@opencorestack/opengridx 1.3.0 → 2.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 +53 -0
- package/dist/index.d.ts +22 -6
- package/dist/opengridx.es.js +3673 -3617
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +16 -16
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +7 -9
- package/docs/components/datagrid.md +20 -2
- package/docs/components/header.md +3 -1
- package/docs/components/row.md +4 -9
- package/docs/features/pinning.md +0 -1
- package/docs/features/selection.md +22 -0
- package/docs/features/sorting-pagination.md +35 -0
- package/docs/features/tree-data-grouping.md +47 -4
- package/lib/components/DataGrid/DataGrid.tsx +86 -18
- package/lib/components/DataGrid/DataGrid.v2.test.tsx +127 -0
- package/lib/components/Header/Header.test.tsx +135 -0
- package/lib/components/Header/Header.tsx +20 -5
- package/lib/hooks/core/useGridColumns.tsx +2 -2
- package/lib/hooks/core/useGridControlledState.ts +3 -3
- package/lib/hooks/features/useAggregation.test.ts +40 -0
- package/lib/hooks/features/useAggregation.ts +14 -1
- package/lib/hooks/useRowGrouping.test.ts +53 -0
- package/lib/hooks/useRowGrouping.ts +22 -3
- package/lib/types/index.ts +18 -8
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,59 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [2.0.1] — 2026-09-08
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
|
|
12
|
+
- **`unique` aggregation function documented in changelog** — `unique` (count of distinct non-null
|
|
13
|
+
values via `Set`) has been a built-in aggregation function since v1. The v2.0.0 changelog entry
|
|
14
|
+
for `availableAggregationFunctions` now explicitly lists all six built-in names: `sum`, `avg`,
|
|
15
|
+
`count`, `min`, `max`, `unique`.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## [2.0.0] — 2026-09-08
|
|
20
|
+
|
|
21
|
+
### Breaking
|
|
22
|
+
|
|
23
|
+
- **Removed dead public API:** `onPinnedRowsChange` and `onRowGroupingModelChange` are removed from
|
|
24
|
+
`DataGridProps`. Both props accepted callbacks that were never invoked — no pin/unpin-row UI and no
|
|
25
|
+
drag-to-group UI exist. Callers that passed these callbacks should simply remove them; grid
|
|
26
|
+
behavior is unchanged.
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **`density` wired** — `density?: 'compact' | 'standard' | 'comfortable'` now sets the
|
|
31
|
+
`--ogx-row-height` CSS variable (compact = 32 px, standard = `rowHeight`, comfortable = 72 px).
|
|
32
|
+
Previously accepted but silently discarded.
|
|
33
|
+
- **`disableRowSelectionOnClick`** — clicking a row no longer triggers selection when this prop is
|
|
34
|
+
`true`. Previously wired to internal state only; `onRowSelectionModelChange` is now also fired.
|
|
35
|
+
- **`disableMultipleRowSelection`** — clicking a row while this prop is `true` caps selection to
|
|
36
|
+
that single row (deselects others). Clicking an already-selected row deselects it.
|
|
37
|
+
- **`groupingColDef` implemented** — passing `groupingColDef` when `rowGroupingModel` is active now
|
|
38
|
+
creates a dedicated `__group__` column at position 0, auto-pinned left. Previously the prop was
|
|
39
|
+
accepted but had no runtime effect.
|
|
40
|
+
- **`groupable: false` honored** — columns with `groupable: false` are now skipped when building the
|
|
41
|
+
grouping tree in `useRowGrouping`. Previously this flag was silently ignored.
|
|
42
|
+
- **`groupingValueFormatter` on `GridColDef`** — new optional field
|
|
43
|
+
`groupingValueFormatter?: (params: { field: string; value: unknown }) => string` customizes the
|
|
44
|
+
label shown for group-header rows at that level. The formatted string flows through
|
|
45
|
+
`GridRowMeta.groupLabel`. Falls back to `"${field}: ${value}"` when omitted.
|
|
46
|
+
- **`availableAggregationFunctions` honored** — per-column `availableAggregationFunctions?: string[]`
|
|
47
|
+
now gates which aggregation functions are computed in `useAggregation`. Functions not in the
|
|
48
|
+
allowed list are skipped for that field. Built-in function names (all available since v1):
|
|
49
|
+
`sum`, `avg`, `count`, `min`, `max`, `unique` (count of distinct non-null values).
|
|
50
|
+
- **`multiSort` prop** — new `multiSort?: boolean` on `DataGrid`. When `true`, every click on a
|
|
51
|
+
sortable column header appends/cycles that column in the sort model instead of replacing it — no
|
|
52
|
+
Shift key required. Shift+click continues to work as an append gesture regardless of this prop.
|
|
53
|
+
- **Multi-sort shift-click** — shift-clicking a column header appends the column to `sortModel`
|
|
54
|
+
rather than replacing it. A numbered priority badge appears next to the sort arrow when more than
|
|
55
|
+
one sort key is active. Plain click still replaces with a single-key sort (unless `multiSort` is set).
|
|
56
|
+
- **`description` tooltip** — `description?: string` on `GridColDef` now renders as the native
|
|
57
|
+
`title` attribute on the header cell, providing a browser tooltip on hover.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
8
61
|
## [1.3.0] — 2026-09-08
|
|
9
62
|
|
|
10
63
|
### Added
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,13 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
|
|
|
108
108
|
sortModel?: GridSortItem[];
|
|
109
109
|
/** Callback fired when the sorting model changes. */
|
|
110
110
|
onSortModelChange?: (model: GridSortItem[]) => void;
|
|
111
|
+
/**
|
|
112
|
+
* When true, clicking any sortable column header appends/cycles that column in the
|
|
113
|
+
* sort model instead of replacing it — no Shift key required. Plain click still
|
|
114
|
+
* cycles asc → desc → removed for that column while all other active sort keys stay.
|
|
115
|
+
* Shift+click continues to work regardless of this prop.
|
|
116
|
+
*/
|
|
117
|
+
multiSort?: boolean;
|
|
111
118
|
/** Filtering mode: 'client' (default) or 'server'. */
|
|
112
119
|
filterMode?: 'client' | 'server';
|
|
113
120
|
/** The current filter model. */
|
|
@@ -136,8 +143,6 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
|
|
|
136
143
|
onColumnVisibilityModelChange?: (model: GridColumnVisibilityModel) => void;
|
|
137
144
|
/** Defines which rows are pinned to the top or bottom. */
|
|
138
145
|
pinnedRows?: GridRowPinning;
|
|
139
|
-
/** Callback fired when row pinning changes. */
|
|
140
|
-
onPinnedRowsChange?: (model: GridRowPinning) => void;
|
|
141
146
|
/** If true, a column of checkboxes is added for row selection. */
|
|
142
147
|
checkboxSelection?: boolean;
|
|
143
148
|
/** If true, the checkbox column remains visible during horizontal scrolling. */
|
|
@@ -204,8 +209,6 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
|
|
|
204
209
|
defaultGroupingExpansionDepth?: number;
|
|
205
210
|
/** Controlled state for row grouping. */
|
|
206
211
|
rowGroupingModel?: GridRowGroupingModel;
|
|
207
|
-
/** Callback fired when row grouping changes. */
|
|
208
|
-
onRowGroupingModelChange?: (model: GridRowGroupingModel) => void;
|
|
209
212
|
/** Controlled state for data aggregation (e.g., { salary: 'sum' }). */
|
|
210
213
|
aggregationModel?: GridAggregationModel;
|
|
211
214
|
/** Callback fired when aggregation model changes. */
|
|
@@ -486,13 +489,22 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
|
|
|
486
489
|
field: string;
|
|
487
490
|
/** Text displayed in the column header. */
|
|
488
491
|
headerName?: string;
|
|
489
|
-
/** Tooltip
|
|
492
|
+
/** Tooltip shown on header hover — used as the column's accessibility label. */
|
|
490
493
|
description?: string;
|
|
491
494
|
/** If true, this column can be used as a grouping dimension. */
|
|
492
495
|
groupable?: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Custom formatter for the group-header label when this column is used as a grouping field.
|
|
498
|
+
* Receives the field name and grouped value; return the string to display.
|
|
499
|
+
* Falls back to `"field: value"` when omitted.
|
|
500
|
+
*/
|
|
501
|
+
groupingValueFormatter?: (params: {
|
|
502
|
+
field: string;
|
|
503
|
+
value: unknown;
|
|
504
|
+
}) => string;
|
|
493
505
|
/** If true, this column can be summarized using aggregation functions. */
|
|
494
506
|
aggregable?: boolean;
|
|
495
|
-
/**
|
|
507
|
+
/** Restricts which aggregation functions are offered for this column (e.g., ['sum', 'avg']). */
|
|
496
508
|
availableAggregationFunctions?: string[];
|
|
497
509
|
/** Width in pixels or a percentage string. Defaults to automatic calculation. */
|
|
498
510
|
width?: number | string;
|
|
@@ -819,6 +831,7 @@ export declare interface GridRowMeta {
|
|
|
819
831
|
treeDepth?: number;
|
|
820
832
|
groupingField?: string;
|
|
821
833
|
groupingValue?: unknown;
|
|
834
|
+
groupLabel?: string;
|
|
822
835
|
descendantCount?: number;
|
|
823
836
|
isExpanded?: boolean;
|
|
824
837
|
isGroupRow?: boolean;
|
|
@@ -1186,6 +1199,8 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
|
|
|
1186
1199
|
field: string;
|
|
1187
1200
|
} | null;
|
|
1188
1201
|
onHeaderClick?: (field: string) => void;
|
|
1202
|
+
onSortAdd?: (field: string, direction: GridSortDirection) => void;
|
|
1203
|
+
multiSort?: boolean;
|
|
1189
1204
|
onHideColumn?: (field: string) => void;
|
|
1190
1205
|
onPinColumn?: (field: string, side: 'left' | 'right' | null) => void;
|
|
1191
1206
|
onManageColumns?: () => void;
|
|
@@ -1380,6 +1395,7 @@ export declare function useAggregation<R extends GridRowModel>(params: UseAggreg
|
|
|
1380
1395
|
|
|
1381
1396
|
export declare interface UseAggregationParams<R extends GridRowModel> {
|
|
1382
1397
|
rows: R[];
|
|
1398
|
+
columns?: GridColDef[];
|
|
1383
1399
|
aggregationModel: GridAggregationModel;
|
|
1384
1400
|
isServerSide: boolean;
|
|
1385
1401
|
dataSource?: GridDataSource<R>;
|