amis2/scss/components/_condition-builder.scss
liaoxuezhi ae11ca586d
组合条件控件补充功能&添加文档 (#1580)
* Condition-Builder 优化 + 补充文档

* 完善文档
2021-02-19 09:56:19 +08:00

298 lines
5.1 KiB
SCSS

.#{$ns}CBGroup {
font-size: var(--fontSizeSm);
&-toolbar {
display: flex;
flex-direction: row;
padding-bottom: 10px;
.#{$ns}Button {
transition: padding var(--animation-duration);
min-width: unset;
svg {
width: 10px;
height: 10px;
top: 0;
margin-right: 5px;
}
}
&:not(:hover)
.#{$ns}CBGroup-toolbarCondition
.#{$ns}Button:not(.is-active) {
width: 0;
padding: 0;
overflow: hidden;
opacity: 0;
margin: 0;
border: 0;
}
.#{$ns}CBGroup-toolbarConditionAdd {
transition: opacity var(--animation-duration);
display: flex;
align-items: center;
margin-left: var(--gap-base);
.#{$ns}CBDelete {
margin-left: var(--gap-xs);
}
}
&:not(:hover) .#{$ns}CBGroup-toolbarConditionAdd {
opacity: 0;
}
}
&-field,
&-operator {
position: relative;
display: inline-block;
margin: px2rem(3px);
vertical-align: middle;
}
&-fieldCaret,
&-operatorCaret {
transition: transform var(--animation-duration) ease-out;
margin: 5px;
display: flex;
color: var(--Form-select-caret-iconColor);
&:hover {
color: var(--Form-select-caret-onHover-iconColor);
}
> svg {
width: px2rem(10px);
height: px2rem(10px);
top: 0;
}
}
&-fieldInput.is-active &-fieldCaret,
&-operatorInput.is-active &-operatorCaret {
transform: rotate(180deg);
}
&-placeholder {
color: var(--text--muted-color);
position: relative;
margin-left: 30px;
padding: 10px;
background: rgba(0, 0, 0, 0.03);
border-radius: 5px;
&:before {
position: absolute;
content: '';
top: -10px;
left: -30px;
width: 20px;
border-left: solid 1px var(--borderColor);
bottom: 0;
}
&:after {
position: absolute;
content: '';
top: 50%;
width: 20px;
left: -30px;
border-top: solid 1px var(--borderColor);
}
&:last-child {
&:before {
border-bottom-left-radius: 5px;
border-bottom: solid 1px var(--borderColor);
bottom: 50%;
}
&:after {
display: none;
}
}
}
}
.#{$ns}CBDelete {
@include icon-color();
cursor: pointer;
margin-left: auto;
transition: opacity var(--animation-duration);
}
.#{$ns}CBGroupOrItem {
position: relative;
margin-left: px2rem(30px);
& + & {
margin-top: px2rem(10px);
}
&-body {
display: flex;
padding: 2px 7px;
border-radius: 5px;
flex-direction: row;
align-items: center;
position: relative;
background: rgba(0, 0, 0, 0.03);
transition: all var(--animation-duration) ease-out;
> .#{$ns}CBGroup {
margin: 3px;
}
}
&-body:not(:hover) .#{$ns}CBDelete {
opacity: 0;
}
&.is-dragging {
display: none;
}
&.is-ghost > &-body:before {
position: absolute;
z-index: 2;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba($info, 0.2);
}
&-dragbar {
cursor: move;
width: 20px;
margin-left: -5px;
opacity: 0.6;
text-align: center;
transition: opacity var(--animation-duration) ease-out;
@include icon-color();
}
.#{$ns}CBGroup {
flex-grow: 1;
}
&:hover > &-body {
background: rgba(0, 0, 0, 0.05);
}
&:hover > &-body > &-dragbar {
opacity: 1;
}
&:before {
position: absolute;
content: '';
top: -10px;
left: -30px;
width: 20px;
border-left: solid 1px var(--borderColor);
bottom: 0;
}
&:after {
position: absolute;
content: '';
top: 50%;
width: 20px;
left: -30px;
border-top: solid 1px var(--borderColor);
}
&:last-child {
&:before {
border-bottom-left-radius: 5px;
border-bottom: solid 1px var(--borderColor);
bottom: 50%;
}
&:after {
display: none;
}
}
}
.#{$ns}CBInputSwitch {
position: relative;
display: inline-block;
vertical-align: middle;
// margin: px2rem(3px);
cursor: pointer;
> a {
@include icon-color();
}
svg {
width: px2rem(10px);
height: px2rem(10px);
}
}
.#{$ns}CBFunc {
display: inline-block;
vertical-align: middle;
margin: px2rem(3px);
&-select {
display: inline-block;
position: relative;
}
&-error {
color: var(--danger);
}
&-args {
display: inline-block;
> span {
display: inline-block;
padding: 0 5px;
color: var(--info);
}
> div {
display: inline-block;
}
}
}
.#{$ns}CBValue {
position: relative;
display: inline-block;
vertical-align: middle;
margin: px2rem(3px);
}
.#{$ns}CBFormula {
position: relative;
display: inline-block;
vertical-align: middle;
margin: px2rem(3px);
&-label {
background: var(--ResultBox-value-bg);
color: var(--text--muted-color);
display: block;
font-size: var(--fontSizeSm);
align-self: center;
margin: -5px 5px -5px -8px;
padding: 5px;
border-radius: 5px;
user-select: none;
}
}
.#{$ns}CBSeprator {
width: 20px;
text-align: center;
display: inline-block;
user-select: none;
}