This repository has been archived by the owner on Oct 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
sp webpart base.basewebpart
John Nguyen edited this page Apr 22, 2021
·
2 revisions
Home > @microsoft/sp-webpart-base > BaseWebPart
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.
Signature:
export default abstract class BaseWebPart<TProperties extends {}> extends BaseComponent implements IPropertyPaneConsumer
Extends: BaseComponent
Implements: IPropertyPaneConsumer
Constructor | Modifiers | Description |
---|---|---|
(constructor)() | Constructor for the BaseWebPart class. |
Property | Modifiers | Type | Description |
---|---|---|---|
accessibleTitle | string | 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 | |
context | BaseWebPartContext | Use the context object to access common services and state associated with the component. | |
dataVersion | Version | 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 | |
description | string | Description of the WebPart | |
disableReactivePropertyChanges | boolean | This property is used to change the web part's property pane interaction from Reactive to NonReactive. virtual | |
displayMode | DisplayMode | This property is the current display mode of the web part. | |
previewImageUrl | string | undefined | 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 | |
properties | TProperties | This property is the pointer to the custom property bag of the web part. | |
propertiesMetadata | IWebPartPropertiesMetadata | undefined | 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 | |
title | string | Title of the WebPart |
Method | Modifiers | Description |
---|---|---|
getPropertyPaneConfiguration() | 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 | |
loadPropertyPaneResources() | This API enables asynchronous loading of property pane related resources of the web part. | |
onAfterDeserialize(deserializedObject, dataVersion) | This API is called after the web part is deserialized to an object, right before the property bag is populated. virtual | |
onAfterPropertyPaneChangesApplied() | 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 | |
onBeforeSerialize() | This event method is called before the web part is serialized. virtual | |
onDisplayModeChanged(oldDisplayMode) | This event method is called when the display mode of a web part is changed. virtual | |
onDispose() | This API should be used to refresh the contents of the PropertyPane. virtual | |
onInit() | This event method is called when the web part is initialized. virtual | |
onPropertyPaneConfigurationComplete() | This API is invoked when the configuration is completed on the PropertyPane. virtual | |
onPropertyPaneConfigurationStart() | This event method is invoked when the configuration starts on the PropertyPane. virtual | |
onPropertyPaneFieldChanged(propertyPath, oldValue, newValue) | 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 | |
onPropertyPaneRendered() | This API is invoked when the PropertyPane is rendered. virtual |