vxe-gantt 4.0.3 → 4.0.5

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.
Files changed (45) hide show
  1. package/es/gantt/src/gantt-body.js +46 -6
  2. package/es/gantt/src/gantt-header.js +22 -6
  3. package/es/gantt/src/gantt-view.js +232 -89
  4. package/es/gantt/src/gantt.js +59 -2
  5. package/es/gantt/src/util.js +6 -0
  6. package/es/gantt/style.css +35 -3
  7. package/es/gantt/style.min.css +1 -1
  8. package/es/style.css +1 -1
  9. package/es/style.min.css +1 -1
  10. package/es/ui/index.js +6 -1
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-gantt/style.css +35 -3
  13. package/es/vxe-gantt/style.min.css +1 -1
  14. package/lib/gantt/src/gantt-body.js +51 -6
  15. package/lib/gantt/src/gantt-body.min.js +1 -1
  16. package/lib/gantt/src/gantt-header.js +34 -6
  17. package/lib/gantt/src/gantt-header.min.js +1 -1
  18. package/lib/gantt/src/gantt-view.js +255 -99
  19. package/lib/gantt/src/gantt-view.min.js +1 -1
  20. package/lib/gantt/src/gantt.js +74 -1
  21. package/lib/gantt/src/gantt.min.js +1 -1
  22. package/lib/gantt/src/util.js +7 -0
  23. package/lib/gantt/src/util.min.js +1 -1
  24. package/lib/gantt/style/style.css +35 -3
  25. package/lib/gantt/style/style.min.css +1 -1
  26. package/lib/index.umd.js +476 -121
  27. package/lib/index.umd.min.js +1 -1
  28. package/lib/style.css +1 -1
  29. package/lib/style.min.css +1 -1
  30. package/lib/ui/index.js +6 -1
  31. package/lib/ui/index.min.js +1 -1
  32. package/lib/ui/src/log.js +1 -1
  33. package/lib/ui/src/log.min.js +1 -1
  34. package/lib/vxe-gantt/style/style.css +35 -3
  35. package/lib/vxe-gantt/style/style.min.css +1 -1
  36. package/package.json +3 -3
  37. package/packages/gantt/src/gantt-body.ts +50 -7
  38. package/packages/gantt/src/gantt-header.ts +23 -7
  39. package/packages/gantt/src/gantt-view.ts +243 -93
  40. package/packages/gantt/src/gantt.ts +68 -1
  41. package/packages/gantt/src/util.ts +7 -0
  42. package/packages/ui/index.ts +5 -0
  43. package/styles/components/gantt-module/gantt-chart.scss +10 -0
  44. package/styles/components/gantt.scss +37 -3
  45. package/styles/theme/base.scss +1 -1
package/lib/index.umd.js CHANGED
@@ -44,6 +44,45 @@ module.exports = function (argument, usingIterator) {
44
44
  };
45
45
 
46
46
 
47
+ /***/ }),
48
+
49
+ /***/ 116:
50
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
51
+
52
+
53
+ var $ = __webpack_require__(6518);
54
+ var call = __webpack_require__(9565);
55
+ var iterate = __webpack_require__(2652);
56
+ var aCallable = __webpack_require__(9306);
57
+ var anObject = __webpack_require__(8551);
58
+ var getIteratorDirect = __webpack_require__(1767);
59
+ var iteratorClose = __webpack_require__(9539);
60
+ var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
61
+
62
+ var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('find', TypeError);
63
+
64
+ // `Iterator.prototype.find` method
65
+ // https://tc39.es/ecma262/#sec-iterator.prototype.find
66
+ $({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {
67
+ find: function find(predicate) {
68
+ anObject(this);
69
+ try {
70
+ aCallable(predicate);
71
+ } catch (error) {
72
+ iteratorClose(this, 'throw', error);
73
+ }
74
+
75
+ if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate);
76
+
77
+ var record = getIteratorDirect(this);
78
+ var counter = 0;
79
+ return iterate(record, function (value, stop) {
80
+ if (predicate(value, counter++)) return stop(value);
81
+ }, { IS_RECORD: true, INTERRUPTED: true }).result;
82
+ }
83
+ });
84
+
85
+
47
86
  /***/ }),
48
87
 
49
88
  /***/ 283:
@@ -2741,7 +2780,7 @@ var core_ = __webpack_require__(4345);
2741
2780
  const {
2742
2781
  log
2743
2782
  } = core_.VxeUI;
2744
- const version = `gantt v${"4.0.3"}`;
2783
+ const version = `gantt v${"4.0.5"}`;
2745
2784
  const warnLog = log.create('warn', version);
2746
2785
  const errLog = log.create('error', version);
