Created
December 11, 2018 15:41
-
-
Save vman/1e02c498ba27e3f40f2fb11a86845a0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class SiteInformationWebPart extends BaseClientSideWebPart<ISiteInformationWebPartProps> { | |
private propertyFieldTermPicker; | |
private propertyFieldPeoplePicker; | |
private principalType; | |
//onInit(), render() functions removed for brevity | |
//function executes only before property pane is loaded. | |
protected async loadPropertyPaneResources(): Promise<void> { | |
const { PropertyFieldTermPicker } = await import ( | |
/* webpackChunkName: 'pnp-propcontrols-termpicker' */ | |
'@pnp/spfx-property-controls/lib/PropertyFieldTermPicker' | |
); | |
const { PropertyFieldPeoplePicker, PrincipalType } = await import ( | |
/* webpackChunkName: 'pnp-propcontrols-peoplepicker' */ | |
'@pnp/spfx-property-controls/lib/PropertyFieldPeoplePicker' | |
); | |
this.propertyFieldTermPicker = PropertyFieldTermPicker; | |
this.propertyFieldPeoplePicker = PropertyFieldPeoplePicker; | |
this.principalType = PrincipalType; | |
} | |
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { | |
return { | |
pages: [ | |
{ | |
header: { | |
description: strings.PropertyPaneDescription | |
}, | |
groups: [ | |
{ | |
groupName: strings.BasicGroupName, | |
groupFields: [ | |
this.propertyFieldPeoplePicker('siteContact', { | |
label: strings.SiteContactFieldLabel, | |
initialData: this.properties.siteContact, | |
principalType: [this.principalType.Users], | |
//other properties removed for brevity | |
}), | |
this.propertyFieldTermPicker('siteOrganization', { | |
label: strings.SiteOrganizationFieldLabel, | |
panelTitle: strings.SiteOrganizationPanelTitle, | |
initialValues: this.properties.siteOrganization | |
//other properties removed for brevity | |
}) | |
] | |
} | |
] | |
} | |
] | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment