publ-echo 0.0.56 → 0.0.57
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.
|
@@ -42,7 +42,7 @@ var GridItem = function (_a) {
|
|
|
42
42
|
var _q = useResizeObserver({
|
|
43
43
|
ref: elementRef,
|
|
44
44
|
box: 'border-box',
|
|
45
|
-
}, [isDragging, isResizing]), _r = _q.width, width = _r === void 0 ? 0 : _r, _s = _q.height, height = _s === void 0 ? 0 : _s, _t = _q.clientHeight, clientHeight = _t === void 0 ? 0 : _t, _u = _q.scrollHeight, scrollHeight = _u === void 0 ? 0 : _u;
|
|
45
|
+
}, [isDragging, isResizing]), _r = _q.width, width = _r === void 0 ? 0 : _r, _s = _q.height, height = _s === void 0 ? 0 : _s, _t = _q.clientHeight, clientHeight = _t === void 0 ? 0 : _t, _u = _q.scrollHeight, scrollHeight = _u === void 0 ? 0 : _u, textContentHeight = _q.textContentHeight;
|
|
46
46
|
// const moveDroppingItem = (prevProps: GridItemProps) => {
|
|
47
47
|
// const { droppingPosition } = props;
|
|
48
48
|
// if (!droppingPosition) return;
|
|
@@ -275,16 +275,67 @@ var GridItem = function (_a) {
|
|
|
275
275
|
* @param {ResizeEventType} e event data
|
|
276
276
|
* @param {Object} callbackData an object with node and size information
|
|
277
277
|
*/
|
|
278
|
+
// const onResizeCallback = useCallback((
|
|
279
|
+
// e:ResizeEventType,
|
|
280
|
+
// callbackData:ResizeCallbackData
|
|
281
|
+
// ) => {
|
|
282
|
+
// setIsResizing(true);
|
|
283
|
+
// const { dirX, dirY } = getDirectionOfMouseEvent(e as MouseEvent);
|
|
284
|
+
// const shouldBlock = shouldBlockResize({
|
|
285
|
+
// handle: callbackData.handle,
|
|
286
|
+
// direction: dirY!,
|
|
287
|
+
// contentHeight: textContentHeight!,
|
|
288
|
+
// gridItemHeight: callbackData.size.height,
|
|
289
|
+
// shouldAutoShrink: shouldAutoShrink.current.shouldAutoShrink,
|
|
290
|
+
// initialHeight: shouldAutoShrink.current.initialHeight,
|
|
291
|
+
// colHeight: rowHeight as number
|
|
292
|
+
// })
|
|
293
|
+
// if (resizing?.top) {
|
|
294
|
+
// callbackData.size.top = resizing?.top
|
|
295
|
+
// }
|
|
296
|
+
// const shouldResize = shouldAutoResize({
|
|
297
|
+
// handle: callbackData.handle,
|
|
298
|
+
// dirX: dirX!,
|
|
299
|
+
// dirY: dirY!,
|
|
300
|
+
// contentHeight: textContentHeight!,
|
|
301
|
+
// gridItemHeight: callbackData.size.height,
|
|
302
|
+
// shouldAutoShrink: shouldAutoShrink.current.shouldAutoShrink,
|
|
303
|
+
// initialHeight: shouldAutoShrink.current.initialHeight
|
|
304
|
+
// })
|
|
305
|
+
// console.log(shouldResize)
|
|
306
|
+
// if (shouldResize !== 'EXPAND' && shouldBlock === 'BLOCK') {
|
|
307
|
+
// callbackData.size.height = textContentHeight!;
|
|
308
|
+
// }
|
|
309
|
+
// if (shouldResize === 'EXPAND') {
|
|
310
|
+
// callbackData.size.height = textContentHeight!;
|
|
311
|
+
// shouldAutoShrink.current.shouldAutoShrink = true;
|
|
312
|
+
// // NOTE: 배포전에 무조건 변경
|
|
313
|
+
// if (callbackData.handle === 'nw') {
|
|
314
|
+
// callbackData.handle = 'w';
|
|
315
|
+
// }
|
|
316
|
+
// if (callbackData.handle === 'ne') {
|
|
317
|
+
// callbackData.handle = 'se';
|
|
318
|
+
// }
|
|
319
|
+
// }
|
|
320
|
+
// if (shouldResize === 'SHRINK') {
|
|
321
|
+
// callbackData.size.height = Math.max(shouldAutoShrink.current.initialHeight, textContentHeight!);
|
|
322
|
+
// // NOTE: 배포전에 무조건 변경
|
|
323
|
+
// if (callbackData.handle === 'nw') {
|
|
324
|
+
// callbackData.handle = 'sw'
|
|
325
|
+
// }
|
|
326
|
+
// if (callbackData.handle === 'ne') {
|
|
327
|
+
// callbackData.handle = 'se'
|
|
328
|
+
// }
|
|
329
|
+
// }
|
|
330
|
+
// onResizeHandler(e, callbackData, "onResize");
|
|
331
|
+
// }, [textContentHeight])
|
|
278
332
|
var onResize = function (e, callbackData) {
|
|
279
|
-
var _a, _b;
|
|
280
333
|
setIsResizing(true);
|
|
281
|
-
var
|
|
282
|
-
var contentHeight = (_b = (_a = callbackData.node.parentNode) === null || _a === void 0 ? void 0 : _a.children[0].children[0].children[0].clientHeight) !== null && _b !== void 0 ? _b : 0;
|
|
283
|
-
console.log(contentHeight);
|
|
334
|
+
var _a = getDirectionOfMouseEvent(e), dirX = _a.dirX, dirY = _a.dirY;
|
|
284
335
|
var shouldBlock = shouldBlockResize({
|
|
285
336
|
handle: callbackData.handle,
|
|
286
337
|
direction: dirY,
|
|
287
|
-
contentHeight:
|
|
338
|
+
contentHeight: textContentHeight,
|
|
288
339
|
gridItemHeight: callbackData.size.height,
|
|
289
340
|
shouldAutoShrink: shouldAutoShrink.current.shouldAutoShrink,
|
|
290
341
|
initialHeight: shouldAutoShrink.current.initialHeight,
|
|
@@ -297,17 +348,17 @@ var GridItem = function (_a) {
|
|
|
297
348
|
handle: callbackData.handle,
|
|
298
349
|
dirX: dirX,
|
|
299
350
|
dirY: dirY,
|
|
300
|
-
contentHeight:
|
|
351
|
+
contentHeight: textContentHeight,
|
|
301
352
|
gridItemHeight: callbackData.size.height,
|
|
302
353
|
shouldAutoShrink: shouldAutoShrink.current.shouldAutoShrink,
|
|
303
354
|
initialHeight: shouldAutoShrink.current.initialHeight
|
|
304
355
|
});
|
|
305
356
|
console.log(shouldResize);
|
|
306
357
|
if (shouldResize !== 'EXPAND' && shouldBlock === 'BLOCK') {
|
|
307
|
-
callbackData.size.height =
|
|
358
|
+
callbackData.size.height = textContentHeight;
|
|
308
359
|
}
|
|
309
360
|
if (shouldResize === 'EXPAND') {
|
|
310
|
-
callbackData.size.height =
|
|
361
|
+
callbackData.size.height = textContentHeight;
|
|
311
362
|
shouldAutoShrink.current.shouldAutoShrink = true;
|
|
312
363
|
// NOTE: 배포전에 무조건 변경
|
|
313
364
|
if (callbackData.handle === 'nw') {
|
|
@@ -318,7 +369,7 @@ var GridItem = function (_a) {
|
|
|
318
369
|
}
|
|
319
370
|
}
|
|
320
371
|
if (shouldResize === 'SHRINK') {
|
|
321
|
-
callbackData.size.height = Math.max(shouldAutoShrink.current.initialHeight,
|
|
372
|
+
callbackData.size.height = Math.max(shouldAutoShrink.current.initialHeight, textContentHeight);
|
|
322
373
|
// NOTE: 배포전에 무조건 변경
|
|
323
374
|
if (callbackData.handle === 'nw') {
|
|
324
375
|
callbackData.handle = 'sw';
|
|
@@ -18,7 +18,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
18
18
|
}
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
|
-
import {
|
|
21
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
22
22
|
import { useIsMounted } from './useIsMounted';
|
|
23
23
|
var initialSize = {
|
|
24
24
|
width: undefined,
|
|
@@ -54,7 +54,7 @@ export function useResizeObserver(options, deps) {
|
|
|
54
54
|
var previousSize = useRef(__assign({}, initialSize));
|
|
55
55
|
var onResize = useRef(undefined);
|
|
56
56
|
onResize.current = options === null || options === void 0 ? void 0 : options.onResize;
|
|
57
|
-
|
|
57
|
+
useLayoutEffect(function () {
|
|
58
58
|
if (!(ref === null || ref === void 0 ? void 0 : ref.current))
|
|
59
59
|
return;
|
|
60
60
|
var placeholder = document.querySelector('.placeholder');
|