@visactor/vtable-gantt 1.22.2 → 1.22.3

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.
@@ -38,15 +38,15 @@ class DataSource {
38
38
  }
39
39
  }
40
40
  adjustOrder(source_index, source_sub_task_index, target_index, target_sub_task_index) {
41
- var _a, _b, _c, _d;
42
- if (this._gantt.parsedOptions.tasksShowMode !== gantt_engine_1.TasksShowMode.Sub_Tasks_Arrange && this._gantt.parsedOptions.tasksShowMode !== gantt_engine_1.TasksShowMode.Sub_Tasks_Compact || source_index !== target_index) if (this._gantt.parsedOptions.tasksShowMode === gantt_engine_1.TasksShowMode.Sub_Tasks_Inline) {
41
+ var _a, _b, _c, _d, _e, _f, _g;
42
+ if ((this._gantt.parsedOptions.tasksShowMode !== gantt_engine_1.TasksShowMode.Sub_Tasks_Arrange && this._gantt.parsedOptions.tasksShowMode !== gantt_engine_1.TasksShowMode.Sub_Tasks_Compact || source_index !== target_index) && !(target_index < 0 || target_sub_task_index < 0)) if (this._gantt.parsedOptions.tasksShowMode === gantt_engine_1.TasksShowMode.Sub_Tasks_Inline) {
43
43
  if ((0, vutils_1.isValid)(source_sub_task_index) && (0, vutils_1.isValid)(target_sub_task_index) && (0,
44
44
  vutils_1.isValid)(source_index) && (0, vutils_1.isValid)(target_index)) {
45
45
  const sub_task_record = this.records[source_index].children[source_sub_task_index];
46
- this.records[source_index].children.splice(source_sub_task_index, 1), this.records[target_index].children || (this.records[target_index].children = []),
46
+ this.records[source_index].children.splice(source_sub_task_index, 1), (null === (_a = this.records[target_index]) || void 0 === _a ? void 0 : _a.children) || (this.records[target_index].children = []),
47
47
  this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);
48
48
  }
49
- null === (_b = null === (_a = this.records[target_index]) || void 0 === _a ? void 0 : _a.children) || void 0 === _b || _b.sort(((a, b) => (0,
49
+ null === (_c = null === (_b = this.records[target_index]) || void 0 === _b ? void 0 : _b.children) || void 0 === _c || _c.sort(((a, b) => (0,
50
50
  util_1.createDateAtMidnight)(a[this._gantt.parsedOptions.startDateField]).getTime() - (0,
51
51
  util_1.createDateAtMidnight)(b[this._gantt.parsedOptions.startDateField]).getTime()));
52
52
  } else if (this._gantt.parsedOptions.tasksShowMode === gantt_engine_1.TasksShowMode.Project_Sub_Tasks_Inline) {
@@ -54,16 +54,16 @@ class DataSource {
54
54
  vutils_1.isValid)(source_index) && (0, vutils_1.isValid)(target_index)) {
55
55
  this.records[source_index].type, gantt_engine_1.TaskType.PROJECT;
56
56
  const targetIsProject = this.records[target_index].type === gantt_engine_1.TaskType.PROJECT, sub_task_record = this.records[source_index].children[source_sub_task_index];
57
- this.records[source_index].children.splice(source_sub_task_index, 1), this.records[target_index].children || (this.records[target_index].children = []),
57
+ this.records[source_index].children.splice(source_sub_task_index, 1), (null === (_d = this.records[target_index]) || void 0 === _d ? void 0 : _d.children) || (this.records[target_index].children = []),
58
58
  this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record),
59
- targetIsProject && (null === (_d = null === (_c = this.records[target_index]) || void 0 === _c ? void 0 : _c.children) || void 0 === _d || _d.sort(((a, b) => (0,
59
+ targetIsProject && (null === (_f = null === (_e = this.records[target_index]) || void 0 === _e ? void 0 : _e.children) || void 0 === _f || _f.sort(((a, b) => (0,
60
60
  util_1.createDateAtMidnight)(a[this._gantt.parsedOptions.startDateField]).getTime() - (0,
61
61
  util_1.createDateAtMidnight)(b[this._gantt.parsedOptions.startDateField]).getTime())));
62
62
  }
63
63
  } else if ((0, vutils_1.isValid)(source_sub_task_index) && (0, vutils_1.isValid)(target_sub_task_index) && (0,
64
64
  vutils_1.isValid)(source_index) && (0, vutils_1.isValid)(target_index)) {
65
65
  const sub_task_record = this.records[source_index].children[source_sub_task_index];
66
- this.records[source_index].children.splice(source_sub_task_index, 1), this.records[target_index].children || (this.records[target_index].children = []),
66
+ this.records[source_index].children.splice(source_sub_task_index, 1), (null === (_g = this.records[target_index]) || void 0 === _g ? void 0 : _g.children) || (this.records[target_index].children = []),
67
67
  this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);
68
68
  }
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/DataSource.ts"],"names":[],"mappings":";;;AACA,wCAAmG;AACnG,2DAAmE;AACnE,6CAA2C;AAE3C,MAAa,UAAU;IAGrB,YAAY,MAAa;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IACD,cAAc;QACZ,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QACjD,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAEjD,IAAI,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACtC,IAAI,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACtC,IACE,CAAC,WAAW;YACV,WAAW;YACX,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,KAAK,4BAAa,CAAC,gBAAgB;YAC1E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,KAAK,4BAAa,CAAC,iBAAiB,CAAC;YAC9E,IAAI,CAAC,OAAO,CAAC,MAAM,EACnB;YACA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC/B,IAAI,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE;oBACnE,MAAM,aAAa,GAAG,IAAA,2BAAoB,EAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAA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cAAc,CAAC,CAAC,CAAC,OAAO,EAAE,CAC5E,CAAC;oBACJ,CAAC,CAAC,CAAC;iBACJ;aACF;SACF;aAAM;YACL,IACE,IAAA,gBAAO,EAAC,qBAAqB,CAAC;gBAC9B,IAAA,gBAAO,EAAC,qBAAqB,CAAC;gBAC9B,IAAA,gBAAO,EAAC,YAAY,CAAC;gBACrB,IAAA,gBAAO,EAAC,YAAY,CAAC,EACrB;gBACA,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;gBACnF,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;gBACrE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE;oBACxC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC;iBAC1C;gBACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC;aACvF;SACF;IACH,CAAC;IACD,UAAU,CAAC,OAAc;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF;AAhKD,gCAgKC","file":"DataSource.js","sourcesContent":["import type { Gantt } from '../Gantt';\nimport { createDateAtMidnight, getEndDateByTimeUnit, getStartDateByTimeUnit } from '../tools/util';\nimport { TasksShowMode, TaskType } from '../ts-types/gantt-engine';\nimport { isValid } from '@visactor/vutils';\n\nexport class DataSource {\n records: any[];\n _gantt: Gantt;\n constructor(_gantt: Gantt) {\n this._gantt = _gantt;\n this.records = _gantt.records;\n this.processRecords();\n }\n processRecords() {\n const needMinDate = !this._gantt.options.minDate;\n const needMaxDate = !this._gantt.options.maxDate;\n\n let minDate = Number.MAX_SAFE_INTEGER;\n let maxDate = Number.MIN_SAFE_INTEGER;\n if (\n (needMinDate ||\n needMaxDate ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact) &&\n this.records.length\n ) {\n for (let i = 0; i < this.records.length; i++) {\n const record = this.records[i];\n if (needMinDate && record[this._gantt.parsedOptions.startDateField]) {\n const recordMinDate = createDateAtMidnight(record[this._gantt.parsedOptions.startDateField]);\n minDate = Math.min(minDate, recordMinDate.getTime());\n }\n if (needMaxDate && record[this._gantt.parsedOptions.endDateField]) {\n const recordMaxDate = createDateAtMidnight(record[this._gantt.parsedOptions.endDateField]);\n maxDate = Math.max(maxDate, recordMaxDate.getTime());\n }\n\n if (\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact\n ) {\n // 将子任务按开始时间升序排列\n record.children &&\n record.children.sort((a: any, b: any) => {\n return (\n createDateAtMidnight(a[this._gantt.parsedOptions.startDateField]).getTime() -\n createDateAtMidnight(b[this._gantt.parsedOptions.startDateField]).getTime()\n );\n });\n }\n }\n\n const { unit: minTimeUnit, startOfWeek, step } = this._gantt.parsedOptions.reverseSortedTimelineScales[0];\n if (needMinDate) {\n this._gantt.parsedOptions.minDate = getStartDateByTimeUnit(new Date(minDate), minTimeUnit, startOfWeek);\n this._gantt.parsedOptions._minDateTime = this._gantt.parsedOptions.minDate.getTime();\n }\n\n // 提供了最大值,没有提供最小值,因为最大值依赖最小值,所以应该重新计算\n if (needMinDate && !needMaxDate) {\n this._gantt.parsedOptions.maxDate = getEndDateByTimeUnit(\n this._gantt.parsedOptions.minDate,\n new Date(this._gantt.options.maxDate),\n minTimeUnit,\n step\n );\n this._gantt.parsedOptions._maxDateTime = this._gantt.parsedOptions.maxDate.getTime();\n }\n\n if (needMaxDate) {\n this._gantt.parsedOptions.maxDate = getEndDateByTimeUnit(\n this._gantt.parsedOptions.minDate,\n new Date(maxDate),\n minTimeUnit,\n step\n );\n this._gantt.parsedOptions._maxDateTime = this._gantt.parsedOptions.maxDate.getTime();\n }\n }\n }\n adjustOrder(\n source_index: number,\n source_sub_task_index: number,\n target_index: number,\n target_sub_task_index: number\n ) {\n if (\n (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact) &&\n source_index === target_index\n ) {\n return;\n }\n if (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline) {\n if (\n isValid(source_sub_task_index) &&\n isValid(target_sub_task_index) &&\n isValid(source_index) &&\n isValid(target_index)\n ) {\n const sub_task_record = this.records[source_index].children[source_sub_task_index];\n this.records[source_index].children.splice(source_sub_task_index, 1);\n if (!this.records[target_index].children) {\n this.records[target_index].children = [];\n }\n this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);\n }\n this.records[target_index]?.children?.sort((a: any, b: any) => {\n return (\n createDateAtMidnight(a[this._gantt.parsedOptions.startDateField]).getTime() -\n createDateAtMidnight(b[this._gantt.parsedOptions.startDateField]).getTime()\n );\n });\n } else if (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Project_Sub_Tasks_Inline) {\n // For Project_Sub_Tasks_Inline mode, we handle reordering based on whether tasks are projects\n if (\n isValid(source_sub_task_index) &&\n isValid(target_sub_task_index) &&\n isValid(source_index) &&\n isValid(target_index)\n ) {\n // Check if source and target are projects\n const sourceIsProject = this.records[source_index].type === TaskType.PROJECT;\n const targetIsProject = this.records[target_index].type === TaskType.PROJECT;\n\n // Moving subtask from a project to another project or normal task\n const sub_task_record = this.records[source_index].children[source_sub_task_index];\n this.records[source_index].children.splice(source_sub_task_index, 1);\n\n if (!this.records[target_index].children) {\n this.records[target_index].children = [];\n }\n\n this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);\n\n // If target is a project, sort children by date\n if (targetIsProject) {\n this.records[target_index]?.children?.sort((a: any, b: any) => {\n return (\n createDateAtMidnight(a[this._gantt.parsedOptions.startDateField]).getTime() -\n createDateAtMidnight(b[this._gantt.parsedOptions.startDateField]).getTime()\n );\n });\n }\n }\n } else {\n if (\n isValid(source_sub_task_index) &&\n isValid(target_sub_task_index) &&\n isValid(source_index) &&\n isValid(target_index)\n ) {\n const sub_task_record = this.records[source_index].children[source_sub_task_index];\n this.records[source_index].children.splice(source_sub_task_index, 1);\n if (!this.records[target_index].children) {\n this.records[target_index].children = [];\n }\n this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);\n }\n }\n }\n setRecords(records: any[]) {\n this.records = records;\n this.processRecords();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/data/DataSource.ts"],"names":[],"mappings":";;;AACA,wCAAmG;AACnG,2DAAmE;AACnE,6CAA2C;AAE3C,MAAa,UAAU;IAGrB,YAAY,MAAa;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IACD,cAAc;QACZ,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QACjD,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAEjD,IAAI,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACtC,IAAI,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACtC,IACE,CAAC,WAAW;YACV,WAAW;YACX,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,KAAK,4BAAa,CAAC,gBAAgB;YAC1E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,KAAK,4BAAa,CAAC,iBAAiB,CAAC;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qBAAqB,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC;aACvF;SACF;IACH,CAAC;IACD,UAAU,CAAC,OAAc;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF;AArKD,gCAqKC","file":"DataSource.js","sourcesContent":["import type { Gantt } from '../Gantt';\nimport { createDateAtMidnight, getEndDateByTimeUnit, getStartDateByTimeUnit } from '../tools/util';\nimport { TasksShowMode, TaskType } from '../ts-types/gantt-engine';\nimport { isValid } from '@visactor/vutils';\n\nexport class DataSource {\n records: any[];\n _gantt: Gantt;\n constructor(_gantt: Gantt) {\n this._gantt = _gantt;\n this.records = _gantt.records;\n this.processRecords();\n }\n processRecords() {\n const needMinDate = !this._gantt.options.minDate;\n const needMaxDate = !this._gantt.options.maxDate;\n\n let minDate = Number.MAX_SAFE_INTEGER;\n let maxDate = Number.MIN_SAFE_INTEGER;\n if (\n (needMinDate ||\n needMaxDate ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact) &&\n this.records.length\n ) {\n for (let i = 0; i < this.records.length; i++) {\n const record = this.records[i];\n if (needMinDate && record[this._gantt.parsedOptions.startDateField]) {\n const recordMinDate = createDateAtMidnight(record[this._gantt.parsedOptions.startDateField]);\n minDate = Math.min(minDate, recordMinDate.getTime());\n }\n if (needMaxDate && record[this._gantt.parsedOptions.endDateField]) {\n const recordMaxDate = createDateAtMidnight(record[this._gantt.parsedOptions.endDateField]);\n maxDate = Math.max(maxDate, recordMaxDate.getTime());\n }\n\n if (\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact\n ) {\n // 将子任务按开始时间升序排列\n record.children &&\n record.children.sort((a: any, b: any) => {\n return (\n createDateAtMidnight(a[this._gantt.parsedOptions.startDateField]).getTime() -\n createDateAtMidnight(b[this._gantt.parsedOptions.startDateField]).getTime()\n );\n });\n }\n }\n\n const { unit: minTimeUnit, startOfWeek, step } = this._gantt.parsedOptions.reverseSortedTimelineScales[0];\n if (needMinDate) {\n this._gantt.parsedOptions.minDate = getStartDateByTimeUnit(new Date(minDate), minTimeUnit, startOfWeek);\n this._gantt.parsedOptions._minDateTime = this._gantt.parsedOptions.minDate.getTime();\n }\n\n // 提供了最大值,没有提供最小值,因为最大值依赖最小值,所以应该重新计算\n if (needMinDate && !needMaxDate) {\n this._gantt.parsedOptions.maxDate = getEndDateByTimeUnit(\n this._gantt.parsedOptions.minDate,\n new Date(this._gantt.options.maxDate),\n minTimeUnit,\n step\n );\n this._gantt.parsedOptions._maxDateTime = this._gantt.parsedOptions.maxDate.getTime();\n }\n\n if (needMaxDate) {\n this._gantt.parsedOptions.maxDate = getEndDateByTimeUnit(\n this._gantt.parsedOptions.minDate,\n new Date(maxDate),\n minTimeUnit,\n step\n );\n this._gantt.parsedOptions._maxDateTime = this._gantt.parsedOptions.maxDate.getTime();\n }\n }\n }\n adjustOrder(\n source_index: number,\n source_sub_task_index: number,\n target_index: number,\n target_sub_task_index: number\n ) {\n if (\n (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange ||\n this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact) &&\n source_index === target_index\n ) {\n return;\n }\n // Excluding scenarios where the target value exceeds the boundary\n if (target_index < 0 || target_sub_task_index < 0) {\n return;\n }\n\n if (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline) {\n if (\n isValid(source_sub_task_index) &&\n isValid(target_sub_task_index) &&\n isValid(source_index) &&\n isValid(target_index)\n ) {\n const sub_task_record = this.records[source_index].children[source_sub_task_index];\n this.records[source_index].children.splice(source_sub_task_index, 1);\n\n if (!this.records[target_index]?.children) {\n this.records[target_index].children = [];\n }\n this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);\n }\n this.records[target_index]?.children?.sort((a: any, b: any) => {\n return (\n createDateAtMidnight(a[this._gantt.parsedOptions.startDateField]).getTime() -\n createDateAtMidnight(b[this._gantt.parsedOptions.startDateField]).getTime()\n );\n });\n } else if (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Project_Sub_Tasks_Inline) {\n // For Project_Sub_Tasks_Inline mode, we handle reordering based on whether tasks are projects\n if (\n isValid(source_sub_task_index) &&\n isValid(target_sub_task_index) &&\n isValid(source_index) &&\n isValid(target_index)\n ) {\n // Check if source and target are projects\n const sourceIsProject = this.records[source_index].type === TaskType.PROJECT;\n const targetIsProject = this.records[target_index].type === TaskType.PROJECT;\n\n // Moving subtask from a project to another project or normal task\n const sub_task_record = this.records[source_index].children[source_sub_task_index];\n this.records[source_index].children.splice(source_sub_task_index, 1);\n if (!this.records[target_index]?.children) {\n this.records[target_index].children = [];\n }\n\n this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);\n\n // If target is a project, sort children by date\n if (targetIsProject) {\n this.records[target_index]?.children?.sort((a: any, b: any) => {\n return (\n createDateAtMidnight(a[this._gantt.parsedOptions.startDateField]).getTime() -\n createDateAtMidnight(b[this._gantt.parsedOptions.startDateField]).getTime()\n );\n });\n }\n }\n } else {\n if (\n isValid(source_sub_task_index) &&\n isValid(target_sub_task_index) &&\n isValid(source_index) &&\n isValid(target_index)\n ) {\n const sub_task_record = this.records[source_index].children[source_sub_task_index];\n this.records[source_index].children.splice(source_sub_task_index, 1);\n if (!this.records[target_index]?.children) {\n this.records[target_index].children = [];\n }\n this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);\n }\n }\n }\n setRecords(records: any[]) {\n this.records = records;\n this.processRecords();\n }\n}\n"]}
package/cjs/index.d.ts CHANGED
@@ -6,5 +6,5 @@ import * as tools from './tools';
6
6
  import * as VRender from './vrender';
7
7
  import * as VTable from './vtable';
8
8
  import * as plugins from './plugins';
9
- export declare const version = "1.22.2";
9
+ export declare const version = "1.22.3";
10
10
  export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable, plugins };
package/cjs/index.js CHANGED
@@ -56,5 +56,5 @@ exports.VTable = VTable;
56
56
 
57
57
  const plugins = __importStar(require("./plugins"));
58
58
 
59
- exports.plugins = plugins, exports.version = "1.22.2";
59
+ exports.plugins = plugins, exports.version = "1.22.3";
60
60
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.22.2\";\n/**\n * @namespace VTableGantt\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.22.3\";\n/**\n * @namespace VTableGantt\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
@@ -40905,7 +40905,7 @@
40905
40905
  } else if (isEmptyA || isEmptyB) return indexA - indexB;
40906
40906
  return (state.orderFn || ("desc" !== state.order ? (v1, v2) => v1 === v2 ? 0 : v1 > v2 ? 1 : -1 : (v1, v2) => v1 === v2 ? 0 : v1 < v2 ? 1 : -1))(this.getOriginalField(indexA, state.field), this.getOriginalField(indexB, state.field), state.order);
40907
40907
  }, 0);
40908
- }), this.currentIndexedData = sortedIndexArray, this.hierarchyExpandLevel) {
40908
+ }), this.currentIndexedData = sortedIndexArray, this.hierarchyExpandLevel && "tree" === this.rowHierarchyType) {
40909
40909
  let nodeLength = sortedIndexArray.length;
40910
40910
  for (let i = 0; i < nodeLength; i++) {
40911
40911
  const record = this.getOriginalRecord(sortedIndexArray[i]),
@@ -45164,7 +45164,7 @@
45164
45164
  var _a, _b;
45165
45165
  if (isPromise(value) && (value = table.getCellValue(col, row)), !addNew && (oldCellGroup.row !== row || oldCellGroup.col !== col)) return null;
45166
45166
  if (!addNew && oldCellGroup.parent && table.reactCustomLayout) {
45167
- const reactGroup = oldCellGroup.getChildByName("custom-container");
45167
+ const reactGroup = oldCellGroup.getChildByName(CUSTOM_CONTAINER_NAME);
45168
45168
  if (reactGroup) {
45169
45169
  const {
45170
45170
  col: col,
@@ -45577,7 +45577,6 @@
45577
45577
  });
45578
45578
  function computeRowsHeight(table, rowStart, rowEnd, isClearRowRangeHeightsMap = !0, update) {
45579
45579
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
45580
- "undefined" != typeof window && window.performance.now();
45581
45580
  const oldRowHeights = [],
45582
45581
  newHeights = [];
45583
45582
  if (update) for (let row = rowStart; row <= rowEnd; row++) oldRowHeights[row] = table.getRowHeight(row);
@@ -45600,7 +45599,7 @@
45600
45599
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
45601
45600
  update ? newHeights[row] = Math.round(height) : table._setRowHeight(row, height);
45602
45601
  }
45603
- if (rowEnd < table.columnHeaderLevelCount || !isAllRowsAuto && !isDefaultRowHeightIsAuto) ;else if (table.internalProps.transpose || table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol || table.options.customComputeRowHeight || !checkFixedStyleAndNoWrap(table, rowStart)) {
45602
+ if (rowEnd < table.columnHeaderLevelCount || !isAllRowsAuto && !isDefaultRowHeightIsAuto) ;else if (table.internalProps.transpose || table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol || table.options.customComputeRowHeight || table.options.rowHeightConfig || !checkFixedStyleAndNoWrap(table, rowStart)) {
45604
45603
  if (table.internalProps.transpose || table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol) for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {
45605
45604
  let height;
45606
45605
  height = checkFixedStyleAndNoWrapForTranspose(table, row) ? computeRowHeight(row, 0, table.rowHeaderLevelCount, table) : computeRowHeight(row, 0, table.colCount - 1, table), update ? newHeights[row] = Math.round(height) : table._setRowHeight(row, height);
@@ -45684,6 +45683,10 @@
45684
45683
  if ("number" == typeof customRowHeight) return customRowHeight;
45685
45684
  if ("auto" !== customRowHeight) return table.getDefaultRowHeight(row);
45686
45685
  }
45686
+ if (table.internalProps.rowHeightConfig) {
45687
+ const rowHeightConfig = table.internalProps.rowHeightConfig.find(item => item.key === row);
45688
+ if (rowHeightConfig) return table.internalProps._heightResizedRowMap.has(row) || (table._setRowHeight(row, rowHeightConfig.height), table.internalProps._heightResizedRowMap.add(row)), rowHeightConfig.height;
45689
+ }
45687
45690
  if (table.isPivotChart() && row >= table.columnHeaderLevelCount && row < table.rowCount - table.bottomFrozenRowCount) {
45688
45691
  let ifNeedComputeRowHeight = table.internalProps.layoutMap.indicatorsAsCol,
45689
45692
  isHeatmap = !1;
@@ -45712,7 +45715,8 @@
45712
45715
  }
45713
45716
  }
45714
45717
  if (table.isPivotChart() && (table.isLeftFrozenColumn(col) && table.isBottomFrozenRow(row) || table.isRightFrozenColumn(col) && table.isBottomFrozenRow(row))) continue;
45715
- const textHeight = computeTextHeight(col, row, table.isHeader(col, row) ? null === (_a = table._getHeaderLayoutMap(col, row)) || void 0 === _a ? void 0 : _a.headerType : table.getBodyColumnType(col, row), table);
45718
+ const cellType = table.isHeader(col, row) ? null === (_a = table._getHeaderLayoutMap(col, row)) || void 0 === _a ? void 0 : _a.headerType : table.getBodyColumnType(col, row),
45719
+ textHeight = computeTextHeight(col, row, cellType, table);
45716
45720
  maxHeight = isValid$3(maxHeight) ? Math.max(textHeight, maxHeight) : textHeight;
45717
45721
  }
45718
45722
  if (isValid$3(maxHeight)) return maxHeight;
@@ -48388,7 +48392,7 @@
48388
48392
  strokeColor = rectAttribute.stroke,
48389
48393
  cornerRadius = rectAttribute.cornerRadius
48390
48394
  } = rect.attribute;
48391
- if (stroke && (Array.isArray(strokeArrayWidth) || 0 !== lineWidth) && (Array.isArray(stroke) || Array.isArray(strokeArrayColor) || Array.isArray(strokeArrayWidth))) {
48395
+ if (!(!stroke || !Array.isArray(strokeArrayWidth) && 0 === lineWidth || width <= 0 || height <= 0) && (Array.isArray(stroke) || Array.isArray(strokeArrayColor) || Array.isArray(strokeArrayWidth))) {
48392
48396
  const deltaWidth = 0,
48393
48397
  deltaHeight = 0;
48394
48398
  "border-rect" !== rect.name && "table-border-rect" !== rect.name && ("number" == typeof lineWidth && 1 & lineWidth || Array.isArray(strokeArrayWidth) && strokeArrayWidth.some(width => 1 & width)) && (x = Math.floor(x) + .5, y = Math.floor(y) + .5), 0 === cornerRadius || isArray$7(cornerRadius) && cornerRadius.every(num => 0 === num) ? renderStroke(rect, context, x, y, rectAttribute, stroke, strokeArrayWidth || lineWidth, strokeArrayColor || strokeColor, "table-border-rect" !== rect.name ? Math.ceil(width + deltaWidth) : width + deltaWidth, "table-border-rect" !== rect.name ? Math.ceil(height + deltaHeight) : height + deltaHeight) : (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius, !0, new Array(4).fill(0).map((_, i) => (x1, y1, x2, y2) => {
@@ -53301,9 +53305,9 @@
53301
53305
 
53302
53306
  function adjustMoveHeaderTarget(source, target, table) {
53303
53307
  const sourceCellRange = table.getCellRange(source.col, source.row);
53304
- if (table.isColumnHeader(source.col, source.row)) {
53308
+ if (table.isColumnHeader(source.col, source.row) || "column" === table.stateManager.columnMove.movingColumnOrRow && 0 === source.row) {
53305
53309
  const targetCellRange = table.getCellRange(target.col, sourceCellRange.start.row);
53306
- target.row >= table.columnHeaderLevelCount && (target.row = table.columnHeaderLevelCount - 1), target.col >= source.col ? target.col = targetCellRange.end.col : target.col = targetCellRange.start.col;
53310
+ target.row >= table.columnHeaderLevelCount && (target.row = Math.max(table.columnHeaderLevelCount - 1, 0)), target.col >= source.col ? target.col = targetCellRange.end.col : target.col = targetCellRange.start.col;
53307
53311
  } else if (table.isRowHeader(source.col, source.row)) {
53308
53312
  const layoutMap = table.internalProps.layoutMap,
53309
53313
  targetCellRange = table.getCellRange(sourceCellRange.start.col, target.row);
@@ -53318,6 +53322,52 @@
53318
53322
  }
53319
53323
  return target;
53320
53324
  }
53325
+ function adjustWidthResizedColMap(moveContext, table) {
53326
+ if (table.internalProps._widthResizedColMap.size > 0) {
53327
+ const resizedColIndexs = Array.from(table.internalProps._widthResizedColMap.keys());
53328
+ table.internalProps._widthResizedColMap.clear();
53329
+ for (let i = 0; i < resizedColIndexs.length; i++) {
53330
+ const colIndex = resizedColIndexs[i];
53331
+ let newColIndex;
53332
+ const {
53333
+ sourceIndex: sourceIndex,
53334
+ targetIndex: targetIndex,
53335
+ sourceSize: sourceSize
53336
+ } = moveContext;
53337
+ newColIndex = colIndex >= sourceIndex && colIndex < sourceIndex + sourceSize ? targetIndex + (colIndex - sourceIndex) : sourceIndex < targetIndex ? colIndex >= sourceIndex + sourceSize && colIndex < targetIndex || colIndex >= targetIndex ? colIndex - sourceSize : colIndex : colIndex >= targetIndex && colIndex < sourceIndex ? colIndex + sourceSize : colIndex, table.internalProps._widthResizedColMap.add(newColIndex);
53338
+ }
53339
+ }
53340
+ }
53341
+ function adjustHeightResizedRowMap(moveContext, table) {
53342
+ if (table.internalProps._heightResizedRowMap.size > 0) {
53343
+ const resizedRowIndexs = Array.from(table.internalProps._heightResizedRowMap.keys());
53344
+ table.internalProps._heightResizedRowMap.clear();
53345
+ for (let i = 0; i < resizedRowIndexs.length; i++) {
53346
+ const rowIndex = resizedRowIndexs[i];
53347
+ let newRowIndex;
53348
+ const {
53349
+ sourceIndex: sourceIndex,
53350
+ targetIndex: targetIndex,
53351
+ sourceSize: sourceSize
53352
+ } = moveContext;
53353
+ newRowIndex = rowIndex >= sourceIndex && rowIndex < sourceIndex + sourceSize ? targetIndex + (rowIndex - sourceIndex) : sourceIndex < targetIndex ? rowIndex >= sourceIndex + sourceSize && rowIndex < targetIndex || rowIndex >= targetIndex ? rowIndex - sourceSize : rowIndex : rowIndex >= targetIndex && rowIndex < sourceIndex ? rowIndex + sourceSize : rowIndex, table.internalProps._heightResizedRowMap.add(newRowIndex);
53354
+ }
53355
+ }
53356
+ }
53357
+ function adjustHeightResizedRowMapWithAddRecordIndex(table, recordIndex, records) {
53358
+ const resizedRowIndexs = Array.from(table.internalProps._heightResizedRowMap.keys()),
53359
+ rowIndex = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
53360
+ for (let i = 0; i < resizedRowIndexs.length; i++) resizedRowIndexs[i] >= rowIndex && (table.internalProps._heightResizedRowMap.delete(resizedRowIndexs[i]), table.internalProps._heightResizedRowMap.add(resizedRowIndexs[i] + records.length));
53361
+ }
53362
+ function adjustHeightResizedRowMapWithDeleteRecordIndex(table, recordIndexs) {
53363
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
53364
+ recordIndexs.sort((a, b) => b - a);
53365
+ for (let i = 0; i < recordIndexs.length; i++) {
53366
+ const rowIndex = recordIndexs[i] + headerCount,
53367
+ resizedRowIndexs = Array.from(table.internalProps._heightResizedRowMap.keys());
53368
+ for (let j = 0; j < resizedRowIndexs.length; j++) resizedRowIndexs[j] === rowIndex ? table.internalProps._heightResizedRowMap.delete(resizedRowIndexs[j]) : resizedRowIndexs[j] > rowIndex && (table.internalProps._heightResizedRowMap.delete(resizedRowIndexs[j]), table.internalProps._heightResizedRowMap.add(resizedRowIndexs[j] - 1));
53369
+ }
53370
+ }
53321
53371
 
53322
53372
  function startMoveCol(col, row, x, y, state, event, dragColumnOrRow) {
53323
53373
  var _a;
@@ -53379,7 +53429,7 @@
53379
53429
  let lineX, backX, lineY, backY;
53380
53430
  state.updateCursor("grabbing");
53381
53431
  const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
53382
- "columnHeader" === cellLocation ? (backX = state.columnMove.x, lineX = state.table.isLeftFrozenColumn(col) ? state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1) : state.table.isRightFrozenColumn(col) ? state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1) : (state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) - state.table.stateManager.scroll.horizontalBarPos) : ("rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) || "row" === state.columnMove.movingColumnOrRow) && (backY = state.columnMove.y, lineY = state.table.isFrozenRow(row) ? state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1) : state.table.isBottomFrozenRow(row) ? state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1) : (state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) - state.table.stateManager.scroll.verticalBarPos), state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY), state.table.fireListeners(TABLE_EVENT_TYPE.CHANGING_HEADER_POSITION, {
53432
+ "columnHeader" === cellLocation || "column" === state.columnMove.movingColumnOrRow && 0 === state.columnMove.rowSource ? (backX = state.columnMove.x, lineX = state.table.isLeftFrozenColumn(col) ? state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1) : state.table.isRightFrozenColumn(col) ? state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1) : (state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) - state.table.stateManager.scroll.horizontalBarPos) : ("rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) || "row" === state.columnMove.movingColumnOrRow) && (backY = state.columnMove.y, lineY = state.table.isFrozenRow(row) ? state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1) : state.table.isBottomFrozenRow(row) ? state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1) : (state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) - state.table.stateManager.scroll.verticalBarPos), state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY), state.table.fireListeners(TABLE_EVENT_TYPE.CHANGING_HEADER_POSITION, {
53383
53433
  col: col,
53384
53434
  row: row,
53385
53435
  x: x,
@@ -54893,7 +54943,7 @@
54893
54943
  });
54894
54944
  (optimizedDeltaX || optimizedDeltaY) && state.interactionState !== InteractionState.scrolling && state.updateInteractionState(InteractionState.scrolling);
54895
54945
  const autoHide = "scrolling" === (null === (_b = null === (_a = state.table.options.theme) || void 0 === _a ? void 0 : _a.scrollStyle) || void 0 === _b ? void 0 : _b.visible);
54896
- optimizedDeltaX && (state.setScrollLeft(state.scroll.horizontalBarPos + optimizedDeltaX, event), state.showHorizontalScrollBar(autoHide)), optimizedDeltaY && (state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY, event), state.showVerticalScrollBar(autoHide)), isWheelEvent && state.resetInteractionState(state.interactionStateBeforeScroll), (null === (_c = event.nativeEvent) || void 0 === _c ? void 0 : _c.cancelable) && ("none" === state.table.internalProps.overscrollBehavior || Math.abs(deltaY) >= Math.abs(deltaX) && 0 !== deltaY && isVerticalScrollable(deltaY, state) || Math.abs(deltaY) <= Math.abs(deltaX) && 0 !== deltaX && isHorizontalScrollable(deltaX, state)) && event.nativeEvent.preventDefault();
54946
+ optimizedDeltaX && (state.setScrollLeft(state.scroll.horizontalBarPos + optimizedDeltaX, event), state.showHorizontalScrollBar(autoHide)), optimizedDeltaY && (state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY, event), state.showVerticalScrollBar(autoHide)), isWheelEvent && state.resetInteractionState(state.interactionStateBeforeScroll), (null === (_c = event.nativeEvent) || void 0 === _c ? void 0 : _c.cancelable) && ("none" === state.table.internalProps.overscrollBehavior && (deltaY && isVerticalExistScrollBar(state) || deltaX && isHorizontalExistScrollBar(state)) || Math.abs(deltaY) >= Math.abs(deltaX) && 0 !== deltaY && isVerticalScrollable(deltaY, state) || Math.abs(deltaY) <= Math.abs(deltaX) && 0 !== deltaX && isHorizontalScrollable(deltaX, state)) && event.nativeEvent.preventDefault();
54897
54947
  }
54898
54948
  function optimizeScrollXY(x, y, ratio) {
54899
54949
  var _a, _b;
@@ -54908,6 +54958,12 @@
54908
54958
  function isHorizontalScrollable(deltaX, state) {
54909
54959
  return 0 != state.table.getAllColsWidth() - state.table.scenegraph.width && !isScrollToLeft(deltaX, state) && !isScrollToRight(deltaX, state);
54910
54960
  }
54961
+ function isVerticalExistScrollBar(state) {
54962
+ return !(state.table.getAllRowsHeight() - state.table.scenegraph.height <= 0);
54963
+ }
54964
+ function isHorizontalExistScrollBar(state) {
54965
+ return !(state.table.getAllColsWidth() - state.table.scenegraph.width <= 0);
54966
+ }
54911
54967
  function isScrollToTop(deltaY, state) {
54912
54968
  return 0 !== state.table.getAllRowsHeight() - state.table.scenegraph.height && deltaY <= 0 && state.scroll.verticalBarPos < 1;
54913
54969
  }
@@ -55850,7 +55906,7 @@
55850
55906
  handleWhell({
55851
55907
  deltaX: deltaX,
55852
55908
  deltaY: deltaY
55853
- }, stateManager), e.cancelable && ("none" === table.internalProps.overscrollBehavior || Math.abs(deltaY) >= Math.abs(deltaX) && 0 !== deltaY && isVerticalScrollable(deltaY, stateManager) || Math.abs(deltaY) <= Math.abs(deltaX) && 0 !== deltaX && isHorizontalScrollable(deltaX, stateManager)) && e.preventDefault();
55909
+ }, stateManager), e.cancelable && ("none" === table.internalProps.overscrollBehavior && (deltaY && isVerticalExistScrollBar(stateManager) || deltaX && isHorizontalExistScrollBar(stateManager)) || Math.abs(deltaY) >= Math.abs(deltaX) && 0 !== deltaY && isVerticalScrollable(deltaY, stateManager) || Math.abs(deltaY) <= Math.abs(deltaX) && 0 !== deltaX && isHorizontalScrollable(deltaX, stateManager)) && e.preventDefault();
55854
55910
  }
55855
55911
  };
