Socket
Socket
Sign inDemoInstall

gantt-schedule-timeline-calendar

Package Overview
Dependencies
Maintainers
1
Versions
483
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gantt-schedule-timeline-calendar - npm Package Compare versions

Comparing version 3.34.1 to 3.34.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## [3.34.2]
- overlapped items order improvement
## [3.34.1]

@@ -2,0 +6,0 @@

@@ -117,2 +117,3 @@ /**

updateItemRowMapForItem(itemId: string, newRowId: string, itemRowMap?: ItemRowMap, rowsData?: RowsData): void;
sortRowItemsInAddOrder(itemsId: string[], rowData: RowData): void;
sortRowItemsByTime(rowData: RowData): void;

@@ -119,0 +120,0 @@ makeTreeMap(rowsData: RowsData, items: Items, onlyItems?: boolean): RowsData;

2

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18
* @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 l{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"),s=o.get("config.scroll.horizontal");if(t.x>0){if(0===this.initialDataIndex.x)return this.resetInitialPoint(e);const o=i.allDates[i.level];let l,r=this.initialDataIndex.x-1,a=0;for(;r>0&&(l=o[r],a+=l.width,!(a>=t.x));r--);let d=0;l&&(d=l.leftPx),s.byPixels?n.setScrollLeft(d):n.setScrollLeft(r)}else if(t.x<0){let l=this.initialDataIndex.x;const r=o.get("$data.scroll.horizontal"),a=i.allDates[i.level];if(l-1>=a.length-r.lastPageCount)return this.resetInitialPoint(e);let d,c=0;for(let e=a.length;l<e&&(d=a[l],c+=d.width,!(-c<=t.x));l++);if(l-1>=a.length-r.lastPageCount)return;let h=0;d&&(h=d.leftPx),s.byPixels?n.setScrollLeft(h):n.setScrollLeft(l)}}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 r="config.plugin.CalendarScroll",a=e.state.get(r);return a&&(t=n.mergeDeep({},t,a)),o.update(r,t),o.subscribe("config.plugin.CalendarScroll.enabled",(t=>s=t)),o.update("config.actions.chart-calendar",(t=>(t.push(l),t))),n.pluginInitialized("CalendarScroll"),function(){o.update("config.actions.chart-calendar",(t=>t.filter((t=>t!==l)))),n.pluginDestroyed("CalendarScroll")}}},Object.defineProperty(t,"__esModule",{value:!0})}));

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18
* @license SEE LICENSE IN LICENSE FILE
*/const e="config.plugin.ItemMovement";class i{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,vido:i})=>i.api.time.findOrCreateMainDateAtTime(t.valueOf(),e).leftGlobalDate,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,allowItemsToGoOutsideTheArea:!0,thresholdReached:{horizontal:!1,vertical:!1}},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.onTimelinePointerDown=this.onTimelinePointerDown.bind(this),this.onTimelinePointerMove=this.onTimelinePointerMove.bind(this),this.onTimelinePointerUp=this.onTimelinePointerUp.bind(this),this.api.plugins.TimelinePointer.addPointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.addPointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.addPointerListener("up",this.onTimelinePointerUp)}destroy(){this.onDestroy.forEach((t=>t())),this.api.plugins.TimelinePointer.removePointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.removePointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.removePointerListener("up",this.onTimelinePointerUp),this.api.pluginDestroyed("ItemMovement")}updateData(){this.state.update(e,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,e){const i=this.api.getAllItems(),a=[];for(const e of t)a.push(this.api.mergeDeep({},i[e.id]));return{items:{initial:this.data.initialItems,before:a,after:t,targetData:e.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,a=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 s=this.data.events[t](this.getEventArgument(e,i));let o=this.state.multi(!0);const l=this.state.get("config.chart.items");for(let t of s){t=this.api.mergeDeep({},t);const e=l[t.id];let i=!1;t.time.start===e.time.start&&t.time.end===e.time.end||(i=!0,o=o.update(`config.chart.items.${t.id}.time`,Object.assign({},t.time)));let s=!1;e.rowId!==t.rowId&&(s=!0,o=o.update(`config.chart.items.${t.id}.rowId`,t.rowId),this.api.updateItemRowMapForItem(t.id,t.rowId)),a&&(i||s)&&(o=o.update(`$data.chart.items.${t.id}`,this.api.mergeDeep({},a[t.id])))}o.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}}onTimelinePointerDown(e){this.data.enabled&&(e.targetType!==t||this.api.plugins.TimelinePointer.isLocked("down")||this.onPointerDown(e))}onTimelinePointerMove(e){this.data.enabled&&e.targetType===t&&"item-movement"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove(e)}onTimelinePointerUp(e){this.data.enabled&&e.targetType===t&&"item-movement"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp(e)}onPointerDown(t){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({},t.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(t.initialPosition.x,!0)),this.scrollWaiting=0,this.data.thresholdReached.horizontal=!1,this.data.thresholdReached.vertical=!1,""!==this.data.state&&"end"!==this.data.state||(this.data.state="move"),this.dispatchEvent("onStart",this.data.initialItems,t),this.updateData()}scrollLeft(){if(!this.data.autoScroll.speed.horizontal)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*t.multiplier):this.api.setScrollLeft(e.dataIndex-1)}else if(this.data.autoScroll.speed.horizontal>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*this.data.autoScroll.speed.horizontal*t.multiplier):this.api.setScrollLeft(e.dataIndex-this.data.autoScroll.speed.horizontal)}this.scrollWaiting=0}scrollRight(){if(!this.data.autoScroll.speed.horizontal)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*t.multiplier):this.api.setScrollLeft(e.dataIndex+1)}else if(this.data.autoScroll.speed.horizontal>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*this.data.autoScroll.speed.horizontal*t.multiplier):this.api.setScrollLeft(e.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(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx-120*e.multiplier):this.api.setScrollTop(t.dataIndex-1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx-120*this.data.autoScroll.speed.vertical*e.multiplier):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(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx-120*e.multiplier):this.api.setScrollTop(t.dataIndex+1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx+120*this.data.autoScroll.speed.vertical*e.multiplier):this.api.setScrollTop(t.dataIndex+this.data.autoScroll.speed.vertical)}this.scrollWaiting=0}}autoScroll(t){if(!this.timelineElement)return;const e=t.currentPosition.x,i=t.currentPosition.y,a=this.state.get("$data.chart.dimensions");e<this.data.autoScroll.edgeThreshold.horizontal?this.scrollLeft():e>a.widthWithoutScrollBar-this.data.autoScroll.edgeThreshold.horizontal?this.scrollRight():i<this.data.autoScroll.edgeThreshold.vertical?this.scrollTop():i>a.innerHeight-this.data.autoScroll.edgeThreshold.vertical&&this.scrollBottom()}moveItemVertically(t,e,i){if(this.data.addedDependantIds.includes(t.id)&&!this.data.moveDependantVertically)return;const a=this.state.get("$data.scroll.vertical").absolutePosPx-this.data.initialVerticalScroll.absolutePosPx,s=i.currentPosition.y-i.initialPosition.y,o=this.data.threshold.vertical;if(Math.abs(s)>=o&&(this.data.thresholdReached.vertical=!0),!this.data.thresholdReached.vertical)return;const l=this.data.clickedItemData.position.viewTop-i.initialPosition.y-this.data.clickedItemData.position.rowTop;let n=e.position.top+s+a-l;n<0&&(n=0);const d=this.api.getRowInfoFromTop(n);d.row.id!==t.rowId&&(t.rowId=d.row.id,e.position.viewTop=this.api.getRowViewTop(t.rowId),e.position.rowTop=0)}getItemsToMove(t=!1){let e,i=[];if(this.data.dependant){const a=this.getSelectedItems(t),s=a.map((t=>t.id)),o=this.getDependantItems(a,t).filter((t=>!s.includes(t.id)));i=o.map((t=>t.id)),e=[...a,...o]}else e=this.getSelectedItems(t);return{itemsToMove:e,dependantIds:i}}calculateFinalLeftGlobal({diffPx:t,initialItemData:e,initialItem:i,isDependant:a,movement:s,itemDataToSave:o,time:l}){const n=e.position.left+t;let d=this.api.time.getTimeFromOffsetPx(n,!0,l);if(a){const t=this.data.initialItems.find((t=>{var e;return null===(e=t.dependant)||void 0===e?void 0:e.includes(i.id)})),a=this.data.initialItemsData[t.id],s=o[a.id],n=this.api.time.getDatesDiffMs(a.time.endDate,s.time.endDate,l,!0);let h=-this.api.time.getDSTDiffForLevel(l.level,a.time.endDate.valueOf(),e.time.startDate.valueOf(),l);d=this.api.time.addTimeFromDates(e.time.startDate.valueOf(),n+h,l),h=this.api.time.getDSTDiffForLevel(l.level,s.time.endDate.valueOf(),d,l),d+=h}const h=this.api.time.date(d);let r=h;return a||(r=this.data.snapToTime.start({startTime:h,item:i,time:l,movement:s,vido:this.vido})),r}calculateFinalRightGlobal({finalLeftGlobalDate:t,initialItemData:e,initialItem:i,isDependant:a,movement:s,time:o}){const l=this.api.time.getViewOffsetPxFromDates(t,!1,o);let n=-this.api.time.getDSTDiffForLevel(o.level,i.time.start,i.time.end,o);const d=l+e.timeWidth;let h;const r=i.time.end-i.time.start;h=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(d,!0,o)):this.api.time.date(t.valueOf()+r),n+=this.api.time.getDSTDiffForLevel(o.level,t.valueOf(),h.valueOf(),o),h=h.add(n,"ms");let m=h;return a||(m=this.data.snapToTime.end({endTime:h,item:i,time:o,movement:s,vido:this.vido})),m}onPointerMove(t){if(!this.data.enabled)return;if(!this.data.isMoving)return;const{original:e,modified:i}=this.getItemsForDiff();if(!e)return;const a=this.data.movement=Object.assign(Object.assign({},t.movement),{time:i.time.start-e.time.start}),s=this.data.threshold.horizontal,o=this.data.threshold.vertical;if(this.data.thresholdReached.horizontal=this.data.thresholdReached.horizontal||Math.abs(a.x)>=s,this.data.thresholdReached.vertical=this.data.thresholdReached.vertical||Math.abs(a.y)>=o,!this.data.thresholdReached.horizontal&&!this.data.thresholdReached.vertical)return;"move"!==this.data.state&&"start"!==this.data.state||(this.data.state="move");const{itemsToMove:l,dependantIds:n}=this.getItemsToMove(!0),d={},h=this.state.get("$data.chart.time"),r=[],m=this.data.snapToTime.start({startTime:this.data.initialPointerTime,item:null,time:h,movement:a,vido:this.vido}),c=this.state.get("$data.scroll.horizontal"),p=this.api.time.getDatesDiffPx(c.data.leftGlobalDate,this.data.initialHorizontalScroll.data.leftGlobalDate,h,!0),u=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x+p,!0,h)),g=this.api.time.getDatesDiffPx(m,u,h,!0);for(let e=0,i=l.length;e<i;e++){const i=this.api.mergeDeep({},l[e]),s=this.api.mergeDeep({},this.data.initialItemsData[i.id]),o=n.includes(i.id);if(this.moveItemVertically(i,s,t),this.data.thresholdReached.horizontal){const t=this.calculateFinalLeftGlobal({diffPx:g,initialItemData:s,initialItem:i,isDependant:o,movement:a,itemDataToSave:d,time:h}),e=this.calculateFinalRightGlobal({finalLeftGlobalDate:t,initialItemData:s,initialItem:i,isDependant:o,movement:a,time:h});if(!(t.valueOf()<h.from||e.valueOf()>h.to)||"function"!=typeof h.format.periodIncrement&&this.data.allowItemsToGoOutsideTheArea)i.time.start=t.valueOf(),i.time.end=e.valueOf(),s.time.startDate=t,s.time.endDate=e;else{const t=this.api.getItem(i.id);i.time.start=t.time.start,i.time.end=t.time.end,s.time.startDate=this.api.time.date(i.time.start),s.time.endDate=this.api.time.date(i.time.end)}}d[i.id]=s,r.push(i)}(this.data.thresholdReached.horizontal||this.data.thresholdReached.vertical)&&this.dispatchEvent("onMove",r,t,d),g&&(this.data.thresholdReached.horizontal||this.data.thresholdReached.vertical)&&this.autoScroll(t),this.updateData()}onEnd(t){const{itemsToMove:e}=this.getItemsToMove(!1);this.dispatchEvent("onEnd",e,t)}onPointerUp(t){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(t),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 a(t={}){return function(a){const s=a.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=a.state.get(e);o&&(t=a.api.mergeDeep({},t,o));const l=new i(a,t);return s.pluginInitialized("ItemMovement"),l.destroy}}export{a 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.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18
* @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,vido:i})=>i.api.time.findOrCreateMainDateAtTime(t.valueOf(),e).leftGlobalDate,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,allowItemsToGoOutsideTheArea:!0,thresholdReached:{horizontal:!1,vertical:!1}},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.onTimelinePointerDown=this.onTimelinePointerDown.bind(this),this.onTimelinePointerMove=this.onTimelinePointerMove.bind(this),this.onTimelinePointerUp=this.onTimelinePointerUp.bind(this),this.api.plugins.TimelinePointer.addPointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.addPointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.addPointerListener("up",this.onTimelinePointerUp)}destroy(){this.onDestroy.forEach((t=>t())),this.api.plugins.TimelinePointer.removePointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.removePointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.removePointerListener("up",this.onTimelinePointerUp),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,e){const i=this.api.getAllItems(),a=[];for(const e of t)a.push(this.api.mergeDeep({},i[e.id]));return{items:{initial:this.data.initialItems,before:a,after:t,targetData:e.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,a=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 s=this.data.events[t](this.getEventArgument(e,i));let o=this.state.multi(!0);const l=this.state.get("config.chart.items");for(let t of s){t=this.api.mergeDeep({},t);const e=l[t.id];let i=!1;t.time.start===e.time.start&&t.time.end===e.time.end||(i=!0,o=o.update(`config.chart.items.${t.id}.time`,Object.assign({},t.time)));let s=!1;e.rowId!==t.rowId&&(s=!0,o=o.update(`config.chart.items.${t.id}.rowId`,t.rowId),this.api.updateItemRowMapForItem(t.id,t.rowId)),a&&(i||s)&&(o=o.update(`$data.chart.items.${t.id}`,this.api.mergeDeep({},a[t.id])))}o.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}}onTimelinePointerDown(t){this.data.enabled&&(t.targetType!==e||this.api.plugins.TimelinePointer.isLocked("down")||this.onPointerDown(t))}onTimelinePointerMove(t){this.data.enabled&&t.targetType===e&&"item-movement"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove(t)}onTimelinePointerUp(t){this.data.enabled&&t.targetType===e&&"item-movement"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp(t)}onPointerDown(t){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({},t.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(t.initialPosition.x,!0)),this.scrollWaiting=0,this.data.thresholdReached.horizontal=!1,this.data.thresholdReached.vertical=!1,""!==this.data.state&&"end"!==this.data.state||(this.data.state="move"),this.dispatchEvent("onStart",this.data.initialItems,t),this.updateData()}scrollLeft(){if(!this.data.autoScroll.speed.horizontal)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*t.multiplier):this.api.setScrollLeft(e.dataIndex-1)}else if(this.data.autoScroll.speed.horizontal>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*this.data.autoScroll.speed.horizontal*t.multiplier):this.api.setScrollLeft(e.dataIndex-this.data.autoScroll.speed.horizontal)}this.scrollWaiting=0}scrollRight(){if(!this.data.autoScroll.speed.horizontal)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed.horizontal<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed.horizontal))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*t.multiplier):this.api.setScrollLeft(e.dataIndex+1)}else if(this.data.autoScroll.speed.horizontal>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*this.data.autoScroll.speed.horizontal*t.multiplier):this.api.setScrollLeft(e.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(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx-120*e.multiplier):this.api.setScrollTop(t.dataIndex-1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx-120*this.data.autoScroll.speed.vertical*e.multiplier):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(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx-120*e.multiplier):this.api.setScrollTop(t.dataIndex+1)}else if(this.data.autoScroll.speed.vertical>0){const t=this.api.getScrollTop(),e=this.state.get("config.scroll.vertical");e.byPixels?this.api.setScrollTop(t.absolutePosPx+120*this.data.autoScroll.speed.vertical*e.multiplier):this.api.setScrollTop(t.dataIndex+this.data.autoScroll.speed.vertical)}this.scrollWaiting=0}}autoScroll(t){if(!this.timelineElement)return;const e=t.currentPosition.x,i=t.currentPosition.y,a=this.state.get("$data.chart.dimensions");e<this.data.autoScroll.edgeThreshold.horizontal?this.scrollLeft():e>a.widthWithoutScrollBar-this.data.autoScroll.edgeThreshold.horizontal?this.scrollRight():i<this.data.autoScroll.edgeThreshold.vertical?this.scrollTop():i>a.innerHeight-this.data.autoScroll.edgeThreshold.vertical&&this.scrollBottom()}moveItemVertically(t,e,i){if(this.data.addedDependantIds.includes(t.id)&&!this.data.moveDependantVertically)return;const a=this.state.get("$data.scroll.vertical").absolutePosPx-this.data.initialVerticalScroll.absolutePosPx,s=i.currentPosition.y-i.initialPosition.y,o=this.data.threshold.vertical;if(Math.abs(s)>=o&&(this.data.thresholdReached.vertical=!0),!this.data.thresholdReached.vertical)return;const l=this.data.clickedItemData.position.viewTop-i.initialPosition.y-this.data.clickedItemData.position.rowTop;let n=e.position.top+s+a-l;n<0&&(n=0);const d=this.api.getRowInfoFromTop(n);d.row.id!==t.rowId&&(t.rowId=d.row.id,e.position.viewTop=this.api.getRowViewTop(t.rowId),e.position.rowTop=0)}getItemsToMove(t=!1){let e,i=[];if(this.data.dependant){const a=this.getSelectedItems(t),s=a.map((t=>t.id)),o=this.getDependantItems(a,t).filter((t=>!s.includes(t.id)));i=o.map((t=>t.id)),e=[...a,...o]}else e=this.getSelectedItems(t);return{itemsToMove:e,dependantIds:i}}calculateFinalLeftGlobal({diffPx:t,initialItemData:e,initialItem:i,isDependant:a,movement:s,itemDataToSave:o,time:l}){const n=e.position.left+t;let d=this.api.time.getTimeFromOffsetPx(n,!0,l);if(a){const t=this.data.initialItems.find((t=>{var e;return null===(e=t.dependant)||void 0===e?void 0:e.includes(i.id)})),a=this.data.initialItemsData[t.id],s=o[a.id],n=this.api.time.getDatesDiffMs(a.time.endDate,s.time.endDate,l,!0);let h=-this.api.time.getDSTDiffForLevel(l.level,a.time.endDate.valueOf(),e.time.startDate.valueOf(),l);d=this.api.time.addTimeFromDates(e.time.startDate.valueOf(),n+h,l),h=this.api.time.getDSTDiffForLevel(l.level,s.time.endDate.valueOf(),d,l),d+=h}const h=this.api.time.date(d);let r=h;return a||(r=this.data.snapToTime.start({startTime:h,item:i,time:l,movement:s,vido:this.vido})),r}calculateFinalRightGlobal({finalLeftGlobalDate:t,initialItemData:e,initialItem:i,isDependant:a,movement:s,time:o}){const l=this.api.time.getViewOffsetPxFromDates(t,!1,o);let n=-this.api.time.getDSTDiffForLevel(o.level,i.time.start,i.time.end,o);const d=l+e.timeWidth;let h;const r=i.time.end-i.time.start;h=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(d,!0,o)):this.api.time.date(t.valueOf()+r),n+=this.api.time.getDSTDiffForLevel(o.level,t.valueOf(),h.valueOf(),o),h=h.add(n,"ms");let m=h;return a||(m=this.data.snapToTime.end({endTime:h,item:i,time:o,movement:s,vido:this.vido})),m}onPointerMove(t){if(!this.data.enabled)return;if(!this.data.isMoving)return;const{original:e,modified:i}=this.getItemsForDiff();if(!e)return;const a=this.data.movement=Object.assign(Object.assign({},t.movement),{time:i.time.start-e.time.start}),s=this.data.threshold.horizontal,o=this.data.threshold.vertical;if(this.data.thresholdReached.horizontal=this.data.thresholdReached.horizontal||Math.abs(a.x)>=s,this.data.thresholdReached.vertical=this.data.thresholdReached.vertical||Math.abs(a.y)>=o,!this.data.thresholdReached.horizontal&&!this.data.thresholdReached.vertical)return;"move"!==this.data.state&&"start"!==this.data.state||(this.data.state="move");const{itemsToMove:l,dependantIds:n}=this.getItemsToMove(!0),d={},h=this.state.get("$data.chart.time"),r=[],m=this.data.snapToTime.start({startTime:this.data.initialPointerTime,item:null,time:h,movement:a,vido:this.vido}),c=this.state.get("$data.scroll.horizontal"),p=this.api.time.getDatesDiffPx(c.data.leftGlobalDate,this.data.initialHorizontalScroll.data.leftGlobalDate,h,!0),u=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x+p,!0,h)),g=this.api.time.getDatesDiffPx(m,u,h,!0);for(let e=0,i=l.length;e<i;e++){const i=this.api.mergeDeep({},l[e]),s=this.api.mergeDeep({},this.data.initialItemsData[i.id]),o=n.includes(i.id);if(this.moveItemVertically(i,s,t),this.data.thresholdReached.horizontal){const t=this.calculateFinalLeftGlobal({diffPx:g,initialItemData:s,initialItem:i,isDependant:o,movement:a,itemDataToSave:d,time:h}),e=this.calculateFinalRightGlobal({finalLeftGlobalDate:t,initialItemData:s,initialItem:i,isDependant:o,movement:a,time:h});if(!(t.valueOf()<h.from||e.valueOf()>h.to)||"function"!=typeof h.format.periodIncrement&&this.data.allowItemsToGoOutsideTheArea)i.time.start=t.valueOf(),i.time.end=e.valueOf(),s.time.startDate=t,s.time.endDate=e;else{const t=this.api.getItem(i.id);i.time.start=t.time.start,i.time.end=t.time.end,s.time.startDate=this.api.time.date(i.time.start),s.time.endDate=this.api.time.date(i.time.end)}}d[i.id]=s,r.push(i)}(this.data.thresholdReached.horizontal||this.data.thresholdReached.vertical)&&this.dispatchEvent("onMove",r,t,d),g&&(this.data.thresholdReached.horizontal||this.data.thresholdReached.vertical)&&this.autoScroll(t),this.updateData()}onEnd(t){const{itemsToMove:e}=this.getItemsToMove(!1);this.dispatchEvent("onEnd",e,t)}onPointerUp(t){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(t),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 l=new a(e,t);return s.pluginInitialized("ItemMovement"),l.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18
* @license SEE LICENSE IN LICENSE FILE
*/const s=i("chart-timeline-items-row-item-resizing-handle-content-line");const a="ItemResizing",n=`config.plugin.${a}`,o="chart-timeline-items-row-item-resizing-handle",d=i(o),l="--left",h="--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,vido:i})=>i.api.time.findOrCreateMainDateAtTime(t.valueOf(),e).leftGlobalDate,end:({endTime:t,time:e,vido:i})=>i.api.time.findOrCreateMainDateAtTime(t.valueOf(),e).rightGlobalDate},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,allowItemsToGoOutsideTheArea:!0,threshold:10,thresholdReached:!1},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=${s}></div><div class=${s}></div>`,right:this.html`<div class=${s}></div><div class=${s}></div>`}),this.PluginItemResizingInnerSlot=this.PluginItemResizingInnerSlot.bind(this),this.PluginItemResizingOuterSlot=this.PluginItemResizingOuterSlot.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(n,(t=>{t.enabled?document.body.classList.add(t.bodyClass):document.body.classList.remove(t.bodyClass),this.data=t}))),this.onTimelinePointerDown=this.onTimelinePointerDown.bind(this),this.onTimelinePointerMove=this.onTimelinePointerMove.bind(this),this.onTimelinePointerUp=this.onTimelinePointerUp.bind(this),this.api.plugins.TimelinePointer.addPointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.addPointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.addPointerListener("up",this.onTimelinePointerUp),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>(t.includes(this.PluginItemResizingInnerSlot)||t.push(this.PluginItemResizingInnerSlot),t))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>(t.includes(this.PluginItemResizingOuterSlot)||t.push(this.PluginItemResizingOuterSlot),t)))}destroy(){this.onDestroy.forEach((t=>t())),this.api.plugins.TimelinePointer.removePointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.removePointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.removePointerListener("up",this.onTimelinePointerUp),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>t.filter((t=>t!==this.PluginItemResizingInnerSlot)))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>t.filter((t=>t!==this.PluginItemResizingOuterSlot)))),this.api.pluginDestroyed(a)}updateData(){this.state.update(n,this.data)}setUpClasses(t=!1){this.leftClassName=this.api.getClass(o),this.leftClassName+=" "+this.leftClassName+l,this.rightClassName=this.api.getClass(o),this.rightClassName+=" "+this.rightClassName+h,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.${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.outOfView.right?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.outOfView.left?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}}onTimelinePointerDown(e){this.data.enabled&&(e.targetType!==t||this.api.plugins.TimelinePointer.isLocked("down")||this.onPointerDown(e))}onTimelinePointerMove(e){this.data.enabled&&e.targetType===t&&"item-resizing"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove(e)}onTimelinePointerUp(e){this.data.enabled&&e.targetType===t&&"item-resizing"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp(e)}onPointerDown(t){const e=t.originalEvent.target.closest("."+d);if(e&&!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"),t.originalEvent.preventDefault(),t.originalEvent.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.thresholdReached=!1,""!==this.data.state&&"end"!==this.data.state||(this.data.state="resize"),e.classList.contains(d+l)&&this.onLeftPointerDown(),e.classList.contains(d+h)&&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)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*t.multiplier):this.api.setScrollLeft(e.dataIndex-1)}else if(this.data.autoScroll.speed>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*this.data.autoScroll.speed*t.multiplier):this.api.setScrollLeft(e.dataIndex-this.data.autoScroll.speed)}this.scrollWaiting=0}scrollRight(){if(!this.data.autoScroll.speed)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*t.multiplier):this.api.setScrollLeft(e.dataIndex+1)}else if(this.data.autoScroll.speed>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*this.data.autoScroll.speed*t.multiplier):this.api.setScrollLeft(e.dataIndex+this.data.autoScroll.speed)}this.scrollWaiting=0}autoScroll(t){if(!this.timelineElement)return;const e=t.currentPosition.x,i=this.timelineElement.getBoundingClientRect();e<this.data.autoScroll.edgeThreshold?this.scrollLeft():e>i.width-this.data.autoScroll.edgeThreshold&&this.scrollRight()}onPointerMove(t){if(!this.data.enabled)return;const{original:e,modified:i}=this.getItemsForDiff();e&&(this.data.movement={px:t.movement.x,time:i.time.start-e.time.start},Math.abs(t.movement.x)>=this.data.threshold&&(this.data.thresholdReached=!0),"resize"!==this.data.state&&"start"!==this.data.state||(this.data.state="resize"),t.movement.x&&this.data.thresholdReached&&this.autoScroll(t),this.data.thresholdReached&&(this.data.leftIsMoving&&this.onLeftPointerMove(t),this.data.rightIsMoving&&this.onRightPointerMove(t)))}onLeftPointerMove(t){if(!this.data.enabled||!this.data.leftIsMoving)return;const e=this.getSelectedItems(),i={},s=this.state.get("$data.chart.time"),{original:a,modified:n}=this.getItemsForDiff(),o=this.data.movement={px:t.movement.x,time:n.time.start-a.time.start},d=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.initialPosition.x,!0,s)),l=this.data.snapToTime.start({startTime:d,item:e[0],time:s,movement:o,vido:this.vido}),h=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x,!0,s)),r=this.api.time.getDatesDiffPx(l,h,s,!0);for(let t=0,a=e.length;t<a;t++){const a=e[t],n=this.api.mergeDeep({},this.api.getItemData(a.id));let d=this.api.mergeDeep({},this.data.initialItemsData[a.id]).position.left+r;d>n.position.right-a.minWidth&&(d=n.position.right-a.minWidth);const l=this.api.time.getTimeFromOffsetPx(d,!0,s),h=this.data.snapToTime.start({startTime:this.api.time.date(l),item:a,time:s,movement:o,vido:this.vido});a.time.start=h.valueOf(),n.time.startDate=h;if((a.time.start<s.from||a.time.end>s.to)&&("function"==typeof s.format.periodIncrement||!this.data.allowItemsToGoOutsideTheArea)){const t=this.api.getItem(a.id);a.time.start=t.time.start,a.time.end=t.time.end,n.time.startDate=this.api.time.date(a.time.start),n.time.endDate=this.api.time.date(a.time.end)}i[a.id]=n}this.dispatchEvent("onResize",e,i),this.updateData()}getItemsToMove(){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();return{itemsToMove:t,dependantIds:i}}onRightPointerMove(t){if(!this.data.enabled||!this.data.rightIsMoving)return;const{itemsToMove:e,dependantIds:i}=this.getItemsToMove(),s={},a=this.state.get("$data.chart.time"),{original:n,modified:o}=this.getItemsForDiff(),d=this.data.movement={px:t.movement.x,time:o.time.start-n.time.start},l=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.initialPosition.x,!0,a)),h=this.data.snapToTime.end({endTime:l,item:null,time:a,movement:d,vido:this.vido}),r=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x,!0,a)),m=this.api.time.getDatesDiffPx(h,r,a,!0);for(let t=0,n=e.length;t<n;t++){const n=e[t],o=this.api.mergeDeep({},this.api.getItemData(n.id)),l=this.api.mergeDeep({},this.data.initialItemsData[n.id]),h=i.includes(n.id);let r=l.position.left+l.timeWidth+m;!h&&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(h||(c=this.data.snapToTime.end({endTime:this.api.time.date(p),item:n,time:a,movement:d,vido:this.vido})),h){const t=this.data.initialItems.find((t=>t.dependant.includes(l.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 h=-this.api.time.getDSTDiffForLevel(a.level,e.time.endDate.valueOf(),l.time.startDate.valueOf(),a),r=this.api.time.addTimeFromDates(l.time.startDate.valueOf(),d+h,a);h=this.api.time.getDSTDiffForLevel(a.level,i.time.endDate.valueOf(),r,a),r+=h;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,l.time.startDate.valueOf(),l.time.endDate.valueOf(),a);const f=g+l.timeWidth;let v;const P=l.time.endDate.valueOf()-l.time.startDate.valueOf();v=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(f,!0,a)):this.api.time.date(m.valueOf()+P),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;if((n.time.start<a.from||n.time.end>a.to)&&("function"==typeof a.format.periodIncrement||!this.data.allowItemsToGoOutsideTheArea)){const t=this.api.getItem(n.id);n.time.start=t.time.start,n.time.end=t.time.end,o.time.startDate=this.api.time.date(n.time.start),o.time.endDate=this.api.time.date(n.time.end)}s[n.id]=o}this.dispatchEvent("onResize",e,s),this.updateData()}onEnd(){const{itemsToMove:t}=this.getItemsToMove();this.dispatchEvent("onEnd",t)}onPointerUp(t){"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.updateData())}onRightPointerUp(){document.body.classList.remove(this.data.bodyClassRight),this.data.enabled&&this.data.rightIsMoving&&(this.data.rightIsMoving=!1)}PluginItemResizingInnerSlot(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 l=e.item;if(!l)return;const h=this.api.getItemData(l.id);if(!h)return;let r;i=!h.detached,this.data.handle.onlyWhenSelected&&(i=i&&h.selected),i=i&&!(this.data.handle.outside||h.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(l,o),this.updateLeftStyleMap(l,n),r="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},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}`}PluginItemResizingOuterSlot(e,i){let s,a,n;const o=new e.StyleMap({}),d=new e.StyleMap({});return e.onChange((l=>{if(!(i=l)||!i.item)return;const h=i.item;if(!h)return;const r=this.api.getItemData(h.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(h,d),this.updateLeftStyleMap(h,o),m="function"==typeof this.data.content?this.data.content({item:h,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=${d.directive()}>${m.right}</div>`,e.update()})),t=>this.html`${s?a:null}${t}${s?n:null}`}}function m(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 o=new r(e,t);return i.pluginInitialized(a),o.destroy}}export{m 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.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18
* @license SEE LICENSE IN LICENSE FILE
*/const a=s("chart-timeline-items-row-item-resizing-handle-content-line");const n="ItemResizing",o=`config.plugin.${n}`,d="chart-timeline-items-row-item-resizing-handle",l=s(d),h="--left",r="--right";class m{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,vido:i})=>i.api.time.findOrCreateMainDateAtTime(t.valueOf(),e).leftGlobalDate,end:({endTime:t,time:e,vido:i})=>i.api.time.findOrCreateMainDateAtTime(t.valueOf(),e).rightGlobalDate},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,allowItemsToGoOutsideTheArea:!0,threshold:10,thresholdReached:!1},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.PluginItemResizingInnerSlot=this.PluginItemResizingInnerSlot.bind(this),this.PluginItemResizingOuterSlot=this.PluginItemResizingOuterSlot.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(o,(t=>{t.enabled?document.body.classList.add(t.bodyClass):document.body.classList.remove(t.bodyClass),this.data=t}))),this.onTimelinePointerDown=this.onTimelinePointerDown.bind(this),this.onTimelinePointerMove=this.onTimelinePointerMove.bind(this),this.onTimelinePointerUp=this.onTimelinePointerUp.bind(this),this.api.plugins.TimelinePointer.addPointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.addPointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.addPointerListener("up",this.onTimelinePointerUp),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>(t.includes(this.PluginItemResizingInnerSlot)||t.push(this.PluginItemResizingInnerSlot),t))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>(t.includes(this.PluginItemResizingOuterSlot)||t.push(this.PluginItemResizingOuterSlot),t)))}destroy(){this.onDestroy.forEach((t=>t())),this.api.plugins.TimelinePointer.removePointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.removePointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.removePointerListener("up",this.onTimelinePointerUp),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>t.filter((t=>t!==this.PluginItemResizingInnerSlot)))),this.state.update("config.slots.chart-timeline-items-row-item.outer",(t=>t.filter((t=>t!==this.PluginItemResizingOuterSlot)))),this.api.pluginDestroyed(n)}updateData(){this.state.update(o,this.data)}setUpClasses(t=!1){this.leftClassName=this.api.getClass(d),this.leftClassName+=" "+this.leftClassName+h,this.rightClassName=this.api.getClass(d),this.rightClassName+=" "+this.rightClassName+r,t&&(this.leftClassName+=` ${this.api.getClass(d)}--left-outside`,this.rightClassName+=` ${this.api.getClass(d)}--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.outOfView.right?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.outOfView.left?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}}onTimelinePointerDown(t){this.data.enabled&&(t.targetType!==e||this.api.plugins.TimelinePointer.isLocked("down")||this.onPointerDown(t))}onTimelinePointerMove(t){this.data.enabled&&t.targetType===e&&"item-resizing"===this.api.plugins.TimelinePointer.isLocked("move")&&this.onPointerMove(t)}onTimelinePointerUp(t){this.data.enabled&&t.targetType===e&&"item-resizing"===this.api.plugins.TimelinePointer.isLocked("up")&&this.onPointerUp(t)}onPointerDown(t){const e=t.originalEvent.target.closest("."+l);if(e&&!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"),t.originalEvent.preventDefault(),t.originalEvent.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.thresholdReached=!1,""!==this.data.state&&"end"!==this.data.state||(this.data.state="resize"),e.classList.contains(l+h)&&this.onLeftPointerDown(),e.classList.contains(l+r)&&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)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*t.multiplier):this.api.setScrollLeft(e.dataIndex-1)}else if(this.data.autoScroll.speed>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx-120*this.data.autoScroll.speed*t.multiplier):this.api.setScrollLeft(e.dataIndex-this.data.autoScroll.speed)}this.scrollWaiting=0}scrollRight(){if(!this.data.autoScroll.speed)return;if(this.state.get("config.chart.time.calculatedZoomMode"))return;this.scrollWaiting++;const t=this.state.get("config.scroll.horizontal");if(this.data.autoScroll.speed<0){if(this.scrollWaiting-1<Math.abs(this.data.autoScroll.speed))return;const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*t.multiplier):this.api.setScrollLeft(e.dataIndex+1)}else if(this.data.autoScroll.speed>0){const e=this.api.getScrollLeft();t.byPixels?this.api.setScrollLeft(e.absolutePosPx+120*this.data.autoScroll.speed*t.multiplier):this.api.setScrollLeft(e.dataIndex+this.data.autoScroll.speed)}this.scrollWaiting=0}autoScroll(t){if(!this.timelineElement)return;const e=t.currentPosition.x,i=this.timelineElement.getBoundingClientRect();e<this.data.autoScroll.edgeThreshold?this.scrollLeft():e>i.width-this.data.autoScroll.edgeThreshold&&this.scrollRight()}onPointerMove(t){if(!this.data.enabled)return;const{original:e,modified:i}=this.getItemsForDiff();e&&(this.data.movement={px:t.movement.x,time:i.time.start-e.time.start},Math.abs(t.movement.x)>=this.data.threshold&&(this.data.thresholdReached=!0),"resize"!==this.data.state&&"start"!==this.data.state||(this.data.state="resize"),t.movement.x&&this.data.thresholdReached&&this.autoScroll(t),this.data.thresholdReached&&(this.data.leftIsMoving&&this.onLeftPointerMove(t),this.data.rightIsMoving&&this.onRightPointerMove(t)))}onLeftPointerMove(t){if(!this.data.enabled||!this.data.leftIsMoving)return;const e=this.getSelectedItems(),i={},s=this.state.get("$data.chart.time"),{original:a,modified:n}=this.getItemsForDiff(),o=this.data.movement={px:t.movement.x,time:n.time.start-a.time.start},d=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.initialPosition.x,!0,s)),l=this.data.snapToTime.start({startTime:d,item:e[0],time:s,movement:o,vido:this.vido}),h=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x,!0,s)),r=this.api.time.getDatesDiffPx(l,h,s,!0);for(let t=0,a=e.length;t<a;t++){const a=e[t],n=this.api.mergeDeep({},this.api.getItemData(a.id));let d=this.api.mergeDeep({},this.data.initialItemsData[a.id]).position.left+r;d>n.position.right-a.minWidth&&(d=n.position.right-a.minWidth);const l=this.api.time.getTimeFromOffsetPx(d,!0,s),h=this.data.snapToTime.start({startTime:this.api.time.date(l),item:a,time:s,movement:o,vido:this.vido});a.time.start=h.valueOf(),n.time.startDate=h;if((a.time.start<s.from||a.time.end>s.to)&&("function"==typeof s.format.periodIncrement||!this.data.allowItemsToGoOutsideTheArea)){const t=this.api.getItem(a.id);a.time.start=t.time.start,a.time.end=t.time.end,n.time.startDate=this.api.time.date(a.time.start),n.time.endDate=this.api.time.date(a.time.end)}i[a.id]=n}this.dispatchEvent("onResize",e,i),this.updateData()}getItemsToMove(){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();return{itemsToMove:t,dependantIds:i}}onRightPointerMove(t){if(!this.data.enabled||!this.data.rightIsMoving)return;const{itemsToMove:e,dependantIds:i}=this.getItemsToMove(),s={},a=this.state.get("$data.chart.time"),{original:n,modified:o}=this.getItemsForDiff(),d=this.data.movement={px:t.movement.x,time:o.time.start-n.time.start},l=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.initialPosition.x,!0,a)),h=this.data.snapToTime.end({endTime:l,item:null,time:a,movement:d,vido:this.vido}),r=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x,!0,a)),m=this.api.time.getDatesDiffPx(h,r,a,!0);for(let t=0,n=e.length;t<n;t++){const n=e[t],o=this.api.mergeDeep({},this.api.getItemData(n.id)),l=this.api.mergeDeep({},this.data.initialItemsData[n.id]),h=i.includes(n.id);let r=l.position.left+l.timeWidth+m;!h&&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(h||(c=this.data.snapToTime.end({endTime:this.api.time.date(p),item:n,time:a,movement:d,vido:this.vido})),h){const t=this.data.initialItems.find((t=>t.dependant.includes(l.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 h=-this.api.time.getDSTDiffForLevel(a.level,e.time.endDate.valueOf(),l.time.startDate.valueOf(),a),r=this.api.time.addTimeFromDates(l.time.startDate.valueOf(),d+h,a);h=this.api.time.getDSTDiffForLevel(a.level,i.time.endDate.valueOf(),r,a),r+=h;const m=this.api.time.date(r),p=m.valueOf(),u=this.api.time.getViewOffsetPxFromDates(m,!1,a);let g=-this.api.time.getDSTDiffForLevel(a.level,l.time.startDate.valueOf(),l.time.endDate.valueOf(),a);const f=u+l.timeWidth;let v;const P=l.time.endDate.valueOf()-l.time.startDate.valueOf();v=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(f,!0,a)):this.api.time.date(m.valueOf()+P),g+=this.api.time.getDSTDiffForLevel(a.level,p,v.valueOf(),a),v=v.add(g,"ms"),c=v,n.time.start=m.valueOf(),o.time.startDate=m}n.time.end=c.valueOf(),o.time.endDate=c;if((n.time.start<a.from||n.time.end>a.to)&&("function"==typeof a.format.periodIncrement||!this.data.allowItemsToGoOutsideTheArea)){const t=this.api.getItem(n.id);n.time.start=t.time.start,n.time.end=t.time.end,o.time.startDate=this.api.time.date(n.time.start),o.time.endDate=this.api.time.date(n.time.end)}s[n.id]=o}this.dispatchEvent("onResize",e,s),this.updateData()}onEnd(){const{itemsToMove:t}=this.getItemsToMove();this.dispatchEvent("onEnd",t)}onPointerUp(t){"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.updateData())}onRightPointerUp(){document.body.classList.remove(this.data.bodyClassRight),this.data.enabled&&this.data.rightIsMoving&&(this.data.rightIsMoving=!1)}PluginItemResizingInnerSlot(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 l=e.item;if(!l)return;const h=this.api.getItemData(l.id);if(!h)return;let r;i=!h.detached,this.data.handle.onlyWhenSelected&&(i=i&&h.selected),i=i&&!(this.data.handle.outside||h.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(l,o),this.updateLeftStyleMap(l,n),r="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},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}`}PluginItemResizingOuterSlot(t,i){let s,a,n;const o=new t.StyleMap({}),d=new t.StyleMap({});return t.onChange((l=>{if(!(i=l)||!i.item)return;const h=i.item;if(!h)return;const r=this.api.getItemData(h.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(h,d),this.updateLeftStyleMap(h,o),m="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},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(o);s&&(t=e.api.mergeDeep({},t,s));const a=new m(e,t);return i.pluginInitialized(n),a.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -26,0 +26,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.34.1
* @version 3.34.2
* @released 2023-08-18

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

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

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

* @link https://gantt-schedule-timeline-calendar.neuronet.io
* @version 3.34.1
* @version 3.34.2
* @released 2023-08-18

@@ -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.34.1
* @version 3.34.2
* @released 2023-08-18
* @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="TimelinePointer",n=`config.plugin.${s}`;class o{constructor(t,s){this.locked={up:!1,move:!1,down:!1},this.initialScrollPosPx={horizontal:0,vertical:0},this.onDestroy=[],this.classNames={cell:"",item:""},this.api=s.api,this.state=s.state,this.apiPointerListeners={down:new Set,move:new Set,up:new Set},this.pointerDown=this.pointerDown.bind(this),this.pointerMove=this.pointerMove.bind(this),this.pointerMove=s.schedule(this.pointerMove),this.pointerUp=this.pointerUp.bind(this),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>{t&&(this.element=t,this.element.removeEventListener("pointerdown",this.pointerDown),this.element.addEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.addEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove),document.addEventListener("pointermove",this.pointerMove))}))),this.apiLock=this.apiLock.bind(this),this.apiUnlock=this.apiUnlock.bind(this),this.apiIsLocked=this.apiIsLocked.bind(this),this.apiAddPointerListener=this.apiAddPointerListener.bind(this),this.apiRemovePointerListener=this.apiRemovePointerListener.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.api.plugins.TimelinePointer={lock:this.apiLock,unlock:this.apiUnlock,isLocked:this.apiIsLocked,addPointerListener:this.apiAddPointerListener,removePointerListener:this.apiRemovePointerListener},this.onDestroy.push(this.state.subscribe(n,(t=>this.data=t)))}destroy(){this.onDestroy.forEach((t=>t())),this.element.removeEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove),this.api.pluginDestroyed(s)}updateData(){this.state.update(n,(()=>Object.assign({},this.data)))}apiLock(t,e=!0){this.locked[t]=e}apiUnlock(t){this.locked[t]=!1}apiIsLocked(t){return this.locked[t]}apiAddPointerListener(t,e){this.apiPointerListeners[t].add(e)}apiRemovePointerListener(t,e){this.apiPointerListeners[t].delete(e)}apiTriggerPointerListener(t,e){this.apiPointerListeners[t].forEach((t=>t(e)))}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;this.initialScrollPosPx.horizontal=this.state.get("$data.scroll.horizontal.handlePosPx"),this.initialScrollPosPx.vertical=this.state.get("$data.scroll.vertical.handlePosPx"),this.data.pointerState="down",this.data.currentTarget=t.target;const a=this.getRealTarget(t);if(this.data.realTarget=a,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 s=this.getRealPosition(t);this.data.initialPosition=s,this.data.currentPosition=s;const n={type:this.data.pointerState,originalEvent:t,targetElement:a,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:{x:0,y:0},initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("down",n),this.updateData()}pointerUp(t){if(!this.data.enabled)return;this.data.pointerState="up",this.data.isMoving=!1,this.data.events.up=t,this.data.currentPosition=this.getRealPosition(t);const e={type:this.data.pointerState,originalEvent:t,targetElement:this.data.realTarget,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:this.data.movement,initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("up",e),this.data.realTarget=null,this.data.targetData=null,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.horizontal;const i={type:this.data.pointerState,originalEvent:t,targetElement:this.data.realTarget,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:this.data.movement,initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("move",i),this.updateData()}}t.CELL=e,t.ITEM=i,t.Plugin=function(t={}){return function(e){const i=e.api,s=e.api.mergeDeep,r=e.state.get(n);r&&(t=s(s({},t),r));const h=a(t);e.state.update(n,h);const l=new o(t,e);return i.pluginInitialized("TimelinePointer"),l.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "gantt-schedule-timeline-calendar",
"version": "3.34.1",
"version": "3.34.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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc