@gridkitjs/react 0.10.0 → 0.11.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/README.md +11 -1
- package/dist/index.d.ts +39 -6
- package/dist/index.js +1785 -362
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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,6 +60,14 @@ 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
73
|
Full documentation: [github.com/blagojablazhevski/gridkit](https://github.com/blagojablazhevski/gridkit#readme)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
|
-
export { Borders, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnVisibilityEvent, ColumnVisibilityState, FilterChangeEvent, FilterEntry, FilterState, GridMessages, GridOptions, GridState, GroupByBarVisibility, HoverableConfig, ResizeMode, ResolvedRow, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, serializeGridState } from '@gridkitjs/core';
|
|
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';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A column whose header and cells may render arbitrary React content.
|
|
@@ -126,7 +126,7 @@ interface DataGridApi<Row> {
|
|
|
126
126
|
* callbacks once for the whole call, and none when nothing changed.
|
|
127
127
|
*/
|
|
128
128
|
selectRows(rowIds: readonly string[], intent?: "replace" | "toggle"): void;
|
|
129
|
-
/** Expands every group at once
|
|
129
|
+
/** Expands every group at once, as the `group.expandAll` command does. */
|
|
130
130
|
expandAllGroups(): void;
|
|
131
131
|
/** 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
132
|
collapseAllGroups(): void;
|
|
@@ -186,6 +186,36 @@ interface DataGridApi<Row> {
|
|
|
186
186
|
* with no rows to measure, is left as it is.
|
|
187
187
|
*/
|
|
188
188
|
autoFitColumn(columnId: string): void;
|
|
189
|
+
/**
|
|
190
|
+
* `autoFitColumn` for each of the given columns, or for every column shown
|
|
191
|
+
* when given none.
|
|
192
|
+
*/
|
|
193
|
+
autoFitColumns(columnIds?: readonly string[]): void;
|
|
194
|
+
/**
|
|
195
|
+
* Opens the context menu `target` has, as a right-click there would —
|
|
196
|
+
* selecting it and focusing its cell first — beside `anchor`, a point in
|
|
197
|
+
* viewport coordinates or an element, or else below its cell. Says whether
|
|
198
|
+
* it opened: not for a target not on screen, nor where `contextMenu`
|
|
199
|
+
* gives no menu.
|
|
200
|
+
*/
|
|
201
|
+
openContextMenu(target: GridContextMenuTarget, anchor?: {
|
|
202
|
+
readonly x: number;
|
|
203
|
+
readonly y: number;
|
|
204
|
+
} | Element): boolean;
|
|
205
|
+
/** Closes the context menu, if one is open. */
|
|
206
|
+
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
|
+
/**
|
|
213
|
+
* Runs a command by id — a built-in or one of `commands` — on `target`,
|
|
214
|
+
* `{ area: "grid" }` when left out, when it is visible and enabled there.
|
|
215
|
+
* Reports it through `onCommand` with `source: "api"`, and says whether it
|
|
216
|
+
* ran.
|
|
217
|
+
*/
|
|
218
|
+
runCommand(commandId: string, target?: GridCommandTarget): boolean;
|
|
189
219
|
/** Scrolls the row with the given id into view, if it is currently shown. */
|
|
190
220
|
scrollToRow(rowId: string, options?: ScrollIntoViewOptions): void;
|
|
191
221
|
/** Scrolls the column with the given id into view. */
|
|
@@ -263,7 +293,8 @@ interface InfiniteScrollConfig {
|
|
|
263
293
|
/**
|
|
264
294
|
* The props that name a React type, and so have no place in the
|
|
265
295
|
* framework-free `GridOptions`: columns whose templates return `ReactNode`,
|
|
266
|
-
*
|
|
296
|
+
* the pager and infinite-scroll configs whose templates do too, and the
|
|
297
|
+
* toolbar's custom entries.
|
|
267
298
|
*/
|
|
268
299
|
interface ReactRenderSlots<Row> {
|
|
269
300
|
columns?: readonly ColumnDefinition<Row>[] | undefined;
|
|
@@ -277,6 +308,8 @@ interface ReactRenderSlots<Row> {
|
|
|
277
308
|
* bound, so the mounted row count never grows with it either.
|
|
278
309
|
*/
|
|
279
310
|
infiniteScroll?: InfiniteScrollConfig | undefined;
|
|
311
|
+
/** Draws the toolbar's custom entries — `{ type: "custom", id }` — by id. */
|
|
312
|
+
renderToolbarItem?: ((id: string) => ReactNode) | undefined;
|
|
280
313
|
}
|
|
281
314
|
/**
|
|
282
315
|
* Every grid setting in `@gridkitjs/core`'s `GridOptions`, plus what only
|
|
@@ -410,8 +443,8 @@ interface FilterStateApi<Row> {
|
|
|
410
443
|
}
|
|
411
444
|
/**
|
|
412
445
|
* Reactive filter state read off a mounted `DataGrid`'s `ref`, for a filter
|
|
413
|
-
* bar or search box living outside the grid's own DOM
|
|
414
|
-
*
|
|
446
|
+
* bar or search box living outside the grid's own DOM, which sees every change
|
|
447
|
+
* however it was made — the toolbar's search box included. `setFilter`
|
|
415
448
|
* replaces the whole filter and sends the grid back to its first page.
|
|
416
449
|
*
|
|
417
450
|
* Before the grid mounts, `filter` reads as an empty array and `setFilter`
|