Skip to content

Commit ef4caa9

Browse files
authored
Table: support class-name when type=expand (#12006)
1 parent 4167809 commit ef4caa9

File tree

2 files changed

+35
-50
lines changed

2 files changed

+35
-50
lines changed

packages/table/src/table-body.js

Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -58,55 +58,30 @@ export default {
5858
if (!rowspan || !colspan) {
5959
return '';
6060
} else {
61-
if (rowspan === 1 && colspan === 1) {
62-
return (
63-
<td
64-
style={ this.getCellStyle($index, cellIndex, row, column) }
65-
class={ this.getCellClass($index, cellIndex, row, column) }
66-
on-mouseenter={ ($event) => this.handleCellMouseEnter($event, row) }
67-
on-mouseleave={ this.handleCellMouseLeave }>
68-
{
69-
column.renderCell.call(
70-
this._renderProxy,
71-
h,
72-
{
73-
row,
74-
column,
75-
$index,
76-
store: this.store,
77-
_self: this.context || this.table.$vnode.context
78-
},
79-
columnsHidden[cellIndex]
80-
)
81-
}
82-
</td>
83-
);
84-
} else {
85-
return (
86-
<td
87-
style={ this.getCellStyle($index, cellIndex, row, column) }
88-
class={ this.getCellClass($index, cellIndex, row, column) }
89-
rowspan={ rowspan }
90-
colspan={ colspan }
91-
on-mouseenter={ ($event) => this.handleCellMouseEnter($event, row) }
92-
on-mouseleave={ this.handleCellMouseLeave }>
93-
{
94-
column.renderCell.call(
95-
this._renderProxy,
96-
h,
97-
{
98-
row,
99-
column,
100-
$index,
101-
store: this.store,
102-
_self: this.context || this.table.$vnode.context
103-
},
104-
columnsHidden[cellIndex]
105-
)
106-
}
107-
</td>
108-
);
109-
}
61+
return (
62+
<td
63+
style={ this.getCellStyle($index, cellIndex, row, column) }
64+
class={ this.getCellClass($index, cellIndex, row, column) }
65+
rowspan={ rowspan }
66+
colspan={ colspan }
67+
on-mouseenter={ ($event) => this.handleCellMouseEnter($event, row) }
68+
on-mouseleave={ this.handleCellMouseLeave }>
69+
{
70+
column.renderCell.call(
71+
this._renderProxy,
72+
h,
73+
{
74+
row,
75+
column,
76+
$index,
77+
store: this.store,
78+
_self: this.context || this.table.$vnode.context
79+
},
80+
columnsHidden[cellIndex]
81+
)
82+
}
83+
</td>
84+
);
11085
}
11186
})
11287
}

packages/table/src/table-column.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,17 @@ export default {
279279
sortOrders: this.sortOrders
280280
});
281281

282-
objectAssign(column, forced[type] || {});
282+
let source = forced[type] || {};
283+
for (let prop in source) {
284+
if (source.hasOwnProperty(prop)) {
285+
let value = source[prop];
286+
if (value !== undefined) {
287+
column[prop] = prop === 'className'
288+
? `${column[prop]} ${value}`
289+
: value;
290+
}
291+
}
292+
}
283293

284294
this.columnConfig = column;
285295

0 commit comments

Comments
 (0)