multiple.less
6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
@import './index';
@select-multiple-item-border-width: 1px;
@select-multiple-padding: max(
@input-padding-vertical-base - @select-multiple-item-border-width -
@select-multiple-item-spacing-half,
0
);
/**
* Do not merge `height` & `line-height` under style with `selection` & `search`,
* since chrome may update to redesign with its align logic.
*/
.@{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;
}
.@{select-prefix-cls}-disabled& {
background: @select-multiple-disabled-background;
cursor: not-allowed;
}
&::after {
display: inline-block;
width: 0;
margin: @select-multiple-item-spacing-half 0;
line-height: @select-multiple-item-height;
content: '\a0';
}
}
&.@{select-prefix-cls}-show-arrow .@{select-prefix-cls}-selector,
&.@{select-prefix-cls}-allow-clear .@{select-prefix-cls}-selector {
padding-right: @font-size-sm + @control-padding-horizontal;
}
// ======================== 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-right: @input-padding-vertical-base;
margin-bottom: @select-multiple-item-spacing-half;
padding: 0 (@padding-xs / 2) 0 @padding-xs;
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;
.@{select-prefix-cls}-disabled& {
color: @select-multiple-item-disabled-color;
border-color: @select-multiple-item-disabled-border-color;
cursor: not-allowed;
}
// It's ok not to do this, but 24px makes bottom narrow in view should adjust
&-content {
display: inline-block;
margin-right: @padding-xs / 2;
overflow: hidden;
white-space: pre; // fix whitespace wrapping. custom tags display all whitespace within.
text-overflow: ellipsis;
}
&-remove {
.iconfont-mixin();
display: inline-block;
color: @text-color-secondary;
font-weight: bold;
font-size: 10px;
line-height: inherit;
cursor: pointer;
> .@{iconfont-css-prefix} {
vertical-align: -0.2em;
}
&:hover {
color: @icon-color-hover;
}
}
}
// ========================== Input ==========================
.@{select-prefix-cls}-selection-search {
position: relative;
margin-left: @select-multiple-padding / 2;
&-input,
&-mirror {
font-family: @font-family;
line-height: @line-height-base;
transition: all 0.3s;
}
&-input {
width: 100%;
min-width: 4.1px; // fix search cursor missing
}
&-mirror {
position: absolute;
top: 0;
left: 0;
z-index: 999;
white-space: pre; // fix whitespace wrapping caused width calculation bug
visibility: hidden;
}
// https://github.com/ant-design/ant-design/issues/22906
&:first-child > .@{select-prefix-cls}-selection-search-input {
margin-left: 6.5px !important;
}
}
// ======================= 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;
}
.@{select-prefix-cls}-selection-item {
height: @select-selection-height;
line-height: @select-selection-height - @border-width-base * 2;
}
.@{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;
}
}
}
}
.select-size('lg', @input-height-lg);
.select-size('sm', @input-height-sm);
// 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;
}
}
&.@{select-prefix-cls}-lg {
.@{select-prefix-cls}-selection-item {
height: @select-multiple-item-height-lg;
line-height: @select-multiple-item-height-lg;
}
}
}
&-disabled .@{select-prefix-cls}-selection-item-remove {
display: none;
}
}