vxe-gantt 4.3.17 → 4.3.19

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.
@@ -102,11 +102,11 @@ export default defineVxeComponent({
102
102
  const taskViewOpts = computeTaskViewOpts.value;
103
103
  const minScale = computeMinScale.value;
104
104
  const { gridding } = taskViewOpts;
105
- const { type, startDay } = minScale;
106
105
  const dateList = [];
107
- if (!minViewDate || !maxViewDate) {
106
+ if (!minScale || !minViewDate || !maxViewDate) {
108
107
  return dateList;
109
108
  }
109
+ const { type, startDay } = minScale;
110
110
  const leftSize = -(ganttReactData.currLeftSpacing + XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0));
111
111
  const rightSize = ganttReactData.currRightSpacing + XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0);
112
112
  const currStep = 1; // XEUtils.toNumber(step || 1) || 1
@@ -242,31 +242,33 @@ export default defineVxeComponent({
242
242
  const ganttReactData = $xeGantt.reactData;
243
243
  const { taskScaleList } = ganttReactData;
244
244
  const minScale = computeMinScale.value;
245
- const weekScale = taskScaleList.find(item => item.type === 'week');
246
- const isMinWeek = minScale.type === 'week';
247
- const itemDate = new Date();
248
- let [yyyy, M, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-MM-dd-HH-mm-ss').split('-');
249
- const e = itemDate.getDay();
250
- const E = e + 1;
251
- const q = Math.ceil((itemDate.getMonth() + 1) / 3);
252
- const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`;
253
- if (isMinWeek && checkWeekOfsetYear(W, M)) {
254
- yyyy = `${Number(yyyy) + 1}`;
255
- M = '1';
256
- MM = '0' + M;
245
+ if (minScale) {
246
+ const weekScale = taskScaleList.find(item => item.type === 'week');
247
+ const isMinWeek = minScale.type === 'week';
248
+ const itemDate = new Date();
249
+ let [yyyy, M, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-MM-dd-HH-mm-ss').split('-');
250
+ const e = itemDate.getDay();
251
+ const E = e + 1;
252
+ const q = Math.ceil((itemDate.getMonth() + 1) / 3);
253
+ const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`;
254
+ if (isMinWeek && checkWeekOfsetYear(W, M)) {
255
+ yyyy = `${Number(yyyy) + 1}`;
256
+ M = '1';
257
+ MM = '0' + M;
258
+ }
259
+ ganttReactData.nowTime = itemDate.getTime();
260
+ internalData.todayDateMaps = {
261
+ year: yyyy,
262
+ quarter: `${yyyy}_q${q}`,
263
+ month: `${yyyy}_${MM}`,
264
+ week: `${yyyy}_W${W}`,
265
+ day: `${yyyy}_${MM}_${dd}_E${E}`,
266
+ date: `${yyyy}_${MM}_${dd}`,
267
+ hour: `${yyyy}_${MM}_${dd}_${HH}`,
268
+ minute: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
269
+ second: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`
270
+ };
257
271
  }
258
- ganttReactData.nowTime = itemDate.getTime();
259
- internalData.todayDateMaps = {
260
- year: yyyy,
261
- quarter: `${yyyy}_q${q}`,
262
- month: `${yyyy}_${MM}`,
263
- week: `${yyyy}_W${W}`,
264
- day: `${yyyy}_${MM}_${dd}_E${E}`,
265
- date: `${yyyy}_${MM}_${dd}`,
266
- hour: `${yyyy}_${MM}_${dd}_${HH}`,
267
- minute: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
268
- second: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`
269
- };
270
272
  };
271
273
  const handleColumnHeader = () => {
272
274
  const ganttReactData = $xeGantt.reactData;
@@ -466,188 +468,190 @@ export default defineVxeComponent({
466
468
  const minScale = computeMinScale.value;
467
469
  const scaleUnit = computeScaleUnit.value;
468
470
  const weekScale = computeWeekScale.value;
469
- switch (scaleUnit) {
470
- case 'year': {
471
- const indexMaps = {};
472
- fullCols.forEach(({ dateObj }, i) => {
473
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy');
474
- indexMaps[yyyyMM] = i;
475
- });
476
- return (startValue, endValue) => {
477
- const startDate = parseStringDate(startValue);
478
- const endDate = parseStringDate(endValue);
479
- const startStr = XEUtils.toDateString(startDate, 'yyyy');
480
- const startFirstDate = XEUtils.getWhatYear(startDate, 0, 'first');
481
- const endStr = XEUtils.toDateString(endDate, 'yyyy');
482
- const endFirstDate = XEUtils.getWhatYear(endDate, 0, 'first');
483
- const dateSize = Math.floor((XEUtils.getWhatYear(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
484
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
485
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
486
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
487
- return {
488
- offsetLeftSize,
489
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
471
+ if (minScale) {
472
+ switch (scaleUnit) {
473
+ case 'year': {
474
+ const indexMaps = {};
475
+ fullCols.forEach(({ dateObj }, i) => {
476
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy');
477
+ indexMaps[yyyyMM] = i;
478
+ });
479
+ return (startValue, endValue) => {
480
+ const startDate = parseStringDate(startValue);
481
+ const endDate = parseStringDate(endValue);
482
+ const startStr = XEUtils.toDateString(startDate, 'yyyy');
483
+ const startFirstDate = XEUtils.getWhatYear(startDate, 0, 'first');
484
+ const endStr = XEUtils.toDateString(endDate, 'yyyy');
485
+ const endFirstDate = XEUtils.getWhatYear(endDate, 0, 'first');
486
+ const dateSize = Math.floor((XEUtils.getWhatYear(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
487
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
488
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
489
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
490
+ return {
491
+ offsetLeftSize,
492
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
493
+ };
490
494
  };
491
- };
492
- }
493
- case 'quarter': {
494
- const indexMaps = {};
495
- fullCols.forEach(({ dateObj }, i) => {
496
- const q = XEUtils.toDateString(dateObj.date, 'yyyy-q');
497
- indexMaps[q] = i;
498
- });
499
- return (startValue, endValue) => {
500
- const startDate = parseStringDate(startValue);
501
- const endDate = parseStringDate(endValue);
502
- const startStr = XEUtils.toDateString(startDate, 'yyyy-q');
503
- const startFirstDate = XEUtils.getWhatQuarter(startDate, 0, 'first');
504
- const endStr = XEUtils.toDateString(endDate, 'yyyy-q');
505
- const endFirstDate = XEUtils.getWhatQuarter(endDate, 0, 'first');
506
- const dateSize = Math.floor((XEUtils.getWhatQuarter(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
507
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
508
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
509
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
510
- return {
511
- offsetLeftSize,
512
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
495
+ }
496
+ case 'quarter': {
497
+ const indexMaps = {};
498
+ fullCols.forEach(({ dateObj }, i) => {
499
+ const q = XEUtils.toDateString(dateObj.date, 'yyyy-q');
500
+ indexMaps[q] = i;
501
+ });
502
+ return (startValue, endValue) => {
503
+ const startDate = parseStringDate(startValue);
504
+ const endDate = parseStringDate(endValue);
505
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-q');
506
+ const startFirstDate = XEUtils.getWhatQuarter(startDate, 0, 'first');
507
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-q');
508
+ const endFirstDate = XEUtils.getWhatQuarter(endDate, 0, 'first');
509
+ const dateSize = Math.floor((XEUtils.getWhatQuarter(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
510
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
511
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
512
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
513
+ return {
514
+ offsetLeftSize,
515
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
516
+ };
513
517
  };
514
- };
515
- }
516
- case 'month': {
517
- const indexMaps = {};
518
- fullCols.forEach(({ dateObj }, i) => {
519
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM');
520
- indexMaps[yyyyMM] = i;
521
- });
522
- return (startValue, endValue) => {
523
- const startDate = parseStringDate(startValue);
524
- const endDate = parseStringDate(endValue);
525
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM');
526
- const startFirstDate = XEUtils.getWhatMonth(startDate, 0, 'first');
527
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM');
528
- const endFirstDate = XEUtils.getWhatMonth(endDate, 0, 'first');
529
- const dateSize = Math.floor((XEUtils.getWhatMonth(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
530
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
531
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
532
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
533
- return {
534
- offsetLeftSize,
535
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
518
+ }
519
+ case 'month': {
520
+ const indexMaps = {};
521
+ fullCols.forEach(({ dateObj }, i) => {
522
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM');
523
+ indexMaps[yyyyMM] = i;
524
+ });
525
+ return (startValue, endValue) => {
526
+ const startDate = parseStringDate(startValue);
527
+ const endDate = parseStringDate(endValue);
528
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM');
529
+ const startFirstDate = XEUtils.getWhatMonth(startDate, 0, 'first');
530
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM');
531
+ const endFirstDate = XEUtils.getWhatMonth(endDate, 0, 'first');
532
+ const dateSize = Math.floor((XEUtils.getWhatMonth(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
533
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
534
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
535
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
536
+ return {
537
+ offsetLeftSize,
538
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
539
+ };
536
540
  };
537
- };
538
- }
539
- case 'week': {
540
- const indexMaps = {};
541
- fullCols.forEach(({ dateObj }, i) => {
542
- const yyyyW = `${dateObj.yyyy}-${dateObj.W}`;
543
- indexMaps[yyyyW] = i;
544
- });
545
- return (startValue, endValue) => {
546
- const startDate = parseStringDate(startValue);
547
- const endDate = parseStringDate(endValue);
548
- const startWeekObj = parseWeekObj(startDate, weekScale ? weekScale.startDay : undefined);
549
- const startStr = `${startWeekObj.yyyy}-${startWeekObj.W}`;
550
- const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
551
- const endWeekObj = parseWeekObj(endDate, weekScale ? weekScale.startDay : undefined);
552
- const endStr = `${endWeekObj.yyyy}-${endWeekObj.W}`;
553
- const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
554
- const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs);
555
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
556
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
557
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
558
- return {
559
- offsetLeftSize,
560
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
541
+ }
542
+ case 'week': {
543
+ const indexMaps = {};
544
+ fullCols.forEach(({ dateObj }, i) => {
545
+ const yyyyW = `${dateObj.yyyy}-${dateObj.W}`;
546
+ indexMaps[yyyyW] = i;
547
+ });
548
+ return (startValue, endValue) => {
549
+ const startDate = parseStringDate(startValue);
550
+ const endDate = parseStringDate(endValue);
551
+ const startWeekObj = parseWeekObj(startDate, weekScale ? weekScale.startDay : undefined);
552
+ const startStr = `${startWeekObj.yyyy}-${startWeekObj.W}`;
553
+ const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
554
+ const endWeekObj = parseWeekObj(endDate, weekScale ? weekScale.startDay : undefined);
555
+ const endStr = `${endWeekObj.yyyy}-${endWeekObj.W}`;
556
+ const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
557
+ const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs);
558
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
559
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
560
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
561
+ return {
562
+ offsetLeftSize,
563
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
564
+ };
561
565
  };
562
- };
563
- }
564
- case 'day':
565
- case 'date': {
566
- const indexMaps = {};
567
- fullCols.forEach(({ dateObj }, i) => {
568
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd');
569
- indexMaps[yyyyMM] = i;
570
- });
571
- return (startValue, endValue) => {
572
- const startDate = parseStringDate(startValue);
573
- const endDate = parseStringDate(endValue);
574
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd');
575
- const startFirstDate = XEUtils.getWhatDay(startDate, 0, 'first');
576
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd');
577
- const endFirstDate = XEUtils.getWhatDay(endDate, 0, 'first');
578
- const minuteSize = Math.floor((XEUtils.getWhatDay(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
579
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
580
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
581
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
582
- // 如果最小轴为天,当存在时分秒时,在当前单元格内渲染维度;如果不存在,则填充满单元格
583
- return {
584
- offsetLeftSize,
585
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + (subtract ? 0 : 1)
566
+ }
567
+ case 'day':
568
+ case 'date': {
569
+ const indexMaps = {};
570
+ fullCols.forEach(({ dateObj }, i) => {
571
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd');
572
+ indexMaps[yyyyMM] = i;
573
+ });
574
+ return (startValue, endValue) => {
575
+ const startDate = parseStringDate(startValue);
576
+ const endDate = parseStringDate(endValue);
577
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd');
578
+ const startFirstDate = XEUtils.getWhatDay(startDate, 0, 'first');
579
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd');
580
+ const endFirstDate = XEUtils.getWhatDay(endDate, 0, 'first');
581
+ const minuteSize = Math.floor((XEUtils.getWhatDay(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
582
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
583
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
584
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
585
+ // 如果最小轴为天,当存在时分秒时,在当前单元格内渲染维度;如果不存在,则填充满单元格
586
+ return {
587
+ offsetLeftSize,
588
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + (subtract ? 0 : 1)
589
+ };
586
590
  };
587
- };
588
- }
589
- case 'hour': {
590
- const indexMaps = {};
591
- fullCols.forEach(({ dateObj }, i) => {
592
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH');
593
- indexMaps[yyyyMM] = i;
594
- });
595
- return (startValue, endValue) => {
596
- const startDate = parseStringDate(startValue);
597
- const endDate = parseStringDate(endValue);
598
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH');
599
- const startFirstDate = XEUtils.getWhatHours(startDate, 0, 'first');
600
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH');
601
- const endFirstDate = XEUtils.getWhatHours(endDate, 0, 'first');
602
- const minuteSize = Math.floor((XEUtils.getWhatHours(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
603
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
604
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
605
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
606
- return {
607
- offsetLeftSize,
608
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
591
+ }
592
+ case 'hour': {
593
+ const indexMaps = {};
594
+ fullCols.forEach(({ dateObj }, i) => {
595
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH');
596
+ indexMaps[yyyyMM] = i;
597
+ });
598
+ return (startValue, endValue) => {
599
+ const startDate = parseStringDate(startValue);
600
+ const endDate = parseStringDate(endValue);
601
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH');
602
+ const startFirstDate = XEUtils.getWhatHours(startDate, 0, 'first');
603
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH');
604
+ const endFirstDate = XEUtils.getWhatHours(endDate, 0, 'first');
605
+ const minuteSize = Math.floor((XEUtils.getWhatHours(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
606
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
607
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
608
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
609
+ return {
610
+ offsetLeftSize,
611
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
612
+ };
609
613
  };
610
- };
611
- }
612
- case 'minute': {
613
- const indexMaps = {};
614
- fullCols.forEach(({ dateObj }, i) => {
615
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH:mm');
616
- indexMaps[yyyyMM] = i;
617
- });
618
- return (startValue, endValue) => {
619
- const startDate = parseStringDate(startValue);
620
- const endDate = parseStringDate(endValue);
621
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH:mm');
622
- const startFirstDate = XEUtils.getWhatMinutes(startDate, 0, 'first');
623
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH:mm');
624
- const endFirstDate = XEUtils.getWhatMinutes(endDate, 0, 'first');
625
- const minuteSize = Math.floor((XEUtils.getWhatMinutes(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
626
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
627
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
628
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
629
- return {
630
- offsetLeftSize,
631
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
614
+ }
615
+ case 'minute': {
616
+ const indexMaps = {};
617
+ fullCols.forEach(({ dateObj }, i) => {
618
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH:mm');
619
+ indexMaps[yyyyMM] = i;
620
+ });
621
+ return (startValue, endValue) => {
622
+ const startDate = parseStringDate(startValue);
623
+ const endDate = parseStringDate(endValue);
624
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH:mm');
625
+ const startFirstDate = XEUtils.getWhatMinutes(startDate, 0, 'first');
626
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH:mm');
627
+ const endFirstDate = XEUtils.getWhatMinutes(endDate, 0, 'first');
628
+ const minuteSize = Math.floor((XEUtils.getWhatMinutes(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
629
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
630
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
631
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
632
+ return {
633
+ offsetLeftSize,
634
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
635
+ };
632
636
  };
633
- };
634
- }
635
- case 'second': {
636
- const gapTime = getStandardGapTime(minScale.type);
637
- return (startValue, endValue) => {
638
- const startDate = parseStringDate(startValue);
639
- const endDate = parseStringDate(endValue);
640
- let offsetLeftSize = 0;
641
- let offsetWidthSize = 0;
642
- if (minViewDate) {
643
- offsetLeftSize = (startDate.getTime() - minViewDate.getTime()) / gapTime;
644
- offsetWidthSize = ((endDate.getTime() - startDate.getTime()) / gapTime);
645
- }
646
- return {
647
- offsetLeftSize,
648
- offsetWidthSize
637
+ }
638
+ case 'second': {
639
+ const gapTime = getStandardGapTime(minScale.type);
640
+ return (startValue, endValue) => {
641
+ const startDate = parseStringDate(startValue);
642
+ const endDate = parseStringDate(endValue);
643
+ let offsetLeftSize = 0;
644
+ let offsetWidthSize = 0;
645
+ if (minViewDate) {
646
+ offsetLeftSize = (startDate.getTime() - minViewDate.getTime()) / gapTime;
647
+ offsetWidthSize = ((endDate.getTime() - startDate.getTime()) / gapTime);
648
+ }
649
+ return {
650
+ offsetLeftSize,
651
+ offsetWidthSize
652
+ };
649
653
  };
650
- };
654
+ }
651
655
  }
652
656
  }
653
657
  return () => {
@@ -500,7 +500,9 @@ export default defineVxeComponent({
500
500
  const scaleList = (taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date']);
501
501
  scaleList.forEach(conf => {
502
502
  const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf;
503
- const { type, step } = sConf;
503
+ const type = sConf.type;
504
+ const step = sConf.step;
505
+ const level = getViewTypeLevel(type);
504
506
  if (step) {
505
507
  errLog('vxe.error.errProp', [`step=${step}`, 'step=1']);
506
508
  }
@@ -512,10 +514,9 @@ export default defineVxeComponent({
512
514
  errLog('vxe.error.repeatProp', ['type', type]);
513
515
  return;
514
516
  }
517
+ const scaleObj = Object.assign({}, type ? (taskViewScaleOpts[type] || {}) : {}, sConf, { level });
515
518
  keyMaps[type] = true;
516
- scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
517
- level: getViewTypeLevel(type)
518
- }));
519
+ scaleConfs.push(scaleObj);
519
520
  });
520
521
  reactData.taskScaleList = XEUtils.orderBy(scaleConfs, { field: 'level', order: 'desc' });
521
522
  };
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { setConfig, setIcon } = VxeUI;
3
- VxeUI.ganttVersion = "4.3.17";
3
+ VxeUI.ganttVersion = "4.3.19";
4
4
  const ymdFormat = 'yyyy-MM-dd';
5
5
  const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
6
6
  setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `gantt v${"4.3.17"}`;
3
+ const version = `gantt v${"4.3.19"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);