publ-echo-test 0.0.290 → 0.0.292
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.
@@ -142,13 +142,20 @@ var GridItem = function (_a) {
|
|
142
142
|
mutation.attributeName === "data-min-height";
|
143
143
|
var keepWidth = true;
|
144
144
|
var hasPaddingChanged = true;
|
145
|
+
var layoutBox = targetNode.children[0];
|
146
|
+
var contentsWrapper = layoutBox.children[0];
|
147
|
+
var oneComposition = contentsWrapper.children[0];
|
145
148
|
// const insetTop = Number(mutation.target.dataset.insetTop!);
|
146
149
|
// const insetBottom = Number(mutation.target.dataset.insetBottom!);
|
147
150
|
var minWidth = 0;
|
148
151
|
// const minHeight =
|
149
152
|
// Number(mutation.target.dataset.minHeight) + insetTop + insetBottom;
|
150
|
-
|
151
|
-
|
153
|
+
// const contentsWrapper = mutation.target.querySelector(
|
154
|
+
// ".cb-contentslist-wrapper"
|
155
|
+
// );
|
156
|
+
// const oneComposition = mutation.target.querySelector(
|
157
|
+
// ".composition-container"
|
158
|
+
// );
|
152
159
|
var minHeight = 0;
|
153
160
|
if (contentsWrapper && oneComposition) {
|
154
161
|
var minCellWidth = 10;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import React from
|
2
|
-
import { GridItemProps } from
|
3
|
-
import { PropsWithChildren } from
|
1
|
+
import React from "react";
|
2
|
+
import { GridItemProps } from "./types";
|
3
|
+
import { PropsWithChildren } from "../types";
|
4
4
|
declare const GroupItem: ({ children, ...props }: PropsWithChildren<GridItemProps & {
|
5
5
|
onContextGroup: (e: React.MouseEvent) => void;
|
6
6
|
zOrder: number;
|
@@ -21,22 +21,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
21
21
|
return t;
|
22
22
|
};
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
-
import React, { useEffect, useRef, useState } from
|
25
|
-
import { DraggableCore } from
|
26
|
-
import classNames from
|
27
|
-
import { calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcXY, clamp, resolveRowHeight, } from
|
28
|
-
import { perc, setTopLeft, setTransform, } from
|
24
|
+
import React, { useEffect, useRef, useState } from "react";
|
25
|
+
import { DraggableCore } from "../Draggable";
|
26
|
+
import classNames from "../../external-lib/classnames";
|
27
|
+
import { calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcXY, clamp, resolveRowHeight, } from "./utils/calculateUtils";
|
28
|
+
import { perc, setTopLeft, setTransform, } from "../GridLayoutEditor/utils/renderHelpers";
|
29
29
|
var GroupItem = function (_a) {
|
30
30
|
var _b;
|
31
31
|
var children = _a.children, props = __rest(_a, ["children"]);
|
32
|
-
var resizeHandle = props.resizeHandle, cols = props.cols, zOrder = props.zOrder, zOrderInternal = props.zOrderInternal, 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 ?
|
32
|
+
var resizeHandle = props.resizeHandle, cols = props.cols, zOrder = props.zOrder, zOrderInternal = props.zOrderInternal, 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, minZ = props.minZ, onContextGroup = props.onContextGroup;
|
33
33
|
var _l = useState(), resizing = _l[0], setResizing = _l[1];
|
34
34
|
var _m = useState(), dragging = _m[0], setDragging = _m[1];
|
35
35
|
var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
|
36
36
|
var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
|
37
37
|
var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
|
38
38
|
var elementRef = useRef(null);
|
39
|
-
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains(
|
39
|
+
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains("react-grid-item-selected");
|
40
40
|
useEffect(function () {
|
41
41
|
var _a;
|
42
42
|
if (!isSelected || !autoResize) {
|
@@ -54,7 +54,7 @@ var GroupItem = function (_a) {
|
|
54
54
|
var callback = function (mutationsList) {
|
55
55
|
for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
|
56
56
|
var mutation = mutationsList_1[_i];
|
57
|
-
var isCharacterChanged = mutation.type ===
|
57
|
+
var isCharacterChanged = mutation.type === "characterData";
|
58
58
|
var keepWidth = true;
|
59
59
|
var hasPaddingChanged = false;
|
60
60
|
var height = isCharacterChanged
|
@@ -85,14 +85,14 @@ var GroupItem = function (_a) {
|
|
85
85
|
var _a = calcWH(getPositionParams(), {
|
86
86
|
width: width,
|
87
87
|
height: height,
|
88
|
-
}, x, y,
|
88
|
+
}, x, y, "e", props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
|
89
89
|
if (keepWidth) {
|
90
90
|
w_1 = prevW;
|
91
91
|
}
|
92
92
|
if (prevH > h_1) {
|
93
93
|
h_1 = prevH;
|
94
94
|
}
|
95
|
-
var _b = getResizableXYPosition(
|
95
|
+
var _b = getResizableXYPosition("e", w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
96
96
|
if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
|
97
97
|
return;
|
98
98
|
}
|
@@ -162,7 +162,7 @@ var GroupItem = function (_a) {
|
|
162
162
|
style = setTopLeft(pos);
|
163
163
|
if (usePercentages) {
|
164
164
|
if (containerWidth == null) {
|
165
|
-
throw new Error(
|
165
|
+
throw new Error("Container width is missing!");
|
166
166
|
}
|
167
167
|
style.left = perc(pos.left / containerWidth);
|
168
168
|
style.width = perc(pos.width / containerWidth);
|
@@ -176,7 +176,7 @@ var GroupItem = function (_a) {
|
|
176
176
|
* @return {Element} Child wrapped in Draggable.
|
177
177
|
*/
|
178
178
|
var mixinDraggable = function (child, isDraggable) {
|
179
|
-
return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel:
|
179
|
+
return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel: ".react-resizable-handle" + (cancel ? "," + cancel : ""), scale: transformScale, nodeRef: elementRef, children: child }));
|
180
180
|
};
|
181
181
|
// /**
|
182
182
|
// * Mix a Resizable instance into a child.
|
@@ -263,7 +263,7 @@ var GroupItem = function (_a) {
|
|
263
263
|
var onDrag = function (e, _a) {
|
264
264
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
265
265
|
if (!dragging) {
|
266
|
-
throw new Error(
|
266
|
+
throw new Error("onDrag called before onDragStart.");
|
267
267
|
}
|
268
268
|
setIsDragging(true);
|
269
269
|
var top = dragging.top + deltaY;
|
@@ -278,7 +278,6 @@ var GroupItem = function (_a) {
|
|
278
278
|
var rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
|
279
279
|
var bottomBoundary = offsetParent.clientHeight -
|
280
280
|
calcGridItemWHPx(h, rowHeightNumber, margin[1]);
|
281
|
-
console.log('bb', bottomBoundary);
|
282
281
|
top = clamp(top, 0, bottomBoundary);
|
283
282
|
var rightBoundary = containerWidth - calcGridItemWHPx(w, colWidth, margin[0]);
|
284
283
|
left = clamp(left, 0, rightBoundary);
|
@@ -297,7 +296,7 @@ var GroupItem = function (_a) {
|
|
297
296
|
var onDragStop = function (e, _a) {
|
298
297
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
299
298
|
if (!dragging) {
|
300
|
-
throw new Error(
|
299
|
+
throw new Error("onDragEnd called before onDragStart.");
|
301
300
|
}
|
302
301
|
var w = props.w, h = props.h, i = props.i;
|
303
302
|
var left = dragging.left, top = dragging.top;
|
@@ -313,7 +312,7 @@ var GroupItem = function (_a) {
|
|
313
312
|
var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
|
314
313
|
var newX = x;
|
315
314
|
var newY = y;
|
316
|
-
if (handle ===
|
315
|
+
if (handle === "nw") {
|
317
316
|
// NOTE - nw left(X)와 top(Y) 둘다 변경
|
318
317
|
if (width > prevW) {
|
319
318
|
newX = x - (width - prevW);
|
@@ -328,7 +327,7 @@ var GroupItem = function (_a) {
|
|
328
327
|
newY = y + (prevH - height);
|
329
328
|
}
|
330
329
|
}
|
331
|
-
if (handle ===
|
330
|
+
if (handle === "n" || handle === "ne") {
|
332
331
|
// NOTE - n, ne left(X) 고정 & top(Y) 변경
|
333
332
|
if (height > prevH) {
|
334
333
|
newY = y - (height - prevH);
|
@@ -337,7 +336,7 @@ var GroupItem = function (_a) {
|
|
337
336
|
newY = y + (prevH - height);
|
338
337
|
}
|
339
338
|
}
|
340
|
-
if (handle ===
|
339
|
+
if (handle === "w" || handle === "sw") {
|
341
340
|
// NOTE - s, sw left(X) 변경 top(Y) 고정
|
342
341
|
if (width > prevW) {
|
343
342
|
newX = x - (width - prevW);
|
@@ -354,7 +353,7 @@ var GroupItem = function (_a) {
|
|
354
353
|
* @param {Object} callbackData an object with node and size information
|
355
354
|
*/
|
356
355
|
var onResizeStart = function (e, callbackData) {
|
357
|
-
onResizeHandler(e, callbackData,
|
356
|
+
onResizeHandler(e, callbackData, "onResizeStart");
|
358
357
|
};
|
359
358
|
/**
|
360
359
|
* onResize event handler
|
@@ -363,7 +362,7 @@ var GroupItem = function (_a) {
|
|
363
362
|
*/
|
364
363
|
var onResize = function (e, callbackData) {
|
365
364
|
setIsResizing(true);
|
366
|
-
onResizeHandler(e, callbackData,
|
365
|
+
onResizeHandler(e, callbackData, "onResize");
|
367
366
|
};
|
368
367
|
/**
|
369
368
|
* onResizeStop event handler
|
@@ -372,7 +371,7 @@ var GroupItem = function (_a) {
|
|
372
371
|
*/
|
373
372
|
var onResizeStop = function (e, callbackData) {
|
374
373
|
setIsResizing(false);
|
375
|
-
onResizeHandler(e, callbackData,
|
374
|
+
onResizeHandler(e, callbackData, "onResizeStop");
|
376
375
|
};
|
377
376
|
/**
|
378
377
|
* Wrapper around drag events to provide more useful data.
|
@@ -406,7 +405,7 @@ var GroupItem = function (_a) {
|
|
406
405
|
// maxW = Math.min(maxW, cols - x);
|
407
406
|
w = clamp(w, minW, maxW);
|
408
407
|
h = clamp(h, tempMinH, maxH);
|
409
|
-
setResizing(handlerName ===
|
408
|
+
setResizing(handlerName === "onResizeStop" ? undefined : size);
|
410
409
|
var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
|
411
410
|
handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
|
412
411
|
};
|
@@ -415,22 +414,22 @@ var GroupItem = function (_a) {
|
|
415
414
|
var newChild = React.cloneElement(child, {
|
416
415
|
key: i,
|
417
416
|
ref: elementRef,
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
className: classNames(
|
417
|
+
"data-group-block-id": i,
|
418
|
+
"data-z-index": z,
|
419
|
+
"data-z-order": zOrder,
|
420
|
+
"data-z-order-internal": zOrderInternal,
|
421
|
+
"data-min-z": minZ,
|
422
|
+
className: classNames("react-group-block", child.props.className, className, {
|
424
423
|
static: props.static,
|
425
424
|
isResizing: Boolean(resizing) &&
|
426
425
|
Boolean(isResizing) &&
|
427
426
|
Boolean(isHiddenVisibility),
|
428
427
|
resizing: Boolean(resizing),
|
429
|
-
|
428
|
+
"react-draggable": isDraggable,
|
430
429
|
isDragging: Boolean(isDragging) &&
|
431
430
|
Boolean(dragging) &&
|
432
431
|
Boolean(isHiddenVisibility),
|
433
|
-
|
432
|
+
"react-draggable-dragging": Boolean(dragging),
|
434
433
|
// dropping: Boolean(droppingPosition),
|
435
434
|
cssTransforms: useCSSTransforms,
|
436
435
|
}),
|
@@ -444,25 +443,25 @@ var GroupItem = function (_a) {
|
|
444
443
|
}
|
445
444
|
// 일시적으로 pointer-events 비활성화
|
446
445
|
if (elementRef.current) {
|
447
|
-
elementRef.current.style.pointerEvents =
|
446
|
+
elementRef.current.style.pointerEvents = "none";
|
448
447
|
}
|
449
448
|
// 현재 마우스 위치에서 실제 요소 찾기
|
450
449
|
var underlyingElement = document.elementFromPoint(e.clientX, e.clientY);
|
451
450
|
// pointer-events 복구
|
452
451
|
if (elementRef.current) {
|
453
|
-
elementRef.current.style.pointerEvents =
|
452
|
+
elementRef.current.style.pointerEvents = "auto";
|
454
453
|
}
|
455
|
-
document.querySelectorAll(
|
456
|
-
el.classList.remove(
|
454
|
+
document.querySelectorAll(".cb-layout-box.hovered").forEach(function (el) {
|
455
|
+
el.classList.remove("hovered");
|
457
456
|
});
|
458
457
|
if (underlyingElement &&
|
459
|
-
underlyingElement.classList.contains(
|
460
|
-
underlyingElement.classList.add(
|
458
|
+
underlyingElement.classList.contains("cb-layout-box")) {
|
459
|
+
underlyingElement.classList.add("hovered");
|
461
460
|
}
|
462
461
|
},
|
463
462
|
onMouseLeave: function () {
|
464
|
-
document.querySelectorAll(
|
465
|
-
el.classList.remove(
|
463
|
+
document.querySelectorAll(".cb-layout-box.hovered").forEach(function (el) {
|
464
|
+
el.classList.remove("hovered");
|
466
465
|
});
|
467
466
|
},
|
468
467
|
});
|
@@ -126,8 +126,11 @@ var Resizable = function (_a) {
|
|
126
126
|
return;
|
127
127
|
}
|
128
128
|
var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
|
129
|
-
|
129
|
+
// const oneComposition = target.querySelector(".composition-container");
|
130
130
|
var isContentsList = target.id === "contentslist-box";
|
131
|
+
var layoutBox = target.children[0];
|
132
|
+
var contentsWrapper = layoutBox.children[0];
|
133
|
+
var oneComposition = contentsWrapper.children[0];
|
131
134
|
if (!isContentsList || !oneComposition) {
|
132
135
|
return;
|
133
136
|
}
|
@@ -145,7 +148,9 @@ var Resizable = function (_a) {
|
|
145
148
|
var oneCompositionMinWidth = minCellWidth * compositionCols + 20; /* 20px padding */
|
146
149
|
// let oneCompositionMinHeight =
|
147
150
|
// minColHeight * compositionRows + 20; /* 20px padding */
|
148
|
-
|
151
|
+
// const contentsWrapper = placeholder.querySelector(
|
152
|
+
// ".cb-contentslist-wrapper"
|
153
|
+
// );
|
149
154
|
if (contentsWrapper) {
|
150
155
|
var gridWrapperInnerH = contentsWrapper.clientHeight;
|
151
156
|
var oneCompositionH = oneComposition.clientHeight;
|