@progress/kendo-react-orgchart 7.2.4-develop.3 → 7.2.4-develop.4
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/OrgChart.js +8 -0
- package/OrgChart.mjs +83 -0
- package/client/ClientOrgChart.js +8 -0
- package/client/ClientOrgChart.mjs +236 -0
- package/client/ExpandButton.js +8 -0
- package/client/ExpandButton.mjs +36 -0
- package/client/OrgChartCard.js +8 -0
- package/client/OrgChartCard.mjs +59 -0
- package/client/OrgChartCardBody.js +8 -0
- package/client/OrgChartCardBody.mjs +18 -0
- package/client/OrgChartGroupContainer.js +8 -0
- package/client/OrgChartGroupContainer.mjs +58 -0
- package/dist/cdn/js/kendo-react-orgchart.js +8 -18
- package/index.d.mts +520 -5
- package/index.d.ts +520 -12
- package/index.js +8 -18
- package/index.mjs +17 -1146
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +4 -4
- package/processOrgChartItems.js +8 -0
- package/processOrgChartItems.mjs +84 -0
- package/server/ServerGroupedOrgChart.js +8 -0
- package/server/ServerGroupedOrgChart.mjs +260 -0
- package/server/ServerOrgChart.js +8 -0
- package/server/ServerOrgChart.mjs +210 -0
- package/server/ServerOrgChartGroup.js +8 -0
- package/server/ServerOrgChartGroup.mjs +114 -0
- package/server/ServerOrgChartNode.js +8 -0
- package/server/ServerOrgChartNode.mjs +95 -0
- package/theming/theme-service.js +21 -0
- package/theming/theme-service.mjs +60 -0
- package/utils/consts.js +8 -0
- package/utils/consts.mjs +24 -0
- package/OrgChart.d.ts +0 -10
- package/OrgChartOperationDescriptors.d.ts +0 -80
- package/client/ClientOrgChart.d.ts +0 -98
- package/client/ExpandButton.d.ts +0 -17
- package/client/OrgChartCard.d.ts +0 -23
- package/client/OrgChartCardBody.d.ts +0 -16
- package/client/OrgChartGroupContainer.d.ts +0 -23
- package/interfaces/ChildGroup.d.ts +0 -20
- package/interfaces/OrgChartActionEvent.d.ts +0 -25
- package/interfaces/OrgChartExpandChangeEvent.d.ts +0 -25
- package/interfaces/SeverOrgChartProps.d.ts +0 -109
- package/package-metadata.d.ts +0 -9
- package/processOrgChartItems.d.ts +0 -55
- package/server/ServerGroupedOrgChart.d.ts +0 -12
- package/server/ServerOrgChart.d.ts +0 -12
- package/server/ServerOrgChartGroup.d.ts +0 -100
- package/server/ServerOrgChartNode.d.ts +0 -79
- package/theming/theme-service.d.ts +0 -9
- package/utils/consts.d.ts +0 -76
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-orgchart",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",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"};exports.packageMetadata=e;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
const e = {
|
|
10
|
+
name: "@progress/kendo-react-orgchart",
|
|
11
|
+
productName: "KendoReact",
|
|
12
|
+
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
+
publishDate: 1709714553,
|
|
14
|
+
version: "",
|
|
15
|
+
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"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
e as packageMetadata
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-orgchart",
|
|
3
|
-
"version": "7.2.4-develop.
|
|
3
|
+
"version": "7.2.4-develop.4",
|
|
4
4
|
"description": "React OrgChart renders a message to the user with information about the status of an app process. KendoReact OrgChart package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-data-query": "^1.0.0",
|
|
26
26
|
"@progress/kendo-licensing": "^1.3.4",
|
|
27
|
-
"@progress/kendo-react-buttons": "7.2.4-develop.
|
|
28
|
-
"@progress/kendo-react-common": "7.2.4-develop.
|
|
29
|
-
"@progress/kendo-react-layout": "7.2.4-develop.
|
|
27
|
+
"@progress/kendo-react-buttons": "7.2.4-develop.4",
|
|
28
|
+
"@progress/kendo-react-common": "7.2.4-develop.4",
|
|
29
|
+
"@progress/kendo-react-layout": "7.2.4-develop.4",
|
|
30
30
|
"@progress/kendo-svg-icons": "^2.1.0",
|
|
31
31
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
32
32
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@progress/kendo-react-common"),d=require("./utils/consts.js");function C(n,t){if(!n||!n.length)return[];let e=n;const l=t.cloneField||"cloned",i=t.expandField||d.EXPAND_FIELD,s=t.selectField||d.SELECT_FIELD,r=t.checkField||d.CHECK_FIELD,c=t.childrenField||d.CHILDREN_FIELD;return e=o(e,i,t.expand,l,c),e=o(e,s,t.select,l,c),e=o(e,r,t.check,l,c),a(e,c,t.check),e}function o(n,t,e,l,i){if(e){const{ids:s,field:r}=E(e,t),c=!f.isArray(e)&&e.idField?f.resolveItemsIds(s,e.idField,n,i):s;return F(n,c,r,l,i)}else return n}function E(n,t){let e,l;return f.isArray(n)?(e=n,l=t):(e=n.ids||[],l=n.operationField||t),{ids:e,field:l}}function F(n,t,e,l,i){let s=n;return t.forEach(r=>{s=f.updateItem(s,r,c=>g(e,c),l,i)}),s}function g(n,t){const e=(n||"").split(".");let l=t;for(let i=0;i<e.length;i++){const s=e[i];if(i===e.length-1)l[s]=!0;else if(l[s]!==void 0)l[s]={...l[s]},l=l[s];else return}}function a(n,t,e){if(e&&!f.isArray(e)&&e.applyCheckIndeterminate){const{field:l}=E(e,d.CHECK_FIELD),i=e.checkIndeterminateField||d.CHECK_INDETERMINATE_FIELD;for(let s=0;s<n.length;s++){const r=n[s],c=r[t];c&&I(c,f.getNestedValue(l,r)?[]:[r],t,l,i)}}}function I(n,t,e,l,i){let s=!1;for(let r=0;r<n.length;r++){const c=n[r];if(f.getNestedValue(l,c)){if(!s)for(let u=0;u<t.length;u++)g(i,t[u]);s=!0,c[e]&&I(c[e],[],e,l,i)}else c[e]&&I(c[e],s?[c]:t.concat([c]),e,l,i)}}exports.processOrgChartItems=C;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import { isArray as I, resolveItemsIds as g, updateItem as C, getNestedValue as E } from "@progress/kendo-react-common";
|
|
10
|
+
import { EXPAND_FIELD as D, SELECT_FIELD as L, CHECK_FIELD as o, CHILDREN_FIELD as h, CHECK_INDETERMINATE_FIELD as N } from "./utils/consts.mjs";
|
|
11
|
+
function a(n, t) {
|
|
12
|
+
if (!n || !n.length)
|
|
13
|
+
return [];
|
|
14
|
+
let e = n;
|
|
15
|
+
const l = t.cloneField || "cloned", f = t.expandField || D, s = t.selectField || L, c = t.checkField || o, i = t.childrenField || h;
|
|
16
|
+
return e = d(e, f, t.expand, l, i), e = d(e, s, t.select, l, i), e = d(e, c, t.check, l, i), p(e, i, t.check), e;
|
|
17
|
+
}
|
|
18
|
+
function d(n, t, e, l, f) {
|
|
19
|
+
if (e) {
|
|
20
|
+
const { ids: s, field: c } = m(e, t), i = !I(e) && e.idField ? g(s, e.idField, n, f) : s;
|
|
21
|
+
return _(n, i, c, l, f);
|
|
22
|
+
} else
|
|
23
|
+
return n;
|
|
24
|
+
}
|
|
25
|
+
function m(n, t) {
|
|
26
|
+
let e, l;
|
|
27
|
+
return I(n) ? (e = n, l = t) : (e = n.ids || [], l = n.operationField || t), { ids: e, field: l };
|
|
28
|
+
}
|
|
29
|
+
function _(n, t, e, l, f) {
|
|
30
|
+
let s = n;
|
|
31
|
+
return t.forEach((c) => {
|
|
32
|
+
s = C(s, c, (i) => F(e, i), l, f);
|
|
33
|
+
}), s;
|
|
34
|
+
}
|
|
35
|
+
function F(n, t) {
|
|
36
|
+
const e = (n || "").split(".");
|
|
37
|
+
let l = t;
|
|
38
|
+
for (let f = 0; f < e.length; f++) {
|
|
39
|
+
const s = e[f];
|
|
40
|
+
if (f === e.length - 1)
|
|
41
|
+
l[s] = !0;
|
|
42
|
+
else if (l[s] !== void 0)
|
|
43
|
+
l[s] = { ...l[s] }, l = l[s];
|
|
44
|
+
else
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function p(n, t, e) {
|
|
49
|
+
if (e && !I(e) && e.applyCheckIndeterminate) {
|
|
50
|
+
const { field: l } = m(e, o), f = e.checkIndeterminateField || N;
|
|
51
|
+
for (let s = 0; s < n.length; s++) {
|
|
52
|
+
const c = n[s], i = c[t];
|
|
53
|
+
i && u(
|
|
54
|
+
i,
|
|
55
|
+
E(l, c) ? [] : [c],
|
|
56
|
+
t,
|
|
57
|
+
l,
|
|
58
|
+
f
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function u(n, t, e, l, f) {
|
|
64
|
+
let s = !1;
|
|
65
|
+
for (let c = 0; c < n.length; c++) {
|
|
66
|
+
const i = n[c];
|
|
67
|
+
if (E(l, i)) {
|
|
68
|
+
if (!s)
|
|
69
|
+
for (let r = 0; r < t.length; r++)
|
|
70
|
+
F(f, t[r]);
|
|
71
|
+
s = !0, i[e] && u(i[e], [], e, l, f);
|
|
72
|
+
} else
|
|
73
|
+
i[e] && u(
|
|
74
|
+
i[e],
|
|
75
|
+
s ? [i] : t.concat([i]),
|
|
76
|
+
e,
|
|
77
|
+
l,
|
|
78
|
+
f
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
a as processOrgChartItems
|
|
84
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),y=require("@progress/kendo-react-common"),B=require("./ServerOrgChartNode.js"),$=require("./ServerOrgChartGroup.js"),F=require("@progress/kendo-data-query"),n=require("../utils/consts.js");function K(o){const I=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(I,a,e.get?e:{enumerable:!0,get:()=>o[a]})}}return I.default=o,Object.freeze(I)}const x=K(V),W=({dataByGroups:o,data:I=[],cardWidth:a,childrenField:e,idField:t,expandField:r,hasChildrenField:i,groupField:c,level:d=1,parentId:l=0})=>{I.forEach(s=>{const h=s[e];if(s[r]&&h&&h.length){const g=h.some(O=>O[e]&&O[e].length||i&&O[i]),H=g?"horizontal":"vertical",p=g?null:a+2*n.HORIZONTAL_GAP,E=o.find(O=>O.parentId===l),A=o.find(O=>O.ids.includes(l));let G=!1;if(E){const O=E.ids[0],b=A.items.find(v=>v[t]===O),N=A.items.find(v=>v[t]===s[t]);G=b[c]===N[c]}E&&G?(E.ids.push(s[t]),E.items=E.items.concat(h)):o.push({ids:[s[t]],items:h,level:d,parentId:l,hasChildren:g,orientation:H,width:p}),W({dataByGroups:o,data:s[e],childrenField:e,cardWidth:a,idField:t,expandField:r,hasChildrenField:i,groupField:c,level:d+1,parentId:s[t]})}})},Q=(o,I)=>{const a=I||n.NODE_WIDTH,e=o.sort((t,r)=>r.level-t.level);e.forEach(t=>{if(!t.width){const r=e.filter(i=>t.ids.includes(i.parentId));if(r.length){const i=Math.max(...r.map(s=>s.width||0)),c=Math.max(...r.map(s=>s.groupedItems.length||0)),d=Math.max(...t.groupedItems.map(s=>{const h=t.orientation==="horizontal"?s.items.length:1;return h*(a+2*n.HORIZONTAL_GAP)+n.HORIZONTAL_GAP*(h-1)})),l=i*c+n.HORIZONTAL_GAP*(c-1);t.width=Math.max(l,d)}else{const i=Math.max(...t.groupedItems.map(c=>{const d=t.orientation==="horizontal"?c.items.length:1;return d*(a+2*n.HORIZONTAL_GAP)+n.HORIZONTAL_GAP*(d-1)}));t.width=i}}})},J=(o,I)=>{const a=o.sort((e,t)=>e.level-t.level);a.forEach(e=>{var h;if(e.level===0)return;const t=a.find(m=>m.ids.includes(e.parentId)),r=(t==null?void 0:t.groupedItems.findIndex(m=>m.items.some(g=>e.ids.includes(g[I]))))||0,i=(t==null?void 0:t.groupedItems)||[],c=t.width?(t.width-(i.length-1)*n.HORIZONTAL_GAP)/i.length:0;if(!e.left){let m=(t==null?void 0:t.left)||0;i.forEach((g,H)=>{H<r&&(m+=c+n.HORIZONTAL_GAP)}),e.left=m}const d=(t==null?void 0:t.width)||0,l=(t==null?void 0:t.groupedItems.length)||1,s=(d-(l-1)*n.HORIZONTAL_GAP)/l;if(e.width=s,t){const m=e.width-(e.width-(e.groupedItems.length-1)*n.HORIZONTAL_GAP)/e.groupedItems.length;t.childLineWidths?(h=t.childLineWidths)==null||h.push(m):t.childLineWidths=[m]}})},X=(o,I,a,e,t)=>{const r=I||n.NODE_HEIGHT,i=t||n.VERTICAL_LINE,c=a+e+n.GROUP_PADDINGS;o.forEach(d=>{const l=d.level,s=(r+i+c)*l+n.VERTICAL_LINE*(l?l-1:0)-(i-n.VERTICAL_LINE)*(l?1:0);d.top=s})},Y=(o,I,a,e,t)=>{const r=I||n.NODE_HEIGHT,i=a||n.VERTICAL_LINE,d=(e||n.GROUP_TITLE_HEIGHT)+(t||n.GROUP_SUBTITLE_HEIGHT)+n.GROUP_PADDINGS;return Math.max(...o.map(s=>{const h=s.top||0,m=Math.max(...s.groupedItems.map(p=>p.items.length)),g=s.hasChildren?n.VERTICAL_LINE:0,H=s.orientation==="horizontal"?r+i+d+i+g:m*(r+i)+d+i;return h+H}))},k=o=>{const I={width:"100%",data:[],ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",expandField:"expanded",orientation:"horizontal"},{id:a,width:e,data:t,groupField:r,cardWidth:i,cardHeight:c,groupTitleHeight:d,groupSubtitleHeight:l,verticalLine:s,idField:h,childrenField:m,expandField:g,hasChildrenField:H,avatarField:p,titleField:E,subtitleField:A,cardsColors:G,ariaLabel:O,itemRender:b,groupTitleRender:N,groupSubtitleRender:v,height:D}={...I,...o},_=[{items:t,level:0,hasChildren:!0,orientation:"horizontal",ids:[0],parentId:null,width:null}];W({dataByGroups:_,data:t,cardWidth:i,expandField:g,hasChildrenField:H,childrenField:m,idField:h,groupField:r}),_.map(u=>{u.groupedItems=F.groupBy(u.items,[{field:r}])}),Q(_,i),J(_,h),X(_,c||n.NODE_HEIGHT,d||n.GROUP_TITLE_HEIGHT,l||n.GROUP_SUBTITLE_HEIGHT,s);const M=Y(_,c||n.NODE_HEIGHT,d||n.GROUP_TITLE_HEIGHT,l||n.GROUP_SUBTITLE_HEIGHT);return x.createElement("div",{className:"k-orgchart-container",style:{width:e,height:D||M}},_.map(u=>{const T=u.level,w=u.groupedItems.map(L=>{const C=L.items.some(R=>R[g]);return{...L,expanded:C}}),U=w.filter(L=>L.expanded),S=T===0?"center":"around",P="horizontal",Z=G&&G[T]||"green";return x.createElement("div",{role:T===0?"tree":"group",id:a+"-"+T+"-"+u.ids[0],"aria-label":T===0?O:void 0,"aria-orientation":T===0?P:void 0,key:u.ids[0]+"_"+T,className:y.classNames("k-orgchart-group",`k-orgchart-level-${T}`,"k-pos-absolute",{[`k-${y.kendoThemeMaps.orientationMap[P]}`]:P,[`k-justify-content-${S}`]:S,"k-orgchart-group-h":o.groupField}),style:{width:u.width||"100%",left:u.left,top:u.top}},t.length>0&&w.map((L,C)=>{const R=L.items.some(f=>f[m]&&f[m].length||H&&f[H]),z=u.width?(u.width-(w.length-1)*n.HORIZONTAL_GAP)/w.length:void 0,j=U.findIndex(f=>f===L);return x.createElement($.ServerOrgChartGroup,{id:a+"-"+(T+1)+"-"+L.items[0][h],style:{width:z},groupTitleHeight:d,groupSubtitleHeight:l,groupTitleRender:N,groupSubtitleRender:v,key:C,level:T,verticalLine:s||n.VERTICAL_LINE,title:L.items[0][r||E],subtitle:r,orientation:u.orientation,childLineWidth:R&&L.expanded&&u.orientation==="horizontal"?u.childLineWidths[j]:0,line:R,nodes:L.items,expanded:L.expanded,plus:R},L.items.map((f,q)=>x.createElement(B.ServerOrgChartNode,{cardHeight:c,cardWidth:i,itemRender:b,color:Z,key:q,level:T,avatar:f[p],title:f[E],subtitle:f[A],verticalLine:0,line:!1,node:f,childLineWidth:0,plus:!1},f.text)))}))}))};k.displayName="KendoServerGroupedOrgChart";exports.ServerGroupedOrgChart=k;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
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,
|
|
17
|
+
data: u = [],
|
|
18
|
+
cardWidth: c,
|
|
19
|
+
childrenField: e,
|
|
20
|
+
idField: t,
|
|
21
|
+
expandField: s,
|
|
22
|
+
hasChildrenField: i,
|
|
23
|
+
groupField: d,
|
|
24
|
+
level: o = 1,
|
|
25
|
+
parentId: a = 0
|
|
26
|
+
}) => {
|
|
27
|
+
u.forEach((n) => {
|
|
28
|
+
const h = n[e];
|
|
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));
|
|
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];
|
|
35
|
+
}
|
|
36
|
+
w && T ? (w.ids.push(n[t]), w.items = w.items.concat(h)) : r.push({
|
|
37
|
+
ids: [n[t]],
|
|
38
|
+
items: h,
|
|
39
|
+
level: o,
|
|
40
|
+
parentId: a,
|
|
41
|
+
hasChildren: g,
|
|
42
|
+
orientation: L,
|
|
43
|
+
width: E
|
|
44
|
+
}), N({
|
|
45
|
+
dataByGroups: r,
|
|
46
|
+
data: n[e],
|
|
47
|
+
childrenField: e,
|
|
48
|
+
cardWidth: c,
|
|
49
|
+
idField: t,
|
|
50
|
+
expandField: s,
|
|
51
|
+
hasChildrenField: i,
|
|
52
|
+
groupField: d,
|
|
53
|
+
level: o + 1,
|
|
54
|
+
parentId: n[t]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}, tt = (r, u) => {
|
|
59
|
+
const c = u || Y, e = r.sort((t, s) => s.level - t.level);
|
|
60
|
+
e.forEach((t) => {
|
|
61
|
+
if (!t.width) {
|
|
62
|
+
const s = e.filter((i) => t.ids.includes(i.parentId));
|
|
63
|
+
if (s.length) {
|
|
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
|
+
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);
|
|
68
|
+
t.width = Math.max(a, o);
|
|
69
|
+
} else {
|
|
70
|
+
const i = Math.max(...t.groupedItems.map((d) => {
|
|
71
|
+
const o = t.orientation === "horizontal" ? d.items.length : 1;
|
|
72
|
+
return o * (c + 2 * x) + x * (o - 1);
|
|
73
|
+
}));
|
|
74
|
+
t.width = i;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}, et = (r, u) => {
|
|
79
|
+
const c = r.sort((e, t) => e.level - t.level);
|
|
80
|
+
c.forEach((e) => {
|
|
81
|
+
var h;
|
|
82
|
+
if (e.level === 0)
|
|
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;
|
|
85
|
+
if (!e.left) {
|
|
86
|
+
let l = (t == null ? void 0 : t.left) || 0;
|
|
87
|
+
i.forEach((g, L) => {
|
|
88
|
+
L < s && (l += d + x);
|
|
89
|
+
}), e.left = l;
|
|
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;
|
|
92
|
+
if (e.width = n, t) {
|
|
93
|
+
const l = e.width - (e.width - (e.groupedItems.length - 1) * x) / e.groupedItems.length;
|
|
94
|
+
t.childLineWidths ? (h = t.childLineWidths) == null || h.push(l) : t.childLineWidths = [l];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}, it = (r, u, c, e, t) => {
|
|
98
|
+
const s = u || R, i = t || b, d = c + e + A;
|
|
99
|
+
r.forEach((o) => {
|
|
100
|
+
const a = o.level, n = (s + i + d) * a + b * (a ? a - 1 : 0) - (i - b) * (a ? 1 : 0);
|
|
101
|
+
o.top = n;
|
|
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;
|
|
108
|
+
}));
|
|
109
|
+
}, st = (r) => {
|
|
110
|
+
const u = {
|
|
111
|
+
width: "100%",
|
|
112
|
+
data: [],
|
|
113
|
+
ariaLabel: "Org Chart",
|
|
114
|
+
idField: "id",
|
|
115
|
+
childrenField: "items",
|
|
116
|
+
avatarField: "avatar",
|
|
117
|
+
titleField: "title",
|
|
118
|
+
subtitleField: "subtitle",
|
|
119
|
+
expandField: "expanded",
|
|
120
|
+
orientation: "horizontal"
|
|
121
|
+
}, {
|
|
122
|
+
id: c,
|
|
123
|
+
width: e,
|
|
124
|
+
data: t,
|
|
125
|
+
groupField: s,
|
|
126
|
+
cardWidth: i,
|
|
127
|
+
cardHeight: d,
|
|
128
|
+
groupTitleHeight: o,
|
|
129
|
+
groupSubtitleHeight: a,
|
|
130
|
+
verticalLine: n,
|
|
131
|
+
idField: h,
|
|
132
|
+
childrenField: l,
|
|
133
|
+
expandField: g,
|
|
134
|
+
hasChildrenField: L,
|
|
135
|
+
avatarField: E,
|
|
136
|
+
titleField: w,
|
|
137
|
+
subtitleField: G,
|
|
138
|
+
cardsColors: T,
|
|
139
|
+
ariaLabel: I,
|
|
140
|
+
itemRender: y,
|
|
141
|
+
groupTitleRender: S,
|
|
142
|
+
groupSubtitleRender: W,
|
|
143
|
+
height: U
|
|
144
|
+
} = { ...u, ...r }, H = [{
|
|
145
|
+
items: t,
|
|
146
|
+
level: 0,
|
|
147
|
+
hasChildren: !0,
|
|
148
|
+
orientation: "horizontal",
|
|
149
|
+
ids: [0],
|
|
150
|
+
parentId: null,
|
|
151
|
+
width: null
|
|
152
|
+
}];
|
|
153
|
+
N({
|
|
154
|
+
dataByGroups: H,
|
|
155
|
+
data: t,
|
|
156
|
+
cardWidth: i,
|
|
157
|
+
expandField: g,
|
|
158
|
+
hasChildrenField: L,
|
|
159
|
+
childrenField: l,
|
|
160
|
+
idField: h,
|
|
161
|
+
groupField: s
|
|
162
|
+
}), H.map((m) => {
|
|
163
|
+
m.groupedItems = X(m.items, [{ field: s }]);
|
|
164
|
+
}), tt(H, i), et(H, h), it(
|
|
165
|
+
H,
|
|
166
|
+
d || R,
|
|
167
|
+
o || z,
|
|
168
|
+
a || D,
|
|
169
|
+
n
|
|
170
|
+
);
|
|
171
|
+
const $ = nt(
|
|
172
|
+
H,
|
|
173
|
+
d || R,
|
|
174
|
+
o || z,
|
|
175
|
+
a || D
|
|
176
|
+
);
|
|
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 {
|
|
181
|
+
...f,
|
|
182
|
+
expanded: M
|
|
183
|
+
};
|
|
184
|
+
}), j = k.filter((f) => f.expanded), P = p === 0 ? "center" : "around", _ = "horizontal", B = T && T[p] || "green";
|
|
185
|
+
return /* @__PURE__ */ O.createElement(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
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(
|
|
194
|
+
"k-orgchart-group",
|
|
195
|
+
`k-orgchart-level-${p}`,
|
|
196
|
+
"k-pos-absolute",
|
|
197
|
+
{
|
|
198
|
+
[`k-${q.orientationMap[_]}`]: _,
|
|
199
|
+
[`k-justify-content-${P}`]: P,
|
|
200
|
+
"k-orgchart-group-h": r.groupField
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
style: {
|
|
204
|
+
width: m.width || "100%",
|
|
205
|
+
left: m.left,
|
|
206
|
+
top: m.top
|
|
207
|
+
}
|
|
208
|
+
},
|
|
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,
|
|
213
|
+
{
|
|
214
|
+
id: c + "-" + (p + 1) + "-" + f.items[0][h],
|
|
215
|
+
style: { width: F },
|
|
216
|
+
groupTitleHeight: o,
|
|
217
|
+
groupSubtitleHeight: a,
|
|
218
|
+
groupTitleRender: S,
|
|
219
|
+
groupSubtitleRender: W,
|
|
220
|
+
key: M,
|
|
221
|
+
level: p,
|
|
222
|
+
verticalLine: n || b,
|
|
223
|
+
title: f.items[0][s || w],
|
|
224
|
+
subtitle: s,
|
|
225
|
+
orientation: m.orientation,
|
|
226
|
+
childLineWidth: C && f.expanded && m.orientation === "horizontal" ? m.childLineWidths[K] : 0,
|
|
227
|
+
line: C,
|
|
228
|
+
nodes: f.items,
|
|
229
|
+
expanded: f.expanded,
|
|
230
|
+
plus: C
|
|
231
|
+
},
|
|
232
|
+
f.items.map((v, V) => /* @__PURE__ */ O.createElement(
|
|
233
|
+
J,
|
|
234
|
+
{
|
|
235
|
+
cardHeight: d,
|
|
236
|
+
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],
|
|
244
|
+
verticalLine: 0,
|
|
245
|
+
line: !1,
|
|
246
|
+
node: v,
|
|
247
|
+
childLineWidth: 0,
|
|
248
|
+
plus: !1
|
|
249
|
+
},
|
|
250
|
+
v.text
|
|
251
|
+
))
|
|
252
|
+
);
|
|
253
|
+
})
|
|
254
|
+
);
|
|
255
|
+
}));
|
|
256
|
+
};
|
|
257
|
+
st.displayName = "KendoServerGroupedOrgChart";
|
|
258
|
+
export {
|
|
259
|
+
st as ServerGroupedOrgChart
|
|
260
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
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;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as I from "react";
|
|
10
|
+
import { classNames as p, kendoThemeMaps as M } from "@progress/kendo-react-common";
|
|
11
|
+
import { ServerOrgChartNode as j } from "./ServerOrgChartNode.mjs";
|
|
12
|
+
import { VERTICAL_LINE as x, HORIZONTAL_GAP as u, NODE_WIDTH as A, NODE_HEIGHT as R } from "../utils/consts.mjs";
|
|
13
|
+
const _ = ({
|
|
14
|
+
dataByGroups: d,
|
|
15
|
+
data: r = [],
|
|
16
|
+
cardWidth: l,
|
|
17
|
+
childrenField: n,
|
|
18
|
+
idField: e,
|
|
19
|
+
expandField: t,
|
|
20
|
+
hasChildrenField: i,
|
|
21
|
+
groupField: o,
|
|
22
|
+
level: m = 1,
|
|
23
|
+
parentId: h = 0
|
|
24
|
+
}) => {
|
|
25
|
+
r.forEach((c) => {
|
|
26
|
+
const f = c[n];
|
|
27
|
+
if (c[t] && f && f.length) {
|
|
28
|
+
const s = f.some((W) => W[n] && W[n].length || i && W[i]), g = s ? "horizontal" : "vertical", v = s ? null : l;
|
|
29
|
+
d.push({
|
|
30
|
+
ids: [c[e]],
|
|
31
|
+
items: f,
|
|
32
|
+
level: m,
|
|
33
|
+
parentId: h,
|
|
34
|
+
hasChildren: s,
|
|
35
|
+
orientation: g,
|
|
36
|
+
width: v
|
|
37
|
+
}), _({
|
|
38
|
+
dataByGroups: d,
|
|
39
|
+
data: c[n],
|
|
40
|
+
childrenField: n,
|
|
41
|
+
cardWidth: l,
|
|
42
|
+
idField: e,
|
|
43
|
+
expandField: t,
|
|
44
|
+
hasChildrenField: i,
|
|
45
|
+
groupField: o,
|
|
46
|
+
level: m + 1,
|
|
47
|
+
parentId: c[e]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}, P = (d, r) => {
|
|
52
|
+
const l = r || A, n = d.sort((e, t) => t.level - e.level);
|
|
53
|
+
n.forEach((e) => {
|
|
54
|
+
if (!e.width) {
|
|
55
|
+
const t = n.filter((h) => e.ids.includes(h.parentId)), i = t.length ? Math.max(...t.map((h) => h.width || 0)) : l, o = e.orientation === "horizontal" ? e.items.length : 1, m = i * o + u * (o - 1);
|
|
56
|
+
e.width = m;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}, V = (d, r, l) => {
|
|
60
|
+
const n = d.sort((e, t) => e.level - t.level);
|
|
61
|
+
n.forEach((e) => {
|
|
62
|
+
if (e.level === 0)
|
|
63
|
+
return;
|
|
64
|
+
const t = n.find((s) => s.ids.includes(e.parentId)), i = (t == null ? void 0 : t.items.findIndex((s) => e.ids.includes(s[l]))) || 0, o = (t == null ? void 0 : t.items) || [], m = t.width ? (t.width - (o.length - 1) * u) / o.length : 0;
|
|
65
|
+
if (!e.left) {
|
|
66
|
+
let s = (t == null ? void 0 : t.left) || 0;
|
|
67
|
+
o.forEach((g, v) => {
|
|
68
|
+
v < i && (s += m + u);
|
|
69
|
+
}), e.left = s;
|
|
70
|
+
}
|
|
71
|
+
const h = (t == null ? void 0 : t.width) || 0, c = (t == null ? void 0 : t.items.length) || 1, f = (h - (c - 1) * u) / c;
|
|
72
|
+
e.width = f;
|
|
73
|
+
const E = t == null ? void 0 : t.items.map((s) => {
|
|
74
|
+
const g = s[r] ? s[r].length : 0, v = n.find((N) => N.ids.includes(s[l])), W = (v == null ? void 0 : v.width) || 0;
|
|
75
|
+
return (v == null ? void 0 : v.orientation) === "vertical" || g === 0 || !s.expanded ? 0 : W - (W - (g - 1) * u) / g;
|
|
76
|
+
});
|
|
77
|
+
t && (t.childLineWidths = E);
|
|
78
|
+
});
|
|
79
|
+
}, B = (d, r, l) => {
|
|
80
|
+
const n = r || R, e = l || x;
|
|
81
|
+
d.forEach((t) => {
|
|
82
|
+
const i = t.level, o = (n + e) * i + x * (i ? i - 1 : 0) - (e - x) * (i ? 1 : 0);
|
|
83
|
+
t.top = o;
|
|
84
|
+
});
|
|
85
|
+
}, G = (d, r, l) => {
|
|
86
|
+
const n = r || R, e = l || x;
|
|
87
|
+
return Math.max(...d.map((i) => {
|
|
88
|
+
const o = i.top || 0, m = i.items.length, h = i.orientation === "horizontal" ? n + e + e : m * (n + e);
|
|
89
|
+
return o + h;
|
|
90
|
+
}));
|
|
91
|
+
}, K = (d) => {
|
|
92
|
+
const r = {
|
|
93
|
+
width: "100%",
|
|
94
|
+
data: [],
|
|
95
|
+
ariaLabel: "Org Chart",
|
|
96
|
+
idField: "id",
|
|
97
|
+
childrenField: "items",
|
|
98
|
+
avatarField: "avatar",
|
|
99
|
+
titleField: "title",
|
|
100
|
+
subtitleField: "subtitle",
|
|
101
|
+
expandField: "expanded"
|
|
102
|
+
}, {
|
|
103
|
+
id: l,
|
|
104
|
+
width: n,
|
|
105
|
+
data: e,
|
|
106
|
+
groupField: t,
|
|
107
|
+
cardWidth: i,
|
|
108
|
+
cardHeight: o,
|
|
109
|
+
verticalLine: m,
|
|
110
|
+
idField: h,
|
|
111
|
+
childrenField: c,
|
|
112
|
+
hasChildrenField: f,
|
|
113
|
+
expandField: E,
|
|
114
|
+
avatarField: s,
|
|
115
|
+
titleField: g,
|
|
116
|
+
subtitleField: v,
|
|
117
|
+
ariaLabel: W,
|
|
118
|
+
itemRender: N,
|
|
119
|
+
height: z
|
|
120
|
+
} = { ...r, ...d }, k = [{
|
|
121
|
+
items: e,
|
|
122
|
+
level: 0,
|
|
123
|
+
hasChildren: !0,
|
|
124
|
+
orientation: "horizontal",
|
|
125
|
+
ids: [0],
|
|
126
|
+
parentId: null,
|
|
127
|
+
width: null
|
|
128
|
+
}];
|
|
129
|
+
_({
|
|
130
|
+
dataByGroups: k,
|
|
131
|
+
data: e,
|
|
132
|
+
cardWidth: i,
|
|
133
|
+
expandField: E,
|
|
134
|
+
hasChildrenField: f,
|
|
135
|
+
childrenField: c,
|
|
136
|
+
idField: h,
|
|
137
|
+
groupField: t
|
|
138
|
+
}), P(k, i), V(k, c, h), B(k, o, m);
|
|
139
|
+
const D = G(k, o, m);
|
|
140
|
+
return /* @__PURE__ */ I.createElement("div", { className: "k-orgchart-container", style: { width: n, height: z || D } }, k.map((a) => {
|
|
141
|
+
const w = a.level, y = a.items, T = w === 0 ? "center" : "around", C = a.orientation;
|
|
142
|
+
return /* @__PURE__ */ I.createElement(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
role: w === 0 ? "tree" : "group",
|
|
146
|
+
id: l + "-" + w + "-" + a.ids[0],
|
|
147
|
+
"aria-label": w === 0 ? W : void 0,
|
|
148
|
+
"aria-orientation": w === 0 ? C : void 0,
|
|
149
|
+
key: a.ids[0] + "_" + w,
|
|
150
|
+
className: p(
|
|
151
|
+
"k-orgchart-group",
|
|
152
|
+
`k-orgchart-level-${w}`,
|
|
153
|
+
"k-pos-absolute",
|
|
154
|
+
{
|
|
155
|
+
[`k-${M.orientationMap[C]}`]: C,
|
|
156
|
+
[`k-justify-content-${T}`]: T
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
style: {
|
|
160
|
+
width: a.width || "100%",
|
|
161
|
+
left: a.left,
|
|
162
|
+
top: a.top
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
y.length > 0 && /* @__PURE__ */ I.createElement(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
role: "group",
|
|
169
|
+
style: { width: "100%" },
|
|
170
|
+
className: p(
|
|
171
|
+
"k-orgchart-node-container",
|
|
172
|
+
"k-justify-content-around",
|
|
173
|
+
{
|
|
174
|
+
[`k-${M.orientationMap[a.orientation]}`]: a.orientation
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
},
|
|
178
|
+
y.map((L, H) => {
|
|
179
|
+
const O = L[c] && L[c].length || f && L[f], F = O || a.orientation === "vertical" && H !== y.length - 1, S = a.orientation === "vertical" && H !== 0 ? 0 : m || x, $ = a.childLineWidths ? Math.max(...a.childLineWidths) : void 0, b = L[E];
|
|
180
|
+
return /* @__PURE__ */ I.createElement(
|
|
181
|
+
j,
|
|
182
|
+
{
|
|
183
|
+
id: l + "-" + (w + 1) + "-" + L[h],
|
|
184
|
+
style: { width: $ },
|
|
185
|
+
itemRender: N,
|
|
186
|
+
cardHeight: o,
|
|
187
|
+
cardWidth: i,
|
|
188
|
+
verticalLine: S,
|
|
189
|
+
key: H,
|
|
190
|
+
level: w,
|
|
191
|
+
avatar: L[s],
|
|
192
|
+
title: L[g],
|
|
193
|
+
subtitle: L[v],
|
|
194
|
+
line: F,
|
|
195
|
+
expanded: b,
|
|
196
|
+
node: L,
|
|
197
|
+
childLineWidth: O && b && a.orientation === "horizontal" ? a.childLineWidths[H] : 0,
|
|
198
|
+
plus: O
|
|
199
|
+
},
|
|
200
|
+
L.text
|
|
201
|
+
);
|
|
202
|
+
})
|
|
203
|
+
)
|
|
204
|
+
);
|
|
205
|
+
}));
|
|
206
|
+
};
|
|
207
|
+
K.displayName = "KendoServerOrgChart";
|
|
208
|
+
export {
|
|
209
|
+
K as ServerOrgChart
|
|
210
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),s=require("@progress/kendo-react-common"),f=require("../client/ExpandButton.js"),C=require("../client/OrgChartGroupContainer.js"),k=require("../utils/consts.js");function A(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const e=A(G),H="k-orgchart-node-group",O="k-orgchart-node-group-title",T="k-orgchart-node-group-subtitle",L=t=>{const n={orientation:"horizontal"},{id:r,title:a,subtitle:u,line:S,plus:d,focus:P,level:o,verticalLine:v,childLineWidth:g,orientation:l,expanded:c,nodes:i,groupTitleHeight:N,groupSubtitleHeight:R,groupTitleRender:y,groupSubtitleRender:_,...b}={...n,...t},m=y,h=_,p={height:N||k.GROUP_TITLE_HEIGHT},E={height:R||k.GROUP_SUBTITLE_HEIGHT};return e.createElement("div",{...b,className:s.classNames(t.className,H,"k-vstack","k-align-items-center")},o!==0&&e.createElement("div",{className:"k-orgchart-line k-orgchart-line-v k-orgchart-line-v-top",style:{height:v}}),e.createElement(C.OrgChartGroupContainer,{nodes:i,"aria-expanded":!!c,"aria-keyshortcuts":"Enter","aria-level":o+1,"aria-owns":r},m?e.createElement(m,{style:p,className:O,title:a,items:i,level:o,expanded:c}):e.createElement("div",{className:O,style:p},a),h?e.createElement(h,{style:E,className:T,subtitle:u,items:i,level:o,expanded:c}):e.createElement("div",{className:T,style:E},u),e.createElement("div",{role:"group",style:{width:"100%"},className:s.classNames("k-orgchart-node-container","k-justify-content-around",{[`k-${s.kendoThemeMaps.orientationMap[l]||l}`]:l})},t.children)),S&&e.createElement("div",{className:"k-orgchart-line k-orgchart-line-v"}),d&&e.createElement(f.ExpandButton,{expanded:c,nodes:i}),d&&!!g&&e.createElement("div",{className:"k-orgchart-line k-orgchart-line-h",style:{width:g,marginTop:-15}}))};exports.ServerOrgChartGroup=L;
|