Skip to content

Commit 29dcb8c

Browse files
author
Asif Ansari
committed
docs: sync all doc files with v1.0.0 API
- API_REFERENCE.md: fix paginationModel (remove bogus default), add pageSizeOptions/onPaginationModelChange/height/density props; add missing GridApi methods (getFilterModel, getAllColumns, setPageSize, getAggregationResult, getAggregationModel, copySelectedRows); fix GridColDef width type (number|string), remove non-existent pinned property, replace with pinnable, fix type to remove dateTime and add singleSelect/image; fix GridFilterModel items type to include GridFilterGroup; fix groupingValue type from any to unknown - components/datagrid.md: fix initialState type (GridState->GridInitialState), add pageSizeOptions row, fix paginationModel default, add onPaginationModelChange to events table, fix processRowUpdate signature - features/sorting-pagination.md: add 'infinite' to paginationMode options, add paginationModel and onPaginationModelChange to props table - features/filtering.md: fix GridFilterModel items type, fix GridFilterItem value type (any->unknown), fix date operators (remove after/before, not in GridFilterOperator), add isAnyOf to string operators, fix custom filter panel example (filterPanel is not a valid slot; replace with correct toolbar slot guidance) - features/selection.md: remove non-existent isRowSelectable prop, add onRowSelectionModelChange and pinCheckboxColumn - features/editing-reordering.md: fix onColumnOrderChange params (params.newOrder does not exist; actual shape is {column, oldIndex, targetIndex}), remove non-existent reorderable column prop - features/state-persistence.md: remove rowSelectionModel and rowGroupingModel (not in GridState/GridInitialState), add density
1 parent 8bb41fc commit 29dcb8c

7 files changed

Lines changed: 49 additions & 29 deletions

File tree

‎docs/API_REFERENCE.md‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ The main component for displaying and interacting with data.
2222
| `checkboxSelection` | `boolean` | `false` | Enable row selection via checkboxes. |
2323
| `pagination` | `boolean` | `false` | Enable the bottom pagination bar. |
2424
| `paginationMode` | `'client' \| 'server' \| 'infinite'` | `'client'` | How to handle paging. |
25-
| `paginationModel` | `GridPaginationModel` | `{page:0, pageSize:25}` | Current page and page size. |
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. |
2628
| `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. |
2731
| `initialState` | `GridInitialState` | `undefined` | Starting state for sorting, filters, etc. |
2832
| `slots` | `GridSlots` | `{}` | Custom component overrides. |
29-
| `slotProps` | `Record<string, any>` | `{}` | Props passed to custom slots. |
33+
| `slotProps` | `Record<string, unknown>` | `{}` | Props passed to custom slots. |
3034
| `filterModel` | `GridFilterModel` | `undefined` | Active filters. |
3135
| `sortModel` | `GridSortItem[]` | `undefined` | Active sorting. |
3236
| `onRowClick` | `(params: GridRowParams) => void` | — | Fired when a row is clicked. |
@@ -54,8 +58,14 @@ Access these methods via the `apiRef` prop.
5458
| `sortColumn(field, dir)` | `void` | Programmatically sort a column. |
5559
| `getSortModel()` | `GridSortItem[]` | Get active sorting state. |
5660
| `setFilterModel(model)` | `void` | Programmatically set filters. |
61+
| `getFilterModel()` | `GridFilterModel` | Get the current filter model. |
5762
| `setPage(page)` | `void` | Change current page (0-indexed). |
63+
| `setPageSize(pageSize)` | `void` | Change the current page size. |
5864
| `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. |
5969

6070
---
6171

@@ -71,7 +81,7 @@ Used in Tree Data and Row Grouping hierarchies.
7181
| `depth` | `number` | Nesting level (0 for root). |
7282
| `isExpanded` | `boolean` | Current expansion state. |
7383
| `children` | `GridRowId[]` | IDs of child nodes. |
74-
| `groupingValue` | `any` | The value this node is grouping by. |
84+
| `groupingValue` | `unknown` | The value this node is grouping by. |
7585
| `aggregatedValues` | `object` | Sums/Avgs computed for this group. |
7686

7787
---
@@ -85,13 +95,13 @@ Defines the behavior and appearance of a single column.
8595
| :--- | :--- | :--- | :--- |
8696
| `field` | `string` | — | Unique identifier (matches row property). |
8797
| `headerName` | `string` | — | Text displayed in the header. |
88-
| `width` | `number` | `100` | Width in pixels. |
89-
| `type` | `'string' \| 'number' \| 'date' \| 'dateTime' \| 'boolean'` | `'string'` | Data type for formatting and filtering. |
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. |
90100
| `sortable` | `boolean` | `true` | Enable sorting for this column. |
91101
| `filterable` | `boolean` | `true` | Enable filtering for this column. |
92102
| `resizable` | `boolean` | `true` | Allow user to drag resize. |
93103
| `hideable` | `boolean` | `true` | Allow user to hide the column. |
94-
| `pinned` | `'left' \| 'right' \| null` | `null` | Sticky positioning. |
104+
| `pinnable` | `boolean` | `true` | Allow column to be pinned via the UI. |
95105
| `exportable` | `boolean` | `true` | If `false`, column is excluded from all exports. |
96106
| `valueFormatter` | `(params: GridValueFormatterParams) => string` | — | Format value for display. |
97107
| `valueGetter` | `(params: GridValueGetterParams) => any` | — | Compute value from row data. |
@@ -153,7 +163,7 @@ interface GridSortItem {
153163
### `GridFilterModel`
154164
```typescript
155165
interface GridFilterModel {
156-
items: GridFilterItem[];
166+
items?: (GridFilterItem | GridFilterGroup)[];
157167
logicOperator?: 'and' | 'or';
158168
quickFilterValues?: string[];
159169
}

‎docs/components/datagrid.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,19 @@ function MyGrid() {
2929
| `loading` | `boolean` | `false` | Displays a loading skeleton/shimmer. |
3030
| `checkboxSelection` | `boolean` | `false` | Enable row checkboxes. |
3131
| `pagination` | `boolean` | `false` | Enable/Disable bottom pagination bar. |
32-
| `paginationModel` | `GridPaginationModel` | `{page:0, pageSize:25}` | Controlled pagination state. |
33-
| `initialState` | `GridState` | `undefined` | Initial configuration (sorting, columns, etc). |
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). |
3435

3536
## 🖱️ Interaction & Events
3637

3738
| Prop | Type | Description |
3839
| :--- | :--- | :--- |
3940
| `onRowClick` | `(params) => void` | Fired when clicking a row body. |
4041
| `onCellClick` | `(params) => void` | Fired when clicking a specific cell. |
42+
| `onPaginationModelChange` | `(model: GridPaginationModel) => void` | Fired when page or page size changes. |
4143
| `onStateChange` | `(state) => void` | Fired on any internal state update. |
42-
| `processRowUpdate` | `(new, old) => R` | Fired after a cell edit is committed. |
44+
| `processRowUpdate` | `(new, old) => R \| Promise<R>` | Fired after a cell edit is committed. |
4345

4446
## 📦 Slots
4547

‎docs/features/editing-reordering.md‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,22 @@ const [colOrder, setColOrder] = useState(['id', 'name', 'status']);
8282
<DataGrid
8383
columnOrder={colOrder}
8484
onColumnOrderChange={(params) => {
85-
// params.newOrder is the updated array of field strings
86-
setColOrder(params.newOrder);
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);
8790
}}
8891
/>
8992
```
9093

9194
### Non-Reorderable Columns
92-
To prevent a specific column from being moved, set `reorderable: false` in its definition.
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.
9396

9497
```tsx
95-
const columns = [
96-
{ field: 'id', reorderable: false }, // Stay pinned at start
97-
{ field: 'name' }
98-
];
98+
// Disable reordering globally
99+
<DataGrid disableColumnReorder />
100+
101+
// Keep a column fixed by pinning it
102+
<DataGrid pinnedColumns={{ left: ['id'] }} />
99103
```

‎docs/features/filtering.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,37 @@ The `GridFilterModel` describes the current state of filters.
4949

5050
```typescript
5151
interface GridFilterModel {
52-
items: GridFilterItem[]; // Active filter items
52+
items?: (GridFilterItem | GridFilterGroup)[]; // Active filter items or groups
5353
logicOperator?: 'and' | 'or'; // How to combine items
5454
quickFilterValues?: string[]; // Values for the global search
5555
}
5656

5757
interface GridFilterItem {
5858
field: string; // Column to filter
5959
operator: GridFilterOperator;
60-
value?: any; // Comparison value
60+
value?: unknown; // Comparison value
6161
}
6262
```
6363

6464
### Supported Operators
6565
| Type | Operators |
6666
| :--- | :--- |
67-
| **String** | `contains`, `equals`, `startsWith`, `endsWith`, `isEmpty`, `isNotEmpty` |
68-
| **Number** | `=`, `!=`, `>`, `>=`, `<`, `<=`, `isEmpty`, `isNotEmpty` |
69-
| **Date** | `is`, `not`, `after`, `before`, `isEmpty`, `isNotEmpty` |
67+
| **String** | `contains`, `equals`, `startsWith`, `endsWith`, `isEmpty`, `isNotEmpty`, `isAnyOf` |
68+
| **Number** | `equals`, `!=`, `>`, `>=`, `<`, `<=`, `isEmpty`, `isNotEmpty` |
69+
| **Date** | `is`, `not`, `isEmpty`, `isNotEmpty` |
7070
| **Boolean** | `is` |
7171

7272
---
7373

74-
## 🎨 Customizing Filter Components
75-
You can replace the default filter panel via the `slots` API:
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:
7676

7777
```tsx
7878
<DataGrid
7979
slots={{
80-
filterPanel: MyCustomFilterPanel
80+
toolbar: MyCustomToolbar
8181
}}
8282
/>
8383
```
84+
85+
The `FilterPanel` component is also exported from `@opencorestack/opengridx` if you need to embed it inside a custom layout.

‎docs/features/selection.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const [selection, setSelection] = useState<GridRowId[]>([]);
4747
| `disableRowSelectionOnClick` | `boolean` | `false` | If true, clicking a cell won't select the row. |
4848
| `disableMultipleRowSelection` | `boolean` | `false` | Restricts selection to a single row. |
4949
| `rowSelectionModel` | `GridRowId[]` | `[]` | Controlled array of selected IDs. |
50-
| `isRowSelectable` | `(params) => boolean` | `undefined` | Predicate to disable selection for specific rows. |
50+
| `onRowSelectionModelChange` | `(model: GridRowSelectionModel) => void` | — | Fired when the selection changes. |
51+
| `pinCheckboxColumn` | `boolean` | `false` | Keep the checkbox column visible during horizontal scroll. |
5152

5253
---
5354

‎docs/features/sorting-pagination.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ When using `paginationMode="server"`, you must provide the `rowCount` and handle
5252
| Prop | Type | Default | Description |
5353
| :--- | :--- | :--- | :--- |
5454
| `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. |
5658
| `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Options for the rows-per-page selector. |
5759

5860
---

‎docs/features/state-persistence.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,4 @@ The following features support state persistence:
6363
- **Filtering**: `filterModel`
6464
- **Pagination**: `paginationModel`
6565
- **Columns**: `columnVisibilityModel`, `columnOrder`, `pinnedColumns`, `columnWidths`
66-
- **Selection**: `rowSelectionModel`
67-
- **Grouping**: `rowGroupingModel`
66+
- **Density**: `density`

0 commit comments

Comments
 (0)