@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,538 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context injected into the UI Builder system prompt.
|
|
3
|
-
* Covers the programmatic criteria / expression API:
|
|
4
|
-
* - CriteriaBuilder, ExpressionBuilder, Serialisers, Join (foundation-criteria)
|
|
5
|
-
* - getCriteriaBuilder, AvailableOption, INPUT_MIN_LENGTH (foundation-ui search-bar helpers)
|
|
6
|
-
* - EntityManagement enableSearchBar + searchBarConfig pattern
|
|
7
|
-
* - React SegmentedControl/SegmentedItem for segmented filter UIs
|
|
8
|
-
*
|
|
9
|
-
* SOURCE NOTES:
|
|
10
|
-
* - CriteriaBuilder / ExpressionBuilder / Serialisers / Join / CriteriaSegmentedControlOption verified against:
|
|
11
|
-
* foundation-criteria/dist/dts/{criteria-builder,expression-builder,serialisers,types}.d.ts
|
|
12
|
-
* foundation-criteria/src/{criteria-builder,expression-builder,form-criteria-builder,serialisers,types}.ts
|
|
13
|
-
* - getCriteriaBuilder / AvailableOption / INPUT_MIN_LENGTH verified against:
|
|
14
|
-
* foundation-ui/dist/dts/search-bar/search-bar.types.d.ts
|
|
15
|
-
* - EntityManagement searchBarConfig / enableSearchBar verified against:
|
|
16
|
-
* foundation-entity-management/dist/dts/entities/entities.d.ts (enableSearchBar boolean attr; searchBarConfig AvailableOption[])
|
|
17
|
-
* showcase react-client Admin.tsx + AdminEntityManagementSSMRColumnActions.tsx (real usage)
|
|
18
|
-
* - SegmentedControl / SegmentedItem React wrappers verified against:
|
|
19
|
-
* rapid-design-system/dist/dts/react.d.ts
|
|
20
|
-
* - CriteriaSegmentedControl is a WC only — NO /react subpath; use SegmentedControl from rapid-design-system/react instead
|
|
21
|
-
* - @genesislcap/foundation-criteria has NO /react subpath — all exports are from the package root
|
|
22
|
-
*
|
|
23
|
-
* RELATIONSHIP TO fui-global-filters:
|
|
24
|
-
* fui-global-filters covers the full Filters component (Option A) and the global Redux filter pattern (Option B).
|
|
25
|
-
* THIS module covers the lower-level building blocks: CriteriaBuilder/ExpressionBuilder API, Serialisers reference,
|
|
26
|
-
* EntityManagement search bar config, and the React segmented filter control pattern.
|
|
27
|
-
* When the user asks for a filter UI backed by the Filters component, load fui-global-filters instead.
|
|
28
|
-
*/
|
|
29
|
-
export const FUI_CRITERIA_TAGS = [
|
|
30
|
-
// natural-language phrases
|
|
31
|
-
'criteria builder',
|
|
32
|
-
'expression builder',
|
|
33
|
-
'build criteria',
|
|
34
|
-
'construct criteria',
|
|
35
|
-
'criteria string',
|
|
36
|
-
'criteria expression',
|
|
37
|
-
'criteria filter',
|
|
38
|
-
'segmented filter',
|
|
39
|
-
'segmented control filter',
|
|
40
|
-
'search bar config',
|
|
41
|
-
'entity search bar',
|
|
42
|
-
'quick search',
|
|
43
|
-
'filter by instrument',
|
|
44
|
-
'filter by field',
|
|
45
|
-
'filter with segments',
|
|
46
|
-
'tab filter',
|
|
47
|
-
'toolbar filter',
|
|
48
|
-
// technical identifiers
|
|
49
|
-
'CriteriaBuilder',
|
|
50
|
-
'ExpressionBuilder',
|
|
51
|
-
'createFormCriteriaBuilder',
|
|
52
|
-
'Serialisers',
|
|
53
|
-
'Join',
|
|
54
|
-
'getCriteriaBuilder',
|
|
55
|
-
'AvailableOption',
|
|
56
|
-
'INPUT_MIN_LENGTH',
|
|
57
|
-
'enableSearchBar',
|
|
58
|
-
'searchBarConfig',
|
|
59
|
-
'CriteriaSegmentedControl',
|
|
60
|
-
'CriteriaSegmentedControlOption',
|
|
61
|
-
'foundation-criteria',
|
|
62
|
-
'withExpression',
|
|
63
|
-
'withField',
|
|
64
|
-
'withValue',
|
|
65
|
-
'withSerialiser',
|
|
66
|
-
];
|
|
67
|
-
export const FUI_CRITERIA_DEPS = ['fui-global-filters'];
|
|
68
|
-
export const FUI_CRITERIA_CONTEXT = `
|
|
69
|
-
## CRITERIA / EXPRESSION BUILDER API
|
|
70
|
-
|
|
71
|
-
> **Relationship to fui-global-filters:**
|
|
72
|
-
> - Use **fui-global-filters** when you need a filter UI component (the \`Filters\` component — Option A)
|
|
73
|
-
> or a full global Redux filter bar (Option B).
|
|
74
|
-
> - Use **this module** when you need to:
|
|
75
|
-
> (a) build criteria strings programmatically in a Redux selector / event handler,
|
|
76
|
-
> (b) wire the EntityManagement search bar (\`enableSearchBar\` + \`searchBarConfig\`), or
|
|
77
|
-
> (c) render a React segmented filter control.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
### Import paths (verified)
|
|
82
|
-
|
|
83
|
-
\`\`\`ts
|
|
84
|
-
// CriteriaBuilder, ExpressionBuilder, Serialisers, Join, CriteriaSegmentedControlOption
|
|
85
|
-
// — pure TypeScript utilities, NO /react subpath.
|
|
86
|
-
import {
|
|
87
|
-
CriteriaBuilder,
|
|
88
|
-
ExpressionBuilder,
|
|
89
|
-
Serialisers,
|
|
90
|
-
Join,
|
|
91
|
-
} from '@genesislcap/foundation-criteria';
|
|
92
|
-
import type { CriteriaSegmentedControlOption } from '@genesislcap/foundation-criteria';
|
|
93
|
-
|
|
94
|
-
// getCriteriaBuilder, AvailableOption, INPUT_MIN_LENGTH — from foundation-ui root
|
|
95
|
-
import { getCriteriaBuilder, INPUT_MIN_LENGTH } from '@genesislcap/foundation-ui';
|
|
96
|
-
import type { AvailableOption } from '@genesislcap/foundation-ui';
|
|
97
|
-
|
|
98
|
-
// React segmented control (design system) — use this instead of CriteriaSegmentedControl WC
|
|
99
|
-
import { SegmentedControl, SegmentedItem } from '@genesislcap/rapid-design-system/react';
|
|
100
|
-
\`\`\`
|
|
101
|
-
|
|
102
|
-
> **CRITICAL:** \`@genesislcap/foundation-criteria\` has NO \`/react\` subpath.
|
|
103
|
-
> The \`CriteriaSegmentedControl\` web component has no React wrapper.
|
|
104
|
-
> For segmented filter UIs in React, use \`SegmentedControl\` / \`SegmentedItem\` from
|
|
105
|
-
> \`@genesislcap/rapid-design-system/react\` (verified in rapid-design-system/dist/dts/react.d.ts).
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
### CriteriaBuilder — programmatic criteria string construction
|
|
110
|
-
|
|
111
|
-
\`CriteriaBuilder\` assembles an \`Expression | ExpressionList\` tree into a criteria string
|
|
112
|
-
(e.g. \`"(SIDE == "BUY" && TRADE_DATE >= 20260101)"\`) suitable for passing to datasource \`criteria\` props.
|
|
113
|
-
|
|
114
|
-
| Method | Signature | Notes |
|
|
115
|
-
|---|---|---|
|
|
116
|
-
| \`withExpression(expression, options?, groupJoin?)\` | \`ValidExpressionType\` → \`this\` | Core method; fluent API |
|
|
117
|
-
| \`And(expression, options?)\` | shorthand for \`withExpression(e, opts, Join.And())\` | Most common |
|
|
118
|
-
| \`Or(expression, options?)\` | shorthand for \`withExpression(e, opts, Join.Or())\` | Multi-value OR |
|
|
119
|
-
| \`Not(expression, options?)\` | shorthand for \`withExpression(e, opts, Join.Not())\` | Negation |
|
|
120
|
-
| \`build(outputFn?)\` | \`string\` | Returns final criteria string (returns \`'()'\` when no expressions added) |
|
|
121
|
-
| \`reset()\` | \`() => void\` | Clears all accumulated expressions |
|
|
122
|
-
|
|
123
|
-
\`\`\`ts
|
|
124
|
-
import { CriteriaBuilder, ExpressionBuilder, Serialisers, Join } from '@genesislcap/foundation-criteria';
|
|
125
|
-
|
|
126
|
-
// Single-value AND condition
|
|
127
|
-
const criteria = new CriteriaBuilder()
|
|
128
|
-
.And(
|
|
129
|
-
new ExpressionBuilder()
|
|
130
|
-
.withField('SIDE')
|
|
131
|
-
.withValue('BUY')
|
|
132
|
-
.withSerialiser(Serialisers.EQ)
|
|
133
|
-
.build()
|
|
134
|
-
)
|
|
135
|
-
.build();
|
|
136
|
-
// → "((SIDE == "BUY"))"
|
|
137
|
-
|
|
138
|
-
// Date range (AND both conditions)
|
|
139
|
-
const dateCriteria = new CriteriaBuilder()
|
|
140
|
-
.And(
|
|
141
|
-
new ExpressionBuilder()
|
|
142
|
-
.withField('TRADE_DATE')
|
|
143
|
-
.withValue('20260101') // strip hyphens: "2026-01-01" → "20260101"
|
|
144
|
-
.withSerialiser(Serialisers.dateIsGreaterEqual)
|
|
145
|
-
.build()
|
|
146
|
-
)
|
|
147
|
-
.And(
|
|
148
|
-
new ExpressionBuilder()
|
|
149
|
-
.withField('TRADE_DATE')
|
|
150
|
-
.withValue('20261231')
|
|
151
|
-
.withSerialiser(Serialisers.dateIsLessEqual)
|
|
152
|
-
.build()
|
|
153
|
-
)
|
|
154
|
-
.build();
|
|
155
|
-
|
|
156
|
-
// Multi-value OR (e.g. multiple sides)
|
|
157
|
-
const multiCriteria = new CriteriaBuilder()
|
|
158
|
-
.withExpression(
|
|
159
|
-
['BUY', 'SELL'].map(side =>
|
|
160
|
-
new ExpressionBuilder()
|
|
161
|
-
.withField('SIDE')
|
|
162
|
-
.withValue(side)
|
|
163
|
-
.withSerialiser(Serialisers.EQ)
|
|
164
|
-
.build()
|
|
165
|
-
),
|
|
166
|
-
{ join: Join.Or() }
|
|
167
|
-
)
|
|
168
|
-
.build();
|
|
169
|
-
\`\`\`
|
|
170
|
-
|
|
171
|
-
**Empty criteria guard:** \`CriteriaBuilder.build()\` returns \`'()'\` when no expressions have been added.
|
|
172
|
-
Always normalize to \`undefined\` or \`''\` before passing to a datasource:
|
|
173
|
-
|
|
174
|
-
\`\`\`ts
|
|
175
|
-
const result = builder.build();
|
|
176
|
-
const criteria = result === '()' ? '' : result; // empty = no filter applied
|
|
177
|
-
// Or: criteria || undefined when passing to datasource props
|
|
178
|
-
\`\`\`
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
### ExpressionBuilder — build a single Expression
|
|
183
|
-
|
|
184
|
-
| Method | Notes |
|
|
185
|
-
|---|---|
|
|
186
|
-
| \`withField(field: string)\` | server field name, e.g. \`'TRADE_DATE'\` |
|
|
187
|
-
| \`withValue(value: unknown)\` | the filter value |
|
|
188
|
-
| \`withSerialiser(serialiser: Serialiser)\` | how field/value are encoded; use \`Serialisers.*\` |
|
|
189
|
-
| \`withParams(params: any)\` | extra params passed to serialiser |
|
|
190
|
-
| \`withValueGetter(fn: (v) => string)\` | custom value encoder |
|
|
191
|
-
| \`withGroup(group: string)\` | optional expression grouping |
|
|
192
|
-
| \`build()\` | returns an \`Expression\` — throws if \`field\` is unset or \`value\` is \`undefined\` |
|
|
193
|
-
|
|
194
|
-
\`new ExpressionBuilder()\` (no args) defaults the serialiser to \`Serialisers.EQ\`.
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
### Serialisers — complete reference (verified from foundation-criteria/src/serialisers.ts)
|
|
199
|
-
|
|
200
|
-
| Key | Output pattern | Use for |
|
|
201
|
-
|---|---|---|
|
|
202
|
-
| \`Serialisers.EQ\` | \`FIELD == VALUE\` | Exact equality (generic) |
|
|
203
|
-
| \`Serialisers.NE\` | \`FIELD != VALUE\` | Not equal |
|
|
204
|
-
| \`Serialisers.GT\` | \`FIELD > VALUE\` | Greater than |
|
|
205
|
-
| \`Serialisers.GE\` | \`FIELD >= VALUE\` | Greater than or equal |
|
|
206
|
-
| \`Serialisers.LT\` | \`FIELD < VALUE\` | Less than |
|
|
207
|
-
| \`Serialisers.LE\` | \`FIELD <= VALUE\` | Less than or equal |
|
|
208
|
-
| \`Serialisers.AND\` | \`FIELD && VALUE\` | Logical AND expression |
|
|
209
|
-
| \`Serialisers.OR\` | \`FIELD |\| VALUE\` | Logical OR expression |
|
|
210
|
-
| \`Serialisers.NOT\` | \`FIELD ! VALUE\` | Logical NOT |
|
|
211
|
-
| \`Serialisers.equals\` | \`FIELD.equals(VALUE)\` | String equals (case-sensitive) |
|
|
212
|
-
| \`Serialisers.equalsIgnoreCase\` | \`FIELD.equalsIgnoreCase(VALUE)\` | String equals (case-insensitive) |
|
|
213
|
-
| \`Serialisers.contains\` | \`Expr.contains(FIELD, VALUE)\` | Contains substring |
|
|
214
|
-
| \`Serialisers.fieldContains\` | \`FIELD.contains(VALUE)\` | Field-level contains |
|
|
215
|
-
| \`Serialisers.containsIgnoreCase\` | \`Expr.containsIgnoreCase(FIELD, VALUE)\` | Contains (case-insensitive) — used by \`getCriteriaBuilder\` |
|
|
216
|
-
| \`Serialisers.startsWith\` | \`FIELD.startsWith(VALUE)\` | Starts with |
|
|
217
|
-
| \`Serialisers.endsWith\` | \`FIELD.endsWith(VALUE)\` | Ends with |
|
|
218
|
-
| \`Serialisers.dateIsToday\` | \`Expr.dateIsToday(FIELD)\` | Date equals today (serialiser ignores the value, but still call \`.withValue('')\` — \`build()\` throws on undefined value) |
|
|
219
|
-
| \`Serialisers.dateIsEqual\` | \`Expr.dateIsEqual(FIELD, VALUE)\` | Date equals a specific date |
|
|
220
|
-
| \`Serialisers.dateIsGreaterEqual\` | \`Expr.dateIsGreaterEqual(FIELD, VALUE)\` | Date >= (use YYYYMMDD format) |
|
|
221
|
-
| \`Serialisers.dateIsLessEqual\` | \`Expr.dateIsLessEqual(FIELD, VALUE)\` | Date <= (use YYYYMMDD format) |
|
|
222
|
-
| \`Serialisers.dateTimeIsGreaterEqual\` | \`Expr.dateTimeIsGreaterEqual(FIELD, VALUE)\` | DateTime >= |
|
|
223
|
-
| \`Serialisers.dateTimeIsLessEqual\` | \`Expr.dateTimeIsLessEqual(FIELD, VALUE)\` | DateTime <= |
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
### EntityManagement search bar — \`enableSearchBar\` + \`searchBarConfig\`
|
|
228
|
-
|
|
229
|
-
EntityManagement has a built-in search bar that accepts user-typed queries and converts them
|
|
230
|
-
to criteria strings via \`searchBarConfig\`. Enable it with \`enableSearchBar\` and provide
|
|
231
|
-
an \`AvailableOption[]\` array via \`searchBarConfig\`.
|
|
232
|
-
|
|
233
|
-
**Types (verified from foundation-ui/dist/dts/search-bar/search-bar.types.d.ts):**
|
|
234
|
-
|
|
235
|
-
\`\`\`ts
|
|
236
|
-
// AvailableOption — one searchable field in the search bar
|
|
237
|
-
type AvailableOption<T extends string = string> = {
|
|
238
|
-
field: T; // server field name
|
|
239
|
-
label: (searchTerm: string) => string; // label shown in the dropdown
|
|
240
|
-
createCriteria: (field: T, term: string) => string; // criteria string builder
|
|
241
|
-
isEnabled?: (searchTerm: string, selectedOptions: SelectedOption[], minLength?: number) => boolean;
|
|
242
|
-
resourceType?: ResourceType; // optional; usually omitted (showcase omits it)
|
|
243
|
-
};
|
|
244
|
-
\`\`\`
|
|
245
|
-
|
|
246
|
-
**\`getCriteriaBuilder\`** (from \`@genesislcap/foundation-ui\`) is a pre-built \`CriteriaCreator\` that
|
|
247
|
-
generates a \`containsIgnoreCase\` criteria string for a given field and term:
|
|
248
|
-
\`\`\`ts
|
|
249
|
-
const getCriteriaBuilder: CriteriaCreator = (field, term) =>
|
|
250
|
-
new CriteriaBuilder()
|
|
251
|
-
.withExpression(
|
|
252
|
-
new ExpressionBuilder()
|
|
253
|
-
.withField(field).withValue(term)
|
|
254
|
-
.withSerialiser(Serialisers.containsIgnoreCase)
|
|
255
|
-
.build()
|
|
256
|
-
)
|
|
257
|
-
.build();
|
|
258
|
-
\`\`\`
|
|
259
|
-
|
|
260
|
-
**Verified usage** (source: showcase react-client/src/pages/Admin/components/AdminEntityManagementSSMRColumnActions.tsx):
|
|
261
|
-
|
|
262
|
-
\`\`\`tsx
|
|
263
|
-
import { getCriteriaBuilder, INPUT_MIN_LENGTH } from '@genesislcap/foundation-ui';
|
|
264
|
-
import type { AvailableOption } from '@genesislcap/foundation-ui';
|
|
265
|
-
import { EntityManagement } from '@genesislcap/foundation-entity-management/react';
|
|
266
|
-
|
|
267
|
-
const searchConfig: AvailableOption[] = [
|
|
268
|
-
{
|
|
269
|
-
field: 'COUNTERPARTY_ID',
|
|
270
|
-
label: (searchTerm) => \`\${searchTerm} as Counterparty ID\`,
|
|
271
|
-
createCriteria: getCriteriaBuilder,
|
|
272
|
-
isEnabled: (searchTerm, selectedOptions) =>
|
|
273
|
-
searchTerm.length >= INPUT_MIN_LENGTH &&
|
|
274
|
-
!selectedOptions.some((e) => e.field === 'COUNTERPARTY_ID'),
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
field: 'NAME',
|
|
278
|
-
label: (searchTerm) => \`\${searchTerm} as Name\`,
|
|
279
|
-
createCriteria: getCriteriaBuilder,
|
|
280
|
-
isEnabled: (searchTerm, selectedOptions) =>
|
|
281
|
-
searchTerm.length >= INPUT_MIN_LENGTH &&
|
|
282
|
-
!selectedOptions.some((e) => e.field === 'NAME'),
|
|
283
|
-
},
|
|
284
|
-
];
|
|
285
|
-
|
|
286
|
-
function CounterpartyGrid() {
|
|
287
|
-
return (
|
|
288
|
-
<EntityManagement
|
|
289
|
-
prefix="rapid"
|
|
290
|
-
resourceName="COUNTERPARTY"
|
|
291
|
-
updateEvent="EVENT_COUNTERPARTY_MODIFY"
|
|
292
|
-
deleteEvent="EVENT_COUNTERPARTY_DELETE"
|
|
293
|
-
createEvent="EVENT_COUNTERPARTY_INSERT"
|
|
294
|
-
columns={columns}
|
|
295
|
-
enableSearchBar // activates the search bar UI
|
|
296
|
-
searchBarConfig={searchConfig as any} // cast as any — WC typing mismatch
|
|
297
|
-
/>
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
\`\`\`
|
|
301
|
-
|
|
302
|
-
**Rules:**
|
|
303
|
-
- \`INPUT_MIN_LENGTH\` = 3 — use this as the minimum search term length in \`isEnabled\`
|
|
304
|
-
- Cast \`searchBarConfig\` as \`any\` when passing to \`EntityManagement\` — the React prop typing
|
|
305
|
-
uses a WC-side type that is not directly compatible with the TypeScript \`AvailableOption\` interface
|
|
306
|
-
- When \`searchBarConfig\` is omitted but \`enableSearchBar\` is true, EntityManagement auto-generates
|
|
307
|
-
the config from column defs + server metadata (uses \`containsIgnoreCase\` for all fields)
|
|
308
|
-
- \`isEnabled\` should guard against duplicate field selections (use \`!selectedOptions.some(...))\`)
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
### React segmented filter control
|
|
313
|
-
|
|
314
|
-
\`CriteriaSegmentedControl\` is a web component (no React wrapper). For segmented filter UIs in React,
|
|
315
|
-
use \`SegmentedControl\` + \`SegmentedItem\` from \`@genesislcap/rapid-design-system/react\`, wiring
|
|
316
|
-
criteria building manually on the change event.
|
|
317
|
-
|
|
318
|
-
\`\`\`tsx
|
|
319
|
-
import React, { useState } from 'react';
|
|
320
|
-
import { SegmentedControl, SegmentedItem } from '@genesislcap/rapid-design-system/react';
|
|
321
|
-
import { CriteriaBuilder, ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
|
|
322
|
-
import type { CriteriaSegmentedControlOption } from '@genesislcap/foundation-criteria';
|
|
323
|
-
|
|
324
|
-
// Define the options — mirrors CriteriaSegmentedControlOption shape (field, value, serialiser, label)
|
|
325
|
-
const filterOptions: CriteriaSegmentedControlOption[] = [
|
|
326
|
-
{ label: 'VOD', field: 'INSTRUMENT_ID', value: 'VOD', serialiser: Serialisers.EQ },
|
|
327
|
-
{ label: 'BP', field: 'INSTRUMENT_ID', value: 'BP', serialiser: Serialisers.EQ },
|
|
328
|
-
{ label: 'LSEG', field: 'INSTRUMENT_ID', value: 'LSEG', serialiser: Serialisers.EQ },
|
|
329
|
-
];
|
|
330
|
-
|
|
331
|
-
function buildCriteriaFromOption(option: CriteriaSegmentedControlOption): string {
|
|
332
|
-
return new CriteriaBuilder()
|
|
333
|
-
.And(
|
|
334
|
-
new ExpressionBuilder()
|
|
335
|
-
.withField(option.field)
|
|
336
|
-
.withValue(option.value)
|
|
337
|
-
.withSerialiser(option.serialiser)
|
|
338
|
-
.build()
|
|
339
|
-
)
|
|
340
|
-
.build();
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
interface SegmentedFilterProps {
|
|
344
|
-
onCriteriaChange: (criteria: string) => void;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
function SegmentedFilter({ onCriteriaChange }: SegmentedFilterProps) {
|
|
348
|
-
const [selected, setSelected] = useState<string | undefined>(undefined);
|
|
349
|
-
|
|
350
|
-
const handleChange = (e: Event) => {
|
|
351
|
-
const value = (e.target as HTMLElement & { value: string }).value;
|
|
352
|
-
// Toggle: clicking the same item again clears the filter
|
|
353
|
-
if (selected === value) {
|
|
354
|
-
setSelected(undefined);
|
|
355
|
-
onCriteriaChange('');
|
|
356
|
-
} else {
|
|
357
|
-
setSelected(value);
|
|
358
|
-
const option = filterOptions.find((o) => o.label === value);
|
|
359
|
-
if (option) {
|
|
360
|
-
onCriteriaChange(buildCriteriaFromOption(option));
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
return (
|
|
366
|
-
<SegmentedControl value={selected ?? ''} onChange={handleChange}>
|
|
367
|
-
{filterOptions.map((option) => (
|
|
368
|
-
<SegmentedItem key={option.label} value={option.label}>
|
|
369
|
-
{option.label}
|
|
370
|
-
</SegmentedItem>
|
|
371
|
-
))}
|
|
372
|
-
</SegmentedControl>
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
\`\`\`
|
|
376
|
-
|
|
377
|
-
Then wire the criteria into a datasource:
|
|
378
|
-
|
|
379
|
-
\`\`\`tsx
|
|
380
|
-
import React, { useState } from 'react';
|
|
381
|
-
import { RapidGridPro } from '@genesislcap/rapid-grid-pro/react';
|
|
382
|
-
import { GridProGenesisDatasource } from '@genesislcap/grid-pro/react';
|
|
383
|
-
|
|
384
|
-
function FilteredChartOrGrid() {
|
|
385
|
-
const [criteria, setCriteria] = useState('');
|
|
386
|
-
|
|
387
|
-
return (
|
|
388
|
-
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
|
|
389
|
-
<SegmentedFilter onCriteriaChange={setCriteria} />
|
|
390
|
-
<RapidGridPro prefix="rapid" style={{ flex: 1 }}>
|
|
391
|
-
<GridProGenesisDatasource
|
|
392
|
-
resourceName="ALL_POSITIONS"
|
|
393
|
-
criteria={criteria || undefined} // pass undefined (not '') when no filter
|
|
394
|
-
requestAutoSetup={false}
|
|
395
|
-
/>
|
|
396
|
-
</RapidGridPro>
|
|
397
|
-
</div>
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
\`\`\`
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
### createFormCriteriaBuilder — form-driven criteria (advanced)
|
|
405
|
-
|
|
406
|
-
\`createFormCriteriaBuilder\` is a higher-order function that maps a form's field values to
|
|
407
|
-
\`ExpressionParams\` arrays and feeds them into a \`CriteriaBuilder\`. Useful when you already
|
|
408
|
-
have a form schema and want each form field to produce a criteria expression automatically.
|
|
409
|
-
|
|
410
|
-
\`\`\`ts
|
|
411
|
-
import {
|
|
412
|
-
CriteriaBuilder,
|
|
413
|
-
createFormCriteriaBuilder,
|
|
414
|
-
Serialisers,
|
|
415
|
-
} from '@genesislcap/foundation-criteria';
|
|
416
|
-
import type { ExpressionConfig } from '@genesislcap/foundation-criteria';
|
|
417
|
-
|
|
418
|
-
// ExpressionConfig maps one form field to one or more ExpressionParams
|
|
419
|
-
const sideConfig: ExpressionConfig = {
|
|
420
|
-
criteria: (value: string) => ['SIDE', Serialisers.EQ, value, !!value],
|
|
421
|
-
// [field, serialiser, value, enabled?]
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
const dateConfig: ExpressionConfig = {
|
|
425
|
-
criteria: (value: string) => [
|
|
426
|
-
'TRADE_DATE',
|
|
427
|
-
Serialisers.dateIsGreaterEqual,
|
|
428
|
-
value ? value.split('-').join('') : '',
|
|
429
|
-
!!value,
|
|
430
|
-
],
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
// Usage:
|
|
434
|
-
const criteriaBuilder = new CriteriaBuilder();
|
|
435
|
-
const applyFormField = createFormCriteriaBuilder(criteriaBuilder);
|
|
436
|
-
|
|
437
|
-
applyFormField(sideConfig, 'BUY', formData);
|
|
438
|
-
applyFormField(dateConfig, '2026-01-01', formData);
|
|
439
|
-
|
|
440
|
-
const result = criteriaBuilder.build();
|
|
441
|
-
const criteria = result === '()' ? '' : result;
|
|
442
|
-
\`\`\`
|
|
443
|
-
|
|
444
|
-
---
|
|
445
|
-
|
|
446
|
-
### DANGEROUS PATTERNS
|
|
447
|
-
|
|
448
|
-
#### DP-1: Importing from \`@genesislcap/foundation-criteria/react\`
|
|
449
|
-
|
|
450
|
-
\`\`\`ts
|
|
451
|
-
// WRONG — foundation-criteria has NO /react subpath:
|
|
452
|
-
import { CriteriaBuilder } from '@genesislcap/foundation-criteria/react'; // TS error
|
|
453
|
-
import { ExpressionBuilder } from '@genesislcap/foundation-criteria/react'; // TS error
|
|
454
|
-
|
|
455
|
-
// CORRECT — always import from the root:
|
|
456
|
-
import { CriteriaBuilder, ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
|
|
457
|
-
\`\`\`
|
|
458
|
-
|
|
459
|
-
#### DP-2: Using \`CriteriaSegmentedControl\` directly as JSX
|
|
460
|
-
|
|
461
|
-
\`\`\`tsx
|
|
462
|
-
// WRONG — CriteriaSegmentedControl is a WC with no React wrapper; renders as unknown element:
|
|
463
|
-
import { CriteriaSegmentedControl } from '@genesislcap/foundation-criteria';
|
|
464
|
-
// <CriteriaSegmentedControl criteriaOptions={...} /> // will NOT work in React
|
|
465
|
-
|
|
466
|
-
// CORRECT — use SegmentedControl + SegmentedItem from rapid-design-system/react and
|
|
467
|
-
// build criteria manually on the change event (see example above):
|
|
468
|
-
import { SegmentedControl, SegmentedItem } from '@genesislcap/rapid-design-system/react';
|
|
469
|
-
\`\`\`
|
|
470
|
-
|
|
471
|
-
#### DP-3: Passing empty string \`'()'\` criteria to a datasource
|
|
472
|
-
|
|
473
|
-
\`\`\`ts
|
|
474
|
-
// WRONG — '()' is what CriteriaBuilder.build() returns when no expressions are set;
|
|
475
|
-
// some datasources treat it as a valid (but empty) filter string:
|
|
476
|
-
<GridProGenesisDatasource criteria={builder.build()} requestAutoSetup={false} /> // may be '()'
|
|
477
|
-
|
|
478
|
-
// CORRECT — normalize to '' or undefined before passing:
|
|
479
|
-
const result = builder.build();
|
|
480
|
-
const criteria = result === '()' ? undefined : result;
|
|
481
|
-
<GridProGenesisDatasource criteria={criteria} requestAutoSetup={false} />
|
|
482
|
-
\`\`\`
|
|
483
|
-
|
|
484
|
-
#### DP-4: Forgetting to strip hyphens from ISO date strings
|
|
485
|
-
|
|
486
|
-
\`\`\`ts
|
|
487
|
-
// WRONG — dateIsGreaterEqual / dateIsLessEqual require YYYYMMDD format without hyphens:
|
|
488
|
-
.withValue('2026-01-15') // sends "2026-01-15" — server may reject
|
|
489
|
-
|
|
490
|
-
// CORRECT — strip hyphens first:
|
|
491
|
-
const dateStr = '2026-01-15';
|
|
492
|
-
.withValue(dateStr.split('-').join('')) // → "20260115"
|
|
493
|
-
\`\`\`
|
|
494
|
-
|
|
495
|
-
#### DP-5: Importing getCriteriaBuilder from foundation-criteria instead of foundation-ui
|
|
496
|
-
|
|
497
|
-
\`\`\`ts
|
|
498
|
-
// WRONG — getCriteriaBuilder is NOT in foundation-criteria:
|
|
499
|
-
import { getCriteriaBuilder } from '@genesislcap/foundation-criteria'; // undefined export
|
|
500
|
-
|
|
501
|
-
// CORRECT — getCriteriaBuilder and INPUT_MIN_LENGTH are in foundation-ui:
|
|
502
|
-
import { getCriteriaBuilder, INPUT_MIN_LENGTH } from '@genesislcap/foundation-ui';
|
|
503
|
-
\`\`\`
|
|
504
|
-
|
|
505
|
-
#### DP-6: Omitting the \`isEnabled\` duplicate-field guard in \`searchBarConfig\`
|
|
506
|
-
|
|
507
|
-
\`\`\`ts
|
|
508
|
-
// WRONG — allows the same field to be added multiple times to the search bar:
|
|
509
|
-
{
|
|
510
|
-
field: 'NAME',
|
|
511
|
-
label: (term) => \`\${term} as Name\`,
|
|
512
|
-
createCriteria: getCriteriaBuilder,
|
|
513
|
-
// no isEnabled guard
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// CORRECT — guard with both min-length and duplicate-field checks:
|
|
517
|
-
{
|
|
518
|
-
field: 'NAME',
|
|
519
|
-
label: (term) => \`\${term} as Name\`,
|
|
520
|
-
createCriteria: getCriteriaBuilder,
|
|
521
|
-
isEnabled: (searchTerm, selectedOptions) =>
|
|
522
|
-
searchTerm.length >= INPUT_MIN_LENGTH &&
|
|
523
|
-
!selectedOptions.some((e) => e.field === 'NAME'),
|
|
524
|
-
}
|
|
525
|
-
\`\`\`
|
|
526
|
-
|
|
527
|
-
#### DP-7: Using a raw string Serialiser instead of \`Serialisers.*\`
|
|
528
|
-
|
|
529
|
-
\`\`\`ts
|
|
530
|
-
// WRONG — manually constructing serialiser as a string, bypasses type-checking:
|
|
531
|
-
.withSerialiser((e) => \`\${e.field} == "\${e.value}"\`) // valid but fragile
|
|
532
|
-
|
|
533
|
-
// CORRECT for common operators — use the predefined Serialisers:
|
|
534
|
-
.withSerialiser(Serialisers.EQ) // string equality
|
|
535
|
-
.withSerialiser(Serialisers.containsIgnoreCase) // case-insensitive contains
|
|
536
|
-
.withSerialiser(Serialisers.dateIsGreaterEqual) // date range lower bound
|
|
537
|
-
\`\`\`
|
|
538
|
-
`.trim();
|