Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new TestWebPart(context: IWebPartContext): TestWebPart

Properties

Protected accessibleTitle

accessibleTitle: string
internal

Protected canOpenPopupOnRender

canOpenPopupOnRender: boolean

This property indicates whether a web part can open a popup on initial render. In some environments the host re-renders the web parts frequently, and therefor, opening popups during render will cause popups to open repeatedly and hence poor user experience. As an example, the classic SharePoint pages perform postbacks and hence page 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 context

context: IWebPartContext

Error on attempt to set readonly properties. The following properties will go away when TypeScript supports readonly.

internal

Protected description

description: string
internal

Protected displayMode

displayMode: DisplayMode
internal

Protected domElement

domElement: HTMLElement
internal

Protected instanceId

instanceId: string
internal

Protected isRenderAsync

isRenderAsync: boolean

Indicates whether the web part is rendering in Async mode. Default value is false. If the web part overrides this field to return true, then it needs to call renderCompleted API after the web part rendering is complete.

Protected previewImageUrl

previewImageUrl: string | undefined
internal

Protected properties

properties: ITestWebPartProps
internal

Protected propertiesMetadata

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.

see

IWebPartPropertiesMetadata for more information about how to define metadata

Protected propertyPaneRenderedByWebPart

propertyPaneRenderedByWebPart: boolean
internal

Protected renderedFromPersistedData

renderedFromPersistedData: boolean
internal

Protected renderedOnce

renderedOnce: boolean
internal

Protected title

title: string
internal

Protected width

width: number

This value is the available width of the area in which the web part can render itself.

readonly
alpha

Accessors

Protected dataVersion

  • get dataVersion(): Version

Protected disableReactivePropertyChanges

  • get disableReactivePropertyChanges(): boolean

Methods

Protected clearError

  • clearError(): void
  • This API should be used to clear the error message from the web part display area.

    Returns void

Protected getPropertyPaneConfiguration

  • getPropertyPaneConfiguration(): IPropertyPaneConfiguration

Protected onAfterDeserialize

  • onAfterDeserialize(deserializedObject: any, dataVersion: Version): ITestWebPartProps
  • This API is called after the web part is deserialized to an object, right before the property bag is populated. 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.

    remarks

    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 incosistent with the current schema of the property bag. The developer can use onAfterDeserialize to check the dataVersion and fix the property bag.

    Parameters

    • deserializedObject: any

      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

    • dataVersion: Version

      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 ITestWebPartProps

    The property bag of the web part

Protected onAfterPropertyPaneChangesApplied

  • onAfterPropertyPaneChangesApplied(): 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.

    Returns void

Protected onAfterResize

  • onAfterResize(newWidth: number): 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/close.

    Webparts should utilize this method to perform operations such as potentially re-rendering components based on the new availble width for the webpart.

    alpha

    Parameters

    • newWidth: number

    Returns void

Protected onBeforeSerialize

  • onBeforeSerialize(): void
  • This API is called before the web part is serialized. 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.

    Returns void

Protected onDisplayModeChanged

  • onDisplayModeChanged(oldDisplayMode: DisplayMode): void
  • This API is called when the display mode of a web part is changed. 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.

    Parameters

    • oldDisplayMode: DisplayMode

      The old display mode.

    Returns void

Protected onDispose

  • onDispose(): void
  • This API should be used to refresh the contents of the PropertyPane. 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.

    Returns void

Protected onEvent

  • onEvent<T>(eventName: string, eventObject: IWebPartEvent<T>): void
  • This API is used to receive custom event notifications from the host page or another web part. ReservedEventNames defines some reserved events. Each web part may process web part specific events.

    internal

    Type parameters

    • T

    Parameters

    • eventName: string

      Event name, such as "setPropertyPaneState".

    • eventObject: IWebPartEvent<T>

      object containing event source, destination and property information.

    Returns void

Protected onInit

  • onInit(): Promise<void>
  • 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.

    Returns Promise<void>

Protected onPropertyPaneConfigurationComplete

  • onPropertyPaneConfigurationComplete(): void
  • This API is invoked when the configuration is completed on the PropertyPane. It's invoked in the following cases:

    • When the CONFIGURATION_COMPLETE_TIMEOUT((currently the value is 5 secs) elapses after the last change.
    • When user clicks 'x'(close) button before the CONFIGURATION_COMPLETE_TIMEOUT elapses.
    • When user clciks 'Apply' button before the CONFIGURATION_COMPLETE_TIMEOUT elapses.
    • When the user switches web parts then the current web part gets this event.

    Returns void

Protected onPropertyPaneConfigurationStart

  • onPropertyPaneConfigurationStart(): void
  • This API is invoked when the configuration starts on the PropertyPane. It's invoked in the following cases:

    • When the PropertyPane is opened.
    • When the user switches web parts then the new web part gets this event.

    Returns void

Protected onPropertyPaneFieldChanged

  • onPropertyPaneFieldChanged(propertyPath: string, oldValue: any, newValue: any): 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. The base implementation of this API re-renders the web part.

    Parameters

    • propertyPath: string

      JSON path of the property in the property bag.

    • oldValue: any

      Old value of the property.

    • newValue: any

      New value of the property.

    Returns void

Protected onPropertyPaneRendered

  • onPropertyPaneRendered(): void
  • This API is invoked when the PropertyPane is rendered.

    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.

    Returns void

render

  • render(): void

Protected renderCompleted

  • renderCompleted(): 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.

    Returns void

Protected renderError

  • renderError(error: Error): 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.

    Parameters

    • error: Error

      An error object containing the error message to render.

    Returns void

Generated using TypeDoc