@progress/kendo-react-chart-wizard
Version:
React Chart Wizard lets you create a chart using data from a Grid, another data-bound component, or an external source
104 lines (103 loc) • 3.01 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 { Button as d } from "@progress/kendo-react-buttons";
import { trashIcon as c, reorderIcon as i } from "@progress/kendo-svg-icons";
import { IconWrap as s } from "@progress/kendo-react-common";
const m = t.createContext({
onRemove: (e) => {
},
count: 0
}), f = (e) => {
const { onRemove: r, count: a } = t.useContext(m), n = () => {
r.call(void 0, e.dataItem.id);
};
return /* @__PURE__ */ t.createElement("td", { ...e.tdProps }, /* @__PURE__ */ t.createElement(
d,
{
type: "button",
onClick: n,
icon: "trash",
svgIcon: c,
fillMode: "flat",
disabled: a < 2
}
));
}, u = t.createContext({
reorder: () => {
},
dragStart: () => {
}
}), E = (e) => {
const r = t.useContext(u);
return /* @__PURE__ */ t.createElement(
"td",
{
...e.tdProps,
onDragOver: (a) => {
r.reorder.call(void 0, e.dataItem), a.preventDefault(), a.dataTransfer.dropEffect = "copy";
}
},
/* @__PURE__ */ t.createElement(
"span",
{
draggable: !0,
style: { cursor: "move" },
onDragStart: (a) => {
r.dragStart.call(void 0, e.dataItem), a.dataTransfer.setData("dragging", "");
}
},
/* @__PURE__ */ t.createElement(s, { icon: i, name: "reorder" })
)
);
}, l = t.createContext({
enterEdit: (e, r) => {
},
exitEdit: (e, r) => {
}
}), C = (e) => {
const { enterEdit: r } = t.useContext(l);
return /* @__PURE__ */ t.createElement(
"td",
{
...e.tdProps,
onClick: () => {
r(e.dataItem, e.field);
}
},
e.children
);
}, D = (e) => e.field === "delete" ? /* @__PURE__ */ t.createElement(f, { ...e }) : e.field === "reorder" ? /* @__PURE__ */ t.createElement(E, { ...e }) : e.field === "name" ? /* @__PURE__ */ t.createElement(C, { ...e }) : null, S = (e) => {
const r = t.useRef(null), { exitEdit: a } = t.useContext(l);
return t.useEffect(() => {
var o;
const n = (o = r.current) == null ? void 0 : o.querySelector("input");
n == null || n.focus();
}, []), /* @__PURE__ */ t.createElement(
"td",
{
...e.tdProps,
ref: r,
onBlur: () => {
a(e.dataItem, e.field);
},
onKeyDown: (n) => {
n.key === "Enter" || n.key === "Escape" ? (n.stopPropagation(), a(e.dataItem, e.field)) : n.key === " " && n.stopPropagation();
}
},
e.children
);
}, y = () => null;
export {
m as RemoveSeriesContext,
u as ReorderContext,
D as SeriesDataCell,
S as SeriesDataEditCell,
l as SeriesEditContext,
y as SeriesHeaderCell
};