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
|
@@ -5,7 +5,7 @@ import { scrollToView } from '../../../ui/src/dom'
|
|
|
5
5
|
import { handleFieldOrColumn, getRowid } from '../../src/util'
|
|
6
6
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
7
7
|
|
|
8
|
-
import type { VxeTableDefines, TableInternalData } from '../../../../types'
|
|
8
|
+
import type { VxeTableDefines, TableInternalData, TableReactData } from '../../../../types'
|
|
9
9
|
|
|
10
10
|
const { getConfig, validators } = VxeUI
|
|
11
11
|
|
|
@@ -229,13 +229,15 @@ export default {
|
|
|
229
229
|
beginValidate (rows: any, cols: VxeTableDefines.ColumnInfo[] | null, cb: any, isFull: any) {
|
|
230
230
|
const $xeTable = this
|
|
231
231
|
const props = $xeTable
|
|
232
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
232
233
|
const internalData = $xeTable as unknown as TableInternalData
|
|
233
234
|
|
|
234
235
|
const validRest: any = {}
|
|
235
236
|
const { editRules, treeConfig } = props
|
|
237
|
+
const { isRowGroupStatus } = reactData
|
|
236
238
|
const { afterFullData, pendingRowMaps, removeRowMaps } = internalData
|
|
237
239
|
const treeOpts = $xeTable.computeTreeOpts
|
|
238
|
-
const
|
|
240
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
239
241
|
let validList
|
|
240
242
|
if (rows === true) {
|
|
241
243
|
validList = afterFullData
|
|
@@ -266,6 +268,9 @@ export default {
|
|
|
266
268
|
if (pendingRowMaps[rowid]) {
|
|
267
269
|
return
|
|
268
270
|
}
|
|
271
|
+
if ($xeTable.isAggregateRecord(row)) {
|
|
272
|
+
return
|
|
273
|
+
}
|
|
269
274
|
if (isFull || !this.validRuleErr) {
|
|
270
275
|
const colVailds: any[] = []
|
|
271
276
|
columns.forEach((column: any) => {
|
|
@@ -305,7 +310,10 @@ export default {
|
|
|
305
310
|
rowValidErrs.push(Promise.all(colVailds))
|
|
306
311
|
}
|
|
307
312
|
}
|
|
308
|
-
if (
|
|
313
|
+
if (isRowGroupStatus) {
|
|
314
|
+
XEUtils.eachTree(validList, handleVaild, { children: aggregateOpts.mapChildrenField })
|
|
315
|
+
} else if (treeConfig) {
|
|
316
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
309
317
|
XEUtils.eachTree(validList, handleVaild, { children: childrenField })
|
|
310
318
|
} else {
|
|
311
319
|
validList.forEach(handleVaild)
|
|
@@ -2,7 +2,7 @@ import { PropType, CreateElement } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
4
|
import { isEnableConf, getClass } from '../../ui/src/utils'
|
|
5
|
-
import { getOffsetSize, calcTreeLine, getRowid, createHandleGetRowId } from './util'
|
|
5
|
+
import { getOffsetSize, calcTreeLine, getRowid, createHandleGetRowId, getCellRestHeight } from './util'
|
|
6
6
|
import { updateCellTitle } from '../../ui/src/dom'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
|
|
@@ -218,6 +218,7 @@ function renderTdColumn (
|
|
|
218
218
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams)
|
|
219
219
|
}
|
|
220
220
|
let isMergeCell = false
|
|
221
|
+
let mergeRowspan = 1
|
|
221
222
|
// 合并行或列
|
|
222
223
|
if (mergeBodyFlag && mergeBodyList.length) {
|
|
223
224
|
const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`]
|
|
@@ -228,6 +229,7 @@ function renderTdColumn (
|
|
|
228
229
|
}
|
|
229
230
|
if (rowspan > 1) {
|
|
230
231
|
isMergeCell = true
|
|
232
|
+
mergeRowspan = rowspan
|
|
231
233
|
tdAttrs.rowspan = rowspan
|
|
232
234
|
}
|
|
233
235
|
if (colspan > 1) {
|
|
@@ -242,9 +244,12 @@ function renderTdColumn (
|
|
|
242
244
|
return null
|
|
243
245
|
}
|
|
244
246
|
if (rowspan > 1) {
|
|
247
|
+
isMergeCell = true
|
|
248
|
+
mergeRowspan = rowspan
|
|
245
249
|
tdAttrs.rowspan = rowspan
|
|
246
250
|
}
|
|
247
251
|
if (colspan > 1) {
|
|
252
|
+
isMergeCell = true
|
|
248
253
|
tdAttrs.colspan = colspan
|
|
249
254
|
}
|
|
250
255
|
}
|
|
@@ -260,7 +265,7 @@ function renderTdColumn (
|
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
const isVNAutoHeight = scrollYLoad && !hasEllipsis
|
|
263
|
-
|
|
268
|
+
let cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
264
269
|
|
|
265
270
|
const isLastColumn = $columnIndex === columns.length - 1
|
|
266
271
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
@@ -276,6 +281,16 @@ function renderTdColumn (
|
|
|
276
281
|
}
|
|
277
282
|
}
|
|
278
283
|
|
|
284
|
+
if (mergeRowspan > 1) {
|
|
285
|
+
const mEndRow = afterFullData[_rowIndex + mergeRowspan - 1]
|
|
286
|
+
if (mEndRow) {
|
|
287
|
+
const meRowRest = fullAllDataRowIdData[getRowid($xeTable, mEndRow)]
|
|
288
|
+
if (meRowRest) {
|
|
289
|
+
cellHeight += meRowRest.oTop - rowRest.oTop + getCellRestHeight(meRowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
279
294
|
const tcStyle: Record<string, string> = {}
|
|
280
295
|
if (hasEllipsis && resizeWidthFlag) {
|
|
281
296
|
let tsColspan = tdAttrs.colspan || 0
|
|
@@ -310,8 +325,10 @@ function renderTdColumn (
|
|
|
310
325
|
)
|
|
311
326
|
} else {
|
|
312
327
|
// 渲染单元格
|
|
328
|
+
if (treeConfig) {
|
|
329
|
+
tdVNs.push(...renderLine(h, $xeTable, rowid, cellParams, cellHeight))
|
|
330
|
+
}
|
|
313
331
|
tdVNs.push(
|
|
314
|
-
...renderLine(h, $xeTable, rowid, cellParams, cellHeight),
|
|
315
332
|
h('div', {
|
|
316
333
|
key: 'tc',
|
|
317
334
|
class: ['vxe-cell', {
|
|
@@ -270,11 +270,11 @@ function renderCellHandle (h: CreateElement, params: VxeTableDefines.CellRenderB
|
|
|
270
270
|
const { editConfig } = tableProps
|
|
271
271
|
const { isRowGroupStatus } = tableReactData
|
|
272
272
|
const { type, treeNode, rowGroupNode, editRender } = column
|
|
273
|
-
const
|
|
274
|
-
const { mode } =
|
|
273
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
274
|
+
const { mode } = aggregateOpts
|
|
275
275
|
const checkboxOpts = $table.computeCheckboxOpts
|
|
276
276
|
const editOpts = $table.computeEditOpts
|
|
277
|
-
const isDeepCell = treeNode || (isRowGroupStatus &&
|
|
277
|
+
const isDeepCell = treeNode || (isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode))
|
|
278
278
|
switch (type) {
|
|
279
279
|
case 'seq':
|
|
280
280
|
return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params)
|
|
@@ -375,7 +375,7 @@ export const Cell = {
|
|
|
375
375
|
const tableReactData = $table as unknown as TableReactData
|
|
376
376
|
const tableInternalData = $table as unknown as TableInternalData
|
|
377
377
|
const { isRowGroupStatus } = tableReactData
|
|
378
|
-
const { field, slots, editRender, cellRender, rowGroupNode } = column
|
|
378
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
|
|
379
379
|
const renderOpts = editRender || cellRender
|
|
380
380
|
if (slots && slots.default) {
|
|
381
381
|
return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h))
|
|
@@ -390,38 +390,50 @@ export const Cell = {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
let cellValue: string | number | null = ''
|
|
393
|
-
if (isRowGroupStatus && row.isAggregate) {
|
|
393
|
+
if (isRowGroupStatus && field && row.isAggregate) {
|
|
394
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = row
|
|
394
395
|
const { fullColumnFieldData } = tableInternalData
|
|
395
|
-
const
|
|
396
|
-
const { mode, showTotal, totalMethod, countFields,
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
const
|
|
396
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
397
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts
|
|
398
|
+
const aggMethod = aggregateOpts.aggregateMethod || aggregateOpts.countMethod
|
|
399
|
+
const groupField = aggRow.groupField
|
|
400
|
+
const groupContent = aggRow.groupContent
|
|
401
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : []
|
|
402
|
+
const childCount = aggRow.childCount
|
|
401
403
|
const colRest = fullColumnFieldData[groupField] || {}
|
|
402
|
-
const
|
|
404
|
+
const ctParams = {
|
|
403
405
|
$table,
|
|
404
406
|
groupField,
|
|
405
407
|
groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
|
|
406
408
|
column,
|
|
407
409
|
groupValue: groupContent,
|
|
408
410
|
children: childList,
|
|
409
|
-
|
|
411
|
+
childCount,
|
|
412
|
+
aggValue: null as any,
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* 已废弃
|
|
416
|
+
* @deprecated
|
|
417
|
+
*/
|
|
418
|
+
totalValue: childCount
|
|
410
419
|
}
|
|
411
|
-
if (mode === 'column' ?
|
|
420
|
+
if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
|
|
412
421
|
cellValue = groupContent
|
|
413
422
|
if (contentMethod) {
|
|
414
|
-
cellValue = `${contentMethod(
|
|
423
|
+
cellValue = `${contentMethod(ctParams)}`
|
|
415
424
|
}
|
|
416
425
|
if (showTotal) {
|
|
417
|
-
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(
|
|
426
|
+
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount])
|
|
418
427
|
}
|
|
419
|
-
} else if (
|
|
420
|
-
|
|
421
|
-
|
|
428
|
+
} else if ($table.getPivotTableAggregateCellAggValue) {
|
|
429
|
+
cellValue = $table.getPivotTableAggregateCellAggValue(params)
|
|
430
|
+
} else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
431
|
+
if (aggMethod) {
|
|
432
|
+
ctParams.aggValue = childCount
|
|
433
|
+
cellValue = `${aggMethod(ctParams)}`
|
|
422
434
|
}
|
|
423
435
|
}
|
|
424
|
-
} else
|
|
436
|
+
} else {
|
|
425
437
|
cellValue = $table.getCellLabel(row, column)
|
|
426
438
|
}
|
|
427
439
|
const cellPlaceholder = editRender ? editRender.placeholder : ''
|
|
@@ -455,8 +467,8 @@ export const Cell = {
|
|
|
455
467
|
const { row, level } = params
|
|
456
468
|
const { rowGroupExpandedFlag } = tableReactData
|
|
457
469
|
const { rowGroupExpandedMaps } = tableInternalData
|
|
458
|
-
const
|
|
459
|
-
const { padding, indent } =
|
|
470
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
471
|
+
const { padding, indent } = aggregateOpts
|
|
460
472
|
const rowid = getRowid($table, row)
|
|
461
473
|
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid]
|
|
462
474
|
return h('div', {
|
|
@@ -469,18 +481,20 @@ export const Cell = {
|
|
|
469
481
|
}
|
|
470
482
|
: undefined
|
|
471
483
|
}, [
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
484
|
+
row.isAggregate
|
|
485
|
+
? h('span', {
|
|
486
|
+
class: 'vxe-row-group--node-btn',
|
|
487
|
+
on: {
|
|
488
|
+
click (evnt: MouseEvent) {
|
|
489
|
+
$table.triggerRowGroupExpandEvent(evnt, params)
|
|
490
|
+
}
|
|
477
491
|
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
492
|
+
}, [
|
|
493
|
+
h('i', {
|
|
494
|
+
class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
|
|
495
|
+
})
|
|
496
|
+
])
|
|
497
|
+
: renderEmptyElement($table),
|
|
484
498
|
h('div', {
|
|
485
499
|
class: 'vxe-row-group-cell'
|
|
486
500
|
}, cellVNodes)
|
|
@@ -563,9 +577,11 @@ export const Cell = {
|
|
|
563
577
|
renderDeepNodeBtn (h: CreateElement, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
|
|
564
578
|
const { $table, row, column } = params
|
|
565
579
|
const { rowGroupNode } = column
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
580
|
+
const tableReactData = $table as unknown as TableReactData
|
|
581
|
+
const { rowGroupList } = tableReactData
|
|
582
|
+
if (rowGroupList.length) {
|
|
583
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
584
|
+
const { mode } = aggregateOpts
|
|
569
585
|
if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
|
|
570
586
|
return [Cell.renderRowGroupBtn(h, params, cellVNodes)]
|
|
571
587
|
}
|
|
@@ -103,6 +103,7 @@ export class ColumnInfo {
|
|
|
103
103
|
titleHelp: _vm.titleHelp,
|
|
104
104
|
titlePrefix: _vm.titlePrefix,
|
|
105
105
|
titleSuffix: _vm.titleSuffix,
|
|
106
|
+
aggFunc: _vm.aggFunc,
|
|
106
107
|
// 自定义参数
|
|
107
108
|
params: _vm.params,
|
|
108
109
|
// 渲染属性
|
|
@@ -128,6 +129,8 @@ export class ColumnInfo {
|
|
|
128
129
|
sortNumber: 0, // 用于记录自定义列顺序
|
|
129
130
|
renderSortNumber: 0, // 用于记录自定义列顺序
|
|
130
131
|
|
|
132
|
+
renderAggFn: '',
|
|
133
|
+
|
|
131
134
|
renderFixed: '',
|
|
132
135
|
renderVisible: false,
|
|
133
136
|
|