import * as React from 'react' ; import * as ReactDOM from 'react-dom' ; import { IPropertyPaneField , PropertyPaneFieldType } from '@microsoft/sp-webpart-base' ; import PropertyFieldCheckboxHost from './PropertyFieldCheckboxWithCalloutHost' ; import { IPropertyFieldCheckboxWithCalloutPropsInternal , IPropertyFieldCheckboxWithCalloutProps } from './IPropertyFieldCheckboxWithCallout' ; /**
 * Represents a PropertyFieldCheckboxWithCallout object
 */ class PropertyFieldCheckboxWithCalloutBuilder implements IPropertyPaneField < IPropertyFieldCheckboxWithCalloutPropsInternal > { public targetProperty : string ; public type : PropertyPaneFieldType = PropertyPaneFieldType . Custom ; public properties : IPropertyFieldCheckboxWithCalloutPropsInternal ; private _onChangeCallback : ( targetProperty ? : string , newValue ? : any ) => void ; public constructor ( _targetProperty , _properties ) { this . targetProperty = _targetProperty ; this . properties = _properties ; this . properties . onRender = this . _render . bind ( this ) ; this . properties . onDispose = this . _dispose . bind ( this ) ; } private _render ( elem , context ? , changeCallback ? ) { const props = < IPropertyFieldCheckboxWithCalloutProps > this . properties ; const element = React . createElement ( PropertyFieldCheckboxHost , { ... props , onChange : this . _onChange . bind ( this ) } ) ; ReactDOM . render ( element , elem ) ; if ( changeCallback ) { this . _onChangeCallback = changeCallback ; } } private _dispose ( elem ) { ReactDOM . unmountComponentAtNode ( elem ) ; } private _onChange ( e , value ) { if ( this . _onChangeCallback ) { this . _onChangeCallback ( this . targetProperty , value ) ; } } } param targetProperty param properties export function PropertyFieldCheckboxWithCallout ( targetProperty , properties ) { return new PropertyFieldCheckboxWithCalloutBuilder ( targetProperty , { ... properties , onRender : null , onDispose : null } ) ; }