Socket
Socket
Sign inDemoInstall

gantt-schedule-timeline-calendar

Package Overview
Dependencies
5
Maintainers
1
Versions
476
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.26.1 to 3.26.2

4

CHANGELOG.md

@@ -844,2 +844,6 @@ [3.1.0]

[3.26.2]
- dependency lines plugin stops draw lines when two connected items was detached bugfix
<br /><br /> \***breaking** in some situations - depends on user configuration - but must be changed due to bug fixing or make it much easier to use

2

dist/plugins/calendar-scroll.esm.min.js

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -12,0 +12,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,5 +10,5 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CalendarScroll={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const e={enabled:!0,bodyClassName:"gstc-scrolling"};t.Plugin=function(t=e){let i,n,o,s=t.enabled;class r{constructor(t){this.moving=!1,this.initialDataIndex={x:0,y:0},this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this),this.destroy=this.destroy.bind(this),this.pointerMove=i.schedule(this.pointerMove.bind(this)),t.addEventListener("pointerdown",this.pointerDown),document.addEventListener("pointermove",this.pointerMove,{passive:!0}),document.addEventListener("pointerup",this.pointerUp),t.style.cursor="grab"}destroy(t){t.removeEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointermove",this.pointerMove),document.removeEventListener("pointerup",this.pointerUp)}resetInitialPoint(t){this.initialPoint={x:t.screenX,y:t.screenY}}pointerDown(e){if(!s)return;document.body.classList.add(t.bodyClassName),this.moving=!0,this.resetInitialPoint(e);const i=o.get("$data.scroll");this.initialDataIndex={x:i.horizontal.dataIndex||0,y:i.vertical.dataIndex||0}}pointerUp(){s&&(document.body.classList.remove(t.bodyClassName),this.moving&&(this.moving=!1))}handleHorizontalMovement(t,e){const i=o.get("$data.chart.time");if(t.x>0){if(0===this.initialDataIndex.x)return this.resetInitialPoint(e);const o=i.allDates[i.level];let s=this.initialDataIndex.x-1,r=0;for(;s>0;s--){if(r+=o[s].width,r>=t.x)break}n.setScrollLeft(s)}else if(t.x<0){let s=this.initialDataIndex.x;const r=o.get("$data.scroll.horizontal"),a=i.allDates[i.level];if(s-1>=a.length-r.lastPageCount)return this.resetInitialPoint(e);let l=0;for(let e=a.length;s<e;s++){if(l+=a[s].width,-l<=t.x)break}if(s-1>=a.length-r.lastPageCount)return;n.setScrollLeft(s)}}pointerMove(t){if(!s||!this.moving)return;const e={x:t.screenX-this.initialPoint.x,y:t.screenY-this.initialPoint.y};this.handleHorizontalMovement(e,t)}}return function(e){i=e,n=i.api,o=i.state;const a="config.plugin.CalendarScroll",l=e.state.get(a);return l&&(t=n.mergeDeep({},t,l)),o.update(a,t),o.subscribe("config.plugin.CalendarScroll.enabled",(t=>s=t)),o.update("config.actions.chart-calendar",(t=>(t.push(r),t))),n.pluginInitialized("CalendarScroll"),function(){o.update("config.actions.chart-calendar",(t=>t.filter((t=>t!==r)))),n.pluginDestroyed("CalendarScroll")}}},Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,6 +23,6 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const i="config.plugin.DependencyLines",e="config.slots.chart-timeline-items.outer",n=t("chart-timeline-dependency-lines-lines"),s=t("chart-timeline-dependency-lines-lines-line"),o=t("chart-timeline-dependency-lines-points"),p=t("chart-timeline-dependency-lines-points-point");class a{constructor(t,n){this.onDestroy=[],this.vido=t,this.api=this.vido.api,this.state=this.vido.state;const s=this.vido.html`<div class=${p+"--left"}></div>`,o=this.vido.html`<div class=${p+"--right"}></div>`;this.data=function(t){return Object.assign(Object.assign({},t),{lines:[]})}(function(t,i,e){const n=Object.assign(Object.assign({},function(t,i){return{type:"smooth",onLines:[],onLine:[],leftPoint:{content:t,width:10,height:10},rightPoint:{content:i,width:10,height:10}}}(i,e)),t);return t.leftPoint&&(n.leftPoint=Object.assign(Object.assign({},n.leftPoint),t.leftPoint)),t.rightPoint&&(n.rightPoint=Object.assign(Object.assign({},n.rightPoint),t.rightPoint)),n}(n,s,o)),this.slot=this.slot.bind(this),this.generateLines=this.generateLines.bind(this),this.destroy=this.destroy.bind(this),this.updateData(),this.onDestroy.push(this.state.subscribe(i,(t=>{this.data=t}))),this.state.update(e,(t=>(t.includes(this.slot)||t.push(this.slot),t))),this.onDestroy.push(this.state.subscribeAll(["$data.chart.items","$data.list.rowsHeight","$data.scroll","$data.chart.time.leftGlobal","$data.chart.time.rightPx"],this.generateLines,{group:!0}))}destroy(){this.state.update(e,(t=>t.filter((t=>t!==this.slot)))),this.onDestroy.forEach((t=>t())),this.api.pluginDestroyed("DependencyLines")}updateData(){this.state.update(i,this.data),this.vido.update()}setStraightPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)||!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(o.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSquareAltPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)&&!this.api.parentsExpanded(p.id))return;const a=(s.position.left-n.position.right)/2,h=n.position.right+a,d=(s.position.viewTop-n.position.viewTop)/2,r=n.position.viewTop+d,l=this.api.getRowViewTop(o.id),c=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:l,type:"M",content:this.data.leftPoint.content}),s.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?r+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:h,y:this.api.parentsExpanded(o.id)?r+i:l,type:"L",content:null}),this.api.parentsExpanded(p.id)?(s.position.left<n.position.right?(t.points.push({x:s.position.left-e-10,y:this.api.parentsExpanded(o.id)?r+i:l,type:"L",content:null}),t.points.push({x:s.position.left-e-10,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:c,type:"L",content:this.data.rightPoint.content})):t.points.push({x:h,y:c,type:"L",content:this.data.rightPoint.content})}setSquarePoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(o.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop!==s.position.viewTop?s.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"L",content:null}),s.position.viewTop>n.position.viewTop?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?a+o.outerHeight:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:this.api.parentsExpanded(o.id)?a+o.outerHeight:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop:h,type:"L",content:this.data.rightPoint.content})):(t.points.push({x:n.position.right+e+10,y:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop+s.actualHeight:h,type:"L",content:this.data.rightPoint.content}))):(t.points.push({x:s.position.left+10,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"L",content:null}),s.position.viewTop>n.position.viewTop?t.points.push({x:s.position.left+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop:h,type:"L",content:this.data.rightPoint.content}):t.points.push({x:s.position.left+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop+s.actualHeight:h,type:"L",content:this.data.rightPoint.content})):t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSmoothPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(o.id),h=this.api.getRowViewTop(p.id);if(t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop===s.position.viewTop)return void t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content});const d=(s.position.left-n.position.right)/2,r=n.position.right+d;if(n.position.right<=s.position.left)t.points.push({x:r,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:r,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"",content:null}),t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"",content:this.data.rightPoint.content});else{const d=(s.position.viewTop-n.position.viewTop)/2,l=n.position.viewTop+d+i;t.points.push({x:n.position.right+20,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:n.position.right+40,y:l,type:"",content:null}),t.points.push({x:r,y:l,type:"",content:null}),t.points.push({x:s.position.left+e-20,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"S",content:null}),t.points.push({x:s.position.left+e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"",content:this.data.rightPoint.content})}}setPoints(t){const{fromItemData:i,toItemData:e,fromRowData:n,toRowData:s,toItem:o,fromItem:p}=t,a=this.state.get("$data.chart.time");switch(this.api.calculateItemPosition(i.id,i,n,a,p),this.api.calculateItemPosition(e.id,e,s,a,o),t.type){case"straight":this.setStraightPoints(t);break;case"square":this.setSquarePoints(t);break;case"smooth":this.setSmoothPoints(t);break;case"square-alt":this.setSquareAltPoints(t)}}generateLines(){const t=[],i=this.api.getAllItems(),e=this.api.getRowsData(),n=this.api.getItemsData(),o=this.state.get("$data.chart.time"),p=this.state.get("$data.chart.dimensions"),a=Math.round(o.rightPx-o.leftPx),h=this.data.type;for(const d in i){const r=i[d];if(!r.dependant)continue;if(!r.dependant.length)continue;const l=e[r.rowId],c=n[d],u=r;if(c&&l)for(const f of r.dependant){const r=i[f],g=r,y=e[r.rowId],x=n[f];if(!x||!y)continue;if(o.calculatedZoomMode){if(u.time.end<o.leftGlobal&&g.time.start>o.rightGlobal)continue;if(g.time.end<o.leftGlobal&&u.time.start>o.rightGlobal)continue;if(u.time.start>o.rightGlobal&&g.time.start>o.rightGlobal)continue;if(u.time.end<o.leftGlobal&&g.time.end<o.leftGlobal)continue}if(this.api.calculateItemPosition(d,c,l,o),this.api.calculateItemPosition(f,x,y,o),c.detached&&x.detached)continue;if(-1===c.width&&-1===x.width)continue;const w=c.actualHeight/2,m=0;let v={x:0,y:0,width:a,height:p.height,topOffset:w,leftOffset:m,points:[],type:h,fromItemData:c,toItemData:x,fromItem:u,toItem:g,fromRowData:l,toRowData:y,className:s};for(const t of this.data.onLine)v=t(v);this.setPoints(v),t.push(v)}}this.data.lines=t;for(const t of this.data.onLines)this.data.lines=t(this.data.lines);this.updateData()}slot(t){const{html:i,svg:e,state:s,onDestroy:a,StyleMap:h}=t,d=new h({});a(s.subscribeAll(["$data.chart.time","$data.chart.dimensions"],(()=>{const t=s.get("$data.chart.time");d.style.width=Math.round(t.rightPx-t.leftPx)+"px";const i=s.get("$data.chart.dimensions");d.style.height=i.innerHeight+"px"})));const r=t=>{if(!t.points.length)return"";const i=t.points.slice(),e=i.shift();return[`${e.type} ${e.x} ${e.y}`,[...i.map((t=>`${t.type} ${t.x} ${t.y}`))]].join(" ")},l=(t,e)=>{const n=`left:${t.x-(0===e?this.data.leftPoint.width/2:this.data.rightPoint.width/2)}px;top:${t.y-(0===e?this.data.leftPoint.height/2:this.data.rightPoint.height/2)}px;width:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px;height:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px`;return t.content?i`<div class=${p+" "+p+"--"+this.data.type} style=${n}>
*/const i="config.plugin.DependencyLines",e="config.slots.chart-timeline-items.outer",n=t("chart-timeline-dependency-lines-lines"),s=t("chart-timeline-dependency-lines-lines-line"),o=t("chart-timeline-dependency-lines-points"),p=t("chart-timeline-dependency-lines-points-point");class a{constructor(t,n){this.onDestroy=[],this.vido=t,this.api=this.vido.api,this.state=this.vido.state;const s=this.vido.html`<div class=${p+"--left"}></div>`,o=this.vido.html`<div class=${p+"--right"}></div>`;this.data=function(t){return Object.assign(Object.assign({},t),{lines:[]})}(function(t,i,e){const n=Object.assign(Object.assign({},function(t,i){return{type:"smooth",onLines:[],onLine:[],leftPoint:{content:t,width:10,height:10},rightPoint:{content:i,width:10,height:10}}}(i,e)),t);return t.leftPoint&&(n.leftPoint=Object.assign(Object.assign({},n.leftPoint),t.leftPoint)),t.rightPoint&&(n.rightPoint=Object.assign(Object.assign({},n.rightPoint),t.rightPoint)),n}(n,s,o)),this.slot=this.slot.bind(this),this.generateLines=this.generateLines.bind(this),this.destroy=this.destroy.bind(this),this.updateData(),this.onDestroy.push(this.state.subscribe(i,(t=>{this.data=t}))),this.state.update(e,(t=>(t.includes(this.slot)||t.push(this.slot),t))),this.onDestroy.push(this.state.subscribeAll(["$data.chart.items","$data.list.rowsHeight","$data.scroll","$data.chart.time.leftGlobal","$data.chart.time.rightPx"],this.generateLines,{group:!0}))}destroy(){this.state.update(e,(t=>t.filter((t=>t!==this.slot)))),this.onDestroy.forEach((t=>t())),this.api.pluginDestroyed("DependencyLines")}updateData(){this.state.update(i,this.data),this.vido.update()}setStraightPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)||!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(o.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSquareAltPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)&&!this.api.parentsExpanded(p.id))return;const a=(s.position.left-n.position.right)/2,h=n.position.right+a,d=(s.position.viewTop-n.position.viewTop)/2,r=n.position.viewTop+d,l=this.api.getRowViewTop(o.id),c=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:l,type:"M",content:this.data.leftPoint.content}),s.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?r+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:h,y:this.api.parentsExpanded(o.id)?r+i:l,type:"L",content:null}),this.api.parentsExpanded(p.id)?(s.position.left<n.position.right?(t.points.push({x:s.position.left-e-10,y:this.api.parentsExpanded(o.id)?r+i:l,type:"L",content:null}),t.points.push({x:s.position.left-e-10,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:c,type:"L",content:this.data.rightPoint.content})):t.points.push({x:h,y:c,type:"L",content:this.data.rightPoint.content})}setSquarePoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(o.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop!==s.position.viewTop?s.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"L",content:null}),s.position.viewTop>n.position.viewTop?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(o.id)?a+o.outerHeight:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:this.api.parentsExpanded(o.id)?a+o.outerHeight:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop:h,type:"L",content:this.data.rightPoint.content})):(t.points.push({x:n.position.right+e+10,y:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:a,type:"L",content:null}),t.points.push({x:s.position.left+e+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop+s.actualHeight:h,type:"L",content:this.data.rightPoint.content}))):(t.points.push({x:s.position.left+10,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"L",content:null}),s.position.viewTop>n.position.viewTop?t.points.push({x:s.position.left+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop:h,type:"L",content:this.data.rightPoint.content}):t.points.push({x:s.position.left+10,y:this.api.parentsExpanded(p.id)?s.position.viewTop+s.actualHeight:h,type:"L",content:this.data.rightPoint.content})):t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSmoothPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:s,fromRowData:o,toRowData:p}=t;if(!this.api.parentsExpanded(o.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(o.id),h=this.api.getRowViewTop(p.id);if(t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop===s.position.viewTop)return void t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content});const d=(s.position.left-n.position.right)/2,r=n.position.right+d;if(n.position.right<=s.position.left)t.points.push({x:r,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:r,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"",content:null}),t.points.push({x:s.position.left-e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"",content:this.data.rightPoint.content});else{const d=(s.position.viewTop-n.position.viewTop)/2,l=n.position.viewTop+d+i;t.points.push({x:n.position.right+20,y:this.api.parentsExpanded(o.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:n.position.right+40,y:l,type:"",content:null}),t.points.push({x:r,y:l,type:"",content:null}),t.points.push({x:s.position.left+e-20,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"S",content:null}),t.points.push({x:s.position.left+e,y:this.api.parentsExpanded(p.id)?s.position.viewTop+i:h,type:"",content:this.data.rightPoint.content})}}setPoints(t){const{fromItemData:i,toItemData:e,fromRowData:n,toRowData:s,toItem:o,fromItem:p}=t,a=this.state.get("$data.chart.time");switch(this.api.calculateItemPosition(i.id,i,n,a,p),this.api.calculateItemPosition(e.id,e,s,a,o),t.type){case"straight":this.setStraightPoints(t);break;case"square":this.setSquarePoints(t);break;case"smooth":this.setSmoothPoints(t);break;case"square-alt":this.setSquareAltPoints(t)}}generateLines(){const t=[],i=this.api.getAllItems(),e=this.api.getRowsData(),n=this.api.getItemsData(),o=this.state.get("$data.chart.time"),p=this.state.get("$data.chart.dimensions"),a=Math.round(o.rightPx-o.leftPx),h=this.data.type;for(const d in i){const r=i[d];if(!r.dependant)continue;if(!r.dependant.length)continue;const l=e[r.rowId],c=n[d],u=r;if(c&&l)for(const f of r.dependant){const r=i[f],g=r,y=e[r.rowId],x=n[f];if(!x||!y)continue;if(o.calculatedZoomMode){if(u.time.end<o.leftGlobal&&g.time.start>o.rightGlobal)continue;if(g.time.end<o.leftGlobal&&u.time.start>o.rightGlobal)continue;if(u.time.start>o.rightGlobal&&g.time.start>o.rightGlobal)continue;if(u.time.end<o.leftGlobal&&g.time.end<o.leftGlobal)continue}if(this.api.calculateItemPosition(d,c,l,o),this.api.calculateItemPosition(f,x,y,o),-1===c.width&&-1===x.width)continue;const w=c.actualHeight/2,m=0;let v={x:0,y:0,width:a,height:p.height,topOffset:w,leftOffset:m,points:[],type:h,fromItemData:c,toItemData:x,fromItem:u,toItem:g,fromRowData:l,toRowData:y,className:s};for(const t of this.data.onLine)v=t(v);this.setPoints(v),t.push(v)}}this.data.lines=t;for(const t of this.data.onLines)this.data.lines=t(this.data.lines);this.updateData()}slot(t){const{html:i,svg:e,state:s,onDestroy:a,StyleMap:h}=t,d=new h({});a(s.subscribeAll(["$data.chart.time","$data.chart.dimensions"],(()=>{const t=s.get("$data.chart.time");d.style.width=Math.round(t.rightPx-t.leftPx)+"px";const i=s.get("$data.chart.dimensions");d.style.height=i.innerHeight+"px"})));const r=t=>{if(!t.points.length)return"";const i=t.points.slice(),e=i.shift();return[`${e.type} ${e.x} ${e.y}`,[...i.map((t=>`${t.type} ${t.x} ${t.y}`))]].join(" ")},l=(t,e)=>{const n=`left:${t.x-(0===e?this.data.leftPoint.width/2:this.data.rightPoint.width/2)}px;top:${t.y-(0===e?this.data.leftPoint.height/2:this.data.rightPoint.height/2)}px;width:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px;height:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px`;return t.content?i`<div class=${p+" "+p+"--"+this.data.type} style=${n}>
${t.content}

@@ -29,0 +29,0 @@ </div>`:null},c=t=>e`<svg width=${t.width} height=${t.height} xmlns="http://www.w3.org/2000/svg">

@@ -10,3 +10,3 @@ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).DependencyLines={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,6 +23,6 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const n="DependencyLines",o="config.plugin.DependencyLines",s="config.slots.chart-timeline-items.outer",p=e("chart-timeline-dependency-lines-lines"),a=e("chart-timeline-dependency-lines-lines-line"),h=e("chart-timeline-dependency-lines-points"),d=e("chart-timeline-dependency-lines-points-point");class r{constructor(t,i){this.onDestroy=[],this.vido=t,this.api=this.vido.api,this.state=this.vido.state;const e=this.vido.html`<div class=${d+"--left"}></div>`,n=this.vido.html`<div class=${d+"--right"}></div>`;this.data=function(t){return Object.assign(Object.assign({},t),{lines:[]})}(function(t,i,e){const n=Object.assign(Object.assign({},function(t,i){return{type:"smooth",onLines:[],onLine:[],leftPoint:{content:t,width:10,height:10},rightPoint:{content:i,width:10,height:10}}}(i,e)),t);return t.leftPoint&&(n.leftPoint=Object.assign(Object.assign({},n.leftPoint),t.leftPoint)),t.rightPoint&&(n.rightPoint=Object.assign(Object.assign({},n.rightPoint),t.rightPoint)),n}(i,e,n)),this.slot=this.slot.bind(this),this.generateLines=this.generateLines.bind(this),this.destroy=this.destroy.bind(this),this.updateData(),this.onDestroy.push(this.state.subscribe(o,(t=>{this.data=t}))),this.state.update(s,(t=>(t.includes(this.slot)||t.push(this.slot),t))),this.onDestroy.push(this.state.subscribeAll(["$data.chart.items","$data.list.rowsHeight","$data.scroll","$data.chart.time.leftGlobal","$data.chart.time.rightPx"],this.generateLines,{group:!0}))}destroy(){this.state.update(s,(t=>t.filter((t=>t!==this.slot)))),this.onDestroy.forEach((t=>t())),this.api.pluginDestroyed(n)}updateData(){this.state.update(o,this.data),this.vido.update()}setStraightPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)||!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(s.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSquareAltPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)&&!this.api.parentsExpanded(p.id))return;const a=(o.position.left-n.position.right)/2,h=n.position.right+a,d=(o.position.viewTop-n.position.viewTop)/2,r=n.position.viewTop+d,l=this.api.getRowViewTop(s.id),c=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:l,type:"M",content:this.data.leftPoint.content}),o.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?r+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:h,y:this.api.parentsExpanded(s.id)?r+i:l,type:"L",content:null}),this.api.parentsExpanded(p.id)?(o.position.left<n.position.right?(t.points.push({x:o.position.left-e-10,y:this.api.parentsExpanded(s.id)?r+i:l,type:"L",content:null}),t.points.push({x:o.position.left-e-10,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:c,type:"L",content:this.data.rightPoint.content})):t.points.push({x:h,y:c,type:"L",content:this.data.rightPoint.content})}setSquarePoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(s.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop!==o.position.viewTop?o.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"L",content:null}),o.position.viewTop>n.position.viewTop?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?a+s.outerHeight:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:this.api.parentsExpanded(s.id)?a+s.outerHeight:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop:h,type:"L",content:this.data.rightPoint.content})):(t.points.push({x:n.position.right+e+10,y:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop+o.actualHeight:h,type:"L",content:this.data.rightPoint.content}))):(t.points.push({x:o.position.left+10,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"L",content:null}),o.position.viewTop>n.position.viewTop?t.points.push({x:o.position.left+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop:h,type:"L",content:this.data.rightPoint.content}):t.points.push({x:o.position.left+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop+o.actualHeight:h,type:"L",content:this.data.rightPoint.content})):t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSmoothPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(s.id),h=this.api.getRowViewTop(p.id);if(t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop===o.position.viewTop)return void t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content});const d=(o.position.left-n.position.right)/2,r=n.position.right+d;if(n.position.right<=o.position.left)t.points.push({x:r,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:r,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"",content:null}),t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"",content:this.data.rightPoint.content});else{const d=(o.position.viewTop-n.position.viewTop)/2,l=n.position.viewTop+d+i;t.points.push({x:n.position.right+20,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:n.position.right+40,y:l,type:"",content:null}),t.points.push({x:r,y:l,type:"",content:null}),t.points.push({x:o.position.left+e-20,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"S",content:null}),t.points.push({x:o.position.left+e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"",content:this.data.rightPoint.content})}}setPoints(t){const{fromItemData:i,toItemData:e,fromRowData:n,toRowData:o,toItem:s,fromItem:p}=t,a=this.state.get("$data.chart.time");switch(this.api.calculateItemPosition(i.id,i,n,a,p),this.api.calculateItemPosition(e.id,e,o,a,s),t.type){case"straight":this.setStraightPoints(t);break;case"square":this.setSquarePoints(t);break;case"smooth":this.setSmoothPoints(t);break;case"square-alt":this.setSquareAltPoints(t)}}generateLines(){const t=[],i=this.api.getAllItems(),e=this.api.getRowsData(),n=this.api.getItemsData(),o=this.state.get("$data.chart.time"),s=this.state.get("$data.chart.dimensions"),p=Math.round(o.rightPx-o.leftPx),h=this.data.type;for(const d in i){const r=i[d];if(!r.dependant)continue;if(!r.dependant.length)continue;const l=e[r.rowId],c=n[d],u=r;if(c&&l)for(const f of r.dependant){const r=i[f],g=r,y=e[r.rowId],x=n[f];if(!x||!y)continue;if(o.calculatedZoomMode){if(u.time.end<o.leftGlobal&&g.time.start>o.rightGlobal)continue;if(g.time.end<o.leftGlobal&&u.time.start>o.rightGlobal)continue;if(u.time.start>o.rightGlobal&&g.time.start>o.rightGlobal)continue;if(u.time.end<o.leftGlobal&&g.time.end<o.leftGlobal)continue}if(this.api.calculateItemPosition(d,c,l,o),this.api.calculateItemPosition(f,x,y,o),c.detached&&x.detached)continue;if(-1===c.width&&-1===x.width)continue;const w=c.actualHeight/2,m=0;let v={x:0,y:0,width:p,height:s.height,topOffset:w,leftOffset:m,points:[],type:h,fromItemData:c,toItemData:x,fromItem:u,toItem:g,fromRowData:l,toRowData:y,className:a};for(const t of this.data.onLine)v=t(v);this.setPoints(v),t.push(v)}}this.data.lines=t;for(const t of this.data.onLines)this.data.lines=t(this.data.lines);this.updateData()}slot(t){const{html:i,svg:e,state:n,onDestroy:o,StyleMap:s}=t,a=new s({});o(n.subscribeAll(["$data.chart.time","$data.chart.dimensions"],(()=>{const t=n.get("$data.chart.time");a.style.width=Math.round(t.rightPx-t.leftPx)+"px";const i=n.get("$data.chart.dimensions");a.style.height=i.innerHeight+"px"})));const r=t=>{if(!t.points.length)return"";const i=t.points.slice(),e=i.shift();return[`${e.type} ${e.x} ${e.y}`,[...i.map((t=>`${t.type} ${t.x} ${t.y}`))]].join(" ")},l=(t,e)=>{const n=`left:${t.x-(0===e?this.data.leftPoint.width/2:this.data.rightPoint.width/2)}px;top:${t.y-(0===e?this.data.leftPoint.height/2:this.data.rightPoint.height/2)}px;width:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px;height:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px`;return t.content?i`<div class=${d+" "+d+"--"+this.data.type} style=${n}>
*/const n="DependencyLines",o="config.plugin.DependencyLines",s="config.slots.chart-timeline-items.outer",p=e("chart-timeline-dependency-lines-lines"),a=e("chart-timeline-dependency-lines-lines-line"),h=e("chart-timeline-dependency-lines-points"),d=e("chart-timeline-dependency-lines-points-point");class r{constructor(t,i){this.onDestroy=[],this.vido=t,this.api=this.vido.api,this.state=this.vido.state;const e=this.vido.html`<div class=${d+"--left"}></div>`,n=this.vido.html`<div class=${d+"--right"}></div>`;this.data=function(t){return Object.assign(Object.assign({},t),{lines:[]})}(function(t,i,e){const n=Object.assign(Object.assign({},function(t,i){return{type:"smooth",onLines:[],onLine:[],leftPoint:{content:t,width:10,height:10},rightPoint:{content:i,width:10,height:10}}}(i,e)),t);return t.leftPoint&&(n.leftPoint=Object.assign(Object.assign({},n.leftPoint),t.leftPoint)),t.rightPoint&&(n.rightPoint=Object.assign(Object.assign({},n.rightPoint),t.rightPoint)),n}(i,e,n)),this.slot=this.slot.bind(this),this.generateLines=this.generateLines.bind(this),this.destroy=this.destroy.bind(this),this.updateData(),this.onDestroy.push(this.state.subscribe(o,(t=>{this.data=t}))),this.state.update(s,(t=>(t.includes(this.slot)||t.push(this.slot),t))),this.onDestroy.push(this.state.subscribeAll(["$data.chart.items","$data.list.rowsHeight","$data.scroll","$data.chart.time.leftGlobal","$data.chart.time.rightPx"],this.generateLines,{group:!0}))}destroy(){this.state.update(s,(t=>t.filter((t=>t!==this.slot)))),this.onDestroy.forEach((t=>t())),this.api.pluginDestroyed(n)}updateData(){this.state.update(o,this.data),this.vido.update()}setStraightPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)||!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(s.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSquareAltPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)&&!this.api.parentsExpanded(p.id))return;const a=(o.position.left-n.position.right)/2,h=n.position.right+a,d=(o.position.viewTop-n.position.viewTop)/2,r=n.position.viewTop+d,l=this.api.getRowViewTop(s.id),c=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:l,type:"M",content:this.data.leftPoint.content}),o.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?r+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:h,y:this.api.parentsExpanded(s.id)?r+i:l,type:"L",content:null}),this.api.parentsExpanded(p.id)?(o.position.left<n.position.right?(t.points.push({x:o.position.left-e-10,y:this.api.parentsExpanded(s.id)?r+i:l,type:"L",content:null}),t.points.push({x:o.position.left-e-10,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:l,type:"L",content:null})):t.points.push({x:h,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:l,type:"L",content:null}),t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:c,type:"L",content:this.data.rightPoint.content})):t.points.push({x:h,y:c,type:"L",content:this.data.rightPoint.content})}setSquarePoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(s.id),h=this.api.getRowViewTop(p.id);t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop!==o.position.viewTop?o.position.left<n.position.right?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"L",content:null}),o.position.viewTop>n.position.viewTop?(t.points.push({x:n.position.right+e+10,y:this.api.parentsExpanded(s.id)?a+s.outerHeight:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:this.api.parentsExpanded(s.id)?a+s.outerHeight:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop:h,type:"L",content:this.data.rightPoint.content})):(t.points.push({x:n.position.right+e+10,y:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:a,type:"L",content:null}),t.points.push({x:o.position.left+e+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop+o.actualHeight:h,type:"L",content:this.data.rightPoint.content}))):(t.points.push({x:o.position.left+10,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"L",content:null}),o.position.viewTop>n.position.viewTop?t.points.push({x:o.position.left+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop:h,type:"L",content:this.data.rightPoint.content}):t.points.push({x:o.position.left+10,y:this.api.parentsExpanded(p.id)?o.position.viewTop+o.actualHeight:h,type:"L",content:this.data.rightPoint.content})):t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content})}setSmoothPoints(t){const{topOffset:i,leftOffset:e,fromItemData:n,toItemData:o,fromRowData:s,toRowData:p}=t;if(!this.api.parentsExpanded(s.id)&&!this.api.parentsExpanded(p.id))return;const a=this.api.getRowViewTop(s.id),h=this.api.getRowViewTop(p.id);if(t.points.push({x:n.position.right+e,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"M",content:this.data.leftPoint.content}),n.position.viewTop===o.position.viewTop)return void t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"L",content:this.data.rightPoint.content});const d=(o.position.left-n.position.right)/2,r=n.position.right+d;if(n.position.right<=o.position.left)t.points.push({x:r,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:r,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"",content:null}),t.points.push({x:o.position.left-e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"",content:this.data.rightPoint.content});else{const d=(o.position.viewTop-n.position.viewTop)/2,l=n.position.viewTop+d+i;t.points.push({x:n.position.right+20,y:this.api.parentsExpanded(s.id)?n.position.viewTop+i:a,type:"C",content:null}),t.points.push({x:n.position.right+40,y:l,type:"",content:null}),t.points.push({x:r,y:l,type:"",content:null}),t.points.push({x:o.position.left+e-20,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"S",content:null}),t.points.push({x:o.position.left+e,y:this.api.parentsExpanded(p.id)?o.position.viewTop+i:h,type:"",content:this.data.rightPoint.content})}}setPoints(t){const{fromItemData:i,toItemData:e,fromRowData:n,toRowData:o,toItem:s,fromItem:p}=t,a=this.state.get("$data.chart.time");switch(this.api.calculateItemPosition(i.id,i,n,a,p),this.api.calculateItemPosition(e.id,e,o,a,s),t.type){case"straight":this.setStraightPoints(t);break;case"square":this.setSquarePoints(t);break;case"smooth":this.setSmoothPoints(t);break;case"square-alt":this.setSquareAltPoints(t)}}generateLines(){const t=[],i=this.api.getAllItems(),e=this.api.getRowsData(),n=this.api.getItemsData(),o=this.state.get("$data.chart.time"),s=this.state.get("$data.chart.dimensions"),p=Math.round(o.rightPx-o.leftPx),h=this.data.type;for(const d in i){const r=i[d];if(!r.dependant)continue;if(!r.dependant.length)continue;const l=e[r.rowId],c=n[d],u=r;if(c&&l)for(const f of r.dependant){const r=i[f],g=r,y=e[r.rowId],x=n[f];if(!x||!y)continue;if(o.calculatedZoomMode){if(u.time.end<o.leftGlobal&&g.time.start>o.rightGlobal)continue;if(g.time.end<o.leftGlobal&&u.time.start>o.rightGlobal)continue;if(u.time.start>o.rightGlobal&&g.time.start>o.rightGlobal)continue;if(u.time.end<o.leftGlobal&&g.time.end<o.leftGlobal)continue}if(this.api.calculateItemPosition(d,c,l,o),this.api.calculateItemPosition(f,x,y,o),-1===c.width&&-1===x.width)continue;const w=c.actualHeight/2,m=0;let v={x:0,y:0,width:p,height:s.height,topOffset:w,leftOffset:m,points:[],type:h,fromItemData:c,toItemData:x,fromItem:u,toItem:g,fromRowData:l,toRowData:y,className:a};for(const t of this.data.onLine)v=t(v);this.setPoints(v),t.push(v)}}this.data.lines=t;for(const t of this.data.onLines)this.data.lines=t(this.data.lines);this.updateData()}slot(t){const{html:i,svg:e,state:n,onDestroy:o,StyleMap:s}=t,a=new s({});o(n.subscribeAll(["$data.chart.time","$data.chart.dimensions"],(()=>{const t=n.get("$data.chart.time");a.style.width=Math.round(t.rightPx-t.leftPx)+"px";const i=n.get("$data.chart.dimensions");a.style.height=i.innerHeight+"px"})));const r=t=>{if(!t.points.length)return"";const i=t.points.slice(),e=i.shift();return[`${e.type} ${e.x} ${e.y}`,[...i.map((t=>`${t.type} ${t.x} ${t.y}`))]].join(" ")},l=(t,e)=>{const n=`left:${t.x-(0===e?this.data.leftPoint.width/2:this.data.rightPoint.width/2)}px;top:${t.y-(0===e?this.data.leftPoint.height/2:this.data.rightPoint.height/2)}px;width:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px;height:${0===e?this.data.leftPoint.width:this.data.rightPoint.width}px`;return t.content?i`<div class=${d+" "+d+"--"+this.data.type} style=${n}>
${t.content}

@@ -29,0 +29,0 @@ </div>`:null},c=t=>e`<svg width=${t.width} height=${t.height} xmlns="http://www.w3.org/2000/svg">

@@ -10,3 +10,3 @@ class t{constructor(){this.isAction=!0}}

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -13,0 +13,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,3 +10,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HighlightWeekends={})}(this,(function(e){"use strict";class t{constructor(){this.isAction=!0}}t.prototype.isAction=!0,e.Plugin=

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -13,0 +13,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,5 +23,5 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/class e{constructor(t,e){this.onDestroy=[],this.scrollWaiting=0,this.vido=t,this.state=t.state,this.api=t.api,this.data=function(t={}){const e={onStart:({items:t})=>t.after,onMove:({items:t})=>t.after,onEnd:({items:t})=>t.after},i={start:({startTime:t,time:e})=>t.startOf(e.period),end:({endTime:t})=>t},a={speed:{horizontal:1,vertical:1},edgeThreshold:{horizontal:0,vertical:0}},s=Object.assign({enabled:!0,dependant:!0,moveDependantVertically:!1,addedDependantIds:[],selectedIds:[],debug:!1,state:"",bodyClass:"gstc-items-moving",itemClass:"",movement:{x:0,y:0,time:0},threshold:{horizontal:10,vertical:10},initialItems:[],initialItemsData:{},clickedItem:null,clickedItemData:null,initialVerticalScroll:null,initialHorizontalScroll:null,initialPointerTime:null,isMoving:!1,events:Object.assign({},e),snapToTime:Object.assign({},i),autoScroll:Object.assign({},a),ignoreMissingDates:!0},t);return t.snapToTime&&(s.snapToTime=Object.assign(Object.assign({},i),t.snapToTime)),t.events&&(s.events=Object.assign(Object.assign({},e),t.events)),t.autoScroll&&(s.autoScroll=Object.assign(Object.assign({},a),t.autoScroll),t.autoScroll.edgeThreshold&&(s.autoScroll.edgeThreshold=Object.assign(Object.assign({},a.edgeThreshold),t.autoScroll.edgeThreshold)),t.autoScroll.speed&&(s.autoScroll.speed=Object.assign(Object.assign({},a.speed),t.autoScroll.speed))),s}(e),this.data.itemClass||(this.data.itemClass=this.api.getClass("timeline-chart-items-row-item")+"--moving"),this.destroy=this.destroy.bind(this),this.itemUpdateAction=this.itemUpdateAction.bind(this),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>this.timelineElement=t))),this.updateData(),this.onDestroy.push(this.state.subscribe("config.plugin.ItemMovement",(t=>{t.enabled&&t.isMoving?document.body.classList.add(t.bodyClass):document.body.classList.remove(t.bodyClass),this.data=t}))),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onDestroy.push(this.state.subscribe("config.plugin.TimelinePointer",(t=>{this.pointerData=t,this.onPointerData()})))}destroy(){this.onDestroy.forEach((t=>t())),this.api.pluginDestroyed("ItemMovement")}updateData(){this.state.update("config.plugin.ItemMovement",this.data)}getSelectedItems(e=!1){return this.state.get(`config.plugin.Selection.selected.${t}`).map((t=>{let i=this.api.getItem(t);if(e)for(const e of this.data.initialItems)if(e.id===t){i=e;break}return this.api.mergeDeep({},i)}))}getSelectedItemsData(t){const e={};for(const i of t)e[i.id]=this.api.mergeDeep({},this.api.getItemData(i.id));return e}getEventArgument(t){const e=this.api.getAllItems(),i=[];for(const a of t)i.push(this.api.mergeDeep({},e[a.id]));return{items:{initial:this.data.initialItems,before:i,after:t,targetData:this.pointerData.targetData},addedDependantIds:this.data.addedDependantIds,selectedIds:this.data.selectedIds,vido:this.vido,state:this.state,time:this.state.get("$data.chart.time")}}getDependantItems(t,e){const i=[],a=this.api.getItemsData();for(const e of t)for(const t of a[e.id].dependant)i.includes(t)||i.push(t);const s=this.state.get("config.chart.items");let o;return o=e?i.map((t=>this.data.initialItems.find((e=>e.id===t)))):i.map((t=>s[t])),o.map((t=>this.api.mergeDeep({},t)))}dispatchEvent(t,e,i=null){"onStart"===t&&(this.api.muteMethod("fixOverlapped"),this.api.muteMethod("fullReload"),this.api.muteMethod("measureRows"),this.api.muteMethod("getLastPageRowsHeight"),this.api.muteMethod("calculateVerticalScrollArea"),this.api.muteMethod("heightChange"),this.api.muteMethod("calculateRowsHeight"),this.api.muteMethod("calculateVisibleRowsHeights"),this.api.muteMethod("updateVisibleItemsListener"),this.api.muteMethod("prepareExpanded"),0===this.data.autoScroll.speed.horizontal&&0===this.data.autoScroll.speed.vertical&&(this.api.muteMethod("generateVisibleRowsAndItems"),this.api.muteMethod("prepareExpanded"))),"onEnd"===t&&(this.api.unmuteMethod("fixOverlapped"),this.api.unmuteMethod("heightChange"),this.api.unmuteMethod("calculateVerticalScrollArea"),this.api.unmuteMethod("getLastPageRowsHeight"),this.api.unmuteMethod("fullReload"),this.api.unmuteMethod("measureRows"),this.api.unmuteMethod("calculateRowsHeight"),this.api.unmuteMethod("calculateVisibleRowsHeights"),this.api.unmuteMethod("updateVisibleItemsListener"),this.api.unmuteMethod("prepareExpanded"),0===this.data.autoScroll.speed.horizontal&&0===this.data.autoScroll.speed.vertical&&(this.api.unmuteMethod("generateVisibleRowsAndItems"),this.api.unmuteMethod("prepareExpanded"))),e=e.map((t=>this.api.mergeDeep({},t)));const a=this.data.events[t](this.getEventArgument(e));let s=this.state.multi(!0);const o=this.state.get("config.chart.items");for(let t of a){t=this.api.mergeDeep({},t);const e=o[t.id];let a=!1;t.time.start===e.time.start&&t.time.end===e.time.end||(a=!0,s=s.update(`config.chart.items.${t.id}.time`,Object.assign({},t.time)));let n=!1;e.rowId!==t.rowId&&(n=!0,s=s.update(`config.chart.items.${t.id}.rowId`,t.rowId),this.api.updateItemRowMapForItem(t.id,t.rowId)),i&&(a||n)&&(s=s.update(`$data.chart.items.${t.id}`,this.api.mergeDeep({},i[t.id])))}s.done(),"onEnd"===t&&this.api.main.partialReload(!1)}getItemsForDiff(){const t=this.getSelectedItems()[0],e=this.data.initialItems.find((e=>e.id===t.id));return{modified:t,original:e}}onPointerData(){this.data.enabled&&("down"===this.pointerData.pointerState&&this.pointerData.targetType===t?this.api.plugins.TimelinePointer.isLocked("down")||this.triggerDown():"move"===this.pointerData.pointerState&&this.pointerData.targetType===t?"item-movement"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove():"up"===this.pointerData.pointerState&&this.pointerData.targetType===t&&"item-movement"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp())}triggerDown(){if(document.body.classList.add(this.data.bodyClass),this.api.plugins.TimelinePointer.lock("down","item-movement"),this.api.plugins.TimelinePointer.lock("move","item-movement"),this.api.plugins.TimelinePointer.lock("up","item-movement"),this.data.isMoving=!0,this.data.dependant){const t=this.getSelectedItems();this.data.selectedIds=t.map((t=>t.id));const e=this.getDependantItems(t,!1).filter((t=>!this.data.selectedIds.includes(t.id)));this.data.addedDependantIds=e.map((t=>t.id)),this.data.initialItems=[...t,...e]}else this.data.addedDependantIds=[],this.data.initialItems=this.getSelectedItems(),this.data.selectedIds=this.data.initialItems.map((t=>t.id));this.data.initialItemsData=this.getSelectedItemsData(this.data.initialItems),this.data.clickedItem=this.api.mergeDeep({},this.pointerData.targetData),this.data.clickedItemData=this.api.mergeDeep({},this.api.getItemData(this.data.clickedItem.id)),this.data.initialVerticalScroll=this.api.mergeDeep({},this.state.get("$data.scroll.vertical")),this.data.initialHorizontalScroll=this.api.mergeDeep({},this.state.get("$data.scroll.horizontal")),this.data.initialPointerTime=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.initialPosition.x,!0)),this.scrollWaiting=0,""!==this.data.state&&"end"!==this.data.state||(this.data.state="move"),this.dispatchEvent("onStart",this.data.initialItems),this.updateData()}scrollLeft(){if(this.data.autoScroll.speed.horizontal&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-1)}else if(this.data.autoScroll.speed.horizontal>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-this.data.autoScroll.speed.horizontal)}this.scrollWaiting=0}}scrollRight(){if(this.data.autoScroll.speed.horizontal&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+1)}else if(this.data.autoScroll.speed.horizontal>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+this.data.autoScroll.speed.horizontal)}this.scrollWaiting=0}}scrollTop(){if(this.data.autoScroll.speed.vertical){if(this.scrollWaiting++,this.data.autoScroll.speed.vertical<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.vertical))return;const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex-1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex-this.data.autoScroll.speed.vertical)}this.scrollWaiting=0}}scrollBottom(){if(this.data.autoScroll.speed.vertical){if(this.scrollWaiting++,this.data.autoScroll.speed.vertical<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.vertical))return;const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex+1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex+this.data.autoScroll.speed.vertical)}this.scrollWaiting=0}}autoScroll(){if(!this.timelineElement)return;const t=this.pointerData.currentPosition.x,e=this.pointerData.currentPosition.y,i=this.state.get("$data.chart.dimensions");t<this.data.autoScroll.edgeThreshold.horizontal?this.scrollLeft():t>i.widthWithoutScrollBar-this.data.autoScroll.edgeThreshold.horizontal?this.scrollRight():e<this.data.autoScroll.edgeThreshold.vertical?this.scrollTop():e>i.innerHeight-this.data.autoScroll.edgeThreshold.vertical&&this.scrollBottom()}moveItemVertically(t,e){if(this.data.addedDependantIds.includes(t.id)&&!this.data.moveDependantVertically)return;const i=this.state.get("$data.scroll.vertical").absolutePosPx-this.data.initialVerticalScroll.absolutePosPx,a=this.pointerData.currentPosition.y-this.pointerData.initialPosition.y,s=this.data.clickedItemData.position.viewTop-this.pointerData.initialPosition.y-this.data.clickedItemData.position.rowTop;let o=e.position.top+a+i-s;o<0&&(o=0);const n=this.api.getRowInfoFromTop(o);n.row.id!==t.rowId&&(t.rowId=n.row.id,e.position.viewTop=this.api.getRowViewTop(t.rowId),e.position.rowTop=0)}onPointerMove(){if(!this.data.enabled)return;if(!this.data.isMoving)return;const{original:t,modified:e}=this.getItemsForDiff();if(!t)return;const i=this.data.movement=Object.assign(Object.assign({},this.pointerData.movement),{time:e.time.start-t.time.start});"move"!==this.data.state&&"start"!==this.data.state||(this.data.state="move");let a,s=[];if(this.data.dependant){const t=this.getSelectedItems(!0),e=t.map((t=>t.id)),i=this.getDependantItems(t,!0).filter((t=>!e.includes(t.id)));s=i.map((t=>t.id)),a=[...t,...i]}else a=this.getSelectedItems(!0);const o={},n=this.state.get("$data.chart.time"),l=[],d=this.data.snapToTime.start({startTime:this.data.initialPointerTime,item:null,time:n,movement:i,vido:this.vido}),h=this.state.get("$data.scroll.horizontal"),r=this.api.time.getDatesDiffPx(h.data.leftGlobalDate,this.data.initialHorizontalScroll.data.leftGlobalDate,n,!0),m=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.currentPosition.x+r,!0,n)),c=this.api.time.getDatesDiffPx(d,m,n,!0);for(let t=0,e=a.length;t<e;t++){const e=this.api.mergeDeep({},a[t]),d=this.api.mergeDeep({},this.data.initialItemsData[e.id]),h=s.includes(e.id);this.moveItemVertically(e,d);const r=d.position.left+c;let m=this.api.time.getTimeFromOffsetPx(r,!0,n);if(h){const t=this.data.initialItems.find((t=>t.dependant.includes(e.id))),i=this.data.initialItemsData[t.id],a=o[i.id],s=this.api.time.getDatesDiffMs(i.time.endDate,a.time.endDate,n,!0);let l=-this.api.time.getDSTDiffForLevel(n.level,i.time.endDate.valueOf(),d.time.startDate.valueOf(),n);m=this.api.time.addTimeFromDates(d.time.startDate.valueOf(),s+l,n),l=this.api.time.getDSTDiffForLevel(n.level,a.time.endDate.valueOf(),m,n),m+=l}const p=this.api.time.date(m);let u=p;h||(u=this.data.snapToTime.start({startTime:p,item:e,time:n,movement:i,vido:this.vido}));const g=u.valueOf(),f=this.api.time.getViewOffsetPxFromDates(u,!1,n);let v=-this.api.time.getDSTDiffForLevel(n.level,e.time.start,e.time.end,n);const D=f+d.timeWidth;let I;const S=e.time.end-e.time.start;I=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(D,!0,n)):this.api.time.date(u.valueOf()+S),v+=this.api.time.getDSTDiffForLevel(n.level,g,I.valueOf(),n),I=I.add(v,"ms");let T=I;h||(T=this.data.snapToTime.end({endTime:I,item:e,time:n,movement:i,vido:this.vido})),e.time.start=u.valueOf(),e.time.end=T.valueOf(),d.time.startDate=u,d.time.endDate=T,o[e.id]=d,l.push(e)}this.dispatchEvent("onMove",l,o),c&&this.autoScroll(),this.updateData()}onEnd(){const t=this.getSelectedItems();this.dispatchEvent("onEnd",t)}onPointerUp(){document.body.classList.remove(this.data.bodyClass),this.data.enabled&&this.data.isMoving&&("move"===this.data.state&&(this.data.state="end"),this.data.isMoving=!1,this.onEnd(),this.updateData(),this.api.plugins.TimelinePointer.unlock("down"),this.api.plugins.TimelinePointer.unlock("move"),this.api.plugins.TimelinePointer.unlock("up"))}itemUpdateAction(t,e){this.data.initialItems.find((t=>t.id===e.item.id))&&this.data.isMoving?t.classList.add(this.data.itemClass):t.classList.remove(this.data.itemClass)}}function i(t={}){return function(i){const a=i.api;if(!a.isPluginInitialized("TimelinePointer"))throw new Error("TimelinePointer plugin must be initialized before ItemMovement plugin.");if(!a.isPluginInitialized("Selection"))throw new Error("Selection plugin must be initialized before ItemMovement plugin.");const s=i.state.get("config.plugin.ItemMovement");s&&(t=i.api.mergeDeep({},t,s));const o=new e(i,t);return a.pluginInitialized("ItemMovement"),o.destroy}}export{i as Plugin};

@@ -10,3 +10,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ItemMovement={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,5 +23,5 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const i="config.plugin.ItemMovement";class a{constructor(t,e){this.onDestroy=[],this.scrollWaiting=0,this.vido=t,this.state=t.state,this.api=t.api,this.data=function(t={}){const e={onStart:({items:t})=>t.after,onMove:({items:t})=>t.after,onEnd:({items:t})=>t.after},i={start:({startTime:t,time:e})=>t.startOf(e.period),end:({endTime:t})=>t},a={speed:{horizontal:1,vertical:1},edgeThreshold:{horizontal:0,vertical:0}},s=Object.assign({enabled:!0,dependant:!0,moveDependantVertically:!1,addedDependantIds:[],selectedIds:[],debug:!1,state:"",bodyClass:"gstc-items-moving",itemClass:"",movement:{x:0,y:0,time:0},threshold:{horizontal:10,vertical:10},initialItems:[],initialItemsData:{},clickedItem:null,clickedItemData:null,initialVerticalScroll:null,initialHorizontalScroll:null,initialPointerTime:null,isMoving:!1,events:Object.assign({},e),snapToTime:Object.assign({},i),autoScroll:Object.assign({},a),ignoreMissingDates:!0},t);return t.snapToTime&&(s.snapToTime=Object.assign(Object.assign({},i),t.snapToTime)),t.events&&(s.events=Object.assign(Object.assign({},e),t.events)),t.autoScroll&&(s.autoScroll=Object.assign(Object.assign({},a),t.autoScroll),t.autoScroll.edgeThreshold&&(s.autoScroll.edgeThreshold=Object.assign(Object.assign({},a.edgeThreshold),t.autoScroll.edgeThreshold)),t.autoScroll.speed&&(s.autoScroll.speed=Object.assign(Object.assign({},a.speed),t.autoScroll.speed))),s}(e),this.data.itemClass||(this.data.itemClass=this.api.getClass("timeline-chart-items-row-item")+"--moving"),this.destroy=this.destroy.bind(this),this.itemUpdateAction=this.itemUpdateAction.bind(this),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>this.timelineElement=t))),this.updateData(),this.onDestroy.push(this.state.subscribe("config.plugin.ItemMovement",(t=>{t.enabled&&t.isMoving?document.body.classList.add(t.bodyClass):document.body.classList.remove(t.bodyClass),this.data=t}))),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onDestroy.push(this.state.subscribe("config.plugin.TimelinePointer",(t=>{this.pointerData=t,this.onPointerData()})))}destroy(){this.onDestroy.forEach((t=>t())),this.api.pluginDestroyed("ItemMovement")}updateData(){this.state.update(i,this.data)}getSelectedItems(t=!1){return this.state.get(`config.plugin.Selection.selected.${e}`).map((e=>{let i=this.api.getItem(e);if(t)for(const t of this.data.initialItems)if(t.id===e){i=t;break}return this.api.mergeDeep({},i)}))}getSelectedItemsData(t){const e={};for(const i of t)e[i.id]=this.api.mergeDeep({},this.api.getItemData(i.id));return e}getEventArgument(t){const e=this.api.getAllItems(),i=[];for(const a of t)i.push(this.api.mergeDeep({},e[a.id]));return{items:{initial:this.data.initialItems,before:i,after:t,targetData:this.pointerData.targetData},addedDependantIds:this.data.addedDependantIds,selectedIds:this.data.selectedIds,vido:this.vido,state:this.state,time:this.state.get("$data.chart.time")}}getDependantItems(t,e){const i=[],a=this.api.getItemsData();for(const e of t)for(const t of a[e.id].dependant)i.includes(t)||i.push(t);const s=this.state.get("config.chart.items");let o;return o=e?i.map((t=>this.data.initialItems.find((e=>e.id===t)))):i.map((t=>s[t])),o.map((t=>this.api.mergeDeep({},t)))}dispatchEvent(t,e,i=null){"onStart"===t&&(this.api.muteMethod("fixOverlapped"),this.api.muteMethod("fullReload"),this.api.muteMethod("measureRows"),this.api.muteMethod("getLastPageRowsHeight"),this.api.muteMethod("calculateVerticalScrollArea"),this.api.muteMethod("heightChange"),this.api.muteMethod("calculateRowsHeight"),this.api.muteMethod("calculateVisibleRowsHeights"),this.api.muteMethod("updateVisibleItemsListener"),this.api.muteMethod("prepareExpanded"),0===this.data.autoScroll.speed.horizontal&&0===this.data.autoScroll.speed.vertical&&(this.api.muteMethod("generateVisibleRowsAndItems"),this.api.muteMethod("prepareExpanded"))),"onEnd"===t&&(this.api.unmuteMethod("fixOverlapped"),this.api.unmuteMethod("heightChange"),this.api.unmuteMethod("calculateVerticalScrollArea"),this.api.unmuteMethod("getLastPageRowsHeight"),this.api.unmuteMethod("fullReload"),this.api.unmuteMethod("measureRows"),this.api.unmuteMethod("calculateRowsHeight"),this.api.unmuteMethod("calculateVisibleRowsHeights"),this.api.unmuteMethod("updateVisibleItemsListener"),this.api.unmuteMethod("prepareExpanded"),0===this.data.autoScroll.speed.horizontal&&0===this.data.autoScroll.speed.vertical&&(this.api.unmuteMethod("generateVisibleRowsAndItems"),this.api.unmuteMethod("prepareExpanded"))),e=e.map((t=>this.api.mergeDeep({},t)));const a=this.data.events[t](this.getEventArgument(e));let s=this.state.multi(!0);const o=this.state.get("config.chart.items");for(let t of a){t=this.api.mergeDeep({},t);const e=o[t.id];let a=!1;t.time.start===e.time.start&&t.time.end===e.time.end||(a=!0,s=s.update(`config.chart.items.${t.id}.time`,Object.assign({},t.time)));let n=!1;e.rowId!==t.rowId&&(n=!0,s=s.update(`config.chart.items.${t.id}.rowId`,t.rowId),this.api.updateItemRowMapForItem(t.id,t.rowId)),i&&(a||n)&&(s=s.update(`$data.chart.items.${t.id}`,this.api.mergeDeep({},i[t.id])))}s.done(),"onEnd"===t&&this.api.main.partialReload(!1)}getItemsForDiff(){const t=this.getSelectedItems()[0],e=this.data.initialItems.find((e=>e.id===t.id));return{modified:t,original:e}}onPointerData(){this.data.enabled&&("down"===this.pointerData.pointerState&&this.pointerData.targetType===e?this.api.plugins.TimelinePointer.isLocked("down")||this.triggerDown():"move"===this.pointerData.pointerState&&this.pointerData.targetType===e?"item-movement"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove():"up"===this.pointerData.pointerState&&this.pointerData.targetType===e&&"item-movement"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp())}triggerDown(){if(document.body.classList.add(this.data.bodyClass),this.api.plugins.TimelinePointer.lock("down","item-movement"),this.api.plugins.TimelinePointer.lock("move","item-movement"),this.api.plugins.TimelinePointer.lock("up","item-movement"),this.data.isMoving=!0,this.data.dependant){const t=this.getSelectedItems();this.data.selectedIds=t.map((t=>t.id));const e=this.getDependantItems(t,!1).filter((t=>!this.data.selectedIds.includes(t.id)));this.data.addedDependantIds=e.map((t=>t.id)),this.data.initialItems=[...t,...e]}else this.data.addedDependantIds=[],this.data.initialItems=this.getSelectedItems(),this.data.selectedIds=this.data.initialItems.map((t=>t.id));this.data.initialItemsData=this.getSelectedItemsData(this.data.initialItems),this.data.clickedItem=this.api.mergeDeep({},this.pointerData.targetData),this.data.clickedItemData=this.api.mergeDeep({},this.api.getItemData(this.data.clickedItem.id)),this.data.initialVerticalScroll=this.api.mergeDeep({},this.state.get("$data.scroll.vertical")),this.data.initialHorizontalScroll=this.api.mergeDeep({},this.state.get("$data.scroll.horizontal")),this.data.initialPointerTime=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.initialPosition.x,!0)),this.scrollWaiting=0,""!==this.data.state&&"end"!==this.data.state||(this.data.state="move"),this.dispatchEvent("onStart",this.data.initialItems),this.updateData()}scrollLeft(){if(this.data.autoScroll.speed.horizontal&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-1)}else if(this.data.autoScroll.speed.horizontal>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-this.data.autoScroll.speed.horizontal)}this.scrollWaiting=0}}scrollRight(){if(this.data.autoScroll.speed.horizontal&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+1)}else if(this.data.autoScroll.speed.horizontal>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+this.data.autoScroll.speed.horizontal)}this.scrollWaiting=0}}scrollTop(){if(this.data.autoScroll.speed.vertical){if(this.scrollWaiting++,this.data.autoScroll.speed.vertical<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.vertical))return;const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex-1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex-this.data.autoScroll.speed.vertical)}this.scrollWaiting=0}}scrollBottom(){if(this.data.autoScroll.speed.vertical){if(this.scrollWaiting++,this.data.autoScroll.speed.vertical<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.vertical))return;const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex+1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop();this.api.setScrollTop(t.dataIndex+this.data.autoScroll.speed.vertical)}this.scrollWaiting=0}}autoScroll(){if(!this.timelineElement)return;const t=this.pointerData.currentPosition.x,e=this.pointerData.currentPosition.y,i=this.state.get("$data.chart.dimensions");t<this.data.autoScroll.edgeThreshold.horizontal?this.scrollLeft():t>i.widthWithoutScrollBar-this.data.autoScroll.edgeThreshold.horizontal?this.scrollRight():e<this.data.autoScroll.edgeThreshold.vertical?this.scrollTop():e>i.innerHeight-this.data.autoScroll.edgeThreshold.vertical&&this.scrollBottom()}moveItemVertically(t,e){if(this.data.addedDependantIds.includes(t.id)&&!this.data.moveDependantVertically)return;const i=this.state.get("$data.scroll.vertical").absolutePosPx-this.data.initialVerticalScroll.absolutePosPx,a=this.pointerData.currentPosition.y-this.pointerData.initialPosition.y,s=this.data.clickedItemData.position.viewTop-this.pointerData.initialPosition.y-this.data.clickedItemData.position.rowTop;let o=e.position.top+a+i-s;o<0&&(o=0);const n=this.api.getRowInfoFromTop(o);n.row.id!==t.rowId&&(t.rowId=n.row.id,e.position.viewTop=this.api.getRowViewTop(t.rowId),e.position.rowTop=0)}onPointerMove(){if(!this.data.enabled)return;if(!this.data.isMoving)return;const{original:t,modified:e}=this.getItemsForDiff();if(!t)return;const i=this.data.movement=Object.assign(Object.assign({},this.pointerData.movement),{time:e.time.start-t.time.start});"move"!==this.data.state&&"start"!==this.data.state||(this.data.state="move");let a,s=[];if(this.data.dependant){const t=this.getSelectedItems(!0),e=t.map((t=>t.id)),i=this.getDependantItems(t,!0).filter((t=>!e.includes(t.id)));s=i.map((t=>t.id)),a=[...t,...i]}else a=this.getSelectedItems(!0);const o={},n=this.state.get("$data.chart.time"),l=[],d=this.data.snapToTime.start({startTime:this.data.initialPointerTime,item:null,time:n,movement:i,vido:this.vido}),h=this.state.get("$data.scroll.horizontal"),r=this.api.time.getDatesDiffPx(h.data.leftGlobalDate,this.data.initialHorizontalScroll.data.leftGlobalDate,n,!0),c=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.currentPosition.x+r,!0,n)),m=this.api.time.getDatesDiffPx(d,c,n,!0);for(let t=0,e=a.length;t<e;t++){const e=this.api.mergeDeep({},a[t]),d=this.api.mergeDeep({},this.data.initialItemsData[e.id]),h=s.includes(e.id);this.moveItemVertically(e,d);const r=d.position.left+m;let c=this.api.time.getTimeFromOffsetPx(r,!0,n);if(h){const t=this.data.initialItems.find((t=>t.dependant.includes(e.id))),i=this.data.initialItemsData[t.id],a=o[i.id],s=this.api.time.getDatesDiffMs(i.time.endDate,a.time.endDate,n,!0);let l=-this.api.time.getDSTDiffForLevel(n.level,i.time.endDate.valueOf(),d.time.startDate.valueOf(),n);c=this.api.time.addTimeFromDates(d.time.startDate.valueOf(),s+l,n),l=this.api.time.getDSTDiffForLevel(n.level,a.time.endDate.valueOf(),c,n),c+=l}const p=this.api.time.date(c);let u=p;h||(u=this.data.snapToTime.start({startTime:p,item:e,time:n,movement:i,vido:this.vido}));const g=u.valueOf(),f=this.api.time.getViewOffsetPxFromDates(u,!1,n);let v=-this.api.time.getDSTDiffForLevel(n.level,e.time.start,e.time.end,n);const D=f+d.timeWidth;let I;const S=e.time.end-e.time.start;I=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(D,!0,n)):this.api.time.date(u.valueOf()+S),v+=this.api.time.getDSTDiffForLevel(n.level,g,I.valueOf(),n),I=I.add(v,"ms");let T=I;h||(T=this.data.snapToTime.end({endTime:I,item:e,time:n,movement:i,vido:this.vido})),e.time.start=u.valueOf(),e.time.end=T.valueOf(),d.time.startDate=u,d.time.endDate=T,o[e.id]=d,l.push(e)}this.dispatchEvent("onMove",l,o),m&&this.autoScroll(),this.updateData()}onEnd(){const t=this.getSelectedItems();this.dispatchEvent("onEnd",t)}onPointerUp(){document.body.classList.remove(this.data.bodyClass),this.data.enabled&&this.data.isMoving&&("move"===this.data.state&&(this.data.state="end"),this.data.isMoving=!1,this.onEnd(),this.updateData(),this.api.plugins.TimelinePointer.unlock("down"),this.api.plugins.TimelinePointer.unlock("move"),this.api.plugins.TimelinePointer.unlock("up"))}itemUpdateAction(t,e){this.data.initialItems.find((t=>t.id===e.item.id))&&this.data.isMoving?t.classList.add(this.data.itemClass):t.classList.remove(this.data.itemClass)}}t.Plugin=function(t={}){return function(e){const s=e.api;if(!s.isPluginInitialized("TimelinePointer"))throw new Error("TimelinePointer plugin must be initialized before ItemMovement plugin.");if(!s.isPluginInitialized("Selection"))throw new Error("Selection plugin must be initialized before ItemMovement plugin.");const o=e.state.get(i);o&&(t=e.api.mergeDeep({},t,o));const n=new a(e,t);return s.pluginInitialized("ItemMovement"),n.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -36,5 +36,5 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const i=e("chart-timeline-items-row-item-resizing-handle-content-line");const s="chart-timeline-items-row-item-resizing-handle",a=e(s);class n{constructor(t,e){this.onDestroy=[],this.scrollWaiting=0,this.vido=t,this.state=t.state,this.api=t.api,this.data=function(t={}){const e={onStart:({items:t})=>t.after,onResize:({items:t})=>t.after,onEnd:({items:t})=>t.after},i={start:({startTime:t,time:e})=>t.startOf(e.period),end:({endTime:t,time:e})=>t.endOf(e.period)},s={width:18,horizontalMargin:0,verticalMargin:0,outside:!1,outsideWidth:14,outsideHorizontalMargin:6,onlyWhenSelected:!0},a=Object.assign({enabled:!0,dependant:!0,addedDependantIds:[],selectedIds:[],debug:!1,state:"",content:null,bodyClass:"gstc-items-resizing",bodyClassLeft:"gstc-items-resizing-left",bodyClassRight:"gstc-items-resizing-right",outsideWidthThreshold:100,movement:{px:0,time:0},initialItems:[],initialItemsData:{},initialHorizontalScroll:null,leftIsMoving:!1,rightIsMoving:!1,handle:Object.assign({},s),events:Object.assign({},e),snapToTime:Object.assign({},i),autoScroll:{speed:1,edgeThreshold:0},ignoreMissingDates:!0},t);return t.snapToTime&&(a.snapToTime=Object.assign(Object.assign({},i),t.snapToTime)),t.events&&(a.events=Object.assign(Object.assign({},e),t.events)),t.handle&&(a.handle=Object.assign(Object.assign({},s),t.handle)),t.autoScroll&&(a.autoScroll=Object.assign(Object.assign({},a.autoScroll),t.autoScroll)),a}(e),this.html=t.html,this.data.content||(this.data.content={left:this.html`<div class=${i}></div><div class=${i}></div>`,right:this.html`<div class=${i}></div><div class=${i}></div>`}),this.innerSlot=this.innerSlot.bind(this),this.outerSlot=this.outerSlot.bind(this),this.onRightPointerDown=this.onRightPointerDown.bind(this),this.onRightPointerMove=this.onRightPointerMove.bind(this),this.onRightPointerUp=this.onRightPointerUp.bind(this),this.onLeftPointerDown=this.onLeftPointerDown.bind(this),this.onLeftPointerMove=this.onLeftPointerMove.bind(this),this.onLeftPointerUp=this.onLeftPointerUp.bind(this),this.destroy=this.destroy.bind(this),this.updateData(),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>this.timelineElement=t))),this.onDestroy.push(this.state.subscribe("config.plugin.ItemResizing",(t=>{t.enabled?document.body.classList.add(t.bodyClass):document.body.classList.remove(t.bodyClass),this.data=t}))),this.onDestroy.push(this.state.subscribe("config.plugin.TimelinePointer",(t=>{this.pointerData=t,this.onPointerData()}))),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>(t.includes(this.innerSlot)||t.push(this.innerSlot),t))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>(t.includes(this.outerSlot)||t.push(this.outerSlot),t)))}destroy(){this.onDestroy.forEach((t=>t())),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>t.filter((t=>t!==this.innerSlot)))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>t.filter((t=>t!==this.outerSlot)))),this.api.pluginDestroyed("ItemResizing")}updateData(){this.state.update("config.plugin.ItemResizing",this.data)}setUpClasses(t=!1){this.leftClassName=this.api.getClass(s),this.leftClassName+=" "+this.leftClassName+"--left",this.rightClassName=this.api.getClass(s),this.rightClassName+=" "+this.rightClassName+"--right",t&&(this.leftClassName+=` ${this.api.getClass(s)}--left-outside`,this.rightClassName+=` ${this.api.getClass(s)}--right-outside`)}getSelectedItems(){return this.state.get(`config.plugin.Selection.selected.${t}`).map((t=>this.api.mergeDeep({},this.api.getItem(t))))}getSelectedItemsData(t){const e={};for(const i of t)e[i.id]=this.api.mergeDeep({},this.api.getItemData(i.id));return e}updateRightStyleMap(t,e){const i=this.api.getItemData(t.id);return e.style.top="0px",this.data.handle.outside||i.actualWidth<this.data.outsideWidthThreshold?(e.style.position="absolute",e.style.left=i.position.actualRight+this.data.handle.outsideHorizontalMargin+"px",e.style.width=this.data.handle.outsideWidth+"px",e.style.top=i.position.actualRowTop+"px",this.setUpClasses(!0)):(e.style.position="static",e.style.width=this.data.handle.width+"px",this.setUpClasses(!1)),e.style.height=i.actualHeight-2*this.data.handle.verticalMargin+"px",i.position.right!==i.position.actualRight?e.style.display="none":e.style.display="flex",e}updateLeftStyleMap(t,e){const i=this.api.getItemData(t.id);return e.style.top="0px",this.data.handle.outside||i.actualWidth<this.data.outsideWidthThreshold?(e.style.position="absolute",e.style.left=i.position.actualLeft-(this.data.handle.outsideWidth+this.data.handle.outsideHorizontalMargin)+"px",e.style.width=this.data.handle.outsideWidth+"px",e.style.top=i.position.actualRowTop+"px",this.setUpClasses(!0)):(e.style.position="static",e.style.left=this.data.handle.horizontalMargin+"px",e.style.width=this.data.handle.width+"px",this.setUpClasses(!1)),e.style.height=i.actualHeight-2*this.data.handle.verticalMargin+"px",i.position.left!==i.position.actualLeft?e.style.display="none":e.style.display="flex",e}getEventArgument(t){const e=this.api.getAllItems(),i=[];for(const s of t)i.push(this.api.mergeDeep({},e[s.id]));return{items:{initial:this.data.initialItems,before:i,after:t},addedDependantIds:this.data.addedDependantIds,selectedIds:this.data.selectedIds,vido:this.vido,state:this.state,time:this.state.get("$data.chart.time")}}getDependantItems(t){const e=[],i=this.api.getItemsData();for(const s of t)for(const t of i[s.id].dependant)e.includes(t)||e.push(t);const s=this.state.get("config.chart.items");return e.map((t=>s[t])).map((t=>this.api.mergeDeep({},t)))}dispatchEvent(t,e,i=null){"onStart"===t&&(this.api.muteMethod("fixOverlapped"),this.api.muteMethod("fullReload"),this.api.muteMethod("recalculateRowPercents"),this.api.muteMethod("getLastPageRowsHeight"),this.api.muteMethod("calculateVerticalScrollArea"),this.api.muteMethod("heightChange"),this.api.muteMethod("calculateRowsHeight"),this.api.muteMethod("updateVisibleItemsListener"),this.api.muteMethod("prepareExpanded"),0===this.data.autoScroll.speed&&0===this.data.autoScroll.speed&&(this.api.muteMethod("generateVisibleRowsAndItems"),this.api.muteMethod("calculateVisibleRowsHeights"),this.api.muteMethod("prepareExpanded"))),"onEnd"===t&&(this.api.unmuteMethod("fixOverlapped"),this.api.unmuteMethod("heightChange"),this.api.unmuteMethod("calculateVerticalScrollArea"),this.api.unmuteMethod("getLastPageRowsHeight"),this.api.unmuteMethod("recalculateRowPercents"),this.api.unmuteMethod("fullReload"),this.api.unmuteMethod("calculateRowsHeight"),this.api.unmuteMethod("updateVisibleItemsListener"),this.api.unmuteMethod("prepareExpanded"),0===this.data.autoScroll.speed&&0===this.data.autoScroll.speed&&(this.api.unmuteMethod("generateVisibleRowsAndItems"),this.api.unmuteMethod("calculateVisibleRowsHeights"),this.api.unmuteMethod("prepareExpanded"))),e=e.map((t=>this.api.mergeDeep({},t)));const s=this.data.events[t](this.getEventArgument(e));let a=this.state.multi(!0);const n=this.state.get("config.chart.items");for(const t of s){let e=!1;const s=n[t.id];t.time.start===s.time.start&&t.time.end===s.time.end||(e=!0,a=a.update(`config.chart.items.${t.id}.time`,t.time)),i&&e&&(a=a.update(`$data.chart.items.${t.id}`,this.api.mergeDeep({},i[t.id])))}a.done(),"onEnd"===t&&this.api.main.partialReload(!1)}getItemsForDiff(){const t=this.getSelectedItems()[0],e=this.data.initialItems.find((e=>e.id===t.id));return{modified:t,original:e}}onPointerData(){this.data.enabled&&("down"===this.pointerData.pointerState&&this.pointerData.targetType===t?this.api.plugins.TimelinePointer.isLocked("down")||this.onPointerDown():"move"===this.pointerData.pointerState&&this.pointerData.targetType===t?"item-resizing"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove():"up"===this.pointerData.pointerState&&this.pointerData.targetType===t&&"item-resizing"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp())}onPointerDown(){const t=this.pointerData.currentTarget.closest("."+a);if(t&&!this.api.plugins.TimelinePointer.isLocked("down")){if(this.api.plugins.TimelinePointer.lock("down","item-resizing"),this.api.plugins.TimelinePointer.lock("move","item-resizing"),this.api.plugins.TimelinePointer.lock("up","item-resizing"),this.pointerData.events.down.preventDefault(),this.pointerData.events.down.stopPropagation(),this.data.dependant){const t=this.getSelectedItems();this.data.selectedIds=t.map((t=>t.id));const e=this.getDependantItems(t).filter((t=>!this.data.selectedIds.includes(t.id)));this.data.addedDependantIds=e.map((t=>t.id)),this.data.initialItems=[...t,...e]}else this.data.initialItems=this.getSelectedItems(),this.data.addedDependantIds=[],this.data.selectedIds=this.data.initialItems.map((t=>t.id));this.data.initialItemsData=this.getSelectedItemsData(this.data.initialItems),this.data.initialHorizontalScroll=this.api.mergeDeep({},this.state.get("$data.scroll.horizontal")),""!==this.data.state&&"end"!==this.data.state||(this.data.state="resize"),t.classList.contains(a+"--left")&&this.onLeftPointerDown(),t.classList.contains(a+"--right")&&this.onRightPointerDown(),this.dispatchEvent("onStart",this.data.initialItems)}}onLeftPointerDown(){this.data.enabled&&(document.body.classList.add(this.data.bodyClassLeft),this.data.leftIsMoving=!0,this.updateData())}onRightPointerDown(){this.data.enabled&&(document.body.classList.add(this.data.bodyClassRight),this.data.rightIsMoving=!0,this.updateData())}scrollLeft(){if(this.data.autoScroll.speed&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-1)}else if(this.data.autoScroll.speed>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-this.data.autoScroll.speed)}this.scrollWaiting=0}}scrollRight(){if(this.data.autoScroll.speed&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+1)}else if(this.data.autoScroll.speed>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+this.data.autoScroll.speed)}this.scrollWaiting=0}}autoScroll(){if(!this.timelineElement)return;const t=this.pointerData.currentPosition.x,e=this.timelineElement.getBoundingClientRect();t<this.data.autoScroll.edgeThreshold?this.scrollLeft():t>e.width-this.data.autoScroll.edgeThreshold&&this.scrollRight()}onPointerMove(){if(!this.data.enabled)return;const{original:t,modified:e}=this.getItemsForDiff();t&&(this.data.movement={px:this.pointerData.movement.x,time:e.time.start-t.time.start},"resize"!==this.data.state&&"start"!==this.data.state||(this.data.state="resize"),this.pointerData.movement.x&&this.autoScroll(),this.data.leftIsMoving&&this.onLeftPointerMove(),this.data.rightIsMoving&&this.onRightPointerMove())}onLeftPointerMove(){if(!this.data.enabled||!this.data.leftIsMoving)return;const t=this.getSelectedItems(),e={},i=this.state.get("$data.chart.time"),{original:s,modified:a}=this.getItemsForDiff(),n=this.data.movement={px:this.pointerData.movement.x,time:a.time.start-s.time.start},o=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.initialPosition.x,!0,i)),h=this.data.snapToTime.start({startTime:o,item:t[0],time:i,movement:n,vido:this.vido}),d=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.currentPosition.x,!0,i)),l=this.api.time.getDatesDiffPx(h,d,i,!0);for(let s=0,a=t.length;s<a;s++){const a=t[s],o=this.api.mergeDeep({},this.api.getItemData(a.id));let h=this.api.mergeDeep({},this.data.initialItemsData[a.id]).position.left+l;h>o.position.right-a.minWidth&&(h=o.position.right-a.minWidth);const d=this.api.time.getTimeFromOffsetPx(h,!0,i),r=this.data.snapToTime.start({startTime:this.api.time.date(d),item:a,time:i,movement:n,vido:this.vido});a.time.start=r.valueOf(),o.time.startDate=r,e[a.id]=o}this.dispatchEvent("onResize",t,e),this.updateData()}onRightPointerMove(){if(!this.data.enabled||!this.data.rightIsMoving)return;let t,e,i;if(this.data.dependant){const s=this.getSelectedItems();e=s.map((t=>t.id));const a=this.getDependantItems(s).filter((t=>!e.includes(t.id)));i=a.map((t=>t.id)),t=[...s,...a]}else t=this.getSelectedItems();const s={},a=this.state.get("$data.chart.time"),{original:n,modified:o}=this.getItemsForDiff(),h=this.data.movement={px:this.pointerData.movement.x,time:o.time.start-n.time.start},d=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.initialPosition.x,!0,a)),l=this.data.snapToTime.end({endTime:d,item:null,time:a,movement:h,vido:this.vido}),r=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.currentPosition.x,!0,a)),m=this.api.time.getDatesDiffPx(l,r,a,!0);for(let e=0,n=t.length;e<n;e++){const n=t[e],o=this.api.mergeDeep({},this.api.getItemData(n.id)),d=this.api.mergeDeep({},this.data.initialItemsData[n.id]),l=i.includes(n.id);let r=d.position.left+d.timeWidth+m;!l&&r<o.position.left+n.minWidth&&(r=o.position.left+n.minWidth);const p=this.api.time.getTimeFromOffsetPx(r,!0,a);let c=this.api.time.date(p);if(l||(c=this.data.snapToTime.end({endTime:this.api.time.date(p),item:n,time:a,movement:h,vido:this.vido})),l){const t=this.data.initialItems.find((t=>t.dependant.includes(d.id))),e=this.data.initialItemsData[t.id],i=s[e.id],h=this.api.time.getDatesDiffMs(e.time.endDate,i.time.endDate,a,!0);let l=-this.api.time.getDSTDiffForLevel(a.level,e.time.endDate.valueOf(),d.time.startDate.valueOf(),a),r=this.api.time.addTimeFromDates(d.time.startDate.valueOf(),h+l,a);l=this.api.time.getDSTDiffForLevel(a.level,i.time.endDate.valueOf(),r,a),r+=l;const m=this.api.time.date(r),p=m.valueOf(),g=this.api.time.getViewOffsetPxFromDates(m,!1,a);let u=-this.api.time.getDSTDiffForLevel(a.level,d.time.startDate.valueOf(),d.time.endDate.valueOf(),a);const f=g+d.timeWidth;let v;const D=d.time.endDate.valueOf()-d.time.startDate.valueOf();v=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(f,!0,a)):this.api.time.date(m.valueOf()+D),u+=this.api.time.getDSTDiffForLevel(a.level,p,v.valueOf(),a),v=v.add(u,"ms"),c=v,n.time.start=m.valueOf(),o.time.startDate=m}n.time.end=c.valueOf(),o.time.endDate=c,s[n.id]=o}this.dispatchEvent("onResize",t,s),this.updateData()}onEnd(){const t=this.getSelectedItems();this.dispatchEvent("onEnd",t)}onPointerUp(){"resize"===this.data.state&&(this.data.state="end"),this.onLeftPointerUp(),this.onRightPointerUp(),this.onEnd(),this.updateData(),this.api.plugins.TimelinePointer.unlock("down"),this.api.plugins.TimelinePointer.unlock("move"),this.api.plugins.TimelinePointer.unlock("up")}onLeftPointerUp(){document.body.classList.remove(this.data.bodyClassLeft),this.data.enabled&&this.data.leftIsMoving&&(this.data.leftIsMoving=!1,this.onEnd(),this.updateData())}onRightPointerUp(){document.body.classList.remove(this.data.bodyClassRight),this.data.enabled&&this.data.rightIsMoving&&(this.data.rightIsMoving=!1)}innerSlot(t,e){let i,s,a;const n=new t.StyleMap({}),o=new t.StyleMap({});return t.onChange((h=>{if(!(e=h)||!e.item)return;const d=e.item;if(!d)return;const l=this.api.getItemData(d.id);if(!l)return;let r;i=!l.detached,this.data.handle.onlyWhenSelected&&(i=i&&l.selected),i=i&&!(this.data.handle.outside||l.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(d,o),this.updateLeftStyleMap(d,n),r="function"==typeof this.data.content?this.data.content({item:d,vido:t}):"object"!=typeof this.data.content||"left"in this.data.content?this.data.content:{left:this.data.content,right:this.data.content},s=this.html`<div class=${this.leftClassName} data-gstcid=${e.item.id} style=${n.directive()}>${r.left}</div>`,a=this.html`<div class=${this.rightClassName} data-gstcid=${e.item.id} style=${o.directive()}>${r.right}</div>`,t.update()})),t=>this.html`${i?s:null}${t}${i?a:null}`}outerSlot(e,i){let s,a,n;const o=new e.StyleMap({}),h=new e.StyleMap({});return e.onChange((d=>{if(!(i=d)||!i.item)return;const l=i.item;if(!l)return;const r=this.api.getItemData(l.id);if(!r)return;let m;s=!r.detached,this.data.handle.onlyWhenSelected&&(s=s&&r.selected),s=s&&(this.data.handle.outside||r.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(l,h),this.updateLeftStyleMap(l,o),m="function"==typeof this.data.content?this.data.content({item:l,vido:e}):"object"!=typeof this.data.content||"left"in this.data.content?this.data.content:{left:this.data.content,right:this.data.content},a=this.html`<div class=${this.leftClassName} data-type=${t} data-gstcid=${i.item.id} style=${o.directive()}>${m.left}</div>`,n=this.html`<div class=${this.rightClassName} data-type=${t} data-gstcid=${i.item.id} style=${h.directive()}>${m.right}</div>`,e.update()})),t=>this.html`${s?a:null}${t}${s?n:null}`}}function o(t={}){return function(e){const i=e.api;if(!i.isPluginInitialized("TimelinePointer"))throw new Error("TimelinePointer plugin must be initialized before ItemResizing plugin.");if(!i.isPluginInitialized("Selection"))throw new Error("Selection plugin must be initialized before ItemResizing plugin.");if(i.isPluginInitialized("ItemMovement"))throw new Error("ItemResizing plugin must be initialized before ItemMovement plugin.");const s=e.state.get("config.plugin.ItemResizing");s&&(t=e.api.mergeDeep({},t,s));const a=new n(e,t);return i.pluginInitialized("ItemResizing"),a.destroy}}export{o as Plugin};

@@ -10,3 +10,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ItemResizing={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -36,5 +36,5 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const a=s("chart-timeline-items-row-item-resizing-handle-content-line");const n="config.plugin.ItemResizing",o="chart-timeline-items-row-item-resizing-handle",d=s(o),h="--left",l="--right";class r{constructor(t,e){this.onDestroy=[],this.scrollWaiting=0,this.vido=t,this.state=t.state,this.api=t.api,this.data=function(t={}){const e={onStart:({items:t})=>t.after,onResize:({items:t})=>t.after,onEnd:({items:t})=>t.after},i={start:({startTime:t,time:e})=>t.startOf(e.period),end:({endTime:t,time:e})=>t.endOf(e.period)},s={width:18,horizontalMargin:0,verticalMargin:0,outside:!1,outsideWidth:14,outsideHorizontalMargin:6,onlyWhenSelected:!0},a=Object.assign({enabled:!0,dependant:!0,addedDependantIds:[],selectedIds:[],debug:!1,state:"",content:null,bodyClass:"gstc-items-resizing",bodyClassLeft:"gstc-items-resizing-left",bodyClassRight:"gstc-items-resizing-right",outsideWidthThreshold:100,movement:{px:0,time:0},initialItems:[],initialItemsData:{},initialHorizontalScroll:null,leftIsMoving:!1,rightIsMoving:!1,handle:Object.assign({},s),events:Object.assign({},e),snapToTime:Object.assign({},i),autoScroll:{speed:1,edgeThreshold:0},ignoreMissingDates:!0},t);return t.snapToTime&&(a.snapToTime=Object.assign(Object.assign({},i),t.snapToTime)),t.events&&(a.events=Object.assign(Object.assign({},e),t.events)),t.handle&&(a.handle=Object.assign(Object.assign({},s),t.handle)),t.autoScroll&&(a.autoScroll=Object.assign(Object.assign({},a.autoScroll),t.autoScroll)),a}(e),this.html=t.html,this.data.content||(this.data.content={left:this.html`<div class=${a}></div><div class=${a}></div>`,right:this.html`<div class=${a}></div><div class=${a}></div>`}),this.innerSlot=this.innerSlot.bind(this),this.outerSlot=this.outerSlot.bind(this),this.onRightPointerDown=this.onRightPointerDown.bind(this),this.onRightPointerMove=this.onRightPointerMove.bind(this),this.onRightPointerUp=this.onRightPointerUp.bind(this),this.onLeftPointerDown=this.onLeftPointerDown.bind(this),this.onLeftPointerMove=this.onLeftPointerMove.bind(this),this.onLeftPointerUp=this.onLeftPointerUp.bind(this),this.destroy=this.destroy.bind(this),this.updateData(),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>this.timelineElement=t))),this.onDestroy.push(this.state.subscribe("config.plugin.ItemResizing",(t=>{t.enabled?document.body.classList.add(t.bodyClass):document.body.classList.remove(t.bodyClass),this.data=t}))),this.onDestroy.push(this.state.subscribe("config.plugin.TimelinePointer",(t=>{this.pointerData=t,this.onPointerData()}))),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>(t.includes(this.innerSlot)||t.push(this.innerSlot),t))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>(t.includes(this.outerSlot)||t.push(this.outerSlot),t)))}destroy(){this.onDestroy.forEach((t=>t())),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>t.filter((t=>t!==this.innerSlot)))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>t.filter((t=>t!==this.outerSlot)))),this.api.pluginDestroyed("ItemResizing")}updateData(){this.state.update(n,this.data)}setUpClasses(t=!1){this.leftClassName=this.api.getClass(o),this.leftClassName+=" "+this.leftClassName+h,this.rightClassName=this.api.getClass(o),this.rightClassName+=" "+this.rightClassName+l,t&&(this.leftClassName+=` ${this.api.getClass(o)}--left-outside`,this.rightClassName+=` ${this.api.getClass(o)}--right-outside`)}getSelectedItems(){return this.state.get(`config.plugin.Selection.selected.${e}`).map((t=>this.api.mergeDeep({},this.api.getItem(t))))}getSelectedItemsData(t){const e={};for(const i of t)e[i.id]=this.api.mergeDeep({},this.api.getItemData(i.id));return e}updateRightStyleMap(t,e){const i=this.api.getItemData(t.id);return e.style.top="0px",this.data.handle.outside||i.actualWidth<this.data.outsideWidthThreshold?(e.style.position="absolute",e.style.left=i.position.actualRight+this.data.handle.outsideHorizontalMargin+"px",e.style.width=this.data.handle.outsideWidth+"px",e.style.top=i.position.actualRowTop+"px",this.setUpClasses(!0)):(e.style.position="static",e.style.width=this.data.handle.width+"px",this.setUpClasses(!1)),e.style.height=i.actualHeight-2*this.data.handle.verticalMargin+"px",i.position.right!==i.position.actualRight?e.style.display="none":e.style.display="flex",e}updateLeftStyleMap(t,e){const i=this.api.getItemData(t.id);return e.style.top="0px",this.data.handle.outside||i.actualWidth<this.data.outsideWidthThreshold?(e.style.position="absolute",e.style.left=i.position.actualLeft-(this.data.handle.outsideWidth+this.data.handle.outsideHorizontalMargin)+"px",e.style.width=this.data.handle.outsideWidth+"px",e.style.top=i.position.actualRowTop+"px",this.setUpClasses(!0)):(e.style.position="static",e.style.left=this.data.handle.horizontalMargin+"px",e.style.width=this.data.handle.width+"px",this.setUpClasses(!1)),e.style.height=i.actualHeight-2*this.data.handle.verticalMargin+"px",i.position.left!==i.position.actualLeft?e.style.display="none":e.style.display="flex",e}getEventArgument(t){const e=this.api.getAllItems(),i=[];for(const s of t)i.push(this.api.mergeDeep({},e[s.id]));return{items:{initial:this.data.initialItems,before:i,after:t},addedDependantIds:this.data.addedDependantIds,selectedIds:this.data.selectedIds,vido:this.vido,state:this.state,time:this.state.get("$data.chart.time")}}getDependantItems(t){const e=[],i=this.api.getItemsData();for(const s of t)for(const t of i[s.id].dependant)e.includes(t)||e.push(t);const s=this.state.get("config.chart.items");return e.map((t=>s[t])).map((t=>this.api.mergeDeep({},t)))}dispatchEvent(t,e,i=null){"onStart"===t&&(this.api.muteMethod("fixOverlapped"),this.api.muteMethod("fullReload"),this.api.muteMethod("recalculateRowPercents"),this.api.muteMethod("getLastPageRowsHeight"),this.api.muteMethod("calculateVerticalScrollArea"),this.api.muteMethod("heightChange"),this.api.muteMethod("calculateRowsHeight"),this.api.muteMethod("updateVisibleItemsListener"),this.api.muteMethod("prepareExpanded"),0===this.data.autoScroll.speed&&0===this.data.autoScroll.speed&&(this.api.muteMethod("generateVisibleRowsAndItems"),this.api.muteMethod("calculateVisibleRowsHeights"),this.api.muteMethod("prepareExpanded"))),"onEnd"===t&&(this.api.unmuteMethod("fixOverlapped"),this.api.unmuteMethod("heightChange"),this.api.unmuteMethod("calculateVerticalScrollArea"),this.api.unmuteMethod("getLastPageRowsHeight"),this.api.unmuteMethod("recalculateRowPercents"),this.api.unmuteMethod("fullReload"),this.api.unmuteMethod("calculateRowsHeight"),this.api.unmuteMethod("updateVisibleItemsListener"),this.api.unmuteMethod("prepareExpanded"),0===this.data.autoScroll.speed&&0===this.data.autoScroll.speed&&(this.api.unmuteMethod("generateVisibleRowsAndItems"),this.api.unmuteMethod("calculateVisibleRowsHeights"),this.api.unmuteMethod("prepareExpanded"))),e=e.map((t=>this.api.mergeDeep({},t)));const s=this.data.events[t](this.getEventArgument(e));let a=this.state.multi(!0);const n=this.state.get("config.chart.items");for(const t of s){let e=!1;const s=n[t.id];t.time.start===s.time.start&&t.time.end===s.time.end||(e=!0,a=a.update(`config.chart.items.${t.id}.time`,t.time)),i&&e&&(a=a.update(`$data.chart.items.${t.id}`,this.api.mergeDeep({},i[t.id])))}a.done(),"onEnd"===t&&this.api.main.partialReload(!1)}getItemsForDiff(){const t=this.getSelectedItems()[0],e=this.data.initialItems.find((e=>e.id===t.id));return{modified:t,original:e}}onPointerData(){this.data.enabled&&("down"===this.pointerData.pointerState&&this.pointerData.targetType===e?this.api.plugins.TimelinePointer.isLocked("down")||this.onPointerDown():"move"===this.pointerData.pointerState&&this.pointerData.targetType===e?"item-resizing"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove():"up"===this.pointerData.pointerState&&this.pointerData.targetType===e&&"item-resizing"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp())}onPointerDown(){const t=this.pointerData.currentTarget.closest("."+d);if(t&&!this.api.plugins.TimelinePointer.isLocked("down")){if(this.api.plugins.TimelinePointer.lock("down","item-resizing"),this.api.plugins.TimelinePointer.lock("move","item-resizing"),this.api.plugins.TimelinePointer.lock("up","item-resizing"),this.pointerData.events.down.preventDefault(),this.pointerData.events.down.stopPropagation(),this.data.dependant){const t=this.getSelectedItems();this.data.selectedIds=t.map((t=>t.id));const e=this.getDependantItems(t).filter((t=>!this.data.selectedIds.includes(t.id)));this.data.addedDependantIds=e.map((t=>t.id)),this.data.initialItems=[...t,...e]}else this.data.initialItems=this.getSelectedItems(),this.data.addedDependantIds=[],this.data.selectedIds=this.data.initialItems.map((t=>t.id));this.data.initialItemsData=this.getSelectedItemsData(this.data.initialItems),this.data.initialHorizontalScroll=this.api.mergeDeep({},this.state.get("$data.scroll.horizontal")),""!==this.data.state&&"end"!==this.data.state||(this.data.state="resize"),t.classList.contains(d+h)&&this.onLeftPointerDown(),t.classList.contains(d+l)&&this.onRightPointerDown(),this.dispatchEvent("onStart",this.data.initialItems)}}onLeftPointerDown(){this.data.enabled&&(document.body.classList.add(this.data.bodyClassLeft),this.data.leftIsMoving=!0,this.updateData())}onRightPointerDown(){this.data.enabled&&(document.body.classList.add(this.data.bodyClassRight),this.data.rightIsMoving=!0,this.updateData())}scrollLeft(){if(this.data.autoScroll.speed&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-1)}else if(this.data.autoScroll.speed>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex-this.data.autoScroll.speed)}this.scrollWaiting=0}}scrollRight(){if(this.data.autoScroll.speed&&!this.state.get("config.chart.time.calculatedZoomMode")){if(this.scrollWaiting++,this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+1)}else if(this.data.autoScroll.speed>0){const t=this.api.getScrollLeft();this.api.setScrollLeft(t.dataIndex+this.data.autoScroll.speed)}this.scrollWaiting=0}}autoScroll(){if(!this.timelineElement)return;const t=this.pointerData.currentPosition.x,e=this.timelineElement.getBoundingClientRect();t<this.data.autoScroll.edgeThreshold?this.scrollLeft():t>e.width-this.data.autoScroll.edgeThreshold&&this.scrollRight()}onPointerMove(){if(!this.data.enabled)return;const{original:t,modified:e}=this.getItemsForDiff();t&&(this.data.movement={px:this.pointerData.movement.x,time:e.time.start-t.time.start},"resize"!==this.data.state&&"start"!==this.data.state||(this.data.state="resize"),this.pointerData.movement.x&&this.autoScroll(),this.data.leftIsMoving&&this.onLeftPointerMove(),this.data.rightIsMoving&&this.onRightPointerMove())}onLeftPointerMove(){if(!this.data.enabled||!this.data.leftIsMoving)return;const t=this.getSelectedItems(),e={},i=this.state.get("$data.chart.time"),{original:s,modified:a}=this.getItemsForDiff(),n=this.data.movement={px:this.pointerData.movement.x,time:a.time.start-s.time.start},o=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.initialPosition.x,!0,i)),d=this.data.snapToTime.start({startTime:o,item:t[0],time:i,movement:n,vido:this.vido}),h=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.currentPosition.x,!0,i)),l=this.api.time.getDatesDiffPx(d,h,i,!0);for(let s=0,a=t.length;s<a;s++){const a=t[s],o=this.api.mergeDeep({},this.api.getItemData(a.id));let d=this.api.mergeDeep({},this.data.initialItemsData[a.id]).position.left+l;d>o.position.right-a.minWidth&&(d=o.position.right-a.minWidth);const h=this.api.time.getTimeFromOffsetPx(d,!0,i),r=this.data.snapToTime.start({startTime:this.api.time.date(h),item:a,time:i,movement:n,vido:this.vido});a.time.start=r.valueOf(),o.time.startDate=r,e[a.id]=o}this.dispatchEvent("onResize",t,e),this.updateData()}onRightPointerMove(){if(!this.data.enabled||!this.data.rightIsMoving)return;let t,e,i;if(this.data.dependant){const s=this.getSelectedItems();e=s.map((t=>t.id));const a=this.getDependantItems(s).filter((t=>!e.includes(t.id)));i=a.map((t=>t.id)),t=[...s,...a]}else t=this.getSelectedItems();const s={},a=this.state.get("$data.chart.time"),{original:n,modified:o}=this.getItemsForDiff(),d=this.data.movement={px:this.pointerData.movement.x,time:o.time.start-n.time.start},h=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.initialPosition.x,!0,a)),l=this.data.snapToTime.end({endTime:h,item:null,time:a,movement:d,vido:this.vido}),r=this.api.time.date(this.api.time.getTimeFromOffsetPx(this.pointerData.currentPosition.x,!0,a)),m=this.api.time.getDatesDiffPx(l,r,a,!0);for(let e=0,n=t.length;e<n;e++){const n=t[e],o=this.api.mergeDeep({},this.api.getItemData(n.id)),h=this.api.mergeDeep({},this.data.initialItemsData[n.id]),l=i.includes(n.id);let r=h.position.left+h.timeWidth+m;!l&&r<o.position.left+n.minWidth&&(r=o.position.left+n.minWidth);const p=this.api.time.getTimeFromOffsetPx(r,!0,a);let c=this.api.time.date(p);if(l||(c=this.data.snapToTime.end({endTime:this.api.time.date(p),item:n,time:a,movement:d,vido:this.vido})),l){const t=this.data.initialItems.find((t=>t.dependant.includes(h.id))),e=this.data.initialItemsData[t.id],i=s[e.id],d=this.api.time.getDatesDiffMs(e.time.endDate,i.time.endDate,a,!0);let l=-this.api.time.getDSTDiffForLevel(a.level,e.time.endDate.valueOf(),h.time.startDate.valueOf(),a),r=this.api.time.addTimeFromDates(h.time.startDate.valueOf(),d+l,a);l=this.api.time.getDSTDiffForLevel(a.level,i.time.endDate.valueOf(),r,a),r+=l;const m=this.api.time.date(r),p=m.valueOf(),g=this.api.time.getViewOffsetPxFromDates(m,!1,a);let u=-this.api.time.getDSTDiffForLevel(a.level,h.time.startDate.valueOf(),h.time.endDate.valueOf(),a);const f=g+h.timeWidth;let v;const D=h.time.endDate.valueOf()-h.time.startDate.valueOf();v=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(f,!0,a)):this.api.time.date(m.valueOf()+D),u+=this.api.time.getDSTDiffForLevel(a.level,p,v.valueOf(),a),v=v.add(u,"ms"),c=v,n.time.start=m.valueOf(),o.time.startDate=m}n.time.end=c.valueOf(),o.time.endDate=c,s[n.id]=o}this.dispatchEvent("onResize",t,s),this.updateData()}onEnd(){const t=this.getSelectedItems();this.dispatchEvent("onEnd",t)}onPointerUp(){"resize"===this.data.state&&(this.data.state="end"),this.onLeftPointerUp(),this.onRightPointerUp(),this.onEnd(),this.updateData(),this.api.plugins.TimelinePointer.unlock("down"),this.api.plugins.TimelinePointer.unlock("move"),this.api.plugins.TimelinePointer.unlock("up")}onLeftPointerUp(){document.body.classList.remove(this.data.bodyClassLeft),this.data.enabled&&this.data.leftIsMoving&&(this.data.leftIsMoving=!1,this.onEnd(),this.updateData())}onRightPointerUp(){document.body.classList.remove(this.data.bodyClassRight),this.data.enabled&&this.data.rightIsMoving&&(this.data.rightIsMoving=!1)}innerSlot(t,e){let i,s,a;const n=new t.StyleMap({}),o=new t.StyleMap({});return t.onChange((d=>{if(!(e=d)||!e.item)return;const h=e.item;if(!h)return;const l=this.api.getItemData(h.id);if(!l)return;let r;i=!l.detached,this.data.handle.onlyWhenSelected&&(i=i&&l.selected),i=i&&!(this.data.handle.outside||l.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(h,o),this.updateLeftStyleMap(h,n),r="function"==typeof this.data.content?this.data.content({item:h,vido:t}):"object"!=typeof this.data.content||"left"in this.data.content?this.data.content:{left:this.data.content,right:this.data.content},s=this.html`<div class=${this.leftClassName} data-gstcid=${e.item.id} style=${n.directive()}>${r.left}</div>`,a=this.html`<div class=${this.rightClassName} data-gstcid=${e.item.id} style=${o.directive()}>${r.right}</div>`,t.update()})),t=>this.html`${i?s:null}${t}${i?a:null}`}outerSlot(t,i){let s,a,n;const o=new t.StyleMap({}),d=new t.StyleMap({});return t.onChange((h=>{if(!(i=h)||!i.item)return;const l=i.item;if(!l)return;const r=this.api.getItemData(l.id);if(!r)return;let m;s=!r.detached,this.data.handle.onlyWhenSelected&&(s=s&&r.selected),s=s&&(this.data.handle.outside||r.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(l,d),this.updateLeftStyleMap(l,o),m="function"==typeof this.data.content?this.data.content({item:l,vido:t}):"object"!=typeof this.data.content||"left"in this.data.content?this.data.content:{left:this.data.content,right:this.data.content},a=this.html`<div class=${this.leftClassName} data-type=${e} data-gstcid=${i.item.id} style=${o.directive()}>${m.left}</div>`,n=this.html`<div class=${this.rightClassName} data-type=${e} data-gstcid=${i.item.id} style=${d.directive()}>${m.right}</div>`,t.update()})),t=>this.html`${s?a:null}${t}${s?n:null}`}}t.Plugin=function(t={}){return function(e){const i=e.api;if(!i.isPluginInitialized("TimelinePointer"))throw new Error("TimelinePointer plugin must be initialized before ItemResizing plugin.");if(!i.isPluginInitialized("Selection"))throw new Error("Selection plugin must be initialized before ItemResizing plugin.");if(i.isPluginInitialized("ItemMovement"))throw new Error("ItemResizing plugin must be initialized before ItemMovement plugin.");const s=e.state.get(n);s&&(t=e.api.mergeDeep({},t,s));const a=new r(e,t);return i.pluginInitialized("ItemResizing"),a.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -12,0 +12,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,3 +10,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ItemTypes={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -13,0 +13,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -26,0 +26,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,3 +10,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ProgressBar={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -26,0 +26,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -26,0 +26,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,3 +10,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Selection={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -26,0 +26,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -22,3 +22,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -25,0 +25,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,3 +10,3 @@ !function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s((t="undefined"!=typeof globalThis?globalThis:t||self).TimeBookmarks={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -23,3 +23,3 @@ * @license SEE LICENSE IN LICENSE FILE

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -26,0 +26,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -9,3 +9,3 @@ /**

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30

@@ -12,0 +12,0 @@ * @license SEE LICENSE IN LICENSE FILE

@@ -10,5 +10,5 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TimelinePointer={})}(this,(function(t){"use strict";

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.26.1
* @version 3.26.2
* @released 2022-06-30
* @license SEE LICENSE IN LICENSE FILE
*/const e="chart-timeline-grid-row-cell",i="chart-timeline-items-row-item";function a(t={}){const e={enabled:!0,isMoving:!1,pointerState:"up",currentTarget:null,realTarget:null,targetType:"",targetData:null,captureEvents:{down:!1,up:!1,move:!1},initialPosition:{x:0,y:0},currentPosition:{x:0,y:0},movement:{x:0,y:0},events:{down:null,move:null,up:null}};return t.captureEvents&&(e.captureEvents=Object.assign(Object.assign({},e.captureEvents),t.captureEvents)),e}const s="config.plugin.TimelinePointer";class n{constructor(t,n){this.locked={up:!1,move:!1,down:!1},this.onDestroy=[],this.classNames={cell:"",item:""},this.api=n.api,this.state=n.state,this.element=this.state.get("$data.elements.chart-timeline"),this.pointerDown=this.pointerDown.bind(this),this.pointerMove=this.pointerMove.bind(this),this.pointerMove=n.schedule(this.pointerMove),this.pointerUp=this.pointerUp.bind(this),this.apiLock=this.apiLock.bind(this),this.apiUnlock=this.apiUnlock.bind(this),this.apiIsLocked=this.apiIsLocked.bind(this),this.getRealPosition=this.getRealPosition.bind(this),this.data=a(t),this.classNames.cell=this.api.getClass(e),this.classNames.item=this.api.getClass(i),this.destroy=this.destroy.bind(this),this.element.addEventListener("pointerdown",this.pointerDown),document.addEventListener("pointerup",this.pointerUp),document.addEventListener("pointermove",this.pointerMove),this.onDestroy.push(this.state.subscribe(s,(t=>this.data=t))),this.api.plugins.TimelinePointer={lock:this.apiLock,unlock:this.apiUnlock,isLocked:this.apiIsLocked}}destroy(){this.element.removeEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove)}updateData(){this.state.update(s,(()=>Object.assign({},this.data)))}apiLock(t,e=!0){this.locked[t]=e}apiUnlock(t){this.locked[t]=!1}apiIsLocked(t){return this.locked[t]}getRealTarget(t){let a=t.target.closest("."+this.classNames.item);return a||(a=t.target.closest("."+this.classNames.cell),a||(a=t.target.closest(`[data-type="${i}"]`),a||(a=t.target.closest(`[data-type="${e}"]`),a||null)))}getRealPosition(t){const e={x:0,y:0};if(this.element){const i=this.element.getBoundingClientRect();e.x=t.clientX-i.x,e.y=t.clientY-i.y;const a=this.state.get("$data.scroll.vertical.preciseOffset")||0;e.y-=a}return e}pointerDown(t){if(!this.data.enabled)return;if(this.initialScrollPosPx=this.state.get("$data.scroll.horizontal.handlePosPx"),this.data.pointerState="down",this.data.currentTarget=t.target,this.data.realTarget=this.getRealTarget(t),this.data.targetType="",this.data.targetData=null,this.data.realTarget)if(this.data.realTarget.classList.contains(this.classNames.item))this.data.targetType=i,this.data.targetData=this.data.realTarget.vido.item;else if(this.data.realTarget.classList.contains(this.classNames.cell))this.data.targetType=e,this.data.targetData=this.data.realTarget.vido;else if(this.data.realTarget.dataset.type===i){this.data.targetType=i;const t=this.data.realTarget.dataset.gstcid;this.data.targetData=this.api.getItem(t)}else if(this.data.realTarget.dataset.type===e){this.data.targetType=e;const t=this.data.realTarget.dataset.gstcid;this.data.targetData=this.state.get(`$data.chart.grid.cells.${t}`)}this.data.isMoving=!!this.data.targetType,this.data.events.down=t,this.data.events.move=t;const a=this.getRealPosition(t);this.data.initialPosition=a,this.data.currentPosition=a,this.updateData()}pointerUp(t){this.data.enabled&&(this.data.pointerState="up",this.data.isMoving=!1,this.data.events.up=t,this.data.currentPosition=this.getRealPosition(t),this.updateData())}pointerMove(t){if(!this.data.enabled||!this.data.isMoving)return;const e=this.state.get("$data.scroll.horizontal.handlePosPx");this.data.pointerState="move",this.data.events.move=t,this.data.currentPosition=this.getRealPosition(t),this.data.movement.x=this.data.currentPosition.x-this.data.initialPosition.x,this.data.movement.y=this.data.currentPosition.y-this.data.initialPosition.y,this.data.movement.x+=e-this.initialScrollPosPx,this.updateData()}}t.CELL=e,t.ITEM=i,t.Plugin=function(t={}){return function(e){const i=e.api,o=e.api.mergeDeep,r=e.state.get(s);r&&(t=o(o({},t),r));const h=[],l=a(t);let d;return e.state.update(s,l),h.push(e.state.subscribe("$data.elements.chart-timeline",(i=>{if(i){d&&d();const i=new n(t,e);d=i.destroy}}))),i.pluginInitialized("TimelinePointer"),function(){h.forEach((t=>t())),d&&d(),i.pluginDestroyed("TimelinePointer")}}},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "gantt-schedule-timeline-calendar",
"version": "3.26.1",
"version": "3.26.2",
"description": "Gantt, Schedule, Timeline, Calendar components all in one. [gantt, timeline, schedule, scheduler, calendar, booking, gantt chart, reservation, javascript gantt, javascript timeline, javascript schedule, javascript scheduler, javascript calendar, javascript booking, javascript gantt chart, javascript reservation, js gantt, js timeline, js schedule, js scheduler, js calendar, js booking, js gantt chart, js reservation, typescript gantt, typescript timeline, typescript schedule, typescript scheduler, typescript calendar, typescript booking, typescript gantt chart, typescript reservation, vue gantt, vue timeline, vue schedule, vue scheduler, vue calendar, vue booking, vue gantt chart, vue reservation, react gantt, react timeline, react schedule, react scheduler, react calendar, react booking, react gantt chart, react reservation, angular gantt, angular timeline, angular schedule, angular scheduler, angular calendar, angular booking, angular gantt chart, angular reservation, svelte gantt, svelte timeline, svelte schedule, svelte scheduler, svelte calendar, svelte booking, svelte gantt chart, svelte reservation, jQuery gantt, jQuery timeline, jQuery schedule, jQuery scheduler, jQuery calendar, jQuery booking, jQuery gantt chart, jQuery reservation, component gantt, component timeline, component schedule, component scheduler, component calendar, component booking, component gantt chart, component reservation, javascript horizontal timeline, javascript multimedia editor, javascript timeline editor, js horizontal timeline, js multimedia editor, js timeline editor, typescript horizontal timeline, typescript multimedia editor, typescript timeline editor, vue horizontal timeline, vue multimedia editor, vue timeline editor, react horizontal timeline, react multimedia editor, react timeline editor, angular horizontal timeline, angular multimedia editor, angular timeline editor, svelte horizontal timeline, svelte multimedia editor, svelte timeline editor, jQuery horizontal timeline, jQuery multimedia editor, jQuery timeline editor, component horizontal timeline, component multimedia editor, component timeline editor]",

@@ -5,0 +5,0 @@ "main": "dist/gstc.wasm.esm.min.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc