vxe-gantt 4.1.3 → 4.1.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
@@ -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.1.3"}`;
2783
+ const version = `gantt v${"4.1.5"}`;
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.1.3";
2794
+ core_.VxeUI.ganttVersion = "4.1.5";
2795
2795
  const ymdFormat = 'yyyy-MM-dd';
2796
2796
  const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
2797
2797
  setConfig({
@@ -2866,7 +2866,11 @@ setConfig({
2866
2866
  }
2867
2867
  },
2868
2868
  taskViewConfig: {
2869
- showNowLine: true
2869
+ showNowLine: true,
2870
+ gridding: {
2871
+ // leftSpacing: 0,
2872
+ // rightSpacing: 0
2873
+ }
2870
2874
  },
2871
2875
  taskSplitConfig: {
2872
2876
  enabled: true,
@@ -3475,7 +3479,7 @@ const viewType = 'header';
3475
3479
  let cellStys = {};
3476
3480
  if (headerCellStyle) {
3477
3481
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(headerCellStyle)) {
3478
- cellStys = headerCellStyle(ctParams);
3482
+ cellStys = headerCellStyle(ctParams) || null;
3479
3483
  } else {
3480
3484
  cellStys = headerCellStyle;
3481
3485
  }
@@ -3487,7 +3491,7 @@ const viewType = 'header';
3487
3491
  }],
3488
3492
  colspan: childCount || null,
3489
3493
  title: titleSlot ? null : label,
3490
- style: cellStys,
3494
+ style: cellStys || undefined,
3491
3495
  onContextmenu(evnt) {
3492
3496
  $xeGantt.handleTaskHeaderContextmenuEvent(evnt, ctParams);
3493
3497
  }
@@ -3538,6 +3542,9 @@ const gantt_chart_viewType = 'chart';
3538
3542
  setup() {
3539
3543
  const $xeGantt = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGantt', {});
3540
3544
  const $xeGanttView = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGanttView', {});
3545
+ const {
3546
+ internalData: ganttInternalData
3547
+ } = $xeGantt;
3541
3548
  const {
3542
3549
  reactData,
3543
3550
  internalData
@@ -3648,17 +3655,27 @@ const gantt_chart_viewType = 'chart';
3648
3655
  };
3649
3656
  if (showTooltip) {
3650
3657
  ons.onMouseover = evnt => {
3658
+ const {
3659
+ dragBarRow
3660
+ } = ganttInternalData;
3651
3661
  const ttParams = Object.assign({
3652
3662
  $event: evnt
3653
3663
  }, ctParams);
3654
- $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
3664
+ if (!dragBarRow) {
3665
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
3666
+ }
3655
3667
  $xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
3656
3668
  };
3657
3669
  ons.onMouseleave = evnt => {
3670
+ const {
3671
+ dragBarRow
3672
+ } = ganttInternalData;
3658
3673
  const ttParams = Object.assign({
3659
3674
  $event: evnt
3660
3675
  }, ctParams);
3661
- $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
3676
+ if (!dragBarRow) {
3677
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
3678
+ }
3662
3679
  $xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
3663
3680
  };
3664
3681
  }
@@ -4021,7 +4038,7 @@ const gantt_body_viewType = 'body';
4021
4038
  'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
4022
4039
  }, getClass(rowClassName, rowParams)],
4023
4040
  rowid,
4024
- style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(rowParams) : rowStyle : undefined,
4041
+ style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(rowParams) || undefined : rowStyle : undefined,
4025
4042
  ...trOns
4026
4043
  }, tableColumn.map((column, $columnIndex) => renderColumn($xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex))));
4027
4044
  let isExpandTree = false;
