@rc-component/trigger 1.3.0 → 1.3.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.
@@ -197,11 +197,17 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
197
197
  adjustY = overflow.adjustY,
198
198
  shiftX = overflow.shiftX,
199
199
  shiftY = overflow.shiftY;
200
+ var supportAdjust = function supportAdjust(val) {
201
+ if (typeof val === 'boolean') {
202
+ return val;
203
+ }
204
+ return val >= 0;
205
+ };
200
206
 
201
207
  // >>>>>>>>>> Top & Bottom
202
208
  var nextPopupY = popupRect.y + nextOffsetY;
203
209
  var nextPopupBottom = nextPopupY + popupHeight;
204
- var needAdjustY = adjustY === true || adjustY >= 0;
210
+ var needAdjustY = supportAdjust(adjustY);
205
211
 
206
212
  // Bottom to Top
207
213
  if (needAdjustY && popupPoints[0] === 't' && nextPopupBottom > visibleArea.bottom) {
@@ -218,7 +224,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
218
224
  // >>>>>>>>>> Left & Right
219
225
  var nextPopupX = popupRect.x + nextOffsetX;
220
226
  var nextPopupRight = nextPopupX + popupWidth;
221
- var needAdjustX = adjustX === true || adjustX >= 0;
227
+ var needAdjustX = supportAdjust(adjustX);
222
228
 
223
229
  // >>>>> Flip
224
230
  // Right to Left
@@ -205,11 +205,17 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
205
205
  adjustY = overflow.adjustY,
206
206
  shiftX = overflow.shiftX,
207
207
  shiftY = overflow.shiftY;
208
+ var supportAdjust = function supportAdjust(val) {
209
+ if (typeof val === 'boolean') {
210
+ return val;
211
+ }
212
+ return val >= 0;
213
+ };
208
214
 
209
215
  // >>>>>>>>>> Top & Bottom
210
216
  var nextPopupY = popupRect.y + nextOffsetY;
211
217
  var nextPopupBottom = nextPopupY + popupHeight;
212
- var needAdjustY = adjustY === true || adjustY >= 0;
218
+ var needAdjustY = supportAdjust(adjustY);
213
219
 
214
220
  // Bottom to Top
215
221
  if (needAdjustY && popupPoints[0] === 't' && nextPopupBottom > visibleArea.bottom) {
@@ -226,7 +232,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
226
232
  // >>>>>>>>>> Left & Right
227
233
  var nextPopupX = popupRect.x + nextOffsetX;
228
234
  var nextPopupRight = nextPopupX + popupWidth;
229
- var needAdjustX = adjustX === true || adjustX >= 0;
235
+ var needAdjustX = supportAdjust(adjustX);
230
236
 
231
237
  // >>>>> Flip
232
238
  // Right to Left
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"