55856
55912
  vglobal.addEventListener("touchmove", globalTouchMoveCallback, {
@@ -58702,7 +58758,7 @@
58702
58758
  targetRange: targetRange,
58703
58759
  theme: theme
58704
58760
  } = axisRange;
58705
- isNumber$4(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min, range.min > 0 && (axisOption.zero = !1)), isNumber$4(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max, range.max < 0 && (axisOption.zero = !1));
58761
+ isNumber$4(null == axisOption ? void 0 : axisOption.max) ? (range.max = axisOption.max, range.max < 0 && (axisOption.zero = !1)) : "boxPlot" === chartType && (range.max += (range.max - range.min) / 20), isNumber$4(null == axisOption ? void 0 : axisOption.min) ? (range.min = axisOption.min, range.min > 0 && (axisOption.zero = !1)) : "boxPlot" === chartType && (range.min -= (range.max - range.min) / 20);
58706
58762
  let domain = [];
58707
58763
  if ("heatmap" === chartType) {
58708
58764
  const colDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.rowCount - layout.bottomFrozenRowCount - 1, "xField"),
@@ -58784,7 +58840,7 @@
58784
58840
  targetRange: targetRange,
58785
58841
  theme: theme
58786
58842
  } = axisRange;
58787
- isNumber$4(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min, range.min > 0 && (axisOption.zero = !1)), isNumber$4(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max, range.max < 0 && (axisOption.zero = !1));
58843
+ isNumber$4(null == axisOption ? void 0 : axisOption.max) ? (range.max = axisOption.max, range.max < 0 && (axisOption.zero = !1)) : "boxPlot" === chartType && (range.max += (range.max - range.min) / 20), isNumber$4(null == axisOption ? void 0 : axisOption.min) ? (range.min = axisOption.min, range.min > 0 && (axisOption.zero = !1)) : "boxPlot" === chartType && (range.min -= (range.max - range.min) / 20);
58788
58844
  let domain = [];
