jch-config-editor 0.1.2 → 0.1.3
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 +1232 -1146
- 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
|
|
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 c, jsx as e, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
+
import de, { useState as G, useRef as ue, useMemo as xt, useCallback as q, useEffect as se } from "react";
|
|
3
|
+
import { Typography as wt, Upload as Yt, Button as j, Collapse as he, List as xe, Empty as ne, Tag as le, Image as Xt, Space as ae, Tooltip as we, Modal as tt, Form as v, Input as J, Divider as ye, Select as me, InputNumber as V, Tabs as St, Switch as Fe, message as De, ConfigProvider as zt, Layout as Qe } from "antd";
|
|
4
|
+
import { UploadOutlined as Ct, EditOutlined as nt, DeleteOutlined as Ge, UndoOutlined as Rt, RedoOutlined as At, GroupOutlined as at, AlignLeftOutlined as jt, AlignRightOutlined as Ft, VerticalAlignTopOutlined as Wt, VerticalAlignBottomOutlined as Ut, ExperimentOutlined as Gt, ZoomInOutlined as qt, ZoomOutOutlined as Bt, SelectOutlined as Vt, DragOutlined as Ht, EyeOutlined as Zt, PlusOutlined as Nt, ArrowUpOutlined as It, ArrowDownOutlined as kt, CopyOutlined as Jt, DownloadOutlined as Kt } from "@ant-design/icons";
|
|
5
|
+
import { create as Qt } from "zustand";
|
|
6
|
+
import { produce as en } from "immer";
|
|
7
|
+
import { nanoid as z } from "nanoid";
|
|
8
|
+
import { TransformWrapper as tn, TransformComponent as nn } from "react-zoom-pan-pinch";
|
|
9
|
+
function ln(n) {
|
|
10
10
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
11
11
|
}
|
|
12
|
-
var Le = {},
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
-
function
|
|
12
|
+
var Le = {}, Ze = { exports: {} }, it;
|
|
13
|
+
function lt() {
|
|
14
|
+
return it || (it = 1, (function(n) {
|
|
15
|
+
function m(t) {
|
|
16
16
|
return t && t.__esModule ? t : {
|
|
17
17
|
default: t
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
n.exports =
|
|
21
|
-
})(
|
|
20
|
+
n.exports = m, n.exports.__esModule = !0, n.exports.default = n.exports;
|
|
21
|
+
})(Ze)), Ze.exports;
|
|
22
22
|
}
|
|
23
|
-
var Pe = {},
|
|
24
|
-
function
|
|
25
|
-
if (
|
|
26
|
-
|
|
23
|
+
var Pe = {}, ot;
|
|
24
|
+
function rn() {
|
|
25
|
+
if (ot) return Pe;
|
|
26
|
+
ot = 1, Object.defineProperty(Pe, "__esModule", {
|
|
27
27
|
value: !0
|
|
28
28
|
}), Pe.default = void 0;
|
|
29
29
|
const n = {
|
|
@@ -43,9 +43,9 @@ function tn() {
|
|
|
43
43
|
};
|
|
44
44
|
return Pe.default = n, Pe;
|
|
45
45
|
}
|
|
46
|
-
var Te = {}, $e = {}, _e = {}, Oe = {},
|
|
47
|
-
function
|
|
48
|
-
return
|
|
46
|
+
var Te = {}, $e = {}, _e = {}, Oe = {}, st;
|
|
47
|
+
function an() {
|
|
48
|
+
return st || (st = 1, Object.defineProperty(Oe, "__esModule", {
|
|
49
49
|
value: !0
|
|
50
50
|
}), Oe.commonLocale = void 0, Oe.commonLocale = {
|
|
51
51
|
yearFormat: "YYYY",
|
|
@@ -54,58 +54,58 @@ function nn() {
|
|
|
54
54
|
monthBeforeYear: !0
|
|
55
55
|
}), Oe;
|
|
56
56
|
}
|
|
57
|
-
var
|
|
58
|
-
function
|
|
59
|
-
if (
|
|
60
|
-
|
|
57
|
+
var ct;
|
|
58
|
+
function on() {
|
|
59
|
+
if (ct) return _e;
|
|
60
|
+
ct = 1, Object.defineProperty(_e, "__esModule", {
|
|
61
61
|
value: !0
|
|
62
62
|
}), _e.default = void 0;
|
|
63
|
-
var n =
|
|
64
|
-
function
|
|
63
|
+
var n = an();
|
|
64
|
+
function m(f) {
|
|
65
65
|
"@babel/helpers - typeof";
|
|
66
|
-
return
|
|
67
|
-
return typeof
|
|
68
|
-
} : function(
|
|
69
|
-
return
|
|
70
|
-
},
|
|
66
|
+
return m = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(g) {
|
|
67
|
+
return typeof g;
|
|
68
|
+
} : function(g) {
|
|
69
|
+
return g && typeof Symbol == "function" && g.constructor === Symbol && g !== Symbol.prototype ? "symbol" : typeof g;
|
|
70
|
+
}, m(f);
|
|
71
71
|
}
|
|
72
|
-
function t(
|
|
73
|
-
var u = Object.keys(
|
|
72
|
+
function t(f, g) {
|
|
73
|
+
var u = Object.keys(f);
|
|
74
74
|
if (Object.getOwnPropertySymbols) {
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
return Object.getOwnPropertyDescriptor(
|
|
78
|
-
})), u.push.apply(u,
|
|
75
|
+
var b = Object.getOwnPropertySymbols(f);
|
|
76
|
+
g && (b = b.filter(function(s) {
|
|
77
|
+
return Object.getOwnPropertyDescriptor(f, s).enumerable;
|
|
78
|
+
})), u.push.apply(u, b);
|
|
79
79
|
}
|
|
80
80
|
return u;
|
|
81
81
|
}
|
|
82
|
-
function r(
|
|
83
|
-
for (var
|
|
84
|
-
var u = arguments[
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
88
|
-
Object.defineProperty(
|
|
82
|
+
function r(f) {
|
|
83
|
+
for (var g = 1; g < arguments.length; g++) {
|
|
84
|
+
var u = arguments[g] != null ? arguments[g] : {};
|
|
85
|
+
g % 2 ? t(Object(u), !0).forEach(function(b) {
|
|
86
|
+
d(f, b, u[b]);
|
|
87
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(f, Object.getOwnPropertyDescriptors(u)) : t(Object(u)).forEach(function(b) {
|
|
88
|
+
Object.defineProperty(f, b, Object.getOwnPropertyDescriptor(u, b));
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return f;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
93
|
+
function d(f, g, u) {
|
|
94
|
+
return g = l(g), g in f ? Object.defineProperty(f, g, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : f[g] = u, f;
|
|
95
95
|
}
|
|
96
|
-
function l(
|
|
97
|
-
var
|
|
98
|
-
return
|
|
96
|
+
function l(f) {
|
|
97
|
+
var g = a(f, "string");
|
|
98
|
+
return m(g) == "symbol" ? g : String(g);
|
|
99
99
|
}
|
|
100
|
-
function a(
|
|
101
|
-
if (
|
|
102
|
-
var u =
|
|
100
|
+
function a(f, g) {
|
|
101
|
+
if (m(f) != "object" || !f) return f;
|
|
102
|
+
var u = f[Symbol.toPrimitive];
|
|
103
103
|
if (u !== void 0) {
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
104
|
+
var b = u.call(f, g);
|
|
105
|
+
if (m(b) != "object") return b;
|
|
106
106
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
107
107
|
}
|
|
108
|
-
return (
|
|
108
|
+
return (g === "string" ? String : Number)(f);
|
|
109
109
|
}
|
|
110
110
|
var o = r(r({}, n.commonLocale), {}, {
|
|
111
111
|
locale: "zh_CN",
|
|
@@ -137,10 +137,10 @@ function ln() {
|
|
|
137
137
|
});
|
|
138
138
|
return _e.default = o, _e;
|
|
139
139
|
}
|
|
140
|
-
var Ye = {},
|
|
141
|
-
function
|
|
142
|
-
if (
|
|
143
|
-
|
|
140
|
+
var Ye = {}, dt;
|
|
141
|
+
function Mt() {
|
|
142
|
+
if (dt) return Ye;
|
|
143
|
+
dt = 1, Object.defineProperty(Ye, "__esModule", {
|
|
144
144
|
value: !0
|
|
145
145
|
}), Ye.default = void 0;
|
|
146
146
|
const n = {
|
|
@@ -149,15 +149,15 @@ function Ct() {
|
|
|
149
149
|
};
|
|
150
150
|
return Ye.default = n, Ye;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
153
|
-
function
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
var n =
|
|
152
|
+
var ut;
|
|
153
|
+
function Et() {
|
|
154
|
+
if (ut) return $e;
|
|
155
|
+
ut = 1;
|
|
156
|
+
var n = lt().default;
|
|
157
157
|
Object.defineProperty($e, "__esModule", {
|
|
158
158
|
value: !0
|
|
159
159
|
}), $e.default = void 0;
|
|
160
|
-
var
|
|
160
|
+
var m = n(on()), t = n(/* @__PURE__ */ Mt());
|
|
161
161
|
const r = {
|
|
162
162
|
lang: {
|
|
163
163
|
placeholder: "请选择日期",
|
|
@@ -170,7 +170,7 @@ function Nt() {
|
|
|
170
170
|
rangeMonthPlaceholder: ["开始月份", "结束月份"],
|
|
171
171
|
rangeQuarterPlaceholder: ["开始季度", "结束季度"],
|
|
172
172
|
rangeWeekPlaceholder: ["开始周", "结束周"],
|
|
173
|
-
...
|
|
173
|
+
...m.default
|
|
174
174
|
},
|
|
175
175
|
timePickerLocale: {
|
|
176
176
|
...t.default
|
|
@@ -178,31 +178,31 @@ function Nt() {
|
|
|
178
178
|
};
|
|
179
179
|
return r.lang.ok = "确定", $e.default = r, $e;
|
|
180
180
|
}
|
|
181
|
-
var
|
|
182
|
-
function
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
var n =
|
|
181
|
+
var ht;
|
|
182
|
+
function sn() {
|
|
183
|
+
if (ht) return Te;
|
|
184
|
+
ht = 1;
|
|
185
|
+
var n = lt().default;
|
|
186
186
|
Object.defineProperty(Te, "__esModule", {
|
|
187
187
|
value: !0
|
|
188
188
|
}), Te.default = void 0;
|
|
189
|
-
var
|
|
190
|
-
return Te.default =
|
|
189
|
+
var m = n(/* @__PURE__ */ Et());
|
|
190
|
+
return Te.default = m.default, Te;
|
|
191
191
|
}
|
|
192
|
-
var
|
|
193
|
-
function
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
var n =
|
|
192
|
+
var mt;
|
|
193
|
+
function cn() {
|
|
194
|
+
if (mt) return Le;
|
|
195
|
+
mt = 1;
|
|
196
|
+
var n = lt().default;
|
|
197
197
|
Object.defineProperty(Le, "__esModule", {
|
|
198
198
|
value: !0
|
|
199
199
|
}), Le.default = void 0;
|
|
200
|
-
var
|
|
200
|
+
var m = n(rn()), t = n(/* @__PURE__ */ sn()), r = n(/* @__PURE__ */ Et()), d = n(/* @__PURE__ */ Mt());
|
|
201
201
|
const l = "${label}不是一个有效的${type}", a = {
|
|
202
202
|
locale: "zh-cn",
|
|
203
|
-
Pagination:
|
|
203
|
+
Pagination: m.default,
|
|
204
204
|
DatePicker: r.default,
|
|
205
|
-
TimePicker:
|
|
205
|
+
TimePicker: d.default,
|
|
206
206
|
Calendar: t.default,
|
|
207
207
|
// locales for all components
|
|
208
208
|
global: {
|
|
@@ -340,15 +340,15 @@ function an() {
|
|
|
340
340
|
};
|
|
341
341
|
return Le.default = a, Le;
|
|
342
342
|
}
|
|
343
|
-
var
|
|
344
|
-
function
|
|
345
|
-
return
|
|
343
|
+
var Je, ft;
|
|
344
|
+
function dn() {
|
|
345
|
+
return ft || (ft = 1, Je = /* @__PURE__ */ cn()), Je;
|
|
346
346
|
}
|
|
347
|
-
var
|
|
348
|
-
const
|
|
349
|
-
const o = typeof
|
|
350
|
-
return
|
|
351
|
-
}, n(r.setState, t, r)),
|
|
347
|
+
var un = /* @__PURE__ */ dn();
|
|
348
|
+
const hn = /* @__PURE__ */ ln(un), mn = (n) => (m, t, r) => (r.setState = (d, l, ...a) => {
|
|
349
|
+
const o = typeof d == "function" ? en(d) : d;
|
|
350
|
+
return m(o, l, ...a);
|
|
351
|
+
}, n(r.setState, t, r)), fn = mn, pt = {
|
|
352
352
|
nodes: [],
|
|
353
353
|
materials: [],
|
|
354
354
|
selectedNodeId: null,
|
|
@@ -369,86 +369,86 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
369
369
|
startPoint: null,
|
|
370
370
|
endPoint: null
|
|
371
371
|
}
|
|
372
|
-
},
|
|
373
|
-
id:
|
|
372
|
+
}, ce = (n, m, t) => ({
|
|
373
|
+
id: z(),
|
|
374
374
|
type: n,
|
|
375
|
-
targetId:
|
|
375
|
+
targetId: m,
|
|
376
376
|
payload: t,
|
|
377
377
|
timestamp: Date.now()
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
...
|
|
378
|
+
}), Ie = Qt()(
|
|
379
|
+
fn((n, m) => ({
|
|
380
|
+
...pt,
|
|
381
381
|
// ========== 节点操作 ==========
|
|
382
382
|
addNode: (t, r = !0) => {
|
|
383
|
-
n((
|
|
383
|
+
n((d) => {
|
|
384
384
|
const l = {
|
|
385
385
|
...t,
|
|
386
|
-
id:
|
|
386
|
+
id: z()
|
|
387
387
|
};
|
|
388
|
-
|
|
388
|
+
d.nodes.push(l), r && (d.selectedNodeId = l.id, d.history.past.push(ce("NODE_SELECT", l.id)));
|
|
389
389
|
});
|
|
390
390
|
},
|
|
391
391
|
updateNode: (t, r) => {
|
|
392
|
-
n((
|
|
393
|
-
const l =
|
|
394
|
-
l && (Object.assign(l, r),
|
|
392
|
+
n((d) => {
|
|
393
|
+
const l = d.nodes.find((a) => a.id === t);
|
|
394
|
+
l && (Object.assign(l, r), d.history.past.push(ce("PROPERTY_CHANGE", t, r)));
|
|
395
395
|
});
|
|
396
396
|
},
|
|
397
397
|
updateNodeStyle: (t, r) => {
|
|
398
|
-
n((
|
|
399
|
-
const l =
|
|
400
|
-
l && (Object.assign(l.normalStyle, r),
|
|
398
|
+
n((d) => {
|
|
399
|
+
const l = d.nodes.find((a) => a.id === t);
|
|
400
|
+
l && (Object.assign(l.normalStyle, r), d.history.past.push(ce("PROPERTY_CHANGE", t, { normalStyle: r })));
|
|
401
401
|
});
|
|
402
402
|
},
|
|
403
403
|
updateNodeContent: (t, r) => {
|
|
404
|
-
n((
|
|
405
|
-
const l =
|
|
406
|
-
l && (Object.assign(l.contentInfo, r),
|
|
404
|
+
n((d) => {
|
|
405
|
+
const l = d.nodes.find((a) => a.id === t);
|
|
406
|
+
l && (Object.assign(l.contentInfo, r), d.history.past.push(ce("PROPERTY_CHANGE", t, { contentInfo: r })));
|
|
407
407
|
});
|
|
408
408
|
},
|
|
409
409
|
updateNodeControl: (t, r) => {
|
|
410
|
-
n((
|
|
411
|
-
const l =
|
|
412
|
-
l && (Object.assign(l.controlInfo, r),
|
|
410
|
+
n((d) => {
|
|
411
|
+
const l = d.nodes.find((a) => a.id === t);
|
|
412
|
+
l && (Object.assign(l.controlInfo, r), d.history.past.push(ce("PROPERTY_CHANGE", t, { controlInfo: r })));
|
|
413
413
|
});
|
|
414
414
|
},
|
|
415
415
|
removeNode: (t) => {
|
|
416
416
|
n((r) => {
|
|
417
|
-
const
|
|
418
|
-
|
|
417
|
+
const d = r.nodes.findIndex((l) => l.id === t);
|
|
418
|
+
d !== -1 && (r.nodes.splice(d, 1), r.selectedNodeId === t && (r.selectedNodeId = null, r.selectedStatusId = null), r.history.past.push(ce("NODE_DELETE", t)));
|
|
419
419
|
});
|
|
420
420
|
},
|
|
421
421
|
selectNode: (t) => {
|
|
422
422
|
n((r) => {
|
|
423
|
-
r.selectedNodeId = t, r.selectedStatusId = null, t && r.history.past.push(
|
|
423
|
+
r.selectedNodeId = t, r.selectedStatusId = null, t && r.history.past.push(ce("NODE_SELECT", t));
|
|
424
424
|
});
|
|
425
425
|
},
|
|
426
426
|
// ========== 状态操作 ==========
|
|
427
427
|
addStatus: (t, r) => {
|
|
428
|
-
n((
|
|
429
|
-
const l =
|
|
428
|
+
n((d) => {
|
|
429
|
+
const l = d.nodes.find((o) => o.id === t);
|
|
430
430
|
if (!l) return;
|
|
431
431
|
const a = {
|
|
432
432
|
...r,
|
|
433
|
-
id:
|
|
433
|
+
id: z()
|
|
434
434
|
};
|
|
435
|
-
l.contentInfo.statusList.push(a),
|
|
435
|
+
l.contentInfo.statusList.push(a), d.history.past.push(ce("MATERIAL_STATUS_CHANGE", t, { statusId: a.id }));
|
|
436
436
|
});
|
|
437
437
|
},
|
|
438
438
|
removeStatus: (t, r) => {
|
|
439
|
-
n((
|
|
440
|
-
const l =
|
|
439
|
+
n((d) => {
|
|
440
|
+
const l = d.nodes.find((o) => o.id === t);
|
|
441
441
|
if (!l) return;
|
|
442
442
|
const a = l.contentInfo.statusList.findIndex((o) => o.id === r);
|
|
443
|
-
a !== -1 && (l.contentInfo.statusList.splice(a, 1), l.contentInfo.currentStatusId === r && (l.contentInfo.currentStatusId = void 0),
|
|
443
|
+
a !== -1 && (l.contentInfo.statusList.splice(a, 1), l.contentInfo.currentStatusId === r && (l.contentInfo.currentStatusId = void 0), d.selectedStatusId === r && (d.selectedStatusId = null));
|
|
444
444
|
});
|
|
445
445
|
},
|
|
446
|
-
updateStatus: (t, r,
|
|
446
|
+
updateStatus: (t, r, d) => {
|
|
447
447
|
n((l) => {
|
|
448
|
-
const a = l.nodes.find((
|
|
448
|
+
const a = l.nodes.find((f) => f.id === t);
|
|
449
449
|
if (!a) return;
|
|
450
|
-
const o = a.contentInfo.statusList.find((
|
|
451
|
-
o && Object.assign(o,
|
|
450
|
+
const o = a.contentInfo.statusList.find((f) => f.id === r);
|
|
451
|
+
o && Object.assign(o, d);
|
|
452
452
|
});
|
|
453
453
|
},
|
|
454
454
|
selectStatus: (t) => {
|
|
@@ -457,7 +457,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
457
457
|
});
|
|
458
458
|
},
|
|
459
459
|
evaluateCurrentStatus: (t, r) => {
|
|
460
|
-
const l =
|
|
460
|
+
const l = m().nodes.find((a) => a.id === t);
|
|
461
461
|
if (l)
|
|
462
462
|
for (const a of l.contentInfo.statusList)
|
|
463
463
|
try {
|
|
@@ -470,23 +470,23 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
470
470
|
// ========== 物料库操作 ==========
|
|
471
471
|
addMaterial: (t) => {
|
|
472
472
|
n((r) => {
|
|
473
|
-
const
|
|
473
|
+
const d = {
|
|
474
474
|
...t,
|
|
475
|
-
id:
|
|
475
|
+
id: z()
|
|
476
476
|
};
|
|
477
|
-
r.materials.push(
|
|
477
|
+
r.materials.push(d), r.history.past.push(ce("MATERIAL_ADD", d.id));
|
|
478
478
|
});
|
|
479
479
|
},
|
|
480
480
|
updateMaterial: (t, r) => {
|
|
481
|
-
n((
|
|
482
|
-
const l =
|
|
481
|
+
n((d) => {
|
|
482
|
+
const l = d.materials.find((a) => a.id === t);
|
|
483
483
|
l && Object.assign(l, r);
|
|
484
484
|
});
|
|
485
485
|
},
|
|
486
486
|
removeMaterial: (t) => {
|
|
487
487
|
n((r) => {
|
|
488
|
-
const
|
|
489
|
-
|
|
488
|
+
const d = r.materials.findIndex((l) => l.id === t);
|
|
489
|
+
d !== -1 && r.materials.splice(d, 1);
|
|
490
490
|
});
|
|
491
491
|
},
|
|
492
492
|
// ========== 视口操作 ==========
|
|
@@ -557,7 +557,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
557
557
|
},
|
|
558
558
|
// ========== 导入导出 ==========
|
|
559
559
|
exportScheme: () => {
|
|
560
|
-
const t =
|
|
560
|
+
const t = m();
|
|
561
561
|
return {
|
|
562
562
|
version: "1.1.0",
|
|
563
563
|
nodes: t.nodes,
|
|
@@ -573,52 +573,52 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
573
573
|
},
|
|
574
574
|
importScheme: (t) => {
|
|
575
575
|
n((r) => {
|
|
576
|
-
r.nodes = t.nodes || [], r.materials = t.materials || [], r.viewport = t.viewport ||
|
|
576
|
+
r.nodes = t.nodes || [], r.materials = t.materials || [], r.viewport = t.viewport || pt.viewport, r.selectedNodeId = null, r.selectedStatusId = null, r.history = { past: [], future: [] };
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
579
|
}))
|
|
580
|
-
),
|
|
580
|
+
), pn = [
|
|
581
581
|
// 基础形状
|
|
582
582
|
{
|
|
583
|
-
id:
|
|
583
|
+
id: z(),
|
|
584
584
|
name: "矩形",
|
|
585
585
|
type: "IMAGE",
|
|
586
586
|
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>')}`
|
|
587
587
|
},
|
|
588
588
|
{
|
|
589
|
-
id:
|
|
589
|
+
id: z(),
|
|
590
590
|
name: "圆形",
|
|
591
591
|
type: "IMAGE",
|
|
592
592
|
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>')}`
|
|
593
593
|
},
|
|
594
594
|
{
|
|
595
|
-
id:
|
|
595
|
+
id: z(),
|
|
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="#faad14" rx="20"/></svg>')}`
|
|
599
599
|
},
|
|
600
600
|
// 设备图标
|
|
601
601
|
{
|
|
602
|
-
id:
|
|
602
|
+
id: z(),
|
|
603
603
|
name: "阀门",
|
|
604
604
|
type: "IMAGE",
|
|
605
605
|
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>')}`
|
|
606
606
|
},
|
|
607
607
|
{
|
|
608
|
-
id:
|
|
608
|
+
id: z(),
|
|
609
609
|
name: "泵",
|
|
610
610
|
type: "IMAGE",
|
|
611
611
|
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>')}`
|
|
612
612
|
},
|
|
613
613
|
{
|
|
614
|
-
id:
|
|
614
|
+
id: z(),
|
|
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="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>')}`
|
|
618
618
|
},
|
|
619
619
|
// 文本
|
|
620
620
|
{
|
|
621
|
-
id:
|
|
621
|
+
id: z(),
|
|
622
622
|
name: "文本标签",
|
|
623
623
|
type: "TEXT",
|
|
624
624
|
content: {
|
|
@@ -640,7 +640,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
640
640
|
},
|
|
641
641
|
// 线条 - 通用线条物料,通过属性配置实现不同线型
|
|
642
642
|
{
|
|
643
|
-
id:
|
|
643
|
+
id: z(),
|
|
644
644
|
name: "线条",
|
|
645
645
|
type: "LINE",
|
|
646
646
|
config: {
|
|
@@ -650,43 +650,43 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
650
650
|
lineType: "solid"
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
],
|
|
654
|
-
id:
|
|
653
|
+
], Dt = (n) => ({
|
|
654
|
+
id: z(),
|
|
655
655
|
name: "默认状态",
|
|
656
656
|
expression: "return true;",
|
|
657
|
-
material: { ...n, id:
|
|
657
|
+
material: { ...n, id: z() },
|
|
658
658
|
bindCodes: []
|
|
659
|
-
}),
|
|
659
|
+
}), gn = (n, m, t) => {
|
|
660
660
|
if (t?.type === "CUSTOM" && t.config?.nodes) {
|
|
661
|
-
const r = t.config.nodes.map((
|
|
662
|
-
...
|
|
663
|
-
id:
|
|
661
|
+
const r = t.config.nodes.map((g) => ({
|
|
662
|
+
...g,
|
|
663
|
+
id: z()
|
|
664
664
|
// 重新生成子节点ID
|
|
665
665
|
}));
|
|
666
|
-
let
|
|
667
|
-
r.forEach((
|
|
668
|
-
const u =
|
|
669
|
-
|
|
666
|
+
let d = 1 / 0, l = 1 / 0, a = -1 / 0, o = -1 / 0;
|
|
667
|
+
r.forEach((g) => {
|
|
668
|
+
const u = g.normalStyle.x || 0, b = g.normalStyle.y || 0, s = g.normalStyle.width || 0, x = g.normalStyle.height || 0;
|
|
669
|
+
d = Math.min(d, u), l = Math.min(l, b), a = Math.max(a, u + s), o = Math.max(o, b + x);
|
|
670
670
|
});
|
|
671
|
-
const
|
|
672
|
-
...
|
|
671
|
+
const f = r.map((g) => ({
|
|
672
|
+
...g,
|
|
673
673
|
normalStyle: {
|
|
674
|
-
...
|
|
675
|
-
x: (
|
|
676
|
-
y: (
|
|
674
|
+
...g.normalStyle,
|
|
675
|
+
x: (g.normalStyle.x || 0) - d,
|
|
676
|
+
y: (g.normalStyle.y || 0) - l,
|
|
677
677
|
scale: void 0
|
|
678
678
|
// 移除 scale,由父级容器统一控制
|
|
679
679
|
}
|
|
680
680
|
}));
|
|
681
681
|
return {
|
|
682
|
-
id:
|
|
682
|
+
id: z(),
|
|
683
683
|
name: t.name || "群组节点",
|
|
684
684
|
type: "group",
|
|
685
685
|
normalStyle: {
|
|
686
|
-
width: a -
|
|
686
|
+
width: a - d,
|
|
687
687
|
height: o - l,
|
|
688
688
|
x: n,
|
|
689
|
-
y:
|
|
689
|
+
y: m
|
|
690
690
|
// 不设置背景和边框,由 NodeRenderer 控制
|
|
691
691
|
},
|
|
692
692
|
contentInfo: {
|
|
@@ -699,23 +699,23 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
699
699
|
isResizable: !0,
|
|
700
700
|
isSelectable: !0
|
|
701
701
|
},
|
|
702
|
-
children:
|
|
702
|
+
children: f
|
|
703
703
|
};
|
|
704
704
|
}
|
|
705
705
|
return {
|
|
706
|
-
id:
|
|
706
|
+
id: z(),
|
|
707
707
|
name: "新节点",
|
|
708
708
|
type: "normal",
|
|
709
709
|
normalStyle: {
|
|
710
710
|
width: 120,
|
|
711
711
|
height: 100,
|
|
712
712
|
x: n,
|
|
713
|
-
y:
|
|
713
|
+
y: m,
|
|
714
714
|
background: "transparent",
|
|
715
715
|
padding: 8
|
|
716
716
|
},
|
|
717
717
|
contentInfo: {
|
|
718
|
-
statusList: t ? [
|
|
718
|
+
statusList: t ? [Dt(t)] : [],
|
|
719
719
|
currentStatusId: void 0
|
|
720
720
|
},
|
|
721
721
|
controlInfo: {
|
|
@@ -725,213 +725,213 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
725
725
|
isSelectable: !0
|
|
726
726
|
}
|
|
727
727
|
};
|
|
728
|
-
}, { Panel:
|
|
728
|
+
}, { Panel: Ne } = he, { Text: We } = wt, yn = () => {
|
|
729
729
|
const {
|
|
730
730
|
materials: n,
|
|
731
|
-
addMaterial:
|
|
731
|
+
addMaterial: m,
|
|
732
732
|
removeMaterial: t,
|
|
733
733
|
selectedStatusId: r,
|
|
734
|
-
selectStatus:
|
|
734
|
+
selectStatus: d,
|
|
735
735
|
mode: l,
|
|
736
736
|
lineDrawing: a,
|
|
737
737
|
startLineDrawing: o,
|
|
738
|
-
cancelLineDrawing:
|
|
739
|
-
} =
|
|
738
|
+
cancelLineDrawing: f
|
|
739
|
+
} = Ie(), [g, u] = G([
|
|
740
740
|
"basic",
|
|
741
741
|
"device",
|
|
742
742
|
"text",
|
|
743
743
|
"line"
|
|
744
|
-
]),
|
|
745
|
-
const
|
|
746
|
-
return
|
|
747
|
-
const D =
|
|
748
|
-
|
|
749
|
-
name:
|
|
744
|
+
]), b = (h) => {
|
|
745
|
+
const A = new FileReader();
|
|
746
|
+
return A.onload = (O) => {
|
|
747
|
+
const D = O.target?.result;
|
|
748
|
+
m({
|
|
749
|
+
name: h.name.replace(".svg", ""),
|
|
750
750
|
type: "IMAGE",
|
|
751
751
|
src: D
|
|
752
752
|
});
|
|
753
|
-
},
|
|
753
|
+
}, A.readAsDataURL(h), !1;
|
|
754
754
|
}, s = {
|
|
755
755
|
basic: n.filter(
|
|
756
|
-
(
|
|
756
|
+
(h) => ["矩形", "圆形", "圆角矩形"].includes(h.name)
|
|
757
757
|
),
|
|
758
758
|
device: n.filter(
|
|
759
|
-
(
|
|
759
|
+
(h) => ["阀门", "泵", "罐体"].includes(h.name) || h.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(h.name) && h.name !== "自定义"
|
|
760
760
|
),
|
|
761
|
-
text: n.filter((
|
|
762
|
-
line: n.filter((
|
|
763
|
-
group: n.filter((
|
|
761
|
+
text: n.filter((h) => h.type === "TEXT"),
|
|
762
|
+
line: n.filter((h) => h.type === "LINE"),
|
|
763
|
+
group: n.filter((h) => h.type === "CUSTOM" && h.config?.nodes),
|
|
764
764
|
custom: n.filter(
|
|
765
|
-
(
|
|
765
|
+
(h) => h.type === "CUSTOM" && !h.config?.nodes || h.type === "IMAGE" && !["矩形", "圆形", "圆角矩形", "阀门", "泵", "罐体"].includes(h.name)
|
|
766
766
|
)
|
|
767
|
-
}, x = (
|
|
768
|
-
|
|
769
|
-
const
|
|
767
|
+
}, x = (h, A) => {
|
|
768
|
+
h.dataTransfer.effectAllowed = "copy", h.dataTransfer.setData("application/json", JSON.stringify(A));
|
|
769
|
+
const O = h.currentTarget.querySelector(
|
|
770
770
|
".material-preview"
|
|
771
771
|
);
|
|
772
|
-
|
|
773
|
-
},
|
|
774
|
-
|
|
775
|
-
},
|
|
776
|
-
const
|
|
772
|
+
O && h.dataTransfer.setDragImage(O, 20, 20);
|
|
773
|
+
}, y = (h) => {
|
|
774
|
+
h.type === "LINE" && o(h);
|
|
775
|
+
}, M = (h, A = !1) => {
|
|
776
|
+
const O = A === !0, D = l === "line-draw" && O && a.material?.id === h.id;
|
|
777
777
|
return /* @__PURE__ */ e(
|
|
778
|
-
|
|
778
|
+
xe.Item,
|
|
779
779
|
{
|
|
780
|
-
draggable: !
|
|
781
|
-
onDragStart: (
|
|
782
|
-
onClick: () =>
|
|
780
|
+
draggable: !O,
|
|
781
|
+
onDragStart: (L) => x(L, h),
|
|
782
|
+
onClick: () => O && y(h),
|
|
783
783
|
className: `
|
|
784
784
|
rounded-lg transition-all duration-200 select-none
|
|
785
|
-
${
|
|
785
|
+
${O ? "cursor-pointer" : "cursor-move"}
|
|
786
786
|
hover:bg-gray-100
|
|
787
787
|
${D ? "bg-blue-50 ring-2 ring-blue-400" : ""}
|
|
788
788
|
`,
|
|
789
789
|
actions: [
|
|
790
|
-
|
|
791
|
-
|
|
790
|
+
O ? /* @__PURE__ */ e(
|
|
791
|
+
j,
|
|
792
792
|
{
|
|
793
793
|
type: "text",
|
|
794
794
|
size: "small",
|
|
795
|
-
icon: /* @__PURE__ */ e(
|
|
796
|
-
onClick: (
|
|
797
|
-
|
|
795
|
+
icon: /* @__PURE__ */ e(nt, {}),
|
|
796
|
+
onClick: (L) => {
|
|
797
|
+
L.stopPropagation(), y(h);
|
|
798
798
|
},
|
|
799
799
|
children: "绘制"
|
|
800
800
|
},
|
|
801
801
|
"draw"
|
|
802
802
|
) : null,
|
|
803
803
|
/* @__PURE__ */ e(
|
|
804
|
-
|
|
804
|
+
j,
|
|
805
805
|
{
|
|
806
806
|
type: "text",
|
|
807
807
|
size: "small",
|
|
808
808
|
danger: !0,
|
|
809
|
-
icon: /* @__PURE__ */ e(
|
|
810
|
-
onClick: (
|
|
811
|
-
|
|
809
|
+
icon: /* @__PURE__ */ e(Ge, {}),
|
|
810
|
+
onClick: (L) => {
|
|
811
|
+
L.stopPropagation(), t(h.id);
|
|
812
812
|
}
|
|
813
813
|
},
|
|
814
814
|
"delete"
|
|
815
815
|
)
|
|
816
816
|
].filter(Boolean),
|
|
817
|
-
children: /* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */ e("div", { className: "material-preview w-12 h-12 flex items-center justify-center bg-white rounded border border-gray-200", children:
|
|
819
|
-
|
|
817
|
+
children: /* @__PURE__ */ c("div", { className: `flex items-center gap-3 w-full py-2 ${O ? "" : "pointer-events-none"}`, children: [
|
|
818
|
+
/* @__PURE__ */ e("div", { className: "material-preview w-12 h-12 flex items-center justify-center bg-white rounded border border-gray-200", children: h.type === "IMAGE" && h.src ? /* @__PURE__ */ e(
|
|
819
|
+
Xt,
|
|
820
820
|
{
|
|
821
|
-
src:
|
|
822
|
-
alt:
|
|
821
|
+
src: h.src,
|
|
822
|
+
alt: h.name,
|
|
823
823
|
width: 40,
|
|
824
824
|
height: 40,
|
|
825
825
|
preview: !1
|
|
826
826
|
}
|
|
827
|
-
) :
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */ e(
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */ e(
|
|
832
|
-
D && /* @__PURE__ */ e(
|
|
827
|
+
) : h.type === "TEXT" ? /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "T" }) : h.type === "LINE" ? /* @__PURE__ */ e("div", { className: "w-8 h-0.5 bg-gray-400" }) : h.type === "CUSTOM" && h.config?.nodes ? /* @__PURE__ */ e("span", { className: "text-xs text-blue-500 font-bold", children: "G" }) : /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "?" }) }),
|
|
828
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
829
|
+
/* @__PURE__ */ e(We, { strong: !0, className: "block truncate", children: h.name }),
|
|
830
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
831
|
+
/* @__PURE__ */ e(We, { type: "secondary", className: "text-xs", children: h.type }),
|
|
832
|
+
D && /* @__PURE__ */ e(le, { color: "blue", className: "text-xs", children: "绘制中" })
|
|
833
833
|
] })
|
|
834
834
|
] })
|
|
835
835
|
] })
|
|
836
836
|
},
|
|
837
|
-
|
|
837
|
+
h.id
|
|
838
838
|
);
|
|
839
839
|
};
|
|
840
|
-
return /* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ c("div", { className: "h-full flex flex-col bg-white border-r border-gray-200", children: [
|
|
841
|
+
/* @__PURE__ */ c("div", { className: "p-4 border-b border-gray-200", children: [
|
|
842
842
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "物料库" }),
|
|
843
|
-
/* @__PURE__ */ e(
|
|
843
|
+
/* @__PURE__ */ e(We, { type: "secondary", className: "text-sm", children: "拖拽物料到画布创建节点" })
|
|
844
844
|
] }),
|
|
845
845
|
/* @__PURE__ */ e("div", { className: "p-3 border-b border-gray-200", children: /* @__PURE__ */ e(
|
|
846
|
-
|
|
846
|
+
Yt,
|
|
847
847
|
{
|
|
848
848
|
accept: ".svg",
|
|
849
|
-
beforeUpload:
|
|
849
|
+
beforeUpload: b,
|
|
850
850
|
showUploadList: !1,
|
|
851
|
-
children: /* @__PURE__ */ e(
|
|
851
|
+
children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(Ct, {}), block: !0, type: "dashed", children: "上传 SVG" })
|
|
852
852
|
}
|
|
853
853
|
) }),
|
|
854
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2", children: /* @__PURE__ */
|
|
855
|
-
|
|
854
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2", children: /* @__PURE__ */ c(
|
|
855
|
+
he,
|
|
856
856
|
{
|
|
857
|
-
activeKey:
|
|
858
|
-
onChange: (
|
|
857
|
+
activeKey: g,
|
|
858
|
+
onChange: (h) => u(h),
|
|
859
859
|
ghost: !0,
|
|
860
860
|
expandIconPosition: "end",
|
|
861
861
|
children: [
|
|
862
|
-
/* @__PURE__ */ e(
|
|
863
|
-
|
|
862
|
+
/* @__PURE__ */ e(Ne, { header: "基础形状", children: /* @__PURE__ */ e(
|
|
863
|
+
xe,
|
|
864
864
|
{
|
|
865
865
|
dataSource: s.basic,
|
|
866
|
-
renderItem: (
|
|
866
|
+
renderItem: (h) => M(h, !1),
|
|
867
867
|
locale: {
|
|
868
868
|
emptyText: /* @__PURE__ */ e(
|
|
869
|
-
|
|
869
|
+
ne,
|
|
870
870
|
{
|
|
871
871
|
description: "暂无物料",
|
|
872
|
-
image:
|
|
872
|
+
image: ne.PRESENTED_IMAGE_SIMPLE
|
|
873
873
|
}
|
|
874
874
|
)
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
877
|
) }, "basic"),
|
|
878
|
-
/* @__PURE__ */ e(
|
|
879
|
-
|
|
878
|
+
/* @__PURE__ */ e(Ne, { header: "设备图标", children: /* @__PURE__ */ e(
|
|
879
|
+
xe,
|
|
880
880
|
{
|
|
881
881
|
dataSource: s.device,
|
|
882
|
-
renderItem: (
|
|
882
|
+
renderItem: (h) => M(h, !1),
|
|
883
883
|
locale: {
|
|
884
884
|
emptyText: /* @__PURE__ */ e(
|
|
885
|
-
|
|
885
|
+
ne,
|
|
886
886
|
{
|
|
887
887
|
description: "暂无物料",
|
|
888
|
-
image:
|
|
888
|
+
image: ne.PRESENTED_IMAGE_SIMPLE
|
|
889
889
|
}
|
|
890
890
|
)
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
) }, "device"),
|
|
894
|
-
/* @__PURE__ */ e(
|
|
895
|
-
|
|
894
|
+
/* @__PURE__ */ e(Ne, { header: "文本", children: /* @__PURE__ */ e(
|
|
895
|
+
xe,
|
|
896
896
|
{
|
|
897
897
|
dataSource: s.text,
|
|
898
|
-
renderItem: (
|
|
898
|
+
renderItem: (h) => M(h, !1),
|
|
899
899
|
locale: {
|
|
900
900
|
emptyText: /* @__PURE__ */ e(
|
|
901
|
-
|
|
901
|
+
ne,
|
|
902
902
|
{
|
|
903
903
|
description: "暂无物料",
|
|
904
|
-
image:
|
|
904
|
+
image: ne.PRESENTED_IMAGE_SIMPLE
|
|
905
905
|
}
|
|
906
906
|
)
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
909
|
) }, "text"),
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
|
|
910
|
+
/* @__PURE__ */ c(
|
|
911
|
+
Ne,
|
|
912
912
|
{
|
|
913
|
-
header: /* @__PURE__ */
|
|
913
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
914
914
|
/* @__PURE__ */ e("span", { children: "线条" }),
|
|
915
|
-
l === "line-draw" && /* @__PURE__ */ e(
|
|
915
|
+
l === "line-draw" && /* @__PURE__ */ e(le, { color: "blue", className: "text-xs", children: "绘制模式" })
|
|
916
916
|
] }),
|
|
917
917
|
children: [
|
|
918
918
|
/* @__PURE__ */ e(
|
|
919
|
-
|
|
919
|
+
xe,
|
|
920
920
|
{
|
|
921
921
|
dataSource: s.line,
|
|
922
|
-
renderItem: (
|
|
922
|
+
renderItem: (h) => M(h, !0),
|
|
923
923
|
locale: {
|
|
924
924
|
emptyText: /* @__PURE__ */ e(
|
|
925
|
-
|
|
925
|
+
ne,
|
|
926
926
|
{
|
|
927
927
|
description: "暂无物料",
|
|
928
|
-
image:
|
|
928
|
+
image: ne.PRESENTED_IMAGE_SIMPLE
|
|
929
929
|
}
|
|
930
930
|
)
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
),
|
|
934
|
-
l === "line-draw" && /* @__PURE__ */
|
|
934
|
+
l === "line-draw" && /* @__PURE__ */ c("div", { className: "mt-2 p-2 bg-blue-50 rounded text-xs text-blue-600", children: [
|
|
935
935
|
/* @__PURE__ */ e("div", { children: "点击线条物料开始绘制" }),
|
|
936
936
|
/* @__PURE__ */ e("div", { children: "点击画布确定起点和终点" })
|
|
937
937
|
] })
|
|
@@ -939,33 +939,33 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
939
939
|
},
|
|
940
940
|
"line"
|
|
941
941
|
),
|
|
942
|
-
s.group.length > 0 && /* @__PURE__ */ e(
|
|
943
|
-
|
|
942
|
+
s.group.length > 0 && /* @__PURE__ */ e(Ne, { header: "群组", children: /* @__PURE__ */ e(
|
|
943
|
+
xe,
|
|
944
944
|
{
|
|
945
945
|
dataSource: s.group,
|
|
946
|
-
renderItem: (
|
|
946
|
+
renderItem: (h) => M(h, !1),
|
|
947
947
|
locale: {
|
|
948
948
|
emptyText: /* @__PURE__ */ e(
|
|
949
|
-
|
|
949
|
+
ne,
|
|
950
950
|
{
|
|
951
951
|
description: "暂无物料",
|
|
952
|
-
image:
|
|
952
|
+
image: ne.PRESENTED_IMAGE_SIMPLE
|
|
953
953
|
}
|
|
954
954
|
)
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
957
|
) }, "group"),
|
|
958
|
-
s.custom.length > 0 && /* @__PURE__ */ e(
|
|
959
|
-
|
|
958
|
+
s.custom.length > 0 && /* @__PURE__ */ e(Ne, { header: "自定义", children: /* @__PURE__ */ e(
|
|
959
|
+
xe,
|
|
960
960
|
{
|
|
961
961
|
dataSource: s.custom,
|
|
962
|
-
renderItem: (
|
|
962
|
+
renderItem: (h) => M(h, !1),
|
|
963
963
|
locale: {
|
|
964
964
|
emptyText: /* @__PURE__ */ e(
|
|
965
|
-
|
|
965
|
+
ne,
|
|
966
966
|
{
|
|
967
967
|
description: "暂无物料",
|
|
968
|
-
image:
|
|
968
|
+
image: ne.PRESENTED_IMAGE_SIMPLE
|
|
969
969
|
}
|
|
970
970
|
)
|
|
971
971
|
}
|
|
@@ -974,58 +974,58 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
974
974
|
]
|
|
975
975
|
}
|
|
976
976
|
) }),
|
|
977
|
-
/* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ e(
|
|
977
|
+
/* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ e(We, { type: "secondary", className: "text-xs", children: l === "line-draw" ? /* @__PURE__ */ e(Se, { children: "💡 提示:点击绘制线段,可连续绘制多段线,双击结束绘制,ESC 取消" }) : /* @__PURE__ */ e(Se, { children: "💡 提示:拖拽物料到画布创建节点,点击线条物料进入绘制模式" }) }) })
|
|
978
978
|
] });
|
|
979
|
-
}, { Text:
|
|
979
|
+
}, { Text: gt } = wt, vn = (n, m) => {
|
|
980
980
|
try {
|
|
981
|
-
const t =
|
|
981
|
+
const t = m && Array.isArray(m) ? m.map((l, a) => l.paramsName) : ["A"], d = new Function(...t, n.expression)(...m.map((l) => l.value));
|
|
982
982
|
return console.log(
|
|
983
983
|
`Evaluating status [${n.name}] with data:`,
|
|
984
|
-
|
|
984
|
+
m,
|
|
985
985
|
"Result:",
|
|
986
|
-
|
|
987
|
-
),
|
|
986
|
+
d
|
|
987
|
+
), d === !0;
|
|
988
988
|
} catch (t) {
|
|
989
989
|
return console.warn(`状态表达式执行失败 [${n.name}]:`, t), !1;
|
|
990
990
|
}
|
|
991
|
-
},
|
|
991
|
+
}, bn = (n, m) => {
|
|
992
992
|
for (const t of n) {
|
|
993
993
|
console.log(t, "status");
|
|
994
994
|
let r = [];
|
|
995
|
-
if (Array.isArray(
|
|
996
|
-
(
|
|
997
|
-
)) : r =
|
|
995
|
+
if (Array.isArray(m) ? (console.log(t.bindCodes, "bindCodes"), r = m.filter(
|
|
996
|
+
(d) => t.bindCodes?.includes(d.paramsCode)
|
|
997
|
+
)) : r = m, vn(t, r))
|
|
998
998
|
return t;
|
|
999
999
|
}
|
|
1000
|
-
},
|
|
1001
|
-
if (!
|
|
1000
|
+
}, xn = (n, m) => {
|
|
1001
|
+
if (!m || !n)
|
|
1002
1002
|
return { value: void 0 };
|
|
1003
1003
|
if (Array.isArray(n)) {
|
|
1004
|
-
const t = n.find((r) => r.paramsCode ===
|
|
1004
|
+
const t = n.find((r) => r.paramsCode === m);
|
|
1005
1005
|
if (t)
|
|
1006
1006
|
return {
|
|
1007
1007
|
value: t.value,
|
|
1008
1008
|
unit: t.unit
|
|
1009
1009
|
};
|
|
1010
|
-
} else if (typeof n == "object" &&
|
|
1010
|
+
} else if (typeof n == "object" && m in n)
|
|
1011
1011
|
return {
|
|
1012
|
-
value: n[
|
|
1012
|
+
value: n[m],
|
|
1013
1013
|
unit: n.unit
|
|
1014
1014
|
};
|
|
1015
1015
|
return { value: void 0 };
|
|
1016
|
-
},
|
|
1016
|
+
}, wn = (n, m) => {
|
|
1017
1017
|
if (n == null) return "";
|
|
1018
|
-
if (
|
|
1018
|
+
if (m === -1) return String(n);
|
|
1019
1019
|
const t = Number(n);
|
|
1020
|
-
return isNaN(t) ? String(n) : t.toFixed(
|
|
1021
|
-
},
|
|
1020
|
+
return isNaN(t) ? String(n) : t.toFixed(m ?? 2);
|
|
1021
|
+
}, Sn = (n, m, t, r) => {
|
|
1022
1022
|
switch (n.type) {
|
|
1023
1023
|
case "IMAGE":
|
|
1024
|
-
const
|
|
1025
|
-
return /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center overflow-hidden", children:
|
|
1024
|
+
const d = n;
|
|
1025
|
+
return /* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center overflow-hidden", children: d.src ? /* @__PURE__ */ e(
|
|
1026
1026
|
"img",
|
|
1027
1027
|
{
|
|
1028
|
-
src:
|
|
1028
|
+
src: d.src,
|
|
1029
1029
|
alt: n.name,
|
|
1030
1030
|
style: {
|
|
1031
1031
|
width: "100%",
|
|
@@ -1038,34 +1038,34 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1038
1038
|
const l = n, {
|
|
1039
1039
|
label: a,
|
|
1040
1040
|
value: o,
|
|
1041
|
-
valueSourceCode:
|
|
1042
|
-
unit:
|
|
1041
|
+
valueSourceCode: f,
|
|
1042
|
+
unit: g,
|
|
1043
1043
|
decimals: u,
|
|
1044
|
-
labelStyle:
|
|
1044
|
+
labelStyle: b,
|
|
1045
1045
|
valueStyle: s,
|
|
1046
1046
|
customStyle: x
|
|
1047
|
-
} = l.content || {}, { value:
|
|
1048
|
-
return /* @__PURE__ */
|
|
1047
|
+
} = l.content || {}, { value: y, unit: M } = f ? xn(m, f) : { value: void 0, unit: void 0 }, A = wn(y !== void 0 ? y : o, u), O = g || M || "";
|
|
1048
|
+
return /* @__PURE__ */ c(
|
|
1049
1049
|
"div",
|
|
1050
1050
|
{
|
|
1051
1051
|
className: "w-full h-full flex flex-col justify-center gap-1",
|
|
1052
1052
|
style: { ...x },
|
|
1053
1053
|
children: [
|
|
1054
1054
|
a && /* @__PURE__ */ e(
|
|
1055
|
-
|
|
1055
|
+
gt,
|
|
1056
1056
|
{
|
|
1057
1057
|
style: {
|
|
1058
1058
|
fontSize: 14,
|
|
1059
1059
|
fontWeight: "bold",
|
|
1060
1060
|
color: "#262626",
|
|
1061
1061
|
textAlign: "left",
|
|
1062
|
-
...
|
|
1062
|
+
...b
|
|
1063
1063
|
},
|
|
1064
1064
|
children: a
|
|
1065
1065
|
}
|
|
1066
1066
|
),
|
|
1067
|
-
|
|
1068
|
-
|
|
1067
|
+
A != null && /* @__PURE__ */ c(
|
|
1068
|
+
gt,
|
|
1069
1069
|
{
|
|
1070
1070
|
style: {
|
|
1071
1071
|
fontSize: 14,
|
|
@@ -1074,8 +1074,8 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1074
1074
|
...s
|
|
1075
1075
|
},
|
|
1076
1076
|
children: [
|
|
1077
|
-
|
|
1078
|
-
|
|
1077
|
+
A,
|
|
1078
|
+
O ? ` ${O}` : ""
|
|
1079
1079
|
]
|
|
1080
1080
|
}
|
|
1081
1081
|
)
|
|
@@ -1084,36 +1084,36 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1084
1084
|
);
|
|
1085
1085
|
case "LINE":
|
|
1086
1086
|
const D = n, {
|
|
1087
|
-
thickness:
|
|
1088
|
-
color:
|
|
1089
|
-
dashed:
|
|
1090
|
-
lineType: H =
|
|
1091
|
-
lineWeight:
|
|
1087
|
+
thickness: L = 2,
|
|
1088
|
+
color: Y = "#d9d9d9",
|
|
1089
|
+
dashed: ie = !1,
|
|
1090
|
+
lineType: H = ie ? "dashed" : "solid",
|
|
1091
|
+
lineWeight: Q = L,
|
|
1092
1092
|
// 起点和终点的相对坐标
|
|
1093
|
-
startX:
|
|
1094
|
-
startY:
|
|
1095
|
-
endX:
|
|
1096
|
-
endY:
|
|
1097
|
-
} = D.config || {}, i = ((
|
|
1098
|
-
const
|
|
1099
|
-
switch (
|
|
1093
|
+
startX: F = 0,
|
|
1094
|
+
startY: P = 0,
|
|
1095
|
+
endX: T = 100,
|
|
1096
|
+
endY: B = 0
|
|
1097
|
+
} = D.config || {}, i = ((w) => {
|
|
1098
|
+
const E = Math.max(Q, 1);
|
|
1099
|
+
switch (w) {
|
|
1100
1100
|
case "solid":
|
|
1101
1101
|
return "";
|
|
1102
1102
|
case "dashed":
|
|
1103
|
-
return `${
|
|
1103
|
+
return `${E * 8},${E * 4}`;
|
|
1104
1104
|
case "center":
|
|
1105
|
-
return `${
|
|
1105
|
+
return `${E * 12},${E * 3},${E * 2},${E * 3}`;
|
|
1106
1106
|
case "phantom":
|
|
1107
|
-
return `${
|
|
1107
|
+
return `${E * 12},${E * 3},${E * 2},${E * 3},${E * 2},${E * 3}`;
|
|
1108
1108
|
case "dot":
|
|
1109
|
-
return `${
|
|
1109
|
+
return `${E},${E * 3}`;
|
|
1110
1110
|
case "dash-dot":
|
|
1111
|
-
return `${
|
|
1111
|
+
return `${E * 8},${E * 3},${E},${E * 3}`;
|
|
1112
1112
|
default:
|
|
1113
1113
|
return "";
|
|
1114
1114
|
}
|
|
1115
|
-
})(H),
|
|
1116
|
-
return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */
|
|
1115
|
+
})(H), k = t ? "#1890ff" : Y;
|
|
1116
|
+
return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */ c(
|
|
1117
1117
|
"svg",
|
|
1118
1118
|
{
|
|
1119
1119
|
className: "absolute top-0 left-0",
|
|
@@ -1124,31 +1124,31 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1124
1124
|
/* @__PURE__ */ e(
|
|
1125
1125
|
"line",
|
|
1126
1126
|
{
|
|
1127
|
-
x1:
|
|
1128
|
-
y1:
|
|
1129
|
-
x2:
|
|
1130
|
-
y2:
|
|
1127
|
+
x1: F,
|
|
1128
|
+
y1: P,
|
|
1129
|
+
x2: T,
|
|
1130
|
+
y2: B,
|
|
1131
1131
|
stroke: "transparent",
|
|
1132
|
-
strokeWidth: Math.max(
|
|
1132
|
+
strokeWidth: Math.max(Q, 10),
|
|
1133
1133
|
strokeLinecap: "round",
|
|
1134
1134
|
strokeLinejoin: "round",
|
|
1135
1135
|
style: { pointerEvents: "stroke", cursor: "pointer" },
|
|
1136
|
-
onClick: (
|
|
1137
|
-
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1136
|
+
onClick: (w) => {
|
|
1137
|
+
w.stopPropagation();
|
|
1138
|
+
const E = w.target.closest("[data-node-id]");
|
|
1139
|
+
E && E.click();
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
),
|
|
1143
1143
|
/* @__PURE__ */ e(
|
|
1144
1144
|
"line",
|
|
1145
1145
|
{
|
|
1146
|
-
x1:
|
|
1147
|
-
y1:
|
|
1148
|
-
x2:
|
|
1149
|
-
y2:
|
|
1150
|
-
stroke:
|
|
1151
|
-
strokeWidth:
|
|
1146
|
+
x1: F,
|
|
1147
|
+
y1: P,
|
|
1148
|
+
x2: T,
|
|
1149
|
+
y2: B,
|
|
1150
|
+
stroke: k,
|
|
1151
|
+
strokeWidth: Q,
|
|
1152
1152
|
strokeDasharray: i,
|
|
1153
1153
|
strokeLinecap: "round",
|
|
1154
1154
|
strokeLinejoin: "round",
|
|
@@ -1159,130 +1159,130 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1159
1159
|
}
|
|
1160
1160
|
) });
|
|
1161
1161
|
case "CUSTOM":
|
|
1162
|
-
const
|
|
1163
|
-
return
|
|
1162
|
+
const S = n;
|
|
1163
|
+
return S.render ? S.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: "自定义组件" }) });
|
|
1164
1164
|
default:
|
|
1165
1165
|
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: "未知类型" }) });
|
|
1166
1166
|
}
|
|
1167
|
-
},
|
|
1167
|
+
}, Cn = ({
|
|
1168
1168
|
node: n,
|
|
1169
|
-
isSelected:
|
|
1169
|
+
isSelected: m = !1,
|
|
1170
1170
|
onClick: t,
|
|
1171
1171
|
onMouseDown: r,
|
|
1172
|
-
data:
|
|
1172
|
+
data: d,
|
|
1173
1173
|
onUpdateNode: l,
|
|
1174
1174
|
scale: a = 1
|
|
1175
1175
|
}) => {
|
|
1176
|
-
const { normalStyle: o, contentInfo:
|
|
1176
|
+
const { normalStyle: o, contentInfo: f, controlInfo: g } = n, { statusList: u } = f, { isClickable: b, isDraggable: s } = g, [x, y] = G(null), [M, h] = G({ x: 0, y: 0 }), A = ue(null), O = xt(() => {
|
|
1177
1177
|
if (u.length === 0) return;
|
|
1178
|
-
const i =
|
|
1178
|
+
const i = bn(u, d);
|
|
1179
1179
|
return i || u[0];
|
|
1180
|
-
}, [u,
|
|
1181
|
-
i.stopPropagation(), i.preventDefault(),
|
|
1180
|
+
}, [u, d]), D = O?.material, L = D?.type === "LINE", Y = L ? D.config : null, ie = o.scale ?? 1, H = (o.width || 100) * ie, Q = (o.height || 100) * ie, F = q((i, k) => {
|
|
1181
|
+
i.stopPropagation(), i.preventDefault(), y(k), h({ x: i.clientX, y: i.clientY });
|
|
1182
1182
|
}, []);
|
|
1183
|
-
|
|
1184
|
-
if (!x || !
|
|
1185
|
-
const i = (
|
|
1186
|
-
const
|
|
1187
|
-
let Z =
|
|
1188
|
-
x === "start" ? (Z =
|
|
1189
|
-
const
|
|
1183
|
+
se(() => {
|
|
1184
|
+
if (!x || !L || !Y || !l) return;
|
|
1185
|
+
const i = (S) => {
|
|
1186
|
+
const w = (S.clientX - M.x) / a, E = (S.clientY - M.y) / a, Xe = Y.startX || 0, Ce = Y.startY || 0, ze = Y.endX || 0, Re = Y.endY || 0;
|
|
1187
|
+
let Z = Xe, ee = Ce, te = ze, oe = Re, ke = o.x || 0, Me = o.y || 0;
|
|
1188
|
+
x === "start" ? (Z = Xe + w, ee = Ce + E, Z < 0 && (ke += Z, te -= Z, Z = 0), ee < 0 && (Me += ee, oe -= ee, ee = 0)) : (te = ze + w, oe = Re + E, te < 0 && (ke += te, Z -= te, te = 0), oe < 0 && (Me += oe, ee -= oe, oe = 0));
|
|
1189
|
+
const Ae = Math.max((Y.lineWeight || 2) * 2, 4), qe = Math.max(Z, te), Be = Math.max(ee, oe), Ve = Math.max(qe, Ae), He = Math.max(Be, Ae);
|
|
1190
1190
|
l(n.id, {
|
|
1191
1191
|
normalStyle: {
|
|
1192
1192
|
...o,
|
|
1193
|
-
x:
|
|
1194
|
-
y:
|
|
1195
|
-
width:
|
|
1196
|
-
height:
|
|
1193
|
+
x: ke,
|
|
1194
|
+
y: Me,
|
|
1195
|
+
width: Ve,
|
|
1196
|
+
height: He
|
|
1197
1197
|
},
|
|
1198
1198
|
contentInfo: {
|
|
1199
|
-
...
|
|
1200
|
-
statusList: u.map((
|
|
1201
|
-
...
|
|
1202
|
-
material:
|
|
1203
|
-
...
|
|
1199
|
+
...f,
|
|
1200
|
+
statusList: u.map((ve) => ({
|
|
1201
|
+
...ve,
|
|
1202
|
+
material: ve.material.type === "LINE" ? {
|
|
1203
|
+
...ve.material,
|
|
1204
1204
|
config: {
|
|
1205
|
-
...
|
|
1205
|
+
...Y,
|
|
1206
1206
|
startX: Z,
|
|
1207
|
-
startY:
|
|
1208
|
-
endX:
|
|
1209
|
-
endY:
|
|
1207
|
+
startY: ee,
|
|
1208
|
+
endX: te,
|
|
1209
|
+
endY: oe
|
|
1210
1210
|
}
|
|
1211
|
-
} :
|
|
1211
|
+
} : ve.material
|
|
1212
1212
|
}))
|
|
1213
1213
|
}
|
|
1214
|
-
}),
|
|
1215
|
-
},
|
|
1216
|
-
|
|
1214
|
+
}), h({ x: S.clientX, y: S.clientY });
|
|
1215
|
+
}, k = () => {
|
|
1216
|
+
y(null);
|
|
1217
1217
|
};
|
|
1218
|
-
return window.addEventListener("mousemove", i), window.addEventListener("mouseup",
|
|
1219
|
-
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup",
|
|
1218
|
+
return window.addEventListener("mousemove", i), window.addEventListener("mouseup", k), () => {
|
|
1219
|
+
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", k);
|
|
1220
1220
|
};
|
|
1221
|
-
}, [x,
|
|
1222
|
-
const
|
|
1221
|
+
}, [x, M, L, Y, n.id, o, f, u, l, a]);
|
|
1222
|
+
const P = n.type === "group", T = {
|
|
1223
1223
|
position: "absolute",
|
|
1224
1224
|
left: o.x || 0,
|
|
1225
1225
|
top: o.y || 0,
|
|
1226
1226
|
width: H,
|
|
1227
|
-
height:
|
|
1227
|
+
height: Q,
|
|
1228
1228
|
// 群组节点不显示背景和边框,只作为容器
|
|
1229
|
-
background:
|
|
1230
|
-
backgroundImage:
|
|
1229
|
+
background: P ? "transparent" : o.background || "transparent",
|
|
1230
|
+
backgroundImage: P ? void 0 : o.backgroundImage ? `url(${o.backgroundImage})` : void 0,
|
|
1231
1231
|
backgroundSize: "cover",
|
|
1232
1232
|
backgroundPosition: "center",
|
|
1233
1233
|
padding: Array.isArray(o.padding) ? o.padding.join("px ") + "px" : o.padding,
|
|
1234
1234
|
margin: Array.isArray(o.margin) ? o.margin.join("px ") + "px" : o.margin,
|
|
1235
|
-
borderRadius:
|
|
1235
|
+
borderRadius: P ? void 0 : o.borderRadius,
|
|
1236
1236
|
// 线条物料选中时不显示边框,而是通过高亮线条颜色来表示
|
|
1237
1237
|
// 群组节点选中时显示边框,平时不显示
|
|
1238
|
-
border:
|
|
1238
|
+
border: m && !L ? "2px solid #1890ff" : L || P ? "none" : o.border || "1px dashed transparent",
|
|
1239
1239
|
// 线条节点需要捕获点击事件,但由内部 SVG 的透明线处理具体点击区域
|
|
1240
1240
|
pointerEvents: "auto",
|
|
1241
1241
|
opacity: o.opacity ?? 1,
|
|
1242
1242
|
transform: o.transform,
|
|
1243
|
-
zIndex:
|
|
1244
|
-
cursor: s && !x ? "move" :
|
|
1243
|
+
zIndex: m ? 1e3 : o.zIndex ?? 1,
|
|
1244
|
+
cursor: s && !x ? "move" : b ? "pointer" : "default",
|
|
1245
1245
|
boxSizing: "border-box",
|
|
1246
1246
|
// 线条和群组节点使用 visible overflow,避免裁剪子节点
|
|
1247
|
-
overflow:
|
|
1248
|
-
},
|
|
1249
|
-
return /* @__PURE__ */
|
|
1247
|
+
overflow: L || P ? "visible" : "hidden"
|
|
1248
|
+
}, B = Y ? { x: Y.startX || 0, y: Y.startY || 0 } : { x: 0, y: 0 }, R = Y ? { x: Y.endX || 0, y: Y.endY || 0 } : { x: 0, y: 0 };
|
|
1249
|
+
return /* @__PURE__ */ c(
|
|
1250
1250
|
"div",
|
|
1251
1251
|
{
|
|
1252
|
-
ref:
|
|
1252
|
+
ref: A,
|
|
1253
1253
|
"data-node-id": n.id,
|
|
1254
|
-
style:
|
|
1254
|
+
style: T,
|
|
1255
1255
|
onClick: (i) => {
|
|
1256
|
-
i.stopPropagation(),
|
|
1256
|
+
i.stopPropagation(), b && t && !x && t(i);
|
|
1257
1257
|
},
|
|
1258
1258
|
onMouseDown: (i) => {
|
|
1259
1259
|
s && r && !x && r(i);
|
|
1260
1260
|
},
|
|
1261
1261
|
children: [
|
|
1262
|
-
|
|
1263
|
-
!
|
|
1262
|
+
m && !L && /* @__PURE__ */ c(Se, { children: [
|
|
1263
|
+
!P && /* @__PURE__ */ c(Se, { children: [
|
|
1264
1264
|
/* @__PURE__ */ e("div", { className: "absolute -top-1 -left-1 w-2 h-2 bg-white border border-blue-500 rounded-full" }),
|
|
1265
1265
|
/* @__PURE__ */ e("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-white border border-blue-500 rounded-full" }),
|
|
1266
1266
|
/* @__PURE__ */ e("div", { className: "absolute -bottom-1 -left-1 w-2 h-2 bg-white border border-blue-500 rounded-full" }),
|
|
1267
1267
|
/* @__PURE__ */ e("div", { className: "absolute -bottom-1 -right-1 w-2 h-2 bg-white border border-blue-500 rounded-full" })
|
|
1268
1268
|
] }),
|
|
1269
|
-
/* @__PURE__ */
|
|
1269
|
+
/* @__PURE__ */ c("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: [
|
|
1270
1270
|
n.name,
|
|
1271
1271
|
" ",
|
|
1272
|
-
|
|
1272
|
+
O ? `(${O.name})` : ""
|
|
1273
1273
|
] })
|
|
1274
1274
|
] }),
|
|
1275
|
-
|
|
1275
|
+
m && L && Y && l && /* @__PURE__ */ c(Se, { children: [
|
|
1276
1276
|
/* @__PURE__ */ e(
|
|
1277
1277
|
"div",
|
|
1278
1278
|
{
|
|
1279
1279
|
className: "absolute w-3 h-3 bg-blue-500 border-2 border-white rounded-full cursor-move z-50",
|
|
1280
1280
|
style: {
|
|
1281
|
-
left:
|
|
1282
|
-
top:
|
|
1281
|
+
left: B.x - 6,
|
|
1282
|
+
top: B.y - 6,
|
|
1283
1283
|
boxShadow: "0 0 4px rgba(0,0,0,0.3)"
|
|
1284
1284
|
},
|
|
1285
|
-
onMouseDown: (i) =>
|
|
1285
|
+
onMouseDown: (i) => F(i, "start"),
|
|
1286
1286
|
title: "拖拽调整起点"
|
|
1287
1287
|
}
|
|
1288
1288
|
),
|
|
@@ -1291,26 +1291,26 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1291
1291
|
{
|
|
1292
1292
|
className: "absolute w-3 h-3 bg-blue-500 border-2 border-white rounded-full cursor-move z-50",
|
|
1293
1293
|
style: {
|
|
1294
|
-
left:
|
|
1295
|
-
top:
|
|
1294
|
+
left: R.x - 6,
|
|
1295
|
+
top: R.y - 6,
|
|
1296
1296
|
boxShadow: "0 0 4px rgba(0,0,0,0.3)"
|
|
1297
1297
|
},
|
|
1298
|
-
onMouseDown: (i) =>
|
|
1298
|
+
onMouseDown: (i) => F(i, "end"),
|
|
1299
1299
|
title: "拖拽调整终点"
|
|
1300
1300
|
}
|
|
1301
1301
|
),
|
|
1302
1302
|
/* @__PURE__ */ e("div", { className: "absolute -top-6 left-0 bg-blue-500 text-white text-xs px-2 py-0.5 rounded whitespace-nowrap", children: n.name })
|
|
1303
1303
|
] }),
|
|
1304
|
-
/* @__PURE__ */ e("div", { className: "w-full h-full relative", children: D ? /* @__PURE__ */ e("div", { className: "w-full h-full", children:
|
|
1304
|
+
/* @__PURE__ */ e("div", { className: "w-full h-full relative", children: D ? /* @__PURE__ */ e("div", { className: "w-full h-full", children: Sn(D, d, m) }) : P ? null : (
|
|
1305
1305
|
// 只有非群组节点才显示"无状态"
|
|
1306
1306
|
/* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center text-gray-300 text-xs", children: "无状态" })
|
|
1307
1307
|
) }),
|
|
1308
1308
|
n.type === "group" && n.children && /* @__PURE__ */ e("div", { className: "absolute inset-0 pointer-events-none", children: n.children.map((i) => /* @__PURE__ */ e("div", { className: "pointer-events-auto", children: /* @__PURE__ */ e(
|
|
1309
|
-
|
|
1309
|
+
Lt,
|
|
1310
1310
|
{
|
|
1311
1311
|
node: i,
|
|
1312
1312
|
isSelected: !1,
|
|
1313
|
-
data:
|
|
1313
|
+
data: d,
|
|
1314
1314
|
onUpdateNode: l,
|
|
1315
1315
|
scale: a
|
|
1316
1316
|
}
|
|
@@ -1318,62 +1318,67 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1318
1318
|
]
|
|
1319
1319
|
}
|
|
1320
1320
|
);
|
|
1321
|
-
},
|
|
1322
|
-
const t = n.node, r =
|
|
1323
|
-
return
|
|
1324
|
-
}), { TextArea:
|
|
1325
|
-
const
|
|
1326
|
-
nodes:
|
|
1327
|
-
selectedNodeId:
|
|
1328
|
-
mode:
|
|
1329
|
-
lineDrawing:
|
|
1330
|
-
viewport:
|
|
1331
|
-
setViewport:
|
|
1332
|
-
addNode:
|
|
1333
|
-
selectNode:
|
|
1334
|
-
updateNode:
|
|
1335
|
-
removeNode:
|
|
1336
|
-
undo:
|
|
1337
|
-
redo:
|
|
1338
|
-
setMode:
|
|
1339
|
-
startLineDrawing:
|
|
1340
|
-
endLineDrawing:
|
|
1341
|
-
cancelLineDrawing:
|
|
1342
|
-
} =
|
|
1321
|
+
}, Lt = de.memo(Cn, (n, m) => {
|
|
1322
|
+
const t = n.node, r = m.node, d = t.id === r.id && t.normalStyle.x === r.normalStyle.x && t.normalStyle.y === r.normalStyle.y && t.normalStyle.width === r.normalStyle.width && t.normalStyle.height === r.normalStyle.height, l = n.isSelected === m.isSelected && n.scale === m.scale;
|
|
1323
|
+
return d && l;
|
|
1324
|
+
}), { TextArea: Nn } = J, In = ({ defaultTestData: n }) => {
|
|
1325
|
+
const m = ue(null), t = ue(null), r = ue(null), {
|
|
1326
|
+
nodes: d,
|
|
1327
|
+
selectedNodeId: l,
|
|
1328
|
+
mode: a,
|
|
1329
|
+
lineDrawing: o,
|
|
1330
|
+
viewport: f,
|
|
1331
|
+
setViewport: g,
|
|
1332
|
+
addNode: u,
|
|
1333
|
+
selectNode: b,
|
|
1334
|
+
updateNode: s,
|
|
1335
|
+
removeNode: x,
|
|
1336
|
+
undo: y,
|
|
1337
|
+
redo: M,
|
|
1338
|
+
setMode: h,
|
|
1339
|
+
startLineDrawing: A,
|
|
1340
|
+
endLineDrawing: O,
|
|
1341
|
+
cancelLineDrawing: D
|
|
1342
|
+
} = Ie(), [L, Y] = G(!1), [, ie] = G({}), H = ue(!1), Q = ue({ x: 0, y: 0 }), F = ue({ x: 0, y: 0, newX: 0, newY: 0 }), P = ue(null), [T, B] = G({ start: null, end: null, isDrawing: !1 }), [R, i] = G(!1), [k, S] = G({ start: null, end: null }), [w, E] = G([]), [Xe, Ce] = G(!1), [ze, Re] = G(
|
|
1343
1343
|
JSON.stringify(n, null, 2)
|
|
1344
|
-
),
|
|
1344
|
+
), Z = q((p, I) => {
|
|
1345
1345
|
if (!t.current) return { x: 0, y: 0 };
|
|
1346
|
-
const X = t.current.getBoundingClientRect(),
|
|
1347
|
-
return { x: Math.round(
|
|
1348
|
-
}, []),
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1346
|
+
const X = t.current.getBoundingClientRect(), C = m.current?.state, N = C?.scale ?? f.scale, _ = C?.positionX ?? f.positionX, U = C?.positionY ?? f.positionY, $ = p - X.left, W = I - X.top, K = ($ - _) / N, re = (W - U) / N;
|
|
1347
|
+
return { x: Math.round(K), y: Math.round(re) };
|
|
1348
|
+
}, [f.scale, f.positionX, f.positionY]), ee = q((p, I) => {
|
|
1349
|
+
const X = t.current;
|
|
1350
|
+
if (!X) return { x: 0, y: 0 };
|
|
1351
|
+
const C = X.getBoundingClientRect(), _ = m.current?.state?.scale ?? 1, U = p - C.left, $ = I - C.top, W = U / _, K = $ / _;
|
|
1352
|
+
return { x: Math.round(W), y: Math.round(K) };
|
|
1353
|
+
}, []), te = q(
|
|
1354
|
+
(p, I, X = !0) => {
|
|
1355
|
+
if (!o.material) return;
|
|
1356
|
+
const C = o.material, N = C.config || {}, _ = N.lineWeight || N.thickness || 2, U = Math.min(p.x, I.x), $ = Math.min(p.y, I.y), W = Math.round(p.x - U), K = Math.round(p.y - $), re = Math.round(I.x - U), fe = Math.round(I.y - $), be = Math.max(_ * 2, 4), pe = Math.max(Math.abs(p.x - I.x), be), je = Math.max(Math.abs(p.y - I.y), be), _t = {
|
|
1357
|
+
...C,
|
|
1358
|
+
id: z(),
|
|
1354
1359
|
config: {
|
|
1355
1360
|
color: N.color,
|
|
1356
|
-
lineWeight:
|
|
1357
|
-
thickness:
|
|
1361
|
+
lineWeight: _,
|
|
1362
|
+
thickness: _,
|
|
1358
1363
|
lineType: N.lineType,
|
|
1359
|
-
startX:
|
|
1360
|
-
startY:
|
|
1361
|
-
endX:
|
|
1362
|
-
endY:
|
|
1364
|
+
startX: W,
|
|
1365
|
+
startY: K,
|
|
1366
|
+
endX: re,
|
|
1367
|
+
endY: fe
|
|
1363
1368
|
}
|
|
1364
|
-
},
|
|
1365
|
-
id:
|
|
1366
|
-
name: `${
|
|
1369
|
+
}, Ot = {
|
|
1370
|
+
id: z(),
|
|
1371
|
+
name: `${C.name}_${Date.now()}`,
|
|
1367
1372
|
type: "normal",
|
|
1368
1373
|
normalStyle: {
|
|
1369
|
-
width:
|
|
1370
|
-
height:
|
|
1371
|
-
x:
|
|
1372
|
-
y:
|
|
1374
|
+
width: pe,
|
|
1375
|
+
height: je,
|
|
1376
|
+
x: U,
|
|
1377
|
+
y: $,
|
|
1373
1378
|
background: "transparent"
|
|
1374
1379
|
},
|
|
1375
1380
|
contentInfo: {
|
|
1376
|
-
statusList: [
|
|
1381
|
+
statusList: [Dt(_t)],
|
|
1377
1382
|
currentStatusId: void 0
|
|
1378
1383
|
},
|
|
1379
1384
|
controlInfo: {
|
|
@@ -1383,297 +1388,377 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1383
1388
|
isSelectable: !0
|
|
1384
1389
|
}
|
|
1385
1390
|
};
|
|
1386
|
-
if (
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
start:
|
|
1390
|
-
end: { ...
|
|
1391
|
+
if (u(Ot, !1), X) {
|
|
1392
|
+
const rt = { x: I.x, y: I.y };
|
|
1393
|
+
B({
|
|
1394
|
+
start: rt,
|
|
1395
|
+
end: { ...rt },
|
|
1391
1396
|
isDrawing: !0
|
|
1392
1397
|
});
|
|
1393
1398
|
} else
|
|
1394
|
-
|
|
1399
|
+
B({ start: null, end: null, isDrawing: !1 }), O();
|
|
1395
1400
|
},
|
|
1396
|
-
[
|
|
1397
|
-
),
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
-
scale:
|
|
1401
|
-
positionX:
|
|
1402
|
-
positionY:
|
|
1401
|
+
[o.material, u, O]
|
|
1402
|
+
), oe = q(() => {
|
|
1403
|
+
const p = m.current?.state;
|
|
1404
|
+
p && g({
|
|
1405
|
+
scale: p.scale,
|
|
1406
|
+
positionX: p.positionX,
|
|
1407
|
+
positionY: p.positionY
|
|
1403
1408
|
});
|
|
1404
|
-
}, [
|
|
1405
|
-
(
|
|
1406
|
-
|
|
1409
|
+
}, [g]), ke = q(
|
|
1410
|
+
(p) => {
|
|
1411
|
+
H.current || R || (p.target === t.current || p.target.dataset?.canvas === "true") && (b(null), E([]));
|
|
1407
1412
|
},
|
|
1408
|
-
[
|
|
1409
|
-
),
|
|
1410
|
-
(
|
|
1411
|
-
if (
|
|
1412
|
-
|
|
1413
|
-
|
|
1413
|
+
[b, R]
|
|
1414
|
+
), Me = q(
|
|
1415
|
+
(p) => {
|
|
1416
|
+
if (p.button === 0) {
|
|
1417
|
+
if (a === "line-draw" && o.material) {
|
|
1418
|
+
const I = Z(p.clientX, p.clientY);
|
|
1419
|
+
T.isDrawing ? T.start && te(T.start, I, !0) : B({ start: I, end: I, isDrawing: !0 });
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
if (R) {
|
|
1423
|
+
const I = ee(p.clientX, p.clientY);
|
|
1424
|
+
S({ start: I, end: I }), E([]), p.preventDefault(), p.stopPropagation();
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1414
1427
|
},
|
|
1415
|
-
[
|
|
1416
|
-
),
|
|
1417
|
-
(
|
|
1418
|
-
if (!(
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1428
|
+
[a, o.material, T.isDrawing, T.start, R, te, Z, ee]
|
|
1429
|
+
), Ae = q(
|
|
1430
|
+
(p) => {
|
|
1431
|
+
if (!(a !== "line-draw" || !o.material) && T.isDrawing && T.start) {
|
|
1432
|
+
const I = Z(p.clientX, p.clientY);
|
|
1433
|
+
te(T.start, I, !1);
|
|
1421
1434
|
}
|
|
1422
1435
|
},
|
|
1423
|
-
[
|
|
1424
|
-
),
|
|
1425
|
-
|
|
1426
|
-
}, []),
|
|
1427
|
-
|
|
1428
|
-
}, []),
|
|
1429
|
-
(
|
|
1430
|
-
if (
|
|
1436
|
+
[a, o.material, T.isDrawing, T.start, te, Z]
|
|
1437
|
+
), qe = q((p) => {
|
|
1438
|
+
p.preventDefault(), p.dataTransfer.dropEffect = "copy", Y(!0);
|
|
1439
|
+
}, []), Be = q((p) => {
|
|
1440
|
+
p.preventDefault(), Y(!1);
|
|
1441
|
+
}, []), Ve = q(
|
|
1442
|
+
(p) => {
|
|
1443
|
+
if (p.preventDefault(), Y(!1), !(!t.current || a !== "select"))
|
|
1431
1444
|
try {
|
|
1432
|
-
const
|
|
1433
|
-
if (!
|
|
1434
|
-
const X = JSON.parse(
|
|
1435
|
-
|
|
1436
|
-
} catch (
|
|
1437
|
-
console.error("Failed to parse dropped material:",
|
|
1445
|
+
const I = p.dataTransfer.getData("application/json");
|
|
1446
|
+
if (!I) return;
|
|
1447
|
+
const X = JSON.parse(I), C = t.current.getBoundingClientRect(), N = m.current?.state, _ = N?.scale ?? f.scale, U = N?.positionX ?? f.positionX, $ = N?.positionY ?? f.positionY, W = (p.clientX - C.left - U) / _ - 50, K = (p.clientY - C.top - $) / _ - 50, re = gn(W, K, X);
|
|
1448
|
+
u(re);
|
|
1449
|
+
} catch (I) {
|
|
1450
|
+
console.error("Failed to parse dropped material:", I);
|
|
1438
1451
|
}
|
|
1439
1452
|
},
|
|
1440
|
-
[
|
|
1441
|
-
),
|
|
1442
|
-
(
|
|
1443
|
-
|
|
1444
|
-
x:
|
|
1445
|
-
y:
|
|
1446
|
-
newX:
|
|
1447
|
-
newY:
|
|
1448
|
-
},
|
|
1453
|
+
[a, f, u]
|
|
1454
|
+
), He = q(
|
|
1455
|
+
(p, I) => {
|
|
1456
|
+
a !== "select" || !I.controlInfo.isDraggable || (p.stopPropagation(), b(I.id), H.current = !0, Q.current = { x: p.clientX, y: p.clientY }, F.current = {
|
|
1457
|
+
x: I.normalStyle.x || 0,
|
|
1458
|
+
y: I.normalStyle.y || 0,
|
|
1459
|
+
newX: I.normalStyle.x || 0,
|
|
1460
|
+
newY: I.normalStyle.y || 0
|
|
1461
|
+
}, P.current = I, p.preventDefault());
|
|
1449
1462
|
},
|
|
1450
|
-
[
|
|
1463
|
+
[a, b]
|
|
1451
1464
|
);
|
|
1452
|
-
|
|
1453
|
-
const
|
|
1454
|
-
if (
|
|
1465
|
+
se(() => {
|
|
1466
|
+
const p = (C) => {
|
|
1467
|
+
if (H.current && l && P.current) {
|
|
1455
1468
|
if (!t.current) return;
|
|
1456
|
-
const N = t.current.getBoundingClientRect(),
|
|
1457
|
-
`[data-node-id="${
|
|
1469
|
+
const N = t.current.getBoundingClientRect(), _ = 1920 / N.width, U = 1080 / N.height, $ = C.clientX - Q.current.x, W = C.clientY - Q.current.y, K = $ * _, re = W * U, fe = F.current.x + K, be = F.current.y + re, pe = document.querySelector(
|
|
1470
|
+
`[data-node-id="${l}"]`
|
|
1458
1471
|
);
|
|
1459
|
-
|
|
1472
|
+
pe && (pe.style.left = `${fe}px`, pe.style.top = `${be}px`), F.current.newX = fe, F.current.newY = be;
|
|
1460
1473
|
}
|
|
1461
|
-
if (R &&
|
|
1462
|
-
const N =
|
|
1463
|
-
|
|
1474
|
+
if (R && k.start) {
|
|
1475
|
+
const N = ee(C.clientX, C.clientY);
|
|
1476
|
+
S((_) => ({ ..._, end: N }));
|
|
1464
1477
|
}
|
|
1465
|
-
if (
|
|
1466
|
-
const N =
|
|
1467
|
-
|
|
1478
|
+
if (a === "line-draw" && T.isDrawing) {
|
|
1479
|
+
const N = Z(C.clientX, C.clientY);
|
|
1480
|
+
B((_) => ({ ..._, end: N }));
|
|
1468
1481
|
}
|
|
1469
|
-
},
|
|
1470
|
-
if (
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1482
|
+
}, I = () => {
|
|
1483
|
+
if (H.current && l && P.current) {
|
|
1484
|
+
const C = Ie.getState(), N = F.current.newX ?? F.current.x, _ = F.current.newY ?? F.current.y;
|
|
1485
|
+
C.updateNode(l, {
|
|
1473
1486
|
normalStyle: {
|
|
1474
|
-
...
|
|
1487
|
+
...P.current.normalStyle,
|
|
1475
1488
|
x: N,
|
|
1476
|
-
y:
|
|
1489
|
+
y: _
|
|
1477
1490
|
}
|
|
1478
1491
|
});
|
|
1479
1492
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1493
|
+
if (H.current = !1, P.current = null, ie({}), R && k.start && k.end) {
|
|
1494
|
+
const C = Math.min(k.start.x, k.end.x), N = Math.max(k.start.x, k.end.x), _ = Math.min(k.start.y, k.end.y), U = Math.max(k.start.y, k.end.y), $ = d.filter((W) => {
|
|
1495
|
+
const K = W.normalStyle.x || 0, re = W.normalStyle.y || 0, fe = W.normalStyle.width || 0, be = W.normalStyle.height || 0, pe = K + fe / 2, je = re + be / 2;
|
|
1496
|
+
return pe >= C && pe <= N && je >= _ && je <= U;
|
|
1497
|
+
}).map((W) => W.id);
|
|
1498
|
+
E($), S({ start: null, end: null });
|
|
1499
|
+
}
|
|
1500
|
+
}, X = (C) => {
|
|
1501
|
+
C.key === "Escape" && a === "line-draw" && (B({ start: null, end: null, isDrawing: !1 }), D()), C.key === "Delete" && (l ? x(l) : w.length > 0 && (w.forEach((N) => x(N)), E([]))), C.ctrlKey && C.key === "z" && (C.preventDefault(), y()), C.ctrlKey && C.key === "y" && (C.preventDefault(), M());
|
|
1483
1502
|
};
|
|
1484
|
-
return window.addEventListener("mousemove",
|
|
1485
|
-
window.removeEventListener("mousemove",
|
|
1503
|
+
return window.addEventListener("mousemove", p), window.addEventListener("mouseup", I), window.addEventListener("keydown", X), () => {
|
|
1504
|
+
window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", I), window.removeEventListener("keydown", X);
|
|
1486
1505
|
};
|
|
1487
1506
|
}, [
|
|
1488
|
-
c,
|
|
1489
|
-
R,
|
|
1490
|
-
i.start,
|
|
1491
1507
|
l,
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1508
|
+
R,
|
|
1509
|
+
k,
|
|
1510
|
+
a,
|
|
1511
|
+
T.isDrawing,
|
|
1512
|
+
w,
|
|
1513
|
+
d,
|
|
1495
1514
|
x,
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1515
|
+
y,
|
|
1516
|
+
M,
|
|
1517
|
+
D,
|
|
1518
|
+
Z,
|
|
1519
|
+
ee,
|
|
1520
|
+
E
|
|
1499
1521
|
]);
|
|
1500
|
-
const ve =
|
|
1501
|
-
(
|
|
1502
|
-
|
|
1503
|
-
|
|
1522
|
+
const ve = q(() => {
|
|
1523
|
+
if (w.length < 2) return;
|
|
1524
|
+
const p = w.map(($) => d.find((W) => W.id === $)).filter(($) => !!$ && $.type !== "group");
|
|
1525
|
+
if (p.length < 2) return;
|
|
1526
|
+
let I = 1 / 0, X = 1 / 0, C = -1 / 0, N = -1 / 0;
|
|
1527
|
+
p.forEach(($) => {
|
|
1528
|
+
const W = $.normalStyle.x || 0, K = $.normalStyle.y || 0, re = $.normalStyle.width || 0, fe = $.normalStyle.height || 0;
|
|
1529
|
+
I = Math.min(I, W), X = Math.min(X, K), C = Math.max(C, W + re), N = Math.max(N, K + fe);
|
|
1530
|
+
});
|
|
1531
|
+
const _ = p.map(($) => ({
|
|
1532
|
+
...$,
|
|
1533
|
+
normalStyle: {
|
|
1534
|
+
...$.normalStyle,
|
|
1535
|
+
x: ($.normalStyle.x || 0) - I,
|
|
1536
|
+
y: ($.normalStyle.y || 0) - X
|
|
1537
|
+
}
|
|
1538
|
+
})), U = {
|
|
1539
|
+
id: z(),
|
|
1540
|
+
name: `群组_${Date.now()}`,
|
|
1541
|
+
type: "group",
|
|
1542
|
+
normalStyle: {
|
|
1543
|
+
x: I,
|
|
1544
|
+
y: X,
|
|
1545
|
+
width: C - I,
|
|
1546
|
+
height: N - X,
|
|
1547
|
+
background: "transparent"
|
|
1548
|
+
},
|
|
1549
|
+
contentInfo: {
|
|
1550
|
+
statusList: [],
|
|
1551
|
+
currentStatusId: void 0
|
|
1552
|
+
},
|
|
1553
|
+
controlInfo: {
|
|
1554
|
+
isDraggable: !0,
|
|
1555
|
+
isClickable: !0,
|
|
1556
|
+
isResizable: !0,
|
|
1557
|
+
isSelectable: !0
|
|
1558
|
+
},
|
|
1559
|
+
children: _
|
|
1560
|
+
};
|
|
1561
|
+
w.forEach(($) => x($)), u(U), E([]), b(U.id);
|
|
1562
|
+
}, [w, d, x, u, b]), Ee = q(
|
|
1563
|
+
(p) => {
|
|
1564
|
+
if (w.length < 2) return;
|
|
1565
|
+
const I = Ie.getState(), X = w.map((N) => d.find((_) => _.id === N)).filter((N) => !!N && N.type !== "group");
|
|
1504
1566
|
if (X.length < 2) return;
|
|
1505
|
-
let
|
|
1506
|
-
switch (
|
|
1567
|
+
let C = 0;
|
|
1568
|
+
switch (p) {
|
|
1507
1569
|
case "left":
|
|
1508
|
-
|
|
1570
|
+
C = Math.min(...X.map((N) => N.normalStyle.x || 0));
|
|
1509
1571
|
break;
|
|
1510
1572
|
case "right":
|
|
1511
|
-
|
|
1573
|
+
C = Math.max(
|
|
1512
1574
|
...X.map((N) => (N.normalStyle.x || 0) + (N.normalStyle.width || 0))
|
|
1513
1575
|
);
|
|
1514
1576
|
break;
|
|
1515
1577
|
case "top":
|
|
1516
|
-
|
|
1578
|
+
C = Math.min(...X.map((N) => N.normalStyle.y || 0));
|
|
1517
1579
|
break;
|
|
1518
1580
|
case "bottom":
|
|
1519
|
-
|
|
1581
|
+
C = Math.max(
|
|
1520
1582
|
...X.map((N) => (N.normalStyle.y || 0) + (N.normalStyle.height || 0))
|
|
1521
1583
|
);
|
|
1522
1584
|
break;
|
|
1523
1585
|
}
|
|
1524
1586
|
X.forEach((N) => {
|
|
1525
|
-
let
|
|
1526
|
-
switch (
|
|
1587
|
+
let _ = N.normalStyle.x || 0, U = N.normalStyle.y || 0;
|
|
1588
|
+
switch (p) {
|
|
1527
1589
|
case "left":
|
|
1528
|
-
|
|
1590
|
+
_ = C;
|
|
1529
1591
|
break;
|
|
1530
1592
|
case "right":
|
|
1531
|
-
|
|
1593
|
+
_ = C - (N.normalStyle.width || 0);
|
|
1532
1594
|
break;
|
|
1533
1595
|
case "top":
|
|
1534
|
-
|
|
1596
|
+
U = C;
|
|
1535
1597
|
break;
|
|
1536
1598
|
case "bottom":
|
|
1537
|
-
|
|
1599
|
+
U = C - (N.normalStyle.height || 0);
|
|
1538
1600
|
break;
|
|
1539
1601
|
}
|
|
1540
|
-
|
|
1541
|
-
normalStyle: { ...N.normalStyle, x:
|
|
1602
|
+
I.updateNode(N.id, {
|
|
1603
|
+
normalStyle: { ...N.normalStyle, x: _, y: U }
|
|
1542
1604
|
});
|
|
1543
1605
|
});
|
|
1544
1606
|
},
|
|
1545
|
-
[
|
|
1546
|
-
),
|
|
1607
|
+
[w, d]
|
|
1608
|
+
), Tt = [
|
|
1547
1609
|
{
|
|
1548
|
-
icon: /* @__PURE__ */ e(
|
|
1610
|
+
icon: /* @__PURE__ */ e(Vt, {}),
|
|
1549
1611
|
title: "选择模式",
|
|
1550
|
-
active:
|
|
1612
|
+
active: a === "select" && !R,
|
|
1551
1613
|
onClick: () => {
|
|
1552
|
-
|
|
1614
|
+
h("select"), i(!1);
|
|
1553
1615
|
}
|
|
1554
1616
|
},
|
|
1555
1617
|
{
|
|
1556
|
-
icon: /* @__PURE__ */ e(
|
|
1618
|
+
icon: /* @__PURE__ */ e(Ht, {}),
|
|
1557
1619
|
title: "拖拽模式",
|
|
1558
|
-
active:
|
|
1620
|
+
active: a === "drag",
|
|
1559
1621
|
onClick: () => {
|
|
1560
|
-
|
|
1622
|
+
h("drag"), i(!1);
|
|
1561
1623
|
}
|
|
1562
1624
|
},
|
|
1563
1625
|
{
|
|
1564
|
-
icon: /* @__PURE__ */ e(
|
|
1626
|
+
icon: /* @__PURE__ */ e(nt, {}),
|
|
1565
1627
|
title: "线条绘制",
|
|
1566
|
-
active:
|
|
1628
|
+
active: a === "line-draw",
|
|
1567
1629
|
onClick: () => {
|
|
1568
|
-
|
|
1630
|
+
h("line-draw"), i(!1);
|
|
1569
1631
|
}
|
|
1570
1632
|
},
|
|
1571
1633
|
{
|
|
1572
|
-
icon: /* @__PURE__ */ e(
|
|
1634
|
+
icon: /* @__PURE__ */ e(Zt, {}),
|
|
1573
1635
|
title: "预览模式",
|
|
1574
|
-
active:
|
|
1636
|
+
active: a === "preview",
|
|
1575
1637
|
onClick: () => {
|
|
1576
|
-
|
|
1638
|
+
h("preview"), i(!1);
|
|
1577
1639
|
}
|
|
1578
1640
|
}
|
|
1579
|
-
],
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1641
|
+
], $t = xt(
|
|
1642
|
+
() => [
|
|
1643
|
+
{ icon: /* @__PURE__ */ e(Rt, {}), title: "撤销 (Ctrl+Z)", onClick: y },
|
|
1644
|
+
{ icon: /* @__PURE__ */ e(At, {}), title: "重做 (Ctrl+Y)", onClick: M },
|
|
1645
|
+
{
|
|
1646
|
+
icon: /* @__PURE__ */ e(at, {}),
|
|
1647
|
+
title: "框选模式",
|
|
1648
|
+
active: R,
|
|
1649
|
+
onClick: () => {
|
|
1650
|
+
const p = !R;
|
|
1651
|
+
i(p), h("select"), p && E([]);
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
icon: /* @__PURE__ */ e(at, {}),
|
|
1656
|
+
title: "组合选中节点",
|
|
1657
|
+
disabled: w.length < 2,
|
|
1658
|
+
onClick: ve
|
|
1659
|
+
},
|
|
1660
|
+
{
|
|
1661
|
+
icon: /* @__PURE__ */ e(jt, {}),
|
|
1662
|
+
title: "左对齐",
|
|
1663
|
+
disabled: w.length < 2,
|
|
1664
|
+
onClick: () => Ee("left")
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
icon: /* @__PURE__ */ e(Ft, {}),
|
|
1668
|
+
title: "右对齐",
|
|
1669
|
+
disabled: w.length < 2,
|
|
1670
|
+
onClick: () => Ee("right")
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
icon: /* @__PURE__ */ e(Wt, {}),
|
|
1674
|
+
title: "上对齐",
|
|
1675
|
+
disabled: w.length < 2,
|
|
1676
|
+
onClick: () => Ee("top")
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
icon: /* @__PURE__ */ e(Ut, {}),
|
|
1680
|
+
title: "下对齐",
|
|
1681
|
+
disabled: w.length < 2,
|
|
1682
|
+
onClick: () => Ee("bottom")
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
icon: /* @__PURE__ */ e(Gt, {}),
|
|
1686
|
+
title: "数据模拟",
|
|
1687
|
+
type: "primary",
|
|
1688
|
+
onClick: () => Ce(!0)
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
icon: /* @__PURE__ */ e(Ge, {}),
|
|
1692
|
+
title: "删除选中 (Delete)",
|
|
1693
|
+
disabled: !l && w.length === 0,
|
|
1694
|
+
onClick: () => {
|
|
1695
|
+
l ? x(l) : w.length > 0 && (w.forEach((p) => x(p)), E([]));
|
|
1696
|
+
}
|
|
1626
1697
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1698
|
+
],
|
|
1699
|
+
[
|
|
1700
|
+
y,
|
|
1701
|
+
M,
|
|
1702
|
+
R,
|
|
1703
|
+
i,
|
|
1704
|
+
h,
|
|
1705
|
+
E,
|
|
1706
|
+
w,
|
|
1707
|
+
ve,
|
|
1708
|
+
Ee,
|
|
1709
|
+
Ce,
|
|
1710
|
+
l,
|
|
1711
|
+
x
|
|
1712
|
+
]
|
|
1713
|
+
);
|
|
1714
|
+
return /* @__PURE__ */ c("div", { className: "flex-1 flex flex-col h-full bg-gray-100", children: [
|
|
1715
|
+
/* @__PURE__ */ c("div", { className: "h-12 bg-white border-b border-gray-200 flex items-center justify-between px-4", children: [
|
|
1716
|
+
/* @__PURE__ */ e(ae, { children: Tt.map((p) => /* @__PURE__ */ e(we, { title: p.title, children: /* @__PURE__ */ e(
|
|
1717
|
+
j,
|
|
1633
1718
|
{
|
|
1634
|
-
type:
|
|
1635
|
-
icon:
|
|
1636
|
-
onClick:
|
|
1719
|
+
type: p.active ? "primary" : "default",
|
|
1720
|
+
icon: p.icon,
|
|
1721
|
+
onClick: p.onClick
|
|
1637
1722
|
}
|
|
1638
|
-
) },
|
|
1639
|
-
/* @__PURE__ */ e(
|
|
1640
|
-
|
|
1723
|
+
) }, p.title)) }),
|
|
1724
|
+
/* @__PURE__ */ e(ae, { children: $t.map((p) => /* @__PURE__ */ e(we, { title: p.title, children: /* @__PURE__ */ e(
|
|
1725
|
+
j,
|
|
1641
1726
|
{
|
|
1642
|
-
type:
|
|
1643
|
-
icon:
|
|
1644
|
-
onClick:
|
|
1645
|
-
disabled:
|
|
1727
|
+
type: p.active ? "primary" : p.type || "default",
|
|
1728
|
+
icon: p.icon,
|
|
1729
|
+
onClick: p.onClick,
|
|
1730
|
+
disabled: p.disabled
|
|
1646
1731
|
}
|
|
1647
|
-
) },
|
|
1732
|
+
) }, p.title)) })
|
|
1648
1733
|
] }),
|
|
1649
|
-
/* @__PURE__ */ e("div", { className: "flex-1 relative", children: /* @__PURE__ */ e(
|
|
1650
|
-
|
|
1734
|
+
/* @__PURE__ */ e("div", { ref: r, className: "flex-1 relative", children: /* @__PURE__ */ e(
|
|
1735
|
+
tn,
|
|
1651
1736
|
{
|
|
1652
|
-
ref:
|
|
1737
|
+
ref: m,
|
|
1653
1738
|
initialScale: 1,
|
|
1654
1739
|
initialPositionX: 0,
|
|
1655
1740
|
initialPositionY: 0,
|
|
1656
1741
|
minScale: 0.5,
|
|
1657
1742
|
maxScale: 5,
|
|
1658
|
-
onTransformed:
|
|
1743
|
+
onTransformed: oe,
|
|
1659
1744
|
limitToBounds: !1,
|
|
1660
1745
|
centerZoomedOut: !1,
|
|
1661
|
-
panning: { disabled:
|
|
1746
|
+
panning: { disabled: R, velocityDisabled: !0 },
|
|
1662
1747
|
wheel: { disabled: !1, step: 0.1 },
|
|
1663
1748
|
pinch: { disabled: !1 },
|
|
1664
1749
|
doubleClick: { disabled: !0 },
|
|
1665
|
-
children: ({ zoomIn:
|
|
1666
|
-
/* @__PURE__ */ e("div", { className: "absolute bottom-4 right-4 z-10 bg-white rounded-lg shadow-lg p-2", children: /* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */ e(
|
|
1668
|
-
/* @__PURE__ */ e(
|
|
1669
|
-
/* @__PURE__ */ e(
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
Math.round(
|
|
1750
|
+
children: ({ zoomIn: p, zoomOut: I, resetTransform: X }) => /* @__PURE__ */ c(Se, { children: [
|
|
1751
|
+
/* @__PURE__ */ e("div", { className: "absolute bottom-4 right-4 z-10 bg-white rounded-lg shadow-lg p-2", children: /* @__PURE__ */ c(ae, { direction: "vertical", children: [
|
|
1752
|
+
/* @__PURE__ */ e(we, { title: "放大", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(qt, {}), onClick: () => p() }) }),
|
|
1753
|
+
/* @__PURE__ */ e(we, { title: "缩小", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(Bt, {}), onClick: () => I() }) }),
|
|
1754
|
+
/* @__PURE__ */ e(we, { title: "重置视图", children: /* @__PURE__ */ e(j, { onClick: () => X(), children: "100%" }) }),
|
|
1755
|
+
/* @__PURE__ */ c("div", { className: "text-center text-xs text-gray-500", children: [
|
|
1756
|
+
Math.round(f.scale * 100),
|
|
1672
1757
|
"%"
|
|
1673
1758
|
] })
|
|
1674
1759
|
] }) }),
|
|
1675
1760
|
/* @__PURE__ */ e(
|
|
1676
|
-
|
|
1761
|
+
nn,
|
|
1677
1762
|
{
|
|
1678
1763
|
wrapperStyle: { width: "100%", height: "100%", position: "relative" },
|
|
1679
1764
|
contentStyle: {
|
|
@@ -1683,42 +1768,42 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1683
1768
|
alignItems: "center",
|
|
1684
1769
|
justifyContent: "center"
|
|
1685
1770
|
},
|
|
1686
|
-
children: /* @__PURE__ */
|
|
1771
|
+
children: /* @__PURE__ */ c(
|
|
1687
1772
|
"div",
|
|
1688
1773
|
{
|
|
1689
1774
|
ref: t,
|
|
1690
1775
|
"data-canvas": "true",
|
|
1691
|
-
className: `relative bg-white ${
|
|
1776
|
+
className: `relative bg-white ${L ? "ring-4 ring-blue-400 ring-opacity-50" : ""} ${a === "line-draw" ? "cursor-crosshair" : ""}`,
|
|
1692
1777
|
style: { width: 1920, height: 1080, flexShrink: 0 },
|
|
1693
|
-
onClick:
|
|
1694
|
-
onMouseDown:
|
|
1695
|
-
onDoubleClick:
|
|
1696
|
-
onDragOver:
|
|
1697
|
-
onDragLeave:
|
|
1698
|
-
onDrop:
|
|
1778
|
+
onClick: ke,
|
|
1779
|
+
onMouseDown: Me,
|
|
1780
|
+
onDoubleClick: Ae,
|
|
1781
|
+
onDragOver: qe,
|
|
1782
|
+
onDragLeave: Be,
|
|
1783
|
+
onDrop: Ve,
|
|
1699
1784
|
children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
1785
|
+
/* @__PURE__ */ c("svg", { className: "absolute top-0 left-0 pointer-events-none", width: "1920", height: "1080", children: [
|
|
1701
1786
|
/* @__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" }) }) }),
|
|
1702
1787
|
/* @__PURE__ */ e("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
|
|
1703
1788
|
] }),
|
|
1704
|
-
|
|
1705
|
-
|
|
1789
|
+
d.map((C) => /* @__PURE__ */ e(
|
|
1790
|
+
Lt,
|
|
1706
1791
|
{
|
|
1707
|
-
node:
|
|
1708
|
-
isSelected:
|
|
1792
|
+
node: C,
|
|
1793
|
+
isSelected: l === C.id || w.includes(C.id),
|
|
1709
1794
|
data: n,
|
|
1710
|
-
onClick: () =>
|
|
1711
|
-
onMouseDown: (N) =>
|
|
1795
|
+
onClick: () => b(C.id),
|
|
1796
|
+
onMouseDown: (N) => He(N, C)
|
|
1712
1797
|
},
|
|
1713
|
-
|
|
1798
|
+
C.id
|
|
1714
1799
|
)),
|
|
1715
|
-
|
|
1800
|
+
a === "line-draw" && T.isDrawing && T.start && T.end && /* @__PURE__ */ e("svg", { className: "absolute top-0 left-0 pointer-events-none", width: "1920", height: "1080", children: /* @__PURE__ */ e(
|
|
1716
1801
|
"line",
|
|
1717
1802
|
{
|
|
1718
|
-
x1:
|
|
1719
|
-
y1:
|
|
1720
|
-
x2:
|
|
1721
|
-
y2:
|
|
1803
|
+
x1: T.start.x,
|
|
1804
|
+
y1: T.start.y,
|
|
1805
|
+
x2: T.end.x,
|
|
1806
|
+
y2: T.end.y,
|
|
1722
1807
|
stroke: "#1890ff",
|
|
1723
1808
|
strokeWidth: "2",
|
|
1724
1809
|
strokeDasharray: "5,5",
|
|
@@ -1726,15 +1811,16 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1726
1811
|
strokeLinejoin: "round"
|
|
1727
1812
|
}
|
|
1728
1813
|
) }),
|
|
1729
|
-
R &&
|
|
1814
|
+
R && k.start && k.end && /* @__PURE__ */ e(
|
|
1730
1815
|
"div",
|
|
1731
1816
|
{
|
|
1732
1817
|
className: "absolute border-2 border-blue-500 bg-blue-500/10 pointer-events-none",
|
|
1733
1818
|
style: {
|
|
1734
|
-
left: Math.min(
|
|
1735
|
-
top: Math.min(
|
|
1736
|
-
width: Math.abs(
|
|
1737
|
-
height: Math.abs(
|
|
1819
|
+
left: Math.min(k.start.x, k.end.x),
|
|
1820
|
+
top: Math.min(k.start.y, k.end.y),
|
|
1821
|
+
width: Math.abs(k.end.x - k.start.x),
|
|
1822
|
+
height: Math.abs(k.end.y - k.start.y),
|
|
1823
|
+
zIndex: 9999
|
|
1738
1824
|
}
|
|
1739
1825
|
}
|
|
1740
1826
|
)
|
|
@@ -1747,17 +1833,17 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1747
1833
|
}
|
|
1748
1834
|
) }),
|
|
1749
1835
|
/* @__PURE__ */ e(
|
|
1750
|
-
|
|
1836
|
+
tt,
|
|
1751
1837
|
{
|
|
1752
1838
|
title: "数据模拟",
|
|
1753
|
-
open:
|
|
1754
|
-
onCancel: () =>
|
|
1839
|
+
open: Xe,
|
|
1840
|
+
onCancel: () => Ce(!1),
|
|
1755
1841
|
footer: null,
|
|
1756
|
-
children: /* @__PURE__ */ e(
|
|
1757
|
-
|
|
1842
|
+
children: /* @__PURE__ */ e(v, { layout: "vertical", children: /* @__PURE__ */ e(v.Item, { label: "测试数据 (JSON)", children: /* @__PURE__ */ e(
|
|
1843
|
+
Nn,
|
|
1758
1844
|
{
|
|
1759
1845
|
value: ze,
|
|
1760
|
-
onChange: (
|
|
1846
|
+
onChange: (p) => Re(p.target.value),
|
|
1761
1847
|
rows: 10,
|
|
1762
1848
|
placeholder: "输入 JSON 格式的测试数据"
|
|
1763
1849
|
}
|
|
@@ -1765,7 +1851,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1765
1851
|
}
|
|
1766
1852
|
)
|
|
1767
1853
|
] });
|
|
1768
|
-
},
|
|
1854
|
+
}, kn = [
|
|
1769
1855
|
"#1890ff",
|
|
1770
1856
|
"#52c41a",
|
|
1771
1857
|
"#faad14",
|
|
@@ -1782,28 +1868,28 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1782
1868
|
"#000000",
|
|
1783
1869
|
"#ff4d4f",
|
|
1784
1870
|
"#73d13d"
|
|
1785
|
-
],
|
|
1871
|
+
], et = ({
|
|
1786
1872
|
value: n = "#1890ff",
|
|
1787
|
-
onChange:
|
|
1873
|
+
onChange: m,
|
|
1788
1874
|
onChangeComplete: t
|
|
1789
1875
|
}) => {
|
|
1790
|
-
const [r,
|
|
1791
|
-
|
|
1876
|
+
const [r, d] = G(!1), [l, a] = G(n), o = ue(null);
|
|
1877
|
+
se(() => {
|
|
1792
1878
|
a(n);
|
|
1793
|
-
}, [n]),
|
|
1794
|
-
const
|
|
1795
|
-
o.current && !o.current.contains(u.target) && (
|
|
1879
|
+
}, [n]), se(() => {
|
|
1880
|
+
const g = (u) => {
|
|
1881
|
+
o.current && !o.current.contains(u.target) && (d(!1), t?.({ toHexString: () => l }));
|
|
1796
1882
|
};
|
|
1797
|
-
return r && document.addEventListener("mousedown",
|
|
1883
|
+
return r && document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
|
|
1798
1884
|
}, [r, t, l]);
|
|
1799
|
-
const
|
|
1800
|
-
a(
|
|
1885
|
+
const f = (g) => {
|
|
1886
|
+
a(g), m?.({ toHexString: () => g });
|
|
1801
1887
|
};
|
|
1802
|
-
return /* @__PURE__ */
|
|
1888
|
+
return /* @__PURE__ */ c("div", { ref: o, style: { position: "relative", display: "inline-block" }, children: [
|
|
1803
1889
|
/* @__PURE__ */ e(
|
|
1804
1890
|
"div",
|
|
1805
1891
|
{
|
|
1806
|
-
onClick: () =>
|
|
1892
|
+
onClick: () => d(!r),
|
|
1807
1893
|
style: {
|
|
1808
1894
|
width: 28,
|
|
1809
1895
|
height: 28,
|
|
@@ -1814,7 +1900,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1814
1900
|
}
|
|
1815
1901
|
}
|
|
1816
1902
|
),
|
|
1817
|
-
r && /* @__PURE__ */
|
|
1903
|
+
r && /* @__PURE__ */ c(
|
|
1818
1904
|
"div",
|
|
1819
1905
|
{
|
|
1820
1906
|
style: {
|
|
@@ -1829,29 +1915,29 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1829
1915
|
border: "1px solid #f0f0f0"
|
|
1830
1916
|
},
|
|
1831
1917
|
children: [
|
|
1832
|
-
/* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children:
|
|
1918
|
+
/* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 4 }, children: kn.map((g) => /* @__PURE__ */ e(
|
|
1833
1919
|
"div",
|
|
1834
1920
|
{
|
|
1835
1921
|
onClick: () => {
|
|
1836
|
-
|
|
1922
|
+
f(g), d(!1), t?.({ toHexString: () => g });
|
|
1837
1923
|
},
|
|
1838
1924
|
style: {
|
|
1839
1925
|
width: 20,
|
|
1840
1926
|
height: 20,
|
|
1841
|
-
backgroundColor:
|
|
1842
|
-
border: l ===
|
|
1927
|
+
backgroundColor: g,
|
|
1928
|
+
border: l === g ? "2px solid #1890ff" : "1px solid #d9d9d9",
|
|
1843
1929
|
borderRadius: 2,
|
|
1844
1930
|
cursor: "pointer"
|
|
1845
1931
|
}
|
|
1846
1932
|
},
|
|
1847
|
-
|
|
1933
|
+
g
|
|
1848
1934
|
)) }),
|
|
1849
1935
|
/* @__PURE__ */ e(
|
|
1850
1936
|
"input",
|
|
1851
1937
|
{
|
|
1852
1938
|
type: "color",
|
|
1853
1939
|
value: l,
|
|
1854
|
-
onChange: (
|
|
1940
|
+
onChange: (g) => f(g.target.value),
|
|
1855
1941
|
onBlur: () => t?.({ toHexString: () => l }),
|
|
1856
1942
|
style: {
|
|
1857
1943
|
width: "100%",
|
|
@@ -1866,13 +1952,13 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1866
1952
|
}
|
|
1867
1953
|
)
|
|
1868
1954
|
] });
|
|
1869
|
-
}, { Option:
|
|
1955
|
+
}, { Option: Ue } = me, Mn = ({
|
|
1870
1956
|
material: n,
|
|
1871
|
-
onSave:
|
|
1957
|
+
onSave: m,
|
|
1872
1958
|
bindCodes: t = [],
|
|
1873
1959
|
dataOptions: r = []
|
|
1874
1960
|
}) => {
|
|
1875
|
-
const l = n.content || {}, [a, o] =
|
|
1961
|
+
const l = n.content || {}, [a, o] = G({
|
|
1876
1962
|
label: l.label || "",
|
|
1877
1963
|
value: l.value || "",
|
|
1878
1964
|
valueSourceCode: l.valueSourceCode || "",
|
|
@@ -1885,7 +1971,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1885
1971
|
valueFontWeight: l.valueStyle?.fontWeight || "normal",
|
|
1886
1972
|
valueColor: l.valueStyle?.color || "#1890ff"
|
|
1887
1973
|
});
|
|
1888
|
-
|
|
1974
|
+
se(() => {
|
|
1889
1975
|
o({
|
|
1890
1976
|
label: l.label || "",
|
|
1891
1977
|
value: l.value || "",
|
|
@@ -1900,27 +1986,27 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1900
1986
|
valueColor: l.valueStyle?.color || "#1890ff"
|
|
1901
1987
|
});
|
|
1902
1988
|
}, [n.id]);
|
|
1903
|
-
const
|
|
1904
|
-
o((
|
|
1905
|
-
},
|
|
1906
|
-
const x = r.find((
|
|
1907
|
-
o((
|
|
1908
|
-
...
|
|
1989
|
+
const f = (s, x) => {
|
|
1990
|
+
o((y) => ({ ...y, [s]: x }));
|
|
1991
|
+
}, g = (s) => {
|
|
1992
|
+
const x = r.find((M) => M.paramsCode === s), y = x?.unit || "";
|
|
1993
|
+
o((M) => ({
|
|
1994
|
+
...M,
|
|
1909
1995
|
valueSourceCode: s,
|
|
1910
|
-
unit:
|
|
1996
|
+
unit: y,
|
|
1911
1997
|
value: String(x?.value || "")
|
|
1912
1998
|
})), setTimeout(() => {
|
|
1913
|
-
|
|
1999
|
+
m({
|
|
1914
2000
|
content: {
|
|
1915
2001
|
...l,
|
|
1916
2002
|
valueSourceCode: s,
|
|
1917
2003
|
value: String(x?.value || ""),
|
|
1918
|
-
unit:
|
|
2004
|
+
unit: y
|
|
1919
2005
|
}
|
|
1920
2006
|
});
|
|
1921
2007
|
}, 0);
|
|
1922
2008
|
}, u = () => {
|
|
1923
|
-
|
|
2009
|
+
m({
|
|
1924
2010
|
content: {
|
|
1925
2011
|
...l,
|
|
1926
2012
|
label: a.label,
|
|
@@ -1940,31 +2026,31 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1940
2026
|
}
|
|
1941
2027
|
}
|
|
1942
2028
|
});
|
|
1943
|
-
},
|
|
2029
|
+
}, b = r.filter(
|
|
1944
2030
|
(s) => t.includes(s.paramsCode)
|
|
1945
2031
|
);
|
|
1946
|
-
return /* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */ e(
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */ e(
|
|
1950
|
-
|
|
2032
|
+
return /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
2033
|
+
/* @__PURE__ */ e(ye, { style: { marginTop: 0 }, children: "文本内容" }),
|
|
2034
|
+
/* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2035
|
+
/* @__PURE__ */ e(v.Item, { label: "标签文本 (label)", children: /* @__PURE__ */ e(
|
|
2036
|
+
J,
|
|
1951
2037
|
{
|
|
1952
2038
|
value: a.label,
|
|
1953
|
-
onChange: (s) =>
|
|
2039
|
+
onChange: (s) => f("label", s.target.value),
|
|
1954
2040
|
onBlur: u,
|
|
1955
2041
|
placeholder: "输入标签文本"
|
|
1956
2042
|
}
|
|
1957
2043
|
) }),
|
|
1958
2044
|
/* @__PURE__ */ e(
|
|
1959
|
-
|
|
2045
|
+
v.Item,
|
|
1960
2046
|
{
|
|
1961
2047
|
label: "值来源",
|
|
1962
2048
|
help: "从绑定的数据中选择字段,优先级高于手动输入的值",
|
|
1963
2049
|
children: /* @__PURE__ */ e(
|
|
1964
|
-
|
|
2050
|
+
me,
|
|
1965
2051
|
{
|
|
1966
2052
|
value: a.valueSourceCode || void 0,
|
|
1967
|
-
onChange:
|
|
2053
|
+
onChange: g,
|
|
1968
2054
|
placeholder: "选择数据字段(可选)",
|
|
1969
2055
|
allowClear: !0,
|
|
1970
2056
|
style: { width: "100%" },
|
|
@@ -1972,21 +2058,21 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1972
2058
|
value: "paramsCode",
|
|
1973
2059
|
label: "paramsName"
|
|
1974
2060
|
},
|
|
1975
|
-
options:
|
|
2061
|
+
options: b
|
|
1976
2062
|
}
|
|
1977
2063
|
)
|
|
1978
2064
|
}
|
|
1979
2065
|
),
|
|
1980
2066
|
/* @__PURE__ */ e(
|
|
1981
|
-
|
|
2067
|
+
v.Item,
|
|
1982
2068
|
{
|
|
1983
2069
|
label: a.valueSourceCode ? "默认值(备用)" : "值文本",
|
|
1984
2070
|
help: a.valueSourceCode ? "已绑定数据源,实际值将来自数据字段,此处仅设置无数据时的备用显示" : "手动输入显示的值",
|
|
1985
2071
|
children: /* @__PURE__ */ e(
|
|
1986
|
-
|
|
2072
|
+
J,
|
|
1987
2073
|
{
|
|
1988
2074
|
value: a.value,
|
|
1989
|
-
onChange: (s) =>
|
|
2075
|
+
onChange: (s) => f("value", s.target.value),
|
|
1990
2076
|
onBlur: u,
|
|
1991
2077
|
placeholder: a.valueSourceCode ? "数据字段无值时显示此备用值" : "输入值文本",
|
|
1992
2078
|
disabled: !!a.valueSourceCode,
|
|
@@ -1995,26 +2081,26 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
1995
2081
|
)
|
|
1996
2082
|
}
|
|
1997
2083
|
),
|
|
1998
|
-
/* @__PURE__ */ e(
|
|
1999
|
-
|
|
2084
|
+
/* @__PURE__ */ e(v.Item, { label: "单位", help: "优先从绑定数据自动获取,也可手动输入", children: /* @__PURE__ */ e(
|
|
2085
|
+
J,
|
|
2000
2086
|
{
|
|
2001
2087
|
value: a.unit,
|
|
2002
|
-
onChange: (s) =>
|
|
2088
|
+
onChange: (s) => f("unit", s.target.value),
|
|
2003
2089
|
onBlur: u,
|
|
2004
2090
|
placeholder: "单位(如°C、%、MPa等)",
|
|
2005
|
-
suffix: a.valueSourceCode &&
|
|
2091
|
+
suffix: a.valueSourceCode && b.length > 0 ? /* @__PURE__ */ e(le, { color: "blue", style: { marginRight: -8 }, children: "自动" }) : null
|
|
2006
2092
|
}
|
|
2007
2093
|
) }),
|
|
2008
2094
|
/* @__PURE__ */ e(
|
|
2009
|
-
|
|
2095
|
+
v.Item,
|
|
2010
2096
|
{
|
|
2011
2097
|
label: "保留小数位",
|
|
2012
2098
|
help: "数值格式化时保留的小数位数,-1表示不格式化",
|
|
2013
2099
|
children: /* @__PURE__ */ e(
|
|
2014
|
-
|
|
2100
|
+
V,
|
|
2015
2101
|
{
|
|
2016
2102
|
value: a.decimals,
|
|
2017
|
-
onChange: (s) =>
|
|
2103
|
+
onChange: (s) => f("decimals", s ?? 2),
|
|
2018
2104
|
onBlur: u,
|
|
2019
2105
|
min: -1,
|
|
2020
2106
|
max: 10,
|
|
@@ -2024,44 +2110,44 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2024
2110
|
}
|
|
2025
2111
|
)
|
|
2026
2112
|
] }),
|
|
2027
|
-
/* @__PURE__ */ e(
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */ e(
|
|
2031
|
-
|
|
2113
|
+
/* @__PURE__ */ e(ye, { children: "标签样式" }),
|
|
2114
|
+
/* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2115
|
+
/* @__PURE__ */ c(ae, { children: [
|
|
2116
|
+
/* @__PURE__ */ e(v.Item, { label: "字体大小", children: /* @__PURE__ */ e(
|
|
2117
|
+
V,
|
|
2032
2118
|
{
|
|
2033
2119
|
value: a.labelFontSize,
|
|
2034
|
-
onChange: (s) =>
|
|
2120
|
+
onChange: (s) => f("labelFontSize", s || 14),
|
|
2035
2121
|
onBlur: u,
|
|
2036
2122
|
min: 8,
|
|
2037
2123
|
max: 72
|
|
2038
2124
|
}
|
|
2039
2125
|
) }),
|
|
2040
|
-
/* @__PURE__ */ e(
|
|
2041
|
-
|
|
2126
|
+
/* @__PURE__ */ e(v.Item, { label: "字体粗细", children: /* @__PURE__ */ c(
|
|
2127
|
+
me,
|
|
2042
2128
|
{
|
|
2043
2129
|
value: a.labelFontWeight,
|
|
2044
2130
|
onChange: (s) => {
|
|
2045
|
-
|
|
2131
|
+
f("labelFontWeight", s), setTimeout(u, 0);
|
|
2046
2132
|
},
|
|
2047
2133
|
style: { width: 100 },
|
|
2048
2134
|
children: [
|
|
2049
|
-
/* @__PURE__ */ e(
|
|
2050
|
-
/* @__PURE__ */ e(
|
|
2135
|
+
/* @__PURE__ */ e(Ue, { value: "normal", children: "正常" }),
|
|
2136
|
+
/* @__PURE__ */ e(Ue, { value: "bold", children: "粗体" })
|
|
2051
2137
|
]
|
|
2052
2138
|
}
|
|
2053
2139
|
) })
|
|
2054
2140
|
] }),
|
|
2055
|
-
/* @__PURE__ */ e(
|
|
2141
|
+
/* @__PURE__ */ e(v.Item, { label: "文字颜色", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2056
2142
|
/* @__PURE__ */ e(
|
|
2057
|
-
|
|
2143
|
+
et,
|
|
2058
2144
|
{
|
|
2059
2145
|
value: a.labelColor || "#262626",
|
|
2060
2146
|
onChange: (s) => {
|
|
2061
|
-
|
|
2147
|
+
f("labelColor", s.toHexString());
|
|
2062
2148
|
},
|
|
2063
2149
|
onChangeComplete: (s) => {
|
|
2064
|
-
|
|
2150
|
+
m({
|
|
2065
2151
|
content: {
|
|
2066
2152
|
...l,
|
|
2067
2153
|
label: a.label,
|
|
@@ -2085,10 +2171,10 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2085
2171
|
}
|
|
2086
2172
|
),
|
|
2087
2173
|
/* @__PURE__ */ e(
|
|
2088
|
-
|
|
2174
|
+
J,
|
|
2089
2175
|
{
|
|
2090
2176
|
value: a.labelColor,
|
|
2091
|
-
onChange: (s) =>
|
|
2177
|
+
onChange: (s) => f("labelColor", s.target.value),
|
|
2092
2178
|
onBlur: u,
|
|
2093
2179
|
placeholder: "#262626",
|
|
2094
2180
|
style: { width: 100 }
|
|
@@ -2096,44 +2182,44 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2096
2182
|
)
|
|
2097
2183
|
] }) })
|
|
2098
2184
|
] }),
|
|
2099
|
-
/* @__PURE__ */ e(
|
|
2100
|
-
/* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
/* @__PURE__ */ e(
|
|
2103
|
-
|
|
2185
|
+
/* @__PURE__ */ e(ye, { children: "值样式" }),
|
|
2186
|
+
/* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2187
|
+
/* @__PURE__ */ c(ae, { children: [
|
|
2188
|
+
/* @__PURE__ */ e(v.Item, { label: "字体大小", children: /* @__PURE__ */ e(
|
|
2189
|
+
V,
|
|
2104
2190
|
{
|
|
2105
2191
|
value: a.valueFontSize,
|
|
2106
|
-
onChange: (s) =>
|
|
2192
|
+
onChange: (s) => f("valueFontSize", s || 14),
|
|
2107
2193
|
onBlur: u,
|
|
2108
2194
|
min: 8,
|
|
2109
2195
|
max: 72
|
|
2110
2196
|
}
|
|
2111
2197
|
) }),
|
|
2112
|
-
/* @__PURE__ */ e(
|
|
2113
|
-
|
|
2198
|
+
/* @__PURE__ */ e(v.Item, { label: "字体粗细", children: /* @__PURE__ */ c(
|
|
2199
|
+
me,
|
|
2114
2200
|
{
|
|
2115
2201
|
value: a.valueFontWeight,
|
|
2116
2202
|
onChange: (s) => {
|
|
2117
|
-
|
|
2203
|
+
f("valueFontWeight", s), setTimeout(u, 0);
|
|
2118
2204
|
},
|
|
2119
2205
|
style: { width: 100 },
|
|
2120
2206
|
children: [
|
|
2121
|
-
/* @__PURE__ */ e(
|
|
2122
|
-
/* @__PURE__ */ e(
|
|
2207
|
+
/* @__PURE__ */ e(Ue, { value: "normal", children: "正常" }),
|
|
2208
|
+
/* @__PURE__ */ e(Ue, { value: "bold", children: "粗体" })
|
|
2123
2209
|
]
|
|
2124
2210
|
}
|
|
2125
2211
|
) })
|
|
2126
2212
|
] }),
|
|
2127
|
-
/* @__PURE__ */ e(
|
|
2213
|
+
/* @__PURE__ */ e(v.Item, { label: "文字颜色", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2128
2214
|
/* @__PURE__ */ e(
|
|
2129
|
-
|
|
2215
|
+
et,
|
|
2130
2216
|
{
|
|
2131
2217
|
value: a.valueColor || "#1890ff",
|
|
2132
2218
|
onChange: (s) => {
|
|
2133
|
-
|
|
2219
|
+
f("valueColor", s.toHexString());
|
|
2134
2220
|
},
|
|
2135
2221
|
onChangeComplete: (s) => {
|
|
2136
|
-
|
|
2222
|
+
m({
|
|
2137
2223
|
content: {
|
|
2138
2224
|
...l,
|
|
2139
2225
|
label: a.label,
|
|
@@ -2157,10 +2243,10 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2157
2243
|
}
|
|
2158
2244
|
),
|
|
2159
2245
|
/* @__PURE__ */ e(
|
|
2160
|
-
|
|
2246
|
+
J,
|
|
2161
2247
|
{
|
|
2162
2248
|
value: a.valueColor,
|
|
2163
|
-
onChange: (s) =>
|
|
2249
|
+
onChange: (s) => f("valueColor", s.target.value),
|
|
2164
2250
|
onBlur: u,
|
|
2165
2251
|
placeholder: "#1890ff",
|
|
2166
2252
|
style: { width: 100 }
|
|
@@ -2169,41 +2255,41 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2169
2255
|
] }) })
|
|
2170
2256
|
] })
|
|
2171
2257
|
] });
|
|
2172
|
-
},
|
|
2258
|
+
}, En = ({
|
|
2173
2259
|
material: n,
|
|
2174
|
-
onSave:
|
|
2260
|
+
onSave: m
|
|
2175
2261
|
}) => {
|
|
2176
|
-
const t = n, [r,
|
|
2262
|
+
const t = n, [r, d] = G({
|
|
2177
2263
|
name: n.name,
|
|
2178
2264
|
src: t.src || ""
|
|
2179
2265
|
});
|
|
2180
|
-
|
|
2181
|
-
|
|
2266
|
+
se(() => {
|
|
2267
|
+
d({
|
|
2182
2268
|
name: n.name,
|
|
2183
2269
|
src: t.src || ""
|
|
2184
2270
|
});
|
|
2185
2271
|
}, [n.id]);
|
|
2186
|
-
const l = (o,
|
|
2187
|
-
|
|
2272
|
+
const l = (o, f) => {
|
|
2273
|
+
d((g) => ({ ...g, [o]: f }));
|
|
2188
2274
|
}, a = () => {
|
|
2189
|
-
|
|
2275
|
+
m({
|
|
2190
2276
|
name: r.name,
|
|
2191
2277
|
src: r.src
|
|
2192
2278
|
});
|
|
2193
2279
|
};
|
|
2194
|
-
return /* @__PURE__ */
|
|
2195
|
-
/* @__PURE__ */ e(
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */ e(
|
|
2198
|
-
|
|
2280
|
+
return /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
2281
|
+
/* @__PURE__ */ e(ye, { style: { marginTop: 0 }, children: "图片属性" }),
|
|
2282
|
+
/* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2283
|
+
/* @__PURE__ */ e(v.Item, { label: "图片名称", children: /* @__PURE__ */ e(
|
|
2284
|
+
J,
|
|
2199
2285
|
{
|
|
2200
2286
|
value: r.name,
|
|
2201
2287
|
onChange: (o) => l("name", o.target.value),
|
|
2202
2288
|
onBlur: a
|
|
2203
2289
|
}
|
|
2204
2290
|
) }),
|
|
2205
|
-
/* @__PURE__ */ e(
|
|
2206
|
-
|
|
2291
|
+
/* @__PURE__ */ e(v.Item, { label: "图片地址 (src)", children: /* @__PURE__ */ e(
|
|
2292
|
+
J.TextArea,
|
|
2207
2293
|
{
|
|
2208
2294
|
value: r.src,
|
|
2209
2295
|
onChange: (o) => l("src", o.target.value),
|
|
@@ -2214,11 +2300,11 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2214
2300
|
) })
|
|
2215
2301
|
] })
|
|
2216
2302
|
] });
|
|
2217
|
-
}, { Option:
|
|
2303
|
+
}, { Option: Dn } = me, Ln = ({
|
|
2218
2304
|
material: n,
|
|
2219
|
-
onSave:
|
|
2305
|
+
onSave: m
|
|
2220
2306
|
}) => {
|
|
2221
|
-
const t = n.config || {}, [r,
|
|
2307
|
+
const t = n.config || {}, [r, d] = G({
|
|
2222
2308
|
lineWeight: t.lineWeight || t.thickness || 2,
|
|
2223
2309
|
color: t.color || "#262626",
|
|
2224
2310
|
lineType: t.lineType || "solid",
|
|
@@ -2227,8 +2313,8 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2227
2313
|
endX: t.endX ?? 100,
|
|
2228
2314
|
endY: t.endY ?? 0
|
|
2229
2315
|
});
|
|
2230
|
-
|
|
2231
|
-
|
|
2316
|
+
se(() => {
|
|
2317
|
+
d({
|
|
2232
2318
|
lineWeight: t.lineWeight || t.thickness || 2,
|
|
2233
2319
|
color: t.color || "#262626",
|
|
2234
2320
|
lineType: t.lineType || "solid",
|
|
@@ -2239,18 +2325,18 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2239
2325
|
});
|
|
2240
2326
|
}, [n.id]);
|
|
2241
2327
|
const l = (o) => {
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2328
|
+
const f = { ...r, ...o };
|
|
2329
|
+
d(f), m({
|
|
2244
2330
|
config: {
|
|
2245
2331
|
...t,
|
|
2246
|
-
thickness:
|
|
2247
|
-
lineWeight:
|
|
2248
|
-
color:
|
|
2249
|
-
lineType:
|
|
2250
|
-
startX:
|
|
2251
|
-
startY:
|
|
2252
|
-
endX:
|
|
2253
|
-
endY:
|
|
2332
|
+
thickness: f.lineWeight,
|
|
2333
|
+
lineWeight: f.lineWeight,
|
|
2334
|
+
color: f.color,
|
|
2335
|
+
lineType: f.lineType,
|
|
2336
|
+
startX: f.startX,
|
|
2337
|
+
startY: f.startY,
|
|
2338
|
+
endX: f.endX,
|
|
2339
|
+
endY: f.endY
|
|
2254
2340
|
}
|
|
2255
2341
|
});
|
|
2256
2342
|
}, a = [
|
|
@@ -2261,22 +2347,22 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2261
2347
|
{ value: "dot", label: "点线", desc: "密集点状" },
|
|
2262
2348
|
{ value: "dash-dot", label: "画点线", desc: "长划-点交替" }
|
|
2263
2349
|
];
|
|
2264
|
-
return /* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */ e(
|
|
2266
|
-
/* @__PURE__ */
|
|
2267
|
-
/* @__PURE__ */ e(
|
|
2268
|
-
|
|
2350
|
+
return /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
2351
|
+
/* @__PURE__ */ e(ye, { style: { marginTop: 0 }, children: "线条属性" }),
|
|
2352
|
+
/* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2353
|
+
/* @__PURE__ */ e(v.Item, { label: "线型", help: "选择线条样式", children: /* @__PURE__ */ e(
|
|
2354
|
+
me,
|
|
2269
2355
|
{
|
|
2270
2356
|
value: r.lineType,
|
|
2271
2357
|
onChange: (o) => l({ lineType: o }),
|
|
2272
|
-
children: a.map((o) => /* @__PURE__ */ e(
|
|
2358
|
+
children: a.map((o) => /* @__PURE__ */ e(Dn, { value: o.value, children: /* @__PURE__ */ c("div", { className: "flex flex-col", children: [
|
|
2273
2359
|
/* @__PURE__ */ e("span", { children: o.label }),
|
|
2274
2360
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400", children: o.desc })
|
|
2275
2361
|
] }) }, o.value))
|
|
2276
2362
|
}
|
|
2277
2363
|
) }),
|
|
2278
|
-
/* @__PURE__ */ e(
|
|
2279
|
-
|
|
2364
|
+
/* @__PURE__ */ e(v.Item, { label: "线宽(像素)", children: /* @__PURE__ */ e(
|
|
2365
|
+
V,
|
|
2280
2366
|
{
|
|
2281
2367
|
value: r.lineWeight,
|
|
2282
2368
|
onChange: (o) => l({ lineWeight: o || 2 }),
|
|
@@ -2285,16 +2371,16 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2285
2371
|
style: { width: 120 }
|
|
2286
2372
|
}
|
|
2287
2373
|
) }),
|
|
2288
|
-
/* @__PURE__ */ e(
|
|
2374
|
+
/* @__PURE__ */ e(v.Item, { label: "颜色", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2289
2375
|
/* @__PURE__ */ e(
|
|
2290
|
-
|
|
2376
|
+
et,
|
|
2291
2377
|
{
|
|
2292
2378
|
value: r.color || "#d9d9d9",
|
|
2293
2379
|
onChange: (o) => l({ color: o.toHexString() })
|
|
2294
2380
|
}
|
|
2295
2381
|
),
|
|
2296
2382
|
/* @__PURE__ */ e(
|
|
2297
|
-
|
|
2383
|
+
J,
|
|
2298
2384
|
{
|
|
2299
2385
|
value: r.color,
|
|
2300
2386
|
onChange: (o) => l({ color: o.target.value }),
|
|
@@ -2304,35 +2390,35 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2304
2390
|
)
|
|
2305
2391
|
] }) })
|
|
2306
2392
|
] }),
|
|
2307
|
-
/* @__PURE__ */ e(
|
|
2308
|
-
/* @__PURE__ */
|
|
2309
|
-
/* @__PURE__ */
|
|
2310
|
-
/* @__PURE__ */ e(
|
|
2311
|
-
|
|
2393
|
+
/* @__PURE__ */ e(ye, { children: "起止位置(相对节点)" }),
|
|
2394
|
+
/* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2395
|
+
/* @__PURE__ */ c("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2396
|
+
/* @__PURE__ */ e(v.Item, { label: "起点 X", className: "mb-2", children: /* @__PURE__ */ e(
|
|
2397
|
+
V,
|
|
2312
2398
|
{
|
|
2313
2399
|
value: r.startX,
|
|
2314
2400
|
onChange: (o) => l({ startX: o ?? 0 }),
|
|
2315
2401
|
style: { width: "100%" }
|
|
2316
2402
|
}
|
|
2317
2403
|
) }),
|
|
2318
|
-
/* @__PURE__ */ e(
|
|
2319
|
-
|
|
2404
|
+
/* @__PURE__ */ e(v.Item, { label: "起点 Y", className: "mb-2", children: /* @__PURE__ */ e(
|
|
2405
|
+
V,
|
|
2320
2406
|
{
|
|
2321
2407
|
value: r.startY,
|
|
2322
2408
|
onChange: (o) => l({ startY: o ?? 0 }),
|
|
2323
2409
|
style: { width: "100%" }
|
|
2324
2410
|
}
|
|
2325
2411
|
) }),
|
|
2326
|
-
/* @__PURE__ */ e(
|
|
2327
|
-
|
|
2412
|
+
/* @__PURE__ */ e(v.Item, { label: "终点 X", className: "mb-2", children: /* @__PURE__ */ e(
|
|
2413
|
+
V,
|
|
2328
2414
|
{
|
|
2329
2415
|
value: r.endX,
|
|
2330
2416
|
onChange: (o) => l({ endX: o ?? 100 }),
|
|
2331
2417
|
style: { width: "100%" }
|
|
2332
2418
|
}
|
|
2333
2419
|
) }),
|
|
2334
|
-
/* @__PURE__ */ e(
|
|
2335
|
-
|
|
2420
|
+
/* @__PURE__ */ e(v.Item, { label: "终点 Y", className: "mb-2", children: /* @__PURE__ */ e(
|
|
2421
|
+
V,
|
|
2336
2422
|
{
|
|
2337
2423
|
value: r.endY,
|
|
2338
2424
|
onChange: (o) => l({ endY: o ?? 0 }),
|
|
@@ -2340,9 +2426,9 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2340
2426
|
}
|
|
2341
2427
|
) })
|
|
2342
2428
|
] }),
|
|
2343
|
-
/* @__PURE__ */ e(
|
|
2429
|
+
/* @__PURE__ */ e(v.Item, { label: "快速对齐", className: "mt-4", children: /* @__PURE__ */ c(ae, { children: [
|
|
2344
2430
|
/* @__PURE__ */ e(
|
|
2345
|
-
|
|
2431
|
+
j,
|
|
2346
2432
|
{
|
|
2347
2433
|
size: "small",
|
|
2348
2434
|
onClick: () => {
|
|
@@ -2353,7 +2439,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2353
2439
|
}
|
|
2354
2440
|
),
|
|
2355
2441
|
/* @__PURE__ */ e(
|
|
2356
|
-
|
|
2442
|
+
j,
|
|
2357
2443
|
{
|
|
2358
2444
|
size: "small",
|
|
2359
2445
|
onClick: () => {
|
|
@@ -2364,7 +2450,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2364
2450
|
}
|
|
2365
2451
|
),
|
|
2366
2452
|
/* @__PURE__ */ e(
|
|
2367
|
-
|
|
2453
|
+
j,
|
|
2368
2454
|
{
|
|
2369
2455
|
size: "small",
|
|
2370
2456
|
onClick: () => {
|
|
@@ -2382,223 +2468,223 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2382
2468
|
] }) })
|
|
2383
2469
|
] })
|
|
2384
2470
|
] });
|
|
2385
|
-
},
|
|
2471
|
+
}, Pt = ({
|
|
2386
2472
|
material: n,
|
|
2387
|
-
onSave:
|
|
2473
|
+
onSave: m,
|
|
2388
2474
|
bindCodes: t,
|
|
2389
2475
|
dataOptions: r
|
|
2390
2476
|
}) => {
|
|
2391
2477
|
switch (n.type) {
|
|
2392
2478
|
case "TEXT":
|
|
2393
2479
|
return /* @__PURE__ */ e(
|
|
2394
|
-
|
|
2480
|
+
Mn,
|
|
2395
2481
|
{
|
|
2396
2482
|
material: n,
|
|
2397
|
-
onSave:
|
|
2483
|
+
onSave: m,
|
|
2398
2484
|
bindCodes: t,
|
|
2399
2485
|
dataOptions: r
|
|
2400
2486
|
}
|
|
2401
2487
|
);
|
|
2402
2488
|
case "IMAGE":
|
|
2403
|
-
return /* @__PURE__ */ e(
|
|
2489
|
+
return /* @__PURE__ */ e(En, { material: n, onSave: m });
|
|
2404
2490
|
case "LINE":
|
|
2405
|
-
return /* @__PURE__ */ e(
|
|
2491
|
+
return /* @__PURE__ */ e(Ln, { material: n, onSave: m });
|
|
2406
2492
|
default:
|
|
2407
2493
|
return /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-8", children: "暂不支持编辑此类型的物料" });
|
|
2408
2494
|
}
|
|
2409
|
-
}, { Panel:
|
|
2495
|
+
}, { Panel: yt } = he, { TextArea: Pn } = J, Tn = ({
|
|
2410
2496
|
node: n,
|
|
2411
|
-
updateNode:
|
|
2497
|
+
updateNode: m,
|
|
2412
2498
|
materials: t
|
|
2413
2499
|
}) => {
|
|
2414
|
-
const r = t.filter((u) => u.type !== "CUSTOM" || !u.config?.nodes),
|
|
2500
|
+
const r = t.filter((u) => u.type !== "CUSTOM" || !u.config?.nodes), d = (u, b) => {
|
|
2415
2501
|
const s = n.children?.map((x) => x.id === u ? {
|
|
2416
2502
|
...x,
|
|
2417
2503
|
contentInfo: {
|
|
2418
2504
|
...x.contentInfo,
|
|
2419
|
-
statusList:
|
|
2505
|
+
statusList: b
|
|
2420
2506
|
}
|
|
2421
2507
|
} : x);
|
|
2422
|
-
|
|
2508
|
+
m(n.id, {
|
|
2423
2509
|
children: s
|
|
2424
2510
|
});
|
|
2425
2511
|
}, l = (u) => {
|
|
2426
|
-
const
|
|
2427
|
-
if (!
|
|
2512
|
+
const b = n.children?.find((x) => x.id === u);
|
|
2513
|
+
if (!b) return;
|
|
2428
2514
|
const s = {
|
|
2429
|
-
id:
|
|
2430
|
-
name: `状态${
|
|
2431
|
-
expression:
|
|
2432
|
-
material: { ...r[0], id:
|
|
2515
|
+
id: z(),
|
|
2516
|
+
name: `状态${b.contentInfo.statusList.length + 1}`,
|
|
2517
|
+
expression: b.contentInfo.statusList.length === 0 ? "return true;" : "return false;",
|
|
2518
|
+
material: { ...r[0], id: z() },
|
|
2433
2519
|
bindCodes: []
|
|
2434
2520
|
};
|
|
2435
|
-
|
|
2436
|
-
}, a = (u,
|
|
2437
|
-
const s = n.children?.find((
|
|
2521
|
+
d(u, [...b.contentInfo.statusList, s]);
|
|
2522
|
+
}, a = (u, b) => {
|
|
2523
|
+
const s = n.children?.find((y) => y.id === u);
|
|
2438
2524
|
if (!s) return;
|
|
2439
|
-
const x = s.contentInfo.statusList.filter((
|
|
2440
|
-
|
|
2441
|
-
}, o = (u,
|
|
2442
|
-
const x = n.children?.find((
|
|
2525
|
+
const x = s.contentInfo.statusList.filter((y) => y.id !== b);
|
|
2526
|
+
d(u, x);
|
|
2527
|
+
}, o = (u, b, s) => {
|
|
2528
|
+
const x = n.children?.find((M) => M.id === u);
|
|
2443
2529
|
if (!x) return;
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
},
|
|
2447
|
-
const x = n.children?.find((
|
|
2530
|
+
const y = x.contentInfo.statusList.map((M) => M.id === b ? { ...M, ...s } : M);
|
|
2531
|
+
d(u, y);
|
|
2532
|
+
}, f = (u, b, s) => {
|
|
2533
|
+
const x = n.children?.find((h) => h.id === u);
|
|
2448
2534
|
if (!x) return;
|
|
2449
|
-
const
|
|
2450
|
-
if (
|
|
2451
|
-
const
|
|
2452
|
-
s === "up" &&
|
|
2453
|
-
},
|
|
2454
|
-
const x = t.find((
|
|
2455
|
-
x && o(u,
|
|
2456
|
-
material: { ...x, id:
|
|
2535
|
+
const y = x.contentInfo.statusList.findIndex((h) => h.id === b);
|
|
2536
|
+
if (y === -1) return;
|
|
2537
|
+
const M = [...x.contentInfo.statusList];
|
|
2538
|
+
s === "up" && y > 0 ? [M[y], M[y - 1]] = [M[y - 1], M[y]] : s === "down" && y < M.length - 1 && ([M[y], M[y + 1]] = [M[y + 1], M[y]]), d(u, M);
|
|
2539
|
+
}, g = (u, b, s) => {
|
|
2540
|
+
const x = t.find((y) => y.id === s);
|
|
2541
|
+
x && o(u, b, {
|
|
2542
|
+
material: { ...x, id: z() }
|
|
2457
2543
|
});
|
|
2458
2544
|
};
|
|
2459
|
-
return /* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */ e("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg mb-4", children: /* @__PURE__ */
|
|
2545
|
+
return /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
2546
|
+
/* @__PURE__ */ e("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg mb-4", children: /* @__PURE__ */ c("div", { className: "text-sm text-blue-700", children: [
|
|
2461
2547
|
/* @__PURE__ */ e("strong", { children: "群组节点" }),
|
|
2462
2548
|
":为每个子节点配置多个状态和绑定"
|
|
2463
2549
|
] }) }),
|
|
2464
|
-
/* @__PURE__ */ e(
|
|
2465
|
-
|
|
2550
|
+
/* @__PURE__ */ e(he, { ghost: !0, children: n.children?.map((u, b) => /* @__PURE__ */ e(
|
|
2551
|
+
yt,
|
|
2466
2552
|
{
|
|
2467
|
-
header: /* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2553
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center justify-between w-full pr-4", children: [
|
|
2554
|
+
/* @__PURE__ */ c("span", { className: "font-medium text-sm", children: [
|
|
2469
2555
|
"子节点 ",
|
|
2470
|
-
|
|
2556
|
+
b + 1
|
|
2471
2557
|
] }),
|
|
2472
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ c(le, { color: "blue", style: { fontSize: "12px", padding: "0 4px" }, children: [
|
|
2473
2559
|
u.contentInfo.statusList.length,
|
|
2474
2560
|
" 个状态"
|
|
2475
2561
|
] })
|
|
2476
2562
|
] }),
|
|
2477
|
-
children: /* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2563
|
+
children: /* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
2564
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between items-center mb-3", children: [
|
|
2479
2565
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "状态列表" }),
|
|
2480
2566
|
/* @__PURE__ */ e(
|
|
2481
|
-
|
|
2567
|
+
j,
|
|
2482
2568
|
{
|
|
2483
2569
|
type: "primary",
|
|
2484
2570
|
size: "small",
|
|
2485
|
-
icon: /* @__PURE__ */ e(
|
|
2571
|
+
icon: /* @__PURE__ */ e(Nt, {}),
|
|
2486
2572
|
onClick: () => l(u.id),
|
|
2487
2573
|
children: "添加状态"
|
|
2488
2574
|
}
|
|
2489
2575
|
)
|
|
2490
2576
|
] }),
|
|
2491
|
-
u.contentInfo.statusList.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(
|
|
2492
|
-
|
|
2577
|
+
u.contentInfo.statusList.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(he, { ghost: !0, children: u.contentInfo.statusList.map((s, x) => /* @__PURE__ */ e(
|
|
2578
|
+
yt,
|
|
2493
2579
|
{
|
|
2494
|
-
header: /* @__PURE__ */
|
|
2580
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2495
2581
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: x + 1 }),
|
|
2496
2582
|
/* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
|
|
2497
|
-
/* @__PURE__ */ e(
|
|
2583
|
+
/* @__PURE__ */ e(le, { color: "default", className: "text-xs", children: s.material.type })
|
|
2498
2584
|
] }),
|
|
2499
|
-
extra: /* @__PURE__ */
|
|
2585
|
+
extra: /* @__PURE__ */ c(ae, { size: "small", onClick: (y) => y.stopPropagation(), children: [
|
|
2500
2586
|
/* @__PURE__ */ e(
|
|
2501
|
-
|
|
2587
|
+
j,
|
|
2502
2588
|
{
|
|
2503
2589
|
type: "text",
|
|
2504
2590
|
size: "small",
|
|
2505
|
-
icon: /* @__PURE__ */ e(
|
|
2591
|
+
icon: /* @__PURE__ */ e(It, {}),
|
|
2506
2592
|
disabled: x === 0,
|
|
2507
|
-
onClick: (
|
|
2508
|
-
|
|
2593
|
+
onClick: (y) => {
|
|
2594
|
+
y.stopPropagation(), f(u.id, s.id, "up");
|
|
2509
2595
|
}
|
|
2510
2596
|
}
|
|
2511
2597
|
),
|
|
2512
2598
|
/* @__PURE__ */ e(
|
|
2513
|
-
|
|
2599
|
+
j,
|
|
2514
2600
|
{
|
|
2515
2601
|
type: "text",
|
|
2516
2602
|
size: "small",
|
|
2517
|
-
icon: /* @__PURE__ */ e(
|
|
2603
|
+
icon: /* @__PURE__ */ e(kt, {}),
|
|
2518
2604
|
disabled: x === u.contentInfo.statusList.length - 1,
|
|
2519
|
-
onClick: (
|
|
2520
|
-
|
|
2605
|
+
onClick: (y) => {
|
|
2606
|
+
y.stopPropagation(), f(u.id, s.id, "down");
|
|
2521
2607
|
}
|
|
2522
2608
|
}
|
|
2523
2609
|
),
|
|
2524
2610
|
/* @__PURE__ */ e(
|
|
2525
|
-
|
|
2611
|
+
j,
|
|
2526
2612
|
{
|
|
2527
2613
|
type: "text",
|
|
2528
2614
|
size: "small",
|
|
2529
2615
|
danger: !0,
|
|
2530
|
-
icon: /* @__PURE__ */ e(
|
|
2531
|
-
onClick: (
|
|
2532
|
-
|
|
2616
|
+
icon: /* @__PURE__ */ e(Ge, {}),
|
|
2617
|
+
onClick: (y) => {
|
|
2618
|
+
y.stopPropagation(), a(u.id, s.id);
|
|
2533
2619
|
}
|
|
2534
2620
|
}
|
|
2535
2621
|
)
|
|
2536
2622
|
] }),
|
|
2537
|
-
children: /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */ e(
|
|
2539
|
-
|
|
2623
|
+
children: /* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2624
|
+
/* @__PURE__ */ e(v.Item, { label: "状态名称", children: /* @__PURE__ */ e(
|
|
2625
|
+
J,
|
|
2540
2626
|
{
|
|
2541
2627
|
value: s.name,
|
|
2542
|
-
onChange: (
|
|
2628
|
+
onChange: (y) => o(u.id, s.id, { name: y.target.value }),
|
|
2543
2629
|
placeholder: "输入状态名称"
|
|
2544
2630
|
}
|
|
2545
2631
|
) }),
|
|
2546
2632
|
/* @__PURE__ */ e(
|
|
2547
|
-
|
|
2633
|
+
v.Item,
|
|
2548
2634
|
{
|
|
2549
2635
|
label: "执行表达式",
|
|
2550
2636
|
help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
|
|
2551
2637
|
children: /* @__PURE__ */ e(
|
|
2552
|
-
|
|
2638
|
+
Pn,
|
|
2553
2639
|
{
|
|
2554
2640
|
value: s.expression,
|
|
2555
|
-
onChange: (
|
|
2641
|
+
onChange: (y) => o(u.id, s.id, { expression: y.target.value }),
|
|
2556
2642
|
rows: 3,
|
|
2557
2643
|
placeholder: "return true;"
|
|
2558
2644
|
}
|
|
2559
2645
|
)
|
|
2560
2646
|
}
|
|
2561
2647
|
),
|
|
2562
|
-
/* @__PURE__ */ e(
|
|
2563
|
-
|
|
2648
|
+
/* @__PURE__ */ e(v.Item, { label: "绑定数据源 (bindCodes)", children: /* @__PURE__ */ e(
|
|
2649
|
+
me,
|
|
2564
2650
|
{
|
|
2565
2651
|
mode: "tags",
|
|
2566
2652
|
value: s.bindCodes || [],
|
|
2567
|
-
onChange: (
|
|
2653
|
+
onChange: (y) => o(u.id, s.id, { bindCodes: y }),
|
|
2568
2654
|
placeholder: "输入数据源 code",
|
|
2569
2655
|
tokenSeparators: [",", " "]
|
|
2570
2656
|
}
|
|
2571
2657
|
) }),
|
|
2572
|
-
/* @__PURE__ */ e(
|
|
2573
|
-
/* @__PURE__ */ e(
|
|
2574
|
-
/* @__PURE__ */ e(
|
|
2658
|
+
/* @__PURE__ */ e(v.Item, { label: "更换物料", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2659
|
+
/* @__PURE__ */ e(le, { color: "blue", children: s.material.name }),
|
|
2660
|
+
/* @__PURE__ */ e(le, { color: "default", children: s.material.type }),
|
|
2575
2661
|
/* @__PURE__ */ e(
|
|
2576
|
-
|
|
2662
|
+
me,
|
|
2577
2663
|
{
|
|
2578
2664
|
placeholder: "选择新物料",
|
|
2579
2665
|
style: { width: 150 },
|
|
2580
2666
|
value: void 0,
|
|
2581
|
-
onChange: (
|
|
2582
|
-
options: r.map((
|
|
2583
|
-
value:
|
|
2584
|
-
label: `${
|
|
2667
|
+
onChange: (y) => y && g(u.id, s.id, y),
|
|
2668
|
+
options: r.map((y) => ({
|
|
2669
|
+
value: y.id,
|
|
2670
|
+
label: `${y.name} (${y.type})`
|
|
2585
2671
|
}))
|
|
2586
2672
|
}
|
|
2587
2673
|
)
|
|
2588
2674
|
] }) }),
|
|
2589
|
-
/* @__PURE__ */ e(
|
|
2590
|
-
/* @__PURE__ */
|
|
2591
|
-
/* @__PURE__ */
|
|
2675
|
+
/* @__PURE__ */ e(ye, { style: { margin: "12px 0" } }),
|
|
2676
|
+
/* @__PURE__ */ c("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2677
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2592
2678
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
|
|
2593
|
-
/* @__PURE__ */ e(
|
|
2679
|
+
/* @__PURE__ */ e(le, { children: s.material.name })
|
|
2594
2680
|
] }),
|
|
2595
2681
|
/* @__PURE__ */ e(
|
|
2596
|
-
|
|
2682
|
+
Pt,
|
|
2597
2683
|
{
|
|
2598
2684
|
material: s.material,
|
|
2599
|
-
onSave: (
|
|
2600
|
-
const
|
|
2601
|
-
o(u.id, s.id, { material:
|
|
2685
|
+
onSave: (y) => {
|
|
2686
|
+
const M = { ...s.material, ...y };
|
|
2687
|
+
o(u.id, s.id, { material: M });
|
|
2602
2688
|
}
|
|
2603
2689
|
}
|
|
2604
2690
|
)
|
|
@@ -2612,23 +2698,23 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2612
2698
|
u.id
|
|
2613
2699
|
)) })
|
|
2614
2700
|
] });
|
|
2615
|
-
}, { Panel:
|
|
2701
|
+
}, { Panel: ge } = he, { TabPane: Ke } = St, { TextArea: $n } = J, _n = ({
|
|
2616
2702
|
defaultTestData: n
|
|
2617
2703
|
}) => {
|
|
2618
2704
|
const {
|
|
2619
|
-
nodes:
|
|
2705
|
+
nodes: m,
|
|
2620
2706
|
selectedNodeId: t,
|
|
2621
2707
|
updateNode: r,
|
|
2622
|
-
updateNodeStyle:
|
|
2708
|
+
updateNodeStyle: d,
|
|
2623
2709
|
updateNodeControl: l,
|
|
2624
2710
|
updateNodeContent: a,
|
|
2625
2711
|
materials: o,
|
|
2626
|
-
selectedStatusId:
|
|
2627
|
-
selectStatus:
|
|
2628
|
-
} =
|
|
2629
|
-
t && (i.normalStyle &&
|
|
2712
|
+
selectedStatusId: f,
|
|
2713
|
+
selectStatus: g
|
|
2714
|
+
} = Ie(), [u] = v.useForm(), [b, s] = G("basic"), [x, y] = G(!1), [M, h] = G(null), [A, O] = G({}), D = de.useMemo(() => m.find((i) => i.id === t), [m, t]), L = D?.contentInfo.statusList || [], Y = (i) => {
|
|
2715
|
+
t && (i.normalStyle && d(t, i.normalStyle), i.name !== void 0 && r(t, { name: i.name }), i.controlInfo && l(t, i.controlInfo));
|
|
2630
2716
|
};
|
|
2631
|
-
|
|
2717
|
+
se(() => {
|
|
2632
2718
|
D && (u.setFieldsValue({
|
|
2633
2719
|
name: D.name,
|
|
2634
2720
|
normalStyle: {
|
|
@@ -2649,222 +2735,222 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2649
2735
|
isSelectable: !0,
|
|
2650
2736
|
...D.controlInfo
|
|
2651
2737
|
}
|
|
2652
|
-
}),
|
|
2653
|
-
}, [D?.id, u,
|
|
2654
|
-
const
|
|
2655
|
-
!t || !D || (
|
|
2738
|
+
}), g(null));
|
|
2739
|
+
}, [D?.id, u, g]);
|
|
2740
|
+
const ie = () => {
|
|
2741
|
+
!t || !D || (h("new"), y(!0));
|
|
2656
2742
|
}, H = (i) => {
|
|
2657
2743
|
if (!t || !D) return;
|
|
2658
|
-
const
|
|
2659
|
-
id:
|
|
2660
|
-
name: `${i.name}_状态${
|
|
2661
|
-
expression:
|
|
2662
|
-
material: { ...i, id:
|
|
2744
|
+
const k = {
|
|
2745
|
+
id: z(),
|
|
2746
|
+
name: `${i.name}_状态${L.length + 1}`,
|
|
2747
|
+
expression: L.length === 0 ? "return true;" : "return false;",
|
|
2748
|
+
material: { ...i, id: z() },
|
|
2663
2749
|
bindCodes: []
|
|
2664
2750
|
};
|
|
2665
|
-
if (
|
|
2666
|
-
const
|
|
2667
|
-
a(t, { statusList:
|
|
2668
|
-
} else if (
|
|
2669
|
-
const
|
|
2670
|
-
a(t, { statusList:
|
|
2751
|
+
if (M === "new") {
|
|
2752
|
+
const S = [...L, k];
|
|
2753
|
+
a(t, { statusList: S });
|
|
2754
|
+
} else if (M) {
|
|
2755
|
+
const S = L.map((w) => w.id === M ? { ...w, material: { ...i, id: z() } } : w);
|
|
2756
|
+
a(t, { statusList: S });
|
|
2671
2757
|
}
|
|
2672
|
-
|
|
2673
|
-
},
|
|
2758
|
+
y(!1), h(null);
|
|
2759
|
+
}, Q = (i) => {
|
|
2674
2760
|
if (!t || !D) return;
|
|
2675
|
-
const
|
|
2676
|
-
a(t, { statusList:
|
|
2677
|
-
},
|
|
2761
|
+
const k = D.contentInfo.statusList?.filter((S) => S.id !== i) || [];
|
|
2762
|
+
a(t, { statusList: k }), f === i && g(null);
|
|
2763
|
+
}, F = (i, k) => {
|
|
2678
2764
|
if (!t || !D) return;
|
|
2679
|
-
const
|
|
2680
|
-
a(t, { statusList:
|
|
2681
|
-
},
|
|
2765
|
+
const S = D.contentInfo.statusList?.map((w) => w.id === i ? { ...w, ...k } : w) || [];
|
|
2766
|
+
a(t, { statusList: S });
|
|
2767
|
+
}, P = (i) => {
|
|
2682
2768
|
if (!t || !D) return;
|
|
2683
|
-
const
|
|
2769
|
+
const k = {
|
|
2684
2770
|
...i,
|
|
2685
|
-
id:
|
|
2771
|
+
id: z(),
|
|
2686
2772
|
name: `${i.name}_复制`,
|
|
2687
2773
|
expression: "return false;"
|
|
2688
|
-
},
|
|
2689
|
-
a(t, { statusList:
|
|
2690
|
-
},
|
|
2774
|
+
}, S = [...L, k];
|
|
2775
|
+
a(t, { statusList: S });
|
|
2776
|
+
}, T = (i, k) => {
|
|
2691
2777
|
if (!t || !D) return;
|
|
2692
|
-
const
|
|
2693
|
-
if (
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
] :
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
]), a(t, { statusList:
|
|
2702
|
-
},
|
|
2703
|
-
|
|
2704
|
-
},
|
|
2778
|
+
const S = L.findIndex((E) => E.id === i);
|
|
2779
|
+
if (S === -1) return;
|
|
2780
|
+
const w = [...L];
|
|
2781
|
+
k === "up" && S > 0 ? [w[S], w[S - 1]] = [
|
|
2782
|
+
w[S - 1],
|
|
2783
|
+
w[S]
|
|
2784
|
+
] : k === "down" && S < w.length - 1 && ([w[S], w[S + 1]] = [
|
|
2785
|
+
w[S + 1],
|
|
2786
|
+
w[S]
|
|
2787
|
+
]), a(t, { statusList: w });
|
|
2788
|
+
}, B = (i) => {
|
|
2789
|
+
h(i), y(!0);
|
|
2790
|
+
}, R = (i, k) => {
|
|
2705
2791
|
if (!t || !D) return;
|
|
2706
|
-
const
|
|
2707
|
-
...
|
|
2708
|
-
material: { ...
|
|
2709
|
-
} :
|
|
2710
|
-
a(t, { statusList:
|
|
2792
|
+
const S = L.map((w) => w.id === i ? {
|
|
2793
|
+
...w,
|
|
2794
|
+
material: { ...w.material, ...k }
|
|
2795
|
+
} : w);
|
|
2796
|
+
a(t, { statusList: S });
|
|
2711
2797
|
};
|
|
2712
|
-
return D ? /* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2798
|
+
return D ? /* @__PURE__ */ c("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
|
|
2799
|
+
/* @__PURE__ */ c("div", { className: "p-4 border-b border-gray-200", children: [
|
|
2714
2800
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "属性面板" }),
|
|
2715
2801
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "编辑选中节点的属性" })
|
|
2716
2802
|
] }),
|
|
2717
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */ e(
|
|
2719
|
-
|
|
2803
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ c(St, { activeKey: b, onChange: s, children: [
|
|
2804
|
+
/* @__PURE__ */ e(Ke, { tab: "基础", children: /* @__PURE__ */ c(
|
|
2805
|
+
v,
|
|
2720
2806
|
{
|
|
2721
2807
|
form: u,
|
|
2722
2808
|
layout: "vertical",
|
|
2723
|
-
onValuesChange:
|
|
2809
|
+
onValuesChange: Y,
|
|
2724
2810
|
initialValues: { name: D.name },
|
|
2725
2811
|
children: [
|
|
2726
|
-
/* @__PURE__ */ e(
|
|
2727
|
-
/* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */ e(
|
|
2729
|
-
/* @__PURE__ */ e(
|
|
2730
|
-
/* @__PURE__ */ e(
|
|
2812
|
+
/* @__PURE__ */ e(v.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(J, { placeholder: "输入节点名称" }) }),
|
|
2813
|
+
/* @__PURE__ */ c(he, { ghost: !0, defaultActiveKey: ["position", "size", "style"], children: [
|
|
2814
|
+
/* @__PURE__ */ e(ge, { header: "位置", children: /* @__PURE__ */ c(ae, { children: [
|
|
2815
|
+
/* @__PURE__ */ e(v.Item, { label: "X", name: ["normalStyle", "x"], children: /* @__PURE__ */ e(V, {}) }),
|
|
2816
|
+
/* @__PURE__ */ e(v.Item, { label: "Y", name: ["normalStyle", "y"], children: /* @__PURE__ */ e(V, {}) })
|
|
2731
2817
|
] }) }, "position"),
|
|
2732
|
-
/* @__PURE__ */ e(
|
|
2733
|
-
/* @__PURE__ */ e(
|
|
2734
|
-
/* @__PURE__ */ e(
|
|
2818
|
+
/* @__PURE__ */ e(ge, { header: "尺寸", children: /* @__PURE__ */ c(ae, { children: [
|
|
2819
|
+
/* @__PURE__ */ e(v.Item, { label: "宽度", name: ["normalStyle", "width"], children: /* @__PURE__ */ e(V, { min: 10 }) }),
|
|
2820
|
+
/* @__PURE__ */ e(v.Item, { label: "高度", name: ["normalStyle", "height"], children: /* @__PURE__ */ e(V, { min: 10 }) })
|
|
2735
2821
|
] }) }, "size"),
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */ e(
|
|
2738
|
-
/* @__PURE__ */ e(
|
|
2739
|
-
/* @__PURE__ */ e(
|
|
2822
|
+
/* @__PURE__ */ c(ge, { header: "样式", children: [
|
|
2823
|
+
/* @__PURE__ */ e(v.Item, { label: "背景色", name: ["normalStyle", "background"], children: /* @__PURE__ */ e(J, { placeholder: "transparent, #fff, url(...)" }) }),
|
|
2824
|
+
/* @__PURE__ */ e(v.Item, { label: "内边距", name: ["normalStyle", "padding"], children: /* @__PURE__ */ e(V, { min: 0 }) }),
|
|
2825
|
+
/* @__PURE__ */ e(v.Item, { label: "圆角", name: ["normalStyle", "borderRadius"], children: /* @__PURE__ */ e(V, { min: 0 }) }),
|
|
2740
2826
|
/* @__PURE__ */ e(
|
|
2741
|
-
|
|
2827
|
+
v.Item,
|
|
2742
2828
|
{
|
|
2743
2829
|
label: "缩放比例",
|
|
2744
2830
|
name: ["normalStyle", "scale"],
|
|
2745
2831
|
help: "等比缩放节点的宽高",
|
|
2746
|
-
children: /* @__PURE__ */ e(
|
|
2832
|
+
children: /* @__PURE__ */ e(V, { min: 0.1, max: 5, step: 0.1 })
|
|
2747
2833
|
}
|
|
2748
2834
|
),
|
|
2749
|
-
/* @__PURE__ */ e(
|
|
2750
|
-
/* @__PURE__ */ e(
|
|
2835
|
+
/* @__PURE__ */ e(v.Item, { label: "透明度", name: ["normalStyle", "opacity"], children: /* @__PURE__ */ e(V, { min: 0, max: 1, step: 0.1 }) }),
|
|
2836
|
+
/* @__PURE__ */ e(v.Item, { label: "层级", name: ["normalStyle", "zIndex"], children: /* @__PURE__ */ e(V, {}) })
|
|
2751
2837
|
] }, "style")
|
|
2752
2838
|
] })
|
|
2753
2839
|
]
|
|
2754
2840
|
}
|
|
2755
2841
|
) }, "basic"),
|
|
2756
|
-
/* @__PURE__ */ e(
|
|
2757
|
-
|
|
2842
|
+
/* @__PURE__ */ e(Ke, { tab: "状态", children: D.type === "group" && D.children ? /* @__PURE__ */ e(
|
|
2843
|
+
Tn,
|
|
2758
2844
|
{
|
|
2759
2845
|
node: D,
|
|
2760
2846
|
updateNode: r,
|
|
2761
2847
|
materials: o
|
|
2762
2848
|
}
|
|
2763
|
-
) : /* @__PURE__ */
|
|
2764
|
-
/* @__PURE__ */
|
|
2765
|
-
/* @__PURE__ */
|
|
2849
|
+
) : /* @__PURE__ */ c("div", { className: "mb-4", children: [
|
|
2850
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2851
|
+
/* @__PURE__ */ c("span", { className: "font-medium", children: [
|
|
2766
2852
|
"状态列表",
|
|
2767
|
-
/* @__PURE__ */ e(
|
|
2853
|
+
/* @__PURE__ */ e(le, { color: "blue", className: "ml-2", children: L.length })
|
|
2768
2854
|
] }),
|
|
2769
2855
|
/* @__PURE__ */ e(
|
|
2770
|
-
|
|
2856
|
+
j,
|
|
2771
2857
|
{
|
|
2772
2858
|
type: "primary",
|
|
2773
2859
|
size: "small",
|
|
2774
|
-
icon: /* @__PURE__ */ e(
|
|
2775
|
-
onClick:
|
|
2860
|
+
icon: /* @__PURE__ */ e(Nt, {}),
|
|
2861
|
+
onClick: ie,
|
|
2776
2862
|
children: "添加状态"
|
|
2777
2863
|
}
|
|
2778
2864
|
)
|
|
2779
2865
|
] }),
|
|
2780
2866
|
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500 mb-3", children: "节点根据状态表达式计算结果显示对应物料,第一个返回 true 的状态为当前状态" }),
|
|
2781
|
-
|
|
2867
|
+
L.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__ */ c("div", { children: [
|
|
2782
2868
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "当前状态:" }),
|
|
2783
2869
|
/* @__PURE__ */ e("span", { className: "ml-2 text-sm font-medium text-blue-600", children: "由表达式自动计算" })
|
|
2784
2870
|
] }) }) }),
|
|
2785
|
-
|
|
2786
|
-
|
|
2871
|
+
L.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-4 bg-gray-50 rounded-lg", children: "暂无状态,点击上方按钮添加" }) : /* @__PURE__ */ e(he, { ghost: !0, children: L.map((i, k) => /* @__PURE__ */ e(
|
|
2872
|
+
ge,
|
|
2787
2873
|
{
|
|
2788
|
-
header: /* @__PURE__ */
|
|
2789
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children:
|
|
2874
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2875
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: k + 1 }),
|
|
2790
2876
|
/* @__PURE__ */ e("span", { className: "font-medium", children: i.name }),
|
|
2791
|
-
/* @__PURE__ */ e(
|
|
2877
|
+
/* @__PURE__ */ e(le, { color: "default", className: "text-xs", children: i.material.type })
|
|
2792
2878
|
] }),
|
|
2793
|
-
extra: /* @__PURE__ */
|
|
2879
|
+
extra: /* @__PURE__ */ c(ae, { size: "small", onClick: (S) => S.stopPropagation(), children: [
|
|
2794
2880
|
/* @__PURE__ */ e(
|
|
2795
|
-
|
|
2881
|
+
j,
|
|
2796
2882
|
{
|
|
2797
2883
|
type: "text",
|
|
2798
2884
|
size: "small",
|
|
2799
|
-
icon: /* @__PURE__ */ e(
|
|
2800
|
-
disabled:
|
|
2801
|
-
onClick: (
|
|
2802
|
-
|
|
2885
|
+
icon: /* @__PURE__ */ e(It, {}),
|
|
2886
|
+
disabled: k === 0,
|
|
2887
|
+
onClick: (S) => {
|
|
2888
|
+
S.stopPropagation(), T(i.id, "up");
|
|
2803
2889
|
}
|
|
2804
2890
|
}
|
|
2805
2891
|
),
|
|
2806
2892
|
/* @__PURE__ */ e(
|
|
2807
|
-
|
|
2893
|
+
j,
|
|
2808
2894
|
{
|
|
2809
2895
|
type: "text",
|
|
2810
2896
|
size: "small",
|
|
2811
|
-
icon: /* @__PURE__ */ e(
|
|
2812
|
-
disabled:
|
|
2813
|
-
onClick: (
|
|
2814
|
-
|
|
2897
|
+
icon: /* @__PURE__ */ e(kt, {}),
|
|
2898
|
+
disabled: k === L.length - 1,
|
|
2899
|
+
onClick: (S) => {
|
|
2900
|
+
S.stopPropagation(), T(i.id, "down");
|
|
2815
2901
|
}
|
|
2816
2902
|
}
|
|
2817
2903
|
),
|
|
2818
2904
|
/* @__PURE__ */ e(
|
|
2819
|
-
|
|
2905
|
+
j,
|
|
2820
2906
|
{
|
|
2821
2907
|
type: "text",
|
|
2822
2908
|
size: "small",
|
|
2823
|
-
icon: /* @__PURE__ */ e(
|
|
2824
|
-
onClick: (
|
|
2825
|
-
|
|
2909
|
+
icon: /* @__PURE__ */ e(Jt, {}),
|
|
2910
|
+
onClick: (S) => {
|
|
2911
|
+
S.stopPropagation(), P(i);
|
|
2826
2912
|
}
|
|
2827
2913
|
}
|
|
2828
2914
|
),
|
|
2829
2915
|
/* @__PURE__ */ e(
|
|
2830
|
-
|
|
2916
|
+
j,
|
|
2831
2917
|
{
|
|
2832
2918
|
type: "text",
|
|
2833
2919
|
size: "small",
|
|
2834
2920
|
danger: !0,
|
|
2835
|
-
icon: /* @__PURE__ */ e(
|
|
2836
|
-
onClick: (
|
|
2837
|
-
|
|
2921
|
+
icon: /* @__PURE__ */ e(Ge, {}),
|
|
2922
|
+
onClick: (S) => {
|
|
2923
|
+
S.stopPropagation(), Q(i.id);
|
|
2838
2924
|
}
|
|
2839
2925
|
}
|
|
2840
2926
|
)
|
|
2841
2927
|
] }),
|
|
2842
|
-
children: /* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */ e(
|
|
2844
|
-
|
|
2928
|
+
children: /* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2929
|
+
/* @__PURE__ */ e(v.Item, { label: "状态名称", children: /* @__PURE__ */ e(
|
|
2930
|
+
J,
|
|
2845
2931
|
{
|
|
2846
2932
|
value: i.name,
|
|
2847
|
-
onChange: (
|
|
2933
|
+
onChange: (S) => F(i.id, { name: S.target.value }),
|
|
2848
2934
|
placeholder: "输入状态名称"
|
|
2849
2935
|
}
|
|
2850
2936
|
) }),
|
|
2851
2937
|
/* @__PURE__ */ e(
|
|
2852
|
-
|
|
2938
|
+
v.Item,
|
|
2853
2939
|
{
|
|
2854
2940
|
label: "执行表达式",
|
|
2855
2941
|
help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
|
|
2856
2942
|
children: /* @__PURE__ */ e(
|
|
2857
|
-
|
|
2943
|
+
$n,
|
|
2858
2944
|
{
|
|
2859
|
-
value:
|
|
2860
|
-
onChange: (
|
|
2861
|
-
...
|
|
2862
|
-
[i.id]:
|
|
2945
|
+
value: A[i.id] ?? i.expression,
|
|
2946
|
+
onChange: (S) => O((w) => ({
|
|
2947
|
+
...w,
|
|
2948
|
+
[i.id]: S.target.value
|
|
2863
2949
|
})),
|
|
2864
|
-
onBlur: (
|
|
2865
|
-
|
|
2866
|
-
const
|
|
2867
|
-
return delete
|
|
2950
|
+
onBlur: (S) => {
|
|
2951
|
+
F(i.id, { expression: S.target.value }), O((w) => {
|
|
2952
|
+
const E = { ...w };
|
|
2953
|
+
return delete E[i.id], E;
|
|
2868
2954
|
});
|
|
2869
2955
|
},
|
|
2870
2956
|
rows: 3,
|
|
@@ -2873,41 +2959,41 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2873
2959
|
)
|
|
2874
2960
|
}
|
|
2875
2961
|
),
|
|
2876
|
-
/* @__PURE__ */ e(
|
|
2877
|
-
|
|
2962
|
+
/* @__PURE__ */ e(v.Item, { label: "绑定数据源 (bindCodes)", children: /* @__PURE__ */ e(
|
|
2963
|
+
me,
|
|
2878
2964
|
{
|
|
2879
2965
|
mode: "tags",
|
|
2880
2966
|
value: i.bindCodes || [],
|
|
2881
|
-
onChange: (
|
|
2967
|
+
onChange: (S) => F(i.id, { bindCodes: S }),
|
|
2882
2968
|
placeholder: "输入数据源 code",
|
|
2883
2969
|
tokenSeparators: [",", " "]
|
|
2884
2970
|
}
|
|
2885
2971
|
) }),
|
|
2886
|
-
/* @__PURE__ */ e(
|
|
2887
|
-
/* @__PURE__ */ e(
|
|
2888
|
-
/* @__PURE__ */ e(
|
|
2972
|
+
/* @__PURE__ */ e(v.Item, { label: "绑定物料", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2973
|
+
/* @__PURE__ */ e(le, { color: "blue", children: i.material.name }),
|
|
2974
|
+
/* @__PURE__ */ e(le, { color: "default", children: i.material.type }),
|
|
2889
2975
|
/* @__PURE__ */ e(
|
|
2890
|
-
|
|
2976
|
+
j,
|
|
2891
2977
|
{
|
|
2892
2978
|
type: "link",
|
|
2893
2979
|
size: "small",
|
|
2894
|
-
icon: /* @__PURE__ */ e(
|
|
2895
|
-
onClick: () =>
|
|
2980
|
+
icon: /* @__PURE__ */ e(nt, {}),
|
|
2981
|
+
onClick: () => B(i.id),
|
|
2896
2982
|
children: "更换物料"
|
|
2897
2983
|
}
|
|
2898
2984
|
)
|
|
2899
2985
|
] }) }),
|
|
2900
|
-
/* @__PURE__ */ e(
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
/* @__PURE__ */
|
|
2986
|
+
/* @__PURE__ */ e(ye, { style: { margin: "12px 0" } }),
|
|
2987
|
+
/* @__PURE__ */ c("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2988
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2903
2989
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
|
|
2904
|
-
/* @__PURE__ */ e(
|
|
2990
|
+
/* @__PURE__ */ e(le, { children: i.material.name })
|
|
2905
2991
|
] }),
|
|
2906
2992
|
/* @__PURE__ */ e(
|
|
2907
|
-
|
|
2993
|
+
Pt,
|
|
2908
2994
|
{
|
|
2909
2995
|
material: i.material,
|
|
2910
|
-
onSave: (
|
|
2996
|
+
onSave: (S) => R(i.id, S),
|
|
2911
2997
|
bindCodes: i.bindCodes || [],
|
|
2912
2998
|
dataOptions: n || []
|
|
2913
2999
|
}
|
|
@@ -2918,94 +3004,94 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2918
3004
|
i.id
|
|
2919
3005
|
)) })
|
|
2920
3006
|
] }) }, "status"),
|
|
2921
|
-
/* @__PURE__ */ e(
|
|
2922
|
-
|
|
3007
|
+
/* @__PURE__ */ e(Ke, { tab: "控制", children: /* @__PURE__ */ c(
|
|
3008
|
+
v,
|
|
2923
3009
|
{
|
|
2924
3010
|
form: u,
|
|
2925
3011
|
layout: "vertical",
|
|
2926
|
-
onValuesChange:
|
|
3012
|
+
onValuesChange: Y,
|
|
2927
3013
|
children: [
|
|
2928
3014
|
/* @__PURE__ */ e(
|
|
2929
|
-
|
|
3015
|
+
v.Item,
|
|
2930
3016
|
{
|
|
2931
3017
|
label: "可拖拽",
|
|
2932
3018
|
name: ["controlInfo", "isDraggable"],
|
|
2933
3019
|
valuePropName: "checked",
|
|
2934
|
-
children: /* @__PURE__ */ e(
|
|
3020
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2935
3021
|
}
|
|
2936
3022
|
),
|
|
2937
3023
|
/* @__PURE__ */ e(
|
|
2938
|
-
|
|
3024
|
+
v.Item,
|
|
2939
3025
|
{
|
|
2940
3026
|
label: "可点击",
|
|
2941
3027
|
name: ["controlInfo", "isClickable"],
|
|
2942
3028
|
valuePropName: "checked",
|
|
2943
|
-
children: /* @__PURE__ */ e(
|
|
3029
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2944
3030
|
}
|
|
2945
3031
|
),
|
|
2946
3032
|
/* @__PURE__ */ e(
|
|
2947
|
-
|
|
3033
|
+
v.Item,
|
|
2948
3034
|
{
|
|
2949
3035
|
label: "可调整大小",
|
|
2950
3036
|
name: ["controlInfo", "isResizable"],
|
|
2951
3037
|
valuePropName: "checked",
|
|
2952
|
-
children: /* @__PURE__ */ e(
|
|
3038
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2953
3039
|
}
|
|
2954
3040
|
),
|
|
2955
3041
|
/* @__PURE__ */ e(
|
|
2956
|
-
|
|
3042
|
+
v.Item,
|
|
2957
3043
|
{
|
|
2958
3044
|
label: "可选中",
|
|
2959
3045
|
name: ["controlInfo", "isSelectable"],
|
|
2960
3046
|
valuePropName: "checked",
|
|
2961
|
-
children: /* @__PURE__ */ e(
|
|
3047
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2962
3048
|
}
|
|
2963
3049
|
)
|
|
2964
3050
|
]
|
|
2965
3051
|
}
|
|
2966
3052
|
) }, "control")
|
|
2967
3053
|
] }) }),
|
|
2968
|
-
/* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
3054
|
+
/* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */ c("div", { className: "text-xs text-gray-500", children: [
|
|
3055
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2970
3056
|
"节点 ID: ",
|
|
2971
3057
|
D.id.slice(0, 8),
|
|
2972
3058
|
"..."
|
|
2973
3059
|
] }),
|
|
2974
|
-
/* @__PURE__ */
|
|
3060
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2975
3061
|
"状态数: ",
|
|
2976
|
-
|
|
3062
|
+
L.length
|
|
2977
3063
|
] })
|
|
2978
3064
|
] }) }),
|
|
2979
3065
|
/* @__PURE__ */ e(
|
|
2980
|
-
|
|
3066
|
+
tt,
|
|
2981
3067
|
{
|
|
2982
3068
|
title: "选择物料",
|
|
2983
3069
|
open: x,
|
|
2984
3070
|
onCancel: () => {
|
|
2985
|
-
|
|
3071
|
+
y(!1), h(null);
|
|
2986
3072
|
},
|
|
2987
3073
|
footer: null,
|
|
2988
3074
|
width: 600,
|
|
2989
|
-
children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */
|
|
2990
|
-
/* @__PURE__ */ e(
|
|
2991
|
-
|
|
3075
|
+
children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ c(he, { ghost: !0, defaultActiveKey: ["basic", "device", "text", "line"], children: [
|
|
3076
|
+
/* @__PURE__ */ e(ge, { header: "基础形状", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: o.filter((i) => ["矩形", "圆形", "圆角矩形"].includes(i.name)).map((i) => /* @__PURE__ */ e(
|
|
3077
|
+
vt,
|
|
2992
3078
|
{
|
|
2993
3079
|
material: i,
|
|
2994
3080
|
onClick: () => H(i)
|
|
2995
3081
|
},
|
|
2996
3082
|
i.id
|
|
2997
3083
|
)) }) }, "basic"),
|
|
2998
|
-
/* @__PURE__ */ e(
|
|
3084
|
+
/* @__PURE__ */ e(ge, { header: "设备图标", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: o.filter(
|
|
2999
3085
|
(i) => ["阀门", "泵", "罐体"].includes(i.name) || i.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(i.name)
|
|
3000
3086
|
).map((i) => /* @__PURE__ */ e(
|
|
3001
|
-
|
|
3087
|
+
vt,
|
|
3002
3088
|
{
|
|
3003
3089
|
material: i,
|
|
3004
3090
|
onClick: () => H(i)
|
|
3005
3091
|
},
|
|
3006
3092
|
i.id
|
|
3007
3093
|
)) }) }, "device"),
|
|
3008
|
-
/* @__PURE__ */ e(
|
|
3094
|
+
/* @__PURE__ */ e(ge, { header: "文本", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: o.filter((i) => i.type === "TEXT").map((i) => /* @__PURE__ */ c(
|
|
3009
3095
|
"div",
|
|
3010
3096
|
{
|
|
3011
3097
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
@@ -3017,7 +3103,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3017
3103
|
},
|
|
3018
3104
|
i.id
|
|
3019
3105
|
)) }) }, "text"),
|
|
3020
|
-
/* @__PURE__ */ e(
|
|
3106
|
+
/* @__PURE__ */ e(ge, { header: "线条", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: o.filter((i) => i.type === "LINE").map((i) => /* @__PURE__ */ c(
|
|
3021
3107
|
"div",
|
|
3022
3108
|
{
|
|
3023
3109
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
@@ -3032,35 +3118,35 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3032
3118
|
] }) })
|
|
3033
3119
|
}
|
|
3034
3120
|
)
|
|
3035
|
-
] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(
|
|
3036
|
-
},
|
|
3121
|
+
] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(ne, { description: "请选择一个节点" }) });
|
|
3122
|
+
}, vt = ({ material: n, onClick: m }) => {
|
|
3037
3123
|
const t = n.type === "IMAGE" ? n.src : void 0;
|
|
3038
|
-
return /* @__PURE__ */
|
|
3124
|
+
return /* @__PURE__ */ c(
|
|
3039
3125
|
"div",
|
|
3040
3126
|
{
|
|
3041
3127
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
3042
|
-
onClick:
|
|
3128
|
+
onClick: m,
|
|
3043
3129
|
children: [
|
|
3044
3130
|
/* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-1 flex items-center justify-center", children: t ? /* @__PURE__ */ e("img", { src: t, alt: n.name, className: "w-10 h-10 object-contain" }) : /* @__PURE__ */ e("span", { className: "text-xs", children: n.name[0] }) }),
|
|
3045
3131
|
/* @__PURE__ */ e("span", { className: "text-xs", children: n.name })
|
|
3046
3132
|
]
|
|
3047
3133
|
}
|
|
3048
3134
|
);
|
|
3049
|
-
},
|
|
3050
|
-
configEditor:
|
|
3051
|
-
}, { Header:
|
|
3135
|
+
}, On = "ConfigEditor-module__configEditor__dinNG", Yn = {
|
|
3136
|
+
configEditor: On
|
|
3137
|
+
}, { Header: Xn, Sider: bt, Content: zn } = Qe, Bn = ({
|
|
3052
3138
|
initialScheme: n,
|
|
3053
|
-
onChange:
|
|
3139
|
+
onChange: m,
|
|
3054
3140
|
readonly: t = !1,
|
|
3055
3141
|
headerExtra: r,
|
|
3056
|
-
className:
|
|
3142
|
+
className: d = "",
|
|
3057
3143
|
style: l,
|
|
3058
3144
|
showHeader: a = !0,
|
|
3059
3145
|
showMaterialPanel: o = !0,
|
|
3060
|
-
showPropertyPanel:
|
|
3061
|
-
customMaterials:
|
|
3146
|
+
showPropertyPanel: f = !0,
|
|
3147
|
+
customMaterials: g
|
|
3062
3148
|
}) => {
|
|
3063
|
-
const [u,
|
|
3149
|
+
const [u, b] = de.useState(!1), [s, x] = de.useState(""), [y, M] = de.useState([
|
|
3064
3150
|
{
|
|
3065
3151
|
paramsCode: "001",
|
|
3066
3152
|
paramsName: "通频速度有效值",
|
|
@@ -3073,103 +3159,103 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3073
3159
|
value: 1.5,
|
|
3074
3160
|
paramsUnit: "m/s²"
|
|
3075
3161
|
}
|
|
3076
|
-
]), { exportScheme:
|
|
3077
|
-
|
|
3078
|
-
const
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
}, []),
|
|
3082
|
-
if (
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3162
|
+
]), { exportScheme: h, importScheme: A, nodes: O, materials: D, addMaterial: L } = Ie();
|
|
3163
|
+
de.useRef(null);
|
|
3164
|
+
const Y = de.useRef(!1);
|
|
3165
|
+
se(() => {
|
|
3166
|
+
Y.current || (Y.current = !0, D.length === 0 && pn.forEach((P) => L(P)), g && g.length > 0 && g.forEach((P) => L(P)), n && A(n));
|
|
3167
|
+
}, []), se(() => {
|
|
3168
|
+
if (m) {
|
|
3169
|
+
const P = h();
|
|
3170
|
+
m(P);
|
|
3085
3171
|
}
|
|
3086
|
-
}, [
|
|
3087
|
-
const
|
|
3088
|
-
const
|
|
3089
|
-
i.setAttribute("href",
|
|
3090
|
-
}, [
|
|
3172
|
+
}, [O, m]);
|
|
3173
|
+
const ie = q(() => {
|
|
3174
|
+
const P = h(), T = JSON.stringify(P, null, 2), B = "data:application/json;charset=utf-8," + encodeURIComponent(T), R = `scheme_${Date.now()}.json`, i = document.createElement("a");
|
|
3175
|
+
i.setAttribute("href", B), i.setAttribute("download", R), i.click(), De.success("导出成功!");
|
|
3176
|
+
}, [h]), H = q(() => {
|
|
3091
3177
|
try {
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3178
|
+
const P = JSON.parse(s);
|
|
3179
|
+
A(P), b(!1), x(""), De.success("导入成功!");
|
|
3094
3180
|
} catch {
|
|
3095
|
-
|
|
3181
|
+
De.error("JSON 格式错误,请检查输入");
|
|
3096
3182
|
}
|
|
3097
|
-
}, [s,
|
|
3098
|
-
(
|
|
3099
|
-
const
|
|
3100
|
-
return
|
|
3183
|
+
}, [s, A]), Q = q(
|
|
3184
|
+
(P) => {
|
|
3185
|
+
const T = new FileReader();
|
|
3186
|
+
return T.onload = (B) => {
|
|
3101
3187
|
try {
|
|
3102
|
-
const
|
|
3103
|
-
|
|
3188
|
+
const R = B.target?.result, i = JSON.parse(R);
|
|
3189
|
+
A(i), De.success("导入成功!");
|
|
3104
3190
|
} catch {
|
|
3105
|
-
|
|
3191
|
+
De.error("文件格式错误");
|
|
3106
3192
|
}
|
|
3107
|
-
},
|
|
3193
|
+
}, T.readAsText(P), !1;
|
|
3108
3194
|
},
|
|
3109
|
-
[
|
|
3110
|
-
),
|
|
3111
|
-
return
|
|
3112
|
-
|
|
3195
|
+
[A]
|
|
3196
|
+
), F = q(() => h(), [h]);
|
|
3197
|
+
return de.useImperativeHandle(
|
|
3198
|
+
de.useRef?.(),
|
|
3113
3199
|
() => ({
|
|
3114
|
-
getScheme:
|
|
3115
|
-
exportScheme:
|
|
3116
|
-
importScheme:
|
|
3200
|
+
getScheme: F,
|
|
3201
|
+
exportScheme: h,
|
|
3202
|
+
importScheme: A
|
|
3117
3203
|
}),
|
|
3118
|
-
[
|
|
3119
|
-
), /* @__PURE__ */ e(
|
|
3120
|
-
|
|
3204
|
+
[F, h, A]
|
|
3205
|
+
), /* @__PURE__ */ e(zt, { locale: hn, children: /* @__PURE__ */ e("div", { className: Yn.configEditor, style: l, children: /* @__PURE__ */ c(
|
|
3206
|
+
Qe,
|
|
3121
3207
|
{
|
|
3122
|
-
className: `h-full w-full overflow-hidden ${
|
|
3208
|
+
className: `h-full w-full overflow-hidden ${d}`,
|
|
3123
3209
|
children: [
|
|
3124
|
-
a && /* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
3210
|
+
a && /* @__PURE__ */ c(Xn, { className: "bg-white border-b border-gray-200 px-4 flex items-center justify-between flex-shrink-0", children: [
|
|
3211
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
3126
3212
|
/* @__PURE__ */ e("div", { className: "text-xl font-bold text-blue-600", children: "组态编辑器" }),
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
|
|
3213
|
+
/* @__PURE__ */ c("div", { className: "text-sm text-gray-500", children: [
|
|
3214
|
+
O.length,
|
|
3129
3215
|
" 个节点"
|
|
3130
3216
|
] })
|
|
3131
3217
|
] }),
|
|
3132
|
-
/* @__PURE__ */
|
|
3218
|
+
/* @__PURE__ */ c(ae, { children: [
|
|
3133
3219
|
r,
|
|
3134
|
-
!t && /* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */ e(
|
|
3136
|
-
/* @__PURE__ */ e(
|
|
3137
|
-
|
|
3220
|
+
!t && /* @__PURE__ */ c(Se, { children: [
|
|
3221
|
+
/* @__PURE__ */ e(we, { title: "导出 JSON", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(Kt, {}), onClick: ie, children: "导出" }) }),
|
|
3222
|
+
/* @__PURE__ */ e(we, { title: "导入 JSON", children: /* @__PURE__ */ e(
|
|
3223
|
+
j,
|
|
3138
3224
|
{
|
|
3139
|
-
icon: /* @__PURE__ */ e(
|
|
3140
|
-
onClick: () =>
|
|
3225
|
+
icon: /* @__PURE__ */ e(Ct, {}),
|
|
3226
|
+
onClick: () => b(!0),
|
|
3141
3227
|
children: "导入"
|
|
3142
3228
|
}
|
|
3143
3229
|
) })
|
|
3144
3230
|
] })
|
|
3145
3231
|
] })
|
|
3146
3232
|
] }),
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
o && !t && /* @__PURE__ */ e(
|
|
3149
|
-
/* @__PURE__ */ e(
|
|
3150
|
-
|
|
3233
|
+
/* @__PURE__ */ c(Qe, { children: [
|
|
3234
|
+
o && !t && /* @__PURE__ */ e(bt, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(yn, {}) }),
|
|
3235
|
+
/* @__PURE__ */ e(zn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(In, { defaultTestData: y }) }),
|
|
3236
|
+
f && !t && /* @__PURE__ */ e(bt, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(_n, { defaultTestData: y }) })
|
|
3151
3237
|
] }),
|
|
3152
3238
|
/* @__PURE__ */ e(
|
|
3153
|
-
|
|
3239
|
+
tt,
|
|
3154
3240
|
{
|
|
3155
3241
|
title: "导入组态方案",
|
|
3156
3242
|
open: u,
|
|
3157
3243
|
onOk: H,
|
|
3158
3244
|
onCancel: () => {
|
|
3159
|
-
|
|
3245
|
+
b(!1), x("");
|
|
3160
3246
|
},
|
|
3161
3247
|
width: 600,
|
|
3162
|
-
children: /* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3248
|
+
children: /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
3249
|
+
/* @__PURE__ */ c("div", { children: [
|
|
3164
3250
|
/* @__PURE__ */ e("p", { className: "mb-2", children: "选择 JSON 文件导入:" }),
|
|
3165
3251
|
/* @__PURE__ */ e(
|
|
3166
3252
|
"input",
|
|
3167
3253
|
{
|
|
3168
3254
|
type: "file",
|
|
3169
3255
|
accept: ".json",
|
|
3170
|
-
onChange: (
|
|
3171
|
-
const
|
|
3172
|
-
|
|
3256
|
+
onChange: (P) => {
|
|
3257
|
+
const T = P.target.files?.[0];
|
|
3258
|
+
T && Q(T);
|
|
3173
3259
|
},
|
|
3174
3260
|
className: `block w-full text-sm text-gray-500
|
|
3175
3261
|
file:mr-4 file:py-2 file:px-4
|
|
@@ -3181,13 +3267,13 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3181
3267
|
)
|
|
3182
3268
|
] }),
|
|
3183
3269
|
/* @__PURE__ */ e("div", { className: "text-center text-gray-400", children: "或" }),
|
|
3184
|
-
/* @__PURE__ */
|
|
3270
|
+
/* @__PURE__ */ c("div", { children: [
|
|
3185
3271
|
/* @__PURE__ */ e("p", { className: "mb-2", children: "粘贴 JSON 内容:" }),
|
|
3186
3272
|
/* @__PURE__ */ e(
|
|
3187
3273
|
"textarea",
|
|
3188
3274
|
{
|
|
3189
3275
|
value: s,
|
|
3190
|
-
onChange: (
|
|
3276
|
+
onChange: (P) => x(P.target.value),
|
|
3191
3277
|
placeholder: "粘贴 JSON 内容...",
|
|
3192
3278
|
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"
|
|
3193
3279
|
}
|
|
@@ -3201,14 +3287,14 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3201
3287
|
) }) });
|
|
3202
3288
|
};
|
|
3203
3289
|
export {
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3290
|
+
In as Canvas,
|
|
3291
|
+
Bn as ConfigEditor,
|
|
3292
|
+
yn as MaterialPanel,
|
|
3293
|
+
Lt as NodeRenderer,
|
|
3294
|
+
_n as PropertyPanel,
|
|
3295
|
+
gn as createDefaultNode,
|
|
3296
|
+
Dt as createDefaultStatus,
|
|
3297
|
+
pn as initMaterials,
|
|
3298
|
+
Ie as useEditorStore
|
|
3213
3299
|
};
|
|
3214
3300
|
//# sourceMappingURL=config-editor.es.js.map
|