Skip to content

Commit 1c2ce39

Browse files
committed
releases 4.17.19
1 parent 182668b commit 1c2ce39

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vxe-table",
3-
"version": "4.17.18",
3+
"version": "4.17.19",
44
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
55
"scripts": {
66
"update": "npm install --legacy-peer-deps",

packages/table/src/header.ts

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,6 @@ const { renderer, renderEmptyElement } = VxeUI
1313
const sourceType = 'table'
1414
const renderType = 'header'
1515

16-
function getColumnFirstChild (column: VxeTableDefines.ColumnInfo): VxeTableDefines.ColumnInfo {
17-
const { children } = column
18-
if (children && children.length) {
19-
return getColumnFirstChild(children[0])
20-
}
21-
return column
22-
}
23-
24-
function getColumnLastChild (column: VxeTableDefines.ColumnInfo): VxeTableDefines.ColumnInfo {
25-
const { children } = column
26-
if (children && children.length) {
27-
return getColumnLastChild(children[children.length - 1])
28-
}
29-
return column
30-
}
31-
3216
export default defineVxeComponent({
3317
name: 'VxeTableHeader',
3418
props: {
@@ -203,15 +187,13 @@ export default defineVxeComponent({
203187
if (showCustomHeader) {
204188
// custom
205189
} else if (isColGroup && !isLastRow) {
206-
const firstCol = getColumnFirstChild(column)
207-
const lastCol = getColumnLastChild(column)
208-
if (firstCol && lastCol && firstCol.id !== lastCol.id) {
209-
const firstColRest = fullColumnIdData[firstCol.id]
210-
const lastColRest = fullColumnIdData[lastCol.id]
211-
if (firstColRest && lastColRest) {
212-
tcStyle.width = `${lastColRest.oLeft - firstColRest.oLeft + lastCol.renderWidth}px`
190+
let childWidth = 0
191+
XEUtils.eachTree(column.children, (childRow) => {
192+
if (childRow.visible && (!childRow.children || !childRow.children.length)) {
193+
childWidth += childRow.renderWidth
213194
}
214-
}
195+
})
196+
tcStyle.width = `${childWidth}px`
215197
}
216198

217199
return h('th', {

packages/ui/src/dom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ function getNodeOffset (elem: any, container: any, rest: any): any {
4747
}
4848

4949
export function isPx (val: any) {
50-
return val && /^\d+(px)?$/.test(val)
50+
return val && /^\d+(\.\d+)?px?$/.test(val)
5151
}
5252

5353
export function isScale (val: any) {
54-
return val && /^\d+%$/.test(val)
54+
return val && /^\d+(\.\d+)?%$/.test(val)
5555
}
5656

5757
export function hasClass (elem: any, cls: any) {

0 commit comments

Comments
 (0)