@wimi/vtable-gantt 1.0.0

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 (317) hide show
  1. package/README.md +213 -0
  2. package/README.zh-CN.md +215 -0
  3. package/cjs/Gantt.d.ts +200 -0
  4. package/cjs/Gantt.js +582 -0
  5. package/cjs/Gantt.js.map +1 -0
  6. package/cjs/components/Menu.d.ts +1 -0
  7. package/cjs/components/Menu.js +1 -0
  8. package/cjs/components/Menu.js.map +1 -0
  9. package/cjs/components/MenuElementStyle.d.ts +1 -0
  10. package/cjs/components/MenuElementStyle.js +12 -0
  11. package/cjs/components/MenuElementStyle.js.map +1 -0
  12. package/cjs/data/DataSource.d.ts +9 -0
  13. package/cjs/data/DataSource.js +76 -0
  14. package/cjs/data/DataSource.js.map +1 -0
  15. package/cjs/env.d.ts +19 -0
  16. package/cjs/env.js +48 -0
  17. package/cjs/env.js.map +1 -0
  18. package/cjs/event/EventHandler.d.ts +47 -0
  19. package/cjs/event/EventHandler.js +128 -0
  20. package/cjs/event/EventHandler.js.map +1 -0
  21. package/cjs/event/EventTarget.d.ts +12 -0
  22. package/cjs/event/EventTarget.js +67 -0
  23. package/cjs/event/EventTarget.js.map +1 -0
  24. package/cjs/event/event-manager.d.ts +34 -0
  25. package/cjs/event/event-manager.js +369 -0
  26. package/cjs/event/event-manager.js.map +1 -0
  27. package/cjs/event/scroll.d.ts +8 -0
  28. package/cjs/event/scroll.js +112 -0
  29. package/cjs/event/scroll.js.map +1 -0
  30. package/cjs/event/touch.d.ts +2 -0
  31. package/cjs/event/touch.js +86 -0
  32. package/cjs/event/touch.js.map +1 -0
  33. package/cjs/gantt-helper.d.ts +63 -0
  34. package/cjs/gantt-helper.js +712 -0
  35. package/cjs/gantt-helper.js.map +1 -0
  36. package/cjs/index.d.ts +10 -0
  37. package/cjs/index.js +60 -0
  38. package/cjs/index.js.map +1 -0
  39. package/cjs/plugins/index.d.ts +2 -0
  40. package/cjs/plugins/index.js +15 -0
  41. package/cjs/plugins/index.js.map +1 -0
  42. package/cjs/plugins/interface.d.ts +10 -0
  43. package/cjs/plugins/interface.js +6 -0
  44. package/cjs/plugins/interface.js.map +1 -0
  45. package/cjs/plugins/plugin-manager.d.ts +16 -0
  46. package/cjs/plugins/plugin-manager.js +63 -0
  47. package/cjs/plugins/plugin-manager.js.map +1 -0
  48. package/cjs/register.d.ts +1 -0
  49. package/cjs/register.js +1 -0
  50. package/cjs/register.js.map +1 -0
  51. package/cjs/scenegraph/dependency-link.d.ts +48 -0
  52. package/cjs/scenegraph/dependency-link.js +480 -0
  53. package/cjs/scenegraph/dependency-link.js.map +1 -0
  54. package/cjs/scenegraph/drag-order-line.d.ts +12 -0
  55. package/cjs/scenegraph/drag-order-line.js +49 -0
  56. package/cjs/scenegraph/drag-order-line.js.map +1 -0
  57. package/cjs/scenegraph/frame-border.d.ts +10 -0
  58. package/cjs/scenegraph/frame-border.js +58 -0
  59. package/cjs/scenegraph/frame-border.js.map +1 -0
  60. package/cjs/scenegraph/gantt-node.d.ts +22 -0
  61. package/cjs/scenegraph/gantt-node.js +66 -0
  62. package/cjs/scenegraph/gantt-node.js.map +1 -0
  63. package/cjs/scenegraph/graphic/group-contribution-render.d.ts +12 -0
  64. package/cjs/scenegraph/graphic/group-contribution-render.js +37 -0
  65. package/cjs/scenegraph/graphic/group-contribution-render.js.map +1 -0
  66. package/cjs/scenegraph/graphic/index.d.ts +3 -0
  67. package/cjs/scenegraph/graphic/index.js +13 -0
  68. package/cjs/scenegraph/graphic/index.js.map +1 -0
  69. package/cjs/scenegraph/grid.d.ts +34 -0
  70. package/cjs/scenegraph/grid.js +316 -0
  71. package/cjs/scenegraph/grid.js.map +1 -0
  72. package/cjs/scenegraph/mark-line.d.ts +13 -0
  73. package/cjs/scenegraph/mark-line.js +109 -0
  74. package/cjs/scenegraph/mark-line.js.map +1 -0
  75. package/cjs/scenegraph/scenegraph.d.ts +59 -0
  76. package/cjs/scenegraph/scenegraph.js +240 -0
  77. package/cjs/scenegraph/scenegraph.js.map +1 -0
  78. package/cjs/scenegraph/scroll-bar.d.ts +19 -0
  79. package/cjs/scenegraph/scroll-bar.js +150 -0
  80. package/cjs/scenegraph/scroll-bar.js.map +1 -0
  81. package/cjs/scenegraph/task-bar.d.ts +40 -0
  82. package/cjs/scenegraph/task-bar.js +476 -0
  83. package/cjs/scenegraph/task-bar.js.map +1 -0
  84. package/cjs/scenegraph/task-creation-button.d.ts +13 -0
  85. package/cjs/scenegraph/task-creation-button.js +86 -0
  86. package/cjs/scenegraph/task-creation-button.js.map +1 -0
  87. package/cjs/scenegraph/timeline-header.d.ts +14 -0
  88. package/cjs/scenegraph/timeline-header.js +190 -0
  89. package/cjs/scenegraph/timeline-header.js.map +1 -0
  90. package/cjs/scenegraph/tooltip.d.ts +9 -0
  91. package/cjs/scenegraph/tooltip.js +59 -0
  92. package/cjs/scenegraph/tooltip.js.map +1 -0
  93. package/cjs/state/gantt-table-sync.d.ts +8 -0
  94. package/cjs/state/gantt-table-sync.js +96 -0
  95. package/cjs/state/gantt-table-sync.js.map +1 -0
  96. package/cjs/state/state-manager.d.ts +127 -0
  97. package/cjs/state/state-manager.js +634 -0
  98. package/cjs/state/state-manager.js.map +1 -0
  99. package/cjs/sub-tasks-inline-helper.d.ts +1 -0
  100. package/cjs/sub-tasks-inline-helper.js +1 -0
  101. package/cjs/sub-tasks-inline-helper.js.map +1 -0
  102. package/cjs/themes.d.ts +1 -0
  103. package/cjs/themes.js +1 -0
  104. package/cjs/themes.js.map +1 -0
  105. package/cjs/tools/debounce.d.ts +1 -0
  106. package/cjs/tools/debounce.js +51 -0
  107. package/cjs/tools/debounce.js.map +1 -0
  108. package/cjs/tools/dom.d.ts +1 -0
  109. package/cjs/tools/dom.js +11 -0
  110. package/cjs/tools/dom.js.map +1 -0
  111. package/cjs/tools/index.d.ts +2 -0
  112. package/cjs/tools/index.js +30 -0
  113. package/cjs/tools/index.js.map +1 -0
  114. package/cjs/tools/inertia.d.ts +15 -0
  115. package/cjs/tools/inertia.js +40 -0
  116. package/cjs/tools/inertia.js.map +1 -0
  117. package/cjs/tools/isx.d.ts +16 -0
  118. package/cjs/tools/isx.js +117 -0
  119. package/cjs/tools/isx.js.map +1 -0
  120. package/cjs/tools/pixel-ratio.d.ts +2 -0
  121. package/cjs/tools/pixel-ratio.js +16 -0
  122. package/cjs/tools/pixel-ratio.js.map +1 -0
  123. package/cjs/tools/util.d.ts +19 -0
  124. package/cjs/tools/util.js +404 -0
  125. package/cjs/tools/util.js.map +1 -0
  126. package/cjs/ts-types/EVENT_TYPE.d.ts +19 -0
  127. package/cjs/ts-types/EVENT_TYPE.js +22 -0
  128. package/cjs/ts-types/EVENT_TYPE.js.map +1 -0
  129. package/cjs/ts-types/common.d.ts +11 -0
  130. package/cjs/ts-types/common.js +10 -0
  131. package/cjs/ts-types/common.js.map +1 -0
  132. package/cjs/ts-types/events.d.ts +132 -0
  133. package/cjs/ts-types/events.js +6 -0
  134. package/cjs/ts-types/events.js.map +1 -0
  135. package/cjs/ts-types/gantt-engine.d.ts +344 -0
  136. package/cjs/ts-types/gantt-engine.js +18 -0
  137. package/cjs/ts-types/gantt-engine.js.map +1 -0
  138. package/cjs/ts-types/index.d.ts +5 -0
  139. package/cjs/ts-types/index.js +23 -0
  140. package/cjs/ts-types/index.js.map +1 -0
  141. package/cjs/ts-types/zoom-scale.d.ts +32 -0
  142. package/cjs/ts-types/zoom-scale.js +6 -0
  143. package/cjs/ts-types/zoom-scale.js.map +1 -0
  144. package/cjs/vrender.d.ts +1 -0
  145. package/cjs/vrender.js +60 -0
  146. package/cjs/vrender.js.map +1 -0
  147. package/cjs/vtable.d.ts +1 -0
  148. package/cjs/vtable.js +35 -0
  149. package/cjs/vtable.js.map +1 -0
  150. package/cjs/zoom-scale/DataZoomIntegration.d.ts +50 -0
  151. package/cjs/zoom-scale/DataZoomIntegration.js +261 -0
  152. package/cjs/zoom-scale/DataZoomIntegration.js.map +1 -0
  153. package/cjs/zoom-scale/ZoomScaleManager.d.ts +55 -0
  154. package/cjs/zoom-scale/ZoomScaleManager.js +328 -0
  155. package/cjs/zoom-scale/ZoomScaleManager.js.map +1 -0
  156. package/cjs/zoom-scale/index.d.ts +4 -0
  157. package/cjs/zoom-scale/index.js +24 -0
  158. package/cjs/zoom-scale/index.js.map +1 -0
  159. package/dist/vtable-gantt.js +76328 -0
  160. package/dist/vtable-gantt.min.js +15 -0
  161. package/es/Gantt.d.ts +200 -0
  162. package/es/Gantt.js +584 -0
  163. package/es/Gantt.js.map +1 -0
  164. package/es/components/Menu.d.ts +1 -0
  165. package/es/components/Menu.js +1 -0
  166. package/es/components/Menu.js.map +1 -0
  167. package/es/components/MenuElementStyle.d.ts +1 -0
  168. package/es/components/MenuElementStyle.js +6 -0
  169. package/es/components/MenuElementStyle.js.map +1 -0
  170. package/es/data/DataSource.d.ts +9 -0
  171. package/es/data/DataSource.js +63 -0
  172. package/es/data/DataSource.js.map +1 -0
  173. package/es/env.d.ts +19 -0
  174. package/es/env.js +42 -0
  175. package/es/env.js.map +1 -0
  176. package/es/event/EventHandler.d.ts +47 -0
  177. package/es/event/EventHandler.js +119 -0
  178. package/es/event/EventHandler.js.map +1 -0
  179. package/es/event/EventTarget.d.ts +12 -0
  180. package/es/event/EventTarget.js +58 -0
  181. package/es/event/EventTarget.js.map +1 -0
  182. package/es/event/event-manager.d.ts +34 -0
  183. package/es/event/event-manager.js +376 -0
  184. package/es/event/event-manager.js.map +1 -0
  185. package/es/event/scroll.d.ts +8 -0
  186. package/es/event/scroll.js +104 -0
  187. package/es/event/scroll.js.map +1 -0
  188. package/es/event/touch.d.ts +2 -0
  189. package/es/event/touch.js +78 -0
  190. package/es/event/touch.js.map +1 -0
  191. package/es/gantt-helper.d.ts +63 -0
  192. package/es/gantt-helper.js +683 -0
  193. package/es/gantt-helper.js.map +1 -0
  194. package/es/index.d.ts +10 -0
  195. package/es/index.js +16 -0
  196. package/es/index.js.map +1 -0
  197. package/es/plugins/index.d.ts +2 -0
  198. package/es/plugins/index.js +2 -0
  199. package/es/plugins/index.js.map +1 -0
  200. package/es/plugins/interface.d.ts +10 -0
  201. package/es/plugins/interface.js +2 -0
  202. package/es/plugins/interface.js.map +1 -0
  203. package/es/plugins/plugin-manager.d.ts +16 -0
  204. package/es/plugins/plugin-manager.js +55 -0
  205. package/es/plugins/plugin-manager.js.map +1 -0
  206. package/es/register.d.ts +1 -0
  207. package/es/register.js +1 -0
  208. package/es/register.js.map +1 -0
  209. package/es/scenegraph/dependency-link.d.ts +48 -0
  210. package/es/scenegraph/dependency-link.js +462 -0
  211. package/es/scenegraph/dependency-link.js.map +1 -0
  212. package/es/scenegraph/drag-order-line.d.ts +12 -0
  213. package/es/scenegraph/drag-order-line.js +40 -0
  214. package/es/scenegraph/drag-order-line.js.map +1 -0
  215. package/es/scenegraph/frame-border.d.ts +10 -0
  216. package/es/scenegraph/frame-border.js +51 -0
  217. package/es/scenegraph/frame-border.js.map +1 -0
  218. package/es/scenegraph/gantt-node.d.ts +22 -0
  219. package/es/scenegraph/gantt-node.js +64 -0
  220. package/es/scenegraph/gantt-node.js.map +1 -0
  221. package/es/scenegraph/graphic/group-contribution-render.d.ts +12 -0
  222. package/es/scenegraph/graphic/group-contribution-render.js +32 -0
  223. package/es/scenegraph/graphic/group-contribution-render.js.map +1 -0
  224. package/es/scenegraph/graphic/index.d.ts +3 -0
  225. package/es/scenegraph/graphic/index.js +8 -0
  226. package/es/scenegraph/graphic/index.js.map +1 -0
  227. package/es/scenegraph/grid.d.ts +34 -0
  228. package/es/scenegraph/grid.js +306 -0
  229. package/es/scenegraph/grid.js.map +1 -0
  230. package/es/scenegraph/mark-line.d.ts +13 -0
  231. package/es/scenegraph/mark-line.js +101 -0
  232. package/es/scenegraph/mark-line.js.map +1 -0
  233. package/es/scenegraph/scenegraph.d.ts +59 -0
  234. package/es/scenegraph/scenegraph.js +250 -0
  235. package/es/scenegraph/scenegraph.js.map +1 -0
  236. package/es/scenegraph/scroll-bar.d.ts +19 -0
  237. package/es/scenegraph/scroll-bar.js +144 -0
  238. package/es/scenegraph/scroll-bar.js.map +1 -0
  239. package/es/scenegraph/task-bar.d.ts +40 -0
  240. package/es/scenegraph/task-bar.js +475 -0
  241. package/es/scenegraph/task-bar.js.map +1 -0
  242. package/es/scenegraph/task-creation-button.d.ts +13 -0
  243. package/es/scenegraph/task-creation-button.js +78 -0
  244. package/es/scenegraph/task-creation-button.js.map +1 -0
  245. package/es/scenegraph/timeline-header.d.ts +14 -0
  246. package/es/scenegraph/timeline-header.js +186 -0
  247. package/es/scenegraph/timeline-header.js.map +1 -0
  248. package/es/scenegraph/tooltip.d.ts +9 -0
  249. package/es/scenegraph/tooltip.js +51 -0
  250. package/es/scenegraph/tooltip.js.map +1 -0
  251. package/es/state/gantt-table-sync.d.ts +8 -0
  252. package/es/state/gantt-table-sync.js +87 -0
  253. package/es/state/gantt-table-sync.js.map +1 -0
  254. package/es/state/state-manager.d.ts +127 -0
  255. package/es/state/state-manager.js +631 -0
  256. package/es/state/state-manager.js.map +1 -0
  257. package/es/sub-tasks-inline-helper.d.ts +1 -0
  258. package/es/sub-tasks-inline-helper.js +1 -0
  259. package/es/sub-tasks-inline-helper.js.map +1 -0
  260. package/es/themes.d.ts +1 -0
  261. package/es/themes.js +1 -0
  262. package/es/themes.js.map +1 -0
  263. package/es/tools/debounce.d.ts +1 -0
  264. package/es/tools/debounce.js +45 -0
  265. package/es/tools/debounce.js.map +1 -0
  266. package/es/tools/dom.d.ts +1 -0
  267. package/es/tools/dom.js +5 -0
  268. package/es/tools/dom.js.map +1 -0
  269. package/es/tools/index.d.ts +2 -0
  270. package/es/tools/index.js +4 -0
  271. package/es/tools/index.js.map +1 -0
  272. package/es/tools/inertia.d.ts +15 -0
  273. package/es/tools/inertia.js +31 -0
  274. package/es/tools/inertia.js.map +1 -0
  275. package/es/tools/isx.d.ts +16 -0
  276. package/es/tools/isx.js +80 -0
  277. package/es/tools/isx.js.map +1 -0
  278. package/es/tools/pixel-ratio.d.ts +2 -0
  279. package/es/tools/pixel-ratio.js +12 -0
  280. package/es/tools/pixel-ratio.js.map +1 -0
  281. package/es/tools/util.d.ts +19 -0
  282. package/es/tools/util.js +390 -0
  283. package/es/tools/util.js.map +1 -0
  284. package/es/ts-types/EVENT_TYPE.d.ts +19 -0
  285. package/es/ts-types/EVENT_TYPE.js +18 -0
  286. package/es/ts-types/EVENT_TYPE.js.map +1 -0
  287. package/es/ts-types/common.d.ts +11 -0
  288. package/es/ts-types/common.js +6 -0
  289. package/es/ts-types/common.js.map +1 -0
  290. package/es/ts-types/events.d.ts +132 -0
  291. package/es/ts-types/events.js +2 -0
  292. package/es/ts-types/events.js.map +1 -0
  293. package/es/ts-types/gantt-engine.d.ts +344 -0
  294. package/es/ts-types/gantt-engine.js +21 -0
  295. package/es/ts-types/gantt-engine.js.map +1 -0
  296. package/es/ts-types/index.d.ts +5 -0
  297. package/es/ts-types/index.js +10 -0
  298. package/es/ts-types/index.js.map +1 -0
  299. package/es/ts-types/zoom-scale.d.ts +32 -0
  300. package/es/ts-types/zoom-scale.js +2 -0
  301. package/es/ts-types/zoom-scale.js.map +1 -0
  302. package/es/vrender.d.ts +1 -0
  303. package/es/vrender.js +2 -0
  304. package/es/vrender.js.map +1 -0
  305. package/es/vtable.d.ts +1 -0
  306. package/es/vtable.js +2 -0
  307. package/es/vtable.js.map +1 -0
  308. package/es/zoom-scale/DataZoomIntegration.d.ts +50 -0
  309. package/es/zoom-scale/DataZoomIntegration.js +253 -0
  310. package/es/zoom-scale/DataZoomIntegration.js.map +1 -0
  311. package/es/zoom-scale/ZoomScaleManager.d.ts +55 -0
  312. package/es/zoom-scale/ZoomScaleManager.js +322 -0
  313. package/es/zoom-scale/ZoomScaleManager.js.map +1 -0
  314. package/es/zoom-scale/index.d.ts +4 -0
  315. package/es/zoom-scale/index.js +4 -0
  316. package/es/zoom-scale/index.js.map +1 -0
  317. package/package.json +124 -0
