@pega/sdk 0.0.5 → 0.0.7
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/README.md +10 -3
- package/dist/index.js +828 -165
- package/package.json +1 -1
- package/templates/react-native-sdk-reference/.claude/settings.json +5 -0
- package/templates/react-native-sdk-reference/.prettierignore +17 -0
- package/templates/react-native-sdk-reference/.vscode/extensions.json +1 -0
- package/templates/react-native-sdk-reference/.vscode/settings.json +7 -0
- package/templates/react-native-sdk-reference/AGENTS.md +3 -0
- package/templates/react-native-sdk-reference/CLAUDE.md +1 -0
- package/templates/react-native-sdk-reference/README.md +56 -0
- package/templates/react-native-sdk-reference/app.json +40 -5
- package/templates/react-native-sdk-reference/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
- package/templates/react-native-sdk-reference/assets/expo.icon/Assets/grid.png +0 -0
- package/templates/react-native-sdk-reference/assets/expo.icon/icon.json +35 -0
- package/templates/react-native-sdk-reference/assets/icons/bell.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/clock.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/cross.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/donut.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/gear.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/globe.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/internet.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/music.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/right-arrow.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/speed.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/MediaCo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/adaptive-icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-background.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-foreground.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-monochrome.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-badge-white.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-badge.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/favicon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/logo-glow.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/partial-react-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo@2x.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo@3x.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/splash-icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/tutorial-web.png +0 -0
- package/templates/react-native-sdk-reference/eslint.config.mjs +68 -0
- package/templates/react-native-sdk-reference/package.json +59 -14
- package/templates/react-native-sdk-reference/pega-constellationjs-0.26.3.tgz +0 -0
- package/templates/react-native-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-native-sdk-reference/pega-sdk-types-0.1.0.tgz +0 -0
- package/templates/react-native-sdk-reference/sdk-config.json +31 -9
- package/templates/react-native-sdk-reference/src/app/_layout.tsx +38 -0
- package/templates/react-native-sdk-reference/src/app/home/_layout.tsx +39 -0
- package/templates/react-native-sdk-reference/src/app/home/contact.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/home/index.tsx +36 -0
- package/templates/react-native-sdk-reference/src/app/home/shop.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/home/your-services.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/index.tsx +72 -0
- package/templates/react-native-sdk-reference/src/app/workarea.tsx +135 -0
- package/templates/react-native-sdk-reference/src/bridge/Context/StoreContext.ts +4 -0
- package/templates/react-native-sdk-reference/src/bridge/RootComponent.tsx +12 -0
- package/templates/react-native-sdk-reference/src/bridge/react_pconnect.jsx +334 -0
- package/templates/react-native-sdk-reference/src/components/common/DisplayField.tsx +29 -0
- package/templates/react-native-sdk-reference/src/components/common/FormFieldWrapper.tsx +5 -0
- package/templates/react-native-sdk-reference/src/components/common/HelperText.tsx +11 -0
- package/templates/react-native-sdk-reference/src/components/common/LabelText.tsx +22 -0
- package/templates/react-native-sdk-reference/src/components/common/inputTheme.ts +17 -0
- package/templates/react-native-sdk-reference/src/components/design-system/AutoComplete.tsx +126 -0
- package/templates/react-native-sdk-reference/src/components/design-system/FieldGroup.tsx +72 -0
- package/templates/react-native-sdk-reference/src/components/design-system/Radio.tsx +61 -0
- package/templates/react-native-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +196 -0
- package/templates/react-native-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +89 -0
- package/templates/react-native-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Currency/Currency.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/Currency/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Date/Date.tsx +94 -0
- package/templates/react-native-sdk-reference/src/components/field/Date/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +211 -0
- package/templates/react-native-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Email/Email.tsx +81 -0
- package/templates/react-native-sdk-reference/src/components/field/Email/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Group/Group.tsx +47 -0
- package/templates/react-native-sdk-reference/src/components/field/Group/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Integer/Integer.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/Integer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Phone/Phone.tsx +85 -0
- package/templates/react-native-sdk-reference/src/components/field/Phone/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +118 -0
- package/templates/react-native-sdk-reference/src/components/field/RadioButtons/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/field/TextArea/TextArea.tsx +86 -0
- package/templates/react-native-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/TextInput/TextInput.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/URL/URL.tsx +86 -0
- package/templates/react-native-sdk-reference/src/components/field/URL/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/helpers/data_page.ts +20 -0
- package/templates/react-native-sdk-reference/src/components/helpers/event-utils.ts +20 -0
- package/templates/react-native-sdk-reference/src/components/helpers/instructions-utils.ts +57 -0
- package/templates/react-native-sdk-reference/src/components/helpers/state-utils.tsx +46 -0
- package/templates/react-native-sdk-reference/src/components/helpers/template-utils.ts +75 -0
- package/templates/react-native-sdk-reference/src/components/helpers/utils.ts +339 -0
- package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/ActionButtons.tsx +63 -0
- package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Assignment/Assignment.tsx +348 -0
- package/templates/react-native-sdk-reference/src/components/infra/Assignment/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/AssignmentCard.tsx +56 -0
- package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/FlowContainer.tsx +57 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/helpers.ts +137 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/RootContainer.tsx +52 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/helper.ts +128 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/index.tsx +59 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/ViewContainer.tsx +31 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/helper.ts +39 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/helper.ts +9 -0
- package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/ErrorBoundary.tsx +53 -0
- package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/MultiStep/MultiStep.tsx +24 -0
- package/templates/react-native-sdk-reference/src/components/infra/MultiStep/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/Reference.tsx +68 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/utils.ts +16 -0
- package/templates/react-native-sdk-reference/src/components/infra/Region/Region.tsx +10 -0
- package/templates/react-native-sdk-reference/src/components/infra/Region/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/View/View.tsx +49 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +38 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/utils/index.ts +28 -0
- package/templates/react-native-sdk-reference/src/components/template/Details/Details.tsx +82 -0
- package/templates/react-native-sdk-reference/src/components/template/Details/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/template/OneColumn/OneColumn.tsx +29 -0
- package/templates/react-native-sdk-reference/src/components/template/OneColumn/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/context/LoaderContext.tsx +42 -0
- package/templates/react-native-sdk-reference/src/mediaco/AdvBanner.tsx +62 -0
- package/templates/react-native-sdk-reference/src/mediaco/Header.tsx +60 -0
- package/templates/react-native-sdk-reference/src/mediaco/HomeScreen.tsx +78 -0
- package/templates/react-native-sdk-reference/src/mediaco/QuickActions.tsx +68 -0
- package/templates/react-native-sdk-reference/src/mediaco/ResolutionScreen.tsx +48 -0
- package/templates/react-native-sdk-reference/src/mediaco/SafeArea.tsx +11 -0
- package/templates/react-native-sdk-reference/src/mediaco/TabBar.tsx +102 -0
- package/templates/react-native-sdk-reference/src/mediaco/YourServices.tsx +90 -0
- package/templates/react-native-sdk-reference/src/sdk-pega-component-map.ts +64 -0
- package/templates/react-native-sdk-reference/src/types/PConnProps.d.ts +41 -0
- package/templates/react-native-sdk-reference/src/utils/auth.ts +62 -0
- package/templates/react-native-sdk-reference/src/utils/init-pcore.ts +37 -0
- package/templates/react-native-sdk-reference/src/utils/pcore-polyfills.ts +66 -0
- package/templates/react-native-sdk-reference/tsconfig.json +9 -8
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +171 -0
- package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +25 -26
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +119 -0
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +70 -121
- package/templates/react-sdk-reference/.ai-common/instructions/component-map.md +7 -19
- package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +10 -40
- package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +134 -0
- package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +15 -43
- package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +11 -63
- package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +12 -57
- package/templates/react-sdk-reference/.ai-common/mcp/claude-code.mcp.json +8 -0
- package/templates/react-sdk-reference/.ai-common/mcp/copilot.mcp.json +8 -0
- package/templates/react-sdk-reference/.ai-common/mcp/cursor.mcp.json +11 -0
- package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +45 -71
- package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +98 -0
- package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +155 -0
- package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +67 -237
- package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +26 -77
- package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +315 -0
- package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +31 -80
- package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +43 -99
- package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +33 -83
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AlertBanner.md +60 -74
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Banner.md +64 -84
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/CaseSummaryFields.md +76 -109
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/DetailsFields.md +84 -101
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroup.md +62 -87
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroupList.md +56 -76
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldValueList.md +61 -85
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Operator.md +84 -107
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Pulse.md +36 -44
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/RichTextEditor.md +125 -189
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/WssQuickCreate.md +34 -50
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +57 -179
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +130 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +311 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +156 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +476 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-components.md +120 -242
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +71 -212
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/CancelAlert.md +47 -209
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Checkbox.md +90 -259
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Currency.md +75 -169
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Date.md +65 -160
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/DateTime.md +59 -157
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Decimal.md +55 -134
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Dropdown.md +61 -185
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Email.md +60 -138
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Group.md +40 -99
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Integer.md +44 -111
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Location.md +57 -165
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Multiselect.md +41 -122
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +32 -130
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Percentage.md +48 -112
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Phone.md +43 -153
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/RadioButtons.md +76 -183
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/RichText.md +59 -176
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ScalarList.md +30 -123
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/SelectableCard.md +47 -178
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/SemanticLink.md +31 -117
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextArea.md +51 -106
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextContent.md +22 -75
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextInput.md +54 -116
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Time.md +46 -100
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/URL.md +44 -93
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +40 -167
- package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +165 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/ActionButtons.md +122 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/MultiStep.md +178 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/Stages.md +140 -0
- package/templates/react-sdk-reference/.ai-common/skills/template-components.md +74 -228
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/AdvancedSearch.md +66 -167
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/AppShell.md +57 -170
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/BannerPage.md +41 -76
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseSummary.md +53 -109
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseView.md +86 -289
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseViewActionsMenu.md +60 -185
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/Confirmation.md +66 -115
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DataReference.md +33 -68
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultForm.md +53 -133
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultPage.md +39 -82
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/Details.md +38 -91
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsSubTabs.md +47 -101
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsThreeColumn.md +27 -34
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsTwoColumn.md +25 -40
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DynamicTabs.md +34 -104
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/FieldGroupTemplate.md +46 -147
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/HierarchicalForm.md +139 -100
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboard.md +43 -82
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboardPage.md +47 -80
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListPage.md +16 -29
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +43 -228
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/MultiReferenceReadOnly.md +20 -65
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/NarrowWide.md +49 -97
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/OneColumn.md +37 -71
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/PromotedFilters.md +58 -148
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SelfServiceCaseView.md +82 -107
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +21 -60
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SingleReferenceReadOnly.md +43 -100
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SubTabs.md +36 -76
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/TwoColumn.md +41 -90
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/WideNarrow.md +36 -43
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/WssNavBar.md +25 -115
- package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +38 -174
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/AppAnnouncement.md +30 -57
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Attachment.md +55 -101
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/CaseHistory.md +38 -121
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/FileUtility.md +37 -98
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Followers.md +18 -33
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/QuickCreate.md +26 -91
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/SummaryItem.md +28 -120
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/ToDo.md +41 -272
- package/templates/react-sdk-reference/package.json +1 -1
- package/templates/react-sdk-reference/pega-auth-0.2.44.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +13 -3
- package/templates/react-native-sdk-reference/.github/AGENTS.md +0 -23
- package/templates/react-native-sdk-reference/.github/copilot-instructions.md +0 -40
- package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +0 -48
- package/templates/react-native-sdk-reference/App.tsx +0 -49
- package/templates/react-native-sdk-reference/expo-env.d.ts +0 -3
- package/templates/react-sdk-reference/pega-auth-0.2.42.tgz +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
File upload/download widget for case attachments. Behaves like a form field — binds to a case attachment property, supports multiple files, validates extensions and size, tracks upload progress, and blocks form submission during active uploads.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, inputs interface, data-fetching patterns, and registration conventions common to ALL widget components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -12,84 +12,48 @@ Renders a file attachment control within a Pega form. Users can upload one or mu
|
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
|
-
- **Registration key:** `Attachment` (in
|
|
15
|
+
- **Registration key:** `Attachment` (registered in the project's component map)
|
|
16
16
|
- **Category:** Widget — form field (file input)
|
|
17
|
-
- **Extends:**
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
| ------------------ | ------------------- |
|
|
23
|
-
| `value` | `any` | Yes
|
|
24
|
-
| `allowMultiple` | `boolean \| string` | No
|
|
25
|
-
| `extensions` | `string` | No
|
|
26
|
-
| `editMode` | `string` | No
|
|
27
|
-
| `isTableFormatter` | `boolean` | No
|
|
28
|
-
| `label` | `string` | Yes (from
|
|
29
|
-
| `required` | `boolean` | No
|
|
30
|
-
| `disabled` | `boolean` | No
|
|
31
|
-
| `displayMode` | `string` | No
|
|
32
|
-
| `validatemessage` | `string` | No
|
|
33
|
-
| `helperText` | `string` | No
|
|
34
|
-
| `getPConnect` | `function` | Yes
|
|
35
|
-
|
|
36
|
-
##
|
|
17
|
+
- **Extends:** the project's base component interface (with `value` typed as `any` instead of the standard string value)
|
|
18
|
+
|
|
19
|
+
## Inputs
|
|
20
|
+
|
|
21
|
+
| Input | Type | Required | Description |
|
|
22
|
+
| ------------------ | ------------------- | ------------------------- | ---------------------------------------------------------------------------- |
|
|
23
|
+
| `value` | `any` | Yes | Attachment list or single attachment object (from Pega property) |
|
|
24
|
+
| `allowMultiple` | `boolean \| string` | No | Whether multiple files can be attached. Default `false` |
|
|
25
|
+
| `extensions` | `string` | No | Comma-separated list of allowed file extensions (e.g., `".pdf,.doc,.jpg"`) |
|
|
26
|
+
| `editMode` | `string` | No | `"tableRows"` for inline table edit mode (special multi-attachment handling) |
|
|
27
|
+
| `isTableFormatter` | `boolean` | No | Whether this widget is used inside a table formatter |
|
|
28
|
+
| `label` | `string` | Yes (from base interface) | Field label |
|
|
29
|
+
| `required` | `boolean` | No | Whether a file is required |
|
|
30
|
+
| `disabled` | `boolean` | No | Whether the control is disabled |
|
|
31
|
+
| `displayMode` | `string` | No | `"DISPLAY_ONLY"` for read-only rendering |
|
|
32
|
+
| `validatemessage` | `string` | No | Validation error message to display |
|
|
33
|
+
| `helperText` | `string` | No | Helper text shown below the control |
|
|
34
|
+
| `getPConnect` | `function` | Yes | PConnect getter |
|
|
35
|
+
|
|
36
|
+
## Implementation Structure
|
|
37
37
|
|
|
38
38
|
This is a complex form-field widget (~400 lines). Key structural outline:
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
[required, disabled, allowMultiple] = [required, disabled, allowMultiple].map(
|
|
58
|
-
p => p === true || (typeof p === 'string' && p === 'true')
|
|
59
|
-
);
|
|
60
|
-
const pConn = getPConnect();
|
|
61
|
-
const actionSequencer = useMemo(() => PCore.getActionsSequencer(), []);
|
|
62
|
-
const contextName = pConn.getContextName();
|
|
63
|
-
|
|
64
|
-
// 1. Normalize attachment data (old vs new format)
|
|
65
|
-
const { attachments, isOldAttachment } = PCore.getAttachmentUtils().prepareAttachmentData(value);
|
|
66
|
-
// 2. Set reference list
|
|
67
|
-
let valueRef = (pConn.getStateProps() as any).value;
|
|
68
|
-
pConn.setReferenceList(`.${valueRef}`);
|
|
69
|
-
|
|
70
|
-
// 3. State: files array, error tracking, upload toggle
|
|
71
|
-
const [files, setFiles] = useState(attachments);
|
|
72
|
-
const [toggleUploadBegin, setToggleUploadBegin] = useState(false);
|
|
73
|
-
|
|
74
|
-
// 4. deleteFile — removes from state, calls deleteAttachments, deregisters sequencer
|
|
75
|
-
// 5. onFileAdded — validates extension + size, adds to files, sets toggleUploadBegin
|
|
76
|
-
// 6. uploadFiles — registerBlockingAction, uploadAttachment per file, insertAttachments on success
|
|
77
|
-
// 7. useEffect: trigger uploadFiles when toggleUploadBegin changes
|
|
78
|
-
// 8. useEffect: subscribe to ASSIGNMENT_SUBMISSION for state override
|
|
79
|
-
|
|
80
|
-
// 9. Render: label + upload button + validation message + file list with progress/delete
|
|
81
|
-
return (
|
|
82
|
-
<div className="file-upload-container">
|
|
83
|
-
<label>{label}</label>
|
|
84
|
-
{/* Upload button (hidden input + styled button) */}
|
|
85
|
-
{/* Validation/helper text */}
|
|
86
|
-
{/* File list: icon + name + meta + progress + delete button */}
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
> **Key patterns:** Action sequencer blocking (`registerBlockingAction`/`deRegisterBlockingAction`), `prepareAttachmentData` normalization, per-file progress tracking, `insertAttachments`/`deleteAttachments` helpers for Redux state.
|
|
40
|
+
**Module Setup:** The component requires local state, lifecycle effects, cached callbacks, memoized computations, and instance references. It depends on `validateMaxSize` from the project's attachment helpers, as well as `clearFieldErrorMessages`, `deleteAttachments`, `getIconFromFileType`, `insertAttachments`, a deep-memo utility, a file-download utility, and `validateFileExtension` from the component's own utility module. The component's inputs interface extends the project's base component interface (with `value` as `any`) plus `allowMultiple` (boolean or string), `extensions` (string), `editMode` (string), and `isTableFormatter` (boolean).
|
|
41
|
+
|
|
42
|
+
**Main Component Logic** — steps in order:
|
|
43
|
+
|
|
44
|
+
1. Receive `value`, `getPConnect`, `label`, `validatemessage`, `extensions`, `displayMode`, `helperText`, `editMode`, and `isTableFormatter` from inputs; also receive `required`, `disabled`, and `allowMultiple` as mutable locals. Coerce each of `required`, `disabled`, and `allowMultiple` to a real boolean (true when the value is literally `true` or the string `'true'`), since these may arrive as string booleans.
|
|
45
|
+
2. Call `getPConnect()` into `pConn`; store `actionSequencer = PCore.getActionsSequencer()` via a memoized computation (no dependencies); resolve `contextName = pConn.getContextName()`.
|
|
46
|
+
3. **Normalize attachment data** (old vs. new format): call `PCore.getAttachmentUtils().prepareAttachmentData(value)` to get `{ attachments, isOldAttachment }`.
|
|
47
|
+
4. **Set the reference list**: read `valueRef` from `(pConn.getStateProps() as any).value`, then call `pConn.setReferenceList('.' + valueRef)`.
|
|
48
|
+
5. Declare local state: `files` (array, initialized from `attachments`) and `toggleUploadBegin` (boolean, default `false`).
|
|
49
|
+
6. Define `deleteFile`: removes the file from local state, calls `deleteAttachments`, and deregisters it from the action sequencer.
|
|
50
|
+
7. Define `onFileAdded`: validates the file's extension and size, adds it to `files`, and sets `toggleUploadBegin`.
|
|
51
|
+
8. Define `uploadFiles`: registers a blocking action via the sequencer, uploads each file via `uploadAttachment`, and calls `insertAttachments` on success.
|
|
52
|
+
9. In a lifecycle effect keyed on `toggleUploadBegin`, trigger `uploadFiles` when it changes.
|
|
53
|
+
10. In another lifecycle effect, subscribe to the `ASSIGNMENT_SUBMISSION` event for state override (block submission while uploads are pending).
|
|
54
|
+
11. **Render**: a container element with the field `label`, an upload button (hidden native file input plus a styled button), validation/helper text, and the file list — each row showing an icon, name, metadata, upload progress, and a delete button.
|
|
55
|
+
|
|
56
|
+
> **Key patterns:** Action sequencer blocking (`registerBlockingAction`/`deRegisterBlockingAction`), `prepareAttachmentData` normalization, per-file progress tracking, `insertAttachments`/`deleteAttachments` helpers for state management.
|
|
93
57
|
|
|
94
58
|
## Behavioral Contract
|
|
95
59
|
|
|
@@ -97,25 +61,17 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
97
61
|
|
|
98
62
|
Pega has two attachment data formats — detect which one is in use:
|
|
99
63
|
|
|
100
|
-
**Old format (annotation-based):**
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
value = { pxResults: [...], pyAttachCount: N }
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**New standard format:**
|
|
64
|
+
**Old format (annotation-based):** `value` is an object shaped like `{ pxResults: [...], pyAttachCount: N }`.
|
|
107
65
|
|
|
108
|
-
|
|
109
|
-
value = [{ ID, name, mimeType, category, ... }] // array
|
|
110
|
-
```
|
|
66
|
+
**New standard format:** `value` is an array of attachment objects, each shaped like `{ ID, name, mimeType, category, ... }`.
|
|
111
67
|
|
|
112
68
|
Call `PCore.getAttachmentUtils().prepareAttachmentData(value)` to normalize both formats into a unified `FileObject[]` array.
|
|
113
69
|
|
|
114
70
|
### File Validation
|
|
115
71
|
|
|
116
|
-
On file selection (via
|
|
72
|
+
On file selection (via a file-picker control):
|
|
117
73
|
|
|
118
|
-
1. **Extension check:** Compare selected file's extension against `extensions`
|
|
74
|
+
1. **Extension check:** Compare selected file's extension against the `extensions` input (split by comma). If not allowed, add an error to the file and do not upload.
|
|
119
75
|
2. **Size check:** Compare file size against `PCore.getEnvironmentInfo().getMaxAttachmentSize()` (in bytes). If too large, add a size error.
|
|
120
76
|
3. Valid files proceed to upload.
|
|
121
77
|
|
|
@@ -123,7 +79,7 @@ On file selection (via `<input type='file'>`):
|
|
|
123
79
|
|
|
124
80
|
1. Call `PCore.getActionsSequencer().addAction('attachment_upload_' + fileId)` — blocks form submission.
|
|
125
81
|
2. Call `PCore.getAttachmentUtils().uploadAttachment(file, onProgress, onError, context)`.
|
|
126
|
-
3. On progress: update per-file `progress` value (0–100) in state.
|
|
82
|
+
3. On progress: update per-file `progress` value (0–100) in local state.
|
|
127
83
|
4. On success: add the returned attachment metadata to the local file list; update the Pega property via `pConn.setReferenceList(newAttachmentList)`.
|
|
128
84
|
5. Call `PCore.getActionsSequencer().removeAction('attachment_upload_' + fileId)` — unblocks form submission.
|
|
129
85
|
6. On error: set file error state; call `PCore.getMessageManager().addMessages([errorMessage])`.
|
|
@@ -170,7 +126,7 @@ Compressed display for use inside a table cell. Show attachment count and a smal
|
|
|
170
126
|
## Edge Cases & Special Logic
|
|
171
127
|
|
|
172
128
|
- `allowMultiple` may be a string `"true"` / `"false"` or a boolean — always coerce: `allowMultiple === true || allowMultiple === 'true'`.
|
|
173
|
-
- Upload progress: track per-file progress in a `
|
|
129
|
+
- Upload progress: track per-file progress in a map of `fileId → number` in local state.
|
|
174
130
|
- `isTableFormatter`: when `true`, hide the label and reduce padding for compact table display.
|
|
175
131
|
- Concurrent uploads: multiple files may upload simultaneously — the sequencer action must be keyed per-file.
|
|
176
132
|
- Max size: call `PCore.getEnvironmentInfo().getMaxAttachmentSize()` at validation time (not at mount) — size config may be dynamic.
|
|
@@ -178,30 +134,28 @@ Compressed display for use inside a table cell. Show attachment count and a smal
|
|
|
178
134
|
|
|
179
135
|
## Dependencies
|
|
180
136
|
|
|
181
|
-
-
|
|
182
|
-
-
|
|
137
|
+
- The project's attachment utility module — `validateExtension`, `validateSize`, `getFileTypeIcon`, `buildDownloadURL`, error handling helpers
|
|
138
|
+
- The project's attachment type definitions — `FileObject`, `AttachmentLinks`, `PageInstructionOptions`
|
|
183
139
|
- `PCore.getAttachmentUtils()` — upload, download, prepareAttachmentData
|
|
184
140
|
- `PCore.getActionsSequencer()` — block/unblock form submission during upload
|
|
185
141
|
- `PCore.getEnvironmentInfo()` — max attachment size
|
|
186
142
|
- `PCore.getMessageManager()` — error message display
|
|
187
143
|
- `PCore.getPubSubUtils()` — before-submit subscription
|
|
188
|
-
-
|
|
144
|
+
- A file-download utility — browser file download trigger
|
|
189
145
|
|
|
190
146
|
## Design System Mapping
|
|
191
147
|
|
|
192
148
|
**UI control type:** File upload form field with progress tracking, validation, and attachment list.
|
|
193
149
|
|
|
194
|
-
|
|
150
|
+
When implementing in a specific design system, map the following:
|
|
195
151
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
| Chakra UI | Custom `<Box>` with `useDropzone` | `<Progress>` | `<VStack>` rows |
|
|
202
|
-
| Shadcn/ui | Custom drop zone | Custom CSS progress bar | `<ul>/<li>` rows |
|
|
152
|
+
- **File input / drop zone:** A clickable upload area (optionally supporting drag-and-drop) backed by a hidden native file input. The design system's file-picker or upload component can replace the custom drop zone, but the hidden native input pattern works universally.
|
|
153
|
+
- **Progress indicator:** A linear progress bar (determinate, 0–100) shown per-file during upload. Use the design system's linear progress component or a CSS-based bar.
|
|
154
|
+
- **File list:** A vertical list of uploaded file rows. Each row contains: a file-type icon, the file name, file size metadata, the progress indicator (during upload), and a delete action button. Use the design system's list component or simple styled rows.
|
|
155
|
+
- **Error text:** Validation or upload error messages displayed below the control in an error color.
|
|
156
|
+
- **Helper text:** Secondary descriptive text below the control.
|
|
203
157
|
|
|
204
|
-
|
|
158
|
+
Implementation notes:
|
|
205
159
|
|
|
206
160
|
- Action sequencer blocking (`addAction`/`removeAction`) is mandatory — do not skip it; form submission must be blocked during uploads
|
|
207
161
|
- Detect and normalize both old and new attachment formats via `prepareAttachmentData`
|
|
@@ -2,119 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
Case history widget. Fetches and displays the full audit trail for the current case in a table with Date, Description, and Performer columns.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, the base component interface, data-fetching patterns, and registration conventions common to ALL widget components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Component Purpose
|
|
10
10
|
|
|
11
|
-
Renders a table of case events sourced from the `D_pyWorkHistory` data page. Shows when each event happened (`
|
|
11
|
+
Renders a table of case events sourced from the `D_pyWorkHistory` data page. Shows when each event happened (`pxTimeCreated`), what happened (`pyMessageKey`), and who performed it (`pyPerformer`). Uses a deep-equality utility to skip unnecessary re-renders when data has not changed.
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
|
-
- **Registration key:** `CaseHistory` (in
|
|
15
|
+
- **Registration key:** `CaseHistory` (in the project's component map)
|
|
16
16
|
- **Category:** Widget — case data display
|
|
17
|
-
- **Extends:**
|
|
17
|
+
- **Extends:** the project's base component interface
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Input | Type | Required | Description |
|
|
22
22
|
| ------------- | ---------- | -------- | ----------------------------------------------------- |
|
|
23
23
|
| `getPConnect` | `function` | Yes | PConnect getter — used to resolve case ID and context |
|
|
24
24
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const [waitingForData, setWaitingForData] = useState(true);
|
|
40
|
-
|
|
41
|
-
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, '');
|
|
42
|
-
const context = thePConn.getContextName();
|
|
43
|
-
|
|
44
|
-
const displayedColumns = [
|
|
45
|
-
{ label: thePConn.getLocalizedValue('Date', '', ''), type: 'DateTime', fieldName: 'pxTimeCreated' },
|
|
46
|
-
{ label: thePConn.getLocalizedValue('Description', '', ''), type: 'TextInput', fieldName: 'pyMessageKey' },
|
|
47
|
-
{ label: thePConn.getLocalizedValue('Performed by', '', ''), type: 'TextInput', fieldName: 'pyPerformer' },
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
// 1. Fetch D_pyWorkHistory on mount
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
let active = true;
|
|
53
|
-
PCore.getDataApiUtils().getData('D_pyWorkHistory',
|
|
54
|
-
{ dataViewParameters: [{ CaseInstanceKey: caseID }] }, context
|
|
55
|
-
).then((historyJSON: any) => {
|
|
56
|
-
if (active) {
|
|
57
|
-
computeRowData(historyJSON.data.data);
|
|
58
|
-
setWaitingForData(false);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return () => { active = false; };
|
|
62
|
-
}, []);
|
|
63
|
-
|
|
64
|
-
// 2. computeRowData — format dates, use isDeepEqual to prevent unnecessary updates
|
|
65
|
-
function computeRowData(rows) {
|
|
66
|
-
const theRowData = rows.map(row => displayedColumns.map(col =>
|
|
67
|
-
col.type === 'DateTime' ? Utils.generateDateTime(row[col.fieldName], 'DateTime-Short') : row[col.fieldName]
|
|
68
|
-
));
|
|
69
|
-
if (!isDeepEqual(theRowData, rowData.current)) rowData.current = theRowData;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// 3. Render: Table with 3 columns, '---' for missing values
|
|
73
|
-
return (
|
|
74
|
-
<TableContainer>
|
|
75
|
-
<Table>
|
|
76
|
-
<TableHead><TableRow>{displayedColumns.map(col => <TableCell key={col.fieldName}>{col.label}</TableCell>)}</TableRow></TableHead>
|
|
77
|
-
<TableBody>
|
|
78
|
-
{rowData.current.map((row, i) => (
|
|
79
|
-
<TableRow key={i}>{row.map((cell, j) => <TableCell key={j}>{cell || '---'}</TableCell>)}</TableRow>
|
|
80
|
-
))}
|
|
81
|
-
</TableBody>
|
|
82
|
-
</Table>
|
|
83
|
-
</TableContainer>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
No additional custom props. All data is fetched internally.
|
|
25
|
+
## Implementation Structure
|
|
26
|
+
|
|
27
|
+
**Module Setup:** Requires local state, an instance reference, and a lifecycle effect. Also needs a deep-equality utility and the project's SDK utility helpers for date formatting. The component interface extends the project's base component interface (no additional custom inputs).
|
|
28
|
+
|
|
29
|
+
**Main Component Logic** — steps in order:
|
|
30
|
+
|
|
31
|
+
1. Receive `getPConnect` from inputs; call it once into `thePConn`. Declare a `rowData` instance reference (initialized to an empty array) and a `waitingForData` local state boolean (default `true`).
|
|
32
|
+
2. Resolve `caseID` via `thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, '')` and `context` via `thePConn.getContextName()`.
|
|
33
|
+
3. Build a `displayedColumns` array of three column descriptors, each with a localized `label` (via `thePConn.getLocalizedValue`), a `type`, and a `fieldName`: Date (`'DateTime'`, `pxTimeCreated`), Description (`'TextInput'`, `pyMessageKey`), and Performed by (`'TextInput'`, `pyPerformer`).
|
|
34
|
+
4. **Fetch `D_pyWorkHistory` on mount** — in a lifecycle effect that runs once on initialization, using a guard flag to prevent post-teardown state updates: call `PCore.getDataApiUtils().getData('D_pyWorkHistory', { dataViewParameters: [{ CaseInstanceKey: caseID }] }, context)`; on resolution, when still active, call `computeRowData` with `historyJSON.data.data` and set `waitingForData` to `false`. In the teardown callback, set the guard flag to `false` so the state setter is never called after the component is destroyed.
|
|
35
|
+
5. Define `computeRowData(rows)`: map each row to an array of cell values, one per `displayedColumns` entry — formatting `DateTime`-type columns through the SDK utility helper `generateDateTime(row[col.fieldName], 'DateTime-Short')` and passing other column values through as-is. Compare the resulting `theRowData` against the current `rowData` instance reference using the deep-equality utility, and only update the instance reference when the data has actually changed (this avoids unnecessary re-renders).
|
|
36
|
+
6. **Render** a table with three columns and `'---'` as the placeholder for missing or falsy cell values. The header row renders one cell per `displayedColumns` entry (using its `label`). The body renders one row per entry in the `rowData` instance reference, with one cell per value (falling back to `'---'` when the value is falsy).
|
|
37
|
+
|
|
38
|
+
No additional custom inputs. All data is fetched internally.
|
|
89
39
|
|
|
90
40
|
## Behavioral Contract
|
|
91
41
|
|
|
92
42
|
### Data Fetch
|
|
93
43
|
|
|
94
|
-
On mount, fetch history from the `D_pyWorkHistory` data page:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
PCore.getDataApiUtils().getData(
|
|
98
|
-
'D_pyWorkHistory',
|
|
99
|
-
{ pyCaseInsKey: caseKey },
|
|
100
|
-
context
|
|
101
|
-
)
|
|
102
|
-
```
|
|
44
|
+
On mount, fetch history from the `D_pyWorkHistory` data page by calling `PCore.getDataApiUtils().getData('D_pyWorkHistory', { dataViewParameters: [{ CaseInstanceKey: caseID }] }, context)`.
|
|
103
45
|
|
|
104
|
-
- `
|
|
105
|
-
- `context` = `
|
|
106
|
-
- Store result in `
|
|
107
|
-
- On error or empty response, `
|
|
46
|
+
- `caseID` = `thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, '')`.
|
|
47
|
+
- `context` = `thePConn.getContextName()`.
|
|
48
|
+
- Store result in a `rowData` instance reference.
|
|
49
|
+
- On error or empty response, `rowData` stays as `[]`.
|
|
108
50
|
|
|
109
51
|
### Re-render Optimization
|
|
110
52
|
|
|
111
|
-
Use
|
|
53
|
+
Use a deep-equality utility to compare new row data with the previous value — only update the stored data if it has actually changed. This prevents unnecessary re-renders caused by reference inequality.
|
|
112
54
|
|
|
113
55
|
### Data Transformation
|
|
114
56
|
|
|
115
57
|
For each history row, map:
|
|
116
58
|
|
|
117
|
-
- **Date column:** Format `
|
|
59
|
+
- **Date column:** Format `pxTimeCreated` using the SDK date formatting utility (e.g., `generateDateTime(row.pxTimeCreated, 'DateTime-Short')`).
|
|
118
60
|
- **Description column:** `row.pyMessageKey` — the localized event description string.
|
|
119
61
|
- **Performer column:** `row.pyPerformer` — the operator who performed the action.
|
|
120
62
|
- Missing values: display `"---"` for any undefined/null field.
|
|
@@ -123,51 +65,26 @@ For each history row, map:
|
|
|
123
65
|
|
|
124
66
|
### Table Layout
|
|
125
67
|
|
|
126
|
-
| Column
|
|
127
|
-
|
|
|
128
|
-
| Date
|
|
129
|
-
| Description
|
|
130
|
-
|
|
|
131
|
-
|
|
132
|
-
**CSS-only implementation notes:**
|
|
68
|
+
| Column | Field | Width |
|
|
69
|
+
| ------------ | --------------------------- | ----- |
|
|
70
|
+
| Date | `pxTimeCreated` (formatted) | ~25% |
|
|
71
|
+
| Description | `pyMessageKey` | ~50% |
|
|
72
|
+
| Performed by | `pyPerformer` | ~25% |
|
|
133
73
|
|
|
134
|
-
|
|
135
|
-
- Table: `border-collapse: collapse; width: 100%`.
|
|
136
|
-
- Header cells: `background: var(--table-header-bg); font-weight: 600; padding: 8px 12px; border-bottom: 2px solid var(--divider-color)`.
|
|
137
|
-
- Body cells: `padding: 8px 12px; border-bottom: 1px solid var(--divider-color)`.
|
|
138
|
-
- Missing value placeholder `"---"`: `color: var(--secondary-text-color)`.
|
|
139
|
-
- No pagination in the reference implementation — all rows shown.
|
|
74
|
+
The table header cells should have a distinct background color, bold text, and 1px solid borders. Body cells should have 1px solid borders in a silver/neutral tone. Missing-value placeholders (`"---"`) should be visually subdued. Use the design system's table component for consistent styling. No pagination in the reference implementation — all rows are shown.
|
|
140
75
|
|
|
141
76
|
## Edge Cases & Special Logic
|
|
142
77
|
|
|
143
78
|
- `D_pyWorkHistory` may return an empty array for cases with no history events — render an empty table body (or an empty-state message like `"No history available"`).
|
|
144
|
-
- `
|
|
79
|
+
- `pxTimeCreated` format varies — always run it through the SDK date formatting utility before display.
|
|
145
80
|
- `pyMessageKey` may be a locale key — resolve it via `PCore.getLocaleUtils().getLocaleValue()` if a localized string is required.
|
|
146
81
|
- The widget has no pagination — for cases with very long history, the table may become very tall. Consider adding pagination if needed.
|
|
82
|
+
- The lifecycle effect teardown callback sets a guard flag to prevent calling state setters after component destruction, avoiding framework warnings about unmounted state updates.
|
|
147
83
|
|
|
148
84
|
## Dependencies
|
|
149
85
|
|
|
150
86
|
- `PCore.getDataApiUtils().getData()` — fetches `D_pyWorkHistory` data page
|
|
151
|
-
-
|
|
87
|
+
- A deep-equality utility — prevents unnecessary re-renders by comparing row data before updating
|
|
152
88
|
- `PCore.getConstants().CASE_INFO.CASE_INFO_ID` — resolves case ID constant
|
|
153
|
-
-
|
|
154
|
-
|
|
155
|
-
## Design System Mapping
|
|
156
|
-
|
|
157
|
-
**UI control type:** Read-only case audit table with 3 columns.
|
|
158
|
-
|
|
159
|
-
Listed design systems are examples only.
|
|
160
|
-
|
|
161
|
-
| Design System | Table |
|
|
162
|
-
| ------------------ | --------------------------------------------------------------------------------- |
|
|
163
|
-
| Default (CSS only) | `<table>/<thead>/<tbody>/<tr>/<td>` |
|
|
164
|
-
| MUI | `<TableContainer>` + `<Table>` + `<TableHead>/<TableBody>/<TableRow>/<TableCell>` |
|
|
165
|
-
| Ant Design | `<Table dataSource={historyData} columns={...}>` |
|
|
166
|
-
| Chakra UI | `<Table>` + `<Thead>/<Tbody>/<Tr>/<Th>/<Td>` |
|
|
167
|
-
| Shadcn/ui | `<Table>` + `<TableHeader>/<TableBody>/<TableRow>/<TableHead>/<TableCell>` |
|
|
168
|
-
|
|
169
|
-
When implementing in a specific design system:
|
|
170
|
-
|
|
171
|
-
- `fast-deep-equal` comparison is a performance optimization — include it to avoid redundant renders on re-subscription
|
|
172
|
-
- Data page name `D_pyWorkHistory` is fixed — do not make it configurable
|
|
173
|
-
- Missing field fallback `"---"` should be consistent across all three columns
|
|
89
|
+
- The project's SDK utility helpers — for date formatting (`generateDateTime`)
|
|
90
|
+
- The design system's table component (container, header, body, row, and cell elements)
|