vxe-gantt 4.0.26 → 4.1.0

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
@@ -2780,7 +2780,7 @@ var core_ = __webpack_require__(4345);
2780
2780
  const {
2781
2781
  log
2782
2782
  } = core_.VxeUI;
2783
- const version = `gantt v${"4.0.26"}`;
2783
+ const version = `gantt v${"4.1.0"}`;
2784
2784
  const warnLog = log.create('warn', version);
2785
2785
  const errLog = log.create('error', version);
2786
2786
  ;// ./packages/ui/index.ts
@@ -2791,7 +2791,7 @@ const {
2791
2791
  setIcon,
2792
2792
  checkVersion
2793
2793
  } = core_.VxeUI;
2794
- core_.VxeUI.ganttVersion = "4.0.26";
2794
+ core_.VxeUI.ganttVersion = "4.1.0";
2795
2795
  setConfig({
2796
2796
  gantt: {
2797
2797
  // size: null,
@@ -2830,7 +2830,7 @@ setConfig({
2830
2830
  // beforeSave: null,
2831
2831
  // afterSave: null
2832
2832
  },
2833
- taskViewScaleConfs: {
2833
+ taskViewScaleConfig: {
2834
2834
  week: {
2835
2835
  startDay: 1
2836
2836
  }
@@ -2871,6 +2871,8 @@ var es_array_push = __webpack_require__(4114);
2871
2871
  var es_iterator_constructor = __webpack_require__(8111);
2872
2872
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
2873
2873
  var es_iterator_filter = __webpack_require__(2489);
2874
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
2875
+ var es_iterator_find = __webpack_require__(116);
2874
2876
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
2875
2877
  var es_iterator_for_each = __webpack_require__(7588);
2876
2878
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
@@ -3296,8 +3298,6 @@ const gridEmits = [...tableEmits, 'page-change', 'form-submit', 'form-submit-inv
3296
3298
  ;// ./packages/gantt/src/emits.ts
3297
3299
 
3298
3300
  const ganttEmits = [...gridEmits, 'task-cell-click', 'task-cell-dblclick', 'task-bar-click', 'task-bar-dblclick', 'task-view-cell-click', 'task-view-cell-dblclick'];
3299
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
3300
- var es_iterator_find = __webpack_require__(116);
3301
3301
  ;// ./packages/gantt/src/util.ts
3302
3302
  function getRefElem(refEl) {
3303
3303
  if (refEl) {
@@ -3317,6 +3317,17 @@ function getCalcHeight(height) {
3317
3317
  function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
3318
3318
  return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
3319
3319
  }
3320
+ function getStandardGapTime(type) {
3321
+ switch (type) {
3322
+ case 'hour':
3323
+ return 1000 * 60 * 60;
3324
+ case 'minute':
3325
+ return 1000 * 60;
3326
+ case 'second':
3327
+ return 1000;
3328
+ }
3329
+ return 1000 * 60 * 60 * 24;
3330
+ }
3320
3331
  ;// ./packages/gantt/src/gantt-header.ts
3321
3332
 
3322
3333
 
@@ -3384,12 +3395,14 @@ const viewType = 'header';
3384
3395
  }, $rowIndex) => {
3385
3396
  const {
3386
3397
  type,
3398
+ titleFormat,
3387
3399
  titleMethod,
3388
3400
  headerCellStyle,
3389
3401
  slots
3390
3402
  } = scaleItem;
3391
3403
  const titleSlot = slots ? slots.title : null;
3392
- const todayValue = showNowLine && $rowIndex === headerGroups.length - 1 ? todayDateMaps[type] : null;
3404
+ const isLast = $rowIndex === headerGroups.length - 1;
3405
+ const todayValue = isLast && showNowLine ? todayDateMaps[type] : null;
3393
3406
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('tr', {
3394
3407
  key: $rowIndex
3395
3408
  }, columns.map((column, cIndex) => {
@@ -3405,6 +3418,10 @@ const viewType = 'header';
3405
3418
  } else {
3406
3419
  label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
3407
3420
  }
3421
+ } else {
3422
+ if (isLast && scaleItem.type === 'week') {
3423
+ label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
3424
+ }
3408
3425
  }
3409
3426
  let cellVNs = label;
3410
3427
  const ctParams = {
@@ -3420,6 +3437,8 @@ const viewType = 'header';
3420
3437
  cellVNs = $xeGantt.callSlot(titleSlot, ctParams);
3421
3438
  } else if (titleMethod) {
3422
3439
  cellVNs = `${titleMethod(ctParams)}`;
3440
+ } else if (titleFormat) {
3441
+ cellVNs = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, titleFormat);
3423
3442
  }
3424
3443
  let cellStys = {};
3425
3444
  if (headerCellStyle) {
@@ -4087,6 +4106,8 @@ const {
4087
4106
  globalEvents
4088
4107
  } = core_.VxeUI;
4089
4108
  const gantt_view_sourceType = 'gantt';
4109
+ const minuteMs = 1000 * 60;
4110
+ const dayMs = minuteMs * 60 * 24;
4090
4111
  function createInternalData() {
4091
4112
  return {
4092
4113
  xeTable: null,
@@ -4124,7 +4145,10 @@ const maxYHeight = 5e6;
4124
4145
  computeEndField,
4125
4146
  computeScrollbarOpts,
4126
4147
  computeScrollbarXToTop,
4127
- computeScrollbarYToLeft
4148
+ computeScrollbarYToLeft,
4149
+ computeScaleUnit,
4150
+ computeWeekScale,
4151
+ computeMinScale
4128
4152
  } = $xeGantt.getComputeMaps();
4129
4153
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
4130
4154
  const refScrollXVirtualElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
@@ -4174,7 +4198,80 @@ const maxYHeight = 5e6;
4174
4198
  const refMaps = {
4175
4199
  refElem
4176
4200
  };
4177
- const computeMaps = {};
4201
+ const computeScaleDateList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
4202
+ const {
4203
+ minViewDate,
4204
+ maxViewDate
4205
+ } = reactData;
4206
+ const minScale = computeMinScale.value;
4207
+ const dateList = [];
4208
+ if (!minViewDate || !maxViewDate) {
4209
+ return dateList;
4210
+ }
4211
+ const startTime = minViewDate.getTime();
4212
+ const endTime = maxViewDate.getTime();
4213
+ switch (minScale.type) {
4214
+ case 'year':
4215
+ {
4216
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(minViewDate, 0, 'first');
4217
+ while (currDate <= maxViewDate) {
4218
+ const itemDate = currDate;
4219
+ dateList.push(itemDate);
4220
+ currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(currDate, 1);
4221
+ }
4222
+ break;
4223
+ }
4224
+ case 'quarter':
4225
+ {
4226
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(minViewDate, 0, 'first');
4227
+ while (currDate <= maxViewDate) {
4228
+ const itemDate = currDate;
4229
+ dateList.push(itemDate);
4230
+ currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(currDate, 1);
4231
+ }
4232
+ break;
4233
+ }
4234
+ case 'month':
4235
+ {
4236
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(minViewDate, 0, 'first');
4237
+ while (currDate <= maxViewDate) {
4238
+ const itemDate = currDate;
4239
+ dateList.push(itemDate);
4240
+ currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(currDate, 1);
4241
+ }
4242
+ break;
4243
+ }
4244
+ case 'week':
4245
+ {
4246
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(minViewDate, 0, minScale.startDay, minScale.startDay);
4247
+ while (currDate <= maxViewDate) {
4248
+ const itemDate = currDate;
4249
+ dateList.push(itemDate);
4250
+ currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(currDate, 1);
4251
+ }
4252
+ break;
4253
+ }
4254
+ case 'day':
4255
+ case 'date':
4256
+ case 'hour':
4257
+ case 'minute':
4258
+ case 'second':
4259
+ {
4260
+ const gapTime = getStandardGapTime(minScale.type);
4261
+ let currTime = startTime;
4262
+ while (currTime <= endTime) {
4263
+ const itemDate = new Date(currTime);
4264
+ dateList.push(itemDate);
4265
+ currTime += gapTime;
4266
+ }
4267
+ break;
4268
+ }
4269
+ }
4270
+ return dateList;
4271
+ });
4272
+ const computeMaps = {
4273
+ computeScaleDateList
4274
+ };
4178
4275
  const $xeGanttView = {
4179
4276
  xID,
4180
4277
  props,
@@ -4215,44 +4312,18 @@ const maxYHeight = 5e6;
4215
4312
  second: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`
4216
4313
  };
4217
4314
  };
4218
- const handleParseColumn = () => {
4219
- const ganttProps = $xeGantt.props;
4315
+ const handleColumnHeader = () => {
4220
4316
  const ganttReactData = $xeGantt.reactData;
4221
- const {
4222
- treeConfig
4223
- } = ganttProps;
4224
4317
  const {
4225
4318
  taskScaleList
4226
4319
  } = ganttReactData;
4227
- const {
4228
- minViewDate,
4229
- maxViewDate
4230
- } = reactData;
4231
- const minScale = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(taskScaleList);
4320
+ const scaleUnit = computeScaleUnit.value;
4321
+ const minScale = computeMinScale.value;
4322
+ const weekScale = computeWeekScale.value;
4323
+ const scaleDateList = computeScaleDateList.value;
4232
4324
  const fullCols = [];
4233
4325
  const groupCols = [];
4234
- if (minScale && minViewDate && maxViewDate) {
4235
- const minSType = minScale.type;
4236
- const weekScale = taskScaleList.find(item => item.type === 'week');
4237
- let gapTime = 1000 * 60 * 60 * 24;
4238
- switch (minScale.type) {
4239
- case 'hour':
4240
- gapTime = 1000 * 60 * 60;
4241
- break;
4242
- case 'minute':
4243
- gapTime = 1000 * 60;
4244
- break;
4245
- case 'second':
4246
- gapTime = 1000;
4247
- break;
4248
- default:
4249
- {
4250
- break;
4251
- }
4252
- }
4253
- const currTime = minViewDate.getTime();
4254
- const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
4255
- const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
4326
+ if (minScale && scaleUnit && scaleDateList.length) {
4256
4327
  const renderListMaps = {
4257
4328
  year: [],
4258
4329
  quarter: [],
@@ -4276,7 +4347,7 @@ const maxYHeight = 5e6;
4276
4347
  second: {}
4277
4348
  };
4278
4349
  const handleData = (type, colMaps, minCol) => {
4279
- if (minSType === type) {
4350
+ if (minScale.type === type) {
4280
4351
  return;
4281
4352
  }
4282
4353
  const currCol = colMaps[type];
@@ -4294,14 +4365,15 @@ const maxYHeight = 5e6;
4294
4365
  currGpCol.children.push(minCol);
4295
4366
  }
4296
4367
  };
4297
- for (let i = 0; i < countSize; i++) {
4298
- const itemDate = new Date(currTime + i * gapTime);
4368
+ for (let i = 0; i < scaleDateList.length; i++) {
4369
+ const itemDate = scaleDateList[i];
4299
4370
  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('-');
4300
4371
  const e = itemDate.getDay();
4301
4372
  const E = e + 1;
4302
4373
  const q = Math.ceil((itemDate.getMonth() + 1) / 3);
4303
4374
  const W = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined);
4304
4375
  const dateObj = {
4376
+ date: itemDate,
4305
4377
  yy: yyyy,
4306
4378
  M: MM,
4307
4379
  d: dd,
@@ -4360,7 +4432,7 @@ const maxYHeight = 5e6;
4360
4432
  dateObj
4361
4433
  }
4362
4434
  };
4363
- const minCol = colMaps[minSType];
4435
+ const minCol = colMaps[minScale.type];
4364
4436
  if (minScale.level < 19) {
4365
4437
  handleData('year', colMaps, minCol);
4366
4438
  }
@@ -4388,7 +4460,7 @@ const maxYHeight = 5e6;
4388
4460
  fullCols.push(minCol);
4389
4461
  }
4390
4462
  taskScaleList.forEach(scaleItem => {
4391
- if (scaleItem.type === minSType) {
4463
+ if (scaleItem.type === minScale.type) {
4392
4464
  groupCols.push({
4393
4465
  scaleItem,
4394
4466
  columns: fullCols
@@ -4407,6 +4479,249 @@ const maxYHeight = 5e6;
4407
4479
  columns: list
4408
4480
  });
4409
4481
  });
4482
+ }
4483
+ return {
4484
+ fullCols,
4485
+ groupCols
4486
+ };
4487
+ };
4488
+ const createChartRender = fullCols => {
4489
+ const {
4490
+ minViewDate
4491
+ } = reactData;
4492
+ const minScale = computeMinScale.value;
4493
+ const scaleUnit = computeScaleUnit.value;
4494
+ const weekScale = computeWeekScale.value;
4495
+ switch (scaleUnit) {
4496
+ case 'year':
4497
+ {
4498
+ const indexMaps = {};
4499
+ fullCols.forEach(({
4500
+ dateObj
4501
+ }, i) => {
4502
+ const yyyyMM = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy');
4503
+ indexMaps[yyyyMM] = i;
4504
+ });
4505
+ return (startValue, endValue) => {
4506
+ const startDate = parseStringDate(startValue);
4507
+ const endDate = parseStringDate(endValue);
4508
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy');
4509
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(startDate, 0, 'first');
4510
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy');
4511
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(endDate, 0, 'first');
4512
+ const dateSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
4513
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
4514
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
4515
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4516
+ return {
4517
+ offsetLeftSize,
4518
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4519
+ };
4520
+ };
4521
+ }
4522
+ case 'quarter':
4523
+ {
4524
+ const indexMaps = {};
4525
+ fullCols.forEach(({
4526
+ dateObj
4527
+ }, i) => {
4528
+ const q = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy-q');
4529
+ indexMaps[q] = i;
4530
+ });
4531
+ return (startValue, endValue) => {
4532
+ const startDate = parseStringDate(startValue);
4533
+ const endDate = parseStringDate(endValue);
4534
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy-q');
4535
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(startDate, 0, 'first');
4536
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy-q');
4537
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(endDate, 0, 'first');
4538
+ const dateSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
4539
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
4540
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
4541
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4542
+ return {
4543
+ offsetLeftSize,
4544
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4545
+ };
4546
+ };
4547
+ }
4548
+ case 'month':
4549
+ {
4550
+ const indexMaps = {};
4551
+ fullCols.forEach(({
4552
+ dateObj
4553
+ }, i) => {
4554
+ const yyyyMM = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy-MM');
4555
+ indexMaps[yyyyMM] = i;
4556
+ });
4557
+ return (startValue, endValue) => {
4558
+ const startDate = parseStringDate(startValue);
4559
+ const endDate = parseStringDate(endValue);
4560
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy-MM');
4561
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(startDate, 0, 'first');
4562
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy-MM');
4563
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(endDate, 0, 'first');
4564
+ const dateSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
4565
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
4566
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
4567
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4568
+ return {
4569
+ offsetLeftSize,
4570
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4571
+ };
4572
+ };
4573
+ }
4574
+ case 'week':
4575
+ {
4576
+ const indexMaps = {};
4577
+ fullCols.forEach(({
4578
+ dateObj
4579
+ }, i) => {
4580
+ const yyyyW = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy-W', {
4581
+ firstDay: weekScale ? weekScale.startDay : undefined
4582
+ });
4583
+ indexMaps[yyyyW] = i;
4584
+ });
4585
+ return (startValue, endValue) => {
4586
+ const startDate = parseStringDate(startValue);
4587
+ const endDate = parseStringDate(endValue);
4588
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy-W', {
4589
+ firstDay: weekScale ? weekScale.startDay : undefined
4590
+ });
4591
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
4592
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy-W', {
4593
+ firstDay: weekScale ? weekScale.startDay : undefined
4594
+ });
4595
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
4596
+ const dateSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs);
4597
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
4598
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
4599
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4600
+ return {
4601
+ offsetLeftSize,
4602
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4603
+ };
4604
+ };
4605
+ }
4606
+ case 'day':
4607
+ case 'date':
4608
+ {
4609
+ const indexMaps = {};
4610
+ fullCols.forEach(({
4611
+ dateObj
4612
+ }, i) => {
4613
+ const yyyyMM = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy-MM-dd');
4614
+ indexMaps[yyyyMM] = i;
4615
+ });
4616
+ return (startValue, endValue) => {
4617
+ const startDate = parseStringDate(startValue);
4618
+ const endDate = parseStringDate(endValue);
4619
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy-MM-dd');
4620
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(startDate, 0, 'first');
4621
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy-MM-dd');
4622
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(endDate, 0, 'first');
4623
+ const minuteSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
4624
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
4625
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
4626
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4627
+ return {
4628
+ offsetLeftSize,
4629
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4630
+ };
4631
+ };
4632
+ }
4633
+ case 'hour':
4634
+ {
4635
+ const indexMaps = {};
4636
+ fullCols.forEach(({
4637
+ dateObj
4638
+ }, i) => {
4639
+ const yyyyMM = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy-MM-dd HH');
4640
+ indexMaps[yyyyMM] = i;
4641
+ });
4642
+ return (startValue, endValue) => {
4643
+ const startDate = parseStringDate(startValue);
4644
+ const endDate = parseStringDate(endValue);
4645
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy-MM-dd HH');
4646
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatHours(startDate, 0, 'first');
4647
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy-MM-dd HH');
4648
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatHours(endDate, 0, 'first');
4649
+ const minuteSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatHours(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
4650
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
4651
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
4652
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4653
+ return {
4654
+ offsetLeftSize,
4655
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4656
+ };
4657
+ };
4658
+ }
4659
+ case 'minute':
4660
+ {
4661
+ const indexMaps = {};
4662
+ fullCols.forEach(({
4663
+ dateObj
4664
+ }, i) => {
4665
+ const yyyyMM = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(dateObj.date, 'yyyy-MM-dd HH:mm');
4666
+ indexMaps[yyyyMM] = i;
4667
+ });
4668
+ return (startValue, endValue) => {
4669
+ const startDate = parseStringDate(startValue);
4670
+ const endDate = parseStringDate(endValue);
4671
+ const startStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(startDate, 'yyyy-MM-dd HH:mm');
4672
+ const startFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMinutes(startDate, 0, 'first');
4673
+ const endStr = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(endDate, 'yyyy-MM-dd HH:mm');
4674
+ const endFirstDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMinutes(endDate, 0, 'first');
4675
+ const minuteSize = Math.floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMinutes(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
4676
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
4677
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
4678
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4679
+ return {
4680
+ offsetLeftSize,
4681
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4682
+ };
4683
+ };
4684
+ }
4685
+ case 'second':
4686
+ {
4687
+ const gapTime = getStandardGapTime(minScale.type);
4688
+ return (startValue, endValue) => {
4689
+ const startDate = parseStringDate(startValue);
4690
+ const endDate = parseStringDate(endValue);
4691
+ let offsetLeftSize = 0;
4692
+ let offsetWidthSize = 0;
4693
+ if (minViewDate) {
4694
+ offsetLeftSize = (startDate.getTime() - minViewDate.getTime()) / gapTime;
4695
+ offsetWidthSize = (endDate.getTime() - startDate.getTime()) / gapTime + 1;
4696
+ }
4697
+ return {
4698
+ offsetLeftSize,
4699
+ offsetWidthSize
4700
+ };
4701
+ };
4702
+ }
4703
+ }
4704
+ return () => {
4705
+ return {
4706
+ offsetLeftSize: 0,
4707
+ offsetWidthSize: 0
4708
+ };
4709
+ };
4710
+ };
4711
+ const handleParseColumn = () => {
4712
+ const ganttProps = $xeGantt.props;
4713
+ const {
4714
+ treeConfig
4715
+ } = ganttProps;
4716
+ const {
4717
+ minViewDate,
4718
+ maxViewDate
4719
+ } = reactData;
4720
+ const {
4721
+ fullCols,
4722
+ groupCols
4723
+ } = handleColumnHeader();
4724
+ if (minViewDate && maxViewDate && fullCols.length) {
4410
4725
  const $xeTable = internalData.xeTable;
4411
4726
  if ($xeTable) {
4412
4727
  const startField = computeStartField.value;
@@ -4432,20 +4747,21 @@ const maxYHeight = 5e6;
4432
4747
  } = treeOpts;
4433
4748
  const childrenField = treeOpts.children || treeOpts.childrenField;
4434
4749
  const ctMaps = {};
4750
+ const renderFn = createChartRender(fullCols);
4435
4751
  const handleParseRender = row => {
4436
4752
  const rowid = $xeTable.getRowid(row);
4437
4753
  const startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, startField);
4438
4754
  const endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, endField);
4439
4755
  if (startValue && endValue) {
4440
- const startDate = parseStringDate(startValue);
4441
- const endDate = parseStringDate(endValue);
4442
- const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / gapTime);
4443
- const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / gapTime) + 1;
4756
+ const {
4757
+ offsetLeftSize,
4758
+ offsetWidthSize
4759
+ } = renderFn(startValue, endValue);
4444
4760
  ctMaps[rowid] = {
4445
4761
  row,
4446
4762
  rowid,
4447
- oLeftSize,
4448
- oWidthSize
4763
+ oLeftSize: offsetLeftSize,
4764
+ oWidthSize: offsetWidthSize
4449
4765
  };
4450
4766
  }
4451
4767
  };
@@ -4734,13 +5050,13 @@ const maxYHeight = 5e6;
4734
5050
  rceRunTime
4735
5051
  } = internalData;
4736
5052
  const $xeTable = internalData.xeTable;
4737
- let refreshDelay = 50;
5053
+ let refreshDelay = 30;
4738
5054
  if ($xeTable) {
4739
5055
  const {
4740
5056
  computeResizeOpts
4741
5057
  } = $xeTable.getComputeMaps();
4742
5058
  const resizeOpts = computeResizeOpts.value;
4743
- refreshDelay = resizeOpts.refreshDelay || 50;
5059
+ refreshDelay = resizeOpts.refreshDelay || refreshDelay;
4744
5060
  }
4745
5061
  if (rceTimeout) {
4746
5062
  clearTimeout(rceTimeout);
@@ -5091,7 +5407,14 @@ const maxYHeight = 5e6;
5091
5407
  const ganttViewMethods = {
5092
5408
  refreshData() {
5093
5409
  handleUpdateData();
5094
- return handleLazyRecalculate();
5410
+ handleRecalculateStyle();
5411
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
5412
+ const $xeTable = internalData.xeTable;
5413
+ handleRecalculateStyle();
5414
+ if ($xeTable) {
5415
+ return $xeTable.recalculate();
5416
+ }
5417
+ });
5095
5418
  },
5096
5419
  updateViewData() {
5097
5420
  const $xeTable = internalData.xeTable;
@@ -5443,6 +5766,7 @@ var external_root_VxeUITable_commonjs_vxe_table_commonjs2_vxe_table_amd_vxe_tabl
5443
5766
 
5444
5767
 
5445
5768
 
5769
+
5446
5770
  const {
5447
5771
  getConfig,
5448
5772
  getIcon,
@@ -5492,7 +5816,7 @@ function getViewTypeLevel(type) {
5492
5816
  zoomConfig: Object,
5493
5817
  layouts: Array,
5494
5818
  taskConfig: Object,
5495
- taskViewScaleConfs: Object,
5819
+ taskViewScaleConfig: Object,
5496
5820
  taskViewConfig: Object,
5497
5821
  taskBarConfig: Object,
5498
5822
  taskSplitConfig: Object,
@@ -5602,8 +5926,8 @@ function getViewTypeLevel(type) {
5602
5926
  const computeTaskOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5603
5927
  return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig);
5604
5928
  });
5605
- const computeTaskViewScaleMapsOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5606
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge({}, getConfig().gantt.taskViewScaleConfs, props.taskViewScaleConfs);
5929
+ const computeTaskViewScaleOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5930
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge({}, getConfig().gantt.taskViewScaleConfig, props.taskViewScaleConfig);
5607
5931
  });
5608
5932
  const computeTaskViewOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5609
5933
  return Object.assign({}, getConfig().gantt.taskViewConfig, props.taskViewConfig);
@@ -5620,6 +5944,22 @@ function getViewTypeLevel(type) {
5620
5944
  const computeTaskSplitOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5621
5945
  return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
5622
5946
  });
5947
+ const computeScaleUnit = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5948
+ const minScale = computeMinScale.value;
5949
+ return minScale ? minScale.type : 'date';
5950
+ });
5951
+ const computeMinScale = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5952
+ const {
5953
+ taskScaleList
5954
+ } = reactData;
5955
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(taskScaleList);
5956
+ });
5957
+ const computeWeekScale = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5958
+ const {
5959
+ taskScaleList
5960
+ } = reactData;
5961
+ return taskScaleList.find(item => item.type === 'week');
5962
+ });
5623
5963
  const computeTaskScaleConfs = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5624
5964
  const taskViewOpts = computeTaskViewOpts.value;
5625
5965
  const {
@@ -5874,13 +6214,16 @@ function getViewTypeLevel(type) {
5874
6214
  computeToolbarOpts,
5875
6215
  computeZoomOpts,
5876
6216
  computeTaskOpts,
5877
- computeTaskViewScaleMapsOpts,
6217
+ computeTaskViewScaleOpts,
5878
6218
  computeTaskViewOpts,
5879
6219
  computeTaskBarOpts,
5880
6220
  computeTaskBarDragOpts,
5881
6221
  computeTaskBarResizeOpts,
5882
6222
  computeTaskSplitOpts,
5883
6223
  computeTaskScaleConfs,
6224
+ computeScaleUnit,
6225
+ computeMinScale,
6226
+ computeWeekScale,
5884
6227
  computeTitleField,
5885
6228
  computeStartField,
5886
6229
  computeEndField,
@@ -5900,7 +6243,7 @@ function getViewTypeLevel(type) {
5900
6243
  };
5901
6244
  const handleTaskScaleConfig = () => {
5902
6245
  const taskScaleConfs = computeTaskScaleConfs.value;
5903
- const taskViewScaleMapsOpts = computeTaskViewScaleMapsOpts.value;
6246
+ const taskViewScaleOpts = computeTaskViewScaleOpts.value;
5904
6247
  const scaleConfs = [];
5905
6248
  if (taskScaleConfs) {
5906
6249
  const keyMaps = {};
@@ -5920,7 +6263,7 @@ function getViewTypeLevel(type) {
5920
6263
  return;
5921
6264
  }
5922
6265
  keyMaps[type] = true;
5923
- scaleConfs.push(Object.assign({}, type ? taskViewScaleMapsOpts[type] || {} : {}, sConf, {
6266
+ scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
5924
6267
  level: getViewTypeLevel(type)
5925
6268
  }));
5926
6269
  });
@@ -7844,6 +8187,7 @@ function getViewTypeLevel(type) {
7844
8187
  });
7845
8188
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(computeTaskScaleConfs, () => {
7846
8189
  handleTaskScaleConfig();
8190
+ $xeGantt.refreshTaskView();
7847
8191
  });
7848
8192
  hooks.forEach(options => {
7849
8193
  const {