vxe-gantt 3.0.6 → 3.0.8

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.
@@ -20,8 +20,10 @@ export default defineVxeComponent({
20
20
  const _vm = this;
21
21
  const $xeGantt = _vm.$xeGantt;
22
22
  const $xeGanttView = _vm.$xeGanttView;
23
- const { reactData } = $xeGanttView;
24
- const { tableColumn, headerGroups, viewCellWidth } = reactData;
23
+ const reactData = $xeGanttView.reactData;
24
+ const internalData = $xeGanttView.internalData;
25
+ const { headerGroups, viewCellWidth } = reactData;
26
+ const { visibleColumn } = internalData;
25
27
  return h('div', {
26
28
  ref: 'refElem',
27
29
  class: 'vxe-gantt-view--header-wrapper'
@@ -41,7 +43,7 @@ export default defineVxeComponent({
41
43
  ref: 'refHeaderTable',
42
44
  class: 'vxe-gantt-view--header-table'
43
45
  }, [
44
- h('colgroup', {}, tableColumn.map((column, cIndex) => {
46
+ h('colgroup', {}, visibleColumn.map((column, cIndex) => {
45
47
  return h('col', {
46
48
  key: cIndex,
47
49
  style: {
@@ -10,6 +10,7 @@ const { globalEvents } = VxeUI;
10
10
  function createInternalData() {
11
11
  return {
12
12
  xeTable: null,
13
+ visibleColumn: [],
13
14
  startMaps: {},
14
15
  endMaps: {},
15
16
  chartMaps: {},
@@ -24,16 +25,9 @@ function createInternalData() {
24
25
  startIndex: 0,
25
26
  endIndex: 0
26
27
  },
27
- // 存放纵向 Y 虚拟滚动相关信息
28
- scrollYStore: {
29
- preloadSize: 0,
30
- offsetSize: 0,
31
- visibleSize: 0,
32
- visibleStartIndex: 0,
33
- visibleEndIndex: 0,
34
- startIndex: 0,
35
- endIndex: 0
36
- }
28
+ // 最后滚动位置
29
+ lastScrollTop: 0,
30
+ lastScrollLeft: 0
37
31
  };
38
32
  }
39
33
  const maxYHeight = 5e6;
@@ -77,37 +71,37 @@ function handleParseColumn($xeGanttView) {
77
71
  const currTime = minViewDate.getTime();
78
72
  const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
79
73
  const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
80
- switch (minScale.type) {
81
- case 'day':
82
- case 'date':
83
- if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
84
- reactData.tableColumn = [];
85
- reactData.headerGroups = [];
86
- return;
87
- }
88
- break;
89
- case 'hour':
90
- if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
91
- reactData.tableColumn = [];
92
- reactData.headerGroups = [];
93
- return;
94
- }
95
- break;
96
- case 'minute':
97
- if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
98
- reactData.tableColumn = [];
99
- reactData.headerGroups = [];
100
- return;
101
- }
102
- break;
103
- case 'second':
104
- if (diffDayNum > (1000 * 60 * 60 * 3)) {
105
- reactData.tableColumn = [];
106
- reactData.headerGroups = [];
107
- return;
108
- }
109
- break;
110
- }
74
+ // switch (minScale.type) {
75
+ // case 'day':
76
+ // case 'date':
77
+ // if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
78
+ // reactData.tableColumn = []
79
+ // reactData.headerGroups = []
80
+ // return
81
+ // }
82
+ // break
83
+ // case 'hour':
84
+ // if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
85
+ // reactData.tableColumn = []
86
+ // reactData.headerGroups = []
87
+ // return
88
+ // }
89
+ // break
90
+ // case 'minute':
91
+ // if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
92
+ // reactData.tableColumn = []
93
+ // reactData.headerGroups = []
94
+ // return
95
+ // }
96
+ // break
97
+ // case 'second':
98
+ // if (diffDayNum > (1000 * 60 * 60 * 3)) {
99
+ // reactData.tableColumn = []
100
+ // reactData.headerGroups = []
101
+ // return
102
+ // }
103
+ // break
104
+ // }
111
105
  const renderListMaps = {
112
106
  year: [],
113
107
  quarter: [],
@@ -255,8 +249,11 @@ function handleParseColumn($xeGanttView) {
255
249
  if ($xeTable) {
256
250
  const startField = $xeGantt.computeStartField;
257
251
  const endField = $xeGantt.computeEndField;
252
+ const tableReactData = $xeTable;
253
+ const { isRowGroupStatus } = tableReactData;
258
254
  const tableInternalData = $xeTable;
259
- const { afterFullData, afterTreeFullData } = tableInternalData;
255
+ const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData;
256
+ const aggregateOpts = $xeTable.computeAggregateOpts;
260
257
  const treeOpts = $xeTable.computeTreeOpts;
261
258
  const { transform } = treeOpts;
262
259
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -278,7 +275,15 @@ function handleParseColumn($xeGanttView) {
278
275
  };
279
276
  }
280
277
  };
281
- if (treeConfig) {
278
+ if (isRowGroupStatus) {
279
+ // 行分组
280
+ const mapChildrenField = aggregateOpts.mapChildrenField;
281
+ if (mapChildrenField) {
282
+ XEUtils.eachTree(afterGroupFullData, handleParseRender, { children: mapChildrenField });
283
+ }
284
+ }
285
+ else if (treeConfig) {
286
+ // 树结构
282
287
  XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField });
283
288
  }
284
289
  else {
@@ -287,8 +292,10 @@ function handleParseColumn($xeGanttView) {
287
292
  internalData.chartMaps = ctMaps;
288
293
  }
289
294
  }
290
- reactData.tableColumn = fullCols;
295
+ internalData.visibleColumn = fullCols;
291
296
  reactData.headerGroups = groupCols;
297
+ updateScrollXStatus($xeGanttView);
298
+ handleTableColumn($xeGanttView);
292
299
  }
293
300
  function handleUpdateData($xeGanttView) {
294
301
  const $xeGantt = $xeGanttView.$xeGantt;
@@ -296,6 +303,7 @@ function handleUpdateData($xeGanttView) {
296
303
  const internalData = $xeGanttView.internalData;
297
304
  const ganttProps = $xeGantt;
298
305
  const { treeConfig } = ganttProps;
306
+ const { scrollXStore } = internalData;
299
307
  const $xeTable = internalData.xeTable;
300
308
  const sdMaps = {};
301
309
  const edMaps = {};
@@ -304,8 +312,11 @@ function handleUpdateData($xeGanttView) {
304
312
  if ($xeTable) {
305
313
  const startField = $xeGantt.computeStartField;
306
314
  const endField = $xeGantt.computeEndField;
315
+ const tableReactData = $xeTable;
316
+ const { isRowGroupStatus } = tableReactData;
307
317
  const tableInternalData = $xeTable;
308
- const { afterFullData, afterTreeFullData } = tableInternalData;
318
+ const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData;
319
+ const aggregateOpts = $xeTable.computeAggregateOpts;
309
320
  const treeOpts = $xeTable.computeTreeOpts;
310
321
  const { transform } = treeOpts;
311
322
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -323,13 +334,23 @@ function handleUpdateData($xeGanttView) {
323
334
  }
324
335
  }
325
336
  };
326
- if (treeConfig) {
337
+ if (isRowGroupStatus) {
338
+ // 行分组
339
+ const mapChildrenField = aggregateOpts.mapChildrenField;
340
+ if (mapChildrenField) {
341
+ XEUtils.eachTree(afterGroupFullData, handleMinMaxData, { children: mapChildrenField });
342
+ }
343
+ }
344
+ else if (treeConfig) {
345
+ // 树结构
327
346
  XEUtils.eachTree(afterTreeFullData, handleMinMaxData, { children: transform ? treeOpts.mapChildrenField : childrenField });
328
347
  }
329
348
  else {
330
349
  afterFullData.forEach(handleMinMaxData);
331
350
  }
332
351
  }
352
+ scrollXStore.startIndex = 0;
353
+ scrollXStore.endIndex = Math.max(1, scrollXStore.visibleSize);
333
354
  reactData.minViewDate = minDate;
334
355
  reactData.maxViewDate = maxDate;
335
356
  internalData.startMaps = sdMaps;
@@ -375,10 +396,8 @@ function updateChart($xeGanttView) {
375
396
  }
376
397
  const rowid = rowEl.getAttribute('rowid');
377
398
  const rowRest = rowid ? chartMaps[rowid] : null;
378
- if (rowRest) {
379
- barEl.style.left = `${viewCellWidth * rowRest.oLeftSize}px`;
380
- barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`;
381
- }
399
+ barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`;
400
+ barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`;
382
401
  });
383
402
  }
384
403
  return $xeGanttView.$nextTick();
@@ -387,8 +406,8 @@ function updateStyle($xeGanttView) {
387
406
  const $xeGantt = $xeGanttView.$xeGantt;
388
407
  const reactData = $xeGanttView.reactData;
389
408
  const internalData = $xeGanttView.internalData;
390
- const { scrollbarWidth, scrollbarHeight, tableColumn, headerGroups } = reactData;
391
- const { elemStore } = internalData;
409
+ const { scrollbarWidth, scrollbarHeight, headerGroups, tableColumn } = reactData;
410
+ const { elemStore, visibleColumn } = internalData;
392
411
  const $xeTable = internalData.xeTable;
393
412
  const el = $xeGanttView.$refs.refElem;
394
413
  if (!el || !el.clientHeight) {
@@ -469,82 +488,194 @@ function updateStyle($xeGanttView) {
469
488
  yBottomCornerEl.style.display = tFooterHeight ? 'block' : '';
470
489
  }
471
490
  const colInfoElem = $xeGanttView.$refs.refColInfoElem;
491
+ let viewCellWidth = 40;
472
492
  if (colInfoElem) {
473
- reactData.viewCellWidth = colInfoElem.clientWidth || 40;
493
+ viewCellWidth = colInfoElem.clientWidth || 40;
474
494
  }
475
- let viewTableWidth = reactData.viewCellWidth * tableColumn.length;
495
+ let viewTableWidth = viewCellWidth * visibleColumn.length;
476
496
  if (bodyScrollElem) {
477
497
  const viewWidth = bodyScrollElem.clientWidth;
478
498
  const remainWidth = viewWidth - viewTableWidth;
479
499
  if (remainWidth > 0) {
480
- reactData.viewCellWidth += Math.floor(remainWidth / tableColumn.length);
500
+ viewCellWidth += Math.floor(remainWidth / visibleColumn.length);
481
501
  viewTableWidth = viewWidth;
482
502
  }
483
503
  }
504
+ reactData.viewCellWidth = viewCellWidth;
484
505
  const headerTableElem = getRefElem(elemStore['main-header-table']);
485
506
  const bodyTableElem = getRefElem(elemStore['main-body-table']);
507
+ const vmTableWidth = viewCellWidth * tableColumn.length;
486
508
  if (headerTableElem) {
487
509
  headerTableElem.style.width = `${viewTableWidth}px`;
488
510
  }
489
511
  if (bodyTableElem) {
490
- bodyTableElem.style.width = `${viewTableWidth}px`;
512
+ bodyTableElem.style.width = `${vmTableWidth}px`;
491
513
  }
492
514
  reactData.scrollXWidth = viewTableWidth;
493
515
  return updateChart($xeGanttView);
494
516
  }
495
- function handleLazyRecalculate($xeGanttView) {
517
+ function handleRecalculateStyle($xeGanttView) {
518
+ const internalData = $xeGanttView.internalData;
519
+ const el = $xeGanttView.$refs.refElem;
520
+ internalData.rceRunTime = Date.now();
521
+ if (!el || !el.clientWidth) {
522
+ return $xeGanttView.$nextTick();
523
+ }
496
524
  calcScrollbar($xeGanttView);
497
525
  updateStyle($xeGanttView);
498
526
  updateChart($xeGanttView);
527
+ return computeScrollLoad($xeGanttView);
528
+ }
529
+ function handleLazyRecalculate($xeGanttView) {
530
+ const internalData = $xeGanttView.internalData;
531
+ return new Promise(resolve => {
532
+ const { rceTimeout, rceRunTime } = internalData;
533
+ const $xeTable = internalData.xeTable;
534
+ let refreshDelay = 50;
535
+ if ($xeTable) {
536
+ const resizeOpts = $xeTable.computeResizeOpts;
537
+ refreshDelay = resizeOpts.refreshDelay || 50;
538
+ }
539
+ if (rceTimeout) {
540
+ clearTimeout(rceTimeout);
541
+ if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
542
+ resolve(handleRecalculateStyle($xeGanttView));
543
+ }
544
+ else {
545
+ $xeGanttView.$nextTick(() => {
546
+ resolve();
547
+ });
548
+ }
549
+ }
550
+ else {
551
+ resolve(handleRecalculateStyle($xeGanttView));
552
+ }
553
+ internalData.rceTimeout = setTimeout(() => {
554
+ internalData.rceTimeout = undefined;
555
+ handleRecalculateStyle($xeGanttView);
556
+ }, refreshDelay);
557
+ });
558
+ }
559
+ function computeScrollLoad($xeGanttView) {
560
+ const reactData = $xeGanttView.reactData;
561
+ const internalData = $xeGanttView.internalData;
562
+ return $xeGanttView.$nextTick().then(() => {
563
+ const { scrollXLoad } = reactData;
564
+ const { scrollXStore } = internalData;
565
+ // 计算 X 逻辑
566
+ if (scrollXLoad) {
567
+ const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible($xeGanttView);
568
+ const offsetXSize = 2;
569
+ scrollXStore.preloadSize = 1;
570
+ scrollXStore.offsetSize = offsetXSize;
571
+ scrollXStore.visibleSize = visibleXSize;
572
+ scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
573
+ scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
574
+ scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
575
+ updateScrollXData($xeGanttView).then(() => {
576
+ loadScrollXData($xeGanttView);
577
+ });
578
+ }
579
+ else {
580
+ updateScrollXSpace($xeGanttView);
581
+ }
582
+ });
583
+ }
584
+ function handleVirtualXVisible($xeGanttView) {
585
+ const reactData = $xeGanttView.reactData;
586
+ const internalData = $xeGanttView.internalData;
587
+ const { viewCellWidth } = reactData;
588
+ const { elemStore } = internalData;
589
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
590
+ if (bodyScrollElem) {
591
+ const clientWidth = bodyScrollElem.clientWidth;
592
+ const scrollLeft = bodyScrollElem.scrollLeft;
593
+ const toVisibleIndex = Math.floor(scrollLeft / viewCellWidth) - 1;
594
+ const visibleSize = Math.ceil(clientWidth / viewCellWidth) + 1;
595
+ return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(1, visibleSize) };
596
+ }
597
+ return { toVisibleIndex: 0, visibleSize: 6 };
598
+ }
599
+ function loadScrollXData($xeGanttView) {
600
+ const reactData = $xeGanttView.reactData;
601
+ const internalData = $xeGanttView.internalData;
602
+ const { isScrollXBig } = reactData;
603
+ const { scrollXStore } = internalData;
604
+ const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore;
605
+ const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeGanttView);
606
+ const offsetItem = {
607
+ startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
608
+ endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
609
+ };
610
+ scrollXStore.visibleStartIndex = toVisibleIndex - 1;
611
+ scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
612
+ const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
613
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
614
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
615
+ scrollXStore.startIndex = offsetStartIndex;
616
+ scrollXStore.endIndex = offsetEndIndex;
617
+ updateScrollXData($xeGanttView);
618
+ }
619
+ }
620
+ }
621
+ function updateScrollXData($xeGanttView) {
622
+ handleTableColumn($xeGanttView);
623
+ updateScrollXSpace($xeGanttView);
499
624
  return $xeGanttView.$nextTick();
500
625
  }
501
- // function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
502
- // const reactData = $xeGanttView.reactData
503
- // const internalData = $xeGanttView.internalData
504
- // const { scrollXLoad, scrollXWidth } = reactData
505
- // const { elemStore } = internalData
506
- // const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
507
- // const bodyTableElem = getRefElem(elemStore['main-body-table'])
508
- // let xSpaceLeft = 0
509
- // let clientWidth = 0
510
- // if (bodyScrollElem) {
511
- // clientWidth = bodyScrollElem.clientWidth
512
- // }
513
- // // 虚拟渲染
514
- // let isScrollXBig = false
515
- // let ySpaceWidth = scrollXWidth
516
- // if (scrollXWidth > maxXWidth) {
517
- // // 触右
518
- // if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
519
- // xSpaceLeft = maxXWidth - bodyTableElem.clientWidth
520
- // } else {
521
- // xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth))
522
- // }
523
- // ySpaceWidth = maxXWidth
524
- // isScrollXBig = true
525
- // }
526
- // if (bodyTableElem) {
527
- // bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`
528
- // }
529
- // const layoutList = ['header', 'body', 'footer']
530
- // layoutList.forEach(layout => {
531
- // const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
532
- // if (xSpaceElem) {
533
- // xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : ''
534
- // }
535
- // })
536
- // reactData.scrollXLeft = xSpaceLeft
537
- // reactData.scrollXWidth = ySpaceWidth
538
- // reactData.isScrollXBig = isScrollXBig
539
- // const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
540
- // if (scrollXSpaceEl) {
541
- // scrollXSpaceEl.style.width = `${ySpaceWidth}px`
542
- // }
543
- // calcScrollbar($xeGanttView)
544
- // return $xeGanttView.$nextTick().then(() => {
545
- // updateStyle($xeGanttView)
546
- // })
547
- // }
626
+ function updateScrollXStatus($xeGanttView) {
627
+ const reactData = $xeGanttView.reactData;
628
+ const scrollXLoad = true;
629
+ reactData.scrollXLoad = scrollXLoad;
630
+ return scrollXLoad;
631
+ }
632
+ function handleTableColumn($xeGanttView) {
633
+ const reactData = $xeGanttView.reactData;
634
+ const internalData = $xeGanttView.internalData;
635
+ const { scrollXLoad } = reactData;
636
+ const { visibleColumn, scrollXStore } = internalData;
637
+ const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
638
+ reactData.tableColumn = tableColumn;
639
+ }
640
+ function updateScrollXSpace($xeGanttView) {
641
+ const reactData = $xeGanttView.reactData;
642
+ const internalData = $xeGanttView.internalData;
643
+ const { scrollXLoad, scrollXWidth, viewCellWidth } = reactData;
644
+ const { elemStore, scrollXStore } = internalData;
645
+ const bodyTableElem = getRefElem(elemStore['main-body-table']);
646
+ // const headerTableElem = getRefElem(elemStore['main-header-table'])
647
+ // const footerTableElem = getRefElem(elemStore['main-footer-table'])
648
+ const { startIndex } = scrollXStore;
649
+ let xSpaceLeft = 0;
650
+ if (scrollXLoad) {
651
+ xSpaceLeft = Math.max(0, startIndex * viewCellWidth);
652
+ }
653
+ // if (headerTableElem) {
654
+ // headerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
655
+ // }
656
+ if (bodyTableElem) {
657
+ bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
658
+ }
659
+ // if (footerTableElem) {
660
+ // footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
661
+ // }
662
+ const layoutList = ['header', 'body', 'footer'];
663
+ layoutList.forEach(layout => {
664
+ const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`]);
665
+ if (xSpaceElem) {
666
+ xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
667
+ }
668
+ });
669
+ const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem;
670
+ if (scrollXSpaceEl) {
671
+ scrollXSpaceEl.style.width = `${scrollXWidth}px`;
672
+ }
673
+ calcScrollbar($xeGanttView);
674
+ return $xeGanttView.$nextTick();
675
+ }
676
+ function triggerScrollXEvent($xeGanttView) {
677
+ loadScrollXData($xeGanttView);
678
+ }
548
679
  function updateScrollYSpace($xeGanttView) {
549
680
  const reactData = $xeGanttView.reactData;
550
681
  const internalData = $xeGanttView.internalData;
@@ -673,6 +804,8 @@ export default defineVxeComponent({
673
804
  scrollbarWidth: 0,
674
805
  // 横向滚动条的高度
675
806
  scrollbarHeight: 0,
807
+ // 最后滚动时间戳
808
+ lastScrollTime: 0,
676
809
  lazScrollLoading: false,
677
810
  scrollVMLoading: false,
678
811
  scrollYHeight: 0,
@@ -791,8 +924,10 @@ export default defineVxeComponent({
791
924
  },
792
925
  triggerBodyScrollEvent(evnt) {
793
926
  const $xeGanttView = this;
927
+ const reactData = $xeGanttView.reactData;
794
928
  const internalData = $xeGanttView.internalData;
795
- const { elemStore, inVirtualScroll, inHeaderScroll, inFooterScroll } = internalData;
929
+ const { scrollXLoad } = reactData;
930
+ const { elemStore, inVirtualScroll, inHeaderScroll, inFooterScroll, lastScrollLeft, lastScrollTop } = internalData;
796
931
  if (inVirtualScroll) {
797
932
  return;
798
933
  }
@@ -803,40 +938,49 @@ export default defineVxeComponent({
803
938
  const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
804
939
  const xHandleEl = $xeGanttView.$refs.refScrollXHandleElem;
805
940
  const yHandleEl = $xeGanttView.$refs.refScrollYHandleElem;
806
- if (headerScrollElem && wrapperEl) {
807
- const isRollX = true;
808
- const isRollY = true;
809
- const currLeftNum = wrapperEl.scrollLeft;
810
- const currTopNum = wrapperEl.scrollTop;
811
- internalData.inBodyScroll = true;
812
- setScrollLeft(xHandleEl, currLeftNum);
813
- setScrollLeft(headerScrollElem, currLeftNum);
814
- setScrollTop(yHandleEl, currTopNum);
815
- syncTableScrollTop($xeGanttView, currTopNum);
816
- handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
941
+ const scrollLeft = wrapperEl.scrollLeft;
942
+ const scrollTop = wrapperEl.scrollTop;
943
+ const isRollX = scrollLeft !== lastScrollLeft;
944
+ const isRollY = scrollTop !== lastScrollTop;
945
+ internalData.inBodyScroll = true;
946
+ internalData.scrollRenderType = '';
947
+ if (isRollY) {
948
+ setScrollTop(yHandleEl, scrollTop);
949
+ syncTableScrollTop($xeGanttView, scrollTop);
817
950
  }
818
- },
819
- triggerFooterScrollEvent(evnt) {
820
- const $xeGanttView = this;
821
- const internalData = $xeGanttView.internalData;
822
- const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
823
- if (inVirtualScroll) {
824
- return;
825
- }
826
- if (inHeaderScroll || inBodyScroll) {
827
- return;
828
- }
829
- const wrapperEl = evnt.currentTarget;
830
- if (wrapperEl) {
831
- const isRollX = true;
832
- const isRollY = false;
833
- const currLeftNum = wrapperEl.scrollLeft;
834
- handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
951
+ if (isRollX) {
952
+ internalData.inBodyScroll = true;
953
+ setScrollLeft(xHandleEl, scrollLeft);
954
+ setScrollLeft(headerScrollElem, scrollLeft);
955
+ if (scrollXLoad) {
956
+ triggerScrollXEvent($xeGanttView);
957
+ }
835
958
  }
959
+ handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
836
960
  },
961
+ // triggerFooterScrollEvent (evnt: Event) {
962
+ // const $xeGanttView = this
963
+ // const internalData = $xeGanttView.internalData
964
+ // const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
965
+ // if (inVirtualScroll) {
966
+ // return
967
+ // }
968
+ // if (inHeaderScroll || inBodyScroll) {
969
+ // return
970
+ // }
971
+ // const wrapperEl = evnt.currentTarget as HTMLDivElement
972
+ // if (wrapperEl) {
973
+ // const isRollX = true
974
+ // const isRollY = false
975
+ // const currLeftNum = wrapperEl.scrollLeft
976
+ // handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
977
+ // }
978
+ // },
837
979
  triggerVirtualScrollXEvent(evnt) {
838
980
  const $xeGanttView = this;
981
+ const reactData = $xeGanttView.reactData;
839
982
  const internalData = $xeGanttView.internalData;
983
+ const { scrollXLoad } = reactData;
840
984
  const { elemStore, inHeaderScroll, inBodyScroll } = internalData;
841
985
  if (inHeaderScroll || inBodyScroll) {
842
986
  return;
@@ -851,6 +995,9 @@ export default defineVxeComponent({
851
995
  internalData.inVirtualScroll = true;
852
996
  setScrollLeft(headerScrollElem, currLeftNum);
853
997
  setScrollLeft(bodyScrollElem, currLeftNum);
998
+ if (scrollXLoad) {
999
+ triggerScrollXEvent($xeGanttView);
1000
+ }
854
1001
  handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
855
1002
  }
856
1003
  },
@@ -875,23 +1022,7 @@ export default defineVxeComponent({
875
1022
  },
876
1023
  handleUpdateSXSpace() {
877
1024
  const $xeGanttView = this;
878
- const reactData = $xeGanttView.reactData;
879
- const internalData = $xeGanttView.internalData;
880
- const { scrollXLoad, scrollXWidth } = reactData;
881
- const { elemStore } = internalData;
882
- const layoutList = ['header', 'body', 'footer'];
883
- layoutList.forEach(layout => {
884
- const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`]);
885
- if (xSpaceElem) {
886
- xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
887
- }
888
- });
889
- const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem;
890
- if (scrollXSpaceEl) {
891
- scrollXSpaceEl.style.width = `${scrollXWidth}px`;
892
- }
893
- calcScrollbar($xeGanttView);
894
- return $xeGanttView.$nextTick();
1025
+ return updateScrollXSpace($xeGanttView);
895
1026
  },
896
1027
  handleUpdateSYSpace() {
897
1028
  const $xeGanttView = this;