jch-config-editor 0.1.10 → 0.1.12

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 Re } from "react/jsx-runtime";
2
- import Ce, { useState as Q, useRef as ue, useMemo as Yt, useCallback as V, useEffect as ye } from "react";
3
- import { Typography as Lt, Upload as Ht, Button as K, Collapse as Ne, List as De, Empty as ge, Tag as pe, Image as Gt, Space as be, Tooltip as $e, Modal as at, Form as w, Input as re, InputNumber as te, Switch as Ze, Divider as Me, Select as Ie, Tabs as Xt, message as We, ConfigProvider as qt, Layout as ut } from "antd";
4
- import { UploadOutlined as Pt, EditOutlined as ht, DeleteOutlined as it, UndoOutlined as Bt, RedoOutlined as Vt, CopyOutlined as Tt, GroupOutlined as pt, UngroupOutlined as Zt, AlignLeftOutlined as Jt, AlignRightOutlined as Kt, VerticalAlignTopOutlined as Qt, VerticalAlignBottomOutlined as en, ColumnWidthOutlined as tn, ColumnHeightOutlined as nn, SettingOutlined as ln, ExperimentOutlined as rn, ZoomInOutlined as an, ZoomOutOutlined as on, SelectOutlined as sn, DragOutlined as cn, EyeOutlined as dn, PlusOutlined as _t, ArrowUpOutlined as Rt, ArrowDownOutlined as zt, DownloadOutlined as un } from "@ant-design/icons";
5
- import { create as hn } from "zustand";
6
- import { produce as mn } from "immer";
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";
7
7
  import { nanoid as H } from "nanoid";
8
- import { TransformWrapper as fn, TransformComponent as gn } from "react-zoom-pan-pinch";
9
- function pn(l) {
8
+ import { TransformWrapper as pn, TransformComponent as yn } from "react-zoom-pan-pinch";
9
+ function vn(l) {
10
10
  return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
11
11
  }
12
- var Fe = {}, st = { exports: {} }, yt;
13
- function mt() {
14
- return yt || (yt = 1, (function(l) {
12
+ var Ue = {}, ct = { exports: {} }, bt;
13
+ function gt() {
14
+ return bt || (bt = 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
- })(st)), st.exports;
21
+ })(ct)), ct.exports;
22
22
  }
