vxe-table 4.18.4 → 4.18.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.en.md +118 -118
- package/README.ja-JP.md +117 -117
- package/README.md +268 -268
- package/README.zh-TW.md +117 -117
- package/es/grid/style.css +4 -0
- package/es/grid/style.min.css +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/table.js +82 -22
- 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-grid/style.css +4 -0
- package/es/vxe-grid/style.min.css +1 -1
- package/es/vxe-table/style.css +48 -18
- package/lib/grid/style/style.css +4 -0
- package/lib/grid/style/style.min.css +1 -1
- package/lib/index.common.js +1 -2
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +2833 -2733
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/table.js +7 -6
- 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-grid/style/style.css +4 -0
- package/lib/vxe-grid/style/style.min.css +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 +91 -91
- package/packages/colgroup/index.ts +22 -22
- package/packages/column/index.ts +22 -22
- package/packages/components.ts +43 -43
- package/packages/grid/index.ts +18 -18
- package/packages/grid/src/emits.ts +19 -19
- package/packages/grid/src/grid.ts +1768 -1768
- package/packages/grid/src/props.ts +23 -23
- 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 +26 -26
- package/packages/table/module/custom/hook.ts +359 -359
- package/packages/table/module/custom/panel.ts +1331 -1331
- package/packages/table/module/edit/hook.ts +1032 -1032
- package/packages/table/module/export/export-panel.ts +567 -567
- package/packages/table/module/export/hook.ts +1654 -1654
- package/packages/table/module/export/import-panel.ts +266 -266
- package/packages/table/module/export/util.ts +24 -24
- package/packages/table/module/filter/hook.ts +468 -468
- package/packages/table/module/filter/panel.ts +301 -301
- package/packages/table/module/keyboard/hook.ts +495 -495
- package/packages/table/module/menu/hook.ts +325 -325
- package/packages/table/module/menu/panel.ts +201 -201
- package/packages/table/module/validator/hook.ts +631 -631
- package/packages/table/render/index.ts +1440 -1440
- package/packages/table/src/body.ts +932 -932
- package/packages/table/src/cell.ts +1290 -1290
- package/packages/table/src/column.ts +190 -190
- package/packages/table/src/columnInfo.ts +225 -225
- package/packages/table/src/emits.ts +123 -123
- package/packages/table/src/footer.ts +368 -368
- package/packages/table/src/group.ts +59 -59
- package/packages/table/src/header.ts +559 -559
- package/packages/table/src/props.ts +324 -324
- package/packages/table/src/store.ts +14 -14
- package/packages/table/src/table.ts +14001 -13939
- package/packages/table/src/use/cell-view.ts +44 -44
- package/packages/table/src/use/index.ts +1 -1
- package/packages/table/src/util.ts +1064 -1064
- package/packages/toolbar/index.ts +18 -18
- package/packages/toolbar/src/toolbar.ts +701 -701
- 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 +55 -55
- package/packages/v-x-e-table/index.d.ts +4 -4
- 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 -85
- 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 +4 -4
- 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 +37 -37
- package/types/index.d.ts +4 -4
- /package/es/{iconfont.1773644074946.ttf → iconfont.1773972993993.ttf} +0 -0
- /package/es/{iconfont.1773644074946.woff → iconfont.1773972993993.woff} +0 -0
- /package/es/{iconfont.1773644074946.woff2 → iconfont.1773972993993.woff2} +0 -0
- /package/lib/{iconfont.1773644074946.ttf → iconfont.1773972993993.ttf} +0 -0
- /package/lib/{iconfont.1773644074946.woff → iconfont.1773972993993.woff} +0 -0
- /package/lib/{iconfont.1773644074946.woff2 → iconfont.1773972993993.woff2} +0 -0
|
@@ -1,368 +1,368 @@
|
|
|
1
|
-
import { h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
|
|
2
|
-
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
-
import XEUtils from 'xe-utils'
|
|
4
|
-
import { VxeUI } from '../../ui'
|
|
5
|
-
import { updateCellTitle, getPropClass } from '../../ui/src/dom'
|
|
6
|
-
import { getCalcHeight } from './util'
|
|
7
|
-
|
|
8
|
-
import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines } from '../../../types'
|
|
9
|
-
|
|
10
|
-
const { renderer, renderEmptyElement } = VxeUI
|
|
11
|
-
|
|
12
|
-
const sourceType = 'table'
|
|
13
|
-
const renderType = 'footer'
|
|
14
|
-
|
|
15
|
-
export default defineVxeComponent({
|
|
16
|
-
name: 'VxeTableFooter',
|
|
17
|
-
props: {
|
|
18
|
-
footerTableData: {
|
|
19
|
-
type: Array as PropType<any[][]>,
|
|
20
|
-
default: () => []
|
|
21
|
-
},
|
|
22
|
-
tableColumn: {
|
|
23
|
-
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
24
|
-
default: () => []
|
|
25
|
-
},
|
|
26
|
-
fixedColumn: {
|
|
27
|
-
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
28
|
-
default: () => []
|
|
29
|
-
},
|
|
30
|
-
fixedType: {
|
|
31
|
-
type: String as PropType<'right' | 'left' | ''>,
|
|
32
|
-
default: null
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
setup (props) {
|
|
36
|
-
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
|
|
37
|
-
|
|
38
|
-
const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
39
|
-
const { computeFooterTooltipOpts, computeColumnOpts, computeCellOpts, computeFooterCellOpts, computeDefaultRowHeight, computeResizableOpts, computeVirtualXOpts, computeIsFooterRenderOptimize } = $xeTable.getComputeMaps()
|
|
40
|
-
|
|
41
|
-
const refElem = ref() as Ref<HTMLDivElement>
|
|
42
|
-
const refFooterScroll = ref() as Ref<HTMLDivElement>
|
|
43
|
-
const refFooterTable = ref() as Ref<HTMLTableElement>
|
|
44
|
-
const refFooterColgroup = ref() as Ref<HTMLTableColElement>
|
|
45
|
-
const refFooterTFoot = ref() as Ref<HTMLTableSectionElement>
|
|
46
|
-
const refFooterXSpace = ref() as Ref<HTMLDivElement>
|
|
47
|
-
|
|
48
|
-
const renderRows = (isOptimizeMode: boolean, tableColumn: VxeTableDefines.ColumnInfo[], footerTableData: any[], row: any, $rowIndex: number, _rowIndex: number) => {
|
|
49
|
-
const $xeGrid = $xeTable.xeGrid
|
|
50
|
-
const $xeGantt = $xeTable.xeGantt
|
|
51
|
-
|
|
52
|
-
const { fixedType } = props
|
|
53
|
-
const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps
|
|
54
|
-
const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFootFlag } = tableReactData
|
|
55
|
-
const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData
|
|
56
|
-
const virtualXOpts = computeVirtualXOpts.value
|
|
57
|
-
const footerTooltipOpts = computeFooterTooltipOpts.value
|
|
58
|
-
const resizableOpts = computeResizableOpts.value
|
|
59
|
-
const { isAllColumnDrag } = resizableOpts
|
|
60
|
-
const columnOpts = computeColumnOpts.value
|
|
61
|
-
const defaultRowHeight = computeDefaultRowHeight.value
|
|
62
|
-
const cellOpts = computeCellOpts.value
|
|
63
|
-
const footerCellOpts = computeFooterCellOpts.value
|
|
64
|
-
const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight
|
|
65
|
-
|
|
66
|
-
return tableColumn.map((column, $columnIndex) => {
|
|
67
|
-
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
68
|
-
const colid = column.id
|
|
69
|
-
const colRest = fullColumnIdData[colid] || {}
|
|
70
|
-
const renderOpts = editRender || cellRender
|
|
71
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
72
|
-
const showAllTip = footerTooltipOpts.showAll
|
|
73
|
-
const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed)
|
|
74
|
-
const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding
|
|
75
|
-
const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
76
|
-
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
77
|
-
const showEllipsis = footOverflow === 'ellipsis'
|
|
78
|
-
const showTitle = footOverflow === 'title'
|
|
79
|
-
const showTooltip = footOverflow === true || footOverflow === 'tooltip'
|
|
80
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
81
|
-
const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
82
|
-
const attrs: any = { colid }
|
|
83
|
-
const tfOns: any = {}
|
|
84
|
-
const columnIndex = colRest.index
|
|
85
|
-
const _columnIndex = colRest._index
|
|
86
|
-
const itemIndex = _columnIndex
|
|
87
|
-
const cellParams: VxeTableDefines.CellRenderFooterParams & {
|
|
88
|
-
$table: VxeTableConstructor<any> & VxeTablePrivateMethods
|
|
89
|
-
} = {
|
|
90
|
-
$table: $xeTable,
|
|
91
|
-
$grid: $xeGrid,
|
|
92
|
-
$gantt: $xeGantt,
|
|
93
|
-
row,
|
|
94
|
-
rowIndex: _rowIndex,
|
|
95
|
-
_rowIndex,
|
|
96
|
-
$rowIndex,
|
|
97
|
-
column,
|
|
98
|
-
columnIndex,
|
|
99
|
-
$columnIndex,
|
|
100
|
-
_columnIndex,
|
|
101
|
-
itemIndex,
|
|
102
|
-
items: row,
|
|
103
|
-
fixed: fixedType,
|
|
104
|
-
source: sourceType,
|
|
105
|
-
type: renderType,
|
|
106
|
-
data: footerTableData
|
|
107
|
-
}
|
|
108
|
-
if (showTitle || showTooltip || showAllTip) {
|
|
109
|
-
tfOns.onMouseenter = (evnt: MouseEvent) => {
|
|
110
|
-
if (showTitle) {
|
|
111
|
-
updateCellTitle(evnt.currentTarget, column)
|
|
112
|
-
} else if (showTooltip || showAllTip) {
|
|
113
|
-
$xeTable.triggerFooterTooltipEvent(evnt, cellParams)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (showTooltip || showAllTip) {
|
|
118
|
-
tfOns.onMouseleave = (evnt: MouseEvent) => {
|
|
119
|
-
if (showTooltip || showAllTip) {
|
|
120
|
-
$xeTable.handleTargetLeaveEvent(evnt)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
tfOns.onClick = (evnt: MouseEvent) => {
|
|
125
|
-
$xeTable.triggerFooterCellClickEvent(evnt, cellParams)
|
|
126
|
-
}
|
|
127
|
-
tfOns.onDblclick = (evnt: MouseEvent) => {
|
|
128
|
-
$xeTable.triggerFooterCellDblclickEvent(evnt, cellParams)
|
|
129
|
-
}
|
|
130
|
-
let isMergeCell = false
|
|
131
|
-
// 合并行或列
|
|
132
|
-
if (mergeFootFlag && mergeFooterList.length) {
|
|
133
|
-
const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`]
|
|
134
|
-
if (spanRest) {
|
|
135
|
-
const { rowspan, colspan } = spanRest
|
|
136
|
-
if (!rowspan || !colspan) {
|
|
137
|
-
return null
|
|
138
|
-
}
|
|
139
|
-
if (rowspan > 1) {
|
|
140
|
-
isMergeCell = true
|
|
141
|
-
attrs.rowspan = rowspan
|
|
142
|
-
}
|
|
143
|
-
if (colspan > 1) {
|
|
144
|
-
isMergeCell = true
|
|
145
|
-
attrs.colspan = colspan
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
} else if (footerSpanMethod) {
|
|
149
|
-
// 自定义合并方法
|
|
150
|
-
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {}
|
|
151
|
-
if (!rowspan || !colspan) {
|
|
152
|
-
return null
|
|
153
|
-
}
|
|
154
|
-
if (rowspan > 1) {
|
|
155
|
-
attrs.rowspan = rowspan
|
|
156
|
-
}
|
|
157
|
-
if (colspan > 1) {
|
|
158
|
-
attrs.colspan = colspan
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const isLastColumn = $columnIndex === tableColumn.length - 1
|
|
162
|
-
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
163
|
-
|
|
164
|
-
let isVNPreEmptyStatus = false
|
|
165
|
-
if (isOptimizeMode && overflowX && !isMergeCell) {
|
|
166
|
-
if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
167
|
-
isVNPreEmptyStatus = true
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const tcStyle: Record<string, string> = {}
|
|
172
|
-
if (hasEllipsis) {
|
|
173
|
-
tcStyle.height = `${currCellHeight}px`
|
|
174
|
-
} else {
|
|
175
|
-
tcStyle.minHeight = `${currCellHeight}px`
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return h('td', {
|
|
179
|
-
class: ['vxe-table--column vxe-footer--column', column.id, {
|
|
180
|
-
[`col--${footAlign}`]: footAlign,
|
|
181
|
-
[`col--${type}`]: type,
|
|
182
|
-
'col--last': isLastColumn,
|
|
183
|
-
'fixed--width': !isAutoCellWidth,
|
|
184
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
185
|
-
'is--padding': isPadding,
|
|
186
|
-
'col--ellipsis': hasEllipsis,
|
|
187
|
-
'col--current': currentColumn === column
|
|
188
|
-
}, getPropClass(footerClassName, cellParams), getPropClass(footerCellClassName, cellParams)],
|
|
189
|
-
...attrs,
|
|
190
|
-
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
191
|
-
...tfOns,
|
|
192
|
-
key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
193
|
-
}, [
|
|
194
|
-
h('div', {
|
|
195
|
-
class: ['vxe-cell', {
|
|
196
|
-
'c--title': showTitle,
|
|
197
|
-
'c--tooltip': showTooltip,
|
|
198
|
-
'c--ellipsis': showEllipsis
|
|
199
|
-
}],
|
|
200
|
-
style: tcStyle
|
|
201
|
-
}, isVNPreEmptyStatus
|
|
202
|
-
? []
|
|
203
|
-
: [
|
|
204
|
-
h('div', {
|
|
205
|
-
colid,
|
|
206
|
-
class: 'vxe-cell--wrapper vxe-footer-cell--wrapper'
|
|
207
|
-
}, column.renderFooter(cellParams))
|
|
208
|
-
]),
|
|
209
|
-
/**
|
|
210
|
-
* 列宽拖动
|
|
211
|
-
*/
|
|
212
|
-
!fixedHiddenColumn && showResizable && isAllColumnDrag
|
|
213
|
-
? h('div', {
|
|
214
|
-
class: ['vxe-cell--col-resizable', {
|
|
215
|
-
'is--line': !border || border === 'none'
|
|
216
|
-
}],
|
|
217
|
-
onMousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
|
|
218
|
-
onDblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
|
|
219
|
-
})
|
|
220
|
-
: renderEmptyElement($xeTable)
|
|
221
|
-
])
|
|
222
|
-
})
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const renderHeads = (isOptimizeMode: boolean, renderColumnList: VxeTableDefines.ColumnInfo[]) => {
|
|
226
|
-
const { fixedType, footerTableData } = props
|
|
227
|
-
const { footerRowClassName, footerRowStyle } = tableProps
|
|
228
|
-
|
|
229
|
-
return footerTableData.map((row, $rowIndex) => {
|
|
230
|
-
const _rowIndex = $rowIndex
|
|
231
|
-
const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
|
|
232
|
-
|
|
233
|
-
return h('tr', {
|
|
234
|
-
key: $rowIndex,
|
|
235
|
-
class: [
|
|
236
|
-
'vxe-footer--row',
|
|
237
|
-
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
238
|
-
],
|
|
239
|
-
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
240
|
-
}, renderRows(isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex))
|
|
241
|
-
})
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const renderVN = () => {
|
|
245
|
-
const { fixedType, fixedColumn, tableColumn } = props
|
|
246
|
-
const { visibleColumn, fullColumnIdData } = tableInternalData
|
|
247
|
-
const { isGroup, isColLoading, overflowX, scrollXLoad, dragCol } = tableReactData
|
|
248
|
-
const isFooterRenderOptimize = computeIsFooterRenderOptimize.value
|
|
249
|
-
|
|
250
|
-
let renderColumnList = tableColumn
|
|
251
|
-
const isOptimizeMode = isFooterRenderOptimize
|
|
252
|
-
|
|
253
|
-
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
254
|
-
renderColumnList = visibleColumn
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (fixedType) {
|
|
258
|
-
if (isOptimizeMode) {
|
|
259
|
-
renderColumnList = fixedColumn || []
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (!fixedType && !isGroup) {
|
|
264
|
-
// 列拖拽
|
|
265
|
-
if (scrollXLoad && dragCol) {
|
|
266
|
-
if (renderColumnList.length > 2) {
|
|
267
|
-
const dCowRest = fullColumnIdData[dragCol.id]
|
|
268
|
-
if (dCowRest) {
|
|
269
|
-
const dcIndex = dCowRest._index
|
|
270
|
-
const firstCol = renderColumnList[0]
|
|
271
|
-
const lastCol = renderColumnList[renderColumnList.length - 1]
|
|
272
|
-
const firstColRest = fullColumnIdData[firstCol.id]
|
|
273
|
-
const lastColRest = fullColumnIdData[lastCol.id]
|
|
274
|
-
if (firstColRest && lastColRest) {
|
|
275
|
-
const fcIndex = firstColRest._index
|
|
276
|
-
const lcIndex = lastColRest._index
|
|
277
|
-
if (dcIndex < fcIndex) {
|
|
278
|
-
renderColumnList = [dragCol].concat(renderColumnList)
|
|
279
|
-
} else if (dcIndex > lcIndex) {
|
|
280
|
-
renderColumnList = renderColumnList.concat([dragCol])
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return h('div', {
|
|
289
|
-
ref: refElem,
|
|
290
|
-
class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
291
|
-
xid: xID
|
|
292
|
-
}, [
|
|
293
|
-
h('div', {
|
|
294
|
-
ref: refFooterScroll,
|
|
295
|
-
class: 'vxe-table--footer-inner-wrapper',
|
|
296
|
-
onScroll (evnt) {
|
|
297
|
-
$xeTable.triggerFooterScrollEvent(evnt, fixedType)
|
|
298
|
-
}
|
|
299
|
-
}, [
|
|
300
|
-
fixedType
|
|
301
|
-
? renderEmptyElement($xeTable)
|
|
302
|
-
: h('div', {
|
|
303
|
-
ref: refFooterXSpace,
|
|
304
|
-
class: 'vxe-body--x-space'
|
|
305
|
-
}),
|
|
306
|
-
h('table', {
|
|
307
|
-
ref: refFooterTable,
|
|
308
|
-
class: 'vxe-table--footer',
|
|
309
|
-
xid: xID,
|
|
310
|
-
cellspacing: 0,
|
|
311
|
-
cellpadding: 0,
|
|
312
|
-
border: 0,
|
|
313
|
-
xvm: isOptimizeMode ? '1' : null
|
|
314
|
-
}, [
|
|
315
|
-
/**
|
|
316
|
-
* 列宽
|
|
317
|
-
*/
|
|
318
|
-
h('colgroup', {
|
|
319
|
-
ref: refFooterColgroup
|
|
320
|
-
}, renderColumnList.map((column, $columnIndex) => {
|
|
321
|
-
return h('col', {
|
|
322
|
-
name: column.id,
|
|
323
|
-
key: $columnIndex,
|
|
324
|
-
style: {
|
|
325
|
-
width: `${column.renderWidth}px`
|
|
326
|
-
}
|
|
327
|
-
})
|
|
328
|
-
})),
|
|
329
|
-
/**
|
|
330
|
-
* 底部
|
|
331
|
-
*/
|
|
332
|
-
h('tfoot', {
|
|
333
|
-
ref: refFooterTFoot
|
|
334
|
-
}, renderHeads(isOptimizeMode, renderColumnList))
|
|
335
|
-
])
|
|
336
|
-
])
|
|
337
|
-
])
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
onMounted(() => {
|
|
341
|
-
nextTick(() => {
|
|
342
|
-
const { fixedType } = props
|
|
343
|
-
const { elemStore } = tableInternalData
|
|
344
|
-
const prefix = `${fixedType || 'main'}-footer-`
|
|
345
|
-
elemStore[`${prefix}wrapper`] = refElem
|
|
346
|
-
elemStore[`${prefix}scroll`] = refFooterScroll
|
|
347
|
-
elemStore[`${prefix}table`] = refFooterTable
|
|
348
|
-
elemStore[`${prefix}colgroup`] = refFooterColgroup
|
|
349
|
-
elemStore[`${prefix}list`] = refFooterTFoot
|
|
350
|
-
elemStore[`${prefix}xSpace`] = refFooterXSpace
|
|
351
|
-
})
|
|
352
|
-
})
|
|
353
|
-
|
|
354
|
-
onUnmounted(() => {
|
|
355
|
-
const { fixedType } = props
|
|
356
|
-
const { elemStore } = tableInternalData
|
|
357
|
-
const prefix = `${fixedType || 'main'}-footer-`
|
|
358
|
-
elemStore[`${prefix}wrapper`] = null
|
|
359
|
-
elemStore[`${prefix}scroll`] = null
|
|
360
|
-
elemStore[`${prefix}table`] = null
|
|
361
|
-
elemStore[`${prefix}colgroup`] = null
|
|
362
|
-
elemStore[`${prefix}list`] = null
|
|
363
|
-
elemStore[`${prefix}xSpace`] = null
|
|
364
|
-
})
|
|
365
|
-
|
|
366
|
-
return renderVN
|
|
367
|
-
}
|
|
368
|
-
})
|
|
1
|
+
import { h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import XEUtils from 'xe-utils'
|
|
4
|
+
import { VxeUI } from '../../ui'
|
|
5
|
+
import { updateCellTitle, getPropClass } from '../../ui/src/dom'
|
|
6
|
+
import { getCalcHeight } from './util'
|
|
7
|
+
|
|
8
|
+
import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines } from '../../../types'
|
|
9
|
+
|
|
10
|
+
const { renderer, renderEmptyElement } = VxeUI
|
|
11
|
+
|
|
12
|
+
const sourceType = 'table'
|
|
13
|
+
const renderType = 'footer'
|
|
14
|
+
|
|
15
|
+
export default defineVxeComponent({
|
|
16
|
+
name: 'VxeTableFooter',
|
|
17
|
+
props: {
|
|
18
|
+
footerTableData: {
|
|
19
|
+
type: Array as PropType<any[][]>,
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
tableColumn: {
|
|
23
|
+
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
24
|
+
default: () => []
|
|
25
|
+
},
|
|
26
|
+
fixedColumn: {
|
|
27
|
+
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
28
|
+
default: () => []
|
|
29
|
+
},
|
|
30
|
+
fixedType: {
|
|
31
|
+
type: String as PropType<'right' | 'left' | ''>,
|
|
32
|
+
default: null
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup (props) {
|
|
36
|
+
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
|
|
37
|
+
|
|
38
|
+
const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
39
|
+
const { computeFooterTooltipOpts, computeColumnOpts, computeCellOpts, computeFooterCellOpts, computeDefaultRowHeight, computeResizableOpts, computeVirtualXOpts, computeIsFooterRenderOptimize } = $xeTable.getComputeMaps()
|
|
40
|
+
|
|
41
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
42
|
+
const refFooterScroll = ref() as Ref<HTMLDivElement>
|
|
43
|
+
const refFooterTable = ref() as Ref<HTMLTableElement>
|
|
44
|
+
const refFooterColgroup = ref() as Ref<HTMLTableColElement>
|
|
45
|
+
const refFooterTFoot = ref() as Ref<HTMLTableSectionElement>
|
|
46
|
+
const refFooterXSpace = ref() as Ref<HTMLDivElement>
|
|
47
|
+
|
|
48
|
+
const renderRows = (isOptimizeMode: boolean, tableColumn: VxeTableDefines.ColumnInfo[], footerTableData: any[], row: any, $rowIndex: number, _rowIndex: number) => {
|
|
49
|
+
const $xeGrid = $xeTable.xeGrid
|
|
50
|
+
const $xeGantt = $xeTable.xeGantt
|
|
51
|
+
|
|
52
|
+
const { fixedType } = props
|
|
53
|
+
const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps
|
|
54
|
+
const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFootFlag } = tableReactData
|
|
55
|
+
const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData
|
|
56
|
+
const virtualXOpts = computeVirtualXOpts.value
|
|
57
|
+
const footerTooltipOpts = computeFooterTooltipOpts.value
|
|
58
|
+
const resizableOpts = computeResizableOpts.value
|
|
59
|
+
const { isAllColumnDrag } = resizableOpts
|
|
60
|
+
const columnOpts = computeColumnOpts.value
|
|
61
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
62
|
+
const cellOpts = computeCellOpts.value
|
|
63
|
+
const footerCellOpts = computeFooterCellOpts.value
|
|
64
|
+
const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight
|
|
65
|
+
|
|
66
|
+
return tableColumn.map((column, $columnIndex) => {
|
|
67
|
+
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
68
|
+
const colid = column.id
|
|
69
|
+
const colRest = fullColumnIdData[colid] || {}
|
|
70
|
+
const renderOpts = editRender || cellRender
|
|
71
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
72
|
+
const showAllTip = footerTooltipOpts.showAll
|
|
73
|
+
const fixedHiddenColumn = overflowX && (fixedType ? column.fixed !== fixedType : !!column.fixed)
|
|
74
|
+
const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding
|
|
75
|
+
const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
76
|
+
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
|
|
77
|
+
const showEllipsis = footOverflow === 'ellipsis'
|
|
78
|
+
const showTitle = footOverflow === 'title'
|
|
79
|
+
const showTooltip = footOverflow === true || footOverflow === 'tooltip'
|
|
80
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
81
|
+
const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
82
|
+
const attrs: any = { colid }
|
|
83
|
+
const tfOns: any = {}
|
|
84
|
+
const columnIndex = colRest.index
|
|
85
|
+
const _columnIndex = colRest._index
|
|
86
|
+
const itemIndex = _columnIndex
|
|
87
|
+
const cellParams: VxeTableDefines.CellRenderFooterParams & {
|
|
88
|
+
$table: VxeTableConstructor<any> & VxeTablePrivateMethods
|
|
89
|
+
} = {
|
|
90
|
+
$table: $xeTable,
|
|
91
|
+
$grid: $xeGrid,
|
|
92
|
+
$gantt: $xeGantt,
|
|
93
|
+
row,
|
|
94
|
+
rowIndex: _rowIndex,
|
|
95
|
+
_rowIndex,
|
|
96
|
+
$rowIndex,
|
|
97
|
+
column,
|
|
98
|
+
columnIndex,
|
|
99
|
+
$columnIndex,
|
|
100
|
+
_columnIndex,
|
|
101
|
+
itemIndex,
|
|
102
|
+
items: row,
|
|
103
|
+
fixed: fixedType,
|
|
104
|
+
source: sourceType,
|
|
105
|
+
type: renderType,
|
|
106
|
+
data: footerTableData
|
|
107
|
+
}
|
|
108
|
+
if (showTitle || showTooltip || showAllTip) {
|
|
109
|
+
tfOns.onMouseenter = (evnt: MouseEvent) => {
|
|
110
|
+
if (showTitle) {
|
|
111
|
+
updateCellTitle(evnt.currentTarget, column)
|
|
112
|
+
} else if (showTooltip || showAllTip) {
|
|
113
|
+
$xeTable.triggerFooterTooltipEvent(evnt, cellParams)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (showTooltip || showAllTip) {
|
|
118
|
+
tfOns.onMouseleave = (evnt: MouseEvent) => {
|
|
119
|
+
if (showTooltip || showAllTip) {
|
|
120
|
+
$xeTable.handleTargetLeaveEvent(evnt)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
tfOns.onClick = (evnt: MouseEvent) => {
|
|
125
|
+
$xeTable.triggerFooterCellClickEvent(evnt, cellParams)
|
|
126
|
+
}
|
|
127
|
+
tfOns.onDblclick = (evnt: MouseEvent) => {
|
|
128
|
+
$xeTable.triggerFooterCellDblclickEvent(evnt, cellParams)
|
|
129
|
+
}
|
|
130
|
+
let isMergeCell = false
|
|
131
|
+
// 合并行或列
|
|
132
|
+
if (mergeFootFlag && mergeFooterList.length) {
|
|
133
|
+
const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`]
|
|
134
|
+
if (spanRest) {
|
|
135
|
+
const { rowspan, colspan } = spanRest
|
|
136
|
+
if (!rowspan || !colspan) {
|
|
137
|
+
return null
|
|
138
|
+
}
|
|
139
|
+
if (rowspan > 1) {
|
|
140
|
+
isMergeCell = true
|
|
141
|
+
attrs.rowspan = rowspan
|
|
142
|
+
}
|
|
143
|
+
if (colspan > 1) {
|
|
144
|
+
isMergeCell = true
|
|
145
|
+
attrs.colspan = colspan
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} else if (footerSpanMethod) {
|
|
149
|
+
// 自定义合并方法
|
|
150
|
+
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {}
|
|
151
|
+
if (!rowspan || !colspan) {
|
|
152
|
+
return null
|
|
153
|
+
}
|
|
154
|
+
if (rowspan > 1) {
|
|
155
|
+
attrs.rowspan = rowspan
|
|
156
|
+
}
|
|
157
|
+
if (colspan > 1) {
|
|
158
|
+
attrs.colspan = colspan
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const isLastColumn = $columnIndex === tableColumn.length - 1
|
|
162
|
+
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
163
|
+
|
|
164
|
+
let isVNPreEmptyStatus = false
|
|
165
|
+
if (isOptimizeMode && overflowX && !isMergeCell) {
|
|
166
|
+
if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
167
|
+
isVNPreEmptyStatus = true
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const tcStyle: Record<string, string> = {}
|
|
172
|
+
if (hasEllipsis) {
|
|
173
|
+
tcStyle.height = `${currCellHeight}px`
|
|
174
|
+
} else {
|
|
175
|
+
tcStyle.minHeight = `${currCellHeight}px`
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return h('td', {
|
|
179
|
+
class: ['vxe-table--column vxe-footer--column', column.id, {
|
|
180
|
+
[`col--${footAlign}`]: footAlign,
|
|
181
|
+
[`col--${type}`]: type,
|
|
182
|
+
'col--last': isLastColumn,
|
|
183
|
+
'fixed--width': !isAutoCellWidth,
|
|
184
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
185
|
+
'is--padding': isPadding,
|
|
186
|
+
'col--ellipsis': hasEllipsis,
|
|
187
|
+
'col--current': currentColumn === column
|
|
188
|
+
}, getPropClass(footerClassName, cellParams), getPropClass(footerCellClassName, cellParams)],
|
|
189
|
+
...attrs,
|
|
190
|
+
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
191
|
+
...tfOns,
|
|
192
|
+
key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
193
|
+
}, [
|
|
194
|
+
h('div', {
|
|
195
|
+
class: ['vxe-cell', {
|
|
196
|
+
'c--title': showTitle,
|
|
197
|
+
'c--tooltip': showTooltip,
|
|
198
|
+
'c--ellipsis': showEllipsis
|
|
199
|
+
}],
|
|
200
|
+
style: tcStyle
|
|
201
|
+
}, isVNPreEmptyStatus
|
|
202
|
+
? []
|
|
203
|
+
: [
|
|
204
|
+
h('div', {
|
|
205
|
+
colid,
|
|
206
|
+
class: 'vxe-cell--wrapper vxe-footer-cell--wrapper'
|
|
207
|
+
}, column.renderFooter(cellParams))
|
|
208
|
+
]),
|
|
209
|
+
/**
|
|
210
|
+
* 列宽拖动
|
|
211
|
+
*/
|
|
212
|
+
!fixedHiddenColumn && showResizable && isAllColumnDrag
|
|
213
|
+
? h('div', {
|
|
214
|
+
class: ['vxe-cell--col-resizable', {
|
|
215
|
+
'is--line': !border || border === 'none'
|
|
216
|
+
}],
|
|
217
|
+
onMousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
|
|
218
|
+
onDblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
|
|
219
|
+
})
|
|
220
|
+
: renderEmptyElement($xeTable)
|
|
221
|
+
])
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const renderHeads = (isOptimizeMode: boolean, renderColumnList: VxeTableDefines.ColumnInfo[]) => {
|
|
226
|
+
const { fixedType, footerTableData } = props
|
|
227
|
+
const { footerRowClassName, footerRowStyle } = tableProps
|
|
228
|
+
|
|
229
|
+
return footerTableData.map((row, $rowIndex) => {
|
|
230
|
+
const _rowIndex = $rowIndex
|
|
231
|
+
const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
|
|
232
|
+
|
|
233
|
+
return h('tr', {
|
|
234
|
+
key: $rowIndex,
|
|
235
|
+
class: [
|
|
236
|
+
'vxe-footer--row',
|
|
237
|
+
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
238
|
+
],
|
|
239
|
+
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
240
|
+
}, renderRows(isOptimizeMode, renderColumnList, footerTableData, row, $rowIndex, _rowIndex))
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const renderVN = () => {
|
|
245
|
+
const { fixedType, fixedColumn, tableColumn } = props
|
|
246
|
+
const { visibleColumn, fullColumnIdData } = tableInternalData
|
|
247
|
+
const { isGroup, isColLoading, overflowX, scrollXLoad, dragCol } = tableReactData
|
|
248
|
+
const isFooterRenderOptimize = computeIsFooterRenderOptimize.value
|
|
249
|
+
|
|
250
|
+
let renderColumnList = tableColumn
|
|
251
|
+
const isOptimizeMode = isFooterRenderOptimize
|
|
252
|
+
|
|
253
|
+
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
254
|
+
renderColumnList = visibleColumn
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (fixedType) {
|
|
258
|
+
if (isOptimizeMode) {
|
|
259
|
+
renderColumnList = fixedColumn || []
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (!fixedType && !isGroup) {
|
|
264
|
+
// 列拖拽
|
|
265
|
+
if (scrollXLoad && dragCol) {
|
|
266
|
+
if (renderColumnList.length > 2) {
|
|
267
|
+
const dCowRest = fullColumnIdData[dragCol.id]
|
|
268
|
+
if (dCowRest) {
|
|
269
|
+
const dcIndex = dCowRest._index
|
|
270
|
+
const firstCol = renderColumnList[0]
|
|
271
|
+
const lastCol = renderColumnList[renderColumnList.length - 1]
|
|
272
|
+
const firstColRest = fullColumnIdData[firstCol.id]
|
|
273
|
+
const lastColRest = fullColumnIdData[lastCol.id]
|
|
274
|
+
if (firstColRest && lastColRest) {
|
|
275
|
+
const fcIndex = firstColRest._index
|
|
276
|
+
const lcIndex = lastColRest._index
|
|
277
|
+
if (dcIndex < fcIndex) {
|
|
278
|
+
renderColumnList = [dragCol].concat(renderColumnList)
|
|
279
|
+
} else if (dcIndex > lcIndex) {
|
|
280
|
+
renderColumnList = renderColumnList.concat([dragCol])
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return h('div', {
|
|
289
|
+
ref: refElem,
|
|
290
|
+
class: ['vxe-table--footer-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
291
|
+
xid: xID
|
|
292
|
+
}, [
|
|
293
|
+
h('div', {
|
|
294
|
+
ref: refFooterScroll,
|
|
295
|
+
class: 'vxe-table--footer-inner-wrapper',
|
|
296
|
+
onScroll (evnt) {
|
|
297
|
+
$xeTable.triggerFooterScrollEvent(evnt, fixedType)
|
|
298
|
+
}
|
|
299
|
+
}, [
|
|
300
|
+
fixedType
|
|
301
|
+
? renderEmptyElement($xeTable)
|
|
302
|
+
: h('div', {
|
|
303
|
+
ref: refFooterXSpace,
|
|
304
|
+
class: 'vxe-body--x-space'
|
|
305
|
+
}),
|
|
306
|
+
h('table', {
|
|
307
|
+
ref: refFooterTable,
|
|
308
|
+
class: 'vxe-table--footer',
|
|
309
|
+
xid: xID,
|
|
310
|
+
cellspacing: 0,
|
|
311
|
+
cellpadding: 0,
|
|
312
|
+
border: 0,
|
|
313
|
+
xvm: isOptimizeMode ? '1' : null
|
|
314
|
+
}, [
|
|
315
|
+
/**
|
|
316
|
+
* 列宽
|
|
317
|
+
*/
|
|
318
|
+
h('colgroup', {
|
|
319
|
+
ref: refFooterColgroup
|
|
320
|
+
}, renderColumnList.map((column, $columnIndex) => {
|
|
321
|
+
return h('col', {
|
|
322
|
+
name: column.id,
|
|
323
|
+
key: $columnIndex,
|
|
324
|
+
style: {
|
|
325
|
+
width: `${column.renderWidth}px`
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
})),
|
|
329
|
+
/**
|
|
330
|
+
* 底部
|
|
331
|
+
*/
|
|
332
|
+
h('tfoot', {
|
|
333
|
+
ref: refFooterTFoot
|
|
334
|
+
}, renderHeads(isOptimizeMode, renderColumnList))
|
|
335
|
+
])
|
|
336
|
+
])
|
|
337
|
+
])
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
onMounted(() => {
|
|
341
|
+
nextTick(() => {
|
|
342
|
+
const { fixedType } = props
|
|
343
|
+
const { elemStore } = tableInternalData
|
|
344
|
+
const prefix = `${fixedType || 'main'}-footer-`
|
|
345
|
+
elemStore[`${prefix}wrapper`] = refElem
|
|
346
|
+
elemStore[`${prefix}scroll`] = refFooterScroll
|
|
347
|
+
elemStore[`${prefix}table`] = refFooterTable
|
|
348
|
+
elemStore[`${prefix}colgroup`] = refFooterColgroup
|
|
349
|
+
elemStore[`${prefix}list`] = refFooterTFoot
|
|
350
|
+
elemStore[`${prefix}xSpace`] = refFooterXSpace
|
|
351
|
+
})
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
onUnmounted(() => {
|
|
355
|
+
const { fixedType } = props
|
|
356
|
+
const { elemStore } = tableInternalData
|
|
357
|
+
const prefix = `${fixedType || 'main'}-footer-`
|
|
358
|
+
elemStore[`${prefix}wrapper`] = null
|
|
359
|
+
elemStore[`${prefix}scroll`] = null
|
|
360
|
+
elemStore[`${prefix}table`] = null
|
|
361
|
+
elemStore[`${prefix}colgroup`] = null
|
|
362
|
+
elemStore[`${prefix}list`] = null
|
|
363
|
+
elemStore[`${prefix}xSpace`] = null
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
return renderVN
|
|
367
|
+
}
|
|
368
|
+
})
|