@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/es/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/es/Gantt.js
CHANGED
|
@@ -37,6 +37,11 @@ export function createRootElement(padding, className = "vtable-gantt") {
|
|
|
37
37
|
element;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
const DEFAULT_TIMELINE_SCALE = {
|
|
41
|
+
unit: "day",
|
|
42
|
+
step: 1
|
|
43
|
+
};
|
|
44
|
+
|
|
40
45
|
export class Gantt extends EventTarget {
|
|
41
46
|
recalculateTimeScale() {
|
|
42
47
|
this.zoomScaleManager && this.zoomScaleManager.recalculateTimeScale();
|
|
@@ -236,20 +241,22 @@ export class Gantt extends EventTarget {
|
|
|
236
241
|
return this.element.parentElement;
|
|
237
242
|
}
|
|
238
243
|
_sortScales() {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
244
|
+
var _a, _b;
|
|
245
|
+
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);
|
|
246
|
+
let timelineScales;
|
|
247
|
+
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 ],
|
|
248
|
+
!timelineHeader || timelineHeader.scales && 0 !== timelineHeader.scales.length || (timelineHeader.scales = timelineScales.map((scale => Object.assign({}, scale))));
|
|
249
|
+
const sortOrder = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second" ];
|
|
250
|
+
this.parsedOptions.timeScaleIncludeHour = !1, 1 === timelineScales.length && ("hour" !== timelineScales[0].unit && "minute" !== timelineScales[0].unit && "second" !== timelineScales[0].unit || (this.parsedOptions.timeScaleIncludeHour = !0));
|
|
251
|
+
const orderedScales = timelineScales.slice().sort(((a, b) => {
|
|
252
|
+
"hour" !== a.unit && "minute" !== a.unit && "second" !== a.unit || (this.parsedOptions.timeScaleIncludeHour = !0);
|
|
253
|
+
const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
|
|
254
|
+
return -1 === indexA ? 1 : -1 === indexB ? -1 : indexA - indexB;
|
|
255
|
+
})), reverseOrderedScales = timelineScales.slice().sort(((a, b) => {
|
|
256
|
+
const indexA = sortOrder.indexOf(a.unit), indexB = sortOrder.indexOf(b.unit);
|
|
257
|
+
return -1 === indexA ? 1 : -1 === indexB ? -1 : indexB - indexA;
|
|
258
|
+
}));
|
|
259
|
+
this.parsedOptions.sortedTimelineScales = orderedScales, this.parsedOptions.reverseSortedTimelineScales = reverseOrderedScales;
|
|
253
260
|
}
|
|
254
261
|
_generateTimeLineDateMap() {
|
|
255
262
|
if (this.parsedOptions.minDate && this.parsedOptions.maxDate) for (const scale of this.parsedOptions.reverseSortedTimelineScales) scale.timelineDates = generateTimeLineDate(new Date(this.parsedOptions.minDate), this.parsedOptions.maxDate, scale);
|
|
@@ -376,7 +383,7 @@ export class Gantt extends EventTarget {
|
|
|
376
383
|
return this.records[taskShowIndex];
|
|
377
384
|
}
|
|
378
385
|
_refreshTaskBar(taskShowIndex, sub_task_index) {
|
|
379
|
-
this.scenegraph.taskBar.updateTaskBarNode(taskShowIndex, sub_task_index), this.scenegraph.refreshRecordLinkNodes(taskShowIndex,
|
|
386
|
+
this.scenegraph.taskBar.updateTaskBarNode(taskShowIndex, sub_task_index), this.scenegraph.refreshRecordLinkNodes(taskShowIndex, sub_task_index, this.scenegraph.taskBar.getTaskBarNodeByIndex(taskShowIndex, sub_task_index)),
|
|
380
387
|
this.scenegraph.updateNextFrame();
|
|
381
388
|
}
|
|
382
389
|
_updateRecordToListTable(record, index) {
|
|
@@ -453,7 +460,8 @@ export class Gantt extends EventTarget {
|
|
|
453
460
|
_updateStartDateToTaskRecord(startDate, index, sub_task_index) {
|
|
454
461
|
var _a;
|
|
455
462
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : parseDateFormat(taskRecord[startDateField]), newStartDate = formatDate(startDate, dateFormat);
|
|
456
|
-
if (taskRecord[startDateField] = newStartDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && this.
|
|
463
|
+
if (taskRecord[startDateField] = newStartDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && (this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
464
|
+
this.stateManager.updateProjectTaskTimes(sub_task_index)); else {
|
|
457
465
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
458
466
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
459
467
|
Array.isArray(recordIndex) && this.stateManager.updateProjectTaskTimes(recordIndex),
|
|
@@ -463,7 +471,8 @@ export class Gantt extends EventTarget {
|
|
|
463
471
|
_updateEndDateToTaskRecord(endDate, index, sub_task_index) {
|
|
464
472
|
var _a;
|
|
465
473
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : parseDateFormat(taskRecord[endDateField]), newEndDate = formatDate(endDate, dateFormat);
|
|
466
|
-
if (taskRecord[endDateField] = newEndDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && this.
|
|
474
|
+
if (taskRecord[endDateField] = newEndDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && (this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
475
|
+
this.stateManager.updateProjectTaskTimes(sub_task_index)); else {
|
|
467
476
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
468
477
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
469
478
|
Array.isArray(recordIndex) && this.stateManager.updateProjectTaskTimes(recordIndex),
|
|
@@ -475,7 +484,8 @@ export class Gantt extends EventTarget {
|
|
|
475
484
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), startDateField = this.parsedOptions.startDateField, endDateField = this.parsedOptions.endDateField, dateFormat = null !== (_a = this.parsedOptions.dateFormat) && void 0 !== _a ? _a : parseDateFormat(taskRecord[startDateField]), newStartDate = formatDate(startDate, dateFormat);
|
|
476
485
|
taskRecord[startDateField] = newStartDate;
|
|
477
486
|
const newEndDate = formatDate(endDate, dateFormat);
|
|
478
|
-
if (taskRecord[endDateField] = newEndDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && this.
|
|
487
|
+
if (taskRecord[endDateField] = newEndDate, isValid(sub_task_index)) Array.isArray(sub_task_index) && (this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
488
|
+
this.stateManager.updateProjectTaskTimes(sub_task_index)); else {
|
|
479
489
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
480
490
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
481
491
|
Array.isArray(recordIndex) && this.stateManager.updateProjectTaskTimes(recordIndex),
|
|
@@ -485,7 +495,8 @@ export class Gantt extends EventTarget {
|
|
|
485
495
|
_updateProgressToTaskRecord(progress, index, sub_task_index) {
|
|
486
496
|
const taskRecord = this.getRecordByIndex(index, sub_task_index), progressField = this.parsedOptions.progressField;
|
|
487
497
|
if (progressField) {
|
|
488
|
-
taskRecord[progressField] = progress
|
|
498
|
+
if (taskRecord[progressField] = progress, Array.isArray(sub_task_index)) return this._updateRecordToListTable(taskRecord, sub_task_index),
|
|
499
|
+
void this._refreshTaskBar(index, sub_task_index);
|
|
489
500
|
const recordIndex = this.getRecordIndexByTaskShowIndex(index);
|
|
490
501
|
this._updateRecordToListTable(taskRecord, Array.isArray(recordIndex) ? recordIndex : index),
|
|
491
502
|
this._refreshSortedTaskBarsAfterRecordUpdate(recordIndex, index) || this._refreshTaskBar(index, sub_task_index);
|
|
@@ -497,7 +508,8 @@ export class Gantt extends EventTarget {
|
|
|
497
508
|
updateTaskRecord(record, task_index, sub_task_index) {
|
|
498
509
|
if (isValid(sub_task_index)) {
|
|
499
510
|
const index = "number" == typeof task_index ? task_index : task_index[0];
|
|
500
|
-
return this._updateRecordToListTable(record, [ index, sub_task_index ]),
|
|
511
|
+
return this._updateRecordToListTable(record, Array.isArray(sub_task_index) ? sub_task_index : [ index, sub_task_index ]),
|
|
512
|
+
void this._refreshTaskBar(index, sub_task_index);
|
|
501
513
|
}
|
|
502
514
|
if (Array.isArray(task_index)) {
|
|
503
515
|
const index = task_index[0], sub_index = task_index[1];
|
|
@@ -637,8 +649,9 @@ export class Gantt extends EventTarget {
|
|
|
637
649
|
set scrollLeft(value) {
|
|
638
650
|
this.stateManager.setScrollLeft(value);
|
|
639
651
|
}
|
|
640
|
-
getTaskBarRelativeRect(index) {
|
|
641
|
-
const taskBarNode = this.scenegraph.taskBar.getTaskBarNodeByIndex(index);
|
|
652
|
+
getTaskBarRelativeRect(index, sub_task_index) {
|
|
653
|
+
const taskBarNode = this.scenegraph.taskBar.getTaskBarNodeByIndex(index, sub_task_index);
|
|
654
|
+
if (!taskBarNode) return null;
|
|
642
655
|
return {
|
|
643
656
|
left: taskBarNode.attribute.x + this.taskListTableInstance.tableNoFrameWidth + this.taskListTableInstance.tableX + this.tableX - this.scrollLeft,
|
|
644
657
|
top: taskBarNode.attribute.y + this.tableY + this.headerHeight - this.scrollTop,
|