jch-config-editor 0.1.12 → 0.1.14

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,31 +1,31 @@
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";
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
- 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
- import { create as fn } from "zustand";
6
- import { produce as gn } from "immer";
1
+ import { jsxs as h, jsx as e, Fragment as Ae } from "react/jsx-runtime";
2
+ import Ce, { useState as ee, useRef as ue, useEffect as he, useMemo as Pt, useCallback as V } from "react";
3
+ import { Typography as Tt, Upload as Rt, Button as Z, Collapse as Ne, List as Le, Empty as pe, Tag as ye, Image as Bt, Space as be, Tooltip as Ye, Modal as st, Form as w, Input as re, InputNumber as te, Switch as Qe, message as $e, Divider as De, Select as Ie, Tabs as _t, ConfigProvider as Vt, Layout as ft } from "antd";
4
+ import { UploadOutlined as gt, EditOutlined as pt, DeleteOutlined as ct, UndoOutlined as Zt, RedoOutlined as Jt, CopyOutlined as zt, GroupOutlined as bt, UngroupOutlined as Kt, AlignLeftOutlined as Qt, AlignRightOutlined as en, VerticalAlignTopOutlined as tn, VerticalAlignBottomOutlined as nn, ColumnWidthOutlined as ln, ColumnHeightOutlined as rn, SettingOutlined as an, ExperimentOutlined as on, ZoomInOutlined as sn, ZoomOutOutlined as cn, CloseOutlined as dn, SelectOutlined as un, DragOutlined as hn, EyeOutlined as mn, PlusOutlined as Ot, ArrowUpOutlined as At, ArrowDownOutlined as jt, DownloadOutlined as fn } from "@ant-design/icons";
5
+ import { create as gn } from "zustand";
6
+ import { produce as pn } from "immer";
7
7
  import { nanoid as H } from "nanoid";