23
- var Ue = {}, vt;
24
- function yn() {
25
- if (vt) return Ue;
26
- vt = 1, Object.defineProperty(Ue, "__esModule", {
23
+ var He = {}, xt;
24
+ function bn() {
25
+ if (xt) return He;
26
+ xt = 1, Object.defineProperty(He, "__esModule", {
27
27
  value: !0
28
- }), Ue.default = void 0;
28
+ }), He.default = void 0;
29
29
  const l = {
30
30
  // Options
31
31
  items_per_page: "条/页",
@@ -41,48 +41,48 @@ function yn() {
41
41
  next_3: "向后 3 页",
42
42
  page_size: "页码"
43
43
  };
44
- return Ue.default = l, Ue;
44
+ return He.default = l, He;
45
45
  }
46
- var He = {}, Ge = {}, qe = {}, Be = {}, bt;
47
- function vn() {
48
- return bt || (bt = 1, Object.defineProperty(Be, "__esModule", {
46
+ var Ge = {}, qe = {}, Be = {}, Ve = {}, wt;
47
+ function xn() {
48
+ return wt || (wt = 1, Object.defineProperty(Ve, "__esModule", {
49
49
  value: !0
50
- }), Be.commonLocale = void 0, Be.commonLocale = {
50
+ }), Ve.commonLocale = void 0, Ve.commonLocale = {
51
51
  yearFormat: "YYYY",
52
52
  dayFormat: "D",
53
53
  cellMeridiemFormat: "A",
54
54
  monthBeforeYear: !0
55
- }), Be;
55
+ }), Ve;
56
56
  }
57
- var xt;
58
- function bn() {
59
- if (xt) return qe;
60
- xt = 1, Object.defineProperty(qe, "__esModule", {
57
+ var St;
58
+ function wn() {
59
+ if (St) return Be;
60
+ St = 1, Object.defineProperty(Be, "__esModule", {
61
61
  value: !0
62
- }), qe.default = void 0;
63
- var l = vn();
62
+ }), Be.default = void 0;
63
+ var l = xn();
64
64
  function f(p) {
65
65
  "@babel/helpers - typeof";
66
- return f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(u) {
67
- return typeof u;
68
- } : function(u) {
69
- return u && typeof Symbol == "function" && u.constructor === Symbol && u !== Symbol.prototype ? "symbol" : typeof u;
66
+ return f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(d) {
67
+ return typeof d;
68
+ } : function(d) {
69
+ return d && typeof Symbol == "function" && d.constructor === Symbol && d !== Symbol.prototype ? "symbol" : typeof d;
70
70
  }, f(p);
71
71
  }
72
- function t(p, u) {
72
+ function t(p, d) {
73
73
  var m = Object.keys(p);
74
74
  if (Object.getOwnPropertySymbols) {
75
75
  var S = Object.getOwnPropertySymbols(p);
76
- u && (S = S.filter(function(s) {
77
- return Object.getOwnPropertyDescriptor(p, s).enumerable;
76
+ d && (S = S.filter(function(u) {
77
+ return Object.getOwnPropertyDescriptor(p, u).enumerable;
78
78
  })), m.push.apply(m, S);
79
79
  }
80
80
  return m;
81
81
  }
82
82
  function r(p) {
83
- for (var u = 1; u < arguments.length; u++) {
84
- var m = arguments[u] != null ? arguments[u] : {};
85
- u % 2 ? t(Object(m), !0).forEach(function(S) {
83
+ for (var d = 1; d < arguments.length; d++) {
84
+ var m = arguments[d] != null ? arguments[d] : {};
85
+ d % 2 ? t(Object(m), !0).forEach(function(S) {
86
86
  c(p, S, m[S]);
87
87
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(p, Object.getOwnPropertyDescriptors(m)) : t(Object(m)).forEach(function(S) {
88
88
  Object.defineProperty(p, S, Object.getOwnPropertyDescriptor(m, S));
@@ -90,22 +90,22 @@ function bn() {
90
90
  }
91
91
  return p;
92
92
  }
93
- function c(p, u, m) {
94
- return u = n(u), u in p ? Object.defineProperty(p, u, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : p[u] = m, p;
93
+ function c(p, d, m) {
94
+ return d = n(d), d in p ? Object.defineProperty(p, d, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : p[d] = m, p;
95
95
  }
96
96
  function n(p) {
97
- var u = a(p, "string");
98
- return f(u) == "symbol" ? u : String(u);
97
+ var d = a(p, "string");
98
+ return f(d) == "symbol" ? d : String(d);
99
99
  }
100
- function a(p, u) {
100
+ function a(p, d) {
101
101
  if (f(p) != "object" || !p) return p;
102
102
  var m = p[Symbol.toPrimitive];
103
103
  if (m !== void 0) {
104
- var S = m.call(p, u);
104
+ var S = m.call(p, d);
105
105
  if (f(S) != "object") return S;
106
106
  throw new TypeError("@@toPrimitive must return a primitive value.");
107
107
  }
108
- return (u === "string" ? String : Number)(p);
108
+ return (d === "string" ? String : Number)(p);
109
109
  }
110
110
  var i = r(r({}, l.commonLocale), {}, {
111
111
  locale: "zh_CN",
@@ -135,29 +135,29 @@ function bn() {
135
135
  cellDateFormat: "D",
136
136
  monthBeforeYear: !1
137
137
  });
138
- return qe.default = i, qe;
138
+ return Be.default = i, Be;
139
139
  }
140
- var Ve = {}, wt;
141
- function Ot() {
142
- if (wt) return Ve;
143
- wt = 1, Object.defineProperty(Ve, "__esModule", {
140
+ var Ze = {}, Ct;
141
+ function jt() {
142
+ if (Ct) return Ze;
143
+ Ct = 1, Object.defineProperty(Ze, "__esModule", {
144
144
  value: !0
145
- }), Ve.default = void 0;
145
+ }), Ze.default = void 0;
146
146
  const l = {
147
147
  placeholder: "请选择时间",
148
148
  rangePlaceholder: ["开始时间", "结束时间"]
149
149
  };
150
- return Ve.default = l, Ve;
150
+ return Ze.default = l, Ze;
151
151
  }
152
- var St;
153
- function At() {
154
- if (St) return Ge;
155
- St = 1;
156
- var l = mt().default;
157
- Object.defineProperty(Ge, "__esModule", {
152
+ var Nt;
153
+ function Wt() {
154
+ if (Nt) return qe;
155
+ Nt = 1;
156
+ var l = gt().default;
157
+ Object.defineProperty(qe, "__esModule", {
158
158
  value: !0
159
- }), Ge.default = void 0;
160
- var f = l(bn()), t = l(/* @__PURE__ */ Ot());
159
+ }), qe.default = void 0;
160
+ var f = l(wn()), t = l(/* @__PURE__ */ jt());
161
161
  const r = {
162
162
  lang: {
163
163
  placeholder: "请选择日期",
@@ -176,28 +176,28 @@ function At() {
176
176
  ...t.default
177
177
  }
178
178
  };
179
- return r.lang.ok = "确定", Ge.default = r, Ge;
179
+ return r.lang.ok = "确定", qe.default = r, qe;
180
180
  }
181
- var Ct;
182
- function xn() {
183
- if (Ct) return He;
184
- Ct = 1;
185
- var l = mt().default;
186
- Object.defineProperty(He, "__esModule", {
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
187
  value: !0
188
- }), He.default = void 0;
189
- var f = l(/* @__PURE__ */ At());
190
- return He.default = f.default, He;
188
+ }), Ge.default = void 0;
189
+ var f = l(/* @__PURE__ */ Wt());
190
+ return Ge.default = f.default, Ge;
191
191
  }
192
- var Nt;
193
- function wn() {
194
- if (Nt) return Fe;
195
- Nt = 1;
196
- var l = mt().default;
197
- Object.defineProperty(Fe, "__esModule", {
192
+ var kt;
193
+ function Cn() {
194
+ if (kt) return Ue;
195
+ kt = 1;
196
+ var l = gt().default;
197
+ Object.defineProperty(Ue, "__esModule", {
198
198
  value: !0
199
- }), Fe.default = void 0;
200
- var f = l(yn()), t = l(/* @__PURE__ */ xn()), r = l(/* @__PURE__ */ At()), c = l(/* @__PURE__ */ Ot());
199
+ }), Ue.default = void 0;
200
+ var f = l(bn()), t = l(/* @__PURE__ */ Sn()), r = l(/* @__PURE__ */ Wt()), c = l(/* @__PURE__ */ jt());
201
201
  const n = "${label}不是一个有效的${type}", a = {
202
202
  locale: "zh-cn",
203
203
  Pagination: f.default,
@@ -338,17 +338,17 @@ function wn() {
338
338
  gradientColor: "渐变色"
339
339
  }
340
340
  };
341
- return Fe.default = a, Fe;
341
+ return Ue.default = a, Ue;
342
342
  }
343
- var ct, It;
344
- function Sn() {
345
- return It || (It = 1, ct = /* @__PURE__ */ wn()), ct;
343
+ var dt, Et;
344
+ function Nn() {
345
+ return Et || (Et = 1, dt = /* @__PURE__ */ Cn()), dt;
346
346
  }
347
- var Cn = /* @__PURE__ */ Sn();
348
- const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n, ...a) => {
349
- const i = typeof c == "function" ? mn(c) : c;
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;
350
350
  return f(i, n, ...a);
351
- }, l(r.setState, t, r)), kn = In, kt = {
351
+ }, l(r.setState, t, r)), Mn = En, Mt = {
352
352
  nodes: [],
353
353
  materials: [],
354
354
  selectedNodeId: null,
@@ -381,15 +381,15 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
381
381
  targetId: f,
382
382
  payload: t,
383
383
  timestamp: Date.now()
384
- }), _e = hn()(
385
- kn((l, f) => ({
386
- ...kt,
384
+ }), ze = fn()(
385
+ Mn((l, f) => ({
386
+ ...Mt,
387
387
  // ========== 节点操作 ==========
388
388
  addNode: (t, r = !0) => {
389
389
  l((c) => {
390
390
  const n = {
391
391
  ...t,
392
- id: H()
392
+ id: t.id || H()
393
393
  };
394
394
  c.nodes.push(n), r && (c.selectedNodeId = n.id, c.history.past.push(Se("NODE_SELECT", n.id)));
395
395
  });
@@ -585,11 +585,11 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (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 || kt.viewport, r.selectedNodeId = null, r.selectedStatusId = null, r.history = { past: [], future: [] };
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: [] };
589
589
  });
590
590
  }
591
591
  }))
592
- ), En = [
592
+ ), Dn = [
593
593
  // 基础形状
594
594
  {
595
595
  id: H(),
@@ -662,30 +662,30 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
662
662
  lineType: "solid"
663
663
  }
664
664
  }
665
- ], jt = (l) => ({
665
+ ], Ft = (l) => ({
666
666
  id: H(),
667
667
  name: "默认状态",
668
668
  expression: "return true;",
669
669
  material: { ...l, id: H() },
670
670
  bindCodes: []
671
- }), Mn = (l, f, t) => {
671
+ }), $n = (l, f, t) => {
672
672
  if (t?.type === "CUSTOM" && t.config?.nodes) {
673
- const r = t.config.nodes.map((u) => ({
674
- ...u,
673
+ const r = t.config.nodes.map((d) => ({
674
+ ...d,
675
675
  id: H()
676
676
  // 重新生成子节点ID
677
677
  }));
678
678
  let c = 1 / 0, n = 1 / 0, a = -1 / 0, i = -1 / 0;
679
- r.forEach((u) => {
680
- const m = u.normalStyle.x || 0, S = u.normalStyle.y || 0, s = u.normalStyle.width || 0, I = u.normalStyle.height || 0;
681
- c = Math.min(c, m), n = Math.min(n, S), a = Math.max(a, m + s), i = Math.max(i, S + I);
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);
682
682
  });
683
- const p = r.map((u) => ({
684
- ...u,
683
+ const p = r.map((d) => ({
684
+ ...d,
685
685
  normalStyle: {
686
- ...u.normalStyle,
687
- x: (u.normalStyle.x || 0) - c,
688
- y: (u.normalStyle.y || 0) - n,
686
+ ...d.normalStyle,
687
+ x: (d.normalStyle.x || 0) - c,
688
+ y: (d.normalStyle.y || 0) - n,
689
689
  scale: void 0
690
690
  // 移除 scale,由父级容器统一控制
691
691
  }
@@ -727,7 +727,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
727
727
  padding: 8
728
728
  },
729
729
  contentInfo: {
730
- statusList: t ? [jt(t)] : [],
730
+ statusList: t ? [Ft(t)] : [],
731
731
  currentStatusId: void 0
732
732
  },
733
733
  controlInfo: {
@@ -737,7 +737,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
737
737
  isSelectable: !0
738
738
  }
739
739
  };
740
- }, { Panel: Te } = Ne, { Text: lt } = Lt, Dn = () => {
740
+ }, { Panel: _e } = Ne, { Text: rt } = Pt, Ln = () => {
741
741
  const {
742
742
  materials: l,
743
743
  addMaterial: f,
@@ -748,7 +748,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
748
748
  lineDrawing: a,
749
749
  startLineDrawing: i,
750
750
  cancelLineDrawing: p
751
- } = _e(), [u, m] = Q([
751
+ } = ze(), [d, m] = Q([
752
752
  "basic",
753
753
  "device",
754
754
  "text",
@@ -763,7 +763,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
763
763
  src: X
764
764
  });
765
765
  }, W.readAsDataURL(g), !1;
766
- }, s = {
766
+ }, u = {
767
767
  basic: l.filter(
768
768
  (g) => ["矩形", "圆形", "圆角矩形"].includes(g.name)
769
769
  ),
@@ -776,22 +776,22 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (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
- }, I = (g, W) => {
779
+ }, k = (g, W) => {
780
780
  g.dataTransfer.effectAllowed = "copy", g.dataTransfer.setData("application/json", JSON.stringify(W));
781
781
  const O = g.currentTarget.querySelector(
782
782
  ".material-preview"
783
783
  );
784
784
  O && g.dataTransfer.setDragImage(O, 20, 20);
785
- }, b = (g) => {
785
+ }, v = (g) => {
786
786
  g.type === "LINE" && i(g);
787
- }, N = (g, W = !1) => {
787
+ }, I = (g, W = !1) => {
788
788
  const O = W === !0, X = n === "line-draw" && O && a.material?.id === g.id;
789
789
  return /* @__PURE__ */ e(
790
- De.Item,
790
+ $e.Item,
791
791
  {
792
792
  draggable: !O,
793
- onDragStart: ($) => I($, g),
794
- onClick: () => O && b(g),
793
+ onDragStart: ($) => k($, g),
794
+ onClick: () => O && v(g),
795
795
  className: `
796
796
  rounded-lg transition-all duration-200 select-none
797
797
  ${O ? "cursor-pointer" : "cursor-move"}
@@ -800,25 +800,25 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
800
800
  `,
801
801
  actions: [
802
802
  O ? /* @__PURE__ */ e(
803
- K,
803
+ Z,
804
804
  {
805
805
  type: "text",
806
806
  size: "small",
807
- icon: /* @__PURE__ */ e(ht, {}),
807
+ icon: /* @__PURE__ */ e(ft, {}),
808
808
  onClick: ($) => {
809
- $.stopPropagation(), b(g);
809
+ $.stopPropagation(), v(g);
810
810
  },
811
811
  children: "绘制"
812
812
  },
813
813
  "draw"
814
814
  ) : null,
815
815
  /* @__PURE__ */ e(
816
- K,
816
+ Z,
817
817
  {
818
818
  type: "text",
819
819
  size: "small",
820
820
  danger: !0,
821
- icon: /* @__PURE__ */ e(it, {}),
821
+ icon: /* @__PURE__ */ e(ot, {}),
822
822
  onClick: ($) => {
823
823
  $.stopPropagation(), t(g.id);
824
824
  }
@@ -828,7 +828,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
828
828
  ].filter(Boolean),
829
829
  children: /* @__PURE__ */ h("div", { className: `flex items-center gap-3 w-full py-2 ${O ? "" : "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
- Gt,
831
+ qt,
832
832
  {
833
833
  src: g.src,
834
834
  alt: g.name,
@@ -838,10 +838,10 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (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(lt, { strong: !0, className: "block truncate", children: g.name }),
841
+ /* @__PURE__ */ e(rt, { strong: !0, className: "block truncate", children: g.name }),
842
842
  /* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
843
- /* @__PURE__ */ e(lt, { type: "secondary", className: "text-xs", children: g.type }),
844
- X && /* @__PURE__ */ e(pe, { color: "blue", className: "text-xs", children: "绘制中" })
843
+ /* @__PURE__ */ e(rt, { type: "secondary", className: "text-xs", children: g.type }),
844
+ X && /* @__PURE__ */ e(ye, { color: "blue", className: "text-xs", children: "绘制中" })
845
845
  ] })
846
846
  ] })
847
847
  ] })
@@ -852,92 +852,92 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (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(lt, { type: "secondary", className: "text-sm", children: "拖拽物料到画布创建节点" })
855
+ /* @__PURE__ */ e(rt, { 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
- Ht,
858
+ Tt,
859
859
  {
860
860
  accept: ".svg",
861
861
  beforeUpload: S,
862
862
  showUploadList: !1,
863
- children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(Pt, {}), block: !0, type: "dashed", children: "上传 SVG" })
863
+ children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mt, {}), 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(
867
867
  Ne,
868
868
  {
869
- activeKey: u,
869
+ activeKey: d,
870
870
  onChange: (g) => m(g),
871
871
  ghost: !0,
872
872
  expandIconPosition: "end",
873
873
  children: [
874
- /* @__PURE__ */ e(Te, { header: "基础形状", children: /* @__PURE__ */ e(
875
- De,
874
+ /* @__PURE__ */ e(_e, { header: "基础形状", children: /* @__PURE__ */ e(
875
+ $e,
876
876
  {
877
- dataSource: s.basic,
878
- renderItem: (g) => N(g, !1),
877
+ dataSource: u.basic,
878
+ renderItem: (g) => I(g, !1),
879
879
  locale: {
880
880
  emptyText: /* @__PURE__ */ e(
881
- ge,
881
+ pe,
882
882
  {
883
883
  description: "暂无物料",
884
- image: ge.PRESENTED_IMAGE_SIMPLE
884
+ image: pe.PRESENTED_IMAGE_SIMPLE
885
885
  }
886
886
  )
887
887
  }
888
888
  }
889
889
  ) }, "basic"),
890
- /* @__PURE__ */ e(Te, { header: "设备图标", children: /* @__PURE__ */ e(
891
- De,
890
+ /* @__PURE__ */ e(_e, { header: "设备图标", children: /* @__PURE__ */ e(
891
+ $e,
892
892
  {
893
- dataSource: s.device,
894
- renderItem: (g) => N(g, !1),
893
+ dataSource: u.device,
894
+ renderItem: (g) => I(g, !1),
895
895
  locale: {
896
896
  emptyText: /* @__PURE__ */ e(
897
- ge,
897
+ pe,
898
898
  {
899
899
  description: "暂无物料",
900
- image: ge.PRESENTED_IMAGE_SIMPLE
900
+ image: pe.PRESENTED_IMAGE_SIMPLE
901
901
  }
902
902
  )
903
903
  }
904
904
  }
905
905
  ) }, "device"),
906
- /* @__PURE__ */ e(Te, { header: "文本", children: /* @__PURE__ */ e(
907
- De,
906
+ /* @__PURE__ */ e(_e, { header: "文本", children: /* @__PURE__ */ e(
907
+ $e,
908
908
  {
909
- dataSource: s.text,
910
- renderItem: (g) => N(g, !1),
909
+ dataSource: u.text,
910
+ renderItem: (g) => I(g, !1),
911
911
  locale: {
912
912
  emptyText: /* @__PURE__ */ e(
913
- ge,
913
+ pe,
914
914
  {
915
915
  description: "暂无物料",
916
- image: ge.PRESENTED_IMAGE_SIMPLE
916
+ image: pe.PRESENTED_IMAGE_SIMPLE
917
917
  }
918
918
  )
919
919
  }
920
920
  }
921
921
  ) }, "text"),
922
922
  /* @__PURE__ */ h(
923
- Te,
923
+ _e,
924
924
  {
925
925
  header: /* @__PURE__ */ h("div", { className: "flex items-center justify-between", children: [
926
926
  /* @__PURE__ */ e("span", { children: "线条" }),
927
- n === "line-draw" && /* @__PURE__ */ e(pe, { color: "blue", className: "text-xs", children: "绘制模式" })
927
+ n === "line-draw" && /* @__PURE__ */ e(ye, { color: "blue", className: "text-xs", children: "绘制模式" })
928
928
  ] }),
929
929
  children: [
930
930
  /* @__PURE__ */ e(
931
- De,
931
+ $e,
932
932
  {
933
- dataSource: s.line,
934
- renderItem: (g) => N(g, !0),
933
+ dataSource: u.line,
934
+ renderItem: (g) => I(g, !0),
935
935
  locale: {
936
936
  emptyText: /* @__PURE__ */ e(
937
- ge,
937
+ pe,
938
938
  {
939
939
  description: "暂无物料",
940
- image: ge.PRESENTED_IMAGE_SIMPLE
940
+ image: pe.PRESENTED_IMAGE_SIMPLE
941
941
  }
942
942
  )
943
943
  }
@@ -951,33 +951,33 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
951
951
  },
952
952
  "line"
953
953
  ),
954
- s.group.length > 0 && /* @__PURE__ */ e(Te, { header: "群组", children: /* @__PURE__ */ e(
955
- De,
954
+ u.group.length > 0 && /* @__PURE__ */ e(_e, { header: "群组", children: /* @__PURE__ */ e(
955
+ $e,
956
956
  {
957
- dataSource: s.group,
958
- renderItem: (g) => N(g, !1),
957
+ dataSource: u.group,
958
+ renderItem: (g) => I(g, !1),
959
959
  locale: {
960
960
  emptyText: /* @__PURE__ */ e(
961
- ge,
961
+ pe,
962
962
  {
963
963
  description: "暂无物料",
964
- image: ge.PRESENTED_IMAGE_SIMPLE
964
+ image: pe.PRESENTED_IMAGE_SIMPLE
965
965
  }
966
966
  )
967
967
  }
968
968
  }
969
969
  ) }, "group"),
970
- s.custom.length > 0 && /* @__PURE__ */ e(Te, { header: "自定义", children: /* @__PURE__ */ e(
971
- De,
970
+ u.custom.length > 0 && /* @__PURE__ */ e(_e, { header: "自定义", children: /* @__PURE__ */ e(
971
+ $e,
972
972
  {
973
- dataSource: s.custom,
974
- renderItem: (g) => N(g, !1),
973
+ dataSource: u.custom,
974
+ renderItem: (g) => I(g, !1),
975
975
  locale: {
976
976
  emptyText: /* @__PURE__ */ e(
977
- ge,
977
+ pe,
978
978
  {
979
979
  description: "暂无物料",
980
- image: ge.PRESENTED_IMAGE_SIMPLE
980
+ image: pe.PRESENTED_IMAGE_SIMPLE
981
981
  }
982
982
  )
983
983
  }
@@ -986,9 +986,9 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (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(lt, { type: "secondary", className: "text-xs", children: n === "line-draw" ? /* @__PURE__ */ e(Re, { children: "💡 提示:点击绘制线段,可连续绘制多段线,双击结束绘制,ESC 取消" }) : /* @__PURE__ */ e(Re, { children: "💡 提示:拖拽物料到画布创建节点,点击线条物料进入绘制模式" }) }) })
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: "💡 提示:拖拽物料到画布创建节点,点击线条物料进入绘制模式" }) }) })
990
990
  ] });
991
- }, { Text: Et } = Lt, $n = (l, f) => {
991
+ }, { Text: Dt } = Pt, Yn = (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 Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1000
1000
  } catch (t) {
1001
1001
  return console.warn(`状态表达式执行失败 [${l.name}]:`, t), !1;
1002
1002
  }
1003
- }, Yn = (l, f) => {
1003
+ }, Xn = (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, $n(t, r))
1009
+ )) : r = f, Yn(t, r))
1010
1010
  return t;
1011
1011
  }
1012
- }, Ln = (l, f) => {
1012
+ }, Pn = (l, f) => {
1013
1013
  if (!f || !l)
1014
1014
  return { value: void 0 };
1015
1015
  if (Array.isArray(l)) {
@@ -1025,12 +1025,12 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1025
1025
  unit: l.unit
1026
1026
  };
1027
1027
  return { value: void 0 };
1028
- }, Xn = (l, f) => {
1028
+ }, Tn = (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
- }, Pn = (l, f, t, r) => {
1033
+ }, Rn = (l, f, t, r) => {
1034
1034
  switch (l.type) {
1035
1035
  case "IMAGE":
1036
1036
  const c = l, n = c.backgroundColor, a = c.fillColor;
@@ -1056,46 +1056,46 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1056
1056
  );
1057
1057
  case "TEXT":
1058
1058
  const p = l, {
1059
- label: u,
1059
+ label: d,
1060
1060
  value: m,
1061
1061
  valueSourceCode: S,
1062
- unit: s,
1063
- decimals: I,
1064
- labelStyle: b,
1065
- valueStyle: N,
1062
+ unit: u,
1063
+ decimals: k,
1064
+ labelStyle: v,
1065
+ valueStyle: I,
1066
1066
  customStyle: g
1067
- } = p.content || {}, { value: W, unit: O } = S ? Ln(f, S) : { value: void 0, unit: void 0 }, $ = Xn(W !== void 0 ? W : m, I), Y = s || O || "";
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 || "";
1068
1068
  return /* @__PURE__ */ h(
1069
1069
  "div",
1070
1070
  {
1071
1071
  className: "w-full h-full flex flex-col justify-center gap-1",
1072
1072
  style: { ...g },
1073
1073
  children: [
1074
- u && /* @__PURE__ */ e(
1075
- Et,
1074
+ d && /* @__PURE__ */ e(
1075
+ Dt,
1076
1076
  {
1077
1077
  style: {
1078
1078
  fontSize: 14,
1079
1079
  fontWeight: "bold",
1080
1080
  color: "#262626",
1081
1081
  textAlign: "left",
1082
- ...b
1082
+ ...v
1083
1083
  },
1084
- children: u
1084
+ children: d
1085
1085
  }
1086
1086
  ),
1087
1087
  $ && /* @__PURE__ */ h(
1088
- Et,
1088
+ Dt,
1089
1089
  {
1090
1090
  style: {
1091
1091
  fontSize: 14,
1092
1092
  color: "#1890ff",
1093
1093
  textAlign: "left",
1094
- ...N
1094
+ ...I
1095
1095
  },
1096
1096
  children: [
1097
1097
  $,
1098
- Y ? ` ${Y}` : ""
1098
+ L ? ` ${L}` : ""
1099
1099
  ]
1100
1100
  }
1101
1101
  )
@@ -1108,15 +1108,15 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1108
1108
  color: we = "#d9d9d9",
1109
1109
  dashed: ie = !1,
1110
1110
  lineType: A = ie ? "dashed" : "solid",
1111
- lineWeight: Z = ne,
1111
+ lineWeight: J = ne,
1112
1112
  // 起点和终点的相对坐标
1113
1113
  startX: G = 0,
1114
1114
  startY: T = 0,
1115
- endX: o = 100,
1115
+ endX: s = 100,
1116
1116
  endY: q = 0
1117
- } = xe.config || {}, L = ((Oe) => {
1118
- const j = Math.max(Z, 1);
1119
- switch (Oe) {
1117
+ } = xe.config || {}, Y = ((je) => {
1118
+ const j = Math.max(J, 1);
1119
+ switch (je) {
1120
1120
  case "solid":
1121
1121
  return "";
1122
1122
  case "dashed":
@@ -1146,10 +1146,10 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1146
1146
  {
1147
1147
  x1: G,
1148
1148
  y1: T,
1149
- x2: o,
1149
+ x2: s,
1150
1150
  y2: q,
1151
1151
  stroke: "transparent",
1152
- strokeWidth: Math.max(Z, 10),
1152
+ strokeWidth: Math.max(J, 10),
1153
1153
  strokeLinecap: "round",
1154
1154
  strokeLinejoin: "round",
1155
1155
  style: { pointerEvents: "stroke", cursor: "pointer" }
@@ -1160,11 +1160,11 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1160
1160
  {
1161
1161
  x1: G,
1162
1162
  y1: T,
1163
- x2: o,
1163
+ x2: s,
1164
1164
  y2: q,
1165
1165
  stroke: M,
1166
- strokeWidth: Z,
1167
- strokeDasharray: L,
1166
+ strokeWidth: J,
1167
+ strokeDasharray: Y,
1168
1168
  strokeLinecap: "round",
1169
1169
  strokeLinejoin: "round",
1170
1170
  style: { pointerEvents: "none" }
@@ -1179,7 +1179,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
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
- }, Tn = ({
1182
+ }, _n = ({
1183
1183
  node: l,
1184
1184
  isSelected: f = !1,
1185
1185
  onClick: t,
@@ -1188,17 +1188,17 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (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: u } = l, { statusList: m } = p, { isClickable: S, isDraggable: s, isResizable: I } = u, b = ue(t);
1192
- b.current = t;
1193
- const [N, g] = Q(null), W = ue(null), O = ue(null), X = ue(null), $ = ue(null), [Y, xe] = Q(null), [ne, we] = Q(null), ie = ue(null), A = Yt(() => {
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(() => {
1194
1194
  if (m.length === 0) return;
1195
- const C = Yn(m, c);
1195
+ const C = Xn(m, c);
1196
1196
  return C || m[0];
1197
- }, [m, c]), Z = A?.material, G = Z?.type === "LINE", T = G ? Z.config : null, o = i.scale ?? 1, q = (i.width || 100) * o, v = (i.height || 100) * o, L = V(() => {
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
1198
  const C = $.current?.closest('[data-canvas="true"]');
1199
1199
  if (!C) return a;
1200
- const z = C.getBoundingClientRect(), _ = parseFloat(C.style.width);
1201
- return _ ? z.width / _ : a;
1200
+ const z = C.getBoundingClientRect(), R = parseFloat(C.style.width);
1201
+ return R ? z.width / R : a;
1202
1202
  }, [a]), M = V((C, z) => {
1203
1203
  C.stopPropagation(), C.preventDefault(), W.current = {
1204
1204
  mouseX: C.clientX,
@@ -1211,40 +1211,40 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1211
1211
  nodeY: i.y || 0
1212
1212
  }, g(z);
1213
1213
  }, [T, i.x, i.y]);
1214
- ye(() => {
1215
- if (!N || !G || !T || !n) return;
1216
- const C = (_) => {
1214
+ me(() => {
1215
+ if (!I || !G || !T || !n) return;
1216
+ const C = (R) => {
1217
1217
  const D = W.current;
1218
1218
  if (!D || !$.current) return;
1219
- const he = L(), me = (_.clientX - D.mouseX) / he, ae = (_.clientY - D.mouseY) / he;
1220
- let J = D.startX, oe = D.startY, se = D.endX, ce = D.endY, Ye = D.nodeX, Le = D.nodeY;
1221
- N === "start" ? (J = D.startX + me, oe = D.startY + ae, J < 0 && (Ye = D.nodeX + J, se = D.endX - J, J = 0), oe < 0 && (Le = D.nodeY + oe, ce = D.endY - oe, oe = 0)) : (se = D.endX + me, ce = D.endY + ae, se < 0 && (Ye = D.nodeX + se, J = D.startX - se, se = 0), ce < 0 && (Le = D.nodeY + ce, oe = D.startY - ce, ce = 0));
1222
- const Qe = Math.max((T.lineWeight || 2) * 2, 4), et = Math.max(J, se), tt = Math.max(oe, ce), Ae = Math.max(et, Qe), Xe = Math.max(tt, Qe);
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
1223
  O.current = {
1224
- nodeX: Ye,
1225
- nodeY: Le,
1226
- width: Ae,
1227
- height: Xe,
1228
- startX: J,
1224
+ nodeX: Xe,
1225
+ nodeY: Pe,
1226
+ width: We,
1227
+ height: Te,
1228
+ startX: K,
1229
1229
  startY: oe,
1230
1230
  endX: se,
1231
1231
  endY: ce
1232
1232
  };
1233
- const fe = $.current;
1234
- fe.style.left = `${Ye}px`, fe.style.top = `${Le}px`, fe.style.width = `${Ae}px`, fe.style.height = `${Xe}px`, fe.querySelectorAll("svg line").forEach((y) => {
1235
- y.setAttribute("x1", String(J)), y.setAttribute("y1", String(oe)), y.setAttribute("x2", String(se)), y.setAttribute("y2", String(ce));
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));
1236
1236
  });
1237
- const je = fe.querySelector('[data-handle="start"]'), d = fe.querySelector('[data-handle="end"]');
1238
- je && (je.style.left = `${J - 6}px`, je.style.top = `${oe - 6}px`), d && (d.style.left = `${se - 6}px`, d.style.top = `${ce - 6}px`);
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
1239
  }, z = () => {
1240
- const _ = O.current;
1241
- _ && n(l.id, {
1240
+ const R = O.current;
1241
+ R && n(l.id, {
1242
1242
  normalStyle: {
1243
1243
  ...i,
1244
- x: _.nodeX,
1245
- y: _.nodeY,
1246
- width: _.width,
1247
- height: _.height
1244
+ x: R.nodeX,
1245
+ y: R.nodeY,
1246
+ width: R.width,
1247
+ height: R.height
1248
1248
  },
1249
1249
  contentInfo: {
1250
1250
  ...p,
@@ -1254,10 +1254,10 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1254
1254
  ...D.material,
1255
1255
  config: {
1256
1256
  ...T,
1257
- startX: _.startX,
1258
- startY: _.startY,
1259
- endX: _.endX,
1260
- endY: _.endY
1257
+ startX: R.startX,
1258
+ startY: R.startY,
1259
+ endX: R.endX,
1260
+ endY: R.endY
1261
1261
  }
1262
1262
  } : D.material
1263
1263
  }))
@@ -1267,45 +1267,45 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1267
1267
  return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1268
1268
  window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1269
1269
  };
1270
- }, [N, G, T, l.id, i, p, m, n, L]), ye(() => {
1271
- if (!Y || !n) return;
1272
- const C = (_) => {
1270
+ }, [I, G, T, l.id, i, p, m, n, Y]), me(() => {
1271
+ if (!L || !n) return;
1272
+ const C = (R) => {
1273
1273
  if (!$.current) return;
1274
- const D = L(), he = (_.clientX - Y.startX) / D, me = (_.clientY - Y.startY) / D;
1275
- let ae = Y.startWidth, J = Y.startHeight, oe = Y.startNodeX, se = Y.startNodeY;
1276
- switch (Y.corner) {
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) {
1277
1277
  case "se":
1278
- ae = Math.max(20, Y.startWidth + he), J = Math.max(20, Y.startHeight + me);
1278
+ ae = Math.max(20, L.startWidth + he), K = Math.max(20, L.startHeight + fe);
1279
1279
  break;
1280
1280
  case "sw":
1281
- ae = Math.max(20, Y.startWidth - he), J = Math.max(20, Y.startHeight + me), oe = Y.startNodeX + (Y.startWidth - ae);
1281
+ ae = Math.max(20, L.startWidth - he), K = Math.max(20, L.startHeight + fe), oe = L.startNodeX + (L.startWidth - ae);
1282
1282
  break;
1283
1283
  case "ne":
1284
- ae = Math.max(20, Y.startWidth + he), J = Math.max(20, Y.startHeight - me), se = Y.startNodeY + (Y.startHeight - J);
1284
+ ae = Math.max(20, L.startWidth + he), K = Math.max(20, L.startHeight - fe), se = L.startNodeY + (L.startHeight - K);
1285
1285
  break;
1286
1286
  case "nw":
1287
- ae = Math.max(20, Y.startWidth - he), J = Math.max(20, Y.startHeight - me), oe = Y.startNodeX + (Y.startWidth - ae), se = Y.startNodeY + (Y.startHeight - J);
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);
1288
1288
  break;
1289
1289
  }
1290
- X.current = { x: oe, y: se, width: ae, height: J };
1290
+ X.current = { x: oe, y: se, width: ae, height: K };
1291
1291
  const ce = $.current;
1292
- ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${J}px`;
1292
+ ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${K}px`;
1293
1293
  }, z = () => {
1294
- const _ = X.current;
1295
- _ && n(l.id, {
1294
+ const R = X.current;
1295
+ R && n(l.id, {
1296
1296
  normalStyle: {
1297
1297
  ...i,
1298
- x: _.x,
1299
- y: _.y,
1300
- width: _.width,
1301
- height: _.height
1298
+ x: R.x,
1299
+ y: R.y,
1300
+ width: R.width,
1301
+ height: R.height
1302
1302
  }
1303
1303
  }), xe(null), X.current = null;
1304
1304
  };
1305
1305
  return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1306
1306
  window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1307
1307
  };
1308
- }, [Y, n, l.id, i, L]);
1308
+ }, [L, n, l.id, i, Y]);
1309
1309
  const ee = V((C, z) => {
1310
1310
  C.stopPropagation(), C.preventDefault(), xe({
1311
1311
  corner: z,
@@ -1316,7 +1316,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1316
1316
  startNodeX: i.x || 0,
1317
1317
  startNodeY: i.y || 0
1318
1318
  });
1319
- }, [i.width, i.height, i.x, i.y]), Oe = V((C) => {
1319
+ }, [i.width, i.height, i.x, i.y]), je = V((C) => {
1320
1320
  C.stopPropagation(), C.preventDefault();
1321
1321
  const z = $.current?.getBoundingClientRect();
1322
1322
  z && we({
@@ -1327,21 +1327,21 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1327
1327
  centerY: z.top + z.height / 2
1328
1328
  });
1329
1329
  }, [i.rotate]);
1330
- ye(() => {
1330
+ me(() => {
1331
1331
  if (!ne) return;
1332
- const C = (_) => {
1333
- const D = _.clientX - ne.centerX, he = _.clientY - ne.centerY;
1332
+ const C = (R) => {
1333
+ const D = R.clientX - ne.centerX, he = R.clientY - ne.centerY;
1334
1334
  let ae = (Math.atan2(he, D) * (180 / Math.PI) + 90) % 360;
1335
1335
  if (ae < 0 && (ae += 360), ie.current = ae, $.current) {
1336
- const J = i.transform || "";
1337
- $.current.style.transform = `rotate(${ae}deg) ${J}`.trim();
1336
+ const K = i.transform || "";
1337
+ $.current.style.transform = `rotate(${ae}deg) ${K}`.trim();
1338
1338
  }
1339
1339
  }, z = () => {
1340
- const _ = ie.current ?? ne.startAngle;
1340
+ const R = ie.current ?? ne.startAngle;
1341
1341
  ie.current = null, n && n(l.id, {
1342
1342
  normalStyle: {
1343
1343
  ...i,
1344
- rotate: Math.round(_)
1344
+ rotate: Math.round(R)
1345
1345
  }
1346
1346
  }), we(null);
1347
1347
  };
@@ -1349,12 +1349,12 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1349
1349
  window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1350
1350
  };
1351
1351
  }, [ne, n, l.id, i]);
1352
- const j = l.type === "group", ot = {
1352
+ const j = l.type === "group", st = {
1353
1353
  position: "absolute",
1354
1354
  left: i.x || 0,
1355
1355
  top: i.y || 0,
1356
1356
  width: q,
1357
- height: v,
1357
+ height: b,
1358
1358
  // 群组节点不显示背景和边框,只作为容器
1359
1359
  background: j ? "transparent" : i.background || "transparent",
1360
1360
  backgroundImage: j ? void 0 : i.backgroundImage ? `url(${i.backgroundImage})` : void 0,
@@ -1372,27 +1372,27 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1372
1372
  transform: `rotate(${ie.current ?? (i.rotate || 0)}deg) ${i.transform || ""}`.trim(),
1373
1373
  transformOrigin: "center center",
1374
1374
  zIndex: f ? 1e3 : i.zIndex ?? 1,
1375
- cursor: s && !N ? "move" : S ? "pointer" : "default",
1375
+ cursor: u && !I ? "move" : S ? "pointer" : "default",
1376
1376
  boxSizing: "border-box",
1377
1377
  // 选中、线条和群组节点使用 visible overflow,避免裁剪手柄
1378
1378
  overflow: f || G || j ? "visible" : "hidden"
1379
- }, Je = T ? { x: T.startX || 0, y: T.startY || 0 } : { x: 0, y: 0 }, Ke = T ? { x: T.endX || 0, y: T.endY || 0 } : { x: 0, y: 0 };
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
1380
  return /* @__PURE__ */ h(
1381
1381
  "div",
1382
1382
  {
1383
1383
  ref: $,
1384
1384
  "data-node-id": l.id,
1385
- style: ot,
1385
+ style: st,
1386
1386
  onClick: (C) => {
1387
1387
  console.log("NodeRenderer onClick", l.id, "isClickable:", S);
1388
- const z = b.current;
1389
- S && z && !N && !Y && !ne && (C.stopPropagation(), z(C));
1388
+ const z = v.current;
1389
+ S && z && !I && !L && !ne && (C.stopPropagation(), z(C));
1390
1390
  },
1391
1391
  onMouseDown: (C) => {
1392
- s && r && !N && r(C);
1392
+ u && r && !I && r(C);
1393
1393
  },
1394
1394
  children: [
1395
- f && !G && !j && /* @__PURE__ */ h(Re, { children: [
1395
+ f && !G && !j && /* @__PURE__ */ h(Oe, { children: [
1396
1396
  /* @__PURE__ */ e(
1397
1397
  "div",
1398
1398
  {
@@ -1434,7 +1434,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1434
1434
  {
1435
1435
  className: "absolute top-0 left-1/2 w-4 h-4 bg-green-500 border-2 border-white rounded-full",
1436
1436
  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) => Oe(C),
1437
+ onMouseDown: (C) => je(C),
1438
1438
  title: "拖拽旋转"
1439
1439
  }
1440
1440
  ),
@@ -1451,15 +1451,15 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1451
1451
  A ? `(${A.name})` : ""
1452
1452
  ] })
1453
1453
  ] }),
1454
- f && G && T && n && /* @__PURE__ */ h(Re, { children: [
1454
+ f && G && T && n && /* @__PURE__ */ h(Oe, { children: [
1455
1455
  /* @__PURE__ */ e(
1456
1456
  "div",
1457
1457
  {
1458
1458
  "data-handle": "start",
1459
1459
  className: "absolute w-3 h-3 bg-blue-500 border-2 border-white rounded-full cursor-move z-50",
1460
1460
  style: {
1461
- left: Je.x - 6,
1462
- top: Je.y - 6,
1461
+ left: Ke.x - 6,
1462
+ top: Ke.y - 6,
1463
1463
  boxShadow: "0 0 4px rgba(0,0,0,0.3)"
1464
1464
  },
1465
1465
  onMouseDown: (C) => M(C, "start"),
@@ -1472,8 +1472,8 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1472
1472
  "data-handle": "end",
1473
1473
  className: "absolute w-3 h-3 bg-blue-500 border-2 border-white rounded-full cursor-move z-50",
1474
1474
  style: {
1475
- left: Ke.x - 6,
1476
- top: Ke.y - 6,
1475
+ left: Qe.x - 6,
1476
+ top: Qe.y - 6,
1477
1477
  boxShadow: "0 0 4px rgba(0,0,0,0.3)"
1478
1478
  },
1479
1479
  onMouseDown: (C) => M(C, "end"),
@@ -1482,12 +1482,12 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1482
1482
  ),
1483
1483
  /* @__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
1484
  ] }),
1485
- /* @__PURE__ */ e("div", { className: "w-full h-full relative", children: Z ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Pn(Z, c, f) }) : j ? null : (
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 : (
1486
1486
  // 只有非群组节点才显示"无状态"
1487
1487
  /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center text-gray-300 text-xs", children: "无状态" })
1488
1488
  ) }),
1489
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
- Wt,
1490
+ Ut,
1491
1491
  {
1492
1492
  node: C,
1493
1493
  isSelected: !1,
@@ -1499,10 +1499,10 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1499
1499
  ]
1500
1500
  }
1501
1501
  );
1502
- }, Wt = Ce.memo(Tn, (l, f) => {
1502
+ }, Ut = Ce.memo(_n, (l, f) => {
1503
1503
  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
1504
  return c && n && a;
1505
- }), _n = [
1505
+ }), zn = [
1506
1506
  "#1890ff",
1507
1507
  "#52c41a",
1508
1508
  "#faad14",
@@ -1519,22 +1519,22 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1519
1519
  "#000000",
1520
1520
  "#ff4d4f",
1521
1521
  "#73d13d"
1522
- ], ze = ({
1522
+ ], Ae = ({
1523
1523
  value: l = "#1890ff",
1524
1524
  onChange: f,
1525
1525
  onChangeComplete: t
1526
1526
  }) => {
1527
1527
  const [r, c] = Q(!1), [n, a] = Q(l), i = ue(null);
1528
- ye(() => {
1528
+ me(() => {
1529
1529
  a(l);
1530
- }, [l]), ye(() => {
1531
- const u = (m) => {
1530
+ }, [l]), me(() => {
1531
+ const d = (m) => {
1532
1532
  i.current && !i.current.contains(m.target) && (c(!1), t?.({ toHexString: () => n }));
1533
1533
  };
1534
- return r && document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
1534
+ return r && document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
1535
1535
  }, [r, t, n]);
1536
- const p = (u) => {
1537
- a(u), f?.({ toHexString: () => u });
1536
+ const p = (d) => {
1537
+ a(d), f?.({ toHexString: () => d });
1538
1538
  };
1539
1539
  return /* @__PURE__ */ h("div", { ref: i, style: { position: "relative", display: "inline-block" }, children: [
1540
1540
  /* @__PURE__ */ e(
@@ -1566,29 +1566,29 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1566
1566
  border: "1px solid #f0f0f0"
1567
1567
  },
1568
1568
  children: [
1569
- /* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: _n.map((u) => /* @__PURE__ */ e(
1569
+ /* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: zn.map((d) => /* @__PURE__ */ e(
1570
1570
  "div",
1571
1571
  {
1572
1572
  onClick: () => {
1573
- p(u), c(!1), t?.({ toHexString: () => u });
1573
+ p(d), c(!1), t?.({ toHexString: () => d });
1574
1574
  },
1575
1575
  style: {
1576
1576
  width: 20,
1577
1577
  height: 20,
1578
- backgroundColor: u,
1579
- border: n === u ? "2px solid #1890ff" : "1px solid #d9d9d9",
1578
+ backgroundColor: d,
1579
+ border: n === d ? "2px solid #1890ff" : "1px solid #d9d9d9",
1580
1580
  borderRadius: 2,
1581
1581
  cursor: "pointer"
1582
1582
  }
1583
1583
  },
1584
- u
1584
+ d
1585
1585
  )) }),
1586
1586
  /* @__PURE__ */ e(
1587
1587
  "input",
1588
1588
  {
1589
1589
  type: "color",
1590
1590
  value: n,
1591
- onChange: (u) => p(u.target.value),
1591
+ onChange: (d) => p(d.target.value),
1592
1592
  onBlur: () => t?.({ toHexString: () => n }),
1593
1593
  style: {
1594
1594
  width: "100%",
@@ -1603,43 +1603,43 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1603
1603
  }
1604
1604
  )
1605
1605
  ] });
1606
- }, { TextArea: Rn } = re, zn = ({ defaultTestData: l }) => {
1606
+ }, { TextArea: On } = re, An = ({ defaultTestData: l }) => {
1607
1607
  const f = ue(null), t = ue(null), r = ue(null), {
1608
1608
  nodes: c,
1609
1609
  selectedNodeId: n,
1610
1610
  mode: a,
1611
1611
  lineDrawing: i,
1612
1612
  viewport: p,
1613
- canvas: u,
1613
+ canvas: d,
1614
1614
  setViewport: m,
1615
1615
  setCanvasConfig: S,
1616
- addNode: s,
1617
- selectNode: I,
1618
- updateNode: b,
1619
- removeNode: N,
1616
+ addNode: u,
1617
+ selectNode: k,
1618
+ updateNode: v,
1619
+ removeNode: I,
1620
1620
  undo: g,
1621
1621
  redo: W,
1622
1622
  setMode: O,
1623
1623
  startLineDrawing: X,
1624
1624
  endLineDrawing: $,
1625
- cancelLineDrawing: Y
1626
- } = _e(), [xe, ne] = Q(!1), [, we] = Q({}), ie = ue(a);
1627
- ye(() => {
1625
+ cancelLineDrawing: L
1626
+ } = ze(), [xe, ne] = Q(!1), [, we] = Q({}), ie = ue(a);
1627
+ me(() => {
1628
1628
  ie.current = a;
1629
1629
  }, [a]);
1630
- const A = ue(!1), Z = ue({ x: 0, y: 0 }), G = ue({ x: 0, y: 0, newX: 0, newY: 0 }), T = ue(null), [o, q] = Q({ start: null, end: null, isDrawing: !1 }), [v, L] = Q({ start: null, end: null }), [M, ee] = Q([]);
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([]);
1631
1631
  ue(!1);
1632
- const [Oe, j] = Q(!1), [ot, Je] = Q(
1632
+ const [je, j] = Q(!1), [st, Ke] = Q(
1633
1633
  JSON.stringify(l, null, 2)
1634
- ), [Ke, C] = Q(!1), [z, _] = Q(!1), D = V((d, y) => {
1634
+ ), [Qe, C] = Q(!1), [z, R] = Q(!1), D = V((o, y) => {
1635
1635
  if (!t.current) return { x: 0, y: 0 };
1636
- const E = t.current.getBoundingClientRect(), k = d - E.left, x = y - E.top, P = E.width / u.width, F = E.height / u.height, U = k / P, B = x / F;
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
1637
  return { x: Math.round(U), y: Math.round(B) };
1638
- }, [u.width, u.height]), he = V((d, y) => D(d, y), [D]), me = V(
1639
- (d, y, E = !0) => {
1638
+ }, [d.width, d.height]), he = V((o, y) => D(o, y), [D]), fe = V(
1639
+ (o, y, N = !0) => {
1640
1640
  if (!i.material) return;
1641
- const k = i.material, x = k.config || {}, P = x.lineWeight || x.thickness || 2, F = Math.min(d.x, y.x), U = Math.min(d.y, y.y), B = Math.round(d.x - F), R = Math.round(d.y - U), le = Math.round(y.x - F), de = Math.round(y.y - U), ve = Math.max(P * 2, 4), Pe = Math.max(Math.abs(d.x - y.x), ve), ke = Math.max(Math.abs(d.y - y.y), ve), nt = {
1642
- ...k,
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,
1643
1643
  id: H(),
1644
1644
  config: {
1645
1645
  color: x.color,
@@ -1647,23 +1647,23 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1647
1647
  thickness: P,
1648
1648
  lineType: x.lineType,
1649
1649
  startX: B,
1650
- startY: R,
1650
+ startY: _,
1651
1651
  endX: le,
1652
1652
  endY: de
1653
1653
  }
1654
- }, Ut = {
1654
+ }, Gt = {
1655
1655
  id: H(),
1656
- name: `${k.name}_${Date.now()}`,
1656
+ name: `${E.name}_${Date.now()}`,
1657
1657
  type: "normal",
1658
1658
  normalStyle: {
1659
- width: Pe,
1659
+ width: Re,
1660
1660
  height: ke,
1661
1661
  x: F,
1662
1662
  y: U,
1663
1663
  background: "transparent"
1664
1664
  },
1665
1665
  contentInfo: {
1666
- statusList: [jt(nt)],
1666
+ statusList: [Ft(lt)],
1667
1667
  currentStatusId: void 0
1668
1668
  },
1669
1669
  controlInfo: {
@@ -1673,101 +1673,101 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1673
1673
  isSelectable: !0
1674
1674
  }
1675
1675
  };
1676
- if (s(Ut, !1), E) {
1677
- const gt = { x: y.x, y: y.y };
1676
+ if (u(Gt, !1), N) {
1677
+ const yt = { x: y.x, y: y.y };
1678
1678
  q({
1679
- start: gt,
1680
- end: { ...gt },
1679
+ start: yt,
1680
+ end: { ...yt },
1681
1681
  isDrawing: !0
1682
1682
  });
1683
1683
  } else
1684
1684
  q({ start: null, end: null, isDrawing: !1 }), $();
1685
1685
  },
1686
- [i.material, s, $]
1686
+ [i.material, u, $]
1687
1687
  ), ae = V(() => {
1688
- const d = f.current?.state;
1689
- d && m({
1690
- scale: d.scale,
1691
- positionX: d.positionX,
1692
- positionY: d.positionY
1688
+ const o = f.current?.state;
1689
+ o && m({
1690
+ scale: o.scale,
1691
+ positionX: o.positionX,
1692
+ positionY: o.positionY
1693
1693
  });
1694
- }, [m]), J = V(
1695
- (d) => {
1696
- A.current || a !== "box-select" && (d.target === t.current || d.target.dataset?.canvas === "true") && (I(null), ee([]));
1694
+ }, [m]), K = V(
1695
+ (o) => {
1696
+ A.current || a !== "box-select" && (o.target === t.current || o.target.dataset?.canvas === "true") && (k(null), ee([]));
1697
1697
  },
1698
- [I, a]
1698
+ [k, a]
1699
1699
  ), oe = V(
1700
- (d) => {
1701
- if (d.button === 0) {
1700
+ (o) => {
1701
+ if (o.button === 0) {
1702
1702
  if (a === "line-draw" && i.material) {
1703
- d.stopPropagation();
1704
- const y = D(d.clientX, d.clientY);
1705
- o.isDrawing ? o.start && me(o.start, y, !0) : q({ start: y, end: y, isDrawing: !0 });
1703
+ 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 });
1706
1706
  return;
1707
1707
  }
1708
1708
  if (a === "box-select" && !z) {
1709
- const y = he(d.clientX, d.clientY);
1710
- L({ start: y, end: y }), ee([]), d.preventDefault(), d.stopPropagation();
1709
+ const y = he(o.clientX, o.clientY);
1710
+ Y({ start: y, end: y }), ee([]), o.preventDefault(), o.stopPropagation();
1711
1711
  }
1712
1712
  }
1713
1713
  },
1714
- [a, i.material, o.isDrawing, o.start, z, me, D, he]
1714
+ [a, i.material, s.isDrawing, s.start, z, fe, D, he]
1715
1715
  ), se = V(
1716
- (d) => {
1717
- if (!(a !== "line-draw" || !i.material) && o.isDrawing && o.start) {
1718
- const y = D(d.clientX, d.clientY);
1719
- me(o.start, y, !1);
1716
+ (o) => {
1717
+ if (!(a !== "line-draw" || !i.material) && s.isDrawing && s.start) {
1718
+ const y = D(o.clientX, o.clientY);
1719
+ fe(s.start, y, !1);
1720
1720
  }
1721
1721
  },
1722
- [a, i.material, o.isDrawing, o.start, me, D]
1723
- ), ce = V((d) => {
1724
- d.preventDefault(), d.dataTransfer.dropEffect = "copy", ne(!0);
1725
- }, []), Ye = V((d) => {
1726
- d.preventDefault(), ne(!1);
1727
- }, []), Le = V(
1728
- (d) => {
1729
- if (d.preventDefault(), ne(!1), !(!t.current || a !== "select"))
1722
+ [a, i.material, s.isDrawing, s.start, fe, D]
1723
+ ), ce = V((o) => {
1724
+ o.preventDefault(), o.dataTransfer.dropEffect = "copy", ne(!0);
1725
+ }, []), Xe = V((o) => {
1726
+ o.preventDefault(), ne(!1);
1727
+ }, []), Pe = V(
1728
+ (o) => {
1729
+ if (o.preventDefault(), ne(!1), !(!t.current || a !== "select"))
1730
1730
  try {
1731
- const y = d.dataTransfer.getData("application/json");
1731
+ const y = o.dataTransfer.getData("application/json");
1732
1732
  if (!y) return;
1733
- const E = JSON.parse(y), k = D(d.clientX, d.clientY), x = k.x - 50, P = k.y - 50, F = Mn(x, P, E);
1734
- s(F);
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
1735
  } catch (y) {
1736
1736
  console.error("Failed to parse dropped material:", y);
1737
1737
  }
1738
1738
  },
1739
- [a, s, D]
1740
- ), Qe = V(
1741
- (d, y) => {
1742
- a !== "select" && a !== "box-select" || !y.controlInfo.isDraggable || (d.stopPropagation(), I(y.id), A.current = !0, Z.current = { x: d.clientX, y: d.clientY }, G.current = {
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
1743
  x: y.normalStyle.x || 0,
1744
1744
  y: y.normalStyle.y || 0,
1745
1745
  newX: y.normalStyle.x || 0,
1746
1746
  newY: y.normalStyle.y || 0
1747
- }, T.current = y, d.preventDefault());
1747
+ }, T.current = y, o.preventDefault());
1748
1748
  },
1749
- [a, I]
1749
+ [a, k]
1750
1750
  );
1751
- ye(() => {
1752
- const d = (x) => {
1751
+ me(() => {
1752
+ const o = (x) => {
1753
1753
  if (A.current && n && T.current) {
1754
1754
  if (!t.current) return;
1755
- const P = t.current.getBoundingClientRect(), F = P.width / u.width, U = P.height / u.height, B = x.clientX - Z.current.x, R = x.clientY - Z.current.y, le = B / F, de = R / U, ve = G.current.x + le, Pe = G.current.y + de, ke = document.querySelector(
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(
1756
1756
  `[data-node-id="${n}"]`
1757
1757
  );
1758
- ke && (ke.style.left = `${ve}px`, ke.style.top = `${Pe}px`), G.current.newX = ve, G.current.newY = Pe;
1758
+ ke && (ke.style.left = `${ve}px`, ke.style.top = `${Re}px`), G.current.newX = ve, G.current.newY = Re;
1759
1759
  }
1760
- if (a === "box-select" && v.start) {
1760
+ if (a === "box-select" && b.start) {
1761
1761
  const P = he(x.clientX, x.clientY);
1762
- L((F) => ({ ...F, end: P }));
1762
+ Y((F) => ({ ...F, end: P }));
1763
1763
  }
1764
- if (a === "line-draw" && o.isDrawing) {
1764
+ if (a === "line-draw" && s.isDrawing) {
1765
1765
  const P = D(x.clientX, x.clientY);
1766
1766
  q((F) => ({ ...F, end: P }));
1767
1767
  }
1768
1768
  }, y = () => {
1769
1769
  if (A.current && n && T.current) {
1770
- const x = _e.getState(), P = G.current.newX ?? G.current.x, F = G.current.newY ?? G.current.y;
1770
+ const x = ze.getState(), P = G.current.newX ?? G.current.x, F = G.current.newY ?? G.current.y;
1771
1771
  x.updateNode(n, {
1772
1772
  normalStyle: {
1773
1773
  ...T.current.normalStyle,
@@ -1776,88 +1776,88 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1776
1776
  }
1777
1777
  });
1778
1778
  }
1779
- if (A.current = !1, T.current = null, we({}), a === "box-select" && v.start && v.end) {
1780
- const x = Math.min(v.start.x, v.end.x), P = Math.max(v.start.x, v.end.x), F = Math.min(v.start.y, v.end.y), U = Math.max(v.start.y, v.end.y), B = c.filter((R) => {
1781
- const le = R.normalStyle.x || 0, de = R.normalStyle.y || 0, ve = R.normalStyle.width || 0, Pe = R.normalStyle.height || 0, ke = le + ve / 2, nt = de + Pe / 2;
1782
- return ke >= x && ke <= P && nt >= F && nt <= U;
1783
- }).map((R) => R.id);
1784
- ee(B), L({ start: null, end: null });
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 });
1785
1785
  }
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));
1786
1788
  }, E = (x) => {
1787
- x.key === "Escape" && a === "line-draw" && (q({ start: null, end: null, isDrawing: !1 }), Y()), x.key === "Delete" && (n ? N(n) : M.length > 0 && (M.forEach((P) => N(P)), ee([]))), x.ctrlKey && x.key === "z" && (x.preventDefault(), g()), x.ctrlKey && x.key === "y" && (x.preventDefault(), W()), x.key === " " && !z && (x.preventDefault(), _(!0));
1788
- }, k = (x) => {
1789
- x.key === " " && z && _(!1);
1789
+ x.key === " " && z && R(!1);
1790
1790
  };
1791
- return window.addEventListener("mousemove", d), window.addEventListener("mouseup", y), window.addEventListener("keydown", E), window.addEventListener("keyup", k), () => {
1792
- window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", y), window.removeEventListener("keydown", E), window.removeEventListener("keyup", k);
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);
1793
1793
  };
1794
1794
  }, [
1795
1795
  n,
1796
- v,
1796
+ b,
1797
1797
  a,
1798
- o.isDrawing,
1798
+ s.isDrawing,
1799
1799
  M,
1800
1800
  c,
1801
- u.width,
1802
- u.height,
1803
- N,
1801
+ d.width,
1802
+ d.height,
1803
+ I,
1804
1804
  g,
1805
1805
  z,
1806
1806
  W,
1807
- Y,
1807
+ L,
1808
1808
  D,
1809
1809
  he,
1810
1810
  ee
1811
1811
  ]);
1812
- const et = V(() => {
1813
- const d = M.length > 0 ? M.map((E) => c.find((k) => k.id === E)).filter(Boolean) : n ? [c.find((E) => E.id === n)].filter(Boolean) : [];
1814
- if (d.length === 0) return;
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) : [];
1814
+ if (o.length === 0) return;
1815
1815
  const y = [];
1816
- d.forEach((E) => {
1817
- const k = {
1818
- ...E,
1816
+ o.forEach((N) => {
1817
+ const E = {
1818
+ ...N,
1819
1819
  id: H(),
1820
- name: `${E.name}_副本`,
1820
+ name: `${N.name}_副本`,
1821
1821
  normalStyle: {
1822
- ...E.normalStyle,
1823
- x: (E.normalStyle.x || 0) + 20,
1824
- y: (E.normalStyle.y || 0) + 20
1822
+ ...N.normalStyle,
1823
+ x: (N.normalStyle.x || 0) + 20,
1824
+ y: (N.normalStyle.y || 0) + 20
1825
1825
  }
1826
1826
  };
1827
- s(k), y.push(k.id);
1828
- }), y.length === 1 ? I(y[0]) : ee(y);
1829
- }, [n, M, c, s, I, ee]), tt = V(() => {
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
1830
  if (M.length < 2) return;
1831
- const d = [];
1831
+ const o = [];
1832
1832
  for (let U = 0; U < M.length; U++) {
1833
- const B = M[U], R = c.find((le) => le.id === B);
1834
- if (R) {
1835
- if (R?.type === "group") {
1836
- R.children.forEach((de) => d.push({
1833
+ const B = M[U], _ = c.find((le) => le.id === B);
1834
+ if (_) {
1835
+ if (_?.type === "group") {
1836
+ _.children.forEach((de) => o.push({
1837
1837
  ...de,
1838
1838
  normalStyle: {
1839
1839
  ...de.normalStyle,
1840
- x: (R.normalStyle.x || 0) + (de.normalStyle.x || 0),
1841
- y: (R.normalStyle.y || 0) + (de.normalStyle.y || 0)
1840
+ x: (_.normalStyle.x || 0) + (de.normalStyle.x || 0),
1841
+ y: (_.normalStyle.y || 0) + (de.normalStyle.y || 0)
1842
1842
  }
1843
- })), N(B);
1843
+ })), I(B);
1844
1844
  continue;
1845
1845
  }
1846
- d.push(R);
1846
+ o.push(_);
1847
1847
  }
1848
1848
  }
1849
- if (d.length < 2) return;
1850
- let y = 1 / 0, E = 1 / 0, k = -1 / 0, x = -1 / 0;
1851
- d.forEach((U) => {
1852
- const B = U.normalStyle.x || 0, R = U.normalStyle.y || 0, le = U.normalStyle.width || 0, de = U.normalStyle.height || 0;
1853
- y = Math.min(y, B), E = Math.min(E, R), k = Math.max(k, B + le), x = Math.max(x, R + de);
1849
+ 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
1854
  });
1855
- const P = d.map((U) => ({
1855
+ const P = o.map((U) => ({
1856
1856
  ...U,
1857
1857
  normalStyle: {
1858
1858
  ...U.normalStyle,
1859
1859
  x: (U.normalStyle.x || 0) - y,
1860
- y: (U.normalStyle.y || 0) - E
1860
+ y: (U.normalStyle.y || 0) - N
1861
1861
  }
1862
1862
  })), F = {
1863
1863
  id: H(),
@@ -1865,9 +1865,9 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1865
1865
  type: "group",
1866
1866
  normalStyle: {
1867
1867
  x: y,
1868
- y: E,
1869
- width: k - y,
1870
- height: x - E,
1868
+ y: N,
1869
+ width: E - y,
1870
+ height: x - N,
1871
1871
  background: "transparent"
1872
1872
  },
1873
1873
  contentInfo: {
@@ -1882,89 +1882,89 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1882
1882
  },
1883
1883
  children: P
1884
1884
  };
1885
- M.forEach((U) => N(U)), s(F), ee([]), I(F.id);
1886
- }, [M, c, N, s, I]), Ae = V(() => {
1887
- const d = M.length > 0 ? M.map((y) => c.find((E) => E.id === y)).filter((y) => !!y && y.type === "group") : n ? [c.find((y) => y.id === n)].filter((y) => !!y && y.type === "group") : [];
1888
- d.length !== 0 && (d.forEach((y) => {
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
1889
  if (!y.children || y.children.length === 0) return;
1890
- const E = y.children.map((k) => ({
1891
- ...k,
1890
+ const N = y.children.map((E) => ({
1891
+ ...E,
1892
1892
  normalStyle: {
1893
- ...k.normalStyle,
1894
- x: (y.normalStyle.x || 0) + (k.normalStyle.x || 0),
1895
- y: (y.normalStyle.y || 0) + (k.normalStyle.y || 0)
1893
+ ...E.normalStyle,
1894
+ x: (y.normalStyle.x || 0) + (E.normalStyle.x || 0),
1895
+ y: (y.normalStyle.y || 0) + (E.normalStyle.y || 0)
1896
1896
  }
1897
1897
  }));
1898
- N(y.id), E.forEach((k) => s(k));
1899
- }), ee([]), I(null));
1900
- }, [n, M, c, N, s, I, ee]), Xe = V(
1901
- (d) => {
1898
+ I(y.id), N.forEach((E) => u(E));
1899
+ }), ee([]), k(null));
1900
+ }, [n, M, c, I, u, k, ee]), Te = V(
1901
+ (o) => {
1902
1902
  if (M.length < 2) return;
1903
- const y = M.map((B) => c.find((R) => R.id === B)).filter((B) => !!B && B.type !== "group");
1903
+ const y = M.map((B) => c.find((_) => _.id === B)).filter((B) => !!B && B.type !== "group");
1904
1904
  if (y.length < 2) return;
1905
- let E = 1 / 0, k = -1 / 0, x = 1 / 0, P = -1 / 0;
1905
+ let N = 1 / 0, E = -1 / 0, x = 1 / 0, P = -1 / 0;
1906
1906
  y.forEach((B) => {
1907
- const R = B.normalStyle.x || 0, le = B.normalStyle.y || 0;
1908
- E = Math.min(E, R), k = Math.max(k, R), x = Math.min(x, le), P = Math.max(P, le);
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);
1909
1909
  });
1910
- const F = [...y].sort((B, R) => d === "horizontal" ? (B.normalStyle.x || 0) - (R.normalStyle.x || 0) : (B.normalStyle.y || 0) - (R.normalStyle.y || 0)), U = F.length;
1911
- if (d === "horizontal") {
1912
- const R = (k - E) / (U - 1);
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;
1911
+ if (o === "horizontal") {
1912
+ const _ = (E - N) / (U - 1);
1913
1913
  F.forEach((le, de) => {
1914
- const ve = E + R * de;
1915
- b(le.id, {
1914
+ const ve = N + _ * de;
1915
+ v(le.id, {
1916
1916
  normalStyle: { ...le.normalStyle, x: ve }
1917
1917
  });
1918
1918
  });
1919
1919
  } else {
1920
- const R = (P - x) / (U - 1);
1920
+ const _ = (P - x) / (U - 1);
1921
1921
  F.forEach((le, de) => {
1922
- const ve = x + R * de;
1923
- b(le.id, {
1922
+ const ve = x + _ * de;
1923
+ v(le.id, {
1924
1924
  normalStyle: { ...le.normalStyle, y: ve }
1925
1925
  });
1926
1926
  });
1927
1927
  }
1928
1928
  },
1929
- [M, c, b]
1930
- ), fe = V(
1931
- (d) => {
1929
+ [M, c, v]
1930
+ ), ge = V(
1931
+ (o) => {
1932
1932
  if (M.length < 2) return;
1933
- const y = _e.getState(), E = M.map((x) => c.find((P) => P.id === x)).filter((x) => !!x && x.type !== "group");
1934
- if (E.length < 2) return;
1935
- let k = 0;
1936
- switch (d) {
1933
+ const y = ze.getState(), N = M.map((x) => c.find((P) => P.id === x)).filter((x) => !!x && x.type !== "group");
1934
+ if (N.length < 2) return;
1935
+ let E = 0;
1936
+ switch (o) {
1937
1937
  case "left":
1938
- k = Math.min(...E.map((x) => x.normalStyle.x || 0));
1938
+ E = Math.min(...N.map((x) => x.normalStyle.x || 0));
1939
1939
  break;
1940
1940
  case "right":
1941
- k = Math.max(
1942
- ...E.map((x) => (x.normalStyle.x || 0) + (x.normalStyle.width || 0))
1941
+ E = Math.max(
1942
+ ...N.map((x) => (x.normalStyle.x || 0) + (x.normalStyle.width || 0))
1943
1943
  );
1944
1944
  break;
1945
1945
  case "top":
1946
- k = Math.min(...E.map((x) => x.normalStyle.y || 0));
1946
+ E = Math.min(...N.map((x) => x.normalStyle.y || 0));
1947
1947
  break;
1948
1948
  case "bottom":
1949
- k = Math.max(
1950
- ...E.map((x) => (x.normalStyle.y || 0) + (x.normalStyle.height || 0))
1949
+ E = Math.max(
1950
+ ...N.map((x) => (x.normalStyle.y || 0) + (x.normalStyle.height || 0))
1951
1951
  );
1952
1952
  break;
1953
1953
  }
1954
- E.forEach((x) => {
1954
+ N.forEach((x) => {
1955
1955
  let P = x.normalStyle.x || 0, F = x.normalStyle.y || 0;
1956
- switch (d) {
1956
+ switch (o) {
1957
1957
  case "left":
1958
- P = k;
1958
+ P = E;
1959
1959
  break;
1960
1960
  case "right":
1961
- P = k - (x.normalStyle.width || 0);
1961
+ P = E - (x.normalStyle.width || 0);
1962
1962
  break;
1963
1963
  case "top":
1964
- F = k;
1964
+ F = E;
1965
1965
  break;
1966
1966
  case "bottom":
1967
- F = k - (x.normalStyle.height || 0);
1967
+ F = E - (x.normalStyle.height || 0);
1968
1968
  break;
1969
1969
  }
1970
1970
  y.updateNode(x.id, {
@@ -1973,9 +1973,9 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1973
1973
  });
1974
1974
  },
1975
1975
  [M, c]
1976
- ), ft = [
1976
+ ), pt = [
1977
1977
  {
1978
- icon: /* @__PURE__ */ e(sn, {}),
1978
+ icon: /* @__PURE__ */ e(dn, {}),
1979
1979
  title: "选择模式",
1980
1980
  active: a === "select",
1981
1981
  onClick: () => {
@@ -1983,7 +1983,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1983
1983
  }
1984
1984
  },
1985
1985
  {
1986
- icon: /* @__PURE__ */ e(pt, {}),
1986
+ icon: /* @__PURE__ */ e(vt, {}),
1987
1987
  title: "框选模式",
1988
1988
  active: a === "box-select",
1989
1989
  onClick: () => {
@@ -1991,7 +1991,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1991
1991
  }
1992
1992
  },
1993
1993
  {
1994
- icon: /* @__PURE__ */ e(cn, {}),
1994
+ icon: /* @__PURE__ */ e(un, {}),
1995
1995
  title: "拖拽模式",
1996
1996
  active: a === "drag",
1997
1997
  onClick: () => {
@@ -1999,7 +1999,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
1999
1999
  }
2000
2000
  },
2001
2001
  {
2002
- icon: /* @__PURE__ */ e(ht, {}),
2002
+ icon: /* @__PURE__ */ e(ft, {}),
2003
2003
  title: "线条绘制",
2004
2004
  active: a === "line-draw",
2005
2005
  onClick: () => {
@@ -2007,88 +2007,88 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2007
2007
  }
2008
2008
  },
2009
2009
  {
2010
- icon: /* @__PURE__ */ e(dn, {}),
2010
+ icon: /* @__PURE__ */ e(hn, {}),
2011
2011
  title: "预览模式",
2012
2012
  active: a === "preview",
2013
2013
  onClick: () => {
2014
2014
  O("preview");
2015
2015
  }
2016
2016
  }
2017
- ], je = Yt(
2017
+ ], Fe = Xt(
2018
2018
  () => [
2019
- { icon: /* @__PURE__ */ e(Bt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2020
- { icon: /* @__PURE__ */ e(Vt, {}), title: "重做 (Ctrl+Y)", onClick: W },
2019
+ { icon: /* @__PURE__ */ e(Vt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2020
+ { icon: /* @__PURE__ */ e(Zt, {}), title: "重做 (Ctrl+Y)", onClick: W },
2021
2021
  {
2022
- icon: /* @__PURE__ */ e(Tt, {}),
2022
+ icon: /* @__PURE__ */ e(_t, {}),
2023
2023
  title: "复制节点",
2024
2024
  disabled: !n && M.length === 0,
2025
- onClick: et
2025
+ onClick: tt
2026
2026
  },
2027
2027
  {
2028
- icon: /* @__PURE__ */ e(pt, {}),
2028
+ icon: /* @__PURE__ */ e(vt, {}),
2029
2029
  title: "组合选中节点",
2030
2030
  disabled: M.length < 2,
2031
- onClick: tt
2031
+ onClick: nt
2032
2032
  },
2033
2033
  {
2034
- icon: /* @__PURE__ */ e(Zt, {}),
2034
+ icon: /* @__PURE__ */ e(Jt, {}),
2035
2035
  title: "解除组合",
2036
2036
  disabled: !n && M.length === 0,
2037
- onClick: Ae
2037
+ onClick: We
2038
2038
  },
2039
2039
  {
2040
- icon: /* @__PURE__ */ e(Jt, {}),
2040
+ icon: /* @__PURE__ */ e(Kt, {}),
2041
2041
  title: "左对齐",
2042
2042
  disabled: M.length < 2,
2043
- onClick: () => fe("left")
2043
+ onClick: () => ge("left")
2044
2044
  },
2045
2045
  {
2046
- icon: /* @__PURE__ */ e(Kt, {}),
2046
+ icon: /* @__PURE__ */ e(Qt, {}),
2047
2047
  title: "右对齐",
2048
2048
  disabled: M.length < 2,
2049
- onClick: () => fe("right")
2049
+ onClick: () => ge("right")
2050
2050
  },
2051
2051
  {
2052
- icon: /* @__PURE__ */ e(Qt, {}),
2052
+ icon: /* @__PURE__ */ e(en, {}),
2053
2053
  title: "上对齐",
2054
2054
  disabled: M.length < 2,
2055
- onClick: () => fe("top")
2055
+ onClick: () => ge("top")
2056
2056
  },
2057
2057
  {
2058
- icon: /* @__PURE__ */ e(en, {}),
2058
+ icon: /* @__PURE__ */ e(tn, {}),
2059
2059
  title: "下对齐",
2060
2060
  disabled: M.length < 2,
2061
- onClick: () => fe("bottom")
2061
+ onClick: () => ge("bottom")
2062
2062
  },
2063
2063
  {
2064
- icon: /* @__PURE__ */ e(tn, {}),
2064
+ icon: /* @__PURE__ */ e(nn, {}),
2065
2065
  title: "水平分布",
2066
2066
  disabled: M.length < 2,
2067
- onClick: () => Xe("horizontal")
2067
+ onClick: () => Te("horizontal")
2068
2068
  },
2069
2069
  {
2070
- icon: /* @__PURE__ */ e(nn, {}),
2070
+ icon: /* @__PURE__ */ e(ln, {}),
2071
2071
  title: "垂直分布",
2072
2072
  disabled: M.length < 2,
2073
- onClick: () => Xe("vertical")
2073
+ onClick: () => Te("vertical")
2074
2074
  },
2075
2075
  {
2076
- icon: /* @__PURE__ */ e(ln, {}),
2076
+ icon: /* @__PURE__ */ e(rn, {}),
2077
2077
  title: "画布配置",
2078
2078
  onClick: () => C(!0)
2079
2079
  },
2080
2080
  {
2081
- icon: /* @__PURE__ */ e(rn, {}),
2081
+ icon: /* @__PURE__ */ e(an, {}),
2082
2082
  title: "数据模拟",
2083
2083
  type: "primary",
2084
2084
  onClick: () => j(!0)
2085
2085
  },
2086
2086
  {
2087
- icon: /* @__PURE__ */ e(it, {}),
2087
+ icon: /* @__PURE__ */ e(ot, {}),
2088
2088
  title: "删除选中 (Delete)",
2089
2089
  disabled: !n && M.length === 0,
2090
2090
  onClick: () => {
2091
- n ? N(n) : M.length > 0 && (M.forEach((d) => N(d)), ee([]));
2091
+ n ? I(n) : M.length > 0 && (M.forEach((o) => I(o)), ee([]));
2092
2092
  }
2093
2093
  }
2094
2094
  ],
@@ -2099,39 +2099,54 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2099
2099
  O,
2100
2100
  ee,
2101
2101
  M,
2102
+ nt,
2103
+ We,
2102
2104
  tt,
2103
- Ae,
2104
- et,
2105
- fe,
2106
- Xe,
2105
+ ge,
2106
+ Te,
2107
2107
  C,
2108
2108
  j,
2109
2109
  n,
2110
- N
2110
+ I
2111
2111
  ]
2112
+ ), De = V(
2113
+ (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, {
2116
+ normalStyle: {
2117
+ ...N.normalStyle,
2118
+ x: (N.normalStyle.x || 0) - 2 * (o.key === "ArrowLeft" ? 1 : o.key === "ArrowRight" ? -1 : 0),
2119
+ y: (N.normalStyle.y || 0) - 2 * (o.key === "ArrowUp" ? 1 : o.key === "ArrowDown" ? -1 : 0)
2120
+ }
2121
+ });
2122
+ });
2123
+ },
2124
+ [M, c, v]
2112
2125
  );
2113
- return /* @__PURE__ */ h("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
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: [
2114
2129
  /* @__PURE__ */ h("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
2115
- /* @__PURE__ */ e(be, { children: ft.map((d) => /* @__PURE__ */ e($e, { title: d.title, children: /* @__PURE__ */ e(
2116
- K,
2130
+ /* @__PURE__ */ e(be, { children: pt.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2131
+ Z,
2117
2132
  {
2118
- type: d.active ? "primary" : "default",
2119
- icon: d.icon,
2120
- onClick: d.onClick
2133
+ type: o.active ? "primary" : "default",
2134
+ icon: o.icon,
2135
+ onClick: o.onClick
2121
2136
  }
2122
- ) }, d.title)) }),
2123
- /* @__PURE__ */ e(be, { children: je.map((d) => /* @__PURE__ */ e($e, { title: d.title, children: /* @__PURE__ */ e(
2124
- K,
2137
+ ) }, o.title)) }),
2138
+ /* @__PURE__ */ e(be, { children: Fe.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2139
+ Z,
2125
2140
  {
2126
- type: d.active ? "primary" : d.type || "default",
2127
- icon: d.icon,
2128
- onClick: d.onClick,
2129
- disabled: d.disabled
2141
+ type: o.active ? "primary" : o.type || "default",
2142
+ icon: o.icon,
2143
+ onClick: o.onClick,
2144
+ disabled: o.disabled
2130
2145
  }
2131
- ) }, d.title)) })
2146
+ ) }, o.title)) })
2132
2147
  ] }),
2133
2148
  /* @__PURE__ */ e("div", { ref: r, className: "flex-1 relative", children: /* @__PURE__ */ e(
2134
- fn,
2149
+ pn,
2135
2150
  {
2136
2151
  ref: f,
2137
2152
  initialScale: 1,
@@ -2146,18 +2161,18 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2146
2161
  wheel: { disabled: !1, step: 0.1 },
2147
2162
  pinch: { disabled: !1 },
2148
2163
  doubleClick: { disabled: !0 },
2149
- children: ({ zoomIn: d, zoomOut: y, resetTransform: E }) => /* @__PURE__ */ h(Re, { children: [
2164
+ children: ({ zoomIn: o, zoomOut: y, resetTransform: N }) => /* @__PURE__ */ h(Oe, { children: [
2150
2165
  /* @__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: [
2151
- /* @__PURE__ */ e($e, { title: "放大", children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(an, {}), onClick: () => d() }) }),
2152
- /* @__PURE__ */ e($e, { title: "缩小", children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(on, {}), onClick: () => y() }) }),
2153
- /* @__PURE__ */ e($e, { title: "重置视图", children: /* @__PURE__ */ e(K, { onClick: () => E(), children: "100%" }) }),
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%" }) }),
2154
2169
  /* @__PURE__ */ h("div", { className: "text-center text-xs text-gray-500", children: [
2155
2170
  Math.round(p.scale * 100),
2156
2171
  "%"
2157
2172
  ] })
2158
2173
  ] }) }),
2159
2174
  /* @__PURE__ */ e(
2160
- gn,
2175
+ yn,
2161
2176
  {
2162
2177
  wrapperStyle: { width: "100%", height: "100%", position: "relative" },
2163
2178
  contentStyle: {
@@ -2174,47 +2189,47 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2174
2189
  "data-canvas": "true",
2175
2190
  className: `relative ${xe ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""} ${z ? "cursor-grab" : ""}`,
2176
2191
  style: {
2177
- width: u.width,
2178
- height: u.height,
2192
+ width: d.width,
2193
+ height: d.height,
2179
2194
  flexShrink: 0,
2180
- backgroundColor: u.background,
2181
- backgroundImage: u.backgroundImage ? `url(${u.backgroundImage})` : void 0,
2195
+ backgroundColor: d.background,
2196
+ backgroundImage: d.backgroundImage ? `url(${d.backgroundImage})` : void 0,
2182
2197
  backgroundSize: "cover",
2183
2198
  backgroundPosition: "center"
2184
2199
  },
2185
- onClick: J,
2200
+ onClick: K,
2186
2201
  onMouseDown: oe,
2187
2202
  onDoubleClick: se,
2188
2203
  onDragOver: ce,
2189
- onDragLeave: Ye,
2190
- onDrop: Le,
2204
+ onDragLeave: Xe,
2205
+ onDrop: Pe,
2191
2206
  children: [
2192
- u.showGrid !== !1 && /* @__PURE__ */ h("svg", { className: "absolute top-0 left-0 pointer-events-none", width: u.width, height: u.height, children: [
2207
+ d.showGrid !== !1 && /* @__PURE__ */ h("svg", { className: "absolute top-0 left-0 pointer-events-none", width: d.width, height: d.height, children: [
2193
2208
  /* @__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" }) }) }),
2194
2209
  /* @__PURE__ */ e("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
2195
2210
  ] }),
2196
- c.map((k) => /* @__PURE__ */ e(
2197
- Wt,
2211
+ c.map((E) => /* @__PURE__ */ e(
2212
+ Ut,
2198
2213
  {
2199
- node: k,
2200
- isSelected: n === k.id || M.includes(k.id),
2214
+ node: E,
2215
+ isSelected: n === E.id || M.includes(E.id),
2201
2216
  data: l,
2202
2217
  onClick: () => {
2203
- console.log("Node onClick:", k.id, "mode:", ie.current), ie.current !== "line-draw" && I(k.id);
2218
+ console.log("Node onClick:", E.id, "mode:", ie.current), ie.current !== "line-draw" && k(E.id);
2204
2219
  },
2205
- onMouseDown: (x) => Qe(x, k),
2206
- onUpdateNode: (x, P) => b(x, P),
2220
+ onMouseDown: (x) => et(x, E),
2221
+ onUpdateNode: (x, P) => v(x, P),
2207
2222
  scale: p.scale
2208
2223
  },
2209
- `${k.id}`
2224
+ `${E.id}`
2210
2225
  )),
2211
- a === "line-draw" && o.isDrawing && o.start && o.end && /* @__PURE__ */ e("svg", { className: "absolute top-0 left-0 pointer-events-none", width: u.width, height: u.height, children: /* @__PURE__ */ e(
2226
+ 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(
2212
2227
  "line",
2213
2228
  {
2214
- x1: o.start.x,
2215
- y1: o.start.y,
2216
- x2: o.end.x,
2217
- y2: o.end.y,
2229
+ x1: s.start.x,
2230
+ y1: s.start.y,
2231
+ x2: s.end.x,
2232
+ y2: s.end.y,
2218
2233
  stroke: "#1890ff",
2219
2234
  strokeWidth: "2",
2220
2235
  strokeDasharray: "5,5",
@@ -2222,15 +2237,15 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2222
2237
  strokeLinejoin: "round"
2223
2238
  }
2224
2239
  ) }),
2225
- a === "box-select" && v.start && v.end && /* @__PURE__ */ e(
2240
+ a === "box-select" && b.start && b.end && /* @__PURE__ */ e(
2226
2241
  "div",
2227
2242
  {
2228
2243
  className: "absolute border-2 border-blue-500 bg-blue-500/10 pointer-events-none",
2229
2244
  style: {
2230
- left: Math.min(v.start.x, v.end.x),
2231
- top: Math.min(v.start.y, v.end.y),
2232
- width: Math.abs(v.end.x - v.start.x),
2233
- height: Math.abs(v.end.y - v.start.y),
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),
2234
2249
  zIndex: 9999
2235
2250
  }
2236
2251
  }
@@ -2244,17 +2259,17 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2244
2259
  }
2245
2260
  ) }),
2246
2261
  /* @__PURE__ */ e(
2247
- at,
2262
+ it,
2248
2263
  {
2249
2264
  title: "数据模拟",
2250
- open: Oe,
2265
+ open: je,
2251
2266
  onCancel: () => j(!1),
2252
2267
  footer: null,
2253
2268
  children: /* @__PURE__ */ e(w, { layout: "vertical", children: /* @__PURE__ */ e(w.Item, { label: "测试数据 (JSON)", children: /* @__PURE__ */ e(
2254
- Rn,
2269
+ On,
2255
2270
  {
2256
- value: ot,
2257
- onChange: (d) => Je(d.target.value),
2271
+ value: st,
2272
+ onChange: (o) => Ke(o.target.value),
2258
2273
  rows: 10,
2259
2274
  placeholder: "输入 JSON 格式的测试数据"
2260
2275
  }
@@ -2262,18 +2277,18 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2262
2277
  }
2263
2278
  ),
2264
2279
  /* @__PURE__ */ e(
2265
- at,
2280
+ it,
2266
2281
  {
2267
2282
  title: "画布配置",
2268
- open: Ke,
2283
+ open: Qe,
2269
2284
  onCancel: () => C(!1),
2270
2285
  footer: null,
2271
2286
  children: /* @__PURE__ */ h(w, { layout: "vertical", children: [
2272
2287
  /* @__PURE__ */ e(w.Item, { label: "宽度", children: /* @__PURE__ */ e(
2273
2288
  te,
2274
2289
  {
2275
- value: u.width,
2276
- onChange: (d) => S({ width: d || 1920 }),
2290
+ value: d.width,
2291
+ onChange: (o) => S({ width: o || 1920 }),
2277
2292
  min: 100,
2278
2293
  max: 5e3,
2279
2294
  style: { width: "100%" }
@@ -2282,50 +2297,89 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2282
2297
  /* @__PURE__ */ e(w.Item, { label: "高度", children: /* @__PURE__ */ e(
2283
2298
  te,
2284
2299
  {
2285
- value: u.height,
2286
- onChange: (d) => S({ height: d || 1080 }),
2300
+ value: d.height,
2301
+ onChange: (o) => S({ height: o || 1080 }),
2287
2302
  min: 100,
2288
2303
  max: 5e3,
2289
2304
  style: { width: "100%" }
2290
2305
  }
2291
2306
  ) }),
2292
2307
  /* @__PURE__ */ e(w.Item, { label: "显示网格", children: /* @__PURE__ */ e(
2293
- Ze,
2308
+ Je,
2294
2309
  {
2295
- checked: u.showGrid !== !1,
2296
- onChange: (d) => S({ showGrid: d })
2310
+ checked: d.showGrid !== !1,
2311
+ onChange: (o) => S({ showGrid: o })
2297
2312
  }
2298
2313
  ) }),
2299
2314
  /* @__PURE__ */ e(w.Item, { label: "背景色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2300
2315
  /* @__PURE__ */ e(
2301
- ze,
2316
+ Ae,
2302
2317
  {
2303
- value: u.background || "#ffffff",
2304
- onChange: (d) => S({ background: d.toHexString() })
2318
+ value: d.background || "#ffffff",
2319
+ onChange: (o) => S({ background: o.toHexString() })
2305
2320
  }
2306
2321
  ),
2307
2322
  /* @__PURE__ */ e(
2308
2323
  re,
2309
2324
  {
2310
- value: u.background,
2311
- onChange: (d) => S({ background: d.target.value }),
2325
+ value: d.background,
2326
+ onChange: (o) => S({ background: o.target.value }),
2312
2327
  placeholder: "#ffffff"
2313
2328
  }
2314
2329
  )
2315
2330
  ] }) }),
2316
- /* @__PURE__ */ e(w.Item, { label: "背景图片 URL", children: /* @__PURE__ */ e(
2317
- re,
2318
- {
2319
- value: u.backgroundImage,
2320
- onChange: (d) => S({ backgroundImage: d.target.value }),
2321
- placeholder: "输入图片 URL"
2322
- }
2323
- ) })
2331
+ /* @__PURE__ */ h(w.Item, { label: "背景图片", children: [
2332
+ /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2333
+ /* @__PURE__ */ e(
2334
+ Tt,
2335
+ {
2336
+ accept: "image/*",
2337
+ showUploadList: !1,
2338
+ beforeUpload: (o) => {
2339
+ if (!o.type.startsWith("image/"))
2340
+ return Ye.error("只能上传图片文件!"), !1;
2341
+ const N = new FileReader();
2342
+ return N.onload = (E) => {
2343
+ const x = E.target?.result;
2344
+ S({ backgroundImage: x }), Ye.success("背景图片上传成功");
2345
+ }, N.readAsDataURL(o), !1;
2346
+ },
2347
+ children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mt, {}), children: "上传图片" })
2348
+ }
2349
+ ),
2350
+ /* @__PURE__ */ e(
2351
+ re,
2352
+ {
2353
+ value: d.backgroundImage,
2354
+ onChange: (o) => S({ backgroundImage: o.target.value }),
2355
+ placeholder: "输入图片 URL 或上传图片",
2356
+ style: { flex: 1 }
2357
+ }
2358
+ ),
2359
+ d.backgroundImage && /* @__PURE__ */ e(
2360
+ Z,
2361
+ {
2362
+ icon: /* @__PURE__ */ e(cn, {}),
2363
+ onClick: () => S({ backgroundImage: void 0 }),
2364
+ danger: !0,
2365
+ size: "small"
2366
+ }
2367
+ )
2368
+ ] }),
2369
+ d.backgroundImage && /* @__PURE__ */ e("div", { className: "mt-2 p-2 border rounded", style: { maxWidth: "100%" }, children: /* @__PURE__ */ e(
2370
+ "img",
2371
+ {
2372
+ src: d.backgroundImage,
2373
+ alt: "背景预览",
2374
+ style: { maxWidth: "100%", maxHeight: 120, objectFit: "contain" }
2375
+ }
2376
+ ) })
2377
+ ] })
2324
2378
  ] })
2325
2379
  }
2326
2380
  )
2327
2381
  ] });
2328
- }, { Option: rt } = Ie, On = ({
2382
+ }, { Option: at } = Ie, jn = ({
2329
2383
  material: l,
2330
2384
  onSave: f,
2331
2385
  bindCodes: t = [],
@@ -2344,7 +2398,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2344
2398
  valueFontWeight: n.valueStyle?.fontWeight || "normal",
2345
2399
  valueColor: n.valueStyle?.color || "#1890ff"
2346
2400
  });
2347
- ye(() => {
2401
+ me(() => {
2348
2402
  i({
2349
2403
  label: n.label || "",
2350
2404
  value: n.value || "",
@@ -2359,22 +2413,22 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2359
2413
  valueColor: n.valueStyle?.color || "#1890ff"
2360
2414
  });
2361
2415
  }, [l.id]);
2362
- const p = (s, I) => {
2363
- i((b) => ({ ...b, [s]: I }));
2364
- }, u = (s) => {
2365
- const I = r.find((N) => N.paramsCode === s), b = I?.unit || "";
2366
- i((N) => ({
2367
- ...N,
2368
- valueSourceCode: s,
2369
- unit: b,
2370
- value: String(I?.value || "")
2416
+ const p = (u, k) => {
2417
+ i((v) => ({ ...v, [u]: k }));
2418
+ }, d = (u) => {
2419
+ const k = r.find((I) => I.paramsCode === u), v = k?.unit || "";
2420
+ i((I) => ({
2421
+ ...I,
2422
+ valueSourceCode: u,
2423
+ unit: v,
2424
+ value: String(k?.value || "")
2371
2425
  })), setTimeout(() => {
2372
2426
  f({
2373
2427
  content: {
2374
2428
  ...n,
2375
- valueSourceCode: s,
2376
- value: String(I?.value || ""),
2377
- unit: b
2429
+ valueSourceCode: u,
2430
+ value: String(k?.value || ""),
2431
+ unit: v
2378
2432
  }
2379
2433
  });
2380
2434
  }, 0);
@@ -2400,7 +2454,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2400
2454
  }
2401
2455
  });
2402
2456
  }, S = r.filter(
2403
- (s) => t.includes(s.paramsCode)
2457
+ (u) => t.includes(u.paramsCode)
2404
2458
  );
2405
2459
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2406
2460
  /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "文本内容" }),
@@ -2409,7 +2463,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2409
2463
  re,
2410
2464
  {
2411
2465
  value: a.label,
2412
- onChange: (s) => p("label", s.target.value),
2466
+ onChange: (u) => p("label", u.target.value),
2413
2467
  onBlur: m,
2414
2468
  placeholder: "输入标签文本"
2415
2469
  }
@@ -2423,7 +2477,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2423
2477
  Ie,
2424
2478
  {
2425
2479
  value: a.valueSourceCode || void 0,
2426
- onChange: u,
2480
+ onChange: d,
2427
2481
  placeholder: "选择数据字段(可选)",
2428
2482
  allowClear: !0,
2429
2483
  style: { width: "100%" },
@@ -2445,7 +2499,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2445
2499
  re,
2446
2500
  {
2447
2501
  value: a.value,
2448
- onChange: (s) => p("value", s.target.value),
2502
+ onChange: (u) => p("value", u.target.value),
2449
2503
  onBlur: m,
2450
2504
  placeholder: a.valueSourceCode ? "数据字段无值时显示此备用值" : "输入值文本",
2451
2505
  disabled: !!a.valueSourceCode,
@@ -2458,10 +2512,10 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2458
2512
  re,
2459
2513
  {
2460
2514
  value: a.unit,
2461
- onChange: (s) => p("unit", s.target.value),
2515
+ onChange: (u) => p("unit", u.target.value),
2462
2516
  onBlur: m,
2463
2517
  placeholder: "单位(如°C、%、MPa等)",
2464
- suffix: a.valueSourceCode && S.length > 0 ? /* @__PURE__ */ e(pe, { color: "blue", style: { marginRight: -8 }, children: "自动" }) : null
2518
+ suffix: a.valueSourceCode && S.length > 0 ? /* @__PURE__ */ e(ye, { color: "blue", style: { marginRight: -8 }, children: "自动" }) : null
2465
2519
  }
2466
2520
  ) }),
2467
2521
  /* @__PURE__ */ e(
@@ -2473,7 +2527,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2473
2527
  te,
2474
2528
  {
2475
2529
  value: a.decimals,
2476
- onChange: (s) => p("decimals", s ?? 2),
2530
+ onChange: (u) => p("decimals", u ?? 2),
2477
2531
  onBlur: m,
2478
2532
  min: -1,
2479
2533
  max: 10,
@@ -2490,7 +2544,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2490
2544
  te,
2491
2545
  {
2492
2546
  value: a.labelFontSize,
2493
- onChange: (s) => p("labelFontSize", s || 14),
2547
+ onChange: (u) => p("labelFontSize", u || 14),
2494
2548
  onBlur: m,
2495
2549
  min: 8,
2496
2550
  max: 72
@@ -2500,26 +2554,26 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2500
2554
  Ie,
2501
2555
  {
2502
2556
  value: a.labelFontWeight,
2503
- onChange: (s) => {
2504
- p("labelFontWeight", s), setTimeout(m, 0);
2557
+ onChange: (u) => {
2558
+ p("labelFontWeight", u), setTimeout(m, 0);
2505
2559
  },
2506
2560
  style: { width: 100 },
2507
2561
  children: [
2508
- /* @__PURE__ */ e(rt, { value: "normal", children: "正常" }),
2509
- /* @__PURE__ */ e(rt, { value: "bold", children: "粗体" })
2562
+ /* @__PURE__ */ e(at, { value: "normal", children: "正常" }),
2563
+ /* @__PURE__ */ e(at, { value: "bold", children: "粗体" })
2510
2564
  ]
2511
2565
  }
2512
2566
  ) })
2513
2567
  ] }),
2514
2568
  /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2515
2569
  /* @__PURE__ */ e(
2516
- ze,
2570
+ Ae,
2517
2571
  {
2518
2572
  value: a.labelColor || "#262626",
2519
- onChange: (s) => {
2520
- p("labelColor", s.toHexString());
2573
+ onChange: (u) => {
2574
+ p("labelColor", u.toHexString());
2521
2575
  },
2522
- onChangeComplete: (s) => {
2576
+ onChangeComplete: (u) => {
2523
2577
  f({
2524
2578
  content: {
2525
2579
  ...n,
@@ -2531,7 +2585,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2531
2585
  labelStyle: {
2532
2586
  fontSize: a.labelFontSize,
2533
2587
  fontWeight: a.labelFontWeight,
2534
- color: s.toHexString()
2588
+ color: u.toHexString()
2535
2589
  },
2536
2590
  valueStyle: {
2537
2591
  fontSize: a.valueFontSize,
@@ -2547,7 +2601,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2547
2601
  re,
2548
2602
  {
2549
2603
  value: a.labelColor,
2550
- onChange: (s) => p("labelColor", s.target.value),
2604
+ onChange: (u) => p("labelColor", u.target.value),
2551
2605
  onBlur: m,
2552
2606
  placeholder: "#262626",
2553
2607
  style: { width: 100 }
@@ -2562,7 +2616,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2562
2616
  te,
2563
2617
  {
2564
2618
  value: a.valueFontSize,
2565
- onChange: (s) => p("valueFontSize", s || 14),
2619
+ onChange: (u) => p("valueFontSize", u || 14),
2566
2620
  onBlur: m,
2567
2621
  min: 8,
2568
2622
  max: 72
@@ -2572,26 +2626,26 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2572
2626
  Ie,
2573
2627
  {
2574
2628
  value: a.valueFontWeight,
2575
- onChange: (s) => {
2576
- p("valueFontWeight", s), setTimeout(m, 0);
2629
+ onChange: (u) => {
2630
+ p("valueFontWeight", u), setTimeout(m, 0);
2577
2631
  },
2578
2632
  style: { width: 100 },
2579
2633
  children: [
2580
- /* @__PURE__ */ e(rt, { value: "normal", children: "正常" }),
2581
- /* @__PURE__ */ e(rt, { value: "bold", children: "粗体" })
2634
+ /* @__PURE__ */ e(at, { value: "normal", children: "正常" }),
2635
+ /* @__PURE__ */ e(at, { value: "bold", children: "粗体" })
2582
2636
  ]
2583
2637
  }
2584
2638
  ) })
2585
2639
  ] }),
2586
2640
  /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2587
2641
  /* @__PURE__ */ e(
2588
- ze,
2642
+ Ae,
2589
2643
  {
2590
2644
  value: a.valueColor || "#1890ff",
2591
- onChange: (s) => {
2592
- p("valueColor", s.toHexString());
2645
+ onChange: (u) => {
2646
+ p("valueColor", u.toHexString());
2593
2647
  },
2594
- onChangeComplete: (s) => {
2648
+ onChangeComplete: (u) => {
2595
2649
  f({
2596
2650
  content: {
2597
2651
  ...n,
@@ -2608,7 +2662,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2608
2662
  valueStyle: {
2609
2663
  fontSize: a.valueFontSize,
2610
2664
  fontWeight: a.valueFontWeight,
2611
- color: s.toHexString()
2665
+ color: u.toHexString()
2612
2666
  }
2613
2667
  }
2614
2668
  });
@@ -2619,7 +2673,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2619
2673
  re,
2620
2674
  {
2621
2675
  value: a.valueColor,
2622
- onChange: (s) => p("valueColor", s.target.value),
2676
+ onChange: (u) => p("valueColor", u.target.value),
2623
2677
  onBlur: m,
2624
2678
  placeholder: "#1890ff",
2625
2679
  style: { width: 100 }
@@ -2628,7 +2682,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2628
2682
  ] }) })
2629
2683
  ] })
2630
2684
  ] });
2631
- }, An = ({
2685
+ }, Wn = ({
2632
2686
  material: l,
2633
2687
  onSave: f
2634
2688
  }) => {
@@ -2638,7 +2692,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2638
2692
  backgroundColor: t.backgroundColor || "",
2639
2693
  fillColor: t.fillColor || ""
2640
2694
  });
2641
- ye(() => {
2695
+ me(() => {
2642
2696
  c({
2643
2697
  name: l.name,
2644
2698
  src: t.src || "",
@@ -2647,7 +2701,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2647
2701
  });
2648
2702
  }, [l.id]);
2649
2703
  const n = (i, p) => {
2650
- c((u) => ({ ...u, [i]: p }));
2704
+ c((d) => ({ ...d, [i]: p }));
2651
2705
  }, a = () => {
2652
2706
  f({
2653
2707
  name: r.name,
@@ -2678,7 +2732,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2678
2732
  ) }),
2679
2733
  /* @__PURE__ */ e(w.Item, { label: "填充颜色(基本形状)", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2680
2734
  /* @__PURE__ */ e(
2681
- ze,
2735
+ Ae,
2682
2736
  {
2683
2737
  value: r.fillColor || "#1890ff",
2684
2738
  onChange: (i) => {
@@ -2704,7 +2758,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2704
2758
  ] }) }),
2705
2759
  /* @__PURE__ */ e(w.Item, { label: "背景颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2706
2760
  /* @__PURE__ */ e(
2707
- ze,
2761
+ Ae,
2708
2762
  {
2709
2763
  value: r.backgroundColor || "#1890ff",
2710
2764
  onChange: (i) => {
@@ -2730,7 +2784,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2730
2784
  ] }) })
2731
2785
  ] })
2732
2786
  ] });
2733
- }, { Option: jn } = Ie, Wn = ({
2787
+ }, { Option: Fn } = Ie, Un = ({
2734
2788
  material: l,
2735
2789
  onSave: f
2736
2790
  }) => {
@@ -2743,7 +2797,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2743
2797
  endX: t.endX ?? 100,
2744
2798
  endY: t.endY ?? 0
2745
2799
  });
2746
- ye(() => {
2800
+ me(() => {
2747
2801
  c({
2748
2802
  lineWeight: t.lineWeight || t.thickness || 2,
2749
2803
  color: t.color || "#262626",
@@ -2816,7 +2870,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2816
2870
  ] }),
2817
2871
  /* @__PURE__ */ e(w.Item, { label: "快速对齐", className: "mt-4", children: /* @__PURE__ */ h(be, { children: [
2818
2872
  /* @__PURE__ */ e(
2819
- K,
2873
+ Z,
2820
2874
  {
2821
2875
  size: "small",
2822
2876
  onClick: () => {
@@ -2828,7 +2882,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2828
2882
  }
2829
2883
  ),
2830
2884
  /* @__PURE__ */ e(
2831
- K,
2885
+ Z,
2832
2886
  {
2833
2887
  size: "small",
2834
2888
  onClick: () => {
@@ -2840,13 +2894,13 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2840
2894
  }
2841
2895
  ),
2842
2896
  /* @__PURE__ */ e(
2843
- K,
2897
+ Z,
2844
2898
  {
2845
2899
  size: "small",
2846
2900
  onClick: () => {
2847
- const i = t.startX ?? r.startX, p = t.startY ?? r.startY, u = t.endX ?? r.endX, m = t.endY ?? r.endY;
2901
+ const i = t.startX ?? r.startX, p = t.startY ?? r.startY, d = t.endX ?? r.endX, m = t.endY ?? r.endY;
2848
2902
  n({
2849
- startX: u,
2903
+ startX: d,
2850
2904
  startY: m,
2851
2905
  endX: i,
2852
2906
  endY: p
@@ -2865,7 +2919,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2865
2919
  {
2866
2920
  value: r.lineType,
2867
2921
  onChange: (i) => n({ lineType: i }),
2868
- children: a.map((i) => /* @__PURE__ */ e(jn, { value: i.value, children: /* @__PURE__ */ h("div", { className: "flex flex-col", children: [
2922
+ children: a.map((i) => /* @__PURE__ */ e(Fn, { value: i.value, children: /* @__PURE__ */ h("div", { className: "flex flex-col", children: [
2869
2923
  /* @__PURE__ */ e("span", { children: i.label }),
2870
2924
  /* @__PURE__ */ e("span", { className: "text-xs text-gray-400", children: i.desc })
2871
2925
  ] }) }, i.value))
@@ -2883,7 +2937,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2883
2937
  ) }),
2884
2938
  /* @__PURE__ */ e(w.Item, { label: "颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2885
2939
  /* @__PURE__ */ e(
2886
- ze,
2940
+ Ae,
2887
2941
  {
2888
2942
  value: r.color || "#d9d9d9",
2889
2943
  onChange: (i) => n({ color: i.toHexString() })
@@ -2901,7 +2955,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2901
2955
  ] }) })
2902
2956
  ] })
2903
2957
  ] });
2904
- }, Ft = ({
2958
+ }, Ht = ({
2905
2959
  material: l,
2906
2960
  onSave: f,
2907
2961
  bindCodes: t,
@@ -2910,7 +2964,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2910
2964
  switch (l.type) {
2911
2965
  case "TEXT":
2912
2966
  return /* @__PURE__ */ e(
2913
- On,
2967
+ jn,
2914
2968
  {
2915
2969
  material: l,
2916
2970
  onSave: f,
@@ -2919,60 +2973,60 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2919
2973
  }
2920
2974
  );
2921
2975
  case "IMAGE":
2922
- return /* @__PURE__ */ e(An, { material: l, onSave: f });
2923
- case "LINE":
2924
2976
  return /* @__PURE__ */ e(Wn, { material: l, onSave: f });
2977
+ case "LINE":
2978
+ return /* @__PURE__ */ e(Un, { material: l, onSave: f });
2925
2979
  default:
2926
2980
  return /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-8", children: "暂不支持编辑此类型的物料" });
2927
2981
  }
2928
- }, { Panel: Mt } = Ne, { TextArea: Fn } = re, Un = ({
2982
+ }, { Panel: $t } = Ne, { TextArea: Hn } = re, Gn = ({
2929
2983
  node: l,
2930
2984
  updateNode: f,
2931
2985
  materials: t
2932
2986
  }) => {
2933
2987
  const r = t.filter((m) => m.type !== "CUSTOM" || !m.config?.nodes), c = (m, S) => {
2934
- const s = l.children?.map((I) => I.id === m ? {
2935
- ...I,
2988
+ const u = l.children?.map((k) => k.id === m ? {
2989
+ ...k,
2936
2990
  contentInfo: {
2937
- ...I.contentInfo,
2991
+ ...k.contentInfo,
2938
2992
  statusList: S
2939
2993
  }
2940
- } : I);
2994
+ } : k);
2941
2995
  f(l.id, {
2942
- children: s
2996
+ children: u
2943
2997
  });
2944
2998
  }, n = (m) => {
2945
- const S = l.children?.find((I) => I.id === m);
2999
+ const S = l.children?.find((k) => k.id === m);
2946
3000
  if (!S) return;
2947
- const s = {
3001
+ const u = {
2948
3002
  id: H(),
2949
3003
  name: `状态${S.contentInfo.statusList.length + 1}`,
2950
3004
  expression: S.contentInfo.statusList.length === 0 ? "return true;" : "return false;",
2951
3005
  material: { ...r[0], id: H() },
2952
3006
  bindCodes: []
2953
3007
  };
2954
- c(m, [...S.contentInfo.statusList, s]);
3008
+ c(m, [...S.contentInfo.statusList, u]);
2955
3009
  }, a = (m, S) => {
2956
- const s = l.children?.find((b) => b.id === m);
2957
- if (!s) return;
2958
- const I = s.contentInfo.statusList.filter((b) => b.id !== S);
2959
- c(m, I);
2960
- }, i = (m, S, s) => {
2961
- const I = l.children?.find((N) => N.id === m);
2962
- if (!I) return;
2963
- const b = I.contentInfo.statusList.map((N) => N.id === S ? { ...N, ...s } : N);
2964
- c(m, b);
2965
- }, p = (m, S, s) => {
2966
- const I = l.children?.find((g) => g.id === m);
2967
- if (!I) return;
2968
- const b = I.contentInfo.statusList.findIndex((g) => g.id === S);
2969
- if (b === -1) return;
2970
- const N = [...I.contentInfo.statusList];
2971
- s === "up" && b > 0 ? [N[b], N[b - 1]] = [N[b - 1], N[b]] : s === "down" && b < N.length - 1 && ([N[b], N[b + 1]] = [N[b + 1], N[b]]), c(m, N);
2972
- }, u = (m, S, s) => {
2973
- const I = t.find((b) => b.id === s);
2974
- I && i(m, S, {
2975
- material: { ...I, id: H() }
3010
+ const u = l.children?.find((v) => v.id === m);
3011
+ if (!u) return;
3012
+ const k = u.contentInfo.statusList.filter((v) => v.id !== S);
3013
+ c(m, k);
3014
+ }, 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);
3019
+ }, 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);
3026
+ }, d = (m, S, u) => {
3027
+ const k = t.find((v) => v.id === u);
3028
+ k && i(m, S, {
3029
+ material: { ...k, id: H() }
2976
3030
  });
2977
3031
  };
2978
3032
  return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
@@ -2981,14 +3035,14 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2981
3035
  ":为每个子节点配置多个状态和绑定"
2982
3036
  ] }) }),
2983
3037
  /* @__PURE__ */ e(Ne, { ghost: !0, children: l.children?.map((m, S) => /* @__PURE__ */ e(
2984
- Mt,
3038
+ $t,
2985
3039
  {
2986
3040
  header: /* @__PURE__ */ h("div", { className: "flex items-center justify-between w-full pr-4", children: [
2987
3041
  /* @__PURE__ */ h("span", { className: "font-medium text-sm", children: [
2988
3042
  "子节点 ",
2989
3043
  S + 1
2990
3044
  ] }),
2991
- /* @__PURE__ */ h(pe, { color: "blue", style: { fontSize: "12px", padding: "0 4px" }, children: [
3045
+ /* @__PURE__ */ h(ye, { color: "blue", style: { fontSize: "12px", padding: "0 4px" }, children: [
2992
3046
  m.contentInfo.statusList.length,
2993
3047
  " 个状态"
2994
3048
  ] })
@@ -2997,58 +3051,58 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
2997
3051
  /* @__PURE__ */ h("div", { className: "flex justify-between items-center mb-3", children: [
2998
3052
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "状态列表" }),
2999
3053
  /* @__PURE__ */ e(
3000
- K,
3054
+ Z,
3001
3055
  {
3002
3056
  type: "primary",
3003
3057
  size: "small",
3004
- icon: /* @__PURE__ */ e(_t, {}),
3058
+ icon: /* @__PURE__ */ e(zt, {}),
3005
3059
  onClick: () => n(m.id),
3006
3060
  children: "添加状态"
3007
3061
  }
3008
3062
  )
3009
3063
  ] }),
3010
- 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((s, I) => /* @__PURE__ */ e(
3011
- Mt,
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,
3012
3066
  {
3013
3067
  header: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3014
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: I + 1 }),
3015
- /* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
3016
- /* @__PURE__ */ e(pe, { color: "default", className: "text-xs", children: s.material.type })
3068
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: k + 1 }),
3069
+ /* @__PURE__ */ e("span", { className: "font-medium", children: u.name }),
3070
+ /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: u.material.type })
3017
3071
  ] }),
3018
- extra: /* @__PURE__ */ h(be, { size: "small", onClick: (b) => b.stopPropagation(), children: [
3072
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (v) => v.stopPropagation(), children: [
3019
3073
  /* @__PURE__ */ e(
3020
- K,
3074
+ Z,
3021
3075
  {
3022
3076
  type: "text",
3023
3077
  size: "small",
3024
- icon: /* @__PURE__ */ e(Rt, {}),
3025
- disabled: I === 0,
3026
- onClick: (b) => {
3027
- b.stopPropagation(), p(m.id, s.id, "up");
3078
+ icon: /* @__PURE__ */ e(Ot, {}),
3079
+ disabled: k === 0,
3080
+ onClick: (v) => {
3081
+ v.stopPropagation(), p(m.id, u.id, "up");
3028
3082
  }
3029
3083
  }
3030
3084
  ),
3031
3085
  /* @__PURE__ */ e(
3032
- K,
3086
+ Z,
3033
3087
  {
3034
3088
  type: "text",
3035
3089
  size: "small",
3036
- icon: /* @__PURE__ */ e(zt, {}),
3037
- disabled: I === m.contentInfo.statusList.length - 1,
3038
- onClick: (b) => {
3039
- b.stopPropagation(), p(m.id, s.id, "down");
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");
3040
3094
  }
3041
3095
  }
3042
3096
  ),
3043
3097
  /* @__PURE__ */ e(
3044
- K,
3098
+ Z,
3045
3099
  {
3046
3100
  type: "text",
3047
3101
  size: "small",
3048
3102
  danger: !0,
3049
- icon: /* @__PURE__ */ e(it, {}),
3050
- onClick: (b) => {
3051
- b.stopPropagation(), a(m.id, s.id);
3103
+ icon: /* @__PURE__ */ e(ot, {}),
3104
+ onClick: (v) => {
3105
+ v.stopPropagation(), a(m.id, u.id);
3052
3106
  }
3053
3107
  }
3054
3108
  )
@@ -3057,8 +3111,8 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3057
3111
  /* @__PURE__ */ e(w.Item, { label: "状态名称", children: /* @__PURE__ */ e(
3058
3112
  re,
3059
3113
  {
3060
- value: s.name,
3061
- onChange: (b) => i(m.id, s.id, { name: b.target.value }),
3114
+ value: u.name,
3115
+ onChange: (v) => i(m.id, u.id, { name: v.target.value }),
3062
3116
  placeholder: "输入状态名称"
3063
3117
  }
3064
3118
  ) }),
@@ -3068,10 +3122,10 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3068
3122
  label: "执行表达式",
3069
3123
  help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
3070
3124
  children: /* @__PURE__ */ e(
3071
- Fn,
3125
+ Hn,
3072
3126
  {
3073
- value: s.expression,
3074
- onChange: (b) => i(m.id, s.id, { expression: b.target.value }),
3127
+ value: u.expression,
3128
+ onChange: (v) => i(m.id, u.id, { expression: v.target.value }),
3075
3129
  rows: 3,
3076
3130
  placeholder: "return true;"
3077
3131
  }
@@ -3082,25 +3136,25 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3082
3136
  Ie,
3083
3137
  {
3084
3138
  mode: "tags",
3085
- value: s.bindCodes || [],
3086
- onChange: (b) => i(m.id, s.id, { bindCodes: b }),
3139
+ value: u.bindCodes || [],
3140
+ onChange: (v) => i(m.id, u.id, { bindCodes: v }),
3087
3141
  placeholder: "输入数据源 code",
3088
3142
  tokenSeparators: [",", " "]
3089
3143
  }
3090
3144
  ) }),
3091
3145
  /* @__PURE__ */ e(w.Item, { label: "更换物料", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3092
- /* @__PURE__ */ e(pe, { color: "blue", children: s.material.name }),
3093
- /* @__PURE__ */ e(pe, { color: "default", children: s.material.type }),
3146
+ /* @__PURE__ */ e(ye, { color: "blue", children: u.material.name }),
3147
+ /* @__PURE__ */ e(ye, { color: "default", children: u.material.type }),
3094
3148
  /* @__PURE__ */ e(
3095
3149
  Ie,
3096
3150
  {
3097
3151
  placeholder: "选择新物料",
3098
3152
  style: { width: 150 },
3099
3153
  value: void 0,
3100
- onChange: (b) => b && u(m.id, s.id, b),
3101
- options: r.map((b) => ({
3102
- value: b.id,
3103
- label: `${b.name} (${b.type})`
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})`
3104
3158
  }))
3105
3159
  }
3106
3160
  )
@@ -3109,29 +3163,29 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3109
3163
  /* @__PURE__ */ h("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3110
3164
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3111
3165
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
3112
- /* @__PURE__ */ e(pe, { children: s.material.name })
3166
+ /* @__PURE__ */ e(ye, { children: u.material.name })
3113
3167
  ] }),
3114
3168
  /* @__PURE__ */ e(
3115
- Ft,
3169
+ Ht,
3116
3170
  {
3117
- material: s.material,
3118
- onSave: (b) => {
3119
- const N = { ...s.material, ...b };
3120
- i(m.id, s.id, { material: N });
3171
+ material: u.material,
3172
+ onSave: (v) => {
3173
+ const I = { ...u.material, ...v };
3174
+ i(m.id, u.id, { material: I });
3121
3175
  }
3122
3176
  }
3123
3177
  )
3124
3178
  ] })
3125
3179
  ] })
3126
3180
  },
3127
- s.id
3181
+ u.id
3128
3182
  )) })
3129
3183
  ] })
3130
3184
  },
3131
3185
  m.id
3132
3186
  )) })
3133
3187
  ] });
3134
- }, { Panel: Ee } = Ne, { TabPane: dt } = Xt, { TextArea: Hn } = re, Gn = ({
3188
+ }, { Panel: Ee } = Ne, { TabPane: ut } = Rt, { TextArea: qn } = re, Bn = ({
3135
3189
  defaultTestData: l
3136
3190
  }) => {
3137
3191
  const {
@@ -3143,12 +3197,12 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3143
3197
  updateNodeContent: a,
3144
3198
  materials: i,
3145
3199
  selectedStatusId: p,
3146
- selectStatus: u
3147
- } = _e(), [m] = w.useForm(), [S, s] = Q("basic"), [I, b] = Q(!1), [N, g] = Q(null), [W, O] = Q({}), X = Ce.useMemo(() => f.find((o) => o.id === t), [f, t]), $ = X?.contentInfo.statusList || [], Y = (o) => {
3148
- t && (o.normalStyle && c(t, o.normalStyle), o.name !== void 0 && r(t, { name: o.name }), o.controlInfo && n(t, o.controlInfo));
3200
+ 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) => {
3202
+ t && (s.normalStyle && c(t, s.normalStyle), s.name !== void 0 && r(t, { name: s.name }), s.controlInfo && n(t, s.controlInfo));
3149
3203
  };
3150
- ye(() => {
3151
- X && (m.setFieldsValue({
3204
+ console.log(t, "selectedNodeId", X), me(() => {
3205
+ X && X && (m.setFieldsValue({
3152
3206
  name: X.name,
3153
3207
  normalStyle: {
3154
3208
  width: 100,
@@ -3168,78 +3222,78 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3168
3222
  isSelectable: !0,
3169
3223
  ...X.controlInfo
3170
3224
  }
3171
- }), u(null));
3172
- }, [X?.id, m, u]);
3225
+ }), d(null));
3226
+ }, [X, d, m]);
3173
3227
  const xe = () => {
3174
- !t || !X || (g("new"), b(!0));
3175
- }, ne = (o) => {
3228
+ !t || !X || (g("new"), v(!0));
3229
+ }, ne = (s) => {
3176
3230
  if (!t || !X) return;
3177
3231
  const q = {
3178
3232
  id: H(),
3179
- name: `${o.name}_状态${$.length + 1}`,
3233
+ name: `${s.name}_状态${$.length + 1}`,
3180
3234
  expression: $.length === 0 ? "return true;" : "return false;",
3181
- material: { ...o, id: H() },
3235
+ material: { ...s, id: H() },
3182
3236
  bindCodes: []
3183
3237
  };
3184
- if (N === "new") {
3185
- const v = [...$, q];
3186
- a(t, { statusList: v });
3187
- } else if (N) {
3188
- const v = $.map((L) => L.id === N ? { ...L, material: { ...o, id: H() } } : L);
3189
- a(t, { statusList: v });
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 });
3190
3244
  }
3191
- b(!1), g(null);
3192
- }, we = (o) => {
3245
+ v(!1), g(null);
3246
+ }, we = (s) => {
3193
3247
  if (!t || !X) return;
3194
- const q = X.contentInfo.statusList?.filter((v) => v.id !== o) || [];
3195
- a(t, { statusList: q }), p === o && u(null);
3196
- }, ie = (o, q) => {
3248
+ const q = X.contentInfo.statusList?.filter((b) => b.id !== s) || [];
3249
+ a(t, { statusList: q }), p === s && d(null);
3250
+ }, ie = (s, q) => {
3197
3251
  if (!t || !X) return;
3198
- const v = X.contentInfo.statusList?.map((L) => L.id === o ? { ...L, ...q } : L) || [];
3199
- a(t, { statusList: v });
3200
- }, A = (o) => {
3252
+ const b = X.contentInfo.statusList?.map((Y) => Y.id === s ? { ...Y, ...q } : Y) || [];
3253
+ a(t, { statusList: b });
3254
+ }, A = (s) => {
3201
3255
  if (!t || !X) return;
3202
3256
  const q = {
3203
- ...o,
3257
+ ...s,
3204
3258
  id: H(),
3205
- name: `${o.name}_复制`,
3259
+ name: `${s.name}_复制`,
3206
3260
  expression: "return false;"
3207
- }, v = [...$, q];
3208
- a(t, { statusList: v });
3209
- }, Z = (o, q) => {
3261
+ }, b = [...$, q];
3262
+ a(t, { statusList: b });
3263
+ }, J = (s, q) => {
3210
3264
  if (!t || !X) return;
3211
- const v = $.findIndex((M) => M.id === o);
3212
- if (v === -1) return;
3213
- const L = [...$];
3214
- q === "up" && v > 0 ? [L[v], L[v - 1]] = [
3215
- L[v - 1],
3216
- L[v]
3217
- ] : q === "down" && v < L.length - 1 && ([L[v], L[v + 1]] = [
3218
- L[v + 1],
3219
- L[v]
3220
- ]), a(t, { statusList: L });
3221
- }, G = (o) => {
3222
- g(o), b(!0);
3223
- }, T = (o, q) => {
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 });
3275
+ }, G = (s) => {
3276
+ g(s), v(!0);
3277
+ }, T = (s, q) => {
3224
3278
  if (!t || !X) return;
3225
- const v = $.map((L) => L.id === o ? {
3226
- ...L,
3227
- material: { ...L.material, ...q }
3228
- } : L);
3229
- a(t, { statusList: v });
3279
+ const b = $.map((Y) => Y.id === s ? {
3280
+ ...Y,
3281
+ material: { ...Y.material, ...q }
3282
+ } : Y);
3283
+ a(t, { statusList: b });
3230
3284
  };
3231
3285
  return X ? /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
3232
3286
  /* @__PURE__ */ h("div", { className: "p-4 border-b border-gray-200", children: [
3233
3287
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "属性面板" }),
3234
3288
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "编辑选中节点的属性" })
3235
3289
  ] }),
