seat-editor 3.6.49 → 3.6.51
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/page.d.ts +1 -1
- package/dist/app/graph-view-new/page.d.ts +1 -1
- package/dist/app/layout.d.ts +1 -1
- package/dist/app/new-board/page.d.ts +1 -1
- package/dist/app/old-board/page.d.ts +1 -2
- package/dist/app/only-view/chair.d.ts +1 -1
- package/dist/app/only-view/chair.js +2 -10
- package/dist/app/only-view/page.d.ts +1 -1
- package/dist/app/only-view/user.d.ts +1 -1
- package/dist/app/only-view/user.js +2 -10
- package/dist/app/page.d.ts +1 -1
- package/dist/app/test/page.d.ts +1 -2
- package/dist/app/v2/page.d.ts +1 -1
- package/dist/components/button-radio/index.d.ts +1 -1
- package/dist/components/button-tools/index.d.ts +1 -1
- package/dist/components/form-tools/label.d.ts +1 -1
- package/dist/components/form-tools/shape.d.ts +2 -2
- package/dist/components/icons/camera.d.ts +1 -2
- package/dist/components/icons/circle.d.ts +1 -2
- package/dist/components/icons/square.d.ts +1 -2
- package/dist/components/icons/type-1.d.ts +1 -2
- package/dist/components/icons/type-2.d.ts +1 -2
- package/dist/components/icons/type-3.d.ts +1 -2
- package/dist/components/icons/type-4.d.ts +1 -2
- package/dist/components/icons/type-5.d.ts +1 -2
- package/dist/components/input/number-indicator.d.ts +1 -1
- package/dist/components/joystick/index.d.ts +1 -2
- package/dist/components/layer/index.d.ts +1 -1
- package/dist/components/layer-v2/index.d.ts +1 -1
- package/dist/components/layer-v3/index.d.ts +2 -3
- package/dist/components/layer-v4/index.d.ts +1 -1
- package/dist/components/layer-v5/icons.d.ts +1 -1
- package/dist/components/layer-v5/index.d.ts +1 -1
- package/dist/components/lib/index.d.ts +1 -1
- package/dist/components/modal-preview/index.d.ts +1 -1
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/board-v2/index.d.ts +1 -2
- package/dist/features/board-v3/icons.d.ts +1 -1
- package/dist/features/board-v3/index.d.ts +1 -1
- package/dist/features/navbar/index.d.ts +1 -1
- package/dist/features/package/index.d.ts +1 -1
- package/dist/features/panel/index.d.ts +1 -1
- package/dist/features/panel/polygon.d.ts +1 -1
- package/dist/features/panel/select-tool.d.ts +1 -1
- package/dist/features/panel/selected-group.d.ts +1 -1
- package/dist/features/panel/square-circle-tool.d.ts +1 -1
- package/dist/features/panel/table-seat-circle.d.ts +1 -1
- package/dist/features/panel/table-seat-square.d.ts +1 -1
- package/dist/features/panel/text-tool.d.ts +1 -1
- package/dist/features/panel/upload-group-tool.d.ts +1 -1
- package/dist/features/panel/upload-tool.d.ts +1 -1
- package/dist/features/side-tool/icons.d.ts +1 -1
- package/dist/features/side-tool/index.d.ts +1 -1
- package/dist/features/view-only/index.d.ts +1 -1
- package/dist/features/view-only-2/index.d.ts +1 -1
- package/dist/features/view-only-3/index.d.ts +1 -1
- package/dist/features/view-only-4/index.d.ts +1 -1
- package/dist/features/view-only-5/connect-handle.js +1 -1
- package/dist/features/view-only-5/connect-handle.jsx +1 -1
- package/dist/features/view-only-5/connection-layer.js +18 -31
- package/dist/features/view-only-5/connection-layer.jsx +102 -46
- package/dist/features/view-only-5/index.d.ts +1 -1
- package/dist/features/view-only-5/index.js +108 -19
- package/dist/features/view-only-5/index.jsx +108 -19
- package/dist/features/view-only-5/utils.d.ts +1 -1
- package/dist/features/view-only-5/utils.js +30 -21
- package/dist/features/view-only-6/index.d.ts +1 -1
- package/dist/features/view-only-7/index.d.ts +1 -1
- package/dist/provider/redux-provider.d.ts +1 -1
- package/dist/provider/store-provider.d.ts +1 -1
- package/package.json +1 -1
|
@@ -44,7 +44,7 @@ const quadraticMidpoint = (from, to) => {
|
|
|
44
44
|
y: mt * mt * from.y + 2 * mt * t * cpy + t * t * to.y,
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAnchor, mousePos, isConnectEdge, getNodeById, onSelectEdge, onDeleteEdge, onStartDragWaypoint, onInsertWaypoint, onRemoveWaypoint, onStartDragAnchor, selectedNodeId, showConnection, renderedElements, groupSelection, connectionMatchKey, isSelectNode }) => {
|
|
47
|
+
export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAnchor, mousePos, isConnectEdge, getNodeById, onSelectEdge, onDeleteEdge, onStartDragWaypoint, onInsertWaypoint, onRemoveWaypoint, onStartDragAnchor, selectedNodeId, showConnection, renderedElements, groupSelection, connectionMatchKey, isSelectNode, }) => {
|
|
48
48
|
const [hoveredEdge, setHoveredEdge] = useState(null);
|
|
49
49
|
const tableMatchConnectionKey = useMemo(() => renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.filter((el) => {
|
|
50
50
|
if (connectionMatchKey) {
|
|
@@ -52,14 +52,12 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
52
52
|
}
|
|
53
53
|
return true;
|
|
54
54
|
}), [renderedElements, connectionMatchKey]);
|
|
55
|
-
const nodeHighlightMap = useMemo(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return floodFill([sel.from, sel.to], edges);
|
|
62
|
-
}, [selectedEdge, edges]);
|
|
55
|
+
// const nodeHighlightMap = useMemo<Map<string, number>>(() => {
|
|
56
|
+
// if (!selectedEdge) return new Map();
|
|
57
|
+
// const sel = edges.find((e) => e.id === selectedEdge);
|
|
58
|
+
// if (!sel) return new Map();
|
|
59
|
+
// return floodFill([sel.from, sel.to], edges);
|
|
60
|
+
// }, [selectedEdge, edges]);
|
|
63
61
|
const nodeHighlightMapByNode = useMemo(() => {
|
|
64
62
|
if (selectedNodeId || connecting) {
|
|
65
63
|
return floodFill([selectedNodeId], edges);
|
|
@@ -133,25 +131,51 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
133
131
|
})}
|
|
134
132
|
|
|
135
133
|
{/* Node highlight flood fill */}
|
|
136
|
-
{Array.from(nodeHighlightMap.entries()).map(([nodeId, level]) => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
134
|
+
{/* {Array.from(nodeHighlightMap.entries()).map(([nodeId, level]) => {
|
|
135
|
+
const node = getNodeById(nodeId);
|
|
136
|
+
if (!node) return null;
|
|
137
|
+
const w = node.width ?? NODE_WIDTH;
|
|
138
|
+
const h = node.height ?? NODE_HEIGHT;
|
|
139
|
+
const rotation = node.rotation ?? 0;
|
|
140
|
+
const color = getLevelColor(level);
|
|
141
|
+
const padding = 4;
|
|
142
|
+
if (level > 0) return null;
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<g
|
|
146
|
+
key={`highlight-${nodeId}`}
|
|
147
|
+
transform={`translate(${node.x}, ${node.y}) rotate(${rotation})`}
|
|
148
|
+
style={{ pointerEvents: "none" }}
|
|
149
|
+
>
|
|
150
|
+
<rect
|
|
151
|
+
x={-w / 2 - padding}
|
|
152
|
+
y={-h / 2 - padding}
|
|
153
|
+
width={w + padding * 2}
|
|
154
|
+
height={h + padding * 2}
|
|
155
|
+
fill="none"
|
|
156
|
+
stroke={color}
|
|
157
|
+
strokeWidth={8}
|
|
158
|
+
rx={5}
|
|
159
|
+
opacity={0.08}
|
|
160
|
+
/>
|
|
161
|
+
<rect
|
|
162
|
+
x={-w / 2 - padding}
|
|
163
|
+
y={-h / 2 - padding}
|
|
164
|
+
width={w + padding * 2}
|
|
165
|
+
height={h + padding * 2}
|
|
166
|
+
fill="none"
|
|
167
|
+
stroke={color}
|
|
168
|
+
strokeWidth={level === 0 ? 2.5 : 1.5}
|
|
169
|
+
// strokeDasharray={level === 0 ? "none" : "5 3"}
|
|
170
|
+
rx={5}
|
|
171
|
+
opacity={level === 0 ? 1 : 0.75}
|
|
172
|
+
/>
|
|
173
|
+
<g
|
|
174
|
+
transform={`translate(${w / 2 + padding - 2}, ${
|
|
175
|
+
-h / 2 - padding
|
|
176
|
+
})`}
|
|
177
|
+
>
|
|
178
|
+
{/* <circle r={7} fill={color} opacity={0.9} />
|
|
155
179
|
<text
|
|
156
180
|
textAnchor="middle"
|
|
157
181
|
dominantBaseline="middle"
|
|
@@ -163,9 +187,10 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
163
187
|
>
|
|
164
188
|
{level}
|
|
165
189
|
</text> */}
|
|
190
|
+
{/* </g>
|
|
166
191
|
</g>
|
|
167
|
-
|
|
168
|
-
})}
|
|
192
|
+
);
|
|
193
|
+
})} */}
|
|
169
194
|
|
|
170
195
|
{Array.from(nodeHighlightMapByNode.entries()).map(([nodeId, level]) => {
|
|
171
196
|
var _a, _b, _c;
|
|
@@ -210,7 +235,11 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
210
235
|
const { pathD, allPoints, fromPos, toPos, midX, midY } = ep;
|
|
211
236
|
const isSel = selectedEdge === edge.id;
|
|
212
237
|
const isHov = hoveredEdge === edge.id;
|
|
213
|
-
const connectionMatch = tableMatchConnectionKey === null || tableMatchConnectionKey === void 0 ? void 0 : tableMatchConnectionKey.some((el) => {
|
|
238
|
+
const connectionMatch = tableMatchConnectionKey === null || tableMatchConnectionKey === void 0 ? void 0 : tableMatchConnectionKey.some((el) => {
|
|
239
|
+
var _a, _b;
|
|
240
|
+
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) === edge.to ||
|
|
241
|
+
((_b = el === null || el === void 0 ? void 0 : el[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _b !== void 0 ? _b : el.id) === edge.from;
|
|
242
|
+
});
|
|
214
243
|
// const fromLevel = nodeHighlightMap.get(edge.from);
|
|
215
244
|
// const toLevel = nodeHighlightMap.get(edge.to);
|
|
216
245
|
const isStillConnectingProcess = (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) === edge.from || (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) === edge.to;
|
|
@@ -281,15 +310,18 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
281
310
|
{/* )} */}
|
|
282
311
|
|
|
283
312
|
{/* Waypoints */}
|
|
284
|
-
{
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
313
|
+
{!isSelectNode &&
|
|
314
|
+
isConnectEdge &&
|
|
315
|
+
((_a = edge.waypoints) !== null && _a !== void 0 ? _a : []).map((wp, i) => (<g key={`wp-${i}`}>
|
|
316
|
+
<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)}/>
|
|
317
|
+
<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" }}/>
|
|
318
|
+
<circle cx={wp.x} cy={wp.y} r={isSel ? 3 : 2} fill={isSel ? "#a78bfa" : "#38bdf8"} style={{ pointerEvents: "none" }}/>
|
|
319
|
+
</g>))}
|
|
289
320
|
|
|
290
321
|
{/* Midpoint insert handles */}
|
|
291
322
|
{isSel &&
|
|
292
|
-
|
|
323
|
+
isConnectEdge &&
|
|
324
|
+
!isSelectNode &&
|
|
293
325
|
allPoints.slice(0, -1).map((pt, i) => {
|
|
294
326
|
var _a;
|
|
295
327
|
const next = allPoints[i + 1];
|
|
@@ -307,15 +339,39 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
|
|
|
307
339
|
})}
|
|
308
340
|
|
|
309
341
|
{/* DEL badge */}
|
|
310
|
-
{isSel && (isConnectEdge && !isSelectNode) && (
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
342
|
+
{/* {isSel && (isConnectEdge && !isSelectNode) && (
|
|
343
|
+
<g
|
|
344
|
+
onClick={(e) => {
|
|
345
|
+
e.stopPropagation();
|
|
346
|
+
onDeleteEdge(edge.id);
|
|
347
|
+
}}
|
|
348
|
+
style={{ cursor: "pointer" }}
|
|
349
|
+
>
|
|
350
|
+
<rect
|
|
351
|
+
x={midX - 16}
|
|
352
|
+
y={midY - 10}
|
|
353
|
+
width={32}
|
|
354
|
+
height={18}
|
|
355
|
+
rx={4}
|
|
356
|
+
fill="#1e1b2e"
|
|
357
|
+
stroke="#a78bfa"
|
|
358
|
+
strokeWidth={1}
|
|
359
|
+
opacity={0.95}
|
|
360
|
+
/>
|
|
361
|
+
<text
|
|
362
|
+
x={midX}
|
|
363
|
+
y={midY}
|
|
364
|
+
textAnchor="middle"
|
|
365
|
+
dominantBaseline="middle"
|
|
366
|
+
fill="#a78bfa"
|
|
367
|
+
fontSize={9}
|
|
368
|
+
fontFamily="monospace"
|
|
369
|
+
fontWeight={600}
|
|
370
|
+
>
|
|
371
|
+
DEL
|
|
372
|
+
</text>
|
|
373
|
+
</g>
|
|
374
|
+
)} */}
|
|
319
375
|
</g>);
|
|
320
376
|
})}
|
|
321
377
|
|
|
@@ -127,5 +127,5 @@ export interface LayerViewProps<TMeta = undefined> {
|
|
|
127
127
|
selectionGroup?: boolean;
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) =>
|
|
130
|
+
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
131
131
|
export default LayerView;
|
|
@@ -269,7 +269,8 @@ const LayerView = (props) => {
|
|
|
269
269
|
}, [actionPrivileged]);
|
|
270
270
|
const timerRef = useRef(null);
|
|
271
271
|
const handlePointerDown = (e) => {
|
|
272
|
-
var _a, _b, _c;
|
|
272
|
+
var _a, _b, _c, _d, _e, _f;
|
|
273
|
+
const shiftActive = e.shiftKey;
|
|
273
274
|
const svg = svgRef.current;
|
|
274
275
|
if (!e.isPrimary || !svg)
|
|
275
276
|
return;
|
|
@@ -288,11 +289,31 @@ const LayerView = (props) => {
|
|
|
288
289
|
const downInOutSelection = hadSelection && makeSelection && e.button !== 2;
|
|
289
290
|
const unSelectAll = hadSelection && e.button === 2 && targetGroup && !targetSelectionGroup;
|
|
290
291
|
const hasSelectionDownOutSelection = !targetSelectionGroup && targetGroup && hadSelection;
|
|
292
|
+
const targetSelection = e.target.closest("g[id='selection-lines']");
|
|
291
293
|
if (downOutTable || (!targetGroup && !targetSelectionGroup)) {
|
|
292
294
|
if (graph.connecting) {
|
|
293
295
|
graph.cancelConnect();
|
|
294
296
|
}
|
|
295
297
|
}
|
|
298
|
+
let idTargetElement = JSON.parse((targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.getAttribute("data-id")) || "{}");
|
|
299
|
+
const selectionTarget = (_b = (_a = targetSelection === null || targetSelection === void 0 ? void 0 : targetSelection.dataset) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.replace("selection-", "");
|
|
300
|
+
const activeId = selectionTarget !== null && selectionTarget !== void 0 ? selectionTarget : idTargetElement;
|
|
301
|
+
if (targetGroup && shiftActive) {
|
|
302
|
+
const findById = renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.find((comp) => comp.id == activeId);
|
|
303
|
+
const currentSelection = (_c = dataElementSelectionGroupRef.current) !== null && _c !== void 0 ? _c : [];
|
|
304
|
+
if (currentSelection.length == 0 && findById) {
|
|
305
|
+
currentSelection.push(findById);
|
|
306
|
+
}
|
|
307
|
+
const alreadySelected = currentSelection.some((comp) => comp.id == activeId);
|
|
308
|
+
let newSelection;
|
|
309
|
+
if (alreadySelected) {
|
|
310
|
+
newSelection = currentSelection.filter((comp) => comp.id != activeId);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
newSelection = [...currentSelection, findById];
|
|
314
|
+
}
|
|
315
|
+
dataElementSelectionGroupRef.current = newSelection;
|
|
316
|
+
}
|
|
296
317
|
if (makeSelection) {
|
|
297
318
|
const boxSelection = createTableGhost({
|
|
298
319
|
x,
|
|
@@ -303,9 +324,9 @@ const LayerView = (props) => {
|
|
|
303
324
|
shape: "selection-box",
|
|
304
325
|
id: "selection-box-ghost",
|
|
305
326
|
});
|
|
306
|
-
(
|
|
327
|
+
(_d = svgRef.current) === null || _d === void 0 ? void 0 : _d.appendChild(boxSelection);
|
|
307
328
|
}
|
|
308
|
-
if (downInOutSelection || hasSelectionDownOutSelection || unSelectAll) {
|
|
329
|
+
if ((downInOutSelection || hasSelectionDownOutSelection || unSelectAll) && !shiftActive) {
|
|
309
330
|
handleUnSelectComponent();
|
|
310
331
|
}
|
|
311
332
|
if (unSelectAll) {
|
|
@@ -341,7 +362,7 @@ const LayerView = (props) => {
|
|
|
341
362
|
const ghostId = JSON.parse((targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.getAttribute("data-id")) || "{}");
|
|
342
363
|
const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
|
|
343
364
|
? true
|
|
344
|
-
: !((
|
|
365
|
+
: !((_e = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _e === void 0 ? void 0 : _e.some((_) => {
|
|
345
366
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
346
367
|
return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
|
|
347
368
|
}))) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable);
|
|
@@ -349,7 +370,7 @@ const LayerView = (props) => {
|
|
|
349
370
|
Object.keys(ghostAttributes).forEach((key) => ghost.setAttribute(key, ghostAttributes[key]));
|
|
350
371
|
}
|
|
351
372
|
if (allowedDrag) {
|
|
352
|
-
(
|
|
373
|
+
(_f = e.dataTransfer) === null || _f === void 0 ? void 0 : _f.setData("application/json", JSON.stringify(ghostId));
|
|
353
374
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
354
375
|
(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) &&
|
|
355
376
|
(props === null || props === void 0 ? void 0 : props.onDragTable) &&
|
|
@@ -442,7 +463,43 @@ const LayerView = (props) => {
|
|
|
442
463
|
};
|
|
443
464
|
pointerMoveGhost(e.nativeEvent);
|
|
444
465
|
const pointerHandleUp = (e) => {
|
|
445
|
-
var _a, _b, _c, _d, _e;
|
|
466
|
+
var _a, _b, _c, _d, _e, _f;
|
|
467
|
+
if (shiftActive) {
|
|
468
|
+
const allElementSelectionGroup = dataElementSelectionGroupRef.current;
|
|
469
|
+
// HITUNG BOUNDING BOX
|
|
470
|
+
let xs = [];
|
|
471
|
+
let ys = [];
|
|
472
|
+
let x2 = [];
|
|
473
|
+
let y2 = [];
|
|
474
|
+
allElementSelectionGroup.forEach((element) => {
|
|
475
|
+
const activeId = element.id;
|
|
476
|
+
const { g } = getAttributeElement(svg, String(activeId));
|
|
477
|
+
const { x, y, width, height } = getGlobalBBox(svg, g);
|
|
478
|
+
xs.push(x);
|
|
479
|
+
ys.push(y);
|
|
480
|
+
x2.push(x + width);
|
|
481
|
+
y2.push(y + height);
|
|
482
|
+
});
|
|
483
|
+
const selectionBox = {
|
|
484
|
+
x: Math.min(...xs),
|
|
485
|
+
y: Math.min(...ys),
|
|
486
|
+
width: Math.max(...x2) - Math.min(...xs),
|
|
487
|
+
height: Math.max(...y2) - Math.min(...ys),
|
|
488
|
+
stroke: "red",
|
|
489
|
+
shape: "selection-box",
|
|
490
|
+
fill: "transparent",
|
|
491
|
+
id: `${Date.now()}`,
|
|
492
|
+
rotation: 0,
|
|
493
|
+
};
|
|
494
|
+
setSelectedLines(selectionBox);
|
|
495
|
+
const allTableInSelection = (_a = dataElementSelectionGroupRef.current) === null || _a === void 0 ? void 0 : _a.map((d) => d.id);
|
|
496
|
+
const filterTableInSelection = componentProps === null || componentProps === void 0 ? void 0 : componentProps.filter((item) => {
|
|
497
|
+
var _a, _b;
|
|
498
|
+
return ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
499
|
+
(allTableInSelection === null || allTableInSelection === void 0 ? void 0 : allTableInSelection.includes((_b = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _b === void 0 ? void 0 : _b.id));
|
|
500
|
+
});
|
|
501
|
+
onMakeSelection && onMakeSelection(filterTableInSelection);
|
|
502
|
+
}
|
|
446
503
|
if (targetGroup && !hadSelection) {
|
|
447
504
|
const dataId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
448
505
|
isDragging.current = false;
|
|
@@ -490,10 +547,10 @@ const LayerView = (props) => {
|
|
|
490
547
|
setTooltip({ x: newX / scale, y: newY / scale, visible: rightClick });
|
|
491
548
|
}
|
|
492
549
|
if (makeSelection &&
|
|
493
|
-
((
|
|
550
|
+
((_b = dataElementSelectionGroupRef.current) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
494
551
|
e.button === 0 &&
|
|
495
552
|
!targetSelectionGroup) {
|
|
496
|
-
const allTableInSelection = (
|
|
553
|
+
const allTableInSelection = (_c = dataElementSelectionGroupRef.current) === null || _c === void 0 ? void 0 : _c.map((d) => d.id);
|
|
497
554
|
const filterTableInSelection = componentProps === null || componentProps === void 0 ? void 0 : componentProps.filter((item) => {
|
|
498
555
|
var _a, _b;
|
|
499
556
|
return ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
@@ -531,13 +588,13 @@ const LayerView = (props) => {
|
|
|
531
588
|
if (!hasInvalidNumber(selectionBox)) {
|
|
532
589
|
setSelectedLines(selectionBox);
|
|
533
590
|
}
|
|
534
|
-
(
|
|
591
|
+
(_d = svg.querySelector("#selection-box-ghost")) === null || _d === void 0 ? void 0 : _d.remove();
|
|
535
592
|
}
|
|
536
593
|
if (makeSelection &&
|
|
537
|
-
((
|
|
594
|
+
((_e = dataElementSelectionGroupRef.current) === null || _e === void 0 ? void 0 : _e.length) === 0 &&
|
|
538
595
|
e.button === 0 &&
|
|
539
596
|
targetSelectionGroup) {
|
|
540
|
-
(
|
|
597
|
+
(_f = svg.querySelector("#selection-box-ghost")) === null || _f === void 0 ? void 0 : _f.remove();
|
|
541
598
|
setSelectedLines(null);
|
|
542
599
|
}
|
|
543
600
|
setPanningGroup(false);
|
|
@@ -619,15 +676,10 @@ const LayerView = (props) => {
|
|
|
619
676
|
// ─── Node helper ──────────────────────────────────────────────────────────
|
|
620
677
|
const getNodeById = useCallback((id) => {
|
|
621
678
|
var _a, _b, _c, _d;
|
|
622
|
-
const comp =
|
|
623
|
-
var _a, _b, _c;
|
|
624
|
-
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey]))
|
|
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;
|
|
627
|
-
});
|
|
679
|
+
const comp = renderedElements.find((c) => { var _a; return ((_a = c[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]) !== null && _a !== void 0 ? _a : c.id) === id; });
|
|
628
680
|
if (!comp)
|
|
629
681
|
return null;
|
|
630
|
-
const v =
|
|
682
|
+
const v = comp;
|
|
631
683
|
const w = (_a = v.width) !== null && _a !== void 0 ? _a : 100;
|
|
632
684
|
const h = (_b = v.height) !== null && _b !== void 0 ? _b : 50;
|
|
633
685
|
const rotation = (_c = v.rotation) !== null && _c !== void 0 ? _c : 0;
|
|
@@ -665,7 +717,43 @@ const LayerView = (props) => {
|
|
|
665
717
|
const viewBox = isValidBoundingBox
|
|
666
718
|
? `${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)}`
|
|
667
719
|
: "0 0 1000 1000";
|
|
668
|
-
const
|
|
720
|
+
const stillHoldShift = useRef(false);
|
|
721
|
+
useEffect(() => {
|
|
722
|
+
var _a, _b;
|
|
723
|
+
if (stillHoldShift.current && dataElementSelectionGroupRef.current) {
|
|
724
|
+
const selectionLines = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#selection-lines");
|
|
725
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "none");
|
|
726
|
+
}
|
|
727
|
+
if (!stillHoldShift.current && dataElementSelectionGroupRef.current) {
|
|
728
|
+
const selectionLines = (_b = svgRef.current) === null || _b === void 0 ? void 0 : _b.querySelector("#selection-lines");
|
|
729
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "all");
|
|
730
|
+
}
|
|
731
|
+
}, [stillHoldShift.current, dataElementSelectionGroupRef.current]);
|
|
732
|
+
useEffect(() => {
|
|
733
|
+
const handleKeyDown = (e) => {
|
|
734
|
+
var _a, _b;
|
|
735
|
+
// setPressedKey(e.key);
|
|
736
|
+
const selectionLines = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#selection-lines");
|
|
737
|
+
(_b = svgRef.current) === null || _b === void 0 ? void 0 : _b.querySelector("#selection-lines");
|
|
738
|
+
if (e.key === "Shift") {
|
|
739
|
+
stillHoldShift.current = true;
|
|
740
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "none");
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
const handleKeyUp = () => {
|
|
744
|
+
var _a;
|
|
745
|
+
const selectionLines = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#selection-lines");
|
|
746
|
+
stillHoldShift.current = false;
|
|
747
|
+
selectionLines === null || selectionLines === void 0 ? void 0 : selectionLines.setAttribute("pointer-events", "all");
|
|
748
|
+
};
|
|
749
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
750
|
+
window.addEventListener("keyup", handleKeyUp);
|
|
751
|
+
return () => {
|
|
752
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
753
|
+
window.removeEventListener("keyup", handleKeyUp);
|
|
754
|
+
};
|
|
755
|
+
}, [dataElementSelectionGroupRef.current]);
|
|
756
|
+
const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection, graph.edges, connectionMatchKey, displaySettings === null || displaySettings === void 0 ? void 0 : displaySettings.selectionGroup, graph.selectedNode), [
|
|
669
757
|
componentsEditor,
|
|
670
758
|
mappingKey,
|
|
671
759
|
tableMatchKey,
|
|
@@ -676,6 +764,7 @@ const LayerView = (props) => {
|
|
|
676
764
|
groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
|
|
677
765
|
graph.edges,
|
|
678
766
|
connectionMatchKey,
|
|
767
|
+
graph.selectedNode
|
|
679
768
|
]);
|
|
680
769
|
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(),
|
|
681
770
|
// onDrop={(e) => handleTableEvent(e, "drop")}
|