@genesislcap/ai-assistant 15.71.0-FUI-2650.1 → 15.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-assistant.api.json +0 -97
- package/dist/ai-assistant.d.ts +0 -65
- package/dist/chat-driver.cjs +0 -18031
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +0 -18024
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +6856 -9696
- package/dist/dts/chat-driver-node.d.ts +0 -2
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/index.d.ts +0 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/react.d.ts +0 -10
- package/dist/esm/chat-driver-node.js +0 -6
- package/dist/esm/index.js +0 -3
- package/dist/react.cjs +0 -7
- package/dist/react.mjs +0 -6
- package/package.json +17 -24
- package/scripts/smoke-chat-driver-node.mjs +0 -15
- package/dist/dts/code-review/code-review.types.d.ts +0 -76
- package/dist/dts/code-review/code-review.types.d.ts.map +0 -1
- package/dist/dts/code-review/code-reviewer.agent.d.ts +0 -77
- package/dist/dts/code-review/code-reviewer.agent.d.ts.map +0 -1
- package/dist/dts/code-review/code-reviewer.prompt.d.ts +0 -23
- package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +0 -1
- package/dist/dts/code-review/gate.d.ts +0 -44
- package/dist/dts/code-review/gate.d.ts.map +0 -1
- package/dist/dts/code-review/index.d.ts +0 -27
- package/dist/dts/code-review/index.d.ts.map +0 -1
- package/dist/dts/code-review/review-changes.d.ts +0 -70
- package/dist/dts/code-review/review-changes.d.ts.map +0 -1
- package/dist/dts/code-review/rules/context-trigger-map.d.ts +0 -6
- package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +0 -1
- package/dist/dts/code-review/rules/context.registry.d.ts +0 -123
- package/dist/dts/code-review/rules/context.registry.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +0 -13
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-blotter.d.ts +0 -16
- package/dist/dts/code-review/rules/fui-blotter.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-chart.d.ts +0 -20
- package/dist/dts/code-review/rules/fui-chart.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-column-defs.d.ts +0 -21
- package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-components.d.ts +0 -9
- package/dist/dts/code-review/rules/fui-components.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-criteria.d.ts +0 -32
- package/dist/dts/code-review/rules/fui-criteria.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +0 -15
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-dashboard.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-dialogs.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-entity-management.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts +0 -9
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-eventing.d.ts +0 -8
- package/dist/dts/code-review/rules/fui-eventing.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts +0 -17
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +0 -10
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-form-component.d.ts +0 -9
- package/dist/dts/code-review/rules/fui-form-component.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-formatters.d.ts +0 -12
- package/dist/dts/code-review/rules/fui-formatters.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +0 -10
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-global-filters.d.ts +0 -33
- package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-import-surface.d.ts +0 -37
- package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts +0 -10
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-layout.d.ts +0 -7
- package/dist/dts/code-review/rules/fui-layout.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-notifications.d.ts +0 -12
- package/dist/dts/code-review/rules/fui-notifications.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-primitives.d.ts +0 -26
- package/dist/dts/code-review/rules/fui-primitives.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +0 -18
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-redux-store.d.ts +0 -8
- package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-reporting.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-reporting.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-styling.d.ts +0 -15
- package/dist/dts/code-review/rules/fui-styling.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-trade-form.d.ts +0 -13
- package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +0 -1
- package/dist/dts/code-review/submit-code-review.tool.d.ts +0 -12
- package/dist/dts/code-review/submit-code-review.tool.d.ts.map +0 -1
- package/dist/dts/code-review/unified-diff.d.ts +0 -7
- package/dist/dts/code-review/unified-diff.d.ts.map +0 -1
- package/dist/dts/code-review/verdict.d.ts +0 -23
- package/dist/dts/code-review/verdict.d.ts.map +0 -1
- package/dist/dts/components/code-review-result/code-review-result.d.ts +0 -26
- package/dist/dts/components/code-review-result/code-review-result.d.ts.map +0 -1
- package/dist/esm/code-review/code-review.types.js +0 -6
- package/dist/esm/code-review/code-reviewer.agent.js +0 -167
- package/dist/esm/code-review/code-reviewer.prompt.js +0 -103
- package/dist/esm/code-review/gate.js +0 -93
- package/dist/esm/code-review/index.js +0 -28
- package/dist/esm/code-review/review-changes.js +0 -123
- package/dist/esm/code-review/rules/context-trigger-map.js +0 -20
- package/dist/esm/code-review/rules/context.registry.js +0 -772
- package/dist/esm/code-review/rules/fui-ai-extensions.js +0 -306
- package/dist/esm/code-review/rules/fui-blotter.js +0 -596
- package/dist/esm/code-review/rules/fui-chart.js +0 -669
- package/dist/esm/code-review/rules/fui-column-defs.js +0 -862
- package/dist/esm/code-review/rules/fui-components.js +0 -245
- package/dist/esm/code-review/rules/fui-criteria.js +0 -538
- package/dist/esm/code-review/rules/fui-custom-renderer.js +0 -612
- package/dist/esm/code-review/rules/fui-dashboard.js +0 -604
- package/dist/esm/code-review/rules/fui-dialogs.js +0 -588
- package/dist/esm/code-review/rules/fui-entity-management.js +0 -1014
- package/dist/esm/code-review/rules/fui-error-boundary.js +0 -244
- package/dist/esm/code-review/rules/fui-eventing.js +0 -628
- package/dist/esm/code-review/rules/fui-flexlayout.js +0 -860
- package/dist/esm/code-review/rules/fui-flyout-panel.js +0 -432
- package/dist/esm/code-review/rules/fui-form-component.js +0 -898
- package/dist/esm/code-review/rules/fui-formatters.js +0 -415
- package/dist/esm/code-review/rules/fui-foundation-comms.js +0 -518
- package/dist/esm/code-review/rules/fui-global-filters.js +0 -778
- package/dist/esm/code-review/rules/fui-import-surface.js +0 -452
- package/dist/esm/code-review/rules/fui-inline-editing.js +0 -445
- package/dist/esm/code-review/rules/fui-layout.js +0 -431
- package/dist/esm/code-review/rules/fui-notifications.js +0 -439
- package/dist/esm/code-review/rules/fui-primitives.js +0 -1216
- package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +0 -650
- package/dist/esm/code-review/rules/fui-redux-store.js +0 -522
- package/dist/esm/code-review/rules/fui-reporting.js +0 -506
- package/dist/esm/code-review/rules/fui-styling.js +0 -1229
- package/dist/esm/code-review/rules/fui-trade-form.js +0 -618
- package/dist/esm/code-review/submit-code-review.tool.js +0 -43
- package/dist/esm/code-review/unified-diff.js +0 -96
- package/dist/esm/code-review/verdict.js +0 -24
- package/dist/esm/components/code-review-result/code-review-result.js +0 -89
- package/docs/code-review.md +0 -137
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context injected into the UI Builder system prompt.
|
|
3
|
-
* Covers read-only reporting grid patterns — no editing, no action columns.
|
|
4
|
-
* Load this when the user asks for a report, read-only grid, analytics view, or audit log.
|
|
5
|
-
*
|
|
6
|
-
* Sources verified against:
|
|
7
|
-
* - @genesislcap/foundation-entity-management/react (EntityManagement, DatasourceConfiguration)
|
|
8
|
-
* - @genesislcap/rapid-grid-pro/react (RapidGridPro)
|
|
9
|
-
* - @genesislcap/grid-pro/react (GridProGenesisDatasource, GridProColumn)
|
|
10
|
-
* - @genesislcap/grid-pro (getActionsMenuDef — fui-column-defs verified)
|
|
11
|
-
* - sales-trader-hub/client/src/components/Blotter/BlotterGrid/BlotterGrid.tsx
|
|
12
|
-
* - sales-trader-hub/client/src/pbc/reporting/routes.ts
|
|
13
|
-
* - fui-entity-management context (EntityManagement props, DatasourceConfiguration)
|
|
14
|
-
* - fui-rapid-grid-pro context (RapidGridPro props, GridProGenesisDatasource props)
|
|
15
|
-
*/
|
|
16
|
-
export const FUI_REPORTING_TAGS = [
|
|
17
|
-
'reporting',
|
|
18
|
-
'report',
|
|
19
|
-
'read-only grid',
|
|
20
|
-
'read only',
|
|
21
|
-
'analytics',
|
|
22
|
-
'audit log',
|
|
23
|
-
'audit trail',
|
|
24
|
-
'snapshot grid',
|
|
25
|
-
'no editing',
|
|
26
|
-
'view only',
|
|
27
|
-
'historical data',
|
|
28
|
-
'data export',
|
|
29
|
-
'export csv',
|
|
30
|
-
'export excel',
|
|
31
|
-
'totals row',
|
|
32
|
-
'aggregation',
|
|
33
|
-
'summary row',
|
|
34
|
-
'pivot',
|
|
35
|
-
'group by',
|
|
36
|
-
'compliance view',
|
|
37
|
-
'P&L report',
|
|
38
|
-
'position snapshot',
|
|
39
|
-
'trade history',
|
|
40
|
-
'order history',
|
|
41
|
-
'read only table',
|
|
42
|
-
'display only',
|
|
43
|
-
];
|
|
44
|
-
export const FUI_REPORTING_DEPS = ['fui-column-defs', 'fui-rapid-grid-pro'];
|
|
45
|
-
export const FUI_REPORTING_CONTEXT = `
|
|
46
|
-
## REPORTING / READ-ONLY GRIDS — PATTERNS
|
|
47
|
-
|
|
48
|
-
A reporting or read-only grid displays data for viewing only — no inline editing, no action menus (unless for navigation/export). Common use cases: audit logs, historical trades, P&L reports, position snapshots, compliance views.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
### Key differences from a blotter
|
|
53
|
-
|
|
54
|
-
| Feature | Blotter | Report |
|
|
55
|
-
|---|---|---|
|
|
56
|
-
| Editing | Inline or modal edit | None |
|
|
57
|
-
| Action column | Edit + Cancel + View | Export / Drill-down only (or omit) |
|
|
58
|
-
| Data mode | \`isSnapshot: false\` (live) | \`isSnapshot: true\` (snapshot) |
|
|
59
|
-
| Row selection | Drives detail tile | Optional — for drill-down only |
|
|
60
|
-
| Criteria | User's book / desk | Date range, instrument, status |
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
### Import paths (verified)
|
|
65
|
-
|
|
66
|
-
\`\`\`tsx
|
|
67
|
-
// EntityManagement read-only approach
|
|
68
|
-
import { EntityManagement } from '@genesislcap/foundation-entity-management/react';
|
|
69
|
-
import type { DatasourceConfiguration } from '@genesislcap/foundation-entity-management';
|
|
70
|
-
|
|
71
|
-
// Standalone RapidGridPro approach
|
|
72
|
-
import { RapidGridPro } from '@genesislcap/rapid-grid-pro/react';
|
|
73
|
-
import { GridProGenesisDatasource, GridProColumn } from '@genesislcap/grid-pro/react';
|
|
74
|
-
import type { GridProColumnRef } from '@genesislcap/grid-pro/react';
|
|
75
|
-
|
|
76
|
-
// Column defs (always .ts, never .tsx)
|
|
77
|
-
import type { ColDef } from '@ag-grid-community/core';
|
|
78
|
-
|
|
79
|
-
// Actions column for export — import from grid-pro root (NOT /react)
|
|
80
|
-
import { getActionsMenuDef } from '@genesislcap/grid-pro';
|
|
81
|
-
\`\`\`
|
|
82
|
-
|
|
83
|
-
> **CRITICAL:** \`EntityManagement\` imports from \`@genesislcap/foundation-entity-management/react\`, NOT from \`@genesislcap/rapid-grid-pro\` or \`@genesislcap/rapid-grid-pro/react\`.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
### Pattern 1 — EntityManagement read-only (preferred for simple reports)
|
|
88
|
-
|
|
89
|
-
CRUD buttons render ONLY when their event props are set (verified in entities.template.ts:
|
|
90
|
-
Create requires \`createEvent\`; Edit renders when \`updateEvent && !hideEdit\`; Delete when
|
|
91
|
-
\`deleteEvent && !hideDelete\`). A read-only report simply OMITS \`createEvent\`/\`updateEvent\`/
|
|
92
|
-
\`deleteEvent\` — no extra props needed. \`hideEdit\`/\`hideDelete\` only matter when those events ARE
|
|
93
|
-
set. There is no \`hideCreate\`, and \`readonly\` is \`@internal\` (modal-form read mode, toggled by
|
|
94
|
-
the component itself) — never set either. Set \`isSnapshot: true\` in \`datasourceConfig\`.
|
|
95
|
-
|
|
96
|
-
The column prop on \`EntityManagement\` is \`columns\` (type \`GridColDef[]\` from \`@genesislcap/foundation-entity-management\`), NOT \`columnDefs\`.
|
|
97
|
-
|
|
98
|
-
\`\`\`tsx
|
|
99
|
-
import { EntityManagement } from '@genesislcap/foundation-entity-management/react';
|
|
100
|
-
import type { DatasourceConfiguration, GridColDef } from '@genesislcap/foundation-entity-management';
|
|
101
|
-
import { useMemo } from 'react';
|
|
102
|
-
|
|
103
|
-
const auditColumns: GridColDef[] = [
|
|
104
|
-
{ field: 'TIMESTAMP', headerName: 'Timestamp', sortable: true, resizable: true },
|
|
105
|
-
{ field: 'USER_NAME', headerName: 'User', sortable: true, resizable: true },
|
|
106
|
-
{ field: 'EVENT_TYPE', headerName: 'Event', sortable: true, resizable: true },
|
|
107
|
-
{ field: 'DETAILS', headerName: 'Details', flex: 1, resizable: true },
|
|
108
|
-
];
|
|
109
|
-
|
|
110
|
-
export const AuditLogGrid: React.FC = () => {
|
|
111
|
-
const datasourceConfig: DatasourceConfiguration = useMemo(() => ({
|
|
112
|
-
isSnapshot: true, // snapshot — no live subscription
|
|
113
|
-
requestAutoSetup: false, // ALWAYS false — see the note under this example
|
|
114
|
-
}), []);
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<EntityManagement
|
|
118
|
-
title="Audit Log"
|
|
119
|
-
resourceName="TRADE_AUDIT"
|
|
120
|
-
columns={auditColumns}
|
|
121
|
-
datasourceConfig={datasourceConfig}
|
|
122
|
-
// No createEvent / updateEvent / deleteEvent → NO CRUD buttons render. Done.
|
|
123
|
-
/>
|
|
124
|
-
);
|
|
125
|
-
};
|
|
126
|
-
\`\`\`
|
|
127
|
-
|
|
128
|
-
**Always set \`isSnapshot: true\`** for historical / report data — live subscriptions on large historical tables are expensive and unnecessary.
|
|
129
|
-
|
|
130
|
-
**The audit resource is \`<ENTITY>_AUDIT\`** (\`TRADE_AUDIT\` here) — a snapshot (request-reply) resource generated for an audited entity. The entity aspect's \`audit\` block names it and reports its request index when the generated code declares one; don't assume an index name it did not report. There is no \`ALL_AUDIT_TRAIL\`; confirm the real name with \`query_project_schema('queries')\` (\`snapshotResources\`) before binding it.
|
|
131
|
-
|
|
132
|
-
#### \`requestAutoSetup\` must ALWAYS be \`false\` — it is not about fetching
|
|
133
|
-
|
|
134
|
-
\`requestAutoSetup\` does NOT mean "fetch automatically". It controls whether the datasource builds
|
|
135
|
-
the \`REQUEST\` object for you, and its default (\`true\`) **silently breaks any \`criteria\` you pass**.
|
|
136
|
-
|
|
137
|
-
On a Request Server resource — Create's codegen emits BOTH a Data Server query and a
|
|
138
|
-
request/reply resource per entity or view, so what decides this is the resource NAME you pass, not
|
|
139
|
-
whether an entity backs it —
|
|
140
|
-
\`foundation-comms\` reads the flag in exactly two places, both on the request path:
|
|
141
|
-
|
|
142
|
-
\`\`\`js
|
|
143
|
-
CRITERIA_MATCH: !this.options.requestAutoSetup ? DETAILS.CRITERIA_MATCH : undefined // dropped when true
|
|
144
|
-
buildRequestFields() { if (!this.options.requestAutoSetup) return {}; /* else criteriaToFields(criteria) */ }
|
|
145
|
-
\`\`\`
|
|
146
|
-
|
|
147
|
-
So with the default your \`CRITERIA_MATCH\` is thrown away and the criteria is rewritten into a
|
|
148
|
-
\`REQUEST\` field object. Nothing throws — the grid just returns unfiltered or empty rows, which is
|
|
149
|
-
extremely hard to trace back to this flag.
|
|
150
|
-
|
|
151
|
-
**Set \`requestAutoSetup: false\` whenever you pass \`criteria\`, and prefer it by default.** You do
|
|
152
|
-
NOT need to work out whether the resource is a Data Server or a Request Server one: the flag is only
|
|
153
|
-
ever read on the REQUEST_SERVER path, so on a Data Server resource it is an inert no-op. This is
|
|
154
|
-
exactly what \`blank-app-seed\` generates for every request/reply tile
|
|
155
|
-
(\`.genx/templates/react/component/component.hbs\` hardcodes \`requestAutoSetup: false\`), so matching
|
|
156
|
-
it keeps hand-written code consistent with the generated baseline.
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
### Pattern 2 — Standalone RapidGridPro (preferred when no CRUD is needed at all)
|
|
161
|
-
|
|
162
|
-
When there is zero need for EntityManagement's CRUD machinery, use \`RapidGridPro\` directly. This is the lightest composition and matches the sales-trader-hub blotter pattern.
|
|
163
|
-
|
|
164
|
-
\`\`\`tsx
|
|
165
|
-
import { useMemo } from 'react';
|
|
166
|
-
import { RapidGridPro } from '@genesislcap/rapid-grid-pro/react';
|
|
167
|
-
import { GridProGenesisDatasource, GridProColumn } from '@genesislcap/grid-pro/react';
|
|
168
|
-
import type { GridProColumnRef } from '@genesislcap/grid-pro/react';
|
|
169
|
-
import { GridProCaseType } from '@genesislcap/grid-pro';
|
|
170
|
-
import type { ColDef } from '@ag-grid-community/core';
|
|
171
|
-
import { getDateFormatter, getNumberFormatter } from '@genesislcap/foundation-utils';
|
|
172
|
-
|
|
173
|
-
// Module-scope formatters (full reference: fui-formatters)
|
|
174
|
-
const priceFormatter = getNumberFormatter('0,0.00'); // 1,234.50
|
|
175
|
-
const qtyFormatter = getNumberFormatter('0,0'); // 250,000
|
|
176
|
-
const dateFormatter = getDateFormatter(); // DATE/DATETIME arrive as ms timestamps
|
|
177
|
-
|
|
178
|
-
const COLUMN_DEFS: ColDef[] = [
|
|
179
|
-
{ field: 'TRADE_ID', headerName: 'Trade ID', sortable: true, resizable: true },
|
|
180
|
-
{ field: 'INSTRUMENT', headerName: 'Instrument', sortable: true, resizable: true, flex: 1 },
|
|
181
|
-
{ field: 'QUANTITY', headerName: 'Qty', sortable: true, resizable: true, type: 'numericColumn', valueFormatter: qtyFormatter },
|
|
182
|
-
{ field: 'PRICE', headerName: 'Price', sortable: true, resizable: true, type: 'numericColumn', valueFormatter: priceFormatter },
|
|
183
|
-
{ field: 'TRADE_DATE', headerName: 'Date', sortable: true, resizable: true, valueFormatter: dateFormatter },
|
|
184
|
-
];
|
|
185
|
-
|
|
186
|
-
export const TradeHistoryReport: React.FC = () => {
|
|
187
|
-
const columnDefs = useMemo(() => COLUMN_DEFS, []);
|
|
188
|
-
|
|
189
|
-
return (
|
|
190
|
-
<RapidGridPro
|
|
191
|
-
headerCaseType={GridProCaseType.capitalCase}
|
|
192
|
-
onlyTemplateColDefs
|
|
193
|
-
enableCellFlashing
|
|
194
|
-
persistColumnStateKey="trade-history-columns"
|
|
195
|
-
sizeColumnsToFit
|
|
196
|
-
>
|
|
197
|
-
<GridProGenesisDatasource
|
|
198
|
-
resourceName="ALL_TRADES"
|
|
199
|
-
isSnapshot
|
|
200
|
-
maxRows={1000}
|
|
201
|
-
/>
|
|
202
|
-
{columnDefs.map((col) => (
|
|
203
|
-
<GridProColumn
|
|
204
|
-
key={col.field ?? col.headerName}
|
|
205
|
-
ref={(el: GridProColumnRef | null) => {
|
|
206
|
-
if (el) el.definition = col;
|
|
207
|
-
}}
|
|
208
|
-
/>
|
|
209
|
-
))}
|
|
210
|
-
</RapidGridPro>
|
|
211
|
-
);
|
|
212
|
-
};
|
|
213
|
-
\`\`\`
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
### Pattern 3 — Date-range criteria filtering
|
|
218
|
-
|
|
219
|
-
Most reports are filtered by a date range selected by the user. Pass a Groovy criteria string to the datasource.
|
|
220
|
-
|
|
221
|
-
\`\`\`tsx
|
|
222
|
-
import { useState, useMemo } from 'react';
|
|
223
|
-
import { DatePicker } from '@genesislcap/rapid-design-system/react';
|
|
224
|
-
import { RapidGridPro } from '@genesislcap/rapid-grid-pro/react';
|
|
225
|
-
import { GridProGenesisDatasource } from '@genesislcap/grid-pro/react';
|
|
226
|
-
import { GridProCaseType } from '@genesislcap/grid-pro';
|
|
227
|
-
|
|
228
|
-
// DatePicker ALWAYS emits MM-DD-YYYY in e.detail — its internal DATE_PICKER_VALUE_FORMAT — no
|
|
229
|
-
// matter what \`format\` is set to. Criteria strings need ISO, so convert before storing.
|
|
230
|
-
// (Plain string reshuffle: dayjs is not a dependency of generated apps — see DP-8.)
|
|
231
|
-
const toIsoDate = (value: string | undefined): string => {
|
|
232
|
-
const [mm, dd, yyyy] = (value ?? '').split('-');
|
|
233
|
-
return yyyy && mm && dd ? \`\${yyyy}-\${mm}-\${dd}\` : '';
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export const DateRangeReport: React.FC = () => {
|
|
237
|
-
// Both hold ISO (YYYY-MM-DD) — never feed these back into DatePicker's \`value\`, which expects
|
|
238
|
-
// MM-DD-YYYY. Leave the picker uncontrolled with \`allowEmpty\` and let it own its own display.
|
|
239
|
-
const [fromDate, setFromDate] = useState('');
|
|
240
|
-
const [toDate, setToDate] = useState('');
|
|
241
|
-
|
|
242
|
-
const criteria = useMemo(() => {
|
|
243
|
-
if (!fromDate || !toDate) return undefined;
|
|
244
|
-
return \`TRADE_DATE >= '\${fromDate}' && TRADE_DATE <= '\${toDate}'\`;
|
|
245
|
-
}, [fromDate, toDate]);
|
|
246
|
-
|
|
247
|
-
return (
|
|
248
|
-
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
|
249
|
-
<div style={{ display: 'flex', gap: 8, padding: 8 }}>
|
|
250
|
-
{/* DatePicker, never <input type="date"> — the raw input misses the theme entirely.
|
|
251
|
-
CONVERT THE VALUE: DatePicker always emits MM-DD-YYYY regardless of \`format\`
|
|
252
|
-
(\`format\` styles the DISPLAY only) — see the note under this snippet. */}
|
|
253
|
-
<DatePicker
|
|
254
|
-
label="From"
|
|
255
|
-
allowEmpty
|
|
256
|
-
format="DD/MM/YYYY"
|
|
257
|
-
onValueChanged={(e: CustomEvent<string | undefined>) => setFromDate(toIsoDate(e.detail))}
|
|
258
|
-
/>
|
|
259
|
-
<DatePicker
|
|
260
|
-
label="To"
|
|
261
|
-
allowEmpty
|
|
262
|
-
format="DD/MM/YYYY"
|
|
263
|
-
onValueChanged={(e: CustomEvent<string | undefined>) => setToDate(toIsoDate(e.detail))}
|
|
264
|
-
/>
|
|
265
|
-
</div>
|
|
266
|
-
<RapidGridPro headerCaseType={GridProCaseType.capitalCase} sizeColumnsToFit>
|
|
267
|
-
<GridProGenesisDatasource
|
|
268
|
-
resourceName="ALL_TRADES"
|
|
269
|
-
isSnapshot
|
|
270
|
-
criteria={criteria}
|
|
271
|
-
requestAutoSetup={false}
|
|
272
|
-
/>
|
|
273
|
-
</RapidGridPro>
|
|
274
|
-
</div>
|
|
275
|
-
);
|
|
276
|
-
};
|
|
277
|
-
\`\`\`
|
|
278
|
-
|
|
279
|
-
> **DANGEROUS: \`DatePicker\` does NOT emit the format you display.** \`format\` (and
|
|
280
|
-
> \`useLocaleFormat\`) control the DISPLAYED text only. The value in \`e.detail\` is always
|
|
281
|
-
> \`MM-DD-YYYY\` — foundation-ui's internal \`DATE_PICKER_VALUE_FORMAT\`
|
|
282
|
-
> (\`date-picker.util.js\`; \`date-picker.js\` emits \`dayjs(day.Date).format(DATE_PICKER_VALUE_FORMAT)\`).
|
|
283
|
-
>
|
|
284
|
-
> Dropping \`e.detail\` straight into a criteria string is the trap: picking 28 Aug 2026 gives
|
|
285
|
-
> \`"08-28-2026"\`, so \`TRADE_DATE >= '08-28-2026'\` silently returns wrong or zero rows. It
|
|
286
|
-
> **compiles cleanly**, so no gate catches it — always convert to ISO first, as \`toIsoDate\` above.
|
|
287
|
-
>
|
|
288
|
-
> The same applies in reverse: \`value\` expects \`MM-DD-YYYY\`, so never round-trip an ISO string
|
|
289
|
-
> back into the picker. Keep it uncontrolled with \`allowEmpty\`.
|
|
290
|
-
|
|
291
|
-
Date values: use ISO 8601 strings (\`YYYY-MM-DD\` or \`YYYY-MM-DDTHH:mm:ss\`) — match the field type in the view.
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
### Export column pattern (optional)
|
|
296
|
-
|
|
297
|
-
If the user wants a single CSV export button on an EntityManagement report grid, the built-in
|
|
298
|
-
\`enableCsvExport\` prop is first choice (\`{ buttonName?: string; fileName?: string }\`); for custom export logic add a
|
|
299
|
-
\`customActions\` entry with
|
|
300
|
-
\`position: CrudMenuPosition.Top\` whose \`action\` is \`{ type: 'callback', callback: () => gridApi.exportDataAsCsv() }\` —
|
|
301
|
-
one real toolbar button, no wrapper div and no per-row column. For a standalone RapidGridPro grid there is no toolbar or
|
|
302
|
-
\`customActions\` API: use ag-Grid's native CSV export via the grid API, or a pinned per-row action column via
|
|
303
|
-
\`getActionsMenuDef\` only when the export genuinely belongs per row. There are no \`exportCsv\`/\`exportExcel\` flags on
|
|
304
|
-
\`getActionsMenuDef\`.
|
|
305
|
-
|
|
306
|
-
**Verified signature:** \`getActionsMenuDef(actions: ActionMenuItem[], overrideDef?: ColDef, customActionsOpenerName?: string, isVertical?: boolean, buttonAppearance?: string): ColDef\`
|
|
307
|
-
\`ActionMenuItem\` = \`{ name: string | ((rowData) => string); callback: (rowData) => void; isDisabled?: (rowData) => boolean; color?: string }\` — exported from \`@genesislcap/foundation-ui\` root.
|
|
308
|
-
|
|
309
|
-
\`\`\`ts
|
|
310
|
-
// ReportColumnDefs.ts — must be .ts, never .tsx
|
|
311
|
-
import type { ColDef } from '@ag-grid-community/core';
|
|
312
|
-
import { getActionsMenuDef } from '@genesislcap/grid-pro';
|
|
313
|
-
import type { ActionMenuItem } from '@genesislcap/foundation-ui';
|
|
314
|
-
|
|
315
|
-
// EntityManagement report — a real toolbar button, not a per-row column:
|
|
316
|
-
import { CrudMenuPosition, type CustomAction } from '@genesislcap/foundation-entity-management';
|
|
317
|
-
|
|
318
|
-
export const makeExportCustomAction = (onExportCsv: () => void): CustomAction => ({
|
|
319
|
-
name: 'Export CSV',
|
|
320
|
-
position: CrudMenuPosition.Top,
|
|
321
|
-
requiresSelection: false,
|
|
322
|
-
appearance: 'secondary',
|
|
323
|
-
action: { type: 'callback', callback: onExportCsv },
|
|
324
|
-
});
|
|
325
|
-
// <EntityManagement ... customActions={[makeExportCustomAction(() => gridApi.exportDataAsCsv())]} />
|
|
326
|
-
|
|
327
|
-
// Standalone RapidGridPro only (no EntityManagement, so no customActions API) — a pinned action column:
|
|
328
|
-
export const makeExportActionsCol = (onExportCsv: () => void): ColDef => {
|
|
329
|
-
const actions: ActionMenuItem[] = [{ name: 'Export CSV', callback: onExportCsv }];
|
|
330
|
-
return getActionsMenuDef(actions, { headerName: '', width: 60, pinned: 'right' });
|
|
331
|
-
};
|
|
332
|
-
\`\`\`
|
|
333
|
-
|
|
334
|
-
Do NOT add edit/delete actions to a reporting grid unless explicitly asked.
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
### Column definition guidelines for reports
|
|
339
|
-
|
|
340
|
-
| Recommendation | Reason |
|
|
341
|
-
|---|---|
|
|
342
|
-
| \`sortable: true\` on most columns | Reports are often re-sorted by users |
|
|
343
|
-
| \`filter: true\` on key columns | Allows client-side column filtering |
|
|
344
|
-
| \`resizable: true\` globally | Report grids are wide — users resize columns |
|
|
345
|
-
| \`editable: false\` (explicit) on all columns | Prevents accidental editable inheritance |
|
|
346
|
-
| Use \`valueFormatter\` for numbers | Consistent decimal/currency display |
|
|
347
|
-
| Pin ID column left | Keeps context visible during horizontal scroll |
|
|
348
|
-
|
|
349
|
-
\`\`\`ts
|
|
350
|
-
// defaultColDef pattern for reports
|
|
351
|
-
const defaultColDef: ColDef = {
|
|
352
|
-
sortable: true,
|
|
353
|
-
filter: true,
|
|
354
|
-
resizable: true,
|
|
355
|
-
editable: false, // explicit — prevents accidental editable inheritance
|
|
356
|
-
};
|
|
357
|
-
\`\`\`
|
|
358
|
-
|
|
359
|
-
---
|
|
360
|
-
|
|
361
|
-
### Snapshot vs live vs polling
|
|
362
|
-
|
|
363
|
-
\`\`\`ts
|
|
364
|
-
// Data Server query (e.g. ALL_TRADES) — live stream by default; isSnapshot = point-in-time report:
|
|
365
|
-
<GridProGenesisDatasource resourceName="ALL_TRADES" isSnapshot />
|
|
366
|
-
<GridProGenesisDatasource resourceName="ALL_TRADES" /> // live blotter
|
|
367
|
-
|
|
368
|
-
// Request Server resource (REQ_*) — auto-polled every 5000ms by default;
|
|
369
|
-
// pollingInterval tunes it, disablePolling stops it (both REQUEST_SERVER only):
|
|
370
|
-
<GridProGenesisDatasource resourceName="REQ_TRADE_SUMMARY" pollingInterval={30000} />
|
|
371
|
-
\`\`\`
|
|
372
|
-
|
|
373
|
-
\`pollingInterval\` is **REQUEST_SERVER only** — on a Data Server query it is silently ignored
|
|
374
|
-
(the grid is already real-time). Do not add it to "refresh" a Data Server report.
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
### Related contexts to load for a reporting page
|
|
379
|
-
|
|
380
|
-
| Context | When needed |
|
|
381
|
-
|---|---|
|
|
382
|
-
| \`fui-column-defs\` | Always — column definitions, valueFormatter, renderers |
|
|
383
|
-
| \`fui-rapid-grid-pro\` | When using standalone RapidGridPro |
|
|
384
|
-
| \`fui-entity-management\` | When using EntityManagement for the reporting grid |
|
|
385
|
-
| \`fui-flexlayout\` | When the report is one tile in a multi-tile page |
|
|
386
|
-
| \`fui-global-filters\` | When a shared filter bar drives the report criteria |
|
|
387
|
-
| \`fui-eventing\` | When selecting a row in this report drives a detail panel |
|
|
388
|
-
|
|
389
|
-
---
|
|
390
|
-
|
|
391
|
-
### DANGEROUS PATTERNS
|
|
392
|
-
|
|
393
|
-
#### DP-1: Wrong EntityManagement import path
|
|
394
|
-
|
|
395
|
-
\`\`\`tsx
|
|
396
|
-
// WRONG — EntityManagement is NOT in rapid-grid-pro:
|
|
397
|
-
import { EntityManagement } from '@genesislcap/rapid-grid-pro';
|
|
398
|
-
import { EntityManagement } from '@genesislcap/rapid-grid-pro/react';
|
|
399
|
-
|
|
400
|
-
// CORRECT — EntityManagement lives in foundation-entity-management:
|
|
401
|
-
import { EntityManagement } from '@genesislcap/foundation-entity-management/react';
|
|
402
|
-
\`\`\`
|
|
403
|
-
|
|
404
|
-
#### DP-2: Wrong DatasourceConfiguration import path
|
|
405
|
-
|
|
406
|
-
\`\`\`tsx
|
|
407
|
-
// WRONG — DatasourceConfiguration is a type from foundation-entity-management, not /react:
|
|
408
|
-
import type { DatasourceConfiguration } from '@genesislcap/foundation-entity-management/react';
|
|
409
|
-
|
|
410
|
-
// CORRECT — types import from the base package root:
|
|
411
|
-
import type { DatasourceConfiguration } from '@genesislcap/foundation-entity-management';
|
|
412
|
-
\`\`\`
|
|
413
|
-
|
|
414
|
-
#### DP-3: Live subscription for historical/report data
|
|
415
|
-
|
|
416
|
-
\`\`\`tsx
|
|
417
|
-
// WRONG — live subscription on a large historical table is expensive and unnecessary:
|
|
418
|
-
<GridProGenesisDatasource resourceName="TRADE_AUDIT" />
|
|
419
|
-
|
|
420
|
-
// CORRECT — use isSnapshot for report/historical data:
|
|
421
|
-
<GridProGenesisDatasource resourceName="TRADE_AUDIT" isSnapshot />
|
|
422
|
-
\`\`\`
|
|
423
|
-
|
|
424
|
-
#### DP-4: pollingInterval on a Data Server query
|
|
425
|
-
|
|
426
|
-
\`\`\`ts
|
|
427
|
-
// WRONG — pollingInterval is REQUEST_SERVER only; on a Data Server query it is silently
|
|
428
|
-
// ignored (a live query streams updates already, a snapshot stays a one-off read):
|
|
429
|
-
<GridProGenesisDatasource resourceName="ALL_TRADES" isSnapshot pollingInterval={5000} />
|
|
430
|
-
|
|
431
|
-
// CORRECT — Data Server: isSnapshot (point-in-time) or live (omit it):
|
|
432
|
-
<GridProGenesisDatasource resourceName="ALL_TRADES" isSnapshot />
|
|
433
|
-
// Polling belongs to Request Server (REQ_*) resources only:
|
|
434
|
-
<GridProGenesisDatasource resourceName="REQ_TRADE_SUMMARY" pollingInterval={30000} />
|
|
435
|
-
\`\`\`
|
|
436
|
-
|
|
437
|
-
#### DP-5: Leaving editable columns in a report
|
|
438
|
-
|
|
439
|
-
\`\`\`ts
|
|
440
|
-
// WRONG — a reporting grid must not have editable columns:
|
|
441
|
-
const col: ColDef = { field: 'PRICE', editable: true };
|
|
442
|
-
|
|
443
|
-
// CORRECT — explicitly set editable: false on all columns (or via defaultColDef):
|
|
444
|
-
const col: ColDef = { field: 'PRICE', editable: false };
|
|
445
|
-
\`\`\`
|
|
446
|
-
|
|
447
|
-
#### DP-6: Showing edit/delete actions in a reporting grid
|
|
448
|
-
|
|
449
|
-
\`\`\`tsx
|
|
450
|
-
// WRONG — including edit/delete in the actions column of a report:
|
|
451
|
-
const actionsCol = getActionsMenuDef([
|
|
452
|
-
{ name: 'Edit', callback: handleEdit },
|
|
453
|
-
{ name: 'Delete', callback: handleDelete },
|
|
454
|
-
]);
|
|
455
|
-
|
|
456
|
-
// CORRECT — for an EntityManagement report, a toolbar customAction, not a per-row column
|
|
457
|
-
// (getActionsMenuDef stays right ONLY for a standalone RapidGridPro grid, or a genuinely per-row action):
|
|
458
|
-
const customActions: CustomAction[] = [{
|
|
459
|
-
name: 'Export CSV',
|
|
460
|
-
position: CrudMenuPosition.Top,
|
|
461
|
-
requiresSelection: false,
|
|
462
|
-
action: { type: 'callback', callback: () => gridRef.current?.exportDataAsCsv() },
|
|
463
|
-
}];
|
|
464
|
-
// <EntityManagement ... customActions={customActions} />
|
|
465
|
-
\`\`\`
|
|
466
|
-
|
|
467
|
-
#### DP-7: Wrong prop name for column definitions on EntityManagement
|
|
468
|
-
|
|
469
|
-
\`\`\`tsx
|
|
470
|
-
// WRONG — EntityManagement does NOT have a columnDefs prop:
|
|
471
|
-
<EntityManagement columnDefs={myColumns} resourceName="ALL_TRADES" />
|
|
472
|
-
|
|
473
|
-
// CORRECT — the prop is columns (type GridColDef[] from @genesislcap/foundation-entity-management):
|
|
474
|
-
import type { GridColDef } from '@genesislcap/foundation-entity-management';
|
|
475
|
-
const myColumns: GridColDef[] = [{ field: 'TRADE_ID', headerName: 'Trade ID' }];
|
|
476
|
-
<EntityManagement columns={myColumns} resourceName="ALL_TRADES" />
|
|
477
|
-
\`\`\`
|
|
478
|
-
|
|
479
|
-
#### DP-8: Using hideCreate or readonly to suppress CRUD buttons
|
|
480
|
-
|
|
481
|
-
\`\`\`tsx
|
|
482
|
-
// WRONG — hideCreate is not a prop, and readonly is @internal (modal-form read mode,
|
|
483
|
-
// toggled by the component itself — it does NOT remove CRUD buttons):
|
|
484
|
-
<EntityManagement hideCreate readonly resourceName="ALL_TRADES" />
|
|
485
|
-
|
|
486
|
-
// CORRECT — buttons only render when their event prop is set; omit the events you don't want:
|
|
487
|
-
<EntityManagement resourceName="ALL_TRADES" /> // no CRUD at all
|
|
488
|
-
<EntityManagement resourceName="ALL_TRADES" createEvent="EVENT_TRADE_INSERT" /> // Create only
|
|
489
|
-
// hideEdit / hideDelete are for hiding buttons when updateEvent/deleteEvent ARE set:
|
|
490
|
-
<EntityManagement resourceName="ALL_TRADES" updateEvent="EVENT_TRADE_MODIFY" hideEdit />
|
|
491
|
-
\`\`\`
|
|
492
|
-
|
|
493
|
-
#### DP-9: Using isSnapshot inside DatasourceConfiguration object for EntityManagement without useMemo
|
|
494
|
-
|
|
495
|
-
\`\`\`tsx
|
|
496
|
-
// WRONG — inline object literal on every render causes EntityManagement to re-subscribe:
|
|
497
|
-
<EntityManagement
|
|
498
|
-
datasourceConfig={{ isSnapshot: true, requestAutoSetup: false }}
|
|
499
|
-
resourceName="TRADE_AUDIT"
|
|
500
|
-
/>
|
|
501
|
-
|
|
502
|
-
// CORRECT — memoize the datasourceConfig to keep the reference stable:
|
|
503
|
-
const datasourceConfig = useMemo(() => ({ isSnapshot: true, requestAutoSetup: false }), []);
|
|
504
|
-
<EntityManagement datasourceConfig={datasourceConfig} resourceName="TRADE_AUDIT" />
|
|
505
|
-
\`\`\`
|
|
506
|
-
`.trim();
|