58789
58845
  if ("heatmap" === chartType) {
58790
58846
  const rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row, "yField"),
@@ -59386,7 +59442,7 @@
59386
59442
  }
59387
59443
  constructor(container, options = {}) {
59388
59444
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
59389
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
59445
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
59390
59446
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59391
59447
  options: options,
59392
59448
  container: container
@@ -59966,7 +60022,7 @@
59966
60022
  return this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
59967
60023
  }
59968
60024
  isAutoRowHeight(row) {
59969
- return "autoHeight" === this.heightMode || !!this.options.customComputeRowHeight || (row >= 0 && row < this.columnHeaderLevelCount ? "auto" === this.getDefaultRowHeight(row) : "auto" === this.internalProps.defaultRowHeight);
60025
+ return "autoHeight" === this.heightMode || !!this.options.customComputeRowHeight || !!this.internalProps.rowHeightConfig || (row >= 0 && row < this.columnHeaderLevelCount ? "auto" === this.getDefaultRowHeight(row) : "auto" === this.internalProps.defaultRowHeight);
59970
60026
  }
59971
60027
  getColWidth(col) {
59972
60028
  var _a;
@@ -63580,7 +63636,7 @@
63580
63636
  if (this.transpose && (this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row) || "row" === dragColumnOrRow) && (this.getBody(source.col + this.leftRowSeriesNumberColumnCount, source.row).isChildNode && this.getBody(target.col + this.leftRowSeriesNumberColumnCount, target.row).isChildNode ? (source.col = source.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1, target.col = target.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1) : (source.col = source.col + this.leftRowSeriesNumberColumnCount, target.col = target.col + this.leftRowSeriesNumberColumnCount)), source.col < 0 || source.row < 0 || target.col < 0 || target.row < 0) return !1;
