react-open-source-grid 1.5.3 → 1.5.4
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/lib/App.d.ts +3 -0
- package/dist/lib/chunk-FG3FLQAE.js +296 -0
- package/dist/lib/components/AccessibilityDemo.d.ts +8 -0
- package/dist/lib/components/ApiReferencePage.d.ts +2 -0
- package/dist/lib/components/BenchmarkDemo.d.ts +2 -0
- package/dist/lib/components/CellRenderersDemo.d.ts +16 -0
- package/dist/lib/components/CodeBlock.d.ts +10 -0
- package/dist/lib/components/ColumnFiltersDemo.d.ts +5 -0
- package/dist/lib/components/CompleteApiReferencePage.d.ts +2 -0
- package/dist/lib/components/ContextMenuDemo.d.ts +12 -0
- package/dist/lib/components/DataGrid/ARCHITECTURE.md.d.ts +288 -0
- package/dist/lib/components/DataGrid/AdvancedFilterBuilder.d.ts +12 -0
- package/dist/lib/components/DataGrid/CellRenderers.d.ts +64 -0
- package/dist/lib/components/DataGrid/ColumnChooser.d.ts +12 -0
- package/dist/lib/components/DataGrid/ColumnFilters.d.ts +16 -0
- package/dist/lib/components/DataGrid/ContextMenu.d.ts +10 -0
- package/dist/lib/components/DataGrid/DataGrid.d.ts +22 -0
- package/dist/lib/components/DataGrid/DensityToggle.d.ts +23 -0
- package/dist/lib/components/DataGrid/DragHandle.d.ts +7 -0
- package/dist/lib/components/DataGrid/DraggableRow.d.ts +14 -0
- package/dist/lib/components/DataGrid/ExportMenu.d.ts +12 -0
- package/dist/lib/components/DataGrid/FacetedSearch.d.ts +29 -0
- package/dist/lib/components/DataGrid/FilteredSearchBar.d.ts +36 -0
- package/dist/lib/components/DataGrid/FocusTrap.d.ts +12 -0
- package/dist/lib/components/DataGrid/GridApiDemo.d.ts +6 -0
- package/dist/lib/components/DataGrid/GridBody.d.ts +42 -0
- package/dist/lib/components/DataGrid/GridFooter.d.ts +18 -0
- package/dist/lib/components/DataGrid/GridHeader.d.ts +18 -0
- package/dist/lib/components/DataGrid/GridPagination.d.ts +10 -0
- package/dist/lib/components/DataGrid/GroupByPanel.d.ts +9 -0
- package/dist/lib/components/DataGrid/GroupRow.d.ts +31 -0
- package/dist/lib/components/DataGrid/InfiniteScrollDataGrid.d.ts +39 -0
- package/dist/lib/components/DataGrid/LayoutPresetsManager.d.ts +11 -0
- package/dist/lib/components/DataGrid/MarketDataEngine.d.ts +165 -0
- package/dist/lib/components/DataGrid/MarketDataGrid.d.ts +33 -0
- package/dist/lib/components/DataGrid/MarketDataGridUtils.d.ts +13 -0
- package/dist/lib/components/DataGrid/ScreenReaderAnnouncer.d.ts +8 -0
- package/dist/lib/components/DataGrid/ServerSideDataSource.d.ts +136 -0
- package/dist/lib/components/DataGrid/ThemeSelector.d.ts +12 -0
- package/dist/lib/components/DataGrid/Tooltip.d.ts +15 -0
- package/dist/lib/components/DataGrid/TreeRow.d.ts +31 -0
- package/dist/lib/components/DataGrid/VirtualScroller.d.ts +35 -0
- package/dist/lib/components/DataGrid/WebSocketMockFeed.d.ts +121 -0
- package/dist/lib/components/DataGrid/aggregationUtils.d.ts +25 -0
- package/dist/lib/components/DataGrid/contextMenuUtils.d.ts +36 -0
- package/dist/lib/components/DataGrid/demos/TooltipDemo.d.ts +1 -0
- package/dist/lib/components/DataGrid/densityModes.d.ts +42 -0
- package/dist/lib/components/DataGrid/dragRowUtils.d.ts +98 -0
- package/dist/lib/components/DataGrid/exportUtils.d.ts +30 -0
- package/dist/lib/components/DataGrid/filterUtils.d.ts +17 -0
- package/dist/lib/components/DataGrid/gridApi.d.ts +142 -0
- package/dist/lib/components/DataGrid/gridApi.types.d.ts +348 -0
- package/dist/lib/components/DataGrid/gridReducer.d.ts +4 -0
- package/dist/lib/components/DataGrid/groupingUtils.d.ts +17 -0
- package/dist/lib/components/DataGrid/index.d.ts +41 -0
- package/dist/lib/components/DataGrid/layoutPersistence.d.ts +95 -0
- package/dist/lib/components/DataGrid/themes.d.ts +113 -0
- package/dist/lib/components/DataGrid/treeDataUtils.d.ts +97 -0
- package/dist/lib/components/DataGrid/types.d.ts +536 -0
- package/dist/lib/components/DataGrid/useContextMenu.d.ts +31 -0
- package/dist/lib/components/DataGrid/useDensityMode.d.ts +36 -0
- package/dist/lib/components/DataGrid/useFocusTrap.d.ts +14 -0
- package/dist/lib/components/DataGrid/useMarketData.d.ts +57 -0
- package/dist/lib/components/DataGrid/useScreenReaderAnnouncements.d.ts +23 -0
- package/dist/lib/components/DataGrid/useTooltip.d.ts +21 -0
- package/dist/lib/components/DemoGridPage.d.ts +2 -0
- package/dist/lib/components/DensityModeDemo.d.ts +12 -0
- package/dist/lib/components/FacetedSearchDemo.d.ts +8 -0
- package/dist/lib/components/FeatureGallery.d.ts +2 -0
- package/dist/lib/components/FilteredSearchDemo.d.ts +7 -0
- package/dist/lib/components/GridApiDemoPage.d.ts +2 -0
- package/dist/lib/components/HomePage.d.ts +1 -0
- package/dist/lib/components/InfiniteScrollDemo.d.ts +13 -0
- package/dist/lib/components/LayoutPersistenceDemo.d.ts +2 -0
- package/dist/lib/components/LiveMarketDemo.d.ts +18 -0
- package/dist/lib/components/MarketDataExamples.d.ts +42 -0
- package/dist/lib/components/RowDraggingDemo.d.ts +3 -0
- package/dist/lib/components/RowPinningDemo.d.ts +12 -0
- package/dist/lib/components/ThemesDemo.d.ts +17 -0
- package/dist/lib/components/TooltipDemo.d.ts +1 -0
- package/dist/lib/components/TreeDataDemo.d.ts +3 -0
- package/dist/lib/components/VirtualScrollDemo.d.ts +13 -0
- package/dist/lib/index.cjs +12233 -0
- package/dist/lib/index.css +465 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +11827 -0
- package/dist/lib/layoutPersistence-2MPTAEYI.js +20 -0
- package/dist/lib/main.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ThemeName } from './themes';
|
|
3
|
+
import type { DensityMode } from './densityModes';
|
|
4
|
+
import type { GridApi } from './gridApi.types';
|
|
5
|
+
export type FilterType = 'text' | 'number' | 'date' | 'set' | 'multi';
|
|
6
|
+
export interface Column {
|
|
7
|
+
field: string;
|
|
8
|
+
headerName: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
editable?: boolean;
|
|
11
|
+
sortable?: boolean;
|
|
12
|
+
filterable?: boolean;
|
|
13
|
+
pinnable?: boolean;
|
|
14
|
+
filterType?: FilterType;
|
|
15
|
+
renderCell?: (row: Row) => React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface Row {
|
|
18
|
+
id: string | number;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export interface TreeNode extends Row {
|
|
22
|
+
isTreeNode: true;
|
|
23
|
+
nodeId: string | number;
|
|
24
|
+
parentId: string | number | null;
|
|
25
|
+
level: number;
|
|
26
|
+
hasChildren: boolean;
|
|
27
|
+
isExpanded: boolean;
|
|
28
|
+
children?: TreeNode[];
|
|
29
|
+
}
|
|
30
|
+
export interface TreeConfig {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
idField?: string;
|
|
33
|
+
parentIdField?: string;
|
|
34
|
+
childrenField?: string;
|
|
35
|
+
indentSize?: number;
|
|
36
|
+
showExpandIcon?: boolean;
|
|
37
|
+
showConnectors?: boolean;
|
|
38
|
+
lazyLoad?: boolean;
|
|
39
|
+
onNodeExpand?: (node: TreeNode) => void | Promise<TreeNode[]>;
|
|
40
|
+
onNodeCollapse?: (node: TreeNode) => void;
|
|
41
|
+
}
|
|
42
|
+
export interface ExpandedNodes {
|
|
43
|
+
[nodeKey: string]: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface SortConfig {
|
|
46
|
+
field: string;
|
|
47
|
+
direction: 'asc' | 'desc' | null;
|
|
48
|
+
}
|
|
49
|
+
export interface FilterValue {
|
|
50
|
+
type?: string;
|
|
51
|
+
value?: any;
|
|
52
|
+
value2?: any;
|
|
53
|
+
values?: any[];
|
|
54
|
+
}
|
|
55
|
+
export interface FilterCondition {
|
|
56
|
+
type: string;
|
|
57
|
+
value?: any;
|
|
58
|
+
value2?: any;
|
|
59
|
+
values?: any[];
|
|
60
|
+
}
|
|
61
|
+
export interface AdvancedFilterValue {
|
|
62
|
+
operator: 'AND' | 'OR';
|
|
63
|
+
conditions: FilterCondition[];
|
|
64
|
+
}
|
|
65
|
+
export interface FilterConfig {
|
|
66
|
+
[field: string]: FilterValue | AdvancedFilterValue | null;
|
|
67
|
+
}
|
|
68
|
+
export interface SelectionState {
|
|
69
|
+
selectedRows: Set<string | number>;
|
|
70
|
+
lastSelectedIndex: number | null;
|
|
71
|
+
}
|
|
72
|
+
export interface EditState {
|
|
73
|
+
rowId: string | number | null;
|
|
74
|
+
field: string | null;
|
|
75
|
+
value: any;
|
|
76
|
+
}
|
|
77
|
+
export interface FocusState {
|
|
78
|
+
rowIndex: number;
|
|
79
|
+
columnIndex: number;
|
|
80
|
+
}
|
|
81
|
+
export type AggregateFunction = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'total';
|
|
82
|
+
export interface GroupConfig {
|
|
83
|
+
field: string;
|
|
84
|
+
aggregates?: {
|
|
85
|
+
field: string;
|
|
86
|
+
function: AggregateFunction;
|
|
87
|
+
}[];
|
|
88
|
+
}
|
|
89
|
+
export interface AggregateConfig {
|
|
90
|
+
field: string;
|
|
91
|
+
function: AggregateFunction;
|
|
92
|
+
label?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface FooterConfig {
|
|
95
|
+
show: boolean;
|
|
96
|
+
aggregates?: AggregateConfig[];
|
|
97
|
+
showGroupFooters?: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface GroupedRow {
|
|
100
|
+
isGroup: true;
|
|
101
|
+
groupKey: string;
|
|
102
|
+
groupValue: any;
|
|
103
|
+
field: string;
|
|
104
|
+
level: number;
|
|
105
|
+
children: (Row | GroupedRow)[];
|
|
106
|
+
isExpanded: boolean;
|
|
107
|
+
aggregates?: {
|
|
108
|
+
[key: string]: any;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export interface ExpandedGroups {
|
|
112
|
+
[groupKey: string]: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface GridState {
|
|
115
|
+
columns: Column[];
|
|
116
|
+
sortConfig: SortConfig;
|
|
117
|
+
filterConfig: FilterConfig;
|
|
118
|
+
currentPage: number;
|
|
119
|
+
pageSize: number;
|
|
120
|
+
selection: SelectionState;
|
|
121
|
+
editState: EditState;
|
|
122
|
+
focusState: FocusState | null;
|
|
123
|
+
columnOrder: string[];
|
|
124
|
+
columnWidths: {
|
|
125
|
+
[field: string]: number;
|
|
126
|
+
};
|
|
127
|
+
groupBy: string[];
|
|
128
|
+
expandedGroups: ExpandedGroups;
|
|
129
|
+
pinnedColumnsLeft: string[];
|
|
130
|
+
pinnedColumnsRight: string[];
|
|
131
|
+
hiddenColumns: string[];
|
|
132
|
+
expandedNodes: ExpandedNodes;
|
|
133
|
+
dragState: DragState;
|
|
134
|
+
pinnedRowsTop: (string | number)[];
|
|
135
|
+
pinnedRowsBottom: (string | number)[];
|
|
136
|
+
}
|
|
137
|
+
export type GridAction = {
|
|
138
|
+
type: 'SET_SORT';
|
|
139
|
+
payload: SortConfig;
|
|
140
|
+
} | {
|
|
141
|
+
type: 'SET_FILTER';
|
|
142
|
+
payload: {
|
|
143
|
+
field: string;
|
|
144
|
+
value: FilterValue | AdvancedFilterValue | null;
|
|
145
|
+
};
|
|
146
|
+
} | {
|
|
147
|
+
type: 'CLEAR_FILTERS';
|
|
148
|
+
} | {
|
|
149
|
+
type: 'SET_PAGE';
|
|
150
|
+
payload: number;
|
|
151
|
+
} | {
|
|
152
|
+
type: 'SET_PAGE_SIZE';
|
|
153
|
+
payload: number;
|
|
154
|
+
} | {
|
|
155
|
+
type: 'TOGGLE_ROW_SELECTION';
|
|
156
|
+
payload: {
|
|
157
|
+
rowId: string | number;
|
|
158
|
+
isMulti: boolean;
|
|
159
|
+
};
|
|
160
|
+
} | {
|
|
161
|
+
type: 'SELECT_RANGE';
|
|
162
|
+
payload: {
|
|
163
|
+
startIndex: number;
|
|
164
|
+
endIndex: number;
|
|
165
|
+
rowIds: (string | number)[];
|
|
166
|
+
};
|
|
167
|
+
} | {
|
|
168
|
+
type: 'CLEAR_SELECTION';
|
|
169
|
+
} | {
|
|
170
|
+
type: 'START_EDIT';
|
|
171
|
+
payload: {
|
|
172
|
+
rowId: string | number;
|
|
173
|
+
field: string;
|
|
174
|
+
value: any;
|
|
175
|
+
};
|
|
176
|
+
} | {
|
|
177
|
+
type: 'END_EDIT';
|
|
178
|
+
} | {
|
|
179
|
+
type: 'SET_FOCUS';
|
|
180
|
+
payload: FocusState | null;
|
|
181
|
+
} | {
|
|
182
|
+
type: 'REORDER_COLUMNS';
|
|
183
|
+
payload: {
|
|
184
|
+
fromIndex: number;
|
|
185
|
+
toIndex: number;
|
|
186
|
+
};
|
|
187
|
+
} | {
|
|
188
|
+
type: 'RESIZE_COLUMN';
|
|
189
|
+
payload: {
|
|
190
|
+
field: string;
|
|
191
|
+
width: number;
|
|
192
|
+
};
|
|
193
|
+
} | {
|
|
194
|
+
type: 'RESET_COLUMNS';
|
|
195
|
+
payload: Column[];
|
|
196
|
+
} | {
|
|
197
|
+
type: 'ADD_GROUP';
|
|
198
|
+
payload: string;
|
|
199
|
+
} | {
|
|
200
|
+
type: 'REMOVE_GROUP';
|
|
201
|
+
payload: string;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'REORDER_GROUPS';
|
|
204
|
+
payload: {
|
|
205
|
+
fromIndex: number;
|
|
206
|
+
toIndex: number;
|
|
207
|
+
};
|
|
208
|
+
} | {
|
|
209
|
+
type: 'TOGGLE_GROUP';
|
|
210
|
+
payload: string;
|
|
211
|
+
} | {
|
|
212
|
+
type: 'CLEAR_GROUPS';
|
|
213
|
+
} | {
|
|
214
|
+
type: 'PIN_COLUMN';
|
|
215
|
+
payload: {
|
|
216
|
+
field: string;
|
|
217
|
+
side: 'left' | 'right';
|
|
218
|
+
};
|
|
219
|
+
} | {
|
|
220
|
+
type: 'UNPIN_COLUMN';
|
|
221
|
+
payload: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: 'TOGGLE_COLUMN_VISIBILITY';
|
|
224
|
+
payload: string;
|
|
225
|
+
} | {
|
|
226
|
+
type: 'SET_COLUMN_VISIBILITY';
|
|
227
|
+
payload: {
|
|
228
|
+
field: string;
|
|
229
|
+
visible: boolean;
|
|
230
|
+
};
|
|
231
|
+
} | {
|
|
232
|
+
type: 'RESET_COLUMN_LAYOUT';
|
|
233
|
+
} | {
|
|
234
|
+
type: 'LOAD_LAYOUT_PRESET';
|
|
235
|
+
payload: LayoutPreset['layout'];
|
|
236
|
+
} | {
|
|
237
|
+
type: 'APPLY_LAYOUT';
|
|
238
|
+
payload: Partial<LayoutPreset['layout']>;
|
|
239
|
+
} | {
|
|
240
|
+
type: 'TOGGLE_TREE_NODE';
|
|
241
|
+
payload: string | number;
|
|
242
|
+
} | {
|
|
243
|
+
type: 'EXPAND_ALL_NODES';
|
|
244
|
+
} | {
|
|
245
|
+
type: 'COLLAPSE_ALL_NODES';
|
|
246
|
+
} | {
|
|
247
|
+
type: 'SET_EXPANDED_NODES';
|
|
248
|
+
payload: ExpandedNodes;
|
|
249
|
+
} | {
|
|
250
|
+
type: 'SET_DRAG_STATE';
|
|
251
|
+
payload: DragState;
|
|
252
|
+
} | {
|
|
253
|
+
type: 'START_DRAG';
|
|
254
|
+
payload: {
|
|
255
|
+
rowId: string | number;
|
|
256
|
+
rowIndex: number;
|
|
257
|
+
};
|
|
258
|
+
} | {
|
|
259
|
+
type: 'END_DRAG';
|
|
260
|
+
} | {
|
|
261
|
+
type: 'PIN_ROW_TOP';
|
|
262
|
+
payload: string | number;
|
|
263
|
+
} | {
|
|
264
|
+
type: 'PIN_ROW_BOTTOM';
|
|
265
|
+
payload: string | number;
|
|
266
|
+
} | {
|
|
267
|
+
type: 'UNPIN_ROW';
|
|
268
|
+
payload: string | number;
|
|
269
|
+
} | {
|
|
270
|
+
type: 'SET_ROW_DATA';
|
|
271
|
+
payload: Row[];
|
|
272
|
+
} | {
|
|
273
|
+
type: 'SET_COLUMN_DEFS';
|
|
274
|
+
payload: Column[];
|
|
275
|
+
} | {
|
|
276
|
+
type: 'SORT_COLUMN';
|
|
277
|
+
payload: string;
|
|
278
|
+
} | {
|
|
279
|
+
type: 'SET_SORT_MODEL';
|
|
280
|
+
payload: SortConfig[];
|
|
281
|
+
} | {
|
|
282
|
+
type: 'CLEAR_ALL_FILTERS';
|
|
283
|
+
} | {
|
|
284
|
+
type: 'CLEAR_ALL_SORTING';
|
|
285
|
+
} | {
|
|
286
|
+
type: 'SELECT_ROW';
|
|
287
|
+
payload: {
|
|
288
|
+
rowId: string | number;
|
|
289
|
+
ctrlKey: boolean;
|
|
290
|
+
};
|
|
291
|
+
} | {
|
|
292
|
+
type: 'DESELECT_ROW';
|
|
293
|
+
payload: string | number;
|
|
294
|
+
} | {
|
|
295
|
+
type: 'SELECT_ALL_ROWS';
|
|
296
|
+
} | {
|
|
297
|
+
type: 'DESELECT_ALL_ROWS';
|
|
298
|
+
} | {
|
|
299
|
+
type: 'CLEAR_FOCUS';
|
|
300
|
+
} | {
|
|
301
|
+
type: 'START_EDITING';
|
|
302
|
+
payload: {
|
|
303
|
+
rowId: string | number;
|
|
304
|
+
field: string;
|
|
305
|
+
value: any;
|
|
306
|
+
};
|
|
307
|
+
} | {
|
|
308
|
+
type: 'CANCEL_EDITING';
|
|
309
|
+
} | {
|
|
310
|
+
type: 'SAVE_EDIT';
|
|
311
|
+
} | {
|
|
312
|
+
type: 'REFRESH_CELLS';
|
|
313
|
+
payload?: unknown;
|
|
314
|
+
} | {
|
|
315
|
+
type: 'REFRESH_HEADER';
|
|
316
|
+
} | {
|
|
317
|
+
type: 'REDRAW_ROWS';
|
|
318
|
+
payload?: unknown;
|
|
319
|
+
} | {
|
|
320
|
+
type: 'SHOW_OVERLAY';
|
|
321
|
+
payload: 'loading' | 'noRows';
|
|
322
|
+
} | {
|
|
323
|
+
type: 'HIDE_OVERLAY';
|
|
324
|
+
} | {
|
|
325
|
+
type: 'SET_GROUP_BY';
|
|
326
|
+
payload: string[];
|
|
327
|
+
} | {
|
|
328
|
+
type: 'RECALCULATE_LAYOUT';
|
|
329
|
+
} | {
|
|
330
|
+
type: 'RESET_COLUMN_STATE';
|
|
331
|
+
};
|
|
332
|
+
export interface VirtualScrollConfig {
|
|
333
|
+
enabled: boolean;
|
|
334
|
+
rowHeight?: number | ((index: number, row: Row | GroupedRow) => number);
|
|
335
|
+
containerHeight?: number;
|
|
336
|
+
overscanCount?: number;
|
|
337
|
+
enableColumnVirtualization?: boolean;
|
|
338
|
+
columnOverscan?: number;
|
|
339
|
+
}
|
|
340
|
+
export interface LayoutPreset {
|
|
341
|
+
id: string;
|
|
342
|
+
name: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
createdAt: number;
|
|
345
|
+
updatedAt: number;
|
|
346
|
+
layout: {
|
|
347
|
+
columnOrder: string[];
|
|
348
|
+
columnWidths: {
|
|
349
|
+
[field: string]: number;
|
|
350
|
+
};
|
|
351
|
+
pinnedColumnsLeft: string[];
|
|
352
|
+
pinnedColumnsRight: string[];
|
|
353
|
+
hiddenColumns: string[];
|
|
354
|
+
sortConfig: SortConfig;
|
|
355
|
+
filterConfig: FilterConfig;
|
|
356
|
+
pageSize: number;
|
|
357
|
+
groupBy?: string[];
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
export type StorageStrategy = 'localStorage' | 'server' | 'userProfile';
|
|
361
|
+
export interface StorageAdapter {
|
|
362
|
+
save(key: string, preset: LayoutPreset): Promise<void>;
|
|
363
|
+
load(key: string, presetId?: string): Promise<LayoutPreset | LayoutPreset[] | null>;
|
|
364
|
+
delete(key: string, presetId: string): Promise<void>;
|
|
365
|
+
list(key: string): Promise<LayoutPreset[]>;
|
|
366
|
+
}
|
|
367
|
+
export interface ServerConfig {
|
|
368
|
+
baseUrl: string;
|
|
369
|
+
headers?: Record<string, string>;
|
|
370
|
+
saveEndpoint?: string;
|
|
371
|
+
loadEndpoint?: string;
|
|
372
|
+
deleteEndpoint?: string;
|
|
373
|
+
listEndpoint?: string;
|
|
374
|
+
}
|
|
375
|
+
export interface UserProfileConfig {
|
|
376
|
+
userId: string;
|
|
377
|
+
profileKey?: string;
|
|
378
|
+
adapter?: StorageAdapter;
|
|
379
|
+
}
|
|
380
|
+
export interface PersistenceConfig {
|
|
381
|
+
enabled: boolean;
|
|
382
|
+
storageKey: string;
|
|
383
|
+
strategy?: StorageStrategy;
|
|
384
|
+
autoSave?: boolean;
|
|
385
|
+
autoSaveDelay?: number;
|
|
386
|
+
autoLoad?: boolean;
|
|
387
|
+
serverConfig?: ServerConfig;
|
|
388
|
+
userProfileConfig?: UserProfileConfig;
|
|
389
|
+
customAdapter?: StorageAdapter;
|
|
390
|
+
}
|
|
391
|
+
export interface RowPinConfig {
|
|
392
|
+
enabled: boolean;
|
|
393
|
+
showPinButton?: boolean;
|
|
394
|
+
maxPinnedTop?: number;
|
|
395
|
+
maxPinnedBottom?: number;
|
|
396
|
+
onPinChange?: (pinnedTop: (string | number)[], pinnedBottom: (string | number)[]) => void;
|
|
397
|
+
}
|
|
398
|
+
export interface DragRowConfig {
|
|
399
|
+
enabled: boolean;
|
|
400
|
+
showDragHandle?: boolean;
|
|
401
|
+
allowCrossGroup?: boolean;
|
|
402
|
+
allowExternalDrop?: boolean;
|
|
403
|
+
dragHandlePosition?: 'left' | 'right';
|
|
404
|
+
onDragStart?: (row: Row, rowIndex: number) => void;
|
|
405
|
+
onDragEnd?: () => void;
|
|
406
|
+
onRowDrop?: (sourceIndex: number, targetIndex: number, row: Row) => void;
|
|
407
|
+
onRowMove?: (sourceIndex: number, targetIndex: number) => void;
|
|
408
|
+
onExternalDrop?: (data: any, targetIndex: number) => void;
|
|
409
|
+
}
|
|
410
|
+
export interface DragState {
|
|
411
|
+
isDragging: boolean;
|
|
412
|
+
draggedRowId: string | number | null;
|
|
413
|
+
draggedRowIndex: number | null;
|
|
414
|
+
dropTargetIndex: number | null;
|
|
415
|
+
dropPosition: 'before' | 'after' | null;
|
|
416
|
+
}
|
|
417
|
+
export interface MarketDataConfig {
|
|
418
|
+
enabled: boolean;
|
|
419
|
+
flashDuration?: number;
|
|
420
|
+
enableFlash?: boolean;
|
|
421
|
+
enableLiveSorting?: boolean;
|
|
422
|
+
enableRankingMovement?: boolean;
|
|
423
|
+
batchInterval?: number;
|
|
424
|
+
maxUpdatesPerFrame?: number;
|
|
425
|
+
cpuThreshold?: number;
|
|
426
|
+
densityMode?: boolean;
|
|
427
|
+
}
|
|
428
|
+
export interface CellUpdate {
|
|
429
|
+
rowId: string | number;
|
|
430
|
+
field: string;
|
|
431
|
+
oldValue: any;
|
|
432
|
+
newValue: any;
|
|
433
|
+
timestamp: number;
|
|
434
|
+
}
|
|
435
|
+
export interface FlashAnimation {
|
|
436
|
+
cellKey: string;
|
|
437
|
+
direction: 'up' | 'down';
|
|
438
|
+
startTime: number;
|
|
439
|
+
duration: number;
|
|
440
|
+
}
|
|
441
|
+
export interface ContextMenuItem {
|
|
442
|
+
id?: string;
|
|
443
|
+
label: string;
|
|
444
|
+
icon?: React.ReactNode;
|
|
445
|
+
onClick?: () => void;
|
|
446
|
+
disabled?: boolean;
|
|
447
|
+
danger?: boolean;
|
|
448
|
+
type?: 'item' | 'separator';
|
|
449
|
+
shortcut?: string;
|
|
450
|
+
submenu?: ContextMenuItem[];
|
|
451
|
+
}
|
|
452
|
+
export interface ContextMenuConfig {
|
|
453
|
+
enabled?: boolean;
|
|
454
|
+
showCopy?: boolean;
|
|
455
|
+
showExport?: boolean;
|
|
456
|
+
showColumnOptions?: boolean;
|
|
457
|
+
showFilterByValue?: boolean;
|
|
458
|
+
customItems?: ContextMenuItem[];
|
|
459
|
+
onBeforeShow?: (event: ContextMenuEvent) => ContextMenuItem[] | null;
|
|
460
|
+
}
|
|
461
|
+
export interface ContextMenuEvent {
|
|
462
|
+
type: 'cell' | 'header' | 'row';
|
|
463
|
+
row?: Row;
|
|
464
|
+
column?: Column;
|
|
465
|
+
rowIndex?: number;
|
|
466
|
+
columnIndex?: number;
|
|
467
|
+
event: React.MouseEvent;
|
|
468
|
+
}
|
|
469
|
+
export interface ContextMenuProps {
|
|
470
|
+
x: number;
|
|
471
|
+
y: number;
|
|
472
|
+
items: ContextMenuItem[];
|
|
473
|
+
onClose: () => void;
|
|
474
|
+
}
|
|
475
|
+
export interface ContextMenuState {
|
|
476
|
+
isOpen: boolean;
|
|
477
|
+
x: number;
|
|
478
|
+
y: number;
|
|
479
|
+
items: ContextMenuItem[];
|
|
480
|
+
contextType: 'cell' | 'header' | 'row' | null;
|
|
481
|
+
targetRow?: Row;
|
|
482
|
+
targetColumn?: Column;
|
|
483
|
+
targetRowIndex?: number;
|
|
484
|
+
targetColumnIndex?: number;
|
|
485
|
+
}
|
|
486
|
+
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right' | 'auto';
|
|
487
|
+
export interface TooltipContent {
|
|
488
|
+
title?: string;
|
|
489
|
+
content: React.ReactNode;
|
|
490
|
+
}
|
|
491
|
+
export interface TooltipConfig {
|
|
492
|
+
enabled?: boolean;
|
|
493
|
+
showDelay?: number;
|
|
494
|
+
hideDelay?: number;
|
|
495
|
+
placement?: TooltipPlacement;
|
|
496
|
+
offset?: number;
|
|
497
|
+
maxWidth?: number;
|
|
498
|
+
showCellTooltips?: boolean;
|
|
499
|
+
showRowTooltips?: boolean;
|
|
500
|
+
getCellTooltip?: (row: Row, column: Column, value: any) => TooltipContent | string | null;
|
|
501
|
+
getRowTooltip?: (row: Row, rowIndex: number) => TooltipContent | string | null;
|
|
502
|
+
}
|
|
503
|
+
export interface TooltipState {
|
|
504
|
+
isVisible: boolean;
|
|
505
|
+
x: number;
|
|
506
|
+
y: number;
|
|
507
|
+
placement: TooltipPlacement;
|
|
508
|
+
content: TooltipContent | null;
|
|
509
|
+
targetRect: DOMRect | null;
|
|
510
|
+
}
|
|
511
|
+
export interface DataGridProps {
|
|
512
|
+
columns: Column[];
|
|
513
|
+
rows: Row[];
|
|
514
|
+
pageSize?: number;
|
|
515
|
+
showColumnPinning?: boolean;
|
|
516
|
+
footerConfig?: FooterConfig;
|
|
517
|
+
virtualScrollConfig?: VirtualScrollConfig;
|
|
518
|
+
persistenceConfig?: PersistenceConfig;
|
|
519
|
+
treeConfig?: TreeConfig;
|
|
520
|
+
dragRowConfig?: DragRowConfig;
|
|
521
|
+
rowPinConfig?: RowPinConfig;
|
|
522
|
+
marketDataConfig?: MarketDataConfig;
|
|
523
|
+
contextMenuConfig?: ContextMenuConfig;
|
|
524
|
+
tooltipConfig?: TooltipConfig;
|
|
525
|
+
tableId?: string;
|
|
526
|
+
theme?: ThemeName;
|
|
527
|
+
densityMode?: DensityMode;
|
|
528
|
+
showDensityToggle?: boolean;
|
|
529
|
+
onDensityChange?: (mode: DensityMode) => void;
|
|
530
|
+
onRowClick?: (row: Row) => void;
|
|
531
|
+
onCellEdit?: (rowIndex: number, field: string, value: any) => void;
|
|
532
|
+
onSelectionChange?: (selectedIds: (string | number)[]) => void;
|
|
533
|
+
onLayoutChange?: (layout: LayoutPreset['layout']) => void;
|
|
534
|
+
onRowReorder?: (rows: Row[]) => void;
|
|
535
|
+
onGridReady?: (api: GridApi) => void;
|
|
536
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ContextMenuState, ContextMenuConfig, ContextMenuEvent, Column, Row, FilterValue } from './types';
|
|
2
|
+
interface UseContextMenuProps {
|
|
3
|
+
config?: ContextMenuConfig;
|
|
4
|
+
columns: Column[];
|
|
5
|
+
rows: Row[];
|
|
6
|
+
selectedRows: Set<string | number>;
|
|
7
|
+
onPinColumn?: (field: string, side: 'left' | 'right') => void;
|
|
8
|
+
onUnpinColumn?: (field: string) => void;
|
|
9
|
+
onToggleColumnVisibility?: (field: string) => void;
|
|
10
|
+
onResizeColumn?: (field: string, width: number) => void;
|
|
11
|
+
onAutoSizeAllColumns?: (widths: {
|
|
12
|
+
[field: string]: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
onSetFilter?: (field: string, value: FilterValue | null) => void;
|
|
15
|
+
onPinRowTop?: (rowId: string | number) => void;
|
|
16
|
+
onPinRowBottom?: (rowId: string | number) => void;
|
|
17
|
+
onUnpinRow?: (rowId: string | number) => void;
|
|
18
|
+
pinnedColumnsLeft?: string[];
|
|
19
|
+
pinnedColumnsRight?: string[];
|
|
20
|
+
pinnedRowsTop?: (string | number)[];
|
|
21
|
+
pinnedRowsBottom?: (string | number)[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Hook to manage context menu state and actions
|
|
25
|
+
*/
|
|
26
|
+
export declare const useContextMenu: ({ config, columns, rows, selectedRows, onPinColumn, onUnpinColumn, onToggleColumnVisibility, onResizeColumn, onAutoSizeAllColumns, onSetFilter, onPinRowTop, onPinRowBottom, onUnpinRow, pinnedColumnsLeft, pinnedColumnsRight, pinnedRowsTop, pinnedRowsBottom, }: UseContextMenuProps) => {
|
|
27
|
+
contextMenu: ContextMenuState;
|
|
28
|
+
handleContextMenu: (event: ContextMenuEvent) => void;
|
|
29
|
+
closeContextMenu: () => void;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { DensityMode } from './densityModes';
|
|
2
|
+
import { getDensityConfig } from './densityModes';
|
|
3
|
+
export interface UseDensityModeOptions {
|
|
4
|
+
initialMode?: DensityMode;
|
|
5
|
+
persist?: boolean;
|
|
6
|
+
persistenceKey?: string;
|
|
7
|
+
onChange?: (mode: DensityMode) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UseDensityModeReturn {
|
|
10
|
+
densityMode: DensityMode;
|
|
11
|
+
setDensityMode: (mode: DensityMode) => void;
|
|
12
|
+
densityConfig: ReturnType<typeof getDensityConfig>;
|
|
13
|
+
densityStyles: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* useDensityMode Hook
|
|
17
|
+
*
|
|
18
|
+
* Manages density mode state and provides CSS variables for styling.
|
|
19
|
+
* Supports persistence to localStorage.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { densityMode, setDensityMode, densityStyles } = useDensityMode({
|
|
24
|
+
* initialMode: 'normal',
|
|
25
|
+
* persist: true
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* return (
|
|
29
|
+
* <div style={densityStyles}>
|
|
30
|
+
* <DensityToggle value={densityMode} onChange={setDensityMode} />
|
|
31
|
+
* <DataGrid ... />
|
|
32
|
+
* </div>
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function useDensityMode(options?: UseDensityModeOptions): UseDensityModeReturn;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFocusTrap Hook
|
|
3
|
+
*
|
|
4
|
+
* Traps focus within a container element (useful for modals, dialogs, and popups).
|
|
5
|
+
* Ensures keyboard navigation stays within the trapped area for accessibility.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export declare const useFocusTrap: (options?: {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
initialFocus?: "first" | "last" | HTMLElement | null;
|
|
11
|
+
returnFocus?: boolean;
|
|
12
|
+
escapeDeactivates?: boolean;
|
|
13
|
+
onEscape?: () => void;
|
|
14
|
+
}) => React.RefObject<HTMLElement | null>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useMarketData.ts
|
|
3
|
+
*
|
|
4
|
+
* React hook for managing market data subscriptions, WebSocket connections,
|
|
5
|
+
* and integrating with MarketDataEngine.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - WebSocket connection management
|
|
9
|
+
* - Auto-reconnect with exponential backoff
|
|
10
|
+
* - Data ingestion pipeline
|
|
11
|
+
* - Subscription management
|
|
12
|
+
* - Connection state tracking
|
|
13
|
+
*/
|
|
14
|
+
import { MarketDataEngine } from './MarketDataEngine';
|
|
15
|
+
import type { RowUpdate, MarketDataRow } from './MarketDataEngine';
|
|
16
|
+
export interface WebSocketConfig {
|
|
17
|
+
url: string;
|
|
18
|
+
reconnect?: boolean;
|
|
19
|
+
reconnectDelay?: number;
|
|
20
|
+
maxReconnectDelay?: number;
|
|
21
|
+
reconnectAttempts?: number;
|
|
22
|
+
onConnect?: () => void;
|
|
23
|
+
onDisconnect?: () => void;
|
|
24
|
+
onError?: (error: Event) => void;
|
|
25
|
+
onMessage?: (data: any) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface MarketDataSubscription {
|
|
28
|
+
symbols: string[];
|
|
29
|
+
onUpdate?: (update: RowUpdate) => void;
|
|
30
|
+
}
|
|
31
|
+
export type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'failed';
|
|
32
|
+
export interface UseMarketDataOptions {
|
|
33
|
+
engine: MarketDataEngine;
|
|
34
|
+
wsConfig?: WebSocketConfig;
|
|
35
|
+
initialData?: MarketDataRow[];
|
|
36
|
+
autoConnect?: boolean;
|
|
37
|
+
subscription?: MarketDataSubscription;
|
|
38
|
+
}
|
|
39
|
+
export interface UseMarketDataReturn {
|
|
40
|
+
rows: MarketDataRow[];
|
|
41
|
+
connectionState: ConnectionState;
|
|
42
|
+
isConnected: boolean;
|
|
43
|
+
connect: () => void;
|
|
44
|
+
disconnect: () => void;
|
|
45
|
+
subscribe: (symbols: string[]) => void;
|
|
46
|
+
unsubscribe: (symbols: string[]) => void;
|
|
47
|
+
sendMessage: (message: any) => void;
|
|
48
|
+
metrics: {
|
|
49
|
+
updatesPerSecond: number;
|
|
50
|
+
totalUpdates: number;
|
|
51
|
+
reconnectCount: number;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Hook for managing market data with WebSocket connection and engine integration
|
|
56
|
+
*/
|
|
57
|
+
export declare function useMarketData(options: UseMarketDataOptions): UseMarketDataReturn;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useScreenReaderAnnouncements Hook
|
|
3
|
+
*
|
|
4
|
+
* Manages live region announcements for screen readers.
|
|
5
|
+
* Provides accessible feedback for grid actions like sorting, filtering, selection, and navigation.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export declare const useScreenReaderAnnouncements: () => {
|
|
9
|
+
announcementRef: React.RefObject<string>;
|
|
10
|
+
announce: (message: string, options?: {
|
|
11
|
+
priority?: "polite" | "assertive";
|
|
12
|
+
delay?: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
announceSorting: (columnName: string, direction: "asc" | "desc" | null) => void;
|
|
15
|
+
announceSelection: (count: number) => void;
|
|
16
|
+
announceFiltering: (columnName: string, hasFilter: boolean, resultCount?: number) => void;
|
|
17
|
+
announcePagination: (currentPage: number, totalPages: number, rowCount: number) => void;
|
|
18
|
+
announceFocus: (rowIndex: number, columnName: string, value?: any) => void;
|
|
19
|
+
announceEditing: (columnName: string, isStarting: boolean) => void;
|
|
20
|
+
announceRowReorder: (fromIndex: number, toIndex: number) => void;
|
|
21
|
+
announceColumnVisibility: (columnName: string, isVisible: boolean) => void;
|
|
22
|
+
announceLoading: (isLoading: boolean, message?: string) => void;
|
|
23
|
+
};
|