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