jch-config-editor 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-editor.es.js +1223 -1134
- 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 q, useRef as ue, useMemo as xt, useCallback as G, useEffect as se } from "react";
|
|
3
|
+
import { Typography as wt, Upload as Ot, Button as j, Collapse as he, List as xe, Empty as ne, Tag as le, Image as Xt, Space as ae, Tooltip as we, Modal as tt, Form as v, Input as J, Divider as ye, Select as me, InputNumber as V, Tabs as St, Switch as Fe, message as De, ConfigProvider as zt, Layout as Qe } from "antd";
|
|
4
|
+
import { UploadOutlined as Ct, EditOutlined as nt, DeleteOutlined as qe, UndoOutlined as Rt, RedoOutlined as At, GroupOutlined as at, AlignLeftOutlined as jt, AlignRightOutlined as Ft, VerticalAlignTopOutlined as Wt, VerticalAlignBottomOutlined as Ut, ExperimentOutlined as qt, ZoomInOutlined as Gt, ZoomOutOutlined as Bt, SelectOutlined as Vt, DragOutlined as Ht, EyeOutlined as Zt, PlusOutlined as Nt, ArrowUpOutlined as It, ArrowDownOutlined as kt, CopyOutlined as Jt, DownloadOutlined as Kt } from "@ant-design/icons";
|
|
5
|
+
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 f(t) {
|
|
16
16
|
return t && t.__esModule ? t : {
|
|
17
17
|
default: t
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
n.exports =
|
|
21
|
-
})(
|
|
20
|
+
n.exports = f, 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,69 +43,69 @@ function tn() {
|
|
|
43
43
|
};
|
|
44
44
|
return Pe.default = n, Pe;
|
|
45
45
|
}
|
|
46
|
-
var Te = {}, $e = {}, _e = {},
|
|
47
|
-
function
|
|
48
|
-
return
|
|
46
|
+
var Te = {}, $e = {}, _e = {}, Ye = {}, st;
|
|
47
|
+
function an() {
|
|
48
|
+
return st || (st = 1, Object.defineProperty(Ye, "__esModule", {
|
|
49
49
|
value: !0
|
|
50
|
-
}),
|
|
50
|
+
}), Ye.commonLocale = void 0, Ye.commonLocale = {
|
|
51
51
|
yearFormat: "YYYY",
|
|
52
52
|
dayFormat: "D",
|
|
53
53
|
cellMeridiemFormat: "A",
|
|
54
54
|
monthBeforeYear: !0
|
|
55
|
-
}),
|
|
55
|
+
}), Ye;
|
|
56
56
|
}
|
|
57
|
-
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 h
|
|
63
|
+
var n = an();
|
|
64
|
+
function f(h) {
|
|
65
65
|
"@babel/helpers - typeof";
|
|
66
|
-
return
|
|
67
|
-
return typeof
|
|
68
|
-
} : function(
|
|
69
|
-
return
|
|
70
|
-
}, h
|
|
66
|
+
return f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(p) {
|
|
67
|
+
return typeof p;
|
|
68
|
+
} : function(p) {
|
|
69
|
+
return p && typeof Symbol == "function" && p.constructor === Symbol && p !== Symbol.prototype ? "symbol" : typeof p;
|
|
70
|
+
}, f(h);
|
|
71
71
|
}
|
|
72
|
-
function t(
|
|
73
|
-
var u = Object.keys(
|
|
72
|
+
function t(h, p) {
|
|
73
|
+
var u = Object.keys(h);
|
|
74
74
|
if (Object.getOwnPropertySymbols) {
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
return Object.getOwnPropertyDescriptor(
|
|
78
|
-
})), u.push.apply(u,
|
|
75
|
+
var b = Object.getOwnPropertySymbols(h);
|
|
76
|
+
p && (b = b.filter(function(s) {
|
|
77
|
+
return Object.getOwnPropertyDescriptor(h, 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(h) {
|
|
83
|
+
for (var p = 1; p < arguments.length; p++) {
|
|
84
|
+
var u = arguments[p] != null ? arguments[p] : {};
|
|
85
|
+
p % 2 ? t(Object(u), !0).forEach(function(b) {
|
|
86
|
+
d(h, b, u[b]);
|
|
87
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(h, Object.getOwnPropertyDescriptors(u)) : t(Object(u)).forEach(function(b) {
|
|
88
|
+
Object.defineProperty(h, b, Object.getOwnPropertyDescriptor(u, b));
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return h;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
93
|
+
function d(h, p, u) {
|
|
94
|
+
return p = l(p), p in h ? Object.defineProperty(h, p, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : h[p] = u, h;
|
|
95
95
|
}
|
|
96
|
-
function l(
|
|
97
|
-
var
|
|
98
|
-
return
|
|
96
|
+
function l(h) {
|
|
97
|
+
var p = a(h, "string");
|
|
98
|
+
return f(p) == "symbol" ? p : String(p);
|
|
99
99
|
}
|
|
100
|
-
function a(
|
|
101
|
-
if (h
|
|
102
|
-
var u =
|
|
100
|
+
function a(h, p) {
|
|
101
|
+
if (f(h) != "object" || !h) return h;
|
|
102
|
+
var u = h[Symbol.toPrimitive];
|
|
103
103
|
if (u !== void 0) {
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
104
|
+
var b = u.call(h, p);
|
|
105
|
+
if (f(b) != "object") return b;
|
|
106
106
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
107
107
|
}
|
|
108
|
-
return (
|
|
108
|
+
return (p === "string" ? String : Number)(h);
|
|
109
109
|
}
|
|
110
110
|
var o = r(r({}, n.commonLocale), {}, {
|
|
111
111
|
locale: "zh_CN",
|
|
@@ -137,27 +137,27 @@ function ln() {
|
|
|
137
137
|
});
|
|
138
138
|
return _e.default = o, _e;
|
|
139
139
|
}
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
if (
|
|
143
|
-
|
|
140
|
+
var Oe = {}, dt;
|
|
141
|
+
function Et() {
|
|
142
|
+
if (dt) return Oe;
|
|
143
|
+
dt = 1, Object.defineProperty(Oe, "__esModule", {
|
|
144
144
|
value: !0
|
|
145
|
-
}),
|
|
145
|
+
}), Oe.default = void 0;
|
|
146
146
|
const n = {
|
|
147
147
|
placeholder: "请选择时间",
|
|
148
148
|
rangePlaceholder: ["开始时间", "结束时间"]
|
|
149
149
|
};
|
|
150
|
-
return
|
|
150
|
+
return Oe.default = n, Oe;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
153
|
-
function
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
var n =
|
|
152
|
+
var ut;
|
|
153
|
+
function Mt() {
|
|
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 f = n(on()), t = n(/* @__PURE__ */ Et());
|
|
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
|
+
...f.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 f = n(/* @__PURE__ */ Mt());
|
|
190
|
+
return Te.default = f.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 f = n(rn()), t = n(/* @__PURE__ */ sn()), r = n(/* @__PURE__ */ Mt()), d = n(/* @__PURE__ */ Et());
|
|
201
201
|
const l = "${label}不是一个有效的${type}", a = {
|
|
202
202
|
locale: "zh-cn",
|
|
203
|
-
Pagination:
|
|
203
|
+
Pagination: f.default,
|
|
204
204
|
DatePicker: r.default,
|
|
205
|
-
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) => (f, t, r) => (r.setState = (d, l, ...a) => {
|
|
349
|
+
const o = typeof d == "function" ? en(d) : d;
|
|
350
|
+
return f(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, f, t) => ({
|
|
373
|
+
id: z(),
|
|
374
374
|
type: n,
|
|
375
|
-
targetId:
|
|
375
|
+
targetId: f,
|
|
376
376
|
payload: t,
|
|
377
377
|
timestamp: Date.now()
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
...
|
|
378
|
+
}), Ie = Qt()(
|
|
379
|
+
fn((n, f) => ({
|
|
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 && (
|
|
404
|
+
n((d) => {
|
|
405
|
+
const l = d.nodes.find((a) => a.id === t);
|
|
406
|
+
l && (l.contentInfo = { ...l.contentInfo, ...r }, d.history.past.push(ce("PROPERTY_CHANGE", t, { contentInfo: r })));
|
|
407
407
|
});
|
|
408
408
|
},
|
|
409
409
|
updateNodeControl: (t, r) => {
|
|
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((h) => h.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((h) => h.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 = f().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 = f();
|
|
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, f, 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((p) => ({
|
|
662
|
+
...p,
|
|
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((p) => {
|
|
668
|
+
const u = p.normalStyle.x || 0, b = p.normalStyle.y || 0, s = p.normalStyle.width || 0, x = p.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 h = r.map((p) => ({
|
|
672
|
+
...p,
|
|
673
673
|
normalStyle: {
|
|
674
|
-
...
|
|
675
|
-
x: (
|
|
676
|
-
y: (
|
|
674
|
+
...p.normalStyle,
|
|
675
|
+
x: (p.normalStyle.x || 0) - d,
|
|
676
|
+
y: (p.normalStyle.y || 0) - l,
|
|
677
677
|
scale: void 0
|
|
678
678
|
// 移除 scale,由父级容器统一控制
|
|
679
679
|
}
|
|
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: f
|
|
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: h
|
|
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: f,
|
|
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,32 +725,32 @@ 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: f,
|
|
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: h
|
|
739
|
+
} = Ie(), [p, u] = q([
|
|
740
740
|
"basic",
|
|
741
741
|
"device",
|
|
742
742
|
"text",
|
|
743
743
|
"line"
|
|
744
|
-
]),
|
|
745
|
-
const
|
|
746
|
-
return
|
|
747
|
-
const D =
|
|
748
|
-
|
|
744
|
+
]), b = (m) => {
|
|
745
|
+
const A = new FileReader();
|
|
746
|
+
return A.onload = (Y) => {
|
|
747
|
+
const D = Y.target?.result;
|
|
748
|
+
f({
|
|
749
749
|
name: m.name.replace(".svg", ""),
|
|
750
750
|
type: "IMAGE",
|
|
751
751
|
src: D
|
|
752
752
|
});
|
|
753
|
-
},
|
|
753
|
+
}, A.readAsDataURL(m), !1;
|
|
754
754
|
}, s = {
|
|
755
755
|
basic: n.filter(
|
|
756
756
|
(m) => ["矩形", "圆形", "圆角矩形"].includes(m.name)
|
|
@@ -764,59 +764,59 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
764
764
|
custom: n.filter(
|
|
765
765
|
(m) => m.type === "CUSTOM" && !m.config?.nodes || m.type === "IMAGE" && !["矩形", "圆形", "圆角矩形", "阀门", "泵", "罐体"].includes(m.name)
|
|
766
766
|
)
|
|
767
|
-
}, x = (m,
|
|
768
|
-
m.dataTransfer.effectAllowed = "copy", m.dataTransfer.setData("application/json", JSON.stringify(
|
|
769
|
-
const
|
|
767
|
+
}, x = (m, A) => {
|
|
768
|
+
m.dataTransfer.effectAllowed = "copy", m.dataTransfer.setData("application/json", JSON.stringify(A));
|
|
769
|
+
const Y = m.currentTarget.querySelector(
|
|
770
770
|
".material-preview"
|
|
771
771
|
);
|
|
772
|
-
|
|
773
|
-
},
|
|
772
|
+
Y && m.dataTransfer.setDragImage(Y, 20, 20);
|
|
773
|
+
}, y = (m) => {
|
|
774
774
|
m.type === "LINE" && o(m);
|
|
775
|
-
},
|
|
776
|
-
const
|
|
775
|
+
}, E = (m, A = !1) => {
|
|
776
|
+
const Y = A === !0, D = l === "line-draw" && Y && a.material?.id === m.id;
|
|
777
777
|
return /* @__PURE__ */ e(
|
|
778
|
-
|
|
778
|
+
xe.Item,
|
|
779
779
|
{
|
|
780
|
-
draggable: !
|
|
781
|
-
onDragStart: (
|
|
782
|
-
onClick: () =>
|
|
780
|
+
draggable: !Y,
|
|
781
|
+
onDragStart: (L) => x(L, m),
|
|
782
|
+
onClick: () => Y && y(m),
|
|
783
783
|
className: `
|
|
784
784
|
rounded-lg transition-all duration-200 select-none
|
|
785
|
-
${
|
|
785
|
+
${Y ? "cursor-pointer" : "cursor-move"}
|
|
786
786
|
hover:bg-gray-100
|
|
787
787
|
${D ? "bg-blue-50 ring-2 ring-blue-400" : ""}
|
|
788
788
|
`,
|
|
789
789
|
actions: [
|
|
790
|
-
|
|
791
|
-
|
|
790
|
+
Y ? /* @__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(m);
|
|
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(qe, {}),
|
|
810
|
+
onClick: (L) => {
|
|
811
|
+
L.stopPropagation(), t(m.id);
|
|
812
812
|
}
|
|
813
813
|
},
|
|
814
814
|
"delete"
|
|
815
815
|
)
|
|
816
816
|
].filter(Boolean),
|
|
817
|
-
children: /* @__PURE__ */
|
|
817
|
+
children: /* @__PURE__ */ c("div", { className: `flex items-center gap-3 w-full py-2 ${Y ? "" : "pointer-events-none"}`, children: [
|
|
818
818
|
/* @__PURE__ */ e("div", { className: "material-preview w-12 h-12 flex items-center justify-center bg-white rounded border border-gray-200", children: m.type === "IMAGE" && m.src ? /* @__PURE__ */ e(
|
|
819
|
-
|
|
819
|
+
Xt,
|
|
820
820
|
{
|
|
821
821
|
src: m.src,
|
|
822
822
|
alt: m.name,
|
|
@@ -825,11 +825,11 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
825
825
|
preview: !1
|
|
826
826
|
}
|
|
827
827
|
) : m.type === "TEXT" ? /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "T" }) : m.type === "LINE" ? /* @__PURE__ */ e("div", { className: "w-8 h-0.5 bg-gray-400" }) : m.type === "CUSTOM" && m.config?.nodes ? /* @__PURE__ */ e("span", { className: "text-xs text-blue-500 font-bold", children: "G" }) : /* @__PURE__ */ e("span", { className: "text-xs text-gray-500", children: "?" }) }),
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */ e(
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */ e(
|
|
832
|
-
D && /* @__PURE__ */ e(
|
|
828
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
829
|
+
/* @__PURE__ */ e(We, { strong: !0, className: "block truncate", children: m.name }),
|
|
830
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
831
|
+
/* @__PURE__ */ e(We, { type: "secondary", className: "text-xs", children: m.type }),
|
|
832
|
+
D && /* @__PURE__ */ e(le, { color: "blue", className: "text-xs", children: "绘制中" })
|
|
833
833
|
] })
|
|
834
834
|
] })
|
|
835
835
|
] })
|
|
@@ -837,101 +837,101 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
837
837
|
m.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
|
+
Ot,
|
|
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:
|
|
857
|
+
activeKey: p,
|
|
858
858
|
onChange: (m) => u(m),
|
|
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: (m) =>
|
|
866
|
+
renderItem: (m) => E(m, !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: (m) =>
|
|
882
|
+
renderItem: (m) => E(m, !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: (m) =>
|
|
898
|
+
renderItem: (m) => E(m, !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: (m) =>
|
|
922
|
+
renderItem: (m) => E(m, !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: (m) =>
|
|
946
|
+
renderItem: (m) => E(m, !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: (m) =>
|
|
962
|
+
renderItem: (m) => E(m, !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, f) => {
|
|
980
980
|
try {
|
|
981
|
-
const t =
|
|
981
|
+
const t = f && Array.isArray(f) ? f.map((l, a) => l.paramsName) : ["A"], d = new Function(...t, n.expression)(...f.map((l) => l.value));
|
|
982
982
|
return console.log(
|
|
983
983
|
`Evaluating status [${n.name}] with data:`,
|
|
984
|
-
|
|
984
|
+
f,
|
|
985
985
|
"Result:",
|
|
986
|
-
|
|
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, f) => {
|
|
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(f) ? (console.log(t.bindCodes, "bindCodes"), r = f.filter(
|
|
996
|
+
(d) => t.bindCodes?.includes(d.paramsCode)
|
|
997
|
+
)) : r = f, vn(t, r))
|
|
998
998
|
return t;
|
|
999
999
|
}
|
|
1000
|
-
},
|
|
1001
|
-
if (!
|
|
1000
|
+
}, xn = (n, f) => {
|
|
1001
|
+
if (!f || !n)
|
|
1002
1002
|
return { value: void 0 };
|
|
1003
1003
|
if (Array.isArray(n)) {
|
|
1004
|
-
const t = n.find((r) => r.paramsCode ===
|
|
1004
|
+
const t = n.find((r) => r.paramsCode === f);
|
|
1005
1005
|
if (t)
|
|
1006
1006
|
return {
|
|
1007
1007
|
value: t.value,
|
|
1008
1008
|
unit: t.unit
|
|
1009
1009
|
};
|
|
1010
|
-
} else if (typeof n == "object" &&
|
|
1010
|
+
} else if (typeof n == "object" && f in n)
|
|
1011
1011
|
return {
|
|
1012
|
-
value: n[
|
|
1012
|
+
value: n[f],
|
|
1013
1013
|
unit: n.unit
|
|
1014
1014
|
};
|
|
1015
1015
|
return { value: void 0 };
|
|
1016
|
-
},
|
|
1016
|
+
}, wn = (n, f) => {
|
|
1017
1017
|
if (n == null) return "";
|
|
1018
|
-
if (
|
|
1018
|
+
if (f === -1) return String(n);
|
|
1019
1019
|
const t = Number(n);
|
|
1020
|
-
return isNaN(t) ? String(n) : t.toFixed(
|
|
1021
|
-
},
|
|
1020
|
+
return isNaN(t) ? String(n) : t.toFixed(f ?? 2);
|
|
1021
|
+
}, Sn = (n, f, t, r) => {
|
|
1022
1022
|
switch (n.type) {
|
|
1023
1023
|
case "IMAGE":
|
|
1024
|
-
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: h,
|
|
1042
|
+
unit: p,
|
|
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: E } = h ? xn(f, h) : { value: void 0, unit: void 0 }, A = wn(y !== void 0 ? y : o, u), Y = p || E || "";
|
|
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
|
+
Y ? ` ${Y}` : ""
|
|
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:
|
|
1087
|
+
thickness: L = 2,
|
|
1088
1088
|
color: O = "#d9d9d9",
|
|
1089
|
-
dashed:
|
|
1090
|
-
lineType: H =
|
|
1091
|
-
lineWeight:
|
|
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 M = Math.max(Q, 1);
|
|
1099
|
+
switch (w) {
|
|
1100
1100
|
case "solid":
|
|
1101
1101
|
return "";
|
|
1102
1102
|
case "dashed":
|
|
1103
|
-
return `${
|
|
1103
|
+
return `${M * 8},${M * 4}`;
|
|
1104
1104
|
case "center":
|
|
1105
|
-
return `${
|
|
1105
|
+
return `${M * 12},${M * 3},${M * 2},${M * 3}`;
|
|
1106
1106
|
case "phantom":
|
|
1107
|
-
return `${
|
|
1107
|
+
return `${M * 12},${M * 3},${M * 2},${M * 3},${M * 2},${M * 3}`;
|
|
1108
1108
|
case "dot":
|
|
1109
|
-
return `${
|
|
1109
|
+
return `${M},${M * 3}`;
|
|
1110
1110
|
case "dash-dot":
|
|
1111
|
-
return `${
|
|
1111
|
+
return `${M * 8},${M * 3},${M},${M * 3}`;
|
|
1112
1112
|
default:
|
|
1113
1113
|
return "";
|
|
1114
1114
|
}
|
|
1115
|
-
})(H),
|
|
1116
|
-
return /* @__PURE__ */ e("div", { className: "w-full h-full relative", style: { overflow: "visible" }, children: /* @__PURE__ */
|
|
1115
|
+
})(H), k = t ? "#1890ff" : O;
|
|
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 M = w.target.closest("[data-node-id]");
|
|
1139
|
+
M && M.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: f = !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: h, controlInfo: p } = n, { statusList: u } = h, { isClickable: b, isDraggable: s } = p, [x, y] = q(null), [E, m] = q({ x: 0, y: 0 }), A = ue(null), Y = xt(() => {
|
|
1177
1177
|
if (u.length === 0) return;
|
|
1178
|
-
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 = Y?.material, L = D?.type === "LINE", O = L ? D.config : null, ie = o.scale ?? 1, H = (o.width || 100) * ie, Q = (o.height || 100) * ie, F = G((i, k) => {
|
|
1181
|
+
i.stopPropagation(), i.preventDefault(), y(k), m({ x: i.clientX, y: i.clientY });
|
|
1182
1182
|
}, []);
|
|
1183
|
-
|
|
1184
|
-
if (!x || !
|
|
1185
|
-
const i = (
|
|
1186
|
-
const
|
|
1187
|
-
let Z =
|
|
1188
|
-
x === "start" ? (Z =
|
|
1189
|
-
const
|
|
1183
|
+
se(() => {
|
|
1184
|
+
if (!x || !L || !O || !l) return;
|
|
1185
|
+
const i = (S) => {
|
|
1186
|
+
const w = (S.clientX - E.x) / a, M = (S.clientY - E.y) / a, Xe = O.startX || 0, Ce = O.startY || 0, ze = O.endX || 0, Re = O.endY || 0;
|
|
1187
|
+
let Z = Xe, ee = Ce, te = ze, oe = Re, ke = o.x || 0, Ee = o.y || 0;
|
|
1188
|
+
x === "start" ? (Z = Xe + w, ee = Ce + M, Z < 0 && (ke += Z, te -= Z, Z = 0), ee < 0 && (Ee += ee, oe -= ee, ee = 0)) : (te = ze + w, oe = Re + M, te < 0 && (ke += te, Z -= te, te = 0), oe < 0 && (Ee += oe, ee -= oe, oe = 0));
|
|
1189
|
+
const Ae = Math.max((O.lineWeight || 2) * 2, 4), Ge = Math.max(Z, te), Be = Math.max(ee, oe), Ve = Math.max(Ge, Ae), He = Math.max(Be, Ae);
|
|
1190
1190
|
l(n.id, {
|
|
1191
1191
|
normalStyle: {
|
|
1192
1192
|
...o,
|
|
1193
|
-
x:
|
|
1194
|
-
y:
|
|
1195
|
-
width:
|
|
1196
|
-
height:
|
|
1193
|
+
x: ke,
|
|
1194
|
+
y: Ee,
|
|
1195
|
+
width: Ve,
|
|
1196
|
+
height: He
|
|
1197
1197
|
},
|
|
1198
1198
|
contentInfo: {
|
|
1199
|
-
...
|
|
1200
|
-
statusList: u.map((
|
|
1201
|
-
...
|
|
1202
|
-
material:
|
|
1203
|
-
...
|
|
1199
|
+
...h,
|
|
1200
|
+
statusList: u.map((ve) => ({
|
|
1201
|
+
...ve,
|
|
1202
|
+
material: ve.material.type === "LINE" ? {
|
|
1203
|
+
...ve.material,
|
|
1204
1204
|
config: {
|
|
1205
1205
|
...O,
|
|
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
|
-
}), m({ x:
|
|
1215
|
-
},
|
|
1216
|
-
|
|
1214
|
+
}), m({ 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, E, L, O, n.id, o, h, 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: f && !L ? "2px solid #1890ff" : L || P ? "none" : o.border || "1px dashed transparent",
|
|
1239
1239
|
// 线条节点需要捕获点击事件,但由内部 SVG 的透明线处理具体点击区域
|
|
1240
1240
|
pointerEvents: "auto",
|
|
1241
1241
|
opacity: o.opacity ?? 1,
|
|
1242
1242
|
transform: o.transform,
|
|
1243
|
-
zIndex:
|
|
1244
|
-
cursor: s && !x ? "move" :
|
|
1243
|
+
zIndex: f ? 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 = O ? { x: O.startX || 0, y: O.startY || 0 } : { x: 0, y: 0 }, R = O ? { x: O.endX || 0, y: O.endY || 0 } : { x: 0, y: 0 };
|
|
1249
|
+
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
|
+
f && !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
|
+
Y ? `(${Y.name})` : ""
|
|
1273
1273
|
] })
|
|
1274
1274
|
] }),
|
|
1275
|
-
|
|
1275
|
+
f && L && O && l && /* @__PURE__ */ c(Se, { children: [
|
|
1276
1276
|
/* @__PURE__ */ e(
|
|
1277
1277
|
"div",
|
|
1278
1278
|
{
|
|
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, f) }) : P ? null : (
|
|
1305
1305
|
// 只有非群组节点才显示"无状态"
|
|
1306
1306
|
/* @__PURE__ */ e("div", { className: "w-full h-full flex items-center justify-center text-gray-300 text-xs", children: "无状态" })
|
|
1307
1307
|
) }),
|
|
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:
|
|
1321
|
+
}, Lt = de.memo(Cn, (n, f) => {
|
|
1322
|
+
const t = n.node, r = f.node, d = t.id === r.id && t.normalStyle.x === r.normalStyle.x && t.normalStyle.y === r.normalStyle.y && t.normalStyle.width === r.normalStyle.width && t.normalStyle.height === r.normalStyle.height, l = t.contentInfo === r.contentInfo, a = n.isSelected === f.isSelected && n.scale === f.scale;
|
|
1323
|
+
return d && l && a;
|
|
1324
|
+
}), { TextArea: Nn } = J, In = ({ defaultTestData: n }) => {
|
|
1325
|
+
const f = ue(null), t = ue(null), r = ue(null), {
|
|
1326
|
+
nodes: d,
|
|
1327
|
+
selectedNodeId: l,
|
|
1328
|
+
mode: a,
|
|
1329
|
+
lineDrawing: o,
|
|
1330
|
+
viewport: h,
|
|
1331
1331
|
setViewport: p,
|
|
1332
|
-
addNode:
|
|
1333
|
-
selectNode:
|
|
1334
|
-
updateNode:
|
|
1335
|
-
removeNode:
|
|
1336
|
-
undo:
|
|
1337
|
-
redo:
|
|
1338
|
-
setMode:
|
|
1339
|
-
startLineDrawing:
|
|
1340
|
-
endLineDrawing:
|
|
1341
|
-
cancelLineDrawing:
|
|
1342
|
-
} =
|
|
1332
|
+
addNode: u,
|
|
1333
|
+
selectNode: b,
|
|
1334
|
+
updateNode: s,
|
|
1335
|
+
removeNode: x,
|
|
1336
|
+
undo: y,
|
|
1337
|
+
redo: E,
|
|
1338
|
+
setMode: m,
|
|
1339
|
+
startLineDrawing: A,
|
|
1340
|
+
endLineDrawing: Y,
|
|
1341
|
+
cancelLineDrawing: D
|
|
1342
|
+
} = Ie(), [L, O] = q(!1), [, ie] = q({}), H = ue(!1), Q = ue({ x: 0, y: 0 }), F = ue({ x: 0, y: 0, newX: 0, newY: 0 }), P = ue(null), [T, B] = q({ start: null, end: null, isDrawing: !1 }), [R, i] = q(!1), [k, S] = q({ start: null, end: null }), [w, M] = q([]), [Xe, Ce] = q(!1), [ze, Re] = q(
|
|
1343
1343
|
JSON.stringify(n, null, 2)
|
|
1344
|
-
),
|
|
1344
|
+
), Z = G((g, 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 = f.current?.state, N = C?.scale ?? h.scale, _ = C?.positionX ?? h.positionX, U = C?.positionY ?? h.positionY, $ = g - X.left, W = I - X.top, K = ($ - _) / N, re = (W - U) / N;
|
|
1347
|
+
return { x: Math.round(K), y: Math.round(re) };
|
|
1348
|
+
}, [h.scale, h.positionX, h.positionY]), ee = G((g, I) => {
|
|
1349
|
+
const X = t.current;
|
|
1350
|
+
if (!X) return { x: 0, y: 0 };
|
|
1351
|
+
const C = X.getBoundingClientRect(), _ = f.current?.state?.scale ?? 1, U = g - C.left, $ = I - C.top, W = U / _, K = $ / _;
|
|
1352
|
+
return { x: Math.round(W), y: Math.round(K) };
|
|
1353
|
+
}, []), te = G(
|
|
1354
|
+
(g, I, X = !0) => {
|
|
1355
|
+
if (!o.material) return;
|
|
1356
|
+
const C = o.material, N = C.config || {}, _ = N.lineWeight || N.thickness || 2, U = Math.min(g.x, I.x), $ = Math.min(g.y, I.y), W = Math.round(g.x - U), K = Math.round(g.y - $), re = Math.round(I.x - U), fe = Math.round(I.y - $), be = Math.max(_ * 2, 4), pe = Math.max(Math.abs(g.x - I.x), be), je = Math.max(Math.abs(g.y - I.y), be), _t = {
|
|
1357
|
+
...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
|
+
}, Yt = {
|
|
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(Yt, !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 }), Y();
|
|
1395
1400
|
},
|
|
1396
|
-
[
|
|
1397
|
-
),
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
-
scale:
|
|
1401
|
-
positionX:
|
|
1402
|
-
positionY:
|
|
1401
|
+
[o.material, u, Y]
|
|
1402
|
+
), oe = G(() => {
|
|
1403
|
+
const g = f.current?.state;
|
|
1404
|
+
g && p({
|
|
1405
|
+
scale: g.scale,
|
|
1406
|
+
positionX: g.positionX,
|
|
1407
|
+
positionY: g.positionY
|
|
1403
1408
|
});
|
|
1404
|
-
}, [p]),
|
|
1405
|
-
(
|
|
1406
|
-
|
|
1409
|
+
}, [p]), ke = G(
|
|
1410
|
+
(g) => {
|
|
1411
|
+
H.current || R || (g.target === t.current || g.target.dataset?.canvas === "true") && (b(null), M([]));
|
|
1407
1412
|
},
|
|
1408
|
-
[
|
|
1409
|
-
),
|
|
1410
|
-
(
|
|
1411
|
-
if (
|
|
1412
|
-
|
|
1413
|
-
|
|
1413
|
+
[b, R]
|
|
1414
|
+
), Ee = G(
|
|
1415
|
+
(g) => {
|
|
1416
|
+
if (g.button === 0) {
|
|
1417
|
+
if (a === "line-draw" && o.material) {
|
|
1418
|
+
const I = Z(g.clientX, g.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(g.clientX, g.clientY);
|
|
1424
|
+
S({ start: I, end: I }), M([]), g.preventDefault(), g.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 = G(
|
|
1430
|
+
(g) => {
|
|
1431
|
+
if (!(a !== "line-draw" || !o.material) && T.isDrawing && T.start) {
|
|
1432
|
+
const I = Z(g.clientX, g.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
|
+
), Ge = G((g) => {
|
|
1438
|
+
g.preventDefault(), g.dataTransfer.dropEffect = "copy", O(!0);
|
|
1439
|
+
}, []), Be = G((g) => {
|
|
1440
|
+
g.preventDefault(), O(!1);
|
|
1441
|
+
}, []), Ve = G(
|
|
1442
|
+
(g) => {
|
|
1443
|
+
if (g.preventDefault(), O(!1), !(!t.current || a !== "select"))
|
|
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 = g.dataTransfer.getData("application/json");
|
|
1446
|
+
if (!I) return;
|
|
1447
|
+
const X = JSON.parse(I), C = t.current.getBoundingClientRect(), N = f.current?.state, _ = N?.scale ?? h.scale, U = N?.positionX ?? h.positionX, $ = N?.positionY ?? h.positionY, W = (g.clientX - C.left - U) / _ - 50, K = (g.clientY - C.top - $) / _ - 50, re = gn(W, K, X);
|
|
1448
|
+
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, h, u]
|
|
1454
|
+
), He = G(
|
|
1455
|
+
(g, I) => {
|
|
1456
|
+
a !== "select" || !I.controlInfo.isDraggable || (g.stopPropagation(), b(I.id), H.current = !0, Q.current = { x: g.clientX, y: g.clientY }, F.current = {
|
|
1457
|
+
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, g.preventDefault());
|
|
1449
1462
|
},
|
|
1450
|
-
[
|
|
1463
|
+
[a, b]
|
|
1451
1464
|
);
|
|
1452
|
-
|
|
1453
|
-
const
|
|
1454
|
-
if (
|
|
1465
|
+
se(() => {
|
|
1466
|
+
const g = (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
|
+
M($), 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)), M([]))), C.ctrlKey && C.key === "z" && (C.preventDefault(), y()), C.ctrlKey && C.key === "y" && (C.preventDefault(), E());
|
|
1483
1502
|
};
|
|
1484
|
-
return window.addEventListener("mousemove",
|
|
1485
|
-
window.removeEventListener("mousemove",
|
|
1503
|
+
return window.addEventListener("mousemove", g), window.addEventListener("mouseup", I), window.addEventListener("keydown", X), () => {
|
|
1504
|
+
window.removeEventListener("mousemove", g), window.removeEventListener("mouseup", I), window.removeEventListener("keydown", X);
|
|
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
|
+
E,
|
|
1517
|
+
D,
|
|
1518
|
+
Z,
|
|
1519
|
+
ee,
|
|
1520
|
+
M
|
|
1499
1521
|
]);
|
|
1500
|
-
const ve = G(
|
|
1501
|
-
(
|
|
1502
|
-
|
|
1503
|
-
|
|
1522
|
+
const ve = G(() => {
|
|
1523
|
+
if (w.length < 2) return;
|
|
1524
|
+
const g = w.map(($) => d.find((W) => W.id === $)).filter(($) => !!$ && $.type !== "group");
|
|
1525
|
+
if (g.length < 2) return;
|
|
1526
|
+
let I = 1 / 0, X = 1 / 0, C = -1 / 0, N = -1 / 0;
|
|
1527
|
+
g.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 _ = g.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), M([]), b(U.id);
|
|
1562
|
+
}, [w, d, x, u, b]), Me = G(
|
|
1563
|
+
(g) => {
|
|
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 (g) {
|
|
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 (g) {
|
|
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
|
+
m("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
|
+
m("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
|
+
m("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
|
+
m("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: E },
|
|
1645
|
+
{
|
|
1646
|
+
icon: /* @__PURE__ */ e(at, {}),
|
|
1647
|
+
title: "框选模式",
|
|
1648
|
+
active: R,
|
|
1649
|
+
onClick: () => {
|
|
1650
|
+
const g = !R;
|
|
1651
|
+
i(g), m("select"), g && M([]);
|
|
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: () => Me("left")
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
icon: /* @__PURE__ */ e(Ft, {}),
|
|
1668
|
+
title: "右对齐",
|
|
1669
|
+
disabled: w.length < 2,
|
|
1670
|
+
onClick: () => Me("right")
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
icon: /* @__PURE__ */ e(Wt, {}),
|
|
1674
|
+
title: "上对齐",
|
|
1675
|
+
disabled: w.length < 2,
|
|
1676
|
+
onClick: () => Me("top")
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
icon: /* @__PURE__ */ e(Ut, {}),
|
|
1680
|
+
title: "下对齐",
|
|
1681
|
+
disabled: w.length < 2,
|
|
1682
|
+
onClick: () => Me("bottom")
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
icon: /* @__PURE__ */ e(qt, {}),
|
|
1686
|
+
title: "数据模拟",
|
|
1687
|
+
type: "primary",
|
|
1688
|
+
onClick: () => Ce(!0)
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
1692
|
+
title: "删除选中 (Delete)",
|
|
1693
|
+
disabled: !l && w.length === 0,
|
|
1694
|
+
onClick: () => {
|
|
1695
|
+
l ? x(l) : w.length > 0 && (w.forEach((g) => x(g)), M([]));
|
|
1696
|
+
}
|
|
1626
1697
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1698
|
+
],
|
|
1699
|
+
[
|
|
1700
|
+
y,
|
|
1701
|
+
E,
|
|
1702
|
+
R,
|
|
1703
|
+
i,
|
|
1704
|
+
m,
|
|
1705
|
+
M,
|
|
1706
|
+
w,
|
|
1707
|
+
ve,
|
|
1708
|
+
Me,
|
|
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((g) => /* @__PURE__ */ e(we, { title: g.title, children: /* @__PURE__ */ e(
|
|
1717
|
+
j,
|
|
1633
1718
|
{
|
|
1634
|
-
type:
|
|
1635
|
-
icon:
|
|
1636
|
-
onClick:
|
|
1719
|
+
type: g.active ? "primary" : "default",
|
|
1720
|
+
icon: g.icon,
|
|
1721
|
+
onClick: g.onClick
|
|
1637
1722
|
}
|
|
1638
|
-
) },
|
|
1639
|
-
/* @__PURE__ */ e(
|
|
1640
|
-
|
|
1723
|
+
) }, g.title)) }),
|
|
1724
|
+
/* @__PURE__ */ e(ae, { children: $t.map((g) => /* @__PURE__ */ e(we, { title: g.title, children: /* @__PURE__ */ e(
|
|
1725
|
+
j,
|
|
1641
1726
|
{
|
|
1642
|
-
type:
|
|
1643
|
-
icon:
|
|
1644
|
-
onClick:
|
|
1645
|
-
disabled:
|
|
1727
|
+
type: g.active ? "primary" : g.type || "default",
|
|
1728
|
+
icon: g.icon,
|
|
1729
|
+
onClick: g.onClick,
|
|
1730
|
+
disabled: g.disabled
|
|
1646
1731
|
}
|
|
1647
|
-
) },
|
|
1732
|
+
) }, g.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: f,
|
|
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: g, 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(Gt, {}), onClick: () => g() }) }),
|
|
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(h.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: Ee,
|
|
1780
|
+
onDoubleClick: Ae,
|
|
1781
|
+
onDragOver: Ge,
|
|
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: (g) => Re(g.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: f,
|
|
1788
1874
|
onChangeComplete: t
|
|
1789
1875
|
}) => {
|
|
1790
|
-
const [r,
|
|
1791
|
-
|
|
1876
|
+
const [r, d] = q(!1), [l, a] = q(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 p = (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", p), () => document.removeEventListener("mousedown", p);
|
|
1798
1884
|
}, [r, t, l]);
|
|
1799
|
-
const
|
|
1800
|
-
a(
|
|
1885
|
+
const h = (p) => {
|
|
1886
|
+
a(p), f?.({ toHexString: () => p });
|
|
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((p) => /* @__PURE__ */ e(
|
|
1833
1919
|
"div",
|
|
1834
1920
|
{
|
|
1835
1921
|
onClick: () => {
|
|
1836
|
-
p
|
|
1922
|
+
h(p), d(!1), t?.({ toHexString: () => p });
|
|
1837
1923
|
},
|
|
1838
1924
|
style: {
|
|
1839
1925
|
width: 20,
|
|
1840
1926
|
height: 20,
|
|
1841
|
-
backgroundColor:
|
|
1842
|
-
border: l ===
|
|
1927
|
+
backgroundColor: p,
|
|
1928
|
+
border: l === p ? "2px solid #1890ff" : "1px solid #d9d9d9",
|
|
1843
1929
|
borderRadius: 2,
|
|
1844
1930
|
cursor: "pointer"
|
|
1845
1931
|
}
|
|
1846
1932
|
},
|
|
1847
|
-
|
|
1933
|
+
p
|
|
1848
1934
|
)) }),
|
|
1849
1935
|
/* @__PURE__ */ e(
|
|
1850
1936
|
"input",
|
|
1851
1937
|
{
|
|
1852
1938
|
type: "color",
|
|
1853
1939
|
value: l,
|
|
1854
|
-
onChange: (
|
|
1940
|
+
onChange: (p) => h(p.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, En = ({
|
|
1870
1956
|
material: n,
|
|
1871
|
-
onSave:
|
|
1957
|
+
onSave: f,
|
|
1872
1958
|
bindCodes: t = [],
|
|
1873
1959
|
dataOptions: r = []
|
|
1874
1960
|
}) => {
|
|
1875
|
-
const l = n.content || {}, [a, o] =
|
|
1961
|
+
const l = n.content || {}, [a, o] = q({
|
|
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 h = (s, x) => {
|
|
1990
|
+
o((y) => ({ ...y, [s]: x }));
|
|
1991
|
+
}, p = (s) => {
|
|
1992
|
+
const x = r.find((E) => E.paramsCode === s), y = x?.unit || "";
|
|
1993
|
+
o((E) => ({
|
|
1994
|
+
...E,
|
|
1909
1995
|
valueSourceCode: s,
|
|
1910
|
-
unit:
|
|
1996
|
+
unit: y,
|
|
1911
1997
|
value: String(x?.value || "")
|
|
1912
1998
|
})), setTimeout(() => {
|
|
1913
|
-
|
|
1999
|
+
f({
|
|
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
|
+
f({
|
|
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) => h("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: p,
|
|
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) => h("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) => h("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) => h("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) => h("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
|
+
h("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
|
+
h("labelColor", s.toHexString());
|
|
2062
2148
|
},
|
|
2063
2149
|
onChangeComplete: (s) => {
|
|
2064
|
-
|
|
2150
|
+
f({
|
|
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) => h("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) => h("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
|
+
h("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
|
+
h("valueColor", s.toHexString());
|
|
2134
2220
|
},
|
|
2135
2221
|
onChangeComplete: (s) => {
|
|
2136
|
-
|
|
2222
|
+
f({
|
|
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) => h("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
|
+
}, Mn = ({
|
|
2173
2259
|
material: n,
|
|
2174
|
-
onSave:
|
|
2260
|
+
onSave: f
|
|
2175
2261
|
}) => {
|
|
2176
|
-
const t = n, [r,
|
|
2262
|
+
const t = n, [r, d] = q({
|
|
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, h) => {
|
|
2273
|
+
d((p) => ({ ...p, [o]: h }));
|
|
2188
2274
|
}, a = () => {
|
|
2189
|
-
|
|
2275
|
+
f({
|
|
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: f
|
|
2220
2306
|
}) => {
|
|
2221
|
-
const t = n.config || {}, [r,
|
|
2307
|
+
const t = n.config || {}, [r, d] = q({
|
|
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 h = { ...r, ...o };
|
|
2329
|
+
d(h), f({
|
|
2244
2330
|
config: {
|
|
2245
2331
|
...t,
|
|
2246
|
-
thickness:
|
|
2247
|
-
lineWeight:
|
|
2248
|
-
color:
|
|
2249
|
-
lineType:
|
|
2250
|
-
startX:
|
|
2251
|
-
startY:
|
|
2252
|
-
endX:
|
|
2253
|
-
endY:
|
|
2332
|
+
thickness: h.lineWeight,
|
|
2333
|
+
lineWeight: h.lineWeight,
|
|
2334
|
+
color: h.color,
|
|
2335
|
+
lineType: h.lineType,
|
|
2336
|
+
startX: h.startX,
|
|
2337
|
+
startY: h.startY,
|
|
2338
|
+
endX: h.endX,
|
|
2339
|
+
endY: h.endY
|
|
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,39 +2426,42 @@ 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: () => {
|
|
2349
|
-
|
|
2435
|
+
const o = t.startY ?? r.startY;
|
|
2436
|
+
l({ endY: o });
|
|
2350
2437
|
},
|
|
2351
2438
|
title: "将线条变为水平线",
|
|
2352
2439
|
children: "水平"
|
|
2353
2440
|
}
|
|
2354
2441
|
),
|
|
2355
2442
|
/* @__PURE__ */ e(
|
|
2356
|
-
|
|
2443
|
+
j,
|
|
2357
2444
|
{
|
|
2358
2445
|
size: "small",
|
|
2359
2446
|
onClick: () => {
|
|
2360
|
-
|
|
2447
|
+
const o = t.startX ?? r.startX;
|
|
2448
|
+
l({ endX: o });
|
|
2361
2449
|
},
|
|
2362
2450
|
title: "将线条变为垂直线",
|
|
2363
2451
|
children: "垂直"
|
|
2364
2452
|
}
|
|
2365
2453
|
),
|
|
2366
2454
|
/* @__PURE__ */ e(
|
|
2367
|
-
|
|
2455
|
+
j,
|
|
2368
2456
|
{
|
|
2369
2457
|
size: "small",
|
|
2370
2458
|
onClick: () => {
|
|
2459
|
+
const o = t.startX ?? r.startX, h = t.startY ?? r.startY, p = t.endX ?? r.endX, u = t.endY ?? r.endY;
|
|
2371
2460
|
l({
|
|
2372
|
-
startX:
|
|
2373
|
-
startY:
|
|
2374
|
-
endX:
|
|
2375
|
-
endY:
|
|
2461
|
+
startX: p,
|
|
2462
|
+
startY: u,
|
|
2463
|
+
endX: o,
|
|
2464
|
+
endY: h
|
|
2376
2465
|
});
|
|
2377
2466
|
},
|
|
2378
2467
|
title: "交换起点和终点",
|
|
@@ -2382,223 +2471,223 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2382
2471
|
] }) })
|
|
2383
2472
|
] })
|
|
2384
2473
|
] });
|
|
2385
|
-
},
|
|
2474
|
+
}, Pt = ({
|
|
2386
2475
|
material: n,
|
|
2387
|
-
onSave:
|
|
2476
|
+
onSave: f,
|
|
2388
2477
|
bindCodes: t,
|
|
2389
2478
|
dataOptions: r
|
|
2390
2479
|
}) => {
|
|
2391
2480
|
switch (n.type) {
|
|
2392
2481
|
case "TEXT":
|
|
2393
2482
|
return /* @__PURE__ */ e(
|
|
2394
|
-
|
|
2483
|
+
En,
|
|
2395
2484
|
{
|
|
2396
2485
|
material: n,
|
|
2397
|
-
onSave:
|
|
2486
|
+
onSave: f,
|
|
2398
2487
|
bindCodes: t,
|
|
2399
2488
|
dataOptions: r
|
|
2400
2489
|
}
|
|
2401
2490
|
);
|
|
2402
2491
|
case "IMAGE":
|
|
2403
|
-
return /* @__PURE__ */ e(
|
|
2492
|
+
return /* @__PURE__ */ e(Mn, { material: n, onSave: f });
|
|
2404
2493
|
case "LINE":
|
|
2405
|
-
return /* @__PURE__ */ e(
|
|
2494
|
+
return /* @__PURE__ */ e(Ln, { material: n, onSave: f });
|
|
2406
2495
|
default:
|
|
2407
2496
|
return /* @__PURE__ */ e("div", { className: "text-center text-gray-400 py-8", children: "暂不支持编辑此类型的物料" });
|
|
2408
2497
|
}
|
|
2409
|
-
}, { Panel:
|
|
2498
|
+
}, { Panel: yt } = he, { TextArea: Pn } = J, Tn = ({
|
|
2410
2499
|
node: n,
|
|
2411
|
-
updateNode:
|
|
2500
|
+
updateNode: f,
|
|
2412
2501
|
materials: t
|
|
2413
2502
|
}) => {
|
|
2414
|
-
const r = t.filter((u) => u.type !== "CUSTOM" || !u.config?.nodes),
|
|
2503
|
+
const r = t.filter((u) => u.type !== "CUSTOM" || !u.config?.nodes), d = (u, b) => {
|
|
2415
2504
|
const s = n.children?.map((x) => x.id === u ? {
|
|
2416
2505
|
...x,
|
|
2417
2506
|
contentInfo: {
|
|
2418
2507
|
...x.contentInfo,
|
|
2419
|
-
statusList:
|
|
2508
|
+
statusList: b
|
|
2420
2509
|
}
|
|
2421
2510
|
} : x);
|
|
2422
|
-
|
|
2511
|
+
f(n.id, {
|
|
2423
2512
|
children: s
|
|
2424
2513
|
});
|
|
2425
2514
|
}, l = (u) => {
|
|
2426
|
-
const
|
|
2427
|
-
if (!
|
|
2515
|
+
const b = n.children?.find((x) => x.id === u);
|
|
2516
|
+
if (!b) return;
|
|
2428
2517
|
const s = {
|
|
2429
|
-
id:
|
|
2430
|
-
name: `状态${
|
|
2431
|
-
expression:
|
|
2432
|
-
material: { ...r[0], id:
|
|
2518
|
+
id: z(),
|
|
2519
|
+
name: `状态${b.contentInfo.statusList.length + 1}`,
|
|
2520
|
+
expression: b.contentInfo.statusList.length === 0 ? "return true;" : "return false;",
|
|
2521
|
+
material: { ...r[0], id: z() },
|
|
2433
2522
|
bindCodes: []
|
|
2434
2523
|
};
|
|
2435
|
-
|
|
2436
|
-
}, a = (u,
|
|
2437
|
-
const s = n.children?.find((
|
|
2524
|
+
d(u, [...b.contentInfo.statusList, s]);
|
|
2525
|
+
}, a = (u, b) => {
|
|
2526
|
+
const s = n.children?.find((y) => y.id === u);
|
|
2438
2527
|
if (!s) return;
|
|
2439
|
-
const x = s.contentInfo.statusList.filter((
|
|
2440
|
-
|
|
2441
|
-
}, o = (u,
|
|
2442
|
-
const x = n.children?.find((
|
|
2528
|
+
const x = s.contentInfo.statusList.filter((y) => y.id !== b);
|
|
2529
|
+
d(u, x);
|
|
2530
|
+
}, o = (u, b, s) => {
|
|
2531
|
+
const x = n.children?.find((E) => E.id === u);
|
|
2443
2532
|
if (!x) return;
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
},
|
|
2533
|
+
const y = x.contentInfo.statusList.map((E) => E.id === b ? { ...E, ...s } : E);
|
|
2534
|
+
d(u, y);
|
|
2535
|
+
}, h = (u, b, s) => {
|
|
2447
2536
|
const x = n.children?.find((m) => m.id === u);
|
|
2448
2537
|
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:
|
|
2538
|
+
const y = x.contentInfo.statusList.findIndex((m) => m.id === b);
|
|
2539
|
+
if (y === -1) return;
|
|
2540
|
+
const E = [...x.contentInfo.statusList];
|
|
2541
|
+
s === "up" && y > 0 ? [E[y], E[y - 1]] = [E[y - 1], E[y]] : s === "down" && y < E.length - 1 && ([E[y], E[y + 1]] = [E[y + 1], E[y]]), d(u, E);
|
|
2542
|
+
}, p = (u, b, s) => {
|
|
2543
|
+
const x = t.find((y) => y.id === s);
|
|
2544
|
+
x && o(u, b, {
|
|
2545
|
+
material: { ...x, id: z() }
|
|
2457
2546
|
});
|
|
2458
2547
|
};
|
|
2459
|
-
return /* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */ e("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg mb-4", children: /* @__PURE__ */
|
|
2548
|
+
return /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
2549
|
+
/* @__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
2550
|
/* @__PURE__ */ e("strong", { children: "群组节点" }),
|
|
2462
2551
|
":为每个子节点配置多个状态和绑定"
|
|
2463
2552
|
] }) }),
|
|
2464
|
-
/* @__PURE__ */ e(
|
|
2465
|
-
|
|
2553
|
+
/* @__PURE__ */ e(he, { ghost: !0, children: n.children?.map((u, b) => /* @__PURE__ */ e(
|
|
2554
|
+
yt,
|
|
2466
2555
|
{
|
|
2467
|
-
header: /* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2556
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center justify-between w-full pr-4", children: [
|
|
2557
|
+
/* @__PURE__ */ c("span", { className: "font-medium text-sm", children: [
|
|
2469
2558
|
"子节点 ",
|
|
2470
|
-
|
|
2559
|
+
b + 1
|
|
2471
2560
|
] }),
|
|
2472
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ c(le, { color: "blue", style: { fontSize: "12px", padding: "0 4px" }, children: [
|
|
2473
2562
|
u.contentInfo.statusList.length,
|
|
2474
2563
|
" 个状态"
|
|
2475
2564
|
] })
|
|
2476
2565
|
] }),
|
|
2477
|
-
children: /* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2566
|
+
children: /* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
2567
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between items-center mb-3", children: [
|
|
2479
2568
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "状态列表" }),
|
|
2480
2569
|
/* @__PURE__ */ e(
|
|
2481
|
-
|
|
2570
|
+
j,
|
|
2482
2571
|
{
|
|
2483
2572
|
type: "primary",
|
|
2484
2573
|
size: "small",
|
|
2485
|
-
icon: /* @__PURE__ */ e(
|
|
2574
|
+
icon: /* @__PURE__ */ e(Nt, {}),
|
|
2486
2575
|
onClick: () => l(u.id),
|
|
2487
2576
|
children: "添加状态"
|
|
2488
2577
|
}
|
|
2489
2578
|
)
|
|
2490
2579
|
] }),
|
|
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
|
-
|
|
2580
|
+
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(
|
|
2581
|
+
yt,
|
|
2493
2582
|
{
|
|
2494
|
-
header: /* @__PURE__ */
|
|
2583
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2495
2584
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: x + 1 }),
|
|
2496
2585
|
/* @__PURE__ */ e("span", { className: "font-medium", children: s.name }),
|
|
2497
|
-
/* @__PURE__ */ e(
|
|
2586
|
+
/* @__PURE__ */ e(le, { color: "default", className: "text-xs", children: s.material.type })
|
|
2498
2587
|
] }),
|
|
2499
|
-
extra: /* @__PURE__ */
|
|
2588
|
+
extra: /* @__PURE__ */ c(ae, { size: "small", onClick: (y) => y.stopPropagation(), children: [
|
|
2500
2589
|
/* @__PURE__ */ e(
|
|
2501
|
-
|
|
2590
|
+
j,
|
|
2502
2591
|
{
|
|
2503
2592
|
type: "text",
|
|
2504
2593
|
size: "small",
|
|
2505
|
-
icon: /* @__PURE__ */ e(
|
|
2594
|
+
icon: /* @__PURE__ */ e(It, {}),
|
|
2506
2595
|
disabled: x === 0,
|
|
2507
|
-
onClick: (
|
|
2508
|
-
|
|
2596
|
+
onClick: (y) => {
|
|
2597
|
+
y.stopPropagation(), h(u.id, s.id, "up");
|
|
2509
2598
|
}
|
|
2510
2599
|
}
|
|
2511
2600
|
),
|
|
2512
2601
|
/* @__PURE__ */ e(
|
|
2513
|
-
|
|
2602
|
+
j,
|
|
2514
2603
|
{
|
|
2515
2604
|
type: "text",
|
|
2516
2605
|
size: "small",
|
|
2517
|
-
icon: /* @__PURE__ */ e(
|
|
2606
|
+
icon: /* @__PURE__ */ e(kt, {}),
|
|
2518
2607
|
disabled: x === u.contentInfo.statusList.length - 1,
|
|
2519
|
-
onClick: (
|
|
2520
|
-
|
|
2608
|
+
onClick: (y) => {
|
|
2609
|
+
y.stopPropagation(), h(u.id, s.id, "down");
|
|
2521
2610
|
}
|
|
2522
2611
|
}
|
|
2523
2612
|
),
|
|
2524
2613
|
/* @__PURE__ */ e(
|
|
2525
|
-
|
|
2614
|
+
j,
|
|
2526
2615
|
{
|
|
2527
2616
|
type: "text",
|
|
2528
2617
|
size: "small",
|
|
2529
2618
|
danger: !0,
|
|
2530
|
-
icon: /* @__PURE__ */ e(
|
|
2531
|
-
onClick: (
|
|
2532
|
-
|
|
2619
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
2620
|
+
onClick: (y) => {
|
|
2621
|
+
y.stopPropagation(), a(u.id, s.id);
|
|
2533
2622
|
}
|
|
2534
2623
|
}
|
|
2535
2624
|
)
|
|
2536
2625
|
] }),
|
|
2537
|
-
children: /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */ e(
|
|
2539
|
-
|
|
2626
|
+
children: /* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2627
|
+
/* @__PURE__ */ e(v.Item, { label: "状态名称", children: /* @__PURE__ */ e(
|
|
2628
|
+
J,
|
|
2540
2629
|
{
|
|
2541
2630
|
value: s.name,
|
|
2542
|
-
onChange: (
|
|
2631
|
+
onChange: (y) => o(u.id, s.id, { name: y.target.value }),
|
|
2543
2632
|
placeholder: "输入状态名称"
|
|
2544
2633
|
}
|
|
2545
2634
|
) }),
|
|
2546
2635
|
/* @__PURE__ */ e(
|
|
2547
|
-
|
|
2636
|
+
v.Item,
|
|
2548
2637
|
{
|
|
2549
2638
|
label: "执行表达式",
|
|
2550
2639
|
help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
|
|
2551
2640
|
children: /* @__PURE__ */ e(
|
|
2552
|
-
|
|
2641
|
+
Pn,
|
|
2553
2642
|
{
|
|
2554
2643
|
value: s.expression,
|
|
2555
|
-
onChange: (
|
|
2644
|
+
onChange: (y) => o(u.id, s.id, { expression: y.target.value }),
|
|
2556
2645
|
rows: 3,
|
|
2557
2646
|
placeholder: "return true;"
|
|
2558
2647
|
}
|
|
2559
2648
|
)
|
|
2560
2649
|
}
|
|
2561
2650
|
),
|
|
2562
|
-
/* @__PURE__ */ e(
|
|
2563
|
-
|
|
2651
|
+
/* @__PURE__ */ e(v.Item, { label: "绑定数据源 (bindCodes)", children: /* @__PURE__ */ e(
|
|
2652
|
+
me,
|
|
2564
2653
|
{
|
|
2565
2654
|
mode: "tags",
|
|
2566
2655
|
value: s.bindCodes || [],
|
|
2567
|
-
onChange: (
|
|
2656
|
+
onChange: (y) => o(u.id, s.id, { bindCodes: y }),
|
|
2568
2657
|
placeholder: "输入数据源 code",
|
|
2569
2658
|
tokenSeparators: [",", " "]
|
|
2570
2659
|
}
|
|
2571
2660
|
) }),
|
|
2572
|
-
/* @__PURE__ */ e(
|
|
2573
|
-
/* @__PURE__ */ e(
|
|
2574
|
-
/* @__PURE__ */ e(
|
|
2661
|
+
/* @__PURE__ */ e(v.Item, { label: "更换物料", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2662
|
+
/* @__PURE__ */ e(le, { color: "blue", children: s.material.name }),
|
|
2663
|
+
/* @__PURE__ */ e(le, { color: "default", children: s.material.type }),
|
|
2575
2664
|
/* @__PURE__ */ e(
|
|
2576
|
-
|
|
2665
|
+
me,
|
|
2577
2666
|
{
|
|
2578
2667
|
placeholder: "选择新物料",
|
|
2579
2668
|
style: { width: 150 },
|
|
2580
2669
|
value: void 0,
|
|
2581
|
-
onChange: (
|
|
2582
|
-
options: r.map((
|
|
2583
|
-
value:
|
|
2584
|
-
label: `${
|
|
2670
|
+
onChange: (y) => y && p(u.id, s.id, y),
|
|
2671
|
+
options: r.map((y) => ({
|
|
2672
|
+
value: y.id,
|
|
2673
|
+
label: `${y.name} (${y.type})`
|
|
2585
2674
|
}))
|
|
2586
2675
|
}
|
|
2587
2676
|
)
|
|
2588
2677
|
] }) }),
|
|
2589
|
-
/* @__PURE__ */ e(
|
|
2590
|
-
/* @__PURE__ */
|
|
2591
|
-
/* @__PURE__ */
|
|
2678
|
+
/* @__PURE__ */ e(ye, { style: { margin: "12px 0" } }),
|
|
2679
|
+
/* @__PURE__ */ c("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2680
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2592
2681
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
|
|
2593
|
-
/* @__PURE__ */ e(
|
|
2682
|
+
/* @__PURE__ */ e(le, { children: s.material.name })
|
|
2594
2683
|
] }),
|
|
2595
2684
|
/* @__PURE__ */ e(
|
|
2596
|
-
|
|
2685
|
+
Pt,
|
|
2597
2686
|
{
|
|
2598
2687
|
material: s.material,
|
|
2599
|
-
onSave: (
|
|
2600
|
-
const
|
|
2601
|
-
o(u.id, s.id, { material:
|
|
2688
|
+
onSave: (y) => {
|
|
2689
|
+
const E = { ...s.material, ...y };
|
|
2690
|
+
o(u.id, s.id, { material: E });
|
|
2602
2691
|
}
|
|
2603
2692
|
}
|
|
2604
2693
|
)
|
|
@@ -2612,23 +2701,23 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2612
2701
|
u.id
|
|
2613
2702
|
)) })
|
|
2614
2703
|
] });
|
|
2615
|
-
}, { Panel:
|
|
2704
|
+
}, { Panel: ge } = he, { TabPane: Ke } = St, { TextArea: $n } = J, _n = ({
|
|
2616
2705
|
defaultTestData: n
|
|
2617
2706
|
}) => {
|
|
2618
2707
|
const {
|
|
2619
|
-
nodes:
|
|
2708
|
+
nodes: f,
|
|
2620
2709
|
selectedNodeId: t,
|
|
2621
2710
|
updateNode: r,
|
|
2622
|
-
updateNodeStyle:
|
|
2711
|
+
updateNodeStyle: d,
|
|
2623
2712
|
updateNodeControl: l,
|
|
2624
2713
|
updateNodeContent: a,
|
|
2625
2714
|
materials: o,
|
|
2626
|
-
selectedStatusId:
|
|
2627
|
-
selectStatus:
|
|
2628
|
-
} =
|
|
2629
|
-
t && (i.normalStyle &&
|
|
2715
|
+
selectedStatusId: h,
|
|
2716
|
+
selectStatus: p
|
|
2717
|
+
} = Ie(), [u] = v.useForm(), [b, s] = q("basic"), [x, y] = q(!1), [E, m] = q(null), [A, Y] = q({}), D = de.useMemo(() => f.find((i) => i.id === t), [f, t]), L = D?.contentInfo.statusList || [], O = (i) => {
|
|
2718
|
+
t && (i.normalStyle && d(t, i.normalStyle), i.name !== void 0 && r(t, { name: i.name }), i.controlInfo && l(t, i.controlInfo));
|
|
2630
2719
|
};
|
|
2631
|
-
|
|
2720
|
+
se(() => {
|
|
2632
2721
|
D && (u.setFieldsValue({
|
|
2633
2722
|
name: D.name,
|
|
2634
2723
|
normalStyle: {
|
|
@@ -2649,222 +2738,222 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2649
2738
|
isSelectable: !0,
|
|
2650
2739
|
...D.controlInfo
|
|
2651
2740
|
}
|
|
2652
|
-
}),
|
|
2653
|
-
}, [D?.id, u,
|
|
2654
|
-
const
|
|
2655
|
-
!t || !D || (m("new"),
|
|
2741
|
+
}), p(null));
|
|
2742
|
+
}, [D?.id, u, p]);
|
|
2743
|
+
const ie = () => {
|
|
2744
|
+
!t || !D || (m("new"), y(!0));
|
|
2656
2745
|
}, H = (i) => {
|
|
2657
2746
|
if (!t || !D) return;
|
|
2658
|
-
const
|
|
2659
|
-
id:
|
|
2660
|
-
name: `${i.name}_状态${
|
|
2661
|
-
expression:
|
|
2662
|
-
material: { ...i, id:
|
|
2747
|
+
const k = {
|
|
2748
|
+
id: z(),
|
|
2749
|
+
name: `${i.name}_状态${L.length + 1}`,
|
|
2750
|
+
expression: L.length === 0 ? "return true;" : "return false;",
|
|
2751
|
+
material: { ...i, id: z() },
|
|
2663
2752
|
bindCodes: []
|
|
2664
2753
|
};
|
|
2665
|
-
if (
|
|
2666
|
-
const
|
|
2667
|
-
a(t, { statusList:
|
|
2668
|
-
} else if (
|
|
2669
|
-
const
|
|
2670
|
-
a(t, { statusList:
|
|
2754
|
+
if (E === "new") {
|
|
2755
|
+
const S = [...L, k];
|
|
2756
|
+
a(t, { statusList: S });
|
|
2757
|
+
} else if (E) {
|
|
2758
|
+
const S = L.map((w) => w.id === E ? { ...w, material: { ...i, id: z() } } : w);
|
|
2759
|
+
a(t, { statusList: S });
|
|
2671
2760
|
}
|
|
2672
|
-
|
|
2673
|
-
},
|
|
2761
|
+
y(!1), m(null);
|
|
2762
|
+
}, Q = (i) => {
|
|
2674
2763
|
if (!t || !D) return;
|
|
2675
|
-
const
|
|
2676
|
-
a(t, { statusList:
|
|
2677
|
-
},
|
|
2764
|
+
const k = D.contentInfo.statusList?.filter((S) => S.id !== i) || [];
|
|
2765
|
+
a(t, { statusList: k }), h === i && p(null);
|
|
2766
|
+
}, F = (i, k) => {
|
|
2678
2767
|
if (!t || !D) return;
|
|
2679
|
-
const
|
|
2680
|
-
a(t, { statusList:
|
|
2681
|
-
},
|
|
2768
|
+
const S = D.contentInfo.statusList?.map((w) => w.id === i ? { ...w, ...k } : w) || [];
|
|
2769
|
+
a(t, { statusList: S });
|
|
2770
|
+
}, P = (i) => {
|
|
2682
2771
|
if (!t || !D) return;
|
|
2683
|
-
const
|
|
2772
|
+
const k = {
|
|
2684
2773
|
...i,
|
|
2685
|
-
id:
|
|
2774
|
+
id: z(),
|
|
2686
2775
|
name: `${i.name}_复制`,
|
|
2687
2776
|
expression: "return false;"
|
|
2688
|
-
},
|
|
2689
|
-
a(t, { statusList:
|
|
2690
|
-
},
|
|
2777
|
+
}, S = [...L, k];
|
|
2778
|
+
a(t, { statusList: S });
|
|
2779
|
+
}, T = (i, k) => {
|
|
2691
2780
|
if (!t || !D) return;
|
|
2692
|
-
const
|
|
2693
|
-
if (
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
] :
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
]), a(t, { statusList:
|
|
2702
|
-
},
|
|
2703
|
-
m(i),
|
|
2704
|
-
},
|
|
2781
|
+
const S = L.findIndex((M) => M.id === i);
|
|
2782
|
+
if (S === -1) return;
|
|
2783
|
+
const w = [...L];
|
|
2784
|
+
k === "up" && S > 0 ? [w[S], w[S - 1]] = [
|
|
2785
|
+
w[S - 1],
|
|
2786
|
+
w[S]
|
|
2787
|
+
] : k === "down" && S < w.length - 1 && ([w[S], w[S + 1]] = [
|
|
2788
|
+
w[S + 1],
|
|
2789
|
+
w[S]
|
|
2790
|
+
]), a(t, { statusList: w });
|
|
2791
|
+
}, B = (i) => {
|
|
2792
|
+
m(i), y(!0);
|
|
2793
|
+
}, R = (i, k) => {
|
|
2705
2794
|
if (!t || !D) return;
|
|
2706
|
-
const
|
|
2707
|
-
...
|
|
2708
|
-
material: { ...
|
|
2709
|
-
} :
|
|
2710
|
-
a(t, { statusList:
|
|
2795
|
+
const S = L.map((w) => w.id === i ? {
|
|
2796
|
+
...w,
|
|
2797
|
+
material: { ...w.material, ...k }
|
|
2798
|
+
} : w);
|
|
2799
|
+
a(t, { statusList: S });
|
|
2711
2800
|
};
|
|
2712
|
-
return D ? /* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2801
|
+
return D ? /* @__PURE__ */ c("div", { className: "h-full flex flex-col bg-white border-l border-gray-200", children: [
|
|
2802
|
+
/* @__PURE__ */ c("div", { className: "p-4 border-b border-gray-200", children: [
|
|
2714
2803
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-800", children: "属性面板" }),
|
|
2715
2804
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "编辑选中节点的属性" })
|
|
2716
2805
|
] }),
|
|
2717
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */ e(
|
|
2719
|
-
|
|
2806
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ c(St, { activeKey: b, onChange: s, children: [
|
|
2807
|
+
/* @__PURE__ */ e(Ke, { tab: "基础", children: /* @__PURE__ */ c(
|
|
2808
|
+
v,
|
|
2720
2809
|
{
|
|
2721
2810
|
form: u,
|
|
2722
2811
|
layout: "vertical",
|
|
2723
2812
|
onValuesChange: O,
|
|
2724
2813
|
initialValues: { name: D.name },
|
|
2725
2814
|
children: [
|
|
2726
|
-
/* @__PURE__ */ e(
|
|
2727
|
-
/* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */ e(
|
|
2729
|
-
/* @__PURE__ */ e(
|
|
2730
|
-
/* @__PURE__ */ e(
|
|
2815
|
+
/* @__PURE__ */ e(v.Item, { label: "节点名称", name: "name", children: /* @__PURE__ */ e(J, { placeholder: "输入节点名称" }) }),
|
|
2816
|
+
/* @__PURE__ */ c(he, { ghost: !0, defaultActiveKey: ["position", "size", "style"], children: [
|
|
2817
|
+
/* @__PURE__ */ e(ge, { header: "位置", children: /* @__PURE__ */ c(ae, { children: [
|
|
2818
|
+
/* @__PURE__ */ e(v.Item, { label: "X", name: ["normalStyle", "x"], children: /* @__PURE__ */ e(V, {}) }),
|
|
2819
|
+
/* @__PURE__ */ e(v.Item, { label: "Y", name: ["normalStyle", "y"], children: /* @__PURE__ */ e(V, {}) })
|
|
2731
2820
|
] }) }, "position"),
|
|
2732
|
-
/* @__PURE__ */ e(
|
|
2733
|
-
/* @__PURE__ */ e(
|
|
2734
|
-
/* @__PURE__ */ e(
|
|
2821
|
+
/* @__PURE__ */ e(ge, { header: "尺寸", children: /* @__PURE__ */ c(ae, { children: [
|
|
2822
|
+
/* @__PURE__ */ e(v.Item, { label: "宽度", name: ["normalStyle", "width"], children: /* @__PURE__ */ e(V, { min: 10 }) }),
|
|
2823
|
+
/* @__PURE__ */ e(v.Item, { label: "高度", name: ["normalStyle", "height"], children: /* @__PURE__ */ e(V, { min: 10 }) })
|
|
2735
2824
|
] }) }, "size"),
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */ e(
|
|
2738
|
-
/* @__PURE__ */ e(
|
|
2739
|
-
/* @__PURE__ */ e(
|
|
2825
|
+
/* @__PURE__ */ c(ge, { header: "样式", children: [
|
|
2826
|
+
/* @__PURE__ */ e(v.Item, { label: "背景色", name: ["normalStyle", "background"], children: /* @__PURE__ */ e(J, { placeholder: "transparent, #fff, url(...)" }) }),
|
|
2827
|
+
/* @__PURE__ */ e(v.Item, { label: "内边距", name: ["normalStyle", "padding"], children: /* @__PURE__ */ e(V, { min: 0 }) }),
|
|
2828
|
+
/* @__PURE__ */ e(v.Item, { label: "圆角", name: ["normalStyle", "borderRadius"], children: /* @__PURE__ */ e(V, { min: 0 }) }),
|
|
2740
2829
|
/* @__PURE__ */ e(
|
|
2741
|
-
|
|
2830
|
+
v.Item,
|
|
2742
2831
|
{
|
|
2743
2832
|
label: "缩放比例",
|
|
2744
2833
|
name: ["normalStyle", "scale"],
|
|
2745
2834
|
help: "等比缩放节点的宽高",
|
|
2746
|
-
children: /* @__PURE__ */ e(
|
|
2835
|
+
children: /* @__PURE__ */ e(V, { min: 0.1, max: 5, step: 0.1 })
|
|
2747
2836
|
}
|
|
2748
2837
|
),
|
|
2749
|
-
/* @__PURE__ */ e(
|
|
2750
|
-
/* @__PURE__ */ e(
|
|
2838
|
+
/* @__PURE__ */ e(v.Item, { label: "透明度", name: ["normalStyle", "opacity"], children: /* @__PURE__ */ e(V, { min: 0, max: 1, step: 0.1 }) }),
|
|
2839
|
+
/* @__PURE__ */ e(v.Item, { label: "层级", name: ["normalStyle", "zIndex"], children: /* @__PURE__ */ e(V, {}) })
|
|
2751
2840
|
] }, "style")
|
|
2752
2841
|
] })
|
|
2753
2842
|
]
|
|
2754
2843
|
}
|
|
2755
2844
|
) }, "basic"),
|
|
2756
|
-
/* @__PURE__ */ e(
|
|
2757
|
-
|
|
2845
|
+
/* @__PURE__ */ e(Ke, { tab: "状态", children: D.type === "group" && D.children ? /* @__PURE__ */ e(
|
|
2846
|
+
Tn,
|
|
2758
2847
|
{
|
|
2759
2848
|
node: D,
|
|
2760
2849
|
updateNode: r,
|
|
2761
2850
|
materials: o
|
|
2762
2851
|
}
|
|
2763
|
-
) : /* @__PURE__ */
|
|
2764
|
-
/* @__PURE__ */
|
|
2765
|
-
/* @__PURE__ */
|
|
2852
|
+
) : /* @__PURE__ */ c("div", { className: "mb-4", children: [
|
|
2853
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2854
|
+
/* @__PURE__ */ c("span", { className: "font-medium", children: [
|
|
2766
2855
|
"状态列表",
|
|
2767
|
-
/* @__PURE__ */ e(
|
|
2856
|
+
/* @__PURE__ */ e(le, { color: "blue", className: "ml-2", children: L.length })
|
|
2768
2857
|
] }),
|
|
2769
2858
|
/* @__PURE__ */ e(
|
|
2770
|
-
|
|
2859
|
+
j,
|
|
2771
2860
|
{
|
|
2772
2861
|
type: "primary",
|
|
2773
2862
|
size: "small",
|
|
2774
|
-
icon: /* @__PURE__ */ e(
|
|
2775
|
-
onClick:
|
|
2863
|
+
icon: /* @__PURE__ */ e(Nt, {}),
|
|
2864
|
+
onClick: ie,
|
|
2776
2865
|
children: "添加状态"
|
|
2777
2866
|
}
|
|
2778
2867
|
)
|
|
2779
2868
|
] }),
|
|
2780
2869
|
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500 mb-3", children: "节点根据状态表达式计算结果显示对应物料,第一个返回 true 的状态为当前状态" }),
|
|
2781
|
-
|
|
2870
|
+
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
2871
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-600", children: "当前状态:" }),
|
|
2783
2872
|
/* @__PURE__ */ e("span", { className: "ml-2 text-sm font-medium text-blue-600", children: "由表达式自动计算" })
|
|
2784
2873
|
] }) }) }),
|
|
2785
|
-
|
|
2786
|
-
|
|
2874
|
+
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(
|
|
2875
|
+
ge,
|
|
2787
2876
|
{
|
|
2788
|
-
header: /* @__PURE__ */
|
|
2789
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children:
|
|
2877
|
+
header: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2878
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-gray-400 w-5", children: k + 1 }),
|
|
2790
2879
|
/* @__PURE__ */ e("span", { className: "font-medium", children: i.name }),
|
|
2791
|
-
/* @__PURE__ */ e(
|
|
2880
|
+
/* @__PURE__ */ e(le, { color: "default", className: "text-xs", children: i.material.type })
|
|
2792
2881
|
] }),
|
|
2793
|
-
extra: /* @__PURE__ */
|
|
2882
|
+
extra: /* @__PURE__ */ c(ae, { size: "small", onClick: (S) => S.stopPropagation(), children: [
|
|
2794
2883
|
/* @__PURE__ */ e(
|
|
2795
|
-
|
|
2884
|
+
j,
|
|
2796
2885
|
{
|
|
2797
2886
|
type: "text",
|
|
2798
2887
|
size: "small",
|
|
2799
|
-
icon: /* @__PURE__ */ e(
|
|
2800
|
-
disabled:
|
|
2801
|
-
onClick: (
|
|
2802
|
-
|
|
2888
|
+
icon: /* @__PURE__ */ e(It, {}),
|
|
2889
|
+
disabled: k === 0,
|
|
2890
|
+
onClick: (S) => {
|
|
2891
|
+
S.stopPropagation(), T(i.id, "up");
|
|
2803
2892
|
}
|
|
2804
2893
|
}
|
|
2805
2894
|
),
|
|
2806
2895
|
/* @__PURE__ */ e(
|
|
2807
|
-
|
|
2896
|
+
j,
|
|
2808
2897
|
{
|
|
2809
2898
|
type: "text",
|
|
2810
2899
|
size: "small",
|
|
2811
|
-
icon: /* @__PURE__ */ e(
|
|
2812
|
-
disabled:
|
|
2813
|
-
onClick: (
|
|
2814
|
-
|
|
2900
|
+
icon: /* @__PURE__ */ e(kt, {}),
|
|
2901
|
+
disabled: k === L.length - 1,
|
|
2902
|
+
onClick: (S) => {
|
|
2903
|
+
S.stopPropagation(), T(i.id, "down");
|
|
2815
2904
|
}
|
|
2816
2905
|
}
|
|
2817
2906
|
),
|
|
2818
2907
|
/* @__PURE__ */ e(
|
|
2819
|
-
|
|
2908
|
+
j,
|
|
2820
2909
|
{
|
|
2821
2910
|
type: "text",
|
|
2822
2911
|
size: "small",
|
|
2823
|
-
icon: /* @__PURE__ */ e(
|
|
2824
|
-
onClick: (
|
|
2825
|
-
|
|
2912
|
+
icon: /* @__PURE__ */ e(Jt, {}),
|
|
2913
|
+
onClick: (S) => {
|
|
2914
|
+
S.stopPropagation(), P(i);
|
|
2826
2915
|
}
|
|
2827
2916
|
}
|
|
2828
2917
|
),
|
|
2829
2918
|
/* @__PURE__ */ e(
|
|
2830
|
-
|
|
2919
|
+
j,
|
|
2831
2920
|
{
|
|
2832
2921
|
type: "text",
|
|
2833
2922
|
size: "small",
|
|
2834
2923
|
danger: !0,
|
|
2835
|
-
icon: /* @__PURE__ */ e(
|
|
2836
|
-
onClick: (
|
|
2837
|
-
|
|
2924
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
2925
|
+
onClick: (S) => {
|
|
2926
|
+
S.stopPropagation(), Q(i.id);
|
|
2838
2927
|
}
|
|
2839
2928
|
}
|
|
2840
2929
|
)
|
|
2841
2930
|
] }),
|
|
2842
|
-
children: /* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */ e(
|
|
2844
|
-
|
|
2931
|
+
children: /* @__PURE__ */ c(v, { layout: "vertical", children: [
|
|
2932
|
+
/* @__PURE__ */ e(v.Item, { label: "状态名称", children: /* @__PURE__ */ e(
|
|
2933
|
+
J,
|
|
2845
2934
|
{
|
|
2846
2935
|
value: i.name,
|
|
2847
|
-
onChange: (
|
|
2936
|
+
onChange: (S) => F(i.id, { name: S.target.value }),
|
|
2848
2937
|
placeholder: "输入状态名称"
|
|
2849
2938
|
}
|
|
2850
2939
|
) }),
|
|
2851
2940
|
/* @__PURE__ */ e(
|
|
2852
|
-
|
|
2941
|
+
v.Item,
|
|
2853
2942
|
{
|
|
2854
2943
|
label: "执行表达式",
|
|
2855
2944
|
help: "返回 true 时激活此状态,可使用 data 变量访问绑定数据",
|
|
2856
2945
|
children: /* @__PURE__ */ e(
|
|
2857
|
-
|
|
2946
|
+
$n,
|
|
2858
2947
|
{
|
|
2859
|
-
value:
|
|
2860
|
-
onChange: (
|
|
2861
|
-
...
|
|
2862
|
-
[i.id]:
|
|
2948
|
+
value: A[i.id] ?? i.expression,
|
|
2949
|
+
onChange: (S) => Y((w) => ({
|
|
2950
|
+
...w,
|
|
2951
|
+
[i.id]: S.target.value
|
|
2863
2952
|
})),
|
|
2864
|
-
onBlur: (
|
|
2865
|
-
|
|
2866
|
-
const
|
|
2867
|
-
return delete
|
|
2953
|
+
onBlur: (S) => {
|
|
2954
|
+
F(i.id, { expression: S.target.value }), Y((w) => {
|
|
2955
|
+
const M = { ...w };
|
|
2956
|
+
return delete M[i.id], M;
|
|
2868
2957
|
});
|
|
2869
2958
|
},
|
|
2870
2959
|
rows: 3,
|
|
@@ -2873,41 +2962,41 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2873
2962
|
)
|
|
2874
2963
|
}
|
|
2875
2964
|
),
|
|
2876
|
-
/* @__PURE__ */ e(
|
|
2877
|
-
|
|
2965
|
+
/* @__PURE__ */ e(v.Item, { label: "绑定数据源 (bindCodes)", children: /* @__PURE__ */ e(
|
|
2966
|
+
me,
|
|
2878
2967
|
{
|
|
2879
2968
|
mode: "tags",
|
|
2880
2969
|
value: i.bindCodes || [],
|
|
2881
|
-
onChange: (
|
|
2970
|
+
onChange: (S) => F(i.id, { bindCodes: S }),
|
|
2882
2971
|
placeholder: "输入数据源 code",
|
|
2883
2972
|
tokenSeparators: [",", " "]
|
|
2884
2973
|
}
|
|
2885
2974
|
) }),
|
|
2886
|
-
/* @__PURE__ */ e(
|
|
2887
|
-
/* @__PURE__ */ e(
|
|
2888
|
-
/* @__PURE__ */ e(
|
|
2975
|
+
/* @__PURE__ */ e(v.Item, { label: "绑定物料", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2976
|
+
/* @__PURE__ */ e(le, { color: "blue", children: i.material.name }),
|
|
2977
|
+
/* @__PURE__ */ e(le, { color: "default", children: i.material.type }),
|
|
2889
2978
|
/* @__PURE__ */ e(
|
|
2890
|
-
|
|
2979
|
+
j,
|
|
2891
2980
|
{
|
|
2892
2981
|
type: "link",
|
|
2893
2982
|
size: "small",
|
|
2894
|
-
icon: /* @__PURE__ */ e(
|
|
2895
|
-
onClick: () =>
|
|
2983
|
+
icon: /* @__PURE__ */ e(nt, {}),
|
|
2984
|
+
onClick: () => B(i.id),
|
|
2896
2985
|
children: "更换物料"
|
|
2897
2986
|
}
|
|
2898
2987
|
)
|
|
2899
2988
|
] }) }),
|
|
2900
|
-
/* @__PURE__ */ e(
|
|
2901
|
-
/* @__PURE__ */
|
|
2902
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ e(ye, { style: { margin: "12px 0" } }),
|
|
2990
|
+
/* @__PURE__ */ c("div", { className: "bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2991
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
2903
2992
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: "物料属性" }),
|
|
2904
|
-
/* @__PURE__ */ e(
|
|
2993
|
+
/* @__PURE__ */ e(le, { children: i.material.name })
|
|
2905
2994
|
] }),
|
|
2906
2995
|
/* @__PURE__ */ e(
|
|
2907
|
-
|
|
2996
|
+
Pt,
|
|
2908
2997
|
{
|
|
2909
2998
|
material: i.material,
|
|
2910
|
-
onSave: (
|
|
2999
|
+
onSave: (S) => R(i.id, S),
|
|
2911
3000
|
bindCodes: i.bindCodes || [],
|
|
2912
3001
|
dataOptions: n || []
|
|
2913
3002
|
}
|
|
@@ -2918,94 +3007,94 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
2918
3007
|
i.id
|
|
2919
3008
|
)) })
|
|
2920
3009
|
] }) }, "status"),
|
|
2921
|
-
/* @__PURE__ */ e(
|
|
2922
|
-
|
|
3010
|
+
/* @__PURE__ */ e(Ke, { tab: "控制", children: /* @__PURE__ */ c(
|
|
3011
|
+
v,
|
|
2923
3012
|
{
|
|
2924
3013
|
form: u,
|
|
2925
3014
|
layout: "vertical",
|
|
2926
3015
|
onValuesChange: O,
|
|
2927
3016
|
children: [
|
|
2928
3017
|
/* @__PURE__ */ e(
|
|
2929
|
-
|
|
3018
|
+
v.Item,
|
|
2930
3019
|
{
|
|
2931
3020
|
label: "可拖拽",
|
|
2932
3021
|
name: ["controlInfo", "isDraggable"],
|
|
2933
3022
|
valuePropName: "checked",
|
|
2934
|
-
children: /* @__PURE__ */ e(
|
|
3023
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2935
3024
|
}
|
|
2936
3025
|
),
|
|
2937
3026
|
/* @__PURE__ */ e(
|
|
2938
|
-
|
|
3027
|
+
v.Item,
|
|
2939
3028
|
{
|
|
2940
3029
|
label: "可点击",
|
|
2941
3030
|
name: ["controlInfo", "isClickable"],
|
|
2942
3031
|
valuePropName: "checked",
|
|
2943
|
-
children: /* @__PURE__ */ e(
|
|
3032
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2944
3033
|
}
|
|
2945
3034
|
),
|
|
2946
3035
|
/* @__PURE__ */ e(
|
|
2947
|
-
|
|
3036
|
+
v.Item,
|
|
2948
3037
|
{
|
|
2949
3038
|
label: "可调整大小",
|
|
2950
3039
|
name: ["controlInfo", "isResizable"],
|
|
2951
3040
|
valuePropName: "checked",
|
|
2952
|
-
children: /* @__PURE__ */ e(
|
|
3041
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2953
3042
|
}
|
|
2954
3043
|
),
|
|
2955
3044
|
/* @__PURE__ */ e(
|
|
2956
|
-
|
|
3045
|
+
v.Item,
|
|
2957
3046
|
{
|
|
2958
3047
|
label: "可选中",
|
|
2959
3048
|
name: ["controlInfo", "isSelectable"],
|
|
2960
3049
|
valuePropName: "checked",
|
|
2961
|
-
children: /* @__PURE__ */ e(
|
|
3050
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2962
3051
|
}
|
|
2963
3052
|
)
|
|
2964
3053
|
]
|
|
2965
3054
|
}
|
|
2966
3055
|
) }, "control")
|
|
2967
3056
|
] }) }),
|
|
2968
|
-
/* @__PURE__ */ e("div", { className: "p-3 border-t border-gray-200 bg-gray-50", children: /* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__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: [
|
|
3058
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2970
3059
|
"节点 ID: ",
|
|
2971
3060
|
D.id.slice(0, 8),
|
|
2972
3061
|
"..."
|
|
2973
3062
|
] }),
|
|
2974
|
-
/* @__PURE__ */
|
|
3063
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2975
3064
|
"状态数: ",
|
|
2976
|
-
|
|
3065
|
+
L.length
|
|
2977
3066
|
] })
|
|
2978
3067
|
] }) }),
|
|
2979
3068
|
/* @__PURE__ */ e(
|
|
2980
|
-
|
|
3069
|
+
tt,
|
|
2981
3070
|
{
|
|
2982
3071
|
title: "选择物料",
|
|
2983
3072
|
open: x,
|
|
2984
3073
|
onCancel: () => {
|
|
2985
|
-
|
|
3074
|
+
y(!1), m(null);
|
|
2986
3075
|
},
|
|
2987
3076
|
footer: null,
|
|
2988
3077
|
width: 600,
|
|
2989
|
-
children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */
|
|
2990
|
-
/* @__PURE__ */ e(
|
|
2991
|
-
|
|
3078
|
+
children: /* @__PURE__ */ e("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ c(he, { ghost: !0, defaultActiveKey: ["basic", "device", "text", "line"], children: [
|
|
3079
|
+
/* @__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(
|
|
3080
|
+
vt,
|
|
2992
3081
|
{
|
|
2993
3082
|
material: i,
|
|
2994
3083
|
onClick: () => H(i)
|
|
2995
3084
|
},
|
|
2996
3085
|
i.id
|
|
2997
3086
|
)) }) }, "basic"),
|
|
2998
|
-
/* @__PURE__ */ e(
|
|
3087
|
+
/* @__PURE__ */ e(ge, { header: "设备图标", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-4 gap-2", children: o.filter(
|
|
2999
3088
|
(i) => ["阀门", "泵", "罐体"].includes(i.name) || i.type === "IMAGE" && !["矩形", "圆形", "圆角矩形"].includes(i.name)
|
|
3000
3089
|
).map((i) => /* @__PURE__ */ e(
|
|
3001
|
-
|
|
3090
|
+
vt,
|
|
3002
3091
|
{
|
|
3003
3092
|
material: i,
|
|
3004
3093
|
onClick: () => H(i)
|
|
3005
3094
|
},
|
|
3006
3095
|
i.id
|
|
3007
3096
|
)) }) }, "device"),
|
|
3008
|
-
/* @__PURE__ */ e(
|
|
3097
|
+
/* @__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
3098
|
"div",
|
|
3010
3099
|
{
|
|
3011
3100
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
@@ -3017,7 +3106,7 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3017
3106
|
},
|
|
3018
3107
|
i.id
|
|
3019
3108
|
)) }) }, "text"),
|
|
3020
|
-
/* @__PURE__ */ e(
|
|
3109
|
+
/* @__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
3110
|
"div",
|
|
3022
3111
|
{
|
|
3023
3112
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
@@ -3032,35 +3121,35 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3032
3121
|
] }) })
|
|
3033
3122
|
}
|
|
3034
3123
|
)
|
|
3035
|
-
] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(
|
|
3036
|
-
},
|
|
3124
|
+
] }) : /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center bg-white border-l border-gray-200", children: /* @__PURE__ */ e(ne, { description: "请选择一个节点" }) });
|
|
3125
|
+
}, vt = ({ material: n, onClick: f }) => {
|
|
3037
3126
|
const t = n.type === "IMAGE" ? n.src : void 0;
|
|
3038
|
-
return /* @__PURE__ */
|
|
3127
|
+
return /* @__PURE__ */ c(
|
|
3039
3128
|
"div",
|
|
3040
3129
|
{
|
|
3041
3130
|
className: "border rounded-lg p-2 cursor-pointer hover:border-blue-500 hover:bg-blue-50 transition-all text-center",
|
|
3042
|
-
onClick:
|
|
3131
|
+
onClick: f,
|
|
3043
3132
|
children: [
|
|
3044
3133
|
/* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-1 flex items-center justify-center", children: t ? /* @__PURE__ */ e("img", { src: t, alt: n.name, className: "w-10 h-10 object-contain" }) : /* @__PURE__ */ e("span", { className: "text-xs", children: n.name[0] }) }),
|
|
3045
3134
|
/* @__PURE__ */ e("span", { className: "text-xs", children: n.name })
|
|
3046
3135
|
]
|
|
3047
3136
|
}
|
|
3048
3137
|
);
|
|
3049
|
-
},
|
|
3050
|
-
configEditor:
|
|
3051
|
-
}, { Header:
|
|
3138
|
+
}, Yn = "ConfigEditor-module__configEditor__dinNG", On = {
|
|
3139
|
+
configEditor: Yn
|
|
3140
|
+
}, { Header: Xn, Sider: bt, Content: zn } = Qe, Bn = ({
|
|
3052
3141
|
initialScheme: n,
|
|
3053
|
-
onChange:
|
|
3142
|
+
onChange: f,
|
|
3054
3143
|
readonly: t = !1,
|
|
3055
3144
|
headerExtra: r,
|
|
3056
|
-
className:
|
|
3145
|
+
className: d = "",
|
|
3057
3146
|
style: l,
|
|
3058
3147
|
showHeader: a = !0,
|
|
3059
3148
|
showMaterialPanel: o = !0,
|
|
3060
|
-
showPropertyPanel:
|
|
3061
|
-
customMaterials:
|
|
3149
|
+
showPropertyPanel: h = !0,
|
|
3150
|
+
customMaterials: p
|
|
3062
3151
|
}) => {
|
|
3063
|
-
const [u,
|
|
3152
|
+
const [u, b] = de.useState(!1), [s, x] = de.useState(""), [y, E] = de.useState([
|
|
3064
3153
|
{
|
|
3065
3154
|
paramsCode: "001",
|
|
3066
3155
|
paramsName: "通频速度有效值",
|
|
@@ -3073,103 +3162,103 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3073
3162
|
value: 1.5,
|
|
3074
3163
|
paramsUnit: "m/s²"
|
|
3075
3164
|
}
|
|
3076
|
-
]), { exportScheme: m, importScheme:
|
|
3077
|
-
|
|
3078
|
-
const O =
|
|
3079
|
-
|
|
3080
|
-
O.current || (O.current = !0, D.length === 0 &&
|
|
3081
|
-
}, []),
|
|
3082
|
-
if (
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3165
|
+
]), { exportScheme: m, importScheme: A, nodes: Y, materials: D, addMaterial: L } = Ie();
|
|
3166
|
+
de.useRef(null);
|
|
3167
|
+
const O = de.useRef(!1);
|
|
3168
|
+
se(() => {
|
|
3169
|
+
O.current || (O.current = !0, D.length === 0 && pn.forEach((P) => L(P)), p && p.length > 0 && p.forEach((P) => L(P)), n && A(n));
|
|
3170
|
+
}, []), se(() => {
|
|
3171
|
+
if (f) {
|
|
3172
|
+
const P = m();
|
|
3173
|
+
f(P);
|
|
3085
3174
|
}
|
|
3086
|
-
}, [
|
|
3087
|
-
const
|
|
3088
|
-
const
|
|
3089
|
-
i.setAttribute("href",
|
|
3175
|
+
}, [Y, f]);
|
|
3176
|
+
const ie = G(() => {
|
|
3177
|
+
const P = m(), T = JSON.stringify(P, null, 2), B = "data:application/json;charset=utf-8," + encodeURIComponent(T), R = `scheme_${Date.now()}.json`, i = document.createElement("a");
|
|
3178
|
+
i.setAttribute("href", B), i.setAttribute("download", R), i.click(), De.success("导出成功!");
|
|
3090
3179
|
}, [m]), H = G(() => {
|
|
3091
3180
|
try {
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3181
|
+
const P = JSON.parse(s);
|
|
3182
|
+
A(P), b(!1), x(""), De.success("导入成功!");
|
|
3094
3183
|
} catch {
|
|
3095
|
-
|
|
3184
|
+
De.error("JSON 格式错误,请检查输入");
|
|
3096
3185
|
}
|
|
3097
|
-
}, [s,
|
|
3098
|
-
(
|
|
3099
|
-
const
|
|
3100
|
-
return
|
|
3186
|
+
}, [s, A]), Q = G(
|
|
3187
|
+
(P) => {
|
|
3188
|
+
const T = new FileReader();
|
|
3189
|
+
return T.onload = (B) => {
|
|
3101
3190
|
try {
|
|
3102
|
-
const
|
|
3103
|
-
|
|
3191
|
+
const R = B.target?.result, i = JSON.parse(R);
|
|
3192
|
+
A(i), De.success("导入成功!");
|
|
3104
3193
|
} catch {
|
|
3105
|
-
|
|
3194
|
+
De.error("文件格式错误");
|
|
3106
3195
|
}
|
|
3107
|
-
},
|
|
3196
|
+
}, T.readAsText(P), !1;
|
|
3108
3197
|
},
|
|
3109
|
-
[
|
|
3110
|
-
),
|
|
3111
|
-
return
|
|
3112
|
-
|
|
3198
|
+
[A]
|
|
3199
|
+
), F = G(() => m(), [m]);
|
|
3200
|
+
return de.useImperativeHandle(
|
|
3201
|
+
de.useRef?.(),
|
|
3113
3202
|
() => ({
|
|
3114
|
-
getScheme:
|
|
3203
|
+
getScheme: F,
|
|
3115
3204
|
exportScheme: m,
|
|
3116
|
-
importScheme:
|
|
3205
|
+
importScheme: A
|
|
3117
3206
|
}),
|
|
3118
|
-
[
|
|
3119
|
-
), /* @__PURE__ */ e(
|
|
3120
|
-
|
|
3207
|
+
[F, m, A]
|
|
3208
|
+
), /* @__PURE__ */ e(zt, { locale: hn, children: /* @__PURE__ */ e("div", { className: On.configEditor, style: l, children: /* @__PURE__ */ c(
|
|
3209
|
+
Qe,
|
|
3121
3210
|
{
|
|
3122
|
-
className: `h-full w-full overflow-hidden ${
|
|
3211
|
+
className: `h-full w-full overflow-hidden ${d}`,
|
|
3123
3212
|
children: [
|
|
3124
|
-
a && /* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
3213
|
+
a && /* @__PURE__ */ c(Xn, { className: "bg-white border-b border-gray-200 px-4 flex items-center justify-between flex-shrink-0", children: [
|
|
3214
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
3126
3215
|
/* @__PURE__ */ e("div", { className: "text-xl font-bold text-blue-600", children: "组态编辑器" }),
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
|
|
3216
|
+
/* @__PURE__ */ c("div", { className: "text-sm text-gray-500", children: [
|
|
3217
|
+
Y.length,
|
|
3129
3218
|
" 个节点"
|
|
3130
3219
|
] })
|
|
3131
3220
|
] }),
|
|
3132
|
-
/* @__PURE__ */
|
|
3221
|
+
/* @__PURE__ */ c(ae, { children: [
|
|
3133
3222
|
r,
|
|
3134
|
-
!t && /* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */ e(
|
|
3136
|
-
/* @__PURE__ */ e(
|
|
3137
|
-
|
|
3223
|
+
!t && /* @__PURE__ */ c(Se, { children: [
|
|
3224
|
+
/* @__PURE__ */ e(we, { title: "导出 JSON", children: /* @__PURE__ */ e(j, { icon: /* @__PURE__ */ e(Kt, {}), onClick: ie, children: "导出" }) }),
|
|
3225
|
+
/* @__PURE__ */ e(we, { title: "导入 JSON", children: /* @__PURE__ */ e(
|
|
3226
|
+
j,
|
|
3138
3227
|
{
|
|
3139
|
-
icon: /* @__PURE__ */ e(
|
|
3140
|
-
onClick: () =>
|
|
3228
|
+
icon: /* @__PURE__ */ e(Ct, {}),
|
|
3229
|
+
onClick: () => b(!0),
|
|
3141
3230
|
children: "导入"
|
|
3142
3231
|
}
|
|
3143
3232
|
) })
|
|
3144
3233
|
] })
|
|
3145
3234
|
] })
|
|
3146
3235
|
] }),
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
o && !t && /* @__PURE__ */ e(
|
|
3149
|
-
/* @__PURE__ */ e(
|
|
3150
|
-
|
|
3236
|
+
/* @__PURE__ */ c(Qe, { children: [
|
|
3237
|
+
o && !t && /* @__PURE__ */ e(bt, { width: 280, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(yn, {}) }),
|
|
3238
|
+
/* @__PURE__ */ e(zn, { className: "bg-gray-100 relative", children: /* @__PURE__ */ e(In, { defaultTestData: y }) }),
|
|
3239
|
+
h && !t && /* @__PURE__ */ e(bt, { width: 360, className: "bg-white", theme: "light", children: /* @__PURE__ */ e(_n, { defaultTestData: y }) })
|
|
3151
3240
|
] }),
|
|
3152
3241
|
/* @__PURE__ */ e(
|
|
3153
|
-
|
|
3242
|
+
tt,
|
|
3154
3243
|
{
|
|
3155
3244
|
title: "导入组态方案",
|
|
3156
3245
|
open: u,
|
|
3157
3246
|
onOk: H,
|
|
3158
3247
|
onCancel: () => {
|
|
3159
|
-
|
|
3248
|
+
b(!1), x("");
|
|
3160
3249
|
},
|
|
3161
3250
|
width: 600,
|
|
3162
|
-
children: /* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3251
|
+
children: /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
3252
|
+
/* @__PURE__ */ c("div", { children: [
|
|
3164
3253
|
/* @__PURE__ */ e("p", { className: "mb-2", children: "选择 JSON 文件导入:" }),
|
|
3165
3254
|
/* @__PURE__ */ e(
|
|
3166
3255
|
"input",
|
|
3167
3256
|
{
|
|
3168
3257
|
type: "file",
|
|
3169
3258
|
accept: ".json",
|
|
3170
|
-
onChange: (
|
|
3171
|
-
const
|
|
3172
|
-
|
|
3259
|
+
onChange: (P) => {
|
|
3260
|
+
const T = P.target.files?.[0];
|
|
3261
|
+
T && Q(T);
|
|
3173
3262
|
},
|
|
3174
3263
|
className: `block w-full text-sm text-gray-500
|
|
3175
3264
|
file:mr-4 file:py-2 file:px-4
|
|
@@ -3181,13 +3270,13 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3181
3270
|
)
|
|
3182
3271
|
] }),
|
|
3183
3272
|
/* @__PURE__ */ e("div", { className: "text-center text-gray-400", children: "或" }),
|
|
3184
|
-
/* @__PURE__ */
|
|
3273
|
+
/* @__PURE__ */ c("div", { children: [
|
|
3185
3274
|
/* @__PURE__ */ e("p", { className: "mb-2", children: "粘贴 JSON 内容:" }),
|
|
3186
3275
|
/* @__PURE__ */ e(
|
|
3187
3276
|
"textarea",
|
|
3188
3277
|
{
|
|
3189
3278
|
value: s,
|
|
3190
|
-
onChange: (
|
|
3279
|
+
onChange: (P) => x(P.target.value),
|
|
3191
3280
|
placeholder: "粘贴 JSON 内容...",
|
|
3192
3281
|
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
3282
|
}
|
|
@@ -3201,14 +3290,14 @@ const cn = /* @__PURE__ */ en(sn), dn = (n) => (h, t, r) => (r.setState = (c, l,
|
|
|
3201
3290
|
) }) });
|
|
3202
3291
|
};
|
|
3203
3292
|
export {
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3293
|
+
In as Canvas,
|
|
3294
|
+
Bn as ConfigEditor,
|
|
3295
|
+
yn as MaterialPanel,
|
|
3296
|
+
Lt as NodeRenderer,
|
|
3297
|
+
_n as PropertyPanel,
|
|
3298
|
+
gn as createDefaultNode,
|
|
3299
|
+
Dt as createDefaultStatus,
|
|
3300
|
+
pn as initMaterials,
|
|
3301
|
+
Ie as useEditorStore
|
|
3213
3302
|
};
|
|
3214
3303
|
//# sourceMappingURL=config-editor.es.js.map
|