drip-table
Version:
A tiny and powerful enterprise-class solution for building tables.
212 lines (179 loc) • 3.85 kB
text/less
@import url("../../../styles/theme/default.less");
@import url("../../../styles/mixins/disabled.less");
@prefixCls: jfe-drip-table-rc-input-number;
.@{prefixCls} {
position: relative;
display: inline-block;
width: 90px;
min-width: 0;
box-sizing: border-box;
margin: 0;
padding: 0;
color: #000000e0;
background-color: #ffffff;
background-image: none;
border-radius: 6px;
transition: all .2s;
border: 1px solid #d9d9d9;
&-borderless {
background-color: transparent;
border: none;
box-shadow: none;
}
&-handler {
position: relative;
display: block;
width: 100%;
height: 50%;
overflow: hidden;
color: #ffffff73;
font-weight: bold;
line-height: 0;
text-align: center;
border-left: 1px solid #d9d9d9;
transition: all .1s linear;
&:active {
background: #ffffff14;
}
&:hover &-up-inner,
&:hover &-down-inner {
color: @drip-table-primary-color;
}
}
&-handler-up-inner,
&-handler-down-inner {
display: inline-block;
font-style: normal;
text-align: center;
text-transform: none;
vertical-align: -.125em; // for SVG icon, see https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
svg {
display: inline-block;
}
&::before {
display: none; // dont display old icon.
}
& &-icon {
display: block;
}
position: absolute;
right: 4px;
width: 12px;
height: 12px;
color: #00000073;
line-height: 12px;
transition: all .1s linear;
}
&:hover {
border-color: @drip-table-primary-color;
transition: opacity .24s linear .24s;
}
&-disabled {
.disabled();
.@{prefixCls}-input {
cursor: not-allowed;
}
.@{prefixCls}-handler-wrap {
display: none;
}
}
&-readonly {
.@{prefixCls}-handler-wrap {
display: none;
}
}
&-input {
width: 100%;
height: 30px;
padding: 0 11px;
text-align: left;
background-color: transparent;
border: 0;
border-radius: 2px;
outline: 0;
transition: all .3s linear;
&[type="number"]::-webkit-inner-spin-button,
&[type="number"]::-webkit-outer-spin-button {
margin: 0;
appearance: none;
}
}
&-lg {
padding: 0;
font-size: 14px;
input {
height: 38px;
}
}
&-sm {
padding: 0;
input {
height: 22px;
padding: 0 7px;
}
}
&-handler-wrap {
position: absolute;
top: 0;
right: 0;
width: 22px;
height: 100%;
background: #ffffff;
border-radius: 0 6px 6px 0;
opacity: 0;
transition: opacity .24s linear .1s;
.@{prefixCls}-handler {
.@{prefixCls}-handler-up-inner,
.@{prefixCls}-handler-down-inner {
display: flex;
align-items: center;
justify-content: center;
min-width: auto;
margin-right: 0;
font-size: 7px;
}
}
.@{prefixCls}-borderless & {
border-left-width: 0;
}
}
&-handler-wrap:hover &-handler {
height: 40%;
}
&:hover &-handler-wrap,
&-focused &-handler-wrap {
opacity: 1;
}
&-handler-up {
border-top-right-radius: 2px;
cursor: pointer;
&-inner {
top: 50%;
margin-top: -5px;
text-align: center;
}
&:hover {
height: 60% ;
}
}
&-handler-down {
top: 0;
border-top: 1px solid #d9d9d9;
border-bottom-right-radius: 2px;
cursor: pointer;
&-inner {
top: 50%;
text-align: center;
transform: translateY(-50%);
}
&:hover {
height: 60% ;
}
.@{prefixCls}-borderless & {
border-top-width: 0;
}
}
}