vxe-gantt 4.0.4 → 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.
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.4"}`;
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.4";
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
  };
@@ -3827,6 +3907,7 @@ const {
3827
3907
 
3828
3908
 
3829
3909
 
3910
+
3830
3911
  const {
3831
3912
  globalEvents
3832
3913
  } = core_.VxeUI;
@@ -3868,7 +3949,6 @@ const maxYHeight = 5e6;
3868
3949
  const $xeGantt = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGantt', {});
3869
3950
  const {
3870
3951
  computeTaskOpts,
3871
- computeTaskViewOpts,
3872
3952
  computeStartField,
3873
3953
  computeEndField,
3874
3954
  computeScrollbarOpts,
@@ -3915,14 +3995,7 @@ const maxYHeight = 5e6;
3915
3995
  tableData: [],
3916
3996
  tableColumn: [],
3917
3997
  headerGroups: [],
3918
- viewCellWidth: 40,
3919
- rowHeightStore: {
3920
- large: 52,
3921
- default: 48,
3922
- medium: 44,
3923
- small: 40,
3924
- mini: 36
3925
- }
3998
+ viewCellWidth: 20
3926
3999
  });
3927
4000
  const internalData = createInternalData();
3928
4001
  const refMaps = {
@@ -3947,106 +4020,271 @@ const maxYHeight = 5e6;
3947
4020
  };
3948
4021
  const handleParseColumn = () => {
3949
4022
  const ganttProps = $xeGantt.props;
4023
+ const ganttReactData = $xeGantt.reactData;
3950
4024
  const {
3951
4025
  treeConfig
3952
4026
  } = ganttProps;
4027
+ const {
4028
+ taskScaleList
4029
+ } = ganttReactData;
3953
4030
  const {
3954
4031
  minViewDate,
3955
4032
  maxViewDate
3956
4033
  } = reactData;
3957
- const taskViewOpts = computeTaskViewOpts.value;
4034
+ const minScale = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(taskScaleList);
3958
4035
  const fullCols = [];
3959
4036
  const groupCols = [];
3960
- switch (taskViewOpts.mode) {
3961
- case 'year':
3962
- break;
3963
- case 'quarter':
3964
- break;
3965
- case 'month':
3966
- break;
3967
- case 'week':
3968
- break;
3969
- default:
3970
- {
3971
- if (minViewDate && maxViewDate) {
3972
- const currTime = minViewDate.getTime();
3973
- const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
3974
- const countDayNum = Math.max(6, Math.floor(diffDayNum / 86400000) + 1);
3975
- const groupList = [];
3976
- const colList = [];
3977
- const groupMaps = {};
3978
- for (let i = 0; i < countDayNum; i++) {
3979
- const itemDate = new Date(currTime + i * 86400000);
3980
- const yyyyy = `${itemDate.getFullYear()}-${itemDate.getMonth() + 1}`;
3981
- const mmDd = `${itemDate.getDate()}`;
3982
- let groupCol = groupMaps[yyyyy];
3983
- const column = {
3984
- field: `${yyyyy}-${mmDd}`,
3985
- title: mmDd
3986
- };
3987
- if (groupCol) {
3988
- groupCol.children.push(column);
3989
- fullCols.push(groupCol);
3990
- } else {
3991
- groupCol = {
3992
- field: yyyyy,
3993
- title: yyyyy,
3994
- children: [column]
3995
- };
3996
- groupList.push(groupCol);
3997
- fullCols.push(groupCol);
3998
- groupMaps[yyyyy] = groupCol;
3999
- }
4000
- colList.push(column);
4001
- }
4002
- groupCols.push(groupList, colList);
4003
- const $xeTable = internalData.xeTable;
4004
- if ($xeTable) {
4005
- const startField = computeStartField.value;
4006
- const endField = computeEndField.value;
4007
- const {
4008
- computeTreeOpts
4009
- } = $xeTable.getComputeMaps();
4010
- const tableInternalData = $xeTable.internalData;
4011
- const {
4012
- afterFullData,
4013
- afterTreeFullData
4014
- } = tableInternalData;
4015
- const treeOpts = computeTreeOpts.value;
4016
- const {
4017
- transform
4018
- } = treeOpts;
4019
- const childrenField = treeOpts.children || treeOpts.childrenField;
4020
- const ctMaps = {};
4021
- const handleParseRender = row => {
4022
- const rowid = $xeTable.getRowid(row);
4023
- const startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
4024
- const endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
4025
- if (startValue && endValue) {
4026
- const startDate = parseStringDate(startValue);
4027
- const endDate = parseStringDate(endValue);
4028
- const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / 86400000);
4029
- const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / 86400000) + 1;
4030
- ctMaps[rowid] = {
4031
- row,
4032
- rowid,
4033
- oLeftSize,
4034
- oWidthSize
4035
- };
4036
- }
4037
- };
4038
- if (treeConfig) {
4039
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, handleParseRender, {
4040
- children: transform ? treeOpts.mapChildrenField : childrenField
4041
- });
4042
- } else {
4043
- afterFullData.forEach(handleParseRender);
4044
- }
4045
- internalData.chartMaps = ctMaps;
4046
- }
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;
4066
+ }
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;
4047
4080
  }
