react-open-source-grid 1.5.0 → 1.5.1
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/assets/components/AccessibilityDemo.d.ts +8 -0
- package/dist/assets/components/ApiReferencePage.d.ts +2 -0
- package/dist/assets/components/BenchmarkDemo.d.ts +2 -0
- package/dist/assets/components/CellRenderersDemo.d.ts +16 -0
- package/dist/assets/components/CodeBlock.d.ts +10 -0
- package/dist/assets/components/ColumnFiltersDemo.d.ts +5 -0
- package/dist/assets/components/CompleteApiReferencePage.d.ts +2 -0
- package/dist/assets/components/ContextMenuDemo.d.ts +12 -0
- package/dist/assets/components/DataGrid/ARCHITECTURE.md.d.ts +288 -0
- package/dist/assets/components/DataGrid/AdvancedFilterBuilder.d.ts +12 -0
- package/dist/assets/components/DataGrid/CellRenderers.d.ts +64 -0
- package/dist/assets/components/DataGrid/ColumnChooser.d.ts +12 -0
- package/dist/assets/components/DataGrid/ColumnFilters.d.ts +16 -0
- package/dist/assets/components/DataGrid/ContextMenu.d.ts +10 -0
- package/dist/assets/components/DataGrid/DataGrid.d.ts +22 -0
- package/dist/assets/components/DataGrid/DensityToggle.d.ts +23 -0
- package/dist/assets/components/DataGrid/DragHandle.d.ts +7 -0
- package/dist/assets/components/DataGrid/DraggableRow.d.ts +14 -0
- package/dist/assets/components/DataGrid/ExportMenu.d.ts +12 -0
- package/dist/assets/components/DataGrid/FacetedSearch.d.ts +29 -0
- package/dist/assets/components/DataGrid/FilteredSearchBar.d.ts +36 -0
- package/dist/assets/components/DataGrid/FocusTrap.d.ts +12 -0
- package/dist/assets/components/DataGrid/GridApiDemo.d.ts +6 -0
- package/dist/assets/components/DataGrid/GridBody.d.ts +42 -0
- package/dist/assets/components/DataGrid/GridFooter.d.ts +18 -0
- package/dist/assets/components/DataGrid/GridHeader.d.ts +18 -0
- package/dist/assets/components/DataGrid/GridPagination.d.ts +10 -0
- package/dist/assets/components/DataGrid/GroupByPanel.d.ts +9 -0
- package/dist/assets/components/DataGrid/GroupRow.d.ts +31 -0
- package/dist/assets/components/DataGrid/InfiniteScrollDataGrid.d.ts +39 -0
- package/dist/assets/components/DataGrid/LayoutPresetsManager.d.ts +11 -0
- package/dist/assets/components/DataGrid/MarketDataEngine.d.ts +165 -0
- package/dist/assets/components/DataGrid/MarketDataGrid.d.ts +33 -0
- package/dist/assets/components/DataGrid/MarketDataGridUtils.d.ts +13 -0
- package/dist/assets/components/DataGrid/ScreenReaderAnnouncer.d.ts +8 -0
- package/dist/assets/components/DataGrid/ServerSideDataSource.d.ts +136 -0
- package/dist/assets/components/DataGrid/ThemeSelector.d.ts +12 -0
- package/dist/assets/components/DataGrid/Tooltip.d.ts +15 -0
- package/dist/assets/components/DataGrid/TreeRow.d.ts +31 -0
- package/dist/assets/components/DataGrid/VirtualScroller.d.ts +35 -0
- package/dist/assets/components/DataGrid/WebSocketMockFeed.d.ts +121 -0
- package/dist/assets/components/DataGrid/aggregationUtils.d.ts +25 -0
- package/dist/assets/components/DataGrid/contextMenuUtils.d.ts +36 -0
- package/dist/assets/components/DataGrid/demos/TooltipDemo.d.ts +1 -0
- package/dist/assets/components/DataGrid/densityModes.d.ts +42 -0
- package/dist/assets/components/DataGrid/dragRowUtils.d.ts +98 -0
- package/dist/assets/components/DataGrid/exportUtils.d.ts +30 -0
- package/dist/assets/components/DataGrid/filterUtils.d.ts +17 -0
- package/dist/assets/components/DataGrid/gridApi.d.ts +142 -0
- package/dist/assets/components/DataGrid/gridApi.types.d.ts +348 -0
- package/dist/assets/components/DataGrid/gridReducer.d.ts +4 -0
- package/dist/assets/components/DataGrid/groupingUtils.d.ts +17 -0
- package/dist/assets/components/DataGrid/index.d.ts +41 -0
- package/dist/assets/components/DataGrid/layoutPersistence.d.ts +95 -0
- package/dist/assets/components/DataGrid/themes.d.ts +113 -0
- package/dist/assets/components/DataGrid/treeDataUtils.d.ts +97 -0
- package/dist/assets/components/DataGrid/types.d.ts +536 -0
- package/dist/assets/components/DataGrid/useContextMenu.d.ts +31 -0
- package/dist/assets/components/DataGrid/useDensityMode.d.ts +36 -0
- package/dist/assets/components/DataGrid/useFocusTrap.d.ts +14 -0
- package/dist/assets/components/DataGrid/useMarketData.d.ts +57 -0
- package/dist/assets/components/DataGrid/useScreenReaderAnnouncements.d.ts +23 -0
- package/dist/assets/components/DataGrid/useTooltip.d.ts +21 -0
- package/dist/assets/components/DemoGridPage.d.ts +2 -0
- package/dist/assets/components/DensityModeDemo.d.ts +12 -0
- package/dist/assets/components/FacetedSearchDemo.d.ts +8 -0
- package/dist/assets/components/FeatureGallery.d.ts +2 -0
- package/dist/assets/components/FilteredSearchDemo.d.ts +7 -0
- package/dist/assets/components/GridApiDemoPage.d.ts +2 -0
- package/dist/assets/components/HomePage.d.ts +1 -0
- package/dist/assets/components/InfiniteScrollDemo.d.ts +13 -0
- package/dist/assets/components/LayoutPersistenceDemo.d.ts +2 -0
- package/dist/assets/components/LiveMarketDemo.d.ts +18 -0
- package/dist/assets/components/MarketDataExamples.d.ts +42 -0
- package/dist/assets/components/RowDraggingDemo.d.ts +3 -0
- package/dist/assets/components/RowPinningDemo.d.ts +12 -0
- package/dist/assets/components/ThemesDemo.d.ts +17 -0
- package/dist/assets/components/TooltipDemo.d.ts +1 -0
- package/dist/assets/components/TreeDataDemo.d.ts +3 -0
- package/dist/assets/components/VirtualScrollDemo.d.ts +13 -0
- package/dist/assets/{index-BCK5Ko4P.js → index-bQ7aqGuU.js} +2 -2
- package/dist/assets/index.js +1 -1
- package/dist/assets/{layoutPersistence-BHB0W18y.js → layoutPersistence-B2lMGbE7.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +14 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccessibilityDemo.tsx
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive demonstration of DataGrid accessibility features
|
|
5
|
+
* including keyboard navigation, ARIA support, and screen reader compatibility.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export declare const AccessibilityDemo: React.FC;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* CellRenderersDemo - Showcase of Custom Cell Renderer Framework
|
|
4
|
+
*
|
|
5
|
+
* This demo demonstrates all available custom cell renderers:
|
|
6
|
+
* - StatusChip: Color-coded status badges
|
|
7
|
+
* - ProgressBar: Visual progress indicators
|
|
8
|
+
* - IconCell: Cells with icons
|
|
9
|
+
* - ImageCell: Cells with images/avatars
|
|
10
|
+
* - ButtonCell: Actionable buttons
|
|
11
|
+
* - BadgeCell: Generic badge component
|
|
12
|
+
* - PriorityIndicator: Priority levels
|
|
13
|
+
* - Rating: Star ratings
|
|
14
|
+
* - CurrencyCell: Formatted currency values
|
|
15
|
+
*/
|
|
16
|
+
export declare const CellRenderersDemo: React.FC;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* ContextMenuDemo Component
|
|
4
|
+
*
|
|
5
|
+
* Demonstrates the context menu feature with:
|
|
6
|
+
* - Right-click on cells: Copy, Copy with Headers, Export Selected Range, Filter by Value
|
|
7
|
+
* - Right-click on headers: Pin/Unpin, Auto-size, Resize to Fit, Hide Column, Filter by Value
|
|
8
|
+
* - Custom menu items
|
|
9
|
+
* - Enable/disable context menu options
|
|
10
|
+
*/
|
|
11
|
+
export declare const ContextMenuDemo: React.FC;
|
|
12
|
+
export default ContextMenuDemo;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COMPONENT ARCHITECTURE GUIDE
|
|
3
|
+
*
|
|
4
|
+
* This document explains the internal design and architecture of the DataGrid component.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The DataGrid uses useReducer for centralized state management.
|
|
8
|
+
* This provides several benefits:
|
|
9
|
+
* - Single source of truth for all grid state
|
|
10
|
+
* - Predictable state updates through actions
|
|
11
|
+
* - Easier debugging and testing
|
|
12
|
+
* - Better performance (fewer re-renders)
|
|
13
|
+
*
|
|
14
|
+
* State Structure:
|
|
15
|
+
* - columns: Column configuration
|
|
16
|
+
* - sortConfig: Current sort field and direction
|
|
17
|
+
* - filterConfig: Filter values for each column
|
|
18
|
+
* - currentPage: Active page number (0-indexed)
|
|
19
|
+
* - pageSize: Rows per page
|
|
20
|
+
* - selection: Selected row IDs and tracking
|
|
21
|
+
* - editState: Currently editing cell info
|
|
22
|
+
* - focusState: Keyboard focus position
|
|
23
|
+
* - columnOrder: Display order of columns
|
|
24
|
+
* - columnWidths: Width of each column in pixels
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Data flows through the component in the following order:
|
|
28
|
+
*
|
|
29
|
+
* Raw Data (props.rows)
|
|
30
|
+
* ↓
|
|
31
|
+
* Apply Sorting (sortedRows)
|
|
32
|
+
* ↓
|
|
33
|
+
* Apply Filtering (filteredRows)
|
|
34
|
+
* ↓
|
|
35
|
+
* Apply Pagination (paginatedRows)
|
|
36
|
+
* ↓
|
|
37
|
+
* Render in GridBody
|
|
38
|
+
*
|
|
39
|
+
* Each transformation is done with useMemo for performance optimization.
|
|
40
|
+
* The transformations only recalculate when their dependencies change.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* DataGrid (Parent)
|
|
44
|
+
* │
|
|
45
|
+
* ├── GridHeader
|
|
46
|
+
* │ ├── Column Headers (sortable, draggable)
|
|
47
|
+
* │ ├── Column Resizers
|
|
48
|
+
* │ └── Filter Inputs
|
|
49
|
+
* │
|
|
50
|
+
* ├── GridBody
|
|
51
|
+
* │ └── Rows
|
|
52
|
+
* │ └── Cells (editable, focusable, selectable)
|
|
53
|
+
* │
|
|
54
|
+
* └── GridPagination
|
|
55
|
+
* ├── Page Size Selector
|
|
56
|
+
* ├── Row Count Info
|
|
57
|
+
* └── Page Navigation Buttons
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* A) Compound Component Pattern
|
|
61
|
+
* - Main DataGrid orchestrates sub-components
|
|
62
|
+
* - Each sub-component has a specific responsibility
|
|
63
|
+
* - State and dispatch are passed down as props
|
|
64
|
+
*
|
|
65
|
+
* B) Reducer Pattern
|
|
66
|
+
* - All state updates go through the reducer
|
|
67
|
+
* - Actions are dispatched from child components
|
|
68
|
+
* - Reducer handles state transitions
|
|
69
|
+
*
|
|
70
|
+
* C) Controlled Components
|
|
71
|
+
* - Parent component (DataGrid) owns the data
|
|
72
|
+
* - Child components receive data and callbacks
|
|
73
|
+
* - Edits are communicated back via callbacks
|
|
74
|
+
*
|
|
75
|
+
* D) Memoization Strategy
|
|
76
|
+
* - useMemo for expensive computations (sorting, filtering)
|
|
77
|
+
* - useCallback for event handlers passed to children
|
|
78
|
+
* - Prevents unnecessary re-renders
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Column resizing uses a custom implementation:
|
|
82
|
+
*
|
|
83
|
+
* 1. Each column has a resize handle (1px div at right edge)
|
|
84
|
+
* 2. On mousedown:
|
|
85
|
+
* - Store starting X position and current width
|
|
86
|
+
* - Set resizing state
|
|
87
|
+
* 3. On mousemove (document level):
|
|
88
|
+
* - Calculate difference from start position
|
|
89
|
+
* - Update column width (with minimum constraint)
|
|
90
|
+
* 4. On mouseup (document level):
|
|
91
|
+
* - Clear resizing state
|
|
92
|
+
* - Clean up event listeners
|
|
93
|
+
*
|
|
94
|
+
* This approach allows dragging outside the column without losing the resize.
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* Column reordering uses HTML5 Drag & Drop API:
|
|
98
|
+
*
|
|
99
|
+
* 1. Each column header is draggable
|
|
100
|
+
* 2. On dragstart:
|
|
101
|
+
* - Store which column is being dragged
|
|
102
|
+
* - Set drag effect to 'move'
|
|
103
|
+
* 3. On dragover:
|
|
104
|
+
* - Prevent default to allow drop
|
|
105
|
+
* - Set drop effect to 'move'
|
|
106
|
+
* 4. On drop:
|
|
107
|
+
* - Calculate new position
|
|
108
|
+
* - Dispatch REORDER_COLUMNS action
|
|
109
|
+
* - Update columnOrder array in state
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* Three selection modes:
|
|
113
|
+
*
|
|
114
|
+
* A) Single Selection (regular click)
|
|
115
|
+
* - Clear all selections
|
|
116
|
+
* - Select clicked row
|
|
117
|
+
*
|
|
118
|
+
* B) Multi Selection (Ctrl/Cmd + click)
|
|
119
|
+
* - Toggle clicked row
|
|
120
|
+
* - Preserve other selections
|
|
121
|
+
*
|
|
122
|
+
* C) Range Selection (Shift + click)
|
|
123
|
+
* - Find last selected row
|
|
124
|
+
* - Select all rows between last and current
|
|
125
|
+
* - Add to existing selection
|
|
126
|
+
*
|
|
127
|
+
* Selection state is stored as a Set for O(1) lookups.
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* Cell editing workflow:
|
|
131
|
+
*
|
|
132
|
+
* 1. Enter Edit Mode:
|
|
133
|
+
* - Double-click cell OR
|
|
134
|
+
* - Press Enter on focused cell
|
|
135
|
+
* - Dispatch START_EDIT action
|
|
136
|
+
* - Replace cell content with input element
|
|
137
|
+
*
|
|
138
|
+
* 2. During Editing:
|
|
139
|
+
* - Input is focused and selected
|
|
140
|
+
* - Value changes update editState
|
|
141
|
+
* - Click outside or press Enter/Escape to exit
|
|
142
|
+
*
|
|
143
|
+
* 3. Exit Edit Mode:
|
|
144
|
+
* - Enter: Save changes, call onCellEdit callback
|
|
145
|
+
* - Escape: Discard changes
|
|
146
|
+
* - Blur: Save changes
|
|
147
|
+
* - Dispatch END_EDIT action
|
|
148
|
+
*/
|
|
149
|
+
/**
|
|
150
|
+
* Keyboard navigation with focus tracking:
|
|
151
|
+
*
|
|
152
|
+
* 1. Focus State:
|
|
153
|
+
* - Stored as { rowIndex, columnIndex }
|
|
154
|
+
* - Rendered cell gets tabIndex={0}, others get tabIndex={-1}
|
|
155
|
+
* - Visual indicator (ring) shows focused cell
|
|
156
|
+
*
|
|
157
|
+
* 2. Arrow Key Handling:
|
|
158
|
+
* - Calculate new position
|
|
159
|
+
* - Apply boundary constraints (0 to max)
|
|
160
|
+
* - Update focus state
|
|
161
|
+
* - Focused cell automatically receives keyboard focus
|
|
162
|
+
*
|
|
163
|
+
* 3. Enter Key:
|
|
164
|
+
* - Starts editing if cell is editable
|
|
165
|
+
* - During editing, saves and exits
|
|
166
|
+
*
|
|
167
|
+
* 4. Escape Key:
|
|
168
|
+
* - During editing, cancels and exits
|
|
169
|
+
* - Otherwise, clears focus
|
|
170
|
+
*/
|
|
171
|
+
/**
|
|
172
|
+
* A) useMemo for derived data:
|
|
173
|
+
* - sortedRows, filteredRows, paginatedRows
|
|
174
|
+
* - Only recalculate when dependencies change
|
|
175
|
+
*
|
|
176
|
+
* B) useCallback for event handlers:
|
|
177
|
+
* - Prevents child component re-renders
|
|
178
|
+
* - Stable function references
|
|
179
|
+
*
|
|
180
|
+
* C) Early returns in reducer:
|
|
181
|
+
* - No-op actions don't create new state
|
|
182
|
+
*
|
|
183
|
+
* D) Set for selection tracking:
|
|
184
|
+
* - O(1) lookups for "is selected" checks
|
|
185
|
+
*
|
|
186
|
+
* E) Column map in GridHeader/GridBody:
|
|
187
|
+
* - Quick column lookup by field name
|
|
188
|
+
* - Avoids O(n) array.find() in render
|
|
189
|
+
*
|
|
190
|
+
* Future optimization opportunities:
|
|
191
|
+
* - Virtual scrolling for large datasets
|
|
192
|
+
* - Web Workers for sorting/filtering
|
|
193
|
+
* - React.memo for sub-components
|
|
194
|
+
* - Debounced filter updates
|
|
195
|
+
*/
|
|
196
|
+
/**
|
|
197
|
+
* Recommended testing approach:
|
|
198
|
+
*
|
|
199
|
+
* A) Unit Tests:
|
|
200
|
+
* - gridReducer.ts: Test all action types
|
|
201
|
+
* - Utility functions: Test sorting, filtering logic
|
|
202
|
+
*
|
|
203
|
+
* B) Component Tests:
|
|
204
|
+
* - GridHeader: Test sorting, filtering, resizing
|
|
205
|
+
* - GridBody: Test cell editing, selection, navigation
|
|
206
|
+
* - GridPagination: Test page changes, size changes
|
|
207
|
+
*
|
|
208
|
+
* C) Integration Tests:
|
|
209
|
+
* - Full DataGrid: Test feature interactions
|
|
210
|
+
* - Example: Sort → Filter → Edit → Page change
|
|
211
|
+
*
|
|
212
|
+
* D) E2E Tests:
|
|
213
|
+
* - User workflows: Select → Edit → Sort → Filter
|
|
214
|
+
* - Keyboard navigation flows
|
|
215
|
+
*/
|
|
216
|
+
/**
|
|
217
|
+
* Current accessibility features:
|
|
218
|
+
* - Keyboard navigation (arrow keys, Enter, Escape)
|
|
219
|
+
* - Focus indicators (visible ring)
|
|
220
|
+
* - Semantic HTML where possible
|
|
221
|
+
*
|
|
222
|
+
* Recommended improvements:
|
|
223
|
+
* - ARIA labels for interactive elements
|
|
224
|
+
* - aria-sort on column headers
|
|
225
|
+
* - aria-selected on selected rows
|
|
226
|
+
* - Screen reader announcements for state changes
|
|
227
|
+
* - Focus management when editing
|
|
228
|
+
* - Proper role attributes (grid, row, columnheader, gridcell)
|
|
229
|
+
* - Keyboard shortcuts documentation
|
|
230
|
+
*/
|
|
231
|
+
/**
|
|
232
|
+
* How to add new features:
|
|
233
|
+
*
|
|
234
|
+
* A) Add new state:
|
|
235
|
+
* 1. Update GridState interface in types.ts
|
|
236
|
+
* 2. Add to createInitialState in gridReducer.ts
|
|
237
|
+
* 3. Create new action type(s)
|
|
238
|
+
* 4. Handle in reducer switch statement
|
|
239
|
+
*
|
|
240
|
+
* B) Add new column feature:
|
|
241
|
+
* 1. Update Column interface in types.ts
|
|
242
|
+
* 2. Handle in GridHeader.tsx
|
|
243
|
+
* 3. Update rendering logic in GridBody.tsx
|
|
244
|
+
*
|
|
245
|
+
* C) Add new UI component:
|
|
246
|
+
* 1. Create new component file
|
|
247
|
+
* 2. Import in DataGrid.tsx
|
|
248
|
+
* 3. Pass necessary state and dispatch
|
|
249
|
+
* 4. Add to component hierarchy
|
|
250
|
+
*
|
|
251
|
+
* Example: Adding column pinning
|
|
252
|
+
* 1. Add pinnedColumns: string[] to GridState
|
|
253
|
+
* 2. Add PIN_COLUMN/UNPIN_COLUMN actions
|
|
254
|
+
* 3. Update GridHeader with pin button
|
|
255
|
+
* 4. Update GridBody to render pinned columns separately
|
|
256
|
+
* 5. Update column ordering logic
|
|
257
|
+
*/
|
|
258
|
+
/**
|
|
259
|
+
* A) Column Lookup Pattern:
|
|
260
|
+
* const columnMap = new Map(columns.map(col => [col.field, col]));
|
|
261
|
+
* const column = columnMap.get(field);
|
|
262
|
+
* // Faster than columns.find(col => col.field === field)
|
|
263
|
+
*
|
|
264
|
+
* B) Conditional Rendering Pattern:
|
|
265
|
+
* if (!column || column.editable === false) return;
|
|
266
|
+
* // Handle missing or disabled features
|
|
267
|
+
*
|
|
268
|
+
* C) Event Handler Pattern:
|
|
269
|
+
* const handleAction = (data) => {
|
|
270
|
+
* dispatch({ type: 'ACTION_TYPE', payload: data });
|
|
271
|
+
* if (onAction) onAction(data);
|
|
272
|
+
* };
|
|
273
|
+
* // Update internal state + notify parent
|
|
274
|
+
*
|
|
275
|
+
* D) Style Computation Pattern:
|
|
276
|
+
* const className = `base-class ${condition ? 'conditional-class' : ''}`;
|
|
277
|
+
* // Dynamic class names based on state
|
|
278
|
+
*
|
|
279
|
+
* E) Ref Usage Pattern:
|
|
280
|
+
* const ref = useRef<HTMLElement>(null);
|
|
281
|
+
* useEffect(() => {
|
|
282
|
+
* if (ref.current) {
|
|
283
|
+
* ref.current.focus();
|
|
284
|
+
* }
|
|
285
|
+
* }, [dependency]);
|
|
286
|
+
* // Imperative DOM operations when needed
|
|
287
|
+
*/
|
|
288
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, AdvancedFilterValue, Row } from './types';
|
|
3
|
+
interface AdvancedFilterBuilderProps {
|
|
4
|
+
column: Column;
|
|
5
|
+
filterValue: AdvancedFilterValue | null;
|
|
6
|
+
onApply: (value: AdvancedFilterValue | null) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
rows: Row[];
|
|
9
|
+
anchorEl: HTMLElement | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const AdvancedFilterBuilder: React.FC<AdvancedFilterBuilderProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Cell Renderer Components
|
|
4
|
+
*
|
|
5
|
+
* Reusable custom cell renderer components for common use cases:
|
|
6
|
+
* - StatusChip: Badge component for status indicators
|
|
7
|
+
* - ProgressBar: Visual progress bar
|
|
8
|
+
* - IconCell: Cell with icon
|
|
9
|
+
* - ImageCell: Cell with image
|
|
10
|
+
* - ButtonCell: Actionable button in cell
|
|
11
|
+
* - BadgeCell: Generic badge component
|
|
12
|
+
*/
|
|
13
|
+
interface StatusChipProps {
|
|
14
|
+
status: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const StatusChip: React.FC<StatusChipProps>;
|
|
17
|
+
interface ProgressBarProps {
|
|
18
|
+
value: number;
|
|
19
|
+
color?: string;
|
|
20
|
+
showLabel?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const ProgressBar: React.FC<ProgressBarProps>;
|
|
23
|
+
interface IconCellProps {
|
|
24
|
+
icon: string;
|
|
25
|
+
text?: string;
|
|
26
|
+
iconColor?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const IconCell: React.FC<IconCellProps>;
|
|
29
|
+
interface ImageCellProps {
|
|
30
|
+
src: string;
|
|
31
|
+
alt: string;
|
|
32
|
+
text?: string;
|
|
33
|
+
size?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const ImageCell: React.FC<ImageCellProps>;
|
|
36
|
+
interface ButtonCellProps {
|
|
37
|
+
label: string;
|
|
38
|
+
onClick: (e: React.MouseEvent) => void;
|
|
39
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const ButtonCell: React.FC<ButtonCellProps>;
|
|
43
|
+
interface BadgeCellProps {
|
|
44
|
+
text: string;
|
|
45
|
+
color?: string;
|
|
46
|
+
backgroundColor?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const BadgeCell: React.FC<BadgeCellProps>;
|
|
49
|
+
interface PriorityIndicatorProps {
|
|
50
|
+
priority: 'low' | 'medium' | 'high' | 'critical';
|
|
51
|
+
}
|
|
52
|
+
export declare const PriorityIndicator: React.FC<PriorityIndicatorProps>;
|
|
53
|
+
interface RatingProps {
|
|
54
|
+
rating: number;
|
|
55
|
+
maxRating?: number;
|
|
56
|
+
}
|
|
57
|
+
export declare const Rating: React.FC<RatingProps>;
|
|
58
|
+
interface CurrencyCellProps {
|
|
59
|
+
amount: number;
|
|
60
|
+
currency?: string;
|
|
61
|
+
locale?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare const CurrencyCell: React.FC<CurrencyCellProps>;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column } from './types';
|
|
3
|
+
interface ColumnChooserProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
columnOrder: string[];
|
|
6
|
+
hiddenColumns: string[];
|
|
7
|
+
onToggleVisibility: (field: string) => void;
|
|
8
|
+
onReorderColumns: (fromIndex: number, toIndex: number) => void;
|
|
9
|
+
onResetLayout: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const ColumnChooser: React.FC<ColumnChooserProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, FilterConfig, GridAction, Row } from './types';
|
|
3
|
+
interface ColumnFiltersProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
displayColumnOrder: string[];
|
|
6
|
+
columnWidths: {
|
|
7
|
+
[field: string]: number;
|
|
8
|
+
};
|
|
9
|
+
filterConfig: FilterConfig;
|
|
10
|
+
dispatch: React.Dispatch<GridAction>;
|
|
11
|
+
pinnedLeft: string[];
|
|
12
|
+
pinnedRight: string[];
|
|
13
|
+
rows: Row[];
|
|
14
|
+
}
|
|
15
|
+
export declare const ColumnFilters: React.FC<ColumnFiltersProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ContextMenuProps } from './types';
|
|
3
|
+
import './ContextMenu.css';
|
|
4
|
+
/**
|
|
5
|
+
* ContextMenu Component
|
|
6
|
+
*
|
|
7
|
+
* A customizable right-click context menu for the DataGrid.
|
|
8
|
+
* Supports nested submenus, separators, disabled items, and custom menu items.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ContextMenu: React.FC<ContextMenuProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DataGridProps } from './types';
|
|
3
|
+
import type { GridApi } from './gridApi.types';
|
|
4
|
+
/**
|
|
5
|
+
* DataGrid Component
|
|
6
|
+
*
|
|
7
|
+
* A feature-rich data grid component with sorting, filtering, pagination,
|
|
8
|
+
* column resizing, column reordering, row selection, cell editing, and keyboard navigation.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Sortable columns (click header to sort asc/desc/none)
|
|
12
|
+
* - Column filtering (text filter for each column)
|
|
13
|
+
* - Pagination with configurable page size (10, 20, 50)
|
|
14
|
+
* - Column resizing (drag column border to resize)
|
|
15
|
+
* - Column reorder (drag and drop column headers)
|
|
16
|
+
* - Row selection (single click, Ctrl+click for multi, Shift+click for range)
|
|
17
|
+
* - Editable cells (double-click to edit, Enter to confirm, Escape to cancel)
|
|
18
|
+
* - Keyboard navigation (arrow keys to move focus, Enter to edit)
|
|
19
|
+
* - Sticky header (header stays visible when scrolling)
|
|
20
|
+
* - Grid API: Programmatic control via ref (AG Grid-inspired API)
|
|
21
|
+
*/
|
|
22
|
+
export declare const DataGrid: React.ForwardRefExoticComponent<DataGridProps & React.RefAttributes<GridApi>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DensityMode } from './densityModes';
|
|
3
|
+
export interface DensityToggleProps {
|
|
4
|
+
value: DensityMode;
|
|
5
|
+
onChange: (mode: DensityMode) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* DensityToggle Component
|
|
11
|
+
*
|
|
12
|
+
* A segmented control for switching between Compact, Normal, and Comfortable density modes.
|
|
13
|
+
* Displays as a horizontal button group with clear visual feedback.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <DensityToggle
|
|
18
|
+
* value={densityMode}
|
|
19
|
+
* onChange={setDensityMode}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const DensityToggle: React.FC<DensityToggleProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Row, DragRowConfig } from './types';
|
|
3
|
+
interface DraggableRowProps {
|
|
4
|
+
row: Row;
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
config: DragRowConfig;
|
|
7
|
+
sourceTableId?: string;
|
|
8
|
+
onRowReorder?: (rows: Row[]) => void;
|
|
9
|
+
rows: Row[];
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const DraggableRow: React.FC<DraggableRowProps>;
|
|
14
|
+
export default DraggableRow;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, Row } from './types';
|
|
3
|
+
interface ExportMenuProps {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
fullDataset: Row[];
|
|
6
|
+
filteredData: Row[];
|
|
7
|
+
selectedRows: Set<string | number>;
|
|
8
|
+
currentPageData: Row[];
|
|
9
|
+
onExport?: (exported: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const ExportMenu: React.FC<ExportMenuProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FacetedSearch Component
|
|
3
|
+
*
|
|
4
|
+
* A filter panel that shows value counts for categorical fields.
|
|
5
|
+
* Perfect for e-commerce and analytics dashboards.
|
|
6
|
+
* Provides instant visual feedback about data distribution and filtering options.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { Column, Row, FilterConfig } from './types';
|
|
10
|
+
export interface FacetConfig {
|
|
11
|
+
field: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
maxItems?: number;
|
|
14
|
+
sortBy?: 'count' | 'value' | 'alpha';
|
|
15
|
+
expanded?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface FacetedSearchProps {
|
|
18
|
+
columns: Column[];
|
|
19
|
+
rows: Row[];
|
|
20
|
+
facetConfigs: FacetConfig[];
|
|
21
|
+
filterConfig: FilterConfig;
|
|
22
|
+
onFilterChange: (field: string, values: any[] | null) => void;
|
|
23
|
+
onClearAll?: () => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
showSearch?: boolean;
|
|
26
|
+
collapsible?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const FacetedSearch: React.FC<FacetedSearchProps>;
|
|
29
|
+
export default FacetedSearch;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FilteredSearchBar Component
|
|
3
|
+
*
|
|
4
|
+
* Advanced search bar with token-based filtering (similar to GitLab/GitHub)
|
|
5
|
+
* Features:
|
|
6
|
+
* - Token/pill-based filters
|
|
7
|
+
* - Autocomplete dropdown
|
|
8
|
+
* - Multi-criteria search
|
|
9
|
+
* - Visual feedback with colored tokens
|
|
10
|
+
* - Keyboard navigation
|
|
11
|
+
*/
|
|
12
|
+
import React from 'react';
|
|
13
|
+
export interface SearchToken {
|
|
14
|
+
id: string;
|
|
15
|
+
field: string;
|
|
16
|
+
label: string;
|
|
17
|
+
value: string | string[];
|
|
18
|
+
operator?: 'equals' | 'contains' | 'startsWith' | 'in';
|
|
19
|
+
color?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface FilterOption {
|
|
22
|
+
field: string;
|
|
23
|
+
label: string;
|
|
24
|
+
type: 'text' | 'select' | 'multiselect' | 'date' | 'number';
|
|
25
|
+
options?: string[];
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
color?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface FilteredSearchBarProps {
|
|
30
|
+
filters: FilterOption[];
|
|
31
|
+
onSearch: (tokens: SearchToken[]) => void;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
maxTokens?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const FilteredSearchBar: React.FC<FilteredSearchBarProps>;
|
|
36
|
+
export default FilteredSearchBar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface FocusTrapProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
initialFocus?: 'first' | 'last' | HTMLElement | null;
|
|
8
|
+
returnFocus?: boolean;
|
|
9
|
+
escapeDeactivates?: boolean;
|
|
10
|
+
onEscape?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const FocusTrap: React.FC<FocusTrapProps>;
|