UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

89 lines (87 loc) 6.03 kB
/** * CodeAnalizerComment: Updated 3 imports on 2024-09-22 14:49:52 * Update:: import { buildExportPropsX } to '@mikezimm/fps-core-v7/lib/banner/features/ImportExport/BuildExportPropsX;' * Update:: import { IWebpartBannerProps } to '@mikezimm/fps-core-v7/lib/banner/mainReact/IWebpartBannerProps;' * Update:: import { IThisFPSWebPartClass } to '@mikezimm/fps-core-v7/lib/banner/FPSWebPartClass/IThisFPSWebPartClass1152;' */ /** * CodeAnalizerComment: Updated 4 imports on 2024-09-21 23:07:24 * Update:: import { startPerformOp } to '@mikezimm/fps-core-v7/lib/components/molecules/Performance/functions;' * Update:: import { updatePerformanceEnd } to '@mikezimm/fps-core-v7/lib/components/molecules/Performance/functions;' * Update:: import { buildExportPropsX } to '@mikezimm/fps-core-v7/lib/banner/features/ImportExport/BuildExportPropsX;' * Update:: import { IThisFPSWebPartClass } to '@mikezimm/fps-core-v7/lib/banner/FPSWebPartClass/IThisFPSWebPartClass1152;' */ import { addCanvasBGImageComponent } from '../../components/molecules/FullPageBackGround/addCanvasBGImageComponent'; import { startPerformOp, updatePerformanceEnd } from '@mikezimm/fps-core-v7/lib/components/molecules/Performance/functions'; import { buildExportPropsX } from '@mikezimm/fps-core-v7/lib/banner/features/ImportExport/BuildExportPropsX'; import { renderCustomStyles } from '../features/PageStyle/renderCustStyles'; import { mainWebPartRenderBannerSetupX } from './BuildBannerPropsX2'; import { updateSectionBGStyles } from '../../components/molecules/FullPageBackGround/SectionStyles'; import { PackageVersionLabelFpsLv2, PackageVersionTimeFpsLv2 } from '../../PackageVersion'; import { PackageVersionLabelFpsCv7, PackageVersionTimeFpsCv7 } from '@mikezimm/fps-core-v7/lib/PackageVersion'; import { PackageVersionLabelFpsSty, PackageVersionTimeFpsSty } from '../../PackageVersionStyles'; /** * * @param thisWPClass * @param strings * @param WebPartAnalyticsChanges * @param WebPartPanelChanges * @param SPPermission - get from: import { SPPermission } from '@microsoft/sp-page-context'; * @param alreadyStartedPerformOp * @returns */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export function runFPSWebPartRender(thisWPClass, strings, // eslint-disable-next-line @typescript-eslint/no-explicit-any WebPartAnalyticsChanges, WebPartPanelChanges, SPPermission, alreadyStartedPerformOp = false) { /** * NOTE FROM TESTING, Only deconstruct things that do NOT change. * If I deconstructed _performance, _sitePresets, _FPSUser, then in main web part it would not return the actual values back. */ const { displayMode, properties, context, _wpInstanceID, domElement, _beAUserFunction, _saveFieldPanelCommandsFunction, _saveFieldPanelViewsFunction } = thisWPClass; /** * PERFORMANCE - START * This is how you can start a performance snapshot - make the _performance.KEYHERE = startPerforOp('KEYHERE', this.displayMode) */ //This will create renderWebPartStart only if it was not created earlier in the render if (thisWPClass._performance.ops.renderWebPartStart === undefined || alreadyStartedPerformOp === false) { thisWPClass._performance.ops.renderWebPartStart = startPerformOp('renderWebPartStart', displayMode, true); // https://github.com/mikezimm/Slick-Sections/issues/69 } renderCustomStyles({ wpInstanceID: _wpInstanceID, domElement: domElement, wpProps: properties, displayMode: displayMode, doHeadings: thisWPClass._doHeadingStyles, fpsid: thisWPClass._FPSId }); //doHeadings is currently only used in PageInfo so set to false. const exportProps = buildExportPropsX('Panel', properties, _wpInstanceID, context.pageContext.web.serverRelativeUrl, WebPartAnalyticsChanges, WebPartPanelChanges, thisWPClass._exportIgnorePropsWP, thisWPClass._FPSId); const analyticsProps = buildExportPropsX('Analytics', properties, _wpInstanceID, context.pageContext.web.serverRelativeUrl, WebPartAnalyticsChanges, WebPartPanelChanges, thisWPClass._exportIgnorePropsWP, thisWPClass._FPSId); analyticsProps.FpsLv2 = `${PackageVersionLabelFpsLv2} --- ${PackageVersionTimeFpsLv2}`; analyticsProps.FpsCv7 = `${PackageVersionLabelFpsCv7} --- ${PackageVersionTimeFpsCv7}`; analyticsProps.FpsSty = `${PackageVersionLabelFpsSty} --- ${PackageVersionTimeFpsSty}`; const buildBannerProps = { main: thisWPClass, exportProps: exportProps, analyticsProps: analyticsProps, strings: strings, wideToggle: true, expandConsole: true, SPPermission: SPPermission, SpecialMessage: undefined, }; const bannerProps = mainWebPartRenderBannerSetupX(buildBannerProps); // https://github.com/mikezimm/Slick-Sections/issues/27 // NOTE: In SlickSections, this was run in the updateSectionStyles function AFTER runFPSWebPartRender was executed... so it is here at the end // https://github.com/mikezimm/pivottiles7/issues/456 - Does not run and white out BG Image if none is in props if (thisWPClass._allowFullPageBG !== false && thisWPClass.properties.fullPageImage) addCanvasBGImageComponent(thisWPClass.properties, 0, thisWPClass._isSPA); if (bannerProps.showBeAUserIcon === true) { bannerProps.beAUserFunction = _beAUserFunction.bind(thisWPClass); } // Migrated from SlickSections web part thisWPClass._performance.ops.process1 = updateSectionBGStyles('BGStylesR', thisWPClass); /** * PERFORMANCE - UPDATE * This is how you can UPDATE a performance snapshot - make the _performance.KEYHERE = startPerforOp('KEYHERE', this.displayMode) * NOTE IN THIS CASE to do it before you refreshPanelHTML :) */ thisWPClass._performance.ops.renderWebPartStart = updatePerformanceEnd(thisWPClass._performance.ops.renderWebPartStart, true, 555); return bannerProps; } //# sourceMappingURL=runWebPartRender.js.map