@svar-ui/trial-vue-gantt 2.7.4 → 2.8.3
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/README.md +38 -15
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +3009 -2067
- package/dist-full/index.css +1 -1
- package/package.json +18 -18
- package/types/index.d.ts +68 -6
package/README.md
CHANGED
|
@@ -26,35 +26,58 @@ The library provides a lightweight, MIT-licensed core for building Gantt charts
|
|
|
26
26
|
<img src="https://svar.dev/images/github/basic-gantt-react.gif" alt="SVAR Vue Gantt Chart UI">
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
|
-
### Key Features
|
|
29
|
+
### :sparkles: Key Features
|
|
30
30
|
|
|
31
|
+
SVAR Vue Gantt component offers a strong foundation for project planning and task management applications:
|
|
32
|
+
|
|
33
|
+
**Interactive & customizable timeline**
|
|
31
34
|
- Interactive drag-and-drop task editing
|
|
32
|
-
- Task dependencies
|
|
35
|
+
- Task dependencies visualization
|
|
36
|
+
- Hierarchical structure
|
|
33
37
|
- Configurable timeline with flexible time scales
|
|
34
|
-
-
|
|
35
|
-
- Sorting and filtering (including natural language search)
|
|
36
|
-
- Built-in tooltips, context menu, and toolbar
|
|
38
|
+
- Drag tasks from a backlog
|
|
37
39
|
- Zooming with scroll
|
|
40
|
+
|
|
41
|
+
**Configurable grid**
|
|
42
|
+
- Sorting
|
|
43
|
+
- Reordering tasks in the grid
|
|
44
|
+
- Custom columns set
|
|
45
|
+
- Custom HTML in grid cells
|
|
46
|
+
- In-cell editing of task details
|
|
47
|
+
|
|
48
|
+
**Task interaction**
|
|
49
|
+
- Customizable task edit form
|
|
50
|
+
- Built-in toolbar and context menu
|
|
51
|
+
- Tooltips for taskbars and links
|
|
38
52
|
- Hotkeys support for common actions
|
|
39
|
-
-
|
|
53
|
+
- Filtering (including natural language search)
|
|
54
|
+
|
|
55
|
+
**Data & performance**
|
|
56
|
+
- Virtual rendering for large datasets
|
|
57
|
+
- Dynamic loading of sub-tasks
|
|
58
|
+
- REST data binding with RestDataProvider
|
|
59
|
+
- Real-time updates from the server
|
|
60
|
+
|
|
61
|
+
**UI & tooling**
|
|
40
62
|
- Light and dark themes
|
|
41
63
|
- Full TypeScript support
|
|
64
|
+
- [AI tools](https://docs.svar.dev/vue/gantt/ai-tools/) for AI-assisted development: MCP server, skills, context files
|
|
42
65
|
|
|
43
66
|
### :rocket: PRO Edition
|
|
44
67
|
|
|
45
|
-
SVAR Vue Gantt is available in open-source and [PRO
|
|
68
|
+
SVAR Vue Gantt is available in open-source and [PRO Edition](https://svar.dev/vue/gantt/#pro). The PRO Edition offers additional features and automation logic:
|
|
46
69
|
|
|
47
|
-
- Scheduling logic → auto-scheduling, critical path, slack, summary tasks automation
|
|
48
|
-
- Resource management → resource assignment,
|
|
49
|
-
- Planning tools → baselines, markers
|
|
50
|
-
- Calendar control → working-time
|
|
51
|
-
- Advanced structure → rollups, split tasks, unscheduled tasks, WBS codes support
|
|
52
|
-
-
|
|
53
|
-
- Data
|
|
70
|
+
- Scheduling logic → auto-scheduling (FS, SS, FF, SF, and lag), critical path, constraints (6 types), deadlines, manual and inactive tasks, slack, summary tasks automation
|
|
71
|
+
- Resource management → resource assignment (including drag-and-drop), resource-driven scheduling, load chart and histogram
|
|
72
|
+
- Planning tools → baselines, progress line, S-curve, vertical markers
|
|
73
|
+
- Calendar control → working days calendar (non-linear time scale), individual calendars for tasks and resources
|
|
74
|
+
- Advanced structure → task grouping, rollups, split tasks, unscheduled tasks, sub-grid panel, WBS codes support
|
|
75
|
+
- UX features → undo/redo
|
|
76
|
+
- Data export → PDF, PNG, Excel, MS Project import/export (including resources and assignments)
|
|
54
77
|
|
|
55
78
|
Visit the [pricing page](https://svar.dev/vue/gantt/pricing/) for full feature comparison, licensing details, and **free trial**.
|
|
56
79
|
|
|
57
|
-
Or [see the live
|
|
80
|
+
Or [see the live demos](https://docs.svar.dev/vue/gantt/samples/#/base/willow) to try SVAR Vue Gantt's features in action.
|
|
58
81
|
|
|
59
82
|
### :hammer_and_wrench: How to Use
|
|
60
83
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("@svar-ui/lib-vue"),z=require("@svar-ui/lib-dom"),Pe=require("@svar-ui/gantt-locales"),Ke=require("@svar-ui/core-locales"),tt=require("@svar-ui/lib-state"),ee=require("@svar-ui/trial-gantt-store"),Xe=require("@svar-ui/grid-store"),Le=require("@svar-ui/vue-grid"),ue=require("@svar-ui/vue-core"),dt=require("@svar-ui/vue-toolbar"),xt=require("@svar-ui/vue-menu"),Ce=require("@svar-ui/vue-editor"),wt="2.7.4",_t={version:wt};function Bt(a,t,n){const o=a.getBoundingClientRect(),l=t.querySelector(".wx-body").getBoundingClientRect();return{top:o.top-l.top,left:o.left-l.left,dt:o.bottom-n.clientY,db:n.clientY-o.top}}function ot(a){return a&&z.getID(a,"data-context-id")}const lt=5;function $t(a,t){let n,o,l,v,u,m,B,y,d;function x(E){v=E.clientX,u=E.clientY,m={...Bt(n,a,E),y:t.getTask(l).$y},document.body.style.userSelect="none"}function I(E){t.isDisabled?.()||(n=z.locate(E),ot(n)&&(l=z.getID(n),d=setTimeout(()=>{y=!0,t&&t.touchStart&&t.touchStart(),x(E.touches[0])},500),a.addEventListener("touchmove",N),a.addEventListener("contextmenu",T),window.addEventListener("touchend",V)))}function T(E){if(y||d)return E.preventDefault(),!1}function b(E){t.isDisabled?.()||E.which!==1||(n=z.locate(E),ot(n)&&(l=z.getID(n),a.addEventListener("mousemove",X),window.addEventListener("mouseup",j),x(E)))}function R(E){a.removeEventListener("mousemove",X),a.removeEventListener("touchmove",N),document.body.removeEventListener("mouseup",j),document.body.removeEventListener("touchend",V),document.body.style.userSelect="",E&&(a.removeEventListener("mousedown",b),a.removeEventListener("touchstart",I))}function U(E){const P=E.clientX-v,L=E.clientY-u;if(!o){if(Math.abs(P)<lt&&Math.abs(L)<lt||t&&t.start&&t.start({id:l,e:E})===!1)return;o=n.cloneNode(!0),o.style.pointerEvents="none",o.classList.add("wx-reorder-task"),o.style.position="absolute",o.style.left=m.left+"px",o.style.top=m.top+"px",n.style.visibility="hidden",n.parentNode.insertBefore(o,n)}if(o){const _=Math.round(Math.max(0,m.top+L));if(t&&t.move&&t.move({id:l,top:_,detail:B})===!1)return;const q=t.getTask(l),k=q.$y;if(!m.start&&m.y===k)return O();m.start=!0,m.y=q.$y-4,o.style.top=_+"px";const $=document.elementFromPoint(E.clientX,E.clientY),C=z.locate($);if(C&&C!==n){const F=z.getID(C),Y=C.getBoundingClientRect(),g=Y.top+Y.height/2,S=E.clientY+m.db>g&&C.nextElementSibling!==n,Z=E.clientY-m.dt<g&&C.previousElementSibling!==n;B?.after===F||B?.before===F?B=null:S?B={id:l,after:F}:Z&&(B={id:l,before:F})}}}function X(E){U(E)}function N(E){y?(E.preventDefault(),U(E.touches[0])):d&&(clearTimeout(d),d=null)}function V(){y=null,d&&(clearTimeout(d),d=null),O()}function j(){O()}function O(){n&&(n.style.visibility=""),o&&(o.parentNode.removeChild(o),t&&t.end&&t.end({id:l,top:m.top})),l=n=o=m=B=null,R()}return a.style.position!=="absolute"&&(a.style.position="relative"),a.addEventListener("mousedown",b),a.addEventListener("touchstart",I),{destroy(){R(!0)}}}const le=(a,t)=>{const n=a.__vccOpts||a;for(const[o,l]of t)n[o]=l;return n},St={class:"wx-group-text"},Tt={key:0,class:"wx-name"},Et={__name:"GroupCellText",props:{row:{}},setup(a){const t=a,o=e.inject("wx-i18n").getGroup("gantt"),l=e.inject("gantt-store"),{groupBy:v,resources:u}=l.getReactiveState(),m=r.subscribe(v),B=r.subscribe(u),y=e.computed(()=>{if(m.value?.field==="resource"){let x=t.row.$groupValue;return Array.isArray(x)||(x=[x]),x.map(I=>B.value.byId(I)).filter(Boolean)}return null}),d=e.computed(()=>m.value?.field=="resource"?o("Unassigned"):o("Ungrouped"));return(x,I)=>(e.openBlock(),e.createElementBlock("div",St,[a.row.$groupValue==="$ungrouped"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(d.value),1)],64)):y.value?.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(ue.Avatar),{value:y.value,size:28},null,8,["value"]),y.value.length===1?(e.openBlock(),e.createElementBlock("span",Tt,e.toDisplayString(y.value[0].name),1)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(a.row.text),1)],64))]))}},Ct=le(Et,[["__scopeId","data-v-36807faa"]]),It={key:1,class:"wx-toggle-placeholder"},Dt={class:"wx-text"},Rt={__name:"TextCell",props:{row:{},column:{}},setup(a){function t(n,o){return`justify-content:${o.align};padding-left: ${(n.$level-1)*20}px`}return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-content",style:e.normalizeStyle(t(a.row,a.column))},[!a.row.$empty&&(a.row.data?.length||a.row.lazy)?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass("wx-toggle-icon wxi-menu-"+(a.row.open?"down":"right")),"data-action":"open-task"},null,2)):(e.openBlock(),e.createElementBlock("i",It)),e.createElementVNode("div",Dt,[a.column._cell?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.column._cell),{key:0,row:a.row,column:a.column},null,8,["row","column"])):a.row.$group?(e.openBlock(),e.createBlock(Ct,{key:1,row:a.row},null,8,["row"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(a.row.text),1)],64))])],4))}},Lt=le(Rt,[["__scopeId","data-v-4fd2001c"]]),Vt=["data-action"],Nt={__name:"ActionCell",props:{column:{},row:{},cell:{}},setup(a){const t=a,n=e.computed(()=>t.column.id),o=e.computed(()=>n.value.includes("edit")?"wxi-edit":n.value.includes("add")?"wxi-plus":n.value.includes("delete")?"wxi-delete":""),l=e.computed(()=>{if(!n.value.includes("add"))return!1;const v=t.row.$groupValue;return!t.row.$group&&typeof v<"u"||t.row.$group&&typeof v>"u"});return(v,u)=>a.cell||o.value?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({textAlign:a.column.align})},[e.createElementVNode("i",{class:e.normalizeClass(["wx-action-icon",o.value,{"wx-disabled":l.value}]),"data-action":!l.value&&n.value},null,10,Vt)],4)):e.createCommentVNode("",!0)}},je=le(Nt,[["__scopeId","data-v-3ce827d8"]]),zt={class:"wx-avatar"},Mt={__name:"ResourcesCell",props:{row:{}},setup(a){const t=a,n=e.inject("gantt-store"),{assignments:o}=n.getReactiveState(),l=r.subscribe(o),v=e.computed(()=>(l.value,n.getTaskResources(t.row.$id||t.row.id)));return(u,m)=>(e.openBlock(),e.createElementBlock("div",zt,[e.createVNode(e.unref(ue.Avatar),{value:v.value,size:28},null,8,["value"])]))}},Wt=le(Mt,[["__scopeId","data-v-3b88ddad"]]),Ht={key:0,class:"wx-avatar-box"},At={key:1,class:"wx-resource-option"},Ot={class:"wx-name"},Ft={__name:"EditorResourcesCell",props:{data:{}},setup(a){const t=a,n=e.computed(()=>t.data.length);return(o,l)=>Array.isArray(a.data)?(e.openBlock(),e.createElementBlock("div",Ht,[n.value?(e.openBlock(),e.createBlock(e.unref(ue.Avatar),{key:0,value:a.data,size:28},null,8,["value"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("div",null,[e.createVNode(e.unref(ue.Avatar),{value:a.data,size:28},null,8,["value"])]),e.createElementVNode("div",Ot,e.toDisplayString(a.data.name),1)]))}},st=le(Ft,[["__scopeId","data-v-daa03424"]]);function jt(a,t,n){const{_assignments:o}=n.getState(),l=o.byTask[a],v=l?.map(y=>y.resource),u=new Set(v||[]),m=new Set(t||[]),B=n.getHistory();B&&B.startBatch();for(const y of u)if(!m.has(y)){const d=l.find(x=>x.resource===y);n.exec("delete-assignment",{id:d.id})}for(const y of m)u.has(y)||n.exec("add-assignment",{assignment:{resource:y,task:a}});B&&B.endBatch()}function Pt(a,t){return`min-height:${a+t*4}px;`}function Gt(a,t,n){return n&&a==="all"?`width:${t}px;`:a==="grid"?n?`width:${t}px;`:"width:100%;":""}function ft(a,t,n){const o=a.find(l=>l.id==="add-task");return t==="all"?`${n}px`:t==="grid"?"calc(100% - 4px)":o?`${o.width}px`:"0"}function Ut(a,t,n,o,l){return!a&&t!=="grid"?n>l:n>o}function mt(a,t,n="add-task"){return t==="chart"?[{...a.filter(o=>o.id===n)[0],resize:!1}]:a}function pt(a,t){const n=o=>o.id!=="add-task"&&o.id!==t&&!o.hidden;return a.filter(n).reduce((o,l)=>!o||l.width>o.width?l:o,null)?.id}function Ye(a){return a.reduce((t,n)=>t+(n.hidden?0:n.width),0)}function vt(a,t){if(a&&t?.length){const n={};return t.forEach(({key:o,order:l},v)=>{n[o]={order:l,...t.length>1&&{index:v}}}),n}return{}}function qt(a,t,n){if(!a)return[];const o=a.rows[a.rows.length-1],{cells:l}=o;if(a.minUnit==="day")return et(l,t,n);const u=1440*60*1e3,m=l.length?(l.length>1?l[1].date.getTime():a.end.getTime())-l[0].date.getTime():0;if(m&&m<u){const y=[];let d=null;return l.forEach(x=>{(!d||d.key!==x.key)&&(d={id:x.key,key:x.key,width:0,date:x.date,unit:x.unit},y.push(d)),d.width+=x.width}),et(y,t,n)}else return et(l,t,n,!0)}function et(a,t,n,o){return a.map(l=>({id:l.key,width:l.width,date:l.date,unit:l.unit,getter:v=>o?v.$unitLoad?.[l.key]:v.$load?.[l.key],template:v=>v?n?n(v):`${v.hours}h`:"",cell:t}))}function Yt(){const a=document.createElement("div");a.style.cssText="position:absolute;left:-1000px;width:100px;padding:0;margin:0;min-height:100px;overflow-y:scroll;",document.body.appendChild(a);const t=a.offsetWidth-a.clientWidth;return document.body.removeChild(a),t}function Kt(a){return String(a??"").replace(/[^\w-]/g,"-")}function gt(a){let t=`wx-text-${a.align}`;return a.id&&(t+=` wx-col-${Kt(a.id)}`),a.id==="add-task"&&(t+=" wx-action"),t.trim()}const Xt=Object.assign({name:"GanttGridGrid"},{__name:"Grid",props:e.mergeModels({readonly:{}},{tableAPI:{},tableAPIModifiers:{}}),emits:["update:tableAPI"],setup(a){const t=r.asDirective($t),n=a,o=e.useModel(a,"tableAPI"),v=e.inject("wx-i18n").getGroup("gantt"),u=e.inject("gantt-store"),{scrollTop:m,cellHeight:B,focusTask:y,_selected:d,area:x,_tasks:I,_scales:T,_headerLength:b,columns:R,_sort:U,durationUnit:X,splitTasks:N,filterValues:V,groupBy:j,gridWidth:O,displayMode:E,_compactMode:P}=u.getReactiveState(),L=r.subscribe(m),_=r.subscribe(B),q=r.subscribe(d),k=r.subscribe(x),$=r.subscribe(I,!0),C=r.subscribe(T),F=r.subscribe(b),Y=r.subscribe(R),g=r.subscribe(U),S=r.subscribe(X),Z=r.subscribe(N),ne=r.subscribe(V),ce=r.subscribe(j),he=r.subscribe(O),h=r.subscribe(E),Q=r.subscribe(P);let te=e.ref(null);const ye=e.ref(0);function ve(w,D){if(D==="add-task")u.exec(D,{target:w,task:{text:v("New Task")},mode:"child",show:!0,focus:w?"grid":null});else if(D==="open-task"){const A=M.value.find(ie=>ie.id===w);(A.data||A.lazy)&&u.exec(D,{id:w,mode:!A.open})}}function we(w){if(w.detail>1)return;const D=z.locateID(w),A=w.target.dataset.action;A&&w.preventDefault(),D?A==="add-task"||A==="open-task"?ve(D,A):u.exec("select-task",{id:D,toggle:w.ctrlKey||w.metaKey,range:w.shiftKey,show:"xy",focus:"grid"}):A==="add-task"&&ve(null,A)}function be(w){if(!n.readonly){const D=z.locateID(w),A=z.locateID(w,"data-col-id");!(A&&ke.value.find(s=>s.id===A))?.editor&&D&&u.exec("show-editor",{id:D})}}let $e;function Be(w){const D=w.id,{before:A,after:ie}=w,s=w.onMove;let p=A||ie,i=A?"before":"after";if(s){if(i==="after"){const W=oe.value.findIndex(me=>me.id===D),re=oe.value.findIndex(me=>me.id===p),de=oe.value[re];W-re===1?i="before":de.data&&de.open&&(i="before",p=de.data[0].id)}$e={id:D,[i]:p}}else $e=null;u.exec("move-task",{id:D,mode:i,target:p,inProgress:s})}function J({id:w}){if(n.readonly||(u.getTask(w).open&&u.exec("open-task",{id:w,mode:!1}),te.value=M.value.find(D=>D.id===w),!te.value))return!1}function ae({id:w,top:D}){$e?Be({...$e,onMove:!1}):u.exec("drag-task",{id:w,top:D+ge.value,inProgress:!1}),te.value=null}function c({id:w,top:D,detail:A}){A&&Be({...A,onMove:!0}),u.exec("drag-task",{id:w,top:D+ge.value,inProgress:!0})}const G=e.ref(0),H=e.ref(0),f=e.ref(null);function se(w){const{key:D,isInput:A}=w;if(!A&&(D==="arrowup"||D==="arrowdown"))return w.eventSource="grid",u.exec("hotkey",w),!1;if(D==="enter"){const ie=o.value.getState().focusCell;if(ie){const{row:s,column:p}=ie;p==="add-task"?ve(s,"add-task"):p==="text"&&ve(s,"open-task")}}}function pe(w){o.value=w,w.intercept("hotkey",se),w.intercept("select-row",()=>!1),w.intercept("scroll",()=>!1),w.intercept("sort-rows",D=>{const{key:A,add:ie}=D;let s=g.value?g.value.find(i=>i.key===A):null,p="asc";return s&&(p=!s||s.order==="asc"?"desc":"asc"),u.exec("sort-tasks",{key:A,order:p,add:ie}),!1}),w.intercept("filter-rows",D=>{const{key:A,value:ie}=D;return u.exec("filter-tasks",{key:A,value:ie,open:!0}),!1}),w.intercept("resize-column",D=>{D.flexgrowFallback=pt(ke.value,D.id)}),w.on("resize-column",D=>{const A=w.getState().columns;ye.value=Ye(A),D.inProgress!==!0&&u.exec("set-columns",{columns:A})}),w.on("hide-column",()=>{const D=w.getState().columns;ye.value=Ye(D),u.exec("set-columns",{columns:D})}),w.intercept("update-cell",D=>{const{id:A,column:ie,value:s}=D,p=M.value.find(i=>i.id===A);if(p){if(ie==="resources"){jt(A,s,u);return}const i={...p};let W=s;W&&!isNaN(W)&&!(W instanceof Date)&&(W*=1),i[ie]=W,ee.prepareEditTask(i,{durationUnit:S.value,splitTasks:Z.value},u.getTaskCalendar(i),ie),u.exec("update-task",{id:A,task:i})}return!1})}const ke=e.computed(()=>{let w=Y.value.map(s=>{s={...s};const p=[...s.header];return p.forEach(i=>{i.text&&(i.text=v(i.text))}),s.header=p,s.editor=n.readonly?null:s.editor,s});const D=w.findIndex(s=>s.id==="text"),A=w.findIndex(s=>s.id==="add-task"),ie=w.findIndex(s=>s.id==="resources");if(D!==-1&&(w[D].cell&&(w[D]._cell=w[D].cell),w[D].cell=Lt),ie!==-1){const s=w[ie];if(s.cell||(s.cell=Wt),s.editor&&typeof s.editor!="function"){const p=s.editor,i=p.config;i.cell||(i.cell=st),i.cell=st,i.dropdown||(i.dropdown={width:"auto"}),s.editor=W=>{if(W.type!=="summary")return p}}}if(A!==-1){w[A].cell=w[A].cell||je;const s=w[A].header[0];if(w[A].header[0].cell=s.cell||je,n.readonly)w.splice(A,1);else if(Q.value){const[p]=w.splice(A,1);w.unshift(p)}}return w.length>0&&(w[w.length-1].resize=!1),w});e.watchEffect(()=>{ye.value=Ye(ke.value)},{flush:"pre"});const ge=e.computed(()=>k.value.from),De=e.computed(()=>C.value.height),_e=e.computed(()=>ft(Y.value,h.value,he.value)),Ie=e.computed(()=>Ut(Q.value,h.value,ye.value,G.value,he.value)),Ee=e.computed(()=>Pt(H.value,_.value)),Ne=e.computed(()=>Ee.value+Gt(h.value,ye.value,Ie.value)),K=e.computed(()=>q.value.map(w=>w.id)),M=e.computed(()=>$.value.slice(k.value.start,k.value.end)),oe=e.computed(()=>(te.value&&!M.value.find(D=>D.id===te.value.id)?[...M.value,te.value]:M.value).map(D=>({...D}))),fe=e.computed(()=>vt(oe.value,g.value)),Se=e.computed(()=>fe.value?{...ne.value}:ne.value),ze=e.computed(()=>mt(ke.value,h.value)),Oe=e.computed(()=>ge.value-L.value);let We;e.onMounted(()=>{f.value&&(We=new ResizeObserver(w=>{for(const D of w)G.value=D.contentRect.width,H.value=D.contentRect.height}),We.observe(f.value))}),e.onUnmounted(()=>{We?.disconnect()});let He=!1;const Fe=r.subscribe(y);e.watch(Fe,w=>{if(!w)return;const{id:D,column:A}=w;A&&(He||(He=!0,requestAnimationFrame(()=>{const{focusCell:ie,editor:s}=o.value.getState();s||(o.value.exec("focus-cell",{row:D,column:ie?.column||ke.value[0]?.id}),He=!1)})))});const Re=e.computed(()=>({isDisabled:()=>!!ce.value?.field,start:J,end:ae,move:c,getTask:u.getTask})),Ze=e.computed(()=>[...K.value]),Qe=e.computed(()=>({rowHeight:_.value,headerHeight:De.value/F.value}));return(w,D)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-table-container",style:e.normalizeStyle({flex:`0 0 ${_e.value}`}),ref_key:"tableContainer",ref:f},[e.withDirectives((e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`${Ne.value}--wx-body-offset:${Oe.value}px;`),class:"wx-table",onClick:we,onDblclick:be},[e.createVNode(e.unref(Le.Grid),{init:pe,sizes:Qe.value,rowStyle:A=>A.$reorder?"wx-reorder-task":"",columnStyle:e.unref(gt),data:oe.value,columns:ze.value,selectedRows:Ze.value,sortMarks:fe.value,filterValues:Se.value},null,8,["sizes","rowStyle","columnStyle","data","columns","selectedRows","sortMarks","filterValues"])],36)),[[e.unref(t),Re.value]])],4))}}),Zt=le(Xt,[["__scopeId","data-v-561b4fb5"]]),Qt={__name:"CellGrid",setup(a){const t=e.inject("gantt-store"),{cellWidth:n,cellHeight:o,cellBorders:l}=t.getReactiveState(),v=r.subscribe(n),u=r.subscribe(o),m=r.subscribe(l),B=e.ref(null),y=e.ref("#e4e4e4");return e.watchEffect(()=>{if(typeof getComputedStyle<"u"&&B.value){const d=getComputedStyle(B.value).getPropertyValue("--wx-gantt-border");y.value=d?d.substring(d.indexOf("#")):"#1d1e261a"}}),(d,x)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"node",ref:B,style:e.normalizeStyle(`width:100%; height:100%; background:url(${e.unref(ee.grid)(e.unref(v),e.unref(u),y.value,e.unref(m))}); position: absolute;`)},null,4))}},Jt={class:"wx-links"},en=["onclick","data-link-id"],tn=["points"],nn=["points"],an=["data-link-id"],on=["points"],ln=["points"],sn=Object.assign({name:"GanttChartLinks"},{__name:"Links",props:{onSelectLink:{type:Function},selectedLink:{},readonly:{}},setup(a){const t=r.asDirective(z.clickOutside),n=a,o=e.inject("gantt-store"),{_visibleLinks:l,criticalPath:v}=o.getReactiveState(),u=r.subscribe(l),m=r.subscribe(v);function B(y){const d=y?.target?.classList;!d?.contains("wx-line-hitbox")&&!d?.contains("wx-delete-button")&&n.onSelectLink(null)}return(y,d)=>(e.openBlock(),e.createElementBlock("svg",Jt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u),x=>(e.openBlock(),e.createElementBlock("g",{key:x.id,class:e.normalizeClass(["wx-line",{"wx-critical":e.unref(m)&&x.critical,"wx-line-selectable":!a.readonly}]),onclick:()=>!a.readonly&&a.onSelectLink(x.id),"data-link-id":e.unref(z.setID)(x.id)},[e.createElementVNode("polyline",{class:"wx-line-draw",points:x.$p},null,8,tn),e.createElementVNode("polyline",{class:"wx-line-hitbox",points:x.$p},null,8,nn)],10,en))),128)),!a.readonly&&a.selectedLink?e.withDirectives((e.openBlock(),e.createElementBlock("g",{key:0,class:"wx-line wx-line-selected wx-line-selectable wx-delete-link","data-link-id":e.unref(z.setID)(a.selectedLink.id)},[e.createElementVNode("polyline",{class:"wx-line-draw",points:a.selectedLink.$p},null,8,on),e.createElementVNode("polyline",{class:"wx-line-hitbox",points:a.selectedLink.$p},null,8,ln)],8,an)),[[e.unref(t),B]]):e.createCommentVNode("",!0)]))}}),rn=le(sn,[["__scopeId","data-v-21ec1498"]]),cn=["data-rollup-id"],un=Object.assign({name:"GanttChartRollups"},{__name:"Rollups",props:{rollup:{},parent:{}},setup(a){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{"data-rollup-id":e.unref(z.setID)(a.rollup.id),class:e.normalizeClass(`wx-rollup wx-${a.rollup.type}-rollup`),style:e.normalizeStyle(`left:${a.rollup.$x_rollup}px;top:${a.parent.$y+a.parent.$h+a.rollup.$y_rollup_relative}px;width:${a.rollup.$w_rollup}px;height:${a.rollup.$h_rollup}px;`)},null,14,cn))}}),dn=le(un,[["__scopeId","data-v-bbc697dd"]]),fn={class:"wx-segments"},mn=["data-segment"],pn={key:0,class:"wx-progress-wrapper"},vn={class:"wx-content"},gn={__name:"BarSegments",props:{task:{},type:{}},setup(a){const t=a;function n(l){const v=t.task.segments[l];return`left:${v.$x}px;top:0px;width:${v.$w}px;height:100%;`}function o(l){if(!t.task.progress)return 0;const v=t.task.duration*t.task.progress/100,u=t.task.segments;let m=0,B=0,y=null;do{const d=u[B];B===l&&(m>v?y=0:y=Math.min((v-m)/d.duration,1)*100),m+=d.duration,B++}while(y===null&&B<u.length);return y||0}return(l,v)=>(e.openBlock(),e.createElementBlock("div",fn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.task.segments,(u,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:e.normalizeClass(["wx-segment","wx-bar",`wx-${a.type}`]),"data-segment":m,style:e.normalizeStyle(n(m))},[a.task.progress?(e.openBlock(),e.createElementBlock("div",pn,[e.createElementVNode("div",{class:"wx-progress-percent",style:e.normalizeStyle(`width:${o(m)}%`)},null,4)])):e.createCommentVNode("",!0),e.createElementVNode("div",vn,e.toDisplayString(u.text||""),1)],14,mn))),128))]))}},hn=le(gn,[["__scopeId","data-v-558dfded"]]),kn=["data-id","data-task-id","tabindex"],yn={key:0,class:"wx-progress-wrapper"},bn={key:4,class:"wx-content"},xn={key:1,class:"wx-text-out"},wn=Object.assign({name:"GanttChartBars"},{__name:"Bars",props:{readonly:{},taskTemplate:{}},setup(a){const t=a,n=e.inject("gantt-store"),{_tasks:o,_links:l,area:v,_scales:u,taskTypes:m,baselines:B,_selected:y,rollups:d,_rollups:x,focusTask:I,criticalPath:T,tree:b,schedule:R,splitTasks:U,summary:X,slack:N}=n.getReactiveState(),V=r.subscribe(o,!0),j=r.subscribe(l),O=r.subscribe(v),E=r.subscribe(u),P=r.subscribe(m),L=r.subscribe(B),_=r.subscribe(y),q=r.subscribe(d),k=r.subscribe(x),$=r.subscribe(T),C=r.subscribe(b),F=r.subscribe(R),Y=r.subscribe(U),g=r.subscribe(X),S=r.subscribe(N),Z=e.computed(()=>V.value.slice(O.value.start,O.value.end).map(s=>({...s}))),ne=e.computed(()=>Z.value.some(s=>s.$id&&s.$id!==s.id)),ce=e.computed(()=>E.value.lengthUnitWidth);let he=!1;const h=e.ref(void 0),Q=e.ref(null);let te=null;const ye=e.ref(null),ve=e.computed(()=>ye.value&&{...j.value.find(s=>s.id===ye.value)}),we=e.ref(void 0);let be;function $e(s){if(s.button!==0)return;const p=z.locate(s);p&&J(p,s)}function Be(s){const p=z.locate(s);p&&(be=setTimeout(()=>{we.value=!0,J(p,s.touches[0])},300))}function J(s,p){const{clientX:i}=p,W=z.getID(s),re=n.getTask(W),de=p.target.classList;if(!p.target.closest(".wx-delete-button")&&!t.readonly){if(de.contains("wx-progress-marker")){const{progress:me}=n.getTask(W);te={id:W,x:i,progress:me,dx:0,node:s,marker:p.target},p.target.classList.add("wx-progress-in-drag")}else{const me=ae(s,p,re)||"move";if(Q.value={id:W,mode:me,x:i,dx:0,l:re.$x,w:re.$w},Y.value&&re.segments?.length){const xe=z.locate(p,"data-segment");xe&&(Q.value.segmentIndex=xe.dataset.segment*1,ee.extendDragOptions(re,Q.value))}}ke()}}function ae(s,p,i){if(p.target.classList.contains("wx-line")||(i||(i=n.getTask(z.getID(s))),i.type==="milestone"||i.type==="summary"))return"";const W=z.locate(p,"data-segment");W&&(s=W);const{left:re,width:de}=s.getBoundingClientRect(),me=(p.clientX-re)/de;let xe=.2/(de>200?de/200:1);return me<xe?"start":me>1-xe?"end":""}function c(s){we.value?(s.preventDefault(),H(s,s.touches[0])):be&&(clearTimeout(be),be=null)}function G(s){H(s,s)}function H(s,p){const{clientX:i}=p;if(!t.readonly)if(te){const{node:W,x:re,id:de}=te,me=te.dx=i-re,xe=Math.round(me/W.offsetWidth*100);let Ve=te.progress+xe;te.value=Ve=Math.min(Math.max(0,Ve),100),n.exec("update-task",{id:de,task:{progress:Ve},inProgress:!0})}else if(Q.value){ze(null);const{mode:W,l:re,w:de,x:me,id:xe,start:Ve,segment:Ae,index:Me}=Q.value,Je=n.getTask(xe),Te=i-me,at=Math.round(ce.value)||1;if(!Ve&&Math.abs(Te)<20||W==="start"&&de-Te<at||W==="end"&&de+Te<at||W==="move"&&(Te<0&&re+Te<0||Te>0&&re+de+Te>Fe.value)||Q.value.segment&&!ee.isSegmentMoveAllowed(Je,Q.value))return;Q.value.dx=Te;let Ge,Ue;if(W==="start"?(Ge=re+Te,Ue=de-Te):W==="end"?(Ge=re,Ue=de+Te):W==="move"&&(Ge=re+Te,Ue=de),n.exec("drag-task",{id:xe,width:Ue,left:Ge,inProgress:!0,...Ae&&{segmentIndex:Me}}),!Q.value.start&&(W==="move"&&Je.$x===re||W!=="move"&&Je.$w===de))return he=!0,pe();Q.value.start=!0}else{const W=z.locate(s);if(W){const re=n.getTask(z.getID(W)),me=z.locate(s,"data-segment")||W,xe=ae(me,p,re);me.style.cursor=xe&&!t.readonly?"col-resize":"pointer"}}}function f(){pe()}function se(){we.value=null,be&&(clearTimeout(be),be=null),pe()}function pe(){if(te){const{dx:s,id:p,marker:i,value:W}=te;te=null,typeof W<"u"&&s&&n.exec("update-task",{id:p,task:{progress:W},inProgress:!1}),i.classList.remove("wx-progress-in-drag"),he=!0,ge()}else if(Q.value){const{id:s,mode:p,dx:i,l:W,w:re,start:de,segment:me,index:xe}=Q.value;if(Q.value=null,de){const Ve=Math.round(i/ce.value);if(!Ve)n.exec("drag-task",{id:s,width:re,left:W,inProgress:!1,...me&&{segmentIndex:xe}});else{let Ae={},Me=n.getTask(s);me&&(Me=Me.segments[xe]),p==="move"?(Ae.start=Me.start,Ae.end=Me.end):Ae[p]=Me[p],n.exec("update-task",{id:s,diff:Ve,task:Ae,...me&&{segmentIndex:xe}})}he=!0}ge()}}function ke(){document.body.style.userSelect="none"}function ge(){document.body.style.userSelect=""}function De(s){if(!t.readonly){const p=z.locateID(s.target);if(p&&!s.target.classList.contains("wx-link")){const i=z.locateID(s.target,"data-segment");n.exec("show-editor",{id:p,...i!==null&&{segmentIndex:i}})}}}function _e(s){if(he){he=!1;return}const p=z.locateID(s.target);if(p){const i=s.target.classList;if(i.contains("wx-link")){const W=i.contains("wx-left");if(!h.value){h.value={id:p,start:W};return}h.value.id!==p&&!fe(p,W)&&n.exec("add-link",{link:{source:h.value.id,target:p,type:oe(h.value.start,W)}})}else if(i.contains("wx-delete-button-icon"))n.exec("delete-link",{id:ye.value}),ye.value=null;else{const W=z.locateID(s.target,"data-segment");n.exec("select-task",{id:p,toggle:s.ctrlKey||s.metaKey,range:s.shiftKey,...W!==null&&{segmentIndex:W}})}}Se()}function Ie(s){return`left:${s.$x}px;top:${s.$y}px;width:${s.$w}px;height:${s.$h}px;line-height:${s.$h}px;`}function Ee(s){return`left:${s.$x_base}px;top:${s.$y_base}px;width:${s.$w_base}px;height:${s.$h_base}px;`}function Ne(s){return`left:${s.$x_slack}px;top:${s.$y}px;width:${s.$w_slack}px;height:${s.$h}px;`}function K(s){if(we.value||be)return s.preventDefault(),!1}const M=["e2s","s2s","e2e","s2e"];function oe(s,p){return M[(s?1:0)+(p?0:2)]}function fe(s,p){const i=h.value.id,W=h.value.start;return s===i?!0:j.value.find(re=>re.target===s&&re.source===i&&re.type===oe(W,p))}function Se(){h.value&&(h.value=null)}function ze(s){ye.value=s}const Oe=e.computed(()=>P.value.map(s=>s.id));function We(s){let p=Oe.value.includes(s)?s:"task";return["task","milestone","summary"].includes(s)||(p=`task ${p}`),p}function He(s){n.exec(s.action,s.data)}const Fe=e.ref(0),Re=e.ref(null),Ze=e.computed(()=>_.value.length&&Re.value&&Re.value.contains(document.activeElement)),Qe=e.computed(()=>Ze.value&&_.value[_.value.length-1].id),w=r.subscribe(I);e.watch(w,s=>{if(s&&s.column===!1){const{id:p}=s,i=Re.value?.querySelector(`.wx-bar[data-id='${z.setID(p)}']`);i&&i.focus()}});const D=s=>$.value&&s.critical;function A(s){if(F.value.auto){const p=C.value.getSummaryId(s,!0),i=C.value.getSummaryId(h.value.id,!0);return h.value?.id&&!(Array.isArray(p)?p:[p]).includes(h.value.id)&&!(Array.isArray(i)?i:[i]).includes(s)}return h.value}let ie;return e.onMounted(()=>{window.addEventListener("mouseup",f),Re.value&&(Fe.value=Re.value.offsetWidth,ie=new ResizeObserver(s=>{for(const p of s)Fe.value=p.target.offsetWidth}),ie.observe(Re.value))}),e.onUnmounted(()=>{window.removeEventListener("mouseup",f),ie?.disconnect()}),(s,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:Re,class:"wx-bars",style:e.normalizeStyle(`line-height: ${Z.value.length?Z.value[0].$h:0}px`),onContextmenu:K,onMousedown:$e,onMousemove:G,onTouchstart:Be,onTouchmove:c,onTouchend:se,onClick:_e,onDblclick:De,onDragstart:p[0]||(p[0]=e.withModifiers(()=>{},["prevent"]))},[e.unref(S)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(Z.value,i=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i.id},[i.$visibleSlack?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass("wx-slack wx-slack-"+i.type),style:e.normalizeStyle(Ne(i))},null,6)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0),e.createVNode(rn,{onSelectLink:ze,selectedLink:ve.value,readonly:t.readonly},null,8,["selectedLink","readonly"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,i=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i.id},[i.$skip?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wx-bar","wx-"+We(i.type),{"wx-touch":we.value&&Q.value&&i.id===Q.value.id,"wx-selected":h.value&&h.value.id===i.id,"wx-critical":D(i),"wx-reorder-task":i.$reorder,"wx-split":e.unref(Y)&&i.segments}]),style:e.normalizeStyle(Ie(i)),"data-id":e.unref(z.setID)(i.id),"data-task-id":e.unref(z.setID)(i.id),tabindex:Qe.value===i.id?"0":"-1"},[!t.readonly&&!ne.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.id===ve.value?.target&&ve.value?.type[2]==="s"?(e.openBlock(),e.createBlock(e.unref(ue.Button),{key:0,type:"danger",css:"wx-left wx-delete-button wx-delete-link"},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createElementVNode("i",{class:"wxi-close wx-delete-button-icon"},null,-1)])]),_:1})):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["wx-link","wx-left",{"wx-visible":h.value,"wx-target":!h.value||!fe(i.id,!0)&&A(i.id),"wx-selected":h.value&&h.value.id===i.id&&h.value.start,"wx-critical":D(i)}])},[...p[2]||(p[2]=[e.createElementVNode("div",{class:"wx-inner"},null,-1)])],2))],64)):e.createCommentVNode("",!0),i.type!=="milestone"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.progress&&!(e.unref(Y)&&i.segments)?(e.openBlock(),e.createElementBlock("div",yn,[e.createElementVNode("div",{class:"wx-progress-percent",style:e.normalizeStyle("width:"+i.progress+"%")},null,4)])):e.createCommentVNode("",!0),!t.readonly&&!(e.unref(Y)&&i.segments)&&!(i.type==="summary"&&e.unref(g)?.autoProgress)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"wx-progress-marker",style:e.normalizeStyle("left:calc("+i.progress+"% - 10px);")},e.toDisplayString(i.progress),5)):e.createCommentVNode("",!0),t.taskTemplate?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.taskTemplate),{key:2,data:i,api:e.unref(n),onaction:He},null,8,["data","api"])):e.unref(Y)&&i.segments?(e.openBlock(),e.createBlock(hn,{key:3,task:i,type:We(i.type)},null,8,["task","type"])):(e.openBlock(),e.createElementBlock("div",bn,e.toDisplayString(i.text||""),1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[p[3]||(p[3]=e.createElementVNode("div",{class:"wx-content"},null,-1)),t.taskTemplate?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.taskTemplate),{key:0,data:i,api:e.unref(n),onaction:He},null,8,["data","api"])):(e.openBlock(),e.createElementBlock("div",xn,e.toDisplayString(i.text),1))],64)),!t.readonly&&!ne.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[i.id===ve.value?.target&&ve.value?.type[2]==="e"?(e.openBlock(),e.createBlock(e.unref(ue.Button),{key:0,type:"danger",css:"wx-right wx-delete-button wx-delete-link"},{default:e.withCtx(()=>[...p[4]||(p[4]=[e.createElementVNode("i",{class:"wxi-close wx-delete-button-icon"},null,-1)])]),_:1})):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["wx-link","wx-right",{"wx-visible":h.value,"wx-target":!h.value||!fe(i.id,!1)&&A(i.id),"wx-selected":h.value&&h.value.id===i.id&&!h.value.start,"wx-critical":D(i)}])},[...p[5]||(p[5]=[e.createElementVNode("div",{class:"wx-inner"},null,-1)])],2))],64)):e.createCommentVNode("",!0)],14,kn)),e.unref(q)&&e.unref(k)?.[i.id]?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(k)[i.id],W=>(e.openBlock(),e.createBlock(dn,{key:W.id,rollup:W,parent:i},null,8,["rollup","parent"]))),128)):e.createCommentVNode("",!0),e.unref(L)&&!i.$skip_baseline?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["wx-baseline",{"wx-milestone":i.type==="milestone"}]),style:e.normalizeStyle(Ee(i))},null,6)):e.createCommentVNode("",!0)],64))),128))],36))}}),_n=le(wn,[["__scopeId","data-v-d1ccbfc8"]]),Bn={__name:"TimeScale",props:{api:{}},setup(a){const t=a,{_scales:n,xArea:o,highlightTime:l}=t.api.getReactiveState(),v=r.subscribe(n),u=r.subscribe(o),m=r.subscribe(l);function B(d,x,I){const T=d.cells;let b=0,R=T.length,U=0;for(let N=0;N<T.length;N++){if(U+T[N].width>x){R=N,b=U;break}U+=T[N].width}let X=R;for(;X<T.length&&U<I;)U+=T[X].width,X++;return{from:b,slice:T.slice(R,X)}}const y=e.computed(()=>{const d=v.value.rows,x=d.length-1;return d.map((I,T)=>T===x?{height:I.height,from:u.value.from,slice:I.cells.slice(u.value.start,u.value.end)}:{height:I.height,...B(I,u.value.from,u.value.to)})});return(d,x)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-scale",style:e.normalizeStyle({width:e.unref(v).width+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(I,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:"wx-row",style:e.normalizeStyle({height:I.height+"px",paddingLeft:I.from+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.slice,(b,R)=>(e.openBlock(),e.createElementBlock("div",{key:R,class:e.normalizeClass(["wx-cell",b.css,e.unref(m)?e.unref(m)(b.date,b.unit):""]),style:e.normalizeStyle({width:b.width+"px"})},[e.createElementVNode("span",{class:e.normalizeClass({"wx-cell-value":b.width>100})},e.toDisplayString(b.value),3)],6))),128))],4))),128))],4))}},ht=le(Bn,[["__scopeId","data-v-b58c6a1c"]]),rt=.003;function $n(a,t,n){return Math.max(Math.min(a,n),t)}function kt(a,t,n){let o=!1,l=performance.now();function v(u){const B=Math.abs(u)<50?.004:.01,y=performance.now(),d=Math.min(y-l,50);l=y;const x=$n(-u*B,-rt*d,rt*d);return Math.exp(x)}return function(m){if(t()&&(m.ctrlKey||m.metaKey)){m.preventDefault();const B=v(m.deltaY),y=m.clientX-n().getBoundingClientRect().left;o||(o=!0,requestAnimationFrame(()=>{a.exec("zoom-scale",{dir:B>1?1:-1,ratio:Math.abs(1-B),offset:y}),o=!1}))}}}const Sn={class:"wx-content"},Tn={key:0,class:"wx-gantt-holidays",style:{height:"100%"}},En=["data-id"],ct=1,Cn=Object.assign({name:"GanttChartChart"},{__name:"Chart",props:{readonly:{},fullWidth:{},fullHeight:{},taskTemplate:{}},setup(a){const t=r.asDirective(Xe.hotkeys),n=a,o=e.inject("gantt-store"),{_selected:l,scrollTop:v,scrollLeft:u,cellHeight:m,_tasks:B,resources:y,_scales:d,area:x,groupBy:I,xArea:T,zoom:b,_calendars:R,_markers:U,highlightTime:X}=o.getReactiveState(),N=r.subscribe(l,!0),V=r.subscribe(v),j=r.subscribe(u),O=r.subscribe(m),E=r.subscribe(d),P=r.subscribe(b),L=r.subscribe(U),_=r.subscribe(B),q=r.subscribe(y),k=r.subscribe(x),$=r.subscribe(I),C=r.subscribe(T),F=r.subscribe(R),Y=r.subscribe(X),g=e.ref(0),S=e.ref(null),Z=e.computed(()=>{const J=[];return N.value.length&&O.value&&N.value.forEach(ae=>{J.push(`height: ${O.value}px;top: ${ae.$y-3}px`)}),J});e.watch([V,g,O],()=>{he()});const ne=e.computed(()=>Math.max(g.value,n.fullHeight));e.watchEffect(()=>{ne.value,g.value,S.value&&(S.value.scrollTop=V.value,S.value.scrollLeft=j.value)});function ce(){S.value.scrollLeft!==j.value&&o.exec("scroll-chart",{left:S.value.scrollLeft})}function he(){const J=g.value||0,ae=Math.ceil(J/O.value)+1,c=Math.floor((V.value||0)/O.value),G=Math.max(0,c-ct),H=c+ae+ct,f=G*O.value;o.exec("render-data",{start:G,end:H,from:f})}const h=kt(o,()=>P.value,()=>S.value);function Q(J){const ae=Y.value?.(J.date,J.unit);return ae?{css:ae,width:J.width}:null}const te=e.computed(()=>Y.value?E.value.rows[E.value.rows.length-1].cells.slice(C.value.start,C.value.end).map(Q):null),ye=e.computed(()=>{const ae=E.value.rows[E.value.rows.length-1]?.cells;return(E.value.minUnit==="hour"||E.value.minUnit==="day")&&ae?ae.slice(C.value.start,C.value.end):[]}),ve=e.computed(()=>_.value.slice(k.value.start,k.value.end));function we(J){if($.value?.field==="resource"){if(J.$resource){const H=o.getResourceCalendar(J);return H?[H]:[]}const c=J.$groupValue;return c===void 0||c==="$ungrouped"?[]:(Array.isArray(c)?c:[c]).flatMap(H=>{const f=q.value?.byId(H);if(!f)return[];const se=o.getResourceCalendar(f);return se?[se]:[]})}const ae=J.calendar?o.getTaskCalendar(J):void 0;return ae?[ae]:[]}const be=e.computed(()=>{const J=[];if(!F.value)return J;const ae=o.getCalendar();return ve.value.forEach((c,G)=>{const H=we(c);H.length&&ye.value.forEach((f,se)=>{const pe=H.filter(Ie=>!Ie.isWorkingDay(f.date)),ke=pe.length===0,ge=ae&&!ae.isWorkingDay(f.date),De={width:f.width,height:O.value,left:(se+C.value.start)*f.width,top:k.value.from+G*O.value};let _e="";ke||(_e=["wx-weekend",...pe.map(Ee=>Ee.css).filter(Boolean)].join(" ")),ke&&ge&&(_e="wx-weekend-override"),_e&&J.push({...De,css:_e})})}),J});function $e(J){J.eventSource="chart",o.exec("hotkey",J)}let Be;return e.onMounted(()=>{S.value&&(g.value=S.value.clientHeight,Be=new ResizeObserver(J=>{for(const ae of J)g.value=ae.target.clientHeight}),Be.observe(S.value))}),e.onUnmounted(()=>{Be?.disconnect()}),(J,ae)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:"wx-chart",tabindex:"-1",ref_key:"chart",ref:S,onScroll:ce,onWheel:ae[0]||(ae[0]=(...c)=>e.unref(h)&&e.unref(h)(...c))},[e.createVNode(ht,{api:e.unref(o)},null,8,["api"]),e.unref(L).length?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-markers",style:e.normalizeStyle(`height:${ne.value}px;`)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),c=>(e.openBlock(),e.createElementBlock("div",{key:c.id||c.left,class:e.normalizeClass("wx-marker "+(c.css||"")),style:e.normalizeStyle(`left:${c.left}px`)},[e.createElementVNode("div",Sn,e.toDisplayString(c.text),1)],6))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"wx-area",style:e.normalizeStyle(`width:${n.fullWidth}px;height:${ne.value}px`)},[te.value?(e.openBlock(),e.createElementBlock("div",Tn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,(c,G)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:G},[c?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.css),style:e.normalizeStyle(`width: ${c.width}px; left:${e.unref(C).from+G*c.width}px`)},null,6)):e.createCommentVNode("",!0)],64))),128))])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(be.value,(c,G)=>(e.openBlock(),e.createElementBlock("div",{key:G,class:e.normalizeClass(c.css),style:e.normalizeStyle(`position: absolute; pointer-events: none; width:${c.width}px; height:${c.height}px; left:${c.left}px; top:${c.top}px`)},null,6))),128)),e.unref(N).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(N),(c,G)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c.id},[c.$y?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-selected","data-id":e.unref(z.setID)(c.id),style:e.normalizeStyle(Z.value[G])},null,12,En)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0),e.createVNode(Qt),e.createVNode(_n,{readonly:n.readonly,taskTemplate:n.taskTemplate},null,8,["readonly","taskTemplate"])],4)],32)),[[e.unref(t),{keys:{arrowup:!0,arrowdown:!0},exec:c=>$e(c)}]])}}),In=le(Cn,[["__scopeId","data-v-8d85f247"]]),Dn=Object.assign({name:"GanttResizer"},{__name:"Resizer",props:{api:{},position:{default:"after"},size:{default:4},dir:{default:"x"},onmove:{type:Function},containerWidth:{default:0},rightThreshold:{default:50}},setup(a){const t=a,{gridWidth:n,displayMode:o,_gridCollapseThreshold:l,_compactMode:v}=t.api.getReactiveState(),u=r.subscribe(n),m=r.subscribe(o),B=r.subscribe(l),y=r.subscribe(v);function d(P){let L=0;t.position==="center"?L=t.size/2:t.position==="before"&&(L=t.size);const _={size:[t.size+"px","auto"],p:[P-L+"px","0px"],p2:["auto","0px"]};if(t.dir!=="x")for(let q in _)_[q]=_[q].reverse();return _}let x=0,I;function T(P){return t.dir==="x"?P.clientX:P.clientY}function b(P){y.value||m.value==="grid"||m.value==="chart"||(x=T(P),I=u.value,document.body.style.cursor=E.value,document.body.style.userSelect="none",window.addEventListener("mousemove",U),window.addEventListener("mouseup",X))}let R;function U(P){const L=I+T(P)-x;t.api.exec("resize-grid",{width:L});let _;L<=B.value?_="chart":t.containerWidth-L<=t.rightThreshold?_="grid":_="all",m.value!==_&&t.api.exec("set-display-mode",{mode:_}),R&&clearTimeout(R),R=setTimeout(()=>t.onmove&&t.onmove(L),100)}function X(){document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",X)}function N(P){let L;y.value?L=m.value==="chart"?"grid":"chart":m.value==="grid"||m.value==="chart"?L="all":L=P==="left"?"chart":"grid",t.api.exec("set-display-mode",{mode:L})}function V(){N("left")}function j(){N("right")}const O=e.computed(()=>d(u.value)),E=e.computed(()=>m.value!=="all"?"auto":t.dir==="x"?"ew-resize":"ns-resize");return(P,L)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wx-resizer",`wx-resizer-${a.dir}`,`wx-resizer-display-${e.unref(m)}`]),onMousedown:b,style:e.normalizeStyle(`width:${O.value.size[0]}; height: ${O.value.size[1]}; cursor:${E.value};`)},[e.createElementVNode("div",{class:"wx-button-expand-box"},[e.createElementVNode("div",{class:"wx-button-expand-content wx-button-expand-left"},[e.createElementVNode("i",{class:"wxi-menu-left",onClick:V})]),e.createElementVNode("div",{class:"wx-button-expand-content wx-button-expand-right"},[e.createElementVNode("i",{class:"wxi-menu-right",onClick:j})])]),L[0]||(L[0]=e.createElementVNode("div",{class:"wx-resizer-line"},null,-1))],38))}}),yt=le(Dn,[["__scopeId","data-v-bb9173dd"]]),Rn={tabindex:"0",class:"wx-layout"},Ln=Object.assign({name:"GanttLayout"},{__name:"Layout",props:e.mergeModels({taskTemplate:{},readonly:{}},{tableAPI:{},tableAPIModifiers:{},ganttWidth:{},ganttWidthModifiers:{}}),emits:["update:tableAPI","update:ganttWidth"],setup(a){const t=r.asDirective(Xe.hotkeys),n=e.useModel(a,"tableAPI"),o=e.useModel(a,"ganttWidth"),l=e.inject("gantt-store"),{_tasks:v,_scales:u,cellHeight:m,columns:B,scrollTop:y,undo:d,_columnsWidth:x}=l.getReactiveState(),I=r.subscribe(v),T=r.subscribe(u),b=r.subscribe(m),R=r.subscribe(B),U=r.subscribe(y),X=r.subscribe(d),N=r.subscribe(x),V=e.ref(void 0),j=e.ref(void 0),O=e.ref(null),E=e.computed(()=>o.value-j.value),P=e.computed(()=>T.value.width),L=e.computed(()=>I.value.length*b.value),_=e.computed(()=>T.value.height+L.value+E.value);e.watchEffect(()=>{let S;O.value&&(S=new ResizeObserver(q),S.observe(O.value)),e.onWatcherCleanup(()=>{S&&S.disconnect()})});function q(){l.exec("resize-chart",{width:o.value-N.value-E.value-4,height:V.value-T.value.height,scrollSize:E.value})}const k=e.ref(null);function $(){l.exec("scroll-chart",{top:k.value.scrollTop})}function C(){k.value&&U.value!==k.value.scrollTop&&(k.value.scrollTop=U.value)}e.watchEffect(()=>{U.value,C()});let F;e.onMounted(()=>{k.value&&(F=new ResizeObserver(()=>{V.value=k.value?.offsetHeight,o.value=k.value?.offsetWidth}),F.observe(k.value),V.value=k.value.offsetHeight,o.value=k.value.offsetWidth)}),e.onUnmounted(()=>{F?.disconnect()});const Y=e.ref(null);let g;return e.onMounted(()=>{Y.value&&(g=new ResizeObserver(()=>{j.value=Y.value?.offsetWidth}),g.observe(Y.value),j.value=Y.value.offsetWidth)}),e.onUnmounted(()=>{g?.disconnect()}),(S,Z)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-gantt",ref_key:"ganttDiv",ref:k,onScroll:$},[e.createElementVNode("div",{ref_key:"pseudoRowsDiv",ref:Y,class:"wx-pseudo-rows",style:e.normalizeStyle(`height:${_.value}px;width:100%;`)},[e.createElementVNode("div",{class:"wx-stuck",style:e.normalizeStyle(`height:${V.value}px;width:${j.value}px;`)},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Rn,[e.unref(R).length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Zt,{readonly:a.readonly,fullHeight:L.value,tableAPI:n.value,"onUpdate:tableAPI":Z[0]||(Z[0]=ne=>n.value=ne)},null,8,["readonly","fullHeight","tableAPI"]),e.createVNode(yt,{containerWidth:o.value,api:e.unref(l)},null,8,["containerWidth","api"])],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"wx-content",ref_key:"chart",ref:O},[e.createVNode(In,{readonly:a.readonly,fullWidth:P.value,fullHeight:L.value,taskTemplate:a.taskTemplate},null,8,["readonly","fullWidth","fullHeight","taskTemplate"])],512)])),[[e.unref(t),{keys:{"ctrl+c":!0,"ctrl+v":!0,"ctrl+x":!0,"ctrl+d":!0,backspace:!0,"ctrl+z":e.unref(X),"ctrl+y":e.unref(X)},exec:ne=>{ne.isInput||e.unref(l).exec("hotkey",ne)}}]])],4)],4)],544))}}),Vn=le(Ln,[["__scopeId","data-v-076c7979"]]);function Nn(a){return{year:"%Y",quarter:`${a("Q")} %Q`,month:"%M",week:`${a("Week")} %w`,day:"%M %j",hour:"%H:%i"}}function zn(a,t){return typeof a=="function"?a:z.dateToString(a,t)}function bt(a,t){return a.map(({format:n,...o})=>({...o,format:zn(n,t)}))}function Mn(a,t){const n=Nn(t);for(let o in n)n[o]=z.dateToString(n[o],a);return n}function Wn(a,t){if(!a||!a.length)return a;const n=z.dateToString("%d-%m-%Y",t);return a.map(o=>o.template?o:o.id==="start"||o.id==="end"?{...o,_template:l=>n(l),template:l=>n(l)}:o.id==="duration"?{...o,_template:l=>l,template:l=>l}:o)}function Hn(a,t){return a.levels?{...a,levels:a.levels.map(n=>({...n,scales:bt(n.scales,t)}))}:a}const An=650,On=Object.assign({name:"GanttComponentsGantt"},{__name:"Gantt",props:{taskTemplate:{default:null},markers:{default:()=>[]},taskTypes:{default:()=>ee.defaultTaskTypes},tasks:{default:()=>[]},selected:{default:()=>[]},activeTask:{default:null},links:{default:()=>[]},resources:{default:null},assignments:{default:()=>[]},scales:{default:()=>[{unit:"month",step:1,format:"%F %Y"},{unit:"day",step:1,format:"%j"}]},columns:{default:null},start:{default:null},end:{default:null},lengthUnit:{default:"day"},durationUnit:{default:"day"},cellWidth:{default:100},cellHeight:{default:38},scaleHeight:{default:36},gridWidth:{default:null},displayMode:{default:"all"},readonly:{type:Boolean,default:!1},cellBorders:{default:"full"},zoom:{type:[Boolean,Object,Array],default:!1},baselines:{type:[Boolean,Object],default:!1},rollups:{type:[Boolean,Object],default:!1},highlightTime:{type:Function,default:null},init:{type:Function,default:null},autoScale:{type:Boolean,default:!0},unscheduledTasks:{type:Boolean,default:!1},criticalPath:{default:null},schedule:{default:()=>({type:"forward"})},projectStart:{default:null},projectEnd:{default:null},calendar:{default:null},calendars:{default:()=>[]},undo:{type:Boolean,default:!1},splitTasks:{type:Boolean,default:!1},summary:{default:null},slack:{type:Boolean,default:!1},groupBy:{default:null},wbs:{type:Boolean,default:!1}},setup(a,{expose:t}){const n=a,o=e.useAttrs(),l=new ee.DataStore(r.writable),v={...Ke.en,...Pe.en};let u=e.inject("wx-i18n",null);u?u=u.extend(v,!0):u=z.locale(v),e.provide("wx-i18n",u);const{calendar:m}=u.getRaw(),B=e.computed(()=>ee.getDefaultColumns({resources:!!n.resources,wbs:n.wbs})),y=e.computed(()=>n.gridWidth??ee.getDefaultGridWidth(B.value)),d=e.computed(()=>{let h={zoom:Hn(n.zoom,m),scales:bt(n.scales,m),columns:Wn(n.columns??B.value,m),links:n.links,cellWidth:n.cellWidth};return h.zoom&&(h={...h,...ee.normalizeZoom(h.zoom,Mn(m,u.getGroup("gantt")),h.scales,n.cellWidth)}),h});let x=l.in;const I=/-/g;let T=new tt.EventBusRouter((h,Q)=>{const te="on"+h.replace(I,"");o[te]&&o[te](Q)});x.setNext(T);const b=e.ref(void 0),R=e.ref(void 0),U=e.computed(()=>R.value<=An),X=l.getState.bind(l),N=l.getReactive.bind(l),V=()=>({data:l}),j=x.exec,O=h=>T=T.setNext(h),E=x.intercept.bind(x),P=x.on.bind(x),L=x.detach.bind(x),_=h=>l.getTask(h),q=h=>l.getResource(h),k=h=>l.serialize(h),$=h=>h?new Promise(Q=>setTimeout(()=>Q(b.value),1)):b.value,C=()=>l.getHistory(),F=h=>l.getCalendar(h),Y=h=>l.getTaskCalendar(h),g=h=>l.getResourceCalendar(h),S=h=>l.getTaskResources(h),Z=h=>l.getResourceTasks(h),ne={getState:X,getReactiveState:N,getStores:V,exec:j,setNext:O,intercept:E,on:P,detach:L,getTable:$,getTask:_,getResource:q,serialize:k,getHistory:C,getCalendar:F,getTaskResources:S,getResourceTasks:Z,getTaskCalendar:Y};t({getState:X,getReactiveState:N,getStores:V,exec:j,setNext:O,intercept:E,on:P,detach:L,getTable:$,getTask:_,getResource:q,serialize:k,getHistory:C,getCalendar:F,getTaskResources:S,getResourceTasks:Z,getTaskCalendar:Y,getResourceCalendar:g}),e.provide("gantt-store",{getReactiveState:l.getReactive.bind(l),getState:l.getState.bind(l),exec:x.exec.bind(x),getTask:l.getTask.bind(l),getTaskCalendar:l.getTaskCalendar.bind(l),getResourceCalendar:l.getResourceCalendar.bind(l),getCalendar:l.getCalendar.bind(l),getTaskResources:l.getTaskResources.bind(l),getHistory:l.getHistory.bind(l)});let ce=!0;const he=()=>{const h=d.value;l.init({tasks:n.tasks,links:h.links,resources:n.resources,assignments:n.assignments,start:n.start,columns:h.columns,end:n.end,lengthUnit:n.lengthUnit,cellWidth:h.cellWidth,cellHeight:n.cellHeight,scaleHeight:n.scaleHeight,scales:h.scales,taskTypes:n.taskTypes,zoom:h.zoom,selected:n.selected,activeTask:n.activeTask,baselines:n.baselines,rollups:n.rollups===!0?{type:"closest"}:n.rollups,autoScale:n.autoScale,unscheduledTasks:n.unscheduledTasks,markers:n.markers,durationUnit:n.durationUnit,criticalPath:n.criticalPath,schedule:n.schedule,projectStart:n.projectStart,projectEnd:n.projectEnd,calendar:n.calendar,calendars:n.calendars,slack:n.slack,undo:n.undo,_weekStart:m.weekStart,splitTasks:n.splitTasks,summary:n.summary,groupBy:n.groupBy,highlightTime:n.highlightTime,wbs:n.wbs,displayMode:n.displayMode,gridWidth:y.value,cellBorders:n.cellBorders,_compactMode:U.value}),ce&&n.init&&(n.init(ne),ce=!1)};return e.watchEffect(he),(h,Q)=>(e.openBlock(),e.createBlock(Vn,{taskTemplate:n.taskTemplate,readonly:n.readonly,tableAPI:b.value,"onUpdate:tableAPI":Q[0]||(Q[0]=te=>b.value=te),ganttWidth:R.value,"onUpdate:ganttWidth":Q[1]||(Q[1]=te=>R.value=te)},null,8,["taskTemplate","readonly","tableAPI","ganttWidth"]))}}),Fn=Object.assign({name:"GanttToolbar"},{__name:"Toolbar",props:{api:{default:null},items:{default:()=>[]}},setup(a){const t=a;let n=e.inject("wx-i18n",null);n||(n=z.locale(Pe.en),e.provide("wx-i18n",n));const o=n.getGroup("gantt"),l=r.subscribeLater(()=>t.api?.getReactiveState()?._selected),v=r.subscribeLater(()=>t.api?.getReactiveState()?.undo),u=r.subscribeLater(()=>t.api?.getReactiveState()?.history),m=r.subscribeLater(()=>t.api?.getReactiveState()?.splitTasks),B=r.subscribeLater(()=>t.api?.getReactiveState()?.groupBy),y=["undo","redo"],d=e.computed(()=>{const I=ee.getToolbarButtons({undo:!0,splitTasks:!0});return(t.items.length?t.items:ee.getToolbarButtons({undo:v().value,splitTasks:m().value,group:!!B().value?.field})).map(b=>(b={...b,disabled:!1},b.handler=ee.isHandledAction(I,b.id)?R=>ee.handleAction(t.api,R.id,null,o):b.handler,b.text&&(b.text=o(b.text)),b.menuText&&(b.menuText=o(b.menuText)),b))}),x=e.computed(()=>{const I=l().value,T=[];return d.value.forEach(b=>{const R=b.id;if(R==="add-task"||!y.includes(R))if(!I?.length||!t.api){if(R!=="add-task")return;T.push(b)}else T.push({...b,disabled:b.isDisabled&&I.some(U=>b.isDisabled(U,t.api.getState(),t.api.getTaskCalendar(U)))});else y.includes(R)&&T.push({...b,disabled:b.isDisabled(u().value)})}),T.filter((b,R)=>{if(t.api&&b.isHidden)return!I.some(U=>b.isHidden(U,t.api.getState()));if(b.comp==="separator"){const U=T[R+1];if(!U||U.comp==="separator")return!1}return!0})});return(I,T)=>(e.openBlock(),e.createBlock(e.unref(dt.Toolbar),{items:x.value},null,8,["items"]))}}),jn=["oncontextmenu"],Pn={__name:"ContextMenu",props:{options:{default:()=>[]},api:{default:null},resolver:{default:null},filter:{default:null},at:{default:"point"},onclick:{type:Function},css:{}},setup(a,{expose:t}){const n=a;let o=null,l=e.inject("wx-i18n",null);l||(l=z.locale({...Pe.en,...Ke.en}),e.provide("wx-i18n",l));const v=l.getGroup("gantt"),u=r.subscribeLater(()=>n.api?.getReactiveState()?.taskTypes),m=r.subscribeLater(()=>n.api?.getReactiveState()?.selected),B=r.subscribeLater(()=>n.api?.getReactiveState()?._selected),y=r.subscribeLater(()=>n.api?.getReactiveState()?.splitTasks),d=r.subscribeLater(()=>n.api?.getReactiveState()?.summary),x=r.subscribeLater(()=>n.api?.getReactiveState()?.groupBy),I=e.computed(()=>({splitTasks:y().value,taskTypes:u().value,summary:d().value,group:!!x().value?.field})),T=e.computed(()=>B().value??[]),b=e.computed(()=>ee.getMenuOptions(I.value)),R=e.computed(()=>n.options.length?n.options:null),U=e.computed(()=>N(R.value??b.value));function X(k){return k.map($=>{const C={...$};return $.data&&(C.data=X($.data)),C})}function N(k){return k.map($=>($={...$},$.text&&($.text=v($.text)),$.subtext&&($.subtext=v($.subtext)),$.data&&($.data=N($.data)),$))}function V(){if(!n.api)return[];const k=X(U.value),$=C=>{C.forEach(F=>{F.isDisabled&&(F.disabled=T.value.some(Y=>F.isDisabled(Y,n.api.getState(),n.api.getTaskCalendar(Y),o))),F.data&&$(F.data)})};return $(k),k}function j(k,$){if(z.locate($.target,"data-menu-ignore")?.classList.contains("wx-resource-load"))return null;let C=k?n.api.getTask(k):null;if(n.resolver){const F=n.resolver(k,$);C=F===!0?C:F}if(C){const F=z.locateID($.target,"data-segment");F!==null?o={id:C.id,segmentIndex:F}:o=C.id,m().value.includes(C.id)||n.api.exec("select-task",{id:C.id}),L.value=V()}return C}function O(k){const $=k.action;$&&(ee.isHandledAction(b.value,$.id)&&ee.handleAction(n.api,$.id,o,v),n.onclick&&n.onclick(k))}function E(k){if(!n.api)return!0;let $=n.filter?T.value.every(C=>n.filter(k,C)):!0;return $&&k.isHidden&&($=!T.value.some(C=>k.isHidden(C,n.api.getState(),o))),$}let P=!1;e.watchEffect(()=>{n.api&&!P&&(P=!0,n.api.on("scroll-chart",()=>_.value.show()),n.api.on("drag-task",()=>_.value.show()))});const L=e.ref([]),_=e.ref(null);function q(k,$){L.value=V(),_.value.show(k,$)}return t({show:q}),(k,$)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(xt.ContextMenu),{filter:E,options:L.value,dataKey:"id",resolver:j,onclick:O,css:a.css,at:a.at,ref_key:"menu",ref:_},null,8,["options","css","at"]),e.createElementVNode("span",{oncontextmenu:_.value?.show,"data-menu-ignore":"true"},[e.renderSlot(k.$slots,"default",{},void 0,!0)],8,jn)],64))}},Gn=le(Pn,[["__scopeId","data-v-b683afc0"]]),Un={__name:"GridSection",props:{columns:{},data:{},onaction:{type:Function},onedit:{type:Function},sizes:{},oninit:{type:Function}},setup(a){const t=a;function n(l){const v=z.locateID(l),u=l.target.dataset.action;u&&l.preventDefault(),v&&u&&t.onaction&&t.onaction(v,u)}function o(l){t.oninit&&t.oninit(l),l.on("update-cell",v=>{const{id:u,column:m,value:B}=v;t.onedit(u,m,B)})}return(l,v)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-table",onClick:n},[e.createVNode(e.unref(Le.Grid),{init:o,columns:a.columns,data:a.data,select:!1,columnStyle:u=>`wx-editor-cell wx-text-${u.align} ${u.id==="delete"?"wx-action":""}`,sizes:a.sizes||{}},null,8,["columns","data","columnStyle","sizes"])]))}},nt=le(Un,[["__scopeId","data-v-011a009e"]]),qn={class:"wx-wrapper"},Yn={class:"wx-text"},Kn={key:0,class:"wxi-angle-down"},Xn={__name:"LinkTypeCell",props:{row:{},column:{},data:{}},setup(a){const t=a,n=e.computed(()=>t.data?t.data.label:t.column.options.find(o=>o.id===t.row.type)?.label||"");return(o,l)=>(e.openBlock(),e.createElementBlock("div",qn,[e.createElementVNode("div",Yn,e.toDisplayString(n.value),1),a.row?(e.openBlock(),e.createElementBlock("i",Kn)):e.createCommentVNode("",!0)]))}},it=le(Xn,[["__scopeId","data-v-2569b653"]]),Zn={class:"wx-title"},Qn={key:0,class:"wx-nodata"},Jn=Object.assign({name:"GanttEditorLinks",inheritAttrs:!1},{__name:"Links",props:{api:{},autoSave:{},onextchange:{type:Function},predecessors:{default:null},successors:{default:null},batch:{default:"links"}},setup(a){const t=e.inject("wx-i18n").getGroup("gantt"),n=a,{activeTask:o,_activeTask:l,links:v,tasks:u,schedule:m,unscheduledTasks:B}=n.api.getReactiveState(),y=r.subscribe(o),d=r.subscribe(l),x=r.subscribe(v,!0),I=r.subscribe(u),T=r.subscribe(m),b=r.subscribe(B),R=e.ref();e.watchEffect(()=>{R.value=j()});const U=[{id:"e2s",label:t("End-to-start")},{id:"s2s",label:t("Start-to-start")},{id:"e2e",label:t("End-to-end")},{id:"s2e",label:t("Start-to-end")}];function X(_){return _.type==="e2s"?{type:"text",config:{type:"number"}}:null}const N=e.computed(()=>!T.value?.auto||b.value&&d.value.unscheduled);function V(){return[{id:"taskText",header:t("Task name"),flexgrow:2},{id:"lag",header:t("Lag"),editor:X,flexgrow:1,hidden:N.value},{id:"type",header:t("Type"),width:124,options:U,editor:{type:"richselect",config:{cell:it}},cell:it},{id:"delete",header:"",cell:je,width:50,align:"center"}]}function j(){if(y.value){const _=[],q=[];(!n.predecessors||!n.successors)&&x.value.forEach(C=>{!n.predecessors&&C.target===y.value&&_.push(C),!n.successors&&C.source===y.value&&q.push(C)});const k=n.predecessors||_.map(C=>{const{id:F,lag:Y,type:g,source:S}=C;return{id:F,type:g,lag:Y,taskText:I.value.byId(S).text}}),$=n.successors||q.map(C=>{const{id:F,lag:Y,type:g,target:S}=C;return{id:F,type:g,lag:Y,taskText:I.value.byId(S).text}});return[{title:t("Predecessors"),data:k},{title:t("Successors"),data:$}]}}function O(_){return{view:"links",event:_,values:{predecessors:R.value[0].data,successors:R.value[1].data}}}function E(_){n.autoSave?n.api.exec("delete-link",{id:_}):(R.value=R.value.map(q=>({...q,data:q.data.filter(k=>k.id!==_)})),n.onextchange?.(O({id:_,action:"delete-link",data:{id:_}})))}function P(_,q,k){q==="lag"&&k!==""&&(k=k*1);const $={[q]:k};q==="type"&&T.value?.auto&&k!=="e2s"&&($.lag=""),n.autoSave?n.api.exec("update-link",{id:_,link:$}):(R.value=R.value.map(C=>({...C,data:C.data.map(F=>F.id===_?{...F,...$}:F)})),n.onextchange?.(O({id:_,action:"update-link",data:{id:_,link:$}})))}const L=e.computed(()=>R.value&&!R.value[0].data.length&&!R.value[1].data.length);return(_,q)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wx-wrapper",{"wx-nobatch":a.batch!=="links"}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,k=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.title},[k.data.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Zn,e.toDisplayString(k.title),1),e.createVNode(nt,{columns:V(),onaction:E,onedit:P,data:k.data,sizes:{rowHeight:44}},null,8,["columns","data"])],64)):e.createCommentVNode("",!0)],64))),128)),L.value?(e.openBlock(),e.createElementBlock("div",Qn,e.toDisplayString(e.unref(t)("No links")),1)):e.createCommentVNode("",!0)],2))}}),ea=le(Jn,[["__scopeId","data-v-0a1cff38"]]),ta={class:"date-time-controll"},na={__name:"DateTimePicker",props:{value:{},time:{},format:{},onchange:{type:Function}},setup(a){const t=a,n=e.computed(()=>{const{value:l,time:v,format:u,onchange:m,...B}=t;return B});function o(l){const v=new Date(l.value);v.setHours(t.value.getHours()),v.setMinutes(t.value.getMinutes()),t.onchange?.({value:v})}return(l,v)=>(e.openBlock(),e.createElementBlock("div",ta,[e.createVNode(e.unref(ue.DatePicker),e.mergeProps(n.value,{value:a.value,onchange:o,format:a.format,buttons:["today"],clear:!1}),null,16,["value","format"]),a.time?(e.openBlock(),e.createBlock(e.unref(ue.TimePicker),{key:0,value:a.value,onchange:a.onchange,format:a.format},null,8,["value","onchange","format"])):e.createCommentVNode("",!0)]))}},aa=le(na,[["__scopeId","data-v-1f9dfea2"]]),oa={class:"wx-avatar"},la={class:"wx-text"},sa={class:"wx-name"},ra={key:0,class:"wx-role"},ca={__name:"ResourcesEditorCell",props:{row:{},data:{}},setup(a){const t=a,n=e.computed(()=>t.data||t.row);return(o,l)=>n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",oa,[e.createVNode(e.unref(ue.Avatar),{value:n.value,size:40},null,8,["value"])]),e.createElementVNode("div",la,[e.createElementVNode("div",sa,e.toDisplayString(n.value.name),1),n.value.role?(e.openBlock(),e.createElementBlock("div",ra,e.toDisplayString(n.value.role),1)):e.createCommentVNode("",!0)])],64)):e.createCommentVNode("",!0)}},ut=le(ca,[["__scopeId","data-v-28c145a1"]]),ia={class:"wx-section"},ua={key:1,class:"wx-nodata"},da={class:"wx-button-wrapper"},fa=Object.assign({name:"GanttEditorResources",inheritAttrs:!1},{__name:"Resources",props:{api:{},autoSave:{},onextchange:{type:Function},taskAssignments:{default:null}},setup(a){const n=e.inject("wx-i18n").getGroup("gantt"),o=a,l=o.onextchange,{activeTask:v,resources:u,_assignments:m,assignments:B}=o.api.getReactiveState(),y=r.subscribe(v),d=r.subscribe(u),x=r.subscribe(B),I=e.ref(void 0),T=e.ref(null),b=e.ref([]);function R(g){b.value=o.taskAssignments||o.api.getTaskResources(g).map(S=>({...S,resource:S.id,id:S.assignmentId}))}const U=[v.subscribe(g=>{R(g)}),m.subscribe(()=>R(y.value))];e.onUnmounted(()=>{for(const g of U)g()});const X=e.computed(()=>{const g=[];return d.value?.eachChild(S=>{S.data||g.push({...S,label:S.name})},0),g}),N=e.computed(()=>X.value.filter(g=>!b.value.find(S=>S.resource===g.id)));function V(g){return{view:"resources",event:g,values:{taskAssignments:b.value}}}function j(g){I.value.exec("close-editor",{ignore:!0}),o.autoSave?o.api.exec("delete-assignment",{id:g}):(b.value=b.value.filter(S=>S.id!==g),l&&l(V({id:g,action:"delete-assignment",data:{id:g}}))),T.value=null}function O(g,S){const Z=y.value;S={...S,units:100,task:Z,id:g};const ne={assignment:S};if(o.autoSave)o.api.exec("add-assignment",ne);else{const ce=d.value?.byId(S.resource);b.value=[...b.value,{...ce,...S}],l&&l(V({id:ce.id,action:"add-assignment",data:ne}))}}function E(g){return g.id===T.value?N.value:[X.value.find(Z=>Z.id===g.resource)].concat(N.value)}function P(g,S){let Z=x.value?.byId(g);Z||(Z=b.value.find(ce=>ce.id===g));const ne={id:g,assignment:{units:Z.units||100,...S,id:g}};o.autoSave?o.api.exec("update-assignment",ne):(S.resource&&S.resource!==Z.resource&&(S={...d.value?.byId(S.resource),...ne.assignment}),b.value=b.value.map(ce=>ce.id===g?{...ce,...S}:ce),l&&l(V({id:g,action:"update-assignment",data:ne})))}const L=e.computed(()=>(N.value,[{id:"resource",header:n("Resource"),cell:ut,type:"string",flexgrow:3,editor:g=>({type:"combo",config:{options:E(g),cell:ut}}),options:X.value},{id:"units",header:n("Units"),flexgrow:1,editor:{type:"text",config:{type:"number"}},template:g=>`${g}%`},{id:"delete",header:"",cell:je,width:50,align:"center"}]));function _(g,S){g&&S==="delete"&&j(g)}function q(g,S,Z){if(S==="units")P(g,{units:Z*1});else if(S==="resource"){const ne={resource:Z};g===T.value?O(g,ne):P(g,ne)}T.value=null}function k(g){I.value=g,I.value.on("close-editor",()=>{T.value&&(I.value.exec("delete-row",{id:T.value}),T.value=null)})}const $=e.computed(()=>T.value||!N.value.length);let C=!1;function F(){I.value?.exec("close-editor",{ignore:!0}),C||(C=!0,T.value=tt.tempID(),requestAnimationFrame(()=>{Y(T.value),C=!1}))}function Y(g){I.value.exec("add-row",{id:g,row:{units:100}}),setTimeout(()=>{I.value.exec("open-editor",{id:g,column:"resource"})})}return(g,S)=>(e.openBlock(),e.createElementBlock("div",ia,[b.value.length||T.value?(e.openBlock(),e.createBlock(nt,{key:0,oninit:k,columns:L.value,onaction:_,onedit:q,data:b.value,sizes:{rowHeight:52}},null,8,["columns","data"])):(e.openBlock(),e.createElementBlock("div",ua,e.toDisplayString(e.unref(n)("No assignments")),1)),e.createElementVNode("div",da,[e.createVNode(e.unref(ue.Button),{disabled:$.value,icon:"wxi-plus",css:"wx-button",onclick:F},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("Add resource")),1)]),_:1},8,["disabled"])])]))}}),ma=le(fa,[["__scopeId","data-v-7bdae259"]]),pa={class:"wx-section"},va={key:1,class:"wx-nodata"},ga=Object.assign({name:"GanttEditorSegments",inheritAttrs:!1},{__name:"Segments",props:{api:{},autoSave:{},segments:{},onextchange:{type:Function}},setup(a){const t=e.inject("wx-i18n"),n=t.getGroup("gantt"),o=t.getRaw(),l=o.gantt?.dateFormat||o.formats?.dateFormat,v=z.dateToString(l,o.calendar),u=a,m=u.onextchange,{_activeTask:B}=u.api.getReactiveState(),y=r.subscribe(B),d=e.ref([]);function x(){const V=y.value;return!V||u.segments===null?[]:u.segments?[...u.segments]:V?.segments?.map(j=>({...j,id:j.id||tt.tempID()}))}e.watchEffect(()=>{y.value,d.value=x()});const I=e.computed(()=>[{id:"text",header:n("Name"),type:"string",flexgrow:3,editor:"text"},{id:"start",header:n("Start"),flexgrow:2,template:V=>v(V),editor:"datepicker"},{id:"duration",header:n("Duration"),flexgrow:2,editor:{type:"text",config:{type:"number"}}},{id:"delete",header:"",cell:je,width:50,align:"center"}]),T=e.ref(null);function b(V){T.value=V}function R(V){return{view:"segments",event:V,values:{segments:d.value.length?[...d.value]:null}}}function U(V){const j=d.value.findIndex(P=>P.id===V);d.value=d.value.filter((P,L)=>L!==j);const E={id:y.value.id,task:{segments:d.value.length?[...d.value]:null}};u.autoSave?u.api.exec("update-task",E):m&&m(R({id:V,action:"update-task",data:E}))}function X(V,j){j==="delete"&&U(V)}function N(V,j,O){const{data:E}=T.value.getState();let P=E.findIndex(k=>k.id===V);j==="duration"&&(O=O*1);const L={...d.value[P],[j]:O},_=y.value;ee.prepareEditTask(L,u.api.getState(),u.api.getTaskCalendar(_),j);const q={id:_.id,segmentIndex:P,task:L};u.autoSave?u.api.exec("update-task",q):(d.value=d.value.map(k=>k.id===V?{...k,...L}:k),m&&m(R({id:V,action:"update-task",data:q})))}return(V,j)=>(e.openBlock(),e.createElementBlock("div",pa,[d.value.length?(e.openBlock(),e.createBlock(nt,{key:0,columns:I.value,oninit:b,onaction:X,data:d.value,onedit:N},null,8,["columns","data"])):(e.openBlock(),e.createElementBlock("div",va,e.toDisplayString(e.unref(n)("No segments")),1))]))}}),ha=le(ga,[["__scopeId","data-v-5a914a60"]]),qe="general",ka=Object.assign({name:"GanttEditor"},{__name:"Editor",props:{api:{default:null},items:{default:()=>[]},css:{default:""},layout:{default:"default"},readonly:{type:Boolean,default:!1},placement:{default:"sidebar"},bottomBar:{type:[Boolean,Object],default:!1},topBar:{type:[Boolean,Object],default:!0},autoSave:{type:Boolean,default:!0},focus:{type:Boolean,default:!1},hotkeys:{default:()=>({})}},setup(a){Ce.registerEditorItem("select",ue.RichSelect),Ce.registerEditorItem("date",aa),Ce.registerEditorItem("twostate",ue.TwoState),Ce.registerEditorItem("slider",ue.Slider),Ce.registerEditorItem("counter",ue.Counter),Ce.registerEditorItem("links",ea),Ce.registerEditorItem("checkbox",ue.Checkbox),Ce.registerEditorItem("resources",ma),Ce.registerEditorItem("segments",ha),dt.registerToolbarItem("tabs",ue.Tabs);const t=a;let n=e.inject("wx-i18n",null);n||(n=z.locale({...Pe.en,...Ke.en}),e.provide("wx-i18n",n));const o=n.getGroup("gantt"),l=n.getRaw(),v=l.gantt?.dateFormat||l.formats?.dateFormat,u=z.dateToString(v,l.calendar),m=r.subscribeLater(()=>t.api?.getReactiveState()?._activeTask),B=r.subscribeLater(()=>t.api?.getReactiveState()?.activeTask),y=r.subscribeLater(()=>t.api?.getReactiveState()?.unscheduledTasks),d=r.subscribeLater(()=>t.api?.getReactiveState()?.rollups),x=r.subscribeLater(()=>t.api?.getReactiveState()?.summary),I=r.subscribeLater(()=>t.api?.getReactiveState()?.links),T=r.subscribeLater(()=>t.api?.getReactiveState()?.splitTasks),b=r.subscribeLater(()=>t.api?.getReactiveState()?.taskTypes),R=r.subscribeLater(()=>t.api?.getReactiveState()?.resources??null),U=r.subscribeLater(()=>t.api?.getReactiveState()?._compactMode),X=r.subscribeLater(()=>t.api?.getReactiveState()?.undo),N=e.ref(qe),V=e.computed(()=>U().value?"wx-full-screen":""),j=e.computed(()=>ee.getEditorItems({unscheduledTasks:y().value,rollups:d().value,summary:x().value,taskTypes:b().value,resources:R().value,splitTasks:T().value})),O=e.ref(new Map),E=e.ref(new Map),P=e.ref(new Map),L=e.ref(null),_=e.ref(void 0),q=e.ref(null),k={taskAssignments:null,predecessors:null,successors:null},$=e.ref({...k}),C=e.computed(()=>{const c=m().value;if(!c)return null;const G={...c};if(t.readonly){let H={parent:G.parent};return j.value.forEach(({key:f,comp:se})=>{if(se!=="links"&&se!=="resources"){const pe=G[f];se==="date"&&pe instanceof Date?H[f]=u(pe):se==="slider"&&f==="progress"?H[f]=`${pe}%`:H[f]=pe}}),H}return G||null});e.watch(C,c=>{_.value=c}),e.watch(B,()=>{O.value=new Map,E.value=new Map,P.value=new Map,q.value=null,L.value=null,N.value||(N.value=qe),$.value={...k}});function F(c,G="form"){return!t.api||!c||!Array.isArray(c)?c:c.filter(H=>_.value?!H.isHidden||!H.isHidden(_.value,t.api.getState()):!0).map(H=>{const f={...H};return f.items&&Array.isArray(f.items)?(f.items=F(f.items),f):(G==="form"&&!f.batch&&(f.batch=qe),["links","resources","segments"].includes(f.key)&&t.api&&(f.api=t.api,f.autoSave=t.autoSave,f.key==="resources"?f.taskAssignments=$.value.taskAssignments:f.key==="links"?(f.successors=$.value.successors,f.predecessors=$.value.predecessors):f.key==="segments"&&(f.segments=$.value.segments),f.onextchange=he),f.id==="tabs"&&(f.api=t.api,f.css="wx-gantt-tabs",f.value=N.value,f.onchange=f.onchange||ae),f.comp==="slider"&&f.key==="progress"&&(f.labelTemplate=se=>`${o(f.label)} ${se}%`),f.text&&(f.text=o(f.text)),f.label&&(f.label=o(f.label)),f.options&&(f.options=F(f.options)),f.config&&(f.config={...f.config}),f.config?.placeholder&&(f.config.placeholder=o(f.config.placeholder)),_.value&&f.isDisabled&&f.isDisabled(_.value,t.api.getState(),t.api.getTaskCalendar(_.value))?f.disabled=!0:delete f.disabled,f)})}const Y=e.computed(()=>{const c=t.items.length?t.items:j.value;return F(c)}),g=e.computed(()=>new Set(Y.value.map(c=>c.batch)));e.watch(g,c=>{c.has(N.value)||(N.value=qe)});const S=e.computed(()=>Y.value.map(c=>c.key));function Z(c,G,H){if(c=typeof c!="object"?{}:{...c},c.items||(c.items=ee.getEditorButtons({resources:R().value,autoSave:t.autoSave,splitTasks:T().value})),c.items=ee.filterEditorButtons(c.items,f=>!(f.id==="tabs"&&(f.type=f.type||H,f.options=f.options.filter(se=>G.has(se.id)),f.options.length<2))),c.items=F(c.items,"toolbar"),!c.layout){const f=c.items.some(se=>se.items);c.layout=f?"column":"row"}return c}const ne=e.computed(()=>!t.topBar||t.readonly?!1:Z(t.topBar,g.value,"top")),ce=e.computed(()=>!t.bottomBar||t.readonly?!1:Z(t.bottomBar,g.value,"bottom"));function he({view:c,event:G,values:H}){const{id:f,action:se,data:pe}=G;let ke;c==="links"?ke=O.value:c==="resources"?ke=E.value:c==="segments"&&(ke=P.value),ke.set(f,{action:se,data:pe}),Object.keys(H).forEach(ge=>{$.value[ge]=H[ge]})}function h(){for(let[c,G]of O.value)if(I().value.byId(c)){const{action:H,data:f}=G;t.api.exec(H,f)}[E.value,P.value].forEach(c=>{for(let[,G]of c){const{action:H,data:f}=G;t.api.exec(H,f)}})}function Q(){t.api.exec("delete-task",{id:B().value})}function te(){t.api.exec("show-editor",{id:null})}function ye(c){const{item:G}=c;G.id==="delete"?Q():G.id==="save"&&h(),G.comp&&te()}function ve(c){let{update:G,key:H,input:f}=c;if(f&&(L.value=!0),c.update=we({...G},H,f),!t.autoSave)_.value=c.update;else if(!q.value&&!f){const se=Y.value.find(ge=>ge.key===H),pe=G[H];(!se.validation||se.validation(pe))&&(!se.required||pe)&&Be(c.update)}}function we(c,G,H){return y().value&&c.type==="summary"&&(c.unscheduled=!1),ee.prepareEditTask(c,t.api.getState(),t.api.getTaskCalendar(c),G),H||(L.value=!1),c}function be(c){t.autoSave||Be(c.values,c.changes)}function $e(c){q.value=c.errors}function Be(c,G){delete c.links,delete c.data,(S.value.indexOf("duration")===-1||c.segments&&!c.duration)&&delete c.duration;const H={id:B().value,task:c};t.autoSave&&L.value&&(H.inProgress=L.value),t.api.exec("update-task",H),!t.autoSave&&!G?.length&&h()}const J=e.computed(()=>X().value?{"ctrl+z":c=>{c.preventDefault(),t.api.exec("undo")},"ctrl+y":c=>{c.preventDefault(),t.api.exec("redo")}}:{});function ae(c){N.value=c.value}return(c,G)=>C.value?(e.openBlock(),e.createBlock(e.unref(ue.Locale),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(Ce.Editor),{css:`wx-gantt-editor ${V.value} ${a.css}`,items:Y.value,values:C.value,topBar:ne.value,bottomBar:ce.value,placement:a.placement,layout:a.layout,readonly:a.readonly,autoSave:a.autoSave,focus:a.focus,activeBatch:N.value,onaction:ye,onsave:be,onvalidation:$e,onchange:ve,hotkeys:a.hotkeys&&{...J.value,...a.hotkeys}},null,8,["css","items","values","topBar","bottomBar","placement","layout","readonly","autoSave","focus","activeBatch","hotkeys"])]),_:1})):e.createCommentVNode("",!0)}}),ya=le(ka,[["__scopeId","data-v-311f463a"]]),ba={__name:"HeaderMenu",props:{columns:{default:null},api:{}},setup(a){const t=a,n=e.computed(()=>t.api?.getTable());return(o,l)=>(e.openBlock(),e.createBlock(e.unref(Le.HeaderMenu),{api:n.value,columns:a.columns},{default:e.withCtx(()=>[o.$slots.default?e.renderSlot(o.$slots,"default",{key:0}):e.createCommentVNode("",!0)]),_:3},8,["api","columns"]))}},xa={key:1,class:"wx-toggle-placeholder"},wa={class:"wx-name"},_a={key:1,class:"wx-avatar-name"},Ba=Object.assign({name:"GanttResourceNameCell"},{__name:"NameCell",props:{row:{},column:{}},setup(a){const t=a;function n(o,l){return`justify-content:${l.align};padding-left: ${(o.$level-1)*20}px`}return(o,l)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-content",style:e.normalizeStyle(n(t.row,t.column))},[t.row.data?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(`wx-toggle-icon wxi-menu-${t.row.open?"down":"right"}`),"data-action":"open-resource-row"},null,2)):(e.openBlock(),e.createElementBlock("i",xa)),e.createElementVNode("div",wa,[t.column._cell?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.column._cell),{key:0,row:t.row,column:t.column},null,8,["row","column"])):t.row.role?(e.openBlock(),e.createElementBlock("div",_a,[e.createVNode(e.unref(ue.Avatar),{value:t.row,size:28},null,8,["value"]),e.createElementVNode("span",null,e.toDisplayString(t.row.name),1)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.row.name),1)],64))])],4))}}),$a=le(Ba,[["__scopeId","data-v-7202a0f4"]]),Sa=["data-tooltip"],Ta={class:"wx-name"},Ea={key:1,class:"wx-avatar"},Ca={__name:"NameCellCompact",props:{row:{},column:{}},setup(a){const t=a;return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-content wx-compact","data-tooltip":t.row.name},[e.createElementVNode("div",Ta,[t.column._cell?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.column._cell),{key:0,row:t.row,column:t.column},null,8,["row","column"])):t.row.role?(e.openBlock(),e.createElementBlock("div",Ea,[e.createVNode(e.unref(ue.Avatar),{value:t.row,size:20},null,8,["value"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.row.name),1)],64))])],8,Sa))}},Ia=le(Ca,[["__scopeId","data-v-a6e976d1"]]),Da=["data-resource-id"],Ra=Object.assign({name:"GanttResourceLoadCell"},{__name:"LoadCell",props:{row:{},column:{}},setup(a){const t=a;return(n,o)=>(e.openBlock(),e.createElementBlock("div",{"data-resource-id":e.unref(z.setID)(t.row.id)},e.toDisplayString(t.column.template(e.unref(Xe.getValue)(t.row,t.column))),9,Da))}}),La={class:"wx-layout"},Va={class:"wx-y-bar-clip"},Na=["onwheel"],za={__name:"ResourceLoad",props:{api:{},columns:{default:()=>ee.getResourceColumns()},mode:{default:"grid"},template:{}},setup(a){const t=a,n=e.ref(17);e.onMounted(()=>{n.value=Yt()});const o=e.computed(()=>t.api?.getReactiveState()),l=r.subscribeLater(()=>o.value?._resources),v=r.subscribeLater(()=>o.value?._scales),u=r.subscribeLater(()=>o.value?._resourceSort),m=r.subscribeLater(()=>o.value?.cellHeight),B=r.subscribeLater(()=>o.value?.columns),y=r.subscribeLater(()=>o.value?.scrollLeft),d=r.subscribeLater(()=>o.value?.gridWidth),x=r.subscribeLater(()=>o.value?.displayMode),I=r.subscribeLater(()=>o.value?._headerLength),T=r.subscribeLater(()=>o.value?.highlightTime),b=r.subscribeLater(()=>o.value?._columnsWidth),R=r.subscribeLater(()=>o.value?._gridCollapseThreshold),U=r.subscribeLater(()=>o.value?.cellBorders),X=r.subscribeLater(()=>o.value?.zoom),N=e.computed(()=>l().value??[]),V=e.computed(()=>v().value??null),j=e.computed(()=>u().value??null),O=e.computed(()=>m().value??0),E=e.computed(()=>B().value??[]),P=e.computed(()=>y().value??0),L=e.computed(()=>d().value??0),_=e.computed(()=>x().value??null),q=e.computed(()=>I().value??1),k=e.computed(()=>T().value??null),$=e.computed(()=>b().value??null),C=e.computed(()=>R().value??null),F=e.computed(()=>U().value??null),Y=e.computed(()=>X().value??null);let g=e.inject("wx-i18n",null);g||(g=z.locale({...Pe.en,...Ke.en}),e.provide("wx-i18n",g));const S=g.getGroup("gantt"),Z=e.ref(0),ne=e.ref(null),ce=e.ref(null),he=e.ref(0);let h,Q;const te=e.computed(()=>{if(!t.columns||!t.columns.length)return[];let K=ee.normalizeResourceColumns(t.columns).map(oe=>{oe={...oe};const fe=oe.header;if(typeof fe=="object"){const Se=fe.text&&S(fe.text);oe.header={...fe,text:Se}}else oe.header=S(fe);return oe.align=oe.align||"left",oe.editor=!1,oe});const M=K.findIndex(oe=>oe.id==="name");return M!==-1&&(K[M].cell&&(K[M]._cell=K[M].cell),K[M]={...K[M],header:_.value==="chart"?"":K[M].header,cell:_.value==="chart"?Ia:$a}),K.length>0&&(K[K.length-1].resize=!1),K}),ye=e.computed(()=>vt(N.value,j.value)),ve=e.ref(0),we=e.ref(0);e.watchEffect(()=>{let K;$.value?K=$.value:_.value==="chart"?K=C.value||0:K=L.value,we.value=K});const be=e.computed(()=>mt(te.value,_.value,"name")),$e=e.computed(()=>qt(V.value,Ra,t.template)),Be=e.computed(()=>ft(E.value,_.value,L.value)),J=e.computed(()=>(V.value?.width??0)>Z.value-ve.value),ae=e.computed(()=>{const K=N.value?.length*O.value,M=he.value-(J.value?n.value:0);return K>M}),c=e.computed(()=>we.value>ve.value+(ae.value?n.value:0));e.watchEffect(()=>{const K=P.value;Q?.exec("scroll-to",{left:K}),ce.value&&Math.abs(ce.value.scrollLeft-K)>1&&(ce.value.scrollLeft=K)});function G(K){const M=K.target.dataset.action;if(M==="open-resource-row"){K.preventDefault();const oe=z.locateID(K),fe=N.value.find(Se=>Se.id===oe);fe.data&&t.api.exec(M,{id:oe,mode:!fe.open})}}const H=e.ref([]);function f(K){h=K,h.on("select-row",M=>{H.value=[M.id]}),h.intercept("sort-rows",M=>{const{key:oe,add:fe}=M;let Se=j.value?j.value.find(Oe=>Oe.key===oe):null,ze="asc";return Se&&(ze=!Se||Se.order==="asc"?"desc":"asc"),t.api.exec("sort-resources",{key:oe,order:ze,add:fe,_columns:te.value}),!1}),h.intercept("resize-column",M=>{M.flexgrowFallback=pt(te.value,M.id)}),h.on("resize-column",()=>{we.value=Ye(h.getState().columns)}),h.on("scroll-to",M=>{M.top!==void 0&&!M.rSync&&Q?.exec("scroll-to",{top:M.top,rSync:!0})})}function se(K){Q=K,Q.on("select-row",M=>{H.value=[M.id]}),Q.on("scroll-to",M=>{M.left!==void 0&&Math.abs(M.left-P.value)>1&&t.api.exec("scroll-chart",{left:M.left}),M.top!==void 0&&!M.rSync&&h?.exec("scroll-to",{top:M.top,rSync:!0})})}function pe(K,M){const oe=Xe.getValue(K,M);if(oe)return oe.percent>100?" wx-overload":" wx-normal";if(M.unit!=="day"&&M.unit!=="hour")return"";const fe=t.api.getResourceCalendar(K);if(fe){if(!fe.isWorkingDay(M.date))return fe.css??"wx-weekend"}else if(k.value)return k.value(M.date,M.unit);return""}const ke=e.computed(()=>t.api&&kt(t.api,()=>Y.value,()=>ne.value)),ge=e.ref(null);let De;e.onMounted(()=>{ge.value&&(De=new ResizeObserver(()=>{Z.value=ge.value?.offsetWidth??0}),De.observe(ge.value),Z.value=ge.value.offsetWidth)}),e.onUnmounted(()=>{De?.disconnect()});const _e=e.ref(null);let Ie;e.onMounted(()=>{_e.value&&(Ie=new ResizeObserver(()=>{ve.value=_e.value?.clientWidth??0}),Ie.observe(_e.value),ve.value=_e.value.clientWidth)}),e.onUnmounted(()=>{Ie?.disconnect()});const Ee=e.ref(null);let Ne;return e.onMounted(()=>{Ee.value&&(Ne=new ResizeObserver(()=>{he.value=Ee.value?.clientHeight??0}),Ne.observe(Ee.value),he.value=Ee.value.clientHeight)}),e.onUnmounted(()=>{Ne?.disconnect()}),(K,M)=>t.api?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-resource-load",style:e.normalizeStyle(`--wx-scrollbar-width: ${n.value}px;`),ref_key:"containerDiv",ref:ge,"data-menu-ignore":"true"},[e.createElementVNode("div",La,[t.columns&&t.columns.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:e.normalizeClass(["wx-grid-container",{"wx-y-scroll":ae.value,"wx-h-scroll-reserve":J.value&&!c.value}]),style:e.normalizeStyle(`flex: 0 0 ${Be.value};`),ref_key:"gridContainerDiv",ref:_e},[e.createElementVNode("div",Va,[e.createElementVNode("div",{class:"wx-resource-grid",onClick:G},[e.createVNode(e.unref(Le.Grid),{init:f,sizes:{rowHeight:O.value,headerHeight:V.value.height/q.value},columnStyle:e.unref(gt),data:N.value,columns:be.value,sortMarks:ye.value,selectedRows:H.value},null,8,["sizes","columnStyle","data","columns","sortMarks","selectedRows"])])])],6),e.createVNode(yt,{containerWidth:Z.value,api:t.api},null,8,["containerWidth","api"])],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"wx-chart",ref_key:"chartContainer",ref:ne,onwheel:ke.value},[e.createElementVNode("div",{class:e.normalizeClass(["wx-timescale-viewport",{"wx-v-scroll-reserve":ae.value}]),ref_key:"scalesDiv",ref:ce},[e.createVNode(ht,{api:t.api},null,8,["api"])],2),t.mode==="grid"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-grid-scale-container",ref_key:"rightContainerDiv",ref:Ee},[e.createVNode(e.unref(Le.Grid),{init:se,columns:$e.value,data:N.value,sizes:{rowHeight:O.value,headerHeight:0},selectedRows:H.value,rowStyle:()=>F.value==="column"?"wx-column-border":"",cellStyle:pe},null,8,["columns","data","sizes","selectedRows","rowStyle"])],512)):e.createCommentVNode("",!0)],8,Na)])],4)):e.createCommentVNode("",!0)}},Ma=le(za,[["__scopeId","data-v-6e54a028"]]),Wa=Object.assign({name:"GanttWidgetsTooltip"},{__name:"Tooltip",props:{api:{},at:{default:"point"},overflow:{default:!1},content:{},resolver:{type:Function}},setup(a){const t=a,n=e.computed(()=>t.resolver||o);function o(l,v){if(!t.api)return null;const u=z.getID(l,"data-task-id");if(u){const d=t.api.getTask(u);if(!d)return null;if(t.overflow){const I=l.querySelector(".wx-content");if(I&&I.scrollWidth<=I.clientWidth)return null}const x=z.locateID(v.target,"data-segment");return t.content?{api:t.api,data:{task:d,segmentIndex:x}}:x!==null?d.segments?.[x]?.text??"":d.text??""}const m=z.getID(l,"data-link-id");if(m){const x=t.api.getState().links.byId(m);return x&&t.content?{api:t.api,data:{link:x}}:null}const B=z.getID(l,"data-rollup-id");if(B){const d=t.api.getTask(B);return d?t.content?{api:t.api,data:{rollup:d}}:d.text??"":null}const y=z.getID(l,"data-resource-id");if(y){const d=t.api.getResource(y);return d?t.content?{api:t.api,data:{resource:d}}:d.name??"":null}return null}return(l,v)=>(e.openBlock(),e.createBlock(e.unref(ue.Tooltip),{at:a.at,content:a.content,resolver:n.value},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},8,["at","content","resolver"]))}}),Ha=Object.assign({name:"GanttThemesWillow"},{__name:"Willow",props:{fonts:{type:Boolean,default:!0}},setup(a){const t=a;return(n,o)=>n.$slots.default?(e.openBlock(),e.createBlock(e.unref(ue.Willow),{key:0,fonts:t.fonts},{default:e.withCtx(()=>[e.createVNode(e.unref(Le.Willow),{fonts:t.fonts},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["fonts"])]),_:3},8,["fonts"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(Le.Willow),{fonts:t.fonts},null,8,["fonts"]),e.createVNode(e.unref(ue.Willow),{fonts:t.fonts},null,8,["fonts"])],64))}}),Aa=le(Ha,[["__scopeId","data-v-25fda217"]]),Oa=Object.assign({name:"GanttThemesWillowDark"},{__name:"WillowDark",props:{fonts:{type:Boolean,default:!0}},setup(a){const t=a;return(n,o)=>n.$slots.default?(e.openBlock(),e.createBlock(e.unref(ue.WillowDark),{key:0,fonts:t.fonts},{default:e.withCtx(()=>[e.createVNode(e.unref(Le.WillowDark),{fonts:t.fonts},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["fonts"])]),_:3},8,["fonts"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(Le.WillowDark),{fonts:t.fonts},null,8,["fonts"]),e.createVNode(e.unref(ue.WillowDark),{fonts:t.fonts},null,8,["fonts"])],64))}}),Fa=le(Oa,[["__scopeId","data-v-c9dbd5e1"]]),ja=_t.version;Object.defineProperty(exports,"defaultColumns",{enumerable:!0,get:()=>ee.defaultColumns});Object.defineProperty(exports,"defaultEditorItems",{enumerable:!0,get:()=>ee.defaultEditorItems});Object.defineProperty(exports,"defaultMenuOptions",{enumerable:!0,get:()=>ee.defaultMenuOptions});Object.defineProperty(exports,"defaultTaskTypes",{enumerable:!0,get:()=>ee.defaultTaskTypes});Object.defineProperty(exports,"defaultToolbarButtons",{enumerable:!0,get:()=>ee.defaultToolbarButtons});Object.defineProperty(exports,"getDefaultColumns",{enumerable:!0,get:()=>ee.getDefaultColumns});Object.defineProperty(exports,"getEditorButtons",{enumerable:!0,get:()=>ee.getEditorButtons});Object.defineProperty(exports,"getEditorItems",{enumerable:!0,get:()=>ee.getEditorItems});Object.defineProperty(exports,"getMenuOptions",{enumerable:!0,get:()=>ee.getMenuOptions});Object.defineProperty(exports,"getResourceColumns",{enumerable:!0,get:()=>ee.getResourceColumns});Object.defineProperty(exports,"getToolbarButtons",{enumerable:!0,get:()=>ee.getToolbarButtons});Object.defineProperty(exports,"registerScaleUnit",{enumerable:!0,get:()=>ee.registerScaleUnit});Object.defineProperty(exports,"registerEditorItem",{enumerable:!0,get:()=>Ce.registerEditorItem});exports.ContextMenu=Gn;exports.Editor=ya;exports.Gantt=On;exports.HeaderMenu=ba;exports.ResourceLoad=Ma;exports.Toolbar=Fn;exports.Tooltip=Wa;exports.Willow=Aa;exports.WillowDark=Fa;exports.version=ja;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("@svar-ui/lib-vue"),z=require("@svar-ui/lib-dom"),lt=require("@svar-ui/gantt-locales"),rt=require("@svar-ui/core-locales"),It=require("@svar-ui/lib-state"),T=require("@svar-ui/trial-gantt-store"),yt=require("@svar-ui/grid-store"),Ke=require("@svar-ui/vue-grid"),xe=require("@svar-ui/vue-core"),Ot=require("@svar-ui/vue-toolbar"),an=require("@svar-ui/vue-menu"),Pe=require("@svar-ui/vue-editor"),ln="2.8.3",on={version:ln};function sn(a,t,n){const l=a.getBoundingClientRect(),o=t.querySelector(".wx-body").getBoundingClientRect();return{top:l.top-o.top,left:l.left-o.left,dt:l.bottom-n.clientY,db:n.clientY-l.top}}function Lt(a){if(!a)return null;const t=z.getID(a,"data-context-id");return T.isPlaceholder(t)?null:t}function zt(a,t){return a.querySelector(`[data-id="${z.setID(t)}"]`)}function jt(a){const t=a.cloneNode(!0);return t.classList.add("wx-reorder-task"),t.style.pointerEvents="none",t.style.position="absolute",t}const Ht=5;function rn(a,t){if(!t)return{};let n=null,l=null;const o=Symbol(),{api:c}=t;function u(){if(n?.parentNode&&n.parentNode.removeChild(n),n=null,l){const i=zt(a,l);i&&(i.style.visibility="")}l=null}function f(i){if(typeof i.top>"u")return;if(i.inProgress===!1){u();return}const v=a.querySelector(".wx-body"),d=zt(a,i.id);if(!v||!d)return;l=i.id,(!n||!n.parentNode)&&(n?.parentNode&&n.parentNode.removeChild(n),n=jt(d),n.style.left="0",v.appendChild(n)),d.style.visibility="hidden";const w=c.getState().area?.from??0;n.style.top=Math.round(Math.max(0,i.top-w))+"px"}return a.style.position!=="absolute"&&(a.style.position="relative"),c.on("drag-task",f,{tag:o}),c.on("move-task",i=>{i.inProgress===!1&&u()},{tag:o}),{destroy(){c.detach(o),u()}}}function cn(a,t){let n,l,o,c,u,f,i,v,d;function w(k){c=k.clientX,u=k.clientY,f={...sn(n,a,k),y:t.getTask(o).$y},document.body.style.userSelect="none"}function B(k){n=z.locate(k),Lt(n)&&(o=z.getID(n),d=setTimeout(()=>{v=!0,t&&t.touchStart&&t.touchStart(),w(k.touches[0])},500),a.addEventListener("touchmove",M),a.addEventListener("contextmenu",C),window.addEventListener("touchend",V))}function C(k){if(v||d)return k.preventDefault(),!1}function m(k){k.which===1&&(n=z.locate(k),Lt(n)&&(o=z.getID(n),a.addEventListener("mousemove",L),window.addEventListener("mouseup",F),w(k)))}function R(k){d&&(clearTimeout(d),d=null),a.removeEventListener("mousemove",L),a.removeEventListener("touchmove",M),a.removeEventListener("contextmenu",C),window.removeEventListener("mouseup",F),window.removeEventListener("touchend",V),document.body.style.userSelect="",k&&(a.removeEventListener("mousedown",m),a.removeEventListener("touchstart",B))}function K(k){const y=k.clientX-c,I=k.clientY-u;if(!l){if(Math.abs(y)<Ht&&Math.abs(I)<Ht||t&&t.start&&t.start({id:o,e:k})===!1)return;l=jt(n),l.style.left=f.left+"px",l.style.top=f.top+"px",n.style.visibility="hidden",n.parentNode.insertBefore(l,n)}if(l){const O=Math.round(Math.max(0,f.top+I));if(t&&t.move&&t.move({id:o,top:O,detail:i})===!1)return;const G=t.getTask(o),_=G.$y;if(!f.start&&f.y===_)return Z();f.start=!0,f.y=G.$y-4,l.style.top=O+"px";const N=document.elementFromPoint(k.clientX,k.clientY),X=z.locate(N);if(X&&X!==n){const x=z.getID(X);if(T.isPlaceholder(x))return;const $=X.getBoundingClientRect(),E=$.top+$.height/2,ae=k.clientY+f.db>E&&X.nextElementSibling!==n,te=k.clientY-f.dt<E&&X.previousElementSibling!==n;i?.after===x||i?.before===x?i=null:ae?i={id:o,after:x}:te&&(i={id:o,before:x})}}}function L(k){K(k)}function M(k){v?(k.preventDefault(),K(k.touches[0])):d&&(clearTimeout(d),d=null)}function V(){v=null,d&&(clearTimeout(d),d=null),Z()}function F(){Z()}function Z(){n&&(n.style.visibility=""),l&&(l.parentNode.removeChild(l),t&&t.end&&t.end({id:o,top:f.top})),o=n=l=f=i=null,R()}return a.style.position!=="absolute"&&(a.style.position="relative"),a.addEventListener("mousedown",m),a.addEventListener("touchstart",B),{destroy(){R(!0)}}}const ie=(a,t)=>{const n=a.__vccOpts||a;for(const[l,o]of t)n[l]=o;return n},un={class:"wx-group-text"},dn={key:0,class:"wx-name"},fn={__name:"GroupCellText",props:{row:{}},setup(a){const t=a,l=e.inject("wx-i18n").getGroup("gantt"),o=e.inject("gantt-store"),{groupBy:c,resources:u}=o.getReactiveState(),f=s.subscribe(c),i=s.subscribe(u),v=e.computed(()=>{if(f.value?.field==="resource"){let w=t.row.$groupValue;return Array.isArray(w)||(w=[w]),w.map(B=>i.value.byId(B)).filter(Boolean)}return null}),d=e.computed(()=>f.value?.field=="resource"?l("Unassigned"):l("Ungrouped"));return(w,B)=>(e.openBlock(),e.createElementBlock("div",un,[a.row.$groupValue==="$ungrouped"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(d.value),1)],64)):v.value?.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(xe.Avatar),{value:v.value,size:28},null,8,["value"]),v.value.length===1?(e.openBlock(),e.createElementBlock("span",dn,e.toDisplayString(v.value[0].name),1)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(a.row.text),1)],64))]))}},mn=ie(fn,[["__scopeId","data-v-36807faa"]]),pn={key:1,class:"wx-toggle-placeholder"},vn={class:"wx-text"},gn={key:2,class:"wx-hint"},hn={__name:"TextCell",props:{row:{},column:{}},setup(a){const t=e.inject("wx-i18n").getGroup("gantt");function n(l,o){return`justify-content:${o.align};padding-left: ${(l.$level-1)*20}px`}return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-content",style:e.normalizeStyle(n(a.row,a.column))},[!a.row.$empty&&(a.row.data?.length||a.row.lazy)?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass("wx-toggle-icon wxi-menu-"+(a.row.open?"down":"right")),"data-action":"open-task"},null,2)):(e.openBlock(),e.createElementBlock("i",pn)),e.createElementVNode("div",vn,[a.column._cell?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.column._cell),{key:0,row:a.row,column:a.column},null,8,["row","column"])):a.row.$group?(e.openBlock(),e.createBlock(mn,{key:1,row:a.row},null,8,["row"])):a.row.$placeholder&&!a.row.text?(e.openBlock(),e.createElementBlock("span",gn,e.toDisplayString(e.unref(t)("New task")),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(a.row.text),1)],64))])],4))}},kn=ie(hn,[["__scopeId","data-v-3224070d"]]),yn=["data-action"],bn={__name:"ActionCell",props:{column:{},row:{},cell:{}},setup(a){const t=a,n=e.computed(()=>t.column.id),l=e.computed(()=>n.value.includes("edit")?"wxi-edit":n.value.includes("add")?"wxi-plus":n.value.includes("delete")?"wxi-delete":""),o=e.computed(()=>{if(!n.value.includes("add"))return!1;const c=t.row.$groupValue;return!t.row.$group&&typeof c<"u"||t.row.$group&&typeof c>"u"});return(c,u)=>!a.row.$placeholder&&(a.cell||l.value)?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({textAlign:a.column.align})},[e.createElementVNode("i",{class:e.normalizeClass(["wx-action-icon",l.value,{"wx-disabled":o.value}]),"data-action":!o.value&&n.value},null,10,yn)],4)):e.createCommentVNode("",!0)}},mt=ie(bn,[["__scopeId","data-v-f6024d31"]]),xn={class:"wx-avatar"},wn={__name:"ResourcesCell",props:{row:{}},setup(a){const t=a,n=e.inject("gantt-store"),{assignments:l}=n.getReactiveState(),o=s.subscribe(l),c=e.computed(()=>(o.value,n.getTaskResources(t.row.$id||t.row.id)));return(u,f)=>(e.openBlock(),e.createElementBlock("div",xn,[e.createVNode(e.unref(xe.Avatar),{value:c.value,size:28},null,8,["value"])]))}},_n=ie(wn,[["__scopeId","data-v-3b88ddad"]]),Bn={key:0,class:"wx-avatar-box"},$n={key:1,class:"wx-resource-option"},Sn={class:"wx-name"},Cn={__name:"EditorResourcesCell",props:{data:{}},setup(a){const t=a,n=e.computed(()=>t.data.length);return(l,o)=>Array.isArray(a.data)?(e.openBlock(),e.createElementBlock("div",Bn,[n.value?(e.openBlock(),e.createBlock(e.unref(xe.Avatar),{key:0,value:a.data,size:28},null,8,["value"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",$n,[e.createElementVNode("div",null,[e.createVNode(e.unref(xe.Avatar),{value:a.data,size:28},null,8,["value"])]),e.createElementVNode("div",Sn,e.toDisplayString(a.data.name),1)]))}},En=ie(Cn,[["__scopeId","data-v-daa03424"]]);function Tn(a,t){return`min-height:${a+t*4}px;`}function Rn(a,t){return t?`width:${a}px;`:"width:100%;"}function Nt(a){return!a?.length||a.includes("grid")&&a.includes("chart")||a.includes("grid")&&a.includes("subGrid")?"all":a.includes("grid")?"grid":"chart"}function In(a,t,n,l="grid"){const o=Nt(a);return l==="subGrid"||o==="all"||o==="grid"?Rn(t,n):""}function Ut(a,t,n,l="grid",o=!1){if(l==="subGrid")return o?"auto":`${n}px`;const c=Nt(t);if(c==="all")return`${n}px`;if(c==="grid")return"calc(100% - 4px)";const u=a.find(f=>f.id==="add-task");return u?`${u.width}px`:"0"}function Nn(a,t,n,l,o,c="grid",u=!1){if(c==="subGrid")return n>(u?l:o);const f=Nt(t);return!a&&f!=="grid"?n>o:n>l}function qt(a,t,n="grid",l="add-task",o=0){if(n!=="grid"||t?.includes("grid"))return a;const c=a.find(u=>u.id===l);return c?[{...c,resize:!1}]:[{id:l,resize:!1,width:o}]}function Yt(a,t){const n=l=>l.id!=="add-task"&&l.id!==t&&!l.hidden;return a.filter(n).reduce((l,o)=>!l||o.width>l.width?o:l,null)?.id}function kt(a){return a.reduce((t,n)=>t+(n.hidden?0:n.width),0)}function Kt(a,t){if(a&&t?.length){const n={};return t.forEach(({key:l,order:o},c)=>{n[l]={order:o,...t.length>1&&{index:c}}}),n}return{}}function Vn(){const a=document.createElement("div");a.style.cssText="position:absolute;left:-1000px;width:100px;padding:0;margin:0;min-height:100px;overflow-y:scroll;",document.body.appendChild(a);const t=a.offsetWidth-a.clientWidth;return document.body.removeChild(a),t}function Dn(a){return String(a??"").replace(/[^\w-]/g,"-")}function Xt(a){let t=`wx-text-${a.align}`;return a.id&&(t+=` wx-col-${Dn(a.id)}`),a.id==="add-task"&&(t+=" wx-action"),t.trim()}const Ln=["data-gantt-section"],zn=Object.assign({name:"GanttGridGrid"},{__name:"Grid",props:e.mergeModels({readonly:{},section:{default:"grid"}},{tableAPI:{},tableAPIModifiers:{}}),emits:["update:tableAPI"],setup(a){const t=s.asDirective(cn),n=s.asDirective(rn),l=a,o=e.useModel(a,"tableAPI"),c=e.computed(()=>l.section==="subGrid"),f=e.inject("wx-i18n").getGroup("gantt"),i=e.inject("gantt-store"),{scrollTop:v,cellHeight:d,focusTask:w,_selected:B,area:C,_tasks:m,_scales:R,_columns:K,_sort:L,durationUnit:M,inclusiveEnd:V,splitTasks:F,unscheduledTasks:Z,inactiveTasks:k,filterValues:y,groupBy:I,gridWidth:O,subGridWidth:G,_displayPanels:_,_compactMode:N,_columnsWidth:X}=i.getReactiveState(),x=s.subscribe(v),$=s.subscribe(d),E=s.subscribe(B),ae=s.subscribe(C),te=s.subscribe(m,!0),ne=s.subscribe(R),ue=s.subscribe(K),W=s.subscribe(L),me=s.subscribe(M),we=s.subscribe(V),Ee=s.subscribe(F),Ne=s.subscribe(Z),Ve=s.subscribe(k),Me=s.subscribe(y),He=s.subscribe(I),Re=s.subscribe(O),Ge=s.subscribe(G),Te=s.subscribe(_),Ie=s.subscribe(N),ee=s.subscribe(X),J=e.computed(()=>c.value?Ge.value:Re.value),H=e.computed(()=>c.value&&!Te.value.includes("chart")),re=e.ref(null),q=e.ref(0);function pe(b,D){if(!T.isPlaceholder(b)){if(D==="add-task")i.exec(D,{target:b,task:{text:f("New task")},mode:"child",show:!0,focus:b?"grid":null});else if(D==="open-task"){const U=P.value.find($e=>$e.id===b);(U.data||U.lazy)&&i.exec(D,{id:b,mode:!U.open})}}}function de(b){const D={task:T.getPlaceholderTask(b,f("New task")),show:!0,eventSource:"placeholder"};return i.exec("add-task",D),D.id}function g(b){if(b.detail>1)return;const D=z.locateID(b),U=b.target.dataset.action;U&&b.preventDefault(),D?U==="add-task"||U==="open-task"?pe(D,U):i.exec("select-task",{id:D,toggle:b.ctrlKey||b.metaKey,range:b.shiftKey,show:"xy",focus:c.value?"subGrid":"grid"}):U==="add-task"&&pe(null,U)}function j(b){if(!l.readonly){const D=z.locateID(b);if(T.isPlaceholder(D))return;const U=z.locateID(b,"data-col-id");!(U&&Oe.value.find(Q=>Q.id===U))?.editor&&D&&!c.value&&i.exec("show-editor",{id:D})}}let A;function h(b){const D=b.id,{before:U,after:$e}=b,Q=b.onMove;let be=U||$e,ge=U?"before":"after";if(Q){if(ge==="after"){const We=Be.value.findIndex(je=>je.id===D),at=Be.value.findIndex(je=>je.id===be),ze=Be.value[at];We-at===1?ge="before":!He.value?.field&&ze.data&&ze.open&&(ge="before",be=ze.data[0].id)}A={id:D,[ge]:be}}else A=null;i.exec("move-task",{id:D,mode:ge,target:be,inProgress:Q})}function le({id:b}){if(l.readonly||c.value)return!1;if(He.value?.field){const D=i.getTask(b);if(D.$group||D.data)return!1}if(i.getTask(b).open&&(oe=b,i.exec("open-task",{id:b,mode:!1})),re.value=P.value.find(D=>D.id===b),!re.value)return ve(),!1}let oe=null;function ve(){oe!==null&&(i.exec("open-task",{id:oe,mode:!0}),oe=null)}function ye({id:b,top:D}){A?h({...A,onMove:!1}):i.exec("drag-task",{id:b,top:D+Ze.value,inProgress:!1}),ve(),re.value=null}function De({id:b,top:D,detail:U}){U&&h({...U,onMove:!0}),i.exec("drag-task",{id:b,top:D+Ze.value,inProgress:!0})}const Ue=e.ref(0),Qe=e.ref(0),Xe=e.ref(null);function qe(b){const{key:D,isInput:U}=b;if(!U&&(D==="arrowup"||D==="arrowdown"))return b.eventSource=c.value?"subGrid":"grid",i.exec("hotkey",b),!1;if(D==="enter"){const $e=o.value.getState().focusCell;if($e){const{row:Q,column:be}=$e;be==="add-task"?pe(Q,"add-task"):be==="text"&&pe(Q,"open-task")}}}function ct(b){o.value=b,b.intercept("hotkey",qe),b.intercept("select-row",()=>!1),b.intercept("scroll",()=>!1),b.intercept("sort-rows",D=>{const{key:U,add:$e}=D;let Q=W.value?W.value.find(ge=>ge.key===U):null,be="asc";return Q&&(be=!Q||Q.order==="asc"?"desc":"asc"),i.exec("sort-tasks",{key:U,order:be,add:$e}),!1}),b.intercept("filter-rows",D=>{const{key:U,value:$e}=D;return i.exec("filter-tasks",{key:U,value:$e,open:!0}),!1}),b.intercept("resize-column",D=>{D.flexgrowFallback=Yt(Oe.value,D.id)}),b.on("resize-column",D=>{const U=b.getState().columns;q.value=kt(U),D.inProgress!==!0&&i.exec("set-columns",{columns:U})}),b.on("hide-column",()=>{const D=b.getState().columns;q.value=kt(D),i.exec("set-columns",{columns:D})}),b.intercept("update-cell",D=>{const{id:U,column:$e,value:Q}=D,be=P.value.find(ge=>ge.id===U);if(be){if($e==="resources"){if(be.$placeholder){const ze=i.getHistory();ze&&ze.startBatch();const je=de(be);je&&T.setTaskResources(je,Q,i),ze&&ze.endBatch()}else T.setTaskResources(U,Q,i);return}let ge=Q;typeof ge!="boolean"&&ge&&!isNaN(ge)&&!(ge instanceof Date)&&(ge*=1);const We={...be},at=ue.value.find(ze=>ze.id===$e);at?.setter?at.setter(We,ge):We[$e]=ge,T.prepareEditTask(We,{durationUnit:me.value,splitTasks:Ee.value,unscheduledTasks:Ne.value},i.getTaskCalendar(We),$e),be.$placeholder?de(We):i.exec("update-task",{id:U,task:We})}return!1})}const Oe=e.computed(()=>{we.value;let b=ue.value.map(Q=>{Q={...Q};const be=[...Q.header];return be.forEach(ge=>{ge.text&&(ge.text=f(ge.text))}),Q.header=be,Q.editor=l.readonly?null:Q.editor,Q});const D=b.findIndex(Q=>Q.id==="text"),U=b.findIndex(Q=>Q.id==="add-task"),$e=b.findIndex(Q=>Q.id==="resources");if(D!==-1&&(b[D].cell&&(b[D]._cell=b[D].cell),b[D].cell=kn),$e!==-1){const Q=b[$e];if(Q.cell||(Q.cell=_n),Q.editor&&typeof Q.editor!="function"){const be=Q.editor,ge=be.config;ge.cell||(ge.cell=En),ge.dropdown||(ge.dropdown={width:"auto"}),Q.editor=We=>{if(We.type!=="summary")return be}}}if(U!==-1&&!c.value){b[U].cell=b[U].cell||mt;const Q=b[U].header[0];if(b[U].header[0].cell=Q.cell||mt,l.readonly)b.splice(U,1);else if(Ie.value){const[be]=b.splice(U,1);b.unshift(be)}}return b=b.filter(Q=>(Q.section||"grid")===l.section),b.length>0&&(b[b.length-1].resize=!1),b});e.watchEffect(()=>{q.value=kt(Oe.value)},{flush:"pre"});const Ze=e.computed(()=>ae.value.from),it=e.computed(()=>ne.value.height),Je=e.computed(()=>Ut(ue.value,Te.value,J.value,l.section,H.value)),et=e.computed(()=>Nn(Ie.value,Te.value,q.value,Ue.value,J.value,l.section,H.value)),tt=e.computed(()=>Tn(Qe.value,$.value)),ot=e.computed(()=>tt.value+In(Te.value,q.value,et.value,l.section)),Y=e.computed(()=>E.value.map(b=>b.id)),P=e.computed(()=>te.value.slice(ae.value.start,ae.value.end)),se=e.computed(()=>c.value?te.value.find(b=>b.$reorder):null),Be=e.computed(()=>{const b=re.value||se.value;return(b&&!P.value.find(U=>U.id===b.id)?[...P.value,b]:P.value).map(U=>({...U}))}),Le=e.computed(()=>Kt(Be.value,W.value)),Ye=e.computed(()=>Le.value?{...Me.value}:Me.value),st=e.computed(()=>qt(Oe.value,Te.value,l.section,"add-task",ee.value)),bt=e.computed(()=>T.getHeaderLength(st.value)),xt=e.computed(()=>Ze.value-x.value);let ut;e.onMounted(()=>{Xe.value&&(ut=new ResizeObserver(b=>{for(const D of b)Ue.value=D.contentRect.width,Qe.value=D.contentRect.height}),ut.observe(Xe.value))});let nt;const wt=s.subscribe(w);e.watch(wt,b=>{if(!b)return;const{id:D,section:U}=b;U===(c.value?"subGrid":"grid")&&(nt||(nt=requestAnimationFrame(()=>{nt=0;const{focusCell:$e,editor:Q}=o.value.getState();Q||o.value.exec("focus-cell",{row:D,column:$e?.column||Oe.value[0]?.id})})))}),e.onUnmounted(()=>{ut?.disconnect(),nt&&cancelAnimationFrame(nt),o.value=null});const pt={start:le,end:ye,move:De,getTask:i.getTask},_t=e.computed(()=>c.value?{api:i}:null),Bt=e.computed(()=>{const b=Ve.value;return D=>{let U=D.$placeholder?"wx-placeholder-row":D.$reorder?"wx-reorder-task":"";return b&&D.inactive&&(U+=(U?" ":"")+"wx-inactive-row"),U}}),dt=e.computed(()=>[...Y.value]),$t=e.computed(()=>({rowHeight:$.value,headerHeight:it.value/bt.value}));return(b,D)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wx-table-container",{"wx-table-container-subgrid":c.value}]),"data-gantt-section":a.section,style:e.normalizeStyle({flex:`${H.value?"1 1":"0 0"} ${Je.value}`,minWidth:"0"}),ref_key:"tableContainer",ref:Xe},[e.withDirectives((e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`${ot.value}--wx-body-offset:${xt.value}px;`),class:"wx-table",onClick:g,onDblclick:j},[e.createVNode(e.unref(Ke.Grid),{init:ct,sizes:$t.value,rowStyle:Bt.value,columnStyle:e.unref(Xt),data:Be.value,columns:st.value,selectedRows:dt.value,sortMarks:Le.value,filterValues:Ye.value},null,8,["sizes","rowStyle","columnStyle","data","columns","selectedRows","sortMarks","filterValues"])],36)),[[e.unref(t),pt],[e.unref(n),_t.value]])],14,Ln))}}),Mt=ie(zn,[["__scopeId","data-v-dd6d5f09"]]),Hn={__name:"CellGrid",setup(a){const t=e.inject("gantt-store"),{cellWidth:n,cellHeight:l,cellBorders:o}=t.getReactiveState(),c=s.subscribe(n),u=s.subscribe(l),f=s.subscribe(o),i=e.ref(null),v=e.ref("#e4e4e4");return e.watchEffect(()=>{if(typeof getComputedStyle<"u"&&i.value){const d=getComputedStyle(i.value).getPropertyValue("--wx-gantt-border");v.value=d?d.substring(d.indexOf("#")):"#1d1e261a"}}),(d,w)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"node",ref:i,style:e.normalizeStyle(`width:100%; height:100%; background:url(${e.unref(T.grid)(e.unref(c),e.unref(u),v.value,e.unref(f))}); position: absolute;`)},null,4))}},Mn={class:"wx-links"},Gn=["onclick","data-link-id"],Wn=["points"],An=["points"],Pn=["data-link-id"],Fn=["points"],On=["points"],jn=Object.assign({name:"GanttChartLinks"},{__name:"Links",props:{onSelectLink:{type:Function},selectedLink:{},readonly:{}},setup(a){const t=s.asDirective(z.clickOutside),n=a,l=e.inject("gantt-store"),{_visibleLinks:o,criticalPath:c,_conflicts:u}=l.getReactiveState(),f=s.subscribe(o),i=s.subscribe(c),v=s.subscribe(u),d=e.computed(()=>v.value?.links);function w(B){const C=B?.target?.classList;!C?.contains("wx-line-hitbox")&&!C?.contains("wx-delete-button")&&n.onSelectLink(null)}return(B,C)=>(e.openBlock(),e.createElementBlock("svg",Mn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f),m=>(e.openBlock(),e.createElementBlock("g",{key:m.id,class:e.normalizeClass(["wx-line",{"wx-critical":e.unref(i)&&m.critical,"wx-violated":d.value?.has(m.id),"wx-line-selectable":!a.readonly}]),onclick:()=>!a.readonly&&a.onSelectLink(m.id),"data-link-id":e.unref(z.setID)(m.id)},[e.createElementVNode("polyline",{class:"wx-line-draw",points:m.$p},null,8,Wn),e.createElementVNode("polyline",{class:"wx-line-hitbox",points:m.$p},null,8,An)],10,Gn))),128)),!a.readonly&&a.selectedLink?e.withDirectives((e.openBlock(),e.createElementBlock("g",{key:0,class:e.normalizeClass(["wx-line wx-line-selected wx-line-selectable wx-delete-link",{"wx-violated":d.value?.has(a.selectedLink.id)}]),"data-link-id":e.unref(z.setID)(a.selectedLink.id)},[e.createElementVNode("polyline",{class:"wx-line-draw",points:a.selectedLink.$p},null,8,Fn),e.createElementVNode("polyline",{class:"wx-line-hitbox",points:a.selectedLink.$p},null,8,On)],10,Pn)),[[e.unref(t),w]]):e.createCommentVNode("",!0)]))}}),Un=ie(jn,[["__scopeId","data-v-193d35ec"]]),qn=["data-rollup-id"],Yn=Object.assign({name:"GanttChartRollups"},{__name:"Rollups",props:{rollup:{},parent:{}},setup(a){const t=e.inject("gantt-store"),{inactiveTasks:n}=t.getReactiveState(),l=s.subscribe(n);return(o,c)=>(e.openBlock(),e.createElementBlock("div",{"data-rollup-id":e.unref(z.setID)(a.rollup.id),class:e.normalizeClass([`wx-rollup wx-${a.rollup.type}-rollup`,{"wx-inactive":e.unref(l)&&a.parent.inactive}]),style:e.normalizeStyle(`left:${a.rollup.$x_rollup}px;top:${a.parent.$y+a.parent.$h+a.rollup.$y_rollup_relative}px;width:${a.rollup.$w_rollup}px;height:${a.rollup.$h_rollup}px;`)},null,14,qn))}}),Kn=ie(Yn,[["__scopeId","data-v-a514979a"]]),Xn={class:"wx-segments"},Zn=["data-segment"],Qn={key:0,class:"wx-progress-wrapper"},Jn={class:"wx-content"},ea={__name:"BarSegments",props:{task:{},type:{}},setup(a){const t=a,n=e.inject("gantt-store"),{inactiveTasks:l}=n.getReactiveState(),o=s.subscribe(l);function c(u){const f=t.task.segments[u];return`left:${f.$x}px;top:0px;width:${f.$w}px;height:100%;`}return(u,f)=>(e.openBlock(),e.createElementBlock("div",Xn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.task.segments,(i,v)=>(e.openBlock(),e.createElementBlock("div",{key:v,class:e.normalizeClass(["wx-segment","wx-bar",`wx-${a.type}`,{"wx-inactive":e.unref(o)&&a.task.inactive}]),"data-segment":v,style:e.normalizeStyle(c(v))},[a.task.progress?(e.openBlock(),e.createElementBlock("div",Qn,[e.createElementVNode("div",{class:"wx-progress-percent",style:e.normalizeStyle(`width:${e.unref(T.getSegmentProgress)(a.task,v)}%`)},null,4)])):e.createCommentVNode("",!0),e.createElementVNode("div",Jn,e.toDisplayString(i.text||""),1)],14,Zn))),128))]))}},ta=ie(ea,[["__scopeId","data-v-25af809c"]]);function Et(a,t){return t=t||1,Math.trunc(a/t)*t}function Zt(a,t,n){if(a?.length)return a[Math.floor(t/n)]}const na=["data-id","data-task-id","tabindex"],aa={key:0,class:"wx-progress-wrapper"},la={key:4,class:"wx-content"},oa={key:1,class:"wx-text-out"},sa=["data-deadline"],ra=["data-constraint-id"],ca={class:"wx-constraint-badge"},ia={key:0,class:"wx-constraint-arrow","aria-hidden":"true"},ua=48,da=Object.assign({name:"GanttChartBars"},{__name:"Bars",props:{readonly:{},taskTemplate:{}},setup(a){const t=a,n=e.inject("wx-i18n").getGroup("gantt"),l=e.inject("gantt-store"),{_tasks:o,_links:c,area:u,_scales:f,taskTypes:i,baselines:v,_selected:d,rollups:w,_rollups:B,focusTask:C,criticalPath:m,schedule:R,splitTasks:K,summary:L,slack:M,cellHeight:V,unscheduledTasks:F,inactiveTasks:Z,deadlines:k,_conflicts:y,placeholderRow:I,durationUnit:O}=l.getReactiveState(),G=s.subscribe(o,!0),_=s.subscribe(c),N=s.subscribe(u),X=s.subscribe(f),x=s.subscribe(i),$=s.subscribe(v),E=s.subscribe(d),ae=s.subscribe(w),te=s.subscribe(B),ne=s.subscribe(m),ue=s.subscribe(R),W=s.subscribe(K),me=s.subscribe(L),we=s.subscribe(M),Ee=s.subscribe(V),Ne=s.subscribe(F),Ve=s.subscribe(Z),Me=s.subscribe(k),He=s.subscribe(y,!0),Re=s.subscribe(I),Ge=s.subscribe(O),Te=e.computed(()=>He.value?.constraints);function Ie(r){return typeof r.$x_constraint!="number"||typeof r.$x_deadline!="number"?!1:Math.abs(r.$x_constraint-r.$x_deadline)<ua}const ee=e.computed(()=>G.value.slice(N.value.start,N.value.end).map(r=>({...r}))),J=e.computed(()=>ee.value.some(r=>r.$id&&r.$id!==r.id)),H=e.computed(()=>X.value.lengthUnitWidth);let re=!1;const q=e.ref(void 0);let pe=null;const de=e.ref(null),g=e.ref(null);let j=null;const A=e.ref(null),h=e.computed(()=>A.value&&{..._.value.find(r=>r.id===A.value)}),le=e.ref(void 0);let oe;const ve=e.ref(0),ye=e.ref(null);function De(r){if(r.button!==0)return;const S=z.locate(r);Oe(S,r)}function Ue(r){const S=z.locate(r);S&&(oe=setTimeout(()=>{le.value=!0,Oe(S,r.touches[0])},300))}function Qe(r,S=ye.value.getBoundingClientRect()){return Zt(G.value,r-S.top,Ee.value)}function Xe(r){return r?r.$placeholder?Re.value:Ne.value&&r.unscheduled&&(r.type==="task"||r.type==="milestone"||r.type==="summary"&&ue.value?.auto&&r.manual)&&!r.$group:!1}function qe(r,S){const p=T.calcScaleCellDate(S,l.getState()),he=l.getTaskCalendar(r);return he?he.isWorkingDay(p):!0}function ct(r){return Math.trunc(r/Ee.value)*Ee.value}function Oe(r,S){const{clientX:p,clientY:he}=S;if(!S.target.closest(".wx-delete-button")&&!t.readonly){if(!r&&(Ne.value||Re.value)){const ce=Qe(he),Ce=ye.value.getBoundingClientRect(),Se=Et(p-Ce.left,H.value);if(Xe(ce)&&qe(ce,Se)){const Fe=ce&&ce.type==="milestone";g.value={x:Se,cx:Se,left:Fe?Se-ce.$h/2:Se,y:ce?ce.$y:ct(he-Ce.top)+3,h:ce?ce.$h:Ee.value-7,w:Fe?ce.$h:H.value,task:ce,isMilestone:Fe},P();return}}if(!r)return;const ke=z.getID(r),fe=l.getTask(ke);if(S.target.classList.contains("wx-progress-marker")){const{progress:ce}=l.getTask(ke);j={id:ke,x:p,progress:ce,dx:0,node:r,marker:S.target},S.target.classList.add("wx-progress-in-drag")}else{const ce=Ze(r,S,fe)||"move";if(de.value={id:ke,mode:ce,x:p,dx:0,l:fe.$x,w:fe.$w},W.value&&fe.segments?.length){const Ce=z.locate(S,"data-segment");Ce&&(de.value.segmentIndex=Ce.dataset.segment*1,T.extendDragOptions(fe,de.value))}}P()}}function Ze(r,S,p){if(S.target.classList.contains("wx-line")||(p||(p=l.getTask(z.getID(r))),p.type==="milestone")||p.type==="summary"&&!(ue.value?.auto&&p.manual))return"";const he=z.locate(S,"data-segment");he&&(r=he);const{left:ke,width:fe}=r.getBoundingClientRect(),_e=(S.clientX-ke)/fe;let ce=.2/(fe>200?fe/200:1);return _e<ce?"start":_e>1-ce?"end":""}function it(r){le.value?(r.preventDefault(),et(r,r.touches[0])):oe&&(clearTimeout(oe),oe=null)}function Je(r){et(r,r)}function et(r,S){const{clientX:p,clientY:he}=S;if(!t.readonly)if(j){const{node:ke,x:fe,id:_e}=j,ce=j.dx=p-fe,Ce=Math.round(ce/ke.offsetWidth*100);let Se=j.progress+Ce;j.value=Se=Math.min(Math.max(0,Se),100),l.exec("update-task",{id:_e,task:{progress:Se},inProgress:!0})}else if(de.value){U(null);const{mode:ke,l:fe,w:_e,x:ce,id:Ce,start:Se,segment:Fe,index:nn}=de.value,Ct=l.getTask(Ce),Ae=p-ce,Dt=Math.round(H.value)||1;if(!Se&&Math.abs(Ae)<20||ke==="start"&&_e-Ae<Dt||ke==="end"&&_e+Ae<Dt||ke==="move"&&(Ae<0&&fe+Ae<0||Ae>0&&fe+_e+Ae>ve.value)||de.value.segment&&!T.isSegmentMoveAllowed(Ct,de.value))return;de.value.dx=Ae;let vt,gt;if(ke==="start"?(vt=fe+Ae,gt=_e-Ae):ke==="end"?(vt=fe,gt=_e+Ae):ke==="move"&&(vt=fe+Ae,gt=_e),l.exec("drag-task",{id:Ce,width:gt,left:vt,inProgress:!0,...Fe&&{segmentIndex:nn}}),!de.value.start&&(ke==="move"&&Ct.$x===fe||ke!=="move"&&Ct.$w===_e))return re=!0,Y();de.value.start=!0}else if(g.value){const{isMilestone:ke,x:fe,w:_e,cx:ce}=g.value,Ce=ye.value.getBoundingClientRect(),Se=Et(p-Ce.left,H.value);if(Se===ce)return;if(ke){g.value={...g.value,cx:Se,left:Se-_e/2};return}g.value={...g.value,cx:Se,left:Math.min(Se,fe),w:Math.abs(Se-fe)+H.value}}else{const ke=z.locate(r);if(ke){const fe=l.getTask(z.getID(ke)),ce=z.locate(r,"data-segment")||ke,Ce=Ze(ce,S,fe);ce.style.cursor=Ce&&!t.readonly?"col-resize":"pointer"}else if(Ne.value||Re.value){const fe=Qe(he),_e=Et(p-ye.value.getBoundingClientRect().left,H.value);ye.value.style.cursor=Xe(fe)&&qe(fe,_e)?"crosshair":""}}}function tt(){Y()}function ot(){le.value=null,oe&&(clearTimeout(oe),oe=null),Y()}function Y(){if(j){const{dx:r,id:S,marker:p,value:he}=j;j=null,typeof he<"u"&&r&&l.exec("update-task",{id:S,task:{progress:he},inProgress:!1}),p.classList.remove("wx-progress-in-drag"),re=!0,se()}else if(de.value){const{id:r,mode:S,dx:p,l:he,w:ke,start:fe,segment:_e,index:ce}=de.value;if(de.value=null,fe){const Ce=Math.round(p/H.value);if(!Ce)l.exec("drag-task",{id:r,width:ke,left:he,inProgress:!1,..._e&&{segmentIndex:ce}});else{let Se={},Fe=l.getTask(r);_e&&(Fe=Fe.segments[ce]),S==="move"?(Se.start=Fe.start,Se.end=Fe.end):Se[S]=Fe[S],l.exec("update-task",{id:r,diff:Ce,task:Se,..._e&&{segmentIndex:ce}})}re=!0}se()}else if(g.value){const{left:r,w:S,task:p,isMilestone:he}=g.value,ke=l.getState(),fe=T.calcScaleCellDate(he?r+S/2:r,ke),_e=T.calcScaleCellDate(r+S,ke),ce=T.getDiffer(Ge.value,l.getCalendar()),Ce=he?{start:fe,duration:0}:{start:fe,duration:Math.max(1,ce(_e,fe))};p.$placeholder?l.exec("add-task",{task:{...Ce,text:n("New task"),type:"task"},eventSource:"placeholder"}):l.exec("update-task",{id:p.id,task:Ce}),g.value=null,re=!0,se()}}function P(){document.body.style.userSelect="none",ye.value&&(ye.value.style.cursor="")}function se(){document.body.style.userSelect="",ye.value&&(ye.value.style.cursor="")}function Be(r){if(!t.readonly){const S=z.locateID(r.target);if(S&&!r.target.classList.contains("wx-link")){const p=z.locateID(r.target,"data-segment");l.exec("show-editor",{id:S,...p!==null&&{segmentIndex:p}})}}}function Le(r){if(re){re=!1;return}const S=z.locateID(r.target);if(S){const p=r.target.classList;if(p.contains("wx-link")){const he=p.contains("wx-left");if(!q.value){pe=ue.value.auto?l.getLinkValidator():null,q.value={id:S,start:he};return}je(S,he)&&l.exec("add-link",{link:{source:q.value.id,target:S,type:dt(q.value.start,he)}})}else if(p.contains("wx-delete-button-icon"))l.exec("delete-link",{id:A.value}),A.value=null;else{const he=z.locateID(r.target,"data-segment");l.exec("select-task",{id:S,toggle:r.ctrlKey||r.metaKey,range:r.shiftKey,...he!==null&&{segmentIndex:he}})}}D()}function Ye(r){return`left:${r.$x}px;top:${r.$y}px;width:${r.$w}px;height:${r.$h}px;line-height:${r.$h}px;`}function st(r){return`left:${r.$x_base}px;top:${r.$y_base}px;width:${r.$w_base}px;height:${r.$h_base}px;`}function bt(r){return`left:${r.$x_slack}px;top:${r.$y}px;width:${r.$w_slack}px;height:${r.$h}px;`}function xt(r){return`left:${r.left}px;top:${r.y}px;width:${r.w}px;height:${r.h}px;`}function ut(r){return`left:${r.$x_deadline}px;top:${r.$y}px;height:${r.$h}px;`}function nt(r){return`left:${r.$x_constraint}px;top:${r.$y-2}px;height:${r.$h+4}px;`}function wt(r){return r==="mso"||r==="mfo"}function pt(r){return r==="snet"||r==="fnet"||r==="mso"}function _t(r){if(le.value||oe)return r.preventDefault(),!1}const Bt=["e2s","s2s","e2e","s2e"];function dt(r,S){return Bt[(r?1:0)+(S?0:2)]}const $t=e.computed(()=>{if(!q.value)return null;const r=new Map;return _.value.forEach(S=>{S.source===q.value.id&&(r.has(S.target)||r.set(S.target,new Set),r.get(S.target).add(S.type))}),r});function b(r,S){if(r===q.value.id)return!0;const p=dt(q.value.start,S);return!!$t.value.get(r)?.has(p)}function D(){q.value&&(q.value=null,pe=null)}function U(r){A.value=r}const $e=e.computed(()=>x.value.map(r=>r.id));function Q(r){let S=$e.value.includes(r)?r:"task";return["task","milestone","summary"].includes(r)||(S=`task ${S}`),S}function be(r){l.exec(r.action,r.data)}const ge=e.computed(()=>E.value.length&&ye.value&&ye.value.contains(document.activeElement)),We=e.computed(()=>ge.value&&E.value[E.value.length-1].id),at=s.subscribe(C);e.watch(at,r=>{if(r&&(!r.section||r.section==="chart")){const{id:S}=r,p=ye.value?.querySelector(`.wx-bar[data-id='${z.setID(S)}']`);p&&p.focus()}});const ze=r=>ne.value&&r.critical;function je(r,S){if(!q.value)return!0;if(b(r,S))return!1;if(!pe)return!0;const p=dt(q.value.start,S);return!pe({source:q.value.id,target:r,type:p})}let St;return e.onMounted(()=>{window.addEventListener("mouseup",tt),ye.value&&(ve.value=ye.value.offsetWidth,St=new ResizeObserver(r=>{for(const S of r)ve.value=S.target.offsetWidth}),St.observe(ye.value))}),e.onUnmounted(()=>{window.removeEventListener("mouseup",tt),St?.disconnect()}),(r,S)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:ye,class:"wx-bars",style:e.normalizeStyle(`line-height: ${ee.value.length?ee.value[0].$h:0}px`),onContextmenu:_t,onMousedown:De,onMousemove:Je,onTouchstart:Ue,onTouchmove:it,onTouchend:ot,onClick:Le,onDblclick:Be,onDragstart:S[0]||(S[0]=e.withModifiers(()=>{},["prevent"]))},[e.unref(we)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(ee.value,p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.id},[p.$visibleSlack?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass("wx-slack wx-slack-"+p.type),style:e.normalizeStyle(bt(p))},null,6)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0),e.createVNode(Un,{onSelectLink:U,selectedLink:h.value,readonly:t.readonly},null,8,["selectedLink","readonly"]),g.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["wx-bar","wx-"+(g.value.task?.type||"task"),"wx-schedule-task"]),style:e.normalizeStyle(xt(g.value))},null,6)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ee.value,p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.id},[p.$skip?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wx-bar","wx-"+Q(p.type),{"wx-touch":le.value&&de.value&&p.id===de.value.id,"wx-selected":q.value&&q.value.id===p.id,"wx-critical":ze(p),"wx-reorder-task":p.$reorder,"wx-split":e.unref(W)&&p.segments,"wx-manual":e.unref(ue)?.auto&&p.manual,"wx-inactive":e.unref(Ve)&&p.inactive,"wx-no-working-time":p.$noWorkingTime}]),style:e.normalizeStyle(Ye(p)),"data-id":e.unref(z.setID)(p.id),"data-task-id":e.unref(z.setID)(p.id),tabindex:We.value===p.id?"0":"-1"},[!t.readonly&&!J.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[p.id===h.value?.target&&h.value?.type[2]==="s"?(e.openBlock(),e.createBlock(e.unref(xe.Button),{key:0,type:"danger",css:"wx-left wx-delete-button wx-delete-link"},{default:e.withCtx(()=>[...S[1]||(S[1]=[e.createElementVNode("i",{class:"wxi-close wx-delete-button-icon"},null,-1)])]),_:1})):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["wx-link","wx-left",{"wx-visible":q.value,"wx-target":je(p.id,!0),"wx-selected":q.value&&q.value.id===p.id&&q.value.start,"wx-critical":ze(p)}])},[...S[2]||(S[2]=[e.createElementVNode("div",{class:"wx-inner"},null,-1)])],2))],64)):e.createCommentVNode("",!0),p.type!=="milestone"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[p.progress&&!(e.unref(W)&&p.segments)?(e.openBlock(),e.createElementBlock("div",aa,[e.createElementVNode("div",{class:"wx-progress-percent",style:e.normalizeStyle("width:"+p.progress+"%")},null,4)])):e.createCommentVNode("",!0),!t.readonly&&!(e.unref(W)&&p.segments)&&!(p.type==="summary"&&e.unref(me)?.autoProgress)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"wx-progress-marker",style:e.normalizeStyle("left:calc("+p.progress+"% - 10px);")},e.toDisplayString(p.progress),5)):e.createCommentVNode("",!0),t.taskTemplate?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.taskTemplate),{key:2,data:p,api:e.unref(l),onaction:be},null,8,["data","api"])):e.unref(W)&&p.segments?(e.openBlock(),e.createBlock(ta,{key:3,task:p,type:Q(p.type)},null,8,["task","type"])):(e.openBlock(),e.createElementBlock("div",la,e.toDisplayString(p.text||""),1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[S[3]||(S[3]=e.createElementVNode("div",{class:"wx-content"},null,-1)),t.taskTemplate?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.taskTemplate),{key:0,data:p,api:e.unref(l),onaction:be},null,8,["data","api"])):(e.openBlock(),e.createElementBlock("div",oa,e.toDisplayString(p.text),1))],64)),!t.readonly&&!J.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[p.id===h.value?.target&&h.value?.type[2]==="e"?(e.openBlock(),e.createBlock(e.unref(xe.Button),{key:0,type:"danger",css:"wx-right wx-delete-button wx-delete-link"},{default:e.withCtx(()=>[...S[4]||(S[4]=[e.createElementVNode("i",{class:"wxi-close wx-delete-button-icon"},null,-1)])]),_:1})):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["wx-link","wx-right",{"wx-visible":q.value,"wx-target":je(p.id,!1),"wx-selected":q.value&&q.value.id===p.id&&!q.value.start,"wx-critical":ze(p)}])},[...S[5]||(S[5]=[e.createElementVNode("div",{class:"wx-inner"},null,-1)])],2))],64)):e.createCommentVNode("",!0)],14,na)),e.unref(ae)&&e.unref(te)?.[p.id]?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(te)[p.id],he=>(e.openBlock(),e.createBlock(Kn,{key:he.id,rollup:he,parent:p},null,8,["rollup","parent"]))),128)):e.createCommentVNode("",!0),e.unref($)&&!p.$skip_baseline?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["wx-baseline",{"wx-milestone":p.type==="milestone"}]),style:e.normalizeStyle(st(p))},null,6)):e.createCommentVNode("",!0),e.unref(Me)&&p.deadline&&typeof p.$x_deadline=="number"?(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(["wx-deadline",{"wx-overdue":p.$overdue}]),style:e.normalizeStyle(ut(p))},[e.createElementVNode("i",{class:"wxi-flag","data-deadline":p.id},null,8,sa)],6)):e.createCommentVNode("",!0),p.constraint&&typeof p.$x_constraint=="number"?(e.openBlock(),e.createElementBlock("div",{key:4,class:e.normalizeClass(["wx-constraint","wx-constraint-"+p.constraint.type,{"wx-start":pt(p.constraint.type),"wx-end":!pt(p.constraint.type),"wx-violated":Te.value?.has(p.$id||p.id),"wx-compact":Ie(p)}]),style:e.normalizeStyle(nt(p)),"data-constraint-id":e.unref(z.setID)(p.id)},[e.createElementVNode("span",ca,e.toDisplayString(p.constraint.type.toUpperCase()),1),S[6]||(S[6]=e.createElementVNode("span",{class:"wx-constraint-line"},null,-1)),wt(p.constraint.type)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",ia))],14,ra)):e.createCommentVNode("",!0)],64))),128))],36))}}),fa=ie(da,[["__scopeId","data-v-530ed83a"]]),ma={__name:"TimeScale",props:{api:{}},setup(a){const t=a,{_scales:n,xArea:l,highlightTime:o}=t.api.getReactiveState(),c=s.subscribe(n),u=s.subscribe(l),f=s.subscribe(o);function i(d,w,B){const C=d.cells;let m=0,R=C.length,K=0;for(let M=0;M<C.length;M++){if(K+C[M].width>w){R=M,m=K;break}K+=C[M].width}let L=R;for(;L<C.length&&K<B;)K+=C[L].width,L++;return{from:m,slice:C.slice(R,L)}}const v=e.computed(()=>{const d=c.value.rows,w=d.length-1;return d.map((B,C)=>C===w?{height:B.height,from:u.value.from,slice:B.cells.slice(u.value.start,u.value.end)}:{height:B.height,...i(B,u.value.from,u.value.to)})});return(d,w)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-scale",style:e.normalizeStyle({width:e.unref(c).width+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(B,C)=>(e.openBlock(),e.createElementBlock("div",{key:C,class:"wx-row",style:e.normalizeStyle({height:B.height+"px",paddingLeft:B.from+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.slice,(m,R)=>(e.openBlock(),e.createElementBlock("div",{key:R,class:e.normalizeClass(["wx-cell",m.css,e.unref(f)?e.unref(f)(m.date,m.unit):""]),style:e.normalizeStyle({width:m.width+"px"})},[e.createElementVNode("span",{class:e.normalizeClass({"wx-cell-value":m.width>100})},e.toDisplayString(m.value),3)],6))),128))],4))),128))],4))}},Qt=ie(ma,[["__scopeId","data-v-b58c6a1c"]]),pa=["width","height"],va=["points"],ga=["data-scurve-line","data-scurve-index"],ha=["cx","cy"],ka=["cx","cy"],ya=Object.assign({name:"GanttChartSCurve"},{__name:"SCurve",setup(a){const t=e.inject("gantt-store"),{_sCurvePoints:n,_chartHeight:l,_scales:o,scrollTop:c}=t.getReactiveState(),u=s.subscribe(n),f=s.subscribe(l),i=s.subscribe(o),v=s.subscribe(c);function d(w){return w.css||`wx-scurve-${w.type}-${w.metric}`}return(w,B)=>e.unref(u)?.length?(e.openBlock(),e.createElementBlock("svg",{key:0,class:"wx-scurve",style:e.normalizeStyle(`top:${e.unref(v)}px`),width:e.unref(i).width,height:e.unref(f)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u),C=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:C.line},[e.createElementVNode("polyline",{class:e.normalizeClass(["wx-scurve-line",d(C)]),points:C.path},null,10,va),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.points,m=>(e.openBlock(),e.createElementBlock("g",{key:m.index,class:"wx-scurve-point","data-scurve-line":C.line,"data-scurve-index":m.index},[e.createElementVNode("circle",{class:"wx-scurve-hit",cx:m.x,cy:m.y,r:"10"},null,8,ha),e.createElementVNode("circle",{class:e.normalizeClass(["wx-scurve-dot",d(C)]),cx:m.x,cy:m.y,r:"4"},null,10,ka)],8,ga))),128))],64))),128))],12,pa)):e.createCommentVNode("",!0)}}),ba=ie(ya,[["__scopeId","data-v-c3643d27"]]),Gt=.003;function xa(a,t,n){return Math.max(Math.min(a,n),t)}function Jt(a,t,n){let l=!1,o=performance.now();function c(u){const i=Math.abs(u)<50?.004:.01,v=performance.now(),d=Math.min(v-o,50);o=v;const w=xa(-u*i,-Gt*d,Gt*d);return Math.exp(w)}return function(f){if(t()&&(f.ctrlKey||f.metaKey)){f.preventDefault();const i=c(f.deltaY),v=f.clientX-n().getBoundingClientRect().left;l||(l=!0,requestAnimationFrame(()=>{a.exec("zoom-scale",{dir:i>1?1:-1,ratio:Math.abs(1-i),offset:v}),l=!1}))}}}const wa={class:"wx-content"},_a={key:0,class:"wx-gantt-holidays",style:{height:"100%"}},Ba=["data-id"],$a=["width","height"],Sa=["points"],Wt=1,Ca=Object.assign({name:"GanttChartChart"},{__name:"Chart",props:{readonly:{},fullWidth:{},fullHeight:{},taskTemplate:{}},setup(a){const t=s.asDirective(yt.hotkeys),n=a,l=e.inject("gantt-store"),{_selected:o,scrollTop:c,scrollLeft:u,cellHeight:f,_tasks:i,resources:v,_scales:d,area:w,groupBy:B,xArea:C,zoom:m,_markers:R,_progressLinePoints:K,highlightTime:L,schedule:M}=l.getReactiveState(),V=s.subscribe(o,!0),F=s.subscribe(c),Z=s.subscribe(u),k=s.subscribe(f),y=s.subscribe(d),I=s.subscribe(m),O=s.subscribe(R),G=s.subscribe(i),_=s.subscribe(v),N=s.subscribe(w),X=s.subscribe(B),x=s.subscribe(C),$=s.subscribe(K),E=s.subscribe(L),ae=s.subscribe(M),te=e.ref(0),ne=e.ref(null),ue=e.computed(()=>{const ee=[];return V.value.length&&k.value&&V.value.forEach(J=>{ee.push(`height: ${k.value}px;top: ${J.$y-3}px`)}),ee});e.watch([F,te,k],()=>{we()});const W=e.computed(()=>Math.max(te.value,n.fullHeight));e.watchEffect(()=>{W.value,te.value,ne.value&&(ne.value.scrollTop=F.value,ne.value.scrollLeft=Z.value)});function me(){ne.value.scrollLeft!==Z.value&&l.exec("scroll-chart",{left:ne.value.scrollLeft})}function we(){const ee=te.value||0;if(!ee)return;const J=Math.ceil(ee/k.value)+1,H=Math.floor((F.value||0)/k.value),re=Math.max(0,H-Wt),q=H+J+Wt,pe=re*k.value;l.exec("render-data",{start:re,end:q,from:pe})}const Ee=Jt(l,()=>I.value,()=>ne.value);function Ne(ee){const J=E.value?.(ee.date,ee.unit);return J?{css:J,width:ee.width}:null}const Ve=e.computed(()=>E.value?y.value.rows[y.value.rows.length-1].cells.slice(x.value.start,x.value.end).map(Ne):null),Me=e.computed(()=>{const J=y.value.rows[y.value.rows.length-1]?.cells;return(y.value.minUnit==="hour"||y.value.minUnit==="day")&&J?J.slice(x.value.start,x.value.end):[]}),He=e.computed(()=>G.value.slice(N.value.start,N.value.end));function Re(ee){if(X.value?.field==="resource"){if(ee.$resource){const q=l.getResourceCalendar(ee);return q?[q]:[]}const H=ee.$groupValue;return H===void 0||H==="$ungrouped"?[]:(Array.isArray(H)?H:[H]).flatMap(q=>{const pe=_.value?.byId(q);if(!pe)return[];const de=l.getResourceCalendar(pe);return de?[de]:[]})}const J=ee.calendar||ae.value?.resourceCalendars?l.getTaskCalendar(ee):void 0;return J?[J]:[]}const Ge=e.computed(()=>{const ee=[],J=l.getCalendar();return He.value.forEach((H,re)=>{const q=Re(H);q.length&&Me.value.forEach((pe,de)=>{const g=q.filter(oe=>oe.noWorkingTime||!oe.isWorkingDay(pe.date)),j=g.length<q.length,A=J&&!J.isWorkingDay(pe.date),h={width:pe.width,height:k.value,left:(de+x.value.start)*pe.width,top:N.value.from+re*k.value};let le="";j||(le=["wx-weekend",...g.map(ve=>ve.css).filter(Boolean)].join(" ")),j&&A&&(le="wx-weekend-override"),le&&ee.push({...h,css:le})})}),ee});function Te(ee){ee.eventSource="chart",l.exec("hotkey",ee)}let Ie;return e.onMounted(()=>{ne.value&&(Ie=new ResizeObserver(ee=>{for(const J of ee)te.value=J.target.clientHeight}),Ie.observe(ne.value))}),e.onUnmounted(()=>{Ie?.disconnect()}),(ee,J)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:"wx-chart",tabindex:"-1",ref_key:"chart",ref:ne,onScroll:me,onWheel:J[0]||(J[0]=(...H)=>e.unref(Ee)&&e.unref(Ee)(...H))},[e.createVNode(Qt,{api:e.unref(l)},null,8,["api"]),e.unref(O).length?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-markers",style:e.normalizeStyle(`height:${W.value}px;`)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(O),H=>(e.openBlock(),e.createElementBlock("div",{key:H.id||H.left,class:e.normalizeClass("wx-marker "+(H.css||"")),style:e.normalizeStyle(`left:${H.left}px`)},[e.createElementVNode("div",wa,e.toDisplayString(H.text),1)],6))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"wx-area",style:e.normalizeStyle(`width:${n.fullWidth}px;height:${W.value}px`)},[Ve.value?(e.openBlock(),e.createElementBlock("div",_a,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ve.value,(H,re)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:re},[H?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(H.css),style:e.normalizeStyle(`width: ${H.width}px; left:${e.unref(x).from+re*H.width}px`)},null,6)):e.createCommentVNode("",!0)],64))),128))])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ge.value,(H,re)=>(e.openBlock(),e.createElementBlock("div",{key:re,class:e.normalizeClass(H.css),style:e.normalizeStyle(`position: absolute; pointer-events: none; width:${H.width}px; height:${H.height}px; left:${H.left}px; top:${H.top}px`)},null,6))),128)),e.unref(V).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(V),(H,re)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:H.id},[H.$y?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-selected","data-id":e.unref(z.setID)(H.id),style:e.normalizeStyle(ue.value[re])},null,12,Ba)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0),e.createVNode(Hn),e.unref($)?(e.openBlock(),e.createElementBlock("svg",{key:2,class:"wx-progress-line",width:n.fullWidth,height:W.value||0},[e.createElementVNode("polyline",{class:"wx-progress-line-path",points:e.unref($)},null,8,Sa)],8,$a)):e.createCommentVNode("",!0),e.createVNode(fa,{readonly:n.readonly,taskTemplate:n.taskTemplate},null,8,["readonly","taskTemplate"]),e.createVNode(ba)],4)],32)),[[e.unref(t),{keys:{arrowup:!0,arrowdown:!0},exec:H=>Te(H)}]])}}),Ea=ie(Ca,[["__scopeId","data-v-aa4dc461"]]),Ta={class:"wx-button-expand-box"},Ra=Object.assign({name:"GanttResizer"},{__name:"Resizer",props:{side:{default:"left"},layout:{default:"both"},draggable:{type:Boolean,default:!1},hideButtonsUntilHover:{type:Boolean,default:!1},startButton:{default:null},endButton:{default:null},panelWidth:{default:0},resizeInvert:{type:Boolean,default:!1},onResize:{type:Function},onResizeStart:{type:Function},onResizeEnd:{type:Function},onExpandStart:{type:Function},onExpandEnd:{type:Function}},setup(a){const t=a,n=e.computed(()=>t.draggable?"ew-resize":"auto");let l=0,o,c=null;function u(m){const R=m.clientX-l;return t.resizeInvert?o-R:o+R}function f(m){t.draggable&&(l=m.clientX,o=c=t.panelWidth,t.onResizeStart?.(),document.body.style.cursor=n.value,document.body.style.userSelect="none",window.addEventListener("mousemove",i),window.addEventListener("mouseup",w))}function i(m){c=u(m),t.onResize?.(c)}function v(){document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",w)}function d(m){c=null,v(),t.onResizeEnd?.(m)}function w(m){d(u(m))}e.onUnmounted(()=>{c!=null?d(c):v()});function B(m){t.onExpandStart?.(m)}function C(m){t.onExpandEnd?.(m)}return(m,R)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wx-resizer",`wx-resizer-${a.side}`,`wx-resizer-layout-${a.layout}`,{"wx-resizer-grip-hover":a.hideButtonsUntilHover}]),onMousedown:f,style:e.normalizeStyle(`cursor:${n.value};`)},[e.createElementVNode("div",Ta,[a.startButton?.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wx-button-expand-content",`wx-button-expand-${a.startButton.side}`])},[e.createElementVNode("i",{class:e.normalizeClass(`wxi-menu-${a.startButton.icon}`),onClick:B},null,2)],2)):e.createCommentVNode("",!0),a.endButton?.visible?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["wx-button-expand-content",`wx-button-expand-${a.endButton.side}`])},[e.createElementVNode("i",{class:e.normalizeClass(`wxi-menu-${a.endButton.icon}`),onClick:C},null,2)],2)):e.createCommentVNode("",!0)])],38))}}),Tt=ie(Ra,[["__scopeId","data-v-9b3ff1d1"]]);function Rt(a,t,n=!1){if(a==="subGrid"){const v=t.includes("subGrid"),d=t.includes("chart"),w=v&&d;return{layout:v||n?"both":"collapsed",draggable:w,hideButtonsUntilHover:w&&!n,startButton:{icon:"left",side:"left",visible:w||!v&&(d||n)},endButton:{icon:"right",side:"right",visible:w||n}}}const l=t.includes("grid"),o=t.includes("chart"),c=t.includes("subGrid"),u=l&&o,f=l&&c&&!o;return{layout:u||f?"both":l?"start":"end",draggable:!n&&(u||f),hideButtonsUntilHover:u,startButton:{icon:"left",side:"left",visible:l},endButton:{icon:"right",side:"right",visible:o||!l||f}}}const Ia={tabindex:"0",class:"wx-layout"},Na=Object.assign({name:"GanttLayout"},{__name:"Layout",props:e.mergeModels({taskTemplate:{},readonly:{}},{tableAPI:{},tableAPIModifiers:{},subGridTableAPI:{},subGridTableAPIModifiers:{}}),emits:["update:tableAPI","update:subGridTableAPI"],setup(a){const t=s.asDirective(yt.hotkeys),n=e.useModel(a,"tableAPI"),l=e.useModel(a,"subGridTableAPI"),o=e.ref(void 0),c=e.inject("gantt-store"),{_tasks:u,_scales:f,cellHeight:i,_columns:v,scrollTop:d,undo:w,_columnsWidth:B,gridWidth:C,subGridWidth:m,_displayPanels:R,_compactMode:K}=c.getReactiveState(),L=s.subscribe(u),M=s.subscribe(f),V=s.subscribe(i),F=s.subscribe(v),Z=s.subscribe(d),k=s.subscribe(w),y=s.subscribe(B),I=s.subscribe(C),O=s.subscribe(m),G=s.subscribe(R),_=s.subscribe(K),N=e.computed(()=>F.value.some(g=>g.section==="subGrid")),X=e.ref(null),x=e.computed(()=>X.value?.panels??G.value),$=e.computed(()=>G.value.includes("subGrid")),E=e.computed(()=>G.value.includes("chart")),ae=e.computed(()=>N.value&&(E.value||X.value?.section==="subGrid")),te=e.computed(()=>N.value&&E.value?8:4),ne=e.computed(()=>$.value?O.value:0),ue=e.computed(()=>Rt("gridChart",x.value,_.value)),W=e.computed(()=>Rt("subGrid",x.value,_.value)),me=e.ref(void 0),we=e.ref(void 0),Ee=e.computed(()=>o.value-we.value),Ne=e.computed(()=>M.value.width),Ve=e.computed(()=>L.value.length*V.value),Me=e.computed(()=>M.value.height+Ve.value+Ee.value);function He(g){X.value={section:g,panels:[...G.value]}}function Re(g,j,A){c.exec("resize-grid",{width:j,section:g,inProgress:!A}),A&&(X.value=null)}function Ge(){c.exec("set-display-mode",{mode:T.toggleGridChart(G.value,"start",_.value)})}function Te(){c.exec("set-display-mode",{mode:T.toggleGridChart(G.value,"end",_.value)})}function Ie(){c.exec("set-display-mode",{mode:T.toggleChartSubGrid(G.value,"start",_.value)})}function ee(){c.exec("set-display-mode",{mode:T.toggleChartSubGrid(G.value,"end",_.value)})}e.watch(()=>{if(o.value==null||X.value)return null;const g=me.value!=null&&E.value?o.value-y.value-ne.value-te.value-Ee.value:0,j=me.value!=null?me.value-M.value.height:0;return{width:g,height:j,scrollSize:Ee.value,ganttWidth:o.value}},g=>{g&&c.exec("resize-chart",g)},{immediate:!0});const J=e.ref(null);function H(){c.exec("scroll-chart",{top:J.value.scrollTop})}function re(){J.value&&Z.value!==J.value.scrollTop&&(J.value.scrollTop=Z.value)}e.watchEffect(()=>{Z.value,re()});const q=e.ref(null);let pe;function de(){J.value&&(me.value=J.value.offsetHeight,o.value=J.value.offsetWidth),q.value&&(we.value=q.value.offsetWidth)}return e.onMounted(()=>{pe=new ResizeObserver(de),J.value&&pe.observe(J.value),q.value&&pe.observe(q.value),de()}),e.onUnmounted(()=>{pe?.disconnect()}),(g,j)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-gantt",ref_key:"ganttDiv",ref:J,onScroll:H},[e.createElementVNode("div",{ref_key:"pseudoRowsDiv",ref:q,class:"wx-pseudo-rows",style:e.normalizeStyle(`height:${Me.value}px;width:100%;`)},[e.createElementVNode("div",{class:"wx-stuck",style:e.normalizeStyle(`height:${me.value}px;width:${we.value}px;`)},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Ia,[e.unref(F).length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Mt,{readonly:a.readonly,tableAPI:n.value,"onUpdate:tableAPI":j[0]||(j[0]=A=>n.value=A)},null,8,["readonly","tableAPI"]),e.createVNode(Tt,e.mergeProps({side:"left",panelWidth:e.unref(I)},ue.value,{onResizeStart:()=>He("grid"),onResize:A=>Re("grid",A),onResizeEnd:A=>Re("grid",A,!0),onExpandStart:Ge,onExpandEnd:Te}),null,16,["panelWidth","onResizeStart","onResize","onResizeEnd"])],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["wx-content",{"wx-content-visible":E.value}])},[e.createVNode(Ea,{readonly:a.readonly,fullWidth:Ne.value,fullHeight:Ve.value,taskTemplate:a.taskTemplate},null,8,["readonly","fullWidth","fullHeight","taskTemplate"])],2),N.value&&ae.value?(e.openBlock(),e.createBlock(Tt,e.mergeProps({key:1,side:"right",panelWidth:e.unref(O),resizeInvert:!0},W.value,{onResizeStart:()=>He("subGrid"),onResize:A=>Re("subGrid",A),onResizeEnd:A=>Re("subGrid",A,!0),onExpandStart:Ie,onExpandEnd:ee}),null,16,["panelWidth","onResizeStart","onResize","onResizeEnd"])):e.createCommentVNode("",!0),N.value&&$.value?(e.openBlock(),e.createBlock(Mt,{key:2,section:"subGrid",readonly:a.readonly,tableAPI:l.value,"onUpdate:tableAPI":j[1]||(j[1]=A=>l.value=A)},null,8,["readonly","tableAPI"])):e.createCommentVNode("",!0)])),[[e.unref(t),{keys:{"ctrl+c":!0,"ctrl+v":!0,"ctrl+x":!0,"ctrl+d":!0,backspace:!0,"ctrl+z":e.unref(k),"ctrl+y":e.unref(k)},exec:A=>{A.isInput||e.unref(c).exec("hotkey",A)}}]])],4)],4)],544))}}),Va=ie(Na,[["__scopeId","data-v-3101d5c1"]]);function Da(a){return{year:"%Y",quarter:`${a("Q")} %Q`,month:"%M",week:`${a("Week")} %w`,day:"%M %j",hour:"%H:%i"}}function La(a,t){return typeof a=="function"?a:z.dateToString(a,t)}function en(a,t){return a.map(({format:n,...l})=>({...l,format:La(n,t)}))}function za(a,t){const n=Da(t);for(let l in n)n[l]=z.dateToString(n[l],a);return n}function Ha(a,t){if(!a||!a.length)return a;const n=z.dateToString("%d-%m-%Y",t);return a.map(l=>l.template?l:l.id==="start"||l.id==="end"?{...l,_template:o=>n(o),template:o=>n(o)}:l.id==="duration"?{...l,_template:o=>o,template:o=>o}:l)}function Ma(a,t){return a.levels?{...a,levels:a.levels.map(n=>({...n,scales:en(n.scales,t)}))}:a}const Ga=Object.assign({name:"GanttComponentsGantt"},{__name:"Gantt",props:{taskTemplate:{default:null},markers:{default:()=>[]},taskTypes:{default:()=>T.defaultTaskTypes},tasks:{default:()=>[]},selected:{default:()=>[]},activeTask:{default:null},links:{default:()=>[]},resources:{default:null},assignments:{default:()=>[]},scales:{default:()=>[{unit:"month",step:1,format:"%F %Y"},{unit:"day",step:1,format:"%j"}]},columns:{default:null},start:{default:null},end:{default:null},lengthUnit:{default:"day"},durationUnit:{default:"day"},inclusiveEnd:{type:Boolean,default:!1},cellWidth:{default:100},cellHeight:{default:38},scaleHeight:{default:36},gridWidth:{default:null},subGridWidth:{default:null},displayMode:{default:"all"},readonly:{type:Boolean,default:!1},cellBorders:{default:"full"},zoom:{type:[Boolean,Object,Array],default:!1},baselines:{type:[Boolean,Object],default:!1},rollups:{type:[Boolean,Object],default:!1},highlightTime:{type:Function,default:null},init:{type:Function,default:null},autoScale:{type:Boolean,default:!0},unscheduledTasks:{type:Boolean,default:!1},inactiveTasks:{type:Boolean,default:!1},placeholderRow:{type:Boolean,default:!1},criticalPath:{default:null},schedule:{default:()=>({type:"forward"})},projectStart:{default:null},projectEnd:{default:null},calendar:{default:null},calendars:{default:()=>[]},undo:{type:Boolean,default:!1},splitTasks:{type:Boolean,default:!1},summary:{default:null},slack:{type:Boolean,default:!1},groupBy:{default:null},wbs:{type:Boolean,default:!1},deadlines:{type:Boolean,default:!1},progressLine:{type:[Boolean,Date],default:!1},sCurve:{type:[Boolean,Array],default:!1}},setup(a,{expose:t}){const n=a,l=e.useAttrs(),o=new T.DataStore(s.writable),c={...rt.en,...lt.en};let u=e.inject("wx-i18n",null);u?u=u.extend(c,!0):u=z.locale(c),e.provide("wx-i18n",u);const{calendar:f}=u.getRaw(),i=e.computed(()=>T.getDefaultColumns({resources:!!n.resources,wbs:n.wbs})),v=e.computed(()=>{let W={zoom:Ma(n.zoom,f),scales:en(n.scales,f),columns:Ha(n.columns??i.value,f),links:n.links,cellWidth:n.cellWidth};return W.zoom&&(W={...W,...T.normalizeZoom(W.zoom,za(f,u.getGroup("gantt")),W.scales,n.cellWidth)}),W});let d=o.in;const w=/-/g;let B=new It.EventBusRouter((W,me)=>{const we="on"+W.replace(w,"");l[we]&&l[we](me)});d.setNext(B);const C=e.ref(void 0),m=e.ref(void 0),R=o.getState.bind(o),K=o.getReactive.bind(o),L=()=>({data:o}),M=d.exec,V=W=>B=B.setNext(W),F=d.intercept.bind(d),Z=d.on.bind(d),k=d.detach.bind(d),y=W=>o.getTask(W),I=W=>o.getResource(W),O=W=>o.serialize(W),G=(W,me="grid")=>{const we=()=>me==="subGrid"?m.value:C.value;return W?new Promise(Ee=>setTimeout(()=>Ee(we()),1)):we()},_=()=>o.getHistory(),N=W=>o.getCalendar(W),X=W=>o.getTaskCalendar(W),x=W=>o.getResourceCalendar(W),$=W=>o.getTaskResources(W),E=W=>o.getResourceTasks(W),ae=()=>o.getLinkValidator(),te={getState:R,getReactiveState:K,getStores:L,exec:M,setNext:V,intercept:F,on:Z,detach:k,getTable:G,getTask:y,getResource:I,serialize:O,getHistory:_,getCalendar:N,getTaskResources:$,getResourceTasks:E,getTaskCalendar:X,getResourceCalendar:x,getLinkValidator:ae};t({getState:R,getReactiveState:K,getStores:L,exec:M,setNext:V,intercept:F,on:Z,detach:k,getTable:G,getTask:y,getResource:I,serialize:O,getHistory:_,getCalendar:N,getTaskResources:$,getResourceTasks:E,getTaskCalendar:X,getResourceCalendar:x,getLinkValidator:ae}),e.provide("gantt-store",{getReactiveState:o.getReactive.bind(o),getState:o.getState.bind(o),exec:d.exec.bind(d),on:d.on.bind(d),detach:d.detach.bind(d),getTask:o.getTask.bind(o),getTaskCalendar:o.getTaskCalendar.bind(o),getResourceCalendar:o.getResourceCalendar.bind(o),getCalendar:o.getCalendar.bind(o),getTaskResources:o.getTaskResources.bind(o),getHistory:o.getHistory.bind(o),getLinkValidator:o.getLinkValidator.bind(o)});let ne=!0;const ue=()=>{const W=v.value;o.init({tasks:n.tasks,links:W.links,resources:n.resources,assignments:n.assignments,start:n.start,columns:W.columns,end:n.end,lengthUnit:n.lengthUnit,cellWidth:W.cellWidth,cellHeight:n.cellHeight,scaleHeight:n.scaleHeight,scales:W.scales,taskTypes:n.taskTypes,zoom:W.zoom,selected:n.selected,activeTask:n.activeTask,baselines:n.baselines,rollups:n.rollups===!0?{type:"closest"}:n.rollups,autoScale:n.autoScale,unscheduledTasks:n.unscheduledTasks,inactiveTasks:n.inactiveTasks,placeholderRow:n.placeholderRow&&!n.readonly,markers:n.markers,durationUnit:n.durationUnit,inclusiveEnd:n.inclusiveEnd,criticalPath:n.criticalPath,schedule:n.schedule,projectStart:n.projectStart,projectEnd:n.projectEnd,calendar:n.calendar,calendars:n.calendars,slack:n.slack,undo:n.undo,_weekStart:f.weekStart,splitTasks:n.splitTasks,deadlines:n.deadlines,summary:n.summary,groupBy:n.groupBy,highlightTime:n.highlightTime,wbs:n.wbs,progressLine:n.progressLine,cellBorders:n.cellBorders,sCurve:n.sCurve,displayMode:n.displayMode,...n.gridWidth!=null?{gridWidth:n.gridWidth}:{},...n.subGridWidth!=null?{subGridWidth:n.subGridWidth}:{}}),ne&&n.init&&(n.init(te),ne=!1)};return e.watchEffect(ue),(W,me)=>(e.openBlock(),e.createBlock(Va,{taskTemplate:n.taskTemplate,readonly:n.readonly,tableAPI:C.value,"onUpdate:tableAPI":me[0]||(me[0]=we=>C.value=we),subGridTableAPI:m.value,"onUpdate:subGridTableAPI":me[1]||(me[1]=we=>m.value=we)},null,8,["taskTemplate","readonly","tableAPI","subGridTableAPI"]))}}),Wa=Object.assign({name:"GanttToolbar"},{__name:"Toolbar",props:{api:{default:null},items:{default:()=>[]}},setup(a){const t=a;let n=e.inject("wx-i18n",null);n||(n=z.locale(lt.en),e.provide("wx-i18n",n));const l=n.getGroup("gantt"),o=s.subscribeLater(()=>t.api?.getReactiveState()?._selected),c=s.subscribeLater(()=>t.api?.getReactiveState()?.undo),u=s.subscribeLater(()=>t.api?.getReactiveState()?.history),f=s.subscribeLater(()=>t.api?.getReactiveState()?.splitTasks),i=s.subscribeLater(()=>t.api?.getReactiveState()?.groupBy),v=s.subscribeLater(()=>t.api?.getReactiveState()?.conflicts),d=s.subscribeLater(()=>t.api?.getReactiveState()?.showConflicts),w=s.subscribeLater(()=>t.api?.getReactiveState()?.schedule),B=["undo","redo"],C=e.computed(()=>{const R=T.getToolbarButtons({undo:!0,splitTasks:!0,conflicts:!0});return(t.items.length?t.items:T.getToolbarButtons({undo:c().value,splitTasks:f().value,group:!!i().value?.field,conflicts:w().value?.auto})).map(L=>(L={...L,disabled:!1},L.id==="show-conflicts"&&(v().value?.length&&(L.css=L.css?`${L.css} wx-conflicts`:"wx-conflicts"),d().value&&(L.type="pressed")),L.handler=T.isHandledAction(R,L.id)?M=>T.handleAction(t.api,M.id,null,l):L.handler,L.text&&(L.text=l(L.text)),L.menuText&&(L.menuText=l(L.menuText)),L))}),m=e.computed(()=>{const R=o().value,K=[];C.value.forEach(M=>{const V=M.id;if(V==="add-task"||!B.includes(V))if(!R?.length||R?.length===1&&T.isPlaceholder(R[0].id)||!t.api){if(V!=="add-task"&&V!=="show-conflicts")return;K.push(M)}else K.push({...M,disabled:M.isDisabled&&R.some(F=>M.isDisabled(F,t.api.getState(),t.api.getTaskCalendar(F)))});else B.includes(V)&&K.push({...M,disabled:M.isDisabled(u().value)})});const L=M=>{if(!t.api||!M.isHidden)return!1;const V=t.api.getState();return R?.length?R.some(F=>M.isHidden(F,V)):M.isHidden(null,V)};return K.filter((M,V)=>{if(L(M))return!1;if(M.comp==="separator"){const F=K.slice(V+1).find(Z=>!L(Z));if(!F||F.comp==="separator")return!1}return!0})});return(R,K)=>(e.openBlock(),e.createBlock(e.unref(Ot.Toolbar),{items:m.value},null,8,["items"]))}}),Aa=ie(Wa,[["__scopeId","data-v-e67d19d6"]]),Pa=["oncontextmenu"],Fa={__name:"ContextMenu",props:{options:{default:()=>[]},api:{default:null},resolver:{default:null},filter:{default:null},at:{default:"point"},onclick:{type:Function},css:{}},setup(a,{expose:t}){const n=a;let l=null,o=e.inject("wx-i18n",null);o||(o=z.locale({...lt.en,...rt.en}),e.provide("wx-i18n",o));const c=o.getGroup("gantt"),u=s.subscribeLater(()=>n.api?.getReactiveState()?.taskTypes),f=s.subscribeLater(()=>n.api?.getReactiveState()?.selected),i=s.subscribeLater(()=>n.api?.getReactiveState()?._selected),v=s.subscribeLater(()=>n.api?.getReactiveState()?.splitTasks),d=s.subscribeLater(()=>n.api?.getReactiveState()?.summary),w=s.subscribeLater(()=>n.api?.getReactiveState()?.groupBy),B=e.computed(()=>({splitTasks:v().value,taskTypes:u().value,summary:d().value,group:!!w().value?.field})),C=e.computed(()=>i().value??[]),m=e.computed(()=>T.getMenuOptions(B.value)),R=e.computed(()=>n.options.length?n.options:null),K=e.computed(()=>M(R.value??m.value));function L(_){return _.map(N=>{const X={...N};return N.data&&(X.data=L(N.data)),X})}function M(_){return _.map(N=>(N={...N},N.text&&(N.text=c(N.text)),N.subtext&&(N.subtext=c(N.subtext)),N.data&&(N.data=M(N.data)),N))}function V(){if(!n.api)return[];const _=L(K.value),N=X=>{X.forEach(x=>{x.isDisabled&&(x.disabled=C.value.some($=>x.isDisabled($,n.api.getState(),n.api.getTaskCalendar($),l))),x.data&&N(x.data)})};return N(_),_}function F(_,N){if(z.locate(N.target,"data-menu-ignore")?.classList.contains("wx-resource-load")||T.isPlaceholder(_))return null;let X=_?n.api.getTask(_):null;if(n.resolver){const x=n.resolver(_,N);X=x===!0?X:x}if(X){const x=z.locateID(N.target,"data-segment");x!==null?l={id:X.id,segmentIndex:x}:l=X.id,f().value.includes(X.id)||n.api.exec("select-task",{id:X.id}),I.value=V()}return X}function Z(_){const N=_.action;N&&(T.isHandledAction(m.value,N.id)&&T.handleAction(n.api,N.id,l,c),n.onclick&&n.onclick(_))}function k(_){if(!n.api)return!0;let N=n.filter?C.value.every(X=>n.filter(_,X)):!0;return N&&_.isHidden&&(N=!C.value.some(X=>_.isHidden(X,n.api.getState(),l))),N}let y=!1;e.watchEffect(()=>{n.api&&!y&&(y=!0,n.api.on("scroll-chart",()=>O.value.show()),n.api.on("drag-task",()=>O.value.show()))});const I=e.ref([]),O=e.ref(null);function G(_,N){I.value=V(),O.value.show(_,N)}return t({show:G}),(_,N)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(an.ContextMenu),{filter:k,options:I.value,dataKey:"id",resolver:F,onclick:Z,css:a.css,at:a.at,ref_key:"menu",ref:O},null,8,["options","css","at"]),e.createElementVNode("div",{style:{display:"contents"},oncontextmenu:O.value?.show,"data-menu-ignore":"true"},[e.renderSlot(_.$slots,"default",{},void 0,!0)],8,Pa)],64))}},Oa=ie(Fa,[["__scopeId","data-v-559029f6"]]),ja={__name:"GridSection",props:{columns:{},data:{},onaction:{type:Function},onedit:{type:Function},sizes:{},oninit:{type:Function}},setup(a){const t=a;function n(o){const c=z.locateID(o),u=o.target.dataset.action;u&&o.preventDefault(),c&&u&&t.onaction&&t.onaction(c,u)}function l(o){t.oninit&&t.oninit(o),o.on("update-cell",c=>{const{id:u,column:f,value:i}=c;t.onedit(u,f,i)})}return(o,c)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-table",onClick:n},[e.createVNode(e.unref(Ke.Grid),{init:l,columns:a.columns,data:a.data,select:!1,columnStyle:u=>`wx-editor-cell wx-text-${u.align} ${u.id==="delete"?"wx-action":""}`,sizes:a.sizes||{}},null,8,["columns","data","columnStyle","sizes"])]))}},Vt=ie(ja,[["__scopeId","data-v-011a009e"]]),Ua={class:"wx-wrapper"},qa={class:"wx-text"},Ya={key:0,class:"wxi-angle-down"},Ka={__name:"LinkTypeCell",props:{row:{},column:{},data:{}},setup(a){const t=a,n=e.computed(()=>t.data?t.data.label:t.column.options.find(l=>l.id===t.row.type)?.label||"");return(l,o)=>(e.openBlock(),e.createElementBlock("div",Ua,[e.createElementVNode("div",qa,e.toDisplayString(n.value),1),a.row?(e.openBlock(),e.createElementBlock("i",Ya)):e.createCommentVNode("",!0)]))}},At=ie(Ka,[["__scopeId","data-v-2569b653"]]),Xa={class:"wx-title"},Za={key:0,class:"wx-nodata"},Qa=Object.assign({name:"GanttEditorLinks",inheritAttrs:!1},{__name:"Links",props:{api:{},autoSave:{},onextchange:{type:Function},batch:{default:"links"},edits:{default:null}},setup(a){const t=e.inject("wx-i18n").getGroup("gantt"),n=a,{activeTask:l,links:o,tasks:c,schedule:u}=n.api.getReactiveState(),f=s.subscribe(l),i=s.subscribe(o,!0),v=s.subscribe(c),d=s.subscribe(u),w=e.ref();e.watchEffect(()=>{w.value=L()});const B=[{id:"e2s",label:t("End-to-start")},{id:"s2s",label:t("Start-to-start")},{id:"e2e",label:t("End-to-end")},{id:"s2e",label:t("Start-to-end")}];function C(k){const y=i.value.byId(k.id);if(!y)return B;const I=m(y,k.id),O=n.api.getLinkValidator();return B.filter(({id:G})=>G===k.type||!I.has(G)&&!O({...y,type:G}))}function m(k,y){const I=new Set;return w.value.forEach(O=>O.data.forEach(G=>{if(G.id===y)return;const _=i.value.byId(G.id);_?.source===k.source&&_.target===k.target&&I.add(G.type)})),I}const R=e.computed(()=>!d.value?.auto);function K(){return[{id:"taskText",header:t("Task name"),flexgrow:2},{id:"lag",header:t("Lag"),editor:{type:"text",config:{type:"number"}},flexgrow:1,hidden:R.value},{id:"type",header:t("Type"),width:124,options:B,editor:k=>({type:"richselect",config:{cell:At,options:C(k)}}),cell:At},{id:"delete",header:"",cell:mt,width:50,align:"center"}]}function L(){if(!f.value)return;const k=[],y=[],I=(O,G)=>({id:O.id,type:O.type,lag:O.lag,taskText:v.value.byId(G).text});return i.value.forEach(O=>{const G=n.edits?.get(O.id);if(G?.action==="delete-link")return;const _=G?{...O,...G.data.link}:O;_.target===f.value&&k.push(I(_,_.source)),_.source===f.value&&y.push(I(_,_.target))}),[{title:t("Predecessors"),data:k},{title:t("Successors"),data:y}]}function M(k){return{view:"links",event:k}}function V(k){n.autoSave?n.api.exec("delete-link",{id:k}):(w.value=w.value.map(y=>({...y,data:y.data.filter(I=>I.id!==k)})),n.onextchange?.(M({id:k,action:"delete-link",data:{id:k}})))}function F(k,y,I){y==="lag"&&I!==""&&(I=I*1);const O={[y]:I};n.autoSave?n.api.exec("update-link",{id:k,link:O}):(w.value=w.value.map(G=>({...G,data:G.data.map(_=>_.id===k?{..._,...O}:_)})),n.onextchange?.(M({id:k,action:"update-link",data:{id:k,link:O}})))}const Z=e.computed(()=>w.value&&!w.value[0].data.length&&!w.value[1].data.length);return(k,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wx-wrapper",{"wx-nobatch":a.batch!=="links"}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,I=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:I.title},[I.data.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Xa,e.toDisplayString(I.title),1),e.createVNode(Vt,{columns:K(),onaction:V,onedit:F,data:I.data,sizes:{rowHeight:44}},null,8,["columns","data"])],64)):e.createCommentVNode("",!0)],64))),128)),Z.value?(e.openBlock(),e.createElementBlock("div",Za,e.toDisplayString(e.unref(t)("No links")),1)):e.createCommentVNode("",!0)],2))}}),Ja=ie(Qa,[["__scopeId","data-v-daf54a72"]]),el={class:"date-time-controll"},tl=Object.assign({inheritAttrs:!1},{__name:"DateTimePicker",props:{value:{},time:{},format:{},onchange:{type:Function},buttons:{default:()=>["today"]},clear:{type:Boolean,default:void 0}},setup(a){const t=a,n=e.inject("wx-i18n").getGroup("gantt"),l=e.computed(()=>t.buttons.map(u=>n(u))),o=e.computed(()=>t.clear??t.buttons.includes("Unschedule"));function c(u){let f=u.value;f&&(f=new Date(u.value),t.value&&(f.setHours(t.value.getHours()),f.setMinutes(t.value.getMinutes()))),t.onchange?.({value:f})}return(u,f)=>(e.openBlock(),e.createElementBlock("div",el,[e.createVNode(e.unref(xe.DatePicker),e.mergeProps(u.$attrs,{value:a.value,onchange:c,format:a.format,buttons:l.value,clear:o.value}),null,16,["value","format","buttons","clear"]),a.time?(e.openBlock(),e.createBlock(e.unref(xe.TimePicker),{key:0,value:a.value,onchange:a.onchange,format:a.format},null,8,["value","onchange","format"])):e.createCommentVNode("",!0)]))}}),tn=ie(tl,[["__scopeId","data-v-6d884554"]]),nl={class:"wx-avatar"},al={class:"wx-text"},ll={class:"wx-name"},ol={key:0,class:"wx-role"},sl={__name:"ResourcesEditorCell",props:{row:{},data:{}},setup(a){const t=a,n=e.computed(()=>t.data||t.row);return(l,o)=>n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",nl,[e.createVNode(e.unref(xe.Avatar),{value:n.value,size:40},null,8,["value"])]),e.createElementVNode("div",al,[e.createElementVNode("div",ll,e.toDisplayString(n.value.name),1),n.value.role?(e.openBlock(),e.createElementBlock("div",ol,e.toDisplayString(n.value.role),1)):e.createCommentVNode("",!0)])],64)):e.createCommentVNode("",!0)}},Pt=ie(sl,[["__scopeId","data-v-28c145a1"]]),rl={class:"wx-section"},cl={key:1,class:"wx-nodata"},il={class:"wx-button-wrapper"},ul=Object.assign({name:"GanttEditorResources",inheritAttrs:!1},{__name:"Resources",props:{api:{},autoSave:{},onextchange:{type:Function},taskAssignments:{default:null}},setup(a){const n=e.inject("wx-i18n").getGroup("gantt"),l=a,o=l.onextchange,{activeTask:c,resources:u,_assignments:f,assignments:i}=l.api.getReactiveState(),v=s.subscribe(c),d=s.subscribe(u),w=s.subscribe(i),B=s.subscribe(f,!0),C=e.ref(void 0),m=e.ref(null),R=e.ref([]);e.watchEffect(()=>{B.value,R.value=l.taskAssignments||l.api.getTaskResources(v.value).map($=>({...$,resource:$.id,id:$.assignmentId}))});const K=e.computed(()=>{const $=[];return d.value?.eachChild(E=>{E.data||$.push({...E,label:E.name})},0),$}),L=e.computed(()=>K.value.filter($=>!R.value.find(E=>E.resource===$.id)));function M($){return{view:"resources",event:$,values:{taskAssignments:R.value}}}function V($){C.value.exec("close-editor",{ignore:!0}),l.autoSave?l.api.exec("delete-assignment",{id:$}):(R.value=R.value.filter(E=>E.id!==$),o&&o(M({id:$,action:"delete-assignment",data:{id:$}}))),m.value=null}function F($,E){const ae=v.value;E={...E,units:100,task:ae,id:$};const te={assignment:E};if(l.autoSave)l.api.exec("add-assignment",te);else{const ne=d.value?.byId(E.resource);R.value=[...R.value,{...ne,...E}],o&&o(M({id:ne.id,action:"add-assignment",data:te}))}}function Z($){return $.id===m.value?L.value:[K.value.find(ae=>ae.id===$.resource)].concat(L.value)}function k($,E){let ae=w.value?.byId($);ae||(ae=R.value.find(ne=>ne.id===$));const te={id:$,assignment:{units:ae.units||100,...E,id:$}};l.autoSave?l.api.exec("update-assignment",te):(E.resource&&E.resource!==ae.resource&&(E={...d.value?.byId(E.resource),...te.assignment}),R.value=R.value.map(ne=>ne.id===$?{...ne,...E}:ne),o&&o(M({id:$,action:"update-assignment",data:te})))}const y=e.computed(()=>(L.value,[{id:"resource",header:n("Resource"),cell:Pt,flexgrow:3,editor:$=>({type:"combo",config:{options:Z($),cell:Pt}}),options:K.value},{id:"units",header:n("Units"),flexgrow:1,editor:{type:"text",config:{type:"number"}},template:$=>`${$}%`},{id:"delete",header:"",cell:mt,width:50,align:"center"}]));function I($,E){$&&E==="delete"&&V($)}function O($,E,ae){if(E==="units")k($,{units:ae*1});else if(E==="resource"){const te={resource:ae};$===m.value?F($,te):k($,te)}m.value=null}function G($){C.value=$,C.value.on("close-editor",()=>{m.value&&(C.value.exec("delete-row",{id:m.value}),m.value=null)})}const _=e.computed(()=>m.value||!L.value.length);let N=!1;function X(){C.value?.exec("close-editor",{ignore:!0}),N||(N=!0,m.value=It.tempID(),requestAnimationFrame(()=>{x(m.value),N=!1}))}function x($){C.value.exec("add-row",{id:$,row:{units:100}}),setTimeout(()=>{C.value.exec("open-editor",{id:$,column:"resource"})})}return($,E)=>(e.openBlock(),e.createElementBlock("div",rl,[R.value.length||m.value?(e.openBlock(),e.createBlock(Vt,{key:0,oninit:G,columns:y.value,onaction:I,onedit:O,data:R.value,sizes:{rowHeight:52}},null,8,["columns","data"])):(e.openBlock(),e.createElementBlock("div",cl,e.toDisplayString(e.unref(n)("No assignments")),1)),e.createElementVNode("div",il,[e.createVNode(e.unref(xe.Button),{disabled:_.value,icon:"wxi-plus",css:"wx-button",onclick:X},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("Add resource")),1)]),_:1},8,["disabled"])])]))}}),dl=ie(ul,[["__scopeId","data-v-2bc34f9d"]]),fl={class:"wx-section"},ml={key:1,class:"wx-nodata"},pl=Object.assign({name:"GanttEditorSegments",inheritAttrs:!1},{__name:"Segments",props:{api:{},autoSave:{},segments:{},onextchange:{type:Function}},setup(a){const t=e.inject("wx-i18n"),n=t.getGroup("gantt"),l=t.getRaw(),o=l.gantt?.dateFormat||l.formats?.dateFormat,c=z.dateToString(o,l.calendar),u=a,f=u.onextchange,{_activeTask:i}=u.api.getReactiveState(),v=s.subscribe(i),d=e.ref([]);function w(){const V=v.value;return!V||u.segments===null?[]:u.segments?[...u.segments]:V?.segments?.map(F=>({...F,id:F.id||It.tempID()}))}e.watchEffect(()=>{v.value,d.value=w()});const B=e.computed(()=>[{id:"text",header:n("Name"),flexgrow:3,editor:"text"},{id:"start",header:n("Start"),flexgrow:2,template:V=>c(V),editor:"datepicker"},{id:"duration",header:n("Duration"),flexgrow:2,editor:{type:"text",config:{type:"number"}}},{id:"delete",header:"",cell:mt,width:50,align:"center"}]),C=e.ref(null);function m(V){C.value=V}function R(V){return{view:"segments",event:V,values:{segments:d.value.length?[...d.value]:null}}}function K(V){const F=d.value.findIndex(y=>y.id===V);d.value=d.value.filter((y,I)=>I!==F);const k={id:v.value.id,task:{segments:d.value.length?[...d.value]:null}};u.autoSave?u.api.exec("update-task",k):f&&f(R({id:V,action:"update-task",data:k}))}function L(V,F){F==="delete"&&K(V)}function M(V,F,Z){const{data:k}=C.value.getState();let y=k.findIndex(_=>_.id===V);F==="duration"&&(Z=Z*1);const I={...d.value[y],[F]:Z},O=v.value;T.prepareEditTask(I,u.api.getState(),u.api.getTaskCalendar(O),F);const G={id:O.id,segmentIndex:y,task:I};u.autoSave?u.api.exec("update-task",G):(d.value=d.value.map(_=>_.id===V?{..._,...I}:_),f&&f(R({id:V,action:"update-task",data:G})))}return(V,F)=>(e.openBlock(),e.createElementBlock("div",fl,[d.value.length?(e.openBlock(),e.createBlock(Vt,{key:0,columns:B.value,oninit:m,onaction:L,data:d.value,onedit:M},null,8,["columns","data"])):(e.openBlock(),e.createElementBlock("div",ml,e.toDisplayString(e.unref(n)("No segments")),1))]))}}),vl=ie(pl,[["__scopeId","data-v-f24f9d75"]]),gl={class:"wx-constraint-editor"},ft="none",hl=Object.assign({name:"GanttEditorConstraint",inheritAttrs:!1},{__name:"Constraint",props:{value:{},onchange:{type:Function},task:{},config:{}},setup(a){const t=a,n=e.inject("wx-i18n").getGroup("gantt"),l=[{id:ft,label:n("None")},...T.defaultConstraintTypes.map(v=>({...v,label:n(v.label)}))],o=v=>v==="fnlt"||v==="fnet"||v==="mfo",c=e.computed(()=>t.value?.type??ft);function u(v){return o(v)&&t.task?.type!=="milestone"?t.task?.end??t.task?.start:t.task?.start}function f(v){const d=v.value;if(d===ft)return t.onchange?.({value:null});const w=t.value?.date&&o(d)===o(c.value);t.onchange?.({value:{type:d,date:w?t.value.date:u(d)}})}function i(v){c.value===ft||!v.value||t.onchange?.({value:{type:c.value,date:v.value}})}return(v,d)=>(e.openBlock(),e.createElementBlock("div",gl,[e.createVNode(e.unref(xe.RichSelect),{options:l,value:c.value,onchange:f},null,8,["value"]),c.value!==ft?(e.openBlock(),e.createBlock(tn,{key:0,value:a.value?.date,onchange:i,format:a.config?.format},null,8,["value","format"])):e.createCommentVNode("",!0)]))}}),kl=ie(hl,[["__scopeId","data-v-c9e4e580"]]),ht="general",yl=Object.assign({name:"GanttEditor"},{__name:"Editor",props:{api:{default:null},items:{default:()=>[]},css:{default:""},layout:{default:"default"},readonly:{type:Boolean,default:!1},placement:{default:"sidebar"},bottomBar:{type:[Boolean,Object],default:!1},topBar:{type:[Boolean,Object],default:!0},autoSave:{type:Boolean,default:!0},focus:{type:Boolean,default:!1},hotkeys:{default:()=>({})}},setup(a){Pe.registerEditorItem("select",xe.RichSelect),Pe.registerEditorItem("date",tn),Pe.registerEditorItem("twostate",xe.TwoState),Pe.registerEditorItem("slider",xe.Slider),Pe.registerEditorItem("counter",xe.Counter),Pe.registerEditorItem("links",Ja),Pe.registerEditorItem("checkbox",xe.Checkbox),Pe.registerEditorItem("resources",dl),Pe.registerEditorItem("segments",vl),Pe.registerEditorItem("constraint",kl),Ot.registerToolbarItem("tabs",xe.Tabs);const t=a;let n=e.inject("wx-i18n",null);n||(n=z.locale({...lt.en,...rt.en}),e.provide("wx-i18n",n));const l=n.getGroup("gantt"),o=n.getRaw(),c=o.gantt?.dateFormat||o.formats?.dateFormat,u=z.dateToString(c,o.calendar),f=s.subscribeLater(()=>t.api?.getReactiveState()?._activeTask),i=s.subscribeLater(()=>t.api?.getReactiveState()?.activeTask),v=s.subscribeLater(()=>t.api?.getReactiveState()?.unscheduledTasks),d=s.subscribeLater(()=>t.api?.getReactiveState()?.inactiveTasks),w=s.subscribeLater(()=>t.api?.getReactiveState()?.rollups),B=s.subscribeLater(()=>t.api?.getReactiveState()?.summary),C=s.subscribeLater(()=>t.api?.getReactiveState()?.links),m=s.subscribeLater(()=>t.api?.getReactiveState()?.splitTasks),R=s.subscribeLater(()=>t.api?.getReactiveState()?.taskTypes),K=s.subscribeLater(()=>t.api?.getReactiveState()?.resources??null),L=s.subscribeLater(()=>t.api?.getReactiveState()?.schedule),M=s.subscribeLater(()=>t.api?.getReactiveState()?._compactMode),V=s.subscribeLater(()=>t.api?.getReactiveState()?.deadlines),F=s.subscribeLater(()=>t.api?.getReactiveState()?.criticalPath),Z=s.subscribeLater(()=>t.api?.getReactiveState()?.inclusiveEnd),k=s.subscribeLater(()=>t.api?.getReactiveState()?.undo),y=e.ref(ht),I=e.computed(()=>M().value?"wx-full-screen":""),O=e.computed(()=>T.getEditorItems({unscheduledTasks:v().value,inactiveTasks:d().value,rollups:w().value,summary:B().value,taskTypes:R().value,resources:K().value,splitTasks:m().value,deadlines:V().value,schedule:L().value,criticalPath:F().value})),G=e.shallowRef(new Map);let _=null;const N=e.shallowRef(new Map),X=e.shallowRef(new Map),x=e.ref(null),$=e.ref(void 0),E=e.ref(null),ae={taskAssignments:null},te=e.ref({...ae}),ne=e.computed(()=>{const g=f().value;if(!g)return null;const j={...g};if(t.readonly){let A={parent:j.parent};const h=Z().value?T.toInclusiveTask(j,t.api.getTaskCalendar(j)):j;return O.value.forEach(({key:le,comp:oe})=>{if(oe!=="links"&&oe!=="resources"){const ve=h[le];if(oe==="date"&&ve instanceof Date)A[le]=u(ve);else if(oe==="slider"&&le==="progress")A[le]=`${ve}%`;else if(oe==="constraint"){const ye=T.defaultConstraintTypes.find(De=>De.id===ve?.type);A[le]=ye?`${l(ye.label)}: ${u(ve.date)}`:""}else A[le]=ve}}),A}return Z().value?T.toInclusiveTask(j,t.api.getTaskCalendar(j)):j}),ue=e.shallowRef(null);e.watchEffect(()=>{$.value=ne.value;const g=f().value;ue.value=g?{...g}:null}),e.watch(i,()=>{G.value=new Map,_=null,N.value=new Map,X.value=new Map,E.value=null,x.value=null,y.value||(y.value=ht),te.value={...ae}});function W(g,j="form"){return!t.api||!g||!Array.isArray(g)?g:g.filter(A=>ue.value?!A.isHidden||!A.isHidden(ue.value,t.api.getState()):!0).map(A=>{const h={...A};return h.items&&Array.isArray(h.items)?(h.items=W(h.items),h):(j==="form"&&!h.batch&&(h.batch=ht),["links","resources","segments"].includes(h.key)&&t.api&&(h.api=t.api,h.autoSave=t.autoSave,h.key==="resources"?h.taskAssignments=te.value.taskAssignments:h.key==="links"?t.autoSave||(h.edits=G.value):h.key==="segments"&&(h.segments=te.value.segments),h.onextchange=He),h.key==="constraint"&&(h.task=$.value),h.id==="tabs"&&(h.api=t.api,h.css="wx-gantt-tabs",h.value=y.value,h.onchange=h.onchange||de),h.comp==="slider"&&h.key==="progress"&&(h.labelTemplate=le=>`${l(h.label)} ${le}%`),h.text&&(h.text=l(h.text)),h.label&&(h.label=l(h.label)),h.options&&(h.options=W(h.options)),h.config&&(h.config={...h.config}),h.config?.placeholder&&(h.config.placeholder=l(h.config.placeholder)),h.comp==="date"&&t.api&&(h.config={...h.config},h.config.buttons=T.getDateEditorButtons(h.key,v().value).map(le=>l(le))),ue.value&&h.isDisabled&&h.isDisabled(ue.value,t.api.getState(),t.api.getTaskCalendar(ue.value))?h.disabled=!0:delete h.disabled,h)})}const me=e.computed(()=>{const g=t.items.length?t.items:O.value;return W(g)}),we=e.computed(()=>new Set(me.value.map(g=>g.batch)));e.watch(we,g=>{g.has(y.value)||(y.value=ht)});const Ee=e.computed(()=>me.value.map(g=>g.key));function Ne(g,j,A){if(g=typeof g!="object"?{}:{...g},g.items||(g.items=T.getEditorButtons({resources:K().value,autoSave:t.autoSave,splitTasks:m().value,deadlines:V().value,criticalPath:F().value,inactiveTasks:d().value,schedule:L().value})),g.items=T.filterEditorButtons(g.items,h=>!(h.id==="tabs"&&(h.type=h.type||A,h.options=h.options.filter(le=>j.has(le.id)),h.options.length<2))),g.items=W(g.items,"toolbar"),!g.layout){const h=g.items.some(le=>le.items);g.layout=h?"column":"row"}return g}const Ve=e.computed(()=>!t.topBar||t.readonly?!1:Ne(t.topBar,we.value,"top")),Me=e.computed(()=>!t.bottomBar||t.readonly?!1:Ne(t.bottomBar,we.value,"bottom"));function He({view:g,event:j,values:A={}}){let{id:h,action:le,data:oe}=j,ve;g==="links"?ve=G.value:g==="resources"?ve=N.value:g==="segments"&&(ve=X.value);const ye=ve.get(h);le==="update-link"&&ye?.action===le&&(oe={...oe,link:{...ye.data.link,...oe.link}}),ve.set(h,{action:le,data:oe}),Object.keys(A).forEach(De=>{te.value[De]=A[De]})}function Re(){const g=[...G.value.values()].filter(h=>C().value.byId(h.data.id)),j=[...g.filter(h=>h.action==="delete-link"),...g.filter(h=>h.action!=="delete-link")],A=t.api.getHistory();A?.startBatch(),j.forEach(({action:h,data:le})=>t.api.exec(h,le)),_&&q({..._}),[N.value,X.value].forEach(h=>{for(let[,le]of h){const{action:oe,data:ve}=le;t.api.exec(oe,ve)}}),A?.endBatch(),_=null}function Ge(){t.api.exec("delete-task",{id:i().value})}function Te(){t.api.exec("show-editor",{id:null})}function Ie(g){const{item:j}=g;if(j.id==="delete")Ge();else if(j.id==="save"){if(E.value)return;Re()}j.comp&&Te()}function ee(g){let{update:j,key:A,input:h}=g;h&&(x.value=!0);const le=Z().value?T.fromInclusiveTask(j,A,ue.value):{...j};if(ue.value=J(le,A,h),g.update=Z().value?T.toInclusiveTask(ue.value,t.api.getTaskCalendar(ue.value)):{...ue.value},!t.autoSave)$.value=g.update;else if(!E.value&&!h){const oe=me.value.find(De=>De.key===A),ve=j[A];(!oe.validation||oe.validation(ve))&&(!oe.required||ve)&&q({...ue.value})}}function J(g,j,A){return T.prepareEditTask(g,t.api.getState(),t.api.getTaskCalendar(g),j),A||(x.value=!1),g}function H(){t.autoSave||(_={...ue.value})}function re(g){E.value=g.errors}function q(g){delete g.links,delete g.data,(Ee.value.indexOf("duration")===-1||g.segments&&!g.duration)&&delete g.duration;const j={id:i().value,task:g};t.autoSave&&x.value&&(j.inProgress=x.value),t.api.exec("update-task",j)}const pe=e.computed(()=>k().value?{"ctrl+z":g=>{g.preventDefault(),t.api.exec("undo")},"ctrl+y":g=>{g.preventDefault(),t.api.exec("redo")}}:{});function de(g){y.value=g.value}return(g,j)=>ne.value?(e.openBlock(),e.createBlock(e.unref(xe.Locale),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(Pe.Editor),{css:`wx-gantt-editor ${I.value} ${a.css}`,items:me.value,values:ne.value,topBar:Ve.value,bottomBar:Me.value,placement:a.placement,layout:a.layout,readonly:a.readonly,autoSave:a.autoSave,focus:a.focus,activeBatch:y.value,onaction:Ie,onsave:H,onvalidation:re,onchange:ee,hotkeys:a.hotkeys?{...pe.value,...a.hotkeys}:!1},null,8,["css","items","values","topBar","bottomBar","placement","layout","readonly","autoSave","focus","activeBatch","hotkeys"])]),_:1})):e.createCommentVNode("",!0)}}),bl={__name:"HeaderMenu",props:{columns:{default:null},api:{}},setup(a){const t=a,n=e.ref("grid"),l=e.computed(()=>t.api?.getTable(!1,n.value));function o(c){const u=c.target?.closest?.("[data-gantt-section]");n.value=u?.dataset.ganttSection==="subGrid"?"subGrid":"grid"}return(c,u)=>(e.openBlock(),e.createBlock(e.unref(Ke.HeaderMenu),{api:l.value,columns:a.columns},{default:e.withCtx(()=>[e.createElementVNode("div",{style:{display:"contents"},onContextmenu:o},[c.$slots.default?e.renderSlot(c.$slots,"default",{key:0}):e.createCommentVNode("",!0)],32)]),_:3},8,["api","columns"]))}},xl={key:1,class:"wx-toggle-placeholder"},wl={class:"wx-name"},_l={key:1,class:"wx-avatar-name"},Bl=Object.assign({name:"GanttResourceNameCell"},{__name:"NameCell",props:{row:{},column:{}},setup(a){const t=a;function n(l,o){return`justify-content:${o.align};padding-left: ${(l.$level-1)*20}px`}return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-content",style:e.normalizeStyle(n(t.row,t.column))},[t.row.data?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(`wx-toggle-icon wxi-menu-${t.row.open?"down":"right"}`),"data-action":"open-resource-row"},null,2)):(e.openBlock(),e.createElementBlock("i",xl)),e.createElementVNode("div",wl,[t.column._cell?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.column._cell),{key:0,row:t.row,column:t.column},null,8,["row","column"])):t.row.role?(e.openBlock(),e.createElementBlock("div",_l,[e.createVNode(e.unref(xe.Avatar),{value:t.row,size:28},null,8,["value"]),e.createElementVNode("span",null,e.toDisplayString(t.row.name),1)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.row.name),1)],64))])],4))}}),$l=ie(Bl,[["__scopeId","data-v-7202a0f4"]]),Sl=["data-tooltip"],Cl={class:"wx-name"},El={key:1,class:"wx-avatar"},Tl={__name:"NameCellCompact",props:{row:{},column:{}},setup(a){const t=a;return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-content wx-compact","data-tooltip":t.row.name},[e.createElementVNode("div",Cl,[t.column._cell?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.column._cell),{key:0,row:t.row,column:t.column},null,8,["row","column"])):t.row.role?(e.openBlock(),e.createElementBlock("div",El,[e.createVNode(e.unref(xe.Avatar),{value:t.row,size:20},null,8,["value"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.row.name),1)],64))])],8,Sl))}},Rl=ie(Tl,[["__scopeId","data-v-a6e976d1"]]),Il=["data-resource-id"],Nl=Object.assign({name:"GanttResourceLoadCell"},{__name:"LoadCell",props:{row:{},column:{}},setup(a){const t=a;return(n,l)=>(e.openBlock(),e.createElementBlock("div",{"data-resource-id":e.unref(z.setID)(t.row.id)},e.toDisplayString(t.column.template(e.unref(yt.getValue)(t.row,t.column))),9,Il))}}),Vl={class:"wx-histogram"},Dl={class:"wx-histogram-stack"},Ll={key:0,class:"wx-histogram-label"},zl={class:"wx-histogram-label-text"},Hl=36,Ml=Object.assign({name:"GanttResourceHistogramCell"},{__name:"HistogramCell",props:{row:{},column:{}},setup(a){const t=a;function n(u,f){const i=f>0?Math.min(u/f*100,100):0,v=Math.round(i*100)/100;return u>0&&i>0?`height:max(${v}%, 3px);`:`height:${v}%;`}function l(u){return`${u.hours}/${u.capacity}`}function o(u){return u.hours>0&&u.width>=Hl}const c=e.computed(()=>T.getHistogramBars(t.row,t.column));return(u,f)=>(e.openBlock(),e.createElementBlock("div",Vl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,i=>(e.openBlock(),e.createElementBlock("div",{key:i.key,class:"wx-histogram-bar"},[e.createElementVNode("div",Dl,[e.createElementVNode("div",{class:e.normalizeClass(["wx-histogram-load",{"wx-histogram-overload":i.overloaded}]),style:e.normalizeStyle(n(i.hours,i.ceiling))},null,6)]),o(i)?(e.openBlock(),e.createElementBlock("div",Ll,[e.createElementVNode("span",zl,e.toDisplayString(l(i)),1)])):e.createCommentVNode("",!0)]))),128))]))}}),Gl=ie(Ml,[["__scopeId","data-v-89d2aed9"]]),Wl=["width","height"],Al=["d","transform"],Pl={__name:"HistogramCapacityOverlay",props:{rows:{default:()=>[]},columns:{default:()=>[]},cellHeight:{default:1},viewportHeight:{default:0},viewportWidth:{default:0},rightInset:{default:0},bottomInset:{default:0},scrollLeft:{default:0},scrollTop:{default:0}},setup(a){const t=a,n=e.computed(()=>t.columns.reduce((i,v)=>i+v.width,0)),l=e.computed(()=>{let i=0;return t.columns.map(v=>{const d={column:v,left:i,right:i+v.width};return i=d.right,d})}),o=e.computed(()=>{const i=l.value,v=i.findIndex(B=>B.right>t.scrollLeft);if(v===-1)return[];const d=t.scrollLeft+t.viewportWidth;let w=v;for(;w<i.length&&i[w].left<d;)w++;return i.slice(Math.max(0,v-1),w)}),c=e.computed(()=>Math.max(0,Math.floor(t.scrollTop/t.cellHeight)-1)),u=e.computed(()=>Math.min(t.rows.length,Math.ceil((t.scrollTop+t.viewportHeight)/t.cellHeight)+1)),f=e.computed(()=>t.rows.slice(c.value,u.value));return(i,v)=>(e.openBlock(),e.createElementBlock("div",{class:"wx-histogram-capacity-overlay",style:e.normalizeStyle(`right:${t.rightInset}px;bottom:${t.bottomInset}px;`),"aria-hidden":"true"},[(e.openBlock(),e.createElementBlock("svg",{width:n.value,height:t.rows.length*t.cellHeight,style:e.normalizeStyle(`transform:translate(${-t.scrollLeft}px, ${-t.scrollTop}px);`)},[o.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(f.value,(d,w)=>(e.openBlock(),e.createElementBlock("path",{key:d.id,class:"wx-histogram-capacity-path",d:e.unref(T.getHistogramCapacityPath)(d,o.value,t.cellHeight),transform:`translate(0, ${(c.value+w)*t.cellHeight})`},null,8,Al))),128)):e.createCommentVNode("",!0)],12,Wl))],4))}},Fl=ie(Pl,[["__scopeId","data-v-5b8c6d31"]]),Ol={class:"wx-layout"},jl={class:"wx-y-bar-clip"},Ul=["onwheel"],ql={__name:"ResourceLoad",props:{api:{},columns:{default:()=>T.getResourceColumns()},mode:{default:"utilization"},template:{},histogram:{},draggableRows:{type:[Boolean,Function],default:!1}},setup(a){const t=a,n=e.computed(()=>t.histogram?.overloadHeadroom),l=e.computed(()=>t.histogram?.capacityLine??!0),o=e.ref(17);e.onMounted(()=>{o.value=Vn()});const c=e.computed(()=>t.api?.getReactiveState()),u=s.subscribeLater(()=>c.value?._resources),f=s.subscribeLater(()=>c.value?._scales),i=s.subscribeLater(()=>c.value?._resourceSort),v=s.subscribeLater(()=>c.value?.cellHeight),d=s.subscribeLater(()=>c.value?._columns),w=s.subscribeLater(()=>c.value?.scrollLeft),B=s.subscribeLater(()=>c.value?.gridWidth),C=s.subscribeLater(()=>c.value?._displayPanels),m=s.subscribeLater(()=>c.value?.highlightTime),R=s.subscribeLater(()=>c.value?._columnsWidth),K=s.subscribeLater(()=>c.value?._gridCollapseThreshold),L=s.subscribeLater(()=>c.value?.cellBorders),M=s.subscribeLater(()=>c.value?.zoom),V=s.subscribeLater(()=>c.value?._compactMode),F=e.computed(()=>u().value??[]),Z=e.computed(()=>f().value??null),k=e.computed(()=>i().value??null),y=e.computed(()=>v().value??0),I=e.computed(()=>d().value??[]),O=e.computed(()=>w().value??0),G=e.computed(()=>B().value??0),_=e.computed(()=>C().value??null),N=e.computed(()=>m().value??null),X=e.computed(()=>R().value??null),x=e.computed(()=>K().value??null),$=e.computed(()=>L().value??null),E=e.computed(()=>M().value??null),ae=e.computed(()=>V().value??!1);let te=e.inject("wx-i18n",null);te||(te=z.locale({...lt.en,...rt.en}),e.provide("wx-i18n",te));const ne=te.getGroup("gantt"),ue=e.ref(null),W=e.computed(()=>ue.value?.panels??_.value),me=e.computed(()=>!!_.value?.includes("grid")),we=e.computed(()=>!!_.value?.includes("chart")),Ee=e.computed(()=>Rt("gridChart",W.value??[],ae.value));function Ne(){ue.value={panels:[..._.value]}}function Ve(Y,P){t.api.exec("resize-grid",{width:Y,inProgress:!P}),P&&(ue.value=null)}const Me=()=>{t.api.exec("set-display-mode",{mode:T.toggleGridChart(_.value,"start",ae.value)})},He=()=>{t.api.exec("set-display-mode",{mode:T.toggleGridChart(_.value,"end",ae.value)})},Re=e.ref(0),Ge=e.ref(null),Te=e.ref(null),Ie=e.ref(0),ee=e.ref(0),J=e.ref(0);let H,re;const q=e.computed(()=>{if(!t.columns||!t.columns.length)return[];let Y=T.normalizeResourceColumns(t.columns).map(se=>{se={...se};const Be=se.header;if(typeof Be=="object"){const Le=Be.text&&ne(Be.text);se.header={...Be,text:Le}}else se.header=ne(Be);return se.align=se.align||"left",se.editor=!1,se});const P=Y.findIndex(se=>se.id==="name");return P!==-1&&(Y[P].cell&&(Y[P]._cell=Y[P].cell),Y[P]={...Y[P],header:me.value?Y[P].header:"",cell:me.value?$l:Rl}),Y.length>0&&(Y[Y.length-1].resize=!1),Y}),pe=e.computed(()=>Kt(F.value,k.value)),de=e.ref(0),g=e.ref(0);e.watchEffect(()=>{let Y;X.value?Y=X.value:me.value?Y=G.value:Y=x.value||0,g.value=Y});const j=e.computed(()=>qt(q.value,_.value,"grid","name")),A=e.computed(()=>T.getHeaderLength(j.value)),h=e.computed(()=>t.mode==="histogram"?T.getResourceHistogramColumns(Z.value,Gl,{overloadHeadroom:n.value}):T.getResourceLoadColumns(Z.value,Nl,t.template)),le=e.computed(()=>({rowHeight:y.value,headerHeight:Z.value.height/A.value})),oe=e.computed(()=>({rowHeight:y.value,headerHeight:0})),ve=e.computed(()=>{const Y=$.value==="column"?"wx-column-border":"";return()=>Y}),ye=e.computed(()=>Ut(I.value,_.value,G.value)),De=e.computed(()=>(Z.value?.width??0)>Re.value-de.value),Ue=e.computed(()=>{const Y=F.value?.length*y.value,P=Ie.value-(De.value?o.value:0);return Y>P}),Qe=e.computed(()=>g.value>de.value+(Ue.value?o.value:0));e.watchEffect(()=>{const Y=O.value;re?.exec("scroll-to",{left:Y}),Te.value&&Math.abs(Te.value.scrollLeft-Y)>1&&(Te.value.scrollLeft=Y)});function Xe(Y){const P=Y.target.dataset.action;if(P==="open-resource-row"){Y.preventDefault();const se=z.locateID(Y),Be=F.value.find(Le=>Le.id===se);Be.data&&t.api.exec(P,{id:se,mode:!Be.open})}}const qe=e.ref([]);function ct(Y){H=Y,H.on("select-row",P=>{qe.value=[P.id]}),H.intercept("sort-rows",P=>{const{key:se,add:Be}=P;let Le=k.value?k.value.find(st=>st.key===se):null,Ye="asc";return Le&&(Ye=!Le||Le.order==="asc"?"desc":"asc"),t.api.exec("sort-resources",{key:se,order:Ye,add:Be,_columns:q.value}),!1}),H.intercept("resize-column",P=>{P.flexgrowFallback=Yt(q.value,P.id)}),H.on("resize-column",()=>{g.value=kt(H.getState().columns)}),H.on("scroll-to",P=>{P.top!==void 0&&!P.rSync&&re?.exec("scroll-to",{top:P.top,rSync:!0})})}function Oe(Y){re=Y,re.on("select-row",P=>{qe.value=[P.id]}),re.on("scroll-to",P=>{P.left!==void 0&&Math.abs(P.left-O.value)>1&&t.api.exec("scroll-chart",{left:P.left}),P.top!==void 0&&!P.rSync&&H?.exec("scroll-to",{top:P.top,rSync:!0}),P.top!==void 0&&(J.value=P.top)})}function Ze(Y,P){if(t.mode!=="histogram"){const Be=yt.getValue(Y,P);if(Be)return Be.percent>100?"wx-overload":"wx-normal"}if(P.unit!=="day"&&P.unit!=="hour")return"";const se=t.api.getResourceCalendar(Y);if(se){if(!se.isWorkingDay(P.date))return se.css??"wx-weekend"}else if(N.value)return N.value(P.date,P.unit);return""}const it=e.computed(()=>t.api&&Jt(t.api,()=>E.value,()=>Ge.value));function Je(Y,P){e.watch(Y,(se,Be,Le)=>{if(!se)return;P(se);const Ye=new ResizeObserver(()=>P(se));Ye.observe(se),Le(()=>Ye.disconnect())},{immediate:!0,flush:"post"})}const et=e.ref(null);Je(et,Y=>{Re.value=Y.offsetWidth});const tt=e.ref(null);Je(tt,Y=>{de.value=Y.clientWidth});const ot=e.ref(null);return Je(ot,Y=>{Ie.value=Y.clientHeight,ee.value=Y.clientWidth}),(Y,P)=>t.api?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wx-resource-load",style:e.normalizeStyle(`--wx-scrollbar-width: ${o.value}px;`),ref_key:"containerDiv",ref:et,"data-menu-ignore":"true"},[e.createElementVNode("div",Ol,[t.columns&&t.columns.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:e.normalizeClass(["wx-grid-container",{"wx-y-scroll":Ue.value,"wx-h-scroll-reserve":De.value&&!Qe.value}]),style:e.normalizeStyle(`flex: 0 0 ${ye.value};`),ref_key:"gridContainerDiv",ref:tt},[e.createElementVNode("div",jl,[e.createElementVNode("div",{class:"wx-resource-grid",onClick:Xe},[e.createVNode(e.unref(Ke.Grid),{init:ct,sizes:le.value,columnStyle:e.unref(Xt),data:F.value,columns:j.value,sortMarks:pe.value,selectedRows:qe.value,draggableRows:t.draggableRows},null,8,["sizes","columnStyle","data","columns","sortMarks","selectedRows","draggableRows"])])])],6),e.createVNode(Tt,e.mergeProps({side:"left",panelWidth:G.value},Ee.value,{onResizeStart:Ne,onResize:se=>Ve(se),onResizeEnd:se=>Ve(se,!0),onExpandStart:Me,onExpandEnd:He}),null,16,["panelWidth","onResize","onResizeEnd"])],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["wx-chart",{"wx-chart-collapsed":!we.value}]),ref_key:"chartContainer",ref:Ge,onwheel:it.value},[e.createElementVNode("div",{class:e.normalizeClass(["wx-timescale-viewport",{"wx-v-scroll-reserve":Ue.value}]),ref_key:"scalesDiv",ref:Te},[e.createVNode(Qt,{api:t.api},null,8,["api"])],2),e.createElementVNode("div",{class:e.normalizeClass(["wx-grid-scale-container",{"wx-histogram-grid":t.mode==="histogram"}]),ref_key:"rightContainerDiv",ref:ot},[e.createVNode(e.unref(Ke.Grid),{init:Oe,columns:h.value,data:F.value,sizes:oe.value,selectedRows:qe.value,rowStyle:ve.value,cellStyle:Ze},null,8,["columns","data","sizes","selectedRows","rowStyle"]),t.mode==="histogram"&&l.value?(e.openBlock(),e.createBlock(Fl,{key:0,rows:F.value,columns:h.value,cellHeight:y.value,viewportHeight:Ie.value,viewportWidth:ee.value,rightInset:Ue.value?o.value:0,bottomInset:De.value?o.value:0,scrollLeft:O.value,scrollTop:J.value},null,8,["rows","columns","cellHeight","viewportHeight","viewportWidth","rightInset","bottomInset","scrollLeft","scrollTop"])):e.createCommentVNode("",!0)],2)],10,Ul)])],4)):e.createCommentVNode("",!0)}},Yl=ie(ql,[["__scopeId","data-v-aeb5bfb2"]]),Kl={key:0,class:"wx-conflict-report"},Xl={class:"wx-title"},Zl={key:0,class:"wx-count"},Ql={key:0,class:"wx-empty"},Jl={class:"wx-empty-title"},eo={key:1,class:"wx-list",role:"list"},to=["data-id","onClick"],no={class:"wx-item-title"},ao={class:"wx-type-icon"},lo={class:"wx-item-title-text"},oo={class:"wx-item-detail"},so={key:0,class:"wx-detail-line"},ro={class:"wx-detail-label"},co={class:"wx-detail-line"},io={class:"wx-detail-label"},uo={key:0,class:"wx-detail-line"},fo={class:"wx-detail-label"},mo={key:0,class:"wx-item-actions"},po={__name:"ConflictReport",props:{api:{default:null},onclose:{type:Function}},setup(a){const t=a;let n=e.inject("wx-i18n",null);n||(n=z.locale({...lt.en,...rt.en}),e.provide("wx-i18n",n));const l=n.getGroup("gantt"),o=n.getRaw(),c=o.gantt?.dateFormat||o.formats?.dateFormat,u=z.dateToString(c,o.calendar),f=Object.fromEntries(T.defaultConstraintTypes.map(x=>[x.id,x.label])),i={constraint:"wxi-triangles-out-h",link:"wxi-link"},v=s.subscribeLater(()=>t.api?.getReactiveState()?._conflicts),d=s.subscribeLater(()=>t.api?.getReactiveState()?.showConflicts),w=s.subscribeLater(()=>t.api?.getReactiveState()?.links,!0),B=s.subscribeLater(()=>t.api?.getReactiveState()?.tasks,!0),C=s.subscribeLater(()=>t.api?.getReactiveState()?.scaleHeight),m=e.computed(()=>!!d().value),R=e.ref(null),K=e.computed(()=>v().value?.rows??[]),L=e.computed(()=>m.value&&K.value.some(x=>x.id===R.value)?R.value:null),M=e.computed(()=>(C().value??36)+"px");function V(x){return x==null?"—":B().value?.byId?.(x)?.text??String(x)}function F(x){return x.typeKey?l(x.typeKey):""}function Z(x){const $=x.required?{id:"resolve",label:"Move task"}:null;return x.type==="constraint"?[$,{id:"remove-constraint",label:"Remove constraint"}].filter(Boolean):x.type==="link"?[$,{id:"remove-link",label:"Remove link"}].filter(Boolean):[]}function k(x){return x.task??null}function y(x){!t.api||x==null||t.api.exec("select-task",{id:x,show:"xy",focus:"chart"})}function I(x){R.value=x.id,y(k(x))}function O(x){return x.link==null?null:w().value?.byId?.(x.link)}function G(x){return B().value?.byId?.(x.task)?.constraint}function _(x,$){if(!t.api)return;R.value=x.id;const E=k(x);switch($){case"remove-link":{const ae=O(x);ae?.id!=null&&t.api.exec("delete-link",{id:ae.id});break}case"resolve":{if(E==null||!x.required)break;t.api.exec("update-task",{id:E,task:{start:x.required}});break}case"remove-constraint":{if(E==null)break;t.api.exec("update-task",{id:E,task:{constraint:null}});break}}}function N(){t.api?.exec("show-conflicts",{mode:!1}),t.onclose?.()}const X=e.computed(()=>K.value.map(x=>({row:x,actions:Z(x),icon:i[x.type]})));return(x,$)=>m.value?(e.openBlock(),e.createElementBlock("div",Kl,[e.createElementVNode("div",{class:"wx-header",style:e.normalizeStyle({height:M.value})},[e.createElementVNode("div",Xl,[e.createTextVNode(e.toDisplayString(e.unref(l)("Conflicts"))+" ",1),K.value.length?(e.openBlock(),e.createElementBlock("span",Zl,e.toDisplayString(K.value.length),1)):e.createCommentVNode("",!0)]),e.createVNode(e.unref(xe.Icon),{css:"wxi-close",onclick:N})],4),K.value.length?(e.openBlock(),e.createElementBlock("div",eo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,({row:E,actions:ae,icon:te})=>(e.openBlock(),e.createElementBlock("div",{key:E.id,class:e.normalizeClass(["wx-item",{"wx-selected":L.value===E.id}]),role:"listitem","data-id":E.id,onClick:ne=>I(E)},[e.createElementVNode("div",no,[e.createElementVNode("span",ao,[te?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(te)},null,2)):e.createCommentVNode("",!0)]),e.createElementVNode("span",lo,e.toDisplayString(F(E)),1)]),e.createElementVNode("div",oo,[E.type==="link"?(e.openBlock(),e.createElementBlock("div",so,[e.createElementVNode("span",ro,e.toDisplayString(e.unref(l)("From link"))+":",1),e.createTextVNode(e.toDisplayString(`${V(O(E)?.source)} → ${V(E.task)}`),1)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",co,[e.createElementVNode("span",io,e.toDisplayString(e.unref(l)("Task"))+":",1),e.createTextVNode(e.toDisplayString(V(E.task)),1)]),G(E)?.date?(e.openBlock(),e.createElementBlock("div",uo,[e.createElementVNode("span",fo,e.toDisplayString(e.unref(l)(e.unref(f)[G(E).type]||G(E).type))+":",1),e.createTextVNode(e.toDisplayString(e.unref(u)(G(E).date)),1)])):e.createCommentVNode("",!0)],64))]),ae.length?(e.openBlock(),e.createElementBlock("div",mo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae,ne=>(e.openBlock(),e.createBlock(e.unref(xe.Button),{key:ne.id,type:L.value===E.id?"primary":void 0,onclick:()=>_(E,ne.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)(ne.label)),1)]),_:2},1032,["type","onclick"]))),128))])):e.createCommentVNode("",!0)],10,to))),128))])):(e.openBlock(),e.createElementBlock("div",Ql,[e.createElementVNode("div",Jl,[$[0]||($[0]=e.createElementVNode("span",{class:"wx-check","aria-hidden":"true"},null,-1)),e.createTextVNode(" "+e.toDisplayString(e.unref(l)("No conflicts found")),1)])]))])):e.createCommentVNode("",!0)}},vo=ie(po,[["__scopeId","data-v-e93b2f56"]]),go=Object.assign({name:"GanttWidgetsTooltip"},{__name:"Tooltip",props:{api:{},at:{default:"point"},overflow:{default:!1},content:{},resolver:{type:Function}},setup(a){const t=a,n=e.computed(()=>t.resolver||w),l=e.inject("wx-i18n",null)||z.locale({...lt.en,...rt.en}),o=l.getGroup("gantt"),c=l.getRaw(),u=z.dateToString(c.gantt?.dateFormat||c.formats?.dateFormat,c.calendar),f=Object.fromEntries(T.defaultConstraintTypes.map(B=>[B.id,B.label]));function i(B){const C=new Date(B);return C.setDate(C.getDate()-1),C}function v(B){return!!t.api.getState()._conflicts?.constraints?.has(B.id)}function d(B){if(!B?.type)return"";const C=o(f[B.type]||B.type);return B.date?`${C}: ${u(B.date)}`:C}function w(B,C){const m=t.api;if(!m)return null;const R=T.resolveResourceHistogramBar(m,C.target);if(R)return t.content?{api:m,data:{histogram:R}}:`${R.resource.name??""}: ${R.hours}h / ${R.capacity}h`;const K=z.getID(B,"data-constraint-id");if(K){const y=m.getTask(K);if(!y?.constraint)return null;if(t.content)return{api:m,data:{constraint:y,violated:v(y)}};const I=m.getState().inclusiveEnd?T.toInclusiveTask(y,m.getTaskCalendar(y)).constraint:y.constraint;return d(I)||null}const L=z.getID(B,"data-task-id");if(L){const y=m.getTask(L);if(!y)return null;if(t.overflow){const O=B.querySelector(".wx-content");if(O&&O.scrollWidth<=O.clientWidth)return null}const I=z.locateID(C.target,"data-segment");return t.content?{api:m,data:{task:y,segmentIndex:I,violated:v(y)}}:I!==null?y.segments?.[I]?.text??"":y.text??""}const M=z.getID(B,"data-link-id");if(M){const I=m.getState().links.byId(M);return I&&t.content?{api:m,data:{link:I}}:null}const V=z.getID(B,"data-rollup-id");if(V){const y=m.getTask(V);return y?t.content?{api:m,data:{rollup:y}}:y.text??"":null}const F=z.getID(B,"data-resource-id");if(F){const y=m.getResource(F);return y?t.content?{api:m,data:{resource:y}}:y.name??"":null}const Z=T.resolveSCurvePoint(m,C.target);if(Z){if(t.content)return{api:m,data:{sCurve:Z}};const y=Math.round(Z.hovered.value);let I=Z.date;return m.getState().inclusiveEnd&&!I.getHours()&&!I.getMinutes()&&(I=i(I)),`${u(I)}: ${y}%`}const k=z.getID(B,"data-deadline");if(k){const y=m.getTask(k);if(!y)return null;if(t.content)return{api:m,data:{deadline:y}};const I=m.getState().inclusiveEnd?T.toInclusiveTask(y,m.getTaskCalendar(y)).deadline:y.deadline;return`${u(I)}`}return null}return(B,C)=>(e.openBlock(),e.createBlock(e.unref(xe.Tooltip),{at:a.at,content:a.content,resolver:n.value},{default:e.withCtx(()=>[e.renderSlot(B.$slots,"default")]),_:3},8,["at","content","resolver"]))}}),ho=Object.assign({name:"GanttThemesWillow"},{__name:"Willow",props:{fonts:{type:Boolean,default:!0}},setup(a){const t=a;return(n,l)=>n.$slots.default?(e.openBlock(),e.createBlock(e.unref(xe.Willow),{key:0,fonts:t.fonts},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke.Willow),{fonts:t.fonts},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["fonts"])]),_:3},8,["fonts"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(Ke.Willow),{fonts:t.fonts},null,8,["fonts"]),e.createVNode(e.unref(xe.Willow),{fonts:t.fonts},null,8,["fonts"])],64))}}),ko=ie(ho,[["__scopeId","data-v-e317edfb"]]),yo=Object.assign({name:"GanttThemesWillowDark"},{__name:"WillowDark",props:{fonts:{type:Boolean,default:!0}},setup(a){const t=a;return(n,l)=>n.$slots.default?(e.openBlock(),e.createBlock(e.unref(xe.WillowDark),{key:0,fonts:t.fonts},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke.WillowDark),{fonts:t.fonts},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["fonts"])]),_:3},8,["fonts"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(Ke.WillowDark),{fonts:t.fonts},null,8,["fonts"]),e.createVNode(e.unref(xe.WillowDark),{fonts:t.fonts},null,8,["fonts"])],64))}}),bo=ie(yo,[["__scopeId","data-v-fbd1cf32"]]);function Ft(a,t){return a?.closest?.(".wx-gantt")?.querySelector(`.wx-row[data-id="${z.setID(t)}"]`)||null}function xo(a,t){const n=z.locate(a);if(n){const d=z.getID(n),w=Ft(n,d)||(n.closest(".wx-area")?null:n);if(w)return{id:d,node:w}}if(!t||a?.clientY==null)return null;const o=(a.target instanceof Element?a.target:null)?.closest(".wx-area");if(!o)return null;const c=o.getBoundingClientRect(),{_tasks:u,cellHeight:f=1}=t.getState();if(!u?.length)return null;const i=Zt(u,a.clientY-c.top,f);if(!i||i.id==null)return null;const v=Ft(o,i.id);return v?{id:i.id,node:v}:null}const wo=on.version;Object.defineProperty(exports,"defaultColumns",{enumerable:!0,get:()=>T.defaultColumns});Object.defineProperty(exports,"defaultEditorItems",{enumerable:!0,get:()=>T.defaultEditorItems});Object.defineProperty(exports,"defaultMenuOptions",{enumerable:!0,get:()=>T.defaultMenuOptions});Object.defineProperty(exports,"defaultTaskTypes",{enumerable:!0,get:()=>T.defaultTaskTypes});Object.defineProperty(exports,"defaultToolbarButtons",{enumerable:!0,get:()=>T.defaultToolbarButtons});Object.defineProperty(exports,"getDefaultColumns",{enumerable:!0,get:()=>T.getDefaultColumns});Object.defineProperty(exports,"getEditorButtons",{enumerable:!0,get:()=>T.getEditorButtons});Object.defineProperty(exports,"getEditorItems",{enumerable:!0,get:()=>T.getEditorItems});Object.defineProperty(exports,"getMenuOptions",{enumerable:!0,get:()=>T.getMenuOptions});Object.defineProperty(exports,"getResourceColumns",{enumerable:!0,get:()=>T.getResourceColumns});Object.defineProperty(exports,"getToolbarButtons",{enumerable:!0,get:()=>T.getToolbarButtons});Object.defineProperty(exports,"registerScaleUnit",{enumerable:!0,get:()=>T.registerScaleUnit});Object.defineProperty(exports,"registerEditorItem",{enumerable:!0,get:()=>Pe.registerEditorItem});exports.ConflictReport=vo;exports.ContextMenu=Oa;exports.Editor=yl;exports.Gantt=Ga;exports.HeaderMenu=bl;exports.ResourceLoad=Yl;exports.Toolbar=Aa;exports.Tooltip=go;exports.Willow=ko;exports.WillowDark=bo;exports.locateTask=xo;exports.version=wo;
|