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
package/lib/index.umd.js
CHANGED
|
@@ -2780,7 +2780,7 @@ var core_ = __webpack_require__(4345);
|
|
|
2780
2780
|
const {
|
|
2781
2781
|
log
|
|
2782
2782
|
} = core_.VxeUI;
|
|
2783
|
-
const version = `gantt v${"4.0.
|
|
2783
|
+
const version = `gantt v${"4.0.8"}`;
|
|
2784
2784
|
const warnLog = log.create('warn', version);
|
|
2785
2785
|
const errLog = log.create('error', version);
|
|
2786
2786
|
;// ./packages/ui/index.ts
|
|
@@ -2791,7 +2791,7 @@ const {
|
|
|
2791
2791
|
setIcon,
|
|
2792
2792
|
checkVersion
|
|
2793
2793
|
} = core_.VxeUI;
|
|
2794
|
-
core_.VxeUI.ganttVersion = "4.0.
|
|
2794
|
+
core_.VxeUI.ganttVersion = "4.0.8";
|
|
2795
2795
|
setConfig({
|
|
2796
2796
|
gantt: {
|
|
2797
2797
|
// size: null,
|
|
@@ -3335,10 +3335,12 @@ const {
|
|
|
3335
3335
|
const refHeaderXSpace = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
|
|
3336
3336
|
const renderVN = () => {
|
|
3337
3337
|
const {
|
|
3338
|
-
tableColumn,
|
|
3339
3338
|
headerGroups,
|
|
3340
3339
|
viewCellWidth
|
|
3341
3340
|
} = reactData;
|
|
3341
|
+
const {
|
|
3342
|
+
visibleColumn
|
|
3343
|
+
} = internalData;
|
|
3342
3344
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
3343
3345
|
ref: refElem,
|
|
3344
3346
|
class: 'vxe-gantt-view--header-wrapper'
|
|
@@ -3352,7 +3354,7 @@ const {
|
|
|
3352
3354
|
}), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('table', {
|
|
3353
3355
|
ref: refHeaderTable,
|
|
3354
3356
|
class: 'vxe-gantt-view--header-table'
|
|
3355
|
-
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('colgroup', {},
|
|
3357
|
+
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('colgroup', {}, visibleColumn.map((column, cIndex) => {
|
|
3356
3358
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('col', {
|
|
3357
3359
|
key: cIndex,
|
|
3358
3360
|
style: {
|
|
@@ -3944,6 +3946,7 @@ const {
|
|
|
3944
3946
|
function createInternalData() {
|
|
3945
3947
|
return {
|
|
3946
3948
|
xeTable: null,
|
|
3949
|
+
visibleColumn: [],
|
|
3947
3950
|
startMaps: {},
|
|
3948
3951
|
endMaps: {},
|
|
3949
3952
|
chartMaps: {},
|
|
@@ -3958,16 +3961,9 @@ function createInternalData() {
|
|
|
3958
3961
|
startIndex: 0,
|
|
3959
3962
|
endIndex: 0
|
|
3960
3963
|
},
|
|
3961
|
-
//
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
offsetSize: 0,
|
|
3965
|
-
visibleSize: 0,
|
|
3966
|
-
visibleStartIndex: 0,
|
|
3967
|
-
visibleEndIndex: 0,
|
|
3968
|
-
startIndex: 0,
|
|
3969
|
-
endIndex: 0
|
|
3970
|
-
}
|
|
3964
|
+
// 最后滚动位置
|
|
3965
|
+
lastScrollTop: 0,
|
|
3966
|
+
lastScrollLeft: 0
|
|
3971
3967
|
};
|
|
3972
3968
|
}
|
|
3973
3969
|
const maxYHeight = 5e6;
|
|
@@ -4012,6 +4008,8 @@ const maxYHeight = 5e6;
|
|
|
4012
4008
|
scrollbarWidth: 0,
|
|
4013
4009
|
// 横向滚动条的高度
|
|
4014
4010
|
scrollbarHeight: 0,
|
|
4011
|
+
// 最后滚动时间戳
|
|
4012
|
+
lastScrollTime: 0,
|
|
4015
4013
|
lazScrollLoading: false,
|
|
4016
4014
|
scrollVMLoading: false,
|
|
4017
4015
|
scrollYHeight: 0,
|
|
@@ -4086,37 +4084,37 @@ const maxYHeight = 5e6;
|
|
|
4086
4084
|
const currTime = minViewDate.getTime();
|
|
4087
4085
|
const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
|
|
4088
4086
|
const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
|
|
4089
|
-
switch (minScale.type) {
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
}
|
|
4087
|
+
// switch (minScale.type) {
|
|
4088
|
+
// case 'day':
|
|
4089
|
+
// case 'date':
|
|
4090
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
|
|
4091
|
+
// reactData.tableColumn = []
|
|
4092
|
+
// reactData.headerGroups = []
|
|
4093
|
+
// return
|
|
4094
|
+
// }
|
|
4095
|
+
// break
|
|
4096
|
+
// case 'hour':
|
|
4097
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
|
|
4098
|
+
// reactData.tableColumn = []
|
|
4099
|
+
// reactData.headerGroups = []
|
|
4100
|
+
// return
|
|
4101
|
+
// }
|
|
4102
|
+
// break
|
|
4103
|
+
// case 'minute':
|
|
4104
|
+
// if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
|
|
4105
|
+
// reactData.tableColumn = []
|
|
4106
|
+
// reactData.headerGroups = []
|
|
4107
|
+
// return
|
|
4108
|
+
// }
|
|
4109
|
+
// break
|
|
4110
|
+
// case 'second':
|
|
4111
|
+
// if (diffDayNum > (1000 * 60 * 60 * 3)) {
|
|
4112
|
+
// reactData.tableColumn = []
|
|
4113
|
+
// reactData.headerGroups = []
|
|
4114
|
+
// return
|
|
4115
|
+
// }
|
|
4116
|
+
// break
|
|
4117
|
+
// }
|
|
4120
4118
|
const renderListMaps = {
|
|
4121
4119
|
year: [],
|
|
4122
4120
|
quarter: [],
|
|
@@ -4276,13 +4274,20 @@ const maxYHeight = 5e6;
|
|
|
4276
4274
|
const startField = computeStartField.value;
|
|
4277
4275
|
const endField = computeEndField.value;
|
|
4278
4276
|
const {
|
|
4277
|
+
computeAggregateOpts,
|
|
4279
4278
|
computeTreeOpts
|
|
4280
4279
|
} = $xeTable.getComputeMaps();
|
|
4280
|
+
const tableReactData = $xeTable.reactData;
|
|
4281
|
+
const {
|
|
4282
|
+
isRowGroupStatus
|
|
4283
|
+
} = tableReactData;
|
|
4281
4284
|
const tableInternalData = $xeTable.internalData;
|
|
4282
4285
|
const {
|
|
4283
4286
|
afterFullData,
|
|
4284
|
-
afterTreeFullData
|
|
4287
|
+
afterTreeFullData,
|
|
4288
|
+
afterGroupFullData
|
|
4285
4289
|
} = tableInternalData;
|
|
4290
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
4286
4291
|
const treeOpts = computeTreeOpts.value;
|
|
4287
4292
|
const {
|
|
4288
4293
|
transform
|
|
@@ -4306,7 +4311,16 @@ const maxYHeight = 5e6;
|
|
|
4306
4311
|
};
|
|
4307
4312
|
}
|
|
4308
4313
|
};
|
|
4309
|
-
if (
|
|
4314
|
+
if (isRowGroupStatus) {
|
|
4315
|
+
// 行分组
|
|
4316
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
4317
|
+
if (mapChildrenField) {
|
|
4318
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, handleParseRender, {
|
|
4319
|
+
children: mapChildrenField
|
|
4320
|
+
});
|
|
4321
|
+
}
|
|
4322
|
+
} else if (treeConfig) {
|
|
4323
|
+
// 树结构
|
|
4310
4324
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, handleParseRender, {
|
|
4311
4325
|
children: transform ? treeOpts.mapChildrenField : childrenField
|
|
4312
4326
|
});
|
|
@@ -4316,14 +4330,19 @@ const maxYHeight = 5e6;
|
|
|
4316
4330
|
internalData.chartMaps = ctMaps;
|
|
4317
4331
|
}
|
|
4318
4332
|
}
|
|
4319
|
-
|
|
4333
|
+
internalData.visibleColumn = fullCols;
|
|
4320
4334
|
reactData.headerGroups = groupCols;
|
|
4335
|
+
updateScrollXStatus();
|
|
4336
|
+
handleTableColumn();
|
|
4321
4337
|
};
|
|
4322
4338
|
const handleUpdateData = () => {
|
|
4323
4339
|
const ganttProps = $xeGantt.props;
|
|
4324
4340
|
const {
|
|
4325
4341
|
treeConfig
|
|
4326
4342
|
} = ganttProps;
|
|
4343
|
+
const {
|
|
4344
|
+
scrollXStore
|
|
4345
|
+
} = internalData;
|
|
4327
4346
|
const $xeTable = internalData.xeTable;
|
|
4328
4347
|
const sdMaps = {};
|
|
4329
4348
|
const edMaps = {};
|
|
@@ -4333,13 +4352,20 @@ const maxYHeight = 5e6;
|
|
|
4333
4352
|
const startField = computeStartField.value;
|
|
4334
4353
|
const endField = computeEndField.value;
|
|
4335
4354
|
const {
|
|
4355
|
+
computeAggregateOpts,
|
|
4336
4356
|
computeTreeOpts
|
|
4337
4357
|
} = $xeTable.getComputeMaps();
|
|
4358
|
+
const tableReactData = $xeTable.reactData;
|
|
4359
|
+
const {
|
|
4360
|
+
isRowGroupStatus
|
|
4361
|
+
} = tableReactData;
|
|
4338
4362
|
const tableInternalData = $xeTable.internalData;
|
|
4339
4363
|
const {
|
|
4340
4364
|
afterFullData,
|
|
4341
|
-
afterTreeFullData
|
|
4365
|
+
afterTreeFullData,
|
|
4366
|
+
afterGroupFullData
|
|
4342
4367
|
} = tableInternalData;
|
|
4368
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
4343
4369
|
const treeOpts = computeTreeOpts.value;
|
|
4344
4370
|
const {
|
|
4345
4371
|
transform
|
|
@@ -4359,7 +4385,16 @@ const maxYHeight = 5e6;
|
|
|
4359
4385
|
}
|
|
4360
4386
|
}
|
|
4361
4387
|
};
|
|
4362
|
-
if (
|
|
4388
|
+
if (isRowGroupStatus) {
|
|
4389
|
+
// 行分组
|
|
4390
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
4391
|
+
if (mapChildrenField) {
|
|
4392
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterGroupFullData, handleMinMaxData, {
|
|
4393
|
+
children: mapChildrenField
|
|
4394
|
+
});
|
|
4395
|
+
}
|
|
4396
|
+
} else if (treeConfig) {
|
|
4397
|
+
// 树结构
|
|
4363
4398
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, handleMinMaxData, {
|
|
4364
4399
|
children: transform ? treeOpts.mapChildrenField : childrenField
|
|
4365
4400
|
});
|
|
@@ -4367,6 +4402,8 @@ const maxYHeight = 5e6;
|
|
|
4367
4402
|
afterFullData.forEach(handleMinMaxData);
|
|
4368
4403
|
}
|
|
4369
4404
|
}
|
|
4405
|
+
scrollXStore.startIndex = 0;
|
|
4406
|
+
scrollXStore.endIndex = Math.max(1, scrollXStore.visibleSize);
|
|
4370
4407
|
reactData.minViewDate = minDate;
|
|
4371
4408
|
reactData.maxViewDate = maxDate;
|
|
4372
4409
|
internalData.startMaps = sdMaps;
|
|
@@ -4417,10 +4454,8 @@ const maxYHeight = 5e6;
|
|
|
4417
4454
|
}
|
|
4418
4455
|
const rowid = rowEl.getAttribute('rowid');
|
|
4419
4456
|
const rowRest = rowid ? chartMaps[rowid] : null;
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`;
|
|
4423
|
-
}
|
|
4457
|
+
barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`;
|
|
4458
|
+
barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`;
|
|
4424
4459
|
});
|
|
4425
4460
|
}
|
|
4426
4461
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
@@ -4429,11 +4464,12 @@ const maxYHeight = 5e6;
|
|
|
4429
4464
|
const {
|
|
4430
4465
|
scrollbarWidth,
|
|
4431
4466
|
scrollbarHeight,
|
|
4432
|
-
|
|
4433
|
-
|
|
4467
|
+
headerGroups,
|
|
4468
|
+
tableColumn
|
|
4434
4469
|
} = reactData;
|
|
4435
4470
|
const {
|
|
4436
|
-
elemStore
|
|
4471
|
+
elemStore,
|
|
4472
|
+
visibleColumn
|
|
4437
4473
|
} = internalData;
|
|
4438
4474
|
const $xeTable = internalData.xeTable;
|
|
4439
4475
|
const el = refElem.value;
|
|
@@ -4515,37 +4551,230 @@ const maxYHeight = 5e6;
|
|
|
4515
4551
|
yBottomCornerEl.style.display = tFooterHeight ? 'block' : '';
|
|
4516
4552
|
}
|
|
4517
4553
|
const colInfoElem = refColInfoElem.value;
|
|
4554
|
+
let viewCellWidth = 40;
|
|
4518
4555
|
if (colInfoElem) {
|
|
4519
|
-
|
|
4556
|
+
viewCellWidth = colInfoElem.clientWidth || 40;
|
|
4520
4557
|
}
|
|
4521
|
-
let viewTableWidth =
|
|
4558
|
+
let viewTableWidth = viewCellWidth * visibleColumn.length;
|
|
4522
4559
|
if (bodyScrollElem) {
|
|
4523
4560
|
const viewWidth = bodyScrollElem.clientWidth;
|
|
4524
4561
|
const remainWidth = viewWidth - viewTableWidth;
|
|
4525
4562
|
if (remainWidth > 0) {
|
|
4526
|
-
|
|
4563
|
+
viewCellWidth += Math.floor(remainWidth / visibleColumn.length);
|
|
4527
4564
|
viewTableWidth = viewWidth;
|
|
4528
4565
|
}
|
|
4529
4566
|
}
|
|
4567
|
+
reactData.viewCellWidth = viewCellWidth;
|
|
4530
4568
|
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
4531
4569
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
4570
|
+
const vmTableWidth = viewCellWidth * tableColumn.length;
|
|
4532
4571
|
if (headerTableElem) {
|
|
4533
4572
|
headerTableElem.style.width = `${viewTableWidth}px`;
|
|
4534
4573
|
}
|
|
4535
4574
|
if (bodyTableElem) {
|
|
4536
|
-
bodyTableElem.style.width = `${
|
|
4575
|
+
bodyTableElem.style.width = `${vmTableWidth}px`;
|
|
4537
4576
|
}
|
|
4538
4577
|
reactData.scrollXWidth = viewTableWidth;
|
|
4539
4578
|
return updateChart();
|
|
4540
4579
|
};
|
|
4541
|
-
const
|
|
4580
|
+
const handleRecalculateStyle = () => {
|
|
4581
|
+
const el = refElem.value;
|
|
4582
|
+
internalData.rceRunTime = Date.now();
|
|
4583
|
+
if (!el || !el.clientWidth) {
|
|
4584
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
4585
|
+
}
|
|
4542
4586
|
calcScrollbar();
|
|
4543
4587
|
updateStyle();
|
|
4544
4588
|
updateChart();
|
|
4589
|
+
return computeScrollLoad();
|
|
4590
|
+
};
|
|
4591
|
+
const handleLazyRecalculate = () => {
|
|
4592
|
+
return new Promise(resolve => {
|
|
4593
|
+
const {
|
|
4594
|
+
rceTimeout,
|
|
4595
|
+
rceRunTime
|
|
4596
|
+
} = internalData;
|
|
4597
|
+
const $xeTable = internalData.xeTable;
|
|
4598
|
+
let refreshDelay = 50;
|
|
4599
|
+
if ($xeTable) {
|
|
4600
|
+
const {
|
|
4601
|
+
computeResizeOpts
|
|
4602
|
+
} = $xeTable.getComputeMaps();
|
|
4603
|
+
const resizeOpts = computeResizeOpts.value;
|
|
4604
|
+
refreshDelay = resizeOpts.refreshDelay || 50;
|
|
4605
|
+
}
|
|
4606
|
+
if (rceTimeout) {
|
|
4607
|
+
clearTimeout(rceTimeout);
|
|
4608
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
4609
|
+
resolve(handleRecalculateStyle());
|
|
4610
|
+
} else {
|
|
4611
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
4612
|
+
resolve();
|
|
4613
|
+
});
|
|
4614
|
+
}
|
|
4615
|
+
} else {
|
|
4616
|
+
resolve(handleRecalculateStyle());
|
|
4617
|
+
}
|
|
4618
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
4619
|
+
internalData.rceTimeout = undefined;
|
|
4620
|
+
handleRecalculateStyle();
|
|
4621
|
+
}, refreshDelay);
|
|
4622
|
+
});
|
|
4623
|
+
};
|
|
4624
|
+
const computeScrollLoad = () => {
|
|
4625
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
|
|
4626
|
+
const {
|
|
4627
|
+
scrollXLoad
|
|
4628
|
+
} = reactData;
|
|
4629
|
+
const {
|
|
4630
|
+
scrollXStore
|
|
4631
|
+
} = internalData;
|
|
4632
|
+
// 计算 X 逻辑
|
|
4633
|
+
if (scrollXLoad) {
|
|
4634
|
+
const {
|
|
4635
|
+
toVisibleIndex: toXVisibleIndex,
|
|
4636
|
+
visibleSize: visibleXSize
|
|
4637
|
+
} = handleVirtualXVisible();
|
|
4638
|
+
const offsetXSize = 2;
|
|
4639
|
+
scrollXStore.preloadSize = 1;
|
|
4640
|
+
scrollXStore.offsetSize = offsetXSize;
|
|
4641
|
+
scrollXStore.visibleSize = visibleXSize;
|
|
4642
|
+
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
4643
|
+
scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
|
|
4644
|
+
scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
|
|
4645
|
+
updateScrollXData().then(() => {
|
|
4646
|
+
loadScrollXData();
|
|
4647
|
+
});
|
|
4648
|
+
} else {
|
|
4649
|
+
updateScrollXSpace();
|
|
4650
|
+
}
|
|
4651
|
+
});
|
|
4652
|
+
};
|
|
4653
|
+
const handleVirtualXVisible = () => {
|
|
4654
|
+
const {
|
|
4655
|
+
viewCellWidth
|
|
4656
|
+
} = reactData;
|
|
4657
|
+
const {
|
|
4658
|
+
elemStore
|
|
4659
|
+
} = internalData;
|
|
4660
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
4661
|
+
if (bodyScrollElem) {
|
|
4662
|
+
const clientWidth = bodyScrollElem.clientWidth;
|
|
4663
|
+
const scrollLeft = bodyScrollElem.scrollLeft;
|
|
4664
|
+
const toVisibleIndex = Math.floor(scrollLeft / viewCellWidth) - 1;
|
|
4665
|
+
const visibleSize = Math.ceil(clientWidth / viewCellWidth) + 1;
|
|
4666
|
+
return {
|
|
4667
|
+
toVisibleIndex: Math.max(0, toVisibleIndex),
|
|
4668
|
+
visibleSize: Math.max(1, visibleSize)
|
|
4669
|
+
};
|
|
4670
|
+
}
|
|
4671
|
+
return {
|
|
4672
|
+
toVisibleIndex: 0,
|
|
4673
|
+
visibleSize: 6
|
|
4674
|
+
};
|
|
4675
|
+
};
|
|
4676
|
+
const loadScrollXData = () => {
|
|
4677
|
+
const {
|
|
4678
|
+
isScrollXBig
|
|
4679
|
+
} = reactData;
|
|
4680
|
+
const {
|
|
4681
|
+
scrollXStore
|
|
4682
|
+
} = internalData;
|
|
4683
|
+
const {
|
|
4684
|
+
preloadSize,
|
|
4685
|
+
startIndex,
|
|
4686
|
+
endIndex,
|
|
4687
|
+
offsetSize
|
|
4688
|
+
} = scrollXStore;
|
|
4689
|
+
const {
|
|
4690
|
+
toVisibleIndex,
|
|
4691
|
+
visibleSize
|
|
4692
|
+
} = handleVirtualXVisible();
|
|
4693
|
+
const offsetItem = {
|
|
4694
|
+
startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
4695
|
+
endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
4696
|
+
};
|
|
4697
|
+
scrollXStore.visibleStartIndex = toVisibleIndex - 1;
|
|
4698
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
4699
|
+
const {
|
|
4700
|
+
startIndex: offsetStartIndex,
|
|
4701
|
+
endIndex: offsetEndIndex
|
|
4702
|
+
} = offsetItem;
|
|
4703
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
4704
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
4705
|
+
scrollXStore.startIndex = offsetStartIndex;
|
|
4706
|
+
scrollXStore.endIndex = offsetEndIndex;
|
|
4707
|
+
updateScrollXData();
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
};
|
|
4711
|
+
const updateScrollXData = () => {
|
|
4712
|
+
handleTableColumn();
|
|
4713
|
+
updateScrollXSpace();
|
|
4714
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
4715
|
+
};
|
|
4716
|
+
const updateScrollXStatus = () => {
|
|
4717
|
+
const scrollXLoad = true;
|
|
4718
|
+
reactData.scrollXLoad = scrollXLoad;
|
|
4719
|
+
return scrollXLoad;
|
|
4720
|
+
};
|
|
4721
|
+
const handleTableColumn = () => {
|
|
4722
|
+
const {
|
|
4723
|
+
scrollXLoad
|
|
4724
|
+
} = reactData;
|
|
4725
|
+
const {
|
|
4726
|
+
visibleColumn,
|
|
4727
|
+
scrollXStore
|
|
4728
|
+
} = internalData;
|
|
4729
|
+
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
4730
|
+
reactData.tableColumn = tableColumn;
|
|
4731
|
+
};
|
|
4732
|
+
const updateScrollXSpace = () => {
|
|
4733
|
+
const {
|
|
4734
|
+
scrollXLoad,
|
|
4735
|
+
scrollXWidth,
|
|
4736
|
+
viewCellWidth
|
|
4737
|
+
} = reactData;
|
|
4738
|
+
const {
|
|
4739
|
+
elemStore,
|
|
4740
|
+
scrollXStore
|
|
4741
|
+
} = internalData;
|
|
4742
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
4743
|
+
// const headerTableElem = getRefElem(elemStore['main-header-table'])
|
|
4744
|
+
// const footerTableElem = getRefElem(elemStore['main-footer-table'])
|
|
4745
|
+
const {
|
|
4746
|
+
startIndex
|
|
4747
|
+
} = scrollXStore;
|
|
4748
|
+
let xSpaceLeft = 0;
|
|
4749
|
+
if (scrollXLoad) {
|
|
4750
|
+
xSpaceLeft = Math.max(0, startIndex * viewCellWidth);
|
|
4751
|
+
}
|
|
4752
|
+
// if (headerTableElem) {
|
|
4753
|
+
// headerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
4754
|
+
// }
|
|
4755
|
+
if (bodyTableElem) {
|
|
4756
|
+
bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
|
|
4757
|
+
}
|
|
4758
|
+
// if (footerTableElem) {
|
|
4759
|
+
// footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
4760
|
+
// }
|
|
4761
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
4762
|
+
layoutList.forEach(layout => {
|
|
4763
|
+
const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`]);
|
|
4764
|
+
if (xSpaceElem) {
|
|
4765
|
+
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
|
|
4766
|
+
}
|
|
4767
|
+
});
|
|
4768
|
+
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
4769
|
+
if (scrollXSpaceEl) {
|
|
4770
|
+
scrollXSpaceEl.style.width = `${scrollXWidth}px`;
|
|
4771
|
+
}
|
|
4772
|
+
calcScrollbar();
|
|
4545
4773
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
4546
4774
|
};
|
|
4547
|
-
|
|
4548
|
-
|
|
4775
|
+
const triggerScrollXEvent = () => {
|
|
4776
|
+
loadScrollXData();
|
|
4777
|
+
};
|
|
4549
4778
|
const updateScrollYSpace = () => {
|
|
4550
4779
|
const {
|
|
4551
4780
|
elemStore
|
|
@@ -4623,6 +4852,13 @@ const maxYHeight = 5e6;
|
|
|
4623
4852
|
};
|
|
4624
4853
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4625
4854
|
const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
4855
|
+
if (isRollX) {
|
|
4856
|
+
internalData.lastScrollLeft = scrollLeft;
|
|
4857
|
+
}
|
|
4858
|
+
if (isRollY) {
|
|
4859
|
+
internalData.lastScrollTop = scrollTop;
|
|
4860
|
+
}
|
|
4861
|
+
reactData.lastScrollTime = Date.now();
|
|
4626
4862
|
checkLastSyncScroll(isRollX, isRollY);
|
|
4627
4863
|
};
|
|
4628
4864
|
const ganttViewMethods = {
|
|
@@ -4728,11 +4964,16 @@ const maxYHeight = 5e6;
|
|
|
4728
4964
|
}
|
|
4729
4965
|
},
|
|
4730
4966
|
triggerBodyScrollEvent(evnt) {
|
|
4967
|
+
const {
|
|
4968
|
+
scrollXLoad
|
|
4969
|
+
} = reactData;
|
|
4731
4970
|
const {
|
|
4732
4971
|
elemStore,
|
|
4733
4972
|
inVirtualScroll,
|
|
4734
4973
|
inHeaderScroll,
|
|
4735
|
-
inFooterScroll
|
|
4974
|
+
inFooterScroll,
|
|
4975
|
+
lastScrollLeft,
|
|
4976
|
+
lastScrollTop
|
|
4736
4977
|
} = internalData;
|
|
4737
4978
|
if (inVirtualScroll) {
|
|
4738
4979
|
return;
|
|
@@ -4744,40 +4985,46 @@ const maxYHeight = 5e6;
|
|
|
4744
4985
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
4745
4986
|
const xHandleEl = refScrollXHandleElem.value;
|
|
4746
4987
|
const yHandleEl = refScrollYHandleElem.value;
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
syncTableScrollTop(currTopNum);
|
|
4757
|
-
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
4988
|
+
const scrollLeft = wrapperEl.scrollLeft;
|
|
4989
|
+
const scrollTop = wrapperEl.scrollTop;
|
|
4990
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
4991
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
4992
|
+
internalData.inBodyScroll = true;
|
|
4993
|
+
internalData.scrollRenderType = '';
|
|
4994
|
+
if (isRollY) {
|
|
4995
|
+
setScrollTop(yHandleEl, scrollTop);
|
|
4996
|
+
syncTableScrollTop(scrollTop);
|
|
4758
4997
|
}
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
if (inVirtualScroll) {
|
|
4767
|
-
return;
|
|
4768
|
-
}
|
|
4769
|
-
if (inHeaderScroll || inBodyScroll) {
|
|
4770
|
-
return;
|
|
4771
|
-
}
|
|
4772
|
-
const wrapperEl = evnt.currentTarget;
|
|
4773
|
-
if (wrapperEl) {
|
|
4774
|
-
const isRollX = true;
|
|
4775
|
-
const isRollY = false;
|
|
4776
|
-
const currLeftNum = wrapperEl.scrollLeft;
|
|
4777
|
-
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
4998
|
+
if (isRollX) {
|
|
4999
|
+
internalData.inBodyScroll = true;
|
|
5000
|
+
setScrollLeft(xHandleEl, scrollLeft);
|
|
5001
|
+
setScrollLeft(headerScrollElem, scrollLeft);
|
|
5002
|
+
if (scrollXLoad) {
|
|
5003
|
+
triggerScrollXEvent();
|
|
5004
|
+
}
|
|
4778
5005
|
}
|
|
5006
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
|
|
4779
5007
|
},
|
|
5008
|
+
// triggerFooterScrollEvent (evnt) {
|
|
5009
|
+
// const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
5010
|
+
// if (inVirtualScroll) {
|
|
5011
|
+
// return
|
|
5012
|
+
// }
|
|
5013
|
+
// if (inHeaderScroll || inBodyScroll) {
|
|
5014
|
+
// return
|
|
5015
|
+
// }
|
|
5016
|
+
// const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
5017
|
+
// if (wrapperEl) {
|
|
5018
|
+
// const isRollX = true
|
|
5019
|
+
// const isRollY = false
|
|
5020
|
+
// const currLeftNum = wrapperEl.scrollLeft
|
|
5021
|
+
// handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum)
|
|
5022
|
+
// }
|
|
5023
|
+
// },
|
|
4780
5024
|
triggerVirtualScrollXEvent(evnt) {
|
|
5025
|
+
const {
|
|
5026
|
+
scrollXLoad
|
|
5027
|
+
} = reactData;
|
|
4781
5028
|
const {
|
|
4782
5029
|
elemStore,
|
|
4783
5030
|
inHeaderScroll,
|
|
@@ -4796,6 +5043,9 @@ const maxYHeight = 5e6;
|
|
|
4796
5043
|
internalData.inVirtualScroll = true;
|
|
4797
5044
|
setScrollLeft(headerScrollElem, currLeftNum);
|
|
4798
5045
|
setScrollLeft(bodyScrollElem, currLeftNum);
|
|
5046
|
+
if (scrollXLoad) {
|
|
5047
|
+
triggerScrollXEvent();
|
|
5048
|
+
}
|
|
4799
5049
|
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
4800
5050
|
}
|
|
4801
5051
|
},
|
|
@@ -4821,28 +5071,11 @@ const maxYHeight = 5e6;
|
|
|
4821
5071
|
}
|
|
4822
5072
|
},
|
|
4823
5073
|
handleUpdateSXSpace() {
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
const {
|
|
4829
|
-
elemStore
|
|
4830
|
-
} = internalData;
|
|
4831
|
-
const layoutList = ['header', 'body', 'footer'];
|
|
4832
|
-
layoutList.forEach(layout => {
|
|
4833
|
-
const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`]);
|
|
4834
|
-
if (xSpaceElem) {
|
|
4835
|
-
xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : '';
|
|
4836
|
-
}
|
|
4837
|
-
});
|
|
4838
|
-
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
4839
|
-
if (scrollXSpaceEl) {
|
|
4840
|
-
scrollXSpaceEl.style.width = `${scrollXWidth}px`;
|
|
4841
|
-
}
|
|
4842
|
-
calcScrollbar();
|
|
4843
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
5074
|
+
return updateScrollXSpace();
|
|
5075
|
+
},
|
|
5076
|
+
handleUpdateSYSpace() {
|
|
5077
|
+
return updateScrollYSpace();
|
|
4844
5078
|
},
|
|
4845
|
-
handleUpdateSYSpace: updateScrollYSpace,
|
|
4846
5079
|
handleUpdateSYStatus(sYLoad) {
|
|
4847
5080
|
reactData.scrollYLoad = sYLoad;
|
|
4848
5081
|
}
|
|
@@ -5792,20 +6025,20 @@ function getViewTypeLevel(type) {
|
|
|
5792
6025
|
let tipHeight = 0;
|
|
5793
6026
|
if (rsNumLeftEl) {
|
|
5794
6027
|
if (offsetLeft < 0) {
|
|
6028
|
+
rsNumLeftEl.style.display = 'none';
|
|
6029
|
+
} else {
|
|
5795
6030
|
rsNumLeftEl.textContent = `${targetTableWidth}px`;
|
|
5796
6031
|
rsNumLeftEl.style.display = 'block';
|
|
5797
6032
|
tipHeight = rsNumLeftEl.offsetHeight;
|
|
5798
|
-
} else {
|
|
5799
|
-
rsNumLeftEl.style.display = 'none';
|
|
5800
6033
|
}
|
|
5801
6034
|
}
|
|
5802
6035
|
if (rsNumRightEl) {
|
|
5803
6036
|
if (offsetLeft < 0) {
|
|
5804
|
-
rsNumRightEl.style.display = 'none';
|
|
5805
|
-
} else {
|
|
5806
6037
|
rsNumRightEl.textContent = `${Math.floor(containerRect.width - targetTableWidth)}px`;
|
|
5807
6038
|
rsNumRightEl.style.display = 'block';
|
|
5808
6039
|
tipHeight = rsNumRightEl.offsetHeight;
|
|
6040
|
+
} else {
|
|
6041
|
+
rsNumRightEl.style.display = 'none';
|
|
5809
6042
|
}
|
|
5810
6043
|
}
|
|
5811
6044
|
const tipTop = evnt.clientY - containerRect.top - tipHeight / 2;
|
|
@@ -7069,9 +7302,9 @@ function getViewTypeLevel(type) {
|
|
|
7069
7302
|
class: 'vxe-gantt--resizable-split-tip-number'
|
|
7070
7303
|
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
7071
7304
|
class: 'vxe-gantt--resizable-split-number-left'
|
|
7072
|
-
}
|
|
7305
|
+
}), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
7073
7306
|
class: 'vxe-gantt--resizable-split-number-right'
|
|
7074
|
-
}
|
|
7307
|
+
})])]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
7075
7308
|
class: 'vxe-gantt--border-line'
|
|
7076
7309
|
})]));
|
|
7077
7310
|
break;
|
|
@@ -7203,9 +7436,6 @@ function getViewTypeLevel(type) {
|
|
|
7203
7436
|
if (props.expandConfig) {
|
|
7204
7437
|
warnLog('vxe.error.notProp', ['expand-config']);
|
|
7205
7438
|
}
|
|
7206
|
-
if (props.aggregateConfig) {
|
|
7207
|
-
warnLog('vxe.error.notProp', ['aggregate-config']);
|
|
7208
|
-
}
|
|
7209
7439
|
if (columns && columns.length) {
|
|
7210
7440
|
$xeGantt.loadColumn(columns);
|
|
7211
7441
|
}
|