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.
- package/es/gantt/src/gantt-header.js +5 -3
- package/es/gantt/src/gantt-view.js +281 -150
- package/es/gantt/src/gantt.js +9 -12
- package/es/gantt/style.css +5 -1
- package/es/gantt/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-gantt/style.css +5 -1
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/src/gantt-header.js +4 -3
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +305 -154
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +8 -11
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/style/style.css +5 -1
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +322 -171
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-gantt/style/style.css +5 -1
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/gantt-header.ts +5 -3
- package/packages/gantt/src/gantt-view.ts +302 -163
- package/packages/gantt/src/gantt.ts +7 -10
- package/styles/components/gantt.scss +6 -1
- package/styles/theme/dark.scss +1 -0
- 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
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
@@ -88,37 +82,37 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
88
82
|
const diffDayNum = maxViewDate.getTime() - minViewDate.getTime()
|
|
89
83
|
const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1)
|
|
90
84
|
|
|
91
|
-
switch (minScale.type) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
85
|
+
// switch (minScale.type) {
|
|
86
|
+
// case 'day':
|
|
87
|
+
// case 'date':
|
|
88
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
|
|
89
|
+
// reactData.tableColumn = []
|
|
90
|
+
// reactData.headerGroups = []
|
|
91
|
+
// return
|
|
92
|
+
// }
|
|
93
|
+
// break
|
|
94
|
+
// case 'hour':
|
|
95
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
|
|
96
|
+
// reactData.tableColumn = []
|
|
97
|
+
// reactData.headerGroups = []
|
|
98
|
+
// return
|
|
99
|
+
// }
|
|
100
|
+
// break
|
|
101
|
+
// case 'minute':
|
|
102
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
|
|
103
|
+
// reactData.tableColumn = []
|
|
104
|
+
// reactData.headerGroups = []
|
|
105
|
+
// return
|
|
106
|
+
// }
|
|
107
|
+
// break
|
|
108
|
+
// case 'second':
|
|
109
|
+
// if (diffDayNum > (1000 * 60 * 60 * 3)) {
|
|
110
|
+
// reactData.tableColumn = []
|
|
111
|
+
// reactData.headerGroups = []
|
|
112
|
+
// return
|
|
113
|
+
// }
|
|
114
|
+
// break
|
|
115
|
+
// }
|
|
122
116
|
|
|
123
117
|
const renderListMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn[]> = {
|
|
124
118
|
year: [],
|
|
@@ -163,7 +157,6 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
163
157
|
currGpCol.children.push(minCol)
|
|
164
158
|
}
|
|
165
159
|
}
|
|
166
|
-
|
|
167
160
|
for (let i = 0; i < countSize; i++) {
|
|
168
161
|
const itemDate = new Date(currTime + (i * gapTime))
|
|
169
162
|
const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
|
|
@@ -273,8 +266,11 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
273
266
|
if ($xeTable) {
|
|
274
267
|
const startField = $xeGantt.computeStartField
|
|
275
268
|
const endField = $xeGantt.computeEndField
|
|
269
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
270
|
+
const { isRowGroupStatus } = tableReactData
|
|
276
271
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
277
|
-
const { afterFullData, afterTreeFullData } = tableInternalData
|
|
272
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData
|
|
273
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
278
274
|
const treeOpts = $xeTable.computeTreeOpts
|
|
279
275
|
const { transform } = treeOpts
|
|
280
276
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -298,7 +294,14 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
298
294
|
}
|
|
299
295
|
}
|
|
300
296
|
|
|
301
|
-
if (
|
|
297
|
+
if (isRowGroupStatus) {
|
|
298
|
+
// 行分组
|
|
299
|
+
const mapChildrenField = aggregateOpts.mapChildrenField
|
|
300
|
+
if (mapChildrenField) {
|
|
301
|
+
XEUtils.eachTree(afterGroupFullData, handleParseRender, { children: mapChildrenField })
|
|
302
|
+
}
|
|
303
|
+
} else if (treeConfig) {
|
|
304
|
+
// 树结构
|
|
302
305
|
XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
303
306
|
} else {
|
|
304
307
|
afterFullData.forEach(handleParseRender)
|
|
@@ -306,8 +309,10 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
306
309
|
internalData.chartMaps = ctMaps
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
|
-
|
|
312
|
+
internalData.visibleColumn = fullCols
|
|
310
313
|
reactData.headerGroups = groupCols
|
|
314
|
+
updateScrollXStatus($xeGanttView)
|
|
315
|
+
handleTableColumn($xeGanttView)
|
|
311
316
|
}
|
|
312
317
|
|
|
313
318
|
function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
@@ -317,6 +322,7 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
|
|
|
317
322
|
|
|
318
323
|
const ganttProps = $xeGantt
|
|
319
324
|
const { treeConfig } = ganttProps
|
|
325
|
+
const { scrollXStore } = internalData
|
|
320
326
|
const $xeTable = internalData.xeTable
|
|
321
327
|
const sdMaps: Record<string, any> = {}
|
|
322
328
|
const edMaps: Record<string, any> = {}
|
|
@@ -325,8 +331,11 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
|
|
|
325
331
|
if ($xeTable) {
|
|
326
332
|
const startField = $xeGantt.computeStartField
|
|
327
333
|
const endField = $xeGantt.computeEndField
|
|
334
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
335
|
+
const { isRowGroupStatus } = tableReactData
|
|
328
336
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
329
|
-
const { afterFullData, afterTreeFullData } = tableInternalData
|
|
337
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData
|
|
338
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
330
339
|
const treeOpts = $xeTable.computeTreeOpts
|
|
331
340
|
const { transform } = treeOpts
|
|
332
341
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -346,12 +355,21 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
|
|
|
346
355
|
}
|
|
347
356
|
}
|
|
348
357
|
|
|
349
|
-
if (
|
|
358
|
+
if (isRowGroupStatus) {
|
|
359
|
+
// 行分组
|
|
360
|
+
const mapChildrenField = aggregateOpts.mapChildrenField
|
|
361
|
+
if (mapChildrenField) {
|
|
362
|
+
XEUtils.eachTree(afterGroupFullData, handleMinMaxData, { children: mapChildrenField })
|
|
363
|
+
}
|
|
364
|
+
} else if (treeConfig) {
|
|
365
|
+
// 树结构
|
|
350
366
|
XEUtils.eachTree(afterTreeFullData, handleMinMaxData, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
351
367
|
} else {
|
|
352
368
|
afterFullData.forEach(handleMinMaxData)
|
|
353
369
|
}
|
|
354
370
|
}
|
|
371
|
+
scrollXStore.startIndex = 0
|
|
372
|
+
scrollXStore.endIndex = Math.max(1, scrollXStore.visibleSize)
|
|
355
373
|
reactData.minViewDate = minDate
|
|
356
374
|
reactData.maxViewDate = maxDate
|
|
357
375
|
internalData.startMaps = sdMaps
|
|
@@ -403,10 +421,8 @@ function updateChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
403
421
|
}
|
|
404
422
|
const rowid = rowEl.getAttribute('rowid')
|
|
405
423
|
const rowRest = rowid ? chartMaps[rowid] : null
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`
|
|
409
|
-
}
|
|
424
|
+
barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`
|
|
425
|
+
barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`
|
|
410
426
|
})
|
|
411
427
|
}
|
|
412
428
|
return $xeGanttView.$nextTick()
|
|
@@ -417,8 +433,8 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
417
433
|
const reactData = $xeGanttView.reactData
|
|
418
434
|
const internalData = $xeGanttView.internalData
|
|
419
435
|
|
|
420
|
-
const { scrollbarWidth, scrollbarHeight,
|
|
421
|
-
const { elemStore } = internalData
|
|
436
|
+
const { scrollbarWidth, scrollbarHeight, headerGroups, tableColumn } = reactData
|
|
437
|
+
const { elemStore, visibleColumn } = internalData
|
|
422
438
|
const $xeTable = internalData.xeTable
|
|
423
439
|
|
|
424
440
|
const el = $xeGanttView.$refs.refElem as HTMLDivElement
|
|
@@ -509,25 +525,28 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
509
525
|
}
|
|
510
526
|
|
|
511
527
|
const colInfoElem = $xeGanttView.$refs.refColInfoElem as HTMLDivElement
|
|
528
|
+
let viewCellWidth = 40
|
|
512
529
|
if (colInfoElem) {
|
|
513
|
-
|
|
530
|
+
viewCellWidth = colInfoElem.clientWidth || 40
|
|
514
531
|
}
|
|
515
|
-
let viewTableWidth =
|
|
532
|
+
let viewTableWidth = viewCellWidth * visibleColumn.length
|
|
516
533
|
if (bodyScrollElem) {
|
|
517
534
|
const viewWidth = bodyScrollElem.clientWidth
|
|
518
535
|
const remainWidth = viewWidth - viewTableWidth
|
|
519
536
|
if (remainWidth > 0) {
|
|
520
|
-
|
|
537
|
+
viewCellWidth += Math.floor(remainWidth / visibleColumn.length)
|
|
521
538
|
viewTableWidth = viewWidth
|
|
522
539
|
}
|
|
523
540
|
}
|
|
541
|
+
reactData.viewCellWidth = viewCellWidth
|
|
524
542
|
const headerTableElem = getRefElem(elemStore['main-header-table'])
|
|
525
543
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
544
|
+
const vmTableWidth = viewCellWidth * tableColumn.length
|
|
526
545
|
if (headerTableElem) {
|
|
527
546
|
headerTableElem.style.width = `${viewTableWidth}px`
|
|
528
547
|
}
|
|
529
548
|
if (bodyTableElem) {
|
|
530
|
-
bodyTableElem.style.width = `${
|
|
549
|
+
bodyTableElem.style.width = `${vmTableWidth}px`
|
|
531
550
|
}
|
|
532
551
|
|
|
533
552
|
reactData.scrollXWidth = viewTableWidth
|
|
@@ -535,68 +554,191 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
535
554
|
return updateChart($xeGanttView)
|
|
536
555
|
}
|
|
537
556
|
|
|
538
|
-
function
|
|
557
|
+
function handleRecalculateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
558
|
+
const internalData = $xeGanttView.internalData
|
|
559
|
+
|
|
560
|
+
const el = $xeGanttView.$refs.refElem as HTMLDivElement
|
|
561
|
+
internalData.rceRunTime = Date.now()
|
|
562
|
+
if (!el || !el.clientWidth) {
|
|
563
|
+
return $xeGanttView.$nextTick()
|
|
564
|
+
}
|
|
539
565
|
calcScrollbar($xeGanttView)
|
|
540
566
|
updateStyle($xeGanttView)
|
|
541
567
|
updateChart($xeGanttView)
|
|
568
|
+
return computeScrollLoad($xeGanttView)
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function handleLazyRecalculate ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
572
|
+
const internalData = $xeGanttView.internalData
|
|
573
|
+
|
|
574
|
+
return new Promise<void>(resolve => {
|
|
575
|
+
const { rceTimeout, rceRunTime } = internalData
|
|
576
|
+
const $xeTable = internalData.xeTable
|
|
577
|
+
let refreshDelay = 50
|
|
578
|
+
if ($xeTable) {
|
|
579
|
+
const resizeOpts = $xeTable.computeResizeOpts
|
|
580
|
+
refreshDelay = resizeOpts.refreshDelay || 50
|
|
581
|
+
}
|
|
582
|
+
if (rceTimeout) {
|
|
583
|
+
clearTimeout(rceTimeout)
|
|
584
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
585
|
+
resolve(
|
|
586
|
+
handleRecalculateStyle($xeGanttView)
|
|
587
|
+
)
|
|
588
|
+
} else {
|
|
589
|
+
$xeGanttView.$nextTick(() => {
|
|
590
|
+
resolve()
|
|
591
|
+
})
|
|
592
|
+
}
|
|
593
|
+
} else {
|
|
594
|
+
resolve(
|
|
595
|
+
handleRecalculateStyle($xeGanttView)
|
|
596
|
+
)
|
|
597
|
+
}
|
|
598
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
599
|
+
internalData.rceTimeout = undefined
|
|
600
|
+
handleRecalculateStyle($xeGanttView)
|
|
601
|
+
}, refreshDelay)
|
|
602
|
+
})
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function computeScrollLoad ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
606
|
+
const reactData = $xeGanttView.reactData
|
|
607
|
+
const internalData = $xeGanttView.internalData
|
|
608
|
+
|
|
609
|
+
return $xeGanttView.$nextTick().then(() => {
|
|
610
|
+
const { scrollXLoad } = reactData
|
|
611
|
+
const { scrollXStore } = internalData
|
|
612
|
+
// 计算 X 逻辑
|
|
613
|
+
if (scrollXLoad) {
|
|
614
|
+
const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible($xeGanttView)
|
|
615
|
+
const offsetXSize = 2
|
|
616
|
+
scrollXStore.preloadSize = 1
|
|
617
|
+
scrollXStore.offsetSize = offsetXSize
|
|
618
|
+
scrollXStore.visibleSize = visibleXSize
|
|
619
|
+
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex)
|
|
620
|
+
scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex)
|
|
621
|
+
scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize)
|
|
622
|
+
updateScrollXData($xeGanttView).then(() => {
|
|
623
|
+
loadScrollXData($xeGanttView)
|
|
624
|
+
})
|
|
625
|
+
} else {
|
|
626
|
+
updateScrollXSpace($xeGanttView)
|
|
627
|
+
}
|
|
628
|
+
})
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function handleVirtualXVisible ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
632
|
+
const reactData = $xeGanttView.reactData
|
|
633
|
+
const internalData = $xeGanttView.internalData
|
|
634
|
+
|
|
635
|
+
const { viewCellWidth } = reactData
|
|
636
|
+
const { elemStore } = internalData
|
|
637
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
638
|
+
if (bodyScrollElem) {
|
|
639
|
+
const clientWidth = bodyScrollElem.clientWidth
|
|
640
|
+
const scrollLeft = bodyScrollElem.scrollLeft
|
|
641
|
+
const toVisibleIndex = Math.floor(scrollLeft / viewCellWidth) - 1
|
|
642
|
+
const visibleSize = Math.ceil(clientWidth / viewCellWidth) + 1
|
|
643
|
+
return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(1, visibleSize) }
|
|
644
|
+
}
|
|
645
|
+
return { toVisibleIndex: 0, visibleSize: 6 }
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function loadScrollXData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
649
|
+
const reactData = $xeGanttView.reactData
|
|
650
|
+
const internalData = $xeGanttView.internalData
|
|
651
|
+
|
|
652
|
+
const { isScrollXBig } = reactData
|
|
653
|
+
const { scrollXStore } = internalData
|
|
654
|
+
const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore
|
|
655
|
+
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeGanttView)
|
|
656
|
+
const offsetItem = {
|
|
657
|
+
startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
658
|
+
endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
659
|
+
}
|
|
660
|
+
scrollXStore.visibleStartIndex = toVisibleIndex - 1
|
|
661
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1
|
|
662
|
+
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
|
|
663
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
664
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
665
|
+
scrollXStore.startIndex = offsetStartIndex
|
|
666
|
+
scrollXStore.endIndex = offsetEndIndex
|
|
667
|
+
updateScrollXData($xeGanttView)
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function updateScrollXData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
673
|
+
handleTableColumn($xeGanttView)
|
|
674
|
+
updateScrollXSpace($xeGanttView)
|
|
675
|
+
return $xeGanttView.$nextTick()
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function updateScrollXStatus ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
679
|
+
const reactData = $xeGanttView.reactData
|
|
680
|
+
|
|
681
|
+
const scrollXLoad = true
|
|
682
|
+
reactData.scrollXLoad = scrollXLoad
|
|
683
|
+
return scrollXLoad
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function handleTableColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
687
|
+
const reactData = $xeGanttView.reactData
|
|
688
|
+
const internalData = $xeGanttView.internalData
|
|
689
|
+
|
|
690
|
+
const { scrollXLoad } = reactData
|
|
691
|
+
const { visibleColumn, scrollXStore } = internalData
|
|
692
|
+
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0)
|
|
693
|
+
reactData.tableColumn = tableColumn
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
697
|
+
const reactData = $xeGanttView.reactData
|
|
698
|
+
const internalData = $xeGanttView.internalData
|
|
699
|
+
|
|
700
|
+
const { scrollXLoad, scrollXWidth, viewCellWidth } = reactData
|
|
701
|
+
const { elemStore, scrollXStore } = internalData
|
|
702
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
703
|
+
// const headerTableElem = getRefElem(elemStore['main-header-table'])
|
|
704
|
+
// const footerTableElem = getRefElem(elemStore['main-footer-table'])
|
|
705
|
+
|
|
706
|
+
const { startIndex } = scrollXStore
|
|
707
|
+
let xSpaceLeft = 0
|
|
708
|
+
if (scrollXLoad) {
|
|
709
|
+
xSpaceLeft = Math.max(0, startIndex * viewCellWidth)
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// if (headerTableElem) {
|
|
713
|
+
// headerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
714
|
+
// }
|
|
715
|
+
if (bodyTableElem) {
|
|
716
|
+
bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`
|
|
717
|
+
}
|
|
718
|
+
// if (footerTableElem) {
|
|
719
|
+
// footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
720
|
+
// }
|
|
721
|
+
|
|
722
|
+
const layoutList = ['header', 'body', 'footer']
|
|
723
|
+
layoutList.forEach(layout => {
|
|
724
|
+
const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
|
|
725
|
+
if (xSpaceElem) {
|
|
726
|
+
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : ''
|
|
727
|
+
}
|
|
728
|
+
})
|
|
729
|
+
|
|
730
|
+
const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
|
|
731
|
+
if (scrollXSpaceEl) {
|
|
732
|
+
scrollXSpaceEl.style.width = `${scrollXWidth}px`
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
calcScrollbar($xeGanttView)
|
|
542
736
|
return $xeGanttView.$nextTick()
|
|
543
737
|
}
|
|
544
738
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
-
// }
|
|
739
|
+
function triggerScrollXEvent ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
740
|
+
loadScrollXData($xeGanttView)
|
|
741
|
+
}
|
|
600
742
|
|
|
601
743
|
function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
602
744
|
const reactData = $xeGanttView.reactData
|
|
@@ -742,6 +884,8 @@ export default defineVxeComponent({
|
|
|
742
884
|
// 横向滚动条的高度
|
|
743
885
|
scrollbarHeight: 0,
|
|
744
886
|
|
|
887
|
+
// 最后滚动时间戳
|
|
888
|
+
lastScrollTime: 0,
|
|
745
889
|
lazScrollLoading: false,
|
|
746
890
|
|
|
747
891
|
scrollVMLoading: false,
|
|
@@ -877,9 +1021,11 @@ export default defineVxeComponent({
|
|
|
877
1021
|
},
|
|
878
1022
|
triggerBodyScrollEvent (evnt: Event) {
|
|
879
1023
|
const $xeGanttView = this
|
|
1024
|
+
const reactData = $xeGanttView.reactData
|
|
880
1025
|
const internalData = $xeGanttView.internalData
|
|
881
1026
|
|
|
882
|
-
const {
|
|
1027
|
+
const { scrollXLoad } = reactData
|
|
1028
|
+
const { elemStore, inVirtualScroll, inHeaderScroll, inFooterScroll, lastScrollLeft, lastScrollTop } = internalData
|
|
883
1029
|
if (inVirtualScroll) {
|
|
884
1030
|
return
|
|
885
1031
|
}
|
|
@@ -890,42 +1036,51 @@ export default defineVxeComponent({
|
|
|
890
1036
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
891
1037
|
const xHandleEl = $xeGanttView.$refs.refScrollXHandleElem as HTMLDivElement
|
|
892
1038
|
const yHandleEl = $xeGanttView.$refs.refScrollYHandleElem as HTMLDivElement
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
syncTableScrollTop($xeGanttView, currTopNum)
|
|
903
|
-
handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
904
|
-
}
|
|
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
|
|
1039
|
+
const scrollLeft = wrapperEl.scrollLeft
|
|
1040
|
+
const scrollTop = wrapperEl.scrollTop
|
|
1041
|
+
const isRollX = scrollLeft !== lastScrollLeft
|
|
1042
|
+
const isRollY = scrollTop !== lastScrollTop
|
|
1043
|
+
internalData.inBodyScroll = true
|
|
1044
|
+
internalData.scrollRenderType = ''
|
|
1045
|
+
if (isRollY) {
|
|
1046
|
+
setScrollTop(yHandleEl, scrollTop)
|
|
1047
|
+
syncTableScrollTop($xeGanttView, scrollTop)
|
|
913
1048
|
}
|
|
914
|
-
if (
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
const currLeftNum = wrapperEl.scrollLeft
|
|
922
|
-
handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
1049
|
+
if (isRollX) {
|
|
1050
|
+
internalData.inBodyScroll = true
|
|
1051
|
+
setScrollLeft(xHandleEl, scrollLeft)
|
|
1052
|
+
setScrollLeft(headerScrollElem, scrollLeft)
|
|
1053
|
+
if (scrollXLoad) {
|
|
1054
|
+
triggerScrollXEvent($xeGanttView)
|
|
1055
|
+
}
|
|
923
1056
|
}
|
|
1057
|
+
handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft)
|
|
924
1058
|
},
|
|
1059
|
+
// triggerFooterScrollEvent (evnt: Event) {
|
|
1060
|
+
// const $xeGanttView = this
|
|
1061
|
+
// const internalData = $xeGanttView.internalData
|
|
1062
|
+
|
|
1063
|
+
// const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
1064
|
+
// if (inVirtualScroll) {
|
|
1065
|
+
// return
|
|
1066
|
+
// }
|
|
1067
|
+
// if (inHeaderScroll || inBodyScroll) {
|
|
1068
|
+
// return
|
|
1069
|
+
// }
|
|
1070
|
+
// const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
1071
|
+
// if (wrapperEl) {
|
|
1072
|
+
// const isRollX = true
|
|
1073
|
+
// const isRollY = false
|
|
1074
|
+
// const currLeftNum = wrapperEl.scrollLeft
|
|
1075
|
+
// handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
1076
|
+
// }
|
|
1077
|
+
// },
|
|
925
1078
|
triggerVirtualScrollXEvent (evnt: Event) {
|
|
926
1079
|
const $xeGanttView = this
|
|
1080
|
+
const reactData = $xeGanttView.reactData
|
|
927
1081
|
const internalData = $xeGanttView.internalData
|
|
928
1082
|
|
|
1083
|
+
const { scrollXLoad } = reactData
|
|
929
1084
|
const { elemStore, inHeaderScroll, inBodyScroll } = internalData
|
|
930
1085
|
if (inHeaderScroll || inBodyScroll) {
|
|
931
1086
|
return
|
|
@@ -940,6 +1095,9 @@ export default defineVxeComponent({
|
|
|
940
1095
|
internalData.inVirtualScroll = true
|
|
941
1096
|
setScrollLeft(headerScrollElem, currLeftNum)
|
|
942
1097
|
setScrollLeft(bodyScrollElem, currLeftNum)
|
|
1098
|
+
if (scrollXLoad) {
|
|
1099
|
+
triggerScrollXEvent($xeGanttView)
|
|
1100
|
+
}
|
|
943
1101
|
handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
944
1102
|
}
|
|
945
1103
|
},
|
|
@@ -965,27 +1123,8 @@ export default defineVxeComponent({
|
|
|
965
1123
|
},
|
|
966
1124
|
handleUpdateSXSpace () {
|
|
967
1125
|
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
1126
|
|
|
987
|
-
|
|
988
|
-
return $xeGanttView.$nextTick()
|
|
1127
|
+
return updateScrollXSpace($xeGanttView)
|
|
989
1128
|
},
|
|
990
1129
|
handleUpdateSYSpace () {
|
|
991
1130
|
const $xeGanttView = this
|
|
@@ -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: '
|
|
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
|
-
}
|
|
2116
|
+
}),
|
|
2117
2117
|
h('div', {
|
|
2118
2118
|
class: 'vxe-gantt--resizable-split-number-right'
|
|
2119
|
-
}
|
|
2119
|
+
})
|
|
2120
2120
|
])
|
|
2121
2121
|
]),
|
|
2122
2122
|
h('div', {
|
|
@@ -2221,9 +2221,6 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2221
2221
|
if (props.expandConfig) {
|
|
2222
2222
|
warnLog('vxe.error.notProp', ['expand-config'])
|
|
2223
2223
|
}
|
|
2224
|
-
if (props.aggregateConfig) {
|
|
2225
|
-
warnLog('vxe.error.notProp', ['aggregate-config'])
|
|
2226
|
-
}
|
|
2227
2224
|
|
|
2228
2225
|
$xeGantt.$nextTick(() => {
|
|
2229
2226
|
if (props.formConfig) {
|