@progress/kendo-react-orgchart 6.1.1 → 7.0.0-develop.10

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.
Files changed (96) hide show
  1. package/LICENSE.md +1 -1
  2. package/OrgChart.d.ts +10 -0
  3. package/{dist/npm/OrgChartOperationDescriptors.d.ts → OrgChartOperationDescriptors.d.ts} +4 -0
  4. package/{dist/es/client → client}/ClientOrgChart.d.ts +7 -3
  5. package/client/ExpandButton.d.ts +17 -0
  6. package/{dist/es/client → client}/OrgChartCard.d.ts +4 -0
  7. package/client/OrgChartCardBody.d.ts +16 -0
  8. package/{dist/npm/client → client}/OrgChartGroupContainer.d.ts +4 -0
  9. package/dist/cdn/js/kendo-react-orgchart.js +18 -1
  10. package/index.d.ts +12 -0
  11. package/index.js +18 -0
  12. package/index.mjs +1148 -0
  13. package/interfaces/ChildGroup.d.ts +20 -0
  14. package/{dist/npm/interfaces → interfaces}/OrgChartActionEvent.d.ts +4 -1
  15. package/{dist/npm/interfaces → interfaces}/OrgChartExpandChangeEvent.d.ts +4 -1
  16. package/{dist/npm/interfaces → interfaces}/SeverOrgChartProps.d.ts +4 -1
  17. package/package-metadata.d.ts +9 -0
  18. package/package.json +29 -38
  19. package/{dist/es/processOrgChartItems.d.ts → processOrgChartItems.d.ts} +4 -0
  20. package/server/ServerGroupedOrgChart.d.ts +12 -0
  21. package/server/ServerOrgChart.d.ts +12 -0
  22. package/{dist/npm/server → server}/ServerOrgChartGroup.d.ts +4 -0
  23. package/{dist/npm/server → server}/ServerOrgChartNode.d.ts +5 -1
  24. package/theming/theme-service.d.ts +9 -0
  25. package/{dist/es/utils → utils}/consts.d.ts +4 -0
  26. package/about.md +0 -3
  27. package/dist/es/OrgChart.d.ts +0 -6
  28. package/dist/es/OrgChart.js +0 -67
  29. package/dist/es/OrgChartOperationDescriptors.d.ts +0 -76
  30. package/dist/es/OrgChartOperationDescriptors.js +0 -2
  31. package/dist/es/client/ClientOrgChart.js +0 -287
  32. package/dist/es/client/ExpandButton.d.ts +0 -13
  33. package/dist/es/client/ExpandButton.js +0 -23
  34. package/dist/es/client/OrgChartCard.js +0 -68
  35. package/dist/es/client/OrgChartCardBody.d.ts +0 -12
  36. package/dist/es/client/OrgChartCardBody.js +0 -13
  37. package/dist/es/client/OrgChartGroupContainer.d.ts +0 -19
  38. package/dist/es/client/OrgChartGroupContainer.js +0 -71
  39. package/dist/es/interfaces/ChildGroup.d.ts +0 -16
  40. package/dist/es/interfaces/ChildGroup.js +0 -1
  41. package/dist/es/interfaces/OrgChartActionEvent.d.ts +0 -22
  42. package/dist/es/interfaces/OrgChartActionEvent.js +0 -1
  43. package/dist/es/interfaces/OrgChartExpandChangeEvent.d.ts +0 -22
  44. package/dist/es/interfaces/OrgChartExpandChangeEvent.js +0 -1
  45. package/dist/es/interfaces/SeverOrgChartProps.d.ts +0 -106
  46. package/dist/es/interfaces/SeverOrgChartProps.js +0 -1
  47. package/dist/es/main.d.ts +0 -6
  48. package/dist/es/main.js +0 -3
  49. package/dist/es/package-metadata.d.ts +0 -5
  50. package/dist/es/package-metadata.js +0 -11
  51. package/dist/es/processOrgChartItems.js +0 -163
  52. package/dist/es/server/ServerGroupedOrgChart.d.ts +0 -9
  53. package/dist/es/server/ServerGroupedOrgChart.js +0 -235
  54. package/dist/es/server/ServerOrgChart.d.ts +0 -9
  55. package/dist/es/server/ServerOrgChart.js +0 -192
  56. package/dist/es/server/ServerOrgChartGroup.d.ts +0 -96
  57. package/dist/es/server/ServerOrgChartGroup.js +0 -59
  58. package/dist/es/server/ServerOrgChartNode.d.ts +0 -75
  59. package/dist/es/server/ServerOrgChartNode.js +0 -57
  60. package/dist/es/theming/theme-service.d.ts +0 -5
  61. package/dist/es/theming/theme-service.js +0 -62
  62. package/dist/es/utils/consts.js +0 -72
  63. package/dist/npm/OrgChart.d.ts +0 -6
  64. package/dist/npm/OrgChart.js +0 -71
  65. package/dist/npm/OrgChartOperationDescriptors.js +0 -3
  66. package/dist/npm/client/ClientOrgChart.d.ts +0 -94
  67. package/dist/npm/client/ClientOrgChart.js +0 -291
  68. package/dist/npm/client/ExpandButton.d.ts +0 -13
  69. package/dist/npm/client/ExpandButton.js +0 -27
  70. package/dist/npm/client/OrgChartCard.d.ts +0 -19
  71. package/dist/npm/client/OrgChartCard.js +0 -72
  72. package/dist/npm/client/OrgChartCardBody.d.ts +0 -12
  73. package/dist/npm/client/OrgChartCardBody.js +0 -17
  74. package/dist/npm/client/OrgChartGroupContainer.js +0 -75
  75. package/dist/npm/interfaces/ChildGroup.d.ts +0 -16
  76. package/dist/npm/interfaces/ChildGroup.js +0 -2
  77. package/dist/npm/interfaces/OrgChartActionEvent.js +0 -2
  78. package/dist/npm/interfaces/OrgChartExpandChangeEvent.js +0 -2
  79. package/dist/npm/interfaces/SeverOrgChartProps.js +0 -2
  80. package/dist/npm/main.d.ts +0 -6
  81. package/dist/npm/main.js +0 -21
  82. package/dist/npm/package-metadata.d.ts +0 -5
  83. package/dist/npm/package-metadata.js +0 -14
  84. package/dist/npm/processOrgChartItems.d.ts +0 -51
  85. package/dist/npm/processOrgChartItems.js +0 -167
  86. package/dist/npm/server/ServerGroupedOrgChart.d.ts +0 -9
  87. package/dist/npm/server/ServerGroupedOrgChart.js +0 -239
  88. package/dist/npm/server/ServerOrgChart.d.ts +0 -9
  89. package/dist/npm/server/ServerOrgChart.js +0 -196
  90. package/dist/npm/server/ServerOrgChartGroup.js +0 -63
  91. package/dist/npm/server/ServerOrgChartNode.js +0 -61
  92. package/dist/npm/theming/theme-service.d.ts +0 -5
  93. package/dist/npm/theming/theme-service.js +0 -65
  94. package/dist/npm/utils/consts.d.ts +0 -72
  95. package/dist/npm/utils/consts.js +0 -75
  96. package/dist/systemjs/kendo-react-orgchart.js +0 -1
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
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
+ export { ServerOrgChart } from './server/ServerOrgChart';
6
+ export { type ServerOrgChartProps } from './interfaces/SeverOrgChartProps';
7
+ export * from './OrgChart';
8
+ export { type OrgChartExpandChangeEvent } from './interfaces/OrgChartExpandChangeEvent';
9
+ export { type OrgChartActionEvent } from './interfaces/OrgChartActionEvent';
10
+ export * from './processOrgChartItems';
11
+ export * from './server/ServerOrgChartNode';
12
+ export * from './server/ServerOrgChartGroup';
package/index.js ADDED
@@ -0,0 +1,18 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ue=require("react"),w=require("@progress/kendo-react-common"),Y=require("@progress/kendo-react-layout"),qe=require("@progress/kendo-react-buttons"),ge=require("@progress/kendo-svg-icons"),Ve=require("prop-types"),Qe=require("@progress/kendo-data-query");function Ce(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>s[o]})}}return t.default=s,Object.freeze(t)}const l=Ce(Ue),h=Ce(Ve),ve=s=>window.getComputedStyle(s).backgroundColor,Xe=s=>s.toLowerCase().charCodeAt(0)-"a".charCodeAt(0),Ze=s=>{const t=s.match(/series-([a-z])$/);if(t!==null)return Xe(t[1]);const o=s.split("--series-")[1];return parseInt(o,10)-1},Je=30,Ye=()=>{let s=`
6
+ <div class="k-var--series-a"></div>
7
+ <div class="k-var--series-b"></div>
8
+ <div class="k-var--series-c"></div>
9
+ <div class="k-var--series-d"></div>
10
+ <div class="k-var--series-e"></div>
11
+ <div class="k-var--series-f"></div>
12
+ `;for(let t=0;t<Je;t++)s+=`
13
+ <div class="k-var--series-${t+1}"></div>`;return s},et=`
14
+ <div class="k-var--series-unset"></div>
15
+ <div class="k-var--series">
16
+ ${Ye()}
17
+ </div>
18
+ `;class tt{getSeriesColors(){const t=this.element,o=[].slice.call(t.querySelectorAll(".k-var--series div")),i=ve(t.querySelector(".k-var--series-unset"));return o.reduce((n,r)=>{const a=Ze(r.className),c=ve(r);return c!==i&&(n[a]=c),n},[])}}const nt=(s,t)=>{const o=new tt,i=o.element=t.createElement("div");i.style.display="none",i.innerHTML=et,t.body.appendChild(i);let e;try{e=o.getSeriesColors()}finally{t.body.removeChild(o.element),delete o.element,s(e)}},it="expanded",ot="items",st="selected",ke="checked",rt="checkIndeterminate",at="k-orgchart",q=80,Ee=300,T=25,G=40,ne=20,ie=20,be=82,ee=l.createContext({cardColors:void 0,onExpandChange:void 0,onKeyDown:void 0,onItemAction:void 0,onItemContextMenu:void 0,onItemDoubleClick:void 0,onGroupAction:void 0,onGroupBlur:void 0,onGroupFocus:void 0}),ce=s=>{const t={tabIndex:0,navigatable:!0,expandField:"expanded",ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",...s},{navigatable:o,id:i,tabIndex:e,className:n,style:r,data:a,groupField:c,cardWidth:m,cardHeight:d,groupTitleHeight:g,groupSubtitleHeight:v,verticalLine:u,idField:k,childrenField:x,expandField:I,hasChildrenField:A,avatarField:R,titleField:E,subtitleField:_,onExpandChange:y,onItemAction:b,onItemDoubleClick:B,onItemContextMenu:H,onKeyDown:z,onGroupAction:C,onGroupBlur:N,onGroupFocus:M,cardsColors:j,ariaLabel:V,itemRender:$,groupTitleRender:Q,groupSubtitleRender:S,height:te,children:U,...oe}=t,X=l.useRef(null),L=l.useRef(new w.Navigation({tabIndex:e,root:X,selectors:[t.groupField?".k-orgchart-node-group-container":".k-orgchart-card"],focusOptions:{}})),[se,Oe]=l.useState([]),P=l.useRef(null),Te=(f,p,O)=>{O.preventDefault(),p.focusNext(f)},Se=(f,p,O)=>{O.preventDefault(),p.focusPrevious(f)},Ae=(f,p,O,F)=>{var W;if(O.preventDefault(),(t.groupField?F.items.some(Z=>Z[t.expandField]):F.item[t.expandField])&&t.onExpandChange)t.onExpandChange.call(void 0,F);else{const Z=".k-orgchart-group",re=(W=f.closest(Z))==null?void 0:W.getAttribute("id"),J=document.querySelector(`[aria-owns="${re}"]`);J?p.focusElement(J,f):p.focusPrevious(f)}},De=(f,p,O,F)=>{var J;O.preventDefault();const D=t.groupField?F.items.some(K=>K[t.expandField]):F.item[t.expandField],W=t.groupField?F.items.find(K=>K[t.childrenField]):F.item[t.childrenField],Z=t.groupField?F.items.some(K=>t.hasChildrenField&&K[t.hasChildrenField]):t.hasChildrenField&&F.item[t.hasChildrenField],re=t.groupField?W&&W[t.childrenField]&&W[t.childrenField].length:W&&W.length;if((Z||re)&&!D&&t.onExpandChange)t.onExpandChange.call(void 0,F);else{const K=t.groupField?".k-orgchart-node-group-container":".k-orgchart-card",$e=f.getAttribute("aria-owns"),me=(J=document.getElementById($e))==null?void 0:J.querySelector(K);me?p.focusElement(me,f):p.focusNext(f)}},Re=(f,p,O)=>{O.preventDefault(),p.focusElement(p.first,null)},He=(f,p,O)=>{O.preventDefault(),p.focusElement(p.last,null)},Ge=(f,p,O,F)=>{O.stopPropagation();const D=f.className.indexOf("k-orgchart-node-group-container")!==-1;if(s.groupField&&D){P.current&&P.current.first&&P.current.focusElement(P.current.first,null);return}t.onItemAction&&t.onItemAction({event:O,item:F.item})},_e=f=>{if(s.groupField){const p=f.closest(".k-orgchart-node-group-container");p&&L.current.focusElement(p,null)}};l.useEffect(()=>{if(o&&L.current.first&&L.current.first.setAttribute("tabindex",String(e)),!j){const f=X.current.ownerDocument||document;nt(p=>{Oe(p)},f)}},[o,e]);const Me=f=>{if(t.navigatable){const p=f.event,O=p.key===" "?"Space":p.key,F=s.groupField&&p.target.className.indexOf("k-orgchart-card")!==-1&&P.current||L.current,D=p.target.closest(F.selectors.join(","));switch(O){case"ArrowUp":Ae(D,F,p,f);break;case"ArrowDown":De(D,F,p,f);break;case"ArrowLeft":Se(D,F,p);break;case"ArrowRight":Te(D,F,p);break;case"End":He(D,F,p);break;case"Home":Re(D,F,p);break;case"Enter":Ge(D,F,p,f);break;case"Escape":_e(D);break}}},We=f=>{if(f.event.stopPropagation(),b&&b.call(void 0,f),t.navigatable){const p=f.event.target.closest(".k-orgchart-card");p&&L.current.focusElement(p,null)}},Pe=f=>{f.event.stopPropagation(),b&&b.call(void 0,f)},Ke=f=>{f.event.stopPropagation(),b&&b.call(void 0,f)},Be=f=>{if(C&&C.call(void 0,f),t.navigatable){const p=f.event.target.closest(".k-orgchart-node-group-container");p&&L.current.focusElement(p,null)}},ze=f=>{P.current=null},je=f=>{P.current=new w.Navigation({tabIndex:0,root:f.containerRef,selectors:[".k-orgchart-card"],focusOptions:{}})};return l.createElement("div",{style:r,ref:X,className:w.classNames(n,at)},l.createElement(ee.Provider,{value:{cardColors:j||se,onExpandChange:s.onExpandChange,onKeyDown:Me,onItemAction:We,onItemDoubleClick:Ke,onItemContextMenu:Pe,onGroupAction:Be,onGroupBlur:ze,onGroupFocus:je},...oe},s.children))};ce.propTypes={className:h.string,style:h.object,id:h.string,ariaLabel:h.string,idField:h.string,childrenField:h.string,expandField:h.string,titleField:h.string,hasChildrenField:h.string,subtitleField:h.string,avatarField:h.string,cardsColors:h.array,data:h.array,groupField:h.string,cardHeight:h.number,cardWidth:h.number,groupTitleHeight:h.number,groupSubtitleHeight:h.number,verticalLine:h.number,height:h.oneOfType([h.string,h.number]),onExpandChange:h.func,onItemAction:h.func,onItemDoubleClick:h.func,onItemContextMenu:h.func,onGroupAction:h.func};ce.displayName="KendoClientOrgChart";const xe=s=>{const{expanded:t,node:o,nodes:i}=s,e=l.useContext(ee),n=r=>{e.onExpandChange&&e.onExpandChange.call(void 0,{event:r,expand:!t,item:o,items:i})};return l.createElement(qe.Button,{className:"k-orgchart-button",icon:t?"minus":"plus",tabIndex:-1,svgIcon:t?ge.minusIcon:ge.plusIcon,"aria-label":t?"collapse":"expand",onClick:n})},lt=s=>{const{node:t,children:o,style:i,...e}=s,[n,r]=l.useState(!1),a=l.useContext(ee),c=v=>{a.onKeyDown&&a.onKeyDown.call(void 0,{event:v,item:t})},m=v=>{a.onItemAction&&a.onItemAction.call(void 0,{event:v,item:t})},d=v=>{a.onItemContextMenu&&a.onItemContextMenu.call(void 0,{event:v,item:t})},g=v=>{a.onItemDoubleClick&&a.onItemDoubleClick.call(void 0,{event:v,item:t})};return l.createElement(Y.Card,{role:"treeitem",className:w.classNames("k-orgchart-card",{"k-focus":n}),onClick:m,onKeyDown:c,onContextMenu:d,onDoubleClick:g,style:i,"aria-selected":n,"aria-keyshortcuts":"Enter",onFocus:()=>r(!0),onBlur:()=>r(!1),...e},o)},ct=s=>{const{level:t,children:o}=s,i=l.useContext(ee),e=i.cardColors&&i.cardColors[t]||"green";return l.createElement(Y.CardBody,{className:"k-hstack",style:{borderTopColor:e}},o)},dt="k-orgchart-node",de=s=>{const t={avatarType:"image"},{id:o,title:i,subtitle:e,level:n,childLineWidth:r,cardWidth:a,cardHeight:c,verticalLine:m,color:d,line:g,plus:v,expanded:u,node:k,avatar:x,avatarType:I,itemRender:A,...R}={...s,...t},E=A;return l.createElement("div",{...R,className:w.classNames(s.className,dt,"k-vstack","k-align-items-center")},n!==0&&l.createElement("div",{className:"k-orgchart-line k-orgchart-line-v k-orgchart-line-v-top",style:{height:m}}),l.createElement(lt,{node:k,style:{width:a,height:c},"aria-level":n+1,"aria-expanded":!!u,"aria-owns":o},l.createElement(ct,{level:n},E?l.createElement(E,{item:k,title:i,subtitle:e,level:n,expanded:u,color:d}):l.createElement(l.Fragment,null,l.createElement(Y.Avatar,{type:I,themeColor:"secondary"},I==="image"?l.createElement("img",{src:x,alt:"KendoReact Avatar Customer Image"}):x),l.createElement("div",{className:"k-card-title-wrap k-vstack"},l.createElement(Y.CardTitle,{className:"k-text-ellipsis"},i),l.createElement("span",{className:"k-spacer"}),l.createElement(Y.CardSubtitle,{className:"k-text-ellipsis"},e)),l.createElement("span",{className:"k-spacer"})))),g&&l.createElement("div",{className:"k-orgchart-line k-orgchart-line-v"}),v&&l.createElement(xe,{expanded:u,node:k}),v&&!!r&&l.createElement("div",{className:"k-orgchart-line k-orgchart-line-h",style:{width:r,marginTop:-15}}))},Ie=({dataByGroups:s,data:t=[],cardWidth:o,childrenField:i,idField:e,expandField:n,hasChildrenField:r,groupField:a,level:c=1,parentId:m=0})=>{t.forEach(d=>{const g=d[i];if(d[n]&&g&&g.length){const u=g.some(I=>I[i]&&I[i].length||r&&I[r]),k=u?"horizontal":"vertical",x=u?null:o;s.push({ids:[d[e]],items:g,level:c,parentId:m,hasChildren:u,orientation:k,width:x}),Ie({dataByGroups:s,data:d[i],childrenField:i,cardWidth:o,idField:e,expandField:n,hasChildrenField:r,groupField:a,level:c+1,parentId:d[e]})}})},ht=(s,t)=>{const o=t||Ee,i=s.sort((e,n)=>n.level-e.level);i.forEach(e=>{if(!e.width){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);e.width=c}})},ut=(s,t,o)=>{const i=s.sort((e,n)=>e.level-n.level);i.forEach(e=>{if(e.level===0)return;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;if(!e.left){let u=(n==null?void 0:n.left)||0;a.forEach((k,x)=>{x<r&&(u+=c+T)}),e.left=u}const m=(n==null?void 0:n.width)||0,d=(n==null?void 0:n.items.length)||1,g=(m-(d-1)*T)/d;e.width=g;const v=n==null?void 0:n.items.map(u=>{const k=u[t]?u[t].length:0,x=i.find(A=>A.ids.includes(u[o])),I=(x==null?void 0:x.width)||0;return(x==null?void 0:x.orientation)==="vertical"||k===0||!u.expanded?0:I-(I-(k-1)*T)/k});n&&(n.childLineWidths=v)})},mt=(s,t,o)=>{const i=t||q,e=o||G;s.forEach(n=>{const r=n.level,a=(i+e)*r+G*(r?r-1:0)-(e-G)*(r?1:0);n.top=a})},gt=(s,t,o)=>{const i=t||q,e=o||G;return Math.max(...s.map(r=>{const a=r.top||0,c=r.items.length,m=r.orientation==="horizontal"?i+e+e:c*(i+e);return a+m}))},he=s=>{const t={width:"100%",data:[],ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",expandField:"expanded"},{id:o,width:i,data:e,groupField:n,cardWidth:r,cardHeight:a,verticalLine:c,idField:m,childrenField:d,hasChildrenField:g,expandField:v,avatarField:u,titleField:k,subtitleField:x,ariaLabel:I,itemRender:A,height:R}={...t,...s},E=[{items:e,level:0,hasChildren:!0,orientation:"horizontal",ids:[0],parentId:null,width:null}];Ie({dataByGroups:E,data:e,cardWidth:r,expandField:v,hasChildrenField:g,childrenField:d,idField:m,groupField:n}),ht(E,r),ut(E,d,m),mt(E,a,c);const _=gt(E,a,c);return l.createElement("div",{className:"k-orgchart-container",style:{width:i,height:R||_}},E.map(y=>{const b=y.level,B=y.items,H=b===0?"center":"around",z=y.orientation;return l.createElement("div",{role:b===0?"tree":"group",id:o+"-"+b+"-"+y.ids[0],"aria-label":b===0?I:void 0,"aria-orientation":b===0?z:void 0,key:y.ids[0]+"_"+b,className:w.classNames("k-orgchart-group",`k-orgchart-level-${b}`,"k-pos-absolute",{[`k-${w.kendoThemeMaps.orientationMap[z]}`]:z,[`k-justify-content-${H}`]:H}),style:{width:y.width||"100%",left:y.left,top:y.top}},B.length>0&&l.createElement("div",{role:"group",style:{width:"100%"},className:w.classNames("k-orgchart-node-container","k-justify-content-around",{[`k-${w.kendoThemeMaps.orientationMap[y.orientation]}`]:y.orientation})},B.map((C,N)=>{const M=C[d]&&C[d].length||g&&C[g],j=M||y.orientation==="vertical"&&N!==B.length-1,V=y.orientation==="vertical"&&N!==0?0:c||G,$=y.childLineWidths?Math.max(...y.childLineWidths):void 0,Q=C[v];return l.createElement(de,{id:o+"-"+(b+1)+"-"+C[m],style:{width:$},itemRender:A,cardHeight:a,cardWidth:r,verticalLine:V,key:N,level:b,avatar:C[u],title:C[k],subtitle:C[x],line:j,expanded:Q,node:C,childLineWidth:M&&Q&&y.orientation==="horizontal"?y.childLineWidths[N]:0,plus:M},C.text)})))}))};he.displayName="KendoServerOrgChart";const vt={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"},ft=s=>{const{nodes:t,children:o,style:i,...e}=s,[n,r]=l.useState(!1),a=l.useContext(ee),c=l.useRef(null),m=u=>{a.onKeyDown&&a.onKeyDown({event:u,items:t})},d=u=>{a.onGroupAction&&a.onGroupAction({event:u,items:t})},g=u=>{r(!0),a.onGroupFocus&&a.onGroupFocus({event:u,items:t,containerRef:c})},v=u=>{r(!1),a.onGroupBlur&&a.onGroupBlur({event:u,items:t})};return l.createElement("div",{role:"treeitem","aria-selected":n,ref:c,className:w.classNames("k-orgchart-node-group-container","k-vstack",{"k-focus":n}),style:i,onKeyDown:m,onClick:d,onFocus:g,onBlur:v,...e},o)},pt="k-orgchart-node-group",fe="k-orgchart-node-group-title",pe="k-orgchart-node-group-subtitle",ye=s=>{const t={orientation:"horizontal"},{id:o,title:i,subtitle:e,line:n,plus:r,focus:a,level:c,verticalLine:m,childLineWidth:d,orientation:g,expanded:v,nodes:u,groupTitleHeight:k,groupSubtitleHeight:x,groupTitleRender:I,groupSubtitleRender:A,...R}={...t,...s},E=I,_=A,y={height:k||ne},b={height:x||ie};return l.createElement("div",{...R,className:w.classNames(s.className,pt,"k-vstack","k-align-items-center")},c!==0&&l.createElement("div",{className:"k-orgchart-line k-orgchart-line-v k-orgchart-line-v-top",style:{height:m}}),l.createElement(ft,{nodes:u,"aria-expanded":!!v,"aria-keyshortcuts":"Enter","aria-level":c+1,"aria-owns":o},E?l.createElement(E,{style:y,className:fe,title:i,items:u,level:c,expanded:v}):l.createElement("div",{className:fe,style:y},i),_?l.createElement(_,{style:b,className:pe,subtitle:e,items:u,level:c,expanded:v}):l.createElement("div",{className:pe,style:b},e),l.createElement("div",{role:"group",style:{width:"100%"},className:w.classNames("k-orgchart-node-container","k-justify-content-around",{[`k-${w.kendoThemeMaps.orientationMap[g]||g}`]:g})},s.children)),n&&l.createElement("div",{className:"k-orgchart-line k-orgchart-line-v"}),r&&l.createElement(xe,{expanded:v,nodes:u}),r&&!!d&&l.createElement("div",{className:"k-orgchart-line k-orgchart-line-h",style:{width:d,marginTop:-15}}))},we=({dataByGroups:s,data:t=[],cardWidth:o,childrenField:i,idField:e,expandField:n,hasChildrenField:r,groupField:a,level:c=1,parentId:m=0})=>{t.forEach(d=>{const g=d[i];if(d[n]&&g&&g.length){const u=g.some(E=>E[i]&&E[i].length||r&&E[r]),k=u?"horizontal":"vertical",x=u?null:o+2*T,I=s.find(E=>E.parentId===m),A=s.find(E=>E.ids.includes(m));let R=!1;if(I){const E=I.ids[0],_=A.items.find(b=>b[e]===E),y=A.items.find(b=>b[e]===d[e]);R=_[a]===y[a]}I&&R?(I.ids.push(d[e]),I.items=I.items.concat(g)):s.push({ids:[d[e]],items:g,level:c,parentId:m,hasChildren:u,orientation:k,width:x}),we({dataByGroups:s,data:d[i],childrenField:i,cardWidth:o,idField:e,expandField:n,hasChildrenField:r,groupField:a,level:c+1,parentId:d[e]})}})},Ct=(s,t)=>{const o=t||Ee,i=s.sort((e,n)=>n.level-e.level);i.forEach(e=>{if(!e.width){const n=i.filter(r=>e.ids.includes(r.parentId));if(n.length){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=>{const g=e.orientation==="horizontal"?d.items.length:1;return g*(o+2*T)+T*(g-1)})),m=r*a+T*(a-1);e.width=Math.max(m,c)}else{const r=Math.max(...e.groupedItems.map(a=>{const c=e.orientation==="horizontal"?a.items.length:1;return c*(o+2*T)+T*(c-1)}));e.width=r}}})},kt=(s,t)=>{const o=s.sort((i,e)=>i.level-e.level);o.forEach(i=>{var g;if(i.level===0)return;const e=o.find(v=>v.ids.includes(i.parentId)),n=(e==null?void 0:e.groupedItems.findIndex(v=>v.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;if(!i.left){let v=(e==null?void 0:e.left)||0;r.forEach((u,k)=>{k<n&&(v+=a+T)}),i.left=v}const c=(e==null?void 0:e.width)||0,m=(e==null?void 0:e.groupedItems.length)||1,d=(c-(m-1)*T)/m;if(i.width=d,e){const v=i.width-(i.width-(i.groupedItems.length-1)*T)/i.groupedItems.length;e.childLineWidths?(g=e.childLineWidths)==null||g.push(v):e.childLineWidths=[v]}})},Et=(s,t,o,i,e)=>{const n=t||q,r=e||G,a=o+i+be;s.forEach(c=>{const m=c.level,d=(n+r+a)*m+G*(m?m-1:0)-(r-G)*(m?1:0);c.top=d})},bt=(s,t,o,i,e)=>{const n=t||q,r=o||G,c=(i||ne)+(e||ie)+be;return Math.max(...s.map(d=>{const g=d.top||0,v=Math.max(...d.groupedItems.map(x=>x.items.length)),u=d.hasChildren?G:0,k=d.orientation==="horizontal"?n+r+c+r+u:v*(n+r)+c+r;return g+k}))},Fe=s=>{const t={width:"100%",data:[],ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",expandField:"expanded",orientation:"horizontal"},{id:o,width:i,data:e,groupField:n,cardWidth:r,cardHeight:a,groupTitleHeight:c,groupSubtitleHeight:m,verticalLine:d,idField:g,childrenField:v,expandField:u,hasChildrenField:k,avatarField:x,titleField:I,subtitleField:A,cardsColors:R,ariaLabel:E,itemRender:_,groupTitleRender:y,groupSubtitleRender:b,height:B}={...t,...s},H=[{items:e,level:0,hasChildren:!0,orientation:"horizontal",ids:[0],parentId:null,width:null}];we({dataByGroups:H,data:e,cardWidth:r,expandField:u,hasChildrenField:k,childrenField:v,idField:g,groupField:n}),H.map(C=>{C.groupedItems=Qe.groupBy(C.items,[{field:n}])}),Ct(H,r),kt(H,g),Et(H,a||q,c||ne,m||ie,d);const z=bt(H,a||q,c||ne,m||ie);return l.createElement("div",{className:"k-orgchart-container",style:{width:i,height:B||z}},H.map(C=>{const N=C.level,M=C.groupedItems.map(S=>{const te=S.items.some(U=>U[u]);return{...S,expanded:te}}),j=M.filter(S=>S.expanded),V=N===0?"center":"around",$="horizontal",Q=R&&R[N]||"green";return l.createElement("div",{role:N===0?"tree":"group",id:o+"-"+N+"-"+C.ids[0],"aria-label":N===0?E:void 0,"aria-orientation":N===0?$:void 0,key:C.ids[0]+"_"+N,className:w.classNames("k-orgchart-group",`k-orgchart-level-${N}`,"k-pos-absolute",{[`k-${w.kendoThemeMaps.orientationMap[$]}`]:$,[`k-justify-content-${V}`]:V,"k-orgchart-group-h":s.groupField}),style:{width:C.width||"100%",left:C.left,top:C.top}},e.length>0&&M.map((S,te)=>{const U=S.items.some(L=>L[v]&&L[v].length||k&&L[k]),oe=C.width?(C.width-(M.length-1)*T)/M.length:void 0,X=j.findIndex(L=>L===S);return l.createElement(ye,{id:o+"-"+(N+1)+"-"+S.items[0][g],style:{width:oe},groupTitleHeight:c,groupSubtitleHeight:m,groupTitleRender:y,groupSubtitleRender:b,key:te,level:N,verticalLine:d||G,title:S.items[0][n||I],subtitle:n,orientation:C.orientation,childLineWidth:U&&S.expanded&&C.orientation==="horizontal"?C.childLineWidths[X]:0,line:U,nodes:S.items,expanded:S.expanded,plus:U},S.items.map((L,se)=>l.createElement(de,{cardHeight:a,cardWidth:r,itemRender:_,color:Q,key:se,level:N,avatar:L[x],title:L[I],subtitle:L[A],verticalLine:0,line:!1,node:L,childLineWidth:0,plus:!1},L.text)))}))}))};Fe.displayName="KendoServerGroupedOrgChart";const ue=s=>{const t={tabIndex:0,navigatable:!0,expandField:"expanded",ariaLabel:"Org Chart",idField:"id",childrenField:"items",avatarField:"avatar",titleField:"title",subtitleField:"subtitle",...s},{cardsColors:o,onExpandChange:i,onKeyDown:e,onItemAction:n,onGroupAction:r,onGroupBlur:a,onGroupFocus:c,id:m,...d}=t,g=l.useRef(w.guid());return w.validatePackage(vt),l.createElement(ce,{...t},s.groupField?l.createElement(Fe,{id:m||g.current,...d},s.children):l.createElement(he,{id:m||g.current,...d},s.children))};ue.propTypes={className:h.string,style:h.object,id:h.string,ariaLabel:h.string,idField:h.string,childrenField:h.string,expandField:h.string,titleField:h.string,hasChildrenField:h.string,subtitleField:h.string,avatarField:h.string,cardsColors:h.array,data:h.array,groupField:h.string,cardHeight:h.number,cardWidth:h.number,groupTitleHeight:h.number,groupSubtitleHeight:h.number,verticalLine:h.number,height:h.oneOfType([h.string,h.number]),onExpandChange:h.func,onItemAction:h.func,onGroupAction:h.func};ue.displayName="KendoOrgChart";function xt(s,t){if(!s||!s.length)return[];let o=s;const i=t.cloneField||"cloned",e=t.expandField||it,n=t.selectField||st,r=t.checkField||ke,a=t.childrenField||ot;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),yt(o,a,t.check),o}function ae(s,t,o,i,e){if(o){const{ids:n,field:r}=Le(o,t),a=!w.isArray(o)&&o.idField?w.resolveItemsIds(n,o.idField,s,e):n;return It(s,a,r,i,e)}else return s}function Le(s,t){let o,i;return w.isArray(s)?(o=s,i=t):(o=s.ids||[],i=s.operationField||t),{ids:o,field:i}}function It(s,t,o,i,e){let n=s;return t.forEach(r=>{n=w.updateItem(n,r,a=>Ne(o,a),i,e)}),n}function Ne(s,t){const o=(s||"").split(".");let i=t;for(let e=0;e<o.length;e++){const n=o[e];if(e===o.length-1)i[n]=!0;else if(i[n]!==void 0)i[n]={...i[n]},i=i[n];else return}}function yt(s,t,o){if(o&&!w.isArray(o)&&o.applyCheckIndeterminate){const{field:i}=Le(o,ke),e=o.checkIndeterminateField||rt;for(let n=0;n<s.length;n++){const r=s[n],a=r[t];a&&le(a,w.getNestedValue(i,r)?[]:[r],t,i,e)}}}function le(s,t,o,i,e){let n=!1;for(let r=0;r<s.length;r++){const a=s[r];if(w.getNestedValue(i,a)){if(!n)for(let c=0;c<t.length;c++)Ne(e,t[c]);n=!0,a[o]&&le(a[o],[],o,i,e)}else a[o]&&le(a[o],n?[a]:t.concat([a]),o,i,e)}}exports.OrgChart=ue;exports.ServerOrgChart=he;exports.ServerOrgChartGroup=ye;exports.ServerOrgChartNode=de;exports.processOrgChartItems=xt;