@gridkitjs/react 0.6.0 → 0.7.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 +63 -4
- package/dist/index.js +670 -86
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, Ref } from 'react';
|
|
3
|
-
import { RowSelectEvent, RowsSelectEvent, RowSelectionChangeEvent, CellSelectEvent as CellSelectEvent$1, CellSelectionChangeEvent as CellSelectionChangeEvent$1, ColumnDefinition as ColumnDefinition$1, ColumnSelectEvent as ColumnSelectEvent$1, ColumnSelectionChangeEvent as ColumnSelectionChangeEvent$1, ColumnsSelectEvent as ColumnsSelectEvent$1, ResolvedRow, ResolvedColumn as ResolvedColumn$1, ColumnSizingState, ColumnOrderState, ColumnSortState, SelectionState, CellSelectionState, SelectableConfig, ColumnSizeDefaults, ColumnResizeEvent, ColumnOrderEvent, ColumnSortEvent, FilterState, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
3
|
+
import { RowSelectEvent, RowsSelectEvent, RowSelectionChangeEvent, CellSelectEvent as CellSelectEvent$1, CellSelectionChangeEvent as CellSelectionChangeEvent$1, ColumnDefinition as ColumnDefinition$1, ColumnSelectEvent as ColumnSelectEvent$1, ColumnSelectionChangeEvent as ColumnSelectionChangeEvent$1, ColumnsSelectEvent as ColumnsSelectEvent$1, ResolvedRow, DisplayRow, ResolvedColumn as ResolvedColumn$1, ColumnSizingState, ColumnOrderState, ColumnSortState, GroupByState, GroupExpansionState, SelectionState, CellSelectionState, SelectableConfig, ColumnSizeDefaults, ColumnResizeEvent, ColumnOrderEvent, ColumnSortEvent, GroupByEvent, GroupExpansionEvent, FilterState, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
4
|
export { CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ResolvedRow, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState } from '@gridkitjs/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -66,13 +66,21 @@ interface DataGridApi<Row> {
|
|
|
66
66
|
readonly element: HTMLDivElement | null;
|
|
67
67
|
/** The grid's `<table>` element. */
|
|
68
68
|
readonly table: HTMLTableElement | null;
|
|
69
|
-
/** Rows as currently filtered and sorted — what's rendered. */
|
|
69
|
+
/** Rows as currently filtered and sorted — what's rendered, ungrouped. */
|
|
70
70
|
getRows(): readonly ResolvedRow<Row>[];
|
|
71
|
+
/**
|
|
72
|
+
* `getRows()` regrouped into the active `groupBy` — group headers
|
|
73
|
+
* interleaved with data rows, in render order. Identical to `getRows()`
|
|
74
|
+
* when `groupBy` is empty.
|
|
75
|
+
*/
|
|
76
|
+
getDisplayRows(): readonly DisplayRow<Row>[];
|
|
71
77
|
/** Columns as currently sized and ordered — what's rendered. */
|
|
72
78
|
getColumns(): readonly ResolvedColumn<Row>[];
|
|
73
79
|
getColumnSizing(): ColumnSizingState;
|
|
74
80
|
getColumnOrder(): ColumnOrderState;
|
|
75
81
|
getColumnSort(): ColumnSortState;
|
|
82
|
+
getGroupBy(): GroupByState;
|
|
83
|
+
getGroupExpansion(): GroupExpansionState;
|
|
76
84
|
getRowSelection(): SelectionState;
|
|
77
85
|
getColumnSelection(): SelectionState;
|
|
78
86
|
getCellSelection(): CellSelectionState;
|
|
@@ -84,6 +92,10 @@ interface DataGridApi<Row> {
|
|
|
84
92
|
focusCell(rowIndex: number, columnIndex: number): void;
|
|
85
93
|
clearSelection(): void;
|
|
86
94
|
selectAllRows(): void;
|
|
95
|
+
/** Expands every group at once — there is no dedicated UI control for it. */
|
|
96
|
+
expandAllGroups(): void;
|
|
97
|
+
/** 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. */
|
|
98
|
+
collapseAllGroups(): void;
|
|
87
99
|
/** Scrolls the row with the given id into view, if it is currently shown. */
|
|
88
100
|
scrollToRow(rowId: string, options?: ScrollIntoViewOptions): void;
|
|
89
101
|
/** Scrolls the column with the given id into view. */
|
|
@@ -99,6 +111,17 @@ type Borders = "horizontal" | "vertical" | "all" | "none";
|
|
|
99
111
|
* nothing else, and the grid scrolls or leaves a gap accordingly.
|
|
100
112
|
*/
|
|
101
113
|
type ResizeMode = "fit" | "fixed";
|
|
114
|
+
/**
|
|
115
|
+
* How the group-by bar's visibility follows the active grouping. `"always"`
|
|
116
|
+
* renders it even with an empty `groupBy` — a fixed drop target and a
|
|
117
|
+
* constant reminder grouping exists. `"never"` never renders it, for a grid
|
|
118
|
+
* driving `groupBy` entirely by its own UI (a header toggle, `Alt+ArrowDown`)
|
|
119
|
+
* or programmatically. `"auto"` renders it once `groupBy` is non-empty, or
|
|
120
|
+
* while a header drag eligible to drop into it is in progress — so there is
|
|
121
|
+
* always somewhere to drop the very first column, even from a fully empty
|
|
122
|
+
* grouping.
|
|
123
|
+
*/
|
|
124
|
+
type GroupByBarVisibility = "always" | "auto" | "never";
|
|
102
125
|
interface HoverableConfig {
|
|
103
126
|
rows?: boolean;
|
|
104
127
|
columns?: boolean;
|
|
@@ -187,6 +210,42 @@ interface DataGridProps<Row> extends SelectionCallbacks<Row> {
|
|
|
187
210
|
* clear back to "none".
|
|
188
211
|
*/
|
|
189
212
|
onColumnSortChange?: ((event: ColumnSortEvent) => void) | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Whether columns can be grouped by — a header's click/`Alt+ArrowDown`
|
|
215
|
+
* toggle — unless a column says otherwise. The grouping itself still
|
|
216
|
+
* applies when this is off, via `defaultGroupBy` or the imperative API;
|
|
217
|
+
* this only gates that one interaction, the same way `sortableColumns`
|
|
218
|
+
* gates the sort toggle without disabling `defaultColumnSort`. Independent
|
|
219
|
+
* of `groupByBarVisibility` and `groupByDraggableColumns`, which gate the
|
|
220
|
+
* bar and the drag-in gesture respectively.
|
|
221
|
+
*/
|
|
222
|
+
groupableColumns?: boolean | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Whether a groupable header shows its group-toggle icon, unless a column
|
|
225
|
+
* says otherwise. Purely a rendering choice: `Alt+ArrowDown` keeps working
|
|
226
|
+
* on a groupable header with the icon hidden.
|
|
227
|
+
*/
|
|
228
|
+
groupToggleIconColumns?: boolean | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Whether a column's header may be dragged into the group-by bar to add
|
|
231
|
+
* it to the grouping, unless a column says otherwise. Independent of
|
|
232
|
+
* `groupableColumns`: a column can be groupable via its header's
|
|
233
|
+
* click/keyboard toggle, via this drag, both, or neither.
|
|
234
|
+
*/
|
|
235
|
+
groupByDraggableColumns?: boolean | undefined;
|
|
236
|
+
/** How the group-by bar's visibility follows the active grouping. */
|
|
237
|
+
groupByBarVisibility?: GroupByBarVisibility | undefined;
|
|
238
|
+
/** The group-by stack to start with, outer to inner. Uncontrolled. */
|
|
239
|
+
defaultGroupBy?: GroupByState | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* Called once when the user changes the group-by stack — adding, removing,
|
|
242
|
+
* or reordering a level.
|
|
243
|
+
*/
|
|
244
|
+
onGroupByChange?: ((event: GroupByEvent) => void) | undefined;
|
|
245
|
+
/** Group keys collapsed to start with — every other group starts expanded. Uncontrolled. */
|
|
246
|
+
defaultGroupExpansion?: GroupExpansionState | undefined;
|
|
247
|
+
/** Called once when the user expands or collapses a group, or every group at once. */
|
|
248
|
+
onGroupExpansionChange?: ((event: GroupExpansionEvent) => void) | undefined;
|
|
190
249
|
/** The filter to start with — every applied entry, ANDed together. Uncontrolled. */
|
|
191
250
|
defaultFilter?: FilterState<Row> | undefined;
|
|
192
251
|
/**
|
|
@@ -202,6 +261,6 @@ interface DataGridProps<Row> extends SelectionCallbacks<Row> {
|
|
|
202
261
|
/** Imperative handle for reading live grid state and triggering actions. */
|
|
203
262
|
ref?: Ref<DataGridApi<Row>> | undefined;
|
|
204
263
|
}
|
|
205
|
-
declare function DataGridComponent<Row>({ dataSource, columns, getRowId, borders, hoverable, selectable, defaultRowSelection, defaultColumnSelection, defaultCellSelection, resizableColumns, reorderableColumns, resizeMode, defaultColumnSizing, defaultColumnOrder, columnSizeDefaults, onColumnResize, onColumnOrderChange, sortableColumns, defaultColumnSort, onColumnSortChange, defaultFilter, label, labelledBy, ref, ...callbacks }: DataGridProps<Row>): react.JSX.Element;
|
|
264
|
+
declare function DataGridComponent<Row>({ dataSource, columns, getRowId, borders, hoverable, selectable, defaultRowSelection, defaultColumnSelection, defaultCellSelection, resizableColumns, reorderableColumns, resizeMode, defaultColumnSizing, defaultColumnOrder, columnSizeDefaults, onColumnResize, onColumnOrderChange, sortableColumns, defaultColumnSort, onColumnSortChange, groupableColumns, groupToggleIconColumns, groupByDraggableColumns, groupByBarVisibility, defaultGroupBy, onGroupByChange, defaultGroupExpansion, onGroupExpansionChange, defaultFilter, label, labelledBy, ref, ...callbacks }: DataGridProps<Row>): react.JSX.Element;
|
|
206
265
|
|
|
207
|
-
export { type Borders, type CellSelectEvent, type CellSelectionChangeEvent, type ColumnDefinition, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnsSelectEvent, type DataGridApi, DataGridComponent, type DataGridProps, type HoverableConfig, type ResizeMode, type ResolvedColumn, type SelectedCell, type SelectedColumn };
|
|
266
|
+
export { type Borders, type CellSelectEvent, type CellSelectionChangeEvent, type ColumnDefinition, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnsSelectEvent, type DataGridApi, DataGridComponent, type DataGridProps, type GroupByBarVisibility, type HoverableConfig, type ResizeMode, type ResolvedColumn, type SelectedCell, type SelectedColumn };
|