@progress/kendo-react-scheduler
Version:
React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package
85 lines (84 loc) • 4.45 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 r from "react";
import { toGroupResources as p } from "./utils.mjs";
import { SchedulerResourceIteratorContext as m } from "../../context/SchedulerResourceIteratorContext.mjs";
const g = (s) => {
const { nested: t, wrapGroup: e, children: n } = s, a = s.cellContent || R, c = p(s.group, s.resources), l = 0, o = 0;
return /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-group" }, t ? e ? /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-row" }, /* @__PURE__ */ r.createElement("div", { className: "k-sticky-cell" }, h({ resources: c, children: n, cellContent: a, depth: l, groupIndex: o })), /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-cell k-group-content" }, i({ resources: c, children: n, cellContent: a, depth: l, groupIndex: o }, !1))) : i({ resources: c, children: n, cellContent: a, depth: l, groupIndex: o }, !0) : e ? /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-row" }, /* @__PURE__ */ r.createElement("div", { className: "k-sticky-cell" }, v({ resources: c, children: n, cellContent: a, depth: l, groupIndex: o })), /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-cell k-group-content" }, n)) : E({ resources: c, children: n, cellContent: a, depth: l, groupIndex: o }));
}, v = (s) => /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-row" }, /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-row" }, s.resources.map((t, e) => /* @__PURE__ */ r.createElement(
"div",
{
key: e,
className: "k-scheduler-cell k-resource-cell k-heading-cell",
"data-depth-index": e
}
)))), i = (s, t = !0) => {
const { resources: e, children: n, cellContent: a, groupIndex: c, depth: l } = s, o = e.length > 0;
if (l === e.length || !o)
return /* @__PURE__ */ r.createElement(
m.Provider,
{
value: { resource: e[l], groupIndex: o ? c : 0 }
},
n
);
const d = e[l].data.length;
return e[l].data.map((k, u) => /* @__PURE__ */ r.createElement("div", { key: u, className: "k-scheduler-row" }, t && /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-cell k-group-cell k-heading-cell", "data-depth-index": l }, k[e[l].textField]), /* @__PURE__ */ r.createElement(
"div",
{
className: "k-scheduler-cell k-group-content k-resource-row",
"data-depth-index": l,
"data-resource-index": d * c + u
},
i(
{
resources: e,
children: n,
cellContent: a,
groupIndex: d * c + u,
depth: l + 1
},
t
)
)));
}, h = (s) => {
const { resources: t, children: e, cellContent: n, groupIndex: a, depth: c } = s, l = t.length ? t[c].data.length : 0;
return t[c] ? t[c].data.map((o, d) => /* @__PURE__ */ r.createElement("div", { key: d, className: "k-scheduler-row" }, /* @__PURE__ */ r.createElement(
"div",
{
className: "k-scheduler-cell k-resource-cell k-resource-row k-heading-cell",
"data-depth-index": c,
"data-resource-index": l * a + d
},
o[t[c].textField]
), c + 1 !== t.length && /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-cell k-resource-content" }, h({
resources: t,
children: e,
cellContent: n,
groupIndex: l * a + d,
depth: c + 1
})))) : null;
}, E = (s) => {
const { resources: t, children: e, groupIndex: n, cellContent: a } = s;
return /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-row" }, x(t), a, N(e, t, n));
}, N = (s, t, e) => {
const n = t.length > 0;
return /* @__PURE__ */ r.createElement("div", { className: "k-scheduler-cell k-group-content" }, /* @__PURE__ */ r.createElement(
m.Provider,
{
value: { resource: t[e], groupIndex: n ? e : void 0 }
},
s
));
}, x = (s) => s.map((t, e) => /* @__PURE__ */ r.createElement("div", { key: e, className: "k-scheduler-cell k-group-cell k-heading-cell", "data-depth-index": e }));
g.displayName = "KendoReactSchedulerVerticalResourceIterator";
const R = null;
export {
g as VerticalResourceIterator
};