@pega/sdk 0.0.2 → 0.0.3
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/dist/index.js +2 -2
- package/package.json +1 -1
- package/templates/react-sdk-reference/.claude/instructions/component-map.md +38 -0
- package/templates/react-sdk-reference/.claude/instructions/dse-component.md +75 -0
- package/templates/react-sdk-reference/.claude/instructions/field-component.md +71 -0
- package/templates/react-sdk-reference/.claude/instructions/template-component.md +92 -0
- package/templates/react-sdk-reference/.claude/instructions/widget-component.md +87 -0
- package/templates/react-sdk-reference/.claude/prompts/add-component.md +144 -0
- package/templates/react-sdk-reference/.claude/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-all-components.md +149 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-dse-components.md +126 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-field-components.md +139 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-template-components.md +151 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-widget-components.md +124 -0
- package/templates/react-sdk-reference/.claude/prompts/identify-components.md +105 -0
- package/templates/react-sdk-reference/.claude/prompts/replace-design-system.md +519 -0
- package/templates/react-sdk-reference/.claude/skills/component-contracts.md +140 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/AlertBanner.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Banner.md +149 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/CaseSummaryFields.md +154 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/DetailsFields.md +144 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroup.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroupList.md +111 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldValueList.md +115 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Operator.md +149 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Pulse.md +83 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/RichTextEditor.md +206 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/WssQuickCreate.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension.md +289 -0
- package/templates/react-sdk-reference/.claude/skills/field-components.md +294 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/AutoComplete.md +112 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/CancelAlert.md +203 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Checkbox.md +158 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Currency.md +106 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Date.md +99 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/DateTime.md +103 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Decimal.md +98 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Dropdown.md +114 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Email.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Group.md +90 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Integer.md +87 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Location.md +136 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Multiselect.md +164 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/ObjectReference.md +164 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Percentage.md +92 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Phone.md +110 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/RadioButtons.md +146 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/RichText.md +138 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/ScalarList.md +124 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/SelectableCard.md +216 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/SemanticLink.md +148 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextArea.md +96 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextContent.md +101 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextInput.md +104 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Time.md +88 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/URL.md +85 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/UserReference.md +180 -0
- package/templates/react-sdk-reference/.claude/skills/run-and-verify.md +68 -0
- package/templates/react-sdk-reference/.claude/skills/template-components.md +322 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/AdvancedSearch.md +144 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/AppShell.md +122 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/BannerPage.md +83 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseSummary.md +100 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseView.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseViewActionsMenu.md +126 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/Confirmation.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DataReference.md +120 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultForm.md +102 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultPage.md +110 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/Details.md +88 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsSubTabs.md +95 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsThreeColumn.md +78 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsTwoColumn.md +78 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DynamicTabs.md +101 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/FieldGroupTemplate.md +109 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/HierarchicalForm.md +113 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboard.md +104 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboardPage.md +85 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/ListPage.md +68 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/ListView.md +139 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/MultiReferenceReadOnly.md +80 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/NarrowWide.md +141 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/OneColumn.md +109 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/PromotedFilters.md +124 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SelfServiceCaseView.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SimpleTable.md +127 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SingleReferenceReadOnly.md +103 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SubTabs.md +79 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/TwoColumn.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/WideNarrow.md +150 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/WssNavBar.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/widget-components.md +271 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/AppAnnouncement.md +82 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/Attachment.md +146 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/CaseHistory.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/FileUtility.md +200 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/Followers.md +99 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/QuickCreate.md +114 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/SummaryItem.md +167 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/ToDo.md +190 -0
- package/templates/react-sdk-reference/.cursor/rules/component-map.mdrules +41 -0
- package/templates/react-sdk-reference/.cursor/rules/dse-component.mdrules +78 -0
- package/templates/react-sdk-reference/.cursor/rules/field-component.mdrules +74 -0
- package/templates/react-sdk-reference/.cursor/rules/pega-sdk.mdrules +247 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/add-component.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-all-components.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-dse-components.mdrules +131 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-field-components.mdrules +144 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-template-components.mdrules +156 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-widget-components.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/identify-components.mdrules +110 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/replace-design-system.mdrules +524 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/component-contracts.mdrules +145 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/AlertBanner.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Banner.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/CaseSummaryFields.mdrules +159 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/DetailsFields.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroup.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroupList.mdrules +116 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldValueList.mdrules +120 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Operator.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Pulse.mdrules +88 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/RichTextEditor.mdrules +211 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/WssQuickCreate.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension.mdrules +294 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-components.mdrules +299 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/AutoComplete.mdrules +117 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/CancelAlert.mdrules +208 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Checkbox.mdrules +163 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Currency.mdrules +111 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Date.mdrules +104 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/DateTime.mdrules +108 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Decimal.mdrules +103 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Dropdown.mdrules +119 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Email.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Group.mdrules +95 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Integer.mdrules +92 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Location.mdrules +141 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Multiselect.mdrules +169 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ObjectReference.mdrules +169 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Percentage.mdrules +97 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Phone.mdrules +115 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RadioButtons.mdrules +151 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RichText.mdrules +143 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ScalarList.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SelectableCard.mdrules +221 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SemanticLink.mdrules +153 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextArea.mdrules +101 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextContent.mdrules +106 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextInput.mdrules +109 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Time.mdrules +93 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/URL.mdrules +90 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/UserReference.mdrules +185 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/run-and-verify.mdrules +73 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-components.mdrules +327 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AdvancedSearch.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AppShell.mdrules +127 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/BannerPage.mdrules +88 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseSummary.mdrules +105 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseView.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseViewActionsMenu.mdrules +131 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Confirmation.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DataReference.mdrules +125 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultForm.mdrules +107 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultPage.mdrules +115 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Details.mdrules +93 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsSubTabs.mdrules +100 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsThreeColumn.mdrules +83 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsTwoColumn.mdrules +83 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DynamicTabs.mdrules +106 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/FieldGroupTemplate.mdrules +114 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/HierarchicalForm.mdrules +118 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboard.mdrules +109 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboardPage.mdrules +90 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListPage.mdrules +73 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListView.mdrules +144 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/MultiReferenceReadOnly.mdrules +85 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/NarrowWide.mdrules +146 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/OneColumn.mdrules +114 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/PromotedFilters.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SelfServiceCaseView.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SimpleTable.mdrules +132 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SingleReferenceReadOnly.mdrules +108 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SubTabs.mdrules +84 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/TwoColumn.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WideNarrow.mdrules +155 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WssNavBar.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-components.mdrules +276 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/AppAnnouncement.mdrules +87 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Attachment.mdrules +151 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/CaseHistory.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/FileUtility.mdrules +205 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Followers.mdrules +104 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/QuickCreate.mdrules +119 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/SummaryItem.mdrules +172 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/ToDo.mdrules +195 -0
- package/templates/react-sdk-reference/.cursor/rules/template-component.mdrules +95 -0
- package/templates/react-sdk-reference/.cursor/rules/widget-component.mdrules +90 -0
- package/templates/react-sdk-reference/.github/copilot-instructions.md +58 -0
- package/templates/react-sdk-reference/.github/prompts/add-component.prompt.md +144 -16
- package/templates/react-sdk-reference/.github/prompts/generate-all-components.prompt.md +154 -0
- package/templates/react-sdk-reference/.github/prompts/generate-dse-components.prompt.md +131 -0
- package/templates/react-sdk-reference/.github/prompts/generate-field-components.prompt.md +144 -0
- package/templates/react-sdk-reference/.github/prompts/generate-template-components.prompt.md +156 -0
- package/templates/react-sdk-reference/.github/prompts/generate-widget-components.prompt.md +129 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension.md +58 -18
- package/templates/react-sdk-reference/.github/skills/field-components.md +55 -23
- package/templates/react-sdk-reference/.github/skills/template-components.md +48 -11
- package/templates/react-sdk-reference/.github/skills/widget-components.md +49 -12
- package/templates/react-sdk-reference/AGENTS.md +217 -29
- package/templates/react-sdk-reference/package.json +1 -1
- package/templates/react-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-sdk-reference/sdk-config.json +1 -1
- package/templates/react-sdk-reference/vite.config.ts +1 -1
- package/templates/react-sdk-reference/.github/prompts/replace-all-fields.prompt.md +0 -48
- package/templates/react-sdk-reference/.github/prompts/replace-component.prompt.md +0 -81
- package/templates/react-sdk-reference/.github/prompts/replace-field.prompt.md +0 -41
- package/templates/react-sdk-reference/.github/prompts/swap-design-system.prompt.md +0 -49
- package/templates/react-sdk-reference/.github/skills/swap-design-system.md +0 -105
- package/templates/react-sdk-reference/pega-constellationjs-0.26.2.tgz +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Field component skill: Integer
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Integer
|
|
7
|
+
|
|
8
|
+
Integer-only text input that filters out decimal separators, binds to a Pega case property.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, props interface, display modes, event handling, and registration patterns common to ALL field components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
Renders a single-line text input restricted to integer values. Actively filters out decimal (`.`) and thousands separator (`,`) characters as the user types, mimicking Pega's native integer field behavior. Delegates read-only rendering to `TextInput`.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Pega Name:** `Integer`
|
|
21
|
+
- **Type / Subtype:** `Field` / `Integer`
|
|
22
|
+
- **Registration key:** `Integer` (in `component-map.ts`)
|
|
23
|
+
|
|
24
|
+
## Props (component-specific)
|
|
25
|
+
|
|
26
|
+
No props beyond `PConnFieldProps`. Import type as:
|
|
27
|
+
```typescript
|
|
28
|
+
import type { PConnFieldProps } from '@pega/sdk-react';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Behavioral Contract
|
|
32
|
+
|
|
33
|
+
1. **Local state:** Maintain `inputValue` (string). Initialize from `value` prop (`''` default).
|
|
34
|
+
2. **Sync from store:** `useEffect` watching `value` → `setInputValue(value)`.
|
|
35
|
+
3. **On change (character filtering):** Before updating local state, inspect the last character typed:
|
|
36
|
+
- If the last character is `.` or `,`, strip it from the value: `event.target.value = theAttemptedValue.slice(0, -1)`.
|
|
37
|
+
- Then update local state with the sanitized value.
|
|
38
|
+
- This "eating" of separator characters replicates Pega's native integer field behavior.
|
|
39
|
+
4. **Input mode:** Set `inputMode='numeric'` and `pattern='[0-9]*'` on the input element for mobile keyboards.
|
|
40
|
+
5. **Input type:** Use `type='text'` (NOT `type='number'`) — this avoids browser-specific number input quirks.
|
|
41
|
+
6. **On blur:** Commit via `handleEvent(actions, 'changeNblur', propName, inputValue)`.
|
|
42
|
+
7. **Read-only:** Delegate to `TextInput`: `return <TextInput {...props} />`.
|
|
43
|
+
|
|
44
|
+
## Display Mode Rendering
|
|
45
|
+
|
|
46
|
+
- **`DISPLAY_ONLY`:** `<FieldValueList name={hideLabel ? '' : label} value={value} />`.
|
|
47
|
+
- **`STACKED_LARGE_VAL`:** `<FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />`.
|
|
48
|
+
|
|
49
|
+
## Read-Only Rendering
|
|
50
|
+
|
|
51
|
+
Delegate to `TextInput`: `return <TextInput {...props} />`.
|
|
52
|
+
|
|
53
|
+
## Visual Specifications
|
|
54
|
+
|
|
55
|
+
Identical to `TextInput` visually:
|
|
56
|
+
|
|
57
|
+
| Property | Value |
|
|
58
|
+
|----------|-------|
|
|
59
|
+
| Width | 100% |
|
|
60
|
+
| Size | Small (~40px height) |
|
|
61
|
+
| Variant | Outlined |
|
|
62
|
+
| Border | 1px solid |
|
|
63
|
+
| Border radius | 4px |
|
|
64
|
+
| Error state | Red border + red helper text |
|
|
65
|
+
| Input mode | `numeric` (shows numeric keyboard on mobile) |
|
|
66
|
+
| Pattern | `[0-9]*` |
|
|
67
|
+
|
|
68
|
+
## Edge Cases & Special Logic
|
|
69
|
+
|
|
70
|
+
- **Character filtering is inline** — do NOT use `type='number'` as it introduces inconsistent behavior across browsers (e.g., accepts `e`, `+`, `-` by default).
|
|
71
|
+
- The disallowed characters array is `['.', ',']` — both decimal point and thousands separator are rejected.
|
|
72
|
+
- Strip only the LAST character if it is disallowed — do not strip from anywhere else in the string (user may paste a valid integer that is then validated by blur).
|
|
73
|
+
- `onBlur` is omitted when `readOnly`.
|
|
74
|
+
|
|
75
|
+
## Dependencies
|
|
76
|
+
|
|
77
|
+
- `handleEvent` from `../../helpers/event-utils`
|
|
78
|
+
- `getComponentFromRegistry('TextInput')` — for read-only delegation
|
|
79
|
+
- `getComponentFromRegistry('FieldValueList')` — for display modes
|
|
80
|
+
|
|
81
|
+
## Design System Mapping
|
|
82
|
+
|
|
83
|
+
**UI control type:** Numeric text input (integer-only) — use `<input type="text" inputmode="numeric" pattern="[0-9]*">`.
|
|
84
|
+
|
|
85
|
+
Listed design systems are examples only.
|
|
86
|
+
|
|
87
|
+
| Design System | Recommended Component |
|
|
88
|
+
|---|---|
|
|
89
|
+
| Default (CSS only) | `<input type="text" inputMode="numeric" pattern="[0-9]*">` |
|
|
90
|
+
| MUI | `<TextField type='text' slotProps={{ htmlInput: { inputMode: 'numeric', pattern: '[0-9]*' } }} />` |
|
|
91
|
+
| Ant Design | `<InputNumber precision={0} />` or `<Input />` with custom `onChange` filter |
|
|
92
|
+
| Chakra UI | `<NumberInput allowMouseWheel={false} />` or plain `<Input>` with filter |
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Field component skill: Location
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Location
|
|
7
|
+
|
|
8
|
+
Location input with Google Maps Places autocomplete, interactive map display, and optional geolocation (current location).
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, props interface, display modes, event handling, and registration patterns common to ALL field components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
Renders a text input that integrates with Google Maps Places API for address/location autocomplete. Optionally shows an interactive map with a marker. Supports an `onlyCoordinates` mode that stores `"lat, lng"` instead of address text. Includes a "get current location" button using the browser geolocation API.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Pega Name:** `Location`
|
|
21
|
+
- **Type / Subtype:** `Field` / `Text-Location`
|
|
22
|
+
- **Registration key:** `Location` (in `component-map.ts`)
|
|
23
|
+
|
|
24
|
+
## Props (component-specific)
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| `coordinates` | `string` (optional) | `''` | Comma-separated lat/lng string (e.g., `'18.5204, 73.8567'`) |
|
|
29
|
+
| `onlyCoordinates` | `boolean` (optional) | `false` | If `true`, store and display lat/lng coordinates instead of address text |
|
|
30
|
+
| `showMap` | `boolean` (optional) | — | Show the interactive map in editable mode |
|
|
31
|
+
| `showMapReadOnly` | `boolean` (optional) | — | Show the map in read-only mode |
|
|
32
|
+
|
|
33
|
+
## Behavioral Contract
|
|
34
|
+
|
|
35
|
+
1. **APIs required:**
|
|
36
|
+
- Google Maps JavaScript API with `places` and `geocoding` libraries
|
|
37
|
+
- API key obtained from `pConn.getGoogleMapsAPIKey?.() || ''`
|
|
38
|
+
2. **Local state:**
|
|
39
|
+
- `inputValue` (string): shown in the text input
|
|
40
|
+
- `mapCenter` (`{lat, lng}`): default `{ lat: 18.5204, lng: 73.8567 }` (Pune, India)
|
|
41
|
+
- `markerPosition` (`{lat, lng} | null`)
|
|
42
|
+
3. **Value sync:** `useEffect` watching `value`, `coordinates`, `onlyCoordinates`:
|
|
43
|
+
- If `onlyCoordinates && coordinates`: `setInputValue(coordinates)`
|
|
44
|
+
- Else: `setInputValue(value ?? '')`
|
|
45
|
+
- If `coordinates` exists: parse `lat, lng`, update `mapCenter` and `markerPosition`
|
|
46
|
+
4. **Places Autocomplete (init):** `useEffect` watching `isLoaded` — once Maps API loads and `inputRef.current` is set, attach `new google.maps.places.Autocomplete(inputRef.current)` and add `place_changed` listener.
|
|
47
|
+
5. **On place changed:**
|
|
48
|
+
- Get `place.geometry.location` → extract `lat`, `lng`
|
|
49
|
+
- If `onlyCoordinates`: `inputValue = "${lat}, ${lng}"`, commit this as the value AND update `coordinates` property
|
|
50
|
+
- Else: `inputValue = place.formatted_address`, commit address as value, update `coordinates` property separately: `actions.updateFieldValue(coordPropName, coordinateString)`
|
|
51
|
+
- Update `mapCenter` and `markerPosition`
|
|
52
|
+
6. **On text change (manual):**
|
|
53
|
+
- Update `inputValue` and commit immediately via `handleEvent(actions, 'changeNblur', propName, newValue)`
|
|
54
|
+
- If input cleared and `coordPropName` exists: `actions.updateFieldValue(coordPropName, '')`; `setMarkerPosition(null)`
|
|
55
|
+
7. **Get current location button:**
|
|
56
|
+
- Use `navigator.geolocation.getCurrentPosition()`
|
|
57
|
+
- If `onlyCoordinates`: store `"lat, lng"` as value and coordinates
|
|
58
|
+
- Else: reverse-geocode using `google.maps.Geocoder`, store address as value, `"lat, lng"` as coordinates
|
|
59
|
+
8. **Coordinate property name:** `coordPropName = (pConn.getStateProps() as any).coordinates` — separate from the main `propName`
|
|
60
|
+
9. **Error display:** If `status === 'error' && !!validatemessage && !disabled`, show an error alert ABOVE the input.
|
|
61
|
+
10. **Read-only:** Delegate text to `TextInput`, optionally show map if `showMapReadOnly`.
|
|
62
|
+
|
|
63
|
+
### Map configuration (disabled state)
|
|
64
|
+
|
|
65
|
+
When `disabled`, map options disable all interactions:
|
|
66
|
+
- `gestureHandling: 'none'`, `keyboardShortcuts: false`, `disableDefaultUI: true`, `clickableIcons: false`
|
|
67
|
+
- Map opacity: `0.7` when disabled
|
|
68
|
+
|
|
69
|
+
### CSS for Google Maps autocomplete dropdown z-index:
|
|
70
|
+
```css
|
|
71
|
+
/* Location.css */
|
|
72
|
+
.pac-container { z-index: 2147483647; }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Display Mode Rendering
|
|
76
|
+
|
|
77
|
+
- **`DISPLAY_ONLY`:** `<FieldValueList name={hideLabel ? '' : label} value={value} />` — raw address/coordinates string.
|
|
78
|
+
- **`STACKED_LARGE_VAL`:** `<FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />`.
|
|
79
|
+
|
|
80
|
+
## Read-Only Rendering
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
<div>
|
|
84
|
+
<TextInput {...props} />
|
|
85
|
+
{isLoaded && showMapReadOnly && <GoogleMap ... />}
|
|
86
|
+
</div>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Visual Specifications
|
|
90
|
+
|
|
91
|
+
| Property | Value |
|
|
92
|
+
|----------|-------|
|
|
93
|
+
| Width | 100% |
|
|
94
|
+
| Input variant | Default (outlined, from `TextField`) |
|
|
95
|
+
| Trailing icon | Location pin icon button (for current location) |
|
|
96
|
+
| Error alert | Alert banner ABOVE the input field when `hasError` |
|
|
97
|
+
| Map container | `width: 100%`, `height: 300px`, `marginTop: 0px` |
|
|
98
|
+
| Map render | Only shown when `isLoaded && (showMap || showMapReadOnly)` |
|
|
99
|
+
| Disabled map opacity | `0.7` |
|
|
100
|
+
|
|
101
|
+
**CSS companion file required:** `Location.css` with:
|
|
102
|
+
```css
|
|
103
|
+
.pac-container { z-index: 2147483647; }
|
|
104
|
+
```
|
|
105
|
+
This ensures the Google Maps autocomplete dropdown appears above modal/dialog overlays.
|
|
106
|
+
|
|
107
|
+
**CSS-only implementation notes:**
|
|
108
|
+
- Location pin button: `<button>` with `position: absolute; right: 8px; top: 50%; transform: translateY(-50%);`
|
|
109
|
+
|
|
110
|
+
## Edge Cases & Special Logic
|
|
111
|
+
|
|
112
|
+
- **`isLoaded` guard:** Only render the `TextField` and map after Google Maps API is fully loaded.
|
|
113
|
+
- **`onlyCoordinates` mode:** The stored `value` is `"lat, lng"` format; coordinates and address are the same.
|
|
114
|
+
- **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.
|
|
115
|
+
- **Autocomplete ref lifecycle:** `autocompleteRef` is only initialized once (when `!autocompleteRef.current`). The `handlePlaceChanged` callback must be stable (`useCallback` with deps).
|
|
116
|
+
- **Map default center:** Pune, India — `{ lat: 18.5204, lng: 73.8567 }`.
|
|
117
|
+
- Google Maps Geocoder is only called in non-`onlyCoordinates` geolocation mode for reverse geocoding.
|
|
118
|
+
|
|
119
|
+
## Dependencies
|
|
120
|
+
|
|
121
|
+
- Google Maps JavaScript API (loaded dynamically via `@react-google-maps/api` or equivalent loader).
|
|
122
|
+
- `@react-google-maps/api` — `GoogleMap`, `Marker`, `useLoadScript`.
|
|
123
|
+
- `handleEvent` from `../../helpers/event-utils`.
|
|
124
|
+
- `getComponentFromRegistry('TextInput')` for read-only.
|
|
125
|
+
- `getComponentFromRegistry('FieldValueList')` for display modes.
|
|
126
|
+
- A location pin icon.
|
|
127
|
+
|
|
128
|
+
**CSS companion:** `Location.css` — must be imported to fix autocomplete z-index.
|
|
129
|
+
|
|
130
|
+
## Design System Mapping
|
|
131
|
+
|
|
132
|
+
**UI control type:** Text input with location autocomplete dropdown + optional map.
|
|
133
|
+
|
|
134
|
+
Listed design systems are examples only.
|
|
135
|
+
|
|
136
|
+
| Design System | Recommended Component |
|
|
137
|
+
|---|---|
|
|
138
|
+
| Default (CSS only) | `<input type="text">` + Google Maps Autocomplete API + Google Map embed |
|
|
139
|
+
| MUI | `<TextField>` + `InputAdornment` for icon + `@react-google-maps/api` |
|
|
140
|
+
| Ant Design | `<Input suffix={<LocationIcon />}>` + Google Maps |
|
|
141
|
+
| Chakra UI | `<InputGroup>` + `<InputRightElement>` + Google Maps |
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Field component skill: Multiselect
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Multiselect
|
|
7
|
+
|
|
8
|
+
Multi-select autocomplete field supporting flat lists, grouped/hierarchical data, reference list binding, and debounced search.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, props interface, display modes, event handling, and registration patterns common to ALL field components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
Renders a multi-value typeahead input where users can search and select multiple items. Supports flat datasources, grouped/hierarchical data, reference lists (embedded page lists), and debounced async search. Manages selection state and commits changes via reference list instructions.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Pega Name:** `Multiselect`
|
|
21
|
+
- **Type / Subtype:** `Field` / `Picklist-Multi`
|
|
22
|
+
- **Registration key:** `Multiselect` (in `component-map.ts`)
|
|
23
|
+
|
|
24
|
+
> **Note:** `Multiselect` does NOT extend `PConnFieldProps` — it uses raw `props` (no typed interface in the reference implementation). Define props as needed for your implementation.
|
|
25
|
+
|
|
26
|
+
## Props (component-specific)
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
|------|------|---------|-------------|
|
|
30
|
+
| `getPConnect` | `function` | — | PConnect accessor |
|
|
31
|
+
| `label` | `string` | — | Field label |
|
|
32
|
+
| `placeholder` | `string` | — | Input placeholder |
|
|
33
|
+
| `referenceList` | `any[]` | — | Currently selected items from embedded page list |
|
|
34
|
+
| `selectionKey` | `string` | — | Property path used as the selection key |
|
|
35
|
+
| `primaryField` | `string` | — | Property path for the primary display field |
|
|
36
|
+
| `initialCaseClass` | `string` | — | Case class for context in search |
|
|
37
|
+
| `selectionList` | `string` | — | Property path of the reference list |
|
|
38
|
+
| `datasource` | `any[]` | `[]` | Flat data source |
|
|
39
|
+
| `columns` | `any[]` | `[{}]` | Column config for key/value extraction |
|
|
40
|
+
| `listType` | `string` | `''` | `'associated'`, `'datapage'`, `'promptList'`, `'localList'` |
|
|
41
|
+
| `isGroupData` | `boolean` | `false` | Whether to use grouped/hierarchical data |
|
|
42
|
+
| `groupDataSource` | `any[]` | `[]` | Data source for grouped display |
|
|
43
|
+
| `groupColumnsConfig` | `any[]` | `[{}]` | Column config for group display |
|
|
44
|
+
| `referenceType` | `string` | — | `'Case'` or `'Data'` |
|
|
45
|
+
| `secondaryFields` | `any` | — | Additional secondary display fields |
|
|
46
|
+
| `showSecondaryInSearchOnly` | `boolean` | `false` | Show secondary fields only during search |
|
|
47
|
+
| `parameters` | `object` | `{}` | Data page query parameters |
|
|
48
|
+
| `matchPosition` | `string` | `'contains'` | Search match position (`'contains'`, `'startsWith'`) |
|
|
49
|
+
| `maxResultsDisplay` | `string` | — | Max results to display (`'100'` default) |
|
|
50
|
+
| `value` | `any` | — | Current value |
|
|
51
|
+
|
|
52
|
+
## Behavioral Contract
|
|
53
|
+
|
|
54
|
+
### Reference List Mode (when `referenceList.length > 0`)
|
|
55
|
+
|
|
56
|
+
When `referenceList` has items, override datasource and columns:
|
|
57
|
+
- `datasource = referenceList`
|
|
58
|
+
- Build `columns`: primary display field, key field, secondary columns (from `secondaryFields` or default to `selectionKey`)
|
|
59
|
+
- If `referenceType === 'Case'`: append secondary columns
|
|
60
|
+
|
|
61
|
+
### Data Config
|
|
62
|
+
|
|
63
|
+
Build a `dataConfig` object (memoized with deep comparison) containing:
|
|
64
|
+
- `dataSource`, `groupDataSource`, `isGroupData`, `showSecondaryInSearchOnly`, `parameters`, `matchPosition`, `listType`, `maxResultsDisplay`
|
|
65
|
+
- `columns`: preprocessed (strip leading `.` from value fields)
|
|
66
|
+
- `groupColumnsConfig`: preprocessed
|
|
67
|
+
|
|
68
|
+
### Items Tree
|
|
69
|
+
|
|
70
|
+
- `displayFieldMeta`: derived from `columns` when `listType !== 'associated'`
|
|
71
|
+
- `groupsDisplayFieldMeta`: derived from `groupColumnsConfig` when `listType !== 'associated'`
|
|
72
|
+
- `itemsTree` state: for `isGroupData` mode, initialized from `getGroupDataForItemsTree(groupDataSource, groupsDisplayFieldMeta, showSecondaryInSearchOnly)`; otherwise `[]`
|
|
73
|
+
|
|
74
|
+
### Data API Initialization
|
|
75
|
+
|
|
76
|
+
In `useEffect` watching `dataConfig` (non-associated lists):
|
|
77
|
+
```
|
|
78
|
+
PCore.getDataApi().init(dataConfig, contextName).then(dataObj => {
|
|
79
|
+
dataApiObj.current = dataObj
|
|
80
|
+
if (!isGroupData) {
|
|
81
|
+
getCaseListBasedOnParamsDebounced.current(inputValue ?? '', '', [...selectedItems], [...itemsTree])
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Search
|
|
87
|
+
|
|
88
|
+
`getCaseListBasedOnParams(searchText, group, selectedRows, currentItemsTree, isTriggeredFromSearch)`:
|
|
89
|
+
1. If `referenceList.length > 0`: get currently selected rows from `listActions.getSelectedRows(true)`, map to `{id, primary}` format, update `selectedItems` state.
|
|
90
|
+
2. Build `initalItemsTree`: use fresh data if `isTriggeredFromSearch || !currentItemsTree`, else current.
|
|
91
|
+
3. Call `doSearch(...)` to get filtered results.
|
|
92
|
+
4. `setItemsTree(results)`.
|
|
93
|
+
|
|
94
|
+
**Debounce:** 500ms debounce on `getCaseListBasedOnParams` via `getCaseListBasedOnParamsDebounced` ref.
|
|
95
|
+
|
|
96
|
+
### Mount Effects
|
|
97
|
+
|
|
98
|
+
- `useEffect([pConn])`: if `referenceList.length > 0`, call `pConn.setReferenceList(selectionList)`.
|
|
99
|
+
- `useEffect([])`: set up debounced search ref.
|
|
100
|
+
|
|
101
|
+
### Selection Changes (`handleChange`)
|
|
102
|
+
|
|
103
|
+
When selection changes (user adds/removes item):
|
|
104
|
+
1. Mark all currently selected items as `selected: true`.
|
|
105
|
+
2. Determine if this was an add or remove.
|
|
106
|
+
3. Update `itemsTree` selections in-place.
|
|
107
|
+
4. `setSelectedItems(updatedItems)`, `setItemsTree(itemsTree)`.
|
|
108
|
+
5. Reset `inputValue` to `''`.
|
|
109
|
+
6. If `referenceList`: call `setSelectedItemsForReferenceList(clickedItem[0])`.
|
|
110
|
+
|
|
111
|
+
`setSelectedItemsForReferenceList`: calls `insertInstruction` (if `selected: true`) or `deleteInstruction` (if `selected: false`) and clears error messages.
|
|
112
|
+
|
|
113
|
+
### Search Input
|
|
114
|
+
|
|
115
|
+
`onSearchHandler`: updates `inputValue` state and calls debounced search with `isTriggeredFromSearch=true`.
|
|
116
|
+
|
|
117
|
+
## Display Mode Rendering
|
|
118
|
+
|
|
119
|
+
No explicit `displayMode` handling in the reference implementation — Multiselect is rendered directly by parent components when display mode is needed. If `displayMode` support is needed, implement similar to Dropdown.
|
|
120
|
+
|
|
121
|
+
## Visual Specifications
|
|
122
|
+
|
|
123
|
+
| Property | Value |
|
|
124
|
+
|----------|-------|
|
|
125
|
+
| Width | 100% |
|
|
126
|
+
| Size | Small |
|
|
127
|
+
| Variant | Outlined |
|
|
128
|
+
| Multiple values | Tags/chips shown inside the input box |
|
|
129
|
+
| Dropdown | Shows filtered options with checkboxes |
|
|
130
|
+
| Close on select | Off (`disableCloseOnSelect`) — user can select multiple before closing |
|
|
131
|
+
| Option label | `option.primary` field |
|
|
132
|
+
| Placeholder | From `placeholder` prop |
|
|
133
|
+
| Error state | Red border + red helper text |
|
|
134
|
+
|
|
135
|
+
**CSS-only notes:**
|
|
136
|
+
```css
|
|
137
|
+
.multiselect-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid rgba(0,0,0,0.23); border-radius: 4px; }
|
|
138
|
+
.multiselect-tag { background: rgba(0,0,0,0.08); border-radius: 16px; padding: 2px 8px; font-size: 0.8125rem; display: flex; align-items: center; gap: 4px; }
|
|
139
|
+
.multiselect-tag-delete { cursor: pointer; font-size: 0.75rem; }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Edge Cases & Special Logic
|
|
143
|
+
|
|
144
|
+
- **`dataConfig` deep memoization:** Use custom deep-equal hook (`useDeepMemo`) to avoid re-initializing data API on every render.
|
|
145
|
+
- `itemsTreeBaseData` is fixed at render time — used as the base for each fresh search.
|
|
146
|
+
- When `isGroupData=false`: debounced search fires after data API init.
|
|
147
|
+
- When `isGroupData=true`: groups are pre-populated from `groupDataSource`.
|
|
148
|
+
- The `selected` flag on items in `itemsTree` tracks selection state in the dropdown.
|
|
149
|
+
|
|
150
|
+
## Dependencies
|
|
151
|
+
|
|
152
|
+
- `doSearch`, `getDisplayFieldsMetaData`, `useDeepMemo`, `preProcessColumns`, `getGroupDataForItemsTree` from `./utils` (local utils file).
|
|
153
|
+
- `insertInstruction`, `deleteInstruction` from `../../helpers/instructions-utils`.
|
|
154
|
+
- `debounce` from `throttle-debounce` library (or any debounce utility).
|
|
155
|
+
- `PCore.getDataApi()` — for data initialization.
|
|
156
|
+
- Multi-select autocomplete UI widget.
|
|
157
|
+
|
|
158
|
+
## Design System Mapping
|
|
159
|
+
|
|
160
|
+
**UI control type:** Multi-select combobox with tags/chips and searchable dropdown.
|
|
161
|
+
|
|
162
|
+
Listed design systems are examples only.
|
|
163
|
+
|
|
164
|
+
| Design System | Recommended Component |
|
|
165
|
+
|---|---|
|
|
166
|
+
| Default (CSS only) | Custom tag input + filterable dropdown list |
|
|
167
|
+
| MUI | `<Autocomplete multiple disableCloseOnSelect>` |
|
|
168
|
+
| Ant Design | `<Select mode="multiple" showSearch>` |
|
|
169
|
+
| Chakra UI | Third-party multi-select (e.g., Chakra React Select) |
|
package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ObjectReference.mdrules
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Field component skill: ObjectReference
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: ObjectReference
|
|
7
|
+
|
|
8
|
+
Composite field that dynamically renders a child component (Dropdown, AutoComplete, or SemanticLink) for referencing another Pega case or data object. Supports editable-in-review mode with direct case update.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, props interface, display modes, event handling, and registration patterns common to ALL field components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
Does NOT render a UI control directly. Instead, it reads the raw metadata to determine which child component type to render (`Dropdown`, `AutoComplete`, or `SemanticLink`), constructs that child component via `getPConnect().createComponent(...)`, and renders it inside a grid container. Also handles editable-in-review mode where the user can change a reference field while viewing a case.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Pega Name:** `ObjectReference`
|
|
21
|
+
- **Type / Subtype:** `Field` / `Reference`
|
|
22
|
+
- **Registration key:** `ObjectReference` (in `component-map.ts`)
|
|
23
|
+
|
|
24
|
+
## Props (component-specific)
|
|
25
|
+
|
|
26
|
+
> Uses `Omit<PConnFieldProps, 'value'>` — no direct `value` prop.
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
|------|------|---------|-------------|
|
|
30
|
+
| `getPConnect` | `any` | — | PConnect accessor |
|
|
31
|
+
| `displayMode` | `any` | — | Display mode |
|
|
32
|
+
| `allowAndPersistChangesInReviewMode` | `any` | `false` | Whether the reference can be edited while in review/display mode |
|
|
33
|
+
| `targetObjectType` | `any` | — | `'case'` or `'data'` — determines `referenceType` |
|
|
34
|
+
| `mode` | `string` | `''` | `'single'` or `'multi'` (SELECTION_MODE) |
|
|
35
|
+
| `parameters` | `object` | — | Data page query parameters |
|
|
36
|
+
| `hideLabel` | `boolean` | `false` | Whether to hide label |
|
|
37
|
+
| `inline` | `boolean` | `false` | Whether to render inline |
|
|
38
|
+
| `showPromotedFilters` | `boolean` | `false` | Show promoted filters in child |
|
|
39
|
+
| `additionalFields` | `any` | — | Additional fields for read-only display |
|
|
40
|
+
|
|
41
|
+
## Behavioral Contract
|
|
42
|
+
|
|
43
|
+
### Setup
|
|
44
|
+
|
|
45
|
+
1. `referenceType = targetObjectType === 'case' ? 'Case' : 'Data'`
|
|
46
|
+
2. `rawViewMetadata = pConn.getRawMetadata()` — the raw component metadata from Pega config
|
|
47
|
+
3. `refFieldMetadata = pConn.getFieldMetadata(rawViewMetadata?.config?.value?.split('.', 2)[1])`
|
|
48
|
+
4. `propsToUse = { ...pConn.getInheritedProps(), ...props }` — merged inherited + local props
|
|
49
|
+
5. `isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY'`
|
|
50
|
+
6. `canBeChangedInReviewMode = editableInReview && ['Autocomplete', 'Dropdown'].includes(rawViewMetadata.config.componentType)`
|
|
51
|
+
|
|
52
|
+
### Subsection: Read-only variants (display mode, non-editable)
|
|
53
|
+
|
|
54
|
+
**If `componentType === 'SemanticLink'` and `!canBeChangedInReviewMode`:**
|
|
55
|
+
Build a SemanticLink config from rawViewMetadata and call `getPConnect().createComponent({ type: 'SemanticLink', config: {...} })`. Config includes:
|
|
56
|
+
- `displayField` → `primaryField` and `text`
|
|
57
|
+
- `value` → `caseID`
|
|
58
|
+
- `resourceParams: { workID: value }`, `resourcePayload: { caseClassName: caseClass }`
|
|
59
|
+
- `displayMode`, `referenceType`, `hideLabel`, `dataRelationshipContext`
|
|
60
|
+
|
|
61
|
+
**If `isDisplayModeEnabled && !canBeChangedInReviewMode` (other types):**
|
|
62
|
+
Render `<SingleReferenceReadonly>` with config from `rawViewMetadata.config`, passing:
|
|
63
|
+
- `label`, `type`, `displayAs='readonly'`, `displayMode`, `referenceType`, `hideLabel`, `dataRelationshipContext`, `additionalFields`
|
|
64
|
+
|
|
65
|
+
### Subsection: Editable variants (including editable-in-review)
|
|
66
|
+
|
|
67
|
+
**If NOT in a read-only case:**
|
|
68
|
+
|
|
69
|
+
1. **Set datasource:** Call `generateColumns(rawViewMetadata.config, pConn, referenceType)` to populate column config.
|
|
70
|
+
- Set `rawViewMetadata.config.deferDatasource = true`
|
|
71
|
+
- Set `rawViewMetadata.config.listType = 'datapage'`
|
|
72
|
+
- Set default placeholder `'@L Select...'` for Dropdown/AutoComplete if missing
|
|
73
|
+
|
|
74
|
+
2. **Pass-through configs:**
|
|
75
|
+
- `rawViewMetadata.config.showPromotedFilters = showPromotedFilters`
|
|
76
|
+
- If `!canBeChangedInReviewMode`: set `rawViewMetadata.config.displayMode = displayMode`
|
|
77
|
+
|
|
78
|
+
3. **Build fieldMetaData:**
|
|
79
|
+
```
|
|
80
|
+
fieldMetaData = { datasourceMetadata: { datasource: { parameters: {} } } }
|
|
81
|
+
```
|
|
82
|
+
- Set `propertyForDisplayText` from `datasource.fields.text` (strip `@P ` prefix)
|
|
83
|
+
- Set `propertyForValue` from `datasource.fields.value` (strip `@P ` prefix)
|
|
84
|
+
- Set `name` from `referenceList`
|
|
85
|
+
- If `rawViewMetadata.config.parameters`: assign `parameters` prop
|
|
86
|
+
|
|
87
|
+
4. **Create child component:**
|
|
88
|
+
```
|
|
89
|
+
getPConnect().createComponent({
|
|
90
|
+
type, // 'Dropdown' or 'AutoComplete'
|
|
91
|
+
config: {
|
|
92
|
+
...rawViewMetadata.config,
|
|
93
|
+
descriptors: mode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
|
|
94
|
+
datasourceMetadata: fieldMetaData.datasourceMetadata,
|
|
95
|
+
required, visibility, disabled, label, parameters, readOnly: false,
|
|
96
|
+
localeReference, referenceType (for single mode only),
|
|
97
|
+
contextClass: targetObjectClass,
|
|
98
|
+
primaryField: displayField,
|
|
99
|
+
dataRelationshipContext,
|
|
100
|
+
hideLabel, onRecordChange, inline
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### `onRecordChange` handler
|
|
106
|
+
|
|
107
|
+
Called when user selects a new value in editable/editable-in-review mode:
|
|
108
|
+
1. Build `refreshOptions = { autoDetectRefresh: true, propertyName: rawViewMetadata.config?.value }`
|
|
109
|
+
2. If `!canBeChangedInReviewMode || !pConn.getValue('__currentPageTabViewName')`: call `getPConnect().getActionsApi().refreshCaseView(caseKey, viewName, pgRef, refreshOptions)`.
|
|
110
|
+
3. Extract `propValue = event?.id || event?.target?.value`.
|
|
111
|
+
4. For multi mode (`SimpleTableSelect`): `propName = getPropertyName(rawViewMetadata.config.selectionList)`, else `propName = getPropertyName(rawViewMetadata.config.value)`.
|
|
112
|
+
5. If `propValue && canBeChangedInReviewMode && isDisplayModeEnabled`:
|
|
113
|
+
- Get edit lock via `PCore.getCaseUtils().getCaseEditLock(caseKey, '')`
|
|
114
|
+
- Build commit data from page reference path
|
|
115
|
+
- Call `PCore.getCaseUtils().updateCaseEditFieldsData(...)` to persist the change
|
|
116
|
+
- Update container's last update time and etag
|
|
117
|
+
|
|
118
|
+
### Memoization
|
|
119
|
+
|
|
120
|
+
`recreatedFirstChild` is memoized with `useMemo` — dependencies: `rawViewMetadata.config?.datasource?.source`, `parameters`, `propsToUse.required`, `propsToUse.disabled`, `getPConnect().getPageReference()`.
|
|
121
|
+
|
|
122
|
+
## Display Mode Rendering
|
|
123
|
+
|
|
124
|
+
Display mode is passed through to the child component — the child (Dropdown, AutoComplete, SemanticLink, or SingleReferenceReadonly) handles its own display mode rendering.
|
|
125
|
+
|
|
126
|
+
## Visual Specifications
|
|
127
|
+
|
|
128
|
+
ObjectReference itself renders a minimal grid container:
|
|
129
|
+
```
|
|
130
|
+
<Grid container>
|
|
131
|
+
<Grid>{recreatedFirstChild}</Grid>
|
|
132
|
+
</Grid>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The visual appearance is entirely determined by the child component being rendered. No additional styling is applied by `ObjectReference` itself.
|
|
136
|
+
|
|
137
|
+
**CSS-only implementation:**
|
|
138
|
+
```css
|
|
139
|
+
.object-reference-container { display: grid; width: 100%; }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Edge Cases & Special Logic
|
|
143
|
+
|
|
144
|
+
- **`generateColumns`**: a utility from `./utils` that populates `rawViewMetadata.config` with proper column definitions for the child Dropdown/AutoComplete.
|
|
145
|
+
- **`getDataRelationshipContextFromKey`**: extracts the relationship context from a field key (also from `./utils`).
|
|
146
|
+
- `rawViewMetadata.config` is mutated in place before being passed to `createComponent` — this is intentional but means the component re-creates the child on relevant prop changes.
|
|
147
|
+
- For `SemanticLink` type, the child is created via `createComponent`, not rendered as a direct React element.
|
|
148
|
+
- `SELECTION_MODE.SINGLE` and `SELECTION_MODE.MULTI` constants from `./utils`.
|
|
149
|
+
|
|
150
|
+
## Dependencies
|
|
151
|
+
|
|
152
|
+
- `SELECTION_MODE`, `generateColumns`, `getDataRelationshipContextFromKey` from `./utils` (local).
|
|
153
|
+
- `getComponentFromRegistry('SingleReferenceReadOnly')` — for display-only non-SemanticLink.
|
|
154
|
+
- `PCore.getCaseUtils()`, `PCore.getAnnotationUtils()`, `PCore.getContainerUtils()` — for editable-in-review updates.
|
|
155
|
+
- `useMemo` from React.
|
|
156
|
+
- No `handleEvent` — selection handling is done by the child component via `onRecordChange`.
|
|
157
|
+
|
|
158
|
+
## Design System Mapping
|
|
159
|
+
|
|
160
|
+
**UI control type:** Composite wrapper — renders Dropdown, AutoComplete, SemanticLink, or SingleReferenceReadonly. No dedicated UI control.
|
|
161
|
+
|
|
162
|
+
Listed design systems are examples only.
|
|
163
|
+
|
|
164
|
+
| Scenario | Rendered Child |
|
|
165
|
+
|----------|----------------|
|
|
166
|
+
| `componentType='Dropdown'` (editable) | `Dropdown` component |
|
|
167
|
+
| `componentType='AutoComplete'` (editable) | `AutoComplete` component |
|
|
168
|
+
| `componentType='SemanticLink'` | `SemanticLink` component |
|
|
169
|
+
| `displayMode='DISPLAY_ONLY'` (non-editable-in-review) | `SingleReferenceReadonly` component |
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Field component skill: Percentage
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Percentage
|
|
7
|
+
|
|
8
|
+
Percentage numeric input with a `%` suffix and locale-aware decimal/thousands separators.
|
|
9
|
+
|
|
10
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, props interface, display modes, event handling, and registration patterns common to ALL field components.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Component Purpose
|
|
15
|
+
|
|
16
|
+
Renders a numeric input for percentage values. Always appends a `%` suffix in the input. Supports configurable decimal precision and optional thousands separator. Shows a formatted percentage string in display modes.
|
|
17
|
+
|
|
18
|
+
## Pega Metadata
|
|
19
|
+
|
|
20
|
+
- **Pega Name:** `Percentage`
|
|
21
|
+
- **Type / Subtype:** `Field` / `Decimal-Percentage`
|
|
22
|
+
- **Registration key:** `Percentage` (in `component-map.ts`)
|
|
23
|
+
|
|
24
|
+
## Props (component-specific)
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| `currencyISOCode` | `string` (optional) | `'USD'` | ISO code used for locale-aware decimal/thousands separator lookup only (not for currency symbol) |
|
|
29
|
+
| `showGroupSeparators` | `string` (optional) | — | Whether to show thousands separators (passed as string, truthy check applies) |
|
|
30
|
+
| `decimalPrecision` | `number` (optional) | — | Number of decimal places |
|
|
31
|
+
|
|
32
|
+
## Behavioral Contract
|
|
33
|
+
|
|
34
|
+
1. **Local state:** Maintain `values` (string). Initialize from `value.toString()`.
|
|
35
|
+
2. **Sync from store:** `useEffect` watching `value` → `setValues(value.toString())`.
|
|
36
|
+
3. **Separators:** Derive `decimalSeparator` and `thousandSeparator` from locale lookup using `currencyISOCode` (same as Currency/Decimal). Apply `thousandSeparator` only when `showGroupSeparators` is truthy.
|
|
37
|
+
4. **Suffix:** Always append `%` suffix to the numeric input.
|
|
38
|
+
5. **Decimal scale:** Use `decimalPrecision` prop.
|
|
39
|
+
6. **No prefix:** Unlike Currency, no prefix symbol.
|
|
40
|
+
7. **On value change:** Update local `values` state with the raw numeric string.
|
|
41
|
+
8. **On blur:** Commit via `handleEvent(actions, 'changeNblur', propName, values)`.
|
|
42
|
+
9. **Read-only:** Set `readOnly: true` on the input. Flat/borderless style. `onBlur` omitted.
|
|
43
|
+
|
|
44
|
+
## Display Mode Rendering
|
|
45
|
+
|
|
46
|
+
Format the value using the percentage formatter before display:
|
|
47
|
+
- `formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), currencyOptions)`
|
|
48
|
+
- **`DISPLAY_ONLY`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedValue} />`.
|
|
49
|
+
- **`STACKED_LARGE_VAL`:** `<FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />`.
|
|
50
|
+
|
|
51
|
+
## Read-Only Rendering
|
|
52
|
+
|
|
53
|
+
Keep numeric format input with `readOnly: true` and `%` suffix still visible. Flat/borderless style.
|
|
54
|
+
|
|
55
|
+
## Visual Specifications
|
|
56
|
+
|
|
57
|
+
| Property | Value |
|
|
58
|
+
|----------|-------|
|
|
59
|
+
| Width | 100% |
|
|
60
|
+
| Size | Small |
|
|
61
|
+
| Variant editable | Outlined |
|
|
62
|
+
| Variant read-only | Standard (flat) |
|
|
63
|
+
| Suffix | `%` (always shown after the value) |
|
|
64
|
+
| Thousands separator | Only when `showGroupSeparators` is truthy |
|
|
65
|
+
| Decimal scale | `decimalPrecision` |
|
|
66
|
+
| Placeholder | From `placeholder` prop |
|
|
67
|
+
| Error state | Red border + red helper text |
|
|
68
|
+
|
|
69
|
+
**CSS-only notes:** Achieve the `%` suffix by wrapping the input in a relative container and absolutely positioning a `%` label at the right side, or using an input with a `::after` pseudo-element technique.
|
|
70
|
+
|
|
71
|
+
## Edge Cases & Special Logic
|
|
72
|
+
|
|
73
|
+
- `showGroupSeparators` is typed as `string` (not `boolean`) in the reference implementation — apply truthy check.
|
|
74
|
+
- `currencyISOCode` is only used for separator lookup (decimal/thousands), NOT for a currency symbol.
|
|
75
|
+
- The stored value is always a raw numeric string (e.g., `'45.5'`), not `'45.5%'`.
|
|
76
|
+
|
|
77
|
+
## Dependencies
|
|
78
|
+
|
|
79
|
+
- Numeric formatting library (e.g., `react-number-format`'s `NumericFormat`).
|
|
80
|
+
- `getCurrencyCharacters(currencyISOCode)` — for `theDecimalIndicator`, `theDigitGroupSeparator`.
|
|
81
|
+
- `getCurrencyOptions(currencyISOCode)` — for `format()` call.
|
|
82
|
+
- `format()` from `../../helpers/formatters`.
|
|
83
|
+
- `handleEvent` from `../../helpers/event-utils`.
|
|
84
|
+
- `getComponentFromRegistry('FieldValueList')` for display modes.
|
|
85
|
+
|
|
86
|
+
## Design System Mapping
|
|
87
|
+
|
|
88
|
+
**UI control type:** Percentage numeric input with `%` suffix.
|
|
89
|
+
|
|
90
|
+
Listed design systems are examples only.
|
|
91
|
+
|
|
92
|
+
| Design System | Recommended Component |
|
|
93
|
+
|---|---|
|
|
94
|
+
| Default (CSS only) | `<input type="text">` + custom masking + `%` suffix span |
|
|
95
|
+
| MUI | `NumericFormat` with `suffix='%'` and `customInput={TextField}` |
|
|
96
|
+
| Ant Design | `<InputNumber suffix="%" precision={decimalPrecision} />` |
|
|
97
|
+
| Chakra UI | `<NumberInput>` + `<InputRightAddon>%</InputRightAddon>` |
|