@rc-component/trigger 1.5.0 → 1.5.2
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 +31 -10
- package/es/index.js +35 -25
- package/lib/hooks/useAlign.js +31 -10
- package/lib/index.js +35 -25
- package/package.json +1 -1
package/es/hooks/useAlign.js
CHANGED
|
@@ -122,6 +122,8 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
122
122
|
scrollLeft = _doc$documentElement.scrollLeft;
|
|
123
123
|
var popupHeight = popupRect.height;
|
|
124
124
|
var popupWidth = popupRect.width;
|
|
125
|
+
var targetHeight = targetRect.height;
|
|
126
|
+
var targetWidth = targetRect.width;
|
|
125
127
|
|
|
126
128
|
// Get bounding of visible area
|
|
127
129
|
var visibleArea = placementInfo.htmlRegion === 'scroll' ?
|
|
@@ -224,16 +226,25 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
224
226
|
var nextPopupY = popupRect.y + nextOffsetY;
|
|
225
227
|
var nextPopupBottom = nextPopupY + popupHeight;
|
|
226
228
|
var needAdjustY = supportAdjust(adjustY);
|
|
229
|
+
var sameTB = popupPoints[0] === targetPoints[0];
|
|
227
230
|
|
|
228
231
|
// Bottom to Top
|
|
229
232
|
if (needAdjustY && popupPoints[0] === 't' && nextPopupBottom > visibleArea.bottom) {
|
|
230
|
-
|
|
233
|
+
if (sameTB) {
|
|
234
|
+
nextOffsetY -= popupHeight - targetHeight;
|
|
235
|
+
} else {
|
|
236
|
+
nextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
|
|
237
|
+
}
|
|
231
238
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
232
239
|
}
|
|
233
240
|
|
|
234
241
|
// Top to Bottom
|
|
235
242
|
if (needAdjustY && popupPoints[0] === 'b' && nextPopupY < visibleArea.top) {
|
|
236
|
-
|
|
243
|
+
if (sameTB) {
|
|
244
|
+
nextOffsetY += popupHeight - targetHeight;
|
|
245
|
+
} else {
|
|
246
|
+
nextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
|
|
247
|
+
}
|
|
237
248
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
238
249
|
}
|
|
239
250
|
|
|
@@ -243,15 +254,25 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
243
254
|
var needAdjustX = supportAdjust(adjustX);
|
|
244
255
|
|
|
245
256
|
// >>>>> Flip
|
|
257
|
+
var sameLR = popupPoints[1] === targetPoints[1];
|
|
258
|
+
|
|
246
259
|
// Right to Left
|
|
247
260
|
if (needAdjustX && popupPoints[1] === 'l' && nextPopupRight > visibleArea.right) {
|
|
248
|
-
|
|
261
|
+
if (sameLR) {
|
|
262
|
+
nextOffsetX -= popupWidth - targetWidth;
|
|
263
|
+
} else {
|
|
264
|
+
nextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
|
|
265
|
+
}
|
|
249
266
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
250
267
|
}
|
|
251
268
|
|
|
252
269
|
// Left to Right
|
|
253
270
|
if (needAdjustX && popupPoints[1] === 'r' && nextPopupX < visibleArea.left) {
|
|
254
|
-
|
|
271
|
+
if (sameLR) {
|
|
272
|
+
nextOffsetX += popupWidth - targetWidth;
|
|
273
|
+
} else {
|
|
274
|
+
nextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
|
|
275
|
+
}
|
|
255
276
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
256
277
|
}
|
|
257
278
|
|
|
@@ -261,8 +282,8 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
261
282
|
// Left
|
|
262
283
|
if (nextPopupX < visibleArea.left) {
|
|
263
284
|
nextOffsetX -= nextPopupX - visibleArea.left;
|
|
264
|
-
if (targetRect.x +
|
|
265
|
-
nextOffsetX += targetRect.x - visibleArea.left +
|
|
285
|
+
if (targetRect.x + targetWidth < visibleArea.left + numShiftX) {
|
|
286
|
+
nextOffsetX += targetRect.x - visibleArea.left + targetWidth - numShiftX;
|
|
266
287
|
}
|
|
267
288
|
}
|
|
268
289
|
|
|
@@ -279,8 +300,8 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
279
300
|
// Top
|
|
280
301
|
if (nextPopupY < visibleArea.top) {
|
|
281
302
|
nextOffsetY -= nextPopupY - visibleArea.top;
|
|
282
|
-
if (targetRect.y +
|
|
283
|
-
nextOffsetY += targetRect.y - visibleArea.top +
|
|
303
|
+
if (targetRect.y + targetHeight < visibleArea.top + numShiftY) {
|
|
304
|
+
nextOffsetY += targetRect.y - visibleArea.top + targetHeight - numShiftY;
|
|
284
305
|
}
|
|
285
306
|
}
|
|
286
307
|
|
|
@@ -299,9 +320,9 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
299
320
|
var popupTop = popupRect.y + nextOffsetY;
|
|
300
321
|
var popupBottom = popupTop + popupHeight;
|
|
301
322
|
var targetLeft = targetRect.x;
|
|
302
|
-
var targetRight = targetLeft +
|
|
323
|
+
var targetRight = targetLeft + targetWidth;
|
|
303
324
|
var targetTop = targetRect.y;
|
|
304
|
-
var targetBottom = targetTop +
|
|
325
|
+
var targetBottom = targetTop + targetHeight;
|
|
305
326
|
var maxLeft = Math.max(popupLeft, targetLeft);
|
|
306
327
|
var minRight = Math.min(popupRight, targetRight);
|
|
307
328
|
var xCenter = (maxLeft + minRight) / 2;
|
package/es/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import ResizeObserver from 'rc-resize-observer';
|
|
|
8
8
|
import useEvent from "rc-util/es/hooks/useEvent";
|
|
9
9
|
import useId from "rc-util/es/hooks/useId";
|
|
10
10
|
import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
|
|
11
|
-
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
12
11
|
import * as React from 'react';
|
|
13
12
|
import TriggerContext from "./context";
|
|
14
13
|
import useAction from "./hooks/useAction";
|
|
@@ -121,12 +120,23 @@ export function generateTrigger() {
|
|
|
121
120
|
var mergeMaskMotion = getMotion(prefixCls, maskMotion, maskAnimation, maskTransitionName);
|
|
122
121
|
|
|
123
122
|
// ============================ Open ============================
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
var _React$useState5 = React.useState(defaultPopupVisible || false),
|
|
124
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
125
|
+
internalOpen = _React$useState6[0],
|
|
126
|
+
setInternalOpen = _React$useState6[1];
|
|
127
|
+
|
|
128
|
+
// Render still use props as first priority
|
|
129
|
+
var mergedOpen = popupVisible !== null && popupVisible !== void 0 ? popupVisible : internalOpen;
|
|
130
|
+
|
|
131
|
+
// We use effect sync here in case `popupVisible` back to `undefined`
|
|
132
|
+
var setMergedOpen = useEvent(function (nextOpen) {
|
|
133
|
+
if (popupVisible === undefined) {
|
|
134
|
+
setInternalOpen(nextOpen);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
useLayoutEffect(function () {
|
|
138
|
+
setInternalOpen(popupVisible || false);
|
|
139
|
+
}, [popupVisible]);
|
|
130
140
|
var openRef = React.useRef(mergedOpen);
|
|
131
141
|
openRef.current = mergedOpen;
|
|
132
142
|
var internalTriggerOpen = useEvent(function (nextOpen) {
|
|
@@ -157,10 +167,10 @@ export function generateTrigger() {
|
|
|
157
167
|
}, []);
|
|
158
168
|
|
|
159
169
|
// ========================== Motion ============================
|
|
160
|
-
var _React$
|
|
161
|
-
_React$
|
|
162
|
-
inMotion = _React$
|
|
163
|
-
setInMotion = _React$
|
|
170
|
+
var _React$useState7 = React.useState(false),
|
|
171
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
172
|
+
inMotion = _React$useState8[0],
|
|
173
|
+
setInMotion = _React$useState8[1];
|
|
164
174
|
var mountRef = React.useRef(true);
|
|
165
175
|
useLayoutEffect(function () {
|
|
166
176
|
if (!mountRef.current || mergedOpen) {
|
|
@@ -168,16 +178,16 @@ export function generateTrigger() {
|
|
|
168
178
|
}
|
|
169
179
|
mountRef.current = true;
|
|
170
180
|
}, [mergedOpen]);
|
|
171
|
-
var _React$
|
|
172
|
-
_React$
|
|
173
|
-
motionPrepareResolve = _React$
|
|
174
|
-
setMotionPrepareResolve = _React$
|
|
181
|
+
var _React$useState9 = React.useState(null),
|
|
182
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
183
|
+
motionPrepareResolve = _React$useState10[0],
|
|
184
|
+
setMotionPrepareResolve = _React$useState10[1];
|
|
175
185
|
|
|
176
186
|
// =========================== Align ============================
|
|
177
|
-
var _React$
|
|
178
|
-
_React$
|
|
179
|
-
mousePos = _React$
|
|
180
|
-
setMousePos = _React$
|
|
187
|
+
var _React$useState11 = React.useState([0, 0]),
|
|
188
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
189
|
+
mousePos = _React$useState12[0],
|
|
190
|
+
setMousePos = _React$useState12[1];
|
|
181
191
|
var setMousePosByEvent = function setMousePosByEvent(event) {
|
|
182
192
|
setMousePos([event.clientX, event.clientY]);
|
|
183
193
|
};
|
|
@@ -242,14 +252,14 @@ export function generateTrigger() {
|
|
|
242
252
|
}, [motionPrepareResolve]);
|
|
243
253
|
|
|
244
254
|
// ========================== Stretch ===========================
|
|
245
|
-
var _React$useState11 = React.useState(0),
|
|
246
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
247
|
-
targetWidth = _React$useState12[0],
|
|
248
|
-
setTargetWidth = _React$useState12[1];
|
|
249
255
|
var _React$useState13 = React.useState(0),
|
|
250
256
|
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
targetWidth = _React$useState14[0],
|
|
258
|
+
setTargetWidth = _React$useState14[1];
|
|
259
|
+
var _React$useState15 = React.useState(0),
|
|
260
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
261
|
+
targetHeight = _React$useState16[0],
|
|
262
|
+
setTargetHeight = _React$useState16[1];
|
|
253
263
|
var onTargetResize = function onTargetResize(_, ele) {
|
|
254
264
|
triggerAlign();
|
|
255
265
|
if (stretch) {
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -130,6 +130,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
130
130
|
scrollLeft = _doc$documentElement.scrollLeft;
|
|
131
131
|
var popupHeight = popupRect.height;
|
|
132
132
|
var popupWidth = popupRect.width;
|
|
133
|
+
var targetHeight = targetRect.height;
|
|
134
|
+
var targetWidth = targetRect.width;
|
|
133
135
|
|
|
134
136
|
// Get bounding of visible area
|
|
135
137
|
var visibleArea = placementInfo.htmlRegion === 'scroll' ?
|
|
@@ -232,16 +234,25 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
232
234
|
var nextPopupY = popupRect.y + nextOffsetY;
|
|
233
235
|
var nextPopupBottom = nextPopupY + popupHeight;
|
|
234
236
|
var needAdjustY = supportAdjust(adjustY);
|
|
237
|
+
var sameTB = popupPoints[0] === targetPoints[0];
|
|
235
238
|
|
|
236
239
|
// Bottom to Top
|
|
237
240
|
if (needAdjustY && popupPoints[0] === 't' && nextPopupBottom > visibleArea.bottom) {
|
|
238
|
-
|
|
241
|
+
if (sameTB) {
|
|
242
|
+
nextOffsetY -= popupHeight - targetHeight;
|
|
243
|
+
} else {
|
|
244
|
+
nextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
|
|
245
|
+
}
|
|
239
246
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
240
247
|
}
|
|
241
248
|
|
|
242
249
|
// Top to Bottom
|
|
243
250
|
if (needAdjustY && popupPoints[0] === 'b' && nextPopupY < visibleArea.top) {
|
|
244
|
-
|
|
251
|
+
if (sameTB) {
|
|
252
|
+
nextOffsetY += popupHeight - targetHeight;
|
|
253
|
+
} else {
|
|
254
|
+
nextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
|
|
255
|
+
}
|
|
245
256
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
246
257
|
}
|
|
247
258
|
|
|
@@ -251,15 +262,25 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
251
262
|
var needAdjustX = supportAdjust(adjustX);
|
|
252
263
|
|
|
253
264
|
// >>>>> Flip
|
|
265
|
+
var sameLR = popupPoints[1] === targetPoints[1];
|
|
266
|
+
|
|
254
267
|
// Right to Left
|
|
255
268
|
if (needAdjustX && popupPoints[1] === 'l' && nextPopupRight > visibleArea.right) {
|
|
256
|
-
|
|
269
|
+
if (sameLR) {
|
|
270
|
+
nextOffsetX -= popupWidth - targetWidth;
|
|
271
|
+
} else {
|
|
272
|
+
nextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
|
|
273
|
+
}
|
|
257
274
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
258
275
|
}
|
|
259
276
|
|
|
260
277
|
// Left to Right
|
|
261
278
|
if (needAdjustX && popupPoints[1] === 'r' && nextPopupX < visibleArea.left) {
|
|
262
|
-
|
|
279
|
+
if (sameLR) {
|
|
280
|
+
nextOffsetX += popupWidth - targetWidth;
|
|
281
|
+
} else {
|
|
282
|
+
nextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
|
|
283
|
+
}
|
|
263
284
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
264
285
|
}
|
|
265
286
|
|
|
@@ -269,8 +290,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
269
290
|
// Left
|
|
270
291
|
if (nextPopupX < visibleArea.left) {
|
|
271
292
|
nextOffsetX -= nextPopupX - visibleArea.left;
|
|
272
|
-
if (targetRect.x +
|
|
273
|
-
nextOffsetX += targetRect.x - visibleArea.left +
|
|
293
|
+
if (targetRect.x + targetWidth < visibleArea.left + numShiftX) {
|
|
294
|
+
nextOffsetX += targetRect.x - visibleArea.left + targetWidth - numShiftX;
|
|
274
295
|
}
|
|
275
296
|
}
|
|
276
297
|
|
|
@@ -287,8 +308,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
287
308
|
// Top
|
|
288
309
|
if (nextPopupY < visibleArea.top) {
|
|
289
310
|
nextOffsetY -= nextPopupY - visibleArea.top;
|
|
290
|
-
if (targetRect.y +
|
|
291
|
-
nextOffsetY += targetRect.y - visibleArea.top +
|
|
311
|
+
if (targetRect.y + targetHeight < visibleArea.top + numShiftY) {
|
|
312
|
+
nextOffsetY += targetRect.y - visibleArea.top + targetHeight - numShiftY;
|
|
292
313
|
}
|
|
293
314
|
}
|
|
294
315
|
|
|
@@ -307,9 +328,9 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
307
328
|
var popupTop = popupRect.y + nextOffsetY;
|
|
308
329
|
var popupBottom = popupTop + popupHeight;
|
|
309
330
|
var targetLeft = targetRect.x;
|
|
310
|
-
var targetRight = targetLeft +
|
|
331
|
+
var targetRight = targetLeft + targetWidth;
|
|
311
332
|
var targetTop = targetRect.y;
|
|
312
|
-
var targetBottom = targetTop +
|
|
333
|
+
var targetBottom = targetTop + targetHeight;
|
|
313
334
|
var maxLeft = Math.max(popupLeft, targetLeft);
|
|
314
335
|
var minRight = Math.min(popupRight, targetRight);
|
|
315
336
|
var xCenter = (maxLeft + minRight) / 2;
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
|
|
16
16
|
var _useEvent = _interopRequireDefault(require("rc-util/lib/hooks/useEvent"));
|
|
17
17
|
var _useId = _interopRequireDefault(require("rc-util/lib/hooks/useId"));
|
|
18
18
|
var _useLayoutEffect = _interopRequireDefault(require("rc-util/lib/hooks/useLayoutEffect"));
|
|
19
|
-
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
20
19
|
var React = _interopRequireWildcard(require("react"));
|
|
21
20
|
var _context = _interopRequireDefault(require("./context"));
|
|
22
21
|
var _useAction3 = _interopRequireDefault(require("./hooks/useAction"));
|
|
@@ -130,12 +129,23 @@ function generateTrigger() {
|
|
|
130
129
|
var mergeMaskMotion = (0, _util.getMotion)(prefixCls, maskMotion, maskAnimation, maskTransitionName);
|
|
131
130
|
|
|
132
131
|
// ============================ Open ============================
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
var _React$useState5 = React.useState(defaultPopupVisible || false),
|
|
133
|
+
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
|
|
134
|
+
internalOpen = _React$useState6[0],
|
|
135
|
+
setInternalOpen = _React$useState6[1];
|
|
136
|
+
|
|
137
|
+
// Render still use props as first priority
|
|
138
|
+
var mergedOpen = popupVisible !== null && popupVisible !== void 0 ? popupVisible : internalOpen;
|
|
139
|
+
|
|
140
|
+
// We use effect sync here in case `popupVisible` back to `undefined`
|
|
141
|
+
var setMergedOpen = (0, _useEvent.default)(function (nextOpen) {
|
|
142
|
+
if (popupVisible === undefined) {
|
|
143
|
+
setInternalOpen(nextOpen);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
(0, _useLayoutEffect.default)(function () {
|
|
147
|
+
setInternalOpen(popupVisible || false);
|
|
148
|
+
}, [popupVisible]);
|
|
139
149
|
var openRef = React.useRef(mergedOpen);
|
|
140
150
|
openRef.current = mergedOpen;
|
|
141
151
|
var internalTriggerOpen = (0, _useEvent.default)(function (nextOpen) {
|
|
@@ -166,10 +176,10 @@ function generateTrigger() {
|
|
|
166
176
|
}, []);
|
|
167
177
|
|
|
168
178
|
// ========================== Motion ============================
|
|
169
|
-
var _React$
|
|
170
|
-
_React$
|
|
171
|
-
inMotion = _React$
|
|
172
|
-
setInMotion = _React$
|
|
179
|
+
var _React$useState7 = React.useState(false),
|
|
180
|
+
_React$useState8 = (0, _slicedToArray2.default)(_React$useState7, 2),
|
|
181
|
+
inMotion = _React$useState8[0],
|
|
182
|
+
setInMotion = _React$useState8[1];
|
|
173
183
|
var mountRef = React.useRef(true);
|
|
174
184
|
(0, _useLayoutEffect.default)(function () {
|
|
175
185
|
if (!mountRef.current || mergedOpen) {
|
|
@@ -177,16 +187,16 @@ function generateTrigger() {
|
|
|
177
187
|
}
|
|
178
188
|
mountRef.current = true;
|
|
179
189
|
}, [mergedOpen]);
|
|
180
|
-
var _React$
|
|
181
|
-
_React$
|
|
182
|
-
motionPrepareResolve = _React$
|
|
183
|
-
setMotionPrepareResolve = _React$
|
|
190
|
+
var _React$useState9 = React.useState(null),
|
|
191
|
+
_React$useState10 = (0, _slicedToArray2.default)(_React$useState9, 2),
|
|
192
|
+
motionPrepareResolve = _React$useState10[0],
|
|
193
|
+
setMotionPrepareResolve = _React$useState10[1];
|
|
184
194
|
|
|
185
195
|
// =========================== Align ============================
|
|
186
|
-
var _React$
|
|
187
|
-
_React$
|
|
188
|
-
mousePos = _React$
|
|
189
|
-
setMousePos = _React$
|
|
196
|
+
var _React$useState11 = React.useState([0, 0]),
|
|
197
|
+
_React$useState12 = (0, _slicedToArray2.default)(_React$useState11, 2),
|
|
198
|
+
mousePos = _React$useState12[0],
|
|
199
|
+
setMousePos = _React$useState12[1];
|
|
190
200
|
var setMousePosByEvent = function setMousePosByEvent(event) {
|
|
191
201
|
setMousePos([event.clientX, event.clientY]);
|
|
192
202
|
};
|
|
@@ -251,14 +261,14 @@ function generateTrigger() {
|
|
|
251
261
|
}, [motionPrepareResolve]);
|
|
252
262
|
|
|
253
263
|
// ========================== Stretch ===========================
|
|
254
|
-
var _React$useState11 = React.useState(0),
|
|
255
|
-
_React$useState12 = (0, _slicedToArray2.default)(_React$useState11, 2),
|
|
256
|
-
targetWidth = _React$useState12[0],
|
|
257
|
-
setTargetWidth = _React$useState12[1];
|
|
258
264
|
var _React$useState13 = React.useState(0),
|
|
259
265
|
_React$useState14 = (0, _slicedToArray2.default)(_React$useState13, 2),
|
|
260
|
-
|
|
261
|
-
|
|
266
|
+
targetWidth = _React$useState14[0],
|
|
267
|
+
setTargetWidth = _React$useState14[1];
|
|
268
|
+
var _React$useState15 = React.useState(0),
|
|
269
|
+
_React$useState16 = (0, _slicedToArray2.default)(_React$useState15, 2),
|
|
270
|
+
targetHeight = _React$useState16[0],
|
|
271
|
+
setTargetHeight = _React$useState16[1];
|
|
262
272
|
var onTargetResize = function onTargetResize(_, ele) {
|
|
263
273
|
triggerAlign();
|
|
264
274
|
if (stretch) {
|