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