vxe-gantt 4.1.2 → 4.1.4

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.2"}`;
2783
+ const version = `gantt v${"4.1.4"}`;
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,9 @@ const {
2791
2791
  setIcon,
2792
2792
  checkVersion
2793
2793
  } = core_.VxeUI;
2794
- core_.VxeUI.ganttVersion = "4.1.2";
2794
+ core_.VxeUI.ganttVersion = "4.1.4";
2795
+ const ymdFormat = 'yyyy-MM-dd';
2796
+ const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
2795
2797
  setConfig({
2796
2798
  gantt: {
2797
2799
  // size: null,
@@ -2834,12 +2836,41 @@ setConfig({
2834
2836
  enterable: true
2835
2837
  },
2836
2838
  taskViewScaleConfig: {
2839
+ year: {
2840
+ valueFormat: ymdFormat
2841
+ },
2842
+ quarter: {
2843
+ valueFormat: ymdFormat
2844
+ },
2845
+ month: {
2846
+ valueFormat: ymdFormat
2847
+ },
2837
2848
  week: {
2838
- startDay: 1
2849
+ startDay: 1,
2850
+ valueFormat: ymdFormat
2851
+ },
2852
+ day: {
2853
+ valueFormat: ymdFormat
2854
+ },
2855
+ date: {
2856
+ valueFormat: ymdFormat
2857
+ },
2858
+ hour: {
2859
+ valueFormat: ymdhmsFormat
2860
+ },
2861
+ minute: {
2862
+ valueFormat: ymdhmsFormat
2863
+ },
2864
+ second: {
2865
+ valueFormat: ymdhmsFormat
2839
2866
  }
2840
2867
  },
2841
2868
  taskViewConfig: {
2842
- showNowLine: true
2869
+ showNowLine: true,
2870
+ gridding: {
2871
+ // leftSpacing: 0,
2872
+ // rightSpacing: 0
2873
+ }
2843
2874
  },
2844
2875
  taskSplitConfig: {
2845
2876
  enabled: true,
@@ -3511,6 +3542,9 @@ const gantt_chart_viewType = 'chart';
3511
3542
  setup() {
3512
3543
  const $xeGantt = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGantt', {});
3513
3544
  const $xeGanttView = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGanttView', {});
3545
+ const {
3546
+ internalData: ganttInternalData
3547
+ } = $xeGantt;
3514
3548
  const {
3515
3549
  reactData,
3516
3550
  internalData
@@ -3621,17 +3655,27 @@ const gantt_chart_viewType = 'chart';
3621
3655
  };
3622
3656
  if (showTooltip) {
3623
3657
  ons.onMouseover = evnt => {
3658
+ const {
3659
+ dragBarRow
3660
+ } = ganttInternalData;
3624
3661
  const ttParams = Object.assign({
3625
3662
  $event: evnt
3626
3663
  }, ctParams);
3627
- $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
3664
+ if (!dragBarRow) {
3665
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
3666
+ }
3628
3667
  $xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
3629
3668
  };
3630
3669
  ons.onMouseleave = evnt => {
3670
+ const {
3671
+ dragBarRow
3672
+ } = ganttInternalData;
3631
3673
  const ttParams = Object.assign({
3632
3674
  $event: evnt
3633
3675
  }, ctParams);
3634
- $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
3676
+ if (!dragBarRow) {
3677
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
3678
+ }
3635
3679
  $xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
3636
3680
  };
3637
3681
  }
@@ -4177,8 +4221,12 @@ const maxYHeight = 5e6;
4177
4221
  setup(props, context) {
4178
4222
  const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
4179
4223
  const $xeGantt = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGantt', {});
4224
+ const {
4225
+ internalData: ganttInternalData
4226
+ } = $xeGantt;
4180
4227
  const {
4181
4228
  computeTaskOpts,
4229
+ computeTaskViewOpts,
4182
4230
  computeStartField,
4183
4231
  computeEndField,
4184
4232
  computeScrollbarOpts,
@@ -4241,18 +4289,23 @@ const maxYHeight = 5e6;
4241
4289
  minViewDate,
4242
4290
  maxViewDate
4243
4291
  } = reactData;
4292
+ const taskViewOpts = computeTaskViewOpts.value;
4244
4293
  const minScale = computeMinScale.value;
4294
+ const {
4295
+ gridding
4296
+ } = taskViewOpts;
4245
4297
  const dateList = [];
4246
4298
  if (!minViewDate || !maxViewDate) {
4247
4299
  return dateList;
4248
4300
  }
4249
- const startTime = minViewDate.getTime();
4250
- 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);
4251
4303
  switch (minScale.type) {
4252
4304
  case 'year':
4253
4305
  {
4254
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(minViewDate, 0, 'first');
4255
- 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) {
4256
4309
  const itemDate = currDate;
4257
4310
  dateList.push(itemDate);
4258
4311
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatYear(currDate, 1);
@@ -4261,8 +4314,9 @@ const maxYHeight = 5e6;
4261
4314
  }
4262
4315
  case 'quarter':
4263
4316
  {
4264
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(minViewDate, 0, 'first');
4265
- 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) {
4266
4320
  const itemDate = currDate;
4267
4321
  dateList.push(itemDate);
4268
4322
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatQuarter(currDate, 1);
@@ -4271,8 +4325,9 @@ const maxYHeight = 5e6;
4271
4325
  }
4272
4326
  case 'month':
4273
4327
  {
4274
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(minViewDate, 0, 'first');
4275
- 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) {
4276
4331
  const itemDate = currDate;
4277
4332
  dateList.push(itemDate);
4278
4333
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatMonth(currDate, 1);
@@ -4281,8 +4336,9 @@ const maxYHeight = 5e6;
4281
4336
  }
4282
4337
  case 'week':
4283
4338
  {
4284
- let currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(minViewDate, 0, minScale.startDay, minScale.startDay);
4285
- 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) {
4286
4342
  const itemDate = currDate;
4287
4343
  dateList.push(itemDate);
4288
4344
  currDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatWeek(currDate, 1);
@@ -4291,12 +4347,23 @@ const maxYHeight = 5e6;
4291
4347
  }
4292
4348
  case 'day':
4293
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
+ }
4294
4360
  case 'hour':
4295
4361
  case 'minute':
4296
4362
  case 'second':
4297
4363
  {
4298
4364
  const gapTime = getStandardGapTime(minScale.type);
4299
- let currTime = startTime;
4365
+ let currTime = minViewDate.getTime() + leftSize * gapTime;
4366
+ const endTime = maxViewDate.getTime() + rightSize * gapTime;
4300
4367
  while (currTime <= endTime) {
4301
4368
  const itemDate = new Date(currTime);
4302
4369
  dateList.push(itemDate);
@@ -4405,21 +4472,29 @@ const maxYHeight = 5e6;
4405
4472
  };
4406
4473
  for (let i = 0; i < scaleDateList.length; i++) {
4407
4474
  const itemDate = scaleDateList[i];
4408
- 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('-');
4409
4476
  const e = itemDate.getDay();
4410
4477
  const E = e + 1;
4411
4478
  const q = Math.ceil((itemDate.getMonth() + 1) / 3);
4412
- 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');
4413
4481
  const dateObj = {
4414
4482
  date: itemDate,
4415
- yy: yyyy,
4416
- M: MM,
4417
- d: dd,
4418
- H: HH,
4419
- m: mm,
4420
- 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,
4421
4495
  q,
4422
4496
  W,
4497
+ WW,
4423
4498
  E,
4424
4499
  e
4425
4500
  };
@@ -4556,7 +4631,7 @@ const maxYHeight = 5e6;
4556
4631
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4557
4632
  return {
4558
4633
  offsetLeftSize,
4559
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4634
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4560
4635
  };
4561
4636
  };
4562
4637
  }
@@ -4582,7 +4657,7 @@ const maxYHeight = 5e6;
4582
4657
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4583
4658
  return {
4584
4659
  offsetLeftSize,
4585
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4660
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4586
4661
  };
4587
4662
  };
4588
4663
  }
@@ -4608,7 +4683,7 @@ const maxYHeight = 5e6;
4608
4683
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4609
4684
  return {
4610
4685
  offsetLeftSize,
4611
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4686
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4612
4687
  };
4613
4688
  };
4614
4689
  }
@@ -4640,7 +4715,7 @@ const maxYHeight = 5e6;
4640
4715
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4641
4716
  return {
4642
4717
  offsetLeftSize,
4643
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4718
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4644
4719
  };
4645
4720
  };
4646
4721
  }
@@ -4667,7 +4742,7 @@ const maxYHeight = 5e6;
4667
4742
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4668
4743
  return {
4669
4744
  offsetLeftSize,
4670
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4745
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4671
4746
  };
4672
4747
  };
4673
4748
  }
@@ -4693,7 +4768,7 @@ const maxYHeight = 5e6;
4693
4768
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4694
4769
  return {
4695
4770
  offsetLeftSize,
4696
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4771
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4697
4772
  };
4698
4773
  };
4699
4774
  }
@@ -4719,7 +4794,7 @@ const maxYHeight = 5e6;
4719
4794
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
4720
4795
  return {
4721
4796
  offsetLeftSize,
4722
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
4797
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
4723
4798
  };
4724
4799
  };
4725
4800
  }
@@ -4934,6 +5009,9 @@ const maxYHeight = 5e6;
4934
5009
  }
4935
5010
  };
4936
5011
  const updateChart = () => {
5012
+ const {
5013
+ dragBarRow
5014
+ } = ganttInternalData;
4937
5015
  const {
4938
5016
  viewCellWidth
4939
5017
  } = reactData;
@@ -4941,14 +5019,18 @@ const maxYHeight = 5e6;
4941
5019
  elemStore,
4942
5020
  chartMaps
4943
5021
  } = internalData;
5022
+ const $xeTable = internalData.xeTable;
4944
5023
  const chartWrapper = getRefElem(elemStore['main-chart-wrapper']);
4945
- if (chartWrapper) {
5024
+ if (chartWrapper && $xeTable) {
4946
5025
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(chartWrapper.children, rowEl => {
4947
5026
  const barEl = rowEl.children[0];
4948
5027
  if (!barEl) {
4949
5028
  return;
4950
5029
  }
4951
5030
  const rowid = rowEl.getAttribute('rowid');
5031
+ if (dragBarRow && $xeTable.getRowid(dragBarRow) === rowid) {
5032
+ return;
5033
+ }
4952
5034
  const rowRest = rowid ? chartMaps[rowid] : null;
4953
5035
  barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`;
4954
5036
  barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`;
@@ -5828,7 +5910,8 @@ function gantt_createInternalData() {
5828
5910
  return {
5829
5911
  uFoot: false,
5830
5912
  resizeTableWidth: 0
5831
- // barTipTimeout: undefined
5913
+ // barTipTimeout: null
5914
+ // dragBarRow: null
5832
5915
  };
5833
5916
  }
5834
5917
  const viewTypeLevelMaps = {
@@ -6257,6 +6340,7 @@ function getViewTypeLevel(type) {
6257
6340
  refForm,
6258
6341
  refToolbar,
6259
6342
  refPager,
6343
+ refGanttView,
6260
6344
  refGanttContainerElem,
6261
6345
  refClassifyWrapperElem,
6262
6346
  refPopupContainerElem
@@ -6301,38 +6385,28 @@ function getViewTypeLevel(type) {
6301
6385
  const taskScaleConfs = computeTaskViewScales.value;
6302
6386
  const taskViewScaleOpts = computeTaskViewScaleOpts.value;
6303
6387
  const scaleConfs = [];
6304
- if (taskScaleConfs) {
6305
- const keyMaps = {};
6306
- taskScaleConfs.forEach(conf => {
6307
- const sConf = !conf || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(conf) ? {
6308
- type: conf
6309
- } : conf;
6310
- const {
6311
- type
6312
- } = sConf;
6313
- if (!type || !viewTypeLevelMaps[type]) {
6314
- errLog('vxe.error.errProp', [`type=${type}`, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(viewTypeLevelMaps).join(',')]);
6315
- return;
6316
- }
6317
- if (keyMaps[type]) {
6318
- errLog('vxe.error.repeatProp', ['type', type]);
6319
- return;
6320
- }
6321
- keyMaps[type] = true;
6322
- scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
6323
- level: getViewTypeLevel(type)
6324
- }));
6325
- });
6326
- }
6327
- if (!scaleConfs.length) {
6328
- scaleConfs.push({
6329
- type: 'month',
6330
- level: viewTypeLevelMaps.month
6331
- }, {
6332
- type: 'date',
6333
- level: viewTypeLevelMaps.date
6334
- });
6335
- }
6388
+ const keyMaps = {};
6389
+ const scaleList = taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date'];
6390
+ scaleList.forEach(conf => {
6391
+ const sConf = !conf || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(conf) ? {
6392
+ type: conf
6393
+ } : conf;
6394
+ const {
6395
+ type
6396
+ } = sConf;
6397
+ if (!type || !viewTypeLevelMaps[type]) {
6398
+ errLog('vxe.error.errProp', [`type=${type}`, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(viewTypeLevelMaps).join(',')]);
6399
+ return;
6400
+ }
6401
+ if (keyMaps[type]) {
6402
+ errLog('vxe.error.repeatProp', ['type', type]);
6403
+ return;
6404
+ }
6405
+ keyMaps[type] = true;
6406
+ scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
6407
+ level: getViewTypeLevel(type)
6408
+ }));
6409
+ });
6336
6410
  reactData.taskScaleList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().orderBy(scaleConfs, {
6337
6411
  field: 'level',
6338
6412
  order: 'desc'