@visactor/vtable-gantt 1.5.4
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/README.md +151 -0
- package/cjs/Gantt.d.ts +111 -0
- package/cjs/Gantt.js +244 -0
- package/cjs/Gantt.js.map +1 -0
- package/cjs/data/DataSource.d.ts +9 -0
- package/cjs/data/DataSource.js +30 -0
- package/cjs/data/DataSource.js.map +1 -0
- package/cjs/env.d.ts +19 -0
- package/cjs/env.js +48 -0
- package/cjs/env.js.map +1 -0
- package/cjs/event/EventHandler.d.ts +47 -0
- package/cjs/event/EventHandler.js +128 -0
- package/cjs/event/EventHandler.js.map +1 -0
- package/cjs/event/EventTarget.d.ts +12 -0
- package/cjs/event/EventTarget.js +67 -0
- package/cjs/event/EventTarget.js.map +1 -0
- package/cjs/event/event-manager.d.ts +15 -0
- package/cjs/event/event-manager.js +76 -0
- package/cjs/event/event-manager.js.map +1 -0
- package/cjs/event/scroll.d.ts +22 -0
- package/cjs/event/scroll.js +136 -0
- package/cjs/event/scroll.js.map +1 -0
- package/cjs/gantt-helper.d.ts +28 -0
- package/cjs/gantt-helper.js +225 -0
- package/cjs/gantt-helper.js.map +1 -0
- package/cjs/index.d.ts +7 -0
- package/cjs/index.js +48 -0
- package/cjs/index.js.map +1 -0
- package/cjs/register.d.ts +1 -0
- package/cjs/register.js +1 -0
- package/cjs/register.js.map +1 -0
- package/cjs/scenegraph/frame-border.d.ts +9 -0
- package/cjs/scenegraph/frame-border.js +42 -0
- package/cjs/scenegraph/frame-border.js.map +1 -0
- package/cjs/scenegraph/ganttNode.d.ts +7 -0
- package/cjs/scenegraph/ganttNode.js +16 -0
- package/cjs/scenegraph/ganttNode.js.map +1 -0
- package/cjs/scenegraph/grid.d.ts +30 -0
- package/cjs/scenegraph/grid.js +130 -0
- package/cjs/scenegraph/grid.js.map +1 -0
- package/cjs/scenegraph/mark-line.d.ts +15 -0
- package/cjs/scenegraph/mark-line.js +66 -0
- package/cjs/scenegraph/mark-line.js.map +1 -0
- package/cjs/scenegraph/scenegraph.d.ts +41 -0
- package/cjs/scenegraph/scenegraph.js +109 -0
- package/cjs/scenegraph/scenegraph.js.map +1 -0
- package/cjs/scenegraph/scroll-bar.d.ts +19 -0
- package/cjs/scenegraph/scroll-bar.js +150 -0
- package/cjs/scenegraph/scroll-bar.js.map +1 -0
- package/cjs/scenegraph/task-bar.d.ts +24 -0
- package/cjs/scenegraph/task-bar.js +188 -0
- package/cjs/scenegraph/task-bar.js.map +1 -0
- package/cjs/scenegraph/timeline-header.d.ts +10 -0
- package/cjs/scenegraph/timeline-header.js +134 -0
- package/cjs/scenegraph/timeline-header.js.map +1 -0
- package/cjs/state/gantt-table-sync.d.ts +7 -0
- package/cjs/state/gantt-table-sync.js +60 -0
- package/cjs/state/gantt-table-sync.js.map +1 -0
- package/cjs/state/state-manager.d.ts +58 -0
- package/cjs/state/state-manager.js +223 -0
- package/cjs/state/state-manager.js.map +1 -0
- package/cjs/themes.d.ts +1 -0
- package/cjs/themes.js +1 -0
- package/cjs/themes.js.map +1 -0
- package/cjs/tools/debounce.d.ts +1 -0
- package/cjs/tools/debounce.js +51 -0
- package/cjs/tools/debounce.js.map +1 -0
- package/cjs/tools/index.d.ts +2 -0
- package/cjs/tools/index.js +20 -0
- package/cjs/tools/index.js.map +1 -0
- package/cjs/tools/isx.d.ts +16 -0
- package/cjs/tools/isx.js +117 -0
- package/cjs/tools/isx.js.map +1 -0
- package/cjs/tools/pixel-ratio.d.ts +2 -0
- package/cjs/tools/pixel-ratio.js +16 -0
- package/cjs/tools/pixel-ratio.js.map +1 -0
- package/cjs/tools/util.d.ts +7 -0
- package/cjs/tools/util.js +87 -0
- package/cjs/tools/util.js.map +1 -0
- package/cjs/ts-types/EVENT_TYPE.d.ts +5 -0
- package/cjs/ts-types/EVENT_TYPE.js +9 -0
- package/cjs/ts-types/EVENT_TYPE.js.map +1 -0
- package/cjs/ts-types/common.d.ts +13 -0
- package/cjs/ts-types/common.js +14 -0
- package/cjs/ts-types/common.js.map +1 -0
- package/cjs/ts-types/events.d.ts +14 -0
- package/cjs/ts-types/events.js +6 -0
- package/cjs/ts-types/events.js.map +1 -0
- package/cjs/ts-types/gantt-engine.d.ts +163 -0
- package/cjs/ts-types/gantt-engine.js +6 -0
- package/cjs/ts-types/gantt-engine.js.map +1 -0
- package/cjs/ts-types/index.d.ts +4 -0
- package/cjs/ts-types/index.js +22 -0
- package/cjs/ts-types/index.js.map +1 -0
- package/dist/vtable-gantt.js +53942 -0
- package/dist/vtable-gantt.min.js +1 -0
- package/es/Gantt.d.ts +111 -0
- package/es/Gantt.js +246 -0
- package/es/Gantt.js.map +1 -0
- package/es/data/DataSource.d.ts +9 -0
- package/es/data/DataSource.js +22 -0
- package/es/data/DataSource.js.map +1 -0
- package/es/env.d.ts +19 -0
- package/es/env.js +42 -0
- package/es/env.js.map +1 -0
- package/es/event/EventHandler.d.ts +47 -0
- package/es/event/EventHandler.js +119 -0
- package/es/event/EventHandler.js.map +1 -0
- package/es/event/EventTarget.d.ts +12 -0
- package/es/event/EventTarget.js +58 -0
- package/es/event/EventTarget.js.map +1 -0
- package/es/event/event-manager.d.ts +15 -0
- package/es/event/event-manager.js +78 -0
- package/es/event/event-manager.js.map +1 -0
- package/es/event/scroll.d.ts +22 -0
- package/es/event/scroll.js +126 -0
- package/es/event/scroll.js.map +1 -0
- package/es/gantt-helper.d.ts +28 -0
- package/es/gantt-helper.js +220 -0
- package/es/gantt-helper.js.map +1 -0
- package/es/index.d.ts +7 -0
- package/es/index.js +10 -0
- package/es/index.js.map +1 -0
- package/es/register.d.ts +1 -0
- package/es/register.js +1 -0
- package/es/register.js.map +1 -0
- package/es/scenegraph/frame-border.d.ts +9 -0
- package/es/scenegraph/frame-border.js +34 -0
- package/es/scenegraph/frame-border.js.map +1 -0
- package/es/scenegraph/ganttNode.d.ts +7 -0
- package/es/scenegraph/ganttNode.js +8 -0
- package/es/scenegraph/ganttNode.js.map +1 -0
- package/es/scenegraph/grid.d.ts +30 -0
- package/es/scenegraph/grid.js +122 -0
- package/es/scenegraph/grid.js.map +1 -0
- package/es/scenegraph/mark-line.d.ts +15 -0
- package/es/scenegraph/mark-line.js +58 -0
- package/es/scenegraph/mark-line.js.map +1 -0
- package/es/scenegraph/scenegraph.d.ts +41 -0
- package/es/scenegraph/scenegraph.js +116 -0
- package/es/scenegraph/scenegraph.js.map +1 -0
- package/es/scenegraph/scroll-bar.d.ts +19 -0
- package/es/scenegraph/scroll-bar.js +144 -0
- package/es/scenegraph/scroll-bar.js.map +1 -0
- package/es/scenegraph/task-bar.d.ts +24 -0
- package/es/scenegraph/task-bar.js +188 -0
- package/es/scenegraph/task-bar.js.map +1 -0
- package/es/scenegraph/timeline-header.d.ts +10 -0
- package/es/scenegraph/timeline-header.js +130 -0
- package/es/scenegraph/timeline-header.js.map +1 -0
- package/es/state/gantt-table-sync.d.ts +7 -0
- package/es/state/gantt-table-sync.js +51 -0
- package/es/state/gantt-table-sync.js.map +1 -0
- package/es/state/state-manager.d.ts +58 -0
- package/es/state/state-manager.js +219 -0
- package/es/state/state-manager.js.map +1 -0
- package/es/themes.d.ts +1 -0
- package/es/themes.js +1 -0
- package/es/themes.js.map +1 -0
- package/es/tools/debounce.d.ts +1 -0
- package/es/tools/debounce.js +43 -0
- package/es/tools/debounce.js.map +1 -0
- package/es/tools/index.d.ts +2 -0
- package/es/tools/index.js +4 -0
- package/es/tools/index.js.map +1 -0
- package/es/tools/isx.d.ts +16 -0
- package/es/tools/isx.js +80 -0
- package/es/tools/isx.js.map +1 -0
- package/es/tools/pixel-ratio.d.ts +2 -0
- package/es/tools/pixel-ratio.js +12 -0
- package/es/tools/pixel-ratio.js.map +1 -0
- package/es/tools/util.d.ts +7 -0
- package/es/tools/util.js +78 -0
- package/es/tools/util.js.map +1 -0
- package/es/ts-types/EVENT_TYPE.d.ts +5 -0
- package/es/ts-types/EVENT_TYPE.js +5 -0
- package/es/ts-types/EVENT_TYPE.js.map +1 -0
- package/es/ts-types/common.d.ts +13 -0
- package/es/ts-types/common.js +13 -0
- package/es/ts-types/common.js.map +1 -0
- package/es/ts-types/events.d.ts +14 -0
- package/es/ts-types/events.js +2 -0
- package/es/ts-types/events.js.map +1 -0
- package/es/ts-types/gantt-engine.d.ts +163 -0
- package/es/ts-types/gantt-engine.js +2 -0
- package/es/ts-types/gantt-engine.js.map +1 -0
- package/es/ts-types/index.d.ts +4 -0
- package/es/ts-types/index.js +8 -0
- package/es/ts-types/index.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.FrameBorder = void 0;
|
|
6
|
+
|
|
7
|
+
const vtable_1 = require("@visactor/vtable");
|
|
8
|
+
|
|
9
|
+
class FrameBorder {
|
|
10
|
+
constructor(scene) {
|
|
11
|
+
this._scene = scene, this.createFrameBorder();
|
|
12
|
+
}
|
|
13
|
+
createFrameBorder() {
|
|
14
|
+
const group = this._scene.tableGroup, frameStyle = this._scene._gantt.parsedOptions.frameStyle;
|
|
15
|
+
if (!frameStyle) return;
|
|
16
|
+
const {cornerRadius: cornerRadius, borderColor: borderColor, borderLineWidth: borderLineWidth, borderLineDash: borderLineDash} = frameStyle, groupAttributes = {}, rectAttributes = {
|
|
17
|
+
pickable: !1
|
|
18
|
+
};
|
|
19
|
+
if (borderLineWidth && (rectAttributes.stroke = !0, rectAttributes.fill = !1, rectAttributes.stroke = borderColor,
|
|
20
|
+
rectAttributes.lineWidth = borderLineWidth, borderLineDash && (rectAttributes.lineDash = borderLineDash),
|
|
21
|
+
rectAttributes.lineCap = "butt"), cornerRadius && (rectAttributes.cornerRadius = [ 0, 10, 10, 0 ],
|
|
22
|
+
groupAttributes.cornerRadius = [ 0, 10, 10, 0 ]), group.setAttributes(groupAttributes),
|
|
23
|
+
rectAttributes.stroke) {
|
|
24
|
+
rectAttributes.x = -borderLineWidth / 2, rectAttributes.y = borderLineWidth / 2,
|
|
25
|
+
rectAttributes.pickable = !1, rectAttributes.width = group.attribute.width + borderLineWidth / 2 + borderLineWidth / 2,
|
|
26
|
+
rectAttributes.height = group.attribute.height + borderLineWidth / 2 + borderLineWidth / 2;
|
|
27
|
+
const borderRect = vtable_1.VRender.createRect(rectAttributes);
|
|
28
|
+
borderRect.name = "border-rect", group.parent.insertAfter(borderRect, group), group.border = borderRect,
|
|
29
|
+
this.border = borderRect;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
resize() {
|
|
33
|
+
const {cornerRadius: cornerRadius, borderColor: borderColor, borderLineWidth: borderLineWidth, borderLineDash: borderLineDash} = this._scene._gantt.parsedOptions.frameStyle;
|
|
34
|
+
this.border.setAttributes({
|
|
35
|
+
width: this._scene.tableGroup.attribute.width + this.border.attribute.lineWidth,
|
|
36
|
+
height: this._scene.tableGroup.attribute.height + this.border.attribute.lineWidth
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.FrameBorder = FrameBorder;
|
|
42
|
+
//# sourceMappingURL=frame-border.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/frame-border.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAO3C,MAAa,WAAW;IAGtB,YAAY,KAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,iBAAiB;QACf,MAAM,iBAAiB,GAAG,KAAK,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC;QAE/D,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QACD,MAAM,EAAE,YAAY,EAAE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AC,UAAU,CAAC,cAAc,CAAC,CAAC;YACtD,UAAU,CAAC,IAAI,GAAG,aAAa,CAAC;YAChC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAC3C,KAAa,CAAC,MAAM,GAAG,UAAU,CAAC;YACnC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;SAC1B;IACH,CAAC;IACD,MAAM;QACJ,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC;QACnH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;YAGxB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS;YAC/E,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS;SAClF,CAAC,CAAC;IACL,CAAC;CACF;AApFD,kCAoFC","file":"frame-border.js","sourcesContent":["import { VRender } from '@visactor/vtable';\n\nimport { isArray } from '@visactor/vutils';\nimport type { IFrameStyle } from '../ts-types';\nimport type { Gantt } from '../Gantt';\nimport type { Scenegraph } from './scenegraph';\n\nexport class FrameBorder {\n _scene: Scenegraph;\n border: VRender.IRect;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.createFrameBorder();\n }\n createFrameBorder() {\n const justForXYPosition = false;\n const group = this._scene.tableGroup;\n const frameStyle = this._scene._gantt.parsedOptions.frameStyle;\n // const strokeArray = [true, true, true, false];\n if (!frameStyle) {\n return;\n }\n const { cornerRadius, borderColor, borderLineWidth, borderLineDash } = frameStyle;\n\n // const hasShadow = false;\n const groupAttributes: VRender.IGroupGraphicAttribute = {};\n const rectAttributes: VRender.IRectGraphicAttribute = {\n pickable: false\n };\n\n // 处理边框\n if (borderLineWidth) {\n rectAttributes.stroke = true;\n rectAttributes.fill = false;\n rectAttributes.stroke = borderColor; // getStroke(borderColor, strokeArray);\n rectAttributes.lineWidth = borderLineWidth as number;\n borderLineDash && (rectAttributes.lineDash = borderLineDash as number[]);\n rectAttributes.lineCap = 'butt';\n }\n\n // if (Array.isArray(borderLineWidth)) {\n // (rectAttributes as any).strokeArrayWidth = getQuadProps(borderLineWidth);\n // (rectAttributes as any).lineWidth = 1;\n // }\n\n if (cornerRadius) {\n rectAttributes.cornerRadius = [0, 10, 10, 0];\n groupAttributes.cornerRadius = [0, 10, 10, 0];\n }\n\n // const borderTop = (rectAttributes as any).strokeArrayWidth\n // ? (rectAttributes as any).strokeArrayWidth[0]\n // : (rectAttributes.lineWidth as number) ?? 0;\n // const borderRight = (rectAttributes as any).strokeArrayWidth\n // ? (rectAttributes as any).strokeArrayWidth[1]\n // : (rectAttributes.lineWidth as number) ?? 0;\n // const borderBottom = (rectAttributes as any).strokeArrayWidth\n // ? (rectAttributes as any).strokeArrayWidth[2]\n // : (rectAttributes.lineWidth as number) ?? 0;\n // const borderLeft = (rectAttributes as any).strokeArrayWidth\n // ? (rectAttributes as any).strokeArrayWidth[3]\n // : (rectAttributes.lineWidth as number) ?? 0;\n group.setAttributes(groupAttributes);\n\n if (justForXYPosition) {\n return;\n }\n\n if (rectAttributes.stroke) {\n rectAttributes.x = -borderLineWidth / 2; //为了可以绘制完整矩形 且左侧的边框不出现在group中\n rectAttributes.y = borderLineWidth / 2;\n rectAttributes.pickable = false;\n\n rectAttributes.width = group.attribute.width + borderLineWidth / 2 + borderLineWidth / 2;\n rectAttributes.height = group.attribute.height + borderLineWidth / 2 + borderLineWidth / 2;\n const borderRect = VRender.createRect(rectAttributes);\n borderRect.name = 'border-rect';\n group.parent.insertAfter(borderRect, group);\n (group as any).border = borderRect;\n this.border = borderRect;\n }\n }\n resize() {\n const { cornerRadius, borderColor, borderLineWidth, borderLineDash } = this._scene._gantt.parsedOptions.frameStyle;\n this.border.setAttributes({\n // x: -borderLineWidth / 2,\n // y: borderLineWidth / 2,\n width: this._scene.tableGroup.attribute.width + this.border.attribute.lineWidth,\n height: this._scene.tableGroup.attribute.height + this.border.attribute.lineWidth\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.GanttTaskBarNode = void 0;
|
|
6
|
+
|
|
7
|
+
const vtable_1 = require("@visactor/vtable");
|
|
8
|
+
|
|
9
|
+
class GanttTaskBarNode extends vtable_1.VRender.Group {
|
|
10
|
+
constructor(attrs) {
|
|
11
|
+
super(attrs);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.GanttTaskBarNode = GanttTaskBarNode;
|
|
16
|
+
//# sourceMappingURL=ganttNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/ganttNode.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,MAAa,gBAAiB,SAAQ,gBAAO,CAAC,KAAK;IAIjD,YAAY,KAAqC;QAC/C,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAPD,4CAOC","file":"ganttNode.js","sourcesContent":["import { VRender } from '@visactor/vtable';\nexport class GanttTaskBarNode extends VRender.Group {\n barRect?: VRender.IRect;\n progressRect?: VRender.IRect;\n textLabel?: VRender.IText;\n constructor(attrs: VRender.IGroupGraphicAttribute) {\n super(attrs);\n }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { VRender } from '@visactor/vtable';
|
|
2
|
+
import type { Scenegraph } from './scenegraph';
|
|
3
|
+
export declare class Grid {
|
|
4
|
+
vertical: boolean;
|
|
5
|
+
horizontal: boolean;
|
|
6
|
+
gridStyle: any;
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
scrollTop: number;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
timelineDates: any;
|
|
14
|
+
colWidthPerDay: number;
|
|
15
|
+
rowHeight: number;
|
|
16
|
+
rowCount: number;
|
|
17
|
+
group: VRender.Group;
|
|
18
|
+
verticalLineGroup: VRender.Group;
|
|
19
|
+
horizontalLineGroup: VRender.Group;
|
|
20
|
+
allGridHeight: number;
|
|
21
|
+
allGridWidth: number;
|
|
22
|
+
_scene: Scenegraph;
|
|
23
|
+
constructor(scene: Scenegraph);
|
|
24
|
+
createVerticalLines(): void;
|
|
25
|
+
createHorizontalLines(): void;
|
|
26
|
+
refresh(): void;
|
|
27
|
+
setX(x: number): void;
|
|
28
|
+
setY(y: number): void;
|
|
29
|
+
resize(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Grid = void 0;
|
|
6
|
+
|
|
7
|
+
const vtable_1 = require("@visactor/vtable");
|
|
8
|
+
|
|
9
|
+
class Grid {
|
|
10
|
+
constructor(scene) {
|
|
11
|
+
var _a, _b, _c, _d, _e;
|
|
12
|
+
this._scene = scene, this.vertical = !!scene._gantt.parsedOptions.gridStyle.verticalLine,
|
|
13
|
+
this.horizontal = !!scene._gantt.parsedOptions.gridStyle.horizontalLine, this.gridStyle = scene._gantt.parsedOptions.gridStyle,
|
|
14
|
+
this.scrollLeft = 0, this.scrollTop = 0, this.x = 0, this.y = scene._gantt.getAllHeaderRowsHeight(),
|
|
15
|
+
this.width = scene.tableGroup.attribute.width, this.height = scene.tableGroup.attribute.height - scene.timelineHeader.group.attribute.height,
|
|
16
|
+
this.timelineDates = scene._gantt.reverseSortedTimelineScales[0].timelineDates,
|
|
17
|
+
this.colWidthPerDay = scene._gantt.parsedOptions.colWidthPerDay, this.rowHeight = scene._gantt.parsedOptions.rowHeight,
|
|
18
|
+
this.rowCount = scene._gantt.itemCount, this.allGridWidth = scene._gantt.getAllColsWidth(),
|
|
19
|
+
this.allGridHeight = scene._gantt.getAllGridHeight(), this.group = new vtable_1.VRender.Group({
|
|
20
|
+
x: this.x,
|
|
21
|
+
y: this.y,
|
|
22
|
+
width: this.width,
|
|
23
|
+
height: this.height,
|
|
24
|
+
clip: !0,
|
|
25
|
+
fill: null === (_a = this.gridStyle) || void 0 === _a ? void 0 : _a.backgroundColor
|
|
26
|
+
}), this.group.name = "grid-container", scene.tableGroup.addChild(this.group);
|
|
27
|
+
const line = vtable_1.VRender.createLine({
|
|
28
|
+
pickable: !1,
|
|
29
|
+
stroke: null === (_b = scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle) || void 0 === _b ? void 0 : _b.lineColor,
|
|
30
|
+
lineWidth: null === (_c = scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle) || void 0 === _c ? void 0 : _c.lineWidth,
|
|
31
|
+
points: [ {
|
|
32
|
+
x: 0,
|
|
33
|
+
y: 1 & (null === (_d = scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle) || void 0 === _d ? void 0 : _d.lineWidth) ? .5 : 0
|
|
34
|
+
}, {
|
|
35
|
+
x: scene._gantt.getAllColsWidth(),
|
|
36
|
+
y: 1 & (null === (_e = scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle) || void 0 === _e ? void 0 : _e.lineWidth) ? .5 : 0
|
|
37
|
+
} ]
|
|
38
|
+
});
|
|
39
|
+
this.group.addChild(line), this.createVerticalLines(), this.createHorizontalLines();
|
|
40
|
+
}
|
|
41
|
+
createVerticalLines() {
|
|
42
|
+
var _a, _b, _c;
|
|
43
|
+
if (this.vertical) {
|
|
44
|
+
this.verticalLineGroup = new vtable_1.VRender.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 vLines = [];
|
|
51
|
+
let x = 0;
|
|
52
|
+
1 & (null === (_a = this.gridStyle) || void 0 === _a ? void 0 : _a.verticalLine.lineWidth) && (x = .5);
|
|
53
|
+
for (let i = 0; i < this.timelineDates.length - 1; i++) {
|
|
54
|
+
const dateline = this.timelineDates[i];
|
|
55
|
+
x += Math.floor(this.colWidthPerDay * dateline.days);
|
|
56
|
+
const line = vtable_1.VRender.createLine({
|
|
57
|
+
pickable: !1,
|
|
58
|
+
stroke: null === (_b = this.gridStyle) || void 0 === _b ? void 0 : _b.verticalLine.lineColor,
|
|
59
|
+
lineWidth: null === (_c = this.gridStyle) || void 0 === _c ? void 0 : _c.verticalLine.lineWidth,
|
|
60
|
+
points: [ {
|
|
61
|
+
x: x,
|
|
62
|
+
y: 0
|
|
63
|
+
}, {
|
|
64
|
+
x: x,
|
|
65
|
+
y: this.allGridHeight
|
|
66
|
+
} ]
|
|
67
|
+
});
|
|
68
|
+
vLines.push(line), this.verticalLineGroup.appendChild(line);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
createHorizontalLines() {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
if (this.horizontal) {
|
|
75
|
+
this.horizontalLineGroup = new vtable_1.VRender.Group({
|
|
76
|
+
x: 0,
|
|
77
|
+
y: 0,
|
|
78
|
+
width: this.allGridWidth,
|
|
79
|
+
height: this.allGridHeight
|
|
80
|
+
}), this.horizontalLineGroup.name = "grid-horizontal", this.group.appendChild(this.horizontalLineGroup);
|
|
81
|
+
const hLines = [];
|
|
82
|
+
let y = 0;
|
|
83
|
+
1 & (null === (_a = this.gridStyle) || void 0 === _a ? void 0 : _a.horizontalLine.lineWidth) && (y += .5);
|
|
84
|
+
for (let i = 0; i < this.rowCount - 1; i++) {
|
|
85
|
+
y += Math.floor(this.rowHeight);
|
|
86
|
+
const line = vtable_1.VRender.createLine({
|
|
87
|
+
pickable: !1,
|
|
88
|
+
stroke: null === (_b = this.gridStyle) || void 0 === _b ? void 0 : _b.horizontalLine.lineColor,
|
|
89
|
+
lineWidth: null === (_c = this.gridStyle) || void 0 === _c ? void 0 : _c.horizontalLine.lineWidth,
|
|
90
|
+
points: [ {
|
|
91
|
+
x: 0,
|
|
92
|
+
y: y
|
|
93
|
+
}, {
|
|
94
|
+
x: this.allGridWidth,
|
|
95
|
+
y: y
|
|
96
|
+
} ]
|
|
97
|
+
});
|
|
98
|
+
hLines.push(line), this.horizontalLineGroup.appendChild(line);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
refresh() {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
this.width = this._scene.tableGroup.attribute.width, this.height = this._scene.tableGroup.attribute.height - this._scene.timelineHeader.group.attribute.height,
|
|
105
|
+
this.group.setAttributes({
|
|
106
|
+
width: this.width,
|
|
107
|
+
height: this.height
|
|
108
|
+
}), this.rowCount = this._scene._gantt.itemCount, this.allGridWidth = this._scene._gantt.getAllColsWidth(),
|
|
109
|
+
this.allGridHeight = this._scene._gantt.getAllGridHeight(), null === (_a = this.verticalLineGroup) || void 0 === _a || _a.parent.removeChild(this.verticalLineGroup),
|
|
110
|
+
null === (_b = this.horizontalLineGroup) || void 0 === _b || _b.parent.removeChild(this.horizontalLineGroup),
|
|
111
|
+
this.createVerticalLines(), this.createHorizontalLines();
|
|
112
|
+
}
|
|
113
|
+
setX(x) {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
null === (_a = this.verticalLineGroup) || void 0 === _a || _a.setAttribute("x", x),
|
|
116
|
+
null === (_b = this.horizontalLineGroup) || void 0 === _b || _b.setAttribute("x", x);
|
|
117
|
+
}
|
|
118
|
+
setY(y) {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
null === (_a = this.verticalLineGroup) || void 0 === _a || _a.setAttribute("y", y),
|
|
121
|
+
null === (_b = this.horizontalLineGroup) || void 0 === _b || _b.setAttribute("y", y);
|
|
122
|
+
}
|
|
123
|
+
resize() {
|
|
124
|
+
this.width = this._scene.tableGroup.attribute.width, this.height = this._scene.tableGroup.attribute.height - this._scene.timelineHeader.group.attribute.height,
|
|
125
|
+
this.group.setAttribute("width", this.width), this.group.setAttribute("height", this.height);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
exports.Grid = Grid;
|
|
130
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/grid.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAK3C,MAAa,IAAI;IAsBf,YAAY,KAAiB;;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC;QACpE,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC;QACxE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;QACtD,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,aAAa,GAA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;CACF;AAlKD,oBAkKC","file":"grid.js","sourcesContent":["import { VRender } from '@visactor/vtable';\nimport { TYPES } from '@visactor/vtable';\nimport type { IGridStyle } from '../ts-types';\nimport { str } from '@visactor/vtable/es/tools/helper';\nimport type { Scenegraph } from './scenegraph';\nexport class Grid {\n vertical: boolean;\n horizontal: boolean;\n // verticalLineSpace: number;\n // horizontalLineSpace: number;\n gridStyle: any;\n scrollLeft: number;\n scrollTop: number;\n x: number;\n y: number;\n width: number;\n height: number;\n timelineDates: any;\n colWidthPerDay: number;\n rowHeight: number;\n rowCount: number;\n group: VRender.Group;\n verticalLineGroup: VRender.Group;\n horizontalLineGroup: VRender.Group;\n allGridHeight: number;\n allGridWidth: number;\n _scene: Scenegraph;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.vertical = !!scene._gantt.parsedOptions.gridStyle.verticalLine;\n this.horizontal = !!scene._gantt.parsedOptions.gridStyle.horizontalLine;\n this.gridStyle = scene._gantt.parsedOptions.gridStyle;\n this.scrollLeft = 0;\n this.scrollTop = 0;\n this.x = 0;\n this.y = scene._gantt.getAllHeaderRowsHeight();\n this.width = scene.tableGroup.attribute.width;\n this.height = scene.tableGroup.attribute.height - scene.timelineHeader.group.attribute.height;\n this.timelineDates = scene._gantt.reverseSortedTimelineScales[0].timelineDates;\n this.colWidthPerDay = scene._gantt.parsedOptions.colWidthPerDay;\n this.rowHeight = scene._gantt.parsedOptions.rowHeight;\n this.rowCount = scene._gantt.itemCount;\n this.allGridWidth = scene._gantt.getAllColsWidth();\n this.allGridHeight = scene._gantt.getAllGridHeight();\n this.group = new VRender.Group({\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height,\n clip: true,\n fill: this.gridStyle?.backgroundColor\n });\n this.group.name = 'grid-container';\n scene.tableGroup.addChild(this.group);\n //补充timelineHeader中不好绘制的底部的边线\n const line = VRender.createLine({\n pickable: false,\n stroke: scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle?.lineColor,\n lineWidth: scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle?.lineWidth,\n points: [\n { x: 0, y: scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle?.lineWidth & 1 ? 0.5 : 0 },\n {\n x: scene._gantt.getAllColsWidth(),\n y: scene._gantt.parsedOptions.timelineHeaderHorizontalLineStyle?.lineWidth & 1 ? 0.5 : 0\n }\n ]\n });\n this.group.addChild(line);\n this.createVerticalLines();\n\n this.createHorizontalLines();\n }\n createVerticalLines() {\n if (this.vertical) {\n this.verticalLineGroup = new VRender.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 vLines = [];\n let x = 0;\n if (this.gridStyle?.verticalLine.lineWidth & 1) {\n x = 0.5;\n }\n for (let i = 0; i < this.timelineDates.length - 1; i++) {\n const dateline = this.timelineDates[i];\n x = x + Math.floor(this.colWidthPerDay * dateline.days);\n const line = VRender.createLine({\n pickable: false,\n stroke: this.gridStyle?.verticalLine.lineColor,\n lineWidth: this.gridStyle?.verticalLine.lineWidth,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n vLines.push(line);\n this.verticalLineGroup.appendChild(line);\n }\n }\n }\n createHorizontalLines() {\n if (this.horizontal) {\n this.horizontalLineGroup = new VRender.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\n const hLines = [];\n let y = 0;\n if (this.gridStyle?.horizontalLine.lineWidth & 1) {\n y += 0.5;\n }\n for (let i = 0; i < this.rowCount - 1; i++) {\n y = y + Math.floor(this.rowHeight);\n const line = VRender.createLine({\n pickable: false,\n stroke: this.gridStyle?.horizontalLine.lineColor,\n lineWidth: this.gridStyle?.horizontalLine.lineWidth,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n hLines.push(line);\n this.horizontalLineGroup.appendChild(line);\n }\n }\n }\n /** 重新创建网格线场景树结点 */\n refresh() {\n this.width = this._scene.tableGroup.attribute.width;\n this.height = this._scene.tableGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttributes({\n width: this.width,\n height: this.height\n });\n this.rowCount = this._scene._gantt.itemCount;\n this.allGridWidth = this._scene._gantt.getAllColsWidth();\n this.allGridHeight = this._scene._gantt.getAllGridHeight();\n this.verticalLineGroup?.parent.removeChild(this.verticalLineGroup);\n this.horizontalLineGroup?.parent.removeChild(this.horizontalLineGroup);\n this.createVerticalLines();\n this.createHorizontalLines();\n }\n setX(x: number) {\n this.verticalLineGroup?.setAttribute('x', x);\n this.horizontalLineGroup?.setAttribute('x', x);\n }\n setY(y: number) {\n this.verticalLineGroup?.setAttribute('y', y);\n this.horizontalLineGroup?.setAttribute('y', y);\n }\n resize() {\n this.width = this._scene.tableGroup.attribute.width;\n this.height = this._scene.tableGroup.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,15 @@
|
|
|
1
|
+
import type { IMarkLine } from '../ts-types';
|
|
2
|
+
import type { Scenegraph } from './scenegraph';
|
|
3
|
+
import { VRender } from '@visactor/vtable';
|
|
4
|
+
export declare class MarkLine {
|
|
5
|
+
_scene: Scenegraph;
|
|
6
|
+
group: VRender.Group;
|
|
7
|
+
markLine: IMarkLine[];
|
|
8
|
+
markLIneContainer: VRender.Group;
|
|
9
|
+
markLineContainerWidth: number;
|
|
10
|
+
height: number;
|
|
11
|
+
constructor(scene: Scenegraph);
|
|
12
|
+
initMarkLines(): void;
|
|
13
|
+
refresh(): void;
|
|
14
|
+
setX(x: number): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.MarkLine = void 0;
|
|
6
|
+
|
|
7
|
+
const vtable_1 = require("@visactor/vtable");
|
|
8
|
+
|
|
9
|
+
class MarkLine {
|
|
10
|
+
constructor(scene) {
|
|
11
|
+
this.markLineContainerWidth = 20, this._scene = scene, this.markLine = scene._gantt.parsedOptions.markLine,
|
|
12
|
+
this.height = Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight) - scene._gantt.getAllHeaderRowsHeight(),
|
|
13
|
+
this.group = new vtable_1.VRender.Group({
|
|
14
|
+
x: 0,
|
|
15
|
+
y: scene._gantt.getAllHeaderRowsHeight(),
|
|
16
|
+
width: scene._gantt.tableNoFrameWidth,
|
|
17
|
+
height: this.height,
|
|
18
|
+
pickable: !1,
|
|
19
|
+
clip: !0
|
|
20
|
+
}), this.group.name = "mark-line-container", scene.tableGroup.addChild(this.group),
|
|
21
|
+
this.markLIneContainer = new vtable_1.VRender.Group({
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
width: this._scene._gantt.getAllColsWidth(),
|
|
25
|
+
height: this.height,
|
|
26
|
+
pickable: !1,
|
|
27
|
+
clip: !0
|
|
28
|
+
}), this.group.appendChild(this.markLIneContainer), this.initMarkLines();
|
|
29
|
+
}
|
|
30
|
+
initMarkLines() {
|
|
31
|
+
this.markLine.forEach((line => {
|
|
32
|
+
const style = line.style, date = new Date(line.date), minDate = new Date(this._scene._gantt.parsedOptions.minDate), dateX = this._scene._gantt.parsedOptions.colWidthPerDay * Math.ceil(Math.abs(date.getTime() - minDate.getTime()) / 864e5), markLineGroup = new vtable_1.VRender.Group({
|
|
33
|
+
pickable: !1,
|
|
34
|
+
x: dateX - this.markLineContainerWidth / 2,
|
|
35
|
+
y: 0,
|
|
36
|
+
width: this.markLineContainerWidth,
|
|
37
|
+
height: this.height
|
|
38
|
+
});
|
|
39
|
+
markLineGroup.name = "mark-line", this.markLIneContainer.appendChild(markLineGroup);
|
|
40
|
+
const lineObj = vtable_1.VRender.createLine({
|
|
41
|
+
pickable: !1,
|
|
42
|
+
stroke: style.lineColor,
|
|
43
|
+
lineWidth: style.lineWidth,
|
|
44
|
+
lineDash: style.lineDash,
|
|
45
|
+
points: [ {
|
|
46
|
+
x: dateX,
|
|
47
|
+
y: 0
|
|
48
|
+
}, {
|
|
49
|
+
x: dateX,
|
|
50
|
+
y: this.height
|
|
51
|
+
} ]
|
|
52
|
+
});
|
|
53
|
+
markLineGroup.appendChild(lineObj);
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
refresh() {
|
|
57
|
+
this.height = Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) - this._scene._gantt.getAllHeaderRowsHeight(),
|
|
58
|
+
this.markLIneContainer.removeAllChild(), this.group.setAttribute("height", this.height),
|
|
59
|
+
this.markLIneContainer.setAttribute("height", this.height), this.initMarkLines();
|
|
60
|
+
}
|
|
61
|
+
setX(x) {
|
|
62
|
+
this.markLIneContainer.setAttribute("x", x);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.MarkLine = MarkLine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/mark-line.ts"],"names":[],"mappings":";;;AAEA,6CAA2C;AAC3C,MAAa,QAAQ;IAOnB,YAAY,KAAiB;QAF7B,2BAAsB,GAAW,EAAE,CAAC;QAGlC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;QACpD,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,gBAAO,CAAC,KAAK,CAAC;YA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,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;AA/ED,4BA+EC","file":"mark-line.js","sourcesContent":["import type { IMarkLine } from '../ts-types';\nimport type { Scenegraph } from './scenegraph';\nimport { VRender } from '@visactor/vtable';\nexport class MarkLine {\n _scene: Scenegraph;\n group: VRender.Group;\n markLine: IMarkLine[];\n markLIneContainer: VRender.Group;\n markLineContainerWidth: number = 20;\n height: number;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.markLine = scene._gantt.parsedOptions.markLine;\n this.height =\n Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight) - scene._gantt.getAllHeaderRowsHeight();\n this.group = new VRender.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.tableGroup.addChild(this.group);\n\n this.markLIneContainer = new VRender.Group({\n x: 0,\n y: 0,\n width: this._scene._gantt.getAllColsWidth(),\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.appendChild(this.markLIneContainer);\n this.initMarkLines();\n }\n initMarkLines() {\n this.markLine.forEach(line => {\n const style = line.style;\n const date = new Date(line.date);\n const minDate = new Date(this._scene._gantt.parsedOptions.minDate);\n const dateX =\n this._scene._gantt.parsedOptions.colWidthPerDay *\n Math.ceil(Math.abs(date.getTime() - minDate.getTime()) / (1000 * 60 * 60 * 24));\n const markLineGroup = new VRender.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 = VRender.createLine({\n pickable: false,\n stroke: style.lineColor,\n lineWidth: style.lineWidth,\n lineDash: style.lineDash,\n points: [\n { x: dateX, y: 0 },\n { x: dateX, y: this.height }\n ]\n });\n markLineGroup.appendChild(lineObj);\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,41 @@
|
|
|
1
|
+
import { VRender } from '@visactor/vtable';
|
|
2
|
+
import { Grid } from './grid';
|
|
3
|
+
import type { Gantt } from '../Gantt';
|
|
4
|
+
import { ScrollBarComponent } from './scroll-bar';
|
|
5
|
+
import { TimelineHeader } from './timeline-header';
|
|
6
|
+
import { TaskBar } from './task-bar';
|
|
7
|
+
import { MarkLine } from './mark-line';
|
|
8
|
+
import { FrameBorder } from './frame-border';
|
|
9
|
+
export declare class Scenegraph {
|
|
10
|
+
dateStepWidth: number;
|
|
11
|
+
rowHeight: number;
|
|
12
|
+
_scales: {}[];
|
|
13
|
+
timelineHeader: TimelineHeader;
|
|
14
|
+
grid: Grid;
|
|
15
|
+
taskBar: TaskBar;
|
|
16
|
+
_gantt: Gantt;
|
|
17
|
+
tableGroup: VRender.Group;
|
|
18
|
+
scrollbarComponent: ScrollBarComponent;
|
|
19
|
+
markLine: MarkLine;
|
|
20
|
+
frameBorder: FrameBorder;
|
|
21
|
+
stage: VRender.Stage;
|
|
22
|
+
tableGroupWidth: number;
|
|
23
|
+
tableGroupHeight: number;
|
|
24
|
+
constructor(gantt: Gantt);
|
|
25
|
+
initSceneGraph(): void;
|
|
26
|
+
afterCreateSceneGraph(): void;
|
|
27
|
+
refreshTaskBars(): void;
|
|
28
|
+
refreshTaskBarsAndGrid(): void;
|
|
29
|
+
updateTableSize(): void;
|
|
30
|
+
renderSceneGraph(): void;
|
|
31
|
+
updateNextFrame(): void;
|
|
32
|
+
get width(): number;
|
|
33
|
+
get height(): number;
|
|
34
|
+
get x(): number;
|
|
35
|
+
get y(): number;
|
|
36
|
+
setX(x: number, isEnd?: boolean): void;
|
|
37
|
+
setY(y: number, isEnd?: boolean): void;
|
|
38
|
+
setPixelRatio(pixelRatio: number): void;
|
|
39
|
+
resize(): void;
|
|
40
|
+
release(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Scenegraph = void 0;
|
|
6
|
+
|
|
7
|
+
const vtable_1 = require("@visactor/vtable"), 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");
|
|
8
|
+
|
|
9
|
+
class Scenegraph {
|
|
10
|
+
constructor(gantt) {
|
|
11
|
+
let width, height;
|
|
12
|
+
this._gantt = gantt, this.tableGroupWidth = gantt.tableNoFrameWidth, this.tableGroupHeight = Math.min(gantt.tableNoFrameHeight, gantt.drawHeight),
|
|
13
|
+
"node" === env_1.Env.mode || (vtable_1.VRender.vglobal.setEnv("browser"), width = gantt.canvas.width,
|
|
14
|
+
height = gantt.canvas.height), this.stage = vtable_1.VRender.createStage({
|
|
15
|
+
canvas: gantt.canvas,
|
|
16
|
+
width: width,
|
|
17
|
+
height: height,
|
|
18
|
+
disableDirtyBounds: !1,
|
|
19
|
+
enableLayout: !0,
|
|
20
|
+
autoRender: !1
|
|
21
|
+
}), this.stage.defaultLayer.setTheme({
|
|
22
|
+
group: {
|
|
23
|
+
boundsPadding: 0,
|
|
24
|
+
strokeBoundsBuffer: 0,
|
|
25
|
+
lineJoin: "round"
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
ignoreBuf: !0
|
|
29
|
+
}
|
|
30
|
+
}), this.initSceneGraph();
|
|
31
|
+
}
|
|
32
|
+
initSceneGraph() {
|
|
33
|
+
this.tableGroup = new vtable_1.VRender.Group({
|
|
34
|
+
x: 0,
|
|
35
|
+
y: this._gantt.tableY,
|
|
36
|
+
width: this.tableGroupWidth,
|
|
37
|
+
height: this.tableGroupHeight,
|
|
38
|
+
clip: !0,
|
|
39
|
+
pickable: !1
|
|
40
|
+
}), this.stage.defaultLayer.add(this.tableGroup), this.tableGroup.name = "table",
|
|
41
|
+
this.timelineHeader = new timeline_header_1.TimelineHeader(this), this.grid = new grid_1.Grid(this),
|
|
42
|
+
this.taskBar = new task_bar_1.TaskBar(this), this.markLine = new mark_line_1.MarkLine(this),
|
|
43
|
+
this.frameBorder = new frame_border_1.FrameBorder(this), this.scrollbarComponent = new scroll_bar_1.ScrollBarComponent(this._gantt),
|
|
44
|
+
this.stage.defaultLayer.addChild(this.scrollbarComponent.hScrollBar), this.stage.defaultLayer.addChild(this.scrollbarComponent.vScrollBar);
|
|
45
|
+
}
|
|
46
|
+
afterCreateSceneGraph() {
|
|
47
|
+
this.scrollbarComponent.updateScrollBar(), (0, scroll_1.bindScrollBarListener)(this._gantt.eventManager);
|
|
48
|
+
}
|
|
49
|
+
refreshTaskBars() {
|
|
50
|
+
this.taskBar.refreshItems(), this.updateNextFrame();
|
|
51
|
+
}
|
|
52
|
+
refreshTaskBarsAndGrid() {
|
|
53
|
+
this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight),
|
|
54
|
+
this.tableGroup.setAttribute("height", this.tableGroupHeight), this.grid.refresh(),
|
|
55
|
+
this.taskBar.refreshItems(), this.markLine.refresh(), this.frameBorder.resize(),
|
|
56
|
+
this.scrollbarComponent.updateScrollBar(), this.updateNextFrame();
|
|
57
|
+
}
|
|
58
|
+
updateTableSize() {
|
|
59
|
+
this.tableGroupHeight = Math.min(this._gantt.tableNoFrameHeight, this._gantt.drawHeight),
|
|
60
|
+
this.tableGroup.setAttributes({
|
|
61
|
+
x: 0,
|
|
62
|
+
y: this._gantt.tableY,
|
|
63
|
+
width: this._gantt.tableNoFrameWidth,
|
|
64
|
+
height: this.tableGroupHeight
|
|
65
|
+
}), this.grid.resize(), this.taskBar.resize(), this.frameBorder.resize();
|
|
66
|
+
}
|
|
67
|
+
renderSceneGraph() {
|
|
68
|
+
this.stage.render();
|
|
69
|
+
}
|
|
70
|
+
updateNextFrame() {
|
|
71
|
+
this.stage.renderNextFrame();
|
|
72
|
+
}
|
|
73
|
+
get width() {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : 0;
|
|
76
|
+
}
|
|
77
|
+
get height() {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.height) && void 0 !== _b ? _b : 0;
|
|
80
|
+
}
|
|
81
|
+
get x() {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0;
|
|
84
|
+
}
|
|
85
|
+
get y() {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
return null !== (_b = null === (_a = this.tableGroup.attribute) || void 0 === _a ? void 0 : _a.y) && void 0 !== _b ? _b : 0;
|
|
88
|
+
}
|
|
89
|
+
setX(x, isEnd = !1) {
|
|
90
|
+
this.timelineHeader.setX(x), this.grid.setX(x), this.taskBar.setX(x), this.markLine.setX(x),
|
|
91
|
+
this.updateNextFrame();
|
|
92
|
+
}
|
|
93
|
+
setY(y, isEnd = !1) {
|
|
94
|
+
this.grid.setY(y), this.taskBar.setY(y), this.updateNextFrame();
|
|
95
|
+
}
|
|
96
|
+
setPixelRatio(pixelRatio) {
|
|
97
|
+
this.stage.disableDirtyBounds(), this.stage.window.setDpr(pixelRatio), this.stage.render(),
|
|
98
|
+
this.stage.enableDirtyBounds();
|
|
99
|
+
}
|
|
100
|
+
resize() {
|
|
101
|
+
this.updateTableSize(), this.scrollbarComponent.updateScrollBar(), this.updateNextFrame();
|
|
102
|
+
}
|
|
103
|
+
release() {
|
|
104
|
+
this.stage.release();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.Scenegraph = Scenegraph;
|
|
109
|
+
//# sourceMappingURL=scenegraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/scenegraph.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,iCAA8B;AAE9B,gCAA6B;AAC7B,6CAAkD;AAClD,4CAAwD;AACxD,uDAAmD;AACnD,yCAAqC;AACrC,2CAAuC;AACvC,iDAA6C;AAE7C,MAAa,UAAU;IAerB,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,gBAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAClC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3B,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAA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AClB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;IAEzB,CAAC;IAOD,IAAI,CAAC,CAAS,EAAE,KAAK,GAAG,KAAK;QAE3B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,aAAa,CAAC,UAAkB;QAI9B,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAhND,gCAgNC","file":"scenegraph.js","sourcesContent":["import { VRender } from '@visactor/vtable';\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';\n\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: VRender.Group;\n scrollbarComponent: ScrollBarComponent;\n markLine: MarkLine;\n frameBorder: FrameBorder;\n stage: VRender.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 // VRender.vglobal.setEnv('node', gantt.options.modeParams);\n // width = table.canvasWidth;\n // height = table.canvasHeight;\n } else {\n VRender.vglobal.setEnv('browser');\n width = gantt.canvas.width;\n height = gantt.canvas.height;\n }\n this.stage = VRender.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 // afterRender: () => {\n // this._gantt.fireListeners('after_render', null);\n // }\n });\n\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 VRender.Group({\n x: 0,\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 refreshTaskBars() {\n // this.timelineHeader.refresh();\n // this.grid.refresh();\n this.taskBar.refreshItems();\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.refreshItems();\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: 0,\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}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VRender } from '@visactor/vtable';
|
|
2
|
+
import type { Gantt } from '../Gantt';
|
|
3
|
+
export declare class ScrollBarComponent {
|
|
4
|
+
hScrollBar: VRender.ScrollBar;
|
|
5
|
+
vScrollBar: VRender.ScrollBar;
|
|
6
|
+
_gantt: Gantt;
|
|
7
|
+
_clearHorizontalScrollBar: any;
|
|
8
|
+
_clearVerticalScrollBar: any;
|
|
9
|
+
constructor(gantt: Gantt);
|
|
10
|
+
createScrollBar(tableWidth: number, tableHeight: number): void;
|
|
11
|
+
refresh(): void;
|
|
12
|
+
hideVerticalScrollBar(): void;
|
|
13
|
+
showVerticalScrollBar(autoHide?: boolean): void;
|
|
14
|
+
hideHorizontalScrollBar(): void;
|
|
15
|
+
showHorizontalScrollBar(autoHide?: boolean): void;
|
|
16
|
+
updateVerticalScrollBarPos(topRatio: number): void;
|
|
17
|
+
updateHorizontalScrollBarPos(leftRatio: number): void;
|
|
18
|
+
updateScrollBar(): void;
|
|
19
|
+
}
|