UNPKG

@mikezimm/npmfunctions

Version:
87 lines 4.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateSectionStyles = exports.setThisPageFormatting = exports.setToolbar = exports.setQuickLaunch = exports.renderCustomStyles = void 0; var sp_core_library_1 = require("@microsoft/sp-core-library"); var FPSFormatFunctions_1 = require("../Services/DOM/FPSFormatFunctions"); // import { IFPSPage, } from '../Services/DOM/FPSInterfaces'; // import { createFPSWindowProps, initializeFPSSection, initializeFPSPage, webpartInstance, initializeMinimalStyle } from '../Services/DOM/FPSDocument'; // import { IFPSWindowProps, IFPSSection, IFPSSectionStyle } from '../Services/DOM/FPSInterfaces'; var FPSDocument_1 = require("../Services/DOM/FPSDocument"); var setAllSectionStyles_1 = require("../Services/DOM/setAllSectionStyles"); var minimzeHeader_1 = require("../Services/DOM/minimzeHeader"); var minimzeToolbar_1 = require("../Services/DOM/minimzeToolbar"); var quickLaunch_1 = require("../Services/DOM/quickLaunch"); // import { getUrlVars } from '../Services/Logging/LogFunctions'; // import { replaceHandleBars } from '../Services/Strings/handleBars'; var FPSHeadingFunctions_1 = require("../HeadingCSS/FPSHeadingFunctions"); /** * renderCustomStyles is intended for one-time style changes during onInit. Not dynamic changes * NOT for things like PinMe or Expando which the user changes on the fly * * @param wpInstanceID * @param domElement * @param wpProps // * @param fpsPageDone // Deprecating - No longer needed with more modern styling options in updateSectionStyles. // * @param fpsPageArray // Deprecating - No longer needed with more modern styling options in updateSectionStyles. * @param displayMode // * @param minHideToolbar //Should not be needed, using web part props for value and local function for url param // * @param hideToolbar //Should not be needed, using web part props for value and local function for url * @param doHeadings */ function renderCustomStyles(sty) { var TempHeadingStyleProps = sty.wpProps; if (sty.doHeadings === true) (0, FPSHeadingFunctions_1.applyHeadingCSS)(TempHeadingStyleProps); //Used with FPS Options Functions setQuickLaunch(sty.wpProps.quickLaunchHide); (0, minimzeHeader_1.minimizeHeader)(document, sty.wpProps.pageHeaderHide, false, true); // Deprecating - No longer needed with more modern styling options in updateSectionStyles. // setThisPageFormatting( sty.wpInstanceID, sty.domElement, sty.wpProps.fpsPageStyle, sty.fpsPageDone, sty.fpsPageArray ); setToolbar(sty.displayMode, sty.wpInstanceID, sty.wpProps.toolBarHide); updateSectionStyles(sty.wpInstanceID, sty.wpProps); } exports.renderCustomStyles = renderCustomStyles; /** * Used with FPS Options Functions * @param quickLaunchHide */ function setQuickLaunch(quickLaunchHide) { //specifically not undefined or null in case it is not yet preset. if (quickLaunchHide === true || quickLaunchHide === false) { (0, quickLaunch_1.minimizeQuickLaunch)(document, quickLaunchHide); } } exports.setQuickLaunch = setQuickLaunch; /** * Used with FPS Options Functions * @param quickLaunchHide */ function setToolbar(displayMode, wpInstanceID, hideToolbar) { var urlParameters = new URLSearchParams(window.location.href); if (displayMode == sp_core_library_1.DisplayMode.Read && urlParameters.get('tool') !== 'true') { var value = hideToolbar === true ? 'none' : null; var toolBarStyle = (0, FPSDocument_1.initializeMinimalStyle)('Miminze Toolbar', wpInstanceID, 'display', value); (0, minimzeToolbar_1.minimizeToolbar)(document, toolBarStyle, false, true); } } exports.setToolbar = setToolbar; /** * Used with FPS Options Functions * @param fpsPageStyle */ function setThisPageFormatting(wpInstanceID, domElement, fpsPageStyle, fpsPageDone, fpsPageArray) { //fpsPage should be IFPSPage var fpsPage = (0, FPSDocument_1.initializeFPSPage)(wpInstanceID, fpsPageDone, fpsPageStyle, fpsPageArray); fpsPage = (0, FPSFormatFunctions_1.setPageFormatting)(domElement, fpsPage); fpsPageArray = fpsPage.Array; fpsPageDone = fpsPage.do; } exports.setThisPageFormatting = setThisPageFormatting; function updateSectionStyles(wpInstanceID, wpProps) { var allSectionMaxWidth = wpProps.allSectionMaxWidthEnable !== true ? null : wpProps.allSectionMaxWidth; var allSectionMargin = wpProps.allSectionMarginEnable !== true ? null : wpProps.allSectionMargin; var sectionStyles = (0, FPSDocument_1.initializeFPSSection)(wpInstanceID, allSectionMaxWidth, allSectionMargin); (0, setAllSectionStyles_1.setSectionStyles)(document, sectionStyles, true, true); } exports.updateSectionStyles = updateSectionStyles; //# sourceMappingURL=MainWebPartStyleFunctions.js.map