vxe-table 3.12.9 → 3.12.10-beta.0
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/grid/src/grid.js +6 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/export/mixin.js +3 -3
- package/es/table/module/filter/mixin.js +3 -3
- package/es/table/module/keyboard/mixin.js +4 -4
- package/es/table/module/menu/mixin.js +2 -2
- package/es/table/module/validator/mixin.js +2 -2
- package/es/table/src/body.js +247 -351
- package/es/table/src/footer.js +135 -154
- package/es/table/src/header.js +120 -100
- package/es/table/src/methods.js +1174 -790
- package/es/table/src/props.js +9 -3
- package/es/table/src/table.js +187 -103
- package/es/table/src/util.js +16 -7
- package/es/table/style.css +146 -63
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +14 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +146 -63
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +4 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1896 -1543
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/export/mixin.js +3 -3
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/filter/mixin.js +4 -4
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +5 -5
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +2 -2
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +2 -2
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +185 -365
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +124 -151
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +97 -74
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1258 -830
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +9 -3
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +171 -90
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +17 -7
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +146 -63
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +14 -4
- 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-table/style/style.css +146 -63
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +6 -1
- package/packages/table/module/export/mixin.ts +3 -3
- package/packages/table/module/filter/mixin.ts +3 -3
- package/packages/table/module/keyboard/mixin.ts +4 -4
- package/packages/table/module/menu/mixin.ts +2 -2
- package/packages/table/module/validator/mixin.ts +2 -2
- package/packages/table/src/body.ts +281 -427
- package/packages/table/src/footer.ts +148 -164
- package/packages/table/src/header.ts +135 -111
- package/packages/table/src/methods.ts +1246 -845
- package/packages/table/src/props.ts +9 -3
- package/packages/table/src/table.ts +195 -146
- package/packages/table/src/util.ts +17 -7
- package/packages/ui/index.ts +13 -3
- package/styles/components/table.scss +164 -74
- /package/es/{iconfont.1736414871619.ttf → iconfont.1736688976404.ttf} +0 -0
- /package/es/{iconfont.1736414871619.woff → iconfont.1736688976404.woff} +0 -0
- /package/es/{iconfont.1736414871619.woff2 → iconfont.1736688976404.woff2} +0 -0
- /package/lib/{iconfont.1736414871619.ttf → iconfont.1736688976404.ttf} +0 -0
- /package/lib/{iconfont.1736414871619.woff → iconfont.1736688976404.woff} +0 -0
- /package/lib/{iconfont.1736414871619.woff2 → iconfont.1736688976404.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -22,14 +22,6 @@ const {
|
|
|
22
22
|
createEvent
|
|
23
23
|
} = _ui.VxeUI;
|
|
24
24
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
25
|
-
// 获取所有的列,排除分组
|
|
26
|
-
const getColumnList = columns => {
|
|
27
|
-
const result = [];
|
|
28
|
-
columns.forEach(column => {
|
|
29
|
-
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
30
|
-
});
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
25
|
function eqCellValue(row1, row2, field) {
|
|
34
26
|
const val1 = _xeUtils.default.get(row1, field);
|
|
35
27
|
const val2 = _xeUtils.default.get(row2, field);
|
|
@@ -89,22 +81,25 @@ function handleReserveRow(_vm, reserveRowMap) {
|
|
|
89
81
|
function handleVirtualXVisible($xeTable) {
|
|
90
82
|
const internalData = $xeTable;
|
|
91
83
|
const {
|
|
84
|
+
elemStore,
|
|
92
85
|
visibleColumn
|
|
93
86
|
} = internalData;
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
87
|
+
const leftFixedWidth = $xeTable.computeLeftFixedWidth;
|
|
88
|
+
const rightFixedWidth = $xeTable.computeRightFixedWidth;
|
|
89
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
90
|
+
if (bodyScrollElem) {
|
|
97
91
|
const {
|
|
98
92
|
scrollLeft,
|
|
99
93
|
clientWidth
|
|
100
|
-
} =
|
|
101
|
-
const
|
|
94
|
+
} = bodyScrollElem;
|
|
95
|
+
const startWidth = scrollLeft + leftFixedWidth;
|
|
96
|
+
const endWidth = scrollLeft + clientWidth - rightFixedWidth;
|
|
102
97
|
let toVisibleIndex = -1;
|
|
103
98
|
let cWidth = 0;
|
|
104
99
|
let visibleSize = 0;
|
|
105
100
|
for (let colIndex = 0, colLen = visibleColumn.length; colIndex < colLen; colIndex++) {
|
|
106
101
|
cWidth += visibleColumn[colIndex].renderWidth;
|
|
107
|
-
if (toVisibleIndex === -1 &&
|
|
102
|
+
if (toVisibleIndex === -1 && startWidth < cWidth) {
|
|
108
103
|
toVisibleIndex = colIndex;
|
|
109
104
|
}
|
|
110
105
|
if (toVisibleIndex >= 0) {
|
|
@@ -116,7 +111,7 @@ function handleVirtualXVisible($xeTable) {
|
|
|
116
111
|
}
|
|
117
112
|
return {
|
|
118
113
|
toVisibleIndex: Math.max(0, toVisibleIndex),
|
|
119
|
-
visibleSize: Math.max(
|
|
114
|
+
visibleSize: Math.max(1, visibleSize)
|
|
120
115
|
};
|
|
121
116
|
}
|
|
122
117
|
return {
|
|
@@ -124,10 +119,97 @@ function handleVirtualXVisible($xeTable) {
|
|
|
124
119
|
visibleSize: 6
|
|
125
120
|
};
|
|
126
121
|
}
|
|
122
|
+
function handleCustomRestore($xeTable, storeData) {
|
|
123
|
+
const reactData = $xeTable;
|
|
124
|
+
const internalData = $xeTable;
|
|
125
|
+
let {
|
|
126
|
+
collectColumn
|
|
127
|
+
} = internalData;
|
|
128
|
+
const {
|
|
129
|
+
resizableData,
|
|
130
|
+
sortData,
|
|
131
|
+
visibleData,
|
|
132
|
+
fixedData
|
|
133
|
+
} = storeData;
|
|
134
|
+
let hasCustomSort = false;
|
|
135
|
+
// 处理还原
|
|
136
|
+
if (resizableData || sortData || visibleData || fixedData) {
|
|
137
|
+
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
138
|
+
const colKey = column.getKey();
|
|
139
|
+
// 支持一级
|
|
140
|
+
if (!parentColumn) {
|
|
141
|
+
if (fixedData && fixedData[colKey] !== undefined) {
|
|
142
|
+
column.fixed = fixedData[colKey];
|
|
143
|
+
}
|
|
144
|
+
if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
|
|
145
|
+
hasCustomSort = true;
|
|
146
|
+
column.renderSortNumber = sortData[colKey];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
|
|
150
|
+
column.resizeWidth = resizableData[colKey];
|
|
151
|
+
}
|
|
152
|
+
if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
|
|
153
|
+
column.visible = visibleData[colKey];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// 如果自定义了顺序
|
|
157
|
+
if (hasCustomSort) {
|
|
158
|
+
collectColumn = _xeUtils.default.orderBy(collectColumn, 'renderSortNumber');
|
|
159
|
+
internalData.collectColumn = collectColumn;
|
|
160
|
+
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
161
|
+
}
|
|
162
|
+
reactData.isCustomStatus = true;
|
|
163
|
+
} else {
|
|
164
|
+
reactData.isCustomStatus = false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
127
167
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
168
|
+
* 还原自定义列操作状态
|
|
169
|
+
*/
|
|
170
|
+
function restoreCustomStorage($xeTable) {
|
|
171
|
+
const props = $xeTable;
|
|
172
|
+
const {
|
|
173
|
+
customConfig
|
|
174
|
+
} = props;
|
|
175
|
+
const tableId = $xeTable.computeTableId;
|
|
176
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
177
|
+
const {
|
|
178
|
+
storage,
|
|
179
|
+
restoreStore
|
|
180
|
+
} = customOpts;
|
|
181
|
+
const isAllCustom = storage === true;
|
|
182
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
|
|
183
|
+
const isCustomResizable = isAllCustom || storageOpts.resizable;
|
|
184
|
+
const isCustomVisible = isAllCustom || storageOpts.visible;
|
|
185
|
+
const isCustomFixed = isAllCustom || storageOpts.fixed;
|
|
186
|
+
const isCustomSort = isAllCustom || storageOpts.sort;
|
|
187
|
+
if ((customConfig ? (0, _utils.isEnableConf)(customOpts) : customOpts.enabled) && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
|
|
188
|
+
if (!tableId) {
|
|
189
|
+
(0, _log.errLog)('vxe.error.reqProp', ['id']);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const storeData = getCustomStorageMap(tableId);
|
|
193
|
+
if (restoreStore) {
|
|
194
|
+
return Promise.resolve(restoreStore({
|
|
195
|
+
id: tableId,
|
|
196
|
+
type: 'restore',
|
|
197
|
+
storeData
|
|
198
|
+
})).then(storeData => {
|
|
199
|
+
if (!storeData) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
return handleCustomRestore($xeTable, storeData);
|
|
203
|
+
}).catch(e => e);
|
|
204
|
+
} else {
|
|
205
|
+
return handleCustomRestore($xeTable, storeData);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 更新数据列的 Map
|
|
211
|
+
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
212
|
+
*/
|
|
131
213
|
function cacheColumnMap($xeTable) {
|
|
132
214
|
const props = $xeTable;
|
|
133
215
|
const reactData = $xeTable;
|
|
@@ -182,7 +264,7 @@ function cacheColumnMap($xeTable) {
|
|
|
182
264
|
}
|
|
183
265
|
fullColumnFieldData[field] = rest;
|
|
184
266
|
} else {
|
|
185
|
-
if (storage || isCrossDrag || isSelfToChildDrag) {
|
|
267
|
+
if (storage || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
|
|
186
268
|
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
|
|
187
269
|
}
|
|
188
270
|
}
|
|
@@ -324,12 +406,354 @@ function handleVirtualTreeToList($xeTable) {
|
|
|
324
406
|
}
|
|
325
407
|
return internalData.afterFullData;
|
|
326
408
|
}
|
|
409
|
+
function updateStyle($xeTable) {
|
|
410
|
+
const props = $xeTable;
|
|
411
|
+
const reactData = $xeTable;
|
|
412
|
+
const internalData = $xeTable;
|
|
413
|
+
const {
|
|
414
|
+
border,
|
|
415
|
+
showOverflow: allColumnOverflow,
|
|
416
|
+
showHeaderOverflow: allColumnHeaderOverflow,
|
|
417
|
+
showFooterOverflow: allColumnFooterOverflow,
|
|
418
|
+
mouseConfig,
|
|
419
|
+
spanMethod,
|
|
420
|
+
footerSpanMethod
|
|
421
|
+
} = props;
|
|
422
|
+
const {
|
|
423
|
+
isGroup,
|
|
424
|
+
currentRow,
|
|
425
|
+
tableColumn,
|
|
426
|
+
scrollXLoad,
|
|
427
|
+
scrollYLoad,
|
|
428
|
+
scrollbarWidth,
|
|
429
|
+
scrollbarHeight,
|
|
430
|
+
columnStore,
|
|
431
|
+
editStore,
|
|
432
|
+
isAllOverflow,
|
|
433
|
+
expandColumn
|
|
434
|
+
} = reactData;
|
|
435
|
+
const {
|
|
436
|
+
visibleColumn,
|
|
437
|
+
fullColumnIdData,
|
|
438
|
+
tableHeight,
|
|
439
|
+
tableWidth,
|
|
440
|
+
headerHeight,
|
|
441
|
+
footerHeight,
|
|
442
|
+
elemStore,
|
|
443
|
+
customHeight,
|
|
444
|
+
customMinHeight,
|
|
445
|
+
customMaxHeight
|
|
446
|
+
} = internalData;
|
|
447
|
+
const el = $xeTable.$refs.refElem;
|
|
448
|
+
if (!el) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const containerList = ['main', 'left', 'right'];
|
|
452
|
+
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
|
|
453
|
+
const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
|
|
454
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
455
|
+
const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
|
|
456
|
+
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
457
|
+
if (emptyPlaceholderElem) {
|
|
458
|
+
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
459
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
|
|
460
|
+
}
|
|
461
|
+
let bodyHeight = 0;
|
|
462
|
+
let bodyMaxHeight = 0;
|
|
463
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - scrollbarHeight;
|
|
464
|
+
if (customMaxHeight) {
|
|
465
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - scrollbarHeight);
|
|
466
|
+
}
|
|
467
|
+
if (customHeight) {
|
|
468
|
+
bodyHeight = customHeight - headerHeight - footerHeight - scrollbarHeight;
|
|
469
|
+
}
|
|
470
|
+
if (!bodyHeight) {
|
|
471
|
+
if (bodyTableElem) {
|
|
472
|
+
bodyHeight = bodyTableElem.clientHeight;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if (bodyHeight) {
|
|
476
|
+
if (bodyMaxHeight) {
|
|
477
|
+
bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
|
|
478
|
+
}
|
|
479
|
+
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
480
|
+
}
|
|
481
|
+
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
|
|
482
|
+
if (scrollXVirtualEl) {
|
|
483
|
+
scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
|
|
484
|
+
scrollXVirtualEl.style.visibility = scrollbarHeight ? 'visible' : 'hidden';
|
|
485
|
+
}
|
|
486
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
487
|
+
if (xHandleEl) {
|
|
488
|
+
xHandleEl.style.width = `${el.clientWidth - scrollbarWidth}px`;
|
|
489
|
+
}
|
|
490
|
+
const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
|
|
491
|
+
if (xRightCornerEl) {
|
|
492
|
+
xRightCornerEl.style.width = `${scrollbarWidth}px`;
|
|
493
|
+
xRightCornerEl.style.display = scrollbarWidth && scrollbarHeight ? 'block' : '';
|
|
494
|
+
}
|
|
495
|
+
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
|
|
496
|
+
if (scrollYVirtualEl) {
|
|
497
|
+
scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
|
|
498
|
+
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
|
|
499
|
+
scrollYVirtualEl.style.visibility = scrollbarWidth ? 'visible' : 'hidden';
|
|
500
|
+
}
|
|
501
|
+
const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
|
|
502
|
+
if (yTopCornerEl) {
|
|
503
|
+
yTopCornerEl.style.height = `${headerHeight}px`;
|
|
504
|
+
yTopCornerEl.style.display = headerHeight ? 'block' : '';
|
|
505
|
+
}
|
|
506
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
507
|
+
if (yHandleEl) {
|
|
508
|
+
yHandleEl.style.height = `${bodyHeight}px`;
|
|
509
|
+
yHandleEl.style.top = `${headerHeight}px`;
|
|
510
|
+
}
|
|
511
|
+
const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem;
|
|
512
|
+
if (yBottomCornerEl) {
|
|
513
|
+
yBottomCornerEl.style.height = `${footerHeight}px`;
|
|
514
|
+
yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`;
|
|
515
|
+
yBottomCornerEl.style.display = footerHeight ? 'block' : '';
|
|
516
|
+
}
|
|
517
|
+
containerList.forEach((name, index) => {
|
|
518
|
+
const fixedType = index > 0 ? name : '';
|
|
519
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
520
|
+
const isFixedLeft = fixedType === 'left';
|
|
521
|
+
let fixedColumn = [];
|
|
522
|
+
let fixedWrapperElem;
|
|
523
|
+
if (fixedType) {
|
|
524
|
+
fixedColumn = isFixedLeft ? columnStore.leftList : columnStore.rightList;
|
|
525
|
+
fixedWrapperElem = isFixedLeft ? $xeTable.$refs.refLeftContainer : $xeTable.$refs.refRightContainer;
|
|
526
|
+
}
|
|
527
|
+
layoutList.forEach(layout => {
|
|
528
|
+
const wrapperElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-wrapper`]);
|
|
529
|
+
const currScrollElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-scroll`]);
|
|
530
|
+
const tableElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-table`]);
|
|
531
|
+
if (layout === 'header') {
|
|
532
|
+
// 表头体样式处理
|
|
533
|
+
// 横向滚动渲染
|
|
534
|
+
let tWidth = tableWidth;
|
|
535
|
+
let renderColumnList = tableColumn;
|
|
536
|
+
let isOptimizeMode = false;
|
|
537
|
+
if (isGroup) {
|
|
538
|
+
renderColumnList = visibleColumn;
|
|
539
|
+
if (fixedType) {
|
|
540
|
+
if (wrapperElem) {
|
|
541
|
+
wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
// 如果是使用优化模式
|
|
546
|
+
if (scrollXLoad || scrollYLoad || allColumnHeaderOverflow) {
|
|
547
|
+
if (spanMethod || footerSpanMethod) {
|
|
548
|
+
// 如果不支持优化模式
|
|
549
|
+
} else {
|
|
550
|
+
isOptimizeMode = true;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (fixedType) {
|
|
554
|
+
renderColumnList = visibleColumn;
|
|
555
|
+
// 如果是使用优化模式
|
|
556
|
+
if (isOptimizeMode) {
|
|
557
|
+
renderColumnList = fixedColumn || [];
|
|
558
|
+
}
|
|
559
|
+
if (!isOptimizeMode) {
|
|
560
|
+
if (wrapperElem) {
|
|
561
|
+
wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
567
|
+
if (currScrollElem) {
|
|
568
|
+
currScrollElem.style.height = `${headerHeight}px`;
|
|
569
|
+
}
|
|
570
|
+
if (tableElem) {
|
|
571
|
+
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
572
|
+
}
|
|
573
|
+
const repairElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-repair`]);
|
|
574
|
+
if (repairElem) {
|
|
575
|
+
repairElem.style.width = `${tableWidth}px`;
|
|
576
|
+
}
|
|
577
|
+
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
578
|
+
if (isGroup && listElem) {
|
|
579
|
+
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
|
|
580
|
+
const colNode = $xeTable.getColumnNode(thElem);
|
|
581
|
+
if (colNode) {
|
|
582
|
+
const column = colNode.item;
|
|
583
|
+
const {
|
|
584
|
+
showHeaderOverflow
|
|
585
|
+
} = column;
|
|
586
|
+
const cellOverflow = _xeUtils.default.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow;
|
|
587
|
+
const showEllipsis = cellOverflow === 'ellipsis';
|
|
588
|
+
const showTitle = cellOverflow === 'title';
|
|
589
|
+
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
590
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
591
|
+
let childWidth = 0;
|
|
592
|
+
let countChild = 0;
|
|
593
|
+
if (hasEllipsis) {
|
|
594
|
+
_xeUtils.default.eachTree(column.children, item => {
|
|
595
|
+
if (!item.children || !column.children.length) {
|
|
596
|
+
countChild++;
|
|
597
|
+
}
|
|
598
|
+
childWidth += item.renderWidth;
|
|
599
|
+
}, {
|
|
600
|
+
children: 'children'
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : '';
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
} else if (layout === 'body') {
|
|
608
|
+
if (currScrollElem) {
|
|
609
|
+
currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
|
|
610
|
+
currScrollElem.style.height = customHeight ? `${bodyHeight}px` : '';
|
|
611
|
+
currScrollElem.style.minHeight = `${bodyMinHeight}px`;
|
|
612
|
+
}
|
|
613
|
+
// 如果是固定列
|
|
614
|
+
if (fixedWrapperElem) {
|
|
615
|
+
if (wrapperElem) {
|
|
616
|
+
wrapperElem.style.top = `${headerHeight}px`;
|
|
617
|
+
}
|
|
618
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + scrollbarHeight}px`;
|
|
619
|
+
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
|
|
620
|
+
}
|
|
621
|
+
let tWidth = tableWidth;
|
|
622
|
+
let renderColumnList = tableColumn;
|
|
623
|
+
let isOptimizeMode = false;
|
|
624
|
+
// 如果是使用优化模式
|
|
625
|
+
if (scrollXLoad || scrollYLoad || allColumnOverflow && isAllOverflow) {
|
|
626
|
+
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
627
|
+
// 如果不支持优化模式
|
|
628
|
+
} else {
|
|
629
|
+
isOptimizeMode = true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (fixedType) {
|
|
633
|
+
renderColumnList = visibleColumn;
|
|
634
|
+
if (isOptimizeMode) {
|
|
635
|
+
renderColumnList = fixedColumn || [];
|
|
636
|
+
}
|
|
637
|
+
if (!isOptimizeMode) {
|
|
638
|
+
if (wrapperElem) {
|
|
639
|
+
wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
644
|
+
if (tableElem) {
|
|
645
|
+
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
646
|
+
// 兼容性处理
|
|
647
|
+
tableElem.style.paddingRight = scrollbarWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${scrollbarWidth}px` : '';
|
|
648
|
+
}
|
|
649
|
+
const emptyBlockElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
650
|
+
if (emptyBlockElem) {
|
|
651
|
+
emptyBlockElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
652
|
+
}
|
|
653
|
+
} else if (layout === 'footer') {
|
|
654
|
+
let tWidth = tableWidth;
|
|
655
|
+
let renderColumnList = tableColumn;
|
|
656
|
+
let isOptimizeMode = false;
|
|
657
|
+
// 如果是使用优化模式
|
|
658
|
+
if (scrollXLoad || scrollYLoad || allColumnFooterOverflow) {
|
|
659
|
+
if (spanMethod || footerSpanMethod) {
|
|
660
|
+
// 如果不支持优化模式
|
|
661
|
+
} else {
|
|
662
|
+
isOptimizeMode = true;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
if (fixedType) {
|
|
666
|
+
renderColumnList = visibleColumn;
|
|
667
|
+
if (isOptimizeMode) {
|
|
668
|
+
renderColumnList = fixedColumn || [];
|
|
669
|
+
}
|
|
670
|
+
if (!isOptimizeMode) {
|
|
671
|
+
if (wrapperElem) {
|
|
672
|
+
wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
677
|
+
if (currScrollElem) {
|
|
678
|
+
currScrollElem.style.height = `${footerHeight}px`;
|
|
679
|
+
// 如果是固定列
|
|
680
|
+
if (fixedWrapperElem) {
|
|
681
|
+
if (wrapperElem) {
|
|
682
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - scrollbarHeight : tableHeight + headerHeight}px`;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
if (tableElem) {
|
|
687
|
+
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
const colgroupElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-colgroup`]);
|
|
691
|
+
if (colgroupElem) {
|
|
692
|
+
_xeUtils.default.arrayEach(colgroupElem.children, colElem => {
|
|
693
|
+
const colid = colElem.getAttribute('name');
|
|
694
|
+
if (fullColumnIdData[colid]) {
|
|
695
|
+
const colRest = fullColumnIdData[colid];
|
|
696
|
+
const column = colRest.column;
|
|
697
|
+
const {
|
|
698
|
+
showHeaderOverflow,
|
|
699
|
+
showFooterOverflow,
|
|
700
|
+
showOverflow
|
|
701
|
+
} = column;
|
|
702
|
+
let cellOverflow;
|
|
703
|
+
colElem.style.width = `${column.renderWidth}px`;
|
|
704
|
+
if (layout === 'header') {
|
|
705
|
+
cellOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
706
|
+
} else if (layout === 'footer') {
|
|
707
|
+
cellOverflow = _xeUtils.default.isUndefined(showFooterOverflow) || _xeUtils.default.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
708
|
+
} else {
|
|
709
|
+
cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? allColumnOverflow : showOverflow;
|
|
710
|
+
}
|
|
711
|
+
const showEllipsis = cellOverflow === 'ellipsis';
|
|
712
|
+
const showTitle = cellOverflow === 'title';
|
|
713
|
+
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
714
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
715
|
+
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
716
|
+
// 纵向虚拟滚动不支持动态行高
|
|
717
|
+
if (scrollYLoad && !hasEllipsis) {
|
|
718
|
+
hasEllipsis = true;
|
|
719
|
+
}
|
|
720
|
+
if (listElem) {
|
|
721
|
+
_xeUtils.default.arrayEach(listElem.querySelectorAll(`.${column.id}`), elem => {
|
|
722
|
+
const colspan = parseInt(elem.getAttribute('colspan') || 1);
|
|
723
|
+
const cellElem = elem.querySelector('.vxe-cell');
|
|
724
|
+
let colWidth = column.renderWidth;
|
|
725
|
+
if (cellElem) {
|
|
726
|
+
if (colspan > 1) {
|
|
727
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
728
|
+
for (let index = 1; index < colspan; index++) {
|
|
729
|
+
const nextColumn = $xeTable.getColumns(columnIndex + index);
|
|
730
|
+
if (nextColumn) {
|
|
731
|
+
colWidth += nextColumn.renderWidth;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
cellElem.style.width = hasEllipsis ? `${colWidth - cellOffsetWidth * colspan}px` : '';
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
if (currentRow) {
|
|
745
|
+
$xeTable.setCurrentRow(currentRow);
|
|
746
|
+
}
|
|
747
|
+
if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
|
|
748
|
+
$xeTable.addCellSelectedClass();
|
|
749
|
+
}
|
|
750
|
+
return $xeTable.$nextTick();
|
|
751
|
+
}
|
|
327
752
|
function computeRowHeight($xeTable) {
|
|
328
|
-
const tableHeader = $xeTable.$refs.
|
|
329
|
-
const tableBody = $xeTable.$refs.
|
|
753
|
+
const tableHeader = $xeTable.$refs.refTableHeader;
|
|
754
|
+
const tableBody = $xeTable.$refs.refTableBody;
|
|
330
755
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
331
|
-
const
|
|
332
|
-
const rowHeightMaps = $xeTable.computeRowHeightMaps;
|
|
756
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
333
757
|
let rowHeight = 0;
|
|
334
758
|
if (tableBodyElem) {
|
|
335
759
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
@@ -343,32 +767,32 @@ function computeRowHeight($xeTable) {
|
|
|
343
767
|
}
|
|
344
768
|
}
|
|
345
769
|
if (!rowHeight) {
|
|
346
|
-
rowHeight =
|
|
770
|
+
rowHeight = defaultRowHeight;
|
|
347
771
|
}
|
|
348
772
|
// 最低支持 18px 行高
|
|
349
773
|
return Math.max(18, rowHeight);
|
|
350
774
|
}
|
|
351
775
|
function handleVirtualYVisible($xeTable) {
|
|
352
776
|
const props = $xeTable;
|
|
777
|
+
const reactData = $xeTable;
|
|
353
778
|
const internalData = $xeTable;
|
|
354
779
|
const {
|
|
355
780
|
showOverflow
|
|
356
781
|
} = props;
|
|
357
782
|
const {
|
|
358
|
-
|
|
783
|
+
rowHeight
|
|
784
|
+
} = reactData;
|
|
785
|
+
const {
|
|
786
|
+
elemStore,
|
|
359
787
|
afterFullData,
|
|
360
788
|
fullAllDataRowIdData
|
|
361
789
|
} = internalData;
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const {
|
|
365
|
-
rowHeight
|
|
366
|
-
} = scrollYStore;
|
|
367
|
-
if (tableBodyElem) {
|
|
790
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
791
|
+
if (bodyScrollElem) {
|
|
368
792
|
const {
|
|
369
793
|
scrollTop,
|
|
370
794
|
clientHeight
|
|
371
|
-
} =
|
|
795
|
+
} = bodyScrollElem;
|
|
372
796
|
const endHeight = scrollTop + clientHeight;
|
|
373
797
|
let toVisibleIndex = -1;
|
|
374
798
|
let offsetTop = 0;
|
|
@@ -395,12 +819,12 @@ function handleVirtualYVisible($xeTable) {
|
|
|
395
819
|
}
|
|
396
820
|
return {
|
|
397
821
|
toVisibleIndex: Math.max(0, toVisibleIndex),
|
|
398
|
-
visibleSize: Math.max(
|
|
822
|
+
visibleSize: Math.max(6, visibleSize)
|
|
399
823
|
};
|
|
400
824
|
}
|
|
401
825
|
return {
|
|
402
826
|
toVisibleIndex: 0,
|
|
403
|
-
visibleSize:
|
|
827
|
+
visibleSize: 6
|
|
404
828
|
};
|
|
405
829
|
}
|
|
406
830
|
function calculateMergerOffsetIndex(list, offsetItem, type) {
|
|
@@ -551,18 +975,26 @@ function autoCellWidth($xeTable) {
|
|
|
551
975
|
const props = $xeTable;
|
|
552
976
|
const reactData = $xeTable;
|
|
553
977
|
const internalData = $xeTable;
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
978
|
+
const {
|
|
979
|
+
elemStore
|
|
980
|
+
} = internalData;
|
|
981
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts;
|
|
982
|
+
const tableBody = $xeTable.$refs.refTableBody;
|
|
557
983
|
const bodyElem = tableBody ? tableBody.$el : null;
|
|
558
|
-
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
559
|
-
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
560
984
|
if (!bodyElem) {
|
|
561
985
|
return;
|
|
562
986
|
}
|
|
987
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
988
|
+
if (!yHandleEl) {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
992
|
+
if (!xHandleEl) {
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
563
995
|
let tableWidth = 0;
|
|
564
996
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
565
|
-
const bodyWidth = bodyElem.clientWidth
|
|
997
|
+
const bodyWidth = bodyElem.clientWidth;
|
|
566
998
|
let remainWidth = bodyWidth;
|
|
567
999
|
let meanWidth = remainWidth / 100;
|
|
568
1000
|
const {
|
|
@@ -643,16 +1075,16 @@ function autoCellWidth($xeTable) {
|
|
|
643
1075
|
});
|
|
644
1076
|
if (fit) {
|
|
645
1077
|
/**
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
1078
|
+
* 偏移量算法
|
|
1079
|
+
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
1080
|
+
*/
|
|
649
1081
|
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
650
1082
|
let dynamicSize = dynamicList.length - 1;
|
|
651
1083
|
if (dynamicSize > 0) {
|
|
652
|
-
let
|
|
653
|
-
if (
|
|
654
|
-
while (
|
|
655
|
-
|
|
1084
|
+
let i = bodyWidth - tableWidth;
|
|
1085
|
+
if (i > 0) {
|
|
1086
|
+
while (i > 0 && dynamicSize >= 0) {
|
|
1087
|
+
i--;
|
|
656
1088
|
dynamicList[dynamicSize--].renderWidth++;
|
|
657
1089
|
}
|
|
658
1090
|
tableWidth = bodyWidth;
|
|
@@ -660,40 +1092,20 @@ function autoCellWidth($xeTable) {
|
|
|
660
1092
|
}
|
|
661
1093
|
}
|
|
662
1094
|
const tableHeight = bodyElem.offsetHeight;
|
|
663
|
-
const overflowY =
|
|
664
|
-
|
|
665
|
-
if (overflowY) {
|
|
666
|
-
scrollbarWidth = Math.max(bodyElem.offsetWidth - bodyElem.clientWidth, 0);
|
|
667
|
-
}
|
|
668
|
-
reactData.scrollbarWidth = scrollbarWidth;
|
|
1095
|
+
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
|
|
1096
|
+
reactData.scrollbarWidth = overflowY ? Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth) : 0;
|
|
669
1097
|
reactData.overflowY = overflowY;
|
|
670
1098
|
internalData.tableWidth = tableWidth;
|
|
671
1099
|
internalData.tableHeight = tableHeight;
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
headerElem.scrollLeft = bodyElem.scrollLeft;
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
}
|
|
1100
|
+
const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
|
|
1101
|
+
const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
|
|
1102
|
+
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
1103
|
+
const overflowX = tableWidth > bodyWidth;
|
|
1104
|
+
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
1105
|
+
reactData.scrollbarHeight = overflowX ? Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight) : 0;
|
|
682
1106
|
internalData.headerHeight = headerHeight;
|
|
683
|
-
let overflowX = false;
|
|
684
|
-
let footerHeight = 0;
|
|
685
|
-
let scrollbarHeight = 0;
|
|
686
|
-
if (footerElem) {
|
|
687
|
-
footerHeight = footerElem.offsetHeight;
|
|
688
|
-
overflowX = tableWidth > footerElem.clientWidth;
|
|
689
|
-
scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0);
|
|
690
|
-
} else {
|
|
691
|
-
overflowX = tableWidth > bodyWidth;
|
|
692
|
-
scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0);
|
|
693
|
-
}
|
|
694
1107
|
internalData.footerHeight = footerHeight;
|
|
695
1108
|
reactData.overflowX = overflowX;
|
|
696
|
-
reactData.scrollbarHeight = scrollbarHeight;
|
|
697
1109
|
updateHeight($xeTable);
|
|
698
1110
|
reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
|
|
699
1111
|
if (overflowX) {
|
|
@@ -931,9 +1343,9 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
931
1343
|
const cdLineEl = $xeTable.$refs.refDragColLineElem;
|
|
932
1344
|
if (cdLineEl) {
|
|
933
1345
|
if (showLine) {
|
|
934
|
-
const leftContainerElem = $xeTable.$refs.
|
|
1346
|
+
const leftContainerElem = $xeTable.$refs.refLeftContainer;
|
|
935
1347
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
936
|
-
const rightContainerElem = $xeTable.$refs.
|
|
1348
|
+
const rightContainerElem = $xeTable.$refs.refRightContainer;
|
|
937
1349
|
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
938
1350
|
const thRect = thEl.getBoundingClientRect();
|
|
939
1351
|
let thWidth = thEl.clientWidth;
|
|
@@ -1015,12 +1427,16 @@ function computeScrollLoad($xeTable) {
|
|
|
1015
1427
|
// 计算 X 逻辑
|
|
1016
1428
|
if (scrollXLoad) {
|
|
1017
1429
|
const {
|
|
1430
|
+
toVisibleIndex: toXVisibleIndex,
|
|
1018
1431
|
visibleSize: visibleXSize
|
|
1019
1432
|
} = handleVirtualXVisible($xeTable);
|
|
1020
|
-
const offsetXSize = Math.max(0, sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) :
|
|
1433
|
+
const offsetXSize = Math.max(0, sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) : 0);
|
|
1434
|
+
scrollXStore.preloadSize = 4;
|
|
1021
1435
|
scrollXStore.offsetSize = offsetXSize;
|
|
1022
1436
|
scrollXStore.visibleSize = visibleXSize;
|
|
1023
1437
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
1438
|
+
scrollXStore.visibleStartIndex = Math.max(scrollXStore.startIndex, toXVisibleIndex);
|
|
1439
|
+
scrollXStore.visibleEndIndex = Math.min(scrollXStore.endIndex, toXVisibleIndex + visibleXSize);
|
|
1024
1440
|
$xeTable.updateScrollXData().then(() => {
|
|
1025
1441
|
loadScrollXData($xeTable);
|
|
1026
1442
|
});
|
|
@@ -1033,13 +1449,17 @@ function computeScrollLoad($xeTable) {
|
|
|
1033
1449
|
scrollYStore.rowHeight = rowHeight;
|
|
1034
1450
|
reactData.rowHeight = rowHeight;
|
|
1035
1451
|
const {
|
|
1452
|
+
toVisibleIndex: toYVisibleIndex,
|
|
1036
1453
|
visibleSize: visibleYSize
|
|
1037
1454
|
} = handleVirtualYVisible($xeTable);
|
|
1038
1455
|
if (scrollYLoad) {
|
|
1039
|
-
const offsetYSize = Math.max(0, sYOpts.oSize ? _xeUtils.default.toNumber(sYOpts.oSize) :
|
|
1456
|
+
const offsetYSize = Math.max(0, sYOpts.oSize ? _xeUtils.default.toNumber(sYOpts.oSize) : 0);
|
|
1457
|
+
scrollYStore.preloadSize = 2;
|
|
1040
1458
|
scrollYStore.offsetSize = offsetYSize;
|
|
1041
1459
|
scrollYStore.visibleSize = visibleYSize;
|
|
1042
1460
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
1461
|
+
scrollYStore.visibleStartIndex = Math.max(scrollYStore.startIndex, toYVisibleIndex);
|
|
1462
|
+
scrollYStore.visibleEndIndex = Math.min(scrollYStore.endIndex, toYVisibleIndex + visibleYSize);
|
|
1043
1463
|
$xeTable.updateScrollYData().then(() => {
|
|
1044
1464
|
loadScrollYData($xeTable);
|
|
1045
1465
|
});
|
|
@@ -1047,7 +1467,7 @@ function computeScrollLoad($xeTable) {
|
|
|
1047
1467
|
$xeTable.updateScrollYSpace();
|
|
1048
1468
|
}
|
|
1049
1469
|
$xeTable.$nextTick(() => {
|
|
1050
|
-
$xeTable
|
|
1470
|
+
updateStyle($xeTable);
|
|
1051
1471
|
});
|
|
1052
1472
|
});
|
|
1053
1473
|
}
|
|
@@ -1070,6 +1490,35 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
1070
1490
|
}
|
|
1071
1491
|
});
|
|
1072
1492
|
}
|
|
1493
|
+
function handleTableColumn($xeTable) {
|
|
1494
|
+
const reactData = $xeTable;
|
|
1495
|
+
const internalData = $xeTable;
|
|
1496
|
+
const {
|
|
1497
|
+
scrollXLoad
|
|
1498
|
+
} = reactData;
|
|
1499
|
+
const {
|
|
1500
|
+
visibleColumn,
|
|
1501
|
+
scrollXStore,
|
|
1502
|
+
fullColumnIdData
|
|
1503
|
+
} = internalData;
|
|
1504
|
+
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
1505
|
+
tableColumn.forEach((column, $index) => {
|
|
1506
|
+
const colid = column.id;
|
|
1507
|
+
const colRest = fullColumnIdData[colid];
|
|
1508
|
+
if (colRest) {
|
|
1509
|
+
colRest.$index = $index;
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
reactData.tableColumn = tableColumn;
|
|
1513
|
+
}
|
|
1514
|
+
function handleUpdateColumn($xeTable) {
|
|
1515
|
+
const internalData = $xeTable;
|
|
1516
|
+
const columnList = _xeUtils.default.orderBy(internalData.collectColumn, 'renderSortNumber');
|
|
1517
|
+
internalData.collectColumn = columnList;
|
|
1518
|
+
const tableFullColumn = getColumnList(columnList);
|
|
1519
|
+
internalData.tableFullColumn = tableFullColumn;
|
|
1520
|
+
cacheColumnMap($xeTable);
|
|
1521
|
+
}
|
|
1073
1522
|
function loadScrollXData($xeTable) {
|
|
1074
1523
|
const reactData = $xeTable;
|
|
1075
1524
|
const internalData = $xeTable;
|
|
@@ -1081,6 +1530,7 @@ function loadScrollXData($xeTable) {
|
|
|
1081
1530
|
scrollXStore
|
|
1082
1531
|
} = internalData;
|
|
1083
1532
|
const {
|
|
1533
|
+
preloadSize,
|
|
1084
1534
|
startIndex,
|
|
1085
1535
|
endIndex,
|
|
1086
1536
|
offsetSize
|
|
@@ -1090,9 +1540,11 @@ function loadScrollXData($xeTable) {
|
|
|
1090
1540
|
visibleSize
|
|
1091
1541
|
} = handleVirtualXVisible($xeTable);
|
|
1092
1542
|
const offsetItem = {
|
|
1093
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
1094
|
-
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
1543
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1544
|
+
endIndex: toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
1095
1545
|
};
|
|
1546
|
+
scrollXStore.visibleStartIndex = toVisibleIndex;
|
|
1547
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize;
|
|
1096
1548
|
calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
|
|
1097
1549
|
const {
|
|
1098
1550
|
startIndex: offsetStartIndex,
|
|
@@ -1107,6 +1559,208 @@ function loadScrollXData($xeTable) {
|
|
|
1107
1559
|
}
|
|
1108
1560
|
$xeTable.closeTooltip();
|
|
1109
1561
|
}
|
|
1562
|
+
// 获取所有的列,排除分组
|
|
1563
|
+
function getColumnList(columns) {
|
|
1564
|
+
const result = [];
|
|
1565
|
+
columns.forEach(column => {
|
|
1566
|
+
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
1567
|
+
});
|
|
1568
|
+
return result;
|
|
1569
|
+
}
|
|
1570
|
+
function parseColumns($xeTable, isReset) {
|
|
1571
|
+
const props = $xeTable;
|
|
1572
|
+
const reactData = $xeTable;
|
|
1573
|
+
const internalData = $xeTable;
|
|
1574
|
+
const {
|
|
1575
|
+
showOverflow
|
|
1576
|
+
} = props;
|
|
1577
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
1578
|
+
const leftList = [];
|
|
1579
|
+
const centerList = [];
|
|
1580
|
+
const rightList = [];
|
|
1581
|
+
const {
|
|
1582
|
+
isGroup,
|
|
1583
|
+
columnStore
|
|
1584
|
+
} = reactData;
|
|
1585
|
+
const sXOpts = $xeTable.computeSXOpts;
|
|
1586
|
+
const {
|
|
1587
|
+
collectColumn,
|
|
1588
|
+
tableFullColumn,
|
|
1589
|
+
scrollXStore,
|
|
1590
|
+
fullColumnIdData
|
|
1591
|
+
} = internalData;
|
|
1592
|
+
// 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
|
|
1593
|
+
if (isGroup) {
|
|
1594
|
+
const leftGroupList = [];
|
|
1595
|
+
const centerGroupList = [];
|
|
1596
|
+
const rightGroupList = [];
|
|
1597
|
+
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
1598
|
+
const isColGroup = (0, _utils.hasChildrenList)(column);
|
|
1599
|
+
// 如果是分组,必须按组设置固定列,不允许给子列设置固定
|
|
1600
|
+
if (parentColumn && parentColumn.fixed) {
|
|
1601
|
+
column.fixed = parentColumn.fixed;
|
|
1602
|
+
}
|
|
1603
|
+
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
1604
|
+
(0, _log.errLog)('vxe.error.groupFixed');
|
|
1605
|
+
}
|
|
1606
|
+
if (isColGroup) {
|
|
1607
|
+
column.visible = !!_xeUtils.default.findTree(column.children, subColumn => (0, _utils.hasChildrenList)(subColumn) ? false : subColumn.visible);
|
|
1608
|
+
} else if (column.visible) {
|
|
1609
|
+
if (column.fixed === 'left') {
|
|
1610
|
+
leftList.push(column);
|
|
1611
|
+
} else if (column.fixed === 'right') {
|
|
1612
|
+
rightList.push(column);
|
|
1613
|
+
} else {
|
|
1614
|
+
centerList.push(column);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
collectColumn.forEach(column => {
|
|
1619
|
+
if (column.visible) {
|
|
1620
|
+
if (column.fixed === 'left') {
|
|
1621
|
+
leftGroupList.push(column);
|
|
1622
|
+
} else if (column.fixed === 'right') {
|
|
1623
|
+
rightGroupList.push(column);
|
|
1624
|
+
} else {
|
|
1625
|
+
centerGroupList.push(column);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
reactData.tableGroupColumn = leftGroupList.concat(centerGroupList).concat(rightGroupList);
|
|
1630
|
+
} else {
|
|
1631
|
+
// 重新分配列
|
|
1632
|
+
tableFullColumn.forEach(column => {
|
|
1633
|
+
if (column.visible) {
|
|
1634
|
+
if (column.fixed === 'left') {
|
|
1635
|
+
leftList.push(column);
|
|
1636
|
+
} else if (column.fixed === 'right') {
|
|
1637
|
+
rightList.push(column);
|
|
1638
|
+
} else {
|
|
1639
|
+
centerList.push(column);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
const visibleColumn = leftList.concat(centerList).concat(rightList);
|
|
1645
|
+
// 如果gt为0,则总是启用
|
|
1646
|
+
const scrollXLoad = !!sXOpts.enabled && sXOpts.gt > -1 && (sXOpts.gt === 0 || sXOpts.gt < tableFullColumn.length);
|
|
1647
|
+
reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
|
|
1648
|
+
Object.assign(columnStore, {
|
|
1649
|
+
leftList,
|
|
1650
|
+
centerList,
|
|
1651
|
+
rightList
|
|
1652
|
+
});
|
|
1653
|
+
if (scrollXLoad) {
|
|
1654
|
+
if (showOverflow) {
|
|
1655
|
+
if (!rowOpts.height) {
|
|
1656
|
+
const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false);
|
|
1657
|
+
if (errColumn) {
|
|
1658
|
+
(0, _log.errLog)('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
if (process.env.NODE_ENV === 'development') {
|
|
1663
|
+
// if (props.showHeader && !props.showHeaderOverflow) {
|
|
1664
|
+
// warnLog('vxe.error.reqProp', ['show-header-overflow'])
|
|
1665
|
+
// }
|
|
1666
|
+
// if (props.showFooter && !props.showFooterOverflow) {
|
|
1667
|
+
// warnLog('vxe.error.reqProp', ['show-footer-overflow'])
|
|
1668
|
+
// }
|
|
1669
|
+
if (props.spanMethod) {
|
|
1670
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['span-method']);
|
|
1671
|
+
}
|
|
1672
|
+
if (props.footerSpanMethod) {
|
|
1673
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['footer-span-method']);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
if (isReset) {
|
|
1677
|
+
const {
|
|
1678
|
+
visibleSize
|
|
1679
|
+
} = handleVirtualXVisible($xeTable);
|
|
1680
|
+
scrollXStore.startIndex = 0;
|
|
1681
|
+
scrollXStore.endIndex = visibleSize;
|
|
1682
|
+
scrollXStore.visibleSize = visibleSize;
|
|
1683
|
+
scrollXStore.visibleStartIndex = 0;
|
|
1684
|
+
scrollXStore.visibleEndIndex = visibleSize;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
// 如果列被显示/隐藏,则清除合并状态
|
|
1688
|
+
// 如果列被设置为固定,则清除合并状态
|
|
1689
|
+
if (visibleColumn.length !== internalData.visibleColumn.length || !internalData.visibleColumn.every((column, index) => column === visibleColumn[index])) {
|
|
1690
|
+
$xeTable.clearMergeCells();
|
|
1691
|
+
$xeTable.clearMergeFooterItems();
|
|
1692
|
+
}
|
|
1693
|
+
reactData.scrollXLoad = scrollXLoad;
|
|
1694
|
+
visibleColumn.forEach((column, index) => {
|
|
1695
|
+
const colid = column.id;
|
|
1696
|
+
const colRest = fullColumnIdData[colid];
|
|
1697
|
+
if (colRest) {
|
|
1698
|
+
colRest._index = index;
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1701
|
+
internalData.visibleColumn = visibleColumn;
|
|
1702
|
+
handleTableColumn($xeTable);
|
|
1703
|
+
if (isReset) {
|
|
1704
|
+
return $xeTable.updateFooter().then(() => {
|
|
1705
|
+
return $xeTable.recalculate();
|
|
1706
|
+
}).then(() => {
|
|
1707
|
+
$xeTable.updateCellAreas();
|
|
1708
|
+
return $xeTable.recalculate();
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
return $xeTable.updateFooter();
|
|
1712
|
+
}
|
|
1713
|
+
function initColumnSort($xeTable) {
|
|
1714
|
+
const internalData = $xeTable;
|
|
1715
|
+
const {
|
|
1716
|
+
collectColumn
|
|
1717
|
+
} = internalData;
|
|
1718
|
+
collectColumn.forEach((column, index) => {
|
|
1719
|
+
const sortIndex = index + 1;
|
|
1720
|
+
column.sortNumber = sortIndex;
|
|
1721
|
+
column.renderSortNumber = sortIndex;
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
function handleColumn($xeTable, collectColumn) {
|
|
1725
|
+
const $xeToolbar = $xeTable.$refs.$xeToolbar;
|
|
1726
|
+
const reactData = $xeTable;
|
|
1727
|
+
const internalData = $xeTable;
|
|
1728
|
+
internalData.collectColumn = collectColumn;
|
|
1729
|
+
const tableFullColumn = getColumnList(collectColumn);
|
|
1730
|
+
internalData.tableFullColumn = tableFullColumn;
|
|
1731
|
+
reactData.isLoading = true;
|
|
1732
|
+
reactData.isDragColMove = false;
|
|
1733
|
+
initColumnSort($xeTable);
|
|
1734
|
+
return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
|
|
1735
|
+
reactData.isLoading = false;
|
|
1736
|
+
cacheColumnMap($xeTable);
|
|
1737
|
+
parseColumns($xeTable, true).then(() => {
|
|
1738
|
+
if (reactData.scrollXLoad) {
|
|
1739
|
+
loadScrollXData($xeTable);
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
$xeTable.clearMergeCells();
|
|
1743
|
+
$xeTable.clearMergeFooterItems();
|
|
1744
|
+
$xeTable.handleTableData(true);
|
|
1745
|
+
if (process.env.NODE_ENV === 'development') {
|
|
1746
|
+
if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
|
|
1747
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['column.type=expand']);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
return $xeTable.$nextTick().then(() => {
|
|
1751
|
+
if ($xeToolbar) {
|
|
1752
|
+
$xeToolbar.syncUpdate({
|
|
1753
|
+
collectColumn: internalData.collectColumn,
|
|
1754
|
+
$table: $xeTable
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
if ($xeTable.handleUpdateCustomColumn) {
|
|
1758
|
+
$xeTable.handleUpdateCustomColumn();
|
|
1759
|
+
}
|
|
1760
|
+
return $xeTable.recalculate();
|
|
1761
|
+
});
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1110
1764
|
/**
|
|
1111
1765
|
* 纵向 Y 可视渲染处理
|
|
1112
1766
|
*/
|
|
@@ -1121,23 +1775,25 @@ function loadScrollYData($xeTable) {
|
|
|
1121
1775
|
mergeList
|
|
1122
1776
|
} = reactData;
|
|
1123
1777
|
const {
|
|
1124
|
-
tableHeight,
|
|
1125
1778
|
scrollYStore
|
|
1126
1779
|
} = internalData;
|
|
1127
1780
|
const {
|
|
1781
|
+
preloadSize,
|
|
1128
1782
|
startIndex,
|
|
1129
1783
|
endIndex,
|
|
1130
1784
|
offsetSize
|
|
1131
1785
|
} = scrollYStore;
|
|
1132
|
-
const autoOffsetYSize = showOverflow ? offsetSize : offsetSize +
|
|
1786
|
+
const autoOffsetYSize = showOverflow ? offsetSize : offsetSize + 1;
|
|
1133
1787
|
const {
|
|
1134
1788
|
toVisibleIndex,
|
|
1135
1789
|
visibleSize
|
|
1136
1790
|
} = handleVirtualYVisible($xeTable);
|
|
1137
1791
|
const offsetItem = {
|
|
1138
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
1139
|
-
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize
|
|
1792
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1793
|
+
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
1140
1794
|
};
|
|
1795
|
+
scrollYStore.visibleStartIndex = toVisibleIndex;
|
|
1796
|
+
scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize;
|
|
1141
1797
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
1142
1798
|
const {
|
|
1143
1799
|
startIndex: offsetStartIndex,
|
|
@@ -1168,16 +1824,20 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
1168
1824
|
internalData.lcsRunTime = Date.now();
|
|
1169
1825
|
internalData.lcsTimeout = undefined;
|
|
1170
1826
|
internalData.inVirtualScroll = false;
|
|
1827
|
+
internalData.inWheelScroll = false;
|
|
1828
|
+
internalData.inHeaderScroll = false;
|
|
1171
1829
|
internalData.inBodyScroll = false;
|
|
1172
1830
|
internalData.inFooterScroll = false;
|
|
1173
|
-
internalData.
|
|
1831
|
+
internalData.scrollRenderType = '';
|
|
1174
1832
|
if (isRollX && scrollXLoad) {
|
|
1175
1833
|
$xeTable.updateScrollXData().then(() => {
|
|
1834
|
+
calcCellHeight($xeTable);
|
|
1176
1835
|
loadScrollXData($xeTable);
|
|
1177
1836
|
});
|
|
1178
1837
|
}
|
|
1179
1838
|
if (isRollY && scrollYLoad) {
|
|
1180
1839
|
$xeTable.updateScrollYData().then(() => {
|
|
1840
|
+
calcCellHeight($xeTable);
|
|
1181
1841
|
loadScrollYData($xeTable);
|
|
1182
1842
|
});
|
|
1183
1843
|
}
|
|
@@ -1477,7 +2137,7 @@ const Methods = {
|
|
|
1477
2137
|
this.updateFooter();
|
|
1478
2138
|
return this.$nextTick().then(() => {
|
|
1479
2139
|
updateHeight($xeTable);
|
|
1480
|
-
|
|
2140
|
+
updateStyle($xeTable);
|
|
1481
2141
|
}).then(() => {
|
|
1482
2142
|
computeScrollLoad($xeTable);
|
|
1483
2143
|
}).then(() => {
|
|
@@ -1500,9 +2160,15 @@ const Methods = {
|
|
|
1500
2160
|
}
|
|
1501
2161
|
// 是否变更虚拟滚动
|
|
1502
2162
|
if (oldScrollYLoad === sYLoad) {
|
|
1503
|
-
(0, _util.restoreScrollLocation)(this, targetScrollLeft, targetScrollTop).then(
|
|
2163
|
+
(0, _util.restoreScrollLocation)(this, targetScrollLeft, targetScrollTop).then(() => {
|
|
2164
|
+
resolve();
|
|
2165
|
+
});
|
|
1504
2166
|
} else {
|
|
1505
|
-
setTimeout(() =>
|
|
2167
|
+
setTimeout(() => {
|
|
2168
|
+
(0, _util.restoreScrollLocation)(this, targetScrollLeft, targetScrollTop).then(() => {
|
|
2169
|
+
resolve();
|
|
2170
|
+
});
|
|
2171
|
+
});
|
|
1506
2172
|
}
|
|
1507
2173
|
});
|
|
1508
2174
|
});
|
|
@@ -1592,10 +2258,11 @@ const Methods = {
|
|
|
1592
2258
|
* @param {ColumnInfo} columns 列配置
|
|
1593
2259
|
*/
|
|
1594
2260
|
loadColumn(columns) {
|
|
2261
|
+
const $xeTable = this;
|
|
1595
2262
|
const collectColumn = _xeUtils.default.mapTree(columns, column => _cell.default.createColumn(this, column), {
|
|
1596
2263
|
children: 'children'
|
|
1597
2264
|
});
|
|
1598
|
-
return
|
|
2265
|
+
return handleColumn($xeTable, collectColumn);
|
|
1599
2266
|
},
|
|
1600
2267
|
/**
|
|
1601
2268
|
* 加载列配置并恢复到初始状态
|
|
@@ -1607,53 +2274,9 @@ const Methods = {
|
|
|
1607
2274
|
return this.loadColumn(columns);
|
|
1608
2275
|
});
|
|
1609
2276
|
},
|
|
1610
|
-
initColumnSort() {
|
|
1611
|
-
const {
|
|
1612
|
-
collectColumn
|
|
1613
|
-
} = this;
|
|
1614
|
-
collectColumn.forEach((column, index) => {
|
|
1615
|
-
const sortIndex = index + 1;
|
|
1616
|
-
column.sortNumber = sortIndex;
|
|
1617
|
-
column.renderSortNumber = sortIndex;
|
|
1618
|
-
});
|
|
1619
|
-
},
|
|
1620
2277
|
handleColumn(collectColumn) {
|
|
1621
2278
|
const $xeTable = this;
|
|
1622
|
-
|
|
1623
|
-
const tableFullColumn = getColumnList(collectColumn);
|
|
1624
|
-
this.tableFullColumn = tableFullColumn;
|
|
1625
|
-
this._isLoading = true;
|
|
1626
|
-
this.isDragColMove = false;
|
|
1627
|
-
this.initColumnSort();
|
|
1628
|
-
return Promise.resolve(this.restoreCustomStorage()).then(() => {
|
|
1629
|
-
this._isLoading = false;
|
|
1630
|
-
cacheColumnMap($xeTable);
|
|
1631
|
-
this.parseColumns(true).then(() => {
|
|
1632
|
-
if (this.scrollXLoad) {
|
|
1633
|
-
loadScrollXData($xeTable);
|
|
1634
|
-
}
|
|
1635
|
-
});
|
|
1636
|
-
this.clearMergeCells();
|
|
1637
|
-
this.clearMergeFooterItems();
|
|
1638
|
-
this.handleTableData(true);
|
|
1639
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1640
|
-
if ((this.scrollXLoad || this.scrollYLoad) && this.expandColumn) {
|
|
1641
|
-
(0, _log.warnLog)('vxe.error.scrollErrProp', ['column.type=expand']);
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
return this.$nextTick().then(() => {
|
|
1645
|
-
if (this.$toolbar) {
|
|
1646
|
-
this.$toolbar.syncUpdate({
|
|
1647
|
-
collectColumn: this.collectColumn,
|
|
1648
|
-
$table: this
|
|
1649
|
-
});
|
|
1650
|
-
}
|
|
1651
|
-
if ($xeTable.handleUpdateCustomColumn) {
|
|
1652
|
-
$xeTable.handleUpdateCustomColumn();
|
|
1653
|
-
}
|
|
1654
|
-
return this.recalculate();
|
|
1655
|
-
});
|
|
1656
|
-
});
|
|
2279
|
+
return handleColumn($xeTable, collectColumn);
|
|
1657
2280
|
},
|
|
1658
2281
|
/**
|
|
1659
2282
|
* 更新数据行的 Map
|
|
@@ -2203,7 +2826,7 @@ const Methods = {
|
|
|
2203
2826
|
const rowid = (0, _util.getRowid)(this, row);
|
|
2204
2827
|
let bodyElem = null;
|
|
2205
2828
|
if (column) {
|
|
2206
|
-
bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.
|
|
2829
|
+
bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.refTableBody;
|
|
2207
2830
|
}
|
|
2208
2831
|
if (bodyElem && bodyElem.$el) {
|
|
2209
2832
|
return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
@@ -3016,8 +3639,8 @@ const Methods = {
|
|
|
3016
3639
|
const colWidth = _xeUtils.default.toInteger(width);
|
|
3017
3640
|
let rdWidth = colWidth;
|
|
3018
3641
|
if ((0, _dom.isScale)(width)) {
|
|
3019
|
-
const
|
|
3020
|
-
const bodyElem =
|
|
3642
|
+
const refTableBody = $xeTable.$refs.refTableBody;
|
|
3643
|
+
const bodyElem = refTableBody ? refTableBody.$el : null;
|
|
3021
3644
|
const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0;
|
|
3022
3645
|
rdWidth = Math.floor(colWidth * bodyWidth);
|
|
3023
3646
|
}
|
|
@@ -3290,158 +3913,16 @@ const Methods = {
|
|
|
3290
3913
|
* 刷新列配置
|
|
3291
3914
|
*/
|
|
3292
3915
|
refreshColumn(initSort) {
|
|
3916
|
+
const $xeTable = this;
|
|
3293
3917
|
if (initSort) {
|
|
3294
|
-
|
|
3918
|
+
handleUpdateColumn($xeTable);
|
|
3295
3919
|
}
|
|
3296
|
-
return
|
|
3920
|
+
return parseColumns($xeTable, true).then(() => {
|
|
3297
3921
|
return this.refreshScroll();
|
|
3298
3922
|
}).then(() => {
|
|
3299
3923
|
return this.recalculate();
|
|
3300
3924
|
});
|
|
3301
3925
|
},
|
|
3302
|
-
/**
|
|
3303
|
-
* 刷新列信息
|
|
3304
|
-
* 将固定的列左边、右边分别靠边
|
|
3305
|
-
*/
|
|
3306
|
-
parseColumns(isReset) {
|
|
3307
|
-
const $xeTable = this;
|
|
3308
|
-
const props = $xeTable;
|
|
3309
|
-
const internalData = $xeTable;
|
|
3310
|
-
const {
|
|
3311
|
-
showOverflow
|
|
3312
|
-
} = props;
|
|
3313
|
-
const rowOpts = $xeTable.computeRowOpts;
|
|
3314
|
-
const leftList = [];
|
|
3315
|
-
const centerList = [];
|
|
3316
|
-
const rightList = [];
|
|
3317
|
-
const {
|
|
3318
|
-
collectColumn,
|
|
3319
|
-
tableFullColumn,
|
|
3320
|
-
isGroup,
|
|
3321
|
-
columnStore,
|
|
3322
|
-
sXOpts,
|
|
3323
|
-
scrollXStore,
|
|
3324
|
-
fullColumnIdData
|
|
3325
|
-
} = this;
|
|
3326
|
-
// 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
|
|
3327
|
-
if (isGroup) {
|
|
3328
|
-
const leftGroupList = [];
|
|
3329
|
-
const centerGroupList = [];
|
|
3330
|
-
const rightGroupList = [];
|
|
3331
|
-
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
3332
|
-
const isColGroup = (0, _utils.hasChildrenList)(column);
|
|
3333
|
-
// 如果是分组,必须按组设置固定列,不允许给子列设置固定
|
|
3334
|
-
if (parentColumn && parentColumn.fixed) {
|
|
3335
|
-
column.fixed = parentColumn.fixed;
|
|
3336
|
-
}
|
|
3337
|
-
if (parentColumn && column.fixed !== parentColumn.fixed) {
|
|
3338
|
-
(0, _log.errLog)('vxe.error.groupFixed');
|
|
3339
|
-
}
|
|
3340
|
-
if (isColGroup) {
|
|
3341
|
-
column.visible = !!_xeUtils.default.findTree(column.children, subColumn => (0, _utils.hasChildrenList)(subColumn) ? null : subColumn.visible);
|
|
3342
|
-
} else if (column.visible) {
|
|
3343
|
-
if (column.fixed === 'left') {
|
|
3344
|
-
leftList.push(column);
|
|
3345
|
-
} else if (column.fixed === 'right') {
|
|
3346
|
-
rightList.push(column);
|
|
3347
|
-
} else {
|
|
3348
|
-
centerList.push(column);
|
|
3349
|
-
}
|
|
3350
|
-
}
|
|
3351
|
-
});
|
|
3352
|
-
collectColumn.forEach(column => {
|
|
3353
|
-
if (column.visible) {
|
|
3354
|
-
if (column.fixed === 'left') {
|
|
3355
|
-
leftGroupList.push(column);
|
|
3356
|
-
} else if (column.fixed === 'right') {
|
|
3357
|
-
rightGroupList.push(column);
|
|
3358
|
-
} else {
|
|
3359
|
-
centerGroupList.push(column);
|
|
3360
|
-
}
|
|
3361
|
-
}
|
|
3362
|
-
});
|
|
3363
|
-
this.tableGroupColumn = leftGroupList.concat(centerGroupList).concat(rightGroupList);
|
|
3364
|
-
} else {
|
|
3365
|
-
// 重新分配列
|
|
3366
|
-
tableFullColumn.forEach(column => {
|
|
3367
|
-
if (column.visible) {
|
|
3368
|
-
if (column.fixed === 'left') {
|
|
3369
|
-
leftList.push(column);
|
|
3370
|
-
} else if (column.fixed === 'right') {
|
|
3371
|
-
rightList.push(column);
|
|
3372
|
-
} else {
|
|
3373
|
-
centerList.push(column);
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
});
|
|
3377
|
-
}
|
|
3378
|
-
const visibleColumn = leftList.concat(centerList).concat(rightList);
|
|
3379
|
-
// 如果gt为0,则总是启用
|
|
3380
|
-
const scrollXLoad = sXOpts.enabled && sXOpts.gt > -1 && (sXOpts.gt === 0 || sXOpts.gt <= tableFullColumn.length);
|
|
3381
|
-
this.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
|
|
3382
|
-
Object.assign(columnStore, {
|
|
3383
|
-
leftList,
|
|
3384
|
-
centerList,
|
|
3385
|
-
rightList
|
|
3386
|
-
});
|
|
3387
|
-
if (scrollXLoad) {
|
|
3388
|
-
if (showOverflow) {
|
|
3389
|
-
if (!rowOpts.height) {
|
|
3390
|
-
const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false);
|
|
3391
|
-
if (errColumn) {
|
|
3392
|
-
(0, _log.errLog)('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
|
|
3393
|
-
}
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3396
|
-
if (process.env.NODE_ENV === 'development') {
|
|
3397
|
-
// if (this.showHeader && !this.showHeaderOverflow) {
|
|
3398
|
-
// warnLog('vxe.error.reqProp', ['show-header-overflow'])
|
|
3399
|
-
// }
|
|
3400
|
-
// if (this.showFooter && !this.showFooterOverflow) {
|
|
3401
|
-
// warnLog('vxe.error.reqProp', ['show-footer-overflow'])
|
|
3402
|
-
// }
|
|
3403
|
-
if (this.spanMethod) {
|
|
3404
|
-
(0, _log.warnLog)('vxe.error.scrollErrProp', ['span-method']);
|
|
3405
|
-
}
|
|
3406
|
-
if (this.footerSpanMethod) {
|
|
3407
|
-
(0, _log.warnLog)('vxe.error.scrollErrProp', ['footer-span-method']);
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3410
|
-
if (isReset) {
|
|
3411
|
-
const {
|
|
3412
|
-
visibleSize
|
|
3413
|
-
} = handleVirtualXVisible(this);
|
|
3414
|
-
scrollXStore.startIndex = 0;
|
|
3415
|
-
scrollXStore.endIndex = visibleSize;
|
|
3416
|
-
scrollXStore.visibleSize = visibleSize;
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
// 如果列被显示/隐藏,则清除合并状态
|
|
3420
|
-
// 如果列被设置为固定,则清除合并状态
|
|
3421
|
-
if (visibleColumn.length !== this.visibleColumn.length || !this.visibleColumn.every((column, index) => column === visibleColumn[index])) {
|
|
3422
|
-
this.clearMergeCells();
|
|
3423
|
-
this.clearMergeFooterItems();
|
|
3424
|
-
}
|
|
3425
|
-
this.scrollXLoad = scrollXLoad;
|
|
3426
|
-
visibleColumn.forEach((column, index) => {
|
|
3427
|
-
const colid = column.id;
|
|
3428
|
-
const colRest = fullColumnIdData[colid];
|
|
3429
|
-
if (colRest) {
|
|
3430
|
-
colRest._index = index;
|
|
3431
|
-
}
|
|
3432
|
-
});
|
|
3433
|
-
this.visibleColumn = visibleColumn;
|
|
3434
|
-
this.handleTableColumn();
|
|
3435
|
-
if (isReset) {
|
|
3436
|
-
return this.updateFooter().then(() => {
|
|
3437
|
-
return this.recalculate();
|
|
3438
|
-
}).then(() => {
|
|
3439
|
-
this.updateCellAreas();
|
|
3440
|
-
return this.recalculate();
|
|
3441
|
-
});
|
|
3442
|
-
}
|
|
3443
|
-
return this.updateFooter();
|
|
3444
|
-
},
|
|
3445
3926
|
/**
|
|
3446
3927
|
* 指定列宽的列进行拆分
|
|
3447
3928
|
*/
|
|
@@ -3545,38 +4026,43 @@ const Methods = {
|
|
|
3545
4026
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
3546
4027
|
*/
|
|
3547
4028
|
refreshScroll() {
|
|
4029
|
+
const $xeTable = this;
|
|
4030
|
+
const internalData = $xeTable;
|
|
3548
4031
|
const {
|
|
4032
|
+
elemStore,
|
|
3549
4033
|
lastScrollLeft,
|
|
3550
4034
|
lastScrollTop
|
|
3551
|
-
} =
|
|
3552
|
-
const
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
const
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
tableFooter
|
|
3560
|
-
} = $refs;
|
|
3561
|
-
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
3562
|
-
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
3563
|
-
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
3564
|
-
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
|
4035
|
+
} = internalData;
|
|
4036
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
4037
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
4038
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
4039
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
4040
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
4041
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
4042
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
3565
4043
|
return new Promise(resolve => {
|
|
3566
4044
|
// 还原滚动条位置
|
|
3567
4045
|
if (lastScrollLeft || lastScrollTop) {
|
|
3568
|
-
return (0, _util.restoreScrollLocation)(
|
|
4046
|
+
return (0, _util.restoreScrollLocation)($xeTable, lastScrollLeft, lastScrollTop).then().then(() => {
|
|
3569
4047
|
// 存在滚动行为未结束情况
|
|
3570
|
-
setTimeout(resolve,
|
|
4048
|
+
setTimeout(resolve, 10);
|
|
3571
4049
|
});
|
|
3572
4050
|
}
|
|
4051
|
+
internalData.intoRunScroll = true;
|
|
3573
4052
|
// 重置
|
|
3574
|
-
(0, _dom.setScrollTop)(
|
|
3575
|
-
(0, _dom.setScrollTop)(
|
|
3576
|
-
(0, _dom.setScrollTop)(
|
|
3577
|
-
(0, _dom.
|
|
4053
|
+
(0, _dom.setScrollTop)(yHandleEl, lastScrollTop);
|
|
4054
|
+
(0, _dom.setScrollTop)(bodyScrollElem, lastScrollTop);
|
|
4055
|
+
(0, _dom.setScrollTop)(leftScrollElem, lastScrollTop);
|
|
4056
|
+
(0, _dom.setScrollTop)(rightScrollElem, lastScrollTop);
|
|
4057
|
+
(0, _dom.setScrollLeft)(xHandleEl, lastScrollLeft);
|
|
4058
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, lastScrollLeft);
|
|
4059
|
+
(0, _dom.setScrollLeft)(headerScrollElem, lastScrollLeft);
|
|
4060
|
+
(0, _dom.setScrollLeft)(footerScrollElem, lastScrollLeft);
|
|
3578
4061
|
// 存在滚动行为未结束情况
|
|
3579
|
-
setTimeout(
|
|
4062
|
+
setTimeout(() => {
|
|
4063
|
+
internalData.intoRunScroll = false;
|
|
4064
|
+
resolve();
|
|
4065
|
+
}, 10);
|
|
3580
4066
|
});
|
|
3581
4067
|
},
|
|
3582
4068
|
/**
|
|
@@ -3585,368 +4071,67 @@ const Methods = {
|
|
|
3585
4071
|
*/
|
|
3586
4072
|
recalculate(reFull) {
|
|
3587
4073
|
const $xeTable = this;
|
|
3588
|
-
const internalData = $xeTable;
|
|
3589
|
-
return new Promise(resolve => {
|
|
3590
|
-
const {
|
|
3591
|
-
rceTimeout,
|
|
3592
|
-
rceRunTime
|
|
3593
|
-
} = internalData;
|
|
3594
|
-
const resizeOpts = $xeTable.computeResizeOpts;
|
|
3595
|
-
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
3596
|
-
const el = $xeTable.$refs.refElem;
|
|
3597
|
-
if (el && el.clientWidth) {
|
|
3598
|
-
autoCellWidth($xeTable);
|
|
3599
|
-
}
|
|
3600
|
-
if (rceTimeout) {
|
|
3601
|
-
clearTimeout(rceTimeout);
|
|
3602
|
-
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
3603
|
-
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
3604
|
-
} else {
|
|
3605
|
-
$xeTable.$nextTick(() => {
|
|
3606
|
-
resolve();
|
|
3607
|
-
});
|
|
3608
|
-
}
|
|
3609
|
-
} else {
|
|
3610
|
-
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
3611
|
-
}
|
|
3612
|
-
internalData.rceTimeout = setTimeout(() => {
|
|
3613
|
-
internalData.rceTimeout = undefined;
|
|
3614
|
-
handleRecalculateLayout($xeTable, !!reFull);
|
|
3615
|
-
}, refreshDelay);
|
|
3616
|
-
});
|
|
3617
|
-
},
|
|
3618
|
-
updateStyle() {
|
|
3619
|
-
const $xeTable = this;
|
|
3620
|
-
let {
|
|
3621
|
-
$refs,
|
|
3622
|
-
isGroup,
|
|
3623
|
-
fullColumnIdData,
|
|
3624
|
-
tableColumn,
|
|
3625
|
-
customHeight,
|
|
3626
|
-
customMinHeight,
|
|
3627
|
-
customMaxHeight,
|
|
3628
|
-
border,
|
|
3629
|
-
headerHeight,
|
|
3630
|
-
showFooter,
|
|
3631
|
-
showOverflow: allColumnOverflow,
|
|
3632
|
-
showHeaderOverflow: allColumnHeaderOverflow,
|
|
3633
|
-
showFooterOverflow: allColumnFooterOverflow,
|
|
3634
|
-
footerHeight,
|
|
3635
|
-
tableHeight,
|
|
3636
|
-
tableWidth,
|
|
3637
|
-
scrollbarHeight,
|
|
3638
|
-
scrollbarWidth,
|
|
3639
|
-
scrollXLoad,
|
|
3640
|
-
scrollYLoad,
|
|
3641
|
-
overflowX,
|
|
3642
|
-
cellOffsetWidth,
|
|
3643
|
-
columnStore,
|
|
3644
|
-
elemStore,
|
|
3645
|
-
editStore,
|
|
3646
|
-
currentRow,
|
|
3647
|
-
mouseConfig,
|
|
3648
|
-
spanMethod,
|
|
3649
|
-
expandColumn,
|
|
3650
|
-
footerSpanMethod,
|
|
3651
|
-
isAllOverflow,
|
|
3652
|
-
visibleColumn
|
|
3653
|
-
} = $xeTable;
|
|
3654
|
-
const containerList = ['main', 'left', 'right'];
|
|
3655
|
-
const emptyPlaceholderElem = $refs.emptyPlaceholder;
|
|
3656
|
-
const bodyWrapperElem = elemStore['main-body-wrapper'];
|
|
3657
|
-
if (emptyPlaceholderElem) {
|
|
3658
|
-
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
3659
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
|
|
3660
|
-
}
|
|
3661
|
-
if (customHeight > 0) {
|
|
3662
|
-
if (showFooter) {
|
|
3663
|
-
customHeight += scrollbarHeight;
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
|
|
3667
|
-
if (scrollXVirtualEl) {
|
|
3668
|
-
scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
|
|
3669
|
-
}
|
|
3670
|
-
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
|
|
3671
|
-
if (scrollYVirtualEl) {
|
|
3672
|
-
let bodyHeight = 0;
|
|
3673
|
-
let bodyMaxHeight = 0;
|
|
3674
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
|
|
3675
|
-
if (customMaxHeight) {
|
|
3676
|
-
bodyMaxHeight = customMaxHeight - headerHeight - footerHeight;
|
|
3677
|
-
bodyMaxHeight = Math.max(bodyMinHeight, bodyMaxHeight);
|
|
3678
|
-
}
|
|
3679
|
-
if (customHeight) {
|
|
3680
|
-
bodyHeight = customHeight - headerHeight - footerHeight;
|
|
3681
|
-
if (bodyMaxHeight) {
|
|
3682
|
-
bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
|
|
3683
|
-
}
|
|
3684
|
-
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
3685
|
-
}
|
|
3686
|
-
scrollYVirtualEl.style.top = `${headerHeight}px`;
|
|
3687
|
-
scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
|
|
3688
|
-
scrollYVirtualEl.style.height = `${bodyHeight + (overflowX ? -Math.max(1, scrollbarHeight) : 0)}px`;
|
|
3689
|
-
}
|
|
3690
|
-
containerList.forEach((name, index) => {
|
|
3691
|
-
const fixedType = index > 0 ? name : '';
|
|
3692
|
-
const layoutList = ['header', 'body', 'footer'];
|
|
3693
|
-
const fixedColumn = columnStore[`${fixedType}List`];
|
|
3694
|
-
const fixedWrapperElem = $refs[`${fixedType}Container`];
|
|
3695
|
-
layoutList.forEach(layout => {
|
|
3696
|
-
const wrapperElem = elemStore[`${name}-${layout}-wrapper`];
|
|
3697
|
-
const tableElem = elemStore[`${name}-${layout}-table`];
|
|
3698
|
-
if (layout === 'header') {
|
|
3699
|
-
// 表头体样式处理
|
|
3700
|
-
// 横向滚动渲染
|
|
3701
|
-
let tWidth = tableWidth;
|
|
3702
|
-
let renderColumnList = tableColumn;
|
|
3703
|
-
if (isGroup) {
|
|
3704
|
-
renderColumnList = visibleColumn;
|
|
3705
|
-
} else {
|
|
3706
|
-
if (fixedType) {
|
|
3707
|
-
// 如果是使用优化模式
|
|
3708
|
-
if (scrollXLoad || scrollYLoad || allColumnHeaderOverflow) {
|
|
3709
|
-
// 如果不支持优化模式
|
|
3710
|
-
if (spanMethod || footerSpanMethod) {
|
|
3711
|
-
renderColumnList = visibleColumn;
|
|
3712
|
-
} else {
|
|
3713
|
-
renderColumnList = fixedColumn || [];
|
|
3714
|
-
}
|
|
3715
|
-
} else {
|
|
3716
|
-
renderColumnList = visibleColumn;
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
}
|
|
3720
|
-
tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
3721
|
-
if (tableElem) {
|
|
3722
|
-
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : '';
|
|
3723
|
-
// 修复 IE 中高度无法自适应问题
|
|
3724
|
-
if (_dom.browse.msie) {
|
|
3725
|
-
_xeUtils.default.arrayEach(tableElem.querySelectorAll('.vxe-resizable'), resizeElem => {
|
|
3726
|
-
resizeElem.style.height = `${resizeElem.parentNode.offsetHeight}px`;
|
|
3727
|
-
});
|
|
3728
|
-
}
|
|
3729
|
-
}
|
|
3730
|
-
const repairElem = elemStore[`${name}-${layout}-repair`];
|
|
3731
|
-
if (repairElem) {
|
|
3732
|
-
repairElem.style.width = `${tableWidth}px`;
|
|
3733
|
-
}
|
|
3734
|
-
const listElem = elemStore[`${name}-${layout}-list`];
|
|
3735
|
-
if (isGroup && listElem) {
|
|
3736
|
-
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
|
|
3737
|
-
const colNode = this.getColumnNode(thElem);
|
|
3738
|
-
if (colNode) {
|
|
3739
|
-
const column = colNode.item;
|
|
3740
|
-
const {
|
|
3741
|
-
showHeaderOverflow
|
|
3742
|
-
} = column;
|
|
3743
|
-
const cellOverflow = _xeUtils.default.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow;
|
|
3744
|
-
const showEllipsis = cellOverflow === 'ellipsis';
|
|
3745
|
-
const showTitle = cellOverflow === 'title';
|
|
3746
|
-
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
3747
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
3748
|
-
let childWidth = 0;
|
|
3749
|
-
let countChild = 0;
|
|
3750
|
-
if (hasEllipsis) {
|
|
3751
|
-
_xeUtils.default.eachTree(column.children, item => {
|
|
3752
|
-
if (!item.children || !column.children.length) {
|
|
3753
|
-
countChild++;
|
|
3754
|
-
}
|
|
3755
|
-
childWidth += item.renderWidth;
|
|
3756
|
-
});
|
|
3757
|
-
}
|
|
3758
|
-
thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : '';
|
|
3759
|
-
}
|
|
3760
|
-
});
|
|
3761
|
-
}
|
|
3762
|
-
} else if (layout === 'body') {
|
|
3763
|
-
const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`];
|
|
3764
|
-
if ((0, _dom.isNodeElement)(wrapperElem)) {
|
|
3765
|
-
let bodyMaxHeight = 0;
|
|
3766
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
|
|
3767
|
-
if (customMaxHeight) {
|
|
3768
|
-
bodyMaxHeight = customMaxHeight - headerHeight - footerHeight;
|
|
3769
|
-
// 如果是固定列
|
|
3770
|
-
if (fixedType) {
|
|
3771
|
-
bodyMaxHeight -= showFooter ? 0 : scrollbarHeight;
|
|
3772
|
-
}
|
|
3773
|
-
bodyMaxHeight = Math.max(bodyMinHeight, bodyMaxHeight);
|
|
3774
|
-
wrapperElem.style.maxHeight = `${bodyMaxHeight}px`;
|
|
3775
|
-
}
|
|
3776
|
-
if (customHeight) {
|
|
3777
|
-
let bodyHeight = customHeight - headerHeight - footerHeight;
|
|
3778
|
-
// 如果是固定列
|
|
3779
|
-
if (fixedType) {
|
|
3780
|
-
bodyHeight -= showFooter ? 0 : scrollbarHeight;
|
|
3781
|
-
}
|
|
3782
|
-
if (bodyMaxHeight) {
|
|
3783
|
-
bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
|
|
3784
|
-
}
|
|
3785
|
-
wrapperElem.style.height = `${Math.max(bodyMinHeight, bodyHeight)}px`;
|
|
3786
|
-
} else {
|
|
3787
|
-
wrapperElem.style.height = '';
|
|
3788
|
-
}
|
|
3789
|
-
wrapperElem.style.minHeight = `${bodyMinHeight}px`;
|
|
3790
|
-
}
|
|
3791
|
-
// 如果是固定列
|
|
3792
|
-
if (fixedWrapperElem) {
|
|
3793
|
-
const isRightFixed = fixedType === 'right';
|
|
3794
|
-
const fixedColumn = columnStore[`${fixedType}List`];
|
|
3795
|
-
if ((0, _dom.isNodeElement)(wrapperElem)) {
|
|
3796
|
-
wrapperElem.style.top = `${headerHeight}px`;
|
|
3797
|
-
}
|
|
3798
|
-
fixedWrapperElem.style.height = `${(customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) + headerHeight + footerHeight - scrollbarHeight * (showFooter ? 2 : 1)}px`;
|
|
3799
|
-
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, isRightFixed ? scrollbarWidth : 0)}px`;
|
|
3800
|
-
}
|
|
3801
|
-
let tWidth = tableWidth;
|
|
3802
|
-
let renderColumnList = tableColumn;
|
|
3803
|
-
if (fixedType) {
|
|
3804
|
-
// 如果是使用优化模式
|
|
3805
|
-
if (scrollXLoad || scrollYLoad || allColumnOverflow && isAllOverflow) {
|
|
3806
|
-
// 如果不支持优化模式
|
|
3807
|
-
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
3808
|
-
renderColumnList = visibleColumn;
|
|
3809
|
-
} else {
|
|
3810
|
-
renderColumnList = fixedColumn || [];
|
|
3811
|
-
}
|
|
3812
|
-
} else {
|
|
3813
|
-
renderColumnList = visibleColumn;
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
|
-
tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
3817
|
-
if (tableElem) {
|
|
3818
|
-
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
3819
|
-
// 兼容性处理
|
|
3820
|
-
tableElem.style.paddingRight = scrollbarWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${scrollbarWidth}px` : '';
|
|
3821
|
-
}
|
|
3822
|
-
if (emptyBlockElem) {
|
|
3823
|
-
emptyBlockElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
3824
|
-
}
|
|
3825
|
-
} else if (layout === 'footer') {
|
|
3826
|
-
let tWidth = tableWidth;
|
|
3827
|
-
let renderColumnList = tableColumn;
|
|
3828
|
-
if (fixedType) {
|
|
3829
|
-
// 如果是使用优化模式
|
|
3830
|
-
if (scrollXLoad || scrollYLoad || allColumnFooterOverflow) {
|
|
3831
|
-
// 如果不支持优化模式
|
|
3832
|
-
if (spanMethod || footerSpanMethod) {
|
|
3833
|
-
renderColumnList = visibleColumn;
|
|
3834
|
-
} else {
|
|
3835
|
-
renderColumnList = fixedColumn || [];
|
|
3836
|
-
}
|
|
3837
|
-
} else {
|
|
3838
|
-
renderColumnList = visibleColumn;
|
|
3839
|
-
}
|
|
3840
|
-
}
|
|
3841
|
-
tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
3842
|
-
if ((0, _dom.isNodeElement)(wrapperElem)) {
|
|
3843
|
-
// 如果是固定列
|
|
3844
|
-
if (fixedWrapperElem) {
|
|
3845
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight : tableHeight + headerHeight}px`;
|
|
3846
|
-
}
|
|
3847
|
-
wrapperElem.style.marginTop = `${-scrollbarHeight}px`;
|
|
3848
|
-
}
|
|
3849
|
-
if (tableElem) {
|
|
3850
|
-
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : '';
|
|
3851
|
-
}
|
|
3852
|
-
}
|
|
3853
|
-
const colgroupElem = elemStore[`${name}-${layout}-colgroup`];
|
|
3854
|
-
if (colgroupElem) {
|
|
3855
|
-
_xeUtils.default.arrayEach(colgroupElem.children, colElem => {
|
|
3856
|
-
const colid = colElem.getAttribute('name');
|
|
3857
|
-
if (colid === 'col_gutter') {
|
|
3858
|
-
colElem.style.width = `${scrollbarWidth}px`;
|
|
3859
|
-
}
|
|
3860
|
-
if (fullColumnIdData[colid]) {
|
|
3861
|
-
const colRest = fullColumnIdData[colid];
|
|
3862
|
-
const column = colRest.column;
|
|
3863
|
-
const {
|
|
3864
|
-
showHeaderOverflow,
|
|
3865
|
-
showFooterOverflow,
|
|
3866
|
-
showOverflow
|
|
3867
|
-
} = column;
|
|
3868
|
-
let cellOverflow;
|
|
3869
|
-
colElem.style.width = `${column.renderWidth}px`;
|
|
3870
|
-
if (layout === 'header') {
|
|
3871
|
-
cellOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
3872
|
-
} else if (layout === 'footer') {
|
|
3873
|
-
cellOverflow = _xeUtils.default.isUndefined(showFooterOverflow) || _xeUtils.default.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
3874
|
-
} else {
|
|
3875
|
-
cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? allColumnOverflow : showOverflow;
|
|
3876
|
-
}
|
|
3877
|
-
const showEllipsis = cellOverflow === 'ellipsis';
|
|
3878
|
-
const showTitle = cellOverflow === 'title';
|
|
3879
|
-
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
3880
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
3881
|
-
const listElem = elemStore[`${name}-${layout}-list`];
|
|
3882
|
-
// 滚动的渲染不支持动态行高
|
|
3883
|
-
if (layout === 'header' || layout === 'footer') {
|
|
3884
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
3885
|
-
hasEllipsis = true;
|
|
3886
|
-
}
|
|
3887
|
-
} else {
|
|
3888
|
-
if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
|
|
3889
|
-
hasEllipsis = true;
|
|
3890
|
-
}
|
|
3891
|
-
}
|
|
3892
|
-
if (listElem) {
|
|
3893
|
-
_xeUtils.default.arrayEach(listElem.querySelectorAll(`.${column.id}`), elem => {
|
|
3894
|
-
const colspan = parseInt(elem.getAttribute('colspan') || 1);
|
|
3895
|
-
const cellElem = elem.querySelector('.vxe-cell');
|
|
3896
|
-
let colWidth = column.renderWidth;
|
|
3897
|
-
if (cellElem) {
|
|
3898
|
-
if (colspan > 1) {
|
|
3899
|
-
const columnIndex = this.getColumnIndex(column);
|
|
3900
|
-
for (let index = 1; index < colspan; index++) {
|
|
3901
|
-
const nextColumn = this.getColumns(columnIndex + index);
|
|
3902
|
-
if (nextColumn) {
|
|
3903
|
-
colWidth += nextColumn.renderWidth;
|
|
3904
|
-
}
|
|
3905
|
-
}
|
|
3906
|
-
}
|
|
3907
|
-
cellElem.style.width = hasEllipsis ? `${colWidth - cellOffsetWidth * colspan}px` : '';
|
|
3908
|
-
}
|
|
3909
|
-
});
|
|
3910
|
-
}
|
|
3911
|
-
}
|
|
4074
|
+
const internalData = $xeTable;
|
|
4075
|
+
return new Promise(resolve => {
|
|
4076
|
+
const {
|
|
4077
|
+
rceTimeout,
|
|
4078
|
+
rceRunTime
|
|
4079
|
+
} = internalData;
|
|
4080
|
+
const resizeOpts = $xeTable.computeResizeOpts;
|
|
4081
|
+
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
4082
|
+
const el = $xeTable.$refs.refElem;
|
|
4083
|
+
if (el && el.clientWidth) {
|
|
4084
|
+
autoCellWidth($xeTable);
|
|
4085
|
+
}
|
|
4086
|
+
if (rceTimeout) {
|
|
4087
|
+
clearTimeout(rceTimeout);
|
|
4088
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
4089
|
+
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
4090
|
+
} else {
|
|
4091
|
+
$xeTable.$nextTick(() => {
|
|
4092
|
+
resolve();
|
|
3912
4093
|
});
|
|
3913
4094
|
}
|
|
3914
|
-
}
|
|
4095
|
+
} else {
|
|
4096
|
+
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
4097
|
+
}
|
|
4098
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
4099
|
+
internalData.rceTimeout = undefined;
|
|
4100
|
+
handleRecalculateLayout($xeTable, !!reFull);
|
|
4101
|
+
}, refreshDelay);
|
|
3915
4102
|
});
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
this.addColSdCls();
|
|
3921
|
-
}
|
|
3922
|
-
return this.$nextTick();
|
|
4103
|
+
},
|
|
4104
|
+
updateStyle() {
|
|
4105
|
+
const $xeTable = this;
|
|
4106
|
+
return updateStyle($xeTable);
|
|
3923
4107
|
},
|
|
3924
4108
|
/**
|
|
3925
4109
|
* 处理固定列的显示状态
|
|
3926
4110
|
*/
|
|
3927
4111
|
checkScrolling() {
|
|
3928
4112
|
const $xeTable = this;
|
|
4113
|
+
const internalData = $xeTable;
|
|
3929
4114
|
const {
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
const
|
|
4115
|
+
elemStore
|
|
4116
|
+
} = internalData;
|
|
4117
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
4118
|
+
const leftContainerElem = $xeTable.$refs.refLeftContainer;
|
|
4119
|
+
const rightContainerElem = $xeTable.$refs.refRightContainer;
|
|
3935
4120
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
3936
|
-
const bodtTargetEl = xHandleEl ||
|
|
4121
|
+
const bodtTargetEl = xHandleEl || bodyScrollElem;
|
|
3937
4122
|
if (bodtTargetEl) {
|
|
3938
|
-
if (
|
|
4123
|
+
if (leftContainerElem) {
|
|
3939
4124
|
if (bodtTargetEl.scrollLeft > 0) {
|
|
3940
|
-
(0, _dom.addClass)(
|
|
4125
|
+
(0, _dom.addClass)(leftContainerElem, 'scrolling--middle');
|
|
3941
4126
|
} else {
|
|
3942
|
-
(0, _dom.removeClass)(
|
|
4127
|
+
(0, _dom.removeClass)(leftContainerElem, 'scrolling--middle');
|
|
3943
4128
|
}
|
|
3944
4129
|
}
|
|
3945
|
-
if (
|
|
4130
|
+
if (rightContainerElem) {
|
|
3946
4131
|
if (bodtTargetEl.clientWidth < bodtTargetEl.scrollWidth - Math.ceil(bodtTargetEl.scrollLeft)) {
|
|
3947
|
-
(0, _dom.addClass)(
|
|
4132
|
+
(0, _dom.addClass)(rightContainerElem, 'scrolling--middle');
|
|
3948
4133
|
} else {
|
|
3949
|
-
(0, _dom.removeClass)(
|
|
4134
|
+
(0, _dom.removeClass)(rightContainerElem, 'scrolling--middle');
|
|
3950
4135
|
}
|
|
3951
4136
|
}
|
|
3952
4137
|
}
|
|
@@ -4002,10 +4187,10 @@ const Methods = {
|
|
|
4002
4187
|
actived
|
|
4003
4188
|
} = editStore;
|
|
4004
4189
|
const {
|
|
4005
|
-
|
|
4190
|
+
refTableMenu,
|
|
4006
4191
|
filterWrapper,
|
|
4007
4192
|
customWrapper,
|
|
4008
|
-
|
|
4193
|
+
refValidTooltip
|
|
4009
4194
|
} = $refs;
|
|
4010
4195
|
// 筛选
|
|
4011
4196
|
if (filterWrapper) {
|
|
@@ -4037,7 +4222,7 @@ const Methods = {
|
|
|
4037
4222
|
// 如果是激活状态,点击了单元格之外
|
|
4038
4223
|
const cell = actived.args.cell;
|
|
4039
4224
|
if (!cell || !(0, _dom.getEventTargetNode)(evnt, cell).flag) {
|
|
4040
|
-
if (
|
|
4225
|
+
if (refValidTooltip && (0, _dom.getEventTargetNode)(evnt, refValidTooltip.$el).flag) {
|
|
4041
4226
|
// 如果是激活状态,且点击了校验提示框
|
|
4042
4227
|
} else if (!this.lastCallTime || this.lastCallTime + 50 < Date.now()) {
|
|
4043
4228
|
if (!(0, _dom.getEventTargetNode)(evnt, document.body, 'vxe-table--ignore-clear').flag) {
|
|
@@ -4085,7 +4270,7 @@ const Methods = {
|
|
|
4085
4270
|
}
|
|
4086
4271
|
}
|
|
4087
4272
|
} else if (mouseConfig) {
|
|
4088
|
-
if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($xegrid && (0, _dom.getEventTargetNode)(evnt, $xegrid.$el).flag) && !(
|
|
4273
|
+
if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($xegrid && (0, _dom.getEventTargetNode)(evnt, $xegrid.$el).flag) && !(refTableMenu && (0, _dom.getEventTargetNode)(evnt, refTableMenu.$el).flag) && !($toolbar && (0, _dom.getEventTargetNode)(evnt, $toolbar.$el).flag)) {
|
|
4089
4274
|
if (this.clearSelected) {
|
|
4090
4275
|
this.clearSelected();
|
|
4091
4276
|
}
|
|
@@ -4106,7 +4291,7 @@ const Methods = {
|
|
|
4106
4291
|
}
|
|
4107
4292
|
}
|
|
4108
4293
|
// 如果配置了快捷菜单且,点击了其他地方则关闭
|
|
4109
|
-
if (ctxMenuStore.visible &&
|
|
4294
|
+
if (ctxMenuStore.visible && refTableMenu && !(0, _dom.getEventTargetNode)(evnt, refTableMenu.$el).flag) {
|
|
4110
4295
|
this.closeMenu();
|
|
4111
4296
|
}
|
|
4112
4297
|
const isActivated = (0, _dom.getEventTargetNode)(evnt, ($xegrid || this).$el).flag;
|
|
@@ -4272,8 +4457,8 @@ const Methods = {
|
|
|
4272
4457
|
} else if (isContextMenu) {
|
|
4273
4458
|
// 如果按下上下文键
|
|
4274
4459
|
this._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
|
|
4275
|
-
clearTimeout(
|
|
4276
|
-
|
|
4460
|
+
clearTimeout(internalData.keyCtxTimeout);
|
|
4461
|
+
internalData.keyCtxTimeout = setTimeout(() => {
|
|
4277
4462
|
this._keyCtx = false;
|
|
4278
4463
|
}, 1000);
|
|
4279
4464
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
|
|
@@ -4689,6 +4874,10 @@ const Methods = {
|
|
|
4689
4874
|
* @param {Row} row 行对象
|
|
4690
4875
|
*/
|
|
4691
4876
|
handleTooltip(evnt, cell, overflowElem, tipElem, params) {
|
|
4877
|
+
const $xeTable = this;
|
|
4878
|
+
if (!overflowElem) {
|
|
4879
|
+
return $xeTable.$nextTick();
|
|
4880
|
+
}
|
|
4692
4881
|
params.cell = cell;
|
|
4693
4882
|
const {
|
|
4694
4883
|
$refs,
|
|
@@ -4728,7 +4917,7 @@ const Methods = {
|
|
|
4728
4917
|
const {
|
|
4729
4918
|
$refs
|
|
4730
4919
|
} = this;
|
|
4731
|
-
const commTip = $refs.
|
|
4920
|
+
const commTip = $refs.refCommTooltip;
|
|
4732
4921
|
if (commTip) {
|
|
4733
4922
|
return commTip.open(target, content);
|
|
4734
4923
|
}
|
|
@@ -4743,7 +4932,7 @@ const Methods = {
|
|
|
4743
4932
|
tooltipStore
|
|
4744
4933
|
} = this;
|
|
4745
4934
|
const tooltip = $refs.tooltip;
|
|
4746
|
-
const commTip = $refs.
|
|
4935
|
+
const commTip = $refs.refCommTooltip;
|
|
4747
4936
|
if (tooltipStore.visible) {
|
|
4748
4937
|
Object.assign(tooltipStore, {
|
|
4749
4938
|
row: null,
|
|
@@ -6175,6 +6364,7 @@ const Methods = {
|
|
|
6175
6364
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
6176
6365
|
},
|
|
6177
6366
|
handleDefaultSort() {
|
|
6367
|
+
const $xeTable = this;
|
|
6178
6368
|
const {
|
|
6179
6369
|
sortConfig,
|
|
6180
6370
|
sortOpts
|
|
@@ -6201,7 +6391,7 @@ const Methods = {
|
|
|
6201
6391
|
}
|
|
6202
6392
|
});
|
|
6203
6393
|
if (!sortOpts.remote) {
|
|
6204
|
-
this.handleTableData(true).then(
|
|
6394
|
+
this.handleTableData(true).then(() => updateStyle($xeTable));
|
|
6205
6395
|
}
|
|
6206
6396
|
}
|
|
6207
6397
|
}
|
|
@@ -6714,8 +6904,8 @@ const Methods = {
|
|
|
6714
6904
|
},
|
|
6715
6905
|
handleColDragSwapColumn() {
|
|
6716
6906
|
const $xeTable = this;
|
|
6717
|
-
$xeTable
|
|
6718
|
-
$xeTable
|
|
6907
|
+
handleUpdateColumn($xeTable);
|
|
6908
|
+
parseColumns($xeTable, false).then(() => {
|
|
6719
6909
|
$xeTable.updateCellAreas();
|
|
6720
6910
|
$xeTable.saveCustomStore('update:sort');
|
|
6721
6911
|
});
|
|
@@ -6965,15 +7155,15 @@ const Methods = {
|
|
|
6965
7155
|
return;
|
|
6966
7156
|
}
|
|
6967
7157
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
6968
|
-
const
|
|
6969
|
-
const tableBodyElem =
|
|
7158
|
+
const refTableBody = $xeTable.$refs.refTableBody;
|
|
7159
|
+
const tableBodyElem = refTableBody ? refTableBody.$el : null;
|
|
6970
7160
|
const scrollTargetEl = xHandleEl || tableBodyElem;
|
|
6971
7161
|
if (scrollTargetEl) {
|
|
6972
7162
|
const wrapperRect = el.getBoundingClientRect();
|
|
6973
7163
|
const tableWidth = el.clientWidth;
|
|
6974
|
-
const leftContainerElem = $xeTable.$refs.
|
|
7164
|
+
const leftContainerElem = $xeTable.$refs.refLeftContainer;
|
|
6975
7165
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
6976
|
-
const rightContainerElem = $xeTable.$refs.
|
|
7166
|
+
const rightContainerElem = $xeTable.$refs.refRightContainer;
|
|
6977
7167
|
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
6978
7168
|
const srartX = wrapperRect.x + leftContainerWidth;
|
|
6979
7169
|
const endX = wrapperRect.x + tableWidth - rightContainerWidth;
|
|
@@ -7105,6 +7295,7 @@ const Methods = {
|
|
|
7105
7295
|
return this.$nextTick();
|
|
7106
7296
|
},
|
|
7107
7297
|
sort(sortConfs, sortOrder) {
|
|
7298
|
+
const $xeTable = this;
|
|
7108
7299
|
const {
|
|
7109
7300
|
sortOpts
|
|
7110
7301
|
} = this;
|
|
@@ -7157,7 +7348,7 @@ const Methods = {
|
|
|
7157
7348
|
}
|
|
7158
7349
|
return this.$nextTick().then(() => {
|
|
7159
7350
|
this.updateCellAreas();
|
|
7160
|
-
return
|
|
7351
|
+
return updateStyle($xeTable);
|
|
7161
7352
|
});
|
|
7162
7353
|
}
|
|
7163
7354
|
return this.$nextTick();
|
|
@@ -7209,7 +7400,7 @@ const Methods = {
|
|
|
7209
7400
|
}
|
|
7210
7401
|
return $xeTable.$nextTick().then(() => {
|
|
7211
7402
|
$xeTable.updateCellAreas();
|
|
7212
|
-
return $xeTable
|
|
7403
|
+
return updateStyle($xeTable);
|
|
7213
7404
|
});
|
|
7214
7405
|
}
|
|
7215
7406
|
return $xeTable.$nextTick();
|
|
@@ -7220,6 +7411,7 @@ const Methods = {
|
|
|
7220
7411
|
* @param {String} column 列或字段名
|
|
7221
7412
|
*/
|
|
7222
7413
|
clearSort(fieldOrColumn) {
|
|
7414
|
+
const $xeTable = this;
|
|
7223
7415
|
const {
|
|
7224
7416
|
sortOpts
|
|
7225
7417
|
} = this;
|
|
@@ -7234,7 +7426,7 @@ const Methods = {
|
|
|
7234
7426
|
if (!sortOpts.remote) {
|
|
7235
7427
|
this.handleTableData(true);
|
|
7236
7428
|
}
|
|
7237
|
-
return this.$nextTick().then(
|
|
7429
|
+
return this.$nextTick().then(() => updateStyle($xeTable));
|
|
7238
7430
|
},
|
|
7239
7431
|
// 在 v3 中废弃
|
|
7240
7432
|
getSortColumn() {
|
|
@@ -8132,7 +8324,7 @@ const Methods = {
|
|
|
8132
8324
|
scrollXLoad,
|
|
8133
8325
|
scrollYLoad
|
|
8134
8326
|
} = this;
|
|
8135
|
-
const bodyElem = $refs.
|
|
8327
|
+
const bodyElem = $refs.refTableBody.$el;
|
|
8136
8328
|
return {
|
|
8137
8329
|
virtualX: scrollXLoad,
|
|
8138
8330
|
virtualY: scrollYLoad,
|
|
@@ -8152,15 +8344,18 @@ const Methods = {
|
|
|
8152
8344
|
lastScrollLeft,
|
|
8153
8345
|
lastScrollTop
|
|
8154
8346
|
} = internalData;
|
|
8155
|
-
const
|
|
8156
|
-
const
|
|
8347
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8348
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8349
|
+
if (!xHandleEl || !yHandleEl) {
|
|
8350
|
+
return;
|
|
8351
|
+
}
|
|
8157
8352
|
const rowOpts = $xeTable.computeRowOpts;
|
|
8158
|
-
const validTip = $xeTable.$refs.
|
|
8159
|
-
const tooltip = $xeTable.$refs.
|
|
8160
|
-
const bodyHeight =
|
|
8161
|
-
const bodyWidth =
|
|
8162
|
-
const scrollHeight =
|
|
8163
|
-
const scrollWidth =
|
|
8353
|
+
const validTip = $xeTable.$refs.refValidTooltip;
|
|
8354
|
+
const tooltip = $xeTable.$refs.refTooltip;
|
|
8355
|
+
const bodyHeight = yHandleEl.clientHeight;
|
|
8356
|
+
const bodyWidth = xHandleEl.clientWidth;
|
|
8357
|
+
const scrollHeight = yHandleEl.scrollHeight;
|
|
8358
|
+
const scrollWidth = xHandleEl.scrollWidth;
|
|
8164
8359
|
let isTop = false;
|
|
8165
8360
|
let isBottom = false;
|
|
8166
8361
|
let isLeft = false;
|
|
@@ -8231,10 +8426,10 @@ const Methods = {
|
|
|
8231
8426
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
8232
8427
|
$xeTable.clearHoverRow();
|
|
8233
8428
|
}
|
|
8234
|
-
if (validTip && validTip.visible) {
|
|
8429
|
+
if (validTip && validTip.reactData.visible) {
|
|
8235
8430
|
validTip.close();
|
|
8236
8431
|
}
|
|
8237
|
-
if (tooltip && tooltip.visible) {
|
|
8432
|
+
if (tooltip && tooltip.reactData.visible) {
|
|
8238
8433
|
tooltip.close();
|
|
8239
8434
|
}
|
|
8240
8435
|
if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
|
|
@@ -8253,7 +8448,7 @@ const Methods = {
|
|
|
8253
8448
|
const {
|
|
8254
8449
|
visibleSize
|
|
8255
8450
|
} = scrollXStore;
|
|
8256
|
-
const fpsTime = Math.min(80, Math.floor(visibleSize * 3));
|
|
8451
|
+
const fpsTime = Math.max(5, Math.min(80, Math.floor(visibleSize * 3)));
|
|
8257
8452
|
if (lxTimeout) {
|
|
8258
8453
|
clearTimeout(lxTimeout);
|
|
8259
8454
|
}
|
|
@@ -8269,7 +8464,11 @@ const Methods = {
|
|
|
8269
8464
|
},
|
|
8270
8465
|
lazyScrollYData() {
|
|
8271
8466
|
const $xeTable = this;
|
|
8467
|
+
const props = $xeTable;
|
|
8272
8468
|
const internalData = $xeTable;
|
|
8469
|
+
const {
|
|
8470
|
+
showOverflow
|
|
8471
|
+
} = props;
|
|
8273
8472
|
const {
|
|
8274
8473
|
lyTimeout,
|
|
8275
8474
|
lyRunTime,
|
|
@@ -8278,7 +8477,7 @@ const Methods = {
|
|
|
8278
8477
|
const {
|
|
8279
8478
|
visibleSize
|
|
8280
8479
|
} = scrollYStore;
|
|
8281
|
-
const fpsTime = Math.min(80, Math.floor(visibleSize));
|
|
8480
|
+
const fpsTime = showOverflow ? 5 : Math.max(5, Math.min(80, Math.floor(visibleSize / 2)));
|
|
8282
8481
|
if (lyTimeout) {
|
|
8283
8482
|
clearTimeout(lyTimeout);
|
|
8284
8483
|
}
|
|
@@ -8316,35 +8515,285 @@ const Methods = {
|
|
|
8316
8515
|
$xeTable.lazyScrollYData();
|
|
8317
8516
|
}
|
|
8318
8517
|
},
|
|
8319
|
-
|
|
8518
|
+
triggerBodyScrollEvent(evnt, fixedType) {
|
|
8320
8519
|
const $xeTable = this;
|
|
8321
8520
|
const internalData = $xeTable;
|
|
8322
8521
|
const {
|
|
8323
|
-
|
|
8324
|
-
|
|
8522
|
+
elemStore,
|
|
8523
|
+
lastScrollTop,
|
|
8524
|
+
lastScrollLeft,
|
|
8525
|
+
inWheelScroll,
|
|
8526
|
+
inVirtualScroll,
|
|
8527
|
+
inHeaderScroll,
|
|
8325
8528
|
inBodyScroll,
|
|
8326
|
-
|
|
8529
|
+
scrollRenderType,
|
|
8530
|
+
inFooterScroll
|
|
8327
8531
|
} = internalData;
|
|
8328
|
-
|
|
8329
|
-
|
|
8532
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8533
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8534
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
8535
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
8536
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
8537
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
8538
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
8539
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
8540
|
+
return;
|
|
8541
|
+
}
|
|
8542
|
+
if (!bodyScrollElem) {
|
|
8543
|
+
return;
|
|
8544
|
+
}
|
|
8545
|
+
if (!xHandleEl) {
|
|
8546
|
+
return;
|
|
8547
|
+
}
|
|
8548
|
+
if (!yHandleEl) {
|
|
8549
|
+
return;
|
|
8550
|
+
}
|
|
8551
|
+
if (inBodyScroll) {
|
|
8552
|
+
if (scrollRenderType !== fixedType) {
|
|
8330
8553
|
return;
|
|
8331
8554
|
}
|
|
8332
|
-
|
|
8333
|
-
|
|
8555
|
+
}
|
|
8556
|
+
let scrollTop = yHandleEl.scrollTop;
|
|
8557
|
+
let scrollLeft = xHandleEl.scrollLeft;
|
|
8558
|
+
if (leftScrollElem && fixedType === 'left') {
|
|
8559
|
+
scrollTop = leftScrollElem.scrollTop;
|
|
8560
|
+
} else if (rightScrollElem && fixedType === 'right') {
|
|
8561
|
+
scrollTop = rightScrollElem.scrollTop;
|
|
8562
|
+
} else {
|
|
8563
|
+
scrollTop = bodyScrollElem.scrollTop;
|
|
8564
|
+
scrollLeft = bodyScrollElem.scrollLeft;
|
|
8565
|
+
}
|
|
8566
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
8567
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
8568
|
+
internalData.inBodyScroll = true;
|
|
8569
|
+
internalData.scrollRenderType = fixedType;
|
|
8570
|
+
if (isRollY) {
|
|
8571
|
+
if (fixedType === 'left') {
|
|
8572
|
+
(0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
|
|
8573
|
+
(0, _dom.setScrollTop)(rightScrollElem, scrollTop);
|
|
8574
|
+
} else if (fixedType === 'right') {
|
|
8575
|
+
(0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
|
|
8576
|
+
(0, _dom.setScrollTop)(leftScrollElem, scrollTop);
|
|
8577
|
+
} else {
|
|
8578
|
+
(0, _dom.setScrollTop)(leftScrollElem, scrollTop);
|
|
8579
|
+
(0, _dom.setScrollTop)(rightScrollElem, scrollTop);
|
|
8334
8580
|
}
|
|
8581
|
+
(0, _dom.setScrollTop)(yHandleEl, scrollTop);
|
|
8582
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8583
|
+
}
|
|
8584
|
+
if (isRollX) {
|
|
8585
|
+
(0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
|
|
8586
|
+
(0, _dom.setScrollLeft)(headerScrollElem, scrollLeft);
|
|
8587
|
+
(0, _dom.setScrollLeft)(footerScrollElem, scrollLeft);
|
|
8588
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8589
|
+
}
|
|
8590
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8591
|
+
type: 'body',
|
|
8592
|
+
fixed: fixedType
|
|
8593
|
+
});
|
|
8594
|
+
},
|
|
8595
|
+
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
8596
|
+
const $xeTable = this;
|
|
8597
|
+
const internalData = $xeTable;
|
|
8598
|
+
const {
|
|
8599
|
+
elemStore,
|
|
8600
|
+
inWheelScroll,
|
|
8601
|
+
inVirtualScroll,
|
|
8602
|
+
inBodyScroll,
|
|
8603
|
+
inFooterScroll
|
|
8604
|
+
} = internalData;
|
|
8605
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8606
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8607
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
8608
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
8609
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
8610
|
+
if (inWheelScroll) {
|
|
8611
|
+
return;
|
|
8612
|
+
}
|
|
8613
|
+
if (inVirtualScroll) {
|
|
8614
|
+
return;
|
|
8615
|
+
}
|
|
8616
|
+
if (inBodyScroll) {
|
|
8617
|
+
return;
|
|
8618
|
+
}
|
|
8619
|
+
if (inFooterScroll) {
|
|
8620
|
+
return;
|
|
8621
|
+
}
|
|
8622
|
+
if (!headerScrollElem) {
|
|
8623
|
+
return;
|
|
8624
|
+
}
|
|
8625
|
+
if (!xHandleEl) {
|
|
8626
|
+
return;
|
|
8627
|
+
}
|
|
8628
|
+
if (!yHandleEl) {
|
|
8629
|
+
return;
|
|
8630
|
+
}
|
|
8631
|
+
const scrollTop = yHandleEl.scrollTop;
|
|
8632
|
+
const scrollLeft = headerScrollElem.scrollLeft;
|
|
8633
|
+
const isRollX = true;
|
|
8634
|
+
const isRollY = false;
|
|
8635
|
+
internalData.inHeaderScroll = true;
|
|
8636
|
+
(0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
|
|
8637
|
+
(0, _dom.setScrollLeft)(footerScrollElem, scrollLeft);
|
|
8638
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, scrollLeft);
|
|
8639
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8640
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8641
|
+
type: 'header',
|
|
8642
|
+
fixed: fixedType
|
|
8643
|
+
});
|
|
8644
|
+
},
|
|
8645
|
+
triggerFooterScrollEvent(evnt, fixedType) {
|
|
8646
|
+
const $xeTable = this;
|
|
8647
|
+
const internalData = $xeTable;
|
|
8648
|
+
const {
|
|
8649
|
+
elemStore,
|
|
8650
|
+
inWheelScroll,
|
|
8651
|
+
inVirtualScroll,
|
|
8652
|
+
inHeaderScroll,
|
|
8653
|
+
inBodyScroll
|
|
8654
|
+
} = internalData;
|
|
8655
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8656
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8657
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
8658
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
8659
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
8660
|
+
if (inWheelScroll) {
|
|
8661
|
+
return;
|
|
8662
|
+
}
|
|
8663
|
+
if (inVirtualScroll) {
|
|
8664
|
+
return;
|
|
8665
|
+
}
|
|
8666
|
+
if (inHeaderScroll) {
|
|
8667
|
+
return;
|
|
8668
|
+
}
|
|
8669
|
+
if (inBodyScroll) {
|
|
8670
|
+
return;
|
|
8671
|
+
}
|
|
8672
|
+
if (!footerScrollElem) {
|
|
8673
|
+
return;
|
|
8674
|
+
}
|
|
8675
|
+
if (!xHandleEl) {
|
|
8676
|
+
return;
|
|
8677
|
+
}
|
|
8678
|
+
if (!yHandleEl) {
|
|
8679
|
+
return;
|
|
8680
|
+
}
|
|
8681
|
+
const scrollTop = yHandleEl.scrollTop;
|
|
8682
|
+
const scrollLeft = footerScrollElem.scrollLeft;
|
|
8683
|
+
const isRollX = true;
|
|
8684
|
+
const isRollY = false;
|
|
8685
|
+
internalData.inFooterScroll = true;
|
|
8686
|
+
(0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
|
|
8687
|
+
(0, _dom.setScrollLeft)(headerScrollElem, scrollLeft);
|
|
8688
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, scrollLeft);
|
|
8689
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8690
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8691
|
+
type: 'footer',
|
|
8692
|
+
fixed: fixedType
|
|
8693
|
+
});
|
|
8694
|
+
},
|
|
8695
|
+
triggerBodyWheelEvent(evnt) {
|
|
8696
|
+
const $xeTable = this;
|
|
8697
|
+
const tableProps = $xeTable;
|
|
8698
|
+
const reactData = $xeTable;
|
|
8699
|
+
const internalData = $xeTable;
|
|
8700
|
+
const {
|
|
8701
|
+
deltaY,
|
|
8702
|
+
deltaX
|
|
8703
|
+
} = evnt;
|
|
8704
|
+
const {
|
|
8705
|
+
highlightHoverRow
|
|
8706
|
+
} = tableProps;
|
|
8707
|
+
const {
|
|
8708
|
+
elemStore,
|
|
8709
|
+
lastScrollTop,
|
|
8710
|
+
lastScrollLeft
|
|
8711
|
+
} = internalData;
|
|
8712
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
8713
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8714
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8715
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
8716
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
8717
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
8718
|
+
if (!xHandleEl) {
|
|
8719
|
+
return;
|
|
8720
|
+
}
|
|
8721
|
+
if (!yHandleEl) {
|
|
8722
|
+
return;
|
|
8723
|
+
}
|
|
8724
|
+
if (!bodyScrollElem) {
|
|
8725
|
+
return;
|
|
8726
|
+
}
|
|
8727
|
+
let multiple = 1;
|
|
8728
|
+
if (reactData.lastScrollTime + 25 > Date.now()) {
|
|
8729
|
+
multiple = 1.18;
|
|
8730
|
+
} else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
8731
|
+
multiple = 1.15;
|
|
8732
|
+
} else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
8733
|
+
multiple = 1.12;
|
|
8734
|
+
} else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
8735
|
+
multiple = 1.09;
|
|
8736
|
+
} else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
8737
|
+
multiple = 1.06;
|
|
8738
|
+
} else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
8739
|
+
multiple = 1.03;
|
|
8740
|
+
}
|
|
8741
|
+
const deltaTop = deltaY * multiple;
|
|
8742
|
+
const deltaLeft = deltaX * multiple;
|
|
8743
|
+
const isTopWheel = deltaTop < 0;
|
|
8744
|
+
const currScrollTop = yHandleEl.scrollTop;
|
|
8745
|
+
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
8746
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= yHandleEl.scrollHeight - yHandleEl.clientHeight) {
|
|
8747
|
+
return;
|
|
8748
|
+
}
|
|
8749
|
+
const scrollTop = bodyScrollElem.scrollTop + deltaTop;
|
|
8750
|
+
const scrollLeft = bodyScrollElem.scrollLeft + deltaLeft;
|
|
8751
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
8752
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
8753
|
+
// 用于鼠标纵向滚轮处理
|
|
8754
|
+
if (isRollY) {
|
|
8755
|
+
evnt.preventDefault();
|
|
8756
|
+
if (rowOpts.isHover || highlightHoverRow) {
|
|
8757
|
+
$xeTable.clearHoverRow();
|
|
8758
|
+
}
|
|
8759
|
+
internalData.inWheelScroll = true;
|
|
8760
|
+
(0, _dom.setScrollTop)(yHandleEl, scrollTop);
|
|
8761
|
+
(0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
|
|
8762
|
+
(0, _dom.setScrollTop)(leftScrollElem, scrollTop);
|
|
8763
|
+
(0, _dom.setScrollTop)(rightScrollElem, scrollTop);
|
|
8764
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8765
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8766
|
+
type: 'footer',
|
|
8767
|
+
fixed: ''
|
|
8768
|
+
});
|
|
8769
|
+
}
|
|
8770
|
+
},
|
|
8771
|
+
scrollXEvent(evnt) {
|
|
8772
|
+
const $xeTable = this;
|
|
8773
|
+
const internalData = $xeTable;
|
|
8774
|
+
const {
|
|
8775
|
+
elemStore,
|
|
8776
|
+
inWheelScroll,
|
|
8777
|
+
lastScrollTop,
|
|
8778
|
+
inHeaderScroll,
|
|
8779
|
+
inBodyScroll,
|
|
8780
|
+
inFooterScroll
|
|
8781
|
+
} = internalData;
|
|
8782
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8783
|
+
return;
|
|
8784
|
+
}
|
|
8785
|
+
if (inWheelScroll) {
|
|
8786
|
+
return;
|
|
8335
8787
|
}
|
|
8336
|
-
const
|
|
8337
|
-
const
|
|
8338
|
-
const
|
|
8339
|
-
const bodyElem = tableBody.$el;
|
|
8340
|
-
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
8341
|
-
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
8788
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
8789
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
8790
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
8342
8791
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8343
8792
|
const wrapperEl = evnt.currentTarget;
|
|
8344
8793
|
const {
|
|
8345
8794
|
scrollLeft
|
|
8346
8795
|
} = wrapperEl;
|
|
8347
|
-
const yBodyEl = yHandleEl ||
|
|
8796
|
+
const yBodyEl = yHandleEl || bodyScrollElem;
|
|
8348
8797
|
let scrollTop = 0;
|
|
8349
8798
|
if (yBodyEl) {
|
|
8350
8799
|
scrollTop = yBodyEl.scrollTop;
|
|
@@ -8352,9 +8801,9 @@ const Methods = {
|
|
|
8352
8801
|
const isRollX = true;
|
|
8353
8802
|
const isRollY = scrollTop !== lastScrollTop;
|
|
8354
8803
|
internalData.inVirtualScroll = true;
|
|
8355
|
-
(0, _dom.setScrollLeft)(
|
|
8356
|
-
(0, _dom.setScrollLeft)(
|
|
8357
|
-
(0, _dom.setScrollLeft)(
|
|
8804
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, scrollLeft);
|
|
8805
|
+
(0, _dom.setScrollLeft)(headerScrollElem, scrollLeft);
|
|
8806
|
+
(0, _dom.setScrollLeft)(footerScrollElem, scrollLeft);
|
|
8358
8807
|
$xeTable.triggerScrollXEvent(evnt);
|
|
8359
8808
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8360
8809
|
type: 'table',
|
|
@@ -8365,31 +8814,28 @@ const Methods = {
|
|
|
8365
8814
|
const $xeTable = this;
|
|
8366
8815
|
const internalData = $xeTable;
|
|
8367
8816
|
const {
|
|
8368
|
-
|
|
8369
|
-
|
|
8817
|
+
elemStore,
|
|
8818
|
+
inWheelScroll,
|
|
8819
|
+
lastScrollLeft,
|
|
8820
|
+
inHeaderScroll,
|
|
8370
8821
|
inBodyScroll,
|
|
8371
|
-
|
|
8822
|
+
inFooterScroll
|
|
8372
8823
|
} = internalData;
|
|
8373
|
-
if (
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
return;
|
|
8379
|
-
}
|
|
8824
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8825
|
+
return;
|
|
8826
|
+
}
|
|
8827
|
+
if (inWheelScroll) {
|
|
8828
|
+
return;
|
|
8380
8829
|
}
|
|
8381
|
-
const
|
|
8382
|
-
const
|
|
8383
|
-
const
|
|
8384
|
-
const bodyElem = tableBody.$el;
|
|
8385
|
-
const leftElem = leftBody ? leftBody.$el : null;
|
|
8386
|
-
const rightElem = rightBody ? rightBody.$el : null;
|
|
8830
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
8831
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
8832
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
8387
8833
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8388
8834
|
const wrapperEl = evnt.currentTarget;
|
|
8389
8835
|
const {
|
|
8390
8836
|
scrollTop
|
|
8391
8837
|
} = wrapperEl;
|
|
8392
|
-
const xBodyEl = xHandleEl ||
|
|
8838
|
+
const xBodyEl = xHandleEl || bodyScrollElem;
|
|
8393
8839
|
let scrollLeft = 0;
|
|
8394
8840
|
if (xBodyEl) {
|
|
8395
8841
|
scrollLeft = xBodyEl.scrollLeft;
|
|
@@ -8397,52 +8843,26 @@ const Methods = {
|
|
|
8397
8843
|
const isRollX = scrollLeft !== lastScrollLeft;
|
|
8398
8844
|
const isRollY = true;
|
|
8399
8845
|
internalData.inVirtualScroll = true;
|
|
8400
|
-
(0, _dom.setScrollTop)(
|
|
8401
|
-
(0, _dom.setScrollTop)(
|
|
8402
|
-
(0, _dom.setScrollTop)(
|
|
8846
|
+
(0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
|
|
8847
|
+
(0, _dom.setScrollTop)(leftScrollElem, scrollTop);
|
|
8848
|
+
(0, _dom.setScrollTop)(rightScrollElem, scrollTop);
|
|
8403
8849
|
$xeTable.triggerScrollYEvent(evnt);
|
|
8404
8850
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8405
8851
|
type: 'table',
|
|
8406
8852
|
fixed: ''
|
|
8407
8853
|
});
|
|
8408
8854
|
},
|
|
8409
|
-
handleTableColumn() {
|
|
8410
|
-
const {
|
|
8411
|
-
scrollXLoad,
|
|
8412
|
-
visibleColumn,
|
|
8413
|
-
scrollXStore,
|
|
8414
|
-
fullColumnIdData
|
|
8415
|
-
} = this;
|
|
8416
|
-
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
8417
|
-
tableColumn.forEach((column, $index) => {
|
|
8418
|
-
const colid = column.id;
|
|
8419
|
-
const colRest = fullColumnIdData[colid];
|
|
8420
|
-
if (colRest) {
|
|
8421
|
-
colRest.$index = $index;
|
|
8422
|
-
}
|
|
8423
|
-
});
|
|
8424
|
-
this.tableColumn = tableColumn;
|
|
8425
|
-
},
|
|
8426
|
-
handleUpdateColumn() {
|
|
8427
|
-
const $xeTable = this;
|
|
8428
|
-
const internalData = $xeTable;
|
|
8429
|
-
const columnList = _xeUtils.default.orderBy(internalData.collectColumn, 'renderSortNumber');
|
|
8430
|
-
internalData.collectColumn = columnList;
|
|
8431
|
-
const tableFullColumn = getColumnList(columnList);
|
|
8432
|
-
internalData.tableFullColumn = tableFullColumn;
|
|
8433
|
-
cacheColumnMap($xeTable);
|
|
8434
|
-
},
|
|
8435
8855
|
updateScrollXData() {
|
|
8436
8856
|
const $xeTable = this;
|
|
8437
8857
|
const props = $xeTable;
|
|
8438
8858
|
const {
|
|
8439
8859
|
showOverflow
|
|
8440
8860
|
} = props;
|
|
8441
|
-
$xeTable
|
|
8442
|
-
calcCellHeight(
|
|
8861
|
+
handleTableColumn($xeTable);
|
|
8862
|
+
// calcCellHeight()
|
|
8443
8863
|
return $xeTable.$nextTick().then(() => {
|
|
8444
|
-
calcCellHeight(
|
|
8445
|
-
$xeTable
|
|
8864
|
+
// calcCellHeight()
|
|
8865
|
+
handleTableColumn($xeTable);
|
|
8446
8866
|
$xeTable.updateScrollXSpace();
|
|
8447
8867
|
if (!showOverflow) {
|
|
8448
8868
|
$xeTable.updateScrollYSpace();
|
|
@@ -8452,21 +8872,21 @@ const Methods = {
|
|
|
8452
8872
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
8453
8873
|
updateScrollXSpace() {
|
|
8454
8874
|
const $xeTable = this;
|
|
8875
|
+
const reactData = $xeTable;
|
|
8876
|
+
const internalData = $xeTable;
|
|
8455
8877
|
const {
|
|
8456
|
-
$refs,
|
|
8457
8878
|
isGroup,
|
|
8458
|
-
|
|
8879
|
+
scrollXLoad
|
|
8880
|
+
} = reactData;
|
|
8881
|
+
const {
|
|
8459
8882
|
visibleColumn,
|
|
8460
8883
|
scrollXStore,
|
|
8461
|
-
|
|
8462
|
-
tableWidth
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
const
|
|
8466
|
-
|
|
8467
|
-
tableBody,
|
|
8468
|
-
tableFooter
|
|
8469
|
-
} = $refs;
|
|
8884
|
+
elemStore,
|
|
8885
|
+
tableWidth
|
|
8886
|
+
} = internalData;
|
|
8887
|
+
const tableHeader = $xeTable.$refs.refTableHeader;
|
|
8888
|
+
const tableBody = $xeTable.$refs.refTableBody;
|
|
8889
|
+
const tableFooter = $xeTable.$refs.refTableFooter;
|
|
8470
8890
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
8471
8891
|
if (tableBodyElem) {
|
|
8472
8892
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
@@ -8490,25 +8910,27 @@ const Methods = {
|
|
|
8490
8910
|
containerList.forEach(name => {
|
|
8491
8911
|
const layoutList = ['header', 'body', 'footer'];
|
|
8492
8912
|
layoutList.forEach(layout => {
|
|
8493
|
-
const xSpaceElem = elemStore[`${name}-${layout}-xSpace`];
|
|
8913
|
+
const xSpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);
|
|
8494
8914
|
if (xSpaceElem) {
|
|
8495
|
-
xSpaceElem.style.width = scrollXLoad ? `${tableWidth
|
|
8915
|
+
xSpaceElem.style.width = scrollXLoad ? `${tableWidth}px` : '';
|
|
8496
8916
|
}
|
|
8497
8917
|
});
|
|
8498
8918
|
});
|
|
8499
8919
|
const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
|
|
8500
8920
|
if (scrollXSpaceEl) {
|
|
8501
|
-
scrollXSpaceEl.style.width = `${tableWidth
|
|
8921
|
+
scrollXSpaceEl.style.width = `${tableWidth}px`;
|
|
8502
8922
|
}
|
|
8503
|
-
|
|
8923
|
+
$xeTable.$nextTick(() => {
|
|
8924
|
+
updateStyle($xeTable);
|
|
8925
|
+
});
|
|
8504
8926
|
}
|
|
8505
8927
|
},
|
|
8506
8928
|
updateScrollYData() {
|
|
8507
8929
|
const $xeTable = this;
|
|
8508
8930
|
$xeTable.handleTableData();
|
|
8509
|
-
calcCellHeight(
|
|
8931
|
+
// calcCellHeight()
|
|
8510
8932
|
return $xeTable.$nextTick().then(() => {
|
|
8511
|
-
calcCellHeight(
|
|
8933
|
+
// calcCellHeight()
|
|
8512
8934
|
$xeTable.handleTableData();
|
|
8513
8935
|
$xeTable.updateScrollYSpace();
|
|
8514
8936
|
});
|
|
@@ -8516,26 +8938,32 @@ const Methods = {
|
|
|
8516
8938
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8517
8939
|
updateScrollYSpace() {
|
|
8518
8940
|
const $xeTable = this;
|
|
8941
|
+
const props = $xeTable;
|
|
8942
|
+
const reactData = $xeTable;
|
|
8943
|
+
const internalData = $xeTable;
|
|
8944
|
+
const {
|
|
8945
|
+
showOverflow
|
|
8946
|
+
} = props;
|
|
8519
8947
|
const {
|
|
8520
|
-
showOverflow,
|
|
8521
|
-
elemStore,
|
|
8522
|
-
scrollYStore,
|
|
8523
8948
|
scrollYLoad,
|
|
8949
|
+
rowHeight
|
|
8950
|
+
} = reactData;
|
|
8951
|
+
const {
|
|
8952
|
+
scrollYStore,
|
|
8953
|
+
elemStore,
|
|
8524
8954
|
afterFullData,
|
|
8525
8955
|
fullAllDataRowIdData
|
|
8526
|
-
} =
|
|
8956
|
+
} = internalData;
|
|
8527
8957
|
const {
|
|
8528
|
-
startIndex
|
|
8529
|
-
rowHeight
|
|
8958
|
+
startIndex
|
|
8530
8959
|
} = scrollYStore;
|
|
8531
|
-
|
|
8532
|
-
let topSpaceHeight = 0;
|
|
8960
|
+
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
8533
8961
|
const containerList = ['main', 'left', 'right'];
|
|
8534
|
-
let
|
|
8535
|
-
let ySpaceHeight =
|
|
8962
|
+
let topSpaceHeight = 0;
|
|
8963
|
+
let ySpaceHeight = 0;
|
|
8536
8964
|
if (scrollYLoad) {
|
|
8537
8965
|
if (showOverflow) {
|
|
8538
|
-
|
|
8966
|
+
ySpaceHeight = afterFullData.length * rowHeight;
|
|
8539
8967
|
topSpaceHeight = Math.max(0, startIndex * rowHeight);
|
|
8540
8968
|
} else {
|
|
8541
8969
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
@@ -8543,7 +8971,7 @@ const Methods = {
|
|
|
8543
8971
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
8544
8972
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
8545
8973
|
if (rowRest) {
|
|
8546
|
-
|
|
8974
|
+
ySpaceHeight += rowRest.height || rowHeight;
|
|
8547
8975
|
}
|
|
8548
8976
|
}
|
|
8549
8977
|
for (let i = 0; i < startIndex; i++) {
|
|
@@ -8555,27 +8983,31 @@ const Methods = {
|
|
|
8555
8983
|
}
|
|
8556
8984
|
}
|
|
8557
8985
|
}
|
|
8558
|
-
|
|
8559
|
-
|
|
8986
|
+
} else {
|
|
8987
|
+
if (bodyTableElem) {
|
|
8988
|
+
ySpaceHeight = bodyTableElem.clientHeight;
|
|
8989
|
+
}
|
|
8560
8990
|
}
|
|
8561
8991
|
containerList.forEach(name => {
|
|
8562
8992
|
const layoutList = ['header', 'body', 'footer'];
|
|
8563
|
-
const tableElem = elemStore[`${name}-body-table`];
|
|
8993
|
+
const tableElem = (0, _util.getRefElem)(elemStore[`${name}-body-table`]);
|
|
8564
8994
|
if (tableElem) {
|
|
8565
|
-
tableElem.style.marginTop =
|
|
8995
|
+
tableElem.style.marginTop = topSpaceHeight ? `${topSpaceHeight}px` : '';
|
|
8566
8996
|
}
|
|
8567
8997
|
layoutList.forEach(layout => {
|
|
8568
|
-
const ySpaceElem = elemStore[`${name}-${layout}-ySpace`];
|
|
8998
|
+
const ySpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-ySpace`]);
|
|
8569
8999
|
if (ySpaceElem) {
|
|
8570
|
-
ySpaceElem.style.height = ySpaceHeight;
|
|
9000
|
+
ySpaceElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
8571
9001
|
}
|
|
8572
9002
|
});
|
|
8573
9003
|
});
|
|
8574
9004
|
const scrollYSpaceEl = $xeTable.$refs.refScrollYSpaceElem;
|
|
8575
9005
|
if (scrollYSpaceEl) {
|
|
8576
|
-
scrollYSpaceEl.style.height = ySpaceHeight;
|
|
9006
|
+
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
8577
9007
|
}
|
|
8578
|
-
|
|
9008
|
+
$xeTable.$nextTick(() => {
|
|
9009
|
+
updateStyle($xeTable);
|
|
9010
|
+
});
|
|
8579
9011
|
},
|
|
8580
9012
|
updateScrollYStatus() {
|
|
8581
9013
|
const $xeTable = this;
|
|
@@ -8593,17 +9025,17 @@ const Methods = {
|
|
|
8593
9025
|
$refs
|
|
8594
9026
|
} = this;
|
|
8595
9027
|
const {
|
|
8596
|
-
|
|
8597
|
-
|
|
9028
|
+
refTableBody,
|
|
9029
|
+
refTableHeader,
|
|
8598
9030
|
leftBody,
|
|
8599
9031
|
rightBody,
|
|
8600
|
-
|
|
9032
|
+
refTableFooter
|
|
8601
9033
|
} = $refs;
|
|
8602
|
-
const tableBodyElem =
|
|
9034
|
+
const tableBodyElem = refTableBody ? refTableBody.$el : null;
|
|
8603
9035
|
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
8604
9036
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
8605
|
-
const tableHeaderElem =
|
|
8606
|
-
const tableFooterElem =
|
|
9037
|
+
const tableHeaderElem = refTableHeader ? refTableHeader.$el : null;
|
|
9038
|
+
const tableFooterElem = refTableFooter ? refTableFooter.$el : null;
|
|
8607
9039
|
internalData.intoRunScroll = true;
|
|
8608
9040
|
if (_xeUtils.default.isNumber(scrollLeft)) {
|
|
8609
9041
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
@@ -8717,46 +9149,36 @@ const Methods = {
|
|
|
8717
9149
|
const $xeTable = this;
|
|
8718
9150
|
const internalData = $xeTable;
|
|
8719
9151
|
const {
|
|
9152
|
+
elemStore,
|
|
8720
9153
|
scrollXStore,
|
|
8721
9154
|
scrollYStore
|
|
8722
9155
|
} = internalData;
|
|
8723
|
-
const
|
|
8724
|
-
const
|
|
8725
|
-
const
|
|
8726
|
-
const
|
|
8727
|
-
const
|
|
8728
|
-
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
8729
|
-
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
8730
|
-
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
8731
|
-
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
8732
|
-
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
|
9156
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
9157
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
9158
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
9159
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
9160
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
8733
9161
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
8734
|
-
if (xHandleEl) {
|
|
8735
|
-
(0, _dom.setScrollLeft)(xHandleEl, 0);
|
|
8736
|
-
} else {
|
|
8737
|
-
(0, _dom.setScrollLeft)(tableBodyElem, 0);
|
|
8738
|
-
(0, _dom.setScrollLeft)(tableHeaderElem, 0);
|
|
8739
|
-
(0, _dom.setScrollLeft)(tableFooterElem, 0);
|
|
8740
|
-
}
|
|
8741
9162
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
9163
|
+
internalData.intoRunScroll = true;
|
|
9164
|
+
(0, _dom.setScrollLeft)(xHandleEl, 0);
|
|
9165
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, 0);
|
|
9166
|
+
(0, _dom.setScrollLeft)(headerScrollElem, 0);
|
|
9167
|
+
(0, _dom.setScrollLeft)(footerScrollElem, 0);
|
|
9168
|
+
(0, _dom.setScrollTop)(yHandleEl, 0);
|
|
9169
|
+
(0, _dom.setScrollTop)(bodyScrollElem, 0);
|
|
9170
|
+
(0, _dom.setScrollTop)(leftScrollElem, 0);
|
|
9171
|
+
(0, _dom.setScrollTop)(rightScrollElem, 0);
|
|
8749
9172
|
scrollXStore.startIndex = 0;
|
|
9173
|
+
scrollXStore.visibleStartIndex = 0;
|
|
8750
9174
|
scrollXStore.endIndex = scrollXStore.visibleSize;
|
|
9175
|
+
scrollXStore.visibleEndIndex = scrollXStore.visibleSize;
|
|
8751
9176
|
scrollYStore.startIndex = 0;
|
|
9177
|
+
scrollYStore.visibleStartIndex = 0;
|
|
8752
9178
|
scrollYStore.endIndex = scrollYStore.visibleSize;
|
|
9179
|
+
scrollYStore.visibleEndIndex = scrollYStore.visibleSize;
|
|
8753
9180
|
return $xeTable.$nextTick().then(() => {
|
|
8754
|
-
|
|
8755
|
-
(0, _dom.setScrollLeft)(tableHeaderElem, 0);
|
|
8756
|
-
(0, _dom.setScrollLeft)(tableFooterElem, 0);
|
|
8757
|
-
(0, _dom.setScrollTop)(tableBodyElem, 0);
|
|
8758
|
-
(0, _dom.setScrollTop)(leftBodyElem, 0);
|
|
8759
|
-
(0, _dom.setScrollTop)(rightBodyElem, 0);
|
|
9181
|
+
internalData.intoRunScroll = false;
|
|
8760
9182
|
});
|
|
8761
9183
|
},
|
|
8762
9184
|
/**
|
|
@@ -8796,8 +9218,8 @@ const Methods = {
|
|
|
8796
9218
|
editRules,
|
|
8797
9219
|
validStore
|
|
8798
9220
|
} = this;
|
|
8799
|
-
const
|
|
8800
|
-
if (slotParams &&
|
|
9221
|
+
const refTableBody = $refs.refTableBody;
|
|
9222
|
+
if (slotParams && refTableBody && editRules) {
|
|
8801
9223
|
const {
|
|
8802
9224
|
row,
|
|
8803
9225
|
column
|
|
@@ -8839,13 +9261,14 @@ const Methods = {
|
|
|
8839
9261
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
8840
9262
|
*/
|
|
8841
9263
|
setMergeCells(merges) {
|
|
9264
|
+
const $xeTable = this;
|
|
8842
9265
|
if (this.spanMethod) {
|
|
8843
9266
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
8844
9267
|
}
|
|
8845
9268
|
setMerges(this, merges, this.mergeList, this.afterFullData);
|
|
8846
9269
|
return this.$nextTick().then(() => {
|
|
8847
9270
|
this.updateCellAreas();
|
|
8848
|
-
return
|
|
9271
|
+
return updateStyle($xeTable);
|
|
8849
9272
|
});
|
|
8850
9273
|
},
|
|
8851
9274
|
/**
|
|
@@ -8853,13 +9276,14 @@ const Methods = {
|
|
|
8853
9276
|
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
8854
9277
|
*/
|
|
8855
9278
|
removeMergeCells(merges) {
|
|
9279
|
+
const $xeTable = this;
|
|
8856
9280
|
if (this.spanMethod) {
|
|
8857
9281
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
8858
9282
|
}
|
|
8859
9283
|
const rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
|
|
8860
9284
|
return this.$nextTick().then(() => {
|
|
8861
9285
|
this.updateCellAreas();
|
|
8862
|
-
|
|
9286
|
+
updateStyle($xeTable);
|
|
8863
9287
|
return rest;
|
|
8864
9288
|
});
|
|
8865
9289
|
},
|
|
@@ -8873,32 +9297,35 @@ const Methods = {
|
|
|
8873
9297
|
* 清除所有单元格合并
|
|
8874
9298
|
*/
|
|
8875
9299
|
clearMergeCells() {
|
|
9300
|
+
const $xeTable = this;
|
|
8876
9301
|
this.mergeList = [];
|
|
8877
9302
|
return this.$nextTick().then(() => {
|
|
8878
|
-
return
|
|
9303
|
+
return updateStyle($xeTable);
|
|
8879
9304
|
});
|
|
8880
9305
|
},
|
|
8881
9306
|
handleDefaultMergeFooterItems() {
|
|
8882
9307
|
this.setMergeFooterItems(this.mergeFooterItems);
|
|
8883
9308
|
},
|
|
8884
9309
|
setMergeFooterItems(merges) {
|
|
9310
|
+
const $xeTable = this;
|
|
8885
9311
|
if (this.footerSpanMethod) {
|
|
8886
9312
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
8887
9313
|
}
|
|
8888
9314
|
setMerges(this, merges, this.mergeFooterList, null);
|
|
8889
9315
|
return this.$nextTick().then(() => {
|
|
8890
9316
|
this.updateCellAreas();
|
|
8891
|
-
return
|
|
9317
|
+
return updateStyle($xeTable);
|
|
8892
9318
|
});
|
|
8893
9319
|
},
|
|
8894
9320
|
removeMergeFooterItems(merges) {
|
|
9321
|
+
const $xeTable = this;
|
|
8895
9322
|
if (this.footerSpanMethod) {
|
|
8896
9323
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
8897
9324
|
}
|
|
8898
9325
|
const rest = removeMerges(this, merges, this.mergeFooterList, null);
|
|
8899
9326
|
return this.$nextTick().then(() => {
|
|
8900
9327
|
this.updateCellAreas();
|
|
8901
|
-
|
|
9328
|
+
updateStyle($xeTable);
|
|
8902
9329
|
return rest;
|
|
8903
9330
|
});
|
|
8904
9331
|
},
|
|
@@ -8912,9 +9339,10 @@ const Methods = {
|
|
|
8912
9339
|
* 清除所有表尾合并
|
|
8913
9340
|
*/
|
|
8914
9341
|
clearMergeFooterItems() {
|
|
9342
|
+
const $xeTable = this;
|
|
8915
9343
|
this.mergeFooterList = [];
|
|
8916
9344
|
return this.$nextTick().then(() => {
|
|
8917
|
-
return
|
|
9345
|
+
return updateStyle($xeTable);
|
|
8918
9346
|
});
|
|
8919
9347
|
},
|
|
8920
9348
|
updateZindex() {
|