@douyinfe/semi-foundation 2.56.0-alpha.0 → 2.56.0

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.
@@ -391,7 +391,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
391
391
  cacheValue = this._getCacheValue(keyEntities);
392
392
  }
393
393
 
394
- const selectedValue = !this._isControlledComponent() ? cacheValue : value;
394
+ const selectedValue = !this._isControlledComponent() ? cacheValue : (isUndefined(value) ? [] : value);
395
395
  if (isValid(selectedValue)) {
396
396
  this.updateSelectedKey(selectedValue, keyEntities);
397
397
  } else {
@@ -402,8 +402,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
402
402
  // call when props.value change
403
403
  handleValueChange(value: BasicValue) {
404
404
  const { keyEntities } = this.getStates();
405
- const { multiple } = this.getProps();
406
- !multiple && this.updateSelectedKey(value, keyEntities);
405
+ this.updateSelectedKey(value, keyEntities);
407
406
  }
408
407
 
409
408
  /**
package/form/form.scss CHANGED
@@ -9,6 +9,8 @@ $col: #{$form}-col;
9
9
  $checkboxGroup: #{$prefix}-checkboxGroup;
10
10
  $radioGroup: #{$prefix}-radioGroup;
11
11
  $buttonRadioGroup: #{$prefix}-radioGroup-buttonRadio;
12
+ $horizontalCardRadioGroup: #{$prefix}-radioGroup-horizontal-card;
13
+ $verticalCardRadioGroup: #{$prefix}-radioGroup-vertical-card;
12
14
 
13
15
  $switch: #{$prefix}-switch;
14
16
  $rating: #{$prefix}-rating;
@@ -171,11 +173,17 @@ $rating: #{$prefix}-rating;
171
173
  padding-top: $spacing-form_label_posTop-paddingTop;
172
174
  padding-bottom: $spacing-form_label_posTop-paddingBottom;
173
175
  }
176
+ // no need to adjust height for button radio & card radio
177
+ .#{$buttonRadioGroup},
178
+ .#{$horizontalCardRadioGroup},
179
+ .#{$verticalCardRadioGroup} {
180
+ padding-top: 0;
181
+ padding-bottom: 0;
182
+ }
174
183
  .#{$field}-label-with-extra {
175
184
  display: flex;
176
185
  align-items: center;
177
186
  }
178
-
179
187
  }
180
188
 
181
189
  &[x-label-pos="left"] {
@@ -197,8 +205,10 @@ $rating: #{$prefix}-rating;
197
205
  padding-top: $spacing-form_label-paddingTop;
198
206
  padding-bottom: $spacing-form_label-paddingTop;
199
207
  }
200
- // no need to adjust height for button radio, already 32px
201
- .#{$buttonRadioGroup} {
208
+ // no need to adjust height for button radio, already 32px, no need to consider height of card radio
209
+ .#{$buttonRadioGroup},
210
+ .#{$horizontalCardRadioGroup},
211
+ .#{$verticalCardRadioGroup} {
202
212
  padding-top: 0;
203
213
  padding-bottom: 0;
204
214
  }
@@ -188,7 +188,7 @@ class CascaderFoundation extends _foundation.default {
188
188
  } else if (!(0, _isEmpty2.default)(keyEntities)) {
189
189
  cacheValue = this._getCacheValue(keyEntities);
190
190
  }
191
- const selectedValue = !this._isControlledComponent() ? cacheValue : value;
191
+ const selectedValue = !this._isControlledComponent() ? cacheValue : (0, _isUndefined2.default)(value) ? [] : value;
192
192
  if ((0, _util.isValid)(selectedValue)) {
193
193
  this.updateSelectedKey(selectedValue, keyEntities);
194
194
  } else {
@@ -202,10 +202,7 @@ class CascaderFoundation extends _foundation.default {
202
202
  const {
203
203
  keyEntities
204
204
  } = this.getStates();
205
- const {
206
- multiple
207
- } = this.getProps();
208
- !multiple && this.updateSelectedKey(value, keyEntities);
205
+ this.updateSelectedKey(value, keyEntities);
209
206
  }
210
207
  /**
211
208
  * When single selection, the clear objects of
@@ -109,6 +109,12 @@
109
109
  padding-top: 4px;
110
110
  padding-bottom: 4px;
111
111
  }
112
+ .semi-form-field[x-label-pos=top] .semi-radioGroup-buttonRadio,
113
+ .semi-form-field[x-label-pos=top] .semi-radioGroup-horizontal-card,
114
+ .semi-form-field[x-label-pos=top] .semi-radioGroup-vertical-card {
115
+ padding-top: 0;
116
+ padding-bottom: 0;
117
+ }
112
118
  .semi-form-field[x-label-pos=top] .semi-form-field-label-with-extra {
113
119
  display: flex;
114
120
  align-items: center;
@@ -131,7 +137,9 @@
131
137
  padding-top: 6px;
132
138
  padding-bottom: 6px;
133
139
  }
134
- .semi-form-field[x-label-pos=left] .semi-radioGroup-buttonRadio {
140
+ .semi-form-field[x-label-pos=left] .semi-radioGroup-buttonRadio,
141
+ .semi-form-field[x-label-pos=left] .semi-radioGroup-horizontal-card,
142
+ .semi-form-field[x-label-pos=left] .semi-radioGroup-vertical-card {
135
143
  padding-top: 0;
136
144
  padding-bottom: 0;
137
145
  }
@@ -9,6 +9,8 @@ $col: #{$form}-col;
9
9
  $checkboxGroup: #{$prefix}-checkboxGroup;
10
10
  $radioGroup: #{$prefix}-radioGroup;
11
11
  $buttonRadioGroup: #{$prefix}-radioGroup-buttonRadio;
12
+ $horizontalCardRadioGroup: #{$prefix}-radioGroup-horizontal-card;
13
+ $verticalCardRadioGroup: #{$prefix}-radioGroup-vertical-card;
12
14
 
13
15
  $switch: #{$prefix}-switch;
14
16
  $rating: #{$prefix}-rating;
@@ -171,11 +173,17 @@ $rating: #{$prefix}-rating;
171
173
  padding-top: $spacing-form_label_posTop-paddingTop;
172
174
  padding-bottom: $spacing-form_label_posTop-paddingBottom;
173
175
  }
176
+ // no need to adjust height for button radio & card radio
177
+ .#{$buttonRadioGroup},
178
+ .#{$horizontalCardRadioGroup},
179
+ .#{$verticalCardRadioGroup} {
180
+ padding-top: 0;
181
+ padding-bottom: 0;
182
+ }
174
183
  .#{$field}-label-with-extra {
175
184
  display: flex;
176
185
  align-items: center;
177
186
  }
178
-
179
187
  }
180
188
 
181
189
  &[x-label-pos="left"] {
@@ -197,8 +205,10 @@ $rating: #{$prefix}-rating;
197
205
  padding-top: $spacing-form_label-paddingTop;
198
206
  padding-bottom: $spacing-form_label-paddingTop;
199
207
  }
200
- // no need to adjust height for button radio, already 32px
201
- .#{$buttonRadioGroup} {
208
+ // no need to adjust height for button radio, already 32px, no need to consider height of card radio
209
+ .#{$buttonRadioGroup},
210
+ .#{$horizontalCardRadioGroup},
211
+ .#{$verticalCardRadioGroup} {
202
212
  padding-top: 0;
203
213
  padding-bottom: 0;
204
214
  }
@@ -242,6 +242,7 @@
242
242
  left: 0;
243
243
  width: 100%;
244
244
  height: 100%;
245
+ margin-top: 0;
245
246
  z-index: -1;
246
247
  opacity: 0;
247
248
  }
@@ -335,6 +335,7 @@ $inner-width: $width-icon-medium;
335
335
  left: 0;
336
336
  width: 100%;
337
337
  height: 100%;
338
+ margin-top: 0; // when type= button/card/pureCard, reset margin
338
339
  z-index: -1;
339
340
  opacity: 0;
340
341
  }
@@ -378,12 +378,21 @@
378
378
  overflow: hidden;
379
379
  position: relative;
380
380
  }
381
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper {
382
+ height: 24px;
383
+ line-height: 24px;
384
+ }
385
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper .semi-input-default {
386
+ height: 24px;
387
+ }
381
388
  .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper-empty .semi-input-wrapper {
382
389
  position: absolute;
383
390
  top: 0;
384
391
  left: 0;
385
392
  height: 100%;
386
- width: 100%;
393
+ }
394
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper-empty .semi-input-wrapper .semi-input-default {
395
+ height: 100%;
387
396
  }
388
397
  .semi-select-multiple.semi-select-filterable .semi-input-wrapper {
389
398
  height: 100%;
@@ -399,6 +408,22 @@
399
408
  padding-right: 0;
400
409
  }
401
410
 
411
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper-large {
412
+ height: 24px;
413
+ line-height: 24px;
414
+ }
415
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper-large .semi-input-large {
416
+ height: 24px;
417
+ }
418
+
419
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper {
420
+ height: 20px;
421
+ line-height: 20px;
422
+ }
423
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper .semi-input-small {
424
+ height: 20px;
425
+ }
426
+
402
427
  .semi-select-option-list-wrapper {
403
428
  padding-top: 4px;
404
429
  padding-bottom: 4px;
@@ -393,17 +393,29 @@ $overflowList: #{$prefix}-overflow-list;
393
393
  overflow: hidden;
394
394
  position: relative;
395
395
 
396
+ &:not(.#{$module}-content-wrapper-empty) {
397
+ .#{$prefix}-input-wrapper {
398
+ height: $height-select_multiple_input_default;
399
+ line-height: $height-select_multiple_input_default;
400
+ .#{$prefix}-input-default {
401
+ height: $height-select_multiple_input_default;
402
+ }
403
+ }
404
+ }
405
+
396
406
  &-empty {
397
407
  .#{$prefix}-input-wrapper {
398
408
  position: absolute;
399
409
  top: 0;
400
410
  left: 0;
401
411
  height: 100%;
402
- width: 100%;
412
+ .#{$prefix}-input-default {
413
+ height: 100%;
414
+ }
415
+ // width: 100%; // no need to set width here, will calcuate inline style by js
403
416
  }
404
417
  }
405
418
  }
406
-
407
419
  .#{$prefix}-input-wrapper {
408
420
  // position: absolute;
409
421
  // top: 0;
@@ -424,6 +436,35 @@ $overflowList: #{$prefix}-overflow-list;
424
436
  }
425
437
  }
426
438
 
439
+ .#{$multiple}.#{$filterable}.#{$module}-large {
440
+ .#{$module}-content-wrapper {
441
+ &:not(.#{$module}-content-wrapper-empty) {
442
+ .#{$prefix}-input-wrapper-large {
443
+ height: $height-select_multiple_input_large;
444
+ line-height: $height-select_multiple_input_large;
445
+ .#{$prefix}-input-large {
446
+ height: $height-select_multiple_input_large
447
+ }
448
+ }
449
+ }
450
+ }
451
+ }
452
+
453
+ .#{$multiple}.#{$filterable}.#{$module}-small {
454
+ .#{$module}-content-wrapper {
455
+ &:not(.#{$module}-content-wrapper-empty) {
456
+ .#{$prefix}-input-wrapper {
457
+ height: $height-select_multiple_input_small;
458
+ line-height: $height-select_multiple_input_small;
459
+ .#{$prefix}-input-small {
460
+ height: $height-select_multiple_input_small;
461
+ }
462
+ }
463
+ }
464
+ }
465
+ }
466
+
467
+
427
468
  .#{$module}-option-list-wrapper {
428
469
  padding-top: $spacing-select_option_list-paddingTop;
429
470
  padding-bottom: $spacing-select_option_list-paddingBottom;
@@ -65,7 +65,12 @@ $width-select_arrow: 32px; // 选择器输入框下拉箭头宽度
65
65
  $width-select_arrow_empty: 12px; // 选择器输入框下拉箭头为空时(有suffix icon)宽度
66
66
  $width-select_clear-icon: 32px; // 选择器输入框清空按钮宽度
67
67
  $width-select_group_top-border: $border-thickness-control; // 选择器菜单分组标题描边宽度
68
- $height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小宽度
68
+ $height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小高度
69
+
70
+ $height-select_multiple_input_small: 20px; // 小尺寸多项选择器输入框Input框高度
71
+ $height-select_multiple_input_default: 24px; // 默认多项选择器输入框Input框高度
72
+ $height-select_multiple_input_large: 24px; // 大尺寸多项选择器输入框Input框高度
73
+
69
74
  $width-select-border-hover: $width-select-border; // 选择器输入框描边宽度 - 悬浮
70
75
  $width-select-border-focus: $width-select-border-hover; // 选择器输入框描边宽度 - 按下
71
76
  $width-select-border-active: $width-select-border-focus; // 选择器输入框描边宽度 - 选中
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
83
83
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
84
84
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
85
85
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
86
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -69,7 +69,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
69
69
  renderSelectedItem?: BasicRenderSelectedItem;
70
70
  getPopupContainer?: () => HTMLElement;
71
71
  onBlur?: (e: any) => void;
72
- onSearch?: (sunInput: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
72
+ onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
73
73
  onChange?: BasicOnChange;
74
74
  onFocus?: (e: any) => void;
75
75
  onVisibleChange?: (isVisible: boolean) => void;
@@ -90,7 +90,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
90
90
  rePositionDropdown: () => void;
91
91
  updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
92
92
  notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
93
- notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
93
+ notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
94
94
  cacheFlattenNodes: (bool: boolean) => void;
95
95
  openMenu: () => void;
96
96
  closeMenu: (cb?: () => void) => void;
@@ -474,7 +474,6 @@ class TreeSelectFoundation extends _foundation.default {
474
474
  } = this.getProps();
475
475
  const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : (0, _get2.default)(keyMaps, 'label', 'label');
476
476
  const newExpandedKeys = new Set(expandedKeys);
477
- let filteredNodes = [];
478
477
  let filteredOptsKeys = [];
479
478
  let expandedOptsKeys = [];
480
479
  let newFlattenNodes = [];
@@ -484,21 +483,19 @@ class TreeSelectFoundation extends _foundation.default {
484
483
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
485
484
  newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, newExpandedKeys, keyMaps);
486
485
  } else {
487
- const filteredOpts = Object.values(keyEntities).filter(item => {
486
+ filteredOptsKeys = Object.values(keyEntities).filter(item => {
488
487
  const {
489
488
  data
490
489
  } = item;
491
490
  return (0, _treeUtil.filter)(sugInput, data, filterTreeNode, realFilterProp);
492
- });
493
- filteredNodes = filteredOpts.map(item => item.data);
494
- filteredOptsKeys = filteredOpts.map(item => item.key);
491
+ }).map(item => item.key);
495
492
  expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(filteredOptsKeys, keyEntities, false);
496
493
  const shownChildKeys = (0, _treeUtil.findDescendantKeys)(filteredOptsKeys, keyEntities, true);
497
494
  filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
498
495
  newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
499
496
  }
500
497
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
501
- this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys), filteredNodes);
498
+ this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
502
499
  this._adapter.updateState({
503
500
  expandedKeys: newExpandedKeys,
504
501
  flattenNodes: newFlattenNodes,
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("custom" | "auto")[];
21
+ UPLOAD_TRIGGER: ("auto" | "custom")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -181,7 +181,7 @@ export default class CascaderFoundation extends BaseFoundation {
181
181
  } else if (!_isEmpty(keyEntities)) {
182
182
  cacheValue = this._getCacheValue(keyEntities);
183
183
  }
184
- const selectedValue = !this._isControlledComponent() ? cacheValue : value;
184
+ const selectedValue = !this._isControlledComponent() ? cacheValue : _isUndefined(value) ? [] : value;
185
185
  if (isValid(selectedValue)) {
186
186
  this.updateSelectedKey(selectedValue, keyEntities);
187
187
  } else {
@@ -195,10 +195,7 @@ export default class CascaderFoundation extends BaseFoundation {
195
195
  const {
196
196
  keyEntities
197
197
  } = this.getStates();
198
- const {
199
- multiple
200
- } = this.getProps();
201
- !multiple && this.updateSelectedKey(value, keyEntities);
198
+ this.updateSelectedKey(value, keyEntities);
202
199
  }
203
200
  /**
204
201
  * When single selection, the clear objects of
@@ -109,6 +109,12 @@
109
109
  padding-top: 4px;
110
110
  padding-bottom: 4px;
111
111
  }
112
+ .semi-form-field[x-label-pos=top] .semi-radioGroup-buttonRadio,
113
+ .semi-form-field[x-label-pos=top] .semi-radioGroup-horizontal-card,
114
+ .semi-form-field[x-label-pos=top] .semi-radioGroup-vertical-card {
115
+ padding-top: 0;
116
+ padding-bottom: 0;
117
+ }
112
118
  .semi-form-field[x-label-pos=top] .semi-form-field-label-with-extra {
113
119
  display: flex;
114
120
  align-items: center;
@@ -131,7 +137,9 @@
131
137
  padding-top: 6px;
132
138
  padding-bottom: 6px;
133
139
  }
134
- .semi-form-field[x-label-pos=left] .semi-radioGroup-buttonRadio {
140
+ .semi-form-field[x-label-pos=left] .semi-radioGroup-buttonRadio,
141
+ .semi-form-field[x-label-pos=left] .semi-radioGroup-horizontal-card,
142
+ .semi-form-field[x-label-pos=left] .semi-radioGroup-vertical-card {
135
143
  padding-top: 0;
136
144
  padding-bottom: 0;
137
145
  }
@@ -9,6 +9,8 @@ $col: #{$form}-col;
9
9
  $checkboxGroup: #{$prefix}-checkboxGroup;
10
10
  $radioGroup: #{$prefix}-radioGroup;
11
11
  $buttonRadioGroup: #{$prefix}-radioGroup-buttonRadio;
12
+ $horizontalCardRadioGroup: #{$prefix}-radioGroup-horizontal-card;
13
+ $verticalCardRadioGroup: #{$prefix}-radioGroup-vertical-card;
12
14
 
13
15
  $switch: #{$prefix}-switch;
14
16
  $rating: #{$prefix}-rating;
@@ -171,11 +173,17 @@ $rating: #{$prefix}-rating;
171
173
  padding-top: $spacing-form_label_posTop-paddingTop;
172
174
  padding-bottom: $spacing-form_label_posTop-paddingBottom;
173
175
  }
176
+ // no need to adjust height for button radio & card radio
177
+ .#{$buttonRadioGroup},
178
+ .#{$horizontalCardRadioGroup},
179
+ .#{$verticalCardRadioGroup} {
180
+ padding-top: 0;
181
+ padding-bottom: 0;
182
+ }
174
183
  .#{$field}-label-with-extra {
175
184
  display: flex;
176
185
  align-items: center;
177
186
  }
178
-
179
187
  }
180
188
 
181
189
  &[x-label-pos="left"] {
@@ -197,8 +205,10 @@ $rating: #{$prefix}-rating;
197
205
  padding-top: $spacing-form_label-paddingTop;
198
206
  padding-bottom: $spacing-form_label-paddingTop;
199
207
  }
200
- // no need to adjust height for button radio, already 32px
201
- .#{$buttonRadioGroup} {
208
+ // no need to adjust height for button radio, already 32px, no need to consider height of card radio
209
+ .#{$buttonRadioGroup},
210
+ .#{$horizontalCardRadioGroup},
211
+ .#{$verticalCardRadioGroup} {
202
212
  padding-top: 0;
203
213
  padding-bottom: 0;
204
214
  }
@@ -242,6 +242,7 @@
242
242
  left: 0;
243
243
  width: 100%;
244
244
  height: 100%;
245
+ margin-top: 0;
245
246
  z-index: -1;
246
247
  opacity: 0;
247
248
  }
@@ -335,6 +335,7 @@ $inner-width: $width-icon-medium;
335
335
  left: 0;
336
336
  width: 100%;
337
337
  height: 100%;
338
+ margin-top: 0; // when type= button/card/pureCard, reset margin
338
339
  z-index: -1;
339
340
  opacity: 0;
340
341
  }
@@ -378,12 +378,21 @@
378
378
  overflow: hidden;
379
379
  position: relative;
380
380
  }
381
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper {
382
+ height: 24px;
383
+ line-height: 24px;
384
+ }
385
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper .semi-input-default {
386
+ height: 24px;
387
+ }
381
388
  .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper-empty .semi-input-wrapper {
382
389
  position: absolute;
383
390
  top: 0;
384
391
  left: 0;
385
392
  height: 100%;
386
- width: 100%;
393
+ }
394
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper-empty .semi-input-wrapper .semi-input-default {
395
+ height: 100%;
387
396
  }
388
397
  .semi-select-multiple.semi-select-filterable .semi-input-wrapper {
389
398
  height: 100%;
@@ -399,6 +408,22 @@
399
408
  padding-right: 0;
400
409
  }
401
410
 
411
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper-large {
412
+ height: 24px;
413
+ line-height: 24px;
414
+ }
415
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper-large .semi-input-large {
416
+ height: 24px;
417
+ }
418
+
419
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper {
420
+ height: 20px;
421
+ line-height: 20px;
422
+ }
423
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-select-content-wrapper:not(.semi-select-content-wrapper-empty) .semi-input-wrapper .semi-input-small {
424
+ height: 20px;
425
+ }
426
+
402
427
  .semi-select-option-list-wrapper {
403
428
  padding-top: 4px;
404
429
  padding-bottom: 4px;
@@ -393,17 +393,29 @@ $overflowList: #{$prefix}-overflow-list;
393
393
  overflow: hidden;
394
394
  position: relative;
395
395
 
396
+ &:not(.#{$module}-content-wrapper-empty) {
397
+ .#{$prefix}-input-wrapper {
398
+ height: $height-select_multiple_input_default;
399
+ line-height: $height-select_multiple_input_default;
400
+ .#{$prefix}-input-default {
401
+ height: $height-select_multiple_input_default;
402
+ }
403
+ }
404
+ }
405
+
396
406
  &-empty {
397
407
  .#{$prefix}-input-wrapper {
398
408
  position: absolute;
399
409
  top: 0;
400
410
  left: 0;
401
411
  height: 100%;
402
- width: 100%;
412
+ .#{$prefix}-input-default {
413
+ height: 100%;
414
+ }
415
+ // width: 100%; // no need to set width here, will calcuate inline style by js
403
416
  }
404
417
  }
405
418
  }
406
-
407
419
  .#{$prefix}-input-wrapper {
408
420
  // position: absolute;
409
421
  // top: 0;
@@ -424,6 +436,35 @@ $overflowList: #{$prefix}-overflow-list;
424
436
  }
425
437
  }
426
438
 
439
+ .#{$multiple}.#{$filterable}.#{$module}-large {
440
+ .#{$module}-content-wrapper {
441
+ &:not(.#{$module}-content-wrapper-empty) {
442
+ .#{$prefix}-input-wrapper-large {
443
+ height: $height-select_multiple_input_large;
444
+ line-height: $height-select_multiple_input_large;
445
+ .#{$prefix}-input-large {
446
+ height: $height-select_multiple_input_large
447
+ }
448
+ }
449
+ }
450
+ }
451
+ }
452
+
453
+ .#{$multiple}.#{$filterable}.#{$module}-small {
454
+ .#{$module}-content-wrapper {
455
+ &:not(.#{$module}-content-wrapper-empty) {
456
+ .#{$prefix}-input-wrapper {
457
+ height: $height-select_multiple_input_small;
458
+ line-height: $height-select_multiple_input_small;
459
+ .#{$prefix}-input-small {
460
+ height: $height-select_multiple_input_small;
461
+ }
462
+ }
463
+ }
464
+ }
465
+ }
466
+
467
+
427
468
  .#{$module}-option-list-wrapper {
428
469
  padding-top: $spacing-select_option_list-paddingTop;
429
470
  padding-bottom: $spacing-select_option_list-paddingBottom;
@@ -65,7 +65,12 @@ $width-select_arrow: 32px; // 选择器输入框下拉箭头宽度
65
65
  $width-select_arrow_empty: 12px; // 选择器输入框下拉箭头为空时(有suffix icon)宽度
66
66
  $width-select_clear-icon: 32px; // 选择器输入框清空按钮宽度
67
67
  $width-select_group_top-border: $border-thickness-control; // 选择器菜单分组标题描边宽度
68
- $height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小宽度
68
+ $height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小高度
69
+
70
+ $height-select_multiple_input_small: 20px; // 小尺寸多项选择器输入框Input框高度
71
+ $height-select_multiple_input_default: 24px; // 默认多项选择器输入框Input框高度
72
+ $height-select_multiple_input_large: 24px; // 大尺寸多项选择器输入框Input框高度
73
+
69
74
  $width-select-border-hover: $width-select-border; // 选择器输入框描边宽度 - 悬浮
70
75
  $width-select-border-focus: $width-select-border-hover; // 选择器输入框描边宽度 - 按下
71
76
  $width-select-border-active: $width-select-border-focus; // 选择器输入框描边宽度 - 选中
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
83
83
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
84
84
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
85
85
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
86
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -69,7 +69,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
69
69
  renderSelectedItem?: BasicRenderSelectedItem;
70
70
  getPopupContainer?: () => HTMLElement;
71
71
  onBlur?: (e: any) => void;
72
- onSearch?: (sunInput: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
72
+ onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
73
73
  onChange?: BasicOnChange;
74
74
  onFocus?: (e: any) => void;
75
75
  onVisibleChange?: (isVisible: boolean) => void;
@@ -90,7 +90,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
90
90
  rePositionDropdown: () => void;
91
91
  updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
92
92
  notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
93
- notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
93
+ notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
94
94
  cacheFlattenNodes: (bool: boolean) => void;
95
95
  openMenu: () => void;
96
96
  closeMenu: (cb?: () => void) => void;
@@ -467,7 +467,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
467
467
  } = this.getProps();
468
468
  const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : _get(keyMaps, 'label', 'label');
469
469
  const newExpandedKeys = new Set(expandedKeys);
470
- let filteredNodes = [];
471
470
  let filteredOptsKeys = [];
472
471
  let expandedOptsKeys = [];
473
472
  let newFlattenNodes = [];
@@ -477,21 +476,19 @@ export default class TreeSelectFoundation extends BaseFoundation {
477
476
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
478
477
  newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
479
478
  } else {
480
- const filteredOpts = Object.values(keyEntities).filter(item => {
479
+ filteredOptsKeys = Object.values(keyEntities).filter(item => {
481
480
  const {
482
481
  data
483
482
  } = item;
484
483
  return filter(sugInput, data, filterTreeNode, realFilterProp);
485
- });
486
- filteredNodes = filteredOpts.map(item => item.data);
487
- filteredOptsKeys = filteredOpts.map(item => item.key);
484
+ }).map(item => item.key);
488
485
  expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
489
486
  const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
490
487
  filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
491
488
  newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
492
489
  }
493
490
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
494
- this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys), filteredNodes);
491
+ this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
495
492
  this._adapter.updateState({
496
493
  expandedKeys: newExpandedKeys,
497
494
  flattenNodes: newFlattenNodes,
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("custom" | "auto")[];
21
+ UPLOAD_TRIGGER: ("auto" | "custom")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.56.0-alpha.0",
3
+ "version": "2.56.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.56.0-alpha.0",
10
+ "@douyinfe/semi-animation": "2.56.0",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "c66a7f2315110d6af211d6edb6163c71a4d8aaa8",
27
+ "gitHead": "df0bd1db35dc3e9fc6b78202ea2eb5d5d60e2256",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-transform-runtime": "^7.15.8",
30
30
  "@babel/preset-env": "^7.15.8",
package/radio/radio.scss CHANGED
@@ -335,6 +335,7 @@ $inner-width: $width-icon-medium;
335
335
  left: 0;
336
336
  width: 100%;
337
337
  height: 100%;
338
+ margin-top: 0; // when type= button/card/pureCard, reset margin
338
339
  z-index: -1;
339
340
  opacity: 0;
340
341
  }
@@ -393,17 +393,29 @@ $overflowList: #{$prefix}-overflow-list;
393
393
  overflow: hidden;
394
394
  position: relative;
395
395
 
396
+ &:not(.#{$module}-content-wrapper-empty) {
397
+ .#{$prefix}-input-wrapper {
398
+ height: $height-select_multiple_input_default;
399
+ line-height: $height-select_multiple_input_default;
400
+ .#{$prefix}-input-default {
401
+ height: $height-select_multiple_input_default;
402
+ }
403
+ }
404
+ }
405
+
396
406
  &-empty {
397
407
  .#{$prefix}-input-wrapper {
398
408
  position: absolute;
399
409
  top: 0;
400
410
  left: 0;
401
411
  height: 100%;
402
- width: 100%;
412
+ .#{$prefix}-input-default {
413
+ height: 100%;
414
+ }
415
+ // width: 100%; // no need to set width here, will calcuate inline style by js
403
416
  }
404
417
  }
405
418
  }
406
-
407
419
  .#{$prefix}-input-wrapper {
408
420
  // position: absolute;
409
421
  // top: 0;
@@ -424,6 +436,35 @@ $overflowList: #{$prefix}-overflow-list;
424
436
  }
425
437
  }
426
438
 
439
+ .#{$multiple}.#{$filterable}.#{$module}-large {
440
+ .#{$module}-content-wrapper {
441
+ &:not(.#{$module}-content-wrapper-empty) {
442
+ .#{$prefix}-input-wrapper-large {
443
+ height: $height-select_multiple_input_large;
444
+ line-height: $height-select_multiple_input_large;
445
+ .#{$prefix}-input-large {
446
+ height: $height-select_multiple_input_large
447
+ }
448
+ }
449
+ }
450
+ }
451
+ }
452
+
453
+ .#{$multiple}.#{$filterable}.#{$module}-small {
454
+ .#{$module}-content-wrapper {
455
+ &:not(.#{$module}-content-wrapper-empty) {
456
+ .#{$prefix}-input-wrapper {
457
+ height: $height-select_multiple_input_small;
458
+ line-height: $height-select_multiple_input_small;
459
+ .#{$prefix}-input-small {
460
+ height: $height-select_multiple_input_small;
461
+ }
462
+ }
463
+ }
464
+ }
465
+ }
466
+
467
+
427
468
  .#{$module}-option-list-wrapper {
428
469
  padding-top: $spacing-select_option_list-paddingTop;
429
470
  padding-bottom: $spacing-select_option_list-paddingBottom;
@@ -65,7 +65,12 @@ $width-select_arrow: 32px; // 选择器输入框下拉箭头宽度
65
65
  $width-select_arrow_empty: 12px; // 选择器输入框下拉箭头为空时(有suffix icon)宽度
66
66
  $width-select_clear-icon: 32px; // 选择器输入框清空按钮宽度
67
67
  $width-select_group_top-border: $border-thickness-control; // 选择器菜单分组标题描边宽度
68
- $height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小宽度
68
+ $height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小高度
69
+
70
+ $height-select_multiple_input_small: 20px; // 小尺寸多项选择器输入框Input框高度
71
+ $height-select_multiple_input_default: 24px; // 默认多项选择器输入框Input框高度
72
+ $height-select_multiple_input_large: 24px; // 大尺寸多项选择器输入框Input框高度
73
+
69
74
  $width-select-border-hover: $width-select-border; // 选择器输入框描边宽度 - 悬浮
70
75
  $width-select-border-focus: $width-select-border-hover; // 选择器输入框描边宽度 - 按下
71
76
  $width-select-border-active: $width-select-border-focus; // 选择器输入框描边宽度 - 选中
@@ -139,7 +139,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps,
139
139
  getPopupContainer?: () => HTMLElement;
140
140
  // triggerRender?: (props: BasicTriggerRenderProps) => any;
141
141
  onBlur?: (e: any) => void;
142
- onSearch?: (sunInput: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
142
+ onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
143
143
  onChange?: BasicOnChange;
144
144
  onFocus?: (e: any) => void;
145
145
  onVisibleChange?: (isVisible: boolean) => void;
@@ -183,7 +183,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
183
183
  rePositionDropdown: () => void;
184
184
  updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
185
185
  notifySelect: (selectedKey: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
186
- notifySearch: (input: string, filteredExpandedKeys: string[], filteredNodes: BasicTreeNodeData[]) => void;
186
+ notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
187
187
  cacheFlattenNodes: (bool: boolean) => void;
188
188
  openMenu: () => void;
189
189
  closeMenu: (cb?: () => void) => void;
@@ -610,7 +610,6 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
610
610
  const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps } = this.getProps();
611
611
  const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : get(keyMaps, 'label', 'label');
612
612
  const newExpandedKeys: Set<string> = new Set(expandedKeys);
613
- let filteredNodes: BasicTreeNodeData[] = [];
614
613
  let filteredOptsKeys: string[] = [];
615
614
  let expandedOptsKeys = [];
616
615
  let newFlattenNodes = [];
@@ -620,20 +619,19 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
620
619
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
621
620
  newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
622
621
  } else {
623
- const filteredOpts = Object.values(keyEntities)
622
+ filteredOptsKeys = Object.values(keyEntities)
624
623
  .filter((item: BasicKeyEntity) => {
625
624
  const { data } = item;
626
625
  return filter(sugInput, data, filterTreeNode, realFilterProp);
627
- });
628
- filteredNodes = filteredOpts.map((item: BasicKeyEntity) => item.data);
629
- filteredOptsKeys = filteredOpts.map((item: BasicKeyEntity) => item.key);
626
+ })
627
+ .map((item: BasicKeyEntity) => item.key);
630
628
  expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
631
629
  const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
632
630
  filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
633
631
  newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
634
632
  }
635
633
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
636
- this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys), filteredNodes);
634
+ this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
637
635
  this._adapter.updateState({
638
636
  expandedKeys: newExpandedKeys,
639
637
  flattenNodes: newFlattenNodes,