@gridkitjs/react 0.0.0-dev-20261109130950 → 0.0.0-dev-20261109131620

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
@@ -174,7 +174,7 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
174
174
  selectRows(rowIds: readonly string[], intent?: "replace" | "toggle"): void;
175
175
  /** Expands every group at once, as the `group.expandAll` command does. */
176
176
  expandAllGroups(): void;
177
- /** 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. */
177
+ /** Collapses every group at once, as the `group.collapseAll` command does — one nested under a collapsed group, and one that appears later, too. */
178
178
  collapseAllGroups(): void;
179
179
  /** Moves to the given page, clamped into range. */
180
180
  goToPage(pageIndex: number): void;
@@ -210,7 +210,7 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
210
210
  setColumnSort(sort: ColumnSortState): void;
211
211
  /** Replaces the group-by stack. Reports through `onGroupByChange`. */
212
212
  setGroupBy(groupBy: GroupByState): void;
213
- /** Replaces the collapsed groups. Reports through `onGroupExpansionChange` with `groupId: null`. */
213
+ /** Replaces the group expansion. Reports through `onGroupExpansionChange` with `groupId: null`, and nothing for an equal expansion. */
214
214
  setGroupExpansion(expansion: GroupExpansionState): void;
215
215
  /** Replaces the page and page size as given. Reports through `onPaginationChange`. */
216
216
  setPagination(pagination: PaginationState): void;
@@ -397,14 +397,14 @@ interface GroupByStateApi {
397
397
  * outside the grid's own DOM.
398
398
  *
399
399
  * The ref's `setGroupBy` and `setGroupExpansion` change the grouping and the
400
- * collapsed groups for a custom group-by UI; this hook carries only the
400
+ * group expansion for a custom group-by UI; this hook carries only the
401
401
  * all-at-once expansion actions. A specific
402
402
  * group's own computed aggregates are read off `getDisplayRows()`'s
403
403
  * per-header `aggregates` field instead of a getter here — see
404
404
  * `useAggregateState` for the grand-total equivalent.
405
405
  *
406
- * Before the grid mounts, both fields read as empty and the actions are
407
- * no-ops.
406
+ * Before the grid mounts, `groupBy` reads as empty, `groupExpansion` as
407
+ * `ALL_EXPANDED`, and the actions are no-ops.
408
408
  */
409
409
  declare function useGroupByState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): GroupByStateApi;
410
410
 
package/dist/index.js CHANGED
@@ -1533,7 +1533,8 @@ function GroupByBar({
1533
1533
 
1534
1534
  // src/DataGrid/announcedCallbacks.ts
1535
1535
  import {
1536
- isColumnVisible
1536
+ isColumnVisible,
1537
+ isGroupExpanded
1537
1538
  } from "@gridkitjs/core";
1538
1539
  function announcedCallbacks({
1539
1540
  callbacks,
@@ -1624,20 +1625,21 @@ function announcedCallbacks({
1624
1625
  );
1625
1626
  },
1626
1627
  /**
1627
- * `groupId: null` marks `expandAll`/`collapseAll`, which touch every
1628
- * group in one call rather than one at a time — announced as a single
1629
- * summary instead of naming a group that doesn't apply.
1628
+ * `groupId: null` marks `expandAll`/`collapseAll` and
1629
+ * `setGroupExpansion`, which touch every group in one call rather than
1630
+ * one at a time — announced as a single summary of the mode the groups
1631
+ * now follow, instead of naming a group that doesn't apply.
1630
1632
  */
1631
1633
  onGroupExpansionChange: (event) => {
1632
1634
  callbacks.onGroupExpansionChange?.(event);
1633
1635
  if (event.groupId === null) {
1634
1636
  announce(
1635
- event.expansion.length === 0 ? messages.allGroupsExpanded : messages.allGroupsCollapsed
1637
+ event.expansion.mode === "allExpanded" ? messages.allGroupsExpanded : messages.allGroupsCollapsed
1636
1638
  );
1637
1639
  return;
1638
1640
  }
1639
1641
  announce(
1640
- event.expansion.includes(event.groupId) ? messages.groupCollapsed : messages.groupExpanded
1642
+ isGroupExpanded(event.expansion, event.groupId) ? messages.groupExpanded : messages.groupCollapsed
1641
1643
  );
1642
1644
  },
1643
1645
  onPaginationChange: (event) => {
@@ -5122,8 +5124,11 @@ function usePaginationState(gridRef) {
5122
5124
 
5123
5125
  // src/DataGrid/hooks/useGroupByState.ts
5124
5126
  import { useCallback as useCallback6 } from "react";
5127
+ import {
5128
+ ALL_EXPANDED
5129
+ } from "@gridkitjs/core";
5125
5130
  var FALLBACK_GROUP_BY = [];
5126
- var FALLBACK_EXPANSION = [];
5131
+ var FALLBACK_EXPANSION = ALL_EXPANDED;
5127
5132
  function useGroupByState(gridRef) {
5128
5133
  const groupBy = useGridSnapshot(
5129
5134
  gridRef,