vxe-table 3.18.1 → 3.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/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/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/footer.js +7 -5
- package/es/table/src/header.js +67 -28
- package/es/table/src/methods.js +233 -39
- package/es/table/src/props.js +23 -6
- package/es/table/src/table.js +43 -19
- package/es/table/src/util.js +70 -2
- package/es/table/style.css +11 -17
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +11 -17
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +482 -94
- 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/column.js +2 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +7 -5
- package/lib/table/src/header.js +82 -25
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +259 -42
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +11 -3
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +46 -16
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +74 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +11 -17
- package/lib/table/style/style.min.css +1 -1
- 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/vxe-table/style/style.css +11 -17
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/table/src/column.ts +4 -2
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/footer.ts +11 -9
- package/packages/table/src/header.ts +76 -34
- package/packages/table/src/methods.ts +245 -40
- package/packages/table/src/props.ts +29 -12
- package/packages/table/src/table.ts +53 -16
- package/packages/table/src/util.ts +76 -2
- package/styles/components/table.scss +33 -55
- /package/es/{iconfont.1756272539382.ttf → iconfont.1756452257212.ttf} +0 -0
- /package/es/{iconfont.1756272539382.woff → iconfont.1756452257212.woff} +0 -0
- /package/es/{iconfont.1756272539382.woff2 → iconfont.1756452257212.woff2} +0 -0
- /package/lib/{iconfont.1756272539382.ttf → iconfont.1756452257212.ttf} +0 -0
- /package/lib/{iconfont.1756272539382.woff → iconfont.1756452257212.woff} +0 -0
- /package/lib/{iconfont.1756272539382.woff2 → iconfont.1756452257212.woff2} +0 -0
|
@@ -34,7 +34,7 @@ function renderRows (h: CreateElement, _vm: any, isOptimizeMode: boolean, tableC
|
|
|
34
34
|
const footerCellOpts = $xeTable.computeFooterCellOpts
|
|
35
35
|
const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight
|
|
36
36
|
|
|
37
|
-
return tableColumn.map((column
|
|
37
|
+
return tableColumn.map((column, $columnIndex) => {
|
|
38
38
|
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
39
39
|
const colid = column.id
|
|
40
40
|
const colRest = fullColumnIdData[colid] || {}
|
|
@@ -240,8 +240,8 @@ export default {
|
|
|
240
240
|
default: null
|
|
241
241
|
}
|
|
242
242
|
},
|
|
243
|
-
mounted (
|
|
244
|
-
const _vm = this
|
|
243
|
+
mounted () {
|
|
244
|
+
const _vm = this as any
|
|
245
245
|
const props = _vm
|
|
246
246
|
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
247
247
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
@@ -257,8 +257,9 @@ export default {
|
|
|
257
257
|
elemStore[`${prefix}xSpace`] = _vm.$refs.refFooterXSpace
|
|
258
258
|
},
|
|
259
259
|
destroyed () {
|
|
260
|
-
const
|
|
261
|
-
const
|
|
260
|
+
const _vm = this as any
|
|
261
|
+
const props = _vm
|
|
262
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
262
263
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
263
264
|
|
|
264
265
|
const { fixedType } = props
|
|
@@ -272,8 +273,9 @@ export default {
|
|
|
272
273
|
elemStore[`${prefix}xSpace`] = null
|
|
273
274
|
},
|
|
274
275
|
render (h: CreateElement) {
|
|
275
|
-
const
|
|
276
|
-
const
|
|
276
|
+
const _vm = this as any
|
|
277
|
+
const props = _vm
|
|
278
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
277
279
|
const tableProps = $xeTable
|
|
278
280
|
const tableReactData = $xeTable as unknown as TableReactData
|
|
279
281
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
@@ -385,9 +387,9 @@ export default {
|
|
|
385
387
|
*/
|
|
386
388
|
h('tfoot', {
|
|
387
389
|
ref: 'refFooterTFoot'
|
|
388
|
-
}, renderHeads(h,
|
|
390
|
+
}, renderHeads(h, _vm, isOptimizeMode, renderColumnList))
|
|
389
391
|
])
|
|
390
392
|
])
|
|
391
393
|
])
|
|
392
394
|
}
|
|
393
|
-
}
|
|
395
|
+
}
|
|
@@ -2,7 +2,7 @@ import { PropType, CreateElement } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
4
|
import { getClass } from '../../ui/src/utils'
|
|
5
|
-
import { getCalcHeight, convertHeaderColumnToRows } from './util'
|
|
5
|
+
import { getCalcHeight, convertHeaderColumnToRows, convertHeaderToGridRows } from './util'
|
|
6
6
|
|
|
7
7
|
import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, VxeColumnPropTypes, TableReactData, TableInternalData, VxeComponentStyleType } from '../../../types'
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ const { renderer, renderEmptyElement } = VxeUI
|
|
|
10
10
|
|
|
11
11
|
const cellType = 'header'
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function renderRows (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode: boolean, headerGroups: VxeTableDefines.ColumnInfo[][], $rowIndex: number, cols: VxeTableDefines.ColumnInfo[]) {
|
|
14
14
|
const props = _vm
|
|
15
15
|
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
16
16
|
const $xeGrid = $xeTable.$xeGrid
|
|
@@ -20,9 +20,9 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
20
20
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
21
21
|
|
|
22
22
|
const { fixedType } = props
|
|
23
|
-
const { resizable: allResizable, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps
|
|
24
|
-
const { currentColumn, dragCol, scrollXLoad, scrollYLoad, overflowX, tableColumn } = tableReactData
|
|
25
|
-
const { fullColumnIdData, scrollXStore } = tableInternalData
|
|
23
|
+
const { resizable: allResizable, columnKey, showCustomHeader, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps
|
|
24
|
+
const { currentColumn, dragCol, scrollXLoad, scrollYLoad, overflowX, mergeHeadFlag, tableColumn } = tableReactData
|
|
25
|
+
const { fullColumnIdData, scrollXStore, mergeHeaderList, mergeHeaderCellMaps } = tableInternalData
|
|
26
26
|
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
27
27
|
const columnOpts = $xeTable.computeColumnOpts
|
|
28
28
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
@@ -31,7 +31,9 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
31
31
|
const headerCellOpts = $xeTable.computeHeaderCellOpts
|
|
32
32
|
const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight
|
|
33
33
|
const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts
|
|
34
|
-
|
|
34
|
+
const isLastRow = $rowIndex === headerGroups.length - 1
|
|
35
|
+
|
|
36
|
+
return cols.map((column, $columnIndex) => {
|
|
35
37
|
const { type, showHeaderOverflow, headerAlign, align, filters, headerClassName, editRender, cellRender } = column
|
|
36
38
|
// const { enabled } = tooltipOpts
|
|
37
39
|
const colid = column.id
|
|
@@ -54,7 +56,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
54
56
|
hasFilter = filters.some((item: VxeColumnPropTypes.FilterItem) => item.checked)
|
|
55
57
|
}
|
|
56
58
|
const columnIndex = colRest.index
|
|
57
|
-
const _columnIndex = colRest._index
|
|
59
|
+
const _columnIndex = showCustomHeader ? $columnIndex : colRest._index
|
|
58
60
|
const cellParams: VxeTableDefines.CellRenderHeaderParams & {
|
|
59
61
|
$table: VxeTableConstructor & VxeTablePrivateMethods
|
|
60
62
|
} = {
|
|
@@ -73,9 +75,30 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
73
75
|
hasFilter
|
|
74
76
|
}
|
|
75
77
|
const thAttrs: Record<string, string | number | null> = {
|
|
76
|
-
colid
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
colid
|
|
79
|
+
}
|
|
80
|
+
let isMergeCell = false
|
|
81
|
+
// 合并行或列
|
|
82
|
+
if (!showCustomHeader) {
|
|
83
|
+
thAttrs.colspan = column.colSpan > 1 ? column.colSpan : null
|
|
84
|
+
thAttrs.rowspan = column.rowSpan > 1 ? column.rowSpan : null
|
|
85
|
+
}
|
|
86
|
+
if (mergeHeadFlag && mergeHeaderList.length && (showCustomHeader || isLastRow)) {
|
|
87
|
+
const spanRest = mergeHeaderCellMaps[`${$rowIndex}:${showCustomHeader ? $columnIndex : _columnIndex}`]
|
|
88
|
+
if (spanRest) {
|
|
89
|
+
const { rowspan, colspan } = spanRest
|
|
90
|
+
if (!rowspan || !colspan) {
|
|
91
|
+
return null
|
|
92
|
+
}
|
|
93
|
+
if (rowspan > 1) {
|
|
94
|
+
isMergeCell = true
|
|
95
|
+
thAttrs.rowspan = rowspan
|
|
96
|
+
}
|
|
97
|
+
if (colspan > 1) {
|
|
98
|
+
isMergeCell = true
|
|
99
|
+
thAttrs.colspan = colspan
|
|
100
|
+
}
|
|
101
|
+
}
|
|
79
102
|
}
|
|
80
103
|
const thOns: any = {
|
|
81
104
|
click: (evnt: MouseEvent) => $xeTable.triggerHeaderCellClickEvent(evnt, cellParams),
|
|
@@ -104,7 +127,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
104
127
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
105
128
|
|
|
106
129
|
let isVNPreEmptyStatus = false
|
|
107
|
-
if (isOptimizeMode && overflowX && !isGroup) {
|
|
130
|
+
if (isOptimizeMode && overflowX && !isGroup && !isMergeCell) {
|
|
108
131
|
if (!dragCol || dragCol.id !== colid) {
|
|
109
132
|
if (scrollXLoad && tableColumn.length > 10 && !column.fixed && !virtualXOpts.immediate && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
110
133
|
isVNPreEmptyStatus = true
|
|
@@ -120,7 +143,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
120
143
|
}
|
|
121
144
|
|
|
122
145
|
return h('th', {
|
|
123
|
-
class: ['vxe-table--column vxe-header--column', colid, {
|
|
146
|
+
class: ['vxe-table--column vxe-header--column', colid, fixedHiddenColumn ? 'fixed--hidden' : 'fixed--visible', {
|
|
124
147
|
[`col--${headAlign}`]: headAlign,
|
|
125
148
|
[`col--${type}`]: type,
|
|
126
149
|
'col--last': isLastColumn,
|
|
@@ -128,7 +151,6 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
128
151
|
'col--group': isColGroup,
|
|
129
152
|
'col--ellipsis': hasEllipsis,
|
|
130
153
|
'fixed--width': !isAutoCellWidth,
|
|
131
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
132
154
|
'is--padding': isPadding,
|
|
133
155
|
'is--sortable': column.sortable,
|
|
134
156
|
'col--filter': !!filters,
|
|
@@ -140,7 +162,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
140
162
|
attrs: thAttrs,
|
|
141
163
|
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(cellParams) : headerCellStyle) as VxeComponentStyleType : undefined,
|
|
142
164
|
on: thOns,
|
|
143
|
-
key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
|
|
165
|
+
key: showCustomHeader ? `${colid}${$columnIndex}` : (columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex)
|
|
144
166
|
}, [
|
|
145
167
|
h('div', {
|
|
146
168
|
class: ['vxe-cell', {
|
|
@@ -160,9 +182,9 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
160
182
|
}, column.renderHeader(h, cellParams))
|
|
161
183
|
]),
|
|
162
184
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
!fixedHiddenColumn && showResizable
|
|
185
|
+
* 列宽拖动
|
|
186
|
+
*/
|
|
187
|
+
!fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow)
|
|
166
188
|
? h('div', {
|
|
167
189
|
class: 'vxe-cell--col-resizable',
|
|
168
190
|
on: {
|
|
@@ -175,7 +197,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
175
197
|
})
|
|
176
198
|
}
|
|
177
199
|
|
|
178
|
-
function renderHeads (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode: boolean, headerGroups:
|
|
200
|
+
function renderHeads (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode: boolean, headerGroups: VxeTableDefines.ColumnInfo[][]) {
|
|
179
201
|
const props = _vm
|
|
180
202
|
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
181
203
|
const tableProps = $xeTable
|
|
@@ -194,7 +216,7 @@ function renderHeads (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMo
|
|
|
194
216
|
headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
|
|
195
217
|
],
|
|
196
218
|
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) as VxeComponentStyleType : undefined
|
|
197
|
-
}, renderRows(h, _vm, isGroup, isOptimizeMode,
|
|
219
|
+
}, renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, $rowIndex, cols))
|
|
198
220
|
})
|
|
199
221
|
}
|
|
200
222
|
|
|
@@ -216,15 +238,18 @@ export default {
|
|
|
216
238
|
}
|
|
217
239
|
},
|
|
218
240
|
watch: {
|
|
219
|
-
tableColumn (
|
|
220
|
-
this
|
|
241
|
+
tableColumn () {
|
|
242
|
+
const _vm = this as any
|
|
243
|
+
|
|
244
|
+
_vm.uploadColumn()
|
|
221
245
|
}
|
|
222
246
|
},
|
|
223
|
-
created (
|
|
224
|
-
this
|
|
247
|
+
created () {
|
|
248
|
+
const _vm = this as any
|
|
249
|
+
_vm.uploadColumn()
|
|
225
250
|
},
|
|
226
251
|
mounted () {
|
|
227
|
-
const _vm = this
|
|
252
|
+
const _vm = this as any
|
|
228
253
|
const props = _vm
|
|
229
254
|
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
230
255
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -241,8 +266,9 @@ export default {
|
|
|
241
266
|
elemStore[`${prefix}repair`] = _vm.$refs.refHeaderBorderRepair
|
|
242
267
|
},
|
|
243
268
|
destroyed () {
|
|
244
|
-
const
|
|
245
|
-
const
|
|
269
|
+
const _vm = this as any
|
|
270
|
+
const props = _vm
|
|
271
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
246
272
|
const internalData = $xeTable as unknown as TableInternalData
|
|
247
273
|
|
|
248
274
|
const { fixedType } = props
|
|
@@ -257,15 +283,16 @@ export default {
|
|
|
257
283
|
elemStore[`${prefix}repair`] = null
|
|
258
284
|
},
|
|
259
285
|
render (h: CreateElement) {
|
|
260
|
-
const
|
|
261
|
-
const
|
|
286
|
+
const _vm = this as any
|
|
287
|
+
const props = _vm
|
|
288
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
262
289
|
const tableProps = $xeTable
|
|
263
290
|
const tableReactData = $xeTable as unknown as TableReactData
|
|
264
291
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
265
292
|
|
|
266
293
|
const { xID } = $xeTable
|
|
267
294
|
const { fixedType, fixedColumn, tableColumn } = props
|
|
268
|
-
const { headerColumn } =
|
|
295
|
+
const { headerColumn } = _vm
|
|
269
296
|
|
|
270
297
|
const { mouseConfig, showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps
|
|
271
298
|
const { isGroup, isColLoading, overflowX, scrollXLoad, dragCol } = tableReactData
|
|
@@ -382,7 +409,7 @@ export default {
|
|
|
382
409
|
*/
|
|
383
410
|
h('thead', {
|
|
384
411
|
ref: 'refHeaderTHead'
|
|
385
|
-
}, renderHeads(h,
|
|
412
|
+
}, renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList))
|
|
386
413
|
]),
|
|
387
414
|
mouseConfig && mouseOpts.area
|
|
388
415
|
? h('div', {
|
|
@@ -413,11 +440,26 @@ export default {
|
|
|
413
440
|
},
|
|
414
441
|
methods: {
|
|
415
442
|
uploadColumn () {
|
|
416
|
-
const
|
|
443
|
+
const _vm = this as any
|
|
444
|
+
const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
445
|
+
const tableProps = $xeTable
|
|
417
446
|
const tableReactData = $xeTable as unknown as TableReactData
|
|
447
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
418
448
|
|
|
449
|
+
const props = _vm
|
|
450
|
+
|
|
451
|
+
const { showCustomHeader } = tableProps
|
|
452
|
+
const { collectColumn, visibleColumn } = tableInternalData
|
|
453
|
+
const { tableGroupColumn } = props
|
|
419
454
|
const { isGroup } = tableReactData
|
|
420
|
-
|
|
455
|
+
let spanColumns: VxeTableDefines.ColumnInfo[][] = isGroup ? convertHeaderColumnToRows(tableGroupColumn) : []
|
|
456
|
+
let visibleColgroups: VxeTableDefines.ColumnInfo[][] = []
|
|
457
|
+
if (showCustomHeader && spanColumns.length > 1) {
|
|
458
|
+
visibleColgroups = convertHeaderToGridRows(spanColumns)
|
|
459
|
+
spanColumns = visibleColgroups
|
|
460
|
+
}
|
|
461
|
+
_vm.headerColumn = spanColumns
|
|
462
|
+
$xeTable.dispatchEvent('columns-change', { visibleColgroups, collectColumn, visibleColumn }, null)
|
|
421
463
|
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
464
|
+
}
|
|
465
|
+
}
|