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