4048
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
+ });
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);
4049
4285
  }
4286
+ internalData.chartMaps = ctMaps;
4287
+ }
4050
4288
  }
4051
4289
  reactData.tableColumn = fullCols;
4052
4290
  reactData.headerGroups = groupCols;
@@ -4646,11 +4884,10 @@ const maxYHeight = 5e6;
4646
4884
  scrollXLoad,
4647
4885
  scrollYLoad
4648
4886
  } = reactData;
4649
- const taskViewOpts = computeTaskViewOpts.value;
4650
4887
  const scrollbarXToTop = computeScrollbarXToTop.value;
4651
4888
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
4652
4889
  ref: refElem,
4653
- class: ['vxe-gantt-view', `mode--${taskViewOpts.mode || 'day'}`, {
4890
+ class: ['vxe-gantt-view', {
4654
4891
  'is--scroll-y': overflowY,
4655
4892
  'is--scroll-x': overflowX,
4656
4893
  'is--virtual-x': scrollXLoad,
@@ -4713,7 +4950,7 @@ var external_root_VxeUITable_commonjs_vxe_table_commonjs2_vxe_table_amd_vxe_tabl
4713
4950
  const {
4714
4951
  getConfig,
4715
4952
  getIcon,
4716
- getI18n,
4953
+ getI18n: gantt_getI18n,
4717
4954
  commands,
4718
4955
  hooks,
4719
4956
  useFns,
@@ -4731,6 +4968,20 @@ function gantt_createInternalData() {
4731
4968
  resizeTableWidth: 0
4732
4969
  };
4733
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
+ }
4734
4985
  /* harmony default export */ var gantt = (defineVxeComponent({
4735
4986
  name: 'VxeGantt',
4736
4987
  props: {
@@ -4743,6 +4994,7 @@ function gantt_createInternalData() {
4743
4994
  zoomConfig: Object,
4744
4995
  layouts: Array,
4745
4996
  taskConfig: Object,
4997
+ taskViewScaleConfs: Object,
4746
4998
  taskViewConfig: Object,
4747
4999
  taskBarConfig: Object,
4748
5000
  taskSplitConfig: Object,
@@ -4781,7 +5033,8 @@ function gantt_createInternalData() {
4781
5033
  currentPage: 1
4782
5034
  },
4783
5035
  showLeftView: true,
4784
- showRightView: true
5036
+ showRightView: true,
5037
+ taskScaleList: []
4785
5038
  });
4786
5039
  const internalData = gantt_createInternalData();
4787
5040
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
@@ -4847,6 +5100,9 @@ function gantt_createInternalData() {
4847
5100
  const computeTaskOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4848
5101
  return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig);
4849
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
+ });
4850
5106
  const computeTaskViewOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4851
5107
  return Object.assign({}, getConfig().gantt.taskViewConfig, props.taskViewConfig);
4852
5108
  });
@@ -4856,6 +5112,13 @@ function gantt_createInternalData() {
4856
5112
  const computeTaskSplitOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4857
5113
  return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
4858
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
+ });
4859
5122
  const computeTitleField = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4860
5123
  const taskOpts = computeTaskOpts.value;
4861
5124
  return taskOpts.titleField || 'title';
@@ -5090,9 +5353,11 @@ function gantt_createInternalData() {
5090
5353
  computeToolbarOpts,
5091
5354
  computeZoomOpts,
5092
5355
  computeTaskOpts,
5356
+ computeTaskViewScaleMapsOpts,
5093
5357
  computeTaskViewOpts,
5094
5358
  computeTaskBarOpts,
5095
5359
  computeTaskSplitOpts,
5360
+ computeTaskScaleConfs,
5096
5361
  computeTitleField,
5097
5362
  computeStartField,
5098
5363
  computeEndField,
@@ -5110,6 +5375,47 @@ function gantt_createInternalData() {
5110
5375
  getRefMaps: () => refMaps,
5111
5376
  getComputeMaps: () => computeMaps
5112
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
+ };
5113
5419
  const initToolbar = () => {
5114
5420
  const toolbarOpts = computeToolbarOpts.value;
5115
5421
  if (props.toolbarConfig && isEnableConf(toolbarOpts)) {
@@ -5185,7 +5491,7 @@ function gantt_createInternalData() {
5185
5491
  if (core_.VxeUI.modal) {
5186
5492
  core_.VxeUI.modal.message({
5187
5493
  id: code,
5188
- content: getI18n('vxe.grid.selectOneRecord'),
5494
+ content: gantt_getI18n('vxe.grid.selectOneRecord'),
5189
5495
  status: 'warning'
5190
5496
  });
5191
5497
  }
@@ -5206,7 +5512,7 @@ function gantt_createInternalData() {
5206
5512
  $gantt: $xeGantt
5207
5513
  }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, messageProp);
5208
5514
  }
5209
- return msg || getI18n(defaultMsg);
5515
+ return msg || gantt_getI18n(defaultMsg);
5210
5516
  };
5211
5517
  const handleDeleteRow = (code, alertKey, callback) => {
5212
5518
  const isActiveMsg = computeIsActiveMsg.value;
@@ -5216,7 +5522,7 @@ function gantt_createInternalData() {
5216
5522
  if (core_.VxeUI.modal) {
5217
5523
  return core_.VxeUI.modal.confirm({
5218
5524
  id: `cfm_${code}`,
5219
- content: getI18n(alertKey),
5525
+ content: gantt_getI18n(alertKey),
5220
5526
  escClosable: true
5221
5527
  }).then(type => {
5222
5528
  if (type === 'confirm') {
@@ -5228,7 +5534,7 @@ function gantt_createInternalData() {
5228
5534
  if (core_.VxeUI.modal) {
5229
5535
  core_.VxeUI.modal.message({
5230
5536
  id: `msg_${code}`,
5231
- content: getI18n('vxe.grid.selectOneRecord'),
5537
+ content: gantt_getI18n('vxe.grid.selectOneRecord'),
5232
5538
  status: 'warning'
5233
5539
  });
5234
5540
  }
@@ -5918,7 +6224,7 @@ function gantt_createInternalData() {
5918
6224
  if (core_.VxeUI.modal) {
5919
6225
  core_.VxeUI.modal.message({
5920
6226
  id: code,
5921
- content: getI18n('vxe.grid.selectOneRecord'),
6227
+ content: gantt_getI18n('vxe.grid.selectOneRecord'),
5922
6228
  status: 'warning'
5923
6229
  });
5924
6230
  }
@@ -6023,7 +6329,7 @@ function gantt_createInternalData() {
6023
6329
  if (core_.VxeUI.modal) {
6024
6330
  core_.VxeUI.modal.message({
6025
6331
  id: code,
6026
- content: getI18n('vxe.grid.dataUnchanged'),
6332
+ content: gantt_getI18n('vxe.grid.dataUnchanged'),
6027
6333
  status: 'info'
6028
6334
  });
6029
6335
  }
@@ -6824,6 +7130,9 @@ function gantt_createInternalData() {
6824
7130
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.proxyConfig, () => {
6825
7131
  initProxy();
6826
7132
  });
7133
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(computeTaskScaleConfs, () => {
7134
+ handleTaskScaleConfig();
7135
+ });
6827
7136
  hooks.forEach(options => {
6828
7137
  const {
6829
7138
  setupGantt
@@ -6835,6 +7144,7 @@ function gantt_createInternalData() {
6835
7144
  }
6836
7145
  }
6837
7146
  });
7147
+ handleTaskScaleConfig();
6838
7148
  initPages();
6839
7149
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
6840
7150
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {