@redsift/ds-mcp-server 12.5.2-muiv6 → 12.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/demos/patterns/_shared/StateDebugPanel.tsx +2 -2
- package/data/demos/patterns/_shared/columns.tsx +12 -3
- package/data/demos/patterns/_shared/defaults.ts +1 -1
- package/data/demos/patterns/_shared/filter-helpers.ts +1 -1
- package/data/demos/patterns/_shared/helpers.tsx +1 -1
- package/data/demos/patterns/_shared/server-logic.ts +1 -1
- package/data/demos/patterns/_shared/story-helpers.ts +106 -22
- package/data/demos/patterns/crossfiltered-datagrid-client-side/CrossfilteredDatagridClientSide.interaction.stories.tsx +1 -18
- package/data/demos/patterns/crossfiltered-datagrid-server-side/CrossfilteredDatagridServerSide.interaction.stories.tsx +1 -1
- package/data/demos/patterns/crossfiltered-datagrid-server-side/example.tsx +10 -10
- package/data/demos/patterns/drilldowned-datagrid-client-side/example.tsx +1 -1
- package/data/demos/patterns/drilldowned-datagrid-server-side/example.tsx +1 -1
- package/data/demos/patterns/single-datagrid-client-side/SingleDatagridClientSide.interaction.stories.tsx +1 -1
- package/data/demos/patterns/single-datagrid-client-side/example.tsx +4 -4
- package/data/demos/patterns/single-datagrid-server-side/SingleDatagridServerSide.interaction.stories.tsx +1 -1
- package/data/demos/patterns/single-datagrid-server-side/example.tsx +4 -4
- package/data/demos/patterns/stateful-single-datagrid-client-side/StatefulSingleDatagridClientSide.interaction.stories.tsx +129 -1
- package/data/demos/patterns/stateful-single-datagrid-client-side/example.tsx +6 -5
- package/data/demos/patterns/stateful-single-datagrid-server-side/StatefulSingleDatagridServerSide.interaction.stories.tsx +134 -1
- package/data/demos/patterns/stateful-single-datagrid-server-side/example.tsx +6 -5
- package/data/demos/patterns/tabbed-datagrid-server-side/example.tsx +1 -1
- package/data/docs/components/dashboard/Dashboard.json +2 -2
- package/data/docs/components/table/DataGrid.json +7 -7
- package/data/docs/components/table/GridToolbarFilterSemanticField.json +1 -1
- package/data/docs/components/table/StatefulDataGrid.json +7 -7
- package/data/docs/components/table/Toolbar.json +8 -2
- package/data/docs/components.json +1359 -5959
- package/data/docs/llms-full.txt +48 -46
- package/data/docs/llms.txt +4 -4
- package/data/docs/patterns-catalog.md +24 -25
- package/data/docs/patterns.json +4 -4
- package/data/metadata.json +2 -2
- package/data/patterns/crossfiltered-datagrid-server-side.mdx +1 -1
- package/data/patterns/drilldowned-datagrid-client-side.mdx +1 -1
- package/data/patterns/drilldowned-datagrid-server-side.mdx +1 -1
- package/data/patterns/single-datagrid-client-side.mdx +7 -7
- package/data/patterns/single-datagrid-server-side.mdx +4 -4
- package/data/patterns/stateful-single-datagrid-client-side.mdx +36 -21
- package/data/patterns/stateful-single-datagrid-server-side.mdx +46 -18
- package/data/patterns/tabbed-datagrid-server-side.mdx +1 -1
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { RouterLink } from '../../components/RouterLink';
|
|
|
6
6
|
|
|
7
7
|
## Introduction
|
|
8
8
|
|
|
9
|
-
The Stateful Datagrid Page extends the [Single Datagrid (client)](/patterns/single-datagrid-client-side) pattern with **automatic state persistence to URL and localStorage**. It uses `StatefulDataGrid` from `@redsift/table` instead of `DataGrid`. Filters, sorting, pagination, column visibility, column order, and density survive page refreshes and can be shared via URL — users bookmark a filtered view and anyone opening the link sees the same grid state.
|
|
9
|
+
The Stateful Datagrid Page extends the [Single Datagrid (client)](/patterns/single-datagrid-client-side) pattern with **automatic state persistence to URL and localStorage**. It uses `StatefulDataGrid` from `@redsift/table` instead of `DataGrid`. Filters, sorting, pagination, column visibility, column order, row grouping, aggregation, pivot, and density survive page refreshes and can be shared via URL — users bookmark a filtered view and anyone opening the link sees the same grid state.
|
|
10
10
|
|
|
11
11
|
All filtering, sorting, and pagination happen **client-side** — all rows are loaded at once. For server-side data handling with URL state persistence, see the [Stateful Single Datagrid (server)](/patterns/stateful-single-datagrid-server-side) pattern.
|
|
12
12
|
|
|
@@ -116,7 +116,21 @@ When **not** to use:
|
|
|
116
116
|
required: false,
|
|
117
117
|
description: 'Column arrangement persisted to URL and localStorage (only when different from default)',
|
|
118
118
|
},
|
|
119
|
-
|
|
119
|
+
{
|
|
120
|
+
feature: 'Row grouping persistence',
|
|
121
|
+
required: false,
|
|
122
|
+
description: 'Row grouping model persisted to URL and localStorage',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
feature: 'Aggregation persistence',
|
|
126
|
+
required: false,
|
|
127
|
+
description: 'Aggregation functions per column persisted to URL and localStorage',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
feature: 'Pivot persistence',
|
|
131
|
+
required: false,
|
|
132
|
+
description: 'Pivot configuration (columns, rows, value aggregations) persisted to URL and localStorage',
|
|
133
|
+
},
|
|
120
134
|
{
|
|
121
135
|
feature: 'URL compression',
|
|
122
136
|
required: false,
|
|
@@ -126,8 +140,7 @@ When **not** to use:
|
|
|
126
140
|
</>
|
|
127
141
|
),
|
|
128
142
|
},
|
|
129
|
-
|
|
130
|
-
]}
|
|
143
|
+
]}
|
|
131
144
|
/>
|
|
132
145
|
|
|
133
146
|
### Components
|
|
@@ -209,18 +222,20 @@ export const useRouter = () => {
|
|
|
209
222
|
|
|
210
223
|
`StatefulDataGrid` writes grid state to URL query params in a human-readable display format.
|
|
211
224
|
|
|
212
|
-
| State | URL Parameter
|
|
213
|
-
| ----------------- |
|
|
214
|
-
| Filter (string) | `field.operator=value`
|
|
215
|
-
| Filter (list) | `field.operator=a,b,c`
|
|
216
|
-
| Sort | `_sortColumn=field.direction`
|
|
217
|
-
| Pagination | `_pagination=page.size.direction`
|
|
218
|
-
| Column visibility | `_columnVisibility=col1,col2,...`
|
|
219
|
-
| Column order | `_columnOrder=col1,col2,...`
|
|
220
|
-
| Pinned columns | `_pinnedColumnsLeft=col1,col2`
|
|
221
|
-
|
|
222
|
-
|
|
|
223
|
-
|
|
|
225
|
+
| State | URL Parameter | Example |
|
|
226
|
+
| ----------------- | ----------------------------------- | ----------------------------------------------- |
|
|
227
|
+
| Filter (string) | `field.operator=value` | `Items.contains=Bread` |
|
|
228
|
+
| Filter (list) | `field.operator=a,b,c` | `Category.isAnyOf=Bakery,Pastry` |
|
|
229
|
+
| Sort | `_sortColumn=field.direction` | `_sortColumn=DateTime.desc` |
|
|
230
|
+
| Pagination | `_pagination=page.size.direction` | `_pagination=0.10.next` |
|
|
231
|
+
| Column visibility | `_columnVisibility=col1,col2,...` | `_columnVisibility=Items,Category,Paid` |
|
|
232
|
+
| Column order | `_columnOrder=col1,col2,...` | `_columnOrder=Category,Items,Paid` |
|
|
233
|
+
| Pinned columns | `_pinnedColumnsLeft=col1,col2` | `_pinnedColumnsLeft=__check__,Items` |
|
|
234
|
+
| Row grouping | `_rowGrouping=col1,col2` | `_rowGrouping=Category` |
|
|
235
|
+
| Aggregation | `_aggregation=field.func,...` | `_aggregation=Paid.sum,Score.avg` |
|
|
236
|
+
| Pivot | `_pivot=cols:...;rows:...;vals:...` | `_pivot=cols:Category;rows:Items;vals:Paid.sum` |
|
|
237
|
+
| Density | `_density=value` | `_density=compact` |
|
|
238
|
+
| Version | `v=N` | `v=1` |
|
|
224
239
|
|
|
225
240
|
Special characters in values (`:`, `,`, `~`) are percent-encoded (`%3A`, `%2C`, `%7E`).
|
|
226
241
|
|
|
@@ -228,7 +243,7 @@ Column order is only written to the URL when it differs from the default column
|
|
|
228
243
|
|
|
229
244
|
### URL Compression
|
|
230
245
|
|
|
231
|
-
When the total URL length exceeds ~2,000 characters, `StatefulDataGrid` automatically compresses query params using `lz-string`. Parameters are compressed in priority order — column order and visibility first — so the most important configuration stays human-readable. Compressed values are prefixed with `~` for self-describing format.
|
|
246
|
+
When the total URL length exceeds ~2,000 characters, `StatefulDataGrid` automatically compresses query params using `lz-string`. Parameters are compressed in priority order — column order and visibility first, pivot last — so the most important configuration stays human-readable. Compressed values are prefixed with `~` for self-describing format.
|
|
232
247
|
|
|
233
248
|
## State Management
|
|
234
249
|
|
|
@@ -239,7 +254,7 @@ When the total URL length exceeds ~2,000 characters, `StatefulDataGrid` automati
|
|
|
239
254
|
|
|
240
255
|
// Persisted states:
|
|
241
256
|
// filters, sorting, pagination, column visibility, column order,
|
|
242
|
-
// pinned columns, density
|
|
257
|
+
// pinned columns, density, row grouping, aggregation, pivot
|
|
243
258
|
|
|
244
259
|
// On every interaction:
|
|
245
260
|
// grid updates internal state
|
|
@@ -266,7 +281,7 @@ type Row = {
|
|
|
266
281
|
};
|
|
267
282
|
|
|
268
283
|
// Column definitions — use createColumn() for built-in filter operators
|
|
269
|
-
import { GridColDef } from '@mui/x-data-grid-
|
|
284
|
+
import { GridColDef } from '@mui/x-data-grid-premium';
|
|
270
285
|
import { createColumn } from '@redsift/table';
|
|
271
286
|
|
|
272
287
|
const columns: GridColDef[] = [
|
|
@@ -302,11 +317,11 @@ When data fetching fails, replace the grid area with an error message and a retr
|
|
|
302
317
|
2. **Define column definitions** — Create a `GridColDef[]` array using `createColumn()` for built-in filter operators.
|
|
303
318
|
3. **Create a router adapter** — Implement a `useRouter` hook for your framework (react-router, Next.js, or plain browser). See the Router Adapter section above.
|
|
304
319
|
4. **Create the toolbar** — Build a `CustomToolbar` component using `GridToolbarContainer`.
|
|
305
|
-
5. **Render StatefulDataGrid** — Pass `useRouter`, `localStorageVersion`, `initialState` (filter, sort, pagination defaults), `pagination`, `pageSizeOptions`, `rows`, `columns`.
|
|
320
|
+
5. **Render StatefulDataGrid** — Pass `useRouter`, `localStorageVersion`, `initialState` (filter, sort, pagination, row grouping, aggregation, pivot defaults), `pagination`, `pageSizeOptions`, `rows`, `columns`.
|
|
306
321
|
6. **Add bulk action bar** — Conditionally render when `selectionModel.length > 0`.
|
|
307
322
|
7. **Handle edge cases** — Loading state (`loading` prop), empty state (custom `NoRowsOverlay`), and error state (conditional render with retry).
|
|
308
323
|
8. **Set localStorageVersion** — Increment when column definitions change to force a clean localStorage. Set `previousLocalStorageVersions` to clean up old keys.
|
|
309
|
-
9. **Verify** — Test pagination, filter operators, column visibility, density, column order, URL sharing (copy URL → paste in new tab), and page refresh persistence. Verify that long URLs trigger compression automatically.
|
|
324
|
+
9. **Verify** — Test pagination, filter operators, column visibility, density, column order, row grouping, aggregation, pivot, URL sharing (copy URL → paste in new tab), and page refresh persistence. Verify that long URLs trigger compression automatically.
|
|
310
325
|
|
|
311
326
|
## Keyboard & Accessibility
|
|
312
327
|
|
|
@@ -6,7 +6,7 @@ import { RouterLink } from '../../components/RouterLink';
|
|
|
6
6
|
|
|
7
7
|
## Introduction
|
|
8
8
|
|
|
9
|
-
The Stateful Server Datagrid Page extends the [Single Datagrid (server)](/patterns/single-datagrid-server-side) pattern with **automatic state persistence to URL and localStorage**. It uses `StatefulDataGrid` from `@redsift/table` instead of `DataGrid`. All filtering, sorting, and pagination happen **server-side**, and the grid state (filters, sort, page, column visibility, column order, pinned columns, and
|
|
9
|
+
The Stateful Server Datagrid Page extends the [Single Datagrid (server)](/patterns/single-datagrid-server-side) pattern with **automatic state persistence to URL and localStorage**. It uses `StatefulDataGrid` from `@redsift/table` instead of `DataGrid`. All filtering, sorting, and pagination happen **server-side**, and the grid state (filters, sort, page, column visibility, column order, pinned columns, density, row grouping, aggregation, and pivot) is written to the URL so users can share filtered views via bookmarks or links. When the URL exceeds 2 000 characters, state is automatically compressed with lz-string.
|
|
10
10
|
|
|
11
11
|
Because `StatefulDataGrid` manages filter/sort/pagination state internally, the consumer uses **refs to track the latest model values** and **fetches data from callbacks** rather than controlled state.
|
|
12
12
|
|
|
@@ -135,7 +135,33 @@ When **not** to use:
|
|
|
135
135
|
</>
|
|
136
136
|
),
|
|
137
137
|
},
|
|
138
|
-
|
|
138
|
+
{
|
|
139
|
+
feature: 'Row grouping',
|
|
140
|
+
required: false,
|
|
141
|
+
description: (
|
|
142
|
+
<>
|
|
143
|
+
<code>rowGroupingModel</code> persisted to URL via <code>_rowGrouping</code> param
|
|
144
|
+
</>
|
|
145
|
+
),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
feature: 'Aggregation',
|
|
149
|
+
required: false,
|
|
150
|
+
description: (
|
|
151
|
+
<>
|
|
152
|
+
<code>aggregationModel</code> persisted to URL via <code>_aggregation</code> param
|
|
153
|
+
</>
|
|
154
|
+
),
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
feature: 'Pivot',
|
|
158
|
+
required: false,
|
|
159
|
+
description: (
|
|
160
|
+
<>
|
|
161
|
+
<code>pivotModel</code> persisted to URL via <code>_pivotModel</code> param. Forwarded to DataGridPremium.
|
|
162
|
+
</>
|
|
163
|
+
),
|
|
164
|
+
},
|
|
139
165
|
{
|
|
140
166
|
feature: 'URL compression',
|
|
141
167
|
required: false,
|
|
@@ -146,8 +172,7 @@ When **not** to use:
|
|
|
146
172
|
</>
|
|
147
173
|
),
|
|
148
174
|
},
|
|
149
|
-
|
|
150
|
-
]}
|
|
175
|
+
]}
|
|
151
176
|
/>
|
|
152
177
|
|
|
153
178
|
### Components
|
|
@@ -229,17 +254,20 @@ export const useRouter = () => {
|
|
|
229
254
|
|
|
230
255
|
`StatefulDataGrid` writes grid state to URL query params in a human-readable display format. The format is identical for both client-side and server-side grids.
|
|
231
256
|
|
|
232
|
-
| State | URL Parameter | Example
|
|
233
|
-
| ----------------- | --------------------------------- |
|
|
234
|
-
| Filter (string) | `field.operator=value` | `Items.contains=Bread`
|
|
235
|
-
| Filter (list) | `field.operator=a,b,c` | `Category.isAnyOf=Bakery,Pastry`
|
|
236
|
-
| Sort | `_sortColumn=field.direction` | `_sortColumn=DateTime.desc`
|
|
237
|
-
| Pagination | `_pagination=page.size.direction` | `_pagination=0.10.next`
|
|
238
|
-
| Column visibility | `_columnVisibility=col1,col2,...` | `_columnVisibility=Items,Category,Paid`
|
|
239
|
-
| Pinned columns | `_pinnedColumnsLeft=col1,col2` | `_pinnedColumnsLeft=__check__,Items`
|
|
240
|
-
| Column order | `_columnOrder=col1,col2,...` | `_columnOrder=Paid,Items,Category`
|
|
241
|
-
|
|
|
242
|
-
|
|
|
257
|
+
| State | URL Parameter | Example |
|
|
258
|
+
| ----------------- | --------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
259
|
+
| Filter (string) | `field.operator=value` | `Items.contains=Bread` |
|
|
260
|
+
| Filter (list) | `field.operator=a,b,c` | `Category.isAnyOf=Bakery,Pastry` |
|
|
261
|
+
| Sort | `_sortColumn=field.direction` | `_sortColumn=DateTime.desc` |
|
|
262
|
+
| Pagination | `_pagination=page.size.direction` | `_pagination=0.10.next` |
|
|
263
|
+
| Column visibility | `_columnVisibility=col1,col2,...` | `_columnVisibility=Items,Category,Paid` |
|
|
264
|
+
| Pinned columns | `_pinnedColumnsLeft=col1,col2` | `_pinnedColumnsLeft=__check__,Items` |
|
|
265
|
+
| Column order | `_columnOrder=col1,col2,...` | `_columnOrder=Paid,Items,Category` |
|
|
266
|
+
| Row grouping | `_rowGrouping=col1,col2` | `_rowGrouping=Category` |
|
|
267
|
+
| Aggregation | `_aggregation=col:func,...` | `_aggregation=Paid:sum,Quantity:avg` |
|
|
268
|
+
| Pivot model | `_pivotModel={json}` | `_pivotModel={"columns":["Category"],"rows":["Items"],"values":[{"field":"Paid","aggFunc":"sum"}]}` |
|
|
269
|
+
| Density | `_density=value` | `_density=compact` |
|
|
270
|
+
| Version | `v=N` | `v=1` |
|
|
243
271
|
|
|
244
272
|
### URL Compression
|
|
245
273
|
|
|
@@ -297,7 +325,7 @@ setLoading(false);
|
|
|
297
325
|
|
|
298
326
|
// Persisted states (URL + localStorage):
|
|
299
327
|
// filters, sort, pagination, column visibility, column order,
|
|
300
|
-
// pinned columns, density
|
|
328
|
+
// pinned columns, density, row grouping, aggregation, pivot
|
|
301
329
|
//
|
|
302
330
|
// URL compression:
|
|
303
331
|
// When the URL exceeds 2 000 chars, all state params are
|
|
@@ -353,11 +381,11 @@ When data fetching fails, replace the grid area with an error message and a retr
|
|
|
353
381
|
4. **Create the fetch function** — Accept filter/sort/page params, return `{ rows, totalRows }`.
|
|
354
382
|
5. **Set up refs** — `useRef` for filterModel, sortModel, page, pageSize.
|
|
355
383
|
6. **Create the toolbar** — Build a `CustomToolbar` component using `GridToolbarContainer`.
|
|
356
|
-
7. **Render StatefulDataGrid** — Pass `useRouter`, `localStorageVersion`, `initialState` (filter, sort, pagination defaults), `paginationMode="server"`, `sortingMode="server"`, `filterMode="server"`, `loading`, `rows`, `rowCount`, callbacks for `onFilterModelChange`/`onSortModelChange`/`onPaginationModelChange`.
|
|
384
|
+
7. **Render StatefulDataGrid** — Pass `useRouter`, `localStorageVersion`, `initialState` (filter, sort, pagination, row grouping, aggregation, pivot defaults), `paginationMode="server"`, `sortingMode="server"`, `filterMode="server"`, `loading`, `rows`, `rowCount`, callbacks for `onFilterModelChange`/`onSortModelChange`/`onPaginationModelChange`.
|
|
357
385
|
8. **Add bulk action bar** — Conditionally render when `selectionModel.length > 0`.
|
|
358
386
|
9. **Handle edge cases** — Loading overlay, empty state, and error state with retry.
|
|
359
387
|
10. **Set localStorageVersion** — Increment when column definitions change. Set `previousLocalStorageVersions` to clean up old keys.
|
|
360
|
-
11. **Verify** — Test pagination, filter operators, column visibility, density, column order, URL sharing, page refresh persistence. Verify that long URLs trigger compression automatically.
|
|
388
|
+
11. **Verify** — Test pagination, filter operators, column visibility, density, column order, row grouping, aggregation, pivot, URL sharing, page refresh persistence. Verify that long URLs trigger compression automatically.
|
|
361
389
|
|
|
362
390
|
## Keyboard & Accessibility
|
|
363
391
|
|
|
@@ -62,7 +62,7 @@ When **not** to use:
|
|
|
62
62
|
## State Management
|
|
63
63
|
|
|
64
64
|
<CodeBlock codeString={`import { useCallback, useEffect, useRef, useState } from 'react';
|
|
65
|
-
import { GridFilterModel, GridSortModel } from '@mui/x-data-grid-
|
|
65
|
+
import { GridFilterModel, GridSortModel } from '@mui/x-data-grid-premium';
|
|
66
66
|
|
|
67
67
|
// Active tab
|
|
68
68
|
const [activeTab, setActiveTab] = useState<string>('all');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redsift/ds-mcp-server",
|
|
3
|
-
"version": "12.5.2
|
|
3
|
+
"version": "12.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MCP server for the Red Sift Design System — provides component lookup, prop documentation, and code generation tools for AI assistants.",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "restricted"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3dd5b1120b0eab67de52a7942c5b8b16fa520abd"
|
|
39
39
|
}
|