@douyinfe/semi-foundation 2.25.0 → 2.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cascader/cascader.scss +8 -20
- package/lib/cjs/cascader/cascader.css +3 -3
- package/lib/cjs/cascader/cascader.scss +8 -20
- package/lib/cjs/overflowList/constants.d.ts +6 -4
- package/lib/cjs/overflowList/constants.js +3 -1
- package/lib/cjs/overflowList/foundation.d.ts +3 -1
- package/lib/cjs/overflowList/foundation.js +59 -38
- package/lib/cjs/tagInput/tagInput.css +9 -0
- package/lib/cjs/tagInput/tagInput.scss +11 -0
- package/lib/cjs/tooltip/foundation.js +1 -1
- package/lib/cjs/treeSelect/treeSelect.css +6 -8
- package/lib/cjs/treeSelect/treeSelect.scss +9 -19
- package/lib/es/cascader/cascader.css +3 -3
- package/lib/es/cascader/cascader.scss +8 -20
- package/lib/es/overflowList/constants.d.ts +6 -4
- package/lib/es/overflowList/constants.js +3 -1
- package/lib/es/overflowList/foundation.d.ts +3 -1
- package/lib/es/overflowList/foundation.js +59 -38
- package/lib/es/tagInput/tagInput.css +9 -0
- package/lib/es/tagInput/tagInput.scss +11 -0
- package/lib/es/tooltip/foundation.js +1 -1
- package/lib/es/treeSelect/treeSelect.css +6 -8
- package/lib/es/treeSelect/treeSelect.scss +9 -19
- package/overflowList/constants.ts +4 -2
- package/overflowList/foundation.ts +46 -30
- package/package.json +2 -2
- package/tagInput/tagInput.scss +11 -0
- package/tooltip/foundation.ts +1 -1
- package/treeSelect/treeSelect.scss +9 -19
package/cascader/cascader.scss
CHANGED
|
@@ -161,22 +161,17 @@ $module: #{$prefix}-cascader;
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.#{$prefix}-tagInput {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
&-large {
|
|
174
|
-
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
175
|
-
}
|
|
164
|
+
min-height: $height-cascader_selection_tagInput_wrapper_default;
|
|
165
|
+
|
|
166
|
+
&-small {
|
|
167
|
+
min-height: $height-cascader_selection_tagInput_wrapper_small;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&-large {
|
|
171
|
+
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
.#{$prefix}-input-wrapper {
|
|
179
|
-
// height: $height-cascader_selection_tagInput_input_default;
|
|
180
175
|
|
|
181
176
|
margin-left: $spacing-cascader_selection_input-marginLeft;
|
|
182
177
|
.#{$prefix}-input {
|
|
@@ -193,13 +188,6 @@ $module: #{$prefix}-cascader;
|
|
|
193
188
|
margin-bottom: $spacing-cascader_selection_tag-marginY;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
// .#{$prefix}-input-wrapper-small {
|
|
198
|
-
// height: $height-cascader_selection_tagInput_input_small;
|
|
199
|
-
// }
|
|
200
|
-
// .#{$prefix}-input-wrapper-large {
|
|
201
|
-
// height: $height-cascader_selection_tagInput_input_large;
|
|
202
|
-
// }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
&-text {
|
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
background: transparent;
|
|
137
137
|
margin-left: -4px;
|
|
138
138
|
}
|
|
139
|
-
.semi-cascader-selection .semi-tagInput
|
|
139
|
+
.semi-cascader-selection .semi-tagInput {
|
|
140
140
|
min-height: 30px;
|
|
141
141
|
}
|
|
142
|
-
.semi-cascader-selection .semi-tagInput-
|
|
142
|
+
.semi-cascader-selection .semi-tagInput-small {
|
|
143
143
|
min-height: 22px;
|
|
144
144
|
}
|
|
145
|
-
.semi-cascader-selection .semi-tagInput-
|
|
145
|
+
.semi-cascader-selection .semi-tagInput-large {
|
|
146
146
|
min-height: 38px;
|
|
147
147
|
}
|
|
148
148
|
.semi-cascader-selection .semi-tagInput .semi-input-wrapper {
|
|
@@ -161,22 +161,17 @@ $module: #{$prefix}-cascader;
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.#{$prefix}-tagInput {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
&-large {
|
|
174
|
-
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
175
|
-
}
|
|
164
|
+
min-height: $height-cascader_selection_tagInput_wrapper_default;
|
|
165
|
+
|
|
166
|
+
&-small {
|
|
167
|
+
min-height: $height-cascader_selection_tagInput_wrapper_small;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&-large {
|
|
171
|
+
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
.#{$prefix}-input-wrapper {
|
|
179
|
-
// height: $height-cascader_selection_tagInput_input_default;
|
|
180
175
|
|
|
181
176
|
margin-left: $spacing-cascader_selection_input-marginLeft;
|
|
182
177
|
.#{$prefix}-input {
|
|
@@ -193,13 +188,6 @@ $module: #{$prefix}-cascader;
|
|
|
193
188
|
margin-bottom: $spacing-cascader_selection_tag-marginY;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
// .#{$prefix}-input-wrapper-small {
|
|
198
|
-
// height: $height-cascader_selection_tagInput_input_small;
|
|
199
|
-
// }
|
|
200
|
-
// .#{$prefix}-input-wrapper-large {
|
|
201
|
-
// height: $height-cascader_selection_tagInput_input_large;
|
|
202
|
-
// }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
&-text {
|
|
@@ -2,7 +2,7 @@ declare const cssClasses: {
|
|
|
2
2
|
PREFIX: string;
|
|
3
3
|
};
|
|
4
4
|
declare const strings: {
|
|
5
|
-
BOUNDARY_SET:
|
|
5
|
+
BOUNDARY_SET: ("end" | "start")[];
|
|
6
6
|
POSITION_SET: string[];
|
|
7
7
|
MODE_SET: string[];
|
|
8
8
|
MODE_MAP: {
|
|
@@ -10,8 +10,8 @@ declare const strings: {
|
|
|
10
10
|
SCROLL: string;
|
|
11
11
|
};
|
|
12
12
|
BOUNDARY_MAP: {
|
|
13
|
-
START:
|
|
14
|
-
END:
|
|
13
|
+
readonly START: "start";
|
|
14
|
+
readonly END: "end";
|
|
15
15
|
};
|
|
16
16
|
OVERFLOW_DIR: {
|
|
17
17
|
NONE: number;
|
|
@@ -19,5 +19,7 @@ declare const strings: {
|
|
|
19
19
|
SHRINK: number;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
declare const numbers: {
|
|
22
|
+
declare const numbers: {
|
|
23
|
+
MINIMUM_HTML_ELEMENT_WIDTH: number;
|
|
24
|
+
};
|
|
23
25
|
export { cssClasses, strings, numbers };
|
|
@@ -3,6 +3,7 @@ export interface OverflowListAdapter extends DefaultAdapter {
|
|
|
3
3
|
updateStates: (state: any) => void;
|
|
4
4
|
updateVisibleState: (visible: Map<string, boolean>) => void;
|
|
5
5
|
notifyIntersect: (res: any) => void;
|
|
6
|
+
getItemSizeMap: () => Map<string, number>;
|
|
6
7
|
}
|
|
7
8
|
declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
8
9
|
constructor(adapter: OverflowListAdapter);
|
|
@@ -10,6 +11,7 @@ declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter>
|
|
|
10
11
|
isScrollMode: () => boolean;
|
|
11
12
|
getOverflowItem(): Array<Array<Record<string, any>>>;
|
|
12
13
|
handleIntersect(entries: Array<IntersectionObserverEntry>): void;
|
|
13
|
-
|
|
14
|
+
getReversedItems: () => any;
|
|
15
|
+
handleCollapseOverflow(): void;
|
|
14
16
|
}
|
|
15
17
|
export default OverflowListFoundation;
|
|
@@ -29,6 +29,13 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
29
29
|
} = this.getProps();
|
|
30
30
|
return renderMode === 'scroll';
|
|
31
31
|
};
|
|
32
|
+
|
|
33
|
+
this.getReversedItems = () => {
|
|
34
|
+
const {
|
|
35
|
+
items
|
|
36
|
+
} = this.getProps();
|
|
37
|
+
return (0, _cloneDeep2.default)(items).reverse();
|
|
38
|
+
};
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
getOverflowItem() {
|
|
@@ -95,54 +102,68 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
95
102
|
this._adapter.notifyIntersect(res);
|
|
96
103
|
}
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
handleCollapseOverflow() {
|
|
106
|
+
const {
|
|
107
|
+
minVisibleItems,
|
|
108
|
+
collapseFrom
|
|
109
|
+
} = this.getProps();
|
|
99
110
|
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
overflowWidth,
|
|
112
|
+
containerWidth,
|
|
113
|
+
pivot: statePivot,
|
|
114
|
+
overflowStatus
|
|
104
115
|
} = this.getStates();
|
|
105
116
|
const {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
items
|
|
117
|
+
items,
|
|
118
|
+
onOverflow
|
|
109
119
|
} = this.getProps();
|
|
110
|
-
let
|
|
120
|
+
let itemWidths = overflowWidth,
|
|
121
|
+
_pivot = 0;
|
|
122
|
+
let overflowed = false;
|
|
111
123
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
direction: OverflowDirection.NONE
|
|
115
|
-
};
|
|
116
|
-
}
|
|
124
|
+
for (const size of this._adapter.getItemSizeMap().values()) {
|
|
125
|
+
itemWidths += size; // 触发overflow
|
|
117
126
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
lastOverflowCount: updatedOverflowCount,
|
|
123
|
-
overflow: [],
|
|
124
|
-
visible: items
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
+
if (itemWidths > containerWidth) {
|
|
128
|
+
overflowed = true;
|
|
129
|
+
break;
|
|
130
|
+
} // 顺利遍历完整个列表,说明不存在overflow,直接渲染全部
|
|
127
131
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
direction: direction !== OverflowDirection.GROW ? OverflowDirection.SHRINK : direction,
|
|
139
|
-
overflow: collapseFromStart ? [...overflow, next] : [next, ...overflow],
|
|
140
|
-
visible: newVisible
|
|
141
|
-
};
|
|
132
|
+
|
|
133
|
+
if (_pivot === items.length - 1) {
|
|
134
|
+
this._adapter.updateStates({
|
|
135
|
+
overflowStatus: "normal",
|
|
136
|
+
pivot: items.length - 1,
|
|
137
|
+
visible: items,
|
|
138
|
+
overflow: []
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
break;
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
_pivot++;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
if (overflowed) {
|
|
148
|
+
const pivot = Math.max(minVisibleItems, _pivot);
|
|
149
|
+
const isCollapseFromStart = collapseFrom === Boundary.START;
|
|
150
|
+
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).reverse() : items.slice(0, pivot);
|
|
151
|
+
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).reverse() : items.slice(pivot);
|
|
152
|
+
|
|
153
|
+
this._adapter.updateStates({
|
|
154
|
+
overflowStatus: "overflowed",
|
|
155
|
+
pivot: pivot,
|
|
156
|
+
visible,
|
|
157
|
+
overflow
|
|
158
|
+
}); // trigger onOverflow
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if (statePivot !== pivot) {
|
|
162
|
+
onOverflow(overflow);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
146
167
|
}
|
|
147
168
|
|
|
148
169
|
}
|
|
@@ -208,6 +208,15 @@
|
|
|
208
208
|
.semi-tagInput-suffix-text {
|
|
209
209
|
color: var(--semi-color-text-2);
|
|
210
210
|
}
|
|
211
|
+
.semi-tagInput-tag-content-wrapper {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
}
|
|
215
|
+
.semi-tagInput-sortable-list {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-flow: row wrap;
|
|
218
|
+
width: 100%;
|
|
219
|
+
}
|
|
211
220
|
|
|
212
221
|
.semi-rtl .semi-tagInput,
|
|
213
222
|
.semi-portal-rtl .semi-tagInput {
|
|
@@ -259,6 +259,17 @@ $module: #{$prefix}-tagInput;
|
|
|
259
259
|
color: $color-tagInput_suffix-default;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
&-tag-content-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&-sortable-list {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-flow: row wrap;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
@import "./rtl.scss";
|
|
@@ -944,7 +944,7 @@ class Tooltip extends _foundation.default {
|
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
947
|
-
position = this._adjustPos(position
|
|
947
|
+
position = this._adjustPos(position);
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
@@ -139,20 +139,18 @@
|
|
|
139
139
|
.semi-tree-select-selection .semi-tagInput {
|
|
140
140
|
border: hidden;
|
|
141
141
|
background: transparent;
|
|
142
|
-
}
|
|
143
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
144
|
-
padding-left: 4px;
|
|
145
|
-
padding-right: 4px;
|
|
146
|
-
}
|
|
147
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper-default {
|
|
148
142
|
min-height: 30px;
|
|
149
143
|
}
|
|
150
|
-
.semi-tree-select-selection .semi-tagInput
|
|
144
|
+
.semi-tree-select-selection .semi-tagInput-small {
|
|
151
145
|
min-height: 22px;
|
|
152
146
|
}
|
|
153
|
-
.semi-tree-select-selection .semi-tagInput
|
|
147
|
+
.semi-tree-select-selection .semi-tagInput-large {
|
|
154
148
|
min-height: 38px;
|
|
155
149
|
}
|
|
150
|
+
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
151
|
+
padding-left: 4px;
|
|
152
|
+
padding-right: 4px;
|
|
153
|
+
}
|
|
156
154
|
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper .semi-input-wrapper .semi-input {
|
|
157
155
|
padding-left: 0;
|
|
158
156
|
}
|
|
@@ -171,23 +171,20 @@ $module: #{$prefix}-tree-select;
|
|
|
171
171
|
.#{$prefix}-tagInput {
|
|
172
172
|
border: hidden;
|
|
173
173
|
background: transparent;
|
|
174
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&-large {
|
|
181
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
.#{$prefix}-tagInput-wrapper {
|
|
176
185
|
padding-left: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
177
186
|
padding-right: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
178
187
|
|
|
179
|
-
&-default {
|
|
180
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&-small {
|
|
184
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&-large {
|
|
188
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
188
|
.#{$prefix}-input-wrapper {
|
|
192
189
|
// height: $height-treeSelect_selection_tagInput_input_default;
|
|
193
190
|
|
|
@@ -205,13 +202,6 @@ $module: #{$prefix}-tree-select;
|
|
|
205
202
|
margin-bottom: $spacing-treeSelect_tag-marginY;
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
// .#{$prefix}-input-wrapper-small {
|
|
210
|
-
// height: $height-treeSelect_selection_tagInput_input_small;
|
|
211
|
-
// }
|
|
212
|
-
// .#{$prefix}-input-wrapper-large {
|
|
213
|
-
// height: $height-treeSelect_selection_tagInput_input_large;
|
|
214
|
-
// }
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
207
|
}
|
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
background: transparent;
|
|
137
137
|
margin-left: -4px;
|
|
138
138
|
}
|
|
139
|
-
.semi-cascader-selection .semi-tagInput
|
|
139
|
+
.semi-cascader-selection .semi-tagInput {
|
|
140
140
|
min-height: 30px;
|
|
141
141
|
}
|
|
142
|
-
.semi-cascader-selection .semi-tagInput-
|
|
142
|
+
.semi-cascader-selection .semi-tagInput-small {
|
|
143
143
|
min-height: 22px;
|
|
144
144
|
}
|
|
145
|
-
.semi-cascader-selection .semi-tagInput-
|
|
145
|
+
.semi-cascader-selection .semi-tagInput-large {
|
|
146
146
|
min-height: 38px;
|
|
147
147
|
}
|
|
148
148
|
.semi-cascader-selection .semi-tagInput .semi-input-wrapper {
|
|
@@ -161,22 +161,17 @@ $module: #{$prefix}-cascader;
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
.#{$prefix}-tagInput {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
&-large {
|
|
174
|
-
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
175
|
-
}
|
|
164
|
+
min-height: $height-cascader_selection_tagInput_wrapper_default;
|
|
165
|
+
|
|
166
|
+
&-small {
|
|
167
|
+
min-height: $height-cascader_selection_tagInput_wrapper_small;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&-large {
|
|
171
|
+
min-height: $height-cascader_selection_tagInput_wrapper_large;
|
|
176
172
|
}
|
|
177
173
|
|
|
178
174
|
.#{$prefix}-input-wrapper {
|
|
179
|
-
// height: $height-cascader_selection_tagInput_input_default;
|
|
180
175
|
|
|
181
176
|
margin-left: $spacing-cascader_selection_input-marginLeft;
|
|
182
177
|
.#{$prefix}-input {
|
|
@@ -193,13 +188,6 @@ $module: #{$prefix}-cascader;
|
|
|
193
188
|
margin-bottom: $spacing-cascader_selection_tag-marginY;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
// .#{$prefix}-input-wrapper-small {
|
|
198
|
-
// height: $height-cascader_selection_tagInput_input_small;
|
|
199
|
-
// }
|
|
200
|
-
// .#{$prefix}-input-wrapper-large {
|
|
201
|
-
// height: $height-cascader_selection_tagInput_input_large;
|
|
202
|
-
// }
|
|
203
191
|
}
|
|
204
192
|
|
|
205
193
|
&-text {
|
|
@@ -2,7 +2,7 @@ declare const cssClasses: {
|
|
|
2
2
|
PREFIX: string;
|
|
3
3
|
};
|
|
4
4
|
declare const strings: {
|
|
5
|
-
BOUNDARY_SET:
|
|
5
|
+
BOUNDARY_SET: ("end" | "start")[];
|
|
6
6
|
POSITION_SET: string[];
|
|
7
7
|
MODE_SET: string[];
|
|
8
8
|
MODE_MAP: {
|
|
@@ -10,8 +10,8 @@ declare const strings: {
|
|
|
10
10
|
SCROLL: string;
|
|
11
11
|
};
|
|
12
12
|
BOUNDARY_MAP: {
|
|
13
|
-
START:
|
|
14
|
-
END:
|
|
13
|
+
readonly START: "start";
|
|
14
|
+
readonly END: "end";
|
|
15
15
|
};
|
|
16
16
|
OVERFLOW_DIR: {
|
|
17
17
|
NONE: number;
|
|
@@ -19,5 +19,7 @@ declare const strings: {
|
|
|
19
19
|
SHRINK: number;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
declare const numbers: {
|
|
22
|
+
declare const numbers: {
|
|
23
|
+
MINIMUM_HTML_ELEMENT_WIDTH: number;
|
|
24
|
+
};
|
|
23
25
|
export { cssClasses, strings, numbers };
|
|
@@ -3,6 +3,7 @@ export interface OverflowListAdapter extends DefaultAdapter {
|
|
|
3
3
|
updateStates: (state: any) => void;
|
|
4
4
|
updateVisibleState: (visible: Map<string, boolean>) => void;
|
|
5
5
|
notifyIntersect: (res: any) => void;
|
|
6
|
+
getItemSizeMap: () => Map<string, number>;
|
|
6
7
|
}
|
|
7
8
|
declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
8
9
|
constructor(adapter: OverflowListAdapter);
|
|
@@ -10,6 +11,7 @@ declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter>
|
|
|
10
11
|
isScrollMode: () => boolean;
|
|
11
12
|
getOverflowItem(): Array<Array<Record<string, any>>>;
|
|
12
13
|
handleIntersect(entries: Array<IntersectionObserverEntry>): void;
|
|
13
|
-
|
|
14
|
+
getReversedItems: () => any;
|
|
15
|
+
handleCollapseOverflow(): void;
|
|
14
16
|
}
|
|
15
17
|
export default OverflowListFoundation;
|
|
@@ -16,6 +16,13 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
16
16
|
} = this.getProps();
|
|
17
17
|
return renderMode === 'scroll';
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
this.getReversedItems = () => {
|
|
21
|
+
const {
|
|
22
|
+
items
|
|
23
|
+
} = this.getProps();
|
|
24
|
+
return _cloneDeep(items).reverse();
|
|
25
|
+
};
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
getOverflowItem() {
|
|
@@ -84,54 +91,68 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
84
91
|
this._adapter.notifyIntersect(res);
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
handleCollapseOverflow() {
|
|
95
|
+
const {
|
|
96
|
+
minVisibleItems,
|
|
97
|
+
collapseFrom
|
|
98
|
+
} = this.getProps();
|
|
88
99
|
const {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
overflowWidth,
|
|
101
|
+
containerWidth,
|
|
102
|
+
pivot: statePivot,
|
|
103
|
+
overflowStatus
|
|
93
104
|
} = this.getStates();
|
|
94
105
|
const {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
items
|
|
106
|
+
items,
|
|
107
|
+
onOverflow
|
|
98
108
|
} = this.getProps();
|
|
99
|
-
let
|
|
109
|
+
let itemWidths = overflowWidth,
|
|
110
|
+
_pivot = 0;
|
|
111
|
+
let overflowed = false;
|
|
100
112
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
direction: OverflowDirection.NONE
|
|
104
|
-
};
|
|
105
|
-
}
|
|
113
|
+
for (const size of this._adapter.getItemSizeMap().values()) {
|
|
114
|
+
itemWidths += size; // 触发overflow
|
|
106
115
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
lastOverflowCount: updatedOverflowCount,
|
|
112
|
-
overflow: [],
|
|
113
|
-
visible: items
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
+
if (itemWidths > containerWidth) {
|
|
117
|
+
overflowed = true;
|
|
118
|
+
break;
|
|
119
|
+
} // 顺利遍历完整个列表,说明不存在overflow,直接渲染全部
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
direction: direction !== OverflowDirection.GROW ? OverflowDirection.SHRINK : direction,
|
|
128
|
-
overflow: collapseFromStart ? [...overflow, next] : [next, ...overflow],
|
|
129
|
-
visible: newVisible
|
|
130
|
-
};
|
|
121
|
+
|
|
122
|
+
if (_pivot === items.length - 1) {
|
|
123
|
+
this._adapter.updateStates({
|
|
124
|
+
overflowStatus: "normal",
|
|
125
|
+
pivot: items.length - 1,
|
|
126
|
+
visible: items,
|
|
127
|
+
overflow: []
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
_pivot++;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
if (overflowed) {
|
|
137
|
+
const pivot = Math.max(minVisibleItems, _pivot);
|
|
138
|
+
const isCollapseFromStart = collapseFrom === Boundary.START;
|
|
139
|
+
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).reverse() : items.slice(0, pivot);
|
|
140
|
+
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).reverse() : items.slice(pivot);
|
|
141
|
+
|
|
142
|
+
this._adapter.updateStates({
|
|
143
|
+
overflowStatus: "overflowed",
|
|
144
|
+
pivot: pivot,
|
|
145
|
+
visible,
|
|
146
|
+
overflow
|
|
147
|
+
}); // trigger onOverflow
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
if (statePivot !== pivot) {
|
|
151
|
+
onOverflow(overflow);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
135
156
|
}
|
|
136
157
|
|
|
137
158
|
}
|
|
@@ -208,6 +208,15 @@
|
|
|
208
208
|
.semi-tagInput-suffix-text {
|
|
209
209
|
color: var(--semi-color-text-2);
|
|
210
210
|
}
|
|
211
|
+
.semi-tagInput-tag-content-wrapper {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
}
|
|
215
|
+
.semi-tagInput-sortable-list {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-flow: row wrap;
|
|
218
|
+
width: 100%;
|
|
219
|
+
}
|
|
211
220
|
|
|
212
221
|
.semi-rtl .semi-tagInput,
|
|
213
222
|
.semi-portal-rtl .semi-tagInput {
|
|
@@ -259,6 +259,17 @@ $module: #{$prefix}-tagInput;
|
|
|
259
259
|
color: $color-tagInput_suffix-default;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
&-tag-content-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&-sortable-list {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-flow: row wrap;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
@import "./rtl.scss";
|
|
@@ -934,7 +934,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
937
|
-
position = this._adjustPos(position
|
|
937
|
+
position = this._adjustPos(position);
|
|
938
938
|
}
|
|
939
939
|
|
|
940
940
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
@@ -139,20 +139,18 @@
|
|
|
139
139
|
.semi-tree-select-selection .semi-tagInput {
|
|
140
140
|
border: hidden;
|
|
141
141
|
background: transparent;
|
|
142
|
-
}
|
|
143
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
144
|
-
padding-left: 4px;
|
|
145
|
-
padding-right: 4px;
|
|
146
|
-
}
|
|
147
|
-
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper-default {
|
|
148
142
|
min-height: 30px;
|
|
149
143
|
}
|
|
150
|
-
.semi-tree-select-selection .semi-tagInput
|
|
144
|
+
.semi-tree-select-selection .semi-tagInput-small {
|
|
151
145
|
min-height: 22px;
|
|
152
146
|
}
|
|
153
|
-
.semi-tree-select-selection .semi-tagInput
|
|
147
|
+
.semi-tree-select-selection .semi-tagInput-large {
|
|
154
148
|
min-height: 38px;
|
|
155
149
|
}
|
|
150
|
+
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper {
|
|
151
|
+
padding-left: 4px;
|
|
152
|
+
padding-right: 4px;
|
|
153
|
+
}
|
|
156
154
|
.semi-tree-select-selection .semi-tagInput .semi-tagInput-wrapper .semi-input-wrapper .semi-input {
|
|
157
155
|
padding-left: 0;
|
|
158
156
|
}
|
|
@@ -171,23 +171,20 @@ $module: #{$prefix}-tree-select;
|
|
|
171
171
|
.#{$prefix}-tagInput {
|
|
172
172
|
border: hidden;
|
|
173
173
|
background: transparent;
|
|
174
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&-large {
|
|
181
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
.#{$prefix}-tagInput-wrapper {
|
|
176
185
|
padding-left: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
177
186
|
padding-right: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
178
187
|
|
|
179
|
-
&-default {
|
|
180
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&-small {
|
|
184
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&-large {
|
|
188
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
188
|
.#{$prefix}-input-wrapper {
|
|
192
189
|
// height: $height-treeSelect_selection_tagInput_input_default;
|
|
193
190
|
|
|
@@ -205,13 +202,6 @@ $module: #{$prefix}-tree-select;
|
|
|
205
202
|
margin-bottom: $spacing-treeSelect_tag-marginY;
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
// .#{$prefix}-input-wrapper-small {
|
|
210
|
-
// height: $height-treeSelect_selection_tagInput_input_small;
|
|
211
|
-
// }
|
|
212
|
-
// .#{$prefix}-input-wrapper-large {
|
|
213
|
-
// height: $height-treeSelect_selection_tagInput_input_large;
|
|
214
|
-
// }
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
207
|
}
|
|
@@ -14,7 +14,7 @@ const MODE_MAP = {
|
|
|
14
14
|
const BOUNDARY_MAP = {
|
|
15
15
|
START: 'start',
|
|
16
16
|
END: 'end',
|
|
17
|
-
};
|
|
17
|
+
} as const;
|
|
18
18
|
|
|
19
19
|
const OVERFLOW_DIR = {
|
|
20
20
|
NONE: 0,
|
|
@@ -31,7 +31,9 @@ const strings = {
|
|
|
31
31
|
OVERFLOW_DIR
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const numbers = {
|
|
34
|
+
const numbers = {
|
|
35
|
+
MINIMUM_HTML_ELEMENT_WIDTH: 4
|
|
36
|
+
};
|
|
35
37
|
|
|
36
38
|
export {
|
|
37
39
|
cssClasses,
|
|
@@ -7,7 +7,8 @@ const OverflowDirection = strings.OVERFLOW_DIR;
|
|
|
7
7
|
export interface OverflowListAdapter extends DefaultAdapter {
|
|
8
8
|
updateStates: (state: any) => void;
|
|
9
9
|
updateVisibleState: (visible: Map<string, boolean>) => void;
|
|
10
|
-
notifyIntersect: (res: any) => void
|
|
10
|
+
notifyIntersect: (res: any) => void;
|
|
11
|
+
getItemSizeMap: ()=>Map<string, number>
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
@@ -29,6 +30,7 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
|
29
30
|
if (!this.isScrollMode()) {
|
|
30
31
|
return overflow;
|
|
31
32
|
}
|
|
33
|
+
|
|
32
34
|
const visibleStateArr = items.map(({ key }: { key: string }) => Boolean(visibleState.get(key)));
|
|
33
35
|
const visibleStart = visibleStateArr.indexOf(true);
|
|
34
36
|
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
@@ -71,38 +73,52 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
|
71
73
|
this._adapter.notifyIntersect(res);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
const {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
getReversedItems = ()=>{
|
|
77
|
+
const { items } = this.getProps();
|
|
78
|
+
return cloneDeep(items).reverse();
|
|
79
|
+
}
|
|
80
|
+
handleCollapseOverflow(){
|
|
81
|
+
const { minVisibleItems, collapseFrom } = this.getProps();
|
|
82
|
+
const { overflowWidth, containerWidth, pivot: statePivot, overflowStatus } = this.getStates();
|
|
83
|
+
const { items, onOverflow } = this.getProps();
|
|
84
|
+
let itemWidths = overflowWidth, _pivot = 0;
|
|
85
|
+
let overflowed = false;
|
|
86
|
+
for (const size of this._adapter.getItemSizeMap().values()) {
|
|
87
|
+
itemWidths += size;
|
|
88
|
+
// 触发overflow
|
|
89
|
+
if (itemWidths > containerWidth) {
|
|
90
|
+
overflowed = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
// 顺利遍历完整个列表,说明不存在overflow,直接渲染全部
|
|
94
|
+
if (_pivot === items.length - 1) {
|
|
95
|
+
this._adapter.updateStates({
|
|
96
|
+
overflowStatus: "normal",
|
|
97
|
+
pivot: items.length - 1,
|
|
98
|
+
visible: items,
|
|
99
|
+
overflow: []
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
_pivot++;
|
|
89
104
|
}
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
if (overflowed) {
|
|
106
|
+
const pivot = Math.max(minVisibleItems, _pivot);
|
|
107
|
+
const isCollapseFromStart = collapseFrom === Boundary.START;
|
|
108
|
+
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).reverse() : items.slice(0, pivot);
|
|
109
|
+
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).reverse() : items.slice(pivot);
|
|
110
|
+
this._adapter.updateStates({
|
|
111
|
+
overflowStatus: "overflowed",
|
|
112
|
+
pivot: pivot,
|
|
113
|
+
visible,
|
|
114
|
+
overflow,
|
|
115
|
+
});
|
|
116
|
+
// trigger onOverflow
|
|
117
|
+
if (statePivot !== pivot){
|
|
118
|
+
onOverflow(overflow);
|
|
103
119
|
}
|
|
120
|
+
return;
|
|
104
121
|
}
|
|
105
|
-
this._adapter.updateStates(updateState);
|
|
106
122
|
}
|
|
107
123
|
|
|
108
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "d1cdea565d328c70a4de8636aed30c88f60732dd",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/tagInput/tagInput.scss
CHANGED
|
@@ -259,6 +259,17 @@ $module: #{$prefix}-tagInput;
|
|
|
259
259
|
color: $color-tagInput_suffix-default;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
&-tag-content-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&-sortable-list {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-flow: row wrap;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
@import "./rtl.scss";
|
package/tooltip/foundation.ts
CHANGED
|
@@ -855,7 +855,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
855
855
|
position = this._adjustPos(position, true);
|
|
856
856
|
}
|
|
857
857
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
858
|
-
position = this._adjustPos(position
|
|
858
|
+
position = this._adjustPos(position);
|
|
859
859
|
}
|
|
860
860
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
861
861
|
position = this._adjustPos(position, true, 'reduce');
|
|
@@ -171,23 +171,20 @@ $module: #{$prefix}-tree-select;
|
|
|
171
171
|
.#{$prefix}-tagInput {
|
|
172
172
|
border: hidden;
|
|
173
173
|
background: transparent;
|
|
174
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&-large {
|
|
181
|
+
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
.#{$prefix}-tagInput-wrapper {
|
|
176
185
|
padding-left: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
177
186
|
padding-right: $spacing-treeSelect_selection_tagInput_wrapper-paddingX;
|
|
178
187
|
|
|
179
|
-
&-default {
|
|
180
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_default;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&-small {
|
|
184
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_small;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&-large {
|
|
188
|
-
min-height: $height-treeSelect_selection_tagInput_wrapper_large;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
188
|
.#{$prefix}-input-wrapper {
|
|
192
189
|
// height: $height-treeSelect_selection_tagInput_input_default;
|
|
193
190
|
|
|
@@ -205,13 +202,6 @@ $module: #{$prefix}-tree-select;
|
|
|
205
202
|
margin-bottom: $spacing-treeSelect_tag-marginY;
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
// .#{$prefix}-input-wrapper-small {
|
|
210
|
-
// height: $height-treeSelect_selection_tagInput_input_small;
|
|
211
|
-
// }
|
|
212
|
-
// .#{$prefix}-input-wrapper-large {
|
|
213
|
-
// height: $height-treeSelect_selection_tagInput_input_large;
|
|
214
|
-
// }
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
207
|
}
|