vxe-table 3.12.1-beta.2 → 3.12.1-beta.4
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/locale/lang/ar-EG.js +2 -1
- package/es/locale/lang/de-DE.js +2 -1
- package/es/locale/lang/en-US.js +2 -1
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +2 -1
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +2 -1
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/table/module/edit/mixin.js +5 -5
- package/es/table/src/body.js +4 -3
- package/es/table/src/cell.js +73 -50
- package/es/table/src/header.js +10 -7
- package/es/table/src/methods.js +503 -450
- package/es/table/src/table.js +2 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +704 -597
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +2 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -1
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -1
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +2 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +10 -5
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/body.js +4 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +87 -54
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.js +11 -6
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +585 -526
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +2 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +2 -1
- package/packages/locale/lang/de-DE.ts +2 -1
- package/packages/locale/lang/en-US.ts +2 -1
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +2 -1
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +2 -1
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/edit/mixin.ts +5 -5
- package/packages/table/src/body.ts +4 -2
- package/packages/table/src/cell.ts +78 -46
- package/packages/table/src/header.ts +13 -10
- package/packages/table/src/methods.ts +523 -459
- package/packages/table/src/table.ts +3 -1
- /package/es/{iconfont.1735881990049.ttf → iconfont.1735908447074.ttf} +0 -0
- /package/es/{iconfont.1735881990049.woff → iconfont.1735908447074.woff} +0 -0
- /package/es/{iconfont.1735881990049.woff2 → iconfont.1735908447074.woff2} +0 -0
- /package/lib/{iconfont.1735881990049.ttf → iconfont.1735908447074.ttf} +0 -0
- /package/lib/{iconfont.1735881990049.woff → iconfont.1735908447074.woff} +0 -0
- /package/lib/{iconfont.1735881990049.woff2 → iconfont.1735908447074.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -93,7 +93,126 @@ function handleVirtualXVisible($xeTable) {
|
|
|
93
93
|
}
|
|
94
94
|
return { toVisibleIndex: 0, visibleSize: 6 };
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
/**
|
|
97
|
+
* 更新数据列的 Map
|
|
98
|
+
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
99
|
+
*/
|
|
100
|
+
function cacheColumnMap($xeTable) {
|
|
101
|
+
const props = $xeTable;
|
|
102
|
+
const reactData = $xeTable;
|
|
103
|
+
const internalData = $xeTable;
|
|
104
|
+
const { tableFullColumn, collectColumn } = internalData;
|
|
105
|
+
const fullColumnIdData = internalData.fullColumnIdData = {};
|
|
106
|
+
const fullColumnFieldData = internalData.fullColumnFieldData = {};
|
|
107
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
108
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
109
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
110
|
+
const { isCrossDrag, isSelfToChildDrag } = columnDragOpts;
|
|
111
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
112
|
+
const isGroup = collectColumn.some(hasChildrenList);
|
|
113
|
+
let isAllOverflow = !!props.showOverflow;
|
|
114
|
+
let expandColumn;
|
|
115
|
+
let treeNodeColumn;
|
|
116
|
+
let checkboxColumn;
|
|
117
|
+
let radioColumn;
|
|
118
|
+
let htmlColumn;
|
|
119
|
+
let hasFixed;
|
|
120
|
+
const handleFunc = (column, index, items, path, parentColumn) => {
|
|
121
|
+
const { id: colid, field, fixed, type, treeNode } = column;
|
|
122
|
+
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0 };
|
|
123
|
+
if (field) {
|
|
124
|
+
if (fullColumnFieldData[field]) {
|
|
125
|
+
errLog('vxe.error.colRepet', ['field', field]);
|
|
126
|
+
}
|
|
127
|
+
fullColumnFieldData[field] = rest;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
if (isCrossDrag || isSelfToChildDrag) {
|
|
131
|
+
errLog('vxe.error.emptyProp', ['column.field']);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!hasFixed && fixed) {
|
|
135
|
+
hasFixed = fixed;
|
|
136
|
+
}
|
|
137
|
+
if (!htmlColumn && type === 'html') {
|
|
138
|
+
htmlColumn = column;
|
|
139
|
+
}
|
|
140
|
+
if (treeNode) {
|
|
141
|
+
if (process.env.NODE_ENV === 'development') {
|
|
142
|
+
if (treeNodeColumn) {
|
|
143
|
+
warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (!treeNodeColumn) {
|
|
147
|
+
treeNodeColumn = column;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else if (type === 'expand') {
|
|
151
|
+
if (process.env.NODE_ENV === 'development') {
|
|
152
|
+
if (expandColumn) {
|
|
153
|
+
warnLog('vxe.error.colRepet', ['type', type]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (!expandColumn) {
|
|
157
|
+
expandColumn = column;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (process.env.NODE_ENV === 'development') {
|
|
161
|
+
if (type === 'checkbox') {
|
|
162
|
+
if (checkboxColumn) {
|
|
163
|
+
warnLog('vxe.error.colRepet', ['type', type]);
|
|
164
|
+
}
|
|
165
|
+
if (!checkboxColumn) {
|
|
166
|
+
checkboxColumn = column;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if (type === 'radio') {
|
|
170
|
+
if (radioColumn) {
|
|
171
|
+
warnLog('vxe.error.colRepet', ['type', type]);
|
|
172
|
+
}
|
|
173
|
+
if (!radioColumn) {
|
|
174
|
+
radioColumn = column;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (isAllOverflow && column.showOverflow === false) {
|
|
179
|
+
isAllOverflow = false;
|
|
180
|
+
}
|
|
181
|
+
if (fullColumnIdData[colid]) {
|
|
182
|
+
errLog('vxe.error.colRepet', ['colId', colid]);
|
|
183
|
+
}
|
|
184
|
+
fullColumnIdData[colid] = rest;
|
|
185
|
+
};
|
|
186
|
+
if (isGroup) {
|
|
187
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
|
|
188
|
+
column.level = nodes.length;
|
|
189
|
+
handleFunc(column, index, items, path, parentColumn);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
tableFullColumn.forEach(handleFunc);
|
|
194
|
+
}
|
|
195
|
+
if (process.env.NODE_ENV === 'development') {
|
|
196
|
+
if (expandColumn && mouseOpts.area) {
|
|
197
|
+
errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (process.env.NODE_ENV === 'development') {
|
|
201
|
+
if (htmlColumn) {
|
|
202
|
+
if (!columnOpts.useKey) {
|
|
203
|
+
errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
|
|
204
|
+
}
|
|
205
|
+
if (!rowOpts.useKey) {
|
|
206
|
+
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
reactData.isGroup = isGroup;
|
|
211
|
+
reactData.treeNodeColumn = treeNodeColumn;
|
|
212
|
+
reactData.expandColumn = expandColumn;
|
|
213
|
+
reactData.isAllOverflow = isAllOverflow;
|
|
214
|
+
}
|
|
215
|
+
function computeRowHeight($xeTable) {
|
|
97
216
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
98
217
|
const tableBody = $xeTable.$refs.tableBody;
|
|
99
218
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
@@ -116,7 +235,7 @@ const computeRowHeight = ($xeTable) => {
|
|
|
116
235
|
}
|
|
117
236
|
// 最低支持 18px 行高
|
|
118
237
|
return Math.max(18, rowHeight);
|
|
119
|
-
}
|
|
238
|
+
}
|
|
120
239
|
function handleVirtualYVisible($xeTable) {
|
|
121
240
|
const internalData = $xeTable;
|
|
122
241
|
const { scrollYStore, afterFullData, fullAllDataRowIdData } = internalData;
|
|
@@ -249,16 +368,18 @@ function clearAllSort(_vm) {
|
|
|
249
368
|
column.order = null;
|
|
250
369
|
});
|
|
251
370
|
}
|
|
252
|
-
function calcTableHeight(
|
|
253
|
-
const
|
|
254
|
-
const
|
|
371
|
+
function calcTableHeight($xeTable, key) {
|
|
372
|
+
const props = $xeTable;
|
|
373
|
+
const reactData = $xeTable;
|
|
374
|
+
const { parentHeight } = reactData;
|
|
375
|
+
const val = props[key];
|
|
255
376
|
let num = 0;
|
|
256
377
|
if (val) {
|
|
257
378
|
if (val === '100%' || val === 'auto') {
|
|
258
379
|
num = parentHeight;
|
|
259
380
|
}
|
|
260
381
|
else {
|
|
261
|
-
const excludeHeight =
|
|
382
|
+
const excludeHeight = $xeTable.getExcludeHeight();
|
|
262
383
|
if (isScale(val)) {
|
|
263
384
|
num = Math.floor((XEUtils.toInteger(val) || 1) / 100 * parentHeight);
|
|
264
385
|
}
|
|
@@ -270,6 +391,155 @@ function calcTableHeight(_vm, key) {
|
|
|
270
391
|
}
|
|
271
392
|
return num;
|
|
272
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* 列宽算法,计算单元格列宽,动态分配可用剩余空间
|
|
396
|
+
* 支持 px、%、固定 混合分配
|
|
397
|
+
* 支持动态列表调整分配
|
|
398
|
+
* 支持自动分配偏移量
|
|
399
|
+
* 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
|
|
400
|
+
*/
|
|
401
|
+
function autoCellWidth($xeTable) {
|
|
402
|
+
const props = $xeTable;
|
|
403
|
+
const reactData = $xeTable;
|
|
404
|
+
const internalData = $xeTable;
|
|
405
|
+
const tableHeader = $xeTable.$refs.tableHeader;
|
|
406
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
407
|
+
const tableFooter = $xeTable.$refs.tableFooter;
|
|
408
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
409
|
+
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
410
|
+
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
411
|
+
if (!bodyElem) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
let tableWidth = 0;
|
|
415
|
+
const minCellWidth = 40; // 列宽最少限制 40px
|
|
416
|
+
const bodyWidth = bodyElem.clientWidth - 1;
|
|
417
|
+
let remainWidth = bodyWidth;
|
|
418
|
+
let meanWidth = remainWidth / 100;
|
|
419
|
+
const { fit } = props;
|
|
420
|
+
const { columnStore } = reactData;
|
|
421
|
+
const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore;
|
|
422
|
+
// 最小宽
|
|
423
|
+
pxMinList.forEach((column) => {
|
|
424
|
+
const minWidth = XEUtils.toInteger(column.minWidth);
|
|
425
|
+
tableWidth += minWidth;
|
|
426
|
+
column.renderWidth = minWidth;
|
|
427
|
+
});
|
|
428
|
+
// 最小自适应
|
|
429
|
+
autoMinList.forEach((column) => {
|
|
430
|
+
const scaleWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
431
|
+
tableWidth += scaleWidth;
|
|
432
|
+
column.renderWidth = scaleWidth;
|
|
433
|
+
});
|
|
434
|
+
// 最小百分比
|
|
435
|
+
scaleMinList.forEach((column) => {
|
|
436
|
+
const scaleWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
437
|
+
tableWidth += scaleWidth;
|
|
438
|
+
column.renderWidth = scaleWidth;
|
|
439
|
+
});
|
|
440
|
+
// 固定百分比
|
|
441
|
+
scaleList.forEach((column) => {
|
|
442
|
+
const scaleWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
443
|
+
tableWidth += scaleWidth;
|
|
444
|
+
column.renderWidth = scaleWidth;
|
|
445
|
+
});
|
|
446
|
+
// 固定宽
|
|
447
|
+
pxList.forEach((column) => {
|
|
448
|
+
const width = XEUtils.toInteger(column.width);
|
|
449
|
+
tableWidth += width;
|
|
450
|
+
column.renderWidth = width;
|
|
451
|
+
});
|
|
452
|
+
// 自适应宽
|
|
453
|
+
autoList.forEach((column) => {
|
|
454
|
+
const width = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
455
|
+
tableWidth += width;
|
|
456
|
+
column.renderWidth = width;
|
|
457
|
+
});
|
|
458
|
+
// 调整了列宽
|
|
459
|
+
resizeList.forEach((column) => {
|
|
460
|
+
const width = XEUtils.toInteger(column.resizeWidth);
|
|
461
|
+
tableWidth += width;
|
|
462
|
+
column.renderWidth = width;
|
|
463
|
+
});
|
|
464
|
+
remainWidth -= tableWidth;
|
|
465
|
+
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
|
|
466
|
+
if (fit) {
|
|
467
|
+
if (remainWidth > 0) {
|
|
468
|
+
scaleMinList.concat(pxMinList).concat(autoMinList).forEach((column) => {
|
|
469
|
+
tableWidth += meanWidth;
|
|
470
|
+
column.renderWidth += meanWidth;
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
meanWidth = minCellWidth;
|
|
476
|
+
}
|
|
477
|
+
// 剩余均分
|
|
478
|
+
remainList.forEach((column) => {
|
|
479
|
+
const width = Math.max(meanWidth, minCellWidth);
|
|
480
|
+
column.renderWidth = width;
|
|
481
|
+
tableWidth += width;
|
|
482
|
+
});
|
|
483
|
+
if (fit) {
|
|
484
|
+
/**
|
|
485
|
+
* 偏移量算法
|
|
486
|
+
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
487
|
+
*/
|
|
488
|
+
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
489
|
+
let dynamicSize = dynamicList.length - 1;
|
|
490
|
+
if (dynamicSize > 0) {
|
|
491
|
+
let odiffer = bodyWidth - tableWidth;
|
|
492
|
+
if (odiffer > 0) {
|
|
493
|
+
while (odiffer > 0 && dynamicSize >= 0) {
|
|
494
|
+
odiffer--;
|
|
495
|
+
dynamicList[dynamicSize--].renderWidth++;
|
|
496
|
+
}
|
|
497
|
+
tableWidth = bodyWidth;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const tableHeight = bodyElem.offsetHeight;
|
|
502
|
+
const overflowY = bodyElem.scrollHeight > bodyElem.clientHeight;
|
|
503
|
+
let scrollbarWidth = 0;
|
|
504
|
+
if (overflowY) {
|
|
505
|
+
scrollbarWidth = Math.max(bodyElem.offsetWidth - bodyElem.clientWidth, 0);
|
|
506
|
+
}
|
|
507
|
+
reactData.scrollbarWidth = scrollbarWidth;
|
|
508
|
+
reactData.overflowY = overflowY;
|
|
509
|
+
internalData.tableWidth = tableWidth;
|
|
510
|
+
internalData.tableHeight = tableHeight;
|
|
511
|
+
let headerHeight = 0;
|
|
512
|
+
if (headerElem) {
|
|
513
|
+
headerHeight = headerElem.clientHeight;
|
|
514
|
+
$xeTable.$nextTick(() => {
|
|
515
|
+
// 检测是否同步滚动
|
|
516
|
+
if (headerElem && bodyElem && headerElem.scrollLeft !== bodyElem.scrollLeft) {
|
|
517
|
+
headerElem.scrollLeft = bodyElem.scrollLeft;
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
internalData.headerHeight = headerHeight;
|
|
522
|
+
let overflowX = false;
|
|
523
|
+
let footerHeight = 0;
|
|
524
|
+
let scrollbarHeight = 0;
|
|
525
|
+
if (footerElem) {
|
|
526
|
+
footerHeight = footerElem.offsetHeight;
|
|
527
|
+
overflowX = tableWidth > footerElem.clientWidth;
|
|
528
|
+
scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
overflowX = tableWidth > bodyWidth;
|
|
532
|
+
scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0);
|
|
533
|
+
}
|
|
534
|
+
internalData.footerHeight = footerHeight;
|
|
535
|
+
reactData.overflowX = overflowX;
|
|
536
|
+
reactData.scrollbarHeight = scrollbarHeight;
|
|
537
|
+
updateHeight($xeTable);
|
|
538
|
+
reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
|
|
539
|
+
if (overflowX) {
|
|
540
|
+
$xeTable.checkScrolling();
|
|
541
|
+
}
|
|
542
|
+
}
|
|
273
543
|
// const updateCellOffset = ($xeTable: VxeTableConstructor) => {
|
|
274
544
|
// const internalData = $xeTable as unknown as TableInternalData
|
|
275
545
|
// const { chTimeout, chRunTime } = internalData
|
|
@@ -380,7 +650,7 @@ function updateRowDropOrigin($xeTable, row) {
|
|
|
380
650
|
});
|
|
381
651
|
}
|
|
382
652
|
}
|
|
383
|
-
|
|
653
|
+
function updateRowDropTipContent($xeTable, tdEl) {
|
|
384
654
|
const reactData = $xeTable;
|
|
385
655
|
const props = $xeTable;
|
|
386
656
|
const { dragConfig } = props;
|
|
@@ -398,8 +668,8 @@ const updateRowDropTipContent = ($xeTable, tdEl) => {
|
|
|
398
668
|
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
399
669
|
}
|
|
400
670
|
reactData.dragTipText = tipContent;
|
|
401
|
-
}
|
|
402
|
-
|
|
671
|
+
}
|
|
672
|
+
function updateColDropOrigin($xeTable, column) {
|
|
403
673
|
const el = $xeTable.$el;
|
|
404
674
|
if (el) {
|
|
405
675
|
const colQuerys = [];
|
|
@@ -411,8 +681,8 @@ const updateColDropOrigin = ($xeTable, column) => {
|
|
|
411
681
|
addClass(elem, clss);
|
|
412
682
|
});
|
|
413
683
|
}
|
|
414
|
-
}
|
|
415
|
-
|
|
684
|
+
}
|
|
685
|
+
function clearColDropOrigin($xeTable) {
|
|
416
686
|
const el = $xeTable.$el;
|
|
417
687
|
if (el) {
|
|
418
688
|
const clss = 'col--drag-origin';
|
|
@@ -421,8 +691,8 @@ const clearColDropOrigin = ($xeTable) => {
|
|
|
421
691
|
removeClass(elem, clss);
|
|
422
692
|
});
|
|
423
693
|
}
|
|
424
|
-
}
|
|
425
|
-
|
|
694
|
+
}
|
|
695
|
+
function updateColDropTipContent($xeTable, tdEl) {
|
|
426
696
|
const reactData = $xeTable;
|
|
427
697
|
const { dragCol } = reactData;
|
|
428
698
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
@@ -437,7 +707,7 @@ const updateColDropTipContent = ($xeTable, tdEl) => {
|
|
|
437
707
|
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
438
708
|
}
|
|
439
709
|
reactData.dragTipText = tipContent;
|
|
440
|
-
}
|
|
710
|
+
}
|
|
441
711
|
function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
442
712
|
const reactData = $xeTable;
|
|
443
713
|
const internalData = $xeTable;
|
|
@@ -519,7 +789,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
519
789
|
rdTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled');
|
|
520
790
|
}
|
|
521
791
|
}
|
|
522
|
-
|
|
792
|
+
function hideDropTip($xeTable) {
|
|
523
793
|
const rdTipEl = $xeTable.$refs.refDragTipElem;
|
|
524
794
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem;
|
|
525
795
|
const cdLineEl = $xeTable.$refs.refDragColLineElem;
|
|
@@ -532,8 +802,8 @@ const hideDropTip = ($xeTable) => {
|
|
|
532
802
|
if (cdLineEl) {
|
|
533
803
|
cdLineEl.style.display = '';
|
|
534
804
|
}
|
|
535
|
-
}
|
|
536
|
-
|
|
805
|
+
}
|
|
806
|
+
function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
|
|
537
807
|
const internalData = $xeTable;
|
|
538
808
|
const { fullColumnIdData } = internalData;
|
|
539
809
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
@@ -541,7 +811,53 @@ const handleScrollToRowColumn = ($xeTable, fieldOrColumn, row) => {
|
|
|
541
811
|
return colToVisible($xeTable, column, row);
|
|
542
812
|
}
|
|
543
813
|
return $xeTable.$nextTick();
|
|
544
|
-
}
|
|
814
|
+
}
|
|
815
|
+
// 计算可视渲染相关数据
|
|
816
|
+
function computeScrollLoad($xeTable) {
|
|
817
|
+
const reactData = $xeTable;
|
|
818
|
+
const internalData = $xeTable;
|
|
819
|
+
return $xeTable.$nextTick().then(() => {
|
|
820
|
+
const { scrollXLoad, scrollYLoad } = reactData;
|
|
821
|
+
const { scrollXStore, scrollYStore } = internalData;
|
|
822
|
+
const sYOpts = $xeTable.computeSYOpts;
|
|
823
|
+
const sXOpts = $xeTable.computeSXOpts;
|
|
824
|
+
// 计算 X 逻辑
|
|
825
|
+
if (scrollXLoad) {
|
|
826
|
+
const { visibleSize: visibleXSize } = handleVirtualXVisible($xeTable);
|
|
827
|
+
const offsetXSize = Math.max(0, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : (browse.edge ? 5 : 0));
|
|
828
|
+
scrollXStore.offsetSize = offsetXSize;
|
|
829
|
+
scrollXStore.visibleSize = visibleXSize;
|
|
830
|
+
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
831
|
+
$xeTable.updateScrollXData().then(() => {
|
|
832
|
+
loadScrollXData($xeTable);
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
$xeTable.updateScrollXSpace();
|
|
837
|
+
}
|
|
838
|
+
calcCellHeight($xeTable);
|
|
839
|
+
// 计算 Y 逻辑
|
|
840
|
+
const rowHeight = computeRowHeight($xeTable);
|
|
841
|
+
scrollYStore.rowHeight = rowHeight;
|
|
842
|
+
reactData.rowHeight = rowHeight;
|
|
843
|
+
const { visibleSize: visibleYSize } = handleVirtualYVisible($xeTable);
|
|
844
|
+
if (scrollYLoad) {
|
|
845
|
+
const offsetYSize = Math.max(0, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0));
|
|
846
|
+
scrollYStore.offsetSize = offsetYSize;
|
|
847
|
+
scrollYStore.visibleSize = visibleYSize;
|
|
848
|
+
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
849
|
+
$xeTable.updateScrollYData().then(() => {
|
|
850
|
+
loadScrollYData($xeTable);
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
$xeTable.updateScrollYSpace();
|
|
855
|
+
}
|
|
856
|
+
$xeTable.$nextTick(() => {
|
|
857
|
+
$xeTable.updateStyle();
|
|
858
|
+
});
|
|
859
|
+
});
|
|
860
|
+
}
|
|
545
861
|
function handleRecalculateLayout($xeTable, reFull) {
|
|
546
862
|
const internalData = $xeTable;
|
|
547
863
|
const el = $xeTable.$refs.refElem;
|
|
@@ -549,18 +865,67 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
549
865
|
if (!el || !el.clientWidth) {
|
|
550
866
|
return $xeTable.$nextTick();
|
|
551
867
|
}
|
|
552
|
-
$xeTable
|
|
553
|
-
$xeTable
|
|
554
|
-
return $xeTable
|
|
868
|
+
calcCellWidth($xeTable);
|
|
869
|
+
autoCellWidth($xeTable);
|
|
870
|
+
return computeScrollLoad($xeTable).then(() => {
|
|
555
871
|
if (reFull === true) {
|
|
556
872
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
557
873
|
calcCellHeight($xeTable);
|
|
558
|
-
$xeTable
|
|
559
|
-
$xeTable
|
|
560
|
-
return $xeTable
|
|
874
|
+
calcCellWidth($xeTable);
|
|
875
|
+
autoCellWidth($xeTable);
|
|
876
|
+
return computeScrollLoad($xeTable);
|
|
561
877
|
}
|
|
562
878
|
});
|
|
563
879
|
}
|
|
880
|
+
function loadScrollXData($xeTable) {
|
|
881
|
+
const reactData = $xeTable;
|
|
882
|
+
const internalData = $xeTable;
|
|
883
|
+
const { mergeList, mergeFooterList } = reactData;
|
|
884
|
+
const { scrollXStore } = internalData;
|
|
885
|
+
const { startIndex, endIndex, offsetSize } = scrollXStore;
|
|
886
|
+
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable);
|
|
887
|
+
const offsetItem = {
|
|
888
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
889
|
+
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
890
|
+
};
|
|
891
|
+
calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
|
|
892
|
+
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
893
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
894
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
895
|
+
scrollXStore.startIndex = offsetStartIndex;
|
|
896
|
+
scrollXStore.endIndex = offsetEndIndex;
|
|
897
|
+
$xeTable.updateScrollXData();
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
$xeTable.closeTooltip();
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* 纵向 Y 可视渲染处理
|
|
904
|
+
*/
|
|
905
|
+
function loadScrollYData($xeTable) {
|
|
906
|
+
const props = $xeTable;
|
|
907
|
+
const reactData = $xeTable;
|
|
908
|
+
const internalData = $xeTable;
|
|
909
|
+
const { showOverflow } = props;
|
|
910
|
+
const { mergeList } = reactData;
|
|
911
|
+
const { tableHeight, scrollYStore } = internalData;
|
|
912
|
+
const { startIndex, endIndex, offsetSize } = scrollYStore;
|
|
913
|
+
const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
|
|
914
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
|
|
915
|
+
const offsetItem = {
|
|
916
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
|
|
917
|
+
endIndex: toVisibleIndex + visibleSize + offsetYSize
|
|
918
|
+
};
|
|
919
|
+
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
920
|
+
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
921
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
922
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
923
|
+
scrollYStore.startIndex = offsetStartIndex;
|
|
924
|
+
scrollYStore.endIndex = offsetEndIndex;
|
|
925
|
+
$xeTable.updateScrollYData();
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
564
929
|
function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
565
930
|
const reactData = $xeTable;
|
|
566
931
|
const internalData = $xeTable;
|
|
@@ -577,17 +942,76 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
577
942
|
internalData.inFooterScroll = false;
|
|
578
943
|
if (isRollX && scrollXLoad) {
|
|
579
944
|
$xeTable.updateScrollXData().then(() => {
|
|
580
|
-
$xeTable
|
|
945
|
+
loadScrollXData($xeTable);
|
|
581
946
|
});
|
|
582
947
|
}
|
|
583
948
|
if (isRollY && scrollYLoad) {
|
|
584
949
|
$xeTable.updateScrollYData().then(() => {
|
|
585
|
-
$xeTable
|
|
950
|
+
loadScrollYData($xeTable);
|
|
586
951
|
});
|
|
587
952
|
}
|
|
588
953
|
$xeTable.updateCellAreas();
|
|
589
954
|
}, 200);
|
|
590
955
|
}
|
|
956
|
+
function updateHeight($xeTable) {
|
|
957
|
+
const internalData = $xeTable;
|
|
958
|
+
internalData.customHeight = calcTableHeight($xeTable, 'height');
|
|
959
|
+
internalData.customMinHeight = calcTableHeight($xeTable, 'minHeight');
|
|
960
|
+
internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
|
|
961
|
+
}
|
|
962
|
+
function calcColumnAutoWidth(column, wrapperEl) {
|
|
963
|
+
const cellElList = wrapperEl.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
|
|
964
|
+
const firstCellEl = cellElList[0];
|
|
965
|
+
let paddingSize = 0;
|
|
966
|
+
if (firstCellEl) {
|
|
967
|
+
const cellStyle = getComputedStyle(firstCellEl);
|
|
968
|
+
paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2;
|
|
969
|
+
}
|
|
970
|
+
let colWidth = column.renderAutoWidth - paddingSize;
|
|
971
|
+
XEUtils.arrayEach(cellElList, (itemEl) => {
|
|
972
|
+
const cellEl = itemEl;
|
|
973
|
+
const thElem = cellEl.parentElement;
|
|
974
|
+
let titleWidth = 0;
|
|
975
|
+
if (`${thElem.tagName}`.toLowerCase() === 'th') {
|
|
976
|
+
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
977
|
+
titleWidth += btnEl.offsetWidth + 1;
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
const labelEl = cellEl.firstElementChild;
|
|
982
|
+
if (labelEl) {
|
|
983
|
+
titleWidth = labelEl.offsetWidth;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
if (titleWidth) {
|
|
987
|
+
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
return colWidth + paddingSize;
|
|
991
|
+
}
|
|
992
|
+
function calcCellWidth($xeTable) {
|
|
993
|
+
const reactData = $xeTable;
|
|
994
|
+
const internalData = $xeTable;
|
|
995
|
+
const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
|
|
996
|
+
reactData.isCalcColumn = true;
|
|
997
|
+
return $xeTable.$nextTick().then(() => {
|
|
998
|
+
const { fullColumnIdData } = internalData;
|
|
999
|
+
const el = $xeTable.$refs.refElem;
|
|
1000
|
+
if (el) {
|
|
1001
|
+
autoWidthColumnList.forEach(column => {
|
|
1002
|
+
const colid = column.id;
|
|
1003
|
+
const colRest = fullColumnIdData[colid];
|
|
1004
|
+
const colWidth = calcColumnAutoWidth(column, el);
|
|
1005
|
+
if (colRest) {
|
|
1006
|
+
colRest.width = Math.max(colWidth, colRest.width);
|
|
1007
|
+
}
|
|
1008
|
+
column.renderAutoWidth = colWidth;
|
|
1009
|
+
});
|
|
1010
|
+
$xeTable.analyColumnWidth();
|
|
1011
|
+
}
|
|
1012
|
+
reactData.isCalcColumn = false;
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
591
1015
|
const Methods = {
|
|
592
1016
|
callSlot(slotFunc, params, h, vNodes) {
|
|
593
1017
|
if (slotFunc) {
|
|
@@ -797,10 +1221,10 @@ const Methods = {
|
|
|
797
1221
|
this.handleTableData(true);
|
|
798
1222
|
this.updateFooter();
|
|
799
1223
|
return this.$nextTick().then(() => {
|
|
800
|
-
|
|
1224
|
+
updateHeight($xeTable);
|
|
801
1225
|
this.updateStyle();
|
|
802
1226
|
}).then(() => {
|
|
803
|
-
|
|
1227
|
+
computeScrollLoad($xeTable);
|
|
804
1228
|
}).then(() => {
|
|
805
1229
|
// 是否启用了虚拟滚动
|
|
806
1230
|
if (sYLoad) {
|
|
@@ -945,10 +1369,10 @@ const Methods = {
|
|
|
945
1369
|
this.initColumnSort();
|
|
946
1370
|
return Promise.resolve(this.restoreCustomStorage()).then(() => {
|
|
947
1371
|
this._isLoading = false;
|
|
948
|
-
|
|
1372
|
+
cacheColumnMap($xeTable);
|
|
949
1373
|
this.parseColumns(true).then(() => {
|
|
950
1374
|
if (this.scrollXLoad) {
|
|
951
|
-
|
|
1375
|
+
loadScrollXData($xeTable);
|
|
952
1376
|
}
|
|
953
1377
|
});
|
|
954
1378
|
this.clearMergeCells();
|
|
@@ -998,7 +1422,7 @@ const Methods = {
|
|
|
998
1422
|
}
|
|
999
1423
|
let cacheItem = fullAllDataRowIdData[rowid];
|
|
1000
1424
|
if (!cacheItem) {
|
|
1001
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0 };
|
|
1425
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0, oTop: 0 };
|
|
1002
1426
|
}
|
|
1003
1427
|
cacheItem.row = row;
|
|
1004
1428
|
cacheItem.items = items;
|
|
@@ -1072,7 +1496,7 @@ const Methods = {
|
|
|
1072
1496
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
1073
1497
|
const rowid = getRowid($xeTable, childRow);
|
|
1074
1498
|
const parentRow = parentItem || parentRest.row;
|
|
1075
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0 };
|
|
1499
|
+
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 };
|
|
1076
1500
|
fullDataRowIdData[rowid] = rest;
|
|
1077
1501
|
fullAllDataRowIdData[rowid] = rest;
|
|
1078
1502
|
}, { children: childrenField });
|
|
@@ -1084,126 +1508,6 @@ const Methods = {
|
|
|
1084
1508
|
return rows;
|
|
1085
1509
|
});
|
|
1086
1510
|
},
|
|
1087
|
-
/**
|
|
1088
|
-
* 更新数据列的 Map
|
|
1089
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
1090
|
-
*/
|
|
1091
|
-
cacheColumnMap() {
|
|
1092
|
-
const $xeTable = this;
|
|
1093
|
-
const props = $xeTable;
|
|
1094
|
-
const reactData = $xeTable;
|
|
1095
|
-
const internalData = $xeTable;
|
|
1096
|
-
const { tableFullColumn, collectColumn } = internalData;
|
|
1097
|
-
const fullColumnIdData = internalData.fullColumnIdData = {};
|
|
1098
|
-
const fullColumnFieldData = internalData.fullColumnFieldData = {};
|
|
1099
|
-
const mouseOpts = $xeTable.computeMouseOpts;
|
|
1100
|
-
const columnOpts = $xeTable.computeColumnOpts;
|
|
1101
|
-
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
1102
|
-
const { isCrossDrag, isSelfToChildDrag } = columnDragOpts;
|
|
1103
|
-
const rowOpts = $xeTable.computeRowOpts;
|
|
1104
|
-
const isGroup = collectColumn.some(hasChildrenList);
|
|
1105
|
-
let isAllOverflow = !!props.showOverflow;
|
|
1106
|
-
let expandColumn;
|
|
1107
|
-
let treeNodeColumn;
|
|
1108
|
-
let checkboxColumn;
|
|
1109
|
-
let radioColumn;
|
|
1110
|
-
let htmlColumn;
|
|
1111
|
-
let hasFixed;
|
|
1112
|
-
const handleFunc = (column, index, items, path, parentColumn) => {
|
|
1113
|
-
const { id: colid, field, fixed, type, treeNode } = column;
|
|
1114
|
-
const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0 };
|
|
1115
|
-
if (field) {
|
|
1116
|
-
if (fullColumnFieldData[field]) {
|
|
1117
|
-
errLog('vxe.error.colRepet', ['field', field]);
|
|
1118
|
-
}
|
|
1119
|
-
fullColumnFieldData[field] = rest;
|
|
1120
|
-
}
|
|
1121
|
-
else {
|
|
1122
|
-
if (isCrossDrag || isSelfToChildDrag) {
|
|
1123
|
-
errLog('vxe.error.emptyProp', ['column.field']);
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
if (!hasFixed && fixed) {
|
|
1127
|
-
hasFixed = fixed;
|
|
1128
|
-
}
|
|
1129
|
-
if (!htmlColumn && type === 'html') {
|
|
1130
|
-
htmlColumn = column;
|
|
1131
|
-
}
|
|
1132
|
-
if (treeNode) {
|
|
1133
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1134
|
-
if (treeNodeColumn) {
|
|
1135
|
-
warnLog('vxe.error.colRepet', ['tree-node', treeNode]);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
if (!treeNodeColumn) {
|
|
1139
|
-
treeNodeColumn = column;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
else if (type === 'expand') {
|
|
1143
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1144
|
-
if (expandColumn) {
|
|
1145
|
-
warnLog('vxe.error.colRepet', ['type', type]);
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
if (!expandColumn) {
|
|
1149
|
-
expandColumn = column;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1153
|
-
if (type === 'checkbox') {
|
|
1154
|
-
if (checkboxColumn) {
|
|
1155
|
-
warnLog('vxe.error.colRepet', ['type', type]);
|
|
1156
|
-
}
|
|
1157
|
-
if (!checkboxColumn) {
|
|
1158
|
-
checkboxColumn = column;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
else if (type === 'radio') {
|
|
1162
|
-
if (radioColumn) {
|
|
1163
|
-
warnLog('vxe.error.colRepet', ['type', type]);
|
|
1164
|
-
}
|
|
1165
|
-
if (!radioColumn) {
|
|
1166
|
-
radioColumn = column;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
if (isAllOverflow && column.showOverflow === false) {
|
|
1171
|
-
isAllOverflow = false;
|
|
1172
|
-
}
|
|
1173
|
-
if (fullColumnIdData[colid]) {
|
|
1174
|
-
errLog('vxe.error.colRepet', ['colId', colid]);
|
|
1175
|
-
}
|
|
1176
|
-
fullColumnIdData[colid] = rest;
|
|
1177
|
-
};
|
|
1178
|
-
if (isGroup) {
|
|
1179
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
|
|
1180
|
-
column.level = nodes.length;
|
|
1181
|
-
handleFunc(column, index, items, path, parentColumn);
|
|
1182
|
-
});
|
|
1183
|
-
}
|
|
1184
|
-
else {
|
|
1185
|
-
tableFullColumn.forEach(handleFunc);
|
|
1186
|
-
}
|
|
1187
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1188
|
-
if (expandColumn && mouseOpts.area) {
|
|
1189
|
-
errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1193
|
-
if (htmlColumn) {
|
|
1194
|
-
if (!columnOpts.useKey) {
|
|
1195
|
-
errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
|
|
1196
|
-
}
|
|
1197
|
-
if (!rowOpts.useKey) {
|
|
1198
|
-
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
reactData.isGroup = isGroup;
|
|
1203
|
-
reactData.treeNodeColumn = treeNodeColumn;
|
|
1204
|
-
reactData.expandColumn = expandColumn;
|
|
1205
|
-
reactData.isAllOverflow = isAllOverflow;
|
|
1206
|
-
},
|
|
1207
1511
|
/**
|
|
1208
1512
|
* 根据 tr 元素获取对应的 row 信息
|
|
1209
1513
|
* @param {Element} tr 元素
|
|
@@ -1936,7 +2240,7 @@ const Methods = {
|
|
|
1936
2240
|
rowRest._index = index;
|
|
1937
2241
|
}
|
|
1938
2242
|
else {
|
|
1939
|
-
const rest = { row, rowid, seq: '-1', index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0 };
|
|
2243
|
+
const rest = { row, rowid, seq: '-1', index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
1940
2244
|
fullAllDataRowIdData[rowid] = rest;
|
|
1941
2245
|
fullDataRowIdData[rowid] = rest;
|
|
1942
2246
|
}
|
|
@@ -1967,7 +2271,7 @@ const Methods = {
|
|
|
1967
2271
|
rowRest._index = index;
|
|
1968
2272
|
}
|
|
1969
2273
|
else {
|
|
1970
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0 };
|
|
2274
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
1971
2275
|
fullAllDataRowIdData[rowid] = rest;
|
|
1972
2276
|
fullDataRowIdData[rowid] = rest;
|
|
1973
2277
|
}
|
|
@@ -1985,7 +2289,7 @@ const Methods = {
|
|
|
1985
2289
|
rowRest._index = index;
|
|
1986
2290
|
}
|
|
1987
2291
|
else {
|
|
1988
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0 };
|
|
2292
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
1989
2293
|
fullAllDataRowIdData[rowid] = rest;
|
|
1990
2294
|
fullDataRowIdData[rowid] = rest;
|
|
1991
2295
|
}
|
|
@@ -2694,6 +2998,34 @@ const Methods = {
|
|
|
2694
2998
|
});
|
|
2695
2999
|
Object.assign(this.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList });
|
|
2696
3000
|
},
|
|
3001
|
+
handleResizeDblclickEvent(evnt, params) {
|
|
3002
|
+
const $xeTable = this;
|
|
3003
|
+
const reactData = $xeTable;
|
|
3004
|
+
const internalData = $xeTable;
|
|
3005
|
+
const resizableOpts = $xeTable.computeResizableOpts;
|
|
3006
|
+
const { isDblclickAutoWidth } = resizableOpts;
|
|
3007
|
+
const el = $xeTable.$refs.refElem;
|
|
3008
|
+
if (isDblclickAutoWidth && el) {
|
|
3009
|
+
const { fullColumnIdData } = internalData;
|
|
3010
|
+
const { column } = params;
|
|
3011
|
+
const colid = column.id;
|
|
3012
|
+
const colRest = fullColumnIdData[colid];
|
|
3013
|
+
let resizeWidth = calcColumnAutoWidth(column, el);
|
|
3014
|
+
if (colRest) {
|
|
3015
|
+
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
3016
|
+
}
|
|
3017
|
+
column.resizeWidth = resizeWidth;
|
|
3018
|
+
reactData._isResize = false;
|
|
3019
|
+
internalData._lastResizeTime = Date.now();
|
|
3020
|
+
$xeTable.analyColumnWidth();
|
|
3021
|
+
$xeTable.recalculate(true).then(() => {
|
|
3022
|
+
$xeTable.saveCustomStore('update:visible');
|
|
3023
|
+
$xeTable.updateCellAreas();
|
|
3024
|
+
$xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
|
|
3025
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
2697
3029
|
/**
|
|
2698
3030
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
2699
3031
|
*/
|
|
@@ -2735,7 +3067,7 @@ const Methods = {
|
|
|
2735
3067
|
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
2736
3068
|
const el = $xeTable.$refs.refElem;
|
|
2737
3069
|
if (el && el.clientWidth) {
|
|
2738
|
-
$xeTable
|
|
3070
|
+
autoCellWidth($xeTable);
|
|
2739
3071
|
}
|
|
2740
3072
|
if (rceTimeout) {
|
|
2741
3073
|
clearTimeout(rceTimeout);
|
|
@@ -2757,198 +3089,6 @@ const Methods = {
|
|
|
2757
3089
|
}, refreshDelay);
|
|
2758
3090
|
});
|
|
2759
3091
|
},
|
|
2760
|
-
calcCellWidth() {
|
|
2761
|
-
const $xeTable = this;
|
|
2762
|
-
const { autoWidthColumnList } = this;
|
|
2763
|
-
this.isCalcColumn = true;
|
|
2764
|
-
return this.$nextTick().then(() => {
|
|
2765
|
-
const internalData = $xeTable;
|
|
2766
|
-
const { fullColumnIdData } = internalData;
|
|
2767
|
-
const el = this.$el;
|
|
2768
|
-
if (el) {
|
|
2769
|
-
autoWidthColumnList.forEach((column) => {
|
|
2770
|
-
const colid = column.id;
|
|
2771
|
-
const colRest = fullColumnIdData[colid];
|
|
2772
|
-
const cellElList = el.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
|
|
2773
|
-
const firstCellEl = cellElList[0];
|
|
2774
|
-
let paddingSize = 0;
|
|
2775
|
-
if (firstCellEl) {
|
|
2776
|
-
const cellStyle = getComputedStyle(firstCellEl);
|
|
2777
|
-
paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2;
|
|
2778
|
-
}
|
|
2779
|
-
let colWidth = column.renderAutoWidth - paddingSize;
|
|
2780
|
-
XEUtils.arrayEach(cellElList, (itemEl) => {
|
|
2781
|
-
const cellEl = itemEl;
|
|
2782
|
-
const thElem = cellEl.parentElement;
|
|
2783
|
-
let titleWidth = 0;
|
|
2784
|
-
if (`${thElem.tagName}`.toLowerCase() === 'th') {
|
|
2785
|
-
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
2786
|
-
titleWidth += btnEl.offsetWidth + 1;
|
|
2787
|
-
});
|
|
2788
|
-
}
|
|
2789
|
-
else {
|
|
2790
|
-
const labelEl = cellEl.firstElementChild;
|
|
2791
|
-
if (labelEl) {
|
|
2792
|
-
titleWidth = labelEl.offsetWidth;
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
if (titleWidth) {
|
|
2796
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
|
|
2797
|
-
}
|
|
2798
|
-
});
|
|
2799
|
-
if (colRest) {
|
|
2800
|
-
colRest.width = Math.max(colWidth, colRest.width);
|
|
2801
|
-
}
|
|
2802
|
-
column.renderAutoWidth = colWidth + paddingSize;
|
|
2803
|
-
});
|
|
2804
|
-
this.analyColumnWidth();
|
|
2805
|
-
}
|
|
2806
|
-
this.isCalcColumn = false;
|
|
2807
|
-
});
|
|
2808
|
-
},
|
|
2809
|
-
/**
|
|
2810
|
-
* 列宽算法,计算单元格列宽,动态分配可用剩余空间
|
|
2811
|
-
* 支持 px、%、固定 混合分配
|
|
2812
|
-
* 支持动态列表调整分配
|
|
2813
|
-
* 支持自动分配偏移量
|
|
2814
|
-
* 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
|
|
2815
|
-
*/
|
|
2816
|
-
autoCellWidth() {
|
|
2817
|
-
const { $refs } = this;
|
|
2818
|
-
const { tableBody, tableHeader, tableFooter } = $refs;
|
|
2819
|
-
const bodyElem = tableBody ? tableBody.$el : null;
|
|
2820
|
-
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
2821
|
-
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
2822
|
-
let tableWidth = 0;
|
|
2823
|
-
const minCellWidth = 40; // 列宽最少限制 40px
|
|
2824
|
-
const bodyWidth = bodyElem.clientWidth - 1;
|
|
2825
|
-
let remainWidth = bodyWidth;
|
|
2826
|
-
let meanWidth = remainWidth / 100;
|
|
2827
|
-
const { fit, columnStore } = this;
|
|
2828
|
-
const { resizeList, pxMinList, pxList, autoMinList, scaleList, scaleMinList, autoList, remainList } = columnStore;
|
|
2829
|
-
// 最小宽
|
|
2830
|
-
pxMinList.forEach((column) => {
|
|
2831
|
-
const minWidth = parseInt(column.minWidth);
|
|
2832
|
-
tableWidth += minWidth;
|
|
2833
|
-
column.renderWidth = minWidth;
|
|
2834
|
-
});
|
|
2835
|
-
// 最小自适应
|
|
2836
|
-
autoMinList.forEach((column) => {
|
|
2837
|
-
const scaleWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
2838
|
-
tableWidth += scaleWidth;
|
|
2839
|
-
column.renderWidth = scaleWidth;
|
|
2840
|
-
});
|
|
2841
|
-
// 最小百分比
|
|
2842
|
-
scaleMinList.forEach((column) => {
|
|
2843
|
-
const scaleWidth = Math.floor(parseInt(column.minWidth) * meanWidth);
|
|
2844
|
-
tableWidth += scaleWidth;
|
|
2845
|
-
column.renderWidth = scaleWidth;
|
|
2846
|
-
});
|
|
2847
|
-
// 固定百分比
|
|
2848
|
-
scaleList.forEach((column) => {
|
|
2849
|
-
const scaleWidth = Math.floor(parseInt(column.width) * meanWidth);
|
|
2850
|
-
tableWidth += scaleWidth;
|
|
2851
|
-
column.renderWidth = scaleWidth;
|
|
2852
|
-
});
|
|
2853
|
-
// 固定宽
|
|
2854
|
-
pxList.forEach((column) => {
|
|
2855
|
-
const width = parseInt(column.width);
|
|
2856
|
-
tableWidth += width;
|
|
2857
|
-
column.renderWidth = width;
|
|
2858
|
-
});
|
|
2859
|
-
// 自适应宽
|
|
2860
|
-
autoList.forEach((column) => {
|
|
2861
|
-
const width = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
2862
|
-
tableWidth += width;
|
|
2863
|
-
column.renderWidth = width;
|
|
2864
|
-
});
|
|
2865
|
-
// 调整了列宽
|
|
2866
|
-
resizeList.forEach((column) => {
|
|
2867
|
-
const width = parseInt(column.resizeWidth);
|
|
2868
|
-
tableWidth += width;
|
|
2869
|
-
column.renderWidth = width;
|
|
2870
|
-
});
|
|
2871
|
-
remainWidth -= tableWidth;
|
|
2872
|
-
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
|
|
2873
|
-
if (fit) {
|
|
2874
|
-
if (remainWidth > 0) {
|
|
2875
|
-
scaleMinList.concat(pxMinList).concat(autoMinList).forEach((column) => {
|
|
2876
|
-
tableWidth += meanWidth;
|
|
2877
|
-
column.renderWidth += meanWidth;
|
|
2878
|
-
});
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
else {
|
|
2882
|
-
meanWidth = minCellWidth;
|
|
2883
|
-
}
|
|
2884
|
-
// 剩余均分
|
|
2885
|
-
remainList.forEach((column) => {
|
|
2886
|
-
const width = Math.max(meanWidth, minCellWidth);
|
|
2887
|
-
column.renderWidth = width;
|
|
2888
|
-
tableWidth += width;
|
|
2889
|
-
});
|
|
2890
|
-
if (fit) {
|
|
2891
|
-
/**
|
|
2892
|
-
* 偏移量算法
|
|
2893
|
-
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
2894
|
-
*/
|
|
2895
|
-
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
2896
|
-
let dynamicSize = dynamicList.length - 1;
|
|
2897
|
-
if (dynamicSize > 0) {
|
|
2898
|
-
let odiffer = bodyWidth - tableWidth;
|
|
2899
|
-
if (odiffer > 0) {
|
|
2900
|
-
while (odiffer > 0 && dynamicSize >= 0) {
|
|
2901
|
-
odiffer--;
|
|
2902
|
-
dynamicList[dynamicSize--].renderWidth++;
|
|
2903
|
-
}
|
|
2904
|
-
tableWidth = bodyWidth;
|
|
2905
|
-
}
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
const tableHeight = bodyElem.offsetHeight;
|
|
2909
|
-
const overflowY = bodyElem.scrollHeight > bodyElem.clientHeight;
|
|
2910
|
-
this.scrollbarWidth = overflowY ? bodyElem.offsetWidth - bodyElem.clientWidth : 0;
|
|
2911
|
-
this.overflowY = overflowY;
|
|
2912
|
-
this.tableWidth = tableWidth;
|
|
2913
|
-
this.tableHeight = tableHeight;
|
|
2914
|
-
if (headerElem) {
|
|
2915
|
-
this.headerHeight = headerElem.clientHeight;
|
|
2916
|
-
this.$nextTick(() => {
|
|
2917
|
-
// 检测是否同步滚动
|
|
2918
|
-
if (headerElem && bodyElem && headerElem.scrollLeft !== bodyElem.scrollLeft) {
|
|
2919
|
-
headerElem.scrollLeft = bodyElem.scrollLeft;
|
|
2920
|
-
}
|
|
2921
|
-
});
|
|
2922
|
-
}
|
|
2923
|
-
else {
|
|
2924
|
-
this.headerHeight = 0;
|
|
2925
|
-
}
|
|
2926
|
-
let overflowX = false;
|
|
2927
|
-
let footerHeight = 0;
|
|
2928
|
-
let scrollbarHeight = 0;
|
|
2929
|
-
if (footerElem) {
|
|
2930
|
-
footerHeight = footerElem.offsetHeight;
|
|
2931
|
-
overflowX = tableWidth > footerElem.clientWidth;
|
|
2932
|
-
scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0);
|
|
2933
|
-
}
|
|
2934
|
-
else {
|
|
2935
|
-
overflowX = tableWidth > bodyWidth;
|
|
2936
|
-
scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0);
|
|
2937
|
-
}
|
|
2938
|
-
this.footerHeight = footerHeight;
|
|
2939
|
-
this.overflowX = tableWidth > bodyWidth;
|
|
2940
|
-
this.scrollbarHeight = scrollbarHeight;
|
|
2941
|
-
this.updateHeight();
|
|
2942
|
-
this.parentHeight = Math.max(this.headerHeight + this.footerHeight + 20, this.getParentHeight());
|
|
2943
|
-
if (overflowX) {
|
|
2944
|
-
this.checkScrolling();
|
|
2945
|
-
}
|
|
2946
|
-
},
|
|
2947
|
-
updateHeight() {
|
|
2948
|
-
this.customHeight = calcTableHeight(this, 'height');
|
|
2949
|
-
this.customMinHeight = calcTableHeight(this, 'minHeight');
|
|
2950
|
-
this.customMaxHeight = calcTableHeight(this, 'maxHeight');
|
|
2951
|
-
},
|
|
2952
3092
|
updateStyle() {
|
|
2953
3093
|
const $xeTable = this;
|
|
2954
3094
|
let { $refs, isGroup, fullColumnIdData, tableColumn, customHeight, customMinHeight, customMaxHeight, border, headerHeight, showFooter, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, footerHeight, tableHeight, tableWidth, scrollbarHeight, scrollbarWidth, scrollXLoad, scrollYLoad, overflowX, cellOffsetWidth, columnStore, elemStore, editStore, currentRow, mouseConfig, spanMethod, expandColumn, footerSpanMethod, isAllOverflow, visibleColumn } = $xeTable;
|
|
@@ -5409,6 +5549,7 @@ const Methods = {
|
|
|
5409
5549
|
oldRow: dragRow,
|
|
5410
5550
|
newRow: prevDragRow,
|
|
5411
5551
|
dragPos: prevDragPos,
|
|
5552
|
+
dragToChild: isSelfToChildDrag,
|
|
5412
5553
|
offsetIndex: dragOffsetIndex,
|
|
5413
5554
|
_index: {
|
|
5414
5555
|
newIndex: nafIndex,
|
|
@@ -5664,6 +5805,7 @@ const Methods = {
|
|
|
5664
5805
|
oldColumn,
|
|
5665
5806
|
newColumn,
|
|
5666
5807
|
dragPos: prevDragPos,
|
|
5808
|
+
dragToChild: isSelfToChildDrag,
|
|
5667
5809
|
offsetIndex: dragOffsetIndex,
|
|
5668
5810
|
_index: {
|
|
5669
5811
|
newIndex: nafIndex,
|
|
@@ -5694,7 +5836,7 @@ const Methods = {
|
|
|
5694
5836
|
setTimeout(() => {
|
|
5695
5837
|
reactData.isDragColMove = false;
|
|
5696
5838
|
$xeTable.recalculate().then(() => {
|
|
5697
|
-
$xeTable
|
|
5839
|
+
loadScrollXData($xeTable);
|
|
5698
5840
|
});
|
|
5699
5841
|
}, 500);
|
|
5700
5842
|
},
|
|
@@ -6680,29 +6822,6 @@ const Methods = {
|
|
|
6680
6822
|
scrollLeft: bodyElem.scrollLeft
|
|
6681
6823
|
};
|
|
6682
6824
|
},
|
|
6683
|
-
loadScrollXData() {
|
|
6684
|
-
const $xeTable = this;
|
|
6685
|
-
const reactData = $xeTable;
|
|
6686
|
-
const internalData = $xeTable;
|
|
6687
|
-
const { mergeList, mergeFooterList } = reactData;
|
|
6688
|
-
const { scrollXStore } = internalData;
|
|
6689
|
-
const { startIndex, endIndex, offsetSize } = scrollXStore;
|
|
6690
|
-
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable);
|
|
6691
|
-
const offsetItem = {
|
|
6692
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
6693
|
-
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
6694
|
-
};
|
|
6695
|
-
calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
|
|
6696
|
-
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
6697
|
-
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
6698
|
-
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
6699
|
-
scrollXStore.startIndex = offsetStartIndex;
|
|
6700
|
-
scrollXStore.endIndex = offsetEndIndex;
|
|
6701
|
-
$xeTable.updateScrollXData();
|
|
6702
|
-
}
|
|
6703
|
-
}
|
|
6704
|
-
$xeTable.closeTooltip();
|
|
6705
|
-
},
|
|
6706
6825
|
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
6707
6826
|
const $xeTable = this;
|
|
6708
6827
|
const props = $xeTable;
|
|
@@ -6808,12 +6927,12 @@ const Methods = {
|
|
|
6808
6927
|
}
|
|
6809
6928
|
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
6810
6929
|
internalData.lxRunTime = Date.now();
|
|
6811
|
-
$xeTable
|
|
6930
|
+
loadScrollXData($xeTable);
|
|
6812
6931
|
}
|
|
6813
6932
|
internalData.lxTimeout = setTimeout(() => {
|
|
6933
|
+
internalData.lxTimeout = undefined;
|
|
6814
6934
|
internalData.lxRunTime = undefined;
|
|
6815
|
-
|
|
6816
|
-
$xeTable.loadScrollXData();
|
|
6935
|
+
loadScrollXData($xeTable);
|
|
6817
6936
|
}, fpsTime);
|
|
6818
6937
|
},
|
|
6819
6938
|
lazyScrollYData() {
|
|
@@ -6827,12 +6946,12 @@ const Methods = {
|
|
|
6827
6946
|
}
|
|
6828
6947
|
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
6829
6948
|
internalData.lyRunTime = Date.now();
|
|
6830
|
-
$xeTable
|
|
6949
|
+
loadScrollYData($xeTable);
|
|
6831
6950
|
}
|
|
6832
6951
|
internalData.lyTimeout = setTimeout(() => {
|
|
6833
6952
|
internalData.lyTimeout = undefined;
|
|
6834
6953
|
internalData.lyRunTime = undefined;
|
|
6835
|
-
$xeTable
|
|
6954
|
+
loadScrollYData($xeTable);
|
|
6836
6955
|
}, fpsTime);
|
|
6837
6956
|
},
|
|
6838
6957
|
/**
|
|
@@ -6842,7 +6961,7 @@ const Methods = {
|
|
|
6842
6961
|
const $xeTable = this;
|
|
6843
6962
|
const sXOpts = $xeTable.computeSXOpts;
|
|
6844
6963
|
if (sXOpts.immediate) {
|
|
6845
|
-
$xeTable
|
|
6964
|
+
loadScrollXData($xeTable);
|
|
6846
6965
|
}
|
|
6847
6966
|
else {
|
|
6848
6967
|
$xeTable.lazyScrollXData();
|
|
@@ -6855,7 +6974,7 @@ const Methods = {
|
|
|
6855
6974
|
const $xeTable = this;
|
|
6856
6975
|
const sYOpts = $xeTable.computeSYOpts;
|
|
6857
6976
|
if (sYOpts.immediate) {
|
|
6858
|
-
$xeTable
|
|
6977
|
+
loadScrollYData($xeTable);
|
|
6859
6978
|
}
|
|
6860
6979
|
else {
|
|
6861
6980
|
$xeTable.lazyScrollYData();
|
|
@@ -6937,74 +7056,6 @@ const Methods = {
|
|
|
6937
7056
|
fixed: ''
|
|
6938
7057
|
});
|
|
6939
7058
|
},
|
|
6940
|
-
/**
|
|
6941
|
-
* 纵向 Y 可视渲染处理
|
|
6942
|
-
*/
|
|
6943
|
-
loadScrollYData() {
|
|
6944
|
-
const $xeTable = this;
|
|
6945
|
-
const props = $xeTable;
|
|
6946
|
-
const reactData = $xeTable;
|
|
6947
|
-
const internalData = $xeTable;
|
|
6948
|
-
const { showOverflow } = props;
|
|
6949
|
-
const { mergeList } = reactData;
|
|
6950
|
-
const { tableHeight, scrollYStore } = internalData;
|
|
6951
|
-
const { startIndex, endIndex, offsetSize } = scrollYStore;
|
|
6952
|
-
const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
|
|
6953
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
|
|
6954
|
-
const offsetItem = {
|
|
6955
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
|
|
6956
|
-
endIndex: toVisibleIndex + visibleSize + offsetYSize
|
|
6957
|
-
};
|
|
6958
|
-
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
6959
|
-
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
6960
|
-
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
6961
|
-
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
6962
|
-
scrollYStore.startIndex = offsetStartIndex;
|
|
6963
|
-
scrollYStore.endIndex = offsetEndIndex;
|
|
6964
|
-
$xeTable.updateScrollYData();
|
|
6965
|
-
}
|
|
6966
|
-
}
|
|
6967
|
-
},
|
|
6968
|
-
// 计算可视渲染相关数据
|
|
6969
|
-
computeScrollLoad() {
|
|
6970
|
-
const $xeTable = this;
|
|
6971
|
-
return this.$nextTick().then(() => {
|
|
6972
|
-
const { sYOpts, sXOpts, scrollXLoad, scrollYLoad, scrollXStore, scrollYStore } = this;
|
|
6973
|
-
// 计算 X 逻辑
|
|
6974
|
-
if (scrollXLoad) {
|
|
6975
|
-
const { visibleSize: visibleXSize } = handleVirtualXVisible($xeTable);
|
|
6976
|
-
const offsetXSize = Math.max(0, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : (browse.edge ? 5 : 0));
|
|
6977
|
-
scrollXStore.offsetSize = offsetXSize;
|
|
6978
|
-
scrollXStore.visibleSize = visibleXSize;
|
|
6979
|
-
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
6980
|
-
$xeTable.updateScrollXData().then(() => {
|
|
6981
|
-
$xeTable.loadScrollXData();
|
|
6982
|
-
});
|
|
6983
|
-
}
|
|
6984
|
-
else {
|
|
6985
|
-
$xeTable.updateScrollXSpace();
|
|
6986
|
-
}
|
|
6987
|
-
calcCellHeight(this);
|
|
6988
|
-
// 计算 Y 逻辑
|
|
6989
|
-
const rowHeight = computeRowHeight(this);
|
|
6990
|
-
scrollYStore.rowHeight = rowHeight;
|
|
6991
|
-
this.rowHeight = rowHeight;
|
|
6992
|
-
const { visibleSize: visibleYSize } = handleVirtualYVisible($xeTable);
|
|
6993
|
-
if (scrollYLoad) {
|
|
6994
|
-
const offsetYSize = Math.max(0, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0));
|
|
6995
|
-
scrollYStore.offsetSize = offsetYSize;
|
|
6996
|
-
scrollYStore.visibleSize = visibleYSize;
|
|
6997
|
-
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
6998
|
-
$xeTable.updateScrollYData().then(() => {
|
|
6999
|
-
$xeTable.loadScrollYData();
|
|
7000
|
-
});
|
|
7001
|
-
}
|
|
7002
|
-
else {
|
|
7003
|
-
$xeTable.updateScrollYSpace();
|
|
7004
|
-
}
|
|
7005
|
-
$xeTable.$nextTick(this.updateStyle);
|
|
7006
|
-
});
|
|
7007
|
-
},
|
|
7008
7059
|
handleTableColumn() {
|
|
7009
7060
|
const { scrollXLoad, visibleColumn, scrollXStore, fullColumnIdData } = this;
|
|
7010
7061
|
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
@@ -7024,14 +7075,15 @@ const Methods = {
|
|
|
7024
7075
|
internalData.collectColumn = columnList;
|
|
7025
7076
|
const tableFullColumn = getColumnList(columnList);
|
|
7026
7077
|
internalData.tableFullColumn = tableFullColumn;
|
|
7027
|
-
$xeTable
|
|
7078
|
+
cacheColumnMap($xeTable);
|
|
7028
7079
|
},
|
|
7029
7080
|
updateScrollXData() {
|
|
7030
7081
|
const $xeTable = this;
|
|
7031
7082
|
const props = $xeTable;
|
|
7032
7083
|
const { showOverflow } = props;
|
|
7084
|
+
$xeTable.handleTableColumn();
|
|
7085
|
+
calcCellHeight($xeTable);
|
|
7033
7086
|
return $xeTable.$nextTick().then(() => {
|
|
7034
|
-
$xeTable.handleTableColumn();
|
|
7035
7087
|
calcCellHeight($xeTable);
|
|
7036
7088
|
$xeTable.updateScrollXSpace();
|
|
7037
7089
|
if (!showOverflow) {
|
|
@@ -7082,8 +7134,9 @@ const Methods = {
|
|
|
7082
7134
|
},
|
|
7083
7135
|
updateScrollYData() {
|
|
7084
7136
|
const $xeTable = this;
|
|
7137
|
+
$xeTable.handleTableData();
|
|
7138
|
+
calcCellHeight($xeTable);
|
|
7085
7139
|
return $xeTable.$nextTick().then(() => {
|
|
7086
|
-
$xeTable.handleTableData();
|
|
7087
7140
|
calcCellHeight($xeTable);
|
|
7088
7141
|
$xeTable.updateScrollYSpace();
|
|
7089
7142
|
});
|