@progress/kendo-react-orgchart 6.1.1 → 7.0.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/OrgChart.d.ts +10 -0
- package/{dist/npm/OrgChartOperationDescriptors.d.ts → OrgChartOperationDescriptors.d.ts} +4 -0
- package/{dist/es/client → client}/ClientOrgChart.d.ts +7 -3
- package/client/ExpandButton.d.ts +17 -0
- package/{dist/es/client → client}/OrgChartCard.d.ts +4 -0
- package/client/OrgChartCardBody.d.ts +16 -0
- package/{dist/npm/client → client}/OrgChartGroupContainer.d.ts +4 -0
- package/dist/cdn/js/kendo-react-orgchart.js +18 -1
- package/index.d.ts +12 -0
- package/index.js +18 -0
- package/index.mjs +1148 -0
- package/interfaces/ChildGroup.d.ts +20 -0
- package/{dist/npm/interfaces → interfaces}/OrgChartActionEvent.d.ts +4 -1
- package/{dist/npm/interfaces → interfaces}/OrgChartExpandChangeEvent.d.ts +4 -1
- package/{dist/npm/interfaces → interfaces}/SeverOrgChartProps.d.ts +4 -1
- package/package-metadata.d.ts +9 -0
- package/package.json +29 -38
- package/{dist/es/processOrgChartItems.d.ts → processOrgChartItems.d.ts} +4 -0
- package/server/ServerGroupedOrgChart.d.ts +12 -0
- package/server/ServerOrgChart.d.ts +12 -0
- package/{dist/npm/server → server}/ServerOrgChartGroup.d.ts +4 -0
- package/{dist/npm/server → server}/ServerOrgChartNode.d.ts +5 -1
- package/theming/theme-service.d.ts +9 -0
- package/{dist/es/utils → utils}/consts.d.ts +4 -0
- package/about.md +0 -3
- package/dist/es/OrgChart.d.ts +0 -6
- package/dist/es/OrgChart.js +0 -67
- package/dist/es/OrgChartOperationDescriptors.d.ts +0 -76
- package/dist/es/OrgChartOperationDescriptors.js +0 -2
- package/dist/es/client/ClientOrgChart.js +0 -287
- package/dist/es/client/ExpandButton.d.ts +0 -13
- package/dist/es/client/ExpandButton.js +0 -23
- package/dist/es/client/OrgChartCard.js +0 -68
- package/dist/es/client/OrgChartCardBody.d.ts +0 -12
- package/dist/es/client/OrgChartCardBody.js +0 -13
- package/dist/es/client/OrgChartGroupContainer.d.ts +0 -19
- package/dist/es/client/OrgChartGroupContainer.js +0 -71
- package/dist/es/interfaces/ChildGroup.d.ts +0 -16
- package/dist/es/interfaces/ChildGroup.js +0 -1
- package/dist/es/interfaces/OrgChartActionEvent.d.ts +0 -22
- package/dist/es/interfaces/OrgChartActionEvent.js +0 -1
- package/dist/es/interfaces/OrgChartExpandChangeEvent.d.ts +0 -22
- package/dist/es/interfaces/OrgChartExpandChangeEvent.js +0 -1
- package/dist/es/interfaces/SeverOrgChartProps.d.ts +0 -106
- package/dist/es/interfaces/SeverOrgChartProps.js +0 -1
- package/dist/es/main.d.ts +0 -6
- package/dist/es/main.js +0 -3
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/processOrgChartItems.js +0 -163
- package/dist/es/server/ServerGroupedOrgChart.d.ts +0 -9
- package/dist/es/server/ServerGroupedOrgChart.js +0 -235
- package/dist/es/server/ServerOrgChart.d.ts +0 -9
- package/dist/es/server/ServerOrgChart.js +0 -192
- package/dist/es/server/ServerOrgChartGroup.d.ts +0 -96
- package/dist/es/server/ServerOrgChartGroup.js +0 -59
- package/dist/es/server/ServerOrgChartNode.d.ts +0 -75
- package/dist/es/server/ServerOrgChartNode.js +0 -57
- package/dist/es/theming/theme-service.d.ts +0 -5
- package/dist/es/theming/theme-service.js +0 -62
- package/dist/es/utils/consts.js +0 -72
- package/dist/npm/OrgChart.d.ts +0 -6
- package/dist/npm/OrgChart.js +0 -71
- package/dist/npm/OrgChartOperationDescriptors.js +0 -3
- package/dist/npm/client/ClientOrgChart.d.ts +0 -94
- package/dist/npm/client/ClientOrgChart.js +0 -291
- package/dist/npm/client/ExpandButton.d.ts +0 -13
- package/dist/npm/client/ExpandButton.js +0 -27
- package/dist/npm/client/OrgChartCard.d.ts +0 -19
- package/dist/npm/client/OrgChartCard.js +0 -72
- package/dist/npm/client/OrgChartCardBody.d.ts +0 -12
- package/dist/npm/client/OrgChartCardBody.js +0 -17
- package/dist/npm/client/OrgChartGroupContainer.js +0 -75
- package/dist/npm/interfaces/ChildGroup.d.ts +0 -16
- package/dist/npm/interfaces/ChildGroup.js +0 -2
- package/dist/npm/interfaces/OrgChartActionEvent.js +0 -2
- package/dist/npm/interfaces/OrgChartExpandChangeEvent.js +0 -2
- package/dist/npm/interfaces/SeverOrgChartProps.js +0 -2
- package/dist/npm/main.d.ts +0 -6
- package/dist/npm/main.js +0 -21
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/processOrgChartItems.d.ts +0 -51
- package/dist/npm/processOrgChartItems.js +0 -167
- package/dist/npm/server/ServerGroupedOrgChart.d.ts +0 -9
- package/dist/npm/server/ServerGroupedOrgChart.js +0 -239
- package/dist/npm/server/ServerOrgChart.d.ts +0 -9
- package/dist/npm/server/ServerOrgChart.js +0 -196
- package/dist/npm/server/ServerOrgChartGroup.js +0 -63
- package/dist/npm/server/ServerOrgChartNode.js +0 -61
- package/dist/npm/theming/theme-service.d.ts +0 -5
- package/dist/npm/theming/theme-service.js +0 -65
- package/dist/npm/utils/consts.d.ts +0 -72
- package/dist/npm/utils/consts.js +0 -75
- package/dist/systemjs/kendo-react-orgchart.js +0 -1
package/index.mjs
ADDED
|
@@ -0,0 +1,1148 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as l from "react";
|
|
6
|
+
import { Navigation as ue, classNames as _, kendoThemeMaps as te, guid as je, validatePackage as qe, isArray as ce, resolveItemsIds as Ve, updateItem as Xe, getNestedValue as ve } from "@progress/kendo-react-common";
|
|
7
|
+
import { Card as Ze, CardBody as Je, Avatar as Qe, CardTitle as Ye, CardSubtitle as et } from "@progress/kendo-react-layout";
|
|
8
|
+
import { Button as tt } from "@progress/kendo-react-buttons";
|
|
9
|
+
import { minusIcon as nt, plusIcon as it } from "@progress/kendo-svg-icons";
|
|
10
|
+
import * as h from "prop-types";
|
|
11
|
+
import { groupBy as ot } from "@progress/kendo-data-query";
|
|
12
|
+
const me = (s) => window.getComputedStyle(s).backgroundColor, st = (s) => s.toLowerCase().charCodeAt(0) - "a".charCodeAt(0), rt = (s) => {
|
|
13
|
+
const t = s.match(/series-([a-z])$/);
|
|
14
|
+
if (t !== null)
|
|
15
|
+
return st(t[1]);
|
|
16
|
+
const o = s.split("--series-")[1];
|
|
17
|
+
return parseInt(o, 10) - 1;
|
|
18
|
+
}, at = 30, lt = () => {
|
|
19
|
+
let s = `
|
|
20
|
+
<div class="k-var--series-a"></div>
|
|
21
|
+
<div class="k-var--series-b"></div>
|
|
22
|
+
<div class="k-var--series-c"></div>
|
|
23
|
+
<div class="k-var--series-d"></div>
|
|
24
|
+
<div class="k-var--series-e"></div>
|
|
25
|
+
<div class="k-var--series-f"></div>
|
|
26
|
+
`;
|
|
27
|
+
for (let t = 0; t < at; t++)
|
|
28
|
+
s += `
|
|
29
|
+
<div class="k-var--series-${t + 1}"></div>`;
|
|
30
|
+
return s;
|
|
31
|
+
}, ct = `
|
|
32
|
+
<div class="k-var--series-unset"></div>
|
|
33
|
+
<div class="k-var--series">
|
|
34
|
+
${lt()}
|
|
35
|
+
</div>
|
|
36
|
+
`;
|
|
37
|
+
class dt {
|
|
38
|
+
getSeriesColors() {
|
|
39
|
+
const t = this.element, o = [].slice.call(t.querySelectorAll(".k-var--series div")), i = me(t.querySelector(".k-var--series-unset"));
|
|
40
|
+
return o.reduce(
|
|
41
|
+
(n, r) => {
|
|
42
|
+
const a = rt(r.className), c = me(r);
|
|
43
|
+
return c !== i && (n[a] = c), n;
|
|
44
|
+
},
|
|
45
|
+
[]
|
|
46
|
+
// Will populate the series colors in this array
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const ht = (s, t) => {
|
|
51
|
+
const o = new dt(), i = o.element = t.createElement("div");
|
|
52
|
+
i.style.display = "none", i.innerHTML = ct, t.body.appendChild(i);
|
|
53
|
+
let e;
|
|
54
|
+
try {
|
|
55
|
+
e = o.getSeriesColors();
|
|
56
|
+
} finally {
|
|
57
|
+
t.body.removeChild(o.element), delete o.element, s(e);
|
|
58
|
+
}
|
|
59
|
+
}, ut = "expanded", mt = "items", gt = "selected", pe = "checked", ft = "checkIndeterminate", vt = "k-orgchart", q = 80, Ce = 300, T = 25, O = 40, ne = 20, ie = 20, ke = 82, Y = l.createContext({
|
|
60
|
+
cardColors: void 0,
|
|
61
|
+
onExpandChange: void 0,
|
|
62
|
+
onKeyDown: void 0,
|
|
63
|
+
onItemAction: void 0,
|
|
64
|
+
onItemContextMenu: void 0,
|
|
65
|
+
onItemDoubleClick: void 0,
|
|
66
|
+
onGroupAction: void 0,
|
|
67
|
+
onGroupBlur: void 0,
|
|
68
|
+
onGroupFocus: void 0
|
|
69
|
+
}), de = (s) => {
|
|
70
|
+
const t = {
|
|
71
|
+
tabIndex: 0,
|
|
72
|
+
navigatable: !0,
|
|
73
|
+
expandField: "expanded",
|
|
74
|
+
ariaLabel: "Org Chart",
|
|
75
|
+
idField: "id",
|
|
76
|
+
childrenField: "items",
|
|
77
|
+
avatarField: "avatar",
|
|
78
|
+
titleField: "title",
|
|
79
|
+
subtitleField: "subtitle",
|
|
80
|
+
...s
|
|
81
|
+
}, {
|
|
82
|
+
navigatable: o,
|
|
83
|
+
id: i,
|
|
84
|
+
tabIndex: e,
|
|
85
|
+
className: n,
|
|
86
|
+
style: r,
|
|
87
|
+
data: a,
|
|
88
|
+
groupField: c,
|
|
89
|
+
cardWidth: m,
|
|
90
|
+
cardHeight: d,
|
|
91
|
+
groupTitleHeight: g,
|
|
92
|
+
groupSubtitleHeight: f,
|
|
93
|
+
verticalLine: u,
|
|
94
|
+
idField: k,
|
|
95
|
+
childrenField: b,
|
|
96
|
+
expandField: I,
|
|
97
|
+
hasChildrenField: R,
|
|
98
|
+
avatarField: S,
|
|
99
|
+
titleField: E,
|
|
100
|
+
subtitleField: G,
|
|
101
|
+
onExpandChange: y,
|
|
102
|
+
onItemAction: x,
|
|
103
|
+
onItemDoubleClick: B,
|
|
104
|
+
onItemContextMenu: D,
|
|
105
|
+
onKeyDown: $,
|
|
106
|
+
onGroupAction: C,
|
|
107
|
+
onGroupBlur: L,
|
|
108
|
+
onGroupFocus: W,
|
|
109
|
+
cardsColors: z,
|
|
110
|
+
ariaLabel: V,
|
|
111
|
+
itemRender: U,
|
|
112
|
+
groupTitleRender: X,
|
|
113
|
+
groupSubtitleRender: A,
|
|
114
|
+
height: ee,
|
|
115
|
+
children: j,
|
|
116
|
+
...oe
|
|
117
|
+
} = t, Z = l.useRef(null), w = l.useRef(new ue({
|
|
118
|
+
tabIndex: e,
|
|
119
|
+
root: Z,
|
|
120
|
+
selectors: [t.groupField ? ".k-orgchart-node-group-container" : ".k-orgchart-card"],
|
|
121
|
+
focusOptions: {}
|
|
122
|
+
})), [se, Te] = l.useState([]), P = l.useRef(null), Ae = (v, p, N) => {
|
|
123
|
+
N.preventDefault(), p.focusNext(v);
|
|
124
|
+
}, Re = (v, p, N) => {
|
|
125
|
+
N.preventDefault(), p.focusPrevious(v);
|
|
126
|
+
}, He = (v, p, N, F) => {
|
|
127
|
+
var M;
|
|
128
|
+
if (N.preventDefault(), (t.groupField ? F.items.some((J) => J[t.expandField]) : F.item[t.expandField]) && t.onExpandChange)
|
|
129
|
+
t.onExpandChange.call(void 0, F);
|
|
130
|
+
else {
|
|
131
|
+
const J = ".k-orgchart-group", re = (M = v.closest(J)) == null ? void 0 : M.getAttribute("id"), Q = document.querySelector(`[aria-owns="${re}"]`);
|
|
132
|
+
Q ? p.focusElement(Q, v) : p.focusPrevious(v);
|
|
133
|
+
}
|
|
134
|
+
}, Se = (v, p, N, F) => {
|
|
135
|
+
var Q;
|
|
136
|
+
N.preventDefault();
|
|
137
|
+
const H = t.groupField ? F.items.some((K) => K[t.expandField]) : F.item[t.expandField], M = t.groupField ? F.items.find((K) => K[t.childrenField]) : F.item[t.childrenField], J = t.groupField ? F.items.some((K) => t.hasChildrenField && K[t.hasChildrenField]) : t.hasChildrenField && F.item[t.hasChildrenField], re = t.groupField ? M && M[t.childrenField] && M[t.childrenField].length : M && M.length;
|
|
138
|
+
if ((J || re) && !H && t.onExpandChange)
|
|
139
|
+
t.onExpandChange.call(void 0, F);
|
|
140
|
+
else {
|
|
141
|
+
const K = t.groupField ? ".k-orgchart-node-group-container" : ".k-orgchart-card", Ue = v.getAttribute("aria-owns"), he = (Q = document.getElementById(Ue)) == null ? void 0 : Q.querySelector(K);
|
|
142
|
+
he ? p.focusElement(he, v) : p.focusNext(v);
|
|
143
|
+
}
|
|
144
|
+
}, De = (v, p, N) => {
|
|
145
|
+
N.preventDefault(), p.focusElement(p.first, null);
|
|
146
|
+
}, Oe = (v, p, N) => {
|
|
147
|
+
N.preventDefault(), p.focusElement(p.last, null);
|
|
148
|
+
}, Ge = (v, p, N, F) => {
|
|
149
|
+
N.stopPropagation();
|
|
150
|
+
const H = v.className.indexOf("k-orgchart-node-group-container") !== -1;
|
|
151
|
+
if (s.groupField && H) {
|
|
152
|
+
P.current && P.current.first && P.current.focusElement(P.current.first, null);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
t.onItemAction && t.onItemAction({
|
|
156
|
+
event: N,
|
|
157
|
+
item: F.item
|
|
158
|
+
});
|
|
159
|
+
}, We = (v) => {
|
|
160
|
+
if (s.groupField) {
|
|
161
|
+
const p = v.closest(".k-orgchart-node-group-container");
|
|
162
|
+
p && w.current.focusElement(p, null);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
l.useEffect(() => {
|
|
166
|
+
if (o && w.current.first && w.current.first.setAttribute("tabindex", String(e)), !z) {
|
|
167
|
+
const v = Z.current.ownerDocument || document;
|
|
168
|
+
ht((p) => {
|
|
169
|
+
Te(p);
|
|
170
|
+
}, v);
|
|
171
|
+
}
|
|
172
|
+
}, [o, e]);
|
|
173
|
+
const _e = (v) => {
|
|
174
|
+
if (t.navigatable) {
|
|
175
|
+
const p = v.event, N = p.key === " " ? "Space" : p.key, F = s.groupField && p.target.className.indexOf("k-orgchart-card") !== -1 && P.current || w.current, H = p.target.closest(F.selectors.join(","));
|
|
176
|
+
switch (N) {
|
|
177
|
+
case "ArrowUp":
|
|
178
|
+
He(H, F, p, v);
|
|
179
|
+
break;
|
|
180
|
+
case "ArrowDown":
|
|
181
|
+
Se(H, F, p, v);
|
|
182
|
+
break;
|
|
183
|
+
case "ArrowLeft":
|
|
184
|
+
Re(H, F, p);
|
|
185
|
+
break;
|
|
186
|
+
case "ArrowRight":
|
|
187
|
+
Ae(H, F, p);
|
|
188
|
+
break;
|
|
189
|
+
case "End":
|
|
190
|
+
Oe(H, F, p);
|
|
191
|
+
break;
|
|
192
|
+
case "Home":
|
|
193
|
+
De(H, F, p);
|
|
194
|
+
break;
|
|
195
|
+
case "Enter":
|
|
196
|
+
Ge(H, F, p, v);
|
|
197
|
+
break;
|
|
198
|
+
case "Escape":
|
|
199
|
+
We(H);
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, Me = (v) => {
|
|
204
|
+
if (v.event.stopPropagation(), x && x.call(void 0, v), t.navigatable) {
|
|
205
|
+
const p = v.event.target.closest(".k-orgchart-card");
|
|
206
|
+
p && w.current.focusElement(p, null);
|
|
207
|
+
}
|
|
208
|
+
}, Pe = (v) => {
|
|
209
|
+
v.event.stopPropagation(), x && x.call(void 0, v);
|
|
210
|
+
}, Ke = (v) => {
|
|
211
|
+
v.event.stopPropagation(), x && x.call(void 0, v);
|
|
212
|
+
}, Be = (v) => {
|
|
213
|
+
if (C && C.call(void 0, v), t.navigatable) {
|
|
214
|
+
const p = v.event.target.closest(".k-orgchart-node-group-container");
|
|
215
|
+
p && w.current.focusElement(p, null);
|
|
216
|
+
}
|
|
217
|
+
}, $e = (v) => {
|
|
218
|
+
P.current = null;
|
|
219
|
+
}, ze = (v) => {
|
|
220
|
+
P.current = new ue({
|
|
221
|
+
tabIndex: 0,
|
|
222
|
+
root: v.containerRef,
|
|
223
|
+
selectors: [".k-orgchart-card"],
|
|
224
|
+
focusOptions: {}
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
return /* @__PURE__ */ l.createElement(
|
|
228
|
+
"div",
|
|
229
|
+
{
|
|
230
|
+
style: r,
|
|
231
|
+
ref: Z,
|
|
232
|
+
className: _(
|
|
233
|
+
n,
|
|
234
|
+
vt
|
|
235
|
+
)
|
|
236
|
+
},
|
|
237
|
+
/* @__PURE__ */ l.createElement(Y.Provider, { value: {
|
|
238
|
+
cardColors: z || se,
|
|
239
|
+
onExpandChange: s.onExpandChange,
|
|
240
|
+
onKeyDown: _e,
|
|
241
|
+
onItemAction: Me,
|
|
242
|
+
onItemDoubleClick: Ke,
|
|
243
|
+
onItemContextMenu: Pe,
|
|
244
|
+
onGroupAction: Be,
|
|
245
|
+
onGroupBlur: $e,
|
|
246
|
+
onGroupFocus: ze
|
|
247
|
+
}, ...oe }, s.children)
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
de.propTypes = {
|
|
251
|
+
className: h.string,
|
|
252
|
+
style: h.object,
|
|
253
|
+
id: h.string,
|
|
254
|
+
ariaLabel: h.string,
|
|
255
|
+
idField: h.string,
|
|
256
|
+
childrenField: h.string,
|
|
257
|
+
expandField: h.string,
|
|
258
|
+
titleField: h.string,
|
|
259
|
+
hasChildrenField: h.string,
|
|
260
|
+
subtitleField: h.string,
|
|
261
|
+
avatarField: h.string,
|
|
262
|
+
cardsColors: h.array,
|
|
263
|
+
data: h.array,
|
|
264
|
+
groupField: h.string,
|
|
265
|
+
cardHeight: h.number,
|
|
266
|
+
cardWidth: h.number,
|
|
267
|
+
groupTitleHeight: h.number,
|
|
268
|
+
groupSubtitleHeight: h.number,
|
|
269
|
+
verticalLine: h.number,
|
|
270
|
+
height: h.oneOfType([h.string, h.number]),
|
|
271
|
+
onExpandChange: h.func,
|
|
272
|
+
onItemAction: h.func,
|
|
273
|
+
onItemDoubleClick: h.func,
|
|
274
|
+
onItemContextMenu: h.func,
|
|
275
|
+
onGroupAction: h.func
|
|
276
|
+
};
|
|
277
|
+
de.displayName = "KendoClientOrgChart";
|
|
278
|
+
const Ee = (s) => {
|
|
279
|
+
const { expanded: t, node: o, nodes: i } = s, e = l.useContext(Y), n = (r) => {
|
|
280
|
+
e.onExpandChange && e.onExpandChange.call(void 0, {
|
|
281
|
+
event: r,
|
|
282
|
+
expand: !t,
|
|
283
|
+
item: o,
|
|
284
|
+
items: i
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
return /* @__PURE__ */ l.createElement(
|
|
288
|
+
tt,
|
|
289
|
+
{
|
|
290
|
+
className: "k-orgchart-button",
|
|
291
|
+
icon: t ? "minus" : "plus",
|
|
292
|
+
tabIndex: -1,
|
|
293
|
+
svgIcon: t ? nt : it,
|
|
294
|
+
"aria-label": t ? "collapse" : "expand",
|
|
295
|
+
onClick: n
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}, pt = (s) => {
|
|
299
|
+
const { node: t, children: o, style: i, ...e } = s, [n, r] = l.useState(!1), a = l.useContext(Y), c = (f) => {
|
|
300
|
+
a.onKeyDown && a.onKeyDown.call(void 0, {
|
|
301
|
+
event: f,
|
|
302
|
+
item: t
|
|
303
|
+
});
|
|
304
|
+
}, m = (f) => {
|
|
305
|
+
a.onItemAction && a.onItemAction.call(void 0, {
|
|
306
|
+
event: f,
|
|
307
|
+
item: t
|
|
308
|
+
});
|
|
309
|
+
}, d = (f) => {
|
|
310
|
+
a.onItemContextMenu && a.onItemContextMenu.call(void 0, {
|
|
311
|
+
event: f,
|
|
312
|
+
item: t
|
|
313
|
+
});
|
|
314
|
+
}, g = (f) => {
|
|
315
|
+
a.onItemDoubleClick && a.onItemDoubleClick.call(void 0, {
|
|
316
|
+
event: f,
|
|
317
|
+
item: t
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
return /* @__PURE__ */ l.createElement(
|
|
321
|
+
Ze,
|
|
322
|
+
{
|
|
323
|
+
role: "treeitem",
|
|
324
|
+
className: _(
|
|
325
|
+
"k-orgchart-card",
|
|
326
|
+
{ "k-focus": n }
|
|
327
|
+
),
|
|
328
|
+
onClick: m,
|
|
329
|
+
onKeyDown: c,
|
|
330
|
+
onContextMenu: d,
|
|
331
|
+
onDoubleClick: g,
|
|
332
|
+
style: i,
|
|
333
|
+
"aria-selected": n,
|
|
334
|
+
"aria-keyshortcuts": "Enter",
|
|
335
|
+
onFocus: () => r(!0),
|
|
336
|
+
onBlur: () => r(!1),
|
|
337
|
+
...e
|
|
338
|
+
},
|
|
339
|
+
o
|
|
340
|
+
);
|
|
341
|
+
}, Ct = (s) => {
|
|
342
|
+
const { level: t, children: o } = s, i = l.useContext(Y), e = i.cardColors && i.cardColors[t] || "green";
|
|
343
|
+
return /* @__PURE__ */ l.createElement(Je, { className: "k-hstack", style: { borderTopColor: e } }, o);
|
|
344
|
+
}, kt = "k-orgchart-node", xe = (s) => {
|
|
345
|
+
const t = {
|
|
346
|
+
avatarType: "image"
|
|
347
|
+
}, {
|
|
348
|
+
id: o,
|
|
349
|
+
title: i,
|
|
350
|
+
subtitle: e,
|
|
351
|
+
level: n,
|
|
352
|
+
childLineWidth: r,
|
|
353
|
+
cardWidth: a,
|
|
354
|
+
cardHeight: c,
|
|
355
|
+
verticalLine: m,
|
|
356
|
+
color: d,
|
|
357
|
+
line: g,
|
|
358
|
+
plus: f,
|
|
359
|
+
expanded: u,
|
|
360
|
+
node: k,
|
|
361
|
+
avatar: b,
|
|
362
|
+
avatarType: I,
|
|
363
|
+
itemRender: R,
|
|
364
|
+
...S
|
|
365
|
+
} = { ...s, ...t }, E = R;
|
|
366
|
+
return /* @__PURE__ */ l.createElement(
|
|
367
|
+
"div",
|
|
368
|
+
{
|
|
369
|
+
...S,
|
|
370
|
+
className: _(
|
|
371
|
+
s.className,
|
|
372
|
+
kt,
|
|
373
|
+
"k-vstack",
|
|
374
|
+
"k-align-items-center"
|
|
375
|
+
)
|
|
376
|
+
},
|
|
377
|
+
n !== 0 && /* @__PURE__ */ l.createElement(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
className: "k-orgchart-line k-orgchart-line-v k-orgchart-line-v-top",
|
|
381
|
+
style: { height: m }
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ l.createElement(
|
|
385
|
+
pt,
|
|
386
|
+
{
|
|
387
|
+
node: k,
|
|
388
|
+
style: { width: a, height: c },
|
|
389
|
+
"aria-level": n + 1,
|
|
390
|
+
"aria-expanded": !!u,
|
|
391
|
+
"aria-owns": o
|
|
392
|
+
},
|
|
393
|
+
/* @__PURE__ */ l.createElement(Ct, { level: n }, E ? /* @__PURE__ */ l.createElement(
|
|
394
|
+
E,
|
|
395
|
+
{
|
|
396
|
+
item: k,
|
|
397
|
+
title: i,
|
|
398
|
+
subtitle: e,
|
|
399
|
+
level: n,
|
|
400
|
+
expanded: u,
|
|
401
|
+
color: d
|
|
402
|
+
}
|
|
403
|
+
) : /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(Qe, { type: I, themeColor: "secondary" }, I === "image" ? /* @__PURE__ */ l.createElement(
|
|
404
|
+
"img",
|
|
405
|
+
{
|
|
406
|
+
src: b,
|
|
407
|
+
alt: "KendoReact Avatar Customer Image"
|
|
408
|
+
}
|
|
409
|
+
) : b), /* @__PURE__ */ l.createElement("div", { className: "k-card-title-wrap k-vstack" }, /* @__PURE__ */ l.createElement(Ye, { className: "k-text-ellipsis" }, i), /* @__PURE__ */ l.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ l.createElement(et, { className: "k-text-ellipsis" }, e)), /* @__PURE__ */ l.createElement("span", { className: "k-spacer" })))
|
|
410
|
+
),
|
|
411
|
+
g && /* @__PURE__ */ l.createElement("div", { className: "k-orgchart-line k-orgchart-line-v" }),
|
|
412
|
+
f && /* @__PURE__ */ l.createElement(Ee, { expanded: u, node: k }),
|
|
413
|
+
f && !!r && /* @__PURE__ */ l.createElement(
|
|
414
|
+
"div",
|
|
415
|
+
{
|
|
416
|
+
className: "k-orgchart-line k-orgchart-line-h",
|
|
417
|
+
style: { width: r, marginTop: -15 }
|
|
418
|
+
}
|
|
419
|
+
)
|
|
420
|
+
);
|
|
421
|
+
}, be = ({
|
|
422
|
+
dataByGroups: s,
|
|
423
|
+
data: t = [],
|
|
424
|
+
cardWidth: o,
|
|
425
|
+
childrenField: i,
|
|
426
|
+
idField: e,
|
|
427
|
+
expandField: n,
|
|
428
|
+
hasChildrenField: r,
|
|
429
|
+
groupField: a,
|
|
430
|
+
level: c = 1,
|
|
431
|
+
parentId: m = 0
|
|
432
|
+
}) => {
|
|
433
|
+
t.forEach((d) => {
|
|
434
|
+
const g = d[i];
|
|
435
|
+
if (d[n] && g && g.length) {
|
|
436
|
+
const u = g.some((I) => I[i] && I[i].length || r && I[r]), k = u ? "horizontal" : "vertical", b = u ? null : o;
|
|
437
|
+
s.push({
|
|
438
|
+
ids: [d[e]],
|
|
439
|
+
items: g,
|
|
440
|
+
level: c,
|
|
441
|
+
parentId: m,
|
|
442
|
+
hasChildren: u,
|
|
443
|
+
orientation: k,
|
|
444
|
+
width: b
|
|
445
|
+
}), be({
|
|
446
|
+
dataByGroups: s,
|
|
447
|
+
data: d[i],
|
|
448
|
+
childrenField: i,
|
|
449
|
+
cardWidth: o,
|
|
450
|
+
idField: e,
|
|
451
|
+
expandField: n,
|
|
452
|
+
hasChildrenField: r,
|
|
453
|
+
groupField: a,
|
|
454
|
+
level: c + 1,
|
|
455
|
+
parentId: d[e]
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}, Et = (s, t) => {
|
|
460
|
+
const o = t || Ce, i = s.sort((e, n) => n.level - e.level);
|
|
461
|
+
i.forEach((e) => {
|
|
462
|
+
if (!e.width) {
|
|
463
|
+
const n = i.filter((m) => e.ids.includes(m.parentId)), r = n.length ? Math.max(...n.map((m) => m.width || 0)) : o, a = e.orientation === "horizontal" ? e.items.length : 1, c = r * a + T * (a - 1);
|
|
464
|
+
e.width = c;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}, xt = (s, t, o) => {
|
|
468
|
+
const i = s.sort((e, n) => e.level - n.level);
|
|
469
|
+
i.forEach((e) => {
|
|
470
|
+
if (e.level === 0)
|
|
471
|
+
return;
|
|
472
|
+
const n = i.find((u) => u.ids.includes(e.parentId)), r = (n == null ? void 0 : n.items.findIndex((u) => e.ids.includes(u[o]))) || 0, a = (n == null ? void 0 : n.items) || [], c = n.width ? (n.width - (a.length - 1) * T) / a.length : 0;
|
|
473
|
+
if (!e.left) {
|
|
474
|
+
let u = (n == null ? void 0 : n.left) || 0;
|
|
475
|
+
a.forEach((k, b) => {
|
|
476
|
+
b < r && (u += c + T);
|
|
477
|
+
}), e.left = u;
|
|
478
|
+
}
|
|
479
|
+
const m = (n == null ? void 0 : n.width) || 0, d = (n == null ? void 0 : n.items.length) || 1, g = (m - (d - 1) * T) / d;
|
|
480
|
+
e.width = g;
|
|
481
|
+
const f = n == null ? void 0 : n.items.map((u) => {
|
|
482
|
+
const k = u[t] ? u[t].length : 0, b = i.find((R) => R.ids.includes(u[o])), I = (b == null ? void 0 : b.width) || 0;
|
|
483
|
+
return (b == null ? void 0 : b.orientation) === "vertical" || k === 0 || !u.expanded ? 0 : I - (I - (k - 1) * T) / k;
|
|
484
|
+
});
|
|
485
|
+
n && (n.childLineWidths = f);
|
|
486
|
+
});
|
|
487
|
+
}, bt = (s, t, o) => {
|
|
488
|
+
const i = t || q, e = o || O;
|
|
489
|
+
s.forEach((n) => {
|
|
490
|
+
const r = n.level, a = (i + e) * r + O * (r ? r - 1 : 0) - (e - O) * (r ? 1 : 0);
|
|
491
|
+
n.top = a;
|
|
492
|
+
});
|
|
493
|
+
}, It = (s, t, o) => {
|
|
494
|
+
const i = t || q, e = o || O;
|
|
495
|
+
return Math.max(...s.map((r) => {
|
|
496
|
+
const a = r.top || 0, c = r.items.length, m = r.orientation === "horizontal" ? i + e + e : c * (i + e);
|
|
497
|
+
return a + m;
|
|
498
|
+
}));
|
|
499
|
+
}, Ie = (s) => {
|
|
500
|
+
const t = {
|
|
501
|
+
width: "100%",
|
|
502
|
+
data: [],
|
|
503
|
+
ariaLabel: "Org Chart",
|
|
504
|
+
idField: "id",
|
|
505
|
+
childrenField: "items",
|
|
506
|
+
avatarField: "avatar",
|
|
507
|
+
titleField: "title",
|
|
508
|
+
subtitleField: "subtitle",
|
|
509
|
+
expandField: "expanded"
|
|
510
|
+
}, {
|
|
511
|
+
id: o,
|
|
512
|
+
width: i,
|
|
513
|
+
data: e,
|
|
514
|
+
groupField: n,
|
|
515
|
+
cardWidth: r,
|
|
516
|
+
cardHeight: a,
|
|
517
|
+
verticalLine: c,
|
|
518
|
+
idField: m,
|
|
519
|
+
childrenField: d,
|
|
520
|
+
hasChildrenField: g,
|
|
521
|
+
expandField: f,
|
|
522
|
+
avatarField: u,
|
|
523
|
+
titleField: k,
|
|
524
|
+
subtitleField: b,
|
|
525
|
+
ariaLabel: I,
|
|
526
|
+
itemRender: R,
|
|
527
|
+
height: S
|
|
528
|
+
} = { ...t, ...s }, E = [{
|
|
529
|
+
items: e,
|
|
530
|
+
level: 0,
|
|
531
|
+
hasChildren: !0,
|
|
532
|
+
orientation: "horizontal",
|
|
533
|
+
ids: [0],
|
|
534
|
+
parentId: null,
|
|
535
|
+
width: null
|
|
536
|
+
}];
|
|
537
|
+
be({
|
|
538
|
+
dataByGroups: E,
|
|
539
|
+
data: e,
|
|
540
|
+
cardWidth: r,
|
|
541
|
+
expandField: f,
|
|
542
|
+
hasChildrenField: g,
|
|
543
|
+
childrenField: d,
|
|
544
|
+
idField: m,
|
|
545
|
+
groupField: n
|
|
546
|
+
}), Et(E, r), xt(E, d, m), bt(E, a, c);
|
|
547
|
+
const G = It(E, a, c);
|
|
548
|
+
return /* @__PURE__ */ l.createElement("div", { className: "k-orgchart-container", style: { width: i, height: S || G } }, E.map((y) => {
|
|
549
|
+
const x = y.level, B = y.items, D = x === 0 ? "center" : "around", $ = y.orientation;
|
|
550
|
+
return /* @__PURE__ */ l.createElement(
|
|
551
|
+
"div",
|
|
552
|
+
{
|
|
553
|
+
role: x === 0 ? "tree" : "group",
|
|
554
|
+
id: o + "-" + x + "-" + y.ids[0],
|
|
555
|
+
"aria-label": x === 0 ? I : void 0,
|
|
556
|
+
"aria-orientation": x === 0 ? $ : void 0,
|
|
557
|
+
key: y.ids[0] + "_" + x,
|
|
558
|
+
className: _(
|
|
559
|
+
"k-orgchart-group",
|
|
560
|
+
`k-orgchart-level-${x}`,
|
|
561
|
+
"k-pos-absolute",
|
|
562
|
+
{
|
|
563
|
+
[`k-${te.orientationMap[$]}`]: $,
|
|
564
|
+
[`k-justify-content-${D}`]: D
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
style: {
|
|
568
|
+
width: y.width || "100%",
|
|
569
|
+
left: y.left,
|
|
570
|
+
top: y.top
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
B.length > 0 && /* @__PURE__ */ l.createElement(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
role: "group",
|
|
577
|
+
style: { width: "100%" },
|
|
578
|
+
className: _(
|
|
579
|
+
"k-orgchart-node-container",
|
|
580
|
+
"k-justify-content-around",
|
|
581
|
+
{
|
|
582
|
+
[`k-${te.orientationMap[y.orientation]}`]: y.orientation
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
},
|
|
586
|
+
B.map((C, L) => {
|
|
587
|
+
const W = C[d] && C[d].length || g && C[g], z = W || y.orientation === "vertical" && L !== B.length - 1, V = y.orientation === "vertical" && L !== 0 ? 0 : c || O, U = y.childLineWidths ? Math.max(...y.childLineWidths) : void 0, X = C[f];
|
|
588
|
+
return /* @__PURE__ */ l.createElement(
|
|
589
|
+
xe,
|
|
590
|
+
{
|
|
591
|
+
id: o + "-" + (x + 1) + "-" + C[m],
|
|
592
|
+
style: { width: U },
|
|
593
|
+
itemRender: R,
|
|
594
|
+
cardHeight: a,
|
|
595
|
+
cardWidth: r,
|
|
596
|
+
verticalLine: V,
|
|
597
|
+
key: L,
|
|
598
|
+
level: x,
|
|
599
|
+
avatar: C[u],
|
|
600
|
+
title: C[k],
|
|
601
|
+
subtitle: C[b],
|
|
602
|
+
line: z,
|
|
603
|
+
expanded: X,
|
|
604
|
+
node: C,
|
|
605
|
+
childLineWidth: W && X && y.orientation === "horizontal" ? y.childLineWidths[L] : 0,
|
|
606
|
+
plus: W
|
|
607
|
+
},
|
|
608
|
+
C.text
|
|
609
|
+
);
|
|
610
|
+
})
|
|
611
|
+
)
|
|
612
|
+
);
|
|
613
|
+
}));
|
|
614
|
+
};
|
|
615
|
+
Ie.displayName = "KendoServerOrgChart";
|
|
616
|
+
const yt = {
|
|
617
|
+
name: "@progress/kendo-react-orgchart",
|
|
618
|
+
productName: "KendoReact",
|
|
619
|
+
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
620
|
+
publishDate: 1700573668,
|
|
621
|
+
version: "",
|
|
622
|
+
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
|
|
623
|
+
}, Ft = (s) => {
|
|
624
|
+
const { nodes: t, children: o, style: i, ...e } = s, [n, r] = l.useState(!1), a = l.useContext(Y), c = l.useRef(null), m = (u) => {
|
|
625
|
+
a.onKeyDown && a.onKeyDown({
|
|
626
|
+
event: u,
|
|
627
|
+
items: t
|
|
628
|
+
});
|
|
629
|
+
}, d = (u) => {
|
|
630
|
+
a.onGroupAction && a.onGroupAction({
|
|
631
|
+
event: u,
|
|
632
|
+
items: t
|
|
633
|
+
});
|
|
634
|
+
}, g = (u) => {
|
|
635
|
+
r(!0), a.onGroupFocus && a.onGroupFocus({
|
|
636
|
+
event: u,
|
|
637
|
+
items: t,
|
|
638
|
+
containerRef: c
|
|
639
|
+
});
|
|
640
|
+
}, f = (u) => {
|
|
641
|
+
r(!1), a.onGroupBlur && a.onGroupBlur({
|
|
642
|
+
event: u,
|
|
643
|
+
items: t
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
return /* @__PURE__ */ l.createElement(
|
|
647
|
+
"div",
|
|
648
|
+
{
|
|
649
|
+
role: "treeitem",
|
|
650
|
+
"aria-selected": n,
|
|
651
|
+
ref: c,
|
|
652
|
+
className: _(
|
|
653
|
+
"k-orgchart-node-group-container",
|
|
654
|
+
"k-vstack",
|
|
655
|
+
{ "k-focus": n }
|
|
656
|
+
),
|
|
657
|
+
style: i,
|
|
658
|
+
onKeyDown: m,
|
|
659
|
+
onClick: d,
|
|
660
|
+
onFocus: g,
|
|
661
|
+
onBlur: f,
|
|
662
|
+
...e
|
|
663
|
+
},
|
|
664
|
+
o
|
|
665
|
+
);
|
|
666
|
+
}, wt = "k-orgchart-node-group", ge = "k-orgchart-node-group-title", fe = "k-orgchart-node-group-subtitle", Lt = (s) => {
|
|
667
|
+
const t = {
|
|
668
|
+
orientation: "horizontal"
|
|
669
|
+
}, {
|
|
670
|
+
id: o,
|
|
671
|
+
title: i,
|
|
672
|
+
subtitle: e,
|
|
673
|
+
line: n,
|
|
674
|
+
plus: r,
|
|
675
|
+
focus: a,
|
|
676
|
+
level: c,
|
|
677
|
+
verticalLine: m,
|
|
678
|
+
childLineWidth: d,
|
|
679
|
+
orientation: g,
|
|
680
|
+
expanded: f,
|
|
681
|
+
nodes: u,
|
|
682
|
+
groupTitleHeight: k,
|
|
683
|
+
groupSubtitleHeight: b,
|
|
684
|
+
groupTitleRender: I,
|
|
685
|
+
groupSubtitleRender: R,
|
|
686
|
+
...S
|
|
687
|
+
} = { ...t, ...s }, E = I, G = R, y = { height: k || ne }, x = { height: b || ie };
|
|
688
|
+
return /* @__PURE__ */ l.createElement(
|
|
689
|
+
"div",
|
|
690
|
+
{
|
|
691
|
+
...S,
|
|
692
|
+
className: _(
|
|
693
|
+
s.className,
|
|
694
|
+
wt,
|
|
695
|
+
"k-vstack",
|
|
696
|
+
"k-align-items-center"
|
|
697
|
+
)
|
|
698
|
+
},
|
|
699
|
+
c !== 0 && /* @__PURE__ */ l.createElement(
|
|
700
|
+
"div",
|
|
701
|
+
{
|
|
702
|
+
className: "k-orgchart-line k-orgchart-line-v k-orgchart-line-v-top",
|
|
703
|
+
style: { height: m }
|
|
704
|
+
}
|
|
705
|
+
),
|
|
706
|
+
/* @__PURE__ */ l.createElement(
|
|
707
|
+
Ft,
|
|
708
|
+
{
|
|
709
|
+
nodes: u,
|
|
710
|
+
"aria-expanded": !!f,
|
|
711
|
+
"aria-keyshortcuts": "Enter",
|
|
712
|
+
"aria-level": c + 1,
|
|
713
|
+
"aria-owns": o
|
|
714
|
+
},
|
|
715
|
+
E ? /* @__PURE__ */ l.createElement(
|
|
716
|
+
E,
|
|
717
|
+
{
|
|
718
|
+
style: y,
|
|
719
|
+
className: ge,
|
|
720
|
+
title: i,
|
|
721
|
+
items: u,
|
|
722
|
+
level: c,
|
|
723
|
+
expanded: f
|
|
724
|
+
}
|
|
725
|
+
) : /* @__PURE__ */ l.createElement("div", { className: ge, style: y }, i),
|
|
726
|
+
G ? /* @__PURE__ */ l.createElement(
|
|
727
|
+
G,
|
|
728
|
+
{
|
|
729
|
+
style: x,
|
|
730
|
+
className: fe,
|
|
731
|
+
subtitle: e,
|
|
732
|
+
items: u,
|
|
733
|
+
level: c,
|
|
734
|
+
expanded: f
|
|
735
|
+
}
|
|
736
|
+
) : /* @__PURE__ */ l.createElement("div", { className: fe, style: x }, e),
|
|
737
|
+
/* @__PURE__ */ l.createElement(
|
|
738
|
+
"div",
|
|
739
|
+
{
|
|
740
|
+
role: "group",
|
|
741
|
+
style: { width: "100%" },
|
|
742
|
+
className: _(
|
|
743
|
+
"k-orgchart-node-container",
|
|
744
|
+
"k-justify-content-around",
|
|
745
|
+
{
|
|
746
|
+
[`k-${te.orientationMap[g] || g}`]: g
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
},
|
|
750
|
+
s.children
|
|
751
|
+
)
|
|
752
|
+
),
|
|
753
|
+
n && /* @__PURE__ */ l.createElement("div", { className: "k-orgchart-line k-orgchart-line-v" }),
|
|
754
|
+
r && /* @__PURE__ */ l.createElement(Ee, { expanded: f, nodes: u }),
|
|
755
|
+
r && !!d && /* @__PURE__ */ l.createElement(
|
|
756
|
+
"div",
|
|
757
|
+
{
|
|
758
|
+
className: "k-orgchart-line k-orgchart-line-h",
|
|
759
|
+
style: { width: d, marginTop: -15 }
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
);
|
|
763
|
+
}, ye = ({
|
|
764
|
+
dataByGroups: s,
|
|
765
|
+
data: t = [],
|
|
766
|
+
cardWidth: o,
|
|
767
|
+
childrenField: i,
|
|
768
|
+
idField: e,
|
|
769
|
+
expandField: n,
|
|
770
|
+
hasChildrenField: r,
|
|
771
|
+
groupField: a,
|
|
772
|
+
level: c = 1,
|
|
773
|
+
parentId: m = 0
|
|
774
|
+
}) => {
|
|
775
|
+
t.forEach((d) => {
|
|
776
|
+
const g = d[i];
|
|
777
|
+
if (d[n] && g && g.length) {
|
|
778
|
+
const u = g.some((E) => E[i] && E[i].length || r && E[r]), k = u ? "horizontal" : "vertical", b = u ? null : o + 2 * T, I = s.find((E) => E.parentId === m), R = s.find((E) => E.ids.includes(m));
|
|
779
|
+
let S = !1;
|
|
780
|
+
if (I) {
|
|
781
|
+
const E = I.ids[0], G = R.items.find((x) => x[e] === E), y = R.items.find((x) => x[e] === d[e]);
|
|
782
|
+
S = G[a] === y[a];
|
|
783
|
+
}
|
|
784
|
+
I && S ? (I.ids.push(d[e]), I.items = I.items.concat(g)) : s.push({
|
|
785
|
+
ids: [d[e]],
|
|
786
|
+
items: g,
|
|
787
|
+
level: c,
|
|
788
|
+
parentId: m,
|
|
789
|
+
hasChildren: u,
|
|
790
|
+
orientation: k,
|
|
791
|
+
width: b
|
|
792
|
+
}), ye({
|
|
793
|
+
dataByGroups: s,
|
|
794
|
+
data: d[i],
|
|
795
|
+
childrenField: i,
|
|
796
|
+
cardWidth: o,
|
|
797
|
+
idField: e,
|
|
798
|
+
expandField: n,
|
|
799
|
+
hasChildrenField: r,
|
|
800
|
+
groupField: a,
|
|
801
|
+
level: c + 1,
|
|
802
|
+
parentId: d[e]
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
}, Nt = (s, t) => {
|
|
807
|
+
const o = t || Ce, i = s.sort((e, n) => n.level - e.level);
|
|
808
|
+
i.forEach((e) => {
|
|
809
|
+
if (!e.width) {
|
|
810
|
+
const n = i.filter((r) => e.ids.includes(r.parentId));
|
|
811
|
+
if (n.length) {
|
|
812
|
+
const r = Math.max(...n.map((d) => d.width || 0)), a = Math.max(...n.map((d) => d.groupedItems.length || 0)), c = Math.max(...e.groupedItems.map((d) => {
|
|
813
|
+
const g = e.orientation === "horizontal" ? d.items.length : 1;
|
|
814
|
+
return g * (o + 2 * T) + T * (g - 1);
|
|
815
|
+
})), m = r * a + T * (a - 1);
|
|
816
|
+
e.width = Math.max(m, c);
|
|
817
|
+
} else {
|
|
818
|
+
const r = Math.max(...e.groupedItems.map((a) => {
|
|
819
|
+
const c = e.orientation === "horizontal" ? a.items.length : 1;
|
|
820
|
+
return c * (o + 2 * T) + T * (c - 1);
|
|
821
|
+
}));
|
|
822
|
+
e.width = r;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
}, Tt = (s, t) => {
|
|
827
|
+
const o = s.sort((i, e) => i.level - e.level);
|
|
828
|
+
o.forEach((i) => {
|
|
829
|
+
var g;
|
|
830
|
+
if (i.level === 0)
|
|
831
|
+
return;
|
|
832
|
+
const e = o.find((f) => f.ids.includes(i.parentId)), n = (e == null ? void 0 : e.groupedItems.findIndex((f) => f.items.some((u) => i.ids.includes(u[t])))) || 0, r = (e == null ? void 0 : e.groupedItems) || [], a = e.width ? (e.width - (r.length - 1) * T) / r.length : 0;
|
|
833
|
+
if (!i.left) {
|
|
834
|
+
let f = (e == null ? void 0 : e.left) || 0;
|
|
835
|
+
r.forEach((u, k) => {
|
|
836
|
+
k < n && (f += a + T);
|
|
837
|
+
}), i.left = f;
|
|
838
|
+
}
|
|
839
|
+
const c = (e == null ? void 0 : e.width) || 0, m = (e == null ? void 0 : e.groupedItems.length) || 1, d = (c - (m - 1) * T) / m;
|
|
840
|
+
if (i.width = d, e) {
|
|
841
|
+
const f = i.width - (i.width - (i.groupedItems.length - 1) * T) / i.groupedItems.length;
|
|
842
|
+
e.childLineWidths ? (g = e.childLineWidths) == null || g.push(f) : e.childLineWidths = [f];
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
}, At = (s, t, o, i, e) => {
|
|
846
|
+
const n = t || q, r = e || O, a = o + i + ke;
|
|
847
|
+
s.forEach((c) => {
|
|
848
|
+
const m = c.level, d = (n + r + a) * m + O * (m ? m - 1 : 0) - (r - O) * (m ? 1 : 0);
|
|
849
|
+
c.top = d;
|
|
850
|
+
});
|
|
851
|
+
}, Rt = (s, t, o, i, e) => {
|
|
852
|
+
const n = t || q, r = o || O, c = (i || ne) + (e || ie) + ke;
|
|
853
|
+
return Math.max(...s.map((d) => {
|
|
854
|
+
const g = d.top || 0, f = Math.max(...d.groupedItems.map((b) => b.items.length)), u = d.hasChildren ? O : 0, k = d.orientation === "horizontal" ? n + r + c + r + u : f * (n + r) + c + r;
|
|
855
|
+
return g + k;
|
|
856
|
+
}));
|
|
857
|
+
}, Fe = (s) => {
|
|
858
|
+
const t = {
|
|
859
|
+
width: "100%",
|
|
860
|
+
data: [],
|
|
861
|
+
ariaLabel: "Org Chart",
|
|
862
|
+
idField: "id",
|
|
863
|
+
childrenField: "items",
|
|
864
|
+
avatarField: "avatar",
|
|
865
|
+
titleField: "title",
|
|
866
|
+
subtitleField: "subtitle",
|
|
867
|
+
expandField: "expanded",
|
|
868
|
+
orientation: "horizontal"
|
|
869
|
+
}, {
|
|
870
|
+
id: o,
|
|
871
|
+
width: i,
|
|
872
|
+
data: e,
|
|
873
|
+
groupField: n,
|
|
874
|
+
cardWidth: r,
|
|
875
|
+
cardHeight: a,
|
|
876
|
+
groupTitleHeight: c,
|
|
877
|
+
groupSubtitleHeight: m,
|
|
878
|
+
verticalLine: d,
|
|
879
|
+
idField: g,
|
|
880
|
+
childrenField: f,
|
|
881
|
+
expandField: u,
|
|
882
|
+
hasChildrenField: k,
|
|
883
|
+
avatarField: b,
|
|
884
|
+
titleField: I,
|
|
885
|
+
subtitleField: R,
|
|
886
|
+
cardsColors: S,
|
|
887
|
+
ariaLabel: E,
|
|
888
|
+
itemRender: G,
|
|
889
|
+
groupTitleRender: y,
|
|
890
|
+
groupSubtitleRender: x,
|
|
891
|
+
height: B
|
|
892
|
+
} = { ...t, ...s }, D = [{
|
|
893
|
+
items: e,
|
|
894
|
+
level: 0,
|
|
895
|
+
hasChildren: !0,
|
|
896
|
+
orientation: "horizontal",
|
|
897
|
+
ids: [0],
|
|
898
|
+
parentId: null,
|
|
899
|
+
width: null
|
|
900
|
+
}];
|
|
901
|
+
ye({
|
|
902
|
+
dataByGroups: D,
|
|
903
|
+
data: e,
|
|
904
|
+
cardWidth: r,
|
|
905
|
+
expandField: u,
|
|
906
|
+
hasChildrenField: k,
|
|
907
|
+
childrenField: f,
|
|
908
|
+
idField: g,
|
|
909
|
+
groupField: n
|
|
910
|
+
}), D.map((C) => {
|
|
911
|
+
C.groupedItems = ot(C.items, [{ field: n }]);
|
|
912
|
+
}), Nt(D, r), Tt(D, g), At(
|
|
913
|
+
D,
|
|
914
|
+
a || q,
|
|
915
|
+
c || ne,
|
|
916
|
+
m || ie,
|
|
917
|
+
d
|
|
918
|
+
);
|
|
919
|
+
const $ = Rt(
|
|
920
|
+
D,
|
|
921
|
+
a || q,
|
|
922
|
+
c || ne,
|
|
923
|
+
m || ie
|
|
924
|
+
);
|
|
925
|
+
return /* @__PURE__ */ React.createElement("div", { className: "k-orgchart-container", style: { width: i, height: B || $ } }, D.map((C) => {
|
|
926
|
+
const L = C.level, W = C.groupedItems.map((A) => {
|
|
927
|
+
const ee = A.items.some((j) => j[u]);
|
|
928
|
+
return {
|
|
929
|
+
...A,
|
|
930
|
+
expanded: ee
|
|
931
|
+
};
|
|
932
|
+
}), z = W.filter((A) => A.expanded), V = L === 0 ? "center" : "around", U = "horizontal", X = S && S[L] || "green";
|
|
933
|
+
return /* @__PURE__ */ React.createElement(
|
|
934
|
+
"div",
|
|
935
|
+
{
|
|
936
|
+
role: L === 0 ? "tree" : "group",
|
|
937
|
+
id: o + "-" + L + "-" + C.ids[0],
|
|
938
|
+
"aria-label": L === 0 ? E : void 0,
|
|
939
|
+
"aria-orientation": L === 0 ? U : void 0,
|
|
940
|
+
key: C.ids[0] + "_" + L,
|
|
941
|
+
className: _(
|
|
942
|
+
"k-orgchart-group",
|
|
943
|
+
`k-orgchart-level-${L}`,
|
|
944
|
+
"k-pos-absolute",
|
|
945
|
+
{
|
|
946
|
+
[`k-${te.orientationMap[U]}`]: U,
|
|
947
|
+
[`k-justify-content-${V}`]: V,
|
|
948
|
+
"k-orgchart-group-h": s.groupField
|
|
949
|
+
}
|
|
950
|
+
),
|
|
951
|
+
style: {
|
|
952
|
+
width: C.width || "100%",
|
|
953
|
+
left: C.left,
|
|
954
|
+
top: C.top
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
e.length > 0 && W.map((A, ee) => {
|
|
958
|
+
const j = A.items.some((w) => w[f] && w[f].length || k && w[k]), oe = C.width ? (C.width - (W.length - 1) * T) / W.length : void 0, Z = z.findIndex((w) => w === A);
|
|
959
|
+
return /* @__PURE__ */ React.createElement(
|
|
960
|
+
Lt,
|
|
961
|
+
{
|
|
962
|
+
id: o + "-" + (L + 1) + "-" + A.items[0][g],
|
|
963
|
+
style: { width: oe },
|
|
964
|
+
groupTitleHeight: c,
|
|
965
|
+
groupSubtitleHeight: m,
|
|
966
|
+
groupTitleRender: y,
|
|
967
|
+
groupSubtitleRender: x,
|
|
968
|
+
key: ee,
|
|
969
|
+
level: L,
|
|
970
|
+
verticalLine: d || O,
|
|
971
|
+
title: A.items[0][n || I],
|
|
972
|
+
subtitle: n,
|
|
973
|
+
orientation: C.orientation,
|
|
974
|
+
childLineWidth: j && A.expanded && C.orientation === "horizontal" ? C.childLineWidths[Z] : 0,
|
|
975
|
+
line: j,
|
|
976
|
+
nodes: A.items,
|
|
977
|
+
expanded: A.expanded,
|
|
978
|
+
plus: j
|
|
979
|
+
},
|
|
980
|
+
A.items.map((w, se) => /* @__PURE__ */ React.createElement(
|
|
981
|
+
xe,
|
|
982
|
+
{
|
|
983
|
+
cardHeight: a,
|
|
984
|
+
cardWidth: r,
|
|
985
|
+
itemRender: G,
|
|
986
|
+
color: X,
|
|
987
|
+
key: se,
|
|
988
|
+
level: L,
|
|
989
|
+
avatar: w[b],
|
|
990
|
+
title: w[I],
|
|
991
|
+
subtitle: w[R],
|
|
992
|
+
verticalLine: 0,
|
|
993
|
+
line: !1,
|
|
994
|
+
node: w,
|
|
995
|
+
childLineWidth: 0,
|
|
996
|
+
plus: !1
|
|
997
|
+
},
|
|
998
|
+
w.text
|
|
999
|
+
))
|
|
1000
|
+
);
|
|
1001
|
+
})
|
|
1002
|
+
);
|
|
1003
|
+
}));
|
|
1004
|
+
};
|
|
1005
|
+
Fe.displayName = "KendoServerGroupedOrgChart";
|
|
1006
|
+
const we = (s) => {
|
|
1007
|
+
const t = {
|
|
1008
|
+
tabIndex: 0,
|
|
1009
|
+
navigatable: !0,
|
|
1010
|
+
expandField: "expanded",
|
|
1011
|
+
ariaLabel: "Org Chart",
|
|
1012
|
+
idField: "id",
|
|
1013
|
+
childrenField: "items",
|
|
1014
|
+
avatarField: "avatar",
|
|
1015
|
+
titleField: "title",
|
|
1016
|
+
subtitleField: "subtitle",
|
|
1017
|
+
...s
|
|
1018
|
+
}, {
|
|
1019
|
+
cardsColors: o,
|
|
1020
|
+
onExpandChange: i,
|
|
1021
|
+
onKeyDown: e,
|
|
1022
|
+
onItemAction: n,
|
|
1023
|
+
onGroupAction: r,
|
|
1024
|
+
onGroupBlur: a,
|
|
1025
|
+
onGroupFocus: c,
|
|
1026
|
+
id: m,
|
|
1027
|
+
...d
|
|
1028
|
+
} = t, g = l.useRef(je());
|
|
1029
|
+
return qe(yt), /* @__PURE__ */ l.createElement(de, { ...t }, s.groupField ? /* @__PURE__ */ l.createElement(
|
|
1030
|
+
Fe,
|
|
1031
|
+
{
|
|
1032
|
+
id: m || g.current,
|
|
1033
|
+
...d
|
|
1034
|
+
},
|
|
1035
|
+
s.children
|
|
1036
|
+
) : /* @__PURE__ */ l.createElement(
|
|
1037
|
+
Ie,
|
|
1038
|
+
{
|
|
1039
|
+
id: m || g.current,
|
|
1040
|
+
...d
|
|
1041
|
+
},
|
|
1042
|
+
s.children
|
|
1043
|
+
));
|
|
1044
|
+
};
|
|
1045
|
+
we.propTypes = {
|
|
1046
|
+
className: h.string,
|
|
1047
|
+
style: h.object,
|
|
1048
|
+
id: h.string,
|
|
1049
|
+
ariaLabel: h.string,
|
|
1050
|
+
idField: h.string,
|
|
1051
|
+
childrenField: h.string,
|
|
1052
|
+
expandField: h.string,
|
|
1053
|
+
titleField: h.string,
|
|
1054
|
+
hasChildrenField: h.string,
|
|
1055
|
+
subtitleField: h.string,
|
|
1056
|
+
avatarField: h.string,
|
|
1057
|
+
cardsColors: h.array,
|
|
1058
|
+
data: h.array,
|
|
1059
|
+
groupField: h.string,
|
|
1060
|
+
cardHeight: h.number,
|
|
1061
|
+
cardWidth: h.number,
|
|
1062
|
+
groupTitleHeight: h.number,
|
|
1063
|
+
groupSubtitleHeight: h.number,
|
|
1064
|
+
verticalLine: h.number,
|
|
1065
|
+
height: h.oneOfType([h.string, h.number]),
|
|
1066
|
+
onExpandChange: h.func,
|
|
1067
|
+
onItemAction: h.func,
|
|
1068
|
+
onGroupAction: h.func
|
|
1069
|
+
};
|
|
1070
|
+
we.displayName = "KendoOrgChart";
|
|
1071
|
+
function Mt(s, t) {
|
|
1072
|
+
if (!s || !s.length)
|
|
1073
|
+
return [];
|
|
1074
|
+
let o = s;
|
|
1075
|
+
const i = t.cloneField || "cloned", e = t.expandField || ut, n = t.selectField || gt, r = t.checkField || pe, a = t.childrenField || mt;
|
|
1076
|
+
return o = ae(o, e, t.expand, i, a), o = ae(o, n, t.select, i, a), o = ae(o, r, t.check, i, a), St(o, a, t.check), o;
|
|
1077
|
+
}
|
|
1078
|
+
function ae(s, t, o, i, e) {
|
|
1079
|
+
if (o) {
|
|
1080
|
+
const { ids: n, field: r } = Le(o, t), a = !ce(o) && o.idField ? Ve(n, o.idField, s, e) : n;
|
|
1081
|
+
return Ht(s, a, r, i, e);
|
|
1082
|
+
} else
|
|
1083
|
+
return s;
|
|
1084
|
+
}
|
|
1085
|
+
function Le(s, t) {
|
|
1086
|
+
let o, i;
|
|
1087
|
+
return ce(s) ? (o = s, i = t) : (o = s.ids || [], i = s.operationField || t), { ids: o, field: i };
|
|
1088
|
+
}
|
|
1089
|
+
function Ht(s, t, o, i, e) {
|
|
1090
|
+
let n = s;
|
|
1091
|
+
return t.forEach((r) => {
|
|
1092
|
+
n = Xe(n, r, (a) => Ne(o, a), i, e);
|
|
1093
|
+
}), n;
|
|
1094
|
+
}
|
|
1095
|
+
function Ne(s, t) {
|
|
1096
|
+
const o = (s || "").split(".");
|
|
1097
|
+
let i = t;
|
|
1098
|
+
for (let e = 0; e < o.length; e++) {
|
|
1099
|
+
const n = o[e];
|
|
1100
|
+
if (e === o.length - 1)
|
|
1101
|
+
i[n] = !0;
|
|
1102
|
+
else if (i[n] !== void 0)
|
|
1103
|
+
i[n] = { ...i[n] }, i = i[n];
|
|
1104
|
+
else
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
function St(s, t, o) {
|
|
1109
|
+
if (o && !ce(o) && o.applyCheckIndeterminate) {
|
|
1110
|
+
const { field: i } = Le(o, pe), e = o.checkIndeterminateField || ft;
|
|
1111
|
+
for (let n = 0; n < s.length; n++) {
|
|
1112
|
+
const r = s[n], a = r[t];
|
|
1113
|
+
a && le(
|
|
1114
|
+
a,
|
|
1115
|
+
ve(i, r) ? [] : [r],
|
|
1116
|
+
t,
|
|
1117
|
+
i,
|
|
1118
|
+
e
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
function le(s, t, o, i, e) {
|
|
1124
|
+
let n = !1;
|
|
1125
|
+
for (let r = 0; r < s.length; r++) {
|
|
1126
|
+
const a = s[r];
|
|
1127
|
+
if (ve(i, a)) {
|
|
1128
|
+
if (!n)
|
|
1129
|
+
for (let c = 0; c < t.length; c++)
|
|
1130
|
+
Ne(e, t[c]);
|
|
1131
|
+
n = !0, a[o] && le(a[o], [], o, i, e);
|
|
1132
|
+
} else
|
|
1133
|
+
a[o] && le(
|
|
1134
|
+
a[o],
|
|
1135
|
+
n ? [a] : t.concat([a]),
|
|
1136
|
+
o,
|
|
1137
|
+
i,
|
|
1138
|
+
e
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
export {
|
|
1143
|
+
we as OrgChart,
|
|
1144
|
+
Ie as ServerOrgChart,
|
|
1145
|
+
Lt as ServerOrgChartGroup,
|
|
1146
|
+
xe as ServerOrgChartNode,
|
|
1147
|
+
Mt as processOrgChartItems
|
|
1148
|
+
};
|