@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
82 lines (81 loc) • 2.21 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
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as a from "react";
import { GridContext as d } from "../../utils/GridContext.mjs";
import { useId as i, getNestedValue as u } from "@progress/kendo-react-common";
import { TextBox as E, Checkbox as f, NumericTextBox as N } from "@progress/kendo-react-inputs";
import { TABLE_PREVENT_SELECTION_ELEMENT as s } from "@progress/kendo-react-data-tools";
import { DatePicker as h } from "@progress/kendo-react-dateinputs";
const b = (t) => {
const { cellProps: e } = t, n = a.useContext(d), r = i(), l = u(e.field, e.dataItem);
let c = null;
const m = a.useCallback(
(o) => {
n != null && n.itemChange && n.itemChange({
dataItem: e.dataItem,
dataIndex: e.dataIndex,
field: e.field,
syntheticEvent: o.syntheticEvent,
value: o.value
});
},
[n, e.dataItem, e.dataIndex, e.field]
);
switch (e.editor) {
case "numeric":
c = /* @__PURE__ */ a.createElement(
N,
{
className: t.className,
value: l === void 0 ? null : l,
onChange: m,
[s]: !0
}
);
break;
case "date":
c = /* @__PURE__ */ a.createElement(
h,
{
className: t.className,
value: l,
onChange: m,
[s]: !0
}
);
break;
case "boolean":
c = /* @__PURE__ */ a.createElement(
f,
{
className: t.className,
checked: l || !1,
id: r,
onChange: m,
[s]: !0
}
);
break;
default:
c = /* @__PURE__ */ a.createElement(
E,
{
className: t.className,
value: l || "",
onChange: m,
[s]: !0
}
);
break;
}
return c;
};
export {
b as GridEditCellEditor
};