@progress/kendo-react-orgchart 7.4.0 → 7.5.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.
@@ -6,16 +6,16 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as O from "react";
10
- import { classNames as Z, kendoThemeMaps as q } from "@progress/kendo-react-common";
11
- import { ServerOrgChartNode as J } from "./ServerOrgChartNode.mjs";
12
- import { ServerOrgChartGroup as Q } from "./ServerOrgChartGroup.mjs";
13
- import { groupBy as X } from "@progress/kendo-data-query";
14
- import { HORIZONTAL_GAP as x, VERTICAL_LINE as b, NODE_WIDTH as Y, NODE_HEIGHT as R, GROUP_PADDINGS as A, GROUP_TITLE_HEIGHT as z, GROUP_SUBTITLE_HEIGHT as D } from "../utils/consts.mjs";
15
- const N = ({
16
- dataByGroups: r,
9
+ import * as R from "react";
10
+ import { classNames as q, kendoThemeMaps as J } from "@progress/kendo-react-common";
11
+ import { ServerOrgChartNode as Q } from "./ServerOrgChartNode.mjs";
12
+ import { ServerOrgChartGroup as X } from "./ServerOrgChartGroup.mjs";
13
+ import { groupBy as Y } from "@progress/kendo-data-query";
14
+ import { HORIZONTAL_GAP as v, VERTICAL_LINE as b, NODE_WIDTH as tt, NODE_HEIGHT as k, GROUP_PADDINGS as D, GROUP_TITLE_HEIGHT as z, GROUP_SUBTITLE_HEIGHT as A } from "../utils/consts.mjs";
15
+ const P = ({
16
+ dataByGroups: m,
17
17
  data: u = [],
18
- cardWidth: c,
18
+ cardWidth: r,
19
19
  childrenField: e,
20
20
  idField: t,
21
21
  expandField: s,
@@ -27,25 +27,25 @@ const N = ({
27
27
  u.forEach((n) => {
28
28
  const h = n[e];
29
29
  if (n[s] && h && h.length) {
30
- const g = h.some((I) => I[e] && I[e].length || i && I[i]), L = g ? "horizontal" : "vertical", E = g ? null : c + 2 * x, w = r.find((I) => I.parentId === a), G = r.find((I) => I.ids.includes(a));
30
+ const I = h.some((p) => p[e] && p[e].length || i && p[i]), x = I ? "horizontal" : "vertical", E = I ? null : r + 2 * v, L = m.find((p) => p.parentId === a), C = m.find((p) => p.ids.includes(a));
31
31
  let T = !1;
32
- if (w) {
33
- const I = w.ids[0], y = G.items.find((W) => W[t] === I), S = G.items.find((W) => W[t] === n[t]);
34
- T = y[d] === S[d];
32
+ if (L) {
33
+ const p = L.ids[0], S = C.items.find((W) => W[t] === p), _ = C.items.find((W) => W[t] === n[t]);
34
+ T = S[d] === _[d];
35
35
  }
36
- w && T ? (w.ids.push(n[t]), w.items = w.items.concat(h)) : r.push({
36
+ L && T ? (L.ids.push(n[t]), L.items = L.items.concat(h)) : m.push({
37
37
  ids: [n[t]],
38
38
  items: h,
39
39
  level: o,
40
40
  parentId: a,
41
- hasChildren: g,
42
- orientation: L,
41
+ hasChildren: I,
42
+ orientation: x,
43
43
  width: E
44
- }), N({
45
- dataByGroups: r,
44
+ }), P({
45
+ dataByGroups: m,
46
46
  data: n[e],
47
47
  childrenField: e,
48
- cardWidth: c,
48
+ cardWidth: r,
49
49
  idField: t,
50
50
  expandField: s,
51
51
  hasChildrenField: i,
@@ -55,58 +55,58 @@ const N = ({
55
55
  });
56
56
  }
57
57
  });
58
- }, tt = (r, u) => {
59
- const c = u || Y, e = r.sort((t, s) => s.level - t.level);
58
+ }, et = (m, u) => {
59
+ const r = u || tt, e = m.sort((t, s) => s.level - t.level);
60
60
  e.forEach((t) => {
61
61
  if (!t.width) {
62
62
  const s = e.filter((i) => t.ids.includes(i.parentId));
63
63
  if (s.length) {
64
64
  const i = Math.max(...s.map((n) => n.width || 0)), d = Math.max(...s.map((n) => n.groupedItems.length || 0)), o = Math.max(...t.groupedItems.map((n) => {
65
65
  const h = t.orientation === "horizontal" ? n.items.length : 1;
66
- return h * (c + 2 * x) + x * (h - 1);
67
- })), a = i * d + x * (d - 1);
66
+ return h * (r + 2 * v) + v * (h - 1);
67
+ })), a = i * d + v * (d - 1);
68
68
  t.width = Math.max(a, o);
69
69
  } else {
70
70
  const i = Math.max(...t.groupedItems.map((d) => {
71
71
  const o = t.orientation === "horizontal" ? d.items.length : 1;
72
- return o * (c + 2 * x) + x * (o - 1);
72
+ return o * (r + 2 * v) + v * (o - 1);
73
73
  }));
74
74
  t.width = i;
75
75
  }
76
76
  }
77
77
  });
78
- }, et = (r, u) => {
79
- const c = r.sort((e, t) => e.level - t.level);
80
- c.forEach((e) => {
78
+ }, it = (m, u) => {
79
+ const r = m.sort((e, t) => e.level - t.level);
80
+ r.forEach((e) => {
81
81
  var h;
82
82
  if (e.level === 0)
83
83
  return;
84
- const t = c.find((l) => l.ids.includes(e.parentId)), s = (t == null ? void 0 : t.groupedItems.findIndex((l) => l.items.some((g) => e.ids.includes(g[u])))) || 0, i = (t == null ? void 0 : t.groupedItems) || [], d = t.width ? (t.width - (i.length - 1) * x) / i.length : 0;
84
+ const t = r.find((l) => l.ids.includes(e.parentId)), s = (t == null ? void 0 : t.groupedItems.findIndex((l) => l.items.some((I) => e.ids.includes(I[u])))) || 0, i = (t == null ? void 0 : t.groupedItems) || [], d = t.width ? (t.width - (i.length - 1) * v) / i.length : 0;
85
85
  if (!e.left) {
86
86
  let l = (t == null ? void 0 : t.left) || 0;
87
- i.forEach((g, L) => {
88
- L < s && (l += d + x);
87
+ i.forEach((I, x) => {
88
+ x < s && (l += d + v);
89
89
  }), e.left = l;
90
90
  }
91
- const o = (t == null ? void 0 : t.width) || 0, a = (t == null ? void 0 : t.groupedItems.length) || 1, n = (o - (a - 1) * x) / a;
91
+ const o = (t == null ? void 0 : t.width) || 0, a = (t == null ? void 0 : t.groupedItems.length) || 1, n = (o - (a - 1) * v) / a;
92
92
  if (e.width = n, t) {
93
- const l = e.width - (e.width - (e.groupedItems.length - 1) * x) / e.groupedItems.length;
93
+ const l = e.width - (e.width - (e.groupedItems.length - 1) * v) / e.groupedItems.length;
94
94
  t.childLineWidths ? (h = t.childLineWidths) == null || h.push(l) : t.childLineWidths = [l];
95
95
  }
96
96
  });
97
- }, it = (r, u, c, e, t) => {
98
- const s = u || R, i = t || b, d = c + e + A;
99
- r.forEach((o) => {
97
+ }, nt = (m, u, r, e, t) => {
98
+ const s = u || k, i = t || b, d = r + e + D;
99
+ m.forEach((o) => {
100
100
  const a = o.level, n = (s + i + d) * a + b * (a ? a - 1 : 0) - (i - b) * (a ? 1 : 0);
101
101
  o.top = n;
102
102
  });
103
- }, nt = (r, u, c, e, t) => {
104
- const s = u || R, i = c || b, o = (e || z) + (t || D) + A;
105
- return Math.max(...r.map((n) => {
106
- const h = n.top || 0, l = Math.max(...n.groupedItems.map((E) => E.items.length)), g = n.hasChildren ? b : 0, L = n.orientation === "horizontal" ? s + i + o + i + g : l * (s + i) + o + i;
107
- return h + L;
103
+ }, st = (m, u, r, e, t) => {
104
+ const s = u || k, i = r || b, o = (e || z) + (t || A) + D;
105
+ return Math.max(...m.map((n) => {
106
+ const h = n.top || 0, l = Math.max(...n.groupedItems.map((E) => E.items.length)), I = n.hasChildren ? b : 0, x = n.orientation === "horizontal" ? s + i + o + i + I : l * (s + i) + o + i;
107
+ return h + x;
108
108
  }));
109
- }, st = (r) => {
109
+ }, ot = (m) => {
110
110
  const u = {
111
111
  width: "100%",
112
112
  data: [],
@@ -117,9 +117,10 @@ const N = ({
117
117
  titleField: "title",
118
118
  subtitleField: "subtitle",
119
119
  expandField: "expanded",
120
- orientation: "horizontal"
120
+ orientation: "horizontal",
121
+ showAvatar: !0
121
122
  }, {
122
- id: c,
123
+ id: r,
123
124
  width: e,
124
125
  data: t,
125
126
  groupField: s,
@@ -130,18 +131,20 @@ const N = ({
130
131
  verticalLine: n,
131
132
  idField: h,
132
133
  childrenField: l,
133
- expandField: g,
134
- hasChildrenField: L,
134
+ expandField: I,
135
+ hasChildrenField: x,
135
136
  avatarField: E,
136
- titleField: w,
137
- subtitleField: G,
137
+ titleField: L,
138
+ subtitleField: C,
138
139
  cardsColors: T,
139
- ariaLabel: I,
140
- itemRender: y,
141
- groupTitleRender: S,
140
+ ariaLabel: p,
141
+ itemRender: S,
142
+ groupTitleRender: _,
142
143
  groupSubtitleRender: W,
143
- height: U
144
- } = { ...u, ...r }, H = [{
144
+ height: N,
145
+ avatarType: U,
146
+ showAvatar: B
147
+ } = { ...u, ...m }, H = [{
145
148
  items: t,
146
149
  level: 0,
147
150
  hasChildren: !0,
@@ -150,111 +153,111 @@ const N = ({
150
153
  parentId: null,
151
154
  width: null
152
155
  }];
153
- N({
156
+ P({
154
157
  dataByGroups: H,
155
158
  data: t,
156
159
  cardWidth: i,
157
- expandField: g,
158
- hasChildrenField: L,
160
+ expandField: I,
161
+ hasChildrenField: x,
159
162
  childrenField: l,
160
163
  idField: h,
161
164
  groupField: s
162
- }), H.map((m) => {
163
- m.groupedItems = X(m.items, [{ field: s }]);
164
- }), tt(H, i), et(H, h), it(
165
+ }), H.map((c) => {
166
+ c.groupedItems = Y(c.items, [{ field: s }]);
167
+ }), et(H, i), it(H, h), nt(
165
168
  H,
166
- d || R,
169
+ d || k,
167
170
  o || z,
168
- a || D,
171
+ a || A,
169
172
  n
170
173
  );
171
- const $ = nt(
174
+ const $ = st(
172
175
  H,
173
- d || R,
176
+ d || k,
174
177
  o || z,
175
- a || D
178
+ a || A
176
179
  );
177
- return /* @__PURE__ */ O.createElement("div", { className: "k-orgchart-container", style: { width: e, height: U || $ } }, H.map((m) => {
178
- const p = m.level, k = m.groupedItems.map((f) => {
179
- const M = f.items.some((C) => C[g]);
180
+ return /* @__PURE__ */ R.createElement("div", { className: "k-orgchart-container", style: { width: e, height: N || $ } }, H.map((c) => {
181
+ const w = c.level, O = c.groupedItems.map((f) => {
182
+ const M = f.items.some((G) => G[I]);
180
183
  return {
181
184
  ...f,
182
185
  expanded: M
183
186
  };
184
- }), j = k.filter((f) => f.expanded), P = p === 0 ? "center" : "around", _ = "horizontal", B = T && T[p] || "green";
185
- return /* @__PURE__ */ O.createElement(
187
+ }), F = O.filter((f) => f.expanded), y = "horizontal", K = T && T[w] || "green";
188
+ return /* @__PURE__ */ R.createElement(
186
189
  "div",
187
190
  {
188
- role: p === 0 ? "tree" : "group",
189
- id: c + "-" + p + "-" + m.ids[0],
190
- "aria-label": p === 0 ? I : void 0,
191
- "aria-orientation": p === 0 ? _ : void 0,
192
- key: m.ids[0] + "_" + p,
193
- className: Z(
191
+ role: w === 0 ? "tree" : "group",
192
+ id: r + "-" + w + "-" + c.ids[0],
193
+ "aria-label": w === 0 ? p : void 0,
194
+ "aria-orientation": w === 0 ? y : void 0,
195
+ key: c.ids[0] + "_" + w,
196
+ className: q(
194
197
  "k-orgchart-group",
195
- `k-orgchart-level-${p}`,
198
+ `k-orgchart-level-${w}`,
196
199
  "k-pos-absolute",
197
200
  {
198
- [`k-${q.orientationMap[_]}`]: _,
199
- [`k-justify-content-${P}`]: P,
200
- "k-orgchart-group-h": r.groupField
201
+ [`k-${J.orientationMap[y]}`]: y
201
202
  }
202
203
  ),
203
204
  style: {
204
- width: m.width || "100%",
205
- left: m.left,
206
- top: m.top
205
+ width: c.width || "100%",
206
+ left: c.left,
207
+ top: c.top
207
208
  }
208
209
  },
209
- t.length > 0 && k.map((f, M) => {
210
- const C = f.items.some((v) => v[l] && v[l].length || L && v[L]), F = m.width ? (m.width - (k.length - 1) * x) / k.length : void 0, K = j.findIndex((v) => v === f);
211
- return /* @__PURE__ */ O.createElement(
212
- Q,
210
+ t.length > 0 && O.map((f, M) => {
211
+ const G = f.items.some((g) => g[l] && g[l].length || x && g[x]), V = c.width ? (c.width - (O.length - 1) * v) / O.length : void 0, Z = F.findIndex((g) => g === f);
212
+ return /* @__PURE__ */ R.createElement(
213
+ X,
213
214
  {
214
- id: c + "-" + (p + 1) + "-" + f.items[0][h],
215
- style: { width: F },
215
+ id: r + "-" + (w + 1) + "-" + f.items[0][h],
216
+ style: { width: V },
216
217
  groupTitleHeight: o,
217
218
  groupSubtitleHeight: a,
218
- groupTitleRender: S,
219
+ groupTitleRender: _,
219
220
  groupSubtitleRender: W,
220
221
  key: M,
221
- level: p,
222
+ level: w,
222
223
  verticalLine: n || b,
223
- title: f.items[0][s || w],
224
+ title: f.items[0][s || L],
224
225
  subtitle: s,
225
- orientation: m.orientation,
226
- childLineWidth: C && f.expanded && m.orientation === "horizontal" ? m.childLineWidths[K] : 0,
227
- line: C,
226
+ orientation: c.orientation,
227
+ childLineWidth: G && f.expanded && c.orientation === "horizontal" ? c.childLineWidths[Z] : 0,
228
+ line: G,
228
229
  nodes: f.items,
229
230
  expanded: f.expanded,
230
- plus: C
231
+ plus: G
231
232
  },
232
- f.items.map((v, V) => /* @__PURE__ */ O.createElement(
233
- J,
233
+ f.items.map((g, j) => /* @__PURE__ */ R.createElement(
234
+ Q,
234
235
  {
235
236
  cardHeight: d,
236
237
  cardWidth: i,
237
- itemRender: y,
238
- color: B,
239
- key: V,
240
- level: p,
241
- avatar: v[E],
242
- title: v[w],
243
- subtitle: v[G],
238
+ itemRender: S,
239
+ color: K,
240
+ key: j,
241
+ level: w,
242
+ avatar: g[E],
243
+ avatarType: U,
244
+ showAvatar: B,
245
+ title: g[L],
246
+ subtitle: g[C],
244
247
  verticalLine: 0,
245
248
  line: !1,
246
- node: v,
249
+ node: g,
247
250
  childLineWidth: 0,
248
251
  plus: !1
249
252
  },
250
- v.text
253
+ g.text
251
254
  ))
252
255
  );
253
256
  })
254
257
  );
255
258
  }));
256
259
  };
257
- st.displayName = "KendoServerGroupedOrgChart";
260
+ ot.displayName = "KendoServerGroupedOrgChart";
258
261
  export {
259
- st as ServerGroupedOrgChart
262
+ ot as ServerGroupedOrgChart
260
263
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),T=require("@progress/kendo-react-common"),D=require("./ServerOrgChartNode.js"),m=require("../utils/consts.js");function z(o){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(c,s,n.get?n:{enumerable:!0,get:()=>o[s]})}}return c.default=o,Object.freeze(c)}const H=z(j),W=({dataByGroups:o,data:c=[],cardWidth:s,childrenField:n,idField:e,expandField:t,hasChildrenField:i,groupField:l,level:v=1,parentId:d=0})=>{c.forEach(h=>{const L=h[n];if(h[t]&&L&&L.length){const a=L.some(O=>O[n]&&O[n].length||i&&O[i]),I=a?"horizontal":"vertical",f=a?null:s;o.push({ids:[h[e]],items:L,level:v,parentId:d,hasChildren:a,orientation:I,width:f}),W({dataByGroups:o,data:h[n],childrenField:n,cardWidth:s,idField:e,expandField:t,hasChildrenField:i,groupField:l,level:v+1,parentId:h[e]})}})},G=(o,c)=>{const s=c||m.NODE_WIDTH,n=o.sort((e,t)=>t.level-e.level);n.forEach(e=>{if(!e.width){const t=n.filter(d=>e.ids.includes(d.parentId)),i=t.length?Math.max(...t.map(d=>d.width||0)):s,l=e.orientation==="horizontal"?e.items.length:1,v=i*l+m.HORIZONTAL_GAP*(l-1);e.width=v}})},V=(o,c,s)=>{const n=o.sort((e,t)=>e.level-t.level);n.forEach(e=>{if(e.level===0)return;const t=n.find(a=>a.ids.includes(e.parentId)),i=(t==null?void 0:t.items.findIndex(a=>e.ids.includes(a[s])))||0,l=(t==null?void 0:t.items)||[],v=t.width?(t.width-(l.length-1)*m.HORIZONTAL_GAP)/l.length:0;if(!e.left){let a=(t==null?void 0:t.left)||0;l.forEach((I,f)=>{f<i&&(a+=v+m.HORIZONTAL_GAP)}),e.left=a}const d=(t==null?void 0:t.width)||0,h=(t==null?void 0:t.items.length)||1,L=(d-(h-1)*m.HORIZONTAL_GAP)/h;e.width=L;const E=t==null?void 0:t.items.map(a=>{const I=a[c]?a[c].length:0,f=n.find(_=>_.ids.includes(a[s])),O=(f==null?void 0:f.width)||0;return(f==null?void 0:f.orientation)==="vertical"||I===0||!a.expanded?0:O-(O-(I-1)*m.HORIZONTAL_GAP)/I});t&&(t.childLineWidths=E)})},F=(o,c,s)=>{const n=c||m.NODE_HEIGHT,e=s||m.VERTICAL_LINE;o.forEach(t=>{const i=t.level,l=(n+e)*i+m.VERTICAL_LINE*(i?i-1:0)-(e-m.VERTICAL_LINE)*(i?1:0);t.top=l})},Z=(o,c,s)=>{const n=c||m.NODE_HEIGHT,e=s||m.VERTICAL_LINE;return Math.max(...o.map(i=>{const l=i.top||0,v=i.items.length,d=i.orientation==="horizontal"?n+e+e:v*(n+e);return l+d}))},A=o=>{const c={width:"100%",data:[],ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",expandField:"expanded"},{id:s,width:n,data:e,groupField:t,cardWidth:i,cardHeight:l,verticalLine:v,idField:d,childrenField:h,hasChildrenField:L,expandField:E,avatarField:a,titleField:I,subtitleField:f,ariaLabel:O,itemRender:_,height:x}={...c,...o},w=[{items:e,level:0,hasChildren:!0,orientation:"horizontal",ids:[0],parentId:null,width:null}];W({dataByGroups:w,data:e,cardWidth:i,expandField:E,hasChildrenField:L,childrenField:h,idField:d,groupField:t}),G(w,i),V(w,h,d),F(w,l,v);const p=Z(w,l,v);return H.createElement("div",{className:"k-orgchart-container",style:{width:n,height:x||p}},w.map(r=>{const g=r.level,k=r.items,y=g===0?"center":"around",C=r.orientation;return H.createElement("div",{role:g===0?"tree":"group",id:s+"-"+g+"-"+r.ids[0],"aria-label":g===0?O:void 0,"aria-orientation":g===0?C:void 0,key:r.ids[0]+"_"+g,className:T.classNames("k-orgchart-group",`k-orgchart-level-${g}`,"k-pos-absolute",{[`k-${T.kendoThemeMaps.orientationMap[C]}`]:C,[`k-justify-content-${y}`]:y}),style:{width:r.width||"100%",left:r.left,top:r.top}},k.length>0&&H.createElement("div",{role:"group",style:{width:"100%"},className:T.classNames("k-orgchart-node-container","k-justify-content-around",{[`k-${T.kendoThemeMaps.orientationMap[r.orientation]}`]:r.orientation})},k.map((u,N)=>{const b=u[h]&&u[h].length||L&&u[L],S=b||r.orientation==="vertical"&&N!==k.length-1,M=r.orientation==="vertical"&&N!==0?0:v||m.VERTICAL_LINE,P=r.childLineWidths?Math.max(...r.childLineWidths):void 0,R=u[E];return H.createElement(D.ServerOrgChartNode,{id:s+"-"+(g+1)+"-"+u[d],style:{width:P},itemRender:_,cardHeight:l,cardWidth:i,verticalLine:M,key:N,level:g,avatar:u[a],title:u[I],subtitle:u[f],line:S,expanded:R,node:u,childLineWidth:b&&R&&r.orientation==="horizontal"?r.childLineWidths[N]:0,plus:b},u.text)})))}))};A.displayName="KendoServerOrgChart";exports.ServerOrgChart=A;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),T=require("@progress/kendo-react-common"),z=require("./ServerOrgChartNode.js"),v=require("../utils/consts.js");function G(a){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(l,s,i.get?i:{enumerable:!0,get:()=>a[s]})}}return l.default=a,Object.freeze(l)}const H=G(j),C=({dataByGroups:a,data:l=[],cardWidth:s,childrenField:i,idField:e,expandField:t,hasChildrenField:n,groupField:c,level:m=1,parentId:d=0})=>{l.forEach(h=>{const f=h[i];if(h[t]&&f&&f.length){const o=f.some(w=>w[i]&&w[i].length||n&&w[n]),u=o?"horizontal":"vertical",L=o?null:s;a.push({ids:[h[e]],items:f,level:m,parentId:d,hasChildren:o,orientation:u,width:L}),C({dataByGroups:a,data:h[i],childrenField:i,cardWidth:s,idField:e,expandField:t,hasChildrenField:n,groupField:c,level:m+1,parentId:h[e]})}})},V=(a,l)=>{const s=l||v.NODE_WIDTH,i=a.sort((e,t)=>t.level-e.level);i.forEach(e=>{if(!e.width){const t=i.filter(d=>e.ids.includes(d.parentId)),n=t.length?Math.max(...t.map(d=>d.width||0)):s,c=e.orientation==="horizontal"?e.items.length:1,m=n*c+v.HORIZONTAL_GAP*(c-1);e.width=m}})},F=(a,l,s)=>{const i=a.sort((e,t)=>e.level-t.level);i.forEach(e=>{if(e.level===0)return;const t=i.find(o=>o.ids.includes(e.parentId)),n=(t==null?void 0:t.items.findIndex(o=>e.ids.includes(o[s])))||0,c=(t==null?void 0:t.items)||[],m=t.width?(t.width-(c.length-1)*v.HORIZONTAL_GAP)/c.length:0;if(!e.left){let o=(t==null?void 0:t.left)||0;c.forEach((u,L)=>{L<n&&(o+=m+v.HORIZONTAL_GAP)}),e.left=o}const d=(t==null?void 0:t.width)||0,h=(t==null?void 0:t.items.length)||1,f=(d-(h-1)*v.HORIZONTAL_GAP)/h;e.width=f;const E=t==null?void 0:t.items.map(o=>{const u=o[l]?o[l].length:0,L=i.find(_=>_.ids.includes(o[s])),w=(L==null?void 0:L.width)||0;return(L==null?void 0:L.orientation)==="vertical"||u===0||!o.expanded?0:w-(w-(u-1)*v.HORIZONTAL_GAP)/u});t&&(t.childLineWidths=E)})},Z=(a,l,s)=>{const i=l||v.NODE_HEIGHT,e=s||v.VERTICAL_LINE;a.forEach(t=>{const n=t.level,c=(i+e)*n+v.VERTICAL_LINE*(n?n-1:0)-(e-v.VERTICAL_LINE)*(n?1:0);t.top=c})},q=(a,l,s)=>{const i=l||v.NODE_HEIGHT,e=s||v.VERTICAL_LINE;return Math.max(...a.map(n=>{const c=n.top||0,m=n.items.length,d=n.orientation==="horizontal"?i+e+e:m*(i+e);return c+d}))},R=a=>{const l={width:"100%",data:[],ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",expandField:"expanded",avatarType:"image",showAvatar:!0},{id:s,width:i,data:e,groupField:t,cardWidth:n,cardHeight:c,verticalLine:m,idField:d,childrenField:h,hasChildrenField:f,expandField:E,avatarField:o,titleField:u,subtitleField:L,ariaLabel:w,itemRender:_,height:W,avatarType:p,showAvatar:x}={...l,...a},O=[{items:e,level:0,hasChildren:!0,orientation:"horizontal",ids:[0],parentId:null,width:null}];C({dataByGroups:O,data:e,cardWidth:n,expandField:E,hasChildrenField:f,childrenField:h,idField:d,groupField:t}),V(O,n),F(O,h,d),Z(O,c,m);const S=q(O,c,m);return H.createElement("div",{className:"k-orgchart-container",style:{width:i,height:W||S}},O.map(r=>{const I=r.level,A=r.items,b=r.orientation;return H.createElement("div",{role:I===0?"tree":"group",id:s+"-"+I+"-"+r.ids[0],"aria-label":I===0?w:void 0,"aria-orientation":I===0?b:void 0,key:r.ids[0]+"_"+I,className:T.classNames("k-orgchart-group",`k-orgchart-level-${I}`,"k-pos-absolute",{[`k-${T.kendoThemeMaps.orientationMap[b]}`]:b}),style:{width:r.width||"100%",left:r.left,top:r.top}},A.length>0&&H.createElement("div",{role:"group",style:{width:"100%"},className:T.classNames("k-orgchart-node-container","k-justify-content-around",{[`k-${T.kendoThemeMaps.orientationMap[r.orientation]}`]:r.orientation})},A.map((g,N)=>{const k=g[h]&&g[h].length||f&&g[f],M=k||r.orientation==="vertical"&&N!==A.length-1,P=r.orientation==="vertical"&&N!==0?0:m||v.VERTICAL_LINE,D=r.childLineWidths?Math.max(...r.childLineWidths):void 0,y=g[E];return H.createElement(z.ServerOrgChartNode,{id:s+"-"+(I+1)+"-"+g[d],style:{width:D},itemRender:_,cardHeight:c,cardWidth:n,verticalLine:P,key:N,level:I,avatar:g[o],avatarType:p,showAvatar:x,title:g[u],subtitle:g[L],line:M,expanded:y,node:g,childLineWidth:k&&y&&r.orientation==="horizontal"?r.childLineWidths[N]:0,plus:k},g.text)})))}))};R.displayName="KendoServerOrgChart";exports.ServerOrgChart=R;