@rc-component/trigger 1.13.2 → 1.13.4-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.
@@ -39,7 +39,6 @@ export default function useWinClick(open, clickToHide, targetEle, popupEle, mask
39
39
  }
40
40
  };
41
41
  var win = getWin(popupEle);
42
- var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : targetEle.getRootNode();
43
42
  win.addEventListener('mousedown', onWindowMouseDown);
44
43
  win.addEventListener('click', onWindowClick);
45
44
 
@@ -52,7 +51,9 @@ export default function useWinClick(open, clickToHide, targetEle, popupEle, mask
52
51
 
53
52
  // Warning if target and popup not in same root
54
53
  if (process.env.NODE_ENV !== 'production') {
55
- var popupRoot = popupEle.getRootNode();
54
+ var _targetEle$getRootNod, _popupEle$getRootNode;
55
+ var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
56
+ var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
56
57
  warning(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
57
58
  }
58
59
  return function () {
package/es/index.js CHANGED
@@ -185,12 +185,10 @@ export function generateTrigger() {
185
185
  _React$useState10 = _slicedToArray(_React$useState9, 2),
186
186
  inMotion = _React$useState10[0],
187
187
  setInMotion = _React$useState10[1];
188
- var mountRef = React.useRef(true);
189
- useLayoutEffect(function () {
190
- if (!mountRef.current || mergedOpen) {
188
+ useLayoutEffect(function (firstMount) {
189
+ if (!firstMount || mergedOpen) {
191
190
  setInMotion(true);
192
191
  }
193
- mountRef.current = true;
194
192
  }, [mergedOpen]);
195
193
  var _React$useState11 = React.useState(null),
196
194
  _React$useState12 = _slicedToArray(_React$useState11, 2),
@@ -47,7 +47,6 @@ function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable,
47
47
  }
48
48
  };
49
49
  var win = (0, _util.getWin)(popupEle);
50
- var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : targetEle.getRootNode();
51
50
  win.addEventListener('mousedown', onWindowMouseDown);
52
51
  win.addEventListener('click', onWindowClick);
53
52
 
@@ -60,7 +59,9 @@ function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable,
60
59
 
61
60
  // Warning if target and popup not in same root
62
61
  if (process.env.NODE_ENV !== 'production') {
63
- var popupRoot = popupEle.getRootNode();
62
+ var _targetEle$getRootNod, _popupEle$getRootNode;
63
+ var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
64
+ var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
64
65
  (0, _rcUtil.warning)(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
65
66
  }
66
67
  return function () {
package/lib/index.js CHANGED
@@ -194,12 +194,10 @@ function generateTrigger() {
194
194
  _React$useState10 = (0, _slicedToArray2.default)(_React$useState9, 2),
195
195
  inMotion = _React$useState10[0],
196
196
  setInMotion = _React$useState10[1];
197
- var mountRef = React.useRef(true);
198
- (0, _useLayoutEffect.default)(function () {
199
- if (!mountRef.current || mergedOpen) {
197
+ (0, _useLayoutEffect.default)(function (firstMount) {
198
+ if (!firstMount || mergedOpen) {
200
199
  setInMotion(true);
201
200
  }
202
- mountRef.current = true;
203
201
  }, [mergedOpen]);
204
202
  var _React$useState11 = React.useState(null),
205
203
  _React$useState12 = (0, _slicedToArray2.default)(_React$useState11, 2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "1.13.2",
3
+ "version": "1.13.4-0",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"
@@ -66,7 +66,7 @@
66
66
  "rc-align": "^4.0.0",
67
67
  "rc-motion": "^2.0.0",
68
68
  "rc-resize-observer": "^1.3.1",
69
- "rc-util": "^5.31.1"
69
+ "rc-util": "^5.33.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "react": ">=16.9.0",