UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

245 lines 7.92 kB
import type { ISerializedServerProcessedData } from '@microsoft/sp-component-base'; /** * This structure represents the serialized state of a web part. * * @remarks * When the `serialize()` API is called on a web part, the output should be this structure. * The structure of the 'properties' field is owned by the web part and is specific to the web part. * Each web part can decide the set of properties it wants to serialize. * * @public */ interface IWebPartData { /** * Universally unique web part Type id. * * @remarks * * Example: `"dbef608d-3ad5-4f8f-b139-d916f2f0a294"` */ id: string; /** * Universally unique instance id of the web part. A web part can have multiple instances on a page. * This id is expected to be universally unique across time and page boundaries. * * @remarks * supported values: a unique string. Could be GUID or other uniquely identifiable formats. * * example: `["dbef608d-3ad5-4f8f-b139-d916f2f0a294"]` */ instanceId: string; /** * Web part title * * @remarks * Used to display the name of the web part in the toolbox, web part gallery and the page. * * Supported values: string less than 100 characters * * Example: `"Text"` */ title: string; /** * Web part description * * @remarks * Used to display the description of the web part. * * Supported values: string with the description. * * Example: `"Text"` */ description?: string; /** * Web part data version * * @remarks * Note that data version is different from the version field in the manifest. * The manifest version is used to control the versioning of the web part code, while data version is used to * control the versioning of the serialized data of the web part. Refer to dataVersion field of your web part * for more information. * * Supported values: MAJOR.MINOR * * Example: `"1.0"` */ dataVersion: string; /** * Web part specific properties. The individual web part owns the definition of these properties. * * @remarks * Used by the web part to manage its internal metadata and config data. The framework code never * touches these properties. * * Supported values: any object hierarchy that can be serialized using `JSON.stringify()`. * * Example: `{ 'value': 'text value' }` */ properties?: any; /** * The collections of data that can be processed by server side services like search index and link fixup */ serverProcessedContent?: ISerializedServerProcessedData; /** * Paths for the dynamic data. * * @remarks * This is used to reconstruct the dynamic data objects when deserializing the web part. * The key is the path within the web part properties, and the value is the dynamic data internal id. * * Example: * ``` * { * 'pageContextUser': * 'PageContext:user', * 'anotherWebPartProperty': * 'WebPart.c3be45f2-7cd9-4e92-9c6c-a01d24dc04cf.3d6307e4-c8e1-4b2d-bef9-f1689c6eb7ea:aProperty' * } * ``` * * @beta */ dynamicDataPaths?: { [path: string]: string; }; /** * Static values for the dynamic data.This is used to reconstruct the dynamic data objects when * deserializing the web part. * * @remarks * The key is the path within the web part properties, and the value is the dynamic data static value. * * Example: * ``` * { * 'aStringProperty': 'thisIsAString', * 'aBooleanProperty': true * } * ``` * * @beta */ dynamicDataValues?: { [path: string]: any; }; /** * Describes the level of isolation needed for the web part. * * @alpha */ isolationLevel?: WebPartIsolationLevel; /** * Icon image URL for the web part * * @internal */ iconImageUrl?: string; /** * Descibes which API is used to modify the web part and when the modification to the web part occurred. * * @internal */ modifiedByGraph?: IModifiedMetadata; /** * Full page icon image URL for the web part * * @internal */ fullPageAppIconImageUrl?: string; /** * List of audiences that should see this web part. All users will be able to see this web part if this list is empty or undefined. * * @internal */ audiences?: string[]; /** * Does this webpart currently have a Dynamic Data Source hookup, as a provider or consumer? Used to disable lazy-loading on page load. * @internal */ containsDynamicDataSource?: boolean; /** * The ID of the Teams app that this web part/ACE is associated with. * * @remarks We need to store this information on the page to initiate Teams permissions check when the page is loaded. * * @internal */ connectedTeamsAppId?: string; /** * Whether or not to show the web part in various view contexts (e.g., mobile, email, etc.). * * @remarks * We implemented this property with one boolean per view contexts for future proofing. * This allows separate rendering conditions for different views, if needed in the future. * * @internal */ hideOn?: IHideOn; } export default IWebPartData; /** * Enum describing different levels isolation supported for a web part. * * @alpha */ export declare enum WebPartIsolationLevel { /** * Web part is not isolated. */ None = "None", /** * Web part's DOM is isolated from the main page's DOM. */ DomIsolation = "DOMIsolation" } /** * @internal */ export interface IModifiedMetadata { apiVersion: 'Graph1.0' | 'GraphBeta' | 'Vroom'; lastModified: number; } /** * Defines whether or not to render this control in the associated view. * * @remarks * Each property's key is the view context that is conditionally rendered based on its boolean value. * Note: Since the default behavior is to show controls, we name this property `HideOn` instead * of `ShowOn`; that way, a possibly `undefined` value properly shows the control by default. * * @internal */ export interface IHideOn { /** * Defines whether or not to render this control in mobile and email views. * * @remarks * We currently use `mobile` to control both mobile and email views. This simplifies the implementation * and avoids risks / code deprecation that accompanies other solutions. For example, separating out to * `mobile` and `email` now will require keeping these properties in sync. If they're out of sync, the * "Show in mobile and email view" property pane toggle (used for both properties) would break. Another * example, `mobileAndEmail` would be more accurate; however, if we need to separate this property into * `mobile` and `email` in the future, we'll need to deprecate (and keep) `mobileAndEmail` to properly * initialize the `mobile` and `email` properties so we respect users' existing web part configurations. * We want to avoid keeping deprecated code, especially at the base web part level, when possible. */ mobile?: boolean; } /** * @internal */ export interface IInternalWebPartData extends IWebPartData { /** * HTML markup equivalent for searchable properties and properties that need link fixup. * * @remarks * * Supported values: a string containing pseudo HTML. * * Example: `"<div>searchable_property_value</div><link href='http://contoso.com/path_of_link.aspx' />"` * * @deprecated Replaced by serverProcessedContent */ htmlProperties?: string; } //# sourceMappingURL=IWebPartData.d.ts.map