@rc-component/trigger 1.18.1 → 1.18.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.
@@ -118,6 +118,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
118
118
  var originTop = popupElement.style.top;
119
119
  var originRight = popupElement.style.right;
120
120
  var originBottom = popupElement.style.bottom;
121
+ var originOverflow = popupElement.style.overflow;
121
122
 
122
123
  // Placement
123
124
  var placementInfo = _objectSpread(_objectSpread({}, builtinPlacements[placement]), popupAlign);
@@ -136,6 +137,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
136
137
  popupElement.style.top = '0';
137
138
  popupElement.style.right = 'auto';
138
139
  popupElement.style.bottom = 'auto';
140
+ popupElement.style.overflow = 'hidden';
139
141
 
140
142
  // Calculate align style, we should consider `transform` case
141
143
  var targetRect;
@@ -208,6 +210,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
208
210
  popupElement.style.top = originTop;
209
211
  popupElement.style.right = originRight;
210
212
  popupElement.style.bottom = originBottom;
213
+ popupElement.style.overflow = originOverflow;
211
214
  (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
212
215
 
213
216
  // Calculate scale
package/es/index.js CHANGED
@@ -24,7 +24,9 @@ import { getAlignPopupClassName, getMotion } from "./util";
24
24
  // Removed Props List
25
25
  // Seems this can be auto
26
26
  // getDocument?: (element?: HTMLElement) => Document;
27
+
27
28
  // New version will not wrap popup with `rc-trigger-popup-content` when multiple children
29
+
28
30
  export function generateTrigger() {
29
31
  var PortalComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Portal;
30
32
  var Trigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -372,9 +374,9 @@ export function generateTrigger() {
372
374
  wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
373
375
  setMousePosByEvent(event);
374
376
  });
375
- onPopupMouseEnter = function onPopupMouseEnter() {
377
+ onPopupMouseEnter = function onPopupMouseEnter(event) {
376
378
  // Only trigger re-open when popup is visible
377
- if (mergedOpen || inMotion) {
379
+ if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
378
380
  triggerOpen(true, mouseEnterDelay);
379
381
  }
380
382
  };
@@ -126,6 +126,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
126
126
  var originTop = popupElement.style.top;
127
127
  var originRight = popupElement.style.right;
128
128
  var originBottom = popupElement.style.bottom;
129
+ var originOverflow = popupElement.style.overflow;
129
130
 
130
131
  // Placement
131
132
  var placementInfo = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, builtinPlacements[placement]), popupAlign);
@@ -144,6 +145,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
144
145
  popupElement.style.top = '0';
145
146
  popupElement.style.right = 'auto';
146
147
  popupElement.style.bottom = 'auto';
148
+ popupElement.style.overflow = 'hidden';
147
149
 
148
150
  // Calculate align style, we should consider `transform` case
149
151
  var targetRect;
@@ -216,6 +218,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
216
218
  popupElement.style.top = originTop;
217
219
  popupElement.style.right = originRight;
218
220
  popupElement.style.bottom = originBottom;
221
+ popupElement.style.overflow = originOverflow;
219
222
  (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
220
223
 
221
224
  // Calculate scale
package/lib/index.js CHANGED
@@ -382,9 +382,9 @@ function generateTrigger() {
382
382
  wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
383
383
  setMousePosByEvent(event);
384
384
  });
385
- onPopupMouseEnter = function onPopupMouseEnter() {
385
+ onPopupMouseEnter = function onPopupMouseEnter(event) {
386
386
  // Only trigger re-open when popup is visible
387
- if (mergedOpen || inMotion) {
387
+ if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
388
388
  triggerOpen(true, mouseEnterDelay);
389
389
  }
390
390
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "1.18.1",
3
+ "version": "1.18.3",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"
@@ -41,10 +41,11 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rc-component/father-plugin": "^1.0.0",
44
- "@testing-library/jest-dom": "^5.16.4",
44
+ "@testing-library/jest-dom": "^6.1.4",
45
45
  "@testing-library/react": "^14.0.0",
46
46
  "@types/classnames": "^2.2.10",
47
47
  "@types/jest": "^29.5.2",
48
+ "@types/node": "^20.11.6",
48
49
  "@types/react": "^18.0.0",
49
50
  "@types/react-dom": "^18.0.11",
50
51
  "@umijs/fabric": "^4.0.1",
@@ -52,12 +53,12 @@
52
53
  "dumi": "^2.1.0",
53
54
  "eslint": "^8.51.0",
54
55
  "father": "^4.0.0",
55
- "less": "^3.10.3",
56
- "np": "^8.0.4",
56
+ "less": "^4.2.0",
57
+ "np": "^9.0.0",
57
58
  "rc-test": "^7.0.13",
58
59
  "react": "^18.0.0",
59
60
  "react-dom": "^18.0.0",
60
- "regenerator-runtime": "^0.13.7",
61
+ "regenerator-runtime": "^0.14.0",
61
62
  "typescript": "^5.1.6"
62
63
  },
63
64
  "dependencies": {