@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
150 lines • 6.12 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FPSBanner2Group = exports.FPSOptionsGroupBasic = exports.FPSOptionsGroupAdvanced = void 0;
var sp_property_pane_1 = require("@microsoft/sp-property-pane");
var Audiences_1 = require("./Audiences");
/**
* This is the legacy options which were more complex with more options
* @param showSearch
* @param pageStyle
* @param quickLaunchHide
* @param containerMaxWidth
*/
function FPSOptionsGroupAdvanced(pageStyle, containerMaxWidth) {
var fields = [];
if (pageStyle === true) {
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('fpsPageStyle', {
// disabled: webPartProps.ignoreList === true ? true : false,
label: 'Custom page style settings', description: 'See wiki for more information.', multiline: true,
}));
}
if (containerMaxWidth === true) {
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('fpsContainerMaxWidth', {
// disabled: webPartProps.ignoreList === true ? true : false,
label: 'Webpart container Max Width', description: 'ie: 100% or 2400px',
}));
}
var optionsGroup = { groupName: 'FPS options - Advanced',
isCollapsed: true,
groupFields: fields
};
return optionsGroup;
}
exports.FPSOptionsGroupAdvanced = FPSOptionsGroupAdvanced;
/**
* This is the second version which is more simple (toggles and sliders)
* @param showSearch
* @param pageStyle
* @param quickLaunchHide
* @param containerMaxWidth
*/
function FPSOptionsGroupBasic(showSearch, quickLaunchHide, pageHeaderHide, allSectWidth, allSectionMaxWidthEnable, allSectMargin, allSectionMarginEnable, toolBarHide) {
var fields = [];
if (showSearch === true) {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('searchShow', {
label: 'Show search bar by default', offText: 'Hide', onText: 'Show',
}));
}
if (quickLaunchHide === true) {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('quickLaunchHide', {
label: 'Hide quick launch - may be seen briefly', offText: 'Ignore', onText: 'Hidden',
}));
}
if (pageHeaderHide === true) {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('pageHeaderHide', {
label: 'Hide Page Header - may be seen briefly',
offText: 'Ignore',
onText: 'Hidden',
}));
}
if (allSectWidth !== 'skip') {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('allSectionMaxWidthEnable', {
label: 'All Sections Max Width',
offText: 'Off',
onText: 'On',
}));
fields.push((0, sp_property_pane_1.PropertyPaneSlider)('allSectionMaxWidth', {
label: 'Max width of all sections',
disabled: allSectionMaxWidthEnable === true ? false : true,
min: 1200,
max: 3200,
step: 100,
}));
}
if (allSectMargin !== 'skip') {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('allSectionMarginEnable', {
label: 'All Sections Margin',
offText: 'Off',
onText: 'On',
}));
fields.push((0, sp_property_pane_1.PropertyPaneSlider)('allSectionMargin', {
label: 'Top and Bottom Margin',
disabled: allSectionMarginEnable === true ? false : true,
min: 0,
max: 100,
step: 2,
}));
}
if (toolBarHide === true) {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('toolBarHide', {
label: 'Hide Toolbar - while viewing',
offText: 'Ignore',
onText: 'Hidden',
}));
}
var optionsGroup = { groupName: 'FPS options - Basic',
isCollapsed: true,
groupFields: fields
};
return optionsGroup;
}
exports.FPSOptionsGroupBasic = FPSOptionsGroupBasic;
/**
*
* @param forceBanner
* @param modifyBannerTitle
* @param modifyBannerStyle
* @param showBanner
* @param showAdvanced
* @param showNavigation - Adds Navigate to Home Page and Parent Site
*/
function FPSBanner2Group(forceBanner, modifyBannerTitle, modifyBannerStyle, showBanner, showAdvanced, showNavigation) {
var fields = [];
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('showBanner', {
label: 'Show Banner',
disabled: forceBanner !== false ? true : false,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('bannerTitle', {
label: 'Webpart Title',
description: '',
disabled: modifyBannerTitle !== true || showBanner !== true ? true : false,
}));
if (showNavigation === true) {
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('showGoToHome', {
label: 'Show Go to Home Page Icon',
}));
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('showGoToParent', {
label: 'Show Got to Parent Site Icon',
}));
fields.push((0, sp_property_pane_1.PropertyPaneDropdown)('homeParentGearAudience', {
label: 'Gear, Home, Parent audience',
options: Audiences_1.EveryoneAudienceChoices,
}));
}
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('bannerStyle', {
label: 'Style options',
description: 'React.CSSProperties format like: "fontSize":"larger","color":"red"',
disabled: modifyBannerStyle !== true || showBanner !== true ? true : false,
}));
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('bannerHoverEffect', {
label: 'Banner Hover Effect',
disabled: modifyBannerStyle !== true || showBanner !== true ? true : false,
}));
var bannerGroup = { groupName: 'Banner',
isCollapsed: true,
groupFields: fields
};
return bannerGroup;
}
exports.FPSBanner2Group = FPSBanner2Group;
//# sourceMappingURL=FPSOptionsGroup2.js.map