@visactor/vtable-gantt 1.9.2-alpha.4 → 1.10.1
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.
- package/cjs/Gantt.d.ts +27 -10
- package/cjs/Gantt.js +31 -13
- package/cjs/Gantt.js.map +1 -1
- package/cjs/event/event-manager.d.ts +1 -0
- package/cjs/event/event-manager.js +120 -24
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/gantt-helper.d.ts +5 -0
- package/cjs/gantt-helper.js +99 -38
- package/cjs/gantt-helper.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/scenegraph/dependency-link.d.ts +47 -0
- package/cjs/scenegraph/dependency-link.js +399 -0
- package/cjs/scenegraph/dependency-link.js.map +1 -0
- package/cjs/scenegraph/frame-border.js +1 -2
- package/cjs/scenegraph/{ganttNode.js → gantt-node.js} +2 -1
- package/cjs/scenegraph/gantt-node.js.map +1 -0
- package/cjs/scenegraph/grid.js +1 -1
- package/cjs/scenegraph/grid.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +6 -0
- package/cjs/scenegraph/scenegraph.js +18 -8
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/task-bar.d.ts +9 -2
- package/cjs/scenegraph/task-bar.js +99 -6
- package/cjs/scenegraph/task-bar.js.map +1 -1
- package/cjs/scenegraph/task-creation-button.d.ts +13 -0
- package/cjs/scenegraph/task-creation-button.js +86 -0
- package/cjs/scenegraph/task-creation-button.js.map +1 -0
- package/cjs/state/gantt-table-sync.d.ts +1 -0
- package/cjs/state/gantt-table-sync.js +11 -2
- package/cjs/state/gantt-table-sync.js.map +1 -1
- package/cjs/state/state-manager.d.ts +42 -4
- package/cjs/state/state-manager.js +129 -40
- package/cjs/state/state-manager.js.map +1 -1
- package/cjs/tools/pixel-ratio.js +1 -2
- package/cjs/ts-types/EVENT_TYPE.d.ts +2 -0
- package/cjs/ts-types/EVENT_TYPE.js +5 -2
- package/cjs/ts-types/EVENT_TYPE.js.map +1 -1
- package/cjs/ts-types/events.d.ts +14 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/gantt-engine.d.ts +69 -10
- package/cjs/ts-types/gantt-engine.js +6 -1
- package/cjs/ts-types/gantt-engine.js.map +1 -1
- package/dist/vtable-gantt.js +25454 -25737
- package/dist/vtable-gantt.min.js +2 -2
- package/es/Gantt.d.ts +27 -10
- package/es/Gantt.js +29 -11
- package/es/Gantt.js.map +1 -1
- package/es/event/event-manager.d.ts +1 -0
- package/es/event/event-manager.js +121 -24
- package/es/event/event-manager.js.map +1 -1
- package/es/gantt-helper.d.ts +5 -0
- package/es/gantt-helper.js +92 -31
- package/es/gantt-helper.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/scenegraph/dependency-link.d.ts +47 -0
- package/es/scenegraph/dependency-link.js +394 -0
- package/es/scenegraph/dependency-link.js.map +1 -0
- package/es/scenegraph/frame-border.js +1 -2
- package/es/scenegraph/{ganttNode.js → gantt-node.js} +2 -1
- package/es/scenegraph/gantt-node.js.map +1 -0
- package/es/scenegraph/grid.js +1 -1
- package/es/scenegraph/grid.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +6 -0
- package/es/scenegraph/scenegraph.js +21 -7
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/task-bar.d.ts +9 -2
- package/es/scenegraph/task-bar.js +99 -6
- package/es/scenegraph/task-bar.js.map +1 -1
- package/es/scenegraph/task-creation-button.d.ts +13 -0
- package/es/scenegraph/task-creation-button.js +78 -0
- package/es/scenegraph/task-creation-button.js.map +1 -0
- package/es/state/gantt-table-sync.d.ts +1 -0
- package/es/state/gantt-table-sync.js +9 -0
- package/es/state/gantt-table-sync.js.map +1 -1
- package/es/state/state-manager.d.ts +42 -4
- package/es/state/state-manager.js +124 -42
- package/es/state/state-manager.js.map +1 -1
- package/es/tools/pixel-ratio.js +1 -2
- package/es/ts-types/EVENT_TYPE.d.ts +2 -0
- package/es/ts-types/EVENT_TYPE.js +5 -2
- package/es/ts-types/EVENT_TYPE.js.map +1 -1
- package/es/ts-types/events.d.ts +14 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/gantt-engine.d.ts +69 -10
- package/es/ts-types/gantt-engine.js +6 -1
- package/es/ts-types/gantt-engine.js.map +1 -1
- package/package.json +4 -4
- package/cjs/scenegraph/ganttNode.js.map +0 -1
- package/es/scenegraph/ganttNode.js.map +0 -1
- /package/cjs/scenegraph/{ganttNode.d.ts → gantt-node.d.ts} +0 -0
- /package/es/scenegraph/{ganttNode.d.ts → gantt-node.d.ts} +0 -0
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
value: !0
|
|
11
11
|
}), exports.Scenegraph = void 0;
|
|
12
12
|
|
|
13
|
-
const vrender_1 = require("@visactor/vtable/es/vrender"), grid_1 = require("./grid"), env_1 = require("../env"), scroll_bar_1 = require("./scroll-bar"), scroll_1 = require("../event/scroll"), timeline_header_1 = require("./timeline-header"), task_bar_1 = require("./task-bar"), mark_line_1 = require("./mark-line"), frame_border_1 = require("./frame-border"), gantt_helper_1 = require("../gantt-helper"), graphic_1 = __importDefault(require("./graphic"));
|
|
13
|
+
const vrender_1 = require("@visactor/vtable/es/vrender"), grid_1 = require("./grid"), env_1 = require("../env"), scroll_bar_1 = require("./scroll-bar"), scroll_1 = require("../event/scroll"), timeline_header_1 = require("./timeline-header"), task_bar_1 = require("./task-bar"), mark_line_1 = require("./mark-line"), frame_border_1 = require("./frame-border"), gantt_helper_1 = require("../gantt-helper"), graphic_1 = __importDefault(require("./graphic")), task_creation_button_1 = require("./task-creation-button"), dependency_link_1 = require("./dependency-link");
|
|
14
14
|
|
|
15
15
|
vrender_1.container.load(graphic_1.default);
|
|
16
16
|
|
|
@@ -24,6 +24,7 @@ class Scenegraph {
|
|
|
24
24
|
width: width,
|
|
25
25
|
height: height,
|
|
26
26
|
disableDirtyBounds: !1,
|
|
27
|
+
background: gantt.parsedOptions.underlayBackgroundColor,
|
|
27
28
|
enableLayout: !0,
|
|
28
29
|
autoRender: !1,
|
|
29
30
|
context: {
|
|
@@ -51,9 +52,10 @@ class Scenegraph {
|
|
|
51
52
|
pickable: !1
|
|
52
53
|
}), this.stage.defaultLayer.add(this.tableGroup), this.tableGroup.name = "table",
|
|
53
54
|
this.timelineHeader = new timeline_header_1.TimelineHeader(this), this.grid = new grid_1.Grid(this),
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
55
|
+
this.dependencyLink = new dependency_link_1.DependencyLink(this), this.taskBar = new task_bar_1.TaskBar(this),
|
|
56
|
+
this.markLine = new mark_line_1.MarkLine(this), this.frameBorder = new frame_border_1.FrameBorder(this),
|
|
57
|
+
this.scrollbarComponent = new scroll_bar_1.ScrollBarComponent(this._gantt), this.stage.defaultLayer.addChild(this.scrollbarComponent.hScrollBar),
|
|
58
|
+
this.stage.defaultLayer.addChild(this.scrollbarComponent.vScrollBar);
|
|
57
59
|
}
|
|
58
60
|
afterCreateSceneGraph() {
|
|
59
61
|
this.scrollbarComponent.updateScrollBar(), (0, scroll_1.bindScrollBarListener)(this._gantt.eventManager);
|
|
@@ -65,7 +67,7 @@ class Scenegraph {
|
|
|
65
67
|
this.scrollbarComponent.updateScrollBar(), this.updateNextFrame();
|
|
66
68
|
}
|
|
67
69
|
refreshTaskBars() {
|
|
68
|
-
this.taskBar.refresh(), this.updateNextFrame();
|
|
70
|
+
this.dependencyLink.refresh(), this.taskBar.refresh(), this.updateNextFrame();
|
|
69
71
|
}
|
|
70
72
|
refreshTaskBarsAndGrid() {
|
|
71
73
|
this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight),
|
|
@@ -105,11 +107,11 @@ class Scenegraph {
|
|
|
105
107
|
return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.y) && void 0 !== _b ? _b : 0;
|
|
106
108
|
}
|
|
107
109
|
setX(x, isEnd = !1) {
|
|
108
|
-
this.timelineHeader.setX(x), this.grid.setX(x), this.taskBar.setX(x), this.
|
|
109
|
-
this.updateNextFrame();
|
|
110
|
+
this.timelineHeader.setX(x), this.grid.setX(x), this.taskBar.setX(x), this.dependencyLink.setX(x),
|
|
111
|
+
this.markLine.setX(x), this.updateNextFrame();
|
|
110
112
|
}
|
|
111
113
|
setY(y, isEnd = !1) {
|
|
112
|
-
this.grid.setY(y), this.taskBar.setY(y), this.updateNextFrame();
|
|
114
|
+
this.grid.setY(y), this.taskBar.setY(y), this.dependencyLink.setY(y), this.updateNextFrame();
|
|
113
115
|
}
|
|
114
116
|
setPixelRatio(pixelRatio) {
|
|
115
117
|
this.stage.disableDirtyBounds(), this.stage.window.setDpr(pixelRatio), this.stage.render(),
|
|
@@ -124,6 +126,14 @@ class Scenegraph {
|
|
|
124
126
|
getTaskBarNodeByY(y) {
|
|
125
127
|
(0, gantt_helper_1.getTaskIndexByY)(y, this._gantt);
|
|
126
128
|
}
|
|
129
|
+
showTaskCreationButton(x, y, taskIndex, record) {
|
|
130
|
+
this.taskCreationButton || (this.taskCreationButton = new task_creation_button_1.TaskCreationButton(this._gantt.scenegraph)),
|
|
131
|
+
this.taskCreationButton.show(x, y, this._gantt.parsedOptions.colWidthPerDay, this._gantt.parsedOptions.rowHeight),
|
|
132
|
+
this.updateNextFrame();
|
|
133
|
+
}
|
|
134
|
+
hideTaskCreationButton() {
|
|
135
|
+
this.taskCreationButton && (this.taskCreationButton.hide(), this.updateNextFrame());
|
|
136
|
+
}
|
|
127
137
|
}
|
|
128
138
|
|
|
129
139
|
exports.Scenegraph = Scenegraph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/scenegraph.ts"],"names":[],"mappings":";;;;;;AACA,yDAAqF;AACrF,iCAA8B;AAE9B,gCAA6B;AAC7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,CAAC;IACpD,CAAC;CACF;AApOD,gCAoOC","file":"scenegraph.js","sourcesContent":["import type { Stage } from '@visactor/vtable/es/vrender';\nimport { container, Group, vglobal, createStage } from '@visactor/vtable/es/vrender';\nimport { Grid } from './grid';\nimport type { Gantt } from '../Gantt';\nimport { Env } from '../env';\nimport { ScrollBarComponent } from './scroll-bar';\nimport { bindScrollBarListener } from '../event/scroll';\nimport { TimelineHeader } from './timeline-header';\nimport { TaskBar } from './task-bar';\nimport { MarkLine } from './mark-line';\nimport { FrameBorder } from './frame-border';\nimport { getTaskIndexByY } from '../gantt-helper';\nimport graphicContribution from './graphic';\ncontainer.load(graphicContribution);\nexport class Scenegraph {\n dateStepWidth: number;\n rowHeight: number;\n _scales: {}[];\n timelineHeader: TimelineHeader;\n grid: Grid;\n taskBar: TaskBar;\n _gantt: Gantt;\n tableGroup: Group;\n scrollbarComponent: ScrollBarComponent;\n markLine: MarkLine;\n frameBorder: FrameBorder;\n stage: Stage;\n tableGroupWidth: number;\n tableGroupHeight: number;\n constructor(gantt: Gantt) {\n this._gantt = gantt;\n this.tableGroupWidth = gantt.tableNoFrameWidth;\n this.tableGroupHeight = Math.min(gantt.tableNoFrameHeight, gantt.drawHeight);\n let width;\n let height;\n if (Env.mode === 'node') {\n // vglobal.setEnv('node', gantt.options.modeParams);\n // width = table.canvasWidth;\n // height = table.canvasHeight;\n } else {\n vglobal.setEnv('browser');\n width = gantt.canvas.width;\n height = gantt.canvas.height;\n }\n this.stage = createStage({\n canvas: gantt.canvas,\n width,\n height,\n disableDirtyBounds: false,\n // background: gantt.theme.underlayBackgroundColor,\n // dpr: gantt.internalProps.pixelRatio,\n enableLayout: true,\n autoRender: false,\n context: {\n appName: 'vtable'\n },\n pluginList: ['poptipForText']\n // afterRender: () => {\n // this._gantt.fireListeners('after_render', null);\n // }\n });\n (this.stage as any).gantt = this._gantt;\n (this.stage as any).table = this._gantt; // 为了使用bindDebugTool\n this.stage.defaultLayer.setTheme({\n group: {\n boundsPadding: 0,\n strokeBoundsBuffer: 0,\n lineJoin: 'round'\n },\n text: {\n ignoreBuf: true\n }\n });\n this.initSceneGraph();\n }\n\n initSceneGraph() {\n const scene = this;\n\n scene.tableGroup = new Group({\n x: scene._gantt.tableX,\n y: scene._gantt.tableY,\n width: this.tableGroupWidth,\n height: this.tableGroupHeight,\n clip: true,\n pickable: false\n });\n scene.stage.defaultLayer.add(scene.tableGroup);\n scene.tableGroup.name = 'table';\n // 初始化顶部时间线表头部分\n scene.timelineHeader = new TimelineHeader(scene);\n\n // 初始化网格线组件\n scene.grid = new Grid(scene);\n\n // 初始化任务条线组件\n scene.taskBar = new TaskBar(scene);\n\n // 初始化标记线组件\n scene.markLine = new MarkLine(scene);\n\n // 初始化边框\n scene.frameBorder = new FrameBorder(scene);\n\n // 初始化滚动条组件\n scene.scrollbarComponent = new ScrollBarComponent(scene._gantt);\n scene.stage.defaultLayer.addChild(scene.scrollbarComponent.hScrollBar);\n scene.stage.defaultLayer.addChild(scene.scrollbarComponent.vScrollBar);\n }\n\n afterCreateSceneGraph() {\n this.scrollbarComponent.updateScrollBar();\n bindScrollBarListener(this._gantt.eventManager);\n }\n\n refreshAll() {\n this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);\n this.tableGroup.setAttribute('height', this.tableGroupHeight);\n this.timelineHeader.refresh();\n this.grid.refresh();\n this.taskBar.refresh();\n this.markLine.refresh();\n this.frameBorder.resize();\n this.scrollbarComponent.updateScrollBar();\n this.updateNextFrame();\n }\n\n refreshTaskBars() {\n // this.timelineHeader.refresh();\n // this.grid.refresh();\n this.taskBar.refresh();\n // this.markLine.refresh();\n // this.frameBorder.refresh();\n // this.scrollbarComponent.refresh();\n this.updateNextFrame();\n }\n refreshTaskBarsAndGrid() {\n this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);\n this.tableGroup.setAttribute('height', this.tableGroupHeight);\n // this.timelineHeader.refresh();\n this.grid.refresh();\n this.taskBar.refresh();\n this.markLine.refresh();\n this.frameBorder.resize();\n this.scrollbarComponent.updateScrollBar();\n this.updateNextFrame();\n }\n\n updateTableSize() {\n this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);\n this.tableGroup.setAttributes({\n x: this._gantt.tableX,\n y: this._gantt.tableY,\n width: this._gantt.tableNoFrameWidth,\n height: this.tableGroupHeight\n } as any);\n this.grid.resize();\n this.taskBar.resize();\n this.frameBorder.resize();\n }\n\n /**\n * @description: 绘制场景树\n * @param {any} element\n * @param {CellRange} visibleCoord\n * @return {*}\n */\n renderSceneGraph() {\n this.stage.render();\n }\n\n /**\n * @description: 触发下一帧渲染\n * @return {*}\n */\n updateNextFrame() {\n this.stage.renderNextFrame();\n }\n get width(): number {\n return this.tableGroup.attribute?.width ?? 0;\n }\n\n get height(): number {\n return this.tableGroup.attribute?.height ?? 0;\n }\n\n get x(): number {\n return this.tableGroup.attribute?.x ?? 0;\n }\n\n get y(): number {\n return this.tableGroup.attribute?.y ?? 0;\n }\n\n /**\n * @description: 设置表格的x位置,滚动中使用\n * @param {number} x\n * @return {*}\n */\n setX(x: number, isEnd = false) {\n this.timelineHeader.setX(x);\n this.grid.setX(x);\n this.taskBar.setX(x);\n this.markLine.setX(x);\n this.updateNextFrame();\n // this._gantt.scenegraph.proxy.setX(-x, isEnd);\n }\n\n /**\n * @description: 更新表格的y位置,滚动中使用\n * @param {number} y\n * @return {*}\n */\n setY(y: number, isEnd = false) {\n // this._gantt.scenegraph.proxy.setY(-y, isEnd);\n this.grid.setY(y);\n this.taskBar.setY(y);\n this.updateNextFrame();\n }\n\n setPixelRatio(pixelRatio: number) {\n // this.stage.setDpr(pixelRatio);\n // 这里因为本时刻部分节点有更新bounds标记,直接render回导致开启DirtyBounds,无法完整重绘画布;\n // 所以这里先关闭DirtyBounds,等待下一帧再开启\n this.stage.disableDirtyBounds();\n this.stage.window.setDpr(pixelRatio);\n this.stage.render();\n this.stage.enableDirtyBounds();\n }\n\n resize() {\n this.updateTableSize();\n // this.updateBorderSizeAndPosition();\n this.scrollbarComponent.updateScrollBar();\n this.updateNextFrame();\n }\n release() {\n this.stage.release();\n }\n getTaskBarNodeByY(y: number) {\n const taskIndex = getTaskIndexByY(y, this._gantt);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/scenegraph.ts"],"names":[],"mappings":";;;;;;AACA,yDAAqF;AACrF,iCAA8B;AAE9B,gCAA6B;AAC7B,6CAAkD;AAClD,4CAAwD;AACxD,uDAAmD;AACnD,yCAAqC;AACrC,2CAAuC;AACvC,iDAA6C;AAC7C,kDAAkD;AAClD,wDAA4C;AAC5C,iEAA4D;AAC5D,uDAAmD;AACnD,mBAAS,CAAC,IAAI,CAAC,iBAAmB,CAAC,CAAC;AACpC,MAAa,UAAU;IAiBrB,YAAY,KAAY;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,iBAAiB,CAAC;QAC/C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,KAAK,CAAC;QACV,IAAI,MAAM,CAAC;QACX,IAAI,SAAG,CAAC,IAAI,KAAK,MAAM,EAAE;SAIxB;aAAM;YACL,iBAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC1B,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3B,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;SAC9B;QACD,IAAI,CAAC,KAAK,GAAG,IAAA,qBAAW,EAAC;YACvB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK;YACL,MAAM;YACN,kBAAkB,EAAE,KAAK;YACzB,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,uBAAuB;YAEvD,YAAY,EAAE,IAAI;YAClB,UA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D,gCAyPC","file":"scenegraph.js","sourcesContent":["import type { Stage } from '@visactor/vtable/es/vrender';\nimport { container, Group, vglobal, createStage } from '@visactor/vtable/es/vrender';\nimport { Grid } from './grid';\nimport type { Gantt } from '../Gantt';\nimport { Env } from '../env';\nimport { ScrollBarComponent } from './scroll-bar';\nimport { bindScrollBarListener } from '../event/scroll';\nimport { TimelineHeader } from './timeline-header';\nimport { TaskBar } from './task-bar';\nimport { MarkLine } from './mark-line';\nimport { FrameBorder } from './frame-border';\nimport { getTaskIndexByY } from '../gantt-helper';\nimport graphicContribution from './graphic';\nimport { TaskCreationButton } from './task-creation-button';\nimport { DependencyLink } from './dependency-link';\ncontainer.load(graphicContribution);\nexport class Scenegraph {\n dateStepWidth: number;\n rowHeight: number;\n _scales: {}[];\n timelineHeader: TimelineHeader;\n grid: Grid;\n dependencyLink: DependencyLink;\n taskBar: TaskBar;\n _gantt: Gantt;\n tableGroup: Group;\n scrollbarComponent: ScrollBarComponent;\n markLine: MarkLine;\n frameBorder: FrameBorder;\n taskCreationButton: TaskCreationButton;\n stage: Stage;\n tableGroupWidth: number;\n tableGroupHeight: number;\n constructor(gantt: Gantt) {\n this._gantt = gantt;\n this.tableGroupWidth = gantt.tableNoFrameWidth;\n this.tableGroupHeight = Math.min(gantt.tableNoFrameHeight, gantt.drawHeight);\n let width;\n let height;\n if (Env.mode === 'node') {\n // vglobal.setEnv('node', gantt.options.modeParams);\n // width = table.canvasWidth;\n // height = table.canvasHeight;\n } else {\n vglobal.setEnv('browser');\n width = gantt.canvas.width;\n height = gantt.canvas.height;\n }\n this.stage = createStage({\n canvas: gantt.canvas,\n width,\n height,\n disableDirtyBounds: false,\n background: gantt.parsedOptions.underlayBackgroundColor,\n // dpr: gantt.internalProps.pixelRatio,\n enableLayout: true,\n autoRender: false,\n context: {\n appName: 'vtable'\n },\n pluginList: ['poptipForText']\n // afterRender: () => {\n // this._gantt.fireListeners('after_render', null);\n // }\n });\n (this.stage as any).gantt = this._gantt;\n (this.stage as any).table = this._gantt; // 为了使用bindDebugTool\n this.stage.defaultLayer.setTheme({\n group: {\n boundsPadding: 0,\n strokeBoundsBuffer: 0,\n lineJoin: 'round'\n },\n text: {\n ignoreBuf: true\n }\n });\n this.initSceneGraph();\n }\n\n initSceneGraph() {\n const scene = this;\n\n scene.tableGroup = new Group({\n x: scene._gantt.tableX,\n y: scene._gantt.tableY,\n width: this.tableGroupWidth,\n height: this.tableGroupHeight,\n clip: true,\n pickable: false\n });\n scene.stage.defaultLayer.add(scene.tableGroup);\n scene.tableGroup.name = 'table';\n // 初始化顶部时间线表头部分\n scene.timelineHeader = new TimelineHeader(scene);\n\n // 初始化网格线组件\n scene.grid = new Grid(scene);\n // 初始化任务条线组件\n scene.dependencyLink = new DependencyLink(scene);\n // 初始化任务条线组件\n scene.taskBar = new TaskBar(scene);\n\n // 初始化标记线组件\n scene.markLine = new MarkLine(scene);\n\n // 初始化边框\n scene.frameBorder = new FrameBorder(scene);\n\n // 初始化滚动条组件\n scene.scrollbarComponent = new ScrollBarComponent(scene._gantt);\n scene.stage.defaultLayer.addChild(scene.scrollbarComponent.hScrollBar);\n scene.stage.defaultLayer.addChild(scene.scrollbarComponent.vScrollBar);\n }\n\n afterCreateSceneGraph() {\n this.scrollbarComponent.updateScrollBar();\n bindScrollBarListener(this._gantt.eventManager);\n }\n\n refreshAll() {\n this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);\n this.tableGroup.setAttribute('height', this.tableGroupHeight);\n this.timelineHeader.refresh();\n this.grid.refresh();\n this.taskBar.refresh();\n this.markLine.refresh();\n this.frameBorder.resize();\n this.scrollbarComponent.updateScrollBar();\n this.updateNextFrame();\n }\n\n refreshTaskBars() {\n // this.timelineHeader.refresh();\n // this.grid.refresh();\n this.dependencyLink.refresh();\n this.taskBar.refresh();\n // this.markLine.refresh();\n // this.frameBorder.refresh();\n // this.scrollbarComponent.refresh();\n this.updateNextFrame();\n }\n refreshTaskBarsAndGrid() {\n this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);\n this.tableGroup.setAttribute('height', this.tableGroupHeight);\n // this.timelineHeader.refresh();\n this.grid.refresh();\n this.taskBar.refresh();\n this.markLine.refresh();\n this.frameBorder.resize();\n this.scrollbarComponent.updateScrollBar();\n this.updateNextFrame();\n }\n\n updateTableSize() {\n this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight);\n this.tableGroup.setAttributes({\n x: this._gantt.tableX,\n y: this._gantt.tableY,\n width: this._gantt.tableNoFrameWidth,\n height: this.tableGroupHeight\n } as any);\n this.grid.resize();\n this.taskBar.resize();\n this.frameBorder.resize();\n }\n\n /**\n * @description: 绘制场景树\n * @param {any} element\n * @param {CellRange} visibleCoord\n * @return {*}\n */\n renderSceneGraph() {\n this.stage.render();\n }\n\n /**\n * @description: 触发下一帧渲染\n * @return {*}\n */\n updateNextFrame() {\n this.stage.renderNextFrame();\n }\n get width(): number {\n return this.tableGroup.attribute?.width ?? 0;\n }\n\n get height(): number {\n return this.tableGroup.attribute?.height ?? 0;\n }\n\n get x(): number {\n return this.tableGroup.attribute?.x ?? 0;\n }\n\n get y(): number {\n return this.tableGroup.attribute?.y ?? 0;\n }\n\n /**\n * @description: 设置表格的x位置,滚动中使用\n * @param {number} x\n * @return {*}\n */\n setX(x: number, isEnd = false) {\n this.timelineHeader.setX(x);\n this.grid.setX(x);\n this.taskBar.setX(x);\n this.dependencyLink.setX(x);\n this.markLine.setX(x);\n this.updateNextFrame();\n // this._gantt.scenegraph.proxy.setX(-x, isEnd);\n }\n\n /**\n * @description: 更新表格的y位置,滚动中使用\n * @param {number} y\n * @return {*}\n */\n setY(y: number, isEnd = false) {\n // this._gantt.scenegraph.proxy.setY(-y, isEnd);\n this.grid.setY(y);\n this.taskBar.setY(y);\n this.dependencyLink.setY(y);\n this.updateNextFrame();\n }\n\n setPixelRatio(pixelRatio: number) {\n // this.stage.setDpr(pixelRatio);\n // 这里因为本时刻部分节点有更新bounds标记,直接render回导致开启DirtyBounds,无法完整重绘画布;\n // 所以这里先关闭DirtyBounds,等待下一帧再开启\n this.stage.disableDirtyBounds();\n this.stage.window.setDpr(pixelRatio);\n this.stage.render();\n this.stage.enableDirtyBounds();\n }\n\n resize() {\n this.updateTableSize();\n // this.updateBorderSizeAndPosition();\n this.scrollbarComponent.updateScrollBar();\n this.updateNextFrame();\n }\n release() {\n this.stage.release();\n }\n getTaskBarNodeByY(y: number) {\n const taskIndex = getTaskIndexByY(y, this._gantt);\n }\n\n showTaskCreationButton(x: number, y: number, taskIndex: number, record: any) {\n if (!this.taskCreationButton) {\n this.taskCreationButton = new TaskCreationButton(this._gantt.scenegraph);\n }\n this.taskCreationButton.show(x, y, this._gantt.parsedOptions.colWidthPerDay, this._gantt.parsedOptions.rowHeight);\n this.updateNextFrame();\n }\n\n hideTaskCreationButton() {\n if (this.taskCreationButton) {\n this.taskCreationButton.hide();\n this.updateNextFrame();\n }\n }\n}\n"]}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { Group, Image } from '@visactor/vtable/es/vrender';
|
|
1
|
+
import { Group, Image, Line } from '@visactor/vtable/es/vrender';
|
|
2
2
|
import type { Scenegraph } from './scenegraph';
|
|
3
|
-
import { GanttTaskBarNode } from './
|
|
3
|
+
import { GanttTaskBarNode } from './gantt-node';
|
|
4
4
|
export declare const TASKBAR_HOVER_ICON_WIDTH = 10;
|
|
5
5
|
export declare class TaskBar {
|
|
6
6
|
group: Group;
|
|
7
7
|
barContainer: Group;
|
|
8
8
|
hoverBarGroup: Group;
|
|
9
|
+
creatingDependencyLine: Line;
|
|
9
10
|
hoverBarLeftIcon: Image;
|
|
10
11
|
hoverBarRightIcon: Image;
|
|
11
12
|
_scene: Scenegraph;
|
|
12
13
|
width: number;
|
|
13
14
|
height: number;
|
|
15
|
+
selectedBorders: Group[];
|
|
14
16
|
constructor(scene: Scenegraph);
|
|
15
17
|
initBars(): void;
|
|
16
18
|
initBar(index: number): GanttTaskBarNode;
|
|
@@ -22,4 +24,9 @@ export declare class TaskBar {
|
|
|
22
24
|
resize(): void;
|
|
23
25
|
showHoverBar(x: number, y: number, width: number, height: number, target?: Group): void;
|
|
24
26
|
hideHoverBar(): void;
|
|
27
|
+
createSelectedBorder(x: number, y: number, width: number, height: number, attachedToTaskBarNode: GanttTaskBarNode, showLinkPoint?: boolean): void;
|
|
28
|
+
removeSelectedBorder(): void;
|
|
29
|
+
removeSecondSelectedBorder(): void;
|
|
30
|
+
updateCreatingDependencyLine(x1: number, y1: number, x2: number, y2: number): void;
|
|
31
|
+
getTaskBarNodeByIndex(index: number): Group;
|
|
25
32
|
}
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.TaskBar = exports.TASKBAR_HOVER_ICON_WIDTH = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_1 = require("@visactor/vtable/es/vrender"), util_1 = require("../tools/util"), vutils_1 = require("@visactor/vutils"), gantt_helper_1 = require("../gantt-helper"),
|
|
7
|
+
const vrender_1 = require("@visactor/vtable/es/vrender"), util_1 = require("../tools/util"), vutils_1 = require("@visactor/vutils"), gantt_helper_1 = require("../gantt-helper"), gantt_node_1 = require("./gantt-node"), TASKBAR_HOVER_ICON = '<svg width="100" height="200" xmlns="http://www.w3.org/2000/svg">\n <line x1="30" y1="10" x2="30" y2="190" stroke="black" stroke-width="4"/>\n <line x1="70" y1="10" x2="70" y2="190" stroke="black" stroke-width="4"/>\n</svg>';
|
|
8
8
|
|
|
9
9
|
exports.TASKBAR_HOVER_ICON_WIDTH = 10;
|
|
10
10
|
|
|
11
11
|
class TaskBar {
|
|
12
12
|
constructor(scene) {
|
|
13
|
-
this.
|
|
14
|
-
this.group = new vrender_1.Group({
|
|
13
|
+
this.selectedBorders = [], this._scene = scene, this.width = scene._gantt.tableNoFrameWidth,
|
|
14
|
+
this.height = scene._gantt.gridHeight, this.group = new vrender_1.Group({
|
|
15
15
|
x: 0,
|
|
16
16
|
y: scene._gantt.getAllHeaderRowsHeight(),
|
|
17
17
|
width: this.width,
|
|
@@ -38,9 +38,9 @@ class TaskBar {
|
|
|
38
38
|
initBar(index) {
|
|
39
39
|
var _a, _b;
|
|
40
40
|
const taskBarCustomLayout = this._scene._gantt.parsedOptions.taskBarCustomLayout, {startDate: startDate, endDate: endDate, taskDays: taskDays, progress: progress, taskRecord: taskRecord} = this._scene._gantt.getTaskInfoByTaskListIndex(index);
|
|
41
|
-
if (taskDays <= 0) return null;
|
|
41
|
+
if (taskDays <= 0 || !startDate || !endDate) return null;
|
|
42
42
|
const taskBarSize = this._scene._gantt.parsedOptions.colWidthPerDay * taskDays, taskbarHeight = this._scene._gantt.parsedOptions.taskBarStyle.width, minDate = (0,
|
|
43
|
-
util_1.createDateAtMidnight)(this._scene._gantt.parsedOptions.minDate), barGroup = new
|
|
43
|
+
util_1.createDateAtMidnight)(this._scene._gantt.parsedOptions.minDate), barGroup = new gantt_node_1.GanttTaskBarNode({
|
|
44
44
|
x: this._scene._gantt.parsedOptions.colWidthPerDay * Math.ceil(Math.abs(startDate.getTime() - minDate.getTime()) / 864e5),
|
|
45
45
|
y: this._scene._gantt.parsedOptions.rowHeight * index + (this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,
|
|
46
46
|
width: taskBarSize,
|
|
@@ -49,7 +49,7 @@ class TaskBar {
|
|
|
49
49
|
clip: !0
|
|
50
50
|
});
|
|
51
51
|
let rootContainer;
|
|
52
|
-
barGroup.name = "task-bar";
|
|
52
|
+
barGroup.name = "task-bar", barGroup.id = index;
|
|
53
53
|
let renderDefaultBar = !0, renderDefaultText = !0;
|
|
54
54
|
if (taskBarCustomLayout) {
|
|
55
55
|
let customLayoutObj;
|
|
@@ -196,6 +196,99 @@ class TaskBar {
|
|
|
196
196
|
hideHoverBar() {
|
|
197
197
|
this.hoverBarGroup.setAttribute("visibleAll", !1);
|
|
198
198
|
}
|
|
199
|
+
createSelectedBorder(x, y, width, height, attachedToTaskBarNode, showLinkPoint = !1) {
|
|
200
|
+
var _a;
|
|
201
|
+
const selectedBorder = new vrender_1.Group({
|
|
202
|
+
x: x,
|
|
203
|
+
y: y,
|
|
204
|
+
width: width,
|
|
205
|
+
height: height,
|
|
206
|
+
lineWidth: this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderLineWidth,
|
|
207
|
+
pickable: !1,
|
|
208
|
+
cornerRadius: null !== (_a = this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius) && void 0 !== _a ? _a : 0,
|
|
209
|
+
fill: !1,
|
|
210
|
+
stroke: this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderColor,
|
|
211
|
+
shadowColor: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowColor,
|
|
212
|
+
shadowOffsetX: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetX,
|
|
213
|
+
shadowOffsetY: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetY,
|
|
214
|
+
shadowBlur: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowBlur,
|
|
215
|
+
attachedToTaskBarNode: attachedToTaskBarNode
|
|
216
|
+
});
|
|
217
|
+
if (selectedBorder.name = "task-bar-select-border", this.barContainer.appendChild(selectedBorder),
|
|
218
|
+
this.selectedBorders.push(selectedBorder), showLinkPoint) {
|
|
219
|
+
const linkPointContainer = new vrender_1.Group({
|
|
220
|
+
x: -10,
|
|
221
|
+
y: 0,
|
|
222
|
+
width: 10,
|
|
223
|
+
height: height,
|
|
224
|
+
pickable: !0
|
|
225
|
+
}), linkPoint = new vrender_1.Circle({
|
|
226
|
+
x: 5,
|
|
227
|
+
y: height / 2,
|
|
228
|
+
radius: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,
|
|
229
|
+
fill: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,
|
|
230
|
+
stroke: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,
|
|
231
|
+
lineWidth: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,
|
|
232
|
+
pickable: !1
|
|
233
|
+
});
|
|
234
|
+
linkPointContainer.appendChild(linkPoint), linkPointContainer.name = "task-bar-link-point-left",
|
|
235
|
+
selectedBorder.appendChild(linkPointContainer);
|
|
236
|
+
const linkPointContainer1 = new vrender_1.Group({
|
|
237
|
+
x: width,
|
|
238
|
+
y: 0,
|
|
239
|
+
width: 10,
|
|
240
|
+
height: height,
|
|
241
|
+
pickable: !0
|
|
242
|
+
}), linkPoint1 = new vrender_1.Circle({
|
|
243
|
+
x: 5,
|
|
244
|
+
y: height / 2,
|
|
245
|
+
radius: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,
|
|
246
|
+
fill: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,
|
|
247
|
+
stroke: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,
|
|
248
|
+
lineWidth: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,
|
|
249
|
+
pickable: !1,
|
|
250
|
+
pickStrokeBuffer: 10
|
|
251
|
+
});
|
|
252
|
+
linkPointContainer1.appendChild(linkPoint1), linkPointContainer1.name = "task-bar-link-point-right",
|
|
253
|
+
selectedBorder.appendChild(linkPointContainer1);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
removeSelectedBorder() {
|
|
257
|
+
this.selectedBorders.forEach((border => {
|
|
258
|
+
border.delete();
|
|
259
|
+
})), this.selectedBorders = [];
|
|
260
|
+
}
|
|
261
|
+
removeSecondSelectedBorder() {
|
|
262
|
+
if (2 === this.selectedBorders.length) {
|
|
263
|
+
this.selectedBorders.pop().delete();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
updateCreatingDependencyLine(x1, y1, x2, y2) {
|
|
267
|
+
this.creatingDependencyLine && (this.creatingDependencyLine.delete(), this.creatingDependencyLine = void 0);
|
|
268
|
+
const line = new vrender_1.Line({
|
|
269
|
+
points: [ {
|
|
270
|
+
x: x1,
|
|
271
|
+
y: y1
|
|
272
|
+
}, {
|
|
273
|
+
x: x2,
|
|
274
|
+
y: y2
|
|
275
|
+
} ],
|
|
276
|
+
stroke: this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineColor,
|
|
277
|
+
lineWidth: this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineWidth,
|
|
278
|
+
lineDash: this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineDash,
|
|
279
|
+
pickable: !1
|
|
280
|
+
});
|
|
281
|
+
this.creatingDependencyLine = line, this.selectedBorders[0].appendChild(line);
|
|
282
|
+
}
|
|
283
|
+
getTaskBarNodeByIndex(index) {
|
|
284
|
+
let c = this.barContainer.firstChild;
|
|
285
|
+
if (!c) return null;
|
|
286
|
+
for (let i = 0; i < this.barContainer.childrenCount; i++) {
|
|
287
|
+
if (c.id === index) return c;
|
|
288
|
+
c = c._next;
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
199
292
|
}
|
|
200
293
|
|
|
201
294
|
exports.TaskBar = TaskBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/task-bar.ts"],"names":[],"mappings":";;;AAAA,yDAAmF;AAGnF,wCAAsF;AACtF,6CAA2C;AAC3C,kDAA6C;AAC7C,2CAA+C;AAE/C,MAAM,kBAAkB,GAAG;;;OAGpB,CAAC;AACK,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAE3C,MAAa,OAAO;IASlB,YAAY,KAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QACtC,IAAI,CAA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,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;SACpF;IACH,CAAC;IACD,YAAY;QACV,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;CACF;AAjSD,0BAiSC","file":"task-bar.js","sourcesContent":["import { Group, createText, createRect, Image } from '@visactor/vtable/es/vrender';\nimport type { Scenegraph } from './scenegraph';\n// import { Icon } from './icon';\nimport { createDateAtMidnight, parseStringTemplate, toBoxArray } from '../tools/util';\nimport { isValid } from '@visactor/vutils';\nimport { getTextPos } from '../gantt-helper';\nimport { GanttTaskBarNode } from './ganttNode';\n\nconst TASKBAR_HOVER_ICON = `<svg width=\"100\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"30\" y1=\"10\" x2=\"30\" y2=\"190\" stroke=\"black\" stroke-width=\"4\"/>\n <line x1=\"70\" y1=\"10\" x2=\"70\" y2=\"190\" stroke=\"black\" stroke-width=\"4\"/>\n</svg>`;\nexport const TASKBAR_HOVER_ICON_WIDTH = 10;\n\nexport class TaskBar {\n group: Group;\n barContainer: Group;\n hoverBarGroup: Group;\n hoverBarLeftIcon: Image;\n hoverBarRightIcon: Image;\n _scene: Scenegraph;\n width: number;\n height: number;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n // const height = Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight);\n this.width = scene._gantt.tableNoFrameWidth;\n this.height = scene._gantt.gridHeight;\n this.group = new Group({\n x: 0,\n y: scene._gantt.getAllHeaderRowsHeight(),\n width: this.width,\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.name = 'task-bar-container';\n scene.tableGroup.addChild(this.group);\n this.initBars();\n this.initHoverBarIcons();\n }\n\n initBars() {\n this.barContainer = new Group({\n x: 0,\n y: 0,\n width: this._scene._gantt._getAllColsWidth(),\n height: this._scene._gantt.getAllTaskBarsHeight(),\n pickable: false,\n clip: true\n });\n this.group.appendChild(this.barContainer);\n\n for (let i = 0; i < this._scene._gantt.itemCount; i++) {\n const barGroup = this.initBar(i);\n if (barGroup) {\n this.barContainer.appendChild(barGroup);\n }\n }\n }\n initBar(index: number) {\n const taskBarCustomLayout = this._scene._gantt.parsedOptions.taskBarCustomLayout;\n const { startDate, endDate, taskDays, progress, taskRecord } = this._scene._gantt.getTaskInfoByTaskListIndex(index);\n if (taskDays <= 0) {\n return null;\n }\n const taskBarSize = this._scene._gantt.parsedOptions.colWidthPerDay * taskDays;\n const taskbarHeight = this._scene._gantt.parsedOptions.taskBarStyle.width;\n const minDate = createDateAtMidnight(this._scene._gantt.parsedOptions.minDate);\n const barGroup = new GanttTaskBarNode({\n x:\n this._scene._gantt.parsedOptions.colWidthPerDay *\n Math.ceil(Math.abs(startDate.getTime() - minDate.getTime()) / (1000 * 60 * 60 * 24)),\n // y: this._scene._gantt.parsedOptions.rowHeight * i,\n y:\n this._scene._gantt.parsedOptions.rowHeight * index +\n (this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: taskBarSize,\n // height: this._scene._gantt.parsedOptions.rowHeight,\n height: taskbarHeight,\n cornerRadius: this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius,\n clip: true\n });\n barGroup.name = 'task-bar';\n // this.barContainer.appendChild(barGroup);\n let rootContainer;\n let renderDefaultBar = true;\n let renderDefaultText = true;\n\n if (taskBarCustomLayout) {\n let customLayoutObj;\n if (typeof taskBarCustomLayout === 'function') {\n const arg = {\n width: taskBarSize,\n height: taskbarHeight,\n index,\n startDate,\n endDate,\n taskDays,\n progress,\n taskRecord,\n ganttInstance: this._scene._gantt\n };\n customLayoutObj = taskBarCustomLayout(arg);\n } else {\n customLayoutObj = taskBarCustomLayout;\n }\n if (customLayoutObj) {\n // if (customLayoutObj.rootContainer) {\n // customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);\n // }\n rootContainer = customLayoutObj.rootContainer;\n renderDefaultBar = customLayoutObj.renderDefaultBar ?? false;\n renderDefaultText = customLayoutObj.renderDefaultText ?? false;\n rootContainer.name = 'task-bar-custom-render';\n }\n }\n\n if (renderDefaultBar) {\n // 创建整个任务条rect\n const rect = createRect({\n x: 0,\n y: 0, //this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: taskBarSize,\n height: taskbarHeight,\n fill: this._scene._gantt.parsedOptions.taskBarStyle.barColor,\n pickable: false\n });\n rect.name = 'task-bar-rect';\n barGroup.appendChild(rect);\n barGroup.barRect = rect;\n // 创建已完成部分任务条rect\n const progress_rect = createRect({\n x: 0,\n y: 0, //(this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: (taskBarSize * progress) / 100,\n height: taskbarHeight,\n fill: this._scene._gantt.parsedOptions.taskBarStyle.completedBarColor,\n pickable: false\n });\n progress_rect.name = 'task-bar-progress-rect';\n barGroup.appendChild(progress_rect);\n barGroup.progressRect = progress_rect;\n }\n\n rootContainer && barGroup.appendChild(rootContainer);\n if (renderDefaultText) {\n const { textAlign, textBaseline, fontSize, fontFamily, textOverflow, color, padding } =\n this._scene._gantt.parsedOptions.taskBarLabelStyle;\n const position = getTextPos(toBoxArray(padding), textAlign, textBaseline, taskBarSize, taskbarHeight);\n //创建label 文字\n const label = createText({\n // visible: false,\n // pickable: false,\n x: position.x, //extAlign === 'center' ? taskBarSize / 2 : textAlign === 'left' ? 10 : taskBarSize - 10,\n y: position.y, //fontSize / 2,\n fontSize: fontSize, // 10\n fill: color,\n fontFamily: fontFamily,\n text: parseStringTemplate(this._scene._gantt.parsedOptions.taskBarLabelText as string, taskRecord),\n maxLineWidth: taskBarSize - TASKBAR_HOVER_ICON_WIDTH,\n textBaseline,\n textAlign,\n ellipsis:\n textOverflow === 'clip'\n ? ''\n : textOverflow === 'ellipsis'\n ? '...'\n : isValid(textOverflow)\n ? textOverflow\n : undefined,\n poptip: {\n position: 'bottom',\n dx: (taskBarSize - TASKBAR_HOVER_ICON_WIDTH) / 4\n }\n // dx: 12 + 4,\n // dy: this._scene._gantt.barLabelStyle.fontSize / 2\n });\n barGroup.appendChild(label);\n barGroup.textLabel = label;\n }\n return barGroup;\n }\n updateTaskBarNode(index: number) {\n const taskbarGroup = this.barContainer.getChildren()?.[index] as GanttTaskBarNode;\n if (taskbarGroup) {\n this.barContainer.removeChild(taskbarGroup);\n const barGroup = this.initBar(index);\n if (barGroup) {\n this.barContainer.insertInto(barGroup, index); //TODO\n }\n }\n }\n initHoverBarIcons() {\n // const target = this._scene._gantt.stateManager.hoverTaskBar.target;\n\n // const barGroup = new Group({\n // x: target.attribute.x,\n // y: target.attribute.y,\n // width: target.attribute.width,\n // height: target.attribute.height,\n // cornerRadius: target.attribute.cornerRadius,\n // clip: true,\n // cursor: 'grab'\n // });\n const hoverBarGroup = new Group({\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n clip: true,\n cursor: this._scene._gantt.parsedOptions.taskBarMoveable ? 'grab' : 'default',\n pickable: false,\n cornerRadius:\n this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius ??\n this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius ??\n 0,\n fill: this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,\n visibleAll: false\n });\n this.hoverBarGroup = hoverBarGroup;\n hoverBarGroup.name = 'task-bar-hover-shadow';\n // this.barContainer.appendChild(hoverBarGroup);\n // 创建左侧的icon\n if (this._scene._gantt.parsedOptions.taskBarResizable) {\n const icon = new Image({\n x: 0,\n y: 0, //this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: TASKBAR_HOVER_ICON_WIDTH,\n height: 20,\n image: TASKBAR_HOVER_ICON,\n pickable: true,\n cursor: 'col-resize'\n });\n icon.name = 'task-bar-hover-shadow-left-icon';\n this.hoverBarLeftIcon = icon;\n hoverBarGroup.appendChild(icon);\n\n // 创建右侧的icon\n const rightIcon = new Image({\n x: 0,\n y: 0, //this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: TASKBAR_HOVER_ICON_WIDTH,\n height: 20,\n image: TASKBAR_HOVER_ICON,\n pickable: true,\n cursor: 'col-resize'\n });\n rightIcon.name = 'task-bar-hover-shadow-right-icon';\n this.hoverBarRightIcon = rightIcon;\n hoverBarGroup.appendChild(rightIcon);\n }\n }\n setX(x: number) {\n this.barContainer.setAttribute('x', x);\n }\n setY(y: number) {\n this.barContainer.setAttribute('y', y);\n }\n /** 重新创建任务条节点 */\n refresh() {\n this.width = this._scene._gantt.tableNoFrameWidth;\n this.height = this._scene._gantt.gridHeight;\n this.group.setAttributes({\n height: this.height,\n width: this.width,\n y: this._scene._gantt.getAllHeaderRowsHeight()\n });\n this.barContainer.removeAllChild();\n this.group.removeChild(this.barContainer);\n this.initBars();\n }\n resize() {\n this.width = this._scene._gantt.tableNoFrameWidth;\n this.height = this._scene._gantt.gridHeight;\n this.group.setAttribute('width', this.width);\n this.group.setAttribute('height', this.height);\n }\n\n showHoverBar(x: number, y: number, width: number, height: number, target?: Group) {\n if (target && target.name === 'task-bar') {\n // this.hoverBarGroup.releatedTaskBar = target;\n target.appendChild(this.hoverBarGroup);\n }\n this.hoverBarGroup.setAttribute('x', 0);\n this.hoverBarGroup.setAttribute('y', 0);\n this.hoverBarGroup.setAttribute('width', width);\n this.hoverBarGroup.setAttribute('height', height);\n this.hoverBarGroup.setAttribute('visibleAll', true);\n if (this.hoverBarLeftIcon) {\n this.hoverBarLeftIcon.setAttribute('x', 0);\n this.hoverBarLeftIcon.setAttribute('y', Math.ceil(height / 10));\n this.hoverBarLeftIcon.setAttribute('width', TASKBAR_HOVER_ICON_WIDTH);\n this.hoverBarLeftIcon.setAttribute('height', height - 2 * Math.ceil(height / 10));\n this.hoverBarRightIcon.setAttribute('x', width - TASKBAR_HOVER_ICON_WIDTH);\n this.hoverBarRightIcon.setAttribute('y', Math.ceil(height / 10));\n this.hoverBarRightIcon.setAttribute('width', TASKBAR_HOVER_ICON_WIDTH);\n this.hoverBarRightIcon.setAttribute('height', height - 2 * Math.ceil(height / 10));\n }\n }\n hideHoverBar() {\n this.hoverBarGroup.setAttribute('visibleAll', false);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/task-bar.ts"],"names":[],"mappings":";;;AAAA,yDAAuG;AAGvG,wCAAsF;AACtF,6CAA2C;AAC3C,kDAA6C;AAC7C,6CAAgD;AAEhD,MAAM,kBAAkB,GAAG;;;OAGpB,CAAC;AACK,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAE3C,MAAa,OAAO;IAWlB,YAAY,KAAiB;QAD7B,oBAAe,GAAY,EAAE,CAAC;QAE5B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC;YACrB,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE;YACxC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACvC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,YAAY,GAAG,IAAI,eAAK,CAAC;YAC5B,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAA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AAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,UAAmB,CAAC;QAC9C,IAAI,CAAC,CAAC,EAAE;YACN,OAAO,IAAI,CAAC;SACb;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE;YACxD,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,EAAE;gBAClB,OAAO,CAAC,CAAC;aACV;YACD,CAAC,GAAG,CAAC,CAAC,KAAc,CAAC;SACtB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9YD,0BA8YC","file":"task-bar.js","sourcesContent":["import { Group, createText, createRect, Image, Circle, Line, Rect } from '@visactor/vtable/es/vrender';\nimport type { Scenegraph } from './scenegraph';\n// import { Icon } from './icon';\nimport { createDateAtMidnight, parseStringTemplate, toBoxArray } from '../tools/util';\nimport { isValid } from '@visactor/vutils';\nimport { getTextPos } from '../gantt-helper';\nimport { GanttTaskBarNode } from './gantt-node';\n\nconst TASKBAR_HOVER_ICON = `<svg width=\"100\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"30\" y1=\"10\" x2=\"30\" y2=\"190\" stroke=\"black\" stroke-width=\"4\"/>\n <line x1=\"70\" y1=\"10\" x2=\"70\" y2=\"190\" stroke=\"black\" stroke-width=\"4\"/>\n</svg>`;\nexport const TASKBAR_HOVER_ICON_WIDTH = 10;\n\nexport class TaskBar {\n group: Group;\n barContainer: Group;\n hoverBarGroup: Group;\n creatingDependencyLine: Line;\n hoverBarLeftIcon: Image;\n hoverBarRightIcon: Image;\n _scene: Scenegraph;\n width: number;\n height: number;\n selectedBorders: Group[] = [];\n constructor(scene: Scenegraph) {\n this._scene = scene;\n // const height = Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight);\n this.width = scene._gantt.tableNoFrameWidth;\n this.height = scene._gantt.gridHeight;\n this.group = new Group({\n x: 0,\n y: scene._gantt.getAllHeaderRowsHeight(),\n width: this.width,\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.name = 'task-bar-container';\n scene.tableGroup.addChild(this.group);\n this.initBars();\n this.initHoverBarIcons();\n }\n\n initBars() {\n this.barContainer = new Group({\n x: 0,\n y: 0,\n width: this._scene._gantt._getAllColsWidth(),\n height: this._scene._gantt.getAllTaskBarsHeight(),\n pickable: false,\n clip: true\n });\n this.group.appendChild(this.barContainer);\n\n for (let i = 0; i < this._scene._gantt.itemCount; i++) {\n const barGroup = this.initBar(i);\n if (barGroup) {\n this.barContainer.appendChild(barGroup);\n }\n }\n }\n initBar(index: number) {\n const taskBarCustomLayout = this._scene._gantt.parsedOptions.taskBarCustomLayout;\n const { startDate, endDate, taskDays, progress, taskRecord } = this._scene._gantt.getTaskInfoByTaskListIndex(index);\n if (taskDays <= 0 || !startDate || !endDate) {\n return null;\n }\n const taskBarSize = this._scene._gantt.parsedOptions.colWidthPerDay * taskDays;\n const taskbarHeight = this._scene._gantt.parsedOptions.taskBarStyle.width;\n const minDate = createDateAtMidnight(this._scene._gantt.parsedOptions.minDate);\n const barGroup = new GanttTaskBarNode({\n x:\n this._scene._gantt.parsedOptions.colWidthPerDay *\n Math.ceil(Math.abs(startDate.getTime() - minDate.getTime()) / (1000 * 60 * 60 * 24)),\n // y: this._scene._gantt.parsedOptions.rowHeight * i,\n y:\n this._scene._gantt.parsedOptions.rowHeight * index +\n (this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: taskBarSize,\n // height: this._scene._gantt.parsedOptions.rowHeight,\n height: taskbarHeight,\n cornerRadius: this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius,\n clip: true\n });\n barGroup.name = 'task-bar';\n barGroup.id = index;\n // this.barContainer.appendChild(barGroup);\n let rootContainer;\n let renderDefaultBar = true;\n let renderDefaultText = true;\n\n if (taskBarCustomLayout) {\n let customLayoutObj;\n if (typeof taskBarCustomLayout === 'function') {\n const arg = {\n width: taskBarSize,\n height: taskbarHeight,\n index,\n startDate,\n endDate,\n taskDays,\n progress,\n taskRecord,\n ganttInstance: this._scene._gantt\n };\n customLayoutObj = taskBarCustomLayout(arg);\n } else {\n customLayoutObj = taskBarCustomLayout;\n }\n if (customLayoutObj) {\n // if (customLayoutObj.rootContainer) {\n // customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);\n // }\n rootContainer = customLayoutObj.rootContainer;\n renderDefaultBar = customLayoutObj.renderDefaultBar ?? false;\n renderDefaultText = customLayoutObj.renderDefaultText ?? false;\n rootContainer.name = 'task-bar-custom-render';\n }\n }\n\n if (renderDefaultBar) {\n // 创建整个任务条rect\n const rect = createRect({\n x: 0,\n y: 0, //this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: taskBarSize,\n height: taskbarHeight,\n fill: this._scene._gantt.parsedOptions.taskBarStyle.barColor,\n pickable: false\n });\n rect.name = 'task-bar-rect';\n barGroup.appendChild(rect);\n barGroup.barRect = rect;\n // 创建已完成部分任务条rect\n const progress_rect = createRect({\n x: 0,\n y: 0, //(this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: (taskBarSize * progress) / 100,\n height: taskbarHeight,\n fill: this._scene._gantt.parsedOptions.taskBarStyle.completedBarColor,\n pickable: false\n });\n progress_rect.name = 'task-bar-progress-rect';\n barGroup.appendChild(progress_rect);\n barGroup.progressRect = progress_rect;\n }\n\n rootContainer && barGroup.appendChild(rootContainer);\n if (renderDefaultText) {\n const { textAlign, textBaseline, fontSize, fontFamily, textOverflow, color, padding } =\n this._scene._gantt.parsedOptions.taskBarLabelStyle;\n const position = getTextPos(toBoxArray(padding), textAlign, textBaseline, taskBarSize, taskbarHeight);\n //创建label 文字\n const label = createText({\n // visible: false,\n // pickable: false,\n x: position.x, //extAlign === 'center' ? taskBarSize / 2 : textAlign === 'left' ? 10 : taskBarSize - 10,\n y: position.y, //fontSize / 2,\n fontSize: fontSize, // 10\n fill: color,\n fontFamily: fontFamily,\n text: parseStringTemplate(this._scene._gantt.parsedOptions.taskBarLabelText as string, taskRecord),\n maxLineWidth: taskBarSize - TASKBAR_HOVER_ICON_WIDTH,\n textBaseline,\n textAlign,\n ellipsis:\n textOverflow === 'clip'\n ? ''\n : textOverflow === 'ellipsis'\n ? '...'\n : isValid(textOverflow)\n ? textOverflow\n : undefined,\n poptip: {\n position: 'bottom',\n dx: (taskBarSize - TASKBAR_HOVER_ICON_WIDTH) / 4\n }\n // dx: 12 + 4,\n // dy: this._scene._gantt.barLabelStyle.fontSize / 2\n });\n barGroup.appendChild(label);\n barGroup.textLabel = label;\n }\n return barGroup;\n }\n updateTaskBarNode(index: number) {\n const taskbarGroup = this.barContainer.getChildren()?.[index] as GanttTaskBarNode;\n if (taskbarGroup) {\n this.barContainer.removeChild(taskbarGroup);\n const barGroup = this.initBar(index);\n if (barGroup) {\n this.barContainer.insertInto(barGroup, index); //TODO\n }\n }\n }\n initHoverBarIcons() {\n const hoverBarGroup = new Group({\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n clip: true,\n cursor: this._scene._gantt.parsedOptions.taskBarMoveable ? 'grab' : 'default',\n pickable: false,\n cornerRadius:\n this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius ??\n this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius ??\n 0,\n fill: this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,\n visibleAll: false\n });\n this.hoverBarGroup = hoverBarGroup;\n hoverBarGroup.name = 'task-bar-hover-shadow';\n // this.barContainer.appendChild(hoverBarGroup);\n // 创建左侧的icon\n if (this._scene._gantt.parsedOptions.taskBarResizable) {\n const icon = new Image({\n x: 0,\n y: 0, //this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: TASKBAR_HOVER_ICON_WIDTH,\n height: 20,\n image: TASKBAR_HOVER_ICON,\n pickable: true,\n cursor: 'col-resize'\n });\n icon.name = 'task-bar-hover-shadow-left-icon';\n this.hoverBarLeftIcon = icon;\n hoverBarGroup.appendChild(icon);\n\n // 创建右侧的icon\n const rightIcon = new Image({\n x: 0,\n y: 0, //this._scene._gantt.parsedOptions.rowHeight - taskbarHeight) / 2,\n width: TASKBAR_HOVER_ICON_WIDTH,\n height: 20,\n image: TASKBAR_HOVER_ICON,\n pickable: true,\n cursor: 'col-resize'\n });\n rightIcon.name = 'task-bar-hover-shadow-right-icon';\n this.hoverBarRightIcon = rightIcon;\n hoverBarGroup.appendChild(rightIcon);\n }\n }\n\n setX(x: number) {\n this.barContainer.setAttribute('x', x);\n }\n setY(y: number) {\n this.barContainer.setAttribute('y', y);\n }\n /** 重新创建任务条节点 */\n refresh() {\n this.width = this._scene._gantt.tableNoFrameWidth;\n this.height = this._scene._gantt.gridHeight;\n this.group.setAttributes({\n height: this.height,\n width: this.width,\n y: this._scene._gantt.getAllHeaderRowsHeight()\n });\n this.barContainer.removeAllChild();\n this.group.removeChild(this.barContainer);\n this.initBars();\n }\n resize() {\n this.width = this._scene._gantt.tableNoFrameWidth;\n this.height = this._scene._gantt.gridHeight;\n this.group.setAttribute('width', this.width);\n this.group.setAttribute('height', this.height);\n }\n\n showHoverBar(x: number, y: number, width: number, height: number, target?: Group) {\n if (target && target.name === 'task-bar') {\n // this.hoverBarGroup.releatedTaskBar = target;\n target.appendChild(this.hoverBarGroup);\n }\n this.hoverBarGroup.setAttribute('x', 0);\n this.hoverBarGroup.setAttribute('y', 0);\n this.hoverBarGroup.setAttribute('width', width);\n this.hoverBarGroup.setAttribute('height', height);\n this.hoverBarGroup.setAttribute('visibleAll', true);\n if (this.hoverBarLeftIcon) {\n this.hoverBarLeftIcon.setAttribute('x', 0);\n this.hoverBarLeftIcon.setAttribute('y', Math.ceil(height / 10));\n this.hoverBarLeftIcon.setAttribute('width', TASKBAR_HOVER_ICON_WIDTH);\n this.hoverBarLeftIcon.setAttribute('height', height - 2 * Math.ceil(height / 10));\n this.hoverBarRightIcon.setAttribute('x', width - TASKBAR_HOVER_ICON_WIDTH);\n this.hoverBarRightIcon.setAttribute('y', Math.ceil(height / 10));\n this.hoverBarRightIcon.setAttribute('width', TASKBAR_HOVER_ICON_WIDTH);\n this.hoverBarRightIcon.setAttribute('height', height - 2 * Math.ceil(height / 10));\n }\n }\n hideHoverBar() {\n this.hoverBarGroup.setAttribute('visibleAll', false);\n }\n\n createSelectedBorder(\n x: number,\n y: number,\n width: number,\n height: number,\n attachedToTaskBarNode: GanttTaskBarNode,\n showLinkPoint: boolean = false\n ) {\n const selectedBorder = new Group({\n x,\n y,\n width,\n height,\n lineWidth: this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderLineWidth,\n pickable: false,\n cornerRadius: this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius ?? 0,\n fill: false,\n stroke: this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderColor,\n shadowColor: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowColor,\n shadowOffsetX: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetX,\n shadowOffsetY: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetY,\n shadowBlur: this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowBlur,\n attachedToTaskBarNode: attachedToTaskBarNode\n });\n selectedBorder.name = 'task-bar-select-border';\n this.barContainer.appendChild(selectedBorder);\n this.selectedBorders.push(selectedBorder);\n\n if (showLinkPoint) {\n const linkPointContainer = new Group({\n x: -10,\n y: 0,\n width: 10,\n height: height,\n pickable: true\n });\n const linkPoint = new Circle({\n x: 5,\n y: height / 2,\n radius: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,\n fill: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,\n stroke: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,\n lineWidth: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,\n pickable: false\n });\n linkPointContainer.appendChild(linkPoint);\n linkPointContainer.name = 'task-bar-link-point-left';\n selectedBorder.appendChild(linkPointContainer);\n\n const linkPointContainer1 = new Group({\n x: width,\n y: 0,\n width: 10,\n height: height,\n pickable: true\n });\n const linkPoint1 = new Circle({\n x: 5,\n y: height / 2,\n radius: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,\n fill: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,\n stroke: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,\n lineWidth: this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,\n pickable: false,\n pickStrokeBuffer: 10\n });\n linkPointContainer1.appendChild(linkPoint1);\n linkPointContainer1.name = 'task-bar-link-point-right';\n selectedBorder.appendChild(linkPointContainer1);\n }\n }\n removeSelectedBorder() {\n this.selectedBorders.forEach(border => {\n border.delete();\n });\n this.selectedBorders = [];\n }\n removeSecondSelectedBorder() {\n if (this.selectedBorders.length === 2) {\n const secondBorder = this.selectedBorders.pop();\n secondBorder.delete();\n }\n }\n updateCreatingDependencyLine(x1: number, y1: number, x2: number, y2: number) {\n if (this.creatingDependencyLine) {\n this.creatingDependencyLine.delete();\n this.creatingDependencyLine = undefined;\n }\n const line = new Line({\n points: [\n { x: x1, y: y1 },\n { x: x2, y: y2 }\n ],\n stroke: this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineColor,\n lineWidth: this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineWidth,\n lineDash: this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineDash,\n pickable: false\n });\n this.creatingDependencyLine = line;\n this.selectedBorders[0].appendChild(line);\n }\n\n getTaskBarNodeByIndex(index: number) {\n let c = this.barContainer.firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.barContainer.childrenCount; i++) {\n if (c.id === index) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Group } from '@visactor/vtable/es/vrender';
|
|
2
|
+
import type { ILine } from '@visactor/vtable/es/vrender';
|
|
3
|
+
import type { Scenegraph } from './scenegraph';
|
|
4
|
+
export declare class TaskCreationButton {
|
|
5
|
+
_scene: Scenegraph;
|
|
6
|
+
group: Group;
|
|
7
|
+
lineVertical: ILine;
|
|
8
|
+
lineHorizontal: ILine;
|
|
9
|
+
constructor(scene: Scenegraph);
|
|
10
|
+
createAddButton(): void;
|
|
11
|
+
show(x: number, y: number, width: number, height: number): void;
|
|
12
|
+
hide(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.TaskCreationButton = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_1 = require("@visactor/vtable/es/vrender");
|
|
8
|
+
|
|
9
|
+
class TaskCreationButton {
|
|
10
|
+
constructor(scene) {
|
|
11
|
+
this._scene = scene, this.createAddButton();
|
|
12
|
+
}
|
|
13
|
+
createAddButton() {
|
|
14
|
+
var _a;
|
|
15
|
+
this._scene._gantt.parsedOptions.taskBarCreationCustomLayout ? this.group = new vrender_1.Group({
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 100,
|
|
19
|
+
height: 100
|
|
20
|
+
}) : (this.group = new vrender_1.Group({
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
width: 100,
|
|
24
|
+
height: 100,
|
|
25
|
+
lineDash: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineDash,
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
lineWidth: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,
|
|
28
|
+
stroke: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,
|
|
29
|
+
cornerRadius: null !== (_a = this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.cornerRadius) && void 0 !== _a ? _a : 0,
|
|
30
|
+
fill: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.backgroundColor
|
|
31
|
+
}), this.lineVertical = (0, vrender_1.createLine)({
|
|
32
|
+
pickable: !1,
|
|
33
|
+
stroke: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,
|
|
34
|
+
lineWidth: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,
|
|
35
|
+
points: [ {
|
|
36
|
+
x: 50,
|
|
37
|
+
y: 0
|
|
38
|
+
}, {
|
|
39
|
+
x: 50,
|
|
40
|
+
y: 100
|
|
41
|
+
} ]
|
|
42
|
+
}), this.group.appendChild(this.lineVertical), this.lineHorizontal = (0, vrender_1.createLine)({
|
|
43
|
+
pickable: !1,
|
|
44
|
+
stroke: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,
|
|
45
|
+
lineWidth: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,
|
|
46
|
+
points: [ {
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 50
|
|
49
|
+
}, {
|
|
50
|
+
x: 100,
|
|
51
|
+
y: 50
|
|
52
|
+
} ]
|
|
53
|
+
}), this.group.appendChild(this.lineHorizontal)), this.group.name = "task-creation-button",
|
|
54
|
+
this._scene.taskBar.group.addChild(this.group);
|
|
55
|
+
}
|
|
56
|
+
show(x, y, width, height) {
|
|
57
|
+
if (this._scene._gantt.parsedOptions.taskBarCreationCustomLayout) this.group.appendChild(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout({
|
|
58
|
+
width: width,
|
|
59
|
+
height: height,
|
|
60
|
+
ganttInstance: this._scene._gantt
|
|
61
|
+
}).rootContainer); else {
|
|
62
|
+
const lineSize = Math.min(width, height) / 6;
|
|
63
|
+
this.lineHorizontal.setAttribute("points", [ {
|
|
64
|
+
x: (width - 4 * lineSize) / 2,
|
|
65
|
+
y: height / 2
|
|
66
|
+
}, {
|
|
67
|
+
x: (width - 4 * lineSize) / 2 + 4 * lineSize,
|
|
68
|
+
y: height / 2
|
|
69
|
+
} ]), this.lineVertical.setAttribute("points", [ {
|
|
70
|
+
x: width / 2,
|
|
71
|
+
y: (height - 4 * lineSize) / 2
|
|
72
|
+
}, {
|
|
73
|
+
x: width / 2,
|
|
74
|
+
y: (height - 4 * lineSize) / 2 + 4 * lineSize
|
|
75
|
+
} ]);
|
|
76
|
+
}
|
|
77
|
+
this.group.setAttribute("x", x), this.group.setAttribute("y", y), this.group.setAttribute("width", width),
|
|
78
|
+
this.group.setAttribute("height", height), this.group.setAttribute("visibleAll", !0);
|
|
79
|
+
}
|
|
80
|
+
hide() {
|
|
81
|
+
this.group.setAttribute("visibleAll", !1), this._scene._gantt.parsedOptions.taskBarCreationCustomLayout && this.group.removeAllChild();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
exports.TaskCreationButton = TaskCreationButton;
|
|
86
|
+
//# sourceMappingURL=task-creation-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/task-creation-button.ts"],"names":[],"mappings":";;;AAAA,yDAAgE;AAKhE,MAAa,kBAAkB;IAK7B,YAAY,KAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IACD,eAAe;;QACb,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,2BAA2B,EAAE;YAChE,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC;gBACrB,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC;gBACrB,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,KAAK,EAAE,GAAG;gBACV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AAC;YAEH,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,QAAQ,EAAE;gBACvC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE;gBAChD,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAC,EAAE;aAChE,CAAC,CAAC;SACJ;QACD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI;QACF,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,2BAA2B,EAAE;YAChE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;SAC7B;IACH,CAAC;CACF;AAxFD,gDAwFC","file":"task-creation-button.js","sourcesContent":["import { createLine, Group } from '@visactor/vtable/es/vrender';\nimport type { IRect, IGroupGraphicAttribute, IRectGraphicAttribute, ILine } from '@visactor/vtable/es/vrender';\n\nimport type { Scenegraph } from './scenegraph';\n\nexport class TaskCreationButton {\n _scene: Scenegraph;\n group: Group;\n lineVertical: ILine;\n lineHorizontal: ILine;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.createAddButton();\n }\n createAddButton() {\n if (this._scene._gantt.parsedOptions.taskBarCreationCustomLayout) {\n this.group = new Group({\n x: 0,\n y: 0,\n width: 100,\n height: 100\n });\n } else {\n this.group = new Group({\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n lineDash: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineDash,\n cursor: 'pointer',\n lineWidth: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,\n stroke: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,\n cornerRadius: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.cornerRadius ?? 0,\n fill: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.backgroundColor\n });\n\n this.lineVertical = createLine({\n pickable: false,\n stroke: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,\n lineWidth: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,\n points: [\n { x: 50, y: 0 },\n { x: 50, y: 100 }\n ]\n });\n this.group.appendChild(this.lineVertical);\n this.lineHorizontal = createLine({\n pickable: false,\n stroke: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,\n lineWidth: this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,\n points: [\n { x: 0, y: 50 },\n { x: 100, y: 50 }\n ]\n });\n this.group.appendChild(this.lineHorizontal);\n }\n this.group.name = 'task-creation-button';\n this._scene.taskBar.group.addChild(this.group);\n }\n show(x: number, y: number, width: number, height: number) {\n if (this._scene._gantt.parsedOptions.taskBarCreationCustomLayout) {\n this.group.appendChild(\n this._scene._gantt.parsedOptions.taskBarCreationCustomLayout({\n width,\n height,\n ganttInstance: this._scene._gantt\n }).rootContainer\n );\n } else {\n const lineSize = Math.min(width, height) / 6;\n this.lineHorizontal.setAttribute('points', [\n { x: (width - lineSize * 4) / 2, y: height / 2 },\n { x: (width - lineSize * 4) / 2 + lineSize * 4, y: height / 2 }\n ]);\n\n this.lineVertical.setAttribute('points', [\n { x: width / 2, y: (height - lineSize * 4) / 2 },\n { x: width / 2, y: (height - lineSize * 4) / 2 + lineSize * 4 }\n ]);\n }\n this.group.setAttribute('x', x);\n this.group.setAttribute('y', y);\n this.group.setAttribute('width', width);\n this.group.setAttribute('height', height);\n this.group.setAttribute('visibleAll', true);\n }\n hide() {\n this.group.setAttribute('visibleAll', false);\n if (this._scene._gantt.parsedOptions.taskBarCreationCustomLayout) {\n this.group.removeAllChild();\n }\n }\n}\n"]}
|
|
@@ -4,3 +4,4 @@ export declare function syncScrollStateFromTable(gantt: Gantt): void;
|
|
|
4
4
|
export declare function syncEditCellFromTable(gantt: Gantt): void;
|
|
5
5
|
export declare function syncDragOrderFromTable(gantt: Gantt): void;
|
|
6
6
|
export declare function syncTreeChangeFromTable(gantt: Gantt): void;
|
|
7
|
+
export declare function syncSortFromTable(gantt: Gantt): void;
|
|
@@ -42,10 +42,19 @@ function syncTreeChangeFromTable(gantt) {
|
|
|
42
42
|
}));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function syncSortFromTable(gantt) {
|
|
46
|
+
var _a;
|
|
47
|
+
null === (_a = gantt.taskListTableInstance) || void 0 === _a || _a.on("after_sort", (args => {
|
|
48
|
+
gantt.scenegraph.refreshTaskBars();
|
|
49
|
+
const left = gantt.stateManager.scroll.horizontalBarPos, top = gantt.stateManager.scroll.verticalBarPos;
|
|
50
|
+
gantt.scenegraph.setX(-left), gantt.scenegraph.setY(-top);
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
Object.defineProperty(exports, "__esModule", {
|
|
46
55
|
value: !0
|
|
47
|
-
}), exports.syncTreeChangeFromTable = exports.syncDragOrderFromTable = exports.syncEditCellFromTable = exports.syncScrollStateFromTable = exports.syncScrollStateToTable = void 0,
|
|
56
|
+
}), exports.syncSortFromTable = exports.syncTreeChangeFromTable = exports.syncDragOrderFromTable = exports.syncEditCellFromTable = exports.syncScrollStateFromTable = exports.syncScrollStateToTable = void 0,
|
|
48
57
|
exports.syncScrollStateToTable = syncScrollStateToTable, exports.syncScrollStateFromTable = syncScrollStateFromTable,
|
|
49
58
|
exports.syncEditCellFromTable = syncEditCellFromTable, exports.syncDragOrderFromTable = syncDragOrderFromTable,
|
|
50
|
-
exports.syncTreeChangeFromTable = syncTreeChangeFromTable;
|
|
59
|
+
exports.syncTreeChangeFromTable = syncTreeChangeFromTable, exports.syncSortFromTable = syncSortFromTable;
|
|
51
60
|
//# sourceMappingURL=gantt-table-sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/gantt-table-sync.ts"],"names":[],"mappings":";;;AAEA,SAAgB,sBAAsB,CAAC,KAAY;IACjD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC;IACtC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,KAAK,CAAC,qBAAqB,CAAC,YAAY,CAAC,YAAY,CAAC,cAAc,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAC1F,CAAC;AAJD,wDAIC;AAED,SAAgB,wBAAwB,CAAC,KAAY;;IACnD,IAAI,KAAK,CAAC,qBAAqB,EAAE;QAC/B,MAAA,KAAK,CAAC,qBAAqB,0CAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAS,EAAE,EAAE;YACtD,IAAI,IAAI,CAAC,eAAe,KAAK,UAAU,EAAE;gBACvC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,qBAAqB,CAAC,YAAY,CAAC;gBAC5D,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;gBAClC,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;aACxD;QACH,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAVD,4DAUC;AACD,SAAgB,qBAAqB,CAAC,KAAY;;IAChD,MAAA,KAAK,CAAC,qBAAqB,0CAAE,EAAE,CAAC,mB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C,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,0DAUC","file":"gantt-table-sync.js","sourcesContent":["import type { Gantt } from '../Gantt';\n\nexport function syncScrollStateToTable(gantt: Gantt) {\n const { scroll } = gantt.stateManager;\n const { verticalBarPos } = scroll;\n gantt.taskListTableInstance.stateManager.setScrollTop(verticalBarPos, undefined, false);\n}\n\nexport function syncScrollStateFromTable(gantt: Gantt) {\n if (gantt.taskListTableInstance) {\n gantt.taskListTableInstance?.on('scroll', (args: any) => {\n if (args.scrollDirection === 'vertical') {\n const { scroll } = gantt.taskListTableInstance.stateManager;\n const { verticalBarPos } = scroll;\n gantt.stateManager.setScrollTop(verticalBarPos, false);\n }\n });\n }\n}\nexport function syncEditCellFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('change_cell_value', (args: any) => {\n const { col, row, rawValue, changedValue } = args;\n gantt._refreshTaskBar(row - gantt.taskListTableInstance.columnHeaderLevelCount);\n // const record = gantt.getRecordByIndex(row - gantt.listTableInstance.columnHeaderLevelCount);\n // debugger;\n });\n}\n\nexport function syncDragOrderFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('change_header_position', (args: any) => {\n gantt.scenegraph.refreshTaskBars();\n const left = gantt.stateManager.scroll.horizontalBarPos;\n const top = gantt.stateManager.scroll.verticalBarPos;\n gantt.scenegraph.setX(-left);\n gantt.scenegraph.setY(-top);\n });\n}\n\nexport function syncTreeChangeFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('tree_hierarchy_state_change', (args: any) => {\n gantt._syncPropsFromTable();\n gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + 'px'; //'100%';\n gantt.scenegraph.refreshTaskBarsAndGrid();\n const left = gantt.stateManager.scroll.horizontalBarPos;\n const top = gantt.stateManager.scroll.verticalBarPos;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E;QAC1D,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACxD,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC;QACrD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AARD,8CAQC","file":"gantt-table-sync.js","sourcesContent":["import type { Gantt } from '../Gantt';\n\nexport function syncScrollStateToTable(gantt: Gantt) {\n const { scroll } = gantt.stateManager;\n const { verticalBarPos } = scroll;\n gantt.taskListTableInstance.stateManager.setScrollTop(verticalBarPos, undefined, false);\n}\n\nexport function syncScrollStateFromTable(gantt: Gantt) {\n if (gantt.taskListTableInstance) {\n gantt.taskListTableInstance?.on('scroll', (args: any) => {\n if (args.scrollDirection === 'vertical') {\n const { scroll } = gantt.taskListTableInstance.stateManager;\n const { verticalBarPos } = scroll;\n gantt.stateManager.setScrollTop(verticalBarPos, false);\n }\n });\n }\n}\nexport function syncEditCellFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('change_cell_value', (args: any) => {\n const { col, row, rawValue, changedValue } = args;\n gantt._refreshTaskBar(row - gantt.taskListTableInstance.columnHeaderLevelCount);\n // const record = gantt.getRecordByIndex(row - gantt.listTableInstance.columnHeaderLevelCount);\n // debugger;\n });\n}\n\nexport function syncDragOrderFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('change_header_position', (args: any) => {\n gantt.scenegraph.refreshTaskBars();\n const left = gantt.stateManager.scroll.horizontalBarPos;\n const top = gantt.stateManager.scroll.verticalBarPos;\n gantt.scenegraph.setX(-left);\n gantt.scenegraph.setY(-top);\n });\n}\n\nexport function syncTreeChangeFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('tree_hierarchy_state_change', (args: any) => {\n gantt._syncPropsFromTable();\n gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + 'px'; //'100%';\n gantt.scenegraph.refreshTaskBarsAndGrid();\n const left = gantt.stateManager.scroll.horizontalBarPos;\n const top = gantt.stateManager.scroll.verticalBarPos;\n gantt.scenegraph.setX(-left);\n gantt.scenegraph.setY(-top);\n });\n}\nexport function syncSortFromTable(gantt: Gantt) {\n gantt.taskListTableInstance?.on('after_sort', (args: any) => {\n gantt.scenegraph.refreshTaskBars();\n const left = gantt.stateManager.scroll.horizontalBarPos;\n const top = gantt.stateManager.scroll.verticalBarPos;\n gantt.scenegraph.setX(-left);\n gantt.scenegraph.setY(-top);\n });\n}\n"]}
|