seat-editor 3.6.26 → 3.6.28
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/app/graph-view-new/constant.d.ts +108 -0
- package/dist/app/graph-view-new/constant.js +2 -0
- package/dist/app/graph-view-new/page.js +34 -25
- package/dist/app/graph-view-new/page.jsx +34 -25
- package/dist/features/view-only-5/connect-handle.d.ts +18 -0
- package/dist/features/view-only-5/connect-handle.js +15 -17
- package/dist/features/view-only-5/connect-handle.jsx +15 -17
- package/dist/features/view-only-5/connection-layer.d.ts +13 -0
- package/dist/features/view-only-5/connection-layer.js +72 -29
- package/dist/features/view-only-5/connection-layer.jsx +127 -51
- package/dist/features/view-only-5/index.d.ts +6 -0
- package/dist/features/view-only-5/index.js +15 -11
- package/dist/features/view-only-5/index.jsx +15 -11
- package/dist/features/view-only-5/use-connection-graph.d.ts +7 -1
- package/dist/features/view-only-5/use-connection-graph.js +91 -4
- package/dist/features/view-only-5/utils.d.ts +6 -0
- package/dist/features/view-only-5/utils.js +20 -8
- package/package.json +4 -1
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
|
-
import { buildPath, getRectEdge, GRID_SIZE, NODE_WIDTH, NODE_HEIGHT, snap, } from "./utils";
|
|
4
|
-
const LEVEL_COLORS = [
|
|
5
|
-
"#22c55e",
|
|
6
|
-
"#f59e0b",
|
|
7
|
-
"#f97316",
|
|
8
|
-
"#ef4444",
|
|
9
|
-
"#a78bfa",
|
|
10
|
-
"#38bdf8",
|
|
11
|
-
];
|
|
3
|
+
import { buildPath, getRectEdge, GRID_SIZE, NODE_WIDTH, NODE_HEIGHT, snap, rotatePoint, } from "./utils";
|
|
4
|
+
const LEVEL_COLORS = ["#7239EA", "#3E97FF"];
|
|
12
5
|
const getLevelColor = (level) => LEVEL_COLORS[Math.min(level, LEVEL_COLORS.length - 1)];
|
|
13
6
|
const floodFill = (seedIds, edges) => {
|
|
14
7
|
const levelMap = new Map();
|
|
@@ -52,9 +45,14 @@ const quadraticMidpoint = (from, to) => {
|
|
|
52
45
|
y: mt * mt * from.y + 2 * mt * t * cpy + t * t * to.y,
|
|
53
46
|
};
|
|
54
47
|
};
|
|
55
|
-
export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAnchor, mousePos, isConnectEdge, getNodeById, onSelectEdge, onDeleteEdge, onStartDragWaypoint, onInsertWaypoint, onRemoveWaypoint, onStartDragAnchor, selectedNodeId, }) => {
|
|
48
|
+
export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAnchor, mousePos, isConnectEdge, getNodeById, onSelectEdge, onDeleteEdge, onStartDragWaypoint, onInsertWaypoint, onRemoveWaypoint, onStartDragAnchor, selectedNodeId, showConnection, renderedElements, groupSelection, connectionMatchKey, }) => {
|
|
56
49
|
const [hoveredEdge, setHoveredEdge] = useState(null);
|
|
57
|
-
|
|
50
|
+
const tableMatchConnectionKey = useMemo(() => renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.filter((el) => {
|
|
51
|
+
if (connectionMatchKey) {
|
|
52
|
+
return (el === null || el === void 0 ? void 0 : el[connectionMatchKey === null || connectionMatchKey === void 0 ? void 0 : connectionMatchKey.key]) === (connectionMatchKey === null || connectionMatchKey === void 0 ? void 0 : connectionMatchKey.value);
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}), [renderedElements, connectionMatchKey]);
|
|
58
56
|
const nodeHighlightMap = useMemo(() => {
|
|
59
57
|
if (!selectedEdge)
|
|
60
58
|
return new Map();
|
|
@@ -105,6 +103,9 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
105
103
|
});
|
|
106
104
|
return map;
|
|
107
105
|
}, [edges, getNodeById, draggingAnchor, mousePos]);
|
|
106
|
+
if (!showConnection) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
108
109
|
return (_jsxs("g", { id: "connection-layer", children: [Array.from(nodeHighlightMap.entries()).map(([nodeId, level]) => {
|
|
109
110
|
var _a, _b, _c;
|
|
110
111
|
const node = getNodeById(nodeId);
|
|
@@ -115,7 +116,11 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
115
116
|
const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
|
|
116
117
|
const color = getLevelColor(level);
|
|
117
118
|
const padding = 4;
|
|
118
|
-
|
|
119
|
+
if (level > 0)
|
|
120
|
+
return null;
|
|
121
|
+
return (_jsxs("g", { transform: `translate(${node.x}, ${node.y}) rotate(${rotation})`, style: { pointerEvents: "none" }, children: [_jsx("rect", { x: -w / 2 - padding, y: -h / 2 - padding, width: w + padding * 2, height: h + padding * 2, fill: "none", stroke: color, strokeWidth: 8, rx: 5, opacity: 0.08 }), _jsx("rect", { x: -w / 2 - padding, y: -h / 2 - padding, width: w + padding * 2, height: h + padding * 2, fill: "none", stroke: color, strokeWidth: level === 0 ? 2.5 : 1.5,
|
|
122
|
+
// strokeDasharray={level === 0 ? "none" : "5 3"}
|
|
123
|
+
rx: 5, opacity: level === 0 ? 1 : 0.75 }), _jsx("g", { transform: `translate(${w / 2 + padding - 2}, ${-h / 2 - padding})` })] }, `highlight-${nodeId}`));
|
|
119
124
|
}), Array.from(nodeHighlightMapByNode.entries()).map(([nodeId, level]) => {
|
|
120
125
|
var _a, _b, _c;
|
|
121
126
|
const node = getNodeById(nodeId);
|
|
@@ -126,7 +131,12 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
126
131
|
const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
|
|
127
132
|
const color = getLevelColor(level);
|
|
128
133
|
const padding = 4;
|
|
129
|
-
|
|
134
|
+
// console.log("nodeHighlightMapByNode", nodeId, level, color);
|
|
135
|
+
if (level > 1)
|
|
136
|
+
return null;
|
|
137
|
+
return (_jsxs("g", { transform: `translate(${node.x}, ${node.y}) rotate(${rotation})`, style: { pointerEvents: "none" }, children: [_jsx("rect", { x: -w / 2 - padding, y: -h / 2 - padding, width: w + padding * 2, height: h + padding * 2, fill: "none", stroke: color, strokeWidth: 8, rx: 5, opacity: 0.08 }), _jsx("rect", { x: -w / 2 - padding, y: -h / 2 - padding, width: w + padding * 2, height: h + padding * 2, fill: "none", stroke: color, strokeWidth: level === 0 ? 2.5 : 1.5,
|
|
138
|
+
// strokeDasharray={level === 0 ? "none" : "5 3"}
|
|
139
|
+
rx: 5, opacity: level === 0 ? 1 : 0.75 }), _jsx("g", { transform: `translate(${w / 2 + padding - 2}, ${-h / 2 - padding})` })] }, `highlight-${nodeId}`));
|
|
130
140
|
}), edges.map((edge) => {
|
|
131
141
|
var _a;
|
|
132
142
|
const ep = edgePaths.get(edge.id);
|
|
@@ -135,30 +145,29 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
135
145
|
const { pathD, allPoints, fromPos, toPos, midX, midY } = ep;
|
|
136
146
|
const isSel = selectedEdge === edge.id;
|
|
137
147
|
const isHov = hoveredEdge === edge.id;
|
|
148
|
+
const connectionMatch = tableMatchConnectionKey === null || tableMatchConnectionKey === void 0 ? void 0 : tableMatchConnectionKey.some((el) => el.id === edge.to || el.id === edge.from);
|
|
138
149
|
const fromLevel = nodeHighlightMap.get(edge.from);
|
|
139
150
|
const toLevel = nodeHighlightMap.get(edge.to);
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
? getLevelColor(Math.max(fromLevel, toLevel))
|
|
143
|
-
: "#38bdf8";
|
|
151
|
+
const isRing1 = (selectedNodeId && selectedNodeId === edge.from) ||
|
|
152
|
+
selectedNodeId === edge.to;
|
|
144
153
|
const isDraggingFrom = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "from";
|
|
145
154
|
const isDraggingTo = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "to";
|
|
146
|
-
// const currentConnection =
|
|
147
|
-
const isNotRing1 = connecting && ((connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.from && (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.to);
|
|
148
155
|
return (_jsxs("g", { children: [_jsx("path", { d: pathD, stroke: "transparent", strokeWidth: 14, fill: "none", style: { cursor: "pointer" }, onClick: (e) => {
|
|
149
156
|
e.stopPropagation();
|
|
150
157
|
onSelectEdge(edge.id);
|
|
151
|
-
}, onMouseEnter: () => setHoveredEdge(edge.id), onMouseLeave: () => setHoveredEdge(null) }), (isSel || isHov) && (_jsx("path", { d: pathD, stroke: isSel ? "#a78bfa" : "#38bdf8", strokeWidth: 8, fill: "none", opacity: isSel ? 0.12 : 0.06, style: { pointerEvents: "none" } })), _jsx("path", { d: pathD, stroke: isSel
|
|
152
|
-
? "#a78bfa"
|
|
153
|
-
: isInNetwork && selectedEdge
|
|
154
|
-
? networkColor
|
|
155
|
-
: "#38bdf8", strokeWidth: isSel ? 2 : isHov ? 2 : 1.5, fill: "none", opacity: (selectedEdge && !isSel && !isInNetwork) || isNotRing1 ? 0.2 : 0.9, strokeLinecap: "round", style: { pointerEvents: "none" } }), isSel && (_jsxs("g", { children: [isDraggingFrom && (_jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 12, fill: "#38bdf8", opacity: 0.15, style: { pointerEvents: "none" } })), _jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 10, fill: "transparent", style: { cursor: "grab" }, onMouseDown: (e) => {
|
|
158
|
+
}, onMouseEnter: () => setHoveredEdge(edge.id), onMouseLeave: () => setHoveredEdge(null) }), (isSel || isHov) && (_jsx("path", { d: pathD, stroke: isSel ? "#a78bfa" : "#38bdf8", strokeWidth: 8, fill: "none", opacity: isSel ? 0.12 : 0.06, style: { pointerEvents: "none" } })), _jsx("path", { d: pathD, stroke: connectionMatch ? "#F1416C" : "#7239EA", strokeWidth: isSel ? 2 : isHov ? 2 : 1.5, fill: "none", opacity: isRing1 && selectedNodeId ? 1 : 0.3, strokeLinecap: "round", style: { pointerEvents: "none" } }), _jsxs("g", { children: [isDraggingFrom && (_jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 12, fill: "#7239EA", opacity: 0.15, style: { pointerEvents: "none" } })), _jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 10, fill: "transparent", style: { cursor: "grab" }, onMouseDown: (e) => {
|
|
156
159
|
e.stopPropagation();
|
|
157
160
|
onStartDragAnchor(e, edge.id, "from");
|
|
158
|
-
} }), _jsx("circle", { cx: fromPos.x, cy: fromPos.y, r:
|
|
161
|
+
} }), _jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 3, fill: connectionMatch ? "#F1416C" : "#7239EA",
|
|
162
|
+
// stroke="#0f172a"
|
|
163
|
+
// strokeWidth={1.5}
|
|
164
|
+
style: { pointerEvents: "none" } })] }), _jsxs("g", { children: [isDraggingTo && (_jsx("circle", { cx: toPos.x, cy: toPos.y, r: 12, fill: "#7239EA", opacity: 0.15, style: { pointerEvents: "none" } })), _jsx("circle", { cx: toPos.x, cy: toPos.y, r: 10, fill: "transparent", style: { cursor: "grab" }, onMouseDown: (e) => {
|
|
159
165
|
e.stopPropagation();
|
|
160
166
|
onStartDragAnchor(e, edge.id, "to");
|
|
161
|
-
} }), _jsx("circle", { cx: toPos.x, cy: toPos.y, r:
|
|
167
|
+
} }), _jsx("circle", { cx: toPos.x, cy: toPos.y, r: 3, fill: connectionMatch ? "#F1416C" : "#7239EA",
|
|
168
|
+
// stroke="#0f172a"
|
|
169
|
+
// strokeWidth={1.5}
|
|
170
|
+
style: { pointerEvents: "none" } })] }), ((_a = edge.waypoints) !== null && _a !== void 0 ? _a : []).map((wp, i) => (_jsxs("g", { children: [_jsx("circle", { cx: wp.x, cy: wp.y, r: 12, fill: "transparent", style: { cursor: "grab" }, onMouseDown: (e) => onStartDragWaypoint(e, edge.id, i), onContextMenu: (e) => onRemoveWaypoint(e, edge.id, i) }), _jsx("circle", { cx: wp.x, cy: wp.y, r: isSel ? 8 : 5, fill: isSel ? "#1e1b2e" : "#0f172a", stroke: isSel ? "#a78bfa" : "#38bdf8", strokeWidth: isSel ? 2 : 1.2, style: { pointerEvents: "none" } }), _jsx("circle", { cx: wp.x, cy: wp.y, r: isSel ? 3 : 2, fill: isSel ? "#a78bfa" : "#38bdf8", style: { pointerEvents: "none" } })] }, `wp-${i}`))), isSel &&
|
|
162
171
|
isConnectEdge &&
|
|
163
172
|
allPoints.slice(0, -1).map((pt, i) => {
|
|
164
173
|
var _a;
|
|
@@ -176,9 +185,43 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
176
185
|
}, style: { cursor: "pointer" }, children: [_jsx("rect", { x: midX - 16, y: midY - 10, width: 32, height: 18, rx: 4, fill: "#1e1b2e", stroke: "#a78bfa", strokeWidth: 1, opacity: 0.95 }), _jsx("text", { x: midX, y: midY, textAnchor: "middle", dominantBaseline: "middle", fill: "#a78bfa", fontSize: 9, fontFamily: "monospace", fontWeight: 600, children: "DEL" })] }))] }, edge.id));
|
|
177
186
|
}), connecting &&
|
|
178
187
|
(() => {
|
|
179
|
-
var _a
|
|
180
|
-
|
|
188
|
+
const findSourceTarget = renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.find((el) => { var _a; return ((_a = el === null || el === void 0 ? void 0 : el[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _a !== void 0 ? _a : el.id) === connecting.fromId; });
|
|
189
|
+
if (!findSourceTarget)
|
|
190
|
+
return null;
|
|
191
|
+
const { x, y, rotation, width, height } = findSourceTarget;
|
|
192
|
+
const rotated = rotatePoint(width / 2, height / 2, rotation !== null && rotation !== void 0 ? rotation : 0);
|
|
193
|
+
const w = width !== null && width !== void 0 ? width : NODE_WIDTH;
|
|
194
|
+
const h = height !== null && height !== void 0 ? height : NODE_HEIGHT;
|
|
195
|
+
const cx = x + rotated.x;
|
|
196
|
+
const cy = y + rotated.y;
|
|
197
|
+
// 3. Tentukan koordinat local space berdasarkan name/side
|
|
198
|
+
let lx = 0;
|
|
199
|
+
let ly = 0;
|
|
200
|
+
const hw = w / 2;
|
|
201
|
+
const hh = h / 2;
|
|
202
|
+
if (connecting.fromPos.name === "top") {
|
|
203
|
+
lx = 0;
|
|
204
|
+
ly = -hh;
|
|
205
|
+
}
|
|
206
|
+
else if (connecting.fromPos.name === "right") {
|
|
207
|
+
lx = hw;
|
|
208
|
+
ly = 0;
|
|
209
|
+
}
|
|
210
|
+
else if (connecting.fromPos.name === "bottom") {
|
|
211
|
+
lx = 0;
|
|
212
|
+
ly = hh;
|
|
213
|
+
}
|
|
214
|
+
else if (connecting.fromPos.name === "left") {
|
|
215
|
+
lx = -hw;
|
|
216
|
+
ly = 0;
|
|
217
|
+
}
|
|
218
|
+
const rad = (rotation * Math.PI) / 180;
|
|
219
|
+
const fromPos = {
|
|
220
|
+
x: cx + lx * Math.cos(rad) - ly * Math.sin(rad),
|
|
221
|
+
y: cy + lx * Math.sin(rad) + ly * Math.cos(rad),
|
|
222
|
+
};
|
|
223
|
+
const pts = computePoints(fromPos, mousePos, []);
|
|
181
224
|
const pathD = buildPath(pts);
|
|
182
|
-
return (_jsxs("g", { children: [_jsx("circle", { cx:
|
|
225
|
+
return (_jsxs("g", { children: [_jsx("circle", { cx: fromPos === null || fromPos === void 0 ? void 0 : fromPos.x, cy: fromPos === null || fromPos === void 0 ? void 0 : fromPos.y, r: 4, fill: "#a78bfa", stroke: "#0f172a", strokeWidth: 0.8, opacity: 0.9, style: { pointerEvents: "none" } }), _jsx("path", { d: pathD, stroke: "#a78bfa", strokeWidth: 1.5, fill: "none", strokeDasharray: "6 3", strokeLinecap: "round", opacity: 0.8, style: { pointerEvents: "none" } })] }));
|
|
183
226
|
})(), draggingAnchor && (_jsx("text", { x: mousePos.x + 14, y: mousePos.y - 8, fill: "#a78bfa", fontSize: 9, fontFamily: "monospace", opacity: 0.8, style: { pointerEvents: "none", userSelect: "none" }, children: "klik node tujuan" }))] }));
|
|
184
227
|
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useState } from "react";
|
|
2
|
-
import { buildPath, getRectEdge, GRID_SIZE, NODE_WIDTH, NODE_HEIGHT, snap, } from "./utils";
|
|
3
|
-
const LEVEL_COLORS = [
|
|
4
|
-
"#22c55e",
|
|
5
|
-
"#f59e0b",
|
|
6
|
-
"#f97316",
|
|
7
|
-
"#ef4444",
|
|
8
|
-
"#a78bfa",
|
|
9
|
-
"#38bdf8",
|
|
10
|
-
];
|
|
2
|
+
import { buildPath, getRectEdge, GRID_SIZE, NODE_WIDTH, NODE_HEIGHT, snap, rotatePoint, } from "./utils";
|
|
3
|
+
const LEVEL_COLORS = ["#7239EA", "#3E97FF"];
|
|
11
4
|
const getLevelColor = (level) => LEVEL_COLORS[Math.min(level, LEVEL_COLORS.length - 1)];
|
|
12
5
|
const floodFill = (seedIds, edges) => {
|
|
13
6
|
const levelMap = new Map();
|
|
@@ -51,9 +44,14 @@ const quadraticMidpoint = (from, to) => {
|
|
|
51
44
|
y: mt * mt * from.y + 2 * mt * t * cpy + t * t * to.y,
|
|
52
45
|
};
|
|
53
46
|
};
|
|
54
|
-
export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAnchor, mousePos, isConnectEdge, getNodeById, onSelectEdge, onDeleteEdge, onStartDragWaypoint, onInsertWaypoint, onRemoveWaypoint, onStartDragAnchor, selectedNodeId, }) => {
|
|
47
|
+
export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAnchor, mousePos, isConnectEdge, getNodeById, onSelectEdge, onDeleteEdge, onStartDragWaypoint, onInsertWaypoint, onRemoveWaypoint, onStartDragAnchor, selectedNodeId, showConnection, renderedElements, groupSelection, connectionMatchKey, }) => {
|
|
55
48
|
const [hoveredEdge, setHoveredEdge] = useState(null);
|
|
56
|
-
|
|
49
|
+
const tableMatchConnectionKey = useMemo(() => renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.filter((el) => {
|
|
50
|
+
if (connectionMatchKey) {
|
|
51
|
+
return (el === null || el === void 0 ? void 0 : el[connectionMatchKey === null || connectionMatchKey === void 0 ? void 0 : connectionMatchKey.key]) === (connectionMatchKey === null || connectionMatchKey === void 0 ? void 0 : connectionMatchKey.value);
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}), [renderedElements, connectionMatchKey]);
|
|
57
55
|
const nodeHighlightMap = useMemo(() => {
|
|
58
56
|
if (!selectedEdge)
|
|
59
57
|
return new Map();
|
|
@@ -104,6 +102,9 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
104
102
|
});
|
|
105
103
|
return map;
|
|
106
104
|
}, [edges, getNodeById, draggingAnchor, mousePos]);
|
|
105
|
+
if (!showConnection) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
107
108
|
return (<g id="connection-layer">
|
|
108
109
|
{/* Node highlight flood fill */}
|
|
109
110
|
{Array.from(nodeHighlightMap.entries()).map(([nodeId, level]) => {
|
|
@@ -116,14 +117,26 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
116
117
|
const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
|
|
117
118
|
const color = getLevelColor(level);
|
|
118
119
|
const padding = 4;
|
|
120
|
+
if (level > 0)
|
|
121
|
+
return null;
|
|
119
122
|
return (<g key={`highlight-${nodeId}`} transform={`translate(${node.x}, ${node.y}) rotate(${rotation})`} style={{ pointerEvents: "none" }}>
|
|
120
123
|
<rect x={-w / 2 - padding} y={-h / 2 - padding} width={w + padding * 2} height={h + padding * 2} fill="none" stroke={color} strokeWidth={8} rx={5} opacity={0.08}/>
|
|
121
|
-
<rect x={-w / 2 - padding} y={-h / 2 - padding} width={w + padding * 2} height={h + padding * 2} fill="none" stroke={color} strokeWidth={level === 0 ? 2.5 : 1.5}
|
|
124
|
+
<rect x={-w / 2 - padding} y={-h / 2 - padding} width={w + padding * 2} height={h + padding * 2} fill="none" stroke={color} strokeWidth={level === 0 ? 2.5 : 1.5}
|
|
125
|
+
// strokeDasharray={level === 0 ? "none" : "5 3"}
|
|
126
|
+
rx={5} opacity={level === 0 ? 1 : 0.75}/>
|
|
122
127
|
<g transform={`translate(${w / 2 + padding - 2}, ${-h / 2 - padding})`}>
|
|
123
|
-
<circle r={7} fill={color} opacity={0.9}/>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
{/* <circle r={7} fill={color} opacity={0.9} />
|
|
129
|
+
<text
|
|
130
|
+
textAnchor="middle"
|
|
131
|
+
dominantBaseline="middle"
|
|
132
|
+
fill="white"
|
|
133
|
+
fontSize={7}
|
|
134
|
+
fontFamily="monospace"
|
|
135
|
+
fontWeight={700}
|
|
136
|
+
style={{ userSelect: "none" }}
|
|
137
|
+
>
|
|
138
|
+
{level}
|
|
139
|
+
</text> */}
|
|
127
140
|
</g>
|
|
128
141
|
</g>);
|
|
129
142
|
})}
|
|
@@ -138,14 +151,27 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
138
151
|
const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
|
|
139
152
|
const color = getLevelColor(level);
|
|
140
153
|
const padding = 4;
|
|
154
|
+
// console.log("nodeHighlightMapByNode", nodeId, level, color);
|
|
155
|
+
if (level > 1)
|
|
156
|
+
return null;
|
|
141
157
|
return (<g key={`highlight-${nodeId}`} transform={`translate(${node.x}, ${node.y}) rotate(${rotation})`} style={{ pointerEvents: "none" }}>
|
|
142
158
|
<rect x={-w / 2 - padding} y={-h / 2 - padding} width={w + padding * 2} height={h + padding * 2} fill="none" stroke={color} strokeWidth={8} rx={5} opacity={0.08}/>
|
|
143
|
-
<rect x={-w / 2 - padding} y={-h / 2 - padding} width={w + padding * 2} height={h + padding * 2} fill="none" stroke={color} strokeWidth={level === 0 ? 2.5 : 1.5}
|
|
159
|
+
<rect x={-w / 2 - padding} y={-h / 2 - padding} width={w + padding * 2} height={h + padding * 2} fill="none" stroke={color} strokeWidth={level === 0 ? 2.5 : 1.5}
|
|
160
|
+
// strokeDasharray={level === 0 ? "none" : "5 3"}
|
|
161
|
+
rx={5} opacity={level === 0 ? 1 : 0.75}/>
|
|
144
162
|
<g transform={`translate(${w / 2 + padding - 2}, ${-h / 2 - padding})`}>
|
|
145
|
-
<circle r={7} fill={color} opacity={0.9}/>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
{/* <circle r={7} fill={color} opacity={0.9} />
|
|
164
|
+
<text
|
|
165
|
+
textAnchor="middle"
|
|
166
|
+
dominantBaseline="middle"
|
|
167
|
+
fill="white"
|
|
168
|
+
fontSize={7}
|
|
169
|
+
fontFamily="monospace"
|
|
170
|
+
fontWeight={700}
|
|
171
|
+
style={{ userSelect: "none" }}
|
|
172
|
+
>
|
|
173
|
+
{level}
|
|
174
|
+
</text> */}
|
|
149
175
|
</g>
|
|
150
176
|
</g>);
|
|
151
177
|
})}
|
|
@@ -159,16 +185,13 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
159
185
|
const { pathD, allPoints, fromPos, toPos, midX, midY } = ep;
|
|
160
186
|
const isSel = selectedEdge === edge.id;
|
|
161
187
|
const isHov = hoveredEdge === edge.id;
|
|
188
|
+
const connectionMatch = tableMatchConnectionKey === null || tableMatchConnectionKey === void 0 ? void 0 : tableMatchConnectionKey.some((el) => el.id === edge.to || el.id === edge.from);
|
|
162
189
|
const fromLevel = nodeHighlightMap.get(edge.from);
|
|
163
190
|
const toLevel = nodeHighlightMap.get(edge.to);
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
? getLevelColor(Math.max(fromLevel, toLevel))
|
|
167
|
-
: "#38bdf8";
|
|
191
|
+
const isRing1 = (selectedNodeId && selectedNodeId === edge.from) ||
|
|
192
|
+
selectedNodeId === edge.to;
|
|
168
193
|
const isDraggingFrom = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "from";
|
|
169
194
|
const isDraggingTo = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "to";
|
|
170
|
-
// const currentConnection =
|
|
171
|
-
const isNotRing1 = connecting && ((connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.from && (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.to);
|
|
172
195
|
return (<g key={edge.id}>
|
|
173
196
|
{/* Hit area */}
|
|
174
197
|
<path d={pathD} stroke="transparent" strokeWidth={14} fill="none" style={{ cursor: "pointer" }} onClick={(e) => {
|
|
@@ -180,33 +203,52 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
180
203
|
{(isSel || isHov) && (<path d={pathD} stroke={isSel ? "#a78bfa" : "#38bdf8"} strokeWidth={8} fill="none" opacity={isSel ? 0.12 : 0.06} style={{ pointerEvents: "none" }}/>)}
|
|
181
204
|
|
|
182
205
|
{/* Curve */}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
: isInNetwork && selectedEdge
|
|
186
|
-
? networkColor
|
|
187
|
-
: "#38bdf8"} strokeWidth={isSel ? 2 : isHov ? 2 : 1.5} fill="none" opacity={(selectedEdge && !isSel && !isInNetwork) || isNotRing1 ? 0.2 : 0.9} strokeLinecap="round" style={{ pointerEvents: "none" }}/>
|
|
206
|
+
|
|
207
|
+
<path d={pathD} stroke={connectionMatch ? "#F1416C" : "#7239EA"} strokeWidth={isSel ? 2 : isHov ? 2 : 1.5} fill={"none"} opacity={isRing1 && selectedNodeId ? 1 : 0.3} strokeLinecap="round" style={{ pointerEvents: "none" }}/>
|
|
188
208
|
|
|
189
209
|
{/* FROM dot */}
|
|
190
|
-
{isSel && (
|
|
191
|
-
|
|
210
|
+
{/* {isSel && ( */}
|
|
211
|
+
<g>
|
|
212
|
+
{isDraggingFrom && (<circle cx={fromPos.x} cy={fromPos.y} r={12} fill="#7239EA" opacity={0.15} style={{ pointerEvents: "none" }}/>)}
|
|
192
213
|
<circle cx={fromPos.x} cy={fromPos.y} r={10} fill="transparent" style={{ cursor: "grab" }} onMouseDown={(e) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<circle cx={fromPos.x} cy={fromPos.y} r={
|
|
197
|
-
|
|
198
|
-
|
|
214
|
+
e.stopPropagation();
|
|
215
|
+
onStartDragAnchor(e, edge.id, "from");
|
|
216
|
+
}}/>
|
|
217
|
+
<circle cx={fromPos.x} cy={fromPos.y} r={3} fill={connectionMatch ? "#F1416C" : "#7239EA"}
|
|
218
|
+
// stroke="#0f172a"
|
|
219
|
+
// strokeWidth={1.5}
|
|
220
|
+
style={{ pointerEvents: "none" }}/>
|
|
221
|
+
{/* <circle
|
|
222
|
+
cx={fromPos.x}
|
|
223
|
+
cy={fromPos.y}
|
|
224
|
+
r={2.5}
|
|
225
|
+
fill="#0f172a"
|
|
226
|
+
style={{ pointerEvents: "none" }}
|
|
227
|
+
/> */}
|
|
228
|
+
</g>
|
|
229
|
+
{/* )} */}
|
|
199
230
|
|
|
200
231
|
{/* TO dot */}
|
|
201
|
-
{isSel && (
|
|
202
|
-
|
|
232
|
+
{/* {isSel && ( */}
|
|
233
|
+
<g>
|
|
234
|
+
{isDraggingTo && (<circle cx={toPos.x} cy={toPos.y} r={12} fill="#7239EA" opacity={0.15} style={{ pointerEvents: "none" }}/>)}
|
|
203
235
|
<circle cx={toPos.x} cy={toPos.y} r={10} fill="transparent" style={{ cursor: "grab" }} onMouseDown={(e) => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<circle cx={toPos.x} cy={toPos.y} r={
|
|
208
|
-
|
|
209
|
-
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
onStartDragAnchor(e, edge.id, "to");
|
|
238
|
+
}}/>
|
|
239
|
+
<circle cx={toPos.x} cy={toPos.y} r={3} fill={connectionMatch ? "#F1416C" : "#7239EA"}
|
|
240
|
+
// stroke="#0f172a"
|
|
241
|
+
// strokeWidth={1.5}
|
|
242
|
+
style={{ pointerEvents: "none" }}/>
|
|
243
|
+
{/* <circle
|
|
244
|
+
cx={toPos.x}
|
|
245
|
+
cy={toPos.y}
|
|
246
|
+
r={2.5}
|
|
247
|
+
fill="#0f172a"
|
|
248
|
+
style={{ pointerEvents: "none" }}
|
|
249
|
+
/> */}
|
|
250
|
+
</g>
|
|
251
|
+
{/* )} */}
|
|
210
252
|
|
|
211
253
|
{/* Waypoints */}
|
|
212
254
|
{((_a = edge.waypoints) !== null && _a !== void 0 ? _a : []).map((wp, i) => (<g key={`wp-${i}`}>
|
|
@@ -250,11 +292,45 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
250
292
|
{/* Preview saat connecting */}
|
|
251
293
|
{connecting &&
|
|
252
294
|
(() => {
|
|
253
|
-
var _a
|
|
254
|
-
|
|
295
|
+
const findSourceTarget = renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.find((el) => { var _a; return ((_a = el === null || el === void 0 ? void 0 : el[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _a !== void 0 ? _a : el.id) === connecting.fromId; });
|
|
296
|
+
if (!findSourceTarget)
|
|
297
|
+
return null;
|
|
298
|
+
const { x, y, rotation, width, height } = findSourceTarget;
|
|
299
|
+
const rotated = rotatePoint(width / 2, height / 2, rotation !== null && rotation !== void 0 ? rotation : 0);
|
|
300
|
+
const w = width !== null && width !== void 0 ? width : NODE_WIDTH;
|
|
301
|
+
const h = height !== null && height !== void 0 ? height : NODE_HEIGHT;
|
|
302
|
+
const cx = x + rotated.x;
|
|
303
|
+
const cy = y + rotated.y;
|
|
304
|
+
// 3. Tentukan koordinat local space berdasarkan name/side
|
|
305
|
+
let lx = 0;
|
|
306
|
+
let ly = 0;
|
|
307
|
+
const hw = w / 2;
|
|
308
|
+
const hh = h / 2;
|
|
309
|
+
if (connecting.fromPos.name === "top") {
|
|
310
|
+
lx = 0;
|
|
311
|
+
ly = -hh;
|
|
312
|
+
}
|
|
313
|
+
else if (connecting.fromPos.name === "right") {
|
|
314
|
+
lx = hw;
|
|
315
|
+
ly = 0;
|
|
316
|
+
}
|
|
317
|
+
else if (connecting.fromPos.name === "bottom") {
|
|
318
|
+
lx = 0;
|
|
319
|
+
ly = hh;
|
|
320
|
+
}
|
|
321
|
+
else if (connecting.fromPos.name === "left") {
|
|
322
|
+
lx = -hw;
|
|
323
|
+
ly = 0;
|
|
324
|
+
}
|
|
325
|
+
const rad = (rotation * Math.PI) / 180;
|
|
326
|
+
const fromPos = {
|
|
327
|
+
x: cx + lx * Math.cos(rad) - ly * Math.sin(rad),
|
|
328
|
+
y: cy + lx * Math.sin(rad) + ly * Math.cos(rad),
|
|
329
|
+
};
|
|
330
|
+
const pts = computePoints(fromPos, mousePos, []);
|
|
255
331
|
const pathD = buildPath(pts);
|
|
256
332
|
return (<g>
|
|
257
|
-
<circle cx={
|
|
333
|
+
<circle cx={fromPos === null || fromPos === void 0 ? void 0 : fromPos.x} cy={fromPos === null || fromPos === void 0 ? void 0 : fromPos.y} r={4} fill="#a78bfa" stroke="#0f172a" strokeWidth={0.8} opacity={0.9} style={{ pointerEvents: "none" }}/>
|
|
258
334
|
<path d={pathD} stroke="#a78bfa" strokeWidth={1.5} fill="none" strokeDasharray="6 3" strokeLinecap="round" opacity={0.8} style={{ pointerEvents: "none" }}/>
|
|
259
335
|
</g>);
|
|
260
336
|
})()}
|
|
@@ -114,6 +114,12 @@ export interface LayerViewProps<TMeta = undefined> {
|
|
|
114
114
|
selection: Record<number, string[]>;
|
|
115
115
|
};
|
|
116
116
|
onHoldTable?: (e: React.PointerEvent<SVGSVGElement>, component: ComponentProps<TMeta>[]) => void;
|
|
117
|
+
showConnection?: boolean;
|
|
118
|
+
initialEdges?: EdgeType[];
|
|
119
|
+
connectionMatchKey?: {
|
|
120
|
+
key: string;
|
|
121
|
+
value: string | number;
|
|
122
|
+
};
|
|
117
123
|
}
|
|
118
124
|
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
119
125
|
export default LayerView;
|
|
@@ -29,7 +29,7 @@ const LayerView = (props) => {
|
|
|
29
29
|
selectNode: false,
|
|
30
30
|
connectingNode: false,
|
|
31
31
|
dragTransferTable: false,
|
|
32
|
-
}, onMakeSelection, groupSelection, onHoldTable } = props;
|
|
32
|
+
}, onMakeSelection, groupSelection, onHoldTable, showConnection, connectionMatchKey } = props;
|
|
33
33
|
const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
|
|
34
34
|
const tableGhost = useRef(null);
|
|
35
35
|
const hoverUnderghostId = useRef(null);
|
|
@@ -288,7 +288,7 @@ const LayerView = (props) => {
|
|
|
288
288
|
const downInOutSelection = hadSelection && makeSelection && e.button !== 2;
|
|
289
289
|
const unSelectAll = hadSelection && e.button === 2 && targetGroup && !targetSelectionGroup;
|
|
290
290
|
const hasSelectionDownOutSelection = !targetSelectionGroup && targetGroup && hadSelection;
|
|
291
|
-
if (downOutTable) {
|
|
291
|
+
if (downOutTable || (!targetGroup && !targetSelectionGroup)) {
|
|
292
292
|
if (graph.connecting) {
|
|
293
293
|
graph.cancelConnect();
|
|
294
294
|
}
|
|
@@ -618,11 +618,12 @@ const LayerView = (props) => {
|
|
|
618
618
|
};
|
|
619
619
|
// ─── Node helper ──────────────────────────────────────────────────────────
|
|
620
620
|
const getNodeById = useCallback((id) => {
|
|
621
|
-
var _a, _b, _c;
|
|
621
|
+
var _a, _b, _c, _d;
|
|
622
622
|
const comp = componentsEditor.find((item) => {
|
|
623
|
+
var _a, _b, _c;
|
|
623
624
|
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey]))
|
|
624
|
-
return item[mappingKey].id == id;
|
|
625
|
-
return (item === null || item === void 0 ? void 0 : item.
|
|
625
|
+
return (_b = (_a = item[mappingKey]) === null || _a === void 0 ? void 0 : _a[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _b !== void 0 ? _b : item[mappingKey].id == id;
|
|
626
|
+
return (_c = item === null || item === void 0 ? void 0 : item[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _c !== void 0 ? _c : item.id == id;
|
|
626
627
|
});
|
|
627
628
|
if (!comp)
|
|
628
629
|
return null;
|
|
@@ -632,7 +633,7 @@ const LayerView = (props) => {
|
|
|
632
633
|
const rotation = (_c = v.rotation) !== null && _c !== void 0 ? _c : 0;
|
|
633
634
|
const rotated = rotatePoint(w / 2, h / 2, rotation);
|
|
634
635
|
return {
|
|
635
|
-
id: String(v.id),
|
|
636
|
+
id: (_d = v === null || v === void 0 ? void 0 : v[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _d !== void 0 ? _d : String(v.id),
|
|
636
637
|
x: v.x + rotated.x,
|
|
637
638
|
y: v.y + rotated.y,
|
|
638
639
|
width: w,
|
|
@@ -649,6 +650,7 @@ const LayerView = (props) => {
|
|
|
649
650
|
mappingKey,
|
|
650
651
|
tableMatchKey,
|
|
651
652
|
statusKey,
|
|
653
|
+
initialEdges: props === null || props === void 0 ? void 0 : props.initialEdges,
|
|
652
654
|
});
|
|
653
655
|
// ─── Render ───────────────────────────────────────────────────────────────
|
|
654
656
|
const hasBoundingBox = hasBoundingBoxRef.current;
|
|
@@ -661,7 +663,7 @@ const LayerView = (props) => {
|
|
|
661
663
|
const viewBox = isValidBoundingBox
|
|
662
664
|
? `${boundingBox.minX - (((_a = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _a === void 0 ? void 0 : _a.paddingLeft) || 0)} ${boundingBox.minY - (((_b = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0)} ${boundingBox.width + (((_c = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _c === void 0 ? void 0 : _c.paddingRight) || 0)} ${boundingBox.height + (((_d = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _d === void 0 ? void 0 : _d.paddingBottom) || 0)}`
|
|
663
665
|
: "0 0 1000 1000";
|
|
664
|
-
const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [
|
|
666
|
+
const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection, graph.edges, connectionMatchKey), [
|
|
665
667
|
componentsEditor,
|
|
666
668
|
mappingKey,
|
|
667
669
|
tableMatchKey,
|
|
@@ -670,6 +672,8 @@ const LayerView = (props) => {
|
|
|
670
672
|
groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection,
|
|
671
673
|
groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey,
|
|
672
674
|
groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
|
|
675
|
+
graph.edges,
|
|
676
|
+
connectionMatchKey
|
|
673
677
|
]);
|
|
674
678
|
return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: { overflow: "auto", WebkitOverflowScrolling: "touch" } }, props.containerProps, { children: [loading && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(TransformWrapper, Object.assign({ ref: transformRef, disablePadding: true, centerZoomedOut: true, panning: { disabled: panningGroup, wheelPanning: true }, wheel: { disabled: false }, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, smooth: true, centerOnInit: true }, props.transformProps, { children: _jsxs(TransformComponent, { wrapperStyle: { width: "100%", height: "100%" }, contentStyle: { width: "100%", height: "100%" }, children: [_jsxs("svg", Object.assign({ id: "workspace", ref: svgRef, width: "100%", height: "100%", overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", onContextMenu: (e) => e.preventDefault(),
|
|
675
679
|
// onDrop={(e) => handleTableEvent(e, "drop")}
|
|
@@ -683,17 +687,17 @@ const LayerView = (props) => {
|
|
|
683
687
|
userSelect: "none",
|
|
684
688
|
} }, props.svgProps, { children: [_jsx("rect", { width: "100%", height: "100%", fill: "url(#biggrid)" }), hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer", clipPath: "url(#contentCrop)", children: _jsx(Layers, { components: [...extraComponentsEditor, ...renderedElements], selectedTable: selectedTable,
|
|
685
689
|
// iconTags={iconTags}
|
|
686
|
-
eventMatchTable: eventMatchTable, privilegedTags: privilegedTags, selectionLines: selectedLines }) }), _jsx(ConnectionLayer, { edges: graph.edges, selectedEdge: graph.selectedEdge, connecting: graph.connecting, draggingAnchor: graph.draggingAnchor, mousePos: graph.mousePos, getNodeById: getNodeById, onSelectEdge: graph.selectEdge, onDeleteEdge: graph.deleteEdge, onStartDragWaypoint: graph.startDragWaypoint, onInsertWaypoint: graph.insertWaypoint, onRemoveWaypoint: graph.removeWaypoint, onStartDragAnchor: graph.startDragAnchor, isConnectEdge: actionPrivileged.connectingNode, selectedNodeId: graph.selectedNode }), renderedElements.map((item) => {
|
|
687
|
-
var _a, _b, _c, _d;
|
|
690
|
+
eventMatchTable: eventMatchTable, privilegedTags: privilegedTags, selectionLines: selectedLines }) }), _jsx(ConnectionLayer, { edges: graph.edges, selectedEdge: graph.selectedEdge, connecting: graph.connecting, draggingAnchor: graph.draggingAnchor, mousePos: graph.mousePos, getNodeById: getNodeById, onSelectEdge: graph.selectEdge, onDeleteEdge: graph.deleteEdge, onStartDragWaypoint: graph.startDragWaypoint, onInsertWaypoint: graph.insertWaypoint, onRemoveWaypoint: graph.removeWaypoint, onStartDragAnchor: graph.startDragAnchor, isConnectEdge: actionPrivileged.connectingNode, selectedNodeId: graph.selectedNode, showConnection: showConnection, renderedElements: renderedElements, groupSelection: groupSelection, connectionMatchKey: connectionMatchKey }), renderedElements.map((item) => {
|
|
691
|
+
var _a, _b, _c, _d, _e;
|
|
688
692
|
const rotated = rotatePoint(item.width / 2, item.height / 2, (_a = item.rotation) !== null && _a !== void 0 ? _a : 0);
|
|
689
693
|
return (_jsx(ConnectHandle, {
|
|
690
694
|
// isAnchor={true}
|
|
691
|
-
connecting: graph.connecting, cx: item.x + rotated.x, cy: item.y + rotated.y, width: (_b = item.width) !== null && _b !== void 0 ? _b : 100, height: (_c = item.height) !== null && _c !== void 0 ? _c : 50, rotation: (_d = item.rotation) !== null && _d !== void 0 ? _d : 0, nodeId: String(item.id), isConnecting: !!graph.connecting, isDraggingAnchor: !!graph.draggingAnchor, onStartConnect: (nodeId, clickPos) => graph.startConnect(nodeId, clickPos), onEndConnect: (nodeId, clickPos) => {
|
|
695
|
+
connecting: graph.connecting, cx: item.x + rotated.x, cy: item.y + rotated.y, width: (_b = item.width) !== null && _b !== void 0 ? _b : 100, height: (_c = item.height) !== null && _c !== void 0 ? _c : 50, rotation: (_d = item.rotation) !== null && _d !== void 0 ? _d : 0, nodeId: (_e = item === null || item === void 0 ? void 0 : item[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _e !== void 0 ? _e : String(item.id), isConnecting: !!graph.connecting, isDraggingAnchor: !!graph.draggingAnchor, onStartConnect: (nodeId, clickPos) => graph.startConnect(nodeId, clickPos), onEndConnect: (nodeId, clickPos) => {
|
|
692
696
|
if (graph.draggingAnchor)
|
|
693
697
|
graph.updateAnchor(nodeId, clickPos);
|
|
694
698
|
else
|
|
695
699
|
graph.endConnect(nodeId, clickPos);
|
|
696
|
-
}, isConnectEdge: actionPrivileged.connectingNode, onSelectNode: graph.selectNode, isSelectNode: actionPrivileged.selectNode, onSelectEdge: graph.selectEdge, edges: graph.edges }, item.id));
|
|
700
|
+
}, isConnectEdge: actionPrivileged.connectingNode, onSelectNode: graph.selectNode, isSelectNode: actionPrivileged.selectNode, onSelectEdge: graph.selectEdge, edges: graph.edges, showConnection: showConnection }, item.id));
|
|
697
701
|
})] })), tooltip.visible && (_jsx("div", { className: `seat-editor tooltip-container ${tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className}`, style: Object.assign({ top: tooltip.y, left: tooltip.x, transform: `scale(${1 / scale})`, transformOrigin: "top left", minWidth: widthTooltip + "px" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.style), children: tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.children }))] }) }))] })));
|
|
698
702
|
};
|
|
699
703
|
export default LayerView;
|