@pega/sdk 0.0.13 → 0.0.15
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 +46 -6
- package/dist/index.js +50 -24
- package/package.json +42 -3
- package/templates/angular-sdk-reference/extra-webpack.config.cjs +23 -0
- package/templates/angular-sdk-reference/index.html +12 -0
- package/templates/angular-sdk-reference/src/app/pconnect-renderer.component.ts +153 -0
- package/templates/angular-sdk-reference/src/components/component-map.ts +90 -0
- package/templates/angular-sdk-reference/src/components/fields/auto-complete/auto-complete.component.ts +304 -0
- package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +89 -0
- package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +112 -0
- package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +101 -0
- package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +118 -0
- package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +104 -0
- package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +106 -0
- package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +104 -0
- package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +113 -0
- package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +111 -0
- package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +110 -0
- package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +113 -0
- package/templates/angular-sdk-reference/src/components/helpers/sdk-helpers.ts +93 -0
- package/templates/angular-sdk-reference/src/components/infra/assignment/assignment.component.ts +206 -0
- package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts +75 -0
- package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +126 -0
- package/templates/angular-sdk-reference/src/components/infra/flow-container/flow-container.component.ts +411 -0
- package/templates/angular-sdk-reference/src/components/infra/reference/reference.component.ts +158 -0
- package/templates/angular-sdk-reference/src/components/infra/region/region.component.ts +39 -0
- package/templates/angular-sdk-reference/src/components/infra/root-container/root-container.component.ts +199 -0
- package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +89 -0
- package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +144 -0
- package/templates/angular-sdk-reference/src/components/infra/view-container/view-container.component.ts +191 -0
- package/templates/angular-sdk-reference/src/components/templates/default-form/default-form.component.ts +105 -0
- package/templates/angular-sdk-reference/src/components/templates/narrow-wide/narrow-wide.component.ts +37 -0
- package/templates/angular-sdk-reference/src/components/templates/one-column/one-column.component.ts +37 -0
- package/templates/angular-sdk-reference/src/components/templates/two-column/two-column.component.ts +37 -0
- package/templates/angular-sdk-reference/src/components/templates/wide-narrow/wide-narrow.component.ts +37 -0
- package/templates/angular-sdk-reference/tsconfig.app.json +13 -0
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +75 -34
- package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +74 -38
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +33 -1
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +57 -22
- package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +25 -10
- package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +40 -19
- package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +62 -1
- package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +26 -4
- package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +84 -33
- package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +46 -26
- package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +28 -15
- package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/generate-infra-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/identify-components.md +2 -0
- package/templates/react-sdk-reference/.ai-common/prompts/replace-design-system.md +44 -17
- package/templates/react-sdk-reference/.ai-common/skills/connect-pega-server.md +14 -1
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AssignmentHeader.md +79 -0
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Toast.md +96 -0
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +56 -35
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +29 -3
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +97 -37
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +91 -60
- package/templates/react-sdk-reference/.ai-common/skills/field-components.md +88 -30
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +133 -101
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedData.md +385 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedDataMulti.md +506 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +549 -86
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +181 -83
- package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +13 -1
- package/templates/react-sdk-reference/.ai-common/skills/portal-flow/run-and-verify-portal.md +290 -0
- package/templates/react-sdk-reference/.ai-common/skills/template-components.md +13 -1
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +125 -153
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +90 -81
- package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +13 -1
- package/templates/react-sdk-reference/assets/icons/trash.svg +3 -0
- package/templates/react-sdk-reference/index.html +0 -1
- package/templates/react-sdk-reference/package.json +2 -2
- package/templates/react-sdk-reference/package.minimal.json +2 -2
- package/templates/react-sdk-reference/sdk-config.json +3 -3
- package/templates/react-sdk-reference/src/FallbackComponent.tsx +1 -1
- package/templates/react-sdk-reference/src/MashupApp.tsx +33 -78
- package/templates/react-sdk-reference/src/PortalApp.tsx +23 -100
- package/templates/react-sdk-reference/src/components/component-map.ts +15 -1
- package/templates/react-sdk-reference/src/components/designSystemExtension/AssignmentHeader/AssignmentHeader.tsx +15 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/AssignmentHeader/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -1
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -1
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx +16 -4
- package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/ModalDialog.tsx +26 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Toast/Toast.tsx +35 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Toast/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +362 -24
- package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.tsx +1 -1
- package/templates/react-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +3 -1
- package/templates/react-sdk-reference/src/components/field/Currency/Currency.tsx +6 -3
- package/templates/react-sdk-reference/src/components/field/Date/Date.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/DateTime/DateTime.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/Decimal/Decimal.tsx +4 -3
- package/templates/react-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +2 -0
- package/templates/react-sdk-reference/src/components/field/Email/Email.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/EmbeddedDataMulti.tsx +121 -0
- package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Integer/Integer.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/Location/Location.tsx +1 -1
- package/templates/react-sdk-reference/src/components/field/Multiselect/Multiselect.tsx +40 -20
- package/templates/react-sdk-reference/src/components/field/ObjectReference/ObjectReference.tsx +554 -49
- package/templates/react-sdk-reference/src/components/field/ObjectReference/utils.ts +111 -20
- package/templates/react-sdk-reference/src/components/field/Percentage/Percentage.tsx +4 -3
- package/templates/react-sdk-reference/src/components/field/Phone/Phone.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/SelectableCard/SelectableCard.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/TextArea/TextArea.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/TextInput/TextInput.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/Time/Time.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/URL/URL.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/UserReference/UserReference.tsx +1 -1
- package/templates/react-sdk-reference/src/components/helpers/field-utils.ts +44 -0
- package/templates/react-sdk-reference/src/components/helpers/simpleTableHelpers.ts +19 -7
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/DataViewActionButtons/DataViewActionButtons.tsx +97 -0
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/DataViewActionButtons/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +53 -0
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +2 -2
- package/templates/react-sdk-reference/src/components/template/CaseSummary/CaseSummary.tsx +3 -1
- package/templates/react-sdk-reference/src/components/template/DataReference/SearchForm.tsx +4 -4
- package/templates/react-sdk-reference/src/components/template/HierarchicalForm/HierarchicalForm.tsx +2 -2
- package/templates/react-sdk-reference/src/components/template/InlineDashboard/InlineDashboard.tsx +1 -1
- package/templates/react-sdk-reference/src/components/template/ListView/ListView.tsx +7 -3
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +173 -99
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +63 -56
- package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.tsx +1 -1
- package/templates/react-sdk-reference/vite.config.ts +26 -4
- package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +0 -47
- package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +0 -50
- package/templates/react-sdk-reference/.ai-common/instructions/infra-component.md +0 -76
- package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +0 -43
- package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +0 -45
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +0 -311
- 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
|
@@ -18,84 +18,102 @@ Renders a typeahead input that shows a dropdown of matching options as the user
|
|
|
18
18
|
|
|
19
19
|
## Inputs (component-specific)
|
|
20
20
|
|
|
21
|
-
| Name
|
|
22
|
-
|
|
|
23
|
-
| `listType`
|
|
24
|
-
| `datasource`
|
|
25
|
-
| `columns`
|
|
26
|
-
| `parameters`
|
|
27
|
-
| `deferDatasource`
|
|
28
|
-
| `datasourceMetadata`
|
|
29
|
-
| `onRecordChange`
|
|
30
|
-
| `additionalProps`
|
|
21
|
+
| Name | Type | Description |
|
|
22
|
+
| ------------------------------------ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `listType` | `string` | `'associated'` or `'datapage'` |
|
|
24
|
+
| `datasource` | `any` | Datasource (array for associated, string name for datapage) |
|
|
25
|
+
| `columns` | `any[]` | Column config for extracting key/value from datasource records |
|
|
26
|
+
| `parameters` | `any` (optional) | Query parameters for data page calls |
|
|
27
|
+
| `deferDatasource` | `boolean` (optional) | If true, transform `datasourceMetadata` into datapage config |
|
|
28
|
+
| `datasourceMetadata` | `any` (optional) | Metadata for deferred datasource |
|
|
29
|
+
| `onRecordChange` | `any` (optional) | Callback fired on selection change |
|
|
30
|
+
| `additionalProps` | `object` (optional) | Extra inputs passed through to the autocomplete |
|
|
31
|
+
| `allowCreatingRecords` | `boolean` (optional) | Data-reference mode — show a "Create new" action at the foot of the option list. Default `false` |
|
|
32
|
+
| `createNewRecord` | `function` (optional) | Data-reference mode — starts creation of a new referenced record. Supplied by the reference field only when the user may create one |
|
|
33
|
+
| `onCreateNew` | `function` (optional) | Replaces the whole create-new flow when supplied |
|
|
34
|
+
| `createNewLabel` | `string` (optional) | Caption of the create-new action. Default `Create new` |
|
|
35
|
+
| `contextClass` | `string` (optional) | Data-reference mode — the class of the referenced record |
|
|
36
|
+
| `referenceType` | `string` (optional) | Data-reference mode — `Data` or `Case`, compared case-insensitively |
|
|
37
|
+
| `showFieldMessage` + `messageConfig` | `boolean` + `object` (optional) | Field input warning: when shown and not read-only, `messageConfig.content` replaces the helper text |
|
|
38
|
+
|
|
39
|
+
Two further keys are read from the component's **own raw configuration**, `getPConnect().getRawMetadata().config`, never from resolved inputs, because resolution would replace their property paths with values: `columnsFormatter`, a list of component descriptors shown as each option's secondary line, and `groupsFields`, a list of descriptors whose first entry groups the options. The reference field supplies both when it creates this component; otherwise both are absent.
|
|
40
|
+
|
|
41
|
+
**Data-reference mode** is simply this component created by the reference field with `deferDatasource` true and a `datasourceMetadata`. Nothing else switches it on, and every step below applies in both modes.
|
|
31
42
|
|
|
32
43
|
All other inputs come from the project's field input contract (see prerequisite skill).
|
|
33
44
|
|
|
34
45
|
## Implementation Structure
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
**Module Setup:** The component depends on the project's component registry
|
|
39
|
-
|
|
40
|
-
**Main Component Logic** —
|
|
41
|
-
|
|
42
|
-
1. **Registry lookups
|
|
43
|
-
2. **Receive inputs
|
|
44
|
-
3. **
|
|
45
|
-
4. **
|
|
46
|
-
5. **
|
|
47
|
-
6. **Derived values
|
|
48
|
-
7. **
|
|
49
|
-
8. **
|
|
50
|
-
9. **
|
|
51
|
-
10. **
|
|
52
|
-
11. **
|
|
53
|
-
12. **Display
|
|
54
|
-
13. **Resolve
|
|
55
|
-
14. **
|
|
56
|
-
15. **Read-only
|
|
57
|
-
16. **
|
|
47
|
+
Replace the autocomplete control with the equivalent from your chosen design system.
|
|
48
|
+
|
|
49
|
+
**Module Setup:** The component depends on the project's component registry, which resolves `TextInput` and `FieldValueList`; a deep-equality utility, for detecting a changed datasource; the project's helper for building an associated option list; and the platform APIs named in this skill. Define the input contract as an extension of the project's field input contract, adding every input in the table above together with `displayMode` and `status`. An option carries a key, which is stored, and a label, which is shown; in data-reference mode it also carries a list of rendered secondary entries, a list of raw secondary strings, and an optional group.
|
|
50
|
+
|
|
51
|
+
**Main Component Logic** — in order:
|
|
52
|
+
|
|
53
|
+
1. **Registry lookups.** Resolve `TextInput` and `FieldValueList`.
|
|
54
|
+
2. **Receive inputs,** each defaulted as documented; `value` defaults to empty text.
|
|
55
|
+
3. **Accessor set-up.** Obtain the accessor from `getPConnect()`, its context name from `getContextName()`, its actions interface from `getActionsApi()`, and the bound property name from the `value` entry of `getStateProps()`.
|
|
56
|
+
4. **Working copies.** Take working copies of `listType`, `parameters`, `datasource` (default: an empty list) and `columns` (default: an empty list). The deferred-datasource step replaces them.
|
|
57
|
+
5. **Component state.** Keep three values that survive re-rendering: the typed text, initially empty; the option list, initially empty; and the last datasource seen, initially none.
|
|
58
|
+
6. **Derived values.** The helper text to show is the validation message when there is one; otherwise the field input warning's content when the warning is shown and the field is not read-only; otherwise `helperText`. The selected label is recomputed on every render — see Behavioral Contract item 10 — and is never stored.
|
|
59
|
+
7. **Detect a changed datasource** while rendering, not in a reaction that runs after rendering: when the incoming datasource differs by deep comparison from the last one seen, remember it. That is what reloads an associated list.
|
|
60
|
+
8. **Transform a deferred datasource** — Behavioral Contract item 5.
|
|
61
|
+
9. **Add secondary and group columns, then normalise every column** — items 6 and 7.
|
|
62
|
+
10. **Load associated options** whenever the remembered datasource changes — item 8.
|
|
63
|
+
11. **Load data-page options** once, when the component is first displayed — item 9.
|
|
64
|
+
12. **Display modes,** before anything else is drawn — see Display Mode Rendering.
|
|
65
|
+
13. **Resolve the selected label** — item 10.
|
|
66
|
+
14. **Define the handlers** for selection, typing and create-new — items 11 and 12, and Create New.
|
|
67
|
+
15. **Read-only** — see Read-Only Rendering.
|
|
68
|
+
16. **Editable render** — the design system's combobox, given the options, a way to read an option's label, the selected label, the typed text, the two handlers, the filtering and option layout described under Visual Specifications, the create-new footer, grouping when present, `label`, `placeholder`, `required`, the error state, the helper text, and `testId`.
|
|
58
69
|
|
|
59
70
|
## Behavioral Contract
|
|
60
71
|
|
|
61
|
-
1. **Options
|
|
62
|
-
2. **
|
|
63
|
-
3. **Helper text
|
|
64
|
-
4. **Datasource change detection
|
|
65
|
-
5. **Deferred datasource transformation
|
|
66
|
-
-
|
|
67
|
-
- Set `
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
72
|
+
1. **Options.** Each option pairs a key, which is what gets stored, with a label, which is what the user sees.
|
|
73
|
+
2. **Typed text versus selection.** The typed text is component state and changes as the user types, without committing anything. The selected label is recomputed on every render from the options and the stored value.
|
|
74
|
+
3. **Helper text** — as described in Main Component Logic step 6.
|
|
75
|
+
4. **Datasource change detection** happens during rendering, by deep comparison, and is what triggers the associated-list reload.
|
|
76
|
+
5. **Deferred datasource transformation.** Applies only when `deferDatasource` is true and `datasourceMetadata` names a datasource. Then, on the working copies:
|
|
77
|
+
- The list type becomes `datapage`, and the datasource becomes the metadata's datasource name.
|
|
78
|
+
- Set `parameters` from the metadata's `parameters`, accepting **both** shapes it arrives in. When every entry is an object carrying a `name` and a `value`, flatten it into a map from each name to its value. Otherwise it is already a flat map from parameter name to value — use it as it is. Flattening a flat map loses every parameter and leaves a parameterised data page with nothing.
|
|
79
|
+
- Take the display and value properties from the metadata's `propertyForDisplayText` and `propertyForValue`, stripping a leading property-reference marker from each.
|
|
80
|
+
- Build `columns`. When the incoming `columns` already hold a column marked as the key — which is what the reference field sends — keep every incoming column, so that its hidden composite-key columns and their set-property targets survive. Otherwise build a two-entry list: a key column for the value property whose set-property target is `Associated property`, and a display column for the display property that is primary and usable for search.
|
|
81
|
+
6. **Secondary and group columns:** For each `columnsFormatter` descriptor carrying a value, add a displayed, searchable, secondary column named by that value with its marker and leading separator removed. For each `groupsFields` descriptor, add a hidden, non-searchable column for its property unless one is already present, so the data page returns it.
|
|
82
|
+
7. **Column normalisation:** Remove a leading separator from every column's value.
|
|
83
|
+
8. **Associated options:** When the list type is `associated`, build the options with the project's associated-list helper from the current data, and rebuild them whenever the remembered datasource changes.
|
|
84
|
+
9. **Data-page options:** Loaded once, when the component is first displayed, and skipped when `displayMode` is set or the list type is `associated`. Call `PCore.getDataApiUtils().getData(dataPageName, payload, contextName)`, where the payload carries the parameters under `dataViewParameters` and is omitted when there are none. The rows are at the response's `data.data`. Build one option per row, as follows.
|
|
85
|
+
- **Key:** the row's value for the key column, falling back to its `pyGUID`.
|
|
86
|
+
- **Label:** the row's value for the primary column, as text. This is what the input shows and what filtering matches first.
|
|
87
|
+
- **Secondary entries:** when `columnsFormatter` is present, one entry per descriptor, rendered from the row. For each descriptor, create a temporary accessor with `PCore.createPConnect(...)`, giving it the descriptor as its metadata with its configuration extended by a display-only display mode, the current context name and the `inline-compact` variant, and the row as its custom context. Resolve that accessor's configuration and render the registry component named by the descriptor's own `type`, in display-only mode, with the resolved configuration. This is how an amount appears as `$777.33` and a label as `Amount:`. If creation or rendering fails, fall back to the row's raw value. When `hideFieldLabels` is true, show values without their labels. Without `columnsFormatter`, the secondary entries are the row's values for the other displayed columns.
|
|
88
|
+
- **Raw secondary text:** the row's raw values for those same descriptors, kept for filtering.
|
|
89
|
+
- **Group:** when `groupsFields` is present, the row's value for the first group property. Sort the options by group so that each group is contiguous.
|
|
90
|
+
10. **Selected label:** On every render, find the option whose key equals the stored value. The selected label is that option's label, or the stored value itself when no option matches.
|
|
91
|
+
11. **On selection change:**
|
|
92
|
+
- Extract the key from the selected option (or empty string if cleared, clearing the typed text as well).
|
|
93
|
+
- Write it with `getPConnect().getActionsApi().updateFieldValue(propertyName, key)`, then trigger the change with `triggerFieldChange(propertyName, key)` on the same actions interface.
|
|
94
|
+
- For every other column carrying a set-property target, write the chosen row's value for that column into the target: update the target's value with this field as its associated property, then trigger the change on the target.
|
|
95
|
+
- Once the triggered change settles, call `onRecordChange` — if provided — with the event extended by the key as its `id`.
|
|
96
|
+
12. **On typing:** Update the typed text only. Nothing is committed to the case.
|
|
97
|
+
13. **Read-only:** Find the option whose key equals the stored value, and delegate to `TextInput` with that option's label as its value.
|
|
98
|
+
|
|
99
|
+
### Create New
|
|
100
|
+
|
|
101
|
+
Show the create-new action when `allowCreatingRecords` is true: a divider and then a full-width action at the foot of the option popup, captioned `createNewLabel`, which must not close the popup or steal focus before its own activation runs. On activation:
|
|
102
|
+
|
|
103
|
+
1. If `onCreateNew` is supplied, call it and stop.
|
|
104
|
+
2. Otherwise start creation: call `createNewRecord` when supplied. Without it, open `showDataObjectCreateView(contextClass)` for a data reference, or call `createWork(contextClass, ...)` with the case view closed after creation for a case reference, both on the actions interface.
|
|
105
|
+
3. Once creation has started, re-fetch the options, and subscribe — keyed by the class — to the data-object-created event for a data reference, or the create-stage-done case event for a case reference, both read from `PCore.getConstants().PUB_SUB_EVENTS`.
|
|
106
|
+
4. When the event arrives for this class: clear the contexted data cache with `PCore.getDataApi().clearContextedCache(contextName)`; find the new record — for data, the response data carried by the event; for a case, by re-fetching the options and matching the created identifier; write every set-property column from it, the key going to this field; call `onRecordChange` with the new key as its `id`; re-fetch the options; and unsubscribe.
|
|
107
|
+
|
|
108
|
+
## Helper Logic
|
|
109
|
+
|
|
110
|
+
Three small pieces of logic, independent of any design system. Keep each separate from the component so it can be reasoned about on its own.
|
|
111
|
+
|
|
112
|
+
**Column normalisation.** Produce a new column list in which each column's value has its leading separator removed. Values without one are left unchanged.
|
|
113
|
+
|
|
114
|
+
**Display-field extraction.** From a column list, find the key column — the first whose key flag is the string `true` — and the displayed columns — those whose display flag is the string `true`. The key property is the key column's value, or `auto` when there is no key column. Among the displayed columns, the one whose primary flag is the string `true` gives the primary property, and each of the others adds a secondary property, in order. The result is one key property, one primary property, and an ordered list of secondary properties.
|
|
115
|
+
|
|
116
|
+
**Parameter flattening.** When parameters arrive as entries that each carry a `name` and a `value`, produce a map from each name to its value. A map that is already flat is returned unchanged.
|
|
99
117
|
|
|
100
118
|
## Display Mode Rendering
|
|
101
119
|
|
|
@@ -108,41 +126,40 @@ Resolve the display label from options and delegate to `TextInput` with the reso
|
|
|
108
126
|
|
|
109
127
|
## Visual Specifications
|
|
110
128
|
|
|
111
|
-
| Property
|
|
112
|
-
|
|
|
113
|
-
| Width
|
|
114
|
-
| Size
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
| Placeholder | From the `placeholder` input |
|
|
129
|
+
| Property | Value |
|
|
130
|
+
| ----------- | ---------------------------------------------------------------------- |
|
|
131
|
+
| Width | The full width of its container |
|
|
132
|
+
| Size | The design system's compact field size |
|
|
133
|
+
| Popup | Opens below the input and lists the filtered options |
|
|
134
|
+
| Input | Combobox pattern — typing filters; the open control shows every option |
|
|
135
|
+
| Error state | The design system's error treatment on the border and the helper text |
|
|
136
|
+
| Label | The design system's standard field label |
|
|
137
|
+
| Placeholder | From the `placeholder` input |
|
|
121
138
|
|
|
122
139
|
**Autocomplete behavior:**
|
|
123
140
|
|
|
124
|
-
- The
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
141
|
+
- The input shows the typed text while the user is typing, and the selected label otherwise.
|
|
142
|
+
- An option's label is read from its label entry, and two options are the same option when their labels match.
|
|
143
|
+
- Filtering matches the typed text against the option's label joined with all of its raw secondary text.
|
|
144
|
+
- Each option shows its label on the first line and, when present, its secondary entries on a wrapped second line, separated by a middle dot.
|
|
145
|
+
- Grouped options appear under their group's heading.
|
|
146
|
+
- The create-new action, when shown, sits below the options behind a divider.
|
|
128
147
|
|
|
129
148
|
## Edge Cases & Special Logic
|
|
130
149
|
|
|
131
|
-
-
|
|
132
|
-
- When
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
- **
|
|
150
|
+
- The input shows the typed text while the user is typing, and the selected label once a selection has been made and nothing is typed.
|
|
151
|
+
- When the stored value is a key not yet among the options — for instance while they are still loading — show the stored value itself.
|
|
152
|
+
- The key is stored; the label is shown.
|
|
153
|
+
- The data page is always queried in the current context, taken from the accessor's context name.
|
|
154
|
+
- **Order matters:** display modes, then the selected label, then the handlers, then read-only, then the editable render. Do not reorder.
|
|
136
155
|
|
|
137
156
|
## Dependencies
|
|
138
157
|
|
|
139
|
-
- A deep-equality utility
|
|
140
|
-
- The project's
|
|
141
|
-
- The
|
|
142
|
-
- The project's
|
|
143
|
-
-
|
|
144
|
-
- The project's component registry, resolving `FieldValueList` — for display modes.
|
|
145
|
-
- A typeahead/autocomplete UI widget from the design system.
|
|
158
|
+
- A deep-equality utility, for datasource change detection.
|
|
159
|
+
- The project's associated-list helper.
|
|
160
|
+
- The platform APIs named in this skill: `PCore.getDataApiUtils().getData`, `PCore.createPConnect`, the accessor's actions interface, and the publish/subscribe utilities.
|
|
161
|
+
- The project's component registry, resolving `TextInput` for read-only rendering, `FieldValueList` for display modes, and the type of every secondary descriptor.
|
|
162
|
+
- A combobox control from the design system, or one built to the pattern described under Design System Mapping.
|
|
146
163
|
|
|
147
164
|
## Design System Mapping
|
|
148
165
|
|
|
@@ -150,8 +167,23 @@ Resolve the display label from options and delegate to `TextInput` with the reso
|
|
|
150
167
|
|
|
151
168
|
When implementing in a specific design system, map the following:
|
|
152
169
|
|
|
153
|
-
- **Autocomplete** →
|
|
154
|
-
- **Option format** →
|
|
155
|
-
- **Read-only mode** → resolve the
|
|
156
|
-
- **Error state** → the
|
|
157
|
-
- **Combobox behavior** →
|
|
170
|
+
- **Autocomplete** → the design system's combobox or autocomplete, with option filtering
|
|
171
|
+
- **Option format** → the option's key is stored and its label is displayed
|
|
172
|
+
- **Read-only mode** → resolve the label and delegate to `TextInput`
|
|
173
|
+
- **Error state** → the design system's error or danger treatment
|
|
174
|
+
- **Combobox behavior** → this component controls both the selected option and the typed text
|
|
175
|
+
- **Rich options** → the design system's option slot, so each option can hold a label line and a secondary line
|
|
176
|
+
- **Create new** → a footer slot inside the option popup
|
|
177
|
+
|
|
178
|
+
**When the design system has no combobox,** build one to the accessible combobox pattern: a text input that owns a popup list box, opens on click and on the arrow keys, moves the active option with the arrow keys, selects with Enter, closes with Escape, and reports the expanded state and the active option to assistive technology. **Never use a native data-list element.** It cannot show a secondary line or a footer action, does not open reliably on click, and merges options that share a label.
|
|
179
|
+
|
|
180
|
+
## Generation Self-Check
|
|
181
|
+
|
|
182
|
+
- Options load from `PCore.getDataApiUtils().getData(...)` and their rows are read from `data.data`.
|
|
183
|
+
- Every option has a non-empty label taken from the primary column; none is built from a resolved property value.
|
|
184
|
+
- `columnsFormatter` and `groupsFields` are read from the raw configuration, and secondary entries are rendered by each descriptor's own type in display-only mode.
|
|
185
|
+
- Parameters reach the data page whichever shape they arrived in.
|
|
186
|
+
- Incoming key and composite-key columns survive the deferred-datasource transformation, and selection writes every set-property target.
|
|
187
|
+
- Selection updates the value, triggers the field change, and only then calls `onRecordChange` with the key as `id`.
|
|
188
|
+
- The create-new action appears only when `allowCreatingRecords` is true, and a created record becomes the selection.
|
|
189
|
+
- No native data-list element is used.
|