63581
63637
  if ("disabled" === this._table.internalProps.frozenColDragHeaderMode && this._table.isFrozenColumn(target.col)) return !1;
63582
63638
  const sourceCellRange = this.getCellRange(source.col, source.row);
63583
- if (this.isColumnHeader(source.col, source.row)) {
63639
+ if (this.isColumnHeader(source.col, source.row) || "column" === this._table.stateManager.columnMove.movingColumnOrRow && 0 === source.row) {
63584
63640
  return this.getParentCellId(source.col, sourceCellRange.start.row) === this.getParentCellId(target.col, sourceCellRange.start.row);
63585
63641
  }
63586
63642
  if (this.isRowHeader(source.col, source.row)) {
@@ -63592,7 +63648,7 @@
63592
63648
  var _a, _b, _c, _d, _e, _f, _g;
63593
63649
  if ((!(null === (_a = this._table.options.dragOrder) || void 0 === _a ? void 0 : _a.validateDragOrderOnEnd) || (null === (_b = this._table.options.dragOrder) || void 0 === _b ? void 0 : _b.validateDragOrderOnEnd(source, target))) && this.canMoveHeaderPosition(source, target)) {
63594
63650
  let sourceCellRange = this.getCellRange(source.col, source.row);
63595
- if (this.isColumnHeader(source.col, source.row)) {
63651
+ if (this.isColumnHeader(source.col, source.row) || "column" === this._table.stateManager.columnMove.movingColumnOrRow && 0 === source.row) {
63596
63652
  const sourceSize = sourceCellRange.end.col - sourceCellRange.start.col + 1;
63597
63653
  let targetIndex;
63598
63654
  const targetCellRange = this.getCellRange(target.col, sourceCellRange.start.row);
@@ -63604,7 +63660,7 @@
63604
63660
  if (null === (_c = this._table.options.dragOrder) || void 0 === _c ? void 0 : _c.maintainArrayDataOrder) for (let j = 0; j < (null === (_d = this._table.dataSource.dataSourceObj) || void 0 === _d ? void 0 : _d.records.length); j++) {
63605
63661
  const rowRecords = null === (_e = this._table.dataSource.dataSourceObj) || void 0 === _e ? void 0 : _e.records[j];
63606
63662
  if (Array.isArray(rowRecords)) {
63607
- rowRecords.length - 1 < targetIndex && rowRecords.push(...Array(targetIndex - rowRecords.length + 1).fill(void 0));
63663
+ rowRecords.length - 1 < Math.max(targetIndex, source.col) && rowRecords.push(...Array(Math.max(targetIndex, source.col) - rowRecords.length + 1).fill(void 0));
63608
63664
  const sourceData = rowRecords.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
63609
63665
  sourceData.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(rowRecords, sourceData);
63610
63666
  }
@@ -64574,7 +64630,7 @@
64574
64630
  const internalProps = this.internalProps;
64575
64631
  if (internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
64576
64632
  addRecordRule: options.addRecordRule
64577
- }, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_d = null !== (_c = options.enableTreeNodeMerge) && void 0 !== _c ? _c : isValid$3(this.internalProps.groupBy)) && void 0 !== _d && _d, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_e = options.showHeader) || void 0 === _e || _e, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, "node" !== Env.mode && (this.editorManager = new EditManager(this)), this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
64633
+ }, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_d = null !== (_c = options.enableTreeNodeMerge) && void 0 !== _c ? _c : isValid$3(this.internalProps.groupBy)) && void 0 !== _d && _d, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_e = options.showHeader) || void 0 === _e || _e, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.rowHeightConfig = options.rowHeightConfig, this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, "node" !== Env.mode && (this.editorManager = new EditManager(this)), this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
64578
64634
  sortState: internalProps.sortState
64579
64635
  }) : this.setRecords([]), options.title) {
64580
64636
  const Title = Factory.getComponent("title");
@@ -64853,7 +64909,7 @@
64853
64909
  const internalProps = this.internalProps;
64854
64910
  if (super.updateOption(options, updateConfig), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
64855
64911
  addRecordRule: options.addRecordRule
64856
- }, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$3(this.internalProps.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
64912
+ }, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$3(this.internalProps.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.rowHeightConfig = options.rowHeightConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
64857
64913
  const releaseObj = internalProps.releaseList[i];
64858
64914
  releaseObj instanceof DataSource$1 ? releaseObj.updateColumns(this.internalProps.columns) : (null === (_g = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _g || _g.call(releaseObj), internalProps.releaseList.splice(i, 1));
64859
64915
  }
@@ -64909,7 +64965,7 @@
64909
64965
  const sourceCellRange = this.getCellRange(source.col, source.row),
64910
64966
  targetCellRange = this.getCellRange(target.col, target.row),
64911
64967
  moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
64912
- return moveContext ? ("column" === moveContext.moveType ? (this.colWidthsMap.exchangeOrder(sourceCellRange.start.col, sourceCellRange.end.col - sourceCellRange.start.col + 1, targetCellRange.start.col, targetCellRange.end.col - targetCellRange.start.col + 1, moveContext.targetIndex), this.transpose || (this.colWidthsLimit = {}, this.setMinMaxLimitWidth())) : moveContext.targetIndex > moveContext.sourceIndex ? this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex + moveContext.sourceSize - moveContext.targetSize, moveContext.targetSize, moveContext.targetIndex) : this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex, moveContext.targetSize, moveContext.targetIndex), moveContext) : null;
64968
+ return moveContext ? ("column" === moveContext.moveType ? (this.colWidthsMap.exchangeOrder(sourceCellRange.start.col, sourceCellRange.end.col - sourceCellRange.start.col + 1, targetCellRange.start.col, targetCellRange.end.col - targetCellRange.start.col + 1, moveContext.targetIndex), adjustWidthResizedColMap(moveContext, this), this.transpose || (this.colWidthsLimit = {}, this.setMinMaxLimitWidth())) : (moveContext.targetIndex > moveContext.sourceIndex ? this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex + moveContext.sourceSize - moveContext.targetSize, moveContext.targetSize, moveContext.targetIndex) : this.rowHeightsMap.exchangeOrder(moveContext.sourceIndex, moveContext.sourceSize, moveContext.targetIndex, moveContext.targetSize, moveContext.targetIndex), adjustHeightResizedRowMap(moveContext, this)), moveContext) : null;
64913
64969
  }
