vxe-table 3.12.8 → 3.12.10-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +6 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/export/mixin.js +3 -3
- package/es/table/module/filter/mixin.js +3 -3
- package/es/table/module/keyboard/mixin.js +4 -4
- package/es/table/module/menu/mixin.js +2 -2
- package/es/table/module/validator/mixin.js +2 -2
- package/es/table/src/body.js +262 -363
- package/es/table/src/footer.js +135 -154
- package/es/table/src/header.js +120 -100
- package/es/table/src/methods.js +1175 -816
- package/es/table/src/props.js +9 -3
- package/es/table/src/table.js +187 -103
- package/es/table/src/util.js +35 -21
- package/es/table/style.css +146 -63
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +14 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +146 -63
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +4 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1920 -1599
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/export/mixin.js +3 -3
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/filter/mixin.js +4 -4
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +5 -5
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +2 -2
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +2 -2
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +205 -381
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +124 -151
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +97 -74
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1261 -875
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +9 -3
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +171 -90
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +38 -22
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +146 -63
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +14 -4
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +146 -63
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +6 -1
- package/packages/table/module/export/mixin.ts +3 -3
- package/packages/table/module/filter/mixin.ts +3 -3
- package/packages/table/module/keyboard/mixin.ts +4 -4
- package/packages/table/module/menu/mixin.ts +2 -2
- package/packages/table/module/validator/mixin.ts +2 -2
- package/packages/table/src/body.ts +296 -436
- package/packages/table/src/footer.ts +148 -164
- package/packages/table/src/header.ts +135 -111
- package/packages/table/src/methods.ts +1249 -873
- package/packages/table/src/props.ts +9 -3
- package/packages/table/src/table.ts +195 -146
- package/packages/table/src/util.ts +40 -23
- package/packages/ui/index.ts +13 -3
- package/styles/components/table.scss +164 -74
- /package/es/{iconfont.1736406699090.ttf → iconfont.1736688976404.ttf} +0 -0
- /package/es/{iconfont.1736406699090.woff → iconfont.1736688976404.woff} +0 -0
- /package/es/{iconfont.1736406699090.woff2 → iconfont.1736688976404.woff2} +0 -0
- /package/lib/{iconfont.1736406699090.ttf → iconfont.1736688976404.ttf} +0 -0
- /package/lib/{iconfont.1736406699090.woff → iconfont.1736688976404.woff} +0 -0
- /package/lib/{iconfont.1736406699090.woff2 → iconfont.1736688976404.woff2} +0 -0
package/lib/table/src/body.js
CHANGED
|
@@ -18,46 +18,60 @@ const {
|
|
|
18
18
|
} = _ui.VxeUI;
|
|
19
19
|
const renderType = 'body';
|
|
20
20
|
// 滚动、拖动过程中不需要触发
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const isVMScrollProcess = $xeTable => {
|
|
22
|
+
const tableProps = $xeTable;
|
|
23
|
+
const tableReactData = $xeTable;
|
|
24
|
+
const {
|
|
25
|
+
delayHover
|
|
26
|
+
} = tableProps;
|
|
27
|
+
const {
|
|
28
|
+
lastScrollTime,
|
|
29
|
+
_isResize
|
|
30
|
+
} = tableReactData;
|
|
31
|
+
return !!(_isResize || lastScrollTime && Date.now() < lastScrollTime + delayHover);
|
|
32
|
+
};
|
|
33
|
+
function renderLine(h, _vm, params) {
|
|
34
|
+
const $xeTable = _vm.$parent;
|
|
35
|
+
const tableProps = $xeTable;
|
|
36
|
+
const tableInternalData = $xeTable;
|
|
25
37
|
const {
|
|
26
38
|
row,
|
|
27
39
|
column
|
|
28
40
|
} = params;
|
|
29
41
|
const {
|
|
30
|
-
afterFullData
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} =
|
|
42
|
+
afterFullData
|
|
43
|
+
} = tableInternalData;
|
|
44
|
+
const {
|
|
45
|
+
treeConfig
|
|
46
|
+
} = tableProps;
|
|
47
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
35
48
|
const {
|
|
36
49
|
slots,
|
|
37
50
|
treeNode
|
|
38
51
|
} = column;
|
|
39
|
-
const
|
|
52
|
+
const {
|
|
53
|
+
fullAllDataRowIdData
|
|
54
|
+
} = tableInternalData;
|
|
55
|
+
if (slots && slots.line) {
|
|
56
|
+
return $xeTable.callSlot(slots.line, params, h);
|
|
57
|
+
}
|
|
58
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
40
59
|
const rest = fullAllDataRowIdData[rowid];
|
|
41
60
|
let rLevel = 0;
|
|
42
|
-
let
|
|
43
|
-
let items = [];
|
|
61
|
+
let prevRow = null;
|
|
44
62
|
if (rest) {
|
|
45
63
|
rLevel = rest.level;
|
|
46
|
-
|
|
47
|
-
items = rest.items;
|
|
48
|
-
}
|
|
49
|
-
if (slots && slots.line) {
|
|
50
|
-
return $xetable.callSlot(slots.line, params, h);
|
|
64
|
+
prevRow = rest.items[rest._index - 1];
|
|
51
65
|
}
|
|
52
|
-
const isFirstRow = $
|
|
66
|
+
const isFirstRow = $xeTable.eqRow(afterFullData[0], row);
|
|
53
67
|
if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
|
|
54
68
|
return [h('div', {
|
|
55
69
|
class: 'vxe-tree--line-wrapper'
|
|
56
70
|
}, [h('div', {
|
|
57
71
|
class: 'vxe-tree--line',
|
|
58
72
|
style: {
|
|
59
|
-
height: `${isFirstRow ? 1 : (0, _util.calcTreeLine)(params,
|
|
60
|
-
left: `${rLevel * treeOpts.indent + (rLevel ? 2 - (0, _util.getOffsetSize)($
|
|
73
|
+
height: `${isFirstRow ? 1 : (0, _util.calcTreeLine)(params, prevRow)}px`,
|
|
74
|
+
left: `${rLevel * treeOpts.indent + (rLevel ? 2 - (0, _util.getOffsetSize)($xeTable) : 0) + 16}px`
|
|
61
75
|
}
|
|
62
76
|
})])];
|
|
63
77
|
}
|
|
@@ -66,56 +80,63 @@ function renderLine(h, _vm, $xetable, params) {
|
|
|
66
80
|
/**
|
|
67
81
|
* 渲染列
|
|
68
82
|
*/
|
|
69
|
-
function
|
|
83
|
+
function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
|
|
84
|
+
const $xeTable = _vm.$parent;
|
|
85
|
+
const tableProps = $xeTable;
|
|
86
|
+
const tableReactData = $xeTable;
|
|
87
|
+
const tableInternalData = $xeTable;
|
|
88
|
+
const {
|
|
89
|
+
fullAllDataRowIdData
|
|
90
|
+
} = tableInternalData;
|
|
70
91
|
const {
|
|
71
|
-
$listeners: tableListeners,
|
|
72
|
-
fullAllDataRowIdData,
|
|
73
|
-
afterFullData,
|
|
74
|
-
tableData,
|
|
75
|
-
height,
|
|
76
92
|
columnKey,
|
|
77
|
-
|
|
78
|
-
sYOpts,
|
|
79
|
-
scrollXLoad,
|
|
80
|
-
scrollYLoad,
|
|
81
|
-
isCalcCellHeight,
|
|
82
|
-
highlightCurrentRow,
|
|
93
|
+
height,
|
|
83
94
|
showOverflow: allColumnOverflow,
|
|
84
|
-
isAllOverflow,
|
|
85
|
-
align: allAlign,
|
|
86
|
-
currentColumn,
|
|
87
95
|
cellClassName: allCellClassName,
|
|
88
96
|
cellStyle,
|
|
89
|
-
|
|
97
|
+
align: allAlign,
|
|
90
98
|
spanMethod,
|
|
91
|
-
radioOpts,
|
|
92
|
-
checkboxOpts,
|
|
93
|
-
expandOpts,
|
|
94
|
-
treeOpts,
|
|
95
|
-
tooltipOpts,
|
|
96
99
|
mouseConfig,
|
|
97
100
|
editConfig,
|
|
98
|
-
editOpts,
|
|
99
101
|
editRules,
|
|
100
|
-
|
|
102
|
+
tooltipConfig
|
|
103
|
+
} = tableProps;
|
|
104
|
+
const {
|
|
105
|
+
tableData,
|
|
106
|
+
overflowX,
|
|
107
|
+
currentColumn,
|
|
108
|
+
scrollXLoad,
|
|
109
|
+
scrollYLoad,
|
|
110
|
+
isCalcCellHeight,
|
|
111
|
+
mergeList,
|
|
101
112
|
editStore,
|
|
102
|
-
|
|
103
|
-
rowOpts,
|
|
104
|
-
columnOpts,
|
|
105
|
-
mouseOpts,
|
|
106
|
-
areaOpts,
|
|
113
|
+
isAllOverflow,
|
|
107
114
|
validErrorMaps
|
|
108
|
-
} =
|
|
115
|
+
} = tableReactData;
|
|
116
|
+
const {
|
|
117
|
+
afterFullData,
|
|
118
|
+
scrollXStore,
|
|
119
|
+
scrollYStore
|
|
120
|
+
} = tableInternalData;
|
|
121
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
122
|
+
const validOpts = $xeTable.computeValidOpts;
|
|
123
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
124
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
125
|
+
const tooltipOpts = $xeTable.computeTooltipOpts;
|
|
126
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
109
127
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
128
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
110
129
|
const {
|
|
111
130
|
disabledMethod: dragDisabledMethod,
|
|
112
131
|
isCrossDrag,
|
|
113
132
|
isPeerDrag
|
|
114
133
|
} = rowDragOpts;
|
|
134
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
135
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
136
|
+
const areaOpts = $xeTable.computeAreaOpts;
|
|
115
137
|
const {
|
|
116
138
|
selectCellToRow
|
|
117
139
|
} = areaOpts;
|
|
118
|
-
const cellOpts = $xeTable.computeCellOpts;
|
|
119
140
|
const {
|
|
120
141
|
type,
|
|
121
142
|
cellRender,
|
|
@@ -133,16 +154,14 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
133
154
|
actived
|
|
134
155
|
} = editStore;
|
|
135
156
|
const {
|
|
136
|
-
|
|
137
|
-
} = sYOpts;
|
|
138
|
-
const {
|
|
139
|
-
height: rowHeight
|
|
157
|
+
height: customRHeight
|
|
140
158
|
} = rowOpts;
|
|
159
|
+
const colid = column.id;
|
|
141
160
|
const renderOpts = editRender || cellRender;
|
|
142
161
|
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
143
|
-
const compCellClassName = compConf ? compConf.tableCellClassName || compConf.cellClassName :
|
|
162
|
+
const compCellClassName = compConf ? compConf.tableCellClassName || compConf.cellClassName : null;
|
|
144
163
|
const compCellStyle = compConf ? compConf.tableCellStyle || compConf.cellStyle : '';
|
|
145
|
-
const showAllTip = tooltipOpts.showAll
|
|
164
|
+
const showAllTip = tooltipOpts.showAll;
|
|
146
165
|
const columnIndex = $xeTable.getColumnIndex(column);
|
|
147
166
|
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
148
167
|
const isEdit = (0, _utils.isEnableConf)(editRender);
|
|
@@ -157,17 +176,14 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
157
176
|
const tdOns = {};
|
|
158
177
|
const rest = fullAllDataRowIdData[rowid];
|
|
159
178
|
const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
160
|
-
const errorValidItem = validErrorMaps[`${rowid}:${
|
|
179
|
+
const errorValidItem = validErrorMaps[`${rowid}:${colid}`];
|
|
161
180
|
const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? height || tableData.length > 1 : validOpts.message === 'inline');
|
|
162
181
|
const attrs = {
|
|
163
|
-
colid
|
|
182
|
+
colid
|
|
164
183
|
};
|
|
165
|
-
const bindMouseenter = tableListeners['cell-mouseenter'];
|
|
166
|
-
const bindMouseleave = tableListeners['cell-mouseleave'];
|
|
167
|
-
const triggerDblclick = editRender && editConfig && editOpts.trigger === 'dblclick';
|
|
168
184
|
const params = {
|
|
169
185
|
$table: $xeTable,
|
|
170
|
-
$grid: $xeTable
|
|
186
|
+
$grid: $xeTable.xegrid,
|
|
171
187
|
isEdit: false,
|
|
172
188
|
seq,
|
|
173
189
|
rowid,
|
|
@@ -181,7 +197,7 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
181
197
|
_columnIndex,
|
|
182
198
|
fixed: fixedType,
|
|
183
199
|
type: renderType,
|
|
184
|
-
isHidden: fixedHiddenColumn,
|
|
200
|
+
isHidden: !!fixedHiddenColumn,
|
|
185
201
|
level: rowLevel,
|
|
186
202
|
visibleData: afterFullData,
|
|
187
203
|
data: tableData,
|
|
@@ -196,7 +212,7 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
196
212
|
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params));
|
|
197
213
|
}
|
|
198
214
|
// hover 进入事件
|
|
199
|
-
if (showTitle || showTooltip || showAllTip ||
|
|
215
|
+
if (showTitle || showTooltip || showAllTip || tooltipConfig) {
|
|
200
216
|
tdOns.mouseenter = evnt => {
|
|
201
217
|
if (isVMScrollProcess($xeTable)) {
|
|
202
218
|
return;
|
|
@@ -207,15 +223,13 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
207
223
|
// 如果配置了显示 tooltip
|
|
208
224
|
$xeTable.triggerBodyTooltipEvent(evnt, params);
|
|
209
225
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}, params), evnt);
|
|
214
|
-
}
|
|
226
|
+
$xeTable.dispatchEvent('cell-mouseenter', Object.assign({
|
|
227
|
+
cell: evnt.currentTarget
|
|
228
|
+
}, params), evnt);
|
|
215
229
|
};
|
|
216
230
|
}
|
|
217
231
|
// hover 退出事件
|
|
218
|
-
if (showTooltip || showAllTip ||
|
|
232
|
+
if (showTooltip || showAllTip || tooltipConfig) {
|
|
219
233
|
tdOns.mouseleave = evnt => {
|
|
220
234
|
if (isVMScrollProcess($xeTable)) {
|
|
221
235
|
return;
|
|
@@ -223,11 +237,9 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
223
237
|
if (showTooltip || showAllTip) {
|
|
224
238
|
$xeTable.handleTargetLeaveEvent(evnt);
|
|
225
239
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}, params), evnt);
|
|
230
|
-
}
|
|
240
|
+
$xeTable.dispatchEvent('cell-mouseleave', Object.assign({
|
|
241
|
+
cell: evnt.currentTarget
|
|
242
|
+
}, params), evnt);
|
|
231
243
|
};
|
|
232
244
|
}
|
|
233
245
|
// 按下事件处理
|
|
@@ -241,17 +253,13 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
241
253
|
tdOns.mouseup = $xeTable.triggerCellMouseupEvent;
|
|
242
254
|
}
|
|
243
255
|
// 点击事件处理
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
};
|
|
248
|
-
}
|
|
256
|
+
tdOns.click = evnt => {
|
|
257
|
+
$xeTable.triggerCellClickEvent(evnt, params);
|
|
258
|
+
};
|
|
249
259
|
// 双击事件处理
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
};
|
|
254
|
-
}
|
|
260
|
+
tdOns.dblclick = evnt => {
|
|
261
|
+
$xeTable.triggerCellDblclickEvent(evnt, params);
|
|
262
|
+
};
|
|
255
263
|
// 合并行或列
|
|
256
264
|
if (mergeList.length) {
|
|
257
265
|
const spanRest = (0, _util.mergeBodyMethod)(mergeList, _rowIndex, _columnIndex);
|
|
@@ -305,19 +313,19 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
305
313
|
'c--ellipsis': showEllipsis
|
|
306
314
|
}],
|
|
307
315
|
style: {
|
|
308
|
-
maxHeight: hasEllipsis && (
|
|
316
|
+
maxHeight: hasEllipsis && (customRHeight || defaultRowHeight) ? `${customRHeight || defaultRowHeight}px` : ''
|
|
309
317
|
}
|
|
310
318
|
}));
|
|
311
319
|
} else {
|
|
312
320
|
// 渲染单元格
|
|
313
|
-
tdVNs.push(...renderLine(h, _vm,
|
|
321
|
+
tdVNs.push(...renderLine(h, _vm, params), h('div', {
|
|
314
322
|
class: ['vxe-cell', {
|
|
315
323
|
'c--title': showTitle,
|
|
316
324
|
'c--tooltip': showTooltip,
|
|
317
325
|
'c--ellipsis': showEllipsis
|
|
318
326
|
}],
|
|
319
327
|
style: {
|
|
320
|
-
maxHeight: hasEllipsis && (
|
|
328
|
+
maxHeight: hasEllipsis && (customRHeight || defaultRowHeight) ? `${customRHeight || defaultRowHeight}px` : ''
|
|
321
329
|
},
|
|
322
330
|
attrs: {
|
|
323
331
|
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
@@ -333,7 +341,7 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
333
341
|
class: ['vxe-cell--valid-error-tip', (0, _utils.getClass)(validOpts.className, errorValidItem)],
|
|
334
342
|
style: errRule && errRule.maxWidth ? {
|
|
335
343
|
width: `${errRule.maxWidth}px`
|
|
336
|
-
} :
|
|
344
|
+
} : undefined
|
|
337
345
|
}, [h('div', {
|
|
338
346
|
class: `vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-${validOpts.theme || 'normal'}`
|
|
339
347
|
}, [validSlot ? $xeTable.callSlot(validSlot, validParams, h) : [h('span', {
|
|
@@ -344,13 +352,13 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
344
352
|
let cellHeight = '';
|
|
345
353
|
const vnHeight = isCalcCellHeight ? rest.height : 0;
|
|
346
354
|
if (hasEllipsis) {
|
|
347
|
-
if (
|
|
348
|
-
cellHeight = `${
|
|
355
|
+
if (customRHeight) {
|
|
356
|
+
cellHeight = `${customRHeight}px`;
|
|
349
357
|
} else if (!isAllOverflow) {
|
|
350
|
-
cellHeight = `${vnHeight ||
|
|
358
|
+
cellHeight = `${vnHeight || defaultRowHeight || 18}px`;
|
|
351
359
|
}
|
|
352
360
|
} else {
|
|
353
|
-
cellHeight = `${vnHeight ||
|
|
361
|
+
cellHeight = `${vnHeight || defaultRowHeight || 18}px`;
|
|
354
362
|
}
|
|
355
363
|
if (mouseConfig && mouseOpts.area && selectCellToRow) {
|
|
356
364
|
if (!$columnIndex && selectCellToRow === true || selectCellToRow === column.field) {
|
|
@@ -360,6 +368,12 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
360
368
|
}
|
|
361
369
|
}
|
|
362
370
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
371
|
+
let isPreLoadStatus = false;
|
|
372
|
+
if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex || _rowIndex > scrollYStore.visibleEndIndex)) {
|
|
373
|
+
isPreLoadStatus = true;
|
|
374
|
+
} else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
|
|
375
|
+
isPreLoadStatus = true;
|
|
376
|
+
}
|
|
363
377
|
return h('td', {
|
|
364
378
|
class: ['vxe-body--column', column.id, {
|
|
365
379
|
[`col--${cellAlign}`]: cellAlign,
|
|
@@ -384,36 +398,44 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
384
398
|
height: cellHeight
|
|
385
399
|
}, _xeUtils.default.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, _xeUtils.default.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
|
|
386
400
|
on: tdOns
|
|
387
|
-
}, tdVNs);
|
|
401
|
+
}, isPreLoadStatus || isOptimizeMode && fixedHiddenColumn ? [] : tdVNs);
|
|
388
402
|
}
|
|
389
|
-
function renderRows(h, _vm,
|
|
390
|
-
const
|
|
391
|
-
const
|
|
403
|
+
function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
404
|
+
const $xeTable = _vm.$parent;
|
|
405
|
+
const tableProps = $xeTable;
|
|
406
|
+
const tableReactData = $xeTable;
|
|
407
|
+
const tableInternalData = $xeTable;
|
|
392
408
|
const {
|
|
393
409
|
stripe,
|
|
394
410
|
rowKey,
|
|
395
411
|
highlightHoverRow,
|
|
396
412
|
rowClassName,
|
|
397
413
|
rowStyle,
|
|
398
|
-
editConfig,
|
|
399
414
|
showOverflow: allColumnOverflow,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
415
|
+
editConfig,
|
|
416
|
+
treeConfig
|
|
417
|
+
} = tableProps;
|
|
418
|
+
const {
|
|
419
|
+
hasFixedColumn,
|
|
404
420
|
treeExpandedMaps,
|
|
405
421
|
scrollXLoad,
|
|
406
422
|
scrollYLoad,
|
|
407
423
|
rowExpandedMaps,
|
|
408
|
-
radioOpts,
|
|
409
|
-
checkboxOpts,
|
|
410
424
|
expandColumn,
|
|
411
|
-
|
|
412
|
-
fullAllDataRowIdData,
|
|
413
|
-
rowOpts,
|
|
425
|
+
selectRadioRow,
|
|
414
426
|
pendingRowMaps,
|
|
415
427
|
isDragColMove
|
|
416
|
-
} =
|
|
428
|
+
} = tableReactData;
|
|
429
|
+
const {
|
|
430
|
+
fullAllDataRowIdData
|
|
431
|
+
} = tableInternalData;
|
|
432
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
433
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
434
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
435
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
436
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
437
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
438
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
417
439
|
const {
|
|
418
440
|
transform,
|
|
419
441
|
seqMode
|
|
@@ -466,7 +488,8 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
466
488
|
level: rowLevel,
|
|
467
489
|
row,
|
|
468
490
|
rowIndex,
|
|
469
|
-
$rowIndex
|
|
491
|
+
$rowIndex,
|
|
492
|
+
_rowIndex
|
|
470
493
|
};
|
|
471
494
|
// 行是否被展开
|
|
472
495
|
const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
|
|
@@ -494,12 +517,12 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
494
517
|
'is--expand-row': isExpandRow,
|
|
495
518
|
'is--expand-tree': isExpandTree,
|
|
496
519
|
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
497
|
-
'row--radio': radioOpts.highlight &&
|
|
520
|
+
'row--radio': radioOpts.highlight && selectRadioRow === row,
|
|
498
521
|
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
499
522
|
'row--pending': !!pendingRowMaps[rowid]
|
|
500
523
|
}, rowClassName ? _xeUtils.default.isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''];
|
|
501
524
|
const tdVNs = tableColumn.map((column, $columnIndex) => {
|
|
502
|
-
return
|
|
525
|
+
return renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
|
|
503
526
|
});
|
|
504
527
|
rows.push(columnOpts.drag && columnDragOpts.animation ? h('transition-group', {
|
|
505
528
|
props: {
|
|
@@ -510,7 +533,7 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
510
533
|
attrs: {
|
|
511
534
|
rowid
|
|
512
535
|
},
|
|
513
|
-
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(params) : rowStyle :
|
|
536
|
+
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
|
|
514
537
|
key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
|
|
515
538
|
nativeOn: trOn
|
|
516
539
|
}, tdVNs) : h('tr', {
|
|
@@ -518,12 +541,13 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
518
541
|
attrs: {
|
|
519
542
|
rowid
|
|
520
543
|
},
|
|
521
|
-
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(params) : rowStyle :
|
|
544
|
+
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(params) : rowStyle : undefined,
|
|
522
545
|
key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
|
|
523
546
|
on: trOn
|
|
524
547
|
}, tdVNs));
|
|
525
548
|
// 如果行被展开了
|
|
526
549
|
if (isExpandRow) {
|
|
550
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
527
551
|
const {
|
|
528
552
|
height: expandHeight,
|
|
529
553
|
padding
|
|
@@ -548,14 +572,15 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
548
572
|
level: rowLevel,
|
|
549
573
|
row,
|
|
550
574
|
rowIndex,
|
|
551
|
-
$rowIndex
|
|
575
|
+
$rowIndex,
|
|
576
|
+
_rowIndex
|
|
552
577
|
};
|
|
553
578
|
rows.push(h('tr', {
|
|
554
579
|
class: ['vxe-body--expanded-row', {
|
|
555
580
|
'is--padding': padding
|
|
556
581
|
}],
|
|
557
582
|
key: `expand_${rowid}`,
|
|
558
|
-
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(expandParams) : rowStyle :
|
|
583
|
+
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(expandParams) : rowStyle : undefined,
|
|
559
584
|
on: trOn
|
|
560
585
|
}, [h('td', {
|
|
561
586
|
class: {
|
|
@@ -576,7 +601,7 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
576
601
|
}
|
|
577
602
|
// 如果是树形表格
|
|
578
603
|
if (isExpandTree) {
|
|
579
|
-
rows.push(...renderRows(h, _vm,
|
|
604
|
+
rows.push(...renderRows(h, _vm, fixedType, isOptimizeMode, rowChildren, tableColumn));
|
|
580
605
|
}
|
|
581
606
|
});
|
|
582
607
|
return rows;
|
|
@@ -587,49 +612,45 @@ var _default = exports.default = {
|
|
|
587
612
|
tableData: Array,
|
|
588
613
|
tableColumn: Array,
|
|
589
614
|
fixedColumn: Array,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return {
|
|
595
|
-
wheelTime: null,
|
|
596
|
-
wheelYSize: 0,
|
|
597
|
-
wheelYInterval: 0,
|
|
598
|
-
wheelYTotal: 0
|
|
599
|
-
};
|
|
615
|
+
fixedType: {
|
|
616
|
+
type: String,
|
|
617
|
+
default: ''
|
|
618
|
+
}
|
|
600
619
|
},
|
|
601
620
|
mounted() {
|
|
621
|
+
const _vm = this;
|
|
622
|
+
const props = _vm;
|
|
623
|
+
const $xeTable = _vm.$parent;
|
|
624
|
+
const tableInternalData = $xeTable;
|
|
602
625
|
const {
|
|
603
|
-
$parent: $xetable,
|
|
604
|
-
$el,
|
|
605
|
-
$refs,
|
|
606
626
|
fixedType
|
|
607
|
-
} =
|
|
627
|
+
} = props;
|
|
608
628
|
const {
|
|
609
629
|
elemStore
|
|
610
|
-
} =
|
|
630
|
+
} = tableInternalData;
|
|
611
631
|
const prefix = `${fixedType || 'main'}-body-`;
|
|
612
|
-
elemStore[`${prefix}wrapper`] =
|
|
613
|
-
elemStore[`${prefix}
|
|
614
|
-
elemStore[`${prefix}
|
|
615
|
-
elemStore[`${prefix}
|
|
616
|
-
elemStore[`${prefix}
|
|
617
|
-
elemStore[`${prefix}
|
|
618
|
-
elemStore[`${prefix}
|
|
619
|
-
|
|
620
|
-
beforeDestroy() {
|
|
621
|
-
clearTimeout(this.wheelTime);
|
|
632
|
+
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
|
|
633
|
+
elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll;
|
|
634
|
+
elemStore[`${prefix}table`] = _vm.$refs.refBodyTable;
|
|
635
|
+
elemStore[`${prefix}colgroup`] = _vm.$refs.refBodyColgroup;
|
|
636
|
+
elemStore[`${prefix}list`] = _vm.$refs.refBodyTBody;
|
|
637
|
+
elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace;
|
|
638
|
+
elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace;
|
|
639
|
+
elemStore[`${prefix}emptyBlock`] = _vm.$refs.refBodyEmptyBlock;
|
|
622
640
|
},
|
|
623
641
|
destroyed() {
|
|
642
|
+
const props = this;
|
|
643
|
+
const $xeTable = this.$parent;
|
|
644
|
+
const tableInternalData = $xeTable;
|
|
624
645
|
const {
|
|
625
|
-
$parent: $xetable,
|
|
626
646
|
fixedType
|
|
627
|
-
} =
|
|
647
|
+
} = props;
|
|
628
648
|
const {
|
|
629
649
|
elemStore
|
|
630
|
-
} =
|
|
650
|
+
} = tableInternalData;
|
|
631
651
|
const prefix = `${fixedType || 'main'}-body-`;
|
|
632
652
|
elemStore[`${prefix}wrapper`] = null;
|
|
653
|
+
elemStore[`${prefix}scroll`] = null;
|
|
633
654
|
elemStore[`${prefix}table`] = null;
|
|
634
655
|
elemStore[`${prefix}colgroup`] = null;
|
|
635
656
|
elemStore[`${prefix}list`] = null;
|
|
@@ -644,7 +665,7 @@ var _default = exports.default = {
|
|
|
644
665
|
const tableReactData = $xeTable;
|
|
645
666
|
const tableInternalData = $xeTable;
|
|
646
667
|
const {
|
|
647
|
-
|
|
668
|
+
xID,
|
|
648
669
|
$scopedSlots
|
|
649
670
|
} = $xeTable;
|
|
650
671
|
const {
|
|
@@ -675,23 +696,26 @@ var _default = exports.default = {
|
|
|
675
696
|
fullColumnIdData
|
|
676
697
|
} = tableInternalData;
|
|
677
698
|
const rowOpts = $xeTable.computeRowOpts;
|
|
678
|
-
const sYOpts = $xeTable.computeSYOpts;
|
|
679
699
|
const emptyOpts = $xeTable.computeEmptyOpts;
|
|
680
700
|
const mouseOpts = $xeTable.computeMouseOpts;
|
|
681
701
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
702
|
+
const leftFixedWidth = $xeTable.computeLeftFixedWidth;
|
|
703
|
+
const rightFixedWidth = $xeTable.computeRightFixedWidth;
|
|
682
704
|
let renderDataList = tableData;
|
|
683
705
|
let renderColumnList = tableColumn;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
706
|
+
let isOptimizeMode = false;
|
|
707
|
+
// 如果是使用优化模式
|
|
708
|
+
if (scrollXLoad || scrollYLoad || allColumnOverflow && isAllOverflow) {
|
|
709
|
+
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
687
710
|
// 如果不支持优化模式
|
|
688
|
-
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
689
|
-
renderColumnList = visibleColumn;
|
|
690
|
-
} else {
|
|
691
|
-
renderColumnList = fixedColumn || [];
|
|
692
|
-
}
|
|
693
711
|
} else {
|
|
694
|
-
|
|
712
|
+
isOptimizeMode = true;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (fixedType) {
|
|
716
|
+
renderColumnList = visibleColumn;
|
|
717
|
+
if (isOptimizeMode) {
|
|
718
|
+
renderColumnList = fixedColumn || [];
|
|
695
719
|
}
|
|
696
720
|
}
|
|
697
721
|
// 行拖拽
|
|
@@ -745,7 +769,7 @@ var _default = exports.default = {
|
|
|
745
769
|
emptyContent = $scopedSlots.empty.call(this, {
|
|
746
770
|
$table: $xeTable,
|
|
747
771
|
$grid: $xeTable.xegrid
|
|
748
|
-
}
|
|
772
|
+
});
|
|
749
773
|
} else {
|
|
750
774
|
const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null;
|
|
751
775
|
const rtEmptyView = compConf ? compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty : null;
|
|
@@ -758,39 +782,44 @@ var _default = exports.default = {
|
|
|
758
782
|
}
|
|
759
783
|
}
|
|
760
784
|
const ons = {
|
|
761
|
-
scroll
|
|
785
|
+
scroll(evnt) {
|
|
786
|
+
$xeTable.triggerBodyScrollEvent(evnt, fixedType);
|
|
787
|
+
}
|
|
762
788
|
};
|
|
763
|
-
if (
|
|
764
|
-
ons.wheel =
|
|
789
|
+
if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
|
|
790
|
+
ons.wheel = $xeTable.triggerBodyWheelEvent;
|
|
765
791
|
}
|
|
766
792
|
return h('div', {
|
|
767
793
|
ref: 'refElem',
|
|
768
794
|
class: ['vxe-table--body-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
769
795
|
attrs: {
|
|
770
|
-
xid:
|
|
771
|
-
}
|
|
796
|
+
xid: xID
|
|
797
|
+
}
|
|
798
|
+
}, [h('div', {
|
|
799
|
+
ref: 'refBodyScroll',
|
|
800
|
+
class: 'vxe-table--body-inner-wrapper',
|
|
772
801
|
on: ons
|
|
773
802
|
}, [fixedType ? renderEmptyElement($xeTable) : h('div', {
|
|
774
|
-
|
|
775
|
-
|
|
803
|
+
ref: 'refBodyXSpace',
|
|
804
|
+
class: 'vxe-body--x-space'
|
|
776
805
|
}), h('div', {
|
|
777
|
-
|
|
778
|
-
|
|
806
|
+
ref: 'refBodyYSpace',
|
|
807
|
+
class: 'vxe-body--y-space'
|
|
779
808
|
}), h('table', {
|
|
809
|
+
ref: 'refBodyTable',
|
|
780
810
|
class: 'vxe-table--body',
|
|
781
811
|
attrs: {
|
|
782
|
-
xid:
|
|
812
|
+
xid: xID,
|
|
783
813
|
cellspacing: 0,
|
|
784
814
|
cellpadding: 0,
|
|
785
815
|
border: 0
|
|
786
|
-
}
|
|
787
|
-
ref: 'table'
|
|
816
|
+
}
|
|
788
817
|
}, [
|
|
789
818
|
/**
|
|
790
819
|
* 列宽
|
|
791
820
|
*/
|
|
792
821
|
h('colgroup', {
|
|
793
|
-
ref: '
|
|
822
|
+
ref: 'refBodyColgroup'
|
|
794
823
|
}, renderColumnList.map((column, $columnIndex) => {
|
|
795
824
|
return h('col', {
|
|
796
825
|
attrs: {
|
|
@@ -800,16 +829,17 @@ var _default = exports.default = {
|
|
|
800
829
|
});
|
|
801
830
|
})),
|
|
802
831
|
/**
|
|
803
|
-
|
|
804
|
-
|
|
832
|
+
* 内容
|
|
833
|
+
*/
|
|
805
834
|
rowOpts.drag && rowDragOpts.animation ? h('transition-group', {
|
|
835
|
+
ref: 'refBodyTBody',
|
|
806
836
|
props: {
|
|
807
837
|
tag: 'tbody',
|
|
808
838
|
name: `vxe-body--row-list${isDragRowMove ? '' : '-disabled'}`
|
|
809
839
|
}
|
|
810
|
-
}, renderRows(h, this,
|
|
811
|
-
ref: '
|
|
812
|
-
}, renderRows(h, this,
|
|
840
|
+
}, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList)) : h('tbody', {
|
|
841
|
+
ref: 'refBodyTBody'
|
|
842
|
+
}, renderRows(h, this, fixedType, isOptimizeMode, renderDataList, renderColumnList))]), h('div', {
|
|
813
843
|
class: 'vxe-table--checkbox-range'
|
|
814
844
|
}), mouseConfig && mouseOpts.area ? h('div', {
|
|
815
845
|
class: 'vxe-table--cell-area'
|
|
@@ -841,212 +871,6 @@ var _default = exports.default = {
|
|
|
841
871
|
ref: 'emptyBlock'
|
|
842
872
|
}, [h('div', {
|
|
843
873
|
class: 'vxe-table--empty-content'
|
|
844
|
-
}, emptyContent)]) : renderEmptyElement($xeTable)]);
|
|
845
|
-
},
|
|
846
|
-
methods: {
|
|
847
|
-
/**
|
|
848
|
-
* 滚动处理
|
|
849
|
-
* 如果存在列固定左侧,同步更新滚动状态
|
|
850
|
-
* 如果存在列固定右侧,同步更新滚动状态
|
|
851
|
-
*/
|
|
852
|
-
scrollEvent(evnt) {
|
|
853
|
-
const $xeTable = this.$parent;
|
|
854
|
-
const tableInternalData = $xeTable;
|
|
855
|
-
const {
|
|
856
|
-
fixedType
|
|
857
|
-
} = this;
|
|
858
|
-
const {
|
|
859
|
-
lastScrollTop,
|
|
860
|
-
lastScrollLeft,
|
|
861
|
-
inVirtualScroll,
|
|
862
|
-
inBodyScroll,
|
|
863
|
-
bodyScrollType,
|
|
864
|
-
inFooterScroll
|
|
865
|
-
} = tableInternalData;
|
|
866
|
-
if (inVirtualScroll) {
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
if (inFooterScroll) {
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
if (inBodyScroll) {
|
|
873
|
-
if (bodyScrollType !== fixedType) {
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
const {
|
|
878
|
-
tableHeader,
|
|
879
|
-
tableBody,
|
|
880
|
-
leftBody,
|
|
881
|
-
rightBody,
|
|
882
|
-
tableFooter
|
|
883
|
-
} = $xeTable.$refs;
|
|
884
|
-
const scrollBodyElem = this.$el;
|
|
885
|
-
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
886
|
-
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
887
|
-
const bodyElem = tableBody ? tableBody.$el : null;
|
|
888
|
-
if (!bodyElem) {
|
|
889
|
-
return;
|
|
890
|
-
}
|
|
891
|
-
const leftElem = leftBody ? leftBody.$el : null;
|
|
892
|
-
const rightElem = rightBody ? rightBody.$el : null;
|
|
893
|
-
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
894
|
-
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
895
|
-
const scrollTop = scrollBodyElem.scrollTop;
|
|
896
|
-
const scrollLeft = bodyElem.scrollLeft;
|
|
897
|
-
const isRollX = scrollLeft !== lastScrollLeft;
|
|
898
|
-
const isRollY = scrollTop !== lastScrollTop;
|
|
899
|
-
tableInternalData.inBodyScroll = true;
|
|
900
|
-
tableInternalData.bodyScrollType = fixedType;
|
|
901
|
-
if (isRollY) {
|
|
902
|
-
if (leftElem && fixedType === 'left') {
|
|
903
|
-
(0, _dom.setScrollTop)(bodyElem, scrollTop);
|
|
904
|
-
(0, _dom.setScrollTop)(rightElem, scrollTop);
|
|
905
|
-
} else if (rightElem && fixedType === 'right') {
|
|
906
|
-
(0, _dom.setScrollTop)(bodyElem, scrollTop);
|
|
907
|
-
(0, _dom.setScrollTop)(leftElem, scrollTop);
|
|
908
|
-
} else {
|
|
909
|
-
(0, _dom.setScrollTop)(leftElem, scrollTop);
|
|
910
|
-
(0, _dom.setScrollTop)(rightElem, scrollTop);
|
|
911
|
-
}
|
|
912
|
-
(0, _dom.setScrollTop)(yHandleEl, scrollTop);
|
|
913
|
-
$xeTable.triggerScrollYEvent(evnt);
|
|
914
|
-
}
|
|
915
|
-
if (isRollX) {
|
|
916
|
-
(0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
|
|
917
|
-
(0, _dom.setScrollLeft)(headerElem, scrollLeft);
|
|
918
|
-
(0, _dom.setScrollLeft)(footerElem, scrollLeft);
|
|
919
|
-
$xeTable.triggerScrollXEvent(evnt);
|
|
920
|
-
}
|
|
921
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
922
|
-
type: renderType,
|
|
923
|
-
fixed: fixedType
|
|
924
|
-
});
|
|
925
|
-
},
|
|
926
|
-
handleWheel(evnt, isTopWheel, deltaTop, isRollX, isRollY) {
|
|
927
|
-
const {
|
|
928
|
-
$parent: $xetable
|
|
929
|
-
} = this;
|
|
930
|
-
const {
|
|
931
|
-
$refs,
|
|
932
|
-
elemStore,
|
|
933
|
-
scrollYLoad,
|
|
934
|
-
scrollXLoad
|
|
935
|
-
} = $xetable;
|
|
936
|
-
const {
|
|
937
|
-
tableBody,
|
|
938
|
-
leftBody,
|
|
939
|
-
rightBody
|
|
940
|
-
} = $refs;
|
|
941
|
-
const bodyElem = tableBody.$el;
|
|
942
|
-
const leftElem = leftBody ? leftBody.$el : null;
|
|
943
|
-
const rightElem = rightBody ? rightBody.$el : null;
|
|
944
|
-
const remainSize = this.isPrevWheelTop === isTopWheel ? Math.max(0, this.wheelYSize - this.wheelYTotal) : 0;
|
|
945
|
-
const bodyYElem = elemStore['main-body-ySpace'];
|
|
946
|
-
const bodyXElem = elemStore['main-body-xSpace'];
|
|
947
|
-
const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight;
|
|
948
|
-
const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth;
|
|
949
|
-
this.isPrevWheelTop = isTopWheel;
|
|
950
|
-
this.wheelYSize = Math.abs(isTopWheel ? deltaTop - remainSize : deltaTop + remainSize);
|
|
951
|
-
this.wheelYInterval = 0;
|
|
952
|
-
this.wheelYTotal = 0;
|
|
953
|
-
clearTimeout(this.wheelTime);
|
|
954
|
-
const handleSmooth = () => {
|
|
955
|
-
let {
|
|
956
|
-
fixedType,
|
|
957
|
-
wheelYTotal,
|
|
958
|
-
wheelYSize,
|
|
959
|
-
wheelYInterval
|
|
960
|
-
} = this;
|
|
961
|
-
if (wheelYTotal < wheelYSize) {
|
|
962
|
-
wheelYInterval = Math.max(5, Math.floor(wheelYInterval * 1.5));
|
|
963
|
-
wheelYTotal = wheelYTotal + wheelYInterval;
|
|
964
|
-
if (wheelYTotal > wheelYSize) {
|
|
965
|
-
wheelYInterval = wheelYInterval - (wheelYTotal - wheelYSize);
|
|
966
|
-
}
|
|
967
|
-
const {
|
|
968
|
-
scrollTop,
|
|
969
|
-
clientHeight,
|
|
970
|
-
scrollHeight
|
|
971
|
-
} = bodyElem;
|
|
972
|
-
const targetTop = scrollTop + wheelYInterval * (isTopWheel ? -1 : 1);
|
|
973
|
-
bodyElem.scrollTop = targetTop;
|
|
974
|
-
if (leftElem) {
|
|
975
|
-
leftElem.scrollTop = targetTop;
|
|
976
|
-
}
|
|
977
|
-
if (rightElem) {
|
|
978
|
-
rightElem.scrollTop = targetTop;
|
|
979
|
-
}
|
|
980
|
-
if (isTopWheel ? targetTop < scrollHeight - clientHeight : targetTop >= 0) {
|
|
981
|
-
this.wheelTime = setTimeout(handleSmooth, 10);
|
|
982
|
-
}
|
|
983
|
-
this.wheelYTotal = wheelYTotal;
|
|
984
|
-
this.wheelYInterval = wheelYInterval;
|
|
985
|
-
$xetable.emitEvent('scroll', {
|
|
986
|
-
type: renderType,
|
|
987
|
-
fixed: fixedType,
|
|
988
|
-
scrollTop: bodyElem.scrollTop,
|
|
989
|
-
scrollLeft: bodyElem.scrollLeft,
|
|
990
|
-
scrollHeight: bodyElem.scrollHeight,
|
|
991
|
-
scrollWidth: bodyElem.scrollWidth,
|
|
992
|
-
bodyHeight,
|
|
993
|
-
bodyWidth,
|
|
994
|
-
isX: isRollX,
|
|
995
|
-
isY: isRollY
|
|
996
|
-
}, evnt);
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
handleSmooth();
|
|
1000
|
-
},
|
|
1001
|
-
/**
|
|
1002
|
-
* 滚轮处理
|
|
1003
|
-
*/
|
|
1004
|
-
wheelEvent(evnt) {
|
|
1005
|
-
const {
|
|
1006
|
-
deltaY,
|
|
1007
|
-
deltaX
|
|
1008
|
-
} = evnt;
|
|
1009
|
-
const {
|
|
1010
|
-
$el: scrollBodyElem,
|
|
1011
|
-
$parent: $xetable
|
|
1012
|
-
} = this;
|
|
1013
|
-
const {
|
|
1014
|
-
$refs,
|
|
1015
|
-
highlightHoverRow,
|
|
1016
|
-
scrollYLoad,
|
|
1017
|
-
lastScrollTop,
|
|
1018
|
-
lastScrollLeft,
|
|
1019
|
-
rowOpts
|
|
1020
|
-
} = $xetable;
|
|
1021
|
-
const {
|
|
1022
|
-
tableBody
|
|
1023
|
-
} = $refs;
|
|
1024
|
-
const bodyElem = tableBody.$el;
|
|
1025
|
-
const deltaTop = deltaY;
|
|
1026
|
-
const deltaLeft = deltaX;
|
|
1027
|
-
const isTopWheel = deltaTop < 0;
|
|
1028
|
-
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
1029
|
-
if (isTopWheel ? scrollBodyElem.scrollTop <= 0 : scrollBodyElem.scrollTop >= scrollBodyElem.scrollHeight - scrollBodyElem.clientHeight) {
|
|
1030
|
-
return;
|
|
1031
|
-
}
|
|
1032
|
-
const scrollTop = scrollBodyElem.scrollTop + deltaTop;
|
|
1033
|
-
const scrollLeft = bodyElem.scrollLeft + deltaLeft;
|
|
1034
|
-
const isRollX = scrollLeft !== lastScrollLeft;
|
|
1035
|
-
const isRollY = scrollTop !== lastScrollTop;
|
|
1036
|
-
// 用于鼠标纵向滚轮处理
|
|
1037
|
-
if (isRollY) {
|
|
1038
|
-
evnt.preventDefault();
|
|
1039
|
-
$xetable.lastScrollTop = scrollTop;
|
|
1040
|
-
$xetable.lastScrollLeft = scrollLeft;
|
|
1041
|
-
$xetable.lastScrollTime = Date.now();
|
|
1042
|
-
if (rowOpts.isHover || highlightHoverRow) {
|
|
1043
|
-
$xetable.clearHoverRow();
|
|
1044
|
-
}
|
|
1045
|
-
this.handleWheel(evnt, isTopWheel, deltaTop, isRollX, isRollY);
|
|
1046
|
-
if (scrollYLoad) {
|
|
1047
|
-
$xetable.triggerScrollYEvent(evnt);
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
874
|
+
}, emptyContent)]) : renderEmptyElement($xeTable)])]);
|
|
1051
875
|
}
|
|
1052
876
|
};
|