vxe-gantt 3.0.5 → 3.0.7

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.
Files changed (42) hide show
  1. package/es/gantt/src/gantt-chart.js +18 -4
  2. package/es/gantt/src/gantt-header.js +19 -10
  3. package/es/gantt/src/gantt-view.js +265 -154
  4. package/es/gantt/src/gantt.js +10 -10
  5. package/es/gantt/style.css +7 -1
  6. package/es/gantt/style.min.css +1 -1
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-gantt/style.css +7 -1
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-chart.js +22 -5
  14. package/lib/gantt/src/gantt-chart.min.js +1 -1
  15. package/lib/gantt/src/gantt-header.js +24 -15
  16. package/lib/gantt/src/gantt-header.min.js +1 -1
  17. package/lib/gantt/src/gantt-view.js +285 -158
  18. package/lib/gantt/src/gantt-view.min.js +1 -1
  19. package/lib/gantt/src/gantt.js +9 -9
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/style/style.css +7 -1
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +345 -190
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +1 -1
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-gantt/style/style.css +7 -1
  32. package/lib/vxe-gantt/style/style.min.css +1 -1
  33. package/package.json +3 -3
  34. package/packages/gantt/src/gantt-chart.ts +20 -4
  35. package/packages/gantt/src/gantt-header.ts +20 -11
  36. package/packages/gantt/src/gantt-view.ts +289 -168
  37. package/packages/gantt/src/gantt.ts +8 -8
  38. package/styles/components/gantt-module/gantt-chart.scss +2 -0
  39. package/styles/components/gantt.scss +6 -1
  40. package/styles/theme/base.scss +1 -1
  41. package/styles/theme/dark.scss +1 -0
  42. package/styles/theme/light.scss +1 -0
@@ -16,6 +16,7 @@ const { globalEvents } = VxeUI
16
16
  function createInternalData (): GanttViewInternalData {
17
17
  return {
18
18
  xeTable: null,
19
+ visibleColumn: [],
19
20
  startMaps: {},
20
21
  endMaps: {},
21
22
  chartMaps: {},
@@ -30,16 +31,9 @@ function createInternalData (): GanttViewInternalData {
30
31
  startIndex: 0,
31
32
  endIndex: 0
32
33
  },
33
- // 存放纵向 Y 虚拟滚动相关信息
34
- scrollYStore: {
35
- preloadSize: 0,
36
- offsetSize: 0,
37
- visibleSize: 0,
38
- visibleStartIndex: 0,
39
- visibleEndIndex: 0,
40
- startIndex: 0,
41
- endIndex: 0
42
- }
34
+ // 最后滚动位置
35
+ lastScrollTop: 0,
36
+ lastScrollLeft: 0
43
37
  }
44
38
  }
45
39
  const maxYHeight = 5e6
@@ -63,9 +57,12 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
63
57
  const { treeConfig } = ganttProps
64
58
  const { taskScaleList } = ganttReactData
65
59
  const { minViewDate, maxViewDate } = reactData
60
+ const { scrollXStore } = internalData
66
61
  const minScale = XEUtils.last(taskScaleList)
67
62
  const fullCols: VxeGanttDefines.ViewColumn[] = []
68
- const groupCols: VxeGanttDefines.HeaderColumn[] = []
63
+ const groupCols: VxeGanttDefines.GroupColumn[] = []
64
+ scrollXStore.startIndex = 0
65
+ scrollXStore.endIndex = 1
69
66
  if (minScale && minViewDate && maxViewDate) {
70
67
  const minSType = minScale.type
71
68
  const weekScale = taskScaleList.find(item => item.type === 'week')
@@ -88,37 +85,37 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
88
85
  const diffDayNum = maxViewDate.getTime() - minViewDate.getTime()
89
86
  const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1)
90
87
 
