@douyinfe/semi-foundation 2.38.0 → 2.38.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.
|
@@ -39,7 +39,9 @@ export interface AutoCompleteAdapter<P = Record<string, any>, S = Record<string,
|
|
|
39
39
|
notifyFocus: (event?: any) => void;
|
|
40
40
|
notifyBlur: (event?: any) => void;
|
|
41
41
|
rePositionDropdown: () => void;
|
|
42
|
-
persistEvent: (event: any) => void
|
|
42
|
+
persistEvent: (event: any) => void;
|
|
43
|
+
registerClickOutsideHandler: (cb: (e: any) => void) => void;
|
|
44
|
+
unregisterClickOutsideHandler: () => void
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AutoCompleteAdapter<P, S>, P, S> {
|
|
@@ -79,7 +81,7 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
destroy(): void {
|
|
82
|
-
|
|
84
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
83
85
|
// this.unBindKeyBoardEvent();
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -114,7 +116,7 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
114
116
|
this.isPanelOpen = true;
|
|
115
117
|
this._adapter.toggleListVisible(true);
|
|
116
118
|
this._setDropdownWidth();
|
|
117
|
-
|
|
119
|
+
this._adapter.registerClickOutsideHandler(e => this.closeDropdown(e));
|
|
118
120
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
119
121
|
this._modifyFocusIndexOnPanelOpen();
|
|
120
122
|
}
|
|
@@ -122,7 +124,7 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
122
124
|
closeDropdown(e?: any): void {
|
|
123
125
|
this.isPanelOpen = false;
|
|
124
126
|
this._adapter.toggleListVisible(false);
|
|
125
|
-
|
|
127
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
126
128
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
127
129
|
// After closing the panel, you can still open the panel by pressing the enter key
|
|
128
130
|
// this.unBindKeyBoardEvent();
|
|
@@ -31,6 +31,8 @@ export interface AutoCompleteAdapter<P = Record<string, any>, S = Record<string,
|
|
|
31
31
|
notifyBlur: (event?: any) => void;
|
|
32
32
|
rePositionDropdown: () => void;
|
|
33
33
|
persistEvent: (event: any) => void;
|
|
34
|
+
registerClickOutsideHandler: (cb: (e: any) => void) => void;
|
|
35
|
+
unregisterClickOutsideHandler: () => void;
|
|
34
36
|
}
|
|
35
37
|
declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AutoCompleteAdapter<P, S>, P, S> {
|
|
36
38
|
private _keydownHandler;
|
|
@@ -47,9 +47,10 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
destroy() {
|
|
50
|
-
|
|
50
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
51
51
|
// this.unBindKeyBoardEvent();
|
|
52
52
|
}
|
|
53
|
+
|
|
53
54
|
_setDropdownWidth() {
|
|
54
55
|
const {
|
|
55
56
|
style,
|
|
@@ -86,14 +87,14 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
86
87
|
this.isPanelOpen = true;
|
|
87
88
|
this._adapter.toggleListVisible(true);
|
|
88
89
|
this._setDropdownWidth();
|
|
89
|
-
|
|
90
|
+
this._adapter.registerClickOutsideHandler(e => this.closeDropdown(e));
|
|
90
91
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
91
92
|
this._modifyFocusIndexOnPanelOpen();
|
|
92
93
|
}
|
|
93
94
|
closeDropdown(e) {
|
|
94
95
|
this.isPanelOpen = false;
|
|
95
96
|
this._adapter.toggleListVisible(false);
|
|
96
|
-
|
|
97
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
97
98
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
98
99
|
// After closing the panel, you can still open the panel by pressing the enter key
|
|
99
100
|
// this.unBindKeyBoardEvent();
|
|
@@ -31,6 +31,8 @@ export interface AutoCompleteAdapter<P = Record<string, any>, S = Record<string,
|
|
|
31
31
|
notifyBlur: (event?: any) => void;
|
|
32
32
|
rePositionDropdown: () => void;
|
|
33
33
|
persistEvent: (event: any) => void;
|
|
34
|
+
registerClickOutsideHandler: (cb: (e: any) => void) => void;
|
|
35
|
+
unregisterClickOutsideHandler: () => void;
|
|
34
36
|
}
|
|
35
37
|
declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AutoCompleteAdapter<P, S>, P, S> {
|
|
36
38
|
private _keydownHandler;
|
|
@@ -39,9 +39,10 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
destroy() {
|
|
42
|
-
|
|
42
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
43
43
|
// this.unBindKeyBoardEvent();
|
|
44
44
|
}
|
|
45
|
+
|
|
45
46
|
_setDropdownWidth() {
|
|
46
47
|
const {
|
|
47
48
|
style,
|
|
@@ -78,14 +79,14 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
78
79
|
this.isPanelOpen = true;
|
|
79
80
|
this._adapter.toggleListVisible(true);
|
|
80
81
|
this._setDropdownWidth();
|
|
81
|
-
|
|
82
|
+
this._adapter.registerClickOutsideHandler(e => this.closeDropdown(e));
|
|
82
83
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
83
84
|
this._modifyFocusIndexOnPanelOpen();
|
|
84
85
|
}
|
|
85
86
|
closeDropdown(e) {
|
|
86
87
|
this.isPanelOpen = false;
|
|
87
88
|
this._adapter.toggleListVisible(false);
|
|
88
|
-
|
|
89
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
89
90
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
90
91
|
// After closing the panel, you can still open the panel by pressing the enter key
|
|
91
92
|
// this.unBindKeyBoardEvent();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.38.
|
|
3
|
+
"version": "2.38.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.38.
|
|
10
|
+
"@douyinfe/semi-animation": "2.38.1",
|
|
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": "aaad3c86114e9bd2d9a61c8b78260e18ffc0eec6",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|