vxe-table 3.12.0-beta.1 → 3.12.0-beta.10
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 +77 -48
- package/es/table/src/table.js +7 -0
- package/es/table/src/util.js +10 -5
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +14 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +157 -109
- 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 +79 -56
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +7 -0
- 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 +1 -1
- 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 +89 -54
- package/packages/table/src/table.ts +9 -0
- package/packages/table/src/util.ts +12 -5
- package/packages/ui/src/dom.ts +16 -1
- /package/es/{iconfont.1735108867776.ttf → iconfont.1735365427273.ttf} +0 -0
- /package/es/{iconfont.1735108867776.woff → iconfont.1735365427273.woff} +0 -0
- /package/es/{iconfont.1735108867776.woff2 → iconfont.1735365427273.woff2} +0 -0
- /package/lib/{iconfont.1735108867776.ttf → iconfont.1735365427273.ttf} +0 -0
- /package/lib/{iconfont.1735108867776.woff → iconfont.1735365427273.woff} +0 -0
- /package/lib/{iconfont.1735108867776.woff2 → iconfont.1735365427273.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) {
|
|
@@ -722,7 +737,6 @@ const Methods = {
|
|
|
722
737
|
editStore.removeList = [];
|
|
723
738
|
editStore.removeMaps = {};
|
|
724
739
|
const sYLoad = this.updateScrollYStatus(fullData);
|
|
725
|
-
this.scrollYLoad = sYLoad;
|
|
726
740
|
this.isDragRowMove = false;
|
|
727
741
|
// 全量数据
|
|
728
742
|
this.tableFullData = fullData;
|
|
@@ -2711,7 +2725,7 @@ const Methods = {
|
|
|
2711
2725
|
internalData.rceTimeout = setTimeout(() => {
|
|
2712
2726
|
internalData.rceTimeout = undefined;
|
|
2713
2727
|
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
2714
|
-
},
|
|
2728
|
+
}, 15);
|
|
2715
2729
|
});
|
|
2716
2730
|
},
|
|
2717
2731
|
calcCellWidth() {
|
|
@@ -5196,14 +5210,16 @@ const Methods = {
|
|
|
5196
5210
|
$xeTable.closeMenu();
|
|
5197
5211
|
}
|
|
5198
5212
|
},
|
|
5213
|
+
triggerCellMouseupEvent() {
|
|
5214
|
+
const $xeTable = this;
|
|
5215
|
+
clearDragStatus($xeTable);
|
|
5216
|
+
},
|
|
5199
5217
|
/**
|
|
5200
5218
|
* 行拖拽
|
|
5201
5219
|
*/
|
|
5202
5220
|
handleRowDragDragstartEvent(evnt) {
|
|
5203
5221
|
if (evnt.dataTransfer) {
|
|
5204
|
-
|
|
5205
|
-
img.src = tpImg;
|
|
5206
|
-
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
5222
|
+
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
|
|
5207
5223
|
}
|
|
5208
5224
|
},
|
|
5209
5225
|
handleRowDragDragendEvent(evnt) {
|
|
@@ -5448,23 +5464,24 @@ const Methods = {
|
|
|
5448
5464
|
},
|
|
5449
5465
|
handleCellDragMouseupEvent() {
|
|
5450
5466
|
const $xeTable = this;
|
|
5451
|
-
|
|
5452
|
-
clearRowDropOrigin($xeTable);
|
|
5453
|
-
hideDropTip($xeTable);
|
|
5454
|
-
reactData.dragRow = null;
|
|
5455
|
-
reactData.dragCol = null;
|
|
5456
|
-
reactData.isDragRowMove = false;
|
|
5467
|
+
clearDragStatus($xeTable);
|
|
5457
5468
|
},
|
|
5458
5469
|
/**
|
|
5459
5470
|
* 列拖拽
|
|
5460
5471
|
*/
|
|
5461
5472
|
handleHeaderCellDragDragstartEvent(evnt) {
|
|
5462
5473
|
if (evnt.dataTransfer) {
|
|
5463
|
-
|
|
5464
|
-
img.src = tpImg;
|
|
5465
|
-
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
5474
|
+
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
|
|
5466
5475
|
}
|
|
5467
5476
|
},
|
|
5477
|
+
handleColDragSwapColumn() {
|
|
5478
|
+
const $xeTable = this;
|
|
5479
|
+
$xeTable.handleUpdateColumn();
|
|
5480
|
+
$xeTable.parseColumns(false).then(() => {
|
|
5481
|
+
$xeTable.updateCellAreas();
|
|
5482
|
+
$xeTable.saveCustomStore('update:sort');
|
|
5483
|
+
});
|
|
5484
|
+
},
|
|
5468
5485
|
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
5469
5486
|
const $xeTable = this;
|
|
5470
5487
|
const props = $xeTable;
|
|
@@ -5608,11 +5625,7 @@ const Methods = {
|
|
|
5608
5625
|
}
|
|
5609
5626
|
}, evnt);
|
|
5610
5627
|
if (isSyncColumn) {
|
|
5611
|
-
$xeTable.
|
|
5612
|
-
$xeTable.parseColumns(false).then(() => {
|
|
5613
|
-
$xeTable.updateCellAreas();
|
|
5614
|
-
return $xeTable.saveCustomStore('update:sort');
|
|
5615
|
-
});
|
|
5628
|
+
$xeTable.handleColDragSwapColumn();
|
|
5616
5629
|
}
|
|
5617
5630
|
}).catch(() => {
|
|
5618
5631
|
});
|
|
@@ -6803,12 +6816,14 @@ const Methods = {
|
|
|
6803
6816
|
scrollXEvent(evnt) {
|
|
6804
6817
|
const $xeTable = this;
|
|
6805
6818
|
const internalData = $xeTable;
|
|
6806
|
-
const { inFooterScroll, inBodyScroll, lastScrollTop } = internalData;
|
|
6807
|
-
if (
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6819
|
+
const { intoRunScroll, inFooterScroll, inBodyScroll, lastScrollTop } = internalData;
|
|
6820
|
+
if (!intoRunScroll) {
|
|
6821
|
+
if (inFooterScroll) {
|
|
6822
|
+
return;
|
|
6823
|
+
}
|
|
6824
|
+
if (inBodyScroll) {
|
|
6825
|
+
return;
|
|
6826
|
+
}
|
|
6812
6827
|
}
|
|
6813
6828
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
6814
6829
|
const tableBody = $xeTable.$refs.tableBody;
|
|
@@ -6839,12 +6854,14 @@ const Methods = {
|
|
|
6839
6854
|
scrollYEvent(evnt) {
|
|
6840
6855
|
const $xeTable = this;
|
|
6841
6856
|
const internalData = $xeTable;
|
|
6842
|
-
const { inFooterScroll, inBodyScroll, lastScrollLeft } = internalData;
|
|
6843
|
-
if (
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6857
|
+
const { intoRunScroll, inFooterScroll, inBodyScroll, lastScrollLeft } = internalData;
|
|
6858
|
+
if (!intoRunScroll) {
|
|
6859
|
+
if (inFooterScroll) {
|
|
6860
|
+
return;
|
|
6861
|
+
}
|
|
6862
|
+
if (inBodyScroll) {
|
|
6863
|
+
return;
|
|
6864
|
+
}
|
|
6848
6865
|
}
|
|
6849
6866
|
const tableBody = $xeTable.$refs.tableBody;
|
|
6850
6867
|
const leftBody = $xeTable.$refs.leftBody;
|
|
@@ -6961,7 +6978,6 @@ const Methods = {
|
|
|
6961
6978
|
const $xeTable = this;
|
|
6962
6979
|
const props = $xeTable;
|
|
6963
6980
|
const { showOverflow } = props;
|
|
6964
|
-
// this.tableColumn = []
|
|
6965
6981
|
return $xeTable.$nextTick().then(() => {
|
|
6966
6982
|
$xeTable.handleTableColumn();
|
|
6967
6983
|
calcCellHeight($xeTable);
|
|
@@ -7014,7 +7030,6 @@ const Methods = {
|
|
|
7014
7030
|
},
|
|
7015
7031
|
updateScrollYData() {
|
|
7016
7032
|
const $xeTable = this;
|
|
7017
|
-
// this.tableData = []
|
|
7018
7033
|
return $xeTable.$nextTick().then(() => {
|
|
7019
7034
|
$xeTable.handleTableData();
|
|
7020
7035
|
calcCellHeight($xeTable);
|
|
@@ -7083,6 +7098,7 @@ const Methods = {
|
|
|
7083
7098
|
*/
|
|
7084
7099
|
scrollTo(scrollLeft, scrollTop) {
|
|
7085
7100
|
const $xeTable = this;
|
|
7101
|
+
const internalData = $xeTable;
|
|
7086
7102
|
const { $refs } = this;
|
|
7087
7103
|
const { tableBody, tableHeader, leftBody, rightBody, tableFooter } = $refs;
|
|
7088
7104
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
@@ -7090,6 +7106,7 @@ const Methods = {
|
|
|
7090
7106
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
7091
7107
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
7092
7108
|
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
|
7109
|
+
internalData.intoRunScroll = true;
|
|
7093
7110
|
if (XEUtils.isNumber(scrollLeft)) {
|
|
7094
7111
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7095
7112
|
if (xHandleEl) {
|
|
@@ -7113,7 +7130,14 @@ const Methods = {
|
|
|
7113
7130
|
}
|
|
7114
7131
|
}
|
|
7115
7132
|
if (this.scrollXLoad || this.scrollYLoad) {
|
|
7116
|
-
return new Promise(resolve =>
|
|
7133
|
+
return new Promise(resolve => {
|
|
7134
|
+
setTimeout(() => {
|
|
7135
|
+
$xeTable.$nextTick(() => {
|
|
7136
|
+
internalData.intoRunScroll = false;
|
|
7137
|
+
resolve();
|
|
7138
|
+
});
|
|
7139
|
+
});
|
|
7140
|
+
});
|
|
7117
7141
|
}
|
|
7118
7142
|
return this.$nextTick();
|
|
7119
7143
|
},
|
|
@@ -7173,10 +7197,15 @@ const Methods = {
|
|
|
7173
7197
|
*/
|
|
7174
7198
|
clearScroll() {
|
|
7175
7199
|
const $xeTable = this;
|
|
7176
|
-
const
|
|
7177
|
-
const {
|
|
7178
|
-
const
|
|
7200
|
+
const internalData = $xeTable;
|
|
7201
|
+
const { scrollXStore, scrollYStore } = internalData;
|
|
7202
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
7203
|
+
const tableHeader = $xeTable.$refs.tableHeader;
|
|
7204
|
+
const tableFooter = $xeTable.$refs.tableFooter;
|
|
7205
|
+
const leftBody = $xeTable.$refs.leftBody;
|
|
7206
|
+
const rightBody = $xeTable.$refs.rightBody;
|
|
7179
7207
|
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
7208
|
+
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
7180
7209
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
7181
7210
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
7182
7211
|
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';
|
|
@@ -1075,6 +1076,12 @@ export default {
|
|
|
1075
1076
|
mounted() {
|
|
1076
1077
|
const $xeTable = this;
|
|
1077
1078
|
const props = $xeTable;
|
|
1079
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
1080
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
1081
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
1082
|
+
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
1083
|
+
initTpImg();
|
|
1084
|
+
}
|
|
1078
1085
|
if (process.env.NODE_ENV === 'development') {
|
|
1079
1086
|
const { $listeners } = this;
|
|
1080
1087
|
if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
|
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
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