@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,306 @@
1
+ import { Group, createLine, createRect } from "@visactor/vtable/es/vrender";
2
+
3
+ import { computeCountToTimeScale } from "../tools/util";
4
+
5
+ export class Grid {
6
+ constructor(scene) {
7
+ var _a;
8
+ this._scene = scene, this.scrollLeft = 0, this.scrollTop = 0, this.x = 0, this.y = scene._gantt.getAllHeaderRowsHeight(),
9
+ this.width = scene.ganttGroup.attribute.width, this.height = scene.ganttGroup.attribute.height - scene.timelineHeader.group.attribute.height,
10
+ this.rowHeight = scene._gantt.parsedOptions.rowHeight, this.rowCount = scene._gantt.itemCount,
11
+ this.allGridWidth = scene._gantt.getAllDateColsWidth(), this.allGridHeight = scene._gantt.getAllTaskBarsHeight(),
12
+ this.group = new Group({
13
+ x: this.x,
14
+ y: this.y,
15
+ width: this.width,
16
+ height: this.height,
17
+ clip: !0,
18
+ fill: null === (_a = scene._gantt.parsedOptions.grid) || void 0 === _a ? void 0 : _a.backgroundColor
19
+ }), this.group.name = "grid-container", scene.ganttGroup.addChild(this.group), this.createHorizontalBackgroundRects(),
20
+ this.createCellBackgroundRects(), this.createVerticalLines(), this.createHorizontalLines(),
21
+ this.createTimeLineHeaderBottomLine();
22
+ }
23
+ createTimeLineHeaderBottomLine() {
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
25
+ const options = this._scene._gantt.parsedOptions, horizontalSplitLineWidth = null !== (_b = null === (_a = options.horizontalSplitLine) || void 0 === _a ? void 0 : _a.lineWidth) && void 0 !== _b ? _b : null === (_c = options.timelineHeaderHorizontalLineStyle) || void 0 === _c ? void 0 : _c.lineWidth, bottomLineY = (1 & horizontalSplitLineWidth ? -.5 : 0) + horizontalSplitLineWidth / 2, line = createLine({
26
+ pickable: !1,
27
+ stroke: null !== (_e = null === (_d = options.horizontalSplitLine) || void 0 === _d ? void 0 : _d.lineColor) && void 0 !== _e ? _e : null === (_f = options.timelineHeaderHorizontalLineStyle) || void 0 === _f ? void 0 : _f.lineColor,
28
+ lineWidth: horizontalSplitLineWidth + (1 & horizontalSplitLineWidth ? 1 : 0),
29
+ lineDash: null !== (_h = null === (_g = options.horizontalSplitLine) || void 0 === _g ? void 0 : _g.lineDash) && void 0 !== _h ? _h : null === (_j = options.timelineHeaderHorizontalLineStyle) || void 0 === _j ? void 0 : _j.lineDash,
30
+ points: [ {
31
+ x: 0,
32
+ y: bottomLineY
33
+ }, {
34
+ x: this._scene._gantt.getAllDateColsWidth(),
35
+ y: bottomLineY
36
+ } ]
37
+ });
38
+ line.name = "timeLine-header-bottom-line", this.group.addChild(line);
39
+ }
40
+ createVerticalLines() {
41
+ var _a, _b;
42
+ const gridStyle = this._scene._gantt.parsedOptions.grid, verticalLineDependenceOnTimeScale = null !== (_a = gridStyle.verticalLineDependenceOnTimeScale) && void 0 !== _a ? _a : this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;
43
+ if (gridStyle.verticalLine) {
44
+ this.verticalLineGroup = new Group({
45
+ x: 0,
46
+ y: 0,
47
+ width: this.allGridWidth,
48
+ height: this.allGridHeight
49
+ }), this.verticalLineGroup.name = "grid-vertical", this.group.appendChild(this.verticalLineGroup);
50
+ const dependenceOnTimeScale = null !== (_b = this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find((scale => scale.unit === verticalLineDependenceOnTimeScale))) && void 0 !== _b ? _b : this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0], {unit: minUnit, step: step} = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0], {timelineDates: timelineDates} = dependenceOnTimeScale, timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
51
+ if ("function" == typeof gridStyle.verticalLine) for (let i = 0; i < (null == timelineDates ? void 0 : timelineDates.length) - 1; i++) {
52
+ const {endDate: endDate} = timelineDates[i], verticalLine_style = gridStyle.verticalLine({
53
+ index: i,
54
+ dateIndex: timelineDates[i].dateIndex,
55
+ date: timelineDates[i].endDate,
56
+ ganttInstance: this._scene._gantt
57
+ }), x = Math.ceil(computeCountToTimeScale(endDate, this._scene._gantt.parsedOptions.minDate, minUnit, step, 1) * timelineColWidth) + (1 & verticalLine_style.lineWidth ? .5 : 0), line = createLine({
58
+ pickable: !1,
59
+ stroke: verticalLine_style.lineColor,
60
+ lineWidth: verticalLine_style.lineWidth,
61
+ lineDash: verticalLine_style.lineDash,
62
+ points: [ {
63
+ x: x,
64
+ y: 0
65
+ }, {
66
+ x: x,
67
+ y: this.allGridHeight
68
+ } ]
69
+ });
70
+ this.verticalLineGroup.appendChild(line);
71
+ } else {
72
+ const verticalLine_style = gridStyle.verticalLine;
73
+ for (let i = 0; i < (null == timelineDates ? void 0 : timelineDates.length) - 1; i++) {
74
+ const {endDate: endDate} = timelineDates[i], x = Math.ceil(computeCountToTimeScale(endDate, this._scene._gantt.parsedOptions.minDate, minUnit, step, 1) * timelineColWidth) + (1 & verticalLine_style.lineWidth ? .5 : 0), line = createLine({
75
+ pickable: !1,
76
+ stroke: verticalLine_style.lineColor,
77
+ lineWidth: verticalLine_style.lineWidth,
78
+ lineDash: verticalLine_style.lineDash,
79
+ points: [ {
80
+ x: x,
81
+ y: 0
82
+ }, {
83
+ x: x,
84
+ y: this.allGridHeight
85
+ } ]
86
+ });
87
+ this.verticalLineGroup.appendChild(line);
88
+ }
89
+ }
90
+ }
91
+ }
92
+ createHorizontalLines() {
93
+ const gridStyle = this._scene._gantt.parsedOptions.grid;
94
+ if (gridStyle.horizontalLine) if (this.horizontalLineGroup = new Group({
95
+ x: 0,
96
+ y: 0,
97
+ width: this.allGridWidth,
98
+ height: this.allGridHeight
99
+ }), this.horizontalLineGroup.name = "grid-horizontal", this.group.appendChild(this.horizontalLineGroup),
100
+ "function" == typeof gridStyle.horizontalLine) {
101
+ let y = .5;
102
+ for (let i = 0; i < this.rowCount - 1; i++) {
103
+ const horizontalLine_style = gridStyle.horizontalLine({
104
+ index: i,
105
+ ganttInstance: this._scene._gantt
106
+ });
107
+ y += this._scene._gantt.getRowHeightByIndex(i);
108
+ const line = createLine({
109
+ pickable: !1,
110
+ stroke: horizontalLine_style.lineColor,
111
+ lineWidth: horizontalLine_style.lineWidth,
112
+ lineDash: horizontalLine_style.lineDash,
113
+ points: [ {
114
+ x: 0,
115
+ y: y
116
+ }, {
117
+ x: this.allGridWidth,
118
+ y: y
119
+ } ]
120
+ });
121
+ this.horizontalLineGroup.appendChild(line);
122
+ }
123
+ } else {
124
+ const horizontalLine_style = gridStyle.horizontalLine;
125
+ let y = 0;
126
+ 1 & horizontalLine_style.lineWidth && (y += .5);
127
+ for (let i = 0; i < this.rowCount - 1; i++) {
128
+ y += this._scene._gantt.getRowHeightByIndex(i);
129
+ const line = createLine({
130
+ pickable: !1,
131
+ stroke: horizontalLine_style.lineColor,
132
+ lineWidth: horizontalLine_style.lineWidth,
133
+ lineDash: horizontalLine_style.lineDash,
134
+ points: [ {
135
+ x: 0,
136
+ y: y
137
+ }, {
138
+ x: this.allGridWidth,
139
+ y: y
140
+ } ]
141
+ });
142
+ this.horizontalLineGroup.appendChild(line);
143
+ }
144
+ }
145
+ }
146
+ createVerticalBackgroundRects() {
147
+ const verticalBackgroundColor = this._scene._gantt.parsedOptions.grid.verticalBackgroundColor, weekendBackgroundColor = this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;
148
+ if (verticalBackgroundColor || weekendBackgroundColor) {
149
+ this.verticalBackgroundRectsGroup = new Group({
150
+ x: 0,
151
+ y: 0,
152
+ width: this.allGridWidth,
153
+ height: this.allGridHeight
154
+ }), this.verticalBackgroundRectsGroup.name = "grid-vertical-background", this.group.appendChild(this.verticalBackgroundRectsGroup);
155
+ const {timelineDates: timelineDates, unit: unit, step: step} = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0], timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
156
+ if (verticalBackgroundColor || weekendBackgroundColor) for (let i = 0; i <= (null == timelineDates ? void 0 : timelineDates.length) - 1; i++) {
157
+ let backgroundColor;
158
+ if (!weekendBackgroundColor || "day" !== unit || 1 !== step || 0 !== timelineDates[i].startDate.getDay() && 6 !== timelineDates[i].startDate.getDay() ? "function" == typeof verticalBackgroundColor ? backgroundColor = verticalBackgroundColor({
159
+ index: i,
160
+ dateIndex: timelineDates[i].dateIndex,
161
+ date: timelineDates[i].endDate,
162
+ ganttInstance: this._scene._gantt
163
+ }) : verticalBackgroundColor && (backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length]) : backgroundColor = weekendBackgroundColor,
164
+ backgroundColor) {
165
+ const x = Math.ceil(timelineColWidth * i), rect = createRect({
166
+ pickable: !1,
167
+ fill: backgroundColor,
168
+ x: x,
169
+ y: 0,
170
+ width: timelineColWidth,
171
+ height: this.allGridHeight
172
+ });
173
+ this.verticalBackgroundRectsGroup.appendChild(rect);
174
+ }
175
+ }
176
+ }
177
+ }
178
+ createHorizontalBackgroundRects() {
179
+ const horizontalBackgroundColor = this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;
180
+ if (horizontalBackgroundColor) {
181
+ this.horizontalBackgroundRectsGroup = new Group({
182
+ x: 0,
183
+ y: 0,
184
+ width: this.allGridWidth,
185
+ height: this.allGridHeight
186
+ }), this.horizontalBackgroundRectsGroup.name = "grid-horizontal-background", this.group.appendChild(this.horizontalBackgroundRectsGroup);
187
+ let y = 0;
188
+ for (let i = 0; i <= this.rowCount - 1; i++) {
189
+ let backgroundColor;
190
+ backgroundColor = "function" == typeof horizontalBackgroundColor ? horizontalBackgroundColor({
191
+ index: i,
192
+ ganttInstance: this._scene._gantt
193
+ }) : horizontalBackgroundColor[i % horizontalBackgroundColor.length];
194
+ const rect = createRect({
195
+ pickable: !1,
196
+ fill: backgroundColor,
197
+ x: 0,
198
+ y: y,
199
+ width: this.allGridWidth,
200
+ height: this._scene._gantt.getRowHeightByIndex(i)
201
+ });
202
+ this.horizontalBackgroundRectsGroup.appendChild(rect), y += this._scene._gantt.getRowHeightByIndex(i);
203
+ }
204
+ }
205
+ }
206
+ createCellBackgroundRects() {
207
+ var _a, _b, _c;
208
+ const cellBackgroundColor = this._scene._gantt.parsedOptions.grid.cellBackgroundColor;
209
+ if (!cellBackgroundColor) return;
210
+ const bgGroup = new Group({
211
+ x: 0,
212
+ y: 0,
213
+ width: this.allGridWidth,
214
+ height: this.allGridHeight
215
+ });
216
+ bgGroup.name = "grid-cell-background", this.cellBackgroundRectsGroup = bgGroup,
217
+ this.group.appendChild(bgGroup);
218
+ const rowCount = this.rowCount, scale = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0], timelineDates = null !== (_a = null == scale ? void 0 : scale.timelineDates) && void 0 !== _a ? _a : [], colCount = timelineDates.length, timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
219
+ let y = 0;
220
+ for (let r = 0; r < rowCount; r++) {
221
+ const rowHeight = this._scene._gantt.getRowHeightByIndex(r);
222
+ let x = 0;
223
+ for (let c = 0; c < colCount; c++) {
224
+ const cellStart = null === (_b = timelineDates[c]) || void 0 === _b ? void 0 : _b.startDate, cellEnd = null === (_c = timelineDates[c]) || void 0 === _c ? void 0 : _c.endDate;
225
+ if (!cellStart || !cellEnd) {
226
+ x += timelineColWidth;
227
+ continue;
228
+ }
229
+ const result = "function" == typeof cellBackgroundColor ? cellBackgroundColor({
230
+ rowIndex: r,
231
+ colIndex: c,
232
+ date: cellStart,
233
+ ganttInstance: this._scene._gantt
234
+ }) : cellBackgroundColor[(r + c) % cellBackgroundColor.length];
235
+ if (!result) {
236
+ x += timelineColWidth;
237
+ continue;
238
+ }
239
+ const resultArray = Array.isArray(result) ? result : [ result ];
240
+ if (1 === resultArray.length && "string" == typeof resultArray[0]) {
241
+ const rect = createRect({
242
+ pickable: !1,
243
+ fill: resultArray[0],
244
+ x: x,
245
+ y: y,
246
+ width: timelineColWidth,
247
+ height: rowHeight
248
+ });
249
+ bgGroup.appendChild(rect), x += timelineColWidth;
250
+ continue;
251
+ }
252
+ const cs = cellStart.getTime(), ce = cellEnd.getTime(), total = ce - cs;
253
+ for (const seg of resultArray) {
254
+ if (!seg) continue;
255
+ const {startTime: startTime, endTime: endTime, color: color} = seg;
256
+ if (!startTime || !endTime || !color) continue;
257
+ const ss = startTime.getTime(), se = endTime.getTime();
258
+ if (se <= cs || ss >= ce) continue;
259
+ const startOffset = (Math.max(ss, cs) - cs) / total, pixelStartX = x + startOffset * timelineColWidth, endOffset = (Math.min(se, ce) - cs) / total, rect = createRect({
260
+ pickable: !1,
261
+ fill: color,
262
+ x: pixelStartX,
263
+ y: y,
264
+ width: (endOffset - startOffset) * timelineColWidth,
265
+ height: rowHeight
266
+ });
267
+ bgGroup.appendChild(rect);
268
+ }
269
+ x += timelineColWidth;
270
+ }
271
+ y += rowHeight;
272
+ }
273
+ }
274
+ refresh() {
275
+ this.width = this._scene.ganttGroup.attribute.width, this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height,
276
+ this.group.setAttributes({
277
+ width: this.width,
278
+ height: this.height,
279
+ y: this._scene._gantt.getAllHeaderRowsHeight()
280
+ }), this.rowCount = this._scene._gantt.itemCount, this.allGridWidth = this._scene._gantt.getAllDateColsWidth(),
281
+ this.allGridHeight = this._scene._gantt.getAllTaskBarsHeight(), this.group.removeAllChild(),
282
+ this.createVerticalBackgroundRects(), this.createHorizontalBackgroundRects(), this.createVerticalLines(),
283
+ this.createHorizontalLines(), this.createTimeLineHeaderBottomLine();
284
+ }
285
+ setX(x) {
286
+ var _a, _b, _c, _d, _e;
287
+ null === (_a = this.verticalLineGroup) || void 0 === _a || _a.setAttribute("x", x),
288
+ null === (_b = this.horizontalLineGroup) || void 0 === _b || _b.setAttribute("x", x),
289
+ null === (_c = this.verticalBackgroundRectsGroup) || void 0 === _c || _c.setAttribute("x", x),
290
+ null === (_d = this.horizontalBackgroundRectsGroup) || void 0 === _d || _d.setAttribute("x", x),
291
+ null === (_e = this.cellBackgroundRectsGroup) || void 0 === _e || _e.setAttribute("x", x);
292
+ }
293
+ setY(y) {
294
+ var _a, _b, _c, _d, _e;
295
+ null === (_a = this.verticalLineGroup) || void 0 === _a || _a.setAttribute("y", y),
296
+ null === (_b = this.horizontalLineGroup) || void 0 === _b || _b.setAttribute("y", y),
297
+ null === (_c = this.verticalBackgroundRectsGroup) || void 0 === _c || _c.setAttribute("y", y),
298
+ null === (_d = this.horizontalBackgroundRectsGroup) || void 0 === _d || _d.setAttribute("y", y),
299
+ null === (_e = this.cellBackgroundRectsGroup) || void 0 === _e || _e.setAttribute("y", y);
300
+ }
301
+ resize() {
302
+ this.width = this._scene.ganttGroup.attribute.width, this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height,
303
+ this.group.setAttribute("width", this.width), this.group.setAttribute("height", this.height);
304
+ }
305
+ }
306
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/scenegraph/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,MAAM,OAAO,IAAI;IAqBf,YAAY,KAAiB;;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC9F,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CA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AC,GAAG,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,CAAC,CAAS;;QACZ,MAAA,IAAI,CAAC,iBAAiB,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC7C,MAAA,IAAI,CAAC,mBAAmB,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC/C,MAAA,IAAI,CAAC,4BAA4B,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACxD,MAAA,IAAI,CAAC,8BAA8B,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC1D,MAAA,IAAI,CAAC,wBAAwB,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,MAAM;QACJ,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1G,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACF","file":"grid.js","sourcesContent":["import { Group, createLine, createRect } from '@visactor/vtable/es/vrender';\n\nimport type { Scenegraph } from './scenegraph';\nimport type { IGrid } from '../ts-types';\nimport { computeCountToTimeScale } from '../tools/util';\nexport class Grid {\n // verticalLineSpace: number;\n // horizontalLineSpace: number;\n gridStyle: IGrid;\n scrollLeft: number;\n scrollTop: number;\n x: number;\n y: number;\n width: number;\n height: number;\n rowHeight: number;\n rowCount: number;\n group: Group;\n verticalLineGroup: Group;\n horizontalLineGroup: Group;\n verticalBackgroundRectsGroup: Group;\n horizontalBackgroundRectsGroup: Group;\n cellBackgroundRectsGroup: Group;\n allGridHeight: number;\n allGridWidth: number;\n _scene: Scenegraph;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n\n this.scrollLeft = 0;\n this.scrollTop = 0;\n this.x = 0;\n this.y = scene._gantt.getAllHeaderRowsHeight();\n this.width = scene.ganttGroup.attribute.width;\n this.height = scene.ganttGroup.attribute.height - scene.timelineHeader.group.attribute.height;\n this.rowHeight = scene._gantt.parsedOptions.rowHeight;\n this.rowCount = scene._gantt.itemCount;\n this.allGridWidth = scene._gantt.getAllDateColsWidth();\n this.allGridHeight = scene._gantt.getAllTaskBarsHeight();\n this.group = new Group({\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height,\n clip: true,\n fill: scene._gantt.parsedOptions.grid?.backgroundColor\n });\n this.group.name = 'grid-container';\n scene.ganttGroup.addChild(this.group);\n this.createHorizontalBackgroundRects();\n this.createCellBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n }\n\n createTimeLineHeaderBottomLine() {\n const options = this._scene._gantt.parsedOptions;\n //补充timelineHeader中不好绘制的底部的边线\n const horizontalSplitLineWidth =\n options.horizontalSplitLine?.lineWidth ?? options.timelineHeaderHorizontalLineStyle?.lineWidth;\n const bottomLineY = (horizontalSplitLineWidth & 1 ? -0.5 : 0) + horizontalSplitLineWidth / 2; // 原来是(horizontalSplitLineWidth & 1 ? 0.5 : 0) 这里改成-0.5为了和左侧表格的水平分割线对齐\n const line = createLine({\n pickable: false,\n stroke: options.horizontalSplitLine?.lineColor ?? options.timelineHeaderHorizontalLineStyle?.lineColor,\n lineWidth: horizontalSplitLineWidth + (horizontalSplitLineWidth & 1 ? 1 : 0), // 加上后面这个1是为了和左侧表格的水平分割线对齐\n lineDash: options.horizontalSplitLine?.lineDash ?? options.timelineHeaderHorizontalLineStyle?.lineDash,\n points: [\n { x: 0, y: bottomLineY },\n {\n x: this._scene._gantt.getAllDateColsWidth(),\n y: bottomLineY\n }\n ]\n });\n line.name = 'timeLine-header-bottom-line';\n this.group.addChild(line);\n }\n\n createVerticalLines() {\n const gridStyle = this._scene._gantt.parsedOptions.grid;\n const verticalLineDependenceOnTimeScale =\n gridStyle.verticalLineDependenceOnTimeScale ??\n this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;\n\n if (gridStyle.verticalLine) {\n this.verticalLineGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.verticalLineGroup.name = 'grid-vertical';\n this.group.appendChild(this.verticalLineGroup);\n\n const dependenceOnTimeScale =\n this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find(\n scale => scale.unit === verticalLineDependenceOnTimeScale\n ) ?? this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const { unit: minUnit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const { timelineDates } = dependenceOnTimeScale;\n const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;\n\n if (typeof gridStyle.verticalLine === 'function') {\n for (let i = 0; i < timelineDates?.length - 1; i++) {\n const { endDate } = timelineDates[i];\n const verticalLine_style = gridStyle.verticalLine({\n index: i,\n dateIndex: timelineDates[i].dateIndex,\n date: timelineDates[i].endDate,\n ganttInstance: this._scene._gantt\n });\n const x =\n Math.ceil(\n computeCountToTimeScale(endDate, this._scene._gantt.parsedOptions.minDate, minUnit, step, 1) *\n timelineColWidth\n ) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n // const x = Math.ceil(timelineColWidth * (i + 1)) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n const line = createLine({\n pickable: false,\n stroke: verticalLine_style.lineColor,\n lineWidth: verticalLine_style.lineWidth,\n lineDash: verticalLine_style.lineDash,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n this.verticalLineGroup.appendChild(line);\n }\n } else {\n const verticalLine_style = gridStyle.verticalLine;\n for (let i = 0; i < timelineDates?.length - 1; i++) {\n const { endDate } = timelineDates[i];\n const x =\n Math.ceil(\n computeCountToTimeScale(endDate, this._scene._gantt.parsedOptions.minDate, minUnit, step, 1) *\n timelineColWidth\n ) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n // const x = Math.ceil(timelineColWidth * (i + 1)) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n const line = createLine({\n pickable: false,\n stroke: verticalLine_style.lineColor,\n lineWidth: verticalLine_style.lineWidth,\n lineDash: verticalLine_style.lineDash,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n this.verticalLineGroup.appendChild(line);\n }\n }\n }\n }\n createHorizontalLines() {\n const gridStyle = this._scene._gantt.parsedOptions.grid;\n if (gridStyle.horizontalLine) {\n this.horizontalLineGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.horizontalLineGroup.name = 'grid-horizontal';\n this.group.appendChild(this.horizontalLineGroup);\n if (typeof gridStyle.horizontalLine === 'function') {\n let y = 0.5; //确保大多数情况 LineWidth为1时是准确的\n for (let i = 0; i < this.rowCount - 1; i++) {\n const horizontalLine_style = gridStyle.horizontalLine({\n index: i,\n ganttInstance: this._scene._gantt\n });\n y = y + this._scene._gantt.getRowHeightByIndex(i); // Math.floor(this.rowHeight);\n const line = createLine({\n pickable: false,\n stroke: horizontalLine_style.lineColor,\n lineWidth: horizontalLine_style.lineWidth,\n lineDash: horizontalLine_style.lineDash,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n this.horizontalLineGroup.appendChild(line);\n }\n } else {\n const horizontalLine_style = gridStyle.horizontalLine;\n let y = 0;\n if (horizontalLine_style.lineWidth & 1) {\n y += 0.5;\n }\n for (let i = 0; i < this.rowCount - 1; i++) {\n y = y + this._scene._gantt.getRowHeightByIndex(i); // Math.floor(this.rowHeight);\n const line = createLine({\n pickable: false,\n stroke: horizontalLine_style.lineColor,\n lineWidth: horizontalLine_style.lineWidth,\n lineDash: horizontalLine_style.lineDash,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n this.horizontalLineGroup.appendChild(line);\n }\n }\n }\n }\n\n createVerticalBackgroundRects() {\n const verticalBackgroundColor = this._scene._gantt.parsedOptions.grid.verticalBackgroundColor;\n const weekendBackgroundColor = this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;\n if (verticalBackgroundColor || weekendBackgroundColor) {\n this.verticalBackgroundRectsGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.verticalBackgroundRectsGroup.name = 'grid-vertical-background';\n this.group.appendChild(this.verticalBackgroundRectsGroup);\n\n const { timelineDates, unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;\n\n if (verticalBackgroundColor || weekendBackgroundColor) {\n for (let i = 0; i <= timelineDates?.length - 1; i++) {\n let backgroundColor;\n if (\n weekendBackgroundColor &&\n unit === 'day' &&\n step === 1 &&\n (timelineDates[i].startDate.getDay() === 0 || timelineDates[i].startDate.getDay() === 6)\n ) {\n backgroundColor = weekendBackgroundColor;\n } else if (typeof verticalBackgroundColor === 'function') {\n backgroundColor = verticalBackgroundColor({\n index: i,\n dateIndex: timelineDates[i].dateIndex,\n date: timelineDates[i].endDate,\n ganttInstance: this._scene._gantt\n });\n } else if (verticalBackgroundColor) {\n backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length];\n }\n if (backgroundColor) {\n const x = Math.ceil(timelineColWidth * i);\n const rect = createRect({\n pickable: false,\n fill: backgroundColor,\n x,\n y: 0,\n width: timelineColWidth,\n height: this.allGridHeight\n });\n this.verticalBackgroundRectsGroup.appendChild(rect);\n }\n }\n }\n }\n }\n createHorizontalBackgroundRects() {\n const horizontalBackgroundColor = this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;\n if (horizontalBackgroundColor) {\n this.horizontalBackgroundRectsGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.horizontalBackgroundRectsGroup.name = 'grid-horizontal-background';\n this.group.appendChild(this.horizontalBackgroundRectsGroup);\n\n let y = 0;\n for (let i = 0; i <= this.rowCount - 1; i++) {\n let backgroundColor;\n if (typeof horizontalBackgroundColor === 'function') {\n backgroundColor = horizontalBackgroundColor({\n index: i,\n ganttInstance: this._scene._gantt\n });\n } else {\n backgroundColor = horizontalBackgroundColor[i % horizontalBackgroundColor.length];\n }\n\n const rect = createRect({\n pickable: false,\n fill: backgroundColor,\n x: 0,\n y,\n width: this.allGridWidth,\n height: this._scene._gantt.getRowHeightByIndex(i)\n });\n this.horizontalBackgroundRectsGroup.appendChild(rect);\n y += this._scene._gantt.getRowHeightByIndex(i);\n }\n }\n }\n\n createCellBackgroundRects() {\n const cellBackgroundColor = this._scene._gantt.parsedOptions.grid.cellBackgroundColor;\n\n // 没配置就不画\n if (!cellBackgroundColor) {\n return;\n }\n\n // 建一个 group 专门放背景 rect\n const bgGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n bgGroup.name = 'grid-cell-background';\n\n this.cellBackgroundRectsGroup = bgGroup;\n this.group.appendChild(bgGroup);\n\n const rowCount = this.rowCount;\n\n // 取第一层时间刻度(reverseSortedTimelineScales[0])\n const scale = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const timelineDates = scale?.timelineDates ?? [];\n const colCount = timelineDates.length;\n\n const timelineColWidth: number = this._scene._gantt.parsedOptions.timelineColWidth;\n\n let y = 0;\n\n for (let r = 0; r < rowCount; r++) {\n const rowHeight: number = this._scene._gantt.getRowHeightByIndex(r);\n\n let x = 0;\n\n for (let c = 0; c < colCount; c++) {\n const cellStart: Date | undefined = timelineDates[c]?.startDate;\n const cellEnd: Date | undefined = timelineDates[c]?.endDate;\n\n // 没有时间范围就跳过\n if (!cellStart || !cellEnd) {\n x += timelineColWidth;\n continue;\n }\n\n // 计算当前单元格的背景配置结果\n const result =\n typeof cellBackgroundColor === 'function'\n ? cellBackgroundColor({\n rowIndex: r,\n colIndex: c,\n date: cellStart,\n ganttInstance: this._scene._gantt\n })\n : cellBackgroundColor[(r + c) % cellBackgroundColor.length];\n\n // 没结果就跳过\n if (!result) {\n x += timelineColWidth;\n continue;\n }\n\n // 统一转成数组处理:要么 [string],要么 segments[]\n const resultArray = Array.isArray(result) ? result : [result];\n\n // 情况1:只有一个 string,整格纯色\n if (resultArray.length === 1 && typeof resultArray[0] === 'string') {\n const rect = createRect({\n pickable: false,\n fill: resultArray[0],\n x,\n y,\n width: timelineColWidth,\n height: rowHeight\n });\n\n bgGroup.appendChild(rect);\n x += timelineColWidth;\n continue;\n }\n\n // 情况2:分段着色(按时间切片映射到像素宽度)\n const cs = cellStart.getTime();\n const ce = cellEnd.getTime();\n const total = ce - cs;\n\n for (const seg of resultArray) {\n if (!seg) {\n continue;\n }\n\n const { startTime, endTime, color } = seg;\n if (!startTime || !endTime || !color) {\n continue;\n }\n\n const ss = startTime.getTime();\n const se = endTime.getTime();\n\n // 完全不相交就跳过\n if (se <= cs || ss >= ce) {\n continue;\n }\n\n // 将时间段裁剪到 [cs, ce],映射到 [x, x+timelineColWidth]\n const startOffset = (Math.max(ss, cs) - cs) / total;\n const pixelStartX = x + startOffset * timelineColWidth;\n\n const endOffset = (Math.min(se, ce) - cs) / total;\n const pixelWidth = (endOffset - startOffset) * timelineColWidth;\n\n const rect = createRect({\n pickable: false,\n fill: color,\n x: pixelStartX,\n y,\n width: pixelWidth,\n height: rowHeight\n });\n\n bgGroup.appendChild(rect);\n }\n\n x += timelineColWidth;\n }\n\n y += rowHeight;\n }\n }\n /** 重新创建网格线场景树结点 */\n refresh() {\n this.width = this._scene.ganttGroup.attribute.width;\n this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttributes({\n width: this.width,\n height: this.height,\n y: this._scene._gantt.getAllHeaderRowsHeight()\n });\n this.rowCount = this._scene._gantt.itemCount;\n this.allGridWidth = this._scene._gantt.getAllDateColsWidth();\n this.allGridHeight = this._scene._gantt.getAllTaskBarsHeight();\n this.group.removeAllChild();\n // this.verticalLineGroup?.parent.removeChild(this.verticalLineGroup);\n // this.horizontalLineGroup?.parent.removeChild(this.horizontalLineGroup);\n // this.verticalBackgroundRectsGroup?.parent.removeChild(this.verticalBackgroundRectsGroup);\n // this.horizontalBackgroundRectsGroup?.parent.removeChild(this.horizontalBackgroundRectsGroup);\n this.createVerticalBackgroundRects();\n this.createHorizontalBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n }\n setX(x: number) {\n this.verticalLineGroup?.setAttribute('x', x);\n this.horizontalLineGroup?.setAttribute('x', x);\n this.verticalBackgroundRectsGroup?.setAttribute('x', x);\n this.horizontalBackgroundRectsGroup?.setAttribute('x', x);\n this.cellBackgroundRectsGroup?.setAttribute('x', x);\n }\n setY(y: number) {\n this.verticalLineGroup?.setAttribute('y', y);\n this.horizontalLineGroup?.setAttribute('y', y);\n this.verticalBackgroundRectsGroup?.setAttribute('y', y);\n this.horizontalBackgroundRectsGroup?.setAttribute('y', y);\n this.cellBackgroundRectsGroup?.setAttribute('y', y);\n }\n resize() {\n this.width = this._scene.ganttGroup.attribute.width;\n this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttribute('width', this.width);\n this.group.setAttribute('height', this.height);\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { Scenegraph } from './scenegraph';
2
+ import { Group } from '@visactor/vtable/es/vrender';
3
+ export declare class MarkLine {
4
+ _scene: Scenegraph;
5
+ group: Group;
6
+ markLIneContainer: Group;
7
+ markLineContainerWidth: number;
8
+ height: number;
9
+ constructor(scene: Scenegraph);
10
+ initMarkLines(): void;
11
+ refresh(): void;
12
+ setX(x: number): void;
13
+ }
@@ -0,0 +1,101 @@
1
+ import { computeCountToTimeScale, createDateAtMidnight } from "../tools/util";
2
+
3
+ import { Group, createLine, Text } from "@visactor/vtable/es/vrender";
4
+
5
+ export class MarkLine {
6
+ constructor(scene) {
7
+ this.markLineContainerWidth = 20, this._scene = scene, this.height = Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight) - scene._gantt.getAllHeaderRowsHeight(),
8
+ this.group = new Group({
9
+ x: 0,
10
+ y: scene._gantt.getAllHeaderRowsHeight(),
11
+ width: scene._gantt.tableNoFrameWidth,
12
+ height: this.height,
13
+ pickable: !1,
14
+ clip: !0
15
+ }), this.group.name = "mark-line-container", scene.ganttGroup.addChild(this.group),
16
+ this.markLIneContainer = new Group({
17
+ x: 0,
18
+ y: 0,
19
+ width: this._scene._gantt.getAllDateColsWidth(),
20
+ height: this.height,
21
+ pickable: !1,
22
+ clip: !0
23
+ }), this.group.appendChild(this.markLIneContainer), this.initMarkLines();
24
+ }
25
+ initMarkLines() {
26
+ const height = Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) - this._scene._gantt.getAllHeaderRowsHeight();
27
+ this.group.setAttributes({
28
+ y: this._scene._gantt.getAllHeaderRowsHeight(),
29
+ width: this._scene._gantt.tableNoFrameWidth,
30
+ height: height
31
+ }), this.markLIneContainer.setAttribute("width", this._scene._gantt.getAllDateColsWidth()),
32
+ this.markLIneContainer.setAttribute("height", height);
33
+ const markLine = this._scene._gantt.parsedOptions.markLine, minDate = this._scene._gantt.parsedOptions.minDate;
34
+ minDate && markLine.forEach((line => {
35
+ const style = line.style, contentStyle = line.contentStyle || {}, date = this._scene._gantt.parsedOptions.timeScaleIncludeHour ? createDateAtMidnight(line.date) : createDateAtMidnight(line.date, !0), {unit: unit, step: step} = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0], unitCount = computeCountToTimeScale(date, minDate, unit, step);
36
+ let positionOffset = 0;
37
+ if ("right" === line.position) positionOffset = 1; else if ("middle" === line.position) positionOffset = .5; else if ("date" === line.position) {
38
+ const date = createDateAtMidnight(line.date), unitCount = computeCountToTimeScale(date, minDate, unit, step);
39
+ positionOffset = unitCount - Math.floor(unitCount);
40
+ }
41
+ const dateX = this._scene._gantt.parsedOptions.timelineColWidth * (Math.floor(unitCount) + positionOffset), markLineGroup = new Group({
42
+ pickable: !1,
43
+ x: dateX - this.markLineContainerWidth / 2,
44
+ y: 0,
45
+ width: this.markLineContainerWidth,
46
+ height: this.height
47
+ });
48
+ markLineGroup.name = "mark-line", this.markLIneContainer.appendChild(markLineGroup);
49
+ const lineObj = createLine({
50
+ pickable: !1,
51
+ stroke: style.lineColor,
52
+ lineWidth: style.lineWidth,
53
+ lineDash: style.lineDash,
54
+ points: [ {
55
+ x: this.markLineContainerWidth / 2,
56
+ y: 0
57
+ }, {
58
+ x: this.markLineContainerWidth / 2,
59
+ y: this.height
60
+ } ]
61
+ });
62
+ if (markLineGroup.appendChild(lineObj), line.content) {
63
+ const textMaxLineWidth = this._scene._gantt.parsedOptions.timelineColWidth, textContainerHeight = contentStyle.lineHeight || 18, textGroup = new Group({
64
+ x: this.markLineContainerWidth / 2,
65
+ y: 0,
66
+ cursor: "pointer",
67
+ height: textContainerHeight,
68
+ clip: !1,
69
+ fill: contentStyle.backgroundColor || style.lineColor,
70
+ display: "flex",
71
+ cornerRadius: contentStyle.cornerRadius || [ 0, 2, 2, 0 ]
72
+ });
73
+ textGroup.name = "mark-line-content", textGroup.data = line, markLineGroup.appendChild(textGroup);
74
+ const text = new Text({
75
+ maxLineWidth: textMaxLineWidth,
76
+ text: line.content,
77
+ cursor: "pointer",
78
+ lineHeight: textContainerHeight,
79
+ fontWeight: contentStyle.fontWeight || "normal",
80
+ fill: contentStyle.color || style.lineColor,
81
+ fontSize: contentStyle.fontSize || 12,
82
+ poptip: {
83
+ position: "top",
84
+ dx: textMaxLineWidth / 4,
85
+ dy: -textContainerHeight / 4
86
+ }
87
+ });
88
+ textGroup.appendChild(text);
89
+ }
90
+ }));
91
+ }
92
+ refresh() {
93
+ this.height = Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) - this._scene._gantt.getAllHeaderRowsHeight(),
94
+ this.markLIneContainer.removeAllChild(), this.group.setAttribute("height", this.height),
95
+ this.markLIneContainer.setAttribute("height", this.height), this.initMarkLines();
96
+ }
97
+ setX(x) {
98
+ this.markLIneContainer.setAttribute("x", x);
99
+ }
100
+ }
101
+ //# sourceMappingURL=mark-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/scenegraph/mark-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAI9E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,OAAO,QAAQ;IAMnB,YAAY,KAAiB;QAF7B,2BAAsB,GAAW,EAAE,CAAC;QAGlC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM;YACT,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC7G,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC;YACrB,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE;YACxC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;YACrC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,qBAAqB,CAAC;QACxC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAA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CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,CAAS;QACZ,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF","file":"mark-line.js","sourcesContent":["import { computeCountToTimeScale, createDateAtMidnight } from '../tools/util';\nimport { DayTimes } from '../gantt-helper';\n//import type { IMarkLine } from '../ts-types';\nimport type { Scenegraph } from './scenegraph';\nimport { Group, createLine, Text } from '@visactor/vtable/es/vrender';\n\nexport class MarkLine {\n _scene: Scenegraph;\n group: Group;\n markLIneContainer: Group;\n markLineContainerWidth: number = 20;\n height: number;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.height =\n Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight) - scene._gantt.getAllHeaderRowsHeight();\n this.group = new Group({\n x: 0,\n y: scene._gantt.getAllHeaderRowsHeight(),\n width: scene._gantt.tableNoFrameWidth,\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.name = 'mark-line-container';\n scene.ganttGroup.addChild(this.group);\n\n this.markLIneContainer = new Group({\n x: 0,\n y: 0,\n width: this._scene._gantt.getAllDateColsWidth(),\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.appendChild(this.markLIneContainer);\n this.initMarkLines();\n }\n initMarkLines() {\n //#region 重置markLine容器大小\n const height =\n Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) -\n this._scene._gantt.getAllHeaderRowsHeight();\n this.group.setAttributes({\n y: this._scene._gantt.getAllHeaderRowsHeight(),\n width: this._scene._gantt.tableNoFrameWidth,\n height: height\n });\n this.markLIneContainer.setAttribute('width', this._scene._gantt.getAllDateColsWidth());\n this.markLIneContainer.setAttribute('height', height);\n //#endregion\n const markLine = this._scene._gantt.parsedOptions.markLine;\n const minDate = this._scene._gantt.parsedOptions.minDate;\n minDate &&\n markLine.forEach(line => {\n const style = line.style;\n const contentStyle = line.contentStyle || {};\n const date = this._scene._gantt.parsedOptions.timeScaleIncludeHour\n ? createDateAtMidnight(line.date)\n : createDateAtMidnight(line.date, true);\n const { unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const unitCount = computeCountToTimeScale(date, minDate, unit, step);\n let positionOffset = 0;\n if (line.position === 'right') {\n positionOffset = 1;\n } else if (line.position === 'middle') {\n positionOffset = 0.5;\n } else if (line.position === 'date') {\n const date = createDateAtMidnight(line.date);\n const unitCount = computeCountToTimeScale(date, minDate, unit, step);\n const cellIndex = Math.floor(unitCount);\n positionOffset = unitCount - cellIndex;\n }\n const dateX = this._scene._gantt.parsedOptions.timelineColWidth * (Math.floor(unitCount) + positionOffset);\n const markLineGroup = new Group({\n pickable: false,\n x: dateX - this.markLineContainerWidth / 2,\n y: 0,\n width: this.markLineContainerWidth,\n height: this.height\n });\n markLineGroup.name = 'mark-line';\n this.markLIneContainer.appendChild(markLineGroup);\n // 创建整个任务条rect\n const lineObj = createLine({\n pickable: false,\n stroke: style.lineColor,\n lineWidth: style.lineWidth,\n lineDash: style.lineDash,\n points: [\n { x: this.markLineContainerWidth / 2, y: 0 },\n { x: this.markLineContainerWidth / 2, y: this.height }\n ]\n });\n markLineGroup.appendChild(lineObj);\n if (line.content) {\n const textMaxLineWidth = this._scene._gantt.parsedOptions.timelineColWidth;\n const textContainerHeight = contentStyle.lineHeight || 18;\n // 创建内容区\n const textGroup = new Group({\n x: this.markLineContainerWidth / 2,\n y: 0,\n cursor: 'pointer',\n height: textContainerHeight,\n clip: false,\n fill: contentStyle.backgroundColor || style.lineColor,\n display: 'flex',\n cornerRadius: contentStyle.cornerRadius || [0, 2, 2, 0]\n });\n textGroup.name = 'mark-line-content';\n (textGroup as any).data = line;\n markLineGroup.appendChild(textGroup);\n // 创建内容\n const text = new Text({\n maxLineWidth: textMaxLineWidth,\n text: line.content,\n cursor: 'pointer',\n lineHeight: textContainerHeight,\n fontWeight: contentStyle.fontWeight || 'normal',\n fill: contentStyle.color || style.lineColor,\n fontSize: contentStyle.fontSize || 12,\n poptip: {\n position: 'top',\n dx: textMaxLineWidth / 4,\n dy: -textContainerHeight / 4\n }\n } as any);\n textGroup.appendChild(text);\n }\n });\n }\n\n /** 重新场景场景树节点 */\n refresh() {\n this.height =\n Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) -\n this._scene._gantt.getAllHeaderRowsHeight();\n this.markLIneContainer.removeAllChild();\n this.group.setAttribute('height', this.height);\n this.markLIneContainer.setAttribute('height', this.height);\n this.initMarkLines();\n }\n setX(x: number) {\n this.markLIneContainer.setAttribute('x', x);\n }\n}\n"]}
@@ -0,0 +1,59 @@
1
+ import type { Stage } from '@visactor/vtable/es/vrender';
2
+ import { Group } from '@visactor/vtable/es/vrender';
3
+ import { Grid } from './grid';
4
+ import type { Gantt } from '../Gantt';
5
+ import { ScrollBarComponent } from './scroll-bar';
6
+ import { TimelineHeader } from './timeline-header';
7
+ import { TaskBar } from './task-bar';
8
+ import { MarkLine } from './mark-line';
9
+ import { FrameBorder } from './frame-border';
10
+ import { TaskCreationButton } from './task-creation-button';
11
+ import { ToolTip } from './tooltip';
12
+ import { DependencyLink } from './dependency-link';
13
+ import { DragOrderLine } from './drag-order-line';
14
+ import type { GanttTaskBarNode } from './gantt-node';
15
+ export declare class Scenegraph {
16
+ dateStepWidth: number;
17
+ rowHeight: number;
18
+ _scales: {}[];
19
+ timelineHeader: TimelineHeader;
20
+ grid: Grid;
21
+ dependencyLink: DependencyLink;
22
+ taskBar: TaskBar;
23
+ _gantt: Gantt;
24
+ ganttGroup: Group;
25
+ scrollbarComponent: ScrollBarComponent;
26
+ markLine: MarkLine;
27
+ dragOrderLine: DragOrderLine;
28
+ frameBorder: FrameBorder;
29
+ taskCreationButton: TaskCreationButton;
30
+ toolTip: ToolTip;
31
+ stage: Stage;
32
+ tableGroupWidth: number;
33
+ tableGroupHeight: number;
34
+ constructor(gantt: Gantt);
35
+ initSceneGraph(): void;
36
+ updateSceneGraph(): void;
37
+ afterCreateSceneGraph(): void;
38
+ refreshAll(): void;
39
+ refreshTaskBars(): void;
40
+ refreshTaskBarsAndGrid(): void;
41
+ updateTableSize(): void;
42
+ updateStageBackground(): void;
43
+ renderSceneGraph(): void;
44
+ updateNextFrame(): void;
45
+ get width(): number;
46
+ get height(): number;
47
+ get x(): number;
48
+ get y(): number;
49
+ setX(x: number, isEnd?: boolean): void;
50
+ setY(y: number, isEnd?: boolean): void;
51
+ setPixelRatio(pixelRatio: number): void;
52
+ resize(): void;
53
+ release(): void;
54
+ showTaskCreationButton(x: number, y: number, dateIndex: number): void;
55
+ hideTaskCreationButton(): void;
56
+ showToolTip(target: any): void;
57
+ hideToolTip(): void;
58
+ refreshRecordLinkNodes(taskIndex: number, sub_task_index: number, target: GanttTaskBarNode, dy?: number): void;
59
+ }