gantt-source_management 3.37.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintrc.json +39 -0
  3. package/.prettierrc.cjs +5 -0
  4. package/README.md +129 -0
  5. package/cypress/e2e/add-rows-items.test.ts +26 -0
  6. package/cypress/e2e/basic.test.ts +173 -0
  7. package/cypress/e2e/calculated-zoom-mode.test.ts +163 -0
  8. package/cypress/e2e/calendar-dates.test.ts +285 -0
  9. package/cypress/e2e/dst.test.ts +691 -0
  10. package/cypress/e2e/grid-cells.test.ts +72 -0
  11. package/cypress/e2e/items-vertical.test.ts +305 -0
  12. package/cypress/e2e/items.test.ts +501 -0
  13. package/cypress/e2e/list-columns-toggle.test.ts +124 -0
  14. package/cypress/e2e/list-header-resize.test.ts +30 -0
  15. package/cypress/e2e/locale.test.ts +102 -0
  16. package/cypress/e2e/move-items-outside.test.ts +437 -0
  17. package/cypress/e2e/rows.test.ts +50 -0
  18. package/cypress/e2e/scroll-bar.test.ts +357 -0
  19. package/cypress/e2e/time-bookmarks.test.ts +92 -0
  20. package/cypress/e2e/utc-mode.test.ts +51 -0
  21. package/cypress/fixtures/example.json +5 -0
  22. package/cypress/helpers.ts +12 -0
  23. package/cypress/plugins/index.js +22 -0
  24. package/cypress/support/commands.ts +175 -0
  25. package/cypress/support/e2e.ts +31 -0
  26. package/cypress.config.js +24 -0
  27. package/dist/api/api.d.ts +182 -0
  28. package/dist/api/helpers.d.ts +9 -0
  29. package/dist/api/id.d.ts +14 -0
  30. package/dist/api/locale.d.ts +3 -0
  31. package/dist/api/main.d.ts +47 -0
  32. package/dist/api/public.d.ts +32 -0
  33. package/dist/api/slots.d.ts +22 -0
  34. package/dist/api/time.d.ts +104 -0
  35. package/dist/assets/2f1f893a.wasm +0 -0
  36. package/dist/gstc.d.ts +708 -0
  37. package/dist/gstc.esm.min.d.ts +708 -0
  38. package/dist/gstc.esm.min.js +574 -0
  39. package/dist/gstc.umd.min.d.ts +708 -0
  40. package/dist/gstc.umd.min.js +701 -0
  41. package/dist/gstc.wasm.esm.min.d.ts +708 -0
  42. package/dist/gstc.wasm.esm.min.js +574 -0
  43. package/dist/gstc.wasm.umd.min.d.ts +708 -0
  44. package/dist/gstc.wasm.umd.min.js +701 -0
  45. package/dist/plugins/calendar-scroll.d.ts +15 -0
  46. package/dist/plugins/calendar-scroll.esm.min.d.ts +15 -0
  47. package/dist/plugins/calendar-scroll.esm.min.js +13 -0
  48. package/dist/plugins/calendar-scroll.umd.min.d.ts +15 -0
  49. package/dist/plugins/calendar-scroll.umd.min.js +13 -0
  50. package/dist/plugins/dependency-lines.d.ts +47 -0
  51. package/dist/plugins/dependency-lines.esm.min.d.ts +47 -0
  52. package/dist/plugins/dependency-lines.esm.min.js +38 -0
  53. package/dist/plugins/dependency-lines.umd.min.d.ts +47 -0
  54. package/dist/plugins/dependency-lines.umd.min.js +38 -0
  55. package/dist/plugins/export-image.d.ts +12 -0
  56. package/dist/plugins/export-image.esm.min.d.ts +12 -0
  57. package/dist/plugins/export-image.esm.min.js +28 -0
  58. package/dist/plugins/export-image.umd.min.d.ts +12 -0
  59. package/dist/plugins/export-image.umd.min.js +34 -0
  60. package/dist/plugins/export-pdf.d.ts +12 -0
  61. package/dist/plugins/export-pdf.esm.min.d.ts +12 -0
  62. package/dist/plugins/export-pdf.esm.min.js +389 -0
  63. package/dist/plugins/export-pdf.umd.min.d.ts +12 -0
  64. package/dist/plugins/export-pdf.umd.min.js +511 -0
  65. package/dist/plugins/grab-scroll.d.ts +14 -0
  66. package/dist/plugins/grab-scroll.esm.min.d.ts +14 -0
  67. package/dist/plugins/grab-scroll.umd.min.d.ts +14 -0
  68. package/dist/plugins/highlight-weekends.d.ts +12 -0
  69. package/dist/plugins/highlight-weekends.esm.min.d.ts +12 -0
  70. package/dist/plugins/highlight-weekends.esm.min.js +14 -0
  71. package/dist/plugins/highlight-weekends.umd.min.d.ts +12 -0
  72. package/dist/plugins/highlight-weekends.umd.min.js +14 -0
  73. package/dist/plugins/item-movement.d.ts +97 -0
  74. package/dist/plugins/item-movement.esm.min.d.ts +97 -0
  75. package/dist/plugins/item-movement.esm.min.js +25 -0
  76. package/dist/plugins/item-movement.umd.min.d.ts +97 -0
  77. package/dist/plugins/item-movement.umd.min.js +25 -0
  78. package/dist/plugins/item-resizing.d.ts +102 -0
  79. package/dist/plugins/item-resizing.esm.min.d.ts +102 -0
  80. package/dist/plugins/item-resizing.esm.min.js +37 -0
  81. package/dist/plugins/item-resizing.umd.min.d.ts +102 -0
  82. package/dist/plugins/item-resizing.umd.min.js +37 -0
  83. package/dist/plugins/item-types.d.ts +13 -0
  84. package/dist/plugins/item-types.esm.min.d.ts +13 -0
  85. package/dist/plugins/item-types.esm.min.js +127 -0
  86. package/dist/plugins/item-types.umd.min.d.ts +13 -0
  87. package/dist/plugins/item-types.umd.min.js +127 -0
  88. package/dist/plugins/progress-bar.d.ts +13 -0
  89. package/dist/plugins/progress-bar.esm.min.d.ts +13 -0
  90. package/dist/plugins/progress-bar.esm.min.js +27 -0
  91. package/dist/plugins/progress-bar.umd.min.d.ts +13 -0
  92. package/dist/plugins/progress-bar.umd.min.js +27 -0
  93. package/dist/plugins/selection.d.ts +94 -0
  94. package/dist/plugins/selection.esm.min.d.ts +94 -0
  95. package/dist/plugins/selection.esm.min.js +26 -0
  96. package/dist/plugins/selection.umd.min.d.ts +94 -0
  97. package/dist/plugins/selection.umd.min.js +26 -0
  98. package/dist/plugins/time-bookmarks.d.ts +38 -0
  99. package/dist/plugins/time-bookmarks.esm.min.d.ts +38 -0
  100. package/dist/plugins/time-bookmarks.esm.min.js +50 -0
  101. package/dist/plugins/time-bookmarks.umd.min.d.ts +38 -0
  102. package/dist/plugins/time-bookmarks.umd.min.js +50 -0
  103. package/dist/plugins/timeline-pointer.d.ts +83 -0
  104. package/dist/plugins/timeline-pointer.esm.min.d.ts +83 -0
  105. package/dist/plugins/timeline-pointer.esm.min.js +13 -0
  106. package/dist/plugins/timeline-pointer.umd.min.d.ts +83 -0
  107. package/dist/plugins/timeline-pointer.umd.min.js +13 -0
  108. package/dist/style.css +811 -0
  109. package/dist/vendor.esm.min.js +128 -0
  110. package/examples/complex-1/faces/face-1.jpg +0 -0
  111. package/examples/complex-1/faces/face-10.jpg +0 -0
  112. package/examples/complex-1/faces/face-11.jpg +0 -0
  113. package/examples/complex-1/faces/face-12.jpg +0 -0
  114. package/examples/complex-1/faces/face-13.jpg +0 -0
  115. package/examples/complex-1/faces/face-14.jpg +0 -0
  116. package/examples/complex-1/faces/face-15.jpg +0 -0
  117. package/examples/complex-1/faces/face-16.jpg +0 -0
  118. package/examples/complex-1/faces/face-17.jpg +0 -0
  119. package/examples/complex-1/faces/face-18.jpg +0 -0
  120. package/examples/complex-1/faces/face-19.jpg +0 -0
  121. package/examples/complex-1/faces/face-2.jpg +0 -0
  122. package/examples/complex-1/faces/face-20.jpg +0 -0
  123. package/examples/complex-1/faces/face-21.jpg +0 -0
  124. package/examples/complex-1/faces/face-22.jpg +0 -0
  125. package/examples/complex-1/faces/face-23.jpg +0 -0
  126. package/examples/complex-1/faces/face-24.jpg +0 -0
  127. package/examples/complex-1/faces/face-25.jpg +0 -0
  128. package/examples/complex-1/faces/face-26.jpg +0 -0
  129. package/examples/complex-1/faces/face-27.jpg +0 -0
  130. package/examples/complex-1/faces/face-28.jpg +0 -0
  131. package/examples/complex-1/faces/face-29.jpg +0 -0
  132. package/examples/complex-1/faces/face-3.jpg +0 -0
  133. package/examples/complex-1/faces/face-30.jpg +0 -0
  134. package/examples/complex-1/faces/face-31.jpg +0 -0
  135. package/examples/complex-1/faces/face-32.jpg +0 -0
  136. package/examples/complex-1/faces/face-33.jpg +0 -0
  137. package/examples/complex-1/faces/face-34.jpg +0 -0
  138. package/examples/complex-1/faces/face-35.jpg +0 -0
  139. package/examples/complex-1/faces/face-36.jpg +0 -0
  140. package/examples/complex-1/faces/face-37.jpg +0 -0
  141. package/examples/complex-1/faces/face-38.jpg +0 -0
  142. package/examples/complex-1/faces/face-39.jpg +0 -0
  143. package/examples/complex-1/faces/face-4.jpg +0 -0
  144. package/examples/complex-1/faces/face-40.jpg +0 -0
  145. package/examples/complex-1/faces/face-41.jpg +0 -0
  146. package/examples/complex-1/faces/face-42.jpg +0 -0
  147. package/examples/complex-1/faces/face-43.jpg +0 -0
  148. package/examples/complex-1/faces/face-44.jpg +0 -0
  149. package/examples/complex-1/faces/face-45.jpg +0 -0
  150. package/examples/complex-1/faces/face-46.jpg +0 -0
  151. package/examples/complex-1/faces/face-47.jpg +0 -0
  152. package/examples/complex-1/faces/face-48.jpg +0 -0
  153. package/examples/complex-1/faces/face-49.jpg +0 -0
  154. package/examples/complex-1/faces/face-5.jpg +0 -0
  155. package/examples/complex-1/faces/face-50.jpg +0 -0
  156. package/examples/complex-1/faces/face-6.jpg +0 -0
  157. package/examples/complex-1/faces/face-7.jpg +0 -0
  158. package/examples/complex-1/faces/face-8.jpg +0 -0
  159. package/examples/complex-1/faces/face-9.jpg +0 -0
  160. package/examples/complex-1/index.html +61 -0
  161. package/examples/complex-1/index.js +923 -0
  162. package/examples/index.html +22 -0
  163. package/examples/reset.css +455 -0
  164. package/examples/server.js +18 -0
  165. package/package.json +150 -0
  166. package/tsconfig.json +17 -0