91
- switch (minScale.type) {
92
- case 'day':
93
- case 'date':
94
- if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
95
- reactData.tableColumn = []
96
- reactData.headerGroups = []
97
- return
98
- }
99
- break
100
- case 'hour':
101
- if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
102
- reactData.tableColumn = []
103
- reactData.headerGroups = []
104
- return
105
- }
106
- break
107
- case 'minute':
108
- if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
109
- reactData.tableColumn = []
110
- reactData.headerGroups = []
111
- return
112
- }
113
- break
114
- case 'second':
115
- if (diffDayNum > (1000 * 60 * 60 * 3)) {
116
- reactData.tableColumn = []
117
- reactData.headerGroups = []
118
- return
119
- }
120
- break
121
- }
88
+ // switch (minScale.type) {
89
+ // case 'day':
90
+ // case 'date':
91
+ // if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
92
+ // reactData.tableColumn = []
93
+ // reactData.headerGroups = []
94
+ // return
95
+ // }
96
+ // break
97
+ // case 'hour':
98
+ // if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
99
+ // reactData.tableColumn = []
100
+ // reactData.headerGroups = []
101
+ // return
102
+ // }
103
+ // break
104
+ // case 'minute':
105
+ // if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
106
+ // reactData.tableColumn = []
107
+ // reactData.headerGroups = []
108
+ // return
109
+ // }
110
+ // break
111
+ // case 'second':
112
+ // if (diffDayNum > (1000 * 60 * 60 * 3)) {
113
+ // reactData.tableColumn = []
114
+ // reactData.headerGroups = []
115
+ // return
116
+ // }
117
+ // break
118
+ // }
122
119
 
123
120
  const renderListMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn[]> = {
124
121
  year: [],
@@ -163,7 +160,6 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
163
160
  currGpCol.children.push(minCol)
164
161
  }
165
162
  }
