@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,985 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
type PropsWithChildren,
|
|
3
|
+
useEffect,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import Table from '@mui/material/Table';
|
|
10
|
+
import TableBody from '@mui/material/TableBody';
|
|
11
|
+
import TableCell from '@mui/material/TableCell';
|
|
12
|
+
import TableContainer from '@mui/material/TableContainer';
|
|
13
|
+
import TableHead from '@mui/material/TableHead';
|
|
14
|
+
import TableRow from '@mui/material/TableRow';
|
|
15
|
+
import Paper from '@mui/material/Paper';
|
|
16
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
17
|
+
import Link from '@mui/material/Link';
|
|
18
|
+
import { createElement } from 'react';
|
|
19
|
+
import TableSortLabel from '@mui/material/TableSortLabel';
|
|
20
|
+
import MoreIcon from '@mui/icons-material/MoreVert';
|
|
21
|
+
import Menu from '@mui/material/Menu';
|
|
22
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
23
|
+
import FilterListIcon from '@mui/icons-material/FilterList';
|
|
24
|
+
import SubjectIcon from '@mui/icons-material/Subject';
|
|
25
|
+
import Dialog from '@mui/material/Dialog';
|
|
26
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
27
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
28
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
29
|
+
import Select from '@mui/material/Select';
|
|
30
|
+
import Button from '@mui/material/Button';
|
|
31
|
+
import TextField from '@mui/material/TextField';
|
|
32
|
+
|
|
33
|
+
import { PConnectComponent } from '@pega/sdk-react';
|
|
34
|
+
import { Utils } from '../../../helpers/utils';
|
|
35
|
+
import { getReferenceList } from '../../../helpers/field-group-utils';
|
|
36
|
+
import { getDataPage } from '../../../helpers/data_page';
|
|
37
|
+
import { getGenericFieldsLocalizedValue } from '../../../helpers/common-utils';
|
|
38
|
+
import {
|
|
39
|
+
buildFieldsForTable,
|
|
40
|
+
filterData,
|
|
41
|
+
getConfigFields,
|
|
42
|
+
getContext,
|
|
43
|
+
} from '../../../helpers/simpleTableHelpers';
|
|
44
|
+
import type { PConnProps } from '@pega/sdk-react';
|
|
45
|
+
import { format } from '../../../helpers/formatters';
|
|
46
|
+
import { initializeColumns } from '../../ListView/utils';
|
|
47
|
+
|
|
48
|
+
interface SimpleTableManualProps extends PConnProps {
|
|
49
|
+
// If any, enter additional props that only exist on this component
|
|
50
|
+
hideAddRow?: boolean;
|
|
51
|
+
hideDeleteRow?: boolean;
|
|
52
|
+
referenceList?: any[];
|
|
53
|
+
renderMode?: string;
|
|
54
|
+
presets?: any[];
|
|
55
|
+
label?: string;
|
|
56
|
+
showLabel?: boolean;
|
|
57
|
+
dataPageName?: string;
|
|
58
|
+
contextClass?: string;
|
|
59
|
+
propertyLabel?: string;
|
|
60
|
+
fieldMetadata?: any;
|
|
61
|
+
editMode?: string;
|
|
62
|
+
addAndEditRowsWithin?: any;
|
|
63
|
+
viewForAddAndEditModal?: any;
|
|
64
|
+
editModeConfig?: any;
|
|
65
|
+
displayMode?: string;
|
|
66
|
+
useSeparateViewForEdit: any;
|
|
67
|
+
viewForEditModal: any;
|
|
68
|
+
validatemessage?: string;
|
|
69
|
+
required?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const useStyles = makeStyles((/* theme */) => ({
|
|
73
|
+
label: {
|
|
74
|
+
margin: '8px',
|
|
75
|
+
},
|
|
76
|
+
tableLabel: {
|
|
77
|
+
'&::after': {
|
|
78
|
+
display: 'inline',
|
|
79
|
+
content: '" *"',
|
|
80
|
+
verticalAlign: 'top',
|
|
81
|
+
color: 'var(--app-error-color)',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
message: {
|
|
85
|
+
margin: '8px',
|
|
86
|
+
color: 'var(--app-error-color)',
|
|
87
|
+
fontSize: '14px',
|
|
88
|
+
},
|
|
89
|
+
header: {
|
|
90
|
+
background: 'var(--table-header-background)',
|
|
91
|
+
},
|
|
92
|
+
tableCell: {
|
|
93
|
+
borderRight: '1px solid lightgray',
|
|
94
|
+
padding: '8px',
|
|
95
|
+
},
|
|
96
|
+
visuallyHidden: {
|
|
97
|
+
border: 0,
|
|
98
|
+
clip: 'rect(0 0 0 0)',
|
|
99
|
+
height: 1,
|
|
100
|
+
margin: -1,
|
|
101
|
+
overflow: 'hidden',
|
|
102
|
+
padding: 0,
|
|
103
|
+
position: 'absolute',
|
|
104
|
+
top: 20,
|
|
105
|
+
width: 1,
|
|
106
|
+
},
|
|
107
|
+
moreIcon: {
|
|
108
|
+
verticalAlign: 'bottom',
|
|
109
|
+
},
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
let menuColumnId = '';
|
|
113
|
+
let menuColumnType = '';
|
|
114
|
+
let menuColumnLabel = '';
|
|
115
|
+
|
|
116
|
+
const filterByColumns: any[] = [];
|
|
117
|
+
let myRows: any[];
|
|
118
|
+
|
|
119
|
+
export default function SimpleTableManual(
|
|
120
|
+
props: PropsWithChildren<SimpleTableManualProps>,
|
|
121
|
+
) {
|
|
122
|
+
const classes = useStyles();
|
|
123
|
+
const {
|
|
124
|
+
getPConnect,
|
|
125
|
+
referenceList = [], // if referenceList not in configProps$, default to empy list
|
|
126
|
+
children,
|
|
127
|
+
renderMode,
|
|
128
|
+
presets,
|
|
129
|
+
label: labelProp,
|
|
130
|
+
showLabel,
|
|
131
|
+
dataPageName,
|
|
132
|
+
contextClass,
|
|
133
|
+
hideAddRow,
|
|
134
|
+
hideDeleteRow,
|
|
135
|
+
propertyLabel,
|
|
136
|
+
fieldMetadata,
|
|
137
|
+
editMode,
|
|
138
|
+
addAndEditRowsWithin,
|
|
139
|
+
viewForAddAndEditModal,
|
|
140
|
+
editModeConfig,
|
|
141
|
+
displayMode,
|
|
142
|
+
useSeparateViewForEdit,
|
|
143
|
+
viewForEditModal,
|
|
144
|
+
required,
|
|
145
|
+
validatemessage,
|
|
146
|
+
} = props;
|
|
147
|
+
const pConn = getPConnect();
|
|
148
|
+
const [rowData, setRowData] = useState([]);
|
|
149
|
+
const [elements, setElementsData] = useState([]);
|
|
150
|
+
const [order, setOrder] = useState<Order>('asc');
|
|
151
|
+
const [orderBy, setOrderBy] = useState<keyof any>('');
|
|
152
|
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
153
|
+
const [editAnchorEl, setEditAnchorEl] = useState<null | HTMLElement>(null);
|
|
154
|
+
const [open, setOpen] = useState(false);
|
|
155
|
+
const [filterBy, setFilterBy] = useState<string>();
|
|
156
|
+
const [containsDateOrTime, setContainsDateOrTime] = useState<boolean>(false);
|
|
157
|
+
const [filterType, setFilterType] = useState<string>('string');
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
159
|
+
const [displayDialogFilterName, setDisplayDialogFilterName] =
|
|
160
|
+
useState<string>('');
|
|
161
|
+
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] =
|
|
162
|
+
useState<string>('contains');
|
|
163
|
+
const [displayDialogContainsValue, setDisplayDialogContainsValue] =
|
|
164
|
+
useState<string>('');
|
|
165
|
+
const [displayDialogDateFilter, setDisplayDialogDateFilter] =
|
|
166
|
+
useState<string>('notequal');
|
|
167
|
+
const [displayDialogDateValue, setDisplayDialogDateValue] =
|
|
168
|
+
useState<string>('');
|
|
169
|
+
const selectedRowIndex: any = useRef(null);
|
|
170
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
171
|
+
const localeCategory = 'SimpleTable';
|
|
172
|
+
const parameters = fieldMetadata?.datasource?.parameters;
|
|
173
|
+
const { referenceListStr } = getContext(getPConnect());
|
|
174
|
+
const label = labelProp || propertyLabel;
|
|
175
|
+
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
176
|
+
if (propsToUse.showLabel === false) {
|
|
177
|
+
propsToUse.label = '';
|
|
178
|
+
}
|
|
179
|
+
// Getting current context
|
|
180
|
+
const context = getPConnect().getContextName();
|
|
181
|
+
const resolvedList = getReferenceList(pConn);
|
|
182
|
+
pConn.setReferenceList(resolvedList);
|
|
183
|
+
const menuIconOverride$ = Utils.getImageSrc(
|
|
184
|
+
'trash',
|
|
185
|
+
Utils.getSDKStaticConentUrl(),
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
const resolvedFields =
|
|
189
|
+
children?.[0]?.children || presets?.[0].children?.[0].children;
|
|
190
|
+
const primaryFieldsViewIndex = resolvedFields.findIndex(
|
|
191
|
+
(field) => field.config.value === 'pyPrimaryFields',
|
|
192
|
+
);
|
|
193
|
+
// NOTE: props has each child.config with datasource and value undefined
|
|
194
|
+
// but getRawMetadata() has each child.config with datasource and value showing their unresolved values (ex: "@P thePropName")
|
|
195
|
+
// We need to use the prop name as the "glue" to tie the table dataSource, displayColumns and data together.
|
|
196
|
+
// So, in the code below, we'll use the unresolved config.value (but replacing the space with an underscore to keep things happy)
|
|
197
|
+
const rawMetadata: any = getPConnect().getRawMetadata();
|
|
198
|
+
|
|
199
|
+
// get raw config since @P and other annotations are processed and don't appear in the resolved config.
|
|
200
|
+
// Destructure "raw" children into array var: "rawFields"
|
|
201
|
+
// NOTE: when config.listType == "associated", the property can be found in either
|
|
202
|
+
// config.value (ex: "@P .DeclarantChoice") or
|
|
203
|
+
// config.datasource (ex: "@ASSOCIATED .DeclarantChoice")
|
|
204
|
+
// Neither of these appear in the resolved props
|
|
205
|
+
|
|
206
|
+
const rawConfig = rawMetadata?.config;
|
|
207
|
+
const rawFields =
|
|
208
|
+
rawConfig?.children?.[0]?.children ||
|
|
209
|
+
rawConfig?.presets?.[0].children?.[0]?.children;
|
|
210
|
+
const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
|
|
211
|
+
const readOnlyMode = renderMode === 'ReadOnly';
|
|
212
|
+
const editableMode = renderMode === 'Editable';
|
|
213
|
+
const showAddRowButton = !readOnlyMode && !hideAddRow;
|
|
214
|
+
const allowEditingInModal =
|
|
215
|
+
(editMode ? editMode === 'modal' : addAndEditRowsWithin === 'modal') &&
|
|
216
|
+
!(renderMode === 'ReadOnly' || isDisplayModeEnabled);
|
|
217
|
+
const showDeleteButton = editableMode && !hideDeleteRow;
|
|
218
|
+
const defaultView = editModeConfig
|
|
219
|
+
? editModeConfig.defaultView
|
|
220
|
+
: viewForAddAndEditModal;
|
|
221
|
+
const bUseSeparateViewForEdit = editModeConfig
|
|
222
|
+
? editModeConfig.useSeparateViewForEdit
|
|
223
|
+
: useSeparateViewForEdit;
|
|
224
|
+
const editView = editModeConfig ? editModeConfig.editView : viewForEditModal;
|
|
225
|
+
|
|
226
|
+
const configFields = getConfigFields(
|
|
227
|
+
rawFields,
|
|
228
|
+
contextClass,
|
|
229
|
+
primaryFieldsViewIndex,
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
const fieldsWithPropNames = rawFields.map((field, index) => {
|
|
233
|
+
return {
|
|
234
|
+
...resolvedFields[index],
|
|
235
|
+
propName: field.config.value.replace('@P .', ''),
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
buildElementsForTable();
|
|
241
|
+
if (readOnlyMode || allowEditingInModal) {
|
|
242
|
+
generateRowsData();
|
|
243
|
+
}
|
|
244
|
+
}, [referenceList]);
|
|
245
|
+
|
|
246
|
+
// fieldDefs will be an array where each entry will have a "name" which will be the
|
|
247
|
+
// "resolved" property name (that we can use as the colId) though it's not really
|
|
248
|
+
// resolved. The buildFieldsForTable helper just removes the "@P " (which is what
|
|
249
|
+
// Constellation DX Components do). It will also have the "label", and "meta" contains the original,
|
|
250
|
+
// unchanged config info. For now, much of the info here is carried over from
|
|
251
|
+
// Constellation DX Components.
|
|
252
|
+
|
|
253
|
+
const fieldDefs = useMemo(
|
|
254
|
+
() =>
|
|
255
|
+
isDisplayModeEnabled || readOnlyMode
|
|
256
|
+
? initializeColumns(configFields, undefined)
|
|
257
|
+
: // For inline edit table
|
|
258
|
+
buildFieldsForTable(rawFields, getPConnect(), showDeleteButton, {
|
|
259
|
+
primaryFieldsViewIndex,
|
|
260
|
+
fields: resolvedFields,
|
|
261
|
+
}),
|
|
262
|
+
[],
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
useLayoutEffect(() => {
|
|
266
|
+
if (allowEditingInModal) {
|
|
267
|
+
getPConnect()
|
|
268
|
+
.getListActions()
|
|
269
|
+
.initDefaultPageInstructions(
|
|
270
|
+
getPConnect().getReferenceList(),
|
|
271
|
+
fieldDefs.filter((item) => item.name).map((item) => item.name),
|
|
272
|
+
);
|
|
273
|
+
} else {
|
|
274
|
+
// @ts-expect-error - An argument for 'fields' was not provided
|
|
275
|
+
getPConnect()
|
|
276
|
+
.getListActions()
|
|
277
|
+
.initDefaultPageInstructions(getPConnect().getReferenceList());
|
|
278
|
+
}
|
|
279
|
+
}, []);
|
|
280
|
+
|
|
281
|
+
const displayedColumns = fieldDefs.map((field) => {
|
|
282
|
+
return field.name ? field.name : field.cellRenderer;
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const getFormattedValue = (val, key) => {
|
|
286
|
+
const rawField = fieldsWithPropNames.find((item) => item.propName === key);
|
|
287
|
+
let options = {};
|
|
288
|
+
if (rawField && ['Boolean', 'Checkbox'].includes(rawField.type)) {
|
|
289
|
+
const { trueLabel, falseLabel } = rawField.config;
|
|
290
|
+
options = {
|
|
291
|
+
trueLabel,
|
|
292
|
+
falseLabel,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return rawField ? format(val, rawField.type, options) : val;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// console.log(`SimpleTable displayedColumns:`);
|
|
299
|
+
// console.log(displayedColumns);
|
|
300
|
+
|
|
301
|
+
// return the value that should be shown as the contents for the given row data
|
|
302
|
+
// of the given row field
|
|
303
|
+
function getRowValue(inRowData: object, inColKey: string): any {
|
|
304
|
+
// See what data (if any) we have to display
|
|
305
|
+
const refKeys: string[] = inColKey?.split('.');
|
|
306
|
+
let valBuilder = inRowData;
|
|
307
|
+
for (const key of refKeys) {
|
|
308
|
+
valBuilder = valBuilder[key];
|
|
309
|
+
}
|
|
310
|
+
return getFormattedValue(valBuilder, inColKey);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const formatRowsData = (data) => {
|
|
314
|
+
if (!data) return {};
|
|
315
|
+
|
|
316
|
+
return data.map((item) => {
|
|
317
|
+
return displayedColumns.reduce((dataForRow, colKey) => {
|
|
318
|
+
dataForRow[colKey] = getRowValue(item, colKey);
|
|
319
|
+
return dataForRow;
|
|
320
|
+
}, {});
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
function generateRowsData() {
|
|
325
|
+
// if referenceList is empty and dataPageName property value exists then make a datapage fetch call and get the list of data.
|
|
326
|
+
if (!referenceList.length && dataPageName) {
|
|
327
|
+
getDataPage(dataPageName, parameters, context)
|
|
328
|
+
.then((listData) => {
|
|
329
|
+
const data = formatRowsData(listData);
|
|
330
|
+
myRows = data;
|
|
331
|
+
setRowData(data);
|
|
332
|
+
})
|
|
333
|
+
.catch((e) => {
|
|
334
|
+
console.log(e);
|
|
335
|
+
});
|
|
336
|
+
} else {
|
|
337
|
+
// The referenceList prop has the JSON data for each row to be displayed
|
|
338
|
+
// in the table. So, iterate over referenceList to create the dataRows that
|
|
339
|
+
// we're using as the table's dataSource
|
|
340
|
+
const data: any = [];
|
|
341
|
+
for (const row of referenceList) {
|
|
342
|
+
const dataForRow: object = {};
|
|
343
|
+
for (const col of displayedColumns) {
|
|
344
|
+
const colKey: string = col;
|
|
345
|
+
const theVal = getRowValue(row, colKey);
|
|
346
|
+
dataForRow[colKey] = theVal || '';
|
|
347
|
+
}
|
|
348
|
+
data.push(dataForRow);
|
|
349
|
+
myRows = data;
|
|
350
|
+
}
|
|
351
|
+
setRowData(data);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// May be useful for debugging or understanding how it works.
|
|
356
|
+
// These are the data structures referred to in the html file.
|
|
357
|
+
// These are the relationships that make the table work
|
|
358
|
+
// displayedColumns: key/value pairs where key is order of column and
|
|
359
|
+
// value is the property shown in that column. Ex: 1: "FirstName"
|
|
360
|
+
// rowData: array of each row's key/value pairs. Inside each row,
|
|
361
|
+
// each key is an entry in displayedColumns: ex: "FirstName": "Charles"
|
|
362
|
+
// Ex: { 1: {config: {label: "First Name", readOnly: true: name: "FirstName"}}, type: "TextInput" }
|
|
363
|
+
// The "type" indicates the type of component that should be used for editing (when editing is enabled)
|
|
364
|
+
//
|
|
365
|
+
// console.log("SimpleTable displayedColumns:");
|
|
366
|
+
// console.log(displayedColumns);
|
|
367
|
+
// console.log(`SimpleTable rowData (${rowData.length} row(s)):`);
|
|
368
|
+
// console.log(JSON.stringify(rowData));
|
|
369
|
+
|
|
370
|
+
const addRecord = () => {
|
|
371
|
+
if (allowEditingInModal && defaultView) {
|
|
372
|
+
pConn
|
|
373
|
+
.getActionsApi()
|
|
374
|
+
// @ts-expect-error
|
|
375
|
+
.openEmbeddedDataModal(
|
|
376
|
+
defaultView,
|
|
377
|
+
pConn,
|
|
378
|
+
referenceListStr,
|
|
379
|
+
referenceList.length,
|
|
380
|
+
PCore.getConstants().RESOURCE_STATUS.CREATE,
|
|
381
|
+
);
|
|
382
|
+
} else {
|
|
383
|
+
pConn
|
|
384
|
+
.getListActions()
|
|
385
|
+
.insert({ classID: contextClass }, referenceList.length);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
getPConnect().clearErrorMessages({
|
|
389
|
+
property: (
|
|
390
|
+
getPConnect().getStateProps() as any
|
|
391
|
+
)?.referenceList?.substring(1),
|
|
392
|
+
} as any);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const editRecord = () => {
|
|
396
|
+
setEditAnchorEl(null);
|
|
397
|
+
if (typeof selectedRowIndex.current === 'number') {
|
|
398
|
+
pConn
|
|
399
|
+
.getActionsApi()
|
|
400
|
+
// @ts-expect-error
|
|
401
|
+
.openEmbeddedDataModal(
|
|
402
|
+
bUseSeparateViewForEdit ? editView : defaultView,
|
|
403
|
+
pConn,
|
|
404
|
+
referenceListStr,
|
|
405
|
+
selectedRowIndex.current,
|
|
406
|
+
PCore.getConstants().RESOURCE_STATUS.UPDATE,
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
const deleteRecord = () => {
|
|
412
|
+
setEditAnchorEl(null);
|
|
413
|
+
pConn.getListActions().deleteEntry(selectedRowIndex.current);
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
const deleteRecordFromInlineEditable = (index: number) => {
|
|
417
|
+
pConn.getListActions().deleteEntry(index);
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
function buildElementsForTable() {
|
|
421
|
+
const eleData: any = [];
|
|
422
|
+
referenceList.forEach((element, index) => {
|
|
423
|
+
const data: any = [];
|
|
424
|
+
rawFields.forEach((item) => {
|
|
425
|
+
// removing label field from config to hide title in the table cell
|
|
426
|
+
if (!item.config.hide) {
|
|
427
|
+
item = {
|
|
428
|
+
...item,
|
|
429
|
+
config: {
|
|
430
|
+
...item.config,
|
|
431
|
+
label: '',
|
|
432
|
+
displayMode:
|
|
433
|
+
readOnlyMode || allowEditingInModal
|
|
434
|
+
? 'DISPLAY_ONLY'
|
|
435
|
+
: undefined,
|
|
436
|
+
},
|
|
437
|
+
};
|
|
438
|
+
const referenceListData = getReferenceList(pConn);
|
|
439
|
+
const isDatapage = referenceListData.startsWith('D_');
|
|
440
|
+
const pageReferenceValue = isDatapage
|
|
441
|
+
? `${referenceListData}[${index}]`
|
|
442
|
+
: `${pConn.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`;
|
|
443
|
+
const config = {
|
|
444
|
+
meta: item,
|
|
445
|
+
options: {
|
|
446
|
+
context,
|
|
447
|
+
pageReference: pageReferenceValue,
|
|
448
|
+
referenceList: referenceListData,
|
|
449
|
+
hasForm: true,
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
const view = PCore.createPConnect(config);
|
|
453
|
+
data.push(createElement(PConnectComponent, view));
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
eleData.push(data);
|
|
457
|
+
});
|
|
458
|
+
setElementsData(eleData);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const handleRequestSort = (
|
|
462
|
+
event: React.MouseEvent<unknown>,
|
|
463
|
+
property: keyof any,
|
|
464
|
+
) => {
|
|
465
|
+
const isAsc = orderBy === property && order === 'asc';
|
|
466
|
+
setOrder(isAsc ? 'desc' : 'asc');
|
|
467
|
+
setOrderBy(property);
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
const createSortHandler =
|
|
471
|
+
(property: keyof any) => (event: React.MouseEvent<unknown>) => {
|
|
472
|
+
handleRequestSort(event, property);
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
|
|
476
|
+
if (!orderedBy || (!a[orderedBy] && !b[orderedBy])) {
|
|
477
|
+
return 0;
|
|
478
|
+
}
|
|
479
|
+
if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
|
|
480
|
+
return -1;
|
|
481
|
+
}
|
|
482
|
+
if (!a[orderedBy] || b[orderedBy] > a[orderedBy]) {
|
|
483
|
+
return 1;
|
|
484
|
+
}
|
|
485
|
+
return 0;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
type Order = 'asc' | 'desc';
|
|
489
|
+
|
|
490
|
+
interface Comparator<T> {
|
|
491
|
+
(a: T, b: T): number;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function getComparator<Key extends keyof any, T extends Record<Key, any>>(
|
|
495
|
+
theOrder: Order,
|
|
496
|
+
orderedBy: Key,
|
|
497
|
+
): Comparator<T> {
|
|
498
|
+
return theOrder === 'desc'
|
|
499
|
+
? (a: T, b: T) => descendingComparator<T>(a, b, orderedBy)
|
|
500
|
+
: (a: T, b: T) => -descendingComparator<T>(a, b, orderedBy);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
504
|
+
const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
|
|
505
|
+
stabilizedThis.sort((a, b) => {
|
|
506
|
+
const order = comparator(a[0], b[0]);
|
|
507
|
+
if (order !== 0) return order;
|
|
508
|
+
return a[1] - b[1];
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
const newElements = new Array(stabilizedThis.length);
|
|
512
|
+
stabilizedThis.forEach((el, index) => {
|
|
513
|
+
newElements[index] = elements[el[1]];
|
|
514
|
+
});
|
|
515
|
+
return newElements;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function _menuClick(
|
|
519
|
+
event,
|
|
520
|
+
columnId: string,
|
|
521
|
+
columnType: string,
|
|
522
|
+
labelValue: string,
|
|
523
|
+
) {
|
|
524
|
+
menuColumnId = columnId;
|
|
525
|
+
menuColumnType = columnType;
|
|
526
|
+
menuColumnLabel = labelValue;
|
|
527
|
+
|
|
528
|
+
setAnchorEl(event.currentTarget);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function editMenuClick(event, index) {
|
|
532
|
+
selectedRowIndex.current = index;
|
|
533
|
+
setEditAnchorEl(event.currentTarget);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function _menuClose() {
|
|
537
|
+
setAnchorEl(null);
|
|
538
|
+
setEditAnchorEl(null);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function _filterMenu() {
|
|
542
|
+
setAnchorEl(null);
|
|
543
|
+
|
|
544
|
+
let bFound = false;
|
|
545
|
+
|
|
546
|
+
for (const filterObj of filterByColumns) {
|
|
547
|
+
if (filterObj.ref === menuColumnId) {
|
|
548
|
+
setFilterBy(menuColumnLabel);
|
|
549
|
+
if (
|
|
550
|
+
filterObj.type === 'Date' ||
|
|
551
|
+
filterObj.type === 'DateTime' ||
|
|
552
|
+
filterObj.type === 'Time'
|
|
553
|
+
) {
|
|
554
|
+
setContainsDateOrTime(true);
|
|
555
|
+
setFilterType(filterObj.type);
|
|
556
|
+
setDisplayDialogDateFilter(filterObj.containsFilter);
|
|
557
|
+
setDisplayDialogDateValue(filterObj.containsFilterValue);
|
|
558
|
+
} else {
|
|
559
|
+
setContainsDateOrTime(false);
|
|
560
|
+
setFilterType('string');
|
|
561
|
+
setDisplayDialogContainsFilter(filterObj.containsFilter);
|
|
562
|
+
setDisplayDialogContainsValue(filterObj.containsFilterValue);
|
|
563
|
+
}
|
|
564
|
+
bFound = true;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (!bFound) {
|
|
570
|
+
setFilterBy(menuColumnLabel);
|
|
571
|
+
setDisplayDialogFilterName(menuColumnId);
|
|
572
|
+
setDisplayDialogContainsValue('');
|
|
573
|
+
|
|
574
|
+
switch (menuColumnType) {
|
|
575
|
+
case 'Date':
|
|
576
|
+
case 'DateTime':
|
|
577
|
+
case 'Time':
|
|
578
|
+
setContainsDateOrTime(true);
|
|
579
|
+
setFilterType(menuColumnType);
|
|
580
|
+
break;
|
|
581
|
+
default:
|
|
582
|
+
setContainsDateOrTime(false);
|
|
583
|
+
setFilterType('string');
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// open dialog
|
|
589
|
+
setOpen(true);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function _groupMenu() {}
|
|
593
|
+
|
|
594
|
+
function _closeDialog() {
|
|
595
|
+
setOpen(false);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function _dialogContainsFilter(event) {
|
|
599
|
+
setDisplayDialogContainsFilter(event.target.value);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function _dialogContainsValue(event) {
|
|
603
|
+
setDisplayDialogContainsValue(event.target.value);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
function _dialogDateFilter(event) {
|
|
607
|
+
setDisplayDialogDateFilter(event.target.value);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function _dialogDateValue(event) {
|
|
611
|
+
setDisplayDialogDateValue(event.target.value);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function filterSortGroupBy() {
|
|
615
|
+
// get original data set
|
|
616
|
+
let theData: any = myRows.slice();
|
|
617
|
+
|
|
618
|
+
// last filter config data is global
|
|
619
|
+
theData = theData.filter(filterData(filterByColumns));
|
|
620
|
+
|
|
621
|
+
// move data to array and then sort
|
|
622
|
+
setRowData(theData);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function updateFilterWithInfo() {
|
|
626
|
+
let bFound = false;
|
|
627
|
+
for (const filterObj of filterByColumns) {
|
|
628
|
+
if (filterObj.ref === menuColumnId) {
|
|
629
|
+
filterObj.type = filterType;
|
|
630
|
+
if (containsDateOrTime) {
|
|
631
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
632
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
633
|
+
} else {
|
|
634
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
635
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
636
|
+
}
|
|
637
|
+
bFound = true;
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
if (!bFound) {
|
|
643
|
+
// add in
|
|
644
|
+
const filterObj: any = {};
|
|
645
|
+
filterObj.ref = menuColumnId;
|
|
646
|
+
filterObj.type = filterType;
|
|
647
|
+
if (containsDateOrTime) {
|
|
648
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
649
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
650
|
+
} else {
|
|
651
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
652
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
filterByColumns.push(filterObj);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function _submitFilter() {
|
|
660
|
+
updateFilterWithInfo();
|
|
661
|
+
filterSortGroupBy();
|
|
662
|
+
|
|
663
|
+
setOpen(false);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function _showFilteredIcon(columnId) {
|
|
667
|
+
for (const filterObj of filterByColumns) {
|
|
668
|
+
if (filterObj.ref === columnId) {
|
|
669
|
+
if (filterObj.containsFilterValue !== '') {
|
|
670
|
+
return true;
|
|
671
|
+
}
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
function results() {
|
|
680
|
+
const len = editableMode ? elements.length : rowData.length;
|
|
681
|
+
|
|
682
|
+
return len ? (
|
|
683
|
+
<span style={{ fontSize: '0.9em', opacity: '0.7' }}>
|
|
684
|
+
{len} result{len > 1 ? 's' : ''}
|
|
685
|
+
</span>
|
|
686
|
+
) : null;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
return (
|
|
690
|
+
<>
|
|
691
|
+
<TableContainer
|
|
692
|
+
component={Paper}
|
|
693
|
+
style={{ margin: '4px 0px' }}
|
|
694
|
+
id='simple-table-manual'
|
|
695
|
+
>
|
|
696
|
+
{propsToUse.label && (
|
|
697
|
+
<h3
|
|
698
|
+
className={`${classes.label} ${required ? classes.tableLabel : ''}`}
|
|
699
|
+
>
|
|
700
|
+
{propsToUse.label} {results()}
|
|
701
|
+
</h3>
|
|
702
|
+
)}
|
|
703
|
+
{validatemessage && (
|
|
704
|
+
<div className={classes.message}>{validatemessage}</div>
|
|
705
|
+
)}
|
|
706
|
+
<Table>
|
|
707
|
+
<TableHead className={classes.header}>
|
|
708
|
+
<TableRow>
|
|
709
|
+
{fieldDefs.map((field: any, index) => {
|
|
710
|
+
if (field?.meta?.config?.hide) {
|
|
711
|
+
return null; // Skip rendering if hide = true
|
|
712
|
+
}
|
|
713
|
+
return (
|
|
714
|
+
<TableCell
|
|
715
|
+
key={`head-${displayedColumns[index]}`}
|
|
716
|
+
className={classes.tableCell}
|
|
717
|
+
>
|
|
718
|
+
{(readOnlyMode || allowEditingInModal) &&
|
|
719
|
+
field.cellRenderer !== 'DeleteIcon' ? (
|
|
720
|
+
<div style={{ display: 'flex' }}>
|
|
721
|
+
<TableSortLabel
|
|
722
|
+
style={{ width: '75%' }}
|
|
723
|
+
active={orderBy === displayedColumns[index]}
|
|
724
|
+
direction={
|
|
725
|
+
orderBy === displayedColumns[index] ? order : 'asc'
|
|
726
|
+
}
|
|
727
|
+
onClick={createSortHandler(displayedColumns[index])}
|
|
728
|
+
>
|
|
729
|
+
{field.label || '---'}
|
|
730
|
+
{_showFilteredIcon(field.name) && (
|
|
731
|
+
<FilterListIcon className={classes.moreIcon} />
|
|
732
|
+
)}
|
|
733
|
+
{orderBy === displayedColumns[index] ? (
|
|
734
|
+
<span className={classes.visuallyHidden}>
|
|
735
|
+
{order === 'desc'
|
|
736
|
+
? 'sorted descending'
|
|
737
|
+
: 'sorted ascending'}
|
|
738
|
+
</span>
|
|
739
|
+
) : null}
|
|
740
|
+
</TableSortLabel>
|
|
741
|
+
<MoreIcon
|
|
742
|
+
style={{ cursor: 'pointer', zIndex: 1000 }}
|
|
743
|
+
id='menu-icon'
|
|
744
|
+
onClick={(event) => {
|
|
745
|
+
_menuClick(
|
|
746
|
+
event,
|
|
747
|
+
field.name,
|
|
748
|
+
field.meta.type,
|
|
749
|
+
field.label,
|
|
750
|
+
);
|
|
751
|
+
}}
|
|
752
|
+
/>
|
|
753
|
+
</div>
|
|
754
|
+
) : (
|
|
755
|
+
field.label
|
|
756
|
+
)}
|
|
757
|
+
</TableCell>
|
|
758
|
+
);
|
|
759
|
+
})}
|
|
760
|
+
</TableRow>
|
|
761
|
+
</TableHead>
|
|
762
|
+
<TableBody>
|
|
763
|
+
{editableMode &&
|
|
764
|
+
!allowEditingInModal &&
|
|
765
|
+
elements.map((row: any, index) => {
|
|
766
|
+
const theKey = `row-${index}`;
|
|
767
|
+
return (
|
|
768
|
+
<TableRow key={theKey}>
|
|
769
|
+
{row.map((item, childIndex) => {
|
|
770
|
+
const theColKey = `data-${index}-${childIndex}`;
|
|
771
|
+
return (
|
|
772
|
+
<TableCell
|
|
773
|
+
key={theColKey}
|
|
774
|
+
className={classes.tableCell}
|
|
775
|
+
>
|
|
776
|
+
{item}
|
|
777
|
+
</TableCell>
|
|
778
|
+
);
|
|
779
|
+
})}
|
|
780
|
+
{showDeleteButton && (
|
|
781
|
+
<TableCell>
|
|
782
|
+
<button
|
|
783
|
+
type='button'
|
|
784
|
+
className='psdk-utility-button'
|
|
785
|
+
id='delete-button'
|
|
786
|
+
aria-label='Delete Cell'
|
|
787
|
+
onClick={() => deleteRecordFromInlineEditable(index)}
|
|
788
|
+
>
|
|
789
|
+
<img
|
|
790
|
+
className='psdk-utility-card-action-svg-icon'
|
|
791
|
+
src={menuIconOverride$}
|
|
792
|
+
/>
|
|
793
|
+
</button>
|
|
794
|
+
</TableCell>
|
|
795
|
+
)}
|
|
796
|
+
</TableRow>
|
|
797
|
+
);
|
|
798
|
+
})}
|
|
799
|
+
{(readOnlyMode || allowEditingInModal) &&
|
|
800
|
+
rowData &&
|
|
801
|
+
rowData.length > 0 &&
|
|
802
|
+
stableSort(rowData, getComparator(order, orderBy))
|
|
803
|
+
.slice(0)
|
|
804
|
+
.map((row, index) => {
|
|
805
|
+
return (
|
|
806
|
+
<TableRow key={index}>
|
|
807
|
+
{row.map((item, childIndex) => {
|
|
808
|
+
const theColKey = displayedColumns[childIndex];
|
|
809
|
+
return (
|
|
810
|
+
<TableCell
|
|
811
|
+
key={theColKey}
|
|
812
|
+
className={classes.tableCell}
|
|
813
|
+
>
|
|
814
|
+
{item}
|
|
815
|
+
</TableCell>
|
|
816
|
+
);
|
|
817
|
+
})}
|
|
818
|
+
{showDeleteButton && (
|
|
819
|
+
<TableCell
|
|
820
|
+
key='DeleteIcon'
|
|
821
|
+
className={classes.tableCell}
|
|
822
|
+
>
|
|
823
|
+
<div>
|
|
824
|
+
<MoreIcon
|
|
825
|
+
id='table-edit-menu-icon'
|
|
826
|
+
className={classes.moreIcon}
|
|
827
|
+
onClick={(event) => {
|
|
828
|
+
editMenuClick(event, index);
|
|
829
|
+
}}
|
|
830
|
+
/>
|
|
831
|
+
<Menu
|
|
832
|
+
id='table-edit-menu'
|
|
833
|
+
anchorEl={editAnchorEl}
|
|
834
|
+
keepMounted
|
|
835
|
+
open={Boolean(editAnchorEl)}
|
|
836
|
+
onClose={_menuClose}
|
|
837
|
+
>
|
|
838
|
+
<MenuItem onClick={() => editRecord()}>
|
|
839
|
+
Edit
|
|
840
|
+
</MenuItem>
|
|
841
|
+
<MenuItem onClick={() => deleteRecord()}>
|
|
842
|
+
Delete
|
|
843
|
+
</MenuItem>
|
|
844
|
+
</Menu>
|
|
845
|
+
</div>
|
|
846
|
+
</TableCell>
|
|
847
|
+
)}
|
|
848
|
+
</TableRow>
|
|
849
|
+
);
|
|
850
|
+
})}
|
|
851
|
+
</TableBody>
|
|
852
|
+
</Table>
|
|
853
|
+
{((readOnlyMode && (!rowData || rowData?.length === 0)) ||
|
|
854
|
+
(editableMode &&
|
|
855
|
+
(!referenceList || referenceList?.length === 0))) && (
|
|
856
|
+
<div className='no-records' id='no-records'>
|
|
857
|
+
{getGenericFieldsLocalizedValue(
|
|
858
|
+
'COSMOSFIELDS.lists',
|
|
859
|
+
'No records found.',
|
|
860
|
+
)}
|
|
861
|
+
</div>
|
|
862
|
+
)}
|
|
863
|
+
</TableContainer>
|
|
864
|
+
{showAddRowButton && (
|
|
865
|
+
<div style={{ fontSize: '1rem' }}>
|
|
866
|
+
<Link
|
|
867
|
+
style={{ cursor: 'pointer' }}
|
|
868
|
+
onClick={addRecord}
|
|
869
|
+
underline='hover'
|
|
870
|
+
>
|
|
871
|
+
+ {localizedVal('Add', localeCategory)}
|
|
872
|
+
</Link>
|
|
873
|
+
</div>
|
|
874
|
+
)}
|
|
875
|
+
<Menu
|
|
876
|
+
id='simple-menu'
|
|
877
|
+
anchorEl={anchorEl}
|
|
878
|
+
keepMounted
|
|
879
|
+
open={Boolean(anchorEl)}
|
|
880
|
+
onClose={_menuClose}
|
|
881
|
+
>
|
|
882
|
+
<MenuItem onClick={_filterMenu}>
|
|
883
|
+
<FilterListIcon /> Filter
|
|
884
|
+
</MenuItem>
|
|
885
|
+
<MenuItem onClick={_groupMenu}>
|
|
886
|
+
<SubjectIcon /> Group
|
|
887
|
+
</MenuItem>
|
|
888
|
+
</Menu>
|
|
889
|
+
<Dialog
|
|
890
|
+
open={open}
|
|
891
|
+
onClose={_closeDialog}
|
|
892
|
+
aria-labelledby='form-dialog-title'
|
|
893
|
+
>
|
|
894
|
+
<DialogTitle id='form-dialog-title'>Filter: {filterBy}</DialogTitle>
|
|
895
|
+
<DialogContent>
|
|
896
|
+
{containsDateOrTime ? (
|
|
897
|
+
<>
|
|
898
|
+
<Select
|
|
899
|
+
variant='standard'
|
|
900
|
+
value={displayDialogDateFilter}
|
|
901
|
+
onChange={_dialogDateFilter}
|
|
902
|
+
fullWidth
|
|
903
|
+
>
|
|
904
|
+
<MenuItem value='notequal'>is not equal to</MenuItem>
|
|
905
|
+
<MenuItem value='equal'>is equal to</MenuItem>
|
|
906
|
+
<MenuItem value='after'>after</MenuItem>
|
|
907
|
+
<MenuItem value='before'>before</MenuItem>
|
|
908
|
+
<MenuItem value='null'>is null</MenuItem>
|
|
909
|
+
<MenuItem value='notnull'>is not null</MenuItem>
|
|
910
|
+
</Select>
|
|
911
|
+
{filterType === 'Date' && (
|
|
912
|
+
<TextField
|
|
913
|
+
variant='standard'
|
|
914
|
+
autoFocus
|
|
915
|
+
margin='dense'
|
|
916
|
+
id='containsFilter'
|
|
917
|
+
type='date'
|
|
918
|
+
fullWidth
|
|
919
|
+
value={displayDialogDateValue}
|
|
920
|
+
onChange={_dialogDateValue}
|
|
921
|
+
/>
|
|
922
|
+
)}
|
|
923
|
+
{filterType === 'DateTime' && (
|
|
924
|
+
<TextField
|
|
925
|
+
variant='standard'
|
|
926
|
+
autoFocus
|
|
927
|
+
margin='dense'
|
|
928
|
+
id='containsFilter'
|
|
929
|
+
type='datetime-local'
|
|
930
|
+
fullWidth
|
|
931
|
+
value={displayDialogDateValue}
|
|
932
|
+
onChange={_dialogDateValue}
|
|
933
|
+
/>
|
|
934
|
+
)}
|
|
935
|
+
{filterType === 'Time' && (
|
|
936
|
+
<TextField
|
|
937
|
+
variant='standard'
|
|
938
|
+
autoFocus
|
|
939
|
+
margin='dense'
|
|
940
|
+
id='containsFilter'
|
|
941
|
+
type='time'
|
|
942
|
+
fullWidth
|
|
943
|
+
value={displayDialogDateValue}
|
|
944
|
+
onChange={_dialogDateValue}
|
|
945
|
+
/>
|
|
946
|
+
)}
|
|
947
|
+
</>
|
|
948
|
+
) : (
|
|
949
|
+
<>
|
|
950
|
+
<Select
|
|
951
|
+
variant='standard'
|
|
952
|
+
id='filter'
|
|
953
|
+
fullWidth
|
|
954
|
+
onChange={_dialogContainsFilter}
|
|
955
|
+
value={displayDialogContainsFilter}
|
|
956
|
+
>
|
|
957
|
+
<MenuItem value='contains'>Contains</MenuItem>
|
|
958
|
+
<MenuItem value='equals'>Equals</MenuItem>
|
|
959
|
+
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
960
|
+
</Select>
|
|
961
|
+
<TextField
|
|
962
|
+
variant='standard'
|
|
963
|
+
autoFocus
|
|
964
|
+
margin='dense'
|
|
965
|
+
id='containsFilter'
|
|
966
|
+
type='text'
|
|
967
|
+
fullWidth
|
|
968
|
+
value={displayDialogContainsValue}
|
|
969
|
+
onChange={_dialogContainsValue}
|
|
970
|
+
/>
|
|
971
|
+
</>
|
|
972
|
+
)}
|
|
973
|
+
</DialogContent>
|
|
974
|
+
<DialogActions>
|
|
975
|
+
<Button onClick={_closeDialog} color='secondary'>
|
|
976
|
+
Cancel
|
|
977
|
+
</Button>
|
|
978
|
+
<Button onClick={_submitFilter} color='primary'>
|
|
979
|
+
Submit
|
|
980
|
+
</Button>
|
|
981
|
+
</DialogActions>
|
|
982
|
+
</Dialog>
|
|
983
|
+
</>
|
|
984
|
+
);
|
|
985
|
+
}
|