@genesislcap/foundation-react-utils 14.479.1-alpha-af2aa5c.0 → 14.480.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/custom-elements.json +0 -130
- package/dist/dts/index.d.ts +0 -5
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/foundation-react-utils.api.json +0 -598
- package/dist/foundation-react-utils.d.ts +1 -96
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/src/index.ts +0 -8
- package/dist/dts/create-grid-pro-cell-renderer.d.ts +0 -94
- package/dist/dts/create-grid-pro-cell-renderer.d.ts.map +0 -1
- package/dist/esm/create-grid-pro-cell-renderer.js +0 -92
- package/src/create-grid-pro-cell-renderer.ts +0 -144
|
@@ -2,112 +2,6 @@
|
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
3
|
"readme": "",
|
|
4
4
|
"modules": [
|
|
5
|
-
{
|
|
6
|
-
"kind": "javascript-module",
|
|
7
|
-
"path": "src/create-grid-pro-cell-renderer.ts",
|
|
8
|
-
"declarations": [
|
|
9
|
-
{
|
|
10
|
-
"kind": "mixin",
|
|
11
|
-
"description": "Wraps a React component as an AG Grid cell renderer component class for use with\n`grid-pro` / `grid-pro-beta` (`<foundation-grid-pro>` / `<rapid-grid-pro>`).\n\nGrid Pro is a framework-agnostic Web Component, so AG Grid inside it only understands\nplain-JS component classes. This helper bridges the gap: it returns a class implementing\n`ICellRendererComp` that mounts the React component into the cell with its own React root,\nre-renders it on `refresh` (so value changes and cell flashing keep working without\nremounting), and unmounts it when the cell is destroyed.\n\nThe component receives the full AG Grid `ICellRendererParams` object as props — including\n`value`, `data`, `node`, `api` and anything supplied via the column's `cellRendererParams`.\nHooks and local state inside the component work as normal.\n\nNote on React Context/Redux: each cell is rendered into its own independent React root, so\nrenderers do NOT inherit contexts (Redux providers, theme context, React Router, etc.) from\nthe application tree hosting the grid. Render any required providers inside the cell\nrenderer component itself, or pass data/callbacks explicitly via `cellRendererParams`.",
|
|
12
|
-
"name": "createGridProCellRenderer",
|
|
13
|
-
"members": [
|
|
14
|
-
{
|
|
15
|
-
"kind": "field",
|
|
16
|
-
"name": "container",
|
|
17
|
-
"type": {
|
|
18
|
-
"text": "HTMLElement"
|
|
19
|
-
},
|
|
20
|
-
"privacy": "private"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"kind": "field",
|
|
24
|
-
"name": "root",
|
|
25
|
-
"type": {
|
|
26
|
-
"text": "Root | null"
|
|
27
|
-
},
|
|
28
|
-
"privacy": "private",
|
|
29
|
-
"default": "null"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"kind": "method",
|
|
33
|
-
"name": "init",
|
|
34
|
-
"privacy": "public",
|
|
35
|
-
"return": {
|
|
36
|
-
"type": {
|
|
37
|
-
"text": "void"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"parameters": [
|
|
41
|
-
{
|
|
42
|
-
"name": "params",
|
|
43
|
-
"type": {
|
|
44
|
-
"text": "P"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"kind": "method",
|
|
51
|
-
"name": "getGui",
|
|
52
|
-
"privacy": "public",
|
|
53
|
-
"return": {
|
|
54
|
-
"type": {
|
|
55
|
-
"text": "HTMLElement"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"kind": "method",
|
|
61
|
-
"name": "refresh",
|
|
62
|
-
"privacy": "public",
|
|
63
|
-
"return": {
|
|
64
|
-
"type": {
|
|
65
|
-
"text": "boolean"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"parameters": [
|
|
69
|
-
{
|
|
70
|
-
"name": "params",
|
|
71
|
-
"type": {
|
|
72
|
-
"text": "P"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"kind": "method",
|
|
79
|
-
"name": "destroy",
|
|
80
|
-
"privacy": "public",
|
|
81
|
-
"return": {
|
|
82
|
-
"type": {
|
|
83
|
-
"text": "void"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
"parameters": [
|
|
89
|
-
{
|
|
90
|
-
"name": "Component",
|
|
91
|
-
"type": {
|
|
92
|
-
"text": "ComponentType<P>"
|
|
93
|
-
},
|
|
94
|
-
"description": "The React component to render inside the cell."
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
"privacy": "public"
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
"exports": [
|
|
101
|
-
{
|
|
102
|
-
"kind": "js",
|
|
103
|
-
"name": "createGridProCellRenderer",
|
|
104
|
-
"declaration": {
|
|
105
|
-
"name": "createGridProCellRenderer",
|
|
106
|
-
"module": "src/create-grid-pro-cell-renderer.ts"
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
5
|
{
|
|
112
6
|
"kind": "javascript-module",
|
|
113
7
|
"path": "src/create-react-renderer.ts",
|
|
@@ -189,30 +83,6 @@
|
|
|
189
83
|
"module": "./create-react-renderer"
|
|
190
84
|
}
|
|
191
85
|
},
|
|
192
|
-
{
|
|
193
|
-
"kind": "js",
|
|
194
|
-
"name": "createGridProCellRenderer",
|
|
195
|
-
"declaration": {
|
|
196
|
-
"name": "createGridProCellRenderer",
|
|
197
|
-
"module": "./create-grid-pro-cell-renderer"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
"kind": "js",
|
|
202
|
-
"name": "GridProCellRendererProps",
|
|
203
|
-
"declaration": {
|
|
204
|
-
"name": "GridProCellRendererProps",
|
|
205
|
-
"module": "./create-grid-pro-cell-renderer"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"kind": "js",
|
|
210
|
-
"name": "GridProReactCellRenderer",
|
|
211
|
-
"declaration": {
|
|
212
|
-
"name": "GridProReactCellRenderer",
|
|
213
|
-
"module": "./create-grid-pro-cell-renderer"
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
86
|
{
|
|
217
87
|
"kind": "js",
|
|
218
88
|
"name": "RendererControlProps",
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -7,15 +7,10 @@
|
|
|
7
7
|
* - `createReactRenderer` — wraps a React component as a `RendererEntry` for use with
|
|
8
8
|
* `foundation-forms` `additionalRenderers`. Use this instead of writing raw FAST templates
|
|
9
9
|
* when your custom form renderer is authored in React/JSX.
|
|
10
|
-
* - `createGridProCellRenderer` — wraps a React component as an AG Grid cell renderer
|
|
11
|
-
* component class for use with `grid-pro` (register via `gridOptions.components` or the
|
|
12
|
-
* grid's `gridComponents` property).
|
|
13
10
|
* - `reactFactory` / `reactFactoryWithProvider` — mount React component trees into
|
|
14
11
|
* Genesis Foundation layout regions.
|
|
15
12
|
*/
|
|
16
13
|
export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
|
|
17
14
|
export { createReactRenderer } from './create-react-renderer';
|
|
18
|
-
export { createGridProCellRenderer } from './create-grid-pro-cell-renderer';
|
|
19
|
-
export type { GridProCellRendererProps, GridProReactCellRenderer, } from './create-grid-pro-cell-renderer';
|
|
20
15
|
export type { RendererControlProps } from '@genesislcap/foundation-forms';
|
|
21
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,12 +7,8 @@
|
|
|
7
7
|
* - `createReactRenderer` — wraps a React component as a `RendererEntry` for use with
|
|
8
8
|
* `foundation-forms` `additionalRenderers`. Use this instead of writing raw FAST templates
|
|
9
9
|
* when your custom form renderer is authored in React/JSX.
|
|
10
|
-
* - `createGridProCellRenderer` — wraps a React component as an AG Grid cell renderer
|
|
11
|
-
* component class for use with `grid-pro` (register via `gridOptions.components` or the
|
|
12
|
-
* grid's `gridComponents` property).
|
|
13
10
|
* - `reactFactory` / `reactFactoryWithProvider` — mount React component trees into
|
|
14
11
|
* Genesis Foundation layout regions.
|
|
15
12
|
*/
|
|
16
13
|
export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
|
|
17
14
|
export { createReactRenderer } from './create-react-renderer';
|
|
18
|
-
export { createGridProCellRenderer } from './create-grid-pro-cell-renderer';
|
|
@@ -172,92 +172,6 @@
|
|
|
172
172
|
"name": "",
|
|
173
173
|
"preserveMemberOrder": false,
|
|
174
174
|
"members": [
|
|
175
|
-
{
|
|
176
|
-
"kind": "Function",
|
|
177
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!createGridProCellRenderer:function(1)",
|
|
178
|
-
"docComment": "/**\n * Wraps a React component as an AG Grid cell renderer component class for use with `grid-pro` / `grid-pro-beta` (`<foundation-grid-pro>` / `<rapid-grid-pro>`).\n *\n * Grid Pro is a framework-agnostic Web Component, so AG Grid inside it only understands plain-JS component classes. This helper bridges the gap: it returns a class implementing `ICellRendererComp` that mounts the React component into the cell with its own React root, re-renders it on `refresh` (so value changes and cell flashing keep working without remounting), and unmounts it when the cell is destroyed.\n *\n * The component receives the full AG Grid `ICellRendererParams` object as props — including `value`, `data`, `node`, `api` and anything supplied via the column's `cellRendererParams`. Hooks and local state inside the component work as normal.\n *\n * Note on React Context/Redux: each cell is rendered into its own independent React root, so renderers do NOT inherit contexts (Redux providers, theme context, React Router, etc.) from the application tree hosting the grid. Render any required providers inside the cell renderer component itself, or pass data/callbacks explicitly via `cellRendererParams`.\n *\n * @param Component - The React component to render inside the cell.\n *\n * @returns A cell renderer component class registrable via `gridOptions.components`, the grid's `gridComponents` property, or directly as a column's `cellRenderer`.\n *\n * @example\n * ```tsx\n * import { createGridProCellRenderer, type GridProCellRendererProps } from '@genesislcap/foundation-react-utils';\n *\n * function PriceCell({ value }: GridProCellRendererProps) {\n * return <span style={{ color: value >= 0 ? 'green' : 'red' }}>{value}</span>;\n * }\n *\n * const gridOptions = {\n * components: {\n * priceCell: createGridProCellRenderer(PriceCell),\n * },\n * columnDefs: [\n * { field: 'price', cellRenderer: 'priceCell' },\n * ],\n * };\n *\n * // <rapid-grid-pro gridOptions={gridOptions} /> — or register via the grid's\n * // `gridComponents` property to make the renderer available across all columns.\n * ```\n *\n * @public\n */\n",
|
|
179
|
-
"excerptTokens": [
|
|
180
|
-
{
|
|
181
|
-
"kind": "Content",
|
|
182
|
-
"text": "export declare function createGridProCellRenderer<P extends "
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"kind": "Reference",
|
|
186
|
-
"text": "GridProCellRendererProps",
|
|
187
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps:interface"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"kind": "Content",
|
|
191
|
-
"text": " = "
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"kind": "Reference",
|
|
195
|
-
"text": "GridProCellRendererProps",
|
|
196
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps:interface"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"kind": "Content",
|
|
200
|
-
"text": ">(Component: "
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"kind": "Reference",
|
|
204
|
-
"text": "ComponentType",
|
|
205
|
-
"canonicalReference": "@types/react!React.ComponentType:type"
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"kind": "Content",
|
|
209
|
-
"text": "<P>"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"kind": "Content",
|
|
213
|
-
"text": "): "
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
"kind": "Content",
|
|
217
|
-
"text": "new () => "
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"kind": "Reference",
|
|
221
|
-
"text": "GridProReactCellRenderer",
|
|
222
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProReactCellRenderer:interface"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"kind": "Content",
|
|
226
|
-
"text": ";"
|
|
227
|
-
}
|
|
228
|
-
],
|
|
229
|
-
"fileUrlPath": "src/create-grid-pro-cell-renderer.ts",
|
|
230
|
-
"returnTypeTokenRange": {
|
|
231
|
-
"startIndex": 8,
|
|
232
|
-
"endIndex": 10
|
|
233
|
-
},
|
|
234
|
-
"releaseTag": "Public",
|
|
235
|
-
"overloadIndex": 1,
|
|
236
|
-
"parameters": [
|
|
237
|
-
{
|
|
238
|
-
"parameterName": "Component",
|
|
239
|
-
"parameterTypeTokenRange": {
|
|
240
|
-
"startIndex": 5,
|
|
241
|
-
"endIndex": 7
|
|
242
|
-
},
|
|
243
|
-
"isOptional": false
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
"typeParameters": [
|
|
247
|
-
{
|
|
248
|
-
"typeParameterName": "P",
|
|
249
|
-
"constraintTokenRange": {
|
|
250
|
-
"startIndex": 1,
|
|
251
|
-
"endIndex": 2
|
|
252
|
-
},
|
|
253
|
-
"defaultTypeTokenRange": {
|
|
254
|
-
"startIndex": 3,
|
|
255
|
-
"endIndex": 4
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
],
|
|
259
|
-
"name": "createGridProCellRenderer"
|
|
260
|
-
},
|
|
261
175
|
{
|
|
262
176
|
"kind": "Function",
|
|
263
177
|
"canonicalReference": "@genesislcap/foundation-react-utils!createReactRenderer:function(1)",
|
|
@@ -370,518 +284,6 @@
|
|
|
370
284
|
],
|
|
371
285
|
"name": "createReactRenderer"
|
|
372
286
|
},
|
|
373
|
-
{
|
|
374
|
-
"kind": "Interface",
|
|
375
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps:interface",
|
|
376
|
-
"docComment": "/**\n * Props passed to a React component used as a Grid Pro cell renderer.\n *\n * This is a structural subset of AG Grid's `ICellRendererParams` — the full params object (including any custom `cellRendererParams` from the column definition) is spread onto the component as props on every render, so anything available on `ICellRendererParams` is available here. Declared locally to avoid coupling this package to a specific `ag-grid-community` version.\n *\n * @public\n */\n",
|
|
377
|
-
"excerptTokens": [
|
|
378
|
-
{
|
|
379
|
-
"kind": "Content",
|
|
380
|
-
"text": "export interface GridProCellRendererProps<TData = "
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"kind": "Content",
|
|
384
|
-
"text": "any"
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
"kind": "Content",
|
|
388
|
-
"text": ", TValue = "
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
"kind": "Content",
|
|
392
|
-
"text": "any"
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
"kind": "Content",
|
|
396
|
-
"text": "> "
|
|
397
|
-
}
|
|
398
|
-
],
|
|
399
|
-
"fileUrlPath": "src/create-grid-pro-cell-renderer.ts",
|
|
400
|
-
"releaseTag": "Public",
|
|
401
|
-
"typeParameters": [
|
|
402
|
-
{
|
|
403
|
-
"typeParameterName": "TData",
|
|
404
|
-
"constraintTokenRange": {
|
|
405
|
-
"startIndex": 0,
|
|
406
|
-
"endIndex": 0
|
|
407
|
-
},
|
|
408
|
-
"defaultTypeTokenRange": {
|
|
409
|
-
"startIndex": 1,
|
|
410
|
-
"endIndex": 2
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
"typeParameterName": "TValue",
|
|
415
|
-
"constraintTokenRange": {
|
|
416
|
-
"startIndex": 0,
|
|
417
|
-
"endIndex": 0
|
|
418
|
-
},
|
|
419
|
-
"defaultTypeTokenRange": {
|
|
420
|
-
"startIndex": 3,
|
|
421
|
-
"endIndex": 4
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
],
|
|
425
|
-
"name": "GridProCellRendererProps",
|
|
426
|
-
"preserveMemberOrder": false,
|
|
427
|
-
"members": [
|
|
428
|
-
{
|
|
429
|
-
"kind": "IndexSignature",
|
|
430
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps:index(1)",
|
|
431
|
-
"docComment": "/**\n * Custom params from `cellRendererParams` and any other AG Grid params.\n */\n",
|
|
432
|
-
"excerptTokens": [
|
|
433
|
-
{
|
|
434
|
-
"kind": "Content",
|
|
435
|
-
"text": "[key: "
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
"kind": "Content",
|
|
439
|
-
"text": "string"
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
"kind": "Content",
|
|
443
|
-
"text": "]: "
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
"kind": "Content",
|
|
447
|
-
"text": "any"
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
"kind": "Content",
|
|
451
|
-
"text": ";"
|
|
452
|
-
}
|
|
453
|
-
],
|
|
454
|
-
"isReadonly": false,
|
|
455
|
-
"returnTypeTokenRange": {
|
|
456
|
-
"startIndex": 3,
|
|
457
|
-
"endIndex": 4
|
|
458
|
-
},
|
|
459
|
-
"releaseTag": "Public",
|
|
460
|
-
"overloadIndex": 1,
|
|
461
|
-
"parameters": [
|
|
462
|
-
{
|
|
463
|
-
"parameterName": "key",
|
|
464
|
-
"parameterTypeTokenRange": {
|
|
465
|
-
"startIndex": 1,
|
|
466
|
-
"endIndex": 2
|
|
467
|
-
},
|
|
468
|
-
"isOptional": false
|
|
469
|
-
}
|
|
470
|
-
]
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
"kind": "PropertySignature",
|
|
474
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#api:member",
|
|
475
|
-
"docComment": "/**\n * The AG Grid api.\n */\n",
|
|
476
|
-
"excerptTokens": [
|
|
477
|
-
{
|
|
478
|
-
"kind": "Content",
|
|
479
|
-
"text": "api: "
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
"kind": "Content",
|
|
483
|
-
"text": "any"
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
"kind": "Content",
|
|
487
|
-
"text": ";"
|
|
488
|
-
}
|
|
489
|
-
],
|
|
490
|
-
"isReadonly": false,
|
|
491
|
-
"isOptional": false,
|
|
492
|
-
"releaseTag": "Public",
|
|
493
|
-
"name": "api",
|
|
494
|
-
"propertyTypeTokenRange": {
|
|
495
|
-
"startIndex": 1,
|
|
496
|
-
"endIndex": 2
|
|
497
|
-
}
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
"kind": "PropertySignature",
|
|
501
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#colDef:member",
|
|
502
|
-
"docComment": "/**\n * The column definition.\n */\n",
|
|
503
|
-
"excerptTokens": [
|
|
504
|
-
{
|
|
505
|
-
"kind": "Content",
|
|
506
|
-
"text": "colDef?: "
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
"kind": "Content",
|
|
510
|
-
"text": "any"
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
"kind": "Content",
|
|
514
|
-
"text": ";"
|
|
515
|
-
}
|
|
516
|
-
],
|
|
517
|
-
"isReadonly": false,
|
|
518
|
-
"isOptional": true,
|
|
519
|
-
"releaseTag": "Public",
|
|
520
|
-
"name": "colDef",
|
|
521
|
-
"propertyTypeTokenRange": {
|
|
522
|
-
"startIndex": 1,
|
|
523
|
-
"endIndex": 2
|
|
524
|
-
}
|
|
525
|
-
},
|
|
526
|
-
{
|
|
527
|
-
"kind": "PropertySignature",
|
|
528
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#column:member",
|
|
529
|
-
"docComment": "/**\n * The column this cell belongs to.\n */\n",
|
|
530
|
-
"excerptTokens": [
|
|
531
|
-
{
|
|
532
|
-
"kind": "Content",
|
|
533
|
-
"text": "column?: "
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
"kind": "Content",
|
|
537
|
-
"text": "any"
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
"kind": "Content",
|
|
541
|
-
"text": ";"
|
|
542
|
-
}
|
|
543
|
-
],
|
|
544
|
-
"isReadonly": false,
|
|
545
|
-
"isOptional": true,
|
|
546
|
-
"releaseTag": "Public",
|
|
547
|
-
"name": "column",
|
|
548
|
-
"propertyTypeTokenRange": {
|
|
549
|
-
"startIndex": 1,
|
|
550
|
-
"endIndex": 2
|
|
551
|
-
}
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
"kind": "PropertySignature",
|
|
555
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#context:member",
|
|
556
|
-
"docComment": "/**\n * The grid context object, as supplied via `gridOptions.context`.\n */\n",
|
|
557
|
-
"excerptTokens": [
|
|
558
|
-
{
|
|
559
|
-
"kind": "Content",
|
|
560
|
-
"text": "context?: "
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
"kind": "Content",
|
|
564
|
-
"text": "any"
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
"kind": "Content",
|
|
568
|
-
"text": ";"
|
|
569
|
-
}
|
|
570
|
-
],
|
|
571
|
-
"isReadonly": false,
|
|
572
|
-
"isOptional": true,
|
|
573
|
-
"releaseTag": "Public",
|
|
574
|
-
"name": "context",
|
|
575
|
-
"propertyTypeTokenRange": {
|
|
576
|
-
"startIndex": 1,
|
|
577
|
-
"endIndex": 2
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
"kind": "PropertySignature",
|
|
582
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#data:member",
|
|
583
|
-
"docComment": "/**\n * The full row data.\n */\n",
|
|
584
|
-
"excerptTokens": [
|
|
585
|
-
{
|
|
586
|
-
"kind": "Content",
|
|
587
|
-
"text": "data: "
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
"kind": "Content",
|
|
591
|
-
"text": "TData"
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
"kind": "Content",
|
|
595
|
-
"text": ";"
|
|
596
|
-
}
|
|
597
|
-
],
|
|
598
|
-
"isReadonly": false,
|
|
599
|
-
"isOptional": false,
|
|
600
|
-
"releaseTag": "Public",
|
|
601
|
-
"name": "data",
|
|
602
|
-
"propertyTypeTokenRange": {
|
|
603
|
-
"startIndex": 1,
|
|
604
|
-
"endIndex": 2
|
|
605
|
-
}
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
"kind": "PropertySignature",
|
|
609
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#node:member",
|
|
610
|
-
"docComment": "/**\n * The AG Grid row node.\n */\n",
|
|
611
|
-
"excerptTokens": [
|
|
612
|
-
{
|
|
613
|
-
"kind": "Content",
|
|
614
|
-
"text": "node: "
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
"kind": "Content",
|
|
618
|
-
"text": "any"
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
"kind": "Content",
|
|
622
|
-
"text": ";"
|
|
623
|
-
}
|
|
624
|
-
],
|
|
625
|
-
"isReadonly": false,
|
|
626
|
-
"isOptional": false,
|
|
627
|
-
"releaseTag": "Public",
|
|
628
|
-
"name": "node",
|
|
629
|
-
"propertyTypeTokenRange": {
|
|
630
|
-
"startIndex": 1,
|
|
631
|
-
"endIndex": 2
|
|
632
|
-
}
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
"kind": "PropertySignature",
|
|
636
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#rowIndex:member",
|
|
637
|
-
"docComment": "/**\n * The row index of the cell.\n */\n",
|
|
638
|
-
"excerptTokens": [
|
|
639
|
-
{
|
|
640
|
-
"kind": "Content",
|
|
641
|
-
"text": "rowIndex: "
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
"kind": "Content",
|
|
645
|
-
"text": "number"
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
"kind": "Content",
|
|
649
|
-
"text": ";"
|
|
650
|
-
}
|
|
651
|
-
],
|
|
652
|
-
"isReadonly": false,
|
|
653
|
-
"isOptional": false,
|
|
654
|
-
"releaseTag": "Public",
|
|
655
|
-
"name": "rowIndex",
|
|
656
|
-
"propertyTypeTokenRange": {
|
|
657
|
-
"startIndex": 1,
|
|
658
|
-
"endIndex": 2
|
|
659
|
-
}
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
"kind": "PropertySignature",
|
|
663
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#value:member",
|
|
664
|
-
"docComment": "/**\n * The cell value.\n */\n",
|
|
665
|
-
"excerptTokens": [
|
|
666
|
-
{
|
|
667
|
-
"kind": "Content",
|
|
668
|
-
"text": "value: "
|
|
669
|
-
},
|
|
670
|
-
{
|
|
671
|
-
"kind": "Content",
|
|
672
|
-
"text": "TValue"
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
"kind": "Content",
|
|
676
|
-
"text": ";"
|
|
677
|
-
}
|
|
678
|
-
],
|
|
679
|
-
"isReadonly": false,
|
|
680
|
-
"isOptional": false,
|
|
681
|
-
"releaseTag": "Public",
|
|
682
|
-
"name": "value",
|
|
683
|
-
"propertyTypeTokenRange": {
|
|
684
|
-
"startIndex": 1,
|
|
685
|
-
"endIndex": 2
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
"kind": "PropertySignature",
|
|
690
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps#valueFormatted:member",
|
|
691
|
-
"docComment": "/**\n * Value formatted by the column's value formatter, if any.\n */\n",
|
|
692
|
-
"excerptTokens": [
|
|
693
|
-
{
|
|
694
|
-
"kind": "Content",
|
|
695
|
-
"text": "valueFormatted?: "
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
"kind": "Content",
|
|
699
|
-
"text": "string | null"
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
"kind": "Content",
|
|
703
|
-
"text": ";"
|
|
704
|
-
}
|
|
705
|
-
],
|
|
706
|
-
"isReadonly": false,
|
|
707
|
-
"isOptional": true,
|
|
708
|
-
"releaseTag": "Public",
|
|
709
|
-
"name": "valueFormatted",
|
|
710
|
-
"propertyTypeTokenRange": {
|
|
711
|
-
"startIndex": 1,
|
|
712
|
-
"endIndex": 2
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
],
|
|
716
|
-
"extendsTokenRanges": []
|
|
717
|
-
},
|
|
718
|
-
{
|
|
719
|
-
"kind": "Interface",
|
|
720
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProReactCellRenderer:interface",
|
|
721
|
-
"docComment": "/**\n * The subset of AG Grid's `ICellRendererComp` contract implemented by the wrapper class returned from {@link createGridProCellRenderer}.\n *\n * @public\n */\n",
|
|
722
|
-
"excerptTokens": [
|
|
723
|
-
{
|
|
724
|
-
"kind": "Content",
|
|
725
|
-
"text": "export interface GridProReactCellRenderer "
|
|
726
|
-
}
|
|
727
|
-
],
|
|
728
|
-
"fileUrlPath": "src/create-grid-pro-cell-renderer.ts",
|
|
729
|
-
"releaseTag": "Public",
|
|
730
|
-
"name": "GridProReactCellRenderer",
|
|
731
|
-
"preserveMemberOrder": false,
|
|
732
|
-
"members": [
|
|
733
|
-
{
|
|
734
|
-
"kind": "MethodSignature",
|
|
735
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProReactCellRenderer#destroy:member(1)",
|
|
736
|
-
"docComment": "",
|
|
737
|
-
"excerptTokens": [
|
|
738
|
-
{
|
|
739
|
-
"kind": "Content",
|
|
740
|
-
"text": "destroy(): "
|
|
741
|
-
},
|
|
742
|
-
{
|
|
743
|
-
"kind": "Content",
|
|
744
|
-
"text": "void"
|
|
745
|
-
},
|
|
746
|
-
{
|
|
747
|
-
"kind": "Content",
|
|
748
|
-
"text": ";"
|
|
749
|
-
}
|
|
750
|
-
],
|
|
751
|
-
"isOptional": false,
|
|
752
|
-
"returnTypeTokenRange": {
|
|
753
|
-
"startIndex": 1,
|
|
754
|
-
"endIndex": 2
|
|
755
|
-
},
|
|
756
|
-
"releaseTag": "Public",
|
|
757
|
-
"overloadIndex": 1,
|
|
758
|
-
"parameters": [],
|
|
759
|
-
"name": "destroy"
|
|
760
|
-
},
|
|
761
|
-
{
|
|
762
|
-
"kind": "MethodSignature",
|
|
763
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProReactCellRenderer#getGui:member(1)",
|
|
764
|
-
"docComment": "",
|
|
765
|
-
"excerptTokens": [
|
|
766
|
-
{
|
|
767
|
-
"kind": "Content",
|
|
768
|
-
"text": "getGui(): "
|
|
769
|
-
},
|
|
770
|
-
{
|
|
771
|
-
"kind": "Reference",
|
|
772
|
-
"text": "HTMLElement",
|
|
773
|
-
"canonicalReference": "!HTMLElement:interface"
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
"kind": "Content",
|
|
777
|
-
"text": ";"
|
|
778
|
-
}
|
|
779
|
-
],
|
|
780
|
-
"isOptional": false,
|
|
781
|
-
"returnTypeTokenRange": {
|
|
782
|
-
"startIndex": 1,
|
|
783
|
-
"endIndex": 2
|
|
784
|
-
},
|
|
785
|
-
"releaseTag": "Public",
|
|
786
|
-
"overloadIndex": 1,
|
|
787
|
-
"parameters": [],
|
|
788
|
-
"name": "getGui"
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
"kind": "MethodSignature",
|
|
792
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProReactCellRenderer#init:member(1)",
|
|
793
|
-
"docComment": "",
|
|
794
|
-
"excerptTokens": [
|
|
795
|
-
{
|
|
796
|
-
"kind": "Content",
|
|
797
|
-
"text": "init(params: "
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
"kind": "Reference",
|
|
801
|
-
"text": "GridProCellRendererProps",
|
|
802
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps:interface"
|
|
803
|
-
},
|
|
804
|
-
{
|
|
805
|
-
"kind": "Content",
|
|
806
|
-
"text": "): "
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
"kind": "Content",
|
|
810
|
-
"text": "void"
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
"kind": "Content",
|
|
814
|
-
"text": ";"
|
|
815
|
-
}
|
|
816
|
-
],
|
|
817
|
-
"isOptional": false,
|
|
818
|
-
"returnTypeTokenRange": {
|
|
819
|
-
"startIndex": 3,
|
|
820
|
-
"endIndex": 4
|
|
821
|
-
},
|
|
822
|
-
"releaseTag": "Public",
|
|
823
|
-
"overloadIndex": 1,
|
|
824
|
-
"parameters": [
|
|
825
|
-
{
|
|
826
|
-
"parameterName": "params",
|
|
827
|
-
"parameterTypeTokenRange": {
|
|
828
|
-
"startIndex": 1,
|
|
829
|
-
"endIndex": 2
|
|
830
|
-
},
|
|
831
|
-
"isOptional": false
|
|
832
|
-
}
|
|
833
|
-
],
|
|
834
|
-
"name": "init"
|
|
835
|
-
},
|
|
836
|
-
{
|
|
837
|
-
"kind": "MethodSignature",
|
|
838
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProReactCellRenderer#refresh:member(1)",
|
|
839
|
-
"docComment": "",
|
|
840
|
-
"excerptTokens": [
|
|
841
|
-
{
|
|
842
|
-
"kind": "Content",
|
|
843
|
-
"text": "refresh(params: "
|
|
844
|
-
},
|
|
845
|
-
{
|
|
846
|
-
"kind": "Reference",
|
|
847
|
-
"text": "GridProCellRendererProps",
|
|
848
|
-
"canonicalReference": "@genesislcap/foundation-react-utils!GridProCellRendererProps:interface"
|
|
849
|
-
},
|
|
850
|
-
{
|
|
851
|
-
"kind": "Content",
|
|
852
|
-
"text": "): "
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
"kind": "Content",
|
|
856
|
-
"text": "boolean"
|
|
857
|
-
},
|
|
858
|
-
{
|
|
859
|
-
"kind": "Content",
|
|
860
|
-
"text": ";"
|
|
861
|
-
}
|
|
862
|
-
],
|
|
863
|
-
"isOptional": false,
|
|
864
|
-
"returnTypeTokenRange": {
|
|
865
|
-
"startIndex": 3,
|
|
866
|
-
"endIndex": 4
|
|
867
|
-
},
|
|
868
|
-
"releaseTag": "Public",
|
|
869
|
-
"overloadIndex": 1,
|
|
870
|
-
"parameters": [
|
|
871
|
-
{
|
|
872
|
-
"parameterName": "params",
|
|
873
|
-
"parameterTypeTokenRange": {
|
|
874
|
-
"startIndex": 1,
|
|
875
|
-
"endIndex": 2
|
|
876
|
-
},
|
|
877
|
-
"isOptional": false
|
|
878
|
-
}
|
|
879
|
-
],
|
|
880
|
-
"name": "refresh"
|
|
881
|
-
}
|
|
882
|
-
],
|
|
883
|
-
"extendsTokenRanges": []
|
|
884
|
-
},
|
|
885
287
|
{
|
|
886
288
|
"kind": "Function",
|
|
887
289
|
"canonicalReference": "@genesislcap/foundation-react-utils!reactFactory:function(1)",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentFactory } from '@genesislcap/foundation-layout';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
2
|
+
import type { ComponentType } from 'react';
|
|
3
3
|
import { JsonFormsState } from '@jsonforms/core';
|
|
4
4
|
import { OwnPropsOfControl } from '@jsonforms/core';
|
|
5
5
|
import { RankedTester } from '@jsonforms/core';
|
|
@@ -8,54 +8,6 @@ import { RendererControlProps } from '@genesislcap/foundation-forms';
|
|
|
8
8
|
import { RendererEntry } from '@genesislcap/foundation-forms';
|
|
9
9
|
import { StatePropsOfControl } from '@jsonforms/core';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Wraps a React component as an AG Grid cell renderer component class for use with
|
|
13
|
-
* `grid-pro` / `grid-pro-beta` (`<foundation-grid-pro>` / `<rapid-grid-pro>`).
|
|
14
|
-
*
|
|
15
|
-
* Grid Pro is a framework-agnostic Web Component, so AG Grid inside it only understands
|
|
16
|
-
* plain-JS component classes. This helper bridges the gap: it returns a class implementing
|
|
17
|
-
* `ICellRendererComp` that mounts the React component into the cell with its own React root,
|
|
18
|
-
* re-renders it on `refresh` (so value changes and cell flashing keep working without
|
|
19
|
-
* remounting), and unmounts it when the cell is destroyed.
|
|
20
|
-
*
|
|
21
|
-
* The component receives the full AG Grid `ICellRendererParams` object as props — including
|
|
22
|
-
* `value`, `data`, `node`, `api` and anything supplied via the column's `cellRendererParams`.
|
|
23
|
-
* Hooks and local state inside the component work as normal.
|
|
24
|
-
*
|
|
25
|
-
* Note on React Context/Redux: each cell is rendered into its own independent React root, so
|
|
26
|
-
* renderers do NOT inherit contexts (Redux providers, theme context, React Router, etc.) from
|
|
27
|
-
* the application tree hosting the grid. Render any required providers inside the cell
|
|
28
|
-
* renderer component itself, or pass data/callbacks explicitly via `cellRendererParams`.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```tsx
|
|
32
|
-
* import { createGridProCellRenderer, type GridProCellRendererProps } from '@genesislcap/foundation-react-utils';
|
|
33
|
-
*
|
|
34
|
-
* function PriceCell({ value }: GridProCellRendererProps) {
|
|
35
|
-
* return <span style={{ color: value >= 0 ? 'green' : 'red' }}>{value}</span>;
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* const gridOptions = {
|
|
39
|
-
* components: {
|
|
40
|
-
* priceCell: createGridProCellRenderer(PriceCell),
|
|
41
|
-
* },
|
|
42
|
-
* columnDefs: [
|
|
43
|
-
* { field: 'price', cellRenderer: 'priceCell' },
|
|
44
|
-
* ],
|
|
45
|
-
* };
|
|
46
|
-
*
|
|
47
|
-
* // <rapid-grid-pro gridOptions={gridOptions} /> — or register via the grid's
|
|
48
|
-
* // `gridComponents` property to make the renderer available across all columns.
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @param Component - The React component to render inside the cell.
|
|
52
|
-
* @returns A cell renderer component class registrable via `gridOptions.components`,
|
|
53
|
-
* the grid's `gridComponents` property, or directly as a column's `cellRenderer`.
|
|
54
|
-
*
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
57
|
-
export declare function createGridProCellRenderer<P extends GridProCellRendererProps = GridProCellRendererProps>(Component: ComponentType<P>): new () => GridProReactCellRenderer;
|
|
58
|
-
|
|
59
11
|
/**
|
|
60
12
|
* Converts a React component into a `RendererEntry` for use with `foundation-form`'s
|
|
61
13
|
* `additionalRenderers` property.
|
|
@@ -134,53 +86,6 @@ export declare function createReactRenderer(Component: ComponentType<RendererCon
|
|
|
134
86
|
wrapWithControlWrapper?: boolean;
|
|
135
87
|
}): RendererEntry;
|
|
136
88
|
|
|
137
|
-
/**
|
|
138
|
-
* Props passed to a React component used as a Grid Pro cell renderer.
|
|
139
|
-
*
|
|
140
|
-
* This is a structural subset of AG Grid's `ICellRendererParams` — the full params object
|
|
141
|
-
* (including any custom `cellRendererParams` from the column definition) is spread onto the
|
|
142
|
-
* component as props on every render, so anything available on `ICellRendererParams` is
|
|
143
|
-
* available here. Declared locally to avoid coupling this package to a specific
|
|
144
|
-
* `ag-grid-community` version.
|
|
145
|
-
*
|
|
146
|
-
* @public
|
|
147
|
-
*/
|
|
148
|
-
export declare interface GridProCellRendererProps<TData = any, TValue = any> {
|
|
149
|
-
/** The cell value. */
|
|
150
|
-
value: TValue;
|
|
151
|
-
/** Value formatted by the column's value formatter, if any. */
|
|
152
|
-
valueFormatted?: string | null;
|
|
153
|
-
/** The full row data. */
|
|
154
|
-
data: TData;
|
|
155
|
-
/** The AG Grid row node. */
|
|
156
|
-
node: any;
|
|
157
|
-
/** The AG Grid api. */
|
|
158
|
-
api: any;
|
|
159
|
-
/** The row index of the cell. */
|
|
160
|
-
rowIndex: number;
|
|
161
|
-
/** The grid context object, as supplied via `gridOptions.context`. */
|
|
162
|
-
context?: any;
|
|
163
|
-
/** The column this cell belongs to. */
|
|
164
|
-
column?: any;
|
|
165
|
-
/** The column definition. */
|
|
166
|
-
colDef?: any;
|
|
167
|
-
/** Custom params from `cellRendererParams` and any other AG Grid params. */
|
|
168
|
-
[key: string]: any;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* The subset of AG Grid's `ICellRendererComp` contract implemented by the wrapper class
|
|
173
|
-
* returned from {@link createGridProCellRenderer}.
|
|
174
|
-
*
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
export declare interface GridProReactCellRenderer {
|
|
178
|
-
init(params: GridProCellRendererProps): void;
|
|
179
|
-
getGui(): HTMLElement;
|
|
180
|
-
refresh(params: GridProCellRendererProps): boolean;
|
|
181
|
-
destroy(): void;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
89
|
/**
|
|
185
90
|
* Creates a factory function for rendering React components in layout items.
|
|
186
91
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/create-
|
|
1
|
+
{"root":["../src/create-react-renderer.ts","../src/index.ts","../src/react-layout-factory.tsx"],"version":"5.9.2"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-react-utils",
|
|
3
3
|
"description": "Genesis Foundation React Utils",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.480.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@genesislcap/foundation-testing": "14.
|
|
33
|
-
"@genesislcap/genx": "14.
|
|
34
|
-
"@genesislcap/rollup-builder": "14.
|
|
35
|
-
"@genesislcap/ts-builder": "14.
|
|
36
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
37
|
-
"@genesislcap/vite-builder": "14.
|
|
38
|
-
"@genesislcap/webpack-builder": "14.
|
|
32
|
+
"@genesislcap/foundation-testing": "14.480.0",
|
|
33
|
+
"@genesislcap/genx": "14.480.0",
|
|
34
|
+
"@genesislcap/rollup-builder": "14.480.0",
|
|
35
|
+
"@genesislcap/ts-builder": "14.480.0",
|
|
36
|
+
"@genesislcap/uvu-playwright-builder": "14.480.0",
|
|
37
|
+
"@genesislcap/vite-builder": "14.480.0",
|
|
38
|
+
"@genesislcap/webpack-builder": "14.480.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^19.0.0",
|
|
42
42
|
"react-dom": "^19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@genesislcap/foundation-forms": "14.
|
|
46
|
-
"@genesislcap/foundation-layout": "14.
|
|
47
|
-
"@genesislcap/foundation-logger": "14.
|
|
48
|
-
"@genesislcap/web-core": "14.
|
|
45
|
+
"@genesislcap/foundation-forms": "14.480.0",
|
|
46
|
+
"@genesislcap/foundation-layout": "14.480.0",
|
|
47
|
+
"@genesislcap/foundation-logger": "14.480.0",
|
|
48
|
+
"@genesislcap/web-core": "14.480.0",
|
|
49
49
|
"@jsonforms/core": "^3.2.1",
|
|
50
50
|
"@r2wc/react-to-web-component": "^2.0.2"
|
|
51
51
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"customElements": "dist/custom-elements.json",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6d2bc60f9700ab9f5a6d8c1834baebbd66ae5e6b"
|
|
62
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,18 +7,10 @@
|
|
|
7
7
|
* - `createReactRenderer` — wraps a React component as a `RendererEntry` for use with
|
|
8
8
|
* `foundation-forms` `additionalRenderers`. Use this instead of writing raw FAST templates
|
|
9
9
|
* when your custom form renderer is authored in React/JSX.
|
|
10
|
-
* - `createGridProCellRenderer` — wraps a React component as an AG Grid cell renderer
|
|
11
|
-
* component class for use with `grid-pro` (register via `gridOptions.components` or the
|
|
12
|
-
* grid's `gridComponents` property).
|
|
13
10
|
* - `reactFactory` / `reactFactoryWithProvider` — mount React component trees into
|
|
14
11
|
* Genesis Foundation layout regions.
|
|
15
12
|
*/
|
|
16
13
|
|
|
17
14
|
export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
|
|
18
15
|
export { createReactRenderer } from './create-react-renderer';
|
|
19
|
-
export { createGridProCellRenderer } from './create-grid-pro-cell-renderer';
|
|
20
|
-
export type {
|
|
21
|
-
GridProCellRendererProps,
|
|
22
|
-
GridProReactCellRenderer,
|
|
23
|
-
} from './create-grid-pro-cell-renderer';
|
|
24
16
|
export type { RendererControlProps } from '@genesislcap/foundation-forms';
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { type ComponentType } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Props passed to a React component used as a Grid Pro cell renderer.
|
|
4
|
-
*
|
|
5
|
-
* This is a structural subset of AG Grid's `ICellRendererParams` — the full params object
|
|
6
|
-
* (including any custom `cellRendererParams` from the column definition) is spread onto the
|
|
7
|
-
* component as props on every render, so anything available on `ICellRendererParams` is
|
|
8
|
-
* available here. Declared locally to avoid coupling this package to a specific
|
|
9
|
-
* `ag-grid-community` version.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export interface GridProCellRendererProps<TData = any, TValue = any> {
|
|
14
|
-
/** The cell value. */
|
|
15
|
-
value: TValue;
|
|
16
|
-
/** Value formatted by the column's value formatter, if any. */
|
|
17
|
-
valueFormatted?: string | null;
|
|
18
|
-
/** The full row data. */
|
|
19
|
-
data: TData;
|
|
20
|
-
/** The AG Grid row node. */
|
|
21
|
-
node: any;
|
|
22
|
-
/** The AG Grid api. */
|
|
23
|
-
api: any;
|
|
24
|
-
/** The row index of the cell. */
|
|
25
|
-
rowIndex: number;
|
|
26
|
-
/** The grid context object, as supplied via `gridOptions.context`. */
|
|
27
|
-
context?: any;
|
|
28
|
-
/** The column this cell belongs to. */
|
|
29
|
-
column?: any;
|
|
30
|
-
/** The column definition. */
|
|
31
|
-
colDef?: any;
|
|
32
|
-
/** Custom params from `cellRendererParams` and any other AG Grid params. */
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The subset of AG Grid's `ICellRendererComp` contract implemented by the wrapper class
|
|
37
|
-
* returned from {@link createGridProCellRenderer}.
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export interface GridProReactCellRenderer {
|
|
42
|
-
init(params: GridProCellRendererProps): void;
|
|
43
|
-
getGui(): HTMLElement;
|
|
44
|
-
refresh(params: GridProCellRendererProps): boolean;
|
|
45
|
-
destroy(): void;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Wraps a React component as an AG Grid cell renderer component class for use with
|
|
49
|
-
* `grid-pro` / `grid-pro-beta` (`<foundation-grid-pro>` / `<rapid-grid-pro>`).
|
|
50
|
-
*
|
|
51
|
-
* Grid Pro is a framework-agnostic Web Component, so AG Grid inside it only understands
|
|
52
|
-
* plain-JS component classes. This helper bridges the gap: it returns a class implementing
|
|
53
|
-
* `ICellRendererComp` that mounts the React component into the cell with its own React root,
|
|
54
|
-
* re-renders it on `refresh` (so value changes and cell flashing keep working without
|
|
55
|
-
* remounting), and unmounts it when the cell is destroyed.
|
|
56
|
-
*
|
|
57
|
-
* The component receives the full AG Grid `ICellRendererParams` object as props — including
|
|
58
|
-
* `value`, `data`, `node`, `api` and anything supplied via the column's `cellRendererParams`.
|
|
59
|
-
* Hooks and local state inside the component work as normal.
|
|
60
|
-
*
|
|
61
|
-
* Note on React Context/Redux: each cell is rendered into its own independent React root, so
|
|
62
|
-
* renderers do NOT inherit contexts (Redux providers, theme context, React Router, etc.) from
|
|
63
|
-
* the application tree hosting the grid. Render any required providers inside the cell
|
|
64
|
-
* renderer component itself, or pass data/callbacks explicitly via `cellRendererParams`.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```tsx
|
|
68
|
-
* import { createGridProCellRenderer, type GridProCellRendererProps } from '@genesislcap/foundation-react-utils';
|
|
69
|
-
*
|
|
70
|
-
* function PriceCell({ value }: GridProCellRendererProps) {
|
|
71
|
-
* return <span style={{ color: value >= 0 ? 'green' : 'red' }}>{value}</span>;
|
|
72
|
-
* }
|
|
73
|
-
*
|
|
74
|
-
* const gridOptions = {
|
|
75
|
-
* components: {
|
|
76
|
-
* priceCell: createGridProCellRenderer(PriceCell),
|
|
77
|
-
* },
|
|
78
|
-
* columnDefs: [
|
|
79
|
-
* { field: 'price', cellRenderer: 'priceCell' },
|
|
80
|
-
* ],
|
|
81
|
-
* };
|
|
82
|
-
*
|
|
83
|
-
* // <rapid-grid-pro gridOptions={gridOptions} /> — or register via the grid's
|
|
84
|
-
* // `gridComponents` property to make the renderer available across all columns.
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* @param Component - The React component to render inside the cell.
|
|
88
|
-
* @returns A cell renderer component class registrable via `gridOptions.components`,
|
|
89
|
-
* the grid's `gridComponents` property, or directly as a column's `cellRenderer`.
|
|
90
|
-
*
|
|
91
|
-
* @public
|
|
92
|
-
*/
|
|
93
|
-
export declare function createGridProCellRenderer<P extends GridProCellRendererProps = GridProCellRendererProps>(Component: ComponentType<P>): new () => GridProReactCellRenderer;
|
|
94
|
-
//# sourceMappingURL=create-grid-pro-cell-renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-grid-pro-cell-renderer.d.ts","sourceRoot":"","sources":["../../src/create-grid-pro-cell-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAK1D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,wBAAwB,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG;IACjE,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,yBAAyB;IACzB,IAAI,EAAE,KAAK,CAAC;IACZ,4BAA4B;IAC5B,IAAI,EAAE,GAAG,CAAC;IACV,uBAAuB;IACvB,GAAG,EAAE,GAAG,CAAC;IACT,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,uCAAuC;IACvC,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,6BAA6B;IAC7B,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,4EAA4E;IAC5E,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC7C,MAAM,IAAI,WAAW,CAAC;IACtB,OAAO,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,yBAAyB,CACvC,CAAC,SAAS,wBAAwB,GAAG,wBAAwB,EAC7D,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU,wBAAwB,CA0CjE"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@genesislcap/foundation-logger';
|
|
2
|
-
import { createElement } from 'react';
|
|
3
|
-
import { createRoot } from 'react-dom/client';
|
|
4
|
-
const logger = createLogger('foundation-react-utils');
|
|
5
|
-
/**
|
|
6
|
-
* Wraps a React component as an AG Grid cell renderer component class for use with
|
|
7
|
-
* `grid-pro` / `grid-pro-beta` (`<foundation-grid-pro>` / `<rapid-grid-pro>`).
|
|
8
|
-
*
|
|
9
|
-
* Grid Pro is a framework-agnostic Web Component, so AG Grid inside it only understands
|
|
10
|
-
* plain-JS component classes. This helper bridges the gap: it returns a class implementing
|
|
11
|
-
* `ICellRendererComp` that mounts the React component into the cell with its own React root,
|
|
12
|
-
* re-renders it on `refresh` (so value changes and cell flashing keep working without
|
|
13
|
-
* remounting), and unmounts it when the cell is destroyed.
|
|
14
|
-
*
|
|
15
|
-
* The component receives the full AG Grid `ICellRendererParams` object as props — including
|
|
16
|
-
* `value`, `data`, `node`, `api` and anything supplied via the column's `cellRendererParams`.
|
|
17
|
-
* Hooks and local state inside the component work as normal.
|
|
18
|
-
*
|
|
19
|
-
* Note on React Context/Redux: each cell is rendered into its own independent React root, so
|
|
20
|
-
* renderers do NOT inherit contexts (Redux providers, theme context, React Router, etc.) from
|
|
21
|
-
* the application tree hosting the grid. Render any required providers inside the cell
|
|
22
|
-
* renderer component itself, or pass data/callbacks explicitly via `cellRendererParams`.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* import { createGridProCellRenderer, type GridProCellRendererProps } from '@genesislcap/foundation-react-utils';
|
|
27
|
-
*
|
|
28
|
-
* function PriceCell({ value }: GridProCellRendererProps) {
|
|
29
|
-
* return <span style={{ color: value >= 0 ? 'green' : 'red' }}>{value}</span>;
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* const gridOptions = {
|
|
33
|
-
* components: {
|
|
34
|
-
* priceCell: createGridProCellRenderer(PriceCell),
|
|
35
|
-
* },
|
|
36
|
-
* columnDefs: [
|
|
37
|
-
* { field: 'price', cellRenderer: 'priceCell' },
|
|
38
|
-
* ],
|
|
39
|
-
* };
|
|
40
|
-
*
|
|
41
|
-
* // <rapid-grid-pro gridOptions={gridOptions} /> — or register via the grid's
|
|
42
|
-
* // `gridComponents` property to make the renderer available across all columns.
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @param Component - The React component to render inside the cell.
|
|
46
|
-
* @returns A cell renderer component class registrable via `gridOptions.components`,
|
|
47
|
-
* the grid's `gridComponents` property, or directly as a column's `cellRenderer`.
|
|
48
|
-
*
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
export function createGridProCellRenderer(Component) {
|
|
52
|
-
return class ReactCellRenderer {
|
|
53
|
-
constructor() {
|
|
54
|
-
this.root = null;
|
|
55
|
-
}
|
|
56
|
-
init(params) {
|
|
57
|
-
this.container = document.createElement('div');
|
|
58
|
-
// Fill the cell so the React content can align itself like native renderers do.
|
|
59
|
-
this.container.style.display = 'flex';
|
|
60
|
-
this.container.style.alignItems = 'center';
|
|
61
|
-
this.container.style.height = '100%';
|
|
62
|
-
this.container.style.width = '100%';
|
|
63
|
-
this.root = createRoot(this.container);
|
|
64
|
-
this.root.render(createElement(Component, params));
|
|
65
|
-
}
|
|
66
|
-
getGui() {
|
|
67
|
-
return this.container;
|
|
68
|
-
}
|
|
69
|
-
refresh(params) {
|
|
70
|
-
var _a;
|
|
71
|
-
(_a = this.root) === null || _a === void 0 ? void 0 : _a.render(createElement(Component, params));
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
destroy() {
|
|
75
|
-
const root = this.root;
|
|
76
|
-
this.root = null;
|
|
77
|
-
if (root) {
|
|
78
|
-
// AG Grid can destroy cells synchronously while React is rendering (e.g. React Router
|
|
79
|
-
// unmounting the page that hosts the grid). Unmounting a root mid-render is not allowed,
|
|
80
|
-
// and microtasks still run inside the render cycle — defer with a macrotask instead.
|
|
81
|
-
setTimeout(() => {
|
|
82
|
-
try {
|
|
83
|
-
root.unmount();
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
logger.error('Error unmounting React root in Grid Pro cell renderer:', error);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@genesislcap/foundation-logger';
|
|
2
|
-
import { createElement, type ComponentType } from 'react';
|
|
3
|
-
import { createRoot, type Root } from 'react-dom/client';
|
|
4
|
-
|
|
5
|
-
const logger = createLogger('foundation-react-utils');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Props passed to a React component used as a Grid Pro cell renderer.
|
|
9
|
-
*
|
|
10
|
-
* This is a structural subset of AG Grid's `ICellRendererParams` — the full params object
|
|
11
|
-
* (including any custom `cellRendererParams` from the column definition) is spread onto the
|
|
12
|
-
* component as props on every render, so anything available on `ICellRendererParams` is
|
|
13
|
-
* available here. Declared locally to avoid coupling this package to a specific
|
|
14
|
-
* `ag-grid-community` version.
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export interface GridProCellRendererProps<TData = any, TValue = any> {
|
|
19
|
-
/** The cell value. */
|
|
20
|
-
value: TValue;
|
|
21
|
-
/** Value formatted by the column's value formatter, if any. */
|
|
22
|
-
valueFormatted?: string | null;
|
|
23
|
-
/** The full row data. */
|
|
24
|
-
data: TData;
|
|
25
|
-
/** The AG Grid row node. */
|
|
26
|
-
node: any;
|
|
27
|
-
/** The AG Grid api. */
|
|
28
|
-
api: any;
|
|
29
|
-
/** The row index of the cell. */
|
|
30
|
-
rowIndex: number;
|
|
31
|
-
/** The grid context object, as supplied via `gridOptions.context`. */
|
|
32
|
-
context?: any;
|
|
33
|
-
/** The column this cell belongs to. */
|
|
34
|
-
column?: any;
|
|
35
|
-
/** The column definition. */
|
|
36
|
-
colDef?: any;
|
|
37
|
-
/** Custom params from `cellRendererParams` and any other AG Grid params. */
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The subset of AG Grid's `ICellRendererComp` contract implemented by the wrapper class
|
|
43
|
-
* returned from {@link createGridProCellRenderer}.
|
|
44
|
-
*
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
export interface GridProReactCellRenderer {
|
|
48
|
-
init(params: GridProCellRendererProps): void;
|
|
49
|
-
getGui(): HTMLElement;
|
|
50
|
-
refresh(params: GridProCellRendererProps): boolean;
|
|
51
|
-
destroy(): void;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Wraps a React component as an AG Grid cell renderer component class for use with
|
|
56
|
-
* `grid-pro` / `grid-pro-beta` (`<foundation-grid-pro>` / `<rapid-grid-pro>`).
|
|
57
|
-
*
|
|
58
|
-
* Grid Pro is a framework-agnostic Web Component, so AG Grid inside it only understands
|
|
59
|
-
* plain-JS component classes. This helper bridges the gap: it returns a class implementing
|
|
60
|
-
* `ICellRendererComp` that mounts the React component into the cell with its own React root,
|
|
61
|
-
* re-renders it on `refresh` (so value changes and cell flashing keep working without
|
|
62
|
-
* remounting), and unmounts it when the cell is destroyed.
|
|
63
|
-
*
|
|
64
|
-
* The component receives the full AG Grid `ICellRendererParams` object as props — including
|
|
65
|
-
* `value`, `data`, `node`, `api` and anything supplied via the column's `cellRendererParams`.
|
|
66
|
-
* Hooks and local state inside the component work as normal.
|
|
67
|
-
*
|
|
68
|
-
* Note on React Context/Redux: each cell is rendered into its own independent React root, so
|
|
69
|
-
* renderers do NOT inherit contexts (Redux providers, theme context, React Router, etc.) from
|
|
70
|
-
* the application tree hosting the grid. Render any required providers inside the cell
|
|
71
|
-
* renderer component itself, or pass data/callbacks explicitly via `cellRendererParams`.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```tsx
|
|
75
|
-
* import { createGridProCellRenderer, type GridProCellRendererProps } from '@genesislcap/foundation-react-utils';
|
|
76
|
-
*
|
|
77
|
-
* function PriceCell({ value }: GridProCellRendererProps) {
|
|
78
|
-
* return <span style={{ color: value >= 0 ? 'green' : 'red' }}>{value}</span>;
|
|
79
|
-
* }
|
|
80
|
-
*
|
|
81
|
-
* const gridOptions = {
|
|
82
|
-
* components: {
|
|
83
|
-
* priceCell: createGridProCellRenderer(PriceCell),
|
|
84
|
-
* },
|
|
85
|
-
* columnDefs: [
|
|
86
|
-
* { field: 'price', cellRenderer: 'priceCell' },
|
|
87
|
-
* ],
|
|
88
|
-
* };
|
|
89
|
-
*
|
|
90
|
-
* // <rapid-grid-pro gridOptions={gridOptions} /> — or register via the grid's
|
|
91
|
-
* // `gridComponents` property to make the renderer available across all columns.
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* @param Component - The React component to render inside the cell.
|
|
95
|
-
* @returns A cell renderer component class registrable via `gridOptions.components`,
|
|
96
|
-
* the grid's `gridComponents` property, or directly as a column's `cellRenderer`.
|
|
97
|
-
*
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export function createGridProCellRenderer<
|
|
101
|
-
P extends GridProCellRendererProps = GridProCellRendererProps,
|
|
102
|
-
>(Component: ComponentType<P>): new () => GridProReactCellRenderer {
|
|
103
|
-
return class ReactCellRenderer implements GridProReactCellRenderer {
|
|
104
|
-
private container!: HTMLElement;
|
|
105
|
-
private root: Root | null = null;
|
|
106
|
-
|
|
107
|
-
public init(params: P): void {
|
|
108
|
-
this.container = document.createElement('div');
|
|
109
|
-
// Fill the cell so the React content can align itself like native renderers do.
|
|
110
|
-
this.container.style.display = 'flex';
|
|
111
|
-
this.container.style.alignItems = 'center';
|
|
112
|
-
this.container.style.height = '100%';
|
|
113
|
-
this.container.style.width = '100%';
|
|
114
|
-
this.root = createRoot(this.container);
|
|
115
|
-
this.root.render(createElement(Component, params));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public getGui(): HTMLElement {
|
|
119
|
-
return this.container;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public refresh(params: P): boolean {
|
|
123
|
-
this.root?.render(createElement(Component, params));
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
public destroy(): void {
|
|
128
|
-
const root = this.root;
|
|
129
|
-
this.root = null;
|
|
130
|
-
if (root) {
|
|
131
|
-
// AG Grid can destroy cells synchronously while React is rendering (e.g. React Router
|
|
132
|
-
// unmounting the page that hosts the grid). Unmounting a root mid-render is not allowed,
|
|
133
|
-
// and microtasks still run inside the render cycle — defer with a macrotask instead.
|
|
134
|
-
setTimeout(() => {
|
|
135
|
-
try {
|
|
136
|
-
root.unmount();
|
|
137
|
-
} catch (error) {
|
|
138
|
-
logger.error('Error unmounting React root in Grid Pro cell renderer:', error);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
}
|