vxe-gantt 4.0.6 → 4.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 +3 -2
- package/es/gantt/src/gantt-view.js +277 -104
- package/es/gantt/src/gantt.js +8 -11
- 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 -2
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +343 -112
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +6 -9
- 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 +355 -125
- 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 +3 -2
- package/packages/gantt/src/gantt-view.ts +288 -107
- package/packages/gantt/src/gantt.ts +6 -9
- package/styles/components/gantt.scss +6 -1
- package/styles/theme/dark.scss +1 -0
- package/styles/theme/light.scss +1 -0
|
@@ -20,6 +20,7 @@ const {
|
|
|
20
20
|
function createInternalData() {
|
|
21
21
|
return {
|
|
22
22
|
xeTable: null,
|
|
23
|
+
visibleColumn: [],
|
|
23
24
|
startMaps: {},
|
|
24
25
|
endMaps: {},
|
|
25
26
|
chartMaps: {},
|
|
@@ -34,16 +35,9 @@ function createInternalData() {
|
|
|
34
35
|
startIndex: 0,
|
|
35
36
|
endIndex: 0
|
|
36
37
|
},
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
offsetSize: 0,
|
|
41
|
-
visibleSize: 0,
|
|
42
|
-
visibleStartIndex: 0,
|
|
43
|
-
visibleEndIndex: 0,
|
|
44
|
-
startIndex: 0,
|
|
45
|
-
endIndex: 0
|
|
46
|
-
}
|
|
38
|
+
// 最后滚动位置
|
|
39
|
+
lastScrollTop: 0,
|
|
40
|
+
lastScrollLeft: 0
|
|
47
41
|
};
|
|
48
42
|
}
|
|
49
43
|
const maxYHeight = 5e6;
|
|
@@ -88,6 +82,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
88
82
|
scrollbarWidth: 0,
|
|
89
83
|
// 横向滚动条的高度
|
|
90
84
|
scrollbarHeight: 0,
|
|
85
|
+
// 最后滚动时间戳
|
|
86
|
+
lastScrollTime: 0,
|
|
91
87
|
lazScrollLoading: false,
|
|
92
88
|
scrollVMLoading: false,
|
|
93
89
|
scrollYHeight: 0,
|
|
@@ -162,37 +158,37 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
162
158
|
const currTime = minViewDate.getTime();
|
|
163
159
|
const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
|
|
164
160
|
const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
|
|
165
|
-
switch (minScale.type) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
161
|
+
// switch (minScale.type) {
|
|
162
|
+
// case 'day':
|
|
163
|
+
// case 'date':
|
|
164
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
|
|
165
|
+
// reactData.tableColumn = []
|
|
166
|
+
// reactData.headerGroups = []
|
|
167
|
+
// return
|
|
168
|
+
// }
|
|
169
|
+
// break
|
|
170
|
+
// case 'hour':
|
|
171
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
|
|
172
|
+
// reactData.tableColumn = []
|
|
173
|
+
// reactData.headerGroups = []
|
|
174
|
+
// return
|
|
175
|
+
// }
|
|
176
|
+
// break
|
|
177
|
+
// case 'minute':
|
|
178
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
|
|
179
|
+
// reactData.tableColumn = []
|
|
180
|
+
// reactData.headerGroups = []
|
|
181
|
+
// return
|
|
182
|
+
// }
|
|
183
|
+
// break
|
|
184
|
+
// case 'second':
|
|
185
|
+
// if (diffDayNum > (1000 * 60 * 60 * 3)) {
|
|
186
|
+
// reactData.tableColumn = []
|
|
187
|
+
// reactData.headerGroups = []
|
|
188
|
+
// return
|
|
189
|
+
// }
|
|
190
|
+
// break
|
|
191
|
+
// }
|
|
196
192
|
const renderListMaps = {
|
|
197
193
|
year: [],
|
|
198
194
|
quarter: [],
|
|
@@ -352,13 +348,20 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
352
348
|
const startField = computeStartField.value;
|
|
353
349
|
const endField = computeEndField.value;
|
|
354
350
|
const {
|
|
351
|
+
computeAggregateOpts,
|
|
355
352
|
computeTreeOpts
|
|
356
353
|
} = $xeTable.getComputeMaps();
|
|
354
|
+
const tableReactData = $xeTable.reactData;
|
|
355
|
+
const {
|
|
356
|
+
isRowGroupStatus
|
|
357
|
+
} = tableReactData;
|
|
357
358
|
const tableInternalData = $xeTable.internalData;
|
|
358
359
|
const {
|
|
359
360
|
afterFullData,
|
|
360
|
-
afterTreeFullData
|
|
361
|
+
afterTreeFullData,
|
|
362
|
+
afterGroupFullData
|
|
361
363
|
} = tableInternalData;
|
|
364
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
362
365
|
const treeOpts = computeTreeOpts.value;
|
|
363
366
|
const {
|
|
364
367
|
transform
|
|
@@ -382,7 +385,16 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
382
385
|
};
|
|
383
386
|
}
|
|
384
387
|
};
|
|
385
|
-
if (
|
|
388
|
+
if (isRowGroupStatus) {
|
|
389
|
+
// 行分组
|
|
390
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
391
|
+
if (mapChildrenField) {
|
|
392
|
+
_xeUtils.default.eachTree(afterGroupFullData, handleParseRender, {
|
|
393
|
+
children: mapChildrenField
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
} else if (treeConfig) {
|
|
397
|
+
// 树结构
|
|
386
398
|
_xeUtils.default.eachTree(afterTreeFullData, handleParseRender, {
|
|
387
399
|
children: transform ? treeOpts.mapChildrenField : childrenField
|
|
388
400
|
});
|
|
@@ -392,14 +404,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
392
404
|
internalData.chartMaps = ctMaps;
|
|
393
405
|
}
|
|
394
406
|
}
|
|
395
|
-
|
|
407
|
+
internalData.visibleColumn = fullCols;
|
|
396
408
|
reactData.headerGroups = groupCols;
|
|
409
|
+
updateScrollXStatus();
|
|
410
|
+
handleTableColumn();
|
|
397
411
|
};
|
|
398
412
|
const handleUpdateData = () => {
|
|
399
413
|
const ganttProps = $xeGantt.props;
|
|
400
414
|
const {
|
|
401
415
|
treeConfig
|
|
402
416
|
} = ganttProps;
|
|
417
|
+
const {
|
|
418
|
+
scrollXStore
|
|
419
|
+
} = internalData;
|
|
403
420
|
const $xeTable = internalData.xeTable;
|
|
404
421
|
const sdMaps = {};
|
|
405
422
|
const edMaps = {};
|
|
@@ -409,13 +426,20 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
409
426
|
const startField = computeStartField.value;
|
|
410
427
|
const endField = computeEndField.value;
|
|
411
428
|
const {
|
|
429
|
+
computeAggregateOpts,
|
|
412
430
|
computeTreeOpts
|
|
413
431
|
} = $xeTable.getComputeMaps();
|
|
432
|
+
const tableReactData = $xeTable.reactData;
|
|
433
|
+
const {
|
|
434
|
+
isRowGroupStatus
|
|
435
|
+
} = tableReactData;
|
|
414
436
|
const tableInternalData = $xeTable.internalData;
|
|
415
437
|
const {
|
|
416
438
|
afterFullData,
|
|
417
|
-
afterTreeFullData
|
|
439
|
+
afterTreeFullData,
|
|
440
|
+
afterGroupFullData
|
|
418
441
|
} = tableInternalData;
|
|
442
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
419
443
|
const treeOpts = computeTreeOpts.value;
|
|
420
444
|
const {
|
|
421
445
|
transform
|
|
@@ -435,7 +459,16 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
435
459
|
}
|
|
436
460
|
}
|
|
437
461
|
};
|
|
438
|
-
if (
|
|
462
|
+
if (isRowGroupStatus) {
|
|
463
|
+
// 行分组
|
|
464
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
465
|
+
if (mapChildrenField) {
|
|
466
|
+
_xeUtils.default.eachTree(afterGroupFullData, handleMinMaxData, {
|
|
467
|
+
children: mapChildrenField
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
} else if (treeConfig) {
|
|
471
|
+
// 树结构
|
|
439
472
|
_xeUtils.default.eachTree(afterTreeFullData, handleMinMaxData, {
|
|
440
473
|
children: transform ? treeOpts.mapChildrenField : childrenField
|
|
441
474
|
});
|
|
@@ -443,6 +476,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
443
476
|
afterFullData.forEach(handleMinMaxData);
|
|
444
477
|
}
|
|
445
478
|
}
|
|
479
|
+
scrollXStore.startIndex = 0;
|
|
480
|
+
scrollXStore.endIndex = Math.max(1, scrollXStore.visibleSize);
|
|
446
481
|
reactData.minViewDate = minDate;
|
|
447
482
|
reactData.maxViewDate = maxDate;
|
|
448
483
|
internalData.startMaps = sdMaps;
|
|
@@ -493,10 +528,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
493
528
|
}
|
|
494
529
|
const rowid = rowEl.getAttribute('rowid');
|
|
495
530
|
const rowRest = rowid ? chartMaps[rowid] : null;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`;
|
|
499
|
-
}
|
|
531
|
+
barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`;
|
|
532
|
+
barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`;
|
|
500
533
|
});
|
|
501
534
|
}
|
|
502
535
|
return (0, _vue.nextTick)();
|
|
@@ -505,11 +538,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
505
538
|
const {
|
|
506
539
|
scrollbarWidth,
|
|
507
540
|
scrollbarHeight,
|
|
508
|
-
|
|
509
|
-
|
|
541
|
+
headerGroups,
|
|
542
|
+
tableColumn
|
|
510
543
|
} = reactData;
|
|
511
544
|
const {
|
|
512
|
-
elemStore
|
|
545
|
+
elemStore,
|
|
546
|
+
visibleColumn
|
|
513
547
|
} = internalData;
|
|
514
548
|
const $xeTable = internalData.xeTable;
|
|
515
549
|
const el = refElem.value;
|
|
@@ -591,37 +625,230 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
591
625
|
yBottomCornerEl.style.display = tFooterHeight ? 'block' : '';
|
|
592
626
|
}
|
|
593
627
|
const colInfoElem = refColInfoElem.value;
|
|
628
|
+
let viewCellWidth = 40;
|
|
594
629
|
if (colInfoElem) {
|
|
595
|
-
|
|
630
|
+
viewCellWidth = colInfoElem.clientWidth || 40;
|
|
596
631
|
}
|
|
597
|
-
let viewTableWidth =
|
|
632
|
+
let viewTableWidth = viewCellWidth * visibleColumn.length;
|
|
598
633
|
if (bodyScrollElem) {
|
|
599
634
|
const viewWidth = bodyScrollElem.clientWidth;
|
|
600
635
|
const remainWidth = viewWidth - viewTableWidth;
|
|
601
636
|
if (remainWidth > 0) {
|
|
602
|
-
|
|
637
|
+
viewCellWidth += Math.floor(remainWidth / visibleColumn.length);
|
|
603
638
|
viewTableWidth = viewWidth;
|
|
604
639
|
}
|
|
605
640
|
}
|
|
641
|
+
reactData.viewCellWidth = viewCellWidth;
|
|
606
642
|
const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
|
|
607
643
|
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
644
|
+
const vmTableWidth = viewCellWidth * tableColumn.length;
|
|
608
645
|
if (headerTableElem) {
|
|
609
646
|
headerTableElem.style.width = `${viewTableWidth}px`;
|
|
610
647
|
}
|
|
611
648
|
if (bodyTableElem) {
|
|
612
|
-
bodyTableElem.style.width = `${
|
|
649
|
+
bodyTableElem.style.width = `${vmTableWidth}px`;
|
|
613
650
|
}
|
|
614
651
|
reactData.scrollXWidth = viewTableWidth;
|
|
615
652
|
return updateChart();
|
|
616
653
|
};
|
|
617
|
-
const
|
|
654
|
+
const handleRecalculateStyle = () => {
|
|
655
|
+
const el = refElem.value;
|
|
656
|
+
internalData.rceRunTime = Date.now();
|
|
657
|
+
if (!el || !el.clientWidth) {
|
|
658
|
+
return (0, _vue.nextTick)();
|
|
659
|
+
}
|
|
618
660
|
calcScrollbar();
|
|
619
661
|
updateStyle();
|
|
620
662
|
updateChart();
|
|
663
|
+
return computeScrollLoad();
|
|
664
|
+
};
|
|
665
|
+
const handleLazyRecalculate = () => {
|
|
666
|
+
return new Promise(resolve => {
|
|
667
|
+
const {
|
|
668
|
+
rceTimeout,
|
|
669
|
+
rceRunTime
|
|
670
|
+
} = internalData;
|
|
671
|
+
const $xeTable = internalData.xeTable;
|
|
672
|
+
let refreshDelay = 50;
|
|
673
|
+
if ($xeTable) {
|
|
674
|
+
const {
|
|
675
|
+
computeResizeOpts
|
|
676
|
+
} = $xeTable.getComputeMaps();
|
|
677
|
+
const resizeOpts = computeResizeOpts.value;
|
|
678
|
+
refreshDelay = resizeOpts.refreshDelay || 50;
|
|
679
|
+
}
|
|
680
|
+
if (rceTimeout) {
|
|
681
|
+
clearTimeout(rceTimeout);
|
|
682
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
683
|
+
resolve(handleRecalculateStyle());
|
|
684
|
+
} else {
|
|
685
|
+
(0, _vue.nextTick)(() => {
|
|
686
|
+
resolve();
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
resolve(handleRecalculateStyle());
|
|
691
|
+
}
|
|
692
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
693
|
+
internalData.rceTimeout = undefined;
|
|
694
|
+
handleRecalculateStyle();
|
|
695
|
+
}, refreshDelay);
|
|
696
|
+
});
|
|
697
|
+
};
|
|
698
|
+
const computeScrollLoad = () => {
|
|
699
|
+
return (0, _vue.nextTick)().then(() => {
|
|
700
|
+
const {
|
|
701
|
+
scrollXLoad
|
|
702
|
+
} = reactData;
|
|
703
|
+
const {
|
|
704
|
+
scrollXStore
|
|
705
|
+
} = internalData;
|
|
706
|
+
// 计算 X 逻辑
|
|
707
|
+
if (scrollXLoad) {
|
|
708
|
+
const {
|
|
709
|
+
toVisibleIndex: toXVisibleIndex,
|
|
710
|
+
visibleSize: visibleXSize
|
|
711
|
+
} = handleVirtualXVisible();
|
|
712
|
+
const offsetXSize = 2;
|
|
713
|
+
scrollXStore.preloadSize = 1;
|
|
714
|
+
scrollXStore.offsetSize = offsetXSize;
|
|
715
|
+
scrollXStore.visibleSize = visibleXSize;
|
|
716
|
+
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
717
|
+
scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
|
|
718
|
+
scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
|
|
719
|
+
updateScrollXData().then(() => {
|
|
720
|
+
loadScrollXData();
|
|
721
|
+
});
|
|
722
|
+
} else {
|
|
723
|
+
updateScrollXSpace();
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
};
|
|
727
|
+
const handleVirtualXVisible = () => {
|
|
728
|
+
const {
|
|
729
|
+
viewCellWidth
|
|
730
|
+
} = reactData;
|
|
731
|
+
const {
|
|
732
|
+
elemStore
|
|
733
|
+
} = internalData;
|
|
734
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
735
|
+
if (bodyScrollElem) {
|
|
736
|
+
const clientWidth = bodyScrollElem.clientWidth;
|
|
737
|
+
const scrollLeft = bodyScrollElem.scrollLeft;
|
|
738
|
+
const toVisibleIndex = Math.floor(scrollLeft / viewCellWidth) - 1;
|
|
739
|
+
const visibleSize = Math.ceil(clientWidth / viewCellWidth) + 1;
|
|
740
|
+
return {
|
|
741
|
+
toVisibleIndex: Math.max(0, toVisibleIndex),
|
|
742
|
+
visibleSize: Math.max(1, visibleSize)
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
return {
|
|
746
|
+
toVisibleIndex: 0,
|
|
747
|
+
visibleSize: 6
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
const loadScrollXData = () => {
|
|
751
|
+
const {
|
|
752
|
+
isScrollXBig
|
|
753
|
+
} = reactData;
|
|
754
|
+
const {
|
|
755
|
+
scrollXStore
|
|
756
|
+
} = internalData;
|
|
757
|
+
const {
|
|
758
|
+
preloadSize,
|
|
759
|
+
startIndex,
|
|
760
|
+
endIndex,
|
|
761
|
+
offsetSize
|
|
762
|
+
} = scrollXStore;
|
|
763
|
+
const {
|
|
764
|
+
toVisibleIndex,
|
|
765
|
+
visibleSize
|
|
766
|
+
} = handleVirtualXVisible();
|
|
767
|
+
const offsetItem = {
|
|
768
|
+
startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
769
|
+
endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
770
|
+
};
|
|
771
|
+
scrollXStore.visibleStartIndex = toVisibleIndex - 1;
|
|
772
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
773
|
+
const {
|
|
774
|
+
startIndex: offsetStartIndex,
|
|
775
|
+
endIndex: offsetEndIndex
|
|
776
|
+
} = offsetItem;
|
|
777
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
778
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
779
|
+
scrollXStore.startIndex = offsetStartIndex;
|
|
780
|
+
scrollXStore.endIndex = offsetEndIndex;
|
|
781
|
+
updateScrollXData();
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
const updateScrollXData = () => {
|
|
786
|
+
handleTableColumn();
|
|
787
|
+
updateScrollXSpace();
|
|
621
788
|
return (0, _vue.nextTick)();
|
|
622
789
|
};
|
|
623
|
-
|
|
624
|
-
|
|
790
|
+
const updateScrollXStatus = () => {
|
|
791
|
+
const scrollXLoad = true;
|
|
792
|
+
reactData.scrollXLoad = scrollXLoad;
|
|
793
|
+
return scrollXLoad;
|
|
794
|
+
};
|
|
795
|
+
const handleTableColumn = () => {
|
|
796
|
+
const {
|
|
797
|
+
scrollXLoad
|
|
798
|
+
} = reactData;
|
|
799
|
+
const {
|
|
800
|
+
visibleColumn,
|
|
801
|
+
scrollXStore
|
|
802
|
+
} = internalData;
|
|
803
|
+
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
804
|
+
reactData.tableColumn = tableColumn;
|
|
805
|
+
};
|
|
806
|
+
const updateScrollXSpace = () => {
|
|
807
|
+
const {
|
|
808
|
+
scrollXLoad,
|
|
809
|
+
scrollXWidth,
|
|
810
|
+
viewCellWidth
|
|
811
|
+
} = reactData;
|
|
812
|
+
const {
|
|
813
|
+
elemStore,
|
|
814
|
+
scrollXStore
|
|
815
|
+
} = internalData;
|
|
816
|
+
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
817
|
+
// const headerTableElem = getRefElem(elemStore['main-header-table'])
|
|
818
|
+
// const footerTableElem = getRefElem(elemStore['main-footer-table'])
|
|
819
|
+
const {
|
|
820
|
+
startIndex
|
|
821
|
+
} = scrollXStore;
|
|
822
|
+
let xSpaceLeft = 0;
|
|
823
|
+
if (scrollXLoad) {
|
|
824
|
+
xSpaceLeft = Math.max(0, startIndex * viewCellWidth);
|
|
825
|
+
}
|
|
826
|
+
// if (headerTableElem) {
|
|
827
|
+
// headerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
828
|
+
// }
|
|
829
|
+
if (bodyTableElem) {
|
|
830
|
+
bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
|
|
831
|
+
}
|
|
832
|
+
// if (footerTableElem) {
|
|
833
|
+
// footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
834
|
+
// }
|
|
835
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
836
|
+
layoutList.forEach(layout => {
|
|
837
|
+
const xSpaceElem = (0, _util.getRefElem)(elemStore[`main-${layout}-xSpace`]);
|
|
838
|
+
if (xSpaceElem) {
|
|
839
|
+
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
843
|
+
if (scrollXSpaceEl) {
|
|
844
|
+
scrollXSpaceEl.style.width = `${scrollXWidth}px`;
|
|
845
|
+
}
|
|
846
|
+
calcScrollbar();
|
|
847
|
+
return (0, _vue.nextTick)();
|
|
848
|
+
};
|
|
849
|
+
const triggerScrollXEvent = () => {
|
|
850
|
+
loadScrollXData();
|
|
851
|
+
};
|
|
625
852
|
const updateScrollYSpace = () => {
|
|
626
853
|
const {
|
|
627
854
|
elemStore
|
|
@@ -699,6 +926,13 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
699
926
|
};
|
|
700
927
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
701
928
|
const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
929
|
+
if (isRollX) {
|
|
930
|
+
internalData.lastScrollLeft = scrollLeft;
|
|
931
|
+
}
|
|
932
|
+
if (isRollY) {
|
|
933
|
+
internalData.lastScrollTop = scrollTop;
|
|
934
|
+
}
|
|
935
|
+
reactData.lastScrollTime = Date.now();
|
|
702
936
|
checkLastSyncScroll(isRollX, isRollY);
|
|
703
937
|
};
|
|
704
938
|
const ganttViewMethods = {
|
|
@@ -804,11 +1038,16 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
804
1038
|
}
|
|
805
1039
|
},
|
|
806
1040
|
triggerBodyScrollEvent(evnt) {
|
|
1041
|
+
const {
|
|
1042
|
+
scrollXLoad
|
|
1043
|
+
} = reactData;
|
|
807
1044
|
const {
|
|
808
1045
|
elemStore,
|
|
809
1046
|
inVirtualScroll,
|
|
810
1047
|
inHeaderScroll,
|
|
811
|
-
inFooterScroll
|
|
1048
|
+
inFooterScroll,
|
|
1049
|
+
lastScrollLeft,
|
|
1050
|
+
lastScrollTop
|
|
812
1051
|
} = internalData;
|
|
813
1052
|
if (inVirtualScroll) {
|
|
814
1053
|
return;
|
|
@@ -820,40 +1059,46 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
820
1059
|
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
821
1060
|
const xHandleEl = refScrollXHandleElem.value;
|
|
822
1061
|
const yHandleEl = refScrollYHandleElem.value;
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
(0, _dom.
|
|
831
|
-
(
|
|
832
|
-
syncTableScrollTop(currTopNum);
|
|
833
|
-
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
834
|
-
}
|
|
835
|
-
},
|
|
836
|
-
triggerFooterScrollEvent(evnt) {
|
|
837
|
-
const {
|
|
838
|
-
inVirtualScroll,
|
|
839
|
-
inHeaderScroll,
|
|
840
|
-
inBodyScroll
|
|
841
|
-
} = internalData;
|
|
842
|
-
if (inVirtualScroll) {
|
|
843
|
-
return;
|
|
1062
|
+
const scrollLeft = wrapperEl.scrollLeft;
|
|
1063
|
+
const scrollTop = wrapperEl.scrollTop;
|
|
1064
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
1065
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
1066
|
+
internalData.inBodyScroll = true;
|
|
1067
|
+
internalData.scrollRenderType = '';
|
|
1068
|
+
if (isRollY) {
|
|
1069
|
+
(0, _dom.setScrollTop)(yHandleEl, scrollTop);
|
|
1070
|
+
syncTableScrollTop(scrollTop);
|
|
844
1071
|
}
|
|
845
|
-
if (
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
const currLeftNum = wrapperEl.scrollLeft;
|
|
853
|
-
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
1072
|
+
if (isRollX) {
|
|
1073
|
+
internalData.inBodyScroll = true;
|
|
1074
|
+
(0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
|
|
1075
|
+
(0, _dom.setScrollLeft)(headerScrollElem, scrollLeft);
|
|
1076
|
+
if (scrollXLoad) {
|
|
1077
|
+
triggerScrollXEvent();
|
|
1078
|
+
}
|
|
854
1079
|
}
|
|
1080
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
|
|
855
1081
|
},
|
|
1082
|
+
// triggerFooterScrollEvent (evnt) {
|
|
1083
|
+
// const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
1084
|
+
// if (inVirtualScroll) {
|
|
1085
|
+
// return
|
|
1086
|
+
// }
|
|
1087
|
+
// if (inHeaderScroll || inBodyScroll) {
|
|
1088
|
+
// return
|
|
1089
|
+
// }
|
|
1090
|
+
// const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
1091
|
+
// if (wrapperEl) {
|
|
1092
|
+
// const isRollX = true
|
|
1093
|
+
// const isRollY = false
|
|
1094
|
+
// const currLeftNum = wrapperEl.scrollLeft
|
|
1095
|
+
// handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
1096
|
+
// }
|
|
1097
|
+
// },
|
|
856
1098
|
triggerVirtualScrollXEvent(evnt) {
|
|
1099
|
+
const {
|
|
1100
|
+
scrollXLoad
|
|
1101
|
+
} = reactData;
|
|
857
1102
|
const {
|
|
858
1103
|
elemStore,
|
|
859
1104
|
inHeaderScroll,
|
|
@@ -872,6 +1117,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
872
1117
|
internalData.inVirtualScroll = true;
|
|
873
1118
|
(0, _dom.setScrollLeft)(headerScrollElem, currLeftNum);
|
|
874
1119
|
(0, _dom.setScrollLeft)(bodyScrollElem, currLeftNum);
|
|
1120
|
+
if (scrollXLoad) {
|
|
1121
|
+
triggerScrollXEvent();
|
|
1122
|
+
}
|
|
875
1123
|
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
876
1124
|
}
|
|
877
1125
|
},
|
|
@@ -897,28 +1145,11 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
897
1145
|
}
|
|
898
1146
|
},
|
|
899
1147
|
handleUpdateSXSpace() {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const {
|
|
905
|
-
elemStore
|
|
906
|
-
} = internalData;
|
|
907
|
-
const layoutList = ['header', 'body', 'footer'];
|
|
908
|
-
layoutList.forEach(layout => {
|
|
909
|
-
const xSpaceElem = (0, _util.getRefElem)(elemStore[`main-${layout}-xSpace`]);
|
|
910
|
-
if (xSpaceElem) {
|
|
911
|
-
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
|
|
912
|
-
}
|
|
913
|
-
});
|
|
914
|
-
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
915
|
-
if (scrollXSpaceEl) {
|
|
916
|
-
scrollXSpaceEl.style.width = `${scrollXWidth}px`;
|
|
917
|
-
}
|
|
918
|
-
calcScrollbar();
|
|
919
|
-
return (0, _vue.nextTick)();
|
|
1148
|
+
return updateScrollXSpace();
|
|
1149
|
+
},
|
|
1150
|
+
handleUpdateSYSpace() {
|
|
1151
|
+
return updateScrollYSpace();
|
|
920
1152
|
},
|
|
921
|
-
handleUpdateSYSpace: updateScrollYSpace,
|
|
922
1153
|
handleUpdateSYStatus(sYLoad) {
|
|
923
1154
|
reactData.scrollYLoad = sYLoad;
|
|
924
1155
|
}
|