Select / Cascader: add chalk theme (#7109)

* Select & Cascader: add chalk theme

* Select / Cascader: fix test
This commit is contained in:
Black Wayne 2017-09-21 10:55:46 +08:00 committed by 杨奕
parent 1912c473ef
commit 31b9429edf
10 changed files with 83 additions and 33 deletions

View File

@ -34,7 +34,7 @@
<i <i
key="2" key="2"
v-else v-else
class="el-input__icon el-icon-caret-bottom" class="el-input__icon el-icon-arrow-down"
:class="{ 'is-reverse': menuVisible }" :class="{ 'is-reverse': menuVisible }"
></i> ></i>
</template> </template>

View File

@ -202,7 +202,7 @@
<div <div
v-show={visible} v-show={visible}
class={[ class={[
'el-cascader-menus', 'el-cascader-menus el-popper',
popperClass popperClass
]} ]}
ref="wrapper" ref="wrapper"

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
class="el-select-dropdown" class="el-select-dropdown el-popper"
:class="[{ 'is-multiple': $parent.multiple }, popperClass]" :class="[{ 'is-multiple': $parent.multiple }, popperClass]"
:style="{ minWidth: minWidth }"> :style="{ minWidth: minWidth }">
<slot></slot> <slot></slot>
@ -33,6 +33,10 @@
gpuAcceleration: false gpuAcceleration: false
}; };
} }
},
visibleArrow: {
default: true
} }
}, },

View File

@ -14,7 +14,7 @@
:key="getValueKey(item)" :key="getValueKey(item)"
:closable="!disabled" :closable="!disabled"
:hit="item.hitState" :hit="item.hitState"
type="primary" type="info"
@close="deleteTag($event, item)" @close="deleteTag($event, item)"
close-transition> close-transition>
<span class="el-select__tags-text">{{ item.currentLabel }}</span> <span class="el-select__tags-text">{{ item.currentLabel }}</span>
@ -152,7 +152,7 @@
!this.multiple && !this.multiple &&
this.value !== undefined && this.value !== undefined &&
this.value !== ''; this.value !== '';
return criteria ? 'circle-close is-show-close' : (this.remote && this.filterable ? '' : 'caret-top'); return criteria ? 'circle-close is-show-close' : (this.remote && this.filterable ? '' : 'arrow-up');
}, },
debounce() { debounce() {

View File

@ -5,6 +5,7 @@
@include b(cascader) { @include b(cascader) {
display: inline-block; display: inline-block;
position: relative; position: relative;
min-width: 224px;
.el-input, .el-input,
.el-input__inner { .el-input__inner {
@ -25,6 +26,11 @@
.el-icon-circle-close { .el-icon-circle-close {
z-index: #{$--index-normal + 1}; z-index: #{$--index-normal + 1};
transition: $--color-transition-base;
&:hover {
color: $--color-text-secondary;
}
} }
@include e(clearIcon) { @include e(clearIcon) {
@ -46,8 +52,9 @@
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
font-size: 14px; font-size: $--font-size-small;
text-align: left; text-align: left;
span { span {
color: $--color-black; color: $--color-black;
} }
@ -84,6 +91,11 @@
border: $--select-dropdown-border; border: $--select-dropdown-border;
border-radius: $--border-radius-small; border-radius: $--border-radius-small;
box-shadow: $--select-dropdown-shadow; box-shadow: $--select-dropdown-shadow;
&.el-popper[x-placement^="bottom"] .popper__arrow {
// dont do that, bro dont do that
left: 24px !important;
}
} }
@include b(cascader-menu) { @include b(cascader-menu) {
@ -104,7 +116,7 @@
@include e(item) { @include e(item) {
font-size: $--select-font-size; font-size: $--select-font-size;
padding: 8px 30px 8px 10px; padding: 8px 20px;
position: relative; position: relative;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -122,12 +134,12 @@
@include m(extensible) { @include m(extensible) {
&:after { &:after {
font-family: 'element-icons'; font-family: 'element-icons';
content: "\e606"; content: "\e602";
font-size: 12px; font-size: 12px;
transform: scale(0.8); transform: scale(0.8);
color: rgb(191, 203, 217); color: rgb(191, 203, 217);
position: absolute; position: absolute;
right: 10px; right: 15px;
margin-top: 1px; margin-top: 1px;
} }
} }
@ -157,11 +169,7 @@
&.selected { &.selected {
color: $--color-white; color: $--color-white;
background-color: $--select-option-selected; background-color: $--select-option-selected-hover;
&.hover {
background-color: $--select-option-selected-hover;
}
} }
} }

View File

@ -203,7 +203,7 @@ $--radio-button-disabled-checked-fill: $--border-color-extra-light;
$--select-border-color-hover: $--border-color-hover; $--select-border-color-hover: $--border-color-hover;
$--select-disabled-border: $--disabled-border-base; $--select-disabled-border: $--disabled-border-base;
$--select-font-size: $--font-size-base; $--select-font-size: $--font-size-base;
$--select-close-hover-color: $--color-text-placeholder; $--select-close-hover-color: $--color-text-secondary;
$--select-input-color: $--color-text-placeholder; $--select-input-color: $--color-text-placeholder;
$--select-multiple-input-color: #666; $--select-multiple-input-color: #666;
@ -214,25 +214,25 @@ $--select-tag-height: 24px;
$--select-tag-color: $--color-white; $--select-tag-color: $--color-white;
$--select-tag-background: $--color-primary; $--select-tag-background: $--color-primary;
$--select-option-color: $--link-color; $--select-option-color: $--font-color-base;
$--select-option-disabled-color: $--color-text-placeholder; $--select-option-disabled-color: $--color-text-placeholder;
$--select-option-disabled-background: $--color-white; $--select-option-disabled-background: $--color-white;
$--select-option-height: 36px; $--select-option-height: 34px;
$--select-option-hover-background: $--color-text-secondary; $--select-option-hover-background: $--background-color-base;
$--select-option-selected: $--color-primary; $--select-option-selected: $--color-primary;
$--select-option-selected-hover: shade($--color-primary, 0.12); $--select-option-selected-hover: mix($--color-primary, black, 95%);
$--select-group-color: #999; $--select-group-color: $--color-info;
$--select-group-height: 30px; $--select-group-height: 30px;
$--select-group-font-size: 12px; $--select-group-font-size: 12px;
$--select-dropdown-background: $--color-white; $--select-dropdown-background: $--color-white;
$--select-dropdown-shadow: $--box-shadow-base; $--select-dropdown-shadow: $--box-shadow-light;
$--select-dropdown-empty-color: #999; $--select-dropdown-empty-color: #999;
$--select-dropdown-max-height: 274px; $--select-dropdown-max-height: 274px;
$--select-dropdown-padding: 6px 0; $--select-dropdown-padding: 6px 0;
$--select-dropdown-empty-padding: 10px 0; $--select-dropdown-empty-padding: 10px 0;
$--select-dropdown-border: solid 1px $--disabled-border-base; $--select-dropdown-border: solid 1px $--border-color-light;
/* Alert /* Alert
-------------------------- */ -------------------------- */

View File

@ -2,24 +2,41 @@
@import "common/var"; @import "common/var";
@include b(select-group) { @include b(select-group) {
$gap: 20px;
margin: 0; margin: 0;
padding: 0; padding: 0;
@include e(wrap) { @include e(wrap) {
position: relative;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
&:not(:last-of-type) {
padding-bottom: 24px;
&::after {
content: '';
position: absolute;
display: block;
left: $gap;
right: $gap;
bottom: 12px;
height: 1px;
background: $--border-color-light;
}
}
} }
@include e(title) { @include e(title) {
padding-left: 10px; padding-left: $gap;
font-size: $--select-group-font-size; font-size: $--select-group-font-size;
color: $--select-group-color; color: $--select-group-color;
height: $--select-group-height;
line-height: $--select-group-height; line-height: $--select-group-height;
} }
& .el-select-dropdown__item { & .el-select-dropdown__item {
padding-left: 20px; padding-left: $gap;
} }
} }

View File

@ -4,7 +4,7 @@
@include b(select-dropdown) { @include b(select-dropdown) {
@include e(item) { @include e(item) {
font-size: $--select-font-size; font-size: $--select-font-size;
padding: 8px 10px; padding: 7px 20px;
position: relative; position: relative;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@ -5,7 +5,7 @@
position: absolute; position: absolute;
z-index: #{$--index-top + 1}; z-index: #{$--index-top + 1};
border: $--select-dropdown-border; border: $--select-dropdown-border;
border-radius: $--border-radius-small; border-radius: $--border-radius-base;
background-color: $--select-dropdown-background; background-color: $--select-dropdown-background;
box-shadow: $--select-dropdown-shadow; box-shadow: $--select-dropdown-shadow;
box-sizing: border-box; box-sizing: border-box;
@ -22,7 +22,7 @@
&::after { &::after {
position: absolute; position: absolute;
right: 10px; right: 20px;
font-family: 'element-icons'; font-family: 'element-icons';
content: "\E608"; content: "\E608";
font-size: 11px; font-size: 11px;
@ -35,6 +35,10 @@
.el-scrollbar.is-empty .el-select-dropdown__list{ .el-scrollbar.is-empty .el-select-dropdown__list{
padding: 0; padding: 0;
} }
&[x-placement^="bottom"] .popper__arrow {
left: 10% !important;
}
} }
@include b(select-dropdown__empty) { @include b(select-dropdown__empty) {

View File

@ -10,6 +10,7 @@
@include b(select) { @include b(select) {
display: inline-block; display: inline-block;
position: relative; position: relative;
min-width: 224px;
&:hover { &:hover {
.el-input__inner { .el-input__inner {
@ -40,12 +41,12 @@
} }
@include when(show-close) { @include when(show-close) {
transition: 0s;
font-size: $--select-font-size; font-size: $--select-font-size;
text-align: center; text-align: center;
transform: rotateZ(180deg); transform: rotateZ(180deg);
border-radius: $--border-radius-circle; border-radius: $--border-radius-circle;
color: $--select-input-color; color: $--select-input-color;
transition: $--color-transition-base;
&:hover { &:hover {
color: $--select-close-hover-color; color: $--select-close-hover-color;
@ -62,10 +63,6 @@
} }
} }
} }
&.is-focus .el-input__inner {
border-color: $--input-focus-border;
}
} }
& > .el-input { & > .el-input {
@ -110,6 +107,10 @@
z-index: $--index-normal; z-index: $--index-normal;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
.el-tag {
}
} }
& .el-tag__close { & .el-tag__close {
@ -120,7 +121,23 @@
height: $--select-tag-height; height: $--select-tag-height;
line-height: $--select-tag-height; line-height: $--select-tag-height;
box-sizing: border-box; box-sizing: border-box;
border-color: transparent;
margin: 3px 0 3px 6px; margin: 3px 0 3px 6px;
&__close.el-icon-close {
background-color: $--color-text-placeholder;
right: -7px;
color: $--color-white;
&:hover {
background-color: $--color-text-secondary;
}
&::before {
display: block;
transform: scale(.6);
}
}
} }
@include e(tag) { @include e(tag) {