import * as React from 'react' ; import * as ReactDom from 'react-dom' ; import { IPropertyPaneField , PropertyPaneFieldType } from '@microsoft/sp-property-pane' ; import { BaseComponentContext } from '@microsoft/sp-component-base' ; import { IPropertyFieldSitePickerPropsInternal , IPropertyFieldSite , IPropertyFieldSitePickerProps } from './IPropertyFieldSitePicker' ; import { IPropertyFieldSitePickerHostProps } from './IPropertyFieldSitePickerHost' ; import PropertyFieldSitePickerHost from './PropertyFieldSitePickerHost' ; /**
 * Represents a PropertyFieldSitePicker object
 */ class PropertyFieldSitePickerBuilder implements IPropertyPaneField < IPropertyFieldSitePickerPropsInternal > { public type : PropertyPaneFieldType = PropertyPaneFieldType . Custom ; public targetProperty : string ; public properties : IPropertyFieldSitePickerPropsInternal ; private label : string ; private disabled : boolean = false ; private context : BaseComponentContext ; private initialSites : IPropertyFieldSite [ ] ; private multiSelect : boolean = false ; private onPropertyChange : ( propertyPath : string , oldValue : any , newValue : any ) => void ; private customProperties : any ; private key : string ; private onGetErrorMessage : ( value : IPropertyFieldSite [ ] ) => string | Promise < string > ; private deferredValidationTime : number = 200 ; private trimDuplicates : boolean ; private additionalQuery : string | undefined ; /**
     * Constructor method
     */ public constructor ( _targetProperty , _properties ) { this . render = this . render . bind ( this ) ; this . label = _properties . label ; this . targetProperty = _properties . targetProperty ; this . properties = _properties ; this . properties . onDispose = this . dispose ; this . properties . onRender = this . render ; this . onPropertyChange = _properties . onPropertyChange ; this . context = _properties . context ; this . initialSites = _properties . initialSites ; this . customProperties = _properties . properties ; this . key = _properties . key ; this . onGetErrorMessage = _properties . onGetErrorMessage ; this . trimDuplicates = _properties . trimDuplicates ; this . additionalQuery = _properties . additionalQuery ; if ( typeof _properties . disabled !== 'undefined' ) { this . disabled = _properties . disabled ; } if ( _properties . deferredValidationTime ) { this . deferredValidationTime = _properties . deferredValidationTime ; } if ( typeof _properties . multiSelect !== "undefined" ) { this . multiSelect = _properties . multiSelect ; } } /**
     * Renders the PeoplePicker field content
     */ private render ( elem , ctx ? , changeCallback ? ) { const element = React . createElement ( PropertyFieldSitePickerHost , { label : this . label , disabled : this . disabled , targetProperty : this . targetProperty , initialSites : this . initialSites , multiSelect : this . multiSelect , onDispose : this . dispose , onRender : this . render , onChange : changeCallback , onPropertyChange : this . onPropertyChange , context : this . context , properties : this . customProperties , key : this . key , onGetErrorMessage : this . onGetErrorMessage , deferredValidationTime : this . deferredValidationTime , trimDuplicates : this . trimDuplicates , additionalQuery : this . additionalQuery } ) ; ReactDom . render ( element , elem ) ; } /**
    * Disposes the current object
    */ private dispose ( elem ) { } } param targetProperty param properties export function PropertyFieldSitePicker ( targetProperty , properties ) { return new PropertyFieldSitePickerBuilder ( targetProperty , { ... properties , targetProperty : targetProperty , onDispose : null , onRender : null } ) ; }