@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
package/es/Gantt.js ADDED
@@ -0,0 +1,584 @@
1
+ import { Scenegraph } from "./scenegraph/scenegraph";
2
+
3
+ import { Env } from "./env";
4
+
5
+ import { TasksShowMode, TaskType, GANTT_EVENT_TYPE } from "./ts-types";
6
+
7
+ import { themes, ListTable } from "@visactor/vtable";
8
+
9
+ import { EventManager } from "./event/event-manager";
10
+
11
+ import { StateManager } from "./state/state-manager";
12
+
13
+ import { computeRowsCountByRecordDate, computeRowsCountByRecordDateForCompact, convertProgress, createSplitLineAndResizeLine, generateTimeLineDate, getHorizontalScrollBarSize, getVerticalScrollBarSize, initOptions, initProjectTaskTimes, updateOptionsWhenDateRangeChanged, updateOptionsWhenMarkLineChanged, updateOptionsWhenRecordChanged, updateOptionsWhenScaleChanged, updateSplitLineAndResizeLine } from "./gantt-helper";
14
+
15
+ import { EventTarget } from "./event/EventTarget";
16
+
17
+ import { computeCountToTimeScale, createDateAtLastHour, createDateAtLastMillisecond, createDateAtMidnight, formatDate, isPropertyWritable, parseDateFormat } from "./tools/util";
18
+
19
+ import { DataSource } from "./data/DataSource";
20
+
21
+ import { isValid } from "@visactor/vutils";
22
+
23
+ import { PluginManager } from "./plugins/plugin-manager";
24
+
25
+ import { toBoxArray } from "@visactor/vtable";
26
+
27
+ import { ZoomScaleManager } from "./zoom-scale";
28
+
29
+ export function createRootElement(padding, className = "vtable-gantt") {
30
+ var _a, _b;
31
+ const element = document.createElement("div");
32
+ element.setAttribute("tabindex", "0"), element.classList.add(className), element.style.outline = "none",
33
+ element.style.margin = `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px`;
34
+ const width = (element.offsetWidth || (null === (_a = element.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) || 1) - 1, height = (element.offsetHeight || (null === (_b = element.parentElement) || void 0 === _b ? void 0 : _b.offsetHeight) || 1) - 1;
35
+ return element.style.width = width && width - padding.left - padding.right + "px" || "0px",
36
+ element.style.height = height && height - padding.top - padding.bottom + "px" || "0px",
37
+ element;
38
+ }
39
+
40
+ export class Gantt extends EventTarget {
41
+ recalculateTimeScale() {
42
+ this.zoomScaleManager && this.zoomScaleManager.recalculateTimeScale();
43
+ }
44
+ zoomByFactor(factor, keepCenter = !0, centerX) {
45
+ this.zoomScaleManager && this.zoomScaleManager.zoomByFactor(factor, keepCenter, centerX);
46
+ }
47
+ constructor(container, options) {
48
+ var _a, _b, _c, _d, _e, _f;
49
+ super(), this.parsedOptions = {}, this.container = container, this.options = options,
50
+ this.taskTableWidth = "number" == typeof (null === (_a = null == options ? void 0 : options.taskListTable) || void 0 === _a ? void 0 : _a.tableWidth) ? null === (_b = null == options ? void 0 : options.taskListTable) || void 0 === _b ? void 0 : _b.tableWidth : -1,
51
+ this.taskTableColumns = null !== (_d = null === (_c = null == options ? void 0 : options.taskListTable) || void 0 === _c ? void 0 : _c.columns) && void 0 !== _d ? _d : [],
52
+ this.records = null !== (_e = null == options ? void 0 : options.records) && void 0 !== _e ? _e : [],
53
+ (null === (_f = options.timelineHeader) || void 0 === _f ? void 0 : _f.zoomScale) && !1 !== options.timelineHeader.zoomScale.enabled && (this.zoomScaleManager = new ZoomScaleManager(this, options.timelineHeader.zoomScale)),
54
+ this._sortScales(), initOptions(this), this.zoomScaleManager ? this.millisecondsPerPixel = this.zoomScaleManager.getInitialMillisecondsPerPixel() : this.millisecondsPerPixel = 144e4,
55
+ initProjectTaskTimes(this), this.data = new DataSource(this), this._generateTimeLineDateMap(),
56
+ this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length, this.element = createRootElement({
57
+ top: 0,
58
+ right: 0,
59
+ left: 0,
60
+ bottom: 0
61
+ }, "vtable-gantt"), this.element.style.left = -1 !== this.taskTableWidth ? `${this.taskTableWidth}px` : "0px",
62
+ this.canvas = document.createElement("canvas"), this.element.appendChild(this.canvas),
63
+ this.context = this.canvas.getContext("2d"), container ? (container.appendChild(this.element),
64
+ this._updateSize()) : this._updateSize(), this._generateListTable(), this._syncPropsFromTable(),
65
+ createSplitLineAndResizeLine(this), this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
66
+ this.eventManager = new EventManager(this), this.scenegraph.afterCreateSceneGraph(),
67
+ this._scrollToMarkLine(), this.pluginManager = new PluginManager(this, options),
68
+ this.recalculateTimeScale();
69
+ }
70
+ renderTaskBarsTable() {
71
+ this.scenegraph.updateNextFrame();
72
+ }
73
+ _updateSize() {
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
+ let widthP = 0, heightP = 0;
76
+ if ("browser" === Env.mode) {
77
+ const element = this.getElement();
78
+ let widthWithoutPadding = 0, heightWithoutPadding = 0;
79
+ if (element.parentElement) {
80
+ const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
81
+ widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10),
82
+ heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20);
83
+ }
84
+ const width1 = (null != widthWithoutPadding ? widthWithoutPadding : 1) - 1 - this.taskTableWidth, height1 = (null != heightWithoutPadding ? heightWithoutPadding : 1) - 1 - this.getDataZoomHeight();
85
+ element.style.width = width1 && `${width1}px` || "0px", element.style.height = height1 && `${height1}px` || "0px";
86
+ const {canvas: canvas} = this;
87
+ widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 1,
88
+ heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 1,
89
+ (null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
90
+ canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
91
+ canvas.style.height = `${heightP}px`);
92
+ } else Env.mode;
93
+ const width = Math.floor(widthP - getVerticalScrollBarSize(this.parsedOptions.scrollStyle)), height = Math.floor(heightP - getHorizontalScrollBarSize(this.parsedOptions.scrollStyle));
94
+ if (this.tableNoFrameWidth = widthP, this.tableNoFrameHeight = Math.floor(heightP),
95
+ this.parsedOptions.outerFrameStyle) {
96
+ const [top, right, bottom, left] = toBoxArray(null !== (_g = null === (_f = this.parsedOptions.outerFrameStyle) || void 0 === _f ? void 0 : _f.borderLineWidth) && void 0 !== _g ? _g : 0);
97
+ this.tableX = this.taskTableColumns.length >= 1 || (null === (_h = this.options) || void 0 === _h ? void 0 : _h.rowSeriesNumber) ? null !== (_j = this.parsedOptions.verticalSplitLine.lineWidth) && void 0 !== _j ? _j : 0 : left,
98
+ this.tableY = top, this.tableNoFrameWidth = Math.min(width - right - this.tableX, this.getAllDateColsWidth()),
99
+ this.tableNoFrameHeight = height - top - bottom;
100
+ }
101
+ }
102
+ _updateListTableSize(taskListTableInstance) {
103
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
104
+ if (taskListTableInstance) {
105
+ if ("auto" === (null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.taskListTable) || void 0 === _b ? void 0 : _b.tableWidth) || -1 === this.taskTableWidth) {
106
+ const [top, right, bottom, left] = toBoxArray(null !== (_d = null === (_c = this.parsedOptions.outerFrameStyle) || void 0 === _c ? void 0 : _c.borderLineWidth) && void 0 !== _d ? _d : 0);
107
+ this.taskTableWidth = taskListTableInstance.getAllColsWidth() + right, (null === (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.taskListTable) || void 0 === _f ? void 0 : _f.maxTableWidth) && (this.taskTableWidth = Math.min(null === (_h = null === (_g = this.options) || void 0 === _g ? void 0 : _g.taskListTable) || void 0 === _h ? void 0 : _h.maxTableWidth, this.taskTableWidth)),
108
+ (null === (_k = null === (_j = this.options) || void 0 === _j ? void 0 : _j.taskListTable) || void 0 === _k ? void 0 : _k.minTableWidth) && (this.taskTableWidth = Math.max(null === (_m = null === (_l = this.options) || void 0 === _l ? void 0 : _l.taskListTable) || void 0 === _m ? void 0 : _m.minTableWidth, this.taskTableWidth)),
109
+ this.element.style.left = -1 !== this.taskTableWidth ? `${this.taskTableWidth}px` : "0px",
110
+ taskListTableInstance.setCanvasSize(this.taskTableWidth, this.tableNoFrameHeight + top + bottom),
111
+ this._updateSize();
112
+ }
113
+ if (taskListTableInstance.columnHeaderLevelCount > 1) if (taskListTableInstance.columnHeaderLevelCount === this.parsedOptions.timeLineHeaderRowHeights.length) for (let i = 0; i < taskListTableInstance.columnHeaderLevelCount; i++) taskListTableInstance.setRowHeight(i, this.parsedOptions.timeLineHeaderRowHeights[i]); else {
114
+ const newRowHeight = this.getAllHeaderRowsHeight() / taskListTableInstance.columnHeaderLevelCount;
115
+ for (let i = 0; i < taskListTableInstance.columnHeaderLevelCount; i++) taskListTableInstance.setRowHeight(i, newRowHeight);
116
+ }
117
+ }
118
+ }
119
+ _generateListTable() {
120
+ var _a;
121
+ if (this.taskTableColumns.length >= 1 || (null === (_a = this.options) || void 0 === _a ? void 0 : _a.rowSeriesNumber)) {
122
+ const listTableOption = this._generateListTableOptions();
123
+ this.taskListTableInstance = new ListTable(this.container, listTableOption), this._updateListTableSize(this.taskListTableInstance);
124
+ }
125
+ }
126
+ _generateListTableOptions() {
127
+ 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;
128
+ const listTable_options = {}, needPutInListTableKeys = [ "container", "records", "rowSeriesNumber", "overscrollBehavior", "pixelRatio", "eventOptions" ];
129
+ for (const key of needPutInListTableKeys) key in this.options && (listTable_options[key] = this.options[key]);
130
+ if (listTable_options.defaultRowHeight = this.options.rowHeight, this.options.taskListTable) for (const key in this.options.taskListTable) {
131
+ if (listTable_options[key] = this.options.taskListTable[key], "columns" === key && (listTable_options[key][listTable_options[key].length - 1].disableColumnResize = !0,
132
+ this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline || this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate || this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange || this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact)) for (let i = 0; i < listTable_options.columns.length; i++) listTable_options.columns[i].tree && (listTable_options.columns[i].tree = !1);
133
+ "hierarchyExpandLevel" !== key || this.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Inline && this.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Separate && this.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Arrange && this.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Compact || delete listTable_options[key];
134
+ }
135
+ if (null === (_a = this.options.taskListTable) || void 0 === _a ? void 0 : _a.theme) if (listTable_options.theme = null === (_b = this.options.taskListTable) || void 0 === _b ? void 0 : _b.theme,
136
+ listTable_options.theme.bodyStyle && !isPropertyWritable(listTable_options.theme, "bodyStyle")) {
137
+ listTable_options.theme = (null === (_c = this.options.taskListTable) || void 0 === _c ? void 0 : _c.theme).extends((null === (_d = this.options.taskListTable) || void 0 === _d ? void 0 : _d.theme).getExtendTheme());
138
+ const extendThemeOption = listTable_options.theme.getExtendTheme();
139
+ listTable_options.theme.clearBodyStyleCache(), (null === (_e = listTable_options.theme.headerStyle) || void 0 === _e ? void 0 : _e.bgColor) || (extendThemeOption.headerStyle ? extendThemeOption.headerStyle.bgColor || (extendThemeOption.headerStyle.bgColor = this.parsedOptions.timelineHeaderBackgroundColor) : extendThemeOption.headerStyle = {
140
+ bgColor: this.parsedOptions.timelineHeaderBackgroundColor
141
+ }), extendThemeOption.bodyStyle ? extendThemeOption.bodyStyle.frameStyle = {
142
+ borderLineWidth: [ null !== (_g = null === (_f = this.parsedOptions.horizontalSplitLine) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 0, 0, 0, 0 ],
143
+ borderColor: null === (_h = this.parsedOptions.horizontalSplitLine) || void 0 === _h ? void 0 : _h.lineColor
144
+ } : extendThemeOption.bodyStyle = {
145
+ frameStyle: {
146
+ borderLineWidth: [ null !== (_k = null === (_j = this.parsedOptions.horizontalSplitLine) || void 0 === _j ? void 0 : _j.lineWidth) && void 0 !== _k ? _k : 0, 0, 0, 0 ],
147
+ borderColor: null === (_l = this.parsedOptions.horizontalSplitLine) || void 0 === _l ? void 0 : _l.lineColor
148
+ }
149
+ }, extendThemeOption.cellInnerBorder = !1;
150
+ const [top, right, bottom, left] = toBoxArray(null !== (_o = null === (_m = this.parsedOptions.outerFrameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : 0);
151
+ extendThemeOption.frameStyle = Object.assign({}, this.parsedOptions.outerFrameStyle, {
152
+ shadowBlur: 0,
153
+ cornerRadius: [ null !== (_q = null === (_p = this.parsedOptions.outerFrameStyle) || void 0 === _p ? void 0 : _p.cornerRadius) && void 0 !== _q ? _q : 0, 0, 0, null !== (_s = null === (_r = this.parsedOptions.outerFrameStyle) || void 0 === _r ? void 0 : _r.cornerRadius) && void 0 !== _s ? _s : 0 ],
154
+ borderLineWidth: [ top, 0, bottom, left ]
155
+ }), extendThemeOption.scrollStyle = Object.assign({}, null === (_u = null === (_t = this.options.taskListTable) || void 0 === _t ? void 0 : _t.theme) || void 0 === _u ? void 0 : _u.scrollStyle, this.parsedOptions.scrollStyle, {
156
+ verticalVisible: "none"
157
+ }), extendThemeOption.columnResize = Object.assign({
158
+ labelColor: "rgba(0,0,0,0)",
159
+ labelBackgroundFill: "rgba(0,0,0,0)"
160
+ }, null == extendThemeOption ? void 0 : extendThemeOption.columnResize), extendThemeOption.underlayBackgroundColor || (extendThemeOption.underlayBackgroundColor = this.parsedOptions.underlayBackgroundColor);
161
+ } else {
162
+ listTable_options.theme.headerStyle ? listTable_options.theme.headerStyle.bgColor || (listTable_options.theme.headerStyle.bgColor = this.parsedOptions.timelineHeaderBackgroundColor) : listTable_options.theme.headerStyle = {
163
+ bgColor: this.parsedOptions.timelineHeaderBackgroundColor
164
+ }, listTable_options.theme.headerStyle = Object.assign({}, themes.DEFAULT.headerStyle, {
165
+ bgColor: this.parsedOptions.timelineHeaderBackgroundColor
166
+ }, null === (_w = null === (_v = this.options.taskListTable) || void 0 === _v ? void 0 : _v.theme) || void 0 === _w ? void 0 : _w.headerStyle),
167
+ listTable_options.theme.bodyStyle = Object.assign({}, themes.DEFAULT.bodyStyle, null === (_y = null === (_x = this.options.taskListTable) || void 0 === _x ? void 0 : _x.theme) || void 0 === _y ? void 0 : _y.bodyStyle, {
168
+ frameStyle: {
169
+ borderLineWidth: [ null !== (_0 = null === (_z = this.parsedOptions.horizontalSplitLine) || void 0 === _z ? void 0 : _z.lineWidth) && void 0 !== _0 ? _0 : 0, 0, 0, 0 ],
170
+ borderColor: null === (_1 = this.parsedOptions.horizontalSplitLine) || void 0 === _1 ? void 0 : _1.lineColor
171
+ }
172
+ }), listTable_options.theme.cellInnerBorder = !1;
173
+ const [top, right, bottom, left] = toBoxArray(null !== (_3 = null === (_2 = this.parsedOptions.outerFrameStyle) || void 0 === _2 ? void 0 : _2.borderLineWidth) && void 0 !== _3 ? _3 : 0);
174
+ listTable_options.theme.frameStyle = Object.assign({}, this.parsedOptions.outerFrameStyle, {
175
+ cornerRadius: [ null !== (_5 = null === (_4 = this.parsedOptions.outerFrameStyle) || void 0 === _4 ? void 0 : _4.cornerRadius) && void 0 !== _5 ? _5 : 0, 0, 0, null !== (_7 = null === (_6 = this.parsedOptions.outerFrameStyle) || void 0 === _6 ? void 0 : _6.cornerRadius) && void 0 !== _7 ? _7 : 0 ],
176
+ borderLineWidth: [ top, 0, bottom, left ]
177
+ }), listTable_options.theme.scrollStyle = Object.assign({}, null === (_9 = null === (_8 = this.options.taskListTable) || void 0 === _8 ? void 0 : _8.theme) || void 0 === _9 ? void 0 : _9.scrollStyle, this.parsedOptions.scrollStyle, {
178
+ verticalVisible: "none"
179
+ }), listTable_options.theme.columnResize = Object.assign({
180
+ labelColor: "rgba(0,0,0,0)",
181
+ labelBackgroundFill: "rgba(0,0,0,0)"
182
+ }, null === (_11 = null === (_10 = this.options.taskListTable) || void 0 === _10 ? void 0 : _10.theme) || void 0 === _11 ? void 0 : _11.columnResize),
183
+ listTable_options.theme.underlayBackgroundColor || (listTable_options.theme.underlayBackgroundColor = this.parsedOptions.underlayBackgroundColor);
184
+ } else {
185
+ const [top, right, bottom, left] = toBoxArray(null !== (_13 = null === (_12 = this.parsedOptions.outerFrameStyle) || void 0 === _12 ? void 0 : _12.borderLineWidth) && void 0 !== _13 ? _13 : 0);
186
+ listTable_options.theme = {
187
+ scrollStyle: Object.assign({}, null === (_15 = null === (_14 = this.options.taskListTable) || void 0 === _14 ? void 0 : _14.theme) || void 0 === _15 ? void 0 : _15.scrollStyle, this.parsedOptions.scrollStyle, {
188
+ verticalVisible: "none"
189
+ }),
190
+ headerStyle: Object.assign({}, themes.DEFAULT.headerStyle, {
191
+ bgColor: this.parsedOptions.timelineHeaderBackgroundColor
192
+ }, null === (_17 = null === (_16 = this.options.taskListTable) || void 0 === _16 ? void 0 : _16.theme) || void 0 === _17 ? void 0 : _17.headerStyle),
193
+ bodyStyle: Object.assign({}, themes.DEFAULT.bodyStyle, null === (_19 = null === (_18 = this.options.taskListTable) || void 0 === _18 ? void 0 : _18.theme) || void 0 === _19 ? void 0 : _19.bodyStyle, {
194
+ frameStyle: {
195
+ borderLineWidth: [ null !== (_21 = null === (_20 = this.parsedOptions.horizontalSplitLine) || void 0 === _20 ? void 0 : _20.lineWidth) && void 0 !== _21 ? _21 : 0, 0, 0, 0 ],
196
+ borderColor: null === (_22 = this.parsedOptions.horizontalSplitLine) || void 0 === _22 ? void 0 : _22.lineColor
197
+ }
198
+ }),
199
+ cellInnerBorder: !1,
200
+ frameStyle: Object.assign({}, this.parsedOptions.outerFrameStyle, {
201
+ cornerRadius: [ null !== (_24 = null === (_23 = this.parsedOptions.outerFrameStyle) || void 0 === _23 ? void 0 : _23.cornerRadius) && void 0 !== _24 ? _24 : 0, 0, 0, null !== (_26 = null === (_25 = this.parsedOptions.outerFrameStyle) || void 0 === _25 ? void 0 : _25.cornerRadius) && void 0 !== _26 ? _26 : 0 ],
202
+ borderLineWidth: [ top, 0, bottom, left ]
203
+ }),
204
+ columnResize: Object.assign({
205
+ labelColor: "rgba(0,0,0,0)",
206
+ labelBackgroundFill: "rgba(0,0,0,0)"
207
+ }, null === (_28 = null === (_27 = this.options.taskListTable) || void 0 === _27 ? void 0 : _27.theme) || void 0 === _28 ? void 0 : _28.columnResize),
208
+ underlayBackgroundColor: this.parsedOptions.underlayBackgroundColor
209
+ };
210
+ }
211
+ return listTable_options.canvasWidth = this.taskTableWidth, listTable_options.canvasHeight = this.canvas.height,
212
+ listTable_options.defaultHeaderRowHeight = this.getAllHeaderRowsHeight(), this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate ? (listTable_options.customComputeRowHeight = args => {
213
+ var _a;
214
+ const {row: row, table: table} = args, record = table.getRecordByRowCol(0, row);
215
+ return record ? ((null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) || 1) * this.parsedOptions.rowHeight : this.parsedOptions.rowHeight;
216
+ }, listTable_options.defaultRowHeight = "auto", listTable_options.customConfig = {
217
+ forceComputeAllRowHeight: !0
218
+ }) : this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact ? (listTable_options.customComputeRowHeight = args => {
219
+ const {row: row, table: table} = args, record = table.getRecordByRowCol(0, row);
220
+ return record ? computeRowsCountByRecordDateForCompact(this, record) * this.parsedOptions.rowHeight : this.parsedOptions.rowHeight;
221
+ }, listTable_options.defaultRowHeight = "auto", listTable_options.customConfig = {
222
+ forceComputeAllRowHeight: !0
223
+ }) : this.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange ? (listTable_options.customComputeRowHeight = args => {
224
+ const {row: row, table: table} = args, record = table.getRecordByRowCol(0, row);
225
+ return record ? computeRowsCountByRecordDate(this, record) * this.parsedOptions.rowHeight : this.parsedOptions.rowHeight;
226
+ }, listTable_options.defaultRowHeight = "auto", listTable_options.customConfig = {
227
+ forceComputeAllRowHeight: !0
228
+ }) : listTable_options.defaultRowHeight = null !== (_29 = this.options.rowHeight) && void 0 !== _29 ? _29 : 40,
229
+ listTable_options.clearDOM = !1, listTable_options;
230
+ }
231
+ getElement() {
232
+ return this.element;
233
+ }
234
+ getContainer() {
235
+ return this.element.parentElement;
236
+ }
237
+ _sortScales() {
238
+ const {timelineHeader: timelineHeader} = this.options;
239
+ if (timelineHeader) {
240
+ const timelineScales = timelineHeader.scales, sortOrder = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second" ];
241
+ 1 === timelineScales.length && ("hour" !== timelineScales[0].unit && "minute" !== timelineScales[0].unit && "second" !== timelineScales[0].unit || (this.parsedOptions.timeScaleIncludeHour = !0));
242
+ const orderedScales = timelineScales.slice().sort(((a, b) => {
243
+ "hour" !== a.unit && "minute" !== a.unit && "second" !== a.unit || (this.parsedOptions.timeScaleIncludeHour = !0);
244
+ const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
245
+ return -1 === indexA ? 1 : -1 === indexB ? -1 : indexA - indexB;
246
+ })), reverseOrderedScales = timelineScales.slice().sort(((a, b) => {
247
+ const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
248
+ return -1 === indexA ? 1 : -1 === indexB ? -1 : indexB - indexA;
249
+ }));
250
+ this.parsedOptions.sortedTimelineScales = orderedScales, this.parsedOptions.reverseSortedTimelineScales = reverseOrderedScales;
251
+ }
252
+ }
253
+ _generateTimeLineDateMap() {
254
+ if (this.parsedOptions.minDate && this.parsedOptions.maxDate) for (const scale of this.parsedOptions.reverseSortedTimelineScales) scale.timelineDates = generateTimeLineDate(new Date(this.parsedOptions.minDate), this.parsedOptions.maxDate, scale);
255
+ }
256
+ getRowHeightByIndex(index) {
257
+ return this.taskListTableInstance ? this.taskListTableInstance.getRowHeight(index + this.taskListTableInstance.columnHeaderLevelCount) : this.parsedOptions.rowHeight;
258
+ }
259
+ getRowsHeightByIndex(startIndex, endIndex) {
260
+ return this.taskListTableInstance ? this.taskListTableInstance.getRowsHeight(startIndex + this.taskListTableInstance.columnHeaderLevelCount, endIndex + this.taskListTableInstance.columnHeaderLevelCount) : this.parsedOptions.rowHeight * (endIndex - startIndex + 1);
261
+ }
262
+ getAllRowsHeight() {
263
+ return this.taskListTableInstance ? this.taskListTableInstance.getAllRowsHeight() : this.getAllHeaderRowsHeight() + this.itemCount * this.parsedOptions.rowHeight;
264
+ }
265
+ getAllHeaderRowsHeight() {
266
+ return this.parsedOptions.timeLineHeaderRowHeights.reduce(((acc, curr, index) => !1 === this.parsedOptions.sortedTimelineScales[index].visible ? acc : acc + curr), 0);
267
+ }
268
+ getAllDateColsWidth() {
269
+ var _a, _b;
270
+ return this.parsedOptions.timelineColWidth * (null !== (_b = null === (_a = this.parsedOptions.reverseSortedTimelineScales[0].timelineDates) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0);
271
+ }
272
+ getAllTaskBarsHeight() {
273
+ return this.taskListTableInstance ? this.taskListTableInstance.getRowsHeight(this.taskListTableInstance.columnHeaderLevelCount, this.taskListTableInstance.rowCount - 1) : this.itemCount * this.parsedOptions.rowHeight;
274
+ }
275
+ getRecordIndexByTaskShowIndex(showIndex) {
276
+ return this.taskListTableInstance ? this.taskListTableInstance.getRecordIndexByCell(0, this.taskListTableInstance.columnHeaderLevelCount + showIndex) : showIndex;
277
+ }
278
+ getTaskShowIndexByRecordIndex(index) {
279
+ return this.taskListTableInstance.getBodyRowIndexByRecordIndex(index);
280
+ }
281
+ getRecordByIndex(taskShowIndex, sub_task_index) {
282
+ var _a, _b;
283
+ if (this.taskListTableInstance) {
284
+ if (isValid(sub_task_index)) {
285
+ const record = this.taskListTableInstance.getRecordByCell(0, taskShowIndex + this.taskListTableInstance.columnHeaderLevelCount);
286
+ if (Array.isArray(sub_task_index)) {
287
+ const recordIndex = this.getRecordIndexByTaskShowIndex(taskShowIndex), parentIndexLength = Array.isArray(recordIndex) ? recordIndex.length : 1, new_sub_task_index = [ ...sub_task_index ];
288
+ new_sub_task_index.splice(0, parentIndexLength);
289
+ let currentRecord = record;
290
+ for (;new_sub_task_index.length > 0; ) {
291
+ const index = new_sub_task_index.shift();
292
+ currentRecord = null === (_a = null == currentRecord ? void 0 : currentRecord.children) || void 0 === _a ? void 0 : _a[index];
293
+ }
294
+ return currentRecord;
295
+ }
296
+ return null === (_b = null == record ? void 0 : record.children) || void 0 === _b ? void 0 : _b[sub_task_index];
297
+ }
298
+ return this.taskListTableInstance.getRecordByCell(0, taskShowIndex + this.taskListTableInstance.columnHeaderLevelCount);
299
+ }
300
+ return this.records[taskShowIndex];
301
+ }
302
+ _refreshTaskBar(taskShowIndex, sub_task_index) {
303
+ this.scenegraph.taskBar.updateTaskBarNode(taskShowIndex, sub_task_index), this.scenegraph.refreshRecordLinkNodes(taskShowIndex, void 0, this.scenegraph.taskBar.getTaskBarNodeByIndex(taskShowIndex, sub_task_index)),
304
+ this.scenegraph.updateNextFrame();
305
+ }
306
+ _updateRecordToListTable(record, index) {
307
+ this.taskListTableInstance.updateRecords([ record ], [ index ]);
308
+ }
309
+ getTaskInfoByTaskListIndex(taskShowIndex, sub_task_index) {
310
+ const taskRecord = this.getRecordByIndex(taskShowIndex, sub_task_index), isMilestone = null == taskRecord ? void 0 : taskRecord.type, startDateField = this.parsedOptions.startDateField, endDateField = this.parsedOptions.endDateField, progressField = this.parsedOptions.progressField, rawDateStartDateTime = createDateAtMidnight(null == taskRecord ? void 0 : taskRecord[startDateField]).getTime(), rawDateEndDateTime = createDateAtMidnight(null == taskRecord ? void 0 : taskRecord[endDateField]).getTime();
311
+ if (isMilestone && !(null == taskRecord ? void 0 : taskRecord[startDateField]) || !isMilestone && (rawDateEndDateTime < this.parsedOptions._minDateTime || rawDateStartDateTime > this.parsedOptions._maxDateTime || !(null == taskRecord ? void 0 : taskRecord[startDateField]) || !(null == taskRecord ? void 0 : taskRecord[endDateField]))) return {
312
+ taskDays: 0,
313
+ progress: 0,
314
+ startDate: null,
315
+ endDate: null,
316
+ taskRecord: taskRecord
317
+ };
318
+ const progress = convertProgress(taskRecord[progressField]);
319
+ let startDate, endDate;
320
+ if (this.parsedOptions.timeScaleIncludeHour) {
321
+ startDate = createDateAtMidnight(Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime));
322
+ const rawEnd = null == taskRecord ? void 0 : taskRecord[endDateField];
323
+ let hasMillisecondProvided = !1;
324
+ "string" == typeof rawEnd && (hasMillisecondProvided = /:\d{2}\.\d+/.test(rawEnd));
325
+ const shouldForceMillisecond = !hasMillisecondProvided;
326
+ endDate = createDateAtLastMillisecond(Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime), shouldForceMillisecond);
327
+ } else startDate = createDateAtMidnight(Math.min(Math.max(this.parsedOptions._minDateTime, rawDateStartDateTime), this.parsedOptions._maxDateTime), !0),
328
+ endDate = createDateAtLastHour(Math.max(Math.min(this.parsedOptions._maxDateTime, rawDateEndDateTime), this.parsedOptions._minDateTime), !0);
329
+ return {
330
+ taskRecord: taskRecord,
331
+ taskDays: (endDate.getTime() - startDate.getTime() + 1) / 864e5,
332
+ startDate: startDate,
333
+ endDate: endDate,
334
+ progress: progress
335
+ };
336
+ }
337
+ _updateStartDateToTaskRecord(startDate, index, sub_task_index) {
338
+ var _a;
339
+ const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : parseDateFormat(taskRecord[startDateField]), newStartDate = formatDate(startDate, dateFormat);
340
+ if (taskRecord[startDateField] = newStartDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && this.stateManager.updateProjectTaskTimes(sub_task_index); else {
341
+ const indexs = this.getRecordIndexByTaskShowIndex(index);
342
+ this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
343
+ }
344
+ }
345
+ _updateEndDateToTaskRecord(endDate, index, sub_task_index) {
346
+ var _a;
347
+ const taskRecord = this.getRecordByIndex(index, sub_task_index), endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : parseDateFormat(taskRecord[endDateField]), newEndDate = formatDate(endDate, dateFormat);
348
+ if (taskRecord[endDateField] = newEndDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && this.stateManager.updateProjectTaskTimes(sub_task_index); else {
349
+ const indexs = this.getRecordIndexByTaskShowIndex(index);
350
+ this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
351
+ }
352
+ }
353
+ _updateStartEndDateToTaskRecord(startDate, endDate, index, sub_task_index) {
354
+ var _a;
355
+ const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : parseDateFormat(taskRecord[startDateField]), newStartDate = formatDate(startDate, dateFormat);
356
+ taskRecord[startDateField] = newStartDate;
357
+ const newEndDate = formatDate(endDate, dateFormat);
358
+ if (taskRecord[endDateField] = newEndDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && this.stateManager.updateProjectTaskTimes(sub_task_index); else {
359
+ const indexs = this.getRecordIndexByTaskShowIndex(index);
360
+ this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
361
+ }
362
+ }
363
+ _updateProgressToTaskRecord(progress, index, sub_task_index) {
364
+ const taskRecord = this.getRecordByIndex(index, sub_task_index), progressField = this.parsedOptions.progressField;
365
+ if (progressField) {
366
+ taskRecord[progressField] = progress;
367
+ const indexs = this.getRecordIndexByTaskShowIndex(index);
368
+ this._updateRecordToListTable(taskRecord, indexs), this._refreshTaskBar(index, sub_task_index);
369
+ }
370
+ }
371
+ _dragOrderTaskRecord(source_index, source_sub_task_index, target_index, target_sub_task_index) {
372
+ this.data.adjustOrder(source_index, source_sub_task_index, target_index, target_sub_task_index);
373
+ }
374
+ updateTaskRecord(record, task_index, sub_task_index) {
375
+ if (isValid(sub_task_index)) {
376
+ const index = "number" == typeof task_index ? task_index : task_index[0];
377
+ return this._updateRecordToListTable(record, [ index, sub_task_index ]), void this._refreshTaskBar(index, sub_task_index);
378
+ }
379
+ if (Array.isArray(task_index)) {
380
+ const index = task_index[0], sub_index = task_index[1];
381
+ return this._updateRecordToListTable(record, task_index), void this._refreshTaskBar(index, sub_index);
382
+ }
383
+ let recordIndexs = task_index;
384
+ "tree" === this.taskListTableInstance.rowHierarchyType && (recordIndexs = this.taskListTableInstance.getRecordIndexByCell(0, task_index + this.taskListTableInstance.columnHeaderLevelCount)),
385
+ this._updateRecordToListTable(record, recordIndexs), this._refreshTaskBar(task_index, void 0);
386
+ }
387
+ setPixelRatio(pixelRatio) {
388
+ var _a;
389
+ null === (_a = this.taskListTableInstance) || void 0 === _a || _a.setPixelRatio(pixelRatio),
390
+ this.parsedOptions.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
391
+ }
392
+ updateTasksShowMode(tasksShowMode) {
393
+ this.options.tasksShowMode = tasksShowMode, this.updateOption(this.options);
394
+ }
395
+ _resize() {
396
+ var _a, _b, _c, _d, _e;
397
+ this._updateSize(), null === (_a = this.taskListTableInstance) || void 0 === _a || _a.setCanvasSize(this.taskTableWidth, this.tableNoFrameHeight + toBoxArray(null !== (_c = null === (_b = this.parsedOptions.outerFrameStyle) || void 0 === _b ? void 0 : _b.borderLineWidth) && void 0 !== _c ? _c : 0)[0] + toBoxArray(null !== (_e = null === (_d = this.parsedOptions.outerFrameStyle) || void 0 === _d ? void 0 : _d.borderLineWidth) && void 0 !== _e ? _e : 0)[2]),
398
+ this._syncPropsFromTable(), this.scenegraph.resize(), updateSplitLineAndResizeLine(this);
399
+ }
400
+ _syncPropsFromTable() {
401
+ this.itemCount = this.taskListTableInstance ? this.taskListTableInstance.rowCount - this.taskListTableInstance.columnHeaderLevelCount : this.records.length,
402
+ this.headerHeight = this.getAllHeaderRowsHeight(), this.drawHeight = Math.min(this.getAllRowsHeight(), this.tableNoFrameHeight),
403
+ this.gridHeight = this.drawHeight - this.headerHeight;
404
+ }
405
+ hasDataZoom() {
406
+ var _a;
407
+ if (!this.zoomScaleManager) return !1;
408
+ const dataZoomConfig = null === (_a = this.zoomScaleManager.config) || void 0 === _a ? void 0 : _a.dataZoomAxis;
409
+ return !(!dataZoomConfig || !1 === dataZoomConfig.enabled) && null !== this.zoomScaleManager.getDataZoomIntegration();
410
+ }
411
+ getDataZoomHeight() {
412
+ var _a, _b, _c;
413
+ return this.hasDataZoom() ? (null === (_c = null === (_b = null === (_a = this.zoomScaleManager) || void 0 === _a ? void 0 : _a.config) || void 0 === _b ? void 0 : _b.dataZoomAxis) || void 0 === _c ? void 0 : _c.height) || 30 : 0;
414
+ }
415
+ getContext() {
416
+ return this.context;
417
+ }
418
+ release() {
419
+ var _a, _b, _c;
420
+ null === (_a = super.release) || void 0 === _a || _a.call(this), this.eventManager.release(),
421
+ null === (_b = this.taskListTableInstance) || void 0 === _b || _b.release(), this.zoomScaleManager && (this.zoomScaleManager.destroyDataZoomIntegration(),
422
+ this.zoomScaleManager = null);
423
+ const parentElement = null === (_c = this.element) || void 0 === _c ? void 0 : _c.parentElement;
424
+ parentElement && (parentElement.removeChild(this.element), this.verticalSplitResizeLine && parentElement.removeChild(this.verticalSplitResizeLine),
425
+ this.horizontalSplitLine && parentElement.removeChild(this.horizontalSplitLine)),
426
+ this.scenegraph = null, this.pluginManager.release();
427
+ }
428
+ updateOption(options) {
429
+ var _a, _b, _c, _d, _e;
430
+ if (this.parsedOptions = {}, this.options = options, this.taskTableWidth = "number" == typeof (null === (_a = null == options ? void 0 : options.taskListTable) || void 0 === _a ? void 0 : _a.tableWidth) ? null === (_b = null == options ? void 0 : options.taskListTable) || void 0 === _b ? void 0 : _b.tableWidth : -1,
431
+ this.taskTableColumns = null !== (_d = null === (_c = null == options ? void 0 : options.taskListTable) || void 0 === _c ? void 0 : _c.columns) && void 0 !== _d ? _d : [],
432
+ this.records = null !== (_e = null == options ? void 0 : options.records) && void 0 !== _e ? _e : [],
433
+ this._sortScales(), initOptions(this), this.data.setRecords(this.records), this._generateTimeLineDateMap(),
434
+ this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length, this._updateSize(),
435
+ this.taskListTableInstance) {
436
+ const listTableOption = this._generateListTableOptions();
437
+ this.taskListTableInstance.updateOption(listTableOption), this._updateListTableSize(this.taskListTableInstance);
438
+ }
439
+ this._syncPropsFromTable(), this.scenegraph.updateStageBackground(), this.element.style.left = -1 !== this.taskTableWidth ? `${this.taskTableWidth}px` : "0px",
440
+ updateSplitLineAndResizeLine(this), this.scenegraph.updateSceneGraph(), this.scenegraph.afterCreateSceneGraph(),
441
+ this._scrollToMarkLine();
442
+ }
443
+ setRecords(records) {
444
+ this.records = records, this.data.setRecords(records), updateOptionsWhenRecordChanged(this),
445
+ this.taskListTableInstance.setRecords(records), this._syncPropsFromTable(), this._generateTimeLineDateMap(),
446
+ this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length, this._updateSize(),
447
+ this.scenegraph.refreshAll(), this.verticalSplitResizeLine.style.height = this.drawHeight + "px";
448
+ const left = this.stateManager.scroll.horizontalBarPos, top = this.stateManager.scroll.verticalBarPos;
449
+ this.scenegraph.setX(-left), this.scenegraph.setY(-top);
450
+ }
451
+ updateScales(scales) {
452
+ const oldScalesLength = this.parsedOptions.sortedTimelineScales.length;
453
+ if (this.options.timelineHeader.scales = scales, this._sortScales(), updateOptionsWhenScaleChanged(this),
454
+ this._generateTimeLineDateMap(), this.timeLineHeaderLevel = this.parsedOptions.sortedTimelineScales.length,
455
+ this.scenegraph.refreshAll(), updateSplitLineAndResizeLine(this), this.taskListTableInstance) if (this.taskListTableInstance.columnHeaderLevelCount === this.parsedOptions.timeLineHeaderRowHeights.length) for (let i = 0; i < this.taskListTableInstance.columnHeaderLevelCount; i++) this.taskListTableInstance.setRowHeight(i, this.parsedOptions.timeLineHeaderRowHeights[i]); else {
456
+ const newRowHeight = this.getAllHeaderRowsHeight() / this.taskListTableInstance.columnHeaderLevelCount;
457
+ for (let i = 0; i < this.taskListTableInstance.columnHeaderLevelCount; i++) this.taskListTableInstance.setRowHeight(i, newRowHeight);
458
+ }
459
+ oldScalesLength !== scales.length && this._resize();
460
+ }
461
+ updateDateRange(minDate, maxDate) {
462
+ this.options.minDate = minDate, this.options.maxDate = maxDate, updateOptionsWhenDateRangeChanged(this),
463
+ this._generateTimeLineDateMap(), this._updateSize(), this.scenegraph.refreshAll(),
464
+ this._scrollToMarkLine();
465
+ }
466
+ updateMarkLine(markLine) {
467
+ this.options.markLine = markLine, updateOptionsWhenMarkLineChanged(this), this.scenegraph.markLine.refresh(),
468
+ this.scenegraph.renderSceneGraph();
469
+ }
470
+ addMarkLine(markLine) {
471
+ this.options.markLine = [ ...this.parsedOptions.markLine, markLine ], updateOptionsWhenMarkLineChanged(this),
472
+ this.scenegraph.markLine.refresh(), this.scenegraph.renderSceneGraph(), this.scenegraph.updateNextFrame();
473
+ }
474
+ updateCurrentMarkLine(markLine) {
475
+ const currentMarkLineIndex = this.parsedOptions.markLine.findIndex((item => item.date === markLine.date));
476
+ -1 !== currentMarkLineIndex && (this.options.markLine = [ ...this.parsedOptions.markLine.slice(0, currentMarkLineIndex), Object.assign(Object.assign({}, this.options.markLine[currentMarkLineIndex]), markLine), ...this.parsedOptions.markLine.slice(currentMarkLineIndex + 1) ],
477
+ updateOptionsWhenMarkLineChanged(this), this.scenegraph.markLine.refresh(), this.scenegraph.renderSceneGraph(),
478
+ this.scenegraph.updateNextFrame());
479
+ }
480
+ _scrollToMarkLine() {
481
+ if (this.parsedOptions.scrollToMarkLineDate && this.parsedOptions.minDate) {
482
+ const minDate = this.parsedOptions.minDate, {unit: unit, step: step} = this.parsedOptions.reverseSortedTimelineScales[0], left = computeCountToTimeScale(this.parsedOptions.scrollToMarkLineDate, minDate, unit, step) * this.parsedOptions.timelineColWidth - this.tableNoFrameWidth / 2;
483
+ this.stateManager.setScrollLeft(left);
484
+ }
485
+ }
486
+ scrollToMarkLine(date) {
487
+ if (!date || !this.parsedOptions.minDate) return;
488
+ const minDate = this.parsedOptions.minDate, {unit: unit, step: step} = this.parsedOptions.reverseSortedTimelineScales[0], left = computeCountToTimeScale(date, minDate, unit, step) * this.parsedOptions.timelineColWidth - this.tableNoFrameWidth / 2;
489
+ this.stateManager.setScrollLeft(left);
490
+ }
491
+ addLink(link) {
492
+ this.parsedOptions.dependencyLinks.push(link), this.scenegraph.dependencyLink.initLinkLine(this.parsedOptions.dependencyLinks.length - 1),
493
+ this.scenegraph.updateNextFrame();
494
+ }
495
+ deleteLink(link) {
496
+ if (this.parsedOptions.dependencyLinkDeletable) {
497
+ const index = this.parsedOptions.dependencyLinks.findIndex((item => item.type === link.type && item.linkedFromTaskKey === link.linkedFromTaskKey && item.linkedToTaskKey === link.linkedToTaskKey));
498
+ if (-1 !== index) {
499
+ const link = this.parsedOptions.dependencyLinks[index];
500
+ this.parsedOptions.dependencyLinks.splice(index, 1), this.scenegraph.dependencyLink.deleteLink(link),
501
+ this.scenegraph.updateNextFrame();
502
+ }
503
+ }
504
+ }
505
+ get scrollTop() {
506
+ return this.stateManager.scrollTop;
507
+ }
508
+ set scrollTop(value) {
509
+ this.stateManager.setScrollTop(value);
510
+ }
511
+ get scrollLeft() {
512
+ return this.stateManager.scrollLeft;
513
+ }
514
+ set scrollLeft(value) {
515
+ this.stateManager.setScrollLeft(value);
516
+ }
517
+ getTaskBarRelativeRect(index) {
518
+ const taskBarNode = this.scenegraph.taskBar.getTaskBarNodeByIndex(index);
519
+ return {
520
+ left: taskBarNode.attribute.x + this.taskListTableInstance.tableNoFrameWidth + this.taskListTableInstance.tableX + this.tableX - this.scrollLeft,
521
+ top: taskBarNode.attribute.y + this.tableY + this.headerHeight - this.scrollTop,
522
+ width: taskBarNode.attribute.width,
523
+ height: taskBarNode.attribute.height
524
+ };
525
+ }
526
+ getDateColWidth(dateIndex) {
527
+ return this.parsedOptions.timelineColWidth;
528
+ }
529
+ getDateColsWidth(startDateIndex, endDateIndex) {
530
+ return (endDateIndex - startDateIndex + 1) * this.parsedOptions.timelineColWidth;
531
+ }
532
+ getDateRangeByIndex(index) {
533
+ const minScale = this.parsedOptions.reverseSortedTimelineScales[0];
534
+ if (index < minScale.timelineDates.length) {
535
+ return {
536
+ startDate: minScale.timelineDates[index].startDate,
537
+ endDate: minScale.timelineDates[index].endDate
538
+ };
539
+ }
540
+ return null;
541
+ }
542
+ parseTimeFormat(date) {
543
+ return parseDateFormat(date);
544
+ }
545
+ getTaskBarStyle(task_index, sub_task_index) {
546
+ const {startDate: startDate, endDate: endDate, taskRecord: taskRecord} = this.getTaskInfoByTaskListIndex(task_index, sub_task_index);
547
+ let style;
548
+ if (style = taskRecord.type === TaskType.PROJECT ? this.parsedOptions.projectBarStyle : this.parsedOptions.taskBarStyle,
549
+ "function" == typeof style) {
550
+ return style({
551
+ index: task_index,
552
+ startDate: startDate,
553
+ endDate: endDate,
554
+ taskRecord: taskRecord,
555
+ ganttInstance: this
556
+ });
557
+ }
558
+ return style;
559
+ }
560
+ formatDate(date, format) {
561
+ return formatDate(date instanceof Date ? date : new Date(date), format);
562
+ }
563
+ getCurrentMillisecondsPerPixel() {
564
+ return this.millisecondsPerPixel;
565
+ }
566
+ setMillisecondsPerPixel(millisecondsPerPixel) {
567
+ var _a, _b, _c, _d;
568
+ const minMillisecondsPerPixel = null !== (_b = null === (_a = this.parsedOptions.zoom) || void 0 === _a ? void 0 : _a.minMillisecondsPerPixel) && void 0 !== _b ? _b : 2e5, maxMillisecondsPerPixel = null !== (_d = null === (_c = this.parsedOptions.zoom) || void 0 === _c ? void 0 : _c.maxMillisecondsPerPixel) && void 0 !== _d ? _d : 3e6, oldMillisecondsPerPixel = this.millisecondsPerPixel, oldWidth = this.parsedOptions.timelineColWidth;
569
+ this.millisecondsPerPixel = Math.max(minMillisecondsPerPixel, Math.min(maxMillisecondsPerPixel, millisecondsPerPixel)),
570
+ this.recalculateTimeScale(), this._updateSize(), this.scenegraph.refreshAll();
571
+ const newWidth = this.parsedOptions.timelineColWidth, scale = newWidth / oldWidth;
572
+ this.hasListeners(GANTT_EVENT_TYPE.ZOOM) && this.fireListeners(GANTT_EVENT_TYPE.ZOOM, {
573
+ oldWidth: oldWidth,
574
+ newWidth: newWidth,
575
+ scale: scale,
576
+ oldMillisecondsPerPixel: oldMillisecondsPerPixel,
577
+ newMillisecondsPerPixel: this.millisecondsPerPixel
578
+ });
579
+ }
580
+ getCurrentZoomScaleLevel() {
581
+ var _a, _b;
582
+ return null !== (_b = null === (_a = this.zoomScaleManager) || void 0 === _a ? void 0 : _a.getCurrentLevel()) && void 0 !== _b ? _b : -1;
583
+ }
584
+ }