3236
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ h(Xt, { activeKey: S, onChange: s, children: [
3237
- /* @__PURE__ */ e(dt, { tab: "基础", children: /* @__PURE__ */ h(
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(
3238
3292
  w,
3239
3293
  {
3240
3294
  form: m,
3241
3295
  layout: "vertical",
3242
- onValuesChange: Y,
3296
+ onValuesChange: L,
3243
3297
  initialValues: { name: X.name },
3244
3298
  children: [
3245
3299
  /* @__PURE__ */ e(w.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(re, { placeholder: "输入节点名称" }) }),
@@ -3281,8 +3335,8 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3281
3335
  ]
3282
3336
  }
3283
3337
  ) }, "basic"),
3284
- /* @__PURE__ */ e(dt, { tab: "状态", children: X.type === "group" && X.children ? /* @__PURE__ */ e(
3285
- Un,
3338
+ /* @__PURE__ */ e(ut, { tab: "状态", children: X.type === "group" && X.children ? /* @__PURE__ */ e(
3339
+ Gn,
3286
3340
  {
3287
3341
  node: X,
3288
3342
  updateNode: r,
@@ -3292,14 +3346,14 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3292
3346
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3293
3347
  /* @__PURE__ */ h("span", { className: "font-medium", children: [
3294
3348
  "状态列表",
3295
- /* @__PURE__ */ e(pe, { color: "blue", className: "ml-2", children: $.length })
3349
+ /* @__PURE__ */ e(ye, { color: "blue", className: "ml-2", children: $.length })
3296
3350
  ] }),
3297
3351
  /* @__PURE__ */ e(
3298
- K,
3352
+ Z,
3299
3353
  {
3300
3354
  type: "primary",
3301
3355
  size: "small",
3302
- icon: /* @__PURE__ */ e(_t, {}),
3356
+ icon: /* @__PURE__ */ e(zt, {}),
3303
3357
  onClick: xe,
3304
3358
  children: "添加状态"
3305
3359
  }
@@ -3310,59 +3364,59 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3310
3364
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "当前状态:" }),
3311
3365
  /* @__PURE__ */ e("span", { className: "ml-2 text-sm font-medium text-blue-600", children: "由表达式自动计算" })
3312
3366
  ] }) }) }),
3313
- $.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, children: $.map((o, q) => /* @__PURE__ */ e(
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(
3314
3368
  Ee,
3315
3369
  {
3316
3370
  header: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3317
3371
  /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: q + 1 }),
3318
- /* @__PURE__ */ e("span", { className: "font-medium", children: o.name }),
3319
- /* @__PURE__ */ e(pe, { color: "default", className: "text-xs", children: o.material.type })
3372
+ /* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
3373
+ /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: s.material.type })
3320
3374
  ] }),
3321
- extra: /* @__PURE__ */ h(be, { size: "small", onClick: (v) => v.stopPropagation(), children: [
3375
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (b) => b.stopPropagation(), children: [
3322
3376
  /* @__PURE__ */ e(
3323
- K,
3377
+ Z,
3324
3378
  {
3325
3379
  type: "text",
3326
3380
  size: "small",
3327
- icon: /* @__PURE__ */ e(Rt, {}),
3381
+ icon: /* @__PURE__ */ e(Ot, {}),
3328
3382
  disabled: q === 0,
3329
- onClick: (v) => {
3330
- v.stopPropagation(), Z(o.id, "up");
3383
+ onClick: (b) => {
3384
+ b.stopPropagation(), J(s.id, "up");
3331
3385
  }
3332
3386
  }
3333
3387
  ),
3334
3388
  /* @__PURE__ */ e(
3335
- K,
3389
+ Z,
3336
3390
  {
3337
3391
  type: "text",
3338
3392
  size: "small",
3339
- icon: /* @__PURE__ */ e(zt, {}),
3393
+ icon: /* @__PURE__ */ e(At, {}),
3340
3394
  disabled: q === $.length - 1,
3341
- onClick: (v) => {
3342
- v.stopPropagation(), Z(o.id, "down");
3395
+ onClick: (b) => {
3396
+ b.stopPropagation(), J(s.id, "down");
3343
3397
  }
3344
3398
  }
3345
3399
  ),
3346
3400
  /* @__PURE__ */ e(
3347
- K,
3401
+ Z,
3348
3402
  {
3349
3403
  type: "text",
3350
3404
  size: "small",
3351
- icon: /* @__PURE__ */ e(Tt, {}),
3352
- onClick: (v) => {
3353
- v.stopPropagation(), A(o);
3405
+ icon: /* @__PURE__ */ e(_t, {}),
3406
+ onClick: (b) => {
3407
+ b.stopPropagation(), A(s);
3354
3408
  }
3355
3409
  }
3356
3410
  ),
3357
3411
  /* @__PURE__ */ e(
3358
- K,
3412
+ Z,
3359
3413
  {
3360
3414
  type: "text",
3361
3415
  size: "small",
3362
3416
  danger: !0,
3363
- icon: /* @__PURE__ */ e(it, {}),
3364
- onClick: (v) => {
3365
- v.stopPropagation(), we(o.id);
3417
+ icon: /* @__PURE__ */ e(ot, {}),
3418
+ onClick: (b) => {
3419
+ b.stopPropagation(), we(s.id);
3366
3420
  }
3367
3421
  }
3368
3422
  )
@@ -3371,8 +3425,8 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3371
3425
  /* @__PURE__ */ e(w.Item, { label: "状态名称", children: /* @__PURE__ */ e(
3372
3426
  re,
3373
3427
  {
3374
- value: o.name,
3375
- onChange: (v) => ie(o.id, { name: v.target.value }),
3428
+ value: s.name,
3429
+ onChange: (b) => ie(s.id, { name: b.target.value }),
3376
3430
  placeholder: "输入状态名称"
3377
3431
  }
3378
3432
  ) }),
@@ -3382,17 +3436,17 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3382
3436
  label: "执行表达式",
3383
3437
  help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
3384
3438
  children: /* @__PURE__ */ e(
3385
- Hn,
3439
+ qn,
3386
3440
  {
3387
- value: W[o.id] ?? o.expression,
3388
- onChange: (v) => O((L) => ({
3389
- ...L,
3390
- [o.id]: v.target.value
3441
+ value: W[s.id] ?? s.expression,
3442
+ onChange: (b) => O((Y) => ({
3443
+ ...Y,
3444
+ [s.id]: b.target.value
3391
3445
  })),
3392
- onBlur: (v) => {
3393
- ie(o.id, { expression: v.target.value }), O((L) => {
3394
- const M = { ...L };
3395
- return delete M[o.id], M;
3446
+ onBlur: (b) => {
3447
+ ie(s.id, { expression: b.target.value }), O((Y) => {
3448
+ const M = { ...Y };
3449
+ return delete M[s.id], M;
3396
3450
  });
3397
3451
  },
3398
3452
  rows: 3,
@@ -3405,22 +3459,22 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3405
3459
  Ie,
3406
3460
  {
3407
3461
  mode: "tags",
3408
- value: o.bindCodes || [],
3409
- onChange: (v) => ie(o.id, { bindCodes: v }),
3462
+ value: s.bindCodes || [],
3463
+ onChange: (b) => ie(s.id, { bindCodes: b }),
3410
3464
  placeholder: "输入数据源 code",
3411
3465
  tokenSeparators: [",", " "]
3412
3466
  }
3413
3467
  ) }),
3414
3468
  /* @__PURE__ */ e(w.Item, { label: "绑定物料", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3415
- /* @__PURE__ */ e(pe, { color: "blue", children: o.material.name }),
3416
- /* @__PURE__ */ e(pe, { color: "default", children: o.material.type }),
3469
+ /* @__PURE__ */ e(ye, { color: "blue", children: s.material.name }),
3470
+ /* @__PURE__ */ e(ye, { color: "default", children: s.material.type }),
3417
3471
  /* @__PURE__ */ e(
3418
- K,
3472
+ Z,
3419
3473
  {
3420
3474
  type: "link",
3421
3475
  size: "small",
3422
- icon: /* @__PURE__ */ e(ht, {}),
3423
- onClick: () => G(o.id),
3476
+ icon: /* @__PURE__ */ e(ft, {}),
3477
+ onClick: () => G(s.id),
3424
3478
  children: "更换物料"
3425
3479
  }
3426
3480
  )
@@ -3429,29 +3483,29 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3429
3483
  /* @__PURE__ */ h("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3430
3484
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3431
3485
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
3432
- /* @__PURE__ */ e(pe, { children: o.material.name })
3486
+ /* @__PURE__ */ e(ye, { children: s.material.name })
3433
3487
  ] }),
3434
3488
  /* @__PURE__ */ e(
3435
- Ft,
3489
+ Ht,
3436
3490
  {
3437
- material: o.material,
3438
- onSave: (v) => T(o.id, v),
3439
- bindCodes: o.bindCodes || [],
3491
+ material: s.material,
3492
+ onSave: (b) => T(s.id, b),
3493
+ bindCodes: s.bindCodes || [],
3440
3494
  dataOptions: l || []
3441
3495
  }
3442
3496
  )
3443
3497
  ] })
3444
3498
  ] })
3445
3499
  },
3446
- o.id
3500
+ s.id + t
3447
3501
  )) })
3448
3502
  ] }) }, "status"),
3449
- /* @__PURE__ */ e(dt, { tab: "控制", children: /* @__PURE__ */ h(
3503
+ /* @__PURE__ */ e(ut, { tab: "控制", children: /* @__PURE__ */ h(
3450
3504
  w,
3451
3505
  {
3452
3506
  form: m,
3453
3507
  layout: "vertical",
3454
- onValuesChange: Y,
3508
+ onValuesChange: L,
3455
3509
  children: [
3456
3510
  /* @__PURE__ */ e(
3457
3511
  w.Item,
@@ -3459,7 +3513,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3459
3513
  label: "可拖拽",
3460
3514
  name: ["controlInfo", "isDraggable"],
3461
3515
  valuePropName: "checked",
3462
- children: /* @__PURE__ */ e(Ze, {})
3516
+ children: /* @__PURE__ */ e(Je, {})
3463
3517
  }
3464
3518
  ),
3465
3519
  /* @__PURE__ */ e(
@@ -3468,7 +3522,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3468
3522
  label: "可点击",
3469
3523
  name: ["controlInfo", "isClickable"],
3470
3524
  valuePropName: "checked",
3471
- children: /* @__PURE__ */ e(Ze, {})
3525
+ children: /* @__PURE__ */ e(Je, {})
3472
3526
  }
3473
3527
  ),
3474
3528
  /* @__PURE__ */ e(
@@ -3477,7 +3531,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3477
3531
  label: "可调整大小",
3478
3532
  name: ["controlInfo", "isResizable"],
3479
3533
  valuePropName: "checked",
3480
- children: /* @__PURE__ */ e(Ze, {})
3534
+ children: /* @__PURE__ */ e(Je, {})
3481
3535
  }
3482
3536
  ),
3483
3537
  /* @__PURE__ */ e(
@@ -3486,7 +3540,7 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3486
3540
  label: "可选中",
3487
3541
  name: ["controlInfo", "isSelectable"],
3488
3542
  valuePropName: "checked",
3489
- children: /* @__PURE__ */ e(Ze, {})
3543
+ children: /* @__PURE__ */ e(Je, {})
3490
3544
  }
3491
3545
  )
3492
3546
  ]
@@ -3505,63 +3559,63 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3505
3559
  ] })
3506
3560
  ] }) }),
