@visactor/vtable-gantt 1.26.4 → 1.26.6
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 +6 -6
- package/cjs/Gantt.js +35 -22
- package/cjs/Gantt.js.map +1 -1
- package/cjs/gantt-helper.js +2 -2
- package/cjs/gantt-helper.js.map +1 -1
- package/cjs/index.d.ts +3 -2
- package/cjs/index.js +11 -2
- package/cjs/index.js.map +1 -1
- package/cjs/scenegraph/gantt-node.d.ts +1 -1
- package/cjs/scenegraph/gantt-node.js.map +1 -1
- package/cjs/scenegraph/graphic/group-contribution-render.js +2 -2
- package/cjs/scenegraph/graphic/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/index.d.ts +1 -2
- package/cjs/scenegraph/graphic/index.js +2 -2
- package/cjs/scenegraph/graphic/index.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -1
- package/cjs/scenegraph/scenegraph.js +24 -7
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/task-bar.d.ts +2 -2
- package/cjs/scenegraph/task-bar.js +3 -2
- package/cjs/scenegraph/task-bar.js.map +1 -1
- package/cjs/state/state-manager.js +4 -2
- package/cjs/state/state-manager.js.map +1 -1
- package/cjs/tools/pixel-ratio.js +2 -2
- package/cjs/tools/pixel-ratio.js.map +1 -1
- package/cjs/ts-types/events.d.ts +11 -9
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/zoom-scale/DataZoomIntegration.d.ts +1 -0
- package/cjs/zoom-scale/DataZoomIntegration.js +19 -5
- package/cjs/zoom-scale/DataZoomIntegration.js.map +1 -1
- package/dist/vtable-gantt.js +72640 -63540
- package/dist/vtable-gantt.min.js +1 -1
- package/es/Gantt.d.ts +6 -6
- package/es/Gantt.js +35 -22
- package/es/Gantt.js.map +1 -1
- package/es/gantt-helper.js +3 -1
- package/es/gantt-helper.js.map +1 -1
- package/es/index.d.ts +3 -2
- package/es/index.js +4 -2
- package/es/index.js.map +1 -1
- package/es/scenegraph/gantt-node.d.ts +1 -1
- package/es/scenegraph/gantt-node.js.map +1 -1
- package/es/scenegraph/graphic/group-contribution-render.js +4 -2
- package/es/scenegraph/graphic/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/index.d.ts +1 -2
- package/es/scenegraph/graphic/index.js +3 -3
- package/es/scenegraph/graphic/index.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -1
- package/es/scenegraph/scenegraph.js +25 -6
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/task-bar.d.ts +2 -2
- package/es/scenegraph/task-bar.js +2 -2
- package/es/scenegraph/task-bar.js.map +1 -1
- package/es/state/state-manager.js +4 -2
- package/es/state/state-manager.js.map +1 -1
- package/es/tools/pixel-ratio.js +1 -1
- package/es/tools/pixel-ratio.js.map +1 -1
- package/es/ts-types/events.d.ts +11 -9
- package/es/ts-types/events.js.map +1 -1
- package/es/zoom-scale/DataZoomIntegration.d.ts +1 -0
- package/es/zoom-scale/DataZoomIntegration.js +21 -5
- package/es/zoom-scale/DataZoomIntegration.js.map +1 -1
- package/package.json +5 -5
package/cjs/Gantt.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export declare class Gantt extends EventTarget {
|
|
|
153
153
|
getRecordIndexByTaskShowIndex(showIndex: number): number | number[];
|
|
154
154
|
getTaskShowIndexByRecordIndex(index: number | number[]): number;
|
|
155
155
|
getRecordByIndex(taskShowIndex: number, sub_task_index?: number | number[]): any;
|
|
156
|
-
_refreshTaskBar(taskShowIndex: number, sub_task_index?: number): void;
|
|
156
|
+
_refreshTaskBar(taskShowIndex: number, sub_task_index?: number | number[]): void;
|
|
157
157
|
_updateRecordToListTable(record: any, index: number | number[]): void;
|
|
158
158
|
private _refreshSortedTaskBarsAfterRecordUpdate;
|
|
159
159
|
getTaskInfoByTaskListIndex(taskShowIndex: number, sub_task_index?: number | number[]): {
|
|
@@ -169,12 +169,12 @@ export declare class Gantt extends EventTarget {
|
|
|
169
169
|
baselineDays: number;
|
|
170
170
|
};
|
|
171
171
|
_updateStartDateToTaskRecord(startDate: Date, index: number, sub_task_index?: number | number[]): void;
|
|
172
|
-
_updateEndDateToTaskRecord(endDate: Date, index: number, sub_task_index?: number): void;
|
|
173
|
-
_updateStartEndDateToTaskRecord(startDate: Date, endDate: Date, index: number, sub_task_index?: number): void;
|
|
174
|
-
_updateProgressToTaskRecord(progress: number, index: number, sub_task_index?: number): void;
|
|
172
|
+
_updateEndDateToTaskRecord(endDate: Date, index: number, sub_task_index?: number | number[]): void;
|
|
173
|
+
_updateStartEndDateToTaskRecord(startDate: Date, endDate: Date, index: number, sub_task_index?: number | number[]): void;
|
|
174
|
+
_updateProgressToTaskRecord(progress: number, index: number, sub_task_index?: number | number[]): void;
|
|
175
175
|
_dragOrderTaskRecord(source_index: number, source_sub_task_index: number, target_index: number, target_sub_task_index: number): void;
|
|
176
176
|
updateTaskRecord(record: any, task_index: number | number[]): void;
|
|
177
|
-
updateTaskRecord(record: any, task_index: number, sub_task_index: number): void;
|
|
177
|
+
updateTaskRecord(record: any, task_index: number, sub_task_index: number | number[]): void;
|
|
178
178
|
setPixelRatio(pixelRatio: number): void;
|
|
179
179
|
updateTasksShowMode(tasksShowMode: TasksShowMode): void;
|
|
180
180
|
_resize(): void;
|
|
@@ -198,7 +198,7 @@ export declare class Gantt extends EventTarget {
|
|
|
198
198
|
set scrollTop(value: number);
|
|
199
199
|
get scrollLeft(): number;
|
|
200
200
|
set scrollLeft(value: number);
|
|
201
|
-
getTaskBarRelativeRect(index: number): {
|
|
201
|
+
getTaskBarRelativeRect(index: number, sub_task_index?: number | number[]): {
|
|
202
202
|
left: number;
|
|
203
203
|
top: number;
|
|
204
204
|
width: number;
|
package/cjs/Gantt.js
CHANGED
|
@@ -19,6 +19,11 @@ function createRootElement(padding, className = "vtable-gantt") {
|
|
|
19
19
|
|
|
20
20
|
exports.createRootElement = createRootElement;
|
|
21
21
|
|
|
22
|
+
const DEFAULT_TIMELINE_SCALE = {
|
|
23
|
+
unit: "day",
|
|
24
|
+
step: 1
|
|
25
|
+
};
|
|
26
|
+
|
|
22
27
|
class Gantt extends EventTarget_1.EventTarget {
|
|
23
28
|
recalculateTimeScale() {
|
|
24
29
|
this.zoomScaleManager && this.zoomScaleManager.recalculateTimeScale();
|
|
@@ -221,20 +226,22 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
221
226
|
return this.element.parentElement;
|
|
222
227
|
}
|
|
223
228
|
_sortScales() {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
229
|
+
var _a, _b;
|
|
230
|
+
const {timelineHeader: timelineHeader} = this.options, zoomLevelScales = null === (_a = this.zoomScaleManager) || void 0 === _a ? void 0 : _a.config.levels[this.zoomScaleManager.getCurrentLevel()], defaultTimelineScale = Object.assign({}, DEFAULT_TIMELINE_SCALE);
|
|
231
|
+
let timelineScales;
|
|
232
|
+
timelineScales = (null === (_b = null == timelineHeader ? void 0 : timelineHeader.scales) || void 0 === _b ? void 0 : _b.length) > 0 ? timelineHeader.scales : (null == zoomLevelScales ? void 0 : zoomLevelScales.length) > 0 ? zoomLevelScales : [ defaultTimelineScale ],
|
|
233
|
+
!timelineHeader || timelineHeader.scales && 0 !== timelineHeader.scales.length || (timelineHeader.scales = timelineScales.map((scale => Object.assign({}, scale))));
|
|
234
|
+
const sortOrder = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second" ];
|
|
235
|
+
this.parsedOptions.timeScaleIncludeHour = !1, 1 === timelineScales.length && ("hour" !== timelineScales[0].unit && "minute" !== timelineScales[0].unit && "second" !== timelineScales[0].unit || (this.parsedOptions.timeScaleIncludeHour = !0));
|
|
236
|
+
const orderedScales = timelineScales.slice().sort(((a, b) => {
|
|
237
|
+
"hour" !== a.unit && "minute" !== a.unit && "second" !== a.unit || (this.parsedOptions.timeScaleIncludeHour = !0);
|
|
238
|
+
const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
|
|
239
|
+
return -1 === indexA ? 1 : -1 === indexB ? -1 : indexA - indexB;
|
|
240
|
+
})), reverseOrderedScales = timelineScales.slice().sort(((a, b) => {
|
|
241
|
+
const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
|
|
242
|
+
return -1 === indexA ? 1 : -1 === indexB ? -1 : indexB - indexA;
|
|
243
|
+
}));
|
|
244
|
+
this.parsedOptions.sortedTimelineScales = orderedScales, this.parsedOptions.reverseSortedTimelineScales = reverseOrderedScales;
|
|
238
245
|
}
|
|
239
246
|
_generateTimeLineDateMap() {
|
|
240
247
|
if (this.parsedOptions.minDate && this.parsedOptions.maxDate) for (const scale of this.parsedOptions.reverseSortedTimelineScales) scale.timelineDates = (0,
|
|
@@ -362,7 +369,7 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
362
369
|
return this.records[taskShowIndex];
|
|
363
370
|
}
|
|
364
371
|
_refreshTaskBar(taskShowIndex, sub_task_index) {
|
|
365
|
-
this.scenegraph.taskBar.updateTaskBarNode(taskShowIndex, sub_task_index), this.scenegraph.refreshRecordLinkNodes(taskShowIndex,
|
|
372
|
+
this.scenegraph.taskBar.updateTaskBarNode(taskShowIndex, sub_task_index), this.scenegraph.refreshRecordLinkNodes(taskShowIndex, sub_task_index, this.scenegraph.taskBar.getTaskBarNodeByIndex(taskShowIndex, sub_task_index)),
|
|
366
373
|
this.scenegraph.updateNextFrame();
|
|
367
374
|
}
|
|
368
375
|
_updateRecordToListTable(record, index) {
|
|
@@ -443,7 +450,8 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
443
450
|
var _a;
|
|
444
451
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : (0,
|
|
445
452
|
util_1.parseDateFormat)(taskRecord[startDateField]), newStartDate = (0, util_1.formatDate)(startDate, dateFormat);
|
|
446
|
-
if (taskRecord[startDateField] = newStartDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && this.
|
|
453
|
+
if (taskRecord[startDateField] = newStartDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && (this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
454
|
+
this.stateManager.updateProjectTaskTimes(sub_task_index)); else {
|
|
447
455
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
448
456
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
449
457
|
Array.isArray(recordIndex) && this.stateManager.updateProjectTaskTimes(recordIndex),
|
|
@@ -454,7 +462,8 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
454
462
|
var _a;
|
|
455
463
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : (0,
|
|
456
464
|
util_1.parseDateFormat)(taskRecord[endDateField]), newEndDate = (0, util_1.formatDate)(endDate, dateFormat);
|
|
457
|
-
if (taskRecord[endDateField] = newEndDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && this.
|
|
465
|
+
if (taskRecord[endDateField] = newEndDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && (this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
466
|
+
this.stateManager.updateProjectTaskTimes(sub_task_index)); else {
|
|
458
467
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
459
468
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
460
469
|
Array.isArray(recordIndex) && this.stateManager.updateProjectTaskTimes(recordIndex),
|
|
@@ -467,7 +476,8 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
467
476
|
util_1.parseDateFormat)(taskRecord[startDateField]), newStartDate = (0, util_1.formatDate)(startDate, dateFormat);
|
|
468
477
|
taskRecord[startDateField] = newStartDate;
|
|
469
478
|
const newEndDate = (0, util_1.formatDate)(endDate, dateFormat);
|
|
470
|
-
if (taskRecord[endDateField] = newEndDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && this.
|
|
479
|
+
if (taskRecord[endDateField] = newEndDate, (0, vutils_1.isValid)(sub_task_index)) Array.isArray(sub_task_index) && (this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
480
|
+
this.stateManager.updateProjectTaskTimes(sub_task_index)); else {
|
|
471
481
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
472
482
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
473
483
|
Array.isArray(recordIndex) && this.stateManager.updateProjectTaskTimes(recordIndex),
|
|
@@ -477,7 +487,8 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
477
487
|
_updateProgressToTaskRecord(progress, index, sub_task_index) {
|
|
478
488
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), progressField = this.parsedOptions.progressField;
|
|
479
489
|
if (progressField) {
|
|
480
|
-
taskRecord[progressField] = progress
|
|
490
|
+
if (taskRecord[progressField] = progress, Array.isArray(sub_task_index)) return this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
491
|
+
void this._refreshTaskBar(index, sub_task_index);
|
|
481
492
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
482
493
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
483
494
|
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index) || this._refreshTaskBar(index, sub_task_index);
|
|
@@ -489,7 +500,8 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
489
500
|
updateTaskRecord(record, task_index, sub_task_index) {
|
|
490
501
|
if ((0, vutils_1.isValid)(sub_task_index)) {
|
|
491
502
|
const index = "number" == typeof task_index ? task_index : task_index[0];
|
|
492
|
-
return this._updateRecordToListTable(record, [ index, sub_task_index ]),
|
|
503
|
+
return this._updateRecordToListTable(record, Array.isArray(sub_task_index) ? sub_task_index : [ index, sub_task_index ]),
|
|
504
|
+
void this._refreshTaskBar(index, sub_task_index);
|
|
493
505
|
}
|
|
494
506
|
if (Array.isArray(task_index)) {
|
|
495
507
|
const index = task_index[0], sub_index = task_index[1];
|
|
@@ -632,8 +644,9 @@ class Gantt extends EventTarget_1.EventTarget {
|
|
|
632
644
|
set scrollLeft(value) {
|
|
633
645
|
this.stateManager.setScrollLeft(value);
|
|
634
646
|
}
|
|
635
|
-
getTaskBarRelativeRect(index) {
|
|
636
|
-
const taskBarNode = this.scenegraph.taskBar.getTaskBarNodeByIndex(index);
|
|
647
|
+
getTaskBarRelativeRect(index, sub_task_index) {
|
|
648
|
+
const taskBarNode = this.scenegraph.taskBar.getTaskBarNodeByIndex(index, sub_task_index);
|
|
649
|
+
if (!taskBarNode) return null;
|
|
637
650
|
return {
|
|
638
651
|
left: taskBarNode.attribute.x + this.taskListTableInstance.tableNoFrameWidth + this.taskListTableInstance.tableX + this.tableX - this.scrollLeft,
|
|
639
652
|
top: taskBarNode.attribute.y + this.tableY + this.headerHeight - this.scrollTop,
|