Commit 1ba90b95 authored by Black  Wayne's avatar Black Wayne Committed by 杨奕

Table: add chalk theme (#7059)

* Table: add chalk theme

* Table: add group header & other

* Table: del package.lock

* Table: del single test trace

* Table: fix border problem

* Table: fix boder problem

* Table: clean css

* Table: footer border right - -|
parent cb1d6beb
...@@ -561,7 +561,6 @@ When there are too many rows, you can use a fixed header. ...@@ -561,7 +561,6 @@ When there are too many rows, you can use a fixed header.
<el-table <el-table
:data="tableData3" :data="tableData3"
height="250" height="250"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="date" prop="date"
...@@ -629,7 +628,6 @@ When there are too many columns, you can fix some of them. ...@@ -629,7 +628,6 @@ When there are too many columns, you can fix some of them.
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
fixed fixed
...@@ -732,7 +730,6 @@ When you have huge chunks of data to put in a table, you can fix the header and ...@@ -732,7 +730,6 @@ When you have huge chunks of data to put in a table, you can fix the header and
<template> <template>
<el-table <el-table
:data="tableData3" :data="tableData3"
border
style="width: 100%" style="width: 100%"
height="250"> height="250">
<el-table-column <el-table-column
...@@ -839,7 +836,6 @@ When the the data is dynamically changed, you might want the table to have a max ...@@ -839,7 +836,6 @@ When the the data is dynamically changed, you might want the table to have a max
<template> <template>
<el-table <el-table
:data="tableData4" :data="tableData4"
border
style="width: 100%" style="width: 100%"
max-height="250"> max-height="250">
<el-table-column <el-table-column
...@@ -964,7 +960,6 @@ When the data structure is complex, you can use group header to show the data hi ...@@ -964,7 +960,6 @@ When the data structure is complex, you can use group header to show the data hi
<template> <template>
<el-table <el-table
:data="tableData3" :data="tableData3"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="date" prop="date"
...@@ -1150,7 +1145,6 @@ You can also select multiple rows. ...@@ -1150,7 +1145,6 @@ You can also select multiple rows.
<el-table <el-table
ref="multipleTable" ref="multipleTable"
:data="tableData3" :data="tableData3"
border
style="width: 100%" style="width: 100%"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column <el-table-column
...@@ -1244,7 +1238,6 @@ Sort the data to find or compare data quickly. ...@@ -1244,7 +1238,6 @@ Sort the data to find or compare data quickly.
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
:default-sort = "{prop: 'date', order: 'descending'}" :default-sort = "{prop: 'date', order: 'descending'}"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
...@@ -1308,7 +1301,6 @@ Filter the table to find desired data. ...@@ -1308,7 +1301,6 @@ Filter the table to find desired data.
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="date" prop="date"
...@@ -1390,7 +1382,6 @@ Customize table column so it can be integrated with other components. ...@@ -1390,7 +1382,6 @@ Customize table column so it can be integrated with other components.
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="Date" label="Date"
......
...@@ -769,7 +769,6 @@ ...@@ -769,7 +769,6 @@
<template> <template>
<el-table <el-table
:data="tableData3" :data="tableData3"
border
style="width: 100%" style="width: 100%"
height="250"> height="250">
<el-table-column <el-table-column
...@@ -876,7 +875,6 @@ ...@@ -876,7 +875,6 @@
<template> <template>
<el-table <el-table
:data="tableData4" :data="tableData4"
border
style="width: 100%" style="width: 100%"
max-height="250"> max-height="250">
<el-table-column <el-table-column
...@@ -1001,7 +999,6 @@ ...@@ -1001,7 +999,6 @@
<template> <template>
<el-table <el-table
:data="tableData3" :data="tableData3"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="date" prop="date"
...@@ -1187,7 +1184,6 @@ ...@@ -1187,7 +1184,6 @@
<el-table <el-table
ref="multipleTable" ref="multipleTable"
:data="tableData3" :data="tableData3"
border
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
...@@ -1282,7 +1278,6 @@ ...@@ -1282,7 +1278,6 @@
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
style="width: 100%" style="width: 100%"
:default-sort = "{prop: 'date', order: 'descending'}" :default-sort = "{prop: 'date', order: 'descending'}"
> >
...@@ -1348,7 +1343,6 @@ ...@@ -1348,7 +1343,6 @@
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="date" prop="date"
...@@ -1430,7 +1424,6 @@ ...@@ -1430,7 +1424,6 @@
<template> <template>
<el-table <el-table
:data="tableData" :data="tableData"
border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
label="日期" label="日期"
......
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
: '' : ''
} }
</colgroup> </colgroup>
<tbody> <tbody class={ [{ 'has-gutter': this.hasGutter }] }>
<tr> <tr>
{ {
this._l(this.columns, (column, cellIndex) => this._l(this.columns, (column, cellIndex) =>
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
) )
} }
{ {
!this.fixed && this.layout.gutterWidth this.hasGutter
? <td class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></td> ? <td class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></td>
: '' : ''
} }
...@@ -121,6 +121,10 @@ export default { ...@@ -121,6 +121,10 @@ export default {
columns() { columns() {
return this.store.states.columns; return this.store.states.columns;
},
hasGutter() {
return !this.fixed && this.layout.gutterWidth;
} }
}, },
......
...@@ -68,6 +68,9 @@ export default { ...@@ -68,6 +68,9 @@ export default {
render(h) { render(h) {
const originColumns = this.store.states.originColumns; const originColumns = this.store.states.originColumns;
const columnRows = convertToRows(originColumns, this.columns); const columnRows = convertToRows(originColumns, this.columns);
// 是否拥有多级表头
const isGroup = columnRows.length > 1;
if (isGroup) this.$parent.isGroup = true;
return ( return (
<table <table
...@@ -89,7 +92,7 @@ export default { ...@@ -89,7 +92,7 @@ export default {
: '' : ''
} }
</colgroup> </colgroup>
<thead> <thead class={ [{ 'is-group': isGroup, 'has-gutter': this.hasGutter }] }>
{ {
this._l(columnRows, (columns, rowIndex) => this._l(columnRows, (columns, rowIndex) =>
<tr> <tr>
...@@ -112,8 +115,12 @@ export default { ...@@ -112,8 +115,12 @@ export default {
{ {
column.sortable column.sortable
? <span class="caret-wrapper" on-click={ ($event) => this.handleSortClick($event, column) }> ? <span class="caret-wrapper" on-click={ ($event) => this.handleSortClick($event, column) }>
<i class="sort-caret ascending" on-click={ ($event) => this.handleSortClick($event, column, 'ascending') }></i> <span class="sort-caret ascending" on-click={ ($event) => this.handleSortClick($event, column, 'ascending') }>
<i class="sort-caret descending" on-click={ ($event) => this.handleSortClick($event, column, 'descending') }></i> <i class="el-icon-sort-up"></i>
</span>
<span class="sort-caret descending" on-click={ ($event) => this.handleSortClick($event, column, 'descending') }>
<i class="el-icon-sort-down"></i>
</span>
</span> </span>
: '' : ''
} }
...@@ -127,7 +134,7 @@ export default { ...@@ -127,7 +134,7 @@ export default {
) )
} }
{ {
!this.fixed && this.layout.gutterWidth this.hasGutter
? <th class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></th> ? <th class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></th>
: '' : ''
} }
...@@ -183,6 +190,10 @@ export default { ...@@ -183,6 +190,10 @@ export default {
columns() { columns() {
return this.store.states.columns; return this.store.states.columns;
},
hasGutter() {
return !this.fixed && this.layout.gutterWidth;
} }
}, },
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
:class="{ :class="{
'el-table--fit': fit, 'el-table--fit': fit,
'el-table--striped': stripe, 'el-table--striped': stripe,
'el-table--border': border, 'el-table--border': border || isGroup,
'el-table--hidden': isHidden, 'el-table--hidden': isHidden,
'el-table--group': isGroup,
'el-table--fluid-height': maxHeight, 'el-table--fluid-height': maxHeight,
'el-table--enable-row-hover': !store.states.isComplex, 'el-table--enable-row-hover': !store.states.isComplex,
'el-table--enable-row-transition': (store.states.data || []).length !== 0 && (store.states.data || []).length < 100 'el-table--enable-row-transition': (store.states.data || []).length !== 0 && (store.states.data || []).length < 100
...@@ -23,6 +24,7 @@ ...@@ -23,6 +24,7 @@
<div <div
class="el-table__body-wrapper" class="el-table__body-wrapper"
ref="bodyWrapper" ref="bodyWrapper"
:class="[`is-scroll-${scrollPosition}`]"
:style="[bodyHeight]"> :style="[bodyHeight]">
<table-body <table-body
:context="context" :context="context"
...@@ -63,7 +65,9 @@ ...@@ -63,7 +65,9 @@
:layout="layout" :layout="layout"
:style="{ width: layout.fixedWidth ? layout.fixedWidth + 'px' : '' }"></table-header> :style="{ width: layout.fixedWidth ? layout.fixedWidth + 'px' : '' }"></table-header>
</div> </div>
<div class="el-table__fixed-body-wrapper" ref="fixedBodyWrapper" <div
class="el-table__fixed-body-wrapper"
ref="fixedBodyWrapper"
:style="[ :style="[
{ top: layout.headerHeight + 'px' }, { top: layout.headerHeight + 'px' },
fixedBodyHeight fixedBodyHeight
...@@ -94,7 +98,7 @@ ...@@ -94,7 +98,7 @@
v-if="rightFixedColumns.length > 0" v-if="rightFixedColumns.length > 0"
:style="[ :style="[
{ width: layout.rightFixedWidth ? layout.rightFixedWidth + 'px' : '' }, { width: layout.rightFixedWidth ? layout.rightFixedWidth + 'px' : '' },
{ right: layout.scrollY ? (border ? layout.gutterWidth : (layout.gutterWidth || 1)) + 'px' : '' }, { right: layout.scrollY ? (border ? layout.gutterWidth : (layout.gutterWidth || 0)) + 'px' : '' },
fixedHeight fixedHeight
]"> ]">
<div class="el-table__fixed-header-wrapper" ref="rightFixedHeaderWrapper" v-if="showHeader"> <div class="el-table__fixed-header-wrapper" ref="rightFixedHeaderWrapper" v-if="showHeader">
...@@ -249,11 +253,21 @@ ...@@ -249,11 +253,21 @@
bindEvents() { bindEvents() {
const { headerWrapper, footerWrapper } = this.$refs; const { headerWrapper, footerWrapper } = this.$refs;
const refs = this.$refs; const refs = this.$refs;
let self = this;
this.bodyWrapper.addEventListener('scroll', function() { this.bodyWrapper.addEventListener('scroll', function() {
if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft; if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft;
if (footerWrapper) footerWrapper.scrollLeft = this.scrollLeft; if (footerWrapper) footerWrapper.scrollLeft = this.scrollLeft;
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 scrollLeft = this.scrollLeft;
if (scrollLeft >= maxScrollLeftPosition) {
self.scrollPosition = 'right';
} else if (scrollLeft === 0) {
self.scrollPosition = 'left';
} else {
self.scrollPosition = 'middle';
}
}); });
const scrollBodyWrapper = event => { const scrollBodyWrapper = event => {
...@@ -459,7 +473,10 @@ ...@@ -459,7 +473,10 @@
layout, layout,
isHidden: false, isHidden: false,
renderExpanded: null, renderExpanded: null,
resizeProxyVisible: false resizeProxyVisible: false,
// 是否拥有多级表头
isGroup: false,
scrollPosition: 'left'
}; };
} }
}; };
......
...@@ -467,13 +467,14 @@ $--dialog-padding-primary: 15px; ...@@ -467,13 +467,14 @@ $--dialog-padding-primary: 15px;
/* Table /* Table
-------------------------- */ -------------------------- */
$--table-border-color: $--border-color-lighter; $--table-border: 1px solid $--border-color-lighter;
$--table-text-color: $--color-text-regular; $--table-text-color: $--color-text-regular;
$--table-header-color: $--color-text-secondary; $--table-header-color: $--color-text-secondary;
$--table-row-hover-background: $--background-color-base; $--table-row-hover-background: $--background-color-base;
$--table-current-row-background: $--background-color-base; $--table-current-row-background: $--color-primary-light-9;
$--table-header-background: $--color-text-secondary; $--table-header-background: $--color-text-secondary;
$--table-footer-background: $--color-text-placeholder; $--table-footer-background: $--color-text-placeholder;
$--table-fixed-box-shadow: 0 0 10px rgba(0, 0, 0, .12);
/* Pagination /* Pagination
-------------------------- */ -------------------------- */
......
@font-face { @font-face {
font-family: 'element-icons'; font-family: 'element-icons';
src: url('fonts/element-icons.woff?t=1504667669908') format('woff'), /* chrome, firefox */ src: url('fonts/element-icons.woff?t=1505459769526') format('woff'), /* chrome, firefox */
url('fonts/element-icons.ttf?t=1504667669908') format('truetype'); /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ url('fonts/element-icons.ttf?t=1505459769526') format('truetype'); /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal
} }
[class^="el-icon-"], [class*=" el-icon-"] { [class^="el-icon-"], [class*=" el-icon-"] {
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
.el-icon-error:before { content: "\e62c"; } .el-icon-error:before { content: "\e62c"; }
.el-icon-success:before { content: "\e62d"; } .el-icon-success:before { content: "\e62d"; }
.el-icon-warning:before { content: "\e62e"; } .el-icon-warning:before { content: "\e62e"; }
.el-icon-sort-down:before { content: "\e630"; }
.el-icon-sort-up:before { content: "\e631"; }
.el-icon-loading { .el-icon-loading {
animation: rotating 1s linear infinite; animation: rotating 1s linear infinite;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
-------------------------- */ -------------------------- */
@mixin scroll-bar { @mixin scroll-bar {
$--scrollbar-thumb-background: #b4bccc; $--scrollbar-thumb-background: #b4bccc;
$--scrollbar-track-background: #edeff5; $--scrollbar-track-background: #fff;
&::-webkit-scrollbar { &::-webkit-scrollbar {
z-index: 11; z-index: 11;
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
&-thumb { &-thumb {
border-radius: 5px; border-radius: 5px;
width: 6px;
background: $--scrollbar-thumb-background; background: $--scrollbar-thumb-background;
} }
...@@ -39,6 +40,11 @@ ...@@ -39,6 +40,11 @@
&-track { &-track {
background: $--scrollbar-track-background; background: $--scrollbar-track-background;
&-piece {
background: $--scrollbar-track-background;
width: 6px;
}
} }
} }
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
} }
@include b(table-filter) { @include b(table-filter) {
border: solid 1px $--color-black; border: solid 1px $--border-color-lighter;
border-radius: 2px; border-radius: 2px;
background-color: $--color-white; background-color: $--color-white;
box-shadow: $--dropdown-menu-box-shadow; box-shadow: $--dropdown-menu-box-shadow;
...@@ -50,15 +50,15 @@ ...@@ -50,15 +50,15 @@
} }
@include e(bottom) { @include e(bottom) {
border-top: 1px solid $--color-black; border-top: 1px solid $--border-color-lighter;
padding: 8px; padding: 8px;
button { button {
background: transparent; background: transparent;
border: none; border: none;
color: $--color-black; color: $--color-text-regular;
cursor: pointer; cursor: pointer;
font-size: $--font-size-base; font-size: $--font-size-small;
padding: 0 3px; padding: 0 3px;
&:hover { &:hover {
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
} }
&.is-disabled { &.is-disabled {
color: $--color-black; color: $--disabled-color-base;
cursor: not-allowed; cursor: not-allowed;
} }
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment