@opencorestack/opengridx 3.2.1 → 3.3.0
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 +35 -0
- package/README.md +12 -1
- package/dist/index.d.ts +173 -1
- package/dist/opengridx.css +1 -1
- package/dist/opengridx.es.js +5478 -4841
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +15 -14
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +34 -2
- package/docs/README.md +1 -0
- package/docs/architecture/datagrid-orchestration.md +13 -5
- package/docs/components/header.md +25 -0
- package/docs/customization/theming.md +3 -1
- package/docs/features/cell-selection.md +131 -0
- package/docs/features/clipboard.md +2 -0
- package/docs/features/keyboard-navigation.md +14 -2
- package/docs/roadmap.md +64 -7
- package/lib/components/Cell/Cell.css +30 -0
- package/lib/components/Cell/Cell.tsx +25 -13
- package/lib/components/Cell/CellErrorBoundary.tsx +3 -0
- package/lib/components/CellSelectionStats/CellSelectionStats.css +31 -0
- package/lib/components/CellSelectionStats/CellSelectionStats.tsx +32 -0
- package/lib/components/CellSelectionStats/GridCellSelectionStatsArea.tsx +24 -0
- package/lib/components/DataGrid/DataGrid.tsx +61 -1
- package/lib/components/DataGrid/GridLiveRegion.tsx +8 -2
- package/lib/components/DataGrid/GridPinnedRows.tsx +9 -0
- package/lib/components/DataGrid/GridToolbarSlot.tsx +5 -0
- package/lib/components/DataGrid/GridVirtualRows.tsx +9 -0
- package/lib/components/FilterPanel/FilterPanel.tsx +2 -1
- package/lib/components/Header/Header.css +12 -0
- package/lib/components/Header/Header.tsx +17 -4
- package/lib/components/Row/Row.tsx +38 -1
- package/lib/components/Toolbar/GridToolbar.tsx +10 -4
- package/lib/components/ui/Checkbox.tsx +10 -5
- package/lib/hooks/core/gridApiPlaceholder.ts +6 -0
- package/lib/hooks/core/useGridCellSelection.ts +603 -0
- package/lib/hooks/core/useGridCellSelectionApi.ts +97 -0
- package/lib/hooks/core/useGridClipboardApi.ts +8 -2
- package/lib/hooks/core/useGridControlledState.ts +38 -0
- package/lib/hooks/core/useGridKeyboardNavigation.ts +32 -0
- package/lib/hooks/core/useGridRowInteractions.ts +8 -4
- package/lib/hooks/core/useGridThemeDimensions.ts +1 -1
- package/lib/hooks/features/useAggregation.ts +8 -6
- package/lib/hooks/features/useGridClipboard.ts +47 -2
- package/lib/hooks/features/useGridEditing.ts +16 -7
- package/lib/index.ts +9 -0
- package/lib/styles/base/variables.css +6 -1
- package/lib/styles/opengridx.css +1 -0
- package/lib/theme/DataGridThemeProvider.tsx +4 -0
- package/lib/theme/presets.ts +8 -0
- package/lib/theme/types.ts +4 -0
- package/lib/types/index.ts +130 -0
- package/lib/utils/attempt.ts +14 -0
- package/lib/utils/cellSelection.ts +238 -0
- package/lib/utils/columnAutosize.ts +1 -1
- package/lib/utils/export/exportShared.ts +11 -2
- package/lib/utils/headerWrap.ts +23 -0
- package/llms.txt +17 -2
- package/package.json +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [3.3.0] — 2026-10-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Wrapped header text** — new grid prop `wrapHeaderText` and per-column `GridColDef.wrapHeaderText` (the column wins). Long header titles wrap instead of being cut with an ellipsis, within the existing `headerHeight`: 2 lines at 56px, 3 at 72px, 4 at 88px, with an ellipsis on the last line if the title is still longer. The header never grows on its own; raise `headerHeight` for more lines. Wrapped header cells get the new class `ogx__header-cell--wrap` and show their full title as the `title` tooltip unless the column has a `description`. Sort icon, column menu button and resize handle are unchanged, and column auto-size still fits the title on one line. Demo: *Wrapped Header Text* (`/header-wrap`).
|
|
13
|
+
- **Cell range selection** (`cellSelection`) — select a rectangle of cells as in Excel or Google Sheets: press and drag (the grid auto-scrolls over virtualized rows and columns when the pointer nears or leaves an edge), Shift+click, Shift+Arrow (no row wrap), Shift+Home/End, Ctrl+Shift+Home/End, Shift+PageUp/PageDown, Ctrl/Cmd+A (every data cell of the page) and Escape (collapse to the anchor). Ctrl/Cmd+C copies the range (the focused cell at minimum) as TSV, formatted as shown, without a header line; `apiRef.current.copySelectedRows()` still copies rows. Ranges never change the row selection; the checkbox, detail-panel, reorder and `__group__` columns never join a range. Group rows, subtotals, tree auto-parents and the pivot Grand Total are highlighted but not copied. A range touching part of a `colSpan` / `rowSpan` grows to cover it. Off by default: grids without the prop are unchanged.
|
|
14
|
+
- **`cellSelectionModel` / `onCellSelectionModelChange(model, { reason })`** — controlled or uncontrolled model of `{ anchor, head }` corners addressed by row id and field, so a range follows its rows through sorting; it is cleared (`reason: 'dataChange'`) when a corner is no longer displayed. New types `GridCellCoordinates`, `GridCellRange`, `GridCellSelectionModel`, `GridCellSelectionReason`, `GridCellSelectionChangeDetails`, `GridSelectedCell`.
|
|
15
|
+
- **`GridApi`**: `getCellSelectionModel`, `setCellSelectionModel`, `selectCellRange`, `clearCellSelection`, `getSelectedCells`, `copySelectedCells`.
|
|
16
|
+
- **`showCellSelectionStats`** — a status bar with the Count, Sum and Average of the range (shared aggregation functions), replaceable through `slots.cellSelectionStats` (`GridCellSelectionStatsSlotProps`); the default component is exported as `CellSelectionStats`.
|
|
17
|
+
- **Accessibility** — range cells carry `aria-selected="true"`, focus stays on the anchor, and the live region announces the size ("12 cells selected, 3 rows by 4 columns", debounced 300 ms); translate it with `localeText.cellSelectionAnnouncement`.
|
|
18
|
+
- **Styling** — public classes `ogx__cell--range`, `ogx__cell--range-top|bottom|left|right` (inset outline, no layout shift) and `ogx--range-dragging`; CSS variables `--ogx-range-background` and `--ogx-range-border`, defined in every built-in theme and settable with the theme keys `grid.rangeBackground` / `grid.rangeBorder`.
|
|
19
|
+
- Demo page *Cell Range Selection* and guide `docs/features/cell-selection.md`.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- `Row` is now memoised (its `cellRange` prop compared by value), and the row click / checkbox handlers keep their identity across renders, so rows whose props did not change no longer re-render.
|
|
24
|
+
|
|
25
|
+
### Internal
|
|
26
|
+
|
|
27
|
+
- **React Compiler compatibility checked** — the library works in apps that use React Compiler, and when `lib/` itself is compiled (unit and browser suites pass with `REACT_COMPILER=1`). Fixed what the compiler rejected: a prop mutated in `Checkbox`, a self-referencing callback in `useGridEditing`, memoization the compiler could not keep in `FilterPanel` / `GridToolbar`, value expressions inside `try` in `Cell` / `useAggregation` / `useGridEditing`, and `GridToolbar`'s `forceColumnsOpen` effect. `InlineToolbar` (`slots.toolbar`) and `CellRenderTarget` (`renderCell`) are marked `'use no memo'`: compiled, they skipped the consumer's toolbar / cell function on re-render and broke its hooks. ESLint uses `react-hooks` `recommended-latest` (7.1.1) with `immutability` and `preserve-manual-memoization` on; new `npm run check:compiler`. Findings, remaining issues and how to re-run: `docs/contributing/react-compiler.md`.
|
|
28
|
+
- **GitHub wiki** generated from `docs/` — `scripts/build-wiki.mjs` (`npm run wiki:build`) turns the docs, CHANGELOG and CONTRIBUTING into wiki pages with a sidebar, rewrites relative links to wiki pages (or GitHub URLs for source files and images), and adds hand-written Home, Getting Started and FAQ pages from `wiki/`. `.github/workflows/wiki.yml` publishes it on every push to `main` that touches them.
|
|
29
|
+
|
|
30
|
+
## [3.2.2] — 2026-10-01
|
|
31
|
+
|
|
32
|
+
### Security
|
|
33
|
+
|
|
34
|
+
- **Exports no longer slow down on crafted cell text** — the check that tells plain signed numbers ("-12.50") from spreadsheet formulas (CSV/Excel formula-injection guard) could backtrack quadratically on long runs of digits, spaces and separators that end in a non-number character, freezing CSV or Excel export of such a value. It now runs in linear time; results are unchanged. Found by CodeQL.
|
|
35
|
+
- **Sheet names and theme heights** — stripping apostrophes from Excel sheet names and parsing `'36px'`-style theme heights used patterns with the same quadratic worst case; both are linear now, results unchanged.
|
|
36
|
+
- **Column auto-size selector fallback** — where `CSS.escape` is unavailable, field names are now escaped for backslashes as well as quotes.
|
|
37
|
+
|
|
38
|
+
### Internal
|
|
39
|
+
|
|
40
|
+
- `exceljs` is a devDependency (it stays an optional peer for consumers), so a regenerated lockfile keeps it.
|
|
41
|
+
- Dev-only dependency alerts: `undici` 7.30.0, `dompurify` 3.4.16, and `uuid` overridden to `^11.1.1` (pulled in by `exceljs` 4.4.0) in the repo and smoke fixtures. Consumers who install `exceljs` themselves still get its `uuid` 8 until `exceljs` updates it.
|
|
42
|
+
|
|
8
43
|
## [3.2.1] — 2026-10-01
|
|
9
44
|
|
|
10
45
|
### Fixed
|
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ Without a `height` prop the grid fills its container (`height: 100%`, or the fre
|
|
|
76
76
|
- **Fully Customizable**: Slots system for replacing any component (pagination, overlays, toolbar).
|
|
77
77
|
- **Export Functionality**: Built-in CSV, Excel (HTML `.xls`, or real `.xlsx` with the optional ExcelJS peer), JSON, PDF (optional jsPDF peer) and Print export.
|
|
78
78
|
- **Clipboard**: `Ctrl+C` / `Cmd+C` copies the selected rows' visible columns as TSV for Excel/Sheets.
|
|
79
|
+
- **Cell Range Selection** (v3.3): drag, Shift+click or Shift+arrows select a rectangle of cells; copy it as TSV and see its count, sum and average in a status bar (`cellSelection`, `showCellSelectionStats`).
|
|
79
80
|
- **Accessibility**: WCAG 2.1 AA — full ARIA roles and keyboard navigation.
|
|
80
81
|
- **Theming**: CSS variable API, `DataGridThemeProvider` with 5 built-in themes (`darkTheme`, `roseTheme`, `emeraldTheme`, `amberTheme`, `compactTheme`) and custom themes.
|
|
81
82
|
- **Column & Row Reordering**: Drag-and-drop column reordering and row reordering.
|
|
@@ -174,6 +175,9 @@ This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agent
|
|
|
174
175
|
| `disableMultipleRowSelection` | `boolean` | Restrict to single-row selection. |
|
|
175
176
|
| `pinCheckboxColumn` | `boolean` | Keeps the checkbox column visible during horizontal scroll. Default `true`. |
|
|
176
177
|
| `disableClipboardCopy` | `boolean` | Turns off the grid's Ctrl/Cmd+C copy (`apiRef.current.copySelectedRows()` still works). |
|
|
178
|
+
| `cellSelection` | `boolean` | Spreadsheet-style cell range selection; Ctrl/Cmd+C then copies the range (v3.3). |
|
|
179
|
+
| `cellSelectionModel` / `onCellSelectionModelChange` | `GridCellSelectionModel` / `(model, { reason }) => void` | Controlled cell range. |
|
|
180
|
+
| `showCellSelectionStats` | `boolean` | Status bar with count, sum and average of the range. |
|
|
177
181
|
|
|
178
182
|
### Sorting & Filtering
|
|
179
183
|
|
|
@@ -316,6 +320,12 @@ apiRef.current.autosizeColumn('name') // fit to content (v3.1.0+)
|
|
|
316
320
|
// Clipboard
|
|
317
321
|
apiRef.current.copySelectedRows() // → Promise<void>, rejects if the clipboard write fails
|
|
318
322
|
|
|
323
|
+
// Cell range selection (cellSelection, v3.3.0+)
|
|
324
|
+
apiRef.current.selectCellRange({ id: 1, field: 'q1' }, { id: 12, field: 'q4' })
|
|
325
|
+
apiRef.current.getSelectedCells() // → { id, field, value }[]
|
|
326
|
+
apiRef.current.copySelectedCells() // → Promise<void>
|
|
327
|
+
apiRef.current.clearCellSelection()
|
|
328
|
+
|
|
319
329
|
// Aggregation
|
|
320
330
|
apiRef.current.getAggregationResult() // → Record<string, unknown> | null
|
|
321
331
|
apiRef.current.getAggregationModel() // → GridAggregationModel | null
|
|
@@ -490,7 +500,7 @@ Built-in themes: `darkTheme`, `roseTheme`, `emeraldTheme`, `amberTheme`, `compac
|
|
|
490
500
|
|
|
491
501
|
## 📚 Documentation
|
|
492
502
|
|
|
493
|
-
Full documentation at 👉 **[opencorestack.github.io/OpenGridX](https://opencorestack.github.io/OpenGridX/)**
|
|
503
|
+
Full documentation at 👉 **[opencorestack.github.io/OpenGridX](https://opencorestack.github.io/OpenGridX/)** · 📖 **[Wiki](https://github.com/OpenCoreStack/OpenGridX/wiki)**
|
|
494
504
|
|
|
495
505
|
### 🏛️ Components
|
|
496
506
|
- **[DataGrid](docs/components/datagrid.md)** — Main component props and slots
|
|
@@ -510,6 +520,7 @@ Full documentation at 👉 **[opencorestack.github.io/OpenGridX](https://opencor
|
|
|
510
520
|
- **[Export Guide](docs/features/export-guide.md)** — Excel, CSV, JSON, and Print
|
|
511
521
|
- **[PDF Export](docs/features/pdf-export.md)** — Branded PDF reports
|
|
512
522
|
- **[Clipboard](docs/features/clipboard.md)** — Copy rows as TSV
|
|
523
|
+
- **[Cell Range Selection](docs/features/cell-selection.md)** — Select, total and copy cell ranges
|
|
513
524
|
- **[Keyboard & Accessibility](docs/features/keyboard-navigation.md)** — Keys, focus and ARIA
|
|
514
525
|
- **[Data Source](docs/features/data-source.md)** — Server-side integration
|
|
515
526
|
- **[Loading States](docs/features/loading-states.md)** — Skeleton and shimmer overlays
|
package/dist/index.d.ts
CHANGED
|
@@ -79,8 +79,22 @@ export declare interface CellProps<R extends GridRowModel = GridRowModel> {
|
|
|
79
79
|
rowMeta?: GridRowMeta;
|
|
80
80
|
/** The error the column's valueGetter threw for this cell (computed by Row); shown as a cell error. */
|
|
81
81
|
valueError?: unknown;
|
|
82
|
+
/**
|
|
83
|
+
* Place of the cell in the selected cell range (`cellSelection`), as bit flags: in range 1, top
|
|
84
|
+
* edge 2, bottom 4, left 8, right 16. 0 or absent: not in a range. @since v3.3
|
|
85
|
+
*/
|
|
86
|
+
rangeFlags?: number;
|
|
82
87
|
}
|
|
83
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The status bar of `showCellSelectionStats`: count of non-empty cells, and the sum and average of
|
|
91
|
+
* the numeric cells of the selected range. Replace it with `slots.cellSelectionStats`, or wrap it.
|
|
92
|
+
* @since v3.3
|
|
93
|
+
*/
|
|
94
|
+
export declare function CellSelectionStats({ count, sum, average }: CellSelectionStatsProps): JSX.Element;
|
|
95
|
+
|
|
96
|
+
export declare type CellSelectionStatsProps = GridCellSelectionStatsSlotProps & Record<string, unknown>;
|
|
97
|
+
|
|
84
98
|
export declare const Checkbox: default_2.FC<CheckboxProps>;
|
|
85
99
|
|
|
86
100
|
export declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
@@ -164,6 +178,13 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
164
178
|
rowHeight?: number;
|
|
165
179
|
/** Height of the header row in pixels. Defaults to 56. */
|
|
166
180
|
headerHeight?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Wraps header titles onto several lines instead of cutting them with an ellipsis. The header
|
|
183
|
+
* keeps `headerHeight` (2 lines at the default 56px, 3 at 72px, 4 at 88px); a title that still
|
|
184
|
+
* does not fit ends in an ellipsis. `GridColDef.wrapHeaderText` overrides it per column.
|
|
185
|
+
* Defaults to `false`.
|
|
186
|
+
*/
|
|
187
|
+
wrapHeaderText?: boolean;
|
|
167
188
|
/** If true, the grid height will adjust to match the total height of its rows. */
|
|
168
189
|
autoHeight?: boolean;
|
|
169
190
|
/**
|
|
@@ -233,6 +254,23 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
233
254
|
* the shortcut. `apiRef.current.copySelectedRows()` still works. Default: false.
|
|
234
255
|
*/
|
|
235
256
|
disableClipboardCopy?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Lets users select a rectangle of cells (drag, Shift+click, Shift+arrows, Ctrl/Cmd+A) and copy it
|
|
259
|
+
* with Ctrl/Cmd+C as tab-separated text. While on, Ctrl/Cmd+C copies the cell range (the focused
|
|
260
|
+
* cell at minimum) instead of the selected rows; `apiRef.copySelectedRows()` still copies rows.
|
|
261
|
+
* Default: false. @since v3.3
|
|
262
|
+
*/
|
|
263
|
+
cellSelection?: boolean;
|
|
264
|
+
/** Controlled cell selection (zero or one range). Needs `cellSelection`. @since v3.3 */
|
|
265
|
+
cellSelectionModel?: GridCellSelectionModel;
|
|
266
|
+
/** Fired when the cell selection changes, with what changed it. @since v3.3 */
|
|
267
|
+
onCellSelectionModelChange?: (model: GridCellSelectionModel, details: GridCellSelectionChangeDetails) => void;
|
|
268
|
+
/**
|
|
269
|
+
* Shows a status bar under the grid with the count of non-empty cells and the sum and average of the
|
|
270
|
+
* numeric cells in the range, while more than one cell is selected. Replaceable through
|
|
271
|
+
* `slots.cellSelectionStats`. Needs `cellSelection`. Default: false. @since v3.3
|
|
272
|
+
*/
|
|
273
|
+
showCellSelectionStats?: boolean;
|
|
236
274
|
/** Loading state. With no rows the body shows skeleton rows (or `slots.loadingOverlay`); with rows, they stay and a progress bar (or `slots.loadingOverlay`) is shown over them. */
|
|
237
275
|
loading?: boolean;
|
|
238
276
|
/** Visual density of the grid. */
|
|
@@ -371,6 +409,11 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
371
409
|
* Receives `GridFooterSlotProps` (plus `slotProps.footer`).
|
|
372
410
|
*/
|
|
373
411
|
footer?: React.ComponentType<GridFooterSlotProps & Record<string, unknown>>;
|
|
412
|
+
/**
|
|
413
|
+
* Replaces the status bar of `showCellSelectionStats`. Receives `GridCellSelectionStatsSlotProps`
|
|
414
|
+
* (plus `slotProps.cellSelectionStats`). @since v3.3
|
|
415
|
+
*/
|
|
416
|
+
cellSelectionStats?: React.ComponentType<GridCellSelectionStatsSlotProps & Record<string, unknown>>;
|
|
374
417
|
};
|
|
375
418
|
/** Properties passed directly to custom slots. */
|
|
376
419
|
slotProps?: {
|
|
@@ -386,6 +429,8 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
386
429
|
loadingOverlay?: GridOverlaySlotProps;
|
|
387
430
|
/** Merged over the `GridFooterSlotProps` the grid passes to the footer slot. */
|
|
388
431
|
footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
|
|
432
|
+
/** Merged over the `GridCellSelectionStatsSlotProps` the grid passes to the status bar. */
|
|
433
|
+
cellSelectionStats?: Partial<GridCellSelectionStatsSlotProps> & Record<string, unknown>;
|
|
389
434
|
};
|
|
390
435
|
/** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
|
|
391
436
|
listView?: boolean;
|
|
@@ -688,6 +733,35 @@ export declare interface GridApi<R extends GridValidRowModel = GridRowModel> {
|
|
|
688
733
|
* in which case nothing is written) and rejects when the clipboard write fails.
|
|
689
734
|
*/
|
|
690
735
|
copySelectedRows: () => Promise<void>;
|
|
736
|
+
/** The cell selection (`[]` when `cellSelection` is off or nothing is selected). @since v3.3 */
|
|
737
|
+
getCellSelectionModel: () => GridCellSelectionModel;
|
|
738
|
+
/**
|
|
739
|
+
* Replaces the cell selection (only the first range is kept) and moves focus to its anchor.
|
|
740
|
+
* Does nothing while `cellSelection` is off. @since v3.3
|
|
741
|
+
*/
|
|
742
|
+
setCellSelectionModel: (model: GridCellSelectionModel) => void;
|
|
743
|
+
/** Selects the rectangle between two cells; `anchor` becomes the active cell. @since v3.3 */
|
|
744
|
+
selectCellRange: (anchor: GridCellCoordinates, head: GridCellCoordinates) => void;
|
|
745
|
+
/** Empties the cell selection. Focus stays where it is. @since v3.3 */
|
|
746
|
+
clearCellSelection: () => void;
|
|
747
|
+
/**
|
|
748
|
+
* Cells of the current range in display order (row by row, columns in screen order), values read
|
|
749
|
+
* through the column's `valueGetter`. Synthetic rows (group headers, subtotals, tree auto-parents, the
|
|
750
|
+
* pivot Grand Total) and positions covered by a span are left out. @since v3.3
|
|
751
|
+
*/
|
|
752
|
+
getSelectedCells: () => GridSelectedCell[];
|
|
753
|
+
/**
|
|
754
|
+
* Copies the cell range (the focused cell when nothing is selected) as tab-separated text, formatted
|
|
755
|
+
* the way the cells show it, with no header line. Resolves without writing when there is nothing to
|
|
756
|
+
* copy; rejects when the clipboard write fails. @since v3.3
|
|
757
|
+
*/
|
|
758
|
+
copySelectedCells: () => Promise<void>;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/** One cell, addressed by its row id and column field. @since v3.3 */
|
|
762
|
+
export declare interface GridCellCoordinates {
|
|
763
|
+
id: GridRowId;
|
|
764
|
+
field: string;
|
|
691
765
|
}
|
|
692
766
|
|
|
693
767
|
export declare interface GridCellParams<R extends GridValidRowModel = GridRowModel> {
|
|
@@ -699,6 +773,54 @@ export declare interface GridCellParams<R extends GridValidRowModel = GridRowMod
|
|
|
699
773
|
colIndex: number;
|
|
700
774
|
}
|
|
701
775
|
|
|
776
|
+
/**
|
|
777
|
+
* A rectangle of cells between two corners. `anchor` is the active cell: it keeps focus, is the cell
|
|
778
|
+
* an edit starts in, and stays put while the range is extended. `head` is the corner that moves with
|
|
779
|
+
* Shift+arrows or the pointer, and the one scrolled into view. A single cell has `anchor` equal to `head`.
|
|
780
|
+
* @since v3.3
|
|
781
|
+
*/
|
|
782
|
+
export declare interface GridCellRange {
|
|
783
|
+
anchor: GridCellCoordinates;
|
|
784
|
+
head: GridCellCoordinates;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** Second argument of `onCellSelectionModelChange`. @since v3.3 */
|
|
788
|
+
export declare interface GridCellSelectionChangeDetails {
|
|
789
|
+
reason: GridCellSelectionReason;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* The cell selection: zero or one range in 3.3 (the array form leaves room for several ranges later).
|
|
794
|
+
* Corners are ids and fields, so the rectangle follows its corner rows through sorting and filtering.
|
|
795
|
+
* @since v3.3
|
|
796
|
+
*/
|
|
797
|
+
export declare type GridCellSelectionModel = readonly GridCellRange[];
|
|
798
|
+
|
|
799
|
+
/** What changed the cell selection. @since v3.3 */
|
|
800
|
+
export declare type GridCellSelectionReason = 'pointer' | 'keyboard' | 'selectAll' | 'api' | 'clear' | 'dataChange';
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Props the grid passes to `slots.cellSelectionStats` (the status bar of `showCellSelectionStats`),
|
|
804
|
+
* before `slotProps.cellSelectionStats` is merged over them. Rendered only while more than one cell
|
|
805
|
+
* is selected.
|
|
806
|
+
* @since v3.3
|
|
807
|
+
*/
|
|
808
|
+
export declare interface GridCellSelectionStatsSlotProps {
|
|
809
|
+
apiRef: React.MutableRefObject<GridApi>;
|
|
810
|
+
/** Cells in the rectangle (rows × columns), synthetic rows and span-covered positions included. */
|
|
811
|
+
cellCount: number;
|
|
812
|
+
rowCount: number;
|
|
813
|
+
columnCount: number;
|
|
814
|
+
/** Non-empty cells of data rows. */
|
|
815
|
+
count: number;
|
|
816
|
+
/** Cells holding a number. */
|
|
817
|
+
numericCount: number;
|
|
818
|
+
/** Sum of the numeric cells, or `null` when there are none. */
|
|
819
|
+
sum: number | null;
|
|
820
|
+
/** Average of the numeric cells, or `null` when there are none. */
|
|
821
|
+
average: number | null;
|
|
822
|
+
}
|
|
823
|
+
|
|
702
824
|
/**
|
|
703
825
|
* Metadata for a single column.
|
|
704
826
|
* Governs rendering, sorting, filtering, and data transformation.
|
|
@@ -737,6 +859,12 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
|
|
|
737
859
|
align?: GridAlignment;
|
|
738
860
|
/** Content alignment within the header cell. */
|
|
739
861
|
headerAlign?: GridAlignment;
|
|
862
|
+
/**
|
|
863
|
+
* Wraps this column's header title onto several lines instead of cutting it with an ellipsis.
|
|
864
|
+
* Overrides the grid's `wrapHeaderText`. The header keeps `headerHeight`: the title shows as many
|
|
865
|
+
* lines as fit and ends in an ellipsis if it is still longer. Raise `headerHeight` for more lines.
|
|
866
|
+
*/
|
|
867
|
+
wrapHeaderText?: boolean;
|
|
740
868
|
/** If false, sorting is disabled for this column. */
|
|
741
869
|
sortable?: boolean;
|
|
742
870
|
/** If false, filtering is disabled for this column. */
|
|
@@ -1046,6 +1174,12 @@ export declare interface GridLocaleText {
|
|
|
1046
1174
|
paginationPage?: (page: number, pageCount: number) => string;
|
|
1047
1175
|
/** Empty-state label. When set, overrides the `noRowsLabel` prop on DataGrid. Default: `"No Data"` */
|
|
1048
1176
|
noRowsLabel?: string;
|
|
1177
|
+
/**
|
|
1178
|
+
* Screen-reader announcement after the cell range changes (`cellSelection`). Receives (cells, rows,
|
|
1179
|
+
* columns). Default: `` (c, r, col) => `${c} cells selected, ${r} rows by ${col} columns` `` (singular for 1).
|
|
1180
|
+
* @since v3.3
|
|
1181
|
+
*/
|
|
1182
|
+
cellSelectionAnnouncement?: (cellCount: number, rowCount: number, columnCount: number) => string;
|
|
1049
1183
|
}
|
|
1050
1184
|
|
|
1051
1185
|
/**
|
|
@@ -1132,6 +1266,20 @@ export declare interface GridRenderHeaderParams {
|
|
|
1132
1266
|
colIndex: number;
|
|
1133
1267
|
}
|
|
1134
1268
|
|
|
1269
|
+
/**
|
|
1270
|
+
* The range flags one row passes to its cells, or `null` for a row outside the range. Rows outside
|
|
1271
|
+
* keep `null`, so a drag only re-renders the rows it enters or leaves. `left` / `right` are data
|
|
1272
|
+
* column indices (`columnIndexMap`).
|
|
1273
|
+
*/
|
|
1274
|
+
declare interface GridRowCellRange {
|
|
1275
|
+
left: number;
|
|
1276
|
+
right: number;
|
|
1277
|
+
isTop: boolean;
|
|
1278
|
+
isBottom: boolean;
|
|
1279
|
+
/** Rows from this one to the bottom of the range; only set (else 0) when the grid has row spans. */
|
|
1280
|
+
bottomOffset: number;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1135
1283
|
export declare type GridRowGroupingModel = string[];
|
|
1136
1284
|
|
|
1137
1285
|
/** Unique identifier for a row (string or number). */
|
|
@@ -1213,6 +1361,14 @@ export declare interface GridRowScrollEndParams {
|
|
|
1213
1361
|
|
|
1214
1362
|
export declare type GridRowSelectionModel = GridRowId[];
|
|
1215
1363
|
|
|
1364
|
+
/** One cell of the selected range, as returned by `apiRef.getSelectedCells()`. @since v3.3 */
|
|
1365
|
+
export declare interface GridSelectedCell {
|
|
1366
|
+
id: GridRowId;
|
|
1367
|
+
field: string;
|
|
1368
|
+
/** The cell's value, read through the column's `valueGetter`. */
|
|
1369
|
+
value: unknown;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1216
1372
|
/** The `slotProps` prop of `DataGrid`: props for each slot, keyed like `GridSlots`. */
|
|
1217
1373
|
export declare type GridSlotProps = NonNullable<DataGridProps['slotProps']>;
|
|
1218
1374
|
|
|
@@ -1354,6 +1510,10 @@ export declare interface GridThemeGrid {
|
|
|
1354
1510
|
rowSelectedBackground?: string;
|
|
1355
1511
|
rowSelectedHoverBackground?: string;
|
|
1356
1512
|
cellFocusBorder?: string;
|
|
1513
|
+
/** Tint over a selected cell range (`--ogx-range-background`). Default: the primary colour at 12%. @since v3.3 */
|
|
1514
|
+
rangeBackground?: string;
|
|
1515
|
+
/** Outline of a selected cell range (`--ogx-range-border`). Default: the primary colour. @since v3.3 */
|
|
1516
|
+
rangeBorder?: string;
|
|
1357
1517
|
pinnedLeftShadow?: string;
|
|
1358
1518
|
pinnedRightShadow?: string;
|
|
1359
1519
|
checkboxBg?: string;
|
|
@@ -1635,6 +1795,10 @@ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
|
|
|
1635
1795
|
onManageColumns?: () => void;
|
|
1636
1796
|
/** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
|
|
1637
1797
|
columnIndexMap?: Map<string, number>;
|
|
1798
|
+
/** Wraps header titles onto several lines; `GridColDef.wrapHeaderText` overrides it per column. */
|
|
1799
|
+
wrapHeaderText?: boolean;
|
|
1800
|
+
/** Header row height in pixels; sets how many lines a wrapped title may take. Defaults to 56. */
|
|
1801
|
+
headerHeight?: number;
|
|
1638
1802
|
}
|
|
1639
1803
|
|
|
1640
1804
|
export declare const Input: default_2.FC<InputProps>;
|
|
@@ -1835,7 +1999,10 @@ export declare interface PrintOptions<R extends GridValidRowModel = GridRowModel
|
|
|
1835
1999
|
|
|
1836
2000
|
export declare const roseTheme: GridTheme;
|
|
1837
2001
|
|
|
1838
|
-
|
|
2002
|
+
/** One grid row. Memoised: rows whose props did not change (for example outside a dragged cell range) do not re-render. */
|
|
2003
|
+
export declare const Row: typeof RowImpl;
|
|
2004
|
+
|
|
2005
|
+
declare function RowImpl<R extends GridRowModel = GridRowModel>(props: RowProps<R>): JSX.Element;
|
|
1839
2006
|
|
|
1840
2007
|
export declare interface RowProps<R extends GridRowModel = GridRowModel> {
|
|
1841
2008
|
row: R;
|
|
@@ -1901,6 +2068,11 @@ export declare interface RowProps<R extends GridRowModel = GridRowModel> {
|
|
|
1901
2068
|
columnIndexMap?: Map<string, number>;
|
|
1902
2069
|
/** 1-based `aria-rowindex` of this row in the whole grid (header rows included). Defaults to `rowIndex + 2`. */
|
|
1903
2070
|
ariaRowIndex?: number;
|
|
2071
|
+
/**
|
|
2072
|
+
* The part of the selected cell range (`cellSelection`) in this row, or `null` / absent when the
|
|
2073
|
+
* row is outside it. @since v3.3
|
|
2074
|
+
*/
|
|
2075
|
+
cellRange?: GridRowCellRange | null;
|
|
1904
2076
|
}
|
|
1905
2077
|
|
|
1906
2078
|
declare interface RowSpanningCaches {
|