@@ -0,0 +1,127 @@
1
+ !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";
2
+ /**
3
+ * ItemTypes plugin
4
+ *
5
+ * @copyright NEURONET - Rafal Pospiech
6
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
7
+ * @module gantt-schedule-timeline-calendar
8
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
9
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
10
+ * @version 3.37.5
11
+ * @released 2024-07-19
12
+ * @license SEE LICENSE IN LICENSE FILE
13
+ */const e="config.plugin.ItemTypes",i="config.templates.chart-timeline-items-row-item",s={task({className:t,labelClassName:e,cache:i,shouldDetach:s,actions:a,styleMap:l,slots:n,cutterLeft:o,cutterRight:c,getContent:p,vido:$,props:h}){const r=s||!h.item,{itemData:g,item:d}=h,u=g.position.left!==g.position.actualLeft,m=g.position.right!==g.position.actualRight,f=g.actualWidth,y=g.actualHeight,L=Math.min(8,y/2);let _=[`M ${L} ${y}`,`Q 0 ${y} 0 ${y-L}`,`L 0 ${L}`,`Q 0 0 ${L} 0`,`L ${f-L} 0`,`Q ${f} 0 ${f} ${L}`,`L ${f} ${y-L}`,`Q ${f} ${y} ${f-L} ${y}`,`L ${L} ${y}`].join(" ");u&&!m?_=["M 0 0",`L ${f-L} 0`,`Q ${f} 0 ${f} ${L}`,`L ${f} ${y-L}`,`Q ${f} ${y} ${f-L} ${y}`,`L 0 ${y}`].join(" "):u&&m?_=["M 0 0",`L ${f} 0`,`L ${f} ${y}`,`L 0 ${y}`].join(" "):!u&&m&&(_=[`M ${L} ${y}`,`Q 0 ${y} 0 ${y-L}`,`L 0 ${L}`,`Q 0 0 ${L} 0`,`L ${f} 0`,`L ${f} ${y}`,`L ${L} ${y}`].join(" "));const w=`gstc__clip-path-${d.id}`,v=`gstc__pattern-${d.id}`,j=void 0===d.progress?100:d.progress,b=g.width-g.width/100*j;let x=g.width-b;u&&(x+=g.position.left),x<0&&(x=0);const M=[`M ${x} 0`,`L ${f} 0`,`L ${f} ${y}`,`L ${x} ${y}`].join(" "),H=d.fill?d.fill:"#e74c3c",T=`gstc__item-type gstc__item-type--${d.type} `;return i(r?null:n.html("outer",$.html`
14
+ <div class=${T+t} data-gstcid=${h.item.id} data-actions=${a()} style=${l.directive()}>
15
+ ${f>=0?$.svg`<svg width=${f} height=${g.actualHeight} xmlns="http://www.w3.org/2000/svg">
16
+ <defs>
17
+ <clipPath id=${w}>
18
+ <path d=${_}></path>
19
+ </clipPath>
20
+ <pattern
21
+ id=${v}
22
+ width="20"
23
+ height="20"
24
+ patternTransform="rotate(45 0 0)"
25
+ patternUnits="userSpaceOnUse"
26
+ >
27
+ <line
28
+ class="gstc__item-type-progress-line"
29
+ x1="0"
30
+ y1="0"
31
+ x2="0"
32
+ y2="20"
33
+ />
34
+ </pattern>
35
+ </defs>
36
+ <path class="gstc__item-type-item" d=${_} fill=${H} />
37
+ <path
38
+ class="gstc__item-type-progress"
39
+ clip-path="url(#${w})"
40
+ d=${M}
41
+ style="fill: url('#${v}');" />
42
+ <g clip-path="url(#${w})">
43
+ <foreignObject x="0" y="0" width="100%" height="100%">
44
+ <div class="gstc__item-type-content" xmlns="http://www.w3.org/1999/xhtml">
45
+ ${n.html("inner",$.html`<div class=${T+e}>${n.html("content",p())}</div>`)}
46
+ </div>
47
+ </foreignObject>
48
+ </g>
49
+ </svg>`:null}
50
+ </div>
51
+ `))},milestone({className:t,labelClassName:e,cache:i,actions:s,styleMap:a,shouldDetach:l,slots:n,cutterLeft:o,cutterRight:c,getContent:p,vido:$,props:h}){const r=l||!h.item,{itemData:g,item:d}=h,u=16,m=g.actualWidth,f=g.actualHeight,y=g.position.left!==g.position.actualLeft,L=g.position.right!==g.position.actualRight;let _=["M 0 "+g.actualHeight/2,`L ${m>=32?u:m/2} 0`,`L ${m>=32?m-u:m/2} 0`,`L ${m} ${g.actualHeight/2}`,`L ${m>=32?m-u:m/2} ${g.actualHeight}`,`L ${m>=32?u:m/2} ${g.actualHeight}`,"L 0 "+g.actualHeight/2].join(" ");y&&!L?_=["M 0 0",`L ${m>=32?m-u:m/2} 0`,`L ${m} ${g.actualHeight/2}`,`L ${m>=32?m-u:m/2} ${g.actualHeight}`,`L 0 ${f}`].join(" "):y&&L?_=["M 0 0",`L ${m} 0`,`L ${m} ${f}`,`L 0 ${f}`].join(" "):!y&&L&&(_=["M 0 "+g.actualHeight/2,`L ${m>=32?u:m/2} 0`,`L ${m} 0`,`L ${m} ${f}`,`L ${m>=32?u:m/2} ${g.actualHeight}`,"L 0 "+g.actualHeight/2].join(" "));const w=`gstc__clip-path-${d.id}`,v=`gstc__pattern-${d.id}`,j=void 0===d.progress?100:d.progress,b=g.width-g.width/100*j;let x=g.width-b;y&&(x+=g.position.left),x<0&&(x=0);const M=[`M ${m} 0`,`L ${m} ${f}`,`L ${x} ${f}`,`L ${x} 0`].join(" "),H=d.fill?d.fill:"#e74c3c",T=`gstc__item-type gstc__item-type--${d.type} `;return i(r?null:n.html("outer",$.html`
52
+ <div class=${T+t} data-gstcid=${h.item.id} data-actions=${s()} style=${a.directive()}>
53
+ ${m>=0?$.svg`<svg width=${m} height=${g.actualHeight} xmlns="http://www.w3.org/2000/svg">
54
+ <defs>
55
+ <clipPath id=${w}>
56
+ <path d=${_}></path>
57
+ </clipPath>
58
+ <pattern
59
+ id=${v}
60
+ width="20"
61
+ height="20"
62
+ patternTransform="rotate(45 0 0)"
63
+ patternUnits="userSpaceOnUse"
64
+ >
65
+ <line
66
+ class="gstc__item-type-progress-line"
67
+ x1="0"
68
+ y1="0"
69
+ x2="0"
70
+ y2="20"
71
+ />
72
+ </pattern>
73
+ </defs>
74
+ <path class="gstc__item-type-item" d=${_} stroke="none" fill=${H} />
75
+ <path
76
+ class="gstc__item-type-progress"
77
+ clip-path="url(#${w})"
78
+ d=${M}
79
+ style="fill: url('#${v}');" />
80
+ <g clip-path="url(#${w})">
81
+ <foreignObject x="0" y="0" width="100%" height="100%">
82
+ <div class="gstc__item-type-content" xmlns="http://www.w3.org/1999/xhtml">
83
+ ${n.html("inner",$.html`<div class=${T+e}>${n.html("content",p())}</div>`)}
84
+ </div>
85
+ </foreignObject>
86
+ </g>
87
+ </svg>`:null}
88
+ </div>
89
+ `))},project({className:t,labelClassName:e,cache:i,shouldDetach:s,actions:a,styleMap:l,slots:n,cutterLeft:o,cutterRight:c,getContent:p,vido:$,props:h}){const r=s||!h.item,{itemData:g,item:d}=h,u=g.actualWidth,m=g.actualHeight,f=g.position.left!==g.position.actualLeft,y=["M 0 0",`L ${u} 0`,`L ${u} ${m}`,`L 0 ${m}`].join(" "),L=`gstc__clip-path-${d.id}`,_=`gstc__pattern-${d.id}`,w=void 0===d.progress?100:d.progress,v=g.width-g.width/100*w;let j=g.width-v;f&&(j+=g.position.left),j<0&&(j=0);const b=[`M ${u} 0`,`L ${u} ${m}`,`L ${j} ${m}`,`L ${j} 0`].join(" "),x=d.fill?d.fill:"#e74c3c",M=`gstc__item-type gstc__item-type--${d.type} `;return i(r?null:n.html("outer",$.html`
90
+ <div class=${M+t} data-gstcid=${h.item.id} data-actions=${a()} style=${l.directive()}>
91
+ ${u>=0?$.svg`<svg width=${u} height=${g.actualHeight} xmlns="http://www.w3.org/2000/svg">
92
+ <defs>
93
+ <clipPath id=${L}>
94
+ <path d=${y}></path>
95
+ </clipPath>
96
+ <pattern
97
+ id=${_}
98
+ width="20"
99
+ height="20"
100
+ patternTransform="rotate(45 0 0)"
101
+ patternUnits="userSpaceOnUse"
102
+ >
103
+ <line
104
+ class="gstc__item-type-progress-line"
105
+ x1="0"
106
+ y1="0"
107
+ x2="0"
108
+ y2="20"
109
+ />
110
+ </pattern>
111
+ </defs>
112
+ <path class="gstc__item-type-item" d=${y} fill=${x} />
113
+ <path
114
+ class="gstc__item-type-progress"
115
+ clip-path="url(#${L})"
116
+ d=${b}
117
+ style="fill: url('#${_}');" />
118
+ <g clip-path="url(#${L})">
119
+ <foreignObject x="0" y="0" width="100%" height="100%">
120
+ <div class="gstc__item-type-content" xmlns="http://www.w3.org/1999/xhtml">
121
+ ${n.html("inner",$.html`<div class=${M+e}>${n.html("content",p())}</div>`)}
122
+ </div>
123
+ </foreignObject>
124
+ </g>
125
+ </svg>`:null}
126
+ </div>
127
+ `))}};class a{constructor(t,a){this.unsub=[],this.options=function(t){return Object.assign(Object.assign({},s),t)}(t),this.vido=a,this.state=a.state,this.api=a.api,this.componentTemplate=this.componentTemplate.bind(this),this.destroy=this.destroy.bind(this),this.state.update(e,this.options),this.state.update(i,(()=>this.componentTemplate)),this.unsub.push(this.state.subscribe(e,(t=>this.options=t))),this.api.pluginInitialized("ItemTypes")}destroy(){this.unsub.forEach((t=>t())),this.state.update(i,null),this.vido.api.pluginDestroyed("ItemTypes")}componentTemplate(t){const e=t.props.item;if(!e)return null;const i=e.type;if(!i)throw new Error(`Item (${e.id}) must have a 'type' {string} property 'task', 'milestone' or 'project'.`);return this.options[i](t)}}t.Plugin=function(t={}){return function(i){const s=i.state.get(e);s&&(t=i.api.mergeDeep({},t,s));return new a(t,i).destroy}},t.pluginPath=e,t.templatePath=i,Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ProgressBar plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Vido } from '../gstc';
7
+ export declare const pluginPath = "config.plugin.ProgressBar";
8
+ export interface Options {
9
+ enabled?: boolean;
10
+ className?: string;
11
+ }
12
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
13
+ //# sourceMappingURL=progress-bar.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ProgressBar plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Vido } from '../gstc';
7
+ export declare const pluginPath = "config.plugin.ProgressBar";
8
+ export interface Options {
9
+ enabled?: boolean;
10
+ className?: string;
11
+ }
12
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
13
+ //# sourceMappingURL=progress-bar.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Gantt-Schedule-Timeline-Calendar helpers
3
+ *
4
+ * @copyright NEURONET - Rafal Pospiech
5
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
6
+ * @module gantt-schedule-timeline-calendar
7
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
8
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
9
+ * @version 3.37.5
10
+ * @released 2024-07-19
11
+ * @license SEE LICENSE IN LICENSE FILE
12
+ */
13
+ const t="gstc";function i(i,s=""){let e=`${t}__${i}`;return i===t&&(e=t),s?`${e} ${e}--${s.replace(":","-")}`:e}
14
+ /**
15
+ * ProgressBar plugin
16
+ *
17
+ * @copyright NEURONET - Rafal Pospiech
18
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
19
+ * @module gantt-schedule-timeline-calendar
20
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
21
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
22
+ * @version 3.37.5
23
+ * @released 2024-07-19
24
+ * @license SEE LICENSE IN LICENSE FILE
25
+ */const s="config.plugin.ProgressBar";class e{constructor(t,s){this.options=function(t){return Object.assign({enabled:!0,className:i("chart-timeline-items-row-item-progress-bar")},t)}(t),this.vido=s,this.state=s.state,this.className=this.options.className,this.PluginProgressBarSlot=this.PluginProgressBarSlot.bind(this),this.destroy=this.destroy.bind(this),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>(t.includes(this.PluginProgressBarSlot)||t.push(this.PluginProgressBarSlot),t)))}destroy(){this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>t.filter((t=>t!==this.PluginProgressBarSlot)))),this.vido.api.pluginDestroyed("ProgressBar")}PluginProgressBarSlot(t,i){let s;const e=new t.StyleMap({width:"0px"});return t.onChange((r=>{if(!(i=r)||!i.item)return void(e.style.width="0px");const o=t.api.getItemData(i.item.id);if(!o||void 0===i.item.progress)return void(e.style.width="0px");if(!i.item)return;const n=i.item,a=void 0===n.progress?100:n.progress;0===Math.floor(o.width)?e.style.width=100-a+"%":(s=o.width-o.width/100*a,s-=o.position.right-o.position.actualRight,s<0&&(s=0),e.style.width=Math.floor(s)+"px")})),t=>i&&i.item&&void 0!==i.item.progress?this.vido.html`
26
+ <div class="${this.className}" style=${e.directive()}></div>${t}
27
+ `:null}}function r(t={}){return function(i){const r=i.state.get(s);r&&(t=i.api.mergeDeep({},t,r));const o=new e(t,i);return i.api.pluginInitialized("ProgressBar"),o.destroy}}export{r as Plugin,s as pluginPath};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ProgressBar plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Vido } from '../gstc';
7
+ export declare const pluginPath = "config.plugin.ProgressBar";
8
+ export interface Options {
9
+ enabled?: boolean;
10
+ className?: string;
11
+ }
12
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
13
+ //# sourceMappingURL=progress-bar.d.ts.map
@@ -0,0 +1,27 @@
1
+ !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";
2
+ /**
3
+ * Gantt-Schedule-Timeline-Calendar helpers
4
+ *
5
+ * @copyright NEURONET - Rafal Pospiech
6
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
7
+ * @module gantt-schedule-timeline-calendar
8
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
9
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
10
+ * @version 3.37.5
11
+ * @released 2024-07-19
12
+ * @license SEE LICENSE IN LICENSE FILE
13
+ */const e="gstc";function i(t,i=""){let s=`${e}__${t}`;return t===e&&(s=e),i?`${s} ${s}--${i.replace(":","-")}`:s}
14
+ /**
15
+ * ProgressBar plugin
16
+ *
17
+ * @copyright NEURONET - Rafal Pospiech
18
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
19
+ * @module gantt-schedule-timeline-calendar
20
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
21
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
22
+ * @version 3.37.5
23
+ * @released 2024-07-19
24
+ * @license SEE LICENSE IN LICENSE FILE
25
+ */const s="config.plugin.ProgressBar";class r{constructor(t,e){this.options=function(t){return Object.assign({enabled:!0,className:i("chart-timeline-items-row-item-progress-bar")},t)}(t),this.vido=e,this.state=e.state,this.className=this.options.className,this.PluginProgressBarSlot=this.PluginProgressBarSlot.bind(this),this.destroy=this.destroy.bind(this),this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>(t.includes(this.PluginProgressBarSlot)||t.push(this.PluginProgressBarSlot),t)))}destroy(){this.state.update("config.slots.chart-timeline-items-row-item.inner",(t=>t.filter((t=>t!==this.PluginProgressBarSlot)))),this.vido.api.pluginDestroyed("ProgressBar")}PluginProgressBarSlot(t,e){let i;const s=new t.StyleMap({width:"0px"});return t.onChange((r=>{if(!(e=r)||!e.item)return void(s.style.width="0px");const o=t.api.getItemData(e.item.id);if(!o||void 0===e.item.progress)return void(s.style.width="0px");if(!e.item)return;const n=e.item,l=void 0===n.progress?100:n.progress;0===Math.floor(o.width)?s.style.width=100-l+"%":(i=o.width-o.width/100*l,i-=o.position.right-o.position.actualRight,i<0&&(i=0),s.style.width=Math.floor(i)+"px")})),t=>e&&e.item&&void 0!==e.item.progress?this.vido.html`
26
+ <div class="${this.className}" style=${s.directive()}></div>${t}
27
+ `:null}}t.Plugin=function(t={}){return function(e){const i=e.state.get(s);i&&(t=e.api.mergeDeep({},t,i));const o=new r(t,e);return e.api.pluginInitialized("ProgressBar"),o.destroy}},t.pluginPath=s,Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Selection plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import { ITEM, ITEM_TYPE, CELL, CELL_TYPE, TimelinePointerPoint, TimelinePointerState } from './timeline-pointer';
7
+ import type { Item, GridCell, Vido } from '../gstc';
8
+ export type ModKey = 'shift' | 'ctrl' | 'alt' | '';
9
+ export interface SelectionItems {
10
+ [key: string]: Item[];
11
+ }
12
+ export interface SelectState {
13
+ selecting?: SelectionItems;
14
+ selected?: SelectionItems;
15
+ }
16
+ export interface Events {
17
+ onStart?: (lastSelected: EventSelection) => void;
18
+ onSelecting?: (selecting: EventSelection, last: EventSelection) => EventSelection;
19
+ onEnd?: (selected: EventSelection, last: EventSelection) => EventSelection;
20
+ }
21
+ export interface Options {
22
+ enabled?: boolean;
23
+ cells?: boolean;
24
+ items?: boolean;
25
+ showOverlay?: boolean;
26
+ rectangularSelection?: boolean;
27
+ multipleSelection?: boolean;
28
+ selectKey?: ModKey;
29
+ multiKey?: ModKey;
30
+ selectedClassName?: string;
31
+ selectingClassName?: string;
32
+ bodySelectedClassName?: string;
33
+ bodySelectingClassName?: string;
34
+ events?: Events;
35
+ pointerEvents?: PointerEvents;
36
+ /**
37
+ * @deprecated use `events.onStart`
38
+ */
39
+ onStart?: (lastSelected: EventSelection) => void;
40
+ /**
41
+ * @deprecated use `events.onSelecting`
42
+ */
43
+ onSelecting?: (selecting: EventSelection, last: EventSelection) => EventSelection;
44
+ /**
45
+ * @deprecated use `events.onEnd`
46
+ */
47
+ onSelected?: (selected: EventSelection, last: EventSelection) => EventSelection;
48
+ }
49
+ export interface Area {
50
+ x: number;
51
+ y: number;
52
+ width: number;
53
+ height: number;
54
+ }
55
+ export interface Selection {
56
+ [CELL]: string[];
57
+ [ITEM]: string[];
58
+ }
59
+ export type GridCellOrId = GridCell | string;
60
+ export type ItemOrId = Item | string;
61
+ export interface EventSelection {
62
+ [CELL]: GridCellOrId[];
63
+ [ITEM]: ItemOrId[];
64
+ }
65
+ export interface SelectedCell {
66
+ rowId: string;
67
+ cellId: string;
68
+ }
69
+ export interface PointerEvents {
70
+ down: PointerEvent | null;
71
+ move: PointerEvent | null;
72
+ up: PointerEvent | null;
73
+ }
74
+ export interface PluginData extends Options {
75
+ enabled: boolean;
76
+ isSelecting: boolean;
77
+ showOverlay: boolean;
78
+ pointerState: TimelinePointerState;
79
+ initialPosition: TimelinePointerPoint;
80
+ currentPosition: TimelinePointerPoint;
81
+ selectionAreaLocal: Area;
82
+ selectionAreaGlobal: Area;
83
+ selected: Selection;
84
+ lastSelected: Selection;
85
+ selecting: Selection;
86
+ lastSelecting: Selection;
87
+ automaticallySelected: Selection;
88
+ pointerEvents: PointerEvents;
89
+ events: Events;
90
+ targetType: ITEM_TYPE | CELL_TYPE | '';
91
+ targetData: any;
92
+ }
93
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
94
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Selection plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import { ITEM, ITEM_TYPE, CELL, CELL_TYPE, TimelinePointerPoint, TimelinePointerState } from './timeline-pointer';
7
+ import type { Item, GridCell, Vido } from '../gstc';
8
+ export type ModKey = 'shift' | 'ctrl' | 'alt' | '';
9
+ export interface SelectionItems {
10
+ [key: string]: Item[];
11
+ }
12
+ export interface SelectState {
13
+ selecting?: SelectionItems;
14
+ selected?: SelectionItems;
15
+ }
16
+ export interface Events {
17
+ onStart?: (lastSelected: EventSelection) => void;
18
+ onSelecting?: (selecting: EventSelection, last: EventSelection) => EventSelection;
19
+ onEnd?: (selected: EventSelection, last: EventSelection) => EventSelection;
20
+ }
21
+ export interface Options {
22
+ enabled?: boolean;
23
+ cells?: boolean;
24
+ items?: boolean;
25
+ showOverlay?: boolean;
26
+ rectangularSelection?: boolean;
27
+ multipleSelection?: boolean;
28
+ selectKey?: ModKey;
29
+ multiKey?: ModKey;
30
+ selectedClassName?: string;
31
+ selectingClassName?: string;
32
+ bodySelectedClassName?: string;
33
+ bodySelectingClassName?: string;
34
+ events?: Events;
35
+ pointerEvents?: PointerEvents;
36
+ /**
37
+ * @deprecated use `events.onStart`
38
+ */
39
+ onStart?: (lastSelected: EventSelection) => void;
40
+ /**
41
+ * @deprecated use `events.onSelecting`
42
+ */
43
+ onSelecting?: (selecting: EventSelection, last: EventSelection) => EventSelection;
44
+ /**
45
+ * @deprecated use `events.onEnd`
46
+ */
47
+ onSelected?: (selected: EventSelection, last: EventSelection) => EventSelection;
48
+ }
49
+ export interface Area {
50
+ x: number;
51
+ y: number;
52
+ width: number;
53
+ height: number;
54
+ }
55
+ export interface Selection {
56
+ [CELL]: string[];
57
+ [ITEM]: string[];
58
+ }
59
+ export type GridCellOrId = GridCell | string;
60
+ export type ItemOrId = Item | string;
61
+ export interface EventSelection {
62
+ [CELL]: GridCellOrId[];
63
+ [ITEM]: ItemOrId[];
64
+ }
65
+ export interface SelectedCell {
66
+ rowId: string;
67
+ cellId: string;
68
+ }
69
+ export interface PointerEvents {
70
+ down: PointerEvent | null;
71
+ move: PointerEvent | null;
72
+ up: PointerEvent | null;
73
+ }
74
+ export interface PluginData extends Options {
75
+ enabled: boolean;
76
+ isSelecting: boolean;
77
+ showOverlay: boolean;
78
+ pointerState: TimelinePointerState;
79
+ initialPosition: TimelinePointerPoint;
80
+ currentPosition: TimelinePointerPoint;
81
+ selectionAreaLocal: Area;
82
+ selectionAreaGlobal: Area;
83
+ selected: Selection;
84
+ lastSelected: Selection;
85
+ selecting: Selection;
86
+ lastSelecting: Selection;
87
+ automaticallySelected: Selection;
88
+ pointerEvents: PointerEvents;
89
+ events: Events;
90
+ targetType: ITEM_TYPE | CELL_TYPE | '';
91
+ targetData: any;
92
+ }
93
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
94
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * TimelinePointer plugin
3
+ *
4
+ * @copyright NEURONET - Rafal Pospiech
5
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
6
+ * @module gantt-schedule-timeline-calendar
7
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
8
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
9
+ * @version 3.37.5
10
+ * @released 2024-07-19
11
+ * @license SEE LICENSE IN LICENSE FILE
12
+ */
13
+ const t="chart-timeline-grid-row-cell",e="chart-timeline-items-row-item";const i="config.plugin.Selection";function s(i){return Object.assign({enabled:!0,showOverlay:!0,isSelecting:!1,pointerState:"up",selectKey:"",multiKey:"shift",multipleSelection:!0,targetType:"",targetData:null,initialPosition:{x:0,y:0},currentPosition:{x:0,y:0},selectionAreaLocal:{x:0,y:0,width:0,height:0},selectionAreaGlobal:{x:0,y:0,width:0,height:0},selecting:{[e]:[],[t]:[]},selected:{[e]:[],[t]:[]},lastSelected:{[e]:[],[t]:[]},lastSelecting:{[e]:[],[t]:[]},automaticallySelected:{[e]:[],[t]:[]},events:{onStart(){},onSelecting:t=>t,onEnd:t=>t},pointerEvents:{down:null,move:null,up:null}},i)}class a{constructor(a,l){this.onDestroy=[],this.started=!1,this.lastAllEvents={down:null,move:null,up:null},this.vido=a,this.state=a.state,this.api=a.api,this.merge=this.state.get("config.merge"),this.state.update(i,s(l)),this.data=s(l),this.slotClassName=this.api.getClass("chart-selection"),this.slotStyleMap=new a.StyleMap({display:"none"}),this.html=a.html,this.slot=this.slot.bind(this),this.destroy=this.destroy.bind(this),this.setSlot(),this.onCellCreate=this.onCellCreate.bind(this),this.apiGetSelection=this.apiGetSelection.bind(this),this.apiGetSelecting=this.apiGetSelecting.bind(this),this.apiGetSelected=this.apiGetSelected.bind(this),this.apiSetSelection=this.apiSetSelection.bind(this),this.apiSelectCells=this.apiSelectCells.bind(this),this.apiSelectItems=this.apiSelectItems.bind(this),this.api.plugins.Selection={ITEM:e,CELL:t,getSelection:this.apiGetSelection,getSelected:this.apiGetSelected,getSelecting:this.apiGetSelecting,setSelection:this.apiSetSelection,selectCells:this.apiSelectCells,selectItems:this.apiSelectItems},this.state.update("config.chart.grid.cell.onCreate",(t=>(t.includes(this.onCellCreate)||t.push(this.onCellCreate),t))),this.updateData(),this.onDestroy.push(this.state.subscribe(i,(t=>{this.data=t}))),this.updateSelectionClassName=this.updateSelectionClassName.bind(this),this.selectedAction=this.selectedAction.bind(this),this.state.update("config.actions.chart-timeline-grid-row-cell",(t=>(t.includes(this.selectedAction)||t.push(this.selectedAction),t))),this.state.update("config.actions.chart-timeline-items-row-item",(t=>(t.includes(this.selectedAction)||t.push(this.selectedAction),t))),this.onDestroy.push(this.state.subscribe("config.chart.items.*;",(()=>{const t=this.api.getAllItems();this.data.selected[e]=this.data.selected[e].filter((e=>!!t[e])),this.data.selecting[e]=this.data.selecting[e].filter((e=>!!t[e]));const i=this.api.getItemsData();for(const t in i){const s=i[t];s.selected=this.data.selected[e].includes(t),s.selecting=this.data.selecting[e].includes(t)}}),{bulk:!0,bulkValue:!1})),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)}setSlot(){this.state.update("config.slots.chart-timeline-items.outer",(t=>(t.includes(this.slot)||t.push(this.slot),t)))}destroy(){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.outer",(t=>t.filter((t=>t!==this.slot)))),this.state.update("config.actions.chart-timeline-grid-row-cell",(t=>t.filter((t=>t!==this.selectedAction)))),this.state.update("config.actions.chart-timeline-items-row-item",(t=>t.filter((t=>t!==this.selectedAction)))),this.state.update("config.chart.grid.cell.onCreate",(t=>t.filter((t=>t!==this.onCellCreate)))),this.onDestroy.forEach((t=>t()))}updateData(){this.state.update(i,Object.assign({},this.data)),this.vido.update()}apiSetSelection(t){this.data.selected=this.api.mergeDeep({},t);let e=this.state.multi(!0);e=this.updateCells(e),e=this.updateItems(e),e.done(),this.updateData()}apiSelectCells(e){this.data.selected[t]=[...e];let i=this.state.multi(!0);i=this.updateCells(i),i.done(),this.updateData()}apiSelectItems(t){this.data.selected[e]=[...t];let i=this.state.multi(!0);i=this.updateItems(i),i.done(),this.updateData()}apiGetSelection(){return{selecting:this.getSelectionWithData(this.data.selecting),selected:this.getSelectionWithData(this.data.selected)}}apiGetSelecting(){return this.getSelectionWithData(this.data.selecting)}apiGetSelected(){return this.getSelectionWithData(this.data.selected)}modKeyPressed(t,e){switch(t){case"shift":return e.shiftKey;case"alt":return e.altKey;case"ctrl":return e.ctrlKey}}canSelect(){let t=this.data.enabled;const e=this.lastAllEvents.down;return e&&this.data.selectKey&&(t=t&&this.modKeyPressed(this.data.selectKey,e)),t&&(this.data.cells||this.data.items)}getSelectionAreaLocal(t){const e={x:0,y:0,width:0,height:0},i=Object.assign({},t.initialPosition),s=Object.assign({},t.currentPosition),a=s.x-i.x,l=s.y-i.y;return a>=0?(e.x=i.x,e.width=a):(e.x=s.x,e.width=Math.abs(a)),l>=0?(e.y=i.y,e.height=l):(e.y=s.y,e.height=Math.abs(l)),e}translateAreaLocalToGlobal(t){const e=this.state.get("$data.chart.time.leftPx"),i=this.state.get("$data.scroll.vertical.absolutePosPx");return Object.assign(Object.assign({},t),{x:t.x+e,y:t.y+i})}collectLinkedItems(t,e=this.api.getItemsData()){if(!e[t])throw console.error('"config.chart.items"',this.state.get("config.chart.items")),console.error('"$data.chart.items"',this.state.get("$data.chart.items")),new Error(`Item with id "${t}" does not exists in "$data.chart.items".`);return[t,...e[t].linkedWith]}getSelectedItem(t){let i,s=this.data.automaticallySelected[e].slice();const a=this.collectLinkedItems(t.id);if(this.data.selected[e].find((e=>e===t.id)))if(i=this.data.selected[e],s.find((e=>e===t.id))){const e=s,a=i.find((i=>t.linkedWith.includes(i)&&!e.includes(i)));s=s.filter((e=>e!==t.id)),s.push(a)}else s=this.data.automaticallySelected[e];else i=this.isMulti()?Array.from(new Set([...this.data.selected[e],...a])):a,s=a.filter((e=>e!==t.id));return i=i.map((e=>(t=this.api.getItem(e),e))),{selected:i,automaticallySelected:s}}isItemVerticallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.y+e.height,s=t.position.viewTop,a=s+t.actualHeight;return s>=e.y&&s<=i||a>=e.y&&a<=i||s>=e.y&&a<=i||s<=e.y&&a>=i}isItemHorizontallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.x+e.width;return t.position.actualLeft>=e.x&&t.position.actualLeft<=i||t.position.actualRight>=e.x&&t.position.actualRight<=i||t.position.actualLeft<=e.x&&t.position.actualRight>=i||t.position.actualLeft>=e.x&&t.position.actualRight<=i}isMulti(){const t=this.lastAllEvents.move;return t&&this.data.multiKey&&this.modKeyPressed(this.data.multiKey,t)}getItemsUnderSelectionArea(t){const e=this.state.get("$data.chart.visibleItems"),i=this.api.getItems(e),s=[],a=[];for(let e of i){e=this.merge({},e);const i=this.api.getItemData(e.id);if(this.isItemVerticallyInsideArea(i,t)&&this.isItemHorizontallyInsideArea(i,t)){s.find((t=>t===e.id))||s.push(e.id);const t=this.collectLinkedItems(e.id);for(const e of t){const t=this.api.getItem(e);s.find((e=>e===t.id))||(s.push(t.id),a.push(t.id))}}}return{selectedItems:s,automaticallySelectedItems:a}}isCellVerticallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.y+e.height,s=t.top,a=s+t.rowData.actualHeight;return s>=e.y&&s<=i||a>=e.y&&a<=i||s>=e.y&&a<=i||s<=e.y&&a>=i}isCellHorizontallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.x+e.width,s=t.time.currentView.leftPx,a=t.time.currentView.rightPx;return s>=e.x&&s<=i||a>=e.x&&a<=i||s<=e.x&&a>=i||s>=e.x&&a<=i}getCellsUnderSelectionArea(t){const e=this.state.get("$data.chart.grid.cells"),i=[];for(const s in e){const a=e[s];this.isCellVerticallyInsideArea(a,t)&&this.isCellHorizontallyInsideArea(a,t)&&(i.find((t=>t===a.id))||i.push(a.id))}return{selectedCells:i}}updateItems(t){if(!this.data.items)return t;const i=this.api.getAllItems(),s=Array.from(new Set([...this.data.selecting[e],...this.data.selected[e]]));return t=t.update("$data.chart.items",(t=>{for(const a in t)if(a in i)if(s.includes(a)){const i=this.data.selecting[e].includes(a),s=this.data.selected[e].includes(a);t[a].selected=s,t[a].selecting=i}else t[a].selected=!1,t[a].selecting=!1;return t}),{data:"selection"})}updateCurrentItems(t){if(!this.data.items)return t;const i=this.state.get("$data.chart.items"),s=Array.from(new Set([...this.data.lastSelecting[e],...this.data.selecting[e],...this.data.selected[e]]));for(const t of s)i[t].selecting=this.data.selecting[e].includes(t),i[t].selected=this.data.selected[e].includes(t);return t}updateCells(e){if(!this.data.cells)return e;const i=this.api.getAllGridCells();return e.update("$data.chart.grid.cells",(e=>{for(const s in e){if(!(s in i))continue;const a=e[s];a&&(a.selected=this.data.selected[t].includes(a.id),a.selecting=this.data.selecting[t].includes(a.id))}return e})),e}updateCurrentCells(e){if(!this.data.items)return e;const i=Array.from(new Set([...this.data.lastSelecting[t],...this.data.selecting[t],...this.data.selected[t]]));for(const s of i){this.state.get(`$data.chart.grid.cells.${s}`)&&(e=e.update(`$data.chart.grid.cells.${s}`,(e=>(e.selected=this.data.selected[t].includes(s),e.selecting=this.data.selecting[t].includes(s),e))))}return e}deselectItems(){if(!this.data.items)return;this.data.selected[e].length=0,this.data.selecting[e].length=0;let t=this.state.multi(!0);t=this.updateItems(t),t.done()}deselectCells(){if(!this.data.cells)return;this.data.selecting[t].length=0,this.data.selected[t].length=0;let e=this.state.multi(!0);e=this.updateCells(e),e.done()}getSelectionWithData(i){const s=this.state.get("config.chart.items"),a=this.state.get("$data.chart.grid.cells");return{[t]:i[t].map((t=>a[t]?a[t]:t)),[e]:i[e].map((t=>s[t]?s[t]:t))}}onSelecting(i,s){const a=this.getSelectionWithData(i),l=this.getSelectionWithData(s);this.started||(this.data.events.onStart(l),this.started=!0,this.api.muteMethod("fullReload"),this.api.muteMethod("prepareExpanded"),this.api.muteMethod("calculateRowsHeight"),this.api.muteMethod("recalculateRowPercents"),this.api.muteMethod("getLastPageRowsHeight"),this.api.muteMethod("calculateVerticalScrollArea"),this.api.muteMethod("calculateVisibleRowsHeights"),this.api.muteMethod("generateVisibleRowsAndItems"),this.api.muteMethod("recalculateTimes"),this.api.muteMethod("heightChange"));const n=this.data.events.onSelecting(a,l);return{[t]:n[t].map((t=>"string"!=typeof t?t.id:t)),[e]:n[e].map((t=>"string"!=typeof t?t.id:t))}}onSelected(i,s){const a=this.getSelectionWithData(i),l=this.getSelectionWithData(s),n=this.data.events.onEnd(a,l);return this.started=!1,this.api.unmuteMethod("heightChange"),this.api.unmuteMethod("recalculateTimes"),this.api.unmuteMethod("generateVisibleRowsAndItems"),this.api.unmuteMethod("calculateVisibleRowsHeights"),this.api.unmuteMethod("calculateVerticalScrollArea"),this.api.unmuteMethod("getLastPageRowsHeight"),this.api.unmuteMethod("recalculateRowPercents"),this.api.unmuteMethod("calculateRowsHeight"),this.api.unmuteMethod("prepareExpanded"),this.api.unmuteMethod("fullReload"),{[t]:n[t].map((t=>"string"!=typeof t?t.id:t)),[e]:n[e].map((t=>"string"!=typeof t?t.id:t))}}updateBodyClass(){this.data.isSelecting?document.body.classList.add(this.data.bodySelectingClassName):document.body.classList.remove(this.data.bodySelectingClassName),this.data.selected[t].length||this.data.selected[e].length?document.body.classList.add(this.data.bodySelectedClassName):document.body.classList.remove(this.data.bodySelectedClassName)}selectMultipleCellsAndItems(i){if(!this.canSelect())return;if(!this.data.multipleSelection)return this.deselectItems(),this.deselectCells(),void this.updateData();this.data.isSelecting=!0,this.data.selectionAreaLocal=this.getSelectionAreaLocal(i),this.data.selectionAreaGlobal=this.translateAreaLocalToGlobal(this.data.selectionAreaLocal);const s={[t]:[],[e]:[]},a=this.isMulti();if(this.data.cells){const{selectedCells:e}=this.getCellsUnderSelectionArea(this.data.selectionAreaLocal);0===e.length?(s[t].length=0,a||(this.data.selected[t].length=0)):s[t]=e}if(this.data.items){const{selectedItems:t,automaticallySelectedItems:i}=this.getItemsUnderSelectionArea(this.data.selectionAreaLocal);this.data.automaticallySelected[e]=i,0===t.length?(s[e].length=0,a||(this.data.selected[e].length=0)):s[e]=t}if(this.data.cells||this.data.items){this.data.lastSelecting={[e]:[...this.data.selecting[e]],[t]:[...this.data.selecting[t]]},this.data.selecting=this.onSelecting(s,this.api.mergeDeep({},this.data.lastSelected));let i=this.state.multi(!0);this.data.cells&&(i=this.updateCurrentCells(i)),this.data.items&&(i=this.updateCurrentItems(i)),i.done()}}selectItemsIndividually(i){if(this.data.isSelecting=!1,this.data.selectionAreaLocal=this.getSelectionAreaLocal(i),this.data.currentPosition=i.currentPosition,this.data.initialPosition=i.initialPosition,!this.data.items)return;if(!this.canSelect())return;if(!i.targetData)return;const s=this.merge({},i.targetData),a=this.api.getItemData(s.id);if(!a)throw console.error('"config.chart.items"',this.state.get("config.chart.items")),console.error('"$data.chart.items"',this.state.get("$data.chart.items")),new Error(`Item with id "${s.id}" does not exists in "$data.chart.items". TIP: For performance reasons, state is mutable, so try not to modify items from the "state.get" method before you copy them (with "gstc.api.clone(items)" for example).`);if(this.data.selected[e].includes(s.id))return;let{selected:l,automaticallySelected:n}=this.getSelectedItem(s);l.length>1&&!this.data.multipleSelection&&(l=[s.id],n=[]),this.isMulti()?a.selected?this.data.selected[e]=l.filter((t=>t!==s.id&&!n.includes(t))):this.data.selected[e]=l:(this.data.selected[e]=l,this.data.selected[t].length=0),this.data.automaticallySelected[e]=n,this.data.lastSelecting={[e]:[...this.data.selected[e]],[t]:[...this.data.selected[t]]},this.data.selected=this.onSelected(this.api.mergeDeep({},this.data.selected),this.api.mergeDeep({},this.data.lastSelected));let c=this.state.multi(!0);c=this.updateCells(c),c=this.updateItems(c),c.done()}removeMultiUnselected(t){const e=this.data.selected[t].filter((e=>this.data.selecting[t].includes(e))),i=[...this.data.selected[t],...this.data.selecting[t]];return Array.from(new Set(i.filter((t=>!e.includes(t)))))}finishSelection(){if(!this.canSelect())return;let i;i=this.isMulti()?{[t]:this.data.cells?this.removeMultiUnselected(t):[],[e]:this.data.items?this.removeMultiUnselected(e):[]}:{[t]:this.data.cells?[...this.data.selecting[t]]:[],[e]:this.data.items?[...this.data.selecting[e]]:[]},this.data.selected=this.onSelected(i,this.api.mergeDeep({},this.data.lastSelected)),this.data.lastSelected=this.api.mergeDeep({},this.data.selected),this.data.cells&&(this.data.selecting[t].length=0),this.data.items&&(this.data.selecting[e].length=0);let s=this.state.multi(!0);s=this.updateItems(s),s=this.updateCells(s),s.done()}onPointerData(i){if(this.lastAllEvents=i.allEvents,i.isMoving&&i.targetType===t&&this.data.rectangularSelection?this.selectMultipleCellsAndItems(i):i.isMoving&&i.targetType===t&&!this.data.rectangularSelection?this.deselectItems():i.targetType===e?this.selectItemsIndividually(i):i.isMoving||(this.data.isSelecting&&this.finishSelection(),this.data.isSelecting=!1),i.isMoving&&i.targetType!==t&&i.targetType!==e&&this.deselectItems(),this.data.pointerState=i.type,this.data.targetType=i.targetType,this.data.targetData=i.targetData,"down"===this.data.pointerState){let t=this.state.multi(!0);t=this.updateItems(t),t=this.updateCells(t),t.done()}this.updateData(),this.updateBodyClass()}onTimelinePointerDown(t){this.data.enabled&&this.onPointerData(t)}onTimelinePointerMove(t){this.data.enabled&&this.onPointerData(t)}onTimelinePointerUp(t){this.data.enabled&&this.onPointerData(t)}slot(){let t,e=!0;return i=>(e=!0,this.canSelect()&&this.data.isSelecting&&this.data.showOverlay&&this.data.multipleSelection&&this.data.rectangularSelection&&(this.slotStyleMap.style.display="block",this.slotStyleMap.style.left=this.data.selectionAreaLocal.x+"px",this.slotStyleMap.style.top=this.data.selectionAreaLocal.y+"px",this.slotStyleMap.style.width=this.data.selectionAreaLocal.width+"px",this.slotStyleMap.style.height=this.data.selectionAreaLocal.height+"px",e=!1),t=this.html`<div class=${this.slotClassName} style=${this.slotStyleMap.directive()}></div>`,this.html`${i}${e?null:t}`)}updateSelectionClassName(t,e){if(!e&&!e.itemData)return;const i="boolean"==typeof e.selected?e.selected:e.itemData.selected,s="boolean"==typeof e.selecting?e.selecting:e.itemData.selecting;i?(t.classList.contains(this.data.selectedClassName)||t.classList.add(this.data.selectedClassName),t.classList.contains(this.data.selectingClassName)&&t.classList.remove(this.data.selectingClassName)):t.classList.contains(this.data.selectedClassName)&&t.classList.remove(this.data.selectedClassName),s?(t.classList.contains(this.data.selectingClassName)||t.classList.add(this.data.selectingClassName),t.classList.contains(this.data.selectedClassName)&&t.classList.remove(this.data.selectedClassName)):t.classList.contains(this.data.selectingClassName)&&t.classList.remove(this.data.selectingClassName)}selectedAction(t,e){this.updateSelectionClassName(t,e);const i=this;return{update(t,e){i.updateSelectionClassName(t,e)},destroy(t,e){i.updateSelectionClassName(t,e)}}}onCellCreate(e){return e.selected=!!this.data.selected[t].find((t=>t===e.id)),e.selecting=!!this.data.selecting[t].find((t=>t===e.id)),e.content}}function l(t={}){return t=function(t){!
14
+ /**
15
+ * Selection plugin
16
+ *
17
+ * @copyright NEURONET - Rafal Pospiech
18
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
19
+ * @module gantt-schedule-timeline-calendar
20
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
21
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
22
+ * @version 3.37.5
23
+ * @released 2024-07-19
24
+ * @license SEE LICENSE IN LICENSE FILE
25
+ */
26
+ function(t){t.events||(t.events={}),t.onStart&&(t.events.onStart=t.onStart),t.onSelecting&&(t.events.onSelecting=t.onSelecting),t.onSelected&&(t.events.onEnd=t.onSelected)}(t);const e={enabled:!0,cells:!0,items:!0,showOverlay:!0,rectangularSelection:!0,multipleSelection:!0,selectedClassName:"gstc__selected",selectingClassName:"gstc__selecting",bodySelectedClassName:"gstc__is-selected",bodySelectingClassName:"gstc__is-selecting",events:{onStart(){},onSelecting:t=>t,onEnd:t=>t}};return t.events=Object.assign(Object.assign({},e.events),t.events),Object.assign(Object.assign({},e),t)}(t),function(e){const s=e.api.mergeDeep,l=e.api;if(!l.isPluginInitialized("TimelinePointer"))throw new Error("TimelinePointer plugin must be initialized before Selection plugin.");const n=e.state.get(i);n&&(t=s({},t,n));const c=new a(e,t);return l.pluginInitialized("Selection"),c.destroy}}export{l as Plugin};
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Selection plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import { ITEM, ITEM_TYPE, CELL, CELL_TYPE, TimelinePointerPoint, TimelinePointerState } from './timeline-pointer';
7
+ import type { Item, GridCell, Vido } from '../gstc';
8
+ export type ModKey = 'shift' | 'ctrl' | 'alt' | '';
9
+ export interface SelectionItems {
10
+ [key: string]: Item[];
11
+ }
12
+ export interface SelectState {
13
+ selecting?: SelectionItems;
14
+ selected?: SelectionItems;
15
+ }
16
+ export interface Events {
17
+ onStart?: (lastSelected: EventSelection) => void;
18
+ onSelecting?: (selecting: EventSelection, last: EventSelection) => EventSelection;
19
+ onEnd?: (selected: EventSelection, last: EventSelection) => EventSelection;
20
+ }
21
+ export interface Options {
22
+ enabled?: boolean;
23
+ cells?: boolean;
24
+ items?: boolean;
25
+ showOverlay?: boolean;
26
+ rectangularSelection?: boolean;
27
+ multipleSelection?: boolean;
28
+ selectKey?: ModKey;
29
+ multiKey?: ModKey;
30
+ selectedClassName?: string;
31
+ selectingClassName?: string;
32
+ bodySelectedClassName?: string;
33
+ bodySelectingClassName?: string;
34
+ events?: Events;
35
+ pointerEvents?: PointerEvents;
36
+ /**
37
+ * @deprecated use `events.onStart`
38
+ */
39
+ onStart?: (lastSelected: EventSelection) => void;
40
+ /**
41
+ * @deprecated use `events.onSelecting`
42
+ */
43
+ onSelecting?: (selecting: EventSelection, last: EventSelection) => EventSelection;
44
+ /**
45
+ * @deprecated use `events.onEnd`
46
+ */
47
+ onSelected?: (selected: EventSelection, last: EventSelection) => EventSelection;
48
+ }
49
+ export interface Area {
50
+ x: number;
51
+ y: number;
52
+ width: number;
53
+ height: number;
54
+ }
55
+ export interface Selection {
56
+ [CELL]: string[];
57
+ [ITEM]: string[];
58
+ }
59
+ export type GridCellOrId = GridCell | string;
60
+ export type ItemOrId = Item | string;
61
+ export interface EventSelection {
62
+ [CELL]: GridCellOrId[];
63
+ [ITEM]: ItemOrId[];
64
+ }
65
+ export interface SelectedCell {
66
+ rowId: string;
67
+ cellId: string;
68
+ }
69
+ export interface PointerEvents {
70
+ down: PointerEvent | null;
71
+ move: PointerEvent | null;
72
+ up: PointerEvent | null;
73
+ }
74
+ export interface PluginData extends Options {
75
+ enabled: boolean;
76
+ isSelecting: boolean;
77
+ showOverlay: boolean;
78
+ pointerState: TimelinePointerState;
79
+ initialPosition: TimelinePointerPoint;
80
+ currentPosition: TimelinePointerPoint;
81
+ selectionAreaLocal: Area;
82
+ selectionAreaGlobal: Area;
83
+ selected: Selection;
84
+ lastSelected: Selection;
85
+ selecting: Selection;
86
+ lastSelecting: Selection;
87
+ automaticallySelected: Selection;
88
+ pointerEvents: PointerEvents;
89
+ events: Events;
90
+ targetType: ITEM_TYPE | CELL_TYPE | '';
91
+ targetData: any;
92
+ }
93
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
94
+ //# sourceMappingURL=selection.d.ts.map