@douyinfe/semi-foundation 2.59.0 → 2.59.1

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.
@@ -283,6 +283,11 @@ $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'ligh
283
283
  border-radius: var(--semi-border-radius-circle);
284
284
  line-height:normal;
285
285
  }
286
+ &-shape_circle-extra-small{
287
+ width:$width-avatar-bottom_slot_circle_extra_small;
288
+ height:$width-avatar-bottom_slot_circle_extra_small;
289
+ font-size: $font-avatar_bottom_slot-extra_small-fontSize;
290
+ }
286
291
  &-shape_circle-small{
287
292
  width:$width-avatar-bottom_slot_circle_small;
288
293
  height:$width-avatar-bottom_slot_circle_small;
@@ -324,6 +329,11 @@ $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'ligh
324
329
  border-color: $color-avatar-bottom_slot_square-border;
325
330
  }
326
331
 
332
+ &-shape_square-extra_small{
333
+ font-size: $font-avatar_bottom_slot-extra_small-fontSize;
334
+ border-width: $width-avatar-bottom_slot_square_extra_small-border;
335
+ }
336
+
327
337
  &-shape_square-small{
328
338
  font-size: $font-avatar_bottom_slot-small-fontSize;
329
339
  border-width: $width-avatar-bottom_slot_square_small-border;
@@ -50,6 +50,7 @@ $width-avatar_additional-border: 1.5px; // 额外描边尺寸
50
50
  $color-avatar_additional-border: var(--semi-color-primary); // 额外描边颜色
51
51
  $spacing-avatar_additional-borderGap: 2px; // 额外描边与内侧间距
52
52
 
53
+ $width-avatar-bottom_slot_circle_extra_small: 12px; // extra small 头像底部 slot 圆形半径
53
54
  $width-avatar-bottom_slot_circle_small: 12px; // small 头像底部 slot 圆形半径
54
55
  $width-avatar-bottom_slot_circle_default: 16px; // default 头像底部 slot 圆形半径
55
56
  $width-avatar-bottom_slot_circle_medium: 18px; // medium 头像底部 slot 圆形半径
@@ -58,6 +59,7 @@ $width-avatar-bottom_slot_circle_extra_large: 28px; // extra large 头像底部
58
59
  $color-avatar-bottom_slot_bg:var(--semi-color-primary); // 头像底部 slot 背景色
59
60
 
60
61
  $radius-avatar-bottom_slot_square:4px; // 底部 slot square 圆角
62
+ $font-avatar_bottom_slot-extra_small-fontSize: 5px; // extra small 底部 slot 文字大小
61
63
  $font-avatar_bottom_slot-small-fontSize: 5px; // small 底部 slot 文字大小
62
64
  $font-avatar_bottom_slot-default-fontSize: 12px; // default 底部 slot 文字大小
63
65
  $font-avatar_bottom_slot-medium-fontSize: 12px; // medium 底部 slot 文字大小
@@ -79,6 +81,7 @@ $spacing-avatar-top_slot_large-content-marginTop: 0px; // large 顶部文字 mar
79
81
  $spacing-avatar-top_slot_extra_large-content-marginTop: 0px; // extra large 顶部文字 marginTop
80
82
 
81
83
  $color-avatar-bottom_slot_square-border:var(--semi-color-bg-0); // 底部 square 边框颜色
84
+ $width-avatar-bottom_slot_square_extra_small-border:2px; // small 头像底部 square 边框宽度
82
85
  $width-avatar-bottom_slot_square_small-border:2px; // small 头像底部 square 边框宽度
83
86
  $width-avatar-bottom_slot_square_default-border:2px; // default 头像底部 square 边框宽度
84
87
  $width-avatar-bottom_slot_square_medium-border:2px; // medium 头像底部 square 边框宽度
package/form/interface.ts CHANGED
@@ -36,22 +36,38 @@ export interface setValuesConfig {
36
36
  isOverride: boolean
37
37
  }
38
38
 
39
- type ExcludeStringNumberKeys<T> = {
40
- [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]
41
- }
42
-
43
- type CustomKeys<T> = { [K in keyof T]: string extends K ? never : number extends K ? never : K; } extends { [K in keyof T]: infer U } ? U : never;
44
-
45
- type FieldPath<T, K extends CustomKeys<T> = CustomKeys<T>> = K extends string ? T[K] extends Record<string, any> ? `${K}.${FieldPath<T[K], CustomKeys<T[K]>>}` | K : K : never;
39
+ // FieldPath 类型定义,用于生成对象字段的路径字符串
40
+ export type FieldPath<T> = T extends object ? {
41
+ // 遍历对象的每个键 K
42
+ [K in keyof T]: T[K] extends object
43
+ // 如果键 K 对应的值是对象,则生成嵌套路径(递归调用 FieldPath)
44
+ ? `${string & K}.${FieldPath<T[K]>}` | `${string & K}`
45
+ // 否则,仅生成当前键的路径
46
+ : `${string & K}`;
47
+ }[keyof T]
48
+ : never;
49
+
50
+ // FieldPathValue 类型定义,用于从路径字符串中推导出实际的类型
51
+ export type FieldPathValue<T, P extends FieldPath<T>> =
52
+ // 如果路径字符串 P 包含嵌套路径(使用模板字符串类型进行匹配)
53
+ P extends `${infer K}.${infer Rest}`
54
+ ? K extends keyof T
55
+ // 递归解析嵌套路径,逐层深入对象结构
56
+ ? Rest extends FieldPath<T[K]>
57
+ ? FieldPathValue<T[K], Rest>
58
+ : never
59
+ : never
60
+ // 如果路径字符串 P 是顶层键
61
+ : P extends keyof T
62
+ ? T[P]
63
+ : never;
46
64
 
47
65
  // use object replace Record<string, any>, fix issue 933
48
66
  export interface BaseFormApi<T extends object = any> {
49
- // export interface BaseFormApi<T extends object = any> {
50
67
  /** get value of field */
51
- getValue: <K extends keyof T>(field?: K) => T[K];
68
+ getValue: <P extends FieldPath<T>>(field?: P) => FieldPathValue<T, P>;
52
69
  /** set value of field */
53
- setValue: <K extends CustomKeys<T>>(field: FieldPath<T, K> | FieldPath<K>, newFieldValue: any) => void;
54
- // setValue: <K extends keyof T>(field: K, newFieldValue: T[K]) => void;
70
+ setValue: <K extends FieldPath<T>>(field: K, newFieldValue: any) => void;
55
71
  /** get error of field */
56
72
  getError: <K extends keyof T>(field: K) => any;
57
73
  /** set error of field */
@@ -236,6 +236,11 @@
236
236
  border-radius: var(--semi-border-radius-circle);
237
237
  line-height: normal;
238
238
  }
239
+ .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_circle-extra-small {
240
+ width: 12px;
241
+ height: 12px;
242
+ font-size: 5px;
243
+ }
239
244
  .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_circle-small {
240
245
  width: 12px;
241
246
  height: 12px;
@@ -272,6 +277,10 @@
272
277
  border-style: solid;
273
278
  border-color: var(--semi-color-bg-0);
274
279
  }
280
+ .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_square-extra_small {
281
+ font-size: 5px;
282
+ border-width: 2px;
283
+ }
275
284
  .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_square-small {
276
285
  font-size: 5px;
277
286
  border-width: 2px;
@@ -283,6 +283,11 @@ $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'ligh
283
283
  border-radius: var(--semi-border-radius-circle);
284
284
  line-height:normal;
285
285
  }
286
+ &-shape_circle-extra-small{
287
+ width:$width-avatar-bottom_slot_circle_extra_small;
288
+ height:$width-avatar-bottom_slot_circle_extra_small;
289
+ font-size: $font-avatar_bottom_slot-extra_small-fontSize;
290
+ }
286
291
  &-shape_circle-small{
287
292
  width:$width-avatar-bottom_slot_circle_small;
288
293
  height:$width-avatar-bottom_slot_circle_small;
@@ -324,6 +329,11 @@ $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'ligh
324
329
  border-color: $color-avatar-bottom_slot_square-border;
325
330
  }
326
331
 
332
+ &-shape_square-extra_small{
333
+ font-size: $font-avatar_bottom_slot-extra_small-fontSize;
334
+ border-width: $width-avatar-bottom_slot_square_extra_small-border;
335
+ }
336
+
327
337
  &-shape_square-small{
328
338
  font-size: $font-avatar_bottom_slot-small-fontSize;
329
339
  border-width: $width-avatar-bottom_slot_square_small-border;
@@ -50,6 +50,7 @@ $width-avatar_additional-border: 1.5px; // 额外描边尺寸
50
50
  $color-avatar_additional-border: var(--semi-color-primary); // 额外描边颜色
51
51
  $spacing-avatar_additional-borderGap: 2px; // 额外描边与内侧间距
52
52
 
53
+ $width-avatar-bottom_slot_circle_extra_small: 12px; // extra small 头像底部 slot 圆形半径
53
54
  $width-avatar-bottom_slot_circle_small: 12px; // small 头像底部 slot 圆形半径
54
55
  $width-avatar-bottom_slot_circle_default: 16px; // default 头像底部 slot 圆形半径
55
56
  $width-avatar-bottom_slot_circle_medium: 18px; // medium 头像底部 slot 圆形半径
@@ -58,6 +59,7 @@ $width-avatar-bottom_slot_circle_extra_large: 28px; // extra large 头像底部
58
59
  $color-avatar-bottom_slot_bg:var(--semi-color-primary); // 头像底部 slot 背景色
59
60
 
60
61
  $radius-avatar-bottom_slot_square:4px; // 底部 slot square 圆角
62
+ $font-avatar_bottom_slot-extra_small-fontSize: 5px; // extra small 底部 slot 文字大小
61
63
  $font-avatar_bottom_slot-small-fontSize: 5px; // small 底部 slot 文字大小
62
64
  $font-avatar_bottom_slot-default-fontSize: 12px; // default 底部 slot 文字大小
63
65
  $font-avatar_bottom_slot-medium-fontSize: 12px; // medium 底部 slot 文字大小
@@ -79,6 +81,7 @@ $spacing-avatar-top_slot_large-content-marginTop: 0px; // large 顶部文字 mar
79
81
  $spacing-avatar-top_slot_extra_large-content-marginTop: 0px; // extra large 顶部文字 marginTop
80
82
 
81
83
  $color-avatar-bottom_slot_square-border:var(--semi-color-bg-0); // 底部 square 边框颜色
84
+ $width-avatar-bottom_slot_square_extra_small-border:2px; // small 头像底部 square 边框宽度
82
85
  $width-avatar-bottom_slot_square_small-border:2px; // small 头像底部 square 边框宽度
83
86
  $width-avatar-bottom_slot_square_default-border:2px; // default 头像底部 square 边框宽度
84
87
  $width-avatar-bottom_slot_square_medium-border:2px; // medium 头像底部 square 边框宽度
@@ -31,17 +31,15 @@ export interface FormState<T extends Record<string, any> = any> {
31
31
  export interface setValuesConfig {
32
32
  isOverride: boolean;
33
33
  }
34
- type CustomKeys<T> = {
35
- [K in keyof T]: string extends K ? never : number extends K ? never : K;
36
- } extends {
37
- [K in keyof T]: infer U;
38
- } ? U : never;
39
- type FieldPath<T, K extends CustomKeys<T> = CustomKeys<T>> = K extends string ? T[K] extends Record<string, any> ? `${K}.${FieldPath<T[K], CustomKeys<T[K]>>}` | K : K : never;
34
+ export type FieldPath<T> = T extends object ? {
35
+ [K in keyof T]: T[K] extends object ? `${string & K}.${FieldPath<T[K]>}` | `${string & K}` : `${string & K}`;
36
+ }[keyof T] : never;
37
+ export type FieldPathValue<T, P extends FieldPath<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends FieldPath<T[K]> ? FieldPathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
40
38
  export interface BaseFormApi<T extends object = any> {
41
39
  /** get value of field */
42
- getValue: <K extends keyof T>(field?: K) => T[K];
40
+ getValue: <P extends FieldPath<T>>(field?: P) => FieldPathValue<T, P>;
43
41
  /** set value of field */
44
- setValue: <K extends CustomKeys<T>>(field: FieldPath<T, K> | FieldPath<K>, newFieldValue: any) => void;
42
+ setValue: <K extends FieldPath<T>>(field: K, newFieldValue: any) => void;
45
43
  /** get error of field */
46
44
  getError: <K extends keyof T>(field: K) => any;
47
45
  /** set error of field */
@@ -128,4 +126,3 @@ export interface FormUpdaterContextType {
128
126
  getArrayField: (arrayField: string) => ArrayFieldStaff;
129
127
  updateArrayField: (arrayField: string, updateValue: any) => void;
130
128
  }
131
- export {};
@@ -16,6 +16,7 @@
16
16
  .semi-toast-wrapper .semi-toast-innerWrapper {
17
17
  width: fit-content;
18
18
  height: fit-content;
19
+ text-align: center;
19
20
  }
20
21
  .semi-toast-wrapper .semi-toast-innerWrapper-hover .semi-toast-zero-height-wrapper {
21
22
  perspective: unset;
@@ -18,6 +18,7 @@ $icon: #{$prefix}-toast-icon;
18
18
  .#{$module}-innerWrapper{
19
19
  width: fit-content;
20
20
  height: fit-content;
21
+ text-align: center;
21
22
  &-hover{
22
23
  .#{$module}-zero-height-wrapper{
23
24
  perspective: unset;
@@ -136,7 +136,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
136
136
  focusInput(bool: boolean): void;
137
137
  _notifyMultipleChange(key: string[], e: any): void;
138
138
  _notifyChange(key: any, e: any): void;
139
- _registerClickOutsideHandler: (e: any) => void;
139
+ _registerClickOutsideHandler: () => void;
140
140
  clearInputValue: () => void;
141
141
  _notifyFocus(e: any): void;
142
142
  handleTriggerFocus(e: any): void;
@@ -19,7 +19,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
  class TreeSelectFoundation extends _foundation.default {
20
20
  constructor(adapter) {
21
21
  super(Object.assign({}, adapter));
22
- this._registerClickOutsideHandler = e => {
22
+ this._registerClickOutsideHandler = () => {
23
23
  this._adapter.registerClickOutsideHandler(e => {
24
24
  this.handlerTriggerBlur(e);
25
25
  this.close(e);
@@ -41,11 +41,13 @@ class TreeSelectFoundation extends _foundation.default {
41
41
  const triggerSearch = searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
42
42
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
43
43
  this._setDropdownWidth();
44
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
44
+ const able = !this._isDisabled();
45
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
45
46
  if (isOpen) {
46
47
  this.open();
48
+ this._registerClickOutsideHandler();
47
49
  }
48
- if (triggerSearchAutoFocus) {
50
+ if (triggerSearchAutoFocus && able) {
49
51
  this.handleTriggerFocus(null);
50
52
  }
51
53
  }
@@ -277,7 +279,7 @@ class TreeSelectFoundation extends _foundation.default {
277
279
  handleTriggerFocus(e) {
278
280
  this._adapter.updateIsFocus(true);
279
281
  this._notifyFocus(e);
280
- this._registerClickOutsideHandler(e);
282
+ this._registerClickOutsideHandler();
281
283
  }
282
284
  // Scenes that may trigger blur
283
285
  // 1、clickOutSide
@@ -287,6 +289,10 @@ class TreeSelectFoundation extends _foundation.default {
287
289
  this._adapter.notifyBlur(e);
288
290
  }
289
291
  handlerTriggerBlur(e) {
292
+ const isFocus = this.getState('isFocus');
293
+ if (!isFocus) {
294
+ return;
295
+ }
290
296
  this._adapter.updateIsFocus(false);
291
297
  this._notifyBlur(e);
292
298
  this._adapter.unregisterClickOutsideHandler();
@@ -236,6 +236,11 @@
236
236
  border-radius: var(--semi-border-radius-circle);
237
237
  line-height: normal;
238
238
  }
239
+ .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_circle-extra-small {
240
+ width: 12px;
241
+ height: 12px;
242
+ font-size: 5px;
243
+ }
239
244
  .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_circle-small {
240
245
  width: 12px;
241
246
  height: 12px;
@@ -272,6 +277,10 @@
272
277
  border-style: solid;
273
278
  border-color: var(--semi-color-bg-0);
274
279
  }
280
+ .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_square-extra_small {
281
+ font-size: 5px;
282
+ border-width: 2px;
283
+ }
275
284
  .semi-avatar-wrapper .semi-avatar-bottom_slot-shape_square-small {
276
285
  font-size: 5px;
277
286
  border-width: 2px;
@@ -283,6 +283,11 @@ $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'ligh
283
283
  border-radius: var(--semi-border-radius-circle);
284
284
  line-height:normal;
285
285
  }
286
+ &-shape_circle-extra-small{
287
+ width:$width-avatar-bottom_slot_circle_extra_small;
288
+ height:$width-avatar-bottom_slot_circle_extra_small;
289
+ font-size: $font-avatar_bottom_slot-extra_small-fontSize;
290
+ }
286
291
  &-shape_circle-small{
287
292
  width:$width-avatar-bottom_slot_circle_small;
288
293
  height:$width-avatar-bottom_slot_circle_small;
@@ -324,6 +329,11 @@ $colors: 'amber', 'blue', 'cyan', 'green', 'grey', 'indigo', 'light-blue', 'ligh
324
329
  border-color: $color-avatar-bottom_slot_square-border;
325
330
  }
326
331
 
332
+ &-shape_square-extra_small{
333
+ font-size: $font-avatar_bottom_slot-extra_small-fontSize;
334
+ border-width: $width-avatar-bottom_slot_square_extra_small-border;
335
+ }
336
+
327
337
  &-shape_square-small{
328
338
  font-size: $font-avatar_bottom_slot-small-fontSize;
329
339
  border-width: $width-avatar-bottom_slot_square_small-border;
@@ -50,6 +50,7 @@ $width-avatar_additional-border: 1.5px; // 额外描边尺寸
50
50
  $color-avatar_additional-border: var(--semi-color-primary); // 额外描边颜色
51
51
  $spacing-avatar_additional-borderGap: 2px; // 额外描边与内侧间距
52
52
 
53
+ $width-avatar-bottom_slot_circle_extra_small: 12px; // extra small 头像底部 slot 圆形半径
53
54
  $width-avatar-bottom_slot_circle_small: 12px; // small 头像底部 slot 圆形半径
54
55
  $width-avatar-bottom_slot_circle_default: 16px; // default 头像底部 slot 圆形半径
55
56
  $width-avatar-bottom_slot_circle_medium: 18px; // medium 头像底部 slot 圆形半径
@@ -58,6 +59,7 @@ $width-avatar-bottom_slot_circle_extra_large: 28px; // extra large 头像底部
58
59
  $color-avatar-bottom_slot_bg:var(--semi-color-primary); // 头像底部 slot 背景色
59
60
 
60
61
  $radius-avatar-bottom_slot_square:4px; // 底部 slot square 圆角
62
+ $font-avatar_bottom_slot-extra_small-fontSize: 5px; // extra small 底部 slot 文字大小
61
63
  $font-avatar_bottom_slot-small-fontSize: 5px; // small 底部 slot 文字大小
62
64
  $font-avatar_bottom_slot-default-fontSize: 12px; // default 底部 slot 文字大小
63
65
  $font-avatar_bottom_slot-medium-fontSize: 12px; // medium 底部 slot 文字大小
@@ -79,6 +81,7 @@ $spacing-avatar-top_slot_large-content-marginTop: 0px; // large 顶部文字 mar
79
81
  $spacing-avatar-top_slot_extra_large-content-marginTop: 0px; // extra large 顶部文字 marginTop
80
82
 
81
83
  $color-avatar-bottom_slot_square-border:var(--semi-color-bg-0); // 底部 square 边框颜色
84
+ $width-avatar-bottom_slot_square_extra_small-border:2px; // small 头像底部 square 边框宽度
82
85
  $width-avatar-bottom_slot_square_small-border:2px; // small 头像底部 square 边框宽度
83
86
  $width-avatar-bottom_slot_square_default-border:2px; // default 头像底部 square 边框宽度
84
87
  $width-avatar-bottom_slot_square_medium-border:2px; // medium 头像底部 square 边框宽度
@@ -31,17 +31,15 @@ export interface FormState<T extends Record<string, any> = any> {
31
31
  export interface setValuesConfig {
32
32
  isOverride: boolean;
33
33
  }
34
- type CustomKeys<T> = {
35
- [K in keyof T]: string extends K ? never : number extends K ? never : K;
36
- } extends {
37
- [K in keyof T]: infer U;
38
- } ? U : never;
39
- type FieldPath<T, K extends CustomKeys<T> = CustomKeys<T>> = K extends string ? T[K] extends Record<string, any> ? `${K}.${FieldPath<T[K], CustomKeys<T[K]>>}` | K : K : never;
34
+ export type FieldPath<T> = T extends object ? {
35
+ [K in keyof T]: T[K] extends object ? `${string & K}.${FieldPath<T[K]>}` | `${string & K}` : `${string & K}`;
36
+ }[keyof T] : never;
37
+ export type FieldPathValue<T, P extends FieldPath<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends FieldPath<T[K]> ? FieldPathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
40
38
  export interface BaseFormApi<T extends object = any> {
41
39
  /** get value of field */
42
- getValue: <K extends keyof T>(field?: K) => T[K];
40
+ getValue: <P extends FieldPath<T>>(field?: P) => FieldPathValue<T, P>;
43
41
  /** set value of field */
44
- setValue: <K extends CustomKeys<T>>(field: FieldPath<T, K> | FieldPath<K>, newFieldValue: any) => void;
42
+ setValue: <K extends FieldPath<T>>(field: K, newFieldValue: any) => void;
45
43
  /** get error of field */
46
44
  getError: <K extends keyof T>(field: K) => any;
47
45
  /** set error of field */
@@ -128,4 +126,3 @@ export interface FormUpdaterContextType {
128
126
  getArrayField: (arrayField: string) => ArrayFieldStaff;
129
127
  updateArrayField: (arrayField: string, updateValue: any) => void;
130
128
  }
131
- export {};
@@ -16,6 +16,7 @@
16
16
  .semi-toast-wrapper .semi-toast-innerWrapper {
17
17
  width: fit-content;
18
18
  height: fit-content;
19
+ text-align: center;
19
20
  }
20
21
  .semi-toast-wrapper .semi-toast-innerWrapper-hover .semi-toast-zero-height-wrapper {
21
22
  perspective: unset;
@@ -18,6 +18,7 @@ $icon: #{$prefix}-toast-icon;
18
18
  .#{$module}-innerWrapper{
19
19
  width: fit-content;
20
20
  height: fit-content;
21
+ text-align: center;
21
22
  &-hover{
22
23
  .#{$module}-zero-height-wrapper{
23
24
  perspective: unset;
@@ -136,7 +136,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
136
136
  focusInput(bool: boolean): void;
137
137
  _notifyMultipleChange(key: string[], e: any): void;
138
138
  _notifyChange(key: any, e: any): void;
139
- _registerClickOutsideHandler: (e: any) => void;
139
+ _registerClickOutsideHandler: () => void;
140
140
  clearInputValue: () => void;
141
141
  _notifyFocus(e: any): void;
142
142
  handleTriggerFocus(e: any): void;
@@ -12,7 +12,7 @@ import isEnterPress from '../utils/isEnterPress';
12
12
  export default class TreeSelectFoundation extends BaseFoundation {
13
13
  constructor(adapter) {
14
14
  super(Object.assign({}, adapter));
15
- this._registerClickOutsideHandler = e => {
15
+ this._registerClickOutsideHandler = () => {
16
16
  this._adapter.registerClickOutsideHandler(e => {
17
17
  this.handlerTriggerBlur(e);
18
18
  this.close(e);
@@ -34,11 +34,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
34
34
  const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
35
35
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
36
36
  this._setDropdownWidth();
37
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
37
+ const able = !this._isDisabled();
38
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
38
39
  if (isOpen) {
39
40
  this.open();
41
+ this._registerClickOutsideHandler();
40
42
  }
41
- if (triggerSearchAutoFocus) {
43
+ if (triggerSearchAutoFocus && able) {
42
44
  this.handleTriggerFocus(null);
43
45
  }
44
46
  }
@@ -270,7 +272,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
270
272
  handleTriggerFocus(e) {
271
273
  this._adapter.updateIsFocus(true);
272
274
  this._notifyFocus(e);
273
- this._registerClickOutsideHandler(e);
275
+ this._registerClickOutsideHandler();
274
276
  }
275
277
  // Scenes that may trigger blur
276
278
  // 1、clickOutSide
@@ -280,6 +282,10 @@ export default class TreeSelectFoundation extends BaseFoundation {
280
282
  this._adapter.notifyBlur(e);
281
283
  }
282
284
  handlerTriggerBlur(e) {
285
+ const isFocus = this.getState('isFocus');
286
+ if (!isFocus) {
287
+ return;
288
+ }
283
289
  this._adapter.updateIsFocus(false);
284
290
  this._notifyBlur(e);
285
291
  this._adapter.unregisterClickOutsideHandler();
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.59.0",
3
+ "version": "2.59.1",
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.59.0",
10
+ "@douyinfe/semi-animation": "2.59.1",
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": "b9a08d8581277fdc6ae9c33cdfc78b39938e5de1",
27
+ "gitHead": "8a6430348ea43876d481711b00d30360b6d62948",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-transform-runtime": "^7.15.8",
30
30
  "@babel/preset-env": "^7.15.8",
package/toast/toast.scss CHANGED
@@ -18,6 +18,7 @@ $icon: #{$prefix}-toast-icon;
18
18
  .#{$module}-innerWrapper{
19
19
  width: fit-content;
20
20
  height: fit-content;
21
+ text-align: center;
21
22
  &-hover{
22
23
  .#{$module}-zero-height-wrapper{
23
24
  perspective: unset;
@@ -215,11 +215,13 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
215
215
  const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
216
216
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
217
217
  this._setDropdownWidth();
218
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
218
+ const able = !this._isDisabled();
219
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
219
220
  if (isOpen) {
220
221
  this.open();
222
+ this._registerClickOutsideHandler();
221
223
  }
222
- if (triggerSearchAutoFocus) {
224
+ if (triggerSearchAutoFocus && able) {
223
225
  this.handleTriggerFocus(null);
224
226
  }
225
227
  }
@@ -429,7 +431,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
429
431
  }
430
432
  }
431
433
 
432
- _registerClickOutsideHandler = (e) => {
434
+ _registerClickOutsideHandler = () => {
433
435
  this._adapter.registerClickOutsideHandler(e => {
434
436
  this.handlerTriggerBlur(e);
435
437
  this.close(e);
@@ -450,7 +452,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
450
452
  handleTriggerFocus(e: any) {
451
453
  this._adapter.updateIsFocus(true);
452
454
  this._notifyFocus(e);
453
- this._registerClickOutsideHandler(e);
455
+ this._registerClickOutsideHandler();
454
456
  }
455
457
 
456
458
  // Scenes that may trigger blur
@@ -462,6 +464,10 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
462
464
  }
463
465
 
464
466
  handlerTriggerBlur(e) {
467
+ const isFocus = this.getState('isFocus');
468
+ if (!isFocus) {
469
+ return;
470
+ }
465
471
  this._adapter.updateIsFocus(false);
466
472
  this._notifyBlur(e);
467
473
  this._adapter.unregisterClickOutsideHandler();