UNPKG

wetrade-design

Version:

一款多语言支持Vue3的UI框架

546 lines (457 loc) 13.6 kB
@import '../../style/themes/index'; @import '../../style/mixins/index'; @input-affix-with-clear-btn-width: 38px; @icon-cls: ~'@{wd-prefix}icon'; // 这个包裹icon的span @icon-prefix-cls: ~'@{wd-prefix}-icon'; @input-prefix-cls: ~'@{wd-prefix}-input'; // size mixins for input .input-lg() { padding: @input-padding-vertical-lg @input-padding-horizontal-lg; font-size: @font-size-base; line-height: @input-line-height-bg; border-radius: @border-radius-base; } .input-bg() { padding: @input-padding-vertical-bg @input-padding-horizontal-bg; font-size: @font-size-base; line-height: @input-line-height-lg; border-radius: @border-radius-base; } .input-sm() { padding: @input-padding-vertical-sm @input-padding-horizontal-sm; border-radius: @border-radius-sm; } .input-xs() { padding: @input-padding-vertical-xs @input-padding-horizontal-xs; border-radius: @border-radius-sm; } // input status // == when focus or active .active(@borderColor: @brand-primary; @hoverBorderColor: @brand-hover; @outlineColor: @brand-primary-outline) { border-right-width: @border-width-base !important; outline: 0; background-color: transparent; } // == when hover .hover(@color: @input-hover-border-color) { border-color: @color; border-right-width: @border-width-base !important; } .disabled() { color: @input-disabled-color; background-color: @input-disabled-bg-color; border-color: @input-border-color; box-shadow: none; cursor: not-allowed; // pointer-events: none; opacity: 1; &:hover { // background-color: transparent; .hover(@line-border); } &.@{input-prefix-cls}-borderless { border-color: transparent; color: @input-disabled-color-borderless; } &.@{input-prefix-cls}-condition { color: @input-disabled-color; } .@{input-prefix-cls}-prefix, .@{input-prefix-cls}-suffix { .@{icon-prefix-cls} { color: @input-disabled-icon-color; } } } // Basic style for input .input() { position: relative; display: inline-block; width: 100%; min-width: 0; padding: @input-padding-vertical-base @input-padding-horizontal-base; color: @input-color; font-size: @font-size-sm; line-height: @input-line-height-base; // background-color: @input-bg; background-color: transparent; background-image: none; border: @border-width-base @border-style-base @input-border-color; border-radius: @border-radius-sm; // transition: all 0.3s; // font-family: PingFang SC; .placeholder(); // Reset placeholder &:hover { .hover(); } &:focus, &-focused { .active(); border-color: var(--wd-brand-hover); } &-disabled { .disabled(); } &[disabled] { .disabled(); } &:not(.@{input-prefix-cls}-borderless).@{input-prefix-cls}-disabled { &::placeholder { color: @input-disabled-color; } } &-borderless { &, // &:focus, // &-focused, // 这里是无效class 在affix中修改focused &-disabled, &[disabled] { background-color: @input-disabled-bg-borderless; box-shadow: none; border-color: transparent; // border-color: @fill-fill-deep; } &:not(:focus):not(.@{input-prefix-cls}-disabled):not( .@{input-prefix-cls}-affix-wrapper-disabled ):hover { background-color: @sp-hover-bar-active; box-shadow: none; border-color: transparent; .@{input-prefix-cls}-borderless:not(.@{input-prefix-cls}-disabled) { background-color: transparent; } } } &-condition { // &:focus, // &-focused { // // background-color: @input-condition-bg-color; // background-color: @bg-page; // // box-shadow: none; // // border-color: transparent; // } // &:not(.@{input-prefix-cls}-disabled):hover { // background-color: @sp-hover-bar-active; // box-shadow: none; // border-color: transparent; // } .@{icon-cls} { margin-left: @input-suffix-icon-margin-left; line-height: @input-suffix-line-height; height: @input-suffix-line-height; color: @input-suffix-color; } } // Reset height for `textarea`s textarea& { max-width: 100%; // prevent textearea resize from coming out of its container height: auto; min-height: @input-height-base; line-height: @line-height-base; vertical-align: bottom; transition: all 0.3s, height 0s; } // Size &-lg { .input-lg(); } &-bg { .input-bg(); } &-sm { .input-sm(); } &-xs { .input-xs(); } } // label input .input-group(@inputClass) { position: relative; display: table; width: 100%; border-collapse: separate; border-spacing: 0; // Undo padding and float of grid classes &[class*='col-'] { float: none; padding-right: 0; padding-left: 0; } > [class*='col-'] { padding-right: 8px; &:last-child { padding-right: 0; } } &-addon, &-wrap, > .@{inputClass} { display: table-cell; &:not(:first-child):not(:last-child) { border-radius: 0; } } &-addon, &-wrap { width: 1px; // To make addon/wrap as small as possible white-space: nowrap; vertical-align: middle; } &-wrap > * { display: block !important; } .@{inputClass} { float: left; width: 100%; margin-bottom: 0; text-align: inherit; &:focus { z-index: 1; // Fix https://gw.alipayobjects.com/zos/rmsportal/DHNpoqfMXSfrSnlZvhsJ.png border-right-width: 1px; } &:hover { z-index: 1; border-right-width: 1px; .@{wd-prefix}-input-search-with-button & { z-index: 0; } } } &-addon { position: relative; padding: 0 @input-padding-horizontal-base; color: @input-color; font-weight: normal; font-size: @font-size-base; text-align: center; background-color: transparent; border: @border-width-base @border-style-base @input-border-color; border-radius: @border-radius-base; transition: all 0.3s; // Reset Select's style in addon .@{wd-prefix}-select { margin: -(@input-padding-vertical-base + 1px) (-@input-padding-horizontal-base); &.@{wd-prefix}-select-single:not(.@{wd-prefix}-select-customize-input) .@{wd-prefix}-select-selector { background-color: inherit; border: @border-width-base @border-style-base transparent; box-shadow: none; } &-open, &-focused { .@{wd-prefix}-select-selector { color: @brand-primary; } } } // https://github.com/ant-design/ant-design/issues/31333 .@{wd-prefix}-cascader-picker { margin: -9px (-@control-padding-horizontal); background-color: transparent; .@{wd-prefix}-cascader-input { text-align: left; border: 0; box-shadow: none; } } } // Reset rounded corners > .@{inputClass}:first-child, &-addon:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; // Reset Select's style in addon .@{wd-prefix}-select .@{wd-prefix}-select-selector { border-top-right-radius: 0; border-bottom-right-radius: 0; } } > .@{inputClass}-affix-wrapper { &:not(:first-child) .@{inputClass} { border-top-left-radius: 0; border-bottom-left-radius: 0; } &:not(:last-child) .@{inputClass} { border-top-right-radius: 0; border-bottom-right-radius: 0; } } &-addon:first-child { border-right: 0; } &-addon:last-child { border-left: 0; } > .@{inputClass}:last-child, &-addon:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; // Reset Select's style in addon .@{wd-prefix}-select .@{wd-prefix}-select-selector { border-top-left-radius: 0; border-bottom-left-radius: 0; } } // Sizing options &-lg .@{inputClass}, &-lg > &-addon { .input-lg(); } &-bg .@{inputClass}, &-bg > &-addon { .input-bg(); } &-sm .@{inputClass}, &-sm > &-addon { .input-sm(); } &-xs .@{inputClass}, &-xs > &-addon { .input-xs(); } // Fix https://github.com/ant-design/ant-design/issues/5754 &-lg .@{wd-prefix}-select-single .@{wd-prefix}-select-selector { height: @input-height-lg; } &-bg .@{wd-prefix}-select-single .@{wd-prefix}-select-selector { height: @input-height-bg; } &-sm .@{wd-prefix}-select-single .@{wd-prefix}-select-selector { height: @input-height-sm; } &-xs .@{wd-prefix}-select-single .@{wd-prefix}-select-selector { height: @input-height-xs; } .@{inputClass}-affix-wrapper { &:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; .@{wd-prefix}-input-search & { border-top-left-radius: @border-radius-base; border-bottom-left-radius: @border-radius-base; } } &:not(:first-child), .@{wd-prefix}-input-search &:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; } } &&-compact { display: block; .clearfix(); &-addon, &-wrap, > .@{inputClass} { &:not(:first-child):not(:last-child) { border-right-width: @border-width-base; &:hover { z-index: 1; } &:focus { z-index: 1; } } } & > * { display: inline-block; float: none; vertical-align: top; // https://github.com/ant-design/ant-design-pro/issues/139 border-radius: 0; } & > .@{inputClass}-affix-wrapper { display: inline-flex; } & > .@{wd-prefix}-picker-range { display: inline-flex; } & > *:not(:last-child) { margin-right: -@border-width-base; border-right-width: @border-width-base; } // Undo float for .ant-input-group .ant-input .@{inputClass} { float: none; } // reset border for Select, DatePicker, AutoComplete, Cascader, Mention, TimePicker, Input & > .@{wd-prefix}-select > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-select-auto-complete .@{wd-prefix}-input, & > .@{wd-prefix}-cascader-picker .@{wd-prefix}-input, & > .@{wd-prefix}-input-group-wrapper .@{wd-prefix}-input { border-right-width: @border-width-base; border-radius: 0; &:hover { z-index: 1; } &:focus { z-index: 1; } } & > .@{wd-prefix}-select-focused { z-index: 1; } // update z-index for arrow icon & > .@{wd-prefix}-select > .@{wd-prefix}-select-arrow { z-index: 1; // https://github.com/ant-design/ant-design/issues/20371 } & > *:first-child, & > .@{wd-prefix}-select:first-child > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-select-auto-complete:first-child .@{wd-prefix}-input, & > .@{wd-prefix}-cascader-picker:first-child .@{wd-prefix}-input { border-top-left-radius: @border-radius-sm; border-bottom-left-radius: @border-radius-sm; } & > *:last-child, & > .@{wd-prefix}-select:last-child > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-cascader-picker:last-child .@{wd-prefix}-input, & > .@{wd-prefix}-cascader-picker-focused:last-child .@{wd-prefix}-input { border-right-width: @border-width-base; border-top-right-radius: @border-radius-sm; border-bottom-right-radius: @border-radius-sm; } // 处理big 和 large尺寸的圆角 & > *:first-child.@{wd-prefix}-input-bg, & > *:first-child.@{wd-prefix}-input-lg, & > .@{wd-prefix}-select:first-child.@{wd-prefix}-select-bg > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-select:first-child.@{wd-prefix}-select-lg > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-select-auto-complete:first-child .@{wd-prefix}-input-bg, & > .@{wd-prefix}-select-auto-complete:first-child .@{wd-prefix}-input-lg, & > .@{wd-prefix}-cascader-picker:first-child .@{wd-prefix}-input-bg, & > .@{wd-prefix}-cascader-picker:first-child .@{wd-prefix}-input-lg { border-top-left-radius: @border-radius-base; border-bottom-left-radius: @border-radius-base; } & > *:last-child.@{wd-prefix}-input-bg, & > *:last-child.@{wd-prefix}-input-lg, & > .@{wd-prefix}-select:last-child.@{wd-prefix}-select-bg > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-select:last-child.@{wd-prefix}-select-lg > .@{wd-prefix}-select-selector, & > .@{wd-prefix}-cascader-picker:last-child .@{wd-prefix}-input-bg, & > .@{wd-prefix}-cascader-picker:last-child .@{wd-prefix}-input-lg, & > .@{wd-prefix}-cascader-picker-focused:last-child .@{wd-prefix}-input-bg, & > .@{wd-prefix}-cascader-picker-focused:last-child .@{wd-prefix}-input-lg { border-top-right-radius: @border-radius-base; border-bottom-right-radius: @border-radius-base; } // https://github.com/ant-design/ant-design/issues/12493 & > .@{wd-prefix}-select-auto-complete .@{wd-prefix}-input { vertical-align: top; } .@{wd-prefix}-input-group-wrapper + .@{wd-prefix}-input-group-wrapper { margin-left: -1px; .@{wd-prefix}-input-affix-wrapper { border-radius: 0; } } .@{wd-prefix}-input-group-wrapper:not(:last-child) { &.@{wd-prefix}-input-search > .@{wd-prefix}-input-group { & > .@{wd-prefix}-input-group-addon > .@{wd-prefix}-input-search-button { border-radius: 0; } & > .@{wd-prefix}-input { border-radius: @border-radius-base 0 0 @border-radius-base; } } } } }