Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 0.1.4 to 0.1.5

src/components/Chart/Timeline/ChartTimelineGridRowBlock.ts

5

dist/DependencyLines.plugin.js
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).DependencyLines=n()}(this,(function(){"use strict";
/**
* Gantt-Schedule-Timeline-Calendar
* DependencyLines plugin
*

@@ -8,4 +8,5 @@ * @copyright Rafal Pospiech <https://neuronet.io>

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/return function(e={}){return function(e,n){e.update("config.wrappers.ChartTimelineGrid",t=>(function(i,o){e.get("config.chart.items");const c=o.vido.html`${i}<div class=${n.getClass("chart-timeline-dependency-lines")}>${[]}</div>`;return t(c,o)}))}}}));
//# sourceMappingURL=DependencyLines.plugin.js.map
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ItemHold=t()}(this,(function(){"use strict";
/**
* ItemsHold plugin
* ItemHold plugin
*

@@ -8,4 +8,5 @@ * @copyright Rafal Pospiech <https://neuronet.io>

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/return function(e={}){e={...{time:1e3,movementThreshold:2,action(e,t){}},...e};const t={},n={x:0,y:0};function o(e){void 0!==t[e]&&delete t[e]}function i(i,d){function u(o){!function(o,i,d){void 0===t[o.id]&&(t[o.id]={x:d.x,y:d.y},setTimeout(()=>{if(void 0!==t[o.id]){let d=!0,u=t[o.id].x-n.x;-1===Math.sign(u)&&(u=-u);let m=t[o.id].y-n.y;-1===Math.sign(m)&&(m=-m),u>e.movementThreshold&&(d=!1),m>e.movementThreshold&&(d=!1),delete t[o.id],d&&e.action(i,o)}},e.time))}(d.item,i,o)}function m(e){n.x=e.x,n.y=e.y}return i.addEventListener("mousedown",u),document.addEventListener("mouseup",(function(){o(d.item.id)})),document.addEventListener("mousemove",m),{update(e,t){d=t},destroy(e,t){document.removeEventListener("mouseup",o),document.removeEventListener("mousemove",m),e.removeEventListener("mousedown",u)}}}return function(e,t){e.update("config.actions.chart-timeline-items-row-item",e=>(e.push(i),e))}}}));
//# sourceMappingURL=ItemHold.plugin.js.map

3

dist/ItemMovement.plugin.js

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

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/return function(t={}){t={moveable:!0,resizeable:!0,resizerContent:"",collisionDetection:!0,outOfBorders:!1,snapStart:(t,e)=>t+e,snapEnd:(t,e)=>t+e,ghostNode:!0,...t};const e={};function i(i,n){let o,r,s=i.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content");if(!t.moveable&&!t.resizeable)return;function a(e){let i=t.resizeable&&(!e.item.hasOwnProperty("resizeable")||!0===e.item.resizeable);return e.row.hasOwnProperty("resizeable")&&i&&(i=e.row.resizeable),i}function m(t){const i=t.item.id;return void 0===e[i]&&(e[i]={moving:!1,resizing:!1}),e[i]}function l(e,i){if(t.ghostNode){const t=m(e),n=i.x-t.ganttLeft-t.itemLeftCompensation,r=o.get("config.scroll.compensation");t.ghost.style.left=n+"px",t.ghost.style.top=i.y-t.ganttTop-t.itemTop+r+"px"}}function c(i){t.ghostNode&&(void 0!==e[i]&&void 0!==e[i].ghost&&(o.get("_internal.elements.gantt").removeChild(e[i].ghost),delete e[i].ghost),s.style.opacity="1")}function d(e){let i=t.snapStart;return"function"==typeof e.item.snapStart&&(i=e.item.snapStart),i}function f(e){let i=t.snapEnd;return"function"==typeof e.item.snapEnd&&(i=e.item.snapEnd),i}o=n.state;const g=`<div class="${(r=n.api).getClass("chart-timeline-items-row-item-content-resizer")}">${t.resizerContent}</div>`;s.insertAdjacentHTML("beforeend",g);const u=s.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content-resizer");function p(e){if(e.stopPropagation(),0!==e.button)return;s=i.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content");const r=m(n);r.moving=!0;const a=o.get(`config.chart.items.${n.item.id}`),l=o.get("_internal.chart.time.leftGlobal"),c=o.get("_internal.chart.time.timePerPixel"),d=o.get("_internal.elements.gantt").getBoundingClientRect();r.ganttTop=d.top,r.ganttLeft=d.left,r.itemX=Math.round((a.time.start-l)/c),r.itemLeftCompensation=e.x-r.ganttLeft-r.itemX,function(e,i,n,r){const a=m(e);if(!t.ghostNode||void 0!==a.ghost)return;const l=s.cloneNode(!0),c=getComputedStyle(s);l.style.position="absolute",l.style.left=i.x-n-a.itemLeftCompensation+"px";const d=i.y-r-e.row.top-s.offsetTop;a.itemTop=d,l.style.top=i.y-r-d+"px",l.style.width=c.width,l.style["box-shadow"]="10px 10px 6px #00000020";const f=s.clientHeight+"px";l.style.height=f,l.style["line-height"]=f,l.style.opacity="0.75",o.get("_internal.elements.gantt").appendChild(l),a.ghost=l}(n,e,d.left,d.top)}function h(t){if(t.stopPropagation(),0!==t.button)return;const e=m(n);e.resizing=!0;const i=o.get(`config.chart.items.${n.item.id}`),r=o.get("_internal.chart.time.leftGlobal"),s=o.get("_internal.chart.time.timePerPixel"),a=o.get("_internal.elements.gantt").getBoundingClientRect();e.ganttTop=a.top,e.ganttLeft=a.left,e.itemX=(i.time.end-r)/s,e.itemLeftCompensation=t.x-e.ganttLeft-e.itemX}function v(e,i,n,s){if(!t.collisionDetection)return!1;const a=o.get("_internal.chart.time");if(t.outOfBorders&&(n<a.from||s>a.to))return!0;let m=r.time.date(s).diff(n,"milliseconds");if(-1===Math.sign(m)&&(m=-m),m<=1)return!0;const l=o.get("config.list.rows."+e);for(const t of l._internal.items)if(t.id!==i){if(n>=t.time.start&&n<=t.time.end)return!0;if(s>=t.time.start&&s<=t.time.end)return!0;if(n<=t.time.start&&s>=t.time.end)return!0}return!1}function y(e){const i=m(n);let r,s,c,g,u;(i.moving||i.resizing)&&(e.stopPropagation(),r=o.get(`config.chart.items.${n.item.id}`),s=o.get(`config.chart.items.${n.item.id}.rowId`),c=o.get(`config.list.rows.${s}`),g=o.get("config.chart.time.zoom"),u=o.get("_internal.chart.time.timePerPixel"));const p=function(e){let i=t.moveable;return e.item.hasOwnProperty("moveable")&&i&&(i=e.item.moveable),e.row.hasOwnProperty("moveable")&&i&&(i=e.row.moveable),i}(n);if(i.moving){if((!0===p||"x"===p||Array.isArray(p)&&p.includes(s))&&function(t,e,i,r,s){t.stopPropagation();const a=m(n),c=t.x-a.ganttLeft-a.itemLeftCompensation;l(n,t);const g=o.get("_internal.chart.time.leftGlobal")+c*s-i.time.start,u=i.time.start,p=d(n)(i.time.start,g,i)-u,h=v(e.id,i.id,i.time.start+p,i.time.end+p);p&&!h&&o.update(`config.chart.items.${n.item.id}.time`,(function(t){return t.start+=p,t.end=f(n)(t.end,p,i)-1,t}))}(e,c,r,0,u),!p||"x"===p)return;let t=function(t,e,i,r,s){t.stopPropagation(),l(n,t);const a=m(n),c=t.y-a.ganttTop,d=o.get("_internal.list.visibleRows"),f=o.get("config.scroll.compensation");let g=0;for(const t of d){if(t.top+f>c)return g>0?g-1:0;g++}return g}(e);const i=o.get("_internal.list.visibleRows");void 0===i[t]&&(t>0?t=i.length-1:t<0&&(t=0));const a=i[t],g=a.id,h=v(g,r.id,r.time.start,r.time.end);g===r.rowId||h||Array.isArray(p)&&!p.includes(g)||a.hasOwnProperty("moveable")&&!a.moveable||o.update(`config.chart.items.${r.id}.rowId`,g)}else!i.resizing||void 0!==r.resizeable&&!0!==r.resizeable||function(t,e,i,r,s){if(t.stopPropagation(),!a(n))return;const l=o.get("_internal.chart.time"),c=m(n),g=t.x-c.ganttLeft-c.itemLeftCompensation,u=l.leftGlobal+g*s-i.time.end;if(i.time.end+u<i.time.start)return;const p=i.time.end,h=f(n)(i.time.end,u,i)-1-p,y=v(e.id,i.id,i.time.start,i.time.end+h);h&&!y&&o.update(`config.chart.items.${n.item.id}.time`,t=>(t.start=d(n)(t.start,0,i),t.end=f(n)(t.end,h,i)-1,t))}(e,c,r,0,u)}function b(t){const i=m(n);(i.moving||i.resizing)&&t.stopPropagation(),i.moving=!1,i.resizing=!1;for(const t in e)e[t].moving=!1,e[t].resizing=!1,c(t)}return a(n)?u.style.visibility="visible":u.style.visibility="hidden",s.addEventListener("mousedown",p),u.addEventListener("mousedown",h,{capture:!0}),document.addEventListener("mousemove",y,{capture:!0,passive:!0}),document.addEventListener("mouseup",b,{capture:!0,passive:!0}),{update(t,e){a(n=e)?u.style.visibility="visible":u.style.visibility="hidden"},destroy(t,e){s.removeEventListener("mousedown",p),u.removeEventListener("mousedown",h),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",b),u.remove()}}}return function(t,e){t.update("config.actions.chart-timeline-items-row-item",t=>(t.push(i),t))}}}));
//# sourceMappingURL=ItemMovement.plugin.js.map
/**
* ItemsHold plugin
* ItemHold plugin
*

@@ -7,3 +7,4 @@ * @copyright Rafal Pospiech <https://neuronet.io>

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/

@@ -17,4 +18,5 @@ function t(t={}){t={...{time:1e3,movementThreshold:2,action(t,e){}},...t};const e={},n={x:0,y:0};function i(t){void 0!==e[t]&&delete e[t]}function o(o,s){function r(i){!function(i,o,s){void 0===e[i.id]&&(e[i.id]={x:s.x,y:s.y},setTimeout(()=>{if(void 0!==e[i.id]){let s=!0,r=e[i.id].x-n.x;-1===Math.sign(r)&&(r=-r);let a=e[i.id].y-n.y;-1===Math.sign(a)&&(a=-a),r>t.movementThreshold&&(s=!1),a>t.movementThreshold&&(s=!1),delete e[i.id],s&&t.action(o,i)}},t.time))}(s.item,o,i)}function a(t){n.x=t.x,n.y=t.y}return o.addEventListener("mousedown",r),document.addEventListener("mouseup",(function(){i(s.item.id)})),document.addEventListener("mousemove",a),{update(t,e){s=e},destroy(t,e){document.removeEventListener("mouseup",i),document.removeEventListener("mousemove",a),t.removeEventListener("mousedown",r)}}}return function(t,e){t.update("config.actions.chart-timeline-items-row-item",t=>(t.push(o),t))}}

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
*/function e(t={}){t={moveable:!0,resizeable:!0,resizerContent:"",collisionDetection:!0,outOfBorders:!1,snapStart:(t,e)=>t+e,snapEnd:(t,e)=>t+e,ghostNode:!0,...t};const e={};function n(n,i){let o,s,r=n.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content");if(!t.moveable&&!t.resizeable)return;function a(e){let n=t.resizeable&&(!e.item.hasOwnProperty("resizeable")||!0===e.item.resizeable);return e.row.hasOwnProperty("resizeable")&&n&&(n=e.row.resizeable),n}function m(t){const n=t.item.id;return void 0===e[n]&&(e[n]={moving:!1,resizing:!1}),e[n]}function l(e,n){if(t.ghostNode){const t=m(e),i=n.x-t.ganttLeft-t.itemLeftCompensation,s=o.get("config.scroll.compensation");t.ghost.style.left=i+"px",t.ghost.style.top=n.y-t.ganttTop-t.itemTop+s+"px"}}function c(n){t.ghostNode&&(void 0!==e[n]&&void 0!==e[n].ghost&&(o.get("_internal.elements.gantt").removeChild(e[n].ghost),delete e[n].ghost),r.style.opacity="1")}function d(e){let n=t.snapStart;return"function"==typeof e.item.snapStart&&(n=e.item.snapStart),n}function u(e){let n=t.snapEnd;return"function"==typeof e.item.snapEnd&&(n=e.item.snapEnd),n}o=i.state;const g=`<div class="${(s=i.api).getClass("chart-timeline-items-row-item-content-resizer")}">${t.resizerContent}</div>`;r.insertAdjacentHTML("beforeend",g);const f=r.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content-resizer");function p(e){if(e.stopPropagation(),0!==e.button)return;r=n.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content");const s=m(i);s.moving=!0;const a=o.get(`config.chart.items.${i.item.id}`),l=o.get("_internal.chart.time.leftGlobal"),c=o.get("_internal.chart.time.timePerPixel"),d=o.get("_internal.elements.gantt").getBoundingClientRect();s.ganttTop=d.top,s.ganttLeft=d.left,s.itemX=Math.round((a.time.start-l)/c),s.itemLeftCompensation=e.x-s.ganttLeft-s.itemX,function(e,n,i,s){const a=m(e);if(!t.ghostNode||void 0!==a.ghost)return;const l=r.cloneNode(!0),c=getComputedStyle(r);l.style.position="absolute",l.style.left=n.x-i-a.itemLeftCompensation+"px";const d=n.y-s-e.row.top-r.offsetTop;a.itemTop=d,l.style.top=n.y-s-d+"px",l.style.width=c.width,l.style["box-shadow"]="10px 10px 6px #00000020";const u=r.clientHeight+"px";l.style.height=u,l.style["line-height"]=u,l.style.opacity="0.75",o.get("_internal.elements.gantt").appendChild(l),a.ghost=l}(i,e,d.left,d.top)}function h(t){if(t.stopPropagation(),0!==t.button)return;const e=m(i);e.resizing=!0;const n=o.get(`config.chart.items.${i.item.id}`),s=o.get("_internal.chart.time.leftGlobal"),r=o.get("_internal.chart.time.timePerPixel"),a=o.get("_internal.elements.gantt").getBoundingClientRect();e.ganttTop=a.top,e.ganttLeft=a.left,e.itemX=(n.time.end-s)/r,e.itemLeftCompensation=t.x-e.ganttLeft-e.itemX}function v(e,n,i,r){if(!t.collisionDetection)return!1;const a=o.get("_internal.chart.time");if(t.outOfBorders&&(i<a.from||r>a.to))return!0;let m=s.time.date(r).diff(i,"milliseconds");if(-1===Math.sign(m)&&(m=-m),m<=1)return!0;const l=o.get("config.list.rows."+e);for(const t of l._internal.items)if(t.id!==n){if(i>=t.time.start&&i<=t.time.end)return!0;if(r>=t.time.start&&r<=t.time.end)return!0;if(i<=t.time.start&&r>=t.time.end)return!0}return!1}function y(e){const n=m(i);let s,r,c,g,f;(n.moving||n.resizing)&&(e.stopPropagation(),s=o.get(`config.chart.items.${i.item.id}`),r=o.get(`config.chart.items.${i.item.id}.rowId`),c=o.get(`config.list.rows.${r}`),g=o.get("config.chart.time.zoom"),f=o.get("_internal.chart.time.timePerPixel"));const p=function(e){let n=t.moveable;return e.item.hasOwnProperty("moveable")&&n&&(n=e.item.moveable),e.row.hasOwnProperty("moveable")&&n&&(n=e.row.moveable),n}(i);if(n.moving){if((!0===p||"x"===p||Array.isArray(p)&&p.includes(r))&&function(t,e,n,s,r){t.stopPropagation();const a=m(i),c=t.x-a.ganttLeft-a.itemLeftCompensation;l(i,t);const g=o.get("_internal.chart.time.leftGlobal")+c*r-n.time.start,f=n.time.start,p=d(i)(n.time.start,g,n)-f,h=v(e.id,n.id,n.time.start+p,n.time.end+p);p&&!h&&o.update(`config.chart.items.${i.item.id}.time`,(function(t){return t.start+=p,t.end=u(i)(t.end,p,n)-1,t}))}(e,c,s,0,f),!p||"x"===p)return;let t=function(t,e,n,s,r){t.stopPropagation(),l(i,t);const a=m(i),c=t.y-a.ganttTop,d=o.get("_internal.list.visibleRows"),u=o.get("config.scroll.compensation");let g=0;for(const t of d){if(t.top+u>c)return g>0?g-1:0;g++}return g}(e);const n=o.get("_internal.list.visibleRows");void 0===n[t]&&(t>0?t=n.length-1:t<0&&(t=0));const a=n[t],g=a.id,h=v(g,s.id,s.time.start,s.time.end);g===s.rowId||h||Array.isArray(p)&&!p.includes(g)||a.hasOwnProperty("moveable")&&!a.moveable||o.update(`config.chart.items.${s.id}.rowId`,g)}else!n.resizing||void 0!==s.resizeable&&!0!==s.resizeable||function(t,e,n,s,r){if(t.stopPropagation(),!a(i))return;const l=o.get("_internal.chart.time"),c=m(i),g=t.x-c.ganttLeft-c.itemLeftCompensation,f=l.leftGlobal+g*r-n.time.end;if(n.time.end+f<n.time.start)return;const p=n.time.end,h=u(i)(n.time.end,f,n)-1-p,y=v(e.id,n.id,n.time.start,n.time.end+h);h&&!y&&o.update(`config.chart.items.${i.item.id}.time`,t=>(t.start=d(i)(t.start,0,n),t.end=u(i)(t.end,h,n)-1,t))}(e,c,s,0,f)}function w(t){const n=m(i);(n.moving||n.resizing)&&t.stopPropagation(),n.moving=!1,n.resizing=!1;for(const t in e)e[t].moving=!1,e[t].resizing=!1,c(t)}return a(i)?f.style.visibility="visible":f.style.visibility="hidden",r.addEventListener("mousedown",p),f.addEventListener("mousedown",h,{capture:!0}),document.addEventListener("mousemove",y,{capture:!0,passive:!0}),document.addEventListener("mouseup",w,{capture:!0,passive:!0}),{update(t,e){a(i=e)?f.style.visibility="visible":f.style.visibility="hidden"},destroy(t,e){r.removeEventListener("mousedown",p),f.removeEventListener("mousedown",h),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",w),f.remove()}}}return function(t,e){t.update("config.actions.chart-timeline-items-row-item",t=>(t.push(n),t))}}
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/function e(t={}){t={moveable:!0,resizeable:!0,resizerContent:"",collisionDetection:!0,outOfBorders:!1,snapStart:(t,e)=>t+e,snapEnd:(t,e)=>t+e,ghostNode:!0,...t};const e={};function n(n,i){let o,s,r=n.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content");if(!t.moveable&&!t.resizeable)return;function a(e){let n=t.resizeable&&(!e.item.hasOwnProperty("resizeable")||!0===e.item.resizeable);return e.row.hasOwnProperty("resizeable")&&n&&(n=e.row.resizeable),n}function m(t){const n=t.item.id;return void 0===e[n]&&(e[n]={moving:!1,resizing:!1}),e[n]}function c(e,n){if(t.ghostNode){const t=m(e),i=n.x-t.ganttLeft-t.itemLeftCompensation,s=o.get("config.scroll.compensation");t.ghost.style.left=i+"px",t.ghost.style.top=n.y-t.ganttTop-t.itemTop+s+"px"}}function l(n){t.ghostNode&&(void 0!==e[n]&&void 0!==e[n].ghost&&(o.get("_internal.elements.gantt").removeChild(e[n].ghost),delete e[n].ghost),r.style.opacity="1")}function d(e){let n=t.snapStart;return"function"==typeof e.item.snapStart&&(n=e.item.snapStart),n}function u(e){let n=t.snapEnd;return"function"==typeof e.item.snapEnd&&(n=e.item.snapEnd),n}o=i.state;const g=`<div class="${(s=i.api).getClass("chart-timeline-items-row-item-content-resizer")}">${t.resizerContent}</div>`;r.insertAdjacentHTML("beforeend",g);const f=r.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content-resizer");function p(e){if(e.stopPropagation(),0!==e.button)return;r=n.querySelector(".gantt-schedule-timeline-calendar__chart-timeline-items-row-item-content");const s=m(i);s.moving=!0;const a=o.get(`config.chart.items.${i.item.id}`),c=o.get("_internal.chart.time.leftGlobal"),l=o.get("_internal.chart.time.timePerPixel"),d=o.get("_internal.elements.gantt").getBoundingClientRect();s.ganttTop=d.top,s.ganttLeft=d.left,s.itemX=Math.round((a.time.start-c)/l),s.itemLeftCompensation=e.x-s.ganttLeft-s.itemX,function(e,n,i,s){const a=m(e);if(!t.ghostNode||void 0!==a.ghost)return;const c=r.cloneNode(!0),l=getComputedStyle(r);c.style.position="absolute",c.style.left=n.x-i-a.itemLeftCompensation+"px";const d=n.y-s-e.row.top-r.offsetTop;a.itemTop=d,c.style.top=n.y-s-d+"px",c.style.width=l.width,c.style["box-shadow"]="10px 10px 6px #00000020";const u=r.clientHeight+"px";c.style.height=u,c.style["line-height"]=u,c.style.opacity="0.75",o.get("_internal.elements.gantt").appendChild(c),a.ghost=c}(i,e,d.left,d.top)}function h(t){if(t.stopPropagation(),0!==t.button)return;const e=m(i);e.resizing=!0;const n=o.get(`config.chart.items.${i.item.id}`),s=o.get("_internal.chart.time.leftGlobal"),r=o.get("_internal.chart.time.timePerPixel"),a=o.get("_internal.elements.gantt").getBoundingClientRect();e.ganttTop=a.top,e.ganttLeft=a.left,e.itemX=(n.time.end-s)/r,e.itemLeftCompensation=t.x-e.ganttLeft-e.itemX}function v(e,n,i,r){if(!t.collisionDetection)return!1;const a=o.get("_internal.chart.time");if(t.outOfBorders&&(i<a.from||r>a.to))return!0;let m=s.time.date(r).diff(i,"milliseconds");if(-1===Math.sign(m)&&(m=-m),m<=1)return!0;const c=o.get("config.list.rows."+e);for(const t of c._internal.items)if(t.id!==n){if(i>=t.time.start&&i<=t.time.end)return!0;if(r>=t.time.start&&r<=t.time.end)return!0;if(i<=t.time.start&&r>=t.time.end)return!0}return!1}function y(e){const n=m(i);let s,r,l,g,f;(n.moving||n.resizing)&&(e.stopPropagation(),s=o.get(`config.chart.items.${i.item.id}`),r=o.get(`config.chart.items.${i.item.id}.rowId`),l=o.get(`config.list.rows.${r}`),g=o.get("config.chart.time.zoom"),f=o.get("_internal.chart.time.timePerPixel"));const p=function(e){let n=t.moveable;return e.item.hasOwnProperty("moveable")&&n&&(n=e.item.moveable),e.row.hasOwnProperty("moveable")&&n&&(n=e.row.moveable),n}(i);if(n.moving){if((!0===p||"x"===p||Array.isArray(p)&&p.includes(r))&&function(t,e,n,s,r){t.stopPropagation();const a=m(i),l=t.x-a.ganttLeft-a.itemLeftCompensation;c(i,t);const g=o.get("_internal.chart.time.leftGlobal")+l*r-n.time.start,f=n.time.start,p=d(i)(n.time.start,g,n)-f,h=v(e.id,n.id,n.time.start+p,n.time.end+p);p&&!h&&o.update(`config.chart.items.${i.item.id}.time`,(function(t){return t.start+=p,t.end=u(i)(t.end,p,n)-1,t}))}(e,l,s,0,f),!p||"x"===p)return;let t=function(t,e,n,s,r){t.stopPropagation(),c(i,t);const a=m(i),l=t.y-a.ganttTop,d=o.get("_internal.list.visibleRows"),u=o.get("config.scroll.compensation");let g=0;for(const t of d){if(t.top+u>l)return g>0?g-1:0;g++}return g}(e);const n=o.get("_internal.list.visibleRows");void 0===n[t]&&(t>0?t=n.length-1:t<0&&(t=0));const a=n[t],g=a.id,h=v(g,s.id,s.time.start,s.time.end);g===s.rowId||h||Array.isArray(p)&&!p.includes(g)||a.hasOwnProperty("moveable")&&!a.moveable||o.update(`config.chart.items.${s.id}.rowId`,g)}else!n.resizing||void 0!==s.resizeable&&!0!==s.resizeable||function(t,e,n,s,r){if(t.stopPropagation(),!a(i))return;const c=o.get("_internal.chart.time"),l=m(i),g=t.x-l.ganttLeft-l.itemLeftCompensation,f=c.leftGlobal+g*r-n.time.end;if(n.time.end+f<n.time.start)return;const p=n.time.end,h=u(i)(n.time.end,f,n)-1-p,y=v(e.id,n.id,n.time.start,n.time.end+h);h&&!y&&o.update(`config.chart.items.${i.item.id}.time`,t=>(t.start=d(i)(t.start,0,n),t.end=u(i)(t.end,h,n)-1,t))}(e,l,s,0,f)}function w(t){const n=m(i);(n.moving||n.resizing)&&t.stopPropagation(),n.moving=!1,n.resizing=!1;for(const t in e)e[t].moving=!1,e[t].resizing=!1,l(t)}return a(i)?f.style.visibility="visible":f.style.visibility="hidden",r.addEventListener("mousedown",p),f.addEventListener("mousedown",h,{capture:!0}),document.addEventListener("mousemove",y,{capture:!0,passive:!0}),document.addEventListener("mouseup",w,{capture:!0,passive:!0}),{update(t,e){a(i=e)?f.style.visibility="visible":f.style.visibility="hidden"},destroy(t,e){r.removeEventListener("mousedown",p),f.removeEventListener("mousedown",h),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",w),f.remove()}}}return function(t,e){t.update("config.actions.chart-timeline-items-row-item",t=>(t.push(n),t))}}
/**

@@ -26,4 +28,14 @@ * SaveAsImage plugin

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
*/function n(t={}){function e(e){const n=e.target,i=n.clientWidth,o=n.clientHeight,s=unescape(encodeURIComponent(n.outerHTML));let r="";for(const t of document.styleSheets)if("gstc"===t.title)for(const e of t.rules)r+=e.cssText;const a=`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${o}" viewBox="0 0 ${i} ${o}">\n <foreignObject x="0" y="0" width="${i}" height="${o}">\n <div xmlns="http://www.w3.org/1999/xhtml">\n ${r=`<style>* {${t.style}} ${r}</style>`}\n ${s}\n </div>\n </foreignObject>\n </svg>`,m=document.createElement("canvas");m.width=i,m.height=o;const l=m.getContext("2d");l.fillStyle="white",l.fillRect(0,0,i,o);const c="data:image/svg+xml;base64,"+btoa(a),d=new Image;d.onload=function(){l.drawImage(d,0,0),function(t,e){const n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click()}(m.toDataURL("image/jpeg",1),t.filename)},d.src=c}return t={style:"font-family: sans-serif;",filename:"gantt-schedule-timeline-calendar.jpeg",options:t},function(t,n){t.subscribe("_internal.elements.main",t=>{t&&t.addEventListener("save-as-image",e)})}}export{t as ItemHold,e as ItemMovement,n as SaveAsImage};
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/function n(t={}){function e(e){const n=e.target,i=n.clientWidth,o=n.clientHeight,s=unescape(encodeURIComponent(n.outerHTML));let r="";for(const t of document.styleSheets)if("gstc"===t.title)for(const e of t.rules)r+=e.cssText;const a=`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${o}" viewBox="0 0 ${i} ${o}">\n <foreignObject x="0" y="0" width="${i}" height="${o}">\n <div xmlns="http://www.w3.org/1999/xhtml">\n ${r=`<style>* {${t.style}} ${r}</style>`}\n ${s}\n </div>\n </foreignObject>\n </svg>`,m=document.createElement("canvas");m.width=i,m.height=o;const c=m.getContext("2d");c.fillStyle="white",c.fillRect(0,0,i,o);const l="data:image/svg+xml;base64,"+btoa(a),d=new Image;d.onload=function(){c.drawImage(d,0,0),function(t,e){const n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click()}(m.toDataURL("image/jpeg",1),t.filename)},d.src=l}return t={style:"font-family: sans-serif;",filename:"gantt-schedule-timeline-calendar.jpeg",options:t},function(t,n){t.subscribe("_internal.elements.main",t=>{t&&t.addEventListener("save-as-image",e)})}}
/**
* GridSelection plugin
*
* @copyright Rafal Pospiech <https://neuronet.io>
* @author Rafal Pospiech <neuronet.io@gmail.com>
* @package gantt-schedule-timeline-calendar
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/function i(){return function(t,e){t.update("config.actions.chart-timeline-grid-row-block",t=>t)}}export{i as GridSelection,t as ItemHold,e as ItemMovement,n as SaveAsImage};
//# sourceMappingURL=plugins.js.map

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

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/return function(e={}){function t(t){const n=t.target,o=n.clientWidth,i=n.clientHeight,s=unescape(encodeURIComponent(n.outerHTML));let c="";for(const e of document.styleSheets)if("gstc"===e.title)for(const t of e.rules)c+=t.cssText;const a=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${i}" viewBox="0 0 ${o} ${i}">\n <foreignObject x="0" y="0" width="${o}" height="${i}">\n <div xmlns="http://www.w3.org/1999/xhtml">\n ${c=`<style>* {${e.style}} ${c}</style>`}\n ${s}\n </div>\n </foreignObject>\n </svg>`,l=document.createElement("canvas");l.width=o,l.height=i;const d=l.getContext("2d");d.fillStyle="white",d.fillRect(0,0,o,i);const f="data:image/svg+xml;base64,"+btoa(a),m=new Image;m.onload=function(){d.drawImage(m,0,0),function(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click()}(l.toDataURL("image/jpeg",1),e.filename)},m.src=f}return e={style:"font-family: sans-serif;",filename:"gantt-schedule-timeline-calendar.jpeg",options:e},function(e,n){e.subscribe("_internal.elements.main",e=>{e&&e.addEventListener("save-as-image",t)})}}}));
//# sourceMappingURL=SaveAsImage.plugin.js.map
{
"name": "gantt-schedule-timeline-calendar",
"version": "0.1.4",
"version": "0.1.5",
"description": "Gantt, Schedule, Timeline, Calendar components all in one!",

@@ -5,0 +5,0 @@ "main": "dist/index.umd.js",

@@ -23,3 +23,3 @@ /**

const GridBlockComponent = state.get('config.components.ChartTimelineGridBlock');
const GridBlockComponent = state.get('config.components.ChartTimelineGridRowBlock');

@@ -26,0 +26,0 @@ const componentActions = api.getActions(componentName);

@@ -23,4 +23,4 @@ /**

import ChartTimelineGrid from './components/Chart/Timeline/ChartTimelineGrid';
import ChartTimelineGridBlock from './components/Chart/Timeline/ChartTimelineGridBlock';
import ChartTimelineGridRow from './components/Chart/Timeline/ChartTimelineGridRow';
import ChartTimelineGridRowBlock from './components/Chart/Timeline/ChartTimelineGridRowBlock';
import ChartTimelineItems from './components/Chart/Timeline/ChartTimelineItems';

@@ -45,7 +45,6 @@ import ChartTimelineItemsRow from './components/Chart/Timeline/ChartTimelineItemsRow';

'chart-timeline-grid-row',
'chart-timeline-grid-row-block',
'chart-timeline-items',
'chart-timeline-items-row',
'chart-timeline-items-row-item',
'chart-timeline-grid-column',
'chart-timeline-grid-block'
'chart-timeline-items-row-item'
];

@@ -79,4 +78,4 @@

ChartTimelineGrid,
ChartTimelineGridBlock,
ChartTimelineGridRow,
ChartTimelineGridRowBlock,
ChartTimelineItems,

@@ -126,6 +125,6 @@ ChartTimelineItemsRow,

},
ChartTimelineGridBlock(input) {
ChartTimelineGridRow(input) {
return input;
},
ChartTimelineGridRow(input) {
ChartTimelineGridRowBlock(input) {
return input;

@@ -132,0 +131,0 @@ },

/**
* Gantt-Schedule-Timeline-Calendar
* DependencyLines plugin
*

@@ -7,3 +7,4 @@ * @copyright Rafal Pospiech <https://neuronet.io>

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/

@@ -10,0 +11,0 @@

/**
* ItemsHold plugin
* ItemHold plugin
*

@@ -7,3 +7,4 @@ * @copyright Rafal Pospiech <https://neuronet.io>

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/

@@ -85,3 +86,3 @@

return function initializePlugin(state, api) {
return function initialize(state, api) {
state.update('config.actions.chart-timeline-items-row-item', actions => {

@@ -88,0 +89,0 @@ actions.push(action);

@@ -7,3 +7,4 @@ /**

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/

@@ -359,3 +360,3 @@

return function initializePlugin(state, api) {
return function initialize(state, api) {
state.update('config.actions.chart-timeline-items-row-item', actions => {

@@ -362,0 +363,0 @@ actions.push(action);

import ItemHold from './ItemHold.plugin';
import ItemMovement from './ItemMovement.plugin';
import SaveAsImage from './SaveAsImage.plugin';
import GridSelection from './GridSelection.plugin';
export { ItemHold, ItemMovement, SaveAsImage };
export { ItemHold, ItemMovement, SaveAsImage, GridSelection };

@@ -7,3 +7,4 @@ /**

* @package gantt-schedule-timeline-calendar
* @license GPL-3.0
* @license GPL-3.0 (https://github.com/neuronetio/gantt-schedule-timeline-calendar/blob/master/LICENSE)
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
*/

@@ -10,0 +11,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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