vxe-table 3.15.34 → 3.15.36
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 +50 -17
- package/es/style.css +1 -1
- package/es/table/module/edit/mixin.js +2 -2
- package/es/table/module/validator/mixin.js +11 -2
- package/es/table/src/body.js +20 -3
- package/es/table/src/cell.js +52 -36
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +2 -0
- package/es/table/src/methods.js +135 -76
- package/es/table/src/props.js +3 -1
- package/es/table/src/table.js +19 -6
- package/es/table/src/util.js +5 -2
- package/es/ui/index.js +4 -4
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +57 -24
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +323 -149
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +2 -2
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +14 -2
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +19 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +43 -28
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +2 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +151 -74
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +3 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +19 -6
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +7 -4
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +4 -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/package.json +1 -1
- package/packages/grid/src/grid.ts +56 -17
- package/packages/table/module/edit/mixin.ts +2 -2
- package/packages/table/module/validator/mixin.ts +11 -3
- package/packages/table/src/body.ts +20 -3
- package/packages/table/src/cell.ts +52 -36
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/methods.ts +143 -77
- package/packages/table/src/props.ts +3 -1
- package/packages/table/src/table.ts +20 -6
- package/packages/table/src/util.ts +6 -2
- package/packages/ui/index.ts +3 -3
- /package/es/{iconfont.1749092456241.ttf → iconfont.1749440099787.ttf} +0 -0
- /package/es/{iconfont.1749092456241.woff → iconfont.1749440099787.woff} +0 -0
- /package/es/{iconfont.1749092456241.woff2 → iconfont.1749440099787.woff2} +0 -0
- /package/lib/{iconfont.1749092456241.ttf → iconfont.1749440099787.ttf} +0 -0
- /package/lib/{iconfont.1749092456241.woff → iconfont.1749440099787.woff} +0 -0
- /package/lib/{iconfont.1749092456241.woff2 → iconfont.1749440099787.woff2} +0 -0
|
@@ -221,12 +221,14 @@ export default {
|
|
|
221
221
|
beginValidate(rows, cols, cb, isFull) {
|
|
222
222
|
const $xeTable = this;
|
|
223
223
|
const props = $xeTable;
|
|
224
|
+
const reactData = $xeTable;
|
|
224
225
|
const internalData = $xeTable;
|
|
225
226
|
const validRest = {};
|
|
226
227
|
const { editRules, treeConfig } = props;
|
|
228
|
+
const { isRowGroupStatus } = reactData;
|
|
227
229
|
const { afterFullData, pendingRowMaps, removeRowMaps } = internalData;
|
|
228
230
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
229
|
-
const
|
|
231
|
+
const aggregateOpts = $xeTable.computeAggregateOpts;
|
|
230
232
|
let validList;
|
|
231
233
|
if (rows === true) {
|
|
232
234
|
validList = afterFullData;
|
|
@@ -259,6 +261,9 @@ export default {
|
|
|
259
261
|
if (pendingRowMaps[rowid]) {
|
|
260
262
|
return;
|
|
261
263
|
}
|
|
264
|
+
if ($xeTable.isAggregateRecord(row)) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
262
267
|
if (isFull || !this.validRuleErr) {
|
|
263
268
|
const colVailds = [];
|
|
264
269
|
columns.forEach((column) => {
|
|
@@ -296,7 +301,11 @@ export default {
|
|
|
296
301
|
rowValidErrs.push(Promise.all(colVailds));
|
|
297
302
|
}
|
|
298
303
|
};
|
|
299
|
-
if (
|
|
304
|
+
if (isRowGroupStatus) {
|
|
305
|
+
XEUtils.eachTree(validList, handleVaild, { children: aggregateOpts.mapChildrenField });
|
|
306
|
+
}
|
|
307
|
+
else if (treeConfig) {
|
|
308
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
300
309
|
XEUtils.eachTree(validList, handleVaild, { children: childrenField });
|
|
301
310
|
}
|
|
302
311
|
else {
|
package/es/table/src/body.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
2
|
import { VxeUI } from '../../ui';
|
|
3
3
|
import { isEnableConf, getClass } from '../../ui/src/utils';
|
|
4
|
-
import { getOffsetSize, calcTreeLine, getRowid, createHandleGetRowId } from './util';
|
|
4
|
+
import { getOffsetSize, calcTreeLine, getRowid, createHandleGetRowId, getCellRestHeight } from './util';
|
|
5
5
|
import { updateCellTitle } from '../../ui/src/dom';
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
7
7
|
const { getI18n, renderer, renderEmptyElement } = VxeUI;
|
|
@@ -190,6 +190,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
190
190
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams);
|
|
191
191
|
};
|
|
192
192
|
let isMergeCell = false;
|
|
193
|
+
let mergeRowspan = 1;
|
|
193
194
|
// 合并行或列
|
|
194
195
|
if (mergeBodyFlag && mergeBodyList.length) {
|
|
195
196
|
const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
|
|
@@ -200,6 +201,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
200
201
|
}
|
|
201
202
|
if (rowspan > 1) {
|
|
202
203
|
isMergeCell = true;
|
|
204
|
+
mergeRowspan = rowspan;
|
|
203
205
|
tdAttrs.rowspan = rowspan;
|
|
204
206
|
}
|
|
205
207
|
if (colspan > 1) {
|
|
@@ -215,9 +217,12 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
215
217
|
return null;
|
|
216
218
|
}
|
|
217
219
|
if (rowspan > 1) {
|
|
220
|
+
isMergeCell = true;
|
|
221
|
+
mergeRowspan = rowspan;
|
|
218
222
|
tdAttrs.rowspan = rowspan;
|
|
219
223
|
}
|
|
220
224
|
if (colspan > 1) {
|
|
225
|
+
isMergeCell = true;
|
|
221
226
|
tdAttrs.colspan = colspan;
|
|
222
227
|
}
|
|
223
228
|
}
|
|
@@ -232,7 +237,7 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
232
237
|
isDirty = $xeTable.isUpdateByRow(row, column.field);
|
|
233
238
|
}
|
|
234
239
|
const isVNAutoHeight = scrollYLoad && !hasEllipsis;
|
|
235
|
-
|
|
240
|
+
let cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
|
|
236
241
|
const isLastColumn = $columnIndex === columns.length - 1;
|
|
237
242
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
238
243
|
let isVNPreEmptyStatus = false;
|
|
@@ -246,6 +251,15 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
246
251
|
}
|
|
247
252
|
}
|
|
248
253
|
}
|
|
254
|
+
if (mergeRowspan > 1) {
|
|
255
|
+
const mEndRow = afterFullData[_rowIndex + mergeRowspan - 1];
|
|
256
|
+
if (mEndRow) {
|
|
257
|
+
const meRowRest = fullAllDataRowIdData[getRowid($xeTable, mEndRow)];
|
|
258
|
+
if (meRowRest) {
|
|
259
|
+
cellHeight += meRowRest.oTop - rowRest.oTop + getCellRestHeight(meRowRest, cellOpts, rowOpts, defaultRowHeight);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
249
263
|
const tcStyle = {};
|
|
250
264
|
if (hasEllipsis && resizeWidthFlag) {
|
|
251
265
|
let tsColspan = tdAttrs.colspan || 0;
|
|
@@ -279,7 +293,10 @@ function renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowL
|
|
|
279
293
|
}
|
|
280
294
|
else {
|
|
281
295
|
// 渲染单元格
|
|
282
|
-
|
|
296
|
+
if (treeConfig) {
|
|
297
|
+
tdVNs.push(...renderLine(h, $xeTable, rowid, cellParams, cellHeight));
|
|
298
|
+
}
|
|
299
|
+
tdVNs.push(h('div', {
|
|
283
300
|
key: 'tc',
|
|
284
301
|
class: ['vxe-cell', {
|
|
285
302
|
'c--title': showTitle,
|
package/es/table/src/cell.js
CHANGED
|
@@ -253,11 +253,11 @@ function renderCellHandle(h, params) {
|
|
|
253
253
|
const { editConfig } = tableProps;
|
|
254
254
|
const { isRowGroupStatus } = tableReactData;
|
|
255
255
|
const { type, treeNode, rowGroupNode, editRender } = column;
|
|
256
|
-
const
|
|
257
|
-
const { mode } =
|
|
256
|
+
const aggregateOpts = $table.computeAggregateOpts;
|
|
257
|
+
const { mode } = aggregateOpts;
|
|
258
258
|
const checkboxOpts = $table.computeCheckboxOpts;
|
|
259
259
|
const editOpts = $table.computeEditOpts;
|
|
260
|
-
const isDeepCell = treeNode || (isRowGroupStatus &&
|
|
260
|
+
const isDeepCell = treeNode || (isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode));
|
|
261
261
|
switch (type) {
|
|
262
262
|
case 'seq':
|
|
263
263
|
return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params);
|
|
@@ -356,7 +356,7 @@ export const Cell = {
|
|
|
356
356
|
const tableReactData = $table;
|
|
357
357
|
const tableInternalData = $table;
|
|
358
358
|
const { isRowGroupStatus } = tableReactData;
|
|
359
|
-
const { field, slots, editRender, cellRender, rowGroupNode } = column;
|
|
359
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
|
|
360
360
|
const renderOpts = editRender || cellRender;
|
|
361
361
|
if (slots && slots.default) {
|
|
362
362
|
return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
|
|
@@ -371,40 +371,52 @@ export const Cell = {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
let cellValue = '';
|
|
374
|
-
if (isRowGroupStatus && row.isAggregate) {
|
|
374
|
+
if (isRowGroupStatus && field && row.isAggregate) {
|
|
375
|
+
const aggRow = row;
|
|
375
376
|
const { fullColumnFieldData } = tableInternalData;
|
|
376
|
-
const
|
|
377
|
-
const { mode, showTotal, totalMethod, countFields,
|
|
378
|
-
const
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
const
|
|
377
|
+
const aggregateOpts = $table.computeAggregateOpts;
|
|
378
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts;
|
|
379
|
+
const aggMethod = aggregateOpts.aggregateMethod || aggregateOpts.countMethod;
|
|
380
|
+
const groupField = aggRow.groupField;
|
|
381
|
+
const groupContent = aggRow.groupContent;
|
|
382
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
383
|
+
const childCount = aggRow.childCount;
|
|
382
384
|
const colRest = fullColumnFieldData[groupField] || {};
|
|
383
|
-
const
|
|
385
|
+
const ctParams = {
|
|
384
386
|
$table,
|
|
385
387
|
groupField,
|
|
386
388
|
groupColumn: (colRest ? colRest.column : null),
|
|
387
389
|
column,
|
|
388
390
|
groupValue: groupContent,
|
|
389
391
|
children: childList,
|
|
390
|
-
|
|
392
|
+
childCount,
|
|
393
|
+
aggValue: null,
|
|
394
|
+
/**
|
|
395
|
+
* 已废弃
|
|
396
|
+
* @deprecated
|
|
397
|
+
*/
|
|
398
|
+
totalValue: childCount
|
|
391
399
|
};
|
|
392
|
-
if (mode === 'column' ?
|
|
400
|
+
if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
|
|
393
401
|
cellValue = groupContent;
|
|
394
402
|
if (contentMethod) {
|
|
395
|
-
cellValue = `${contentMethod(
|
|
403
|
+
cellValue = `${contentMethod(ctParams)}`;
|
|
396
404
|
}
|
|
397
405
|
if (showTotal) {
|
|
398
|
-
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(
|
|
406
|
+
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
399
407
|
}
|
|
400
408
|
}
|
|
401
|
-
else if (
|
|
402
|
-
|
|
403
|
-
|
|
409
|
+
else if ($table.getPivotTableAggregateCellAggValue) {
|
|
410
|
+
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
411
|
+
}
|
|
412
|
+
else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
413
|
+
if (aggMethod) {
|
|
414
|
+
ctParams.aggValue = childCount;
|
|
415
|
+
cellValue = `${aggMethod(ctParams)}`;
|
|
404
416
|
}
|
|
405
417
|
}
|
|
406
418
|
}
|
|
407
|
-
else
|
|
419
|
+
else {
|
|
408
420
|
cellValue = $table.getCellLabel(row, column);
|
|
409
421
|
}
|
|
410
422
|
const cellPlaceholder = editRender ? editRender.placeholder : '';
|
|
@@ -437,8 +449,8 @@ export const Cell = {
|
|
|
437
449
|
const { row, level } = params;
|
|
438
450
|
const { rowGroupExpandedFlag } = tableReactData;
|
|
439
451
|
const { rowGroupExpandedMaps } = tableInternalData;
|
|
440
|
-
const
|
|
441
|
-
const { padding, indent } =
|
|
452
|
+
const aggregateOpts = $table.computeAggregateOpts;
|
|
453
|
+
const { padding, indent } = aggregateOpts;
|
|
442
454
|
const rowid = getRowid($table, row);
|
|
443
455
|
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
|
|
444
456
|
return h('div', {
|
|
@@ -451,18 +463,20 @@ export const Cell = {
|
|
|
451
463
|
}
|
|
452
464
|
: undefined
|
|
453
465
|
}, [
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
466
|
+
row.isAggregate
|
|
467
|
+
? h('span', {
|
|
468
|
+
class: 'vxe-row-group--node-btn',
|
|
469
|
+
on: {
|
|
470
|
+
click(evnt) {
|
|
471
|
+
$table.triggerRowGroupExpandEvent(evnt, params);
|
|
472
|
+
}
|
|
459
473
|
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
474
|
+
}, [
|
|
475
|
+
h('i', {
|
|
476
|
+
class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
|
|
477
|
+
})
|
|
478
|
+
])
|
|
479
|
+
: renderEmptyElement($table),
|
|
466
480
|
h('div', {
|
|
467
481
|
class: 'vxe-row-group-cell'
|
|
468
482
|
}, cellVNodes)
|
|
@@ -545,9 +559,11 @@ export const Cell = {
|
|
|
545
559
|
renderDeepNodeBtn(h, params, cellVNodes) {
|
|
546
560
|
const { $table, row, column } = params;
|
|
547
561
|
const { rowGroupNode } = column;
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
562
|
+
const tableReactData = $table;
|
|
563
|
+
const { rowGroupList } = tableReactData;
|
|
564
|
+
if (rowGroupList.length) {
|
|
565
|
+
const aggregateOpts = $table.computeAggregateOpts;
|
|
566
|
+
const { mode } = aggregateOpts;
|
|
551
567
|
if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
|
|
552
568
|
return [Cell.renderRowGroupBtn(h, params, cellVNodes)];
|
|
553
569
|
}
|
package/es/table/src/column.js
CHANGED
|
@@ -97,6 +97,7 @@ export class ColumnInfo {
|
|
|
97
97
|
titleHelp: _vm.titleHelp,
|
|
98
98
|
titlePrefix: _vm.titlePrefix,
|
|
99
99
|
titleSuffix: _vm.titleSuffix,
|
|
100
|
+
aggFunc: _vm.aggFunc,
|
|
100
101
|
// 自定义参数
|
|
101
102
|
params: _vm.params,
|
|
102
103
|
// 渲染属性
|
|
@@ -119,6 +120,7 @@ export class ColumnInfo {
|
|
|
119
120
|
// 列排序
|
|
120
121
|
sortNumber: 0,
|
|
121
122
|
renderSortNumber: 0,
|
|
123
|
+
renderAggFn: '',
|
|
122
124
|
renderFixed: '',
|
|
123
125
|
renderVisible: false,
|
|
124
126
|
renderWidth: 0,
|