UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

36 lines (35 loc) • 1.71 kB
/** * DevExtreme (esm/__internal/grids/data_grid/grouping/utils.js) * Version: 26.1.6 * Build date: Fri Oct 16 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { isDefined, isString } from "../../../../core/utils/type"; export function isGroupNode(item) { return "items" in item } export function isGroupRow(item) { return isDefined(item.groupIndex) && isString(item.rowType) && item.rowType.startsWith("group") } export function isSameExpandedState(item1, item2) { return item1.isExpanded === item2.isExpanded } export function isSameContinuationState(item1, item2) { var _item1$data, _item2$data, _item1$data2, _item2$data2; return (null === (_item1$data = item1.data) || void 0 === _item1$data ? void 0 : _item1$data.isContinuation) === (null === (_item2$data = item2.data) || void 0 === _item2$data ? void 0 : _item2$data.isContinuation) && (null === (_item1$data2 = item1.data) || void 0 === _item1$data2 ? void 0 : _item1$data2.isContinuationOnNextPage) === (null === (_item2$data2 = item2.data) || void 0 === _item2$data2 ? void 0 : _item2$data2.isContinuationOnNextPage) } export function getGroupColumnIndices(oldItem, newItem) { const isSameState = isSameExpandedState(oldItem, newItem) && isSameContinuationState(oldItem, newItem); if (!oldItem.cells || !isSameState) { return } return oldItem.cells.map((cell, index) => { var _cell$column; return "groupExpand" !== (null === (_cell$column = cell.column) || void 0 === _cell$column ? void 0 : _cell$column.type) ? index : -1 }).filter(index => index >= 0) }