amis2/scss/components/form/_nested-select.scss
2020-07-06 14:48:25 +08:00

175 lines
4.0 KiB
SCSS

.#{$ns}NestedSelect {
display: inline-flex;
vertical-align: middle;
outline: none;
position: relative;
border: $Form-select-borderWidth solid $Form-select-borderColor;
background: $Form-select-bg;
border-radius: $Form-select-borderRadius;
min-height: $Form-selectOption-height;
$paddingY: (
$Form-selectOption-height - $Form-input-lineHeight * $Form-input-fontSize -
$Form-select-borderWidth * 2
)/2;
padding: $paddingY 0 $paddingY $Form-select-paddingX;
cursor: pointer;
color: $Form-select-color;
&.is-disabled {
color: $text--muted-color;
background: $Form-input-onDisabled-bg;
border-color: $Form-input-onDisabled-borderColor;
}
&.is-focused,
&.is-opened {
border-color: $Form-input-onFocused-borderColor;
// border-bottom: 0;
@if ($Form-select-onFocused-color !=$Form-select-color) {
color: $Form-select-onFocused-color;
}
}
&.is-opened .#{$ns}Select-arrow > svg {
transform: rotate(180deg);
}
&:not(.is-disabled):hover {
background: $Form-select-onHover-bg;
}
&--multi {
.#{$ns}Select-value {
position: static;
user-select: none;
line-height: $Form-input-lineHeight * $Form-input-fontSize - px2rem(2px);
display: inline-block;
vertical-align: middle;
font-size: $Form-selectValue-fontSize;
color: $Form-selectValue-color;
background: $Form-selectValue-bg;
border: px2rem(1px) solid $Form-selectValue-borderColor;
border-radius: px2rem(2px);
margin-right: $gap-xs;
margin-bottom: $gap-xs;
}
.#{$ns}Select-valueLabel {
padding: 0 $gap-xs;
}
}
&-placeholder {
color: $Form-select-placeholderColor;
line-height: $Form-input-lineHeight;
}
&-valueWrap {
user-select: none;
position: relative;
flex-grow: 1;
}
&-clear {
padding: px2rem(3px);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 2;
svg {
fill: $Form-input-iconColor;
width: px2rem(10px);
height: px2rem(10px);
}
&:hover svg {
fill: darken($color: $Form-input-iconColor, $amount: 20%);
}
}
&-optionArrowRight {
display: inline-block;
padding-right: px2rem(10px);
svg {
width: px2rem(12px);
height: px2rem(12px);
fill: $Form-input-iconColor;
}
}
&-menuOuter {
display: flex;
}
&-menu {
width: px2rem(160px);
max-height: px2rem(300px);
background: $Form-select-menu-bg;
color: $Form-select-menu-color;
border: $Form-select-outer-borderWidth solid
$Form-input-onFocused-borderColor;
box-shadow: $Form-select-outer-boxShadow;
overflow-y: auto;
overflow-x: hidden;
&:not(:first-child) {
border-left: 0;
}
.#{$ns}NestedSelect-option {
position: relative;
padding-left: px2rem(10px);
min-height: $Form-input-height;
line-height: $Form-input-height;
cursor: pointer;
display: flex;
> .#{$ns}NestedSelect-optionLabel {
flex: 1;
cursor: pointer;
span {
display: inline-flex;
word-break: break-all;
}
}
&.is-active {
color: $Form-select-menu-onActive-color;
background-color: $Form-select-menu-onActive-bg;
}
&:hover {
color: $Form-select-menu-onHover-color;
background-color: $Form-select-menu-onHover-bg;
}
&:hover > .#{$ns}NestedSelect-childrenOuter {
display: block;
}
.#{$ns}Checkbox {
display: inline-block;
padding-top: 0;
}
&.checkall {
border-bottom: px2rem(1px) solid #eceff8;
}
}
}
}
// 需要能撑开
@include media-breakpoint-up(sm) {
.#{$ns}Form-control--sizeXs > .#{$ns}NestedSelect,
.#{$ns}Form-control--sizeSm > .#{$ns}NestedSelect,
.#{$ns}Form-control--sizeMd > .#{$ns}NestedSelect,
.#{$ns}Form-control--sizeLg > .#{$ns}NestedSelect {
display: inline-flex !important;
}
}