UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

1,139 lines (1,086 loc) 81.9 kB
/** * SharePoint Framework support for building web parts. * * @remarks * This package defines the APIs used by developers to create a custom web part. * A web part is a reusable visual object that a page author can add to their content, * and customize using a property pane. Examples of web parts include an embedded * video player, a map, a group calendar, a chart, etc. * * @packagedocumentation */ /// <reference types="office-js" /> import { BaseComponent } from '@microsoft/sp-component-base'; import { BaseComponentContext } from '@microsoft/sp-component-base'; import { DisplayMode } from '@microsoft/sp-core-library'; import type { HttpClient } from '@microsoft/sp-http'; import type { IAdaptiveCardExtensionManifest } from '@microsoft/sp-module-interfaces'; import type { IClientSideWebPartManifest } from '@microsoft/sp-module-interfaces'; import type { IClientSideWebPartManifestInstance } from '@microsoft/sp-module-interfaces'; import type { _IComponentContextParameters } from '@microsoft/sp-component-base'; import type { _IComponentPosition } from '@microsoft/sp-component-base'; import type { IComponentPropertyMetadata } from '@microsoft/sp-component-base'; import type { _IConfigurableOptionsController } from '@microsoft/sp-property-pane'; import type { IPropertyPaneConsumer } from '@microsoft/sp-property-pane'; import type { IPropertyPaneCustomFieldProps as IPropertyPaneCustomFieldProps_2 } from '@microsoft/sp-property-pane'; import type { IPropertyPaneData } from '@microsoft/sp-property-pane'; import type { IPropertyPaneField as IPropertyPaneField_2 } from '@microsoft/sp-property-pane'; import { IReadonlyTheme } from '@microsoft/sp-component-base'; import { ISerializedServerProcessedData } from '@microsoft/sp-component-base'; import type { ISpPageContext } from '@ms/odsp-datasources/lib/interfaces/ISpPageContext'; import type { ITopActions } from '@microsoft/sp-top-actions'; import type * as microsoftTeams from '@microsoft/teams-js-v2'; import type { PageContext } from '@microsoft/sp-page-context'; import type { PropertyPaneAction as PropertyPaneAction_2 } from '@microsoft/sp-property-pane'; import type { PropertyPaneLifeCycleEvent } from '@microsoft/sp-property-pane'; import { ServiceKey } from '@microsoft/sp-core-library'; import { ServiceScope } from '@microsoft/sp-core-library'; import { SPEvent } from '@microsoft/sp-core-library'; import { SPEventArgs } from '@microsoft/sp-core-library'; import type { SPHttpClient } from '@microsoft/sp-http'; import type * as SPPropertyPane from '@microsoft/sp-property-pane'; import { Version } from '@microsoft/sp-core-library'; /* Excluded from this release type: _AdaptiveCardExtensionWidthCalculator */ /* Excluded from this release type: _audienceFormServiceKey */ /** * This abstract class implements the the base functionality for a client-side web part. Every client-side web part * needs to inherit from this class. * * @remarks * Along with the base functionality, this class provides some APIs that can be * used by the web part. These APIs fall in two catagories. * * The first category of APIs provide data and functionality. Example, the web part context (i.e. this.context). This * API should be used to access contextual data relevant to this web part instance. * * The second category of APIs provide a base implementation for the web part lifecycle and can be overridden for an * updated implementation. The render() API is the only API that is mandatory to be implemented/overridden by a web * part. All other life cycle APIs have a base implementation and can be overridden based on the needs of the web part. * Please refer to the documentation of the individual APIs to make the right decision. * * @public */ export declare abstract class BaseClientSideWebPart<TProperties> extends BaseWebPart<TProperties> { /** * {@inheritDoc @microsoft/sp-component-base#BaseComponent.context} */ readonly context: WebPartContext; private _firstTimeRenderPromises; private _renderedOnce; private _logSource; /** * Container width allocated for the web part */ private _width; /** * A timer guard, QOS monitor and resolver delegate for the Async render scenarios. An async render scenario * is one in which the web part is rendering an IFRAME OR fetching async data outside of the onInit API * OR rendering an image tag. In these cases much of the web part rendering lifecycle is controlled by external * factors once the IFRAME is created or the data fetch request is sent OR the image tag is set. The web part * needs to call the renderCompleted API once the final rendering is complete and data is displayed. */ private _asyncRenderGuardTimer; private _asyncRenderQosMonitor; private _renderPromiseResolver; private _renderPromiseRejecter; private _asyncRenderCompleteCalled; private _asyncRenderCompleteDidUpdate; /** * Whether the web part is visible. */ private _isVisible; /** * Theme Provider to handle theme changes */ private _internalThemeProvider; /** * Current theme */ private _internalThemeVariant; private _internalIsDisposing; /** * Time when syncRender is finished. */ private _syncRenderTime; /** * Constructor for the BaseClientSideWebPart class. * * @remarks * It is highly recommended that the web part use the `onInit()` API to perform any web part specific * initialization. Most of the web part features like this.context and `this.properties` are not * available to be used before the the `onInit()` part of the web part loading lifecycle. */ constructor(); /** * This property is a pointer to the root DOM element of the web part. This is a DIV element and contains the whole * DOM subtree of the web part. * * @readonly */ protected get domElement(): HTMLElement; /** * This property returns the width of the container for the web part. * @returns Width (in pixels) of the container for the web part. * * @remarks * Web parts should utilize this property to perform operations such as any conditional styling of components * based on the initial available width for the web part. * @readonly */ protected get width(): number; /** * This property indicates whether the web part has been rendered once or not. After the first time rendering, * the value of this property is always true until a full re-render of the web part happens. * * @readonly */ protected get renderedOnce(): boolean; /** * This property indicates whether the web part was rendered from the persisted data (serialized state from the * last time that the web part was saved) or not. * * @remarks * Example: When web part is added for the first time using toolbox then the value is false. * * @readonly */ protected get renderedFromPersistedData(): boolean; /** * This property indicates whether a web part can open a popup on initial render. * * @remarks * In some environments the host * re-renders the web parts frequently, and therefore opening popups during render will cause popups to open * repeatedly, which is a poor user experience. As an example, the classic SharePoint pages perform postbacks * causing the page to re-render on all button clicks. * * If a web part needs to open a popup on render, it should use this API before opening the popup. If this API * returns false, the web part should not open popup on initial render. Some web parts that open popups during * render are the document embed web part that pops up the file picker on initial render, embedded video web part * that pops up the PropertyPane on initial render. * * @readonly */ protected get canOpenPopupOnRender(): boolean; /** * Indicates whether the web part is rendering in Async mode. * * @remarks * If the web part overrides this field to return true, then it needs to call renderCompleted API * after the web part rendering is complete. * * The default value is false. * * @virtual */ protected get isRenderAsync(): boolean; /* Excluded from this release type: isVisible */ /* Excluded from this release type: isVisible */ /* Excluded from this release type: _isDisposing */ /* Excluded from this release type: _internalOnAfterResize */ /* Excluded from this release type: _internalFirstTimeRender */ /* Excluded from this release type: _internalSetDisplayMode */ /* Excluded from this release type: _internalInitialize */ /* Excluded from this release type: _internalDispose */ /** * This API is called to render the web part. There is no base implementation of this API and the web part is * required to override this API. */ protected abstract render(): void; /** * This API should be called by web parts that perform Async rendering. Those web part are required to override * the isRenderAsync API and return true. One such example is web parts that render content in an IFrame. The * web part initiates the IFrame rendering in the `render()` API but the actual rendering is complete only after * the iframe loading completes. * * @param error - error object indicating async render has completed with an error * @param didUpdate - used to override end performance time with sync render time */ protected renderCompleted(error?: Error, didUpdate?: boolean): void; /** * This event method is called when the display mode of a web part is changed. * * @remarks * The default implementation of this API calls * the web part render method to re-render the web part with the new display mode. If a web part developer does not * want a full re-render to happen on display mode change, they can override this API and perform specific updates * to the web part DOM to switch its display mode. * * If the web part is initialized or re-initialized when switching to a different display mode then this * lifecycle method is not called. Example: SharePoint Site Page. * * @param oldDisplayMode - The old display mode. * * @virtual */ protected onDisplayModeChanged(oldDisplayMode: DisplayMode): void; /** * This API should be used to refresh the contents of the PropertyPane. * * @remarks * This API is called at the end of the web part lifecycle on a page. It should be used to dispose any local * resources (i.e. DOM elements) that the web part is holding onto. This API is expected to be called in scenarios * like page navigation i.e. the host is transitioning from one page to another and disposes the page that is being * transitioned out. * * @virtual */ protected onDispose(): void; /** * This API is invoked when the web part container dom element width is changed, e.g. when the browser * browser window is resized and when the property pane is toggled open/closed. * * @param newWidth - Width (in pixels) of the container for the web part after the resize event. * @remarks * Web parts should utilize this method to perform operations such as potentially re-rendering components * based on the new available width for the web part. * * @virtual */ protected onAfterResize(newWidth: number): void; /** * This API is called when a theme is initialized or changed on the page or for the current section. * @param theme - New theme for the page or section * @remarks * Developers sould not call render in overridden method. It can lead to unpredicted re-flow of the web part. * render will be called from the base class when needed. * * @virtual */ protected onThemeChanged(theme: IReadonlyTheme | undefined): void; /** * This API should be used to render an error message in the web part display area. Also logs the error message * using the trace logger. * * @param error - An error object containing the error message to render. */ protected renderError(error: Error): void; /** * This API should be used to clear the error message from the web part display area. */ protected clearError(): void; /* Excluded from this release type: _refresh */ /* Excluded from this release type: _dynamicPropertyRefresh */ /** * Waits for all render promises to resolve before disposing. */ private _disposeAfterRenderPromises; /* Excluded from this release type: _getExtendedWidthCacheKey */ /** * The actual initialization and rendering of the Web part starts when it is close enough * to the Viewport */ private _onInViewport; /** * Wraps render to ensure any type of rendering has access to the latest context * to provide the most accurate accessible info to screen readers. */ private _renderWithAccessibleTitle; /** * Start async guard timer. This timer is to help avoid losing performance markers for a web part * that renders asynchronously but does not call the `renderCompleted` API; */ private _startAsyncRenderGuardTimer; /** * Render completed. * * @param didUpdate - used to override end performance time with sync render time. */ private _renderCompleted; private _handleAsyncRenderFailed; /** * Async render timed out. Log error information and */ private _asyncRenderTimeout; private _logAsyncRenderError; private _clearAsyncRenderGuardTimer; /** * This is called for every web part whether sync or async once rendering is completed. * * @param error - error object indicating asycn render has completed with an error * @param didUpdate - used to override end performance time with sync render time. */ private _resolveOrRejectOnRenderPromise; private _clearRenderPromises; private _internalHandleThemeChangedEvent; } /** * This abstract class implements the UI-agnostic base functionality for a client-side web part. * The purpose is to allow a common core between 2D and MR WebParts. * * @privateRemarks * The _refresh() and _dynamicPropertyRefresh() API are the only API that are * mandatory to be implemented by our base WebPart classes. * * @public */ export declare abstract class BaseWebPart<TProperties extends {}> extends BaseComponent implements IPropertyPaneConsumer { /** * {@inheritDoc @microsoft/sp-component-base#BaseComponent.context} */ readonly context: BaseWebPartContext; /* Excluded from this release type: _renderedFromPersistedData */ private _displayMode; private _properties; private _initialized; /** * Keep a copy of the properties to be used for discard in non-reactive mode and this new set * of `properties('_backUpProperties')` is what will be persisted until the apply button is clicked. */ private _backupProperties; private _previousState; private _baseLogSource; private _title; private _modifiedByGraph; private _description; private _iconImageUrl; private _audiences; /** * It makes sure we only log edit events once during one editing session. */ private _hasEditLogged; /** * Cache init properties value, it would be used to check whether web part has been changed or not. */ private _initPropertiesSnapshot; private _loadPropertyPaneResourcesPromise; private _emptyResolvedPromise; /** * This property points to the preview image for the web part. The base implementation returns undefined. Web parts * that want to provide a valid preview image url need to override this API. The preview image url can be used to * create a preview of the web part or of the page on which the web part is present. * virtual */ get previewImageUrl(): string | undefined; /** * This property is the current display mode of the web part. * * @readonly */ get displayMode(): DisplayMode; /* Excluded from this release type: modifiedByGraph */ /** * The value of this property is stored in the serialized data of the web part to allow developers to manage * versioning of their web part. The default version is 1.0 */ protected get dataVersion(): Version; /** * This property is the pointer to the custom property bag of the web part. * * @readonly */ protected get properties(): TProperties; /** * This property defines metadata for the web part property bag. The metadata can help SharePoint understand * the content of the properties better and perform relevant services on the data. * virtual * * @remarks * See {@link IWebPartPropertiesMetadata} for more information about how to define metadata */ protected get propertiesMetadata(): IWebPartPropertiesMetadata | undefined; /** * This property is used to change the web part's property pane interaction from Reactive to NonReactive. * virtual * * @remarks * The default behavior is Reactive. * * Reactive implies that changes made in the PropertyPane are transmitted to the web part instantly and the user can * see instant updates. This helps the page creator get instant feedback and decide if they should keep the new * configuration changes or not. * * NonReactive implies that the configuration changes are transmitted to the web part only after "Apply" PropertyPane * button is clicked. */ protected get disableReactivePropertyChanges(): boolean; /** * This property points to the accessible title of web part made available to screen readers. The base implementation * returns that default title in the manifest. Web parts that want to provide more descriptive title containing * contextual information need to override this API. * virtual */ protected get accessibleTitle(): string; /** * Title of the WebPart * * @readonly */ protected get title(): string; /* Excluded from this release type: iconImageUrl */ /** * Description of the WebPart * * @readonly */ protected get description(): string; /* Excluded from this release type: audiences */ /** * This property is a pointer to the current set of properties which are already or needs to be persisted. * * @readonly */ private get _persistedProperties(); /** * Constructor for the `BaseWebPart` class. * * @remarks * It is highly recommended that the web part use the OnInit API to perform any web part specific initialization. * Most of the web part features like this.context and this.properties are not available to be used before the * the onInit part of the web part loading lifecycle. */ constructor(); /* Excluded from this release type: _getPropertyPaneData */ /* Excluded from this release type: _loadPropertyPaneResources */ /* Excluded from this release type: _onPropertyPaneFieldChanged */ /* Excluded from this release type: _onPropertyPaneLifeCycleEvent */ /* Excluded from this release type: _isPropertyPaneReactive */ /* Excluded from this release type: _internalSerialize */ /* Excluded from this release type: _internalDispose */ /* Excluded from this release type: _internalOnAfterResize */ /* Excluded from this release type: _internalSetWebPartData */ /* Excluded from this release type: _internalSetDisplayMode */ /* Excluded from this release type: _internalSetDirtyBit */ /* Excluded from this release type: _internalInitialize */ /* Excluded from this release type: _internalDeserialize */ /** * Returns the configuration for this webpart's top actions or undefined if the webpart * doesn't support top actions. */ getTopActionsConfiguration(): ITopActions | undefined; /** * This event method is called when the web part is initialized. * virtual * * @remarks * This API should be overridden to perform long running operations e.g. data fetching from a remote service before * the initial rendering of the web part. The loading indicator is displayed during the lifetime of this method. * This API is called only once during the lifecycle of a web part. */ protected onInit(): Promise<void>; /** * This event method is called when the display mode of a web part is changed. * virtual * * @remarks * The default implementation of this API calls * the web part render method to re-render the web part with the new display mode. If a web part developer does not * want a full re-render to happen on display mode change, they can override this API and perform specific updates * to the web part DOM to switch its display mode. * * If the web part is initialized or re-initialized when switching to a different display mode then this * lifecycle method is not called. Example: SharePoint Site Page. * * @param oldDisplayMode - The old display mode. */ protected onDisplayModeChanged(oldDisplayMode: DisplayMode): void; /** * This event method is called before the web part is serialized. * virtual * * @remarks * The default implementation is a no-op. The serialization * process serializes the web part property bag i.e. this.properties. This API gives the web part a chance to * update it's property bag before the serialization happens. Some web part's may keep their state other objects * or even in the DOM. If a web part needs to persist some of that state, it needs to override this API and update * the web part property bag to the latest state. If a web part updates the property bag with invalid property * values, those will get persisted. So that should be avoided. The web part property bag should always contain * valid property values. */ protected onBeforeSerialize(): void; /** * This API is called after the web part is deserialized to an object, right before the property bag is populated. * virtual * * @remarks * The default implementation is a no-op. A web part developer can override this API if the deserialized object * does not fully reflect the initial state of the property bag. This gives the web part developer a chance to * populate the property bag right after the data is deserialized to an object. * * An important scenario to use deserialize is upgrading. An upgraded web part may load the data * that was serialized by an older version of the web part that supported a different schema of the property bag, * resulting the deserialized object to be inconsistent with the current schema of the property bag. The developer * can use `onAfterDeserialize` to check the dataVersion and fix the property bag. * * @param deserializedObject - The object deserialized from the stored data. Note that the schema of this object * is not necessarily consistent with the current property bag, because the serialization could have been done by * an older version of the web part * @param dataVersion - The data version of the stored data being deserialized. You can use this value to determine * if the data was serialized by an older web part. Web parts can define their data version by overriding the * dataVersion property. * * @returns The property bag of the web part */ protected onAfterDeserialize(deserializedObject: any, dataVersion: Version): TProperties; /** * This API enables asynchronous loading of property pane related resources of the web part. * @virtual * * @remarks * If not overridden by the web part, base web part resolves the promise immediately. * * This method is called before any property pane APIs are called. * Other property pane APIs cannot be called until this promise is resolved. * No other property pane related events are raised except 'PropertyPaneConfigurationComplete'. * * 'PropertyPaneConfigurationComplete' event can be raised to clean up any pending resources * including 'loadPropertyPaneResources' promise. */ protected loadPropertyPaneResources(): Promise<void>; /** * This API is used to ger the configuration to build the property pane for the web part. If the web part wants * to use the PropertyPane for configuration, this API needs to be overridden and the web part needs to return * the configuration for the PropertyPane. * * This API is not invoked until the 'loadPropertyPaneResources' promise is resolved. * * See IPropertyPane and other PropertyPane integration wiki documentation for more details. * virtual */ protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration; /* Excluded from this release type: getDetailsPaneConfiguration */ /** * This API should be used to refresh the contents of the PropertyPane. * virtual * * @remarks * This API is called at the end of the web part lifecycle on a page. It should be used to dispose any local * resources (i.e. DOM elements) that the web part is holding onto. This API is expected to be called in scenarios * like page navigation i.e. the host is transitioning from one page to another and disposes the page that is being * transitioned out. */ protected onDispose(): void; /** * This API is invoked after updating the new value of the property in the property bag when the PropertyPane * is being used in Reactive mode. * virtual * * @param propertyPath - JSON path of the property in the property bag. * In the case of custom field, if no target property is provided then a custom value is assigned, * which will be in the form of `__CustomField_<key provided when the custom field is created>`. * @param oldValue - Old value of the property. * This value could be undefined/empty in the case of custom field. * @param newValue - New value of the property. * This value could be undefined/empty in the case of custom field. */ protected onPropertyPaneFieldChanged(propertyPath: string, oldValue: any, newValue: any): void; /** * This event method is invoked when the configuration starts on the PropertyPane. * virtual * * @remarks * This event method is invoked in the following cases: * * - When the PropertyPane is opened. * * - When the user switches web parts then the new web part gets this event. */ protected onPropertyPaneConfigurationStart(): void; /** * This API is invoked when the configuration is completed on the PropertyPane. * virtual * * @remarks * This event method is invoked in the following cases: * * - When the CONFIGURATION_COMPLETE_TIMEOUT((currently the value is 5 secs) elapses after the last change. * * - When user clicks the "X" (close) button before the CONFIGURATION_COMPLETE_TIMEOUT elapses. * * - When user clicks the 'Apply' button before the CONFIGURATION_COMPLETE_TIMEOUT elapses. * * - When the user switches web parts then the current web part gets this event. */ protected onPropertyPaneConfigurationComplete(): void; /** * This API is invoked after the changes made on the PropertyPane are applied when the PropertyPane is used in * Non-Reactive mode. This API is not invoked when the PropertyPane is used in Reactive mode. * virtual */ protected onAfterPropertyPaneChangesApplied(): void; /** * This API is invoked when the PropertyPane is rendered. * virtual * @privateRemarks * From framework standpoint, we do not want to allow this event handler to be passed in, and trigger it. * This api should be deprecated and then removed as part of refactoring. */ protected onPropertyPaneRendered(): void; /* Excluded from this release type: onAfterPropertiesUpdatedExternally */ /* Excluded from this release type: _internalGetData */ /* Excluded from this release type: _refresh */ /* Excluded from this release type: _dynamicPropertyRefresh */ /* Excluded from this release type: _getDefaultAccessibleTitle */ /* Excluded from this release type: _onPropertyPaneChangesApplied */ /** * This method consumes the properties object from the serialized data and re-applies * the field values from the serverProcessedContent. This process will result in the * properties bag as it was when the serialization happened. */ private _reInstateServerProcessedData; /** * Iterates and validates each metadata property before calling metadata processor. * * @param metadataProcessor - Callback handler to to process validated metadata. * @param properties - Optional properties to process instead of default this.properties */ private _forEachPropertyWithMetaData; /** * Validates path and iterate over one or multiple wildcard paths * * @param propPath - Original property path provided in metadata * @param properties - Properties to look for the given path. * @param propertyPathHandler - Handler to process validated and fixed path */ private _validateAndIteratePath; /** * Operations to be done after the property bag is updated. * * @param shouldRefresh - Indicating whether web part needs to be shouldRefresh or not. */ private _afterPropertyUpdated; /** * Fixes up a property pane configuration to use dynamic data. This happens in-place. * The fix-up consists on adding the necessary hooks to the web part that are required, * like the dynamic data provider, the render function and the object it refers to. * * @param configuration - Property pane configuration to fix up. */ private _fixUpDynamicDataConfiguration; /** * Adds a new group with an audiences picker to the first page of the property pane configuration. * This happens in-place. * * @param configuration - Property pane configuration to add the audience targeting picker group to */ private _addAudienceTargetingConfiguration; /** * The serializer for the exposed part of the web part data * * @privateRemarks * This serialize API is a public candidate for post-GA (after removing the input parameter) */ private _serialize; /** * This function serializes the Dynamic Data objects from the web part properties into the serialized web part data. * * If there is a property "myDynamicProperty" in the property bag that points to `"PageContext:user"`, * the serialized data is updated as the following: * ``` * serializedData = { * dynamicDataPaths: { * "myDynamicProperty": "PageContext:user" * } * } * ``` */ private _serializeDynamicData; /** * This function deserializes the Dynamic Data objects from serialized web part data into web part properties. * * If the serializedData has a "dynamicDataPaths" or "dynamicDataValues" property, * it creates DynamicData objects for it. * * Example: * ``` * serializedData = { * dynamicDataPaths: { * "myDynamicProperty": "PageContext:user" * } * } * ``` * * This will create a property "myDynamicProperty" in the web parts properties, with a new DynamicData object that * points at "PageContext:user" */ private _deserializeDynamicData; /** * For each property in the serialized properties of the web part, we check if the property is declared * as dynamicProperty in the properties metadata of the web part. * - If yes, then we check * - if the value of it is an instance of DynamicProperty * - If No, then we create and assign a DynamicProperty with the type given specified in the * 'dynamicPropertyType' property * - else, it's a no-op. * - If no, then it's a no-op * * While creating the DynamicProperty, we use the pre-configured value associated with that property from * the web part's property bag as the default value. * @param deSerializedProperties - deserialized properties of the web part. */ private _initializeDynamicPropertiesIfRequired; /** * Disposing the dynamic properties, for those which are declared as dynamic properties. * * @privateRemarks * We are disposing only the declared dynamic properties because we created them on behalf of * the web part and hence it is our responsiblity to clean them. */ private _disposeDynamicPropertiesIfRequired; /** * Update the web part property if it is in the property bag. * * @param propertyPath - property path as expected by lodash update (https://lodash.com/docs#update). * (e.g. 'o.a.b', 'o[0].a.b[1].c'). These paths are similar to those in the JSONPath spec described by * Stefan Goessner at (http://goessner.net/articles/JsonPath/). Currently we plan to use lodash.get, has * and update APIs which support paths. Some day we may migrate to using actual JSONPath.js. But that * should not be an issue because the path formatting conventions are same in lodash and JSONPath. * @param newValue - new value entered by the user for the associated target property */ private _updateProperty; /** * Using 'cloneDeepWith' because the web part properties bag will now serialize the * dynamic properties as well. One of the building blocks of these properties are dataProviders, * which when serialized will result in 'Maximum call stack size exceeded' based on what kind of * sources they hold references to. * Hence using cloneDeepWith, which lets us handle the special cases and in this case if the property * in question is a 'DynamicProperty' and we call '_cloneDeep' api on the dynamicProperty. */ private _cloneProperties; } /** * Web part context object. This object contains the contextual services available to a web part. e.g. * a contextual instance to the http client. * * This base is to be extended by UI-specific WebPart's base. * * @public */ export declare class BaseWebPartContext extends BaseComponentContext { /** * {@inheritDoc @microsoft/sp-component-base#BaseComponentContext.manifest} */ readonly manifest: IClientSideWebPartManifestInstance<any>; private _webPartTag; private _requestPropertyPaneAction; private _isPropertyPaneRenderedByWebPart; private _isPropertyPaneOpen; private _isContentPanelOpen; private _host; private _propertyPaneAccessor; private _privateDataUpdatedEvent; private _formFactor; /* Excluded from this release type: __constructor */ /** * Web part tag to be used for logging and telemetry. */ get webPartTag(): string; /** * Accessor for common web part property pane operations. */ get propertyPane(): IPropertyPaneAccessor; /* Excluded from this release type: formFactor */ /* Excluded from this release type: host */ /* Excluded from this release type: _dataUpdatedEvent */ } /* Excluded from this release type: _BaseWebPartHost */ /** * Callback to clear the dom node. */ declare type ClearDomElementCallback = (domElement: Element) => void; /* Excluded from this release type: ClientSideWebPartManager */ /* Excluded from this release type: ClientSideWebPartManagerFactory */ /* Excluded from this release type: _ClientSideWebPartStatusRenderer */ /* Excluded from this release type: CONTENT_PANEL_TOGGLED */ /** * Enum for the possible values of shared depth of the dynamic data reference. * * @public * @deprecated This is obsolete now. This enum has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare enum DynamicDataSharedDepth { /** * Indicates that nothing is shared. */ None = 0, /** * Indicates that the dynamic data source is shared. */ Source = 1, /** * Indicates that both the dynamic data source and the property are shared. */ Property = 2 } /* Excluded from this release type: _getErrorAceLoadConfiguration */ /* Excluded from this release type: IAdaptiveCardExtensionManifest */ /* Excluded from this release type: _IAudienceFormOptions */ /* Excluded from this release type: _IAudienceFormService */ /* Excluded from this release type: _IBaseWebPartContextParameters */ /* Excluded from this release type: _ICardWidthMap */ /** * Interface to be implemented by a component that should display the loading indicator and * error messages for a web part. * * @public */ export declare interface IClientSideWebPartStatusRenderer { /** * Display a loading spinner. * @param domElement - the web part container div. * @param loadingMessage - the message to be displayed when the loading spinner id displayed. * @param timeout - timeout to render the loading indicator. Default is 1500ms. * @param clearDomElementCallback - Callback to clear the dom node before rendering the indicator. Standard DOM API will be used after the callback. */ displayLoadingIndicator(domElement: Element, loadingMessage: string, timeout?: number, clearDomElementCallback?: ClearDomElementCallback): void; /** * Clear the loading indicator. * @param domElement - the web part container div. */ clearLoadingIndicator(domElement: Element): void; /** * Render the provided error message in the webpart container div. * @param domElement - the web part container div. * @param error - the error message. * @param clearDomElementCallback - Callback to clear the dom node before rendering the error element. Standard DOM API will be used after the callback. */ renderError(domElement: HTMLElement, error: Error | string, clearDomElementCallback?: ClearDomElementCallback): void; /** * Clear the webpart error message. * @param domElement - the web part container div. */ clearError(domElement: HTMLElement): void; } /* Excluded from this release type: _IComponentContextParameters */ /* Excluded from this release type: _IComponentPosition */ /* Excluded from this release type: _IConfigurableOptionsController */ /** * Configuration related to a shared property. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IDynamicDataSharedPropertyConfiguration extends SPPropertyPane.IDynamicDataSharedPropertyConfiguration { } /** * Property pane dynamic data property filters. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IDynamicDataSharedPropertyFilters extends SPPropertyPane.IDynamicDataSharedPropertyFilters { } /** * Configuration related to a shared source. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IDynamicDataSharedSourceConfiguration extends SPPropertyPane.IDynamicDataSharedSourceConfiguration { } /** * Property pane dynamic data source filters. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IDynamicDataSharedSourceFilters extends SPPropertyPane.IDynamicDataSharedSourceFilters { } /* Excluded from this release type: _IframedLifeCycleMethods */ /* Excluded from this release type: _IframedWebPartAction */ /* Excluded from this release type: _IIframedWebPartMessage */ /* Excluded from this release type: IInternalWebPartData */ /* Excluded from this release type: _IIsolatedItemContext */ /** * Provides access to the Teams SDK and Teams context. Only provided when the web part is loaded in Teams. * * @public */ export declare interface IMicrosoftTeams { /** * Microsoft Teams SDK. */ teamsJs: typeof microsoftTeams; /** * Microsoft Teams' Context. * * @deprecated * This property is deprecated. Use the `teamsJs.app.getContext()` method instead. * * @remarks * For more information, please see: * {@link https://docs.microsoft.com/en-us/javascript/api/@microsoft/teams-js/microsoftteams.context?view=msteams-client-js-latest} */ context: microsoftTeams.Context; } /* Excluded from this release type: _IMinimalWebPartContainerProps */ /* Excluded from this release type: IModifiedMetadata */ /* Excluded from this release type: IOffice */ /* Excluded from this release type: IParentHostLifeCycle */ /** * Web part context property pane accessor interface. Provides some most commonly used operations * to access the property pane and content panel. * * @public */ export declare interface IPropertyPaneAccessor { /** * This API should be used to open the PropertyPane or Content Panel to help configure the web part. */ open(): void; /** * This API should be used to close the PropertyPane or Content Panel to help configure the web part. */ close(): void; /** * This API should be used to open the Details PropertyPane/Content Panel to help configure the items in the web part. * @remarks * This API is mainly used for configuring Details, which is different from configuring the web part itself. * * @param context - Add additional context for property pane or content panel */ openDetails(context?: any): void; /** * This API should be used to invoke the PropertyPane or Content Panel to help configure the web part. * * @remarks * This operation only works when the PropertyPane is already open for the currently active web part. * If the PropertyPane is opened for another web part, calling the refresh API will have no impact. */ refresh(): void; /** * Indicates whether the PropertyPane/Content Panel was initially opened by the web part. * @remarks * For example, if the web part calls this.context.propertyPane.open() then the property would be true, * whereas if the configuration was opened by the host, then the value will be false. */ isRenderedByWebPart(): boolean; /** * Returns true if the PropertyPane is open. * @remarks * This is true whenever the Property Pane is open whether it is hosted in the Content Panel * or traditional Property Pane UI. * */ isPropertyPaneOpen(): boolean; /* Excluded from this release type: isPropertyPaneOpen */ /* Excluded from this release type: isContentPanelOpen */ } /** * PropertyPane button props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneButtonProps extends SPPropertyPane.IPropertyPaneButtonProps { } /** * PropertyPane CheckBox component props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneCheckboxProps extends SPPropertyPane.IPropertyPaneCheckboxProps { } /** * PropertyPane ChoiceGroup option props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneChoiceGroupOption extends SPPropertyPane.IPropertyPaneChoiceGroupOption { } /** * PropertyPane ChoiceGroup icon props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneChoiceGroupOptionIconProps extends SPPropertyPane.IPropertyPaneChoiceGroupOptionIconProps { } /** * PropertyPane ChoiceGroup props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneChoiceGroupProps extends SPPropertyPane.IPropertyPaneChoiceGroupProps { } /** * Property pane conditional group. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneConditionalGroup extends SPPropertyPane.IPropertyPaneConditionalGroup { } /** * Web part configuration settings * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneConfiguration extends SPPropertyPane.IPropertyPaneConfiguration { } /* Excluded from this release type: IPropertyPaneConsumer */ /** * PropertyPane CustomPropertyField props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneCustomFieldProps extends SPPropertyPane.IPropertyPaneCustomFieldProps { } /* Excluded from this release type: IPropertyPaneData */ /** * PropertyPane dropdown callout properties. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneDropdownCalloutProps extends SPPropertyPane.IPropertyPaneDropdownCalloutProps { } /** * PropertyPane drop down options. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneDropdownOption extends SPPropertyPane.IPropertyPaneDropdownOption { } /** * PropertyPane drop down component props. * * @public * @deprecated This is obsolete now. This interface has been moved to `@microsoft/sp-property-pane`. * Please consume it from there. * @remarks We have left the original implementation here to avoid breaking the public API contract. */ export declare interface IPropertyPaneDropdownProps extends SPPropertyPane.IPropertyPaneDropdownProps { } /** * Property pane dynamic field filters which is an intersection of both * source and property filters. * * @public * @deprecated This is obsolete now. This interface has be