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