2019-09-12 20:15:17 +08:00
|
|
|
@import './index';
|
|
|
|
|
2020-12-25 13:13:07 +08:00
|
|
|
@select-overflow-prefix-cls: ~'@{select-prefix-cls}-selection-overflow';
|
2020-02-02 16:57:23 +08:00
|
|
|
@select-multiple-item-border-width: 1px;
|
|
|
|
|
2020-03-09 12:04:12 +08:00
|
|
|
@select-multiple-padding: max(
|
|
|
|
@input-padding-vertical-base - @select-multiple-item-border-width -
|
|
|
|
@select-multiple-item-spacing-half,
|
|
|
|
0
|
|
|
|
);
|
2019-09-12 20:15:17 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do not merge `height` & `line-height` under style with `selection` & `search`,
|
|
|
|
* since chrome may update to redesign with its align logic.
|
|
|
|
*/
|
|
|
|
|
2020-12-25 13:13:07 +08:00
|
|
|
// =========================== Overflow ===========================
|
|
|
|
.@{select-overflow-prefix-cls} {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
flex: auto;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
max-width: 100%;
|
|
|
|
|
|
|
|
&-item {
|
|
|
|
flex: none;
|
2021-01-21 15:54:19 +08:00
|
|
|
align-self: center;
|
2020-12-25 13:13:07 +08:00
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
.@{select-prefix-cls} {
|
|
|
|
&-multiple {
|
|
|
|
// ========================= Selector =========================
|
|
|
|
.@{select-prefix-cls}-selector {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
align-items: center;
|
|
|
|
// Multiple is little different that horizontal is follow the vertical
|
|
|
|
padding: @select-multiple-padding @input-padding-vertical-base;
|
|
|
|
|
|
|
|
.@{select-prefix-cls}-show-search& {
|
|
|
|
cursor: text;
|
|
|
|
}
|
2020-02-02 16:57:23 +08:00
|
|
|
|
2020-08-04 11:56:18 +08:00
|
|
|
.@{select-prefix-cls}-disabled& {
|
|
|
|
background: @select-multiple-disabled-background;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
&::after {
|
|
|
|
display: inline-block;
|
|
|
|
width: 0;
|
|
|
|
margin: @select-multiple-item-spacing-half 0;
|
|
|
|
line-height: @select-multiple-item-height;
|
|
|
|
content: '\a0';
|
|
|
|
}
|
2020-02-02 16:57:23 +08:00
|
|
|
}
|
2020-01-15 13:26:09 +08:00
|
|
|
|
2020-08-13 13:33:38 +08:00
|
|
|
&.@{select-prefix-cls}-show-arrow .@{select-prefix-cls}-selector,
|
2020-04-15 22:54:59 +08:00
|
|
|
&.@{select-prefix-cls}-allow-clear .@{select-prefix-cls}-selector {
|
|
|
|
padding-right: @font-size-sm + @control-padding-horizontal;
|
2019-09-12 20:15:17 +08:00
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
// ======================== Selections ========================
|
|
|
|
.@{select-prefix-cls}-selection-item {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
flex: none;
|
|
|
|
box-sizing: border-box;
|
|
|
|
max-width: 100%;
|
|
|
|
|
|
|
|
height: @select-multiple-item-height;
|
|
|
|
margin-top: @select-multiple-item-spacing-half;
|
|
|
|
margin-bottom: @select-multiple-item-spacing-half;
|
|
|
|
line-height: @select-multiple-item-height - @select-multiple-item-border-width * 2;
|
|
|
|
background: @select-selection-item-bg;
|
|
|
|
border: 1px solid @select-selection-item-border-color;
|
|
|
|
border-radius: @border-radius-base;
|
|
|
|
cursor: default;
|
|
|
|
transition: font-size 0.3s, line-height 0.3s, height 0.3s;
|
|
|
|
user-select: none;
|
2021-01-30 19:39:02 +08:00
|
|
|
margin-inline-end: @input-padding-vertical-base;
|
|
|
|
padding-inline-start: @padding-xs;
|
|
|
|
padding-inline-end: (@padding-xs / 2);
|
2020-04-15 22:54:59 +08:00
|
|
|
|
2020-08-04 11:56:18 +08:00
|
|
|
.@{select-prefix-cls}-disabled& {
|
|
|
|
color: @select-multiple-item-disabled-color;
|
|
|
|
border-color: @select-multiple-item-disabled-border-color;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
// It's ok not to do this, but 24px makes bottom narrow in view should adjust
|
|
|
|
&-content {
|
|
|
|
display: inline-block;
|
2020-12-25 14:31:44 +08:00
|
|
|
margin-right: (@padding-xs / 2);
|
2020-04-15 22:54:59 +08:00
|
|
|
overflow: hidden;
|
2020-11-14 16:30:13 +08:00
|
|
|
white-space: pre; // fix whitespace wrapping. custom tags display all whitespace within.
|
2020-04-15 22:54:59 +08:00
|
|
|
text-overflow: ellipsis;
|
2019-09-12 20:15:17 +08:00
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
&-remove {
|
|
|
|
.iconfont-mixin();
|
|
|
|
display: inline-block;
|
|
|
|
color: @text-color-secondary;
|
|
|
|
font-weight: bold;
|
2020-10-12 15:50:02 +08:00
|
|
|
font-size: 10px;
|
2020-04-15 22:54:59 +08:00
|
|
|
line-height: inherit;
|
|
|
|
cursor: pointer;
|
2020-05-08 18:13:38 +08:00
|
|
|
|
|
|
|
> .@{iconfont-css-prefix} {
|
|
|
|
vertical-align: -0.2em;
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
&:hover {
|
|
|
|
color: @icon-color-hover;
|
|
|
|
}
|
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
// ========================== Input ==========================
|
2020-12-25 13:13:07 +08:00
|
|
|
.@{select-overflow-prefix-cls}-item + .@{select-overflow-prefix-cls}-item {
|
|
|
|
.@{select-prefix-cls}-selection-search {
|
|
|
|
margin-inline-start: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
.@{select-prefix-cls}-selection-search {
|
|
|
|
position: relative;
|
2020-12-31 17:37:45 +08:00
|
|
|
max-width: 100%;
|
2020-12-25 13:13:07 +08:00
|
|
|
margin-top: @select-multiple-item-spacing-half;
|
|
|
|
margin-bottom: @select-multiple-item-spacing-half;
|
2020-12-31 17:37:45 +08:00
|
|
|
margin-inline-start: @input-padding-horizontal-base - @input-padding-vertical-base;
|
2020-04-07 15:41:16 +08:00
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
&-input,
|
|
|
|
&-mirror {
|
2020-12-25 13:13:07 +08:00
|
|
|
height: @select-multiple-item-height;
|
2020-04-15 22:54:59 +08:00
|
|
|
font-family: @font-family;
|
2020-12-25 13:13:07 +08:00
|
|
|
line-height: @select-multiple-item-height;
|
2020-04-15 22:54:59 +08:00
|
|
|
transition: all 0.3s;
|
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
&-input {
|
|
|
|
width: 100%;
|
2020-09-05 00:38:39 +08:00
|
|
|
min-width: 4.1px; // fix search cursor missing
|
2020-04-15 22:54:59 +08:00
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
&-mirror {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 999;
|
2020-11-14 16:30:13 +08:00
|
|
|
white-space: pre; // fix whitespace wrapping caused width calculation bug
|
2020-04-15 22:54:59 +08:00
|
|
|
visibility: hidden;
|
2020-02-02 16:57:23 +08:00
|
|
|
}
|
2020-04-15 22:54:59 +08:00
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
// ======================= Placeholder =======================
|
|
|
|
.@{select-prefix-cls}-selection-placeholder {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
right: @input-padding-horizontal;
|
|
|
|
left: @input-padding-horizontal;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
transition: all 0.3s;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================
|
|
|
|
// == Size ==
|
|
|
|
// ============================================================
|
|
|
|
.select-size(@suffix, @input-height) {
|
|
|
|
@merged-cls: ~'@{select-prefix-cls}-@{suffix}';
|
|
|
|
&.@{merged-cls} {
|
|
|
|
@select-selection-height: @input-height - @input-padding-vertical-base * 2;
|
|
|
|
@select-height-without-border: @input-height - @border-width-base * 2;
|
|
|
|
|
|
|
|
.@{select-prefix-cls}-selector::after {
|
|
|
|
line-height: @select-selection-height;
|
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
.@{select-prefix-cls}-selection-item {
|
2019-09-12 20:15:17 +08:00
|
|
|
height: @select-selection-height;
|
|
|
|
line-height: @select-selection-height - @border-width-base * 2;
|
|
|
|
}
|
2020-04-15 22:54:59 +08:00
|
|
|
|
|
|
|
.@{select-prefix-cls}-selection-search {
|
|
|
|
height: @select-selection-height + @select-multiple-padding;
|
|
|
|
line-height: @select-selection-height + @select-multiple-padding;
|
|
|
|
|
|
|
|
&-input,
|
|
|
|
&-mirror {
|
|
|
|
height: @select-selection-height;
|
|
|
|
line-height: @select-selection-height - @border-width-base * 2;
|
|
|
|
}
|
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
.select-size('lg', @input-height-lg);
|
|
|
|
.select-size('sm', @input-height-sm);
|
2020-01-13 23:39:42 +08:00
|
|
|
|
2020-04-15 22:54:59 +08:00
|
|
|
// Size small need additional set padding
|
|
|
|
&.@{select-prefix-cls}-sm {
|
|
|
|
.@{select-prefix-cls}-selection-placeholder {
|
|
|
|
left: @input-padding-horizontal-sm;
|
|
|
|
}
|
|
|
|
// https://github.com/ant-design/ant-design/issues/22906
|
|
|
|
.@{select-prefix-cls}-selection-search:first-child
|
|
|
|
.@{select-prefix-cls}-selection-search-input {
|
|
|
|
margin-left: 3px;
|
|
|
|
}
|
2020-01-13 23:39:42 +08:00
|
|
|
}
|
2020-04-15 22:54:59 +08:00
|
|
|
&.@{select-prefix-cls}-lg {
|
|
|
|
.@{select-prefix-cls}-selection-item {
|
|
|
|
height: @select-multiple-item-height-lg;
|
|
|
|
line-height: @select-multiple-item-height-lg;
|
|
|
|
}
|
2020-04-07 15:41:16 +08:00
|
|
|
}
|
2020-01-13 23:39:42 +08:00
|
|
|
}
|
2020-04-15 22:54:59 +08:00
|
|
|
|
|
|
|
&-disabled .@{select-prefix-cls}-selection-item-remove {
|
|
|
|
display: none;
|
2020-03-29 10:39:46 +08:00
|
|
|
}
|
2019-09-12 20:15:17 +08:00
|
|
|
}
|