@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
85 lines • 4.13 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BannerPropVisHelp = exports.FPSBanner3VisHelpGroup = void 0;
var sp_property_pane_1 = require("@microsoft/sp-property-pane");
var PropertyFieldPeoplePicker_1 = require("@pnp/spfx-property-controls/lib/PropertyFieldPeoplePicker");
var Audiences_1 = require("../Services/PropPane/Audiences");
/**
* FPSBanner3VisHelpGroup - Builds FPS Banner Visitor Help Group:
* fullPanelAudience, panelMessageDescription1, panelMessageSupport,
* panelMessageDocumentation, documentationLinkUrl, documentationLinkDesc,
* panelMessageIfYouStill, supportContacts
*
*/
function FPSBanner3VisHelpGroup(wpContext, onPropertyPaneFieldChanged, wpProperties) {
var fields = BannerPropVisHelp(wpContext, onPropertyPaneFieldChanged, wpProperties);
var bannerGroup = { groupName: 'Visitor Help Info (required)',
isCollapsed: true,
groupFields: fields
};
return bannerGroup;
}
exports.FPSBanner3VisHelpGroup = FPSBanner3VisHelpGroup;
/**
* Generates prop pane FIELDS for: bannerStyleChoice, bannerStyle, bannerCmdStyle, bannerHoverEffect
*/
function BannerPropVisHelp(wpContext, onPropertyPaneFieldChanged, wpProperties) {
var fields = [];
var disabled = wpProperties.showCustomHelp === false ? true : false;
fields.push((0, sp_property_pane_1.PropertyPaneToggle)('showCustomHelp', {
label: 'Enable custom help panel', offText: 'Disable', onText: 'Enable',
}));
fields.push((0, sp_property_pane_1.PropertyPaneDropdown)('fullPanelAudience', {
label: 'Full Help Panel Audience',
options: Audiences_1.EveryoneAudienceChoices,
disabled: disabled,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('panelMessageDescription1', {
label: 'Panel Description',
description: 'Optional message displayed at the top of the panel for the end user to see.',
disabled: disabled,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('panelMessageSupport', {
label: 'Support Message',
description: 'Optional message to the user when looking for support',
disabled: disabled,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('panelMessageDocumentation', {
label: 'Documentation message',
description: 'Optional message to the user shown directly above the Documentation link',
disabled: disabled,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('documentationLinkUrl', {
label: 'PASTE a Documentation Link',
description: 'REQUIRED: A valid link to documentation - DO NOT TYPE in or webpart will lage',
disabled: disabled,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('documentationLinkDesc', {
label: 'Documentation Description',
description: 'Optional: Text user sees as the clickable documentation link',
disabled: disabled,
}));
fields.push((0, sp_property_pane_1.PropertyPaneTextField)('panelMessageIfYouStill', {
label: 'If you still have... message',
description: 'If you have more than one contact, explain who to call for what',
disabled: disabled,
}));
fields.push((0, PropertyFieldPeoplePicker_1.PropertyFieldPeoplePicker)('supportContacts', {
label: 'Support Contacts',
initialData: wpProperties.supportContacts,
allowDuplicate: false,
principalType: [PropertyFieldPeoplePicker_1.PrincipalType.Users,],
onPropertyChange: onPropertyPaneFieldChanged,
//Had to cast to get it to work
//https://github.com/pnp/sp-dev-fx-controls-react/issues/851#issuecomment-978990638
context: wpContext,
properties: wpProperties,
onGetErrorMessage: null,
deferredValidationTime: 0,
key: 'peopleFieldId',
disabled: disabled,
}));
return fields;
}
exports.BannerPropVisHelp = BannerPropVisHelp;
//# sourceMappingURL=FPSOptionsGroupVisHelp.js.map