jch-config-editor 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as h, jsx as e, Fragment as Oe } from "react/jsx-runtime";
2
- import Ce, { useState as Q, useRef as ue, useMemo as Xt, useCallback as V, useEffect as me } from "react";
2
+ import Ce, { useState as ee, useRef as ue, useEffect as he, useMemo as Xt, useCallback as V } from "react";
3
3
  import { Typography as Pt, Upload as Tt, Button as Z, Collapse as Ne, List as $e, Empty as pe, Tag as ye, Image as qt, Space as be, Tooltip as Le, Modal as it, Form as w, Input as re, InputNumber as te, Switch as Je, message as Ye, Divider as Me, Select as Ie, Tabs as Rt, ConfigProvider as Bt, Layout as ht } from "antd";
4
4
  import { UploadOutlined as mt, EditOutlined as ft, DeleteOutlined as ot, UndoOutlined as Vt, RedoOutlined as Zt, CopyOutlined as _t, GroupOutlined as vt, UngroupOutlined as Jt, AlignLeftOutlined as Kt, AlignRightOutlined as Qt, VerticalAlignTopOutlined as en, VerticalAlignBottomOutlined as tn, ColumnWidthOutlined as nn, ColumnHeightOutlined as ln, SettingOutlined as rn, ExperimentOutlined as an, ZoomInOutlined as on, ZoomOutOutlined as sn, CloseOutlined as cn, SelectOutlined as dn, DragOutlined as un, EyeOutlined as hn, PlusOutlined as zt, ArrowUpOutlined as Ot, ArrowDownOutlined as At, DownloadOutlined as mn } from "@ant-design/icons";
5
5
  import { create as fn } from "zustand";
@@ -677,8 +677,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
677
677
  }));
678
678
  let c = 1 / 0, n = 1 / 0, a = -1 / 0, i = -1 / 0;
679
679
  r.forEach((d) => {
680
- const m = d.normalStyle.x || 0, S = d.normalStyle.y || 0, u = d.normalStyle.width || 0, k = d.normalStyle.height || 0;
681
- c = Math.min(c, m), n = Math.min(n, S), a = Math.max(a, m + u), i = Math.max(i, S + k);
680
+ const m = d.normalStyle.x || 0, S = d.normalStyle.y || 0, u = d.normalStyle.width || 0, E = d.normalStyle.height || 0;
681
+ c = Math.min(c, m), n = Math.min(n, S), a = Math.max(a, m + u), i = Math.max(i, S + E);
682
682
  });
