vxe-table 4.8.16 → 4.9.1
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/README.en.md +1 -1
- package/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/es/locale/lang/en-US.js +1 -0
- package/es/locale/lang/es-ES.js +1 -0
- package/es/locale/lang/hu-HU.js +1 -0
- package/es/locale/lang/ja-JP.js +1 -0
- package/es/locale/lang/ko-KR.js +1 -0
- package/es/locale/lang/pt-BR.js +1 -0
- package/es/locale/lang/ru-RU.js +1 -0
- package/es/locale/lang/uk-UA.js +1 -0
- package/es/locale/lang/vi-VN.js +1 -0
- package/es/locale/lang/zh-CHT.js +1 -0
- package/es/locale/lang/zh-CN.js +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/hook.js +4 -0
- package/es/table/module/edit/hook.js +53 -34
- package/es/table/module/filter/hook.js +2 -3
- package/es/table/module/keyboard/hook.js +2 -2
- package/es/table/src/body.js +31 -24
- package/es/table/src/cell.js +99 -59
- package/es/table/src/emits.js +3 -0
- package/es/table/src/footer.js +177 -147
- package/es/table/src/header.js +144 -107
- package/es/table/src/props.js +5 -1
- package/es/table/src/table.js +346 -108
- package/es/table/src/util.js +9 -0
- package/es/table/style.css +33 -20
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +9 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +33 -20
- package/es/vxe-table/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/index.umd.js +1035 -573
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +1 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +1 -0
- package/lib/locale/lang/es-ES.js +1 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +1 -0
- package/lib/locale/lang/hu-HU.js +1 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +1 -0
- package/lib/locale/lang/ja-JP.js +1 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +1 -0
- package/lib/locale/lang/ko-KR.js +1 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +1 -0
- package/lib/locale/lang/pt-BR.js +1 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +1 -0
- package/lib/locale/lang/ru-RU.js +1 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +1 -0
- package/lib/locale/lang/uk-UA.js +1 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +1 -0
- package/lib/locale/lang/vi-VN.js +1 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +1 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +1 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +1 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/hook.js +4 -0
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/edit/hook.js +63 -42
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/filter/hook.js +1 -2
- package/lib/table/module/filter/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -2
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +34 -21
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +110 -51
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/footer.js +222 -183
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +188 -150
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/props.js +5 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +380 -110
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +33 -20
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +9 -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 +33 -20
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/locale/lang/en-US.ts +1 -0
- package/packages/locale/lang/es-ES.ts +1 -0
- package/packages/locale/lang/hu-HU.ts +1 -0
- package/packages/locale/lang/ja-JP.ts +1 -0
- package/packages/locale/lang/ko-KR.ts +1 -0
- package/packages/locale/lang/pt-BR.ts +1 -0
- package/packages/locale/lang/ru-RU.ts +1 -0
- package/packages/locale/lang/uk-UA.ts +1 -0
- package/packages/locale/lang/vi-VN.ts +1 -0
- package/packages/locale/lang/zh-CHT.ts +1 -0
- package/packages/locale/lang/zh-CN.ts +1 -0
- package/packages/table/module/custom/hook.ts +4 -0
- package/packages/table/module/edit/hook.ts +54 -34
- package/packages/table/module/filter/hook.ts +2 -3
- package/packages/table/module/keyboard/hook.ts +2 -2
- package/packages/table/src/body.ts +46 -31
- package/packages/table/src/cell.ts +140 -92
- package/packages/table/src/emits.ts +3 -0
- package/packages/table/src/footer.ts +189 -152
- package/packages/table/src/header.ts +157 -116
- package/packages/table/src/props.ts +5 -1
- package/packages/table/src/table.ts +358 -109
- package/packages/table/src/util.ts +10 -0
- package/packages/ui/index.ts +8 -3
- package/styles/components/table.scss +42 -35
- /package/es/{iconfont.1731633504443.ttf → iconfont.1731937248477.ttf} +0 -0
- /package/es/{iconfont.1731633504443.woff → iconfont.1731937248477.woff} +0 -0
- /package/es/{iconfont.1731633504443.woff2 → iconfont.1731937248477.woff2} +0 -0
- /package/lib/{iconfont.1731633504443.ttf → iconfont.1731937248477.ttf} +0 -0
- /package/lib/{iconfont.1731633504443.woff → iconfont.1731937248477.woff} +0 -0
- /package/lib/{iconfont.1731633504443.woff2 → iconfont.1731937248477.woff2} +0 -0
package/lib/table/src/footer.js
CHANGED
|
@@ -109,36 +109,201 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
-
(
|
|
113
|
-
(0, _vue.nextTick)(() => {
|
|
114
|
-
const {
|
|
115
|
-
fixedType
|
|
116
|
-
} = props;
|
|
117
|
-
const {
|
|
118
|
-
elemStore
|
|
119
|
-
} = tableInternalData;
|
|
120
|
-
const prefix = `${fixedType || 'main'}-footer-`;
|
|
121
|
-
elemStore[`${prefix}wrapper`] = refElem;
|
|
122
|
-
elemStore[`${prefix}table`] = refFooterTable;
|
|
123
|
-
elemStore[`${prefix}colgroup`] = refFooterColgroup;
|
|
124
|
-
elemStore[`${prefix}list`] = refFooterTFoot;
|
|
125
|
-
elemStore[`${prefix}xSpace`] = refFooterXSpace;
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
(0, _vue.onUnmounted)(() => {
|
|
112
|
+
const renderRows = (tableColumn, footerTableData, row, $rowIndex, _rowIndex) => {
|
|
129
113
|
const {
|
|
130
114
|
fixedType
|
|
131
115
|
} = props;
|
|
132
116
|
const {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
117
|
+
footerCellClassName,
|
|
118
|
+
footerCellStyle,
|
|
119
|
+
footerAlign: allFooterAlign,
|
|
120
|
+
footerSpanMethod,
|
|
121
|
+
align: allAlign,
|
|
122
|
+
columnKey,
|
|
123
|
+
showFooterOverflow: allColumnFooterOverflow
|
|
124
|
+
} = tableProps;
|
|
125
|
+
const {
|
|
126
|
+
scrollXLoad,
|
|
127
|
+
overflowX,
|
|
128
|
+
scrollbarWidth,
|
|
129
|
+
currentColumn,
|
|
130
|
+
mergeFooterList
|
|
131
|
+
} = tableReactData;
|
|
132
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
133
|
+
const columnOpts = computeColumnOpts.value;
|
|
134
|
+
return tableColumn.map((column, $columnIndex) => {
|
|
135
|
+
const {
|
|
136
|
+
type,
|
|
137
|
+
showFooterOverflow,
|
|
138
|
+
footerAlign,
|
|
139
|
+
align,
|
|
140
|
+
footerClassName,
|
|
141
|
+
editRender,
|
|
142
|
+
cellRender
|
|
143
|
+
} = column;
|
|
144
|
+
const renderOpts = editRender || cellRender;
|
|
145
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
146
|
+
const showAllTip = tooltipOpts.showAll;
|
|
147
|
+
const isColGroup = column.children && column.children.length;
|
|
148
|
+
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
149
|
+
const footOverflow = _xeUtils.default.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
150
|
+
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
151
|
+
let showEllipsis = footOverflow === 'ellipsis';
|
|
152
|
+
const showTitle = footOverflow === 'title';
|
|
153
|
+
const showTooltip = footOverflow === true || footOverflow === 'tooltip';
|
|
154
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
155
|
+
const attrs = {
|
|
156
|
+
colid: column.id
|
|
157
|
+
};
|
|
158
|
+
const tfOns = {};
|
|
159
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
160
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
161
|
+
const itemIndex = _columnIndex;
|
|
162
|
+
const cellParams = {
|
|
163
|
+
$table: $xeTable,
|
|
164
|
+
$grid: $xeTable.xegrid,
|
|
165
|
+
row,
|
|
166
|
+
rowIndex: _rowIndex,
|
|
167
|
+
_rowIndex,
|
|
168
|
+
$rowIndex,
|
|
169
|
+
column,
|
|
170
|
+
columnIndex,
|
|
171
|
+
$columnIndex,
|
|
172
|
+
_columnIndex,
|
|
173
|
+
itemIndex,
|
|
174
|
+
items: row,
|
|
175
|
+
fixed: fixedType,
|
|
176
|
+
type: renderType,
|
|
177
|
+
data: footerTableData
|
|
178
|
+
};
|
|
179
|
+
// 纵向虚拟滚动不支持动态行高
|
|
180
|
+
if (scrollXLoad && !hasEllipsis) {
|
|
181
|
+
showEllipsis = hasEllipsis = true;
|
|
182
|
+
}
|
|
183
|
+
if (showTitle || showTooltip || showAllTip) {
|
|
184
|
+
tfOns.onMouseenter = evnt => {
|
|
185
|
+
if (showTitle) {
|
|
186
|
+
(0, _dom.updateCellTitle)(evnt.currentTarget, column);
|
|
187
|
+
} else if (showTooltip || showAllTip) {
|
|
188
|
+
$xeTable.triggerFooterTooltipEvent(evnt, cellParams);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (showTooltip || showAllTip) {
|
|
193
|
+
tfOns.onMouseleave = evnt => {
|
|
194
|
+
if (showTooltip || showAllTip) {
|
|
195
|
+
$xeTable.handleTargetLeaveEvent(evnt);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
tfOns.onClick = evnt => {
|
|
200
|
+
$xeTable.dispatchEvent('footer-cell-click', Object.assign({
|
|
201
|
+
cell: evnt.currentTarget
|
|
202
|
+
}, cellParams), evnt);
|
|
203
|
+
};
|
|
204
|
+
tfOns.onDblclick = evnt => {
|
|
205
|
+
$xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({
|
|
206
|
+
cell: evnt.currentTarget
|
|
207
|
+
}, cellParams), evnt);
|
|
208
|
+
};
|
|
209
|
+
// 合并行或列
|
|
210
|
+
if (mergeFooterList.length) {
|
|
211
|
+
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
212
|
+
if (spanRest) {
|
|
213
|
+
const {
|
|
214
|
+
rowspan,
|
|
215
|
+
colspan
|
|
216
|
+
} = spanRest;
|
|
217
|
+
if (!rowspan || !colspan) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
if (rowspan > 1) {
|
|
221
|
+
attrs.rowspan = rowspan;
|
|
222
|
+
}
|
|
223
|
+
if (colspan > 1) {
|
|
224
|
+
attrs.colspan = colspan;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} else if (footerSpanMethod) {
|
|
228
|
+
// 自定义合并方法
|
|
229
|
+
const {
|
|
230
|
+
rowspan = 1,
|
|
231
|
+
colspan = 1
|
|
232
|
+
} = footerSpanMethod(cellParams) || {};
|
|
233
|
+
if (!rowspan || !colspan) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
if (rowspan > 1) {
|
|
237
|
+
attrs.rowspan = rowspan;
|
|
238
|
+
}
|
|
239
|
+
if (colspan > 1) {
|
|
240
|
+
attrs.colspan = colspan;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return (0, _vue.h)('td', Object.assign(Object.assign(Object.assign(Object.assign({
|
|
244
|
+
class: ['vxe-footer--column', column.id, {
|
|
245
|
+
[`col--${footAlign}`]: footAlign,
|
|
246
|
+
[`col--${type}`]: type,
|
|
247
|
+
'col--last': $columnIndex === tableColumn.length - 1,
|
|
248
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
249
|
+
'col--ellipsis': hasEllipsis,
|
|
250
|
+
'col--current': currentColumn === column
|
|
251
|
+
}, (0, _dom.getPropClass)(footerClassName, cellParams), (0, _dom.getPropClass)(footerCellClassName, cellParams)]
|
|
252
|
+
}, attrs), {
|
|
253
|
+
style: footerCellStyle ? _xeUtils.default.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle : null
|
|
254
|
+
}), tfOns), {
|
|
255
|
+
key: columnKey || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
256
|
+
}), [(0, _vue.h)('div', {
|
|
257
|
+
class: ['vxe-cell', {
|
|
258
|
+
'c--title': showTitle,
|
|
259
|
+
'c--tooltip': showTooltip,
|
|
260
|
+
'c--ellipsis': showEllipsis
|
|
261
|
+
}]
|
|
262
|
+
}, column.renderFooter(cellParams))]);
|
|
263
|
+
}).concat(scrollbarWidth ? [(0, _vue.h)('td', {
|
|
264
|
+
key: `gr${$rowIndex}`,
|
|
265
|
+
class: 'vxe-footer--gutter col--gutter'
|
|
266
|
+
})] : []);
|
|
267
|
+
};
|
|
268
|
+
const renderHeads = footerTableData => {
|
|
269
|
+
const {
|
|
270
|
+
fixedType,
|
|
271
|
+
tableColumn
|
|
272
|
+
} = props;
|
|
273
|
+
const {
|
|
274
|
+
footerRowClassName,
|
|
275
|
+
footerRowStyle
|
|
276
|
+
} = tableProps;
|
|
277
|
+
const {
|
|
278
|
+
isDragColMove
|
|
279
|
+
} = tableReactData;
|
|
280
|
+
const columnOpts = computeColumnOpts.value;
|
|
281
|
+
return footerTableData.map((row, $rowIndex) => {
|
|
282
|
+
const _rowIndex = $rowIndex;
|
|
283
|
+
const rowParams = {
|
|
284
|
+
$table: $xeTable,
|
|
285
|
+
row,
|
|
286
|
+
_rowIndex,
|
|
287
|
+
$rowIndex,
|
|
288
|
+
fixed: fixedType,
|
|
289
|
+
type: renderType
|
|
290
|
+
};
|
|
291
|
+
if (columnOpts.drag) {
|
|
292
|
+
return (0, _vue.h)(_vue.TransitionGroup, {
|
|
293
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
294
|
+
tag: 'tr',
|
|
295
|
+
class: ['vxe-footer--row', footerRowClassName ? _xeUtils.default.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
|
|
296
|
+
style: footerRowStyle ? _xeUtils.default.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle : null
|
|
297
|
+
}, {
|
|
298
|
+
default: () => renderRows(tableColumn, footerTableData, row, $rowIndex, _rowIndex)
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return (0, _vue.h)('tr', {
|
|
302
|
+
class: ['vxe-footer--row', footerRowClassName ? _xeUtils.default.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
|
|
303
|
+
style: footerRowStyle ? _xeUtils.default.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle : null
|
|
304
|
+
}, renderRows(tableColumn, footerTableData, row, $rowIndex, _rowIndex));
|
|
305
|
+
});
|
|
306
|
+
};
|
|
142
307
|
const renderVN = () => {
|
|
143
308
|
let {
|
|
144
309
|
fixedType,
|
|
@@ -147,14 +312,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
147
312
|
footerTableData
|
|
148
313
|
} = props;
|
|
149
314
|
const {
|
|
150
|
-
footerRowClassName,
|
|
151
|
-
footerCellClassName,
|
|
152
|
-
footerRowStyle,
|
|
153
|
-
footerCellStyle,
|
|
154
|
-
footerAlign: allFooterAlign,
|
|
155
315
|
footerSpanMethod,
|
|
156
|
-
align: allAlign,
|
|
157
|
-
columnKey,
|
|
158
316
|
showFooterOverflow: allColumnFooterOverflow
|
|
159
317
|
} = tableProps;
|
|
160
318
|
const {
|
|
@@ -162,13 +320,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
162
320
|
} = tableInternalData;
|
|
163
321
|
const {
|
|
164
322
|
scrollXLoad,
|
|
165
|
-
overflowX,
|
|
166
323
|
scrollbarWidth,
|
|
167
|
-
currentColumn,
|
|
168
324
|
mergeFooterList
|
|
169
325
|
} = tableReactData;
|
|
170
|
-
const tooltipOpts = computeTooltipOpts.value;
|
|
171
|
-
const columnOpts = computeColumnOpts.value;
|
|
172
326
|
// 如果是使用优化模式
|
|
173
327
|
if (fixedType) {
|
|
174
328
|
// 如果存在展开行使用全量渲染
|
|
@@ -216,153 +370,38 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
216
370
|
*/
|
|
217
371
|
(0, _vue.h)('tfoot', {
|
|
218
372
|
ref: refFooterTFoot
|
|
219
|
-
}, footerTableData
|
|
220
|
-
const $rowIndex = _rowIndex;
|
|
221
|
-
const rowParams = {
|
|
222
|
-
$table: $xeTable,
|
|
223
|
-
row: list,
|
|
224
|
-
_rowIndex,
|
|
225
|
-
$rowIndex,
|
|
226
|
-
fixed: fixedType,
|
|
227
|
-
type: renderType
|
|
228
|
-
};
|
|
229
|
-
return (0, _vue.h)('tr', {
|
|
230
|
-
class: ['vxe-footer--row', footerRowClassName ? _xeUtils.default.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
|
|
231
|
-
style: footerRowStyle ? _xeUtils.default.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle : null
|
|
232
|
-
}, tableColumn.map((column, $columnIndex) => {
|
|
233
|
-
const {
|
|
234
|
-
type,
|
|
235
|
-
showFooterOverflow,
|
|
236
|
-
footerAlign,
|
|
237
|
-
align,
|
|
238
|
-
footerClassName,
|
|
239
|
-
editRender,
|
|
240
|
-
cellRender
|
|
241
|
-
} = column;
|
|
242
|
-
const renderOpts = editRender || cellRender;
|
|
243
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
244
|
-
const showAllTip = tooltipOpts.showAll;
|
|
245
|
-
const isColGroup = column.children && column.children.length;
|
|
246
|
-
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
247
|
-
const footOverflow = _xeUtils.default.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
248
|
-
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
249
|
-
let showEllipsis = footOverflow === 'ellipsis';
|
|
250
|
-
const showTitle = footOverflow === 'title';
|
|
251
|
-
const showTooltip = footOverflow === true || footOverflow === 'tooltip';
|
|
252
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
253
|
-
const attrs = {
|
|
254
|
-
colid: column.id
|
|
255
|
-
};
|
|
256
|
-
const tfOns = {};
|
|
257
|
-
const columnIndex = $xeTable.getColumnIndex(column);
|
|
258
|
-
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
259
|
-
const itemIndex = _columnIndex;
|
|
260
|
-
const cellParams = {
|
|
261
|
-
$table: $xeTable,
|
|
262
|
-
$grid: $xeTable.xegrid,
|
|
263
|
-
row: list,
|
|
264
|
-
rowIndex: _rowIndex,
|
|
265
|
-
_rowIndex,
|
|
266
|
-
$rowIndex,
|
|
267
|
-
column,
|
|
268
|
-
columnIndex,
|
|
269
|
-
$columnIndex,
|
|
270
|
-
_columnIndex,
|
|
271
|
-
itemIndex,
|
|
272
|
-
items: list,
|
|
273
|
-
fixed: fixedType,
|
|
274
|
-
type: renderType,
|
|
275
|
-
data: footerTableData
|
|
276
|
-
};
|
|
277
|
-
// 纵向虚拟滚动不支持动态行高
|
|
278
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
279
|
-
showEllipsis = hasEllipsis = true;
|
|
280
|
-
}
|
|
281
|
-
if (showTitle || showTooltip || showAllTip) {
|
|
282
|
-
tfOns.onMouseenter = evnt => {
|
|
283
|
-
if (showTitle) {
|
|
284
|
-
(0, _dom.updateCellTitle)(evnt.currentTarget, column);
|
|
285
|
-
} else if (showTooltip || showAllTip) {
|
|
286
|
-
$xeTable.triggerFooterTooltipEvent(evnt, cellParams);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
if (showTooltip || showAllTip) {
|
|
291
|
-
tfOns.onMouseleave = evnt => {
|
|
292
|
-
if (showTooltip || showAllTip) {
|
|
293
|
-
$xeTable.handleTargetLeaveEvent(evnt);
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
tfOns.onClick = evnt => {
|
|
298
|
-
$xeTable.dispatchEvent('footer-cell-click', Object.assign({
|
|
299
|
-
cell: evnt.currentTarget
|
|
300
|
-
}, cellParams), evnt);
|
|
301
|
-
};
|
|
302
|
-
tfOns.onDblclick = evnt => {
|
|
303
|
-
$xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({
|
|
304
|
-
cell: evnt.currentTarget
|
|
305
|
-
}, cellParams), evnt);
|
|
306
|
-
};
|
|
307
|
-
// 合并行或列
|
|
308
|
-
if (mergeFooterList.length) {
|
|
309
|
-
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
310
|
-
if (spanRest) {
|
|
311
|
-
const {
|
|
312
|
-
rowspan,
|
|
313
|
-
colspan
|
|
314
|
-
} = spanRest;
|
|
315
|
-
if (!rowspan || !colspan) {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
if (rowspan > 1) {
|
|
319
|
-
attrs.rowspan = rowspan;
|
|
320
|
-
}
|
|
321
|
-
if (colspan > 1) {
|
|
322
|
-
attrs.colspan = colspan;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
} else if (footerSpanMethod) {
|
|
326
|
-
// 自定义合并方法
|
|
327
|
-
const {
|
|
328
|
-
rowspan = 1,
|
|
329
|
-
colspan = 1
|
|
330
|
-
} = footerSpanMethod(cellParams) || {};
|
|
331
|
-
if (!rowspan || !colspan) {
|
|
332
|
-
return null;
|
|
333
|
-
}
|
|
334
|
-
if (rowspan > 1) {
|
|
335
|
-
attrs.rowspan = rowspan;
|
|
336
|
-
}
|
|
337
|
-
if (colspan > 1) {
|
|
338
|
-
attrs.colspan = colspan;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return (0, _vue.h)('td', Object.assign(Object.assign(Object.assign(Object.assign({
|
|
342
|
-
class: ['vxe-footer--column', column.id, {
|
|
343
|
-
[`col--${footAlign}`]: footAlign,
|
|
344
|
-
[`col--${type}`]: type,
|
|
345
|
-
'col--last': $columnIndex === tableColumn.length - 1,
|
|
346
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
347
|
-
'col--ellipsis': hasEllipsis,
|
|
348
|
-
'col--current': currentColumn === column
|
|
349
|
-
}, (0, _dom.getPropClass)(footerClassName, cellParams), (0, _dom.getPropClass)(footerCellClassName, cellParams)]
|
|
350
|
-
}, attrs), {
|
|
351
|
-
style: footerCellStyle ? _xeUtils.default.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle : null
|
|
352
|
-
}), tfOns), {
|
|
353
|
-
key: columnKey || columnOpts.useKey ? column.id : $columnIndex
|
|
354
|
-
}), [(0, _vue.h)('div', {
|
|
355
|
-
class: ['vxe-cell', {
|
|
356
|
-
'c--title': showTitle,
|
|
357
|
-
'c--tooltip': showTooltip,
|
|
358
|
-
'c--ellipsis': showEllipsis
|
|
359
|
-
}]
|
|
360
|
-
}, column.renderFooter(cellParams))]);
|
|
361
|
-
}).concat(scrollbarWidth ? [(0, _vue.h)('td', {
|
|
362
|
-
class: 'vxe-footer--gutter col--gutter'
|
|
363
|
-
})] : []));
|
|
364
|
-
}))])]);
|
|
373
|
+
}, renderHeads(footerTableData))])]);
|
|
365
374
|
};
|
|
375
|
+
(0, _vue.onMounted)(() => {
|
|
376
|
+
(0, _vue.nextTick)(() => {
|
|
377
|
+
const {
|
|
378
|
+
fixedType
|
|
379
|
+
} = props;
|
|
380
|
+
const {
|
|
381
|
+
elemStore
|
|
382
|
+
} = tableInternalData;
|
|
383
|
+
const prefix = `${fixedType || 'main'}-footer-`;
|
|
384
|
+
elemStore[`${prefix}wrapper`] = refElem;
|
|
385
|
+
elemStore[`${prefix}table`] = refFooterTable;
|
|
386
|
+
elemStore[`${prefix}colgroup`] = refFooterColgroup;
|
|
387
|
+
elemStore[`${prefix}list`] = refFooterTFoot;
|
|
388
|
+
elemStore[`${prefix}xSpace`] = refFooterXSpace;
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
(0, _vue.onUnmounted)(() => {
|
|
392
|
+
const {
|
|
393
|
+
fixedType
|
|
394
|
+
} = props;
|
|
395
|
+
const {
|
|
396
|
+
elemStore
|
|
397
|
+
} = tableInternalData;
|
|
398
|
+
const prefix = `${fixedType || 'main'}-footer-`;
|
|
399
|
+
elemStore[`${prefix}wrapper`] = null;
|
|
400
|
+
elemStore[`${prefix}table`] = null;
|
|
401
|
+
elemStore[`${prefix}colgroup`] = null;
|
|
402
|
+
elemStore[`${prefix}list`] = null;
|
|
403
|
+
elemStore[`${prefix}xSpace`] = null;
|
|
404
|
+
});
|
|
366
405
|
return renderVN;
|
|
367
406
|
}
|
|
368
407
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const renderer=_ui.VxeUI["renderer"],renderType="footer";function mergeFooterMethod(l,o,t){for(let e=0;e<l.length;e++){var{row:r,col:n,rowspan:a,colspan:u}=l[e];if(-1<n&&-1<r&&a&&u){if(r===o&&n===t)return{rowspan:a,colspan:u};if(r<=o&&o<r+a&&n<=t&&t<n+u)return{rowspan:0,colspan:0}}}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeTableFooter",props:{footerTableData:{type:Array,default:()=>[]},tableColumn:{type:Array,default:()=>[]},fixedColumn:{type:Array,default:()=>[]},fixedType:{type:String,default:null}},setup(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const renderer=_ui.VxeUI["renderer"],renderType="footer";function mergeFooterMethod(l,o,t){for(let e=0;e<l.length;e++){var{row:r,col:n,rowspan:a,colspan:u}=l[e];if(-1<n&&-1<r&&a&&u){if(r===o&&n===t)return{rowspan:a,colspan:u};if(r<=o&&o<r+a&&n<=t&&t<n+u)return{rowspan:0,colspan:0}}}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeTableFooter",props:{footerTableData:{type:Array,default:()=>[]},tableColumn:{type:Array,default:()=>[]},fixedColumn:{type:Array,default:()=>[]},fixedType:{type:String,default:null}},setup(c){const A=(0,_vue.inject)("$xeTable",{}),{xID:d,props:f,reactData:p,internalData:v}=A,{refTableHeader:a,refTableBody:u,refScrollXHandleElem:i}=A.getRefMaps(),{computeTooltipOpts:l,computeColumnOpts:x}=A.getComputeMaps(),m=(0,_vue.ref)(),_=(0,_vue.ref)(),g=(0,_vue.ref)(),y=(0,_vue.ref)(),h=(0,_vue.ref)(),b=e=>{var l=c["fixedType"],o=a.value,t=u.value,o=o?o.$el:null,r=m.value,t=t.$el,r=r.scrollLeft,n=i.value;n?n.scrollLeft=r:(n=t.scrollTop,(!!0,_dom.setScrollLeft)(o,r),(0,_dom.setScrollLeft)(t,r),A.handleScrollEvent(e,!1,!0,n,r,{type:renderType,fixed:l}))},w=(_,g,y,h,b)=>{const w=c["fixedType"],{footerCellClassName:T,footerCellStyle:C,footerAlign:F,footerSpanMethod:S,align:I,columnKey:M,showFooterOverflow:O}=f,{scrollXLoad:$,overflowX:D,scrollbarWidth:e,currentColumn:L,mergeFooterList:U}=p,j=l.value,k=x.value;return _.map((l,e)=>{var{type:o,showFooterOverflow:t,footerAlign:r,align:n,footerClassName:a,editRender:u,cellRender:i}=l,u=u||i,i=u?renderer.get(u.name):null;const s=j.showAll;u=l.children&&l.children.length,u=w?l.fixed!==w&&!u:l.fixed&&D,t=_xeUtils.default.eqNull(t)?O:t,r=r||(i?i.tableFooterCellAlign:"")||F||n||(i?i.tableCellAlign:"")||I;let d="ellipsis"===t;const c="title"===t,f=!0===t||"tooltip"===t;let p=c||f||d;var n={colid:l.id},i={},t=A.getColumnIndex(l),v=A.getVTColumnIndex(l),x=v;const m={$table:A,$grid:A.xegrid,row:y,rowIndex:b,_rowIndex:b,$rowIndex:h,column:l,columnIndex:t,$columnIndex:e,_columnIndex:v,itemIndex:x,items:y,fixed:w,type:renderType,data:g};if($&&!p&&(d=p=!0),(c||f||s)&&(i.onMouseenter=e=>{c?(0,_dom.updateCellTitle)(e.currentTarget,l):(f||s)&&A.triggerFooterTooltipEvent(e,m)}),(f||s)&&(i.onMouseleave=e=>{(f||s)&&A.handleTargetLeaveEvent(e)}),i.onClick=e=>{A.dispatchEvent("footer-cell-click",Object.assign({cell:e.currentTarget},m),e)},i.onDblclick=e=>{A.dispatchEvent("footer-cell-dblclick",Object.assign({cell:e.currentTarget},m),e)},U.length){t=mergeFooterMethod(U,b,v);if(t){var{rowspan:x,colspan:v}=t;if(!x||!v)return null;1<x&&(n.rowspan=x),1<v&&(n.colspan=v)}}else if(S){var{rowspan:t=1,colspan:x=1}=S(m)||{};if(!t||!x)return null;1<t&&(n.rowspan=t),1<x&&(n.colspan=x)}return(0,_vue.h)("td",Object.assign(Object.assign(Object.assign(Object.assign({class:["vxe-footer--column",l.id,{["col--"+r]:r,["col--"+o]:o,"col--last":e===_.length-1,"fixed--hidden":u,"col--ellipsis":p,"col--current":L===l},(0,_dom.getPropClass)(a,m),(0,_dom.getPropClass)(T,m)]},n),{style:C?_xeUtils.default.isFunction(C)?C(m):C:null}),i),{key:M||k.useKey||k.drag?l.id:e}),[(0,_vue.h)("div",{class:["vxe-cell",{"c--title":c,"c--tooltip":f,"c--ellipsis":d}]},l.renderFooter(m))])}).concat(e?[(0,_vue.h)("td",{key:"gr"+h,class:"vxe-footer--gutter col--gutter"})]:[])};return(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{var e=c["fixedType"],l=v["elemStore"],e=`${e||"main"}-footer-`;l[e+"wrapper"]=m,l[e+"table"]=_,l[e+"colgroup"]=g,l[e+"list"]=y,l[e+"xSpace"]=h})}),(0,_vue.onUnmounted)(()=>{var e=c["fixedType"],l=v["elemStore"],e=`${e||"main"}-footer-`;l[e+"wrapper"]=null,l[e+"table"]=null,l[e+"colgroup"]=null,l[e+"list"]=null,l[e+"xSpace"]=null}),()=>{let{fixedType:e,fixedColumn:l,tableColumn:o,footerTableData:t}=c;var{footerSpanMethod:r,showFooterOverflow:n}=f,a=v["visibleColumn"],{scrollXLoad:u,scrollbarWidth:i,mergeFooterList:s}=p;return e&&(o=p.expandColumn||!u&&!n||s.length&&r?a:l),(0,_vue.h)("div",{ref:m,class:["vxe-table--footer-wrapper",e?`fixed-${e}--wrapper`:"body--wrapper"],xid:d,onScroll:b},[e?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{ref:h,class:"vxe-body--x-space"}),(0,_vue.h)("table",{ref:_,class:"vxe-table--footer",xid:d,cellspacing:0,cellpadding:0,border:0},[(0,_vue.h)("colgroup",{ref:g},o.map((e,l)=>(0,_vue.h)("col",{name:e.id,key:l})).concat(i?[(0,_vue.h)("col",{name:"col_gutter"})]:[])),(0,_vue.h)("tfoot",{ref:y},(r=>{const{fixedType:n,tableColumn:a}=c,{footerRowClassName:u,footerRowStyle:i}=f,s=p["isDragColMove"],d=x.value;return r.map((e,l)=>{const o=l;var t={$table:A,row:e,_rowIndex:o,$rowIndex:l,fixed:n,type:renderType};return d.drag?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-header--col-list"+(s?"":"-disabled"),tag:"tr",class:["vxe-footer--row",u?_xeUtils.default.isFunction(u)?u(t):u:""],style:i?_xeUtils.default.isFunction(i)?i(t):i:null},{default:()=>w(a,r,e,l,o)}):(0,_vue.h)("tr",{class:["vxe-footer--row",u?_xeUtils.default.isFunction(u)?u(t):u:""],style:i?_xeUtils.default.isFunction(i)?i(t):i:null},w(a,r,e,l,o))})})(t))])])}}});
|