@gridkitjs/react v0.7.0
Minor Changes#
-
388def3: Drag a column header into the group-by bar to add it to the grouping, and drag chips within the bar to reorder the stack.
<DataGridComponent columns={columns} dataSource={rows} groupableColumns groupByDraggableColumns groupByBarVisibility="always" />;groupByDraggableColumns(grid-level) /ColumnDefinition.groupByDraggable(per-column) let a header be dragged straight into the group-by bar, independent ofgroupableColumns— a column can be groupable via its header's click/keyboard toggle, via this drag, both, or neither. Dropped at a specific point among the bar's existing chips, it's inserted there, not appended. A column already in the group-by stack rejects its own header dragged back toward the bar — anot-allowedcursor and a muted outline in place of the usual accent one — since repositioning an existing level is the chip's job, not the header's.- Chips in the group-by bar are now draggable to reorder the stack, and each
chip is its own focusable stop — focus one and press
Ctrl+ArrowLeft/Ctrl+ArrowRightto move it, mirroring a column header's own reorder shortcut. groupToggleIconColumns(grid-level) /ColumnDefinition.groupToggleIcon(per-column) hide a groupable header's group-toggle icon without touching its capability —Alt+ArrowDownkeeps working with the icon hidden.groupByBarVisibility("always" | "auto" | "never", default"auto") controls when the group-by bar renders, decoupled fromgroupableColumns."auto"shows it oncegroupByis non-empty, or while a header drag eligible to drop into it is in progress, so there's a drop target even from a fully empty grouping.
Breaking: the group-by bar's visibility no longer follows
groupableColumns— it's governed by the newgroupByBarVisibilityalone. A grid grouping purely programmatically (defaultGroupBywithgroupableColumnsoff) previously showed no bar; under the new"auto"default it now does oncegroupByis non-empty. PassgroupByBarVisibility="never"to keep the previous behavior.Internally,
useColumnDrag's pointer-drag mechanics are extracted into a new, reusableuseDragReorderhook shared with the group-by bar's own chip dragging — no change to any existing public API. -
388def3: Row grouping: stack one or more columns into nested, collapsible groups.
<DataGridComponent columns={columns} dataSource={rows} groupableColumns defaultGroupBy={[{ columnId: "Region" }, { columnId: "Status" }]} onGroupByChange={({ groupBy }) => persist(groupBy)} />;groupableColumns(grid-level) /ColumnDefinition.groupable(per-column) turn on each header's group toggle — click its icon, or focus the header and pressAlt+ArrowDown, to add or remove that column from the group-by stack. A group-by bar above the grid lists the active stack as removable chips.defaultGroupBy/onGroupByChangeanddefaultGroupExpansion/onGroupExpansionChangefor the uncontrolled group-by stack and its collapsed/expanded state. Click a group header, or focus it and pressSpace/Enter, to toggle it.DataGridApigainsgetGroupBy(),getGroupExpansion(),getDisplayRows()(getRows()'s data regrouped, with group headers interleaved), andexpandAllGroups()/collapseAllGroups().getRows()itself is unchanged — it still returns the flat, ungrouped rows, exactly as before.- The grid's
roleswitches from"grid"to the WAI-ARIA"treegrid"pattern whenevergroupByis non-empty, witharia-expanded/aria-level/aria-posinset/aria-setsizeon each group header row. An ungrouped grid is unaffected —role="grid"stays exactly as it was.
Depends on
@gridkitjs/core's new grouping primitives (groupRowsand friends) — see that package's own changelog entry.
Patch Changes#
- Updated dependencies [388def3]
- Updated dependencies [388def3]
- @gridkitjs/core@0.8.0