3507
3561
  /* @__PURE__ */ e(
3508
- at,
3562
+ it,
3509
3563
  {
3510
3564
  title: "选择物料",
3511
- open: I,
3565
+ open: k,
3512
3566
  onCancel: () => {
3513
- b(!1), g(null);
3567
+ v(!1), g(null);
3514
3568
  },
3515
3569
  footer: null,
3516
3570
  width: 600,
3517
3571
  children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ h(Ne, { ghost: !0, defaultActiveKey: ["basic", "device", "text", "line"], children: [
3518
- /* @__PURE__ */ e(Ee, { header: "基础形状", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((o) => ["矩形", "圆形", "圆角矩形"].includes(o.name)).map((o) => /* @__PURE__ */ e(
3519
- Dt,
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,
3520
3574
  {
3521
- material: o,
3522
- onClick: () => ne(o)
3575
+ material: s,
3576
+ onClick: () => ne(s)
3523
3577
  },
3524
- o.id
3578
+ s.id
3525
3579
  )) }) }, "basic"),
3526
3580
  /* @__PURE__ */ e(Ee, { header: "设备图标", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter(
3527
- (o) => ["阀门", "泵", "罐体"].includes(o.name) || o.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(o.name)
3528
- ).map((o) => /* @__PURE__ */ e(
3529
- Dt,
3581
+ (s) => ["阀门", "泵", "罐体"].includes(s.name) || s.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(s.name)
3582
+ ).map((s) => /* @__PURE__ */ e(
3583
+ Lt,
3530
3584
  {
3531
- material: o,
3532
- onClick: () => ne(o)
3585
+ material: s,
3586
+ onClick: () => ne(s)
3533
3587
  },
3534
- o.id
3588
+ s.id
3535
3589
  )) }) }, "device"),
3536
- /* @__PURE__ */ e(Ee, { header: "文本", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((o) => o.type === "TEXT").map((o) => /* @__PURE__ */ h(
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(
3537
3591
  "div",
3538
3592
  {
3539
3593
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
3540
- onClick: () => ne(o),
3594
+ onClick: () => ne(s),
3541
3595
  children: [
3542
3596
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-1 flex items-center justify-center bg-gray-100 rounded", children: /* @__PURE__ */ e("span", { className: "text-lg font-bold text-gray-500", children: "T" }) }),
3543
- /* @__PURE__ */ e("span", { className: "text-xs", children: o.name })
3597
+ /* @__PURE__ */ e("span", { className: "text-xs", children: s.name })
3544
3598
  ]
3545
3599
  },
3546
- o.id
3600
+ s.id
3547
3601
  )) }) }, "text"),
3548
- /* @__PURE__ */ e(Ee, { header: "线条", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((o) => o.type === "LINE").map((o) => /* @__PURE__ */ h(
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(
3549
3603
  "div",
3550
3604
  {
3551
3605
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
3552
- onClick: () => ne(o),
3606
+ onClick: () => ne(s),
3553
3607
  children: [
3554
3608
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-1 flex items-center justify-center bg-gray-100 rounded", children: /* @__PURE__ */ e("div", { className: "w-8 h-0.5 bg-gray-400" }) }),
3555
- /* @__PURE__ */ e("span", { className: "text-xs", children: o.name })
3609
+ /* @__PURE__ */ e("span", { className: "text-xs", children: s.name })
3556
3610
  ]
3557
3611
  },
3558
- o.id
3612
+ s.id
3559
3613
  )) }) }, "line")
