amis/scss/components/form/_combo.scss

234 lines
5.4 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}Combo {
2020-04-07 17:27:51 +08:00
&-placeholder {
color: $text--muted-color;
}
2019-12-06 09:58:08 +08:00
&-toolbarBtn {
line-height: $Combo-toolbarBtn-lineHeight;
height: $Combo-toolbarBtn-height;
color: $Combo-toolbarBtn-color;
padding: $Combo-toolbarBtn-paddingY $Combo-toolbarBtn-paddingX;
cursor: pointer;
&:hover {
color: darken($Combo-toolbarBtn-color, 10%);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2020-03-24 20:01:34 +08:00
&-setNullBtn {
margin-top: $gap-xs;
display: inline-block;
}
2019-12-06 09:58:08 +08:00
&-addBtn {
font-size: $Combo-addBtn-fontSize;
@include button-size(
$Combo-addBtn-paddingY,
$Combo-addBtn-paddingX,
$Combo-addBtn-fontSize,
$Combo-addBtn-lineHeight,
$Combo-addBtn-borderRadius,
$Combo-addBtn-height
);
@include button-variant(
$Combo-addBtn-bg,
$Combo-addBtn-border,
$Combo-addBtn-color,
$Combo-addBtn-onHover-bg,
$Combo-addBtn-onHover-border,
$Combo-addBtn-onHover-color,
$Combo-addBtn-onActive-bg,
$Combo-addBtn-onActive-border,
$Combo-addBtn-onActive-color
);
&.is-disabled {
pointer-events: none;
opacity: $Button-onDisabled-opacity;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&-items {
&:empty {
display: none;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
+ .#{$ns}Combo-toolbar {
padding-top: ($Form-input-height - $Combo-addBtn-height) / 2;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
margin-bottom: $Combo-items-marginBottom;
}
2019-04-30 11:11:25 +08:00
2020-01-02 17:52:17 +08:00
&-item {
background: $white;
}
2019-12-06 09:58:08 +08:00
&--hor {
.#{$ns}Combo-item {
display: flex;
flex-wrap: nowrap;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Combo-item + .#{$ns}Combo-item {
margin-top: $Combo--horizontal-item-gap;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Combo-itemInner {
flex-basis: 0;
flex-grow: 1;
}
2019-06-26 17:57:23 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Combo-itemTag {
margin-right: $gap-sm;
2019-06-26 17:57:23 +08:00
2019-12-06 09:58:08 +08:00
label {
color: $info;
margin-right: $gap-sm;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
.#{$ns}Combo-itemToolbar {
margin-left: $gap-xs;
display: flex;
white-space: nowrap;
align-items: flex-start;
padding-top: $Form-label-paddingTop;
> .is-disabled {
pointer-events: none;
opacity: $Button-onDisabled-opacity;
}
}
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--ver:not(&--noBorder) {
@include clearfix();
> .#{$ns}Combo-items {
margin: (-$Combo--vertical-item-gap * 2) (-$Combo--vertical-item-gap * 2)
0 (-$Combo--vertical-item-gap * 2);
2020-04-07 17:27:51 +08:00
> .#{$ns}Combo-placeholder {
padding: ($Combo--vertical-item-gap * 2) ($Combo--vertical-item-gap * 2)
0 ($Combo--vertical-item-gap * 2);
margin-bottom: $Combo--vertical-item-gap * 2;
}
2019-12-06 09:58:08 +08:00
}
2019-06-26 17:57:23 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}Combo-itemTag {
text-align: right;
2019-06-26 17:57:23 +08:00
2019-12-06 09:58:08 +08:00
label {
color: $info;
margin-right: $gap-sm;
}
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
// 不严格点会命中 combo 里面嵌套 combo 的情况so sad.
> .#{$ns}Combo-item,
> .#{$ns}Combo-items > .#{$ns}Combo-item {
border: $Combo--vertical-item-borderWidth dashed
$Combo--vertical-item-borderColor;
padding: $Combo--vertical-item-paddingY $Combo--vertical-item-paddingX;
position: relative;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
> .#{$ns}Combo-items > .#{$ns}Combo-item {
margin: $Combo--vertical-item-gap * 2;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
> .#{$ns}Combo-item > .#{$ns}Combo-itemToolbar,
> .#{$ns}Combo-items > .#{$ns}Combo-item > .#{$ns}Combo-itemToolbar {
opacity: 0;
position: absolute;
right: $Combo--vertical-itemToolbar-positionRight;
top: $Combo--vertical-itemToolbar-positionTop / 2;
transition: $Combo--vertical-itemToolbar-transion;
height: $Combo--vertical-itemToolbar-height;
line-height: $Combo--vertical-itemToolbar-height;
background-color: $Combo--vertical-itemToolbar-bg;
color: $Combo--vertical-itemToolbar-color;
border-top-left-radius: $Combo--vertical-itemToolbar-borderRadius;
border-top-right-radius: $Combo--vertical-itemToolbar-borderRadius;
padding: 0 px2rem(3px);
border-style: solid;
border-color: $Combo--vertical-itemToolbar-borderColor;
border-width: $Combo--vertical-itemToolbar-borderWidth
$Combo--vertical-itemToolbar-borderWidth 0
$Combo--vertical-itemToolbar-borderWidth;
// margin-top: px2rem(-1px);
.#{$ns}Combo-toolbarBtn {
color: inherit;
line-height: $Combo--vertical-itemToolbar-height;
// font-size: px2rem(14px);
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:hover {
color: $Combo--vertical-itemToolbar-onHover-color;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
// top: $Combo--vertical-itemToolbar-positionTop;
// opacity: 1;
2019-04-30 11:11:25 +08:00
}
2020-01-09 16:25:41 +08:00
&:not(.is-disabled) > .#{$ns}Combo-item:hover,
&:not(.is-disabled) > .#{$ns}Combo-items > .#{$ns}Combo-item:hover {
2019-12-06 09:58:08 +08:00
border-color: $Combo--vertical-item-onHover-borderColor;
// border-style: solid;
> .#{$ns}Combo-itemToolbar {
top: $Combo--vertical-itemToolbar-positionTop;
opacity: 1;
}
}
}
&-item--dragging {
position: relative;
&:after {
content: '';
display: block;
position: absolute;
z-index: 5;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.1);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Combo-dragableTip {
2019-12-06 09:58:08 +08:00
color: $text--muted-color;
font-size: $fontSizeSm;
margin-left: $gap-xs;
2019-07-04 14:21:32 +08:00
2019-12-06 09:58:08 +08:00
&:empty {
display: none;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}ComboControl.is-inline {
2019-12-06 09:58:08 +08:00
.#{$ns}Combo--hor .#{$ns}Combo-itemInner {
flex-grow: unset;
flex-basis: unset;
}
.#{$ns}Combo--ver .#{$ns}Combo-item {
display: inline-block;
}
2019-04-30 11:11:25 +08:00
}
@include media-breakpoint-up(sm) {
2019-12-06 09:58:08 +08:00
.#{$ns}Combo-form .#{$ns}Form-item:last-child {
margin-bottom: 0;
}
}