make methods private

This commit is contained in:
Russell Gove 2024-02-16 15:53:10 -05:00
parent 5e34ee7cb7
commit 52ef8554a8
5 changed files with 40 additions and 44 deletions

View File

@ -103,7 +103,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public renderPopup(): JSX.Element {
private renderPopup(): JSX.Element {
if (!this.state.workingStorage) {
return (<div />);
@ -176,7 +176,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public removeMessage(messageList: Array<md.Message>, messageId: string): void {
private removeMessage(messageList: Array<md.Message>, messageId: string): void {
_.remove(messageList, {
Id: messageId
});
@ -189,7 +189,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public removeMainMessage(messageId: string): void {
private removeMainMessage(messageId: string): void {
this.removeMessage(this.state.errorMessages, messageId);
}
/**
@ -199,7 +199,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public removePanelMessage(messageId: string): void {
private removePanelMessage(messageId: string): void {
this.removeMessage(this.state.workingStorage.errorMessages, messageId);
}
/**
@ -212,7 +212,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public changeSearchable(siteUrl: string, propname: string, newValue: boolean): Promise<any> {
private changeSearchable(siteUrl: string, propname: string, newValue: boolean): Promise<any> {
if (newValue) {//make prop searchable
if (_.indexOf(this.state.workingStorage.searchableProps, propname) === -1) {// wasa not searchable, mpw it is
console.log(propname + "was not searchable, now it is ");
@ -242,7 +242,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public stopediting(): void {
private stopediting(): void {
this.setState((current) => ({
...current,
isediting: false,
@ -263,6 +263,8 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
private renderSiteUrl(item?: any, index?: number, column?: IColumn): JSX.Element {
return (<a href={item[column.fieldName]}>{item[column.fieldName]} </a>);
}
/**
* Sets the columns to be displayed in the list.
* These are SiteTemplate, Title and Url, plus any properties specified in
@ -394,7 +396,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public onActiveItemChanged(item?: any, index?: number): void {
private onActiveItemChanged(item?: any, index?: number): void {
this.setState((current) => ({ ...current, selectedIndex: index }));
}
@ -405,7 +407,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public onSave(e?: MouseEvent): void {
private onSave(e?: MouseEvent): void {
const promises: Array<Promise<any>> = [];
for (const prop of this.state.workingStorage.DisplayProps) {
const promise = utils.setSPProperty(prop.crawledPropertyName, prop.value, this.state.workingStorage.Url)
@ -437,7 +439,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public onCancel(e?: MouseEvent): void {
private onCancel(e?: MouseEvent): void {
this.setState((current) => ({ ...current, workingStorage: null, isediting: false }));
}
/**
@ -449,11 +451,11 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
* @memberOf PropertyBagDisplay
*/
public onForceCrawlChange(newValue: boolean): void {
private onForceCrawlChange(newValue: boolean): void {
this.setState(current => ({ ...current, workingStorage: ({ ...current.workingStorage, forceCrawl: newValue }) }));
}
public createSearcheableOnChangedHandler = (managedPropertyName) => (value) => {
private createSearcheableOnChangedHandler = (managedPropertyName) => (value) => {
const dp: DisplayProp = _.find(this.state.workingStorage.DisplayProps, p => { return p.crawledPropertyName === managedPropertyName; });
dp.searchable = value;
this.setState(this.state);
@ -468,7 +470,7 @@ export default class PropertyBagDisplay extends React.Component<IPropertyBagDisp
*
* @memberOf PropertyBagDisplay
*/
public onEditItemClicked(e?: MouseEvent): void {
private onEditItemClicked(e?: MouseEvent): void {
debugger;
console.log("in onEditItemClicked");
const selectedSite = this.state.sites[this.state.selectedIndex];

View File

@ -85,11 +85,11 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
}
/** event hadlers */
public stopediting() {
private stopediting() {
this.setState((current) => ({ ...current, isediting: false }))
}
public onActiveItemChanged(item?: any, index?: number) {
private onActiveItemChanged(item?: any, index?: number) {
this.setState((current) => ({ ...current, selectedIndex: index }))
}
/**
@ -100,7 +100,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
*
* @memberOf PropertyBagEditor
*/
public onSearchableValueChanged(e: Event, newValue: boolean) {
private onSearchableValueChanged(e: Event, newValue: boolean) {
debugger;
this.setState((current) => ({ ...current, workingStorage: ({ ...current.workingStorage, searchable: newValue }) }));
}
@ -112,7 +112,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
*
* @memberOf PropertyBagEditor
*/
public onPropertyValueChanged(event) {
private onPropertyValueChanged(event) {
debugger;
this.setState((current) => ({
...current,
@ -131,7 +131,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
*
* @memberOf PropertyBagEditor
*/
public onEditItemClicked(e?: MouseEvent): void {
private onEditItemClicked(e?: MouseEvent): void {
this.setState((current) => ({ ...current, isediting: true, workingStorage: _.clone(current.displayProps[current.selectedIndex]) }))
}
/**
@ -141,7 +141,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
*
* @memberOf PropertyBagEditor
*/
public onSave(e?: MouseEvent): void {
private onSave(e?: MouseEvent): void {
debugger;
utils.setSPProperty(this.state.workingStorage.crawledPropertyName, this.state.workingStorage.value, this.props.siteUrl)
.then(value => {
@ -160,7 +160,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
*
* @memberOf PropertyBagEditor
*/
public onCancel(e?: MouseEvent): void {
private onCancel(e?: MouseEvent): void {
this.setState((current) => ({ ...current, isediting: false, workingStorage: null }))
}
@ -174,7 +174,7 @@ export default class PropertyBagEditor extends React.Component<IPropertyBagEdito
*
* @memberOf PropertyBagEditor
*/
public changeSearchable(propname: string, newValue: boolean): Promise<any> {
private changeSearchable(propname: string, newValue: boolean): Promise<any> {
if (newValue) {//make prop searchable
if (_.indexOf(this.state.searchableProps, propname) === -1) {// wasa not searchable, mpw it is
const temp = _.clone(this.state.searchableProps);

View File

@ -59,7 +59,7 @@ export default class PropertyBagFilteredSiteListWebPart extends BaseClientSideWe
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
}),
})
,
PropertyPaneTextField("filters", {
label: strings.FiltersFieldLabel,

View File

@ -81,7 +81,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public removeMessage(messageId: string) {
private removeMessage(messageId: string): void {
const messages = this.state.errorMessages;
_.remove(messages, {
Id: messageId
@ -98,7 +98,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public extractUserFilterValues(userFilters: Array<UserFilter>, r): void {
private extractUserFilterValues(userFilters: Array<UserFilter>, r): void {
for (const userFilter of userFilters) {
if (r[userFilter.managedPropertyName]) {
@ -124,7 +124,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, showQueryText: boolean, userFilters: Array<string>, showSiteDescriptions: boolean): void {
private getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, showQueryText: boolean, userFilters: Array<string>, showSiteDescriptions: boolean): void {
const userFilterNameArray = [];
if (userFilters) {
@ -201,7 +201,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public componentDidMount() {
public componentDidMount(): void {
this.getSites(this.props.siteTemplatesToInclude, this.props.filters, this.props.showQueryText, this.props.userFilters, this.props.showSiteDescriptions);
}
@ -216,7 +216,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public conditionallyRenderDescription(site: Site): JSX.Element {
private conditionallyRenderDescription(site: Site): JSX.Element {
if (this.props.showSiteDescriptions) {
return (<Label>{site.description}</Label>);
}
@ -272,7 +272,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public AppliedFilterExists(appliedUserFilters: AppliedUserFilter[], managedPropertyName: string, value: string): boolean {
private AppliedFilterExists(appliedUserFilters: AppliedUserFilter[], managedPropertyName: string, value: string): boolean {
debugger;
const selectedFilter = _.find(appliedUserFilters, af => {
return (af.managedPropertyName === managedPropertyName && af.value === value);
@ -291,7 +291,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public ToggleAppliedUserFilter(appliedUserFilters: AppliedUserFilter[], item: IContextualMenuItem): AppliedUserFilter[] {
private ToggleAppliedUserFilter(appliedUserFilters: AppliedUserFilter[], item: IContextualMenuItem): AppliedUserFilter[] {
if (this.AppliedFilterExists(appliedUserFilters, item.data.managedPropertyName, item.data.value)) {
return appliedUserFilters.filter(af => {
return (af.managedPropertyName !== item.data.managedPropertyName || af.value !== item.data.value);
@ -312,7 +312,7 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public filterSites(appliedUserFilters: AppliedUserFilter[], sites: Site[]): Site[] {
private filterSites(appliedUserFilters: AppliedUserFilter[], sites: Site[]): Site[] {
if (appliedUserFilters.length === 0) {
return sites;
}
@ -342,24 +342,18 @@ export default class PropertyBagFilteredSiteList extends React.Component<IProper
*
* @memberOf PropertyBagFilteredSiteList
*/
public filterOnMetadata(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
private filterOnMetadata(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
const newFilters = this.ToggleAppliedUserFilter(this.state.appliedUserFilters, item);
this.setState((current) => ({ ...current, appliedUserFilters: newFilters, filteredSites: this.filterSites(newFilters, current.sites) }));
}
public doNothing(ev?: React.MouseEvent<HTMLElement>, item?: IContextualMenuItem) {
ev.stopPropagation();
return false;
}
/**
* Renders the list of sites in this.state.filteredSites.
*
* @returns {React.ReactElement<IPropertyBagFilteredSiteListProps>}
*
* @memberOf PropertyBagFilteredSiteList
*/
* Renders the list of sites in this.state.filteredSites.
*
* @returns {React.ReactElement<IPropertyBagFilteredSiteListProps>}
*
* @memberOf PropertyBagFilteredSiteList
*/
public render(): React.ReactElement<IPropertyBagFilteredSiteListProps> {
debugger;

View File

@ -25,7 +25,7 @@ export default class PropertyBagGlobalNav extends React.Component<IPropertyBagGl
*
* @memberOf PropertyBagGlobalNav
*/
public addMenuItem(items: Array<IContextualMenuItem>, r: any): Array<IContextualMenuItem> {
private addMenuItem(items: Array<IContextualMenuItem>, r: any): Array<IContextualMenuItem> {
let currentItem: IContextualMenuItem;
let currentSet: Array<IContextualMenuItem> = items;
@ -59,7 +59,7 @@ export default class PropertyBagGlobalNav extends React.Component<IPropertyBagGl
*
* @memberOf PropertyBagGlobalNav
*/
public getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, managedProperties: Array<string>): void {
private getSites(siteTemplatesToInclude: Array<string>, filters: Array<string>, managedProperties: Array<string>): void {
let querytext = "contentclass:STS_Site ";
if (siteTemplatesToInclude) {