@opencorestack/opengridx 1.0.4 → 1.0.6
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 +22 -0
- package/README.md +48 -1
- package/dist/index.d.ts +46 -1
- package/dist/opengridx.es.js +1902 -1872
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +9 -9
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +53 -0
- package/docs/components/toolbar.md +200 -19
- package/docs/features/toolbar-customization.md +205 -0
- package/lib/components/DataGrid/DataGrid.tsx +14 -1
- package/lib/components/Toolbar/GridToolbar.tsx +161 -69
- package/lib/index.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [1.0.6] — August 13, 2026 ✨
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Toolbar render prop slots**: `GridToolbar` now accepts render props to replace individual toolbar controls without replacing the entire toolbar. All panels (columns, filters, aggregation) continue to open and close normally — only the trigger element is swapped.
|
|
12
|
+
- `renderColumnsButton(props)` — replace the Columns icon button
|
|
13
|
+
- `renderFilterButton(props)` — replace the Filters icon button; receives `activeCount`
|
|
14
|
+
- `renderAggregationButton(props)` — replace the Summaries icon button; receives `activeCount`
|
|
15
|
+
- `renderExportButton()` — inject an Export button after the Aggregation button (no built-in exists)
|
|
16
|
+
- `renderQuickFilter(props)` — replace the built-in `GlobalSearch` input; receives `value` and `onChange`
|
|
17
|
+
- **`GridToolbar.className`**: Accepts an additional CSS class on the toolbar root `<div>` for full visual override without replacing the component.
|
|
18
|
+
- **Exported types**: `ToolbarButtonRenderProps` and `ToolbarQuickFilterRenderProps` are now exported from the package for TypeScript consumers.
|
|
19
|
+
- **Toolbar Customization demo**: new demo page at `/toolbar-customization` showing a branded dark toolbar and a plain light toolbar, each using all five render props.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## [1.0.5] — August 12, 2026 🐛
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- **Aggregation footer width misalignment with `flex` columns**: When a `GridColDef` used `flex` (with or without a `width` fallback), the aggregation footer cells used `columnWidths` to resolve rendered widths. That map is a user-resize override cache — it contains no entry for columns that have not been manually resized, so flex-columns fell back to their raw `col.width` prop value, producing cells that were narrower than the actual column. Fixed by computing `resolvedColumnWidths` in `DataGrid` that seeds from the layout-computed flex widths (`unpinnedColsWithWidth`, `leftPinnedCols`, `rightPinnedCols`) and then overlays any user-resize overrides. `GridAggregationFooter` now receives `resolvedColumnWidths` instead of `columnWidths`.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
8
30
|
## [1.0.4] — July 30, 2026 🐛
|
|
9
31
|
|
|
10
32
|
### Fixed
|
package/README.md
CHANGED
|
@@ -339,11 +339,58 @@ import { DataGrid, GridToolbar } from '@opencorestack/opengridx';
|
|
|
339
339
|
<DataGrid
|
|
340
340
|
rows={rows}
|
|
341
341
|
columns={columns}
|
|
342
|
+
filterModel={filterModel}
|
|
343
|
+
onFilterModelChange={setFilterModel}
|
|
344
|
+
columnVisibilityModel={columnVisibilityModel}
|
|
345
|
+
onColumnVisibilityModelChange={setColumnVisibilityModel}
|
|
342
346
|
slots={{ toolbar: GridToolbar }}
|
|
343
347
|
/>
|
|
344
348
|
```
|
|
345
349
|
|
|
346
|
-
`GridToolbar` provides global search, column visibility
|
|
350
|
+
`GridToolbar` provides global search, column visibility management, advanced filters, and aggregation controls. Each feature button is automatically hidden if its callback prop is not provided.
|
|
351
|
+
|
|
352
|
+
#### Customizing individual toolbar controls
|
|
353
|
+
|
|
354
|
+
Replace any single control using render props — the panels remain fully functional:
|
|
355
|
+
|
|
356
|
+
| Prop | What it replaces |
|
|
357
|
+
|------|-----------------|
|
|
358
|
+
| `renderQuickFilter(props)` | The search input. Receives `{ value, onChange }`. |
|
|
359
|
+
| `renderColumnsButton(props)` | The Columns toggle button. Receives `{ onClick, isOpen, activeCount }`. |
|
|
360
|
+
| `renderFilterButton(props)` | The Filters toggle button. Receives `{ onClick, isOpen, activeCount }`. |
|
|
361
|
+
| `renderAggregationButton(props)` | The Summaries toggle button. Receives `{ onClick, isOpen, activeCount }`. |
|
|
362
|
+
| `renderExportButton()` | Inserts an Export button slot (no built-in exists). |
|
|
363
|
+
| `className` | CSS class on the toolbar root for theme overrides. |
|
|
364
|
+
|
|
365
|
+
```tsx
|
|
366
|
+
import { GridToolbar, exportToCsv, useGridApiRef,
|
|
367
|
+
type ToolbarButtonRenderProps, type ToolbarQuickFilterRenderProps } from '@opencorestack/opengridx';
|
|
368
|
+
|
|
369
|
+
const apiRef = useGridApiRef();
|
|
370
|
+
|
|
371
|
+
<DataGrid
|
|
372
|
+
apiRef={apiRef}
|
|
373
|
+
slots={{ toolbar: GridToolbar }}
|
|
374
|
+
slotProps={{
|
|
375
|
+
toolbar: {
|
|
376
|
+
className: 'my-branded-toolbar',
|
|
377
|
+
renderQuickFilter: ({ value, onChange }: ToolbarQuickFilterRenderProps) => (
|
|
378
|
+
<input className="my-search" value={value} onChange={e => onChange(e.target.value)} />
|
|
379
|
+
),
|
|
380
|
+
renderFilterButton: ({ onClick, isOpen, activeCount }: ToolbarButtonRenderProps) => (
|
|
381
|
+
<button className={isOpen ? 'active' : ''} onClick={onClick}>
|
|
382
|
+
Filters {activeCount > 0 && <span>{activeCount}</span>}
|
|
383
|
+
</button>
|
|
384
|
+
),
|
|
385
|
+
renderExportButton: () => (
|
|
386
|
+
<button onClick={() => exportToCsv(apiRef.current.getAllRows(), columns)}>
|
|
387
|
+
Export CSV
|
|
388
|
+
</button>
|
|
389
|
+
),
|
|
390
|
+
},
|
|
391
|
+
}}
|
|
392
|
+
/>
|
|
393
|
+
```
|
|
347
394
|
|
|
348
395
|
### Export Functionality
|
|
349
396
|
|
package/dist/index.d.ts
CHANGED
|
@@ -976,7 +976,7 @@ export declare interface GridThemeTypography {
|
|
|
976
976
|
fontSizeXl?: string;
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
-
export declare function GridToolbar({ columns, baseColumns, aggregationModel, onAggregationModelChange, pivotModel, onPivotModelChange, filterModel, onFilterModelChange, columnVisibilityModel, onColumnVisibilityModelChange, onColumnReorder, onColumnOrderReset, forceColumnsOpen, onColumnsPanelClose, children, rightContent, style, }: GridToolbarProps): JSX.Element;
|
|
979
|
+
export declare function GridToolbar({ columns, baseColumns, aggregationModel, onAggregationModelChange, pivotModel, onPivotModelChange, filterModel, onFilterModelChange, columnVisibilityModel, onColumnVisibilityModelChange, onColumnReorder, onColumnOrderReset, forceColumnsOpen, onColumnsPanelClose, children, rightContent, style, renderColumnsButton, renderFilterButton, renderAggregationButton, renderExportButton, renderQuickFilter, className, }: GridToolbarProps): JSX.Element;
|
|
980
980
|
|
|
981
981
|
export declare interface GridToolbarProps {
|
|
982
982
|
columns?: GridColDef[];
|
|
@@ -1000,6 +1000,33 @@ export declare interface GridToolbarProps {
|
|
|
1000
1000
|
children?: default_2.ReactNode;
|
|
1001
1001
|
rightContent?: default_2.ReactNode;
|
|
1002
1002
|
style?: default_2.CSSProperties;
|
|
1003
|
+
/**
|
|
1004
|
+
* Replace the built-in Columns button. The columns panel still opens and
|
|
1005
|
+
* closes normally — only the trigger element is replaced.
|
|
1006
|
+
*/
|
|
1007
|
+
renderColumnsButton?: (props: ToolbarButtonRenderProps) => default_2.ReactNode;
|
|
1008
|
+
/**
|
|
1009
|
+
* Replace the built-in Filters button. The filter panel still opens and
|
|
1010
|
+
* closes normally — only the trigger element is replaced.
|
|
1011
|
+
*/
|
|
1012
|
+
renderFilterButton?: (props: ToolbarButtonRenderProps) => default_2.ReactNode;
|
|
1013
|
+
/**
|
|
1014
|
+
* Replace the built-in Aggregation/Summaries button. The aggregation panel
|
|
1015
|
+
* still opens and closes normally — only the trigger element is replaced.
|
|
1016
|
+
*/
|
|
1017
|
+
renderAggregationButton?: (props: ToolbarButtonRenderProps) => default_2.ReactNode;
|
|
1018
|
+
/**
|
|
1019
|
+
* Render an Export button. There is no built-in export button — this slot
|
|
1020
|
+
* inserts your element after the Aggregation button in the toolbar action row.
|
|
1021
|
+
*/
|
|
1022
|
+
renderExportButton?: () => default_2.ReactNode;
|
|
1023
|
+
/**
|
|
1024
|
+
* Replace the built-in quick-filter search bar. Receives the current search
|
|
1025
|
+
* value and an onChange handler; connect them to your own input element.
|
|
1026
|
+
*/
|
|
1027
|
+
renderQuickFilter?: (props: ToolbarQuickFilterRenderProps) => default_2.ReactNode;
|
|
1028
|
+
/** Additional CSS class applied to the toolbar root element. */
|
|
1029
|
+
className?: string;
|
|
1003
1030
|
}
|
|
1004
1031
|
|
|
1005
1032
|
export declare function GridTooltip({ title, children, placement, enterDelay, leaveDelay }: GridTooltipProps): JSX.Element;
|
|
@@ -1198,6 +1225,24 @@ declare interface SkeletonProps {
|
|
|
1198
1225
|
columns?: number;
|
|
1199
1226
|
}
|
|
1200
1227
|
|
|
1228
|
+
/** Props passed to a custom toolbar button renderer. */
|
|
1229
|
+
export declare interface ToolbarButtonRenderProps {
|
|
1230
|
+
/** Call this to toggle the associated panel open/closed. */
|
|
1231
|
+
onClick: () => void;
|
|
1232
|
+
/** Whether the associated panel is currently open. */
|
|
1233
|
+
isOpen: boolean;
|
|
1234
|
+
/** Number of active items (filters applied, aggregations configured, etc.). */
|
|
1235
|
+
activeCount: number;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/** Props passed to a custom quick-filter renderer. */
|
|
1239
|
+
export declare interface ToolbarQuickFilterRenderProps {
|
|
1240
|
+
/** Current search string. */
|
|
1241
|
+
value: string;
|
|
1242
|
+
/** Call with the new search string when the input changes. */
|
|
1243
|
+
onChange: (value: string) => void;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1201
1246
|
export declare function useAggregation<R extends GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
|
|
1202
1247
|
|
|
1203
1248
|
export declare interface UseAggregationParams<R extends GridRowModel> {
|