@gridkitjs/react 0.17.1 → 0.19.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/dist/index.d.ts +43 -21
- package/dist/index.js +789 -524
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
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 { 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, PaginationUnit, PrintOptions, ResizeMode, ResolvedRow, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, ToolbarEntry, ToolbarItemAttributes, excelFilter, 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, ColumnPinningState, ColumnSortState, FilterState, GroupByState, GroupExpansionState, AggregateResults, SelectionState, CellSelectionState, GridFocus, GridState, SerializedGridState, ColumnPin, GridContextMenuTarget, GridCommandTarget, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
|
+
export { AggregateFn, AggregateResults, AggregateSpec, AggregateState, Borders, BuiltInAggregate, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnAlignment, ColumnFilterMenuOptions, ColumnOrderEvent, ColumnOrderState, ColumnPin, ColumnPinningEvent, ColumnPinningState, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnSortEntry, ColumnSortEvent, ColumnSortState, ColumnType, ColumnVisibilityEvent, ColumnVisibilityState, ColumnWrapConfig, ContextMenuOpenChangeEvent, DisplayRow, ExportFile, ExportOptions, ExportScalar, ExportWriter, FieldPath, FilterChangeEvent, FilterEntry, FilterState, FooterTemplateContext, FormatLocale, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridExportOptions, GridFilterMenuOptions, GridFocus, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupAggregateDisplay, GroupByBarVisibility, GroupByEntry, GroupByEvent, GroupByState, GroupExpansionEvent, GroupExpansionState, HoverableConfig, MenuEntry, PaginationChangeEvent, PaginationState, PaginationUnit, PrintOptions, ResizeMode, ResolvedGroupRow, ResolvedGroupSummaryRow, ResolvedRow, RowGroupPosition, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, SortDirection, ToolbarEntry, ToolbarItemAttributes, excelFilter, serializeGridState } from '@gridkitjs/core';
|
|
5
5
|
|
|
6
6
|
/** What `DataGridApi` carries for exporting. */
|
|
7
7
|
interface GridExportApi {
|
|
@@ -89,13 +89,16 @@ type SelectionCallbacks<Row> = SelectionCallbacks$1<Row, ReactNode>;
|
|
|
89
89
|
* `packages/react/src/DataGrid/hooks/` for the public hooks built on it.
|
|
90
90
|
*/
|
|
91
91
|
interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
92
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* The grid's root element, `.gridkit-data-grid-viewport`. The tables
|
|
94
|
+
* scroll inside it, in `.gridkit-data-grid-tables`, not on it.
|
|
95
|
+
*/
|
|
93
96
|
readonly element: HTMLDivElement | null;
|
|
94
97
|
/**
|
|
95
98
|
* The grid's row-area `<table>` element — the one holding `<tbody>`. The
|
|
96
99
|
* header and, when aggregates are active, footer render as their own
|
|
97
100
|
* sibling `<table>`s outside this one; use `element` to reach the whole
|
|
98
|
-
*
|
|
101
|
+
* grid instead.
|
|
99
102
|
*/
|
|
100
103
|
readonly table: HTMLTableElement | null;
|
|
101
104
|
/** Rows as currently filtered and sorted — what's rendered, ungrouped. */
|
|
@@ -119,6 +122,8 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
119
122
|
getColumnOrder(): ColumnOrderState;
|
|
120
123
|
/** Columns shown or hidden since the grid mounted. A column absent from it follows its definition's `hidden`. */
|
|
121
124
|
getColumnVisibility(): ColumnVisibilityState;
|
|
125
|
+
/** Columns pinned or unpinned since the grid mounted. A column absent from it follows its definition's `pinned`. */
|
|
126
|
+
getColumnPinning(): ColumnPinningState;
|
|
122
127
|
getColumnSort(): ColumnSortState;
|
|
123
128
|
/** The filter the rows are shown through — every entry, ANDed together. */
|
|
124
129
|
getFilter(): FilterState<Row>;
|
|
@@ -145,13 +150,10 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
145
150
|
getColumnSelection(): SelectionState;
|
|
146
151
|
getCellSelection(): CellSelectionState;
|
|
147
152
|
/**
|
|
148
|
-
* The cell currently holding the grid's single tab stop,
|
|
149
|
-
* `focusCell` takes
|
|
153
|
+
* The cell currently holding the grid's single tab stop, in the shape
|
|
154
|
+
* `focusCell` takes. Returns the same object until the focus moves.
|
|
150
155
|
*/
|
|
151
|
-
getFocusedCell():
|
|
152
|
-
rowIndex: number;
|
|
153
|
-
columnIndex: number;
|
|
154
|
-
};
|
|
156
|
+
getFocusedCell(): GridFocus;
|
|
155
157
|
/**
|
|
156
158
|
* Every slice of state as the grid applies it, in one object — what
|
|
157
159
|
* `restoreState` takes back. Pass it through `serializeGridState` before
|
|
@@ -162,16 +164,17 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
162
164
|
* Puts back state saved earlier, whole or in part — from `getState()`, or
|
|
163
165
|
* from `serializeGridState` and back through JSON. Each slice given is set
|
|
164
166
|
* as its setter would set it, firing its callback when it changes; the
|
|
165
|
-
* grid re-renders once.
|
|
167
|
+
* grid re-renders once. Saved state is read by its `version`; one without
|
|
168
|
+
* a version, saved by an earlier release, still restores, and one newer
|
|
169
|
+
* than this release reads throws.
|
|
166
170
|
*/
|
|
167
171
|
restoreState(saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>): void;
|
|
168
172
|
/**
|
|
169
|
-
* Moves the grid's tab stop, and the browser's focus, to
|
|
170
|
-
* `
|
|
171
|
-
* `
|
|
172
|
-
* the grid.
|
|
173
|
+
* Moves the grid's tab stop, and the browser's focus, to a cell:
|
|
174
|
+
* `{ area: "body", rowIndex, columnIndex }` or
|
|
175
|
+
* `{ area: "header", columnIndex }`. Either index is held inside the grid.
|
|
173
176
|
*/
|
|
174
|
-
focusCell(
|
|
177
|
+
focusCell(focus: GridFocus): void;
|
|
175
178
|
clearSelection(): void;
|
|
176
179
|
selectAllRows(): void;
|
|
177
180
|
/**
|
|
@@ -204,6 +207,13 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
204
207
|
* filters and groups, and keeps its place in the column order.
|
|
205
208
|
*/
|
|
206
209
|
hideColumns(columnIds: readonly string[]): void;
|
|
210
|
+
/**
|
|
211
|
+
* Pins a column to the `"start"` or `"end"` edge, or unpins it with
|
|
212
|
+
* `"none"`, leaving the column order as it is: an unpinned column goes
|
|
213
|
+
* back to its place among the others. Reports one
|
|
214
|
+
* `onColumnPinningChange`, and none when the column is already there.
|
|
215
|
+
*/
|
|
216
|
+
pinColumn(columnId: string, pin: ColumnPin): void;
|
|
207
217
|
/**
|
|
208
218
|
* Replaces the filter, the way a filter UI would, and sends an uncontrolled
|
|
209
219
|
* grid back to its first page. Reports one `onFilterChange`, and none when
|
|
@@ -223,21 +233,23 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
223
233
|
setGroupExpansion(expansion: GroupExpansionState): void;
|
|
224
234
|
/** Replaces the page and page size as given. Reports through `onPaginationChange`. */
|
|
225
235
|
setPagination(pagination: PaginationState): void;
|
|
226
|
-
/** Replaces the column widths. Reports through `
|
|
236
|
+
/** Replaces the column widths. Reports through `onColumnSizingChange`, as the `"end"` of a resize. */
|
|
227
237
|
setColumnSizing(sizing: ColumnSizingState): void;
|
|
228
238
|
/** Replaces the column order. Reports through `onColumnOrderChange`. */
|
|
229
239
|
setColumnOrder(order: ColumnOrderState): void;
|
|
230
240
|
/** Replaces the column visibility state. Reports through `onColumnVisibilityChange`. */
|
|
231
241
|
setColumnVisibility(visibility: ColumnVisibilityState): void;
|
|
242
|
+
/** Replaces the column pinning state. Reports through `onColumnPinningChange`. */
|
|
243
|
+
setColumnPinning(pinning: ColumnPinningState): void;
|
|
232
244
|
/** Replaces the selected row ids as given, whatever `selectable` allows. Fires the row selection callbacks. */
|
|
233
245
|
setRowSelection(selection: SelectionState): void;
|
|
234
246
|
/** Replaces the selected column ids as given. Fires the column selection callbacks. */
|
|
235
247
|
setColumnSelection(selection: SelectionState): void;
|
|
236
|
-
/** Replaces the
|
|
248
|
+
/** Replaces the cell selection as given, `{ kind: "none" }` for none. Fires the cell selection callbacks. */
|
|
237
249
|
setCellSelection(selection: CellSelectionState): void;
|
|
238
250
|
/**
|
|
239
251
|
* Sizes a shown column to fit its content, as double-clicking its resize
|
|
240
|
-
* handle does, reporting through `
|
|
252
|
+
* handle does, reporting through `onColumnSizingChange`. A hidden column, or one
|
|
241
253
|
* with no rows to measure, is left as it is.
|
|
242
254
|
*/
|
|
243
255
|
autoFitColumn(columnId: string): void;
|
|
@@ -443,7 +455,7 @@ interface SelectionStateApi {
|
|
|
443
455
|
* internally.
|
|
444
456
|
*
|
|
445
457
|
* Before the grid mounts, the row/column fields read as empty arrays and
|
|
446
|
-
* the cell field reads `
|
|
458
|
+
* the cell field reads `{ kind: "none" }`; the actions are no-ops.
|
|
447
459
|
*/
|
|
448
460
|
declare function useSelectionState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): SelectionStateApi;
|
|
449
461
|
|
|
@@ -489,6 +501,16 @@ declare function useColumnOrderState<Row>(gridRef: RefObject<DataGridApi<Row> |
|
|
|
489
501
|
*/
|
|
490
502
|
declare function useColumnVisibilityState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): ColumnVisibilityState;
|
|
491
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Reactive column-pinning state read off a mounted `DataGrid`'s `ref` — the
|
|
506
|
+
* columns pinned or unpinned since it mounted, keyed by id. Read-only:
|
|
507
|
+
* change it through the ref's `pinColumn`/`setColumnPinning`. A column
|
|
508
|
+
* absent from it follows its definition's `pinned`.
|
|
509
|
+
*
|
|
510
|
+
* Before the grid mounts, reads as an empty object.
|
|
511
|
+
*/
|
|
512
|
+
declare function useColumnPinningState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): ColumnPinningState;
|
|
513
|
+
|
|
492
514
|
interface FilterStateApi<Row> {
|
|
493
515
|
filter: FilterState<Row>;
|
|
494
516
|
setFilter: (filter: FilterState<Row>) => void;
|
|
@@ -504,4 +526,4 @@ interface FilterStateApi<Row> {
|
|
|
504
526
|
*/
|
|
505
527
|
declare function useFilterState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): FilterStateApi<Row>;
|
|
506
528
|
|
|
507
|
-
export { type CellSelectEvent, type CellSelectionChangeEvent, type ColumnDefinition, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnsSelectEvent, type DataColumn, DataGrid, type DataGridApi, type DataGridProps, type FilterStateApi, type GroupByStateApi, type InfiniteScrollConfig, type PagerConfig, type PagerTemplateContext, type PaginationStateApi, type ReactRenderSlots, type ResolvedColumn, type SelectedCell, type SelectedColumn, type SelectionStateApi, useAggregateState, useColumnOrderState, useColumnSizingState, useColumnSortState, useColumnVisibilityState, useFilterState, useGroupByState, usePaginationState, useSelectionState };
|
|
529
|
+
export { type CellSelectEvent, type CellSelectionChangeEvent, type ColumnDefinition, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnsSelectEvent, type DataColumn, DataGrid, type DataGridApi, type DataGridProps, type FilterStateApi, type GroupByStateApi, type InfiniteScrollConfig, type PagerConfig, type PagerTemplateContext, type PaginationStateApi, type ReactRenderSlots, type ResolvedColumn, type SelectedCell, type SelectedColumn, type SelectionStateApi, useAggregateState, useColumnOrderState, useColumnPinningState, useColumnSizingState, useColumnSortState, useColumnVisibilityState, useFilterState, useGroupByState, usePaginationState, useSelectionState };
|