@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,541 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
2
|
+
import { CircularProgress, IconButton, Menu, MenuItem, Button } from '@mui/material';
|
|
3
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
4
|
+
|
|
5
|
+
import { Utils } from '../../helpers/utils';
|
|
6
|
+
import {
|
|
7
|
+
clearFieldErrorMessages,
|
|
8
|
+
deleteAttachments,
|
|
9
|
+
getIconFromFileType,
|
|
10
|
+
getMappedValue,
|
|
11
|
+
insertAttachments,
|
|
12
|
+
useDeepMemo,
|
|
13
|
+
useFileDownload,
|
|
14
|
+
validateFileExtension
|
|
15
|
+
} from './AttachmentUtils';
|
|
16
|
+
import { validateMaxSize } from '../../helpers/attachmentShared';
|
|
17
|
+
import type { PageInstructionOptions } from './Attachment.types';
|
|
18
|
+
import type { PConnFieldProps } from '@pega/sdk-react';
|
|
19
|
+
|
|
20
|
+
import './Attachment.css';
|
|
21
|
+
|
|
22
|
+
interface AttachmentProps extends Omit<PConnFieldProps, 'value'> {
|
|
23
|
+
// If any, enter additional props that only exist on this component
|
|
24
|
+
value: any;
|
|
25
|
+
allowMultiple: boolean | string;
|
|
26
|
+
extensions: string;
|
|
27
|
+
editMode: string;
|
|
28
|
+
isTableFormatter: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default function Attachment(props: AttachmentProps) {
|
|
32
|
+
const { value, getPConnect, label, validatemessage, extensions, displayMode, helperText, editMode, isTableFormatter } = props;
|
|
33
|
+
/* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */
|
|
34
|
+
let { required, disabled, allowMultiple } = props;
|
|
35
|
+
[required, disabled, allowMultiple] = [required, disabled, allowMultiple].map(
|
|
36
|
+
prop => prop === true || (typeof prop === 'string' && prop === 'true')
|
|
37
|
+
);
|
|
38
|
+
const pConn = getPConnect();
|
|
39
|
+
const localizationService = pConn.getLocalizationService();
|
|
40
|
+
|
|
41
|
+
const actionSequencer = useMemo(() => PCore.getActionsSequencer(), []);
|
|
42
|
+
const rawValue = pConn.getComponentConfig().value;
|
|
43
|
+
const isAttachmentAnnotationPresent = typeof rawValue === 'object' ? false : rawValue?.includes('@ATTACHMENT');
|
|
44
|
+
const { attachments, isOldAttachment } = isAttachmentAnnotationPresent ? value : PCore.getAttachmentUtils().prepareAttachmentData(value);
|
|
45
|
+
|
|
46
|
+
let valueRef = (pConn.getStateProps() as any).value;
|
|
47
|
+
valueRef = valueRef.indexOf('.') === 0 ? valueRef.substring(1) : valueRef;
|
|
48
|
+
|
|
49
|
+
pConn.setReferenceList(`.${valueRef}`);
|
|
50
|
+
|
|
51
|
+
const isMultiAttachmentInInlineEditTable = isTableFormatter && allowMultiple && editMode === 'tableRows';
|
|
52
|
+
|
|
53
|
+
const [files, setFiles] = useState<any[]>(attachments);
|
|
54
|
+
const overrideLocalState = useRef(false);
|
|
55
|
+
const attachmentCount = useRef(attachments.length);
|
|
56
|
+
const filesWithError = useRef<any[]>([]);
|
|
57
|
+
const multiAttachmentsInInlineEdit = useRef([]);
|
|
58
|
+
const thumbnailURLs = useRef<any[]>([]);
|
|
59
|
+
const contextName = pConn.getContextName();
|
|
60
|
+
const onFileDownload = useFileDownload(contextName);
|
|
61
|
+
|
|
62
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
63
|
+
const localeCategory = 'CosmosFields';
|
|
64
|
+
const uploadMultipleFilesLabel = localizedVal('file_upload_text_multiple', localeCategory);
|
|
65
|
+
const uploadSingleFileLabel = localizedVal('file_upload_text_one', localeCategory);
|
|
66
|
+
const deleteIcon = Utils.getImageSrc('trash', Utils.getSDKStaticConentUrl());
|
|
67
|
+
const srcImg = Utils.getImageSrc('document-doc', Utils.getSDKStaticConentUrl());
|
|
68
|
+
|
|
69
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
70
|
+
const open = Boolean(anchorEl);
|
|
71
|
+
|
|
72
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
73
|
+
const [toggleUploadBegin, setToggleUploadBegin] = useState(false);
|
|
74
|
+
|
|
75
|
+
const deleteFile = useCallback(
|
|
76
|
+
(file, fileIndex) => {
|
|
77
|
+
setAnchorEl(null);
|
|
78
|
+
|
|
79
|
+
// reset the file input so that it will allow re-uploading the same file after deletion
|
|
80
|
+
if (fileInputRef.current) {
|
|
81
|
+
fileInputRef.current.value = ''; // Reset the input
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (filesWithError.current.length > 0) {
|
|
85
|
+
filesWithError.current = filesWithError.current.filter(fileWithError => fileWithError.props.id !== file.props.id);
|
|
86
|
+
if (filesWithError.current.length === 0) {
|
|
87
|
+
clearFieldErrorMessages(pConn);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (file.inProgress) {
|
|
92
|
+
// @ts-ignore - Expected 1 arguments, but got 2.ts(2554)
|
|
93
|
+
PCore.getAttachmentUtils().cancelRequest(file.props.id, contextName);
|
|
94
|
+
actionSequencer.deRegisterBlockingAction(contextName).catch(() => {});
|
|
95
|
+
setFiles(localFiles => {
|
|
96
|
+
return localFiles.filter(localFile => localFile.props.id !== file.props.id);
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
deleteAttachments([file], pConn, multiAttachmentsInInlineEdit.current, {
|
|
100
|
+
allowMultiple,
|
|
101
|
+
isOldAttachment,
|
|
102
|
+
isMultiAttachmentInInlineEditTable,
|
|
103
|
+
attachmentCount: attachmentCount.current,
|
|
104
|
+
deleteIndex: fileIndex
|
|
105
|
+
} as any);
|
|
106
|
+
// Filter out without deleted file and reset the file indexes
|
|
107
|
+
setFiles(localFiles => {
|
|
108
|
+
let tempLocalFiles = [...localFiles];
|
|
109
|
+
tempLocalFiles = tempLocalFiles.filter(localFile => localFile.props.id !== file.props.id);
|
|
110
|
+
tempLocalFiles.forEach(localFile => {
|
|
111
|
+
if (!localFile.props.error && !file.props.error) {
|
|
112
|
+
const updatedDeleteIndex =
|
|
113
|
+
localFile.responseProps.deleteIndex > fileIndex ? localFile.responseProps.deleteIndex - 1 : localFile.responseProps.deleteIndex;
|
|
114
|
+
|
|
115
|
+
localFile.props.onDelete = () => deleteFile(localFile, updatedDeleteIndex);
|
|
116
|
+
|
|
117
|
+
localFile.responseProps.deleteIndex = updatedDeleteIndex;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return tempLocalFiles;
|
|
121
|
+
});
|
|
122
|
+
if (!file.props.error) {
|
|
123
|
+
attachmentCount.current -= 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setToggleUploadBegin(false);
|
|
128
|
+
},
|
|
129
|
+
[pConn]
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const onUploadProgress = (id, ev) => {
|
|
133
|
+
const progress = Math.floor((ev.loaded / ev.total) * 100);
|
|
134
|
+
setFiles(localFiles => [
|
|
135
|
+
...localFiles.map(localFile => {
|
|
136
|
+
if (localFile.props?.id === id) {
|
|
137
|
+
localFile.inProgress = true;
|
|
138
|
+
localFile.props.progress = progress;
|
|
139
|
+
}
|
|
140
|
+
return localFile;
|
|
141
|
+
})
|
|
142
|
+
]);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const populateErrorAndUpdateRedux = file => {
|
|
146
|
+
const fieldName = (pConn.getStateProps() as any).value;
|
|
147
|
+
// set errors to property to block submit even on errors in file upload
|
|
148
|
+
PCore.getMessageManager().addMessages({
|
|
149
|
+
messages: [
|
|
150
|
+
{
|
|
151
|
+
type: 'error',
|
|
152
|
+
message: localizationService.getLocalizedText('Error with one or more files')
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
property: fieldName,
|
|
156
|
+
pageReference: pConn.getPageReference(),
|
|
157
|
+
context: contextName
|
|
158
|
+
});
|
|
159
|
+
insertAttachments([file], pConn, multiAttachmentsInInlineEdit.current, {
|
|
160
|
+
allowMultiple,
|
|
161
|
+
isOldAttachment,
|
|
162
|
+
isMultiAttachmentInInlineEditTable,
|
|
163
|
+
attachmentCount: attachmentCount.current
|
|
164
|
+
} as any);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const errorHandler = (isFetchCanceled, file) => {
|
|
168
|
+
return error => {
|
|
169
|
+
if (!isFetchCanceled(error)) {
|
|
170
|
+
let uploadFailMsg = localizationService.getLocalizedText('Something went wrong');
|
|
171
|
+
if (error.response && error.response.data && error.response.data.errorDetails) {
|
|
172
|
+
uploadFailMsg = localizationService.getLocalizedText(error.response.data.errorDetails[0].localizedValue);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
setFiles(current => {
|
|
176
|
+
return current.map((localFile, index) => {
|
|
177
|
+
if (localFile.props.id === file.props.id) {
|
|
178
|
+
localFile.props.meta = uploadFailMsg;
|
|
179
|
+
localFile.props.error = true;
|
|
180
|
+
localFile.props.onDelete = () => deleteFile(localFile, index);
|
|
181
|
+
localFile.props.icon = getIconFromFileType(localFile.type);
|
|
182
|
+
localFile.props.name = localizationService.getLocalizedText('Unable to upload file');
|
|
183
|
+
localFile.inProgress = false;
|
|
184
|
+
delete localFile.props.progress;
|
|
185
|
+
filesWithError.current.push(localFile);
|
|
186
|
+
|
|
187
|
+
populateErrorAndUpdateRedux(localFile);
|
|
188
|
+
}
|
|
189
|
+
return localFile;
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
throw error;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const onFileAdded = event => {
|
|
198
|
+
let addedFiles = Array.from(event.target.files);
|
|
199
|
+
addedFiles = allowMultiple ? addedFiles : [addedFiles[0]];
|
|
200
|
+
const maxAttachmentSize = PCore.getEnvironmentInfo().getMaxAttachmentSize() || '5';
|
|
201
|
+
const tempFilesToBeUploaded = [
|
|
202
|
+
...addedFiles.map((f: any, index) => {
|
|
203
|
+
f.ID = `${new Date().getTime()}I${index}`;
|
|
204
|
+
f.props = {
|
|
205
|
+
type: f.type,
|
|
206
|
+
name: f.name,
|
|
207
|
+
id: f.ID,
|
|
208
|
+
format: f.name.split('.').pop(),
|
|
209
|
+
icon: getIconFromFileType(f.type),
|
|
210
|
+
onDelete: () => deleteFile(f, index),
|
|
211
|
+
thumbnail: window.URL.createObjectURL(f)
|
|
212
|
+
};
|
|
213
|
+
if (!validateMaxSize(f, maxAttachmentSize)) {
|
|
214
|
+
f.props.error = true;
|
|
215
|
+
f.props.meta = localizationService.getLocalizedText(`File is too big. Max allowed size is ${maxAttachmentSize}MB.`);
|
|
216
|
+
} else if (!validateFileExtension(f, extensions)) {
|
|
217
|
+
f.props.error = true;
|
|
218
|
+
f.props.meta = `${localizationService.getLocalizedText('File has invalid extension. Allowed extensions are:')} ${extensions.replaceAll(
|
|
219
|
+
'.',
|
|
220
|
+
''
|
|
221
|
+
)}`;
|
|
222
|
+
}
|
|
223
|
+
if (f.props.error) {
|
|
224
|
+
const fieldName = (pConn.getStateProps() as any).value;
|
|
225
|
+
PCore.getMessageManager().addMessages({
|
|
226
|
+
messages: [
|
|
227
|
+
{
|
|
228
|
+
type: 'error',
|
|
229
|
+
message: localizationService.getLocalizedText('Error with one or more files')
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
property: fieldName,
|
|
233
|
+
pageReference: pConn.getPageReference(),
|
|
234
|
+
context: contextName
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return f;
|
|
238
|
+
})
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
const tempFilesWithError = tempFilesToBeUploaded.filter(f => f.props.error);
|
|
242
|
+
if (tempFilesWithError.length > 0) {
|
|
243
|
+
filesWithError.current = [...filesWithError.current, ...tempFilesWithError];
|
|
244
|
+
|
|
245
|
+
insertAttachments(tempFilesWithError, pConn, multiAttachmentsInInlineEdit.current, {
|
|
246
|
+
allowMultiple,
|
|
247
|
+
isOldAttachment,
|
|
248
|
+
isMultiAttachmentInInlineEditTable,
|
|
249
|
+
attachmentCount: attachmentCount.current
|
|
250
|
+
} as PageInstructionOptions);
|
|
251
|
+
}
|
|
252
|
+
setFiles(current => (!allowMultiple ? [...tempFilesToBeUploaded] : [...current, ...tempFilesToBeUploaded]));
|
|
253
|
+
setToggleUploadBegin(true);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const uploadFiles = useCallback(() => {
|
|
257
|
+
const filesToBeUploaded = files
|
|
258
|
+
.filter(e => {
|
|
259
|
+
const isFileUploaded = e.props && e.props.progress === 100;
|
|
260
|
+
const fileHasError = e.props && e.props.error;
|
|
261
|
+
const isFileUploadedInLastStep = e.responseProps && e.responseProps.ID !== 'temp';
|
|
262
|
+
const isFileUploadInProgress = e.inProgress;
|
|
263
|
+
return !isFileUploadInProgress && !isFileUploaded && !fileHasError && !isFileUploadedInLastStep;
|
|
264
|
+
})
|
|
265
|
+
.map(file =>
|
|
266
|
+
PCore.getAttachmentUtils().uploadAttachment(
|
|
267
|
+
file,
|
|
268
|
+
ev => {
|
|
269
|
+
onUploadProgress(file.props.id, ev);
|
|
270
|
+
},
|
|
271
|
+
isFetchCanceled => {
|
|
272
|
+
return errorHandler(isFetchCanceled, file);
|
|
273
|
+
},
|
|
274
|
+
contextName
|
|
275
|
+
)
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
// allow new files to be added when other files upload is still in progress
|
|
279
|
+
setToggleUploadBegin(false);
|
|
280
|
+
Promise.allSettled(filesToBeUploaded)
|
|
281
|
+
.then((fileResponses: any) => {
|
|
282
|
+
fileResponses = fileResponses.filter(fr => fr.status !== 'rejected'); // in case of deleting an in progress file, promise gets cancelled but still enters then block
|
|
283
|
+
if (fileResponses.length > 0) {
|
|
284
|
+
setFiles(localFiles => {
|
|
285
|
+
const tempFilesUploaded = [...localFiles];
|
|
286
|
+
tempFilesUploaded.forEach(localFile => {
|
|
287
|
+
// if attach field has multiple files & in bw any error files are present
|
|
288
|
+
// Example : files = [properFile1, errFile, errFile, properFile2]
|
|
289
|
+
// indexes for delete & preview should be for files [properFile1, properFile2] which is [1,2]
|
|
290
|
+
const index = fileResponses.findIndex(fileResponse => fileResponse.value.clientFileID === localFile.props.id);
|
|
291
|
+
if (index >= 0) {
|
|
292
|
+
fileResponses[index].value.thumbnail = localFile.props.thumbnail;
|
|
293
|
+
localFile.inProgress = false;
|
|
294
|
+
localFile.ID = fileResponses[index].value.ID;
|
|
295
|
+
localFile.props.meta = localizationService.getLocalizedText('Uploaded successfully');
|
|
296
|
+
localFile.props.progress = 100;
|
|
297
|
+
localFile.handle = fileResponses[index].value.ID;
|
|
298
|
+
localFile.label = valueRef;
|
|
299
|
+
localFile.responseProps = {
|
|
300
|
+
pzInsKey: 'temp'
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
return tempFilesUploaded;
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
insertAttachments(fileResponses, pConn, multiAttachmentsInInlineEdit.current, {
|
|
308
|
+
allowMultiple,
|
|
309
|
+
isOldAttachment,
|
|
310
|
+
isMultiAttachmentInInlineEditTable,
|
|
311
|
+
attachmentCount: attachmentCount.current,
|
|
312
|
+
insert: true
|
|
313
|
+
} as any);
|
|
314
|
+
attachmentCount.current += fileResponses.length;
|
|
315
|
+
|
|
316
|
+
if (filesWithError.current.length === 0) {
|
|
317
|
+
clearFieldErrorMessages(pConn);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
actionSequencer.deRegisterBlockingAction(contextName).catch(() => {});
|
|
321
|
+
})
|
|
322
|
+
.catch(error => {
|
|
323
|
+
console.log(error);
|
|
324
|
+
setToggleUploadBegin(false);
|
|
325
|
+
});
|
|
326
|
+
}, [files]);
|
|
327
|
+
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
if (toggleUploadBegin && files.length > 0) {
|
|
330
|
+
actionSequencer.registerBlockingAction(contextName).then(() => {
|
|
331
|
+
uploadFiles();
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}, [toggleUploadBegin]);
|
|
335
|
+
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
if (filesWithError.current.length === 0) {
|
|
338
|
+
clearFieldErrorMessages(pConn);
|
|
339
|
+
}
|
|
340
|
+
}, [filesWithError]);
|
|
341
|
+
|
|
342
|
+
const memoizedAttachments = useDeepMemo(() => {
|
|
343
|
+
return attachments;
|
|
344
|
+
}, [attachments]);
|
|
345
|
+
|
|
346
|
+
// Prepares new structure as per Cosmos component
|
|
347
|
+
const transformAttachments = () => {
|
|
348
|
+
const transformedFiles = [...attachments];
|
|
349
|
+
let deleteIndex = -1;
|
|
350
|
+
transformedFiles.forEach(attachment => {
|
|
351
|
+
attachment.props.id = attachment.responseProps.ID;
|
|
352
|
+
attachment.props.format = attachment.props.name.split('.').pop();
|
|
353
|
+
if (attachment.props.error) {
|
|
354
|
+
attachment.responseProps.deleteIndex = deleteIndex;
|
|
355
|
+
} else {
|
|
356
|
+
deleteIndex += 1;
|
|
357
|
+
attachment.responseProps.deleteIndex = deleteIndex;
|
|
358
|
+
}
|
|
359
|
+
if (attachment.props.thumbnail) {
|
|
360
|
+
thumbnailURLs.current.push(attachment.props.thumbnail);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
return transformedFiles;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
useEffect(() => {
|
|
368
|
+
const caseID = PCore.getStoreValue(`.${getMappedValue('pyID')}`, PCore.getResolvedConstantValue('caseInfo.content'), contextName);
|
|
369
|
+
if (displayMode !== 'DISPLAY_ONLY') {
|
|
370
|
+
PCore.getPubSubUtils().subscribe(
|
|
371
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION,
|
|
372
|
+
() => {
|
|
373
|
+
overrideLocalState.current = true;
|
|
374
|
+
},
|
|
375
|
+
caseID
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// When component mounts, only set local files state from redux.
|
|
380
|
+
const serverFiles = transformAttachments();
|
|
381
|
+
setFiles(serverFiles);
|
|
382
|
+
filesWithError.current = serverFiles.filter(file => file.props.error);
|
|
383
|
+
|
|
384
|
+
return () => {
|
|
385
|
+
if (displayMode !== 'DISPLAY_ONLY') {
|
|
386
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, caseID);
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
}, []);
|
|
390
|
+
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (overrideLocalState.current) {
|
|
393
|
+
const serverFiles = transformAttachments();
|
|
394
|
+
overrideLocalState.current = false;
|
|
395
|
+
attachmentCount.current = attachments.length;
|
|
396
|
+
filesWithError.current = [];
|
|
397
|
+
setFiles(serverFiles);
|
|
398
|
+
} else {
|
|
399
|
+
// Determine whether refresh call has overridden any error files in redux, push error files back to redux from local state to perform client side validation during assignment submit
|
|
400
|
+
const errorFiles = attachments.filter(attachment => attachment.props.error);
|
|
401
|
+
if (errorFiles.length === 0 && filesWithError.current.length > 0) {
|
|
402
|
+
// Check if local file state contains error files and push those to redux
|
|
403
|
+
const uniqueKey = getMappedValue('pzInsKey');
|
|
404
|
+
const transformedErrorFiles = filesWithError.current.map(errorFile => {
|
|
405
|
+
const filename = errorFile.props.name;
|
|
406
|
+
return {
|
|
407
|
+
[uniqueKey]: errorFile.props.id,
|
|
408
|
+
FileName: filename,
|
|
409
|
+
Category: '',
|
|
410
|
+
FileExtension: filename.split('.').pop() ?? filename,
|
|
411
|
+
error: errorFile.props.error || null
|
|
412
|
+
};
|
|
413
|
+
});
|
|
414
|
+
let key = '';
|
|
415
|
+
let updatedAttachments: any = [];
|
|
416
|
+
if (allowMultiple || isOldAttachment) {
|
|
417
|
+
key = isOldAttachment ? `${valueRef}.pxResults` : valueRef;
|
|
418
|
+
const existingAttachments = PCore.getStoreValue(`.${key}`, pConn.getPageReference(), pConn.getContextName()) || [];
|
|
419
|
+
updatedAttachments = [...existingAttachments, ...transformedErrorFiles];
|
|
420
|
+
} else {
|
|
421
|
+
key = valueRef;
|
|
422
|
+
updatedAttachments = transformedErrorFiles[0];
|
|
423
|
+
}
|
|
424
|
+
PCore.getStateUtils().updateState(pConn.getContextName(), key, updatedAttachments, {
|
|
425
|
+
pageReference: pConn.getPageReference(),
|
|
426
|
+
isArrayDeepMerge: false,
|
|
427
|
+
removePropertyFromChangedList: true
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}, [memoizedAttachments]);
|
|
432
|
+
|
|
433
|
+
const handleClick = event => {
|
|
434
|
+
setAnchorEl(event.currentTarget);
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
const handleClose = () => {
|
|
438
|
+
setAnchorEl(null);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
const content = (
|
|
442
|
+
<div style={{ marginBottom: '8px' }}>
|
|
443
|
+
<div className={`${disabled ? 'file-disabled' : ''} ${validatemessage === '' ? 'file-div' : 'file-div-error'}`}>
|
|
444
|
+
<div hidden={true} id='attachment-ID'>
|
|
445
|
+
{valueRef}
|
|
446
|
+
</div>
|
|
447
|
+
<label htmlFor={valueRef}>
|
|
448
|
+
<input
|
|
449
|
+
style={{ display: 'none' }}
|
|
450
|
+
id={valueRef}
|
|
451
|
+
name='upload-photo'
|
|
452
|
+
type='file'
|
|
453
|
+
multiple={allowMultiple}
|
|
454
|
+
required={required}
|
|
455
|
+
disabled={disabled}
|
|
456
|
+
onChange={onFileAdded}
|
|
457
|
+
/>
|
|
458
|
+
<Button style={{ textTransform: 'none' }} variant='outlined' color='primary' component='span'>
|
|
459
|
+
{allowMultiple
|
|
460
|
+
? uploadMultipleFilesLabel === 'file_upload_text_multiple'
|
|
461
|
+
? 'Choose files'
|
|
462
|
+
: uploadMultipleFilesLabel
|
|
463
|
+
: uploadSingleFileLabel === 'file_upload_text_one'
|
|
464
|
+
? 'Choose a file'
|
|
465
|
+
: uploadSingleFileLabel}
|
|
466
|
+
</Button>
|
|
467
|
+
</label>
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
);
|
|
471
|
+
|
|
472
|
+
const fileDisplay = (
|
|
473
|
+
<div>
|
|
474
|
+
{files &&
|
|
475
|
+
files.length > 0 &&
|
|
476
|
+
files.map((item, index) => {
|
|
477
|
+
return (
|
|
478
|
+
<div key={index} className='psdk-utility-card'>
|
|
479
|
+
<div className='psdk-utility-card-icon'>
|
|
480
|
+
{!item.inProgress && <img className='psdk-utility-card-svg-icon' src={srcImg} />}
|
|
481
|
+
{item.inProgress && (
|
|
482
|
+
<div>
|
|
483
|
+
<CircularProgress />
|
|
484
|
+
</div>
|
|
485
|
+
)}
|
|
486
|
+
</div>
|
|
487
|
+
<div className='psdk-utility-card-main'>
|
|
488
|
+
<div className='psdk-utility-card-main-primary-label'>{item.props.name}</div>
|
|
489
|
+
{item.props.meta && <div style={{ color: item.props.error ? 'red' : undefined }}>{item.props.meta}</div>}
|
|
490
|
+
</div>
|
|
491
|
+
<div className='psdk-utility-action'>
|
|
492
|
+
{item.ID && (
|
|
493
|
+
<button type='button' className='psdk-utility-button' aria-label='Delete Attachment' onClick={() => deleteFile(item, index)}>
|
|
494
|
+
<img className='psdk-utility-card-action-svg-icon' src={deleteIcon} />
|
|
495
|
+
</button>
|
|
496
|
+
)}
|
|
497
|
+
{!item.ID && (
|
|
498
|
+
<div>
|
|
499
|
+
<IconButton
|
|
500
|
+
id='setting-button'
|
|
501
|
+
aria-controls={open ? 'file-menu' : undefined}
|
|
502
|
+
aria-expanded={open ? 'true' : undefined}
|
|
503
|
+
aria-haspopup='true'
|
|
504
|
+
onClick={handleClick}
|
|
505
|
+
size='large'
|
|
506
|
+
>
|
|
507
|
+
<MoreVertIcon />
|
|
508
|
+
</IconButton>
|
|
509
|
+
<Menu style={{ marginTop: '3rem' }} id='file-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
|
|
510
|
+
<MenuItem
|
|
511
|
+
style={{ fontSize: '14px' }}
|
|
512
|
+
key='download'
|
|
513
|
+
onClick={() => {
|
|
514
|
+
setAnchorEl(null);
|
|
515
|
+
onFileDownload(item.responseProps ? item.responseProps : {});
|
|
516
|
+
}}
|
|
517
|
+
>
|
|
518
|
+
Download
|
|
519
|
+
</MenuItem>
|
|
520
|
+
<MenuItem style={{ fontSize: '14px' }} key='delete' onClick={() => deleteFile(item, index)}>
|
|
521
|
+
Delete
|
|
522
|
+
</MenuItem>
|
|
523
|
+
</Menu>
|
|
524
|
+
</div>
|
|
525
|
+
)}
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
);
|
|
529
|
+
})}
|
|
530
|
+
</div>
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
return (
|
|
534
|
+
<div className='file-upload-container'>
|
|
535
|
+
<span className={`label ${required ? 'file-label' : ''}`}>{label}</span>
|
|
536
|
+
{((files.length === 0 && !allowMultiple) || allowMultiple) && <section>{content}</section>}
|
|
537
|
+
{validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : <span style={{ fontSize: '14px' }}>{helperText}</span>}
|
|
538
|
+
{files && files.length > 0 && <section>{fileDisplay}</section>}
|
|
539
|
+
</div>
|
|
540
|
+
);
|
|
541
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ReactElement, Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ResponseProps {
|
|
4
|
+
ID: string;
|
|
5
|
+
extension: string;
|
|
6
|
+
createDateTime?: Date | string | number;
|
|
7
|
+
createUser?: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AttachmentActions {
|
|
12
|
+
rel: string;
|
|
13
|
+
href: string;
|
|
14
|
+
title: string;
|
|
15
|
+
type: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AttachmentLinks {
|
|
19
|
+
delete: AttachmentActions;
|
|
20
|
+
download: AttachmentActions;
|
|
21
|
+
edit: AttachmentActions;
|
|
22
|
+
}
|
|
23
|
+
export interface FileObject extends File {
|
|
24
|
+
icon?: string;
|
|
25
|
+
ID: string;
|
|
26
|
+
fileName: string;
|
|
27
|
+
category: string;
|
|
28
|
+
responseType: string;
|
|
29
|
+
fileType: string;
|
|
30
|
+
mimeType: string;
|
|
31
|
+
extension: string;
|
|
32
|
+
thumbnail?: string;
|
|
33
|
+
nameWithExt: string;
|
|
34
|
+
inProgress?: boolean;
|
|
35
|
+
progress?: number;
|
|
36
|
+
handle: string;
|
|
37
|
+
label: string;
|
|
38
|
+
delete?: boolean;
|
|
39
|
+
error?: boolean;
|
|
40
|
+
description: string;
|
|
41
|
+
|
|
42
|
+
props: {
|
|
43
|
+
icon?: string;
|
|
44
|
+
|
|
45
|
+
ref?: Ref<HTMLDivElement>;
|
|
46
|
+
id: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
format?: string;
|
|
49
|
+
name: string;
|
|
50
|
+
thumbnail?: string;
|
|
51
|
+
onPreview?: () => void;
|
|
52
|
+
onDelete?: () => void;
|
|
53
|
+
onOpen?: () => void;
|
|
54
|
+
onEdit?: () => void;
|
|
55
|
+
onCancel?: () => void;
|
|
56
|
+
};
|
|
57
|
+
responseProps: ResponseProps;
|
|
58
|
+
value?: {
|
|
59
|
+
filename: string;
|
|
60
|
+
ID: string;
|
|
61
|
+
thumbnail: string;
|
|
62
|
+
};
|
|
63
|
+
categoryName: string;
|
|
64
|
+
createTime: string;
|
|
65
|
+
createdBy: string;
|
|
66
|
+
createdByName: string;
|
|
67
|
+
links: AttachmentLinks;
|
|
68
|
+
name: string;
|
|
69
|
+
meta?: ReactElement;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ReduxAttachments {
|
|
73
|
+
ID?: string;
|
|
74
|
+
pzInsKey?: string;
|
|
75
|
+
FileName: string;
|
|
76
|
+
Category: string;
|
|
77
|
+
MimeType?: string;
|
|
78
|
+
FileExtension: string;
|
|
79
|
+
error: string | null;
|
|
80
|
+
localAttachment: boolean;
|
|
81
|
+
thumbnail?: string;
|
|
82
|
+
fileIndex?: number;
|
|
83
|
+
instruction?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface PageInstructionOptions {
|
|
87
|
+
allowMultiple: boolean;
|
|
88
|
+
isMultiAttachmentInInlineEditTable: boolean;
|
|
89
|
+
attachmentCount: number;
|
|
90
|
+
insertPageInstruction: boolean;
|
|
91
|
+
deletePageInstruction: boolean;
|
|
92
|
+
deleteIndex: number;
|
|
93
|
+
insertRedux: boolean;
|
|
94
|
+
isOldAttachment: boolean;
|
|
95
|
+
deleteRedux: boolean;
|
|
96
|
+
}
|