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
|
@@ -13,7 +13,8 @@ export default defineVxeComponent({
|
|
|
13
13
|
const refHeaderTable = ref();
|
|
14
14
|
const refHeaderXSpace = ref();
|
|
15
15
|
const renderVN = () => {
|
|
16
|
-
const {
|
|
16
|
+
const { headerGroups, viewCellWidth } = reactData;
|
|
17
|
+
const { visibleColumn } = internalData;
|
|
17
18
|
return h('div', {
|
|
18
19
|
ref: refElem,
|
|
19
20
|
class: 'vxe-gantt-view--header-wrapper'
|
|
@@ -31,7 +32,7 @@ export default defineVxeComponent({
|
|
|
31
32
|
ref: refHeaderTable,
|
|
32
33
|
class: 'vxe-gantt-view--header-table'
|
|
33
34
|
}, [
|
|
34
|
-
h('colgroup', {},
|
|
35
|
+
h('colgroup', {}, visibleColumn.map((column, cIndex) => {
|
|
35
36
|
return h('col', {
|
|
36
37
|
key: cIndex,
|
|
37
38
|
style: {
|
|
@@ -11,6 +11,7 @@ const { globalEvents } = VxeUI;
|
|
|
11
11
|
function createInternalData() {
|
|
12
12
|
return {
|
|
13
13
|
xeTable: null,
|
|
14
|
+
visibleColumn: [],
|
|
14
15
|
startMaps: {},
|
|
15
16
|
endMaps: {},
|
|
16
17
|
chartMaps: {},
|
|
@@ -25,16 +26,9 @@ function createInternalData() {
|
|
|
25
26
|
startIndex: 0,
|
|
26
27
|
endIndex: 0
|
|
27
28
|
},
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
offsetSize: 0,
|
|
32
|
-
visibleSize: 0,
|
|
33
|
-
visibleStartIndex: 0,
|
|
34
|
-
visibleEndIndex: 0,
|
|
35
|
-
startIndex: 0,
|
|
36
|
-
endIndex: 0
|
|
37
|
-
}
|
|
29
|
+
// 最后滚动位置
|
|
30
|
+
lastScrollTop: 0,
|
|
31
|
+
lastScrollLeft: 0
|
|
38
32
|
};
|
|
39
33
|
}
|
|
40
34
|
const maxYHeight = 5e6;
|
|
@@ -72,6 +66,8 @@ export default defineVxeComponent({
|
|
|
72
66
|
scrollbarWidth: 0,
|
|
73
67
|
// 横向滚动条的高度
|
|
74
68
|
scrollbarHeight: 0,
|
|
69
|
+
// 最后滚动时间戳
|
|
70
|
+
lastScrollTime: 0,
|
|
75
71
|
lazScrollLoading: false,
|
|
76
72
|
scrollVMLoading: false,
|
|
77
73
|
scrollYHeight: 0,
|
|
@@ -136,37 +132,37 @@ export default defineVxeComponent({
|
|
|
136
132
|
const currTime = minViewDate.getTime();
|
|
137
133
|
const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
|
|
138
134
|
const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
|
|
139
|
-
switch (minScale.type) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
135
|
+
// switch (minScale.type) {
|
|
136
|
+
// case 'day':
|
|
137
|
+
// case 'date':
|
|
138
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
|
|
139
|
+
// reactData.tableColumn = []
|
|
140
|
+
// reactData.headerGroups = []
|
|
141
|
+
// return
|
|
142
|
+
// }
|
|
143
|
+
// break
|
|
144
|
+
// case 'hour':
|
|
145
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
|
|
146
|
+
// reactData.tableColumn = []
|
|
147
|
+
// reactData.headerGroups = []
|
|
148
|
+
// return
|
|
149
|
+
// }
|
|
150
|
+
// break
|
|
151
|
+
// case 'minute':
|
|
152
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
|
|
153
|
+
// reactData.tableColumn = []
|
|
154
|
+
// reactData.headerGroups = []
|
|
155
|
+
// return
|
|
156
|
+
// }
|
|
157
|
+
// break
|
|
158
|
+
// case 'second':
|
|
159
|
+
// if (diffDayNum > (1000 * 60 * 60 * 3)) {
|
|
160
|
+
// reactData.tableColumn = []
|
|
161
|
+
// reactData.headerGroups = []
|
|
162
|
+
// return
|
|
163
|
+
// }
|
|
164
|
+
// break
|
|
165
|
+
// }
|
|
170
166
|
const renderListMaps = {
|
|
171
167
|
year: [],
|
|
172
168
|
quarter: [],
|
|
@@ -314,9 +310,12 @@ export default defineVxeComponent({
|
|
|
314
310
|
if ($xeTable) {
|
|
315
311
|
const startField = computeStartField.value;
|
|
316
312
|
const endField = computeEndField.value;
|
|
317
|
-
const { computeTreeOpts } = $xeTable.getComputeMaps();
|
|
313
|
+
const { computeAggregateOpts, computeTreeOpts } = $xeTable.getComputeMaps();
|
|
314
|
+
const tableReactData = $xeTable.reactData;
|
|
315
|
+
const { isRowGroupStatus } = tableReactData;
|
|
318
316
|
const tableInternalData = $xeTable.internalData;
|
|
319
|
-
const { afterFullData, afterTreeFullData } = tableInternalData;
|
|
317
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData;
|
|
318
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
320
319
|
const treeOpts = computeTreeOpts.value;
|
|
321
320
|
const { transform } = treeOpts;
|
|
322
321
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -338,7 +337,15 @@ export default defineVxeComponent({
|
|
|
338
337
|
};
|
|
339
338
|
}
|
|
340
339
|
};
|
|
341
|
-
if (
|
|
340
|
+
if (isRowGroupStatus) {
|
|
341
|
+
// 行分组
|
|
342
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
343
|
+
if (mapChildrenField) {
|
|
344
|
+
XEUtils.eachTree(afterGroupFullData, handleParseRender, { children: mapChildrenField });
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else if (treeConfig) {
|
|
348
|
+
// 树结构
|
|
342
349
|
XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
343
350
|
}
|
|
344
351
|
else {
|
|
@@ -347,12 +354,15 @@ export default defineVxeComponent({
|
|
|
347
354
|
internalData.chartMaps = ctMaps;
|
|
348
355
|
}
|
|
349
356
|
}
|
|
350
|
-
|
|
357
|
+
internalData.visibleColumn = fullCols;
|
|
351
358
|
reactData.headerGroups = groupCols;
|
|
359
|
+
updateScrollXStatus();
|
|
360
|
+
handleTableColumn();
|
|
352
361
|
};
|
|
353
362
|
const handleUpdateData = () => {
|
|
354
363
|
const ganttProps = $xeGantt.props;
|
|
355
364
|
const { treeConfig } = ganttProps;
|
|
365
|
+
const { scrollXStore } = internalData;
|
|
356
366
|
const $xeTable = internalData.xeTable;
|
|
357
367
|
const sdMaps = {};
|
|
358
368
|
const edMaps = {};
|
|
@@ -361,9 +371,12 @@ export default defineVxeComponent({
|
|
|
361
371
|
if ($xeTable) {
|
|
362
372
|
const startField = computeStartField.value;
|
|
363
373
|
const endField = computeEndField.value;
|
|
364
|
-
const { computeTreeOpts } = $xeTable.getComputeMaps();
|
|
374
|
+
const { computeAggregateOpts, computeTreeOpts } = $xeTable.getComputeMaps();
|
|
375
|
+
const tableReactData = $xeTable.reactData;
|
|
376
|
+
const { isRowGroupStatus } = tableReactData;
|
|
365
377
|
const tableInternalData = $xeTable.internalData;
|
|
366
|
-
const { afterFullData, afterTreeFullData } = tableInternalData;
|
|
378
|
+
const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData;
|
|
379
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
367
380
|
const treeOpts = computeTreeOpts.value;
|
|
368
381
|
const { transform } = treeOpts;
|
|
369
382
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -381,13 +394,23 @@ export default defineVxeComponent({
|
|
|
381
394
|
}
|
|
382
395
|
}
|
|
383
396
|
};
|
|
384
|
-
if (
|
|
397
|
+
if (isRowGroupStatus) {
|
|
398
|
+
// 行分组
|
|
399
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
400
|
+
if (mapChildrenField) {
|
|
401
|
+
XEUtils.eachTree(afterGroupFullData, handleMinMaxData, { children: mapChildrenField });
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else if (treeConfig) {
|
|
405
|
+
// 树结构
|
|
385
406
|
XEUtils.eachTree(afterTreeFullData, handleMinMaxData, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
386
407
|
}
|
|
387
408
|
else {
|
|
388
409
|
afterFullData.forEach(handleMinMaxData);
|
|
389
410
|
}
|
|
390
411
|
}
|
|
412
|
+
scrollXStore.startIndex = 0;
|
|
413
|
+
scrollXStore.endIndex = Math.max(1, scrollXStore.visibleSize);
|
|
391
414
|
reactData.minViewDate = minDate;
|
|
392
415
|
reactData.maxViewDate = maxDate;
|
|
393
416
|
internalData.startMaps = sdMaps;
|
|
@@ -428,17 +451,15 @@ export default defineVxeComponent({
|
|
|
428
451
|
}
|
|
429
452
|
const rowid = rowEl.getAttribute('rowid');
|
|
430
453
|
const rowRest = rowid ? chartMaps[rowid] : null;
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`;
|
|
434
|
-
}
|
|
454
|
+
barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`;
|
|
455
|
+
barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`;
|
|
435
456
|
});
|
|
436
457
|
}
|
|
437
458
|
return nextTick();
|
|
438
459
|
};
|
|
439
460
|
const updateStyle = () => {
|
|
440
|
-
const { scrollbarWidth, scrollbarHeight,
|
|
441
|
-
const { elemStore } = internalData;
|
|
461
|
+
const { scrollbarWidth, scrollbarHeight, headerGroups, tableColumn } = reactData;
|
|
462
|
+
const { elemStore, visibleColumn } = internalData;
|
|
442
463
|
const $xeTable = internalData.xeTable;
|
|
443
464
|
const el = refElem.value;
|
|
444
465
|
if (!el || !el.clientHeight) {
|
|
@@ -519,37 +540,182 @@ export default defineVxeComponent({
|
|
|
519
540
|
yBottomCornerEl.style.display = tFooterHeight ? 'block' : '';
|
|
520
541
|
}
|
|
521
542
|
const colInfoElem = refColInfoElem.value;
|
|
543
|
+
let viewCellWidth = 40;
|
|
522
544
|
if (colInfoElem) {
|
|
523
|
-
|
|
545
|
+
viewCellWidth = colInfoElem.clientWidth || 40;
|
|
524
546
|
}
|
|
525
|
-
let viewTableWidth =
|
|
547
|
+
let viewTableWidth = viewCellWidth * visibleColumn.length;
|
|
526
548
|
if (bodyScrollElem) {
|
|
527
549
|
const viewWidth = bodyScrollElem.clientWidth;
|
|
528
550
|
const remainWidth = viewWidth - viewTableWidth;
|
|
529
551
|
if (remainWidth > 0) {
|
|
530
|
-
|
|
552
|
+
viewCellWidth += Math.floor(remainWidth / visibleColumn.length);
|
|
531
553
|
viewTableWidth = viewWidth;
|
|
532
554
|
}
|
|
533
555
|
}
|
|
556
|
+
reactData.viewCellWidth = viewCellWidth;
|
|
534
557
|
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
535
558
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
559
|
+
const vmTableWidth = viewCellWidth * tableColumn.length;
|
|
536
560
|
if (headerTableElem) {
|
|
537
561
|
headerTableElem.style.width = `${viewTableWidth}px`;
|
|
538
562
|
}
|
|
539
563
|
if (bodyTableElem) {
|
|
540
|
-
bodyTableElem.style.width = `${
|
|
564
|
+
bodyTableElem.style.width = `${vmTableWidth}px`;
|
|
541
565
|
}
|
|
542
566
|
reactData.scrollXWidth = viewTableWidth;
|
|
543
567
|
return updateChart();
|
|
544
568
|
};
|
|
545
|
-
const
|
|
569
|
+
const handleRecalculateStyle = () => {
|
|
570
|
+
const el = refElem.value;
|
|
571
|
+
internalData.rceRunTime = Date.now();
|
|
572
|
+
if (!el || !el.clientWidth) {
|
|
573
|
+
return nextTick();
|
|
574
|
+
}
|
|
546
575
|
calcScrollbar();
|
|
547
576
|
updateStyle();
|
|
548
577
|
updateChart();
|
|
578
|
+
return computeScrollLoad();
|
|
579
|
+
};
|
|
580
|
+
const handleLazyRecalculate = () => {
|
|
581
|
+
return new Promise(resolve => {
|
|
582
|
+
const { rceTimeout, rceRunTime } = internalData;
|
|
583
|
+
const $xeTable = internalData.xeTable;
|
|
584
|
+
let refreshDelay = 50;
|
|
585
|
+
if ($xeTable) {
|
|
586
|
+
const { computeResizeOpts } = $xeTable.getComputeMaps();
|
|
587
|
+
const resizeOpts = computeResizeOpts.value;
|
|
588
|
+
refreshDelay = resizeOpts.refreshDelay || 50;
|
|
589
|
+
}
|
|
590
|
+
if (rceTimeout) {
|
|
591
|
+
clearTimeout(rceTimeout);
|
|
592
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
593
|
+
resolve(handleRecalculateStyle());
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
nextTick(() => {
|
|
597
|
+
resolve();
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
resolve(handleRecalculateStyle());
|
|
603
|
+
}
|
|
604
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
605
|
+
internalData.rceTimeout = undefined;
|
|
606
|
+
handleRecalculateStyle();
|
|
607
|
+
}, refreshDelay);
|
|
608
|
+
});
|
|
609
|
+
};
|
|
610
|
+
const computeScrollLoad = () => {
|
|
611
|
+
return nextTick().then(() => {
|
|
612
|
+
const { scrollXLoad } = reactData;
|
|
613
|
+
const { scrollXStore } = internalData;
|
|
614
|
+
// 计算 X 逻辑
|
|
615
|
+
if (scrollXLoad) {
|
|
616
|
+
const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible();
|
|
617
|
+
const offsetXSize = 2;
|
|
618
|
+
scrollXStore.preloadSize = 1;
|
|
619
|
+
scrollXStore.offsetSize = offsetXSize;
|
|
620
|
+
scrollXStore.visibleSize = visibleXSize;
|
|
621
|
+
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
622
|
+
scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
|
|
623
|
+
scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
|
|
624
|
+
updateScrollXData().then(() => {
|
|
625
|
+
loadScrollXData();
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
updateScrollXSpace();
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
};
|
|
633
|
+
const handleVirtualXVisible = () => {
|
|
634
|
+
const { viewCellWidth } = reactData;
|
|
635
|
+
const { elemStore } = internalData;
|
|
636
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
637
|
+
if (bodyScrollElem) {
|
|
638
|
+
const clientWidth = bodyScrollElem.clientWidth;
|
|
639
|
+
const scrollLeft = bodyScrollElem.scrollLeft;
|
|
640
|
+
const toVisibleIndex = Math.floor(scrollLeft / viewCellWidth) - 1;
|
|
641
|
+
const visibleSize = Math.ceil(clientWidth / viewCellWidth) + 1;
|
|
642
|
+
return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(1, visibleSize) };
|
|
643
|
+
}
|
|
644
|
+
return { toVisibleIndex: 0, visibleSize: 6 };
|
|
645
|
+
};
|
|
646
|
+
const loadScrollXData = () => {
|
|
647
|
+
const { isScrollXBig } = reactData;
|
|
648
|
+
const { scrollXStore } = internalData;
|
|
649
|
+
const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore;
|
|
650
|
+
const { toVisibleIndex, visibleSize } = handleVirtualXVisible();
|
|
651
|
+
const offsetItem = {
|
|
652
|
+
startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
653
|
+
endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
654
|
+
};
|
|
655
|
+
scrollXStore.visibleStartIndex = toVisibleIndex - 1;
|
|
656
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
657
|
+
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
658
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
659
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
660
|
+
scrollXStore.startIndex = offsetStartIndex;
|
|
661
|
+
scrollXStore.endIndex = offsetEndIndex;
|
|
662
|
+
updateScrollXData();
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
const updateScrollXData = () => {
|
|
667
|
+
handleTableColumn();
|
|
668
|
+
updateScrollXSpace();
|
|
549
669
|
return nextTick();
|
|
550
670
|
};
|
|
551
|
-
|
|
552
|
-
|
|
671
|
+
const updateScrollXStatus = () => {
|
|
672
|
+
const scrollXLoad = true;
|
|
673
|
+
reactData.scrollXLoad = scrollXLoad;
|
|
674
|
+
return scrollXLoad;
|
|
675
|
+
};
|
|
676
|
+
const handleTableColumn = () => {
|
|
677
|
+
const { scrollXLoad } = reactData;
|
|
678
|
+
const { visibleColumn, scrollXStore } = internalData;
|
|
679
|
+
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
680
|
+
reactData.tableColumn = tableColumn;
|
|
681
|
+
};
|
|
682
|
+
const updateScrollXSpace = () => {
|
|
683
|
+
const { scrollXLoad, scrollXWidth, viewCellWidth } = reactData;
|
|
684
|
+
const { elemStore, scrollXStore } = internalData;
|
|
685
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
686
|
+
// const headerTableElem = getRefElem(elemStore['main-header-table'])
|
|
687
|
+
// const footerTableElem = getRefElem(elemStore['main-footer-table'])
|
|
688
|
+
const { startIndex } = scrollXStore;
|
|
689
|
+
let xSpaceLeft = 0;
|
|
690
|
+
if (scrollXLoad) {
|
|
691
|
+
xSpaceLeft = Math.max(0, startIndex * viewCellWidth);
|
|
692
|
+
}
|
|
693
|
+
// if (headerTableElem) {
|
|
694
|
+
// headerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
695
|
+
// }
|
|
696
|
+
if (bodyTableElem) {
|
|
697
|
+
bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
|
|
698
|
+
}
|
|
699
|
+
// if (footerTableElem) {
|
|
700
|
+
// footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
701
|
+
// }
|
|
702
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
703
|
+
layoutList.forEach(layout => {
|
|
704
|
+
const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`]);
|
|
705
|
+
if (xSpaceElem) {
|
|
706
|
+
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
710
|
+
if (scrollXSpaceEl) {
|
|
711
|
+
scrollXSpaceEl.style.width = `${scrollXWidth}px`;
|
|
712
|
+
}
|
|
713
|
+
calcScrollbar();
|
|
714
|
+
return nextTick();
|
|
715
|
+
};
|
|
716
|
+
const triggerScrollXEvent = () => {
|
|
717
|
+
loadScrollXData();
|
|
718
|
+
};
|
|
553
719
|
const updateScrollYSpace = () => {
|
|
554
720
|
const { elemStore } = internalData;
|
|
555
721
|
const $xeTable = internalData.xeTable;
|
|
@@ -624,6 +790,13 @@ export default defineVxeComponent({
|
|
|
624
790
|
};
|
|
625
791
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
626
792
|
const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
793
|
+
if (isRollX) {
|
|
794
|
+
internalData.lastScrollLeft = scrollLeft;
|
|
795
|
+
}
|
|
796
|
+
if (isRollY) {
|
|
797
|
+
internalData.lastScrollTop = scrollTop;
|
|
798
|
+
}
|
|
799
|
+
reactData.lastScrollTime = Date.now();
|
|
627
800
|
checkLastSyncScroll(isRollX, isRollY);
|
|
628
801
|
};
|
|
629
802
|
const ganttViewMethods = {
|
|
@@ -716,7 +889,8 @@ export default defineVxeComponent({
|
|
|
716
889
|
}
|
|
717
890
|
},
|
|
718
891
|
triggerBodyScrollEvent(evnt) {
|
|
719
|
-
const {
|
|
892
|
+
const { scrollXLoad } = reactData;
|
|
893
|
+
const { elemStore, inVirtualScroll, inHeaderScroll, inFooterScroll, lastScrollLeft, lastScrollTop } = internalData;
|
|
720
894
|
if (inVirtualScroll) {
|
|
721
895
|
return;
|
|
722
896
|
}
|
|
@@ -727,36 +901,44 @@ export default defineVxeComponent({
|
|
|
727
901
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
728
902
|
const xHandleEl = refScrollXHandleElem.value;
|
|
729
903
|
const yHandleEl = refScrollYHandleElem.value;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
syncTableScrollTop(currTopNum);
|
|
740
|
-
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
904
|
+
const scrollLeft = wrapperEl.scrollLeft;
|
|
905
|
+
const scrollTop = wrapperEl.scrollTop;
|
|
906
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
907
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
908
|
+
internalData.inBodyScroll = true;
|
|
909
|
+
internalData.scrollRenderType = '';
|
|
910
|
+
if (isRollY) {
|
|
911
|
+
setScrollTop(yHandleEl, scrollTop);
|
|
912
|
+
syncTableScrollTop(scrollTop);
|
|
741
913
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
const wrapperEl = evnt.currentTarget;
|
|
752
|
-
if (wrapperEl) {
|
|
753
|
-
const isRollX = true;
|
|
754
|
-
const isRollY = false;
|
|
755
|
-
const currLeftNum = wrapperEl.scrollLeft;
|
|
756
|
-
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
914
|
+
if (isRollX) {
|
|
915
|
+
internalData.inBodyScroll = true;
|
|
916
|
+
setScrollLeft(xHandleEl, scrollLeft);
|
|
917
|
+
setScrollLeft(headerScrollElem, scrollLeft);
|
|
918
|
+
if (scrollXLoad) {
|
|
919
|
+
triggerScrollXEvent();
|
|
920
|
+
}
|
|
757
921
|
}
|
|
922
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
|
|
758
923
|
},
|
|
924
|
+
// triggerFooterScrollEvent (evnt) {
|
|
925
|
+
// const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
926
|
+
// if (inVirtualScroll) {
|
|
927
|
+
// return
|
|
928
|
+
// }
|
|
929
|
+
// if (inHeaderScroll || inBodyScroll) {
|
|
930
|
+
// return
|
|
931
|
+
// }
|
|
932
|
+
// const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
933
|
+
// if (wrapperEl) {
|
|
934
|
+
// const isRollX = true
|
|
935
|
+
// const isRollY = false
|
|
936
|
+
// const currLeftNum = wrapperEl.scrollLeft
|
|
937
|
+
// handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
938
|
+
// }
|
|
939
|
+
// },
|
|
759
940
|
triggerVirtualScrollXEvent(evnt) {
|
|
941
|
+
const { scrollXLoad } = reactData;
|
|
760
942
|
const { elemStore, inHeaderScroll, inBodyScroll } = internalData;
|
|
761
943
|
if (inHeaderScroll || inBodyScroll) {
|
|
762
944
|
return;
|
|
@@ -771,6 +953,9 @@ export default defineVxeComponent({
|
|
|
771
953
|
internalData.inVirtualScroll = true;
|
|
772
954
|
setScrollLeft(headerScrollElem, currLeftNum);
|
|
773
955
|
setScrollLeft(bodyScrollElem, currLeftNum);
|
|
956
|
+
if (scrollXLoad) {
|
|
957
|
+
triggerScrollXEvent();
|
|
958
|
+
}
|
|
774
959
|
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
775
960
|
}
|
|
776
961
|
},
|
|
@@ -792,23 +977,11 @@ export default defineVxeComponent({
|
|
|
792
977
|
}
|
|
793
978
|
},
|
|
794
979
|
handleUpdateSXSpace() {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`]);
|
|
800
|
-
if (xSpaceElem) {
|
|
801
|
-
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
805
|
-
if (scrollXSpaceEl) {
|
|
806
|
-
scrollXSpaceEl.style.width = `${scrollXWidth}px`;
|
|
807
|
-
}
|
|
808
|
-
calcScrollbar();
|
|
809
|
-
return nextTick();
|
|
980
|
+
return updateScrollXSpace();
|
|
981
|
+
},
|
|
982
|
+
handleUpdateSYSpace() {
|
|
983
|
+
return updateScrollYSpace();
|
|
810
984
|
},
|
|
811
|
-
handleUpdateSYSpace: updateScrollYSpace,
|
|
812
985
|
handleUpdateSYStatus(sYLoad) {
|
|
813
986
|
reactData.scrollYLoad = sYLoad;
|
|
814
987
|
}
|
package/es/gantt/src/gantt.js
CHANGED
|
@@ -689,23 +689,23 @@ export default defineVxeComponent({
|
|
|
689
689
|
let tipHeight = 0;
|
|
690
690
|
if (rsNumLeftEl) {
|
|
691
691
|
if (offsetLeft < 0) {
|
|
692
|
+
rsNumLeftEl.style.display = 'none';
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
692
695
|
rsNumLeftEl.textContent = `${targetTableWidth}px`;
|
|
693
696
|
rsNumLeftEl.style.display = 'block';
|
|
694
697
|
tipHeight = rsNumLeftEl.offsetHeight;
|
|
695
698
|
}
|
|
696
|
-
else {
|
|
697
|
-
rsNumLeftEl.style.display = 'none';
|
|
698
|
-
}
|
|
699
699
|
}
|
|
700
700
|
if (rsNumRightEl) {
|
|
701
701
|
if (offsetLeft < 0) {
|
|
702
|
-
rsNumRightEl.style.display = 'none';
|
|
703
|
-
}
|
|
704
|
-
else {
|
|
705
702
|
rsNumRightEl.textContent = `${Math.floor(containerRect.width - targetTableWidth)}px`;
|
|
706
703
|
rsNumRightEl.style.display = 'block';
|
|
707
704
|
tipHeight = rsNumRightEl.offsetHeight;
|
|
708
705
|
}
|
|
706
|
+
else {
|
|
707
|
+
rsNumRightEl.style.display = 'none';
|
|
708
|
+
}
|
|
709
709
|
}
|
|
710
710
|
const tipTop = evnt.clientY - containerRect.top - tipHeight / 2;
|
|
711
711
|
rsSplitLineEl.style.left = `${targetTableWidth}px`;
|
|
@@ -1776,10 +1776,10 @@ export default defineVxeComponent({
|
|
|
1776
1776
|
}, [
|
|
1777
1777
|
h('div', {
|
|
1778
1778
|
class: 'vxe-gantt--resizable-split-number-left'
|
|
1779
|
-
}
|
|
1779
|
+
}),
|
|
1780
1780
|
h('div', {
|
|
1781
1781
|
class: 'vxe-gantt--resizable-split-number-right'
|
|
1782
|
-
}
|
|
1782
|
+
})
|
|
1783
1783
|
])
|
|
1784
1784
|
]),
|
|
1785
1785
|
h('div', {
|
|
@@ -1916,9 +1916,6 @@ export default defineVxeComponent({
|
|
|
1916
1916
|
if (props.expandConfig) {
|
|
1917
1917
|
warnLog('vxe.error.notProp', ['expand-config']);
|
|
1918
1918
|
}
|
|
1919
|
-
if (props.aggregateConfig) {
|
|
1920
|
-
warnLog('vxe.error.notProp', ['aggregate-config']);
|
|
1921
|
-
}
|
|
1922
1919
|
if (columns && columns.length) {
|
|
1923
1920
|
$xeGantt.loadColumn(columns);
|
|
1924
1921
|
}
|
package/es/gantt/style.css
CHANGED
|
@@ -152,6 +152,9 @@
|
|
|
152
152
|
width: var(--vxe-ui-gantt-view-split-bar-width);
|
|
153
153
|
background-color: var(--vxe-ui-gantt-view-split-bar-background-color);
|
|
154
154
|
}
|
|
155
|
+
.vxe-gantt .vxe-gantt--view-split-bar:hover, .vxe-gantt .vxe-gantt--view-split-bar:active {
|
|
156
|
+
background-color: var(--vxe-ui-gantt-view-split-bar-hover-background-color);
|
|
157
|
+
}
|
|
155
158
|
.vxe-gantt .vxe-gantt--view-split-bar.is--resize {
|
|
156
159
|
cursor: col-resize;
|
|
157
160
|
}
|
|
@@ -356,7 +359,8 @@
|
|
|
356
359
|
}
|
|
357
360
|
.vxe-gantt--view-split-bar-left-btn:hover,
|
|
358
361
|
.vxe-gantt--view-split-bar-right-btn:hover {
|
|
359
|
-
|
|
362
|
+
color: #ffffff;
|
|
363
|
+
background-color: var(--vxe-ui-font-primary-color);
|
|
360
364
|
}
|
|
361
365
|
.vxe-gantt--view-split-bar-left-btn:active,
|
|
362
366
|
.vxe-gantt--view-split-bar-right-btn:active {
|