@@ -4204,8 +4221,12 @@ const maxYHeight = 5e6;
4204
4221
  setup(props, context) {
4205
4222
  const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
4206
4223
  const $xeGantt = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGantt', {});
4224
+ const {
4225
+ internalData: ganttInternalData
4226
+ } = $xeGantt;
4207
4227
  const {
4208
4228
  computeTaskOpts,
4229
+ computeTaskViewOpts,
4209
4230
  computeStartField,
4210
4231
  computeEndField,
4211
4232
  computeScrollbarOpts,
@@ -4268,18 +4289,23 @@ const maxYHeight = 5e6;
4268
4289
  minViewDate,
4269
4290
  maxViewDate
4270
4291
  } = reactData;
4292
+ const taskViewOpts = computeTaskViewOpts.value;
4271
4293
  const minScale = computeMinScale.value;
4294
+ const {
4295
+ gridding
4296
+ } = taskViewOpts;
4272
4297
  const dateList = [];
4273
4298
  if (!minViewDate || !maxViewDate) {
4274
4299
  return dateList;
4275
4300
  }
4276
- const startTime = minViewDate.getTime();
4277
- const endTime = maxViewDate.getTime();
4301
+ const leftSize = -external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(gridding ? gridding.leftSpacing || 0 : 0);
4302
+ const rightSize = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(gridding ? gridding.rightSpacing || 0 : 0);
4278
4303
  switch (minScale.type) {
4279
4304
  case 'year':
4280
4305
  {
4281
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(minViewDate, 0, 'first');
4282
- while (currDate <= maxViewDate) {
4306
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(minViewDate, leftSize, 'first');
4307
+ const endDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(maxViewDate, rightSize, 'first');
4308
+ while (currDate <= endDate) {
4283
4309
  const itemDate = currDate;
4284
4310
  dateList.push(itemDate);
4285
4311
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(currDate, 1);
@@ -4288,8 +4314,9 @@ const maxYHeight = 5e6;
4288
4314
  }
4289
4315
  case 'quarter':
4290
4316
  {
4291
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(minViewDate, 0, 'first');
4292
- while (currDate <= maxViewDate) {
4317
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(minViewDate, leftSize, 'first');
4318
+ const endDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(maxViewDate, rightSize, 'first');
4319
+ while (currDate <= endDate) {
4293
4320
  const itemDate = currDate;
4294
4321
  dateList.push(itemDate);
4295
4322
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(currDate, 1);
@@ -4298,8 +4325,9 @@ const maxYHeight = 5e6;
4298
4325
  }
4299
4326
  case 'month':
4300
4327
  {
4301
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(minViewDate, 0, 'first');
4302
- while (currDate <= maxViewDate) {
4328
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(minViewDate, leftSize, 'first');
4329
+ const endDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(maxViewDate, rightSize, 'first');
4330
+ while (currDate <= endDate) {
4303
4331
  const itemDate = currDate;
4304
4332
  dateList.push(itemDate);
4305
4333
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(currDate, 1);
@@ -4308,8 +4336,9 @@ const maxYHeight = 5e6;
4308
4336
  }
4309
4337
  case 'week':
4310
4338
  {
4311
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(minViewDate, 0, minScale.startDay, minScale.startDay);
4312
- while (currDate <= maxViewDate) {
4339
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay);
4340
+ const endDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay);
4341
+ while (currDate <= endDate) {
4313
4342
  const itemDate = currDate;
4314
4343
  dateList.push(itemDate);
4315
4344
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(currDate, 1);
@@ -4318,12 +4347,23 @@ const maxYHeight = 5e6;
4318
4347
  }
4319
4348
  case 'day':
4320
4349
  case 'date':
4350
+ {
4351
+ let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(minViewDate, leftSize, 'first');
4352
+ const endDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(maxViewDate, rightSize, 'first');
4353
+ while (currDate <= endDate) {
4354
+ const itemDate = currDate;
4355
+ dateList.push(itemDate);
4356
+ currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(currDate, 1);
4357
+ }
4358
+ break;
4359
+ }
4321
4360
  case 'hour':
4322
4361
  case 'minute':
4323
4362
  case 'second':
4324
4363
  {
4325
4364
  const gapTime = getStandardGapTime(minScale.type);
4326
- let currTime = startTime;
4365
+ let currTime = minViewDate.getTime() + leftSize * gapTime;
4366
+ const endTime = maxViewDate.getTime() + rightSize * gapTime;
4327
4367
  while (currTime <= endTime) {
4328
4368
  const itemDate = new Date(currTime);
4329
4369
  dateList.push(itemDate);
@@ -4432,21 +4472,29 @@ const maxYHeight = 5e6;
4432
4472
  };
4433
4473
  for (let i = 0; i < scaleDateList.length; i++) {
4434
4474
  const itemDate = scaleDateList[i];
4435
- 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('-');
4475
+ const [yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(itemDate, 'yy-yyyy-M-MM-d-dd-H-HH-m-mm-s-ss').split('-');
4436
4476
  const e = itemDate.getDay();
4437
4477
  const E = e + 1;
4438
4478
  const q = Math.ceil((itemDate.getMonth() + 1) / 3);
4439
- const W = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined);
4479
+ const W = `${external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`;
4480
+ const WW = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().padStart(W, 2, '0');
4440
4481
  const dateObj = {
4441
4482
  date: itemDate,
4442
- yy: yyyy,
4443
- M: MM,
4444
- d: dd,
4445
- H: HH,
4446
- m: mm,
4447
- s: ss,
4483
+ yy,
4484
+ yyyy,
4485
+ M,
4486
+ MM,
4487
+ d,
4488
+ dd,
4489
+ H,
4490
+ HH,
4491
+ m,
4492
+ mm,
4493
+ s,
4494
+ ss,
4448
4495
  q,
4449
4496
  W,
4497
+ WW,
4450
4498
  E,
4451
4499
  e
4452
4500
  };
@@ -4583,7 +4631,7 @@ const maxYHeight = 5e6;
4583
4631
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4584
4632
  return {
4585
4633
  offsetLeftSize,
4586
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4634
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4587
4635
  };
4588
4636
  };
4589
4637
  }
@@ -4609,7 +4657,7 @@ const maxYHeight = 5e6;
4609
4657
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4610
4658
  return {
4611
4659
  offsetLeftSize,
4612
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4660
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4613
4661
  };
4614
4662
  };
4615
4663
  }
@@ -4635,7 +4683,7 @@ const maxYHeight = 5e6;
4635
4683
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4636
4684
  return {
4637
4685
  offsetLeftSize,
4638
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4686
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4639
4687
  };
4640
4688
  };
4641
4689
  }
@@ -4667,7 +4715,7 @@ const maxYHeight = 5e6;
4667
4715
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4668
4716
  return {
4669
4717
  offsetLeftSize,
4670
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4718
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4671
4719
  };
4672
4720
  };
4673
4721
  }
@@ -4694,7 +4742,7 @@ const maxYHeight = 5e6;
4694
4742
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4695
4743
  return {
4696
4744
  offsetLeftSize,
4697
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4745
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4698
4746
  };
4699
4747
  };
4700
4748
  }
