@douyinfe/semi-foundation 2.55.4 → 2.56.0-beta.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.
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
  }
@@ -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
  }
@@ -383,7 +383,13 @@
383
383
  top: 0;
384
384
  left: 0;
385
385
  height: 100%;
386
- width: 100%;
386
+ }
387
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper .semi-input-wrapper {
388
+ height: 24px;
389
+ line-height: 24px;
390
+ }
391
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper .semi-input-wrapper .semi-input-default {
392
+ height: 24px;
387
393
  }
388
394
  .semi-select-multiple.semi-select-filterable .semi-input-wrapper {
389
395
  height: 100%;
@@ -399,6 +405,22 @@
399
405
  padding-right: 0;
400
406
  }
401
407
 
408
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-input-wrapper-large {
409
+ height: 24px;
410
+ line-height: 24px;
411
+ }
412
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-input-wrapper-large .semi-input-large {
413
+ height: 24px;
414
+ }
415
+
416
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-input-wrapper {
417
+ height: 20px;
418
+ line-height: 20px;
419
+ }
420
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-input-wrapper .semi-input-small {
421
+ height: 20px;
422
+ }
423
+
402
424
  .semi-select-option-list-wrapper {
403
425
  padding-top: 4px;
404
426
  padding-bottom: 4px;
@@ -392,18 +392,23 @@ $overflowList: #{$prefix}-overflow-list;
392
392
  height: 100%;
393
393
  overflow: hidden;
394
394
  position: relative;
395
-
396
395
  &-empty {
397
396
  .#{$prefix}-input-wrapper {
398
397
  position: absolute;
399
398
  top: 0;
400
399
  left: 0;
401
400
  height: 100%;
402
- width: 100%;
401
+ // width: 100%; // no need to set width here, will calcuate inline style by js
402
+ }
403
+ }
404
+ .#{$prefix}-input-wrapper {
405
+ height: $height-select_multiple_input_default;
406
+ line-height: $height-select_multiple_input_default;
407
+ .#{$prefix}-input-default {
408
+ height: $height-select_multiple_input_default;
403
409
  }
404
410
  }
405
411
  }
406
-
407
412
  .#{$prefix}-input-wrapper {
408
413
  // position: absolute;
409
414
  // top: 0;
@@ -424,6 +429,26 @@ $overflowList: #{$prefix}-overflow-list;
424
429
  }
425
430
  }
426
431
 
432
+ .#{$multiple}.#{$filterable}.#{$module}-large {
433
+ .#{$prefix}-input-wrapper-large {
434
+ height: $height-select_multiple_input_large;
435
+ line-height: $height-select_multiple_input_large;
436
+ .#{$prefix}-input-large {
437
+ height: $height-select_multiple_input_large
438
+ }
439
+ }
440
+ }
441
+ .#{$multiple}.#{$filterable}.#{$module}-small {
442
+ .#{$prefix}-input-wrapper {
443
+ height: $height-select_multiple_input_small;
444
+ line-height: $height-select_multiple_input_small;
445
+ .#{$prefix}-input-small {
446
+ height: $height-select_multiple_input_small;
447
+ }
448
+ }
449
+ }
450
+
451
+
427
452
  .#{$module}-option-list-wrapper {
428
453
  padding-top: $spacing-select_option_list-paddingTop;
429
454
  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; // 选择器输入框描边宽度 - 选中
