UNPKG

@mikezimm/npmfunctions

Version:
63 lines (47 loc) 2.74 kB
/** * To use this feature: * Apply these changes * * ## Copy this to main WebpartProperties import { IWebpartHistory, IWebpartHistoryItem2, } from '@mikezimm/npmfunctions/dist/Services/PropPane/WebPartHistory/Interface'; //ADDED FOR WEBPART HISTORY: webpartHistory: IWebpartHistory; ## Copy this to main WebpartProperties //Add this to MAIN WEBPART.ts import { IWebpartHistory, IWebpartHistoryItem2, } from '@mikezimm/npmfunctions/dist/Services/PropPane/WebPartHistory/Interface'; import { createWebpartHistory, updateWebpartHistory } from '@mikezimm/npmfunctions/dist/Services/PropPane/WebPartHistoryFunctions'; //ADDED FOR WEBPART HISTORY: - // === TO main webpart class private thisHistoryInstance: IWebpartHistoryItem2 = null; //ADDED FOR WEBPART HISTORY: This sets the webpartHistory - // === TO END OF onInit function this.thisHistoryInstance = createWebpartHistory( 'onInit' , 'new', this.context.pageContext.user.displayName ); let priorHistory : IWebpartHistoryItem2[] = this.properties.webpartHistory ? this.properties.webpartHistory.history : []; this.properties.webpartHistory = { thisInstance: this.thisHistoryInstance, history: priorHistory, }; //ADDED FOR WEBPART HISTORY: This sets the webpartHistory // === TO PropertyPaneChanged this.properties.webpartHistory = updateWebpartHistory( this.properties.webpartHistory , propertyPath , newValue, this.context.pageContext.user.displayName ); */ import { IWebpartHistoryItem2, IWebpartHistory } from './Interface'; export declare function createWebpartHistory(prop: any, newValue: any, user: string): IWebpartHistoryItem2; export declare function updateCurrentHistorySaved(allHistory: IWebpartHistory, thisInstance: IWebpartHistoryItem2): IWebpartHistory; export declare function upgradeV1History(allHistory: IWebpartHistory): IWebpartHistory; export declare type ITrimThis = 'start' | 'end' | 'none'; /** * Added 2022-07-25 from FPSPageInfo to simplify re-usability. * It just has logic to get the trimThis based on the passed in array of strings * @param webpartHistory * @param prop * @param newValue * @param user * @param noTrimProps * @param startTrimProps * @param trimLength * @returns */ export declare function updateWebpartHistoryV2(webpartHistory: IWebpartHistory, prop: string, newValue: any, user: string, noTrimProps: string[], startTrimProps: string[], trimLength?: number): IWebpartHistory; export declare function updateWebpartHistory(webpartHistory: IWebpartHistory, prop: string, newValue: any, user: string, trimThis?: ITrimThis, trimLength?: number): IWebpartHistory;