UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

171 lines 5.82 kB
import type { IReadonlyTheme } from '@microsoft/sp-component-base'; import type { DisplayMode } from '@microsoft/sp-core-library'; import type { _PropertyPaneAction as PropertyPaneAction, _PropertyPaneLifeCycleEvent as PropertyPaneLifeCycleEvent } from '@microsoft/sp-property-pane'; import type IWebPartData from './IWebPartData'; /** * Event data that is sent via a 'window.postMessage()' function call for the purposes * of executing lifecycle methods between the SpWebPartApplication and the IframedWebPartController. * @internal */ export default interface IIframedWebPartMessage { /** * The action that this data corresponds to. */ action: IframedWebPartAction; /** * The WebPart instanceId that is associated with the WebPartData. */ instanceId: string; /** * The current ClientRect of the iframe element. */ clientRect?: ClientRect; /** * The display mode of the WebPart. */ displayMode?: DisplayMode; /** * The height of the content within the iframe. */ height?: number; /** * Indicates whether the iframe should render fullscreen */ isFullScreen?: boolean; /** * An action requested on the PropertyPane. */ propertyPaneAction?: PropertyPaneAction; /** * The lifecycle event of the PropertyPane. */ propertyPaneLifeCycleEvent?: PropertyPaneLifeCycleEvent; /** * The lifecycle method to call on parent host */ parentHostLifeCycle?: IParentHostLifeCycle; /** * The OBO token request from the isolated web part. */ oboRequest?: { application: string; claims?: string[]; }; /** * The OBO token used by the isolated web part. */ oboToken?: string; /** * Optional IWebPartData, not all actions require web part data. */ webPartData?: IWebPartData; /** * The width of the content within the iframe. */ width?: number; /** * Current theme of the site or page's section */ theme?: IReadonlyTheme; /** * The audiences that the web part is targeted to. */ audiences?: string[]; } /** * Contains the parent host life cycle to call. * If life cycle method fails it will include error object * @internal */ export interface IParentHostLifeCycle { lifeCycleMethod: string; error?: Error; } /** * Strings for the 'action' property on IIframedWebPartMessage. * @internal */ export declare const IframedWebPartAction: { /** * An action to delete the web part. */ readonly DeleteWebPart: "iframeDeleteWebPart"; /** * An action to request the current DisplayMode of a WebPart. */ readonly RequestDisplayMode: "iframeRequestDisplayMode"; /** * An action requested on the PropertyPane. */ readonly RequestPropertyPaneAction: "iframeRequestPropertyPaneAction"; /** * An action to set the DisplayMode of an iframed WebPart. */ readonly SetDisplayMode: "iframeSetDisplayMode"; /** * An action to set the dimensions of the iframe to match it's embed contents. * Example dimensions: height and/or width. */ readonly SetDimensions: "iframeSetDimensions"; /** * An action from the IframedWebPartController to the window that * is showing the WebPart or PropertyPane. */ readonly SetWebPartData: "iframeSetWebPartData"; /** * An action to update the WebPart with the data changed by the PropertyPane. */ readonly UpdateWebPartData: "iframeUpdateWebPartData"; /** * An action to update the PropertyPane with the data changed by the rendered WebPart. */ readonly UpdatePropertyPaneData: "iframeUpdatePropertyPaneData"; /** * The action corresponds to a PropertyPane lifecycle event. */ readonly UpdatePropertyPaneLifeCycle: "iframePropertyPaneLifeCycle"; /** * Action to indicate that the web part is rendered in the iframe application * where the property pane is to be rendered. */ readonly WebPartRenderedInPropertyPaneIframe: "webPartRenderedInPropertyPaneIframe"; /** * Action to communicate a message to the main page from the dynamic data scenarios. */ readonly DynamicDataMessage: "isolatedDynamicDataMessage"; /** * Action corresponds to update life cycle method in page host */ readonly UpdateWebpartLifeCycle: "iframeUpdateWebpartLifeCycle"; /** * Action corresponding to a request from the isolated application to the host for an OBO token. */ readonly GetOboToken: "iframeGetOboToken"; /** * Action corresponding to a response from the host to the isolated application for an OBO token. */ readonly SetOboToken: "iframeSetOboToken"; /** * An action to request the Theme for the current web part. */ readonly RequestTheme: "iframeRequestTheme"; /** * An action to set the Theme of an iframed web part. */ readonly SetTheme: "iframeSetTheme"; /** * Action to communicate to the canvas that the web part's audiences have been updated. */ readonly UpdateAudiences: "iframeUpdateAudiences"; }; /** * Strings for the 'action' property on IIframedWebPartMessage. * @internal */ export type IframedWebPartAction = (typeof IframedWebPartAction)[keyof typeof IframedWebPartAction]; /** * Strings used to update parent host lifecycle methods. * @internal */ export type IframedLifeCycleMethods = 'onBeforeWebPartLoad' | 'onAfterWebPartLoad' | 'onAfterWebPartLoadFailed' | 'onBeforeWebPartInitialize' | 'onAfterWebPartInitialize' | 'onAfterWebPartInitializeFailed' | 'onBeforeWebPartRender' | 'onAfterWebPartRender' | 'onAfterWebPartRenderFailed'; //# sourceMappingURL=IIframedWebPartMessage.d.ts.map