@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
|
Location input with Google Maps Places autocomplete, interactive map display, and optional geolocation (current location).
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -14,121 +14,41 @@ Renders a text input that integrates with Google Maps Places API for address/loc
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Location`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Text-Location`
|
|
17
|
-
- **Registration key:** `Location` (in
|
|
17
|
+
- **Registration key:** `Location` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Input | Type | Default | Description |
|
|
22
22
|
| ----------------- | -------------------- | ------- | ------------------------------------------------------------------------ |
|
|
23
23
|
| `coordinates` | `string` (optional) | `''` | Comma-separated lat/lng string (e.g., `'18.5204, 73.8567'`) |
|
|
24
24
|
| `onlyCoordinates` | `boolean` (optional) | `false` | If `true`, store and display lat/lng coordinates instead of address text |
|
|
25
25
|
| `showMap` | `boolean` (optional) | — | Show the interactive map in editable mode |
|
|
26
26
|
| `showMapReadOnly` | `boolean` (optional) | — | Show the map in read-only mode |
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Implementation Structure
|
|
29
29
|
|
|
30
30
|
Follow this exact structure. This component is complex — integrates Google Maps API for places autocomplete, geolocation, and optional map display.
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export default function Location(props: LocationProps) {
|
|
54
|
-
// 1. Registry lookups
|
|
55
|
-
const TextInput = getComponentFromRegistry('TextInput');
|
|
56
|
-
const FieldValueList = getComponentFromRegistry('FieldValueList');
|
|
57
|
-
|
|
58
|
-
// 2. Destructure props
|
|
59
|
-
const {
|
|
60
|
-
getPConnect, label, required = false, disabled = false, value = '',
|
|
61
|
-
validatemessage, status, readOnly = false, testId, displayMode,
|
|
62
|
-
hideLabel = false, placeholder, helperText,
|
|
63
|
-
coordinates = '', onlyCoordinates = false, showMap, showMapReadOnly,
|
|
64
|
-
} = props;
|
|
65
|
-
|
|
66
|
-
// 3. PConnect setup — note TWO property names
|
|
67
|
-
const pConn = getPConnect();
|
|
68
|
-
const actions = pConn.getActionsApi();
|
|
69
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
70
|
-
const coordPropName = (pConn.getStateProps() as any).coordinates;
|
|
71
|
-
|
|
72
|
-
// 4. State
|
|
73
|
-
const [inputValue, setInputValue] = useState<string>(value ?? '');
|
|
74
|
-
const [mapCenter, setMapCenter] = useState(defaultCenter);
|
|
75
|
-
const [markerPosition, setMarkerPosition] = useState<{lat:number,lng:number} | null>(null);
|
|
76
|
-
|
|
77
|
-
// 5. Refs
|
|
78
|
-
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
79
|
-
const autocompleteRef = useRef<google.maps.places.Autocomplete | null>(null);
|
|
80
|
-
|
|
81
|
-
// 6. Load Google Maps API
|
|
82
|
-
const { isLoaded } = useLoadScript({
|
|
83
|
-
googleMapsApiKey: pConn.getGoogleMapsAPIKey?.() || '',
|
|
84
|
-
libraries: ['places', 'geocoding'],
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// 7. Error flag
|
|
88
|
-
const hasError = status === 'error' && !!validatemessage && !disabled;
|
|
89
|
-
|
|
90
|
-
// 8. useEffect: sync value + coordinates — deps: [value, coordinates, onlyCoordinates]
|
|
91
|
-
// → see Behavioral Contract #3
|
|
92
|
-
|
|
93
|
-
// 9. handleChange (manual text input) — useCallback
|
|
94
|
-
// Commits immediately, clears coordinates if input emptied
|
|
95
|
-
|
|
96
|
-
// 10. handlePlaceChanged — useCallback
|
|
97
|
-
// Reads place from autocompleteRef, extracts lat/lng,
|
|
98
|
-
// stores address or coordinates based on onlyCoordinates flag
|
|
99
|
-
|
|
100
|
-
// 11. useEffect: init Places Autocomplete — deps: [isLoaded, handlePlaceChanged]
|
|
101
|
-
// Guard: isLoaded && inputRef.current && !autocompleteRef.current
|
|
102
|
-
|
|
103
|
-
// 12. handleGetCurrentLocation — useCallback
|
|
104
|
-
// Uses navigator.geolocation.getCurrentPosition
|
|
105
|
-
// If onlyCoordinates: store coords directly
|
|
106
|
-
// Else: reverse geocode via google.maps.Geocoder
|
|
107
|
-
|
|
108
|
-
// 13. Display mode returns
|
|
109
|
-
if (displayMode === 'DISPLAY_ONLY') {
|
|
110
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
111
|
-
}
|
|
112
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
113
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// 14. Map element (shared between readOnly and editable)
|
|
117
|
-
// opacity: disabled ? 0.7 : 1, options: disabled ? disabledMapOptions : undefined
|
|
118
|
-
|
|
119
|
-
// 15. Read-only return
|
|
120
|
-
if (readOnly) {
|
|
121
|
-
return <div><TextInput {...props} />{isLoaded && showMapReadOnly && map}</div>;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// 16. Main render
|
|
125
|
-
// - Error alert ABOVE input if hasError
|
|
126
|
-
// - Guard: only render TextField when isLoaded
|
|
127
|
-
// - TextField with inputRef, endAdornment location icon button
|
|
128
|
-
// - Map below if isLoaded && showMap
|
|
129
|
-
return <div>...</div>;
|
|
130
|
-
}
|
|
131
|
-
```
|
|
32
|
+
**Module Setup:** The component depends on the project's component registry (to resolve `TextInput` and `FieldValueList`), the project's event-commit utility (for committing value changes to the store), and a Google Maps script loader capable of loading the `places` and `geocoding` libraries dynamically. A companion stylesheet is needed to fix the autocomplete dropdown z-index (see CSS section). Define the input contract as the project's field input contract extended with `coordinates?`, `onlyCoordinates?`, `showMap?`, and `showMapReadOnly?`. Define module-level constants: `mapContainerStyle` (`width: '100%'`, `height: '300px'`, `marginTop: '0px'`), `defaultCenter` (`{ lat: 18.5204, lng: 73.8567 }` — Pune, India), and `disabledMapOptions` (`gestureHandling: 'none'`, `keyboardShortcuts: false`, `disableDefaultUI: true`, `clickableIcons: false`).
|
|
33
|
+
|
|
34
|
+
**Main Component Logic** — steps in order:
|
|
35
|
+
|
|
36
|
+
1. **Registry lookups** — resolve `TextInput` and `FieldValueList` via the project's component registry.
|
|
37
|
+
2. **Receive inputs** — `getPConnect`, `label`, `required` (default `false`), `disabled` (default `false`), `value` (default `''`), `validatemessage`, `status`, `readOnly` (default `false`), `testId`, `displayMode`, `hideLabel` (default `false`), `placeholder`, `helperText`, `coordinates` (default `''`), `onlyCoordinates` (default `false`), `showMap`, `showMapReadOnly`.
|
|
38
|
+
3. **PConnect setup** (note TWO property names) — `pConn`, `actions`, `propName` for the address/value, and a separate `coordPropName` for the coordinates property.
|
|
39
|
+
4. **Local state** — `inputValue` (initialized from `value`), `mapCenter` (initialized to `defaultCenter`), and `markerPosition` (initialized to `null`).
|
|
40
|
+
5. **Instance references** — `inputRef` for the text input element, `autocompleteRef` for the Google Places Autocomplete instance.
|
|
41
|
+
6. **Load Google Maps API** — use a script-loading mechanism with the API key from `pConn.getGoogleMapsAPIKey?.() || ''` and the `places` and `geocoding` libraries. Track the loaded status via an `isLoaded` flag.
|
|
42
|
+
7. **Error flag** — `hasError = status === 'error' && !!validatemessage && !disabled`.
|
|
43
|
+
8. **Sync lifecycle effect** — watching `value`, `coordinates`, `onlyCoordinates`; see Behavioral Contract item 3.
|
|
44
|
+
9. **`handleChange`** (manual text input, cached callback) — commits immediately, clears coordinates if the input is emptied.
|
|
45
|
+
10. **`handlePlaceChanged`** (cached callback) — reads the selected place from the autocomplete instance reference, extracts `lat`/`lng`, and stores either the address or the coordinates depending on the `onlyCoordinates` flag.
|
|
46
|
+
11. **Init Places Autocomplete** — a lifecycle effect watching `isLoaded` and the place-changed handler, guarded to run only once `isLoaded && inputRef is set && autocompleteRef is not yet set`.
|
|
47
|
+
12. **`handleGetCurrentLocation`** (cached callback) — uses `navigator.geolocation.getCurrentPosition`; when `onlyCoordinates` is set, stores the coordinates directly, otherwise reverse-geocodes via `google.maps.Geocoder`.
|
|
48
|
+
13. **Display mode returns** — `DISPLAY_ONLY` and `STACKED_LARGE_VAL` (the latter with a stacked variant) both return `FieldValueList` with the raw `value`.
|
|
49
|
+
14. **Map element** (shared between read-only and editable rendering) — opacity reduced to `0.7` when `disabled`, and `disabledMapOptions` applied when `disabled`.
|
|
50
|
+
15. **Read-only return** — render a wrapper containing `TextInput` with all inputs spread, plus the map (once loaded) when `showMapReadOnly` is set.
|
|
51
|
+
16. **Main render** — render an error alert above the input when `hasError`; only render the text field once `isLoaded`; the text field carries the input reference and a trailing location-icon button that triggers `handleGetCurrentLocation`; render the map below when `isLoaded && showMap`.
|
|
132
52
|
|
|
133
53
|
## Behavioral Contract
|
|
134
54
|
|
|
@@ -139,19 +59,19 @@ export default function Location(props: LocationProps) {
|
|
|
139
59
|
- `inputValue` (string): shown in the text input
|
|
140
60
|
- `mapCenter` (`{lat, lng}`): default `{ lat: 18.5204, lng: 73.8567 }` (Pune, India)
|
|
141
61
|
- `markerPosition` (`{lat, lng} | null`)
|
|
142
|
-
3. **Value sync:**
|
|
143
|
-
- If `onlyCoordinates && coordinates`: `
|
|
144
|
-
- Else: `
|
|
62
|
+
3. **Value sync:** A lifecycle effect watching `value`, `coordinates`, `onlyCoordinates`:
|
|
63
|
+
- If `onlyCoordinates && coordinates`: set `inputValue` to `coordinates`
|
|
64
|
+
- Else: set `inputValue` to `value ?? ''`
|
|
145
65
|
- If `coordinates` exists: parse `lat, lng`, update `mapCenter` and `markerPosition`
|
|
146
|
-
4. **Places Autocomplete (init):**
|
|
66
|
+
4. **Places Autocomplete (init):** A lifecycle effect watching `isLoaded` — once Maps API loads and the input element reference is set, attach `new google.maps.places.Autocomplete(inputElement)` and add `place_changed` listener.
|
|
147
67
|
5. **On place changed:**
|
|
148
68
|
- Get `place.geometry.location` → extract `lat`, `lng`
|
|
149
|
-
- If `onlyCoordinates`: `inputValue
|
|
150
|
-
- Else: `inputValue
|
|
69
|
+
- If `onlyCoordinates`: set `inputValue` to `"lat, lng"` format, commit this as the value AND update the coordinates property
|
|
70
|
+
- Else: set `inputValue` to `place.formatted_address`, commit address as value, update coordinates property separately via `actions.updateFieldValue(coordPropName, coordinateString)`
|
|
151
71
|
- Update `mapCenter` and `markerPosition`
|
|
152
72
|
6. **On text change (manual):**
|
|
153
|
-
- Update `inputValue` and commit immediately via
|
|
154
|
-
- If input cleared and `coordPropName` exists: `actions.updateFieldValue(coordPropName, '')
|
|
73
|
+
- Update `inputValue` and commit immediately via the project's event-commit utility with event type `'changeNblur'`, the property name, and the new value
|
|
74
|
+
- If input cleared and `coordPropName` exists: `actions.updateFieldValue(coordPropName, '')` and clear the marker position
|
|
155
75
|
7. **Get current location button:**
|
|
156
76
|
- Use `navigator.geolocation.getCurrentPosition()`
|
|
157
77
|
- If `onlyCoordinates`: store `"lat, lng"` as value and coordinates
|
|
@@ -169,82 +89,54 @@ When `disabled`, map options disable all interactions:
|
|
|
169
89
|
|
|
170
90
|
### CSS for Google Maps autocomplete dropdown z-index:
|
|
171
91
|
|
|
172
|
-
|
|
173
|
-
/* Location.css */
|
|
174
|
-
.pac-container {
|
|
175
|
-
z-index: 2147483647;
|
|
176
|
-
}
|
|
177
|
-
```
|
|
92
|
+
A companion stylesheet sets the `.pac-container` (the autocomplete dropdown) to the maximum z-index value, ensuring it appears above modal/dialog overlays.
|
|
178
93
|
|
|
179
94
|
## Display Mode Rendering
|
|
180
95
|
|
|
181
|
-
- **`DISPLAY_ONLY`:**
|
|
182
|
-
- **`STACKED_LARGE_VAL`:**
|
|
96
|
+
- **`DISPLAY_ONLY`:** Render `FieldValueList` with `name` set to the label (empty string if `hideLabel`) and `value` set to the raw address/coordinates string.
|
|
97
|
+
- **`STACKED_LARGE_VAL`:** Render `FieldValueList` with the same name/value and a stacked variant.
|
|
183
98
|
|
|
184
99
|
## Read-Only Rendering
|
|
185
100
|
|
|
186
|
-
|
|
187
|
-
<div>
|
|
188
|
-
<TextInput {...props} />
|
|
189
|
-
{isLoaded && showMapReadOnly && <GoogleMap ... />}
|
|
190
|
-
</div>
|
|
191
|
-
```
|
|
101
|
+
A wrapper containing `TextInput` with all inputs spread, followed by the interactive map (once loaded) when `showMapReadOnly` is set.
|
|
192
102
|
|
|
193
103
|
## Visual Specifications
|
|
194
104
|
|
|
195
|
-
| Property | Value
|
|
196
|
-
| -------------------- |
|
|
197
|
-
| Width | 100%
|
|
198
|
-
| Input variant | Default
|
|
199
|
-
| Trailing icon | Location pin icon button (for current location)
|
|
200
|
-
| Error alert | Alert banner ABOVE the input field when `hasError`
|
|
201
|
-
| Map container | `width: 100%`, `height: 300px`, `marginTop: 0px`
|
|
202
|
-
| Map render | Only shown when `isLoaded && (showMap
|
|
203
|
-
| Disabled map opacity | `0.7`
|
|
105
|
+
| Property | Value |
|
|
106
|
+
| -------------------- | ------------------------------------------------------------ |
|
|
107
|
+
| Width | 100% |
|
|
108
|
+
| Input variant | Default outlined text field |
|
|
109
|
+
| Trailing icon | Location pin icon button (for current location) |
|
|
110
|
+
| Error alert | Alert banner ABOVE the input field when `hasError` |
|
|
111
|
+
| Map container | `width: 100%`, `height: 300px`, `marginTop: 0px` |
|
|
112
|
+
| Map render | Only shown when `isLoaded && (showMap \|\| showMapReadOnly)` |
|
|
113
|
+
| Disabled map opacity | `0.7` |
|
|
204
114
|
|
|
205
|
-
**CSS companion file required:** `
|
|
115
|
+
**CSS companion file required:** A stylesheet that sets `.pac-container` to the maximum z-index value, ensuring the Google Maps autocomplete dropdown appears above modal/dialog overlays.
|
|
206
116
|
|
|
207
|
-
|
|
208
|
-
.pac-container {
|
|
209
|
-
z-index: 2147483647;
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
This ensures the Google Maps autocomplete dropdown appears above modal/dialog overlays.
|
|
214
|
-
|
|
215
|
-
**CSS-only implementation notes:**
|
|
216
|
-
|
|
217
|
-
- Location pin button: `<button>` with `position: absolute; right: 8px; top: 50%; transform: translateY(-50%);`
|
|
117
|
+
**Visual-only styling notes:** The location pin button is positioned at the trailing edge of the input, vertically centered.
|
|
218
118
|
|
|
219
119
|
## Edge Cases & Special Logic
|
|
220
120
|
|
|
221
|
-
- **`isLoaded` guard:** Only render the
|
|
121
|
+
- **`isLoaded` guard:** Only render the text field and map after Google Maps API is fully loaded.
|
|
222
122
|
- **`onlyCoordinates` mode:** The stored `value` is `"lat, lng"` format; coordinates and address are the same.
|
|
223
123
|
- **Dual property:** The component writes to TWO properties — `propName` (address or coordinates) and `coordPropName` (coordinates). `coordPropName` may be undefined if the Pega config doesn't include a coordinates property.
|
|
224
|
-
- **Autocomplete
|
|
124
|
+
- **Autocomplete instance reference lifecycle:** The autocomplete instance is only initialized once (when the reference is not yet set). The `handlePlaceChanged` callback must be stable (cached with appropriate dependencies).
|
|
225
125
|
- **Map default center:** Pune, India — `{ lat: 18.5204, lng: 73.8567 }`.
|
|
226
126
|
- Google Maps Geocoder is only called in non-`onlyCoordinates` geolocation mode for reverse geocoding.
|
|
227
127
|
|
|
228
128
|
## Dependencies
|
|
229
129
|
|
|
230
|
-
- Google Maps JavaScript API (loaded dynamically via
|
|
231
|
-
-
|
|
232
|
-
-
|
|
233
|
-
- `
|
|
234
|
-
-
|
|
235
|
-
- A location pin icon.
|
|
130
|
+
- Google Maps JavaScript API (loaded dynamically via a script loader).
|
|
131
|
+
- A Google Maps rendering library providing map display, marker, and script-loading capabilities.
|
|
132
|
+
- The project's event-commit utility for committing field value changes.
|
|
133
|
+
- The project's component registry to resolve `TextInput` (for read-only) and `FieldValueList` (for display modes).
|
|
134
|
+
- A location pin icon from the project's icon set.
|
|
236
135
|
|
|
237
|
-
**CSS companion:**
|
|
136
|
+
**CSS companion:** A stylesheet that fixes the autocomplete dropdown z-index (`.pac-container`).
|
|
238
137
|
|
|
239
138
|
## Design System Mapping
|
|
240
139
|
|
|
241
140
|
**UI control type:** Text input with location autocomplete dropdown + optional map.
|
|
242
141
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
| Design System | Recommended Component |
|
|
246
|
-
| ------------------ | ----------------------------------------------------------------------- |
|
|
247
|
-
| Default (CSS only) | `<input type="text">` + Google Maps Autocomplete API + Google Map embed |
|
|
248
|
-
| MUI | `<TextField>` + `InputAdornment` for icon + `@react-google-maps/api` |
|
|
249
|
-
| Ant Design | `<Input suffix={<LocationIcon />}>` + Google Maps |
|
|
250
|
-
| Chakra UI | `<InputGroup>` + `<InputRightElement>` + Google Maps |
|
|
142
|
+
When implementing in a specific design system, map the following: a full-width outlined text field with trailing icon adornment (for the current-location button), an alert/banner component for error display above the input, and a Google Maps embed component for the interactive map. The trailing icon should be a location/pin icon wrapped in a clickable button. The autocomplete functionality comes from the Google Maps Places API directly attached to the input element, not from the design system.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Multi-select autocomplete field supporting flat lists, grouped/hierarchical data, reference list binding, and debounced search.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -14,11 +14,11 @@ Renders a multi-value typeahead input where users can search and select multiple
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `Multiselect`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Picklist-Multi`
|
|
17
|
-
- **Registration key:** `Multiselect` (in
|
|
17
|
+
- **Registration key:** `Multiselect` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
> **Note:** `Multiselect` does NOT extend
|
|
19
|
+
> **Note:** `Multiselect` does NOT extend the project's field input contract — it defines its own inputs directly.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Inputs (component-specific)
|
|
22
22
|
|
|
23
23
|
| Prop | Type | Default | Description |
|
|
24
24
|
| --------------------------- | ---------- | ------------ | ----------------------------------------------------------- |
|
|
@@ -44,75 +44,28 @@ Renders a multi-value typeahead input where users can search and select multiple
|
|
|
44
44
|
| `maxResultsDisplay` | `string` | — | Max results to display (`'100'` default) |
|
|
45
45
|
| `value` | `any` | — | Current value |
|
|
46
46
|
|
|
47
|
-
##
|
|
48
|
-
|
|
49
|
-
This is a complex component. Note: it does NOT extend
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let { datasource = [], columns = [{}] } = props;
|
|
70
|
-
|
|
71
|
-
// 2. Reference list mode override (if referenceList.length > 0)
|
|
72
|
-
// → reassign datasource and columns
|
|
73
|
-
// → see Behavioral Contract "Reference List Mode"
|
|
74
|
-
|
|
75
|
-
// 3. State
|
|
76
|
-
const [inputValue, setInputValue] = useState(value);
|
|
77
|
-
const [selectedItems, setSelectedItems] = useState([]);
|
|
78
|
-
|
|
79
|
-
// 4. dataConfig (memoized with deep comparison via useDeepMemo)
|
|
80
|
-
// → see Behavioral Contract "Data Config"
|
|
81
|
-
|
|
82
|
-
// 5. Display field metadata + items tree
|
|
83
|
-
// → displayFieldMeta, groupsDisplayFieldMeta, itemsTreeBaseData, itemsTree state
|
|
84
|
-
|
|
85
|
-
// 6. Refs
|
|
86
|
-
const getCaseListBasedOnParamsDebounced: any = useRef();
|
|
87
|
-
const dataApiObj: any = useRef();
|
|
88
|
-
const pConn = getPConnect();
|
|
89
|
-
const contextName = pConn.getContextName();
|
|
90
|
-
const listActions = pConn.getListActions();
|
|
91
|
-
|
|
92
|
-
// 7. getCaseListBasedOnParams — main search function
|
|
93
|
-
// → see Behavioral Contract "Search"
|
|
94
|
-
|
|
95
|
-
// 8. useEffect: setReferenceList — deps: [pConn]
|
|
96
|
-
// 9. useEffect: init debounced ref — deps: []
|
|
97
|
-
// 10. useEffect: init data API — deps: [dataConfig, ...]
|
|
98
|
-
// → PCore.getDataApi().init(dataConfig, contextName)
|
|
99
|
-
|
|
100
|
-
// 11. onSearchHandler — updates inputValue, triggers debounced search
|
|
101
|
-
// 12. setSelectedItemsForReferenceList — insert/delete instruction
|
|
102
|
-
// 13. handleChange — selection add/remove logic
|
|
103
|
-
// → see Behavioral Contract "Selection Changes"
|
|
104
|
-
|
|
105
|
-
// 14. Main render — multi-select autocomplete
|
|
106
|
-
// Key props:
|
|
107
|
-
// - multiple, fullWidth, disableCloseOnSelect
|
|
108
|
-
// - options: itemsTree, value: selectedItems
|
|
109
|
-
// - getOptionLabel: (option) => option?.primary
|
|
110
|
-
// - onChange: handleChange
|
|
111
|
-
// - renderInput: TextField with label, placeholder, size='small',
|
|
112
|
-
// variant='outlined', onChange=onSearchHandler
|
|
113
|
-
return <MultiSelectAutocomplete ... />;
|
|
114
|
-
}
|
|
115
|
-
```
|
|
47
|
+
## Implementation Structure
|
|
48
|
+
|
|
49
|
+
This is a complex component. Note: it does NOT extend the project's field input contract — it defines its own inputs directly.
|
|
50
|
+
|
|
51
|
+
**Module Setup:** The component depends on local utility helpers (`doSearch`, `getDisplayFieldsMetaData`, a deep-memoization hook, `preProcessColumns`, `getGroupDataForItemsTree`), the project's instruction helpers (`insertInstruction` and `deleteInstruction`), and a debounce utility. It does not use the standard field input contract or the project's event-commit utility — selection commits happen via the instruction helpers.
|
|
52
|
+
|
|
53
|
+
**Main Component Logic** — steps in order:
|
|
54
|
+
|
|
55
|
+
1. **Receive inputs** (declare `datasource`/`columns` as reassignable since they may be overridden) — `getPConnect`, `label`, `placeholder`, `referenceList`, `selectionKey`, `primaryField`, `initialCaseClass`, `showSecondaryInSearchOnly` (default `false`), `listType` (default `''`), `isGroupData` (default `false`), `referenceType`, `secondaryFields`, `groupDataSource` (default `[]`), `parameters` (default `{}`), `matchPosition` (default `'contains'`), `maxResultsDisplay`, `groupColumnsConfig` (default `[{}]`), `selectionList`, `value`; separately destructure `datasource` (default `[]`) and `columns` (default `[{}]`) with `let`.
|
|
56
|
+
2. **Reference list mode override** — when `referenceList.length > 0`, reassign `datasource` and `columns`; see the Behavioral Contract "Reference List Mode" section.
|
|
57
|
+
3. **Local state** — `inputValue` initialized from `value`, and `selectedItems` initialized to `[]`.
|
|
58
|
+
4. **`dataConfig`** (memoized with deep comparison via a deep-memoization utility) — see the Behavioral Contract "Data Config" section.
|
|
59
|
+
5. **Display field metadata and items tree** — `displayFieldMeta`, `groupsDisplayFieldMeta`, `itemsTreeBaseData`, and an `itemsTree` state value; see the Behavioral Contract "Items Tree" section.
|
|
60
|
+
6. **Instance references** — `getCaseListBasedOnParamsDebounced` and `dataApiObj` as instance references; also `pConn` via `getPConnect()`, `contextName` via `pConn.getContextName()`, and `listActions` via `pConn.getListActions()`.
|
|
61
|
+
7. **`getCaseListBasedOnParams`** — the main search function; see the Behavioral Contract "Search" section.
|
|
62
|
+
8. **Lifecycle effect: set reference list** — watching the PConnect instance.
|
|
63
|
+
9. **Lifecycle effect: init debounced reference** — on mount.
|
|
64
|
+
10. **Lifecycle effect: init data API** — watching `dataConfig` and related dependencies; calls `PCore.getDataApi().init(dataConfig, contextName)`.
|
|
65
|
+
11. **`onSearchHandler`** — updates `inputValue` and triggers the debounced search.
|
|
66
|
+
12. **`setSelectedItemsForReferenceList`** — inserts or deletes an instruction depending on selection state.
|
|
67
|
+
13. **`handleChange`** — selection add/remove logic; see the Behavioral Contract "Selection Changes" section.
|
|
68
|
+
14. **Main render** — a multi-select autocomplete widget with: `multiple`, `fullWidth`, `disableCloseOnSelect` set; `options={itemsTree}`, `value={selectedItems}`; `getOptionLabel` returning `option?.primary`; `onChange={handleChange}`; and a `renderInput` producing a text field with `label`, `placeholder`, `size='small'`, `variant='outlined'`, and `onChange={onSearchHandler}`.
|
|
116
69
|
|
|
117
70
|
## Behavioral Contract
|
|
118
71
|
|
|
@@ -140,16 +93,7 @@ Build a `dataConfig` object (memoized with deep comparison) containing:
|
|
|
140
93
|
|
|
141
94
|
### Data API Initialization
|
|
142
95
|
|
|
143
|
-
In
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
PCore.getDataApi().init(dataConfig, contextName).then(dataObj => {
|
|
147
|
-
dataApiObj.current = dataObj
|
|
148
|
-
if (!isGroupData) {
|
|
149
|
-
getCaseListBasedOnParamsDebounced.current(inputValue ?? '', '', [...selectedItems], [...itemsTree])
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
```
|
|
96
|
+
In a lifecycle effect watching `dataConfig` (non-associated lists), call `PCore.getDataApi().init(dataConfig, contextName)`. When the promise resolves with a data object: store it in the `dataApiObj` instance reference, and when `isGroupData` is false, invoke the debounced search function with the current `inputValue` (or `''`), an empty group, a copy of `selectedItems`, and a copy of `itemsTree`.
|
|
153
97
|
|
|
154
98
|
### Search
|
|
155
99
|
|
|
@@ -164,8 +108,8 @@ PCore.getDataApi().init(dataConfig, contextName).then(dataObj => {
|
|
|
164
108
|
|
|
165
109
|
### Mount Effects
|
|
166
110
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
111
|
+
- A lifecycle effect watching the PConnect instance: if `referenceList.length > 0`, call `pConn.setReferenceList(selectionList)`.
|
|
112
|
+
- A mount lifecycle effect: set up the debounced search reference.
|
|
169
113
|
|
|
170
114
|
### Selection Changes (`handleChange`)
|
|
171
115
|
|
|
@@ -202,35 +146,11 @@ No explicit `displayMode` handling in the reference implementation — Multisele
|
|
|
202
146
|
| Placeholder | From `placeholder` prop |
|
|
203
147
|
| Error state | Red border + red helper text |
|
|
204
148
|
|
|
205
|
-
**
|
|
206
|
-
|
|
207
|
-
```css
|
|
208
|
-
.multiselect-tags {
|
|
209
|
-
display: flex;
|
|
210
|
-
flex-wrap: wrap;
|
|
211
|
-
gap: 4px;
|
|
212
|
-
padding: 4px;
|
|
213
|
-
border: 1px solid rgba(0, 0, 0, 0.23);
|
|
214
|
-
border-radius: 4px;
|
|
215
|
-
}
|
|
216
|
-
.multiselect-tag {
|
|
217
|
-
background: rgba(0, 0, 0, 0.08);
|
|
218
|
-
border-radius: 16px;
|
|
219
|
-
padding: 2px 8px;
|
|
220
|
-
font-size: 0.8125rem;
|
|
221
|
-
display: flex;
|
|
222
|
-
align-items: center;
|
|
223
|
-
gap: 4px;
|
|
224
|
-
}
|
|
225
|
-
.multiselect-tag-delete {
|
|
226
|
-
cursor: pointer;
|
|
227
|
-
font-size: 0.75rem;
|
|
228
|
-
}
|
|
229
|
-
```
|
|
149
|
+
**Visual-only styling notes:** Selected values render as wrapping flex tags inside a bordered, rounded input container with a small gap and padding. Each tag has a light grey pill background, rounded corners, small padding, and a small font size, laid out as a flex row with a delete affordance at a slightly smaller font size and a pointer cursor.
|
|
230
150
|
|
|
231
151
|
## Edge Cases & Special Logic
|
|
232
152
|
|
|
233
|
-
- **`dataConfig` deep memoization:** Use
|
|
153
|
+
- **`dataConfig` deep memoization:** Use a deep-equality memoization utility to avoid re-initializing data API on every render.
|
|
234
154
|
- `itemsTreeBaseData` is fixed at render time — used as the base for each fresh search.
|
|
235
155
|
- When `isGroupData=false`: debounced search fires after data API init.
|
|
236
156
|
- When `isGroupData=true`: groups are pre-populated from `groupDataSource`.
|
|
@@ -238,21 +158,20 @@ No explicit `displayMode` handling in the reference implementation — Multisele
|
|
|
238
158
|
|
|
239
159
|
## Dependencies
|
|
240
160
|
|
|
241
|
-
- `doSearch`, `getDisplayFieldsMetaData`,
|
|
242
|
-
- `insertInstruction`, `deleteInstruction`
|
|
243
|
-
-
|
|
161
|
+
- Local utility helpers: `doSearch`, `getDisplayFieldsMetaData`, a deep-memoization utility, `preProcessColumns`, `getGroupDataForItemsTree`.
|
|
162
|
+
- The project's instruction helpers (`insertInstruction`, `deleteInstruction`).
|
|
163
|
+
- A debounce utility.
|
|
244
164
|
- `PCore.getDataApi()` — for data initialization.
|
|
245
|
-
-
|
|
165
|
+
- A multi-select autocomplete UI widget from the design system.
|
|
246
166
|
|
|
247
167
|
## Design System Mapping
|
|
248
168
|
|
|
249
169
|
**UI control type:** Multi-select combobox with tags/chips and searchable dropdown.
|
|
250
170
|
|
|
251
|
-
|
|
171
|
+
When implementing in a specific design system, map the following:
|
|
252
172
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
| Chakra UI | Third-party multi-select (e.g., Chakra React Select) |
|
|
173
|
+
- **Multi-select autocomplete** → use the DS's multi-select combobox with tag/chip display and searchable dropdown
|
|
174
|
+
- **Disable close on select** → the dropdown should stay open after each selection
|
|
175
|
+
- **Option label** → display `option.primary`
|
|
176
|
+
- **Selected items** → render as tags/chips inside the input area
|
|
177
|
+
- **Search input** → wired to the debounced search function
|