vxe-gantt 4.9.0-beta.1 → 4.9.0-beta.3

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/dist/all.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { VxeUI } from '@vxe-ui/core';
1
+ import { VxeUI, useFns as useFns$1 } from '@vxe-ui/core';
2
2
  export { VxeUI } from '@vxe-ui/core';
3
3
  import { defineComponent, inject, ref, onMounted, onUnmounted, h, reactive, computed, watch, nextTick, onBeforeUnmount, provide } from 'vue';
4
4
  import XEUtils from 'xe-utils';
@@ -6,7 +6,7 @@ import DomZIndex from 'dom-zindex';
6
6
  import { VxeTable } from 'vxe-table';
7
7
 
8
8
  const { setConfig: setConfig$1, setIcon } = VxeUI;
9
- VxeUI.ganttVersion = "4.9.0-beta.1";
9
+ VxeUI.ganttVersion = "4.9.0-beta.3";
10
10
  const ymdFormat = 'yyyy-MM-dd';
11
11
  const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
12
12
  setConfig$1({
@@ -130,7 +130,7 @@ setIcon({
130
130
  });
131
131
 
132
132
  const { log } = VxeUI;
133
- const ganttVersion = `gantt v${"4.9.0-beta.1"}`;
133
+ const ganttVersion = `gantt v${"4.9.0-beta.3"}`;
134
134
  function createComponentLog(name) {
135
135
  const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
136
136
  const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
@@ -1400,8 +1400,7 @@ var GanttViewFooterComponent = defineVxeComponent({
1400
1400
  }
1401
1401
  });
1402
1402
 
1403
- const { getConfig: getConfig$1, domUtils, scrollbarUtils, globalResize, globalEvents: globalEvents$1, renderEmptyElement: renderEmptyElement$1 } = VxeUI;
1404
- const { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } = scrollbarUtils;
1403
+ const { getConfig: getConfig$1, domUtils, globalResize, globalEvents: globalEvents$1, renderEmptyElement: renderEmptyElement$1 } = VxeUI;
1405
1404
  const { FinishToStart, StartToFinish, StartToStart, FinishToFinish } = VxeGanttDependencyType;
1406
1405
  const sourceType = 'gantt';
1407
1406
  const secondMs = 1000;
@@ -1438,6 +1437,27 @@ function createInternalData$1() {
1438
1437
  xThumbLeft: 0,
1439
1438
  lastScrollTop: 0,
1440
1439
  lastScrollLeft: 0
1440
+ // 刷新布局
1441
+ // rceTimeout: undefined,
1442
+ // rceRunTime: undefined,
1443
+ // // 滚动属性
1444
+ // intoRunScroll: false,
1445
+ // inVirtualScroll: false,
1446
+ // inWheelScroll: false,
1447
+ // inHeaderScroll: false,
1448
+ // inBodyScroll: false,
1449
+ // inFooterScroll: false,
1450
+ // scrollRenderType: '',
1451
+ // isSyncTableScrollTop: false,
1452
+ // // 同步滚动
1453
+ // lcsTimeout: undefined,
1454
+ // lcsRunTime: undefined,
1455
+ // // 横向虚拟
1456
+ // lxRunTime: undefined,
1457
+ // lxTimeout: undefined,
1458
+ // // 纵向虚拟
1459
+ // lyRunTime: undefined,
1460
+ // lyTimeout: undefined
1441
1461
  };
1442
1462
  }
1443
1463
  function createReactData$1() {
@@ -1488,10 +1508,6 @@ var GanttViewComponent = defineVxeComponent({
1488
1508
  const ganttInternalData = $xeGantt.internalData;
1489
1509
  const { computeDateFormat, computeTaskBarOpts, computeTaskViewOpts, computeStartField, computeEndField, computeTypeField, computeScrollbarOpts, computeScaleUnit, computeWeekScale, computeMinScale, computeTaskNowLineOpts, computeScaleStep, computeIsVScrollbar } = $xeGantt.getComputeMaps();
1490
1510
  const refElem = ref();
1491
- const refTrackXElem = ref();
1492
- const refTrackYElem = ref();
1493
- const refThumbXElem = ref();
1494
- const refThumbYElem = ref();
1495
1511
  const refScrollXVirtualElem = ref();
1496
1512
  const refScrollYVirtualElem = ref();
1497
1513
  const refScrollXHandleElem = ref();
@@ -1745,6 +1761,7 @@ var GanttViewComponent = defineVxeComponent({
1745
1761
  getRefMaps: () => refMaps,
1746
1762
  getComputeMaps: () => computeMaps
1747
1763
  };
1764
+ const { refTrackXElem, refTrackYElem, refThumbXElem, refThumbYElem, updateThumbSize, updateThumbOffset, clickTrackXEvent, clickTrackYEvent, pointerdownThumbXEvent, pointermoveThumbXEvent, cleatPointerThumbEvent, pointerdownThumbYEvent, pointermoveThumbYEvent } = useFns$1.useInitVScrollbar($xeGanttView);
1748
1765
  const parseStringDate = (dateValue) => {
1749
1766
  const dateFormat = computeDateFormat.value;
1750
1767
  return XEUtils.toStringDate(dateValue, dateFormat);
@@ -3229,6 +3246,7 @@ var GanttViewComponent = defineVxeComponent({
3229
3246
  clearTimeout(lcsTimeout);
3230
3247
  }
3231
3248
  internalData.lcsTimeout = setTimeout(() => {
3249
+ const $xeTable = internalData.xeTable;
3232
3250
  internalData.lcsRunTime = Date.now();
3233
3251
  internalData.lcsTimeout = undefined;
3234
3252
  internalData.intoRunScroll = false;
@@ -3238,6 +3256,10 @@ var GanttViewComponent = defineVxeComponent({
3238
3256
  internalData.inBodyScroll = false;
3239
3257
  internalData.inFooterScroll = false;
3240
3258
  reactData.lazScrollLoading = false;
3259
+ if ($xeTable) {
3260
+ const tableInternalData = $xeTable.internalData;
3261
+ tableInternalData.isSyncGanttScrollTop = false;
3262
+ }
3241
3263
  }, 200);
3242
3264
  };
3243
3265
  const handleScrollData = (isRollY, isRollX, scrollTop, scrollLeft) => {
@@ -3312,7 +3334,10 @@ var GanttViewComponent = defineVxeComponent({
3312
3334
  }
3313
3335
  }
3314
3336
  }
3315
- updateThumbOffset();
3337
+ const isVScrollbar = computeGanttIsVScrollbar.value;
3338
+ if (isVScrollbar) {
3339
+ updateThumbOffset();
3340
+ }
3316
3341
  handleScrollData(isRollY, isRollX, scrollTop, scrollLeft);
3317
3342
  const evntParams = {
3318
3343
  source: sourceType,
@@ -3336,6 +3361,11 @@ var GanttViewComponent = defineVxeComponent({
3336
3361
  $xeGantt.dispatchEvent('scroll', evntParams, evnt);
3337
3362
  };
3338
3363
  const ganttViewMethods = {
3364
+ getScrollViewElem() {
3365
+ const { elemStore } = internalData;
3366
+ const viewEl = getRefElem(elemStore['main-body-scroll']);
3367
+ return viewEl;
3368
+ },
3339
3369
  refreshData() {
3340
3370
  handleUpdateData();
3341
3371
  handleRecalculateStyle();
@@ -3373,14 +3403,15 @@ var GanttViewComponent = defineVxeComponent({
3373
3403
  * 同步表格滚动
3374
3404
  */
3375
3405
  const syncTableScrollTop = (scrollTop) => {
3406
+ const { isSyncTableScrollTop } = internalData;
3407
+ if (isSyncTableScrollTop) {
3408
+ return;
3409
+ }
3376
3410
  const $xeTable = internalData.xeTable;
3377
3411
  if ($xeTable) {
3378
3412
  const tableInternalData = $xeTable.internalData;
3379
- const { elemStore: tableElemStore } = tableInternalData;
3380
- const tableBodyScrollElem = getRefElem(tableElemStore['main-body-scroll']);
3381
- if (tableBodyScrollElem) {
3382
- tableBodyScrollElem.scrollTop = scrollTop;
3383
- }
3413
+ tableInternalData.isSyncGanttScrollTop = true;
3414
+ $xeTable.handleSyncScrollTop({ scrollTop });
3384
3415
  }
3385
3416
  };
3386
3417
  const ganttViewPrivateMethods = {
@@ -3415,6 +3446,14 @@ var GanttViewComponent = defineVxeComponent({
3415
3446
  }
3416
3447
  }
3417
3448
  },
3449
+ handleSyncScrollTop(params) {
3450
+ const { scrollTop } = params;
3451
+ const { elemStore } = internalData;
3452
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
3453
+ if (bodyScrollElem) {
3454
+ bodyScrollElem.scrollTop = scrollTop;
3455
+ }
3456
+ },
3418
3457
  triggerHeaderScrollEvent(evnt) {
3419
3458
  const { elemStore, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
3420
3459
  if (inVirtualScroll) {
@@ -3541,15 +3580,21 @@ var GanttViewComponent = defineVxeComponent({
3541
3580
  }
3542
3581
  };
3543
3582
  const updateScrollbar = () => {
3544
- updateThumbSize();
3545
- updateThumbOffset();
3583
+ const isVScrollbar = computeGanttIsVScrollbar.value;
3584
+ if (isVScrollbar) {
3585
+ return nextTick().then(() => {
3586
+ updateThumbSize();
3587
+ updateThumbOffset();
3588
+ });
3589
+ }
3590
+ return Promise.resolve();
3546
3591
  };
3547
3592
  const handleGlobalResizeEvent = () => {
3548
3593
  handleLazyRecalculate();
3549
3594
  };
3550
3595
  const bindScrollbarResize = () => {
3551
3596
  const { elemStore, scrollObserver } = internalData;
3552
- const isVScrollbar = computeIsVScrollbar.value;
3597
+ const isVScrollbar = computeGanttIsVScrollbar.value;
3553
3598
  if (isVScrollbar) {
3554
3599
  if (!scrollObserver) {
3555
3600
  const el = refElem.value;
@@ -3571,168 +3616,6 @@ var GanttViewComponent = defineVxeComponent({
3571
3616
  }
3572
3617
  }
3573
3618
  };
3574
- const updateThumbSize = () => {
3575
- const { elemStore } = internalData;
3576
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3577
- if (!viewEl) {
3578
- return;
3579
- }
3580
- if (!viewEl.clientHeight || !viewEl.clientHeight) {
3581
- return;
3582
- }
3583
- const trackXEl = refTrackXElem.value;
3584
- const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0;
3585
- const thumbXElem = refThumbXElem.value;
3586
- if (thumbXElem) {
3587
- thumbXElem.style.width = xThumbWidth + 'px';
3588
- }
3589
- reactData.xThumbWidth = xThumbWidth;
3590
- const trackYEl = refTrackYElem.value;
3591
- const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0;
3592
- const thumbYElem = refThumbYElem.value;
3593
- if (thumbYElem) {
3594
- thumbYElem.style.height = yThumbHeight + 'px';
3595
- }
3596
- reactData.yThumbHeight = yThumbHeight;
3597
- };
3598
- const updateThumbOffset = () => {
3599
- const { elemStore } = internalData;
3600
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3601
- if (!viewEl) {
3602
- return;
3603
- }
3604
- if (!viewEl.clientHeight || !viewEl.clientHeight) {
3605
- return;
3606
- }
3607
- const { xThumbWidth, yThumbHeight } = reactData;
3608
- const trackXEl = refTrackXElem.value;
3609
- const thumbXElem = refThumbXElem.value;
3610
- const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0;
3611
- internalData.xThumbLeft = xThumbLeft;
3612
- if (thumbXElem && xThumbWidth) {
3613
- thumbXElem.style.width = xThumbWidth + 'px';
3614
- thumbXElem.style.transform = `translateX(${xThumbLeft}px)`;
3615
- }
3616
- const trackYEl = refTrackYElem.value;
3617
- const thumbYElem = refThumbYElem.value;
3618
- const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0;
3619
- internalData.yThumbTop = yThumbTop;
3620
- if (thumbYElem && yThumbHeight) {
3621
- thumbYElem.style.height = yThumbHeight + 'px';
3622
- thumbYElem.style.transform = `translateY(${yThumbTop}px)`;
3623
- }
3624
- };
3625
- const clickTrackXEvent = (evnt) => {
3626
- const trackEl = evnt.currentTarget;
3627
- if (trackEl !== evnt.target) {
3628
- return;
3629
- }
3630
- const { elemStore } = internalData;
3631
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3632
- if (!viewEl) {
3633
- return;
3634
- }
3635
- const { xThumbWidth } = reactData;
3636
- const trackRect = trackEl.getBoundingClientRect();
3637
- viewEl.scrollTo({
3638
- left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
3639
- behavior: 'auto'
3640
- });
3641
- };
3642
- const clickTrackYEvent = (evnt) => {
3643
- const trackEl = evnt.currentTarget;
3644
- if (trackEl !== evnt.target) {
3645
- return;
3646
- }
3647
- const { elemStore } = internalData;
3648
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3649
- if (!viewEl) {
3650
- return;
3651
- }
3652
- const { yThumbHeight } = reactData;
3653
- const trackRect = trackEl.getBoundingClientRect();
3654
- viewEl.scrollTo({
3655
- top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
3656
- behavior: 'auto'
3657
- });
3658
- };
3659
- const pointerdownThumbXEvent = (evnt) => {
3660
- const thumbEl = evnt.currentTarget;
3661
- internalData.isThumbDrag = true;
3662
- thumbEl.setPointerCapture(evnt.pointerId);
3663
- const { elemStore } = internalData;
3664
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3665
- if (!viewEl) {
3666
- return;
3667
- }
3668
- const { xThumbWidth } = reactData;
3669
- const trackEl = thumbEl.parentElement;
3670
- const trackRect = trackEl.getBoundingClientRect();
3671
- const pointerPosition = evnt.clientX - trackRect.left;
3672
- // 记录 thumb 的偏移
3673
- const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
3674
- internalData.thumbDragOffset = pointerPosition - thumbOffset;
3675
- };
3676
- const pointermoveThumbXEvent = (evnt) => {
3677
- const thumbEl = evnt.currentTarget;
3678
- if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
3679
- return;
3680
- }
3681
- const { elemStore, isThumbDrag, thumbDragOffset } = internalData;
3682
- if (isThumbDrag) {
3683
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3684
- if (!viewEl) {
3685
- return;
3686
- }
3687
- const { xThumbWidth } = reactData;
3688
- const thumbEl = evnt.currentTarget;
3689
- const trackEl = thumbEl.parentElement;
3690
- const trackRect = trackEl.getBoundingClientRect();
3691
- // 更新偏移
3692
- viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
3693
- }
3694
- };
3695
- const cleatPointerThumbEvent = (evnt) => {
3696
- const thumbEl = evnt.currentTarget;
3697
- thumbEl.releasePointerCapture(evnt.pointerId);
3698
- internalData.isThumbDrag = false;
3699
- };
3700
- const pointerdownThumbYEvent = (evnt) => {
3701
- const thumbEl = evnt.currentTarget;
3702
- internalData.isThumbDrag = true;
3703
- thumbEl.setPointerCapture(evnt.pointerId);
3704
- const { elemStore } = internalData;
3705
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3706
- if (!viewEl) {
3707
- return;
3708
- }
3709
- const { yThumbHeight } = reactData;
3710
- const trackEl = thumbEl.parentElement;
3711
- const trackRect = trackEl.getBoundingClientRect();
3712
- const pointerPosition = evnt.clientY - trackRect.top;
3713
- // 记录 thumb 的偏移
3714
- const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
3715
- internalData.thumbDragOffset = pointerPosition - thumbOffset;
3716
- };
3717
- const pointermoveThumbYEvent = (evnt) => {
3718
- const thumbEl = evnt.currentTarget;
3719
- if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
3720
- return;
3721
- }
3722
- const { elemStore, isThumbDrag, thumbDragOffset } = internalData;
3723
- if (isThumbDrag) {
3724
- const viewEl = getRefElem(elemStore['main-body-scroll']);
3725
- if (!viewEl) {
3726
- return;
3727
- }
3728
- const { yThumbHeight } = reactData;
3729
- const thumbEl = evnt.currentTarget;
3730
- const trackEl = thumbEl.parentElement;
3731
- const trackRect = trackEl.getBoundingClientRect();
3732
- // 更新偏移
3733
- viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
3734
- }
3735
- };
3736
3619
  Object.assign($xeGanttView, ganttViewMethods, ganttViewPrivateMethods);
3737
3620
  const renderScrollX = () => {
3738
3621
  return h('div', {
@@ -3830,7 +3713,7 @@ var GanttViewComponent = defineVxeComponent({
3830
3713
  const renderVirtualBody = () => {
3831
3714
  const { showLeftView } = ganttReactData;
3832
3715
  const { xThumbWidth, yThumbHeight } = reactData;
3833
- const isVScrollbar = computeIsVScrollbar.value;
3716
+ const isVScrollbar = computeGanttIsVScrollbar.value;
3834
3717
  const scrollbarOpts = computeScrollbarOpts.value;
3835
3718
  const scrollXAutoHide = computeScrollXAutoHide.value;
3836
3719
  const scrollYAutoHide = computeScrollYAutoHide.value;
@@ -3893,7 +3776,7 @@ var GanttViewComponent = defineVxeComponent({
3893
3776
  };
3894
3777
  const renderVN = () => {
3895
3778
  const { overflowX, overflowY, scrollXLoad, scrollYLoad } = reactData;
3896
- const isVScrollbar = computeIsVScrollbar.value;
3779
+ const isVScrollbar = computeGanttIsVScrollbar.value;
3897
3780
  const scrollbarXToTop = computeScrollbarXToTop.value;
3898
3781
  return h('div', {
3899
3782
  ref: refElem,