import * as React from 'react' ; import * as ReactDom from 'react-dom' ; import { IPropertyPaneField , PropertyPaneFieldType , IPropertyPaneCustomFieldProps } from '@microsoft/sp-property-pane' ; import PartViewManager , { IPartViewManagerProps } from './components/PartViewManager' ; import ViewSet from '../../data/ViewSet' ; import { ICrmDataProvider } from '../../dataProviders/ICrmDataProvider' ; export interface IViewManagerPropertyPaneFieldProps extends IPropertyPaneCustomFieldProps { views : ViewSet ; data : ICrmDataProvider ; } export default class ViewManagerPropertyPaneField implements IPropertyPaneField < IViewManagerPropertyPaneFieldProps > { public type : PropertyPaneFieldType = PropertyPaneFieldType . Custom ; public targetProperty : string ; public properties : IViewManagerPropertyPaneFieldProps ; private elem : HTMLElement ; constructor ( targetProperty , views , data ) { this . targetProperty = targetProperty ; this . properties = { key : "views" , views : views , data : data , onRender : this . onRender . bind ( this ) } ; } public render ( ) { if ( ! this . elem ) { return ; } this . onRender ( this . elem ) ; } private onRender ( elem ) { if ( ! this . elem ) { this . elem = elem ; } const element = React . createElement ( PartViewManager , { views : this . properties . views , data : this . properties . data } ) ; ReactDom . render ( element , elem ) ; } }