683
683
  const p = r.map((d) => ({
684
684
  ...d,
@@ -748,21 +748,21 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
748
748
  lineDrawing: a,
749
749
  startLineDrawing: i,
750
750
  cancelLineDrawing: p
751
- } = ze(), [d, m] = Q([
751
+ } = ze(), [d, m] = ee([
752
752
  "basic",
753
753
  "device",
754
754
  "text",
755
755
  "line"
756
756
  ]), S = (g) => {
757
- const W = new FileReader();
758
- return W.onload = (O) => {
757
+ const F = new FileReader();
758
+ return F.onload = (O) => {
759
759
  const X = O.target?.result;
760
760
  f({
761
761
  name: g.name.replace(".svg", ""),
762
762
  type: "IMAGE",
763
763
  src: X
764
764
  });
765
- }, W.readAsDataURL(g), !1;
765
+ }, F.readAsDataURL(g), !1;
766
766
  }, u = {
767
767
  basic: l.filter(
768
768
  (g) => ["矩形", "圆形", "圆角矩形"].includes(g.name)
@@ -776,21 +776,21 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
776
776
  custom: l.filter(
777
777
  (g) => g.type === "CUSTOM" && !g.config?.nodes || g.type === "IMAGE" && !["矩形", "圆形", "圆角矩形", "阀门", "泵", "罐体"].includes(g.name)
778
778
  )
779
- }, k = (g, W) => {
780
- g.dataTransfer.effectAllowed = "copy", g.dataTransfer.setData("application/json", JSON.stringify(W));
779
+ }, E = (g, F) => {
780
+ g.dataTransfer.effectAllowed = "copy", g.dataTransfer.setData("application/json", JSON.stringify(F));
781
781
  const O = g.currentTarget.querySelector(
782
782
  ".material-preview"
783
783
  );
784
784
  O && g.dataTransfer.setDragImage(O, 20, 20);
785
785
  }, v = (g) => {
786
786
  g.type === "LINE" && i(g);
787
- }, I = (g, W = !1) => {
788
- const O = W === !0, X = n === "line-draw" && O && a.material?.id === g.id;
787
+ }, I = (g, F = !1) => {
788
+ const O = F === !0, X = n === "line-draw" && O && a.material?.id === g.id;
789
789
  return /* @__PURE__ */ e(
790
790
  $e.Item,
791
791
  {
792
792
  draggable: !O,
793
- onDragStart: ($) => k($, g),
793
+ onDragStart: ($) => E($, g),
794
794
  onClick: () => O && v(g),
795
795
  className: `
796
796
  rounded-lg transition-all duration-200 select-none
@@ -1060,11 +1060,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1060
1060
  value: m,
1061
1061
  valueSourceCode: S,
1062
1062
  unit: u,
1063
- decimals: k,
1063
+ decimals: E,
1064
1064
  labelStyle: v,
1065
1065
  valueStyle: I,
1066
1066
  customStyle: g
1067
- } = p.content || {}, { value: W, unit: O } = S ? Pn(f, S) : { value: void 0, unit: void 0 }, $ = Tn(W !== void 0 ? W : m, k), L = u || O || "";
1067
+ } = p.content || {}, { value: F, unit: O } = S ? Pn(f, S) : { value: void 0, unit: void 0 }, $ = Tn(F !== void 0 ? F : m, E), L = u || O || "";
1068
1068
  return /* @__PURE__ */ h(
1069
1069
  "div",
1070
1070
  {
@@ -1108,14 +1108,14 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1108
1108
  color: we = "#d9d9d9",
1109
1109
  dashed: ie = !1,
1110
1110
  lineType: A = ie ? "dashed" : "solid",
1111
- lineWeight: J = ne,
1111
+ lineWeight: K = ne,
1112
1112
  // 起点和终点的相对坐标
1113
1113
  startX: G = 0,
1114
1114
  startY: T = 0,
1115
1115
  endX: s = 100,
1116
1116
  endY: q = 0
1117
1117
  } = xe.config || {}, Y = ((je) => {
1118
- const j = Math.max(J, 1);
1118
+ const j = Math.max(K, 1);
1119
1119
  switch (je) {
1120
1120
  case "solid":
1121
1121
  return "";
@@ -1149,7 +1149,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1149
1149
  x2: s,
1150
1150
  y2: q,
1151
1151
  stroke: "transparent",
1152
- strokeWidth: Math.max(J, 10),
1152
+ strokeWidth: Math.max(K, 10),
1153
1153
  strokeLinecap: "round",
1154
1154
  strokeLinejoin: "round",
1155
1155
  style: { pointerEvents: "stroke", cursor: "pointer" }
@@ -1163,7 +1163,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1163
1163
  x2: s,
1164
1164
  y2: q,
1165
1165
  stroke: M,
1166
- strokeWidth: J,
1166
+ strokeWidth: K,
1167
1167
  strokeDasharray: Y,
1168
1168
  strokeLinecap: "round",
1169
1169
  strokeLinejoin: "round",
@@ -1174,8 +1174,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1174
1174
  }
1175
1175
  ) });
1176
1176
  case "CUSTOM":
1177
- const ee = l;
1178
- return ee.render ? ee.render({}) : /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "自定义组件" }) });
1177
+ const J = l;
1178
+ return J.render ? J.render({}) : /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "自定义组件" }) });
1179
1179
  default:
1180
1180
  return /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "未知类型" }) });
1181
1181
  }
@@ -1188,19 +1188,21 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1188
1188
  onUpdateNode: n,
1189
1189
  scale: a = 1
1190
1190
  }) => {
1191
- const { normalStyle: i, contentInfo: p, controlInfo: d } = l, { statusList: m } = p, { isClickable: S, isDraggable: u, isResizable: k } = d, v = ue(t);
1192
- v.current = t;
1193
- const [I, g] = Q(null), W = ue(null), O = ue(null), X = ue(null), $ = ue(null), [L, xe] = Q(null), [ne, we] = Q(null), ie = ue(null), A = Xt(() => {
1191
+ const { normalStyle: i, contentInfo: p, controlInfo: d } = l, { statusList: m } = p, { isClickable: S, isDraggable: u, isResizable: E } = d, v = ue(t);
1192
+ he(() => {
1193
+ v.current = t;
1194
+ }, [t]);
1195
+ const [I, g] = ee(null), F = ue(null), O = ue(null), X = ue(null), $ = ue(null), [L, xe] = ee(null), [ne, we] = ee(null), ie = ue(null), A = Xt(() => {
1194
1196
  if (m.length === 0) return;
1195
1197
  const C = Xn(m, c);
1196
1198
  return C || m[0];
1197
- }, [m, c]), J = A?.material, G = J?.type === "LINE", T = G ? J.config : null, s = i.scale ?? 1, q = (i.width || 100) * s, b = (i.height || 100) * s, Y = V(() => {
1199
+ }, [m, c]), K = A?.material, G = K?.type === "LINE", T = G ? K.config : null, s = i.scale ?? 1, q = (i.width || 100) * s, x = (i.height || 100) * s, Y = V(() => {
1198
1200
  const C = $.current?.closest('[data-canvas="true"]');
1199
1201
  if (!C) return a;
1200
1202
  const z = C.getBoundingClientRect(), R = parseFloat(C.style.width);
1201
1203
  return R ? z.width / R : a;
1202
1204
  }, [a]), M = V((C, z) => {
1203
- C.stopPropagation(), C.preventDefault(), W.current = {
1205
+ C.stopPropagation(), C.preventDefault(), F.current = {
1204
1206
  mouseX: C.clientX,
1205
1207
  mouseY: C.clientY,
1206
1208
  startX: T?.startX || 0,
@@ -1211,31 +1213,31 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1211
1213
  nodeY: i.y || 0
1212
1214
  }, g(z);
1213
1215
  }, [T, i.x, i.y]);
1214
- me(() => {
1216
+ he(() => {
1215
1217
  if (!I || !G || !T || !n) return;
1216
1218
  const C = (R) => {
1217
- const D = W.current;
1219
+ const D = F.current;
1218
1220
  if (!D || !$.current) return;
1219
- const he = Y(), fe = (R.clientX - D.mouseX) / he, ae = (R.clientY - D.mouseY) / he;
1220
- let K = D.startX, oe = D.startY, se = D.endX, ce = D.endY, Xe = D.nodeX, Pe = D.nodeY;
1221
- I === "start" ? (K = D.startX + fe, oe = D.startY + ae, K < 0 && (Xe = D.nodeX + K, se = D.endX - K, K = 0), oe < 0 && (Pe = D.nodeY + oe, ce = D.endY - oe, oe = 0)) : (se = D.endX + fe, ce = D.endY + ae, se < 0 && (Xe = D.nodeX + se, K = D.startX - se, se = 0), ce < 0 && (Pe = D.nodeY + ce, oe = D.startY - ce, ce = 0));
1222
- const et = Math.max((T.lineWeight || 2) * 2, 4), tt = Math.max(K, se), nt = Math.max(oe, ce), We = Math.max(tt, et), Te = Math.max(nt, et);
1221
+ const me = Y(), fe = (R.clientX - D.mouseX) / me, ae = (R.clientY - D.mouseY) / me;
1222
+ let Q = D.startX, oe = D.startY, se = D.endX, ce = D.endY, Xe = D.nodeX, Pe = D.nodeY;
1223
+ I === "start" ? (Q = D.startX + fe, oe = D.startY + ae, Q < 0 && (Xe = D.nodeX + Q, se = D.endX - Q, Q = 0), oe < 0 && (Pe = D.nodeY + oe, ce = D.endY - oe, oe = 0)) : (se = D.endX + fe, ce = D.endY + ae, se < 0 && (Xe = D.nodeX + se, Q = D.startX - se, se = 0), ce < 0 && (Pe = D.nodeY + ce, oe = D.startY - ce, ce = 0));
1224
+ const et = Math.max((T.lineWeight || 2) * 2, 4), tt = Math.max(Q, se), nt = Math.max(oe, ce), We = Math.max(tt, et), Te = Math.max(nt, et);
1223
1225
  O.current = {
1224
1226
  nodeX: Xe,
1225
1227
  nodeY: Pe,
1226
1228
  width: We,
1227
1229
  height: Te,
1228
- startX: K,
1230
+ startX: Q,
1229
1231
  startY: oe,
1230
1232
  endX: se,
1231
1233
  endY: ce
1232
1234
  };
1233
1235
  const ge = $.current;
1234
1236
  ge.style.left = `${Xe}px`, ge.style.top = `${Pe}px`, ge.style.width = `${We}px`, ge.style.height = `${Te}px`, ge.querySelectorAll("svg line").forEach((o) => {
1235
- o.setAttribute("x1", String(K)), o.setAttribute("y1", String(oe)), o.setAttribute("x2", String(se)), o.setAttribute("y2", String(ce));
1237
+ o.setAttribute("x1", String(Q)), o.setAttribute("y1", String(oe)), o.setAttribute("x2", String(se)), o.setAttribute("y2", String(ce));
1236
1238
  });
1237
1239
  const Fe = ge.querySelector('[data-handle="start"]'), De = ge.querySelector('[data-handle="end"]');
1238
- Fe && (Fe.style.left = `${K - 6}px`, Fe.style.top = `${oe - 6}px`), De && (De.style.left = `${se - 6}px`, De.style.top = `${ce - 6}px`);
1240
+ Fe && (Fe.style.left = `${Q - 6}px`, Fe.style.top = `${oe - 6}px`), De && (De.style.left = `${se - 6}px`, De.style.top = `${ce - 6}px`);
1239
1241
  }, z = () => {
1240
1242
  const R = O.current;
1241
1243
  R && n(l.id, {
@@ -1262,34 +1264,34 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1262
1264
  } : D.material
1263
1265
  }))
1264
1266
  }
1265
- }), g(null), W.current = null, O.current = null;
1267
+ }), g(null), F.current = null, O.current = null;
1266
1268
  };
1267
1269
  return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1268
1270
  window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1269
1271
  };
1270
- }, [I, G, T, l.id, i, p, m, n, Y]), me(() => {
1272
+ }, [I, G, T, l.id, i, p, m, n, Y]), he(() => {
1271
1273
  if (!L || !n) return;
1272
1274
  const C = (R) => {
1273
1275
  if (!$.current) return;
1274
- const D = Y(), he = (R.clientX - L.startX) / D, fe = (R.clientY - L.startY) / D;
1275
- let ae = L.startWidth, K = L.startHeight, oe = L.startNodeX, se = L.startNodeY;
1276
+ const D = Y(), me = (R.clientX - L.startX) / D, fe = (R.clientY - L.startY) / D;
1277
+ let ae = L.startWidth, Q = L.startHeight, oe = L.startNodeX, se = L.startNodeY;
1276
1278
  switch (L.corner) {
1277
1279
  case "se":
1278
- ae = Math.max(20, L.startWidth + he), K = Math.max(20, L.startHeight + fe);
1280
+ ae = Math.max(20, L.startWidth + me), Q = Math.max(20, L.startHeight + fe);
1279
1281
  break;
1280
1282
  case "sw":
1281
- ae = Math.max(20, L.startWidth - he), K = Math.max(20, L.startHeight + fe), oe = L.startNodeX + (L.startWidth - ae);
1283
+ ae = Math.max(20, L.startWidth - me), Q = Math.max(20, L.startHeight + fe), oe = L.startNodeX + (L.startWidth - ae);
1282
1284
  break;
1283
1285
  case "ne":
1284
- ae = Math.max(20, L.startWidth + he), K = Math.max(20, L.startHeight - fe), se = L.startNodeY + (L.startHeight - K);
1286
+ ae = Math.max(20, L.startWidth + me), Q = Math.max(20, L.startHeight - fe), se = L.startNodeY + (L.startHeight - Q);
1285
1287
  break;
1286
1288
  case "nw":
1287
- ae = Math.max(20, L.startWidth - he), K = Math.max(20, L.startHeight - fe), oe = L.startNodeX + (L.startWidth - ae), se = L.startNodeY + (L.startHeight - K);
1289
+ ae = Math.max(20, L.startWidth - me), Q = Math.max(20, L.startHeight - fe), oe = L.startNodeX + (L.startWidth - ae), se = L.startNodeY + (L.startHeight - Q);
1288
1290
  break;
1289
1291
  }
1290
- X.current = { x: oe, y: se, width: ae, height: K };
1292
+ X.current = { x: oe, y: se, width: ae, height: Q };
1291
1293
  const ce = $.current;
1292
- ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${K}px`;
1294
+ ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${Q}px`;
1293
1295
  }, z = () => {
1294
1296
  const R = X.current;
1295
1297
  R && n(l.id, {
@@ -1306,7 +1308,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1306
1308
  window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1307
1309
  };
1308
1310
  }, [L, n, l.id, i, Y]);
1309
- const ee = V((C, z) => {
1311
+ const J = V((C, z) => {
1310
1312
  C.stopPropagation(), C.preventDefault(), xe({
1311
1313
  corner: z,
1312
1314
  startX: C.clientX,
@@ -1327,14 +1329,14 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1327
1329
  centerY: z.top + z.height / 2
1328
1330
  });
1329
1331
  }, [i.rotate]);
1330
- me(() => {
1332
+ he(() => {
1331
1333
  if (!ne) return;
1332
1334
  const C = (R) => {
1333
- const D = R.clientX - ne.centerX, he = R.clientY - ne.centerY;
1334
- let ae = (Math.atan2(he, D) * (180 / Math.PI) + 90) % 360;
1335
+ const D = R.clientX - ne.centerX, me = R.clientY - ne.centerY;
1336
+ let ae = (Math.atan2(me, D) * (180 / Math.PI) + 90) % 360;
1335
1337
  if (ae < 0 && (ae += 360), ie.current = ae, $.current) {
1336
- const K = i.transform || "";
1337
- $.current.style.transform = `rotate(${ae}deg) ${K}`.trim();
1338
+ const Q = i.transform || "";
1339
+ $.current.style.transform = `rotate(${ae}deg) ${Q}`.trim();
1338
1340
  }
1339
1341
  }, z = () => {
1340
1342
  const R = ie.current ?? ne.startAngle;
@@ -1354,7 +1356,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1354
1356
  left: i.x || 0,
1355
1357
  top: i.y || 0,
1356
1358
  width: q,
1357
- height: b,
1359
+ height: x,
1358
1360
  // 群组节点不显示背景和边框,只作为容器
1359
1361
  background: j ? "transparent" : i.background || "transparent",
1360
1362
  backgroundImage: j ? void 0 : i.backgroundImage ? `url(${i.backgroundImage})` : void 0,
@@ -1398,7 +1400,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1398
1400
  {
1399
1401
  className: "absolute top-0 left-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1400
1402
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "nw-resize", marginTop: "-6px", marginLeft: "-6px" },
1401
- onMouseDown: (C) => ee(C, "nw"),
1403
+ onMouseDown: (C) => J(C, "nw"),
1402
1404
  title: "拖拽调整大小"
1403
1405
  }
1404
1406
  ),
@@ -1407,7 +1409,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1407
1409
  {
1408
1410
  className: "absolute top-0 right-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1409
1411
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "ne-resize", marginTop: "-6px", marginRight: "-6px" },
1410
- onMouseDown: (C) => ee(C, "ne"),
1412
+ onMouseDown: (C) => J(C, "ne"),
1411
1413
  title: "拖拽调整大小"
1412
1414
  }
1413
1415
  ),
@@ -1416,7 +1418,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1416
1418
  {
1417
1419
  className: "absolute bottom-0 left-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1418
1420
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "sw-resize", marginBottom: "-6px", marginLeft: "-6px" },
1419
- onMouseDown: (C) => ee(C, "sw"),
1421
+ onMouseDown: (C) => J(C, "sw"),
1420
1422
  title: "拖拽调整大小"
1421
1423
  }
1422
1424
  ),
@@ -1425,7 +1427,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1425
1427
  {
1426
1428
  className: "absolute bottom-0 right-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1427
1429
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "se-resize", marginBottom: "-6px", marginRight: "-6px" },
1428
- onMouseDown: (C) => ee(C, "se"),
1430
+ onMouseDown: (C) => J(C, "se"),
1429
1431
  title: "拖拽调整大小"
1430
1432
  }
1431
1433
  ),
@@ -1482,7 +1484,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1482
1484
  ),
1483
1485
  /* @__PURE__ */ e("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: l.name })
1484
1486
  ] }),
1485
- /* @__PURE__ */ e("div", { className: "w-full h-full relative", children: J ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Rn(J, c, f) }) : j ? null : (
1487
+ /* @__PURE__ */ e("div", { className: "w-full h-full relative", children: K ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Rn(K, c, f) }) : j ? null : (
1486
1488
  // 只有非群组节点才显示"无状态"
1487
1489
  /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center text-gray-300 text-xs", children: "无状态" })
1488
1490
  ) }),
@@ -1524,10 +1526,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1524
1526
  onChange: f,
1525
1527
  onChangeComplete: t
1526
1528
  }) => {
1527
- const [r, c] = Q(!1), [n, a] = Q(l), i = ue(null);
1528
- me(() => {
1529
+ const [r, c] = ee(!1), [n, a] = ee(l), i = ue(null);
1530
+ he(() => {
1529
1531
  a(l);
1530
- }, [l]), me(() => {
1532
+ }, [l]), he(() => {
1531
1533
  const d = (m) => {
1532
1534
  i.current && !i.current.contains(m.target) && (c(!1), t?.({ toHexString: () => n }));
1533
1535
  };
@@ -1614,38 +1616,40 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1614
1616
  setViewport: m,
1615
1617
  setCanvasConfig: S,
1616
1618
  addNode: u,
1617
- selectNode: k,
1619
+ selectNode: E,
1618
1620
  updateNode: v,
1619
1621
  removeNode: I,
1620
1622
  undo: g,
1621
- redo: W,
1623
+ redo: F,
1622
1624
  setMode: O,
1623
1625
  startLineDrawing: X,
1624
1626
  endLineDrawing: $,
1625
1627
  cancelLineDrawing: L
1626
- } = ze(), [xe, ne] = Q(!1), [, we] = Q({}), ie = ue(a);
1627
- me(() => {
1628
+ } = ze();
1629
+ console.log("selectedNodeId", n);
1630
+ const [xe, ne] = ee(!1), [, we] = ee({}), ie = ue(a);
1631
+ he(() => {
1628
1632
  ie.current = a;
1629
1633
  }, [a]);
1630
- const A = ue(!1), J = ue({ x: 0, y: 0 }), G = ue({ x: 0, y: 0, newX: 0, newY: 0 }), T = ue(null), [s, q] = Q({ start: null, end: null, isDrawing: !1 }), [b, Y] = Q({ start: null, end: null }), [M, ee] = Q([]);
1634
+ const A = ue(!1), K = ue({ x: 0, y: 0 }), G = ue({ x: 0, y: 0, newX: 0, newY: 0 }), T = ue(null), [s, q] = ee({ start: null, end: null, isDrawing: !1 }), [x, Y] = ee({ start: null, end: null }), [M, J] = ee([]);
1631
1635
  ue(!1);
1632
- const [je, j] = Q(!1), [st, Ke] = Q(
1636
+ const [je, j] = ee(!1), [st, Ke] = ee(
1633
1637
  JSON.stringify(l, null, 2)
1634
- ), [Qe, C] = Q(!1), [z, R] = Q(!1), D = V((o, y) => {
1638
+ ), [Qe, C] = ee(!1), [z, R] = ee(!1), D = V((o, y) => {
1635
1639
  if (!t.current) return { x: 0, y: 0 };
1636
- const N = t.current.getBoundingClientRect(), E = o - N.left, x = y - N.top, P = N.width / d.width, F = N.height / d.height, U = E / P, B = x / F;
1640
+ const N = t.current.getBoundingClientRect(), k = o - N.left, b = y - N.top, P = N.width / d.width, W = N.height / d.height, U = k / P, B = b / W;
1637
1641
  return { x: Math.round(U), y: Math.round(B) };
1638
- }, [d.width, d.height]), he = V((o, y) => D(o, y), [D]), fe = V(
1642
+ }, [d.width, d.height]), me = V((o, y) => D(o, y), [D]), fe = V(
1639
1643
  (o, y, N = !0) => {
1640
1644
  if (!i.material) return;
1641
- const E = i.material, x = E.config || {}, P = x.lineWeight || x.thickness || 2, F = Math.min(o.x, y.x), U = Math.min(o.y, y.y), B = Math.round(o.x - F), _ = Math.round(o.y - U), le = Math.round(y.x - F), de = Math.round(y.y - U), ve = Math.max(P * 2, 4), Re = Math.max(Math.abs(o.x - y.x), ve), ke = Math.max(Math.abs(o.y - y.y), ve), lt = {
1642
- ...E,
1645
+ const k = i.material, b = k.config || {}, P = b.lineWeight || b.thickness || 2, W = Math.min(o.x, y.x), U = Math.min(o.y, y.y), B = Math.round(o.x - W), _ = Math.round(o.y - U), le = Math.round(y.x - W), de = Math.round(y.y - U), ve = Math.max(P * 2, 4), Re = Math.max(Math.abs(o.x - y.x), ve), ke = Math.max(Math.abs(o.y - y.y), ve), lt = {
1646
+ ...k,
1643
1647
  id: H(),
1644
1648
  config: {
1645
- color: x.color,
1649
+ color: b.color,
1646
1650
  lineWeight: P,
1647
1651
  thickness: P,
1648
- lineType: x.lineType,
1652
+ lineType: b.lineType,
1649
1653
  startX: B,
1650
1654
  startY: _,
1651
1655
  endX: le,
@@ -1653,12 +1657,12 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1653
1657
  }
1654
1658
  }, Gt = {
1655
1659
  id: H(),
1656
- name: `${E.name}_${Date.now()}`,
1660
+ name: `${k.name}_${Date.now()}`,
1657
1661
  type: "normal",
1658
1662
  normalStyle: {
1659
1663
  width: Re,
1660
1664
  height: ke,
1661
- x: F,
1665
+ x: W,
1662
1666
  y: U,
1663
1667
  background: "transparent"
1664
1668
  },
@@ -1691,11 +1695,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1691
1695
  positionX: o.positionX,
1692
1696
  positionY: o.positionY
1693
1697
  });
1694
- }, [m]), K = V(
1698
+ }, [m]), Q = V(
1695
1699
  (o) => {
1696
- A.current || a !== "box-select" && (o.target === t.current || o.target.dataset?.canvas === "true") && (k(null), ee([]));
1700
+ A.current || a !== "box-select" && (o.target === t.current || o.target.dataset?.canvas === "true") && (E(null), J([]));
1697
1701
  },
1698
- [k, a]
1702
+ [E, a]
1699
1703
  ), oe = V(
1700
1704
  (o) => {
1701
1705
  if (o.button === 0) {
@@ -1706,12 +1710,12 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1706
1710
  return;
1707
1711
  }
1708
1712
  if (a === "box-select" && !z) {
1709
- const y = he(o.clientX, o.clientY);
1710
- Y({ start: y, end: y }), ee([]), o.preventDefault(), o.stopPropagation();
1713
+ const y = me(o.clientX, o.clientY);
1714
+ Y({ start: y, end: y }), J([]), o.preventDefault(), o.stopPropagation();
1711
1715
  }
1712
1716
  }
1713
1717
  },
1714
- [a, i.material, s.isDrawing, s.start, z, fe, D, he]
1718
+ [a, i.material, s.isDrawing, s.start, z, fe, D, me]
1715
1719
  ), se = V(
1716
1720
  (o) => {
1717
1721
  if (!(a !== "line-draw" || !i.material) && s.isDrawing && s.start) {
@@ -1730,8 +1734,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1730
1734
  try {
1731
1735
  const y = o.dataTransfer.getData("application/json");
1732
1736
  if (!y) return;
1733
- const N = JSON.parse(y), E = D(o.clientX, o.clientY), x = E.x - 50, P = E.y - 50, F = $n(x, P, N);
1734
- u(F);
1737
+ const N = JSON.parse(y), k = D(o.clientX, o.clientY), b = k.x - 50, P = k.y - 50, W = $n(b, P, N);
1738
+ u(W), J([W.id]);
1735
1739
  } catch (y) {
1736
1740
  console.error("Failed to parse dropped material:", y);
1737
1741
  }
@@ -1739,61 +1743,61 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1739
1743
  [a, u, D]
1740
1744
  ), et = V(
1741
1745
  (o, y) => {
1742
- a !== "select" && a !== "box-select" || !y.controlInfo.isDraggable || (o.stopPropagation(), k(y.id), A.current = !0, J.current = { x: o.clientX, y: o.clientY }, G.current = {
1746
+ a !== "select" && a !== "box-select" || !y.controlInfo.isDraggable || (o.stopPropagation(), E(y.id), A.current = !0, K.current = { x: o.clientX, y: o.clientY }, G.current = {
1743
1747
  x: y.normalStyle.x || 0,
1744
1748
  y: y.normalStyle.y || 0,
1745
1749
  newX: y.normalStyle.x || 0,
1746
1750
  newY: y.normalStyle.y || 0
1747
1751
  }, T.current = y, o.preventDefault());
1748
1752
  },
1749
- [a, k]
1753
+ [a, E]
1750
1754
  );
1751
- me(() => {
1752
- const o = (x) => {
1755
+ he(() => {
1756
+ const o = (b) => {
1753
1757
  if (A.current && n && T.current) {
1754
1758
  if (!t.current) return;
1755
- const P = t.current.getBoundingClientRect(), F = P.width / d.width, U = P.height / d.height, B = x.clientX - J.current.x, _ = x.clientY - J.current.y, le = B / F, de = _ / U, ve = G.current.x + le, Re = G.current.y + de, ke = document.querySelector(
1759
+ const P = t.current.getBoundingClientRect(), W = P.width / d.width, U = P.height / d.height, B = b.clientX - K.current.x, _ = b.clientY - K.current.y, le = B / W, de = _ / U, ve = G.current.x + le, Re = G.current.y + de, ke = document.querySelector(
1756
1760
  `[data-node-id="${n}"]`
1757
1761
  );
1758
1762
  ke && (ke.style.left = `${ve}px`, ke.style.top = `${Re}px`), G.current.newX = ve, G.current.newY = Re;
1759
1763
  }
1760
- if (a === "box-select" && b.start) {
1761
- const P = he(x.clientX, x.clientY);
1762
- Y((F) => ({ ...F, end: P }));
1764
+ if (a === "box-select" && x.start) {
1765
+ const P = me(b.clientX, b.clientY);
1766
+ Y((W) => ({ ...W, end: P }));
1763
1767
  }
1764
1768
  if (a === "line-draw" && s.isDrawing) {
1765
- const P = D(x.clientX, x.clientY);
1766
- q((F) => ({ ...F, end: P }));
1769
+ const P = D(b.clientX, b.clientY);
1770
+ q((W) => ({ ...W, end: P }));
1767
1771
  }
1768
1772
  }, y = () => {
1769
1773
  if (A.current && n && T.current) {
1770
- const x = ze.getState(), P = G.current.newX ?? G.current.x, F = G.current.newY ?? G.current.y;
1771
- x.updateNode(n, {
1774
+ const b = ze.getState(), P = G.current.newX ?? G.current.x, W = G.current.newY ?? G.current.y;
1775
+ b.updateNode(n, {
1772
1776
  normalStyle: {
1773
1777
  ...T.current.normalStyle,
1774
1778
  x: P,
1775
- y: F
1779
+ y: W
1776
1780
  }
1777
1781
  });
1778
1782
  }
1779
- if (A.current = !1, T.current = null, we({}), a === "box-select" && b.start && b.end) {
1780
- const x = Math.min(b.start.x, b.end.x), P = Math.max(b.start.x, b.end.x), F = Math.min(b.start.y, b.end.y), U = Math.max(b.start.y, b.end.y), B = c.filter((_) => {
1783
+ if (A.current = !1, T.current = null, we({}), a === "box-select" && x.start && x.end) {
1784
+ const b = Math.min(x.start.x, x.end.x), P = Math.max(x.start.x, x.end.x), W = Math.min(x.start.y, x.end.y), U = Math.max(x.start.y, x.end.y), B = c.filter((_) => {
1781
1785
  const le = _.normalStyle.x || 0, de = _.normalStyle.y || 0, ve = _.normalStyle.width || 0, Re = _.normalStyle.height || 0, ke = le + ve / 2, lt = de + Re / 2;
1782
- return ke >= x && ke <= P && lt >= F && lt <= U;
1786
+ return ke >= b && ke <= P && lt >= W && lt <= U;
1783
1787
  }).map((_) => _.id);
1784
- ee(B), Y({ start: null, end: null });
1788
+ J(B), Y({ start: null, end: null });
1785
1789
  }
1786
- }, N = (x) => {
1787
- x.key === "Escape" && a === "line-draw" && (q({ start: null, end: null, isDrawing: !1 }), L()), x.key === "Delete" && (n ? I(n) : M.length > 0 && (M.forEach((P) => I(P)), ee([]))), x.ctrlKey && x.key === "z" && (x.preventDefault(), g()), x.ctrlKey && x.key === "y" && (x.preventDefault(), W()), x.key === " " && !z && (x.preventDefault(), R(!0));
1788
- }, E = (x) => {
1789
- x.key === " " && z && R(!1);
1790
+ }, N = (b) => {
1791
+ b.key === "Escape" && a === "line-draw" && (q({ start: null, end: null, isDrawing: !1 }), L()), b.key === "Delete" && (n ? I(n) : M.length > 0 && (M.forEach((P) => I(P)), J([]))), b.ctrlKey && b.key === "z" && (b.preventDefault(), g()), b.ctrlKey && b.key === "y" && (b.preventDefault(), F()), b.key === " " && !z && (b.preventDefault(), R(!0));
1792
+ }, k = (b) => {
1793
+ b.key === " " && z && R(!1);
1790
1794
  };
1791
- return window.addEventListener("mousemove", o), window.addEventListener("mouseup", y), window.addEventListener("keydown", N), window.addEventListener("keyup", E), () => {
1792
- window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", y), window.removeEventListener("keydown", N), window.removeEventListener("keyup", E);
1795
+ return window.addEventListener("mousemove", o), window.addEventListener("mouseup", y), window.addEventListener("keydown", N), window.addEventListener("keyup", k), () => {
1796
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", y), window.removeEventListener("keydown", N), window.removeEventListener("keyup", k);
1793
1797
  };
1794
1798
  }, [
1795
1799
  n,
1796
- b,
1800
+ x,
1797
1801
  a,
1798
1802
  s.isDrawing,
1799
1803
  M,
@@ -1803,18 +1807,18 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1803
1807
  I,
1804
1808
  g,
1805
1809
  z,
1806
- W,
1810
+ F,
1807
1811
  L,
1808
1812
  D,
1809
- he,
1810
- ee
1813
+ me,
1814
+ J
1811
1815
  ]);
1812
1816
  const tt = V(() => {
1813
- const o = M.length > 0 ? M.map((N) => c.find((E) => E.id === N)).filter(Boolean) : n ? [c.find((N) => N.id === n)].filter(Boolean) : [];
1817
+ const o = M.length > 0 ? M.map((N) => c.find((k) => k.id === N)).filter(Boolean) : n ? [c.find((N) => N.id === n)].filter(Boolean) : [];
1814
1818
  if (o.length === 0) return;
1815
1819
  const y = [];
1816
1820
  o.forEach((N) => {
1817
- const E = {
1821
+ const k = {
1818
1822
  ...N,
1819
1823
  id: H(),
1820
1824
  name: `${N.name}_副本`,
@@ -1824,9 +1828,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1824
1828
  y: (N.normalStyle.y || 0) + 20
1825
1829
  }
1826
1830
  };
1827
- u(E), y.push(E.id);
1828
- }), y.length === 1 ? k(y[0]) : ee(y);
1829
- }, [n, M, c, u, k, ee]), nt = V(() => {
1831
+ u(k), y.push(k.id);
1832
+ }), y.length === 1 ? E(y[0]) : J(y);
1833
+ }, [n, M, c, u, E, J]), nt = V(() => {
1830
1834
  if (M.length < 2) return;
1831
1835
  const o = [];
1832
1836
  for (let U = 0; U < M.length; U++) {
@@ -1847,10 +1851,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1847
1851
  }
1848
1852
  }
1849
1853
  if (o.length < 2) return;
1850
- let y = 1 / 0, N = 1 / 0, E = -1 / 0, x = -1 / 0;
1854
+ let y = 1 / 0, N = 1 / 0, k = -1 / 0, b = -1 / 0;
1851
1855
  o.forEach((U) => {
1852
1856
  const B = U.normalStyle.x || 0, _ = U.normalStyle.y || 0, le = U.normalStyle.width || 0, de = U.normalStyle.height || 0;
1853
- y = Math.min(y, B), N = Math.min(N, _), E = Math.max(E, B + le), x = Math.max(x, _ + de);
1857
+ y = Math.min(y, B), N = Math.min(N, _), k = Math.max(k, B + le), b = Math.max(b, _ + de);
1854
1858
  });
1855
1859
  const P = o.map((U) => ({
1856
1860
  ...U,
@@ -1859,15 +1863,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1859
1863
  x: (U.normalStyle.x || 0) - y,
1860
1864
  y: (U.normalStyle.y || 0) - N
1861
1865
  }
1862
- })), F = {
1866
+ })), W = {
1863
1867
  id: H(),
1864
1868
  name: `群组_${Date.now()}`,
1865
1869
  type: "group",
1866
1870
  normalStyle: {
1867
1871
  x: y,
1868
1872
  y: N,
1869
- width: E - y,
1870
- height: x - N,
1873
+ width: k - y,
1874
+ height: b - N,
1871
1875
  background: "transparent"
1872
1876
  },
1873
1877
  contentInfo: {
@@ -1882,44 +1886,44 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1882
1886
  },
1883
1887
  children: P
1884
1888
  };
1885
- M.forEach((U) => I(U)), u(F), ee([]), k(F.id);
1886
- }, [M, c, I, u, k]), We = V(() => {
1889
+ M.forEach((U) => I(U)), u(W), J([]), E(W.id);
1890
+ }, [M, c, I, u, E]), We = V(() => {
1887
1891
  const o = M.length > 0 ? M.map((y) => c.find((N) => N.id === y)).filter((y) => !!y && y.type === "group") : n ? [c.find((y) => y.id === n)].filter((y) => !!y && y.type === "group") : [];
1888
1892
  o.length !== 0 && (o.forEach((y) => {
1889
1893
  if (!y.children || y.children.length === 0) return;
1890
- const N = y.children.map((E) => ({
1891
- ...E,
1894
+ const N = y.children.map((k) => ({
1895
+ ...k,
1892
1896
  normalStyle: {
1893
- ...E.normalStyle,
1894
- x: (y.normalStyle.x || 0) + (E.normalStyle.x || 0),
1895
- y: (y.normalStyle.y || 0) + (E.normalStyle.y || 0)
1897
+ ...k.normalStyle,
1898
+ x: (y.normalStyle.x || 0) + (k.normalStyle.x || 0),
1899
+ y: (y.normalStyle.y || 0) + (k.normalStyle.y || 0)
1896
1900
  }
1897
1901
  }));
1898
- I(y.id), N.forEach((E) => u(E));
1899
- }), ee([]), k(null));
1900
- }, [n, M, c, I, u, k, ee]), Te = V(
1902
+ I(y.id), N.forEach((k) => u(k));
1903
+ }), J([]), E(null));
1904
+ }, [n, M, c, I, u, E, J]), Te = V(
1901
1905
  (o) => {
1902
1906
  if (M.length < 2) return;
1903
1907
  const y = M.map((B) => c.find((_) => _.id === B)).filter((B) => !!B && B.type !== "group");
1904
1908
  if (y.length < 2) return;
1905
- let N = 1 / 0, E = -1 / 0, x = 1 / 0, P = -1 / 0;
1909
+ let N = 1 / 0, k = -1 / 0, b = 1 / 0, P = -1 / 0;
1906
1910
  y.forEach((B) => {
1907
1911
  const _ = B.normalStyle.x || 0, le = B.normalStyle.y || 0;
1908
- N = Math.min(N, _), E = Math.max(E, _), x = Math.min(x, le), P = Math.max(P, le);
1912
+ N = Math.min(N, _), k = Math.max(k, _), b = Math.min(b, le), P = Math.max(P, le);
1909
1913
  });
1910
- const F = [...y].sort((B, _) => o === "horizontal" ? (B.normalStyle.x || 0) - (_.normalStyle.x || 0) : (B.normalStyle.y || 0) - (_.normalStyle.y || 0)), U = F.length;
1914
+ const W = [...y].sort((B, _) => o === "horizontal" ? (B.normalStyle.x || 0) - (_.normalStyle.x || 0) : (B.normalStyle.y || 0) - (_.normalStyle.y || 0)), U = W.length;
1911
1915
  if (o === "horizontal") {
1912
- const _ = (E - N) / (U - 1);
1913
- F.forEach((le, de) => {
1916
+ const _ = (k - N) / (U - 1);
1917
+ W.forEach((le, de) => {
1914
1918
  const ve = N + _ * de;
1915
1919
  v(le.id, {
1916
1920
  normalStyle: { ...le.normalStyle, x: ve }
1917
1921
  });
1918
1922
  });
1919
1923
  } else {
1920
- const _ = (P - x) / (U - 1);
1921
- F.forEach((le, de) => {
1922
- const ve = x + _ * de;
1924
+ const _ = (P - b) / (U - 1);
1925
+ W.forEach((le, de) => {
1926
+ const ve = b + _ * de;
1923
1927
  v(le.id, {
1924
1928
  normalStyle: { ...le.normalStyle, y: ve }
1925
1929
  });
@@ -1930,45 +1934,45 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1930
1934
  ), ge = V(
1931
1935
  (o) => {
1932
1936
  if (M.length < 2) return;
1933
- const y = ze.getState(), N = M.map((x) => c.find((P) => P.id === x)).filter((x) => !!x && x.type !== "group");
1937
+ const y = ze.getState(), N = M.map((b) => c.find((P) => P.id === b)).filter((b) => !!b);
1934
1938
  if (N.length < 2) return;
1935
- let E = 0;
1939
+ let k = 0;
1936
1940
  switch (o) {
1937
1941
  case "left":
1938
- E = Math.min(...N.map((x) => x.normalStyle.x || 0));
1942
+ k = Math.min(...N.map((b) => b.normalStyle.x || 0));
1939
1943
  break;
1940
1944
  case "right":
1941
- E = Math.max(
1942
- ...N.map((x) => (x.normalStyle.x || 0) + (x.normalStyle.width || 0))
1945
+ k = Math.max(
1946
+ ...N.map((b) => (b.normalStyle.x || 0) + (b.normalStyle.width || 0))
1943
1947
  );
1944
1948
  break;
1945
1949
  case "top":
1946
- E = Math.min(...N.map((x) => x.normalStyle.y || 0));
1950
+ k = Math.min(...N.map((b) => b.normalStyle.y || 0));
1947
1951
  break;
1948
1952
  case "bottom":
1949
- E = Math.max(
1950
- ...N.map((x) => (x.normalStyle.y || 0) + (x.normalStyle.height || 0))
1953
+ k = Math.max(
1954
+ ...N.map((b) => (b.normalStyle.y || 0) + (b.normalStyle.height || 0))
1951
1955
  );
1952
1956
  break;
1953
1957
  }
1954
- N.forEach((x) => {
1955
- let P = x.normalStyle.x || 0, F = x.normalStyle.y || 0;
1958
+ N.forEach((b) => {
1959
+ let P = b.normalStyle.x || 0, W = b.normalStyle.y || 0;
1956
1960
  switch (o) {
1957
1961
  case "left":
1958
- P = E;
1962
+ P = k;
1959
1963
  break;
1960
1964
  case "right":
1961
- P = E - (x.normalStyle.width || 0);
1965
+ P = k - (b.normalStyle.width || 0);
1962
1966
  break;
1963
1967
  case "top":
1964
- F = E;
1968
+ W = k;
1965
1969
  break;
1966
1970
  case "bottom":
1967
- F = E - (x.normalStyle.height || 0);
1971
+ W = k - (b.normalStyle.height || 0);
1968
1972
  break;
1969
1973
  }
1970
- y.updateNode(x.id, {
1971
- normalStyle: { ...x.normalStyle, x: P, y: F }
1974
+ y.updateNode(b.id, {
1975
+ normalStyle: { ...b.normalStyle, x: P, y: W }
1972
1976
  });
1973
1977
  });
1974
1978
  },
@@ -1987,7 +1991,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1987
1991
  title: "框选模式",
1988
1992
  active: a === "box-select",
1989
1993
  onClick: () => {
1990
- O("box-select"), ee([]);
1994
+ O("box-select"), J([]);
1991
1995
  }
1992
1996
  },
1993
1997
  {
@@ -2017,7 +2021,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2017
2021
  ], Fe = Xt(
2018
2022
  () => [
2019
2023
  { icon: /* @__PURE__ */ e(Vt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2020
- { icon: /* @__PURE__ */ e(Zt, {}), title: "重做 (Ctrl+Y)", onClick: W },
2024
+ { icon: /* @__PURE__ */ e(Zt, {}), title: "重做 (Ctrl+Y)", onClick: F },
2021
2025
  {
2022
2026
  icon: /* @__PURE__ */ e(_t, {}),
2023
2027
  title: "复制节点",
@@ -2088,16 +2092,16 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2088
2092
  title: "删除选中 (Delete)",
2089
2093
  disabled: !n && M.length === 0,
2090
2094
  onClick: () => {
2091
- n ? I(n) : M.length > 0 && (M.forEach((o) => I(o)), ee([]));
2095
+ n ? I(n) : M.length > 0 && (M.forEach((o) => I(o)), J([]));
2092
2096
  }
2093
2097
  }
2094
2098
  ],
2095
2099
  [
2096
2100
  g,
2097
- W,
2101
+ F,
2098
2102
  a,
2099
2103
  O,
2100
- ee,
2104
+ J,
2101
2105
  M,
2102
2106
  nt,
2103
2107
  We,
@@ -2111,7 +2115,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2111
2115
  ]
2112
2116
  ), De = V(
2113
2117
  (o) => {
2114
- (o.key === "ArrowLeft" || o.key === "ArrowRight" || o.key === "ArrowUp" || o.key === "ArrowDown") && M.map((N) => c.find((E) => E.id === N)).forEach((N) => {
2118
+ o.preventDefault(), (o.key === "ArrowLeft" || o.key === "ArrowRight" || o.key === "ArrowUp" || o.key === "ArrowDown") && M.map((N) => c.find((k) => k.id === N)).forEach((N) => {
2115
2119
  N && v(N.id, {
2116
2120
  normalStyle: {
2117
2121
  ...N.normalStyle,
@@ -2123,9 +2127,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2123
2127
  },
2124
2128
  [M, c, v]
2125
2129
  );
2126
- return me(() => (a === "box-select" && document.addEventListener("keydown", De), () => {
2130
+ return he(() => (document.addEventListener("keydown", De), () => {
2127
2131
  document.removeEventListener("keydown", De);
2128
- }), [a, De]), /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
2132
+ }), [De]), /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
2129
2133
  /* @__PURE__ */ h("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
2130
2134
  /* @__PURE__ */ e(be, { children: pt.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2131
2135
  Z,
@@ -2197,7 +2201,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2197
2201
  backgroundSize: "cover",
2198
2202
  backgroundPosition: "center"
2199
2203
  },
2200
- onClick: K,
2204
+ onClick: Q,
2201
2205
  onMouseDown: oe,
2202
2206
  onDoubleClick: se,
2203
2207
  onDragOver: ce,
@@ -2208,20 +2212,20 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2208
2212
  /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("pattern", { id: "grid", width: "20", height: "20", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ e("path", { d: "M 20 0 L 0 0 0 20", fill: "none", stroke: "#f0f0f0", strokeWidth: "1" }) }) }),
2209
2213
  /* @__PURE__ */ e("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
2210
2214
  ] }),
2211
- c.map((E) => /* @__PURE__ */ e(
2215
+ c.map((k) => /* @__PURE__ */ e(
2212
2216
  Ut,
2213
2217
  {
2214
- node: E,
2215
- isSelected: n === E.id || M.includes(E.id),
2218
+ node: k,
2219
+ isSelected: n === k.id || M.includes(k.id),
2216
2220
  data: l,
2217
- onClick: () => {
2218
- console.log("Node onClick:", E.id, "mode:", ie.current), ie.current !== "line-draw" && k(E.id);
2221
+ onClick: (b) => {
2222
+ console.log("Node onClick:", k.id, "mode:", ie.current), ie.current !== "line-draw" && (b.shiftKey ? (E(k.id), J([...M, k.id])) : (E(k.id), J([k.id])));
2219
2223
  },
2220
- onMouseDown: (x) => et(x, E),
2221
- onUpdateNode: (x, P) => v(x, P),
2224
+ onMouseDown: (b) => et(b, k),
2225
+ onUpdateNode: (b, P) => v(b, P),
2222
2226
  scale: p.scale
2223
2227
  },
2224
- `${E.id}`
2228
+ `${k.id}`
2225
2229
  )),
2226
2230
  a === "line-draw" && s.isDrawing && s.start && s.end && /* @__PURE__ */ e("svg", { className: "absolute top-0 left-0 pointer-events-none", width: d.width, height: d.height, children: /* @__PURE__ */ e(
2227
2231
  "line",
@@ -2237,15 +2241,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2237
2241
  strokeLinejoin: "round"
2238
2242
  }
2239
2243
  ) }),
2240
- a === "box-select" && b.start && b.end && /* @__PURE__ */ e(
2244
+ a === "box-select" && x.start && x.end && /* @__PURE__ */ e(
2241
2245
  "div",
2242
2246
  {
2243
2247
  className: "absolute border-2 border-blue-500 bg-blue-500/10 pointer-events-none",
2244
2248
  style: {
2245
- left: Math.min(b.start.x, b.end.x),
2246
- top: Math.min(b.start.y, b.end.y),
2247
- width: Math.abs(b.end.x - b.start.x),
2248
- height: Math.abs(b.end.y - b.start.y),
2249
+ left: Math.min(x.start.x, x.end.x),
2250
+ top: Math.min(x.start.y, x.end.y),
2251
+ width: Math.abs(x.end.x - x.start.x),
2252
+ height: Math.abs(x.end.y - x.start.y),
2249
2253
  zIndex: 9999
2250
2254
  }
2251
2255
  }
@@ -2339,9 +2343,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2339
2343
  if (!o.type.startsWith("image/"))
2340
2344
  return Ye.error("只能上传图片文件!"), !1;
2341
2345
  const N = new FileReader();
2342
- return N.onload = (E) => {
2343
- const x = E.target?.result;
2344
- S({ backgroundImage: x }), Ye.success("背景图片上传成功");
2346
+ return N.onload = (k) => {
2347
+ const b = k.target?.result;
2348
+ S({ backgroundImage: b }), Ye.success("背景图片上传成功");
2345
2349
  }, N.readAsDataURL(o), !1;
2346
2350
  },
2347
2351
  children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mt, {}), children: "上传图片" })
@@ -2385,7 +2389,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2385
2389
  bindCodes: t = [],
2386
2390
  dataOptions: r = []
2387
2391
  }) => {
2388
- const n = l.content || {}, [a, i] = Q({
2392
+ const n = l.content || {}, [a, i] = ee({
2389
2393
  label: n.label || "",
2390
2394
  value: n.value || "",
2391
2395
  valueSourceCode: n.valueSourceCode || "",
@@ -2398,7 +2402,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2398
2402
  valueFontWeight: n.valueStyle?.fontWeight || "normal",
2399
2403
  valueColor: n.valueStyle?.color || "#1890ff"
2400
2404
  });
2401
- me(() => {
2405
+ he(() => {
2402
2406
  i({
2403
2407
  label: n.label || "",
2404
2408
  value: n.value || "",
@@ -2413,21 +2417,21 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2413
2417
  valueColor: n.valueStyle?.color || "#1890ff"
2414
2418
  });
2415
2419
  }, [l.id]);
2416
- const p = (u, k) => {
2417
- i((v) => ({ ...v, [u]: k }));
2420
+ const p = (u, E) => {
2421
+ i((v) => ({ ...v, [u]: E }));
2418
2422
  }, d = (u) => {
2419
- const k = r.find((I) => I.paramsCode === u), v = k?.unit || "";
2423
+ const E = r.find((I) => I.paramsCode === u), v = E?.unit || "";
2420
2424
  i((I) => ({
2421
2425
  ...I,
2422
2426
  valueSourceCode: u,
2423
2427
  unit: v,
2424
- value: String(k?.value || "")
2428
+ value: String(E?.value || "")
2425
2429
  })), setTimeout(() => {
2426
2430
  f({
2427
2431
  content: {
2428
2432
  ...n,
2429
2433
  valueSourceCode: u,
2430
- value: String(k?.value || ""),
2434
+ value: String(E?.value || ""),
2431
2435
  unit: v
2432
2436
  }
2433
2437
  });
@@ -2686,13 +2690,13 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2686
2690
  material: l,
2687
2691
  onSave: f
2688
2692
  }) => {
2689
- const t = l, [r, c] = Q({
2693
+ const t = l, [r, c] = ee({
2690
2694
  name: l.name,
2691
2695
  src: t.src || "",
2692
2696
  backgroundColor: t.backgroundColor || "",
2693
2697
  fillColor: t.fillColor || ""
2694
2698
  });
2695
- me(() => {
2699
+ he(() => {
2696
2700
  c({
2697
2701
  name: l.name,
2698
2702
  src: t.src || "",
@@ -2788,7 +2792,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2788
2792
  material: l,
2789
2793
  onSave: f
2790
2794
  }) => {
2791
- const t = l.config || {}, [r, c] = Q({
2795
+ const t = l.config || {}, [r, c] = ee({
2792
2796
  lineWeight: t.lineWeight || t.thickness || 2,
2793
2797
  color: t.color || "#262626",
2794
2798
  lineType: t.lineType || "solid",
@@ -2797,7 +2801,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2797
2801
  endX: t.endX ?? 100,
2798
2802
  endY: t.endY ?? 0
2799
2803
  });
2800
- me(() => {
2804
+ he(() => {
2801
2805
  c({
2802
2806
  lineWeight: t.lineWeight || t.thickness || 2,
2803
2807
  color: t.color || "#262626",
@@ -2985,18 +2989,18 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2985
2989
  materials: t
2986
2990
  }) => {
2987
2991
  const r = t.filter((m) => m.type !== "CUSTOM" || !m.config?.nodes), c = (m, S) => {
2988
- const u = l.children?.map((k) => k.id === m ? {
2989
- ...k,
2992
+ const u = l.children?.map((E) => E.id === m ? {
2993
+ ...E,
2990
2994
  contentInfo: {
2991
- ...k.contentInfo,
2995
+ ...E.contentInfo,
2992
2996
  statusList: S
2993
2997
  }
2994
- } : k);
2998
+ } : E);
2995
2999
  f(l.id, {
2996
3000
  children: u
2997
3001
  });
2998
3002
  }, n = (m) => {
2999
- const S = l.children?.find((k) => k.id === m);
3003
+ const S = l.children?.find((E) => E.id === m);
3000
3004
  if (!S) return;
3001
3005
  const u = {
3002
3006
  id: H(),
@@ -3009,24 +3013,24 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3009
3013
  }, a = (m, S) => {
3010
3014
  const u = l.children?.find((v) => v.id === m);
3011
3015
  if (!u) return;
3012
- const k = u.contentInfo.statusList.filter((v) => v.id !== S);
3013
- c(m, k);
3016
+ const E = u.contentInfo.statusList.filter((v) => v.id !== S);
3017
+ c(m, E);
3014
3018
  }, i = (m, S, u) => {
3015
- const k = l.children?.find((I) => I.id === m);
3016
- if (!k) return;
3017
- const v = k.contentInfo.statusList.map((I) => I.id === S ? { ...I, ...u } : I);
3019
+ const E = l.children?.find((I) => I.id === m);
3020
+ if (!E) return;
3021
+ const v = E.contentInfo.statusList.map((I) => I.id === S ? { ...I, ...u } : I);
3018
3022
  c(m, v);
3019
3023
  }, p = (m, S, u) => {
3020
- const k = l.children?.find((g) => g.id === m);
3021
- if (!k) return;
3022
- const v = k.contentInfo.statusList.findIndex((g) => g.id === S);
3024
+ const E = l.children?.find((g) => g.id === m);
3025
+ if (!E) return;
3026
+ const v = E.contentInfo.statusList.findIndex((g) => g.id === S);
3023
3027
  if (v === -1) return;
3024
- const I = [...k.contentInfo.statusList];
3028
+ const I = [...E.contentInfo.statusList];
3025
3029
  u === "up" && v > 0 ? [I[v], I[v - 1]] = [I[v - 1], I[v]] : u === "down" && v < I.length - 1 && ([I[v], I[v + 1]] = [I[v + 1], I[v]]), c(m, I);
3026
3030
  }, d = (m, S, u) => {
3027
- const k = t.find((v) => v.id === u);
3028
- k && i(m, S, {
3029
- material: { ...k, id: H() }
3031
+ const E = t.find((v) => v.id === u);
3032
+ E && i(m, S, {
3033
+ material: { ...E, id: H() }
3030
3034
  });
3031
3035
  };
3032
3036
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
@@ -3061,11 +3065,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3061
3065
  }
3062
3066
  )
3063
3067
  ] }),
3064
- m.contentInfo.statusList.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(Ne, { ghost: !0, children: m.contentInfo.statusList.map((u, k) => /* @__PURE__ */ e(
3068
+ m.contentInfo.statusList.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(Ne, { ghost: !0, children: m.contentInfo.statusList.map((u, E) => /* @__PURE__ */ e(
3065
3069
  $t,
3066
3070
  {
3067
3071
  header: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3068
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: k + 1 }),
3072
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: E + 1 }),
3069
3073
  /* @__PURE__ */ e("span", { className: "font-medium", children: u.name }),
3070
3074
  /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: u.material.type })
3071
3075
  ] }),
@@ -3076,7 +3080,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3076
3080
  type: "text",
3077
3081
  size: "small",
3078
3082
  icon: /* @__PURE__ */ e(Ot, {}),
3079
- disabled: k === 0,
3083
+ disabled: E === 0,
3080
3084
  onClick: (v) => {
3081
3085
  v.stopPropagation(), p(m.id, u.id, "up");
3082
3086
  }
@@ -3088,7 +3092,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3088
3092
  type: "text",
3089
3093
  size: "small",
3090
3094
  icon: /* @__PURE__ */ e(At, {}),
3091
- disabled: k === m.contentInfo.statusList.length - 1,
3095
+ disabled: E === m.contentInfo.statusList.length - 1,
3092
3096
  onClick: (v) => {
3093
3097
  v.stopPropagation(), p(m.id, u.id, "down");
3094
3098
  }
@@ -3198,10 +3202,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3198
3202
  materials: i,
3199
3203
  selectedStatusId: p,
3200
3204
  selectStatus: d
3201
- } = ze(), [m] = w.useForm(), [S, u] = Q("basic"), [k, v] = Q(!1), [I, g] = Q(null), [W, O] = Q({}), X = Ce.useMemo(() => f.find((s) => s.id === t), [f, t]), $ = X?.contentInfo.statusList || [], L = (s) => {
3205
+ } = ze(), [m] = w.useForm(), [S, u] = ee("basic"), [E, v] = ee(!1), [I, g] = ee(null), [F, O] = ee({}), X = Ce.useMemo(() => f.find((s) => s.id === t), [f, t]), $ = X?.contentInfo.statusList || [], L = (s) => {
3202
3206
  t && (s.normalStyle && c(t, s.normalStyle), s.name !== void 0 && r(t, { name: s.name }), s.controlInfo && n(t, s.controlInfo));
3203
3207
  };
3204
- console.log(t, "selectedNodeId", X), me(() => {
3208
+ console.log(t, "selectedNodeId", X), he(() => {
3205
3209
  X && X && (m.setFieldsValue({
3206
3210
  name: X.name,
3207
3211
  normalStyle: {
@@ -3236,21 +3240,21 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3236
3240
  bindCodes: []
3237
3241
  };
3238
3242
  if (I === "new") {
3239
- const b = [...$, q];
3240
- a(t, { statusList: b });
3243
+ const x = [...$, q];
3244
+ a(t, { statusList: x });
3241
3245
  } else if (I) {
3242
- const b = $.map((Y) => Y.id === I ? { ...Y, material: { ...s, id: H() } } : Y);
3243
- a(t, { statusList: b });
3246
+ const x = $.map((Y) => Y.id === I ? { ...Y, material: { ...s, id: H() } } : Y);
3247
+ a(t, { statusList: x });
3244
3248
  }
3245
3249
  v(!1), g(null);
3246
3250
  }, we = (s) => {
3247
3251
  if (!t || !X) return;
3248
- const q = X.contentInfo.statusList?.filter((b) => b.id !== s) || [];
3252
+ const q = X.contentInfo.statusList?.filter((x) => x.id !== s) || [];
3249
3253
  a(t, { statusList: q }), p === s && d(null);
3250
3254
  }, ie = (s, q) => {
3251
3255
  if (!t || !X) return;
3252
- const b = X.contentInfo.statusList?.map((Y) => Y.id === s ? { ...Y, ...q } : Y) || [];
3253
- a(t, { statusList: b });
3256
+ const x = X.contentInfo.statusList?.map((Y) => Y.id === s ? { ...Y, ...q } : Y) || [];
3257
+ a(t, { statusList: x });
3254
3258
  }, A = (s) => {
3255
3259
  if (!t || !X) return;
3256
3260
  const q = {
@@ -3258,29 +3262,29 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3258
3262
  id: H(),
3259
3263
  name: `${s.name}_复制`,
3260
3264
  expression: "return false;"
3261
- }, b = [...$, q];
3262
- a(t, { statusList: b });
3263
- }, J = (s, q) => {
3265
+ }, x = [...$, q];
3266
+ a(t, { statusList: x });
3267
+ }, K = (s, q) => {
3264
3268
  if (!t || !X) return;
3265
- const b = $.findIndex((M) => M.id === s);
3266
- if (b === -1) return;
3269
+ const x = $.findIndex((M) => M.id === s);
3270
+ if (x === -1) return;
3267
3271
  const Y = [...$];
3268
- q === "up" && b > 0 ? [Y[b], Y[b - 1]] = [
3269
- Y[b - 1],
3270
- Y[b]
3271
- ] : q === "down" && b < Y.length - 1 && ([Y[b], Y[b + 1]] = [
3272
- Y[b + 1],
3273
- Y[b]
3272
+ q === "up" && x > 0 ? [Y[x], Y[x - 1]] = [
3273
+ Y[x - 1],
3274
+ Y[x]
3275
+ ] : q === "down" && x < Y.length - 1 && ([Y[x], Y[x + 1]] = [
3276
+ Y[x + 1],
3277
+ Y[x]
3274
3278
  ]), a(t, { statusList: Y });
3275
3279
  }, G = (s) => {
3276
3280
  g(s), v(!0);
3277
3281
  }, T = (s, q) => {
3278
3282
  if (!t || !X) return;
3279
- const b = $.map((Y) => Y.id === s ? {
3283
+ const x = $.map((Y) => Y.id === s ? {
3280
3284
  ...Y,
3281
3285
  material: { ...Y.material, ...q }
3282
3286
  } : Y);
3283
- a(t, { statusList: b });
3287
+ a(t, { statusList: x });
3284
3288
  };
3285
3289
  return X ? /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
3286
3290
  /* @__PURE__ */ h("div", { className: "p-4 border-b border-gray-200", children: [
@@ -3372,7 +3376,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3372
3376
  /* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
3373
3377
  /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: s.material.type })
3374
3378
  ] }),
3375
- extra: /* @__PURE__ */ h(be, { size: "small", onClick: (b) => b.stopPropagation(), children: [
3379
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (x) => x.stopPropagation(), children: [
3376
3380
  /* @__PURE__ */ e(
3377
3381
  Z,
3378
3382
  {
@@ -3380,8 +3384,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3380
3384
  size: "small",
3381
3385
  icon: /* @__PURE__ */ e(Ot, {}),
3382
3386
  disabled: q === 0,
3383
- onClick: (b) => {
3384
- b.stopPropagation(), J(s.id, "up");
3387
+ onClick: (x) => {
3388
+ x.stopPropagation(), K(s.id, "up");
3385
3389
  }
3386
3390
  }
3387
3391
  ),
@@ -3392,8 +3396,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3392
3396
  size: "small",
3393
3397
  icon: /* @__PURE__ */ e(At, {}),
3394
3398
  disabled: q === $.length - 1,
3395
- onClick: (b) => {
3396
- b.stopPropagation(), J(s.id, "down");
3399
+ onClick: (x) => {
3400
+ x.stopPropagation(), K(s.id, "down");
3397
3401
  }
3398
3402
  }
3399
3403
  ),
@@ -3403,8 +3407,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3403
3407
  type: "text",
3404
3408
  size: "small",
3405
3409
  icon: /* @__PURE__ */ e(_t, {}),
3406
- onClick: (b) => {
3407
- b.stopPropagation(), A(s);
3410
+ onClick: (x) => {
3411
+ x.stopPropagation(), A(s);
3408
3412
  }
3409
3413
  }
3410
3414
  ),
@@ -3415,8 +3419,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3415
3419
  size: "small",
3416
3420
  danger: !0,
3417
3421
  icon: /* @__PURE__ */ e(ot, {}),
3418
- onClick: (b) => {
3419
- b.stopPropagation(), we(s.id);
3422
+ onClick: (x) => {
3423
+ x.stopPropagation(), we(s.id);
3420
3424
  }
3421
3425
  }
3422
3426
  )
@@ -3426,7 +3430,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3426
3430
  re,
3427
3431
  {
3428
3432
  value: s.name,
3429
- onChange: (b) => ie(s.id, { name: b.target.value }),
3433
+ onChange: (x) => ie(s.id, { name: x.target.value }),
3430
3434
  placeholder: "输入状态名称"
3431
3435
  }
3432
3436
  ) }),
@@ -3438,13 +3442,13 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3438
3442
  children: /* @__PURE__ */ e(
3439
3443
  qn,
3440
3444
  {
3441
- value: W[s.id] ?? s.expression,
3442
- onChange: (b) => O((Y) => ({
3445
+ value: F[s.id] ?? s.expression,
3446
+ onChange: (x) => O((Y) => ({
3443
3447
  ...Y,
3444
- [s.id]: b.target.value
3448
+ [s.id]: x.target.value
3445
3449
  })),
3446
- onBlur: (b) => {
3447
- ie(s.id, { expression: b.target.value }), O((Y) => {
3450
+ onBlur: (x) => {
3451
+ ie(s.id, { expression: x.target.value }), O((Y) => {
3448
3452
  const M = { ...Y };
3449
3453
  return delete M[s.id], M;
3450
3454
  });
@@ -3460,7 +3464,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3460
3464
  {
3461
3465
  mode: "tags",
3462
3466
  value: s.bindCodes || [],
3463
- onChange: (b) => ie(s.id, { bindCodes: b }),
3467
+ onChange: (x) => ie(s.id, { bindCodes: x }),
3464
3468
  placeholder: "输入数据源 code",
3465
3469
  tokenSeparators: [",", " "]
3466
3470
  }
@@ -3489,7 +3493,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3489
3493
  Ht,
3490
3494
  {
3491
3495
  material: s.material,
3492
- onSave: (b) => T(s.id, b),
3496
+ onSave: (x) => T(s.id, x),
3493
3497
  bindCodes: s.bindCodes || [],
3494
3498
  dataOptions: l || []
3495
3499
  }
@@ -3562,7 +3566,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3562
3566
  it,
3563
3567
  {
3564
3568
  title: "选择物料",
3565
- open: k,
3569
+ open: E,
3566
3570
  onCancel: () => {
3567
3571
  v(!1), g(null);
3568
3572
  },
@@ -3642,7 +3646,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3642
3646
  showPropertyPanel: p = !0,
3643
3647
  customMaterials: d
3644
3648
  }) => {
3645
- const [m, S] = Ce.useState(!1), [u, k] = Ce.useState(""), [v, I] = Ce.useState([
3649
+ const [m, S] = Ce.useState(!1), [u, E] = Ce.useState(""), [v, I] = Ce.useState([
3646
3650
  {
3647
3651
  paramsCode: "001",
3648
3652
  paramsName: "通频速度有效值",
@@ -3655,49 +3659,49 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3655
3659
  value: 1.5,
3656
3660
  paramsUnit: "m/s²"
3657
3661
  }
3658
- ]), { exportScheme: g, importScheme: W, nodes: O, materials: X, addMaterial: $ } = ze();
3662
+ ]), { exportScheme: g, importScheme: F, nodes: O, materials: X, addMaterial: $ } = ze();
3659
3663
  Ce.useRef(null);
3660
3664
  const L = Ce.useRef(!1);
3661
- me(() => {
3662
- L.current || (L.current = !0, X.length === 0 && Dn.forEach((A) => $(A)), d && d.length > 0 && d.forEach((A) => $(A)), l && W(l));
3663
- }, []), me(() => {
3665
+ he(() => {
3666
+ L.current || (L.current = !0, X.length === 0 && Dn.forEach((A) => $(A)), d && d.length > 0 && d.forEach((A) => $(A)), l && F(l));
3667
+ }, []), he(() => {
3664
3668
  if (f) {
3665
3669
  const A = g();
3666
3670
  f(A);
3667
3671
  }
3668
3672
  }, [O, f]);
3669
3673
  const xe = V(() => {
3670
- const A = g(), J = JSON.stringify(A, null, 2), G = "data:application/json;charset=utf-8," + encodeURIComponent(J), T = `scheme_${Date.now()}.json`, s = document.createElement("a");
3674
+ const A = g(), K = JSON.stringify(A, null, 2), G = "data:application/json;charset=utf-8," + encodeURIComponent(K), T = `scheme_${Date.now()}.json`, s = document.createElement("a");
3671
3675
  s.setAttribute("href", G), s.setAttribute("download", T), s.click(), Ye.success("导出成功!");
3672
3676
  }, [g]), ne = V(() => {
3673
3677
  try {
3674
3678
  const A = JSON.parse(u);
3675
- W(A), S(!1), k(""), Ye.success("导入成功!");
3679
+ F(A), S(!1), E(""), Ye.success("导入成功!");
3676
3680
  } catch {
3677
3681
  Ye.error("JSON 格式错误,请检查输入");
3678
3682
  }
3679
- }, [u, W]), we = V(
3683
+ }, [u, F]), we = V(
3680
3684
  (A) => {
3681
- const J = new FileReader();
3682
- return J.onload = (G) => {
3685
+ const K = new FileReader();
3686
+ return K.onload = (G) => {
3683
3687
  try {
3684
3688
  const T = G.target?.result, s = JSON.parse(T);
3685
- W(s), Ye.success("导入成功!"), S(!1);
3689
+ F(s), Ye.success("导入成功!"), S(!1);
3686
3690
  } catch {
3687
3691
  Ye.error("文件格式错误");
3688
3692
  }
3689
- }, J.readAsText(A), !1;
3693
+ }, K.readAsText(A), !1;
3690
3694
  },
3691
- [W]
3695
+ [F]
3692
3696
  ), ie = V(() => g(), [g]);
3693
3697
  return Ce.useImperativeHandle(
3694
3698
  Ce.useRef?.(),
3695
3699
  () => ({
3696
3700
  getScheme: ie,
3697
3701
  exportScheme: g,
3698
- importScheme: W
3702
+ importScheme: F
3699
3703
  }),
3700
- [ie, g, W]
3704
+ [ie, g, F]
3701
3705
  ), /* @__PURE__ */ e(Bt, { locale: kn, children: /* @__PURE__ */ e("div", { className: Zn.configEditor, style: n, children: /* @__PURE__ */ h(
3702
3706
  ht,
3703
3707
  {
@@ -3738,7 +3742,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3738
3742
  open: m,
3739
3743
  onOk: ne,
3740
3744
  onCancel: () => {
3741
- S(!1), k("");
3745
+ S(!1), E("");
3742
3746
  },
3743
3747
  width: 600,
3744
3748
  children: /* @__PURE__ */ h("div", { className: "space-y-4", children: [
@@ -3750,8 +3754,8 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3750
3754
  type: "file",
3751
3755
  accept: ".json",
3752
3756
  onChange: (A) => {
3753
- const J = A.target.files?.[0];
3754
- J && we(J);
3757
+ const K = A.target.files?.[0];
3758
+ K && we(K);
3755
3759
  },
3756
3760
  className: `block w-full text-sm text-gray-500
3757
3761
  file:mr-4 file:py-2 file:px-4
@@ -3769,7 +3773,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3769
3773
  "textarea",
3770
3774
  {
3771
3775
  value: u,
3772
- onChange: (A) => k(A.target.value),
3776
+ onChange: (A) => E(A.target.value),
3773
3777
  placeholder: "粘贴 JSON 内容...",
3774
3778
  className: "w-full h-48 p-3 border border-gray-300 rounded-lg font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500"
3775
3779
  }