UNPKG

@progress/kendo-react-gantt

Version:

React Gantt enables the display of self-referencing tabular data with many features. KendoReact Gantt package

15 lines 76.2 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ /** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-date-math"),require("@progress/kendo-react-common"),require("@progress/kendo-react-data-tools"),require("@progress/kendo-react-treelist"),require("@progress/kendo-react-intl"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-buttons"),require("react-dom"),require("@progress/kendo-react-form"),require("@progress/kendo-react-dialogs"),require("@progress/kendo-react-labels"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-dateinputs"),require("@progress/kendo-react-dropdowns"),require("@progress/kendo-react-grid"),require("@progress/kendo-data-query")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-date-math","@progress/kendo-react-common","@progress/kendo-react-data-tools","@progress/kendo-react-treelist","@progress/kendo-react-intl","@progress/kendo-svg-icons","@progress/kendo-react-buttons","react-dom","@progress/kendo-react-form","@progress/kendo-react-dialogs","@progress/kendo-react-labels","@progress/kendo-react-inputs","@progress/kendo-react-layout","@progress/kendo-react-dateinputs","@progress/kendo-react-dropdowns","@progress/kendo-react-grid","@progress/kendo-data-query"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactGantt={},e.React,e.PropTypes,e.KendoDateMath,e.KendoReactCommon,e.KendoReactDataTools,e.KendoReactTreelist,e.KendoReactIntl,e.KendoSvgIcons,e.KendoReactButtons,e.ReactDOM,e.KendoReactForm,e.KendoReactDialogs,e.KendoReactLabels,e.KendoReactInputs,e.KendoReactLayout,e.KendoReactDateinputs,e.KendoReactDropdowns,e.KendoReactGrid,e.KendoDataQuery)}(this,(function(e,t,n,a,o,r,l,s,i,d,c,u,m,p,g,h,f,k,y,v){"use strict";function C(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var D=C(t),E=C(c);const b=r.TABLE_ROW_INDEX_ATTRIBUTE,I=r.TABLE_COL_INDEX_ATTRIBUTE,w=r.TABLE_PREVENT_SELECTION_ELEMENT,S=(new Date).getTime(),R={skeleton:"MEd"},T=100,x="data-dependency-drag-handle",F={[x]:"start"},N={[x]:"finish"},M="data-task-id",z={id:"id",start:"start",end:"end",title:"title",percentComplete:"percentComplete",parentId:"parentId",isRollup:"isRollup",isExpanded:"isExpanded",isInEdit:"isInEdit",children:"children",isSelected:"isSelected"},L={id:"id",fromId:"fromId",toId:"toId",type:"type"},W=r.orderBy,H=r.filterBy,K=o.mapTree,V=o.extendDataItem,O=l.createDataTree,A=e=>a.getDate(e),P=(e,t)=>a.getDate(a.addDays(e,t||1));function B(e){return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))}const G=(e,t,n,a)=>a?_(e,t,n):$(e,t,n),_=(e,t,n)=>{n.push({top:e-2,left:t}),n.push({top:e,left:t-4+1}),n.push({top:e+2,left:t}),n.push({top:e,left:t})},$=(e,t,n)=>{n.push({top:e+2,left:t}),n.push({top:e,left:t+4-1}),n.push({top:e-2,left:t}),n.push({top:e,left:t})},q=e=>{if(void 0===e.workWeekStart||void 0===e.workWeekEnd)return[];const t=[];let n=e.workWeekStart;for(t.push(n);e.workWeekEnd!==n;)n>6?n-=7:n++,t.push(n);return t},Z=(e,t)=>{const n=e.getDay();return t.indexOf(n)>-1},U=(e,{step:t,timezone:n})=>{const o=[],r=a.ZonedDate.fromLocalDate(e.start,n),l=a.ZonedDate.fromLocalDate(e.end,n);let s=r.clone();for(;s.getTime()<l.getTime();){const e=s.clone(),n=e.clone().addTime(t),a=new Date(e.getTime()),r={end:new Date(n.getTime()),start:a,zonedStart:e,zonedEnd:n};o.push(r),s=s.addTime(t)}return o},j=(e,t,n)=>U(e,{step:a.MS_PER_DAY,timezone:t.timezone}).map((e=>({range:e,isWork:Z(e.start,t.workDays),span:1,text:n.formatDate(e.zonedStart,R),type:"day"}))),Y=(e,t,n)=>((e,{timezone:t},n)=>{const o=[],r=a.ZonedDate.fromLocalDate(e.start,t),l=a.ZonedDate.fromLocalDate(e.end,t);for(let e=r.clone();e.getTime()<l.getTime();){const r=e.clone(),s=P(a.firstDayInWeek(a.getDate(r),n.firstDay()),7),i=a.ZonedDate.fromUTCDate(B(s),t),d=i.getTime()>l.getTime()?l.clone():i;e=d.clone();const c=new Date(r.getTime()),u={end:new Date(d.getTime()),start:c,zonedStart:r,zonedEnd:d};o.push(u)}return o})(e,{timezone:t.timezone},n).map((e=>{const t=Math.round((e.zonedEnd.getTime()-e.zonedStart.getTime())/a.MS_PER_DAY);return{range:e,isWork:!1,span:t,text:`${n.formatDate(e.zonedStart,R)} - ${n.formatDate(e.zonedEnd,R)}`,type:"week"}})),X=(e,t,n)=>((e,{timezone:t})=>{const n=[],o=a.ZonedDate.fromLocalDate(e.start,t),r=a.ZonedDate.fromLocalDate(e.end,t);for(let e=o.clone();e.getTime()<r.getTime();){const o=e.clone(),r=a.ZonedDate.fromLocalDate(a.addMonths(new Date(o.getTime()),1),t);e=r.clone();const l=new Date(o.getTime()),s={end:new Date(r.getTime()),start:l,zonedStart:o,zonedEnd:r};n.push(s)}return n})(e,{timezone:t.timezone}).map((e=>{const t=Math.round((e.zonedEnd.getTime()-e.zonedStart.getTime())/a.MS_PER_DAY);return{range:e,isWork:!1,span:t,text:n.formatDate(e.zonedStart,"MMM"),type:"month"}})),Q=(e,t,n)=>((e,{timezone:t})=>{const n=[],o=a.ZonedDate.fromLocalDate(e.start,t),r=a.ZonedDate.fromLocalDate(e.end,t);for(let e=o.clone();e.getTime()<r.getTime();){const o=e.clone(),r=a.ZonedDate.fromLocalDate(a.addMonths(new Date(o.getTime()),12),t);e=r.clone();const l=new Date(o.getTime()),s={end:new Date(r.getTime()),start:l,zonedStart:o,zonedEnd:r};n.push(s)}return n})(e,{timezone:t.timezone}).map((e=>{const t=Math.round((e.zonedEnd.getTime()-e.zonedStart.getTime())/a.MS_PER_DAY);return{range:e,isWork:!1,span:t,text:n.formatDate(e.zonedStart,"yyyy"),type:"year"}})),J=(e,t)=>!!o.getter(t)(e),ee=(e,t)=>!!o.getter(t)(e),te=D.createContext([]);te.displayName="KendoReactGanttTaskDataContext";const ne=D.createContext([]);ne.displayName="KendoReactGanttDependencyDataContext";const ae=D.createContext(z),oe=()=>D.useContext(ae);ae.displayName="KendoReactGanttTaskModelFieldsContext";const re=D.createContext(L),le=()=>D.useContext(re);re.displayName="KendoReactGanttDependencyModelFieldsContext";const se=D.createContext({}),ie=()=>D.useContext(se);se.displayName="KendoReactGanttPropsContext";const de=D.createContext({start:new Date,end:new Date,zonedStart:a.ZonedDate.fromLocalDate(new Date),zonedEnd:a.ZonedDate.fromLocalDate(new Date)}),ce=()=>D.useContext(de);de.displayName="KendoReactGanttDateRangeContext";const ue=D.createContext([]);ue.displayName="KendoReactGanttViewsContext";const me=D.createContext(["week",o.noop]),pe=()=>D.useContext(me);me.displayName="KendoReactGanttActiveViewContext";const ge=D.createContext(0),he=()=>D.useContext(ge);ge.displayName="KendoReactGanttRowHeightContext";const fe=D.createContext(0);fe.displayName="KendoReactGanttToolbarHeightContext";const ke=D.createContext({onDataStateChange:o.noop,onSortChange:o.noop,onFilterChange:o.noop,onColumnMenuFilterChange:o.noop,onExpandChange:o.noop,onRowClick:o.noop,onRowDoubleClick:o.noop,onRowContextMenu:o.noop,onColumnResize:o.noop,onColumnReorder:o.noop,onDependencyCreate:o.noop,onKeyDown:o.noop,onSelectionChange:o.noop,onHeaderSelectionChange:o.noop});ke.displayName="KendoReactGanttEventsContext";const ye=D.createContext({onTaskClick:o.noop,onTaskDoubleClick:o.noop,onTaskContextMenu:o.noop});ye.displayName="KendoReactGanttTaskEventsContext";const ve=({children:e,taskData:t,dependencyData:n,taskModelFields:a,dependencyModelFields:o,props:r,dateRange:l,views:s,activeView:i,rowHeight:d,toolbarHeight:c,events:u,taskEvents:m})=>D.createElement(se.Provider,{value:r},D.createElement(te.Provider,{value:t},D.createElement(ne.Provider,{value:n},D.createElement(ae.Provider,{value:a},D.createElement(re.Provider,{value:o},D.createElement(de.Provider,{value:l},D.createElement(ue.Provider,{value:s},D.createElement(me.Provider,{value:i},D.createElement(ge.Provider,{value:d},D.createElement(fe.Provider,{value:c},D.createElement(ke.Provider,{value:u},D.createElement(ye.Provider,{value:m},e))))))))))));ve.displayName="KendoReactGanttContext";const Ce=D.createContext([{current:{}},o.noop]),De=()=>D.useContext(Ce);Ce.displayName="KendoReactGanttViewContext";const Ee=D.createContext(0);Ee.displayName="KendoReactGanttViewTimelineWidthContext";const be=D.createContext({onDependencyHandlePress:o.noop,onDependencyHandleDrag:o.noop,onDependencyHandleRelease:o.noop,isEnabled:!1,draggedId:null});be.displayName="KendoReactGanttViewDependencyDragContext";const Ie=({children:e,tasksStore:t,timelineWidth:n,dependencyDrag:a})=>D.createElement(Ce.Provider,{value:t},D.createElement(Ee.Provider,{value:n},D.createElement(be.Provider,{value:a},e)));Ie.displayName="KendoReactGanttViewContext";var we=(e=>(e[e.add=0]="add",e[e.remove=1]="remove",e))(we||{});const Se=D.forwardRef(((e,t)=>{const n=ce(),a=oe(),r=D.useContext(Ee),l=D.useContext(be),s=D.useContext(ye),d=D.useRef(null),c=D.useRef(null);((e,t,n,a)=>{const r=D.useRef(null),[,l]=De();D.useImperativeHandle(r,(()=>({element:a.current,dataItem:e}))),D.useImperativeHandle(n,(()=>r.current)),o.useIsomorphicLayoutEffect((()=>{const e=r.current;if(e)return l({type:we.add,itemRef:e,id:t}),()=>{l({type:we.remove,itemRef:e,id:t})}}))})(e.dataItem,o.getter(a.id)(e.dataItem),t,d);const u=D.useRef(null),m=o.getter(a.id)(e.dataItem),p=o.getter(a.start)(e.dataItem),g=o.getter(a.end)(e.dataItem),h=o.getter(a.title)(e.dataItem),f=o.getter(a.percentComplete)(e.dataItem),k=o.getter(a.children)(e.dataItem),y=o.getter(a.isSelected)(e.dataItem),v=p&&p.getTime(),C=g&&g.getTime(),E=k&&k.length,b=!E&&v===C,I=v&&C&&((e,t,n,a)=>n<t&&e<=a)(n.start,n.end,p,g),[w,S]=D.useState(!1),R=D.useRef(null),T=D.useRef(null);o.useDraggable(R,{onPress:l.onDependencyHandlePress,onDrag:l.onDependencyHandleDrag,onRelease:l.onDependencyHandleRelease}),o.useDraggable(T,{onPress:l.onDependencyHandlePress,onDrag:l.onDependencyHandleDrag,onRelease:l.onDependencyHandleRelease});const x=D.useCallback((t=>{s.onTaskClick&&s.onTaskClick({dataItem:e.dataItem,level:e.level,nativeEvent:t&&t.nativeEvent,syntheticEvent:t,target:null})}),[e.dataItem,e.level]),z=D.useCallback((t=>{s.onTaskDoubleClick&&s.onTaskDoubleClick({dataItem:e.dataItem,level:e.level,nativeEvent:t&&t.nativeEvent,syntheticEvent:t,target:null})}),[e.dataItem,e.level]),L=D.useCallback((t=>{s.onTaskContextMenu&&s.onTaskContextMenu({dataItem:e.dataItem,level:e.level,nativeEvent:t&&t.nativeEvent,syntheticEvent:t,target:null})}),[e.dataItem,e.level]),W=D.useCallback((t=>{s.onTaskRemoveClick&&s.onTaskRemoveClick({dataItem:e.dataItem,level:e.level,nativeEvent:t&&t.nativeEvent,syntheticEvent:t,target:null})}),[e.dataItem,e.level]),H=D.useCallback((()=>{const e=n.start,t=n.end,a=u.current,o=d.current,r=c.current;if(!I||null===a||null===o)return;const l=a.clientWidth/(t.getTime()-e.getTime()),s=(p.getTime()-e.getTime())*l,i=(g.getTime()-p.getTime())*l,m=(a.offsetHeight-o.offsetHeight)/2;o.style.left=`${Math.round(b?s-6:s)}px`,o.style.top=`${Math.round(m)}px`,b||(o.style.width=`${Math.round(i)}px`,null!==r&&(r.style.width=`${Math.round(i*(f||0))}px`)),S(!0)}),[n.start.getTime(),n.end.getTime(),v,C,I,f,r]);D.useEffect(H,[H]);const K={visibility:w?void 0:"hidden",display:I?void 0:"none"},V={userSelect:"none",display:l.draggedId===String(m)?"block":void 0};return D.createElement("td",{ref:u,key:m,role:"presentation"},b?D.createElement("div",{"aria-hidden":!0,className:o.classNames({"k-task":!0,"k-task-milestone":!0,"k-selected":y&&!Array.isArray(y)}),style:K,ref:d,[M]:m,onClick:x,onDoubleClick:z,onContextMenu:L},D.createElement("div",{className:"k-task-milestone-content"}),l.isEnabled&&D.createElement("div",{className:"k-task-dot k-task-start",ref:R,style:V,...F}),l.isEnabled&&D.createElement("div",{className:"k-task-dot k-task-end",ref:T,style:V,...N})):D.createElement("div",{"aria-hidden":!0,className:o.classNames({"k-task":!0,"k-task-summary":E,"k-task-single":!E,"k-selected":y&&!Array.isArray(y)}),ref:d,style:K,[M]:m,onClick:x,onDoubleClick:z,onContextMenu:L},E?D.createElement("div",{className:"k-task-summary-progress",ref:c},D.createElement("div",{className:"k-task-summary-complete"})):D.createElement("div",{className:"k-task-complete",ref:c}),!E&&D.createElement(D.Fragment,null,D.createElement("div",{className:"k-task-content"},h),s.onTaskRemoveClick?D.createElement("span",{className:"k-task-actions"},D.createElement("span",{onClick:W,className:"k-link k-task-delete","aria-label":"Delete"},D.createElement(o.IconWrap,{name:"x",icon:i.xIcon}))):null),l.isEnabled&&D.createElement("div",{className:"k-task-dot k-task-start",ref:R,style:V,...F}),l.isEnabled&&D.createElement("div",{className:"k-task-dot k-task-end",ref:T,style:V,...N})))}));Se.displayName="KendoReactGanttTask";const Re=e=>{const{dependency:t}=e,[n]=De(),a=D.useRef(null),r=le(),l=he(),[s,i]=D.useState(!1);return D.useEffect((()=>{if(null===a.current||null===n.current)return void i(!1);const e=n.current[o.getter(r.fromId)(t)],d=n.current[o.getter(r.toId)(t)];if(!e||!d)return void i(!1);const c=e.element,u=d.element;if(!c||!u)return void i(!1);if(!1===s)return void i(!0);const m={top:c.offsetTop+c.offsetHeight/2,start:c.offsetLeft,end:c.offsetLeft+c.offsetWidth},p={top:u.offsetTop+u.offsetHeight/2,start:u.offsetLeft,end:u.offsetLeft+u.offsetWidth},g=o.getter(r.type)(t),h=((e,t,n,a)=>{const o=[];let r=0,l=0;const s=10,i=Math.floor(n/2),d=e.top<t.top,c=()=>o.push({left:l,top:r});if(0===a||3===a){const n=3===a?"start":"end";r=e.top,l=e[n],c(),l=Math["start"===n?"min":"max"](e[n],t[n]),l="start"===n?l-s:l+s,c(),r=t.top,c(),l="start"===n?t[n]-4:t[n]+4,c(),G(r,l,o,"start"!==n)}else{const n=2===a?"start":"end",u=2===a?"end":"start",m=2===a?e[n]-20>=t[u]:e[n]+20<=t[u];r=e.top,l=e[n],c(),l="start"===n?l-s:l+s,c(),m||(r=d?r+i:r-i,c(),l="start"===n?t[u]+s:t[u]-s,c()),r=t.top,c(),l="start"===u?t[u]-4:t[u]+4,c(),G(r,l,o,"start"!==u)}return o})(m,p,l,g);h&&h.length&&a.current.setAttribute("points",h.map((e=>`${e.left},${e.top}`)).join(" "))})),D.createElement("polyline",{ref:a,style:{display:s?void 0:"none"}})};Re.displayName="KendoReactGanttDependency";const Te=class extends D.Component{constructor(e){super(e),this.state={activeId:void 0,level:0},this.tableElement=null,this.tbodyElement=null,this.wrapperScrollLeft=0,this.wrapperScrollTop=0,this.updateOnScroll=!1,this.tbodyOffsetTop=0,this.prevData=[],this.flattedData=[],this.element=null,this.contextStateRef={current:void 0},this.navigationStateRef={current:void 0},this.scrollIntoView=e=>{if(!this.element)return;const{rowIndex:t=0}=e,{rowHeight:n=0}=this.props;this.element.scroll(0,(t-1)*n)},this.getColumns=e=>{const t=e.filter((e=>e.declarationIndex>=0&&-1===e.parentIndex)),n=e=>(e.sort(((e,t)=>e.declarationIndex-t.declarationIndex)),e.map((e=>{const{declarationIndex:t,parentIndex:a,depth:o,colSpan:r,rowSpan:l,index:s,kFirst:i,groupable:d,children:c,...u}=e;return c.length?{children:n(c),...u}:u})));return n(t)},this.onKeyDown=e=>{if(r.tableKeyboardNavigation.onKeyDown(e,{navigatable:!1,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef}),this.props.onKeyDown){const{mode:t,cell:n}=r.getSelectionOptions(this.props.selectable),a={dataItems:this.getLeafDataItems(),mode:t,cell:n,componentId:this.props.treelistId,selectedField:this.props.selectedField,...this.getEventArguments(e)};this.props.onKeyDown.call(void 0,a)}},this.onFocus=e=>{r.tableKeyboardNavigation.onFocus(e,{contextStateRef:this.contextStateRef})},this.onRowDrag=e=>{if(this.props.onRowDrag){const t={...e,target:this};this.props.onRowDrag.call(void 0,t)}},this.onRowDrop=e=>{if(this.props.onRowDrop){const t={...e,target:this};this.props.onRowDrop.call(void 0,t)}},this.onColumnReorder=(e,t,n)=>{const{extendedColumns:a}=this.props,o=a[e].depth,r=e=>{do{e++}while(e<a.length&&a[e].depth>o);return e},l=[...a],s=l.splice(e,r(e)-e);if(l.splice(e<t?r(t-s.length):t,0,...s),l.filter((e=>e.declarationIndex>=0)).forEach(((e,t)=>e.orderIndex=t)),this.props.onColumnReorder){const e={target:this,columns:this.getColumns(l),nativeEvent:n};this.props.onColumnReorder.call(void 0,e)}},this.onColumnResize=(e,t,n,a,o)=>{if(this.props.onColumnResize){const r=this.props.extendedColumns.filter((e=>0===e.children.length)).reduce(((e,t)=>e+parseFloat(String(t.width))),0);this.tableElement&&(this.tableElement.style.width=r+"px");const l={columns:this.getColumns(this.props.extendedColumns),totalWidth:r,index:e,nativeEvent:a,newWidth:t,oldWidth:n,end:o,target:this};this.props.onColumnResize.call(void 0,l)}},this.onScroll=e=>{const t=e.currentTarget.scrollLeft,n=e.currentTarget.scrollTop,{columnVirtualization:a,scrollable:o,rowHeight:r=0}=this.props,l=r;let s=!1;a&&Math.abs(this.wrapperScrollLeft-t)>0&&(this.wrapperScrollLeft=t,s=!0),"virtual"===o&&Math.abs(this.wrapperScrollTop-n)>l&&(this.wrapperScrollTop=n,s=!0),s&&(this.updateOnScroll=!0,this.forceUpdate())},this.calculateSizes=e=>{if(!e||"none"===this.props.scrollable)return;const t=Array.from(e.childNodes),n=t.find((e=>"TABLE"===e.nodeName)),a=this.props.toolbar&&t.find((e=>1===e.nodeType&&e.classList.contains("k-grid-toolbar")));let o=0;if(a){const e=a.style.boxSizing;a.style.boxSizing="border-box",o=parseFloat(String(window.getComputedStyle(a).height))||a.offsetHeight,a.style.boxSizing=e,a.getAttribute("style")||a.removeAttribute("style")}this.tbodyOffsetTop=n.tBodies[0].offsetTop,l.setHeaderRowsTop(n,o)},this.onItemChange=e=>{if(e.field!==this.props.expandField){if(this.props.onItemChange){const t={...this.getEventArguments(e.syntheticEvent),dataItem:e.dataItem,level:e.level,field:e.field,value:e.value};this.props.onItemChange.call(void 0,t)}}else{const t=this.props.onExpandChange;if(t){const n={...this.getEventArguments(e.syntheticEvent),dataItem:e.dataItem,level:e.level,value:e.value};t.call(void 0,n)}}},this.onHeaderSelectionChange=e=>{if(this.props.onHeaderSelectionChange){const t={field:e.field,nativeEvent:e.syntheticEvent&&e.syntheticEvent.nativeEvent,syntheticEvent:e.syntheticEvent,target:this,dataItems:this.getLeafDataItems()};this.props.onHeaderSelectionChange.call(void 0,t)}},this.selectionRelease=e=>{if(this.props.onSelectionChange){const t={syntheticEvent:void 0,target:this,selectedField:this.props.selectedField||"",componentId:this.props.treelistId,dataItems:this.getLeafDataItems(),dataItem:null,level:[],...e};this.props.onSelectionChange.call(void 0,t)}},this.onSortChange=(e,t,n)=>{this.onDataStateChange(this.props.onSortChange,{sort:t,field:n},e)},this.onFilterChange=e=>{const{filter:t,field:n}=e;this.onDataStateChange(this.props.onFilterChange,{filter:t,field:n},e.syntheticEvent)},this.onColumnMenuFilterChange=(e,t,n)=>{if(!n)return;const{onColumnMenuFilterChange:a}=this.props;if(!a)return;const o={syntheticEvent:e,filter:t,field:n,target:this,nativeEvent:e.nativeEvent};a.call(void 0,o)},this.onExpandChange=(e,t,n)=>{const{expandField:a,onExpandChange:o}=this.props;if(a&&o){const a={...this.getEventArguments(e),dataItem:t,level:n,value:J(t,this.props.expandField)};o.call(void 0,a)}},this.onRowClick=(e,t)=>{if(this.props.onRowClick&&"TD"===e.target.nodeName){const n={dataItem:t.dataItem,level:t.level,...this.getEventArguments(e)};this.props.onRowClick.call(void 0,n)}},this.rowDoubleClick=(e,t)=>{if(this.props.onRowDoubleClick&&"TD"===e.target.nodeName){const n={dataItem:t.dataItem,level:t.level,...this.getEventArguments(e)};this.props.onRowDoubleClick.call(void 0,n)}},this.rowContextMenu=(e,t)=>{if(this.props.onRowContextMenu&&"TD"===e.target.nodeName){const n={dataItem:t.dataItem,level:t.level,...this.getEventArguments(e)};this.props.onRowContextMenu.call(void 0,n)}},this.onPageChange=e=>{if(this.props.onPageChange){const t={...this.getEventArguments(e.syntheticEvent),skip:e.skip,take:e.take};this.props.onPageChange.call(void 0,t)}},this.onDataStateChange=(e,t,n)=>{if(e&&e.call(void 0,{...this.getEventArguments(n),...t}),this.props.onDataStateChange){const e={...this.getEventArguments(n),dataState:{...this.getDataState(),...t}};this.props.onDataStateChange.call(void 0,e)}},this.getDataState=()=>({filter:this.props.filter,sort:this.props.sort}),this.getEventArguments=e=>({nativeEvent:e&&e.nativeEvent,syntheticEvent:e,target:this}),this.getLeafDataItems=()=>this.flatData.map((e=>e.dataItem)),this.dragLogic=new r.CommonDragLogic(this.onColumnReorder,o.noop,o.noop),this.columnResize=new r.ColumnResize(this.onColumnResize),r.tableKeyboardNavigation.onConstructor({navigatable:!!e.navigatable,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef,idPrefix:e.idPrefix})}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}componentDidMount(){this.calculateSizes(this.element),r.tableKeyboardNavigation.onComponentDidMount({scope:this.element||void 0,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef})}getSnapshotBeforeUpdate(){return r.tableKeyboardNavigation.onGetSnapshotBeforeUpdate({document:this.document,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef}),null}componentDidUpdate(e){e.columns!==this.props.columns&&this.calculateSizes(this.element),r.tableKeyboardNavigation.onComponentDidUpdate({scope:this.element||void 0,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef})}componentWillUnmount(){this.columnResize.columns=[],this.dragLogic.columns=[],this.prevData=[],this.flattedData=[],this.updateOnScroll=!1}render(){const{filterRow:e,scrollable:t="scrollable",resizable:n=!1,reorderable:a=!1,skip:s,take:i,afterContent:d,extendedColumns:c=[],columnsMap:u}=this.props,m=c.some((e=>!!e.filter))||void 0!==e,p=e||r.FilterRow,g=r.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef);this.columnResize.columns=c,this.columnResize.resizable=n,this.dragLogic.columns=c,this.dragLogic.reorderable=a,this.dragLogic.groupable=!1;const h=c.filter((e=>0===e.children.length)),f=D.createElement(r.Header,{headerRow:D.createElement(r.HeaderRow,{sort:this.props.sort,sortable:this.props.sortable,sortChange:this.onSortChange,selectionChange:this.onHeaderSelectionChange,columns:c,columnsMap:u,cellRender:this.props.headerCellRender,columnResize:this.columnResize,columnMenu:this.props.columnMenu,columnMenuFilter:this.props.columnMenuFilter,columnMenuFilterChange:this.onColumnMenuFilterChange,pressHandler:this.dragLogic.pressHandler,dragHandler:this.dragLogic.dragHandler,releaseHandler:this.dragLogic.releaseHandler}),filterRow:m&&D.createElement(p,{columns:h,filter:this.props.filter,filterChange:this.onFilterChange,sort:this.props.sort,ariaRowIndex:u.length+1})||void 0,columnResize:this.columnResize}),k=this.props.style||{},{colSpans:y,hiddenColumns:v}=r.tableColumnsVirtualization({enabled:this.props.columnVirtualization,columns:h,scrollLeft:this.wrapperScrollLeft,tableViewPortWidth:parseFloat((k.width||"").toString())}),C=(e,t,n,a,o,s)=>h.map(((i,d)=>{if(v[d])return null;const c=i.id?i.id:d,u=`k-table-td ${i.className?i.className+" ":""}${i.locked?"k-grid-content-sticky":""}`,m={id:r.tableKeyboardNavigationTools.generateNavigatableId(`${n}-${String(d)}`,g),colSpan:y[d],dataItem:e.dataItem,field:i.field,format:i.format,className:u||void 0,render:this.props.cellRender,onChange:this.onItemChange,selectionChange:this.props.onSelectionChange?t=>{this.onSelectionChange({event:t,item:e,columnIndex:d,dataIndex:o})}:void 0,level:e.level,expandable:i.expandable,expanded:a,hasChildren:ee(e.dataItem,this.props.subItemsField),colIndex:d,ariaColumnIndex:i.ariaColumnIndex,onExpandChange:this.onExpandChange,style:void 0!==i.left&&{left:i.left,right:i.right,borderRightWidth:i.rightBorder?"1px":""}||{},isSelected:Array.isArray(s)&&s.indexOf(d)>-1};return t&&i.editCell?D.createElement(i.editCell,{...m,onChange:this.onItemChange,key:c}):i.cell?D.createElement(i.cell,{key:c,...m}):D.createElement(l.TreeListCell,{key:c,...m})}));let E=this.flatData;const b=E.length;void 0!==s&&void 0!==i&&(E=E.slice(s,s+i)),"virtual"===t&&(E=l.tableRowsVirtualization({rows:E,tableViewPortHeight:parseFloat((k.height||k.maxHeight||"").toString()),scrollTop:this.wrapperScrollTop}),this.updateOnScroll=!1);const I=E.map((e=>e.level)),w=u.length+(m?1:0)+1,S=E.length>0&&E.map(((e,t)=>{const n=o.getter(this.props.editField||"")(e.dataItem),a=o.getter(this.props.dataItemKey)(e.dataItem),r=String(a||e.level.join(".")),s=J(e.dataItem,this.props.expandField),i=this.props.selectedField?o.getter(this.props.selectedField)(e.dataItem):void 0,d={key:r,level:e.level,levels:I,dataItem:e.dataItem,selectedField:this.props.selectedField,rowHeight:e.height,render:this.props.rowRender,onDrop:this.onRowDrop,onDrag:this.onRowDrag,onClick:t=>this.onRowClick(t,e),onDoubleClick:t=>this.rowDoubleClick(t,e),onContextMenu:t=>this.rowContextMenu(t,e),isAltRow:t%2!=0,expanded:s,rowIndex:t,ariaRowIndex:w+t,ariaSetSize:e.levelCount,ariaPosInSet:e.level[e.level.length-1]+1,isSelected:"boolean"==typeof i&&i},c=this.props.editRow,u=this.props.row||l.TreeListRow,m=C(e,n,r,s,t,i);return n&&c?D.createElement(c,{...d,key:d.key},m):D.createElement(u,{...d,key:d.key},m)}))||D.createElement("tr",{className:"k-table-row k-grid-norecords"},D.createElement("td",{className:"k-table-td",colSpan:h.length},this.props.noRecords||D.createElement(l.TreeListNoRecords,null))),R=e=>this.props.sort&&this.props.sort.some((t=>t.field===e)),T=D.createElement("colgroup",{ref:e=>{this.columnResize.colGroupMain=e}},h.map(((e,t)=>D.createElement("col",{key:t.toString(),className:R(e.field)?"k-sorted":void 0,style:void 0!==e.width?{width:e.width}:void 0})))),x=this.props.columnVirtualization||"virtual"===this.props.scrollable,F=this.props.selectable&&this.props.selectable.drag?"none":void 0,N=this.props.tableProps||{};return D.createElement(r.TableKeyboardNavigationContext.Provider,{value:this.contextStateRef.current},D.createElement("div",{id:this.props.treelistId,style:this.props.style,className:o.classNames("k-grid k-grid-md",this.props.className,{"k-treelist-scrollable":"none"!==t}),ref:e=>{this.element=e},onScroll:x?this.onScroll:void 0,onKeyDown:this.onKeyDown,onFocus:this.onFocus,"aria-rowcount":b,"aria-colcount":h.length,role:"treegrid",...r.tableKeyboardNavigationScopeAttributes},this.props.toolbar,D.createElement(r.TableSelection,{selectable:this.props.selectable,onRelease:this.selectionRelease,childRef:e=>{this.tableElement=e}},D.createElement("table",{className:"k-table k-table-md",...this.props.tableProps||{},style:{...N.style||{},userSelect:F},role:"presentation"},T,f,D.createElement("tbody",{className:"k-table-tbody",...r.tableKeyboardNavigationBodyAttributes,ref:e=>{this.tbodyElement=e},role:"presentation"},S))),this.props.pager&&D.createElement(this.props.pager,{className:"k-grid-pager",total:b,skip:s,take:i,onPageChange:this.onPageChange}),a&&D.createElement(D.Fragment,null,D.createElement(r.DropClue,{ref:this.dragLogic.refDropElementClue}),D.createElement(r.DragClue,{ref:this.dragLogic.refDragElementClue})),d))}get flatData(){const{data:e=[],rowHeight:t=0}=this.props;let n=0;const a=()=>{const e={height:t,offsetTop:n};return n+=e.height,e},o=this.updateOnScroll&&this.prevData===e&&this.tbodyOffsetTop>0&&this.flattedData.length?this.flattedData:e.map((e=>({...e,...a()})));return this.prevData=e,this.flattedData=o,o}onSelectionChange(e){if(this.props.onSelectionChange){const{event:t,item:n,dataIndex:a,columnIndex:o}=e,{mode:l,cell:s}=r.getSelectionOptions(this.props.selectable),i={...this.getEventArguments(t.syntheticEvent),dataItem:n.dataItem,level:n.level,startColIndex:o,endColIndex:o,startRowIndex:a,endRowIndex:a,dataItems:this.getLeafDataItems(),altKey:!1,ctrlKey:!1,shiftKey:!1,metaKey:!1,mode:l,cell:s,isDrag:!1,componentId:this.props.treelistId,selectedField:this.props.selectedField||""};this.props.onSelectionChange.call(void 0,i)}}};Te.propTypes={data:n.array,resizable:n.bool,reorderable:n.bool,sortable:n.oneOfType([n.bool,n.shape({mode:n.oneOf(["single","multiple"]),allowUnsort:n.bool})]),onSortChange:n.func,sort:n.array,columns:n.arrayOf(n.object),columnVirtualization:n.bool,filter:n.array,onFilterChange:n.func,filterRow:n.any,toolbar:n.any,noRecords:n.any,onExpandChange:n.func,expandField:n.string,subItemsField:n.string,selectedField:n.string,onSelectionChange:n.func,onHeaderSelectionChange:n.func,onRowClick:n.func,onItemChange:n.func,editField:n.string,scrollable:n.oneOf(["none","scrollable","virtual"]),rowHeight:n.number,style:n.object,tableProps:n.object,pager:n.any,skip:n.number,take:n.number,onPageChange:n.func,onDataStateChange:n.func,onColumnResize:n.func,onColumnReorder:n.func,extendedColumns:n.arrayOf(n.object),columnsMap:n.arrayOf(n.array),dataItemKey:n.string.isRequired,afterContent:n.any,navigatable:n.bool,idPrefix:n.string,treelistId:n.string},Te.contextType=r.TableKeyboardNavigationContext;let xe=Te;const Fe=D.forwardRef(((e,t)=>{const{slotLevels:n,slotWidth:a,timelineHeaderCell:l}=e,{columns:s,noRecords:i,resizable:d,reorderable:c,sortable:u,sort:m,filter:p,columnMenuFilter:g,columnMenu:h,navigatable:f,row:k,selectable:y}=ie(),{onDataStateChange:v,onSortChange:C,onFilterChange:E,onColumnMenuFilterChange:b,onExpandChange:I,onRowClick:w,onRowDoubleClick:S,onRowContextMenu:R,onColumnResize:F,onColumnReorder:N,onDependencyCreate:z,onKeyDown:L,onSelectionChange:W,onHeaderSelectionChange:H}=D.useContext(ke),K=he(),V=D.useContext(fe),O=oe(),A=le(),P=D.useContext(te),B=D.useContext(ne),G=D.useRef(null),_=D.useRef(null),$=D.useRef(null),q=D.useRef(null),Z=D.useRef(0),U=D.useRef(o.useId()),j=D.useRef(o.useId()),Y=D.useRef(null),X=D.useRef(null),Q=D.useCallback((e=>{$.current&&$.current.scrollIntoView(e)}),[]);D.useImperativeHandle(X,(()=>({scrollIntoView:Q}))),D.useImperativeHandle(t,(()=>X.current));const J=D.useRef(0),ee=D.useRef(0),ae=D.useRef(0),re=D.useRef(0),se=D.useRef(null),de=D.useRef(null),[ce,ue]=D.useState(null),me=((e,t,n)=>{const a=n;return D.createElement("table",{className:"k-table k-table-md",ref:t,"aria-hidden":!0},D.createElement("tbody",{className:"k-table-tbody"},e.map(((e,t)=>D.createElement("tr",{className:"k-table-row",key:t},e.map(((e,n)=>D.createElement("td",{key:e.range.start.getTime(),colSpan:e.span,className:o.classNames("k-table-th",{"k-header":!0,"k-nonwork-hour":!e.isWork})},a?D.createElement(a,{rowIndex:t,index:n,range:e.range,text:e.text,isWork:e.isWork,type:e.type}):e.text))))))))})(n,G,l),pe=((e,t)=>{const n=e[e.length-1];return D.createElement("table",{className:"k-table k-table-md k-gantt-columns",ref:t,"aria-hidden":!0},D.createElement("tbody",{className:"k-table-tbody"},D.createElement("tr",{className:"k-table-row"},n.map((e=>D.createElement("td",{key:e.range.start.getTime(),colSpan:e.span,className:o.classNames("k-table-td",{"k-nonwork-hour":!e.isWork})}))))))})(n,_),ge=((e,t)=>{const n=e[e.length-1];let a=0,o=0;return n.forEach((e=>{const t=e.span;o+=t,t>a&&(a=t)})),Math.round(o*t/a)})(n,a),{extendedColumns:ye,columnsWidth:ve,columnsMap:Ce}=D.useMemo((()=>{const e=r.readColumns([...s,{title:"",sortable:!1,resizable:!1,reorderable:!1,width:ge,headerCell:()=>me,cell:Se,orderIndex:Number.MAX_SAFE_INTEGER,navigatable:!1}],{prevId:0,idPrefix:U.current});let t=0;return e.forEach(((e,n,a)=>{const o=n+1===a.length,r=0===e.children.length;o?e.isAccessible=!1:(e.locked=!0,r&&(e.width=e.width||T)),r&&(t+=parseFloat(String(e.width)))})),{extendedColumns:e,columnsWidth:t,columnsMap:r.mapColumns(e)}}),[s,ge]),[De,Ee]=(()=>{const e=D.useRef({}),t=D.useCallback((t=>{switch(t.type){case 0:e.current[t.id]=t.itemRef;break;case 1:delete e.current[t.id]}}),[]);return[e,t]})(),be=D.useCallback((()=>G.current&&G.current.parentElement),[]),we=()=>{const e=be(),t=_.current,n=$.current&&$.current.tbodyElement;if(!e||!t||!n)return;const a=n.offsetTop,o=e.offsetLeft,r=ge;t.style.top=a+"px",t.style.left=o+"px",t.style.width=r+"px",t.style.height=n.offsetHeight+"px"};D.useEffect(we),D.useEffect((()=>{const e=be();e&&(Z.current=e.offsetLeft)}));const Te=D.useCallback((e=>{if(!q.current)return;const t=e.columns.slice(0,e.columns.length-1);if(e.end)q.current.style.left="0px";else{const e=be();if(!e)return;q.current.style.left=e.offsetLeft-Z.current+"px",we()}F({...e,columns:t})}),[F]),Fe=D.useCallback((e=>{const t=e.columns.slice(0,e.columns.length-1);N({...e,columns:t})}),[F]),Ne=D.useCallback((e=>{const t=(Y.current&&Y.current.ownerDocument?Y.current.ownerDocument:document).elementFromPoint(e.clientX,e.clientY),n=Y.current;if(!t||!t.parentElement||!n)return;const a=n.parentElement,o=n.firstElementChild;if(!a||!o)return;const r=t.getAttribute(x);if(r){const l=n.offsetTop,s=n.offsetLeft,i=a.offsetTop,d=a.offsetLeft,c=o.scrollTop,u=o.scrollLeft;ae.current=s+d,re.current=l+i,J.current=e.clientX-ae.current+u,ee.current=e.clientY-re.current+c,se.current=t.parentElement.getAttribute(M),de.current=r}}),[]),Me=D.useCallback((e=>{const t=Y.current;if(!t)return;const n=t.firstElementChild;if(!n)return;const a=n.scrollTop,o=n.scrollLeft,r=e.clientX-ae.current+o,l=e.clientY-re.current+a;Math.abs(J.current-r)<10&&Math.abs(ee.current-l)<10||ue({startX:J.current,startY:ee.current,endX:r,endY:l})}),[]),ze=D.useCallback((e=>{const t=(Y.current&&Y.current.ownerDocument?Y.current.ownerDocument:document).elementFromPoint(e.clientX,e.clientY);if(!t||!t.parentElement)return;const n=t.parentElement.getAttribute(M),a=t.getAttribute(x);if(a&&n!==se.current&&z){let e;e="start"===de.current?"start"===a?3:2:"start"===a?1:0,z({fromId:se.current,toId:n,type:e})}J.current=0,ee.current=0,ae.current=0,re.current=0,se.current=null,de.current=null,ue(null)}),[z,ue]);return D.createElement(Ie,{tasksStore:[De,Ee],timelineWidth:ge,dependencyDrag:{isEnabled:!!z,draggedId:se.current,onDependencyHandlePress:Ne,onDependencyHandleDrag:Me,onDependencyHandleRelease:ze}},D.createElement("div",{className:"k-gantt-content",ref:Y,style:{height:`calc(100% - ${V}px)`}},D.createElement(xe,{treelistId:j.current,ref:$,extendedColumns:ye,columnsMap:Ce,dataItemKey:O.id,data:P,idPrefix:U.current,navigatable:f,expandField:O.isExpanded,subItemsField:O.children,editField:O.isInEdit,selectedField:O.isSelected,onDataStateChange:v,onSortChange:C,onFilterChange:E,onExpandChange:I,onRowClick:w,onRowDoubleClick:S,onRowContextMenu:R,onColumnResize:Te,onColumnReorder:Fe,onColumnMenuFilterChange:b,onKeyDown:L,onSelectionChange:W,onHeaderSelectionChange:H,tableProps:{style:{width:ve},className:"k-table k-table-md k-table-layout-fixed"},noRecords:i,rowHeight:K,resizable:d,reorderable:c,sortable:u,sort:m,filter:p,columnMenuFilter:g,columnMenu:h,row:k,selectable:y,afterContent:D.createElement(D.Fragment,null,D.createElement("svg",{className:"k-gantt-dependencies-svg",ref:q,style:{left:0,top:0}},B.map((e=>D.createElement(Re,{key:o.getter(A.id)(e),dependency:e})))),D.createElement("svg",{className:"k-gantt-dependencies-svg",style:{left:0,top:0,zIndex:3}},ce&&D.createElement("polyline",{points:`${ce.startX},${ce.startY} ${ce.endX},${ce.endY}`})),P&&P.length?pe:null)})))}));Fe.displayName="KendoReactGanttBaseView";const Ne="gantt.weekViewTitle",Me="gantt.dayViewTitle",ze="gantt.monthViewTitle",Le="gantt.yearViewTitle",We="gantt.filterClearButton",He="gantt.filterEqOperator",Ke="gantt.filterNotEqOperator",Ve="gantt.filterIsNullOperator",Oe="gantt.filterIsNotNullOperator",Ae="gantt.filterIsEmptyOperator",Pe="gantt.filterIsNotEmptyOperator",Be="gantt.filterStartsWithOperator",Ge="gantt.filterContainsOperator",_e="gantt.filterNotContainsOperator",$e="gantt.filterEndsWithOperator",qe="gantt.filterGteOperator",Ze="gantt.filterGtOperator",Ue="gantt.filterLteOperator",je="gantt.filterLtOperator",Ye="gantt.filterIsTrue",Xe="gantt.filterIsFalse",Qe="gantt.filterBooleanAll",Je="gantt.filterAfterOrEqualOperator",et="gantt.filterAfterOperator",tt="gantt.filterBeforeOperator",nt="gantt.filterBeforeOrEqualOperator",at="gantt.editSave",ot="gantt.editCancel",rt="gantt.editAdd",lt="gantt.editRemove",st="gantt.editTabGeneral",it="gantt.editTabPredecessors",dt="gantt.editTabSuccessors",ct="gantt.editorTitle",ut="gantt.editorTaskTitle",mt="gantt.editorTaskStart",pt="gantt.editorTaskEnd",gt="gantt.editorTaskComplete",ht="gantt.editorTaskParent",ft="gantt.editorValidationRequired",kt="gantt.editorValidationStart",yt="gantt.editorValidationEnd",vt="gantt.editorValidationPercentCompleteRange",Ct="gantt.editorDependencyTypesFF",Dt="gantt.editorDependencyTypesSF",Et="gantt.editorDependencyTypesFS",bt="gantt.editorDependencyTypesSS",It="gantt.addTask",wt="gantt.addChild",St="gantt.addAbove",Rt="gantt.addBelow",Tt="gantt.viewSelector",xt="gantt.editorDelete",Ft="gantt.deleteConfirmation",Nt="gantt.deleteDialogTitle",Mt="gantt.editorDependencyNameLabel",zt="gantt.editorDependencyTypeLabel",Lt={[Ne]:"Week",[Me]:"Day",[ze]:"Month",[Le]:"Year",[We]:"Clear",[He]:"Is equal to",[Ke]:"Is not equal to",[Ve]:"Is null",[Oe]:"Is not null",[Ae]:"Is empty",[Pe]:"Is not empty",[Be]:"Starts with",[Ge]:"Contains",[_e]:"Does not contain",[$e]:"Ends with",[qe]:"Is greater than or equal to",[Ze]:"Is greater than",[Ue]:"Is less than or equal to",[je]:"Is less than",[Ye]:"Is true",[Xe]:"Is false",[Qe]:"(All)",[Je]:"Is after or equal to",[et]:"Is after",[tt]:"Is before",[nt]:"Is before or equal to","gantt.noRecords":"No records available",[at]:"Save",[ot]:"Cancel",[rt]:"Add",[lt]:"Remove",[st]:"General",[it]:"Predecessors",[dt]:"Successors",[ct]:"Edit task",[ut]:"Title",[mt]:"Start",[pt]:"End","gantt.editorTaskPlannedStart":"Planned Start Date","gantt.editorTaskPlannedEnd":"Planned End Date","gantt.editorTaskActualStart":"Actual Start Date","gantt.editorTaskActualEnd":"Actual End Date",[gt]:"Complete",[ht]:"Parent",[ft]:"Field is required.",[kt]:"Start time must be be before End time.",[yt]:"End time must be after Start time.",[vt]:"Value should be between 0 and 100.",[Ct]:"Finish-Finish",[Et]:"Finish-Start",[Dt]:"Start-Finish",[bt]:"Start-Start",[It]:"Add Task",[wt]:"Add Child",[St]:"Add Above",[Rt]:"Add Below",[Tt]:"View Selector",[xt]:"Delete",[Ft]:"Are you sure you want to delete this event?",[Nt]:"Delete Event",[Mt]:"Name",[zt]:"Type"},Wt=D.forwardRef(((e,t)=>{const{slotWidth:n=Ht.slotWidth,firstSlotRangeRef:a,timelineHeaderCell:o}=e,{timezone:r}=ie(),l=s.useInternationalization(),i=D.useRef(null),d=D.useRef(null),c=D.useCallback((e=>{d.current&&d.current.scrollIntoView(e)}),[]);D.useImperativeHandle(i,(()=>({scrollIntoView:c}))),D.useImperativeHandle(t,(()=>i.current));const u=ce(),m=e.workWeekStart||Ht.workWeekStart,p=e.workWeekEnd||Ht.workWeekEnd,g=D.useMemo((()=>{const e=q({workWeekStart:m,workWeekEnd:p}),t=[],n=Y(u,{timezone:r},l);return n.forEach((n=>{const a=j(n.range,{workDays:e,timezone:r},l);t.push.apply(t,a)})),a&&t[0]&&(a.current=t[0].range),[n,t]}),[r,u.start.getTime(),u.end.getTime(),l,m,p]);return D.createElement(Fe,{ref:d,slotWidth:n,slotLevels:g,timelineHeaderCell:o})})),Ht={name:"week",dateRange:({intl:e,tasksStart:t,tasksEnd:n,timezone:o})=>{const r=a.ZonedDate.fromLocalDate(t,o),l=a.ZonedDate.fromLocalDate(n,o),s=A(a.firstDayInWeek(a.getDate(r),e.firstDay())),i=P(a.firstDayInWeek(a.getDate(l),e.firstDay()),7),d=a.ZonedDate.fromUTCDate(B(s),o),c=a.ZonedDate.fromUTCDate(B(i),o);return{start:new Date(d.getTime()),end:new Date(c.getTime()),zonedStart:d,zonedEnd:c}},title:e=>e.toLanguageString(Ne,Lt[Ne]),slotWidth:T,workWeekStart:1,workWeekEnd:5,workDayStart:"08:00",workDayEnd:"17:00"};Wt.propTypes={name:n.string,dateRange:n.oneOfType([n.func,n.object]),title:n.oneOfType([n.string,n.func]),slotWidth:n.number,workWeekStart:n.number,workWeekEnd:n.number,workDayStart:n.string,workDayEnd:n.string},Wt.displayName="KendoReactGanttWeekView";const Kt=D.forwardRef(((e,t)=>{const{slotWidth:n=Vt.slotWidth,slotDuration:o=Vt.slotDuration,firstSlotRangeRef:r,timelineHeaderCell:l}=e,{timezone:i}=ie(),d=s.useInternationalization(),c=D.useRef(null),u=D.useRef(null),m=D.useCallback((e=>{u.current&&u.current.scrollIntoView(e)}),[]);D.useImperativeHandle(c,(()=>({scrollIntoView:m}))),D.useImperativeHandle(t,(()=>c.current));const p=ce(),g=e.workWeekStart||Vt.workWeekStart,h=e.workWeekEnd||Vt.workWeekEnd,f=e.workDayStart||Vt.workDayStart,k=e.workDayEnd||Vt.workDayEnd,y=D.useMemo((()=>{const e=q({workWeekStart:g,workWeekEnd:h}),t=[],n=j(p,{workDays:e,timezone:i},d);return n.forEach((e=>{const n=((e,t,n)=>{const o=n.parseDate(t.workDayStart).getHours(),r=n.parseDate(t.workDayEnd).getHours();return U(e,{step:a.MS_PER_MINUTE*t.slotDuration,timezone:t.timezone}).map((e=>{const t=e.zonedStart.getHours();return{range:e,isWork:t>=o&&t<r,span:1,text:n.formatDate(e.zonedStart,"hh:mm a"),type:"time"}}))})(e.range,{workDayStart:f,workDayEnd:k,timezone:i,slotDuration:o},d);e.span=n.length,t.push.apply(t,n)})),r&&t[0]&&(r.current=t[0].range),[n,t]}),[i,p.start.getTime(),p.end.getTime(),d,g,h,f,k]);return D.createElement(Fe,{ref:u,slotWidth:n,slotLevels:y,timelineHeaderCell:l})})),Vt={name:"day",dateRange:({tasksStart:e,tasksEnd:t,timezone:n})=>{const o=a.ZonedDate.fromLocalDate(e,n),r=a.ZonedDate.fromLocalDate(t,n),l=A(o),s=P(r),i=a.ZonedDate.fromUTCDate(B(l),n),d=a.ZonedDate.fromUTCDate(B(s),n);return{start:new Date(i.getTime()),end:new Date(d.getTime()),zonedStart:i,zonedEnd:d}},title:e=>e.toLanguageString(Me,Lt[Me]),slotWidth:T,slotDuration:60,workWeekStart:1,workWeekEnd:5,workDayStart:"08:00",workDayEnd:"17:00"};Kt.propTypes={name:n.string,dateRange:n.oneOfType([n.func,n.object]),title:n.oneOfType([n.string,n.func]),slotWidth:n.number,slotDuration:n.number,workWeekStart:n.number,workWeekEnd:n.number,workDayStart:n.string,workDayEnd:n.string},Kt.displayName="KendoReactGanttDayView";const Ot=D.forwardRef(((e,t)=>{const{slotWidth:n=At.slotWidth,firstSlotRangeRef:a,timelineHeaderCell:o}=e,{timezone:r}=ie(),l=s.useInternationalization(),i=D.useRef(null),d=D.useRef(null),c=D.useCallback((e=>{d.current&&d.current.scrollIntoView(e)}),[]);D.useImperativeHandle(i,(()=>({scrollIntoView:c}))),D.useImperativeHandle(t,(()=>i.current));const u=ce(),m=D.useMemo((()=>{const e=[],t=X(u,{timezone:r},l);return t.forEach((t=>{const n=Y(t.range,{timezone:r},l);e.push.apply(e,n)})),a&&e[0]&&(a.current=e[0].range),[t,e]}),[r,u.start.getTime(),u.end.getTime(),l]);return D.createElement(Fe,{ref:d,slotWidth:n,slotLevels:m,timelineHeaderCell:o})})),At={name:"month",dateRange:({tasksStart:e,tasksEnd:t,timezone:n})=>{const o=a.ZonedDate.fromLocalDate(e,n),r=a.ZonedDate.fromLocalDate(t,n),l=a.firstDayOfMonth(a.getDate(o)),s=a.addDays(a.lastDayOfMonth(a.getDate(r)),1),i=a.ZonedDate.fromUTCDate(B(l),n),d=a.ZonedDate.fromUTCDate(B(s),n);return{start:new Date(i.getTime()),end:new Date(d.getTime()),zonedStart:i,zonedEnd:d}},title:e=>e.toLanguageString(ze,Lt[ze]),slotWidth:T,workWeekStart:1,workWeekEnd:5,workDayStart:"08:00",workDayEnd:"17:00"};Ot.propTypes={name:n.string,dateRange:n.oneOfType([n.func,n.object]),title:n.oneOfType([n.string,n.func]),slotWidth:n.number,workWeekStart:n.number,workWeekEnd:n.number,workDayStart:n.string,workDayEnd:n.string},Ot.displayName="GanttMonthView";const Pt=D.forwardRef(((e,t)=>{const{slotWidth:n=Bt.slotWidth,firstSlotRangeRef:a,timelineHeaderCell:o}=e,{timezone:r}=ie(),l=s.useInternationalization(),i=D.useRef(null),d=D.useRef(null),c=D.useCallback((e=>{d.current&&d.current.scrollIntoView(e)}),[]);D.useImperativeHandle(i,(()=>({scrollIntoView:c}))),D.useImperativeHandle(t,(()=>i.current));const u=ce(),m=D.useMemo((()=>{const e=Q(u,{timezone:r},l),t=[];return e.forEach((e=>{const n=X(e.range,{timezone:r},l);t.push.apply(t,n)})),a&&t[0]&&(a.current=t[0].range),[e,t]}),[r,u.start.getTime(),u.end.getTime(),l]);return D.createElement(Fe,{slotWidth:n,slotLevels:m,timelineHeaderCell:o})})),Bt={name:"year",dateRange:({tasksStart:e,tasksEnd:t,timezone:n})=>{const o=a.ZonedDate.fromLocalDate(e,n),r=a.ZonedDate.fromLocalDate(t,n),l=a.firstDayOfMonth(a.firstMonthOfYear(a.getDate(o))),s=a.addDays(a.lastDayOfMonth(a.lastMonthOfYear(a.getDate(r))),1),i=a.ZonedDate.fromUTCDate(B(l),n),d=a.ZonedDate.fromUTCDate(B(s),n);return{start:new Date(i.getTime()),end:new Date(d.getTime()),zonedStart:i,zonedEnd:d}},title:e=>e.toLanguageString(Le,Lt[Le]),slotWidth:T};Pt.propTypes={name:n.string,dateRange:n.oneOfType([n.func,n.object]),title:n.oneOfType([n.string,n.func]),slotWidth:n.number},Pt.displayName="GanttYearView";const Gt=e=>{const[t,n]=pe(),a=s.useLocalization(),o=D.useMemo((()=>"function"==typeof e.view.title?e.view.title.call(void 0,a):e.view.title),[e.view.title,a]),r=D.useCallback((()=>{e.view.name&&n(e.view.name)}),[n,e.view.name]);return D.createElement(d.Button,{role:"button",type:"button",tabIndex:-1,togglable:!0,selected:e.view.name===t,onClick:r},o)};Gt.displayName="KendoReactGanttViewSelectorItem";const _t=D.forwardRef((()=>{const e=D.useContext(ue),[t,n]=pe(),a=s.useLocalization(),o=D.useCallback((e=>{n&&(e.preventDefault(),n(e.target.value))}),[n]);return D.createElement("div",{className:"k-gantt-views-wrapper"},D.createElement(d.ButtonGroup,{className:"k-gantt-views"},e.map((e=>D.createElement(Gt,{key:e.props.name,view:e.props})))),D.createElement("select",{value:t,onChange:o,"aria-label":(e=>a.toLanguageString(e,Lt[e]))(Tt),className:"k-picker k-picker-solid k-dropdown-list k-dropdown k-views-dropdown k-rounded-md"},e.map((e=>D.createElement("option",{key:e.props.name,value:e.props.name},"function"==typeof e.props.title?e.props.title.call(void 0,a):e.props.title)))))}));_t.displayName="KendoReactGanttViewSelectorList";const $t=D.forwardRef(((e,t)=>{const{className:n,...a}=e,r=D.useRef(null);return D.useImperativeHandle(t,(()=>({element:r.current,props:e}))),D.createElement(d.ToolbarItem,{ref:e=>{e&&(r.current=e.element)},className:o.classNames("k-gantt-views",n),...a},e.children)}));$t.displayName="KendoReactGanttViewSelector";const qt=D.forwardRef(((e,t)=>{const{className:n,...a}=e,r=D.useRef(null),l=D.useRef(null);D.useImperativeHandle(l,(()=>({element:r.current,props:e}))),D.useImperativeHandle(t,(()=>l.current));const s=D.useMemo((()=>o.classNames("k-gantt-toolbar k-gantt-header",n)),[n]);return D.createElement(d.Toolbar,{ref:e=>{e&&(r.current=e.element)},className:s,...a},e.children)}));qt.displayName="KendoReactGanttToolbar";const Zt={name:"@progress/kendo-react-gantt",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"11.3.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},Ut=D.forwardRef(((e,t)=>{const n=s.useLocalization(),a=e=>n.toLanguageString(e,Lt[e]),r=a(It),l=a(wt),c=a(St),u=a(Rt),m=D.useCallback((t=>{t.syntheticEvent.preventDefault();const n=t.item&&t.item.direction?t.item.direction:"none";e.onClick&&e.onClick({nativeEvent:t.nativeEvent,syntheticEvent:t.syntheticEvent,direction:n})}),[e.onClick]),p=D.useCallback((t=>{t.preventDefault(),e.onClick&&e.onClick({nativeEvent:t&&t.nativeEvent,syntheticEvent:t,direction:"none"})}),[e.onClick]),g=D.createElement(D.Fragment,null,D.createElement(o.IconWrap,{name:"plus",icon:i.plusIcon}),r);return e.selectedTask?D.createElement(d.DropDownButton,{className:"k-views-dropdown",onItemClick:m,popupSettings:{popupClass:"k-gantt-toolbar"},textField:"title",items:[{title:l,direction:"child"},{title:c,direction:"above"},{title:u,direction:"below"}],text:g}):D.createElement(d.Button,{onClick:p},g)}));Ut.displayName="KendoReactGanttAddButton";const jt=D.forwardRef(((e,t)=>{const n=!o.validatePackage(Zt,{component:"Gantt"}),{columns:a=Yt.columns,taskData:r=Yt.taskData,dependencyData:i=Yt.dependencyData,style:c,className:u,noRecords:m,timezone:p,rowHeight:g=Yt.rowHeight,resizable:h,reorderable:f,sortable:k,sort:y,filter:v,columnMenuFilter:C,columnMenu:E,navigatable:b,toolbar:I,row:w,selectable:R}=e,T=new Map;T.set(Kt,Vt),T.set(Ot,At),T.set(Wt,Ht),T.set(Pt,Bt);const x=s.useInternationalization(),{fields:F}=D.useMemo((()=>(e=>({fields:{...z,...e}}))(e.taskModelFields)),[e.taskModelFields]),{fields:N}=D.useMemo((()=>(e=>({fields:{...L,...e}}))(e.dependencyModelFields)),[e.dependencyModelFields]),M=D.useCallback(((e,t)=>n=>J(n,e)&&ee(n,t)?[...o.getter(t)(n)]:[])(F.isExpanded,F.children),[F.isExpanded,F.children]),W=D.useRef(null),H=D.useRef(null),K=D.useRef(null),V=D.useRef(null),O=D.useRef(null),A=D.useCallback((e=>{const t=o.getter(F.start)(e),n=o.getter(F.end)(e),a=o.getter(F.isSelected)(e);(!H.current||t<H.current)&&(H.current=t),(!K.current||n>K.current)&&(K.current=n),a&&(V.current=e)}),[F.start,F.end]),P=D.useMemo((()=>(H.current=null,K.current=null,V.current=null,l.flatData(r,M,A))),[r,M]);(!H.current||!K.current)&&(H.current=new Date(S),K.current=new Date(S));const B=D.Children.toArray(e.children||[]).map((e=>{var t;return D.isValidElement(e)?D.cloneElement(e,{...T.get(e.type),...null!=(t=e.props)?t:{}}):e})),G=D.cloneElement(D.createElement(Wt,null),T.get(Wt)),_=B.length?B[0]:G,[$,q]=((e,t,n)=>{const[a,o]=D.useState(t||e),r=D.useCallback(((e,t)=>{o(e),n&&n.call(void 0,{...t,value:e})}),[n,o]);return[void 0!==t?t:a,r]})(e.defaultView||_.props.name,e.view,e.onViewChange),Z=B.find((e=>e.props.name===$))||_,U="function"==typeof Z.props.dateRange?Z.props.dateRange.call(void 0,{intl:x,tasksStart:H.current,tasksEnd:K.current,timezone:p}):Z.props.dateRange,j=D.useRef(null),[Y,X]=D.useState(0);o.useIsomorphicLayoutEffect((()=>{j.current&&X(j.current.element.offsetHeight)}),[]);const Q=D.useCallback((e=>{W.current&&W.current.scrollIntoView(e)}),[]),te=D.useRef(null),ne=D.useRef(null);D.useImperativeHandle(ne,(()=>({props:e,element:te.curre