@azrico/reactgrid 1.4.1 → 1.5.2

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.
@@ -1,286 +1,362 @@
1
- import '@inovua/reactdatagrid-enterprise/index.css';
2
- import '../themes/base_styles.css';
3
- import '../themes/grid.css';
4
- import { get_default_key } from '../func/func_grid';
5
- import { ContextMenu } from '@azrico/controls/context-menu';
6
- import React from 'react';
7
- import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles';
8
-
9
- import ReactDataGrid from '@inovua/reactdatagrid-enterprise';
10
- import clsx from 'clsx';
11
- import { useComponentSize } from 'react-use-size';
12
-
13
- import { AzGridOptions, AzGridProps, DataGridWrapperProps } from '../types/types';
14
- import { useGridEvents } from '../hooks/useGridEvents';
15
- import { useColumnData } from '../hooks/useColumnData';
16
- import { useDataSource } from '../hooks/useDatasource';
17
- import { useGridSearch } from '../hooks/useGridSearch';
18
- /* -------------------------------------------------------------------------- */
19
-
20
- /* -------------------------------------------------------------------------- */
21
-
22
- const defaultOptions: AzGridOptions = {
23
- //filterTypes: defaultfilterTypes,
24
- remoteFilter: false,
25
- remoteSort: false,
26
- editStartEvent: 'click',
27
- rowReorderColumn: false,
28
- resizable: true,
29
- columnUserSelect: true,
30
- rowIndexColumn: true,
31
- rowHeight: 35,
32
- };
33
- const forcedOptions: AzGridOptions = {
34
- idProperty: '__table_id',
35
- nodesProperty: '__children',
36
- theme: 'default-light',
37
- };
38
-
39
- const dynamic_option_names = ['selected', 'cellSelection', 'loading', 'limit', 'skip'];
40
- /* -------------------------------------------------------------------------- */
41
- export function AzGrid(props: AzGridProps) {
42
- const gridRefBackup = React.useRef<any>(null);
43
- const gridRef = props.gridRef || gridRefBackup;
44
-
45
- /* -------------------------------------------------------------------------- */
46
- /* Columns */
47
- /* -------------------------------------------------------------------------- */
48
- const cached_columns = useColumnData(props);
49
- const dataSource = useDataSource(props.dataSource, props);
50
- /* -------------------------------------------------------------------------- */
51
- /* Row changes */
52
- /* -------------------------------------------------------------------------- */
53
-
54
- const base_gridOptions = React.useMemo<AzGridOptions>(() => {
55
- const firstcolumn = cached_columns[0];
56
- const licenseKey = props.licenseKey || get_default_key();
57
- const events: AzGridOptions = {
58
- onSkipChange: props.onSkipChange,
59
- onLimitChange: props.onLimitChange,
60
- onEditComplete: props.onEditComplete,
61
- };
62
- const extra_ops: AzGridOptions = {
63
- onSelectionChange: props.onSelectionChange,
64
- onCellSelectionChange: props.onCellSelectionChange,
65
-
66
- licenseKey: licenseKey,
67
- editable: props.editable as any, //bug in types of the plugin
68
- treeColumn: props.allowChildRows ? firstcolumn.name : undefined,
69
- renderRowDetails: props.RowDetail,
70
- };
71
- return { ...defaultOptions, ...events, ...extra_ops };
72
- }, [
73
- cached_columns,
74
- props.allowChildRows,
75
- props.editable,
76
- props.RowDetail,
77
- props.onEditComplete,
78
- ]);
79
-
80
- const static_gridOptions = React.useMemo<AzGridOptions>(() => {
81
- const finalres = { ...base_gridOptions, ...props.gridOptions, ...forcedOptions };
82
-
83
- //append filter types instead of replacing it
84
- if (finalres.filterTypes)
85
- finalres.filterTypes = Object.assign(
86
- {},
87
- ReactDataGrid.defaultProps.filterTypes,
88
- finalres.filterTypes
89
- );
90
-
91
- return finalres;
92
- }, [props.gridOptions, base_gridOptions, forcedOptions]);
93
-
94
- const dynamic_gridOptions = React.useMemo<AzGridOptions>(
95
- () => {
96
- const res = {};
97
- dynamic_option_names.map((r) => {
98
- res[r] = props[r];
99
- });
100
- return res;
101
- },
102
- dynamic_option_names.map((r) => props[r])
103
- );
104
-
105
- return (
106
- <DataGridEventsWrapper
107
- {...props}
108
- gridRef={gridRef}
109
- static_gridOptions={static_gridOptions}
110
- dynamic_gridOptions={dynamic_gridOptions}
111
- columns={cached_columns}
112
- dataSource={dataSource}
113
- highlightedRow={props.highlightedRow}
114
- />
115
- );
116
- }
117
-
118
- /* -------------------------------------------------------------------------- */
119
- /**
120
- * Wrapper for menu events
121
- * @param props
122
- * @returns
123
- */
124
- function DataGridEventsWrapper(props: DataGridWrapperProps) {
125
- const scopeRef = React.useRef<HTMLDivElement>(null);
126
- const hostTheme = useTheme();
127
- // Keep the existing context menu and its portal in this grid's CSS scope.
128
- const menuTheme = React.useMemo(
129
- () => createTheme(hostTheme, {
130
- components: { MuiPopper: { defaultProps: { container: () => scopeRef.current } } },
131
- }),
132
- [hostTheme]
133
- );
134
- const themeClass = `azgrid-theme-${props.theme ?? (props.dark ? 'dark' : 'light')}`;
135
- /* -------------------------------------------------------------------------- */
136
- const {
137
- onRowClick,
138
- onRowContextMenu,
139
- onRenderRow,
140
- update_menuRow,
141
- menuAnchorEl,
142
- menuRow,
143
- } = useGridEvents(props.gridRef.current, props);
144
- /* -------------------------------------------------------------------------- */
145
- /**
146
- * Merge click events into grid options
147
- */
148
- const static_gridOptions = React.useMemo<AzGridOptions>(() => {
149
- const events: AzGridOptions = {
150
- onRowClick: onRowClick,
151
- onRowContextMenu: onRowContextMenu,
152
- };
153
-
154
- const renderProps: any = {
155
- onRenderRow: onRenderRow,
156
- };
157
- return {
158
- ...props.static_gridOptions,
159
- ...events,
160
- ...renderProps,
161
- };
162
- }, [props.static_gridOptions]);
163
-
164
- /* -------------------------------------------------------------------------- */
165
- //TODO ContextMenu not from mui...
166
- return (
167
- <div ref={scopeRef} className={clsx('azgrid-scope azgrid-flexed azgrid-flexlayout', themeClass)}>
168
- <ThemeProvider theme={menuTheme}>
169
- <ContextMenu
170
- classname="azgrid-context-menu"
171
- menuAnchorEl={menuAnchorEl}
172
- menuRow={menuRow}
173
- close={update_menuRow}
174
- dontAutoClose={false}
175
- menu_items={props.contextMenuItems as any}
176
- />
177
- </ThemeProvider>
178
- {props.details_dataSource ? (
179
- <DataGridDetailsWrapper {...props} static_gridOptions={static_gridOptions} />
180
- ) : (
181
- <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />
182
- )}
183
- </div>
184
- );
185
- }
186
-
187
- function DataGridDetailsWrapper(props: DataGridWrapperProps) {
188
- const cached_details_columns = useColumnData(props.details_columns);
189
- const details_dataSource = useDataSource(props.details_dataSource, props);
190
- const renderDetailsGrid = ({ data }) => {
191
- return (
192
- <ReactDataGrid
193
- theme="default-light"
194
- className={clsx('azgrid', `azgrid-theme-${props.theme ?? (props.dark ? 'dark' : 'light')}`)}
195
- defaultFilterValue={props.details_filter}
196
- dataSource={details_dataSource}
197
- columns={cached_details_columns}
198
- />
199
- );
200
- };
201
-
202
- /**
203
- * Merge details into grid
204
- */
205
- const static_gridOptions = React.useMemo<AzGridOptions>(() => {
206
- const finalresult = props.static_gridOptions || {};
207
- finalresult['renderDetailsGrid'] = renderDetailsGrid;
208
- return finalresult;
209
- }, [props.static_gridOptions, props.theme, props.dark]);
210
-
211
- return <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />;
212
- }
213
-
214
- function DataGridSizeWrapper(props: DataGridWrapperProps) {
215
- if (props.delayedSize) {
216
- return <DataGridDelayedSizeWrapper {...props} />;
217
- } else {
218
- return <DataGridNormalSizeWrapper {...props} />;
219
- }
220
- }
221
-
222
- /* -------------------------------------------------------------------------- */
223
- function DataGridNormalSizeWrapper(props: DataGridWrapperProps) {
224
- return props.advancedFilterFields ? (
225
- <DataGridSearchWrapper {...props} />
226
- ) : (
227
- <DataGridCore {...props} />
228
- );
229
- }
230
- function DataGridDelayedSizeWrapper(props: DataGridWrapperProps) {
231
- const { ref, height, width } = useComponentSize();
232
- return (
233
- <div ref={ref} className={'azgrid-filler azgrid-nooverflow '}>
234
- <div
235
- className={'azgrid-delayedresize azgrid-flexlayout'}
236
- style={{ height: height, width: width }}
237
- >
238
- {props.advancedFilterFields ? (
239
- <DataGridSearchWrapper {...props} />
240
- ) : (
241
- <DataGridCore {...props} />
242
- )}
243
- </div>
244
- </div>
245
- );
246
- }
247
- function DataGridSearchWrapper(props: DataGridWrapperProps) {
248
- const { element, filteredData } = useGridSearch(props.gridRef.current, props);
249
-
250
- return (
251
- <div className={'azgrid-flexed azgrid-flexlayout azgrid-nooverflow'}>
252
- {element}
253
- <DataGridCore {...props} dataSource={filteredData} />
254
- </div>
255
- );
256
- }
257
- function DataGridCore(props: DataGridWrapperProps) {
258
- return (
259
- <div className={clsx(props.className, 'azgrid-flexed', 'azgrid-flexlayout')}>
260
- <ReactDataGrid
261
- {...props.static_gridOptions}
262
- {...props.dynamic_gridOptions}
263
- rowIndexColumn
264
- handle={(ref) => {
265
- if (ref) props.gridRef.current = ref.current as any;
266
- }}
267
- theme="default-light"
268
- className={clsx(
269
- 'azgrid azgrid-flexed',
270
- props.allowChildRows && 'azgrid-tree',
271
- `azgrid-theme-${props.theme ?? (props.dark ? 'dark' : 'light')}`
272
- )}
273
- columns={props.columns}
274
- dataSource={props.dataSource}
275
- />
276
- {props.children}
277
- </div>
278
- );
279
- }
280
- /* -------------------------------------------------------------------------- */
281
- /* -------------------------------------------------------------------------- */
282
- /* -------------------------------------------------------------------------- */
283
- /* -------------------------------------------------------------------------- */
284
-
285
- /* -------------------------------------------------------------------------- */
286
- export default AzGrid;
1
+ import '@inovua/reactdatagrid-enterprise/index.css';
2
+ import '../themes/base_styles.css';
3
+ import '../themes/grid.css';
4
+ import { get_default_key } from '../func/func_grid';
5
+ import { ContextMenu } from '@azrico/controls/context-menu';
6
+ import React from 'react';
7
+ import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles';
8
+
9
+ import ReactDataGrid from '@inovua/reactdatagrid-enterprise';
10
+ import clsx from 'clsx';
11
+ import { useComponentSize } from 'react-use-size';
12
+
13
+ import { AzGridOptions, AzGridProps, DataGridWrapperProps } from '../types/types';
14
+ import { useGridEvents } from '../hooks/useGridEvents';
15
+ import { useColumnData } from '../hooks/useColumnData';
16
+ import { useDataSource } from '../hooks/useDatasource';
17
+ import { useGridSearch } from '../hooks/useGridSearch';
18
+ import { apply_column_a11y } from '../func/func_a11y';
19
+ /* -------------------------------------------------------------------------- */
20
+
21
+ /* -------------------------------------------------------------------------- */
22
+
23
+ const defaultOptions: AzGridOptions = {
24
+ //filterTypes: defaultfilterTypes,
25
+ remoteFilter: false,
26
+ remoteSort: false,
27
+ editStartEvent: 'click',
28
+ rowReorderColumn: false,
29
+ resizable: true,
30
+ columnUserSelect: true,
31
+ rowIndexColumn: true,
32
+ rowHeight: 35,
33
+ };
34
+ const forcedOptions: AzGridOptions = {
35
+ idProperty: '__table_id',
36
+ nodesProperty: '__children',
37
+ theme: 'default-light',
38
+ };
39
+
40
+ const dynamic_option_names = ['selected', 'cellSelection', 'loading', 'limit', 'skip'];
41
+ // consumer callbacks forwarded to the grid; wrapped so a new function doesn't re-render the grid
42
+ const callback_option_names = [
43
+ 'onSkipChange',
44
+ 'onLimitChange',
45
+ 'onEditComplete',
46
+ 'onSelectionChange',
47
+ 'onCellSelectionChange',
48
+ ];
49
+ // props DataGridCore renders from, other props don't need to re-render the grid
50
+ const core_prop_names = [
51
+ 'className',
52
+ 'static_gridOptions',
53
+ 'dynamic_gridOptions',
54
+ 'columns',
55
+ 'dataSource',
56
+ 'gridRef',
57
+ 'liveGridRef',
58
+ 'allowChildRows',
59
+ 'theme',
60
+ 'dark',
61
+ 'children',
62
+ ];
63
+ /* -------------------------------------------------------------------------- */
64
+ export function AzGrid(props: AzGridProps) {
65
+ const gridRefBackup = React.useRef<any>(null);
66
+ const gridRef = props.gridRef || gridRefBackup;
67
+ const liveGridRef = React.useRef<any>(null);
68
+ const latestProps = React.useRef(props);
69
+ latestProps.current = props;
70
+
71
+ /* -------------------------------------------------------------------------- */
72
+ /* Columns */
73
+ /* -------------------------------------------------------------------------- */
74
+ const cached_columns = useColumnData(props);
75
+ const dataSource = useDataSource(props.dataSource, props);
76
+ const a11y_columns = React.useMemo(
77
+ () => cached_columns.map((col) => apply_column_a11y(col, { gridEditable: !!props.editable })),
78
+ [cached_columns, props.editable]
79
+ );
80
+ /* -------------------------------------------------------------------------- */
81
+ /* Row changes */
82
+ /* -------------------------------------------------------------------------- */
83
+
84
+ const base_gridOptions = React.useMemo<AzGridOptions>(() => {
85
+ const firstcolumn = cached_columns[0];
86
+ const licenseKey = props.licenseKey || get_default_key();
87
+ // call the latest consumer callback, only passed when the consumer gave one
88
+ const events: AzGridOptions = {};
89
+ callback_option_names.forEach((name) => {
90
+ if (props[name])
91
+ events[name] = (...args: any[]) => latestProps.current[name]?.(...args);
92
+ });
93
+ const extra_ops: AzGridOptions = {
94
+ licenseKey: licenseKey,
95
+ editable: props.editable as any, //bug in types of the plugin
96
+ treeColumn: props.allowChildRows ? firstcolumn.name : undefined,
97
+ renderRowDetails: props.RowDetail,
98
+ };
99
+ return { ...defaultOptions, ...events, ...extra_ops };
100
+ }, [
101
+ cached_columns,
102
+ props.allowChildRows,
103
+ props.editable,
104
+ props.RowDetail,
105
+ props.licenseKey,
106
+ ...callback_option_names.map((name) => !!props[name]),
107
+ ]);
108
+
109
+ const static_gridOptions = React.useMemo<AzGridOptions>(() => {
110
+ const finalres = { ...base_gridOptions, ...props.gridOptions, ...forcedOptions };
111
+
112
+ //append filter types instead of replacing it
113
+ if (finalres.filterTypes)
114
+ finalres.filterTypes = Object.assign(
115
+ {},
116
+ ReactDataGrid.defaultProps.filterTypes,
117
+ finalres.filterTypes
118
+ );
119
+
120
+ return finalres;
121
+ }, [props.gridOptions, base_gridOptions, forcedOptions]);
122
+
123
+ const dynamic_gridOptions = React.useMemo<AzGridOptions>(
124
+ () => {
125
+ const res = {};
126
+ dynamic_option_names.map((r) => {
127
+ res[r] = props[r];
128
+ });
129
+ return res;
130
+ },
131
+ dynamic_option_names.map((r) => props[r])
132
+ );
133
+
134
+ return (
135
+ <DataGridEventsWrapper
136
+ {...props}
137
+ gridRef={gridRef}
138
+ liveGridRef={liveGridRef}
139
+ static_gridOptions={static_gridOptions}
140
+ dynamic_gridOptions={dynamic_gridOptions}
141
+ columns={a11y_columns}
142
+ dataSource={dataSource}
143
+ highlightedRow={props.highlightedRow}
144
+ />
145
+ );
146
+ }
147
+
148
+ /* -------------------------------------------------------------------------- */
149
+ /**
150
+ * Wrapper for menu events
151
+ * @param props
152
+ * @returns
153
+ */
154
+ function DataGridEventsWrapper(props: DataGridWrapperProps) {
155
+ const scopeRef = React.useRef<HTMLDivElement>(null);
156
+ const hostTheme = useTheme();
157
+ // Keep the existing context menu and its portal in this grid's CSS scope.
158
+ const menuTheme = React.useMemo(
159
+ () => createTheme(hostTheme, {
160
+ components: { MuiPopper: { defaultProps: { container: () => scopeRef.current } } },
161
+ }),
162
+ [hostTheme]
163
+ );
164
+ const themeClass = `azgrid-theme-${props.theme ?? (props.dark ? 'dark' : 'light')}`;
165
+ /* -------------------------------------------------------------------------- */
166
+ const {
167
+ onRowClick,
168
+ onRowContextMenu,
169
+ onRenderRow,
170
+ onRenderLoadMask,
171
+ update_menuRow,
172
+ menuAnchorEl,
173
+ menuRow,
174
+ } = useGridEvents(props.gridRef.current, props);
175
+ /* -------------------------------------------------------------------------- */
176
+ /**
177
+ * Merge click events into grid options
178
+ */
179
+ const static_gridOptions = React.useMemo<AzGridOptions>(() => {
180
+ const opts: any = props.static_gridOptions || {};
181
+ const events: AzGridOptions = {
182
+ onRowClick: onRowClick,
183
+ onRowContextMenu: onRowContextMenu,
184
+ };
185
+
186
+ // internal row attributes first, consumer's onRenderRow last so it can override them
187
+ const consumerOnRenderRow = opts.onRenderRow;
188
+ const renderProps: any = {
189
+ onRenderRow: consumerOnRenderRow
190
+ ? (rowProps) => {
191
+ onRenderRow(rowProps);
192
+ consumerOnRenderRow(rowProps);
193
+ }
194
+ : onRenderRow,
195
+ // track loading for aria-busy, the consumer's renderLoadMask (if any) still renders the mask
196
+ renderLoadMask: (maskProps) => {
197
+ onRenderLoadMask(maskProps);
198
+ return opts.renderLoadMask ? opts.renderLoadMask(maskProps) : undefined;
199
+ },
200
+ };
201
+
202
+ const gridEditable = !!props.editable;
203
+ const a11yProps: any = {
204
+ headerProps: { role: 'row', 'aria-rowindex': 1, ...opts.headerProps },
205
+ rowIndexColumn: apply_column_a11y(
206
+ typeof opts.rowIndexColumn === 'object' ? opts.rowIndexColumn : {},
207
+ { role: 'rowheader', gridEditable }
208
+ ),
209
+ };
210
+ if (opts.checkboxColumn)
211
+ a11yProps.checkboxColumn = apply_column_a11y(
212
+ typeof opts.checkboxColumn === 'object' ? opts.checkboxColumn : {},
213
+ { gridEditable, markReadonly: false }
214
+ );
215
+
216
+ return {
217
+ ...opts,
218
+ ...events,
219
+ ...renderProps,
220
+ ...a11yProps,
221
+ };
222
+ }, [
223
+ props.static_gridOptions,
224
+ props.editable,
225
+ onRowClick,
226
+ onRowContextMenu,
227
+ onRenderRow,
228
+ onRenderLoadMask,
229
+ ]);
230
+
231
+ /* -------------------------------------------------------------------------- */
232
+ //TODO ContextMenu not from mui...
233
+ return (
234
+ <div ref={scopeRef} className={clsx('azgrid-scope azgrid-flexed azgrid-flexlayout', themeClass)}>
235
+ <ThemeProvider theme={menuTheme}>
236
+ <ContextMenu
237
+ classname="azgrid-context-menu"
238
+ menuAnchorEl={menuAnchorEl}
239
+ menuRow={menuRow}
240
+ close={update_menuRow}
241
+ dontAutoClose={false}
242
+ menu_items={props.contextMenuItems as any}
243
+ />
244
+ </ThemeProvider>
245
+ {props.details_dataSource ? (
246
+ <DataGridDetailsWrapper {...props} static_gridOptions={static_gridOptions} />
247
+ ) : (
248
+ <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />
249
+ )}
250
+ </div>
251
+ );
252
+ }
253
+
254
+ function DataGridDetailsWrapper(props: DataGridWrapperProps) {
255
+ const cached_details_columns = useColumnData(props.details_columns);
256
+ const details_dataSource = useDataSource(props.details_dataSource, props);
257
+ const renderDetailsGrid = ({ data }) => {
258
+ return (
259
+ <ReactDataGrid
260
+ theme="default-light"
261
+ className={clsx('azgrid', `azgrid-theme-${props.theme ?? (props.dark ? 'dark' : 'light')}`)}
262
+ defaultFilterValue={props.details_filter}
263
+ dataSource={details_dataSource}
264
+ columns={cached_details_columns}
265
+ />
266
+ );
267
+ };
268
+
269
+ /**
270
+ * Merge details into grid
271
+ */
272
+ const static_gridOptions = React.useMemo<AzGridOptions>(() => {
273
+ const finalresult = props.static_gridOptions || {};
274
+ finalresult['renderDetailsGrid'] = renderDetailsGrid;
275
+ return finalresult;
276
+ }, [props.static_gridOptions, props.theme, props.dark]);
277
+
278
+ return <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />;
279
+ }
280
+
281
+ function DataGridSizeWrapper(props: DataGridWrapperProps) {
282
+ if (props.delayedSize) {
283
+ return <DataGridDelayedSizeWrapper {...props} />;
284
+ } else {
285
+ return <DataGridNormalSizeWrapper {...props} />;
286
+ }
287
+ }
288
+
289
+ /* -------------------------------------------------------------------------- */
290
+ function DataGridNormalSizeWrapper(props: DataGridWrapperProps) {
291
+ return props.advancedFilterFields ? (
292
+ <DataGridSearchWrapper {...props} />
293
+ ) : (
294
+ <DataGridCore {...props} />
295
+ );
296
+ }
297
+ function DataGridDelayedSizeWrapper(props: DataGridWrapperProps) {
298
+ const { ref, height, width } = useComponentSize();
299
+ return (
300
+ <div ref={ref} className={'azgrid-filler azgrid-nooverflow '}>
301
+ <div
302
+ className={'azgrid-delayedresize azgrid-flexlayout'}
303
+ style={{ height: height, width: width }}
304
+ >
305
+ {props.advancedFilterFields ? (
306
+ <DataGridSearchWrapper {...props} />
307
+ ) : (
308
+ <DataGridCore {...props} />
309
+ )}
310
+ </div>
311
+ </div>
312
+ );
313
+ }
314
+ function DataGridSearchWrapper(props: DataGridWrapperProps) {
315
+ const { element, filteredData } = useGridSearch(props);
316
+
317
+ return (
318
+ <div className={'azgrid-flexed azgrid-flexlayout azgrid-nooverflow'}>
319
+ {element}
320
+ <DataGridCore {...props} dataSource={filteredData} />
321
+ </div>
322
+ );
323
+ }
324
+ const DataGridCore = React.memo(DataGridCoreView, (prev, next) =>
325
+ core_prop_names.every((name) => prev[name] === next[name])
326
+ );
327
+ function DataGridCoreView(props: DataGridWrapperProps) {
328
+ const { gridRef, liveGridRef } = props;
329
+ const handle = React.useCallback(
330
+ (ref) => {
331
+ if (ref) gridRef.current = ref.current as any;
332
+ if (liveGridRef) liveGridRef.current = ref as any;
333
+ },
334
+ [gridRef, liveGridRef]
335
+ );
336
+ return (
337
+ <div className={clsx(props.className, 'azgrid-flexed', 'azgrid-flexlayout')}>
338
+ <ReactDataGrid
339
+ {...props.static_gridOptions}
340
+ {...props.dynamic_gridOptions}
341
+ rowIndexColumn={props.static_gridOptions.rowIndexColumn || true}
342
+ handle={handle}
343
+ theme="default-light"
344
+ className={clsx(
345
+ 'azgrid azgrid-flexed',
346
+ props.allowChildRows && 'azgrid-tree',
347
+ `azgrid-theme-${props.theme ?? (props.dark ? 'dark' : 'light')}`
348
+ )}
349
+ columns={props.columns}
350
+ dataSource={props.dataSource}
351
+ />
352
+ {props.children}
353
+ </div>
354
+ );
355
+ }
356
+ /* -------------------------------------------------------------------------- */
357
+ /* -------------------------------------------------------------------------- */
358
+ /* -------------------------------------------------------------------------- */
359
+ /* -------------------------------------------------------------------------- */
360
+
361
+ /* -------------------------------------------------------------------------- */
362
+ export default AzGrid;