mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-12 12:25:16 +08:00
commit
bab814f49f
@ -8,7 +8,7 @@
|
||||
:overlay-style="{ marginTop: '24px', marginBottom: '24px', width: '800px' }"
|
||||
>
|
||||
<n-button @click="drawerActive = !drawerActive">Open Drawer</n-button>
|
||||
<n-drawer v-model="drawerActive">
|
||||
<n-drawer v-model="drawerActive" width="600">
|
||||
<n-radio-group v-model="size" name="top-size" style="margin-bottom: 12px;">
|
||||
<n-radio-button value="small">小</n-radio-button>
|
||||
<n-radio-button value="medium" >中</n-radio-button>
|
||||
|
@ -2,17 +2,7 @@
|
||||
<div class="footer">
|
||||
<n-divider v-if="showDivider" style="margin: 0 0 16px 0;" />
|
||||
<n-text depth="tertiary">
|
||||
For Preview Only ·
|
||||
</n-text>
|
||||
<n-text depth="tertiary">
|
||||
Designed by <n-a ref="noopener noreferer" class="link" href="https://www.ritalei.com" target="_blank">
|
||||
<n-text>
|
||||
Rita Lei
|
||||
</n-text>
|
||||
</n-a>
|
||||
<n-text depth="tertiary">
|
||||
· Refined by Haiyang Yu & 07akioni
|
||||
</n-text>
|
||||
A Tusimple Product
|
||||
</n-text>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -116,9 +116,9 @@
|
||||
box-shadow: inset 0 0 0 1px map-get($--checkbox-border-color, 'active');
|
||||
}
|
||||
}
|
||||
&:focus {
|
||||
&:focus:not(:active) {
|
||||
@include b(checkbox-box) {
|
||||
box-shadow: inset 0 0 0 1px map-get($--checkbox-border-color, 'active');
|
||||
box-shadow: inset 0 0 0 1px map-get($--checkbox-border-color, 'active'), 0 0 0 2px change-color(map-get($--checkbox-border-color, 'active'), $alpha: .3);
|
||||
}
|
||||
}
|
||||
@include b(checkbox-box) {
|
||||
@ -139,7 +139,7 @@
|
||||
}
|
||||
}
|
||||
@include m(checked, indeterminate) {
|
||||
&:focus {
|
||||
&:focus:not(:active) {
|
||||
@include b(checkbox-box) {
|
||||
box-shadow: inset 0 0 0 1px map-get($--checkbox-border-color, 'active'), 0 0 0 2px change-color(map-get($--checkbox-border-color, 'active'), $alpha: .3);
|
||||
}
|
||||
|
@ -31,494 +31,492 @@
|
||||
}
|
||||
|
||||
@include themes-mixin {
|
||||
@include b(data-table) {
|
||||
@include once {
|
||||
@include data-table-size-mixin();
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
@include b(data-table-empty) {
|
||||
margin: 16px 0 14px 0;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 0;
|
||||
opacity: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: opacity .3s $--n-ease-in-out-cubic-bezier;
|
||||
@include m(hide) {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@include e(pagination) {
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
@include b(data-table-wrapper) {
|
||||
@include once {
|
||||
position: relative;
|
||||
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
border-top-left-radius: $--n-data-table-border-radius;
|
||||
border-top-right-radius: $--n-data-table-border-radius;
|
||||
overflow: hidden;
|
||||
line-height: 1.75;
|
||||
}
|
||||
}
|
||||
@include b(data-table-table) {
|
||||
@include once {
|
||||
font-variant-numeric: tabular-nums;
|
||||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
table-layout: fixed;
|
||||
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
}
|
||||
background-color: map-get($--data-table-body-background-color, 'default');
|
||||
@include b(data-table-thead) {
|
||||
@include once {
|
||||
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
}
|
||||
background-color: map-get($--data-table-header-background-color, 'default');
|
||||
}
|
||||
@include b(data-table-tr) {
|
||||
@include once {
|
||||
box-sizing: border-box;
|
||||
transition: background-color 0.3s $--n-ease-in-out-cubic-bezier;
|
||||
background-clip: padding-box;
|
||||
&:last-child {
|
||||
@include b(data-table-td) {
|
||||
&::after {
|
||||
bottom: 0 !important;
|
||||
}
|
||||
&::before {
|
||||
bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background-color: map-get($--data-table-row-background-color, 'hover');
|
||||
@include b(data-table-td) {
|
||||
background-color: map-get($--data-table-row-background-color, 'hover');
|
||||
}
|
||||
}
|
||||
}
|
||||
@include b(data-table-td) {
|
||||
@include once {
|
||||
text-align: left;
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
transition:
|
||||
box-shadow .3s $--n-ease-in-out-cubic-bezier,
|
||||
background-color .3s $--n-ease-in-out-cubic-bezier,
|
||||
border-color .3s $--n-ease-in-out-cubic-bezier,
|
||||
color .3s $--n-ease-in-out-cubic-bezier;
|
||||
@include m(ellipsis) {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@include m(selection) {
|
||||
line-height: 0;
|
||||
}
|
||||
@include m(fixed-left) {
|
||||
left: 0;
|
||||
position: sticky;
|
||||
z-index: 2;
|
||||
&::after {
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
width: 36px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -1px;
|
||||
transition: box-shadow .2s $--n-ease-in-out-cubic-bezier;
|
||||
right: -36px;
|
||||
}
|
||||
}
|
||||
@include m(fixed-right) {
|
||||
right: 0;
|
||||
position: sticky;
|
||||
&::before {
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
width: 36px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -1px;
|
||||
transition: box-shadow .2s $--n-ease-in-out-cubic-bezier;
|
||||
left: -36px;
|
||||
}
|
||||
}
|
||||
}
|
||||
background-color: map-get($--data-table-body-background-color, 'default');
|
||||
@include m(shadow-before) {
|
||||
&::before {
|
||||
box-shadow: inset -12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
}
|
||||
}
|
||||
@include m(shadow-after) {
|
||||
border-right-color: transparent !important;
|
||||
&::after {
|
||||
box-shadow: inset 12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
}
|
||||
}
|
||||
color: $--data-table-body-text-color;
|
||||
border-bottom: 1px solid map-get($--data-table-border-color, 'default');
|
||||
}
|
||||
@include b(data-table-th) {
|
||||
@include once {
|
||||
position: relative;
|
||||
text-align: left;
|
||||
font-weight: $--n-strong-weight;
|
||||
box-sizing: border-box;
|
||||
transition:
|
||||
border-color .3s $--n-ease-in-out-cubic-bezier,
|
||||
color .3s $--n-ease-in-out-cubic-bezier,
|
||||
background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
@include m(filterable) {
|
||||
padding-right: 36px;
|
||||
}
|
||||
@include m(selection) {
|
||||
line-height: 0;
|
||||
}
|
||||
@include e(ellipsis) {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
background-color: map-get($--data-table-header-background-color, 'default');
|
||||
border-color: map-get($--data-table-border-color, 'default');
|
||||
color: $--data-table-header-text-color;
|
||||
@include m(sortable) {
|
||||
@include once {
|
||||
cursor: pointer;
|
||||
@include e(ellipsis) {
|
||||
max-width: calc(100% - 18px);
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background-color: map-get($--data-table-header-background-color, 'hover');
|
||||
}
|
||||
}
|
||||
@include m(fixed-left) {
|
||||
left: 0;
|
||||
position: sticky;
|
||||
z-index: 2;
|
||||
&::after {
|
||||
content: "";
|
||||
pointer-events: none;
|
||||
width: 36px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -1px;
|
||||
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
||||
right: -36px;
|
||||
}
|
||||
}
|
||||
@include m(fixed-right) {
|
||||
right: 0;
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
&::before {
|
||||
content: "";
|
||||
pointer-events: none;
|
||||
width: 36px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -1px;
|
||||
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
||||
left: -36px;
|
||||
}
|
||||
}
|
||||
@include m(shadow-before) {
|
||||
&::before {
|
||||
box-shadow: inset -12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
}
|
||||
}
|
||||
@include m(shadow-after) {
|
||||
border-right-color: transparent !important;
|
||||
&::after {
|
||||
box-shadow: inset 12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include m(single-column) {
|
||||
@include b(data-table-wrapper) {
|
||||
@include b(data-table-table){
|
||||
@include b(data-table-tr) {
|
||||
@include b(data-table-td) {
|
||||
border-bottom: 0px solid map-get($--data-table-border-color, 'default') !important;
|
||||
&::after {
|
||||
bottom: 0 !important;
|
||||
}
|
||||
&::before {
|
||||
bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include not-m(single-line) {
|
||||
@include b(data-table-wrapper) {
|
||||
@include b(data-table-table){
|
||||
@include b(data-table-th) {
|
||||
border-right: 1px solid map-get($--data-table-border-color, 'default');
|
||||
&:last-child {
|
||||
border-right: 0px solid map-get($--data-table-border-color, 'default');
|
||||
}
|
||||
}
|
||||
@include b(data-table-td) {
|
||||
border-right: 1px solid map-get($--data-table-border-color, 'default');
|
||||
&:last-child {
|
||||
border-right: 0px solid map-get($--data-table-border-color, 'default');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include m(bordered) {
|
||||
@include b(data-table-wrapper) {
|
||||
overflow: hidden;
|
||||
border: 1px solid map-get($--data-table-border-color, 'default');
|
||||
border-bottom-left-radius: $--n-data-table-border-radius;
|
||||
border-bottom-right-radius: $--n-data-table-border-radius;
|
||||
@include b(data-table-table){
|
||||
@include b(data-table-tr) {
|
||||
&:last-child {
|
||||
@include b(data-table-td) {
|
||||
border-bottom: 0px solid map-get($--data-table-border-color, 'default');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include b(data-table-base-table) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@include b(scrollbar) {
|
||||
@include b(scrollbar-content) {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@include b(data-table-base-table-header) {
|
||||
@include once {
|
||||
flex-shrink: 0;
|
||||
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
&::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
scrollbar-width: none;
|
||||
@include b(data-table-table) {
|
||||
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
}
|
||||
}
|
||||
@include b(data-table-table) {
|
||||
border-bottom: 1px solid map-get($--data-table-border-color, 'default');
|
||||
}
|
||||
@include b(data-table-th) {
|
||||
@include b(data-table-sort-button) {
|
||||
@include once {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
margin-left: 4px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
@include e(asc-icon) {
|
||||
bottom: calc(50% - 2px);
|
||||
left: 0;
|
||||
}
|
||||
@include e(desc-icon) {
|
||||
top: calc(50% - 2px);
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
@include m(asc) {
|
||||
@include e(asc-icon) {
|
||||
fill: map-get($--data-table-button-color, 'active');
|
||||
}
|
||||
}
|
||||
@include m(desc) {
|
||||
@include e(desc-icon) {
|
||||
fill: map-get($--data-table-button-color, 'active');
|
||||
}
|
||||
}
|
||||
@include e(asc-icon, desc-icon) {
|
||||
@include once {
|
||||
transition: fill .3s $--n-ease-in-out-cubic-bezier;
|
||||
position: absolute;
|
||||
}
|
||||
fill: map-get($--data-table-button-color, 'default');
|
||||
}
|
||||
}
|
||||
@include b(data-table-filter-button) {
|
||||
@include once {
|
||||
position: absolute;
|
||||
z-index: auto;
|
||||
right: 0;
|
||||
width: 36px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
@include e(icon-wrapper) {
|
||||
@include once {
|
||||
position: absolute;
|
||||
z-index: auto;
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
}
|
||||
&:hover {
|
||||
background-color: map-get($--data-table-icon-button-background-color, 'hover');
|
||||
}
|
||||
@include b(icon) {
|
||||
@include once {
|
||||
font-size: 12px;
|
||||
}
|
||||
fill: map-get($--data-table-button-color, 'default');
|
||||
stroke: map-get($--data-table-button-color, 'default');
|
||||
}
|
||||
}
|
||||
@include m(popover-visible) {
|
||||
@include e(icon-wrapper) {
|
||||
background-color: map-get($--data-table-icon-button-background-color, 'hover');
|
||||
}
|
||||
}
|
||||
@include m(active) {
|
||||
@include e(icon-wrapper) {
|
||||
background-color: map-get($--data-table-icon-button-background-color, 'hover');
|
||||
@include b(icon) {
|
||||
fill: map-get($--data-table-button-color, 'active');
|
||||
stroke: map-get($--data-table-button-color, 'active');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include as-modal-content {
|
||||
@include b(data-table) {
|
||||
@include b(data-table-table) {
|
||||
background-color: map-get($--data-table-body-background-color, 'modal');
|
||||
@include b(data-table-thead) {
|
||||
background-color: map-get($--data-table-header-background-color, 'modal');
|
||||
}
|
||||
@include b(data-table-th) {
|
||||
border-color: map-get($--data-table-border-color, 'modal');
|
||||
background-color: map-get($--data-table-header-background-color, 'modal');
|
||||
@include m(sortable) {
|
||||
&:hover {
|
||||
background-color: map-get($--data-table-header-background-color, 'modal-hover');
|
||||
}
|
||||
}
|
||||
}
|
||||
@include b(data-table-tr) {
|
||||
&:hover {
|
||||
background-color: map-get($--data-table-row-background-color, 'modal-hover');
|
||||
@include b(data-table-td) {
|
||||
background-color: map-get($--data-table-row-background-color, 'modal-hover');
|
||||
}
|
||||
}
|
||||
}
|
||||
@include b(data-table-td) {
|
||||
border-color: map-get($--data-table-border-color, 'modal');
|
||||
background-color: map-get($--data-table-body-background-color, 'modal')
|
||||
}
|
||||
}
|
||||
@include not-m(single-line) {
|
||||
@include b(data-table-wrapper) {
|
||||
@include b(data-table-table){
|
||||
@include b(data-table-th) {
|
||||
border-right: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
&:last-child {
|
||||
border-right: 0px solid map-get($--data-table-border-color, 'modal');
|
||||
}
|
||||
}
|
||||
@include b(data-table-td) {
|
||||
border-right: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
&:last-child {
|
||||
border-right: 0px solid map-get($--data-table-border-color, 'modal');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include m(bordered) {
|
||||
@include b(data-table-wrapper) {
|
||||
border: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
@include b(data-table-table){
|
||||
@include b(data-table-tr) {
|
||||
&:last-child {
|
||||
@include b(data-table-td) {
|
||||
border-bottom: 0px solid map-get($--data-table-border-color, 'modal');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@include b(data-table-base-table-header) {
|
||||
@include b(data-table-table) {
|
||||
border-bottom: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// @include b(data-table) {
|
||||
// @include once {
|
||||
// // @include data-table-size-mixin();
|
||||
// width: 100%;
|
||||
// // font-size: 14px;
|
||||
// @include b(data-table-empty) {
|
||||
// margin: 16px 0 14px 0;
|
||||
// flex-grow: 1;
|
||||
// flex-shrink: 0;
|
||||
// opacity: 1;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: center;
|
||||
// transition: opacity .3s $--n-ease-in-out-cubic-bezier;
|
||||
// @include m(hide) {
|
||||
// opacity: 0;
|
||||
// }
|
||||
// }
|
||||
// @include e(pagination) {
|
||||
// margin-top: 24px;
|
||||
// display: flex;
|
||||
// justify-content: flex-end;
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-wrapper) {
|
||||
// @include once {
|
||||
// position: relative;
|
||||
// transition: border-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// border-top-left-radius: $--n-data-table-border-radius;
|
||||
// border-top-right-radius: $--n-data-table-border-radius;
|
||||
// overflow: hidden;
|
||||
// line-height: 1.75;
|
||||
// }
|
||||
// }
|
||||
// @include m(single-column) {
|
||||
// @include b(data-table-wrapper) {
|
||||
// @include b(data-table-table){
|
||||
// @include b(data-table-tr) {
|
||||
// @include b(data-table-td) {
|
||||
// border-bottom: 0px solid map-get($--data-table-border-color, 'default') !important;
|
||||
// &::after {
|
||||
// bottom: 0 !important;
|
||||
// }
|
||||
// &::before {
|
||||
// bottom: 0 !important;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include not-m(single-line) {
|
||||
// @include b(data-table-wrapper) {
|
||||
// @include b(data-table-table){
|
||||
// @include b(data-table-th) {
|
||||
// border-right: 1px solid map-get($--data-table-border-color, 'default');
|
||||
// &:last-child {
|
||||
// border-right: 0px solid map-get($--data-table-border-color, 'default');
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-td) {
|
||||
// border-right: 1px solid map-get($--data-table-border-color, 'default');
|
||||
// &:last-child {
|
||||
// border-right: 0px solid map-get($--data-table-border-color, 'default');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include m(bordered) {
|
||||
// @include b(data-table-wrapper) {
|
||||
// overflow: hidden;
|
||||
// border: 1px solid map-get($--data-table-border-color, 'default');
|
||||
// border-bottom-left-radius: $--n-data-table-border-radius;
|
||||
// border-bottom-right-radius: $--n-data-table-border-radius;
|
||||
// @include b(data-table-table){
|
||||
// @include b(data-table-tr) {
|
||||
// &:last-child {
|
||||
// @include b(data-table-td) {
|
||||
// border-bottom: 0px solid map-get($--data-table-border-color, 'default');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-base-table) {
|
||||
// @include b(scrollbar) {
|
||||
// @include b(scrollbar-content) {
|
||||
// overflow: visible;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-table) {
|
||||
// @include once {
|
||||
// font-variant-numeric: tabular-nums;
|
||||
// width: 100%;
|
||||
// word-wrap: break-word;
|
||||
// word-break: break-all;
|
||||
// table-layout: fixed;
|
||||
// transition: background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// border-collapse: separate;
|
||||
// border-spacing: 0;
|
||||
// }
|
||||
// background-color: map-get($--data-table-body-background-color, 'default');
|
||||
// @include b(data-table-thead) {
|
||||
// @include once {
|
||||
// transition: background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// }
|
||||
// background-color: map-get($--data-table-header-background-color, 'default');
|
||||
// }
|
||||
// @include b(data-table-tr) {
|
||||
// @include once {
|
||||
// box-sizing: border-box;
|
||||
// transition: background-color 0.3s $--n-ease-in-out-cubic-bezier;
|
||||
// background-clip: padding-box;
|
||||
// &:last-child {
|
||||
// @include b(data-table-td) {
|
||||
// &::after {
|
||||
// bottom: 0 !important;
|
||||
// }
|
||||
// &::before {
|
||||
// bottom: 0 !important;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// &:hover {
|
||||
// background-color: map-get($--data-table-row-background-color, 'hover');
|
||||
// @include b(data-table-td) {
|
||||
// background-color: map-get($--data-table-row-background-color, 'hover');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-td) {
|
||||
// @include once {
|
||||
// text-align: left;
|
||||
// box-sizing: border-box;
|
||||
// border: none;
|
||||
// transition:
|
||||
// box-shadow .3s $--n-ease-in-out-cubic-bezier,
|
||||
// background-color .3s $--n-ease-in-out-cubic-bezier,
|
||||
// border-color .3s $--n-ease-in-out-cubic-bezier,
|
||||
// color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// @include m(ellipsis) {
|
||||
// text-overflow: ellipsis;
|
||||
// overflow: hidden;
|
||||
// white-space: nowrap;
|
||||
// }
|
||||
// @include m(selection) {
|
||||
// line-height: 0;
|
||||
// }
|
||||
// @include m(fixed-left) {
|
||||
// left: 0;
|
||||
// position: sticky;
|
||||
// z-index: 2;
|
||||
// &::after {
|
||||
// pointer-events: none;
|
||||
// content: "";
|
||||
// width: 36px;
|
||||
// display: inline-block;
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// bottom: -1px;
|
||||
// transition: box-shadow .2s $--n-ease-in-out-cubic-bezier;
|
||||
// right: -36px;
|
||||
// }
|
||||
// }
|
||||
// @include m(fixed-right) {
|
||||
// right: 0;
|
||||
// position: sticky;
|
||||
// &::before {
|
||||
// pointer-events: none;
|
||||
// content: "";
|
||||
// width: 36px;
|
||||
// display: inline-block;
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// bottom: -1px;
|
||||
// transition: box-shadow .2s $--n-ease-in-out-cubic-bezier;
|
||||
// left: -36px;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// background-color: map-get($--data-table-body-background-color, 'default');
|
||||
// @include m(shadow-before) {
|
||||
// &::before {
|
||||
// box-shadow: inset -12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
// }
|
||||
// }
|
||||
// @include m(shadow-after) {
|
||||
// border-right-color: transparent !important;
|
||||
// &::after {
|
||||
// box-shadow: inset 12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
// }
|
||||
// }
|
||||
// color: $--data-table-body-text-color;
|
||||
// border-bottom: 1px solid map-get($--data-table-border-color, 'default');
|
||||
// }
|
||||
// @include b(data-table-th) {
|
||||
// @include once {
|
||||
// position: relative;
|
||||
// text-align: left;
|
||||
// font-weight: $--n-strong-weight;
|
||||
// box-sizing: border-box;
|
||||
// transition:
|
||||
// border-color .3s $--n-ease-in-out-cubic-bezier,
|
||||
// color .3s $--n-ease-in-out-cubic-bezier,
|
||||
// background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// @include m(filterable) {
|
||||
// padding-right: 36px;
|
||||
// }
|
||||
// @include m(selection) {
|
||||
// line-height: 0;
|
||||
// }
|
||||
// @include e(ellipsis) {
|
||||
// display: inline-block;
|
||||
// vertical-align: middle;
|
||||
// text-overflow: ellipsis;
|
||||
// overflow: hidden;
|
||||
// white-space: nowrap;
|
||||
// max-width: 100%;
|
||||
// }
|
||||
// }
|
||||
// background-color: map-get($--data-table-header-background-color, 'default');
|
||||
// border-color: map-get($--data-table-border-color, 'default');
|
||||
// color: $--data-table-header-text-color;
|
||||
// @include m(sortable) {
|
||||
// @include once {
|
||||
// cursor: pointer;
|
||||
// @include e(ellipsis) {
|
||||
// max-width: calc(100% - 18px);
|
||||
// }
|
||||
// }
|
||||
// &:hover {
|
||||
// background-color: map-get($--data-table-header-background-color, 'hover');
|
||||
// }
|
||||
// }
|
||||
// @include m(fixed-left) {
|
||||
// left: 0;
|
||||
// position: sticky;
|
||||
// z-index: 2;
|
||||
// &::after {
|
||||
// content: "";
|
||||
// pointer-events: none;
|
||||
// width: 36px;
|
||||
// display: inline-block;
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// bottom: -1px;
|
||||
// transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
||||
// right: -36px;
|
||||
// }
|
||||
// }
|
||||
// @include m(fixed-right) {
|
||||
// right: 0;
|
||||
// position: sticky;
|
||||
// z-index: 1;
|
||||
// &::before {
|
||||
// content: "";
|
||||
// pointer-events: none;
|
||||
// width: 36px;
|
||||
// display: inline-block;
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// bottom: -1px;
|
||||
// transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
||||
// left: -36px;
|
||||
// }
|
||||
// }
|
||||
// @include m(shadow-before) {
|
||||
// &::before {
|
||||
// box-shadow: inset -12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
// }
|
||||
// }
|
||||
// @include m(shadow-after) {
|
||||
// border-right-color: transparent !important;
|
||||
// &::after {
|
||||
// box-shadow: inset 12px 0 8px -12px $--data-table-fixed-column-box-shadow-color;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-base-table-header) {
|
||||
// @include once {
|
||||
// flex-shrink: 0;
|
||||
// transition: border-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// &::-webkit-scrollbar {
|
||||
// width: 0;
|
||||
// height: 0;
|
||||
// }
|
||||
// scrollbar-width: none;
|
||||
// @include b(data-table-table) {
|
||||
// transition: border-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-table) {
|
||||
// border-bottom: 1px solid map-get($--data-table-border-color, 'default');
|
||||
// }
|
||||
// @include b(data-table-th) {
|
||||
// @include b(data-table-sort-button) {
|
||||
// @include once {
|
||||
// height: 14px;
|
||||
// width: 14px;
|
||||
// margin-left: 4px;
|
||||
// position: relative;
|
||||
// display: inline-block;
|
||||
// vertical-align: middle;
|
||||
// @include e(asc-icon) {
|
||||
// bottom: calc(50% - 2px);
|
||||
// left: 0;
|
||||
// }
|
||||
// @include e(desc-icon) {
|
||||
// top: calc(50% - 2px);
|
||||
// left: 0;
|
||||
// }
|
||||
// }
|
||||
// @include m(asc) {
|
||||
// @include e(asc-icon) {
|
||||
// fill: map-get($--data-table-button-color, 'active');
|
||||
// }
|
||||
// }
|
||||
// @include m(desc) {
|
||||
// @include e(desc-icon) {
|
||||
// fill: map-get($--data-table-button-color, 'active');
|
||||
// }
|
||||
// }
|
||||
// @include e(asc-icon, desc-icon) {
|
||||
// @include once {
|
||||
// transition: fill .3s $--n-ease-in-out-cubic-bezier;
|
||||
// position: absolute;
|
||||
// }
|
||||
// fill: map-get($--data-table-button-color, 'default');
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-filter-button) {
|
||||
// @include once {
|
||||
// position: absolute;
|
||||
// z-index: auto;
|
||||
// right: 0;
|
||||
// width: 36px;
|
||||
// top: 0;
|
||||
// bottom: 0;
|
||||
// cursor: pointer;
|
||||
// }
|
||||
// @include e(icon-wrapper) {
|
||||
// @include once {
|
||||
// position: absolute;
|
||||
// z-index: auto;
|
||||
// right: 0;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// bottom: 0;
|
||||
// display: flex;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
// transition: background-color .3s $--n-ease-in-out-cubic-bezier;
|
||||
// }
|
||||
// &:hover {
|
||||
// background-color: map-get($--data-table-icon-button-background-color, 'hover');
|
||||
// }
|
||||
// @include b(icon) {
|
||||
// @include once {
|
||||
// font-size: 12px;
|
||||
// }
|
||||
// fill: map-get($--data-table-button-color, 'default');
|
||||
// stroke: map-get($--data-table-button-color, 'default');
|
||||
// }
|
||||
// }
|
||||
// @include m(popover-visible) {
|
||||
// @include e(icon-wrapper) {
|
||||
// background-color: map-get($--data-table-icon-button-background-color, 'hover');
|
||||
// }
|
||||
// }
|
||||
// @include m(active) {
|
||||
// @include e(icon-wrapper) {
|
||||
// background-color: map-get($--data-table-icon-button-background-color, 'hover');
|
||||
// @include b(icon) {
|
||||
// fill: map-get($--data-table-button-color, 'active');
|
||||
// stroke: map-get($--data-table-button-color, 'active');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include as-modal-content {
|
||||
// @include b(data-table) {
|
||||
// @include b(data-table-table) {
|
||||
// background-color: map-get($--data-table-body-background-color, 'modal');
|
||||
// @include b(data-table-thead) {
|
||||
// background-color: map-get($--data-table-header-background-color, 'modal');
|
||||
// }
|
||||
// @include b(data-table-th) {
|
||||
// border-color: map-get($--data-table-border-color, 'modal');
|
||||
// background-color: map-get($--data-table-header-background-color, 'modal');
|
||||
// @include m(sortable) {
|
||||
// &:hover {
|
||||
// background-color: map-get($--data-table-header-background-color, 'modal-hover');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-tr) {
|
||||
// &:hover {
|
||||
// background-color: map-get($--data-table-row-background-color, 'modal-hover');
|
||||
// @include b(data-table-td) {
|
||||
// background-color: map-get($--data-table-row-background-color, 'modal-hover');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-td) {
|
||||
// border-color: map-get($--data-table-border-color, 'modal');
|
||||
// background-color: map-get($--data-table-body-background-color, 'modal')
|
||||
// }
|
||||
// }
|
||||
// @include not-m(single-line) {
|
||||
// @include b(data-table-wrapper) {
|
||||
// @include b(data-table-table){
|
||||
// @include b(data-table-th) {
|
||||
// border-right: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
// &:last-child {
|
||||
// border-right: 0px solid map-get($--data-table-border-color, 'modal');
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-td) {
|
||||
// border-right: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
// &:last-child {
|
||||
// border-right: 0px solid map-get($--data-table-border-color, 'modal');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include m(bordered) {
|
||||
// @include b(data-table-wrapper) {
|
||||
// border: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
// @include b(data-table-table){
|
||||
// @include b(data-table-tr) {
|
||||
// &:last-child {
|
||||
// @include b(data-table-td) {
|
||||
// border-bottom: 0px solid map-get($--data-table-border-color, 'modal');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// @include b(data-table-base-table-header) {
|
||||
// @include b(data-table-table) {
|
||||
// border-bottom: 1px solid map-get($--data-table-border-color, 'modal');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@include b(data-table-filter-menu) {
|
||||
@include b(scrollbar) {
|
||||
max-height: 240px;
|
||||
}
|
||||
@include e(group) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px 12px 0 12px;
|
||||
@include b(checkbox) {
|
||||
margin-bottom: 12px;
|
||||
margin-right: 0;
|
||||
}
|
||||
@include b(radio) {
|
||||
margin-bottom: 12px;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
@include b(divider) {
|
||||
margin: 0;
|
||||
}
|
||||
@include e(action) {
|
||||
padding: 8px 12px;
|
||||
display: flex;
|
||||
flex-wrap: no-wrap;
|
||||
justify-content: space-evenly;
|
||||
@include b(button) {
|
||||
&:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// @include b(data-table-filter-menu) {
|
||||
// @include b(scrollbar) {
|
||||
// max-height: 240px;
|
||||
// }
|
||||
// @include e(group) {
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// padding: 12px 12px 0 12px;
|
||||
// @include b(checkbox) {
|
||||
// margin-bottom: 12px;
|
||||
// margin-right: 0;
|
||||
// }
|
||||
// @include b(radio) {
|
||||
// margin-bottom: 12px;
|
||||
// margin-right: 0;
|
||||
// }
|
||||
// }
|
||||
// @include b(divider) {
|
||||
// margin: 0;
|
||||
// }
|
||||
// @include e(action) {
|
||||
// padding: 8px 12px;
|
||||
// display: flex;
|
||||
// flex-wrap: no-wrap;
|
||||
// justify-content: space-evenly;
|
||||
// @include b(button) {
|
||||
// &:not(:last-child) {
|
||||
// margin-right: 8px;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
@ -1,6 +1,6 @@
|
||||
@import "./base.scss";
|
||||
|
||||
// don't use ~vue-virtual-scroller, if so rollup not working
|
||||
// don't use ~vue-virtual-scroller, if so rollup won't work
|
||||
@import '../../node_modules/vue-virtual-scroller/dist/vue-virtual-scroller';
|
||||
|
||||
@import "./BaseLoading.scss";
|
||||
@ -50,7 +50,6 @@
|
||||
@import './List.scss';
|
||||
@import './Layout.scss';
|
||||
@import "./Popover.scss";
|
||||
@import "./DataTable.scss";
|
||||
@import "./Confirm.scss";
|
||||
@import "./Modal.scss";
|
||||
@import "./Result.scss";
|
||||
|
@ -82,8 +82,8 @@ export function read (color) {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {[number, number, number]} base
|
||||
* @param {[number, number, number, number]} overlay
|
||||
* @param {string | [number, number, number]} base
|
||||
* @param {string | [number, number, number, number]} overlay
|
||||
*/
|
||||
export function composite (base, overlay) {
|
||||
if (!Array.isArray(base)) base = read(base)
|
||||
|
@ -29,6 +29,12 @@ function insideFormItem (status, style) {
|
||||
])
|
||||
}
|
||||
|
||||
function insideModal (style) {
|
||||
return c(`${prefix}modal-content, ${prefix}drawer`, [
|
||||
style
|
||||
])
|
||||
}
|
||||
|
||||
function cTB (selector, ...rest) {
|
||||
return cB(selector, [
|
||||
c(
|
||||
@ -47,4 +53,4 @@ function cTB (selector, ...rest) {
|
||||
])
|
||||
}
|
||||
|
||||
export { c, cTB, cB, cE, cM, cNotM, insideFormItem, namespace }
|
||||
export { c, cTB, cB, cE, cM, cNotM, insideFormItem, insideModal, namespace }
|
||||
|
@ -64,6 +64,7 @@
|
||||
<script>
|
||||
import withapp from '../../_mixins/withapp'
|
||||
import themeable from '../../_mixins/themeable'
|
||||
import usecssr from '../../_mixins/usecssr'
|
||||
import locale from '../../_mixins/locale'
|
||||
import { setCheckStatusOfRow, createRowKey } from './utils'
|
||||
import BaseTable from './BaseTable.vue'
|
||||
@ -71,6 +72,7 @@ import NEmpty from '../../Empty'
|
||||
import NPagination from '../../Pagination'
|
||||
import formatLength from '../../_utils/css/formatLength'
|
||||
import isPlainObject from 'lodash-es/isPlainObject'
|
||||
import styles from './styles'
|
||||
|
||||
function createShallowClonedObject (object) {
|
||||
if (!object) return object
|
||||
@ -131,7 +133,12 @@ export default {
|
||||
NEmpty,
|
||||
NPagination
|
||||
},
|
||||
mixins: [ withapp, themeable, locale('DataTable') ],
|
||||
mixins: [
|
||||
withapp,
|
||||
themeable,
|
||||
usecssr(styles),
|
||||
locale('DataTable')
|
||||
],
|
||||
provide () {
|
||||
return {
|
||||
NDataTable: this
|
||||
|
11
src/data-table/src/styles/index.js
Normal file
11
src/data-table/src/styles/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
import themedBaseStyle from './themed-base.cssr.js'
|
||||
|
||||
export default [
|
||||
{
|
||||
key: 'syntheticTheme',
|
||||
watch: [
|
||||
'syntheticTheme'
|
||||
],
|
||||
CNode: themedBaseStyle
|
||||
}
|
||||
]
|
544
src/data-table/src/styles/themed-base.cssr.js
Normal file
544
src/data-table/src/styles/themed-base.cssr.js
Normal file
@ -0,0 +1,544 @@
|
||||
import { c, cTB, cB, cE, cM, cNotM, insideModal } from '../../../_utils/cssr'
|
||||
|
||||
export default c([
|
||||
({ props }) => {
|
||||
const { easeInOutCubicBezier } = props.$base
|
||||
const { borderRadius } = props.$local
|
||||
const {
|
||||
borderColor,
|
||||
bodyHoverBackgroundColor,
|
||||
headerBackgroundColor,
|
||||
headerHoverBackgroundColor,
|
||||
bodyBackgroundColor,
|
||||
bodyTextColor,
|
||||
headerTextColor,
|
||||
headerFontWeight,
|
||||
headerButtonHoverBackgroundColor,
|
||||
headerButtonIconColor,
|
||||
headerButtonIconActiveColor,
|
||||
fixedColumnBoxShadowColor
|
||||
} = props.$local.default
|
||||
const fixedColumnStyle = createFixedColumnStyle({ easeInOutCubicBezier, fixedColumnBoxShadowColor })
|
||||
return [
|
||||
createSizeStyle(props),
|
||||
cTB('data-table', {
|
||||
width: '100%'
|
||||
}, [
|
||||
cB('data-table-empty', {
|
||||
raw: `
|
||||
margin: 16px 0 14px 0;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 0;
|
||||
opacity: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: opacity .3s ${easeInOutCubicBezier};
|
||||
`
|
||||
}, [
|
||||
cM('hide', {
|
||||
opacity: 0
|
||||
})
|
||||
]),
|
||||
cE('pagination', {
|
||||
raw: `
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
`
|
||||
}),
|
||||
cB('data-table-wrapper', {
|
||||
raw: `
|
||||
position: relative;
|
||||
transition: border-color .3s ${easeInOutCubicBezier};
|
||||
border-top-left-radius: ${borderRadius};
|
||||
border-top-right-radius: ${borderRadius};
|
||||
overflow: hidden;
|
||||
line-height: 1.75;
|
||||
`
|
||||
}),
|
||||
cM('single-column', [
|
||||
cB('data-table-wrapper', [
|
||||
cB('data-table-table', [
|
||||
cB('data-table-tr', [
|
||||
cB('data-table-td', {
|
||||
borderBottom: `0 solid ${borderColor}`
|
||||
}, [
|
||||
c('&::after, &::before', {
|
||||
bottom: '0 !important'
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
cNotM('single-line', [
|
||||
cB('data-table-wrapper', [
|
||||
cB('data-table-table', [
|
||||
cB('data-table-th', {
|
||||
borderRight: `1px solid ${borderColor}`
|
||||
}, [
|
||||
cB('&:last-child', {
|
||||
borderRight: `0 solid ${borderColor}`
|
||||
})
|
||||
]),
|
||||
cB('data-table-td', {
|
||||
borderRight: `1px solid ${borderColor}`
|
||||
}, [
|
||||
cB('&:last-child', {
|
||||
borderRight: `0 solid ${borderColor}`
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
cM('bordered', [
|
||||
cB('data-table-wrapper', {
|
||||
overflow: 'hidden',
|
||||
border: `1px solid ${borderColor}`,
|
||||
borderBottomLeftRadius: borderRadius,
|
||||
borderBottomRightRadius: borderRadius
|
||||
}, [
|
||||
cB('data-table-table', [
|
||||
cB('data-table-tr', [
|
||||
c('&:last-child', [
|
||||
cB('data-table-td', {
|
||||
borderBottom: `0 solid ${borderColor}`
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
cB('data-table-base-table', [
|
||||
cB('scrollbar', [
|
||||
cB('scrollbar-content', {
|
||||
overflow: 'visible'
|
||||
})
|
||||
])
|
||||
]),
|
||||
cB('data-table-table', {
|
||||
raw: `
|
||||
font-variant-numeric: tabular-nums;
|
||||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
table-layout: fixed;
|
||||
transition: background-color .3s ${easeInOutCubicBezier};
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
background-color: ${bodyBackgroundColor}
|
||||
`
|
||||
}, [
|
||||
cB('data-table-thead', {
|
||||
transition: `background-color .3s ${easeInOutCubicBezier}`,
|
||||
backgroundColor: headerBackgroundColor
|
||||
}),
|
||||
cB('data-table-tr', {
|
||||
boxSizing: 'border-box',
|
||||
backgroundClip: 'padding-box',
|
||||
transition: `background-color .3s ${easeInOutCubicBezier}`
|
||||
}, [
|
||||
c('&:last-child', [
|
||||
cB('data-table-td', [
|
||||
c('&::after', {
|
||||
bottom: '0 !important'
|
||||
}),
|
||||
c('&::before', {
|
||||
bottom: '0 !important'
|
||||
})
|
||||
])
|
||||
]),
|
||||
c('&:hover', {
|
||||
backgroundColor: bodyHoverBackgroundColor
|
||||
}, [
|
||||
cB('data-table-td', {
|
||||
backgroundColor: bodyHoverBackgroundColor
|
||||
})
|
||||
])
|
||||
]),
|
||||
cB('data-table-th', {
|
||||
position: 'relative',
|
||||
textAlign: 'start',
|
||||
fontWeight: headerFontWeight,
|
||||
boxSizing: 'border-box',
|
||||
backgroundColor: headerBackgroundColor,
|
||||
borderColor: borderColor,
|
||||
color: headerTextColor,
|
||||
transition: `
|
||||
border-color .3s ${easeInOutCubicBezier},
|
||||
color .3s ${easeInOutCubicBezier},
|
||||
background-color .3s ${easeInOutCubicBezier};
|
||||
`
|
||||
}, [
|
||||
cM('filterable', {
|
||||
paddingRight: '36px'
|
||||
}),
|
||||
cM('selection', {
|
||||
lineHeight: 0
|
||||
}),
|
||||
cM('ellipsis', {
|
||||
raw: `
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
`
|
||||
}),
|
||||
cM('sortable', {
|
||||
cursor: 'pointer'
|
||||
}, [
|
||||
cE('ellipsis', {
|
||||
maxWidth: 'calc(100% - 18px)'
|
||||
}),
|
||||
c('&:hover', {
|
||||
backgroundColor: headerHoverBackgroundColor
|
||||
})
|
||||
]),
|
||||
fixedColumnStyle
|
||||
]),
|
||||
cB('data-table-td', {
|
||||
raw: `
|
||||
text-align: start;
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
background-color: ${bodyBackgroundColor};
|
||||
color: ${bodyTextColor};
|
||||
border-bottom: 1px solid ${borderColor};
|
||||
transition:
|
||||
box-shadow .3s ${easeInOutCubicBezier},
|
||||
background-color .3s ${easeInOutCubicBezier},
|
||||
border-color .3s ${easeInOutCubicBezier},
|
||||
color .3s ${easeInOutCubicBezier};
|
||||
`
|
||||
}, [
|
||||
cM('ellipsis', {
|
||||
raw: `
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
`
|
||||
}),
|
||||
cM('selection', {
|
||||
lineHeight: 0
|
||||
}),
|
||||
fixedColumnStyle
|
||||
])
|
||||
]),
|
||||
cB('data-table-base-table-header', {
|
||||
flexShrink: 0,
|
||||
transition: `border-color .3s ${easeInOutCubicBezier}`,
|
||||
scrollbarWidth: 'none'
|
||||
}, [
|
||||
c('&::-webkit-scrollbar', {
|
||||
width: 0,
|
||||
height: 0
|
||||
}),
|
||||
cB('data-table-table', {
|
||||
borderBottom: `1px solid ${borderColor}`,
|
||||
transition: `border-color .3s ${easeInOutCubicBezier}`
|
||||
}),
|
||||
cB('data-table-th', [
|
||||
cB('data-table-sort-button', {
|
||||
height: '14px',
|
||||
width: '14px',
|
||||
marginLeft: '4px',
|
||||
position: 'relative',
|
||||
display: 'inline-block',
|
||||
verticalAlign: 'middle'
|
||||
}, [
|
||||
cE('asc-icon', {
|
||||
bottom: 'calc(50% - 2px)',
|
||||
left: 0
|
||||
}),
|
||||
cE('desc-icon', {
|
||||
top: 'calc(50% - 2px)',
|
||||
left: 0
|
||||
}),
|
||||
cM('asc', [
|
||||
cE('asc-icon', {
|
||||
fill: headerButtonIconActiveColor
|
||||
})
|
||||
]),
|
||||
cM('desc', [
|
||||
cE('desc-icon', {
|
||||
fill: headerButtonIconActiveColor
|
||||
})
|
||||
]),
|
||||
cE('asc-icon, desc-icon', {
|
||||
transition: `fill .3s ${easeInOutCubicBezier}`,
|
||||
fill: headerButtonIconColor,
|
||||
position: 'absolute'
|
||||
})
|
||||
]),
|
||||
cB('data-table-filter-button', {
|
||||
raw: `
|
||||
position: absolute;
|
||||
z-index: auto;
|
||||
right: 0;
|
||||
width: 36px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
cursor: pointer;
|
||||
`
|
||||
}, [
|
||||
cE('icon-wrapper', {
|
||||
raw: `
|
||||
position: absolute;
|
||||
z-index: auto;
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
`,
|
||||
transition: `background-color .3s ${easeInOutCubicBezier}`
|
||||
}, [
|
||||
c('&:hover', {
|
||||
backgroundColor: headerButtonHoverBackgroundColor
|
||||
}),
|
||||
cB('icon', {
|
||||
fontSize: '12px',
|
||||
fill: headerButtonIconColor,
|
||||
stroke: headerButtonIconColor
|
||||
})
|
||||
]),
|
||||
cM('popover-visible', [
|
||||
cE('icon-wrapper', {
|
||||
backgroundColor: headerButtonHoverBackgroundColor
|
||||
})
|
||||
]),
|
||||
cM('active', [
|
||||
cE('icon-wrapper', {
|
||||
backgroundColor: headerButtonHoverBackgroundColor
|
||||
}, [
|
||||
cB('icon', {
|
||||
fill: headerButtonIconActiveColor,
|
||||
stroke: headerButtonIconActiveColor
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
cB('data-table-filter-menu', [
|
||||
cB('scrollbar', {
|
||||
maxHeight: '240px'
|
||||
}),
|
||||
cE('group', {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
padding: '12px 12px 0 12px'
|
||||
}, [
|
||||
cB('checkbox', {
|
||||
marginBottom: '12px',
|
||||
marginRight: 0
|
||||
}),
|
||||
cB('radio', {
|
||||
marginBottom: '12px',
|
||||
marginRight: 0
|
||||
})
|
||||
]),
|
||||
cE('action', {
|
||||
padding: '8px 12px',
|
||||
display: 'flex',
|
||||
flexWrap: 'nowrap',
|
||||
justifyContent: 'space-evenly'
|
||||
}, [
|
||||
cB('button', [
|
||||
c('&:not(:last-child)', {
|
||||
marginRight: '8px'
|
||||
})
|
||||
])
|
||||
]),
|
||||
cB('divider', {
|
||||
margin: 0
|
||||
})
|
||||
]),
|
||||
createStyleInsideModal(props)
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
function createStyleInsideModal (props) {
|
||||
const {
|
||||
bodyBackgroundColor,
|
||||
headerBackgroundColor,
|
||||
borderColor,
|
||||
headerHoverBackgroundColor,
|
||||
bodyHoverBackgroundColor
|
||||
} = props.$local.modal
|
||||
return insideModal(cTB('data-table', [
|
||||
cB('data-table-table', {
|
||||
backgroundColor: bodyBackgroundColor
|
||||
}, [
|
||||
cB('data-table-thead', {
|
||||
backgroundColor: headerBackgroundColor
|
||||
}),
|
||||
cB('data-table-th', {
|
||||
borderColor: borderColor,
|
||||
backgroundColor: headerBackgroundColor
|
||||
}, [
|
||||
cM('sortable', [
|
||||
c('&:hover', {
|
||||
backgroundColor: headerHoverBackgroundColor
|
||||
})
|
||||
])
|
||||
]),
|
||||
cB('data-table-tr', [
|
||||
c('&:hover', {
|
||||
backgroundColor: bodyHoverBackgroundColor
|
||||
}, [
|
||||
cB('data-table-td', {
|
||||
backgroundColor: bodyHoverBackgroundColor
|
||||
})
|
||||
])
|
||||
]),
|
||||
cB('data-table-td', {
|
||||
borderColor: borderColor,
|
||||
backgroundColor: bodyBackgroundColor
|
||||
})
|
||||
]),
|
||||
cNotM('single-line', [
|
||||
cB('data-table-wrapper', [
|
||||
cB('data-table-table', [
|
||||
cB('data-table-th', {
|
||||
borderRight: `1px solid ${borderColor}`
|
||||
}, [
|
||||
c('&:last-child', {
|
||||
borderRight: `0 solid ${borderColor}`
|
||||
})
|
||||
]),
|
||||
cB('data-table-td', {
|
||||
borderRight: `1px solid ${borderColor}`
|
||||
}, [
|
||||
c('&:last-child', {
|
||||
borderRight: `0 solid ${borderColor}`
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
cM('bordered', [
|
||||
cB('data-table-wrapper', {
|
||||
border: `1px solid ${borderColor}`
|
||||
}, [
|
||||
cB('data-table-table', [
|
||||
cB('data-table-tr', [
|
||||
c('&:last-child', [
|
||||
cB('data-table-td', {
|
||||
borderBottom: `0 solid ${borderColor}`
|
||||
})
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
cB('data-table-base-table-header', [
|
||||
cB('data-table-table', {
|
||||
borderBottom: `1px solid ${borderColor}`
|
||||
})
|
||||
])
|
||||
]))
|
||||
}
|
||||
|
||||
function createSizeStyle (props) {
|
||||
const {
|
||||
smallFontSize,
|
||||
mediumFontSize,
|
||||
largeFontSize
|
||||
} = props.$local
|
||||
return cTB('data-table', [
|
||||
cM('small-size', {
|
||||
fontSize: smallFontSize
|
||||
}, [
|
||||
cB('data-table-th', {
|
||||
padding: '5px 5px 5px 11px'
|
||||
}),
|
||||
cB('data-table-td', {
|
||||
padding: '5px 5px 5px 11px'
|
||||
})
|
||||
]),
|
||||
cM('medium-size', {
|
||||
fontSize: mediumFontSize
|
||||
}, [
|
||||
cB('data-table-th', {
|
||||
padding: '10px 10px 10px 16px'
|
||||
}),
|
||||
cB('data-table-td', {
|
||||
padding: '10px 10px 10px 16px'
|
||||
})
|
||||
]),
|
||||
cM('large-size', {
|
||||
fontSize: largeFontSize
|
||||
}, [
|
||||
cB('data-table-th', {
|
||||
padding: '15px 15px 15px 20px'
|
||||
}),
|
||||
cB('data-table-td', {
|
||||
padding: '15px 15px 15px 20px'
|
||||
})
|
||||
])
|
||||
])
|
||||
}
|
||||
|
||||
function createFixedColumnStyle ({
|
||||
easeInOutCubicBezier,
|
||||
fixedColumnBoxShadowColor
|
||||
}) {
|
||||
return [
|
||||
cM('fixed-left', {
|
||||
left: 0,
|
||||
position: 'sticky',
|
||||
zIndex: 2
|
||||
}, [
|
||||
c('&::after', {
|
||||
raw: `
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
width: 36px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -1px;
|
||||
transition: box-shadow .2s ${easeInOutCubicBezier};
|
||||
right: -36px;
|
||||
`
|
||||
})
|
||||
]),
|
||||
cM('fixed-right', {
|
||||
right: 0,
|
||||
position: 'sticky',
|
||||
zIndex: 1
|
||||
}, [
|
||||
c('&::before', {
|
||||
raw: `
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
width: 36px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -1px;
|
||||
transition: box-shadow .2s ${easeInOutCubicBezier};
|
||||
left: -36px;
|
||||
`
|
||||
})
|
||||
]),
|
||||
cM('shadow-before', [
|
||||
c('&::before', {
|
||||
boxShadow: `inset -12px 0 8px -12px ${fixedColumnBoxShadowColor}`
|
||||
})
|
||||
]),
|
||||
cM('shadow-after', [
|
||||
c('&::after', {
|
||||
boxShadow: `inset 12px 0 8px -12px ${fixedColumnBoxShadowColor}`
|
||||
})
|
||||
])
|
||||
]
|
||||
}
|
7
src/data-table/styles/_common.js
Normal file
7
src/data-table/styles/_common.js
Normal file
@ -0,0 +1,7 @@
|
||||
export default {
|
||||
fontSize: {
|
||||
small: '14px',
|
||||
medium: '14px',
|
||||
large: '15px'
|
||||
}
|
||||
}
|
56
src/data-table/styles/dark.js
Normal file
56
src/data-table/styles/dark.js
Normal file
@ -0,0 +1,56 @@
|
||||
import create from '../../styles/_utils/create-component-base'
|
||||
import { composite } from '../../_utils/color'
|
||||
import commonVariables from './_common'
|
||||
|
||||
export default create({
|
||||
theme: 'dark',
|
||||
name: 'DataTable',
|
||||
getDerivedVariables ({ base, derived }) {
|
||||
const {
|
||||
strongFontWeight,
|
||||
borderRadius
|
||||
} = base
|
||||
const {
|
||||
cardBackgroundColor,
|
||||
modalBackgroundColor,
|
||||
dividerOverlayColor,
|
||||
secondaryTextColor,
|
||||
primaryTextColor,
|
||||
tableHeaderBackgroundOverlayColor,
|
||||
tablePendingBackgroundOverlayColor,
|
||||
iconOverlayColor,
|
||||
primaryColor
|
||||
} = derived
|
||||
return {
|
||||
...commonVariables,
|
||||
borderRadius,
|
||||
default: {
|
||||
borderColor: composite(cardBackgroundColor, dividerOverlayColor),
|
||||
bodyHoverBackgroundColor: composite(cardBackgroundColor, tablePendingBackgroundOverlayColor),
|
||||
headerBackgroundColor: composite(cardBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
headerHoverBackgroundColor: composite(
|
||||
composite(cardBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
tableHeaderBackgroundOverlayColor
|
||||
),
|
||||
bodyBackgroundColor: cardBackgroundColor,
|
||||
bodyTextColor: secondaryTextColor,
|
||||
headerTextColor: primaryTextColor,
|
||||
headerFontWeight: strongFontWeight,
|
||||
headerButtonHoverBackgroundColor: tablePendingBackgroundOverlayColor,
|
||||
headerButtonIconColor: iconOverlayColor,
|
||||
headerButtonIconActiveColor: primaryColor,
|
||||
fixedColumnBoxShadowColor: 'rgba(0, 0, 0, .36)'
|
||||
},
|
||||
modal: {
|
||||
borderColor: composite(modalBackgroundColor, dividerOverlayColor),
|
||||
bodyHoverBackgroundColor: composite(modalBackgroundColor, tablePendingBackgroundOverlayColor),
|
||||
headerBackgroundColor: composite(modalBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
headerHoverBackgroundColor: composite(
|
||||
composite(modalBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
tableHeaderBackgroundOverlayColor
|
||||
),
|
||||
bodyBackgroundColor: modalBackgroundColor
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
56
src/data-table/styles/light.js
Normal file
56
src/data-table/styles/light.js
Normal file
@ -0,0 +1,56 @@
|
||||
import create from '../../styles/_utils/create-component-base'
|
||||
import { composite } from '../../_utils/color'
|
||||
import commonVariables from './_common'
|
||||
|
||||
export default create({
|
||||
theme: 'light',
|
||||
name: 'DataTable',
|
||||
getDerivedVariables ({ base, derived }) {
|
||||
const {
|
||||
strongFontWeight,
|
||||
borderRadius
|
||||
} = base
|
||||
const {
|
||||
cardBackgroundColor,
|
||||
modalBackgroundColor,
|
||||
dividerOverlayColor,
|
||||
secondaryTextColor,
|
||||
primaryTextColor,
|
||||
tableHeaderBackgroundOverlayColor,
|
||||
tablePendingBackgroundOverlayColor,
|
||||
iconOverlayColor,
|
||||
primaryColor
|
||||
} = derived
|
||||
return {
|
||||
...commonVariables,
|
||||
borderRadius,
|
||||
default: {
|
||||
borderColor: composite(cardBackgroundColor, dividerOverlayColor),
|
||||
bodyHoverBackgroundColor: composite(cardBackgroundColor, tablePendingBackgroundOverlayColor),
|
||||
headerBackgroundColor: composite(cardBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
headerHoverBackgroundColor: composite(
|
||||
composite(cardBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
tableHeaderBackgroundOverlayColor
|
||||
),
|
||||
bodyBackgroundColor: cardBackgroundColor,
|
||||
bodyTextColor: secondaryTextColor,
|
||||
headerTextColor: primaryTextColor,
|
||||
headerFontWeight: strongFontWeight,
|
||||
headerButtonHoverBackgroundColor: tablePendingBackgroundOverlayColor,
|
||||
headerButtonIconColor: iconOverlayColor,
|
||||
headerButtonIconActiveColor: primaryColor,
|
||||
fixedColumnBoxShadowColor: 'rgba(0, 0, 0, .18)'
|
||||
},
|
||||
modal: {
|
||||
borderColor: composite(modalBackgroundColor, dividerOverlayColor),
|
||||
bodyHoverBackgroundColor: composite(modalBackgroundColor, tablePendingBackgroundOverlayColor),
|
||||
headerBackgroundColor: composite(modalBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
headerHoverBackgroundColor: composite(
|
||||
composite(modalBackgroundColor, tableHeaderBackgroundOverlayColor),
|
||||
tableHeaderBackgroundOverlayColor
|
||||
),
|
||||
bodyBackgroundColor: modalBackgroundColor
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
@ -10,7 +10,7 @@
|
||||
<div
|
||||
class="n-drawer-container"
|
||||
>
|
||||
<transition name="n-drawer-overlay-transition">
|
||||
<transition name="n-fade-in-transition">
|
||||
<div
|
||||
v-if="active"
|
||||
class="n-drawer-overlay"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { c, cTB, cM } from '../../../_utils/cssr'
|
||||
import { c, cTB, cB, cM } from '../../../_utils/cssr'
|
||||
import slideInFromRightTransition from '../../../styles/_transitions/slide-in-from-right'
|
||||
import slideInFromLeftTransition from '../../../styles/_transitions/slide-in-from-left'
|
||||
import slideInFromTopTransition from '../../../styles/_transitions/slide-in-from-top'
|
||||
@ -60,7 +60,7 @@ export default c([
|
||||
`
|
||||
})
|
||||
]),
|
||||
cTB('drawer-overlay', {
|
||||
cB('drawer-overlay', {
|
||||
raw: `
|
||||
background-color: rgba(0, 0, 0, .3);
|
||||
position: absolute;
|
||||
@ -71,7 +71,7 @@ export default c([
|
||||
pointer-events: all;
|
||||
`
|
||||
}),
|
||||
c('drawer-overlay', {
|
||||
cB('drawer-overlay', {
|
||||
raw: `
|
||||
background-color: rgba(0, 0, 0, .3);
|
||||
position: absolute;
|
||||
@ -83,12 +83,11 @@ export default c([
|
||||
`
|
||||
}, [
|
||||
fadeInTransition({
|
||||
name: 'drawer-overlay',
|
||||
enterDuration: '0.3s',
|
||||
leaveDuration: '0.3s'
|
||||
})
|
||||
]),
|
||||
c('darwer-container', {
|
||||
cB('darwer-container', {
|
||||
raw: `
|
||||
position: absolute;
|
||||
left: 0;
|
||||
|
@ -95,12 +95,14 @@ import dynamicTagsLightStyle from './dynamic-tags/styles/light'
|
||||
import dynamicTagsDarkStyle from './dynamic-tags/styles/dark'
|
||||
import alertLightStyle from './alert/styles/light'
|
||||
import alertDarkStyle from './alert/styles/dark'
|
||||
import avatarDarkStyle from './avatar/styles/dark'
|
||||
import avatarLightStyle from './avatar/styles/light'
|
||||
import avatarDarkStyle from './avatar/styles/dark'
|
||||
import affixLightStyle from './affix/styles/light'
|
||||
import affixDarkStyle from './affix/styles/dark'
|
||||
import drawerDarkStyle from './drawer/styles/dark'
|
||||
import drawerLightStyle from './drawer/styles/light'
|
||||
import drawerDarkStyle from './drawer/styles/dark'
|
||||
import dataTableLightStyle from './data-table/styles/light'
|
||||
import dataTableDarkStyle from './data-table/styles/dark'
|
||||
|
||||
// Can be remove after refactoring
|
||||
import baseSelectionLightStyle from './_base/selection/styles/light'
|
||||
@ -224,6 +226,8 @@ export default create({
|
||||
affixDarkStyle,
|
||||
drawerDarkStyle,
|
||||
drawerLightStyle,
|
||||
dataTableLightStyle,
|
||||
dataTableDarkStyle,
|
||||
// Can be remove after refactoring
|
||||
baseSelectionLightStyle,
|
||||
baseSelectionDarkStyle
|
||||
|
@ -17,12 +17,10 @@ export default function ({
|
||||
c(`&.${namespace}-${name}-transition-leave-active`, {
|
||||
transition: `all ${leaveDuration} ${easeInOutCubicBezier}!important`
|
||||
}),
|
||||
c(`&.${namespace}-${name}-transition-enter,
|
||||
&.${namespace}-${name}-transiton-leave-to`, {
|
||||
c(`&.${namespace}-${name}-transition-enter, &.${namespace}-${name}-transition-leave-to`, {
|
||||
opacity: 0
|
||||
}),
|
||||
c(`&.${namespace}-${name}-transition-enter-to,
|
||||
&.${namespace}-${name}-transition-leave`, {
|
||||
c(`&.${namespace}-${name}-transition-enter-to, &.${namespace}-${name}-transition-leave`, {
|
||||
opacity: 1
|
||||
})
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user