amis2/scss/components/form/_number.scss
吴多益 944bcb2e85
feat:input-number 支持设置单位;page 支持 style (#2721)
* feat:input-number 支持设置单位;page 支持 style
并修复小数值的显示问题

* 改一下名字

* 更新 snapshot

* 支持 didUpdate

* 支持 didMount

* 支持 didMount
2021-10-19 09:59:39 +08:00

201 lines
4.0 KiB
SCSS

.#{$ns}Number {
margin: 0;
padding: 0;
line-height: var(--Form-input-height);
font-size: var(--Form-input-fontSize);
height: var(--Form-input-height);
display: inline-block;
vertical-align: middle;
background: var(--Number-bg);
border: var(--Number-borderWidth) solid var(--Number-borderColor);
border-radius: var(--Number-borderRadius);
@include input-border();
&.no-steps > &-handler-wrap {
display: none;
}
&-focused {
border-color: var(--Form-input-onFocused-borderColor);
box-shadow: var(--Form-input-boxShadow);
}
&-handler {
text-align: center;
overflow: hidden;
display: block;
touch-action: none;
&-active {
background: #ddd;
}
}
&-handler-up-inner,
&-handler-down-inner {
user-select: none;
-webkit-user-select: none;
display: inline-block;
}
&:hover {
border-color: var(--Form-input-onFocused-borderColor);
.#{$ns}Number-handler-up,
.#{$ns}Number-handler-wrap {
border-color: var(--Form-input-onFocused-borderColor);
}
}
&-disabled:hover {
border-color: var(--Form-input-borderColor);
.#{$ns}Number-handler-up,
.#{$ns}Number-handler-wrap {
border-color: var(--Form-input-borderColor);
}
}
&-input-wrap {
overflow: hidden;
height: 100%;
}
&-input {
width: 100%;
background: transparent;
text-align: left;
vertical-align: top;
outline: 0;
-moz-appearance: textfield;
line-height: calc(var(--Form-input-height) - var(--Number-borderWidth) * 2);
height: 100%;
transition: all var(--animation-duration) ease;
border: 0;
border-radius: var(--Form-input-borderRadius);
padding: 0 var(--Form-input-paddingX);
}
&-handler {
background: var(--Number-handler-bg);
color: var(--Number-handler-color);
font-family: var(--Number-handler-fontFamily);
font-size: var(--Number-handler-fontSize);
&:hover {
background: var(--Number-handler-onHover-bg);
color: var(--Number-handler-onHover-color);
}
&:hover:active {
background: var(--Number-handler-onActive-bg);
}
}
&-handler-up {
&-inner {
transform: var(--Number-handler--up-transform);
&:after {
content: var(--Number-handler--up-content);
}
}
}
&-handler-down {
&-inner {
&:after {
content: var(--Number-handler--down-content);
}
}
}
@if $Number-handler-mode==vertical {
&-handler-wrap {
float: right;
border-left: px2rem(1px) solid var(--Form-input-borderColor);
width: var(--Number-handler-width);
height: 100%;
}
&-handler {
line-height: calc((var(--Form-input-height) - #{px2rem(6px)}) / 2);
height: calc(
(var(--Form-input-height) - var(--Number-borderWidth) * 2) / 2
);
}
&-handler-up {
border-bottom: var(--Number-handler-borderBottom);
padding-top: px2rem(1px);
}
} @else {
position: relative;
&-input {
text-align: center;
}
&-handler-up,
&-handler-down {
position: absolute;
width: var(--Number-handler-width);
height: 100%;
top: 0;
}
&-handler-down {
left: 0;
}
&-handler-up {
right: 0;
}
}
&-handler-down-disabled,
&-handler-up-disabled {
background: var(--Number-handler-onDisabled-bg);
pointer-events: none;
color: var(--Number-handler-onDisabled-color);
}
&-disabled {
.#{$ns}Number-input {
opacity: 0.72;
cursor: not-allowed;
background: var(--Number-onDisabled-bg);
}
.#{$ns}Number-handler {
opacity: 0.72;
&:hover {
color: var(--text--muted-color);
border-color: var(--Form-input-borderColor);
}
}
}
}
.#{$ns}NumberControl:not(.is-inline) > .#{$ns}Number {
display: block;
}
.#{$ns}Number--borderHalf,
.#{$ns}Number--borderNone {
.#{$ns}Number-handler-wrap {
border-left: none;
}
}
.#{$ns}NumberControl--withUnit {
display: flex;
.#{$ns}Number {
flex-grow: 1;
}
.#{$ns}Select {
border-left: 0;
}
}