vxe-gantt 3.5.3 → 3.6.0-beta.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.
@@ -306,18 +306,28 @@ function parseWeekObj(date, firstDay) {
306
306
  function createChartRender($xeGanttView, fullCols) {
307
307
  const $xeGantt = $xeGanttView.$xeGantt;
308
308
  const minScale = $xeGantt.computeMinScale;
309
+ const scaleStep = $xeGantt.computeScaleStep;
309
310
  const scaleUnit = $xeGantt.computeScaleUnit;
310
311
  const weekScale = $xeGantt.computeWeekScale;
311
312
  const dateFormat = $xeGantt.computeDateFormat;
312
313
  if (minScale) {
314
+ const currRatio = scaleStep > 1 ? 1 / scaleStep : 0;
313
315
  switch (scaleUnit) {
314
316
  case 'year': {
315
- const showActualProgress = /M|d|H|mm|ss|S/.test(dateFormat);
317
+ const showActualProgress = /M|d|H|m|s|S/.test(dateFormat);
316
318
  const renderFormat = 'yyyy';
317
319
  const indexMaps = {};
318
320
  fullCols.forEach(({ dateObj }, i) => {
319
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy');
320
- indexMaps[yyyyMM] = i;
321
+ const currStr = XEUtils.toDateString(dateObj.date, 'yyyy');
322
+ indexMaps[currStr] = i;
323
+ if (currRatio) {
324
+ let currStep = scaleStep - 1;
325
+ while (currStep) {
326
+ const currStr = XEUtils.toDateString(XEUtils.getWhatYear(dateObj.date, scaleStep - currStep), renderFormat);
327
+ indexMaps[currStr] = i + currRatio;
328
+ currStep--;
329
+ }
330
+ }
321
331
  });
322
332
  return (startValue, endValue) => {
323
333
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -337,6 +347,10 @@ function createChartRender($xeGanttView, fullCols) {
337
347
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / syDaySize;
338
348
  const eyDaySize = XEUtils.getDayOfYear(endDate, 0);
339
349
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / eyDaySize;
350
+ if (currRatio) {
351
+ startSubtractSize *= currRatio;
352
+ endSubtractSize *= currRatio;
353
+ }
340
354
  }
341
355
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
342
356
  return {
@@ -346,12 +360,20 @@ function createChartRender($xeGanttView, fullCols) {
346
360
  };
347
361
  }
348
362
  case 'quarter': {
349
- const showActualProgress = /M|d|H|mm|ss|S/.test(dateFormat);
363
+ const showActualProgress = /M|d|H|m|ss|S/.test(dateFormat);
350
364
  const renderFormat = 'yyyy-q';
351
365
  const indexMaps = {};
352
366
  fullCols.forEach(({ dateObj }, i) => {
353
- const q = XEUtils.toDateString(dateObj.date, renderFormat);
354
- indexMaps[q] = i;
367
+ const currStr = XEUtils.toDateString(dateObj.date, renderFormat);
368
+ indexMaps[currStr] = i;
369
+ if (currRatio) {
370
+ let currStep = scaleStep - 1;
371
+ while (currStep) {
372
+ const currStr = XEUtils.toDateString(XEUtils.getWhatQuarter(dateObj.date, scaleStep - currStep), renderFormat);
373
+ indexMaps[currStr] = i + currRatio;
374
+ currStep--;
375
+ }
376
+ }
355
377
  });
356
378
  return (startValue, endValue) => {
357
379
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -371,6 +393,10 @@ function createChartRender($xeGanttView, fullCols) {
371
393
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / sqDaySize;
372
394
  const eqDaySize = XEUtils.getDayOfQuarter(endDate, 0);
373
395
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / eqDaySize;
396
+ if (currRatio) {
397
+ startSubtractSize *= currRatio;
398
+ endSubtractSize *= currRatio;
399
+ }
374
400
  }
375
401
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
376
402
  return {
@@ -381,11 +407,19 @@ function createChartRender($xeGanttView, fullCols) {
381
407
  }
382
408
  case 'month': {
383
409
  const renderFormat = 'yyyy-MM';
384
- const showActualProgress = /d|H|mm|ss|S/.test(dateFormat);
410
+ const showActualProgress = /d|H|m|ss|S/.test(dateFormat);
385
411
  const indexMaps = {};
386
412
  fullCols.forEach(({ dateObj }, i) => {
387
- const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
388
- indexMaps[yyyyMM] = i;
413
+ const currStr = XEUtils.toDateString(dateObj.date, renderFormat);
414
+ indexMaps[currStr] = i;
415
+ if (currRatio) {
416
+ let currStep = scaleStep - 1;
417
+ while (currStep) {
418
+ const currStr = XEUtils.toDateString(XEUtils.getWhatMonth(dateObj.date, scaleStep - currStep), renderFormat);
419
+ indexMaps[currStr] = i + currRatio;
420
+ currStep--;
421
+ }
422
+ }
389
423
  });
390
424
  return (startValue, endValue) => {
391
425
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -405,6 +439,10 @@ function createChartRender($xeGanttView, fullCols) {
405
439
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / smDaySize;
406
440
  const emDaySize = XEUtils.getDayOfMonth(endDate, 0);
407
441
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / emDaySize;
442
+ if (currRatio) {
443
+ startSubtractSize *= currRatio;
444
+ endSubtractSize *= currRatio;
445
+ }
408
446
  }
409
447
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
410
448
  return {
@@ -414,14 +452,28 @@ function createChartRender($xeGanttView, fullCols) {
414
452
  };
415
453
  }
416
454
  case 'week': {
417
- const showActualProgress = /d|mm|ss|S/.test(dateFormat);
455
+ const weekStartDay = weekScale ? weekScale.startDay : undefined;
456
+ const showActualProgress = /d|H|m|s|S/.test(dateFormat);
418
457
  const indexMaps = {};
419
458
  fullCols.forEach(({ dateObj }, i) => {
420
- const yyyyW = `${dateObj.yyyy}-${dateObj.W}`;
421
- indexMaps[yyyyW] = i;
459
+ const currStr = `${dateObj.yyyy}-${dateObj.W}`;
460
+ indexMaps[currStr] = i;
461
+ if (currRatio) {
462
+ let currStep = scaleStep - 1;
463
+ while (currStep) {
464
+ const offsetDate = XEUtils.getWhatWeek(dateObj.date, scaleStep - currStep, weekStartDay, weekStartDay);
465
+ let [yyyy, M] = XEUtils.toDateString(offsetDate, 'yyyy-M-MM-dd-HH-mm-ss').split('-');
466
+ const W = `${XEUtils.getYearWeek(offsetDate, weekScale ? weekScale.startDay : undefined)}`;
467
+ if (checkWeekOfsetYear(W, M)) {
468
+ yyyy = `${Number(yyyy) + 1}`;
469
+ }
470
+ const currStr = `${yyyy}-${W}`;
471
+ indexMaps[currStr] = i + currRatio;
472
+ currStep--;
473
+ }
474
+ }
422
475
  });
423
476
  return (startValue, endValue) => {
424
- const weekStartDay = weekScale ? weekScale.startDay : undefined;
425
477
  const startValDate = parseStringDate($xeGanttView, startValue);
426
478
  const endValDate = parseStringDate($xeGanttView, endValue);
427
479
  const startDate = showActualProgress ? startValDate : XEUtils.getWhatWeek(startValDate, 0, 'first', weekStartDay);
@@ -439,6 +491,10 @@ function createChartRender($xeGanttView, fullCols) {
439
491
  // 按周天数比计算
440
492
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / 7;
441
493
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / 7;
494
+ if (currRatio) {
495
+ startSubtractSize *= currRatio;
496
+ endSubtractSize *= currRatio;
497
+ }
442
498
  }
443
499
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
444
500
  return {
@@ -450,11 +506,19 @@ function createChartRender($xeGanttView, fullCols) {
450
506
  case 'day':
451
507
  case 'date': {
452
508
  const renderFormat = 'yyyy-MM-dd';
453
- const showActualProgress = /mm|ss|S/.test(dateFormat);
509
+ const showActualProgress = /H|m|s|S/.test(dateFormat);
454
510
  const indexMaps = {};
455
511
  fullCols.forEach(({ dateObj }, i) => {
456
- const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
457
- indexMaps[yyyyMM] = i;
512
+ const currStr = XEUtils.toDateString(dateObj.date, renderFormat);
513
+ indexMaps[currStr] = i;
514
+ if (currRatio) {
515
+ let currStep = scaleStep - 1;
516
+ while (currStep) {
517
+ const currStr = XEUtils.toDateString(XEUtils.getWhatDay(dateObj.date, scaleStep - currStep), renderFormat);
518
+ indexMaps[currStr] = i + currRatio;
519
+ currStep--;
520
+ }
521
+ }
458
522
  });
459
523
  return (startValue, endValue) => {
460
524
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -471,6 +535,10 @@ function createChartRender($xeGanttView, fullCols) {
471
535
  if (showActualProgress) {
472
536
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs;
473
537
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs;
538
+ if (currRatio) {
539
+ startSubtractSize *= currRatio;
540
+ endSubtractSize *= currRatio;
541
+ }
474
542
  }
475
543
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
476
544
  return {
@@ -481,11 +549,19 @@ function createChartRender($xeGanttView, fullCols) {
481
549
  }
482
550
  case 'hour': {
483
551
  const renderFormat = 'yyyy-MM-dd HH';
484
- const showActualProgress = /mm|ss|S/.test(dateFormat);
552
+ const showActualProgress = /m|ss|S/.test(dateFormat);
485
553
  const indexMaps = {};
486
554
  fullCols.forEach(({ dateObj }, i) => {
487
- const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
488
- indexMaps[yyyyMM] = i;
555
+ const currStr = XEUtils.toDateString(dateObj.date, renderFormat);
556
+ indexMaps[currStr] = i;
557
+ if (currRatio) {
558
+ let currStep = scaleStep - 1;
559
+ while (currStep) {
560
+ const currStr = XEUtils.toDateString(XEUtils.getWhatHours(dateObj.date, scaleStep - currStep), renderFormat);
561
+ indexMaps[currStr] = i + currRatio;
562
+ currStep--;
563
+ }
564
+ }
489
565
  });
490
566
  return (startValue, endValue) => {
491
567
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -502,6 +578,10 @@ function createChartRender($xeGanttView, fullCols) {
502
578
  if (showActualProgress) {
503
579
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / hourMs;
504
580
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / hourMs;
581
+ if (currRatio) {
582
+ startSubtractSize *= currRatio;
583
+ endSubtractSize *= currRatio;
584
+ }
505
585
  }
506
586
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
507
587
  return {
@@ -512,11 +592,19 @@ function createChartRender($xeGanttView, fullCols) {
512
592
  }
513
593
  case 'minute': {
514
594
  const renderFormat = 'yyyy-MM-dd HH:mm';
515
- const showActualProgress = /ss|S/.test(dateFormat);
595
+ const showActualProgress = /s|S/.test(dateFormat);
516
596
  const indexMaps = {};
517
597
  fullCols.forEach(({ dateObj }, i) => {
518
- const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
519
- indexMaps[yyyyMM] = i;
598
+ const currStr = XEUtils.toDateString(dateObj.date, renderFormat);
599
+ indexMaps[currStr] = i;
600
+ if (currRatio) {
601
+ let currStep = scaleStep - 1;
602
+ while (currStep) {
603
+ const currStr = XEUtils.toDateString(XEUtils.getWhatMinutes(dateObj.date, scaleStep - currStep), renderFormat);
604
+ indexMaps[currStr] = i + currRatio;
605
+ currStep--;
606
+ }
607
+ }
520
608
  });
521
609
  return (startValue, endValue) => {
522
610
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -533,6 +621,10 @@ function createChartRender($xeGanttView, fullCols) {
533
621
  if (showActualProgress) {
534
622
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / minuteMs;
535
623
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / minuteMs;
624
+ if (currRatio) {
625
+ startSubtractSize *= currRatio;
626
+ endSubtractSize *= currRatio;
627
+ }
536
628
  }
537
629
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
538
630
  return {
@@ -548,6 +640,14 @@ function createChartRender($xeGanttView, fullCols) {
548
640
  fullCols.forEach(({ dateObj }, i) => {
549
641
  const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
550
642
  indexMaps[yyyyMM] = i;
643
+ if (currRatio) {
644
+ let currStep = scaleStep - 1;
645
+ while (currStep) {
646
+ const yyyyMM = XEUtils.toDateString(XEUtils.getWhatSeconds(dateObj.date, scaleStep - currStep), renderFormat);
647
+ indexMaps[yyyyMM] = i + currRatio;
648
+ currStep--;
649
+ }
650
+ }
551
651
  });
552
652
  return (startValue, endValue) => {
553
653
  const startValDate = parseStringDate($xeGanttView, startValue);
@@ -564,6 +664,10 @@ function createChartRender($xeGanttView, fullCols) {
564
664
  if (showActualProgress) {
565
665
  startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / secondMs;
566
666
  endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / secondMs;
667
+ if (currRatio) {
668
+ startSubtractSize *= currRatio;
669
+ endSubtractSize *= currRatio;
670
+ }
567
671
  }
568
672
  const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
569
673
  return {
@@ -1396,6 +1500,7 @@ export default defineVxeComponent({
1396
1500
  const { minViewDate, maxViewDate } = reactData;
1397
1501
  const taskViewOpts = $xeGantt.computeTaskViewOpts;
1398
1502
  const minScale = $xeGantt.computeMinScale;
1503
+ const scaleStep = $xeGantt.computeScaleStep;
1399
1504
  const { gridding } = taskViewOpts;
1400
1505
  const dateList = [];
1401
1506
  if (!minScale || !minViewDate || !maxViewDate) {
@@ -1404,7 +1509,6 @@ export default defineVxeComponent({
1404
1509
  const { type, startDay } = minScale;
1405
1510
  const leftSize = -(ganttReactData.currLeftSpacing + XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0));
1406
1511
  const rightSize = ganttReactData.currRightSpacing + XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0);
1407
- const currStep = 1; // XEUtils.toNumber(step || 1) || 1
1408
1512
  switch (type) {
1409
1513
  case 'year': {
1410
1514
  let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first');
@@ -1412,7 +1516,7 @@ export default defineVxeComponent({
1412
1516
  while (currDate <= endDate) {
1413
1517
  const itemDate = currDate;
1414
1518
  dateList.push(itemDate);
1415
- currDate = XEUtils.getWhatYear(currDate, currStep);
1519
+ currDate = XEUtils.getWhatYear(currDate, scaleStep);
1416
1520
  }
1417
1521
  break;
1418
1522
  }
@@ -1422,7 +1526,7 @@ export default defineVxeComponent({
1422
1526
  while (currDate <= endDate) {
1423
1527
  const itemDate = currDate;
1424
1528
  dateList.push(itemDate);
1425
- currDate = XEUtils.getWhatQuarter(currDate, currStep);
1529
+ currDate = XEUtils.getWhatQuarter(currDate, scaleStep);
1426
1530
  }
1427
1531
  break;
1428
1532
  }
@@ -1432,7 +1536,7 @@ export default defineVxeComponent({
1432
1536
  while (currDate <= endDate) {
1433
1537
  const itemDate = currDate;
1434
1538
  dateList.push(itemDate);
1435
- currDate = XEUtils.getWhatMonth(currDate, currStep);
1539
+ currDate = XEUtils.getWhatMonth(currDate, scaleStep);
1436
1540
  }
1437
1541
  break;
1438
1542
  }
@@ -1442,7 +1546,7 @@ export default defineVxeComponent({
1442
1546
  while (currDate <= endDate) {
1443
1547
  const itemDate = currDate;
1444
1548
  dateList.push(itemDate);
1445
- currDate = XEUtils.getWhatWeek(currDate, currStep);
1549
+ currDate = XEUtils.getWhatWeek(currDate, scaleStep);
1446
1550
  }
1447
1551
  break;
1448
1552
  }
@@ -1453,14 +1557,14 @@ export default defineVxeComponent({
1453
1557
  while (currDate <= endDate) {
1454
1558
  const itemDate = currDate;
1455
1559
  dateList.push(itemDate);
1456
- currDate = XEUtils.getWhatDay(currDate, currStep);
1560
+ currDate = XEUtils.getWhatDay(currDate, scaleStep);
1457
1561
  }
1458
1562
  break;
1459
1563
  }
1460
1564
  case 'hour':
1461
1565
  case 'minute':
1462
1566
  case 'second': {
1463
- const gapTime = getStandardGapTime(minScale.type) * currStep;
1567
+ const gapTime = getStandardGapTime(minScale.type) * scaleStep;
1464
1568
  let currTime = minViewDate.getTime() + (leftSize * gapTime);
1465
1569
  const endTime = maxViewDate.getTime() + (rightSize * gapTime);
1466
1570
  while (currTime <= endTime) {
@@ -256,6 +256,12 @@ export default {
256
256
  const { taskScaleList } = reactData;
257
257
  return XEUtils.last(taskScaleList);
258
258
  },
259
+ computeScaleStep() {
260
+ const $xeGantt = this;
261
+ const minScale = $xeGantt.computeMinScale;
262
+ const { step } = minScale;
263
+ return XEUtils.toNumber(step || 1) || 1;
264
+ },
259
265
  computeWeekScale() {
260
266
  const $xeGantt = this;
261
267
  const reactData = $xeGantt.reactData;
@@ -580,11 +586,7 @@ export default {
580
586
  scaleList.forEach(conf => {
581
587
  const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf;
582
588
  const type = sConf.type;
583
- const step = sConf.step;
584
589
  const level = getViewTypeLevel(type);
585
- if (step) {
586
- errLog('vxe.error.errProp', [`step=${step}`, 'step=1']);
587
- }
588
590
  if (!type || !viewTypeLevelMaps[type]) {
589
591
  errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')]);
590
592
  return;
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 = "3.5.3";
3
+ VxeUI.ganttVersion = "3.6.0-beta.0";
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,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const ganttVersion = `gantt v${"3.5.3"}`;
3
+ const ganttVersion = `gantt v${"3.6.0-beta.0"}`;
4
4
  export function createComponentLog(name) {
5
5
  const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
6
6
  const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';