2747
2786
  ;// ./packages/ui/index.ts
@@ -2752,7 +2791,7 @@ const {
2752
2791
  setIcon,
2753
2792
  checkVersion
2754
2793
  } = core_.VxeUI;
2755
- core_.VxeUI.ganttVersion = "4.0.3";
2794
+ core_.VxeUI.ganttVersion = "4.0.5";
2756
2795
  setConfig({
2757
2796
  gantt: {
2758
2797
  // size: null,
@@ -2791,6 +2830,11 @@ setConfig({
2791
2830
  // beforeSave: null,
2792
2831
  // afterSave: null
2793
2832
  },
2833
+ taskViewScaleConfs: {
2834
+ week: {
2835
+ startDay: 1
2836
+ }
2837
+ },
2794
2838
  taskSplitConfig: {
2795
2839
  enabled: true,
2796
2840
  resize: true,
@@ -3246,6 +3290,8 @@ const gridEmits = [...tableEmits, 'page-change', 'form-submit', 'form-submit-inv
3246
3290
  ;// ./packages/gantt/src/emits.ts
3247
3291
 
3248
3292
  const ganttEmits = [...gridEmits, 'task-cell-click', 'task-cell-dblclick', 'task-bar-click', 'task-bar-dblclick'];
3293
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
3294
+ var es_iterator_find = __webpack_require__(116);
3249
3295
  ;// ./packages/gantt/src/util.ts
3250
3296
  function getRefElem(refEl) {
3251
3297
  if (refEl) {
@@ -3256,6 +3302,12 @@ function getRefElem(refEl) {
3256
3302
  }
3257
3303
  return null;
3258
3304
  }
3305
+ function getCalcHeight(height) {
3306
+ if (height === 'unset') {
3307
+ return 0;
3308
+ }
3309
+ return height || 0;
3310
+ }
3259
3311
  function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
3260
3312
  return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
3261
3313
  }
@@ -3264,6 +3316,10 @@ function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
3264
3316
 
3265
3317
 
3266
3318
 
3319
+
3320
+ const {
3321
+ getI18n
3322
+ } = core_.VxeUI;
3267
3323
  /* harmony default export */ var gantt_header = (defineVxeComponent({
3268
3324
  name: 'VxeGanttViewHeader',
3269
3325
  setup() {
@@ -3302,16 +3358,40 @@ function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
3302
3358
  width: `${viewCellWidth}px`
3303
3359
  }
3304
3360
  });
3305
- })), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('thead', {}, headerGroups.map((cols, rIndex) => {
3361
+ })), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('thead', {}, headerGroups.map(({
3362
+ scaleItem,
3363
+ columns
3364
+ }, $rowIndex) => {
3365
+ const {
3366
+ type,
3367
+ titleMethod
3368
+ } = scaleItem;
3306
3369
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('tr', {
3307
- key: rIndex
3308
- }, cols.map((column, cIndex) => {
3370
+ key: $rowIndex
3371
+ }, columns.map((column, cIndex) => {
3372
+ const dateObj = column.params;
3373
+ let label = `${column.title}`;
3374
+ if ($rowIndex < headerGroups.length - 1) {
3375
+ if (scaleItem.type === 'day') {
3376
+ label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
3377
+ } else {
3378
+ label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
3379
+ }
3380
+ }
3381
+ if (titleMethod) {
3382
+ label = `${titleMethod({
3383
+ scaleObj: scaleItem,
3384
+ title: label,
3385
+ dateObj: dateObj,
3386
+ $rowIndex
3387
+ })}`;
3388
+ }
3309
3389
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('th', {
3310
3390
  key: cIndex,
3311
3391
  class: 'vxe-gantt-view--header-column',
3312
- colspan: column.children ? column.children.length : null,
3313
- title: `${column.field}`
3314
- }, column.title);
3392
+ colspan: column.childCount || null,
3393
+ title: label
3394
+ }, label);
3315
3395
  }));
3316
3396
  }))])])]);
3317
3397
  };