166
-
167
163
  for (let i = 0; i < countSize; i++) {
168
164
  const itemDate = new Date(currTime + (i * gapTime))
169
165
  const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
@@ -176,47 +172,47 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
176
172
  year: {
177
173
  field: yyyy,
178
174
  title: yyyy,
179
- params: dateObj
175
+ dateObj
180
176
  },
181
177
  quarter: {
182
178
  field: `${yyyy}_q${q}`,
183
- title: q,
184
- params: dateObj
179
+ title: `${q}`,
180
+ dateObj
185
181
  },
186
182
  month: {
187
183
  field: `${yyyy}_${MM}`,
188
184
  title: MM,
189
- params: dateObj
185
+ dateObj
190
186
  },
191
187
  week: {
192
188
  field: `${yyyy}_W${W}`,
193
- title: W,
194
- params: dateObj
189
+ title: `${W}`,
190
+ dateObj
195
191
  },
196
192
  day: {
197
193
  field: `${yyyy}_${MM}_${dd}_E${E}`,
198
- title: E,
199
- params: dateObj
194
+ title: `${E}`,
195
+ dateObj
200
196
  },
201
197
  date: {
202
198
  field: `${yyyy}_${MM}_${dd}`,
203
199
  title: dd,
204
- params: dateObj
200
+ dateObj
205
201
  },
206
202
  hour: {
207
203
  field: `${yyyy}_${MM}_${dd}_${HH}`,
208
204
  title: HH,
209
- params: dateObj
205
+ dateObj
210
206
  },
211
207
  minute: {
212
208
  field: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
213
209
  title: mm,
214
- params: dateObj
210
+ dateObj
215
211
  },
216
212
  second: {
217
213
  field: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`,
218
214
  title: ss,
219
- params: dateObj
215
+ dateObj
220
216
  }
221
217
  }
222
218
  const minCol = colMaps[minSType]
@@ -306,8 +302,10 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
306
302
  internalData.chartMaps = ctMaps
307
303
  }
308
304
  }
309
- reactData.tableColumn = fullCols
305
+ internalData.visibleColumn = fullCols
310
306
  reactData.headerGroups = groupCols
307
+ updateScrollXStatus($xeGanttView)
308
+ handleTableColumn($xeGanttView)
311
309
  }
312
310
 
313
311
  function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
@@ -417,8 +415,8 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
417
415
  const reactData = $xeGanttView.reactData
418
416
  const internalData = $xeGanttView.internalData
419
417
 
420
- const { scrollbarWidth, scrollbarHeight, tableColumn, headerGroups } = reactData
421
- const { elemStore } = internalData
418
+ const { scrollbarWidth, scrollbarHeight, headerGroups, tableColumn } = reactData
419
+ const { elemStore, visibleColumn } = internalData
422
420
  const $xeTable = internalData.xeTable
423
421
 
424
422
  const el = $xeGanttView.$refs.refElem as HTMLDivElement
@@ -509,25 +507,28 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
509
507
  }
510
508
 
511
509
  const colInfoElem = $xeGanttView.$refs.refColInfoElem as HTMLDivElement
510
+ let viewCellWidth = 40
512
511
  if (colInfoElem) {
513
- reactData.viewCellWidth = colInfoElem.clientWidth || 40
512
+ viewCellWidth = colInfoElem.clientWidth || 40
514
513
  }
515
- let viewTableWidth = reactData.viewCellWidth * tableColumn.length
514
+ let viewTableWidth = viewCellWidth * visibleColumn.length
516
515
  if (bodyScrollElem) {
517
516
  const viewWidth = bodyScrollElem.clientWidth
518
517
  const remainWidth = viewWidth - viewTableWidth
519
518
  if (remainWidth > 0) {
520
- reactData.viewCellWidth += Math.floor(remainWidth / tableColumn.length)
519
+ viewCellWidth += Math.floor(remainWidth / visibleColumn.length)
521
520
  viewTableWidth = viewWidth
522
521
  }
523
522
  }
523
+ reactData.viewCellWidth = viewCellWidth
524
524
  const headerTableElem = getRefElem(elemStore['main-header-table'])
525
525
  const bodyTableElem = getRefElem(elemStore['main-body-table'])
526
+ const vmTableWidth = viewCellWidth * tableColumn.length
526
527
  if (headerTableElem) {
527
528
  headerTableElem.style.width = `${viewTableWidth}px`
528
529
  }
529
530
  if (bodyTableElem) {
530
- bodyTableElem.style.width = `${viewTableWidth}px`
531
+ bodyTableElem.style.width = `${vmTableWidth}px`
531
532
  }
532
533
 
533
534
  reactData.scrollXWidth = viewTableWidth
@@ -535,68 +536,191 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
535
536
  return updateChart($xeGanttView)
536
537
  }
537
538
 
538
- function handleLazyRecalculate ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
539
+ function handleRecalculateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
540
+ const internalData = $xeGanttView.internalData
541
+
542
+ const el = $xeGanttView.$refs.refElem as HTMLDivElement
543
+ internalData.rceRunTime = Date.now()
544
+ if (!el || !el.clientWidth) {
545
+ return $xeGanttView.$nextTick()
546
+ }
539
547
  calcScrollbar($xeGanttView)
540
548
  updateStyle($xeGanttView)
541
549
  updateChart($xeGanttView)
550
+ return computeScrollLoad($xeGanttView)
551
+ }
552
+
553
+ function handleLazyRecalculate ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
554
+ const internalData = $xeGanttView.internalData
555
+
556
+ return new Promise<void>(resolve => {
557
+ const { rceTimeout, rceRunTime } = internalData
558
+ const $xeTable = internalData.xeTable
559
+ let refreshDelay = 50
560
+ if ($xeTable) {
561
+ const resizeOpts = $xeTable.computeResizeOpts
562
+ refreshDelay = resizeOpts.refreshDelay || 50
563
+ }
564
+ if (rceTimeout) {
565
+ clearTimeout(rceTimeout)
566
+ if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
567
+ resolve(
568
+ handleRecalculateStyle($xeGanttView)
569
+ )
570
+ } else {
571
+ $xeGanttView.$nextTick(() => {
572
+ resolve()
573
+ })
574
+ }
575
+ } else {
576
+ resolve(
577
+ handleRecalculateStyle($xeGanttView)
578
+ )
579
+ }
580
+ internalData.rceTimeout = setTimeout(() => {
581
+ internalData.rceTimeout = undefined
582
+ handleRecalculateStyle($xeGanttView)
583
+ }, refreshDelay)
584
+ })
585
+ }
586
+
587
+ function computeScrollLoad ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
588
+ const reactData = $xeGanttView.reactData
589
+ const internalData = $xeGanttView.internalData
590
+
591
+ return $xeGanttView.$nextTick().then(() => {
592
+ const { scrollXLoad } = reactData
593
+ const { scrollXStore } = internalData
594
+ // 计算 X 逻辑
595
+ if (scrollXLoad) {
596
+ const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible($xeGanttView)
597
+ const offsetXSize = 2
598
+ scrollXStore.preloadSize = 1
599
+ scrollXStore.offsetSize = offsetXSize
600
+ scrollXStore.visibleSize = visibleXSize
601
+ scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex)
602
+ scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex)
603
+ scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize)
604
+ updateScrollXData($xeGanttView).then(() => {
605
+ loadScrollXData($xeGanttView)
606
+ })
607
+ } else {
608
+ updateScrollXSpace($xeGanttView)
609
+ }
610
+ })
611
+ }
612
+
613
+ function handleVirtualXVisible ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
614
+ const reactData = $xeGanttView.reactData
615
+ const internalData = $xeGanttView.internalData
616
+
617
+ const { viewCellWidth } = reactData
618
+ const { elemStore } = internalData
619
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
620
+ if (bodyScrollElem) {
621
+ const clientWidth = bodyScrollElem.clientWidth
622
+ const scrollLeft = bodyScrollElem.scrollLeft
623
+ const toVisibleIndex = Math.floor(scrollLeft / viewCellWidth) - 1
624
+ const visibleSize = Math.ceil(clientWidth / viewCellWidth) + 1
625
+ return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(1, visibleSize) }
626
+ }
627
+ return { toVisibleIndex: 0, visibleSize: 6 }
628
+ }
629
+
630
+ function loadScrollXData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
631
+ const reactData = $xeGanttView.reactData
632
+ const internalData = $xeGanttView.internalData
633
+
634
+ const { isScrollXBig } = reactData
635
+ const { scrollXStore } = internalData
636
+ const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore
637
+ const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeGanttView)
638
+ const offsetItem = {
639
+ startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
640
+ endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
641
+ }
642
+ scrollXStore.visibleStartIndex = toVisibleIndex - 1
643
+ scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1
644
+ const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
645
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
646
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
647
+ scrollXStore.startIndex = offsetStartIndex
648
+ scrollXStore.endIndex = offsetEndIndex
649
+ updateScrollXData($xeGanttView)
650
+ }
651
+ }
652
+ }
653
+
654
+ function updateScrollXData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
655
+ handleTableColumn($xeGanttView)
656
+ updateScrollXSpace($xeGanttView)
542
657
  return $xeGanttView.$nextTick()
543
658
  }
544
659
 
545
- // function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
546
- // const reactData = $xeGanttView.reactData
547
- // const internalData = $xeGanttView.internalData
548
-
549
- // const { scrollXLoad, scrollXWidth } = reactData
550
- // const { elemStore } = internalData
551
- // const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
552
- // const bodyTableElem = getRefElem(elemStore['main-body-table'])
553
-
554
- // let xSpaceLeft = 0
555
-
556
- // let clientWidth = 0
557
- // if (bodyScrollElem) {
558
- // clientWidth = bodyScrollElem.clientWidth
559
- // }
560
- // // 虚拟渲染
561
- // let isScrollXBig = false
562
- // let ySpaceWidth = scrollXWidth
563
- // if (scrollXWidth > maxXWidth) {
564
- // // 触右
565
- // if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
566
- // xSpaceLeft = maxXWidth - bodyTableElem.clientWidth
567
- // } else {
568
- // xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth))
569
- // }
570
- // ySpaceWidth = maxXWidth
571
- // isScrollXBig = true
572
- // }
573
-
574
- // if (bodyTableElem) {
575
- // bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`
576
- // }
577
-
578
- // const layoutList = ['header', 'body', 'footer']
579
- // layoutList.forEach(layout => {
580
- // const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
581
- // if (xSpaceElem) {
582
- // xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : ''
583
- // }
584
- // })
585
-
586
- // reactData.scrollXLeft = xSpaceLeft
587
- // reactData.scrollXWidth = ySpaceWidth
588
- // reactData.isScrollXBig = isScrollXBig
589
-
590
- // const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
591
- // if (scrollXSpaceEl) {
592
- // scrollXSpaceEl.style.width = `${ySpaceWidth}px`
593
- // }
594
-
595
- // calcScrollbar($xeGanttView)
596
- // return $xeGanttView.$nextTick().then(() => {
597
- // updateStyle($xeGanttView)
598
- // })
599
- // }
660
+ function updateScrollXStatus ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
661
+ const reactData = $xeGanttView.reactData
662
+
663
+ const scrollXLoad = true
664
+ reactData.scrollXLoad = scrollXLoad
665
+ return scrollXLoad
666
+ }
667
+
668
+ function handleTableColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
669
+ const reactData = $xeGanttView.reactData
670
+ const internalData = $xeGanttView.internalData
671
+
672
+ const { scrollXLoad } = reactData
673
+ const { visibleColumn, scrollXStore } = internalData
674
+ const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0)
675
+ reactData.tableColumn = tableColumn
676
+ }
677
+
678
+ function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
679
+ const reactData = $xeGanttView.reactData
680
+ const internalData = $xeGanttView.internalData
681
+
682
+ const { scrollXLoad, scrollXWidth, viewCellWidth } = reactData
683
+ const { elemStore, scrollXStore } = internalData
684
+ const bodyTableElem = getRefElem(elemStore['main-body-table'])
685
+ // const headerTableElem = getRefElem(elemStore['main-header-table'])
686
+ // const footerTableElem = getRefElem(elemStore['main-footer-table'])
687
+
688
+ const { startIndex } = scrollXStore
689
+ let xSpaceLeft = 0
690
+ if (scrollXLoad) {
691
+ xSpaceLeft = Math.max(0, startIndex * viewCellWidth)
692
+ }
693
+
694
+ // if (headerTableElem) {
695
+ // headerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
696
+ // }
697
+ if (bodyTableElem) {
698
+ bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`
699
+ }
700
+ // if (footerTableElem) {
701
+ // footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
702
+ // }
703
+
704
+ const layoutList = ['header', 'body', 'footer']
705
+ layoutList.forEach(layout => {
706
+ const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
707
+ if (xSpaceElem) {
708
+ xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : ''
709
+ }
710
+ })
711
+
712
+ const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
713
+ if (scrollXSpaceEl) {
714
+ scrollXSpaceEl.style.width = `${scrollXWidth}px`
715
+ }
716
+
717
+ calcScrollbar($xeGanttView)
718
+ return $xeGanttView.$nextTick()
719
+ }
720
+
721
+ function triggerScrollXEvent ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
722
+ loadScrollXData($xeGanttView)
723
+ }
600
724
 
601
725
  function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
602
726
  const reactData = $xeGanttView.reactData
@@ -742,6 +866,8 @@ export default defineVxeComponent({
742
866
  // 横向滚动条的高度
743
867
  scrollbarHeight: 0,
744
868
 
869
+ // 最后滚动时间戳
870
+ lastScrollTime: 0,
745
871
  lazScrollLoading: false,
746
872
 
747
873
  scrollVMLoading: false,
@@ -877,9 +1003,11 @@ export default defineVxeComponent({
877
1003
  },
878
1004
  triggerBodyScrollEvent (evnt: Event) {
879
1005
  const $xeGanttView = this
1006
+ const reactData = $xeGanttView.reactData
880
1007
  const internalData = $xeGanttView.internalData
881
1008
 
882
- const { elemStore, inVirtualScroll, inHeaderScroll, inFooterScroll } = internalData
1009
+ const { scrollXLoad } = reactData
1010
+ const { elemStore, inVirtualScroll, inHeaderScroll, inFooterScroll, lastScrollLeft, lastScrollTop } = internalData
883
1011
  if (inVirtualScroll) {
884
1012
  return
885
1013
  }
@@ -890,42 +1018,51 @@ export default defineVxeComponent({
890
1018
  const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
891
1019
  const xHandleEl = $xeGanttView.$refs.refScrollXHandleElem as HTMLDivElement
892
1020
  const yHandleEl = $xeGanttView.$refs.refScrollYHandleElem as HTMLDivElement
893
- if (headerScrollElem && wrapperEl) {
894
- const isRollX = true
895
- const isRollY = true
896
- const currLeftNum = wrapperEl.scrollLeft
897
- const currTopNum = wrapperEl.scrollTop
898
- internalData.inBodyScroll = true
899
- setScrollLeft(xHandleEl, currLeftNum)
900
- setScrollLeft(headerScrollElem, currLeftNum)
901
- setScrollTop(yHandleEl, currTopNum)
902
- syncTableScrollTop($xeGanttView, currTopNum)
903
- handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
1021
+ const scrollLeft = wrapperEl.scrollLeft
1022
+ const scrollTop = wrapperEl.scrollTop
1023
+ const isRollX = scrollLeft !== lastScrollLeft
1024
+ const isRollY = scrollTop !== lastScrollTop
1025
+ internalData.inBodyScroll = true
1026
+ internalData.scrollRenderType = ''
1027
+ if (isRollY) {
1028
+ setScrollTop(yHandleEl, scrollTop)
1029
+ syncTableScrollTop($xeGanttView, scrollTop)
904
1030
  }
905
- },
906
- triggerFooterScrollEvent (evnt: Event) {
907
- const $xeGanttView = this
908
- const internalData = $xeGanttView.internalData
909
-
910
- const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
911
- if (inVirtualScroll) {
912
- return
913
- }
914
- if (inHeaderScroll || inBodyScroll) {
915
- return
916
- }
917
- const wrapperEl = evnt.currentTarget as HTMLDivElement
918
- if (wrapperEl) {
919
- const isRollX = true
920
- const isRollY = false
921
- const currLeftNum = wrapperEl.scrollLeft
922
- handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
1031
+ if (isRollX) {
1032
+ internalData.inBodyScroll = true
1033
+ setScrollLeft(xHandleEl, scrollLeft)
1034
+ setScrollLeft(headerScrollElem, scrollLeft)
1035
+ if (scrollXLoad) {
1036
+ triggerScrollXEvent($xeGanttView)
1037
+ }
923
1038
  }
1039
+ handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft)
924
1040
  },
1041
+ // triggerFooterScrollEvent (evnt: Event) {
1042
+ // const $xeGanttView = this
1043
+ // const internalData = $xeGanttView.internalData
1044
+
1045
+ // const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
1046
+ // if (inVirtualScroll) {
1047
+ // return
1048
+ // }
1049
+ // if (inHeaderScroll || inBodyScroll) {
1050
+ // return
1051
+ // }
1052
+ // const wrapperEl = evnt.currentTarget as HTMLDivElement
1053
+ // if (wrapperEl) {
1054
+ // const isRollX = true
1055
+ // const isRollY = false
1056
+ // const currLeftNum = wrapperEl.scrollLeft
1057
+ // handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
1058
+ // }
1059
+ // },
925
1060
  triggerVirtualScrollXEvent (evnt: Event) {
926
1061
  const $xeGanttView = this
1062
+ const reactData = $xeGanttView.reactData
927
1063
  const internalData = $xeGanttView.internalData
928
1064
 
1065
+ const { scrollXLoad } = reactData
929
1066
  const { elemStore, inHeaderScroll, inBodyScroll } = internalData
930
1067
  if (inHeaderScroll || inBodyScroll) {
931
1068
  return
@@ -940,6 +1077,9 @@ export default defineVxeComponent({
940
1077
  internalData.inVirtualScroll = true
941
1078
  setScrollLeft(headerScrollElem, currLeftNum)
942
1079
  setScrollLeft(bodyScrollElem, currLeftNum)
1080
+ if (scrollXLoad) {
1081
+ triggerScrollXEvent($xeGanttView)
1082
+ }
943
1083
  handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
944
1084
  }
945
1085
  },
@@ -965,27 +1105,8 @@ export default defineVxeComponent({
965
1105
  },
966
1106
  handleUpdateSXSpace () {
967
1107
  const $xeGanttView = this
968
- const reactData = $xeGanttView.reactData
969
- const internalData = $xeGanttView.internalData
970
-
971
- const { scrollXLoad, scrollXWidth } = reactData
972
- const { elemStore } = internalData
973
-
974
- const layoutList = ['header', 'body', 'footer']
975
- layoutList.forEach(layout => {
976
- const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
977
- if (xSpaceElem) {
978
- xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : ''
979
- }
980
- })
981
-
982
- const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
983
- if (scrollXSpaceEl) {
984
- scrollXSpaceEl.style.width = `${scrollXWidth}px`
985
- }
986
1108
 
987
- calcScrollbar($xeGanttView)
988
- return $xeGanttView.$nextTick()
1109
+ return updateScrollXSpace($xeGanttView)
989
1110
  },
990
1111
  handleUpdateSYSpace () {
991
1112
  const $xeGanttView = this
@@ -310,7 +310,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
310
310
  stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight)
311
311
  }
312
312
  }
313
- if (barStyle) {
313
+ if (barStyle && !XEUtils.isFunction(barStyle)) {
314
314
  const { bgColor, completedBgColor } = barStyle
315
315
  if (bgColor) {
316
316
  stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor
@@ -546,7 +546,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
546
546
  if (!scaleConfs.length) {
547
547
  scaleConfs.push(
548
548
  { type: 'month', level: viewTypeLevelMaps.month },
549
- { type: 'day', level: viewTypeLevelMaps.day }
549
+ { type: 'date', level: viewTypeLevelMaps.date }
550
550
  )
551
551
  }
552
552
  reactData.taskScaleList = XEUtils.orderBy(scaleConfs, { field: 'level', order: 'desc' })
@@ -835,20 +835,20 @@ export default /* define-vxe-component start */ defineVxeComponent({
835
835
  let tipHeight = 0
836
836
  if (rsNumLeftEl) {
837
837
  if (offsetLeft < 0) {
838
+ rsNumLeftEl.style.display = 'none'
839
+ } else {
838
840
  rsNumLeftEl.textContent = `${targetTableWidth}px`
839
841
  rsNumLeftEl.style.display = 'block'
840
842
  tipHeight = rsNumLeftEl.offsetHeight
841
- } else {
842
- rsNumLeftEl.style.display = 'none'
843
843
  }
844
844
  }
845
845
  if (rsNumRightEl) {
846
846
  if (offsetLeft < 0) {
847
- rsNumRightEl.style.display = 'none'
848
- } else {
849
847
  rsNumRightEl.textContent = `${Math.floor(containerRect.width - targetTableWidth)}px`
850
848
  rsNumRightEl.style.display = 'block'
851
849
  tipHeight = rsNumRightEl.offsetHeight
850
+ } else {
851
+ rsNumRightEl.style.display = 'none'
852
852
  }
853
853
  }
854
854
  const tipTop = evnt.clientY - containerRect.top - tipHeight / 2
@@ -2113,10 +2113,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
2113
2113
  }, [
2114
2114
  h('div', {
2115
2115
  class: 'vxe-gantt--resizable-split-number-left'
2116
- }, '10px'),
2116
+ }),
2117
2117
  h('div', {
2118
2118
  class: 'vxe-gantt--resizable-split-number-right'
2119
- }, '20px')
2119
+ })
2120
2120
  ])
2121
2121
  ]),
2122
2122
  h('div', {