@@ -0,0 +1,683 @@
1
+ import { TasksShowMode, TaskType } from "./ts-types";
2
+
3
+ import { createDateAtLastHour, createDateAtLastMillisecond, createDateAtLastMinute, createDateAtLastSecond, createDateAtMidnight, getEndDateByTimeUnit, getStartDateByTimeUnit, getWeekNumber } from "./tools/util";
4
+
5
+ export const defaultTaskBarStyle = {
6
+ barColor: "blue",
7
+ completedBarColor: "gray",
8
+ width: 30,
9
+ cornerRadius: 3,
10
+ borderWidth: 0,
11
+ fontFamily: "Arial",
12
+ fontSize: 14
13
+ };
14
+
15
+ function setWidthToDefaultTaskBarStyle(width) {
16
+ defaultTaskBarStyle.width = width;
17
+ }
18
+
19
+ const isNode = "undefined" == typeof window || void 0 === window.window;
20
+
21
+ export const DayTimes = 864e5;
22
+
23
+ export function getDateIndexByX(x, gantt) {
24
+ const totalX = x + gantt.stateManager.scroll.horizontalBarPos, firstDateColWidth = gantt.getDateColWidth(0);
25
+ return Math.floor((totalX - firstDateColWidth) / gantt.parsedOptions.timelineColWidth) + 1;
26
+ }
27
+
28
+ export function generateMarkLine(markLine) {
29
+ var _a, _b, _c, _d, _e;
30
+ return markLine ? !0 === markLine ? [ {
31
+ date: createDateAtMidnight().toLocaleDateString(),
32
+ content: "",
33
+ scrollToMarkLine: !0,
34
+ position: "left",
35
+ style: {
36
+ lineColor: "red",
37
+ lineWidth: 1
38
+ }
39
+ } ] : Array.isArray(markLine) ? markLine.map(((item, index) => {
40
+ var _a, _b, _c, _d;
41
+ return Object.assign(Object.assign({}, item), {
42
+ date: item.date,
43
+ scrollToMarkLine: item.scrollToMarkLine,
44
+ position: null !== (_a = item.position) && void 0 !== _a ? _a : "left",
45
+ style: {
46
+ lineColor: (null === (_b = item.style) || void 0 === _b ? void 0 : _b.lineColor) || "red",
47
+ lineWidth: (null === (_c = item.style) || void 0 === _c ? void 0 : _c.lineWidth) || 1,
48
+ lineDash: null === (_d = item.style) || void 0 === _d ? void 0 : _d.lineDash
49
+ }
50
+ });
51
+ })) : [ Object.assign(Object.assign({}, markLine), {
52
+ date: markLine.date,
53
+ scrollToMarkLine: null === (_a = markLine.scrollToMarkLine) || void 0 === _a || _a,
54
+ position: null !== (_b = markLine.position) && void 0 !== _b ? _b : "left",
55
+ style: {
56
+ lineColor: (null === (_c = markLine.style) || void 0 === _c ? void 0 : _c.lineColor) || "red",
57
+ lineWidth: (null === (_d = markLine.style) || void 0 === _d ? void 0 : _d.lineWidth) || 1,
58
+ lineDash: null === (_e = markLine.style) || void 0 === _e ? void 0 : _e.lineDash
59
+ }
60
+ }) ] : [];
61
+ }
62
+
63
+ export function getHorizontalScrollBarSize(scrollStyle) {
64
+ var _a;
65
+ return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
66
+ }
67
+
68
+ export function getVerticalScrollBarSize(scrollStyle) {
69
+ var _a;
70
+ return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
71
+ }
72
+
73
+ export { isNode };
74
+
75
+ export function initOptions(gantt) {
76
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91;
77
+ const options = gantt.options;
78
+ gantt.parsedOptions.tasksShowMode = null !== (_a = null == options ? void 0 : options.tasksShowMode) && void 0 !== _a ? _a : TasksShowMode.Tasks_Separate,
79
+ gantt.parsedOptions.pixelRatio = null !== (_b = null == options ? void 0 : options.pixelRatio) && void 0 !== _b ? _b : 1,
80
+ gantt.parsedOptions.rowHeight = null !== (_c = null == options ? void 0 : options.rowHeight) && void 0 !== _c ? _c : 40,
81
+ gantt.parsedOptions.timelineColWidth = null !== (_e = null === (_d = null == options ? void 0 : options.timelineHeader) || void 0 === _d ? void 0 : _d.colWidth) && void 0 !== _e ? _e : 60,
82
+ gantt.parsedOptions.startDateField = null !== (_g = null === (_f = options.taskBar) || void 0 === _f ? void 0 : _f.startDateField) && void 0 !== _g ? _g : "startDate",
83
+ gantt.parsedOptions.endDateField = null !== (_j = null === (_h = options.taskBar) || void 0 === _h ? void 0 : _h.endDateField) && void 0 !== _j ? _j : "endDate",
84
+ gantt.parsedOptions.progressField = null !== (_l = null === (_k = options.taskBar) || void 0 === _k ? void 0 : _k.progressField) && void 0 !== _l ? _l : "progress",
85
+ gantt.parsedOptions.taskBarClip = null === (_o = null === (_m = null == options ? void 0 : options.taskBar) || void 0 === _m ? void 0 : _m.clip) || void 0 === _o || _o,
86
+ gantt.parsedOptions.projectSubTasksExpandable = null === (_p = null == options ? void 0 : options.projectSubTasksExpandable) || void 0 === _p || _p;
87
+ const {unit: minTimeUnit, startOfWeek: startOfWeek, step: step} = gantt.parsedOptions.reverseSortedTimelineScales[0];
88
+ gantt.parsedOptions.minDate = (null == options ? void 0 : options.minDate) ? getStartDateByTimeUnit(new Date(options.minDate), minTimeUnit, startOfWeek) : void 0,
89
+ gantt.parsedOptions.maxDate = (null == options ? void 0 : options.maxDate) && (null === (_q = gantt.parsedOptions) || void 0 === _q ? void 0 : _q.minDate) ? getEndDateByTimeUnit(null === (_r = gantt.parsedOptions) || void 0 === _r ? void 0 : _r.minDate, new Date(options.maxDate), minTimeUnit, step) : void 0,
90
+ gantt.parsedOptions._minDateTime = null === (_s = gantt.parsedOptions.minDate) || void 0 === _s ? void 0 : _s.getTime(),
91
+ gantt.parsedOptions._maxDateTime = null === (_t = gantt.parsedOptions.maxDate) || void 0 === _t ? void 0 : _t.getTime(),
92
+ gantt.parsedOptions.overscrollBehavior = null !== (_u = null == options ? void 0 : options.overscrollBehavior) && void 0 !== _u ? _u : "auto",
93
+ gantt.parsedOptions.underlayBackgroundColor = null !== (_v = null == options ? void 0 : options.underlayBackgroundColor) && void 0 !== _v ? _v : "#FFF",
94
+ gantt.parsedOptions.scrollStyle = Object.assign({}, {
95
+ scrollRailColor: "rgba(100, 100, 100, 0.2)",
96
+ scrollSliderColor: "rgba(100, 100, 100, 0.5)",
97
+ scrollSliderCornerRadius: 4,
98
+ width: 10,
99
+ visible: "always",
100
+ hoverOn: !0,
101
+ barToSide: !1
102
+ }, null == options ? void 0 : options.scrollStyle), gantt.parsedOptions.timelineHeaderHorizontalLineStyle = null === (_w = null == options ? void 0 : options.timelineHeader) || void 0 === _w ? void 0 : _w.horizontalLine,
103
+ gantt.parsedOptions.timelineHeaderVerticalLineStyle = null === (_x = null == options ? void 0 : options.timelineHeader) || void 0 === _x ? void 0 : _x.verticalLine,
104
+ gantt.parsedOptions.timelineHeaderBackgroundColor = null === (_y = null == options ? void 0 : options.timelineHeader) || void 0 === _y ? void 0 : _y.backgroundColor,
105
+ gantt.parsedOptions.timeLineHeaderRowHeights = [], gantt.parsedOptions.timelineHeaderStyles = [];
106
+ for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length; i++) {
107
+ const style = gantt.parsedOptions.sortedTimelineScales[i].style;
108
+ gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
109
+ fontSize: 20,
110
+ fontWeight: "bold",
111
+ textAlign: "center",
112
+ textBaseline: "middle",
113
+ color: "#000",
114
+ backgroundColor: "#fff"
115
+ }, style)), gantt.parsedOptions.timeLineHeaderRowHeights.push(null !== (_0 = null !== (_z = gantt.parsedOptions.sortedTimelineScales[i].rowHeight) && void 0 !== _z ? _z : null == options ? void 0 : options.headerRowHeight) && void 0 !== _0 ? _0 : 40);
116
+ }
117
+ gantt.parsedOptions.grid = Object.assign({}, null == options ? void 0 : options.grid),
118
+ setWidthToDefaultTaskBarStyle(3 * gantt.parsedOptions.rowHeight / 4), gantt.parsedOptions.taskBarStyle = (null === (_1 = null == options ? void 0 : options.taskBar) || void 0 === _1 ? void 0 : _1.barStyle) && "function" == typeof (null === (_2 = null == options ? void 0 : options.taskBar) || void 0 === _2 ? void 0 : _2.barStyle) ? options.taskBar.barStyle : Object.assign({}, defaultTaskBarStyle, null === (_3 = null == options ? void 0 : options.taskBar) || void 0 === _3 ? void 0 : _3.barStyle),
119
+ gantt.parsedOptions.projectBarStyle = (null === (_4 = null == options ? void 0 : options.taskBar) || void 0 === _4 ? void 0 : _4.projectStyle) && "function" == typeof (null === (_5 = null == options ? void 0 : options.taskBar) || void 0 === _5 ? void 0 : _5.projectStyle) ? options.taskBar.projectStyle : (null === (_6 = null == options ? void 0 : options.taskBar) || void 0 === _6 ? void 0 : _6.projectStyle) ? Object.assign({}, defaultTaskBarStyle, null === (_7 = null == options ? void 0 : options.taskBar) || void 0 === _7 ? void 0 : _7.projectStyle) : gantt.parsedOptions.taskBarStyle;
120
+ gantt.parsedOptions.taskBarMilestoneStyle = Object.assign("function" == typeof gantt.parsedOptions.taskBarStyle ? {} : {
121
+ width: gantt.parsedOptions.taskBarStyle.width,
122
+ borderColor: gantt.parsedOptions.taskBarStyle.borderColor,
123
+ borderLineWidth: null !== (_8 = gantt.parsedOptions.taskBarStyle.borderLineWidth) && void 0 !== _8 ? _8 : 1,
124
+ fillColor: gantt.parsedOptions.taskBarStyle.barColor,
125
+ cornerRadius: 0
126
+ }, {
127
+ labelTextStyle: {
128
+ fontSize: 16,
129
+ color: "red",
130
+ fontFamily: "Arial",
131
+ padding: 4
132
+ }
133
+ }, null === (_9 = null == options ? void 0 : options.taskBar) || void 0 === _9 ? void 0 : _9.milestoneStyle),
134
+ gantt.parsedOptions.taskBarMilestoneHypotenuse = gantt.parsedOptions.taskBarMilestoneStyle.width * Math.sqrt(2),
135
+ gantt.parsedOptions.dateFormat = null == options ? void 0 : options.dateFormat,
136
+ gantt.parsedOptions.taskBarHoverStyle = Object.assign({
137
+ barOverlayColor: "rgba(99, 144, 0, 0.4)"
138
+ }, null === (_10 = null == options ? void 0 : options.taskBar) || void 0 === _10 ? void 0 : _10.hoverBarStyle),
139
+ gantt.parsedOptions.taskBarSelectable = null === (_12 = null === (_11 = null == options ? void 0 : options.taskBar) || void 0 === _11 ? void 0 : _11.selectable) || void 0 === _12 || _12,
140
+ gantt.parsedOptions.taskBarSelectedStyle = Object.assign("function" == typeof gantt.parsedOptions.taskBarStyle ? {
141
+ shadowBlur: 6,
142
+ shadowOffsetX: 0,
143
+ shadowOffsetY: 0,
144
+ borderLineWidth: 1
145
+ } : {
146
+ shadowBlur: 6,
147
+ shadowOffsetX: 0,
148
+ shadowOffsetY: 0,
149
+ shadowColor: gantt.parsedOptions.taskBarStyle.barColor,
150
+ borderColor: gantt.parsedOptions.taskBarStyle.barColor,
151
+ borderLineWidth: 1
152
+ }, null === (_13 = null == options ? void 0 : options.taskBar) || void 0 === _13 ? void 0 : _13.selectedBarStyle),
153
+ gantt.parsedOptions.taskBarLabelText = null !== (_15 = null === (_14 = null == options ? void 0 : options.taskBar) || void 0 === _14 ? void 0 : _14.labelText) && void 0 !== _15 ? _15 : "",
154
+ gantt.parsedOptions.taskBarMoveable = null === (_17 = null === (_16 = null == options ? void 0 : options.taskBar) || void 0 === _16 ? void 0 : _16.moveable) || void 0 === _17 || _17,
155
+ gantt.parsedOptions.moveTaskBarToExtendDateRange = null === (_19 = null === (_18 = null == options ? void 0 : options.taskBar) || void 0 === _18 ? void 0 : _18.moveToExtendDateRange) || void 0 === _19 || _19,
156
+ gantt.parsedOptions.taskBarResizable = null === (_21 = null === (_20 = null == options ? void 0 : options.taskBar) || void 0 === _20 ? void 0 : _20.resizable) || void 0 === _21 || _21,
157
+ gantt.parsedOptions.taskBarProgressAdjustable = null !== (_23 = null === (_22 = null == options ? void 0 : options.taskBar) || void 0 === _22 ? void 0 : _22.progressAdjustable) && void 0 !== _23 && _23,
158
+ gantt.parsedOptions.taskBarDragOrder = null === (_25 = null === (_24 = null == options ? void 0 : options.taskBar) || void 0 === _24 ? void 0 : _24.dragOrder) || void 0 === _25 || _25,
159
+ gantt.parsedOptions.taskBarLabelStyle = {
160
+ fontFamily: null !== (_28 = null === (_27 = null === (_26 = null == options ? void 0 : options.taskBar) || void 0 === _26 ? void 0 : _26.labelTextStyle) || void 0 === _27 ? void 0 : _27.fontFamily) && void 0 !== _28 ? _28 : "Arial",
161
+ fontSize: null !== (_31 = null === (_30 = null === (_29 = null == options ? void 0 : options.taskBar) || void 0 === _29 ? void 0 : _29.labelTextStyle) || void 0 === _30 ? void 0 : _30.fontSize) && void 0 !== _31 ? _31 : 20,
162
+ color: null !== (_34 = null === (_33 = null === (_32 = null == options ? void 0 : options.taskBar) || void 0 === _32 ? void 0 : _32.labelTextStyle) || void 0 === _33 ? void 0 : _33.color) && void 0 !== _34 ? _34 : "#F01",
163
+ outsideColor: null !== (_37 = null === (_36 = null === (_35 = null == options ? void 0 : options.taskBar) || void 0 === _35 ? void 0 : _35.labelTextStyle) || void 0 === _36 ? void 0 : _36.outsideColor) && void 0 !== _37 ? _37 : "#333333",
164
+ textAlign: null !== (_40 = null === (_39 = null === (_38 = null == options ? void 0 : options.taskBar) || void 0 === _38 ? void 0 : _38.labelTextStyle) || void 0 === _39 ? void 0 : _39.textAlign) && void 0 !== _40 ? _40 : "left",
165
+ textBaseline: null !== (_43 = null === (_42 = null === (_41 = null == options ? void 0 : options.taskBar) || void 0 === _41 ? void 0 : _41.labelTextStyle) || void 0 === _42 ? void 0 : _42.textBaseline) && void 0 !== _43 ? _43 : "middle",
166
+ padding: null !== (_46 = null === (_45 = null === (_44 = null == options ? void 0 : options.taskBar) || void 0 === _44 ? void 0 : _44.labelTextStyle) || void 0 === _45 ? void 0 : _45.padding) && void 0 !== _46 ? _46 : [ 0, 0, 0, 10 ],
167
+ textOverflow: null === (_48 = null === (_47 = null == options ? void 0 : options.taskBar) || void 0 === _47 ? void 0 : _47.labelTextStyle) || void 0 === _48 ? void 0 : _48.textOverflow,
168
+ orient: null === (_50 = null === (_49 = null == options ? void 0 : options.taskBar) || void 0 === _49 ? void 0 : _49.labelTextStyle) || void 0 === _50 ? void 0 : _50.orient,
169
+ orientHandleWithOverflow: null === (_52 = null === (_51 = null == options ? void 0 : options.taskBar) || void 0 === _51 ? void 0 : _51.labelTextStyle) || void 0 === _52 ? void 0 : _52.orientHandleWithOverflow
170
+ }, gantt.parsedOptions.taskBarCustomLayout = null === (_53 = null == options ? void 0 : options.taskBar) || void 0 === _53 ? void 0 : _53.customLayout,
171
+ gantt.parsedOptions.taskBarCreatable = null !== (_55 = null === (_54 = null == options ? void 0 : options.taskBar) || void 0 === _54 ? void 0 : _54.scheduleCreatable) && void 0 !== _55 ? _55 : !(gantt.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Separate && gantt.parsedOptions.tasksShowMode !== TasksShowMode.Tasks_Separate),
172
+ gantt.parsedOptions.taskBarCreationButtonStyle = Object.assign({
173
+ lineColor: "rgb(99, 144, 0)",
174
+ lineWidth: 1,
175
+ lineDash: [ 5, 5 ],
176
+ cornerRadius: 4,
177
+ backgroundColor: "#FFF"
178
+ }, null === (_57 = null === (_56 = null == options ? void 0 : options.taskBar) || void 0 === _56 ? void 0 : _56.scheduleCreation) || void 0 === _57 ? void 0 : _57.buttonStyle),
179
+ gantt.parsedOptions.taskBarCreationCustomLayout = null === (_59 = null === (_58 = null == options ? void 0 : options.taskBar) || void 0 === _58 ? void 0 : _58.scheduleCreation) || void 0 === _59 ? void 0 : _59.customLayout,
180
+ gantt.parsedOptions.taskBarCreationMaxWidth = null === (_61 = null === (_60 = null == options ? void 0 : options.taskBar) || void 0 === _60 ? void 0 : _60.scheduleCreation) || void 0 === _61 ? void 0 : _61.maxWidth,
181
+ gantt.parsedOptions.taskBarCreationMinWidth = null === (_63 = null === (_62 = null == options ? void 0 : options.taskBar) || void 0 === _62 ? void 0 : _62.scheduleCreation) || void 0 === _63 ? void 0 : _63.minWidth,
182
+ gantt.parsedOptions.outerFrameStyle = Object.assign({
183
+ borderColor: "#e1e4e8",
184
+ borderLineWidth: 1,
185
+ cornerRadius: 4
186
+ }, null === (_64 = options.frame) || void 0 === _64 ? void 0 : _64.outerFrameStyle),
187
+ gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine),
188
+ null !== (_66 = null === (_65 = gantt.parsedOptions.markLine) || void 0 === _65 ? void 0 : _65.length) && void 0 !== _66 && _66 && ((null === (_67 = gantt.parsedOptions.markLine) || void 0 === _67 ? void 0 : _67.every((item => void 0 === item.scrollToMarkLine))) && (gantt.parsedOptions.markLine[0].scrollToMarkLine = !0),
189
+ (null === (_68 = gantt.parsedOptions.markLine) || void 0 === _68 ? void 0 : _68.find((item => item.scrollToMarkLine))) && (gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(null === (_69 = gantt.parsedOptions.markLine) || void 0 === _69 ? void 0 : _69.find((item => item.scrollToMarkLine)).date), minTimeUnit, startOfWeek))),
190
+ gantt.parsedOptions.verticalSplitLineHighlight = null === (_70 = options.frame) || void 0 === _70 ? void 0 : _70.verticalSplitLineHighlight,
191
+ gantt.parsedOptions.verticalSplitLine = Object.assign({
192
+ lineColor: null === (_71 = gantt.parsedOptions.outerFrameStyle) || void 0 === _71 ? void 0 : _71.borderColor,
193
+ lineWidth: null === (_72 = gantt.parsedOptions.outerFrameStyle) || void 0 === _72 ? void 0 : _72.borderLineWidth
194
+ }, null === (_73 = options.frame) || void 0 === _73 ? void 0 : _73.verticalSplitLine),
195
+ gantt.parsedOptions.horizontalSplitLine = null === (_74 = options.frame) || void 0 === _74 ? void 0 : _74.horizontalSplitLine,
196
+ gantt.parsedOptions.verticalSplitLineMoveable = null === (_75 = options.frame) || void 0 === _75 ? void 0 : _75.verticalSplitLineMoveable,
197
+ gantt.parsedOptions.taskKeyField = null !== (_76 = options.taskKeyField) && void 0 !== _76 ? _76 : "id",
198
+ gantt.parsedOptions.dependencyLinks = null !== (_78 = null === (_77 = options.dependency) || void 0 === _77 ? void 0 : _77.links) && void 0 !== _78 ? _78 : [],
199
+ gantt.parsedOptions.dependencyLinkCreatable = null !== (_80 = null === (_79 = options.dependency) || void 0 === _79 ? void 0 : _79.linkCreatable) && void 0 !== _80 && _80,
200
+ gantt.parsedOptions.dependencyLinkSelectable = null === (_82 = null === (_81 = options.dependency) || void 0 === _81 ? void 0 : _81.linkSelectable) || void 0 === _82 || _82,
201
+ gantt.parsedOptions.dependencyLinkDeletable = null !== (_84 = null === (_83 = options.dependency) || void 0 === _83 ? void 0 : _83.linkDeletable) && void 0 !== _84 && _84,
202
+ gantt.parsedOptions.dependencyLinkLineStyle = Object.assign({
203
+ lineColor: "red",
204
+ lineWidth: 1
205
+ }, null === (_85 = options.dependency) || void 0 === _85 ? void 0 : _85.linkLineStyle),
206
+ gantt.parsedOptions.dependencyLinkSelectedLineStyle = Object.assign({
207
+ shadowBlur: 4,
208
+ shadowOffset: 0,
209
+ shadowColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
210
+ lineColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
211
+ lineWidth: gantt.parsedOptions.dependencyLinkLineStyle.lineWidth
212
+ }, null === (_86 = null == options ? void 0 : options.dependency) || void 0 === _86 ? void 0 : _86.linkSelectedLineStyle),
213
+ gantt.parsedOptions.dependencyLinkLineCreatePointStyle = Object.assign({
214
+ strokeColor: "red",
215
+ fillColor: "white",
216
+ radius: 5,
217
+ strokeWidth: 1
218
+ }, null === (_87 = null == options ? void 0 : options.dependency) || void 0 === _87 ? void 0 : _87.linkCreatePointStyle),
219
+ gantt.parsedOptions.dependencyLinkLineCreatingPointStyle = Object.assign({
220
+ strokeColor: "red",
221
+ fillColor: "red",
222
+ radius: 5,
223
+ strokeWidth: 1
224
+ }, null === (_88 = null == options ? void 0 : options.dependency) || void 0 === _88 ? void 0 : _88.linkCreatingPointStyle),
225
+ gantt.parsedOptions.dependencyLinkLineCreatingStyle = Object.assign({
226
+ lineColor: "red",
227
+ lineWidth: 1,
228
+ lineDash: [ 5, 5 ]
229
+ }, null === (_89 = null == options ? void 0 : options.dependency) || void 0 === _89 ? void 0 : _89.linkCreatingLineStyle),
230
+ gantt.parsedOptions.dependencyLinkDistanceToTaskBar = null !== (_91 = null === (_90 = null == options ? void 0 : options.dependency) || void 0 === _90 ? void 0 : _90.distanceToTaskBar) && void 0 !== _91 ? _91 : 20,
231
+ gantt.parsedOptions.eventOptions = null == options ? void 0 : options.eventOptions,
232
+ gantt.parsedOptions.keyboardOptions = null == options ? void 0 : options.keyboardOptions,
233
+ gantt.parsedOptions.markLineCreateOptions = null == options ? void 0 : options.markLineCreateOptions;
234
+ }
235
+
236
+ export function updateOptionsWhenScaleChanged(gantt) {
237
+ var _a, _b, _c, _d;
238
+ const options = gantt.options, {unit: minTimeUnit, startOfWeek: startOfWeek, step: step} = gantt.parsedOptions.reverseSortedTimelineScales[0];
239
+ gantt.parsedOptions.minDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.minDate), minTimeUnit, startOfWeek),
240
+ gantt.parsedOptions.maxDate = getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(gantt.parsedOptions.maxDate), minTimeUnit, step),
241
+ gantt.parsedOptions._minDateTime = null === (_a = gantt.parsedOptions.minDate) || void 0 === _a ? void 0 : _a.getTime(),
242
+ gantt.parsedOptions._maxDateTime = null === (_b = gantt.parsedOptions.maxDate) || void 0 === _b ? void 0 : _b.getTime(),
243
+ gantt.parsedOptions.timeLineHeaderRowHeights = [], gantt.parsedOptions.timelineHeaderStyles = [];
244
+ for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length; i++) {
245
+ const style = gantt.parsedOptions.sortedTimelineScales[i].style;
246
+ gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
247
+ fontSize: 20,
248
+ fontWeight: "bold",
249
+ textAlign: "center",
250
+ textBaseline: "middle",
251
+ color: "#000",
252
+ backgroundColor: "#fff"
253
+ }, style)), gantt.parsedOptions.timeLineHeaderRowHeights.push(null !== (_d = null !== (_c = gantt.parsedOptions.sortedTimelineScales[i].rowHeight) && void 0 !== _c ? _c : null == options ? void 0 : options.headerRowHeight) && void 0 !== _d ? _d : 40);
254
+ }
255
+ }
256
+
257
+ export function generateTimeLineDate(currentDate, endDate, scale) {
258
+ var _a;
259
+ const {unit: unit, step: step, format: format} = scale, timelineDates = [];
260
+ for (;currentDate < endDate; ) if ("day" === unit) {
261
+ const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), end = createDateAtLastHour(new Date(year, month, day + step - 1), !0);
262
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
263
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
264
+ dateIndex: day,
265
+ startDate: start,
266
+ endDate: end
267
+ })) || day.toString(), dayCellConfig = {
268
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
269
+ startDate: start,
270
+ endDate: end,
271
+ step: step,
272
+ unit: "day",
273
+ title: columnTitle,
274
+ dateIndex: day
275
+ };
276
+ timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day + step);
277
+ } else if ("month" === unit) {
278
+ const year = currentDate.getFullYear(), month = currentDate.getMonth(), end = createDateAtLastHour(new Date(year, month + step, 0), !0);
279
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
280
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
281
+ dateIndex: month + 1,
282
+ startDate: start,
283
+ endDate: end
284
+ })) || (month + 1).toString(), dayCellConfig = {
285
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
286
+ startDate: start,
287
+ step: step,
288
+ unit: "month",
289
+ endDate: end,
290
+ title: columnTitle,
291
+ dateIndex: month + 1
292
+ };
293
+ timelineDates.push(dayCellConfig), currentDate = new Date(year, month + step, 1);
294
+ } else if ("quarter" === unit) {
295
+ const year = currentDate.getFullYear(), quarter = Math.floor(currentDate.getMonth() / 3), end = createDateAtLastHour(new Date(year, 3 * (quarter + step), 0), !0);
296
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
297
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
298
+ dateIndex: quarter + 1,
299
+ startDate: start,
300
+ endDate: end
301
+ })) || (quarter + 1).toString(), dayCellConfig = {
302
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
303
+ startDate: start,
304
+ step: step,
305
+ unit: "quarter",
306
+ endDate: end,
307
+ title: columnTitle,
308
+ dateIndex: quarter + 1
309
+ };
310
+ timelineDates.push(dayCellConfig), currentDate = new Date(year, 3 * (quarter + step), 1);
311
+ } else if ("year" === unit) {
312
+ const year = currentDate.getFullYear(), end = createDateAtLastHour(new Date(year + step - 1, 11, 31), !0);
313
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
314
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
315
+ dateIndex: year,
316
+ startDate: start,
317
+ endDate: end
318
+ })) || year.toString(), dayCellConfig = {
319
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
320
+ startDate: start,
321
+ endDate: end,
322
+ step: step,
323
+ unit: "year",
324
+ title: columnTitle,
325
+ dateIndex: year
326
+ };
327
+ timelineDates.push(dayCellConfig), currentDate = new Date(year + step, 0, 1);
328
+ } else if ("week" === unit) {
329
+ const startOfWeekSetting = null !== (_a = scale.startOfWeek) && void 0 !== _a ? _a : "monday";
330
+ let dayOfWeek = currentDate.getDay();
331
+ "monday" === startOfWeekSetting && (dayOfWeek = 0 === dayOfWeek ? 6 : dayOfWeek - 1);
332
+ const startOfWeek = createDateAtMidnight(currentDate), dateEnd = createDateAtLastHour(currentDate.getTime() + 24 * (7 * step - dayOfWeek) * 60 * 60 * 1e3 - 1, !0);
333
+ dateEnd > endDate && dateEnd.setTime(endDate.getTime());
334
+ const weekNumber = getWeekNumber(startOfWeek), columnTitle = (null == format ? void 0 : format({
335
+ dateIndex: weekNumber,
336
+ startDate: startOfWeek,
337
+ endDate: dateEnd
338
+ })) || weekNumber.toString(), dayCellConfig = {
339
+ days: (dateEnd.getTime() - startOfWeek.getTime() + 1) / 864e5,
340
+ startDate: startOfWeek,
341
+ endDate: dateEnd,
342
+ step: step,
343
+ unit: "week",
344
+ title: columnTitle,
345
+ dateIndex: weekNumber
346
+ };
347
+ timelineDates.push(dayCellConfig), currentDate.setTime(createDateAtMidnight(currentDate.getTime() + 24 * (7 * step - dayOfWeek) * 60 * 60 * 1e3, !0).getTime());
348
+ } else if ("hour" === unit) {
349
+ const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), hour = currentDate.getHours(), end = createDateAtLastMinute(new Date(year, month, day, hour + step - 1), !0);
350
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
351
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
352
+ dateIndex: hour,
353
+ startDate: start,
354
+ endDate: end
355
+ })) || hour.toString(), dayCellConfig = {
356
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
357
+ startDate: start,
358
+ endDate: end,
359
+ step: step,
360
+ unit: "hour",
361
+ title: columnTitle,
362
+ dateIndex: currentDate.getHours()
363
+ };
364
+ timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day, hour + step);
365
+ } else if ("minute" === unit) {
366
+ const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), hour = currentDate.getHours(), minute = currentDate.getMinutes(), end = createDateAtLastSecond(new Date(year, month, day, hour, minute + step - 1), !0);
367
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
368
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
369
+ dateIndex: minute,
370
+ startDate: start,
371
+ endDate: end
372
+ })) || minute.toString(), dayCellConfig = {
373
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
374
+ startDate: start,
375
+ endDate: end,
376
+ step: step,
377
+ unit: "minute",
378
+ title: columnTitle,
379
+ dateIndex: currentDate.getMinutes()
380
+ };
381
+ timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day, hour, minute + step);
382
+ } else if ("second" === unit) {
383
+ const year = currentDate.getFullYear(), month = currentDate.getMonth(), day = currentDate.getDate(), hour = currentDate.getHours(), minute = currentDate.getMinutes(), second = currentDate.getSeconds(), end = createDateAtLastMillisecond(new Date(year, month, day, hour, minute, second + step - 1), !0);
384
+ end.getTime() > endDate.getTime() && end.setTime(endDate.getTime());
385
+ const start = currentDate, columnTitle = (null == format ? void 0 : format({
386
+ dateIndex: second,
387
+ startDate: start,
388
+ endDate: end
389
+ })) || second.toString(), dayCellConfig = {
390
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / 864e5,
391
+ startDate: start,
392
+ endDate: end,
393
+ step: step,
394
+ unit: "second",
395
+ title: columnTitle,
396
+ dateIndex: currentDate.getSeconds()
397
+ };
398
+ timelineDates.push(dayCellConfig), currentDate = new Date(year, month, day, hour, minute, second + step);
399
+ }
400
+ return timelineDates;
401
+ }
402
+
403
+ export function getTextPos(padding, textAlign, textBaseline, width, height) {
404
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
405
+ let textX = null !== (_a = padding[3]) && void 0 !== _a ? _a : 10;
406
+ "right" === textAlign || "end" === textAlign ? textX = width - 0 - (null !== (_b = padding[1]) && void 0 !== _b ? _b : 10) : "center" === textAlign && (textX = 0 + (width - 0 + (null !== (_c = padding[3]) && void 0 !== _c ? _c : 10) - (null !== (_d = padding[1]) && void 0 !== _d ? _d : 10)) / 2);
407
+ let textY = 0 + (null !== (_e = padding[0]) && void 0 !== _e ? _e : 10);
408
+ return "bottom" === textBaseline || "alphabetic" === textBaseline || "ideographic" === textBaseline ? textY = height - 0 - (null !== (_f = padding[2]) && void 0 !== _f ? _f : 10) : "middle" === textBaseline && (textY = 0 + (height - 0 - (null !== (_g = padding[0]) && void 0 !== _g ? _g : 10) - (null !== (_h = padding[2]) && void 0 !== _h ? _h : 10)) / 2 + (null !== (_j = padding[0]) && void 0 !== _j ? _j : 10)),
409
+ {
410
+ x: textX,
411
+ y: textY
412
+ };
413
+ }
414
+
415
+ export function convertProgress(progress) {
416
+ return "string" == typeof progress && (progress = progress.replace("%", ""), progress = parseFloat(progress)),
417
+ isNaN(progress) ? 0 : Math.max(0, Math.min(100, Math.round(10 * progress) / 10));
418
+ }
419
+
420
+ export function createSplitLineAndResizeLine(gantt) {
421
+ if (gantt.taskListTableInstance) {
422
+ gantt.verticalSplitResizeLine = document.createElement("div"), gantt.verticalSplitResizeLine.style.position = "absolute",
423
+ gantt.verticalSplitResizeLine.style.top = gantt.tableY + "px", gantt.verticalSplitResizeLine.style.left = (-1 !== gantt.taskTableWidth ? gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2 : 0) + "px",
424
+ gantt.verticalSplitResizeLine.style.width = "14px", gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + "px",
425
+ gantt.verticalSplitResizeLine.style.backgroundColor = "rgba(0,0,0,0)", gantt.verticalSplitResizeLine.style.zIndex = "100",
426
+ gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = "col-resize"),
427
+ gantt.verticalSplitResizeLine.style.userSelect = "none", gantt.verticalSplitResizeLine.style.opacity = "1";
428
+ const verticalSplitLine = document.createElement("div");
429
+ if (verticalSplitLine.style.position = "absolute", verticalSplitLine.style.top = "0px",
430
+ verticalSplitLine.style.left = (14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2 + "px",
431
+ verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + "px",
432
+ verticalSplitLine.style.height = "100%", verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor,
433
+ verticalSplitLine.style.zIndex = "100", verticalSplitLine.style.userSelect = "none",
434
+ verticalSplitLine.style.pointerEvents = "none", verticalSplitLine.style.transition = "background-color 0.3s",
435
+ gantt.verticalSplitResizeLine.appendChild(verticalSplitLine), gantt.parsedOptions.verticalSplitLineHighlight) {
436
+ const highlightLine = document.createElement("div");
437
+ highlightLine.style.position = "absolute", highlightLine.style.top = "0px", highlightLine.style.left = (14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth) / 2 + "px",
438
+ highlightLine.style.width = gantt.parsedOptions.verticalSplitLineHighlight.lineWidth + "px",
439
+ highlightLine.style.height = "100%", highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor,
440
+ highlightLine.style.zIndex = "100", highlightLine.style.cursor = "col-resize", highlightLine.style.userSelect = "none",
441
+ highlightLine.style.pointerEvents = "none", highlightLine.style.opacity = "0", highlightLine.style.transition = "background-color 0.3s",
442
+ gantt.verticalSplitResizeLine.appendChild(highlightLine);
443
+ }
444
+ gantt.container.appendChild(gantt.verticalSplitResizeLine);
445
+ }
446
+ }
447
+
448
+ export function updateSplitLineAndResizeLine(gantt) {
449
+ if (gantt.verticalSplitResizeLine) {
450
+ gantt.verticalSplitResizeLine.style.position = "absolute", gantt.verticalSplitResizeLine.style.top = gantt.tableY + "px",
451
+ gantt.verticalSplitResizeLine.style.left = -1 !== gantt.taskTableWidth ? gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2 + "px" : "0px",
452
+ gantt.verticalSplitResizeLine.style.width = "14px", gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + "px",
453
+ gantt.verticalSplitResizeLine.style.backgroundColor = "rgba(0,0,0,0)", gantt.verticalSplitResizeLine.style.zIndex = "100",
454
+ gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = "col-resize"),
455
+ gantt.verticalSplitResizeLine.style.userSelect = "none", gantt.verticalSplitResizeLine.style.opacity = "1";
456
+ const verticalSplitLine = gantt.verticalSplitResizeLine.childNodes[0];
457
+ if (verticalSplitLine.style.position = "absolute", verticalSplitLine.style.top = "0px",
458
+ verticalSplitLine.style.left = (14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2 + "px",
459
+ verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + "px",
460
+ verticalSplitLine.style.height = "100%", verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor,
461
+ verticalSplitLine.style.zIndex = "100", verticalSplitLine.style.userSelect = "none",
462
+ verticalSplitLine.style.pointerEvents = "none", verticalSplitLine.style.transition = "background-color 0.3s",
463
+ gantt.verticalSplitResizeLine.childNodes[1]) {
464
+ const highlightLine = gantt.verticalSplitResizeLine.childNodes[1];
465
+ highlightLine.style.position = "absolute", highlightLine.style.top = "0px", highlightLine.style.left = (14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth) / 2 + "px",
466
+ highlightLine.style.width = gantt.parsedOptions.verticalSplitLineHighlight.lineWidth + "px",
467
+ highlightLine.style.height = "100%", highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor,
468
+ highlightLine.style.zIndex = "100", highlightLine.style.cursor = "col-resize", highlightLine.style.userSelect = "none",
469
+ highlightLine.style.pointerEvents = "none", highlightLine.style.opacity = "0", highlightLine.style.transition = "background-color 0.3s";
470
+ }
471
+ }
472
+ }
473
+
474
+ export function findRecordByTaskKey(records, taskKeyField, taskKey, childrenField = "children") {
475
+ var _a;
476
+ for (let i = 0; i < records.length; i++) {
477
+ if (Array.isArray(taskKey) && 1 === taskKey.length && records[i][taskKeyField] === taskKey[0] || records[i][taskKeyField] === taskKey) return {
478
+ record: records[i],
479
+ index: [ i ]
480
+ };
481
+ if (null === (_a = records[i][childrenField]) || void 0 === _a ? void 0 : _a.length) if (Array.isArray(taskKey) && taskKey[0] === records[i][taskKeyField]) {
482
+ const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey.slice(1));
483
+ if (result) return result.index.unshift(i), result;
484
+ } else if (!Array.isArray(taskKey)) {
485
+ const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey);
486
+ if (result) return result.index.unshift(i), result;
487
+ }
488
+ }
489
+ }
490
+
491
+ export function clearRecordLinkInfos(records, childrenField = "children") {
492
+ var _a;
493
+ for (let i = 0; i < records.length; i++) (null === (_a = records[i][childrenField]) || void 0 === _a ? void 0 : _a.length) ? clearRecordLinkInfos(records[i][childrenField], childrenField) : (delete records[i].vtable_gantt_linkedTo,
494
+ delete records[i].vtable_gantt_linkedFrom);
495
+ }
496
+
497
+ export function clearRecordShowIndex(records, childrenField = "children") {
498
+ var _a;
499
+ for (let i = 0; i < records.length; i++) (null === (_a = records[i][childrenField]) || void 0 === _a ? void 0 : _a.length) ? clearRecordShowIndex(records[i][childrenField], childrenField) : delete records[i].vtable_gantt_showIndex;
500
+ }
501
+
502
+ export function getTaskIndexsByTaskY(y, gantt) {
503
+ var _a;
504
+ let task_index, sub_task_index;
505
+ if (gantt.taskListTableInstance) {
506
+ const rowInfo = gantt.taskListTableInstance.getTargetRowAt(y + gantt.headerHeight);
507
+ if (rowInfo) {
508
+ const {row: row} = rowInfo;
509
+ task_index = row - gantt.taskListTableInstance.columnHeaderLevelCount;
510
+ const beforeRowsHeight = gantt.getRowsHeightByIndex(0, task_index - 1);
511
+ if (gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline || gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange || gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact || gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate) sub_task_index = Math.floor((y - beforeRowsHeight) / gantt.parsedOptions.rowHeight); else if (gantt.parsedOptions.tasksShowMode === TasksShowMode.Project_Sub_Tasks_Inline) {
512
+ const record = gantt.getRecordByIndex(task_index);
513
+ if (record && record.type === TaskType.PROJECT && (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) > 0) {
514
+ "expand" === record.hierarchyState || !1 === gantt.parsedOptions.projectSubTasksExpandable || (sub_task_index = Math.floor((y - beforeRowsHeight) / gantt.parsedOptions.rowHeight));
515
+ }
516
+ }
517
+ }
518
+ } else task_index = Math.floor(y / gantt.parsedOptions.rowHeight);
519
+ return {
520
+ task_index: task_index,
521
+ sub_task_index: sub_task_index
522
+ };
523
+ }
524
+
525
+ export function computeRowsCountByRecordDateForCompact(gantt, record) {
526
+ var _a;
527
+ if (!record.children || record.children.length <= 1) return 1 === (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) ? record.children[0].vtable_gantt_showIndex = 0 : record.vtable_gantt_showIndex = 0,
528
+ 1;
529
+ const sortedChildren = record.children.slice().sort(((a, b) => {
530
+ const {startDate: aStartDate} = formatRecordDateConsiderHasHour(gantt, a), {startDate: bStartDate} = formatRecordDateConsiderHasHour(gantt, b);
531
+ return aStartDate.getTime() - bStartDate.getTime();
532
+ })), rows = [];
533
+ for (let i = 0; i <= sortedChildren.length - 1; i++) {
534
+ const newRecord = sortedChildren[i], {startDate: startDate, endDate: endDate} = formatRecordDateConsiderHasHour(gantt, newRecord);
535
+ let placed = !1;
536
+ for (let j = 0; j < rows.length; j++) if (startDate.getTime() > rows[j]) {
537
+ rows[j] = endDate.getTime(), placed = !0, newRecord.vtable_gantt_showIndex = j;
538
+ break;
539
+ }
540
+ placed || (rows.push(endDate.getTime()), newRecord.vtable_gantt_showIndex = rows.length - 1);
541
+ }
542
+ return rows.length;
543
+ }
544
+
545
+ function isOverlapping(startDate, endDate, rowTasks, gantt) {
546
+ return rowTasks.some((rowTask => {
547
+ const {startDate: startDate2, endDate: endDate2} = formatRecordDateConsiderHasHour(gantt, rowTask);
548
+ return startDate <= endDate2 && startDate2 <= endDate;
549
+ }));
550
+ }
551
+
552
+ export function computeRowsCountByRecordDate(gantt, record) {
553
+ var _a;
554
+ if (!record.children || record.children.length <= 1) return 1 === (null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) ? record.children[0].vtable_gantt_showIndex = 0 : record.vtable_gantt_showIndex = 0,
555
+ 1;
556
+ const rows = [];
557
+ for (let i = 0; i <= record.children.length - 1; i++) {
558
+ const newRecord = record.children[i], {startDate: startDate, endDate: endDate} = formatRecordDateConsiderHasHour(gantt, newRecord);
559
+ let placed = !1;
560
+ for (let j = 0; j < rows.length; j++) {
561
+ if (!isOverlapping(startDate, endDate, record.children.filter((t => t !== newRecord && t.vtable_gantt_showIndex === j)), gantt)) {
562
+ rows[j] = endDate.getTime(), placed = !0, newRecord.vtable_gantt_showIndex = j;
563
+ break;
564
+ }
565
+ }
566
+ placed || (rows.push(endDate.getTime()), newRecord.vtable_gantt_showIndex = rows.length - 1);
567
+ }
568
+ return rows.length;
569
+ }
570
+
571
+ export function getSubTaskRowIndexByRecordDate(record, childIndex, startDateField, endDateField) {
572
+ if (0 === childIndex) return 0;
573
+ const rows = [];
574
+ if (null == record ? void 0 : record.children) for (let i = 0; i <= record.children.length - 1; i++) {
575
+ const newRecord = record.children[i], startDate = createDateAtMidnight(newRecord[startDateField]).getTime(), endDate = createDateAtMidnight(newRecord[endDateField]).getTime();
576
+ let placed = !1;
577
+ for (let j = 0; j < rows.length; j++) if (startDate > rows[j]) {
578
+ if (rows[j] = endDate, placed = !0, i === childIndex) return j;
579
+ break;
580
+ }
581
+ if (placed || rows.push(endDate), i === childIndex) return rows.length - 1;
582
+ }
583
+ return 0;
584
+ }
585
+
586
+ export function formatRecordDateConsiderHasHour(gantt, record) {
587
+ const {timeScaleIncludeHour: timeScaleIncludeHour, startDateField: startDateField, endDateField: endDateField} = gantt.parsedOptions, startDate = record[startDateField], endDate = record[endDateField];
588
+ return timeScaleIncludeHour ? {
589
+ startDate: createDateAtMidnight(startDate),
590
+ endDate: createDateAtLastHour(endDate)
591
+ } : {
592
+ startDate: createDateAtMidnight(startDate, !0),
593
+ endDate: createDateAtLastHour(endDate, !0)
594
+ };
595
+ }
596
+
597
+ export function updateOptionsWhenRecordChanged(gantt) {
598
+ var _a, _b, _c, _d, _e, _f, _g;
599
+ const options = gantt.options, {unit: minTimeUnit, startOfWeek: startOfWeek} = gantt.parsedOptions.reverseSortedTimelineScales[0];
600
+ gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine),
601
+ null !== (_b = null === (_a = gantt.parsedOptions.markLine) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b && _b && ((null === (_c = gantt.parsedOptions.markLine) || void 0 === _c ? void 0 : _c.every((item => void 0 === item.scrollToMarkLine))) && (gantt.parsedOptions.markLine[0].scrollToMarkLine = !0),
602
+ (null === (_d = gantt.parsedOptions.markLine) || void 0 === _d ? void 0 : _d.find((item => item.scrollToMarkLine))) && (gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(null === (_e = gantt.parsedOptions.markLine) || void 0 === _e ? void 0 : _e.find((item => item.scrollToMarkLine)).date), minTimeUnit, startOfWeek))),
603
+ gantt.parsedOptions.dependencyLinks = null !== (_g = null === (_f = options.dependency) || void 0 === _f ? void 0 : _f.links) && void 0 !== _g ? _g : [];
604
+ }
605
+
606
+ export function updateOptionsWhenDateRangeChanged(gantt) {
607
+ var _a, _b;
608
+ const options = gantt.options, {unit: minTimeUnit, startOfWeek: startOfWeek, step: step} = gantt.parsedOptions.reverseSortedTimelineScales[0];
609
+ gantt.parsedOptions.minDate = (null == options ? void 0 : options.minDate) ? getStartDateByTimeUnit(new Date(options.minDate), minTimeUnit, startOfWeek) : void 0,
610
+ gantt.parsedOptions.maxDate = (null == options ? void 0 : options.maxDate) ? getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(options.maxDate), minTimeUnit, step) : void 0,
611
+ gantt.parsedOptions._minDateTime = null === (_a = gantt.parsedOptions.minDate) || void 0 === _a ? void 0 : _a.getTime(),
612
+ gantt.parsedOptions._maxDateTime = null === (_b = gantt.parsedOptions.maxDate) || void 0 === _b ? void 0 : _b.getTime();
613
+ }
614
+
615
+ export function updateOptionsWhenMarkLineChanged(gantt) {
616
+ const options = gantt.options;
617
+ gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine);
618
+ }
619
+
620
+ export function _getTaskInfoByXYForCreateSchedule(eventX, eventY, gantt) {
621
+ const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt), recordParent = gantt.getRecordByIndex(taskIndex.task_index), dateIndex = getDateIndexByX(eventX, gantt), dateRange = gantt.getDateRangeByIndex(dateIndex);
622
+ if (null == recordParent ? void 0 : recordParent.children) {
623
+ const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt);
624
+ for (let i = 0; i < recordParent.children.length; i++) {
625
+ const {startDate: startDate, endDate: endDate, taskDays: taskDays, progress: progress, taskRecord: taskRecord} = gantt.getTaskInfoByTaskListIndex(taskIndex.task_index, i);
626
+ if (((gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact || gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange) && taskRecord.vtable_gantt_showIndex === taskIndex.sub_task_index || gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline || gantt.parsedOptions.tasksShowMode === TasksShowMode.Project_Sub_Tasks_Inline && recordParent.type === TaskType.PROJECT && "expand" !== recordParent.hierarchyState && !1 !== gantt.parsedOptions.projectSubTasksExpandable) && startDate && endDate && dateRange.startDate.getTime() >= startDate.getTime() && dateRange.endDate.getTime() <= endDate.getTime()) return {
627
+ startDate: startDate,
628
+ endDate: endDate,
629
+ taskDays: taskDays,
630
+ progress: progress,
631
+ taskRecord: taskRecord
632
+ };
633
+ }
634
+ }
635
+ }
636
+
637
+ export function getNodeClickPos(marklineIconNode, gantt) {
638
+ return {
639
+ left: marklineIconNode.globalTransMatrix.e + gantt.taskListTableInstance.tableNoFrameWidth + gantt.taskListTableInstance.tableX + gantt.tableX,
640
+ top: marklineIconNode.globalTransMatrix.f,
641
+ width: marklineIconNode.attribute.width,
642
+ height: marklineIconNode.attribute.height
643
+ };
644
+ }
645
+
646
+ export function judgeIfHasMarkLine(data, markLine) {
647
+ const beginTime = data.startDate.getTime(), endTime = data.endDate.getTime();
648
+ return markLine.some((item => {
649
+ const marklineTime = new Date(item.date).getTime();
650
+ return marklineTime >= beginTime && marklineTime <= endTime;
651
+ }));
652
+ }
653
+
654
+ export function checkHasChildTasks(gantt, taskIndex, subTaskIndex) {
655
+ const taskRecord = gantt.getRecordByIndex(taskIndex, subTaskIndex);
656
+ return !!((null == taskRecord ? void 0 : taskRecord.children) && taskRecord.children.length > 0);
657
+ }
658
+
659
+ export function initProjectTaskTimes(gantt) {
660
+ if (!gantt.records || 0 === gantt.records.length) return;
661
+ const startDateField = gantt.parsedOptions.startDateField, endDateField = gantt.parsedOptions.endDateField, processTasksRecursively = (records, parentIndex, parentArray) => {
662
+ let earliestStartAll = null, latestEndAll = null;
663
+ return records.forEach(((record, index) => {
664
+ var _a;
665
+ if (!record) return;
666
+ let earliestStart = null, latestEnd = null;
667
+ if (record.children && record.children.length > 0 && record.type === TaskType.PROJECT) {
668
+ const [childrenEarliestStart, childrenLatestEnd] = processTasksRecursively(record.children, index, records);
669
+ if (childrenEarliestStart && childrenLatestEnd && (earliestStart = childrenEarliestStart,
670
+ latestEnd = childrenLatestEnd, record.type === TaskType.PROJECT)) {
671
+ const dateFormat = null !== (_a = gantt.parsedOptions.dateFormat) && void 0 !== _a ? _a : gantt.parseTimeFormat(record[startDateField] || record.children[0][startDateField] || ""), formatDateValue = date => gantt.formatDate ? gantt.formatDate(date, dateFormat) : date.toISOString().split("T")[0], updatedRecord = Object.assign({}, record);
672
+ updatedRecord[startDateField] = formatDateValue(earliestStart), updatedRecord[endDateField] = formatDateValue(latestEnd),
673
+ records[index] = updatedRecord;
674
+ }
675
+ } else record[startDateField] && record[endDateField] && (earliestStart = new Date(record[startDateField]),
676
+ latestEnd = new Date(record[endDateField]));
677
+ earliestStart && (!earliestStartAll || earliestStart < earliestStartAll) && (earliestStartAll = earliestStart),
678
+ latestEnd && (!latestEndAll || latestEnd > latestEndAll) && (latestEndAll = latestEnd);
679
+ })), [ earliestStartAll, latestEndAll ];
680
+ };
681
+ processTasksRecursively(gantt.records);
682
+ }
683
+ //# sourceMappingURL=gantt-helper.js.map