seat-editor 3.6.27 → 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.
@@ -7,6 +7,7 @@ export declare const data: ({
7
7
  code: string;
8
8
  name: string;
9
9
  capacity: number;
10
+ use_connection: number;
10
11
  pax: {
11
12
  adults: number;
12
13
  };
@@ -132,6 +133,109 @@ export declare const data: ({
132
133
  uuid: string;
133
134
  image: any;
134
135
  }[];
136
+ } | {
137
+ uuid_table: string;
138
+ uuid_rsvp: any;
139
+ uuid_event_outlet: any;
140
+ uuid_reserved: any;
141
+ uuid_rsvp_table: any;
142
+ code: string;
143
+ name: string;
144
+ capacity: number;
145
+ use_connection: number;
146
+ pax: any;
147
+ req_pax: any;
148
+ total_pax: any;
149
+ total_req_pax: any;
150
+ uuid_status: any;
151
+ status_bg_color: any;
152
+ status_name: any;
153
+ status_color: any;
154
+ status_icon: any;
155
+ title: any;
156
+ firstname: any;
157
+ lastname: any;
158
+ fullname: any;
159
+ ranks: any;
160
+ tags: any;
161
+ rank_sp: any;
162
+ rank_ts: any;
163
+ start_date: any;
164
+ end_date: any;
165
+ start_time: any;
166
+ end_time: any;
167
+ walk_in: any;
168
+ dp_amount: any;
169
+ dp_status: any;
170
+ online_payment: any;
171
+ rsvp_type: any;
172
+ rsvp_input: any;
173
+ is_reserved: number;
174
+ is_hold: number;
175
+ is_lock: number;
176
+ is_overtime: number;
177
+ is_upcoming: number;
178
+ conflicted: number;
179
+ is_late: number;
180
+ properties: {
181
+ x: number;
182
+ y: number;
183
+ id: string;
184
+ fill: string;
185
+ tags: ({
186
+ gap: string;
187
+ key: string;
188
+ items: {
189
+ type: string;
190
+ value: string;
191
+ }[];
192
+ direction: string;
193
+ offsetX?: undefined;
194
+ offsetY?: undefined;
195
+ } | {
196
+ gap: string;
197
+ key: string;
198
+ items: {
199
+ type: string;
200
+ value: string;
201
+ }[];
202
+ offsetX: string;
203
+ offsetY: string;
204
+ direction: string;
205
+ })[];
206
+ text: string;
207
+ shape: string;
208
+ width: number;
209
+ height: number;
210
+ labels: {
211
+ x: number;
212
+ y: number;
213
+ label: string;
214
+ fontSize: number;
215
+ fontColor: string;
216
+ }[];
217
+ points: any[];
218
+ opacity: number;
219
+ rotation: number;
220
+ seatCount: number;
221
+ uuid_table: string;
222
+ stroke?: undefined;
223
+ seatFill?: undefined;
224
+ openSpace?: undefined;
225
+ seatPositions?: undefined;
226
+ };
227
+ image_mapping: {
228
+ x: number;
229
+ y: number;
230
+ id: string;
231
+ fill: string;
232
+ shape: string;
233
+ width: number;
234
+ height: number;
235
+ }[];
236
+ upcomings: any[];
237
+ areas: any;
238
+ sections: any;
135
239
  } | {
136
240
  uuid_table: string;
137
241
  uuid_rsvp: string;
@@ -261,6 +365,7 @@ export declare const data: ({
261
365
  uuid: string;
262
366
  image: any;
263
367
  }[];
368
+ use_connection?: undefined;
264
369
  } | {
265
370
  uuid_table: string;
266
371
  uuid_rsvp: any;
@@ -363,6 +468,7 @@ export declare const data: ({
363
468
  upcomings: any[];
364
469
  areas: any;
365
470
  sections: any;
471
+ use_connection?: undefined;
366
472
  } | {
367
473
  uuid_table: string;
368
474
  uuid_rsvp: any;
@@ -471,6 +577,7 @@ export declare const data: ({
471
577
  upcomings: any[];
472
578
  areas: any;
473
579
  sections: any;
580
+ use_connection?: undefined;
474
581
  } | {
475
582
  uuid_table: string;
476
583
  uuid_rsvp: any;
@@ -578,6 +685,7 @@ export declare const data: ({
578
685
  upcomings: any[];
579
686
  areas: any;
580
687
  sections: any;
688
+ use_connection?: undefined;
581
689
  })[];
582
690
  export declare const COLORS_SECTION: string[];
583
691
  export declare const background: {
@@ -8,6 +8,7 @@ export const data = [
8
8
  code: "T1",
9
9
  name: "TABLE 1",
10
10
  capacity: 5,
11
+ use_connection: 1,
11
12
  pax: {
12
13
  adults: 4,
13
14
  },
@@ -168,6 +169,7 @@ export const data = [
168
169
  code: "V1",
169
170
  name: "VIP 1",
170
171
  capacity: 8,
172
+ use_connection: 1,
171
173
  pax: null,
172
174
  req_pax: null,
173
175
  total_pax: null,
@@ -2,10 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
4
  import LayerView from "../../features/view-only-5";
5
- import { COLORS_SECTION, data } from "./constant";
5
+ import { data } from "./constant";
6
6
  import { Button } from "antd";
7
7
  import { useMemo, useState } from "react";
8
- import { selection } from "./selection";
9
8
  export default function GraphView() {
10
9
  const [isConnecting, setIsConnecting] = useState(false);
11
10
  const [actionPrivileged, setActionPrivileged] = useState({
@@ -36,10 +35,13 @@ export default function GraphView() {
36
35
  },
37
36
  ]);
38
37
  const [sectionActive, setSectionActive] = useState(null);
39
- const componentSection = useMemo(() => data === null || data === void 0 ? void 0 : data.map((data) => {
38
+ const componentSection = useMemo(() => {
40
39
  var _a;
41
- return (Object.assign(Object.assign({}, data), { section: (_a = sections.find((section) => section.items.some((item) => item.uuid_table === data.uuid_table))) === null || _a === void 0 ? void 0 : _a.id }));
42
- }), [data, sections]);
40
+ return (_a = data === null || data === void 0 ? void 0 : data.map((data) => {
41
+ var _a;
42
+ return (Object.assign(Object.assign({}, data), { section: (_a = sections.find((section) => section.items.some((item) => item.uuid_table === data.uuid_table))) === null || _a === void 0 ? void 0 : _a.id }));
43
+ })) === null || _a === void 0 ? void 0 : _a.slice(0, 10);
44
+ }, [data, sections]);
43
45
  const onMakeSelection = (datas) => {
44
46
  setSections((prev) => {
45
47
  const uuidSet = new Set(datas.map((d) => d.uuid_table));
@@ -145,29 +147,36 @@ export default function GraphView() {
145
147
  };
146
148
  return (_jsx("div", { className: "w-full h-screen flex relative", children: _jsxs("div", { className: "flex", children: [_jsx("div", { className: "absolute top-0 left-0 z-10 flex gap-2", children: priviledged.map((item) => (_jsx(Button, { type: actionPrivileged[item.key] ? "primary" : "default", htmlType: "button", onClick: () => {
147
149
  setActionPrivileged((prev) => (Object.assign(Object.assign({}, prev), { [item.key]: !prev[item.key] })));
148
- }, children: item.name }, item.key))) }), _jsx(LayerView, { componentProps: componentSection, statusKey: "section", defaultBackground: "#1e2d4a", mappingKey: "properties", keyNode: "nodes", onEdgesChange: (table, edges) => console.log({ edges, table }), isConnectEdge: isConnecting, isSelectNode: isSelectNode,
150
+ }, children: item.name }, item.key))) }), _jsx(LayerView, { componentProps: componentSection, statusKey: "section", defaultBackground: "#1e2d4a", mappingKey: "properties", keyNode: "nodes", onEdgesChange: (table, edges) => console.log({ edges, table }), isConnectEdge: isConnecting, isSelectNode: isSelectNode, connectionMatchKey: {
151
+ key: "use_connection",
152
+ value: 1
153
+ },
149
154
  // extraComponentProps={background}
150
155
  onSelectComponent: handleSelectItem,
151
156
  // actionPrivileged={{
152
157
  // select: true,
153
158
  // }}
154
- onMakeSelection: onMakeSelection, tableMatchKey: [
155
- {
156
- key: "capacity",
157
- value: 5,
158
- properties: {
159
- fill: "#000000",
160
- },
161
- // element: {
162
- // icon: undefined,
163
- // props: {},
164
- // },
165
- },
166
- ], onDragTable: (_, data) => setDataDrag(data), actionPrivileged: actionPrivileged, groupSelection: {
167
- colorGroupSelection: COLORS_SECTION,
168
- dataKey: "uuid_table",
169
- selection: selection
170
- }, onRightClick: (e, data) => {
159
+ onMakeSelection: onMakeSelection,
160
+ // tableMatchKey={[
161
+ // // {
162
+ // // key: "capacity",
163
+ // // value: 5,
164
+ // // properties: {
165
+ // // fill: "#000000",
166
+ // // },
167
+ // // element: {
168
+ // // icon: undefined,
169
+ // // props: {},
170
+ // // },
171
+ // },
172
+ // ]}
173
+ onDragTable: (_, data) => setDataDrag(data), actionPrivileged: actionPrivileged,
174
+ // groupSelection={{
175
+ // colorGroupSelection: COLORS_SECTION,
176
+ // dataKey: "uuid_table",
177
+ // selection: selection
178
+ // }}
179
+ onRightClick: (e, data) => {
171
180
  console.log({ e, data });
172
181
  }, allowTooltip: true, onHoldTable: (e, data) => {
173
182
  console.log({ e, data });
@@ -1,10 +1,9 @@
1
1
  "use client";
2
2
  import clsx from "clsx";
3
3
  import LayerView from "../../features/view-only-5";
4
- import { COLORS_SECTION, data } from "./constant";
4
+ import { data } from "./constant";
5
5
  import { Button } from "antd";
6
6
  import { useMemo, useState } from "react";
7
- import { selection } from "./selection";
8
7
  export default function GraphView() {
9
8
  const [isConnecting, setIsConnecting] = useState(false);
10
9
  const [actionPrivileged, setActionPrivileged] = useState({
@@ -35,10 +34,13 @@ export default function GraphView() {
35
34
  },
36
35
  ]);
37
36
  const [sectionActive, setSectionActive] = useState(null);
38
- const componentSection = useMemo(() => data === null || data === void 0 ? void 0 : data.map((data) => {
37
+ const componentSection = useMemo(() => {
39
38
  var _a;
40
- return (Object.assign(Object.assign({}, data), { section: (_a = sections.find((section) => section.items.some((item) => item.uuid_table === data.uuid_table))) === null || _a === void 0 ? void 0 : _a.id }));
41
- }), [data, sections]);
39
+ return (_a = data === null || data === void 0 ? void 0 : data.map((data) => {
40
+ var _a;
41
+ return (Object.assign(Object.assign({}, data), { section: (_a = sections.find((section) => section.items.some((item) => item.uuid_table === data.uuid_table))) === null || _a === void 0 ? void 0 : _a.id }));
42
+ })) === null || _a === void 0 ? void 0 : _a.slice(0, 10);
43
+ }, [data, sections]);
42
44
  const onMakeSelection = (datas) => {
43
45
  setSections((prev) => {
44
46
  const uuidSet = new Set(datas.map((d) => d.uuid_table));
@@ -151,29 +153,36 @@ export default function GraphView() {
151
153
  {item.name}
152
154
  </Button>))}
153
155
  </div>
154
- <LayerView componentProps={componentSection} statusKey="section" defaultBackground="#1e2d4a" mappingKey="properties" keyNode="nodes" onEdgesChange={(table, edges) => console.log({ edges, table })} isConnectEdge={isConnecting} isSelectNode={isSelectNode}
156
+ <LayerView componentProps={componentSection} statusKey="section" defaultBackground="#1e2d4a" mappingKey="properties" keyNode="nodes" onEdgesChange={(table, edges) => console.log({ edges, table })} isConnectEdge={isConnecting} isSelectNode={isSelectNode} connectionMatchKey={{
157
+ key: "use_connection",
158
+ value: 1
159
+ }}
155
160
  // extraComponentProps={background}
156
161
  onSelectComponent={handleSelectItem}
157
162
  // actionPrivileged={{
158
163
  // select: true,
159
164
  // }}
160
- onMakeSelection={onMakeSelection} tableMatchKey={[
161
- {
162
- key: "capacity",
163
- value: 5,
164
- properties: {
165
- fill: "#000000",
166
- },
167
- // element: {
168
- // icon: undefined,
169
- // props: {},
170
- // },
171
- },
172
- ]} onDragTable={(_, data) => setDataDrag(data)} actionPrivileged={actionPrivileged} groupSelection={{
173
- colorGroupSelection: COLORS_SECTION,
174
- dataKey: "uuid_table",
175
- selection: selection
176
- }} onRightClick={(e, data) => {
165
+ onMakeSelection={onMakeSelection}
166
+ // tableMatchKey={[
167
+ // // {
168
+ // // key: "capacity",
169
+ // // value: 5,
170
+ // // properties: {
171
+ // // fill: "#000000",
172
+ // // },
173
+ // // element: {
174
+ // // icon: undefined,
175
+ // // props: {},
176
+ // // },
177
+ // },
178
+ // ]}
179
+ onDragTable={(_, data) => setDataDrag(data)} actionPrivileged={actionPrivileged}
180
+ // groupSelection={{
181
+ // colorGroupSelection: COLORS_SECTION,
182
+ // dataKey: "uuid_table",
183
+ // selection: selection
184
+ // }}
185
+ onRightClick={(e, data) => {
177
186
  console.log({ e, data });
178
187
  }} allowTooltip={true} onHoldTable={(e, data) => {
179
188
  console.log({ e, data });
@@ -79,11 +79,11 @@ export const ConnectHandle = ({ cx, cy, width, height, nodeId, rotation = 0, isC
79
79
  };
80
80
  if (!showConnection)
81
81
  return null;
82
- return (_jsxs("g", { transform: `translate(${cx}, ${cy}) rotate(${rotation})`, children: [_jsx("rect", { x: -hw - 4, y: -hh - 4, width: width + 8, height: height + 8, fill: "transparent", stroke: isActive ? "#a78bfa" : hovered ? "#38bdf8" : "transparent", strokeWidth: isActive ? 2 : 1.5, strokeDasharray: isActive ? "4 2" : "none", rx: 4, style: { pointerEvents: "none" } }), _jsx("rect", { x: -hw - 4, y: -hh - 4, width: width + 8, height: height + 8, fill: "transparent", style: {
82
+ return (_jsxs("g", { transform: `translate(${cx}, ${cy}) rotate(${rotation})`, children: [_jsx("rect", { x: -hw - 4, y: -hh - 4, width: width + 8, height: height + 8, fill: "transparent", stroke: (isActive && (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) === nodeId) ? "#5014D0" : hovered ? "#3E97FF" : "transparent", strokeWidth: isActive ? 1 : 1, strokeDasharray: (isActive && hovered) ? "solid" : "none", rx: 4, style: { pointerEvents: "none" } }), _jsx("rect", { x: -hw - 4, y: -hh - 4, width: width + 8, height: height + 8, fill: "transparent", style: {
83
83
  cursor: isConnectEdge ? "crosshair" : "pointer",
84
84
  pointerEvents: isConnectEdge ? "all" : "none",
85
85
  }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onPointerDown: (e) => {
86
86
  handlePointerDown(e);
87
87
  } }), ((hovered && isConnectEdge) || isActive) &&
88
- anchors.map((a, i) => (_jsx("circle", { cx: a.x, cy: a.y, r: 3, fill: isActive ? "#a78bfa" : "#38bdf8", opacity: 0.5, style: { pointerEvents: "none" } }, i)))] }));
88
+ anchors.map((a, i) => (_jsx("circle", { cx: a.x, cy: a.y, r: 3, fill: isActive ? "#7239EA" : "#38bdf8", opacity: 0.5, style: { pointerEvents: "none" } }, i)))] }));
89
89
  };
@@ -80,7 +80,7 @@ export const ConnectHandle = ({ cx, cy, width, height, nodeId, rotation = 0, isC
80
80
  return null;
81
81
  return (<g transform={`translate(${cx}, ${cy}) rotate(${rotation})`}>
82
82
  {/* Border visual */}
83
- <rect x={-hw - 4} y={-hh - 4} width={width + 8} height={height + 8} fill="transparent" stroke={isActive ? "#a78bfa" : hovered ? "#38bdf8" : "transparent"} strokeWidth={isActive ? 2 : 1.5} strokeDasharray={isActive ? "4 2" : "none"} rx={4} style={{ pointerEvents: "none" }}/>
83
+ <rect x={-hw - 4} y={-hh - 4} width={width + 8} height={height + 8} fill={"transparent"} stroke={(isActive && (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) === nodeId) ? "#5014D0" : hovered ? "#3E97FF" : "transparent"} strokeWidth={isActive ? 1 : 1} strokeDasharray={(isActive && hovered) ? "solid" : "none"} rx={4} style={{ pointerEvents: "none" }}/>
84
84
 
85
85
  {/* Hit area */}
86
86
  <rect x={-hw - 4} y={-hh - 4} width={width + 8} height={height + 8} fill="transparent" style={{
@@ -92,7 +92,7 @@ export const ConnectHandle = ({ cx, cy, width, height, nodeId, rotation = 0, isC
92
92
 
93
93
  {/* Anchor dots — muncul saat hover atau active */}
94
94
  {((hovered && isConnectEdge) || isActive) &&
95
- anchors.map((a, i) => (<circle key={i} cx={a.x} cy={a.y} r={3} fill={isActive ? "#a78bfa" : "#38bdf8"} opacity={0.5} style={{ pointerEvents: "none" }}/>))}
95
+ anchors.map((a, i) => (<circle key={i} cx={a.x} cy={a.y} r={3} fill={isActive ? "#7239EA" : "#38bdf8"} opacity={0.5} style={{ pointerEvents: "none" }}/>))}
96
96
 
97
97
  </g>);
98
98
  };
@@ -32,6 +32,15 @@ type Props = {
32
32
  selectedNodeId: string | null;
33
33
  showConnection?: boolean;
34
34
  renderedElements?: ComponentProps[];
35
+ groupSelection?: {
36
+ colorGroupSelection: string[];
37
+ dataKey: string;
38
+ selection: Record<number, string[]>;
39
+ };
40
+ connectionMatchKey?: {
41
+ key: string;
42
+ value: string | number;
43
+ };
35
44
  };
36
45
  export declare const ConnectionLayer: React.FC<Props>;
37
46
  export {};
@@ -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
3
  import { buildPath, getRectEdge, GRID_SIZE, NODE_WIDTH, NODE_HEIGHT, snap, rotatePoint, } from "./utils";
4
- const LEVEL_COLORS = [
5
- "#22c55e",
6
- "#f59e0b",
7
- "#f97316",
8
- "#ef4444",
9
- "#a78bfa",
10
- "#38bdf8",
11
- ];
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,8 +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, showConnection, renderedElements, }) => {
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);
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]);
57
56
  const nodeHighlightMap = useMemo(() => {
58
57
  if (!selectedEdge)
59
58
  return new Map();
@@ -107,15 +106,6 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
107
106
  if (!showConnection) {
108
107
  return null;
109
108
  }
110
- // const toLocalPos = ({ cx, cy, rotation }) => {
111
- // const dx = world.x - cx;
112
- // const dy = world.y - cy;
113
- // const rad = -(rotation * Math.PI) / 180;
114
- // return {
115
- // x: dx * Math.cos(rad) - dy * Math.sin(rad),
116
- // y: dx * Math.sin(rad) + dy * Math.cos(rad),
117
- // };
118
- // };
119
109
  return (_jsxs("g", { id: "connection-layer", children: [Array.from(nodeHighlightMap.entries()).map(([nodeId, level]) => {
120
110
  var _a, _b, _c;
121
111
  const node = getNodeById(nodeId);
@@ -126,7 +116,11 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
126
116
  const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
127
117
  const color = getLevelColor(level);
128
118
  const padding = 4;
129
- 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, strokeDasharray: level === 0 ? "none" : "5 3", rx: 5, opacity: level === 0 ? 1 : 0.75 }), _jsxs("g", { transform: `translate(${w / 2 + padding - 2}, ${-h / 2 - padding})`, children: [_jsx("circle", { r: 7, fill: color, opacity: 0.9 }), _jsx("text", { textAnchor: "middle", dominantBaseline: "middle", fill: "white", fontSize: 7, fontFamily: "monospace", fontWeight: 700, style: { userSelect: "none" }, children: level })] })] }, `highlight-${nodeId}`));
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}`));
130
124
  }), Array.from(nodeHighlightMapByNode.entries()).map(([nodeId, level]) => {
131
125
  var _a, _b, _c;
132
126
  const node = getNodeById(nodeId);
@@ -137,7 +131,12 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
137
131
  const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
138
132
  const color = getLevelColor(level);
139
133
  const padding = 4;
140
- 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, strokeDasharray: level === 0 ? "none" : "5 3", rx: 5, opacity: level === 0 ? 1 : 0.75 }), _jsxs("g", { transform: `translate(${w / 2 + padding - 2}, ${-h / 2 - padding})`, children: [_jsx("circle", { r: 7, fill: color, opacity: 0.9 }), _jsx("text", { textAnchor: "middle", dominantBaseline: "middle", fill: "white", fontSize: 7, fontFamily: "monospace", fontWeight: 700, style: { userSelect: "none" }, children: level })] })] }, `highlight-${nodeId}`));
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}`));
141
140
  }), edges.map((edge) => {
142
141
  var _a;
143
142
  const ep = edgePaths.get(edge.id);
@@ -146,34 +145,29 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
146
145
  const { pathD, allPoints, fromPos, toPos, midX, midY } = ep;
147
146
  const isSel = selectedEdge === edge.id;
148
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);
149
149
  const fromLevel = nodeHighlightMap.get(edge.from);
150
150
  const toLevel = nodeHighlightMap.get(edge.to);
151
- const isInNetwork = fromLevel !== undefined && toLevel !== undefined;
152
- const networkColor = isInNetwork
153
- ? getLevelColor(Math.max(fromLevel, toLevel))
154
- : "#38bdf8";
151
+ const isRing1 = (selectedNodeId && selectedNodeId === edge.from) ||
152
+ selectedNodeId === edge.to;
155
153
  const isDraggingFrom = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "from";
156
154
  const isDraggingTo = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "to";
157
- // const currentConnection =
158
- const isNotRing1 = connecting &&
159
- (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.from &&
160
- (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.to;
161
155
  return (_jsxs("g", { children: [_jsx("path", { d: pathD, stroke: "transparent", strokeWidth: 14, fill: "none", style: { cursor: "pointer" }, onClick: (e) => {
162
156
  e.stopPropagation();
163
157
  onSelectEdge(edge.id);
164
- }, 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
165
- ? "#a78bfa"
166
- : isInNetwork && selectedEdge
167
- ? networkColor
168
- : "#38bdf8", strokeWidth: isSel ? 2 : isHov ? 2 : 1.5, fill: "none", opacity: (selectedEdge && !isSel && !isInNetwork) || isNotRing1
169
- ? 0.2
170
- : 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) => {
171
159
  e.stopPropagation();
172
160
  onStartDragAnchor(e, edge.id, "from");
173
- } }), _jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 6, fill: isDraggingFrom ? "#a78bfa" : "#38bdf8", stroke: "#0f172a", strokeWidth: 1.5, style: { pointerEvents: "none" } }), _jsx("circle", { cx: fromPos.x, cy: fromPos.y, r: 2.5, fill: "#0f172a", style: { pointerEvents: "none" } })] })), isSel && (_jsxs("g", { children: [isDraggingTo && (_jsx("circle", { cx: toPos.x, cy: toPos.y, r: 12, fill: "#22c55e", opacity: 0.15, style: { pointerEvents: "none" } })), _jsx("circle", { cx: toPos.x, cy: toPos.y, r: 10, fill: "transparent", style: { cursor: "grab" }, onMouseDown: (e) => {
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) => {
174
165
  e.stopPropagation();
175
166
  onStartDragAnchor(e, edge.id, "to");
176
- } }), _jsx("circle", { cx: toPos.x, cy: toPos.y, r: 6, fill: isDraggingTo ? "#a78bfa" : "#22c55e", stroke: "#0f172a", strokeWidth: 1.5, style: { pointerEvents: "none" } }), _jsx("circle", { cx: toPos.x, cy: toPos.y, r: 2.5, fill: "#0f172a", 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 &&
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 &&
177
171
  isConnectEdge &&
178
172
  allPoints.slice(0, -1).map((pt, i) => {
179
173
  var _a;
@@ -191,7 +185,7 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
191
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));
192
186
  }), connecting &&
193
187
  (() => {
194
- const findSourceTarget = renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.find((el) => el.id === connecting.fromId);
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; });
195
189
  if (!findSourceTarget)
196
190
  return null;
197
191
  const { x, y, rotation, width, height } = findSourceTarget;
@@ -1,13 +1,6 @@
1
1
  import React, { useMemo, useState } from "react";
2
2
  import { buildPath, getRectEdge, GRID_SIZE, NODE_WIDTH, NODE_HEIGHT, snap, rotatePoint, } from "./utils";
3
- const LEVEL_COLORS = [
4
- "#22c55e",
5
- "#f59e0b",
6
- "#f97316",
7
- "#ef4444",
8
- "#a78bfa",
9
- "#38bdf8",
10
- ];
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,8 +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, showConnection, renderedElements, }) => {
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);
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]);
56
55
  const nodeHighlightMap = useMemo(() => {
57
56
  if (!selectedEdge)
58
57
  return new Map();
@@ -106,15 +105,6 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
106
105
  if (!showConnection) {
107
106
  return null;
108
107
  }
109
- // const toLocalPos = ({ cx, cy, rotation }) => {
110
- // const dx = world.x - cx;
111
- // const dy = world.y - cy;
112
- // const rad = -(rotation * Math.PI) / 180;
113
- // return {
114
- // x: dx * Math.cos(rad) - dy * Math.sin(rad),
115
- // y: dx * Math.sin(rad) + dy * Math.cos(rad),
116
- // };
117
- // };
118
108
  return (<g id="connection-layer">
119
109
  {/* Node highlight flood fill */}
120
110
  {Array.from(nodeHighlightMap.entries()).map(([nodeId, level]) => {
@@ -127,14 +117,26 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
127
117
  const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
128
118
  const color = getLevelColor(level);
129
119
  const padding = 4;
120
+ if (level > 0)
121
+ return null;
130
122
  return (<g key={`highlight-${nodeId}`} transform={`translate(${node.x}, ${node.y}) rotate(${rotation})`} style={{ pointerEvents: "none" }}>
131
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}/>
132
- <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} strokeDasharray={level === 0 ? "none" : "5 3"} rx={5} opacity={level === 0 ? 1 : 0.75}/>
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}/>
133
127
  <g transform={`translate(${w / 2 + padding - 2}, ${-h / 2 - padding})`}>
134
- <circle r={7} fill={color} opacity={0.9}/>
135
- <text textAnchor="middle" dominantBaseline="middle" fill="white" fontSize={7} fontFamily="monospace" fontWeight={700} style={{ userSelect: "none" }}>
136
- {level}
137
- </text>
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> */}
138
140
  </g>
139
141
  </g>);
140
142
  })}
@@ -149,14 +151,27 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
149
151
  const rotation = (_c = node.rotation) !== null && _c !== void 0 ? _c : 0;
150
152
  const color = getLevelColor(level);
151
153
  const padding = 4;
154
+ // console.log("nodeHighlightMapByNode", nodeId, level, color);
155
+ if (level > 1)
156
+ return null;
152
157
  return (<g key={`highlight-${nodeId}`} transform={`translate(${node.x}, ${node.y}) rotate(${rotation})`} style={{ pointerEvents: "none" }}>
153
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}/>
154
- <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} strokeDasharray={level === 0 ? "none" : "5 3"} rx={5} opacity={level === 0 ? 1 : 0.75}/>
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}/>
155
162
  <g transform={`translate(${w / 2 + padding - 2}, ${-h / 2 - padding})`}>
156
- <circle r={7} fill={color} opacity={0.9}/>
157
- <text textAnchor="middle" dominantBaseline="middle" fill="white" fontSize={7} fontFamily="monospace" fontWeight={700} style={{ userSelect: "none" }}>
158
- {level}
159
- </text>
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> */}
160
175
  </g>
161
176
  </g>);
162
177
  })}
@@ -170,18 +185,13 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
170
185
  const { pathD, allPoints, fromPos, toPos, midX, midY } = ep;
171
186
  const isSel = selectedEdge === edge.id;
172
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);
173
189
  const fromLevel = nodeHighlightMap.get(edge.from);
174
190
  const toLevel = nodeHighlightMap.get(edge.to);
175
- const isInNetwork = fromLevel !== undefined && toLevel !== undefined;
176
- const networkColor = isInNetwork
177
- ? getLevelColor(Math.max(fromLevel, toLevel))
178
- : "#38bdf8";
191
+ const isRing1 = (selectedNodeId && selectedNodeId === edge.from) ||
192
+ selectedNodeId === edge.to;
179
193
  const isDraggingFrom = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "from";
180
194
  const isDraggingTo = (draggingAnchor === null || draggingAnchor === void 0 ? void 0 : draggingAnchor.edgeId) === edge.id && draggingAnchor.side === "to";
181
- // const currentConnection =
182
- const isNotRing1 = connecting &&
183
- (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.from &&
184
- (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== edge.to;
185
195
  return (<g key={edge.id}>
186
196
  {/* Hit area */}
187
197
  <path d={pathD} stroke="transparent" strokeWidth={14} fill="none" style={{ cursor: "pointer" }} onClick={(e) => {
@@ -193,35 +203,52 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
193
203
  {(isSel || isHov) && (<path d={pathD} stroke={isSel ? "#a78bfa" : "#38bdf8"} strokeWidth={8} fill="none" opacity={isSel ? 0.12 : 0.06} style={{ pointerEvents: "none" }}/>)}
194
204
 
195
205
  {/* Curve */}
196
- <path d={pathD} stroke={isSel
197
- ? "#a78bfa"
198
- : isInNetwork && selectedEdge
199
- ? networkColor
200
- : "#38bdf8"} strokeWidth={isSel ? 2 : isHov ? 2 : 1.5} fill="none" opacity={(selectedEdge && !isSel && !isInNetwork) || isNotRing1
201
- ? 0.2
202
- : 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" }}/>
203
208
 
204
209
  {/* FROM dot */}
205
- {isSel && (<g>
206
- {isDraggingFrom && (<circle cx={fromPos.x} cy={fromPos.y} r={12} fill="#38bdf8" opacity={0.15} style={{ pointerEvents: "none" }}/>)}
210
+ {/* {isSel && ( */}
211
+ <g>
212
+ {isDraggingFrom && (<circle cx={fromPos.x} cy={fromPos.y} r={12} fill="#7239EA" opacity={0.15} style={{ pointerEvents: "none" }}/>)}
207
213
  <circle cx={fromPos.x} cy={fromPos.y} r={10} fill="transparent" style={{ cursor: "grab" }} onMouseDown={(e) => {
208
- e.stopPropagation();
209
- onStartDragAnchor(e, edge.id, "from");
210
- }}/>
211
- <circle cx={fromPos.x} cy={fromPos.y} r={6} fill={isDraggingFrom ? "#a78bfa" : "#38bdf8"} stroke="#0f172a" strokeWidth={1.5} style={{ pointerEvents: "none" }}/>
212
- <circle cx={fromPos.x} cy={fromPos.y} r={2.5} fill="#0f172a" style={{ pointerEvents: "none" }}/>
213
- </g>)}
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
+ {/* )} */}
214
230
 
215
231
  {/* TO dot */}
216
- {isSel && (<g>
217
- {isDraggingTo && (<circle cx={toPos.x} cy={toPos.y} r={12} fill="#22c55e" opacity={0.15} style={{ pointerEvents: "none" }}/>)}
232
+ {/* {isSel && ( */}
233
+ <g>
234
+ {isDraggingTo && (<circle cx={toPos.x} cy={toPos.y} r={12} fill="#7239EA" opacity={0.15} style={{ pointerEvents: "none" }}/>)}
218
235
  <circle cx={toPos.x} cy={toPos.y} r={10} fill="transparent" style={{ cursor: "grab" }} onMouseDown={(e) => {
219
- e.stopPropagation();
220
- onStartDragAnchor(e, edge.id, "to");
221
- }}/>
222
- <circle cx={toPos.x} cy={toPos.y} r={6} fill={isDraggingTo ? "#a78bfa" : "#22c55e"} stroke="#0f172a" strokeWidth={1.5} style={{ pointerEvents: "none" }}/>
223
- <circle cx={toPos.x} cy={toPos.y} r={2.5} fill="#0f172a" style={{ pointerEvents: "none" }}/>
224
- </g>)}
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
+ {/* )} */}
225
252
 
226
253
  {/* Waypoints */}
227
254
  {((_a = edge.waypoints) !== null && _a !== void 0 ? _a : []).map((wp, i) => (<g key={`wp-${i}`}>
@@ -265,7 +292,7 @@ export const ConnectionLayer = ({ edges, selectedEdge, connecting, draggingAncho
265
292
  {/* Preview saat connecting */}
266
293
  {connecting &&
267
294
  (() => {
268
- const findSourceTarget = renderedElements === null || renderedElements === void 0 ? void 0 : renderedElements.find((el) => el.id === connecting.fromId);
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; });
269
296
  if (!findSourceTarget)
270
297
  return null;
271
298
  const { x, y, rotation, width, height } = findSourceTarget;
@@ -116,6 +116,10 @@ export interface LayerViewProps<TMeta = undefined> {
116
116
  onHoldTable?: (e: React.PointerEvent<SVGSVGElement>, component: ComponentProps<TMeta>[]) => void;
117
117
  showConnection?: boolean;
118
118
  initialEdges?: EdgeType[];
119
+ connectionMatchKey?: {
120
+ key: string;
121
+ value: string | number;
122
+ };
119
123
  }
120
124
  declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
121
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, showConnection } = 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);
@@ -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.id) == id;
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,
@@ -662,7 +663,7 @@ const LayerView = (props) => {
662
663
  const viewBox = isValidBoundingBox
663
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)}`
664
665
  : "0 0 1000 1000";
665
- const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [
666
+ const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection, graph.edges, connectionMatchKey), [
666
667
  componentsEditor,
667
668
  mappingKey,
668
669
  tableMatchKey,
@@ -671,6 +672,8 @@ const LayerView = (props) => {
671
672
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection,
672
673
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey,
673
674
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
675
+ graph.edges,
676
+ connectionMatchKey
674
677
  ]);
675
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(),
676
679
  // onDrop={(e) => handleTableEvent(e, "drop")}
@@ -684,12 +687,12 @@ const LayerView = (props) => {
684
687
  userSelect: "none",
685
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,
686
689
  // iconTags={iconTags}
687
- 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 }), renderedElements.map((item) => {
688
- 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;
689
692
  const rotated = rotatePoint(item.width / 2, item.height / 2, (_a = item.rotation) !== null && _a !== void 0 ? _a : 0);
690
693
  return (_jsx(ConnectHandle, {
691
694
  // isAnchor={true}
692
- 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) => {
693
696
  if (graph.draggingAnchor)
694
697
  graph.updateAnchor(nodeId, clickPos);
695
698
  else
@@ -28,7 +28,7 @@ const LayerView = (props) => {
28
28
  selectNode: false,
29
29
  connectingNode: false,
30
30
  dragTransferTable: false,
31
- }, onMakeSelection, groupSelection, onHoldTable, showConnection } = props;
31
+ }, onMakeSelection, groupSelection, onHoldTable, showConnection, connectionMatchKey } = props;
32
32
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
33
33
  const tableGhost = useRef(null);
34
34
  const hoverUnderghostId = useRef(null);
@@ -617,11 +617,12 @@ const LayerView = (props) => {
617
617
  };
618
618
  // ─── Node helper ──────────────────────────────────────────────────────────
619
619
  const getNodeById = useCallback((id) => {
620
- var _a, _b, _c;
620
+ var _a, _b, _c, _d;
621
621
  const comp = componentsEditor.find((item) => {
622
+ var _a, _b, _c;
622
623
  if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey]))
623
- return item[mappingKey].id == id;
624
- return (item === null || item === void 0 ? void 0 : item.id) == id;
624
+ 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;
625
+ 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;
625
626
  });
626
627
  if (!comp)
627
628
  return null;
@@ -631,7 +632,7 @@ const LayerView = (props) => {
631
632
  const rotation = (_c = v.rotation) !== null && _c !== void 0 ? _c : 0;
632
633
  const rotated = rotatePoint(w / 2, h / 2, rotation);
633
634
  return {
634
- id: String(v.id),
635
+ 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),
635
636
  x: v.x + rotated.x,
636
637
  y: v.y + rotated.y,
637
638
  width: w,
@@ -661,7 +662,7 @@ const LayerView = (props) => {
661
662
  const viewBox = isValidBoundingBox
662
663
  ? `${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
664
  : "0 0 1000 1000";
664
- const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection), [
665
+ const renderedElements = useMemo(() => renderElements(componentsEditor, mappingKey, tableMatchKey, graph.connecting, groupSelection, graph.edges, connectionMatchKey), [
665
666
  componentsEditor,
666
667
  mappingKey,
667
668
  tableMatchKey,
@@ -670,6 +671,8 @@ const LayerView = (props) => {
670
671
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection,
671
672
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey,
672
673
  groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection,
674
+ graph.edges,
675
+ connectionMatchKey
673
676
  ]);
674
677
  return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{ overflow: "auto", WebkitOverflowScrolling: "touch" }} {...props.containerProps}>
675
678
  {loading && (<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">
@@ -703,14 +706,14 @@ const LayerView = (props) => {
703
706
  eventMatchTable={eventMatchTable} privilegedTags={privilegedTags} selectionLines={selectedLines}/>
704
707
  </g>
705
708
 
706
- <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}/>
709
+ <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}/>
707
710
 
708
711
  {renderedElements.map((item) => {
709
- var _a, _b, _c, _d;
712
+ var _a, _b, _c, _d, _e;
710
713
  const rotated = rotatePoint(item.width / 2, item.height / 2, (_a = item.rotation) !== null && _a !== void 0 ? _a : 0);
711
714
  return (<ConnectHandle key={item.id}
712
715
  // isAnchor={true}
713
- 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) => {
716
+ 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) => {
714
717
  if (graph.draggingAnchor)
715
718
  graph.updateAnchor(nodeId, clickPos);
716
719
  else
@@ -170,6 +170,7 @@ export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey,
170
170
  }, [edges]);
171
171
  // initialize edges
172
172
  useEffect(() => {
173
+ var _a;
173
174
  if (initialEdges) {
174
175
  //process initial edges
175
176
  const allElements = components === null || components === void 0 ? void 0 : components.map((table) => {
@@ -181,7 +182,7 @@ export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey,
181
182
  // const findSourceTarget = allElements?.find(
182
183
  // (el) => el.id === connecting.fromId
183
184
  // );
184
- const transformAllEdges = initialEdges === null || initialEdges === void 0 ? void 0 : initialEdges.map((edge) => {
185
+ const transformAllEdges = (_a = initialEdges === null || initialEdges === void 0 ? void 0 : initialEdges.filter((edge) => (edge === null || edge === void 0 ? void 0 : edge.status) === 1)) === null || _a === void 0 ? void 0 : _a.map((edge) => {
185
186
  const fromElement = allElements === null || allElements === void 0 ? void 0 : allElements.find((el) => el.id === edge.from);
186
187
  if (!fromElement)
187
188
  return null;
@@ -213,6 +214,7 @@ export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey,
213
214
  const fromPos = {
214
215
  x: fromCx + fromLx * Math.cos(rad) - fromLy * Math.sin(rad),
215
216
  y: fromCy + fromLx * Math.sin(rad) + fromLy * Math.cos(rad),
217
+ name: edge.fromPos.name,
216
218
  };
217
219
  const toElement = allElements === null || allElements === void 0 ? void 0 : allElements.find((el) => el.id === edge.to);
218
220
  if (!toElement)
@@ -245,10 +247,12 @@ export const useConnectionGraph = ({ svgRef, onEdgesChange, keyNode, mappingKey,
245
247
  const toPos = {
246
248
  x: toCx + toLx * Math.cos(rad2) - toLy * Math.sin(rad2),
247
249
  y: toCy + toLx * Math.sin(rad2) + toLy * Math.cos(rad2),
250
+ name: edge.toPos.name,
248
251
  };
249
252
  return Object.assign(Object.assign({}, edge), { from: fromElement.id, to: toElement.id, fromPos,
250
253
  toPos });
251
254
  });
255
+ setEdges(transformAllEdges === null || transformAllEdges === void 0 ? void 0 : transformAllEdges.filter((el) => el !== null));
252
256
  }
253
257
  }, [initialEdges]);
254
258
  return {
@@ -21,6 +21,7 @@ export type EdgeType = {
21
21
  x: number;
22
22
  y: number;
23
23
  }[];
24
+ status?: number;
24
25
  };
25
26
  export type NodeType = {
26
27
  id: string;
@@ -61,4 +62,7 @@ export declare const renderElements: (elementEditor: ComponentProps[], mappingKe
61
62
  colorGroupSelection: string[];
62
63
  dataKey: string;
63
64
  selection: Record<number, string[]>;
65
+ }, edges?: EdgeType[], connectionMatchKey?: {
66
+ key: string;
67
+ value: string | number;
64
68
  }) => ComponentProps[];
@@ -71,7 +71,11 @@ const findIndexByValue = (obj, targetValue) => {
71
71
  const foundEntry = Object.entries(obj).find(([_, values]) => values.includes(targetValue));
72
72
  return foundEntry ? Number(foundEntry[0]) : undefined;
73
73
  };
74
- export const renderElements = (elementEditor, mappingKey, tableMatchKey, connecting, groupSelection) => {
74
+ export const renderElements = (elementEditor, mappingKey, tableMatchKey, connecting, groupSelection, edges, connectionMatchKey) => {
75
+ var _a;
76
+ const allIDFromIdConnection = ((_a = edges === null || edges === void 0 ? void 0 : edges.filter((edge) => edge.from === (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) || edge.to === (connecting === null || connecting === void 0 ? void 0 : connecting.fromId)
77
+ //bikin ed.to di merge dengan ed.from
78
+ )) === null || _a === void 0 ? void 0 : _a.map((edge) => edge.to === (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) ? edge.from : edge.to)) || [];
75
79
  return elementEditor.map((editorItem) => {
76
80
  var _a, _b;
77
81
  const isUsingMapping = mappingKey &&
@@ -84,9 +88,10 @@ export const renderElements = (elementEditor, mappingKey, tableMatchKey, connect
84
88
  if (hasKey)
85
89
  return item.value == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[item.key]);
86
90
  });
87
- // console.log({ finalProps })
88
91
  const findIndexSelection = findIndexByValue(groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection, finalProps === null || finalProps === void 0 ? void 0 : finalProps[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]);
89
92
  let fill = finalProps === null || finalProps === void 0 ? void 0 : finalProps.fill;
93
+ let stroke = finalProps === null || finalProps === void 0 ? void 0 : finalProps.stroke;
94
+ let seatFill = finalProps === null || finalProps === void 0 ? void 0 : finalProps.seatFill;
90
95
  if (findIndexSelection !== undefined) {
91
96
  fill = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
92
97
  }
@@ -94,13 +99,20 @@ export const renderElements = (elementEditor, mappingKey, tableMatchKey, connect
94
99
  fill = (_b = tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties) === null || _b === void 0 ? void 0 : _b.fill;
95
100
  }
96
101
  if ((connecting === null || connecting === void 0 ? void 0 : connecting.fromId) == (finalProps === null || finalProps === void 0 ? void 0 : finalProps.id)) {
97
- fill = "#7239EA";
102
+ fill = "#F8F5FF";
103
+ stroke = "#5014D0";
104
+ }
105
+ if ((allIDFromIdConnection === null || allIDFromIdConnection === void 0 ? void 0 : allIDFromIdConnection.includes(finalProps === null || finalProps === void 0 ? void 0 : finalProps.id)) && (connecting === null || connecting === void 0 ? void 0 : connecting.fromId) !== (finalProps === null || finalProps === void 0 ? void 0 : finalProps.id)) {
106
+ fill = "#EEF6FF";
107
+ stroke = "#3E97FF";
108
+ seatFill = "#3E97FF";
109
+ }
110
+ finalProps = Object.assign(Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties), { fill: fill, stroke, className: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.className, element: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.element });
111
+ }
112
+ if (connectionMatchKey) {
113
+ if (!(finalProps === null || finalProps === void 0 ? void 0 : finalProps[connectionMatchKey.key])) {
114
+ finalProps = Object.assign(Object.assign({}, finalProps), { [connectionMatchKey.key]: editorItem === null || editorItem === void 0 ? void 0 : editorItem[connectionMatchKey.key] });
98
115
  }
99
- // fill =
100
- // connecting?.fromId == finalProps?.id
101
- // ? "#7239EA"
102
- // : tableMatch?.properties?.fill ?? finalProps?.fill;
103
- finalProps = Object.assign(Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties), { fill: fill, className: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.className, element: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.element });
104
116
  }
105
117
  return finalProps;
106
118
  });
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.6.27",
3
+ "version": "3.6.28",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
7
10
  "files": [
8
11
  "dist"
9
12
  ],