import * as React from 'react' ; import * as ReactDOM from 'react-dom' ; import { IPropertyPaneField , PropertyPaneFieldType } from '@microsoft/sp-webpart-base' ; import PropertyFieldLinkHost from './PropertyFieldLinkWithCalloutHost' ; import { IPropertyFieldLinkWithCalloutPropsInternal , IPropertyFieldLinkWithCalloutProps } from './IPropertyFieldLinkWithCallout' ; import omit from 'lodash/omit' ; /**
 * Represents a PropertyFieldLinkWithCallout object
 */ class PropertyFieldLinkWithCalloutBuilder implements IPropertyPaneField < IPropertyFieldLinkWithCalloutPropsInternal > { public targetProperty : string ; public type : PropertyPaneFieldType = PropertyPaneFieldType . Custom ; public properties : IPropertyFieldLinkWithCalloutPropsInternal ; 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 = < IPropertyFieldLinkWithCalloutProps > omit ( this . properties ) ; const element = React . createElement ( PropertyFieldLinkHost , { ... props } ) ; ReactDOM . render ( element , elem ) ; } private _dispose ( elem ) { ReactDOM . unmountComponentAtNode ( elem ) ; } } param targetProperty param properties export function PropertyFieldLinkWithCallout ( targetProperty , properties ) { return new PropertyFieldLinkWithCalloutBuilder ( targetProperty , { ... properties , onRender : null , onDispose : null } ) ; }