@gridkitjs/react 0.0.0-dev-20261112192401 → 0.0.0-dev-20261112193732
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 +12 -14
- package/dist/index.js +2 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -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, ColumnSortState, FilterState, GroupByState, GroupExpansionState, AggregateResults, SelectionState, CellSelectionState, GridFocus, 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, GridFocus, 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';
|
|
5
5
|
|
|
6
6
|
/** What `DataGridApi` carries for exporting. */
|
|
7
7
|
interface GridExportApi {
|
|
@@ -145,13 +145,10 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
145
145
|
getColumnSelection(): SelectionState;
|
|
146
146
|
getCellSelection(): CellSelectionState;
|
|
147
147
|
/**
|
|
148
|
-
* The cell currently holding the grid's single tab stop,
|
|
149
|
-
* `focusCell` takes
|
|
148
|
+
* The cell currently holding the grid's single tab stop, in the shape
|
|
149
|
+
* `focusCell` takes. Returns the same object until the focus moves.
|
|
150
150
|
*/
|
|
151
|
-
getFocusedCell():
|
|
152
|
-
rowIndex: number;
|
|
153
|
-
columnIndex: number;
|
|
154
|
-
};
|
|
151
|
+
getFocusedCell(): GridFocus;
|
|
155
152
|
/**
|
|
156
153
|
* Every slice of state as the grid applies it, in one object — what
|
|
157
154
|
* `restoreState` takes back. Pass it through `serializeGridState` before
|
|
@@ -162,16 +159,17 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
162
159
|
* Puts back state saved earlier, whole or in part — from `getState()`, or
|
|
163
160
|
* from `serializeGridState` and back through JSON. Each slice given is set
|
|
164
161
|
* as its setter would set it, firing its callback when it changes; the
|
|
165
|
-
* grid re-renders once.
|
|
162
|
+
* grid re-renders once. Saved state is read by its `version`; one without
|
|
163
|
+
* a version, saved by an earlier release, still restores, and one newer
|
|
164
|
+
* than this release reads throws.
|
|
166
165
|
*/
|
|
167
166
|
restoreState(saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>): void;
|
|
168
167
|
/**
|
|
169
|
-
* Moves the grid's tab stop, and the browser's focus, to
|
|
170
|
-
* `
|
|
171
|
-
* `
|
|
172
|
-
* the grid.
|
|
168
|
+
* Moves the grid's tab stop, and the browser's focus, to a cell:
|
|
169
|
+
* `{ area: "body", rowIndex, columnIndex }` or
|
|
170
|
+
* `{ area: "header", columnIndex }`. Either index is held inside the grid.
|
|
173
171
|
*/
|
|
174
|
-
focusCell(
|
|
172
|
+
focusCell(focus: GridFocus): void;
|
|
175
173
|
clearSelection(): void;
|
|
176
174
|
selectAllRows(): void;
|
|
177
175
|
/**
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
useState as useState18
|
|
11
11
|
} from "react";
|
|
12
12
|
import {
|
|
13
|
-
bodyFocus as bodyFocus3,
|
|
14
13
|
headerFocus as headerFocus3,
|
|
15
14
|
moveColumnBefore,
|
|
16
15
|
resolveColumnHeaderText as resolveColumnHeaderText2,
|
|
@@ -4554,19 +4553,6 @@ function selectedRowsReader(controller) {
|
|
|
4554
4553
|
return last.selected;
|
|
4555
4554
|
};
|
|
4556
4555
|
}
|
|
4557
|
-
function focusAt(rowIndex, columnIndex) {
|
|
4558
|
-
return rowIndex < 0 ? headerFocus3(columnIndex) : bodyFocus3(rowIndex, columnIndex);
|
|
4559
|
-
}
|
|
4560
|
-
function focusedCellReader() {
|
|
4561
|
-
let last;
|
|
4562
|
-
return (focus) => {
|
|
4563
|
-
if (last?.focus !== focus) {
|
|
4564
|
-
const rowIndex = focus.area === "header" ? -1 : focus.rowIndex;
|
|
4565
|
-
last = { focus, cell: { rowIndex, columnIndex: focus.columnIndex } };
|
|
4566
|
-
}
|
|
4567
|
-
return last.cell;
|
|
4568
|
-
};
|
|
4569
|
-
}
|
|
4570
4556
|
function DataGrid(props) {
|
|
4571
4557
|
const {
|
|
4572
4558
|
borders,
|
|
@@ -4626,7 +4612,6 @@ function DataGrid(props) {
|
|
|
4626
4612
|
});
|
|
4627
4613
|
const [readPagination] = useState18(() => paginationReader(controller));
|
|
4628
4614
|
const [readSelectedRows] = useState18(() => selectedRowsReader(controller));
|
|
4629
|
-
const [readFocusedCell] = useState18(focusedCellReader);
|
|
4630
4615
|
const virtualizer = useRowVirtualizer({
|
|
4631
4616
|
enabled: virtualized,
|
|
4632
4617
|
rows: view.pageRows,
|
|
@@ -4819,12 +4804,10 @@ function DataGrid(props) {
|
|
|
4819
4804
|
getSelectedRows: readSelectedRows,
|
|
4820
4805
|
getColumnSelection: () => controller.getState().columnSelection,
|
|
4821
4806
|
getCellSelection: () => controller.getState().cellSelection,
|
|
4822
|
-
getFocusedCell: () =>
|
|
4807
|
+
getFocusedCell: () => nav.focus,
|
|
4823
4808
|
getState: controller.getState,
|
|
4824
4809
|
restoreState: controller.restoreState,
|
|
4825
|
-
focusCell:
|
|
4826
|
-
nav.focusCell(focusAt(rowIndex, columnIndex));
|
|
4827
|
-
},
|
|
4810
|
+
focusCell: nav.focusCell,
|
|
4828
4811
|
clearSelection: controller.clearSelection,
|
|
4829
4812
|
selectAllRows: controller.selectAllRows,
|
|
4830
4813
|
selectRows: controller.selectRows,
|