@@ -3538,27 +3618,65 @@ const {
3538
3618
  const refBodyTable = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
3539
3619
  const refBodyXSpace = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
3540
3620
  const refBodyYSpace = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
3541
- const renderColumn = ($xeTable, row, rowid, $rowIndex, column, $columnIndex) => {
3621
+ const renderColumn = ($xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex) => {
3542
3622
  const tableReactData = $xeTable.reactData;
3543
3623
  const {
3544
3624
  resizeHeightFlag
3545
3625
  } = tableReactData;
3546
3626
  const tableInternalData = $xeTable.internalData;
3547
3627
  const {
3548
- fullAllDataRowIdData
3628
+ fullAllDataRowIdData,
3629
+ visibleColumn
3549
3630
  } = tableInternalData;
3550
3631
  const {
3551
3632
  computeCellOpts,
3552
3633
  computeRowOpts,
3553
- computeDefaultRowHeight
3634
+ computeDefaultRowHeight,
3635
+ computeResizableOpts
3554
3636
  } = $xeTable.getComputeMaps();
3555
3637
  const cellOpts = computeCellOpts.value;
3556
3638
  const rowOpts = computeRowOpts.value;
3557
3639
  const defaultRowHeight = computeDefaultRowHeight.value;
3640
+ const resizableOpts = computeResizableOpts.value;
3641
+ const {
3642
+ isAllRowDrag
3643
+ } = resizableOpts;
3558
3644
  const rowRest = fullAllDataRowIdData[rowid] || {};
3559
3645
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
3560
3646
  const isRsHeight = resizeHeight > 0;
3561
3647
  const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
3648
+ const tdVNs = [];
3649
+ if (isAllRowDrag && rowOpts.resizable) {
3650
+ const cellParams = {
3651
+ $table: $xeTable,
3652
+ $grid: null,
3653
+ $gantt: $xeGantt,
3654
+ seq: -1,
3655
+ rowid,
3656
+ row,
3657
+ rowIndex,
3658
+ $rowIndex,
3659
+ _rowIndex,
3660
+ column: visibleColumn[0],
3661
+ columnIndex: 0,
3662
+ $columnIndex: 0,
3663
+ _columnIndex: 0,
3664
+ fixed: '',
3665
+ type: '',
3666
+ isHidden: false,
3667
+ isEdit: false,
3668
+ level: -1,
3669
+ // 已废弃属性
3670
+ visibleData: [],
3671
+ data: [],
3672
+ items: []
3673
+ };
3674
+ tdVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
3675
+ class: 'vxe-gantt-view-cell--row-resizable',
3676
+ onMousedown: evnt => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
3677
+ onDblclick: evnt => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
3678
+ }));
3679
+ }
3562
3680
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('td', {
3563
3681
  key: $columnIndex,
3564
3682
  class: ['vxe-gantt-view--body-column', {
@@ -3579,7 +3697,7 @@ const {
3579
3697
  column
3580
3698
  });
3581
3699
  }
3582
- });
3700
+ }, tdVNs);
3583
3701
  };
3584
3702
  const renderRows = ($xeTable, tableData) => {
3585
3703
  const tableProps = $xeTable.props;
@@ -3593,7 +3711,8 @@ const {
3593
3711
  const {
3594
3712
  treeExpandedFlag,
3595
3713
  selectRadioRow,
3596
- pendingRowFlag
3714
+ pendingRowFlag,
3715
+ isRowGroupStatus
3597
3716
  } = tableReactData;
3598
3717
  const tableInternalData = $xeTable.internalData;
3599
3718
  const {
@@ -3647,6 +3766,12 @@ const {
3647
3766
  $xeTable.clearHoverRow();
3648
3767
  };
3649
3768
  }
3769
+ // 拖拽行事件
3770
+ if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
3771
+ trOns.onDragstart = $xeTable.handleRowDragDragstartEvent;
3772
+ trOns.onDragend = $xeTable.handleRowDragDragendEvent;
3773
+ trOns.onDragover = $xeTable.handleRowDragDragoverEvent;
3774
+ }
3650
3775
  trVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('tr', {
3651
3776
  key: treeConfig ? rowid : $rowIndex,
3652
3777
  class: ['vxe-gantt-view--body-row', {
@@ -3658,7 +3783,7 @@ const {
3658
3783
  }],
3659
3784
  rowid,
3660
3785
  ...trOns
3661
- }, tableColumn.map((column, $columnIndex) => renderColumn($xeTable, row, rowid, $rowIndex, column, $columnIndex))));
3786
+ }, tableColumn.map((column, $columnIndex) => renderColumn($xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex))));
3662
3787
  let isExpandTree = false;
3663
3788
  let rowChildren = [];
