bin-ui
Version:
基于 vue2.6 / vue-cli3 的 UI 组件库
370 lines (364 loc) • 8.89 kB
text/stylus
.bin-select {
position: relative;
display: inline-block;
width: 100%;
box-sizing: border-box;
vertical-align: middle;
color: $color-text-default;
font-size: $base-font-size;
line-height: $base-line-height;
.head-multiple-wrap {
white-space: nowrap;
overflow: hidden;
}
&-selection {
display: block;
box-sizing: border-box;
outline: 0;
user-select: none;
cursor: pointer;
position: relative;
background-color: $color-white;
border-radius: $border-base-radius;
border: $border-base;
transition: all $animation-duration-base ease-in-out;
&:hover, &-focused {
border-color: $color-primary-light1;
.bin-select-arrow {
display: inline-block;
}
}
}
&-arrow {
position: absolute;
top: 50%;
right: 8px;
line-height: 1;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
font-size: $base-font-size;
color: $color-text-secondary;
transition: all $animation-duration-base ease-in-out;
}
&-visible {
.bin-select-selection {
border-color: $color-primary;
outline: 0;
box-shadow: 0 0 0 2px $color-input-shadow;
}
.bin-select-arrow {
transform: translateY(-50%) rotate(180deg);
display: inline-block;
}
}
&-disabled {
.bin-select-selection {
background-color: $color-select-hover;
opacity: 1;
cursor: not-allowed;
color: $color-text-disabled;
&:hover {
border-color: $border-color-base;
box-shadow: none;
}
}
.bin-select-arrow {
color: #ccc;
}
}
&-single &-selection {
height: $default-height;
position: relative;
.bin-select-placeholder {
color: $color-text-placeholder;
}
.bin-select-placeholder, .bin-select-selected-value {
display: block;
height: $default-height - 2;
line-height: $default-height - 2;
font-size: $base-font-size;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-left: 8px;
padding-right: 24px;
}
}
&-mini&-single &-selection {
height: $mini-height;
border-radius: $border-base-radius;
.bin-select-placeholder, .bin-select-selected-value {
height: $mini-height - 2;
line-height: $mini-height - 2;
}
}
&-mini&-multiple &-selection {
height: $small-height;
border-radius: $border-base-radius;
.bin-select-placeholder, .bin-select-selected-value {
height: $small-height - 2;
line-height: $small-height - 2;
}
.bin-tag {
height: $small-height - 8;
line-height: $small-height - 10;
}
}
&-small&-single &-selection {
height: $small-height;
.bin-select-placeholder, .bin-select-selected-value {
height: $small-height - 2;
line-height: $small-height - 2;
}
}
&-small&-multiple &-selection {
height: $small-height;
.bin-select-placeholder, .bin-select-selected-value {
height: $small-height - 2;
line-height: $small-height - 2;
}
.bin-tag {
height: $small-height - 8;
line-height: $small-height - 10;
}
}
&-large&-single &-selection {
height: $large-height;
.bin-select-placeholder, .bin-select-selected-value {
height: $large-height - 2;
line-height: $large-height - 2;
font-size: $header-font-size;
}
}
&-large&-multiple &-selection {
height: $large-height;
.bin-select-placeholder, .bin-select-selected-value {
height: $large-height - 2;
line-height: $large-height - 2;
font-size: $header-font-size;
}
.bin-tag {
height: $large-height - 8;
line-height: $large-height - 10;
}
}
&-multiple &-selection {
height: $default-height;
padding: 0 24px 0 4px;
.bin-select-placeholder {
display: block;
height: $default-height - 2;
line-height: $default-height - 2;
color: $btn-disable-color;
font-size: $base-font-size;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-left: 4px;
padding-right: 22px;
}
}
&-multiple .bin-tag {
height: $default-height - 8;
line-height: $default-height - 10;
margin: 3px 4px 3px 0;
max-width: 99%;
position: relative;
span:not(.bin-select-max-tag) {
display: block;
margin-right: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
i {
position: absolute;
right: 2px;
top: 50%;
transform: translateY(-50%);
}
}
&-prefix {
display: inline-block;
i {
vertical-align: -1px;
font-size: 16px;
}
}
&-head-with-prefix {
display: flex ;
align-items: center;
}
&-single &-prefix {
padding-left: 8px;
}
&-single &-head-with-prefix, &-multiple &-head-with-prefix {
padding-left: 0 ;
}
// input
&-input {
display: inline-block;
height: $default-height - 2;
line-height: $default-height - 2;
padding: 0 24px 0 8px;
font-size: $base-font-size;
outline: none;
border: none;
box-sizing: border-box;
color: $color-text-default;
background-color: transparent;
position: relative;
cursor: pointer;
&::-moz-placeholder {
color: $color-text-placeholder;
opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526
}
// Internet Explorer 10+
&:-ms-input-placeholder {
color: $color-text-placeholder;
}
// Safari and Chrome
&::-webkit-input-placeholder {
color: $color-text-placeholder;
}
&[disabled] {
cursor: not-allowed;
color: #ccc;
-webkit-text-fill-color: #ccc; // #5249
}
}
&-single &-input {
width: 100%;
}
&-large &-input {
height: $large-height - 2;
line-height: $large-height - 2;
}
&-large {
font-size: $header-font-size;
}
&-small &-input {
height: $small-height - 2;
line-height: $small-height - 2;
}
&-mini &-input {
height: $mini-height - 2;
line-height: $mini-height - 2;
}
&-multiple &-input {
height: $default-height - 2;
line-height: $default-height - 2;
padding: 0 0 0 4px;
}
&-not-found {
text-align: center;
color: $color-text-placeholder;
}
&-loading {
text-align: center;
color: $color-text-placeholder;
}
}
// 下拉框样式
.bin-select-dropdown {
width: inherit;
max-height: 200px;
overflow: auto;
margin: 5px 0;
padding: 5px 0;
background-color: $color-white;
box-sizing: border-box;
border-radius: $border-base-radius;
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
position: absolute;
z-index: 900;
}
// 下拉框item样式
.bin-select-item {
margin: 0;
line-height: $base-line-height;
min-height: $small-height;
padding: 5px 12px;
clear: both;
color: $color-text-default;
font-size: $base-font-size ;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
list-style: none;
cursor: pointer;
transition: background $animation-duration-base ease-in-out;
&:hover {
background: $color-select-hover;
}
&-selected, &-item &-selected:hover {
background: $color-primary-light5;
font-weight: bold;
}
&-disabled {
color: $color-text-placeholder ;
cursor: not-allowed;
&:hover {
color: $color-text-placeholder ;
background-color: $color-white;
cursor: not-allowed;
}
}
}
// 分组样式
.bin-select-group {
list-style: none;
margin: 0;
padding: 0;
&-title {
padding-left: 8px;
font-size: $base-font-size;
color: $color-text-secondary;
height: 30px;
line-height: 30px;
}
}
// 多选状态下的下拉item样式
.bin-select-multiple .bin-select-item {
position: relative;
&-selected {
color: $color-primary-light1 ;
background: $color-white;
}
&-focus, &-selected:hover {
background: $color-select-hover;
}
&-selected&-focus {
color: $color-primary-light4;
background: $color-white;
}
&-selected:after {
font-family: "iconfont" ;
font-style: normal;
font-weight: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 20px;
content: '\e820';
color: $color-primary-light1;
position: absolute;
top: 2px;
right: 8px;
}
}
// form-item error 样式
.bin-form-item-error {
.bin-select {
&-selection {
border: 1px solid $color-danger;
}
&-arrow {
color: $color-danger;
}
&-visible .bin-select-selection {
border-color: $color-danger;
outline: 0;
box-shadow: 0 0 0 2px $color-input-error-shadow;
}
}
}