vxe-table 3.10.16 → 3.11.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.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/mixin.js +5 -1
- package/es/table/module/edit/mixin.js +32 -15
- package/es/table/src/body.js +40 -24
- package/es/table/src/cell.js +75 -32
- package/es/table/src/footer.js +159 -131
- package/es/table/src/header.js +128 -90
- package/es/table/src/methods.js +284 -65
- package/es/table/src/props.js +5 -1
- package/es/table/src/table.js +64 -20
- 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 +917 -449
- 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-CHT.umd.js +1 -0
- 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/mixin.js +5 -1
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/edit/mixin.js +34 -15
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/body.js +31 -15
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +82 -35
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/footer.js +198 -161
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +169 -128
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +313 -68
- package/lib/table/src/methods.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 +70 -20
- package/lib/table/src/table.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/mixin.ts +5 -1
- package/packages/table/module/edit/mixin.ts +32 -15
- package/packages/table/src/body.ts +43 -25
- package/packages/table/src/cell.ts +120 -67
- package/packages/table/src/footer.ts +164 -150
- package/packages/table/src/header.ts +136 -90
- package/packages/table/src/methods.ts +296 -67
- package/packages/table/src/props.ts +5 -1
- package/packages/table/src/table.ts +71 -19
- package/packages/ui/index.ts +8 -3
- package/styles/components/table.scss +42 -35
- /package/es/{iconfont.1731633464058.ttf → iconfont.1731937243466.ttf} +0 -0
- /package/es/{iconfont.1731633464058.woff → iconfont.1731937243466.woff} +0 -0
- /package/es/{iconfont.1731633464058.woff2 → iconfont.1731937243466.woff2} +0 -0
- /package/lib/{iconfont.1731633464058.ttf → iconfont.1731937243466.ttf} +0 -0
- /package/lib/{iconfont.1731633464058.woff → iconfont.1731937243466.woff} +0 -0
- /package/lib/{iconfont.1731633464058.woff2 → iconfont.1731937243466.woff2} +0 -0
|
@@ -4,6 +4,8 @@ import { VxeUI } from '../../ui'
|
|
|
4
4
|
import { getClass } from '../../ui/src/utils'
|
|
5
5
|
import { updateCellTitle, setScrollLeft } from '../../ui/src/dom'
|
|
6
6
|
|
|
7
|
+
import type { VxeTableDefines } from '../../../types'
|
|
8
|
+
|
|
7
9
|
const renderType = 'footer'
|
|
8
10
|
|
|
9
11
|
const { renderer } = VxeUI
|
|
@@ -22,6 +24,166 @@ function mergeFooterMethod (mergeFooterList: any, _rowIndex: any, _columnIndex:
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
function renderRows (h: CreateElement, _vm: any, tableColumn: VxeTableDefines.ColumnInfo[], footerTableData: any[], row: any, $rowIndex: number, _rowIndex: number) {
|
|
28
|
+
const { $parent: $xetable, fixedType } = _vm
|
|
29
|
+
const { $listeners: tableListeners, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, mergeFooterList, footerSpanMethod, align: allAlign, scrollXLoad, columnKey, columnOpts, showFooterOverflow: allColumnFooterOverflow, currentColumn, overflowX, scrollbarWidth, tooltipOpts } = $xetable
|
|
30
|
+
|
|
31
|
+
return tableColumn.map((column: any, $columnIndex: any) => {
|
|
32
|
+
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
33
|
+
const renderOpts = editRender || cellRender
|
|
34
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
35
|
+
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled
|
|
36
|
+
const isColGroup = column.children && column.children.length
|
|
37
|
+
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX
|
|
38
|
+
const footOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
39
|
+
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
40
|
+
let showEllipsis = footOverflow === 'ellipsis'
|
|
41
|
+
const showTitle = footOverflow === 'title'
|
|
42
|
+
const showTooltip = footOverflow === true || footOverflow === 'tooltip'
|
|
43
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
44
|
+
const attrs: any = { colid: column.id }
|
|
45
|
+
const tfOns: any = {}
|
|
46
|
+
const columnIndex = $xetable.getColumnIndex(column)
|
|
47
|
+
const _columnIndex = $xetable.getVTColumnIndex(column)
|
|
48
|
+
const itemIndex = _columnIndex
|
|
49
|
+
const cellParams = {
|
|
50
|
+
$table: $xetable,
|
|
51
|
+
$grid: $xetable.xegrid,
|
|
52
|
+
row,
|
|
53
|
+
_rowIndex,
|
|
54
|
+
$rowIndex,
|
|
55
|
+
column,
|
|
56
|
+
columnIndex,
|
|
57
|
+
$columnIndex,
|
|
58
|
+
_columnIndex,
|
|
59
|
+
itemIndex,
|
|
60
|
+
items: row,
|
|
61
|
+
fixed: fixedType,
|
|
62
|
+
type: renderType,
|
|
63
|
+
data: footerTableData
|
|
64
|
+
}
|
|
65
|
+
// 虚拟滚动不支持动态高度
|
|
66
|
+
if (scrollXLoad && !hasEllipsis) {
|
|
67
|
+
showEllipsis = hasEllipsis = true
|
|
68
|
+
}
|
|
69
|
+
if (showTitle || showTooltip || showAllTip) {
|
|
70
|
+
tfOns.mouseenter = (evnt: any) => {
|
|
71
|
+
if (showTitle) {
|
|
72
|
+
updateCellTitle(evnt.currentTarget, column)
|
|
73
|
+
} else if (showTooltip || showAllTip) {
|
|
74
|
+
$xetable.triggerFooterTooltipEvent(evnt, cellParams)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (showTooltip || showAllTip) {
|
|
79
|
+
tfOns.mouseleave = (evnt: any) => {
|
|
80
|
+
if (showTooltip || showAllTip) {
|
|
81
|
+
$xetable.handleTargetLeaveEvent(evnt)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (tableListeners['footer-cell-click']) {
|
|
86
|
+
tfOns.click = (evnt: any) => {
|
|
87
|
+
$xetable.emitEvent('footer-cell-click', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (tableListeners['footer-cell-dblclick']) {
|
|
91
|
+
tfOns.dblclick = (evnt: any) => {
|
|
92
|
+
$xetable.emitEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// 合并行或列
|
|
96
|
+
if (mergeFooterList.length) {
|
|
97
|
+
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex)
|
|
98
|
+
if (spanRest) {
|
|
99
|
+
const { rowspan, colspan } = spanRest
|
|
100
|
+
if (!rowspan || !colspan) {
|
|
101
|
+
return null
|
|
102
|
+
}
|
|
103
|
+
if (rowspan > 1) {
|
|
104
|
+
attrs.rowspan = rowspan
|
|
105
|
+
}
|
|
106
|
+
if (colspan > 1) {
|
|
107
|
+
attrs.colspan = colspan
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
} else if (footerSpanMethod) {
|
|
111
|
+
// 自定义合并方法
|
|
112
|
+
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {}
|
|
113
|
+
if (!rowspan || !colspan) {
|
|
114
|
+
return null
|
|
115
|
+
}
|
|
116
|
+
if (rowspan > 1) {
|
|
117
|
+
attrs.rowspan = rowspan
|
|
118
|
+
}
|
|
119
|
+
if (colspan > 1) {
|
|
120
|
+
attrs.colspan = colspan
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return h('td', {
|
|
124
|
+
class: ['vxe-footer--column', column.id, {
|
|
125
|
+
[`col--${footAlign}`]: footAlign,
|
|
126
|
+
[`col--${type}`]: type,
|
|
127
|
+
'col--last': $columnIndex === tableColumn.length - 1,
|
|
128
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
129
|
+
'col--ellipsis': hasEllipsis,
|
|
130
|
+
'col--current': currentColumn === column
|
|
131
|
+
}, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
|
|
132
|
+
attrs,
|
|
133
|
+
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
134
|
+
on: tfOns,
|
|
135
|
+
key: columnKey || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
136
|
+
}, [
|
|
137
|
+
h('div', {
|
|
138
|
+
class: ['vxe-cell', {
|
|
139
|
+
'c--title': showTitle,
|
|
140
|
+
'c--tooltip': showTooltip,
|
|
141
|
+
'c--ellipsis': showEllipsis
|
|
142
|
+
}]
|
|
143
|
+
}, column.renderFooter(h, cellParams))
|
|
144
|
+
])
|
|
145
|
+
}).concat(scrollbarWidth
|
|
146
|
+
? [
|
|
147
|
+
h('td', {
|
|
148
|
+
key: `gr${$rowIndex}`,
|
|
149
|
+
class: 'vxe-footer--gutter col--gutter'
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
: [])
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function renderHeads (h: CreateElement, _vm: any, footerTableData: any[]) {
|
|
156
|
+
const { $parent: $xetable, fixedType, tableColumn } = _vm
|
|
157
|
+
const { footerRowClassName, footerRowStyle, isDragColMove } = $xetable
|
|
158
|
+
const columnOpts = $xetable.columnOpts
|
|
159
|
+
|
|
160
|
+
return footerTableData.map((row: any, $rowIndex: any) => {
|
|
161
|
+
const _rowIndex = $rowIndex
|
|
162
|
+
const rowParams = { $table: $xetable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
|
|
163
|
+
|
|
164
|
+
if (columnOpts.drag) {
|
|
165
|
+
return h('transition-group', {
|
|
166
|
+
props: {
|
|
167
|
+
tag: 'tr',
|
|
168
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
169
|
+
class: [
|
|
170
|
+
'vxe-footer--row',
|
|
171
|
+
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
172
|
+
],
|
|
173
|
+
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
174
|
+
}
|
|
175
|
+
}, renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIndex))
|
|
176
|
+
}
|
|
177
|
+
return h('tr', {
|
|
178
|
+
class: [
|
|
179
|
+
'vxe-footer--row',
|
|
180
|
+
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
181
|
+
],
|
|
182
|
+
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
183
|
+
}, renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIndex))
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
25
187
|
export default {
|
|
26
188
|
name: 'VxeTableFooter',
|
|
27
189
|
props: {
|
|
@@ -53,28 +215,7 @@ export default {
|
|
|
53
215
|
},
|
|
54
216
|
render (h: CreateElement) {
|
|
55
217
|
let { _e, $parent: $xetable, fixedType, fixedColumn, tableColumn, footerTableData } = this
|
|
56
|
-
const {
|
|
57
|
-
$listeners: tableListeners,
|
|
58
|
-
tId,
|
|
59
|
-
footerRowClassName,
|
|
60
|
-
footerCellClassName,
|
|
61
|
-
footerRowStyle,
|
|
62
|
-
footerCellStyle,
|
|
63
|
-
footerAlign: allFooterAlign,
|
|
64
|
-
mergeFooterList,
|
|
65
|
-
footerSpanMethod,
|
|
66
|
-
align: allAlign,
|
|
67
|
-
scrollXLoad,
|
|
68
|
-
columnKey,
|
|
69
|
-
columnOpts,
|
|
70
|
-
showFooterOverflow: allColumnFooterOverflow,
|
|
71
|
-
currentColumn,
|
|
72
|
-
overflowX,
|
|
73
|
-
scrollbarWidth,
|
|
74
|
-
tooltipOpts,
|
|
75
|
-
visibleColumn,
|
|
76
|
-
expandColumn
|
|
77
|
-
} = $xetable
|
|
218
|
+
const { tId, mergeFooterList, footerSpanMethod, scrollXLoad, showFooterOverflow: allColumnFooterOverflow, scrollbarWidth, visibleColumn, expandColumn } = $xetable
|
|
78
219
|
// 如果是使用优化模式
|
|
79
220
|
if (fixedType) {
|
|
80
221
|
// 如果存在展开行使用全量渲染
|
|
@@ -139,134 +280,7 @@ export default {
|
|
|
139
280
|
*/
|
|
140
281
|
h('tfoot', {
|
|
141
282
|
ref: 'tfoot'
|
|
142
|
-
},
|
|
143
|
-
const $rowIndex = _rowIndex
|
|
144
|
-
const rowParams = { $table: $xetable, row: list, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
|
|
145
|
-
return h('tr', {
|
|
146
|
-
class: ['vxe-footer--row', footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
|
|
147
|
-
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
148
|
-
}, tableColumn.map((column: any, $columnIndex: any) => {
|
|
149
|
-
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
150
|
-
const renderOpts = editRender || cellRender
|
|
151
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
152
|
-
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled
|
|
153
|
-
const isColGroup = column.children && column.children.length
|
|
154
|
-
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX
|
|
155
|
-
const footOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
156
|
-
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
157
|
-
let showEllipsis = footOverflow === 'ellipsis'
|
|
158
|
-
const showTitle = footOverflow === 'title'
|
|
159
|
-
const showTooltip = footOverflow === true || footOverflow === 'tooltip'
|
|
160
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
161
|
-
const attrs: any = { colid: column.id }
|
|
162
|
-
const tfOns: any = {}
|
|
163
|
-
const columnIndex = $xetable.getColumnIndex(column)
|
|
164
|
-
const _columnIndex = $xetable.getVTColumnIndex(column)
|
|
165
|
-
const itemIndex = _columnIndex
|
|
166
|
-
const cellParams = {
|
|
167
|
-
$table: $xetable,
|
|
168
|
-
$grid: $xetable.xegrid,
|
|
169
|
-
row: list,
|
|
170
|
-
_rowIndex,
|
|
171
|
-
$rowIndex,
|
|
172
|
-
column,
|
|
173
|
-
columnIndex,
|
|
174
|
-
$columnIndex,
|
|
175
|
-
_columnIndex,
|
|
176
|
-
itemIndex,
|
|
177
|
-
items: list,
|
|
178
|
-
fixed: fixedType,
|
|
179
|
-
type: renderType,
|
|
180
|
-
data: footerTableData
|
|
181
|
-
}
|
|
182
|
-
// 虚拟滚动不支持动态高度
|
|
183
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
184
|
-
showEllipsis = hasEllipsis = true
|
|
185
|
-
}
|
|
186
|
-
if (showTitle || showTooltip || showAllTip) {
|
|
187
|
-
tfOns.mouseenter = (evnt: any) => {
|
|
188
|
-
if (showTitle) {
|
|
189
|
-
updateCellTitle(evnt.currentTarget, column)
|
|
190
|
-
} else if (showTooltip || showAllTip) {
|
|
191
|
-
$xetable.triggerFooterTooltipEvent(evnt, cellParams)
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (showTooltip || showAllTip) {
|
|
196
|
-
tfOns.mouseleave = (evnt: any) => {
|
|
197
|
-
if (showTooltip || showAllTip) {
|
|
198
|
-
$xetable.handleTargetLeaveEvent(evnt)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (tableListeners['footer-cell-click']) {
|
|
203
|
-
tfOns.click = (evnt: any) => {
|
|
204
|
-
$xetable.emitEvent('footer-cell-click', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (tableListeners['footer-cell-dblclick']) {
|
|
208
|
-
tfOns.dblclick = (evnt: any) => {
|
|
209
|
-
$xetable.emitEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
// 合并行或列
|
|
213
|
-
if (mergeFooterList.length) {
|
|
214
|
-
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex)
|
|
215
|
-
if (spanRest) {
|
|
216
|
-
const { rowspan, colspan } = 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 { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {}
|
|
230
|
-
if (!rowspan || !colspan) {
|
|
231
|
-
return null
|
|
232
|
-
}
|
|
233
|
-
if (rowspan > 1) {
|
|
234
|
-
attrs.rowspan = rowspan
|
|
235
|
-
}
|
|
236
|
-
if (colspan > 1) {
|
|
237
|
-
attrs.colspan = colspan
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return h('td', {
|
|
241
|
-
class: ['vxe-footer--column', column.id, {
|
|
242
|
-
[`col--${footAlign}`]: footAlign,
|
|
243
|
-
[`col--${type}`]: type,
|
|
244
|
-
'col--last': $columnIndex === tableColumn.length - 1,
|
|
245
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
246
|
-
'col--ellipsis': hasEllipsis,
|
|
247
|
-
'col--current': currentColumn === column
|
|
248
|
-
}, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
|
|
249
|
-
attrs,
|
|
250
|
-
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
251
|
-
on: tfOns,
|
|
252
|
-
key: columnKey || columnOpts.useKey ? column.id : $columnIndex
|
|
253
|
-
}, [
|
|
254
|
-
h('div', {
|
|
255
|
-
class: ['vxe-cell', {
|
|
256
|
-
'c--title': showTitle,
|
|
257
|
-
'c--tooltip': showTooltip,
|
|
258
|
-
'c--ellipsis': showEllipsis
|
|
259
|
-
}]
|
|
260
|
-
}, column.renderFooter(h, cellParams))
|
|
261
|
-
])
|
|
262
|
-
}).concat(scrollbarWidth
|
|
263
|
-
? [
|
|
264
|
-
h('td', {
|
|
265
|
-
class: 'vxe-footer--gutter col--gutter'
|
|
266
|
-
})
|
|
267
|
-
]
|
|
268
|
-
: []))
|
|
269
|
-
}))
|
|
283
|
+
}, renderHeads(h, this, footerTableData))
|
|
270
284
|
])
|
|
271
285
|
])
|
|
272
286
|
},
|
|
@@ -5,10 +5,144 @@ import { getClass } from '../../ui/src/utils'
|
|
|
5
5
|
import { getOffsetPos, hasClass, addClass, removeClass } from '../../ui/src/dom'
|
|
6
6
|
import { convertHeaderColumnToRows, getColReMinWidth } from './util'
|
|
7
7
|
|
|
8
|
+
import type { VxeTableDefines } from '../../../types'
|
|
9
|
+
|
|
8
10
|
const { renderer } = VxeUI
|
|
9
11
|
|
|
10
12
|
const cellType = 'header'
|
|
11
13
|
|
|
14
|
+
const renderRows = (h: CreateElement, _vm: any, cols: VxeTableDefines.ColumnInfo[], $rowIndex: number) => {
|
|
15
|
+
const { $parent: $xetable, fixedType } = _vm
|
|
16
|
+
const { $listeners: tableListeners, resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, highlightCurrentColumn, currentColumn, scrollXLoad, overflowX, scrollbarWidth, sortOpts, mouseConfig, columnOpts } = $xetable
|
|
17
|
+
|
|
18
|
+
return cols.map((column: any, $columnIndex: any) => {
|
|
19
|
+
const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column
|
|
20
|
+
// const { enabled } = tooltipOpts
|
|
21
|
+
const colid = column.id
|
|
22
|
+
const renderOpts = editRender || cellRender
|
|
23
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
24
|
+
const isColGroup = column.children && column.children.length
|
|
25
|
+
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX
|
|
26
|
+
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
|
|
27
|
+
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
28
|
+
let showEllipsis = headOverflow === 'ellipsis'
|
|
29
|
+
const showTitle = headOverflow === 'title'
|
|
30
|
+
const showTooltip = headOverflow === true || headOverflow === 'tooltip'
|
|
31
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
32
|
+
const thOns: any = {}
|
|
33
|
+
const hasFilter = column.filters && column.filters.some((item: any) => item.checked)
|
|
34
|
+
const columnIndex = $xetable.getColumnIndex(column)
|
|
35
|
+
const _columnIndex = $xetable.getVTColumnIndex(column)
|
|
36
|
+
const params = { $table: $xetable, $grid: $xetable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter }
|
|
37
|
+
// 虚拟滚动不支持动态高度
|
|
38
|
+
if (scrollXLoad && !hasEllipsis) {
|
|
39
|
+
showEllipsis = hasEllipsis = true
|
|
40
|
+
}
|
|
41
|
+
if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
|
|
42
|
+
thOns.click = (evnt: any) => $xetable.triggerHeaderCellClickEvent(evnt, params)
|
|
43
|
+
}
|
|
44
|
+
if (tableListeners['header-cell-dblclick']) {
|
|
45
|
+
thOns.dblclick = (evnt: any) => $xetable.triggerHeaderCellDblclickEvent(evnt, params)
|
|
46
|
+
}
|
|
47
|
+
// 按下事件处理
|
|
48
|
+
if (mouseConfig) {
|
|
49
|
+
thOns.mousedown = (evnt: any) => $xetable.triggerHeaderCellMousedownEvent(evnt, params)
|
|
50
|
+
}
|
|
51
|
+
// 拖拽行事件
|
|
52
|
+
if (columnOpts.drag && !column.parentId) {
|
|
53
|
+
thOns.dragstart = $xetable.handleHeaderCellDragDragstartEvent
|
|
54
|
+
thOns.dragend = $xetable.handleHeaderCellDragDragendEvent
|
|
55
|
+
thOns.dragover = $xetable.handleHeaderCellDragDragoverEvent
|
|
56
|
+
}
|
|
57
|
+
return h('th', {
|
|
58
|
+
class: ['vxe-header--column', colid, {
|
|
59
|
+
[`col--${headAlign}`]: headAlign,
|
|
60
|
+
[`col--${type}`]: type,
|
|
61
|
+
'col--last': $columnIndex === cols.length - 1,
|
|
62
|
+
'col--fixed': column.fixed,
|
|
63
|
+
'col--group': isColGroup,
|
|
64
|
+
'col--ellipsis': hasEllipsis,
|
|
65
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
66
|
+
'is--sortable': column.sortable,
|
|
67
|
+
'col--filter': !!column.filters,
|
|
68
|
+
'is--filter-active': hasFilter,
|
|
69
|
+
'col--current': currentColumn === column
|
|
70
|
+
}, getClass(headerClassName, params), getClass(headerCellClassName, params)],
|
|
71
|
+
attrs: {
|
|
72
|
+
colid,
|
|
73
|
+
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
74
|
+
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
75
|
+
},
|
|
76
|
+
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
77
|
+
on: thOns,
|
|
78
|
+
key: columnKey || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
|
|
79
|
+
}, [
|
|
80
|
+
h('div', {
|
|
81
|
+
class: ['vxe-cell', {
|
|
82
|
+
'c--title': showTitle,
|
|
83
|
+
'c--tooltip': showTooltip,
|
|
84
|
+
'c--ellipsis': showEllipsis
|
|
85
|
+
}]
|
|
86
|
+
}, column.renderHeader(h, params)),
|
|
87
|
+
/**
|
|
88
|
+
* 列宽拖动
|
|
89
|
+
*/
|
|
90
|
+
!fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
91
|
+
? h('div', {
|
|
92
|
+
class: ['vxe-resizable', {
|
|
93
|
+
'is--line': !border || border === 'none'
|
|
94
|
+
}],
|
|
95
|
+
on: {
|
|
96
|
+
mousedown: (evnt: any) => _vm.resizeMousedown(evnt, params)
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
: null
|
|
100
|
+
])
|
|
101
|
+
}).concat(scrollbarWidth
|
|
102
|
+
? [
|
|
103
|
+
h('th', {
|
|
104
|
+
key: `gr${$rowIndex}`,
|
|
105
|
+
class: 'vxe-header--gutter col--gutter'
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
: [])
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function renderHeads (h: CreateElement, _vm: any, headerGroups: any[]) {
|
|
112
|
+
const { $parent: $xetable } = _vm
|
|
113
|
+
const tableProps = $xetable
|
|
114
|
+
|
|
115
|
+
const { fixedType } = _vm
|
|
116
|
+
const { headerRowClassName, headerRowStyle } = tableProps
|
|
117
|
+
const { isDragColMove } = $xetable
|
|
118
|
+
const columnOpts = $xetable.columnOpts
|
|
119
|
+
|
|
120
|
+
return headerGroups.map((cols: any, $rowIndex: any) => {
|
|
121
|
+
const params = { $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }
|
|
122
|
+
|
|
123
|
+
if (columnOpts.drag) {
|
|
124
|
+
return h('transition-group', {
|
|
125
|
+
props: {
|
|
126
|
+
tag: 'tr',
|
|
127
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
128
|
+
class: [
|
|
129
|
+
'vxe-header--row',
|
|
130
|
+
headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
|
|
131
|
+
],
|
|
132
|
+
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
|
|
133
|
+
}
|
|
134
|
+
}, renderRows(h, _vm, cols, $rowIndex))
|
|
135
|
+
}
|
|
136
|
+
return h('tr', {
|
|
137
|
+
class: [
|
|
138
|
+
'vxe-header--row',
|
|
139
|
+
headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
|
|
140
|
+
],
|
|
141
|
+
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
|
|
142
|
+
}, renderRows(h, _vm, cols, $rowIndex))
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
12
146
|
export default {
|
|
13
147
|
name: 'VxeTableHeader',
|
|
14
148
|
props: {
|
|
@@ -56,7 +190,7 @@ export default {
|
|
|
56
190
|
},
|
|
57
191
|
render (h: CreateElement) {
|
|
58
192
|
const { _e, $parent: $xetable, fixedType, headerColumn, tableColumn, fixedColumn } = this
|
|
59
|
-
const {
|
|
193
|
+
const { tId, isGroup, visibleColumn, showHeaderOverflow: allColumnHeaderOverflow, scrollXLoad, scrollbarWidth } = $xetable
|
|
60
194
|
let headerGroups = headerColumn
|
|
61
195
|
let renderColumnList = tableColumn
|
|
62
196
|
if (isGroup) {
|
|
@@ -118,95 +252,7 @@ export default {
|
|
|
118
252
|
*/
|
|
119
253
|
h('thead', {
|
|
120
254
|
ref: 'thead'
|
|
121
|
-
},
|
|
122
|
-
return h('tr', {
|
|
123
|
-
class: ['vxe-header--row', headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName({ $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }) : headerRowClassName : ''],
|
|
124
|
-
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle({ $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }) : headerRowStyle) : null
|
|
125
|
-
}, cols.map((column: any, $columnIndex: any) => {
|
|
126
|
-
const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column
|
|
127
|
-
// const { enabled } = tooltipOpts
|
|
128
|
-
const colid = column.id
|
|
129
|
-
const renderOpts = editRender || cellRender
|
|
130
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
131
|
-
const isColGroup = column.children && column.children.length
|
|
132
|
-
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX
|
|
133
|
-
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
|
|
134
|
-
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
135
|
-
let showEllipsis = headOverflow === 'ellipsis'
|
|
136
|
-
const showTitle = headOverflow === 'title'
|
|
137
|
-
const showTooltip = headOverflow === true || headOverflow === 'tooltip'
|
|
138
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
139
|
-
const thOns: any = {}
|
|
140
|
-
const hasFilter = column.filters && column.filters.some((item: any) => item.checked)
|
|
141
|
-
const columnIndex = $xetable.getColumnIndex(column)
|
|
142
|
-
const _columnIndex = $xetable.getVTColumnIndex(column)
|
|
143
|
-
const params = { $table: $xetable, $grid: $xetable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter }
|
|
144
|
-
// 虚拟滚动不支持动态高度
|
|
145
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
146
|
-
showEllipsis = hasEllipsis = true
|
|
147
|
-
}
|
|
148
|
-
if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
|
|
149
|
-
thOns.click = (evnt: any) => $xetable.triggerHeaderCellClickEvent(evnt, params)
|
|
150
|
-
}
|
|
151
|
-
if (tableListeners['header-cell-dblclick']) {
|
|
152
|
-
thOns.dblclick = (evnt: any) => $xetable.triggerHeaderCellDblclickEvent(evnt, params)
|
|
153
|
-
}
|
|
154
|
-
// 按下事件处理
|
|
155
|
-
if (mouseConfig) {
|
|
156
|
-
thOns.mousedown = (evnt: any) => $xetable.triggerHeaderCellMousedownEvent(evnt, params)
|
|
157
|
-
}
|
|
158
|
-
return h('th', {
|
|
159
|
-
class: ['vxe-header--column', colid, {
|
|
160
|
-
[`col--${headAlign}`]: headAlign,
|
|
161
|
-
[`col--${type}`]: type,
|
|
162
|
-
'col--last': $columnIndex === cols.length - 1,
|
|
163
|
-
'col--fixed': column.fixed,
|
|
164
|
-
'col--group': isColGroup,
|
|
165
|
-
'col--ellipsis': hasEllipsis,
|
|
166
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
167
|
-
'is--sortable': column.sortable,
|
|
168
|
-
'col--filter': !!column.filters,
|
|
169
|
-
'is--filter-active': hasFilter,
|
|
170
|
-
'col--current': currentColumn === column
|
|
171
|
-
}, getClass(headerClassName, params), getClass(headerCellClassName, params)],
|
|
172
|
-
attrs: {
|
|
173
|
-
colid,
|
|
174
|
-
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
175
|
-
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
176
|
-
},
|
|
177
|
-
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
178
|
-
on: thOns,
|
|
179
|
-
key: columnKey || columnOpts.useKey || isColGroup ? colid : $columnIndex
|
|
180
|
-
}, [
|
|
181
|
-
h('div', {
|
|
182
|
-
class: ['vxe-cell', {
|
|
183
|
-
'c--title': showTitle,
|
|
184
|
-
'c--tooltip': showTooltip,
|
|
185
|
-
'c--ellipsis': showEllipsis
|
|
186
|
-
}]
|
|
187
|
-
}, column.renderHeader(h, params)),
|
|
188
|
-
/**
|
|
189
|
-
* 列宽拖动
|
|
190
|
-
*/
|
|
191
|
-
!fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
192
|
-
? h('div', {
|
|
193
|
-
class: ['vxe-resizable', {
|
|
194
|
-
'is--line': !border || border === 'none'
|
|
195
|
-
}],
|
|
196
|
-
on: {
|
|
197
|
-
mousedown: (evnt: any) => this.resizeMousedown(evnt, params)
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
: null
|
|
201
|
-
])
|
|
202
|
-
}).concat(scrollbarWidth
|
|
203
|
-
? [
|
|
204
|
-
h('th', {
|
|
205
|
-
class: 'vxe-header--gutter col--gutter'
|
|
206
|
-
})
|
|
207
|
-
]
|
|
208
|
-
: []))
|
|
209
|
-
}))
|
|
255
|
+
}, renderHeads(h, this, headerGroups))
|
|
210
256
|
]),
|
|
211
257
|
/**
|
|
212
258
|
* 其他
|