tomtaw-vxe-table 3.25.19 → 3.25.21
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/colgroup/index.d.ts +2 -0
- package/es/column/index.d.ts +2 -0
- package/es/grid/index.d.ts +2 -0
- package/es/grid/src/grid.d.ts +1 -0
- package/es/table/src/body.js +84 -36
- package/es/table/src/column.d.ts +2 -0
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/group.d.ts +1 -0
- package/es/table/src/header.d.ts +3 -1
- package/es/table/src/header.js +49 -12
- package/es/table/src/methods.js +142 -79
- package/es/table/src/table.js +6 -15
- package/es/table/src/util.d.ts +3 -1
- package/es/table/src/util.js +30 -14
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +315 -164
- package/lib/index.umd.min.js +3 -3
- package/lib/table/src/body.js +84 -36
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/header.js +48 -11
- package/lib/table/src/methods.js +147 -86
- package/lib/table/src/table.js +6 -15
- package/lib/table/src/util.js +30 -14
- package/lib/ui/index.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/package.json +1 -1
- package/packages/table/src/body.ts +71 -35
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/header.ts +53 -13
- package/packages/table/src/methods.ts +176 -79
- package/packages/table/src/table.ts +10 -18
- package/packages/table/src/util.ts +32 -15
- package/types/all.d.ts +23 -1
- /package/es/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
- /package/es/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
- /package/es/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
- /package/lib/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
- /package/lib/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
- /package/lib/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
|
@@ -15,6 +15,37 @@ const { getI18n, renderer, renderEmptyElement } = VxeUI
|
|
|
15
15
|
const sourceType = 'table'
|
|
16
16
|
const renderType = 'body'
|
|
17
17
|
|
|
18
|
+
// 单独传入作用域字段,让 Vue 只订阅插槽实际使用的字段。例如只读 row
|
|
19
|
+
// 的插槽不会因为 data 或 $rowIndex 随窗口变化而重绘。
|
|
20
|
+
const cellScopeKeys = [
|
|
21
|
+
'$table', '$grid', '$gantt', 'isEdit', 'seq', 'rowid', 'row', 'rowIndex', '$rowIndex',
|
|
22
|
+
'_rowIndex', 'column', 'columnIndex', '$columnIndex', '_columnIndex', 'fixed', 'source',
|
|
23
|
+
'type', 'isHidden', 'level', 'visibleData', 'data', 'items'
|
|
24
|
+
]
|
|
25
|
+
const RowScopedCell = defineVxeComponent({
|
|
26
|
+
name: 'VxeRowScopedCell',
|
|
27
|
+
props: [...cellScopeKeys, 'contentVersion', 'rowOrder', 'defaultSlot'],
|
|
28
|
+
data() {
|
|
29
|
+
const props = this.$props as Record<string, any>
|
|
30
|
+
const scope = {} as Record<string, any>
|
|
31
|
+
for (const key of cellScopeKeys) {
|
|
32
|
+
Object.defineProperty(scope, key, { enumerable: true, get: () => props[key] })
|
|
33
|
+
}
|
|
34
|
+
return { cellScope: Object.freeze(scope) }
|
|
35
|
+
},
|
|
36
|
+
render(h: CreateElement) {
|
|
37
|
+
// 非响应式行的显式刷新、完整数据更新和插槽替换也必须触发渲染。
|
|
38
|
+
void this.contentVersion
|
|
39
|
+
void this.rowOrder
|
|
40
|
+
void this.defaultSlot
|
|
41
|
+
const scope = this.cellScope
|
|
42
|
+
return h('div', {
|
|
43
|
+
class: 'vxe-cell--wrapper vxe-body-cell--wrapper',
|
|
44
|
+
attrs: { rowid: scope.rowid, colid: scope.column.id }
|
|
45
|
+
}, scope.column.renderCell(h, scope))
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
18
49
|
// 滚动、拖动过程中不需要触发
|
|
19
50
|
const isVMScrollProcess = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) => {
|
|
20
51
|
const tableProps = $xeTable
|
|
@@ -86,12 +117,35 @@ function renderLine(h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePr
|
|
|
86
117
|
return []
|
|
87
118
|
}
|
|
88
119
|
|
|
120
|
+
// 这些配置值由当前表体共用。每次渲染重新读取,保留 Vue 对配置变化的订阅。
|
|
121
|
+
function getBodyCellOptions($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
122
|
+
return {
|
|
123
|
+
cellOpts: $xeTable.computeCellOpts,
|
|
124
|
+
validOpts: $xeTable.computeValidOpts,
|
|
125
|
+
checkboxOpts: $xeTable.computeCheckboxOpts,
|
|
126
|
+
editOpts: $xeTable.computeEditOpts,
|
|
127
|
+
tooltipOpts: $xeTable.computeTooltipOpts,
|
|
128
|
+
virtualXOpts: $xeTable.computeVirtualXOpts,
|
|
129
|
+
virtualYOpts: $xeTable.computeVirtualYOpts,
|
|
130
|
+
rendererOpts: $xeTable.computeRendererOpts,
|
|
131
|
+
rowOpts: $xeTable.computeRowOpts,
|
|
132
|
+
rowDragOpts: $xeTable.computeRowDragOpts,
|
|
133
|
+
columnOpts: $xeTable.computeColumnOpts,
|
|
134
|
+
mouseOpts: $xeTable.computeMouseOpts,
|
|
135
|
+
areaOpts: $xeTable.computeAreaOpts,
|
|
136
|
+
defaultRowHeight: $xeTable.computeDefaultRowHeight,
|
|
137
|
+
cellOffsetWidth: $xeTable.computeCellOffsetWidth
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
89
141
|
/**
|
|
90
142
|
* 渲染列
|
|
91
143
|
*/
|
|
92
144
|
function renderTdColumn(
|
|
93
145
|
h: CreateElement,
|
|
94
146
|
$xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
147
|
+
options: ReturnType<typeof getBodyCellOptions>,
|
|
148
|
+
rowRest: VxeTableDefines.RowCacheItem,
|
|
95
149
|
seq: number | string,
|
|
96
150
|
rowid: string,
|
|
97
151
|
fixedType: 'left' | 'right' | '',
|
|
@@ -115,29 +169,14 @@ function renderTdColumn(
|
|
|
115
169
|
const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, treeConfig, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
|
|
116
170
|
const { tableData, tableColumn, dragRow, overflowX, overflowY, scrollXLoad, scrollYLoad, mergeBodyFlag, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, editStore, isAllOverflow, validErrorMaps, currColFlag } = tableReactData
|
|
117
171
|
const { fullAllDataRowIdData, fullColumnIdData, mergeBodyCellMaps, visibleColumn, afterFullData, mergeBodyList, scrollXStore, scrollYStore, keepUpdateFieldMaps, currentCol } = tableInternalData
|
|
118
|
-
const cellOpts =
|
|
119
|
-
const validOpts = $xeTable.computeValidOpts
|
|
120
|
-
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
121
|
-
const editOpts = $xeTable.computeEditOpts
|
|
122
|
-
const tooltipOpts = $xeTable.computeTooltipOpts
|
|
123
|
-
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
124
|
-
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
125
|
-
const rendererOpts = $xeTable.computeRendererOpts
|
|
172
|
+
const { cellOpts, validOpts, checkboxOpts, editOpts, tooltipOpts, virtualXOpts, virtualYOpts, rendererOpts, rowOpts, rowDragOpts, columnOpts, mouseOpts, areaOpts, defaultRowHeight, cellOffsetWidth } = options
|
|
126
173
|
const { isAllColumnDrag, isAllRowDrag } = $xeTable.resizableOpts
|
|
127
|
-
const rowOpts = $xeTable.computeRowOpts
|
|
128
|
-
const rowDragOpts = $xeTable.computeRowDragOpts
|
|
129
|
-
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
130
174
|
const customCellHeight = calcCellHeightFlag ? cellOpts.height || rowOpts.height : 0
|
|
131
175
|
const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = rowDragOpts
|
|
132
|
-
const columnOpts = $xeTable.computeColumnOpts
|
|
133
|
-
const mouseOpts = $xeTable.computeMouseOpts
|
|
134
|
-
const areaOpts = $xeTable.computeAreaOpts
|
|
135
|
-
const cellOffsetWidth = $xeTable.computeCellOffsetWidth
|
|
136
176
|
const { selectCellToRow } = areaOpts
|
|
137
177
|
const { field, type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column
|
|
138
178
|
const { verticalAlign: allVerticalAlign, minHeight, maxHeight } = cellOpts
|
|
139
179
|
const { actived } = editStore
|
|
140
|
-
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
141
180
|
const colid = column.id
|
|
142
181
|
const colRest = fullColumnIdData[colid] || {}
|
|
143
182
|
const renderOpts = editRender || cellRender
|
|
@@ -383,19 +422,17 @@ function renderTdColumn(
|
|
|
383
422
|
}
|
|
384
423
|
const clVNs: VxeComponentSlotType[] = []
|
|
385
424
|
if (!isVNPreEmptyStatus) {
|
|
386
|
-
|
|
387
|
-
h(
|
|
388
|
-
|
|
389
|
-
{
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
)
|
|
398
|
-
)
|
|
425
|
+
if (column.rowScopedSlot && slots && slots.default && !type && !editRender && !treeNode && !tableReactData.isRowGroupStatus) {
|
|
426
|
+
clVNs.push(h(RowScopedCell, {
|
|
427
|
+
key: rowid,
|
|
428
|
+
props: { ...cellParams, contentVersion: rowRest.contentVersion, rowOrder: tableInternalData.afterFullRowMaps, defaultSlot: slots.default }
|
|
429
|
+
}))
|
|
430
|
+
} else {
|
|
431
|
+
clVNs.push(h('div', {
|
|
432
|
+
class: 'vxe-cell--wrapper vxe-body-cell--wrapper',
|
|
433
|
+
attrs: { colid, rowid }
|
|
434
|
+
}, column.renderCell(h, cellParams)))
|
|
435
|
+
}
|
|
399
436
|
}
|
|
400
437
|
tdVNs.push(
|
|
401
438
|
h(
|
|
@@ -555,12 +592,11 @@ function renderRows(h: CreateElement, _vm: any, fixedType: 'left' | 'right' | ''
|
|
|
555
592
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
|
|
556
593
|
const { hasFixedColumn, treeExpandedFlag, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, rowExpandHeightFlag, isRowGroupStatus } = tableReactData
|
|
557
594
|
const { fullAllDataRowIdData, fullColumnIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps, currentRow } = tableInternalData
|
|
558
|
-
const
|
|
595
|
+
const options = getBodyCellOptions($xeTable)
|
|
596
|
+
const { checkboxOpts, editOpts, rowOpts, columnOpts } = options
|
|
559
597
|
const radioOpts = $xeTable.computeRadioOpts
|
|
560
598
|
const treeOpts = $xeTable.computeTreeOpts
|
|
561
|
-
const
|
|
562
|
-
const rowOpts = $xeTable.computeRowOpts
|
|
563
|
-
const columnOpts = $xeTable.computeColumnOpts
|
|
599
|
+
const currentRowId = currentRow && (rowOpts.isCurrent || tableProps.highlightCurrentRow) ? getRowid($xeTable, currentRow) : null
|
|
564
600
|
const { transform, seqMode } = treeOpts
|
|
565
601
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
566
602
|
const rows: any[] = []
|
|
@@ -646,12 +682,12 @@ function renderRows(h: CreateElement, _vm: any, fixedType: 'left' | 'right' | ''
|
|
|
646
682
|
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
647
683
|
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
|
|
648
684
|
'row--group': hasRowGroupAggregate,
|
|
649
|
-
'row--current':
|
|
685
|
+
'row--current': rowid === currentRowId
|
|
650
686
|
},
|
|
651
687
|
rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
|
|
652
688
|
]
|
|
653
689
|
const tdVNs = tableColumn.map((column, $columnIndex) => {
|
|
654
|
-
return renderTdColumn(h, $xeTable, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
|
690
|
+
return renderTdColumn(h, $xeTable, options, rowRest, seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
|
655
691
|
})
|
|
656
692
|
rows.push(
|
|
657
693
|
h(
|
|
@@ -56,6 +56,8 @@ export const columnProps = {
|
|
|
56
56
|
footerClassName: [String, Function],
|
|
57
57
|
// 格式化显示内容
|
|
58
58
|
formatter: [Function, Array, String] as PropType<VxeColumnPropTypes.Formatter<any>>,
|
|
59
|
+
// 只读插槽以独立组件订阅行内容及实际使用的窗口参数。
|
|
60
|
+
rowScopedSlot: Boolean,
|
|
59
61
|
// 格式化表头显示内容
|
|
60
62
|
headerFormatter: [Function, Array, String] as PropType<VxeColumnPropTypes.HeaderFormatter>,
|
|
61
63
|
// 格式化表尾显示内容
|
|
@@ -132,6 +132,7 @@ export class ColumnInfo {
|
|
|
132
132
|
dragSort: colConfs.dragSort,
|
|
133
133
|
rowResize: colConfs.rowResize,
|
|
134
134
|
cellType: colConfs.cellType,
|
|
135
|
+
rowScopedSlot: colConfs.rowScopedSlot,
|
|
135
136
|
cellRender: colConfs.cellRender,
|
|
136
137
|
editRender: editRender,
|
|
137
138
|
contentRender: colConfs.contentRender,
|
|
@@ -3,7 +3,7 @@ import XEUtils from 'xe-utils'
|
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
5
5
|
import { isEnableConf, getClass, getDefaultConfig, hasEnableConf } from '../../ui/src/utils'
|
|
6
|
-
import { getCalcHeight, convertHeaderColumnToRows, convertHeaderToGridRows } from './util'
|
|
6
|
+
import { getCalcHeight, convertHeaderColumnToRows, convertHeaderToGridRows, getLastChildColumn } from './util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
|
|
9
9
|
import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, VxeColumnPropTypes, TableReactData, TableInternalData, VxeComponentStyleType, VxeGlobalRendererHandles } from '../../../types'
|
|
@@ -13,7 +13,33 @@ const { renderer, renderEmptyElement } = VxeUI
|
|
|
13
13
|
const sourceType = 'table'
|
|
14
14
|
const renderType = 'header'
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type GroupWindow = Map<VxeTableDefines.ColumnInfo, { span: number; width: number; lastLeaf: VxeTableDefines.ColumnInfo }>
|
|
17
|
+
|
|
18
|
+
// 各固定区共用列对象,裁剪后的跨度和宽度只属于当前窗口。
|
|
19
|
+
function projectHeaderWindow(leaves: VxeTableDefines.ColumnInfo[], rows: VxeTableDefines.ColumnInfo[][], columnCache: TableInternalData['fullColumnIdData']) {
|
|
20
|
+
const groups: GroupWindow = new Map()
|
|
21
|
+
const headers = rows.map(() => [] as VxeTableDefines.ColumnInfo[])
|
|
22
|
+
for (const leaf of leaves) {
|
|
23
|
+
let column: VxeTableDefines.ColumnInfo | undefined = leaf
|
|
24
|
+
while (column) {
|
|
25
|
+
const headerRow = headers[column.level - 1]
|
|
26
|
+
if (!headerRow) break
|
|
27
|
+
const group = groups.get(column)
|
|
28
|
+
if (group) {
|
|
29
|
+
group.span++
|
|
30
|
+
group.width += leaf.renderWidth
|
|
31
|
+
group.lastLeaf = leaf
|
|
32
|
+
} else {
|
|
33
|
+
headerRow.push(column)
|
|
34
|
+
groups.set(column, { span: 1, width: leaf.renderWidth, lastLeaf: leaf })
|
|
35
|
+
}
|
|
36
|
+
column = column.parentId ? columnCache[column.parentId]?.column : undefined
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { headers, groups }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function renderRows(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode: boolean, headerGroups: VxeTableDefines.ColumnInfo[][], _rowIndex: number, cols: VxeTableDefines.ColumnInfo[], groups?: GroupWindow) {
|
|
17
43
|
const props = _vm
|
|
18
44
|
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
19
45
|
const $xeGrid = $xeTable.$xeGrid
|
|
@@ -93,10 +119,12 @@ function renderRows(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
93
119
|
const thAttrs: Record<string, string | number | null> = {
|
|
94
120
|
colid
|
|
95
121
|
}
|
|
122
|
+
const group = groups?.get(column)
|
|
96
123
|
let isMergeCell = false
|
|
97
124
|
// 合并行或列
|
|
98
125
|
if (!showCustomHeader) {
|
|
99
|
-
|
|
126
|
+
const colSpan = group ? group.span : column.colSpan
|
|
127
|
+
thAttrs.colspan = colSpan > 1 ? colSpan : null
|
|
100
128
|
thAttrs.rowspan = column.rowSpan > 1 ? column.rowSpan : null
|
|
101
129
|
}
|
|
102
130
|
if (mergeHeadFlag && mergeHeaderList.length && (showCustomHeader || isLastRow)) {
|
|
@@ -160,6 +188,8 @@ function renderRows(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
160
188
|
|
|
161
189
|
if (showCustomHeader) {
|
|
162
190
|
// custom
|
|
191
|
+
} else if (isColGroup && group) {
|
|
192
|
+
tcStyle.width = `${group.width}px`
|
|
163
193
|
} else if (isColGroup && !isLastRow) {
|
|
164
194
|
let childWidth = 0
|
|
165
195
|
XEUtils.eachTree(column.children, (childRow) => {
|
|
@@ -236,7 +266,7 @@ function renderRows(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
236
266
|
/**
|
|
237
267
|
* 列宽拖动
|
|
238
268
|
*/
|
|
239
|
-
!fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow)
|
|
269
|
+
!fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) && (!group || !isColGroup || group.lastLeaf === getLastChildColumn(column))
|
|
240
270
|
? h('div', {
|
|
241
271
|
class: 'vxe-cell--col-resizable',
|
|
242
272
|
on: {
|
|
@@ -385,7 +415,7 @@ function renderFilterRows(h: CreateElement, _vm: any, isOptimizeMode: boolean, c
|
|
|
385
415
|
})
|
|
386
416
|
}
|
|
387
417
|
|
|
388
|
-
function renderHeads(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode: boolean, headerGroups: VxeTableDefines.ColumnInfo[][], renderColumnList: VxeTableDefines.ColumnInfo[]) {
|
|
418
|
+
function renderHeads(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode: boolean, headerGroups: VxeTableDefines.ColumnInfo[][], renderColumnList: VxeTableDefines.ColumnInfo[], groups?: GroupWindow) {
|
|
389
419
|
const props = _vm
|
|
390
420
|
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
391
421
|
const tableProps = $xeTable
|
|
@@ -394,6 +424,8 @@ function renderHeads(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMod
|
|
|
394
424
|
|
|
395
425
|
const { headerRowClassName, headerRowStyle } = tableProps
|
|
396
426
|
const floatingFilterOpts = $xeTable.computeFloatingFilterOpts
|
|
427
|
+
// 固定区可能仅有一个跨行的叶子表头;空层也要和主表占用同样高度。
|
|
428
|
+
const groupRowStyle = groups ? { height: `${getCalcHeight($xeTable.computeHeaderCellOpts.height) || $xeTable.computeDefaultRowHeight}px` } : undefined
|
|
397
429
|
const rowVNs = headerGroups.map((cols, _rowIndex) => {
|
|
398
430
|
const params = { $table: $xeTable, rowIndex: _rowIndex, _rowIndex, $rowIndex: _rowIndex, fixed: fixedType, type: renderType }
|
|
399
431
|
return h(
|
|
@@ -401,9 +433,9 @@ function renderHeads(h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMod
|
|
|
401
433
|
{
|
|
402
434
|
key: _rowIndex,
|
|
403
435
|
class: ['vxe-header--row', headerRowClassName ? (XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName) : ''],
|
|
404
|
-
style: headerRowStyle ? ((XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) as VxeComponentStyleType) :
|
|
436
|
+
style: headerRowStyle ? ((XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) as VxeComponentStyleType) : groupRowStyle
|
|
405
437
|
},
|
|
406
|
-
renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols)
|
|
438
|
+
renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols, groups)
|
|
407
439
|
)
|
|
408
440
|
})
|
|
409
441
|
|
|
@@ -442,6 +474,11 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
442
474
|
headerColumn
|
|
443
475
|
}
|
|
444
476
|
},
|
|
477
|
+
computed: {
|
|
478
|
+
groupedHeaderRows(): VxeTableDefines.ColumnInfo[][] {
|
|
479
|
+
return convertHeaderColumnToRows(this.tableGroupColumn || [])
|
|
480
|
+
}
|
|
481
|
+
},
|
|
445
482
|
watch: {
|
|
446
483
|
tableColumn() {
|
|
447
484
|
const _vm = this as any
|
|
@@ -509,7 +546,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
509
546
|
let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
|
|
510
547
|
const isOptimizeMode = isHeaderRenderOptimize
|
|
511
548
|
|
|
512
|
-
|
|
549
|
+
let groups: GroupWindow | undefined
|
|
550
|
+
if (isGroup && isOptimizeMode) {
|
|
551
|
+
renderColumnList = fixedType ? fixedColumn : tableColumn
|
|
552
|
+
const projection = projectHeaderWindow(renderColumnList, headerColumn, fullColumnIdData)
|
|
553
|
+
renderHeaderList = projection.headers
|
|
554
|
+
groups = projection.groups
|
|
555
|
+
} else if (isGroup) {
|
|
513
556
|
renderColumnList = visibleColumn
|
|
514
557
|
} else {
|
|
515
558
|
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
@@ -622,7 +665,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
622
665
|
{
|
|
623
666
|
ref: 'refHeaderTHead'
|
|
624
667
|
},
|
|
625
|
-
renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList, renderColumnList)
|
|
668
|
+
renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList, renderColumnList, groups)
|
|
626
669
|
)
|
|
627
670
|
]
|
|
628
671
|
),
|
|
@@ -670,13 +713,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
670
713
|
const tableReactData = $xeTable as unknown as TableReactData
|
|
671
714
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
672
715
|
|
|
673
|
-
const props = _vm
|
|
674
|
-
|
|
675
716
|
const { showCustomHeader } = tableProps
|
|
676
717
|
const { collectColumn, visibleColumn } = tableInternalData
|
|
677
|
-
const { tableGroupColumn } = props
|
|
678
718
|
const { isGroup } = tableReactData
|
|
679
|
-
let spanColumns: VxeTableDefines.ColumnInfo[][] = isGroup ?
|
|
719
|
+
let spanColumns: VxeTableDefines.ColumnInfo[][] = isGroup ? (_vm as any).groupedHeaderRows : []
|
|
680
720
|
let visibleColgroups: VxeTableDefines.ColumnInfo[][] = []
|
|
681
721
|
if (showCustomHeader && spanColumns.length > 1) {
|
|
682
722
|
visibleColgroups = convertHeaderToGridRows(spanColumns)
|