@rc-component/trigger 1.3.5 → 1.3.6
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 +1 -1
- package/es/index.js +5 -2
- package/lib/hooks/useAlign.js +1 -1
- package/lib/index.js +5 -2
- package/package.json +1 -1
package/es/hooks/useAlign.js
CHANGED
|
@@ -150,7 +150,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
150
150
|
var _scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1000) / 1000);
|
|
151
151
|
|
|
152
152
|
// Placement
|
|
153
|
-
var placementInfo =
|
|
153
|
+
var placementInfo = builtinPlacements[placement] || popupAlign || {};
|
|
154
154
|
|
|
155
155
|
// Offset
|
|
156
156
|
var offset = placementInfo.offset,
|
package/es/index.js
CHANGED
|
@@ -201,9 +201,12 @@ export function generateTrigger() {
|
|
|
201
201
|
useLayoutEffect(function () {
|
|
202
202
|
triggerAlign();
|
|
203
203
|
}, [mousePos]);
|
|
204
|
+
|
|
205
|
+
// When no builtinPlacements and popupAlign changed
|
|
204
206
|
useLayoutEffect(function () {
|
|
205
|
-
if (!
|
|
206
|
-
|
|
207
|
+
if (mergedOpen && !(builtinPlacements !== null && builtinPlacements !== void 0 && builtinPlacements[popupPlacement])) {
|
|
208
|
+
triggerAlign();
|
|
209
|
+
}
|
|
207
210
|
}, [JSON.stringify(popupAlign)]);
|
|
208
211
|
var alignedClassName = React.useMemo(function () {
|
|
209
212
|
var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -158,7 +158,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
158
158
|
var _scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1000) / 1000);
|
|
159
159
|
|
|
160
160
|
// Placement
|
|
161
|
-
var placementInfo =
|
|
161
|
+
var placementInfo = builtinPlacements[placement] || popupAlign || {};
|
|
162
162
|
|
|
163
163
|
// Offset
|
|
164
164
|
var offset = placementInfo.offset,
|
package/lib/index.js
CHANGED
|
@@ -210,9 +210,12 @@ function generateTrigger() {
|
|
|
210
210
|
(0, _useLayoutEffect.default)(function () {
|
|
211
211
|
triggerAlign();
|
|
212
212
|
}, [mousePos]);
|
|
213
|
+
|
|
214
|
+
// When no builtinPlacements and popupAlign changed
|
|
213
215
|
(0, _useLayoutEffect.default)(function () {
|
|
214
|
-
if (!
|
|
215
|
-
|
|
216
|
+
if (mergedOpen && !(builtinPlacements !== null && builtinPlacements !== void 0 && builtinPlacements[popupPlacement])) {
|
|
217
|
+
triggerAlign();
|
|
218
|
+
}
|
|
216
219
|
}, [JSON.stringify(popupAlign)]);
|
|
217
220
|
var alignedClassName = React.useMemo(function () {
|
|
218
221
|
var baseClassName = (0, _util.getAlignPopupClassName)(builtinPlacements, prefixCls, alignInfo, alignPoint);
|