jch-config-editor 0.1.9 → 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,29 +1,29 @@
1
- import { jsxs as u, jsx as e, Fragment as Ae } from "react/jsx-runtime";
2
- import Ce, { useState as Q, useRef as ce, useMemo as $t, useCallback as B, useEffect as me } from "react";
3
- import { Typography as Yt, Upload as Ut, Button as K, Collapse as Ne, List as Ye, Empty as ue, Tag as he, Image as Ht, Space as pe, Tooltip as Le, Modal as rt, Form as w, Input as le, InputNumber as ee, Switch as Je, Divider as De, Select as Ie, Tabs as Lt, message as Fe, ConfigProvider as Gt, Layout as dt } from "antd";
4
- import { UploadOutlined as Xt, EditOutlined as ut, DeleteOutlined as at, UndoOutlined as qt, RedoOutlined as Bt, CopyOutlined as Pt, GroupOutlined as gt, UngroupOutlined as Vt, AlignLeftOutlined as Zt, AlignRightOutlined as Jt, VerticalAlignTopOutlined as Kt, VerticalAlignBottomOutlined as Qt, ColumnWidthOutlined as en, ColumnHeightOutlined as tn, SettingOutlined as nn, ExperimentOutlined as ln, ZoomInOutlined as rn, ZoomOutOutlined as an, SelectOutlined as on, DragOutlined as sn, EyeOutlined as cn, PlusOutlined as Tt, ArrowUpOutlined as _t, ArrowDownOutlined as zt, DownloadOutlined as dn } from "@ant-design/icons";
5
- import { create as un } from "zustand";
6
- import { produce as hn } from "immer";
7
- import { nanoid as U } from "nanoid";
8
- import { TransformWrapper as mn, TransformComponent as fn } from "react-zoom-pan-pinch";
9
- function gn(l) {
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
+ import { nanoid as H } from "nanoid";
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 Ue = {}, ot = { exports: {} }, pt;
13
- function ht() {
14
- return pt || (pt = 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
- })(ot)), ot.exports;
21
+ })(ct)), ct.exports;
22
22
  }
23
- var He = {}, yt;
24
- function pn() {
25
- if (yt) return He;
26
- yt = 1, Object.defineProperty(He, "__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
28
  }), He.default = void 0;
29
29
  const l = {
@@ -43,9 +43,9 @@ function pn() {
43
43
  };
44
44
  return He.default = l, He;
45
45
  }
46
- var Ge = {}, qe = {}, Be = {}, Ve = {}, vt;
47
- function yn() {
48
- return vt || (vt = 1, Object.defineProperty(Ve, "__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
50
  }), Ve.commonLocale = void 0, Ve.commonLocale = {
51
51
  yearFormat: "YYYY",
@@ -54,58 +54,58 @@ function yn() {
54
54
  monthBeforeYear: !0
55
55
  }), Ve;
56
56
  }
