publ-echo-test 0.0.19 → 0.0.21
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.
@@ -31,13 +31,11 @@ var GridItem = function (_a) {
|
|
31
31
|
var _b;
|
32
32
|
var children = _a.children, props = __rest(_a, ["children"]);
|
33
33
|
var resizeHandle = props.resizeHandle, cols = props.cols, isDraggable = props.isDraggable, _c = props.transformScale, transformScale = _c === void 0 ? 1 : _c, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _d = props.cancel, cancel = _d === void 0 ? "" : _d, _e = props.handle, handle = _e === void 0 ? "" : _e, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _f = props.minH, minH = _f === void 0 ? 1 : _f, _g = props.minW, minW = _g === void 0 ? 1 : _g, _h = props.maxH, maxH = _h === void 0 ? Infinity : _h, _j = props.maxW, maxW = _j === void 0 ? Infinity : _j, i = props.i, _k = props.isHiddenVisibility, isHiddenVisibility = _k === void 0 ? false : _k, containerWidth = props.containerWidth, customColWidth = props.customColWidth, autoResize = props.autoResize;
|
34
|
-
var _l = useState(
|
35
|
-
var _m = useState(
|
36
|
-
var _o = useState(),
|
37
|
-
var _p = useState(),
|
38
|
-
var _q = useState(),
|
39
|
-
var _r = useState(false), isDragging = _r[0], setIsDragging = _r[1];
|
40
|
-
var _s = useState(false), isResizing = _s[0], setIsResizing = _s[1];
|
34
|
+
var _l = useState(), resizing = _l[0], setResizing = _l[1];
|
35
|
+
var _m = useState(), dragging = _m[0], setDragging = _m[1];
|
36
|
+
var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
|
37
|
+
var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
|
38
|
+
var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
|
41
39
|
var elementRef = useRef(null);
|
42
40
|
// const isSelected = className?.includes('react-grid-item-selected');
|
43
41
|
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains('react-grid-item-selected');
|
@@ -52,18 +50,15 @@ var GridItem = function (_a) {
|
|
52
50
|
}
|
53
51
|
// MutationObserver 콜백 함수
|
54
52
|
var callback = function (mutationsList, observer) {
|
55
|
-
console.log("MUTATION CALLBACK");
|
56
53
|
for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
|
57
54
|
var mutation = mutationsList_1[_i];
|
58
|
-
|
59
|
-
var height = mutation.target.clientHeight;
|
60
|
-
console.log("new height", height);
|
55
|
+
var height = mutation.type === 'characterData' ? mutation.target.parentNode.clientHeight : mutation.target.clientHeight;
|
61
56
|
var prevW = props.w;
|
62
57
|
var prevH = props.h;
|
63
58
|
var _a = calcWH(getPositionParams(), {
|
64
59
|
width: targetNode.clientWidth,
|
65
60
|
height: height,
|
66
|
-
}, x, y, 'e', props.w, props.h), w_1 = _a.w, h_1 = _a.h;
|
61
|
+
}, x, y, 'e', props.w, props.h, true), w_1 = _a.w, h_1 = _a.h;
|
67
62
|
var _b = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
68
63
|
props.onFitToContent && props.onFitToContent(i, w_1, h_1, newX, newY);
|
69
64
|
}
|
@@ -23,7 +23,7 @@ export declare function calcXY(positionParams: PositionParams, top: number, left
|
|
23
23
|
export declare function calcWH(positionParams: PositionParams, { width, height }: {
|
24
24
|
width: number;
|
25
25
|
height: number;
|
26
|
-
}, x: number, y: number, handleAxis?: ResizeHandleAxis, prevW?: number, prevH?: number): {
|
26
|
+
}, x: number, y: number, handleAxis?: ResizeHandleAxis, prevW?: number, prevH?: number, shouldCeil?: boolean): {
|
27
27
|
w: number;
|
28
28
|
h: number;
|
29
29
|
};
|
@@ -52,13 +52,14 @@ export function calcXY(positionParams, top, left, w, h) {
|
|
52
52
|
y = clamp(y, 0, maxRows - h);
|
53
53
|
return { x: x, y: y };
|
54
54
|
}
|
55
|
-
export function calcWH(positionParams, _a, x, y, handleAxis, prevW, prevH) {
|
55
|
+
export function calcWH(positionParams, _a, x, y, handleAxis, prevW, prevH, shouldCeil) {
|
56
56
|
var width = _a.width, height = _a.height;
|
57
57
|
var margin = positionParams.margin, maxRows = positionParams.maxRows, cols = positionParams.cols, rowHeight = positionParams.rowHeight;
|
58
58
|
var colWidth = calcGridColWidth(positionParams);
|
59
59
|
var rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
|
60
|
-
var
|
61
|
-
var
|
60
|
+
var roundOrCeil = shouldCeil ? Math.ceil : Math.round;
|
61
|
+
var w = roundOrCeil((width + margin[0]) / (colWidth + margin[0]));
|
62
|
+
var h = roundOrCeil((height + margin[1]) / (rowHeightNumber + margin[1]));
|
62
63
|
// // Capping
|
63
64
|
// w = clamp(w, 0, cols - x);
|
64
65
|
// h = clamp(h, 0, maxRows - y);
|