@gridkitjs/react 0.11.0 → 0.12.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/README.md +12 -2
- package/dist/index.d.ts +51 -11
- package/dist/index.js +1286 -161
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @gridkitjs/react
|
|
2
2
|
|
|
3
3
|
React data-grid components built on
|
|
4
|
-
[`@gridkitjs/core`](https://www.npmjs.com/package/@gridkitjs/core)
|
|
4
|
+
[`@gridkitjs/core`](https://www.npmjs.com/package/@gridkitjs/core) for the
|
|
5
|
+
grid's logic and [`@gridkitjs/dom`](https://www.npmjs.com/package/@gridkitjs/dom)
|
|
6
|
+
for its browser behaviours. Both are installed with it.
|
|
5
7
|
|
|
6
8
|
> **Early development.** The API is still moving and may break between minor
|
|
7
9
|
> versions.
|
|
@@ -58,9 +60,17 @@ The grid is an ARIA grid: one tab stop, with the arrow keys moving cell to cell
|
|
|
58
60
|
within it, `Ctrl+Arrow` reordering a column and `Alt+Arrow` resizing one. Name
|
|
59
61
|
it with `label`, or a screen reader announces only "grid".
|
|
60
62
|
|
|
63
|
+
`contextMenu` gives headers, cells and group rows a menu of their own — sort,
|
|
64
|
+
group, autofit, hide and choose columns, select and clear, expand and collapse
|
|
65
|
+
— and `toolbar` puts a toolbar above the grid, with a search box, "Clear
|
|
66
|
+
filters" and "Choose columns" by default. Both list built-in commands by id,
|
|
67
|
+
and `commands` adds your own beside them; the column chooser shows and hides
|
|
68
|
+
columns from either. `messages` translates every string the grid shows or
|
|
69
|
+
announces, and `locale` formats dates and numbers.
|
|
70
|
+
|
|
61
71
|
Requires React 19.
|
|
62
72
|
|
|
63
|
-
Full documentation: [github.com/
|
|
73
|
+
Full documentation: [github.com/gridkitjs/gridkitjs](https://github.com/gridkitjs/gridkitjs#readme)
|
|
64
74
|
|
|
65
75
|
## License
|
|
66
76
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,52 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, Ref, RefObject } from 'react';
|
|
3
|
-
import { CellSelectEvent as CellSelectEvent$1, CellSelectionChangeEvent as CellSelectionChangeEvent$1, ColumnDefinition as ColumnDefinition$1, ColumnSelectEvent as ColumnSelectEvent$1, ColumnSelectionChangeEvent as ColumnSelectionChangeEvent$1, ColumnsSelectEvent as ColumnsSelectEvent$1, DataColumn as DataColumn$1, GridOptions, PaginationState, SelectionCallbacks as SelectionCallbacks$1, ResolvedRow, DisplayRow, ResolvedColumn as ResolvedColumn$1, ColumnSizingState, ColumnOrderState, ColumnVisibilityState, ColumnSortState, FilterState, GroupByState, GroupExpansionState, AggregateResults, SelectionState, CellSelectionState, GridState, SerializedGridState, GridContextMenuTarget, GridCommandTarget, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
|
-
export { Borders, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnVisibilityEvent, ColumnVisibilityState, ContextMenuOpenChangeEvent, FilterChangeEvent, FilterEntry, FilterState, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupByBarVisibility, HoverableConfig, MenuEntry, ResizeMode, ResolvedRow, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, ToolbarEntry, serializeGridState } from '@gridkitjs/core';
|
|
3
|
+
import { ExportWriter, GridExportOptions, PrintOptions, CellSelectEvent as CellSelectEvent$1, CellSelectionChangeEvent as CellSelectionChangeEvent$1, ColumnDefinition as ColumnDefinition$1, ColumnSelectEvent as ColumnSelectEvent$1, ColumnSelectionChangeEvent as ColumnSelectionChangeEvent$1, ColumnsSelectEvent as ColumnsSelectEvent$1, DataColumn as DataColumn$1, GridOptions, PaginationState, SelectionCallbacks as SelectionCallbacks$1, ResolvedRow, DisplayRow, ResolvedColumn as ResolvedColumn$1, ColumnSizingState, ColumnOrderState, ColumnVisibilityState, ColumnSortState, FilterState, GroupByState, GroupExpansionState, AggregateResults, SelectionState, CellSelectionState, GridState, SerializedGridState, GridContextMenuTarget, GridCommandTarget, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
|
+
export { Borders, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnVisibilityEvent, ColumnVisibilityState, ContextMenuOpenChangeEvent, ExportFile, ExportOptions, ExportWriter, FilterChangeEvent, FilterEntry, FilterState, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridExportOptions, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupByBarVisibility, HoverableConfig, MenuEntry, PrintOptions, ResizeMode, ResolvedRow, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, ToolbarEntry, excelFilter, serializeGridState } from '@gridkitjs/core';
|
|
5
|
+
|
|
6
|
+
/** What `DataGridApi` carries for exporting. */
|
|
7
|
+
interface GridExportApi {
|
|
8
|
+
/**
|
|
9
|
+
* The grid's view exported as `format` — `"csv"`, `"json"`, a format
|
|
10
|
+
* registered through `exportWriters`, or a writer passed as it is — and
|
|
11
|
+
* handed back as a `Blob`, under the grid's `export` option with
|
|
12
|
+
* `options` over it, field by field. Nothing is downloaded:
|
|
13
|
+
* `runCommand("export.csv")` downloads.
|
|
14
|
+
*
|
|
15
|
+
* Rejects for a format no writer is registered for, and when the writer
|
|
16
|
+
* fails.
|
|
17
|
+
*/
|
|
18
|
+
exportData(format: string | ExportWriter, options?: GridExportOptions): Promise<Blob>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** What `DataGridApi` carries for the grid's panels. */
|
|
22
|
+
interface GridPanelApi {
|
|
23
|
+
/**
|
|
24
|
+
* Opens the column chooser at the grid's top-end corner, in place of any
|
|
25
|
+
* panel open; it gives focus back to what had it when it closes.
|
|
26
|
+
*/
|
|
27
|
+
openColumnChooser(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Opens the filter menu of the column `columnId` below its header, in
|
|
30
|
+
* place of any panel open, and says whether it opened: not for a column
|
|
31
|
+
* with no filter menu, nor one not shown. It gives focus back to the
|
|
32
|
+
* header when it closes.
|
|
33
|
+
*/
|
|
34
|
+
openFilterMenu(columnId: string): boolean;
|
|
35
|
+
/** Closes the filter menu, if one is open, leaving any other panel open. */
|
|
36
|
+
closeFilterMenu(): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What `DataGridApi` carries for printing. */
|
|
40
|
+
interface GridPrintApi {
|
|
41
|
+
/**
|
|
42
|
+
* Prints the grid's view through the browser's print dialog — every row
|
|
43
|
+
* the filter leaves, across pages and collapsed groups, not only those
|
|
44
|
+
* drawn — under the grid's `print` option with `options` over it, field
|
|
45
|
+
* by field. Resolves once the dialog has closed, or at once while another
|
|
46
|
+
* print is open.
|
|
47
|
+
*/
|
|
48
|
+
print(options?: PrintOptions): Promise<void>;
|
|
49
|
+
}
|
|
5
50
|
|
|
6
51
|
/**
|
|
7
52
|
* A column whose header and cells may render arbitrary React content.
|
|
@@ -42,7 +87,7 @@ type SelectionCallbacks<Row> = SelectionCallbacks$1<Row, ReactNode>;
|
|
|
42
87
|
* notify channel for state that changes; see
|
|
43
88
|
* `packages/react/src/DataGrid/hooks/` for the public hooks built on it.
|
|
44
89
|
*/
|
|
45
|
-
interface DataGridApi<Row> {
|
|
90
|
+
interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
46
91
|
/** The grid's scrollable viewport element. */
|
|
47
92
|
readonly element: HTMLDivElement | null;
|
|
48
93
|
/**
|
|
@@ -126,7 +171,7 @@ interface DataGridApi<Row> {
|
|
|
126
171
|
* callbacks once for the whole call, and none when nothing changed.
|
|
127
172
|
*/
|
|
128
173
|
selectRows(rowIds: readonly string[], intent?: "replace" | "toggle"): void;
|
|
129
|
-
/** Expands every group at once
|
|
174
|
+
/** Expands every group at once, as the `group.expandAll` command does. */
|
|
130
175
|
expandAllGroups(): void;
|
|
131
176
|
/** Collapses every group currently shown at once — see `collapseAllGroups` in `@gridkitjs/core` for what "currently shown" means for a group already nested under a collapsed one. */
|
|
132
177
|
collapseAllGroups(): void;
|
|
@@ -204,11 +249,6 @@ interface DataGridApi<Row> {
|
|
|
204
249
|
} | Element): boolean;
|
|
205
250
|
/** Closes the context menu, if one is open. */
|
|
206
251
|
closeContextMenu(): void;
|
|
207
|
-
/**
|
|
208
|
-
* Opens the column chooser at the grid's top-end corner, in place of any
|
|
209
|
-
* panel open; it gives focus back to what had it when it closes.
|
|
210
|
-
*/
|
|
211
|
-
openColumnChooser(): void;
|
|
212
252
|
/**
|
|
213
253
|
* Runs a command by id — a built-in or one of `commands` — on `target`,
|
|
214
254
|
* `{ area: "grid" }` when left out, when it is visible and enabled there.
|
|
@@ -443,8 +483,8 @@ interface FilterStateApi<Row> {
|
|
|
443
483
|
}
|
|
444
484
|
/**
|
|
445
485
|
* Reactive filter state read off a mounted `DataGrid`'s `ref`, for a filter
|
|
446
|
-
* bar or search box living outside the grid's own DOM
|
|
447
|
-
*
|
|
486
|
+
* bar or search box living outside the grid's own DOM, which sees every change
|
|
487
|
+
* however it was made — the toolbar's search box included. `setFilter`
|
|
448
488
|
* replaces the whole filter and sends the grid back to its first page.
|
|
449
489
|
*
|
|
450
490
|
* Before the grid mounts, `filter` reads as an empty array and `setFilter`
|