vxe-table 3.12.0-beta.1 → 3.12.0-beta.11
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/style.css +1 -1
- package/es/table/module/custom/panel.js +4 -10
- package/es/table/module/edit/mixin.js +7 -1
- package/es/table/module/validator/mixin.js +2 -6
- package/es/table/src/body.js +31 -27
- package/es/table/src/footer.js +2 -2
- package/es/table/src/header.js +1 -1
- package/es/table/src/methods.js +94 -56
- package/es/table/src/table.js +14 -11
- package/es/table/src/util.js +10 -5
- package/es/ui/index.js +2 -2
- package/es/ui/src/dom.js +14 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +181 -127
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +3 -9
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +6 -1
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +1 -6
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +32 -27
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +2 -1
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +1 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +98 -64
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +11 -9
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -5
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +16 -2
- package/lib/ui/src/dom.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/table/module/custom/panel.ts +4 -10
- package/packages/table/module/edit/mixin.ts +6 -1
- package/packages/table/module/validator/mixin.ts +2 -6
- package/packages/table/src/body.ts +31 -27
- package/packages/table/src/footer.ts +2 -2
- package/packages/table/src/header.ts +1 -1
- package/packages/table/src/methods.ts +127 -77
- package/packages/table/src/table.ts +17 -12
- package/packages/table/src/util.ts +12 -5
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/dom.ts +16 -1
- /package/es/{iconfont.1735108867776.ttf → iconfont.1735528767577.ttf} +0 -0
- /package/es/{iconfont.1735108867776.woff → iconfont.1735528767577.woff} +0 -0
- /package/es/{iconfont.1735108867776.woff2 → iconfont.1735528767577.woff2} +0 -0
- /package/lib/{iconfont.1735108867776.ttf → iconfont.1735528767577.ttf} +0 -0
- /package/lib/{iconfont.1735108867776.woff → iconfont.1735528767577.woff} +0 -0
- /package/lib/{iconfont.1735108867776.woff2 → iconfont.1735528767577.woff2} +0 -0
package/es/table/src/body.js
CHANGED
|
@@ -48,12 +48,12 @@ function renderLine(h, _vm, $xetable, params) {
|
|
|
48
48
|
/**
|
|
49
49
|
* 渲染列
|
|
50
50
|
*/
|
|
51
|
-
function renderColumn(h, _vm, $
|
|
52
|
-
const { $listeners: tableListeners, fullAllDataRowIdData, afterFullData, tableData, height, columnKey, overflowX, sYOpts, scrollXLoad, scrollYLoad, highlightCurrentRow, showOverflow: allColumnOverflow, isAllOverflow, align: allAlign, currentColumn, cellClassName: allCellClassName, cellStyle, mergeList, spanMethod, radioOpts, checkboxOpts, expandOpts, treeOpts, tooltipOpts, mouseConfig, editConfig, editOpts, editRules, validOpts, editStore, tooltipConfig, rowOpts, columnOpts, mouseOpts, areaOpts, validErrorMaps } = $
|
|
53
|
-
const rowDragOpts = $
|
|
51
|
+
function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
|
|
52
|
+
const { $listeners: tableListeners, fullAllDataRowIdData, afterFullData, tableData, height, columnKey, overflowX, sYOpts, scrollXLoad, scrollYLoad, highlightCurrentRow, showOverflow: allColumnOverflow, isAllOverflow, align: allAlign, currentColumn, cellClassName: allCellClassName, cellStyle, mergeList, spanMethod, radioOpts, checkboxOpts, expandOpts, treeOpts, tooltipOpts, mouseConfig, editConfig, editOpts, editRules, validOpts, editStore, tooltipConfig, rowOpts, columnOpts, mouseOpts, areaOpts, validErrorMaps } = $xeTable;
|
|
53
|
+
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
54
54
|
const { disabledMethod: dragDisabledMethod } = rowDragOpts;
|
|
55
55
|
const { selectCellToRow } = areaOpts;
|
|
56
|
-
const cellOpts = $
|
|
56
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
57
57
|
const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column;
|
|
58
58
|
const { verticalAlign } = cellOpts;
|
|
59
59
|
const { actived } = editStore;
|
|
@@ -64,8 +64,8 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
64
64
|
const compCellClassName = compConf ? (compConf.tableCellClassName || compConf.cellClassName) : '';
|
|
65
65
|
const compCellStyle = compConf ? (compConf.tableCellStyle || compConf.cellStyle) : '';
|
|
66
66
|
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled;
|
|
67
|
-
const columnIndex = $
|
|
68
|
-
const _columnIndex = $
|
|
67
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
68
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
69
69
|
const isEdit = isEnableConf(editRender);
|
|
70
70
|
let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
|
|
71
71
|
const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow;
|
|
@@ -84,19 +84,19 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
84
84
|
const bindMouseenter = tableListeners['cell-mouseenter'];
|
|
85
85
|
const bindMouseleave = tableListeners['cell-mouseleave'];
|
|
86
86
|
const triggerDblclick = (editRender && editConfig && editOpts.trigger === 'dblclick');
|
|
87
|
-
const params = { $table: $
|
|
88
|
-
let
|
|
87
|
+
const params = { $table: $xeTable, $grid: $xeTable.$xegrid, isEdit: false, seq, rowid, row, rowIndex, $rowIndex, _rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, level: rowLevel, visibleData: afterFullData, data: tableData, items };
|
|
88
|
+
let isRowDragCell = false;
|
|
89
89
|
let isDisabledDrag = false;
|
|
90
90
|
if (rowOpts.drag) {
|
|
91
|
-
|
|
91
|
+
isRowDragCell = rowDragOpts.trigger === 'row' || (column.dragSort && rowDragOpts.trigger === 'cell');
|
|
92
92
|
}
|
|
93
|
-
if (
|
|
93
|
+
if (isRowDragCell) {
|
|
94
94
|
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params));
|
|
95
95
|
}
|
|
96
96
|
// hover 进入事件
|
|
97
97
|
if (showTitle || showTooltip || showAllTip || bindMouseenter || tooltipConfig) {
|
|
98
98
|
tdOns.mouseenter = (evnt) => {
|
|
99
|
-
if (isVMScrollProcess($
|
|
99
|
+
if (isVMScrollProcess($xeTable)) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
if (showTitle) {
|
|
@@ -104,33 +104,37 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
104
104
|
}
|
|
105
105
|
else if (showTooltip || showAllTip) {
|
|
106
106
|
// 如果配置了显示 tooltip
|
|
107
|
-
$
|
|
107
|
+
$xeTable.triggerBodyTooltipEvent(evnt, params);
|
|
108
108
|
}
|
|
109
109
|
if (bindMouseenter) {
|
|
110
|
-
$
|
|
110
|
+
$xeTable.emitEvent('cell-mouseenter', Object.assign({ cell: evnt.currentTarget }, params), evnt);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
// hover 退出事件
|
|
115
115
|
if (showTooltip || showAllTip || bindMouseleave || tooltipConfig) {
|
|
116
116
|
tdOns.mouseleave = (evnt) => {
|
|
117
|
-
if (isVMScrollProcess($
|
|
117
|
+
if (isVMScrollProcess($xeTable)) {
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
if (showTooltip || showAllTip) {
|
|
121
|
-
$
|
|
121
|
+
$xeTable.handleTargetLeaveEvent(evnt);
|
|
122
122
|
}
|
|
123
123
|
if (bindMouseleave) {
|
|
124
|
-
$
|
|
124
|
+
$xeTable.emitEvent('cell-mouseleave', Object.assign({ cell: evnt.currentTarget }, params), evnt);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
// 按下事件处理
|
|
129
|
-
if (
|
|
129
|
+
if (isRowDragCell || checkboxOpts.range || mouseConfig) {
|
|
130
130
|
tdOns.mousedown = (evnt) => {
|
|
131
|
-
$
|
|
131
|
+
$xeTable.triggerCellMousedownEvent(evnt, params);
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
+
// 拖拽列事件
|
|
135
|
+
if (isRowDragCell) {
|
|
136
|
+
tdOns.mouseup = $xeTable.triggerCellMouseupEvent;
|
|
137
|
+
}
|
|
134
138
|
// 点击事件处理
|
|
135
139
|
if ((rowOpts.isCurrent || highlightCurrentRow) ||
|
|
136
140
|
tableListeners['cell-click'] ||
|
|
@@ -140,13 +144,13 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
140
144
|
(checkboxOpts.trigger === 'row' || (column.type === 'checkbox' && checkboxOpts.trigger === 'cell')) ||
|
|
141
145
|
(treeOpts.trigger === 'row' || (column.treeNode && treeOpts.trigger === 'cell'))) {
|
|
142
146
|
tdOns.click = (evnt) => {
|
|
143
|
-
$
|
|
147
|
+
$xeTable.triggerCellClickEvent(evnt, params);
|
|
144
148
|
};
|
|
145
149
|
}
|
|
146
150
|
// 双击事件处理
|
|
147
151
|
if (triggerDblclick || tableListeners['cell-dblclick']) {
|
|
148
152
|
tdOns.dblclick = (evnt) => {
|
|
149
|
-
$
|
|
153
|
+
$xeTable.triggerCellDblclickEvent(evnt, params);
|
|
150
154
|
};
|
|
151
155
|
}
|
|
152
156
|
// 合并行或列
|
|
@@ -186,7 +190,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
186
190
|
}
|
|
187
191
|
// 如果编辑列开启显示状态
|
|
188
192
|
if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
|
|
189
|
-
isDirty = $
|
|
193
|
+
isDirty = $xeTable.isUpdateByRow(row, column.field);
|
|
190
194
|
}
|
|
191
195
|
const tdVNs = [];
|
|
192
196
|
if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
|
|
@@ -203,7 +207,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
203
207
|
}
|
|
204
208
|
else {
|
|
205
209
|
// 渲染单元格
|
|
206
|
-
tdVNs.push(...renderLine(h, _vm, $
|
|
210
|
+
tdVNs.push(...renderLine(h, _vm, $xeTable, params), h('div', {
|
|
207
211
|
class: ['vxe-cell', {
|
|
208
212
|
'c--title': showTitle,
|
|
209
213
|
'c--tooltip': showTooltip,
|
|
@@ -213,7 +217,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
213
217
|
maxHeight: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
|
|
214
218
|
},
|
|
215
219
|
attrs: {
|
|
216
|
-
title: showTitle ? $
|
|
220
|
+
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
217
221
|
}
|
|
218
222
|
}, column.renderCell(h, params)));
|
|
219
223
|
if (showValidTip && errorValidItem) {
|
|
@@ -232,7 +236,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
232
236
|
class: `vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-${validOpts.theme || 'normal'}`
|
|
233
237
|
}, [
|
|
234
238
|
validSlot
|
|
235
|
-
? $
|
|
239
|
+
? $xeTable.callSlot(validSlot, validParams, h)
|
|
236
240
|
: [
|
|
237
241
|
h('span', {
|
|
238
242
|
class: 'vxe-cell--valid-error-msg'
|
|
@@ -274,7 +278,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
274
278
|
'col--ellipsis': hasEllipsis,
|
|
275
279
|
'fixed--width': !isAutoCellWidth,
|
|
276
280
|
'fixed--hidden': fixedHiddenColumn,
|
|
277
|
-
'is--drag-cell':
|
|
281
|
+
'is--drag-cell': isRowDragCell,
|
|
278
282
|
'is--drag-disabled': isDisabledDrag,
|
|
279
283
|
'col--dirty': isDirty,
|
|
280
284
|
'col--active': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
|
|
@@ -500,7 +504,7 @@ export default {
|
|
|
500
504
|
const { tId, $scopedSlots } = $xeTable;
|
|
501
505
|
const { fixedColumn, fixedType, tableColumn } = props;
|
|
502
506
|
const { showOverflow: allColumnOverflow, spanMethod, footerSpanMethod, mouseConfig } = tableProps;
|
|
503
|
-
const { tableData, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData;
|
|
507
|
+
const { isGroup, tableData, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData;
|
|
504
508
|
const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData;
|
|
505
509
|
const rowOpts = $xeTable.computeRowOpts;
|
|
506
510
|
const sYOpts = $xeTable.computeSYOpts;
|
|
@@ -547,7 +551,7 @@ export default {
|
|
|
547
551
|
}
|
|
548
552
|
}
|
|
549
553
|
}
|
|
550
|
-
if (!fixedType) {
|
|
554
|
+
if (!fixedType && !isGroup) {
|
|
551
555
|
// 列拖拽
|
|
552
556
|
if (scrollXLoad && dragCol) {
|
|
553
557
|
if (renderColumnList.length > 2) {
|
package/es/table/src/footer.js
CHANGED
|
@@ -220,7 +220,7 @@ export default {
|
|
|
220
220
|
const { fixedType, fixedColumn, tableColumn } = props;
|
|
221
221
|
const { spanMethod, footerSpanMethod, showFooterOverflow: allColumnFooterOverflow } = tableProps;
|
|
222
222
|
const { visibleColumn, fullColumnIdData } = tableInternalData;
|
|
223
|
-
const { scrollXLoad, scrollYLoad, scrollbarWidth, dragCol } = tableReactData;
|
|
223
|
+
const { isGroup, scrollXLoad, scrollYLoad, scrollbarWidth, dragCol } = tableReactData;
|
|
224
224
|
let renderColumnList = tableColumn;
|
|
225
225
|
// 如果是使用优化模式
|
|
226
226
|
if (fixedType) {
|
|
@@ -238,7 +238,7 @@ export default {
|
|
|
238
238
|
renderColumnList = visibleColumn;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
if (!fixedType) {
|
|
241
|
+
if (!fixedType && !isGroup) {
|
|
242
242
|
// 列拖拽
|
|
243
243
|
if (scrollXLoad && dragCol) {
|
|
244
244
|
if (renderColumnList.length > 2) {
|
package/es/table/src/header.js
CHANGED
package/es/table/src/methods.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, isNodeElement } from '../../ui/src/dom';
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
4
4
|
import { VxeUI } from '../../ui';
|
|
5
5
|
import Cell from './cell';
|
|
@@ -66,9 +66,10 @@ function handleReserveRow(_vm, reserveRowMap) {
|
|
|
66
66
|
});
|
|
67
67
|
return reserveList;
|
|
68
68
|
}
|
|
69
|
-
function handleVirtualXVisible(
|
|
70
|
-
const
|
|
71
|
-
const {
|
|
69
|
+
function handleVirtualXVisible($xeTable) {
|
|
70
|
+
const internalData = $xeTable;
|
|
71
|
+
const { visibleColumn } = internalData;
|
|
72
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
72
73
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
73
74
|
if (tableBodyElem) {
|
|
74
75
|
const { scrollLeft, clientWidth } = tableBodyElem;
|
|
@@ -99,8 +100,8 @@ const computeRowHeight = ($xeTable) => {
|
|
|
99
100
|
const tableBody = $xeTable.$refs.tableBody;
|
|
100
101
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
101
102
|
const vSize = $xeTable.computeSize;
|
|
102
|
-
const rowHeightMaps = $xeTable.
|
|
103
|
-
let rowHeight =
|
|
103
|
+
const rowHeightMaps = $xeTable.computeRowHeightMaps;
|
|
104
|
+
let rowHeight = 24;
|
|
104
105
|
if (showOverflow) {
|
|
105
106
|
if (tableBodyElem) {
|
|
106
107
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
@@ -120,8 +121,9 @@ const computeRowHeight = ($xeTable) => {
|
|
|
120
121
|
return rowHeight;
|
|
121
122
|
};
|
|
122
123
|
function handleVirtualYVisible($xeTable) {
|
|
123
|
-
const
|
|
124
|
-
const
|
|
124
|
+
const internalData = $xeTable;
|
|
125
|
+
const { scrollYStore, afterFullData, fullAllDataRowIdData } = internalData;
|
|
126
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
125
127
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
126
128
|
const { rowHeight } = scrollYStore;
|
|
127
129
|
if (tableBodyElem) {
|
|
@@ -133,11 +135,11 @@ function handleVirtualYVisible($xeTable) {
|
|
|
133
135
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
134
136
|
const row = afterFullData[rIndex];
|
|
135
137
|
const rowid = getRowid($xeTable, row);
|
|
136
|
-
const
|
|
137
|
-
if (!
|
|
138
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
139
|
+
if (!rowRest) {
|
|
138
140
|
break;
|
|
139
141
|
}
|
|
140
|
-
offsetTop +=
|
|
142
|
+
offsetTop += rowRest.height || rowHeight;
|
|
141
143
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
142
144
|
toVisibleIndex = rIndex;
|
|
143
145
|
}
|
|
@@ -333,6 +335,19 @@ function getOrderField(_vm, column) {
|
|
|
333
335
|
return cellValue;
|
|
334
336
|
};
|
|
335
337
|
}
|
|
338
|
+
function clearDragStatus($xeTable) {
|
|
339
|
+
const reactData = $xeTable;
|
|
340
|
+
const { dragRow, dragCol } = reactData;
|
|
341
|
+
if (dragRow || dragCol) {
|
|
342
|
+
clearColDropOrigin($xeTable);
|
|
343
|
+
clearRowDropOrigin($xeTable);
|
|
344
|
+
hideDropTip($xeTable);
|
|
345
|
+
reactData.dragRow = null;
|
|
346
|
+
reactData.dragCol = null;
|
|
347
|
+
reactData.isDragColMove = false;
|
|
348
|
+
reactData.isDragRowMove = false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
336
351
|
function clearRowDropOrigin($xeTable) {
|
|
337
352
|
const el = $xeTable.$el;
|
|
338
353
|
if (el) {
|
|
@@ -516,7 +531,9 @@ const handleScrollToRowColumn = ($xeTable, fieldOrColumn, row) => {
|
|
|
516
531
|
return $xeTable.$nextTick();
|
|
517
532
|
};
|
|
518
533
|
function handleRecalculateLayout($xeTable, reFull) {
|
|
534
|
+
const internalData = $xeTable;
|
|
519
535
|
const el = $xeTable.$refs.refElem;
|
|
536
|
+
internalData.reRunTime = Date.now();
|
|
520
537
|
if (!el || !el.clientWidth) {
|
|
521
538
|
return $xeTable.$nextTick();
|
|
522
539
|
}
|
|
@@ -722,7 +739,6 @@ const Methods = {
|
|
|
722
739
|
editStore.removeList = [];
|
|
723
740
|
editStore.removeMaps = {};
|
|
724
741
|
const sYLoad = this.updateScrollYStatus(fullData);
|
|
725
|
-
this.scrollYLoad = sYLoad;
|
|
726
742
|
this.isDragRowMove = false;
|
|
727
743
|
// 全量数据
|
|
728
744
|
this.tableFullData = fullData;
|
|
@@ -2691,27 +2707,34 @@ const Methods = {
|
|
|
2691
2707
|
* 刷新布局
|
|
2692
2708
|
*/
|
|
2693
2709
|
recalculate(reFull) {
|
|
2710
|
+
const $xeTable = this;
|
|
2711
|
+
const internalData = $xeTable;
|
|
2694
2712
|
return new Promise(resolve => {
|
|
2695
|
-
const
|
|
2696
|
-
const
|
|
2697
|
-
const
|
|
2713
|
+
const { rceTimeout, reRunTime } = internalData;
|
|
2714
|
+
const resizeOpts = $xeTable.computeResizeOpts;
|
|
2715
|
+
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
2698
2716
|
const el = $xeTable.$refs.refElem;
|
|
2699
2717
|
if (el && el.clientWidth) {
|
|
2700
2718
|
$xeTable.autoCellWidth();
|
|
2701
2719
|
}
|
|
2702
2720
|
if (rceTimeout) {
|
|
2703
2721
|
clearTimeout(rceTimeout);
|
|
2704
|
-
|
|
2705
|
-
resolve();
|
|
2706
|
-
}
|
|
2722
|
+
if (reRunTime && reRunTime + (refreshDelay - 5) < Date.now()) {
|
|
2723
|
+
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
2724
|
+
}
|
|
2725
|
+
else {
|
|
2726
|
+
$xeTable.$nextTick(() => {
|
|
2727
|
+
resolve();
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2707
2730
|
}
|
|
2708
2731
|
else {
|
|
2709
2732
|
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
2710
2733
|
}
|
|
2711
2734
|
internalData.rceTimeout = setTimeout(() => {
|
|
2712
2735
|
internalData.rceTimeout = undefined;
|
|
2713
|
-
|
|
2714
|
-
},
|
|
2736
|
+
handleRecalculateLayout($xeTable, !!reFull);
|
|
2737
|
+
}, refreshDelay);
|
|
2715
2738
|
});
|
|
2716
2739
|
},
|
|
2717
2740
|
calcCellWidth() {
|
|
@@ -5048,7 +5071,7 @@ const Methods = {
|
|
|
5048
5071
|
const { editStore, editConfig, editOpts } = this;
|
|
5049
5072
|
const { actived } = editStore;
|
|
5050
5073
|
const cell = evnt.currentTarget;
|
|
5051
|
-
params.cell
|
|
5074
|
+
params = Object.assign({ cell }, params);
|
|
5052
5075
|
if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
|
|
5053
5076
|
if (!actived.args || evnt.currentTarget !== actived.args.cell) {
|
|
5054
5077
|
if (editOpts.mode === 'row') {
|
|
@@ -5196,14 +5219,16 @@ const Methods = {
|
|
|
5196
5219
|
$xeTable.closeMenu();
|
|
5197
5220
|
}
|
|
5198
5221
|
},
|
|
5222
|
+
triggerCellMouseupEvent() {
|
|
5223
|
+
const $xeTable = this;
|
|
5224
|
+
clearDragStatus($xeTable);
|
|
5225
|
+
},
|
|
5199
5226
|
/**
|
|
5200
5227
|
* 行拖拽
|
|
5201
5228
|
*/
|
|
5202
5229
|
handleRowDragDragstartEvent(evnt) {
|
|
5203
5230
|
if (evnt.dataTransfer) {
|
|
5204
|
-
|
|
5205
|
-
img.src = tpImg;
|
|
5206
|
-
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
5231
|
+
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
|
|
5207
5232
|
}
|
|
5208
5233
|
},
|
|
5209
5234
|
handleRowDragDragendEvent(evnt) {
|
|
@@ -5448,23 +5473,24 @@ const Methods = {
|
|
|
5448
5473
|
},
|
|
5449
5474
|
handleCellDragMouseupEvent() {
|
|
5450
5475
|
const $xeTable = this;
|
|
5451
|
-
|
|
5452
|
-
clearRowDropOrigin($xeTable);
|
|
5453
|
-
hideDropTip($xeTable);
|
|
5454
|
-
reactData.dragRow = null;
|
|
5455
|
-
reactData.dragCol = null;
|
|
5456
|
-
reactData.isDragRowMove = false;
|
|
5476
|
+
clearDragStatus($xeTable);
|
|
5457
5477
|
},
|
|
5458
5478
|
/**
|
|
5459
5479
|
* 列拖拽
|
|
5460
5480
|
*/
|
|
5461
5481
|
handleHeaderCellDragDragstartEvent(evnt) {
|
|
5462
5482
|
if (evnt.dataTransfer) {
|
|
5463
|
-
|
|
5464
|
-
img.src = tpImg;
|
|
5465
|
-
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
5483
|
+
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
|
|
5466
5484
|
}
|
|
5467
5485
|
},
|
|
5486
|
+
handleColDragSwapColumn() {
|
|
5487
|
+
const $xeTable = this;
|
|
5488
|
+
$xeTable.handleUpdateColumn();
|
|
5489
|
+
$xeTable.parseColumns(false).then(() => {
|
|
5490
|
+
$xeTable.updateCellAreas();
|
|
5491
|
+
$xeTable.saveCustomStore('update:sort');
|
|
5492
|
+
});
|
|
5493
|
+
},
|
|
5468
5494
|
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
5469
5495
|
const $xeTable = this;
|
|
5470
5496
|
const props = $xeTable;
|
|
@@ -5608,11 +5634,7 @@ const Methods = {
|
|
|
5608
5634
|
}
|
|
5609
5635
|
}, evnt);
|
|
5610
5636
|
if (isSyncColumn) {
|
|
5611
|
-
$xeTable.
|
|
5612
|
-
$xeTable.parseColumns(false).then(() => {
|
|
5613
|
-
$xeTable.updateCellAreas();
|
|
5614
|
-
return $xeTable.saveCustomStore('update:sort');
|
|
5615
|
-
});
|
|
5637
|
+
$xeTable.handleColDragSwapColumn();
|
|
5616
5638
|
}
|
|
5617
5639
|
}).catch(() => {
|
|
5618
5640
|
});
|
|
@@ -6803,12 +6825,14 @@ const Methods = {
|
|
|
6803
6825
|
scrollXEvent(evnt) {
|
|
6804
6826
|
const $xeTable = this;
|
|
6805
6827
|
const internalData = $xeTable;
|
|
6806
|
-
const { inFooterScroll, inBodyScroll, lastScrollTop } = internalData;
|
|
6807
|
-
if (
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6828
|
+
const { intoRunScroll, inFooterScroll, inBodyScroll, lastScrollTop } = internalData;
|
|
6829
|
+
if (!intoRunScroll) {
|
|
6830
|
+
if (inFooterScroll) {
|
|
6831
|
+
return;
|
|
6832
|
+
}
|
|
6833
|
+
if (inBodyScroll) {
|
|
6834
|
+
return;
|
|
6835
|
+
}
|
|
6812
6836
|
}
|
|
6813
6837
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
6814
6838
|
const tableBody = $xeTable.$refs.tableBody;
|
|
@@ -6839,12 +6863,14 @@ const Methods = {
|
|
|
6839
6863
|
scrollYEvent(evnt) {
|
|
6840
6864
|
const $xeTable = this;
|
|
6841
6865
|
const internalData = $xeTable;
|
|
6842
|
-
const { inFooterScroll, inBodyScroll, lastScrollLeft } = internalData;
|
|
6843
|
-
if (
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6866
|
+
const { intoRunScroll, inFooterScroll, inBodyScroll, lastScrollLeft } = internalData;
|
|
6867
|
+
if (!intoRunScroll) {
|
|
6868
|
+
if (inFooterScroll) {
|
|
6869
|
+
return;
|
|
6870
|
+
}
|
|
6871
|
+
if (inBodyScroll) {
|
|
6872
|
+
return;
|
|
6873
|
+
}
|
|
6848
6874
|
}
|
|
6849
6875
|
const tableBody = $xeTable.$refs.tableBody;
|
|
6850
6876
|
const leftBody = $xeTable.$refs.leftBody;
|
|
@@ -6961,7 +6987,6 @@ const Methods = {
|
|
|
6961
6987
|
const $xeTable = this;
|
|
6962
6988
|
const props = $xeTable;
|
|
6963
6989
|
const { showOverflow } = props;
|
|
6964
|
-
// this.tableColumn = []
|
|
6965
6990
|
return $xeTable.$nextTick().then(() => {
|
|
6966
6991
|
$xeTable.handleTableColumn();
|
|
6967
6992
|
calcCellHeight($xeTable);
|
|
@@ -7014,7 +7039,6 @@ const Methods = {
|
|
|
7014
7039
|
},
|
|
7015
7040
|
updateScrollYData() {
|
|
7016
7041
|
const $xeTable = this;
|
|
7017
|
-
// this.tableData = []
|
|
7018
7042
|
return $xeTable.$nextTick().then(() => {
|
|
7019
7043
|
$xeTable.handleTableData();
|
|
7020
7044
|
calcCellHeight($xeTable);
|
|
@@ -7083,6 +7107,7 @@ const Methods = {
|
|
|
7083
7107
|
*/
|
|
7084
7108
|
scrollTo(scrollLeft, scrollTop) {
|
|
7085
7109
|
const $xeTable = this;
|
|
7110
|
+
const internalData = $xeTable;
|
|
7086
7111
|
const { $refs } = this;
|
|
7087
7112
|
const { tableBody, tableHeader, leftBody, rightBody, tableFooter } = $refs;
|
|
7088
7113
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
@@ -7090,6 +7115,7 @@ const Methods = {
|
|
|
7090
7115
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
7091
7116
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
7092
7117
|
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
|
7118
|
+
internalData.intoRunScroll = true;
|
|
7093
7119
|
if (XEUtils.isNumber(scrollLeft)) {
|
|
7094
7120
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7095
7121
|
if (xHandleEl) {
|
|
@@ -7113,7 +7139,14 @@ const Methods = {
|
|
|
7113
7139
|
}
|
|
7114
7140
|
}
|
|
7115
7141
|
if (this.scrollXLoad || this.scrollYLoad) {
|
|
7116
|
-
return new Promise(resolve =>
|
|
7142
|
+
return new Promise(resolve => {
|
|
7143
|
+
setTimeout(() => {
|
|
7144
|
+
$xeTable.$nextTick(() => {
|
|
7145
|
+
internalData.intoRunScroll = false;
|
|
7146
|
+
resolve();
|
|
7147
|
+
});
|
|
7148
|
+
});
|
|
7149
|
+
});
|
|
7117
7150
|
}
|
|
7118
7151
|
return this.$nextTick();
|
|
7119
7152
|
},
|
|
@@ -7173,10 +7206,15 @@ const Methods = {
|
|
|
7173
7206
|
*/
|
|
7174
7207
|
clearScroll() {
|
|
7175
7208
|
const $xeTable = this;
|
|
7176
|
-
const
|
|
7177
|
-
const {
|
|
7178
|
-
const
|
|
7209
|
+
const internalData = $xeTable;
|
|
7210
|
+
const { scrollXStore, scrollYStore } = internalData;
|
|
7211
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
7212
|
+
const tableHeader = $xeTable.$refs.tableHeader;
|
|
7213
|
+
const tableFooter = $xeTable.$refs.tableFooter;
|
|
7214
|
+
const leftBody = $xeTable.$refs.leftBody;
|
|
7215
|
+
const rightBody = $xeTable.$refs.rightBody;
|
|
7179
7216
|
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
7217
|
+
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
7180
7218
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
7181
7219
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
7182
7220
|
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
package/es/table/src/table.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
2
|
import { getFuncText, isEnableConf } from '../../ui/src/utils';
|
|
3
|
+
import { initTpImg } from '../../ui/src/dom';
|
|
3
4
|
import { VxeUI } from '../../ui';
|
|
4
5
|
import methods from './methods';
|
|
5
6
|
import TableBodyComponent from './body';
|
|
@@ -474,6 +475,9 @@ export default {
|
|
|
474
475
|
return 0;
|
|
475
476
|
},
|
|
476
477
|
rowHeightMaps() {
|
|
478
|
+
return this.computeRowHeightMaps;
|
|
479
|
+
},
|
|
480
|
+
computeRowHeightMaps() {
|
|
477
481
|
return {
|
|
478
482
|
default: 48,
|
|
479
483
|
medium: 44,
|
|
@@ -1075,6 +1079,12 @@ export default {
|
|
|
1075
1079
|
mounted() {
|
|
1076
1080
|
const $xeTable = this;
|
|
1077
1081
|
const props = $xeTable;
|
|
1082
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
1083
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
1084
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
1085
|
+
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
1086
|
+
initTpImg();
|
|
1087
|
+
}
|
|
1078
1088
|
if (process.env.NODE_ENV === 'development') {
|
|
1079
1089
|
const { $listeners } = this;
|
|
1080
1090
|
if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
|
|
@@ -1105,18 +1115,11 @@ export default {
|
|
|
1105
1115
|
});
|
|
1106
1116
|
}
|
|
1107
1117
|
if (this.autoResize) {
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
if (this.autoResize) {
|
|
1112
|
-
handleWrapperResize();
|
|
1113
|
-
}
|
|
1118
|
+
const resizeObserver = globalResize.create(() => {
|
|
1119
|
+
if (this.autoResize) {
|
|
1120
|
+
this.recalculate(true);
|
|
1114
1121
|
}
|
|
1115
|
-
|
|
1116
|
-
if (this.autoResize) {
|
|
1117
|
-
this.recalculate(true);
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1122
|
+
});
|
|
1120
1123
|
resizeObserver.observe(this.$el);
|
|
1121
1124
|
resizeObserver.observe(this.getParentElem());
|
|
1122
1125
|
this.$resize = resizeObserver;
|
package/es/table/src/util.js
CHANGED
|
@@ -66,14 +66,19 @@ const lineOffsetSizes = {
|
|
|
66
66
|
small: 2,
|
|
67
67
|
medium: 1
|
|
68
68
|
};
|
|
69
|
-
export function restoreScrollLocation(
|
|
70
|
-
|
|
69
|
+
export function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
|
|
70
|
+
const internalData = $xeTable;
|
|
71
|
+
return $xeTable.clearScroll().then(() => {
|
|
71
72
|
if (scrollLeft || scrollTop) {
|
|
72
73
|
// 重置最后滚动状态
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
internalData.lastScrollLeft = 0;
|
|
75
|
+
internalData.lastScrollTop = 0;
|
|
76
|
+
internalData.inVirtualScroll = false;
|
|
77
|
+
internalData.inBodyScroll = false;
|
|
78
|
+
internalData.inFooterScroll = false;
|
|
79
|
+
internalData.bodyScrollType = '';
|
|
75
80
|
// 还原滚动状态
|
|
76
|
-
return
|
|
81
|
+
return $xeTable.scrollTo(scrollLeft, scrollTop);
|
|
77
82
|
}
|
|
78
83
|
});
|
|
79
84
|
}
|
package/es/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
import { getFuncText } from './src/utils';
|
|
3
|
-
export const version = "3.12.0-beta.
|
|
3
|
+
export const version = "3.12.0-beta.11";
|
|
4
4
|
VxeUI.version = version;
|
|
5
5
|
VxeUI.tableVersion = version;
|
|
6
6
|
VxeUI.setConfig({
|
|
@@ -31,7 +31,7 @@ VxeUI.setConfig({
|
|
|
31
31
|
// keyField: '_X_ROW_KEY' // 行数据的唯一主键字段名
|
|
32
32
|
// },
|
|
33
33
|
resizeConfig: {
|
|
34
|
-
// refreshDelay:
|
|
34
|
+
// refreshDelay: 20
|
|
35
35
|
},
|
|
36
36
|
resizableConfig: {
|
|
37
37
|
dragMode: 'auto',
|
package/es/ui/src/dom.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
2
|
const reClsMap = {};
|
|
3
3
|
export const browse = XEUtils.browse();
|
|
4
|
-
|
|
4
|
+
let tpImgEl;
|
|
5
|
+
export function initTpImg() {
|
|
6
|
+
if (!tpImgEl) {
|
|
7
|
+
tpImgEl = new Image();
|
|
8
|
+
tpImgEl.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
|
9
|
+
}
|
|
10
|
+
return tpImgEl;
|
|
11
|
+
}
|
|
12
|
+
export function getTpImg() {
|
|
13
|
+
if (!tpImgEl) {
|
|
14
|
+
return initTpImg();
|
|
15
|
+
}
|
|
16
|
+
return tpImgEl;
|
|
17
|
+
}
|
|
5
18
|
export function getPropClass(property, params) {
|
|
6
19
|
return property ? XEUtils.isFunction(property) ? property(params) : property : '';
|
|
7
20
|
}
|
package/es/ui/src/log.js
CHANGED