import * as React from 'react' ; import * as ReactDom from 'react-dom' ; import { IPropertyPaneField , PropertyPaneFieldType } from '@microsoft/sp-webpart-base' ; import { IPropertyPanePropertyEditorProps , IPropertyPanePropertyEditorPropsInternal } from './IPropertyPanePropertyEditor' ; import { IPropertyPanePropertyEditorHostProps } from './IPropertyPanePropertyEditorHost' ; import PropertyPanePropertyEditorHost from './PropertyPanePropertyEditorHost' ; class PropertyPanePropertyEditorBuilder implements IPropertyPaneField < IPropertyPanePropertyEditorProps > { public type : PropertyPaneFieldType = PropertyPaneFieldType . Custom ; public targetProperty : string ; public properties : IPropertyPanePropertyEditorPropsInternal ; private elem : HTMLElement ; public constructor ( _properties ) { this . properties = { key : _properties . key , webpart : _properties . webpart , onRender : this . onRender . bind ( this ) } ; } public render ( ) { if ( ! this . elem ) { return ; } this . onRender ( this . elem ) ; } private onRender ( elem , ctx ? , changeCallback ? ) { if ( ! this . elem ) { this . elem = elem ; } const element = React . createElement ( PropertyPanePropertyEditorHost , { webpart : this . properties . webpart } ) ; ReactDom . render ( element , elem ) ; } } export function PropertyPanePropertyEditor ( properties ) { return new PropertyPanePropertyEditorBuilder ( properties ) ; }