57
- var bt;
58
- function vn() {
59
- if (bt) return Be;
60
- bt = 1, Object.defineProperty(Be, "__esModule", {
57
+ var St;
58
+ function wn() {
59
+ if (St) return Be;
60
+ St = 1, Object.defineProperty(Be, "__esModule", {
61
61
  value: !0
62
62
  }), Be.default = void 0;
63
- var l = yn();
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(c) {
67
- return typeof c;
68
- } : function(c) {
69
- return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
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, c) {
72
+ function t(p, d) {
73
73
  var m = Object.keys(p);
74
74
  if (Object.getOwnPropertySymbols) {
75
- var C = Object.getOwnPropertySymbols(p);
76
- c && (C = C.filter(function(o) {
77
- return Object.getOwnPropertyDescriptor(p, o).enumerable;
78
- })), m.push.apply(m, C);
75
+ var S = Object.getOwnPropertySymbols(p);
76
+ d && (S = S.filter(function(u) {
77
+ return Object.getOwnPropertyDescriptor(p, u).enumerable;
78
+ })), m.push.apply(m, S);
79
79
  }
80
80
  return m;
81
81
  }
82
82
  function r(p) {
83
- for (var c = 1; c < arguments.length; c++) {
84
- var m = arguments[c] != null ? arguments[c] : {};
85
- c % 2 ? t(Object(m), !0).forEach(function(C) {
86
- s(p, C, m[C]);
87
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(p, Object.getOwnPropertyDescriptors(m)) : t(Object(m)).forEach(function(C) {
88
- Object.defineProperty(p, C, Object.getOwnPropertyDescriptor(m, C));
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
+ c(p, S, m[S]);
87
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(p, Object.getOwnPropertyDescriptors(m)) : t(Object(m)).forEach(function(S) {
88
+ Object.defineProperty(p, S, Object.getOwnPropertyDescriptor(m, S));
89
89
  });
90
90
  }
91
91
  return p;
92
92
  }
93
- function s(p, c, m) {
94
- return c = n(c), c in p ? Object.defineProperty(p, c, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : p[c] = 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 c = a(p, "string");
98
- return f(c) == "symbol" ? c : String(c);
97
+ var d = a(p, "string");
98
+ return f(d) == "symbol" ? d : String(d);
99
99
  }
100
- function a(p, c) {
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 C = m.call(p, c);
105
- if (f(C) != "object") return C;
104
+ var S = m.call(p, d);
105
+ if (f(S) != "object") return S;
106
106
  throw new TypeError("@@toPrimitive must return a primitive value.");
107
107
  }
108
- return (c === "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",
@@ -137,10 +137,10 @@ function vn() {
137
137
  });
138
138
  return Be.default = i, Be;
139
139
  }
140
- var Ze = {}, xt;
141
- function Ot() {
142
- if (xt) return Ze;
143
- xt = 1, Object.defineProperty(Ze, "__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
145
  }), Ze.default = void 0;
146
146
  const l = {
@@ -149,15 +149,15 @@ function Ot() {
149
149
  };
150
150
  return Ze.default = l, Ze;
151
151
  }
152
- var wt;
153
- function Rt() {
154
- if (wt) return qe;
155
- wt = 1;
156
- var l = ht().default;
152
+ var Nt;
153
+ function Wt() {
154
+ if (Nt) return qe;
155
+ Nt = 1;
156
+ var l = gt().default;
157
157
  Object.defineProperty(qe, "__esModule", {
158
158
  value: !0
159
159
  }), qe.default = void 0;
160
- var f = l(vn()), t = l(/* @__PURE__ */ Ot());
160
+ var f = l(wn()), t = l(/* @__PURE__ */ jt());
161
161
  const r = {
162
162
  lang: {
163
163
  placeholder: "请选择日期",
@@ -178,31 +178,31 @@ function Rt() {
178
178
  };
179
179
  return r.lang.ok = "确定", qe.default = r, qe;
180
180
  }
181
- var St;
182
- function bn() {
183
- if (St) return Ge;
184
- St = 1;
185
- var l = ht().default;
181
+ var It;
182
+ function Sn() {
183
+ if (It) return Ge;
184
+ It = 1;
185
+ var l = gt().default;
186
186
  Object.defineProperty(Ge, "__esModule", {
187
187
  value: !0
188
188
  }), Ge.default = void 0;
189
- var f = l(/* @__PURE__ */ Rt());
189
+ var f = l(/* @__PURE__ */ Wt());
190
190
  return Ge.default = f.default, Ge;
191
191
  }
192
- var Ct;
193
- function xn() {
194
- if (Ct) return Ue;
195
- Ct = 1;
196
- var l = ht().default;
192
+ var kt;
193
+ function Cn() {
194
+ if (kt) return Ue;
195
+ kt = 1;
196
+ var l = gt().default;
197
197
  Object.defineProperty(Ue, "__esModule", {
198
198
  value: !0
199
199
  }), Ue.default = void 0;
200
- var f = l(pn()), t = l(/* @__PURE__ */ bn()), r = l(/* @__PURE__ */ Rt()), s = l(/* @__PURE__ */ Ot());
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,
204
204
  DatePicker: r.default,
205
- TimePicker: s.default,
205
+ TimePicker: c.default,
206
206
  Calendar: t.default,
207
207
  // locales for all components
208
208
  global: {
@@ -340,15 +340,15 @@ function xn() {
340
340
  };
341
341
  return Ue.default = a, Ue;
342
342
  }
343
- var st, Nt;
344
- function wn() {
345
- return Nt || (Nt = 1, st = /* @__PURE__ */ xn()), st;
343
+ var dt, Et;
344
+ function Nn() {
345
+ return Et || (Et = 1, dt = /* @__PURE__ */ Cn()), dt;
346
346
  }
347
- var Sn = /* @__PURE__ */ wn();
348
- const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n, ...a) => {
349
- const i = typeof s == "function" ? hn(s) : s;
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)), In = Nn, It = {
351
+ }, l(r.setState, t, r)), Mn = En, Mt = {
352
352
  nodes: [],
353
353
  materials: [],
354
354
  selectedNodeId: null,
@@ -376,52 +376,52 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
376
376
  endPoint: null
377
377
  }
378
378
  }, Se = (l, f, t) => ({
379
- id: U(),
379
+ id: H(),
380
380
  type: l,
381
381
  targetId: f,
382
382
  payload: t,
383
383
  timestamp: Date.now()
384
- }), Re = un()(
385
- In((l, f) => ({
386
- ...It,
384
+ }), ze = fn()(
385
+ Mn((l, f) => ({
386
+ ...Mt,
387
387
  // ========== 节点操作 ==========
388
388
  addNode: (t, r = !0) => {
389
- l((s) => {
389
+ l((c) => {
390
390
  const n = {
391
391
  ...t,
392
- id: U()
392
+ id: t.id || H()
393
393
  };
394
- s.nodes.push(n), r && (s.selectedNodeId = n.id, s.history.past.push(Se("NODE_SELECT", n.id)));
394
+ c.nodes.push(n), r && (c.selectedNodeId = n.id, c.history.past.push(Se("NODE_SELECT", n.id)));
395
395
  });
396
396
  },
397
397
  updateNode: (t, r) => {
398
- l((s) => {
399
- const n = s.nodes.find((a) => a.id === t);
400
- n && (Object.assign(n, r), s.history.past.push(Se("PROPERTY_CHANGE", t, r)));
398
+ l((c) => {
399
+ const n = c.nodes.find((a) => a.id === t);
400
+ n && (Object.assign(n, r), c.history.past.push(Se("PROPERTY_CHANGE", t, r)));
401
401
  });
402
402
  },
403
403
  updateNodeStyle: (t, r) => {
404
- l((s) => {
405
- const n = s.nodes.find((a) => a.id === t);
406
- n && (Object.assign(n.normalStyle, r), s.history.past.push(Se("PROPERTY_CHANGE", t, { normalStyle: r })));
404
+ l((c) => {
405
+ const n = c.nodes.find((a) => a.id === t);
406
+ n && (Object.assign(n.normalStyle, r), c.history.past.push(Se("PROPERTY_CHANGE", t, { normalStyle: r })));
407
407
  });
408
408
  },
409
409
  updateNodeContent: (t, r) => {
410
- l((s) => {
411
- const n = s.nodes.find((a) => a.id === t);
412
- n && (n.contentInfo = { ...n.contentInfo, ...r }, s.history.past.push(Se("PROPERTY_CHANGE", t, { contentInfo: r })));
410
+ l((c) => {
411
+ const n = c.nodes.find((a) => a.id === t);
412
+ n && (n.contentInfo = { ...n.contentInfo, ...r }, c.history.past.push(Se("PROPERTY_CHANGE", t, { contentInfo: r })));
413
413
  });
414
414
  },
415
415
  updateNodeControl: (t, r) => {
416
- l((s) => {
417
- const n = s.nodes.find((a) => a.id === t);
418
- n && (Object.assign(n.controlInfo, r), s.history.past.push(Se("PROPERTY_CHANGE", t, { controlInfo: r })));
416
+ l((c) => {
417
+ const n = c.nodes.find((a) => a.id === t);
418
+ n && (Object.assign(n.controlInfo, r), c.history.past.push(Se("PROPERTY_CHANGE", t, { controlInfo: r })));
419
419
  });
420
420
  },
421
421
  removeNode: (t) => {
422
422
  l((r) => {
423
- const s = r.nodes.findIndex((n) => n.id === t);
424
- s !== -1 && (r.nodes.splice(s, 1), r.selectedNodeId === t && (r.selectedNodeId = null, r.selectedStatusId = null), r.history.past.push(Se("NODE_DELETE", t)));
423
+ const c = r.nodes.findIndex((n) => n.id === t);
424
+ c !== -1 && (r.nodes.splice(c, 1), r.selectedNodeId === t && (r.selectedNodeId = null, r.selectedStatusId = null), r.history.past.push(Se("NODE_DELETE", t)));
425
425
  });
426
426
  },
427
427
  selectNode: (t) => {
@@ -431,30 +431,30 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
431
431
  },
432
432
  // ========== 状态操作 ==========
433
433
  addStatus: (t, r) => {
434
- l((s) => {
435
- const n = s.nodes.find((i) => i.id === t);
434
+ l((c) => {
435
+ const n = c.nodes.find((i) => i.id === t);
436
436
  if (!n) return;
437
437
  const a = {
438
438
  ...r,
439
- id: U()
439
+ id: H()
440
440
  };
441
- n.contentInfo.statusList.push(a), s.history.past.push(Se("MATERIAL_STATUS_CHANGE", t, { statusId: a.id }));
441
+ n.contentInfo.statusList.push(a), c.history.past.push(Se("MATERIAL_STATUS_CHANGE", t, { statusId: a.id }));
442
442
  });
443
443
  },
444
444
  removeStatus: (t, r) => {
445
- l((s) => {
446
- const n = s.nodes.find((i) => i.id === t);
445
+ l((c) => {
446
+ const n = c.nodes.find((i) => i.id === t);
447
447
  if (!n) return;
448
448
  const a = n.contentInfo.statusList.findIndex((i) => i.id === r);
449
- a !== -1 && (n.contentInfo.statusList.splice(a, 1), n.contentInfo.currentStatusId === r && (n.contentInfo.currentStatusId = void 0), s.selectedStatusId === r && (s.selectedStatusId = null));
449
+ a !== -1 && (n.contentInfo.statusList.splice(a, 1), n.contentInfo.currentStatusId === r && (n.contentInfo.currentStatusId = void 0), c.selectedStatusId === r && (c.selectedStatusId = null));
450
450
  });
451
451
  },
452
- updateStatus: (t, r, s) => {
452
+ updateStatus: (t, r, c) => {
453
453
  l((n) => {
454
454
  const a = n.nodes.find((p) => p.id === t);
455
455
  if (!a) return;
456
456
  const i = a.contentInfo.statusList.find((p) => p.id === r);
457
- i && Object.assign(i, s);
457
+ i && Object.assign(i, c);
458
458
  });
459
459
  },
460
460
  selectStatus: (t) => {
@@ -476,23 +476,23 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
476
476
  // ========== 物料库操作 ==========
477
477
  addMaterial: (t) => {
478
478
  l((r) => {
479
- const s = {
479
+ const c = {
480
480
  ...t,
481
- id: U()
481
+ id: H()
482
482
  };
483
- r.materials.push(s), r.history.past.push(Se("MATERIAL_ADD", s.id));
483
+ r.materials.push(c), r.history.past.push(Se("MATERIAL_ADD", c.id));
484
484
  });
485
485
  },
486
486
  updateMaterial: (t, r) => {
487
- l((s) => {
488
- const n = s.materials.find((a) => a.id === t);
487
+ l((c) => {
488
+ const n = c.materials.find((a) => a.id === t);
489
489
  n && Object.assign(n, r);
490
490
  });
491
491
  },
492
492
  removeMaterial: (t) => {
493
493
  l((r) => {
494
- const s = r.materials.findIndex((n) => n.id === t);
495
- s !== -1 && r.materials.splice(s, 1);
494
+ const c = r.materials.findIndex((n) => n.id === t);
495
+ c !== -1 && r.materials.splice(c, 1);
496
496
  });
497
497
  },
498
498
  // ========== 视口操作 ==========
@@ -585,52 +585,52 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
585
585
  },
586
586
  importScheme: (t) => {
587
587
  l((r) => {
588
- r.nodes = t.nodes || [], r.materials = t.materials || [], r.viewport = t.viewport || It.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
- ), kn = [
592
+ ), Dn = [
593
593
  // 基础形状
594
594
  {
595
- id: U(),
595
+ id: H(),
596
596
  name: "矩形",
597
597
  type: "IMAGE",
598
598
  src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="60"><rect width="100" height="60" fill="#1890ff" rx="4"/></svg>')}`
599
599
  },
600
600
  {
601
- id: U(),
601
+ id: H(),
602
602
  name: "圆形",
603
603
  type: "IMAGE",
604
604
  src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><circle cx="40" cy="40" r="38" fill="#52c41a"/></svg>')}`
605
605
  },
606
606
  {
607
- id: U(),
607
+ id: H(),
608
608
  name: "圆角矩形",
609
609
  type: "IMAGE",
610
610
  src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="60"><rect width="100" height="60" fill="#faad14" rx="20"/></svg>')}`
611
611
  },
612
612
  // 设备图标
613
613
  {
614
- id: U(),
614
+ id: H(),
615
615
  name: "阀门",
616
616
  type: "IMAGE",
617
617
  src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><path d="M10 20 L30 10 L50 20 L50 40 L30 50 L10 40 Z" fill="#bfbfbf" stroke="#595959" stroke-width="2"/><circle cx="30" cy="30" r="8" fill="#1890ff"/></svg>')}`
618
618
  },
619
619
  {
620
- id: U(),
620
+ id: H(),
621
621
  name: "泵",
622
622
  type: "IMAGE",
623
623
  src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><circle cx="30" cy="35" r="20" fill="#bfbfbf" stroke="#595959" stroke-width="2"/><rect x="25" y="5" width="10" height="15" fill="#595959"/><path d="M30 20 L30 35 M20 30 Q30 45 40 30" stroke="#595959" stroke-width="2" fill="none"/></svg>')}`
624
624
  },
625
625
  {
626
- id: U(),
626
+ id: H(),
627
627
  name: "罐体",
628
628
  type: "IMAGE",
629
629
  src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="60" height="80"><ellipse cx="30" cy="10" rx="25" ry="10" fill="#d9d9d9" stroke="#595959" stroke-width="2"/><rect x="5" y="10" width="50" height="60" fill="#f0f0f0" stroke="#595959" stroke-width="2"/><ellipse cx="30" cy="70" rx="25" ry="10" fill="#d9d9d9" stroke="#595959" stroke-width="2"/></svg>')}`
630
630
  },
631
631
  // 文本
632
632
  {
633
- id: U(),
633
+ id: H(),
634
634
  name: "文本标签",
635
635
  type: "TEXT",
636
636
  content: {
@@ -652,7 +652,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
652
652
  },
653
653
  // 线条 - 通用线条物料,通过属性配置实现不同线型
654
654
  {
655
- id: U(),
655
+ id: H(),
656
656
  name: "线条",
657
657
  type: "LINE",
658
658
  config: {
@@ -662,40 +662,40 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
662
662
  lineType: "solid"
663
663
  }
664
664
  }
665
- ], At = (l) => ({
666
- id: U(),
665
+ ], Ft = (l) => ({
666
+ id: H(),
667
667
  name: "默认状态",
668
668
  expression: "return true;",
669
- material: { ...l, id: U() },
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((c) => ({
674
- ...c,
675
- id: U()
673
+ const r = t.config.nodes.map((d) => ({
674
+ ...d,
675
+ id: H()
676
676
  // 重新生成子节点ID
677
677
  }));
678
- let s = 1 / 0, n = 1 / 0, a = -1 / 0, i = -1 / 0;
679
- r.forEach((c) => {
680
- const m = c.normalStyle.x || 0, C = c.normalStyle.y || 0, o = c.normalStyle.width || 0, I = c.normalStyle.height || 0;
681
- s = Math.min(s, m), n = Math.min(n, C), a = Math.max(a, m + o), i = Math.max(i, C + I);
678
+ let c = 1 / 0, n = 1 / 0, a = -1 / 0, i = -1 / 0;
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((c) => ({
684
- ...c,
683
+ const p = r.map((d) => ({
684
+ ...d,
685
685
  normalStyle: {
686
- ...c.normalStyle,
687
- x: (c.normalStyle.x || 0) - s,
688
- y: (c.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
  }
692
692
  }));
693
693
  return {
694
- id: U(),
694
+ id: H(),
695
695
  name: t.name || "群组节点",
696
696
  type: "group",
697
697
  normalStyle: {
698
- width: a - s,
698
+ width: a - c,
699
699
  height: i - n,
700
700
  x: l,
701
701
  y: f
@@ -715,7 +715,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
715
715
  };
716
716
  }
717
717
  return {
718
- id: U(),
718
+ id: H(),
719
719
  name: "新节点",
720
720
  type: "normal",
721
721
  normalStyle: {
@@ -727,7 +727,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
727
727
  padding: 8
728
728
  },
729
729
  contentInfo: {
730
- statusList: t ? [At(t)] : [],
730
+ statusList: t ? [Ft(t)] : [],
731
731
  currentStatusId: void 0
732
732
  },
733
733
  controlInfo: {
@@ -737,33 +737,33 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
737
737
  isSelectable: !0
738
738
  }
739
739
  };
740
- }, { Panel: Oe } = Ne, { Text: nt } = Yt, En = () => {
740
+ }, { Panel: _e } = Ne, { Text: rt } = Pt, Ln = () => {
741
741
  const {
742
742
  materials: l,
743
743
  addMaterial: f,
744
744
  removeMaterial: t,
745
745
  selectedStatusId: r,
746
- selectStatus: s,
746
+ selectStatus: c,
747
747
  mode: n,
748
748
  lineDrawing: a,
749
749
  startLineDrawing: i,
750
750
  cancelLineDrawing: p
751
- } = Re(), [c, m] = Q([
751
+ } = ze(), [d, m] = Q([
752
752
  "basic",
753
753
  "device",
754
754
  "text",
755
755
  "line"
756
- ]), C = (g) => {
757
- const A = new FileReader();
758
- return A.onload = (z) => {
759
- const T = z.target?.result;
756
+ ]), S = (g) => {
757
+ const W = new FileReader();
758
+ return W.onload = (O) => {
759
+ const X = O.target?.result;
760
760
  f({
761
761
  name: g.name.replace(".svg", ""),
762
762
  type: "IMAGE",
763
- src: T
763
+ src: X
764
764
  });
765
- }, A.readAsDataURL(g), !1;
766
- }, o = {
765
+ }, W.readAsDataURL(g), !1;
766
+ }, u = {
767
767
  basic: l.filter(
768
768
  (g) => ["矩形", "圆形", "圆角矩形"].includes(g.name)
769
769
  ),
@@ -776,59 +776,59 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, 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, A) => {
780
- g.dataTransfer.effectAllowed = "copy", g.dataTransfer.setData("application/json", JSON.stringify(A));
781
- const z = g.currentTarget.querySelector(
779
+ }, k = (g, W) => {
780
+ g.dataTransfer.effectAllowed = "copy", g.dataTransfer.setData("application/json", JSON.stringify(W));
781
+ const O = g.currentTarget.querySelector(
782
782
  ".material-preview"
783
783
  );
784
- z && g.dataTransfer.setDragImage(z, 20, 20);
784
+ O && g.dataTransfer.setDragImage(O, 20, 20);
785
785
  }, v = (g) => {
786
786
  g.type === "LINE" && i(g);
787
- }, N = (g, A = !1) => {
788
- const z = A === !0, T = n === "line-draw" && z && a.material?.id === g.id;
787
+ }, I = (g, W = !1) => {
788
+ const O = W === !0, X = n === "line-draw" && O && a.material?.id === g.id;
789
789
  return /* @__PURE__ */ e(
790
- Ye.Item,
790
+ $e.Item,
791
791
  {
792
- draggable: !z,
793
- onDragStart: (Y) => I(Y, g),
794
- onClick: () => z && v(g),
792
+ draggable: !O,
793
+ onDragStart: ($) => k($, g),
794
+ onClick: () => O && v(g),
795
795
  className: `
796
796
  rounded-lg transition-all duration-200 select-none
797
- ${z ? "cursor-pointer" : "cursor-move"}
797
+ ${O ? "cursor-pointer" : "cursor-move"}
798
798
  hover:bg-gray-100
799
- ${T ? "bg-blue-50 ring-2 ring-blue-400" : ""}
799
+ ${X ? "bg-blue-50 ring-2 ring-blue-400" : ""}
800
800
  `,
801
801
  actions: [
802
- z ? /* @__PURE__ */ e(
803
- K,
802
+ O ? /* @__PURE__ */ e(
803
+ Z,
804
804
  {
805
805
  type: "text",
806
806
  size: "small",
807
- icon: /* @__PURE__ */ e(ut, {}),
808
- onClick: (Y) => {
809
- Y.stopPropagation(), v(g);
807
+ icon: /* @__PURE__ */ e(ft, {}),
808
+ onClick: ($) => {
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(at, {}),
822
- onClick: (Y) => {
823
- Y.stopPropagation(), t(g.id);
821
+ icon: /* @__PURE__ */ e(ot, {}),
822
+ onClick: ($) => {
823
+ $.stopPropagation(), t(g.id);
824
824
  }
825
825
  },
826
826
  "delete"
827
827
  )
828
828
  ].filter(Boolean),
829
- children: /* @__PURE__ */ u("div", { className: `flex items-center gap-3 w-full py-2 ${z ? "" : "pointer-events-none"}`, children: [
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
- Ht,
831
+ qt,
832
832
  {
833
833
  src: g.src,
834
834
  alt: g.name,
@@ -837,11 +837,11 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
837
837
  preview: !1
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
- /* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
841
- /* @__PURE__ */ e(nt, { strong: !0, className: "block truncate", children: g.name }),
842
- /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
843
- /* @__PURE__ */ e(nt, { type: "secondary", className: "text-xs", children: g.type }),
844
- T && /* @__PURE__ */ e(he, { color: "blue", className: "text-xs", children: "绘制中" })
840
+ /* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
841
+ /* @__PURE__ */ e(rt, { strong: !0, className: "block truncate", children: g.name }),
842
+ /* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
843
+ /* @__PURE__ */ e(rt, { type: "secondary", className: "text-xs", children: g.type }),
844
+ X && /* @__PURE__ */ e(ye, { color: "blue", className: "text-xs", children: "绘制中" })
845
845
  ] })
846
846
  ] })
847
847
  ] })
@@ -849,101 +849,101 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
849
849
  g.id
850
850
  );
851
851
  };
852
- return /* @__PURE__ */ u("div", { className: "h-full flex flex-col bg-white border-r border-gray-200", children: [
853
- /* @__PURE__ */ u("div", { className: "p-4 border-b border-gray-200", children: [
852
+ return /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-r border-gray-200", children: [
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(nt, { 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
- Ut,
858
+ Tt,
859
859
  {
860
860
  accept: ".svg",
861
- beforeUpload: C,
861
+ beforeUpload: S,
862
862
  showUploadList: !1,
863
- children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(Xt, {}), 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
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2", children: /* @__PURE__ */ u(
866
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2", children: /* @__PURE__ */ h(
867
867
  Ne,
868
868
  {
869
- activeKey: c,
869
+ activeKey: d,
870
870
  onChange: (g) => m(g),
871
871
  ghost: !0,
872
872
  expandIconPosition: "end",
873
873
  children: [
874
- /* @__PURE__ */ e(Oe, { header: "基础形状", children: /* @__PURE__ */ e(
875
- Ye,
874
+ /* @__PURE__ */ e(_e, { header: "基础形状", children: /* @__PURE__ */ e(
875
+ $e,
876
876
  {
877
- dataSource: o.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
- ue,
881
+ pe,
882
882
  {
883
883
  description: "暂无物料",
884
- image: ue.PRESENTED_IMAGE_SIMPLE
884
+ image: pe.PRESENTED_IMAGE_SIMPLE
885
885
  }
886
886
  )
887
887
  }
888
888
  }
889
889
  ) }, "basic"),
890
- /* @__PURE__ */ e(Oe, { header: "设备图标", children: /* @__PURE__ */ e(
891
- Ye,
890
+ /* @__PURE__ */ e(_e, { header: "设备图标", children: /* @__PURE__ */ e(
891
+ $e,
892
892
  {
893
- dataSource: o.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
- ue,
897
+ pe,
898
898
  {
899
899
  description: "暂无物料",
900
- image: ue.PRESENTED_IMAGE_SIMPLE
900
+ image: pe.PRESENTED_IMAGE_SIMPLE
901
901
  }
902
902
  )
903
903
  }
904
904
  }
905
905
  ) }, "device"),
906
- /* @__PURE__ */ e(Oe, { header: "文本", children: /* @__PURE__ */ e(
907
- Ye,
906
+ /* @__PURE__ */ e(_e, { header: "文本", children: /* @__PURE__ */ e(
907
+ $e,
908
908
  {
909
- dataSource: o.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
- ue,
913
+ pe,
914
914
  {
915
915
  description: "暂无物料",
916
- image: ue.PRESENTED_IMAGE_SIMPLE
916
+ image: pe.PRESENTED_IMAGE_SIMPLE
917
917
  }
918
918
  )
919
919
  }
920
920
  }
921
921
  ) }, "text"),
922
- /* @__PURE__ */ u(
923
- Oe,
922
+ /* @__PURE__ */ h(
923
+ _e,
924
924
  {
925
- header: /* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
925
+ header: /* @__PURE__ */ h("div", { className: "flex items-center justify-between", children: [
926
926
  /* @__PURE__ */ e("span", { children: "线条" }),
927
- n === "line-draw" && /* @__PURE__ */ e(he, { 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
- Ye,
931
+ $e,
932
932
  {
933
- dataSource: o.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
- ue,
937
+ pe,
938
938
  {
939
939
  description: "暂无物料",
940
- image: ue.PRESENTED_IMAGE_SIMPLE
940
+ image: pe.PRESENTED_IMAGE_SIMPLE
941
941
  }
942
942
  )
943
943
  }
944
944
  }
945
945
  ),
946
- n === "line-draw" && /* @__PURE__ */ u("div", { className: "mt-2 p-2 bg-blue-50 rounded text-xs text-blue-600", children: [
946
+ n === "line-draw" && /* @__PURE__ */ h("div", { className: "mt-2 p-2 bg-blue-50 rounded text-xs text-blue-600", children: [
947
947
  /* @__PURE__ */ e("div", { children: "点击线条物料开始绘制" }),
948
948
  /* @__PURE__ */ e("div", { children: "点击画布确定起点和终点" })
949
949
  ] })
@@ -951,33 +951,33 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
951
951
  },
952
952
  "line"
953
953
  ),
954
- o.group.length > 0 && /* @__PURE__ */ e(Oe, { header: "群组", children: /* @__PURE__ */ e(
955
- Ye,
954
+ u.group.length > 0 && /* @__PURE__ */ e(_e, { header: "群组", children: /* @__PURE__ */ e(
955
+ $e,
956
956
  {
957
- dataSource: o.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
- ue,
961
+ pe,
962
962
  {
963
963
  description: "暂无物料",
964
- image: ue.PRESENTED_IMAGE_SIMPLE
964
+ image: pe.PRESENTED_IMAGE_SIMPLE
965
965
  }
966
966
  )
967
967
  }
968
968
  }
969
969
  ) }, "group"),
970
- o.custom.length > 0 && /* @__PURE__ */ e(Oe, { header: "自定义", children: /* @__PURE__ */ e(
971
- Ye,
970
+ u.custom.length > 0 && /* @__PURE__ */ e(_e, { header: "自定义", children: /* @__PURE__ */ e(
971
+ $e,
972
972
  {
973
- dataSource: o.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
- ue,
977
+ pe,
978
978
  {
979
979
  description: "暂无物料",
980
- image: ue.PRESENTED_IMAGE_SIMPLE
980
+ image: pe.PRESENTED_IMAGE_SIMPLE
981
981
  }
982
982
  )
983
983
  }
@@ -986,30 +986,30 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, 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(nt, { type: "secondary", className: "text-xs", children: n === "line-draw" ? /* @__PURE__ */ e(Ae, { children: "💡 提示:点击绘制线段,可连续绘制多段线,双击结束绘制,ESC 取消" }) : /* @__PURE__ */ e(Ae, { 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: kt } = Yt, Dn = (l, f) => {
991
+ }, { Text: Dt } = Pt, Yn = (l, f) => {
992
992
  try {
993
- const t = f && Array.isArray(f) ? f.map((n, a) => n.paramsName) : ["A"], s = new Function(...t, l.expression)(...f.map((n) => n.value));
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(
995
995
  `Evaluating status [${l.name}] with data:`,
996
996
  f,
997
997
  "Result:",
998
- s
999
- ), s === !0;
998
+ c
999
+ ), c === !0;
1000
1000
  } catch (t) {
1001
1001
  return console.warn(`状态表达式执行失败 [${l.name}]:`, t), !1;
1002
1002
  }
1003
- }, $n = (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
- (s) => t.bindCodes?.includes(s.paramsCode)
1009
- )) : r = f, Dn(t, r))
1008
+ (c) => t.bindCodes?.includes(c.paramsCode)
1009
+ )) : r = f, Yn(t, r))
1010
1010
  return t;
1011
1011
  }
1012
- }, Yn = (l, f) => {
1012
+ }, Pn = (l, f) => {
1013
1013
  if (!f || !l)
1014
1014
  return { value: void 0 };
1015
1015
  if (Array.isArray(l)) {
@@ -1025,16 +1025,16 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1025
1025
  unit: l.unit
1026
1026
  };
1027
1027
  return { value: void 0 };
1028
- }, Ln = (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
- }, Xn = (l, f, t, r) => {
1033
+ }, Rn = (l, f, t, r) => {
1034
1034
  switch (l.type) {
1035
1035
  case "IMAGE":
1036
- const s = l, n = s.backgroundColor, a = s.fillColor;
1037
- let i = s.src;
1036
+ const c = l, n = c.backgroundColor, a = c.fillColor;
1037
+ let i = c.src;
1038
1038
  return a && i && i.includes("data:image/svg+xml") && (l.name === "矩形" ? i = `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="60"><rect width="100" height="60" fill="${a}" rx="4"/></svg>`)}` : l.name === "圆形" ? i = `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><circle cx="40" cy="40" r="38" fill="${a}"/></svg>`)}` : l.name === "圆角矩形" && (i = `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="60"><rect width="100" height="60" fill="${a}" rx="20"/></svg>`)}`)), /* @__PURE__ */ e(
1039
1039
  "div",
1040
1040
  {
@@ -1056,23 +1056,23 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1056
1056
  );
1057
1057
  case "TEXT":
1058
1058
  const p = l, {
1059
- label: c,
1059
+ label: d,
1060
1060
  value: m,
1061
- valueSourceCode: C,
1062
- unit: o,
1063
- decimals: I,
1061
+ valueSourceCode: S,
1062
+ unit: u,
1063
+ decimals: k,
1064
1064
  labelStyle: v,
1065
- valueStyle: N,
1065
+ valueStyle: I,
1066
1066
  customStyle: g
1067
- } = p.content || {}, { value: A, unit: z } = C ? Yn(f, C) : { value: void 0, unit: void 0 }, Y = Ln(A !== void 0 ? A : m, I), X = o || z || "";
1068
- return /* @__PURE__ */ u(
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
+ 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
- c && /* @__PURE__ */ e(
1075
- kt,
1074
+ d && /* @__PURE__ */ e(
1075
+ Dt,
1076
1076
  {
1077
1077
  style: {
1078
1078
  fontSize: 14,
@@ -1081,21 +1081,21 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1081
1081
  textAlign: "left",
1082
1082
  ...v
1083
1083
  },
1084
- children: c
1084
+ children: d
1085
1085
  }
1086
1086
  ),
1087
- Y && /* @__PURE__ */ u(
1088
- kt,
1087
+ $ && /* @__PURE__ */ h(
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
- Y,
1098
- X ? ` ${X}` : ""
1097
+ $,
1098
+ L ? ` ${L}` : ""
1099
1099
  ]
1100
1100
  }
1101
1101
  )
@@ -1103,37 +1103,37 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1103
1103
  }
1104
1104
  );
1105
1105
  case "LINE":
1106
- const ye = l, {
1107
- thickness: te = 2,
1108
- color: ve = "#d9d9d9",
1109
- dashed: ne = !1,
1110
- lineType: j = ne ? "dashed" : "solid",
1111
- lineWeight: O = te,
1106
+ const xe = l, {
1107
+ thickness: ne = 2,
1108
+ color: we = "#d9d9d9",
1109
+ dashed: ie = !1,
1110
+ lineType: A = ie ? "dashed" : "solid",
1111
+ lineWeight: J = ne,
1112
1112
  // 起点和终点的相对坐标
1113
- startX: V = 0,
1114
- startY: D = 0,
1115
- endX: h = 100,
1116
- endY: $ = 0
1117
- } = ye.config || {}, b = (($e) => {
1118
- const W = Math.max(O, 1);
1119
- switch ($e) {
1113
+ startX: G = 0,
1114
+ startY: T = 0,
1115
+ endX: s = 100,
1116
+ endY: q = 0
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":
1123
- return `${W * 8},${W * 4}`;
1123
+ return `${j * 8},${j * 4}`;
1124
1124
  case "center":
1125
- return `${W * 12},${W * 3},${W * 2},${W * 3}`;
1125
+ return `${j * 12},${j * 3},${j * 2},${j * 3}`;
1126
1126
  case "phantom":
1127
- return `${W * 12},${W * 3},${W * 2},${W * 3},${W * 2},${W * 3}`;
1127
+ return `${j * 12},${j * 3},${j * 2},${j * 3},${j * 2},${j * 3}`;
1128
1128
  case "dot":
1129
- return `${W},${W * 3}`;
1129
+ return `${j},${j * 3}`;
1130
1130
  case "dash-dot":
1131
- return `${W * 8},${W * 3},${W},${W * 3}`;
1131
+ return `${j * 8},${j * 3},${j},${j * 3}`;
1132
1132
  default:
1133
1133
  return "";
1134
1134
  }
1135
- })(j), Z = t ? "#1890ff" : ve;
1136
- return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */ u(
1135
+ })(A), M = t ? "#1890ff" : we;
1136
+ return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */ h(
1137
1137
  "svg",
1138
1138
  {
1139
1139
  className: "absolute top-0 left-0",
@@ -1144,12 +1144,12 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1144
1144
  /* @__PURE__ */ e(
1145
1145
  "line",
1146
1146
  {
1147
- x1: V,
1148
- y1: D,
1149
- x2: h,
1150
- y2: $,
1147
+ x1: G,
1148
+ y1: T,
1149
+ x2: s,
1150
+ y2: q,
1151
1151
  stroke: "transparent",
1152
- strokeWidth: Math.max(O, 10),
1152
+ strokeWidth: Math.max(J, 10),
1153
1153
  strokeLinecap: "round",
1154
1154
  strokeLinejoin: "round",
1155
1155
  style: { pointerEvents: "stroke", cursor: "pointer" }
@@ -1158,13 +1158,13 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1158
1158
  /* @__PURE__ */ e(
1159
1159
  "line",
1160
1160
  {
1161
- x1: V,
1162
- y1: D,
1163
- x2: h,
1164
- y2: $,
1165
- stroke: Z,
1166
- strokeWidth: O,
1167
- strokeDasharray: b,
1161
+ x1: G,
1162
+ y1: T,
1163
+ x2: s,
1164
+ y2: q,
1165
+ stroke: M,
1166
+ strokeWidth: J,
1167
+ strokeDasharray: Y,
1168
1168
  strokeLinecap: "round",
1169
1169
  strokeLinejoin: "round",
1170
1170
  style: { pointerEvents: "none" }
@@ -1174,231 +1174,231 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1174
1174
  }
1175
1175
  ) });
1176
1176
  case "CUSTOM":
1177
- const xe = l;
1178
- return xe.render ? xe.render({}) : /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "自定义组件" }) });
1177
+ const ee = l;
1178
+ return ee.render ? ee.render({}) : /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "自定义组件" }) });
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
- }, Pn = ({
1182
+ }, _n = ({
1183
1183
  node: l,
1184
1184
  isSelected: f = !1,
1185
1185
  onClick: t,
1186
1186
  onMouseDown: r,
1187
- data: s,
1187
+ data: c,
1188
1188
  onUpdateNode: n,
1189
1189
  scale: a = 1
1190
1190
  }) => {
1191
- const { normalStyle: i, contentInfo: p, controlInfo: c } = l, { statusList: m } = p, { isClickable: C, isDraggable: o, isResizable: I } = c, v = ce(t);
1191
+ const { normalStyle: i, contentInfo: p, controlInfo: d } = l, { statusList: m } = p, { isClickable: S, isDraggable: u, isResizable: k } = d, v = ue(t);
1192
1192
  v.current = t;
1193
- const [N, g] = Q(null), A = ce(null), z = ce(null), T = ce(null), Y = ce(null), [X, ye] = Q(null), [te, ve] = Q(null), ne = ce(null), j = $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 S = $n(m, s);
1196
- return S || m[0];
1197
- }, [m, s]), O = j?.material, V = O?.type === "LINE", D = V ? O.config : null, h = i.scale ?? 1, $ = (i.width || 100) * h, k = (i.height || 100) * h, b = B(() => {
1198
- const S = Y.current?.closest('[data-canvas="true"]');
1199
- if (!S) return a;
1200
- const H = S.getBoundingClientRect(), L = parseFloat(S.style.width);
1201
- return L ? H.width / L : a;
1202
- }, [a]), Z = B((S, H) => {
1203
- S.stopPropagation(), S.preventDefault(), A.current = {
1204
- mouseX: S.clientX,
1205
- mouseY: S.clientY,
1206
- startX: D?.startX || 0,
1207
- startY: D?.startY || 0,
1208
- endX: D?.endX || 0,
1209
- endY: D?.endY || 0,
1195
+ const C = Xn(m, c);
1196
+ return C || m[0];
1197
+ }, [m, c]), J = A?.material, G = J?.type === "LINE", T = G ? J.config : null, s = i.scale ?? 1, q = (i.width || 100) * s, b = (i.height || 100) * s, Y = V(() => {
1198
+ const C = $.current?.closest('[data-canvas="true"]');
1199
+ if (!C) return a;
1200
+ const z = C.getBoundingClientRect(), R = parseFloat(C.style.width);
1201
+ return R ? z.width / R : a;
1202
+ }, [a]), M = V((C, z) => {
1203
+ C.stopPropagation(), C.preventDefault(), W.current = {
1204
+ mouseX: C.clientX,
1205
+ mouseY: C.clientY,
1206
+ startX: T?.startX || 0,
1207
+ startY: T?.startY || 0,
1208
+ endX: T?.endX || 0,
1209
+ endY: T?.endY || 0,
1210
1210
  nodeX: i.x || 0,
1211
1211
  nodeY: i.y || 0
1212
- }, g(H);
1213
- }, [D, i.x, i.y]);
1212
+ }, g(z);
1213
+ }, [T, i.x, i.y]);
1214
1214
  me(() => {
1215
- if (!N || !V || !D || !n) return;
1216
- const S = (L) => {
1217
- const P = A.current;
1218
- if (!P || !Y.current) return;
1219
- const de = b(), be = (L.clientX - P.mouseX) / de, re = (L.clientY - P.mouseY) / de;
1220
- let J = P.startX, ae = P.startY, ie = P.endX, oe = P.endY, Pe = P.nodeX, Te = P.nodeY;
1221
- N === "start" ? (J = P.startX + be, ae = P.startY + re, J < 0 && (Pe = P.nodeX + J, ie = P.endX - J, J = 0), ae < 0 && (Te = P.nodeY + ae, oe = P.endY - ae, ae = 0)) : (ie = P.endX + be, oe = P.endY + re, ie < 0 && (Pe = P.nodeX + ie, J = P.startX - ie, ie = 0), oe < 0 && (Te = P.nodeY + oe, ae = P.startY - oe, oe = 0));
1222
- const We = Math.max((D.lineWeight || 2) * 2, 4), Qe = Math.max(J, ie), et = Math.max(ae, oe), _e = Math.max(Qe, We), ke = Math.max(et, We);
1223
- z.current = {
1224
- nodeX: Pe,
1225
- nodeY: Te,
1226
- width: _e,
1227
- height: ke,
1228
- startX: J,
1229
- startY: ae,
1230
- endX: ie,
1231
- endY: oe
1215
+ if (!I || !G || !T || !n) return;
1216
+ const C = (R) => {
1217
+ const D = W.current;
1218
+ if (!D || !$.current) return;
1219
+ const he = Y(), fe = (R.clientX - D.mouseX) / he, ae = (R.clientY - D.mouseY) / he;
1220
+ let K = D.startX, oe = D.startY, se = D.endX, ce = D.endY, Xe = D.nodeX, Pe = D.nodeY;
1221
+ I === "start" ? (K = D.startX + fe, oe = D.startY + ae, K < 0 && (Xe = D.nodeX + K, se = D.endX - K, K = 0), oe < 0 && (Pe = D.nodeY + oe, ce = D.endY - oe, oe = 0)) : (se = D.endX + fe, ce = D.endY + ae, se < 0 && (Xe = D.nodeX + se, K = D.startX - se, se = 0), ce < 0 && (Pe = D.nodeY + ce, oe = D.startY - ce, ce = 0));
1222
+ const et = Math.max((T.lineWeight || 2) * 2, 4), tt = Math.max(K, se), nt = Math.max(oe, ce), We = Math.max(tt, et), Te = Math.max(nt, et);
1223
+ O.current = {
1224
+ nodeX: Xe,
1225
+ nodeY: Pe,
1226
+ width: We,
1227
+ height: Te,
1228
+ startX: K,
1229
+ startY: oe,
1230
+ endX: se,
1231
+ endY: ce
1232
1232
  };
1233
- const we = Y.current;
1234
- we.style.left = `${Pe}px`, we.style.top = `${Te}px`, we.style.width = `${_e}px`, we.style.height = `${ke}px`, we.querySelectorAll("svg line").forEach((M) => {
1235
- M.setAttribute("x1", String(J)), M.setAttribute("y1", String(ae)), M.setAttribute("x2", String(ie)), M.setAttribute("y2", String(oe));
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 d = we.querySelector('[data-handle="start"]'), y = we.querySelector('[data-handle="end"]');
1238
- d && (d.style.left = `${J - 6}px`, d.style.top = `${ae - 6}px`), y && (y.style.left = `${ie - 6}px`, y.style.top = `${oe - 6}px`);
1239
- }, H = () => {
1240
- const L = z.current;
1241
- L && n(l.id, {
1237
+ const Fe = ge.querySelector('[data-handle="start"]'), De = ge.querySelector('[data-handle="end"]');
1238
+ Fe && (Fe.style.left = `${K - 6}px`, Fe.style.top = `${oe - 6}px`), De && (De.style.left = `${se - 6}px`, De.style.top = `${ce - 6}px`);
1239
+ }, z = () => {
1240
+ const R = O.current;
1241
+ R && n(l.id, {
1242
1242
  normalStyle: {
1243
1243
  ...i,
1244
- x: L.nodeX,
1245
- y: L.nodeY,
1246
- width: L.width,
1247
- height: L.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,
1251
- statusList: m.map((P) => ({
1252
- ...P,
1253
- material: P.material.type === "LINE" ? {
1254
- ...P.material,
1251
+ statusList: m.map((D) => ({
1252
+ ...D,
1253
+ material: D.material.type === "LINE" ? {
1254
+ ...D.material,
1255
1255
  config: {
1256
- ...D,
1257
- startX: L.startX,
1258
- startY: L.startY,
1259
- endX: L.endX,
1260
- endY: L.endY
1256
+ ...T,
1257
+ startX: R.startX,
1258
+ startY: R.startY,
1259
+ endX: R.endX,
1260
+ endY: R.endY
1261
1261
  }
1262
- } : P.material
1262
+ } : D.material
1263
1263
  }))
1264
1264
  }
1265
- }), g(null), A.current = null, z.current = null;
1265
+ }), g(null), W.current = null, O.current = null;
1266
1266
  };
1267
- return window.addEventListener("mousemove", S), window.addEventListener("mouseup", H), () => {
1268
- window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", H);
1267
+ return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1268
+ window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1269
1269
  };
1270
- }, [N, V, D, l.id, i, p, m, n, b]), me(() => {
1271
- if (!X || !n) return;
1272
- const S = (L) => {
1273
- if (!Y.current) return;
1274
- const P = b(), de = (L.clientX - X.startX) / P, be = (L.clientY - X.startY) / P;
1275
- let re = X.startWidth, J = X.startHeight, ae = X.startNodeX, ie = X.startNodeY;
1276
- switch (X.corner) {
1270
+ }, [I, G, T, l.id, i, p, m, n, Y]), me(() => {
1271
+ if (!L || !n) return;
1272
+ const C = (R) => {
1273
+ if (!$.current) return;
1274
+ const D = Y(), he = (R.clientX - L.startX) / D, fe = (R.clientY - L.startY) / D;
1275
+ let ae = L.startWidth, K = L.startHeight, oe = L.startNodeX, se = L.startNodeY;
1276
+ switch (L.corner) {
1277
1277
  case "se":
1278
- re = Math.max(20, X.startWidth + de), J = Math.max(20, X.startHeight + be);
1278
+ ae = Math.max(20, L.startWidth + he), K = Math.max(20, L.startHeight + fe);
1279
1279
  break;
1280
1280
  case "sw":
1281
- re = Math.max(20, X.startWidth - de), J = Math.max(20, X.startHeight + be), ae = X.startNodeX + (X.startWidth - re);
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
- re = Math.max(20, X.startWidth + de), J = Math.max(20, X.startHeight - be), ie = X.startNodeY + (X.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
- re = Math.max(20, X.startWidth - de), J = Math.max(20, X.startHeight - be), ae = X.startNodeX + (X.startWidth - re), ie = X.startNodeY + (X.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
- T.current = { x: ae, y: ie, width: re, height: J };
1291
- const oe = Y.current;
1292
- oe.style.left = `${ae}px`, oe.style.top = `${ie}px`, oe.style.width = `${re}px`, oe.style.height = `${J}px`;
1293
- }, H = () => {
1294
- const L = T.current;
1295
- L && n(l.id, {
1290
+ X.current = { x: oe, y: se, width: ae, height: K };
1291
+ const ce = $.current;
1292
+ ce.style.left = `${oe}px`, ce.style.top = `${se}px`, ce.style.width = `${ae}px`, ce.style.height = `${K}px`;
1293
+ }, z = () => {
1294
+ const R = X.current;
1295
+ R && n(l.id, {
1296
1296
  normalStyle: {
1297
1297
  ...i,
1298
- x: L.x,
1299
- y: L.y,
1300
- width: L.width,
1301
- height: L.height
1298
+ x: R.x,
1299
+ y: R.y,
1300
+ width: R.width,
1301
+ height: R.height
1302
1302
  }
1303
- }), ye(null), T.current = null;
1303
+ }), xe(null), X.current = null;
1304
1304
  };
1305
- return window.addEventListener("mousemove", S), window.addEventListener("mouseup", H), () => {
1306
- window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", H);
1305
+ return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1306
+ window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1307
1307
  };
1308
- }, [X, n, l.id, i, b]);
1309
- const xe = B((S, H) => {
1310
- S.stopPropagation(), S.preventDefault(), ye({
1311
- corner: H,
1312
- startX: S.clientX,
1313
- startY: S.clientY,
1308
+ }, [L, n, l.id, i, Y]);
1309
+ const ee = V((C, z) => {
1310
+ C.stopPropagation(), C.preventDefault(), xe({
1311
+ corner: z,
1312
+ startX: C.clientX,
1313
+ startY: C.clientY,
1314
1314
  startWidth: i.width || 100,
1315
1315
  startHeight: i.height || 100,
1316
1316
  startNodeX: i.x || 0,
1317
1317
  startNodeY: i.y || 0
1318
1318
  });
1319
- }, [i.width, i.height, i.x, i.y]), $e = B((S) => {
1320
- S.stopPropagation(), S.preventDefault();
1321
- const H = Y.current?.getBoundingClientRect();
1322
- H && ve({
1323
- startX: S.clientX,
1324
- startY: S.clientY,
1319
+ }, [i.width, i.height, i.x, i.y]), je = V((C) => {
1320
+ C.stopPropagation(), C.preventDefault();
1321
+ const z = $.current?.getBoundingClientRect();
1322
+ z && we({
1323
+ startX: C.clientX,
1324
+ startY: C.clientY,
1325
1325
  startAngle: i.rotate || 0,
1326
- centerX: H.left + H.width / 2,
1327
- centerY: H.top + H.height / 2
1326
+ centerX: z.left + z.width / 2,
1327
+ centerY: z.top + z.height / 2
1328
1328
  });
1329
1329
  }, [i.rotate]);
1330
1330
  me(() => {
1331
- if (!te) return;
1332
- const S = (L) => {
1333
- const P = L.clientX - te.centerX, de = L.clientY - te.centerY;
1334
- let re = (Math.atan2(de, P) * (180 / Math.PI) + 90) % 360;
1335
- if (re < 0 && (re += 360), ne.current = re, Y.current) {
1336
- const J = i.transform || "";
1337
- Y.current.style.transform = `rotate(${re}deg) ${J}`.trim();
1331
+ if (!ne) return;
1332
+ const C = (R) => {
1333
+ const D = R.clientX - ne.centerX, he = R.clientY - ne.centerY;
1334
+ let ae = (Math.atan2(he, D) * (180 / Math.PI) + 90) % 360;
1335
+ if (ae < 0 && (ae += 360), ie.current = ae, $.current) {
1336
+ const K = i.transform || "";
1337
+ $.current.style.transform = `rotate(${ae}deg) ${K}`.trim();
1338
1338
  }
1339
- }, H = () => {
1340
- const L = ne.current ?? te.startAngle;
1341
- ne.current = null, n && n(l.id, {
1339
+ }, z = () => {
1340
+ const R = ie.current ?? ne.startAngle;
1341
+ ie.current = null, n && n(l.id, {
1342
1342
  normalStyle: {
1343
1343
  ...i,
1344
- rotate: Math.round(L)
1344
+ rotate: Math.round(R)
1345
1345
  }
1346
- }), ve(null);
1346
+ }), we(null);
1347
1347
  };
1348
- return window.addEventListener("mousemove", S), window.addEventListener("mouseup", H), () => {
1349
- window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", H);
1348
+ return window.addEventListener("mousemove", C), window.addEventListener("mouseup", z), () => {
1349
+ window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", z);
1350
1350
  };
1351
- }, [te, n, l.id, i]);
1352
- const W = l.type === "group", it = {
1351
+ }, [ne, n, l.id, i]);
1352
+ const j = l.type === "group", st = {
1353
1353
  position: "absolute",
1354
1354
  left: i.x || 0,
1355
1355
  top: i.y || 0,
1356
- width: $,
1357
- height: k,
1356
+ width: q,
1357
+ height: b,
1358
1358
  // 群组节点不显示背景和边框,只作为容器
1359
- background: W ? "transparent" : i.background || "transparent",
1360
- backgroundImage: W ? void 0 : i.backgroundImage ? `url(${i.backgroundImage})` : void 0,
1359
+ background: j ? "transparent" : i.background || "transparent",
1360
+ backgroundImage: j ? void 0 : i.backgroundImage ? `url(${i.backgroundImage})` : void 0,
1361
1361
  backgroundSize: "cover",
1362
1362
  backgroundPosition: "center",
1363
1363
  padding: Array.isArray(i.padding) ? i.padding.join("px ") + "px" : i.padding,
1364
1364
  margin: Array.isArray(i.margin) ? i.margin.join("px ") + "px" : i.margin,
1365
- borderRadius: W ? void 0 : i.borderRadius,
1365
+ borderRadius: j ? void 0 : i.borderRadius,
1366
1366
  // 线条物料选中时不显示边框,而是通过高亮线条颜色来表示
1367
1367
  // 群组节点选中时显示边框,平时不显示
1368
- border: f && !V ? "2px solid #1890ff" : V || W ? "none" : i.border || "1px dashed transparent",
1368
+ border: f && !G ? "2px solid #1890ff" : G || j ? "none" : i.border || "1px dashed transparent",
1369
1369
  // 线条节点需要捕获点击事件,但由内部 SVG 的透明线处理具体点击区域
1370
1370
  pointerEvents: "auto",
1371
1371
  opacity: i.opacity ?? 1,
1372
- transform: `rotate(${ne.current ?? (i.rotate || 0)}deg) ${i.transform || ""}`.trim(),
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: o && !N ? "move" : C ? "pointer" : "default",
1375
+ cursor: u && !I ? "move" : S ? "pointer" : "default",
1376
1376
  boxSizing: "border-box",
1377
1377
  // 选中、线条和群组节点使用 visible overflow,避免裁剪手柄
1378
- overflow: f || V || W ? "visible" : "hidden"
1379
- }, Ke = D ? { x: D.startX || 0, y: D.startY || 0 } : { x: 0, y: 0 }, Xe = D ? { x: D.endX || 0, y: D.endY || 0 } : { x: 0, y: 0 };
1380
- return /* @__PURE__ */ u(
1378
+ overflow: f || G || j ? "visible" : "hidden"
1379
+ }, Ke = T ? { x: T.startX || 0, y: T.startY || 0 } : { x: 0, y: 0 }, Qe = T ? { x: T.endX || 0, y: T.endY || 0 } : { x: 0, y: 0 };
1380
+ return /* @__PURE__ */ h(
1381
1381
  "div",
1382
1382
  {
1383
- ref: Y,
1383
+ ref: $,
1384
1384
  "data-node-id": l.id,
1385
- style: it,
1386
- onClick: (S) => {
1387
- S.stopPropagation();
1388
- const H = v.current;
1389
- C && H && !N && !X && !te && H(S);
1385
+ style: st,
1386
+ onClick: (C) => {
1387
+ console.log("NodeRenderer onClick", l.id, "isClickable:", S);
1388
+ const z = v.current;
1389
+ S && z && !I && !L && !ne && (C.stopPropagation(), z(C));
1390
1390
  },
1391
- onMouseDown: (S) => {
1392
- o && r && !N && r(S);
1391
+ onMouseDown: (C) => {
1392
+ u && r && !I && r(C);
1393
1393
  },
1394
1394
  children: [
1395
- f && !V && !W && /* @__PURE__ */ u(Ae, { children: [
1395
+ f && !G && !j && /* @__PURE__ */ h(Oe, { children: [
1396
1396
  /* @__PURE__ */ e(
1397
1397
  "div",
1398
1398
  {
1399
1399
  className: "absolute top-0 left-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1400
1400
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "nw-resize", marginTop: "-6px", marginLeft: "-6px" },
1401
- onMouseDown: (S) => xe(S, "nw"),
1401
+ onMouseDown: (C) => ee(C, "nw"),
1402
1402
  title: "拖拽调整大小"
1403
1403
  }
1404
1404
  ),
@@ -1407,7 +1407,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1407
1407
  {
1408
1408
  className: "absolute top-0 right-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1409
1409
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "ne-resize", marginTop: "-6px", marginRight: "-6px" },
1410
- onMouseDown: (S) => xe(S, "ne"),
1410
+ onMouseDown: (C) => ee(C, "ne"),
1411
1411
  title: "拖拽调整大小"
1412
1412
  }
1413
1413
  ),
@@ -1416,7 +1416,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1416
1416
  {
1417
1417
  className: "absolute bottom-0 left-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1418
1418
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "sw-resize", marginBottom: "-6px", marginLeft: "-6px" },
1419
- onMouseDown: (S) => xe(S, "sw"),
1419
+ onMouseDown: (C) => ee(C, "sw"),
1420
1420
  title: "拖拽调整大小"
1421
1421
  }
1422
1422
  ),
@@ -1425,7 +1425,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1425
1425
  {
1426
1426
  className: "absolute bottom-0 right-0 w-3 h-3 bg-blue-500 border-2 border-white rounded-full",
1427
1427
  style: { zIndex: 9999, pointerEvents: "auto", cursor: "se-resize", marginBottom: "-6px", marginRight: "-6px" },
1428
- onMouseDown: (S) => xe(S, "se"),
1428
+ onMouseDown: (C) => ee(C, "se"),
1429
1429
  title: "拖拽调整大小"
1430
1430
  }
1431
1431
  ),
@@ -1434,7 +1434,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, 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: (S) => $e(S),
1437
+ onMouseDown: (C) => je(C),
1438
1438
  title: "拖拽旋转"
1439
1439
  }
1440
1440
  ),
@@ -1445,13 +1445,13 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1445
1445
  style: { zIndex: 9998, pointerEvents: "none", marginTop: "-14px", transform: "translateX(-50%)" }
1446
1446
  }
1447
1447
  ),
1448
- /* @__PURE__ */ u("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: [
1448
+ /* @__PURE__ */ h("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: [
1449
1449
  l.name,
1450
1450
  " ",
1451
- j ? `(${j.name})` : ""
1451
+ A ? `(${A.name})` : ""
1452
1452
  ] })
1453
1453
  ] }),
1454
- f && V && D && n && /* @__PURE__ */ u(Ae, { children: [
1454
+ f && G && T && n && /* @__PURE__ */ h(Oe, { children: [
1455
1455
  /* @__PURE__ */ e(
1456
1456
  "div",
1457
1457
  {
@@ -1462,7 +1462,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1462
1462
  top: Ke.y - 6,
1463
1463
  boxShadow: "0 0 4px rgba(0,0,0,0.3)"
1464
1464
  },
1465
- onMouseDown: (S) => Z(S, "start"),
1465
+ onMouseDown: (C) => M(C, "start"),
1466
1466
  title: "拖拽调整起点"
1467
1467
  }
1468
1468
  ),
@@ -1472,37 +1472,37 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, 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: Xe.x - 6,
1476
- top: Xe.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
- onMouseDown: (S) => Z(S, "end"),
1479
+ onMouseDown: (C) => M(C, "end"),
1480
1480
  title: "拖拽调整终点"
1481
1481
  }
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: O ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Xn(O, s, f) }) : W ? 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
- l.type === "group" && l.children && /* @__PURE__ */ e("div", { className: "absolute inset-0 pointer-events-none", children: l.children.map((S) => /* @__PURE__ */ e("div", { className: "pointer-events-auto", children: /* @__PURE__ */ e(
1490
- jt,
1489
+ l.type === "group" && l.children && /* @__PURE__ */ e("div", { className: "absolute inset-0 pointer-events-none", children: l.children.map((C) => /* @__PURE__ */ e("div", { className: "pointer-events-auto", children: /* @__PURE__ */ e(
1490
+ Ut,
1491
1491
  {
1492
- node: S,
1492
+ node: C,
1493
1493
  isSelected: !1,
1494
- data: s,
1494
+ data: c,
1495
1495
  onUpdateNode: n,
1496
1496
  scale: a
1497
1497
  }
1498
- ) }, S.id)) })
1498
+ ) }, C.id)) })
1499
1499
  ]
1500
1500
  }
1501
1501
  );
1502
- }, jt = Ce.memo(Pn, (l, f) => {
1503
- const t = l.node, r = f.node, s = 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
- return s && n && a;
1505
- }), Tn = [
1502
+ }, Ut = Ce.memo(_n, (l, f) => {
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
+ return c && n && a;
1505
+ }), zn = [
1506
1506
  "#1890ff",
1507
1507
  "#52c41a",
1508
1508
  "#faad14",
@@ -1519,28 +1519,28 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1519
1519
  "#000000",
1520
1520
  "#ff4d4f",
1521
1521
  "#73d13d"
1522
- ], je = ({
1522
+ ], Ae = ({
1523
1523
  value: l = "#1890ff",
1524
1524
  onChange: f,
1525
1525
  onChangeComplete: t
1526
1526
  }) => {
1527
- const [r, s] = Q(!1), [n, a] = Q(l), i = ce(null);
1527
+ const [r, c] = Q(!1), [n, a] = Q(l), i = ue(null);
1528
1528
  me(() => {
1529
1529
  a(l);
1530
1530
  }, [l]), me(() => {
1531
- const c = (m) => {
1532
- i.current && !i.current.contains(m.target) && (s(!1), t?.({ toHexString: () => n }));
1531
+ const d = (m) => {
1532
+ i.current && !i.current.contains(m.target) && (c(!1), t?.({ toHexString: () => n }));
1533
1533
  };
1534
- return r && document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
1534
+ return r && document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
1535
1535
  }, [r, t, n]);
1536
- const p = (c) => {
1537
- a(c), f?.({ toHexString: () => c });
1536
+ const p = (d) => {
1537
+ a(d), f?.({ toHexString: () => d });
1538
1538
  };
1539
- return /* @__PURE__ */ u("div", { ref: i, style: { position: "relative", display: "inline-block" }, children: [
1539
+ return /* @__PURE__ */ h("div", { ref: i, style: { position: "relative", display: "inline-block" }, children: [
1540
1540
  /* @__PURE__ */ e(
1541
1541
  "div",
1542
1542
  {
1543
- onClick: () => s(!r),
1543
+ onClick: () => c(!r),
1544
1544
  style: {
1545
1545
  width: 28,
1546
1546
  height: 28,
@@ -1551,7 +1551,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1551
1551
  }
1552
1552
  }
1553
1553
  ),
1554
- r && /* @__PURE__ */ u(
1554
+ r && /* @__PURE__ */ h(
1555
1555
  "div",
1556
1556
  {
1557
1557
  style: {
@@ -1566,29 +1566,29 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, 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: Tn.map((c) => /* @__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(c), s(!1), t?.({ toHexString: () => c });
1573
+ p(d), c(!1), t?.({ toHexString: () => d });
1574
1574
  },
1575
1575
  style: {
1576
1576
  width: 20,
1577
1577
  height: 20,
1578
- backgroundColor: c,
1579
- border: n === c ? "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
- c
1584
+ d
1585
1585
  )) }),
1586
1586
  /* @__PURE__ */ e(
1587
1587
  "input",
1588
1588
  {
1589
1589
  type: "color",
1590
1590
  value: n,
1591
- onChange: (c) => p(c.target.value),
1591
+ onChange: (d) => p(d.target.value),
1592
1592
  onBlur: () => t?.({ toHexString: () => n }),
1593
1593
  style: {
1594
1594
  width: "100%",
@@ -1603,65 +1603,67 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1603
1603
  }
1604
1604
  )
1605
1605
  ] });
1606
- }, { TextArea: _n } = le, zn = ({ defaultTestData: l }) => {
1607
- const f = ce(null), t = ce(null), r = ce(null), {
1608
- nodes: s,
1606
+ }, { TextArea: On } = re, An = ({ defaultTestData: l }) => {
1607
+ const f = ue(null), t = ue(null), r = ue(null), {
1608
+ nodes: c,
1609
1609
  selectedNodeId: n,
1610
1610
  mode: a,
1611
1611
  lineDrawing: i,
1612
1612
  viewport: p,
1613
- canvas: c,
1613
+ canvas: d,
1614
1614
  setViewport: m,
1615
- setCanvasConfig: C,
1616
- addNode: o,
1617
- selectNode: I,
1615
+ setCanvasConfig: S,
1616
+ addNode: u,
1617
+ selectNode: k,
1618
1618
  updateNode: v,
1619
- removeNode: N,
1619
+ removeNode: I,
1620
1620
  undo: g,
1621
- redo: A,
1622
- setMode: z,
1623
- startLineDrawing: T,
1624
- endLineDrawing: Y,
1625
- cancelLineDrawing: X
1626
- } = Re();
1627
- console.log("mode", a);
1628
- const [ye, te] = Q(!1), [, ve] = Q({}), ne = ce(!1), j = ce({ x: 0, y: 0 }), O = ce({ x: 0, y: 0, newX: 0, newY: 0 }), V = ce(null), [D, h] = Q({ start: null, end: null, isDrawing: !1 }), [$, k] = Q({ start: null, end: null }), [b, Z] = Q([]);
1629
- ce(!1);
1630
- const [xe, $e] = Q(!1), [W, it] = Q(
1621
+ redo: W,
1622
+ setMode: O,
1623
+ startLineDrawing: X,
1624
+ endLineDrawing: $,
1625
+ cancelLineDrawing: L
1626
+ } = ze(), [xe, ne] = Q(!1), [, we] = Q({}), ie = ue(a);
1627
+ me(() => {
1628
+ ie.current = a;
1629
+ }, [a]);
1630
+ const A = ue(!1), J = ue({ x: 0, y: 0 }), G = ue({ x: 0, y: 0, newX: 0, newY: 0 }), T = ue(null), [s, q] = Q({ start: null, end: null, isDrawing: !1 }), [b, Y] = Q({ start: null, end: null }), [M, ee] = Q([]);
1631
+ ue(!1);
1632
+ const [je, j] = Q(!1), [st, Ke] = Q(
1631
1633
  JSON.stringify(l, null, 2)
1632
- ), [Ke, Xe] = Q(!1), [S, H] = Q(!1), L = B((d, y) => {
1634
+ ), [Qe, C] = Q(!1), [z, R] = Q(!1), D = V((o, y) => {
1633
1635
  if (!t.current) return { x: 0, y: 0 };
1634
- const M = t.current.getBoundingClientRect(), E = d - M.left, x = y - M.top, _ = M.width / c.width, F = M.height / c.height, R = E / _, G = x / F;
1635
- return { x: Math.round(R), y: Math.round(G) };
1636
- }, [c.width, c.height]), P = B((d, y) => L(d, y), [L]), de = B(
1637
- (d, y, M = !0) => {
1636
+ const N = t.current.getBoundingClientRect(), E = o - N.left, x = y - N.top, P = N.width / d.width, F = N.height / d.height, U = E / P, B = x / F;
1637
+ return { x: Math.round(U), y: Math.round(B) };
1638
+ }, [d.width, d.height]), he = V((o, y) => D(o, y), [D]), fe = V(
1639
+ (o, y, N = !0) => {
1638
1640
  if (!i.material) return;
1639
- const E = i.material, x = E.config || {}, _ = x.lineWeight || x.thickness || 2, F = Math.min(d.x, y.x), R = Math.min(d.y, y.y), G = Math.round(d.x - F), q = Math.round(d.y - R), se = Math.round(y.x - F), fe = Math.round(y.y - R), ge = Math.max(_ * 2, 4), ze = Math.max(Math.abs(d.x - y.x), ge), Me = Math.max(Math.abs(d.y - y.y), ge), tt = {
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 = {
1640
1642
  ...E,
1641
- id: U(),
1643
+ id: H(),
1642
1644
  config: {
1643
1645
  color: x.color,
1644
- lineWeight: _,
1645
- thickness: _,
1646
+ lineWeight: P,
1647
+ thickness: P,
1646
1648
  lineType: x.lineType,
1647
- startX: G,
1648
- startY: q,
1649
- endX: se,
1650
- endY: fe
1649
+ startX: B,
1650
+ startY: _,
1651
+ endX: le,
1652
+ endY: de
1651
1653
  }
1652
- }, Ft = {
1653
- id: U(),
1654
+ }, Gt = {
1655
+ id: H(),
1654
1656
  name: `${E.name}_${Date.now()}`,
1655
1657
  type: "normal",
1656
1658
  normalStyle: {
1657
- width: ze,
1658
- height: Me,
1659
+ width: Re,
1660
+ height: ke,
1659
1661
  x: F,
1660
- y: R,
1662
+ y: U,
1661
1663
  background: "transparent"
1662
1664
  },
1663
1665
  contentInfo: {
1664
- statusList: [At(tt)],
1666
+ statusList: [Ft(lt)],
1665
1667
  currentStatusId: void 0
1666
1668
  },
1667
1669
  controlInfo: {
@@ -1671,184 +1673,201 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1671
1673
  isSelectable: !0
1672
1674
  }
1673
1675
  };
1674
- if (o(Ft, !1), M) {
1675
- const ft = { x: y.x, y: y.y };
1676
- h({
1677
- start: ft,
1678
- end: { ...ft },
1676
+ if (u(Gt, !1), N) {
1677
+ const yt = { x: y.x, y: y.y };
1678
+ q({
1679
+ start: yt,
1680
+ end: { ...yt },
1679
1681
  isDrawing: !0
1680
1682
  });
1681
1683
  } else
1682
- h({ start: null, end: null, isDrawing: !1 }), Y();
1684
+ q({ start: null, end: null, isDrawing: !1 }), $();
1683
1685
  },
1684
- [i.material, o, Y]
1685
- ), be = B(() => {
1686
- const d = f.current?.state;
1687
- d && m({
1688
- scale: d.scale,
1689
- positionX: d.positionX,
1690
- positionY: d.positionY
1686
+ [i.material, u, $]
1687
+ ), ae = V(() => {
1688
+ const o = f.current?.state;
1689
+ o && m({
1690
+ scale: o.scale,
1691
+ positionX: o.positionX,
1692
+ positionY: o.positionY
1691
1693
  });
1692
- }, [m]), re = B(
1693
- (d) => {
1694
- ne.current || a !== "box-select" && (d.target === t.current || d.target.dataset?.canvas === "true") && (I(null), Z([]));
1694
+ }, [m]), K = V(
1695
+ (o) => {
1696
+ A.current || a !== "box-select" && (o.target === t.current || o.target.dataset?.canvas === "true") && (k(null), ee([]));
1695
1697
  },
1696
- [I, a]
1697
- ), J = B(
1698
- (d) => {
1699
- if (d.button === 0) {
1698
+ [k, a]
1699
+ ), oe = V(
1700
+ (o) => {
1701
+ if (o.button === 0) {
1700
1702
  if (a === "line-draw" && i.material) {
1701
- d.stopPropagation();
1702
- const y = L(d.clientX, d.clientY);
1703
- D.isDrawing ? D.start && de(D.start, y, !0) : h({ 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 });
1704
1706
  return;
1705
1707
  }
1706
- if (a === "box-select" && !S) {
1707
- const y = P(d.clientX, d.clientY);
1708
- k({ start: y, end: y }), Z([]), d.preventDefault(), d.stopPropagation();
1708
+ if (a === "box-select" && !z) {
1709
+ const y = he(o.clientX, o.clientY);
1710
+ Y({ start: y, end: y }), ee([]), o.preventDefault(), o.stopPropagation();
1709
1711
  }
1710
1712
  }
1711
1713
  },
1712
- [a, i.material, D.isDrawing, D.start, S, de, L, P]
1713
- ), ae = B(
1714
- (d) => {
1715
- if (!(a !== "line-draw" || !i.material) && D.isDrawing && D.start) {
1716
- const y = L(d.clientX, d.clientY);
1717
- de(D.start, y, !1);
1714
+ [a, i.material, s.isDrawing, s.start, z, fe, D, he]
1715
+ ), se = V(
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);
1718
1720
  }
1719
1721
  },
1720
- [a, i.material, D.isDrawing, D.start, de, L]
1721
- ), ie = B((d) => {
1722
- d.preventDefault(), d.dataTransfer.dropEffect = "copy", te(!0);
1723
- }, []), oe = B((d) => {
1724
- d.preventDefault(), te(!1);
1725
- }, []), Pe = B(
1726
- (d) => {
1727
- if (d.preventDefault(), te(!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"))
1728
1730
  try {
1729
- const y = d.dataTransfer.getData("application/json");
1731
+ const y = o.dataTransfer.getData("application/json");
1730
1732
  if (!y) return;
1731
- const M = JSON.parse(y), E = L(d.clientX, d.clientY), x = E.x - 50, _ = E.y - 50, F = Mn(x, _, M);
1732
- o(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);
1733
1735
  } catch (y) {
1734
1736
  console.error("Failed to parse dropped material:", y);
1735
1737
  }
1736
1738
  },
1737
- [a, o, L]
1738
- ), Te = B(
1739
- (d, y) => {
1740
- a !== "select" || !y.controlInfo.isDraggable || (d.stopPropagation(), I(y.id), ne.current = !0, j.current = { x: d.clientX, y: d.clientY }, O.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 = {
1741
1743
  x: y.normalStyle.x || 0,
1742
1744
  y: y.normalStyle.y || 0,
1743
1745
  newX: y.normalStyle.x || 0,
1744
1746
  newY: y.normalStyle.y || 0
1745
- }, V.current = y, d.preventDefault());
1747
+ }, T.current = y, o.preventDefault());
1746
1748
  },
1747
- [a, I]
1749
+ [a, k]
1748
1750
  );
1749
1751
  me(() => {
1750
- const d = (x) => {
1751
- if (ne.current && n && V.current) {
1752
+ const o = (x) => {
1753
+ if (A.current && n && T.current) {
1752
1754
  if (!t.current) return;
1753
- const _ = t.current.getBoundingClientRect(), F = _.width / c.width, R = _.height / c.height, G = x.clientX - j.current.x, q = x.clientY - j.current.y, se = G / F, fe = q / R, ge = O.current.x + se, ze = O.current.y + fe, Me = 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(
1754
1756
  `[data-node-id="${n}"]`
1755
1757
  );
1756
- Me && (Me.style.left = `${ge}px`, Me.style.top = `${ze}px`), O.current.newX = ge, O.current.newY = ze;
1758
+ ke && (ke.style.left = `${ve}px`, ke.style.top = `${Re}px`), G.current.newX = ve, G.current.newY = Re;
1757
1759
  }
1758
- if (a === "box-select" && $.start) {
1759
- const _ = P(x.clientX, x.clientY);
1760
- k((F) => ({ ...F, end: _ }));
1760
+ if (a === "box-select" && b.start) {
1761
+ const P = he(x.clientX, x.clientY);
1762
+ Y((F) => ({ ...F, end: P }));
1761
1763
  }
1762
- if (a === "line-draw" && D.isDrawing) {
1763
- const _ = L(x.clientX, x.clientY);
1764
- h((F) => ({ ...F, end: _ }));
1764
+ if (a === "line-draw" && s.isDrawing) {
1765
+ const P = D(x.clientX, x.clientY);
1766
+ q((F) => ({ ...F, end: P }));
1765
1767
  }
1766
1768
  }, y = () => {
1767
- if (ne.current && n && V.current) {
1768
- const x = Re.getState(), _ = O.current.newX ?? O.current.x, F = O.current.newY ?? O.current.y;
1769
+ if (A.current && n && T.current) {
1770
+ const x = ze.getState(), P = G.current.newX ?? G.current.x, F = G.current.newY ?? G.current.y;
1769
1771
  x.updateNode(n, {
1770
1772
  normalStyle: {
1771
- ...V.current.normalStyle,
1772
- x: _,
1773
+ ...T.current.normalStyle,
1774
+ x: P,
1773
1775
  y: F
1774
1776
  }
1775
1777
  });
1776
1778
  }
1777
- if (ne.current = !1, V.current = null, ve({}), a === "box-select" && $.start && $.end) {
1778
- const x = Math.min($.start.x, $.end.x), _ = Math.max($.start.x, $.end.x), F = Math.min($.start.y, $.end.y), R = Math.max($.start.y, $.end.y), G = s.filter((q) => {
1779
- const se = q.normalStyle.x || 0, fe = q.normalStyle.y || 0, ge = q.normalStyle.width || 0, ze = q.normalStyle.height || 0, Me = se + ge / 2, tt = fe + ze / 2;
1780
- return Me >= x && Me <= _ && tt >= F && tt <= R;
1781
- }).map((q) => q.id);
1782
- Z(G), k({ 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 });
1783
1785
  }
1784
- }, M = (x) => {
1785
- x.key === "Escape" && a === "line-draw" && (h({ start: null, end: null, isDrawing: !1 }), X()), x.key === "Delete" && (n ? N(n) : b.length > 0 && (b.forEach((_) => N(_)), Z([]))), x.ctrlKey && x.key === "z" && (x.preventDefault(), g()), x.ctrlKey && x.key === "y" && (x.preventDefault(), A()), x.key === " " && !S && (x.preventDefault(), H(!0));
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 === " " && S && H(!1);
1789
+ x.key === " " && z && R(!1);
1788
1790
  };
1789
- return window.addEventListener("mousemove", d), window.addEventListener("mouseup", y), window.addEventListener("keydown", M), window.addEventListener("keyup", E), () => {
1790
- window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", y), window.removeEventListener("keydown", M), window.removeEventListener("keyup", E);
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);
1791
1793
  };
1792
1794
  }, [
1793
1795
  n,
1794
- $,
1795
- a,
1796
- D.isDrawing,
1797
1796
  b,
1798
- s,
1799
- c.width,
1800
- c.height,
1801
- N,
1797
+ a,
1798
+ s.isDrawing,
1799
+ M,
1800
+ c,
1801
+ d.width,
1802
+ d.height,
1803
+ I,
1802
1804
  g,
1803
- S,
1804
- A,
1805
- X,
1805
+ z,
1806
+ W,
1806
1807
  L,
1807
- P,
1808
- Z
1808
+ D,
1809
+ he,
1810
+ ee
1809
1811
  ]);
1810
- const We = B(() => {
1811
- const d = b.length > 0 ? b.map((M) => s.find((E) => E.id === M)).filter(Boolean) : n ? [s.find((M) => M.id === n)].filter(Boolean) : [];
1812
- 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;
1813
1815
  const y = [];
1814
- d.forEach((M) => {
1816
+ o.forEach((N) => {
1815
1817
  const E = {
1816
- ...M,
1817
- id: U(),
1818
- name: `${M.name}_副本`,
1818
+ ...N,
1819
+ id: H(),
1820
+ name: `${N.name}_副本`,
1819
1821
  normalStyle: {
1820
- ...M.normalStyle,
1821
- x: (M.normalStyle.x || 0) + 20,
1822
- y: (M.normalStyle.y || 0) + 20
1822
+ ...N.normalStyle,
1823
+ x: (N.normalStyle.x || 0) + 20,
1824
+ y: (N.normalStyle.y || 0) + 20
1823
1825
  }
1824
1826
  };
1825
- o(E), y.push(E.id);
1826
- }), y.length === 1 ? I(y[0]) : Z(y);
1827
- }, [n, b, s, o, I, Z]), Qe = B(() => {
1828
- if (b.length < 2) return;
1829
- const d = b.map((R) => s.find((G) => G.id === R)).filter((R) => !!R && R.type !== "group");
1830
- if (d.length < 2) return;
1831
- let y = 1 / 0, M = 1 / 0, E = -1 / 0, x = -1 / 0;
1832
- d.forEach((R) => {
1833
- const G = R.normalStyle.x || 0, q = R.normalStyle.y || 0, se = R.normalStyle.width || 0, fe = R.normalStyle.height || 0;
1834
- y = Math.min(y, G), M = Math.min(M, q), E = Math.max(E, G + se), x = Math.max(x, q + fe);
1827
+ u(E), y.push(E.id);
1828
+ }), y.length === 1 ? k(y[0]) : ee(y);
1829
+ }, [n, M, c, u, k, ee]), nt = V(() => {
1830
+ if (M.length < 2) return;
1831
+ const o = [];
1832
+ for (let U = 0; U < M.length; U++) {
1833
+ const B = M[U], _ = c.find((le) => le.id === B);
1834
+ if (_) {
1835
+ if (_?.type === "group") {
1836
+ _.children.forEach((de) => o.push({
1837
+ ...de,
1838
+ normalStyle: {
1839
+ ...de.normalStyle,
1840
+ x: (_.normalStyle.x || 0) + (de.normalStyle.x || 0),
1841
+ y: (_.normalStyle.y || 0) + (de.normalStyle.y || 0)
1842
+ }
1843
+ })), I(B);
1844
+ continue;
1845
+ }
1846
+ o.push(_);
1847
+ }
1848
+ }
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);
1835
1854
  });
1836
- const _ = d.map((R) => ({
1837
- ...R,
1855
+ const P = o.map((U) => ({
1856
+ ...U,
1838
1857
  normalStyle: {
1839
- ...R.normalStyle,
1840
- x: (R.normalStyle.x || 0) - y,
1841
- y: (R.normalStyle.y || 0) - M
1858
+ ...U.normalStyle,
1859
+ x: (U.normalStyle.x || 0) - y,
1860
+ y: (U.normalStyle.y || 0) - N
1842
1861
  }
1843
1862
  })), F = {
1844
- id: U(),
1863
+ id: H(),
1845
1864
  name: `群组_${Date.now()}`,
1846
1865
  type: "group",
1847
1866
  normalStyle: {
1848
1867
  x: y,
1849
- y: M,
1868
+ y: N,
1850
1869
  width: E - y,
1851
- height: x - M,
1870
+ height: x - N,
1852
1871
  background: "transparent"
1853
1872
  },
1854
1873
  contentInfo: {
@@ -1861,14 +1880,14 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1861
1880
  isResizable: !0,
1862
1881
  isSelectable: !0
1863
1882
  },
1864
- children: _
1883
+ children: P
1865
1884
  };
1866
- b.forEach((R) => N(R)), o(F), Z([]), I(F.id);
1867
- }, [b, s, N, o, I]), et = B(() => {
1868
- const d = b.length > 0 ? b.map((y) => s.find((M) => M.id === y)).filter((y) => !!y && y.type === "group") : n ? [s.find((y) => y.id === n)].filter((y) => !!y && y.type === "group") : [];
1869
- 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) => {
1870
1889
  if (!y.children || y.children.length === 0) return;
1871
- const M = y.children.map((E) => ({
1890
+ const N = y.children.map((E) => ({
1872
1891
  ...E,
1873
1892
  normalStyle: {
1874
1893
  ...E.normalStyle,
@@ -1876,70 +1895,70 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1876
1895
  y: (y.normalStyle.y || 0) + (E.normalStyle.y || 0)
1877
1896
  }
1878
1897
  }));
1879
- N(y.id), M.forEach((E) => o(E));
1880
- }), Z([]), I(null));
1881
- }, [n, b, s, N, o, I, Z]), _e = B(
1882
- (d) => {
1883
- if (b.length < 2) return;
1884
- const y = b.map((G) => s.find((q) => q.id === G)).filter((G) => !!G && G.type !== "group");
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
+ if (M.length < 2) return;
1903
+ const y = M.map((B) => c.find((_) => _.id === B)).filter((B) => !!B && B.type !== "group");
1885
1904
  if (y.length < 2) return;
1886
- let M = 1 / 0, E = -1 / 0, x = 1 / 0, _ = -1 / 0;
1887
- y.forEach((G) => {
1888
- const q = G.normalStyle.x || 0, se = G.normalStyle.y || 0;
1889
- M = Math.min(M, q), E = Math.max(E, q), x = Math.min(x, se), _ = Math.max(_, se);
1905
+ let N = 1 / 0, E = -1 / 0, x = 1 / 0, P = -1 / 0;
1906
+ y.forEach((B) => {
1907
+ const _ = B.normalStyle.x || 0, le = B.normalStyle.y || 0;
1908
+ N = Math.min(N, _), E = Math.max(E, _), x = Math.min(x, le), P = Math.max(P, le);
1890
1909
  });
1891
- const F = [...y].sort((G, q) => d === "horizontal" ? (G.normalStyle.x || 0) - (q.normalStyle.x || 0) : (G.normalStyle.y || 0) - (q.normalStyle.y || 0)), R = F.length;
1892
- if (d === "horizontal") {
1893
- const q = (E - M) / (R - 1);
1894
- F.forEach((se, fe) => {
1895
- const ge = M + q * fe;
1896
- v(se.id, {
1897
- normalStyle: { ...se.normalStyle, x: ge }
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
+ F.forEach((le, de) => {
1914
+ const ve = N + _ * de;
1915
+ v(le.id, {
1916
+ normalStyle: { ...le.normalStyle, x: ve }
1898
1917
  });
1899
1918
  });
1900
1919
  } else {
1901
- const q = (_ - x) / (R - 1);
1902
- F.forEach((se, fe) => {
1903
- const ge = x + q * fe;
1904
- v(se.id, {
1905
- normalStyle: { ...se.normalStyle, y: ge }
1920
+ const _ = (P - x) / (U - 1);
1921
+ F.forEach((le, de) => {
1922
+ const ve = x + _ * de;
1923
+ v(le.id, {
1924
+ normalStyle: { ...le.normalStyle, y: ve }
1906
1925
  });
1907
1926
  });
1908
1927
  }
1909
1928
  },
1910
- [b, s, v]
1911
- ), ke = B(
1912
- (d) => {
1913
- if (b.length < 2) return;
1914
- const y = Re.getState(), M = b.map((x) => s.find((_) => _.id === x)).filter((x) => !!x && x.type !== "group");
1929
+ [M, c, v]
1930
+ ), ge = V(
1931
+ (o) => {
1915
1932
  if (M.length < 2) return;
1933
+ const y = ze.getState(), N = M.map((x) => c.find((P) => P.id === x)).filter((x) => !!x && x.type !== "group");
1934
+ if (N.length < 2) return;
1916
1935
  let E = 0;
1917
- switch (d) {
1936
+ switch (o) {
1918
1937
  case "left":
1919
- E = Math.min(...M.map((x) => x.normalStyle.x || 0));
1938
+ E = Math.min(...N.map((x) => x.normalStyle.x || 0));
1920
1939
  break;
1921
1940
  case "right":
1922
1941
  E = Math.max(
1923
- ...M.map((x) => (x.normalStyle.x || 0) + (x.normalStyle.width || 0))
1942
+ ...N.map((x) => (x.normalStyle.x || 0) + (x.normalStyle.width || 0))
1924
1943
  );
1925
1944
  break;
1926
1945
  case "top":
1927
- E = Math.min(...M.map((x) => x.normalStyle.y || 0));
1946
+ E = Math.min(...N.map((x) => x.normalStyle.y || 0));
1928
1947
  break;
1929
1948
  case "bottom":
1930
1949
  E = Math.max(
1931
- ...M.map((x) => (x.normalStyle.y || 0) + (x.normalStyle.height || 0))
1950
+ ...N.map((x) => (x.normalStyle.y || 0) + (x.normalStyle.height || 0))
1932
1951
  );
1933
1952
  break;
1934
1953
  }
1935
- M.forEach((x) => {
1936
- let _ = x.normalStyle.x || 0, F = x.normalStyle.y || 0;
1937
- switch (d) {
1954
+ N.forEach((x) => {
1955
+ let P = x.normalStyle.x || 0, F = x.normalStyle.y || 0;
1956
+ switch (o) {
1938
1957
  case "left":
1939
- _ = E;
1958
+ P = E;
1940
1959
  break;
1941
1960
  case "right":
1942
- _ = E - (x.normalStyle.width || 0);
1961
+ P = E - (x.normalStyle.width || 0);
1943
1962
  break;
1944
1963
  case "top":
1945
1964
  F = E;
@@ -1949,170 +1968,185 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
1949
1968
  break;
1950
1969
  }
1951
1970
  y.updateNode(x.id, {
1952
- normalStyle: { ...x.normalStyle, x: _, y: F }
1971
+ normalStyle: { ...x.normalStyle, x: P, y: F }
1953
1972
  });
1954
1973
  });
1955
1974
  },
1956
- [b, s]
1957
- ), we = [
1975
+ [M, c]
1976
+ ), pt = [
1958
1977
  {
1959
- icon: /* @__PURE__ */ e(on, {}),
1978
+ icon: /* @__PURE__ */ e(dn, {}),
1960
1979
  title: "选择模式",
1961
1980
  active: a === "select",
1962
1981
  onClick: () => {
1963
- z("select");
1982
+ O("select");
1964
1983
  }
1965
1984
  },
1966
1985
  {
1967
- icon: /* @__PURE__ */ e(gt, {}),
1986
+ icon: /* @__PURE__ */ e(vt, {}),
1968
1987
  title: "框选模式",
1969
1988
  active: a === "box-select",
1970
1989
  onClick: () => {
1971
- z("box-select"), Z([]);
1990
+ O("box-select"), ee([]);
1972
1991
  }
1973
1992
  },
1974
1993
  {
1975
- icon: /* @__PURE__ */ e(sn, {}),
1994
+ icon: /* @__PURE__ */ e(un, {}),
1976
1995
  title: "拖拽模式",
1977
1996
  active: a === "drag",
1978
1997
  onClick: () => {
1979
- z("drag");
1998
+ O("drag");
1980
1999
  }
1981
2000
  },
1982
2001
  {
1983
- icon: /* @__PURE__ */ e(ut, {}),
2002
+ icon: /* @__PURE__ */ e(ft, {}),
1984
2003
  title: "线条绘制",
1985
2004
  active: a === "line-draw",
1986
2005
  onClick: () => {
1987
- z("line-draw");
2006
+ O("line-draw");
1988
2007
  }
1989
2008
  },
1990
2009
  {
1991
- icon: /* @__PURE__ */ e(cn, {}),
2010
+ icon: /* @__PURE__ */ e(hn, {}),
1992
2011
  title: "预览模式",
1993
2012
  active: a === "preview",
1994
2013
  onClick: () => {
1995
- z("preview");
2014
+ O("preview");
1996
2015
  }
1997
2016
  }
1998
- ], mt = $t(
2017
+ ], Fe = Xt(
1999
2018
  () => [
2000
- { icon: /* @__PURE__ */ e(qt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2001
- { icon: /* @__PURE__ */ e(Bt, {}), title: "重做 (Ctrl+Y)", onClick: A },
2019
+ { icon: /* @__PURE__ */ e(Vt, {}), title: "撤销 (Ctrl+Z)", onClick: g },
2020
+ { icon: /* @__PURE__ */ e(Zt, {}), title: "重做 (Ctrl+Y)", onClick: W },
2002
2021
  {
2003
- icon: /* @__PURE__ */ e(Pt, {}),
2022
+ icon: /* @__PURE__ */ e(_t, {}),
2004
2023
  title: "复制节点",
2005
- disabled: !n && b.length === 0,
2006
- onClick: We
2024
+ disabled: !n && M.length === 0,
2025
+ onClick: tt
2007
2026
  },
2008
2027
  {
2009
- icon: /* @__PURE__ */ e(gt, {}),
2028
+ icon: /* @__PURE__ */ e(vt, {}),
2010
2029
  title: "组合选中节点",
2011
- disabled: b.length < 2,
2012
- onClick: Qe
2030
+ disabled: M.length < 2,
2031
+ onClick: nt
2013
2032
  },
2014
2033
  {
2015
- icon: /* @__PURE__ */ e(Vt, {}),
2034
+ icon: /* @__PURE__ */ e(Jt, {}),
2016
2035
  title: "解除组合",
2017
- disabled: !n && b.length === 0,
2018
- onClick: et
2036
+ disabled: !n && M.length === 0,
2037
+ onClick: We
2019
2038
  },
2020
2039
  {
2021
- icon: /* @__PURE__ */ e(Zt, {}),
2040
+ icon: /* @__PURE__ */ e(Kt, {}),
2022
2041
  title: "左对齐",
2023
- disabled: b.length < 2,
2024
- onClick: () => ke("left")
2042
+ disabled: M.length < 2,
2043
+ onClick: () => ge("left")
2025
2044
  },
2026
2045
  {
2027
- icon: /* @__PURE__ */ e(Jt, {}),
2046
+ icon: /* @__PURE__ */ e(Qt, {}),
2028
2047
  title: "右对齐",
2029
- disabled: b.length < 2,
2030
- onClick: () => ke("right")
2048
+ disabled: M.length < 2,
2049
+ onClick: () => ge("right")
2031
2050
  },
2032
2051
  {
2033
- icon: /* @__PURE__ */ e(Kt, {}),
2052
+ icon: /* @__PURE__ */ e(en, {}),
2034
2053
  title: "上对齐",
2035
- disabled: b.length < 2,
2036
- onClick: () => ke("top")
2054
+ disabled: M.length < 2,
2055
+ onClick: () => ge("top")
2037
2056
  },
2038
2057
  {
2039
- icon: /* @__PURE__ */ e(Qt, {}),
2058
+ icon: /* @__PURE__ */ e(tn, {}),
2040
2059
  title: "下对齐",
2041
- disabled: b.length < 2,
2042
- onClick: () => ke("bottom")
2060
+ disabled: M.length < 2,
2061
+ onClick: () => ge("bottom")
2043
2062
  },
2044
2063
  {
2045
- icon: /* @__PURE__ */ e(en, {}),
2064
+ icon: /* @__PURE__ */ e(nn, {}),
2046
2065
  title: "水平分布",
2047
- disabled: b.length < 2,
2048
- onClick: () => _e("horizontal")
2066
+ disabled: M.length < 2,
2067
+ onClick: () => Te("horizontal")
2049
2068
  },
2050
2069
  {
2051
- icon: /* @__PURE__ */ e(tn, {}),
2070
+ icon: /* @__PURE__ */ e(ln, {}),
2052
2071
  title: "垂直分布",
2053
- disabled: b.length < 2,
2054
- onClick: () => _e("vertical")
2072
+ disabled: M.length < 2,
2073
+ onClick: () => Te("vertical")
2055
2074
  },
2056
2075
  {
2057
- icon: /* @__PURE__ */ e(nn, {}),
2076
+ icon: /* @__PURE__ */ e(rn, {}),
2058
2077
  title: "画布配置",
2059
- onClick: () => Xe(!0)
2078
+ onClick: () => C(!0)
2060
2079
  },
2061
2080
  {
2062
- icon: /* @__PURE__ */ e(ln, {}),
2081
+ icon: /* @__PURE__ */ e(an, {}),
2063
2082
  title: "数据模拟",
2064
2083
  type: "primary",
2065
- onClick: () => $e(!0)
2084
+ onClick: () => j(!0)
2066
2085
  },
2067
2086
  {
2068
- icon: /* @__PURE__ */ e(at, {}),
2087
+ icon: /* @__PURE__ */ e(ot, {}),
2069
2088
  title: "删除选中 (Delete)",
2070
- disabled: !n && b.length === 0,
2089
+ disabled: !n && M.length === 0,
2071
2090
  onClick: () => {
2072
- n ? N(n) : b.length > 0 && (b.forEach((d) => N(d)), Z([]));
2091
+ n ? I(n) : M.length > 0 && (M.forEach((o) => I(o)), ee([]));
2073
2092
  }
2074
2093
  }
2075
2094
  ],
2076
2095
  [
2077
2096
  g,
2078
- A,
2097
+ W,
2079
2098
  a,
2080
- z,
2081
- Z,
2082
- b,
2083
- Qe,
2084
- et,
2099
+ O,
2100
+ ee,
2101
+ M,
2102
+ nt,
2085
2103
  We,
2086
- ke,
2087
- _e,
2088
- Xe,
2089
- $e,
2104
+ tt,
2105
+ ge,
2106
+ Te,
2107
+ C,
2108
+ j,
2090
2109
  n,
2091
- N
2110
+ I
2092
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]
2093
2125
  );
2094
- return /* @__PURE__ */ u("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
2095
- /* @__PURE__ */ u("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
2096
- /* @__PURE__ */ e(pe, { children: we.map((d) => /* @__PURE__ */ e(Le, { title: d.title, children: /* @__PURE__ */ e(
2097
- K,
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: [
2129
+ /* @__PURE__ */ h("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
2130
+ /* @__PURE__ */ e(be, { children: pt.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2131
+ Z,
2098
2132
  {
2099
- type: d.active ? "primary" : "default",
2100
- icon: d.icon,
2101
- onClick: d.onClick
2133
+ type: o.active ? "primary" : "default",
2134
+ icon: o.icon,
2135
+ onClick: o.onClick
2102
2136
  }
2103
- ) }, d.title)) }),
2104
- /* @__PURE__ */ e(pe, { children: mt.map((d) => /* @__PURE__ */ e(Le, { title: d.title, children: /* @__PURE__ */ e(
2105
- K,
2137
+ ) }, o.title)) }),
2138
+ /* @__PURE__ */ e(be, { children: Fe.map((o) => /* @__PURE__ */ e(Le, { title: o.title, children: /* @__PURE__ */ e(
2139
+ Z,
2106
2140
  {
2107
- type: d.active ? "primary" : d.type || "default",
2108
- icon: d.icon,
2109
- onClick: d.onClick,
2110
- disabled: d.disabled
2141
+ type: o.active ? "primary" : o.type || "default",
2142
+ icon: o.icon,
2143
+ onClick: o.onClick,
2144
+ disabled: o.disabled
2111
2145
  }
2112
- ) }, d.title)) })
2146
+ ) }, o.title)) })
2113
2147
  ] }),
2114
2148
  /* @__PURE__ */ e("div", { ref: r, className: "flex-1 relative", children: /* @__PURE__ */ e(
2115
- mn,
2149
+ pn,
2116
2150
  {
2117
2151
  ref: f,
2118
2152
  initialScale: 1,
@@ -2120,25 +2154,25 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2120
2154
  initialPositionY: 0,
2121
2155
  minScale: 0.5,
2122
2156
  maxScale: 5,
2123
- onTransformed: be,
2157
+ onTransformed: ae,
2124
2158
  limitToBounds: !1,
2125
2159
  centerZoomedOut: !1,
2126
- panning: { disabled: !S && (a === "select" || a === "line-draw" || a === "box-select"), velocityDisabled: !0 },
2160
+ panning: { disabled: !z && (a === "select" || a === "line-draw" || a === "box-select"), velocityDisabled: !0 },
2127
2161
  wheel: { disabled: !1, step: 0.1 },
2128
2162
  pinch: { disabled: !1 },
2129
2163
  doubleClick: { disabled: !0 },
2130
- children: ({ zoomIn: d, zoomOut: y, resetTransform: M }) => /* @__PURE__ */ u(Ae, { children: [
2131
- /* @__PURE__ */ e("div", { className: "absolute bottom-4 right-4 z-10 bg-white rounded-lg shadow-lg p-2", children: /* @__PURE__ */ u(pe, { direction: "vertical", children: [
2132
- /* @__PURE__ */ e(Le, { title: "放大", children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(rn, {}), onClick: () => d() }) }),
2133
- /* @__PURE__ */ e(Le, { title: "缩小", children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(an, {}), onClick: () => y() }) }),
2134
- /* @__PURE__ */ e(Le, { title: "重置视图", children: /* @__PURE__ */ e(K, { onClick: () => M(), children: "100%" }) }),
2135
- /* @__PURE__ */ u("div", { className: "text-center text-xs text-gray-500", children: [
2164
+ children: ({ zoomIn: o, zoomOut: y, resetTransform: N }) => /* @__PURE__ */ h(Oe, { children: [
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: [
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%" }) }),
2169
+ /* @__PURE__ */ h("div", { className: "text-center text-xs text-gray-500", children: [
2136
2170
  Math.round(p.scale * 100),
2137
2171
  "%"
2138
2172
  ] })
2139
2173
  ] }) }),
2140
2174
  /* @__PURE__ */ e(
2141
- fn,
2175
+ yn,
2142
2176
  {
2143
2177
  wrapperStyle: { width: "100%", height: "100%", position: "relative" },
2144
2178
  contentStyle: {
@@ -2148,54 +2182,54 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2148
2182
  alignItems: "center",
2149
2183
  justifyContent: "center"
2150
2184
  },
2151
- children: /* @__PURE__ */ u(
2185
+ children: /* @__PURE__ */ h(
2152
2186
  "div",
2153
2187
  {
2154
2188
  ref: t,
2155
2189
  "data-canvas": "true",
2156
- className: `relative ${ye ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""} ${S ? "cursor-grab" : ""}`,
2190
+ className: `relative ${xe ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""} ${z ? "cursor-grab" : ""}`,
2157
2191
  style: {
2158
- width: c.width,
2159
- height: c.height,
2192
+ width: d.width,
2193
+ height: d.height,
2160
2194
  flexShrink: 0,
2161
- backgroundColor: c.background,
2162
- backgroundImage: c.backgroundImage ? `url(${c.backgroundImage})` : void 0,
2195
+ backgroundColor: d.background,
2196
+ backgroundImage: d.backgroundImage ? `url(${d.backgroundImage})` : void 0,
2163
2197
  backgroundSize: "cover",
2164
2198
  backgroundPosition: "center"
2165
2199
  },
2166
- onClick: re,
2167
- onMouseDown: J,
2168
- onDoubleClick: ae,
2169
- onDragOver: ie,
2170
- onDragLeave: oe,
2200
+ onClick: K,
2201
+ onMouseDown: oe,
2202
+ onDoubleClick: se,
2203
+ onDragOver: ce,
2204
+ onDragLeave: Xe,
2171
2205
  onDrop: Pe,
2172
2206
  children: [
2173
- c.showGrid !== !1 && /* @__PURE__ */ u("svg", { className: "absolute top-0 left-0 pointer-events-none", width: c.width, height: c.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: [
2174
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" }) }) }),
2175
2209
  /* @__PURE__ */ e("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
2176
2210
  ] }),
2177
- s.map((E) => /* @__PURE__ */ e(
2178
- jt,
2211
+ c.map((E) => /* @__PURE__ */ e(
2212
+ Ut,
2179
2213
  {
2180
2214
  node: E,
2181
- isSelected: n === E.id || b.includes(E.id),
2215
+ isSelected: n === E.id || M.includes(E.id),
2182
2216
  data: l,
2183
2217
  onClick: () => {
2184
- I(E.id);
2218
+ console.log("Node onClick:", E.id, "mode:", ie.current), ie.current !== "line-draw" && k(E.id);
2185
2219
  },
2186
- onMouseDown: (x) => Te(x, E),
2187
- onUpdateNode: (x, _) => v(x, _),
2220
+ onMouseDown: (x) => et(x, E),
2221
+ onUpdateNode: (x, P) => v(x, P),
2188
2222
  scale: p.scale
2189
2223
  },
2190
2224
  `${E.id}`
2191
2225
  )),
2192
- a === "line-draw" && D.isDrawing && D.start && D.end && /* @__PURE__ */ e("svg", { className: "absolute top-0 left-0 pointer-events-none", width: c.width, height: c.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(
2193
2227
  "line",
2194
2228
  {
2195
- x1: D.start.x,
2196
- y1: D.start.y,
2197
- x2: D.end.x,
2198
- y2: D.end.y,
2229
+ x1: s.start.x,
2230
+ y1: s.start.y,
2231
+ x2: s.end.x,
2232
+ y2: s.end.y,
2199
2233
  stroke: "#1890ff",
2200
2234
  strokeWidth: "2",
2201
2235
  strokeDasharray: "5,5",
@@ -2203,15 +2237,15 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2203
2237
  strokeLinejoin: "round"
2204
2238
  }
2205
2239
  ) }),
2206
- a === "box-select" && $.start && $.end && /* @__PURE__ */ e(
2240
+ a === "box-select" && b.start && b.end && /* @__PURE__ */ e(
2207
2241
  "div",
2208
2242
  {
2209
2243
  className: "absolute border-2 border-blue-500 bg-blue-500/10 pointer-events-none",
2210
2244
  style: {
2211
- left: Math.min($.start.x, $.end.x),
2212
- top: Math.min($.start.y, $.end.y),
2213
- width: Math.abs($.end.x - $.start.x),
2214
- height: Math.abs($.end.y - $.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),
2215
2249
  zIndex: 9999
2216
2250
  }
2217
2251
  }
@@ -2225,17 +2259,17 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2225
2259
  }
2226
2260
  ) }),
2227
2261
  /* @__PURE__ */ e(
2228
- rt,
2262
+ it,
2229
2263
  {
2230
2264
  title: "数据模拟",
2231
- open: xe,
2232
- onCancel: () => $e(!1),
2265
+ open: je,
2266
+ onCancel: () => j(!1),
2233
2267
  footer: null,
2234
2268
  children: /* @__PURE__ */ e(w, { layout: "vertical", children: /* @__PURE__ */ e(w.Item, { label: "测试数据 (JSON)", children: /* @__PURE__ */ e(
2235
- _n,
2269
+ On,
2236
2270
  {
2237
- value: W,
2238
- onChange: (d) => it(d.target.value),
2271
+ value: st,
2272
+ onChange: (o) => Ke(o.target.value),
2239
2273
  rows: 10,
2240
2274
  placeholder: "输入 JSON 格式的测试数据"
2241
2275
  }
@@ -2243,28 +2277,28 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2243
2277
  }
2244
2278
  ),
2245
2279
  /* @__PURE__ */ e(
2246
- rt,
2280
+ it,
2247
2281
  {
2248
2282
  title: "画布配置",
2249
- open: Ke,
2250
- onCancel: () => Xe(!1),
2283
+ open: Qe,
2284
+ onCancel: () => C(!1),
2251
2285
  footer: null,
2252
- children: /* @__PURE__ */ u(w, { layout: "vertical", children: [
2286
+ children: /* @__PURE__ */ h(w, { layout: "vertical", children: [
2253
2287
  /* @__PURE__ */ e(w.Item, { label: "宽度", children: /* @__PURE__ */ e(
2254
- ee,
2288
+ te,
2255
2289
  {
2256
- value: c.width,
2257
- onChange: (d) => C({ width: d || 1920 }),
2290
+ value: d.width,
2291
+ onChange: (o) => S({ width: o || 1920 }),
2258
2292
  min: 100,
2259
2293
  max: 5e3,
2260
2294
  style: { width: "100%" }
2261
2295
  }
2262
2296
  ) }),
2263
2297
  /* @__PURE__ */ e(w.Item, { label: "高度", children: /* @__PURE__ */ e(
2264
- ee,
2298
+ te,
2265
2299
  {
2266
- value: c.height,
2267
- onChange: (d) => C({ height: d || 1080 }),
2300
+ value: d.height,
2301
+ onChange: (o) => S({ height: o || 1080 }),
2268
2302
  min: 100,
2269
2303
  max: 5e3,
2270
2304
  style: { width: "100%" }
@@ -2273,40 +2307,79 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2273
2307
  /* @__PURE__ */ e(w.Item, { label: "显示网格", children: /* @__PURE__ */ e(
2274
2308
  Je,
2275
2309
  {
2276
- checked: c.showGrid !== !1,
2277
- onChange: (d) => C({ showGrid: d })
2310
+ checked: d.showGrid !== !1,
2311
+ onChange: (o) => S({ showGrid: o })
2278
2312
  }
2279
2313
  ) }),
2280
- /* @__PURE__ */ e(w.Item, { label: "背景色", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2314
+ /* @__PURE__ */ e(w.Item, { label: "背景色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2281
2315
  /* @__PURE__ */ e(
2282
- je,
2316
+ Ae,
2283
2317
  {
2284
- value: c.background || "#ffffff",
2285
- onChange: (d) => C({ background: d.toHexString() })
2318
+ value: d.background || "#ffffff",
2319
+ onChange: (o) => S({ background: o.toHexString() })
2286
2320
  }
2287
2321
  ),
2288
2322
  /* @__PURE__ */ e(
2289
- le,
2323
+ re,
2290
2324
  {
2291
- value: c.background,
2292
- onChange: (d) => C({ background: d.target.value }),
2325
+ value: d.background,
2326
+ onChange: (o) => S({ background: o.target.value }),
2293
2327
  placeholder: "#ffffff"
2294
2328
  }
2295
2329
  )
2296
2330
  ] }) }),
2297
- /* @__PURE__ */ e(w.Item, { label: "背景图片 URL", children: /* @__PURE__ */ e(
2298
- le,
2299
- {
2300
- value: c.backgroundImage,
2301
- onChange: (d) => C({ backgroundImage: d.target.value }),
2302
- placeholder: "输入图片 URL"
2303
- }
2304
- ) })
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
+ ] })
2305
2378
  ] })
2306
2379
  }
2307
2380
  )
2308
2381
  ] });
2309
- }, { Option: lt } = Ie, On = ({
2382
+ }, { Option: at } = Ie, jn = ({
2310
2383
  material: l,
2311
2384
  onSave: f,
2312
2385
  bindCodes: t = [],
@@ -2340,21 +2413,21 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2340
2413
  valueColor: n.valueStyle?.color || "#1890ff"
2341
2414
  });
2342
2415
  }, [l.id]);
2343
- const p = (o, I) => {
2344
- i((v) => ({ ...v, [o]: I }));
2345
- }, c = (o) => {
2346
- const I = r.find((N) => N.paramsCode === o), v = I?.unit || "";
2347
- i((N) => ({
2348
- ...N,
2349
- valueSourceCode: o,
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,
2350
2423
  unit: v,
2351
- value: String(I?.value || "")
2424
+ value: String(k?.value || "")
2352
2425
  })), setTimeout(() => {
2353
2426
  f({
2354
2427
  content: {
2355
2428
  ...n,
2356
- valueSourceCode: o,
2357
- value: String(I?.value || ""),
2429
+ valueSourceCode: u,
2430
+ value: String(k?.value || ""),
2358
2431
  unit: v
2359
2432
  }
2360
2433
  });
@@ -2380,17 +2453,17 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2380
2453
  }
2381
2454
  }
2382
2455
  });
2383
- }, C = r.filter(
2384
- (o) => t.includes(o.paramsCode)
2456
+ }, S = r.filter(
2457
+ (u) => t.includes(u.paramsCode)
2385
2458
  );
2386
- return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
2387
- /* @__PURE__ */ e(De, { style: { marginTop: 0 }, children: "文本内容" }),
2388
- /* @__PURE__ */ u(w, { layout: "vertical", children: [
2459
+ return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2460
+ /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "文本内容" }),
2461
+ /* @__PURE__ */ h(w, { layout: "vertical", children: [
2389
2462
  /* @__PURE__ */ e(w.Item, { label: "标签文本 (label)", children: /* @__PURE__ */ e(
2390
- le,
2463
+ re,
2391
2464
  {
2392
2465
  value: a.label,
2393
- onChange: (o) => p("label", o.target.value),
2466
+ onChange: (u) => p("label", u.target.value),
2394
2467
  onBlur: m,
2395
2468
  placeholder: "输入标签文本"
2396
2469
  }
@@ -2404,7 +2477,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2404
2477
  Ie,
2405
2478
  {
2406
2479
  value: a.valueSourceCode || void 0,
2407
- onChange: c,
2480
+ onChange: d,
2408
2481
  placeholder: "选择数据字段(可选)",
2409
2482
  allowClear: !0,
2410
2483
  style: { width: "100%" },
@@ -2412,7 +2485,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2412
2485
  value: "paramsCode",
2413
2486
  label: "paramsName"
2414
2487
  },
2415
- options: C
2488
+ options: S
2416
2489
  }
2417
2490
  )
2418
2491
  }
@@ -2423,10 +2496,10 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2423
2496
  label: a.valueSourceCode ? "默认值(备用)" : "值文本",
2424
2497
  help: a.valueSourceCode ? "已绑定数据源,实际值将来自数据字段,此处仅设置无数据时的备用显示" : "手动输入显示的值",
2425
2498
  children: /* @__PURE__ */ e(
2426
- le,
2499
+ re,
2427
2500
  {
2428
2501
  value: a.value,
2429
- onChange: (o) => p("value", o.target.value),
2502
+ onChange: (u) => p("value", u.target.value),
2430
2503
  onBlur: m,
2431
2504
  placeholder: a.valueSourceCode ? "数据字段无值时显示此备用值" : "输入值文本",
2432
2505
  disabled: !!a.valueSourceCode,
@@ -2436,13 +2509,13 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2436
2509
  }
2437
2510
  ),
2438
2511
  /* @__PURE__ */ e(w.Item, { label: "单位", help: "优先从绑定数据自动获取,也可手动输入", children: /* @__PURE__ */ e(
2439
- le,
2512
+ re,
2440
2513
  {
2441
2514
  value: a.unit,
2442
- onChange: (o) => p("unit", o.target.value),
2515
+ onChange: (u) => p("unit", u.target.value),
2443
2516
  onBlur: m,
2444
2517
  placeholder: "单位(如°C、%、MPa等)",
2445
- suffix: a.valueSourceCode && C.length > 0 ? /* @__PURE__ */ e(he, { color: "blue", style: { marginRight: -8 }, children: "自动" }) : null
2518
+ suffix: a.valueSourceCode && S.length > 0 ? /* @__PURE__ */ e(ye, { color: "blue", style: { marginRight: -8 }, children: "自动" }) : null
2446
2519
  }
2447
2520
  ) }),
2448
2521
  /* @__PURE__ */ e(
@@ -2451,10 +2524,10 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2451
2524
  label: "保留小数位",
2452
2525
  help: "数值格式化时保留的小数位数,-1表示不格式化",
2453
2526
  children: /* @__PURE__ */ e(
2454
- ee,
2527
+ te,
2455
2528
  {
2456
2529
  value: a.decimals,
2457
- onChange: (o) => p("decimals", o ?? 2),
2530
+ onChange: (u) => p("decimals", u ?? 2),
2458
2531
  onBlur: m,
2459
2532
  min: -1,
2460
2533
  max: 10,
@@ -2464,43 +2537,43 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2464
2537
  }
2465
2538
  )
2466
2539
  ] }),
2467
- /* @__PURE__ */ e(De, { children: "标签样式" }),
2468
- /* @__PURE__ */ u(w, { layout: "vertical", children: [
2469
- /* @__PURE__ */ u(pe, { children: [
2540
+ /* @__PURE__ */ e(Me, { children: "标签样式" }),
2541
+ /* @__PURE__ */ h(w, { layout: "vertical", children: [
2542
+ /* @__PURE__ */ h(be, { children: [
2470
2543
  /* @__PURE__ */ e(w.Item, { label: "字体大小", children: /* @__PURE__ */ e(
2471
- ee,
2544
+ te,
2472
2545
  {
2473
2546
  value: a.labelFontSize,
2474
- onChange: (o) => p("labelFontSize", o || 14),
2547
+ onChange: (u) => p("labelFontSize", u || 14),
2475
2548
  onBlur: m,
2476
2549
  min: 8,
2477
2550
  max: 72
2478
2551
  }
2479
2552
  ) }),
2480
- /* @__PURE__ */ e(w.Item, { label: "字体粗细", children: /* @__PURE__ */ u(
2553
+ /* @__PURE__ */ e(w.Item, { label: "字体粗细", children: /* @__PURE__ */ h(
2481
2554
  Ie,
2482
2555
  {
2483
2556
  value: a.labelFontWeight,
2484
- onChange: (o) => {
2485
- p("labelFontWeight", o), setTimeout(m, 0);
2557
+ onChange: (u) => {
2558
+ p("labelFontWeight", u), setTimeout(m, 0);
2486
2559
  },
2487
2560
  style: { width: 100 },
2488
2561
  children: [
2489
- /* @__PURE__ */ e(lt, { value: "normal", children: "正常" }),
2490
- /* @__PURE__ */ e(lt, { value: "bold", children: "粗体" })
2562
+ /* @__PURE__ */ e(at, { value: "normal", children: "正常" }),
2563
+ /* @__PURE__ */ e(at, { value: "bold", children: "粗体" })
2491
2564
  ]
2492
2565
  }
2493
2566
  ) })
2494
2567
  ] }),
2495
- /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2568
+ /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2496
2569
  /* @__PURE__ */ e(
2497
- je,
2570
+ Ae,
2498
2571
  {
2499
2572
  value: a.labelColor || "#262626",
2500
- onChange: (o) => {
2501
- p("labelColor", o.toHexString());
2573
+ onChange: (u) => {
2574
+ p("labelColor", u.toHexString());
2502
2575
  },
2503
- onChangeComplete: (o) => {
2576
+ onChangeComplete: (u) => {
2504
2577
  f({
2505
2578
  content: {
2506
2579
  ...n,
@@ -2512,7 +2585,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2512
2585
  labelStyle: {
2513
2586
  fontSize: a.labelFontSize,
2514
2587
  fontWeight: a.labelFontWeight,
2515
- color: o.toHexString()
2588
+ color: u.toHexString()
2516
2589
  },
2517
2590
  valueStyle: {
2518
2591
  fontSize: a.valueFontSize,
@@ -2525,10 +2598,10 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2525
2598
  }
2526
2599
  ),
2527
2600
  /* @__PURE__ */ e(
2528
- le,
2601
+ re,
2529
2602
  {
2530
2603
  value: a.labelColor,
2531
- onChange: (o) => p("labelColor", o.target.value),
2604
+ onChange: (u) => p("labelColor", u.target.value),
2532
2605
  onBlur: m,
2533
2606
  placeholder: "#262626",
2534
2607
  style: { width: 100 }
@@ -2536,43 +2609,43 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2536
2609
  )
2537
2610
  ] }) })
2538
2611
  ] }),
2539
- /* @__PURE__ */ e(De, { children: "值样式" }),
2540
- /* @__PURE__ */ u(w, { layout: "vertical", children: [
2541
- /* @__PURE__ */ u(pe, { children: [
2612
+ /* @__PURE__ */ e(Me, { children: "值样式" }),
2613
+ /* @__PURE__ */ h(w, { layout: "vertical", children: [
2614
+ /* @__PURE__ */ h(be, { children: [
2542
2615
  /* @__PURE__ */ e(w.Item, { label: "字体大小", children: /* @__PURE__ */ e(
2543
- ee,
2616
+ te,
2544
2617
  {
2545
2618
  value: a.valueFontSize,
2546
- onChange: (o) => p("valueFontSize", o || 14),
2619
+ onChange: (u) => p("valueFontSize", u || 14),
2547
2620
  onBlur: m,
2548
2621
  min: 8,
2549
2622
  max: 72
2550
2623
  }
2551
2624
  ) }),
2552
- /* @__PURE__ */ e(w.Item, { label: "字体粗细", children: /* @__PURE__ */ u(
2625
+ /* @__PURE__ */ e(w.Item, { label: "字体粗细", children: /* @__PURE__ */ h(
2553
2626
  Ie,
2554
2627
  {
2555
2628
  value: a.valueFontWeight,
2556
- onChange: (o) => {
2557
- p("valueFontWeight", o), setTimeout(m, 0);
2629
+ onChange: (u) => {
2630
+ p("valueFontWeight", u), setTimeout(m, 0);
2558
2631
  },
2559
2632
  style: { width: 100 },
2560
2633
  children: [
2561
- /* @__PURE__ */ e(lt, { value: "normal", children: "正常" }),
2562
- /* @__PURE__ */ e(lt, { value: "bold", children: "粗体" })
2634
+ /* @__PURE__ */ e(at, { value: "normal", children: "正常" }),
2635
+ /* @__PURE__ */ e(at, { value: "bold", children: "粗体" })
2563
2636
  ]
2564
2637
  }
2565
2638
  ) })
2566
2639
  ] }),
2567
- /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2640
+ /* @__PURE__ */ e(w.Item, { label: "文字颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2568
2641
  /* @__PURE__ */ e(
2569
- je,
2642
+ Ae,
2570
2643
  {
2571
2644
  value: a.valueColor || "#1890ff",
2572
- onChange: (o) => {
2573
- p("valueColor", o.toHexString());
2645
+ onChange: (u) => {
2646
+ p("valueColor", u.toHexString());
2574
2647
  },
2575
- onChangeComplete: (o) => {
2648
+ onChangeComplete: (u) => {
2576
2649
  f({
2577
2650
  content: {
2578
2651
  ...n,
@@ -2589,7 +2662,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2589
2662
  valueStyle: {
2590
2663
  fontSize: a.valueFontSize,
2591
2664
  fontWeight: a.valueFontWeight,
2592
- color: o.toHexString()
2665
+ color: u.toHexString()
2593
2666
  }
2594
2667
  }
2595
2668
  });
@@ -2597,10 +2670,10 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2597
2670
  }
2598
2671
  ),
2599
2672
  /* @__PURE__ */ e(
2600
- le,
2673
+ re,
2601
2674
  {
2602
2675
  value: a.valueColor,
2603
- onChange: (o) => p("valueColor", o.target.value),
2676
+ onChange: (u) => p("valueColor", u.target.value),
2604
2677
  onBlur: m,
2605
2678
  placeholder: "#1890ff",
2606
2679
  style: { width: 100 }
@@ -2609,18 +2682,18 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2609
2682
  ] }) })
2610
2683
  ] })
2611
2684
  ] });
2612
- }, Rn = ({
2685
+ }, Wn = ({
2613
2686
  material: l,
2614
2687
  onSave: f
2615
2688
  }) => {
2616
- const t = l, [r, s] = Q({
2689
+ const t = l, [r, c] = Q({
2617
2690
  name: l.name,
2618
2691
  src: t.src || "",
2619
2692
  backgroundColor: t.backgroundColor || "",
2620
2693
  fillColor: t.fillColor || ""
2621
2694
  });
2622
2695
  me(() => {
2623
- s({
2696
+ c({
2624
2697
  name: l.name,
2625
2698
  src: t.src || "",
2626
2699
  backgroundColor: t.backgroundColor || "",
@@ -2628,7 +2701,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2628
2701
  });
2629
2702
  }, [l.id]);
2630
2703
  const n = (i, p) => {
2631
- s((c) => ({ ...c, [i]: p }));
2704
+ c((d) => ({ ...d, [i]: p }));
2632
2705
  }, a = () => {
2633
2706
  f({
2634
2707
  name: r.name,
@@ -2636,11 +2709,11 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2636
2709
  backgroundColor: r.backgroundColor
2637
2710
  });
2638
2711
  };
2639
- return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
2640
- /* @__PURE__ */ e(De, { style: { marginTop: 0 }, children: "图片属性" }),
2641
- /* @__PURE__ */ u(w, { layout: "vertical", children: [
2712
+ return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2713
+ /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "图片属性" }),
2714
+ /* @__PURE__ */ h(w, { layout: "vertical", children: [
2642
2715
  /* @__PURE__ */ e(w.Item, { label: "图片名称", children: /* @__PURE__ */ e(
2643
- le,
2716
+ re,
2644
2717
  {
2645
2718
  value: r.name,
2646
2719
  onChange: (i) => n("name", i.target.value),
@@ -2648,7 +2721,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2648
2721
  }
2649
2722
  ) }),
2650
2723
  /* @__PURE__ */ e(w.Item, { label: "图片地址 (src)", children: /* @__PURE__ */ e(
2651
- le.TextArea,
2724
+ re.TextArea,
2652
2725
  {
2653
2726
  value: r.src,
2654
2727
  onChange: (i) => n("src", i.target.value),
@@ -2657,9 +2730,9 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2657
2730
  placeholder: "输入图片 URL 或 Data URI"
2658
2731
  }
2659
2732
  ) }),
2660
- /* @__PURE__ */ e(w.Item, { label: "填充颜色(基本形状)", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2733
+ /* @__PURE__ */ e(w.Item, { label: "填充颜色(基本形状)", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2661
2734
  /* @__PURE__ */ e(
2662
- je,
2735
+ Ae,
2663
2736
  {
2664
2737
  value: r.fillColor || "#1890ff",
2665
2738
  onChange: (i) => {
@@ -2674,7 +2747,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2674
2747
  }
2675
2748
  ),
2676
2749
  /* @__PURE__ */ e(
2677
- le,
2750
+ re,
2678
2751
  {
2679
2752
  value: r.fillColor,
2680
2753
  onChange: (i) => n("fillColor", i.target.value),
@@ -2683,9 +2756,9 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2683
2756
  }
2684
2757
  )
2685
2758
  ] }) }),
2686
- /* @__PURE__ */ e(w.Item, { label: "背景颜色", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2759
+ /* @__PURE__ */ e(w.Item, { label: "背景颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2687
2760
  /* @__PURE__ */ e(
2688
- je,
2761
+ Ae,
2689
2762
  {
2690
2763
  value: r.backgroundColor || "#1890ff",
2691
2764
  onChange: (i) => {
@@ -2700,7 +2773,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2700
2773
  }
2701
2774
  ),
2702
2775
  /* @__PURE__ */ e(
2703
- le,
2776
+ re,
2704
2777
  {
2705
2778
  value: r.backgroundColor,
2706
2779
  onChange: (i) => n("backgroundColor", i.target.value),
@@ -2711,11 +2784,11 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2711
2784
  ] }) })
2712
2785
  ] })
2713
2786
  ] });
2714
- }, { Option: An } = Ie, jn = ({
2787
+ }, { Option: Fn } = Ie, Un = ({
2715
2788
  material: l,
2716
2789
  onSave: f
2717
2790
  }) => {
2718
- const t = l.config || {}, [r, s] = Q({
2791
+ const t = l.config || {}, [r, c] = Q({
2719
2792
  lineWeight: t.lineWeight || t.thickness || 2,
2720
2793
  color: t.color || "#262626",
2721
2794
  lineType: t.lineType || "solid",
@@ -2725,7 +2798,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2725
2798
  endY: t.endY ?? 0
2726
2799
  });
2727
2800
  me(() => {
2728
- s({
2801
+ c({
2729
2802
  lineWeight: t.lineWeight || t.thickness || 2,
2730
2803
  color: t.color || "#262626",
2731
2804
  lineType: t.lineType || "solid",
@@ -2737,7 +2810,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2737
2810
  }, [l.id]);
2738
2811
  const n = (i) => {
2739
2812
  const p = { ...r, ...i };
2740
- s(p), f({
2813
+ c(p), f({
2741
2814
  config: {
2742
2815
  ...t,
2743
2816
  thickness: p.lineWeight,
@@ -2758,12 +2831,12 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2758
2831
  { value: "dot", label: "点线", desc: "密集点状" },
2759
2832
  { value: "dash-dot", label: "画点线", desc: "长划-点交替" }
2760
2833
  ];
2761
- return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
2762
- /* @__PURE__ */ e(De, { style: { marginTop: 0 }, children: "起止位置(相对节点)" }),
2763
- /* @__PURE__ */ u(w, { layout: "vertical", children: [
2764
- /* @__PURE__ */ u("div", { className: "grid grid-cols-2 gap-2", children: [
2834
+ return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
2835
+ /* @__PURE__ */ e(Me, { style: { marginTop: 0 }, children: "起止位置(相对节点)" }),
2836
+ /* @__PURE__ */ h(w, { layout: "vertical", children: [
2837
+ /* @__PURE__ */ h("div", { className: "grid grid-cols-2 gap-2", children: [
2765
2838
  /* @__PURE__ */ e(w.Item, { label: "起点 X", className: "mb-2", children: /* @__PURE__ */ e(
2766
- ee,
2839
+ te,
2767
2840
  {
2768
2841
  value: r.startX,
2769
2842
  onChange: (i) => n({ startX: i ?? 0 }),
@@ -2771,7 +2844,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2771
2844
  }
2772
2845
  ) }),
2773
2846
  /* @__PURE__ */ e(w.Item, { label: "起点 Y", className: "mb-2", children: /* @__PURE__ */ e(
2774
- ee,
2847
+ te,
2775
2848
  {
2776
2849
  value: r.startY,
2777
2850
  onChange: (i) => n({ startY: i ?? 0 }),
@@ -2779,7 +2852,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2779
2852
  }
2780
2853
  ) }),
2781
2854
  /* @__PURE__ */ e(w.Item, { label: "终点 X", className: "mb-2", children: /* @__PURE__ */ e(
2782
- ee,
2855
+ te,
2783
2856
  {
2784
2857
  value: r.endX,
2785
2858
  onChange: (i) => n({ endX: i ?? 100 }),
@@ -2787,7 +2860,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2787
2860
  }
2788
2861
  ) }),
2789
2862
  /* @__PURE__ */ e(w.Item, { label: "终点 Y", className: "mb-2", children: /* @__PURE__ */ e(
2790
- ee,
2863
+ te,
2791
2864
  {
2792
2865
  value: r.endY,
2793
2866
  onChange: (i) => n({ endY: i ?? 0 }),
@@ -2795,9 +2868,9 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2795
2868
  }
2796
2869
  ) })
2797
2870
  ] }),
2798
- /* @__PURE__ */ e(w.Item, { label: "快速对齐", className: "mt-4", children: /* @__PURE__ */ u(pe, { children: [
2871
+ /* @__PURE__ */ e(w.Item, { label: "快速对齐", className: "mt-4", children: /* @__PURE__ */ h(be, { children: [
2799
2872
  /* @__PURE__ */ e(
2800
- K,
2873
+ Z,
2801
2874
  {
2802
2875
  size: "small",
2803
2876
  onClick: () => {
@@ -2809,7 +2882,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2809
2882
  }
2810
2883
  ),
2811
2884
  /* @__PURE__ */ e(
2812
- K,
2885
+ Z,
2813
2886
  {
2814
2887
  size: "small",
2815
2888
  onClick: () => {
@@ -2821,13 +2894,13 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2821
2894
  }
2822
2895
  ),
2823
2896
  /* @__PURE__ */ e(
2824
- K,
2897
+ Z,
2825
2898
  {
2826
2899
  size: "small",
2827
2900
  onClick: () => {
2828
- const i = t.startX ?? r.startX, p = t.startY ?? r.startY, c = 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;
2829
2902
  n({
2830
- startX: c,
2903
+ startX: d,
2831
2904
  startY: m,
2832
2905
  endX: i,
2833
2906
  endY: p
@@ -2839,21 +2912,21 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2839
2912
  )
2840
2913
  ] }) })
2841
2914
  ] }),
2842
- /* @__PURE__ */ e(De, { children: "线条属性" }),
2843
- /* @__PURE__ */ u(w, { layout: "vertical", children: [
2915
+ /* @__PURE__ */ e(Me, { children: "线条属性" }),
2916
+ /* @__PURE__ */ h(w, { layout: "vertical", children: [
2844
2917
  /* @__PURE__ */ e(w.Item, { label: "线型", help: "选择线条样式", children: /* @__PURE__ */ e(
2845
2918
  Ie,
2846
2919
  {
2847
2920
  value: r.lineType,
2848
2921
  onChange: (i) => n({ lineType: i }),
2849
- children: a.map((i) => /* @__PURE__ */ e(An, { value: i.value, children: /* @__PURE__ */ u("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: [
2850
2923
  /* @__PURE__ */ e("span", { children: i.label }),
2851
2924
  /* @__PURE__ */ e("span", { className: "text-xs text-gray-400", children: i.desc })
2852
2925
  ] }) }, i.value))
2853
2926
  }
2854
2927
  ) }),
2855
2928
  /* @__PURE__ */ e(w.Item, { label: "线宽(像素)", children: /* @__PURE__ */ e(
2856
- ee,
2929
+ te,
2857
2930
  {
2858
2931
  value: r.lineWeight,
2859
2932
  onChange: (i) => n({ lineWeight: i || 2 }),
@@ -2862,16 +2935,16 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2862
2935
  style: { width: 120 }
2863
2936
  }
2864
2937
  ) }),
2865
- /* @__PURE__ */ e(w.Item, { label: "颜色", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2938
+ /* @__PURE__ */ e(w.Item, { label: "颜色", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
2866
2939
  /* @__PURE__ */ e(
2867
- je,
2940
+ Ae,
2868
2941
  {
2869
2942
  value: r.color || "#d9d9d9",
2870
2943
  onChange: (i) => n({ color: i.toHexString() })
2871
2944
  }
2872
2945
  ),
2873
2946
  /* @__PURE__ */ e(
2874
- le,
2947
+ re,
2875
2948
  {
2876
2949
  value: r.color,
2877
2950
  onChange: (i) => n({ color: i.target.value }),
@@ -2882,7 +2955,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2882
2955
  ] }) })
2883
2956
  ] })
2884
2957
  ] });
2885
- }, Wt = ({
2958
+ }, Ht = ({
2886
2959
  material: l,
2887
2960
  onSave: f,
2888
2961
  bindCodes: t,
@@ -2891,7 +2964,7 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2891
2964
  switch (l.type) {
2892
2965
  case "TEXT":
2893
2966
  return /* @__PURE__ */ e(
2894
- On,
2967
+ jn,
2895
2968
  {
2896
2969
  material: l,
2897
2970
  onSave: f,
@@ -2900,146 +2973,146 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
2900
2973
  }
2901
2974
  );
2902
2975
  case "IMAGE":
2903
- return /* @__PURE__ */ e(Rn, { material: l, onSave: f });
2976
+ return /* @__PURE__ */ e(Wn, { material: l, onSave: f });
2904
2977
  case "LINE":
2905
- return /* @__PURE__ */ e(jn, { material: l, onSave: f });
2978
+ return /* @__PURE__ */ e(Un, { material: l, onSave: f });
2906
2979
  default:
2907
2980
  return /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-8", children: "暂不支持编辑此类型的物料" });
2908
2981
  }
2909
- }, { Panel: Mt } = Ne, { TextArea: Wn } = le, Fn = ({
2982
+ }, { Panel: $t } = Ne, { TextArea: Hn } = re, Gn = ({
2910
2983
  node: l,
2911
2984
  updateNode: f,
2912
2985
  materials: t
2913
2986
  }) => {
2914
- const r = t.filter((m) => m.type !== "CUSTOM" || !m.config?.nodes), s = (m, C) => {
2915
- const o = l.children?.map((I) => I.id === m ? {
2916
- ...I,
2987
+ const r = t.filter((m) => m.type !== "CUSTOM" || !m.config?.nodes), c = (m, S) => {
2988
+ const u = l.children?.map((k) => k.id === m ? {
2989
+ ...k,
2917
2990
  contentInfo: {
2918
- ...I.contentInfo,
2919
- statusList: C
2991
+ ...k.contentInfo,
2992
+ statusList: S
2920
2993
  }
2921
- } : I);
2994
+ } : k);
2922
2995
  f(l.id, {
2923
- children: o
2996
+ children: u
2924
2997
  });
2925
2998
  }, n = (m) => {
2926
- const C = l.children?.find((I) => I.id === m);
2927
- if (!C) return;
2928
- const o = {
2929
- id: U(),
2930
- name: `状态${C.contentInfo.statusList.length + 1}`,
2931
- expression: C.contentInfo.statusList.length === 0 ? "return true;" : "return false;",
2932
- material: { ...r[0], id: U() },
2999
+ const S = l.children?.find((k) => k.id === m);
3000
+ if (!S) return;
3001
+ const u = {
3002
+ id: H(),
3003
+ name: `状态${S.contentInfo.statusList.length + 1}`,
3004
+ expression: S.contentInfo.statusList.length === 0 ? "return true;" : "return false;",
3005
+ material: { ...r[0], id: H() },
2933
3006
  bindCodes: []
2934
3007
  };
2935
- s(m, [...C.contentInfo.statusList, o]);
2936
- }, a = (m, C) => {
2937
- const o = l.children?.find((v) => v.id === m);
2938
- if (!o) return;
2939
- const I = o.contentInfo.statusList.filter((v) => v.id !== C);
2940
- s(m, I);
2941
- }, i = (m, C, o) => {
2942
- const I = l.children?.find((N) => N.id === m);
2943
- if (!I) return;
2944
- const v = I.contentInfo.statusList.map((N) => N.id === C ? { ...N, ...o } : N);
2945
- s(m, v);
2946
- }, p = (m, C, o) => {
2947
- const I = l.children?.find((g) => g.id === m);
2948
- if (!I) return;
2949
- const v = I.contentInfo.statusList.findIndex((g) => g.id === C);
3008
+ c(m, [...S.contentInfo.statusList, u]);
3009
+ }, a = (m, S) => {
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);
2950
3023
  if (v === -1) return;
2951
- const N = [...I.contentInfo.statusList];
2952
- o === "up" && v > 0 ? [N[v], N[v - 1]] = [N[v - 1], N[v]] : o === "down" && v < N.length - 1 && ([N[v], N[v + 1]] = [N[v + 1], N[v]]), s(m, N);
2953
- }, c = (m, C, o) => {
2954
- const I = t.find((v) => v.id === o);
2955
- I && i(m, C, {
2956
- material: { ...I, id: U() }
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() }
2957
3030
  });
2958
3031
  };
2959
- return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
2960
- /* @__PURE__ */ e("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg mb-4", children: /* @__PURE__ */ u("div", { className: "text-sm text-blue-700", children: [
3032
+ return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
3033
+ /* @__PURE__ */ e("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg mb-4", children: /* @__PURE__ */ h("div", { className: "text-sm text-blue-700", children: [
2961
3034
  /* @__PURE__ */ e("strong", { children: "群组节点" }),
2962
3035
  ":为每个子节点配置多个状态和绑定"
2963
3036
  ] }) }),
2964
- /* @__PURE__ */ e(Ne, { ghost: !0, children: l.children?.map((m, C) => /* @__PURE__ */ e(
2965
- Mt,
3037
+ /* @__PURE__ */ e(Ne, { ghost: !0, children: l.children?.map((m, S) => /* @__PURE__ */ e(
3038
+ $t,
2966
3039
  {
2967
- header: /* @__PURE__ */ u("div", { className: "flex items-center justify-between w-full pr-4", children: [
2968
- /* @__PURE__ */ u("span", { className: "font-medium text-sm", children: [
3040
+ header: /* @__PURE__ */ h("div", { className: "flex items-center justify-between w-full pr-4", children: [
3041
+ /* @__PURE__ */ h("span", { className: "font-medium text-sm", children: [
2969
3042
  "子节点 ",
2970
- C + 1
3043
+ S + 1
2971
3044
  ] }),
2972
- /* @__PURE__ */ u(he, { color: "blue", style: { fontSize: "12px", padding: "0 4px" }, children: [
3045
+ /* @__PURE__ */ h(ye, { color: "blue", style: { fontSize: "12px", padding: "0 4px" }, children: [
2973
3046
  m.contentInfo.statusList.length,
2974
3047
  " 个状态"
2975
3048
  ] })
2976
3049
  ] }),
2977
- children: /* @__PURE__ */ u("div", { className: "space-y-3", children: [
2978
- /* @__PURE__ */ u("div", { className: "flex justify-between items-center mb-3", children: [
3050
+ children: /* @__PURE__ */ h("div", { className: "space-y-3", children: [
3051
+ /* @__PURE__ */ h("div", { className: "flex justify-between items-center mb-3", children: [
2979
3052
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "状态列表" }),
2980
3053
  /* @__PURE__ */ e(
2981
- K,
3054
+ Z,
2982
3055
  {
2983
3056
  type: "primary",
2984
3057
  size: "small",
2985
- icon: /* @__PURE__ */ e(Tt, {}),
3058
+ icon: /* @__PURE__ */ e(zt, {}),
2986
3059
  onClick: () => n(m.id),
2987
3060
  children: "添加状态"
2988
3061
  }
2989
3062
  )
2990
3063
  ] }),
2991
- 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((o, I) => /* @__PURE__ */ e(
2992
- 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,
2993
3066
  {
2994
- header: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
2995
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: I + 1 }),
2996
- /* @__PURE__ */ e("span", { className: "font-medium", children: o.name }),
2997
- /* @__PURE__ */ e(he, { color: "default", className: "text-xs", children: o.material.type })
3067
+ header: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3068
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: k + 1 }),
3069
+ /* @__PURE__ */ e("span", { className: "font-medium", children: u.name }),
3070
+ /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: u.material.type })
2998
3071
  ] }),
2999
- extra: /* @__PURE__ */ u(pe, { size: "small", onClick: (v) => v.stopPropagation(), children: [
3072
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (v) => v.stopPropagation(), children: [
3000
3073
  /* @__PURE__ */ e(
3001
- K,
3074
+ Z,
3002
3075
  {
3003
3076
  type: "text",
3004
3077
  size: "small",
3005
- icon: /* @__PURE__ */ e(_t, {}),
3006
- disabled: I === 0,
3078
+ icon: /* @__PURE__ */ e(Ot, {}),
3079
+ disabled: k === 0,
3007
3080
  onClick: (v) => {
3008
- v.stopPropagation(), p(m.id, o.id, "up");
3081
+ v.stopPropagation(), p(m.id, u.id, "up");
3009
3082
  }
3010
3083
  }
3011
3084
  ),
3012
3085
  /* @__PURE__ */ e(
3013
- K,
3086
+ Z,
3014
3087
  {
3015
3088
  type: "text",
3016
3089
  size: "small",
3017
- icon: /* @__PURE__ */ e(zt, {}),
3018
- disabled: I === m.contentInfo.statusList.length - 1,
3090
+ icon: /* @__PURE__ */ e(At, {}),
3091
+ disabled: k === m.contentInfo.statusList.length - 1,
3019
3092
  onClick: (v) => {
3020
- v.stopPropagation(), p(m.id, o.id, "down");
3093
+ v.stopPropagation(), p(m.id, u.id, "down");
3021
3094
  }
3022
3095
  }
3023
3096
  ),
3024
3097
  /* @__PURE__ */ e(
3025
- K,
3098
+ Z,
3026
3099
  {
3027
3100
  type: "text",
3028
3101
  size: "small",
3029
3102
  danger: !0,
3030
- icon: /* @__PURE__ */ e(at, {}),
3103
+ icon: /* @__PURE__ */ e(ot, {}),
3031
3104
  onClick: (v) => {
3032
- v.stopPropagation(), a(m.id, o.id);
3105
+ v.stopPropagation(), a(m.id, u.id);
3033
3106
  }
3034
3107
  }
3035
3108
  )
3036
3109
  ] }),
3037
- children: /* @__PURE__ */ u(w, { layout: "vertical", children: [
3110
+ children: /* @__PURE__ */ h(w, { layout: "vertical", children: [
3038
3111
  /* @__PURE__ */ e(w.Item, { label: "状态名称", children: /* @__PURE__ */ e(
3039
- le,
3112
+ re,
3040
3113
  {
3041
- value: o.name,
3042
- onChange: (v) => i(m.id, o.id, { name: v.target.value }),
3114
+ value: u.name,
3115
+ onChange: (v) => i(m.id, u.id, { name: v.target.value }),
3043
3116
  placeholder: "输入状态名称"
3044
3117
  }
3045
3118
  ) }),
@@ -3049,10 +3122,10 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3049
3122
  label: "执行表达式",
3050
3123
  help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
3051
3124
  children: /* @__PURE__ */ e(
3052
- Wn,
3125
+ Hn,
3053
3126
  {
3054
- value: o.expression,
3055
- onChange: (v) => i(m.id, o.id, { expression: v.target.value }),
3127
+ value: u.expression,
3128
+ onChange: (v) => i(m.id, u.id, { expression: v.target.value }),
3056
3129
  rows: 3,
3057
3130
  placeholder: "return true;"
3058
3131
  }
@@ -3063,22 +3136,22 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3063
3136
  Ie,
3064
3137
  {
3065
3138
  mode: "tags",
3066
- value: o.bindCodes || [],
3067
- onChange: (v) => i(m.id, o.id, { bindCodes: v }),
3139
+ value: u.bindCodes || [],
3140
+ onChange: (v) => i(m.id, u.id, { bindCodes: v }),
3068
3141
  placeholder: "输入数据源 code",
3069
3142
  tokenSeparators: [",", " "]
3070
3143
  }
3071
3144
  ) }),
3072
- /* @__PURE__ */ e(w.Item, { label: "更换物料", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
3073
- /* @__PURE__ */ e(he, { color: "blue", children: o.material.name }),
3074
- /* @__PURE__ */ e(he, { color: "default", children: o.material.type }),
3145
+ /* @__PURE__ */ e(w.Item, { label: "更换物料", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3146
+ /* @__PURE__ */ e(ye, { color: "blue", children: u.material.name }),
3147
+ /* @__PURE__ */ e(ye, { color: "default", children: u.material.type }),
3075
3148
  /* @__PURE__ */ e(
3076
3149
  Ie,
3077
3150
  {
3078
3151
  placeholder: "选择新物料",
3079
3152
  style: { width: 150 },
3080
3153
  value: void 0,
3081
- onChange: (v) => v && c(m.id, o.id, v),
3154
+ onChange: (v) => v && d(m.id, u.id, v),
3082
3155
  options: r.map((v) => ({
3083
3156
  value: v.id,
3084
3157
  label: `${v.name} (${v.type})`
@@ -3086,51 +3159,51 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3086
3159
  }
3087
3160
  )
3088
3161
  ] }) }),
3089
- /* @__PURE__ */ e(De, { style: { margin: "12px 0" } }),
3090
- /* @__PURE__ */ u("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3091
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-2", children: [
3162
+ /* @__PURE__ */ e(Me, { style: { margin: "12px 0" } }),
3163
+ /* @__PURE__ */ h("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3164
+ /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3092
3165
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
3093
- /* @__PURE__ */ e(he, { children: o.material.name })
3166
+ /* @__PURE__ */ e(ye, { children: u.material.name })
3094
3167
  ] }),
3095
3168
  /* @__PURE__ */ e(
3096
- Wt,
3169
+ Ht,
3097
3170
  {
3098
- material: o.material,
3171
+ material: u.material,
3099
3172
  onSave: (v) => {
3100
- const N = { ...o.material, ...v };
3101
- i(m.id, o.id, { material: N });
3173
+ const I = { ...u.material, ...v };
3174
+ i(m.id, u.id, { material: I });
3102
3175
  }
3103
3176
  }
3104
3177
  )
3105
3178
  ] })
3106
3179
  ] })
3107
3180
  },
3108
- o.id
3181
+ u.id
3109
3182
  )) })
3110
3183
  ] })
3111
3184
  },
3112
3185
  m.id
3113
3186
  )) })
3114
3187
  ] });
3115
- }, { Panel: Ee } = Ne, { TabPane: ct } = Lt, { TextArea: Un } = le, Hn = ({
3188
+ }, { Panel: Ee } = Ne, { TabPane: ut } = Rt, { TextArea: qn } = re, Bn = ({
3116
3189
  defaultTestData: l
3117
3190
  }) => {
3118
3191
  const {
3119
3192
  nodes: f,
3120
3193
  selectedNodeId: t,
3121
3194
  updateNode: r,
3122
- updateNodeStyle: s,
3195
+ updateNodeStyle: c,
3123
3196
  updateNodeControl: n,
3124
3197
  updateNodeContent: a,
3125
3198
  materials: i,
3126
3199
  selectedStatusId: p,
3127
- selectStatus: c
3128
- } = Re(), [m] = w.useForm(), [C, o] = Q("basic"), [I, v] = Q(!1), [N, g] = Q(null), [A, z] = Q({}), T = Ce.useMemo(() => f.find((h) => h.id === t), [f, t]), Y = T?.contentInfo.statusList || [], X = (h) => {
3129
- t && (h.normalStyle && s(t, h.normalStyle), h.name !== void 0 && r(t, { name: h.name }), h.controlInfo && n(t, h.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));
3130
3203
  };
3131
- me(() => {
3132
- T && (m.setFieldsValue({
3133
- name: T.name,
3204
+ console.log(t, "selectedNodeId", X), me(() => {
3205
+ X && X && (m.setFieldsValue({
3206
+ name: X.name,
3134
3207
  normalStyle: {
3135
3208
  width: 100,
3136
3209
  height: 100,
@@ -3140,110 +3213,110 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3140
3213
  background: "transparent",
3141
3214
  borderRadius: 0,
3142
3215
  opacity: 1,
3143
- ...T.normalStyle
3216
+ ...X.normalStyle
3144
3217
  },
3145
3218
  controlInfo: {
3146
3219
  isDraggable: !0,
3147
3220
  isClickable: !0,
3148
3221
  isResizable: !0,
3149
3222
  isSelectable: !0,
3150
- ...T.controlInfo
3223
+ ...X.controlInfo
3151
3224
  }
3152
- }), c(null));
3153
- }, [T?.id, m, c]);
3154
- const ye = () => {
3155
- !t || !T || (g("new"), v(!0));
3156
- }, te = (h) => {
3157
- if (!t || !T) return;
3158
- const $ = {
3159
- id: U(),
3160
- name: `${h.name}_状态${Y.length + 1}`,
3161
- expression: Y.length === 0 ? "return true;" : "return false;",
3162
- material: { ...h, id: U() },
3225
+ }), d(null));
3226
+ }, [X, d, m]);
3227
+ const xe = () => {
3228
+ !t || !X || (g("new"), v(!0));
3229
+ }, ne = (s) => {
3230
+ if (!t || !X) return;
3231
+ const q = {
3232
+ id: H(),
3233
+ name: `${s.name}_状态${$.length + 1}`,
3234
+ expression: $.length === 0 ? "return true;" : "return false;",
3235
+ material: { ...s, id: H() },
3163
3236
  bindCodes: []
3164
3237
  };
3165
- if (N === "new") {
3166
- const k = [...Y, $];
3167
- a(t, { statusList: k });
3168
- } else if (N) {
3169
- const k = Y.map((b) => b.id === N ? { ...b, material: { ...h, id: U() } } : b);
3170
- a(t, { statusList: k });
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 });
3171
3244
  }
3172
3245
  v(!1), g(null);
3173
- }, ve = (h) => {
3174
- if (!t || !T) return;
3175
- const $ = T.contentInfo.statusList?.filter((k) => k.id !== h) || [];
3176
- a(t, { statusList: $ }), p === h && c(null);
3177
- }, ne = (h, $) => {
3178
- if (!t || !T) return;
3179
- const k = T.contentInfo.statusList?.map((b) => b.id === h ? { ...b, ...$ } : b) || [];
3180
- a(t, { statusList: k });
3181
- }, j = (h) => {
3182
- if (!t || !T) return;
3183
- const $ = {
3184
- ...h,
3185
- id: U(),
3186
- name: `${h.name}_复制`,
3246
+ }, we = (s) => {
3247
+ if (!t || !X) return;
3248
+ const q = X.contentInfo.statusList?.filter((b) => b.id !== s) || [];
3249
+ a(t, { statusList: q }), p === s && d(null);
3250
+ }, ie = (s, q) => {
3251
+ if (!t || !X) return;
3252
+ const b = X.contentInfo.statusList?.map((Y) => Y.id === s ? { ...Y, ...q } : Y) || [];
3253
+ a(t, { statusList: b });
3254
+ }, A = (s) => {
3255
+ if (!t || !X) return;
3256
+ const q = {
3257
+ ...s,
3258
+ id: H(),
3259
+ name: `${s.name}_复制`,
3187
3260
  expression: "return false;"
3188
- }, k = [...Y, $];
3189
- a(t, { statusList: k });
3190
- }, O = (h, $) => {
3191
- if (!t || !T) return;
3192
- const k = Y.findIndex((Z) => Z.id === h);
3193
- if (k === -1) return;
3194
- const b = [...Y];
3195
- $ === "up" && k > 0 ? [b[k], b[k - 1]] = [
3196
- b[k - 1],
3197
- b[k]
3198
- ] : $ === "down" && k < b.length - 1 && ([b[k], b[k + 1]] = [
3199
- b[k + 1],
3200
- b[k]
3201
- ]), a(t, { statusList: b });
3202
- }, V = (h) => {
3203
- g(h), v(!0);
3204
- }, D = (h, $) => {
3205
- if (!t || !T) return;
3206
- const k = Y.map((b) => b.id === h ? {
3207
- ...b,
3208
- material: { ...b.material, ...$ }
3209
- } : b);
3210
- a(t, { statusList: k });
3261
+ }, b = [...$, q];
3262
+ a(t, { statusList: b });
3263
+ }, J = (s, q) => {
3264
+ if (!t || !X) return;
3265
+ const b = $.findIndex((M) => M.id === s);
3266
+ if (b === -1) return;
3267
+ const Y = [...$];
3268
+ q === "up" && b > 0 ? [Y[b], Y[b - 1]] = [
3269
+ Y[b - 1],
3270
+ Y[b]
3271
+ ] : q === "down" && b < Y.length - 1 && ([Y[b], Y[b + 1]] = [
3272
+ Y[b + 1],
3273
+ Y[b]
3274
+ ]), a(t, { statusList: Y });
3275
+ }, G = (s) => {
3276
+ g(s), v(!0);
3277
+ }, T = (s, q) => {
3278
+ if (!t || !X) return;
3279
+ const b = $.map((Y) => Y.id === s ? {
3280
+ ...Y,
3281
+ material: { ...Y.material, ...q }
3282
+ } : Y);
3283
+ a(t, { statusList: b });
3211
3284
  };
3212
- return T ? /* @__PURE__ */ u("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
3213
- /* @__PURE__ */ u("div", { className: "p-4 border-b border-gray-200", children: [
3285
+ return X ? /* @__PURE__ */ h("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
3286
+ /* @__PURE__ */ h("div", { className: "p-4 border-b border-gray-200", children: [
3214
3287
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "属性面板" }),
3215
3288
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "编辑选中节点的属性" })
3216
3289
  ] }),
3217
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ u(Lt, { activeKey: C, onChange: o, children: [
3218
- /* @__PURE__ */ e(ct, { tab: "基础", children: /* @__PURE__ */ u(
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(
3219
3292
  w,
3220
3293
  {
3221
3294
  form: m,
3222
3295
  layout: "vertical",
3223
- onValuesChange: X,
3224
- initialValues: { name: T.name },
3296
+ onValuesChange: L,
3297
+ initialValues: { name: X.name },
3225
3298
  children: [
3226
- /* @__PURE__ */ e(w.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(le, { placeholder: "输入节点名称" }) }),
3227
- /* @__PURE__ */ u(Ne, { ghost: !0, defaultActiveKey: ["position", "size", "style"], children: [
3228
- /* @__PURE__ */ e(Ee, { header: "位置", children: /* @__PURE__ */ u(pe, { children: [
3229
- /* @__PURE__ */ e(w.Item, { label: "X", name: ["normalStyle", "x"], children: /* @__PURE__ */ e(ee, {}) }),
3230
- /* @__PURE__ */ e(w.Item, { label: "Y", name: ["normalStyle", "y"], children: /* @__PURE__ */ e(ee, {}) })
3299
+ /* @__PURE__ */ e(w.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(re, { placeholder: "输入节点名称" }) }),
3300
+ /* @__PURE__ */ h(Ne, { ghost: !0, defaultActiveKey: ["position", "size", "style"], children: [
3301
+ /* @__PURE__ */ e(Ee, { header: "位置", children: /* @__PURE__ */ h(be, { children: [
3302
+ /* @__PURE__ */ e(w.Item, { label: "X", name: ["normalStyle", "x"], children: /* @__PURE__ */ e(te, {}) }),
3303
+ /* @__PURE__ */ e(w.Item, { label: "Y", name: ["normalStyle", "y"], children: /* @__PURE__ */ e(te, {}) })
3231
3304
  ] }) }, "position"),
3232
- /* @__PURE__ */ e(Ee, { header: "尺寸", children: /* @__PURE__ */ u(pe, { children: [
3233
- /* @__PURE__ */ e(w.Item, { label: "宽度", name: ["normalStyle", "width"], children: /* @__PURE__ */ e(ee, { min: 10 }) }),
3234
- /* @__PURE__ */ e(w.Item, { label: "高度", name: ["normalStyle", "height"], children: /* @__PURE__ */ e(ee, { min: 10 }) })
3305
+ /* @__PURE__ */ e(Ee, { header: "尺寸", children: /* @__PURE__ */ h(be, { children: [
3306
+ /* @__PURE__ */ e(w.Item, { label: "宽度", name: ["normalStyle", "width"], children: /* @__PURE__ */ e(te, { min: 10 }) }),
3307
+ /* @__PURE__ */ e(w.Item, { label: "高度", name: ["normalStyle", "height"], children: /* @__PURE__ */ e(te, { min: 10 }) })
3235
3308
  ] }) }, "size"),
3236
- /* @__PURE__ */ u(Ee, { header: "样式", children: [
3237
- /* @__PURE__ */ e(w.Item, { label: "背景色", name: ["normalStyle", "background"], children: /* @__PURE__ */ e(le, { placeholder: "transparent, #fff, url(...)" }) }),
3238
- /* @__PURE__ */ e(w.Item, { label: "内边距", name: ["normalStyle", "padding"], children: /* @__PURE__ */ e(ee, { min: 0 }) }),
3239
- /* @__PURE__ */ e(w.Item, { label: "圆角", name: ["normalStyle", "borderRadius"], children: /* @__PURE__ */ e(ee, { min: 0 }) }),
3309
+ /* @__PURE__ */ h(Ee, { header: "样式", children: [
3310
+ /* @__PURE__ */ e(w.Item, { label: "背景色", name: ["normalStyle", "background"], children: /* @__PURE__ */ e(re, { placeholder: "transparent, #fff, url(...)" }) }),
3311
+ /* @__PURE__ */ e(w.Item, { label: "内边距", name: ["normalStyle", "padding"], children: /* @__PURE__ */ e(te, { min: 0 }) }),
3312
+ /* @__PURE__ */ e(w.Item, { label: "圆角", name: ["normalStyle", "borderRadius"], children: /* @__PURE__ */ e(te, { min: 0 }) }),
3240
3313
  /* @__PURE__ */ e(
3241
3314
  w.Item,
3242
3315
  {
3243
3316
  label: "缩放比例",
3244
3317
  name: ["normalStyle", "scale"],
3245
3318
  help: "等比缩放节点的宽高",
3246
- children: /* @__PURE__ */ e(ee, { min: 0.1, max: 5, step: 0.1 })
3319
+ children: /* @__PURE__ */ e(te, { min: 0.1, max: 5, step: 0.1 })
3247
3320
  }
3248
3321
  ),
3249
3322
  /* @__PURE__ */ e(
@@ -3252,108 +3325,108 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3252
3325
  label: "旋转角度",
3253
3326
  name: ["normalStyle", "rotate"],
3254
3327
  help: "顺时针旋转角度(度)",
3255
- children: /* @__PURE__ */ e(ee, { min: 0, max: 360, step: 1 })
3328
+ children: /* @__PURE__ */ e(te, { min: 0, max: 360, step: 1 })
3256
3329
  }
3257
3330
  ),
3258
- /* @__PURE__ */ e(w.Item, { label: "透明度", name: ["normalStyle", "opacity"], children: /* @__PURE__ */ e(ee, { min: 0, max: 1, step: 0.1 }) }),
3259
- /* @__PURE__ */ e(w.Item, { label: "层级", name: ["normalStyle", "zIndex"], children: /* @__PURE__ */ e(ee, {}) })
3331
+ /* @__PURE__ */ e(w.Item, { label: "透明度", name: ["normalStyle", "opacity"], children: /* @__PURE__ */ e(te, { min: 0, max: 1, step: 0.1 }) }),
3332
+ /* @__PURE__ */ e(w.Item, { label: "层级", name: ["normalStyle", "zIndex"], children: /* @__PURE__ */ e(te, {}) })
3260
3333
  ] }, "style")
3261
3334
  ] })
3262
3335
  ]
3263
3336
  }
3264
3337
  ) }, "basic"),
3265
- /* @__PURE__ */ e(ct, { tab: "状态", children: T.type === "group" && T.children ? /* @__PURE__ */ e(
3266
- Fn,
3338
+ /* @__PURE__ */ e(ut, { tab: "状态", children: X.type === "group" && X.children ? /* @__PURE__ */ e(
3339
+ Gn,
3267
3340
  {
3268
- node: T,
3341
+ node: X,
3269
3342
  updateNode: r,
3270
3343
  materials: i
3271
3344
  }
3272
- ) : /* @__PURE__ */ u("div", { className: "mb-4", children: [
3273
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-2", children: [
3274
- /* @__PURE__ */ u("span", { className: "font-medium", children: [
3345
+ ) : /* @__PURE__ */ h("div", { className: "mb-4", children: [
3346
+ /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3347
+ /* @__PURE__ */ h("span", { className: "font-medium", children: [
3275
3348
  "状态列表",
3276
- /* @__PURE__ */ e(he, { color: "blue", className: "ml-2", children: Y.length })
3349
+ /* @__PURE__ */ e(ye, { color: "blue", className: "ml-2", children: $.length })
3277
3350
  ] }),
3278
3351
  /* @__PURE__ */ e(
3279
- K,
3352
+ Z,
3280
3353
  {
3281
3354
  type: "primary",
3282
3355
  size: "small",
3283
- icon: /* @__PURE__ */ e(Tt, {}),
3284
- onClick: ye,
3356
+ icon: /* @__PURE__ */ e(zt, {}),
3357
+ onClick: xe,
3285
3358
  children: "添加状态"
3286
3359
  }
3287
3360
  )
3288
3361
  ] }),
3289
3362
  /* @__PURE__ */ e("p", { className: "text-xs text-gray-500 mb-3", children: "节点根据状态表达式计算结果显示对应物料,第一个返回 true 的状态为当前状态" }),
3290
- Y.length > 0 && /* @__PURE__ */ e("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ u("div", { children: [
3363
+ $.length > 0 && /* @__PURE__ */ e("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ h("div", { children: [
3291
3364
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "当前状态:" }),
3292
3365
  /* @__PURE__ */ e("span", { className: "ml-2 text-sm font-medium text-blue-600", children: "由表达式自动计算" })
3293
3366
  ] }) }) }),
3294
- Y.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(Ne, { ghost: !0, defaultActiveKey: Y[0]?.id, children: Y.map((h, $) => /* @__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(
3295
3368
  Ee,
3296
3369
  {
3297
- header: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
3298
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: $ + 1 }),
3299
- /* @__PURE__ */ e("span", { className: "font-medium", children: h.name }),
3300
- /* @__PURE__ */ e(he, { color: "default", className: "text-xs", children: h.material.type })
3370
+ header: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3371
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: q + 1 }),
3372
+ /* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
3373
+ /* @__PURE__ */ e(ye, { color: "default", className: "text-xs", children: s.material.type })
3301
3374
  ] }),
3302
- extra: /* @__PURE__ */ u(pe, { size: "small", onClick: (k) => k.stopPropagation(), children: [
3375
+ extra: /* @__PURE__ */ h(be, { size: "small", onClick: (b) => b.stopPropagation(), children: [
3303
3376
  /* @__PURE__ */ e(
3304
- K,
3377
+ Z,
3305
3378
  {
3306
3379
  type: "text",
3307
3380
  size: "small",
3308
- icon: /* @__PURE__ */ e(_t, {}),
3309
- disabled: $ === 0,
3310
- onClick: (k) => {
3311
- k.stopPropagation(), O(h.id, "up");
3381
+ icon: /* @__PURE__ */ e(Ot, {}),
3382
+ disabled: q === 0,
3383
+ onClick: (b) => {
3384
+ b.stopPropagation(), J(s.id, "up");
3312
3385
  }
3313
3386
  }
3314
3387
  ),
3315
3388
  /* @__PURE__ */ e(
3316
- K,
3389
+ Z,
3317
3390
  {
3318
3391
  type: "text",
3319
3392
  size: "small",
3320
- icon: /* @__PURE__ */ e(zt, {}),
3321
- disabled: $ === Y.length - 1,
3322
- onClick: (k) => {
3323
- k.stopPropagation(), O(h.id, "down");
3393
+ icon: /* @__PURE__ */ e(At, {}),
3394
+ disabled: q === $.length - 1,
3395
+ onClick: (b) => {
3396
+ b.stopPropagation(), J(s.id, "down");
3324
3397
  }
3325
3398
  }
3326
3399
  ),
3327
3400
  /* @__PURE__ */ e(
3328
- K,
3401
+ Z,
3329
3402
  {
3330
3403
  type: "text",
3331
3404
  size: "small",
3332
- icon: /* @__PURE__ */ e(Pt, {}),
3333
- onClick: (k) => {
3334
- k.stopPropagation(), j(h);
3405
+ icon: /* @__PURE__ */ e(_t, {}),
3406
+ onClick: (b) => {
3407
+ b.stopPropagation(), A(s);
3335
3408
  }
3336
3409
  }
3337
3410
  ),
3338
3411
  /* @__PURE__ */ e(
3339
- K,
3412
+ Z,
3340
3413
  {
3341
3414
  type: "text",
3342
3415
  size: "small",
3343
3416
  danger: !0,
3344
- icon: /* @__PURE__ */ e(at, {}),
3345
- onClick: (k) => {
3346
- k.stopPropagation(), ve(h.id);
3417
+ icon: /* @__PURE__ */ e(ot, {}),
3418
+ onClick: (b) => {
3419
+ b.stopPropagation(), we(s.id);
3347
3420
  }
3348
3421
  }
3349
3422
  )
3350
3423
  ] }),
3351
- children: /* @__PURE__ */ u(w, { layout: "vertical", children: [
3424
+ children: /* @__PURE__ */ h(w, { layout: "vertical", children: [
3352
3425
  /* @__PURE__ */ e(w.Item, { label: "状态名称", children: /* @__PURE__ */ e(
3353
- le,
3426
+ re,
3354
3427
  {
3355
- value: h.name,
3356
- onChange: (k) => ne(h.id, { name: k.target.value }),
3428
+ value: s.name,
3429
+ onChange: (b) => ie(s.id, { name: b.target.value }),
3357
3430
  placeholder: "输入状态名称"
3358
3431
  }
3359
3432
  ) }),
@@ -3363,17 +3436,17 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3363
3436
  label: "执行表达式",
3364
3437
  help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
3365
3438
  children: /* @__PURE__ */ e(
3366
- Un,
3439
+ qn,
3367
3440
  {
3368
- value: A[h.id] ?? h.expression,
3369
- onChange: (k) => z((b) => ({
3370
- ...b,
3371
- [h.id]: k.target.value
3441
+ value: W[s.id] ?? s.expression,
3442
+ onChange: (b) => O((Y) => ({
3443
+ ...Y,
3444
+ [s.id]: b.target.value
3372
3445
  })),
3373
- onBlur: (k) => {
3374
- ne(h.id, { expression: k.target.value }), z((b) => {
3375
- const Z = { ...b };
3376
- return delete Z[h.id], Z;
3446
+ onBlur: (b) => {
3447
+ ie(s.id, { expression: b.target.value }), O((Y) => {
3448
+ const M = { ...Y };
3449
+ return delete M[s.id], M;
3377
3450
  });
3378
3451
  },
3379
3452
  rows: 3,
@@ -3386,53 +3459,53 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3386
3459
  Ie,
3387
3460
  {
3388
3461
  mode: "tags",
3389
- value: h.bindCodes || [],
3390
- onChange: (k) => ne(h.id, { bindCodes: k }),
3462
+ value: s.bindCodes || [],
3463
+ onChange: (b) => ie(s.id, { bindCodes: b }),
3391
3464
  placeholder: "输入数据源 code",
3392
3465
  tokenSeparators: [",", " "]
3393
3466
  }
3394
3467
  ) }),
3395
- /* @__PURE__ */ e(w.Item, { label: "绑定物料", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
3396
- /* @__PURE__ */ e(he, { color: "blue", children: h.material.name }),
3397
- /* @__PURE__ */ e(he, { color: "default", children: h.material.type }),
3468
+ /* @__PURE__ */ e(w.Item, { label: "绑定物料", children: /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
3469
+ /* @__PURE__ */ e(ye, { color: "blue", children: s.material.name }),
3470
+ /* @__PURE__ */ e(ye, { color: "default", children: s.material.type }),
3398
3471
  /* @__PURE__ */ e(
3399
- K,
3472
+ Z,
3400
3473
  {
3401
3474
  type: "link",
3402
3475
  size: "small",
3403
- icon: /* @__PURE__ */ e(ut, {}),
3404
- onClick: () => V(h.id),
3476
+ icon: /* @__PURE__ */ e(ft, {}),
3477
+ onClick: () => G(s.id),
3405
3478
  children: "更换物料"
3406
3479
  }
3407
3480
  )
3408
3481
  ] }) }),
3409
- /* @__PURE__ */ e(De, { style: { margin: "12px 0" } }),
3410
- /* @__PURE__ */ u("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3411
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-2", children: [
3482
+ /* @__PURE__ */ e(Me, { style: { margin: "12px 0" } }),
3483
+ /* @__PURE__ */ h("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3484
+ /* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
3412
3485
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
3413
- /* @__PURE__ */ e(he, { children: h.material.name })
3486
+ /* @__PURE__ */ e(ye, { children: s.material.name })
3414
3487
  ] }),
3415
3488
  /* @__PURE__ */ e(
3416
- Wt,
3489
+ Ht,
3417
3490
  {
3418
- material: h.material,
3419
- onSave: (k) => D(h.id, k),
3420
- bindCodes: h.bindCodes || [],
3491
+ material: s.material,
3492
+ onSave: (b) => T(s.id, b),
3493
+ bindCodes: s.bindCodes || [],
3421
3494
  dataOptions: l || []
3422
3495
  }
3423
3496
  )
3424
3497
  ] })
3425
3498
  ] })
3426
3499
  },
3427
- h.id
3500
+ s.id + t
3428
3501
  )) })
3429
3502
  ] }) }, "status"),
3430
- /* @__PURE__ */ e(ct, { tab: "控制", children: /* @__PURE__ */ u(
3503
+ /* @__PURE__ */ e(ut, { tab: "控制", children: /* @__PURE__ */ h(
3431
3504
  w,
3432
3505
  {
3433
3506
  form: m,
3434
3507
  layout: "vertical",
3435
- onValuesChange: X,
3508
+ onValuesChange: L,
3436
3509
  children: [
3437
3510
  /* @__PURE__ */ e(
3438
3511
  w.Item,
@@ -3474,77 +3547,77 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3474
3547
  }
3475
3548
  ) }, "control")
3476
3549
  ] }) }),
3477
- /* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ u("div", { className: "text-xs text-gray-500", children: [
3478
- /* @__PURE__ */ u("div", { children: [
3550
+ /* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ h("div", { className: "text-xs text-gray-500", children: [
3551
+ /* @__PURE__ */ h("div", { children: [
3479
3552
  "节点 ID: ",
3480
- T.id.slice(0, 8),
3553
+ X.id.slice(0, 8),
3481
3554
  "..."
3482
3555
  ] }),
3483
- /* @__PURE__ */ u("div", { children: [
3556
+ /* @__PURE__ */ h("div", { children: [
3484
3557
  "状态数: ",
3485
- Y.length
3558
+ $.length
3486
3559
  ] })
3487
3560
  ] }) }),
3488
3561
  /* @__PURE__ */ e(
3489
- rt,
3562
+ it,
3490
3563
  {
3491
3564
  title: "选择物料",
3492
- open: I,
3565
+ open: k,
3493
3566
  onCancel: () => {
3494
3567
  v(!1), g(null);
3495
3568
  },
3496
3569
  footer: null,
3497
3570
  width: 600,
3498
- children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ u(Ne, { ghost: !0, defaultActiveKey: ["basic", "device", "text", "line"], children: [
3499
- /* @__PURE__ */ e(Ee, { header: "基础形状", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((h) => ["矩形", "圆形", "圆角矩形"].includes(h.name)).map((h) => /* @__PURE__ */ e(
3500
- Et,
3571
+ children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ h(Ne, { ghost: !0, defaultActiveKey: ["basic", "device", "text", "line"], children: [
3572
+ /* @__PURE__ */ e(Ee, { header: "基础形状", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((s) => ["矩形", "圆形", "圆角矩形"].includes(s.name)).map((s) => /* @__PURE__ */ e(
3573
+ Lt,
3501
3574
  {
3502
- material: h,
3503
- onClick: () => te(h)
3575
+ material: s,
3576
+ onClick: () => ne(s)
3504
3577
  },
3505
- h.id
3578
+ s.id
3506
3579
  )) }) }, "basic"),
3507
3580
  /* @__PURE__ */ e(Ee, { header: "设备图标", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter(
3508
- (h) => ["阀门", "泵", "罐体"].includes(h.name) || h.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(h.name)
3509
- ).map((h) => /* @__PURE__ */ e(
3510
- Et,
3581
+ (s) => ["阀门", "泵", "罐体"].includes(s.name) || s.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(s.name)
3582
+ ).map((s) => /* @__PURE__ */ e(
3583
+ Lt,
3511
3584
  {
3512
- material: h,
3513
- onClick: () => te(h)
3585
+ material: s,
3586
+ onClick: () => ne(s)
3514
3587
  },
3515
- h.id
3588
+ s.id
3516
3589
  )) }) }, "device"),
3517
- /* @__PURE__ */ e(Ee, { header: "文本", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((h) => h.type === "TEXT").map((h) => /* @__PURE__ */ u(
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(
3518
3591
  "div",
3519
3592
  {
3520
3593
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
3521
- onClick: () => te(h),
3594
+ onClick: () => ne(s),
3522
3595
  children: [
3523
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" }) }),
3524
- /* @__PURE__ */ e("span", { className: "text-xs", children: h.name })
3597
+ /* @__PURE__ */ e("span", { className: "text-xs", children: s.name })
3525
3598
  ]
3526
3599
  },
3527
- h.id
3600
+ s.id
3528
3601
  )) }) }, "text"),
3529
- /* @__PURE__ */ e(Ee, { header: "线条", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: i.filter((h) => h.type === "LINE").map((h) => /* @__PURE__ */ u(
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(
3530
3603
  "div",
3531
3604
  {
3532
3605
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
3533
- onClick: () => te(h),
3606
+ onClick: () => ne(s),
3534
3607
  children: [
3535
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" }) }),
3536
- /* @__PURE__ */ e("span", { className: "text-xs", children: h.name })
3609
+ /* @__PURE__ */ e("span", { className: "text-xs", children: s.name })
3537
3610
  ]
3538
3611
  },
3539
- h.id
3612
+ s.id
3540
3613
  )) }) }, "line")
3541
3614
  ] }) })
3542
3615
  }
3543
3616
  )
3544
- ] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(ue, { description: "请选择一个节点" }) });
3545
- }, Et = ({ 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 }) => {
3546
3619
  const t = l.type === "IMAGE" ? l.src : void 0;
3547
- return /* @__PURE__ */ u(
3620
+ return /* @__PURE__ */ h(
3548
3621
  "div",
3549
3622
  {
3550
3623
  className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
@@ -3555,21 +3628,21 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3555
3628
  ]
3556
3629
  }
3557
3630
  );
3558
- }, Gn = "ConfigEditor-module__configEditor__dinNG", qn = {
3559
- configEditor: Gn
3560
- }, { Header: Bn, Sider: Dt, Content: Vn } = dt, rl = ({
3631
+ }, Vn = "ConfigEditor-module__configEditor__dinNG", Zn = {
3632
+ configEditor: Vn
3633
+ }, { Header: Jn, Sider: Yt, Content: Kn } = ht, ol = ({
3561
3634
  initialScheme: l,
3562
3635
  onChange: f,
3563
3636
  readonly: t = !1,
3564
3637
  headerExtra: r,
3565
- className: s = "",
3638
+ className: c = "",
3566
3639
  style: n,
3567
3640
  showHeader: a = !0,
3568
3641
  showMaterialPanel: i = !0,
3569
3642
  showPropertyPanel: p = !0,
3570
- customMaterials: c
3643
+ customMaterials: d
3571
3644
  }) => {
3572
- const [m, C] = Ce.useState(!1), [o, I] = Ce.useState(""), [v, N] = Ce.useState([
3645
+ const [m, S] = Ce.useState(!1), [u, k] = Ce.useState(""), [v, I] = Ce.useState([
3573
3646
  {
3574
3647
  paramsCode: "001",
3575
3648
  paramsName: "通频速度有效值",
@@ -3582,103 +3655,103 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3582
3655
  value: 1.5,
3583
3656
  paramsUnit: "m/s²"
3584
3657
  }
3585
- ]), { exportScheme: g, importScheme: A, nodes: z, materials: T, addMaterial: Y } = Re();
3658
+ ]), { exportScheme: g, importScheme: W, nodes: O, materials: X, addMaterial: $ } = ze();
3586
3659
  Ce.useRef(null);
3587
- const X = Ce.useRef(!1);
3660
+ const L = Ce.useRef(!1);
3588
3661
  me(() => {
3589
- X.current || (X.current = !0, T.length === 0 && kn.forEach((j) => Y(j)), c && c.length > 0 && c.forEach((j) => Y(j)), l && A(l));
3662
+ L.current || (L.current = !0, X.length === 0 && Dn.forEach((A) => $(A)), d && d.length > 0 && d.forEach((A) => $(A)), l && W(l));
3590
3663
  }, []), me(() => {
3591
3664
  if (f) {
3592
- const j = g();
3593
- f(j);
3665
+ const A = g();
3666
+ f(A);
3594
3667
  }
3595
- }, [z, f]);
3596
- const ye = B(() => {
3597
- const j = g(), O = JSON.stringify(j, null, 2), V = "data:application/json;charset=utf-8," + encodeURIComponent(O), D = `scheme_${Date.now()}.json`, h = document.createElement("a");
3598
- h.setAttribute("href", V), h.setAttribute("download", D), h.click(), Fe.success("导出成功!");
3599
- }, [g]), te = B(() => {
3668
+ }, [O, f]);
3669
+ const xe = V(() => {
3670
+ const A = g(), J = JSON.stringify(A, null, 2), G = "data:application/json;charset=utf-8," + encodeURIComponent(J), T = `scheme_${Date.now()}.json`, s = document.createElement("a");
3671
+ s.setAttribute("href", G), s.setAttribute("download", T), s.click(), Ye.success("导出成功!");
3672
+ }, [g]), ne = V(() => {
3600
3673
  try {
3601
- const j = JSON.parse(o);
3602
- A(j), C(!1), I(""), Fe.success("导入成功!");
3674
+ const A = JSON.parse(u);
3675
+ W(A), S(!1), k(""), Ye.success("导入成功!");
3603
3676
  } catch {
3604
- Fe.error("JSON 格式错误,请检查输入");
3677
+ Ye.error("JSON 格式错误,请检查输入");
3605
3678
  }
3606
- }, [o, A]), ve = B(
3607
- (j) => {
3608
- const O = new FileReader();
3609
- return O.onload = (V) => {
3679
+ }, [u, W]), we = V(
3680
+ (A) => {
3681
+ const J = new FileReader();
3682
+ return J.onload = (G) => {
3610
3683
  try {
3611
- const D = V.target?.result, h = JSON.parse(D);
3612
- A(h), Fe.success("导入成功!");
3684
+ const T = G.target?.result, s = JSON.parse(T);
3685
+ W(s), Ye.success("导入成功!"), S(!1);
3613
3686
  } catch {
3614
- Fe.error("文件格式错误");
3687
+ Ye.error("文件格式错误");
3615
3688
  }
3616
- }, O.readAsText(j), !1;
3689
+ }, J.readAsText(A), !1;
3617
3690
  },
3618
- [A]
3619
- ), ne = B(() => g(), [g]);
3691
+ [W]
3692
+ ), ie = V(() => g(), [g]);
3620
3693
  return Ce.useImperativeHandle(
3621
3694
  Ce.useRef?.(),
3622
3695
  () => ({
3623
- getScheme: ne,
3696
+ getScheme: ie,
3624
3697
  exportScheme: g,
3625
- importScheme: A
3698
+ importScheme: W
3626
3699
  }),
3627
- [ne, g, A]
3628
- ), /* @__PURE__ */ e(Gt, { locale: Cn, children: /* @__PURE__ */ e("div", { className: qn.configEditor, style: n, children: /* @__PURE__ */ u(
3629
- dt,
3700
+ [ie, g, W]
3701
+ ), /* @__PURE__ */ e(Bt, { locale: kn, children: /* @__PURE__ */ e("div", { className: Zn.configEditor, style: n, children: /* @__PURE__ */ h(
3702
+ ht,
3630
3703
  {
3631
- className: `h-full w-full overflow-hidden ${s}`,
3704
+ className: `h-full w-full overflow-hidden ${c}`,
3632
3705
  children: [
3633
- a && /* @__PURE__ */ u(Bn, { className: "bg-white border-b border-gray-200 px-4 flex items-center justify-between flex-shrink-0", children: [
3634
- /* @__PURE__ */ u("div", { className: "flex items-center gap-4", 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: [
3707
+ /* @__PURE__ */ h("div", { className: "flex items-center gap-4", children: [
3635
3708
  /* @__PURE__ */ e("div", { className: "text-xl font-bold text-blue-600", children: "组态编辑器" }),
3636
- /* @__PURE__ */ u("div", { className: "text-sm text-gray-500", children: [
3637
- z.length,
3709
+ /* @__PURE__ */ h("div", { className: "text-sm text-gray-500", children: [
3710
+ O.length,
3638
3711
  " 个节点"
3639
3712
  ] })
3640
3713
  ] }),
3641
- /* @__PURE__ */ u(pe, { children: [
3714
+ /* @__PURE__ */ h(be, { children: [
3642
3715
  r,
3643
- !t && /* @__PURE__ */ u(Ae, { children: [
3644
- /* @__PURE__ */ e(Le, { title: "导出 JSON", children: /* @__PURE__ */ e(K, { icon: /* @__PURE__ */ e(dn, {}), onClick: ye, children: "导出" }) }),
3716
+ !t && /* @__PURE__ */ h(Oe, { children: [
3717
+ /* @__PURE__ */ e(Le, { title: "导出 JSON", children: /* @__PURE__ */ e(Z, { icon: /* @__PURE__ */ e(mn, {}), onClick: xe, children: "导出" }) }),
3645
3718
  /* @__PURE__ */ e(Le, { title: "导入 JSON", children: /* @__PURE__ */ e(
3646
- K,
3719
+ Z,
3647
3720
  {
3648
- icon: /* @__PURE__ */ e(Xt, {}),
3649
- onClick: () => C(!0),
3721
+ icon: /* @__PURE__ */ e(mt, {}),
3722
+ onClick: () => S(!0),
3650
3723
  children: "导入"
3651
3724
  }
3652
3725
  ) })
3653
3726
  ] })
3654
3727
  ] })
3655
3728
  ] }),
3656
- /* @__PURE__ */ u(dt, { children: [
3657
- i && !t && /* @__PURE__ */ e(Dt, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(En, {}) }),
3658
- /* @__PURE__ */ e(Vn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(zn, { defaultTestData: v }) }),
3659
- p && !t && /* @__PURE__ */ e(Dt, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(Hn, { defaultTestData: v }) })
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 }) })
3660
3733
  ] }),
3661
3734
  /* @__PURE__ */ e(
3662
- rt,
3735
+ it,
3663
3736
  {
3664
3737
  title: "导入组态方案",
3665
3738
  open: m,
3666
- onOk: te,
3739
+ onOk: ne,
3667
3740
  onCancel: () => {
3668
- C(!1), I("");
3741
+ S(!1), k("");
3669
3742
  },
3670
3743
  width: 600,
3671
- children: /* @__PURE__ */ u("div", { className: "space-y-4", children: [
3672
- /* @__PURE__ */ u("div", { children: [
3744
+ children: /* @__PURE__ */ h("div", { className: "space-y-4", children: [
3745
+ /* @__PURE__ */ h("div", { children: [
3673
3746
  /* @__PURE__ */ e("p", { className: "mb-2", children: "选择 JSON 文件导入:" }),
3674
3747
  /* @__PURE__ */ e(
3675
3748
  "input",
3676
3749
  {
3677
3750
  type: "file",
3678
3751
  accept: ".json",
3679
- onChange: (j) => {
3680
- const O = j.target.files?.[0];
3681
- O && ve(O);
3752
+ onChange: (A) => {
3753
+ const J = A.target.files?.[0];
3754
+ J && we(J);
3682
3755
  },
3683
3756
  className: `block w-full text-sm text-gray-500
3684
3757
  file:mr-4 file:py-2 file:px-4
@@ -3690,13 +3763,13 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3690
3763
  )
3691
3764
  ] }),
3692
3765
  /* @__PURE__ */ e("div", { className: "text-center text-gray-400", children: "或" }),
3693
- /* @__PURE__ */ u("div", { children: [
3766
+ /* @__PURE__ */ h("div", { children: [
3694
3767
  /* @__PURE__ */ e("p", { className: "mb-2", children: "粘贴 JSON 内容:" }),
3695
3768
  /* @__PURE__ */ e(
3696
3769
  "textarea",
3697
3770
  {
3698
- value: o,
3699
- onChange: (j) => I(j.target.value),
3771
+ value: u,
3772
+ onChange: (A) => k(A.target.value),
3700
3773
  placeholder: "粘贴 JSON 内容...",
3701
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"
3702
3775
  }
@@ -3710,14 +3783,14 @@ const Cn = /* @__PURE__ */ gn(Sn), Nn = (l) => (f, t, r) => (r.setState = (s, n,
3710
3783
  ) }) });
3711
3784
  };
3712
3785
  export {
3713
- zn as Canvas,
3714
- rl as ConfigEditor,
3715
- En as MaterialPanel,
3716
- jt as NodeRenderer,
3717
- Hn as PropertyPanel,
3718
- Mn as createDefaultNode,
3719
- At as createDefaultStatus,
3720
- kn as initMaterials,
3721
- Re 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
3722
3795
  };
3723
3796
  //# sourceMappingURL=config-editor.es.js.map