vxe-table 3.20.5 → 3.20.6
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/LICENSE +20 -20
- package/README.md +106 -106
- package/es/index.esm.js +1 -2
- package/es/style.css +1 -1
- package/es/table/src/methods.js +20 -0
- package/es/table/src/table.js +36 -0
- package/es/table/src/util.js +3 -4
- package/es/table/style.css +48 -18
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +48 -18
- package/lib/index.common.js +1 -2
- package/lib/index.umd.js +3251 -1876
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +2 -1
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +44 -0
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +4 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +48 -18
- package/lib/ui/index.js +1 -1
- 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/v-x-e-table/index.js +1 -2
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-colgroup/index.js +1 -2
- package/lib/vxe-colgroup/index.min.js +1 -1
- package/lib/vxe-column/index.js +1 -2
- package/lib/vxe-column/index.min.js +1 -1
- package/lib/vxe-grid/index.js +1 -2
- package/lib/vxe-grid/index.min.js +1 -1
- package/lib/vxe-table/index.js +1 -2
- package/lib/vxe-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +48 -18
- package/lib/vxe-toolbar/index.js +1 -2
- package/lib/vxe-toolbar/index.min.js +1 -1
- package/lib/vxe-ui/index.js +1 -2
- package/lib/vxe-ui/index.min.js +1 -1
- package/lib/vxe-v-x-e-table/index.js +1 -2
- package/lib/vxe-v-x-e-table/index.min.js +1 -1
- package/package.json +93 -93
- package/packages/colgroup/index.ts +22 -22
- package/packages/column/index.ts +22 -22
- package/packages/components.ts +42 -42
- package/packages/grid/index.ts +22 -22
- package/packages/grid/src/grid.ts +1935 -1935
- package/packages/index.ts +4 -4
- package/packages/locale/lang/ar-EG.ts +832 -832
- package/packages/locale/lang/de-DE.ts +832 -832
- package/packages/locale/lang/en-US.ts +832 -832
- package/packages/locale/lang/es-ES.ts +832 -832
- package/packages/locale/lang/fr-FR.ts +832 -832
- package/packages/locale/lang/hu-HU.ts +832 -832
- package/packages/locale/lang/hy-AM.ts +832 -832
- package/packages/locale/lang/id-ID.ts +832 -832
- package/packages/locale/lang/it-IT.ts +832 -832
- package/packages/locale/lang/ja-JP.ts +832 -832
- package/packages/locale/lang/ko-KR.ts +832 -832
- package/packages/locale/lang/ms-MY.ts +832 -832
- package/packages/locale/lang/nb-NO.ts +832 -832
- package/packages/locale/lang/pt-BR.ts +832 -832
- package/packages/locale/lang/ru-RU.ts +832 -832
- package/packages/locale/lang/th-TH.ts +832 -832
- package/packages/locale/lang/ug-CN.ts +832 -832
- package/packages/locale/lang/uk-UA.ts +832 -832
- package/packages/locale/lang/uz-UZ.ts +832 -832
- package/packages/locale/lang/vi-VN.ts +832 -832
- package/packages/locale/lang/zh-CHT.ts +832 -832
- package/packages/locale/lang/zh-CN.ts +832 -832
- package/packages/locale/lang/zh-HK.ts +3 -3
- package/packages/locale/lang/zh-MO.ts +3 -3
- package/packages/locale/lang/zh-TC.ts +3 -3
- package/packages/locale/lang/zh-TW.ts +3 -3
- package/packages/table/index.ts +49 -49
- package/packages/table/module/custom/mixin.ts +369 -369
- package/packages/table/module/custom/panel.ts +1461 -1461
- package/packages/table/module/edit/mixin.ts +1123 -1123
- package/packages/table/module/export/export-panel.ts +658 -658
- package/packages/table/module/export/import-panel.ts +319 -319
- package/packages/table/module/export/mixin.ts +1693 -1693
- package/packages/table/module/export/util.ts +24 -24
- package/packages/table/module/filter/mixin.ts +507 -507
- package/packages/table/module/filter/panel.ts +329 -329
- package/packages/table/module/keyboard/mixin.ts +513 -513
- package/packages/table/module/menu/mixin.ts +329 -329
- package/packages/table/module/menu/panel.ts +212 -212
- package/packages/table/module/validator/mixin.ts +626 -626
- package/packages/table/render/index.ts +1456 -1456
- package/packages/table/src/body.ts +969 -969
- package/packages/table/src/cell.ts +1285 -1285
- package/packages/table/src/column.ts +205 -205
- package/packages/table/src/columnInfo.ts +228 -228
- package/packages/table/src/footer.ts +388 -388
- package/packages/table/src/group.ts +51 -51
- package/packages/table/src/header.ts +602 -602
- package/packages/table/src/methods.ts +12939 -12920
- package/packages/table/src/props.ts +311 -311
- package/packages/table/src/store.ts +15 -15
- package/packages/table/src/table.ts +2502 -2460
- package/packages/table/src/util.ts +1012 -1012
- package/packages/toolbar/index.ts +18 -18
- package/packages/toolbar/src/toolbar.ts +856 -856
- package/packages/ui/index.ts +530 -530
- package/packages/ui/src/anime.ts +52 -52
- package/packages/ui/src/comp.ts +3 -3
- package/packages/ui/src/dom.ts +236 -236
- package/packages/ui/src/log.ts +8 -8
- package/packages/ui/src/utils.ts +56 -56
- package/packages/ui/src/vn.ts +65 -65
- package/packages/v-x-e-table/index.ts +4 -4
- package/styles/all.scss +7 -7
- package/styles/base.scss +16 -16
- package/styles/components/grid.scss +89 -89
- package/styles/components/icon.scss +225 -225
- package/styles/components/old-icon.scss +715 -715
- package/styles/components/table-module/all.scss +6 -6
- package/styles/components/table-module/custom.scss +527 -527
- package/styles/components/table-module/export.scss +130 -130
- package/styles/components/table-module/filter.scss +130 -130
- package/styles/components/table-module/menu.scss +81 -81
- package/styles/components/table.scss +2679 -2679
- package/styles/components/toolbar.scss +119 -119
- package/styles/default.scss +2 -2
- package/styles/helpers/baseMixin.scss +95 -95
- package/styles/index.scss +3 -3
- package/styles/modules.scss +5 -5
- package/styles/theme/base.scss +93 -93
- package/styles/theme/dark.scss +49 -49
- package/styles/theme/light.scss +44 -44
- package/styles/variable.scss +43 -43
- package/types/all.d.ts +53 -53
- package/types/index.d.ts +4 -4
- /package/es/{iconfont.1773710661615.ttf → iconfont.1773972972913.ttf} +0 -0
- /package/es/{iconfont.1773710661615.woff → iconfont.1773972972913.woff} +0 -0
- /package/es/{iconfont.1773710661615.woff2 → iconfont.1773972972913.woff2} +0 -0
- /package/lib/{iconfont.1773710661615.ttf → iconfont.1773972972913.ttf} +0 -0
- /package/lib/{iconfont.1773710661615.woff → iconfont.1773972972913.woff} +0 -0
- /package/lib/{iconfont.1773710661615.woff2 → iconfont.1773972972913.woff2} +0 -0
|
@@ -1,388 +1,388 @@
|
|
|
1
|
-
import { PropType, CreateElement } from 'vue'
|
|
2
|
-
import XEUtils from 'xe-utils'
|
|
3
|
-
import { VxeUI } from '../../ui'
|
|
4
|
-
import { getClass } from '../../ui/src/utils'
|
|
5
|
-
import { updateCellTitle } from '../../ui/src/dom'
|
|
6
|
-
import { getCalcHeight } from './util'
|
|
7
|
-
|
|
8
|
-
import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, TableReactData, TableInternalData, VxeComponentStyleType } from '../../../types'
|
|
9
|
-
|
|
10
|
-
const sourceType = 'table'
|
|
11
|
-
const renderType = 'footer'
|
|
12
|
-
|
|
13
|
-
const { renderer, renderEmptyElement } = VxeUI
|
|
14
|
-
|
|
15
|
-
function renderRows (h: CreateElement, _vm: any, isOptimizeMode: boolean, tableColumn: VxeTableDefines.ColumnInfo[], footerTableData: any[], row: any, $rowIndex: number, _rowIndex: number) {
|
|
16
|
-
const props = _vm
|
|
17
|
-
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
18
|
-
const tableProps = $xeTable
|
|
19
|
-
const tableReactData = $xeTable as unknown as TableReactData
|
|
20
|
-
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
21
|
-
const $xeGrid = $xeTable.$xeGrid
|
|
22
|
-
const $xeGantt = $xeTable.$xeGantt
|
|
23
|
-
|
|
24
|
-
const { fixedType } = props
|
|
25
|
-
const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps
|
|
26
|
-
const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFootFlag } = tableReactData
|
|
27
|
-
const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData
|
|
28
|
-
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
29
|
-
const footerTooltipOpts = $xeTable.computeFooterTooltipOpts
|
|
30
|
-
const resizableOpts = $xeTable.resizableOpts
|
|
31
|
-
const { isAllColumnDrag } = resizableOpts
|
|
32
|
-
const columnOpts = $xeTable.computeColumnOpts
|
|
33
|
-
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
34
|
-
const cellOpts = $xeTable.computeCellOpts
|
|
35
|
-
const footerCellOpts = $xeTable.computeFooterCellOpts
|
|
36
|
-
const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight
|
|
37
|
-
|
|
38
|
-
return tableColumn.map((column, $columnIndex) => {
|
|
39
|
-
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
40
|
-
const colid = column.id
|
|
41
|
-
const colRest = fullColumnIdData[colid] || {}
|
|
42
|
-
const renderOpts = editRender || cellRender
|
|
43
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
44
|
-
const showAllTip = footerTooltipOpts.showAll
|
|
45
|
-
const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed)
|
|
46
|
-
const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding
|
|
47
|
-
const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
48
|
-
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
49
|
-
const showEllipsis = footOverflow === 'ellipsis'
|
|
50
|
-
const showTitle = footOverflow === 'title'
|
|
51
|
-
const showTooltip = footOverflow === true || footOverflow === 'tooltip'
|
|
52
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
53
|
-
const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
54
|
-
const attrs: any = { colid }
|
|
55
|
-
const tfOns: any = {}
|
|
56
|
-
const columnIndex = colRest.index
|
|
57
|
-
const _columnIndex = colRest._index
|
|
58
|
-
const itemIndex = _columnIndex
|
|
59
|
-
const cellParams: VxeTableDefines.CellRenderFooterParams & {
|
|
60
|
-
$table: VxeTableConstructor<any> & VxeTablePrivateMethods
|
|
61
|
-
} = {
|
|
62
|
-
source: sourceType,
|
|
63
|
-
$table: $xeTable,
|
|
64
|
-
$grid: $xeGrid,
|
|
65
|
-
$gantt: $xeGantt,
|
|
66
|
-
row,
|
|
67
|
-
rowIndex: _rowIndex,
|
|
68
|
-
_rowIndex,
|
|
69
|
-
$rowIndex,
|
|
70
|
-
column,
|
|
71
|
-
columnIndex,
|
|
72
|
-
$columnIndex,
|
|
73
|
-
_columnIndex,
|
|
74
|
-
itemIndex,
|
|
75
|
-
items: row,
|
|
76
|
-
fixed: fixedType,
|
|
77
|
-
type: renderType,
|
|
78
|
-
data: footerTableData
|
|
79
|
-
}
|
|
80
|
-
if (showTitle || showTooltip || showAllTip) {
|
|
81
|
-
tfOns.mouseenter = (evnt: MouseEvent) => {
|
|
82
|
-
if (showTitle) {
|
|
83
|
-
updateCellTitle(evnt.currentTarget, column)
|
|
84
|
-
} else if (showTooltip || showAllTip) {
|
|
85
|
-
$xeTable.triggerFooterTooltipEvent(evnt, cellParams)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (showTooltip || showAllTip) {
|
|
90
|
-
tfOns.mouseleave = (evnt: MouseEvent) => {
|
|
91
|
-
if (showTooltip || showAllTip) {
|
|
92
|
-
$xeTable.handleTargetLeaveEvent(evnt)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
tfOns.click = (evnt: MouseEvent) => {
|
|
97
|
-
$xeTable.triggerFooterCellClickEvent(evnt, cellParams)
|
|
98
|
-
}
|
|
99
|
-
tfOns.dblclick = (evnt: MouseEvent) => {
|
|
100
|
-
$xeTable.triggerFooterCellDblclickEvent(evnt, cellParams)
|
|
101
|
-
}
|
|
102
|
-
let isMergeCell = false
|
|
103
|
-
// 合并行或列
|
|
104
|
-
if (mergeFootFlag && mergeFooterList.length) {
|
|
105
|
-
const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`]
|
|
106
|
-
if (spanRest) {
|
|
107
|
-
const { rowspan, colspan } = spanRest
|
|
108
|
-
if (!rowspan || !colspan) {
|
|
109
|
-
return null
|
|
110
|
-
}
|
|
111
|
-
if (rowspan > 1) {
|
|
112
|
-
isMergeCell = true
|
|
113
|
-
attrs.rowspan = rowspan
|
|
114
|
-
}
|
|
115
|
-
if (colspan > 1) {
|
|
116
|
-
isMergeCell = true
|
|
117
|
-
attrs.colspan = colspan
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} else if (footerSpanMethod) {
|
|
121
|
-
// 自定义合并方法
|
|
122
|
-
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {}
|
|
123
|
-
if (!rowspan || !colspan) {
|
|
124
|
-
return null
|
|
125
|
-
}
|
|
126
|
-
if (rowspan > 1) {
|
|
127
|
-
attrs.rowspan = rowspan
|
|
128
|
-
}
|
|
129
|
-
if (colspan > 1) {
|
|
130
|
-
attrs.colspan = colspan
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
const isLastColumn = $columnIndex === tableColumn.length - 1
|
|
134
|
-
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
135
|
-
|
|
136
|
-
let isVNPreEmptyStatus = false
|
|
137
|
-
if (isOptimizeMode && overflowX && !isMergeCell) {
|
|
138
|
-
if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
139
|
-
isVNPreEmptyStatus = true
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const tcStyle: Record<string, string> = {}
|
|
144
|
-
if (hasEllipsis) {
|
|
145
|
-
tcStyle.height = `${currCellHeight}px`
|
|
146
|
-
} else {
|
|
147
|
-
tcStyle.minHeight = `${currCellHeight}px`
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return h('td', {
|
|
151
|
-
class: ['vxe-table--column vxe-footer--column', column.id, {
|
|
152
|
-
[`col--${footAlign}`]: footAlign,
|
|
153
|
-
[`col--${type}`]: type,
|
|
154
|
-
'col--last': isLastColumn,
|
|
155
|
-
'fixed--width': !isAutoCellWidth,
|
|
156
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
157
|
-
'is--padding': isPadding,
|
|
158
|
-
'col--ellipsis': hasEllipsis,
|
|
159
|
-
'col--current': currentColumn === column
|
|
160
|
-
}, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
|
|
161
|
-
attrs,
|
|
162
|
-
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) as VxeComponentStyleType : undefined,
|
|
163
|
-
on: tfOns,
|
|
164
|
-
key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
165
|
-
}, [
|
|
166
|
-
h('div', {
|
|
167
|
-
class: ['vxe-cell', {
|
|
168
|
-
'c--title': showTitle,
|
|
169
|
-
'c--tooltip': showTooltip,
|
|
170
|
-
'c--ellipsis': showEllipsis
|
|
171
|
-
}],
|
|
172
|
-
style: tcStyle
|
|
173
|
-
}, isVNPreEmptyStatus
|
|
174
|
-
? []
|
|
175
|
-
: [
|
|
176
|
-
h('div', {
|
|
177
|
-
attrs: {
|
|
178
|
-
colid
|
|
179
|
-
},
|
|
180
|
-
class: 'vxe-cell--wrapper vxe-footer-cell--wrapper'
|
|
181
|
-
}, column.renderFooter(h, cellParams))
|
|
182
|
-
]),
|
|
183
|
-
/**
|
|
184
|
-
* 列宽拖动
|
|
185
|
-
*/
|
|
186
|
-
!fixedHiddenColumn && showResizable && isAllColumnDrag
|
|
187
|
-
? h('div', {
|
|
188
|
-
class: ['vxe-cell--col-resizable', {
|
|
189
|
-
'is--line': !border || border === 'none'
|
|
190
|
-
}],
|
|
191
|
-
on: {
|
|
192
|
-
mousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
|
|
193
|
-
dblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
: renderEmptyElement($xeTable)
|
|
197
|
-
])
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function renderHeads (h: CreateElement, _vm: any, isOptimizeMode: boolean, renderColumnList: VxeTableDefines.ColumnInfo[]) {
|
|
202
|
-
const props = _vm
|
|
203
|
-
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
204
|
-
const tableProps = $xeTable
|
|
205
|
-
|
|
206
|
-
const { fixedType, footerTableData } = props
|
|
207
|
-
|
|
208
|
-
const { footerRowClassName, footerRowStyle } = tableProps
|
|
209
|
-
|
|
210
|
-
return (footerTableData as any[][]).map((row, $rowIndex) => {
|
|
211
|
-
const _rowIndex = $rowIndex
|
|
212
|
-
const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
|
|
213
|
-
|
|
214
|
-
return h('tr', {
|
|
215
|
-
key: $rowIndex,
|
|
216
|
-
class: [
|
|
217
|
-
'vxe-footer--row',
|
|
218
|
-
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
219
|
-
],
|
|
220
|
-
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) as VxeComponentStyleType : undefined
|
|
221
|
-
}, renderRows(h, _vm, isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex))
|
|
222
|
-
})
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export default {
|
|
226
|
-
name: 'VxeTableFooter',
|
|
227
|
-
props: {
|
|
228
|
-
footerTableData: {
|
|
229
|
-
type: Array as PropType<any[][]>,
|
|
230
|
-
default: () => []
|
|
231
|
-
},
|
|
232
|
-
tableColumn: {
|
|
233
|
-
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
234
|
-
default: () => []
|
|
235
|
-
},
|
|
236
|
-
fixedColumn: {
|
|
237
|
-
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
238
|
-
default: () => []
|
|
239
|
-
},
|
|
240
|
-
fixedType: {
|
|
241
|
-
type: String as PropType<'right' | 'left' | ''>,
|
|
242
|
-
default: null
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
mounted () {
|
|
246
|
-
const _vm = this as any
|
|
247
|
-
const props = _vm
|
|
248
|
-
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
249
|
-
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
250
|
-
|
|
251
|
-
const { fixedType } = props
|
|
252
|
-
const { elemStore } = tableInternalData
|
|
253
|
-
const prefix = `${fixedType || 'main'}-footer-`
|
|
254
|
-
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem
|
|
255
|
-
elemStore[`${prefix}scroll`] = _vm.$refs.refFooterScroll
|
|
256
|
-
elemStore[`${prefix}table`] = _vm.$refs.refFooterTable
|
|
257
|
-
elemStore[`${prefix}colgroup`] = _vm.$refs.refFooterColgroup
|
|
258
|
-
elemStore[`${prefix}list`] = _vm.$refs.refFooterTFoot
|
|
259
|
-
elemStore[`${prefix}xSpace`] = _vm.$refs.refFooterXSpace
|
|
260
|
-
},
|
|
261
|
-
destroyed () {
|
|
262
|
-
const _vm = this as any
|
|
263
|
-
const props = _vm
|
|
264
|
-
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
265
|
-
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
266
|
-
|
|
267
|
-
const { fixedType } = props
|
|
268
|
-
const { elemStore } = tableInternalData
|
|
269
|
-
const prefix = `${fixedType || 'main'}-footer-`
|
|
270
|
-
elemStore[`${prefix}wrapper`] = null
|
|
271
|
-
elemStore[`${prefix}scroll`] = null
|
|
272
|
-
elemStore[`${prefix}table`] = null
|
|
273
|
-
elemStore[`${prefix}colgroup`] = null
|
|
274
|
-
elemStore[`${prefix}list`] = null
|
|
275
|
-
elemStore[`${prefix}xSpace`] = null
|
|
276
|
-
},
|
|
277
|
-
render (h: CreateElement) {
|
|
278
|
-
const _vm = this as any
|
|
279
|
-
const props = _vm
|
|
280
|
-
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
281
|
-
const tableReactData = $xeTable as unknown as TableReactData
|
|
282
|
-
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
283
|
-
|
|
284
|
-
const { xID } = $xeTable
|
|
285
|
-
|
|
286
|
-
const { fixedType, fixedColumn, tableColumn } = props
|
|
287
|
-
const { visibleColumn, fullColumnIdData } = tableInternalData
|
|
288
|
-
const { isGroup, isColLoading, overflowX, scrollXLoad, dragCol } = tableReactData
|
|
289
|
-
const isFooterRenderOptimize = $xeTable.computeIsFooterRenderOptimize
|
|
290
|
-
|
|
291
|
-
let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
|
|
292
|
-
const isOptimizeMode = isFooterRenderOptimize
|
|
293
|
-
|
|
294
|
-
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
295
|
-
renderColumnList = visibleColumn
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (fixedType) {
|
|
299
|
-
if (isOptimizeMode) {
|
|
300
|
-
renderColumnList = fixedColumn || []
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (!fixedType && !isGroup) {
|
|
305
|
-
// 列拖拽
|
|
306
|
-
if (scrollXLoad && dragCol) {
|
|
307
|
-
if (renderColumnList.length > 2) {
|
|
308
|
-
const dCowRest = fullColumnIdData[dragCol.id]
|
|
309
|
-
if (dCowRest) {
|
|
310
|
-
const dcIndex = dCowRest._index
|
|
311
|
-
const firstCol = renderColumnList[0]
|
|
312
|
-
const lastCol = renderColumnList[renderColumnList.length - 1]
|
|
313
|
-
const firstColRest = fullColumnIdData[firstCol.id]
|
|
314
|
-
const lastColRest = fullColumnIdData[lastCol.id]
|
|
315
|
-
if (firstColRest && lastColRest) {
|
|
316
|
-
const fcIndex = firstColRest._index
|
|
317
|
-
const lcIndex = lastColRest._index
|
|
318
|
-
if (dcIndex < fcIndex) {
|
|
319
|
-
renderColumnList = [dragCol].concat(renderColumnList)
|
|
320
|
-
} else if (dcIndex > lcIndex) {
|
|
321
|
-
renderColumnList = renderColumnList.concat([dragCol])
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return h('div', {
|
|
330
|
-
ref: 'refElem',
|
|
331
|
-
class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
332
|
-
attrs: {
|
|
333
|
-
xid: xID
|
|
334
|
-
}
|
|
335
|
-
}, [
|
|
336
|
-
h('div', {
|
|
337
|
-
ref: 'refFooterScroll',
|
|
338
|
-
class: 'vxe-table--footer-inner-wrapper',
|
|
339
|
-
on: {
|
|
340
|
-
scroll (evnt: Event) {
|
|
341
|
-
$xeTable.triggerFooterScrollEvent(evnt, fixedType)
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}, [
|
|
345
|
-
fixedType
|
|
346
|
-
? renderEmptyElement($xeTable)
|
|
347
|
-
: h('div', {
|
|
348
|
-
ref: 'refFooterXSpace',
|
|
349
|
-
class: 'vxe-body--x-space'
|
|
350
|
-
}),
|
|
351
|
-
h('table', {
|
|
352
|
-
ref: 'refFooterTable',
|
|
353
|
-
class: 'vxe-table--footer',
|
|
354
|
-
attrs: {
|
|
355
|
-
xid: xID,
|
|
356
|
-
cellspacing: 0,
|
|
357
|
-
cellpadding: 0,
|
|
358
|
-
border: 0,
|
|
359
|
-
xvm: isOptimizeMode ? '1' : null
|
|
360
|
-
}
|
|
361
|
-
}, [
|
|
362
|
-
/**
|
|
363
|
-
* 列宽
|
|
364
|
-
*/
|
|
365
|
-
h('colgroup', {
|
|
366
|
-
ref: 'refFooterColgroup'
|
|
367
|
-
}, renderColumnList.map((column, $columnIndex) => {
|
|
368
|
-
return h('col', {
|
|
369
|
-
attrs: {
|
|
370
|
-
name: column.id
|
|
371
|
-
},
|
|
372
|
-
key: $columnIndex,
|
|
373
|
-
style: {
|
|
374
|
-
width: `${column.renderWidth}px`
|
|
375
|
-
}
|
|
376
|
-
})
|
|
377
|
-
})),
|
|
378
|
-
/**
|
|
379
|
-
* 底部
|
|
380
|
-
*/
|
|
381
|
-
h('tfoot', {
|
|
382
|
-
ref: 'refFooterTFoot'
|
|
383
|
-
}, renderHeads(h, _vm, isOptimizeMode, renderColumnList))
|
|
384
|
-
])
|
|
385
|
-
])
|
|
386
|
-
])
|
|
387
|
-
}
|
|
388
|
-
}
|
|
1
|
+
import { PropType, CreateElement } from 'vue'
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
3
|
+
import { VxeUI } from '../../ui'
|
|
4
|
+
import { getClass } from '../../ui/src/utils'
|
|
5
|
+
import { updateCellTitle } from '../../ui/src/dom'
|
|
6
|
+
import { getCalcHeight } from './util'
|
|
7
|
+
|
|
8
|
+
import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, TableReactData, TableInternalData, VxeComponentStyleType } from '../../../types'
|
|
9
|
+
|
|
10
|
+
const sourceType = 'table'
|
|
11
|
+
const renderType = 'footer'
|
|
12
|
+
|
|
13
|
+
const { renderer, renderEmptyElement } = VxeUI
|
|
14
|
+
|
|
15
|
+
function renderRows (h: CreateElement, _vm: any, isOptimizeMode: boolean, tableColumn: VxeTableDefines.ColumnInfo[], footerTableData: any[], row: any, $rowIndex: number, _rowIndex: number) {
|
|
16
|
+
const props = _vm
|
|
17
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
18
|
+
const tableProps = $xeTable
|
|
19
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
20
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
21
|
+
const $xeGrid = $xeTable.$xeGrid
|
|
22
|
+
const $xeGantt = $xeTable.$xeGantt
|
|
23
|
+
|
|
24
|
+
const { fixedType } = props
|
|
25
|
+
const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps
|
|
26
|
+
const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFootFlag } = tableReactData
|
|
27
|
+
const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData
|
|
28
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
29
|
+
const footerTooltipOpts = $xeTable.computeFooterTooltipOpts
|
|
30
|
+
const resizableOpts = $xeTable.resizableOpts
|
|
31
|
+
const { isAllColumnDrag } = resizableOpts
|
|
32
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
33
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
34
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
35
|
+
const footerCellOpts = $xeTable.computeFooterCellOpts
|
|
36
|
+
const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight
|
|
37
|
+
|
|
38
|
+
return tableColumn.map((column, $columnIndex) => {
|
|
39
|
+
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
40
|
+
const colid = column.id
|
|
41
|
+
const colRest = fullColumnIdData[colid] || {}
|
|
42
|
+
const renderOpts = editRender || cellRender
|
|
43
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
44
|
+
const showAllTip = footerTooltipOpts.showAll
|
|
45
|
+
const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed)
|
|
46
|
+
const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding
|
|
47
|
+
const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
48
|
+
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
49
|
+
const showEllipsis = footOverflow === 'ellipsis'
|
|
50
|
+
const showTitle = footOverflow === 'title'
|
|
51
|
+
const showTooltip = footOverflow === true || footOverflow === 'tooltip'
|
|
52
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
53
|
+
const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
54
|
+
const attrs: any = { colid }
|
|
55
|
+
const tfOns: any = {}
|
|
56
|
+
const columnIndex = colRest.index
|
|
57
|
+
const _columnIndex = colRest._index
|
|
58
|
+
const itemIndex = _columnIndex
|
|
59
|
+
const cellParams: VxeTableDefines.CellRenderFooterParams & {
|
|
60
|
+
$table: VxeTableConstructor<any> & VxeTablePrivateMethods
|
|
61
|
+
} = {
|
|
62
|
+
source: sourceType,
|
|
63
|
+
$table: $xeTable,
|
|
64
|
+
$grid: $xeGrid,
|
|
65
|
+
$gantt: $xeGantt,
|
|
66
|
+
row,
|
|
67
|
+
rowIndex: _rowIndex,
|
|
68
|
+
_rowIndex,
|
|
69
|
+
$rowIndex,
|
|
70
|
+
column,
|
|
71
|
+
columnIndex,
|
|
72
|
+
$columnIndex,
|
|
73
|
+
_columnIndex,
|
|
74
|
+
itemIndex,
|
|
75
|
+
items: row,
|
|
76
|
+
fixed: fixedType,
|
|
77
|
+
type: renderType,
|
|
78
|
+
data: footerTableData
|
|
79
|
+
}
|
|
80
|
+
if (showTitle || showTooltip || showAllTip) {
|
|
81
|
+
tfOns.mouseenter = (evnt: MouseEvent) => {
|
|
82
|
+
if (showTitle) {
|
|
83
|
+
updateCellTitle(evnt.currentTarget, column)
|
|
84
|
+
} else if (showTooltip || showAllTip) {
|
|
85
|
+
$xeTable.triggerFooterTooltipEvent(evnt, cellParams)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (showTooltip || showAllTip) {
|
|
90
|
+
tfOns.mouseleave = (evnt: MouseEvent) => {
|
|
91
|
+
if (showTooltip || showAllTip) {
|
|
92
|
+
$xeTable.handleTargetLeaveEvent(evnt)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
tfOns.click = (evnt: MouseEvent) => {
|
|
97
|
+
$xeTable.triggerFooterCellClickEvent(evnt, cellParams)
|
|
98
|
+
}
|
|
99
|
+
tfOns.dblclick = (evnt: MouseEvent) => {
|
|
100
|
+
$xeTable.triggerFooterCellDblclickEvent(evnt, cellParams)
|
|
101
|
+
}
|
|
102
|
+
let isMergeCell = false
|
|
103
|
+
// 合并行或列
|
|
104
|
+
if (mergeFootFlag && mergeFooterList.length) {
|
|
105
|
+
const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`]
|
|
106
|
+
if (spanRest) {
|
|
107
|
+
const { rowspan, colspan } = spanRest
|
|
108
|
+
if (!rowspan || !colspan) {
|
|
109
|
+
return null
|
|
110
|
+
}
|
|
111
|
+
if (rowspan > 1) {
|
|
112
|
+
isMergeCell = true
|
|
113
|
+
attrs.rowspan = rowspan
|
|
114
|
+
}
|
|
115
|
+
if (colspan > 1) {
|
|
116
|
+
isMergeCell = true
|
|
117
|
+
attrs.colspan = colspan
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
} else if (footerSpanMethod) {
|
|
121
|
+
// 自定义合并方法
|
|
122
|
+
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {}
|
|
123
|
+
if (!rowspan || !colspan) {
|
|
124
|
+
return null
|
|
125
|
+
}
|
|
126
|
+
if (rowspan > 1) {
|
|
127
|
+
attrs.rowspan = rowspan
|
|
128
|
+
}
|
|
129
|
+
if (colspan > 1) {
|
|
130
|
+
attrs.colspan = colspan
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const isLastColumn = $columnIndex === tableColumn.length - 1
|
|
134
|
+
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
135
|
+
|
|
136
|
+
let isVNPreEmptyStatus = false
|
|
137
|
+
if (isOptimizeMode && overflowX && !isMergeCell) {
|
|
138
|
+
if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
139
|
+
isVNPreEmptyStatus = true
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const tcStyle: Record<string, string> = {}
|
|
144
|
+
if (hasEllipsis) {
|
|
145
|
+
tcStyle.height = `${currCellHeight}px`
|
|
146
|
+
} else {
|
|
147
|
+
tcStyle.minHeight = `${currCellHeight}px`
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return h('td', {
|
|
151
|
+
class: ['vxe-table--column vxe-footer--column', column.id, {
|
|
152
|
+
[`col--${footAlign}`]: footAlign,
|
|
153
|
+
[`col--${type}`]: type,
|
|
154
|
+
'col--last': isLastColumn,
|
|
155
|
+
'fixed--width': !isAutoCellWidth,
|
|
156
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
157
|
+
'is--padding': isPadding,
|
|
158
|
+
'col--ellipsis': hasEllipsis,
|
|
159
|
+
'col--current': currentColumn === column
|
|
160
|
+
}, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
|
|
161
|
+
attrs,
|
|
162
|
+
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) as VxeComponentStyleType : undefined,
|
|
163
|
+
on: tfOns,
|
|
164
|
+
key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
165
|
+
}, [
|
|
166
|
+
h('div', {
|
|
167
|
+
class: ['vxe-cell', {
|
|
168
|
+
'c--title': showTitle,
|
|
169
|
+
'c--tooltip': showTooltip,
|
|
170
|
+
'c--ellipsis': showEllipsis
|
|
171
|
+
}],
|
|
172
|
+
style: tcStyle
|
|
173
|
+
}, isVNPreEmptyStatus
|
|
174
|
+
? []
|
|
175
|
+
: [
|
|
176
|
+
h('div', {
|
|
177
|
+
attrs: {
|
|
178
|
+
colid
|
|
179
|
+
},
|
|
180
|
+
class: 'vxe-cell--wrapper vxe-footer-cell--wrapper'
|
|
181
|
+
}, column.renderFooter(h, cellParams))
|
|
182
|
+
]),
|
|
183
|
+
/**
|
|
184
|
+
* 列宽拖动
|
|
185
|
+
*/
|
|
186
|
+
!fixedHiddenColumn && showResizable && isAllColumnDrag
|
|
187
|
+
? h('div', {
|
|
188
|
+
class: ['vxe-cell--col-resizable', {
|
|
189
|
+
'is--line': !border || border === 'none'
|
|
190
|
+
}],
|
|
191
|
+
on: {
|
|
192
|
+
mousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
|
|
193
|
+
dblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
: renderEmptyElement($xeTable)
|
|
197
|
+
])
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function renderHeads (h: CreateElement, _vm: any, isOptimizeMode: boolean, renderColumnList: VxeTableDefines.ColumnInfo[]) {
|
|
202
|
+
const props = _vm
|
|
203
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
204
|
+
const tableProps = $xeTable
|
|
205
|
+
|
|
206
|
+
const { fixedType, footerTableData } = props
|
|
207
|
+
|
|
208
|
+
const { footerRowClassName, footerRowStyle } = tableProps
|
|
209
|
+
|
|
210
|
+
return (footerTableData as any[][]).map((row, $rowIndex) => {
|
|
211
|
+
const _rowIndex = $rowIndex
|
|
212
|
+
const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
|
|
213
|
+
|
|
214
|
+
return h('tr', {
|
|
215
|
+
key: $rowIndex,
|
|
216
|
+
class: [
|
|
217
|
+
'vxe-footer--row',
|
|
218
|
+
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
219
|
+
],
|
|
220
|
+
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) as VxeComponentStyleType : undefined
|
|
221
|
+
}, renderRows(h, _vm, isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex))
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export default {
|
|
226
|
+
name: 'VxeTableFooter',
|
|
227
|
+
props: {
|
|
228
|
+
footerTableData: {
|
|
229
|
+
type: Array as PropType<any[][]>,
|
|
230
|
+
default: () => []
|
|
231
|
+
},
|
|
232
|
+
tableColumn: {
|
|
233
|
+
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
234
|
+
default: () => []
|
|
235
|
+
},
|
|
236
|
+
fixedColumn: {
|
|
237
|
+
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
238
|
+
default: () => []
|
|
239
|
+
},
|
|
240
|
+
fixedType: {
|
|
241
|
+
type: String as PropType<'right' | 'left' | ''>,
|
|
242
|
+
default: null
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
mounted () {
|
|
246
|
+
const _vm = this as any
|
|
247
|
+
const props = _vm
|
|
248
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
249
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
250
|
+
|
|
251
|
+
const { fixedType } = props
|
|
252
|
+
const { elemStore } = tableInternalData
|
|
253
|
+
const prefix = `${fixedType || 'main'}-footer-`
|
|
254
|
+
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem
|
|
255
|
+
elemStore[`${prefix}scroll`] = _vm.$refs.refFooterScroll
|
|
256
|
+
elemStore[`${prefix}table`] = _vm.$refs.refFooterTable
|
|
257
|
+
elemStore[`${prefix}colgroup`] = _vm.$refs.refFooterColgroup
|
|
258
|
+
elemStore[`${prefix}list`] = _vm.$refs.refFooterTFoot
|
|
259
|
+
elemStore[`${prefix}xSpace`] = _vm.$refs.refFooterXSpace
|
|
260
|
+
},
|
|
261
|
+
destroyed () {
|
|
262
|
+
const _vm = this as any
|
|
263
|
+
const props = _vm
|
|
264
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
265
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
266
|
+
|
|
267
|
+
const { fixedType } = props
|
|
268
|
+
const { elemStore } = tableInternalData
|
|
269
|
+
const prefix = `${fixedType || 'main'}-footer-`
|
|
270
|
+
elemStore[`${prefix}wrapper`] = null
|
|
271
|
+
elemStore[`${prefix}scroll`] = null
|
|
272
|
+
elemStore[`${prefix}table`] = null
|
|
273
|
+
elemStore[`${prefix}colgroup`] = null
|
|
274
|
+
elemStore[`${prefix}list`] = null
|
|
275
|
+
elemStore[`${prefix}xSpace`] = null
|
|
276
|
+
},
|
|
277
|
+
render (h: CreateElement) {
|
|
278
|
+
const _vm = this as any
|
|
279
|
+
const props = _vm
|
|
280
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
281
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
282
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
283
|
+
|
|
284
|
+
const { xID } = $xeTable
|
|
285
|
+
|
|
286
|
+
const { fixedType, fixedColumn, tableColumn } = props
|
|
287
|
+
const { visibleColumn, fullColumnIdData } = tableInternalData
|
|
288
|
+
const { isGroup, isColLoading, overflowX, scrollXLoad, dragCol } = tableReactData
|
|
289
|
+
const isFooterRenderOptimize = $xeTable.computeIsFooterRenderOptimize
|
|
290
|
+
|
|
291
|
+
let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
|
|
292
|
+
const isOptimizeMode = isFooterRenderOptimize
|
|
293
|
+
|
|
294
|
+
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
295
|
+
renderColumnList = visibleColumn
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (fixedType) {
|
|
299
|
+
if (isOptimizeMode) {
|
|
300
|
+
renderColumnList = fixedColumn || []
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (!fixedType && !isGroup) {
|
|
305
|
+
// 列拖拽
|
|
306
|
+
if (scrollXLoad && dragCol) {
|
|
307
|
+
if (renderColumnList.length > 2) {
|
|
308
|
+
const dCowRest = fullColumnIdData[dragCol.id]
|
|
309
|
+
if (dCowRest) {
|
|
310
|
+
const dcIndex = dCowRest._index
|
|
311
|
+
const firstCol = renderColumnList[0]
|
|
312
|
+
const lastCol = renderColumnList[renderColumnList.length - 1]
|
|
313
|
+
const firstColRest = fullColumnIdData[firstCol.id]
|
|
314
|
+
const lastColRest = fullColumnIdData[lastCol.id]
|
|
315
|
+
if (firstColRest && lastColRest) {
|
|
316
|
+
const fcIndex = firstColRest._index
|
|
317
|
+
const lcIndex = lastColRest._index
|
|
318
|
+
if (dcIndex < fcIndex) {
|
|
319
|
+
renderColumnList = [dragCol].concat(renderColumnList)
|
|
320
|
+
} else if (dcIndex > lcIndex) {
|
|
321
|
+
renderColumnList = renderColumnList.concat([dragCol])
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return h('div', {
|
|
330
|
+
ref: 'refElem',
|
|
331
|
+
class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
332
|
+
attrs: {
|
|
333
|
+
xid: xID
|
|
334
|
+
}
|
|
335
|
+
}, [
|
|
336
|
+
h('div', {
|
|
337
|
+
ref: 'refFooterScroll',
|
|
338
|
+
class: 'vxe-table--footer-inner-wrapper',
|
|
339
|
+
on: {
|
|
340
|
+
scroll (evnt: Event) {
|
|
341
|
+
$xeTable.triggerFooterScrollEvent(evnt, fixedType)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}, [
|
|
345
|
+
fixedType
|
|
346
|
+
? renderEmptyElement($xeTable)
|
|
347
|
+
: h('div', {
|
|
348
|
+
ref: 'refFooterXSpace',
|
|
349
|
+
class: 'vxe-body--x-space'
|
|
350
|
+
}),
|
|
351
|
+
h('table', {
|
|
352
|
+
ref: 'refFooterTable',
|
|
353
|
+
class: 'vxe-table--footer',
|
|
354
|
+
attrs: {
|
|
355
|
+
xid: xID,
|
|
356
|
+
cellspacing: 0,
|
|
357
|
+
cellpadding: 0,
|
|
358
|
+
border: 0,
|
|
359
|
+
xvm: isOptimizeMode ? '1' : null
|
|
360
|
+
}
|
|
361
|
+
}, [
|
|
362
|
+
/**
|
|
363
|
+
* 列宽
|
|
364
|
+
*/
|
|
365
|
+
h('colgroup', {
|
|
366
|
+
ref: 'refFooterColgroup'
|
|
367
|
+
}, renderColumnList.map((column, $columnIndex) => {
|
|
368
|
+
return h('col', {
|
|
369
|
+
attrs: {
|
|
370
|
+
name: column.id
|
|
371
|
+
},
|
|
372
|
+
key: $columnIndex,
|
|
373
|
+
style: {
|
|
374
|
+
width: `${column.renderWidth}px`
|
|
375
|
+
}
|
|
376
|
+
})
|
|
377
|
+
})),
|
|
378
|
+
/**
|
|
379
|
+
* 底部
|
|
380
|
+
*/
|
|
381
|
+
h('tfoot', {
|
|
382
|
+
ref: 'refFooterTFoot'
|
|
383
|
+
}, renderHeads(h, _vm, isOptimizeMode, renderColumnList))
|
|
384
|
+
])
|
|
385
|
+
])
|
|
386
|
+
])
|
|
387
|
+
}
|
|
388
|
+
}
|