amis/scss/components/_condition-builder.scss
Akikonata 0cbb2ea0f1
Feat condition builder (#3392)
* 处理某些特殊情况下会传入空字符串导致无法识别值的问题

* 修复空字符串不能识别导致出错的问题

* select 支持不换行模式

* 解决长列表出现双滚动条的问题

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* 大赛广告

* List 不再下发"-" 作为空值

* condition-builder 支持简单模式

* condition-builder 支持简单模式

Co-authored-by: panzheng <panzheng@baidu.com>
2022-01-13 11:28:30 +08:00

309 lines
5.3 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: var(--gap-md);
border-left: solid 1px var(--borderColor);
bottom: 0;
}
&:after {
position: absolute;
content: '';
top: 50%;
width: var(--gap-md);
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;
}
}
&.simple {
margin-left: 0;
&:before {
display: none;
}
&: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;
}