publ-echo 0.0.57 → 0.0.59
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, textContentHeight = _q.textContentHeight;
|
|
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, myHeightRef = _q.myHeightRef;
|
|
46
46
|
// const moveDroppingItem = (prevProps: GridItemProps) => {
|
|
47
47
|
// const { droppingPosition } = props;
|
|
48
48
|
// if (!droppingPosition) return;
|
|
@@ -116,7 +116,7 @@ var GridItem = function (_a) {
|
|
|
116
116
|
* @param {Object} position Position object (pixel values)
|
|
117
117
|
* @return {Element} Child wrapped in Resizable.
|
|
118
118
|
*/
|
|
119
|
-
var mixinResizable = function (child, position, isResizable) {
|
|
119
|
+
var mixinResizable = function (child, position, isResizable, placeholderHeight) {
|
|
120
120
|
var positionParams = getPositionParams();
|
|
121
121
|
// const maxWidth = calcGridItemPosition(
|
|
122
122
|
// positionParams,
|
|
@@ -133,6 +133,8 @@ var GridItem = function (_a) {
|
|
|
133
133
|
Math.min(maxes.width, containerWidth),
|
|
134
134
|
Math.min(maxes.height, Infinity),
|
|
135
135
|
];
|
|
136
|
+
console.log('from mixin: ', textContentHeight);
|
|
137
|
+
console.log('prop value: ', placeholderHeight);
|
|
136
138
|
return (_jsx(Resizable, { draggableOpts: {
|
|
137
139
|
disabled: !isResizable,
|
|
138
140
|
}, className: isResizable ? undefined : "react-resizable-hide", width: position.width, height: position.height, top: position.top, left: position.left, minConstraints: minConstraints, maxConstraints: maxConstraints, onResizeStop: onResizeStop, onResizeStart: onResizeStart, onResize: onResize, transformScale: transformScale, resizeHandles: props.resizeHandles, handle: resizeHandle, children: child }));
|
|
@@ -330,12 +332,15 @@ var GridItem = function (_a) {
|
|
|
330
332
|
// onResizeHandler(e, callbackData, "onResize");
|
|
331
333
|
// }, [textContentHeight])
|
|
332
334
|
var onResize = function (e, callbackData) {
|
|
335
|
+
var _a;
|
|
333
336
|
setIsResizing(true);
|
|
334
|
-
var
|
|
337
|
+
var _b = getDirectionOfMouseEvent(e), dirX = _b.dirX, dirY = _b.dirY;
|
|
338
|
+
var myh = (_a = myHeightRef.current) === null || _a === void 0 ? void 0 : _a.myHeight;
|
|
339
|
+
console.log('myh: ', myh);
|
|
335
340
|
var shouldBlock = shouldBlockResize({
|
|
336
341
|
handle: callbackData.handle,
|
|
337
342
|
direction: dirY,
|
|
338
|
-
contentHeight:
|
|
343
|
+
contentHeight: myh,
|
|
339
344
|
gridItemHeight: callbackData.size.height,
|
|
340
345
|
shouldAutoShrink: shouldAutoShrink.current.shouldAutoShrink,
|
|
341
346
|
initialHeight: shouldAutoShrink.current.initialHeight,
|
|
@@ -348,17 +353,17 @@ var GridItem = function (_a) {
|
|
|
348
353
|
handle: callbackData.handle,
|
|
349
354
|
dirX: dirX,
|
|
350
355
|
dirY: dirY,
|
|
351
|
-
contentHeight:
|
|
356
|
+
contentHeight: myh,
|
|
352
357
|
gridItemHeight: callbackData.size.height,
|
|
353
358
|
shouldAutoShrink: shouldAutoShrink.current.shouldAutoShrink,
|
|
354
359
|
initialHeight: shouldAutoShrink.current.initialHeight
|
|
355
360
|
});
|
|
356
361
|
console.log(shouldResize);
|
|
357
362
|
if (shouldResize !== 'EXPAND' && shouldBlock === 'BLOCK') {
|
|
358
|
-
callbackData.size.height =
|
|
363
|
+
callbackData.size.height = myh;
|
|
359
364
|
}
|
|
360
365
|
if (shouldResize === 'EXPAND') {
|
|
361
|
-
callbackData.size.height =
|
|
366
|
+
callbackData.size.height = myh;
|
|
362
367
|
shouldAutoShrink.current.shouldAutoShrink = true;
|
|
363
368
|
// NOTE: 배포전에 무조건 변경
|
|
364
369
|
if (callbackData.handle === 'nw') {
|
|
@@ -369,7 +374,7 @@ var GridItem = function (_a) {
|
|
|
369
374
|
}
|
|
370
375
|
}
|
|
371
376
|
if (shouldResize === 'SHRINK') {
|
|
372
|
-
callbackData.size.height = Math.max(shouldAutoShrink.current.initialHeight,
|
|
377
|
+
callbackData.size.height = Math.max(shouldAutoShrink.current.initialHeight, myh);
|
|
373
378
|
// NOTE: 배포전에 무조건 변경
|
|
374
379
|
if (callbackData.handle === 'nw') {
|
|
375
380
|
callbackData.handle = 'sw';
|
|
@@ -445,7 +450,7 @@ var GridItem = function (_a) {
|
|
|
445
450
|
}),
|
|
446
451
|
style: __assign(__assign(__assign({}, props.style), child.props.style), createStyle(pos)),
|
|
447
452
|
});
|
|
448
|
-
newChild = mixinResizable(newChild, pos, isResizable);
|
|
453
|
+
newChild = mixinResizable(newChild, pos, isResizable, textContentHeight !== null && textContentHeight !== void 0 ? textContentHeight : 0);
|
|
449
454
|
newChild = mixinDraggable(newChild, isDraggable);
|
|
450
455
|
return newChild;
|
|
451
456
|
};
|
|
@@ -46,6 +46,11 @@ var Resizable = function (_a) {
|
|
|
46
46
|
ne: useRef(null),
|
|
47
47
|
nw: useRef(null),
|
|
48
48
|
});
|
|
49
|
+
// const elementRef = useRef<HTMLDivElement>(null);
|
|
50
|
+
// const { textContentHeight, myHeightRef } = useResizeObserver({
|
|
51
|
+
// ref: elementRef,
|
|
52
|
+
// box: 'border-box',
|
|
53
|
+
// } ,[])
|
|
49
54
|
var startPosition = useRef(null);
|
|
50
55
|
var startSize = useRef(null);
|
|
51
56
|
var lastHandleRect = null;
|
|
@@ -13,7 +13,11 @@ type UseResizeObserverOptions<T extends HTMLElement = HTMLElement> = {
|
|
|
13
13
|
onResize?: ResizeHandler;
|
|
14
14
|
box?: BoxOptions;
|
|
15
15
|
};
|
|
16
|
-
type UseResizeObserverResult = Size
|
|
16
|
+
type UseResizeObserverResult = Size & {
|
|
17
|
+
myHeightRef: RefObject<{
|
|
18
|
+
myHeight: number;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
17
21
|
/**
|
|
18
22
|
* Custom hook for observing the size of an element using the ResizeObserver API.
|
|
19
23
|
*
|
|
@@ -50,6 +50,7 @@ var initialSize = {
|
|
|
50
50
|
export function useResizeObserver(options, deps) {
|
|
51
51
|
var ref = options.ref, _a = options.box, box = _a === void 0 ? 'content-box' : _a;
|
|
52
52
|
var _b = useState(initialSize), size = _b[0], setSize = _b[1];
|
|
53
|
+
var refvalue = useRef({ myHeight: 0 });
|
|
53
54
|
var isMounted = useIsMounted();
|
|
54
55
|
var previousSize = useRef(__assign({}, initialSize));
|
|
55
56
|
var onResize = useRef(undefined);
|
|
@@ -77,6 +78,7 @@ export function useResizeObserver(options, deps) {
|
|
|
77
78
|
var newScrollHeight = entry.target.scrollHeight;
|
|
78
79
|
var newClientHeight = entry.target.clientHeight;
|
|
79
80
|
var newTextContentHeight = (_d = (_c = (_b = entry.target.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0;
|
|
81
|
+
refvalue.current.myHeight = newTextContentHeight;
|
|
80
82
|
var hasChanged = previousSize.current.width !== newWidth ||
|
|
81
83
|
previousSize.current.height !== newHeight ||
|
|
82
84
|
previousSize.current.scrollHeight !== newScrollHeight ||
|
|
@@ -101,7 +103,8 @@ export function useResizeObserver(options, deps) {
|
|
|
101
103
|
observer.disconnect();
|
|
102
104
|
};
|
|
103
105
|
}, __spreadArray([box, ref, isMounted], deps, true));
|
|
104
|
-
|
|
106
|
+
console.log('--SIZE FROM OBSERVER--', size.textContentHeight);
|
|
107
|
+
return __assign(__assign({}, size), { myHeightRef: refvalue });
|
|
105
108
|
}
|
|
106
109
|
function extractSize(entry, box, sizeType) {
|
|
107
110
|
if (!entry[box]) {
|