Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descirptions: avoid table style conflict #21254

Merged
merged 5 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/descriptions/src/descriptions-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
return (
<th
class={{
'el-descriptions-item__cell': true,
'el-descriptions-item__label': true,
'has-colon': elDescriptions.border ? false : elDescriptions.colon,
'is-bordered-label': elDescriptions.border,
Expand All @@ -44,8 +45,7 @@ export default {
row.map(item =>{
return (
<td
class="el-descriptions-item__content"
class={['el-descriptions-item__content', item.contentClassName]}
class={['el-descriptions-item__cell', 'el-descriptions-item__content', item.contentClassName]}
style={item.contentStyle}
colSpan={item.props.span}
>{item.slots.default}</td>
Expand All @@ -65,6 +65,7 @@ export default {
return ([
<th
class={{
'el-descriptions-item__cell': true,
'el-descriptions-item__label': true,
'is-bordered-label': elDescriptions.border,
[item.labelClassName]: true
Expand All @@ -73,7 +74,7 @@ export default {
colSpan="1"
>{item.label}</th>,
<td
class={['el-descriptions-item__content', item.contentClassName]}
class={['el-descriptions-item__cell', 'el-descriptions-item__content', item.contentClassName]}
style={item.contentStyle}
colSpan={item.props.span * 2 - 1}
>{item.slots.default}</td>
Expand All @@ -90,7 +91,7 @@ export default {
{
row.map(item=> {
return (
<td class="el-descriptions-item" colSpan={item.props.span}>
<td class="el-descriptions-item el-descriptions-item__cell" colSpan={item.props.span}>
<div class="el-descriptions-item__container">
<span
class={{
Expand Down
2 changes: 1 addition & 1 deletion packages/descriptions/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default {
}

<div class="el-descriptions__body">
<table class={[{'is-bordered': border}, descriptionsSize ? `el-descriptions--${descriptionsSize}` : '']}>
<table class={['el-descriptions__table', {'is-bordered': border}, descriptionsSize ? `el-descriptions--${descriptionsSize}` : '']}>
{rows.map(row => (
<DescriptionsRow row={row}></DescriptionsRow>
))}
Expand Down
4 changes: 3 additions & 1 deletion packages/table/src/table-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ export default {
}));
}

classes.push('el-table__cell');

return classes.join(' ');
},

Expand Down Expand Up @@ -404,7 +406,7 @@ export default {
return [[
tr,
<tr key={'expanded-row__' + tr.key}>
<td colspan={ this.columnsCount } class="el-table__expanded-cell">
<td colspan={ this.columnsCount } class="el-table__cell el-table__expanded-cell">
{ renderExpanded(this.$createElement, { row, $index, store: this.store }) }
</td>
</tr>]];
Expand Down
4 changes: 2 additions & 2 deletions packages/table/src/table-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default {
key={cellIndex}
colspan={ column.colSpan }
rowspan={ column.rowSpan }
class={ this.getRowClasses(column, cellIndex) }>
class={ [...this.getRowClasses(column, cellIndex), 'el-table__cell'] }>
<div class={ ['cell', column.labelClassName] }>
{
sums[cellIndex]
Expand All @@ -72,7 +72,7 @@ export default {
</td>)
}
{
this.hasGutter ? <th class="gutter"></th> : ''
this.hasGutter ? <th class="el-table__cell gutter"></th> : ''
}
</tr>
</tbody>
Expand Down
4 changes: 3 additions & 1 deletion packages/table/src/table-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default {
</th>))
}
{
this.hasGutter ? <th class="gutter"></th> : ''
this.hasGutter ? <th class="el-table__cell gutter"></th> : ''
}
</tr>
)
Expand Down Expand Up @@ -286,6 +286,8 @@ export default {
}));
}

classes.push('el-table__cell');

return classes.join(' ');
},

Expand Down
20 changes: 10 additions & 10 deletions packages/theme-chalk/src/descriptions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
color: $--color-text-regular;
background-color: $--color-white;

table {
.el-descriptions__table {
border-collapse: collapse;
width: 100%;
table-layout: fixed;

th, td {
.el-descriptions-item__cell {
box-sizing: border-box;
text-align: left;
font-weight: normal;
Expand All @@ -51,27 +51,27 @@

.is-bordered {
table-layout: auto;
th, td {
.el-descriptions-item__cell {
border: $--descriptions-table-border;
padding: 12px 10px;
}
}

:not(.is-bordered) {
th, td {
.el-descriptions-item__cell {
padding-bottom: 12px;
}
}

@include m(medium) {
&.is-bordered {
th, td {
.el-descriptions-item__cell {
padding: 10px;
}
}

&:not(.is-bordered) {
th, td {
.el-descriptions-item__cell {
padding-bottom: 10px;
}
}
Expand All @@ -81,13 +81,13 @@
font-size: 12px;

&.is-bordered {
th, td {
.el-descriptions-item__cell {
padding: 8px 10px;
}
}

&:not(.is-bordered) {
th, td {
.el-descriptions-item__cell {
padding-bottom: 8px;
}
}
Expand All @@ -97,13 +97,13 @@
font-size: 12px;

&.is-bordered {
th, td {
.el-descriptions-item__cell {
padding: 6px 10px;
}
}

&:not(.is-bordered) {
th, td {
.el-descriptions-item__cell {
padding-bottom: 6px;
}
}
Expand Down
45 changes: 23 additions & 22 deletions packages/theme-chalk/src/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
border-right: 0;
border-bottom: 0;

th.gutter, td.gutter {
.el-table__cell.gutter {
border-right-width: 1px;
}
}
Expand All @@ -111,13 +111,13 @@
font-weight: 500;

&.is-group {
th {
th.el-table__cell {
background: $--background-color-base;
}
}
}

th, td {
.el-table__cell {
padding: 12px 0;
min-width: 0;
box-sizing: border-box;
Expand Down Expand Up @@ -149,21 +149,21 @@
}

@include m(medium) {
th, td {
.el-table__cell {
padding: 10px 0;
}
}

@include m(small) {
font-size: 12px;
th, td {
.el-table__cell {
padding: 8px 0;
}
}

@include m(mini) {
font-size: 12px;
th, td {
.el-table__cell {
padding: 6px 0;
}
}
Expand All @@ -176,15 +176,16 @@
}
}

th.is-leaf, td {
th.el-table__cell.is-leaf,
td.el-table__cell {
border-bottom: $--table-border;
}

th.is-sortable {
th.el-table__cell.is-sortable {
cursor: pointer;
}

th {
th.el-table__cell {
overflow: hidden;
user-select: none;
background-color: $--table-header-background-color;
Expand Down Expand Up @@ -215,7 +216,7 @@
}
}

td {
td.el-table__cell {
div {
box-sizing: border-box;
}
Expand Down Expand Up @@ -280,20 +281,20 @@
border-color: transparent;
}

th, td {
.el-table__cell {
border-right: $--table-border;

&:first-child .cell {
padding-left: 10px;
}
}

th.gutter:last-of-type {
th.el-table__cell.gutter:last-of-type {
border-bottom: $--table-border;
border-bottom-width: 1px;
}

& th {
& th.el-table__cell {
border-bottom: $--table-border;
}
}
Expand Down Expand Up @@ -356,7 +357,7 @@
bottom: 0;
z-index: 3;

& tbody td {
& tbody td.el-table__cell {
border-top: $--table-border;
background-color: $--table-row-hover-background-color;
color: $--table-font-color;
Expand All @@ -377,7 +378,7 @@

@include e(footer-wrapper) {
margin-top: -1px;
td {
td.el-table__cell {
border-top: $--table-border;
}
}
Expand All @@ -390,7 +391,7 @@
@include e((header-wrapper, footer-wrapper)) {
overflow: hidden;

& tbody td {
& tbody td.el-table__cell {
background-color: $--table-row-hover-background-color;
color: $--table-font-color;
}
Expand Down Expand Up @@ -481,11 +482,11 @@
@include m(striped) {
& .el-table__body {
& tr.el-table__row--striped {
td {
td.el-table__cell {
background: #FAFAFA;
}

&.current-row td {
&.current-row td.el-table__cell {
background-color: $--table-current-row-background-color;
}
}
Expand All @@ -496,14 +497,14 @@
tr.hover-row {
&, &.el-table__row--striped {
&, &.current-row {
> td {
> td.el-table__cell {
background-color: $--table-row-hover-background-color;
}
}
}
}

tr.current-row > td {
tr.current-row > td.el-table__cell {
background-color: $--table-current-row-background-color;
}
}
Expand Down Expand Up @@ -531,13 +532,13 @@
}

@include m(enable-row-transition) {
.el-table__body td {
.el-table__body td.el-table__cell {
transition: background-color .25s ease;
}
}

@include m(enable-row-hover) {
.el-table__body tr:hover > td {
.el-table__body tr:hover > td.el-table__cell {
background-color: $--table-row-hover-background-color;
}
}
Expand Down