@douyinfe/semi-foundation 2.37.1 → 2.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -135,7 +135,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
135
135
|
focusInput(bool: boolean): void;
|
|
136
136
|
_notifyMultipleChange(key: string[], e: any): void;
|
|
137
137
|
_notifyChange(key: any, e: any): void;
|
|
138
|
-
_registerClickOutsideHandler: (
|
|
138
|
+
_registerClickOutsideHandler: () => void;
|
|
139
139
|
_notifyFocus(e: any): void;
|
|
140
140
|
handleTriggerFocus(e: any): void;
|
|
141
141
|
_notifyBlur(e: any): void;
|
|
@@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
21
|
class TreeSelectFoundation extends _foundation.default {
|
|
22
22
|
constructor(adapter) {
|
|
23
23
|
super(Object.assign({}, adapter));
|
|
24
|
-
this._registerClickOutsideHandler =
|
|
24
|
+
this._registerClickOutsideHandler = () => {
|
|
25
25
|
this._adapter.registerClickOutsideHandler(e => {
|
|
26
26
|
this.handlerTriggerBlur(e);
|
|
27
27
|
this.close(e);
|
|
@@ -37,11 +37,13 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
37
37
|
const triggerSearch = searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
|
|
38
38
|
const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
|
|
39
39
|
this._setDropdownWidth();
|
|
40
|
-
const
|
|
40
|
+
const able = !this._isDisabled();
|
|
41
|
+
const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
|
|
41
42
|
if (isOpen) {
|
|
42
43
|
this.open();
|
|
44
|
+
this._registerClickOutsideHandler();
|
|
43
45
|
}
|
|
44
|
-
if (triggerSearchAutoFocus) {
|
|
46
|
+
if (triggerSearchAutoFocus && able) {
|
|
45
47
|
this.handleTriggerFocus(null);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -272,7 +274,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
272
274
|
handleTriggerFocus(e) {
|
|
273
275
|
this._adapter.updateIsFocus(true);
|
|
274
276
|
this._notifyFocus(e);
|
|
275
|
-
this._registerClickOutsideHandler(
|
|
277
|
+
this._registerClickOutsideHandler();
|
|
276
278
|
}
|
|
277
279
|
// Scenes that may trigger blur
|
|
278
280
|
// 1、clickOutSide
|
|
@@ -282,6 +284,10 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
282
284
|
this._adapter.notifyBlur(e);
|
|
283
285
|
}
|
|
284
286
|
handlerTriggerBlur(e) {
|
|
287
|
+
const isFocus = this.getState('isFocus');
|
|
288
|
+
if (!isFocus) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
285
291
|
this._adapter.updateIsFocus(false);
|
|
286
292
|
this._notifyBlur(e);
|
|
287
293
|
this._adapter.unregisterClickOutsideHandler();
|
|
@@ -135,7 +135,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
135
135
|
focusInput(bool: boolean): void;
|
|
136
136
|
_notifyMultipleChange(key: string[], e: any): void;
|
|
137
137
|
_notifyChange(key: any, e: any): void;
|
|
138
|
-
_registerClickOutsideHandler: (
|
|
138
|
+
_registerClickOutsideHandler: () => void;
|
|
139
139
|
_notifyFocus(e: any): void;
|
|
140
140
|
handleTriggerFocus(e: any): void;
|
|
141
141
|
_notifyBlur(e: any): void;
|
|
@@ -14,7 +14,7 @@ import isEnterPress from '../utils/isEnterPress';
|
|
|
14
14
|
export default class TreeSelectFoundation extends BaseFoundation {
|
|
15
15
|
constructor(adapter) {
|
|
16
16
|
super(Object.assign({}, adapter));
|
|
17
|
-
this._registerClickOutsideHandler =
|
|
17
|
+
this._registerClickOutsideHandler = () => {
|
|
18
18
|
this._adapter.registerClickOutsideHandler(e => {
|
|
19
19
|
this.handlerTriggerBlur(e);
|
|
20
20
|
this.close(e);
|
|
@@ -30,11 +30,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
30
30
|
const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
|
|
31
31
|
const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
|
|
32
32
|
this._setDropdownWidth();
|
|
33
|
-
const
|
|
33
|
+
const able = !this._isDisabled();
|
|
34
|
+
const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
|
|
34
35
|
if (isOpen) {
|
|
35
36
|
this.open();
|
|
37
|
+
this._registerClickOutsideHandler();
|
|
36
38
|
}
|
|
37
|
-
if (triggerSearchAutoFocus) {
|
|
39
|
+
if (triggerSearchAutoFocus && able) {
|
|
38
40
|
this.handleTriggerFocus(null);
|
|
39
41
|
}
|
|
40
42
|
}
|
|
@@ -265,7 +267,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
265
267
|
handleTriggerFocus(e) {
|
|
266
268
|
this._adapter.updateIsFocus(true);
|
|
267
269
|
this._notifyFocus(e);
|
|
268
|
-
this._registerClickOutsideHandler(
|
|
270
|
+
this._registerClickOutsideHandler();
|
|
269
271
|
}
|
|
270
272
|
// Scenes that may trigger blur
|
|
271
273
|
// 1、clickOutSide
|
|
@@ -275,6 +277,10 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
275
277
|
this._adapter.notifyBlur(e);
|
|
276
278
|
}
|
|
277
279
|
handlerTriggerBlur(e) {
|
|
280
|
+
const isFocus = this.getState('isFocus');
|
|
281
|
+
if (!isFocus) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
278
284
|
this._adapter.updateIsFocus(false);
|
|
279
285
|
this._notifyBlur(e);
|
|
280
286
|
this._adapter.unregisterClickOutsideHandler();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.2",
|
|
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.37.
|
|
10
|
+
"@douyinfe/semi-animation": "2.37.2",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
13
|
"date-fns": "^2.29.3",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "a60ba17cdb9b16ace637706583ea31dbf3a6a255",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/treeSelect/foundation.ts
CHANGED
|
@@ -212,11 +212,13 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
212
212
|
const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
|
|
213
213
|
const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
|
|
214
214
|
this._setDropdownWidth();
|
|
215
|
-
const
|
|
215
|
+
const able = !this._isDisabled();
|
|
216
|
+
const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
|
|
216
217
|
if (isOpen) {
|
|
217
218
|
this.open();
|
|
219
|
+
this._registerClickOutsideHandler();
|
|
218
220
|
}
|
|
219
|
-
if (triggerSearchAutoFocus) {
|
|
221
|
+
if (triggerSearchAutoFocus && able) {
|
|
220
222
|
this.handleTriggerFocus(null);
|
|
221
223
|
}
|
|
222
224
|
}
|
|
@@ -433,7 +435,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
433
435
|
}
|
|
434
436
|
}
|
|
435
437
|
|
|
436
|
-
_registerClickOutsideHandler = (
|
|
438
|
+
_registerClickOutsideHandler = () => {
|
|
437
439
|
this._adapter.registerClickOutsideHandler(e => {
|
|
438
440
|
this.handlerTriggerBlur(e);
|
|
439
441
|
this.close(e);
|
|
@@ -449,7 +451,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
449
451
|
handleTriggerFocus(e: any) {
|
|
450
452
|
this._adapter.updateIsFocus(true);
|
|
451
453
|
this._notifyFocus(e);
|
|
452
|
-
this._registerClickOutsideHandler(
|
|
454
|
+
this._registerClickOutsideHandler();
|
|
453
455
|
}
|
|
454
456
|
|
|
455
457
|
// Scenes that may trigger blur
|
|
@@ -461,6 +463,10 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
461
463
|
}
|
|
462
464
|
|
|
463
465
|
handlerTriggerBlur(e) {
|
|
466
|
+
const isFocus = this.getState('isFocus');
|
|
467
|
+
if (!isFocus) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
464
470
|
this._adapter.updateIsFocus(false);
|
|
465
471
|
this._notifyBlur(e);
|
|
466
472
|
this._adapter.unregisterClickOutsideHandler();
|