8
- import { TransformWrapper as pn, TransformComponent as yn } from "react-zoom-pan-pinch";
9
- function vn(l) {
8
+ import { TransformWrapper as yn, TransformComponent as vn } from "react-zoom-pan-pinch";
9
+ function bn(l) {
10
10
  return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
11
11
  }
12
- var Ue = {}, ct = { exports: {} }, bt;
13
- function gt() {
14
- return bt || (bt = 1, (function(l) {
12
+ var Ge = {}, ut = { exports: {} }, xt;
13
+ function yt() {
14
+ return xt || (xt = 1, (function(l) {
15
15
  function f(t) {
16
16
  return t && t.__esModule ? t : {
17
17
  default: t
18
18
  };
19
19
  }
20
20
  l.exports = f, l.exports.__esModule = !0, l.exports.default = l.exports;
21
- })(ct)), ct.exports;
21
+ })(ut)), ut.exports;
22
22
  }
23
- var He = {}, xt;
24
- function bn() {
25
- if (xt) return He;
26
- xt = 1, Object.defineProperty(He, "__esModule", {
23
+ var qe = {}, wt;
24
+ function xn() {
25
+ if (wt) return qe;
26
+ wt = 1, Object.defineProperty(qe, "__esModule", {
27
27
  value: !0
28
- }), He.default = void 0;
28
+ }), qe.default = void 0;
29
29
  const l = {
30
30
  // Options
31
31
  items_per_page: "条/页",
@@ -41,26 +41,26 @@ function bn() {
41
41
  next_3: "向后 3 页",
42
42
  page_size: "页码"
43
43
  };
44
- return He.default = l, He;
44
+ return qe.default = l, qe;
45
45
  }
46
- var Ge = {}, qe = {}, Be = {}, Ve = {}, wt;
47
- function xn() {
48
- return wt || (wt = 1, Object.defineProperty(Ve, "__esModule", {
46
+ var Be = {}, Ve = {}, Ze = {}, Je = {}, St;
47
+ function wn() {
48
+ return St || (St = 1, Object.defineProperty(Je, "__esModule", {
49
49
  value: !0
50
- }), Ve.commonLocale = void 0, Ve.commonLocale = {
50
+ }), Je.commonLocale = void 0, Je.commonLocale = {
51
51
  yearFormat: "YYYY",
52
52
  dayFormat: "D",
53
53
  cellMeridiemFormat: "A",
54
54
  monthBeforeYear: !0
55
- }), Ve;
55
+ }), Je;
56
56
  }
57
- var St;
58
- function wn() {
59
- if (St) return Be;
60
- St = 1, Object.defineProperty(Be, "__esModule", {
57
+ var Ct;
58
+ function Sn() {
59
+ if (Ct) return Ze;
60
+ Ct = 1, Object.defineProperty(Ze, "__esModule", {
61
61
  value: !0
62
- }), Be.default = void 0;
63
- var l = xn();
62
+ }), Ze.default = void 0;
63
+ var l = wn();
64
64
  function f(p) {
65
65
  "@babel/helpers - typeof";
66
66
  return f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(d) {
@@ -135,29 +135,29 @@ function wn() {
135
135
  cellDateFormat: "D",
136
136
  monthBeforeYear: !1
137
137
  });
138
- return Be.default = i, Be;
138
+ return Ze.default = i, Ze;
139
139
  }
140
- var Ze = {}, Ct;
141
- function jt() {
142
- if (Ct) return Ze;
143
- Ct = 1, Object.defineProperty(Ze, "__esModule", {
140
+ var Ke = {}, Nt;
141
+ function Wt() {
142
+ if (Nt) return Ke;
143
+ Nt = 1, Object.defineProperty(Ke, "__esModule", {
144
144
  value: !0
145
- }), Ze.default = void 0;
145
+ }), Ke.default = void 0;
146
146
  const l = {
147
147
  placeholder: "请选择时间",
148
148
  rangePlaceholder: ["开始时间", "结束时间"]
149
149
  };
150
- return Ze.default = l, Ze;
150
+ return Ke.default = l, Ke;
151
151
  }
152
- var Nt;
153
- function Wt() {
154
- if (Nt) return qe;
155
- Nt = 1;
156
- var l = gt().default;
157
- Object.defineProperty(qe, "__esModule", {
152
+ var It;
153
+ function Ft() {
154
+ if (It) return Ve;
155
+ It = 1;
156
+ var l = yt().default;
157
+ Object.defineProperty(Ve, "__esModule", {
158
158
  value: !0
159
- }), qe.default = void 0;
160
- var f = l(wn()), t = l(/* @__PURE__ */ jt());
159
+ }), Ve.default = void 0;
160
+ var f = l(Sn()), t = l(/* @__PURE__ */ Wt());
161
161
  const r = {
162
162
  lang: {
163
163
  placeholder: "请选择日期",
@@ -176,28 +176,28 @@ function Wt() {
176
176
  ...t.default
177
177
  }
178
178
  };
179
- return r.lang.ok = "确定", qe.default = r, qe;
180
- }
181
- var It;
182
- function Sn() {
183
- if (It) return Ge;
184
- It = 1;
185
- var l = gt().default;
186
- Object.defineProperty(Ge, "__esModule", {
187
- value: !0
188
- }), Ge.default = void 0;
189
- var f = l(/* @__PURE__ */ Wt());
190
- return Ge.default = f.default, Ge;
179
+ return r.lang.ok = "确定", Ve.default = r, Ve;
191
180
  }
192
181
  var kt;
193
182
  function Cn() {
194
- if (kt) return Ue;
183
+ if (kt) return Be;
195
184
  kt = 1;
196
- var l = gt().default;
197
- Object.defineProperty(Ue, "__esModule", {
185
+ var l = yt().default;
186
+ Object.defineProperty(Be, "__esModule", {
187
+ value: !0
188
+ }), Be.default = void 0;
189
+ var f = l(/* @__PURE__ */ Ft());
190
+ return Be.default = f.default, Be;
191
+ }
192
+ var Et;
193
+ function Nn() {
194
+ if (Et) return Ge;
195
+ Et = 1;
196
+ var l = yt().default;
197
+ Object.defineProperty(Ge, "__esModule", {
198
198
  value: !0
199
- }), Ue.default = void 0;
200
- var f = l(bn()), t = l(/* @__PURE__ */ Sn()), r = l(/* @__PURE__ */ Wt()), c = l(/* @__PURE__ */ jt());
199
+ }), Ge.default = void 0;
200
+ var f = l(xn()), t = l(/* @__PURE__ */ Cn()), r = l(/* @__PURE__ */ Ft()), c = l(/* @__PURE__ */ Wt());
201
201
  const n = "${label}不是一个有效的${type}", a = {
202
202
  locale: "zh-cn",
203
203
  Pagination: f.default,
@@ -338,17 +338,17 @@ function Cn() {
338
338
  gradientColor: "渐变色"
339
339
  }
340
340
  };
341
- return Ue.default = a, Ue;
341
+ return Ge.default = a, Ge;
342
342
  }
343
- var dt, Et;
344
- function Nn() {
345
- return Et || (Et = 1, dt = /* @__PURE__ */ Cn()), dt;
343
+ var ht, Mt;
344
+ function In() {
345
+ return Mt || (Mt = 1, ht = /* @__PURE__ */ Nn()), ht;
346
346
  }
347
- var In = /* @__PURE__ */ Nn();
348
- const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n, ...a) => {
349
- const i = typeof c == "function" ? gn(c) : c;
347
+ var kn = /* @__PURE__ */ In();
348
+ const En = /* @__PURE__ */ bn(kn), Mn = (l) => (f, t, r) => (r.setState = (c, n, ...a) => {
349
+ const i = typeof c == "function" ? pn(c) : c;
350
350
  return f(i, n, ...a);
351
- }, l(r.setState, t, r)), Mn = En, Mt = {
351
+ }, l(r.setState, t, r)), Dn = Mn, Dt = {
352
352
  nodes: [],
353
353
  materials: [],
354
354
  selectedNodeId: null,
@@ -381,9 +381,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
381
381
  targetId: f,
382
382
  payload: t,
383
383
  timestamp: Date.now()
384
- }), ze = fn()(
385
- Mn((l, f) => ({
386
- ...Mt,
384
+ }), Oe = gn()(
385
+ Dn((l, f) => ({
386
+ ...Dt,
387
387
  // ========== 节点操作 ==========
388
388
  addNode: (t, r = !0) => {
389
389
  l((c) => {
@@ -585,11 +585,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
585
585
  },
586
586
  importScheme: (t) => {
587
587
  l((r) => {
588
- r.nodes = t.nodes || [], r.materials = t.materials || [], r.viewport = t.viewport || Mt.viewport, r.selectedNodeId = null, r.selectedStatusId = null, r.history = { past: [], future: [] };
588
+ r.nodes = t.nodes || [], r.materials = t.materials || [], r.viewport = t.viewport || Dt.viewport, r.selectedNodeId = null, r.selectedStatusId = null, r.history = { past: [], future: [] };
589
589
  });
590
590
  }
591
591
  }))
592
- ), Dn = [
592
+ ), Ln = [
593
593
  // 基础形状
594
594
  {
595
595
  id: H(),
@@ -662,13 +662,13 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
662
662
  lineType: "solid"
663
663
  }
664
664
  }
665
- ], Ft = (l) => ({
665
+ ], Ut = (l) => ({
666
666
  id: H(),
667
667
  name: "默认状态",
668
668
  expression: "return true;",
669
669
  material: { ...l, id: H() },
670
670
  bindCodes: []
671
- }), $n = (l, f, t) => {
671
+ }), Yn = (l, f, t) => {
672
672
  if (t?.type === "CUSTOM" && t.config?.nodes) {
673
673
  const r = t.config.nodes.map((d) => ({
674
674
  ...d,
@@ -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,
@@ -727,7 +727,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
727
727
  padding: 8
728
728
  },
729
729
  contentInfo: {
730
- statusList: t ? [Ft(t)] : [],
730
+ statusList: t ? [Ut(t)] : [],
731
731
  currentStatusId: void 0
732
732
  },
733
733
  controlInfo: {
@@ -737,7 +737,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
737
737
  isSelectable: !0
738
738
  }
739
739
  };
740
- }, { Panel: _e } = Ne, { Text: rt } = Pt, Ln = () => {
740
+ }, { Panel: ze } = Ne, { Text: it } = Tt, $n = () => {
741
741
  const {
742
742
  materials: l,
743
743
  addMaterial: f,
@@ -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
+ } = Oe(), [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) => {
759
- const X = O.target?.result;
757
+ const U = new FileReader();
758
+ return U.onload = (j) => {
759
+ const T = j.target?.result;
760
760
  f({
761
761
  name: g.name.replace(".svg", ""),
762
762
  type: "IMAGE",
763
- src: X
763
+ src: T
764
764
  });
765
- }, W.readAsDataURL(g), !1;
765
+ }, U.readAsDataURL(g), !1;
766
766
  }, u = {
767
767
  basic: l.filter(
768
768
  (g) => ["矩形", "圆形", "圆角矩形"].includes(g.name)
@@ -776,37 +776,37 @@ 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));
781
- const O = g.currentTarget.querySelector(
779
+ }, E = (g, U) => {
780
+ g.dataTransfer.effectAllowed = "copy", g.dataTransfer.setData("application/json", JSON.stringify(U));
781
+ const j = g.currentTarget.querySelector(
782
782
  ".material-preview"
783
783
  );
784
- O && g.dataTransfer.setDragImage(O, 20, 20);
785
- }, v = (g) => {
784
+ j && g.dataTransfer.setDragImage(j, 20, 20);
785
+ }, b = (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
+ }, k = (g, U = !1) => {
788
+ const j = U === !0, T = n === "line-draw" && j && a.material?.id === g.id;
789
789
  return /* @__PURE__ */ e(
790
- $e.Item,
790
+ Le.Item,
791
791
  {
792
- draggable: !O,
793
- onDragStart: ($) => k($, g),
794
- onClick: () => O && v(g),
792
+ draggable: !j,
793
+ onDragStart: (Y) => E(Y, g),
794
+ onClick: () => j && b(g),
795
795
  className: `
796
796
  rounded-lg transition-all duration-200 select-none
797
- ${O ? "cursor-pointer" : "cursor-move"}
797
+ ${j ? "cursor-pointer" : "cursor-move"}
798
798
  hover:bg-gray-100
799
- ${X ? "bg-blue-50 ring-2 ring-blue-400" : ""}
799
+ ${T ? "bg-blue-50 ring-2 ring-blue-400" : ""}
800
800
  `,
801
801
  actions: [
802
- O ? /* @__PURE__ */ e(
802
+ j ? /* @__PURE__ */ e(
803
803
  Z,
804
804
  {
805
805
  type: "text",
806
806
  size: "small",
807
- icon: /* @__PURE__ */ e(ft, {}),
808
- onClick: ($) => {
809
- $.stopPropagation(), v(g);
807
+ icon: /* @__PURE__ */ e(pt, {}),
808
+ onClick: (Y) => {
809
+ Y.stopPropagation(), b(g);
810
810
  },
811
811
  children: "绘制"
812
812
  },
@@ -818,17 +818,17 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
818
818
  type: "text",
819
819
  size: "small",
820
820
  danger: !0,
821
- icon: /* @__PURE__ */ e(ot, {}),
822
- onClick: ($) => {
823
- $.stopPropagation(), t(g.id);
821
+ icon: /* @__PURE__ */ e(ct, {}),
822
+ onClick: (Y) => {
823
+ Y.stopPropagation(), t(g.id);
824
824
  }
825
825
  },
826
826
  "delete"
827
827
  )
828
828
  ].filter(Boolean),
829
- children: /* @__PURE__ */ h("div", { className: `flex items-center gap-3 w-full py-2 ${O ? "" : "pointer-events-none"}`, children: [
829
+ children: /* @__PURE__ */ h("div", { className: `flex items-center gap-3 w-full py-2 ${j ? "" : "pointer-events-none"}`, children: [
830
830
  /* @__PURE__ */ e("div", { className: "material-preview w-12 h-12 flex items-center justify-center bg-white rounded border border-gray-200", children: g.type === "IMAGE" && g.src ? /* @__PURE__ */ e(
831
- qt,
831
+ Bt,
832
832
  {
833
833
  src: g.src,
834
834
  alt: g.name,
@@ -838,10 +838,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
838
838
  }
839
839
  ) : g.type === "TEXT" ? /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "T" }) : g.type === "LINE" ? /* @__PURE__ */ e("div", { className: "w-8 h-0.5 bg-gray-400" }) : g.type === "CUSTOM" && g.config?.nodes ? /* @__PURE__ */ e("span", { className: "text-xs text-blue-500 font-bold", children: "G" }) : /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "?" }) }),
840
840
  /* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
841
- /* @__PURE__ */ e(rt, { strong: !0, className: "block truncate", children: g.name }),
841
+ /* @__PURE__ */ e(it, { strong: !0, className: "block truncate", children: g.name }),
842
842
  /* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
843
- /* @__PURE__ */ e(rt, { type: "secondary", className: "text-xs", children: g.type }),
844
- X && /* @__PURE__ */ e(ye, { color: "blue", className: "text-xs", children: "绘制中" })
843
+ /* @__PURE__ */ e(it, { type: "secondary", className: "text-xs", children: g.type }),
844
+ T && /* @__PURE__ */ e(ye, { color: "blue", className: "text-xs", children: "绘制中" })
845
845
  ] })
846
846
  ] })
847
847
  ] })
@@ -852,15 +852,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
852
852
  return /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-r border-gray-200", children: [
853
853
  /* @__PURE__ */ h("div", { className: "p-4 border-b border-gray-200", children: [
854
854
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "物料库" }),
855
- /* @__PURE__ */ e(rt, { type: "secondary", className: "text-sm", children: "拖拽物料到画布创建节点" })
855
+ /* @__PURE__ */ e(it, { type: "secondary", className: "text-sm", children: "拖拽物料到画布创建节点" })
856
856
  ] }),
857
857
  /* @__PURE__ */ e("div", { className: "p-3 border-b border-gray-200", children: /* @__PURE__ */ e(
858
- Tt,
858
+ Rt,
859
859
  {
860
860
  accept: ".svg",
861
861
  beforeUpload: S,
862
862
  showUploadList: !1,
863
- children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mt, {}), block: !0, type: "dashed", children: "上传 SVG" })
863
+ children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(gt, {}), block: !0, type: "dashed", children: "上传 SVG" })
864
864
  }
865
865
  ) }),
866
866
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2", children: /* @__PURE__ */ h(
@@ -871,11 +871,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
871
871
  ghost: !0,
872
872
  expandIconPosition: "end",
873
873
  children: [
874
- /* @__PURE__ */ e(_e, { header: "基础形状", children: /* @__PURE__ */ e(
875
- $e,
874
+ /* @__PURE__ */ e(ze, { header: "基础形状", children: /* @__PURE__ */ e(
875
+ Le,
876
876
  {
877
877
  dataSource: u.basic,
878
- renderItem: (g) => I(g, !1),
878
+ renderItem: (g) => k(g, !1),
879
879
  locale: {
880
880
  emptyText: /* @__PURE__ */ e(
881
881
  pe,
@@ -887,11 +887,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
887
887
  }
888
888
  }
889
889
  ) }, "basic"),
890
- /* @__PURE__ */ e(_e, { header: "设备图标", children: /* @__PURE__ */ e(
891
- $e,
890
+ /* @__PURE__ */ e(ze, { header: "设备图标", children: /* @__PURE__ */ e(
891
+ Le,
892
892
  {
893
893
  dataSource: u.device,
894
- renderItem: (g) => I(g, !1),
894
+ renderItem: (g) => k(g, !1),
895
895
  locale: {
896
896
  emptyText: /* @__PURE__ */ e(
897
897
  pe,
@@ -903,11 +903,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
903
903
  }
904
904
  }
905
905
  ) }, "device"),
906
- /* @__PURE__ */ e(_e, { header: "文本", children: /* @__PURE__ */ e(
907
- $e,
906
+ /* @__PURE__ */ e(ze, { header: "文本", children: /* @__PURE__ */ e(
907
+ Le,
908
908
  {
909
909
  dataSource: u.text,
910
- renderItem: (g) => I(g, !1),
910
+ renderItem: (g) => k(g, !1),
911
911
  locale: {
912
912
  emptyText: /* @__PURE__ */ e(
913
913
  pe,
@@ -920,7 +920,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
920
920
  }
921
921
  ) }, "text"),
922
922
  /* @__PURE__ */ h(
923
- _e,
923
+ ze,
924
924
  {
925
925
  header: /* @__PURE__ */ h("div", { className: "flex items-center justify-between", children: [
926
926
  /* @__PURE__ */ e("span", { children: "线条" }),
@@ -928,10 +928,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
928
928
  ] }),
929
929
  children: [
930
930
  /* @__PURE__ */ e(
931
- $e,
931
+ Le,
932
932
  {
933
933
  dataSource: u.line,
934
- renderItem: (g) => I(g, !0),
934
+ renderItem: (g) => k(g, !0),
935
935
  locale: {
936
936
  emptyText: /* @__PURE__ */ e(
937
937
  pe,
@@ -951,11 +951,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
951
951
  },
952
952
  "line"
953
953
  ),
954
- u.group.length > 0 && /* @__PURE__ */ e(_e, { header: "群组", children: /* @__PURE__ */ e(
955
- $e,
954
+ u.group.length > 0 && /* @__PURE__ */ e(ze, { header: "群组", children: /* @__PURE__ */ e(
955
+ Le,
956
956
  {
957
957
  dataSource: u.group,
958
- renderItem: (g) => I(g, !1),
958
+ renderItem: (g) => k(g, !1),
959
959
  locale: {
960
960
  emptyText: /* @__PURE__ */ e(
961
961
  pe,
@@ -967,11 +967,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
967
967
  }
968
968
  }
969
969
  ) }, "group"),
970
- u.custom.length > 0 && /* @__PURE__ */ e(_e, { header: "自定义", children: /* @__PURE__ */ e(
971
- $e,
970
+ u.custom.length > 0 && /* @__PURE__ */ e(ze, { header: "自定义", children: /* @__PURE__ */ e(
971
+ Le,
972
972
  {
973
973
  dataSource: u.custom,
974
- renderItem: (g) => I(g, !1),
974
+ renderItem: (g) => k(g, !1),
975
975
  locale: {
976
976
  emptyText: /* @__PURE__ */ e(
977
977
  pe,
@@ -986,9 +986,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
986
986
  ]
987
987
  }
988
988
  ) }),
989
- /* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ e(rt, { type: "secondary", className: "text-xs", children: n === "line-draw" ? /* @__PURE__ */ e(Oe, { children: "💡 提示:点击绘制线段,可连续绘制多段线,双击结束绘制,ESC 取消" }) : /* @__PURE__ */ e(Oe, { children: "💡 提示:拖拽物料到画布创建节点,点击线条物料进入绘制模式" }) }) })
989
+ /* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ e(it, { type: "secondary", className: "text-xs", children: n === "line-draw" ? /* @__PURE__ */ e(Ae, { children: "💡 提示:点击绘制线段,可连续绘制多段线,双击结束绘制,ESC 取消" }) : /* @__PURE__ */ e(Ae, { children: "💡 提示:拖拽物料到画布创建节点,点击线条物料进入绘制模式" }) }) })
990
990
  ] });
991
- }, { Text: Dt } = Pt, Yn = (l, f) => {
991
+ }, { Text: Lt } = Tt, Xn = (l, f) => {
992
992
  try {
993
993
  const t = f && Array.isArray(f) ? f.map((n, a) => n.paramsName) : ["A"], c = new Function(...t, l.expression)(...f.map((n) => n.value));
994
994
  return console.log(
@@ -1000,16 +1000,16 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1000
1000
  } catch (t) {
1001
1001
  return console.warn(`状态表达式执行失败 [${l.name}]:`, t), !1;
1002
1002
  }
1003
- }, Xn = (l, f) => {
1003
+ }, Pn = (l, f) => {
1004
1004
  for (const t of l) {
1005
1005
  console.log(t, "status");
1006
1006
  let r = [];
1007
1007
  if (Array.isArray(f) ? (console.log(t.bindCodes, "bindCodes"), r = f.filter(
1008
1008
  (c) => t.bindCodes?.includes(c.paramsCode)
1009
- )) : r = f, Yn(t, r))
1009
+ )) : r = f, Xn(t, r))
1010
1010
  return t;
1011
1011
  }
1012
- }, Pn = (l, f) => {
1012
+ }, Tn = (l, f) => {
1013
1013
  if (!f || !l)
1014
1014
  return { value: void 0 };
1015
1015
  if (Array.isArray(l)) {
@@ -1025,12 +1025,12 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1025
1025
  unit: l.unit
1026
1026
  };
1027
1027
  return { value: void 0 };
1028
- }, Tn = (l, f) => {
1028
+ }, Rn = (l, f) => {
1029
1029
  if (l == null || l === "") return "";
1030
1030
  if (f === -1) return String(l);
1031
1031
  const t = Number(l);
1032
1032
  return isNaN(t) ? String(l) : t.toFixed(f ?? 2);
1033
- }, Rn = (l, f, t, r) => {
1033
+ }, _n = (l, f, t, r) => {
1034
1034
  switch (l.type) {
1035
1035
  case "IMAGE":
1036
1036
  const c = l, n = c.backgroundColor, a = c.fillColor;
@@ -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,
1064
- labelStyle: v,
1065
- valueStyle: I,
1063
+ decimals: E,
1064
+ labelStyle: b,
1065
+ valueStyle: k,
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: U, unit: j } = S ? Tn(f, S) : { value: void 0, unit: void 0 }, Y = Rn(U !== void 0 ? U : m, E), $ = u || j || "";
1068
1068
  return /* @__PURE__ */ h(
1069
1069
  "div",
1070
1070
  {
@@ -1072,30 +1072,30 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1072
1072
  style: { ...g },
1073
1073
  children: [
1074
1074
  d && /* @__PURE__ */ e(
1075
- Dt,
1075
+ Lt,
1076
1076
  {
1077
1077
  style: {
1078
1078
  fontSize: 14,
1079
1079
  fontWeight: "bold",
1080
1080
  color: "#262626",
1081
1081
  textAlign: "left",
1082
- ...v
1082
+ ...b
1083
1083
  },
1084
1084
  children: d
1085
1085
  }
1086
1086
  ),
1087
- $ && /* @__PURE__ */ h(
1088
- Dt,
1087
+ Y && /* @__PURE__ */ h(
1088
+ Lt,
1089
1089
  {
1090
1090
  style: {
1091
1091
  fontSize: 14,
1092
1092
  color: "#1890ff",
1093
1093
  textAlign: "left",
1094
- ...I
1094
+ ...k
1095
1095
  },
1096
1096
  children: [
1097
- $,
1098
- L ? ` ${L}` : ""
1097
+ Y,
1098
+ $ ? ` ${$}` : ""
1099
1099
  ]
1100
1100
  }
1101
1101
  )
@@ -1107,32 +1107,32 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1107
1107
  thickness: ne = 2,
1108
1108
  color: we = "#d9d9d9",
1109
1109
  dashed: ie = !1,
1110
- lineType: A = ie ? "dashed" : "solid",
1111
- lineWeight: J = ne,
1110
+ lineType: W = ie ? "dashed" : "solid",
1111
+ lineWeight: K = ne,
1112
1112
  // 起点和终点的相对坐标
1113
1113
  startX: G = 0,
1114
- startY: T = 0,
1114
+ startY: R = 0,
1115
1115
  endX: s = 100,
1116
1116
  endY: q = 0
1117
- } = xe.config || {}, Y = ((je) => {
1118
- const j = Math.max(J, 1);
1119
- switch (je) {
1117
+ } = xe.config || {}, X = ((We) => {
1118
+ const F = Math.max(K, 1);
1119
+ switch (We) {
1120
1120
  case "solid":
1121
1121
  return "";
1122
1122
  case "dashed":
1123
- return `${j * 8},${j * 4}`;
1123
+ return `${F * 8},${F * 4}`;
1124
1124
  case "center":
1125
- return `${j * 12},${j * 3},${j * 2},${j * 3}`;
1125
+ return `${F * 12},${F * 3},${F * 2},${F * 3}`;
1126
1126
  case "phantom":
1127
- return `${j * 12},${j * 3},${j * 2},${j * 3},${j * 2},${j * 3}`;
1127
+ return `${F * 12},${F * 3},${F * 2},${F * 3},${F * 2},${F * 3}`;
1128
1128
  case "dot":
1129
- return `${j},${j * 3}`;
1129
+ return `${F},${F * 3}`;
1130
1130
  case "dash-dot":
1131
- return `${j * 8},${j * 3},${j},${j * 3}`;
1131
+ return `${F * 8},${F * 3},${F},${F * 3}`;
1132
1132
  default:
1133
1133
  return "";
1134
1134
  }
1135
- })(A), M = t ? "#1890ff" : we;
1135
+ })(W), D = t ? "#1890ff" : we;
1136
1136
  return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */ h(
1137
1137
  "svg",
1138
1138
  {
@@ -1145,11 +1145,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1145
1145
  "line",
1146
1146
  {
1147
1147
  x1: G,
1148
- y1: T,
1148
+ y1: R,
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" }
@@ -1159,12 +1159,12 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1159
1159
  "line",
1160
1160
  {
1161
1161
  x1: G,
1162
- y1: T,
1162
+ y1: R,
1163
1163
  x2: s,
1164
1164
  y2: q,
1165
- stroke: M,
1166
- strokeWidth: J,
1167
- strokeDasharray: Y,
1165
+ stroke: D,
1166
+ strokeWidth: K,
1167
+ strokeDasharray: X,
1168
1168
  strokeLinecap: "round",
1169
1169
  strokeLinejoin: "round",
1170
1170
  style: { pointerEvents: "none" }
@@ -1174,12 +1174,12 @@ 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
  }
1182
- }, _n = ({
1182
+ }, zn = ({
1183
1183
  node: l,
1184
1184
  isSelected: f = !1,
1185
1185
  onClick: t,
@@ -1188,217 +1188,219 @@ 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, b = ue(t);
1192
+ he(() => {
1193
+ b.current = t;
1194
+ }, [t]);
1195
+ const [k, g] = ee(null), U = ue(null), j = ue(null), T = ue(null), Y = ue(null), [$, xe] = ee(null), [ne, we] = ee(null), ie = ue(null), W = Pt(() => {
1194
1196
  if (m.length === 0) return;
1195
- const C = Xn(m, c);
1196
- 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(() => {
1198
- const C = $.current?.closest('[data-canvas="true"]');
1199
- if (!C) return a;
1200
- const z = C.getBoundingClientRect(), R = parseFloat(C.style.width);
1201
- return R ? z.width / R : a;
1202
- }, [a]), M = V((C, z) => {
1203
- C.stopPropagation(), C.preventDefault(), W.current = {
1204
- mouseX: C.clientX,
1205
- mouseY: C.clientY,
1206
- startX: T?.startX || 0,
1207
- startY: T?.startY || 0,
1208
- endX: T?.endX || 0,
1209
- endY: T?.endY || 0,
1197
+ const I = Pn(m, c);
1198
+ return I || m[0];
1199
+ }, [m, c]), K = W?.material, G = K?.type === "LINE", R = G ? K.config : null, s = i.scale ?? 1, q = (i.width || 100) * s, x = (i.height || 100) * s, X = V(() => {
1200
+ const I = Y.current?.closest('[data-canvas="true"]');
1201
+ if (!I) return a;
1202
+ const O = I.getBoundingClientRect(), _ = parseFloat(I.style.width);
1203
+ return _ ? O.width / _ : a;
1204
+ }, [a]), D = V((I, O) => {
1205
+ I.stopPropagation(), I.preventDefault(), U.current = {
1206
+ mouseX: I.clientX,
1207
+ mouseY: I.clientY,
1208
+ startX: R?.startX || 0,
1209
+ startY: R?.startY || 0,
1210
+ endX: R?.endX || 0,
1211
+ endY: R?.endY || 0,
1210
1212
  nodeX: i.x || 0,
1211
1213
  nodeY: i.y || 0
1212
- }, g(z);
1213
- }, [T, i.x, i.y]);
1214
- me(() => {
1215
- if (!I || !G || !T || !n) return;
1216
- const C = (R) => {
1217
- const D = W.current;
1218
- 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);
1223
- O.current = {
1214
+ }, g(O);
1215
+ }, [R, i.x, i.y]);
1216
+ he(() => {
1217
+ if (!k || !G || !R || !n) return;
1218
+ const I = (_) => {
1219
+ const L = U.current;
1220
+ if (!L || !Y.current) return;
1221
+ const me = X(), fe = (_.clientX - L.mouseX) / me, ae = (_.clientY - L.mouseY) / me;
1222
+ let Q = L.startX, oe = L.startY, se = L.endX, ce = L.endY, Xe = L.nodeX, Pe = L.nodeY;
1223
+ k === "start" ? (Q = L.startX + fe, oe = L.startY + ae, Q < 0 && (Xe = L.nodeX + Q, se = L.endX - Q, Q = 0), oe < 0 && (Pe = L.nodeY + oe, ce = L.endY - oe, oe = 0)) : (se = L.endX + fe, ce = L.endY + ae, se < 0 && (Xe = L.nodeX + se, Q = L.startX - se, se = 0), ce < 0 && (Pe = L.nodeY + ce, oe = L.startY - ce, ce = 0));
1224
+ const nt = Math.max((R.lineWeight || 2) * 2, 4), lt = Math.max(Q, se), rt = Math.max(oe, ce), Fe = Math.max(lt, nt), Te = Math.max(rt, nt);
1225
+ j.current = {
1224
1226
  nodeX: Xe,
1225
1227
  nodeY: Pe,
1226
- width: We,
1228
+ width: Fe,
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
- const ge = $.current;
1234
- 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));
1235
+ const ge = Y.current;
1236
+ ge.style.left = `${Xe}px`, ge.style.top = `${Pe}px`, ge.style.width = `${Fe}px`, ge.style.height = `${Te}px`, ge.querySelectorAll("svg line").forEach((ke) => {
1237
+ ke.setAttribute("x1", String(Q)), ke.setAttribute("y1", String(oe)), ke.setAttribute("x2", String(se)), ke.setAttribute("y2", String(ce));
1236
1238
  });
1237
- 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`);
1239
- }, z = () => {
1240
- const R = O.current;
1241
- R && n(l.id, {
1239
+ const Ue = ge.querySelector('[data-handle="start"]'), He = ge.querySelector('[data-handle="end"]');
1240
+ Ue && (Ue.style.left = `${Q - 6}px`, Ue.style.top = `${oe - 6}px`), He && (He.style.left = `${se - 6}px`, He.style.top = `${ce - 6}px`);
1241
+ }, O = () => {
1242
+ const _ = j.current;
1243
+ _ && n(l.id, {
1242
1244
  normalStyle: {
1243
1245
  ...i,
1244
- x: R.nodeX,
1245
- y: R.nodeY,
1246
- width: R.width,
1247
- height: R.height
1246
+ x: _.nodeX,
1247
+ y: _.nodeY,
1248
+ width: _.width,
1249
+ height: _.height
1248
1250
  },
1249
1251
  contentInfo: {
1250
1252
  ...p,
1251
- statusList: m.map((D) => ({
1252
- ...D,
1253
- material: D.material.type === "LINE" ? {
1254
- ...D.material,
1253
+ statusList: m.map((L) => ({
1254
+ ...L,
1255
+ material: L.material.type === "LINE" ? {
1256
+ ...L.material,
1255
1257
  config: {
1256
- ...T,
1257
- startX: R.startX,
1258
- startY: R.startY,
1259
- endX: R.endX,
1260
- endY: R.endY
1258
+ ...R,
1259
+ startX: _.startX,
1260
+ startY: _.startY,
1261
+ endX: _.endX,
1262
+ endY: _.endY
1261
1263
  }
1262
- } : D.material
1264
+ } : L.material
1263
1265
  }))
1264
1266
  }
1265
- }), g(null), W.current = null, O.current = null;
1267
+ }), g(null), U.current = null, j.current = null;
1266
1268
  };
1267
- return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1268
- window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1269
+ return window.addEventListener("mousemove", I), window.addEventListener("mouseup", O), () => {
1270
+ window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", O);
1269
1271
  };
1270
- }, [I, G, T, l.id, i, p, m, n, Y]), me(() => {
1271
- if (!L || !n) return;
1272
- const C = (R) => {
1273
- 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
- switch (L.corner) {
1272
+ }, [k, G, R, l.id, i, p, m, n, X]), he(() => {
1273
+ if (!$ || !n) return;
1274
+ const I = (_) => {
1275
+ if (!Y.current) return;
1276
+ const L = X(), me = (_.clientX - $.startX) / L, fe = (_.clientY - $.startY) / L;
1277
+ let ae = $.startWidth, Q = $.startHeight, oe = $.startNodeX, se = $.startNodeY;
1278
+ switch ($.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, $.startWidth + me), Q = Math.max(20, $.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, $.startWidth - me), Q = Math.max(20, $.startHeight + fe), oe = $.startNodeX + ($.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, $.startWidth + me), Q = Math.max(20, $.startHeight - fe), se = $.startNodeY + ($.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, $.startWidth - me), Q = Math.max(20, $.startHeight - fe), oe = $.startNodeX + ($.startWidth - ae), se = $.startNodeY + ($.startHeight - Q);
1288
1290
  break;
1289
1291
  }
1290
- X.current = { x: oe, y: se, width: ae, height: K };
1291
- const ce = $.current;
1292
- ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${K}px`;
1293
- }, z = () => {
1294
- const R = X.current;
1295
- R && n(l.id, {
1292
+ T.current = { x: oe, y: se, width: ae, height: Q };
1293
+ const ce = Y.current;
1294
+ ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${Q}px`;
1295
+ }, O = () => {
1296
+ const _ = T.current;
1297
+ _ && n(l.id, {
1296
1298
  normalStyle: {
1297
1299
  ...i,
1298
- x: R.x,
1299
- y: R.y,
1300
- width: R.width,
1301
- height: R.height
1300
+ x: _.x,
1301
+ y: _.y,
1302
+ width: _.width,
1303
+ height: _.height
1302
1304
  }
1303
- }), xe(null), X.current = null;
1305
+ }), xe(null), T.current = null;
1304
1306
  };
1305
- return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1306
- window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1307
+ return window.addEventListener("mousemove", I), window.addEventListener("mouseup", O), () => {
1308
+ window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", O);
1307
1309
  };
1308
- }, [L, n, l.id, i, Y]);
1309
- const ee = V((C, z) => {
1310
- C.stopPropagation(), C.preventDefault(), xe({
1311
- corner: z,
1312
- startX: C.clientX,
1313
- startY: C.clientY,
1310
+ }, [$, n, l.id, i, X]);
1311
+ const J = V((I, O) => {
1312
+ I.stopPropagation(), I.preventDefault(), xe({
1313
+ corner: O,
1314
+ startX: I.clientX,
1315
+ startY: I.clientY,
1314
1316
  startWidth: i.width || 100,
1315
1317
  startHeight: i.height || 100,
1316
1318
  startNodeX: i.x || 0,
1317
1319
  startNodeY: i.y || 0
1318
1320
  });
1319
- }, [i.width, i.height, i.x, i.y]), je = V((C) => {
1320
- C.stopPropagation(), C.preventDefault();
1321
- const z = $.current?.getBoundingClientRect();
1322
- z && we({
1323
- startX: C.clientX,
1324
- startY: C.clientY,
1321
+ }, [i.width, i.height, i.x, i.y]), We = V((I) => {
1322
+ I.stopPropagation(), I.preventDefault();
1323
+ const O = Y.current?.getBoundingClientRect();
1324
+ O && we({
1325
+ startX: I.clientX,
1326
+ startY: I.clientY,
1325
1327
  startAngle: i.rotate || 0,
1326
- centerX: z.left + z.width / 2,
1327
- centerY: z.top + z.height / 2
1328
+ centerX: O.left + O.width / 2,
1329
+ centerY: O.top + O.height / 2
1328
1330
  });
1329
1331
  }, [i.rotate]);
1330
- me(() => {
1332
+ he(() => {
1331
1333
  if (!ne) return;
1332
- 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
- if (ae < 0 && (ae += 360), ie.current = ae, $.current) {
1336
- const K = i.transform || "";
1337
- $.current.style.transform = `rotate(${ae}deg) ${K}`.trim();
1334
+ const I = (_) => {
1335
+ const L = _.clientX - ne.centerX, me = _.clientY - ne.centerY;
1336
+ let ae = (Math.atan2(me, L) * (180 / Math.PI) + 90) % 360;
1337
+ if (ae < 0 && (ae += 360), ie.current = ae, Y.current) {
1338
+ const Q = i.transform || "";
1339
+ Y.current.style.transform = `rotate(${ae}deg) ${Q}`.trim();
1338
1340
  }
1339
- }, z = () => {
1340
- const R = ie.current ?? ne.startAngle;
1341
+ }, O = () => {
1342
+ const _ = ie.current ?? ne.startAngle;
1341
1343
  ie.current = null, n && n(l.id, {
1342
1344
  normalStyle: {
1343
1345
  ...i,
1344
- rotate: Math.round(R)
1346
+ rotate: Math.round(_)
1345
1347
  }
1346
1348
  }), we(null);
1347
1349
  };
1348
- return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1349
- window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1350
+ return window.addEventListener("mousemove", I), window.addEventListener("mouseup", O), () => {
1351
+ window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", O);
1350
1352
  };
1351
1353
  }, [ne, n, l.id, i]);
1352
- const j = l.type === "group", st = {
1354
+ const F = l.type === "group", dt = {
1353
1355
  position: "absolute",
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
- background: j ? "transparent" : i.background || "transparent",
1360
- backgroundImage: j ? void 0 : i.backgroundImage ? `url(${i.backgroundImage})` : void 0,
1361
+ background: F ? "transparent" : i.background || "transparent",
1362
+ backgroundImage: F ? void 0 : i.backgroundImage ? `url(${i.backgroundImage})` : void 0,
1361
1363
  backgroundSize: "cover",
1362
1364
  backgroundPosition: "center",
1363
1365
  padding: Array.isArray(i.padding) ? i.padding.join("px ") + "px" : i.padding,
1364
1366
  margin: Array.isArray(i.margin) ? i.margin.join("px ") + "px" : i.margin,
1365
- borderRadius: j ? void 0 : i.borderRadius,
1367
+ borderRadius: F ? void 0 : i.borderRadius,
1366
1368
  // 线条物料选中时不显示边框,而是通过高亮线条颜色来表示
1367
1369
  // 群组节点选中时显示边框,平时不显示
1368
- border: f && !G ? "2px solid #1890ff" : G || j ? "none" : i.border || "1px dashed transparent",
1370
+ border: f && !G ? "2px solid #1890ff" : G || F ? "none" : i.border || "1px dashed transparent",
1369
1371
  // 线条节点需要捕获点击事件,但由内部 SVG 的透明线处理具体点击区域
1370
1372
  pointerEvents: "auto",
1371
1373
  opacity: i.opacity ?? 1,
1372
1374
  transform: `rotate(${ie.current ?? (i.rotate || 0)}deg) ${i.transform || ""}`.trim(),
1373
1375
  transformOrigin: "center center",
1374
1376
  zIndex: f ? 1e3 : i.zIndex ?? 1,
1375
- cursor: u && !I ? "move" : S ? "pointer" : "default",
1377
+ cursor: u && !k ? "move" : S ? "pointer" : "default",
1376
1378
  boxSizing: "border-box",
1377
1379
  // 选中、线条和群组节点使用 visible overflow,避免裁剪手柄
1378
- overflow: f || G || j ? "visible" : "hidden"
1379
- }, Ke = T ? { x: T.startX || 0, y: T.startY || 0 } : { x: 0, y: 0 }, Qe = T ? { x: T.endX || 0, y: T.endY || 0 } : { x: 0, y: 0 };
1380
+ overflow: f || G || F ? "visible" : "hidden"
1381
+ }, et = R ? { x: R.startX || 0, y: R.startY || 0 } : { x: 0, y: 0 }, tt = R ? { x: R.endX || 0, y: R.endY || 0 } : { x: 0, y: 0 };
1380
1382
  return /* @__PURE__ */ h(
1381
1383
  "div",
1382
1384
  {
1383
- ref: $,
1385
+ ref: Y,
1384
1386
  "data-node-id": l.id,
1385
- style: st,
1386
- onClick: (C) => {
1387
+ style: dt,
1388
+ onClick: (I) => {
1387
1389
  console.log("NodeRenderer onClick", l.id, "isClickable:", S);
1388
- const z = v.current;
1389
- S && z && !I && !L && !ne && (C.stopPropagation(), z(C));
1390
+ const O = b.current;
1391
+ S && O && !k && !$ && !ne && (I.stopPropagation(), O(I));
1390
1392
  },
1391
- onMouseDown: (C) => {
1392
- u && r && !I && r(C);
1393
+ onMouseDown: (I) => {
1394
+ u && r && !k && r(I);
1393
1395
  },
1394
1396
  children: [
1395
- f && !G && !j && /* @__PURE__ */ h(Oe, { children: [
1397
+ f && !G && !F && /* @__PURE__ */ h(Ae, { children: [
1396
1398
  /* @__PURE__ */ e(
1397
1399
  "div",
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: (I) => J(I, "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: (I) => J(I, "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: (I) => J(I, "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: (I) => J(I, "se"),
1429
1431
  title: "拖拽调整大小"
1430
1432
  }
1431
1433
  ),
@@ -1434,7 +1436,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1434
1436
  {
1435
1437
  className: "absolute top-0 left-1/2 w-4 h-4 bg-green-500 border-2 border-white rounded-full",
1436
1438
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "grab", marginTop: "-20px", transform: "translateX(-50%)", boxShadow: "0 0 4px rgba(0,0,0,0.3)" },
1437
- onMouseDown: (C) => je(C),
1439
+ onMouseDown: (I) => We(I),
1438
1440
  title: "拖拽旋转"
1439
1441
  }
1440
1442
  ),
@@ -1448,21 +1450,21 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1448
1450
  /* @__PURE__ */ h("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: [
1449
1451
  l.name,
1450
1452
  " ",
1451
- A ? `(${A.name})` : ""
1453
+ W ? `(${W.name})` : ""
1452
1454
  ] })
1453
1455
  ] }),
1454
- f && G && T && n && /* @__PURE__ */ h(Oe, { children: [
1456
+ f && G && R && n && /* @__PURE__ */ h(Ae, { children: [
1455
1457
  /* @__PURE__ */ e(
1456
1458
  "div",
1457
1459
  {
1458
1460
  "data-handle": "start",
1459
1461
  className: "absolute w-3 h-3 bg-blue-500 border-2 border-white rounded-full cursor-move z-50",
1460
1462
  style: {
1461
- left: Ke.x - 6,
1462
- top: Ke.y - 6,
1463
+ left: et.x - 6,
1464
+ top: et.y - 6,
1463
1465
  boxShadow: "0 0 4px rgba(0,0,0,0.3)"
1464
1466
  },
1465
- onMouseDown: (C) => M(C, "start"),
1467
+ onMouseDown: (I) => D(I, "start"),
1466
1468
  title: "拖拽调整起点"
1467
1469
  }
1468
1470
  ),
@@ -1472,37 +1474,37 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1472
1474
  "data-handle": "end",
1473
1475
  className: "absolute w-3 h-3 bg-blue-500 border-2 border-white rounded-full cursor-move z-50",
1474
1476
  style: {
1475
- left: Qe.x - 6,
1476
- top: Qe.y - 6,
1477
+ left: tt.x - 6,
1478
+ top: tt.y - 6,
1477
1479
  boxShadow: "0 0 4px rgba(0,0,0,0.3)"
1478
1480
  },
1479
- onMouseDown: (C) => M(C, "end"),
1481
+ onMouseDown: (I) => D(I, "end"),
1480
1482
  title: "拖拽调整终点"
1481
1483
  }
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: _n(K, c, f) }) : F ? 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
  ) }),
1489
- l.type === "group" && l.children && /* @__PURE__ */ e("div", { className: "absolute inset-0 pointer-events-none", children: l.children.map((C) => /* @__PURE__ */ e("div", { className: "pointer-events-auto", children: /* @__PURE__ */ e(
1490
- Ut,
1491
+ l.type === "group" && l.children && /* @__PURE__ */ e("div", { className: "absolute inset-0 pointer-events-none", children: l.children.map((I) => /* @__PURE__ */ e("div", { className: "pointer-events-auto", children: /* @__PURE__ */ e(
1492
+ Ht,
1491
1493
  {
1492
- node: C,
1494
+ node: I,
1493
1495
  isSelected: !1,
1494
1496
  data: c,
1495
1497
  onUpdateNode: n,
1496
1498
  scale: a
1497
1499
  }
1498
- ) }, C.id)) })
1500
+ ) }, I.id)) })
1499
1501
  ]
1500
1502
  }
1501
1503
  );
1502
- }, Ut = Ce.memo(_n, (l, f) => {
1504
+ }, Ht = Ce.memo(zn, (l, f) => {
1503
1505
  const t = l.node, r = f.node, c = t.id === r.id && t.normalStyle.x === r.normalStyle.x && t.normalStyle.y === r.normalStyle.y && t.normalStyle.width === r.normalStyle.width && t.normalStyle.height === r.normalStyle.height, n = t.contentInfo === r.contentInfo, a = l.isSelected === f.isSelected && l.scale === f.scale;
1504
1506
  return c && n && a;
1505
- }), zn = [
1507
+ }), On = [
1506
1508
  "#1890ff",
1507
1509
  "#52c41a",
1508
1510
  "#faad14",
@@ -1519,15 +1521,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1519
1521
  "#000000",
1520
1522
  "#ff4d4f",
1521
1523
  "#73d13d"
1522
- ], Ae = ({
1524
+ ], je = ({
1523
1525
  value: l = "#1890ff",
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
  };
@@ -1566,7 +1568,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1566
1568
  border: "1px solid #f0f0f0"
1567
1569
  },
1568
1570
  children: [
1569
- /* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: zn.map((d) => /* @__PURE__ */ e(
1571
+ /* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: On.map((d) => /* @__PURE__ */ e(
1570
1572
  "div",
1571
1573
  {
1572
1574
  onClick: () => {
@@ -1603,7 +1605,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1603
1605
  }
1604
1606
  )
1605
1607
  ] });
1606
- }, { TextArea: On } = re, An = ({ defaultTestData: l }) => {
1608
+ }, { TextArea: An } = re, jn = ({ defaultTestData: l }) => {
1607
1609
  const f = ue(null), t = ue(null), r = ue(null), {
1608
1610
  nodes: c,
1609
1611
  selectedNodeId: n,
@@ -1614,56 +1616,58 @@ 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,
1618
- updateNode: v,
1619
- removeNode: I,
1619
+ selectNode: E,
1620
+ updateNode: b,
1621
+ removeNode: k,
1620
1622
  undo: g,
1621
- redo: W,
1622
- setMode: O,
1623
- startLineDrawing: X,
1624
- endLineDrawing: $,
1625
- cancelLineDrawing: L
1626
- } = ze(), [xe, ne] = Q(!1), [, we] = Q({}), ie = ue(a);
1627
- me(() => {
1623
+ redo: U,
1624
+ setMode: j,
1625
+ startLineDrawing: T,
1626
+ endLineDrawing: Y,
1627
+ cancelLineDrawing: $
1628
+ } = Oe();
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 W = ue(!1), K = ue({ x: 0, y: 0 }), G = ue({ x: 0, y: 0, newX: 0, newY: 0 }), R = ue(null), [s, q] = ee({ start: null, end: null, isDrawing: !1 }), [x, X] = ee({ start: null, end: null }), [D, J] = ee([]);
1631
1635
  ue(!1);
1632
- const [je, j] = Q(!1), [st, Ke] = Q(
1636
+ const [We, F] = ee(!1), [dt, et] = ee(
1633
1637
  JSON.stringify(l, null, 2)
1634
- ), [Qe, C] = Q(!1), [z, R] = Q(!1), D = V((o, y) => {
1638
+ ), [tt, I] = ee(!1), [O, _] = ee(!1), L = V((o, v) => {
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;
1637
- return { x: Math.round(U), y: Math.round(B) };
1638
- }, [d.width, d.height]), he = V((o, y) => D(o, y), [D]), fe = V(
1639
- (o, y, N = !0) => {
1640
+ const N = t.current.getBoundingClientRect(), C = o - N.left, y = v - N.top, M = N.width / d.width, A = N.height / d.height, P = C / M, B = y / A;
1641
+ return { x: Math.round(P), y: Math.round(B) };
1642
+ }, [d.width, d.height]), me = V((o, v) => L(o, v), [L]), fe = V(
1643
+ (o, v, 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 C = i.material, y = C.config || {}, M = y.lineWeight || y.thickness || 2, A = Math.min(o.x, v.x), P = Math.min(o.y, v.y), B = Math.round(o.x - A), z = Math.round(o.y - P), le = Math.round(v.x - A), de = Math.round(v.y - P), ve = Math.max(M * 2, 4), _e = Math.max(Math.abs(o.x - v.x), ve), Ee = Math.max(Math.abs(o.y - v.y), ve), at = {
1646
+ ...C,
1643
1647
  id: H(),
1644
1648
  config: {
1645
- color: x.color,
1646
- lineWeight: P,
1647
- thickness: P,
1648
- lineType: x.lineType,
1649
+ color: y.color,
1650
+ lineWeight: M,
1651
+ thickness: M,
1652
+ lineType: y.lineType,
1649
1653
  startX: B,
1650
- startY: _,
1654
+ startY: z,
1651
1655
  endX: le,
1652
1656
  endY: de
1653
1657
  }
1654
- }, Gt = {
1658
+ }, qt = {
1655
1659
  id: H(),
1656
- name: `${E.name}_${Date.now()}`,
1660
+ name: `${C.name}_${Date.now()}`,
1657
1661
  type: "normal",
1658
1662
  normalStyle: {
1659
- width: Re,
1660
- height: ke,
1661
- x: F,
1662
- y: U,
1663
+ width: _e,
1664
+ height: Ee,
1665
+ x: A,
1666
+ y: P,
1663
1667
  background: "transparent"
1664
1668
  },
1665
1669
  contentInfo: {
1666
- statusList: [Ft(lt)],
1670
+ statusList: [Ut(at)],
1667
1671
  currentStatusId: void 0
1668
1672
  },
1669
1673
  controlInfo: {
@@ -1673,17 +1677,17 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1673
1677
  isSelectable: !0
1674
1678
  }
1675
1679
  };
1676
- if (u(Gt, !1), N) {
1677
- const yt = { x: y.x, y: y.y };
1680
+ if (u(qt, !1), N) {
1681
+ const vt = { x: v.x, y: v.y };
1678
1682
  q({
1679
- start: yt,
1680
- end: { ...yt },
1683
+ start: vt,
1684
+ end: { ...vt },
1681
1685
  isDrawing: !0
1682
1686
  });
1683
1687
  } else
1684
- q({ start: null, end: null, isDrawing: !1 }), $();
1688
+ q({ start: null, end: null, isDrawing: !1 }), Y();
1685
1689
  },
1686
- [i.material, u, $]
1690
+ [i.material, u, Y]
1687
1691
  ), ae = V(() => {
1688
1692
  const o = f.current?.state;
1689
1693
  o && m({
@@ -1691,35 +1695,35 @@ 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
+ W.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) {
1702
1706
  if (a === "line-draw" && i.material) {
1703
1707
  o.stopPropagation();
1704
- const y = D(o.clientX, o.clientY);
1705
- s.isDrawing ? s.start && fe(s.start, y, !0) : q({ start: y, end: y, isDrawing: !0 });
1708
+ const v = L(o.clientX, o.clientY);
1709
+ s.isDrawing ? s.start && fe(s.start, v, !0) : q({ start: v, end: v, isDrawing: !0 });
1706
1710
  return;
1707
1711
  }
1708
- if (a === "box-select" && !z) {
1709
- const y = he(o.clientX, o.clientY);
1710
- Y({ start: y, end: y }), ee([]), o.preventDefault(), o.stopPropagation();
1712
+ if (a === "box-select" && !O) {
1713
+ const v = me(o.clientX, o.clientY);
1714
+ X({ start: v, end: v }), 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, O, fe, L, me]
1715
1719
  ), se = V(
1716
1720
  (o) => {
1717
1721
  if (!(a !== "line-draw" || !i.material) && s.isDrawing && s.start) {
1718
- const y = D(o.clientX, o.clientY);
1719
- fe(s.start, y, !1);
1722
+ const v = L(o.clientX, o.clientY);
1723
+ fe(s.start, v, !1);
1720
1724
  }
1721
1725
  },
1722
- [a, i.material, s.isDrawing, s.start, fe, D]
1726
+ [a, i.material, s.isDrawing, s.start, fe, L]
1723
1727
  ), ce = V((o) => {
1724
1728
  o.preventDefault(), o.dataTransfer.dropEffect = "copy", ne(!0);
1725
1729
  }, []), Xe = V((o) => {
@@ -1728,93 +1732,93 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1728
1732
  (o) => {
1729
1733
  if (o.preventDefault(), ne(!1), !(!t.current || a !== "select"))
1730
1734
  try {
1731
- const y = o.dataTransfer.getData("application/json");
1732
- 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);
1735
- } catch (y) {
1736
- console.error("Failed to parse dropped material:", y);
1735
+ const v = o.dataTransfer.getData("application/json");
1736
+ if (!v) return;
1737
+ const N = JSON.parse(v), C = L(o.clientX, o.clientY), y = C.x - 50, M = C.y - 50, A = Yn(y, M, N);
1738
+ u(A), J([A.id]);
1739
+ } catch (v) {
1740
+ console.error("Failed to parse dropped material:", v);
1737
1741
  }
1738
1742
  },
1739
- [a, u, D]
1740
- ), et = V(
1741
- (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 = {
1743
- x: y.normalStyle.x || 0,
1744
- y: y.normalStyle.y || 0,
1745
- newX: y.normalStyle.x || 0,
1746
- newY: y.normalStyle.y || 0
1747
- }, T.current = y, o.preventDefault());
1743
+ [a, u, L]
1744
+ ), nt = V(
1745
+ (o, v) => {
1746
+ a !== "select" && a !== "box-select" || !v.controlInfo.isDraggable || (o.stopPropagation(), E(v.id), W.current = !0, K.current = { x: o.clientX, y: o.clientY }, G.current = {
1747
+ x: v.normalStyle.x || 0,
1748
+ y: v.normalStyle.y || 0,
1749
+ newX: v.normalStyle.x || 0,
1750
+ newY: v.normalStyle.y || 0
1751
+ }, R.current = v, o.preventDefault());
1748
1752
  },
1749
- [a, k]
1753
+ [a, E]
1750
1754
  );
1751
- me(() => {
1752
- const o = (x) => {
1753
- if (A.current && n && T.current) {
1755
+ he(() => {
1756
+ const o = (y) => {
1757
+ if (W.current && n && R.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 M = t.current.getBoundingClientRect(), A = M.width / d.width, P = M.height / d.height, B = y.clientX - K.current.x, z = y.clientY - K.current.y, le = B / A, de = z / P, ve = G.current.x + le, _e = G.current.y + de, Ee = document.querySelector(
1756
1760
  `[data-node-id="${n}"]`
1757
1761
  );
1758
- ke && (ke.style.left = `${ve}px`, ke.style.top = `${Re}px`), G.current.newX = ve, G.current.newY = Re;
1762
+ Ee && (Ee.style.left = `${ve}px`, Ee.style.top = `${_e}px`), G.current.newX = ve, G.current.newY = _e;
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 M = me(y.clientX, y.clientY);
1766
+ X((A) => ({ ...A, end: M }));
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 M = L(y.clientX, y.clientY);
1770
+ q((A) => ({ ...A, end: M }));
1767
1771
  }
1768
- }, y = () => {
1769
- 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, {
1772
+ }, v = () => {
1773
+ if (W.current && n && R.current) {
1774
+ const y = Oe.getState(), M = G.current.newX ?? G.current.x, A = G.current.newY ?? G.current.y;
1775
+ y.updateNode(n, {
1772
1776
  normalStyle: {
1773
- ...T.current.normalStyle,
1774
- x: P,
1775
- y: F
1777
+ ...R.current.normalStyle,
1778
+ x: M,
1779
+ y: A
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((_) => {
1781
- 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;
1783
- }).map((_) => _.id);
1784
- ee(B), Y({ start: null, end: null });
1783
+ if (W.current = !1, R.current = null, we({}), a === "box-select" && x.start && x.end) {
1784
+ const y = Math.min(x.start.x, x.end.x), M = Math.max(x.start.x, x.end.x), A = Math.min(x.start.y, x.end.y), P = Math.max(x.start.y, x.end.y), B = c.filter((z) => {
1785
+ const le = z.normalStyle.x || 0, de = z.normalStyle.y || 0, ve = z.normalStyle.width || 0, _e = z.normalStyle.height || 0, Ee = le + ve / 2, at = de + _e / 2;
1786
+ return Ee >= y && Ee <= M && at >= A && at <= P;
1787
+ }).map((z) => z.id);
1788
+ J(B), X({ 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 = (y) => {
1791
+ y.key === "Escape" && a === "line-draw" && (q({ start: null, end: null, isDrawing: !1 }), $()), y.key === "Delete" && (n ? k(n) : D.length > 0 && (D.forEach((M) => k(M)), J([]))), y.ctrlKey && y.key === "z" && (y.preventDefault(), g()), y.ctrlKey && y.key === "y" && (y.preventDefault(), U()), y.key === " " && !O && (y.preventDefault(), _(!0));
1792
+ }, C = (y) => {
1793
+ y.key === " " && O && _(!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", v), window.addEventListener("keydown", N), window.addEventListener("keyup", C), () => {
1796
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", v), window.removeEventListener("keydown", N), window.removeEventListener("keyup", C);
1793
1797
  };
1794
1798
  }, [
1795
1799
  n,
1796
- b,
1800
+ x,
1797
1801
  a,
1798
1802
  s.isDrawing,
1799
- M,
1803
+ D,
1800
1804
  c,
1801
1805
  d.width,
1802
1806
  d.height,
1803
- I,
1807
+ k,
1804
1808
  g,
1805
- z,
1806
- W,
1809
+ O,
1810
+ U,
1811
+ $,
1807
1812
  L,
1808
- D,
1809
- he,
1810
- ee
1813
+ me,
1814
+ J
1811
1815
  ]);
1812
- 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) : [];
1816
+ const lt = V(() => {
1817
+ const o = D.length > 0 ? D.map((N) => c.find((C) => C.id === N)).filter(Boolean) : n ? [c.find((N) => N.id === n)].filter(Boolean) : [];
1814
1818
  if (o.length === 0) return;
1815
- const y = [];
1819
+ const v = [];
1816
1820
  o.forEach((N) => {
1817
- const E = {
1821
+ const C = {
1818
1822
  ...N,
1819
1823
  id: H(),
1820
1824
  name: `${N.name}_副本`,
@@ -1824,50 +1828,50 @@ 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(() => {
1830
- if (M.length < 2) return;
1831
+ u(C), v.push(C.id);
1832
+ }), v.length === 1 ? E(v[0]) : J(v);
1833
+ }, [n, D, c, u, E, J]), rt = V(() => {
1834
+ if (D.length < 2) return;
1831
1835
  const o = [];
1832
- for (let U = 0; U < M.length; U++) {
1833
- const B = M[U], _ = c.find((le) => le.id === B);
1834
- if (_) {
1835
- if (_?.type === "group") {
1836
- _.children.forEach((de) => o.push({
1836
+ for (let P = 0; P < D.length; P++) {
1837
+ const B = D[P], z = c.find((le) => le.id === B);
1838
+ if (z) {
1839
+ if (z?.type === "group") {
1840
+ z.children.forEach((de) => o.push({
1837
1841
  ...de,
1838
1842
  normalStyle: {
1839
1843
  ...de.normalStyle,
1840
- x: (_.normalStyle.x || 0) + (de.normalStyle.x || 0),
1841
- y: (_.normalStyle.y || 0) + (de.normalStyle.y || 0)
1844
+ x: (z.normalStyle.x || 0) + (de.normalStyle.x || 0),
1845
+ y: (z.normalStyle.y || 0) + (de.normalStyle.y || 0)
1842
1846
  }
1843
- })), I(B);
1847
+ })), k(B);
1844
1848
  continue;
1845
1849
  }
1846
- o.push(_);
1850
+ o.push(z);
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;
1851
- o.forEach((U) => {
1852
- 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);
1854
+ let v = 1 / 0, N = 1 / 0, C = -1 / 0, y = -1 / 0;
1855
+ o.forEach((P) => {
1856
+ const B = P.normalStyle.x || 0, z = P.normalStyle.y || 0, le = P.normalStyle.width || 0, de = P.normalStyle.height || 0;
1857
+ v = Math.min(v, B), N = Math.min(N, z), C = Math.max(C, B + le), y = Math.max(y, z + de);
1854
1858
  });
1855
- const P = o.map((U) => ({
1856
- ...U,
1859
+ const M = o.map((P) => ({
1860
+ ...P,
1857
1861
  normalStyle: {
1858
- ...U.normalStyle,
1859
- x: (U.normalStyle.x || 0) - y,
1860
- y: (U.normalStyle.y || 0) - N
1862
+ ...P.normalStyle,
1863
+ x: (P.normalStyle.x || 0) - v,
1864
+ y: (P.normalStyle.y || 0) - N
1861
1865
  }
1862
- })), F = {
1866
+ })), A = {
1863
1867
  id: H(),
1864
1868
  name: `群组_${Date.now()}`,
1865
1869
  type: "group",
1866
1870
  normalStyle: {
1867
- x: y,
1871
+ x: v,
1868
1872
  y: N,
1869
- width: E - y,
1870
- height: x - N,
1873
+ width: C - v,
1874
+ height: y - N,
1871
1875
  background: "transparent"
1872
1876
  },
1873
1877
  contentInfo: {
@@ -1880,239 +1884,253 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
1880
1884
  isResizable: !0,
1881
1885
  isSelectable: !0
1882
1886
  },
1883
- children: P
1887
+ children: M
1884
1888
  };
1885
- M.forEach((U) => I(U)), u(F), ee([]), k(F.id);
1886
- }, [M, c, I, u, k]), We = V(() => {
1887
- 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
- o.length !== 0 && (o.forEach((y) => {
1889
- if (!y.children || y.children.length === 0) return;
1890
- const N = y.children.map((E) => ({
1891
- ...E,
1889
+ D.forEach((P) => k(P)), u(A), J([]), E(A.id);
1890
+ }, [D, c, k, u, E]), Fe = V(() => {
1891
+ const o = D.length > 0 ? D.map((v) => c.find((N) => N.id === v)).filter((v) => !!v && v.type === "group") : n ? [c.find((v) => v.id === n)].filter((v) => !!v && v.type === "group") : [];
1892
+ o.length !== 0 && (o.forEach((v) => {
1893
+ if (!v.children || v.children.length === 0) return;
1894
+ const N = v.children.map((C) => ({
1895
+ ...C,
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
+ ...C.normalStyle,
1898
+ x: (v.normalStyle.x || 0) + (C.normalStyle.x || 0),
1899
+ y: (v.normalStyle.y || 0) + (C.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
+ k(v.id), N.forEach((C) => u(C));
1903
+ }), J([]), E(null));
1904
+ }, [n, D, c, k, u, E, J]), Te = V(
1901
1905
  (o) => {
1902
- if (M.length < 2) return;
1903
- const y = M.map((B) => c.find((_) => _.id === B)).filter((B) => !!B && B.type !== "group");
1904
- if (y.length < 2) return;
1905
- let N = 1 / 0, E = -1 / 0, x = 1 / 0, P = -1 / 0;
1906
- y.forEach((B) => {
1907
- 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);
1906
+ if (D.length < 2) return;
1907
+ const v = D.map((B) => c.find((z) => z.id === B)).filter((B) => !!B && B.type !== "group");
1908
+ if (v.length < 2) return;
1909
+ let N = 1 / 0, C = -1 / 0, y = 1 / 0, M = -1 / 0;
1910
+ v.forEach((B) => {
1911
+ const z = B.normalStyle.x || 0, le = B.normalStyle.y || 0;
1912
+ N = Math.min(N, z), C = Math.max(C, z), y = Math.min(y, le), M = Math.max(M, 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 A = [...v].sort((B, z) => o === "horizontal" ? (B.normalStyle.x || 0) - (z.normalStyle.x || 0) : (B.normalStyle.y || 0) - (z.normalStyle.y || 0)), P = A.length;
1911
1915
  if (o === "horizontal") {
1912
- const _ = (E - N) / (U - 1);
1913
- F.forEach((le, de) => {
1914
- const ve = N + _ * de;
1915
- v(le.id, {
1916
+ const z = (C - N) / (P - 1);
1917
+ A.forEach((le, de) => {
1918
+ const ve = N + z * de;
1919
+ b(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;
1923
- v(le.id, {
1924
+ const z = (M - y) / (P - 1);
1925
+ A.forEach((le, de) => {
1926
+ const ve = y + z * de;
1927
+ b(le.id, {
1924
1928
  normalStyle: { ...le.normalStyle, y: ve }
1925
1929
  });
1926
1930
  });
1927
1931
  }
1928
1932
  },
1929
- [M, c, v]
1930
- ), ge = V(
1933
+ [D, c, b]
1934
+ ), ge = (o) => {
1935
+ const v = o.contentInfo.statusList.find(
1936
+ (N) => N.material.type === "LINE"
1937
+ );
1938
+ return v ? v.material.config : null;
1939
+ }, Re = V(
1931
1940
  (o) => {
1932
- 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");
1941
+ if (D.length < 2) return;
1942
+ const v = Oe.getState(), N = D.map((y) => c.find((M) => M.id === y)).filter((y) => !!y);
1934
1943
  if (N.length < 2) return;
1935
- let E = 0;
1944
+ let C = 0;
1936
1945
  switch (o) {
1937
1946
  case "left":
1938
- E = Math.min(...N.map((x) => x.normalStyle.x || 0));
1947
+ C = Math.min(...N.map((y) => {
1948
+ const M = ge(y);
1949
+ return M ? (y.normalStyle.x || 0) + (M.startX || 0) : y.normalStyle.x || 0;
1950
+ }));
1939
1951
  break;
1940
1952
  case "right":
1941
- E = Math.max(
1942
- ...N.map((x) => (x.normalStyle.x || 0) + (x.normalStyle.width || 0))
1943
- );
1953
+ C = Math.max(...N.map((y) => {
1954
+ const M = ge(y);
1955
+ return M ? (y.normalStyle.x || 0) + (M.endX || 0) : (y.normalStyle.x || 0) + (y.normalStyle.width || 0);
1956
+ }));
1944
1957
  break;
1945
1958
  case "top":
1946
- E = Math.min(...N.map((x) => x.normalStyle.y || 0));
1959
+ C = Math.min(...N.map((y) => {
1960
+ const M = ge(y);
1961
+ return M ? (y.normalStyle.y || 0) + (M.startY || 0) : y.normalStyle.y || 0;
1962
+ }));
1947
1963
  break;
1948
1964
  case "bottom":
1949
- E = Math.max(
1950
- ...N.map((x) => (x.normalStyle.y || 0) + (x.normalStyle.height || 0))
1951
- );
1965
+ C = Math.max(...N.map((y) => {
1966
+ const M = ge(y);
1967
+ return M ? (y.normalStyle.y || 0) + (M.endY || 0) : (y.normalStyle.y || 0) + (y.normalStyle.height || 0);
1968
+ }));
1952
1969
  break;
1953
1970
  }
1954
- N.forEach((x) => {
1955
- let P = x.normalStyle.x || 0, F = x.normalStyle.y || 0;
1971
+ N.forEach((y) => {
1972
+ let M = y.normalStyle.x || 0, A = y.normalStyle.y || 0;
1973
+ const P = ge(y);
1956
1974
  switch (o) {
1957
1975
  case "left":
1958
- P = E;
1976
+ P ? M = C - (P.startX || 0) : M = C;
1959
1977
  break;
1960
1978
  case "right":
1961
- P = E - (x.normalStyle.width || 0);
1979
+ P ? M = C - (P.endX || 0) : M = C - (y.normalStyle.width || 0);
1962
1980
  break;
1963
1981
  case "top":
1964
- F = E;
1982
+ P ? A = C - (P.startY || 0) : A = C;
1965
1983
  break;
1966
1984
  case "bottom":
1967
- F = E - (x.normalStyle.height || 0);
1985
+ P ? A = C - (P.endY || 0) : A = C - (y.normalStyle.height || 0);
1968
1986
  break;
1969
1987
  }
1970
- y.updateNode(x.id, {
1971
- normalStyle: { ...x.normalStyle, x: P, y: F }
1988
+ v.updateNode(y.id, {
1989
+ normalStyle: { ...y.normalStyle, x: M, y: A }
1972
1990
  });
1973
1991
  });
1974
1992
  },
1975
- [M, c]
1976
- ), pt = [
1993
+ [D, c]
1994
+ ), Ue = [
1977
1995
  {
1978
- icon: /* @__PURE__ */ e(dn, {}),
1996
+ icon: /* @__PURE__ */ e(un, {}),
1979
1997
  title: "选择模式",
1980
1998
  active: a === "select",
1981
1999
  onClick: () => {
1982
- O("select");
2000
+ j("select");
1983
2001
  }
1984
2002
  },
1985
2003
  {
1986
- icon: /* @__PURE__ */ e(vt, {}),
2004
+ icon: /* @__PURE__ */ e(bt, {}),
1987
2005
  title: "框选模式",
1988
2006
  active: a === "box-select",
1989
2007
  onClick: () => {
1990
- O("box-select"), ee([]);
2008
+ j("box-select"), J([]);
1991
2009
  }
1992
2010
  },
1993
2011
  {
1994
- icon: /* @__PURE__ */ e(un, {}),
2012
+ icon: /* @__PURE__ */ e(hn, {}),
1995
2013
  title: "拖拽模式",
1996
2014
  active: a === "drag",
1997
2015
  onClick: () => {
1998
- O("drag");
2016
+ j("drag");
1999
2017
  }
2000
2018
  },
2001
2019
  {
2002
- icon: /* @__PURE__ */ e(ft, {}),
2020
+ icon: /* @__PURE__ */ e(pt, {}),
2003
2021
  title: "线条绘制",
2004
2022
  active: a === "line-draw",
2005
2023
  onClick: () => {
2006
- O("line-draw");
2024
+ j("line-draw");
2007
2025
  }
2008
2026
  },
2009
2027
  {
2010
- icon: /* @__PURE__ */ e(hn, {}),
2028
+ icon: /* @__PURE__ */ e(mn, {}),
2011
2029
  title: "预览模式",
2012
2030
  active: a === "preview",
2013
2031
  onClick: () => {
2014
- O("preview");
2032
+ j("preview");
2015
2033
  }
2016
2034
  }
2017
- ], Fe = Xt(
2035
+ ], He = Pt(
2018
2036
  () => [
2019
- { icon: /* @__PURE__ */ e(Vt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2020
- { icon: /* @__PURE__ */ e(Zt, {}), title: "重做 (Ctrl+Y)", onClick: W },
2037
+ { icon: /* @__PURE__ */ e(Zt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2038
+ { icon: /* @__PURE__ */ e(Jt, {}), title: "重做 (Ctrl+Y)", onClick: U },
2021
2039
  {
2022
- icon: /* @__PURE__ */ e(_t, {}),
2040
+ icon: /* @__PURE__ */ e(zt, {}),
2023
2041
  title: "复制节点",
2024
- disabled: !n && M.length === 0,
2025
- onClick: tt
2042
+ disabled: !n && D.length === 0,
2043
+ onClick: lt
2026
2044
  },
2027
2045
  {
2028
- icon: /* @__PURE__ */ e(vt, {}),
2046
+ icon: /* @__PURE__ */ e(bt, {}),
2029
2047
  title: "组合选中节点",
2030
- disabled: M.length < 2,
2031
- onClick: nt
2048
+ disabled: D.length < 2,
2049
+ onClick: rt
2032
2050
  },
2033
2051
  {
2034
- icon: /* @__PURE__ */ e(Jt, {}),
2052
+ icon: /* @__PURE__ */ e(Kt, {}),
2035
2053
  title: "解除组合",
2036
- disabled: !n && M.length === 0,
2037
- onClick: We
2054
+ disabled: !n && D.length === 0,
2055
+ onClick: Fe
2038
2056
  },
2039
2057
  {
2040
- icon: /* @__PURE__ */ e(Kt, {}),
2058
+ icon: /* @__PURE__ */ e(Qt, {}),
2041
2059
  title: "左对齐",
2042
- disabled: M.length < 2,
2043
- onClick: () => ge("left")
2060
+ disabled: D.length < 2,
2061
+ onClick: () => Re("left")
2044
2062
  },
2045
2063
  {
2046
- icon: /* @__PURE__ */ e(Qt, {}),
2064
+ icon: /* @__PURE__ */ e(en, {}),
2047
2065
  title: "右对齐",
2048
- disabled: M.length < 2,
2049
- onClick: () => ge("right")
2066
+ disabled: D.length < 2,
2067
+ onClick: () => Re("right")
2050
2068
  },
2051
2069
  {
2052
- icon: /* @__PURE__ */ e(en, {}),
2070
+ icon: /* @__PURE__ */ e(tn, {}),
2053
2071
  title: "上对齐",
2054
- disabled: M.length < 2,
2055
- onClick: () => ge("top")
2072
+ disabled: D.length < 2,
2073
+ onClick: () => Re("top")
2056
2074
  },
2057
2075
  {
2058
- icon: /* @__PURE__ */ e(tn, {}),
2076
+ icon: /* @__PURE__ */ e(nn, {}),
2059
2077
  title: "下对齐",
2060
- disabled: M.length < 2,
2061
- onClick: () => ge("bottom")
2078
+ disabled: D.length < 2,
2079
+ onClick: () => Re("bottom")
2062
2080
  },
2063
2081
  {
2064
- icon: /* @__PURE__ */ e(nn, {}),
2082
+ icon: /* @__PURE__ */ e(ln, {}),
2065
2083
  title: "水平分布",
2066
- disabled: M.length < 2,
2084
+ disabled: D.length < 2,
2067
2085
  onClick: () => Te("horizontal")
2068
2086
  },
2069
2087
  {
2070
- icon: /* @__PURE__ */ e(ln, {}),
2088
+ icon: /* @__PURE__ */ e(rn, {}),
2071
2089
  title: "垂直分布",
2072
- disabled: M.length < 2,
2090
+ disabled: D.length < 2,
2073
2091
  onClick: () => Te("vertical")
2074
2092
  },
2075
2093
  {
2076
- icon: /* @__PURE__ */ e(rn, {}),
2094
+ icon: /* @__PURE__ */ e(an, {}),
2077
2095
  title: "画布配置",
2078
- onClick: () => C(!0)
2096
+ onClick: () => I(!0)
2079
2097
  },
2080
2098
  {
2081
- icon: /* @__PURE__ */ e(an, {}),
2099
+ icon: /* @__PURE__ */ e(on, {}),
2082
2100
  title: "数据模拟",
2083
2101
  type: "primary",
2084
- onClick: () => j(!0)
2102
+ onClick: () => F(!0)
2085
2103
  },
2086
2104
  {
2087
- icon: /* @__PURE__ */ e(ot, {}),
2105
+ icon: /* @__PURE__ */ e(ct, {}),
2088
2106
  title: "删除选中 (Delete)",
2089
- disabled: !n && M.length === 0,
2107
+ disabled: !n && D.length === 0,
2090
2108
  onClick: () => {
2091
- n ? I(n) : M.length > 0 && (M.forEach((o) => I(o)), ee([]));
2109
+ n ? k(n) : D.length > 0 && (D.forEach((o) => k(o)), J([]));
2092
2110
  }
2093
2111
  }
2094
2112
  ],
2095
2113
  [
2096
2114
  g,
2097
- W,
2115
+ U,
2098
2116
  a,
2099
- O,
2100
- ee,
2101
- M,
2102
- nt,
2103
- We,
2104
- tt,
2105
- ge,
2106
- Te,
2107
- C,
2108
2117
  j,
2118
+ J,
2119
+ D,
2120
+ rt,
2121
+ Fe,
2122
+ lt,
2123
+ Re,
2124
+ Te,
2125
+ I,
2126
+ F,
2109
2127
  n,
2110
- I
2128
+ k
2111
2129
  ]
2112
- ), De = V(
2130
+ ), ke = V(
2113
2131
  (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) => {
2115
- N && v(N.id, {
2132
+ o.preventDefault(), (o.key === "ArrowLeft" || o.key === "ArrowRight" || o.key === "ArrowUp" || o.key === "ArrowDown") && D.map((N) => c.find((C) => C.id === N)).forEach((N) => {
2133
+ N && b(N.id, {
2116
2134
  normalStyle: {
2117
2135
  ...N.normalStyle,
2118
2136
  x: (N.normalStyle.x || 0) - 2 * (o.key === "ArrowLeft" ? 1 : o.key === "ArrowRight" ? -1 : 0),
@@ -2121,13 +2139,13 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2121
2139
  });
2122
2140
  });
2123
2141
  },
2124
- [M, c, v]
2142
+ [D, c, b]
2125
2143
  );
2126
- return me(() => (a === "box-select" && document.addEventListener("keydown", De), () => {
2127
- document.removeEventListener("keydown", De);
2128
- }), [a, De]), /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
2144
+ return he(() => (document.addEventListener("keydown", ke), () => {
2145
+ document.removeEventListener("keydown", ke);
2146
+ }), [ke]), /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
2129
2147
  /* @__PURE__ */ h("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
2130
- /* @__PURE__ */ e(be, { children: pt.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2148
+ /* @__PURE__ */ e(be, { children: Ue.map((o) => /* @__PURE__ */ e(Ye, { title: o.title, children: /* @__PURE__ */ e(
2131
2149
  Z,
2132
2150
  {
2133
2151
  type: o.active ? "primary" : "default",
@@ -2135,7 +2153,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2135
2153
  onClick: o.onClick
2136
2154
  }
2137
2155
  ) }, o.title)) }),
2138
- /* @__PURE__ */ e(be, { children: Fe.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2156
+ /* @__PURE__ */ e(be, { children: He.map((o) => /* @__PURE__ */ e(Ye, { title: o.title, children: /* @__PURE__ */ e(
2139
2157
  Z,
2140
2158
  {
2141
2159
  type: o.active ? "primary" : o.type || "default",
@@ -2146,7 +2164,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2146
2164
  ) }, o.title)) })
2147
2165
  ] }),
2148
2166
  /* @__PURE__ */ e("div", { ref: r, className: "flex-1 relative", children: /* @__PURE__ */ e(
2149
- pn,
2167
+ yn,
2150
2168
  {
2151
2169
  ref: f,
2152
2170
  initialScale: 1,
@@ -2157,22 +2175,22 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2157
2175
  onTransformed: ae,
2158
2176
  limitToBounds: !1,
2159
2177
  centerZoomedOut: !1,
2160
- panning: { disabled: !z && (a === "select" || a === "line-draw" || a === "box-select"), velocityDisabled: !0 },
2178
+ panning: { disabled: !O && (a === "select" || a === "line-draw" || a === "box-select"), velocityDisabled: !0 },
2161
2179
  wheel: { disabled: !1, step: 0.1 },
2162
2180
  pinch: { disabled: !1 },
2163
2181
  doubleClick: { disabled: !0 },
2164
- children: ({ zoomIn: o, zoomOut: y, resetTransform: N }) => /* @__PURE__ */ h(Oe, { children: [
2182
+ children: ({ zoomIn: o, zoomOut: v, resetTransform: N }) => /* @__PURE__ */ h(Ae, { children: [
2165
2183
  /* @__PURE__ */ e("div", { className: "absolute bottom-4 right-4 z-10 bg-white rounded-lg shadow-lg p-2", children: /* @__PURE__ */ h(be, { direction: "vertical", children: [
2166
- /* @__PURE__ */ e(Le, { title: "放大", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(on, {}), onClick: () => o() }) }),
2167
- /* @__PURE__ */ e(Le, { title: "缩小", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(sn, {}), onClick: () => y() }) }),
2168
- /* @__PURE__ */ e(Le, { title: "重置视图", children: /* @__PURE__ */ e(Z, { onClick: () => N(), children: "100%" }) }),
2184
+ /* @__PURE__ */ e(Ye, { title: "放大", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(sn, {}), onClick: () => o() }) }),
2185
+ /* @__PURE__ */ e(Ye, { title: "缩小", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(cn, {}), onClick: () => v() }) }),
2186
+ /* @__PURE__ */ e(Ye, { title: "重置视图", children: /* @__PURE__ */ e(Z, { onClick: () => N(), children: "100%" }) }),
2169
2187
  /* @__PURE__ */ h("div", { className: "text-center text-xs text-gray-500", children: [
2170
2188
  Math.round(p.scale * 100),
2171
2189
  "%"
2172
2190
  ] })
2173
2191
  ] }) }),
2174
2192
  /* @__PURE__ */ e(
2175
- yn,
2193
+ vn,
2176
2194
  {
2177
2195
  wrapperStyle: { width: "100%", height: "100%", position: "relative" },
2178
2196
  contentStyle: {
@@ -2187,7 +2205,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2187
2205
  {
2188
2206
  ref: t,
2189
2207
  "data-canvas": "true",
2190
- className: `relative ${xe ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""} ${z ? "cursor-grab" : ""}`,
2208
+ className: `relative ${xe ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""} ${O ? "cursor-grab" : ""}`,
2191
2209
  style: {
2192
2210
  width: d.width,
2193
2211
  height: d.height,
@@ -2197,7 +2215,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2197
2215
  backgroundSize: "cover",
2198
2216
  backgroundPosition: "center"
2199
2217
  },
2200
- onClick: K,
2218
+ onClick: Q,
2201
2219
  onMouseDown: oe,
2202
2220
  onDoubleClick: se,
2203
2221
  onDragOver: ce,
@@ -2208,20 +2226,20 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2208
2226
  /* @__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
2227
  /* @__PURE__ */ e("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
2210
2228
  ] }),
2211
- c.map((E) => /* @__PURE__ */ e(
2212
- Ut,
2229
+ c.map((C) => /* @__PURE__ */ e(
2230
+ Ht,
2213
2231
  {
2214
- node: E,
2215
- isSelected: n === E.id || M.includes(E.id),
2232
+ node: C,
2233
+ isSelected: n === C.id || D.includes(C.id),
2216
2234
  data: l,
2217
- onClick: () => {
2218
- console.log("Node onClick:", E.id, "mode:", ie.current), ie.current !== "line-draw" && k(E.id);
2235
+ onClick: (y) => {
2236
+ console.log("Node onClick:", C.id, "mode:", ie.current), ie.current !== "line-draw" && (y.shiftKey ? (E(C.id), J([...D, C.id])) : (E(C.id), J([C.id])));
2219
2237
  },
2220
- onMouseDown: (x) => et(x, E),
2221
- onUpdateNode: (x, P) => v(x, P),
2238
+ onMouseDown: (y) => nt(y, C),
2239
+ onUpdateNode: (y, M) => b(y, M),
2222
2240
  scale: p.scale
2223
2241
  },
2224
- `${E.id}`
2242
+ `${C.id}`
2225
2243
  )),
2226
2244
  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
2245
  "line",
@@ -2237,15 +2255,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2237
2255
  strokeLinejoin: "round"
2238
2256
  }
2239
2257
  ) }),
2240
- a === "box-select" && b.start && b.end && /* @__PURE__ */ e(
2258
+ a === "box-select" && x.start && x.end && /* @__PURE__ */ e(
2241
2259
  "div",
2242
2260
  {
2243
2261
  className: "absolute border-2 border-blue-500 bg-blue-500/10 pointer-events-none",
2244
2262
  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),
2263
+ left: Math.min(x.start.x, x.end.x),
2264
+ top: Math.min(x.start.y, x.end.y),
2265
+ width: Math.abs(x.end.x - x.start.x),
2266
+ height: Math.abs(x.end.y - x.start.y),
2249
2267
  zIndex: 9999
2250
2268
  }
2251
2269
  }
@@ -2259,17 +2277,17 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2259
2277
  }
2260
2278
  ) }),
2261
2279
  /* @__PURE__ */ e(
2262
- it,
2280
+ st,
2263
2281
  {
2264
2282
  title: "数据模拟",
2265
- open: je,
2266
- onCancel: () => j(!1),
2283
+ open: We,
2284
+ onCancel: () => F(!1),
2267
2285
  footer: null,
2268
2286
  children: /* @__PURE__ */ e(w, { layout: "vertical", children: /* @__PURE__ */ e(w.Item, { label: "测试数据 (JSON)", children: /* @__PURE__ */ e(
2269
- On,
2287
+ An,
2270
2288
  {
2271
- value: st,
2272
- onChange: (o) => Ke(o.target.value),
2289
+ value: dt,
2290
+ onChange: (o) => et(o.target.value),
2273
2291
  rows: 10,
2274
2292
  placeholder: "输入 JSON 格式的测试数据"
2275
2293
  }
@@ -2277,11 +2295,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2277
2295
  }
2278
2296
  ),
2279
2297
  /* @__PURE__ */ e(
2280
- it,
2298
+ st,
2281
2299
  {
2282
2300
  title: "画布配置",
2283
- open: Qe,
2284
- onCancel: () => C(!1),
2301
+ open: tt,
2302
+ onCancel: () => I(!1),
2285
2303
  footer: null,
2286
2304
  children: /* @__PURE__ */ h(w, { layout: "vertical", children: [
2287
2305
  /* @__PURE__ */ e(w.Item, { label: "宽度", children: /* @__PURE__ */ e(
@@ -2305,7 +2323,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2305
2323
  }
2306
2324
  ) }),
2307
2325
  /* @__PURE__ */ e(w.Item, { label: "显示网格", children: /* @__PURE__ */ e(
2308
- Je,
2326
+ Qe,
2309
2327
  {
2310
2328
  checked: d.showGrid !== !1,
2311
2329
  onChange: (o) => S({ showGrid: o })
@@ -2313,7 +2331,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2313
2331
  ) }),
2314
2332
  /* @__PURE__ */ e(w.Item, { label: "背景色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2315
2333
  /* @__PURE__ */ e(
2316
- Ae,
2334
+ je,
2317
2335
  {
2318
2336
  value: d.background || "#ffffff",
2319
2337
  onChange: (o) => S({ background: o.toHexString() })
@@ -2331,20 +2349,20 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2331
2349
  /* @__PURE__ */ h(w.Item, { label: "背景图片", children: [
2332
2350
  /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2333
2351
  /* @__PURE__ */ e(
2334
- Tt,
2352
+ Rt,
2335
2353
  {
2336
2354
  accept: "image/*",
2337
2355
  showUploadList: !1,
2338
2356
  beforeUpload: (o) => {
2339
2357
  if (!o.type.startsWith("image/"))
2340
- return Ye.error("只能上传图片文件!"), !1;
2358
+ return $e.error("只能上传图片文件!"), !1;
2341
2359
  const N = new FileReader();
2342
- return N.onload = (E) => {
2343
- const x = E.target?.result;
2344
- S({ backgroundImage: x }), Ye.success("背景图片上传成功");
2360
+ return N.onload = (C) => {
2361
+ const y = C.target?.result;
2362
+ S({ backgroundImage: y }), $e.success("背景图片上传成功");
2345
2363
  }, N.readAsDataURL(o), !1;
2346
2364
  },
2347
- children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mt, {}), children: "上传图片" })
2365
+ children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(gt, {}), children: "上传图片" })
2348
2366
  }
2349
2367
  ),
2350
2368
  /* @__PURE__ */ e(
@@ -2359,7 +2377,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2359
2377
  d.backgroundImage && /* @__PURE__ */ e(
2360
2378
  Z,
2361
2379
  {
2362
- icon: /* @__PURE__ */ e(cn, {}),
2380
+ icon: /* @__PURE__ */ e(dn, {}),
2363
2381
  onClick: () => S({ backgroundImage: void 0 }),
2364
2382
  danger: !0,
2365
2383
  size: "small"
@@ -2379,13 +2397,13 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2379
2397
  }
2380
2398
  )
2381
2399
  ] });
2382
- }, { Option: at } = Ie, jn = ({
2400
+ }, { Option: ot } = Ie, Wn = ({
2383
2401
  material: l,
2384
2402
  onSave: f,
2385
2403
  bindCodes: t = [],
2386
2404
  dataOptions: r = []
2387
2405
  }) => {
2388
- const n = l.content || {}, [a, i] = Q({
2406
+ const n = l.content || {}, [a, i] = ee({
2389
2407
  label: n.label || "",
2390
2408
  value: n.value || "",
2391
2409
  valueSourceCode: n.valueSourceCode || "",
@@ -2398,7 +2416,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2398
2416
  valueFontWeight: n.valueStyle?.fontWeight || "normal",
2399
2417
  valueColor: n.valueStyle?.color || "#1890ff"
2400
2418
  });
2401
- me(() => {
2419
+ he(() => {
2402
2420
  i({
2403
2421
  label: n.label || "",
2404
2422
  value: n.value || "",
@@ -2413,22 +2431,22 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2413
2431
  valueColor: n.valueStyle?.color || "#1890ff"
2414
2432
  });
2415
2433
  }, [l.id]);
2416
- const p = (u, k) => {
2417
- i((v) => ({ ...v, [u]: k }));
2434
+ const p = (u, E) => {
2435
+ i((b) => ({ ...b, [u]: E }));
2418
2436
  }, d = (u) => {
2419
- const k = r.find((I) => I.paramsCode === u), v = k?.unit || "";
2420
- i((I) => ({
2421
- ...I,
2437
+ const E = r.find((k) => k.paramsCode === u), b = E?.unit || "";
2438
+ i((k) => ({
2439
+ ...k,
2422
2440
  valueSourceCode: u,
2423
- unit: v,
2424
- value: String(k?.value || "")
2441
+ unit: b,
2442
+ value: String(E?.value || "")
2425
2443
  })), setTimeout(() => {
2426
2444
  f({
2427
2445
  content: {
2428
2446
  ...n,
2429
2447
  valueSourceCode: u,
2430
- value: String(k?.value || ""),
2431
- unit: v
2448
+ value: String(E?.value || ""),
2449
+ unit: b
2432
2450
  }
2433
2451
  });
2434
2452
  }, 0);
@@ -2457,7 +2475,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2457
2475
  (u) => t.includes(u.paramsCode)
2458
2476
  );
2459
2477
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2460
- /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "文本内容" }),
2478
+ /* @__PURE__ */ e(De, { style: { marginTop: 0 }, children: "文本内容" }),
2461
2479
  /* @__PURE__ */ h(w, { layout: "vertical", children: [
2462
2480
  /* @__PURE__ */ e(w.Item, { label: "标签文本 (label)", children: /* @__PURE__ */ e(
2463
2481
  re,
@@ -2537,7 +2555,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2537
2555
  }
2538
2556
  )
2539
2557
  ] }),
2540
- /* @__PURE__ */ e(Me, { children: "标签样式" }),
2558
+ /* @__PURE__ */ e(De, { children: "标签样式" }),
2541
2559
  /* @__PURE__ */ h(w, { layout: "vertical", children: [
2542
2560
  /* @__PURE__ */ h(be, { children: [
2543
2561
  /* @__PURE__ */ e(w.Item, { label: "字体大小", children: /* @__PURE__ */ e(
@@ -2559,15 +2577,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2559
2577
  },
2560
2578
  style: { width: 100 },
2561
2579
  children: [
2562
- /* @__PURE__ */ e(at, { value: "normal", children: "正常" }),
2563
- /* @__PURE__ */ e(at, { value: "bold", children: "粗体" })
2580
+ /* @__PURE__ */ e(ot, { value: "normal", children: "正常" }),
2581
+ /* @__PURE__ */ e(ot, { value: "bold", children: "粗体" })
2564
2582
  ]
2565
2583
  }
2566
2584
  ) })
2567
2585
  ] }),
2568
2586
  /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2569
2587
  /* @__PURE__ */ e(
2570
- Ae,
2588
+ je,
2571
2589
  {
2572
2590
  value: a.labelColor || "#262626",
2573
2591
  onChange: (u) => {
@@ -2609,7 +2627,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2609
2627
  )
2610
2628
  ] }) })
2611
2629
  ] }),
2612
- /* @__PURE__ */ e(Me, { children: "值样式" }),
2630
+ /* @__PURE__ */ e(De, { children: "值样式" }),
2613
2631
  /* @__PURE__ */ h(w, { layout: "vertical", children: [
2614
2632
  /* @__PURE__ */ h(be, { children: [
2615
2633
  /* @__PURE__ */ e(w.Item, { label: "字体大小", children: /* @__PURE__ */ e(
@@ -2631,15 +2649,15 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2631
2649
  },
2632
2650
  style: { width: 100 },
2633
2651
  children: [
2634
- /* @__PURE__ */ e(at, { value: "normal", children: "正常" }),
2635
- /* @__PURE__ */ e(at, { value: "bold", children: "粗体" })
2652
+ /* @__PURE__ */ e(ot, { value: "normal", children: "正常" }),
2653
+ /* @__PURE__ */ e(ot, { value: "bold", children: "粗体" })
2636
2654
  ]
2637
2655
  }
2638
2656
  ) })
2639
2657
  ] }),
2640
2658
  /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2641
2659
  /* @__PURE__ */ e(
2642
- Ae,
2660
+ je,
2643
2661
  {
2644
2662
  value: a.valueColor || "#1890ff",
2645
2663
  onChange: (u) => {
@@ -2682,17 +2700,17 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2682
2700
  ] }) })
2683
2701
  ] })
2684
2702
  ] });
2685
- }, Wn = ({
2703
+ }, Fn = ({
2686
2704
  material: l,
2687
2705
  onSave: f
2688
2706
  }) => {
2689
- const t = l, [r, c] = Q({
2707
+ const t = l, [r, c] = ee({
2690
2708
  name: l.name,
2691
2709
  src: t.src || "",
2692
2710
  backgroundColor: t.backgroundColor || "",
2693
2711
  fillColor: t.fillColor || ""
2694
2712
  });
2695
- me(() => {
2713
+ he(() => {
2696
2714
  c({
2697
2715
  name: l.name,
2698
2716
  src: t.src || "",
@@ -2710,7 +2728,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2710
2728
  });
2711
2729
  };
2712
2730
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2713
- /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "图片属性" }),
2731
+ /* @__PURE__ */ e(De, { style: { marginTop: 0 }, children: "图片属性" }),
2714
2732
  /* @__PURE__ */ h(w, { layout: "vertical", children: [
2715
2733
  /* @__PURE__ */ e(w.Item, { label: "图片名称", children: /* @__PURE__ */ e(
2716
2734
  re,
@@ -2732,7 +2750,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2732
2750
  ) }),
2733
2751
  /* @__PURE__ */ e(w.Item, { label: "填充颜色(基本形状)", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2734
2752
  /* @__PURE__ */ e(
2735
- Ae,
2753
+ je,
2736
2754
  {
2737
2755
  value: r.fillColor || "#1890ff",
2738
2756
  onChange: (i) => {
@@ -2758,7 +2776,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2758
2776
  ] }) }),
2759
2777
  /* @__PURE__ */ e(w.Item, { label: "背景颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2760
2778
  /* @__PURE__ */ e(
2761
- Ae,
2779
+ je,
2762
2780
  {
2763
2781
  value: r.backgroundColor || "#1890ff",
2764
2782
  onChange: (i) => {
@@ -2784,11 +2802,11 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2784
2802
  ] }) })
2785
2803
  ] })
2786
2804
  ] });
2787
- }, { Option: Fn } = Ie, Un = ({
2805
+ }, { Option: Un } = Ie, Hn = ({
2788
2806
  material: l,
2789
2807
  onSave: f
2790
2808
  }) => {
2791
- const t = l.config || {}, [r, c] = Q({
2809
+ const t = l.config || {}, [r, c] = ee({
2792
2810
  lineWeight: t.lineWeight || t.thickness || 2,
2793
2811
  color: t.color || "#262626",
2794
2812
  lineType: t.lineType || "solid",
@@ -2797,7 +2815,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2797
2815
  endX: t.endX ?? 100,
2798
2816
  endY: t.endY ?? 0
2799
2817
  });
2800
- me(() => {
2818
+ he(() => {
2801
2819
  c({
2802
2820
  lineWeight: t.lineWeight || t.thickness || 2,
2803
2821
  color: t.color || "#262626",
@@ -2832,7 +2850,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2832
2850
  { value: "dash-dot", label: "画点线", desc: "长划-点交替" }
2833
2851
  ];
2834
2852
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2835
- /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "起止位置(相对节点)" }),
2853
+ /* @__PURE__ */ e(De, { style: { marginTop: 0 }, children: "起止位置(相对节点)" }),
2836
2854
  /* @__PURE__ */ h(w, { layout: "vertical", children: [
2837
2855
  /* @__PURE__ */ h("div", { className: "grid grid-cols-2 gap-2", children: [
2838
2856
  /* @__PURE__ */ e(w.Item, { label: "起点 X", className: "mb-2", children: /* @__PURE__ */ e(
@@ -2912,14 +2930,14 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2912
2930
  )
2913
2931
  ] }) })
2914
2932
  ] }),
2915
- /* @__PURE__ */ e(Me, { children: "线条属性" }),
2933
+ /* @__PURE__ */ e(De, { children: "线条属性" }),
2916
2934
  /* @__PURE__ */ h(w, { layout: "vertical", children: [
2917
2935
  /* @__PURE__ */ e(w.Item, { label: "线型", help: "选择线条样式", children: /* @__PURE__ */ e(
2918
2936
  Ie,
2919
2937
  {
2920
2938
  value: r.lineType,
2921
2939
  onChange: (i) => n({ lineType: i }),
2922
- children: a.map((i) => /* @__PURE__ */ e(Fn, { value: i.value, children: /* @__PURE__ */ h("div", { className: "flex flex-col", children: [
2940
+ children: a.map((i) => /* @__PURE__ */ e(Un, { value: i.value, children: /* @__PURE__ */ h("div", { className: "flex flex-col", children: [
2923
2941
  /* @__PURE__ */ e("span", { children: i.label }),
2924
2942
  /* @__PURE__ */ e("span", { className: "text-xs text-gray-400", children: i.desc })
2925
2943
  ] }) }, i.value))
@@ -2937,7 +2955,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2937
2955
  ) }),
2938
2956
  /* @__PURE__ */ e(w.Item, { label: "颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2939
2957
  /* @__PURE__ */ e(
2940
- Ae,
2958
+ je,
2941
2959
  {
2942
2960
  value: r.color || "#d9d9d9",
2943
2961
  onChange: (i) => n({ color: i.toHexString() })
@@ -2955,7 +2973,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2955
2973
  ] }) })
2956
2974
  ] })
2957
2975
  ] });
2958
- }, Ht = ({
2976
+ }, Gt = ({
2959
2977
  material: l,
2960
2978
  onSave: f,
2961
2979
  bindCodes: t,
@@ -2964,7 +2982,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2964
2982
  switch (l.type) {
2965
2983
  case "TEXT":
2966
2984
  return /* @__PURE__ */ e(
2967
- jn,
2985
+ Wn,
2968
2986
  {
2969
2987
  material: l,
2970
2988
  onSave: f,
@@ -2973,30 +2991,30 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
2973
2991
  }
2974
2992
  );
2975
2993
  case "IMAGE":
2976
- return /* @__PURE__ */ e(Wn, { material: l, onSave: f });
2994
+ return /* @__PURE__ */ e(Fn, { material: l, onSave: f });
2977
2995
  case "LINE":
2978
- return /* @__PURE__ */ e(Un, { material: l, onSave: f });
2996
+ return /* @__PURE__ */ e(Hn, { material: l, onSave: f });
2979
2997
  default:
2980
2998
  return /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-8", children: "暂不支持编辑此类型的物料" });
2981
2999
  }
2982
- }, { Panel: $t } = Ne, { TextArea: Hn } = re, Gn = ({
3000
+ }, { Panel: Yt } = Ne, { TextArea: Gn } = re, qn = ({
2983
3001
  node: l,
2984
3002
  updateNode: f,
2985
3003
  materials: t
2986
3004
  }) => {
2987
3005
  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,
3006
+ const u = l.children?.map((E) => E.id === m ? {
3007
+ ...E,
2990
3008
  contentInfo: {
2991
- ...k.contentInfo,
3009
+ ...E.contentInfo,
2992
3010
  statusList: S
2993
3011
  }
2994
- } : k);
3012
+ } : E);
2995
3013
  f(l.id, {
2996
3014
  children: u
2997
3015
  });
2998
3016
  }, n = (m) => {
2999
- const S = l.children?.find((k) => k.id === m);
3017
+ const S = l.children?.find((E) => E.id === m);
3000
3018
  if (!S) return;
3001
3019
  const u = {
3002
3020
  id: H(),
@@ -3007,26 +3025,26 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3007
3025
  };
3008
3026
  c(m, [...S.contentInfo.statusList, u]);
3009
3027
  }, a = (m, S) => {
3010
- const u = l.children?.find((v) => v.id === m);
3028
+ const u = l.children?.find((b) => b.id === m);
3011
3029
  if (!u) return;
3012
- const k = u.contentInfo.statusList.filter((v) => v.id !== S);
3013
- c(m, k);
3030
+ const E = u.contentInfo.statusList.filter((b) => b.id !== S);
3031
+ c(m, E);
3014
3032
  }, 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);
3018
- c(m, v);
3033
+ const E = l.children?.find((k) => k.id === m);
3034
+ if (!E) return;
3035
+ const b = E.contentInfo.statusList.map((k) => k.id === S ? { ...k, ...u } : k);
3036
+ c(m, b);
3019
3037
  }, 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);
3023
- if (v === -1) return;
3024
- const I = [...k.contentInfo.statusList];
3025
- 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);
3038
+ const E = l.children?.find((g) => g.id === m);
3039
+ if (!E) return;
3040
+ const b = E.contentInfo.statusList.findIndex((g) => g.id === S);
3041
+ if (b === -1) return;
3042
+ const k = [...E.contentInfo.statusList];
3043
+ u === "up" && b > 0 ? [k[b], k[b - 1]] = [k[b - 1], k[b]] : u === "down" && b < k.length - 1 && ([k[b], k[b + 1]] = [k[b + 1], k[b]]), c(m, k);
3026
3044
  }, d = (m, S, u) => {
3027
- const k = t.find((v) => v.id === u);
3028
- k && i(m, S, {
3029
- material: { ...k, id: H() }
3045
+ const E = t.find((b) => b.id === u);
3046
+ E && i(m, S, {
3047
+ material: { ...E, id: H() }
3030
3048
  });
3031
3049
  };
3032
3050
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
@@ -3035,7 +3053,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3035
3053
  ":为每个子节点配置多个状态和绑定"
3036
3054
  ] }) }),
3037
3055
  /* @__PURE__ */ e(Ne, { ghost: !0, children: l.children?.map((m, S) => /* @__PURE__ */ e(
3038
- $t,
3056
+ Yt,
3039
3057
  {
3040
3058
  header: /* @__PURE__ */ h("div", { className: "flex items-center justify-between w-full pr-4", children: [
3041
3059
  /* @__PURE__ */ h("span", { className: "font-medium text-sm", children: [
@@ -3055,30 +3073,30 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3055
3073
  {
3056
3074
  type: "primary",
3057
3075
  size: "small",
3058
- icon: /* @__PURE__ */ e(zt, {}),
3076
+ icon: /* @__PURE__ */ e(Ot, {}),
3059
3077
  onClick: () => n(m.id),
3060
3078
  children: "添加状态"
3061
3079
  }
3062
3080
  )
3063
3081
  ] }),
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(
3065
- $t,
3082
+ 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(
3083
+ Yt,
3066
3084
  {
3067
3085
  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 }),
3086
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: E + 1 }),
3069
3087
  /* @__PURE__ */ e("span", { className: "font-medium", children: u.name }),
3070
3088
  /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: u.material.type })
3071
3089
  ] }),
3072
- extra: /* @__PURE__ */ h(be, { size: "small", onClick: (v) => v.stopPropagation(), children: [
3090
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (b) => b.stopPropagation(), children: [
3073
3091
  /* @__PURE__ */ e(
3074
3092
  Z,
3075
3093
  {
3076
3094
  type: "text",
3077
3095
  size: "small",
3078
- icon: /* @__PURE__ */ e(Ot, {}),
3079
- disabled: k === 0,
3080
- onClick: (v) => {
3081
- v.stopPropagation(), p(m.id, u.id, "up");
3096
+ icon: /* @__PURE__ */ e(At, {}),
3097
+ disabled: E === 0,
3098
+ onClick: (b) => {
3099
+ b.stopPropagation(), p(m.id, u.id, "up");
3082
3100
  }
3083
3101
  }
3084
3102
  ),
@@ -3087,10 +3105,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3087
3105
  {
3088
3106
  type: "text",
3089
3107
  size: "small",
3090
- icon: /* @__PURE__ */ e(At, {}),
3091
- disabled: k === m.contentInfo.statusList.length - 1,
3092
- onClick: (v) => {
3093
- v.stopPropagation(), p(m.id, u.id, "down");
3108
+ icon: /* @__PURE__ */ e(jt, {}),
3109
+ disabled: E === m.contentInfo.statusList.length - 1,
3110
+ onClick: (b) => {
3111
+ b.stopPropagation(), p(m.id, u.id, "down");
3094
3112
  }
3095
3113
  }
3096
3114
  ),
@@ -3100,9 +3118,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3100
3118
  type: "text",
3101
3119
  size: "small",
3102
3120
  danger: !0,
3103
- icon: /* @__PURE__ */ e(ot, {}),
3104
- onClick: (v) => {
3105
- v.stopPropagation(), a(m.id, u.id);
3121
+ icon: /* @__PURE__ */ e(ct, {}),
3122
+ onClick: (b) => {
3123
+ b.stopPropagation(), a(m.id, u.id);
3106
3124
  }
3107
3125
  }
3108
3126
  )
@@ -3112,7 +3130,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3112
3130
  re,
3113
3131
  {
3114
3132
  value: u.name,
3115
- onChange: (v) => i(m.id, u.id, { name: v.target.value }),
3133
+ onChange: (b) => i(m.id, u.id, { name: b.target.value }),
3116
3134
  placeholder: "输入状态名称"
3117
3135
  }
3118
3136
  ) }),
@@ -3122,10 +3140,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3122
3140
  label: "执行表达式",
3123
3141
  help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
3124
3142
  children: /* @__PURE__ */ e(
3125
- Hn,
3143
+ Gn,
3126
3144
  {
3127
3145
  value: u.expression,
3128
- onChange: (v) => i(m.id, u.id, { expression: v.target.value }),
3146
+ onChange: (b) => i(m.id, u.id, { expression: b.target.value }),
3129
3147
  rows: 3,
3130
3148
  placeholder: "return true;"
3131
3149
  }
@@ -3137,7 +3155,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3137
3155
  {
3138
3156
  mode: "tags",
3139
3157
  value: u.bindCodes || [],
3140
- onChange: (v) => i(m.id, u.id, { bindCodes: v }),
3158
+ onChange: (b) => i(m.id, u.id, { bindCodes: b }),
3141
3159
  placeholder: "输入数据源 code",
3142
3160
  tokenSeparators: [",", " "]
3143
3161
  }
@@ -3151,27 +3169,27 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3151
3169
  placeholder: "选择新物料",
3152
3170
  style: { width: 150 },
3153
3171
  value: void 0,
3154
- onChange: (v) => v && d(m.id, u.id, v),
3155
- options: r.map((v) => ({
3156
- value: v.id,
3157
- label: `${v.name} (${v.type})`
3172
+ onChange: (b) => b && d(m.id, u.id, b),
3173
+ options: r.map((b) => ({
3174
+ value: b.id,
3175
+ label: `${b.name} (${b.type})`
3158
3176
  }))
3159
3177
  }
3160
3178
  )
3161
3179
  ] }) }),
3162
- /* @__PURE__ */ e(Me, { style: { margin: "12px 0" } }),
3180
+ /* @__PURE__ */ e(De, { style: { margin: "12px 0" } }),
3163
3181
  /* @__PURE__ */ h("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3164
3182
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3165
3183
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
3166
3184
  /* @__PURE__ */ e(ye, { children: u.material.name })
3167
3185
  ] }),
3168
3186
  /* @__PURE__ */ e(
3169
- Ht,
3187
+ Gt,
3170
3188
  {
3171
3189
  material: u.material,
3172
- onSave: (v) => {
3173
- const I = { ...u.material, ...v };
3174
- i(m.id, u.id, { material: I });
3190
+ onSave: (b) => {
3191
+ const k = { ...u.material, ...b };
3192
+ i(m.id, u.id, { material: k });
3175
3193
  }
3176
3194
  }
3177
3195
  )
@@ -3185,7 +3203,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3185
3203
  m.id
3186
3204
  )) })
3187
3205
  ] });
3188
- }, { Panel: Ee } = Ne, { TabPane: ut } = Rt, { TextArea: qn } = re, Bn = ({
3206
+ }, { Panel: Me } = Ne, { TabPane: mt } = _t, { TextArea: Bn } = re, Vn = ({
3189
3207
  defaultTestData: l
3190
3208
  }) => {
3191
3209
  const {
@@ -3198,12 +3216,12 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3198
3216
  materials: i,
3199
3217
  selectedStatusId: p,
3200
3218
  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) => {
3219
+ } = Oe(), [m] = w.useForm(), [S, u] = ee("basic"), [E, b] = ee(!1), [k, g] = ee(null), [U, j] = ee({}), T = Ce.useMemo(() => f.find((s) => s.id === t), [f, t]), Y = T?.contentInfo.statusList || [], $ = (s) => {
3202
3220
  t && (s.normalStyle && c(t, s.normalStyle), s.name !== void 0 && r(t, { name: s.name }), s.controlInfo && n(t, s.controlInfo));
3203
3221
  };
3204
- console.log(t, "selectedNodeId", X), me(() => {
3205
- X && X && (m.setFieldsValue({
3206
- name: X.name,
3222
+ console.log(t, "selectedNodeId", T), he(() => {
3223
+ T && T && (m.setFieldsValue({
3224
+ name: T.name,
3207
3225
  normalStyle: {
3208
3226
  width: 100,
3209
3227
  height: 100,
@@ -3213,100 +3231,100 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3213
3231
  background: "transparent",
3214
3232
  borderRadius: 0,
3215
3233
  opacity: 1,
3216
- ...X.normalStyle
3234
+ ...T.normalStyle
3217
3235
  },
3218
3236
  controlInfo: {
3219
3237
  isDraggable: !0,
3220
3238
  isClickable: !0,
3221
3239
  isResizable: !0,
3222
3240
  isSelectable: !0,
3223
- ...X.controlInfo
3241
+ ...T.controlInfo
3224
3242
  }
3225
3243
  }), d(null));
3226
- }, [X, d, m]);
3244
+ }, [T, d, m]);
3227
3245
  const xe = () => {
3228
- !t || !X || (g("new"), v(!0));
3246
+ !t || !T || (g("new"), b(!0));
3229
3247
  }, ne = (s) => {
3230
- if (!t || !X) return;
3248
+ if (!t || !T) return;
3231
3249
  const q = {
3232
3250
  id: H(),
3233
- name: `${s.name}_状态${$.length + 1}`,
3234
- expression: $.length === 0 ? "return true;" : "return false;",
3251
+ name: `${s.name}_状态${Y.length + 1}`,
3252
+ expression: Y.length === 0 ? "return true;" : "return false;",
3235
3253
  material: { ...s, id: H() },
3236
3254
  bindCodes: []
3237
3255
  };
3238
- if (I === "new") {
3239
- const b = [...$, q];
3240
- a(t, { statusList: b });
3241
- } else if (I) {
3242
- const b = $.map((Y) => Y.id === I ? { ...Y, material: { ...s, id: H() } } : Y);
3243
- a(t, { statusList: b });
3256
+ if (k === "new") {
3257
+ const x = [...Y, q];
3258
+ a(t, { statusList: x });
3259
+ } else if (k) {
3260
+ const x = Y.map((X) => X.id === k ? { ...X, material: { ...s, id: H() } } : X);
3261
+ a(t, { statusList: x });
3244
3262
  }
3245
- v(!1), g(null);
3263
+ b(!1), g(null);
3246
3264
  }, we = (s) => {
3247
- if (!t || !X) return;
3248
- const q = X.contentInfo.statusList?.filter((b) => b.id !== s) || [];
3265
+ if (!t || !T) return;
3266
+ const q = T.contentInfo.statusList?.filter((x) => x.id !== s) || [];
3249
3267
  a(t, { statusList: q }), p === s && d(null);
3250
3268
  }, ie = (s, q) => {
3251
- if (!t || !X) return;
3252
- const b = X.contentInfo.statusList?.map((Y) => Y.id === s ? { ...Y, ...q } : Y) || [];
3253
- a(t, { statusList: b });
3254
- }, A = (s) => {
3255
- if (!t || !X) return;
3269
+ if (!t || !T) return;
3270
+ const x = T.contentInfo.statusList?.map((X) => X.id === s ? { ...X, ...q } : X) || [];
3271
+ a(t, { statusList: x });
3272
+ }, W = (s) => {
3273
+ if (!t || !T) return;
3256
3274
  const q = {
3257
3275
  ...s,
3258
3276
  id: H(),
3259
3277
  name: `${s.name}_复制`,
3260
3278
  expression: "return false;"
3261
- }, b = [...$, q];
3262
- a(t, { statusList: b });
3263
- }, J = (s, q) => {
3264
- if (!t || !X) return;
3265
- const b = $.findIndex((M) => M.id === s);
3266
- if (b === -1) return;
3267
- 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]
3274
- ]), a(t, { statusList: Y });
3279
+ }, x = [...Y, q];
3280
+ a(t, { statusList: x });
3281
+ }, K = (s, q) => {
3282
+ if (!t || !T) return;
3283
+ const x = Y.findIndex((D) => D.id === s);
3284
+ if (x === -1) return;
3285
+ const X = [...Y];
3286
+ q === "up" && x > 0 ? [X[x], X[x - 1]] = [
3287
+ X[x - 1],
3288
+ X[x]
3289
+ ] : q === "down" && x < X.length - 1 && ([X[x], X[x + 1]] = [
3290
+ X[x + 1],
3291
+ X[x]
3292
+ ]), a(t, { statusList: X });
3275
3293
  }, G = (s) => {
3276
- g(s), v(!0);
3277
- }, T = (s, q) => {
3278
- if (!t || !X) return;
3279
- const b = $.map((Y) => Y.id === s ? {
3280
- ...Y,
3281
- material: { ...Y.material, ...q }
3282
- } : Y);
3283
- a(t, { statusList: b });
3294
+ g(s), b(!0);
3295
+ }, R = (s, q) => {
3296
+ if (!t || !T) return;
3297
+ const x = Y.map((X) => X.id === s ? {
3298
+ ...X,
3299
+ material: { ...X.material, ...q }
3300
+ } : X);
3301
+ a(t, { statusList: x });
3284
3302
  };
3285
- return X ? /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
3303
+ return T ? /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
3286
3304
  /* @__PURE__ */ h("div", { className: "p-4 border-b border-gray-200", children: [
3287
3305
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "属性面板" }),
3288
3306
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "编辑选中节点的属性" })
3289
3307
  ] }),
3290
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ h(Rt, { activeKey: S, onChange: u, children: [
3291
- /* @__PURE__ */ e(ut, { tab: "基础", children: /* @__PURE__ */ h(
3308
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ h(_t, { activeKey: S, onChange: u, children: [
3309
+ /* @__PURE__ */ e(mt, { tab: "基础", children: /* @__PURE__ */ h(
3292
3310
  w,
3293
3311
  {
3294
3312
  form: m,
3295
3313
  layout: "vertical",
3296
- onValuesChange: L,
3297
- initialValues: { name: X.name },
3314
+ onValuesChange: $,
3315
+ initialValues: { name: T.name },
3298
3316
  children: [
3299
3317
  /* @__PURE__ */ e(w.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(re, { placeholder: "输入节点名称" }) }),
3300
3318
  /* @__PURE__ */ h(Ne, { ghost: !0, defaultActiveKey: ["position", "size", "style"], children: [
3301
- /* @__PURE__ */ e(Ee, { header: "位置", children: /* @__PURE__ */ h(be, { children: [
3319
+ /* @__PURE__ */ e(Me, { header: "位置", children: /* @__PURE__ */ h(be, { children: [
3302
3320
  /* @__PURE__ */ e(w.Item, { label: "X", name: ["normalStyle", "x"], children: /* @__PURE__ */ e(te, {}) }),
3303
3321
  /* @__PURE__ */ e(w.Item, { label: "Y", name: ["normalStyle", "y"], children: /* @__PURE__ */ e(te, {}) })
3304
3322
  ] }) }, "position"),
3305
- /* @__PURE__ */ e(Ee, { header: "尺寸", children: /* @__PURE__ */ h(be, { children: [
3323
+ /* @__PURE__ */ e(Me, { header: "尺寸", children: /* @__PURE__ */ h(be, { children: [
3306
3324
  /* @__PURE__ */ e(w.Item, { label: "宽度", name: ["normalStyle", "width"], children: /* @__PURE__ */ e(te, { min: 10 }) }),
3307
3325
  /* @__PURE__ */ e(w.Item, { label: "高度", name: ["normalStyle", "height"], children: /* @__PURE__ */ e(te, { min: 10 }) })
3308
3326
  ] }) }, "size"),
3309
- /* @__PURE__ */ h(Ee, { header: "样式", children: [
3327
+ /* @__PURE__ */ h(Me, { header: "样式", children: [
3310
3328
  /* @__PURE__ */ e(w.Item, { label: "背景色", name: ["normalStyle", "background"], children: /* @__PURE__ */ e(re, { placeholder: "transparent, #fff, url(...)" }) }),
3311
3329
  /* @__PURE__ */ e(w.Item, { label: "内边距", name: ["normalStyle", "padding"], children: /* @__PURE__ */ e(te, { min: 0 }) }),
3312
3330
  /* @__PURE__ */ e(w.Item, { label: "圆角", name: ["normalStyle", "borderRadius"], children: /* @__PURE__ */ e(te, { min: 0 }) }),
@@ -3335,10 +3353,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3335
3353
  ]
3336
3354
  }
3337
3355
  ) }, "basic"),
3338
- /* @__PURE__ */ e(ut, { tab: "状态", children: X.type === "group" && X.children ? /* @__PURE__ */ e(
3339
- Gn,
3356
+ /* @__PURE__ */ e(mt, { tab: "状态", children: T.type === "group" && T.children ? /* @__PURE__ */ e(
3357
+ qn,
3340
3358
  {
3341
- node: X,
3359
+ node: T,
3342
3360
  updateNode: r,
3343
3361
  materials: i
3344
3362
  }
@@ -3346,42 +3364,42 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3346
3364
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3347
3365
  /* @__PURE__ */ h("span", { className: "font-medium", children: [
3348
3366
  "状态列表",
3349
- /* @__PURE__ */ e(ye, { color: "blue", className: "ml-2", children: $.length })
3367
+ /* @__PURE__ */ e(ye, { color: "blue", className: "ml-2", children: Y.length })
3350
3368
  ] }),
3351
3369
  /* @__PURE__ */ e(
3352
3370
  Z,
3353
3371
  {
3354
3372
  type: "primary",
3355
3373
  size: "small",
3356
- icon: /* @__PURE__ */ e(zt, {}),
3374
+ icon: /* @__PURE__ */ e(Ot, {}),
3357
3375
  onClick: xe,
3358
3376
  children: "添加状态"
3359
3377
  }
3360
3378
  )
3361
3379
  ] }),
3362
3380
  /* @__PURE__ */ e("p", { className: "text-xs text-gray-500 mb-3", children: "节点根据状态表达式计算结果显示对应物料,第一个返回 true 的状态为当前状态" }),
3363
- $.length > 0 && /* @__PURE__ */ e("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ h("div", { children: [
3381
+ Y.length > 0 && /* @__PURE__ */ e("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ h("div", { children: [
3364
3382
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "当前状态:" }),
3365
3383
  /* @__PURE__ */ e("span", { className: "ml-2 text-sm font-medium text-blue-600", children: "由表达式自动计算" })
3366
3384
  ] }) }) }),
3367
- $.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(Ne, { ghost: !0, defaultActiveKey: $[0]?.id + t, children: $.map((s, q) => /* @__PURE__ */ e(
3368
- Ee,
3385
+ Y.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(Ne, { ghost: !0, defaultActiveKey: Y[0]?.id + t, children: Y.map((s, q) => /* @__PURE__ */ e(
3386
+ Me,
3369
3387
  {
3370
3388
  header: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3371
3389
  /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: q + 1 }),
3372
3390
  /* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
3373
3391
  /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: s.material.type })
3374
3392
  ] }),
3375
- extra: /* @__PURE__ */ h(be, { size: "small", onClick: (b) => b.stopPropagation(), children: [
3393
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (x) => x.stopPropagation(), children: [
3376
3394
  /* @__PURE__ */ e(
3377
3395
  Z,
3378
3396
  {
3379
3397
  type: "text",
3380
3398
  size: "small",
3381
- icon: /* @__PURE__ */ e(Ot, {}),
3399
+ icon: /* @__PURE__ */ e(At, {}),
3382
3400
  disabled: q === 0,
3383
- onClick: (b) => {
3384
- b.stopPropagation(), J(s.id, "up");
3401
+ onClick: (x) => {
3402
+ x.stopPropagation(), K(s.id, "up");
3385
3403
  }
3386
3404
  }
3387
3405
  ),
@@ -3390,10 +3408,10 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3390
3408
  {
3391
3409
  type: "text",
3392
3410
  size: "small",
3393
- icon: /* @__PURE__ */ e(At, {}),
3394
- disabled: q === $.length - 1,
3395
- onClick: (b) => {
3396
- b.stopPropagation(), J(s.id, "down");
3411
+ icon: /* @__PURE__ */ e(jt, {}),
3412
+ disabled: q === Y.length - 1,
3413
+ onClick: (x) => {
3414
+ x.stopPropagation(), K(s.id, "down");
3397
3415
  }
3398
3416
  }
3399
3417
  ),
@@ -3402,9 +3420,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3402
3420
  {
3403
3421
  type: "text",
3404
3422
  size: "small",
3405
- icon: /* @__PURE__ */ e(_t, {}),
3406
- onClick: (b) => {
3407
- b.stopPropagation(), A(s);
3423
+ icon: /* @__PURE__ */ e(zt, {}),
3424
+ onClick: (x) => {
3425
+ x.stopPropagation(), W(s);
3408
3426
  }
3409
3427
  }
3410
3428
  ),
@@ -3414,9 +3432,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3414
3432
  type: "text",
3415
3433
  size: "small",
3416
3434
  danger: !0,
3417
- icon: /* @__PURE__ */ e(ot, {}),
3418
- onClick: (b) => {
3419
- b.stopPropagation(), we(s.id);
3435
+ icon: /* @__PURE__ */ e(ct, {}),
3436
+ onClick: (x) => {
3437
+ x.stopPropagation(), we(s.id);
3420
3438
  }
3421
3439
  }
3422
3440
  )
@@ -3426,7 +3444,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3426
3444
  re,
3427
3445
  {
3428
3446
  value: s.name,
3429
- onChange: (b) => ie(s.id, { name: b.target.value }),
3447
+ onChange: (x) => ie(s.id, { name: x.target.value }),
3430
3448
  placeholder: "输入状态名称"
3431
3449
  }
3432
3450
  ) }),
@@ -3436,17 +3454,17 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3436
3454
  label: "执行表达式",
3437
3455
  help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
3438
3456
  children: /* @__PURE__ */ e(
3439
- qn,
3457
+ Bn,
3440
3458
  {
3441
- value: W[s.id] ?? s.expression,
3442
- onChange: (b) => O((Y) => ({
3443
- ...Y,
3444
- [s.id]: b.target.value
3459
+ value: U[s.id] ?? s.expression,
3460
+ onChange: (x) => j((X) => ({
3461
+ ...X,
3462
+ [s.id]: x.target.value
3445
3463
  })),
3446
- onBlur: (b) => {
3447
- ie(s.id, { expression: b.target.value }), O((Y) => {
3448
- const M = { ...Y };
3449
- return delete M[s.id], M;
3464
+ onBlur: (x) => {
3465
+ ie(s.id, { expression: x.target.value }), j((X) => {
3466
+ const D = { ...X };
3467
+ return delete D[s.id], D;
3450
3468
  });
3451
3469
  },
3452
3470
  rows: 3,
@@ -3460,7 +3478,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3460
3478
  {
3461
3479
  mode: "tags",
3462
3480
  value: s.bindCodes || [],
3463
- onChange: (b) => ie(s.id, { bindCodes: b }),
3481
+ onChange: (x) => ie(s.id, { bindCodes: x }),
3464
3482
  placeholder: "输入数据源 code",
3465
3483
  tokenSeparators: [",", " "]
3466
3484
  }
@@ -3473,23 +3491,23 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3473
3491
  {
3474
3492
  type: "link",
3475
3493
  size: "small",
3476
- icon: /* @__PURE__ */ e(ft, {}),
3494
+ icon: /* @__PURE__ */ e(pt, {}),
3477
3495
  onClick: () => G(s.id),
3478
3496
  children: "更换物料"
3479
3497
  }
3480
3498
  )
3481
3499
  ] }) }),
3482
- /* @__PURE__ */ e(Me, { style: { margin: "12px 0" } }),
3500
+ /* @__PURE__ */ e(De, { style: { margin: "12px 0" } }),
3483
3501
  /* @__PURE__ */ h("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3484
3502
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3485
3503
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
3486
3504
  /* @__PURE__ */ e(ye, { children: s.material.name })
3487
3505
  ] }),
3488
3506
  /* @__PURE__ */ e(
3489
- Ht,
3507
+ Gt,
3490
3508
  {
3491
3509
  material: s.material,
3492
- onSave: (b) => T(s.id, b),
3510
+ onSave: (x) => R(s.id, x),
3493
3511
  bindCodes: s.bindCodes || [],
3494
3512
  dataOptions: l || []
3495
3513
  }
@@ -3500,12 +3518,12 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3500
3518
  s.id + t
3501
3519
  )) })
3502
3520
  ] }) }, "status"),
3503
- /* @__PURE__ */ e(ut, { tab: "控制", children: /* @__PURE__ */ h(
3521
+ /* @__PURE__ */ e(mt, { tab: "控制", children: /* @__PURE__ */ h(
3504
3522
  w,
3505
3523
  {
3506
3524
  form: m,
3507
3525
  layout: "vertical",
3508
- onValuesChange: L,
3526
+ onValuesChange: $,
3509
3527
  children: [
3510
3528
  /* @__PURE__ */ e(
3511
3529
  w.Item,
@@ -3513,7 +3531,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3513
3531
  label: "可拖拽",
3514
3532
  name: ["controlInfo", "isDraggable"],
3515
3533
  valuePropName: "checked",
3516
- children: /* @__PURE__ */ e(Je, {})
3534
+ children: /* @__PURE__ */ e(Qe, {})
3517
3535
  }
3518
3536
  ),
3519
3537
  /* @__PURE__ */ e(
@@ -3522,7 +3540,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3522
3540
  label: "可点击",
3523
3541
  name: ["controlInfo", "isClickable"],
3524
3542
  valuePropName: "checked",
3525
- children: /* @__PURE__ */ e(Je, {})
3543
+ children: /* @__PURE__ */ e(Qe, {})
3526
3544
  }
3527
3545
  ),
3528
3546
  /* @__PURE__ */ e(
@@ -3531,7 +3549,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3531
3549
  label: "可调整大小",
3532
3550
  name: ["controlInfo", "isResizable"],
3533
3551
  valuePropName: "checked",
3534
- children: /* @__PURE__ */ e(Je, {})
3552
+ children: /* @__PURE__ */ e(Qe, {})
3535
3553
  }
3536
3554
  ),
3537
3555
  /* @__PURE__ */ e(
@@ -3540,7 +3558,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3540
3558
  label: "可选中",
3541
3559
  name: ["controlInfo", "isSelectable"],
3542
3560
  valuePropName: "checked",
3543
- children: /* @__PURE__ */ e(Je, {})
3561
+ children: /* @__PURE__ */ e(Qe, {})
3544
3562
  }
3545
3563
  )
3546
3564
  ]
@@ -3550,44 +3568,44 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3550
3568
  /* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ h("div", { className: "text-xs text-gray-500", children: [
3551
3569
  /* @__PURE__ */ h("div", { children: [
3552
3570
  "节点 ID: ",
3553
- X.id.slice(0, 8),
3571
+ T.id.slice(0, 8),
3554
3572
  "..."
3555
3573
  ] }),
3556
3574
  /* @__PURE__ */ h("div", { children: [
3557
3575
  "状态数: ",
3558
- $.length
3576
+ Y.length
3559
3577
  ] })
3560
3578
  ] }) }),
3561
3579
  /* @__PURE__ */ e(
3562
- it,
3580
+ st,
3563
3581
  {
3564
3582
  title: "选择物料",
3565
- open: k,
3583
+ open: E,
3566
3584
  onCancel: () => {
3567
- v(!1), g(null);
3585
+ b(!1), g(null);
3568
3586
  },
3569
3587
  footer: null,
3570
3588
  width: 600,
3571
3589
  children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ h(Ne, { ghost: !0, defaultActiveKey: ["basic", "device", "text", "line"], children: [
3572
- /* @__PURE__ */ e(Ee, { header: "基础形状", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => ["矩形", "圆形", "圆角矩形"].includes(s.name)).map((s) => /* @__PURE__ */ e(
3573
- Lt,
3590
+ /* @__PURE__ */ e(Me, { header: "基础形状", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => ["矩形", "圆形", "圆角矩形"].includes(s.name)).map((s) => /* @__PURE__ */ e(
3591
+ $t,
3574
3592
  {
3575
3593
  material: s,
3576
3594
  onClick: () => ne(s)
3577
3595
  },
3578
3596
  s.id
3579
3597
  )) }) }, "basic"),
3580
- /* @__PURE__ */ e(Ee, { header: "设备图标", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter(
3598
+ /* @__PURE__ */ e(Me, { header: "设备图标", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter(
3581
3599
  (s) => ["阀门", "泵", "罐体"].includes(s.name) || s.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(s.name)
3582
3600
  ).map((s) => /* @__PURE__ */ e(
3583
- Lt,
3601
+ $t,
3584
3602
  {
3585
3603
  material: s,
3586
3604
  onClick: () => ne(s)
3587
3605
  },
3588
3606
  s.id
3589
3607
  )) }) }, "device"),
3590
- /* @__PURE__ */ e(Ee, { header: "文本", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => s.type === "TEXT").map((s) => /* @__PURE__ */ h(
3608
+ /* @__PURE__ */ e(Me, { header: "文本", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => s.type === "TEXT").map((s) => /* @__PURE__ */ h(
3591
3609
  "div",
3592
3610
  {
3593
3611
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
@@ -3599,7 +3617,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3599
3617
  },
3600
3618
  s.id
3601
3619
  )) }) }, "text"),
3602
- /* @__PURE__ */ e(Ee, { header: "线条", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => s.type === "LINE").map((s) => /* @__PURE__ */ h(
3620
+ /* @__PURE__ */ e(Me, { header: "线条", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => s.type === "LINE").map((s) => /* @__PURE__ */ h(
3603
3621
  "div",
3604
3622
  {
3605
3623
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
@@ -3615,7 +3633,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3615
3633
  }
3616
3634
  )
3617
3635
  ] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(pe, { description: "请选择一个节点" }) });
3618
- }, Lt = ({ material: l, onClick: f }) => {
3636
+ }, $t = ({ material: l, onClick: f }) => {
3619
3637
  const t = l.type === "IMAGE" ? l.src : void 0;
3620
3638
  return /* @__PURE__ */ h(
3621
3639
  "div",
@@ -3628,9 +3646,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3628
3646
  ]
3629
3647
  }
3630
3648
  );
3631
- }, Vn = "ConfigEditor-module__configEditor__dinNG", Zn = {
3632
- configEditor: Vn
3633
- }, { Header: Jn, Sider: Yt, Content: Kn } = ht, ol = ({
3649
+ }, Zn = "ConfigEditor-module__configEditor__dinNG", Jn = {
3650
+ configEditor: Zn
3651
+ }, { Header: Kn, Sider: Xt, Content: Qn } = ft, sl = ({
3634
3652
  initialScheme: l,
3635
3653
  onChange: f,
3636
3654
  readonly: t = !1,
@@ -3642,7 +3660,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3642
3660
  showPropertyPanel: p = !0,
3643
3661
  customMaterials: d
3644
3662
  }) => {
3645
- const [m, S] = Ce.useState(!1), [u, k] = Ce.useState(""), [v, I] = Ce.useState([
3663
+ const [m, S] = Ce.useState(!1), [u, E] = Ce.useState(""), [b, k] = Ce.useState([
3646
3664
  {
3647
3665
  paramsCode: "001",
3648
3666
  paramsName: "通频速度有效值",
@@ -3655,70 +3673,70 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3655
3673
  value: 1.5,
3656
3674
  paramsUnit: "m/s²"
3657
3675
  }
3658
- ]), { exportScheme: g, importScheme: W, nodes: O, materials: X, addMaterial: $ } = ze();
3676
+ ]), { exportScheme: g, importScheme: U, nodes: j, materials: T, addMaterial: Y } = Oe();
3659
3677
  Ce.useRef(null);
3660
- 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(() => {
3678
+ const $ = Ce.useRef(!1);
3679
+ he(() => {
3680
+ $.current || ($.current = !0, T.length === 0 && Ln.forEach((W) => Y(W)), d && d.length > 0 && d.forEach((W) => Y(W)), l && U(l));
3681
+ }, []), he(() => {
3664
3682
  if (f) {
3665
- const A = g();
3666
- f(A);
3683
+ const W = g();
3684
+ f(W);
3667
3685
  }
3668
- }, [O, f]);
3686
+ }, [j, f]);
3669
3687
  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");
3671
- s.setAttribute("href", G), s.setAttribute("download", T), s.click(), Ye.success("导出成功!");
3688
+ const W = g(), K = JSON.stringify(W, null, 2), G = "data:application/json;charset=utf-8," + encodeURIComponent(K), R = `scheme_${Date.now()}.json`, s = document.createElement("a");
3689
+ s.setAttribute("href", G), s.setAttribute("download", R), s.click(), $e.success("导出成功!");
3672
3690
  }, [g]), ne = V(() => {
3673
3691
  try {
3674
- const A = JSON.parse(u);
3675
- W(A), S(!1), k(""), Ye.success("导入成功!");
3692
+ const W = JSON.parse(u);
3693
+ U(W), S(!1), E(""), $e.success("导入成功!");
3676
3694
  } catch {
3677
- Ye.error("JSON 格式错误,请检查输入");
3695
+ $e.error("JSON 格式错误,请检查输入");
3678
3696
  }
3679
- }, [u, W]), we = V(
3680
- (A) => {
3681
- const J = new FileReader();
3682
- return J.onload = (G) => {
3697
+ }, [u, U]), we = V(
3698
+ (W) => {
3699
+ const K = new FileReader();
3700
+ return K.onload = (G) => {
3683
3701
  try {
3684
- const T = G.target?.result, s = JSON.parse(T);
3685
- W(s), Ye.success("导入成功!"), S(!1);
3702
+ const R = G.target?.result, s = JSON.parse(R);
3703
+ U(s), $e.success("导入成功!"), S(!1);
3686
3704
  } catch {
3687
- Ye.error("文件格式错误");
3705
+ $e.error("文件格式错误");
3688
3706
  }
3689
- }, J.readAsText(A), !1;
3707
+ }, K.readAsText(W), !1;
3690
3708
  },
3691
- [W]
3709
+ [U]
3692
3710
  ), ie = V(() => g(), [g]);
3693
3711
  return Ce.useImperativeHandle(
3694
3712
  Ce.useRef?.(),
3695
3713
  () => ({
3696
3714
  getScheme: ie,
3697
3715
  exportScheme: g,
3698
- importScheme: W
3716
+ importScheme: U
3699
3717
  }),
3700
- [ie, g, W]
3701
- ), /* @__PURE__ */ e(Bt, { locale: kn, children: /* @__PURE__ */ e("div", { className: Zn.configEditor, style: n, children: /* @__PURE__ */ h(
3702
- ht,
3718
+ [ie, g, U]
3719
+ ), /* @__PURE__ */ e(Vt, { locale: En, children: /* @__PURE__ */ e("div", { className: Jn.configEditor, style: n, children: /* @__PURE__ */ h(
3720
+ ft,
3703
3721
  {
3704
3722
  className: `h-full w-full overflow-hidden ${c}`,
3705
3723
  children: [
3706
- a && /* @__PURE__ */ h(Jn, { className: "bg-white border-b border-gray-200 px-4 flex items-center justify-between flex-shrink-0", children: [
3724
+ a && /* @__PURE__ */ h(Kn, { className: "bg-white border-b border-gray-200 px-4 flex items-center justify-between flex-shrink-0", children: [
3707
3725
  /* @__PURE__ */ h("div", { className: "flex items-center gap-4", children: [
3708
3726
  /* @__PURE__ */ e("div", { className: "text-xl font-bold text-blue-600", children: "组态编辑器" }),
3709
3727
  /* @__PURE__ */ h("div", { className: "text-sm text-gray-500", children: [
3710
- O.length,
3728
+ j.length,
3711
3729
  " 个节点"
3712
3730
  ] })
3713
3731
  ] }),
3714
3732
  /* @__PURE__ */ h(be, { children: [
3715
3733
  r,
3716
- !t && /* @__PURE__ */ h(Oe, { children: [
3717
- /* @__PURE__ */ e(Le, { title: "导出 JSON", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mn, {}), onClick: xe, children: "导出" }) }),
3718
- /* @__PURE__ */ e(Le, { title: "导入 JSON", children: /* @__PURE__ */ e(
3734
+ !t && /* @__PURE__ */ h(Ae, { children: [
3735
+ /* @__PURE__ */ e(Ye, { title: "导出 JSON", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(fn, {}), onClick: xe, children: "导出" }) }),
3736
+ /* @__PURE__ */ e(Ye, { title: "导入 JSON", children: /* @__PURE__ */ e(
3719
3737
  Z,
3720
3738
  {
3721
- icon: /* @__PURE__ */ e(mt, {}),
3739
+ icon: /* @__PURE__ */ e(gt, {}),
3722
3740
  onClick: () => S(!0),
3723
3741
  children: "导入"
3724
3742
  }
@@ -3726,19 +3744,19 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3726
3744
  ] })
3727
3745
  ] })
3728
3746
  ] }),
3729
- /* @__PURE__ */ h(ht, { children: [
3730
- i && !t && /* @__PURE__ */ e(Yt, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(Ln, {}) }),
3731
- /* @__PURE__ */ e(Kn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(An, { defaultTestData: v }) }),
3732
- p && !t && /* @__PURE__ */ e(Yt, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(Bn, { defaultTestData: v }) })
3747
+ /* @__PURE__ */ h(ft, { children: [
3748
+ i && !t && /* @__PURE__ */ e(Xt, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e($n, {}) }),
3749
+ /* @__PURE__ */ e(Qn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(jn, { defaultTestData: b }) }),
3750
+ p && !t && /* @__PURE__ */ e(Xt, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(Vn, { defaultTestData: b }) })
3733
3751
  ] }),
3734
3752
  /* @__PURE__ */ e(
3735
- it,
3753
+ st,
3736
3754
  {
3737
3755
  title: "导入组态方案",
3738
3756
  open: m,
3739
3757
  onOk: ne,
3740
3758
  onCancel: () => {
3741
- S(!1), k("");
3759
+ S(!1), E("");
3742
3760
  },
3743
3761
  width: 600,
3744
3762
  children: /* @__PURE__ */ h("div", { className: "space-y-4", children: [
@@ -3749,9 +3767,9 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3749
3767
  {
3750
3768
  type: "file",
3751
3769
  accept: ".json",
3752
- onChange: (A) => {
3753
- const J = A.target.files?.[0];
3754
- J && we(J);
3770
+ onChange: (W) => {
3771
+ const K = W.target.files?.[0];
3772
+ K && we(K);
3755
3773
  },
3756
3774
  className: `block w-full text-sm text-gray-500
3757
3775
  file:mr-4 file:py-2 file:px-4
@@ -3769,7 +3787,7 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3769
3787
  "textarea",
3770
3788
  {
3771
3789
  value: u,
3772
- onChange: (A) => k(A.target.value),
3790
+ onChange: (W) => E(W.target.value),
3773
3791
  placeholder: "粘贴 JSON 内容...",
3774
3792
  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
3793
  }
@@ -3783,14 +3801,14 @@ const kn = /* @__PURE__ */ vn(In), En = (l) => (f, t, r) => (r.setState = (c, n,
3783
3801
  ) }) });
3784
3802
  };
3785
3803
  export {
3786
- An as Canvas,
3787
- ol as ConfigEditor,
3788
- Ln as MaterialPanel,
3789
- Ut as NodeRenderer,
3790
- Bn as PropertyPanel,
3791
- $n as createDefaultNode,
3792
- Ft as createDefaultStatus,
3793
- Dn as initMaterials,
3794
- ze as useEditorStore
3804
+ jn as Canvas,
3805
+ sl as ConfigEditor,
3806
+ $n as MaterialPanel,
3807
+ Ht as NodeRenderer,
3808
+ Vn as PropertyPanel,
3809
+ Yn as createDefaultNode,
3810
+ Ut as createDefaultStatus,
3811
+ Ln as initMaterials,
3812
+ Oe as useEditorStore
3795
3813
  };
3796
3814
  //# sourceMappingURL=config-editor.es.js.map