UNPKG

@pnp/spfx-property-controls

Version:

Reusable property pane controls for SharePoint Framework solutions

38 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PropertyPanePropertyEditor = PropertyPanePropertyEditor; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const ReactDom = tslib_1.__importStar(require("react-dom")); const sp_property_pane_1 = require("@microsoft/sp-property-pane"); const PropertyPanePropertyEditorHost_1 = tslib_1.__importDefault(require("./PropertyPanePropertyEditorHost")); class PropertyPanePropertyEditorBuilder { constructor(_properties) { //Properties defined by IPropertyPaneField this.type = sp_property_pane_1.PropertyPaneFieldType.Custom; this.properties = { key: _properties.key, webpart: _properties.webpart, onRender: this.onRender.bind(this) }; } render() { if (!this.elem) { return; } this.onRender(this.elem); } onRender(elem, ctx, changeCallback) { if (!this.elem) { this.elem = elem; } const element = React.createElement(PropertyPanePropertyEditorHost_1.default, { webpart: this.properties.webpart }); ReactDom.render(element, elem); } } function PropertyPanePropertyEditor(properties) { return new PropertyPanePropertyEditorBuilder(properties); } //# sourceMappingURL=PropertyPanePropertyEditor.js.map