publ-echo 0.0.78 → 0.0.80
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/dist/lib/FlexGridLayout/FlexGridLayout.d.ts +2 -0
- package/dist/lib/FlexGridLayout/FlexGridLayout.js +5 -0
- package/dist/lib/GridItem/GridItem.js +8 -16
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +2 -2
- package/dist/lib/GridLayoutEditor/types.d.ts +2 -0
- package/dist/lib/Resizable/Resizable.js +7 -11
- package/dist/lib/hooks/useResizeobserver.js +7 -9
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ import { useResizeObserver } from "../hooks/useResizeobserver";
|
|
|
31
31
|
import { shouldAutoResize, shouldBlockResize } from "./utils/autoResizeUtils";
|
|
32
32
|
var GridItem = function (_a) {
|
|
33
33
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
34
|
-
var resizeHandle = props.resizeHandle, cols = props.cols, isDraggable = props.isDraggable, _b = props.transformScale, transformScale = _b === void 0 ? 1 : _b, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _c = props.cancel, cancel = _c === void 0 ? "" : _c, _d = props.handle, handle = _d === void 0 ? "" : _d, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _e = props.minH, minH = _e === void 0 ? 1 : _e, _f = props.minW, minW = _f === void 0 ? 1 : _f, _g = props.maxH, maxH = _g === void 0 ? Infinity : _g, _h = props.maxW, maxW = _h === void 0 ? Infinity : _h, i = props.i, _j = props.isHiddenVisibility, isHiddenVisibility = _j === void 0 ? false : _j, containerWidth = props.containerWidth, customColWidth = props.customColWidth, rowHeight = props.rowHeight, activeResizeObserver = props.activeResizeObserver
|
|
34
|
+
var resizeHandle = props.resizeHandle, cols = props.cols, isDraggable = props.isDraggable, _b = props.transformScale, transformScale = _b === void 0 ? 1 : _b, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _c = props.cancel, cancel = _c === void 0 ? "" : _c, _d = props.handle, handle = _d === void 0 ? "" : _d, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _e = props.minH, minH = _e === void 0 ? 1 : _e, _f = props.minW, minW = _f === void 0 ? 1 : _f, _g = props.maxH, maxH = _g === void 0 ? Infinity : _g, _h = props.maxW, maxW = _h === void 0 ? Infinity : _h, i = props.i, _j = props.isHiddenVisibility, isHiddenVisibility = _j === void 0 ? false : _j, containerWidth = props.containerWidth, customColWidth = props.customColWidth, rowHeight = props.rowHeight, activeResizeObserver = props.activeResizeObserver;
|
|
35
35
|
var shouldAutoShrink = useRef({ shouldAutoShrink: false, initialHeight: 0 });
|
|
36
36
|
var _k = useState(), resizing = _k[0], setResizing = _k[1];
|
|
37
37
|
var _l = useState(), dragging = _l[0], setDragging = _l[1];
|
|
@@ -39,7 +39,7 @@ var GridItem = function (_a) {
|
|
|
39
39
|
var _o = useState(false), isDragging = _o[0], setIsDragging = _o[1];
|
|
40
40
|
var _p = useState(false), isResizing = _p[0], setIsResizing = _p[1];
|
|
41
41
|
var elementRef = useRef(null);
|
|
42
|
-
var
|
|
42
|
+
var gridItemHeight = useResizeObserver([isDragging, isResizing]).gridItemHeight;
|
|
43
43
|
var isHoveredRef = useRef(false);
|
|
44
44
|
useEffect(function () {
|
|
45
45
|
var node = elementRef.current;
|
|
@@ -60,6 +60,7 @@ var GridItem = function (_a) {
|
|
|
60
60
|
};
|
|
61
61
|
}, []);
|
|
62
62
|
useEffect(function () {
|
|
63
|
+
// NOTE: 표현길이 높이맞춤
|
|
63
64
|
if (isDragging || isResizing) {
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
@@ -70,7 +71,10 @@ var GridItem = function (_a) {
|
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
73
|
if (isHoveredRef.current) {
|
|
73
|
-
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
var target = elementRef.current.querySelector(".cb-text-content");
|
|
77
|
+
if (!target) {
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
80
|
var observer = new ResizeObserver(function (_a) {
|
|
@@ -83,16 +87,14 @@ var GridItem = function (_a) {
|
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
if (isHoveredRef.current) {
|
|
86
|
-
console.log('disconnect from observer');
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
89
92
|
;
|
|
90
93
|
var _d = calcWH(getPositionParams(), { width: newClientWidth, height: newClientHeight }, x, y, 'se', props.w, props.h), w = _d.w, h = _d.h;
|
|
91
94
|
props.onContentSizeChange(props.i, { x: x, y: y, w: w, h: h });
|
|
92
95
|
});
|
|
93
|
-
observer.observe(
|
|
96
|
+
observer.observe(target, { box: 'border-box' });
|
|
94
97
|
if (isHoveredRef.current) {
|
|
95
|
-
console.log('disconnect observer');
|
|
96
98
|
observer.disconnect();
|
|
97
99
|
}
|
|
98
100
|
;
|
|
@@ -317,20 +319,11 @@ var GridItem = function (_a) {
|
|
|
317
319
|
* @param {Object} callbackData an object with node and size information
|
|
318
320
|
*/
|
|
319
321
|
var onResizeStart = function (e, callbackData) {
|
|
320
|
-
// const isOverflowingVertically = scrollHeight > clientHeight;
|
|
321
|
-
// const isHandleVertical = callbackData.handle.includes('n') || callbackData.handle.includes('s')
|
|
322
|
-
// const isOverflowingHorizontally = scrollWidth > clientWidth;
|
|
323
|
-
// if (isOverflowingVertically && isHandleVertical) {
|
|
324
|
-
// elementRef.current?.classList.add(`resize-notallowed-${callbackData.handle}`)
|
|
325
|
-
// return;
|
|
326
|
-
// }
|
|
327
322
|
onResizeHandler(e, callbackData, "onResizeStart");
|
|
328
|
-
// NOTE: 확인필요
|
|
329
323
|
shouldAutoShrink.current.initialHeight = gridItemHeight;
|
|
330
324
|
};
|
|
331
325
|
var onResize = function (e, callbackData, contentSize) {
|
|
332
326
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
333
|
-
console.log(contentSize);
|
|
334
327
|
setIsResizing(true);
|
|
335
328
|
var _j = getDirectionOfMouseEvent(e), dirX = _j.dirX, dirY = _j.dirY;
|
|
336
329
|
var oneLetterSize = (_a = calculateCharacterWidthInDiv()) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -458,7 +451,6 @@ var GridItem = function (_a) {
|
|
|
458
451
|
if (className === 'placeholder') {
|
|
459
452
|
return newChild;
|
|
460
453
|
}
|
|
461
|
-
console.log(activeResizeObserver);
|
|
462
454
|
newChild = mixinResizable(newChild, pos, isResizable);
|
|
463
455
|
newChild = mixinDraggable(newChild, isDraggable);
|
|
464
456
|
return newChild;
|
|
@@ -279,7 +279,7 @@ var ReactGridLayout = function (_a) {
|
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
281
|
setLayout(newLayout);
|
|
282
|
-
props.
|
|
282
|
+
props.onAutoResizedToFit && props.onAutoResizedToFit(newLayout);
|
|
283
283
|
};
|
|
284
284
|
var onResizeHandler = function (i, w, h, _a, x, y) {
|
|
285
285
|
var e = _a.e, node = _a.node;
|
|
@@ -395,7 +395,7 @@ var ReactGridLayout = function (_a) {
|
|
|
395
395
|
: !l.static && isResizable;
|
|
396
396
|
var resizeHandlesOptions = l.resizeHandles || resizeHandles;
|
|
397
397
|
var bounded = draggable && isBounded && l.isBounded !== false;
|
|
398
|
-
return (_jsx(GridItem, { className: "i-am-grid-item", containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onContentSizeChange: onContentSizeChange, isDraggable: draggable, isResizable: resizable, isBounded: bounded, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: l.w, h: l.h, x: l.x, y: l.y, z: l.z || 0, i: l.i, minH: l.minH, minW: l.minW, maxH: l.maxH, maxW: l.maxW, static: l.static, droppingPosition: isDroppingItem ? droppingPosition : undefined, resizeHandles: resizeHandlesOptions, resizeHandle: resizeHandle, isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, activeResizeObserver: child.props.className === 'react-grid-item-selected', children: child }, l.i));
|
|
398
|
+
return (_jsx(GridItem, { className: "i-am-grid-item", containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onContentSizeChange: onContentSizeChange, isDraggable: draggable, isResizable: resizable, isBounded: bounded, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: l.w, h: l.h, x: l.x, y: l.y, z: l.z || 0, i: l.i, minH: l.minH, minW: l.minW, maxH: l.maxH, maxW: l.maxW, static: l.static, droppingPosition: isDroppingItem ? droppingPosition : undefined, resizeHandles: resizeHandlesOptions, resizeHandle: resizeHandle, isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, activeResizeObserver: child.props.className === 'react-grid-item-selected' && l.activeAutoResize, children: child }, l.i));
|
|
399
399
|
};
|
|
400
400
|
var onDragOverHandler = function (e) {
|
|
401
401
|
var _a;
|
|
@@ -21,6 +21,7 @@ export type LayoutItem = {
|
|
|
21
21
|
isBounded?: boolean;
|
|
22
22
|
autoExpandOnContentChanged?: boolean;
|
|
23
23
|
groupLayouts?: LayoutItem[];
|
|
24
|
+
activeAutoResize?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export type Layout = LayoutItem[];
|
|
26
27
|
export type DroppedEvent = {
|
|
@@ -56,6 +57,7 @@ export type ReactGridLayoutProps = {
|
|
|
56
57
|
resizeHandle?: ResizeHandleType;
|
|
57
58
|
allowOverlap?: boolean;
|
|
58
59
|
onLayoutChange?: (layout: Layout) => void;
|
|
60
|
+
onAutoResizedToFit?: (layout: Layout) => void;
|
|
59
61
|
onDrag?: EventCallback;
|
|
60
62
|
onDragStart?: EventCallback;
|
|
61
63
|
onDragStop?: EventCallback;
|
|
@@ -35,7 +35,8 @@ import React, { useEffect, useRef, useState } from "react";
|
|
|
35
35
|
import DraggableCore from "../Draggable/DraggableCore";
|
|
36
36
|
import { cloneElement } from "./utils/cloneElement";
|
|
37
37
|
var Resizable = function (_a) {
|
|
38
|
-
var
|
|
38
|
+
var _b;
|
|
39
|
+
var children = _a.children, _c = _a.axis, axis = _c === void 0 ? "both" : _c, _d = _a.handleSize, handleSize = _d === void 0 ? [20, 20] : _d, _e = _a.lockAspectRatio, lockAspectRatio = _e === void 0 ? false : _e, _f = _a.minConstraints, minConstraints = _f === void 0 ? [20, 20] : _f, _g = _a.maxConstraints, maxConstraints = _g === void 0 ? [Infinity, Infinity] : _g, _h = _a.resizeHandles, resizeHandles = _h === void 0 ? ["se"] : _h, _j = _a.transformScale, transformScale = _j === void 0 ? 1 : _j, props = __rest(_a, ["children", "axis", "handleSize", "lockAspectRatio", "minConstraints", "maxConstraints", "resizeHandles", "transformScale"]);
|
|
39
40
|
var placeholderObserver = props.placeholderObserver;
|
|
40
41
|
var handleRefs = useRef({
|
|
41
42
|
s: useRef(null),
|
|
@@ -51,18 +52,13 @@ var Resizable = function (_a) {
|
|
|
51
52
|
var startSize = useRef(null);
|
|
52
53
|
var lastHandleRect = null;
|
|
53
54
|
var slack = null;
|
|
54
|
-
var
|
|
55
|
-
var
|
|
55
|
+
var _k = useState({ width: 0, height: 0 }), content = _k[0], setContent = _k[1];
|
|
56
|
+
var target = (_b = document.querySelector('.placeholder')) === null || _b === void 0 ? void 0 : _b.querySelector('.cb-text-content');
|
|
56
57
|
useEffect(function () {
|
|
57
|
-
var _a;
|
|
58
58
|
if (!placeholderObserver) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (!
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
var content = (_a = placeholder.children[0].children[0]) === null || _a === void 0 ? void 0 : _a.children[0];
|
|
65
|
-
if (!content) {
|
|
61
|
+
if (!target) {
|
|
66
62
|
return;
|
|
67
63
|
}
|
|
68
64
|
var observer = new ResizeObserver(function (_a) {
|
|
@@ -71,11 +67,11 @@ var Resizable = function (_a) {
|
|
|
71
67
|
var contentWidth = entry.target.clientWidth;
|
|
72
68
|
setContent({ width: contentWidth, height: contentHeight });
|
|
73
69
|
});
|
|
74
|
-
observer.observe(
|
|
70
|
+
observer.observe(target, { box: 'border-box' });
|
|
75
71
|
return function () {
|
|
76
72
|
observer.disconnect();
|
|
77
73
|
};
|
|
78
|
-
}, [placeholderObserver,
|
|
74
|
+
}, [placeholderObserver, target]);
|
|
79
75
|
var className = props.className, draggableOpts = props.draggableOpts, width = props.width, height = props.height, handle = props.handle, onResize = props.onResize, onResizeStop = props.onResizeStop, onResizeStart = props.onResizeStart, restProps = __rest(props, ["className", "draggableOpts", "width", "height", "handle", "onResize", "onResizeStop", "onResizeStart"]);
|
|
80
76
|
var resetData = function () {
|
|
81
77
|
lastHandleRect = slack = null;
|
|
@@ -32,29 +32,27 @@ export function useResizeObserver(deps) {
|
|
|
32
32
|
var refvalue = useRef({ myHeight: 0 });
|
|
33
33
|
var isMounted = useIsMounted();
|
|
34
34
|
useLayoutEffect(function () {
|
|
35
|
-
var
|
|
36
|
-
|
|
35
|
+
var _a;
|
|
36
|
+
var target = (_a = document.querySelector('.placeholder')) === null || _a === void 0 ? void 0 : _a.querySelector('.cb-text-box');
|
|
37
|
+
if (!target) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
if (typeof window === 'undefined' || !('ResizeObserver' in window)) {
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
var observer = new ResizeObserver(function (_a) {
|
|
43
|
-
var _b
|
|
44
|
+
var _b;
|
|
44
45
|
var entry = _a[0];
|
|
45
46
|
var newWidth = extractSize(entry, 'contentBoxSize', 'inlineSize');
|
|
46
47
|
var newHeight = extractSize(entry, 'borderBoxSize', 'blockSize');
|
|
47
48
|
var newScrollHeight = entry.target.scrollHeight;
|
|
48
|
-
var
|
|
49
|
-
var newContentHeight = (_c = (_b = entry.target.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.clientHeight;
|
|
50
|
-
var newContentWidth = (_e = (_d = entry.target.children[0]) === null || _d === void 0 ? void 0 : _d.children[0]) === null || _e === void 0 ? void 0 : _e.clientWidth;
|
|
49
|
+
var newContentHeight = (_b = entry.target.children[0]) === null || _b === void 0 ? void 0 : _b.clientHeight;
|
|
51
50
|
refvalue.current.myHeight = newContentHeight;
|
|
52
|
-
var newSize = { gridItemWidth: newWidth, gridItemHeight: newHeight, scrollHeight: newScrollHeight, clientHeight:
|
|
51
|
+
var newSize = { gridItemWidth: newWidth, gridItemHeight: newHeight, scrollHeight: newScrollHeight, clientHeight: newContentHeight };
|
|
53
52
|
previousSize.current = newSize;
|
|
54
53
|
setSize(newSize);
|
|
55
54
|
});
|
|
56
|
-
observer.observe(
|
|
57
|
-
console.log('target', placeholder.children[0]);
|
|
55
|
+
observer.observe(target, { box: 'border-box' });
|
|
58
56
|
return function () {
|
|
59
57
|
observer.disconnect();
|
|
60
58
|
};
|