3560
3614
  ] }) })
3561
3615
  }
3562
3616
  )
3563
- ] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(ge, { description: "请选择一个节点" }) });
3564
- }, Dt = ({ material: l, onClick: f }) => {
3617
+ ] }) : /* @__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 }) => {
3565
3619
  const t = l.type === "IMAGE" ? l.src : void 0;
3566
3620
  return /* @__PURE__ */ h(
3567
3621
  "div",
@@ -3574,9 +3628,9 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3574
3628
  ]
3575
3629
  }
3576
3630
  );
3577
- }, qn = "ConfigEditor-module__configEditor__dinNG", Bn = {
3578
- configEditor: qn
3579
- }, { Header: Vn, Sider: $t, Content: Zn } = ut, al = ({
3631
+ }, Vn = "ConfigEditor-module__configEditor__dinNG", Zn = {
3632
+ configEditor: Vn
3633
+ }, { Header: Jn, Sider: Yt, Content: Kn } = ht, ol = ({
3580
3634
  initialScheme: l,
3581
3635
  onChange: f,
3582
3636
  readonly: t = !1,
@@ -3586,9 +3640,9 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3586
3640
  showHeader: a = !0,
3587
3641
  showMaterialPanel: i = !0,
3588
3642
  showPropertyPanel: p = !0,
3589
- customMaterials: u
3643
+ customMaterials: d
3590
3644
  }) => {
3591
- const [m, S] = Ce.useState(!1), [s, I] = Ce.useState(""), [b, N] = Ce.useState([
3645
+ const [m, S] = Ce.useState(!1), [u, k] = Ce.useState(""), [v, I] = Ce.useState([
3592
3646
  {
3593
3647
  paramsCode: "001",
3594
3648
  paramsName: "通频速度有效值",
@@ -3601,38 +3655,38 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3601
3655
  value: 1.5,
3602
3656
  paramsUnit: "m/s²"
3603
3657
  }
3604
- ]), { exportScheme: g, importScheme: W, nodes: O, materials: X, addMaterial: $ } = _e();
3658
+ ]), { exportScheme: g, importScheme: W, nodes: O, materials: X, addMaterial: $ } = ze();
3605
3659
  Ce.useRef(null);
3606
- const Y = Ce.useRef(!1);
3607
- ye(() => {
3608
- Y.current || (Y.current = !0, X.length === 0 && En.forEach((A) => $(A)), u && u.length > 0 && u.forEach((A) => $(A)), l && W(l));
3609
- }, []), ye(() => {
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(() => {
3610
3664
  if (f) {
3611
3665
  const A = g();
3612
3666
  f(A);
3613
3667
  }
3614
3668
  }, [O, f]);
3615
3669
  const xe = V(() => {
3616
- const A = g(), Z = JSON.stringify(A, null, 2), G = "data:application/json;charset=utf-8," + encodeURIComponent(Z), T = `scheme_${Date.now()}.json`, o = document.createElement("a");
3617
- o.setAttribute("href", G), o.setAttribute("download", T), o.click(), We.success("导出成功!");
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("导出成功!");
3618
3672
  }, [g]), ne = V(() => {
3619
3673
  try {
3620
- const A = JSON.parse(s);
3621
- W(A), S(!1), I(""), We.success("导入成功!");
3674
+ const A = JSON.parse(u);
3675
+ W(A), S(!1), k(""), Ye.success("导入成功!");
3622
3676
  } catch {
3623
- We.error("JSON 格式错误,请检查输入");
3677
+ Ye.error("JSON 格式错误,请检查输入");
3624
3678
  }
3625
- }, [s, W]), we = V(
3679
+ }, [u, W]), we = V(
3626
3680
  (A) => {
3627
- const Z = new FileReader();
3628
- return Z.onload = (G) => {
3681
+ const J = new FileReader();
3682
+ return J.onload = (G) => {
3629
3683
  try {
3630
- const T = G.target?.result, o = JSON.parse(T);
3631
- W(o), We.success("导入成功!");
3684
+ const T = G.target?.result, s = JSON.parse(T);
3685
+ W(s), Ye.success("导入成功!"), S(!1);
3632
3686
  } catch {
3633
- We.error("文件格式错误");
3687
+ Ye.error("文件格式错误");
3634
3688
  }
3635
- }, Z.readAsText(A), !1;
3689
+ }, J.readAsText(A), !1;
3636
3690
  },
3637
3691
  [W]
3638
3692
  ), ie = V(() => g(), [g]);
@@ -3644,12 +3698,12 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3644
3698
  importScheme: W
3645
3699
  }),
3646
3700
  [ie, g, W]
3647
- ), /* @__PURE__ */ e(qt, { locale: Nn, children: /* @__PURE__ */ e("div", { className: Bn.configEditor, style: n, children: /* @__PURE__ */ h(
3648
- ut,
3701
+ ), /* @__PURE__ */ e(Bt, { locale: kn, children: /* @__PURE__ */ e("div", { className: Zn.configEditor, style: n, children: /* @__PURE__ */ h(
3702
+ ht,
3649
3703
  {
3650
3704
  className: `h-full w-full overflow-hidden ${c}`,
3651
3705
  children: [
3652
- a && /* @__PURE__ */ h(Vn, { className: "bg-white border-b border-gray-200 px-4 flex items-center justify-between flex-shrink-0", 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: [
3653
3707
  /* @__PURE__ */ h("div", { className: "flex items-center gap-4", children: [
3654
3708
  /* @__PURE__ */ e("div", { className: "text-xl font-bold text-blue-600", children: "组态编辑器" }),
3655
3709
  /* @__PURE__ */ h("div", { className: "text-sm text-gray-500", children: [
@@ -3659,12 +3713,12 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3659
3713
  ] }),
3660
3714
  /* @__PURE__ */ h(be, { children: [
3661
3715
  r,
3662
- !t && /* @__PURE__ */ h(Re, { children: [
3663
- /* @__PURE__ */ e($e, { title: "导出 JSON", children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(un, {}), onClick: xe, children: "导出" }) }),
3664
- /* @__PURE__ */ e($e, { title: "导入 JSON", children: /* @__PURE__ */ e(
3665
- K,
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(
3719
+ Z,
3666
3720
  {
3667
- icon: /* @__PURE__ */ e(Pt, {}),
3721
+ icon: /* @__PURE__ */ e(mt, {}),
3668
3722
  onClick: () => S(!0),
3669
3723
  children: "导入"
3670
3724
  }
@@ -3672,19 +3726,19 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3672
3726
  ] })
3673
3727
  ] })
3674
3728
  ] }),
3675
- /* @__PURE__ */ h(ut, { children: [
3676
- i && !t && /* @__PURE__ */ e($t, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(Dn, {}) }),
3677
- /* @__PURE__ */ e(Zn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(zn, { defaultTestData: b }) }),
3678
- p && !t && /* @__PURE__ */ e($t, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(Gn, { defaultTestData: b }) })
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 }) })
3679
3733
  ] }),
3680
3734
  /* @__PURE__ */ e(
3681
- at,
3735
+ it,
3682
3736
  {
3683
3737
  title: "导入组态方案",
3684
3738
  open: m,
3685
3739
  onOk: ne,
3686
3740
  onCancel: () => {
3687
- S(!1), I("");
3741
+ S(!1), k("");
3688
3742
  },
3689
3743
  width: 600,
3690
3744
  children: /* @__PURE__ */ h("div", { className: "space-y-4", children: [
@@ -3696,8 +3750,8 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3696
3750
  type: "file",
3697
3751
  accept: ".json",
3698
3752
  onChange: (A) => {
3699
- const Z = A.target.files?.[0];
3700
- Z && we(Z);
3753
+ const J = A.target.files?.[0];
3754
+ J && we(J);
3701
3755
  },
3702
3756
  className: `block w-full text-sm text-gray-500
3703
3757
  file:mr-4 file:py-2 file:px-4
@@ -3714,8 +3768,8 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3714
3768
  /* @__PURE__ */ e(
3715
3769
  "textarea",
3716
3770
  {
3717
- value: s,
3718
- onChange: (A) => I(A.target.value),
3771
+ value: u,
3772
+ onChange: (A) => k(A.target.value),
3719
3773
  placeholder: "粘贴 JSON 内容...",
3720
3774
  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"
3721
3775
  }
@@ -3729,14 +3783,14 @@ const Nn = /* @__PURE__ */ pn(Cn), In = (l) => (f, t, r) => (r.setState = (c, n,
3729
3783
  ) }) });
3730
3784
  };
3731
3785
  export {
3732
- zn as Canvas,
3733
- al as ConfigEditor,
3734
- Dn as MaterialPanel,
3735
- Wt as NodeRenderer,
3736
- Gn as PropertyPanel,
3737
- Mn as createDefaultNode,
3738
- jt as createDefaultStatus,
3739
- En as initMaterials,
3740
- _e as useEditorStore
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
3741
3795
  };
3742
3796
  //# sourceMappingURL=config-editor.es.js.map