3664
3789
  if (treeConfig && !scrollYLoad && !transform) {
@@ -3782,6 +3907,7 @@ const {
3782
3907
 
3783
3908
 
3784
3909
 
3910
+
3785
3911
  const {
3786
3912
  globalEvents
3787
3913
  } = core_.VxeUI;
@@ -3823,7 +3949,6 @@ const maxYHeight = 5e6;
3823
3949
  const $xeGantt = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGantt', {});
3824
3950
  const {
3825
3951
  computeTaskOpts,
3826
- computeTaskViewOpts,
3827
3952
  computeStartField,
3828
3953
  computeEndField,
3829
3954
  computeScrollbarOpts,
@@ -3870,14 +3995,7 @@ const maxYHeight = 5e6;
3870
3995
  tableData: [],
3871
3996
  tableColumn: [],
3872
3997
  headerGroups: [],
3873
- viewCellWidth: 40,
3874
- rowHeightStore: {
3875
- large: 52,
3876
- default: 48,
3877
- medium: 44,
3878
- small: 40,
3879
- mini: 36
3880
- }
3998
+ viewCellWidth: 20
3881
3999
  });
3882
4000
  const internalData = createInternalData();
3883
4001
  const refMaps = {
@@ -3902,106 +4020,271 @@ const maxYHeight = 5e6;
3902
4020
  };
3903
4021
  const handleParseColumn = () => {
3904
4022
  const ganttProps = $xeGantt.props;
4023
+ const ganttReactData = $xeGantt.reactData;
3905
4024
  const {
3906
4025
  treeConfig
3907
4026
  } = ganttProps;
4027
+ const {
4028
+ taskScaleList
4029
+ } = ganttReactData;
3908
4030
  const {
3909
4031
  minViewDate,
3910
4032
  maxViewDate
3911
4033
  } = reactData;
3912
- const taskViewOpts = computeTaskViewOpts.value;
4034
+ const minScale = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(taskScaleList);
3913
4035
  const fullCols = [];
3914
4036
  const groupCols = [];
3915
- switch (taskViewOpts.mode) {
3916
- case 'year':
3917
- break;
3918
- case 'quarter':
3919
- break;
3920
- case 'month':
3921
- break;
3922
- case 'week':
3923
- break;
3924
- default:
3925
- {
3926
- if (minViewDate && maxViewDate) {
3927
- const currTime = minViewDate.getTime();
3928
- const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
3929
- const countDayNum = Math.max(6, Math.floor(diffDayNum / 86400000) + 1);
3930
- const groupList = [];
3931
- const colList = [];
3932
- const groupMaps = {};
3933
- for (let i = 0; i < countDayNum; i++) {
3934
- const itemDate = new Date(currTime + i * 86400000);
3935
- const yyyyy = `${itemDate.getFullYear()}-${itemDate.getMonth() + 1}`;
3936
- const mmDd = `${itemDate.getDate()}`;
3937
- let groupCol = groupMaps[yyyyy];
3938
- const column = {
3939
- field: `${yyyyy}-${mmDd}`,
3940
- title: mmDd
3941
- };
3942
- if (groupCol) {
3943
- groupCol.children.push(column);
3944
- fullCols.push(groupCol);
3945
- } else {
3946
- groupCol = {
3947
- field: yyyyy,
3948
- title: yyyyy,
3949
- children: [column]
3950
- };
3951
- groupList.push(groupCol);
3952
- fullCols.push(groupCol);
3953
- groupMaps[yyyyy] = groupCol;
3954
- }
3955
- colList.push(column);
3956
- }
3957
- groupCols.push(groupList, colList);
3958
- const $xeTable = internalData.xeTable;
3959
- if ($xeTable) {
3960
- const startField = computeStartField.value;
3961
- const endField = computeEndField.value;
3962
- const {
3963
- computeTreeOpts
3964
- } = $xeTable.getComputeMaps();
3965
- const tableInternalData = $xeTable.internalData;
3966
- const {
3967
- afterFullData,
3968
- afterTreeFullData
3969
- } = tableInternalData;
3970
- const treeOpts = computeTreeOpts.value;
3971
- const {
3972
- transform
3973
- } = treeOpts;
3974
- const childrenField = treeOpts.children || treeOpts.childrenField;
3975
- const ctMaps = {};
3976
- const handleParseRender = row => {
3977
- const rowid = $xeTable.getRowid(row);
3978
- const startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
3979
- const endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
3980
- if (startValue && endValue) {
3981
- const startDate = parseStringDate(startValue);
3982
- const endDate = parseStringDate(endValue);
3983
- const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / 86400000);
3984
- const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / 86400000) + 1;
3985
- ctMaps[rowid] = {
3986
- row,
3987
- rowid,
3988
- oLeftSize,
3989
- oWidthSize
3990
- };
3991
- }
3992
- };
3993
- if (treeConfig) {
3994
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, handleParseRender, {
3995
- children: transform ? treeOpts.mapChildrenField : childrenField
3996
- });
3997
- } else {
3998
- afterFullData.forEach(handleParseRender);
3999
- }
4000
- internalData.chartMaps = ctMaps;
4001
- }
4037
+ if (minScale && minViewDate && maxViewDate) {
4038
+ const minSType = minScale.type;
4039
+ const weekScale = taskScaleList.find(item => item.type === 'week');
4040
+ let gapTime = 1000 * 60 * 60 * 24;
4041
+ switch (minScale.type) {
4042
+ case 'hour':
4043
+ gapTime = 1000 * 60 * 60;
4044
+ break;
4045
+ case 'minute':
4046
+ gapTime = 1000 * 60;
4047
+ break;
4048
+ case 'second':
4049
+ gapTime = 1000;
4050
+ break;
4051
+ default:
4052
+ {
4053
+ break;
4054
+ }
4055
+ }
4056
+ const currTime = minViewDate.getTime();
4057
+ const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
4058
+ const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
4059
+ switch (minScale.type) {
4060
+ case 'day':
4061
+ case 'date':
4062
+ if (diffDayNum > 1000 * 60 * 60 * 24 * 366 * 3) {
4063
+ reactData.tableColumn = [];
4064
+ reactData.headerGroups = [];
4065
+ return;
4002
4066
  }
4003
4067
  break;
4068
+ case 'hour':
4069
+ if (diffDayNum > 1000 * 60 * 60 * 24 * 31 * 3) {
4070
+ reactData.tableColumn = [];
4071
+ reactData.headerGroups = [];
4072
+ return;
4073
+ }
4074
+ break;
4075
+ case 'minute':
4076
+ if (diffDayNum > 1000 * 60 * 60 * 24 * 3) {
4077
+ reactData.tableColumn = [];
4078
+ reactData.headerGroups = [];
4079
+ return;
4080
+ }
4081
+ break;
4082
+ case 'second':
4083
+ if (diffDayNum > 1000 * 60 * 60 * 3) {
4084
+ reactData.tableColumn = [];
4085
+ reactData.headerGroups = [];
4086
+ return;
4087
+ }
4088
+ break;
4089
+ }
4090
+ const renderListMaps = {
4091
+ year: [],
4092
+ quarter: [],
4093
+ month: [],
4094
+ week: [],
4095
+ day: [],
4096
+ date: [],
4097
+ hour: [],
4098
+ minute: [],
4099
+ second: []
4100
+ };
4101
+ const tempTypeMaps = {
4102
+ year: {},
4103
+ quarter: {},
4104
+ month: {},
4105
+ week: {},
4106
+ day: {},
4107
+ date: {},
4108
+ hour: {},
4109
+ minute: {},
4110
+ second: {}
4111
+ };
4112
+ const handleData = (type, colMaps, minCol) => {
4113
+ if (minSType === type) {
4114
+ return;
4115
+ }
4116
+ const currCol = colMaps[type];
4117
+ const currKey = `${currCol.field}`;
4118
+ let currGpCol = tempTypeMaps[type][currKey];
4119
+ if (!currGpCol) {
4120
+ currGpCol = currCol;
4121
+ tempTypeMaps[type][currKey] = currGpCol;
4122
+ renderListMaps[type].push(currGpCol);
4123
+ }
4124
+ if (currGpCol) {
4125
+ if (!currGpCol.children) {
4126
+ currGpCol.children = [];
4127
+ }
4128
+ currGpCol.children.push(minCol);
4129
+ }
4130
+ };
4131
+ for (let i = 0; i < countSize; i++) {
4132
+ const itemDate = new Date(currTime + i * gapTime);
4133
+ const [yyyy, MM, dd, HH, mm, ss] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-');
4134
+ const e = itemDate.getDay();
4135
+ const E = e + 1;
4136
+ const q = Math.ceil((itemDate.getMonth() + 1) / 3);
4137
+ const W = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined);
4138
+ const dateObj = {
4139
+ yy: yyyy,
4140
+ M: MM,
4141
+ d: dd,
4142
+ H: HH,
4143
+ m: mm,
4144
+ s: ss,
4145
+ q,
4146
+ W,
4147
+ E,
4148
+ e
4149
+ };
4150
+ const colMaps = {
4151
+ year: {
4152
+ field: yyyy,
4153
+ title: yyyy,
4154
+ params: dateObj
4155
+ },
4156
+ quarter: {
4157
+ field: `${yyyy}_q${q}`,
4158
+ title: q,
4159
+ params: dateObj
4160
+ },
4161
+ month: {
4162
+ field: `${yyyy}_${MM}`,
4163
+ title: MM,
4164
+ params: dateObj
4165
+ },
4166
+ week: {
4167
+ field: `${yyyy}_W${W}`,
4168
+ title: W,
4169
+ params: dateObj
4170
+ },
4171
+ day: {
4172
+ field: `${yyyy}_${MM}_${dd}_E${E}`,
4173
+ title: E,
4174
+ params: dateObj
4175
+ },
4176
+ date: {
4177
+ field: `${yyyy}_${MM}_${dd}`,
4178
+ title: dd,
4179
+ params: dateObj
4180
+ },
4181
+ hour: {
4182
+ field: `${yyyy}_${MM}_${dd}_${HH}`,
4183
+ title: HH,
4184
+ params: dateObj
4185
+ },
4186
+ minute: {
4187
+ field: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
4188
+ title: mm,
4189
+ params: dateObj
4190
+ },
4191
+ second: {
4192
+ field: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`,
4193
+ title: ss,
4194
+ params: dateObj
4195
+ }
4196
+ };
4197
+ const minCol = colMaps[minSType];
4198
+ if (minScale.level < 19) {
4199
+ handleData('year', colMaps, minCol);
4200
+ }
4201
+ if (minScale.level < 17) {
4202
+ handleData('quarter', colMaps, minCol);
4203
+ }
4204
+ if (minScale.level < 14) {
4205
+ handleData('month', colMaps, minCol);
4206
+ }
4207
+ if (minScale.level < 13) {
4208
+ handleData('week', colMaps, minCol);
4209
+ }
4210
+ if (minScale.level < 11) {
4211
+ handleData('day', colMaps, minCol);
4212
+ }
4213
+ if (minScale.level < 12) {
4214
+ handleData('date', colMaps, minCol);
4215
+ }
4216
+ if (minScale.level < 7) {
4217
+ handleData('hour', colMaps, minCol);
4218
+ }
4219
+ if (minScale.level < 5) {
4220
+ handleData('minute', colMaps, minCol);
4221
+ }
4222
+ fullCols.push(minCol);
4223
+ }
4224
+ taskScaleList.forEach(scaleItem => {
4225
+ if (scaleItem.type === minSType) {
4226
+ groupCols.push({
4227
+ scaleItem,
4228
+ columns: fullCols
4229
+ });
4230
+ return;
4231
+ }
4232
+ const list = renderListMaps[scaleItem.type] || [];
4233
+ if (list) {
4234
+ list.forEach(item => {
4235
+ item.childCount = item.children ? item.children.length : 0;
4236
+ item.children = undefined;
4237
+ });
4004
4238
  }
4239
+ groupCols.push({
4240
+ scaleItem,
4241
+ columns: list
4242
+ });
4243
+ });
4244
+ const $xeTable = internalData.xeTable;
4245
+ if ($xeTable) {
4246
+ const startField = computeStartField.value;
4247
+ const endField = computeEndField.value;
4248
+ const {
4249
+ computeTreeOpts
4250
+ } = $xeTable.getComputeMaps();
4251
+ const tableInternalData = $xeTable.internalData;
4252
+ const {
4253
+ afterFullData,
4254
+ afterTreeFullData
4255
+ } = tableInternalData;
4256
+ const treeOpts = computeTreeOpts.value;
4257
+ const {
4258
+ transform
4259
+ } = treeOpts;
4260
+ const childrenField = treeOpts.children || treeOpts.childrenField;
4261
+ const ctMaps = {};
4262
+ const handleParseRender = row => {
4263
+ const rowid = $xeTable.getRowid(row);
4264
+ const startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
4265
+ const endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
4266
+ if (startValue && endValue) {
4267
+ const startDate = parseStringDate(startValue);
4268
+ const endDate = parseStringDate(endValue);
4269
+ const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / gapTime);
4270
+ const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / gapTime) + 1;
4271
+ ctMaps[rowid] = {
4272
+ row,
4273
+ rowid,
4274
+ oLeftSize,
4275
+ oWidthSize
4276
+ };
4277
+ }
4278
+ };
4279
+ if (treeConfig) {
4280
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, handleParseRender, {
4281
+ children: transform ? treeOpts.mapChildrenField : childrenField
4282
+ });
4283
+ } else {
4284
+ afterFullData.forEach(handleParseRender);
4285
+ }
4286
+ internalData.chartMaps = ctMaps;
4287
+ }
4005
4288
  }
4006
4289
  reactData.tableColumn = fullCols;
4007
4290
  reactData.headerGroups = groupCols;
@@ -4601,11 +4884,10 @@ const maxYHeight = 5e6;
4601
4884
  scrollXLoad,
4602
4885
  scrollYLoad
4603
4886
  } = reactData;
4604
- const taskViewOpts = computeTaskViewOpts.value;
4605
4887
  const scrollbarXToTop = computeScrollbarXToTop.value;
4606
4888
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
4607
4889
  ref: refElem,
4608
- class: ['vxe-gantt-view', `mode--${taskViewOpts.mode || 'day'}`, {
4890
+ class: ['vxe-gantt-view', {
4609
4891
  'is--scroll-y': overflowY,
4610
4892
  'is--scroll-x': overflowX,
4611
4893
  'is--virtual-x': scrollXLoad,
@@ -4668,7 +4950,7 @@ var external_root_VxeUITable_commonjs_vxe_table_commonjs2_vxe_table_amd_vxe_tabl
4668
4950
  const {
4669
4951
  getConfig,
4670
4952
  getIcon,
4671
- getI18n,
4953
+ getI18n: gantt_getI18n,
4672
4954
  commands,
4673
4955
  hooks,
4674
4956
  useFns,
@@ -4686,6 +4968,20 @@ function gantt_createInternalData() {
4686
4968
  resizeTableWidth: 0
4687
4969
  };
4688
4970
  }
4971
+ const viewTypeLevelMaps = {
4972
+ year: 19,
4973
+ quarter: 17,
4974
+ month: 15,
4975
+ week: 13,
4976
+ day: 11,
4977
+ date: 9,
4978
+ hour: 7,
4979
+ minute: 5,
4980
+ second: 3
4981
+ };
4982
+ function getViewTypeLevel(type) {
4983
+ return viewTypeLevelMaps[type || 'date'] || viewTypeLevelMaps.date;
4984
+ }
4689
4985
  /* harmony default export */ var gantt = (defineVxeComponent({
4690
4986
  name: 'VxeGantt',
4691
4987
  props: {
@@ -4698,6 +4994,7 @@ function gantt_createInternalData() {
4698
4994
  zoomConfig: Object,
4699
4995
  layouts: Array,
4700
4996
  taskConfig: Object,
4997
+ taskViewScaleConfs: Object,
4701
4998
  taskViewConfig: Object,
4702
4999
  taskBarConfig: Object,
4703
5000
  taskSplitConfig: Object,
@@ -4736,7 +5033,8 @@ function gantt_createInternalData() {
4736
5033
  currentPage: 1
4737
5034
  },
4738
5035
  showLeftView: true,
4739
- showRightView: true
5036
+ showRightView: true,
5037
+ taskScaleList: []
4740
5038
  });
4741
5039
  const internalData = gantt_createInternalData();
4742
5040
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
@@ -4802,6 +5100,9 @@ function gantt_createInternalData() {
4802
5100
  const computeTaskOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4803
5101
  return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig);
4804
5102
  });
5103
+ const computeTaskViewScaleMapsOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5104
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge({}, getConfig().gantt.taskViewScaleConfs, props.taskViewScaleConfs);
5105
+ });
4805
5106
  const computeTaskViewOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4806
5107
  return Object.assign({}, getConfig().gantt.taskViewConfig, props.taskViewConfig);
4807
5108
  });
@@ -4811,6 +5112,13 @@ function gantt_createInternalData() {
4811
5112
  const computeTaskSplitOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4812
5113
  return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
4813
5114
  });
5115
+ const computeTaskScaleConfs = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5116
+ const taskViewOpts = computeTaskViewOpts.value;
5117
+ const {
5118
+ scales
5119
+ } = taskViewOpts;
5120
+ return scales;
5121
+ });
4814
5122
  const computeTitleField = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4815
5123
  const taskOpts = computeTaskOpts.value;
4816
5124
  return taskOpts.titleField || 'title';
@@ -5045,9 +5353,11 @@ function gantt_createInternalData() {
5045
5353
  computeToolbarOpts,
5046
5354
  computeZoomOpts,
5047
5355
  computeTaskOpts,
5356
+ computeTaskViewScaleMapsOpts,
5048
5357
  computeTaskViewOpts,
5049
5358
  computeTaskBarOpts,
5050
5359
  computeTaskSplitOpts,
5360
+ computeTaskScaleConfs,
5051
5361
  computeTitleField,
5052
5362
  computeStartField,
5053
5363
  computeEndField,
@@ -5065,6 +5375,47 @@ function gantt_createInternalData() {
5065
5375
  getRefMaps: () => refMaps,
5066
5376
  getComputeMaps: () => computeMaps
5067
5377
  };
5378
+ const handleTaskScaleConfig = () => {
5379
+ const taskScaleConfs = computeTaskScaleConfs.value;
5380
+ const taskViewScaleMapsOpts = computeTaskViewScaleMapsOpts.value;
5381
+ const scaleConfs = [];
5382
+ if (taskScaleConfs) {
5383
+ const keyMaps = {};
5384
+ taskScaleConfs.forEach(conf => {
5385
+ const sConf = !conf || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(conf) ? {
5386
+ type: conf
5387
+ } : conf;
5388
+ const {
5389
+ type
5390
+ } = sConf;
5391
+ if (!type || !viewTypeLevelMaps[type]) {
5392
+ errLog('vxe.error.errProp', [`type=${type}`, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(viewTypeLevelMaps).join(',')]);
5393
+ return;
5394
+ }
5395
+ if (keyMaps[type]) {
5396
+ errLog('vxe.error.repeatProp', ['type', type]);
5397
+ return;
5398
+ }
5399
+ keyMaps[type] = true;
5400
+ scaleConfs.push(Object.assign({}, type ? taskViewScaleMapsOpts[type] || {} : {}, sConf, {
5401
+ level: getViewTypeLevel(type)
5402
+ }));
5403
+ });
5404
+ }
5405
+ if (!scaleConfs.length) {
5406
+ scaleConfs.push({
5407
+ type: 'month',
5408
+ level: viewTypeLevelMaps.month
5409
+ }, {
5410
+ type: 'date',
5411
+ level: viewTypeLevelMaps.date
5412
+ });
5413
+ }
5414
+ reactData.taskScaleList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(scaleConfs, {
5415
+ field: 'level',
5416
+ order: 'desc'
5417
+ });
5418
+ };
5068
5419
  const initToolbar = () => {
5069
5420
  const toolbarOpts = computeToolbarOpts.value;
5070
5421
  if (props.toolbarConfig && isEnableConf(toolbarOpts)) {
@@ -5140,7 +5491,7 @@ function gantt_createInternalData() {
5140
5491
  if (core_.VxeUI.modal) {
5141
5492
  core_.VxeUI.modal.message({
5142
5493
  id: code,
5143
- content: getI18n('vxe.grid.selectOneRecord'),
5494
+ content: gantt_getI18n('vxe.grid.selectOneRecord'),
5144
5495
  status: 'warning'
5145
5496
  });
5146
5497
  }
@@ -5161,7 +5512,7 @@ function gantt_createInternalData() {
5161
5512
  $gantt: $xeGantt
5162
5513
  }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, messageProp);
5163
5514
  }
5164
- return msg || getI18n(defaultMsg);
5515
+ return msg || gantt_getI18n(defaultMsg);
5165
5516
  };
5166
5517
  const handleDeleteRow = (code, alertKey, callback) => {
5167
5518
  const isActiveMsg = computeIsActiveMsg.value;
@@ -5171,7 +5522,7 @@ function gantt_createInternalData() {
5171
5522
  if (core_.VxeUI.modal) {
5172
5523
  return core_.VxeUI.modal.confirm({
5173
5524
  id: `cfm_${code}`,
5174
- content: getI18n(alertKey),
5525
+ content: gantt_getI18n(alertKey),
5175
5526
  escClosable: true
5176
5527
  }).then(type => {
5177
5528
  if (type === 'confirm') {
@@ -5183,7 +5534,7 @@ function gantt_createInternalData() {
5183
5534
  if (core_.VxeUI.modal) {
5184
5535
  core_.VxeUI.modal.message({
5185
5536
  id: `msg_${code}`,
5186
- content: getI18n('vxe.grid.selectOneRecord'),
5537
+ content: gantt_getI18n('vxe.grid.selectOneRecord'),
5187
5538
  status: 'warning'
5188
5539
  });
5189
5540
  }
@@ -5873,7 +6224,7 @@ function gantt_createInternalData() {
5873
6224
  if (core_.VxeUI.modal) {
5874
6225
  core_.VxeUI.modal.message({
5875
6226
  id: code,
5876
- content: getI18n('vxe.grid.selectOneRecord'),
6227
+ content: gantt_getI18n('vxe.grid.selectOneRecord'),
5877
6228
  status: 'warning'
5878
6229
  });
5879
6230
  }
@@ -5978,7 +6329,7 @@ function gantt_createInternalData() {
5978
6329
  if (core_.VxeUI.modal) {
5979
6330
  core_.VxeUI.modal.message({
5980
6331
  id: code,
5981
- content: getI18n('vxe.grid.dataUnchanged'),
6332
+ content: gantt_getI18n('vxe.grid.dataUnchanged'),
5982
6333
  status: 'info'
5983
6334
  });
5984
6335
  }
@@ -6779,6 +7130,9 @@ function gantt_createInternalData() {
6779
7130
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.proxyConfig, () => {
6780
7131
  initProxy();
6781
7132
  });
7133
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(computeTaskScaleConfs, () => {
7134
+ handleTaskScaleConfig();
7135
+ });
6782
7136
  hooks.forEach(options => {
6783
7137
  const {
6784
7138
  setupGantt
@@ -6790,6 +7144,7 @@ function gantt_createInternalData() {
6790
7144
  }
6791
7145
  }
6792
7146
  });
7147
+ handleTaskScaleConfig();
6793
7148
  initPages();
6794
7149
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
6795
7150
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {