UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

69 lines 3.14 kB
import { ServiceKey } from '@microsoft/sp-core-library'; import { _LogSource, _QosMonitor, _TraceLogger } from '@microsoft/sp-diagnostics'; import { SPComponentLoader } from '@microsoft/sp-loader'; /** * Loads the property pane module, asynchronously. * @internal */ var PropertyPaneLoader = /** @class */ (function () { function PropertyPaneLoader() { this._logSource = _LogSource.create('PropertyPaneLoader'); } Object.defineProperty(PropertyPaneLoader.prototype, "propertyPane", { /** * Async property pane getter. */ get: function () { var _this = this; if (!this._propertyPaneController) { var propertyPaneQosMonitor_1 = new _QosMonitor('PropertyPaneLoader.loadPropertyPaneModule'); if (DEPRECATED_UNIT_TEST) { // eslint-disable-next-line @rushstack/import-requires-chunk-name return import('@microsoft/sp-property-pane').then(function (propertyPane) { return new propertyPane._ConfigurableOptionsController(); }); } else { return SPComponentLoader.loadComponentById(PropertyPaneLoader._propertyPaneModuleId) .then(function (propertyPane) { if (!_this._propertyPaneController) { _this._propertyPaneController = new propertyPane._ConfigurableOptionsController(); } return Promise.resolve(_this._propertyPaneController); }) .catch(function (error) { _TraceLogger.logErrorData({ source: _this._logSource, error: error }); propertyPaneQosMonitor_1.writeUnexpectedFailure('UnhandledError', error); return Promise.reject(error); }); } } else { return Promise.resolve(this._propertyPaneController); } }, enumerable: false, configurable: true }); Object.defineProperty(PropertyPaneLoader.prototype, "isLoaded", { /** * Whether the property pane controller is loaded. * For scenarios that want to do something ONLY when property pane has been loaded (e.g. Close the property pane * if the property pane is loaded and open. But do nothing if property pane has not even been loaded) */ get: function () { return !!this._propertyPaneController; }, enumerable: false, configurable: true }); /** * Service key to uniquely identify PropertyPaneLoader in the service scope. */ PropertyPaneLoader.serviceKey = ServiceKey.create('sp-webpart-base:PropertyPaneLoader', PropertyPaneLoader); PropertyPaneLoader._propertyPaneModuleId = 'f9e737b7-f0df-4597-ba8c-3060f82380db'; return PropertyPaneLoader; }()); export default PropertyPaneLoader; //# sourceMappingURL=PropertyPaneLoader.js.map