@opencorestack/opengridx 1.0.0 → 1.0.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/CHANGELOG.md +8 -0
- package/README.md +162 -19
- package/docs/API_REFERENCE.md +17 -7
- package/docs/components/datagrid.md +5 -3
- package/docs/features/editing-reordering.md +11 -7
- package/docs/features/filtering.md +10 -8
- package/docs/features/selection.md +2 -1
- package/docs/features/sorting-pagination.md +3 -1
- package/docs/features/state-persistence.md +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [1.0.1] — July 30, 2026 📚
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Bundled documentation accuracy**: All doc files shipped inside the npm package (`docs/`) have been corrected to match the actual v1.0.0 API. Key fixes: removed non-existent `pageSize` standalone prop (correct API is `paginationModel` + `pageSizeOptions`), fixed `height` type to `number | string`, corrected `onColumnOrderChange` params shape, removed non-existent `isRowSelectable` and `reorderable` props, fixed `GridFilterModel.items` type, added missing `GridApi` methods (`getFilterModel`, `getAllColumns`, `setPageSize`, `getAggregationResult`, `getAggregationModel`, `copySelectedRows`), and corrected `GridInitialState` persisted state fields. AI agents (Cursor, Copilot, Windsurf) reading bundled docs will now generate accurate code.
|
|
12
|
+
- **README API reference**: Same prop and type corrections applied — complete `apiRef` method list, new prop tables for Events, Columns, Pinning, Inline Editing, Row Reordering, and updated comparison table.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
8
16
|
## [1.0.0] — July 30, 2026 🚀
|
|
9
17
|
|
|
10
18
|
First stable public release. All 32 demo pages ship with a live source viewer. npm publish workflow is live.
|
package/README.md
CHANGED
|
@@ -40,14 +40,14 @@ const columns: GridColDef[] = [
|
|
|
40
40
|
{ field: 'name', headerName: 'Name', width: 180 },
|
|
41
41
|
{ field: 'role', headerName: 'Role', width: 150 },
|
|
42
42
|
{ field: 'salary', headerName: 'Salary', width: 120, type: 'number',
|
|
43
|
-
valueFormatter: ({ value }) => `$${value.toLocaleString()}` },
|
|
43
|
+
valueFormatter: ({ value }) => `$${(value as number).toLocaleString()}` },
|
|
44
44
|
{ field: 'department', headerName: 'Department', width: 160 },
|
|
45
45
|
];
|
|
46
46
|
|
|
47
47
|
const rows = [
|
|
48
|
-
{ id: 1, name: 'Jon Snow',
|
|
49
|
-
{ id: 2, name: 'Cersei Lannister', role: 'Manager',
|
|
50
|
-
{ id: 3, name: 'Arya Stark',
|
|
48
|
+
{ id: 1, name: 'Jon Snow', role: 'Engineer', salary: 95000, department: 'Defense' },
|
|
49
|
+
{ id: 2, name: 'Cersei Lannister', role: 'Manager', salary: 140000, department: 'Management' },
|
|
50
|
+
{ id: 3, name: 'Arya Stark', role: 'Analyst', salary: 65000, department: 'Special Ops' },
|
|
51
51
|
];
|
|
52
52
|
|
|
53
53
|
export default function App() {
|
|
@@ -77,18 +77,23 @@ export default function App() {
|
|
|
77
77
|
- **Clipboard**: `Ctrl+C` / `Cmd+C` copies selected rows as TSV for Excel/Sheets.
|
|
78
78
|
- **Accessibility**: WCAG 2.1 AA — full ARIA roles and keyboard navigation.
|
|
79
79
|
- **Theming**: CSS variable API with 5 built-in themes + custom theme support.
|
|
80
|
+
- **Column & Row Reordering**: Drag-and-drop column reordering and row reordering.
|
|
81
|
+
- **Inline Cell Editing**: Full inline editing with `processRowUpdate` validation.
|
|
82
|
+
- **State Persistence**: Save and restore grid state (sort, filter, columns) via `useGridStateStorage`.
|
|
80
83
|
- **AI-Native Integration**: Shipped with raw `lib/` source and `docs/` inside the npm package, allowing AI agents (Cursor, Copilot, Windsurf) to flawlessly implement features by "seeing" the internal logic.
|
|
81
84
|
|
|
82
85
|
---
|
|
83
86
|
|
|
84
87
|
## 🤖 AI-Powered Implementation
|
|
85
88
|
|
|
86
|
-
OpenGridX is built for the era of AI-native development. When you install `@opencorestack/opengridx`, we include the full raw source code and markdown documentation in your `node_modules`.
|
|
89
|
+
OpenGridX is built for the era of AI-native development. When you install `@opencorestack/opengridx`, we include the full raw source code and markdown documentation in your `node_modules`.
|
|
87
90
|
|
|
88
91
|
This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agents can read the actual implementation patterns and docs to accurately help you build complex features like server-side tree data or pivot tables without guessing.
|
|
89
92
|
|
|
90
93
|
> **Tip for Cursor/Copilot users:** If your AI is struggling, tell it to "Read the docs and source in `./node_modules/@opencorestack/opengridx/docs`" for instant context.
|
|
91
94
|
|
|
95
|
+
---
|
|
96
|
+
|
|
92
97
|
## 📐 API Reference
|
|
93
98
|
|
|
94
99
|
### Core Props
|
|
@@ -97,14 +102,21 @@ This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agent
|
|
|
97
102
|
| :--- | :--- | :--- | :--- |
|
|
98
103
|
| `rows` | `GridRowModel[]` | — | **Required.** Array of data rows. |
|
|
99
104
|
| `columns` | `GridColDef[]` | — | **Required.** Column definitions. |
|
|
100
|
-
| `height` | `number` | `500` | Grid height in pixels. |
|
|
105
|
+
| `height` | `number \| string` | `500` | Grid height in pixels or CSS string (e.g. `'100%'`). |
|
|
106
|
+
| `autoHeight` | `boolean` | `false` | Expands grid height to fit all rows. |
|
|
101
107
|
| `loading` | `boolean` | `false` | Shows skeleton loader when `true`. |
|
|
108
|
+
| `density` | `'compact' \| 'standard' \| 'comfortable'` | `'standard'` | Visual row density. |
|
|
102
109
|
| `checkboxSelection` | `boolean` | `false` | Enables checkbox column for row selection. |
|
|
103
110
|
| `pagination` | `boolean` | `false` | Enables client-side pagination. |
|
|
104
|
-
| `
|
|
111
|
+
| `paginationModel` | `{ page: number; pageSize: number }` | — | Controlled pagination state. |
|
|
112
|
+
| `onPaginationModelChange` | `(model) => void` | — | Fires on page or page size change. |
|
|
113
|
+
| `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Available page size options. |
|
|
105
114
|
| `getRowId` | `(row) => GridRowId` | `row.id` | Custom row ID accessor. |
|
|
106
115
|
| `rowHeight` | `number` | `52` | Row height in pixels. |
|
|
107
116
|
| `headerHeight` | `number` | `56` | Header height in pixels. |
|
|
117
|
+
| `noRowsLabel` | `string` | — | Custom empty-state message. |
|
|
118
|
+
| `className` | `string` | — | Custom CSS class on the grid container. |
|
|
119
|
+
| `style` | `React.CSSProperties` | — | Custom inline styles on the grid container. |
|
|
108
120
|
|
|
109
121
|
### Selection
|
|
110
122
|
|
|
@@ -113,17 +125,37 @@ This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agent
|
|
|
113
125
|
| `rowSelectionModel` | `GridRowId[]` | Controlled selected row IDs. |
|
|
114
126
|
| `onRowSelectionModelChange` | `(model: GridRowId[]) => void` | Fires on selection change. |
|
|
115
127
|
| `disableRowSelectionOnClick` | `boolean` | Prevent row click from toggling selection. |
|
|
128
|
+
| `disableMultipleRowSelection` | `boolean` | Restrict to single-row selection. |
|
|
129
|
+
| `pinCheckboxColumn` | `boolean` | Keeps the checkbox column visible during horizontal scroll. |
|
|
116
130
|
|
|
117
131
|
### Sorting & Filtering
|
|
118
132
|
|
|
119
133
|
| Prop | Type | Description |
|
|
120
134
|
| :--- | :--- | :--- |
|
|
121
135
|
| `sortModel` | `GridSortItem[]` | Controlled sort model. |
|
|
122
|
-
| `onSortModelChange` | `(model) => void` | Fires on sort change. |
|
|
136
|
+
| `onSortModelChange` | `(model: GridSortItem[]) => void` | Fires on sort change. |
|
|
123
137
|
| `filterModel` | `GridFilterModel` | Controlled filter model. |
|
|
124
|
-
| `onFilterModelChange` | `(model) => void` | Fires on filter change. |
|
|
138
|
+
| `onFilterModelChange` | `(model: GridFilterModel) => void` | Fires on filter change. |
|
|
125
139
|
| `disableColumnFilter` | `boolean` | Disables column-level filtering. |
|
|
126
140
|
|
|
141
|
+
### Columns
|
|
142
|
+
|
|
143
|
+
| Prop | Type | Description |
|
|
144
|
+
| :--- | :--- | :--- |
|
|
145
|
+
| `columnVisibilityModel` | `GridColumnVisibilityModel` | Controlled column visibility. |
|
|
146
|
+
| `onColumnVisibilityModelChange` | `(model) => void` | Fires when column visibility changes. |
|
|
147
|
+
| `columnOrder` | `string[]` | Controlled column field order. |
|
|
148
|
+
| `onColumnOrderChange` | `(params) => void` | Fires when columns are reordered. |
|
|
149
|
+
| `disableColumnReorder` | `boolean` | Disables drag-and-drop column reordering. |
|
|
150
|
+
|
|
151
|
+
### Events
|
|
152
|
+
|
|
153
|
+
| Prop | Type | Description |
|
|
154
|
+
| :--- | :--- | :--- |
|
|
155
|
+
| `onRowClick` | `(params: GridRowParams) => void` | Fires when a row is clicked. |
|
|
156
|
+
| `onCellClick` | `(params: GridCellParams) => void` | Fires when a cell is clicked. |
|
|
157
|
+
| `onRowsScrollEnd` | `(params: GridRowScrollEndParams) => void` | Fires when scrolling reaches the bottom. |
|
|
158
|
+
|
|
127
159
|
### Server-Side
|
|
128
160
|
|
|
129
161
|
| Prop | Type | Description |
|
|
@@ -134,11 +166,60 @@ This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agent
|
|
|
134
166
|
| `dataSource` | `GridDataSource` | Server-side data adapter. |
|
|
135
167
|
| `rowCount` | `number` | Total rows for server-side pagination. |
|
|
136
168
|
|
|
169
|
+
### Pinning
|
|
170
|
+
|
|
171
|
+
| Prop | Type | Description |
|
|
172
|
+
| :--- | :--- | :--- |
|
|
173
|
+
| `pinnedColumns` | `GridColumnPinning` | Pin columns to `left` or `right`. |
|
|
174
|
+
| `onPinnedColumnsChange` | `(model) => void` | Fires when column pinning changes. |
|
|
175
|
+
| `pinnedRows` | `GridRowPinning` | Pin rows to `top` or `bottom`. |
|
|
176
|
+
| `onPinnedRowsChange` | `(model) => void` | Fires when row pinning changes. |
|
|
177
|
+
|
|
178
|
+
### Inline Editing
|
|
179
|
+
|
|
180
|
+
| Prop | Type | Description |
|
|
181
|
+
| :--- | :--- | :--- |
|
|
182
|
+
| `isCellEditable` | `(params: GridCellParams) => boolean` | Per-cell editability predicate. |
|
|
183
|
+
| `processRowUpdate` | `(newRow, oldRow) => R \| Promise<R>` | Handles row save; supports async validation. |
|
|
184
|
+
| `onProcessRowUpdateError` | `(error: unknown) => void` | Fires if `processRowUpdate` throws. |
|
|
185
|
+
|
|
186
|
+
### Row Reordering
|
|
187
|
+
|
|
188
|
+
| Prop | Type | Description |
|
|
189
|
+
| :--- | :--- | :--- |
|
|
190
|
+
| `rowReordering` | `boolean` | Enables drag-and-drop row reordering. |
|
|
191
|
+
| `onRowOrderChange` | `(params) => void` | Fires when rows are reordered. |
|
|
192
|
+
|
|
193
|
+
### Advanced Features
|
|
194
|
+
|
|
195
|
+
| Prop | Type | Description |
|
|
196
|
+
| :--- | :--- | :--- |
|
|
197
|
+
| `treeData` | `boolean` | Enables hierarchical tree data display. |
|
|
198
|
+
| `getTreeDataPath` | `(row) => string[]` | Returns the path array for each row in tree mode. |
|
|
199
|
+
| `groupingColDef` | `GridColDef` | Overrides the auto-generated grouping column. |
|
|
200
|
+
| `defaultGroupingExpansionDepth` | `number` | Initial expansion depth for tree data. |
|
|
201
|
+
| `rowGroupingModel` | `GridRowGroupingModel` | Controlled row grouping state. |
|
|
202
|
+
| `onRowGroupingModelChange` | `(model) => void` | Fires when grouping changes. |
|
|
203
|
+
| `aggregationModel` | `GridAggregationModel` | Controlled aggregation state (e.g. `{ salary: 'sum' }`). |
|
|
204
|
+
| `onAggregationModelChange` | `(model) => void` | Fires when aggregation changes. |
|
|
205
|
+
| `pivotMode` | `boolean` | Switches the grid to multidimensional pivot mode. |
|
|
206
|
+
| `pivotModel` | `GridPivotModel` | Controlled pivot configuration (rows, columns, values). |
|
|
207
|
+
| `onPivotModelChange` | `(model) => void` | Fires when pivot model changes. |
|
|
208
|
+
|
|
209
|
+
### Master-Detail
|
|
210
|
+
|
|
211
|
+
| Prop | Type | Description |
|
|
212
|
+
| :--- | :--- | :--- |
|
|
213
|
+
| `getDetailPanelContent` | `(params) => ReactNode` | Renders the expandable detail panel. |
|
|
214
|
+
| `getDetailPanelHeight` | `(params) => number \| 'auto'` | Controls detail panel height. |
|
|
215
|
+
| `detailPanelExpandedRowIds` | `Set<GridRowId>` | Controlled expanded rows. |
|
|
216
|
+
| `onDetailPanelExpandedRowIdsChange` | `(ids) => void` | Fires when expanded rows change. |
|
|
217
|
+
|
|
137
218
|
### Customization
|
|
138
219
|
|
|
139
220
|
| Prop | Type | Description |
|
|
140
221
|
| :--- | :--- | :--- |
|
|
141
|
-
| `slots` | `GridSlots` | Replace built-in components (toolbar, pagination, overlays). |
|
|
222
|
+
| `slots` | `GridSlots` | Replace built-in components (toolbar, pagination, overlays, footer). |
|
|
142
223
|
| `slotProps` | `GridSlotProps` | Pass custom props to slot components. |
|
|
143
224
|
| `getRowClassName` | `(params) => string` | Add custom CSS class to rows. |
|
|
144
225
|
| `getCellClassName` | `(params) => string` | Add custom CSS class to cells. |
|
|
@@ -150,14 +231,42 @@ This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agent
|
|
|
150
231
|
const apiRef = useGridApiRef();
|
|
151
232
|
<DataGrid apiRef={apiRef} ... />
|
|
152
233
|
|
|
153
|
-
//
|
|
234
|
+
// Rows
|
|
235
|
+
apiRef.current.getRow(id) // → GridRowModel | null
|
|
236
|
+
apiRef.current.getAllRows() // → GridRowModel[]
|
|
237
|
+
apiRef.current.getVisibleRows() // → GridRowModel[] (post-filter/sort)
|
|
238
|
+
|
|
239
|
+
// Columns
|
|
240
|
+
apiRef.current.getColumn(field) // → GridColDef | null
|
|
241
|
+
apiRef.current.getAllColumns() // → GridColDef[]
|
|
242
|
+
apiRef.current.getVisibleColumns() // → GridColDef[]
|
|
243
|
+
|
|
244
|
+
// Selection
|
|
245
|
+
apiRef.current.selectRow(id, true)
|
|
246
|
+
apiRef.current.selectRows([id1, id2], true)
|
|
154
247
|
apiRef.current.getSelectedRows() // → GridRowId[]
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
apiRef.current.setFilterModel(model) // programmatic filter
|
|
248
|
+
|
|
249
|
+
// Sorting
|
|
158
250
|
apiRef.current.sortColumn('name', 'asc')
|
|
251
|
+
apiRef.current.getSortModel() // → GridSortItem[]
|
|
252
|
+
|
|
253
|
+
// Filtering
|
|
254
|
+
apiRef.current.setFilterModel(model)
|
|
255
|
+
apiRef.current.getFilterModel() // → GridFilterModel
|
|
256
|
+
|
|
257
|
+
// Pagination
|
|
159
258
|
apiRef.current.setPage(2)
|
|
160
|
-
apiRef.current.
|
|
259
|
+
apiRef.current.setPageSize(50)
|
|
260
|
+
|
|
261
|
+
// Scroll
|
|
262
|
+
apiRef.current.scrollToIndexes({ rowIndex: 100, colIndex: 3 })
|
|
263
|
+
|
|
264
|
+
// Clipboard
|
|
265
|
+
apiRef.current.copySelectedRows() // → Promise<void>
|
|
266
|
+
|
|
267
|
+
// Aggregation
|
|
268
|
+
apiRef.current.getAggregationResult() // → Record<string, unknown> | null
|
|
269
|
+
apiRef.current.getAggregationModel() // → GridAggregationModel | null
|
|
161
270
|
```
|
|
162
271
|
|
|
163
272
|
---
|
|
@@ -186,6 +295,20 @@ Replace any built-in component with your own:
|
|
|
186
295
|
/>
|
|
187
296
|
```
|
|
188
297
|
|
|
298
|
+
### Built-in Toolbar
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import { DataGrid, GridToolbar } from '@opencorestack/opengridx';
|
|
302
|
+
|
|
303
|
+
<DataGrid
|
|
304
|
+
rows={rows}
|
|
305
|
+
columns={columns}
|
|
306
|
+
slots={{ toolbar: GridToolbar }}
|
|
307
|
+
/>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
`GridToolbar` provides global search, column visibility panel, filter panel, and export controls out of the box.
|
|
311
|
+
|
|
189
312
|
### Export Functionality
|
|
190
313
|
|
|
191
314
|
OpenGridX has **two tiers of Excel export**:
|
|
@@ -214,6 +337,21 @@ printGrid(rows, columns, 'Report Title');
|
|
|
214
337
|
> npm install exceljs
|
|
215
338
|
> ```
|
|
216
339
|
|
|
340
|
+
### State Persistence
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
import { useGridStateStorage } from '@opencorestack/opengridx';
|
|
344
|
+
|
|
345
|
+
const { initialState, onStateChange } = useGridStateStorage('my-grid-key');
|
|
346
|
+
|
|
347
|
+
<DataGrid
|
|
348
|
+
rows={rows}
|
|
349
|
+
columns={columns}
|
|
350
|
+
initialState={initialState}
|
|
351
|
+
onStateChange={onStateChange}
|
|
352
|
+
/>
|
|
353
|
+
```
|
|
354
|
+
|
|
217
355
|
### Theming
|
|
218
356
|
|
|
219
357
|
```tsx
|
|
@@ -232,11 +370,11 @@ Built-in themes: `darkTheme`, `roseTheme`, `emeraldTheme`, `amberTheme`, `compac
|
|
|
232
370
|
|
|
233
371
|
| Artifact | Minified | Gzipped | Notes |
|
|
234
372
|
| :--- | :--- | :--- | :--- |
|
|
235
|
-
| **Core ES Module** (`opengridx.es.js`) |
|
|
236
|
-
| **Core UMD** (`opengridx.umd.js`) |
|
|
237
|
-
| **Styles** (`opengridx.css`) |
|
|
373
|
+
| **Core ES Module** (`opengridx.es.js`) | 242 KB | **58 KB** | Use this — tree-shakeable |
|
|
374
|
+
| **Core UMD** (`opengridx.umd.js`) | 164 KB | **48 KB** | CommonJS / CDN compat |
|
|
375
|
+
| **Styles** (`opengridx.css`) | 62 KB | **10 KB** | Auto-included |
|
|
238
376
|
| **ExcelJS** (optional peer dep) | — | — | `npm install exceljs` |
|
|
239
|
-
| **npm package download** | — | **
|
|
377
|
+
| **npm package download** | — | **613 KB** | Total compressed tarball |
|
|
240
378
|
|
|
241
379
|
- **Tree-shaking Ready**: ES Module build — bundlers (Vite, Webpack) only include what you use.
|
|
242
380
|
- **Zero UI Dependencies**: No MUI, Ant Design, or Radix. Pure React + vanilla CSS.
|
|
@@ -252,6 +390,8 @@ Full documentation at 👉 **[opencorestack.github.io/OpenGridX](https://opencor
|
|
|
252
390
|
### 🏛️ Components
|
|
253
391
|
- **[DataGrid](docs/components/datagrid.md)** — Main component props and slots
|
|
254
392
|
- **[Toolbar & Pagination](docs/components/toolbar.md)** — Supplemental UI components
|
|
393
|
+
- **[Filter Panel](docs/components/filter-panel.md)** — Advanced filter panel component
|
|
394
|
+
- **[Column Visibility](docs/components/column-visibility.md)** — Column show/hide panel
|
|
255
395
|
|
|
256
396
|
### 🚀 Features
|
|
257
397
|
- **[Virtualization](docs/features/virtualization.md)** — 60fps rendering for 100k+ rows
|
|
@@ -264,6 +404,7 @@ Full documentation at 👉 **[opencorestack.github.io/OpenGridX](https://opencor
|
|
|
264
404
|
- **[Infinite Scroll](docs/features/infinite-scroll.md)** — Seamless lazy-loading
|
|
265
405
|
- **[Export Guide](docs/features/export-guide.md)** — Excel, CSV, and Print
|
|
266
406
|
- **[Data Source](docs/features/data-source.md)** — Server-side integration
|
|
407
|
+
- **[Loading States](docs/features/loading-states.md)** — Skeleton and shimmer overlays
|
|
267
408
|
|
|
268
409
|
### 📊 Advanced Data
|
|
269
410
|
- **[Aggregation & Pivot](docs/features/aggregation-pivot.md)** — Summary totals
|
|
@@ -292,6 +433,8 @@ Most React grids gatekeep essential features like **Row Grouping**, **Excel Expo
|
|
|
292
433
|
| Advanced Filtering | ❌ | ✅ | ❌ | ✅ |
|
|
293
434
|
| Aggregation | ❌ | ✅ | ❌ | ✅ |
|
|
294
435
|
| Pivot Mode | ❌ | ✅ | ❌ | ✅ |
|
|
436
|
+
| Inline Cell Editing | ❌ | ✅ | ✅ | ✅ |
|
|
437
|
+
| State Persistence | ❌ | ✅ | ❌ | ✅ |
|
|
295
438
|
| **Price** | Free | **$$$** | Free (limited) | **Free** |
|
|
296
439
|
|
|
297
440
|
---
|
package/docs/API_REFERENCE.md
CHANGED
|
@@ -22,11 +22,15 @@ The main component for displaying and interacting with data.
|
|
|
22
22
|
| `checkboxSelection` | `boolean` | `false` | Enable row selection via checkboxes. |
|
|
23
23
|
| `pagination` | `boolean` | `false` | Enable the bottom pagination bar. |
|
|
24
24
|
| `paginationMode` | `'client' \| 'server' \| 'infinite'` | `'client'` | How to handle paging. |
|
|
25
|
-
| `paginationModel` | `GridPaginationModel` | `{page
|
|
25
|
+
| `paginationModel` | `GridPaginationModel` | — | Controlled pagination state (`{ page, pageSize }`). |
|
|
26
|
+
| `onPaginationModelChange` | `(model: GridPaginationModel) => void` | — | Fired when page or page size changes. |
|
|
27
|
+
| `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Available page size options. |
|
|
26
28
|
| `rowCount` | `number` | — | Total rows (required for server-side paging). |
|
|
29
|
+
| `height` | `number \| string` | `undefined` | Total height of the grid container. |
|
|
30
|
+
| `density` | `'compact' \| 'standard' \| 'comfortable'` | `'standard'` | Visual row density. |
|
|
27
31
|
| `initialState` | `GridInitialState` | `undefined` | Starting state for sorting, filters, etc. |
|
|
28
32
|
| `slots` | `GridSlots` | `{}` | Custom component overrides. |
|
|
29
|
-
| `slotProps` | `Record<string,
|
|
33
|
+
| `slotProps` | `Record<string, unknown>` | `{}` | Props passed to custom slots. |
|
|
30
34
|
| `filterModel` | `GridFilterModel` | `undefined` | Active filters. |
|
|
31
35
|
| `sortModel` | `GridSortItem[]` | `undefined` | Active sorting. |
|
|
32
36
|
| `onRowClick` | `(params: GridRowParams) => void` | — | Fired when a row is clicked. |
|
|
@@ -54,8 +58,14 @@ Access these methods via the `apiRef` prop.
|
|
|
54
58
|
| `sortColumn(field, dir)` | `void` | Programmatically sort a column. |
|
|
55
59
|
| `getSortModel()` | `GridSortItem[]` | Get active sorting state. |
|
|
56
60
|
| `setFilterModel(model)` | `void` | Programmatically set filters. |
|
|
61
|
+
| `getFilterModel()` | `GridFilterModel` | Get the current filter model. |
|
|
57
62
|
| `setPage(page)` | `void` | Change current page (0-indexed). |
|
|
63
|
+
| `setPageSize(pageSize)` | `void` | Change the current page size. |
|
|
58
64
|
| `scrollToIndexes(params)` | `void` | Scroll to specific row/column index. |
|
|
65
|
+
| `getAllColumns()` | `GridColDef[]` | Get all defined columns. |
|
|
66
|
+
| `getAggregationResult()` | `Record<string, unknown> \| null` | Get current aggregation results. |
|
|
67
|
+
| `getAggregationModel()` | `GridAggregationModel \| null` | Get the active aggregation configuration. |
|
|
68
|
+
| `copySelectedRows()` | `Promise<void>` | Copy selected rows to clipboard as TSV. |
|
|
59
69
|
|
|
60
70
|
---
|
|
61
71
|
|
|
@@ -71,7 +81,7 @@ Used in Tree Data and Row Grouping hierarchies.
|
|
|
71
81
|
| `depth` | `number` | Nesting level (0 for root). |
|
|
72
82
|
| `isExpanded` | `boolean` | Current expansion state. |
|
|
73
83
|
| `children` | `GridRowId[]` | IDs of child nodes. |
|
|
74
|
-
| `groupingValue` | `
|
|
84
|
+
| `groupingValue` | `unknown` | The value this node is grouping by. |
|
|
75
85
|
| `aggregatedValues` | `object` | Sums/Avgs computed for this group. |
|
|
76
86
|
|
|
77
87
|
---
|
|
@@ -85,13 +95,13 @@ Defines the behavior and appearance of a single column.
|
|
|
85
95
|
| :--- | :--- | :--- | :--- |
|
|
86
96
|
| `field` | `string` | — | Unique identifier (matches row property). |
|
|
87
97
|
| `headerName` | `string` | — | Text displayed in the header. |
|
|
88
|
-
| `width` | `number` | `100` | Width in pixels. |
|
|
89
|
-
| `type` | `'string' \| 'number' \| 'date' \| '
|
|
98
|
+
| `width` | `number \| string` | `100` | Width in pixels or percentage string. |
|
|
99
|
+
| `type` | `'string' \| 'number' \| 'date' \| 'boolean' \| 'singleSelect' \| 'image'` | `'string'` | Data type for formatting and filtering. |
|
|
90
100
|
| `sortable` | `boolean` | `true` | Enable sorting for this column. |
|
|
91
101
|
| `filterable` | `boolean` | `true` | Enable filtering for this column. |
|
|
92
102
|
| `resizable` | `boolean` | `true` | Allow user to drag resize. |
|
|
93
103
|
| `hideable` | `boolean` | `true` | Allow user to hide the column. |
|
|
94
|
-
| `
|
|
104
|
+
| `pinnable` | `boolean` | `true` | Allow column to be pinned via the UI. |
|
|
95
105
|
| `exportable` | `boolean` | `true` | If `false`, column is excluded from all exports. |
|
|
96
106
|
| `valueFormatter` | `(params: GridValueFormatterParams) => string` | — | Format value for display. |
|
|
97
107
|
| `valueGetter` | `(params: GridValueGetterParams) => any` | — | Compute value from row data. |
|
|
@@ -153,7 +163,7 @@ interface GridSortItem {
|
|
|
153
163
|
### `GridFilterModel`
|
|
154
164
|
```typescript
|
|
155
165
|
interface GridFilterModel {
|
|
156
|
-
items
|
|
166
|
+
items?: (GridFilterItem | GridFilterGroup)[];
|
|
157
167
|
logicOperator?: 'and' | 'or';
|
|
158
168
|
quickFilterValues?: string[];
|
|
159
169
|
}
|
|
@@ -29,8 +29,9 @@ function MyGrid() {
|
|
|
29
29
|
| `loading` | `boolean` | `false` | Displays a loading skeleton/shimmer. |
|
|
30
30
|
| `checkboxSelection` | `boolean` | `false` | Enable row checkboxes. |
|
|
31
31
|
| `pagination` | `boolean` | `false` | Enable/Disable bottom pagination bar. |
|
|
32
|
-
| `paginationModel` | `GridPaginationModel` | `{page
|
|
33
|
-
| `
|
|
32
|
+
| `paginationModel` | `GridPaginationModel` | — | Controlled pagination state (`{ page, pageSize }`). |
|
|
33
|
+
| `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Available page size options. |
|
|
34
|
+
| `initialState` | `GridInitialState` | `undefined` | Initial configuration (sorting, columns, etc). |
|
|
34
35
|
|
|
35
36
|
## 🖱️ Interaction & Events
|
|
36
37
|
|
|
@@ -38,8 +39,9 @@ function MyGrid() {
|
|
|
38
39
|
| :--- | :--- | :--- |
|
|
39
40
|
| `onRowClick` | `(params) => void` | Fired when clicking a row body. |
|
|
40
41
|
| `onCellClick` | `(params) => void` | Fired when clicking a specific cell. |
|
|
42
|
+
| `onPaginationModelChange` | `(model: GridPaginationModel) => void` | Fired when page or page size changes. |
|
|
41
43
|
| `onStateChange` | `(state) => void` | Fired on any internal state update. |
|
|
42
|
-
| `processRowUpdate` | `(new, old) => R
|
|
44
|
+
| `processRowUpdate` | `(new, old) => R \| Promise<R>` | Fired after a cell edit is committed. |
|
|
43
45
|
|
|
44
46
|
## 📦 Slots
|
|
45
47
|
|
|
@@ -82,18 +82,22 @@ const [colOrder, setColOrder] = useState(['id', 'name', 'status']);
|
|
|
82
82
|
<DataGrid
|
|
83
83
|
columnOrder={colOrder}
|
|
84
84
|
onColumnOrderChange={(params) => {
|
|
85
|
-
// params
|
|
86
|
-
|
|
85
|
+
// params: { column: GridColDef, oldIndex: number, targetIndex: number }
|
|
86
|
+
const newOrder = [...colOrder];
|
|
87
|
+
const [moved] = newOrder.splice(params.oldIndex, 1);
|
|
88
|
+
newOrder.splice(params.targetIndex, 0, moved);
|
|
89
|
+
setColOrder(newOrder);
|
|
87
90
|
}}
|
|
88
91
|
/>
|
|
89
92
|
```
|
|
90
93
|
|
|
91
94
|
### Non-Reorderable Columns
|
|
92
|
-
To prevent
|
|
95
|
+
To prevent all columns from being reordered, use `disableColumnReorder` on the grid. For individual column control, pin the column using `pinnedColumns` at the grid level — pinned columns do not participate in drag-reorder.
|
|
93
96
|
|
|
94
97
|
```tsx
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
// Disable reordering globally
|
|
99
|
+
<DataGrid disableColumnReorder />
|
|
100
|
+
|
|
101
|
+
// Keep a column fixed by pinning it
|
|
102
|
+
<DataGrid pinnedColumns={{ left: ['id'] }} />
|
|
99
103
|
```
|
|
@@ -49,7 +49,7 @@ The `GridFilterModel` describes the current state of filters.
|
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
51
|
interface GridFilterModel {
|
|
52
|
-
items
|
|
52
|
+
items?: (GridFilterItem | GridFilterGroup)[]; // Active filter items or groups
|
|
53
53
|
logicOperator?: 'and' | 'or'; // How to combine items
|
|
54
54
|
quickFilterValues?: string[]; // Values for the global search
|
|
55
55
|
}
|
|
@@ -57,27 +57,29 @@ interface GridFilterModel {
|
|
|
57
57
|
interface GridFilterItem {
|
|
58
58
|
field: string; // Column to filter
|
|
59
59
|
operator: GridFilterOperator;
|
|
60
|
-
value?:
|
|
60
|
+
value?: unknown; // Comparison value
|
|
61
61
|
}
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### Supported Operators
|
|
65
65
|
| Type | Operators |
|
|
66
66
|
| :--- | :--- |
|
|
67
|
-
| **String** | `contains`, `equals`, `startsWith`, `endsWith`, `isEmpty`, `isNotEmpty` |
|
|
68
|
-
| **Number** |
|
|
69
|
-
| **Date** | `is`, `not`, `
|
|
67
|
+
| **String** | `contains`, `equals`, `startsWith`, `endsWith`, `isEmpty`, `isNotEmpty`, `isAnyOf` |
|
|
68
|
+
| **Number** | `equals`, `!=`, `>`, `>=`, `<`, `<=`, `isEmpty`, `isNotEmpty` |
|
|
69
|
+
| **Date** | `is`, `not`, `isEmpty`, `isNotEmpty` |
|
|
70
70
|
| **Boolean** | `is` |
|
|
71
71
|
|
|
72
72
|
---
|
|
73
73
|
|
|
74
|
-
## 🎨 Customizing
|
|
75
|
-
|
|
74
|
+
## 🎨 Customizing the Toolbar
|
|
75
|
+
The filter panel is accessible through the built-in `GridToolbar`. To use your own toolbar that includes a filter entry point, pass a custom component to the `toolbar` slot:
|
|
76
76
|
|
|
77
77
|
```tsx
|
|
78
78
|
<DataGrid
|
|
79
79
|
slots={{
|
|
80
|
-
|
|
80
|
+
toolbar: MyCustomToolbar
|
|
81
81
|
}}
|
|
82
82
|
/>
|
|
83
83
|
```
|
|
84
|
+
|
|
85
|
+
The `FilterPanel` component is also exported from `@opencorestack/opengridx` if you need to embed it inside a custom layout.
|
|
@@ -47,7 +47,8 @@ const [selection, setSelection] = useState<GridRowId[]>([]);
|
|
|
47
47
|
| `disableRowSelectionOnClick` | `boolean` | `false` | If true, clicking a cell won't select the row. |
|
|
48
48
|
| `disableMultipleRowSelection` | `boolean` | `false` | Restricts selection to a single row. |
|
|
49
49
|
| `rowSelectionModel` | `GridRowId[]` | `[]` | Controlled array of selected IDs. |
|
|
50
|
-
| `
|
|
50
|
+
| `onRowSelectionModelChange` | `(model: GridRowSelectionModel) => void` | — | Fired when the selection changes. |
|
|
51
|
+
| `pinCheckboxColumn` | `boolean` | `false` | Keep the checkbox column visible during horizontal scroll. |
|
|
51
52
|
|
|
52
53
|
---
|
|
53
54
|
|
|
@@ -52,7 +52,9 @@ When using `paginationMode="server"`, you must provide the `rowCount` and handle
|
|
|
52
52
|
| Prop | Type | Default | Description |
|
|
53
53
|
| :--- | :--- | :--- | :--- |
|
|
54
54
|
| `pagination` | `boolean` | `false` | Enable/disable the pagination footer. |
|
|
55
|
-
| `paginationMode` | `'client' \| 'server'` | `'client'` | Location of the pagination logic. |
|
|
55
|
+
| `paginationMode` | `'client' \| 'server' \| 'infinite'` | `'client'` | Location of the pagination logic. |
|
|
56
|
+
| `paginationModel` | `GridPaginationModel` | — | Controlled pagination state (`{ page, pageSize }`). |
|
|
57
|
+
| `onPaginationModelChange` | `(model: GridPaginationModel) => void` | — | Fired when page or page size changes. |
|
|
56
58
|
| `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Options for the rows-per-page selector. |
|
|
57
59
|
|
|
58
60
|
---
|
|
@@ -63,5 +63,4 @@ The following features support state persistence:
|
|
|
63
63
|
- **Filtering**: `filterModel`
|
|
64
64
|
- **Pagination**: `paginationModel`
|
|
65
65
|
- **Columns**: `columnVisibilityModel`, `columnOrder`, `pinnedColumns`, `columnWidths`
|
|
66
|
-
- **
|
|
67
|
-
- **Grouping**: `rowGroupingModel`
|
|
66
|
+
- **Density**: `density`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencorestack/opengridx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "OpenGridX: High-performance React data infrastructure. Unlock advanced Row Grouping, Excel Export, and Column Pinning without the usual \"Pro\" gatekeeping. Built for speed, scale, and complete architectural freedom. Fully open, virtualization-ready, and feature-complete.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/opengridx.umd.js",
|