@@ -458,7 +458,8 @@ class SliderFoundation extends _foundation.default {
458
458
  this.onHandleLeave = () => {
459
459
  // this._adapter.setEventDefault(e);
460
460
  const disabled = this._adapter.getState('disabled');
461
- if (!disabled && this.getStates()['focusPos'] === "") {
461
+ const isDrag = this._adapter.getState('isDrag');
462
+ if (!disabled && !isDrag) {
462
463
  this._adapter.onHandleLeave();
463
464
  }
464
465
  };
@@ -251,6 +251,11 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
251
251
  _showFilteredOnly(): any;
252
252
  getTreeNodeProps(key: string): BasicTreeNodeProps;
253
253
  notifyJsonChange(key: string[] | string, e: any): void;
254
+ constructDataForValue(value: string): {
255
+ [x: number]: string;
256
+ };
257
+ findDataForValue(findValue: string): any;
258
+ getDataForKeyNotInKeyEntities(value: string): any;
254
259
  notifyMultipleChange(key: string[], e: any): void;
255
260
  notifyChange(key: string[] | string, e: any): void;
256
261
  handleInputChange(sugInput: string): void;
@@ -115,6 +115,45 @@ class TreeFoundation extends _foundation.default {
115
115
  const value = (0, _pick2.default)(data, selectedPath);
116
116
  this._adapter.notifyChange(value);
117
117
  }
118
+ constructDataForValue(value) {
119
+ const {
120
+ keyMaps
121
+ } = this.getProps();
122
+ const keyName = (0, _get2.default)(keyMaps, 'key', 'key');
123
+ const labelName = (0, _get2.default)(keyMaps, 'label', 'label');
124
+ return {
125
+ [keyName]: value,
126
+ [labelName]: value
127
+ };
128
+ }
129
+ findDataForValue(findValue) {
130
+ const {
131
+ value,
132
+ defaultValue,
133
+ keyMaps
134
+ } = this.getProps();
135
+ const realValueName = (0, _get2.default)(keyMaps, 'value', 'value');
136
+ const realKeyName = (0, _get2.default)(keyMaps, 'key', 'key');
137
+ let valueArr = [];
138
+ if (value) {
139
+ valueArr = Array.isArray(value) ? value : [value];
140
+ } else if (defaultValue) {
141
+ valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
142
+ }
143
+ return valueArr.find(item => {
144
+ return item[realValueName] === findValue || item[realKeyName] === findValue;
145
+ });
146
+ }
147
+ getDataForKeyNotInKeyEntities(value) {
148
+ const {
149
+ onChangeWithObject
150
+ } = this.getProps();
151
+ if (onChangeWithObject) {
152
+ return this.findDataForValue(value);
153
+ } else {
154
+ return this.constructDataForValue(value);
155
+ }
156
+ }
118
157
  notifyMultipleChange(key, e) {
119
158
  const {
120
159
  keyEntities
@@ -127,14 +166,15 @@ class TreeFoundation extends _foundation.default {
127
166
  let value;
128
167
  let keyList = [];
129
168
  if (checkRelation === 'related') {
130
- keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
169
+ keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly, true);
131
170
  } else if (checkRelation === 'unRelated') {
132
171
  keyList = key;
133
172
  }
173
+ const nodes = keyList.map(key => keyEntities[key] ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
134
174
  if (this.getProp('onChangeWithObject')) {
135
- value = keyList.map(itemKey => keyEntities[itemKey].data);
175
+ value = nodes;
136
176
  } else {
137
- value = (0, _treeUtil.getValueOrKey)(keyList.map(itemKey => keyEntities[itemKey].data), keyMaps);
177
+ value = (0, _treeUtil.getValueOrKey)(nodes, keyMaps);
138
178
  }
139
179
  this._adapter.notifyChange(value);
140
180
  }
@@ -293,7 +333,7 @@ class TreeFoundation extends _foundation.default {
293
333
  return this.calcCheckedKeys(eventKey, targetStatus);
294
334
  }
295
335
  const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
296
- const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : (0, _difference2.default)((0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, true), nonDisabled);
336
+ const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : (0, _difference2.default)((0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, true, true), nonDisabled);
297
337
  return (0, _treeUtil.calcCheckedKeys)(newCheckedKeys, keyEntities);
298
338
  }
299
339
  /*
@@ -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
  }
@@ -383,7 +383,13 @@
383
383
  top: 0;
384
384
  left: 0;
385
385
  height: 100%;
386
- width: 100%;
386
+ }
387
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper .semi-input-wrapper {
388
+ height: 24px;
389
+ line-height: 24px;
390
+ }
391
+ .semi-select-multiple.semi-select-filterable .semi-select-content-wrapper .semi-input-wrapper .semi-input-default {
392
+ height: 24px;
387
393
  }
388
394
  .semi-select-multiple.semi-select-filterable .semi-input-wrapper {
389
395
  height: 100%;
@@ -399,6 +405,22 @@
399
405
  padding-right: 0;
400
406
  }
401
407
 
408
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-input-wrapper-large {
409
+ height: 24px;
410
+ line-height: 24px;
411
+ }
412
+ .semi-select-multiple.semi-select-filterable.semi-select-large .semi-input-wrapper-large .semi-input-large {
413
+ height: 24px;
414
+ }
415
+
416
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-input-wrapper {
417
+ height: 20px;
418
+ line-height: 20px;
419
+ }
420
+ .semi-select-multiple.semi-select-filterable.semi-select-small .semi-input-wrapper .semi-input-small {
421
+ height: 20px;
422
+ }
423
+
402
424
  .semi-select-option-list-wrapper {
403
425
  padding-top: 4px;
404
426
  padding-bottom: 4px;
@@ -392,18 +392,23 @@ $overflowList: #{$prefix}-overflow-list;
392
392
  height: 100%;
393
393
  overflow: hidden;
394
394
  position: relative;
395
-
396
395
  &-empty {
397
396
  .#{$prefix}-input-wrapper {
398
397
  position: absolute;
399
398
  top: 0;
400
399
  left: 0;
401
400
  height: 100%;
402
- width: 100%;
401
+ // width: 100%; // no need to set width here, will calcuate inline style by js
402
+ }
403
+ }
404
+ .#{$prefix}-input-wrapper {
405
+ height: $height-select_multiple_input_default;
406
+ line-height: $height-select_multiple_input_default;
407
+ .#{$prefix}-input-default {
408
+ height: $height-select_multiple_input_default;
403
409
  }
404
410
  }
405
411
  }
406
-
407
412
  .#{$prefix}-input-wrapper {
408
413
  // position: absolute;
409
414
  // top: 0;
@@ -424,6 +429,26 @@ $overflowList: #{$prefix}-overflow-list;
424
429
  }
425
430
  }
426
431
 
432
+ .#{$multiple}.#{$filterable}.#{$module}-large {
433
+ .#{$prefix}-input-wrapper-large {
434
+ height: $height-select_multiple_input_large;
435
+ line-height: $height-select_multiple_input_large;
436
+ .#{$prefix}-input-large {
437
+ height: $height-select_multiple_input_large
438
+ }
439
+ }
440
+ }
441
+ .#{$multiple}.#{$filterable}.#{$module}-small {
442
+ .#{$prefix}-input-wrapper {
443
+ height: $height-select_multiple_input_small;
444
+ line-height: $height-select_multiple_input_small;
445
+ .#{$prefix}-input-small {
446
+ height: $height-select_multiple_input_small;
447
+ }
448
+ }
449
+ }
450
+
451
+
427
452
  .#{$module}-option-list-wrapper {
428
453
  padding-top: $spacing-select_option_list-paddingTop;
429
454
  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; // 选择器输入框描边宽度 - 选中
@@ -451,7 +451,8 @@ export default class SliderFoundation extends BaseFoundation {
451
451
  this.onHandleLeave = () => {
452
452
  // this._adapter.setEventDefault(e);
453
453
  const disabled = this._adapter.getState('disabled');
454
- if (!disabled && this.getStates()['focusPos'] === "") {
454
+ const isDrag = this._adapter.getState('isDrag');
455
+ if (!disabled && !isDrag) {
455
456
  this._adapter.onHandleLeave();
456
457
  }
457
458
  };
@@ -251,6 +251,11 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
251
251
  _showFilteredOnly(): any;
252
252
  getTreeNodeProps(key: string): BasicTreeNodeProps;
253
253
  notifyJsonChange(key: string[] | string, e: any): void;
254
+ constructDataForValue(value: string): {
255
+ [x: number]: string;
256
+ };
257
+ findDataForValue(findValue: string): any;
258
+ getDataForKeyNotInKeyEntities(value: string): any;
254
259
  notifyMultipleChange(key: string[], e: any): void;
255
260
  notifyChange(key: string[] | string, e: any): void;
256
261
  handleInputChange(sugInput: string): void;
@@ -107,6 +107,45 @@ export default class TreeFoundation extends BaseFoundation {
107
107
  const value = _pick(data, selectedPath);
108
108
  this._adapter.notifyChange(value);
109
109
  }
110
+ constructDataForValue(value) {
111
+ const {
112
+ keyMaps
113
+ } = this.getProps();
114
+ const keyName = _get(keyMaps, 'key', 'key');
115
+ const labelName = _get(keyMaps, 'label', 'label');
116
+ return {
117
+ [keyName]: value,
118
+ [labelName]: value
119
+ };
120
+ }
121
+ findDataForValue(findValue) {
122
+ const {
123
+ value,
124
+ defaultValue,
125
+ keyMaps
126
+ } = this.getProps();
127
+ const realValueName = _get(keyMaps, 'value', 'value');
128
+ const realKeyName = _get(keyMaps, 'key', 'key');
129
+ let valueArr = [];
130
+ if (value) {
131
+ valueArr = Array.isArray(value) ? value : [value];
132
+ } else if (defaultValue) {
133
+ valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
134
+ }
135
+ return valueArr.find(item => {
136
+ return item[realValueName] === findValue || item[realKeyName] === findValue;
137
+ });
138
+ }
139
+ getDataForKeyNotInKeyEntities(value) {
140
+ const {
141
+ onChangeWithObject
142
+ } = this.getProps();
143
+ if (onChangeWithObject) {
144
+ return this.findDataForValue(value);
145
+ } else {
146
+ return this.constructDataForValue(value);
147
+ }
148
+ }
110
149
  notifyMultipleChange(key, e) {
111
150
  const {
112
151
  keyEntities
@@ -119,14 +158,15 @@ export default class TreeFoundation extends BaseFoundation {
119
158
  let value;
120
159
  let keyList = [];
121
160
  if (checkRelation === 'related') {
122
- keyList = normalizeKeyList(key, keyEntities, leafOnly);
161
+ keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
123
162
  } else if (checkRelation === 'unRelated') {
124
163
  keyList = key;
125
164
  }
165
+ const nodes = keyList.map(key => keyEntities[key] ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
126
166
  if (this.getProp('onChangeWithObject')) {
127
- value = keyList.map(itemKey => keyEntities[itemKey].data);
167
+ value = nodes;
128
168
  } else {
129
- value = getValueOrKey(keyList.map(itemKey => keyEntities[itemKey].data), keyMaps);
169
+ value = getValueOrKey(nodes, keyMaps);
130
170
  }
131
171
  this._adapter.notifyChange(value);
132
172
  }
@@ -285,7 +325,7 @@ export default class TreeFoundation extends BaseFoundation {
285
325
  return this.calcCheckedKeys(eventKey, targetStatus);
286
326
  }
287
327
  const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
288
- const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
328
+ const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true, true), nonDisabled);
289
329
  return calcCheckedKeys(newCheckedKeys, keyEntities);
290
330
  }
291
331
  /*
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.55.4",
3
+ "version": "2.56.0-beta.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.55.4",
10
+ "@douyinfe/semi-animation": "2.56.0-beta.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": "b164af409e92b8165e4355e9d53e011224986f62",
27
+ "gitHead": "ae4502e3075a19370e9f4ed32fbfb1292acd06c2",
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
  }
@@ -392,18 +392,23 @@ $overflowList: #{$prefix}-overflow-list;
392
392
  height: 100%;
393
393
  overflow: hidden;
394
394
  position: relative;
395
-
396
395
  &-empty {
397
396
  .#{$prefix}-input-wrapper {
398
397
  position: absolute;
399
398
  top: 0;
400
399
  left: 0;
401
400
  height: 100%;
402
- width: 100%;
401
+ // width: 100%; // no need to set width here, will calcuate inline style by js
402
+ }
403
+ }
404
+ .#{$prefix}-input-wrapper {
405
+ height: $height-select_multiple_input_default;
406
+ line-height: $height-select_multiple_input_default;
407
+ .#{$prefix}-input-default {
408
+ height: $height-select_multiple_input_default;
403
409
  }
404
410
  }
405
411
  }
406
-
407
412
  .#{$prefix}-input-wrapper {
408
413
  // position: absolute;
409
414
  // top: 0;
@@ -424,6 +429,26 @@ $overflowList: #{$prefix}-overflow-list;
424
429
  }
425
430
  }
426
431
 
432
+ .#{$multiple}.#{$filterable}.#{$module}-large {
433
+ .#{$prefix}-input-wrapper-large {
434
+ height: $height-select_multiple_input_large;
435
+ line-height: $height-select_multiple_input_large;
436
+ .#{$prefix}-input-large {
437
+ height: $height-select_multiple_input_large
438
+ }
439
+ }
440
+ }
441
+ .#{$multiple}.#{$filterable}.#{$module}-small {
442
+ .#{$prefix}-input-wrapper {
443
+ height: $height-select_multiple_input_small;
444
+ line-height: $height-select_multiple_input_small;
445
+ .#{$prefix}-input-small {
446
+ height: $height-select_multiple_input_small;
447
+ }
448
+ }
449
+ }
450
+
451
+
427
452
  .#{$module}-option-list-wrapper {
428
453
  padding-top: $spacing-select_option_list-paddingTop;
429
454
  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; // 选择器输入框描边宽度 - 选中
@@ -550,7 +550,8 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
550
550
  onHandleLeave = () => {
551
551
  // this._adapter.setEventDefault(e);
552
552
  const disabled = this._adapter.getState('disabled');
553
- if (!disabled && this.getStates()['focusPos'] === "") {
553
+ const isDrag = this._adapter.getState('isDrag');
554
+ if (!disabled && !isDrag) {
554
555
  this._adapter.onHandleLeave();
555
556
  }
556
557
  };
@@ -420,20 +420,55 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
420
420
  this._adapter.notifyChange(value as BasicValue);
421
421
  }
422
422
 
423
+ constructDataForValue(value: string) {
424
+ const { keyMaps } = this.getProps();
425
+ const keyName = get(keyMaps, 'key', 'key');
426
+ const labelName = get(keyMaps, 'label', 'label');
427
+ return {
428
+ [keyName]: value,
429
+ [labelName]: value
430
+ };
431
+ }
432
+
433
+ findDataForValue(findValue: string) {
434
+ const { value, defaultValue, keyMaps } = this.getProps();
435
+ const realValueName = get(keyMaps, 'value', 'value');
436
+ const realKeyName = get(keyMaps, 'key', 'key');
437
+ let valueArr = [];
438
+ if (value) {
439
+ valueArr = Array.isArray(value) ? value : [value];
440
+ } else if (defaultValue) {
441
+ valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
442
+ }
443
+ return valueArr.find(item => {
444
+ return item[realValueName] === findValue || item[realKeyName] === findValue;
445
+ });
446
+ }
447
+
448
+ getDataForKeyNotInKeyEntities(value: string) {
449
+ const { onChangeWithObject } = this.getProps();
450
+ if (onChangeWithObject) {
451
+ return this.findDataForValue(value);
452
+ } else {
453
+ return this.constructDataForValue(value);
454
+ }
455
+ }
456
+
423
457
  notifyMultipleChange(key: string[], e: any) {
424
458
  const { keyEntities } = this.getStates();
425
459
  const { leafOnly, checkRelation, keyMaps } = this.getProps();
426
460
  let value;
427
461
  let keyList = [];
428
462
  if (checkRelation === 'related') {
429
- keyList = normalizeKeyList(key, keyEntities, leafOnly);
463
+ keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
430
464
  } else if (checkRelation === 'unRelated') {
431
465
  keyList = key;
432
466
  }
467
+ const nodes = keyList.map(key => keyEntities[key] ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
433
468
  if (this.getProp('onChangeWithObject')) {
434
- value = keyList.map((itemKey: string) => keyEntities[itemKey].data);
469
+ value = nodes;
435
470
  } else {
436
- value = getValueOrKey(keyList.map((itemKey: string) => keyEntities[itemKey].data), keyMaps);
471
+ value = getValueOrKey(nodes, keyMaps);
437
472
  }
438
473
  this._adapter.notifyChange(value);
439
474
  }
@@ -585,7 +620,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
585
620
  const nonDisabled = descendantKeys.filter((key: string) => !disabledKeys.has(key));
586
621
  const newCheckedKeys = targetStatus ?
587
622
  [...nonDisabled, ...checkedKeys] :
588
- difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
623
+ difference(normalizeKeyList([...checkedKeys], keyEntities, true, true), nonDisabled);
589
624
  return calcCheckedKeys(newCheckedKeys, keyEntities);
590
625
  }
591
626