@genesislcap/ai-assistant 15.69.0 → 15.71.0-FUI-2650.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/ai-assistant.api.json +97 -0
  2. package/dist/ai-assistant.d.ts +65 -0
  3. package/dist/chat-driver.cjs +18031 -0
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +18024 -0
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +5524 -2684
  8. package/dist/dts/chat-driver-node.d.ts +2 -0
  9. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  10. package/dist/dts/code-review/code-review.types.d.ts +76 -0
  11. package/dist/dts/code-review/code-review.types.d.ts.map +1 -0
  12. package/dist/dts/code-review/code-reviewer.agent.d.ts +77 -0
  13. package/dist/dts/code-review/code-reviewer.agent.d.ts.map +1 -0
  14. package/dist/dts/code-review/code-reviewer.prompt.d.ts +23 -0
  15. package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +1 -0
  16. package/dist/dts/code-review/gate.d.ts +44 -0
  17. package/dist/dts/code-review/gate.d.ts.map +1 -0
  18. package/dist/dts/code-review/index.d.ts +27 -0
  19. package/dist/dts/code-review/index.d.ts.map +1 -0
  20. package/dist/dts/code-review/review-changes.d.ts +70 -0
  21. package/dist/dts/code-review/review-changes.d.ts.map +1 -0
  22. package/dist/dts/code-review/rules/context-trigger-map.d.ts +6 -0
  23. package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +1 -0
  24. package/dist/dts/code-review/rules/context.registry.d.ts +123 -0
  25. package/dist/dts/code-review/rules/context.registry.d.ts.map +1 -0
  26. package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +13 -0
  27. package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +1 -0
  28. package/dist/dts/code-review/rules/fui-blotter.d.ts +16 -0
  29. package/dist/dts/code-review/rules/fui-blotter.d.ts.map +1 -0
  30. package/dist/dts/code-review/rules/fui-chart.d.ts +20 -0
  31. package/dist/dts/code-review/rules/fui-chart.d.ts.map +1 -0
  32. package/dist/dts/code-review/rules/fui-column-defs.d.ts +21 -0
  33. package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +1 -0
  34. package/dist/dts/code-review/rules/fui-components.d.ts +9 -0
  35. package/dist/dts/code-review/rules/fui-components.d.ts.map +1 -0
  36. package/dist/dts/code-review/rules/fui-criteria.d.ts +32 -0
  37. package/dist/dts/code-review/rules/fui-criteria.d.ts.map +1 -0
  38. package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +15 -0
  39. package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +1 -0
  40. package/dist/dts/code-review/rules/fui-dashboard.d.ts +19 -0
  41. package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +1 -0
  42. package/dist/dts/code-review/rules/fui-dialogs.d.ts +19 -0
  43. package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +1 -0
  44. package/dist/dts/code-review/rules/fui-entity-management.d.ts +19 -0
  45. package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +1 -0
  46. package/dist/dts/code-review/rules/fui-error-boundary.d.ts +9 -0
  47. package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +1 -0
  48. package/dist/dts/code-review/rules/fui-eventing.d.ts +8 -0
  49. package/dist/dts/code-review/rules/fui-eventing.d.ts.map +1 -0
  50. package/dist/dts/code-review/rules/fui-flexlayout.d.ts +17 -0
  51. package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +1 -0
  52. package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +10 -0
  53. package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +1 -0
  54. package/dist/dts/code-review/rules/fui-form-component.d.ts +9 -0
  55. package/dist/dts/code-review/rules/fui-form-component.d.ts.map +1 -0
  56. package/dist/dts/code-review/rules/fui-formatters.d.ts +12 -0
  57. package/dist/dts/code-review/rules/fui-formatters.d.ts.map +1 -0
  58. package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +10 -0
  59. package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +1 -0
  60. package/dist/dts/code-review/rules/fui-global-filters.d.ts +33 -0
  61. package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +1 -0
  62. package/dist/dts/code-review/rules/fui-import-surface.d.ts +37 -0
  63. package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +1 -0
  64. package/dist/dts/code-review/rules/fui-inline-editing.d.ts +10 -0
  65. package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +1 -0
  66. package/dist/dts/code-review/rules/fui-layout.d.ts +7 -0
  67. package/dist/dts/code-review/rules/fui-layout.d.ts.map +1 -0
  68. package/dist/dts/code-review/rules/fui-notifications.d.ts +12 -0
  69. package/dist/dts/code-review/rules/fui-notifications.d.ts.map +1 -0
  70. package/dist/dts/code-review/rules/fui-primitives.d.ts +26 -0
  71. package/dist/dts/code-review/rules/fui-primitives.d.ts.map +1 -0
  72. package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +18 -0
  73. package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +1 -0
  74. package/dist/dts/code-review/rules/fui-redux-store.d.ts +8 -0
  75. package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +1 -0
  76. package/dist/dts/code-review/rules/fui-reporting.d.ts +19 -0
  77. package/dist/dts/code-review/rules/fui-reporting.d.ts.map +1 -0
  78. package/dist/dts/code-review/rules/fui-styling.d.ts +15 -0
  79. package/dist/dts/code-review/rules/fui-styling.d.ts.map +1 -0
  80. package/dist/dts/code-review/rules/fui-trade-form.d.ts +13 -0
  81. package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +1 -0
  82. package/dist/dts/code-review/submit-code-review.tool.d.ts +12 -0
  83. package/dist/dts/code-review/submit-code-review.tool.d.ts.map +1 -0
  84. package/dist/dts/code-review/unified-diff.d.ts +7 -0
  85. package/dist/dts/code-review/unified-diff.d.ts.map +1 -0
  86. package/dist/dts/code-review/verdict.d.ts +23 -0
  87. package/dist/dts/code-review/verdict.d.ts.map +1 -0
  88. package/dist/dts/components/code-review-result/code-review-result.d.ts +26 -0
  89. package/dist/dts/components/code-review-result/code-review-result.d.ts.map +1 -0
  90. package/dist/dts/index.d.ts +1 -0
  91. package/dist/dts/index.d.ts.map +1 -1
  92. package/dist/dts/react.d.ts +20 -10
  93. package/dist/esm/chat-driver-node.js +6 -0
  94. package/dist/esm/code-review/code-review.types.js +6 -0
  95. package/dist/esm/code-review/code-reviewer.agent.js +167 -0
  96. package/dist/esm/code-review/code-reviewer.prompt.js +103 -0
  97. package/dist/esm/code-review/gate.js +93 -0
  98. package/dist/esm/code-review/index.js +28 -0
  99. package/dist/esm/code-review/review-changes.js +123 -0
  100. package/dist/esm/code-review/rules/context-trigger-map.js +20 -0
  101. package/dist/esm/code-review/rules/context.registry.js +772 -0
  102. package/dist/esm/code-review/rules/fui-ai-extensions.js +306 -0
  103. package/dist/esm/code-review/rules/fui-blotter.js +596 -0
  104. package/dist/esm/code-review/rules/fui-chart.js +669 -0
  105. package/dist/esm/code-review/rules/fui-column-defs.js +862 -0
  106. package/dist/esm/code-review/rules/fui-components.js +245 -0
  107. package/dist/esm/code-review/rules/fui-criteria.js +538 -0
  108. package/dist/esm/code-review/rules/fui-custom-renderer.js +612 -0
  109. package/dist/esm/code-review/rules/fui-dashboard.js +604 -0
  110. package/dist/esm/code-review/rules/fui-dialogs.js +588 -0
  111. package/dist/esm/code-review/rules/fui-entity-management.js +1014 -0
  112. package/dist/esm/code-review/rules/fui-error-boundary.js +244 -0
  113. package/dist/esm/code-review/rules/fui-eventing.js +628 -0
  114. package/dist/esm/code-review/rules/fui-flexlayout.js +860 -0
  115. package/dist/esm/code-review/rules/fui-flyout-panel.js +432 -0
  116. package/dist/esm/code-review/rules/fui-form-component.js +898 -0
  117. package/dist/esm/code-review/rules/fui-formatters.js +415 -0
  118. package/dist/esm/code-review/rules/fui-foundation-comms.js +518 -0
  119. package/dist/esm/code-review/rules/fui-global-filters.js +778 -0
  120. package/dist/esm/code-review/rules/fui-import-surface.js +452 -0
  121. package/dist/esm/code-review/rules/fui-inline-editing.js +445 -0
  122. package/dist/esm/code-review/rules/fui-layout.js +431 -0
  123. package/dist/esm/code-review/rules/fui-notifications.js +439 -0
  124. package/dist/esm/code-review/rules/fui-primitives.js +1216 -0
  125. package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +650 -0
  126. package/dist/esm/code-review/rules/fui-redux-store.js +522 -0
  127. package/dist/esm/code-review/rules/fui-reporting.js +506 -0
  128. package/dist/esm/code-review/rules/fui-styling.js +1229 -0
  129. package/dist/esm/code-review/rules/fui-trade-form.js +618 -0
  130. package/dist/esm/code-review/submit-code-review.tool.js +43 -0
  131. package/dist/esm/code-review/unified-diff.js +96 -0
  132. package/dist/esm/code-review/verdict.js +24 -0
  133. package/dist/esm/components/code-review-result/code-review-result.js +89 -0
  134. package/dist/esm/index.js +3 -0
  135. package/dist/react.cjs +25 -18
  136. package/dist/react.mjs +23 -17
  137. package/docs/code-review.md +137 -0
  138. package/package.json +24 -17
  139. package/scripts/smoke-chat-driver-node.mjs +15 -0
