@rc-component/trigger 1.6.3 → 1.7.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.
- package/es/hooks/useAlign.js +17 -6
- package/lib/hooks/useAlign.js +17 -6
- package/package.json +1 -1
package/es/hooks/useAlign.js
CHANGED
|
@@ -223,7 +223,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
223
223
|
}
|
|
224
224
|
var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
|
|
225
225
|
|
|
226
|
-
//
|
|
226
|
+
// ========================== Overflow ===========================
|
|
227
227
|
var targetAlignPointTL = getAlignPoint(targetRect, ['t', 'l']);
|
|
228
228
|
var popupAlignPointTL = getAlignPoint(popupRect, ['t', 'l']);
|
|
229
229
|
var targetAlignPointBR = getAlignPoint(targetRect, ['b', 'r']);
|
|
@@ -240,9 +240,20 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
240
240
|
return val >= 0;
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
+
// Prepare position
|
|
244
|
+
var nextPopupY;
|
|
245
|
+
var nextPopupBottom;
|
|
246
|
+
var nextPopupX;
|
|
247
|
+
var nextPopupRight;
|
|
248
|
+
function syncNextPopupPosition() {
|
|
249
|
+
nextPopupY = popupRect.y + nextOffsetY;
|
|
250
|
+
nextPopupBottom = nextPopupY + popupHeight;
|
|
251
|
+
nextPopupX = popupRect.x + nextOffsetX;
|
|
252
|
+
nextPopupRight = nextPopupX + popupWidth;
|
|
253
|
+
}
|
|
254
|
+
syncNextPopupPosition();
|
|
255
|
+
|
|
243
256
|
// >>>>>>>>>> Top & Bottom
|
|
244
|
-
var nextPopupY = popupRect.y + nextOffsetY;
|
|
245
|
-
var nextPopupBottom = nextPopupY + popupHeight;
|
|
246
257
|
var needAdjustY = supportAdjust(adjustY);
|
|
247
258
|
var sameTB = popupPoints[0] === targetPoints[0];
|
|
248
259
|
|
|
@@ -275,8 +286,6 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
275
286
|
}
|
|
276
287
|
|
|
277
288
|
// >>>>>>>>>> Left & Right
|
|
278
|
-
var nextPopupX = popupRect.x + nextOffsetX;
|
|
279
|
-
var nextPopupRight = nextPopupX + popupWidth;
|
|
280
289
|
var needAdjustX = supportAdjust(adjustX);
|
|
281
290
|
|
|
282
291
|
// >>>>> Flip
|
|
@@ -310,7 +319,8 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
310
319
|
}
|
|
311
320
|
}
|
|
312
321
|
|
|
313
|
-
//
|
|
322
|
+
// ============================ Shift ============================
|
|
323
|
+
syncNextPopupPosition();
|
|
314
324
|
var numShiftX = shiftX === true ? 0 : shiftX;
|
|
315
325
|
if (typeof numShiftX === 'number') {
|
|
316
326
|
// Left
|
|
@@ -348,6 +358,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
348
358
|
}
|
|
349
359
|
}
|
|
350
360
|
|
|
361
|
+
// ============================ Arrow ============================
|
|
351
362
|
// Arrow center align
|
|
352
363
|
var popupLeft = popupRect.x + nextOffsetX;
|
|
353
364
|
var popupRight = popupLeft + popupWidth;
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -231,7 +231,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
231
231
|
}
|
|
232
232
|
var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
|
|
233
233
|
|
|
234
|
-
//
|
|
234
|
+
// ========================== Overflow ===========================
|
|
235
235
|
var targetAlignPointTL = getAlignPoint(targetRect, ['t', 'l']);
|
|
236
236
|
var popupAlignPointTL = getAlignPoint(popupRect, ['t', 'l']);
|
|
237
237
|
var targetAlignPointBR = getAlignPoint(targetRect, ['b', 'r']);
|
|
@@ -248,9 +248,20 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
248
248
|
return val >= 0;
|
|
249
249
|
};
|
|
250
250
|
|
|
251
|
+
// Prepare position
|
|
252
|
+
var nextPopupY;
|
|
253
|
+
var nextPopupBottom;
|
|
254
|
+
var nextPopupX;
|
|
255
|
+
var nextPopupRight;
|
|
256
|
+
function syncNextPopupPosition() {
|
|
257
|
+
nextPopupY = popupRect.y + nextOffsetY;
|
|
258
|
+
nextPopupBottom = nextPopupY + popupHeight;
|
|
259
|
+
nextPopupX = popupRect.x + nextOffsetX;
|
|
260
|
+
nextPopupRight = nextPopupX + popupWidth;
|
|
261
|
+
}
|
|
262
|
+
syncNextPopupPosition();
|
|
263
|
+
|
|
251
264
|
// >>>>>>>>>> Top & Bottom
|
|
252
|
-
var nextPopupY = popupRect.y + nextOffsetY;
|
|
253
|
-
var nextPopupBottom = nextPopupY + popupHeight;
|
|
254
265
|
var needAdjustY = supportAdjust(adjustY);
|
|
255
266
|
var sameTB = popupPoints[0] === targetPoints[0];
|
|
256
267
|
|
|
@@ -283,8 +294,6 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
// >>>>>>>>>> Left & Right
|
|
286
|
-
var nextPopupX = popupRect.x + nextOffsetX;
|
|
287
|
-
var nextPopupRight = nextPopupX + popupWidth;
|
|
288
297
|
var needAdjustX = supportAdjust(adjustX);
|
|
289
298
|
|
|
290
299
|
// >>>>> Flip
|
|
@@ -318,7 +327,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
318
327
|
}
|
|
319
328
|
}
|
|
320
329
|
|
|
321
|
-
//
|
|
330
|
+
// ============================ Shift ============================
|
|
331
|
+
syncNextPopupPosition();
|
|
322
332
|
var numShiftX = shiftX === true ? 0 : shiftX;
|
|
323
333
|
if (typeof numShiftX === 'number') {
|
|
324
334
|
// Left
|
|
@@ -356,6 +366,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
356
366
|
}
|
|
357
367
|
}
|
|
358
368
|
|
|
369
|
+
// ============================ Arrow ============================
|
|
359
370
|
// Arrow center align
|
|
360
371
|
var popupLeft = popupRect.x + nextOffsetX;
|
|
361
372
|
var popupRight = popupLeft + popupWidth;
|