@rc-component/trigger 1.14.2 → 1.14.3
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/es/hooks/useWinClick.js +12 -12
- package/lib/hooks/useWinClick.js +12 -12
- package/package.json +1 -1
package/es/hooks/useWinClick.js
CHANGED
|
@@ -53,16 +53,16 @@ export default function useWinClick(open, clickToHide, targetEle, popupEle, mask
|
|
|
53
53
|
onShadowMouseDown = _genClickEvents4[0],
|
|
54
54
|
onShadowClick = _genClickEvents4[1];
|
|
55
55
|
var win = getWin(popupEle);
|
|
56
|
-
win.addEventListener('mousedown', onWinMouseDown);
|
|
57
|
-
win.addEventListener('click', onWinClick);
|
|
58
|
-
win.addEventListener('contextmenu', onWinClick);
|
|
56
|
+
win.addEventListener('mousedown', onWinMouseDown, true);
|
|
57
|
+
win.addEventListener('click', onWinClick, true);
|
|
58
|
+
win.addEventListener('contextmenu', onWinClick, true);
|
|
59
59
|
|
|
60
60
|
// shadow root
|
|
61
61
|
var targetShadowRoot = getShadowRoot(targetEle);
|
|
62
62
|
if (targetShadowRoot) {
|
|
63
|
-
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown);
|
|
64
|
-
targetShadowRoot.addEventListener('click', onShadowClick);
|
|
65
|
-
targetShadowRoot.addEventListener('contextmenu', onShadowClick);
|
|
63
|
+
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
|
|
64
|
+
targetShadowRoot.addEventListener('click', onShadowClick, true);
|
|
65
|
+
targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// Warning if target and popup not in same root
|
|
@@ -73,13 +73,13 @@ export default function useWinClick(open, clickToHide, targetEle, popupEle, mask
|
|
|
73
73
|
warning(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
|
|
74
74
|
}
|
|
75
75
|
return function () {
|
|
76
|
-
win.removeEventListener('mousedown', onWinMouseDown);
|
|
77
|
-
win.removeEventListener('click', onWinClick);
|
|
78
|
-
win.removeEventListener('contextmenu', onWinClick);
|
|
76
|
+
win.removeEventListener('mousedown', onWinMouseDown, true);
|
|
77
|
+
win.removeEventListener('click', onWinClick, true);
|
|
78
|
+
win.removeEventListener('contextmenu', onWinClick, true);
|
|
79
79
|
if (targetShadowRoot) {
|
|
80
|
-
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown);
|
|
81
|
-
targetShadowRoot.removeEventListener('click', onShadowClick);
|
|
82
|
-
targetShadowRoot.removeEventListener('contextmenu', onShadowClick);
|
|
80
|
+
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
|
|
81
|
+
targetShadowRoot.removeEventListener('click', onShadowClick, true);
|
|
82
|
+
targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
}
|
package/lib/hooks/useWinClick.js
CHANGED
|
@@ -61,16 +61,16 @@ function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable,
|
|
|
61
61
|
onShadowMouseDown = _genClickEvents4[0],
|
|
62
62
|
onShadowClick = _genClickEvents4[1];
|
|
63
63
|
var win = (0, _util.getWin)(popupEle);
|
|
64
|
-
win.addEventListener('mousedown', onWinMouseDown);
|
|
65
|
-
win.addEventListener('click', onWinClick);
|
|
66
|
-
win.addEventListener('contextmenu', onWinClick);
|
|
64
|
+
win.addEventListener('mousedown', onWinMouseDown, true);
|
|
65
|
+
win.addEventListener('click', onWinClick, true);
|
|
66
|
+
win.addEventListener('contextmenu', onWinClick, true);
|
|
67
67
|
|
|
68
68
|
// shadow root
|
|
69
69
|
var targetShadowRoot = (0, _shadow.getShadowRoot)(targetEle);
|
|
70
70
|
if (targetShadowRoot) {
|
|
71
|
-
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown);
|
|
72
|
-
targetShadowRoot.addEventListener('click', onShadowClick);
|
|
73
|
-
targetShadowRoot.addEventListener('contextmenu', onShadowClick);
|
|
71
|
+
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
|
|
72
|
+
targetShadowRoot.addEventListener('click', onShadowClick, true);
|
|
73
|
+
targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// Warning if target and popup not in same root
|
|
@@ -81,13 +81,13 @@ function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable,
|
|
|
81
81
|
(0, _rcUtil.warning)(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
|
|
82
82
|
}
|
|
83
83
|
return function () {
|
|
84
|
-
win.removeEventListener('mousedown', onWinMouseDown);
|
|
85
|
-
win.removeEventListener('click', onWinClick);
|
|
86
|
-
win.removeEventListener('contextmenu', onWinClick);
|
|
84
|
+
win.removeEventListener('mousedown', onWinMouseDown, true);
|
|
85
|
+
win.removeEventListener('click', onWinClick, true);
|
|
86
|
+
win.removeEventListener('contextmenu', onWinClick, true);
|
|
87
87
|
if (targetShadowRoot) {
|
|
88
|
-
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown);
|
|
89
|
-
targetShadowRoot.removeEventListener('click', onShadowClick);
|
|
90
|
-
targetShadowRoot.removeEventListener('contextmenu', onShadowClick);
|
|
88
|
+
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
|
|
89
|
+
targetShadowRoot.removeEventListener('click', onShadowClick, true);
|
|
90
|
+
targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
}
|