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,102 @@
1
+ /**
2
+ * ItemResizing plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Vido, htmlResult, Item, DataChartTime, DataItems, DataScrollHorizontal } from '../gstc';
7
+ import type DeepState from 'deep-state-observer';
8
+ import type { Dayjs } from 'dayjs';
9
+ export interface Handle {
10
+ width?: number;
11
+ outsideWidth?: number;
12
+ horizontalMargin?: number;
13
+ outsideHorizontalMargin?: number;
14
+ verticalMargin?: number;
15
+ outside?: boolean;
16
+ onlyWhenSelected?: boolean;
17
+ }
18
+ export interface SnapArg {
19
+ item: Item;
20
+ time: DataChartTime;
21
+ vido: Vido;
22
+ movement: Movement;
23
+ }
24
+ export interface SnapStartArg extends SnapArg {
25
+ startTime: Dayjs;
26
+ }
27
+ export interface SnapEndArg extends SnapArg {
28
+ endTime: Dayjs;
29
+ }
30
+ export interface Movement {
31
+ px: number;
32
+ time: number;
33
+ }
34
+ export interface SnapToTime {
35
+ start?: (snapStartArgs: SnapStartArg) => Dayjs;
36
+ end?: (snapEndArgs: SnapEndArg) => Dayjs;
37
+ }
38
+ export interface BeforeAfterInitialItems {
39
+ initial: Item[];
40
+ before: Item[];
41
+ after: Item[];
42
+ }
43
+ export interface OnArg {
44
+ items: BeforeAfterInitialItems;
45
+ addedDependantIds: string[];
46
+ selectedIds: string[];
47
+ vido: Vido;
48
+ state: DeepState;
49
+ time: DataChartTime;
50
+ }
51
+ export interface Events {
52
+ onStart?: (onArg: OnArg) => Item[];
53
+ onResize?: (onArg: OnArg) => Item[];
54
+ onEnd?: (onArg: OnArg) => Item[];
55
+ }
56
+ export interface AutoScroll {
57
+ speed?: number;
58
+ edgeThreshold?: number;
59
+ }
60
+ export interface HandleContentObject {
61
+ left: htmlResult;
62
+ right: htmlResult;
63
+ }
64
+ export type HandleContentFunctionArgument = {
65
+ item: Item;
66
+ vido: Vido;
67
+ };
68
+ export type HandleContentFunction = (arg: HandleContentFunctionArgument) => HandleContentObject;
69
+ export type HandleContent = HandleContentObject | HandleContentFunction | htmlResult;
70
+ export interface Options {
71
+ enabled?: boolean;
72
+ dependant?: boolean;
73
+ debug?: boolean;
74
+ handle?: Handle;
75
+ content?: HandleContent;
76
+ bodyClass?: string;
77
+ bodyClassLeft?: string;
78
+ bodyClassRight?: string;
79
+ events?: Events;
80
+ snapToTime?: SnapToTime;
81
+ outsideWidthThreshold?: number;
82
+ autoScroll?: AutoScroll;
83
+ ignoreMissingDates?: boolean;
84
+ allowItemsToGoOutsideTheArea?: boolean;
85
+ threshold?: number;
86
+ shouldMuteNotNeededMethods?: boolean;
87
+ }
88
+ export type State = 'start' | 'resize' | 'end' | '';
89
+ export interface PluginData extends Options {
90
+ leftIsMoving: boolean;
91
+ rightIsMoving: boolean;
92
+ initialItems: Item[];
93
+ initialItemsData: DataItems;
94
+ addedDependantIds: string[];
95
+ selectedIds: string[];
96
+ initialHorizontalScroll: DataScrollHorizontal;
97
+ state: State;
98
+ movement: Movement;
99
+ thresholdReached: boolean;
100
+ }
101
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
102
+ //# sourceMappingURL=item-resizing.d.ts.map
@@ -0,0 +1,37 @@
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-items-row-item",e="gstc";
14
+ /**
15
+ * Gantt-Schedule-Timeline-Calendar helpers
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
+ */function i(t,i=""){let s=`${e}__${t}`;return t===e&&(s=e),i?`${s} ${s}--${i.replace(":","-")}`:s}
26
+ /**
27
+ * ItemResizing plugin
28
+ *
29
+ * @copyright NEURONET - Rafal Pospiech
30
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
31
+ * @module gantt-schedule-timeline-calendar
32
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
33
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
34
+ * @version 3.37.5
35
+ * @released 2024-07-19
36
+ * @license SEE LICENSE IN LICENSE FILE
37
+ */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),h="--left",l="--right";class r{constructor(t,e){this.onDestroy=[],this.scrollWaiting=0,this.vido=t,this.state=t.state,this.api=t.api,this.data=function(t={}){const e={onStart:({items:t})=>t.after,onResize:({items:t})=>t.after,onEnd:({items:t})=>t.after},i={start:({startTime:t,time:e,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:60},ignoreMissingDates:!0,allowItemsToGoOutsideTheArea:!0,threshold:10,thresholdReached:!1,shouldMuteNotNeededMethods:!0},t);return t.snapToTime&&(a.snapToTime=Object.assign(Object.assign({},i),t.snapToTime)),t.events&&(a.events=Object.assign(Object.assign({},e),t.events)),t.handle&&(a.handle=Object.assign(Object.assign({},s),t.handle)),t.autoScroll&&(a.autoScroll=Object.assign(Object.assign({},a.autoScroll),t.autoScroll)),a}(e),this.html=t.html,this.data.content||(this.data.content={left:this.html`<div class=${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+h,this.rightClassName=this.api.getClass(o),this.rightClassName+=" "+this.rightClassName+l,t&&(this.leftClassName+=` ${this.api.getClass(o)}--left-outside`,this.rightClassName+=` ${this.api.getClass(o)}--right-outside`)}getSelectedItems(){return this.state.get(`config.plugin.Selection.selected.${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.data.shouldMuteNotNeededMethods&&(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.data.shouldMuteNotNeededMethods&&(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+h)&&this.onLeftPointerDown(),e.classList.contains(d+l)&&this.onRightPointerDown(),this.dispatchEvent("onStart",this.data.initialItems)}}onLeftPointerDown(){this.data.enabled&&(document.body.classList.add(this.data.bodyClassLeft),this.data.leftIsMoving=!0,this.updateData())}onRightPointerDown(){this.data.enabled&&(document.body.classList.add(this.data.bodyClassRight),this.data.rightIsMoving=!0,this.updateData())}scrollLeft(){if(!this.data.autoScroll.speed)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().width-2;e<this.data.autoScroll.edgeThreshold?this.scrollLeft():e>i-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)),h=this.data.snapToTime.start({startTime:d,item:e[0],time:s,movement:o,vido:this.vido}),l=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x,!0,s)),r=this.api.time.getDatesDiffPx(h,l,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 h=this.api.time.getTimeFromOffsetPx(d,!0,s),l=this.data.snapToTime.start({startTime:this.api.time.date(h),item:a,time:s,movement:o,vido:this.vido});a.time.start=l.valueOf(),n.time.startDate=l;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},h=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.initialPosition.x,!0,a)),l=this.data.snapToTime.end({endTime:h,item:null,time:a,movement:d,vido:this.vido}),r=this.api.time.date(this.api.time.getTimeFromOffsetPx(t.currentPosition.x,!0,a)),m=this.api.time.getDatesDiffPx(l,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)),h=this.api.mergeDeep({},this.data.initialItemsData[n.id]),l=i.includes(n.id);let r=h.position.left+h.timeWidth+m;!l&&r<o.position.left+n.minWidth&&(r=o.position.left+n.minWidth);const p=this.api.time.getTimeFromOffsetPx(r,!0,a);let c=this.api.time.date(p);if(l||(c=this.data.snapToTime.end({endTime:this.api.time.date(p),item:n,time:a,movement:d,vido:this.vido})),l){const t=this.data.initialItems.find((t=>t.dependant.includes(h.id))),e=this.data.initialItemsData[t.id],i=s[e.id],d=this.api.time.getDatesDiffMs(e.time.endDate,i.time.endDate,a,!0);let l=-this.api.time.getDSTDiffForLevel(a.level,e.time.endDate.valueOf(),h.time.startDate.valueOf(),a),r=this.api.time.addTimeFromDates(h.time.startDate.valueOf(),d+l,a);l=this.api.time.getDSTDiffForLevel(a.level,i.time.endDate.valueOf(),r,a),r+=l;const m=this.api.time.date(r),p=m.valueOf(),u=this.api.time.getViewOffsetPxFromDates(m,!1,a);let g=-this.api.time.getDSTDiffForLevel(a.level,h.time.startDate.valueOf(),h.time.endDate.valueOf(),a);const f=u+h.timeWidth;let v;const P=h.time.endDate.valueOf()-h.time.startDate.valueOf();v=this.data.ignoreMissingDates?this.api.time.date(this.api.time.getTimeFromOffsetPx(f,!0,a)):this.api.time.date(m.valueOf()+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 h=e.item;if(!h)return;const l=this.api.getItemData(h.id);if(!l)return;let r;i=!l.detached,this.data.handle.onlyWhenSelected&&(i=i&&l.selected),i=i&&!(this.data.handle.outside||l.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(h,o),this.updateLeftStyleMap(h,n),r="function"==typeof this.data.content?this.data.content({item:h,vido:t}):"object"!=typeof this.data.content||"left"in this.data.content?this.data.content:{left:this.data.content,right:this.data.content},s=this.html`<div class=${this.leftClassName} data-gstcid=${e.item.id} style=${n.directive()}>${r.left}</div>`,a=this.html`<div class=${this.rightClassName} data-gstcid=${e.item.id} style=${o.directive()}>${r.right}</div>`,t.update()})),t=>this.html`${i?s:null}${t}${i?a:null}`}PluginItemResizingOuterSlot(e,i){let s,a,n;const o=new e.StyleMap({}),d=new e.StyleMap({});return e.onChange((h=>{if(!(i=h)||!i.item)return;const l=i.item;if(!l)return;const r=this.api.getItemData(l.id);if(!r)return;let m;s=!r.detached,this.data.handle.onlyWhenSelected&&(s=s&&r.selected),s=s&&(this.data.handle.outside||r.actualWidth<this.data.outsideWidthThreshold),this.updateRightStyleMap(l,d),this.updateLeftStyleMap(l,o),m="function"==typeof this.data.content?this.data.content({item:l,vido: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};
@@ -0,0 +1,102 @@
1
+ /**
2
+ * ItemResizing plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Vido, htmlResult, Item, DataChartTime, DataItems, DataScrollHorizontal } from '../gstc';
7
+ import type DeepState from 'deep-state-observer';
8
+ import type { Dayjs } from 'dayjs';
9
+ export interface Handle {
10
+ width?: number;
11
+ outsideWidth?: number;
12
+ horizontalMargin?: number;
13
+ outsideHorizontalMargin?: number;
14
+ verticalMargin?: number;
15
+ outside?: boolean;
16
+ onlyWhenSelected?: boolean;
17
+ }
18
+ export interface SnapArg {
19
+ item: Item;
20
+ time: DataChartTime;
21
+ vido: Vido;
22
+ movement: Movement;
23
+ }
24
+ export interface SnapStartArg extends SnapArg {
25
+ startTime: Dayjs;
26
+ }
27
+ export interface SnapEndArg extends SnapArg {
28
+ endTime: Dayjs;
29
+ }
30
+ export interface Movement {
31
+ px: number;
32
+ time: number;
33
+ }
34
+ export interface SnapToTime {
35
+ start?: (snapStartArgs: SnapStartArg) => Dayjs;
36
+ end?: (snapEndArgs: SnapEndArg) => Dayjs;
37
+ }
38
+ export interface BeforeAfterInitialItems {
39
+ initial: Item[];
40
+ before: Item[];
41
+ after: Item[];
42
+ }
43
+ export interface OnArg {
44
+ items: BeforeAfterInitialItems;
45
+ addedDependantIds: string[];
46
+ selectedIds: string[];
47
+ vido: Vido;
48
+ state: DeepState;
49
+ time: DataChartTime;
50
+ }
51
+ export interface Events {
52
+ onStart?: (onArg: OnArg) => Item[];
53
+ onResize?: (onArg: OnArg) => Item[];
54
+ onEnd?: (onArg: OnArg) => Item[];
55
+ }
56
+ export interface AutoScroll {
57
+ speed?: number;
58
+ edgeThreshold?: number;
59
+ }
60
+ export interface HandleContentObject {
61
+ left: htmlResult;
62
+ right: htmlResult;
63
+ }
64
+ export type HandleContentFunctionArgument = {
65
+ item: Item;
66
+ vido: Vido;
67
+ };
68
+ export type HandleContentFunction = (arg: HandleContentFunctionArgument) => HandleContentObject;
69
+ export type HandleContent = HandleContentObject | HandleContentFunction | htmlResult;
70
+ export interface Options {
71
+ enabled?: boolean;
72
+ dependant?: boolean;
73
+ debug?: boolean;
74
+ handle?: Handle;
75
+ content?: HandleContent;
76
+ bodyClass?: string;
77
+ bodyClassLeft?: string;
78
+ bodyClassRight?: string;
79
+ events?: Events;
80
+ snapToTime?: SnapToTime;
81
+ outsideWidthThreshold?: number;
82
+ autoScroll?: AutoScroll;
83
+ ignoreMissingDates?: boolean;
84
+ allowItemsToGoOutsideTheArea?: boolean;
85
+ threshold?: number;
86
+ shouldMuteNotNeededMethods?: boolean;
87
+ }
88
+ export type State = 'start' | 'resize' | 'end' | '';
89
+ export interface PluginData extends Options {
90
+ leftIsMoving: boolean;
91
+ rightIsMoving: boolean;
92
+ initialItems: Item[];
93
+ initialItemsData: DataItems;
94
+ addedDependantIds: string[];
95
+ selectedIds: string[];
96
+ initialHorizontalScroll: DataScrollHorizontal;
97
+ state: State;
98
+ movement: Movement;
99
+ thresholdReached: boolean;
100
+ }
101
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
102
+ //# sourceMappingURL=item-resizing.d.ts.map
@@ -0,0 +1,37 @@
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).ItemResizing={})}(this,(function(t){"use strict";
2
+ /**
3
+ * TimelinePointer 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="chart-timeline-items-row-item",i="gstc";
14
+ /**
15
+ * Gantt-Schedule-Timeline-Calendar helpers
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
+ */function s(t,e=""){let s=`${i}__${t}`;return t===i&&(s=i),e?`${s} ${s}--${e.replace(":","-")}`:s}
26
+ /**
27
+ * ItemResizing plugin
28
+ *
29
+ * @copyright NEURONET - Rafal Pospiech
30
+ * @author Rafal Pospiech <neuronet.io@gmail.com>
31
+ * @module gantt-schedule-timeline-calendar
32
+ * @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
33
+ * @link https://gantt-schedule-timeline-calendar.neuronet.io
34
+ * @version 3.37.5
35
+ * @released 2024-07-19
36
+ * @license SEE LICENSE IN LICENSE FILE
37
+ */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:60},ignoreMissingDates:!0,allowItemsToGoOutsideTheArea:!0,threshold:10,thresholdReached:!1,shouldMuteNotNeededMethods:!0},t);return t.snapToTime&&(a.snapToTime=Object.assign(Object.assign({},i),t.snapToTime)),t.events&&(a.events=Object.assign(Object.assign({},e),t.events)),t.handle&&(a.handle=Object.assign(Object.assign({},s),t.handle)),t.autoScroll&&(a.autoScroll=Object.assign(Object.assign({},a.autoScroll),t.autoScroll)),a}(e),this.html=t.html,this.data.content||(this.data.content={left:this.html`<div class=${a}></div><div class=${a}></div>`,right:this.html`<div class=${a}></div><div class=${a}></div>`}),this.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.data.shouldMuteNotNeededMethods&&(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.data.shouldMuteNotNeededMethods&&(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().width-2;e<this.data.autoScroll.edgeThreshold?this.scrollLeft():e>i-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})}));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ItemTypes plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Template, Vido } from '../gstc';
7
+ export declare const pluginPath = "config.plugin.ItemTypes";
8
+ export declare const templatePath = "config.templates.chart-timeline-items-row-item";
9
+ export interface Options {
10
+ [key: string]: Template;
11
+ }
12
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
13
+ //# sourceMappingURL=item-types.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ItemTypes plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Template, Vido } from '../gstc';
7
+ export declare const pluginPath = "config.plugin.ItemTypes";
8
+ export declare const templatePath = "config.templates.chart-timeline-items-row-item";
9
+ export interface Options {
10
+ [key: string]: Template;
11
+ }
12
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
13
+ //# sourceMappingURL=item-types.d.ts.map
@@ -0,0 +1,127 @@
1
+ /**
2
+ * ItemTypes 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="config.plugin.ItemTypes",e="config.templates.chart-timeline-items-row-item",i={task({className:t,labelClassName:e,cache:i,shouldDetach:s,actions:a,styleMap:l,slots:n,cutterLeft:c,cutterRight:o,getContent:$,vido:p,props:h}){const r=s||!h.item,{itemData:g,item:d}=h,m=g.position.left!==g.position.actualLeft,u=g.position.right!==g.position.actualRight,y=g.actualWidth,L=g.actualHeight,_=Math.min(8,L/2);let f=[`M ${_} ${L}`,`Q 0 ${L} 0 ${L-_}`,`L 0 ${_}`,`Q 0 0 ${_} 0`,`L ${y-_} 0`,`Q ${y} 0 ${y} ${_}`,`L ${y} ${L-_}`,`Q ${y} ${L} ${y-_} ${L}`,`L ${_} ${L}`].join(" ");m&&!u?f=["M 0 0",`L ${y-_} 0`,`Q ${y} 0 ${y} ${_}`,`L ${y} ${L-_}`,`Q ${y} ${L} ${y-_} ${L}`,`L 0 ${L}`].join(" "):m&&u?f=["M 0 0",`L ${y} 0`,`L ${y} ${L}`,`L 0 ${L}`].join(" "):!m&&u&&(f=[`M ${_} ${L}`,`Q 0 ${L} 0 ${L-_}`,`L 0 ${_}`,`Q 0 0 ${_} 0`,`L ${y} 0`,`L ${y} ${L}`,`L ${_} ${L}`].join(" "));const w=`gstc__clip-path-${d.id}`,v=`gstc__pattern-${d.id}`,j=void 0===d.progress?100:d.progress,x=g.width-g.width/100*j;let b=g.width-x;m&&(b+=g.position.left),b<0&&(b=0);const H=[`M ${b} 0`,`L ${y} 0`,`L ${y} ${L}`,`L ${b} ${L}`].join(" "),M=d.fill?d.fill:"#e74c3c",O=`gstc__item-type gstc__item-type--${d.type} `;return i(r?null:n.html("outer",p.html`
14
+ <div class=${O+t} data-gstcid=${h.item.id} data-actions=${a()} style=${l.directive()}>
15
+ ${y>=0?p.svg`<svg width=${y} height=${g.actualHeight} xmlns="http://www.w3.org/2000/svg">
16
+ <defs>
17
+ <clipPath id=${w}>
18
+ <path d=${f}></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=${f} fill=${M} />
37
+ <path
38
+ class="gstc__item-type-progress"
39
+ clip-path="url(#${w})"
40
+ d=${H}
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",p.html`<div class=${O+e}>${n.html("content",$())}</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:c,cutterRight:o,getContent:$,vido:p,props:h}){const r=l||!h.item,{itemData:g,item:d}=h,m=16,u=g.actualWidth,y=g.actualHeight,L=g.position.left!==g.position.actualLeft,_=g.position.right!==g.position.actualRight;let f=["M 0 "+g.actualHeight/2,`L ${u>=32?m:u/2} 0`,`L ${u>=32?u-m:u/2} 0`,`L ${u} ${g.actualHeight/2}`,`L ${u>=32?u-m:u/2} ${g.actualHeight}`,`L ${u>=32?m:u/2} ${g.actualHeight}`,"L 0 "+g.actualHeight/2].join(" ");L&&!_?f=["M 0 0",`L ${u>=32?u-m:u/2} 0`,`L ${u} ${g.actualHeight/2}`,`L ${u>=32?u-m:u/2} ${g.actualHeight}`,`L 0 ${y}`].join(" "):L&&_?f=["M 0 0",`L ${u} 0`,`L ${u} ${y}`,`L 0 ${y}`].join(" "):!L&&_&&(f=["M 0 "+g.actualHeight/2,`L ${u>=32?m:u/2} 0`,`L ${u} 0`,`L ${u} ${y}`,`L ${u>=32?m:u/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,x=g.width-g.width/100*j;let b=g.width-x;L&&(b+=g.position.left),b<0&&(b=0);const H=[`M ${u} 0`,`L ${u} ${y}`,`L ${b} ${y}`,`L ${b} 0`].join(" "),M=d.fill?d.fill:"#e74c3c",O=`gstc__item-type gstc__item-type--${d.type} `;return i(r?null:n.html("outer",p.html`
52
+ <div class=${O+t} data-gstcid=${h.item.id} data-actions=${s()} style=${a.directive()}>
53
+ ${u>=0?p.svg`<svg width=${u} height=${g.actualHeight} xmlns="http://www.w3.org/2000/svg">
54
+ <defs>
55
+ <clipPath id=${w}>
56
+ <path d=${f}></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=${f} stroke="none" fill=${M} />
75
+ <path
76
+ class="gstc__item-type-progress"
77
+ clip-path="url(#${w})"
78
+ d=${H}
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",p.html`<div class=${O+e}>${n.html("content",$())}</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:c,cutterRight:o,getContent:$,vido:p,props:h}){const r=s||!h.item,{itemData:g,item:d}=h,m=g.actualWidth,u=g.actualHeight,y=g.position.left!==g.position.actualLeft,L=["M 0 0",`L ${m} 0`,`L ${m} ${u}`,`L 0 ${u}`].join(" "),_=`gstc__clip-path-${d.id}`,f=`gstc__pattern-${d.id}`,w=void 0===d.progress?100:d.progress,v=g.width-g.width/100*w;let j=g.width-v;y&&(j+=g.position.left),j<0&&(j=0);const x=[`M ${m} 0`,`L ${m} ${u}`,`L ${j} ${u}`,`L ${j} 0`].join(" "),b=d.fill?d.fill:"#e74c3c",H=`gstc__item-type gstc__item-type--${d.type} `;return i(r?null:n.html("outer",p.html`
90
+ <div class=${H+t} data-gstcid=${h.item.id} data-actions=${a()} style=${l.directive()}>
91
+ ${m>=0?p.svg`<svg width=${m} height=${g.actualHeight} xmlns="http://www.w3.org/2000/svg">
92
+ <defs>
93
+ <clipPath id=${_}>
94
+ <path d=${L}></path>
95
+ </clipPath>
96
+ <pattern
97
+ id=${f}
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=${L} fill=${b} />
113
+ <path
114
+ class="gstc__item-type-progress"
115
+ clip-path="url(#${_})"
116
+ d=${x}
117
+ style="fill: url('#${f}');" />
118
+ <g clip-path="url(#${_})">
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",p.html`<div class=${H+e}>${n.html("content",$())}</div>`)}
122
+ </div>
123
+ </foreignObject>
124
+ </g>
125
+ </svg>`:null}
126
+ </div>
127
+ `))}};class s{constructor(s,a){this.unsub=[],this.options=function(t){return Object.assign(Object.assign({},i),t)}(s),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(t,this.options),this.state.update(e,(()=>this.componentTemplate)),this.unsub.push(this.state.subscribe(t,(t=>this.options=t))),this.api.pluginInitialized("ItemTypes")}destroy(){this.unsub.forEach((t=>t())),this.state.update(e,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)}}function a(e={}){return function(i){const a=i.state.get(t);a&&(e=i.api.mergeDeep({},e,a));return new s(e,i).destroy}}export{a as Plugin,t as pluginPath,e as templatePath};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ItemTypes plugin
3
+ *
4
+ * @header --gstc--header--
5
+ */
6
+ import type { Template, Vido } from '../gstc';
7
+ export declare const pluginPath = "config.plugin.ItemTypes";
8
+ export declare const templatePath = "config.templates.chart-timeline-items-row-item";
9
+ export interface Options {
10
+ [key: string]: Template;
11
+ }
12
+ export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
13
+ //# sourceMappingURL=item-types.d.ts.map