mirror of https://github.com/ElemeFE/element
Table: Move `append` slot out of `table-body`
parent
f6f61bcbde
commit
999db14732
|
@ -136,8 +136,6 @@ export default {
|
||||||
</tr>)
|
</tr>)
|
||||||
: ''
|
: ''
|
||||||
]
|
]
|
||||||
).concat(
|
|
||||||
this._self.$parent.$slots.append
|
|
||||||
).concat(
|
).concat(
|
||||||
<el-tooltip effect={ this.table.tooltipEffect } placement="top" ref="tooltip" content={ this.tooltipContent }></el-tooltip>
|
<el-tooltip effect={ this.table.tooltipEffect } placement="top" ref="tooltip" content={ this.tooltipContent }></el-tooltip>
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,6 +16,7 @@ class TableLayout {
|
||||||
this.rightFixedWidth = null;
|
this.rightFixedWidth = null;
|
||||||
this.tableHeight = null;
|
this.tableHeight = null;
|
||||||
this.headerHeight = 44; // Table Header Height
|
this.headerHeight = 44; // Table Header Height
|
||||||
|
this.appendHeight = 0; // Append Slot Height
|
||||||
this.footerHeight = 44; // Table Footer Height
|
this.footerHeight = 44; // Table Footer Height
|
||||||
this.viewportHeight = null; // Table Height - Scroll Bar Height
|
this.viewportHeight = null; // Table Height - Scroll Bar Height
|
||||||
this.bodyHeight = null; // Table Height - Table Header Height
|
this.bodyHeight = null; // Table Height - Table Header Height
|
||||||
|
@ -74,8 +75,9 @@ class TableLayout {
|
||||||
updateHeight() {
|
updateHeight() {
|
||||||
const height = this.tableHeight = this.table.$el.clientHeight;
|
const height = this.tableHeight = this.table.$el.clientHeight;
|
||||||
const noData = !this.table.data || this.table.data.length === 0;
|
const noData = !this.table.data || this.table.data.length === 0;
|
||||||
const { headerWrapper, footerWrapper } = this.table.$refs;
|
const { headerWrapper, appendWrapper, footerWrapper } = this.table.$refs;
|
||||||
const footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
|
const footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
|
||||||
|
this.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
|
||||||
if (this.showHeader && !headerWrapper) return;
|
if (this.showHeader && !headerWrapper) return;
|
||||||
if (!this.showHeader) {
|
if (!this.showHeader) {
|
||||||
this.headerHeight = 0;
|
this.headerHeight = 0;
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
<div :style="{ width: bodyWidth }" class="el-table__empty-block" v-if="!data || data.length === 0">
|
<div :style="{ width: bodyWidth }" class="el-table__empty-block" v-if="!data || data.length === 0">
|
||||||
<span class="el-table__empty-text"><slot name="empty">{{ emptyText || t('el.table.emptyText') }}</slot></span>
|
<span class="el-table__empty-text"><slot name="empty">{{ emptyText || t('el.table.emptyText') }}</slot></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="el-table__append-wrapper" ref="appendWrapper" v-if="$slots.append">
|
||||||
|
<slot name="append"></slot>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-table__footer-wrapper" ref="footerWrapper" v-if="showSummary" v-show="data && data.length > 0">
|
<div class="el-table__footer-wrapper" ref="footerWrapper" v-if="showSummary" v-show="data && data.length > 0">
|
||||||
<table-footer
|
<table-footer
|
||||||
|
@ -84,6 +87,7 @@
|
||||||
:row-style="rowStyle"
|
:row-style="rowStyle"
|
||||||
:style="{ width: layout.fixedWidth ? layout.fixedWidth + 'px' : '' }">
|
:style="{ width: layout.fixedWidth ? layout.fixedWidth + 'px' : '' }">
|
||||||
</table-body>
|
</table-body>
|
||||||
|
<div class="el-table__append-gutter" :style="{ height: layout.appendHeight + 'px' }" v-if="$slots.append"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-table__fixed-footer-wrapper" ref="fixedFooterWrapper" v-if="showSummary" v-show="data && data.length > 0">
|
<div class="el-table__fixed-footer-wrapper" ref="fixedFooterWrapper" v-if="showSummary" v-show="data && data.length > 0">
|
||||||
<table-footer
|
<table-footer
|
||||||
|
@ -273,8 +277,11 @@
|
||||||
if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
|
if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
|
||||||
if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
|
if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
|
||||||
const maxScrollLeftPosition = this.scrollWidth - this.offsetWidth - 1;
|
const maxScrollLeftPosition = this.scrollWidth - this.offsetWidth - 1;
|
||||||
|
|
||||||
const scrollLeft = this.scrollLeft;
|
const scrollLeft = this.scrollLeft;
|
||||||
if (scrollLeft >= maxScrollLeftPosition) {
|
if (!self.layout.scrollX) {
|
||||||
|
self.scrollPosition = 'none';
|
||||||
|
} else if (scrollLeft >= maxScrollLeftPosition) {
|
||||||
self.scrollPosition = 'right';
|
self.scrollPosition = 'right';
|
||||||
} else if (scrollLeft === 0) {
|
} else if (scrollLeft === 0) {
|
||||||
self.scrollPosition = 'left';
|
self.scrollPosition = 'left';
|
||||||
|
@ -494,7 +501,7 @@
|
||||||
resizeProxyVisible: false,
|
resizeProxyVisible: false,
|
||||||
// 是否拥有多级表头
|
// 是否拥有多级表头
|
||||||
isGroup: false,
|
isGroup: false,
|
||||||
scrollPosition: 'left'
|
scrollPosition: layout.scrollX ? 'left' : 'none'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -366,6 +366,13 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
@include when(scroll-none) {
|
||||||
|
~ .el-table__fixed,
|
||||||
|
~ .el-table__fixed-right {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@include when(scroll-left) {
|
@include when(scroll-left) {
|
||||||
~ .el-table__fixed {
|
~ .el-table__fixed {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|
Loading…
Reference in New Issue