64914
64970
  changeRecordOrder(sourceIndex, targetIndex) {
64915
64971
  this.transpose ? (sourceIndex = this.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = this.getRecordShowIndexByCell(targetIndex, 0)) : (sourceIndex = this.getRecordShowIndexByCell(0, sourceIndex), targetIndex = this.getRecordShowIndexByCell(0, targetIndex)), this.dataSource.changeOrder(sourceIndex, targetIndex);
@@ -65073,8 +65129,10 @@
65073
65129
  };
65074
65130
  })), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell()), sortState.length && this.stateManager.updateSortState(sortState);
65075
65131
  }
65076
- updateFilterRules(filterRules) {
65077
- this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(), this.resize();
65132
+ updateFilterRules(filterRules, options = {
65133
+ clearRowHeightCache: !0
65134
+ }) {
65135
+ this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), this.resize();
65078
65136
  }
65079
65137
  getFilteredRecords() {
65080
65138
  return this.dataSource.records;
@@ -65219,7 +65277,7 @@
65219
65277
  addRecord(record, recordIndex) {
65220
65278
  var _a;
65221
65279
  const success = listTableAddRecord(record, recordIndex, this);
65222
- null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65280
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65223
65281
  records: [record],
65224
65282
  recordIndex: recordIndex,
65225
65283
  recordCount: 1
@@ -65228,7 +65286,7 @@
65228
65286
  addRecords(records, recordIndex) {
65229
65287
  var _a;
65230
65288
  const success = listTableAddRecords(records, recordIndex, this);
65231
- null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65289
+ "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65232
65290
  records: records,
65233
65291
  recordIndex: recordIndex,
65234
65292
  recordCount: records.length
@@ -65236,7 +65294,7 @@
65236
65294
  }
65237
65295
  deleteRecords(recordIndexs) {
65238
65296
  var _a;
65239
- listTableDeleteRecords(recordIndexs, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65297
+ listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65240
65298
  const rowIndexs = [];
65241
65299
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65242
65300
  this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
@@ -75330,6 +75388,9 @@
75330
75388
  source_index === target_index) {
75331
75389
  return;
75332
75390
  }
75391
+ if (target_index < 0 || target_sub_task_index < 0) {
75392
+ return;
75393
+ }
75333
75394
  if (this._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline) {
75334
75395
  if (isValid$3(source_sub_task_index) &&
75335
75396
  isValid$3(target_sub_task_index) &&
@@ -75337,7 +75398,7 @@
75337
75398
  isValid$3(target_index)) {
75338
75399
  const sub_task_record = this.records[source_index].children[source_sub_task_index];
75339
75400
  this.records[source_index].children.splice(source_sub_task_index, 1);
75340
- if (!this.records[target_index].children) {
75401
+ if (!this.records[target_index]?.children) {
75341
75402
  this.records[target_index].children = [];
75342
75403
  }
75343
75404
  this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);
@@ -75356,7 +75417,7 @@
75356
75417
  const targetIsProject = this.records[target_index].type === TaskType.PROJECT;
75357
75418
  const sub_task_record = this.records[source_index].children[source_sub_task_index];
75358
75419
  this.records[source_index].children.splice(source_sub_task_index, 1);
75359
- if (!this.records[target_index].children) {
75420
+ if (!this.records[target_index]?.children) {
75360
75421
  this.records[target_index].children = [];
75361
75422
  }
75362
75423
  this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);
@@ -75375,7 +75436,7 @@
75375
75436
  isValid$3(target_index)) {
75376
75437
  const sub_task_record = this.records[source_index].children[source_sub_task_index];
75377
75438
  this.records[source_index].children.splice(source_sub_task_index, 1);
75378
- if (!this.records[target_index].children) {
75439
+ if (!this.records[target_index]?.children) {
75379
75440
  this.records[target_index].children = [];
75380
75441
  }
75381
75442
  this.records[target_index].children.splice(target_sub_task_index, 0, sub_task_record);
@@ -77300,7 +77361,7 @@
77300
77361
  PluginManager: PluginManager
77301
77362
  });
77302
77363
 
77303
- const version = "1.22.2";
77364
+ const version = "1.22.3";
77304
77365
 
77305
77366
  exports.Gantt = Gantt;
77306
77367
  exports.TYPES = index$4;