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