@progress/kendo-react-treelist
Version:
React TreeList enables the display of self-referencing tabular data. KendoReact TreeList package
58 lines (57 loc) • 1.78 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 t from "react";
import { useId as m, classNames as o, getNestedValue as s } from "@progress/kendo-react-common";
import { useTableKeyboardNavigation as r } from "@progress/kendo-react-data-tools";
import { TREELIST_COL_INDEX_ATTRIBUTE as h } from "../../constants/index.mjs";
const k = (e) => {
const c = t.useCallback(
(d) => {
e.onChange && e.onChange({
dataItem: e.dataItem,
level: e.level,
field: e.field,
syntheticEvent: d,
value: d.target.checked
});
},
[e.onChange, e.dataItem, e.level, e.field]
), a = m(), n = r(e.id), i = o(
{
"k-selected": e.isSelected
},
e.className
), l = /* @__PURE__ */ t.createElement(
"td",
{
style: e.style,
className: i,
"aria-colindex": e.ariaColumnIndex,
"aria-selected": e.isSelected,
role: "gridcell",
...n,
[h]: e.colIndex
},
/* @__PURE__ */ t.createElement(
"input",
{
checked: s(e.field, e.dataItem) || !1,
id: a,
type: "checkbox",
className: "k-checkbox k-checkbox-md k-rounded-md",
onChange: c
}
),
/* @__PURE__ */ t.createElement("label", { className: "k-checkbox-label", htmlFor: a })
);
return e.render ? e.render.call(void 0, l, e) : l;
};
k.displayName = "KendoReactTreeListBooleanEditor";
export {
k as TreeListBooleanEditor
};