You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

586 lines
13 KiB

@import '../../style/themes/default';
@import '../../style/mixins/index';
@import '../../input/style/mixin';
@select-prefix-cls: ~'@{ant-prefix}-select';
.selection__clear() {
display: inline-block;
font-style: normal;
vertical-align: baseline;
text-align: center;
text-transform: none;
text-rendering: auto;
opacity: 0;
position: absolute;
right: @control-padding-horizontal - 1px;
z-index: 1;
background: @component-background;
top: 50%;
font-size: @font-size-sm;
color: @disabled-color;
width: 12px;
height: 12px;
margin-top: -6px;
line-height: 12px;
cursor: pointer;
transition: color 0.3s ease, opacity 0.15s ease;
&:before {
display: block;
}
&:hover {
color: @text-color-secondary;
}
}
.@{select-prefix-cls} {
.reset-component;
display: inline-block;
position: relative;
outline: 0;
ul,
ol {
margin: 0;
padding: 0;
list-style: none;
}
> ul > li > a {
padding: 0;
background-color: @component-background;
}
// arrow
&-arrow {
.iconfont-mixin();
position: absolute;
top: 50%;
right: @control-padding-horizontal - 1px;
line-height: 1;
margin-top: -@font-size-sm / 2;
transform-origin: 50% 50%;
color: @disabled-color;
font-size: @font-size-sm;
& &-icon svg {
transition: transform 0.3s;
}
}
&-selection {
outline: none;
user-select: none;
box-sizing: border-box;
display: block;
background-color: @component-background;
9 years ago
border-radius: @border-radius-base;
border: @border-width-base @border-style-base @select-border-color;
// strange align fix for chrome but works
// https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
border-top-width: @border-width-base + 0.02px;
transition: all 0.3s @ease-in-out;
&:hover {
.hover;
}
.@{select-prefix-cls}-focused &,
&:focus,
&:active {
.active;
}
&__clear {
.selection__clear();
}
&:hover &__clear {
opacity: 1;
}
&-selected-value {
8 years ago
float: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
padding-right: 20px;
}
}
&-no-arrow &-selection-selected-value {
padding-right: 0;
}
10 years ago
&-disabled {
color: @disabled-color;
10 years ago
}
&-disabled &-selection {
background: @input-disabled-bg;
cursor: not-allowed;
&:hover,
&:focus,
&:active {
border-color: @select-border-color;
box-shadow: none;
10 years ago
}
&__clear {
display: none;
visibility: hidden;
pointer-events: none;
}
10 years ago
}
&-disabled &-selection--multiple &-selection__choice {
background: @background-color-base;
color: fade(@black, 33%);
padding-right: 10px;
&__remove {
display: none;
}
}
&-selection--single {
height: @input-height-base;
position: relative;
cursor: pointer;
}
&-selection__rendered {
display: block;
margin-left: @control-padding-horizontal - 1px;
margin-right: @control-padding-horizontal - 1px;
position: relative;
line-height: @input-height-base - 2px;
// https://github.com/ant-design/ant-design/issues/3481#issuecomment-254721026
&:after {
content: '.';
visibility: hidden;
pointer-events: none;
display: inline-block;
width: 0;
}
}
&-lg {
font-size: @font-size-lg;
.@{select-prefix-cls}-selection--single {
height: @input-height-lg;
9 years ago
}
.@{select-prefix-cls}-selection__rendered {
line-height: @input-height-lg - 2px;
}
.@{select-prefix-cls}-selection--multiple {
min-height: @input-height-lg;
.@{select-prefix-cls}-selection__rendered {
li {
height: @input-height-lg - 8px;
line-height: @input-height-lg - 8px;
9 years ago
}
}
.@{select-prefix-cls}-selection__clear {
top: @input-height-lg / 2;
}
9 years ago
}
}
&-sm {
.@{select-prefix-cls}-selection--single {
height: @input-height-sm;
}
.@{select-prefix-cls}-selection__rendered {
line-height: @input-height-sm - 2px;
margin: 0 @control-padding-horizontal-sm - 1px;
9 years ago
}
.@{select-prefix-cls}-selection--multiple {
min-height: @input-height-sm;
.@{select-prefix-cls}-selection__rendered {
li {
height: @input-height-sm - 8px;
line-height: @input-height-sm - 10px;
9 years ago
}
}
.@{select-prefix-cls}-selection__clear {
top: @input-height-sm / 2;
}
9 years ago
}
.@{select-prefix-cls}-selection__clear,
.@{select-prefix-cls}-arrow {
right: @control-padding-horizontal-sm;
}
9 years ago
}
10 years ago
&-disabled &-selection__choice__remove {
color: @disabled-color;
10 years ago
cursor: default;
&:hover {
color: @disabled-color;
10 years ago
}
}
9 years ago
&-search__field__wrap {
display: inline-block;
position: relative;
}
&-selection__placeholder,
&-search__field__placeholder {
// for TreeSelect compatibility
position: absolute;
9 years ago
top: 50%;
left: 0;
right: 9px;
color: @input-placeholder-color;
9 years ago
line-height: 20px;
height: 20px;
max-width: 100%;
9 years ago
margin-top: -10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
&-search__field__placeholder {
left: @control-padding-horizontal;
}
&-search__field__mirror {
position: absolute;
top: 0;
left: 0;
white-space: pre;
pointer-events: none;
opacity: 0;
}
10 years ago
&-search--inline {
position: absolute;
height: 100%;
width: 100%;
10 years ago
9 years ago
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
9 years ago
}
.@{select-prefix-cls}-search__field {
border-width: 0;
10 years ago
font-size: 100%;
height: 100%;
width: 100%;
10 years ago
background: transparent;
outline: 0;
border-radius: @border-radius-base;
line-height: 1;
10 years ago
}
9 years ago
10 years ago
> i {
float: right;
}
}
&-selection--multiple {
min-height: @input-height-base;
cursor: text;
padding-bottom: 3px;
.clearfix;
.@{select-prefix-cls}-search--inline {
float: left;
position: static;
10 years ago
width: auto;
padding: 0;
max-width: 100%;
.@{select-prefix-cls}-search__field {
max-width: 100%;
10 years ago
width: 0.75em;
}
}
.@{select-prefix-cls}-selection__rendered {
margin-left: 5px;
margin-bottom: -3px;
height: auto;
}
.@{select-prefix-cls}-selection__placeholder {
margin-left: 6px;
}
> ul > li,
.@{select-prefix-cls}-selection__rendered > ul > li {
// for tree-select
margin-top: 3px;
height: @input-height-base - 8px;
line-height: @input-height-base - 8px - 2px;
10 years ago
}
.@{select-prefix-cls}-selection__choice {
color: @tag-default-color;
background-color: @tag-default-bg;
border: 1px solid @border-color-split;
border-radius: @border-radius-sm;
cursor: default;
float: left;
margin-right: 4px;
max-width: 99%;
position: relative;
overflow: hidden;
transition: padding 0.3s @ease-in-out;
padding: 0 20px 0 10px;
&__disabled {
padding: 0 10px;
}
}
.@{select-prefix-cls}-selection__choice__content {
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
transition: margin 0.3s @ease-in-out;
}
.@{select-prefix-cls}-selection__choice__remove {
10 years ago
.iconfont-mixin();
color: @text-color-secondary;
9 years ago
line-height: inherit;
cursor: pointer;
display: inline-block;
font-weight: bold;
transition: all 0.3s;
font-size: @font-size-sm;
.iconfont-size-under-12px(10px);
position: absolute;
right: 4px;
&:hover {
color: @icon-color-hover;
}
}
.@{select-prefix-cls}-selection__clear {
top: @input-height-base / 2;
}
}
&-allow-clear &-selection--single &-selection-selected-value {
padding-right: 16px;
}
&-allow-clear &-selection--multiple &-selection__rendered {
margin-right: 20px; // In case that clear button will overlap content
}
9 years ago
&-open {
6 years ago
.@{select-prefix-cls}-arrow {
&-icon svg {
6 years ago
transform: rotate(180deg);
}
}
9 years ago
.@{select-prefix-cls}-selection {
.active();
}
}
9 years ago
&-combobox {
.@{select-prefix-cls}-arrow {
display: none;
}
9 years ago
.@{select-prefix-cls}-search--inline {
height: 100%;
width: 100%;
9 years ago
float: none;
}
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
}
.@{select-prefix-cls}-search__field {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
transition: all 0.3s @ease-in-out, height 0s;
box-shadow: none;
9 years ago
}
}
&-combobox&-allow-clear &-selection:hover &-selection__rendered {
margin-right: 20px; // In case that clear button will overlap content
}
9 years ago
}
.@{select-prefix-cls}-dropdown {
.reset-component;
// Fix select render lag of long text in chrome
// https://github.com/ant-design/ant-design/issues/11456
// https://github.com/ant-design/ant-design/issues/11843
font-variant: initial;
9 years ago
&.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
&.slide-up-appear.slide-up-appear-active&-placement-bottomLeft {
animation-name: antSlideUpIn;
}
9 years ago
&.slide-up-enter.slide-up-enter-active&-placement-topLeft,
&.slide-up-appear.slide-up-appear-active&-placement-topLeft {
animation-name: antSlideDownIn;
}
9 years ago
&.slide-up-leave.slide-up-leave-active&-placement-bottomLeft {
animation-name: antSlideUpOut;
}
9 years ago
&.slide-up-leave.slide-up-leave-active&-placement-topLeft {
animation-name: antSlideDownOut;
}
9 years ago
&-hidden {
display: none;
}
background-color: @component-background;
box-shadow: @box-shadow-base;
border-radius: @border-radius-base;
9 years ago
box-sizing: border-box;
9 years ago
z-index: @zindex-dropdown;
9 years ago
left: -9999px;
top: -9999px;
position: absolute;
outline: none;
font-size: @font-size-base;
9 years ago
&-menu {
outline: none;
9 years ago
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
max-height: 250px;
overflow: auto;
10 years ago
9 years ago
&-item-group-list {
margin: 0;
padding: 0;
> .@{select-prefix-cls}-dropdown-menu-item {
padding-left: 20px;
10 years ago
}
9 years ago
}
10 years ago
9 years ago
&-item-group-title {
color: @text-color-secondary;
padding: 0 @control-padding-horizontal;
height: 32px;
line-height: 32px;
font-size: @font-size-sm;
9 years ago
}
9 years ago
&-item-group-list &-item:first-child:not(:last-child),
&-item-group:not(:last-child) &-item-group-list &-item:last-child {
border-radius: 0;
}
9 years ago
&-item {
position: relative;
display: block;
padding: 5px @control-padding-horizontal;
line-height: 22px;
9 years ago
font-weight: normal;
8 years ago
color: @text-color;
9 years ago
white-space: nowrap;
cursor: pointer;
9 years ago
overflow: hidden;
text-overflow: ellipsis;
transition: background 0.3s ease;
9 years ago
&:hover {
background-color: @item-hover-bg;
}
&:first-child {
border-radius: @border-radius-base @border-radius-base 0 0;
}
&:last-child {
border-radius: 0 0 @border-radius-base @border-radius-base;
}
9 years ago
&-disabled {
color: @disabled-color;
9 years ago
cursor: not-allowed;
10 years ago
9 years ago
&:hover {
color: @disabled-color;
background-color: @component-background;
10 years ago
cursor: not-allowed;
}
9 years ago
}
10 years ago
&-selected {
&,
&:hover {
background-color: @background-color-light;
font-weight: 600;
8 years ago
color: @text-color;
}
}
&-active {
background-color: @item-active-bg;
}
9 years ago
&-divider {
height: 1px;
margin: 1px 0;
overflow: hidden;
background-color: @border-color-split;
9 years ago
line-height: 0;
10 years ago
}
}
}
&&--multiple {
.@{select-prefix-cls}-dropdown-menu-item {
6 years ago
padding-right: @control-padding-horizontal + 20;
& .@{select-prefix-cls}-selected-icon {
color: transparent;
.iconfont-size-under-12px(10px);
transition: all 0.2s ease;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: @control-padding-horizontal;
font-weight: bold;
text-shadow: 0 0.1px 0, 0.1px 0 0, 0 -0.1px 0, -0.1px 0;
}
&:hover .@{select-prefix-cls}-selected-icon {
color: fade(@black, 87%);
}
&-disabled .@{select-prefix-cls}-selected-icon {
display: none;
}
&-selected .@{select-prefix-cls}-selected-icon,
&-selected:hover .@{select-prefix-cls}-selected-icon {
color: @primary-color;
display: inline-block;
}
}
}
&-container-open,
&-open {
.@{select-prefix-cls}-dropdown {
10 years ago
display: block;
}
}
10 years ago
}