@pega/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +111 -0
- package/SECURITY.md +10 -0
- package/dist/index.js +753 -0
- package/package.json +41 -0
- package/templates/angular-sdk-reference/.github/AGENTS.md +23 -0
- package/templates/angular-sdk-reference/.github/copilot-instructions.md +40 -0
- package/templates/angular-sdk-reference/.github/skills/pega-sdk-component.md +48 -0
- package/templates/angular-sdk-reference/angular.json +34 -0
- package/templates/angular-sdk-reference/package.json +31 -0
- package/templates/angular-sdk-reference/sdk-config.json +26 -0
- package/templates/angular-sdk-reference/src/app/app.component.ts +54 -0
- package/templates/angular-sdk-reference/src/index.html +12 -0
- package/templates/angular-sdk-reference/src/main.ts +4 -0
- package/templates/angular-sdk-reference/src/styles.css +19 -0
- package/templates/angular-sdk-reference/tsconfig.json +32 -0
- package/templates/react-native-sdk-reference/.github/AGENTS.md +23 -0
- package/templates/react-native-sdk-reference/.github/copilot-instructions.md +40 -0
- package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +48 -0
- package/templates/react-native-sdk-reference/App.tsx +51 -0
- package/templates/react-native-sdk-reference/app.json +11 -0
- package/templates/react-native-sdk-reference/package.json +22 -0
- package/templates/react-native-sdk-reference/sdk-config.json +14 -0
- package/templates/react-native-sdk-reference/tsconfig.json +12 -0
- package/templates/react-sdk-reference/.github/copilot-instructions.md +185 -0
- package/templates/react-sdk-reference/.github/instructions/component-map.instructions.md +40 -0
- package/templates/react-sdk-reference/.github/instructions/dse-component.instructions.md +77 -0
- package/templates/react-sdk-reference/.github/instructions/field-component.instructions.md +73 -0
- package/templates/react-sdk-reference/.github/instructions/template-component.instructions.md +94 -0
- package/templates/react-sdk-reference/.github/instructions/widget-component.instructions.md +89 -0
- package/templates/react-sdk-reference/.github/prompts/add-component.prompt.md +21 -0
- package/templates/react-sdk-reference/.github/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.github/prompts/identify-components.prompt.md +110 -0
- package/templates/react-sdk-reference/.github/prompts/replace-all-fields.prompt.md +48 -0
- package/templates/react-sdk-reference/.github/prompts/replace-component.prompt.md +81 -0
- package/templates/react-sdk-reference/.github/prompts/replace-design-system.prompt.md +524 -0
- package/templates/react-sdk-reference/.github/prompts/replace-field.prompt.md +41 -0
- package/templates/react-sdk-reference/.github/prompts/swap-design-system.prompt.md +49 -0
- package/templates/react-sdk-reference/.github/skills/component-contracts.md +140 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/AlertBanner.md +135 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/Banner.md +149 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/CaseSummaryFields.md +154 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/DetailsFields.md +144 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/FieldGroup.md +131 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/FieldGroupList.md +111 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/FieldValueList.md +115 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/Operator.md +149 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/Pulse.md +83 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/RichTextEditor.md +206 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/WssQuickCreate.md +135 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension.md +249 -0
- package/templates/react-sdk-reference/.github/skills/field-components.md +262 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/AutoComplete.md +112 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/CancelAlert.md +203 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Checkbox.md +158 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Currency.md +106 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Date.md +99 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/DateTime.md +103 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Decimal.md +98 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Dropdown.md +114 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Email.md +107 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Group.md +90 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Integer.md +87 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Location.md +136 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Multiselect.md +164 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/ObjectReference.md +164 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Percentage.md +92 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Phone.md +110 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/RadioButtons.md +146 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/RichText.md +138 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/ScalarList.md +124 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/SelectableCard.md +216 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/SemanticLink.md +148 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/TextArea.md +96 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/TextContent.md +101 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/TextInput.md +104 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/Time.md +88 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/URL.md +85 -0
- package/templates/react-sdk-reference/.github/skills/field-skills/UserReference.md +180 -0
- package/templates/react-sdk-reference/.github/skills/run-and-verify.md +68 -0
- package/templates/react-sdk-reference/.github/skills/swap-design-system.md +105 -0
- package/templates/react-sdk-reference/.github/skills/template-components.md +285 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/AdvancedSearch.md +144 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/AppShell.md +122 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/BannerPage.md +83 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/CaseSummary.md +100 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/CaseView.md +131 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/CaseViewActionsMenu.md +126 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/Confirmation.md +107 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DataReference.md +120 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DefaultForm.md +102 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DefaultPage.md +110 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/Details.md +88 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DetailsSubTabs.md +95 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DetailsThreeColumn.md +78 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DetailsTwoColumn.md +78 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/DynamicTabs.md +101 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/FieldGroupTemplate.md +109 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/HierarchicalForm.md +113 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/InlineDashboard.md +104 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/InlineDashboardPage.md +85 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/ListPage.md +68 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/ListView.md +139 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/MultiReferenceReadOnly.md +80 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/NarrowWide.md +141 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/OneColumn.md +109 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/PromotedFilters.md +124 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/SelfServiceCaseView.md +135 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/SimpleTable.md +127 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/SingleReferenceReadOnly.md +103 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/SubTabs.md +79 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/TwoColumn.md +131 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/WideNarrow.md +150 -0
- package/templates/react-sdk-reference/.github/skills/template-skills/WssNavBar.md +135 -0
- package/templates/react-sdk-reference/.github/skills/widget-components.md +234 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/AppAnnouncement.md +82 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/Attachment.md +146 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/CaseHistory.md +107 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/FileUtility.md +200 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/Followers.md +99 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/QuickCreate.md +114 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/SummaryItem.md +167 -0
- package/templates/react-sdk-reference/.github/skills/widget-skills/ToDo.md +190 -0
- package/templates/react-sdk-reference/AGENTS.md +59 -0
- package/templates/react-sdk-reference/assets/icons/analytics-good-solid.svg +3 -0
- package/templates/react-sdk-reference/assets/icons/cart-solid.svg +3 -0
- package/templates/react-sdk-reference/assets/icons/headset.svg +3 -0
- package/templates/react-sdk-reference/assets/icons/mobile-phone-solid.svg +3 -0
- package/templates/react-sdk-reference/assets/icons/money-solid.svg +3 -0
- package/templates/react-sdk-reference/assets/icons/multi-device-solid.svg +3 -0
- package/templates/react-sdk-reference/index.html +36 -0
- package/templates/react-sdk-reference/package.json +52 -0
- package/templates/react-sdk-reference/sdk-config.json +26 -0
- package/templates/react-sdk-reference/src/AppSelector.tsx +18 -0
- package/templates/react-sdk-reference/src/FallbackComponent.tsx +40 -0
- package/templates/react-sdk-reference/src/MashupApp.styles.ts +105 -0
- package/templates/react-sdk-reference/src/MashupApp.tsx +254 -0
- package/templates/react-sdk-reference/src/PortalApp.tsx +175 -0
- package/templates/react-sdk-reference/src/components/component-map.ts +255 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/AlertBanner/AlertBanner.css +46 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/AlertBanner/AlertBanner.tsx +91 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Banner/Banner.css +39 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Banner/Banner.tsx +53 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Banner/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +16 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +270 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/CaseSummaryFields/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/DetailsFields/DetailsFields.tsx +164 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/DetailsFields/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx +79 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/FieldGroupList.tsx +58 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx +84 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Operator/Operator.tsx +220 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Operator/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Pulse/Pulse.tsx +33 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Pulse/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/RichTextEditor/RichTextEditor.tsx +201 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/WssQuickCreate/WssQuickCreate.css +33 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +48 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/WssQuickCreate/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +218 -0
- package/templates/react-sdk-reference/src/components/field/AutoComplete/config-ext.json +10 -0
- package/templates/react-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.css +24 -0
- package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.tsx +148 -0
- package/templates/react-sdk-reference/src/components/field/CancelAlert/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +263 -0
- package/templates/react-sdk-reference/src/components/field/Checkbox/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Currency/Currency.tsx +111 -0
- package/templates/react-sdk-reference/src/components/field/Currency/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/field/Currency/currency-utils.ts +67 -0
- package/templates/react-sdk-reference/src/components/field/Currency/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Date/Date.tsx +94 -0
- package/templates/react-sdk-reference/src/components/field/Date/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/field/Date/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/DateTime/DateTime.tsx +101 -0
- package/templates/react-sdk-reference/src/components/field/DateTime/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/DateTime/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Decimal/Decimal.tsx +122 -0
- package/templates/react-sdk-reference/src/components/field/Decimal/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Decimal/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +238 -0
- package/templates/react-sdk-reference/src/components/field/Dropdown/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Email/Email.tsx +96 -0
- package/templates/react-sdk-reference/src/components/field/Email/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Email/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Group/Group.tsx +41 -0
- package/templates/react-sdk-reference/src/components/field/Group/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/Group/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Integer/Integer.tsx +100 -0
- package/templates/react-sdk-reference/src/components/field/Integer/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Integer/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Location/Location.css +4 -0
- package/templates/react-sdk-reference/src/components/field/Location/Location.tsx +258 -0
- package/templates/react-sdk-reference/src/components/field/Location/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Location/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Multiselect/Multiselect.tsx +238 -0
- package/templates/react-sdk-reference/src/components/field/Multiselect/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Multiselect/utils.ts +230 -0
- package/templates/react-sdk-reference/src/components/field/ObjectReference/ObjectReference.tsx +235 -0
- package/templates/react-sdk-reference/src/components/field/ObjectReference/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/ObjectReference/utils.ts +111 -0
- package/templates/react-sdk-reference/src/components/field/Percentage/Percentage.tsx +112 -0
- package/templates/react-sdk-reference/src/components/field/Percentage/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Percentage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Phone/Phone.tsx +113 -0
- package/templates/react-sdk-reference/src/components/field/Phone/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Phone/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +158 -0
- package/templates/react-sdk-reference/src/components/field/RadioButtons/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/RadioButtons/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/RichText/RichText.css +79 -0
- package/templates/react-sdk-reference/src/components/field/RichText/RichText.tsx +98 -0
- package/templates/react-sdk-reference/src/components/field/RichText/config-ext.json +10 -0
- package/templates/react-sdk-reference/src/components/field/RichText/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/ScalarList/ScalarList.tsx +63 -0
- package/templates/react-sdk-reference/src/components/field/ScalarList/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/ScalarList/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/SelectableCard/SelectableCard.tsx +189 -0
- package/templates/react-sdk-reference/src/components/field/SelectableCard/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/SelectableCard/utils.tsx +223 -0
- package/templates/react-sdk-reference/src/components/field/SemanticLink/SemanticLink.tsx +208 -0
- package/templates/react-sdk-reference/src/components/field/SemanticLink/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/SemanticLink/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/SemanticLink/utils.ts +49 -0
- package/templates/react-sdk-reference/src/components/field/TextArea/TextArea.tsx +94 -0
- package/templates/react-sdk-reference/src/components/field/TextArea/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/TextContent/TextContent.tsx +46 -0
- package/templates/react-sdk-reference/src/components/field/TextContent/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/TextContent/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/TextInput/TextInput.tsx +92 -0
- package/templates/react-sdk-reference/src/components/field/TextInput/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Time/Time.tsx +79 -0
- package/templates/react-sdk-reference/src/components/field/Time/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/Time/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/URL/URL.tsx +89 -0
- package/templates/react-sdk-reference/src/components/field/URL/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/field/URL/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/UserReference/UserReference.tsx +198 -0
- package/templates/react-sdk-reference/src/components/field/UserReference/UserReferenceUtils.ts +13 -0
- package/templates/react-sdk-reference/src/components/field/UserReference/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/UserReference/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/helpers/attachmentShared.ts +6 -0
- package/templates/react-sdk-reference/src/components/helpers/case-utils.tsx +99 -0
- package/templates/react-sdk-reference/src/components/helpers/common-utils.ts +26 -0
- package/templates/react-sdk-reference/src/components/helpers/data_page.ts +20 -0
- package/templates/react-sdk-reference/src/components/helpers/date-format-utils.ts +76 -0
- package/templates/react-sdk-reference/src/components/helpers/event-utils.ts +20 -0
- package/templates/react-sdk-reference/src/components/helpers/field-group-utils.ts +63 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/Boolean.ts +21 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/Currency.ts +77 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/CurrencyMap.ts +913 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/Date.ts +71 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/common.ts +14 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +130 -0
- package/templates/react-sdk-reference/src/components/helpers/instructions-utils.ts +38 -0
- package/templates/react-sdk-reference/src/components/helpers/object-utils.ts +10 -0
- package/templates/react-sdk-reference/src/components/helpers/reactContextHelpers.ts +3 -0
- package/templates/react-sdk-reference/src/components/helpers/simpleTableHelpers.ts +452 -0
- package/templates/react-sdk-reference/src/components/helpers/state-utils.tsx +43 -0
- package/templates/react-sdk-reference/src/components/helpers/template-utils.ts +76 -0
- package/templates/react-sdk-reference/src/components/helpers/utils.ts +349 -0
- package/templates/react-sdk-reference/src/components/helpers/versionHelpers.ts +14 -0
- package/templates/react-sdk-reference/src/components/index.ts +8 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +329 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/TemplateContext.ts +11 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/AppShell/AppShell.css +35 -0
- package/templates/react-sdk-reference/src/components/template/AppShell/AppShell.tsx +259 -0
- package/templates/react-sdk-reference/src/components/template/AppShell/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/BannerPage/BannerPage.tsx +54 -0
- package/templates/react-sdk-reference/src/components/template/BannerPage/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/template/BannerPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/CaseSummary/CaseSummary.tsx +79 -0
- package/templates/react-sdk-reference/src/components/template/CaseSummary/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/CaseSummary/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/CaseView/CaseView.tsx +261 -0
- package/templates/react-sdk-reference/src/components/template/CaseView/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/CaseView/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +117 -0
- package/templates/react-sdk-reference/src/components/template/CaseViewActionsMenu/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/Confirmation/Confirmation.tsx +102 -0
- package/templates/react-sdk-reference/src/components/template/Confirmation/config-ext.json +11 -0
- package/templates/react-sdk-reference/src/components/template/Confirmation/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/DataReference/DataReference.tsx +590 -0
- package/templates/react-sdk-reference/src/components/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
- package/templates/react-sdk-reference/src/components/template/DataReference/SearchForm.tsx +213 -0
- package/templates/react-sdk-reference/src/components/template/DataReference/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/DataReference/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/DataReference/utils.ts +90 -0
- package/templates/react-sdk-reference/src/components/template/DefaultForm/DefaultForm.css +34 -0
- package/templates/react-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +74 -0
- package/templates/react-sdk-reference/src/components/template/DefaultForm/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/DefaultForm/utils/index.ts +26 -0
- package/templates/react-sdk-reference/src/components/template/DefaultPage/DefaultPage.tsx +108 -0
- package/templates/react-sdk-reference/src/components/template/DefaultPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/Details/Details/Details.tsx +74 -0
- package/templates/react-sdk-reference/src/components/template/Details/Details/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +58 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsSubTabs/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsSubTabs/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +79 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsThreeColumn/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsThreeColumn/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +79 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsTwoColumn/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/Details/DetailsTwoColumn/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
- package/templates/react-sdk-reference/src/components/template/Details/DynamicTabs/config.json +36 -0
- package/templates/react-sdk-reference/src/components/template/Details/DynamicTabs/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/FieldGroupTemplate/FieldGroupTemplate.tsx +116 -0
- package/templates/react-sdk-reference/src/components/template/FieldGroupTemplate/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/HierarchicalForm/HierarchicalForm.tsx +58 -0
- package/templates/react-sdk-reference/src/components/template/HierarchicalForm/hooks.ts +293 -0
- package/templates/react-sdk-reference/src/components/template/HierarchicalForm/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/InlineDashboard/InlineDashboard.tsx +72 -0
- package/templates/react-sdk-reference/src/components/template/InlineDashboard/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/InlineDashboardPage/InlineDashboardPage.tsx +39 -0
- package/templates/react-sdk-reference/src/components/template/InlineDashboardPage/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/template/InlineDashboardPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/ListPage/ListPage.tsx +16 -0
- package/templates/react-sdk-reference/src/components/template/ListPage/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/template/ListPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/ListView/DefaultViewMeta.ts +220 -0
- package/templates/react-sdk-reference/src/components/template/ListView/ListView.css +10 -0
- package/templates/react-sdk-reference/src/components/template/ListView/ListView.tsx +1391 -0
- package/templates/react-sdk-reference/src/components/template/ListView/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/ListView/hooks.ts +93 -0
- package/templates/react-sdk-reference/src/components/template/ListView/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/ListView/utils.ts +781 -0
- package/templates/react-sdk-reference/src/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +52 -0
- package/templates/react-sdk-reference/src/components/template/MultiReferenceReadOnly/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWide/NarrowWide.css +19 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWide/NarrowWide.tsx +37 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWide/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +85 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideDetails/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideDetails/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +19 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +22 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +28 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWidePage/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWidePage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/ObjectPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumn/OneColumn.tsx +32 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumn/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumn/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnPage/OneColumnPage.tsx +17 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnPage/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnTab/OneColumnTab.tsx +11 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnTab/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnTab/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/PromotedFilters/PromotedFilters.css +7 -0
- package/templates/react-sdk-reference/src/components/template/PromotedFilters/PromotedFilters.tsx +204 -0
- package/templates/react-sdk-reference/src/components/template/PromotedFilters/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SelfServiceCaseView/SelfServiceCaseView.tsx +153 -0
- package/templates/react-sdk-reference/src/components/template/SelfServiceCaseView/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTable/SimpleTable.tsx +126 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTable/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTable/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +985 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +122 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelectReadonly/SimpleTableSelectReadonly.tsx +207 -0
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelectReadonly/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +71 -0
- package/templates/react-sdk-reference/src/components/template/SingleReferenceReadOnly/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SubTabs/SubTabs.tsx +46 -0
- package/templates/react-sdk-reference/src/components/template/SubTabs/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/SubTabs/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/SubTabs/tabUtils.ts +185 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/TwoColumn.css +12 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/TwoColumn.tsx +54 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +17 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnPage/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +54 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrow/WideNarrow.css +19 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrow/WideNarrow.tsx +37 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrow/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +96 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowDetails/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowDetails/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +19 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +22 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +28 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowPage/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowPage/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/WssNavBar/WssNavBar.css +11 -0
- package/templates/react-sdk-reference/src/components/template/WssNavBar/WssNavBar.tsx +160 -0
- package/templates/react-sdk-reference/src/components/template/WssNavBar/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/utils.tsx +58 -0
- package/templates/react-sdk-reference/src/components/widget/AppAnnouncement/AppAnnouncement.tsx +60 -0
- package/templates/react-sdk-reference/src/components/widget/AppAnnouncement/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/widget/AppAnnouncement/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/Attachment/Attachment.css +95 -0
- package/templates/react-sdk-reference/src/components/widget/Attachment/Attachment.tsx +541 -0
- package/templates/react-sdk-reference/src/components/widget/Attachment/Attachment.types.ts +96 -0
- package/templates/react-sdk-reference/src/components/widget/Attachment/AttachmentUtils.ts +316 -0
- package/templates/react-sdk-reference/src/components/widget/Attachment/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/CaseHistory/CaseHistory.tsx +171 -0
- package/templates/react-sdk-reference/src/components/widget/CaseHistory/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/widget/CaseHistory/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +13 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +32 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/ActionButtonsForFileUtil/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/FileUtility.css +118 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/FileUtility.tsx +653 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/Followers/Followers.tsx +43 -0
- package/templates/react-sdk-reference/src/components/widget/Followers/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/widget/Followers/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/QuickCreate/QuickCreate.tsx +88 -0
- package/templates/react-sdk-reference/src/components/widget/QuickCreate/config-ext.json +9 -0
- package/templates/react-sdk-reference/src/components/widget/QuickCreate/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/SummaryItem/SummaryItem.css +76 -0
- package/templates/react-sdk-reference/src/components/widget/SummaryItem/SummaryItem.tsx +89 -0
- package/templates/react-sdk-reference/src/components/widget/SummaryItem/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/SummaryList/SummaryList.tsx +23 -0
- package/templates/react-sdk-reference/src/components/widget/SummaryList/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.css +81 -0
- package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.tsx +507 -0
- package/templates/react-sdk-reference/src/components/widget/ToDo/config-ext.json +8 -0
- package/templates/react-sdk-reference/src/components/widget/ToDo/index.tsx +1 -0
- package/templates/react-sdk-reference/src/main.tsx +13 -0
- package/templates/react-sdk-reference/src/mui-theme-augmentation.d.ts +6 -0
- package/templates/react-sdk-reference/tsconfig.json +24 -0
- package/templates/react-sdk-reference/vite.config.ts +65 -0
- package/templates/wc-sdk-reference/.github/AGENTS.md +23 -0
- package/templates/wc-sdk-reference/.github/copilot-instructions.md +40 -0
- package/templates/wc-sdk-reference/.github/skills/pega-sdk-component.md +48 -0
- package/templates/wc-sdk-reference/index.html +21 -0
- package/templates/wc-sdk-reference/package.json +19 -0
- package/templates/wc-sdk-reference/sdk-config.json +19 -0
- package/templates/wc-sdk-reference/src/index.ts +98 -0
- package/templates/wc-sdk-reference/tsconfig.json +21 -0
- package/templates/wc-sdk-reference/vite.config.ts +8 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import isDeepEqual from 'fast-deep-equal/react';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
4
|
+
import TextField from '@mui/material/TextField';
|
|
5
|
+
|
|
6
|
+
import { getDateFormatInfo } from '../../helpers/date-format-utils';
|
|
7
|
+
import { getCurrencyOptions } from '../../field/Currency/currency-utils';
|
|
8
|
+
import { getComponentFromRegistry } from '@pega/sdk-react';
|
|
9
|
+
|
|
10
|
+
import './CaseSummaryFields.css';
|
|
11
|
+
|
|
12
|
+
import { format } from '../../helpers/formatters';
|
|
13
|
+
|
|
14
|
+
// CaseSummaryFields is one of the few components that does NOT have getPConnect.
|
|
15
|
+
// So, no need to extend PConnProps
|
|
16
|
+
interface CaseSummaryFieldsProps {
|
|
17
|
+
// If any, enter additional props that only exist on this component
|
|
18
|
+
status?: string;
|
|
19
|
+
showStatus?: boolean;
|
|
20
|
+
theFields: any[] | any | never;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function CaseSummaryFields(props: CaseSummaryFieldsProps) {
|
|
24
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
25
|
+
const Operator = getComponentFromRegistry('Operator');
|
|
26
|
+
|
|
27
|
+
const { status, showStatus, theFields } = props;
|
|
28
|
+
|
|
29
|
+
const [theFieldsToRender, setFieldsToRender] = useState([]);
|
|
30
|
+
const [theFieldsAsGridItems, setFieldsAsGridItems] = useState<any[]>([]);
|
|
31
|
+
|
|
32
|
+
function getFieldValue(field: any): any {
|
|
33
|
+
const fieldTypeLower = field.type.toLowerCase();
|
|
34
|
+
|
|
35
|
+
if (field.config.value === null || field.config.value === '') {
|
|
36
|
+
// Special handling for missing value
|
|
37
|
+
|
|
38
|
+
switch (fieldTypeLower) {
|
|
39
|
+
case 'caseoperator':
|
|
40
|
+
return <Operator {...field.config} />;
|
|
41
|
+
break;
|
|
42
|
+
|
|
43
|
+
default:
|
|
44
|
+
return (
|
|
45
|
+
<TextField
|
|
46
|
+
variant='standard'
|
|
47
|
+
value='---'
|
|
48
|
+
label={field.config.label}
|
|
49
|
+
slotProps={{
|
|
50
|
+
input: {
|
|
51
|
+
readOnly: true,
|
|
52
|
+
disableUnderline: true
|
|
53
|
+
}
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
switch (fieldTypeLower) {
|
|
61
|
+
case 'textinput':
|
|
62
|
+
case 'decimal':
|
|
63
|
+
case 'integer':
|
|
64
|
+
case 'dropdown':
|
|
65
|
+
return (
|
|
66
|
+
<TextField
|
|
67
|
+
variant='standard'
|
|
68
|
+
value={field.config.value}
|
|
69
|
+
label={field.config.label}
|
|
70
|
+
slotProps={{
|
|
71
|
+
input: {
|
|
72
|
+
readOnly: true,
|
|
73
|
+
disableUnderline: true
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
case 'checkbox': {
|
|
80
|
+
const { caption, label, value, trueLabel, falseLabel } = field.config;
|
|
81
|
+
const fieldLabel = label || caption;
|
|
82
|
+
const fieldValue = value ? trueLabel : falseLabel;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<TextField
|
|
86
|
+
variant='standard'
|
|
87
|
+
value={fieldValue}
|
|
88
|
+
label={fieldLabel}
|
|
89
|
+
slotProps={{
|
|
90
|
+
input: {
|
|
91
|
+
readOnly: true,
|
|
92
|
+
disableUnderline: true
|
|
93
|
+
}
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
case 'status':
|
|
100
|
+
return (
|
|
101
|
+
<TextField
|
|
102
|
+
variant='standard'
|
|
103
|
+
className='psdk-csf-status-style'
|
|
104
|
+
value={field.config.value}
|
|
105
|
+
label={field.config.label}
|
|
106
|
+
slotProps={{
|
|
107
|
+
input: {
|
|
108
|
+
readOnly: true,
|
|
109
|
+
disableUnderline: true
|
|
110
|
+
}
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
case 'phone': {
|
|
116
|
+
const displayPhone = field.config.value !== '' ? field.config.value : '---';
|
|
117
|
+
return (
|
|
118
|
+
<a href={`tel:${displayPhone}`}>
|
|
119
|
+
<TextField
|
|
120
|
+
variant='standard'
|
|
121
|
+
value={field.config.value}
|
|
122
|
+
label={field.config.label}
|
|
123
|
+
slotProps={{
|
|
124
|
+
input: {
|
|
125
|
+
readOnly: true,
|
|
126
|
+
disableUnderline: true,
|
|
127
|
+
inputProps: { style: { cursor: 'pointer' } }
|
|
128
|
+
}
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
</a>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
case 'email': {
|
|
136
|
+
const displayEmail = format(field.config.value, field.type);
|
|
137
|
+
return (
|
|
138
|
+
<a href={`mailto:${displayEmail}`}>
|
|
139
|
+
<TextField
|
|
140
|
+
variant='standard'
|
|
141
|
+
value={field.config.value}
|
|
142
|
+
label={field.config.label}
|
|
143
|
+
slotProps={{
|
|
144
|
+
input: {
|
|
145
|
+
readOnly: true,
|
|
146
|
+
disableUnderline: true,
|
|
147
|
+
inputProps: { style: { cursor: 'pointer' } }
|
|
148
|
+
}
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
</a>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
case 'date':
|
|
156
|
+
case 'datetime': {
|
|
157
|
+
const theDateFormatInfo = getDateFormatInfo();
|
|
158
|
+
// console.log(`theDateFormatInfo: ${theDateFormatInfo}`);
|
|
159
|
+
const theFormat =
|
|
160
|
+
fieldTypeLower === 'datetime' ? `${theDateFormatInfo.dateFormatStringLong} hh:mm a` : theDateFormatInfo.dateFormatStringLong;
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<TextField
|
|
164
|
+
variant='standard'
|
|
165
|
+
value={format(field.config.value, field.type, {
|
|
166
|
+
format: theFormat
|
|
167
|
+
})}
|
|
168
|
+
label={field.config.label}
|
|
169
|
+
slotProps={{
|
|
170
|
+
input: {
|
|
171
|
+
readOnly: true,
|
|
172
|
+
disableUnderline: true
|
|
173
|
+
}
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
case 'currency': {
|
|
180
|
+
const theCurrencyOptions = getCurrencyOptions(field.config?.currencyISOCode);
|
|
181
|
+
return (
|
|
182
|
+
<TextField
|
|
183
|
+
variant='standard'
|
|
184
|
+
value={format(field.config.value, field.type, theCurrencyOptions)}
|
|
185
|
+
label={field.config.label}
|
|
186
|
+
slotProps={{
|
|
187
|
+
input: {
|
|
188
|
+
readOnly: true,
|
|
189
|
+
disableUnderline: true
|
|
190
|
+
}
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
case 'boolean':
|
|
197
|
+
case 'userreference':
|
|
198
|
+
return (
|
|
199
|
+
<TextField
|
|
200
|
+
variant='standard'
|
|
201
|
+
value={format(field.config.value, field.type)}
|
|
202
|
+
label={field.config.label}
|
|
203
|
+
slotProps={{
|
|
204
|
+
input: {
|
|
205
|
+
readOnly: true,
|
|
206
|
+
disableUnderline: true
|
|
207
|
+
}
|
|
208
|
+
}}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
case 'caseoperator':
|
|
213
|
+
return <Operator {...field.config} />;
|
|
214
|
+
|
|
215
|
+
default:
|
|
216
|
+
return (
|
|
217
|
+
<span>
|
|
218
|
+
{field.type.toLowerCase()} {field.config.value}
|
|
219
|
+
</span>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Whenever theFieldsToRender changes, update theFieldsAsGridItems that's used during render
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
const arGridItems = theFieldsToRender?.map((field: any) => {
|
|
227
|
+
// display the field when either visibility property doesn't exist or is true(if exists)
|
|
228
|
+
if (field.config.visibility === undefined || field.config.visibility === true) {
|
|
229
|
+
return (
|
|
230
|
+
<Grid size={{ xs: 6 }} key={field.config.label}>
|
|
231
|
+
{getFieldValue(field)}
|
|
232
|
+
</Grid>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return null;
|
|
237
|
+
});
|
|
238
|
+
setFieldsAsGridItems(arGridItems);
|
|
239
|
+
}, [theFieldsToRender]);
|
|
240
|
+
|
|
241
|
+
const theFieldsModifiable = theFields;
|
|
242
|
+
|
|
243
|
+
// Special Case: if showStatus is true, splice the status value to be 2nd in theFields
|
|
244
|
+
// if it's not already there
|
|
245
|
+
if (showStatus && theFields?.[1].type !== 'status') {
|
|
246
|
+
const oStatus = {
|
|
247
|
+
type: 'status',
|
|
248
|
+
config: { value: status, label: 'Status' }
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const count = theFieldsModifiable.length;
|
|
252
|
+
if (count < 2) {
|
|
253
|
+
theFieldsModifiable.push(oStatus);
|
|
254
|
+
} else {
|
|
255
|
+
theFieldsModifiable.splice(1, 0, oStatus);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// At this point, we know what fields we want to render...
|
|
260
|
+
// So, update our state if it's changed
|
|
261
|
+
if (!isDeepEqual(theFieldsToRender, theFieldsModifiable)) {
|
|
262
|
+
setFieldsToRender(theFieldsModifiable);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<Grid container className='psdk-case-summary-fields'>
|
|
267
|
+
{theFieldsAsGridItems}
|
|
268
|
+
</Grid>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CaseSummaryFields';
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React, { createElement, isValidElement } from 'react';
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
5
|
+
|
|
6
|
+
import { PConnectComponent } from '@pega/sdk-react';
|
|
7
|
+
import { format } from '../../helpers/formatters';
|
|
8
|
+
|
|
9
|
+
// DetailsFields is one of the few components that does NOT have getPConnect.
|
|
10
|
+
// So, no need to extend PConnProps
|
|
11
|
+
interface DetailsFieldsProps {
|
|
12
|
+
// If any, enter additional props that only exist on this component
|
|
13
|
+
fields: any[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const useStyles = makeStyles((theme) => ({
|
|
17
|
+
root: {
|
|
18
|
+
paddingRight: theme.spacing(1),
|
|
19
|
+
paddingLeft: theme.spacing(1),
|
|
20
|
+
paddingTop: theme.spacing(1),
|
|
21
|
+
paddingBottom: theme.spacing(1),
|
|
22
|
+
marginRight: theme.spacing(1),
|
|
23
|
+
marginLeft: theme.spacing(1),
|
|
24
|
+
marginTop: theme.spacing(1),
|
|
25
|
+
marginBottom: theme.spacing(1),
|
|
26
|
+
},
|
|
27
|
+
fieldLabel: {
|
|
28
|
+
display: 'block',
|
|
29
|
+
fontWeight: 400,
|
|
30
|
+
color: theme.palette.text.secondary,
|
|
31
|
+
},
|
|
32
|
+
fieldValue: {
|
|
33
|
+
fontWeight: 400,
|
|
34
|
+
color: theme.palette.text.primary,
|
|
35
|
+
},
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
export default function DetailsFields(props: DetailsFieldsProps) {
|
|
39
|
+
// const componentName = "DetailsFields";
|
|
40
|
+
const { fields = [] } = props;
|
|
41
|
+
const classes = useStyles();
|
|
42
|
+
const fieldComponents: any[] = [];
|
|
43
|
+
|
|
44
|
+
fields?.forEach((field, index) => {
|
|
45
|
+
const thePConn = field.getPConnect();
|
|
46
|
+
const theCompType = thePConn.getComponentName().toLowerCase();
|
|
47
|
+
const { label } = thePConn.getConfigProps();
|
|
48
|
+
const configObj = thePConn?.getReferencedView();
|
|
49
|
+
configObj.config.readOnly = true;
|
|
50
|
+
configObj.config.displayMode = 'DISPLAY_ONLY';
|
|
51
|
+
const propToUse = { ...thePConn.getInheritedProps() };
|
|
52
|
+
configObj.config.label =
|
|
53
|
+
theCompType === 'reference' ? propToUse?.label : label;
|
|
54
|
+
fieldComponents.push({
|
|
55
|
+
type: theCompType,
|
|
56
|
+
label,
|
|
57
|
+
value: (
|
|
58
|
+
<React.Fragment key={index}>
|
|
59
|
+
{createElement(
|
|
60
|
+
PConnectComponent,
|
|
61
|
+
thePConn.getReferencedViewPConnect(),
|
|
62
|
+
)}
|
|
63
|
+
</React.Fragment>
|
|
64
|
+
),
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
function getGridItemLabel(field: any, keyVal: string) {
|
|
69
|
+
const dispValue = field.label;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Grid size={{ xs: 6 }} key={keyVal}>
|
|
73
|
+
<Typography
|
|
74
|
+
variant='body2'
|
|
75
|
+
component='span'
|
|
76
|
+
className={`${classes.fieldLabel}`}
|
|
77
|
+
>
|
|
78
|
+
{dispValue}
|
|
79
|
+
</Typography>
|
|
80
|
+
</Grid>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function formatItemValue(inField: any) {
|
|
85
|
+
const { type, value } = inField;
|
|
86
|
+
let formattedVal = value;
|
|
87
|
+
|
|
88
|
+
switch (type) {
|
|
89
|
+
case 'date':
|
|
90
|
+
formattedVal = format(value, type);
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
default:
|
|
94
|
+
// No match means we return the value as we received it
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Finally, if the value is undefined or an empty string, we want to display it as "---"
|
|
99
|
+
if (formattedVal === undefined || formattedVal === '') {
|
|
100
|
+
formattedVal = '---';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return formattedVal;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function getGridItemValue(field: any, keyVal: string) {
|
|
107
|
+
const formattedValue = formatItemValue(field);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Grid size={{ xs: 6 }} key={keyVal}>
|
|
111
|
+
<Typography
|
|
112
|
+
variant='body2'
|
|
113
|
+
component='span'
|
|
114
|
+
className={classes.fieldValue}
|
|
115
|
+
>
|
|
116
|
+
{formattedValue}
|
|
117
|
+
</Typography>
|
|
118
|
+
</Grid>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getGridItem(field: any, keyVal: string) {
|
|
123
|
+
return (
|
|
124
|
+
<Grid size={{ xs: 12 }} key={keyVal}>
|
|
125
|
+
<Typography
|
|
126
|
+
variant='body2'
|
|
127
|
+
component='span'
|
|
128
|
+
className={classes.fieldValue}
|
|
129
|
+
>
|
|
130
|
+
{field?.value}
|
|
131
|
+
</Typography>
|
|
132
|
+
</Grid>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getGridItems() {
|
|
137
|
+
const gridItems: any[] = fieldComponents.map((field, index) => {
|
|
138
|
+
if (field?.type === 'reference') {
|
|
139
|
+
return field?.value;
|
|
140
|
+
}
|
|
141
|
+
if (isValidElement(field?.value)) {
|
|
142
|
+
return (
|
|
143
|
+
<Grid
|
|
144
|
+
container
|
|
145
|
+
spacing={1}
|
|
146
|
+
style={{ padding: '4px 0px' }}
|
|
147
|
+
key={index}
|
|
148
|
+
>
|
|
149
|
+
{getGridItem(field, `${index}-item`)}
|
|
150
|
+
</Grid>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
return (
|
|
154
|
+
<Grid container spacing={1} style={{ padding: '4px 0px' }} key={index}>
|
|
155
|
+
{getGridItemLabel(field, `${index}-label`)}
|
|
156
|
+
{getGridItemValue(field, `${index}-value`)}
|
|
157
|
+
</Grid>
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
return gridItems;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return <>{getGridItems()}</>;
|
|
164
|
+
}
|
package/templates/react-sdk-reference/src/components/designSystemExtension/DetailsFields/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DetailsFields';
|
package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type PropsWithChildren, useState } from 'react';
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
4
|
+
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
|
5
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
6
|
+
|
|
7
|
+
// FieldGroupProps is one of the few components that does NOT have getPConnect.
|
|
8
|
+
// So, no need to extend PConnProps
|
|
9
|
+
interface FieldGroupProps {
|
|
10
|
+
// If any, enter additional props that only exist on this component
|
|
11
|
+
name?: string;
|
|
12
|
+
collapsible?: boolean;
|
|
13
|
+
instructions?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const useStyles = makeStyles(theme => ({
|
|
17
|
+
root: {
|
|
18
|
+
marginRight: theme.spacing(1),
|
|
19
|
+
marginLeft: theme.spacing(1),
|
|
20
|
+
marginTop: theme.spacing(1),
|
|
21
|
+
marginBottom: theme.spacing(1)
|
|
22
|
+
},
|
|
23
|
+
fieldMargin: {
|
|
24
|
+
paddingTop: theme.spacing(1),
|
|
25
|
+
paddingBottom: theme.spacing(1),
|
|
26
|
+
marginTop: theme.spacing(1)
|
|
27
|
+
},
|
|
28
|
+
fullWidth: {
|
|
29
|
+
width: '100%'
|
|
30
|
+
},
|
|
31
|
+
fieldGroupHeader: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: '5px',
|
|
35
|
+
cursor: collapsible => (collapsible ? 'pointer' : 'auto')
|
|
36
|
+
},
|
|
37
|
+
instructionText: {
|
|
38
|
+
padding: '5px 0'
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export default function FieldGroup(props: PropsWithChildren<FieldGroupProps>) {
|
|
43
|
+
const { children, name, collapsible = false, instructions } = props;
|
|
44
|
+
const classes = useStyles(collapsible);
|
|
45
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
46
|
+
|
|
47
|
+
const descAndChildren = (
|
|
48
|
+
<Grid container>
|
|
49
|
+
<div className={classes.fullWidth}>{children}</div>
|
|
50
|
+
</Grid>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const headerClickHandler = () => {
|
|
54
|
+
setCollapsed(current => !current);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Grid container spacing={4} justifyContent='space-between'>
|
|
59
|
+
<Grid style={{ width: '100%' }}>
|
|
60
|
+
{name && (
|
|
61
|
+
<div className={classes.fieldMargin}>
|
|
62
|
+
{collapsible ? (
|
|
63
|
+
<span id='field-group-header' className={classes.fieldGroupHeader} onClick={headerClickHandler}>
|
|
64
|
+
{collapsed ? <KeyboardArrowRightIcon /> : <KeyboardArrowDownIcon />}
|
|
65
|
+
<b>{name}</b>
|
|
66
|
+
</span>
|
|
67
|
+
) : (
|
|
68
|
+
<b>{name}</b>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
{instructions && instructions !== 'none' && (
|
|
73
|
+
<div key='instructions' className={classes.instructionText} dangerouslySetInnerHTML={{ __html: instructions }} />
|
|
74
|
+
)}
|
|
75
|
+
{!collapsed && descAndChildren}
|
|
76
|
+
</Grid>
|
|
77
|
+
</Grid>
|
|
78
|
+
);
|
|
79
|
+
}
|
package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FieldGroup';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import Grid from '@mui/material/Grid';
|
|
2
|
+
import Divider from '@mui/material/Divider';
|
|
3
|
+
import Link from '@mui/material/Link';
|
|
4
|
+
|
|
5
|
+
import { Utils } from '../../helpers/utils';
|
|
6
|
+
|
|
7
|
+
// FieldGroupList is one of the few components that does NOT have getPConnect.
|
|
8
|
+
// So, no need to extend PConnProps
|
|
9
|
+
interface FieldGroupListProps {
|
|
10
|
+
// If any, enter additional props that only exist on this component
|
|
11
|
+
items: any[] | any;
|
|
12
|
+
onDelete: any;
|
|
13
|
+
onAdd: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function FieldGroupList(props: FieldGroupListProps) {
|
|
17
|
+
let menuIconOverride$ = 'trash';
|
|
18
|
+
if (menuIconOverride$) {
|
|
19
|
+
menuIconOverride$ = Utils.getImageSrc(menuIconOverride$, Utils.getSDKStaticConentUrl());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Grid container spacing={4} justifyContent='space-between'>
|
|
24
|
+
<Grid style={{ width: '100%' }}>
|
|
25
|
+
<Grid container spacing={1}>
|
|
26
|
+
{props.items.map(item => (
|
|
27
|
+
<Grid key={item.name} style={{ width: '100%' }}>
|
|
28
|
+
<b>{item.name}</b>
|
|
29
|
+
{props.onDelete && (
|
|
30
|
+
<button
|
|
31
|
+
type='button'
|
|
32
|
+
style={{ float: 'right' }}
|
|
33
|
+
className='psdk-utility-button'
|
|
34
|
+
id={`delete-row-${item.id}`}
|
|
35
|
+
aria-label='Delete Row'
|
|
36
|
+
onClick={() => {
|
|
37
|
+
props.onDelete(item.id);
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$} />
|
|
41
|
+
</button>
|
|
42
|
+
)}
|
|
43
|
+
{item.children}
|
|
44
|
+
<br />
|
|
45
|
+
{props.onAdd && <Divider />}
|
|
46
|
+
<br />
|
|
47
|
+
</Grid>
|
|
48
|
+
))}
|
|
49
|
+
{props.onAdd && (
|
|
50
|
+
<Link onClick={props.onAdd} style={{ cursor: 'pointer' }} underline='hover'>
|
|
51
|
+
+Add
|
|
52
|
+
</Link>
|
|
53
|
+
)}
|
|
54
|
+
</Grid>
|
|
55
|
+
</Grid>
|
|
56
|
+
</Grid>
|
|
57
|
+
);
|
|
58
|
+
}
|
package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FieldGroupList';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import Grid from '@mui/material/Grid';
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
3
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
4
|
+
|
|
5
|
+
// FieldValueList is one of the few components that does NOT have getPConnect.
|
|
6
|
+
// So, no need to extend PConnProps
|
|
7
|
+
interface FieldValueListProps {
|
|
8
|
+
// If any, enter additional props that only exist on this component
|
|
9
|
+
name?: string;
|
|
10
|
+
value: any;
|
|
11
|
+
variant?: string;
|
|
12
|
+
isHtml?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const useStyles = makeStyles(theme => ({
|
|
16
|
+
root: {
|
|
17
|
+
marginRight: theme.spacing(1),
|
|
18
|
+
marginLeft: theme.spacing(1),
|
|
19
|
+
marginTop: theme.spacing(1),
|
|
20
|
+
marginBottom: theme.spacing(1)
|
|
21
|
+
},
|
|
22
|
+
fieldLabel: {
|
|
23
|
+
fontWeight: 400,
|
|
24
|
+
color: theme.palette.text.secondary
|
|
25
|
+
},
|
|
26
|
+
fieldValue: {
|
|
27
|
+
color: theme.palette.text.primary
|
|
28
|
+
},
|
|
29
|
+
noPaddingTop: {
|
|
30
|
+
paddingTop: '0 !important'
|
|
31
|
+
},
|
|
32
|
+
noPaddingBottom: {
|
|
33
|
+
paddingBottom: '0 !important'
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
function formatItemValue(value) {
|
|
38
|
+
let formattedVal = value;
|
|
39
|
+
|
|
40
|
+
// if the value is undefined or an empty string, we want to display it as "---"
|
|
41
|
+
if (formattedVal === undefined || formattedVal === '') {
|
|
42
|
+
formattedVal = '---';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return formattedVal;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function FieldValueList(props: FieldValueListProps) {
|
|
49
|
+
const { name, value, variant = 'inline', isHtml = false } = props;
|
|
50
|
+
const classes = useStyles();
|
|
51
|
+
|
|
52
|
+
function getGridItemLabel() {
|
|
53
|
+
return (
|
|
54
|
+
<Grid size={{ xs: variant === 'stacked' ? 12 : 4 }} className={variant === 'stacked' ? classes.noPaddingBottom : ''}>
|
|
55
|
+
<Typography variant='body2' component='span' className={`${classes.fieldLabel}`}>
|
|
56
|
+
{name}
|
|
57
|
+
</Typography>
|
|
58
|
+
</Grid>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getGridItemValue() {
|
|
63
|
+
const formattedValue = formatItemValue(value);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Grid size={{ xs: variant === 'stacked' || !name ? 12 : 8 }} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
|
|
67
|
+
{isHtml ? (
|
|
68
|
+
<div dangerouslySetInnerHTML={{ __html: formattedValue }} />
|
|
69
|
+
) : (
|
|
70
|
+
<Typography variant={variant === 'stacked' ? 'h6' : 'body2'} component='span' className={classes.fieldValue}>
|
|
71
|
+
{formattedValue}
|
|
72
|
+
</Typography>
|
|
73
|
+
)}
|
|
74
|
+
</Grid>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Grid container spacing={4} justifyContent='space-between'>
|
|
80
|
+
{name ? getGridItemLabel() : null}
|
|
81
|
+
{getGridItemValue()}
|
|
82
|
+
</Grid>
|
|
83
|
+
);
|
|
84
|
+
}
|
package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FieldValueList';
|