@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
66 lines (65 loc) • 2.88 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as a from "react";
import { getSelectionOptions as o, getEditableOptions as i } from "@progress/kendo-react-data-tools";
import { normalizeSortable as s } from "../sortCommon.mjs";
import { normalize as d } from "../paging/GridPagerSettings.mjs";
const u = (e) => ({
lockedColumn: e.some((r) => r.locked)
}), m = (e) => ({
multiColumn: e.some((r) => r.children && r.children.length > 0)
}), c = (e) => ({
columnCellTemplate: e.some((r) => r.columnType !== "data" ? !1 : r.cells)
}), b = (e) => ({
columnMenu: e.some((r) => r.columnMenu)
}), y = (e) => a.Children.toArray(e.children).some((t) => t && t.type && t.type.displayName === "KendoReactGridColumn" ? t.props.hidden : !1), h = (e) => a.Children.toArray(e.children).some((t) => t && t.type && t.type.displayName === "KendoReactGridToolbar" && t.props && t.props.children ? a.Children.toArray(t.props.children).some((l) => l.type && (l.type.displayName === "KendoReactGridToolbarSort" || l.type.displayName === "KendoReactGridToolbarFilter" || l.type.displayName === "KendoReactGridToolbarCheckboxFilter" || l.type.displayName === "KendoReactGridToolbarColumnsChooser" || l.type.displayName === "KendoReactGridToolbarGroup" || l.type.displayName === "KendoReactGridToolbarAIAssistant")) : !1), g = (e) => {
const r = o(e.selectable), t = i(e.editable), n = e.sortable && s(e.sortable), l = e.pageable && d(e.pageable);
return {
cells: !!e.cells,
pdf: !!e.pdf,
detail: !!e.detail,
rows: !!e.rows,
highlight: !!e.highlight,
editableInline: t.mode === "inline",
selectionMultiple: r.enabled && r.mode === "multiple",
selectionDrag: r.enabled && r.drag,
columnMenu: !!e.columnMenu,
filterOperators: !!e.filterOperators,
groupable: !!e.groupable,
group: !!e.group,
groupExpand: !!e.groupExpand,
customPager: !!e.pager,
clipboard: !!e.clipboard,
contextMenu: !!e.contextMenu,
serverGrid: !e.isClient,
scrollableVirtual: e.scrollable === "virtual",
pageableInput: !!(e.pageable && l.type === "input"),
sortableMultiple: !!(e.sortable && n.mode === "multiple"),
hiddenColumns: y(e)
};
}, C = (e) => ({
...u(e),
...m(e),
...c(e),
...b(e)
}), p = (e) => ({
toolbarTools: h(e)
}), T = (e, r) => {
const t = {
...g(e),
...C(r),
...p(e)
};
return Object.keys(t).filter((n) => t[n] === !0);
};
export {
T as gridPremiumFeatures,
C as isPremiumGridByColumns,
p as isPremiumGridByComponents,
g as isPremiumGridByProps
};