jch-config-editor 0.1.3 → 0.1.4
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,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
-
import de, { useState as
|
|
3
|
-
import { Typography as wt, Upload as
|
|
4
|
-
import { UploadOutlined as Ct, EditOutlined as nt, DeleteOutlined as
|
|
2
|
+
import de, { useState as q, useRef as ue, useMemo as xt, useCallback as G, useEffect as se } from "react";
|
|
3
|
+
import { Typography as wt, Upload as Ot, Button as j, Collapse as he, List as xe, Empty as ne, Tag as le, Image as Xt, Space as ae, Tooltip as we, Modal as tt, Form as v, Input as J, Divider as ye, Select as me, InputNumber as V, Tabs as St, Switch as Fe, message as De, ConfigProvider as zt, Layout as Qe } from "antd";
|
|
4
|
+
import { UploadOutlined as Ct, EditOutlined as nt, DeleteOutlined as qe, UndoOutlined as Rt, RedoOutlined as At, GroupOutlined as at, AlignLeftOutlined as jt, AlignRightOutlined as Ft, VerticalAlignTopOutlined as Wt, VerticalAlignBottomOutlined as Ut, ExperimentOutlined as qt, ZoomInOutlined as Gt, ZoomOutOutlined as Bt, SelectOutlined as Vt, DragOutlined as Ht, EyeOutlined as Zt, PlusOutlined as Nt, ArrowUpOutlined as It, ArrowDownOutlined as kt, CopyOutlined as Jt, DownloadOutlined as Kt } from "@ant-design/icons";
|
|
5
5
|
import { create as Qt } from "zustand";
|
|
6
6
|
import { produce as en } from "immer";
|
|
7
7
|
import { nanoid as z } from "nanoid";
|
|
@@ -12,12 +12,12 @@ function ln(n) {
|
|
|
12
12
|
var Le = {}, Ze = { exports: {} }, it;
|
|
13
13
|
function lt() {
|
|
14
14
|
return it || (it = 1, (function(n) {
|
|
15
|
-
function
|
|
15
|
+
function f(t) {
|
|
16
16
|
return t && t.__esModule ? t : {
|
|
17
17
|
default: t
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
n.exports =
|
|
20
|
+
n.exports = f, n.exports.__esModule = !0, n.exports.default = n.exports;
|
|
21
21
|
})(Ze)), Ze.exports;
|
|
22
22
|
}
|
|
23
23
|
var Pe = {}, ot;
|
|
@@ -43,16 +43,16 @@ function rn() {
|
|
|
43
43
|
};
|
|
44
44
|
return Pe.default = n, Pe;
|
|
45
45
|
}
|
|
46
|
-
var Te = {}, $e = {}, _e = {},
|
|
46
|
+
var Te = {}, $e = {}, _e = {}, Ye = {}, st;
|
|
47
47
|
function an() {
|
|
48
|
-
return st || (st = 1, Object.defineProperty(
|
|
48
|
+
return st || (st = 1, Object.defineProperty(Ye, "__esModule", {
|
|
49
49
|
value: !0
|
|
50
|
-
}),
|
|
50
|
+
}), Ye.commonLocale = void 0, Ye.commonLocale = {
|
|
51
51
|
yearFormat: "YYYY",
|
|
52
52
|
dayFormat: "D",
|
|
53
53
|
cellMeridiemFormat: "A",
|
|
54
54
|
monthBeforeYear: !0
|
|
55
|
-
}),
|
|
55
|
+
}), Ye;
|
|
56
56
|
}
|
|
57
57
|
var ct;
|
|
58
58
|
function on() {
|
|
@@ -61,51 +61,51 @@ function on() {
|
|
|
61
61
|
value: !0
|
|
62
62
|
}), _e.default = void 0;
|
|
63
63
|
var n = an();
|
|
64
|
-
function
|
|
64
|
+
function f(h) {
|
|
65
65
|
"@babel/helpers - typeof";
|
|
66
|
-
return
|
|
67
|
-
return typeof
|
|
68
|
-
} : function(
|
|
69
|
-
return
|
|
70
|
-
},
|
|
66
|
+
return f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(p) {
|
|
67
|
+
return typeof p;
|
|
68
|
+
} : function(p) {
|
|
69
|
+
return p && typeof Symbol == "function" && p.constructor === Symbol && p !== Symbol.prototype ? "symbol" : typeof p;
|
|
70
|
+
}, f(h);
|
|
71
71
|
}
|
|
72
|
-
function t(
|
|
73
|
-
var u = Object.keys(
|
|
72
|
+
function t(h, p) {
|
|
73
|
+
var u = Object.keys(h);
|
|
74
74
|
if (Object.getOwnPropertySymbols) {
|
|
75
|
-
var b = Object.getOwnPropertySymbols(
|
|
76
|
-
|
|
77
|
-
return Object.getOwnPropertyDescriptor(
|
|
75
|
+
var b = Object.getOwnPropertySymbols(h);
|
|
76
|
+
p && (b = b.filter(function(s) {
|
|
77
|
+
return Object.getOwnPropertyDescriptor(h, s).enumerable;
|
|
78
78
|
})), u.push.apply(u, b);
|
|
79
79
|
}
|
|
80
80
|
return u;
|
|
81
81
|
}
|
|
82
|
-
function r(
|
|
83
|
-
for (var
|
|
84
|
-
var u = arguments[
|
|
85
|
-
|
|
86
|
-
d(
|
|
87
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
88
|
-
Object.defineProperty(
|
|
82
|
+
function r(h) {
|
|
83
|
+
for (var p = 1; p < arguments.length; p++) {
|
|
84
|
+
var u = arguments[p] != null ? arguments[p] : {};
|
|
85
|
+
p % 2 ? t(Object(u), !0).forEach(function(b) {
|
|
86
|
+
d(h, b, u[b]);
|
|
87
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(h, Object.getOwnPropertyDescriptors(u)) : t(Object(u)).forEach(function(b) {
|
|
88
|
+
Object.defineProperty(h, b, Object.getOwnPropertyDescriptor(u, b));
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return h;
|
|
92
92
|
}
|
|
93
|
-
function d(
|
|
94
|
-
return
|
|
93
|
+
function d(h, p, u) {
|
|
94
|
+
return p = l(p), p in h ? Object.defineProperty(h, p, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : h[p] = u, h;
|
|
95
95
|
}
|
|
96
|
-
function l(
|
|
97
|
-
var
|
|
98
|
-
return
|
|
96
|
+
function l(h) {
|
|
97
|
+
var p = a(h, "string");
|
|
98
|
+
return f(p) == "symbol" ? p : String(p);
|
|
99
99
|
}
|
|
100
|
-
function a(
|
|
101
|
-
if (
|
|
102
|
-
var u =
|
|
100
|
+
function a(h, p) {
|
|
101
|
+
if (f(h) != "object" || !h) return h;
|
|
102
|
+
var u = h[Symbol.toPrimitive];
|
|
103
103
|
if (u !== void 0) {
|
|
104
|
-
var b = u.call(
|
|
105
|
-
if (
|
|
104
|
+
var b = u.call(h, p);
|
|
105
|
+
if (f(b) != "object") return b;
|
|
106
106
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
107
107
|
}
|
|
108
|
-
return (
|
|
108
|
+
return (p === "string" ? String : Number)(h);
|
|
109
109
|
}
|
|
110
110
|
var o = r(r({}, n.commonLocale), {}, {
|
|
111
111
|
locale: "zh_CN",
|
|
@@ -137,27 +137,27 @@ function on() {
|
|
|
137
137
|
});
|
|
138
138
|
return _e.default = o, _e;
|
|
139
139
|
}
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
if (dt) return
|
|
143
|
-
dt = 1, Object.defineProperty(
|
|
140
|
+
var Oe = {}, dt;
|
|
141
|
+
function Et() {
|
|
142
|
+
if (dt) return Oe;
|
|
143
|
+
dt = 1, Object.defineProperty(Oe, "__esModule", {
|
|
144
144
|
value: !0
|
|
145
|
-
}),
|
|
145
|
+
}), Oe.default = void 0;
|
|
146
146
|
const n = {
|
|
147
147
|
placeholder: "请选择时间",
|
|
148
148
|
rangePlaceholder: ["开始时间", "结束时间"]
|
|
149
149
|
};
|
|
150
|
-
return
|
|
150
|
+
return Oe.default = n, Oe;
|
|
151
151
|
}
|
|
152
152
|
var ut;
|
|
153
|
-
function
|
|
153
|
+
function Mt() {
|
|
154
154
|
if (ut) return $e;
|
|
155
155
|
ut = 1;
|
|
156
156
|
var n = lt().default;
|
|
157
157
|
Object.defineProperty($e, "__esModule", {
|
|
158
158
|
value: !0
|
|
159
159
|
}), $e.default = void 0;
|
|
160
|
-
var
|
|
160
|
+
var f = n(on()), t = n(/* @__PURE__ */ Et());
|
|
161
161
|
const r = {
|
|
162
162
|
lang: {
|
|
163
163
|
placeholder: "请选择日期",
|
|
@@ -170,7 +170,7 @@ function Et() {
|
|
|
170
170
|
rangeMonthPlaceholder: ["开始月份", "结束月份"],
|
|
171
171
|
rangeQuarterPlaceholder: ["开始季度", "结束季度"],
|
|
172
172
|
rangeWeekPlaceholder: ["开始周", "结束周"],
|
|
173
|
-
...
|
|
173
|
+
...f.default
|
|
174
174
|
},
|
|
175
175
|
timePickerLocale: {
|
|
176
176
|
...t.default
|
|
@@ -186,8 +186,8 @@ function sn() {
|
|
|
186
186
|
Object.defineProperty(Te, "__esModule", {
|
|
187
187
|
value: !0
|
|
188
188
|
}), Te.default = void 0;
|
|
189
|
-
var
|
|
190
|
-
return Te.default =
|
|
189
|
+
var f = n(/* @__PURE__ */ Mt());
|
|
190
|
+
return Te.default = f.default, Te;
|
|
191
191
|
}
|
|
192
192
|
var mt;
|
|
193
193
|
function cn() {
|
|
@@ -197,10 +197,10 @@ function cn() {
|
|
|
197
197
|
Object.defineProperty(Le, "__esModule", {
|
|
198
198
|
value: !0
|
|
199
199
|
}), Le.default = void 0;
|
|
200
|
-
var
|
|
200
|
+
var f = n(rn()), t = n(/* @__PURE__ */ sn()), r = n(/* @__PURE__ */ Mt()), d = n(/* @__PURE__ */ Et());
|
|
201
201
|
const l = "${label}不是一个有效的${type}", a = {
|
|
202
202
|
locale: "zh-cn",
|
|
203
|
-
Pagination:
|
|
203
|
+
Pagination: f.default,
|
|
204
204
|
DatePicker: r.default,
|
|
205
205
|
TimePicker: d.default,
|
|
206
206
|
Calendar: t.default,
|
|
@@ -345,9 +345,9 @@ function dn() {
|
|
|
345
345
|
return ft || (ft = 1, Je = /* @__PURE__ */ cn()), Je;
|
|
346
346
|
}
|
|
347
347
|
var un = /* @__PURE__ */ dn();
|
|
348
|
-
const hn = /* @__PURE__ */ ln(un), mn = (n) => (
|
|
348
|
+
const hn = /* @__PURE__ */ ln(un), mn = (n) => (f, t, r) => (r.setState = (d, l, ...a) => {
|
|
349
349
|
const o = typeof d == "function" ? en(d) : d;
|
|
350
|
-
return
|
|
350
|
+
return f(o, l, ...a);
|
|
351
351
|
}, n(r.setState, t, r)), fn = mn, pt = {
|
|
352
352
|
nodes: [],
|
|
353
353
|
materials: [],
|
|
@@ -369,14 +369,14 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
369
369
|
startPoint: null,
|
|
370
370
|
endPoint: null
|
|
371
371
|
}
|
|
372
|
-
}, ce = (n,
|
|
372
|
+
}, ce = (n, f, t) => ({
|
|
373
373
|
id: z(),
|
|
374
374
|
type: n,
|
|
375
|
-
targetId:
|
|
375
|
+
targetId: f,
|
|
376
376
|
payload: t,
|
|
377
377
|
timestamp: Date.now()
|
|
378
378
|
}), Ie = Qt()(
|
|
379
|
-
fn((n,
|
|
379
|
+
fn((n, f) => ({
|
|
380
380
|
...pt,
|
|
381
381
|
// ========== 节点操作 ==========
|
|
382
382
|
addNode: (t, r = !0) => {
|
|
@@ -403,7 +403,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
403
403
|
updateNodeContent: (t, r) => {
|
|
404
404
|
n((d) => {
|
|
405
405
|
const l = d.nodes.find((a) => a.id === t);
|
|
406
|
-
l && (
|
|
406
|
+
l && (l.contentInfo = { ...l.contentInfo, ...r }, d.history.past.push(ce("PROPERTY_CHANGE", t, { contentInfo: r })));
|
|
407
407
|
});
|
|
408
408
|
},
|
|
409
409
|
updateNodeControl: (t, r) => {
|
|
@@ -445,9 +445,9 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
445
445
|
},
|
|
446
446
|
updateStatus: (t, r, d) => {
|
|
447
447
|
n((l) => {
|
|
448
|
-
const a = l.nodes.find((
|
|
448
|
+
const a = l.nodes.find((h) => h.id === t);
|
|
449
449
|
if (!a) return;
|
|
450
|
-
const o = a.contentInfo.statusList.find((
|
|
450
|
+
const o = a.contentInfo.statusList.find((h) => h.id === r);
|
|
451
451
|
o && Object.assign(o, d);
|
|
452
452
|
});
|
|
453
453
|
},
|
|
@@ -457,7 +457,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
457
457
|
});
|
|
458
458
|
},
|
|
459
459
|
evaluateCurrentStatus: (t, r) => {
|
|
460
|
-
const l =
|
|
460
|
+
const l = f().nodes.find((a) => a.id === t);
|
|
461
461
|
if (l)
|
|
462
462
|
for (const a of l.contentInfo.statusList)
|
|
463
463
|
try {
|
|
@@ -557,7 +557,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
557
557
|
},
|
|
558
558
|
// ========== 导入导出 ==========
|
|
559
559
|
exportScheme: () => {
|
|
560
|
-
const t =
|
|
560
|
+
const t = f();
|
|
561
561
|
return {
|
|
562
562
|
version: "1.1.0",
|
|
563
563
|
nodes: t.nodes,
|
|
@@ -656,24 +656,24 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
656
656
|
expression: "return true;",
|
|
657
657
|
material: { ...n, id: z() },
|
|
658
658
|
bindCodes: []
|
|
659
|
-
}), gn = (n,
|
|
659
|
+
}), gn = (n, f, t) => {
|
|
660
660
|
if (t?.type === "CUSTOM" && t.config?.nodes) {
|
|
661
|
-
const r = t.config.nodes.map((
|
|
662
|
-
...
|
|
661
|
+
const r = t.config.nodes.map((p) => ({
|
|
662
|
+
...p,
|
|
663
663
|
id: z()
|
|
664
664
|
// 重新生成子节点ID
|
|
665
665
|
}));
|
|
666
666
|
let d = 1 / 0, l = 1 / 0, a = -1 / 0, o = -1 / 0;
|
|
667
|
-
r.forEach((
|
|
668
|
-
const u =
|
|
667
|
+
r.forEach((p) => {
|
|
668
|
+
const u = p.normalStyle.x || 0, b = p.normalStyle.y || 0, s = p.normalStyle.width || 0, x = p.normalStyle.height || 0;
|
|
669
669
|
d = Math.min(d, u), l = Math.min(l, b), a = Math.max(a, u + s), o = Math.max(o, b + x);
|
|
670
670
|
});
|
|
671
|
-
const
|
|
672
|
-
...
|
|
671
|
+
const h = r.map((p) => ({
|
|
672
|
+
...p,
|
|
673
673
|
normalStyle: {
|
|
674
|
-
...
|
|
675
|
-
x: (
|
|
676
|
-
y: (
|
|
674
|
+
...p.normalStyle,
|
|
675
|
+
x: (p.normalStyle.x || 0) - d,
|
|
676
|
+
y: (p.normalStyle.y || 0) - l,
|
|
677
677
|
scale: void 0
|
|
678
678
|
// 移除 scale,由父级容器统一控制
|
|
679
679
|
}
|
|
@@ -686,7 +686,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
686
686
|
width: a - d,
|
|
687
687
|
height: o - l,
|
|
688
688
|
x: n,
|
|
689
|
-
y:
|
|
689
|
+
y: f
|
|
690
690
|
// 不设置背景和边框,由 NodeRenderer 控制
|
|
691
691
|
},
|
|
692
692
|
contentInfo: {
|
|
@@ -699,7 +699,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
699
699
|
isResizable: !0,
|
|
700
700
|
isSelectable: !0
|
|
701
701
|
},
|
|
702
|
-
children:
|
|
702
|
+
children: h
|
|
703
703
|
};
|
|
704
704
|
}
|
|
705
705
|
return {
|
|
@@ -710,7 +710,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
710
710
|
width: 120,
|
|
711
711
|
height: 100,
|
|
712
712
|
x: n,
|
|
713
|
-
y:
|
|
713
|
+
y: f,
|
|
714
714
|
background: "transparent",
|
|
715
715
|
padding: 8
|
|
716
716
|
},
|
|
@@ -728,73 +728,73 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
728
728
|
}, { Panel: Ne } = he, { Text: We } = wt, yn = () => {
|
|
729
729
|
const {
|
|
730
730
|
materials: n,
|
|
731
|
-
addMaterial:
|
|
731
|
+
addMaterial: f,
|
|
732
732
|
removeMaterial: t,
|
|
733
733
|
selectedStatusId: r,
|
|
734
734
|
selectStatus: d,
|
|
735
735
|
mode: l,
|
|
736
736
|
lineDrawing: a,
|
|
737
737
|
startLineDrawing: o,
|
|
738
|
-
cancelLineDrawing:
|
|
739
|
-
} = Ie(), [
|
|
738
|
+
cancelLineDrawing: h
|
|
739
|
+
} = Ie(), [p, u] = q([
|
|
740
740
|
"basic",
|
|
741
741
|
"device",
|
|
742
742
|
"text",
|
|
743
743
|
"line"
|
|
744
|
-
]), b = (
|
|
744
|
+
]), b = (m) => {
|
|
745
745
|
const A = new FileReader();
|
|
746
|
-
return A.onload = (
|
|
747
|
-
const D =
|
|
748
|
-
|
|
749
|
-
name:
|
|
746
|
+
return A.onload = (Y) => {
|
|
747
|
+
const D = Y.target?.result;
|
|
748
|
+
f({
|
|
749
|
+
name: m.name.replace(".svg", ""),
|
|
750
750
|
type: "IMAGE",
|
|
751
751
|
src: D
|
|
752
752
|
});
|
|
753
|
-
}, A.readAsDataURL(
|
|
753
|
+
}, A.readAsDataURL(m), !1;
|
|
754
754
|
}, s = {
|
|
755
755
|
basic: n.filter(
|
|
756
|
-
(
|
|
756
|
+
(m) => ["矩形", "圆形", "圆角矩形"].includes(m.name)
|
|
757
757
|
),
|
|
758
758
|
device: n.filter(
|
|
759
|
-
(
|
|
759
|
+
(m) => ["阀门", "泵", "罐体"].includes(m.name) || m.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(m.name) && m.name !== "自定义"
|
|
760
760
|
),
|
|
761
|
-
text: n.filter((
|
|
762
|
-
line: n.filter((
|
|
763
|
-
group: n.filter((
|
|
761
|
+
text: n.filter((m) => m.type === "TEXT"),
|
|
762
|
+
line: n.filter((m) => m.type === "LINE"),
|
|
763
|
+
group: n.filter((m) => m.type === "CUSTOM" && m.config?.nodes),
|
|
764
764
|
custom: n.filter(
|
|
765
|
-
(
|
|
765
|
+
(m) => m.type === "CUSTOM" && !m.config?.nodes || m.type === "IMAGE" && !["矩形", "圆形", "圆角矩形", "阀门", "泵", "罐体"].includes(m.name)
|
|
766
766
|
)
|
|
767
|
-
}, x = (
|
|
768
|
-
|
|
769
|
-
const
|
|
767
|
+
}, x = (m, A) => {
|
|
768
|
+
m.dataTransfer.effectAllowed = "copy", m.dataTransfer.setData("application/json", JSON.stringify(A));
|
|
769
|
+
const Y = m.currentTarget.querySelector(
|
|
770
770
|
".material-preview"
|
|
771
771
|
);
|
|
772
|
-
|
|
773
|
-
}, y = (
|
|
774
|
-
|
|
775
|
-
},
|
|
776
|
-
const
|
|
772
|
+
Y && m.dataTransfer.setDragImage(Y, 20, 20);
|
|
773
|
+
}, y = (m) => {
|
|
774
|
+
m.type === "LINE" && o(m);
|
|
775
|
+
}, E = (m, A = !1) => {
|
|
776
|
+
const Y = A === !0, D = l === "line-draw" && Y && a.material?.id === m.id;
|
|
777
777
|
return /* @__PURE__ */ e(
|
|
778
778
|
xe.Item,
|
|
779
779
|
{
|
|
780
|
-
draggable: !
|
|
781
|
-
onDragStart: (L) => x(L,
|
|
782
|
-
onClick: () =>
|
|
780
|
+
draggable: !Y,
|
|
781
|
+
onDragStart: (L) => x(L, m),
|
|
782
|
+
onClick: () => Y && y(m),
|
|
783
783
|
className: `
|
|
784
784
|
rounded-lg transition-all duration-200 select-none
|
|
785
|
-
${
|
|
785
|
+
${Y ? "cursor-pointer" : "cursor-move"}
|
|
786
786
|
hover:bg-gray-100
|
|
787
787
|
${D ? "bg-blue-50 ring-2 ring-blue-400" : ""}
|
|
788
788
|
`,
|
|
789
789
|
actions: [
|
|
790
|
-
|
|
790
|
+
Y ? /* @__PURE__ */ e(
|
|
791
791
|
j,
|
|
792
792
|
{
|
|
793
793
|
type: "text",
|
|
794
794
|
size: "small",
|
|
795
795
|
icon: /* @__PURE__ */ e(nt, {}),
|
|
796
796
|
onClick: (L) => {
|
|
797
|
-
L.stopPropagation(), y(
|
|
797
|
+
L.stopPropagation(), y(m);
|
|
798
798
|
},
|
|
799
799
|
children: "绘制"
|
|
800
800
|
},
|
|
@@ -806,35 +806,35 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
806
806
|
type: "text",
|
|
807
807
|
size: "small",
|
|
808
808
|
danger: !0,
|
|
809
|
-
icon: /* @__PURE__ */ e(
|
|
809
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
810
810
|
onClick: (L) => {
|
|
811
|
-
L.stopPropagation(), t(
|
|
811
|
+
L.stopPropagation(), t(m.id);
|
|
812
812
|
}
|
|
813
813
|
},
|
|
814
814
|
"delete"
|
|
815
815
|
)
|
|
816
816
|
].filter(Boolean),
|
|
817
|
-
children: /* @__PURE__ */ c("div", { className: `flex items-center gap-3 w-full py-2 ${
|
|
818
|
-
/* @__PURE__ */ e("div", { className: "material-preview w-12 h-12 flex items-center justify-center bg-white rounded border border-gray-200", children:
|
|
817
|
+
children: /* @__PURE__ */ c("div", { className: `flex items-center gap-3 w-full py-2 ${Y ? "" : "pointer-events-none"}`, children: [
|
|
818
|
+
/* @__PURE__ */ e("div", { className: "material-preview w-12 h-12 flex items-center justify-center bg-white rounded border border-gray-200", children: m.type === "IMAGE" && m.src ? /* @__PURE__ */ e(
|
|
819
819
|
Xt,
|
|
820
820
|
{
|
|
821
|
-
src:
|
|
822
|
-
alt:
|
|
821
|
+
src: m.src,
|
|
822
|
+
alt: m.name,
|
|
823
823
|
width: 40,
|
|
824
824
|
height: 40,
|
|
825
825
|
preview: !1
|
|
826
826
|
}
|
|
827
|
-
) :
|
|
827
|
+
) : m.type === "TEXT" ? /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "T" }) : m.type === "LINE" ? /* @__PURE__ */ e("div", { className: "w-8 h-0.5 bg-gray-400" }) : m.type === "CUSTOM" && m.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: "?" }) }),
|
|
828
828
|
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
829
|
-
/* @__PURE__ */ e(We, { strong: !0, className: "block truncate", children:
|
|
829
|
+
/* @__PURE__ */ e(We, { strong: !0, className: "block truncate", children: m.name }),
|
|
830
830
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
831
|
-
/* @__PURE__ */ e(We, { type: "secondary", className: "text-xs", children:
|
|
831
|
+
/* @__PURE__ */ e(We, { type: "secondary", className: "text-xs", children: m.type }),
|
|
832
832
|
D && /* @__PURE__ */ e(le, { color: "blue", className: "text-xs", children: "绘制中" })
|
|
833
833
|
] })
|
|
834
834
|
] })
|
|
835
835
|
] })
|
|
836
836
|
},
|
|
837
|
-
|
|
837
|
+
m.id
|
|
838
838
|
);
|
|
839
839
|
};
|
|
840
840
|
return /* @__PURE__ */ c("div", { className: "h-full flex flex-col bg-white border-r border-gray-200", children: [
|
|
@@ -843,7 +843,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
843
843
|
/* @__PURE__ */ e(We, { type: "secondary", className: "text-sm", children: "拖拽物料到画布创建节点" })
|
|
844
844
|
] }),
|
|
845
845
|
/* @__PURE__ */ e("div", { className: "p-3 border-b border-gray-200", children: /* @__PURE__ */ e(
|
|
846
|
-
|
|
846
|
+
Ot,
|
|
847
847
|
{
|
|
848
848
|
accept: ".svg",
|
|
849
849
|
beforeUpload: b,
|
|
@@ -854,8 +854,8 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
854
854
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2", children: /* @__PURE__ */ c(
|
|
855
855
|
he,
|
|
856
856
|
{
|
|
857
|
-
activeKey:
|
|
858
|
-
onChange: (
|
|
857
|
+
activeKey: p,
|
|
858
|
+
onChange: (m) => u(m),
|
|
859
859
|
ghost: !0,
|
|
860
860
|
expandIconPosition: "end",
|
|
861
861
|
children: [
|
|
@@ -863,7 +863,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
863
863
|
xe,
|
|
864
864
|
{
|
|
865
865
|
dataSource: s.basic,
|
|
866
|
-
renderItem: (
|
|
866
|
+
renderItem: (m) => E(m, !1),
|
|
867
867
|
locale: {
|
|
868
868
|
emptyText: /* @__PURE__ */ e(
|
|
869
869
|
ne,
|
|
@@ -879,7 +879,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
879
879
|
xe,
|
|
880
880
|
{
|
|
881
881
|
dataSource: s.device,
|
|
882
|
-
renderItem: (
|
|
882
|
+
renderItem: (m) => E(m, !1),
|
|
883
883
|
locale: {
|
|
884
884
|
emptyText: /* @__PURE__ */ e(
|
|
885
885
|
ne,
|
|
@@ -895,7 +895,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
895
895
|
xe,
|
|
896
896
|
{
|
|
897
897
|
dataSource: s.text,
|
|
898
|
-
renderItem: (
|
|
898
|
+
renderItem: (m) => E(m, !1),
|
|
899
899
|
locale: {
|
|
900
900
|
emptyText: /* @__PURE__ */ e(
|
|
901
901
|
ne,
|
|
@@ -919,7 +919,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
919
919
|
xe,
|
|
920
920
|
{
|
|
921
921
|
dataSource: s.line,
|
|
922
|
-
renderItem: (
|
|
922
|
+
renderItem: (m) => E(m, !0),
|
|
923
923
|
locale: {
|
|
924
924
|
emptyText: /* @__PURE__ */ e(
|
|
925
925
|
ne,
|
|
@@ -943,7 +943,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
943
943
|
xe,
|
|
944
944
|
{
|
|
945
945
|
dataSource: s.group,
|
|
946
|
-
renderItem: (
|
|
946
|
+
renderItem: (m) => E(m, !1),
|
|
947
947
|
locale: {
|
|
948
948
|
emptyText: /* @__PURE__ */ e(
|
|
949
949
|
ne,
|
|
@@ -959,7 +959,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
959
959
|
xe,
|
|
960
960
|
{
|
|
961
961
|
dataSource: s.custom,
|
|
962
|
-
renderItem: (
|
|
962
|
+
renderItem: (m) => E(m, !1),
|
|
963
963
|
locale: {
|
|
964
964
|
emptyText: /* @__PURE__ */ e(
|
|
965
965
|
ne,
|
|
@@ -976,49 +976,49 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
976
976
|
) }),
|
|
977
977
|
/* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ e(We, { type: "secondary", className: "text-xs", children: l === "line-draw" ? /* @__PURE__ */ e(Se, { children: "💡 提示:点击绘制线段,可连续绘制多段线,双击结束绘制,ESC 取消" }) : /* @__PURE__ */ e(Se, { children: "💡 提示:拖拽物料到画布创建节点,点击线条物料进入绘制模式" }) }) })
|
|
978
978
|
] });
|
|
979
|
-
}, { Text: gt } = wt, vn = (n,
|
|
979
|
+
}, { Text: gt } = wt, vn = (n, f) => {
|
|
980
980
|
try {
|
|
981
|
-
const t =
|
|
981
|
+
const t = f && Array.isArray(f) ? f.map((l, a) => l.paramsName) : ["A"], d = new Function(...t, n.expression)(...f.map((l) => l.value));
|
|
982
982
|
return console.log(
|
|
983
983
|
`Evaluating status [${n.name}] with data:`,
|
|
984
|
-
|
|
984
|
+
f,
|
|
985
985
|
"Result:",
|
|
986
986
|
d
|
|
987
987
|
), d === !0;
|
|
988
988
|
} catch (t) {
|
|
989
989
|
return console.warn(`状态表达式执行失败 [${n.name}]:`, t), !1;
|
|
990
990
|
}
|
|
991
|
-
}, bn = (n,
|
|
991
|
+
}, bn = (n, f) => {
|
|
992
992
|
for (const t of n) {
|
|
993
993
|
console.log(t, "status");
|
|
994
994
|
let r = [];
|
|
995
|
-
if (Array.isArray(
|
|
995
|
+
if (Array.isArray(f) ? (console.log(t.bindCodes, "bindCodes"), r = f.filter(
|
|
996
996
|
(d) => t.bindCodes?.includes(d.paramsCode)
|
|
997
|
-
)) : r =
|
|
997
|
+
)) : r = f, vn(t, r))
|
|
998
998
|
return t;
|
|
999
999
|
}
|
|
1000
|
-
}, xn = (n,
|
|
1001
|
-
if (!
|
|
1000
|
+
}, xn = (n, f) => {
|
|
1001
|
+
if (!f || !n)
|
|
1002
1002
|
return { value: void 0 };
|
|
1003
1003
|
if (Array.isArray(n)) {
|
|
1004
|
-
const t = n.find((r) => r.paramsCode ===
|
|
1004
|
+
const t = n.find((r) => r.paramsCode === f);
|
|
1005
1005
|
if (t)
|
|
1006
1006
|
return {
|
|
1007
1007
|
value: t.value,
|
|
1008
1008
|
unit: t.unit
|
|
1009
1009
|
};
|
|
1010
|
-
} else if (typeof n == "object" &&
|
|
1010
|
+
} else if (typeof n == "object" && f in n)
|
|
1011
1011
|
return {
|
|
1012
|
-
value: n[
|
|
1012
|
+
value: n[f],
|
|
1013
1013
|
unit: n.unit
|
|
1014
1014
|
};
|
|
1015
1015
|
return { value: void 0 };
|
|
1016
|
-
}, wn = (n,
|
|
1016
|
+
}, wn = (n, f) => {
|
|
1017
1017
|
if (n == null) return "";
|
|
1018
|
-
if (
|
|
1018
|
+
if (f === -1) return String(n);
|
|
1019
1019
|
const t = Number(n);
|
|
1020
|
-
return isNaN(t) ? String(n) : t.toFixed(
|
|
1021
|
-
}, Sn = (n,
|
|
1020
|
+
return isNaN(t) ? String(n) : t.toFixed(f ?? 2);
|
|
1021
|
+
}, Sn = (n, f, t, r) => {
|
|
1022
1022
|
switch (n.type) {
|
|
1023
1023
|
case "IMAGE":
|
|
1024
1024
|
const d = n;
|
|
@@ -1038,13 +1038,13 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1038
1038
|
const l = n, {
|
|
1039
1039
|
label: a,
|
|
1040
1040
|
value: o,
|
|
1041
|
-
valueSourceCode:
|
|
1042
|
-
unit:
|
|
1041
|
+
valueSourceCode: h,
|
|
1042
|
+
unit: p,
|
|
1043
1043
|
decimals: u,
|
|
1044
1044
|
labelStyle: b,
|
|
1045
1045
|
valueStyle: s,
|
|
1046
1046
|
customStyle: x
|
|
1047
|
-
} = l.content || {}, { value: y, unit:
|
|
1047
|
+
} = l.content || {}, { value: y, unit: E } = h ? xn(f, h) : { value: void 0, unit: void 0 }, A = wn(y !== void 0 ? y : o, u), Y = p || E || "";
|
|
1048
1048
|
return /* @__PURE__ */ c(
|
|
1049
1049
|
"div",
|
|
1050
1050
|
{
|
|
@@ -1075,7 +1075,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1075
1075
|
},
|
|
1076
1076
|
children: [
|
|
1077
1077
|
A,
|
|
1078
|
-
|
|
1078
|
+
Y ? ` ${Y}` : ""
|
|
1079
1079
|
]
|
|
1080
1080
|
}
|
|
1081
1081
|
)
|
|
@@ -1085,7 +1085,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1085
1085
|
case "LINE":
|
|
1086
1086
|
const D = n, {
|
|
1087
1087
|
thickness: L = 2,
|
|
1088
|
-
color:
|
|
1088
|
+
color: O = "#d9d9d9",
|
|
1089
1089
|
dashed: ie = !1,
|
|
1090
1090
|
lineType: H = ie ? "dashed" : "solid",
|
|
1091
1091
|
lineWeight: Q = L,
|
|
@@ -1095,24 +1095,24 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1095
1095
|
endX: T = 100,
|
|
1096
1096
|
endY: B = 0
|
|
1097
1097
|
} = D.config || {}, i = ((w) => {
|
|
1098
|
-
const
|
|
1098
|
+
const M = Math.max(Q, 1);
|
|
1099
1099
|
switch (w) {
|
|
1100
1100
|
case "solid":
|
|
1101
1101
|
return "";
|
|
1102
1102
|
case "dashed":
|
|
1103
|
-
return `${
|
|
1103
|
+
return `${M * 8},${M * 4}`;
|
|
1104
1104
|
case "center":
|
|
1105
|
-
return `${
|
|
1105
|
+
return `${M * 12},${M * 3},${M * 2},${M * 3}`;
|
|
1106
1106
|
case "phantom":
|
|
1107
|
-
return `${
|
|
1107
|
+
return `${M * 12},${M * 3},${M * 2},${M * 3},${M * 2},${M * 3}`;
|
|
1108
1108
|
case "dot":
|
|
1109
|
-
return `${
|
|
1109
|
+
return `${M},${M * 3}`;
|
|
1110
1110
|
case "dash-dot":
|
|
1111
|
-
return `${
|
|
1111
|
+
return `${M * 8},${M * 3},${M},${M * 3}`;
|
|
1112
1112
|
default:
|
|
1113
1113
|
return "";
|
|
1114
1114
|
}
|
|
1115
|
-
})(H), k = t ? "#1890ff" :
|
|
1115
|
+
})(H), k = t ? "#1890ff" : O;
|
|
1116
1116
|
return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */ c(
|
|
1117
1117
|
"svg",
|
|
1118
1118
|
{
|
|
@@ -1135,8 +1135,8 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1135
1135
|
style: { pointerEvents: "stroke", cursor: "pointer" },
|
|
1136
1136
|
onClick: (w) => {
|
|
1137
1137
|
w.stopPropagation();
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1138
|
+
const M = w.target.closest("[data-node-id]");
|
|
1139
|
+
M && M.click();
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
),
|
|
@@ -1166,43 +1166,43 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1166
1166
|
}
|
|
1167
1167
|
}, Cn = ({
|
|
1168
1168
|
node: n,
|
|
1169
|
-
isSelected:
|
|
1169
|
+
isSelected: f = !1,
|
|
1170
1170
|
onClick: t,
|
|
1171
1171
|
onMouseDown: r,
|
|
1172
1172
|
data: d,
|
|
1173
1173
|
onUpdateNode: l,
|
|
1174
1174
|
scale: a = 1
|
|
1175
1175
|
}) => {
|
|
1176
|
-
const { normalStyle: o, contentInfo:
|
|
1176
|
+
const { normalStyle: o, contentInfo: h, controlInfo: p } = n, { statusList: u } = h, { isClickable: b, isDraggable: s } = p, [x, y] = q(null), [E, m] = q({ x: 0, y: 0 }), A = ue(null), Y = xt(() => {
|
|
1177
1177
|
if (u.length === 0) return;
|
|
1178
1178
|
const i = bn(u, d);
|
|
1179
1179
|
return i || u[0];
|
|
1180
|
-
}, [u, d]), D =
|
|
1181
|
-
i.stopPropagation(), i.preventDefault(), y(k),
|
|
1180
|
+
}, [u, d]), D = Y?.material, L = D?.type === "LINE", O = L ? D.config : null, ie = o.scale ?? 1, H = (o.width || 100) * ie, Q = (o.height || 100) * ie, F = G((i, k) => {
|
|
1181
|
+
i.stopPropagation(), i.preventDefault(), y(k), m({ x: i.clientX, y: i.clientY });
|
|
1182
1182
|
}, []);
|
|
1183
1183
|
se(() => {
|
|
1184
|
-
if (!x || !L || !
|
|
1184
|
+
if (!x || !L || !O || !l) return;
|
|
1185
1185
|
const i = (S) => {
|
|
1186
|
-
const w = (S.clientX -
|
|
1187
|
-
let Z = Xe, ee = Ce, te = ze, oe = Re, ke = o.x || 0,
|
|
1188
|
-
x === "start" ? (Z = Xe + w, ee = Ce +
|
|
1189
|
-
const Ae = Math.max((
|
|
1186
|
+
const w = (S.clientX - E.x) / a, M = (S.clientY - E.y) / a, Xe = O.startX || 0, Ce = O.startY || 0, ze = O.endX || 0, Re = O.endY || 0;
|
|
1187
|
+
let Z = Xe, ee = Ce, te = ze, oe = Re, ke = o.x || 0, Ee = o.y || 0;
|
|
1188
|
+
x === "start" ? (Z = Xe + w, ee = Ce + M, Z < 0 && (ke += Z, te -= Z, Z = 0), ee < 0 && (Ee += ee, oe -= ee, ee = 0)) : (te = ze + w, oe = Re + M, te < 0 && (ke += te, Z -= te, te = 0), oe < 0 && (Ee += oe, ee -= oe, oe = 0));
|
|
1189
|
+
const Ae = Math.max((O.lineWeight || 2) * 2, 4), Ge = Math.max(Z, te), Be = Math.max(ee, oe), Ve = Math.max(Ge, Ae), He = Math.max(Be, Ae);
|
|
1190
1190
|
l(n.id, {
|
|
1191
1191
|
normalStyle: {
|
|
1192
1192
|
...o,
|
|
1193
1193
|
x: ke,
|
|
1194
|
-
y:
|
|
1194
|
+
y: Ee,
|
|
1195
1195
|
width: Ve,
|
|
1196
1196
|
height: He
|
|
1197
1197
|
},
|
|
1198
1198
|
contentInfo: {
|
|
1199
|
-
...
|
|
1199
|
+
...h,
|
|
1200
1200
|
statusList: u.map((ve) => ({
|
|
1201
1201
|
...ve,
|
|
1202
1202
|
material: ve.material.type === "LINE" ? {
|
|
1203
1203
|
...ve.material,
|
|
1204
1204
|
config: {
|
|
1205
|
-
...
|
|
1205
|
+
...O,
|
|
1206
1206
|
startX: Z,
|
|
1207
1207
|
startY: ee,
|
|
1208
1208
|
endX: te,
|
|
@@ -1211,14 +1211,14 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1211
1211
|
} : ve.material
|
|
1212
1212
|
}))
|
|
1213
1213
|
}
|
|
1214
|
-
}),
|
|
1214
|
+
}), m({ x: S.clientX, y: S.clientY });
|
|
1215
1215
|
}, k = () => {
|
|
1216
1216
|
y(null);
|
|
1217
1217
|
};
|
|
1218
1218
|
return window.addEventListener("mousemove", i), window.addEventListener("mouseup", k), () => {
|
|
1219
1219
|
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", k);
|
|
1220
1220
|
};
|
|
1221
|
-
}, [x,
|
|
1221
|
+
}, [x, E, L, O, n.id, o, h, u, l, a]);
|
|
1222
1222
|
const P = n.type === "group", T = {
|
|
1223
1223
|
position: "absolute",
|
|
1224
1224
|
left: o.x || 0,
|
|
@@ -1235,17 +1235,17 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1235
1235
|
borderRadius: P ? void 0 : o.borderRadius,
|
|
1236
1236
|
// 线条物料选中时不显示边框,而是通过高亮线条颜色来表示
|
|
1237
1237
|
// 群组节点选中时显示边框,平时不显示
|
|
1238
|
-
border:
|
|
1238
|
+
border: f && !L ? "2px solid #1890ff" : L || P ? "none" : o.border || "1px dashed transparent",
|
|
1239
1239
|
// 线条节点需要捕获点击事件,但由内部 SVG 的透明线处理具体点击区域
|
|
1240
1240
|
pointerEvents: "auto",
|
|
1241
1241
|
opacity: o.opacity ?? 1,
|
|
1242
1242
|
transform: o.transform,
|
|
1243
|
-
zIndex:
|
|
1243
|
+
zIndex: f ? 1e3 : o.zIndex ?? 1,
|
|
1244
1244
|
cursor: s && !x ? "move" : b ? "pointer" : "default",
|
|
1245
1245
|
boxSizing: "border-box",
|
|
1246
1246
|
// 线条和群组节点使用 visible overflow,避免裁剪子节点
|
|
1247
1247
|
overflow: L || P ? "visible" : "hidden"
|
|
1248
|
-
}, B =
|
|
1248
|
+
}, B = O ? { x: O.startX || 0, y: O.startY || 0 } : { x: 0, y: 0 }, R = O ? { x: O.endX || 0, y: O.endY || 0 } : { x: 0, y: 0 };
|
|
1249
1249
|
return /* @__PURE__ */ c(
|
|
1250
1250
|
"div",
|
|
1251
1251
|
{
|
|
@@ -1259,7 +1259,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1259
1259
|
s && r && !x && r(i);
|
|
1260
1260
|
},
|
|
1261
1261
|
children: [
|
|
1262
|
-
|
|
1262
|
+
f && !L && /* @__PURE__ */ c(Se, { children: [
|
|
1263
1263
|
!P && /* @__PURE__ */ c(Se, { children: [
|
|
1264
1264
|
/* @__PURE__ */ e("div", { className: "absolute -top-1 -left-1 w-2 h-2 bg-white border border-blue-500 rounded-full" }),
|
|
1265
1265
|
/* @__PURE__ */ e("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-white border border-blue-500 rounded-full" }),
|
|
@@ -1269,10 +1269,10 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1269
1269
|
/* @__PURE__ */ c("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: [
|
|
1270
1270
|
n.name,
|
|
1271
1271
|
" ",
|
|
1272
|
-
|
|
1272
|
+
Y ? `(${Y.name})` : ""
|
|
1273
1273
|
] })
|
|
1274
1274
|
] }),
|
|
1275
|
-
|
|
1275
|
+
f && L && O && l && /* @__PURE__ */ c(Se, { children: [
|
|
1276
1276
|
/* @__PURE__ */ e(
|
|
1277
1277
|
"div",
|
|
1278
1278
|
{
|
|
@@ -1301,7 +1301,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1301
1301
|
),
|
|
1302
1302
|
/* @__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: n.name })
|
|
1303
1303
|
] }),
|
|
1304
|
-
/* @__PURE__ */ e("div", { className: "w-full h-full relative", children: D ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Sn(D, d,
|
|
1304
|
+
/* @__PURE__ */ e("div", { className: "w-full h-full relative", children: D ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Sn(D, d, f) }) : P ? null : (
|
|
1305
1305
|
// 只有非群组节点才显示"无状态"
|
|
1306
1306
|
/* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center text-gray-300 text-xs", children: "无状态" })
|
|
1307
1307
|
) }),
|
|
@@ -1318,42 +1318,42 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1318
1318
|
]
|
|
1319
1319
|
}
|
|
1320
1320
|
);
|
|
1321
|
-
}, Lt = de.memo(Cn, (n,
|
|
1322
|
-
const t = n.node, r =
|
|
1323
|
-
return d && l;
|
|
1321
|
+
}, Lt = de.memo(Cn, (n, f) => {
|
|
1322
|
+
const t = n.node, r = f.node, d = 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, l = t.contentInfo === r.contentInfo, a = n.isSelected === f.isSelected && n.scale === f.scale;
|
|
1323
|
+
return d && l && a;
|
|
1324
1324
|
}), { TextArea: Nn } = J, In = ({ defaultTestData: n }) => {
|
|
1325
|
-
const
|
|
1325
|
+
const f = ue(null), t = ue(null), r = ue(null), {
|
|
1326
1326
|
nodes: d,
|
|
1327
1327
|
selectedNodeId: l,
|
|
1328
1328
|
mode: a,
|
|
1329
1329
|
lineDrawing: o,
|
|
1330
|
-
viewport:
|
|
1331
|
-
setViewport:
|
|
1330
|
+
viewport: h,
|
|
1331
|
+
setViewport: p,
|
|
1332
1332
|
addNode: u,
|
|
1333
1333
|
selectNode: b,
|
|
1334
1334
|
updateNode: s,
|
|
1335
1335
|
removeNode: x,
|
|
1336
1336
|
undo: y,
|
|
1337
|
-
redo:
|
|
1338
|
-
setMode:
|
|
1337
|
+
redo: E,
|
|
1338
|
+
setMode: m,
|
|
1339
1339
|
startLineDrawing: A,
|
|
1340
|
-
endLineDrawing:
|
|
1340
|
+
endLineDrawing: Y,
|
|
1341
1341
|
cancelLineDrawing: D
|
|
1342
|
-
} = Ie(), [L,
|
|
1342
|
+
} = Ie(), [L, O] = q(!1), [, ie] = q({}), H = ue(!1), Q = ue({ x: 0, y: 0 }), F = ue({ x: 0, y: 0, newX: 0, newY: 0 }), P = ue(null), [T, B] = q({ start: null, end: null, isDrawing: !1 }), [R, i] = q(!1), [k, S] = q({ start: null, end: null }), [w, M] = q([]), [Xe, Ce] = q(!1), [ze, Re] = q(
|
|
1343
1343
|
JSON.stringify(n, null, 2)
|
|
1344
|
-
), Z =
|
|
1344
|
+
), Z = G((g, I) => {
|
|
1345
1345
|
if (!t.current) return { x: 0, y: 0 };
|
|
1346
|
-
const X = t.current.getBoundingClientRect(), C =
|
|
1346
|
+
const X = t.current.getBoundingClientRect(), C = f.current?.state, N = C?.scale ?? h.scale, _ = C?.positionX ?? h.positionX, U = C?.positionY ?? h.positionY, $ = g - X.left, W = I - X.top, K = ($ - _) / N, re = (W - U) / N;
|
|
1347
1347
|
return { x: Math.round(K), y: Math.round(re) };
|
|
1348
|
-
}, [
|
|
1348
|
+
}, [h.scale, h.positionX, h.positionY]), ee = G((g, I) => {
|
|
1349
1349
|
const X = t.current;
|
|
1350
1350
|
if (!X) return { x: 0, y: 0 };
|
|
1351
|
-
const C = X.getBoundingClientRect(), _ =
|
|
1351
|
+
const C = X.getBoundingClientRect(), _ = f.current?.state?.scale ?? 1, U = g - C.left, $ = I - C.top, W = U / _, K = $ / _;
|
|
1352
1352
|
return { x: Math.round(W), y: Math.round(K) };
|
|
1353
|
-
}, []), te =
|
|
1354
|
-
(
|
|
1353
|
+
}, []), te = G(
|
|
1354
|
+
(g, I, X = !0) => {
|
|
1355
1355
|
if (!o.material) return;
|
|
1356
|
-
const C = o.material, N = C.config || {}, _ = N.lineWeight || N.thickness || 2, U = Math.min(
|
|
1356
|
+
const C = o.material, N = C.config || {}, _ = N.lineWeight || N.thickness || 2, U = Math.min(g.x, I.x), $ = Math.min(g.y, I.y), W = Math.round(g.x - U), K = Math.round(g.y - $), re = Math.round(I.x - U), fe = Math.round(I.y - $), be = Math.max(_ * 2, 4), pe = Math.max(Math.abs(g.x - I.x), be), je = Math.max(Math.abs(g.y - I.y), be), _t = {
|
|
1357
1357
|
...C,
|
|
1358
1358
|
id: z(),
|
|
1359
1359
|
config: {
|
|
@@ -1366,7 +1366,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1366
1366
|
endX: re,
|
|
1367
1367
|
endY: fe
|
|
1368
1368
|
}
|
|
1369
|
-
},
|
|
1369
|
+
}, Yt = {
|
|
1370
1370
|
id: z(),
|
|
1371
1371
|
name: `${C.name}_${Date.now()}`,
|
|
1372
1372
|
type: "normal",
|
|
@@ -1388,7 +1388,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1388
1388
|
isSelectable: !0
|
|
1389
1389
|
}
|
|
1390
1390
|
};
|
|
1391
|
-
if (u(
|
|
1391
|
+
if (u(Yt, !1), X) {
|
|
1392
1392
|
const rt = { x: I.x, y: I.y };
|
|
1393
1393
|
B({
|
|
1394
1394
|
start: rt,
|
|
@@ -1396,74 +1396,74 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1396
1396
|
isDrawing: !0
|
|
1397
1397
|
});
|
|
1398
1398
|
} else
|
|
1399
|
-
B({ start: null, end: null, isDrawing: !1 }),
|
|
1399
|
+
B({ start: null, end: null, isDrawing: !1 }), Y();
|
|
1400
1400
|
},
|
|
1401
|
-
[o.material, u,
|
|
1402
|
-
), oe =
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
scale:
|
|
1406
|
-
positionX:
|
|
1407
|
-
positionY:
|
|
1401
|
+
[o.material, u, Y]
|
|
1402
|
+
), oe = G(() => {
|
|
1403
|
+
const g = f.current?.state;
|
|
1404
|
+
g && p({
|
|
1405
|
+
scale: g.scale,
|
|
1406
|
+
positionX: g.positionX,
|
|
1407
|
+
positionY: g.positionY
|
|
1408
1408
|
});
|
|
1409
|
-
}, [
|
|
1410
|
-
(
|
|
1411
|
-
H.current || R || (
|
|
1409
|
+
}, [p]), ke = G(
|
|
1410
|
+
(g) => {
|
|
1411
|
+
H.current || R || (g.target === t.current || g.target.dataset?.canvas === "true") && (b(null), M([]));
|
|
1412
1412
|
},
|
|
1413
1413
|
[b, R]
|
|
1414
|
-
),
|
|
1415
|
-
(
|
|
1416
|
-
if (
|
|
1414
|
+
), Ee = G(
|
|
1415
|
+
(g) => {
|
|
1416
|
+
if (g.button === 0) {
|
|
1417
1417
|
if (a === "line-draw" && o.material) {
|
|
1418
|
-
const I = Z(
|
|
1418
|
+
const I = Z(g.clientX, g.clientY);
|
|
1419
1419
|
T.isDrawing ? T.start && te(T.start, I, !0) : B({ start: I, end: I, isDrawing: !0 });
|
|
1420
1420
|
return;
|
|
1421
1421
|
}
|
|
1422
1422
|
if (R) {
|
|
1423
|
-
const I = ee(
|
|
1424
|
-
S({ start: I, end: I }),
|
|
1423
|
+
const I = ee(g.clientX, g.clientY);
|
|
1424
|
+
S({ start: I, end: I }), M([]), g.preventDefault(), g.stopPropagation();
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
},
|
|
1428
1428
|
[a, o.material, T.isDrawing, T.start, R, te, Z, ee]
|
|
1429
|
-
), Ae =
|
|
1430
|
-
(
|
|
1429
|
+
), Ae = G(
|
|
1430
|
+
(g) => {
|
|
1431
1431
|
if (!(a !== "line-draw" || !o.material) && T.isDrawing && T.start) {
|
|
1432
|
-
const I = Z(
|
|
1432
|
+
const I = Z(g.clientX, g.clientY);
|
|
1433
1433
|
te(T.start, I, !1);
|
|
1434
1434
|
}
|
|
1435
1435
|
},
|
|
1436
1436
|
[a, o.material, T.isDrawing, T.start, te, Z]
|
|
1437
|
-
),
|
|
1438
|
-
|
|
1439
|
-
}, []), Be =
|
|
1440
|
-
|
|
1441
|
-
}, []), Ve =
|
|
1442
|
-
(
|
|
1443
|
-
if (
|
|
1437
|
+
), Ge = G((g) => {
|
|
1438
|
+
g.preventDefault(), g.dataTransfer.dropEffect = "copy", O(!0);
|
|
1439
|
+
}, []), Be = G((g) => {
|
|
1440
|
+
g.preventDefault(), O(!1);
|
|
1441
|
+
}, []), Ve = G(
|
|
1442
|
+
(g) => {
|
|
1443
|
+
if (g.preventDefault(), O(!1), !(!t.current || a !== "select"))
|
|
1444
1444
|
try {
|
|
1445
|
-
const I =
|
|
1445
|
+
const I = g.dataTransfer.getData("application/json");
|
|
1446
1446
|
if (!I) return;
|
|
1447
|
-
const X = JSON.parse(I), C = t.current.getBoundingClientRect(), N =
|
|
1447
|
+
const X = JSON.parse(I), C = t.current.getBoundingClientRect(), N = f.current?.state, _ = N?.scale ?? h.scale, U = N?.positionX ?? h.positionX, $ = N?.positionY ?? h.positionY, W = (g.clientX - C.left - U) / _ - 50, K = (g.clientY - C.top - $) / _ - 50, re = gn(W, K, X);
|
|
1448
1448
|
u(re);
|
|
1449
1449
|
} catch (I) {
|
|
1450
1450
|
console.error("Failed to parse dropped material:", I);
|
|
1451
1451
|
}
|
|
1452
1452
|
},
|
|
1453
|
-
[a,
|
|
1454
|
-
), He =
|
|
1455
|
-
(
|
|
1456
|
-
a !== "select" || !I.controlInfo.isDraggable || (
|
|
1453
|
+
[a, h, u]
|
|
1454
|
+
), He = G(
|
|
1455
|
+
(g, I) => {
|
|
1456
|
+
a !== "select" || !I.controlInfo.isDraggable || (g.stopPropagation(), b(I.id), H.current = !0, Q.current = { x: g.clientX, y: g.clientY }, F.current = {
|
|
1457
1457
|
x: I.normalStyle.x || 0,
|
|
1458
1458
|
y: I.normalStyle.y || 0,
|
|
1459
1459
|
newX: I.normalStyle.x || 0,
|
|
1460
1460
|
newY: I.normalStyle.y || 0
|
|
1461
|
-
}, P.current = I,
|
|
1461
|
+
}, P.current = I, g.preventDefault());
|
|
1462
1462
|
},
|
|
1463
1463
|
[a, b]
|
|
1464
1464
|
);
|
|
1465
1465
|
se(() => {
|
|
1466
|
-
const
|
|
1466
|
+
const g = (C) => {
|
|
1467
1467
|
if (H.current && l && P.current) {
|
|
1468
1468
|
if (!t.current) return;
|
|
1469
1469
|
const N = t.current.getBoundingClientRect(), _ = 1920 / N.width, U = 1080 / N.height, $ = C.clientX - Q.current.x, W = C.clientY - Q.current.y, K = $ * _, re = W * U, fe = F.current.x + K, be = F.current.y + re, pe = document.querySelector(
|
|
@@ -1495,13 +1495,13 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1495
1495
|
const K = W.normalStyle.x || 0, re = W.normalStyle.y || 0, fe = W.normalStyle.width || 0, be = W.normalStyle.height || 0, pe = K + fe / 2, je = re + be / 2;
|
|
1496
1496
|
return pe >= C && pe <= N && je >= _ && je <= U;
|
|
1497
1497
|
}).map((W) => W.id);
|
|
1498
|
-
|
|
1498
|
+
M($), S({ start: null, end: null });
|
|
1499
1499
|
}
|
|
1500
1500
|
}, X = (C) => {
|
|
1501
|
-
C.key === "Escape" && a === "line-draw" && (B({ start: null, end: null, isDrawing: !1 }), D()), C.key === "Delete" && (l ? x(l) : w.length > 0 && (w.forEach((N) => x(N)),
|
|
1501
|
+
C.key === "Escape" && a === "line-draw" && (B({ start: null, end: null, isDrawing: !1 }), D()), C.key === "Delete" && (l ? x(l) : w.length > 0 && (w.forEach((N) => x(N)), M([]))), C.ctrlKey && C.key === "z" && (C.preventDefault(), y()), C.ctrlKey && C.key === "y" && (C.preventDefault(), E());
|
|
1502
1502
|
};
|
|
1503
|
-
return window.addEventListener("mousemove",
|
|
1504
|
-
window.removeEventListener("mousemove",
|
|
1503
|
+
return window.addEventListener("mousemove", g), window.addEventListener("mouseup", I), window.addEventListener("keydown", X), () => {
|
|
1504
|
+
window.removeEventListener("mousemove", g), window.removeEventListener("mouseup", I), window.removeEventListener("keydown", X);
|
|
1505
1505
|
};
|
|
1506
1506
|
}, [
|
|
1507
1507
|
l,
|
|
@@ -1513,22 +1513,22 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1513
1513
|
d,
|
|
1514
1514
|
x,
|
|
1515
1515
|
y,
|
|
1516
|
-
|
|
1516
|
+
E,
|
|
1517
1517
|
D,
|
|
1518
1518
|
Z,
|
|
1519
1519
|
ee,
|
|
1520
|
-
|
|
1520
|
+
M
|
|
1521
1521
|
]);
|
|
1522
|
-
const ve =
|
|
1522
|
+
const ve = G(() => {
|
|
1523
1523
|
if (w.length < 2) return;
|
|
1524
|
-
const
|
|
1525
|
-
if (
|
|
1524
|
+
const g = w.map(($) => d.find((W) => W.id === $)).filter(($) => !!$ && $.type !== "group");
|
|
1525
|
+
if (g.length < 2) return;
|
|
1526
1526
|
let I = 1 / 0, X = 1 / 0, C = -1 / 0, N = -1 / 0;
|
|
1527
|
-
|
|
1527
|
+
g.forEach(($) => {
|
|
1528
1528
|
const W = $.normalStyle.x || 0, K = $.normalStyle.y || 0, re = $.normalStyle.width || 0, fe = $.normalStyle.height || 0;
|
|
1529
1529
|
I = Math.min(I, W), X = Math.min(X, K), C = Math.max(C, W + re), N = Math.max(N, K + fe);
|
|
1530
1530
|
});
|
|
1531
|
-
const _ =
|
|
1531
|
+
const _ = g.map(($) => ({
|
|
1532
1532
|
...$,
|
|
1533
1533
|
normalStyle: {
|
|
1534
1534
|
...$.normalStyle,
|
|
@@ -1558,14 +1558,14 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1558
1558
|
},
|
|
1559
1559
|
children: _
|
|
1560
1560
|
};
|
|
1561
|
-
w.forEach(($) => x($)), u(U),
|
|
1562
|
-
}, [w, d, x, u, b]),
|
|
1563
|
-
(
|
|
1561
|
+
w.forEach(($) => x($)), u(U), M([]), b(U.id);
|
|
1562
|
+
}, [w, d, x, u, b]), Me = G(
|
|
1563
|
+
(g) => {
|
|
1564
1564
|
if (w.length < 2) return;
|
|
1565
1565
|
const I = Ie.getState(), X = w.map((N) => d.find((_) => _.id === N)).filter((N) => !!N && N.type !== "group");
|
|
1566
1566
|
if (X.length < 2) return;
|
|
1567
1567
|
let C = 0;
|
|
1568
|
-
switch (
|
|
1568
|
+
switch (g) {
|
|
1569
1569
|
case "left":
|
|
1570
1570
|
C = Math.min(...X.map((N) => N.normalStyle.x || 0));
|
|
1571
1571
|
break;
|
|
@@ -1585,7 +1585,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1585
1585
|
}
|
|
1586
1586
|
X.forEach((N) => {
|
|
1587
1587
|
let _ = N.normalStyle.x || 0, U = N.normalStyle.y || 0;
|
|
1588
|
-
switch (
|
|
1588
|
+
switch (g) {
|
|
1589
1589
|
case "left":
|
|
1590
1590
|
_ = C;
|
|
1591
1591
|
break;
|
|
@@ -1611,7 +1611,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1611
1611
|
title: "选择模式",
|
|
1612
1612
|
active: a === "select" && !R,
|
|
1613
1613
|
onClick: () => {
|
|
1614
|
-
|
|
1614
|
+
m("select"), i(!1);
|
|
1615
1615
|
}
|
|
1616
1616
|
},
|
|
1617
1617
|
{
|
|
@@ -1619,7 +1619,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1619
1619
|
title: "拖拽模式",
|
|
1620
1620
|
active: a === "drag",
|
|
1621
1621
|
onClick: () => {
|
|
1622
|
-
|
|
1622
|
+
m("drag"), i(!1);
|
|
1623
1623
|
}
|
|
1624
1624
|
},
|
|
1625
1625
|
{
|
|
@@ -1627,7 +1627,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1627
1627
|
title: "线条绘制",
|
|
1628
1628
|
active: a === "line-draw",
|
|
1629
1629
|
onClick: () => {
|
|
1630
|
-
|
|
1630
|
+
m("line-draw"), i(!1);
|
|
1631
1631
|
}
|
|
1632
1632
|
},
|
|
1633
1633
|
{
|
|
@@ -1635,20 +1635,20 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1635
1635
|
title: "预览模式",
|
|
1636
1636
|
active: a === "preview",
|
|
1637
1637
|
onClick: () => {
|
|
1638
|
-
|
|
1638
|
+
m("preview"), i(!1);
|
|
1639
1639
|
}
|
|
1640
1640
|
}
|
|
1641
1641
|
], $t = xt(
|
|
1642
1642
|
() => [
|
|
1643
1643
|
{ icon: /* @__PURE__ */ e(Rt, {}), title: "撤销 (Ctrl+Z)", onClick: y },
|
|
1644
|
-
{ icon: /* @__PURE__ */ e(At, {}), title: "重做 (Ctrl+Y)", onClick:
|
|
1644
|
+
{ icon: /* @__PURE__ */ e(At, {}), title: "重做 (Ctrl+Y)", onClick: E },
|
|
1645
1645
|
{
|
|
1646
1646
|
icon: /* @__PURE__ */ e(at, {}),
|
|
1647
1647
|
title: "框选模式",
|
|
1648
1648
|
active: R,
|
|
1649
1649
|
onClick: () => {
|
|
1650
|
-
const
|
|
1651
|
-
i(
|
|
1650
|
+
const g = !R;
|
|
1651
|
+
i(g), m("select"), g && M([]);
|
|
1652
1652
|
}
|
|
1653
1653
|
},
|
|
1654
1654
|
{
|
|
@@ -1661,51 +1661,51 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1661
1661
|
icon: /* @__PURE__ */ e(jt, {}),
|
|
1662
1662
|
title: "左对齐",
|
|
1663
1663
|
disabled: w.length < 2,
|
|
1664
|
-
onClick: () =>
|
|
1664
|
+
onClick: () => Me("left")
|
|
1665
1665
|
},
|
|
1666
1666
|
{
|
|
1667
1667
|
icon: /* @__PURE__ */ e(Ft, {}),
|
|
1668
1668
|
title: "右对齐",
|
|
1669
1669
|
disabled: w.length < 2,
|
|
1670
|
-
onClick: () =>
|
|
1670
|
+
onClick: () => Me("right")
|
|
1671
1671
|
},
|
|
1672
1672
|
{
|
|
1673
1673
|
icon: /* @__PURE__ */ e(Wt, {}),
|
|
1674
1674
|
title: "上对齐",
|
|
1675
1675
|
disabled: w.length < 2,
|
|
1676
|
-
onClick: () =>
|
|
1676
|
+
onClick: () => Me("top")
|
|
1677
1677
|
},
|
|
1678
1678
|
{
|
|
1679
1679
|
icon: /* @__PURE__ */ e(Ut, {}),
|
|
1680
1680
|
title: "下对齐",
|
|
1681
1681
|
disabled: w.length < 2,
|
|
1682
|
-
onClick: () =>
|
|
1682
|
+
onClick: () => Me("bottom")
|
|
1683
1683
|
},
|
|
1684
1684
|
{
|
|
1685
|
-
icon: /* @__PURE__ */ e(
|
|
1685
|
+
icon: /* @__PURE__ */ e(qt, {}),
|
|
1686
1686
|
title: "数据模拟",
|
|
1687
1687
|
type: "primary",
|
|
1688
1688
|
onClick: () => Ce(!0)
|
|
1689
1689
|
},
|
|
1690
1690
|
{
|
|
1691
|
-
icon: /* @__PURE__ */ e(
|
|
1691
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
1692
1692
|
title: "删除选中 (Delete)",
|
|
1693
1693
|
disabled: !l && w.length === 0,
|
|
1694
1694
|
onClick: () => {
|
|
1695
|
-
l ? x(l) : w.length > 0 && (w.forEach((
|
|
1695
|
+
l ? x(l) : w.length > 0 && (w.forEach((g) => x(g)), M([]));
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
1698
|
],
|
|
1699
1699
|
[
|
|
1700
1700
|
y,
|
|
1701
|
-
|
|
1701
|
+
E,
|
|
1702
1702
|
R,
|
|
1703
1703
|
i,
|
|
1704
|
-
|
|
1705
|
-
|
|
1704
|
+
m,
|
|
1705
|
+
M,
|
|
1706
1706
|
w,
|
|
1707
1707
|
ve,
|
|
1708
|
-
|
|
1708
|
+
Me,
|
|
1709
1709
|
Ce,
|
|
1710
1710
|
l,
|
|
1711
1711
|
x
|
|
@@ -1713,28 +1713,28 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1713
1713
|
);
|
|
1714
1714
|
return /* @__PURE__ */ c("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
|
|
1715
1715
|
/* @__PURE__ */ c("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
|
|
1716
|
-
/* @__PURE__ */ e(ae, { children: Tt.map((
|
|
1716
|
+
/* @__PURE__ */ e(ae, { children: Tt.map((g) => /* @__PURE__ */ e(we, { title: g.title, children: /* @__PURE__ */ e(
|
|
1717
1717
|
j,
|
|
1718
1718
|
{
|
|
1719
|
-
type:
|
|
1720
|
-
icon:
|
|
1721
|
-
onClick:
|
|
1719
|
+
type: g.active ? "primary" : "default",
|
|
1720
|
+
icon: g.icon,
|
|
1721
|
+
onClick: g.onClick
|
|
1722
1722
|
}
|
|
1723
|
-
) },
|
|
1724
|
-
/* @__PURE__ */ e(ae, { children: $t.map((
|
|
1723
|
+
) }, g.title)) }),
|
|
1724
|
+
/* @__PURE__ */ e(ae, { children: $t.map((g) => /* @__PURE__ */ e(we, { title: g.title, children: /* @__PURE__ */ e(
|
|
1725
1725
|
j,
|
|
1726
1726
|
{
|
|
1727
|
-
type:
|
|
1728
|
-
icon:
|
|
1729
|
-
onClick:
|
|
1730
|
-
disabled:
|
|
1727
|
+
type: g.active ? "primary" : g.type || "default",
|
|
1728
|
+
icon: g.icon,
|
|
1729
|
+
onClick: g.onClick,
|
|
1730
|
+
disabled: g.disabled
|
|
1731
1731
|
}
|
|
1732
|
-
) },
|
|
1732
|
+
) }, g.title)) })
|
|
1733
1733
|
] }),
|
|
1734
1734
|
/* @__PURE__ */ e("div", { ref: r, className: "flex-1 relative", children: /* @__PURE__ */ e(
|
|
1735
1735
|
tn,
|
|
1736
1736
|
{
|
|
1737
|
-
ref:
|
|
1737
|
+
ref: f,
|
|
1738
1738
|
initialScale: 1,
|
|
1739
1739
|
initialPositionX: 0,
|
|
1740
1740
|
initialPositionY: 0,
|
|
@@ -1747,13 +1747,13 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1747
1747
|
wheel: { disabled: !1, step: 0.1 },
|
|
1748
1748
|
pinch: { disabled: !1 },
|
|
1749
1749
|
doubleClick: { disabled: !0 },
|
|
1750
|
-
children: ({ zoomIn:
|
|
1750
|
+
children: ({ zoomIn: g, zoomOut: I, resetTransform: X }) => /* @__PURE__ */ c(Se, { children: [
|
|
1751
1751
|
/* @__PURE__ */ e("div", { className: "absolute bottom-4 right-4 z-10 bg-white rounded-lg shadow-lg p-2", children: /* @__PURE__ */ c(ae, { direction: "vertical", children: [
|
|
1752
|
-
/* @__PURE__ */ e(we, { title: "放大", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(
|
|
1752
|
+
/* @__PURE__ */ e(we, { title: "放大", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(Gt, {}), onClick: () => g() }) }),
|
|
1753
1753
|
/* @__PURE__ */ e(we, { title: "缩小", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(Bt, {}), onClick: () => I() }) }),
|
|
1754
1754
|
/* @__PURE__ */ e(we, { title: "重置视图", children: /* @__PURE__ */ e(j, { onClick: () => X(), children: "100%" }) }),
|
|
1755
1755
|
/* @__PURE__ */ c("div", { className: "text-center text-xs text-gray-500", children: [
|
|
1756
|
-
Math.round(
|
|
1756
|
+
Math.round(h.scale * 100),
|
|
1757
1757
|
"%"
|
|
1758
1758
|
] })
|
|
1759
1759
|
] }) }),
|
|
@@ -1776,9 +1776,9 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1776
1776
|
className: `relative bg-white ${L ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""}`,
|
|
1777
1777
|
style: { width: 1920, height: 1080, flexShrink: 0 },
|
|
1778
1778
|
onClick: ke,
|
|
1779
|
-
onMouseDown:
|
|
1779
|
+
onMouseDown: Ee,
|
|
1780
1780
|
onDoubleClick: Ae,
|
|
1781
|
-
onDragOver:
|
|
1781
|
+
onDragOver: Ge,
|
|
1782
1782
|
onDragLeave: Be,
|
|
1783
1783
|
onDrop: Ve,
|
|
1784
1784
|
children: [
|
|
@@ -1843,7 +1843,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1843
1843
|
Nn,
|
|
1844
1844
|
{
|
|
1845
1845
|
value: ze,
|
|
1846
|
-
onChange: (
|
|
1846
|
+
onChange: (g) => Re(g.target.value),
|
|
1847
1847
|
rows: 10,
|
|
1848
1848
|
placeholder: "输入 JSON 格式的测试数据"
|
|
1849
1849
|
}
|
|
@@ -1870,20 +1870,20 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1870
1870
|
"#73d13d"
|
|
1871
1871
|
], et = ({
|
|
1872
1872
|
value: n = "#1890ff",
|
|
1873
|
-
onChange:
|
|
1873
|
+
onChange: f,
|
|
1874
1874
|
onChangeComplete: t
|
|
1875
1875
|
}) => {
|
|
1876
|
-
const [r, d] =
|
|
1876
|
+
const [r, d] = q(!1), [l, a] = q(n), o = ue(null);
|
|
1877
1877
|
se(() => {
|
|
1878
1878
|
a(n);
|
|
1879
1879
|
}, [n]), se(() => {
|
|
1880
|
-
const
|
|
1880
|
+
const p = (u) => {
|
|
1881
1881
|
o.current && !o.current.contains(u.target) && (d(!1), t?.({ toHexString: () => l }));
|
|
1882
1882
|
};
|
|
1883
|
-
return r && document.addEventListener("mousedown",
|
|
1883
|
+
return r && document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
1884
1884
|
}, [r, t, l]);
|
|
1885
|
-
const
|
|
1886
|
-
a(
|
|
1885
|
+
const h = (p) => {
|
|
1886
|
+
a(p), f?.({ toHexString: () => p });
|
|
1887
1887
|
};
|
|
1888
1888
|
return /* @__PURE__ */ c("div", { ref: o, style: { position: "relative", display: "inline-block" }, children: [
|
|
1889
1889
|
/* @__PURE__ */ e(
|
|
@@ -1915,29 +1915,29 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1915
1915
|
border: "1px solid #f0f0f0"
|
|
1916
1916
|
},
|
|
1917
1917
|
children: [
|
|
1918
|
-
/* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: kn.map((
|
|
1918
|
+
/* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: kn.map((p) => /* @__PURE__ */ e(
|
|
1919
1919
|
"div",
|
|
1920
1920
|
{
|
|
1921
1921
|
onClick: () => {
|
|
1922
|
-
|
|
1922
|
+
h(p), d(!1), t?.({ toHexString: () => p });
|
|
1923
1923
|
},
|
|
1924
1924
|
style: {
|
|
1925
1925
|
width: 20,
|
|
1926
1926
|
height: 20,
|
|
1927
|
-
backgroundColor:
|
|
1928
|
-
border: l ===
|
|
1927
|
+
backgroundColor: p,
|
|
1928
|
+
border: l === p ? "2px solid #1890ff" : "1px solid #d9d9d9",
|
|
1929
1929
|
borderRadius: 2,
|
|
1930
1930
|
cursor: "pointer"
|
|
1931
1931
|
}
|
|
1932
1932
|
},
|
|
1933
|
-
|
|
1933
|
+
p
|
|
1934
1934
|
)) }),
|
|
1935
1935
|
/* @__PURE__ */ e(
|
|
1936
1936
|
"input",
|
|
1937
1937
|
{
|
|
1938
1938
|
type: "color",
|
|
1939
1939
|
value: l,
|
|
1940
|
-
onChange: (
|
|
1940
|
+
onChange: (p) => h(p.target.value),
|
|
1941
1941
|
onBlur: () => t?.({ toHexString: () => l }),
|
|
1942
1942
|
style: {
|
|
1943
1943
|
width: "100%",
|
|
@@ -1952,13 +1952,13 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1952
1952
|
}
|
|
1953
1953
|
)
|
|
1954
1954
|
] });
|
|
1955
|
-
}, { Option: Ue } = me,
|
|
1955
|
+
}, { Option: Ue } = me, En = ({
|
|
1956
1956
|
material: n,
|
|
1957
|
-
onSave:
|
|
1957
|
+
onSave: f,
|
|
1958
1958
|
bindCodes: t = [],
|
|
1959
1959
|
dataOptions: r = []
|
|
1960
1960
|
}) => {
|
|
1961
|
-
const l = n.content || {}, [a, o] =
|
|
1961
|
+
const l = n.content || {}, [a, o] = q({
|
|
1962
1962
|
label: l.label || "",
|
|
1963
1963
|
value: l.value || "",
|
|
1964
1964
|
valueSourceCode: l.valueSourceCode || "",
|
|
@@ -1986,17 +1986,17 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
1986
1986
|
valueColor: l.valueStyle?.color || "#1890ff"
|
|
1987
1987
|
});
|
|
1988
1988
|
}, [n.id]);
|
|
1989
|
-
const
|
|
1989
|
+
const h = (s, x) => {
|
|
1990
1990
|
o((y) => ({ ...y, [s]: x }));
|
|
1991
|
-
},
|
|
1992
|
-
const x = r.find((
|
|
1993
|
-
o((
|
|
1994
|
-
...
|
|
1991
|
+
}, p = (s) => {
|
|
1992
|
+
const x = r.find((E) => E.paramsCode === s), y = x?.unit || "";
|
|
1993
|
+
o((E) => ({
|
|
1994
|
+
...E,
|
|
1995
1995
|
valueSourceCode: s,
|
|
1996
1996
|
unit: y,
|
|
1997
1997
|
value: String(x?.value || "")
|
|
1998
1998
|
})), setTimeout(() => {
|
|
1999
|
-
|
|
1999
|
+
f({
|
|
2000
2000
|
content: {
|
|
2001
2001
|
...l,
|
|
2002
2002
|
valueSourceCode: s,
|
|
@@ -2006,7 +2006,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2006
2006
|
});
|
|
2007
2007
|
}, 0);
|
|
2008
2008
|
}, u = () => {
|
|
2009
|
-
|
|
2009
|
+
f({
|
|
2010
2010
|
content: {
|
|
2011
2011
|
...l,
|
|
2012
2012
|
label: a.label,
|
|
@@ -2036,7 +2036,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2036
2036
|
J,
|
|
2037
2037
|
{
|
|
2038
2038
|
value: a.label,
|
|
2039
|
-
onChange: (s) =>
|
|
2039
|
+
onChange: (s) => h("label", s.target.value),
|
|
2040
2040
|
onBlur: u,
|
|
2041
2041
|
placeholder: "输入标签文本"
|
|
2042
2042
|
}
|
|
@@ -2050,7 +2050,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2050
2050
|
me,
|
|
2051
2051
|
{
|
|
2052
2052
|
value: a.valueSourceCode || void 0,
|
|
2053
|
-
onChange:
|
|
2053
|
+
onChange: p,
|
|
2054
2054
|
placeholder: "选择数据字段(可选)",
|
|
2055
2055
|
allowClear: !0,
|
|
2056
2056
|
style: { width: "100%" },
|
|
@@ -2072,7 +2072,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2072
2072
|
J,
|
|
2073
2073
|
{
|
|
2074
2074
|
value: a.value,
|
|
2075
|
-
onChange: (s) =>
|
|
2075
|
+
onChange: (s) => h("value", s.target.value),
|
|
2076
2076
|
onBlur: u,
|
|
2077
2077
|
placeholder: a.valueSourceCode ? "数据字段无值时显示此备用值" : "输入值文本",
|
|
2078
2078
|
disabled: !!a.valueSourceCode,
|
|
@@ -2085,7 +2085,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2085
2085
|
J,
|
|
2086
2086
|
{
|
|
2087
2087
|
value: a.unit,
|
|
2088
|
-
onChange: (s) =>
|
|
2088
|
+
onChange: (s) => h("unit", s.target.value),
|
|
2089
2089
|
onBlur: u,
|
|
2090
2090
|
placeholder: "单位(如°C、%、MPa等)",
|
|
2091
2091
|
suffix: a.valueSourceCode && b.length > 0 ? /* @__PURE__ */ e(le, { color: "blue", style: { marginRight: -8 }, children: "自动" }) : null
|
|
@@ -2100,7 +2100,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2100
2100
|
V,
|
|
2101
2101
|
{
|
|
2102
2102
|
value: a.decimals,
|
|
2103
|
-
onChange: (s) =>
|
|
2103
|
+
onChange: (s) => h("decimals", s ?? 2),
|
|
2104
2104
|
onBlur: u,
|
|
2105
2105
|
min: -1,
|
|
2106
2106
|
max: 10,
|
|
@@ -2117,7 +2117,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2117
2117
|
V,
|
|
2118
2118
|
{
|
|
2119
2119
|
value: a.labelFontSize,
|
|
2120
|
-
onChange: (s) =>
|
|
2120
|
+
onChange: (s) => h("labelFontSize", s || 14),
|
|
2121
2121
|
onBlur: u,
|
|
2122
2122
|
min: 8,
|
|
2123
2123
|
max: 72
|
|
@@ -2128,7 +2128,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2128
2128
|
{
|
|
2129
2129
|
value: a.labelFontWeight,
|
|
2130
2130
|
onChange: (s) => {
|
|
2131
|
-
|
|
2131
|
+
h("labelFontWeight", s), setTimeout(u, 0);
|
|
2132
2132
|
},
|
|
2133
2133
|
style: { width: 100 },
|
|
2134
2134
|
children: [
|
|
@@ -2144,10 +2144,10 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2144
2144
|
{
|
|
2145
2145
|
value: a.labelColor || "#262626",
|
|
2146
2146
|
onChange: (s) => {
|
|
2147
|
-
|
|
2147
|
+
h("labelColor", s.toHexString());
|
|
2148
2148
|
},
|
|
2149
2149
|
onChangeComplete: (s) => {
|
|
2150
|
-
|
|
2150
|
+
f({
|
|
2151
2151
|
content: {
|
|
2152
2152
|
...l,
|
|
2153
2153
|
label: a.label,
|
|
@@ -2174,7 +2174,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2174
2174
|
J,
|
|
2175
2175
|
{
|
|
2176
2176
|
value: a.labelColor,
|
|
2177
|
-
onChange: (s) =>
|
|
2177
|
+
onChange: (s) => h("labelColor", s.target.value),
|
|
2178
2178
|
onBlur: u,
|
|
2179
2179
|
placeholder: "#262626",
|
|
2180
2180
|
style: { width: 100 }
|
|
@@ -2189,7 +2189,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2189
2189
|
V,
|
|
2190
2190
|
{
|
|
2191
2191
|
value: a.valueFontSize,
|
|
2192
|
-
onChange: (s) =>
|
|
2192
|
+
onChange: (s) => h("valueFontSize", s || 14),
|
|
2193
2193
|
onBlur: u,
|
|
2194
2194
|
min: 8,
|
|
2195
2195
|
max: 72
|
|
@@ -2200,7 +2200,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2200
2200
|
{
|
|
2201
2201
|
value: a.valueFontWeight,
|
|
2202
2202
|
onChange: (s) => {
|
|
2203
|
-
|
|
2203
|
+
h("valueFontWeight", s), setTimeout(u, 0);
|
|
2204
2204
|
},
|
|
2205
2205
|
style: { width: 100 },
|
|
2206
2206
|
children: [
|
|
@@ -2216,10 +2216,10 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2216
2216
|
{
|
|
2217
2217
|
value: a.valueColor || "#1890ff",
|
|
2218
2218
|
onChange: (s) => {
|
|
2219
|
-
|
|
2219
|
+
h("valueColor", s.toHexString());
|
|
2220
2220
|
},
|
|
2221
2221
|
onChangeComplete: (s) => {
|
|
2222
|
-
|
|
2222
|
+
f({
|
|
2223
2223
|
content: {
|
|
2224
2224
|
...l,
|
|
2225
2225
|
label: a.label,
|
|
@@ -2246,7 +2246,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2246
2246
|
J,
|
|
2247
2247
|
{
|
|
2248
2248
|
value: a.valueColor,
|
|
2249
|
-
onChange: (s) =>
|
|
2249
|
+
onChange: (s) => h("valueColor", s.target.value),
|
|
2250
2250
|
onBlur: u,
|
|
2251
2251
|
placeholder: "#1890ff",
|
|
2252
2252
|
style: { width: 100 }
|
|
@@ -2255,11 +2255,11 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2255
2255
|
] }) })
|
|
2256
2256
|
] })
|
|
2257
2257
|
] });
|
|
2258
|
-
},
|
|
2258
|
+
}, Mn = ({
|
|
2259
2259
|
material: n,
|
|
2260
|
-
onSave:
|
|
2260
|
+
onSave: f
|
|
2261
2261
|
}) => {
|
|
2262
|
-
const t = n, [r, d] =
|
|
2262
|
+
const t = n, [r, d] = q({
|
|
2263
2263
|
name: n.name,
|
|
2264
2264
|
src: t.src || ""
|
|
2265
2265
|
});
|
|
@@ -2269,10 +2269,10 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2269
2269
|
src: t.src || ""
|
|
2270
2270
|
});
|
|
2271
2271
|
}, [n.id]);
|
|
2272
|
-
const l = (o,
|
|
2273
|
-
d((
|
|
2272
|
+
const l = (o, h) => {
|
|
2273
|
+
d((p) => ({ ...p, [o]: h }));
|
|
2274
2274
|
}, a = () => {
|
|
2275
|
-
|
|
2275
|
+
f({
|
|
2276
2276
|
name: r.name,
|
|
2277
2277
|
src: r.src
|
|
2278
2278
|
});
|
|
@@ -2302,9 +2302,9 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2302
2302
|
] });
|
|
2303
2303
|
}, { Option: Dn } = me, Ln = ({
|
|
2304
2304
|
material: n,
|
|
2305
|
-
onSave:
|
|
2305
|
+
onSave: f
|
|
2306
2306
|
}) => {
|
|
2307
|
-
const t = n.config || {}, [r, d] =
|
|
2307
|
+
const t = n.config || {}, [r, d] = q({
|
|
2308
2308
|
lineWeight: t.lineWeight || t.thickness || 2,
|
|
2309
2309
|
color: t.color || "#262626",
|
|
2310
2310
|
lineType: t.lineType || "solid",
|
|
@@ -2325,18 +2325,18 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2325
2325
|
});
|
|
2326
2326
|
}, [n.id]);
|
|
2327
2327
|
const l = (o) => {
|
|
2328
|
-
const
|
|
2329
|
-
d(
|
|
2328
|
+
const h = { ...r, ...o };
|
|
2329
|
+
d(h), f({
|
|
2330
2330
|
config: {
|
|
2331
2331
|
...t,
|
|
2332
|
-
thickness:
|
|
2333
|
-
lineWeight:
|
|
2334
|
-
color:
|
|
2335
|
-
lineType:
|
|
2336
|
-
startX:
|
|
2337
|
-
startY:
|
|
2338
|
-
endX:
|
|
2339
|
-
endY:
|
|
2332
|
+
thickness: h.lineWeight,
|
|
2333
|
+
lineWeight: h.lineWeight,
|
|
2334
|
+
color: h.color,
|
|
2335
|
+
lineType: h.lineType,
|
|
2336
|
+
startX: h.startX,
|
|
2337
|
+
startY: h.startY,
|
|
2338
|
+
endX: h.endX,
|
|
2339
|
+
endY: h.endY
|
|
2340
2340
|
}
|
|
2341
2341
|
});
|
|
2342
2342
|
}, a = [
|
|
@@ -2432,7 +2432,8 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2432
2432
|
{
|
|
2433
2433
|
size: "small",
|
|
2434
2434
|
onClick: () => {
|
|
2435
|
-
|
|
2435
|
+
const o = t.startY ?? r.startY;
|
|
2436
|
+
l({ endY: o });
|
|
2436
2437
|
},
|
|
2437
2438
|
title: "将线条变为水平线",
|
|
2438
2439
|
children: "水平"
|
|
@@ -2443,7 +2444,8 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2443
2444
|
{
|
|
2444
2445
|
size: "small",
|
|
2445
2446
|
onClick: () => {
|
|
2446
|
-
|
|
2447
|
+
const o = t.startX ?? r.startX;
|
|
2448
|
+
l({ endX: o });
|
|
2447
2449
|
},
|
|
2448
2450
|
title: "将线条变为垂直线",
|
|
2449
2451
|
children: "垂直"
|
|
@@ -2454,11 +2456,12 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2454
2456
|
{
|
|
2455
2457
|
size: "small",
|
|
2456
2458
|
onClick: () => {
|
|
2459
|
+
const o = t.startX ?? r.startX, h = t.startY ?? r.startY, p = t.endX ?? r.endX, u = t.endY ?? r.endY;
|
|
2457
2460
|
l({
|
|
2458
|
-
startX:
|
|
2459
|
-
startY:
|
|
2460
|
-
endX:
|
|
2461
|
-
endY:
|
|
2461
|
+
startX: p,
|
|
2462
|
+
startY: u,
|
|
2463
|
+
endX: o,
|
|
2464
|
+
endY: h
|
|
2462
2465
|
});
|
|
2463
2466
|
},
|
|
2464
2467
|
title: "交换起点和终点",
|
|
@@ -2470,31 +2473,31 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2470
2473
|
] });
|
|
2471
2474
|
}, Pt = ({
|
|
2472
2475
|
material: n,
|
|
2473
|
-
onSave:
|
|
2476
|
+
onSave: f,
|
|
2474
2477
|
bindCodes: t,
|
|
2475
2478
|
dataOptions: r
|
|
2476
2479
|
}) => {
|
|
2477
2480
|
switch (n.type) {
|
|
2478
2481
|
case "TEXT":
|
|
2479
2482
|
return /* @__PURE__ */ e(
|
|
2480
|
-
|
|
2483
|
+
En,
|
|
2481
2484
|
{
|
|
2482
2485
|
material: n,
|
|
2483
|
-
onSave:
|
|
2486
|
+
onSave: f,
|
|
2484
2487
|
bindCodes: t,
|
|
2485
2488
|
dataOptions: r
|
|
2486
2489
|
}
|
|
2487
2490
|
);
|
|
2488
2491
|
case "IMAGE":
|
|
2489
|
-
return /* @__PURE__ */ e(
|
|
2492
|
+
return /* @__PURE__ */ e(Mn, { material: n, onSave: f });
|
|
2490
2493
|
case "LINE":
|
|
2491
|
-
return /* @__PURE__ */ e(Ln, { material: n, onSave:
|
|
2494
|
+
return /* @__PURE__ */ e(Ln, { material: n, onSave: f });
|
|
2492
2495
|
default:
|
|
2493
2496
|
return /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-8", children: "暂不支持编辑此类型的物料" });
|
|
2494
2497
|
}
|
|
2495
2498
|
}, { Panel: yt } = he, { TextArea: Pn } = J, Tn = ({
|
|
2496
2499
|
node: n,
|
|
2497
|
-
updateNode:
|
|
2500
|
+
updateNode: f,
|
|
2498
2501
|
materials: t
|
|
2499
2502
|
}) => {
|
|
2500
2503
|
const r = t.filter((u) => u.type !== "CUSTOM" || !u.config?.nodes), d = (u, b) => {
|
|
@@ -2505,7 +2508,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2505
2508
|
statusList: b
|
|
2506
2509
|
}
|
|
2507
2510
|
} : x);
|
|
2508
|
-
|
|
2511
|
+
f(n.id, {
|
|
2509
2512
|
children: s
|
|
2510
2513
|
});
|
|
2511
2514
|
}, l = (u) => {
|
|
@@ -2525,18 +2528,18 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2525
2528
|
const x = s.contentInfo.statusList.filter((y) => y.id !== b);
|
|
2526
2529
|
d(u, x);
|
|
2527
2530
|
}, o = (u, b, s) => {
|
|
2528
|
-
const x = n.children?.find((
|
|
2531
|
+
const x = n.children?.find((E) => E.id === u);
|
|
2529
2532
|
if (!x) return;
|
|
2530
|
-
const y = x.contentInfo.statusList.map((
|
|
2533
|
+
const y = x.contentInfo.statusList.map((E) => E.id === b ? { ...E, ...s } : E);
|
|
2531
2534
|
d(u, y);
|
|
2532
|
-
},
|
|
2533
|
-
const x = n.children?.find((
|
|
2535
|
+
}, h = (u, b, s) => {
|
|
2536
|
+
const x = n.children?.find((m) => m.id === u);
|
|
2534
2537
|
if (!x) return;
|
|
2535
|
-
const y = x.contentInfo.statusList.findIndex((
|
|
2538
|
+
const y = x.contentInfo.statusList.findIndex((m) => m.id === b);
|
|
2536
2539
|
if (y === -1) return;
|
|
2537
|
-
const
|
|
2538
|
-
s === "up" && y > 0 ? [
|
|
2539
|
-
},
|
|
2540
|
+
const E = [...x.contentInfo.statusList];
|
|
2541
|
+
s === "up" && y > 0 ? [E[y], E[y - 1]] = [E[y - 1], E[y]] : s === "down" && y < E.length - 1 && ([E[y], E[y + 1]] = [E[y + 1], E[y]]), d(u, E);
|
|
2542
|
+
}, p = (u, b, s) => {
|
|
2540
2543
|
const x = t.find((y) => y.id === s);
|
|
2541
2544
|
x && o(u, b, {
|
|
2542
2545
|
material: { ...x, id: z() }
|
|
@@ -2591,7 +2594,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2591
2594
|
icon: /* @__PURE__ */ e(It, {}),
|
|
2592
2595
|
disabled: x === 0,
|
|
2593
2596
|
onClick: (y) => {
|
|
2594
|
-
y.stopPropagation(),
|
|
2597
|
+
y.stopPropagation(), h(u.id, s.id, "up");
|
|
2595
2598
|
}
|
|
2596
2599
|
}
|
|
2597
2600
|
),
|
|
@@ -2603,7 +2606,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2603
2606
|
icon: /* @__PURE__ */ e(kt, {}),
|
|
2604
2607
|
disabled: x === u.contentInfo.statusList.length - 1,
|
|
2605
2608
|
onClick: (y) => {
|
|
2606
|
-
y.stopPropagation(),
|
|
2609
|
+
y.stopPropagation(), h(u.id, s.id, "down");
|
|
2607
2610
|
}
|
|
2608
2611
|
}
|
|
2609
2612
|
),
|
|
@@ -2613,7 +2616,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2613
2616
|
type: "text",
|
|
2614
2617
|
size: "small",
|
|
2615
2618
|
danger: !0,
|
|
2616
|
-
icon: /* @__PURE__ */ e(
|
|
2619
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
2617
2620
|
onClick: (y) => {
|
|
2618
2621
|
y.stopPropagation(), a(u.id, s.id);
|
|
2619
2622
|
}
|
|
@@ -2664,7 +2667,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2664
2667
|
placeholder: "选择新物料",
|
|
2665
2668
|
style: { width: 150 },
|
|
2666
2669
|
value: void 0,
|
|
2667
|
-
onChange: (y) => y &&
|
|
2670
|
+
onChange: (y) => y && p(u.id, s.id, y),
|
|
2668
2671
|
options: r.map((y) => ({
|
|
2669
2672
|
value: y.id,
|
|
2670
2673
|
label: `${y.name} (${y.type})`
|
|
@@ -2683,8 +2686,8 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2683
2686
|
{
|
|
2684
2687
|
material: s.material,
|
|
2685
2688
|
onSave: (y) => {
|
|
2686
|
-
const
|
|
2687
|
-
o(u.id, s.id, { material:
|
|
2689
|
+
const E = { ...s.material, ...y };
|
|
2690
|
+
o(u.id, s.id, { material: E });
|
|
2688
2691
|
}
|
|
2689
2692
|
}
|
|
2690
2693
|
)
|
|
@@ -2702,16 +2705,16 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2702
2705
|
defaultTestData: n
|
|
2703
2706
|
}) => {
|
|
2704
2707
|
const {
|
|
2705
|
-
nodes:
|
|
2708
|
+
nodes: f,
|
|
2706
2709
|
selectedNodeId: t,
|
|
2707
2710
|
updateNode: r,
|
|
2708
2711
|
updateNodeStyle: d,
|
|
2709
2712
|
updateNodeControl: l,
|
|
2710
2713
|
updateNodeContent: a,
|
|
2711
2714
|
materials: o,
|
|
2712
|
-
selectedStatusId:
|
|
2713
|
-
selectStatus:
|
|
2714
|
-
} = Ie(), [u] = v.useForm(), [b, s] =
|
|
2715
|
+
selectedStatusId: h,
|
|
2716
|
+
selectStatus: p
|
|
2717
|
+
} = Ie(), [u] = v.useForm(), [b, s] = q("basic"), [x, y] = q(!1), [E, m] = q(null), [A, Y] = q({}), D = de.useMemo(() => f.find((i) => i.id === t), [f, t]), L = D?.contentInfo.statusList || [], O = (i) => {
|
|
2715
2718
|
t && (i.normalStyle && d(t, i.normalStyle), i.name !== void 0 && r(t, { name: i.name }), i.controlInfo && l(t, i.controlInfo));
|
|
2716
2719
|
};
|
|
2717
2720
|
se(() => {
|
|
@@ -2735,10 +2738,10 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2735
2738
|
isSelectable: !0,
|
|
2736
2739
|
...D.controlInfo
|
|
2737
2740
|
}
|
|
2738
|
-
}),
|
|
2739
|
-
}, [D?.id, u,
|
|
2741
|
+
}), p(null));
|
|
2742
|
+
}, [D?.id, u, p]);
|
|
2740
2743
|
const ie = () => {
|
|
2741
|
-
!t || !D || (
|
|
2744
|
+
!t || !D || (m("new"), y(!0));
|
|
2742
2745
|
}, H = (i) => {
|
|
2743
2746
|
if (!t || !D) return;
|
|
2744
2747
|
const k = {
|
|
@@ -2748,18 +2751,18 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2748
2751
|
material: { ...i, id: z() },
|
|
2749
2752
|
bindCodes: []
|
|
2750
2753
|
};
|
|
2751
|
-
if (
|
|
2754
|
+
if (E === "new") {
|
|
2752
2755
|
const S = [...L, k];
|
|
2753
2756
|
a(t, { statusList: S });
|
|
2754
|
-
} else if (
|
|
2755
|
-
const S = L.map((w) => w.id ===
|
|
2757
|
+
} else if (E) {
|
|
2758
|
+
const S = L.map((w) => w.id === E ? { ...w, material: { ...i, id: z() } } : w);
|
|
2756
2759
|
a(t, { statusList: S });
|
|
2757
2760
|
}
|
|
2758
|
-
y(!1),
|
|
2761
|
+
y(!1), m(null);
|
|
2759
2762
|
}, Q = (i) => {
|
|
2760
2763
|
if (!t || !D) return;
|
|
2761
2764
|
const k = D.contentInfo.statusList?.filter((S) => S.id !== i) || [];
|
|
2762
|
-
a(t, { statusList: k }),
|
|
2765
|
+
a(t, { statusList: k }), h === i && p(null);
|
|
2763
2766
|
}, F = (i, k) => {
|
|
2764
2767
|
if (!t || !D) return;
|
|
2765
2768
|
const S = D.contentInfo.statusList?.map((w) => w.id === i ? { ...w, ...k } : w) || [];
|
|
@@ -2775,7 +2778,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2775
2778
|
a(t, { statusList: S });
|
|
2776
2779
|
}, T = (i, k) => {
|
|
2777
2780
|
if (!t || !D) return;
|
|
2778
|
-
const S = L.findIndex((
|
|
2781
|
+
const S = L.findIndex((M) => M.id === i);
|
|
2779
2782
|
if (S === -1) return;
|
|
2780
2783
|
const w = [...L];
|
|
2781
2784
|
k === "up" && S > 0 ? [w[S], w[S - 1]] = [
|
|
@@ -2786,7 +2789,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2786
2789
|
w[S]
|
|
2787
2790
|
]), a(t, { statusList: w });
|
|
2788
2791
|
}, B = (i) => {
|
|
2789
|
-
|
|
2792
|
+
m(i), y(!0);
|
|
2790
2793
|
}, R = (i, k) => {
|
|
2791
2794
|
if (!t || !D) return;
|
|
2792
2795
|
const S = L.map((w) => w.id === i ? {
|
|
@@ -2806,7 +2809,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2806
2809
|
{
|
|
2807
2810
|
form: u,
|
|
2808
2811
|
layout: "vertical",
|
|
2809
|
-
onValuesChange:
|
|
2812
|
+
onValuesChange: O,
|
|
2810
2813
|
initialValues: { name: D.name },
|
|
2811
2814
|
children: [
|
|
2812
2815
|
/* @__PURE__ */ e(v.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(J, { placeholder: "输入节点名称" }) }),
|
|
@@ -2918,7 +2921,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2918
2921
|
type: "text",
|
|
2919
2922
|
size: "small",
|
|
2920
2923
|
danger: !0,
|
|
2921
|
-
icon: /* @__PURE__ */ e(
|
|
2924
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
2922
2925
|
onClick: (S) => {
|
|
2923
2926
|
S.stopPropagation(), Q(i.id);
|
|
2924
2927
|
}
|
|
@@ -2943,14 +2946,14 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
2943
2946
|
$n,
|
|
2944
2947
|
{
|
|
2945
2948
|
value: A[i.id] ?? i.expression,
|
|
2946
|
-
onChange: (S) =>
|
|
2949
|
+
onChange: (S) => Y((w) => ({
|
|
2947
2950
|
...w,
|
|
2948
2951
|
[i.id]: S.target.value
|
|
2949
2952
|
})),
|
|
2950
2953
|
onBlur: (S) => {
|
|
2951
|
-
F(i.id, { expression: S.target.value }),
|
|
2952
|
-
const
|
|
2953
|
-
return delete
|
|
2954
|
+
F(i.id, { expression: S.target.value }), Y((w) => {
|
|
2955
|
+
const M = { ...w };
|
|
2956
|
+
return delete M[i.id], M;
|
|
2954
2957
|
});
|
|
2955
2958
|
},
|
|
2956
2959
|
rows: 3,
|
|
@@ -3009,7 +3012,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3009
3012
|
{
|
|
3010
3013
|
form: u,
|
|
3011
3014
|
layout: "vertical",
|
|
3012
|
-
onValuesChange:
|
|
3015
|
+
onValuesChange: O,
|
|
3013
3016
|
children: [
|
|
3014
3017
|
/* @__PURE__ */ e(
|
|
3015
3018
|
v.Item,
|
|
@@ -3068,7 +3071,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3068
3071
|
title: "选择物料",
|
|
3069
3072
|
open: x,
|
|
3070
3073
|
onCancel: () => {
|
|
3071
|
-
y(!1),
|
|
3074
|
+
y(!1), m(null);
|
|
3072
3075
|
},
|
|
3073
3076
|
footer: null,
|
|
3074
3077
|
width: 600,
|
|
@@ -3119,34 +3122,34 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3119
3122
|
}
|
|
3120
3123
|
)
|
|
3121
3124
|
] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(ne, { description: "请选择一个节点" }) });
|
|
3122
|
-
}, vt = ({ material: n, onClick:
|
|
3125
|
+
}, vt = ({ material: n, onClick: f }) => {
|
|
3123
3126
|
const t = n.type === "IMAGE" ? n.src : void 0;
|
|
3124
3127
|
return /* @__PURE__ */ c(
|
|
3125
3128
|
"div",
|
|
3126
3129
|
{
|
|
3127
3130
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
3128
|
-
onClick:
|
|
3131
|
+
onClick: f,
|
|
3129
3132
|
children: [
|
|
3130
3133
|
/* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-1 flex items-center justify-center", children: t ? /* @__PURE__ */ e("img", { src: t, alt: n.name, className: "w-10 h-10 object-contain" }) : /* @__PURE__ */ e("span", { className: "text-xs", children: n.name[0] }) }),
|
|
3131
3134
|
/* @__PURE__ */ e("span", { className: "text-xs", children: n.name })
|
|
3132
3135
|
]
|
|
3133
3136
|
}
|
|
3134
3137
|
);
|
|
3135
|
-
},
|
|
3136
|
-
configEditor:
|
|
3138
|
+
}, Yn = "ConfigEditor-module__configEditor__dinNG", On = {
|
|
3139
|
+
configEditor: Yn
|
|
3137
3140
|
}, { Header: Xn, Sider: bt, Content: zn } = Qe, Bn = ({
|
|
3138
3141
|
initialScheme: n,
|
|
3139
|
-
onChange:
|
|
3142
|
+
onChange: f,
|
|
3140
3143
|
readonly: t = !1,
|
|
3141
3144
|
headerExtra: r,
|
|
3142
3145
|
className: d = "",
|
|
3143
3146
|
style: l,
|
|
3144
3147
|
showHeader: a = !0,
|
|
3145
3148
|
showMaterialPanel: o = !0,
|
|
3146
|
-
showPropertyPanel:
|
|
3147
|
-
customMaterials:
|
|
3149
|
+
showPropertyPanel: h = !0,
|
|
3150
|
+
customMaterials: p
|
|
3148
3151
|
}) => {
|
|
3149
|
-
const [u, b] = de.useState(!1), [s, x] = de.useState(""), [y,
|
|
3152
|
+
const [u, b] = de.useState(!1), [s, x] = de.useState(""), [y, E] = de.useState([
|
|
3150
3153
|
{
|
|
3151
3154
|
paramsCode: "001",
|
|
3152
3155
|
paramsName: "通频速度有效值",
|
|
@@ -3159,28 +3162,28 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3159
3162
|
value: 1.5,
|
|
3160
3163
|
paramsUnit: "m/s²"
|
|
3161
3164
|
}
|
|
3162
|
-
]), { exportScheme:
|
|
3165
|
+
]), { exportScheme: m, importScheme: A, nodes: Y, materials: D, addMaterial: L } = Ie();
|
|
3163
3166
|
de.useRef(null);
|
|
3164
|
-
const
|
|
3167
|
+
const O = de.useRef(!1);
|
|
3165
3168
|
se(() => {
|
|
3166
|
-
|
|
3169
|
+
O.current || (O.current = !0, D.length === 0 && pn.forEach((P) => L(P)), p && p.length > 0 && p.forEach((P) => L(P)), n && A(n));
|
|
3167
3170
|
}, []), se(() => {
|
|
3168
|
-
if (
|
|
3169
|
-
const P =
|
|
3170
|
-
|
|
3171
|
+
if (f) {
|
|
3172
|
+
const P = m();
|
|
3173
|
+
f(P);
|
|
3171
3174
|
}
|
|
3172
|
-
}, [
|
|
3173
|
-
const ie =
|
|
3174
|
-
const P =
|
|
3175
|
+
}, [Y, f]);
|
|
3176
|
+
const ie = G(() => {
|
|
3177
|
+
const P = m(), T = JSON.stringify(P, null, 2), B = "data:application/json;charset=utf-8," + encodeURIComponent(T), R = `scheme_${Date.now()}.json`, i = document.createElement("a");
|
|
3175
3178
|
i.setAttribute("href", B), i.setAttribute("download", R), i.click(), De.success("导出成功!");
|
|
3176
|
-
}, [
|
|
3179
|
+
}, [m]), H = G(() => {
|
|
3177
3180
|
try {
|
|
3178
3181
|
const P = JSON.parse(s);
|
|
3179
3182
|
A(P), b(!1), x(""), De.success("导入成功!");
|
|
3180
3183
|
} catch {
|
|
3181
3184
|
De.error("JSON 格式错误,请检查输入");
|
|
3182
3185
|
}
|
|
3183
|
-
}, [s, A]), Q =
|
|
3186
|
+
}, [s, A]), Q = G(
|
|
3184
3187
|
(P) => {
|
|
3185
3188
|
const T = new FileReader();
|
|
3186
3189
|
return T.onload = (B) => {
|
|
@@ -3193,16 +3196,16 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3193
3196
|
}, T.readAsText(P), !1;
|
|
3194
3197
|
},
|
|
3195
3198
|
[A]
|
|
3196
|
-
), F =
|
|
3199
|
+
), F = G(() => m(), [m]);
|
|
3197
3200
|
return de.useImperativeHandle(
|
|
3198
3201
|
de.useRef?.(),
|
|
3199
3202
|
() => ({
|
|
3200
3203
|
getScheme: F,
|
|
3201
|
-
exportScheme:
|
|
3204
|
+
exportScheme: m,
|
|
3202
3205
|
importScheme: A
|
|
3203
3206
|
}),
|
|
3204
|
-
[F,
|
|
3205
|
-
), /* @__PURE__ */ e(zt, { locale: hn, children: /* @__PURE__ */ e("div", { className:
|
|
3207
|
+
[F, m, A]
|
|
3208
|
+
), /* @__PURE__ */ e(zt, { locale: hn, children: /* @__PURE__ */ e("div", { className: On.configEditor, style: l, children: /* @__PURE__ */ c(
|
|
3206
3209
|
Qe,
|
|
3207
3210
|
{
|
|
3208
3211
|
className: `h-full w-full overflow-hidden ${d}`,
|
|
@@ -3211,7 +3214,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3211
3214
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
3212
3215
|
/* @__PURE__ */ e("div", { className: "text-xl font-bold text-blue-600", children: "组态编辑器" }),
|
|
3213
3216
|
/* @__PURE__ */ c("div", { className: "text-sm text-gray-500", children: [
|
|
3214
|
-
|
|
3217
|
+
Y.length,
|
|
3215
3218
|
" 个节点"
|
|
3216
3219
|
] })
|
|
3217
3220
|
] }),
|
|
@@ -3233,7 +3236,7 @@ const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l,
|
|
|
3233
3236
|
/* @__PURE__ */ c(Qe, { children: [
|
|
3234
3237
|
o && !t && /* @__PURE__ */ e(bt, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(yn, {}) }),
|
|
3235
3238
|
/* @__PURE__ */ e(zn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(In, { defaultTestData: y }) }),
|
|
3236
|
-
|
|
3239
|
+
h && !t && /* @__PURE__ */ e(bt, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(_n, { defaultTestData: y }) })
|
|
3237
3240
|
] }),
|
|
3238
3241
|
/* @__PURE__ */ e(
|
|
3239
3242
|
tt,
|