publ-echo 0.0.122 → 0.0.124
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.
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
type OutsideClickHandlerProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
onOutsideClick: () => void;
|
|
5
|
+
onMouseEnter: () => void;
|
|
6
|
+
onMouseLeave: () => void;
|
|
5
7
|
};
|
|
6
8
|
declare const OutsideClickHandler: React.FC<OutsideClickHandlerProps>;
|
|
7
9
|
export default OutsideClickHandler;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from
|
|
3
|
-
import { zIndexMap } from
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { zIndexMap } from "../GridLayoutEditor/group";
|
|
4
4
|
var OutsideClickHandler = function (_a) {
|
|
5
|
-
var children = _a.children, onOutsideClick = _a.onOutsideClick;
|
|
5
|
+
var children = _a.children, onOutsideClick = _a.onOutsideClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave;
|
|
6
6
|
var wrapperRef = useRef(null);
|
|
7
7
|
var _b = useState({
|
|
8
|
-
transform:
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
8
|
+
transform: "",
|
|
9
|
+
width: "0",
|
|
10
|
+
height: "0",
|
|
11
11
|
}), childDimensions = _b[0], setChildDimensions = _b[1];
|
|
12
12
|
var _c = useState(0), zIndex = _c[0], setZIndex = _c[1];
|
|
13
13
|
useEffect(function () {
|
|
14
14
|
var handleClickOutside = function (e) {
|
|
15
15
|
var target = e.target;
|
|
16
|
-
if (target.closest(
|
|
17
|
-
target.closest(
|
|
18
|
-
target.closest(
|
|
19
|
-
target.closest(
|
|
16
|
+
if (target.closest(".editable-grid-item") ||
|
|
17
|
+
target.closest(".group") ||
|
|
18
|
+
target.closest(".placeholder") ||
|
|
19
|
+
target.closest(".react-group-block")) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
if (wrapperRef.current &&
|
|
@@ -24,14 +24,14 @@ var OutsideClickHandler = function (_a) {
|
|
|
24
24
|
onOutsideClick();
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
var selectedSection = document.querySelector(
|
|
27
|
+
var selectedSection = document.querySelector(".editor-canvas");
|
|
28
28
|
// const selectedSection = document;
|
|
29
29
|
if (selectedSection) {
|
|
30
|
-
selectedSection.addEventListener(
|
|
30
|
+
selectedSection.addEventListener("dblclick", handleClickOutside);
|
|
31
31
|
}
|
|
32
32
|
return function () {
|
|
33
33
|
if (selectedSection) {
|
|
34
|
-
selectedSection.removeEventListener(
|
|
34
|
+
selectedSection.removeEventListener("dblclick", handleClickOutside);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}, [onOutsideClick]);
|
|
@@ -41,7 +41,7 @@ var OutsideClickHandler = function (_a) {
|
|
|
41
41
|
var childElement = wrapperRef.current.children[0];
|
|
42
42
|
// Get computed style of the child element
|
|
43
43
|
var computedStyle = window.getComputedStyle(childElement);
|
|
44
|
-
if (childElement.dataset[
|
|
44
|
+
if (childElement.dataset["groupBlockId"] !== "BULK") {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
setChildDimensions({
|
|
@@ -49,15 +49,15 @@ var OutsideClickHandler = function (_a) {
|
|
|
49
49
|
width: computedStyle.width,
|
|
50
50
|
height: computedStyle.height,
|
|
51
51
|
});
|
|
52
|
-
if (childElement.dataset[
|
|
53
|
-
setZIndex(Number(childElement.dataset[
|
|
52
|
+
if (childElement.dataset["minZ"]) {
|
|
53
|
+
setZIndex(Number(childElement.dataset["minZ"]));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return function () {
|
|
57
57
|
setChildDimensions({
|
|
58
|
-
transform:
|
|
59
|
-
width:
|
|
60
|
-
height:
|
|
58
|
+
transform: "",
|
|
59
|
+
width: "0",
|
|
60
|
+
height: "0",
|
|
61
61
|
});
|
|
62
62
|
setZIndex(0);
|
|
63
63
|
};
|
|
@@ -67,45 +67,45 @@ var OutsideClickHandler = function (_a) {
|
|
|
67
67
|
var height = parseFloat(childDimensions.height) || 0;
|
|
68
68
|
var borderThickness = 3; // 3px border thickness
|
|
69
69
|
var shadowOffset = 3; // Match the child's shadow (0 0 0 3px #027aff)
|
|
70
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: wrapperRef, className:
|
|
71
|
-
position:
|
|
70
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: wrapperRef, className: "outside-click-wrapper", onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: children }), width > 0 && height > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "border-top", style: {
|
|
71
|
+
position: "absolute",
|
|
72
72
|
transform: childDimensions.transform,
|
|
73
73
|
width: "".concat(width + shadowOffset * 2, "px"),
|
|
74
74
|
height: "".concat(borderThickness, "px"),
|
|
75
|
-
backgroundColor:
|
|
75
|
+
backgroundColor: "#027aff",
|
|
76
76
|
marginLeft: "-".concat(shadowOffset, "px"),
|
|
77
77
|
marginTop: "-".concat(shadowOffset, "px"),
|
|
78
|
-
pointerEvents:
|
|
78
|
+
pointerEvents: "none",
|
|
79
79
|
zIndex: zIndexMap.EDITING_GROUP + zIndex,
|
|
80
|
-
} }), _jsx("div", { className:
|
|
81
|
-
position:
|
|
80
|
+
} }), _jsx("div", { className: "border-right", style: {
|
|
81
|
+
position: "absolute",
|
|
82
82
|
transform: childDimensions.transform,
|
|
83
83
|
width: "".concat(borderThickness, "px"),
|
|
84
84
|
height: "".concat(height + shadowOffset * 2, "px"),
|
|
85
|
-
backgroundColor:
|
|
85
|
+
backgroundColor: "#027aff",
|
|
86
86
|
marginLeft: "".concat(width + shadowOffset - borderThickness, "px"),
|
|
87
87
|
marginTop: "-".concat(shadowOffset, "px"),
|
|
88
|
-
pointerEvents:
|
|
88
|
+
pointerEvents: "none",
|
|
89
89
|
zIndex: zIndexMap.EDITING_GROUP + zIndex,
|
|
90
|
-
} }), _jsx("div", { className:
|
|
91
|
-
position:
|
|
90
|
+
} }), _jsx("div", { className: "border-bottom", style: {
|
|
91
|
+
position: "absolute",
|
|
92
92
|
transform: childDimensions.transform,
|
|
93
93
|
width: "".concat(width + shadowOffset * 2, "px"),
|
|
94
94
|
height: "".concat(borderThickness, "px"),
|
|
95
|
-
backgroundColor:
|
|
95
|
+
backgroundColor: "#027aff",
|
|
96
96
|
marginLeft: "-".concat(shadowOffset, "px"),
|
|
97
97
|
marginTop: "".concat(height + shadowOffset - borderThickness, "px"),
|
|
98
|
-
pointerEvents:
|
|
98
|
+
pointerEvents: "none",
|
|
99
99
|
zIndex: zIndexMap.EDITING_GROUP + zIndex,
|
|
100
|
-
} }), _jsx("div", { className:
|
|
101
|
-
position:
|
|
100
|
+
} }), _jsx("div", { className: "border-left", style: {
|
|
101
|
+
position: "absolute",
|
|
102
102
|
transform: childDimensions.transform,
|
|
103
103
|
width: "".concat(borderThickness, "px"),
|
|
104
104
|
height: "".concat(height + shadowOffset * 2, "px"),
|
|
105
|
-
backgroundColor:
|
|
105
|
+
backgroundColor: "#027aff",
|
|
106
106
|
marginLeft: "-".concat(shadowOffset, "px"),
|
|
107
107
|
marginTop: "-".concat(shadowOffset, "px"),
|
|
108
|
-
pointerEvents:
|
|
108
|
+
pointerEvents: "none",
|
|
109
109
|
zIndex: zIndexMap.EDITING_GROUP + zIndex,
|
|
110
110
|
} })] }))] }));
|
|
111
111
|
};
|
|
@@ -60,6 +60,7 @@ var ReactGridLayout = function (_a) {
|
|
|
60
60
|
var _6 = useState(), droppingDOMNode = _6[0], setDroppingDOMNode = _6[1];
|
|
61
61
|
var _7 = useState(), droppingPosition = _7[0], setDroppingPosition = _7[1];
|
|
62
62
|
var _8 = useState(false), isMounted = _8[0], setIsMounted = _8[1];
|
|
63
|
+
var _9 = useState(null), hoveredGroupId = _9[0], setHoveredGroupId = _9[1];
|
|
63
64
|
var editorMode = props.isDraggable && props.isResizable ? "EDIT" : "VIEW";
|
|
64
65
|
var editableBlockIds = blockStructure
|
|
65
66
|
? findDirectChildrenCbIds(blockStructure, editingGroupBlock)
|
|
@@ -69,10 +70,10 @@ var ReactGridLayout = function (_a) {
|
|
|
69
70
|
return i.toString();
|
|
70
71
|
})
|
|
71
72
|
: [];
|
|
72
|
-
var
|
|
73
|
-
var
|
|
73
|
+
var _10 = useState([]), oldGroupChildren = _10[0], setOldGroupChildren = _10[1];
|
|
74
|
+
var _11 = useState(function () {
|
|
74
75
|
return synchronizeLayoutWithChildren(props.layout || [], children, cols, compactType, allowOverlap);
|
|
75
|
-
}), layout =
|
|
76
|
+
}), layout = _11[0], setLayout = _11[1];
|
|
76
77
|
var dragEnterCounter = useRef(0);
|
|
77
78
|
useLayoutEffect(function () {
|
|
78
79
|
setIsMounted(true);
|
|
@@ -616,6 +617,7 @@ var ReactGridLayout = function (_a) {
|
|
|
616
617
|
"outside-of-editing-group": !isInsideOfEditingGroup,
|
|
617
618
|
"show-block-data": showBlockData,
|
|
618
619
|
"is-in-group": isInGroup,
|
|
620
|
+
"is-hovered-group-child": hoveredGroupId === (parent ? parent.blockId : undefined),
|
|
619
621
|
}), z: zIndex, zOrder: l.z, zOrderInternal: parent
|
|
620
622
|
? "".concat(parent[device === "DESKTOP"
|
|
621
623
|
? "zOrderDesktopInternal"
|
|
@@ -704,6 +706,7 @@ var ReactGridLayout = function (_a) {
|
|
|
704
706
|
var isRoot = editingGroupBlock === "ROOT";
|
|
705
707
|
var isInBulk = bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(block.blockId);
|
|
706
708
|
var isBulk = block.blockId === "BULK";
|
|
709
|
+
console.log("id", block.blockId, "isBulk", isBulk, "isInBulk", isInBulk, "isEditingGroup", isEditingGroup);
|
|
707
710
|
var baseZ = (function () {
|
|
708
711
|
if (isBulk) {
|
|
709
712
|
// groupItem.z : 그룹 내 CB중 가장 큰 zorder
|
|
@@ -740,7 +743,11 @@ var ReactGridLayout = function (_a) {
|
|
|
740
743
|
var parent = blockStructure
|
|
741
744
|
? findParentGroupBlock(blockStructure, block.blockId)
|
|
742
745
|
: null;
|
|
743
|
-
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup,
|
|
746
|
+
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, onMouseEnter: function () {
|
|
747
|
+
setHoveredGroupId(block.blockId);
|
|
748
|
+
}, onMouseLeave: function () {
|
|
749
|
+
setHoveredGroupId(null);
|
|
750
|
+
}, children: _jsx(GroupItem, { heightFitContent: false, isheightVariable: device === "DESKTOP"
|
|
744
751
|
? !!block.isHeightVariableDesktop
|
|
745
752
|
: !!block.isHeightVariableMobile, className: classNames({
|
|
746
753
|
"bulk-child-item": isInBulk,
|