@@ -0,0 +1,1014 @@
1
+ /**
2
+ * Context: EntityManagement, SmartFormModal, List — full CRUD grid from
3
+ * @genesislcap/foundation-entity-management/react
4
+ *
5
+ * Sources verified against:
6
+ * - dist/dts/react.d.ts (exported component signatures + on* events)
7
+ * - dist/dts/types.d.ts (enums: CrudMenuPosition, CrudAction, ModalFormType, ActionsMenuStyle)
8
+ * - dist/dts/entities/entities.d.ts (full @attr / @observable props)
9
+ * - dist/dts/entities/smartFormModal.d.ts (SmartFormModal extends EntityManagement)
10
+ * - dist/dts/list/list.d.ts (List props + events incl. onCustomAction)
11
+ * - Showcase React pages: Admin/components/AdminCounterpartyEm.tsx,
12
+ * AdminEntityManagementFilters.tsx, AdminEntityManagementSSMR.tsx,
13
+ * AdminEntityManagementSSMRColumnActions.tsx, AdminEntityManagementSlotTest.tsx
14
+ * - blank-app-seed/.genx/templates/react/entityManager.hbs
15
+ */
16
+ export const FUI_ENTITY_MANAGEMENT_DEPS = ['fui-column-defs', 'fui-form-component'];
17
+ export const FUI_ENTITY_MANAGEMENT_TAGS = [
18
+ 'entity management',
19
+ 'EntityManagement',
20
+ 'SmartFormModal',
21
+ 'List',
22
+ 'crud',
23
+ 'create update delete',
24
+ 'manage entities',
25
+ 'entity manager',
26
+ 'entity grid',
27
+ 'foundation-entity-management',
28
+ 'resourceName',
29
+ 'createEvent',
30
+ 'updateEvent',
31
+ 'deleteEvent',
32
+ 'customActions',
33
+ 'custom action form',
34
+ 'custom event form',
35
+ 'action form layout',
36
+ 'edit form layout',
37
+ 'two column form',
38
+ 'restructure form',
39
+ 'EventsConfig',
40
+ 'entityLabel',
41
+ 'modalPosition',
42
+ 'crudMenuPosition',
43
+ 'button',
44
+ 'toolbar',
45
+ 'toolbar button',
46
+ 'add button',
47
+ 'grid button',
48
+ 'button above the grid',
49
+ 'action above the grid',
50
+ 'action strip',
51
+ 'enableSearchBar',
52
+ 'enableFilters',
53
+ 'datasourceConfig',
54
+ 'CrudAction',
55
+ 'CrudMenuPosition',
56
+ 'ActionsMenuStyle',
57
+ 'add edit delete rows',
58
+ 'crud grid',
59
+ 'management screen',
60
+ ];
61
+ export const FUI_ENTITY_MANAGEMENT_CONTEXT = `
62
+ ## EntityManagement — Full CRUD Grid
63
+
64
+ **Import (component):** \`@genesislcap/foundation-entity-management/react\`
65
+ **Import (types/enums):** \`@genesislcap/foundation-entity-management\`
66
+
67
+ **Read react.d.ts BEFORE use:** VFS key \`@genesislcap/foundation-entity-management/react.d.ts\`
68
+ **Read types.d.ts for complex props:** VFS key \`@genesislcap/foundation-entity-management/types.d.ts\`
69
+
70
+ > **Check server resource names first.** EntityManagement behaviour varies heavily with server-side
71
+ > configuration (CRUD event names, resource names, modal position, custom actions).
72
+ > Use \`query_project_schema('entities')\` / \`('queries')\` to verify the \`resourceName\` before writing
73
+ > JSX — it can be an entity, a view, or a query, so check what actually exists rather than assuming.
74
+ > Event names (\`createEvent\`/\`updateEvent\`/\`deleteEvent\`/custom-action events) come from
75
+ > \`query_project_schema('events')\` or your PLAN SPEC — never invent one. An empty \`events\` list
76
+ > under \`answeredFrom: 'config'\` means UNKNOWN, not zero.
77
+
78
+ ---
79
+
80
+ ### Basic usage
81
+
82
+ \`\`\`tsx
83
+ import { EntityManagement } from '@genesislcap/foundation-entity-management/react';
84
+ import type { CustomAction } from '@genesislcap/foundation-entity-management';
85
+ import type { ColDef } from '@ag-grid-community/core';
86
+ import type { UiSchema } from '@genesislcap/foundation-forms';
87
+
88
+ const columns: ColDef[] = [
89
+ { field: 'TRADE_ID', headerName: 'Trade ID' },
90
+ { field: 'INSTRUMENT', headerName: 'Instrument' },
91
+ { field: 'QUANTITY', headerName: 'Quantity' },
92
+ { field: 'PRICE', headerName: 'Price' },
93
+ { field: 'SIDE', headerName: 'Side' },
94
+ ];
95
+
96
+ const createFormSchema: UiSchema = {
97
+ type: 'VerticalLayout',
98
+ elements: [
99
+ { type: 'Control', scope: '#/properties/INSTRUMENT', label: 'Instrument' },
100
+ { type: 'Control', scope: '#/properties/QUANTITY', label: 'Quantity' },
101
+ { type: 'Control', scope: '#/properties/PRICE', label: 'Price' },
102
+ { type: 'Control', scope: '#/properties/SIDE', label: 'Side' },
103
+ ],
104
+ };
105
+
106
+ // Minimal — create/update/delete with built-in modal form auto-generated from event schema
107
+ <EntityManagement
108
+ resourceName="ALL_TRADES"
109
+ createEvent="EVENT_TRADE_INSERT"
110
+ updateEvent="EVENT_TRADE_MODIFY"
111
+ deleteEvent="EVENT_TRADE_DELETE"
112
+ entityLabel="Trade"
113
+ columns={columns}
114
+ modalPosition="centre"
115
+ enableRowFlashing
116
+ enableCellFlashing
117
+ />
118
+ \`\`\`
119
+
120
+ ---
121
+
122
+ ### A button above the grid is a \`customActions\` entry — never a wrapper div
123
+
124
+ This is the canonical rule for the whole corpus. Every other module that mentions a toolbar, an
125
+ action strip, or a button above a grid points here rather than restating it.
126
+
127
+ \`EntityManagement\` renders its own toolbar. A \`CustomAction\` with \`position: CrudMenuPosition.Top\`
128
+ puts a themed, correctly-spaced button in it — so there is no wrapper \`<div>\` to create, no
129
+ \`justify-content\` to choose, no \`flex: 1\` / \`minHeight: 0\` chain to get right, and no way for the
130
+ grid to collapse because a new sibling refused to shrink:
131
+
132
+ \`\`\`tsx
133
+ import { EntityManagement } from '@genesislcap/foundation-entity-management/react';
134
+ import { CrudMenuPosition, type CustomAction } from '@genesislcap/foundation-entity-management';
135
+
136
+ const customActions: CustomAction[] = [{
137
+ name: 'Add RFQ',
138
+ position: CrudMenuPosition.Top, // the toolbar, ABOVE the rows
139
+ requiresSelection: false, // this button is not tied to a selected row
140
+ appearance: 'primary',
141
+ icon: 'plus',
142
+ action: { type: 'callback', callback: () => actions.createRfqModal.openBlank() },
143
+ }];
144
+
145
+ <EntityManagement resourceName="RFQ_VIEW_QUERY" columns={columnDefs}
146
+ customActions={customActions} style={{ height: '100%' }} />
147
+ \`\`\`
148
+
149
+ **\`position\` is optional and its default is NOT the toolbar.** A \`{ name, action }\` object literal
150
+ with no \`position\` renders a PER-ROW action, not the button you meant — the platform resolves it as
151
+ \`action.position || CrudMenuPosition.Column\`. Write \`position: CrudMenuPosition.Top\` explicitly for
152
+ anything that belongs above the rows. The full enum is \`Column | Top | Bottom | Action | None\`.
153
+
154
+ Four tiers, in order. Go down one only when the tier above genuinely cannot express what you need:
155
+
156
+ 1. **A dedicated prop**, when one exists for that exact action — \`createEvent\` + \`createLabel\` for
157
+ create, \`updateEvent\`, \`deleteEvent\`, \`enableCsvExport\`, \`enableFilters\`, \`enableSearchBar\`.
158
+ The platform draws the button, its icon, its modal and its event commit.
159
+ 2. **A \`customActions\` entry at \`CrudMenuPosition.Top\`** — for ANY button that acts on the data or
160
+ on the grid: "Add RFQ" opening your own modal, Refresh, Respond, a custom export, a bulk action.
161
+ You supply a name and a callback; EntityManagement places it in its own toolbar and gives it the
162
+ theme, the spacing, the alignment with the CRUD buttons, the icon slot and the
163
+ selection/disabled gating for free. **This is the answer for almost every button you will be
164
+ asked for.**
165
+ 3. **A slot** — \`before-header\` or \`after-header\` — when the thing is genuinely NOT an action
166
+ button: an inline filter strip, a legend, a status line, a count. Slotted content lands INSIDE
167
+ the grid's own \`header-container\` flex row, so it shares the baseline, the gap and the
168
+ alignment with everything else in that row. A \`customActions\` button renders in the same row,
169
+ at the trailing edge, which is why the two compose.
170
+ 4. **Your own element above \`<EntityManagement>\`** — last resort, and only when the thing is not
171
+ the grid's concern at all: a page heading, a KPI strip spanning several tiles, or a toolbar over
172
+ a grid that is NOT an EntityManagement (a standalone RapidGridPro has no \`customActions\` API).
173
+ This is the only tier that costs you a wrapper, a flex chain and a \`minHeight: 0\`, and it is
174
+ the tier that collapses the grid when you get them wrong.
175
+
176
+ **A Top custom action that CREATES the entity replaces the built-in create button — so turn the
177
+ built-in one off.** \`createEvent\` is what draws it. Leave the prop set and add
178
+ \`{ name: 'Add RFQ', position: CrudMenuPosition.Top }\` and the toolbar shows TWO Add buttons opening
179
+ two different create forms: yours, and the platform's built-in modal. Switching from a hand-rolled
180
+ \`<Button>\` to a custom action does not fix this by itself — it is the same duplicate, moved.
181
+
182
+ \`\`\`tsx
183
+ // WRONG — two Add buttons. createEvent still draws the built-in one.
184
+ <EntityManagement createEvent="EVENT_RFQ_INSERT" customActions={[addRfqAtTop]} … />
185
+
186
+ // CORRECT — one trigger. Drop createEvent so only your action renders.
187
+ <EntityManagement updateEvent="EVENT_RFQ_MODIFY" deleteEvent="EVENT_RFQ_DELETE"
188
+ customActions={[addRfqAtTop]} … />
189
+ \`\`\`
190
+
191
+ Drop \`createEvent\` (and the now-unused \`createFormUiSchema\` with it) — do NOT set it to
192
+ \`undefined\` behind a permission ternary and consider it handled: \`createEvent={canUpdate ? 'EVENT_RFQ_INSERT' : undefined}\`
193
+ still renders the built-in button for every user who HAS the permission, which is the case you are
194
+ looking at. \`updateEvent\` and \`deleteEvent\` are unaffected; only the create affordance is being
195
+ replaced. And if the built-in create modal CAN do the job, the reverse is the better trade: keep
196
+ \`createEvent\`, shape it with \`createFormUiSchema\`, rename it with \`createLabel\`, and write no
197
+ custom action at all.
198
+
199
+ **The one-line test: would this button be meaningless if the grid were not on the page?**
200
+ Yes → it is a grid action, so it goes in \`customActions\`. No → it is a page or panel element, and a
201
+ hand-rolled strip is correct.
202
+
203
+ Hand-rolling stays right for exactly these: a standalone \`RapidGridPro\`/ag-grid (it has no
204
+ \`customActions\` API at all); a page-level filter row or global filter bar; a heading or KPI strip; a
205
+ trigger that opens a Flyout or navigates rather than acting on the grid; an action that belongs on
206
+ the FlexLayout **tab strip** (use \`onRenderTabSet\` — \`CrudMenuPosition.Top\` cannot reach the tab
207
+ header); and a per-row or per-cell control (that is \`CrudMenuPosition.Column\`, or a
208
+ \`GridProRendererTypes.action\` column — not \`Top\`).
209
+
210
+ MEASURED (fi-portal, 2026-09-02): asked for an "Add RFQ" button above the blotter, the agent wrote a
211
+ wrapper \`<div>\` with its own \`<Button>\`, then spent the rest of the step repairing the flex chain it
212
+ had just created — the grid collapsed because the new sibling would not shrink. The
213
+ \`CrudMenuPosition.Top\` version has none of those failure modes, because there is no sibling.
214
+
215
+ ---
216
+
217
+ ### Full-featured usage with filters, search, and custom actions
218
+
219
+ On an \`EntityManagement\` grid, add row/toolbar actions with the \`customActions\` prop — not a
220
+ hand-rolled action column (\`GridProRendererTypes.action\`) or DOM buttons bridged through window
221
+ events. \`customActions\` gives you selection handling, the confirm flow, the modal form and the
222
+ event commit for free; action-column renderers are for standalone \`RapidGridPro\` grids
223
+ (see fui-column-defs).
224
+
225
+ **The built-in form is OPTIONAL — the action is not.** \`action\` is a union: \`type: 'event'\`
226
+ uses the framework's own popup (one schema, one event), and \`type: 'callback'\` hands you
227
+ \`(rowData) => void\` to do anything, including opening a modal you built yourself. When a request
228
+ needs something the built-in popup cannot express — a read-only summary block above the fields,
229
+ two or three buttons each firing a DIFFERENT event, a layout of your own — switch that ONE action
230
+ to \`type: 'callback'\` and open your modal from it. **Do not delete the custom action and replace
231
+ it with a hand-rolled row button**: you would be discarding the selection handling, the icon, the
232
+ positioning and the \`disabled\` gating to solve a problem that only concerned the form.
233
+
234
+ *This is a real failure, not a hypothetical.* Asked for a Respond modal with a summary and three
235
+ buttons, the agent reasoned "the built-in popup can only show schema fields and submit to one
236
+ event" — correct — and then removed the custom action too, hand-rolling a row button. The user's
237
+ reply was "we already had a placeholder for custom action, why did you change it to a button?".
238
+ Replace the form; keep the trigger.
239
+
240
+ **\`createEvent\` RENDERS THE ADD BUTTON — it is not just server wiring.** The prop table below
241
+ calls it "server event handler for create", which reads like plumbing; it is also the thing that
242
+ puts the button on screen. \`entities.template.ts\` renders the create button under
243
+ \`when(x => x.createEvent, …)\`, with a \`plus\` icon, the label from \`createLabel\` (falling back
244
+ to \`Add {entityLabel}\`), \`appearance="neutral"\`, and a click that opens the create modal. Set
245
+ the prop and you get all of it:
246
+
247
+ \`\`\`tsx
248
+ <EntityManagement resourceName="RFQ_VIEW_QUERY" createEvent="EVENT_RFQ_INSERT" createLabel="New RFQ" … />
249
+ \`\`\`
250
+
251
+ So NEVER hand-roll an "Add X" / "+ New X" button beside an EntityManagement grid just to get a
252
+ button — that trades the built-in modal, the validation and the event commit for an \`onClick\` you
253
+ then have to write.
254
+
255
+ There is ONE case where your own create flow is right: when the create genuinely cannot be
256
+ expressed by the built-in form — it prefills from the current selection, or it has several modes.
257
+ Then the screen owns creation, and you must **drop \`createEvent\`** so the built-in button stops
258
+ rendering. MEASURED (fi-portal, 2026-09-02): asked for a Create RFQ modal that prefills from the
259
+ selected axe, the agent added its own \`<Button>Add RFQ</Button>\` and left
260
+ \`createEvent={canUpdate ? 'EVENT_RFQ_INSERT' : undefined}\` in place, so the running app showed
261
+ "Add RFQ" next to "Add Rfq" — two buttons opening two different forms that write the same event.
262
+ Keeping both is always wrong. Pick one:
263
+
264
+ Decide with the list below, not by feel. The built-in create form renders ONE schema, from a blank
265
+ record, opened from ONE place. So it CANNOT do the job if any of these is true — and if you are
266
+ building a custom modal at all, at least one of them already is:
267
+
268
+ - the create is prefilled from the selected row or from anything else on screen;
269
+ - there is more than one entry point (a row button AND a toolbar button opening the same form);
270
+ - a field must be present but not editable (a hidden id carried through to the payload);
271
+ - the field SET changes by mode (one shape from a grid row, another from the toolbar);
272
+ - a field is a connected lookup driven by another field's value.
273
+
274
+ MEASURED (fi-portal, step "Create RFQ modal", 2026-09-02): asked for a modal reachable from BOTH
275
+ the bid/ask price cells and an "Add RFQ" button above the blotter, with a hidden Axe ID and two
276
+ connected dropdowns, the agent kept \`createEvent\` and merely renamed the built-in button with
277
+ \`createLabel="+ New RFQ"\`. The custom modal was rendered but reachable only from the price cells;
278
+ the toolbar button opened the BUILT-IN form instead, so half the requested feature was dead. Every
279
+ one of the five conditions above was true for that task.
280
+
281
+ - built-in modal can do it (none of the above) -> keep \`createEvent\`, add \`createFormUiSchema\`
282
+ to control the fields, and render NO button of your own;
283
+ - it genuinely cannot -> omit \`createEvent\` so the built-in button stops rendering, and put the
284
+ trigger back as a TOOLBAR custom action, not a hand-rolled \`<Button>\`:
285
+
286
+ \`\`\`ts
287
+ {
288
+ name: 'Add RFQ',
289
+ action: { type: 'callback', callback: () => actions.createRfqModal.open({ mode: 'add' }) },
290
+ position: CrudMenuPosition.Top,
291
+ icon: 'plus',
292
+ requiresSelection: false,
293
+ }
294
+ \`\`\`
295
+
296
+ That is the same rule as for row actions one section up — **replace the form; keep the trigger** —
297
+ applied to create. A raw \`<Button>\` in your own toolbar div throws away the positioning, the icon
298
+ and the \`disabled\` gating to solve a problem that only ever concerned the form.
299
+ (\`createLabel\` also suppresses the plus icon, so \`createLabel="+ New RFQ"\` is how you keep a
300
+ literal plus in the text.) The button carries \`part="create-button"\` with
301
+ \`exportparts="control: create-button-control, …"\`, so restyle it from your stylesheet with
302
+ \`rapid-entity-management::part(create-button)\` rather than replacing it.
303
+
304
+ **Omitting \`createFormUiSchema\` is what makes the built-in modal look unusable.** With no schema
305
+ the form is generated from the TABLE, so it renders every column — including the ones a user must
306
+ never set by hand. Opened live on the RFQ blotter, the default create modal showed twelve fields:
307
+ Instrument Id*, Axe Reference, Client Code*, Direction*, Quantity*, Sales Price, Trader Price,
308
+ **Status***, Trader, Salesperson*, **Created At***, **Last Updated*** — with the two datetimes as
309
+ NATIVE \`<input type="datetime-local">\` controls (\`dd/mm/yyyy, --:--\` plus the browser's own
310
+ picker), not themed DatePickers.
311
+
312
+ **Those asterisks are the SERVER's constraints, not decoration.** The form projects the GENERATED
313
+ table, so what it marks required follows \`daoNonNull\` — returned beside every attribute by
314
+ \`query_project_schema('entities', NAME)\` — not the config's \`nullable\`. \`nullable\` is what was
315
+ asked for; \`daoNonNull\` is what the generated DAO enforces, and it is true for a primary key, any
316
+ index member, a generated field, or anything carrying a default (BOOLEAN and ENUM always do), as
317
+ well as for an explicit \`nullable: false\`. So an attribute can come back \`nullable: true,
318
+ daoNonNull: true\` — reading that as "nullable, so optional, so I can drop it" is the mistake this
319
+ section exists to stop. Every asterisked column above is \`daoNonNull\`: INSTRUMENT_ID, CLIENT_CODE,
320
+ DIRECTION, QUANTITY, STATUS, SALESPERSON, CREATED_AT and LAST_UPDATED; AXE_REFERENCE, SALES_PRICE,
321
+ TRADER_PRICE and TRADER are not.
322
+
323
+ So **you cannot simply hide a required field.** \`createFormUiSchema\` controls what is DISPLAYED, not
324
+ what the insert needs. Drop \`CREATED_AT\` — \`daoNonNull\` with no default — and the commit fails on a
325
+ NOT NULL column, unless something supplies a value, and a generated \`type: 'crud'\` handler supplies
326
+ nothing (verify before assuming: a CUSTOM handler may default them server-side, a generated one does
327
+ not). A DEFAULTED column is the exception, and every BOOLEAN and ENUM has one, so hiding \`STATUS\`
328
+ just takes its default. For a required field the user should not type, make it a HIDDEN field WITH
329
+ a value — which is exactly what a well-written design asks for ("Axe Reference and Order Type, fixed
330
+ to AXE_HIT, should both be hidden fields") — via the schema's hidden/const support or
331
+ \`defaultValues\` on the action.
332
+
333
+ That raw form is why a design will often say "remove the Create button". The answer is almost never
334
+ to remove it, because the chrome around it is already right — the modal's footer is a single
335
+ right-aligned **Submit** with an X to dismiss, which is exactly the dialog rule this corpus teaches.
336
+ Pass a \`createFormUiSchema\` and you keep that, and get the fields you actually want — hiding the
337
+ OPTIONAL ones freely, and hiding a REQUIRED one only together with a default:
338
+
339
+ \`\`\`tsx
340
+ <EntityManagement
341
+ resourceName="RFQ_VIEW_QUERY"
342
+ createEvent="EVENT_RFQ_INSERT"
343
+ createLabel="+ New RFQ"
344
+ createFormUiSchema={newRfqFormSchema} // curate: drop STATUS / CREATED_AT / LAST_UPDATED,
345
+ … // order the rest, group them, set widgets
346
+ />
347
+ \`\`\`
348
+
349
+ So the decision is three-way, not two-way: the built-in button with the DEFAULT form (raw — rarely
350
+ what a design wants), the built-in button with a CURATED form (usually right), or a hand-built modal
351
+ (only when the layout itself is bespoke — a read-only summary block above the fields, several submit
352
+ buttons firing different events). Reach for the third only after the second cannot express it, and
353
+ even then keep the trigger via a \`customActions\` entry with \`action: { type: 'callback' }\`.
354
+
355
+ *Measured on the fi-portal scenario.* Asked for a "+ New RFQ" button on the blotter, the agent set
356
+ all three CRUD events to \`undefined\` and rendered its own \`<Button style={{backgroundColor:
357
+ '#16a34a'}} onClick={() => alert('New RFQ dialogue placeholder')}>\` — losing the create modal it
358
+ already had, hardcoding an off-token green onto a design-system component, and shipping an
359
+ \`alert()\`. The user's report for the same shape was "we already had a placeholder for custom
360
+ action, why did you change it to a button?". The rule is one line: if the affordance already
361
+ exists, configure it; do not rebuild it.
362
+
363
+ \`\`\`tsx
364
+ import {
365
+ EntityManagement,
366
+ type EntityManagementRef,
367
+ } from '@genesislcap/foundation-entity-management/react';
368
+ import {
369
+ CrudMenuPosition,
370
+ ActionsMenuStyle,
371
+ type CustomAction,
372
+ } from '@genesislcap/foundation-entity-management';
373
+ import type { ColDef } from '@ag-grid-community/core';
374
+ import type { UiSchema } from '@genesislcap/foundation-forms';
375
+ import { GridProCaseType } from '@genesislcap/grid-pro';
376
+ import { useRef } from 'react';
377
+
378
+ const customActions: CustomAction[] = [
379
+ // Event-based: opens a form populated with row data
380
+ {
381
+ name: 'Approve Trade',
382
+ action: {
383
+ type: 'event',
384
+ event: 'EVENT_TRADE_APPROVE',
385
+ hasForm: true,
386
+ defaultValues: {
387
+ TRADE_ID: { type: 'record', mapping: 'TRADE_ID' },
388
+ QUANTITY: { type: 'record', mapping: 'QUANTITY' },
389
+ },
390
+ },
391
+ position: CrudMenuPosition.Top,
392
+ icon: 'check',
393
+ tooltip: 'Approve selected trade',
394
+ requiresSelection: true,
395
+ confirmSubmit: { state: 'enabled', message: 'Approve this trade?' },
396
+ },
397
+ // Callback-based: executes JS directly without a modal
398
+ {
399
+ name: 'Log Row',
400
+ action: {
401
+ type: 'callback',
402
+ callback: (rowData: any) => console.log(rowData),
403
+ },
404
+ position: CrudMenuPosition.Column,
405
+ icon: 'terminal',
406
+ requiresSelection: true,
407
+ },
408
+ ];
409
+
410
+ const filtersUiSchema: UiSchema = {
411
+ type: 'VerticalLayout',
412
+ elements: [
413
+ { type: 'Control', scope: '#/properties/SIDE', label: 'Side' },
414
+ { type: 'Control', scope: '#/properties/TRADE_DATE', label: 'Trade Date' },
415
+ ],
416
+ };
417
+
418
+ export const TradeManagement = () => {
419
+ const emRef = useRef<EntityManagementRef>(null);
420
+
421
+ return (
422
+ <EntityManagement
423
+ ref={emRef}
424
+ style={{ height: '100%' }} {/* EM has NO intrinsic height — a parent must resolve one, else the grid is invisible. See "Sizing" below. */}
425
+ resourceName="ALL_TRADES"
426
+ createEvent="EVENT_TRADE_INSERT"
427
+ updateEvent="EVENT_TRADE_MODIFY"
428
+ deleteEvent="EVENT_TRADE_DELETE"
429
+ entityLabel="Trade"
430
+ title="Trade Management"
431
+ columns={columns}
432
+ createFormUiSchema={createFormSchema}
433
+ updateFormUiSchema={createFormSchema}
434
+ modalPosition="centre"
435
+ crudMenuPosition={CrudMenuPosition.Top}
436
+ crudMenuStyle={ActionsMenuStyle.Default}
437
+ enableRowFlashing
438
+ enableCellFlashing
439
+ enableSearchBar
440
+ enableFilters
441
+ filtersUiSchema={filtersUiSchema}
442
+ showFilterPersistenceControls
443
+ sizeColumnsToFit
444
+ headerCaseType={GridProCaseType.capitalCase}
445
+ persistColumnStateKey="trade-management-cols"
446
+ customActions={customActions}
447
+ datasourceConfig={{ maxRows: 500, orderBy: 'TRADE_DATE', reverse: true }}
448
+ {/* onSelectionChanged is the ONE selection event — read the current selection off the grid api */}
449
+ onSelectionChanged={(e) => console.log('selection', e.detail.api.getSelectedRows())}
450
+ onSubmitSuccess={(e) => console.log('success', e.detail)}
451
+ onSubmitFailure={(e) => console.error('failure', e.detail)}
452
+ />
453
+ );
454
+ };
455
+ \`\`\`
456
+
457
+ ---
458
+
459
+ ### Sizing — EntityManagement has NO intrinsic height (else the grid is invisible)
460
+
461
+ EntityManagement's \`:host\` is only \`contain: content\` — it sets **no height** and no display size. Its
462
+ internal grid area is \`height: 100%\`, which resolves to **0** unless a PARENT gives it a real height.
463
+ Symptom when missing: only the header/toolbar (the "Add …" button) shows and the **grid is invisible**.
464
+ (The inner \`List\` host already fills — the missing link is always EntityManagement's OWN host height.)
465
+
466
+ It **never auto-heights** — whether it is a direct FlexLayout tile child or wrapped in a \`<div>\`, you
467
+ must give it a resolved height. The whole ancestor chain must also reach a real height (see fui-flexlayout
468
+ "Tile sizing — the height chain": the page container needs e.g. \`height: calc(100vh - 48px)\`). Two correct
469
+ patterns:
470
+
471
+ 1. **EntityManagement alone in its container** — give IT \`height: '100%'\`:
472
+ \`\`\`tsx
473
+ <EntityManagement resourceName="TRADES" columns={cols} style={{ height: '100%' }} />
474
+ \`\`\`
475
+ 2. **A filter/toolbar strip ABOVE the grid** — flex COLUMN; the strip is natural height, the grid fills and
476
+ is allowed to shrink (\`minHeight: 0\`):
477
+ \`\`\`tsx
478
+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
479
+ <Filters style={{ flex: '0 0 auto', height: 'auto' }} ... /> {/* pin: foundation Filters :host is height:100% */}
480
+ <div style={{ flex: 1, minHeight: 0 }}> {/* minHeight:0 lets the grid shrink, not overflow */}
481
+ <EntityManagement resourceName="TRADES" columns={cols} style={{ height: '100%' }} />
482
+ </div>
483
+ </div>
484
+ \`\`\`
485
+
486
+ 3. **A SCAFFOLDED tile** — the shape you will most often be editing rather than writing. Generated
487
+ tiles arrive as a wrapper div around the grid, and NEITHER element carries a height:
488
+ \`\`\`tsx
489
+ // as generated — the grid collapses to its header row
490
+ <div className="main-trading-rf-qs-manager-wrapper">
491
+ <EntityManagement className="main-trading-rf-qs-manager" resourceName="RFQ_VIEW_QUERY" ... />
492
+ </div>
493
+ \`\`\`
494
+ \`height: '100%'\` on the GRID ALONE does not fix this: it resolves against the wrapper, and the
495
+ wrapper is auto-height, so 100% of auto is still nothing. The wrapper needs the height too:
496
+ \`\`\`tsx
497
+ <div className="main-trading-rf-qs-manager-wrapper" style={{ height: '100%' }}>
498
+ <EntityManagement ... style={{ height: '100%' }} />
499
+ </div>
500
+ \`\`\`
501
+ MEASURED (fi-portal-visual-core): the wrapper computed to 48px inside a 728px tile — exactly the
502
+ header row — and setting \`height: 100%\` on the WRAPPER alone took the grid from 48px to 728px.
503
+
504
+ **The generated \`.css\` file misleads you here.** It ships a rule for the grid's class with the
505
+ comment "Set on the tile's root element by the component — the React stand-in for :host". That
506
+ class is on the \`<EntityManagement>\`, NOT on the wrapper, so height written there is height on
507
+ the inner element and the wrapper still collapses. Style the \`-wrapper\` class, or set the height
508
+ inline on both.
509
+
510
+ NEVER drop EntityManagement into a plain \`<div>\` with no resolved height, or a flex item without
511
+ \`flex: 1\` / \`height: '100%'\` — the grid collapses to just the toolbar. Same host, same rule for \`<List>\`.
512
+ When you EDIT an existing tile — adding columns, a custom action, a renderer — check the wrapper has a
513
+ height before you finish: a scaffolded tile you never touched can still be the reason nothing renders.
514
+
515
+ ---
516
+
517
+ ### Server-Side Row Model (SSRM)
518
+
519
+ \`\`\`tsx
520
+ <EntityManagement
521
+ resourceName="ALL_TRADES"
522
+ datasourceType="server"
523
+ datasourceConfig={{ maxRows: 50, requestAutoSetup: false }}
524
+ columns={columns}
525
+ updateEvent="EVENT_TRADE_MODIFY"
526
+ deleteEvent="EVENT_TRADE_DELETE"
527
+ createEvent="EVENT_TRADE_INSERT"
528
+ crudMenuPosition={CrudMenuPosition.Top}
529
+ enableCellFlashing
530
+ enableRowFlashing
531
+ />
532
+ \`\`\`
533
+
534
+ ---
535
+
536
+ ### datasourceConfig — key fields
537
+
538
+ \`\`\`ts
539
+ // Type: Omit<DatasourceOptions, 'resourceName'>
540
+ datasourceConfig={{
541
+ criteria: 'STATUS == "ACTIVE"', // server-side filter expression
542
+ orderBy: 'CREATED_AT', // default sort field
543
+ reverse: true, // descending
544
+ maxRows: 200, // max rows returned
545
+ maxView: 500, // client-side tracked rows
546
+ isSnapshot: false, // true = poll once, no streaming updates
547
+ fields: 'TRADE_ID,QUANTITY', // restrict returned fields (DataServer)
548
+ request: { INSTRUMENT_ID: 'X' },// payload for request/reply resources
549
+ requestAutoSetup: false, // REQUIRED whenever criteria is set — see below
550
+ disablePolling: false, // disable polling for req/reply
551
+ pollingInterval: 10000, // poll interval in ms (req/reply)
552
+ pollTriggerEvents: ['EVENT_TRADE_INSERT'], // extra poll triggers
553
+ }}
554
+ \`\`\`
555
+
556
+ #### \`criteria\` without \`requestAutoSetup: false\` silently does not filter
557
+
558
+ \`grid-pro\`'s datasource ELEMENT defaults \`requestAutoSetup\` to **true**
559
+ (\`base.datasource.ts\`: \`@attr({ mode: 'boolean', attribute: 'request-auto-setup' }) requestAutoSetup = true\`).
560
+ On a Request Server resource that default discards your filter: \`foundation-comms\` drops \`CRITERIA_MATCH\`
561
+ from the request and rewrites the criteria into a \`REQUEST\` field object via \`criteriaToFields\`.
562
+ Nothing throws — the grid just returns unfiltered or empty rows.
563
+
564
+ Always write the two together:
565
+
566
+ \`\`\`tsx
567
+ datasourceConfig={{ criteria: 'STATUS == "ACTIVE"', requestAutoSetup: false }}
568
+ \`\`\`
569
+
570
+ You do NOT need to determine the resource type first. The flag is only read on the REQUEST_SERVER
571
+ code path, so on a Data Server resource it is an inert no-op — setting it is always safe.
572
+ \`blank-app-seed\` does this for every request/reply tile it generates — but note it is NOT a
573
+ complete safety net: in \`grid.hbs\` the \`criteria\` prop is gated on \`config.eventing.listener\`
574
+ while \`requestAutoSetup\` is gated on \`config.reqrep\`, so an eventing-listener tile that is not
575
+ also reqrep emits \`criteria\` with no \`requestAutoSetup\` and hits this same bug.
576
+
577
+ ---
578
+
579
+ ### Key props reference
580
+
581
+ | Prop | Type | Notes |
582
+ |---|---|---|
583
+ | \`prefix\` | \`string\` | Design system prefix. Defaults to \`'rapid'\` — omit it in rapid apps. |
584
+ | \`resourceName\` | \`string\` | An entity, view, or query name (e.g. \`ALL_TRADES\`) — verify the exact one with \`query_project_schema\` before writing it; do not assume it must be a query. |
585
+ | \`createEvent\` | \`string\` | Server event handler for create (e.g. \`EVENT_TRADE_INSERT\`). |
586
+ | \`updateEvent\` | \`string\` | Server event handler for update. |
587
+ | \`deleteEvent\` | \`string\` | Server event handler for delete. |
588
+ | \`readEvent\` | \`string\` | Server resource to pre-fetch data for the edit form. |
589
+ | \`readEventFn\` | \`(entity) => any\` | Function alternative to \`readEvent\` for pre-fetching. |
590
+ | \`entityLabel\` | \`string\` | Used in modal titles and toast notifications (e.g. \`"Trade"\`). |
591
+ | \`title\` | \`string\` | Grid header title. |
592
+ | \`columns\` | \`ColDef[]\` | ag-Grid column defs. Use \`ColDef\` from \`@ag-grid-community/core\`. |
593
+ | \`createFormUiSchema\` | \`UiSchema\` | JSON Forms schema for the create modal. |
594
+ | \`updateFormUiSchema\` | \`UiSchema\` | JSON Forms schema for the update modal. |
595
+ | \`filtersUiSchema\` | \`UiSchema\` | JSON Forms schema for the filters flyout. |
596
+ | \`gridOptions\` | \`GridOptionsConfig\` | ag-Grid options (from \`@genesislcap/grid-pro\`). |
597
+ | \`datasourceConfig\` | \`DatasourceConfiguration\` | Datasource query parameters. |
598
+ | \`datasourceType\` | \`'client' | 'server'\` | Client-side or server-side row model. |
599
+ | \`customActions\` | \`CustomAction[]\` | Extra action buttons (see CustomAction type below). |
600
+ | \`defaultEntityValues\` | \`Record<string, unknown>\` | Pre-fill create form with defaults. |
601
+ | \`modalPosition\` | \`'centre' | 'left' | 'right'\` | Default \`'right'\`. |
602
+ | \`filtersModalPosition\` | \`'centre' | 'left' | 'right'\` | Default \`'left'\`. |
603
+ | \`crudMenuPosition\` | \`CrudMenuPosition\` | Where CRUD buttons appear (Column/Top/Bottom/Action/None). |
604
+ | \`crudMenuStyle\` | \`ActionsMenuStyle\` | Button grouping style (Default/ActionsVertical/ActionsHorizontal). |
605
+ | \`crudActionMenuName\` | \`string\` | Label text for the crud action menu button (when using Action position). |
606
+ | \`enableSearchBar\` | \`boolean\` | Enables top search/criteria bar. |
607
+ | \`enableFilters\` | \`boolean\` | Enables filters flyout modal. |
608
+ | \`enableFilterBar\` | \`boolean\` | Enables in-grid filter bar. |
609
+ | \`enableCellFlashing\` | \`boolean\` | Flash cells on data updates. |
610
+ | \`enableRowFlashing\` | \`boolean\` | Flash rows on add transactions. |
611
+ | \`enableCsvExport\` | \`{ buttonName?: string; fileName?: string } | null\` | Adds CSV export button; pass \`{}\` for defaults. |
612
+ | \`sizeColumnsToFit\` | \`boolean\` | Resize columns to fill available width. |
613
+ | \`sizeColumnsToContent\` | \`boolean\` | Auto-size columns to content. |
614
+ | \`gridAutosizing\` | \`boolean\` | Disable manual widths; auto-size on interaction. |
615
+ | \`hideEdit\` | \`boolean\` | Hide per-row Edit button (use when inline editing). |
616
+ | \`hideDelete\` | \`boolean\` | Hide per-row Delete button. |
617
+ | \`rowSelection\` | \`string\` | \`'single'\` (default) or \`'multiple'\`. |
618
+ | \`persistColumnStateKey\` | \`string\` | Unique key to persist column state in storage. |
619
+ | \`persistFilterModelKey\` | \`string\` | Unique key to persist filter model in storage. |
620
+ | \`headerCaseType\` | \`GridProCaseType\` | Header label case transform (e.g. \`GridProCaseType.capitalCase\`). |
621
+ | \`confirmationMessage\` | \`string\` | Confirmation dialog shown before form submit (applies to CRUD, not custom actions). |
622
+ | \`setApprovalMessage\` | \`boolean\` | Adds APPROVAL_MESSAGE field to form for approval workflows. |
623
+ | \`approvalMessageLabel\` | \`string\` | Label for the approval message field. |
624
+ | \`statusBarConfig\` | \`GridProStatusBarConfig\` | **DO NOT USE — not available.** AG Grid Enterprise status bar; the platform registers community modules only, so it never renders. See \`read_context('fui-rapid-grid-pro')\` Example 5. |
625
+ | \`showFilterPersistenceControls\` | \`boolean\` | Show filter save/load UI (default \`true\`). |
626
+ | \`searchBarConfig\` | \`AvailableOption[]\` | Manual search bar field config (auto-built from columns if omitted). |
627
+ | \`enableAiCriteriaSearch\` | \`boolean\` | Enables AI-powered criteria search bar. |
628
+ | \`additionalFormRenderers\` | \`RendererEntry[]\` | Extra JSON Forms renderers without replacing defaults. |
629
+ | \`formRenderers\` | \`RendererEntry[]\` | Replace the full JSON Forms renderer registry. |
630
+ | \`errorNotificationConfig\` | \`NotificationStructure['config']\` | Override default error snackbar config on submit failure. |
631
+
632
+ ---
633
+
634
+ ### Events (on* props)
635
+
636
+ | Event | When fired |
637
+ |---|---|
638
+ | \`onRequestChanged\` | Search bar request payload changes |
639
+ | \`onCriteriaChanged\` | Search bar criteria expression changes |
640
+ | \`onCreateEntity\` | User initiates create |
641
+ | \`onEditEntity\` | User initiates edit |
642
+ | \`onDeleteEntity\` | User initiates delete |
643
+ | \`onSubmitSuccess\` | CRUD operation completed successfully |
644
+ | \`onSubmitFailure\` | CRUD operation returned an error |
645
+ | \`onRowClick\` | Row clicked |
646
+ | \`onRowDblClick\` | Row double-clicked |
647
+ | \`onSelectionChanged\` | Selection changed (PREFER). \`e.detail\` = ag-grid event → row = \`e.detail.api.getSelectedRows()[0]\` |
648
+ | \`onRowSelected\` | Per-row select/deselect. \`e.detail\` = ag-grid event → row = \`e.detail.data\` (gate \`e.detail.node.isSelected()\`); NEVER bare \`e.detail\` |
649
+
650
+ > **List-only events** (when using \`<List>\` directly instead of \`<EntityManagement>\`):
651
+ > \`onCustomAction\` — fired when a custom grid action runs from within the List sub-component.
652
+
653
+ ---
654
+
655
+ ### ⚠️ CRITICAL — Grid selection: \`e.detail\` is the ag-grid EVENT, NEVER the row
656
+
657
+ Both selection props are typed \`(e: CustomEvent<unknown>) => void\` in react.d.ts, so the type gives you NO help and \`e.detail as MyRow\` compiles cleanly while being WRONG. The #1 bug: treating \`e.detail\` as the row. **\`e.detail\` is the ag-grid event object; the row lives INSIDE it.** Never write \`e.detail as Row\`, \`setSelected(e.detail)\`, or \`e.detail.SOME_FIELD\`.
658
+
659
+ PREFER **\`onSelectionChanged\`** (fires once, whole current selection, no deselect edge case). If you use **\`onRowSelected\`** instead, it is equally valid — just read its payload correctly. Both, verbatim:
660
+
661
+ \`\`\`tsx
662
+ // onSelectionChanged — e.detail is the SelectionChangedEvent; the row is on the grid api:
663
+ onSelectionChanged={(e) => {
664
+ const row = e.detail.api.getSelectedRows()[0] ?? null; // null = nothing selected
665
+ dispatch(setSelectedX(row));
666
+ }}
667
+
668
+ // onRowSelected — fires PER ROW on select AND deselect; the row is e.detail.DATA (gate on isSelected):
669
+ onRowSelected={(e) => {
670
+ const row = e.detail.node.isSelected() ? e.detail.data : null; // row = e.detail.data, NOT e.detail
671
+ dispatch(setSelectedX(row));
672
+ }}
673
+ \`\`\`
674
+
675
+ These are the platform's own shapes (\`entities.ts\`: \`selectionChanged\` → \`e.detail.api.getSelectedRows()\`; \`selectEntity\` → \`e.detail.node.isSelected() ? e.detail.data : {}\`; verified 14.481.1/14.482.1). (Unrelated exception: \`onContextMenu\` emits \`e.detail = the row\` directly.)
676
+
677
+ ---
678
+
679
+ ### CustomAction type (verified against types.d.ts)
680
+
681
+ \`\`\`tsx
682
+ import type { CustomAction, CrudMenuPosition, ConfirmSubmit } from '@genesislcap/foundation-entity-management';
683
+
684
+ const customActions: CustomAction[] = [
685
+ // Type 1: fires a server event (optionally with a form modal)
686
+ {
687
+ name: 'Approve',
688
+ action: {
689
+ type: 'event',
690
+ event: 'EVENT_TRADE_APPROVE',
691
+ hasForm: true, // true = opens form modal
692
+ defaultValues: {
693
+ // Static value:
694
+ STATUS: 'APPROVED',
695
+ // Map from current row data:
696
+ TRADE_ID: { type: 'record', mapping: 'TRADE_ID' },
697
+ },
698
+ uiSchema: { /* optional UiSchema for the form modal */ },
699
+ },
700
+ appearance: 'accent', // optional button appearance
701
+ position: CrudMenuPosition.Top, // Column | Top | Bottom | Action | None
702
+ icon: 'check', // icon name
703
+ tooltip: 'Approve this trade',
704
+ requiresSelection: true, // disable button if no row selected
705
+ setApprovalMessage: false, // adds APPROVAL_MESSAGE field to form
706
+ confirmSubmit: {
707
+ state: 'enabled',
708
+ message: 'Confirm approval?',
709
+ },
710
+ // Custom disable logic — consulted only AFTER requiresSelection passes. requiresSelection
711
+ // always wins first (entities.ts isCustomActionDisabled), so disabled() can never re-enable
712
+ // a button when nothing is selected, despite what the CustomAction JSDoc says:
713
+ disabled: (rowData) => rowData?.STATUS === 'APPROVED',
714
+ },
715
+ // Type 2: callback — runs JS, no server call
716
+ {
717
+ name: 'Inspect',
718
+ action: {
719
+ type: 'callback',
720
+ callback: (rowData: any) => console.log(rowData),
721
+ },
722
+ position: CrudMenuPosition.Column,
723
+ icon: 'magnifying-glass',
724
+ requiresSelection: true,
725
+ },
726
+ ];
727
+ \`\`\`
728
+
729
+ ---
730
+
731
+ ### Adding or editing custom actions on an EXISTING (generated) tile
732
+
733
+ An existing \`entity-manager\` tile is one already present in the preview, generated from Genesis
734
+ Create config rather than written by you. **First \`vfs_list\` the tile's folder and check whether a
735
+ \`<Tile>EventsConfig.ts\` sibling exists** — the two cases are different, and picking the wrong one
736
+ is a common failure:
737
+
738
+ **Case A — \`<Tile>EventsConfig.ts\` EXISTS** (the tile already has custom actions). Its actions are
739
+ **generated code you edit in place** — do NOT author a second \`customActions\` array or a parallel
740
+ form schema.
741
+
742
+ **Case B — there is NO \`<Tile>EventsConfig.ts\`** (the tile was generated with no custom actions;
743
+ its config had \`customEvents: null\`). Nothing exists to edit, so you **must author it** — this is
744
+ the correct and expected path, not a violation of Case A. Create the sibling
745
+ \`<Tile>EventsConfig.ts\` and wire it onto the tile's existing \`<EntityManagement>\`. Match the shape
746
+ the seed itself emits:
747
+
748
+ \`\`\`ts
749
+ // <Tile>EventsConfig.ts — new sibling file in the tile's own folder
750
+ import { type CustomAction, CrudMenuPosition } from '@genesislcap/foundation-entity-management';
751
+
752
+ export const customActions: CustomAction[] = [
753
+ {
754
+ name: 'Details', // the button label
755
+ action: { type: 'callback', callback: (row) => { /* open your flyout/dialog with \`row\` */ } },
756
+ position: CrudMenuPosition.Column, // a per-row button in its own column
757
+ requiresSelection: true,
758
+ },
759
+ ];
760
+ \`\`\`
761
+
762
+ \`\`\`tsx
763
+ // <Tile>Component.tsx — edit the EXISTING <EntityManagement>, do not create a second grid
764
+ import { customActions } from './<Tile>EventsConfig';
765
+ …
766
+ <EntityManagement … customActions={customActions} />
767
+ \`\`\`
768
+
769
+ For an action that raises a backend event instead of running local code, use
770
+ \`action: { type: 'event', event: 'EVENT_…', hasForm: true, uiSchema, defaultValues }\` — see the
771
+ generated \`RfQsEventsConfig.ts\` in the fi-portal sample for a full worked example.
772
+
773
+ **Do NOT hand-roll a row action as an ag-grid \`cellRenderer\` that returns an HTML string** (with an
774
+ inline \`onclick\`, or dispatching a global \`window\` \`CustomEvent\`). It type-checks and trips no
775
+ lint rule, but it bypasses the framework's eventing and rendering model, loses React context, and
776
+ is not how any generated tile works. On an \`EntityManagement\` grid the row-action idiom is
777
+ \`customActions\`; on a standalone \`RapidGridPro\` see \`fui-column-defs\` (\`GridProRendererTypes.action\`).
778
+
779
+ The seed emits these sibling files in the tile's folder; \`vfs_list\` to find the exact keys (do not
780
+ hard-code paths):
781
+
782
+ | File (suffix) | Holds |
783
+ |---|---|
784
+ | \`<Tile>EventsConfig.ts\` | the \`customActions: CustomAction[]\` array **and** one \`export const <actionName>FormSchema: UiSchema\` per action that has a form |
785
+ | \`<Tile>CreateFormSchema.ts\` / \`<Tile>UpdateFormSchema.ts\` | the create / update modal form (NOT custom actions) |
786
+ | \`<Tile>FilterFormSchema.ts\` | the filters-flyout form |
787
+
788
+ - Change a **custom-action button** (label, icon, position, confirm) → \`vfs_read\` \`<Tile>EventsConfig.ts\` and edit that entry in the \`customActions\` array. (Case A only — if the file does not exist, author it as shown above.)
789
+ - Change a **custom-action form's layout** (e.g. single column → two) → edit that action's \`export const <actionName>FormSchema: UiSchema = { … }\` in the SAME file. The generated default is a single \`VerticalLayout\`; for columns/grouping use the layout renderers from \`fui-form-component\` (\`HorizontalLayout\`, \`LayoutVertical2Columns\` — layout containers take NO \`scope\`, only \`Control\`s do). Preserve every existing field's \`scope\` and \`options\` so you don't drop fields or their read-only / lookup config.
790
+
791
+ Editing any of these promotes the file into the VFS and the route becomes AI-owned — the seed stops regenerating it from Genesis Create config (expected). Edit in place; never recreate the file under a new key.
792
+
793
+ ---
794
+
795
+ ### Slot names (verified from source / showcase)
796
+
797
+ Children of \`<EntityManagement>\` can use a \`slot\` attribute to inject custom content:
798
+
799
+ | Slot name | Inserts content |
800
+ |---|---|
801
+ | \`before-header\` | Above the grid header |
802
+ | \`after-header\` | Below the grid header / above the grid |
803
+ | \`before-footer\` | Above the footer |
804
+ | \`after-footer\` | Below the footer |
805
+ | \`crud-{position}-before\` | Before CRUD buttons (requires Top/Bottom crudMenuPosition) |
806
+ | \`crud-{position}-after\` | After CRUD buttons (requires Top/Bottom crudMenuPosition) |
807
+
808
+ Slots are for CONTENT, not action buttons — an actionable trigger belongs in \`customActions\`
809
+ (framework positioning, selection/disabled gating and toast handling included), or in a dedicated
810
+ prop like \`enableCsvExport\` when one exists for that exact action.
811
+
812
+ \`\`\`tsx
813
+ <EntityManagement resourceName="ALL_TRADES" /* ... */>
814
+ <span slot="after-header">Showing trades settled in the last 30 days.</span>
815
+ </EntityManagement>
816
+ \`\`\`
817
+
818
+ Need an Export button? Use \`enableCsvExport\`, or a \`customActions\` entry at
819
+ \`CrudMenuPosition.Top\` when the export logic is custom:
820
+
821
+ \`\`\`tsx
822
+ <EntityManagement
823
+ resourceName="ALL_TRADES"
824
+ enableCsvExport={{ buttonName: 'Export', fileName: 'trades-export' }}
825
+ // or, for custom export logic:
826
+ customActions={[{
827
+ name: 'Export',
828
+ action: { type: 'callback', callback: () => handleExport() },
829
+ position: CrudMenuPosition.Top,
830
+ icon: 'download',
831
+ requiresSelection: false,
832
+ }]}
833
+ />
834
+ \`\`\`
835
+
836
+ ---
837
+
838
+ ### SmartFormModal
839
+
840
+ A variant of EntityManagement that hides the grid (\`gridVisible = false\`). Use when you need
841
+ only the create/update form without a grid display. Extends \`EntityManagement\` — all props apply.
842
+
843
+ \`\`\`tsx
844
+ import { SmartFormModal } from '@genesislcap/foundation-entity-management/react';
845
+
846
+ <SmartFormModal
847
+ resourceName="ALL_TRADES"
848
+ createEvent="EVENT_TRADE_INSERT"
849
+ updateEvent="EVENT_TRADE_MODIFY"
850
+ createFormUiSchema={createFormSchema}
851
+ />
852
+ \`\`\`
853
+
854
+ ---
855
+
856
+ ### List (lower-level grid sub-component)
857
+
858
+ \`<List>\` is the grid-only sub-component used internally by \`EntityManagement\`. Use it directly
859
+ when you need a raw data grid with row actions but without the EntityManagement modal/form layer.
860
+
861
+ \`\`\`tsx
862
+ import { List, type ListRef } from '@genesislcap/foundation-entity-management/react';
863
+ import { useRef } from 'react';
864
+
865
+ export const TradeList = () => {
866
+ const listRef = useRef<ListRef>(null);
867
+ return (
868
+ <List
869
+ ref={listRef}
870
+ resourceName="ALL_TRADES"
871
+ columns={columns}
872
+ datasourceConfig={{ maxRows: 200 }}
873
+ enableCellFlashing
874
+ enableRowFlashing
875
+ onSelectionChanged={(e) => console.log('selection', e.detail.api.getSelectedRows())}
876
+ onCustomAction={(e) => console.log('custom action', e.detail)}
877
+ />
878
+ );
879
+ };
880
+ \`\`\`
881
+
882
+ ---
883
+
884
+ ### Type imports summary
885
+
886
+ | Type | Import from |
887
+ |---|---|
888
+ | \`CustomAction\`, \`CustomActionState\` | \`@genesislcap/foundation-entity-management\` |
889
+ | \`CrudMenuPosition\` (enum) | \`@genesislcap/foundation-entity-management\` |
890
+ | \`CrudAction\` (enum) | \`@genesislcap/foundation-entity-management\` |
891
+ | \`ModalFormType\` (enum) | \`@genesislcap/foundation-entity-management\` |
892
+ | \`ActionsMenuStyle\` (enum) | \`@genesislcap/foundation-entity-management\` |
893
+ | \`ConfirmSubmit\`, \`DefaultValues\`, \`RecordTypeValue\` | \`@genesislcap/foundation-entity-management\` |
894
+ | \`DatasourceConfiguration\` | \`@genesislcap/foundation-entity-management\` (re-exported) |
895
+ | \`EntityManagementRef\`, \`SmartFormModalRef\`, \`ListRef\` | \`@genesislcap/foundation-entity-management/react\` |
896
+ | \`ColDef\`, \`GridOptions\` | \`@ag-grid-community/core\` |
897
+ | \`UiSchema\` | \`@genesislcap/foundation-forms\` |
898
+ | \`GridProCaseType\`, \`GridOptionsConfig\`, \`GridProStatusBarConfig\` | \`@genesislcap/grid-pro\` |
899
+
900
+ ---
901
+
902
+ ### DANGEROUS PATTERNS
903
+
904
+ #### DP-1: Guessing \`resourceName\` from the entity's business name instead of verifying it
905
+
906
+ \`\`\`tsx
907
+ // WRONG — "TRADE"/"COUNTERPARTY" guessed from the entity's name, never checked against the project:
908
+ <EntityManagement resourceName="TRADE" />
909
+ <EntityManagement resourceName="COUNTERPARTY" />
910
+
911
+ // CORRECT — verify the real resource first. It is commonly the ALL_* DataServer query, but an
912
+ // entity with snapshot/realtime access is also valid — query_project_schema tells you which exists:
913
+ <EntityManagement resourceName="ALL_TRADES" />
914
+ <EntityManagement resourceName="ALL_COUNTERPARTYS" />
915
+ // Verify with query_project_schema('entities') / ('queries') before writing — don't assume either way.
916
+ \`\`\`
917
+
918
+ #### DP-2: Using kebab-case attribute names instead of camelCase React props
919
+
920
+ \`\`\`tsx
921
+ // WRONG — these are web component attributes, not React prop names:
922
+ <EntityManagement enable-search-bar enable-row-flashing modal-position="centre" />
923
+
924
+ // CORRECT — camelCase props on the React wrapper:
925
+ <EntityManagement enableSearchBar enableRowFlashing modalPosition="centre" />
926
+ \`\`\`
927
+
928
+ #### DP-3: Importing types from /react instead of the base package
929
+
930
+ \`\`\`tsx
931
+ // WRONG — types are not exported from /react:
932
+ import type { CustomAction, CrudMenuPosition } from '@genesislcap/foundation-entity-management/react';
933
+
934
+ // CORRECT — types come from the base package root:
935
+ import type { CustomAction, CrudMenuPosition } from '@genesislcap/foundation-entity-management';
936
+ \`\`\`
937
+
938
+ #### DP-4: Omitting \`hasForm\` on an event-type custom action
939
+
940
+ \`\`\`tsx
941
+ // WRONG — hasForm is REQUIRED on the 'event' action variant (TS error if missing),
942
+ // and whether a modal opens depends on it:
943
+ { name: 'Approve', action: { type: 'event', event: 'EVENT_TRADE_APPROVE' } }
944
+
945
+ // CORRECT — always state hasForm explicitly:
946
+ { name: 'Approve', action: { type: 'event', event: 'EVENT_TRADE_APPROVE', hasForm: true } }
947
+ // hasForm: false commits the event immediately, no modal — payload is the mapped
948
+ // defaultValues, or the whole selected row when defaultValues is omitted.
949
+ \`\`\`
950
+
951
+ #### DP-5: Providing a confirmation message only at component level when using custom actions
952
+
953
+ \`\`\`tsx
954
+ // WRONG — component-level confirmationMessage does not apply to custom actions;
955
+ // custom actions need their own confirmSubmit:
956
+ <EntityManagement confirmationMessage="Are you sure?" customActions={[
957
+ { name: 'Approve', action: { type: 'event', event: 'EVENT_APPROVE', hasForm: false } }
958
+ // Missing confirmSubmit — no confirmation shown for this action
959
+ ]} />
960
+
961
+ // CORRECT — add confirmSubmit per custom action that needs it:
962
+ const customActions: CustomAction[] = [{
963
+ name: 'Approve',
964
+ action: { type: 'event', event: 'EVENT_APPROVE', hasForm: false },
965
+ confirmSubmit: { state: 'enabled', message: 'Approve this record?' },
966
+ }];
967
+ <EntityManagement customActions={customActions} />
968
+ \`\`\`
969
+
970
+ #### DP-6: Setting a non-rapid \`prefix\`
971
+
972
+ \`\`\`tsx
973
+ // WRONG — a prefix whose design system is not registered leaves modals/renderers
974
+ // rendering unregistered <foundation-*> elements (blank UI):
975
+ <EntityManagement prefix="foundation" resourceName="ALL_TRADES" />
976
+
977
+ // CORRECT — omit prefix entirely; it already defaults to 'rapid':
978
+ <EntityManagement resourceName="ALL_TRADES" createEvent="EVENT_TRADE_INSERT" />
979
+ \`\`\`
980
+
981
+ #### DP-7: Setting \`enableCsvExport\` to a boolean JSX flag
982
+
983
+ \`\`\`tsx
984
+ // WRONG — boolean JSX flag sets the prop to \`true\` (not the expected object shape):
985
+ <EntityManagement enableCsvExport />
986
+
987
+ // CORRECT — pass an empty object for defaults, or configure explicitly:
988
+ <EntityManagement enableCsvExport={{}} />
989
+ <EntityManagement enableCsvExport={{ fileName: 'trades-export', buttonName: 'Download' }} />
990
+ \`\`\`
991
+
992
+ #### DP-8: Omitting \`hideEdit\` when inline editing is active
993
+
994
+ \`\`\`tsx
995
+ // WRONG — user sees both inline editor and a modal Edit button; leads to double-editing confusion:
996
+ <EntityManagement updateEvent="EVENT_TRADE_MODIFY" columns={columnsWithEditable} />
997
+
998
+ // CORRECT — hide the modal Edit button when inline editing is configured:
999
+ <EntityManagement updateEvent="EVENT_TRADE_MODIFY" columns={columnsWithEditable} hideEdit />
1000
+ // See fui-inline-editing context for full inline editing setup.
1001
+ \`\`\`
1002
+
1003
+ #### DP-9: Treating \`DatasourceType\` as an enum
1004
+
1005
+ \`\`\`tsx
1006
+ // WRONG — DatasourceType is a TYPE alias ('client' | 'server'), not an enum;
1007
+ // DatasourceType.Server does not exist at runtime:
1008
+ import { DatasourceType } from '@genesislcap/grid-pro';
1009
+ <EntityManagement datasourceType={DatasourceType.Server} />
1010
+
1011
+ // CORRECT — pass the string literal directly (verified in showcase):
1012
+ <EntityManagement datasourceType="server" />
1013
+ \`\`\`
1014
+ `.trim();