@gridkitjs/react 0.0.0-dev-20261112192401 → 0.0.0-dev-20261112193051

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 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, numbered as
149
- * `focusCell` takes it: `rowIndex` is `-1` on the header.
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
@@ -166,12 +163,11 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
166
163
  */
167
164
  restoreState(saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>): void;
168
165
  /**
169
- * Moves the grid's tab stop, and the browser's focus, to body row
170
- * `rowIndex`'s cell at `columnIndex`, or to the header's cell at
171
- * `columnIndex` when `rowIndex` is negative. Either index is held inside
172
- * the grid.
166
+ * Moves the grid's tab stop, and the browser's focus, to a cell:
167
+ * `{ area: "body", rowIndex, columnIndex }` or
168
+ * `{ area: "header", columnIndex }`. Either index is held inside the grid.
173
169
  */
174
- focusCell(rowIndex: number, columnIndex: number): void;
170
+ focusCell(focus: GridFocus): void;
175
171
  clearSelection(): void;
176
172
  selectAllRows(): void;
177
173
  /**
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: () => readFocusedCell(nav.focus),
4807
+ getFocusedCell: () => nav.focus,
4823
4808
  getState: controller.getState,
4824
4809
  restoreState: controller.restoreState,
4825
- focusCell: (rowIndex, columnIndex) => {
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,