@@ -4720,7 +4768,7 @@ const maxYHeight = 5e6;
4720
4768
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4721
4769
  return {
4722
4770
  offsetLeftSize,
4723
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4771
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4724
4772
  };
4725
4773
  };
4726
4774
  }
@@ -4746,7 +4794,7 @@ const maxYHeight = 5e6;
4746
4794
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4747
4795
  return {
4748
4796
  offsetLeftSize,
4749
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4797
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4750
4798
  };
4751
4799
  };
4752
4800
  }
@@ -4961,6 +5009,9 @@ const maxYHeight = 5e6;
4961
5009
  }
4962
5010
  };
4963
5011
  const updateChart = () => {
5012
+ const {
5013
+ dragBarRow
5014
+ } = ganttInternalData;
4964
5015
  const {
4965
5016
  viewCellWidth
4966
5017
  } = reactData;
@@ -4968,14 +5019,18 @@ const maxYHeight = 5e6;
4968
5019
  elemStore,
4969
5020
  chartMaps
4970
5021
  } = internalData;
5022
+ const $xeTable = internalData.xeTable;
4971
5023
  const chartWrapper = getRefElem(elemStore['main-chart-wrapper']);
4972
- if (chartWrapper) {
5024
+ if (chartWrapper && $xeTable) {
4973
5025
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(chartWrapper.children, rowEl => {
4974
5026
  const barEl = rowEl.children[0];
4975
5027
  if (!barEl) {
4976
5028
  return;
4977
5029
  }
4978
5030
  const rowid = rowEl.getAttribute('rowid');
5031
+ if (dragBarRow && $xeTable.getRowid(dragBarRow) === rowid) {
5032
+ return;
5033
+ }
4979
5034
  const rowRest = rowid ? chartMaps[rowid] : null;
4980
5035
  barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`;
4981
5036
  barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`;
@@ -5855,7 +5910,8 @@ function gantt_createInternalData() {
5855
5910
  return {
5856
5911
  uFoot: false,
5857
5912
  resizeTableWidth: 0
5858
- // barTipTimeout: undefined
5913
+ // barTipTimeout: null
5914
+ // dragBarRow: null
5859
5915
  };
5860
5916
  }
5861
5917
  const viewTypeLevelMaps = {