@gridkitjs/react 0.15.0 → 0.17.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 CHANGED
@@ -22,14 +22,15 @@ interface GridExportApi {
22
22
  interface GridPanelApi {
23
23
  /**
24
24
  * Opens the column chooser at the grid's top-end corner, in place of any
25
- * panel open; it gives focus back to what had it when it closes.
25
+ * panel or context menu open; it gives focus back to what had it when it
26
+ * closes.
26
27
  */
27
28
  openColumnChooser(): void;
28
29
  /**
29
30
  * Opens the filter menu of the column `columnId` below its header, in
30
- * place of any panel open, and says whether it opened: not for a column
31
- * with no filter menu, nor one not shown. It gives focus back to the
32
- * header when it closes.
31
+ * place of any panel or context menu open, and says whether it opened:
32
+ * not for a column with no filter menu, nor one not shown. It gives focus
33
+ * back to the header when it closes.
33
34
  */
34
35
  openFilterMenu(columnId: string): boolean;
35
36
  /** Closes the filter menu, if one is open, leaving any other panel open. */
@@ -143,7 +144,10 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
143
144
  getSelectedRows(): readonly ResolvedRow<Row>[];
144
145
  getColumnSelection(): SelectionState;
145
146
  getCellSelection(): CellSelectionState;
146
- /** The cell currently holding the grid's single tab stop. */
147
+ /**
148
+ * The cell currently holding the grid's single tab stop, numbered as
149
+ * `focusCell` takes it: `rowIndex` is `-1` on the header.
150
+ */
147
151
  getFocusedCell(): {
148
152
  rowIndex: number;
149
153
  columnIndex: number;
@@ -161,6 +165,12 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
161
165
  * grid re-renders once.
162
166
  */
163
167
  restoreState(saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>): void;
168
+ /**
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.
173
+ */
164
174
  focusCell(rowIndex: number, columnIndex: number): void;
165
175
  clearSelection(): void;
166
176
  selectAllRows(): void;
@@ -173,7 +183,7 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
173
183
  selectRows(rowIds: readonly string[], intent?: "replace" | "toggle"): void;
174
184
  /** Expands every group at once, as the `group.expandAll` command does. */
175
185
  expandAllGroups(): void;
176
- /** 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. */
186
+ /** Collapses every group at once, as the `group.collapseAll` command does — one nested under a collapsed group, and one that appears later, too. */
177
187
  collapseAllGroups(): void;
178
188
  /** Moves to the given page, clamped into range. */
179
189
  goToPage(pageIndex: number): void;
@@ -209,7 +219,7 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
209
219
  setColumnSort(sort: ColumnSortState): void;
210
220
  /** Replaces the group-by stack. Reports through `onGroupByChange`. */
211
221
  setGroupBy(groupBy: GroupByState): void;
212
- /** Replaces the collapsed groups. Reports through `onGroupExpansionChange` with `groupId: null`. */
222
+ /** Replaces the group expansion. Reports through `onGroupExpansionChange` with `groupId: null`, and nothing for an equal expansion. */
213
223
  setGroupExpansion(expansion: GroupExpansionState): void;
214
224
  /** Replaces the page and page size as given. Reports through `onPaginationChange`. */
215
225
  setPagination(pagination: PaginationState): void;
@@ -239,9 +249,9 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
239
249
  /**
240
250
  * Opens the context menu `target` has, as a right-click there would —
241
251
  * selecting it and focusing its cell first — beside `anchor`, a point in
242
- * viewport coordinates or an element, or else below its cell. Says whether
243
- * it opened: not for a target not on screen, nor where `contextMenu`
244
- * gives no menu.
252
+ * viewport coordinates or an element, or else below its cell, in place of
253
+ * any panel open. Says whether it opened: not for a target not on screen,
254
+ * nor where `contextMenu` gives no menu.
245
255
  */
246
256
  openContextMenu(target: GridContextMenuTarget, anchor?: {
247
257
  readonly x: number;
@@ -314,9 +324,11 @@ interface InfiniteScrollConfig {
314
324
  /** Whether a further `onLoadMore` could still return more rows. `false` removes the sentinel entirely, so no further scrolling can trigger a load. */
315
325
  readonly hasMore: boolean;
316
326
  /**
317
- * Called at most once per genuine threshold-crossing: fires when the
318
- * sentinel comes within `rootMargin` of the body's viewport, and not again
319
- * until `isLoadingMore` has gone back to `false`.
327
+ * Called when the sentinel comes within `rootMargin` of the body's
328
+ * viewport, then not again until one of these says the request was
329
+ * answered: `isLoadingMore` goes back to `false`, `hasMore` changes, the
330
+ * sentinel leaves range and comes back, or rows appended while
331
+ * `isLoadingMore` never read `true` move the sentinel down.
320
332
  */
321
333
  readonly onLoadMore: () => void;
322
334
  /** Whether a load triggered by `onLoadMore` is still in flight. Suppresses further calls to it until this goes back to `false`. */
@@ -394,14 +406,14 @@ interface GroupByStateApi {
394
406
  * outside the grid's own DOM.
395
407
  *
396
408
  * The ref's `setGroupBy` and `setGroupExpansion` change the grouping and the
397
- * collapsed groups for a custom group-by UI; this hook carries only the
409
+ * group expansion for a custom group-by UI; this hook carries only the
398
410
  * all-at-once expansion actions. A specific
399
411
  * group's own computed aggregates are read off `getDisplayRows()`'s
400
412
  * per-header `aggregates` field instead of a getter here — see
401
413
  * `useAggregateState` for the grand-total equivalent.
402
414
  *
403
- * Before the grid mounts, both fields read as empty and the actions are
404
- * no-ops.
415
+ * Before the grid mounts, `groupBy` reads as empty, `groupExpansion` as
416
+ * `ALL_EXPANDED`, and the actions are no-ops.
405
417
  */
406
418
  declare function useGroupByState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): GroupByStateApi;
407
419