form-design-v3 1.0.0 → 1.0.2

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.
@@ -0,0 +1,3578 @@
1
+ import { defineComponent as L, openBlock as d, createElementBlock as c, normalizeClass as R, unref as h, createElementVNode as t, toDisplayString as y, normalizeStyle as G, Fragment as T, createTextVNode as U, computed as M, ref as O, onMounted as ie, onUnmounted as Ce, createVNode as F, withCtx as A, renderList as N, createBlock as V, resolveDynamicComponent as me, createCommentVNode as I, withModifiers as J, withDirectives as ce, renderSlot as Q, vShow as _e, reactive as Ie, Teleport as pe, nextTick as De, resolveComponent as Se, mergeProps as de, createSlots as ae, normalizeProps as Ue, guardReactiveProps as Be, provide as Ve, watch as le, createStaticVNode as ve, onBeforeUnmount as je, vModelText as Re, defineAsyncComponent as Ae, createApp as ze, h as Je } from "vue";
2
+ import { defineStore as We } from "pinia";
3
+ import { ElSelect as re, ElOption as oe, ElTree as He, ElLoading as qe, ElConfigProvider as Ge, ElDialog as Ye, ElInput as Ke, ElEmpty as Qe, ElPagination as Xe, ElButton as we, ElInputNumber as Ze } from "element-plus";
4
+ import "element-plus/es/components/select/style/css";
5
+ import { icons as et } from "lucide-vue-next";
6
+ import "element-plus/es/components/input-number/style/css";
7
+ import "element-plus/es/components/tree/style/css";
8
+ import "element-plus/es/components/dialog/style/css";
9
+ import "element-plus/es/components/input/style/css";
10
+ import "element-plus/es/components/pagination/style/css";
11
+ import "element-plus/es/components/button/style/css";
12
+ import "element-plus/es/components/empty/style/css";
13
+ import "element-plus/es/components/loading/style/css";
14
+ import "element-plus/es/components/config-provider/style/css";
15
+ const be = /* @__PURE__ */ new Map();
16
+ function ee(e) {
17
+ be.set(e.type, e);
18
+ }
19
+ function K(e) {
20
+ return be.get(e);
21
+ }
22
+ function tt() {
23
+ return Array.from(be.values());
24
+ }
25
+ function nt(e) {
26
+ const n = K(e);
27
+ if (!n) throw new Error(`未注册的控件类型: ${e}`);
28
+ return { ...n.createDefaultProps(), id: `${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}` };
29
+ }
30
+ const ot = { class: "fd-label-name" }, st = /* @__PURE__ */ L({
31
+ __name: "LabelDesign",
32
+ props: {
33
+ node: {}
34
+ },
35
+ setup(e) {
36
+ const n = W();
37
+ return (o, s) => (d(), c("div", {
38
+ class: R(["fd-label-design", { "is-mobile": h(n).device === "mobile" }])
39
+ }, [
40
+ t("span", ot, y(e.node.label || "标题"), 1),
41
+ t("span", {
42
+ class: R(["fd-label-value", { "fd-label-value--link": !!e.node.bindLink }]),
43
+ style: G(e.node.color ? { color: e.node.color } : void 0)
44
+ }, [
45
+ e.node.bindLink ? (d(), c(T, { key: 0 }, [
46
+ U(y(e.node.bindField || e.node.bindLink), 1)
47
+ ], 64)) : (d(), c(T, { key: 1 }, [
48
+ U(y(e.node.bindField || "未绑定字段"), 1)
49
+ ], 64))
50
+ ], 6)
51
+ ], 2));
52
+ }
53
+ }), E = (e, n) => {
54
+ const o = e.__vccOpts || e;
55
+ for (const [s, a] of n)
56
+ o[s] = a;
57
+ return o;
58
+ }, lt = /* @__PURE__ */ E(st, [["__scopeId", "data-v-b6dcc499"]]), at = { class: "fd-label-name" }, it = ["data-key"], dt = ["href"], rt = /* @__PURE__ */ L({
59
+ __name: "LabelRender",
60
+ props: {
61
+ node: {},
62
+ value: {},
63
+ formData: {}
64
+ },
65
+ setup(e) {
66
+ const n = e, o = M(() => !!n.node.bindLink), s = M(() => {
67
+ var v;
68
+ const f = n.node.bindLink ? (v = n.formData) == null ? void 0 : v[n.node.bindLink] : void 0;
69
+ return f == null ? "" : String(f);
70
+ }), a = M(() => n.value !== void 0 && n.value !== null && n.value !== "" ? String(n.value) : s.value ? s.value : ""), i = W(), u = O(!1);
71
+ let r = null;
72
+ ie(() => {
73
+ r = window.matchMedia("(max-width: 768px)"), u.value = r.matches, r.addEventListener("change", (f) => {
74
+ u.value = f.matches;
75
+ });
76
+ }), Ce(() => {
77
+ r && r.removeEventListener("change", () => {
78
+ });
79
+ });
80
+ const l = M(() => i.device === "mobile" || u.value);
81
+ return (f, v) => (d(), c("div", {
82
+ class: R(["fd-label-render", { "is-mobile": l.value }])
83
+ }, [
84
+ t("span", at, y(e.node.label || "标题"), 1),
85
+ t("span", {
86
+ class: R(["fd-label-value", { "fd-label-value--link": o.value }]),
87
+ "data-key": e.node.bindField,
88
+ style: G(e.node.color ? { color: e.node.color } : void 0)
89
+ }, [
90
+ s.value ? (d(), c("a", {
91
+ key: 0,
92
+ class: "fd-label-link",
93
+ href: s.value,
94
+ target: "_blank",
95
+ rel: "noopener noreferrer"
96
+ }, y(a.value), 9, dt)) : (d(), c(T, { key: 1 }, [
97
+ U(y(a.value), 1)
98
+ ], 64))
99
+ ], 14, it)
100
+ ], 2));
101
+ }
102
+ }), ut = /* @__PURE__ */ E(rt, [["__scopeId", "data-v-7fe92042"]]), ct = { class: "fd-panel" }, ft = { class: "fd-panel-item" }, mt = ["value"], pt = { class: "fd-panel-item" }, vt = { class: "fd-panel-item" }, bt = ["value"], gt = { class: "fd-panel-item" }, ht = { class: "fd-color-row" }, yt = ["value"], kt = ["value"], wt = "#344054", $t = /* @__PURE__ */ L({
103
+ __name: "LabelPanel",
104
+ props: {
105
+ node: {},
106
+ fields: {}
107
+ },
108
+ emits: ["update"],
109
+ setup(e, { emit: n }) {
110
+ const o = e, s = n;
111
+ function a(r) {
112
+ return r && /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(r) ? r : wt;
113
+ }
114
+ function i(r) {
115
+ s("update", { color: r.target.value });
116
+ }
117
+ const u = (r) => {
118
+ const l = r ?? "", f = o.fields.find((v) => v.name === l);
119
+ s("update", { bindField: l, bindLink: (f == null ? void 0 : f.dataType) === "link" ? l : "" });
120
+ };
121
+ return (r, l) => (d(), c("div", ct, [
122
+ t("div", ft, [
123
+ l[2] || (l[2] = t("label", null, "标题", -1)),
124
+ t("input", {
125
+ value: e.node.label,
126
+ onInput: l[0] || (l[0] = (f) => s("update", { label: f.target.value }))
127
+ }, null, 40, mt)
128
+ ]),
129
+ t("div", pt, [
130
+ l[3] || (l[3] = t("label", null, "绑定字段", -1)),
131
+ F(h(re), {
132
+ "model-value": e.node.bindField,
133
+ filterable: "",
134
+ clearable: "",
135
+ placeholder: "搜索并选择字段(链接字段自动作为链接)",
136
+ style: { width: "100%" },
137
+ "onUpdate:modelValue": u
138
+ }, {
139
+ default: A(() => [
140
+ F(h(oe), {
141
+ label: "不绑定",
142
+ value: ""
143
+ }),
144
+ (d(!0), c(T, null, N(e.fields, (f) => (d(), V(h(oe), {
145
+ key: f.name,
146
+ label: `${f.label}(${f.name})`,
147
+ value: f.name
148
+ }, null, 8, ["label", "value"]))), 128))
149
+ ]),
150
+ _: 1
151
+ }, 8, ["model-value"])
152
+ ]),
153
+ t("div", vt, [
154
+ l[4] || (l[4] = t("label", null, "链接", -1)),
155
+ t("input", {
156
+ value: e.node.bindLink ? `${e.node.bindLink}(链接字段自动绑定)` : "非链接字段",
157
+ readonly: ""
158
+ }, null, 8, bt)
159
+ ]),
160
+ t("div", gt, [
161
+ l[5] || (l[5] = t("label", null, "字体颜色", -1)),
162
+ t("div", ht, [
163
+ t("input", {
164
+ type: "color",
165
+ value: a(e.node.color),
166
+ onInput: i
167
+ }, null, 40, yt),
168
+ t("input", {
169
+ type: "text",
170
+ value: e.node.color,
171
+ onInput: l[1] || (l[1] = (f) => s("update", { color: f.target.value })),
172
+ placeholder: "默认 #344054"
173
+ }, null, 40, kt)
174
+ ])
175
+ ])
176
+ ]));
177
+ }
178
+ }), xt = /* @__PURE__ */ E($t, [["__scopeId", "data-v-d1d2c609"]]), Ct = {
179
+ type: "label",
180
+ title: "Label 文本",
181
+ design: lt,
182
+ render: ut,
183
+ panel: xt,
184
+ isContainer: !1,
185
+ createDefaultProps: () => ({
186
+ id: "",
187
+ type: "label",
188
+ label: "Label 文本",
189
+ bindField: "",
190
+ bindLink: "",
191
+ color: "#344054"
192
+ }),
193
+ serialize: (e) => e
194
+ }, ue = /* @__PURE__ */ L({
195
+ __name: "LucideIcon",
196
+ props: {
197
+ name: {},
198
+ size: { default: 18 },
199
+ strokeWidth: { default: 2 }
200
+ },
201
+ setup(e) {
202
+ const n = e, o = M(() => n.name && et[n.name] || null);
203
+ return (s, a) => o.value ? (d(), V(me(o.value), {
204
+ key: 0,
205
+ size: e.size,
206
+ "stroke-width": e.strokeWidth
207
+ }, null, 8, ["size", "stroke-width"])) : I("", !0);
208
+ }
209
+ }), _t = { class: "fd-card-design" }, It = { class: "fd-card-head" }, Dt = { class: "fd-card-title" }, St = ["title"], Tt = { class: "fd-card-body" }, Ft = /* @__PURE__ */ L({
210
+ __name: "CardDesign",
211
+ props: {
212
+ node: {}
213
+ },
214
+ setup(e) {
215
+ const n = e, o = W();
216
+ function s() {
217
+ o.setExpanded(n.node.id, !n.node.expanded);
218
+ }
219
+ return (a, i) => (d(), c("div", _t, [
220
+ t("div", It, [
221
+ e.node.icon ? (d(), c("span", {
222
+ key: 0,
223
+ class: "fd-card-icon",
224
+ style: G({ background: e.node.iconBgColor || void 0 })
225
+ }, [
226
+ F(ue, {
227
+ name: e.node.icon,
228
+ size: 18
229
+ }, null, 8, ["name"])
230
+ ], 4)) : I("", !0),
231
+ t("span", Dt, y(e.node.label || "卡片标题"), 1),
232
+ t("span", {
233
+ class: R(["fd-card-arrow", { "is-open": e.node.expanded }]),
234
+ title: e.node.expanded ? "收起" : "展开",
235
+ onClick: J(s, ["stop"])
236
+ }, [...i[0] || (i[0] = [
237
+ t("svg", {
238
+ viewBox: "0 0 24 24",
239
+ fill: "none",
240
+ stroke: "currentColor",
241
+ "stroke-width": "2",
242
+ "stroke-linecap": "round",
243
+ "stroke-linejoin": "round"
244
+ }, [
245
+ t("polyline", { points: "6 9 12 15 18 9" })
246
+ ], -1)
247
+ ])], 10, St)
248
+ ]),
249
+ ce(t("div", Tt, [
250
+ Q(a.$slots, "children", {}, () => [
251
+ i[1] || (i[1] = t("div", { class: "fd-card-empty" }, "拖拽子控件到此处", -1))
252
+ ], !0)
253
+ ], 512), [
254
+ [_e, e.node.expanded]
255
+ ])
256
+ ]));
257
+ }
258
+ }), Lt = /* @__PURE__ */ E(Ft, [["__scopeId", "data-v-6a46ee95"]]);
259
+ function Te(e, n) {
260
+ if (!e || e === "none") return !1;
261
+ const o = Number(n);
262
+ return e === "start" ? o === 10 : e === "not-start" ? o !== 10 : e === "not-approval" ? o !== 20 : !1;
263
+ }
264
+ const Mt = {
265
+ key: 0,
266
+ class: "fd-card-render"
267
+ }, Nt = { class: "fd-card-title" }, Et = { class: "fd-card-body" }, Pt = /* @__PURE__ */ L({
268
+ __name: "CardRender",
269
+ props: {
270
+ node: {},
271
+ formData: {}
272
+ },
273
+ setup(e) {
274
+ const o = O(e.node.expanded);
275
+ return (s, a) => {
276
+ var i;
277
+ return h(Te)(e.node.hiddenMode, (i = e.formData) == null ? void 0 : i.status) ? I("", !0) : (d(), c("div", Mt, [
278
+ t("div", {
279
+ class: "fd-card-head",
280
+ onClick: a[0] || (a[0] = (u) => o.value = !o.value)
281
+ }, [
282
+ e.node.icon ? (d(), c("span", {
283
+ key: 0,
284
+ class: "fd-card-icon",
285
+ style: G({ background: e.node.iconBgColor || void 0 })
286
+ }, [
287
+ F(ue, {
288
+ name: e.node.icon,
289
+ size: 18
290
+ }, null, 8, ["name"])
291
+ ], 4)) : I("", !0),
292
+ t("span", Nt, y(e.node.label || "卡片标题"), 1),
293
+ t("span", {
294
+ class: R(["fd-card-arrow", { "is-open": o.value }])
295
+ }, [...a[1] || (a[1] = [
296
+ t("svg", {
297
+ viewBox: "0 0 24 24",
298
+ fill: "none",
299
+ stroke: "currentColor",
300
+ "stroke-width": "2",
301
+ "stroke-linecap": "round",
302
+ "stroke-linejoin": "round"
303
+ }, [
304
+ t("polyline", { points: "6 9 12 15 18 9" })
305
+ ], -1)
306
+ ])], 2)
307
+ ]),
308
+ ce(t("div", Et, [
309
+ Q(s.$slots, "children", {}, void 0, !0)
310
+ ], 512), [
311
+ [_e, o.value]
312
+ ])
313
+ ]));
314
+ };
315
+ }
316
+ }), Ot = /* @__PURE__ */ E(Pt, [["__scopeId", "data-v-bc2f6273"]]), Ut = ["disabled", "aria-checked"], Bt = /* @__PURE__ */ L({
317
+ __name: "FdSwitch",
318
+ props: {
319
+ modelValue: { type: Boolean },
320
+ disabled: { type: Boolean }
321
+ },
322
+ emits: ["update:modelValue"],
323
+ setup(e, { emit: n }) {
324
+ const o = n;
325
+ return (s, a) => (d(), c("button", {
326
+ type: "button",
327
+ class: R(["fd-switch", { "is-on": e.modelValue }]),
328
+ disabled: e.disabled,
329
+ role: "switch",
330
+ "aria-checked": e.modelValue,
331
+ onClick: a[0] || (a[0] = (i) => o("update:modelValue", !e.modelValue))
332
+ }, [...a[1] || (a[1] = [
333
+ t("span", { class: "fd-switch-dot" }, null, -1)
334
+ ])], 10, Ut));
335
+ }
336
+ }), se = /* @__PURE__ */ E(Bt, [["__scopeId", "data-v-eac909bd"]]), Vt = [
337
+ // 卡片 / 布局通用
338
+ "LayoutGrid",
339
+ "PanelTop",
340
+ "Folder",
341
+ "FolderOpen",
342
+ "FileText",
343
+ "ClipboardList",
344
+ "ClipboardCheck",
345
+ // 业务语义(源自 approval-lease.html 卡片:铺位/品牌/合同/递增/免租/计费/预算/招调/指导价)
346
+ "MapPin",
347
+ "Store",
348
+ "Building2",
349
+ "Badge",
350
+ "Tag",
351
+ "CalendarDays",
352
+ "TrendingUp",
353
+ "Clock",
354
+ "Calculator",
355
+ "Receipt",
356
+ "Target",
357
+ "ChartPie",
358
+ "ChartLine",
359
+ "CircleDollarSign",
360
+ // 通用 / 状态
361
+ "Briefcase",
362
+ "Scale",
363
+ "ShieldCheck",
364
+ "Sparkles",
365
+ "ScanSearch",
366
+ "MessageSquareText",
367
+ "GitBranch",
368
+ "Paperclip",
369
+ "Download",
370
+ "Upload",
371
+ "Network",
372
+ "Printer",
373
+ "CircleCheck",
374
+ "CircleAlert",
375
+ "Info",
376
+ "Bell",
377
+ "Settings",
378
+ "User",
379
+ "Users",
380
+ "Heart",
381
+ "Star",
382
+ "Lightbulb",
383
+ "Award",
384
+ "BookOpen",
385
+ "Coins",
386
+ "Wallet"
387
+ ], jt = { class: "fd-panel" }, Rt = { class: "fd-panel-item" }, At = ["value"], zt = { class: "fd-panel-item" }, Jt = { class: "fd-icon-picker" }, Wt = {
388
+ key: 1,
389
+ class: "fd-icon-placeholder"
390
+ }, Ht = { class: "fd-icon-grid" }, qt = ["title", "onClick"], Gt = { class: "fd-panel-item" }, Yt = ["value"], Kt = { class: "fd-panel-item fd-panel-item--row" }, Qt = { class: "fd-panel-item" }, Xt = ["value"], Zt = { class: "fd-panel-item" }, en = ["value"], tn = /* @__PURE__ */ L({
391
+ __name: "CardPanel",
392
+ props: {
393
+ node: {},
394
+ fields: {}
395
+ },
396
+ emits: ["update"],
397
+ setup(e, { emit: n }) {
398
+ const o = n, s = O(!1);
399
+ function a(i) {
400
+ o("update", { icon: i }), s.value = !1;
401
+ }
402
+ return (i, u) => (d(), c("div", jt, [
403
+ t("div", Rt, [
404
+ u[8] || (u[8] = t("label", null, "标题", -1)),
405
+ t("input", {
406
+ value: e.node.label,
407
+ onInput: u[0] || (u[0] = (r) => o("update", { label: r.target.value }))
408
+ }, null, 40, At)
409
+ ]),
410
+ t("div", zt, [
411
+ u[11] || (u[11] = t("label", null, "图标", -1)),
412
+ t("div", Jt, [
413
+ t("button", {
414
+ type: "button",
415
+ class: "fd-icon-trigger",
416
+ onClick: u[1] || (u[1] = (r) => s.value = !s.value)
417
+ }, [
418
+ e.node.icon ? (d(), V(ue, {
419
+ key: 0,
420
+ name: e.node.icon,
421
+ size: 16
422
+ }, null, 8, ["name"])) : (d(), c("span", Wt, "无图标")),
423
+ u[9] || (u[9] = t("svg", {
424
+ class: "fd-icon-caret",
425
+ viewBox: "0 0 24 24",
426
+ fill: "none",
427
+ stroke: "currentColor",
428
+ "stroke-width": "2",
429
+ "stroke-linecap": "round",
430
+ "stroke-linejoin": "round"
431
+ }, [
432
+ t("polyline", { points: "6 9 12 15 18 9" })
433
+ ], -1))
434
+ ]),
435
+ s.value ? (d(), c("div", {
436
+ key: 0,
437
+ class: "fd-icon-popover",
438
+ onClick: u[3] || (u[3] = J(() => {
439
+ }, ["stop"]))
440
+ }, [
441
+ t("div", Ht, [
442
+ t("button", {
443
+ type: "button",
444
+ class: R(["fd-icon-option", { active: !e.node.icon }]),
445
+ title: "无图标",
446
+ onClick: u[2] || (u[2] = (r) => a(""))
447
+ }, [...u[10] || (u[10] = [
448
+ t("span", { class: "fd-icon-none" }, "无", -1)
449
+ ])], 2),
450
+ (d(!0), c(T, null, N(h(Vt), (r) => (d(), c("button", {
451
+ key: r,
452
+ type: "button",
453
+ class: R(["fd-icon-option", { active: e.node.icon === r }]),
454
+ title: r,
455
+ onClick: (l) => a(r)
456
+ }, [
457
+ F(ue, {
458
+ name: r,
459
+ size: 18
460
+ }, null, 8, ["name"])
461
+ ], 10, qt))), 128))
462
+ ])
463
+ ])) : I("", !0)
464
+ ])
465
+ ]),
466
+ t("div", Gt, [
467
+ u[12] || (u[12] = t("label", null, "图标底色", -1)),
468
+ t("input", {
469
+ value: e.node.iconBgColor,
470
+ onInput: u[4] || (u[4] = (r) => o("update", { iconBgColor: r.target.value }))
471
+ }, null, 40, Yt)
472
+ ]),
473
+ t("div", Kt, [
474
+ u[13] || (u[13] = t("label", null, "初始展开", -1)),
475
+ F(se, {
476
+ "model-value": e.node.expanded,
477
+ "onUpdate:modelValue": u[5] || (u[5] = (r) => o("update", { expanded: r }))
478
+ }, null, 8, ["model-value"])
479
+ ]),
480
+ t("div", Qt, [
481
+ u[14] || (u[14] = t("label", null, "宽度", -1)),
482
+ t("input", {
483
+ value: e.node.width,
484
+ onInput: u[6] || (u[6] = (r) => o("update", { width: r.target.value }))
485
+ }, null, 40, Xt)
486
+ ]),
487
+ t("div", Zt, [
488
+ u[16] || (u[16] = t("label", null, "是否隐藏", -1)),
489
+ t("select", {
490
+ value: e.node.hiddenMode || "none",
491
+ onChange: u[7] || (u[7] = (r) => o("update", { hiddenMode: r.target.value }))
492
+ }, [...u[15] || (u[15] = [
493
+ t("option", { value: "none" }, "不隐藏", -1),
494
+ t("option", { value: "start" }, "发起时隐藏", -1),
495
+ t("option", { value: "not-start" }, "非发起时隐藏", -1),
496
+ t("option", { value: "not-approval" }, "非审批时隐藏", -1)
497
+ ])], 40, en)
498
+ ])
499
+ ]));
500
+ }
501
+ }), nn = /* @__PURE__ */ E(tn, [["__scopeId", "data-v-4585a5b8"]]), on = {
502
+ type: "card",
503
+ title: "卡片容器",
504
+ design: Lt,
505
+ render: Ot,
506
+ panel: nn,
507
+ isContainer: !0,
508
+ createDefaultProps: () => ({
509
+ id: "",
510
+ type: "card",
511
+ label: "卡片标题",
512
+ bindField: "",
513
+ icon: "",
514
+ iconBgColor: "",
515
+ expanded: !0,
516
+ width: "",
517
+ hiddenMode: "none",
518
+ children: []
519
+ }),
520
+ serialize: (e) => e
521
+ }, sn = { class: "fd-slot-design" }, ln = { class: "fd-slot-name" }, an = { class: "fd-slot-hint" }, dn = /* @__PURE__ */ L({
522
+ __name: "SlotDesign",
523
+ props: {
524
+ node: {}
525
+ },
526
+ setup(e) {
527
+ return (n, o) => (d(), c("div", sn, [
528
+ o[0] || (o[0] = t("span", { class: "fd-slot-tag" }, "插槽", -1)),
529
+ t("span", ln, y(e.node.slotName || "未命名插槽"), 1),
530
+ t("span", an, "宿主注入:" + y(e.node.slotName), 1)
531
+ ]));
532
+ }
533
+ }), rn = /* @__PURE__ */ E(dn, [["__scopeId", "data-v-d3fbc11d"]]), un = {
534
+ key: 0,
535
+ class: "fd-slot-render"
536
+ }, cn = { class: "fd-slot-missing" }, fn = /* @__PURE__ */ L({
537
+ __name: "SlotRender",
538
+ props: {
539
+ node: {},
540
+ mode: {},
541
+ formId: {},
542
+ formData: {}
543
+ },
544
+ setup(e) {
545
+ return (n, o) => {
546
+ var s;
547
+ return h(Te)(e.node.hiddenMode, (s = e.formData) == null ? void 0 : s.status) ? I("", !0) : (d(), c("div", un, [
548
+ Q(n.$slots, e.node.slotName, {
549
+ node: e.node,
550
+ formData: e.formData,
551
+ mode: e.mode,
552
+ formId: e.formId
553
+ }, () => [
554
+ t("div", cn, "未注入插槽:" + y(e.node.slotName), 1)
555
+ ], !0)
556
+ ]));
557
+ };
558
+ }
559
+ }), mn = /* @__PURE__ */ E(fn, [["__scopeId", "data-v-10795159"]]), pn = { class: "fd-panel" }, vn = { class: "fd-panel-item" }, bn = ["value"], gn = { class: "fd-panel-item" }, hn = { class: "fd-panel-item" }, yn = ["value"], kn = /* @__PURE__ */ L({
560
+ __name: "SlotPanel",
561
+ props: {
562
+ node: {},
563
+ fields: {}
564
+ },
565
+ emits: ["update"],
566
+ setup(e, { emit: n }) {
567
+ const o = n, s = W(), a = [
568
+ "header",
569
+ "base-info",
570
+ "shop-tuning",
571
+ "contract-links",
572
+ "contract-list",
573
+ "handover-records",
574
+ "attachments",
575
+ "ai-risk",
576
+ "initiator-opinion",
577
+ "approval-flow",
578
+ "return-records",
579
+ "approval-records",
580
+ "approval-opinion",
581
+ "footer"
582
+ ], i = O([]);
583
+ function u(f, v) {
584
+ f.forEach((k) => {
585
+ var P;
586
+ k.type === "slot" && k.slotName && v.add(k.slotName), (P = k.children) != null && P.length && u(k.children, v);
587
+ });
588
+ }
589
+ const r = M(() => {
590
+ const f = new Set(a);
591
+ return u(s.widgets, f), i.value.forEach((v) => v && f.add(v)), [...f];
592
+ });
593
+ function l(f) {
594
+ const v = f ?? "";
595
+ v && !r.value.includes(v) && i.value.push(v), o("update", { slotName: v });
596
+ }
597
+ return (f, v) => (d(), c("div", pn, [
598
+ t("div", vn, [
599
+ v[2] || (v[2] = t("label", null, "标题", -1)),
600
+ t("input", {
601
+ value: e.node.label,
602
+ onInput: v[0] || (v[0] = (k) => o("update", { label: k.target.value }))
603
+ }, null, 40, bn)
604
+ ]),
605
+ t("div", gn, [
606
+ v[3] || (v[3] = t("label", null, "插槽名", -1)),
607
+ F(h(re), {
608
+ "model-value": e.node.slotName,
609
+ filterable: "",
610
+ "allow-create": "",
611
+ clearable: "",
612
+ "default-first-option": "",
613
+ placeholder: "选择已有插槽名,或输入新名称创建",
614
+ style: { width: "100%" },
615
+ "onUpdate:modelValue": l
616
+ }, {
617
+ default: A(() => [
618
+ (d(!0), c(T, null, N(r.value, (k) => (d(), V(h(oe), {
619
+ key: k,
620
+ label: k,
621
+ value: k
622
+ }, null, 8, ["label", "value"]))), 128))
623
+ ]),
624
+ _: 1
625
+ }, 8, ["model-value"])
626
+ ]),
627
+ t("div", hn, [
628
+ v[5] || (v[5] = t("label", null, "是否隐藏", -1)),
629
+ t("select", {
630
+ value: e.node.hiddenMode || "none",
631
+ onChange: v[1] || (v[1] = (k) => o("update", { hiddenMode: k.target.value }))
632
+ }, [...v[4] || (v[4] = [
633
+ t("option", { value: "none" }, "不隐藏", -1),
634
+ t("option", { value: "start" }, "发起时隐藏", -1),
635
+ t("option", { value: "not-start" }, "非发起时隐藏", -1),
636
+ t("option", { value: "not-approval" }, "非审批时隐藏", -1)
637
+ ])], 40, yn)
638
+ ])
639
+ ]));
640
+ }
641
+ }), wn = /* @__PURE__ */ E(kn, [["__scopeId", "data-v-dfae47c6"]]), $n = {
642
+ type: "slot",
643
+ title: "插槽",
644
+ design: rn,
645
+ render: mn,
646
+ panel: wn,
647
+ isContainer: !1,
648
+ createDefaultProps: () => ({
649
+ id: "",
650
+ type: "slot",
651
+ label: "插槽",
652
+ bindField: "",
653
+ slotName: "",
654
+ slotProps: {},
655
+ hiddenMode: "none"
656
+ }),
657
+ serialize: (e) => e
658
+ }, xn = { class: "fd-st-design" }, Cn = {
659
+ key: 0,
660
+ class: "fd-st-table-wrap"
661
+ }, _n = { class: "fd-st-table" }, In = {
662
+ key: 0,
663
+ class: "fd-st-seq"
664
+ }, Dn = {
665
+ key: 0,
666
+ class: "fd-st-seq"
667
+ }, Sn = {
668
+ key: 1,
669
+ class: "fd-st-cards"
670
+ }, Tn = { class: "fd-st-card" }, Fn = { class: "fd-st-card-label" }, Ln = {
671
+ key: 0,
672
+ class: "fd-st-cards-empty"
673
+ }, Mn = /* @__PURE__ */ L({
674
+ __name: "SubtableDesign",
675
+ props: {
676
+ node: {}
677
+ },
678
+ setup(e) {
679
+ const n = e, o = M(() => n.node.tablestyle !== "cards");
680
+ return (s, a) => (d(), c("div", xn, [
681
+ o.value ? (d(), c("div", Cn, [
682
+ t("table", _n, [
683
+ t("thead", null, [
684
+ t("tr", null, [
685
+ e.node.secondtableindex === "1" ? (d(), c("th", In, "序号")) : I("", !0),
686
+ (d(!0), c(T, null, N(e.node.colnums.filter((i) => i.isshow === 1), (i) => (d(), c("th", {
687
+ key: i.name,
688
+ style: G({ width: i.showwidth || void 0 })
689
+ }, y(i.showname || i.major || i.name), 5))), 128))
690
+ ])
691
+ ]),
692
+ t("tbody", null, [
693
+ t("tr", null, [
694
+ e.node.secondtableindex === "1" ? (d(), c("td", Dn, "1")) : I("", !0),
695
+ (d(!0), c(T, null, N(e.node.colnums.filter((i) => i.isshow === 1), (i) => (d(), c("td", {
696
+ key: i.name,
697
+ class: R(["fd-st-cell", { "fd-st-cell--link": !!i.bindLink }])
698
+ }, y(i.name), 3))), 128))
699
+ ])
700
+ ])
701
+ ])
702
+ ])) : (d(), c("div", Sn, [
703
+ t("div", Tn, [
704
+ (d(!0), c(T, null, N(e.node.colnums.filter((i) => i.isshow === 1), (i) => (d(), c("div", {
705
+ key: i.name,
706
+ class: "fd-st-card-row"
707
+ }, [
708
+ t("span", Fn, y(i.showname || i.major), 1),
709
+ t("span", {
710
+ class: R(["fd-st-card-value", { "fd-st-card-value--link": !!i.bindLink }])
711
+ }, y(i.name), 3)
712
+ ]))), 128))
713
+ ]),
714
+ e.node.colnums.filter((i) => i.isshow === 1).length === 0 ? (d(), c("div", Ln, " 暂无列配置 ")) : I("", !0)
715
+ ]))
716
+ ]));
717
+ }
718
+ }), Nn = /* @__PURE__ */ E(Mn, [["__scopeId", "data-v-aba8caec"]]), En = ["subtable-key"], Pn = {
719
+ key: 0,
720
+ class: "fd-st-table-wrap"
721
+ }, On = { class: "fd-st-table" }, Un = {
722
+ key: 0,
723
+ class: "fd-st-seq"
724
+ }, Bn = ["subtable-val"], Vn = {
725
+ key: 1,
726
+ class: "fd-st-op"
727
+ }, jn = {
728
+ key: 0,
729
+ class: "fd-st-seq"
730
+ }, Rn = ["rowspan", "subtable-val"], An = ["href"], zn = {
731
+ key: 1,
732
+ class: "fd-st-op"
733
+ }, Jn = ["onClick"], Wn = { key: 0 }, Hn = ["colspan"], qn = {
734
+ key: 1,
735
+ class: "fd-st-cards"
736
+ }, Gn = { class: "fd-st-card-label" }, Yn = ["subtable-val"], Kn = ["href"], Qn = {
737
+ key: 0,
738
+ class: "fd-st-card-actions"
739
+ }, Xn = ["onClick"], Zn = {
740
+ key: 0,
741
+ class: "fd-st-cards-empty"
742
+ }, eo = /* @__PURE__ */ L({
743
+ __name: "SubtableRender",
744
+ props: {
745
+ node: {},
746
+ formData: {}
747
+ },
748
+ setup(e) {
749
+ const n = e, o = M(() => n.node.colnums.filter((_) => _.isshow === 1)), s = M(() => n.node.isreadonly === "1"), a = M(() => {
750
+ var D;
751
+ const _ = (D = n.formData) == null ? void 0 : D[n.node.secondtable];
752
+ return Array.isArray(_) ? _ : [];
753
+ }), i = M(() => !(n.node.nodatahidetable === "1" && a.value.length === 0)), u = M(() => n.node.tablestyle !== "cards");
754
+ function r() {
755
+ if (s.value) return;
756
+ const _ = {};
757
+ o.value.forEach((D) => _[D.name] = ""), n.formData && Array.isArray(n.formData[n.node.secondtable]) && n.formData[n.node.secondtable].push(_);
758
+ }
759
+ function l(_) {
760
+ s.value || n.formData && Array.isArray(n.formData[n.node.secondtable]) && n.formData[n.node.secondtable].splice(_, 1);
761
+ }
762
+ function f(_, D) {
763
+ const m = _[D];
764
+ return m == null ? "" : String(m);
765
+ }
766
+ function v(_, D) {
767
+ return _.bindLink ? f(D, _.bindLink) : "";
768
+ }
769
+ const k = M(() => {
770
+ const _ = a.value, D = [], m = [];
771
+ return o.value.forEach((g, $) => {
772
+ D[$] = [], m[$] = [];
773
+ const B = g.issamecolmerge === 1;
774
+ let q = 0;
775
+ for (let x = 0; x < _.length; x++) {
776
+ const p = f(_[x], g.name);
777
+ B && p !== "" && x > 0 && p === f(_[x - 1], g.name) ? (m[$][x] = !0, D[$][q] += 1) : (m[$][x] = !1, D[$][x] = 1, q = x);
778
+ }
779
+ }), { spans: D, skipped: m };
780
+ });
781
+ function P(_, D) {
782
+ var m;
783
+ return ((m = k.value.skipped[_]) == null ? void 0 : m[D]) === !0;
784
+ }
785
+ function j(_, D) {
786
+ var g;
787
+ const m = (g = k.value.spans[_]) == null ? void 0 : g[D];
788
+ return m && m > 1 ? m : void 0;
789
+ }
790
+ return (_, D) => i.value ? (d(), c("div", {
791
+ key: 0,
792
+ class: "fd-st-render",
793
+ "subtable-key": e.node.secondtable
794
+ }, [
795
+ u.value ? (d(), c("div", Pn, [
796
+ t("table", On, [
797
+ t("thead", null, [
798
+ t("tr", null, [
799
+ e.node.secondtableindex === "1" ? (d(), c("th", Un, "序号")) : I("", !0),
800
+ (d(!0), c(T, null, N(o.value, (m) => (d(), c("th", {
801
+ key: m.name,
802
+ "subtable-val": m.name,
803
+ style: G({ width: m.showwidth || void 0, textAlign: m.align || "left" })
804
+ }, y(m.showname || m.major || m.name), 13, Bn))), 128)),
805
+ s.value ? I("", !0) : (d(), c("th", Vn, "操作"))
806
+ ])
807
+ ]),
808
+ t("tbody", null, [
809
+ (d(!0), c(T, null, N(a.value, (m, g) => (d(), c("tr", { key: g }, [
810
+ e.node.secondtableindex === "1" ? (d(), c("td", jn, y(g + 1), 1)) : I("", !0),
811
+ (d(!0), c(T, null, N(o.value, ($, B) => (d(), c(T, {
812
+ key: $.name
813
+ }, [
814
+ P(B, g) ? I("", !0) : (d(), c("td", {
815
+ key: 0,
816
+ rowspan: j(B, g),
817
+ "subtable-val": $.name,
818
+ style: G({ textAlign: $.align || "left", color: $.prospect || void 0, background: $.background || void 0 })
819
+ }, [
820
+ v($, m) ? (d(), c("a", {
821
+ key: 0,
822
+ class: "fd-st-link",
823
+ href: v($, m),
824
+ target: "_blank",
825
+ rel: "noopener noreferrer"
826
+ }, y(f(m, $.name)), 9, An)) : (d(), c(T, { key: 1 }, [
827
+ U(y(f(m, $.name)), 1)
828
+ ], 64))
829
+ ], 12, Rn))
830
+ ], 64))), 128)),
831
+ s.value ? I("", !0) : (d(), c("td", zn, [
832
+ t("button", {
833
+ class: "fd-btn fd-btn--danger",
834
+ onClick: ($) => l(g)
835
+ }, "删除", 8, Jn)
836
+ ]))
837
+ ]))), 128)),
838
+ a.value.length === 0 ? (d(), c("tr", Wn, [
839
+ t("td", {
840
+ colspan: o.value.length + (e.node.secondtableindex === "1" ? 1 : 0) + (s.value ? 0 : 1),
841
+ class: "fd-st-empty"
842
+ }, y(e.node.nodatatitle === "1" ? "暂无数据" : ""), 9, Hn)
843
+ ])) : I("", !0)
844
+ ])
845
+ ])
846
+ ])) : (d(), c("div", qn, [
847
+ (d(!0), c(T, null, N(a.value, (m, g) => (d(), c("div", {
848
+ key: g,
849
+ class: "fd-st-card"
850
+ }, [
851
+ (d(!0), c(T, null, N(o.value, ($) => (d(), c("div", {
852
+ key: $.name,
853
+ class: "fd-st-card-row"
854
+ }, [
855
+ t("span", Gn, y($.showname || $.major || $.name), 1),
856
+ t("span", {
857
+ class: "fd-st-card-value",
858
+ "subtable-val": $.name
859
+ }, [
860
+ v($, m) ? (d(), c("a", {
861
+ key: 0,
862
+ class: "fd-st-link",
863
+ href: v($, m),
864
+ target: "_blank",
865
+ rel: "noopener noreferrer"
866
+ }, y(f(m, $.name)), 9, Kn)) : (d(), c(T, { key: 1 }, [
867
+ U(y(f(m, $.name)), 1)
868
+ ], 64))
869
+ ], 8, Yn)
870
+ ]))), 128)),
871
+ s.value ? I("", !0) : (d(), c("div", Qn, [
872
+ t("button", {
873
+ class: "fd-btn fd-btn--danger fd-btn--sm",
874
+ onClick: ($) => l(g)
875
+ }, "删除", 8, Xn)
876
+ ]))
877
+ ]))), 128)),
878
+ a.value.length === 0 ? (d(), c("div", Zn, y(e.node.nodatatitle === "1" ? "暂无数据" : ""), 1)) : I("", !0)
879
+ ])),
880
+ s.value ? I("", !0) : (d(), c("button", {
881
+ key: 2,
882
+ class: "fd-btn fd-btn--primary fd-st-add",
883
+ onClick: r
884
+ }, "新增一行"))
885
+ ], 8, En)) : I("", !0);
886
+ }
887
+ }), to = /* @__PURE__ */ E(eo, [["__scopeId", "data-v-a650847e"]]);
888
+ function no(e) {
889
+ return e.fields.map((n, o) => {
890
+ const s = n.dataType === "file", a = n.dataType === "link";
891
+ return {
892
+ name: n.name,
893
+ isshow: 1,
894
+ major: "",
895
+ showname: n.label,
896
+ showwidth: "",
897
+ background: "",
898
+ prospect: "",
899
+ issum: 0,
900
+ index: o + 1,
901
+ align: "",
902
+ iscompletehide: 0,
903
+ iscompletehidecode: "",
904
+ issamecolmerge: 0,
905
+ // 链接字段:直接使用所绑定字段的链接
906
+ bindLink: a ? n.name : "",
907
+ editmode: { editmode: s ? "files" : "text", title: s ? "文件" : "文本" },
908
+ events: []
909
+ };
910
+ });
911
+ }
912
+ const oo = { class: "fd-panel" }, so = { class: "fd-panel-item" }, lo = { class: "fd-panel-item fd-panel-item--row" }, ao = { class: "fd-panel-item fd-panel-item--row" }, io = { class: "fd-panel-item" }, ro = { class: "fd-panel-item" }, uo = { class: "fd-cols-head" }, co = {
913
+ key: 0,
914
+ class: "fd-cols-empty"
915
+ }, fo = { class: "fd-col-card-top" }, mo = { class: "fd-col-order" }, po = { class: "fd-col-meta" }, vo = { class: "fd-col-title" }, bo = { class: "fd-col-name-sub" }, go = { class: "fd-col-tag" }, ho = { class: "fd-col-card-bottom" }, yo = { class: "fd-col-switch" }, ko = { class: "fd-col-actions" }, wo = ["onClick"], $o = ["onClick"], xo = {
916
+ class: "fd-dialog",
917
+ style: { "max-width": "560px" }
918
+ }, Co = { class: "fd-dialog-head" }, _o = { class: "fd-dialog-body" }, Io = { class: "fd-form-section" }, Do = { class: "fd-form-grid" }, So = { class: "fd-form-item" }, To = ["value"], Fo = ["value"], Lo = { class: "fd-form-item" }, Mo = ["value"], No = { class: "fd-form-item" }, Eo = ["value"], Po = { class: "fd-form-item" }, Oo = ["value"], Uo = { class: "fd-form-section" }, Bo = { class: "fd-form-grid" }, Vo = { class: "fd-form-item" }, jo = ["value"], Ro = { class: "fd-form-item" }, Ao = ["value"], zo = { class: "fd-form-item" }, Jo = { class: "fd-color-row" }, Wo = ["value"], Ho = ["value"], qo = { class: "fd-form-item" }, Go = { class: "fd-color-row" }, Yo = ["value"], Ko = ["value"], Qo = { class: "fd-form-section" }, Xo = { class: "fd-form-grid" }, Zo = { class: "fd-form-item" }, es = { class: "fd-form-item" }, ts = ["value"], ns = /* @__PURE__ */ L({
919
+ __name: "SubtablePanel",
920
+ props: {
921
+ node: {},
922
+ fields: {}
923
+ },
924
+ emits: ["update"],
925
+ setup(e, { emit: n }) {
926
+ const o = e, s = n, a = W(), i = M(() => a.subTables);
927
+ function u(x, p) {
928
+ s("update", { [x]: p });
929
+ }
930
+ function r(x) {
931
+ const p = x ?? "", w = a.subTables.find((b) => b.name === p), C = { secondtable: p };
932
+ w && (C.displaytitle = w.label, C.colnums = no(w)), s("update", C);
933
+ }
934
+ const l = Ie({
935
+ open: !1,
936
+ index: -1,
937
+ draft: null
938
+ });
939
+ function f(x) {
940
+ return JSON.parse(JSON.stringify(x));
941
+ }
942
+ function v(x) {
943
+ l.index = x, l.draft = f(o.node.colnums[x]), l.open = !0;
944
+ }
945
+ function k() {
946
+ l.open = !1, l.draft = null, l.index = -1;
947
+ }
948
+ function P() {
949
+ if (l.draft && l.index >= 0) {
950
+ const x = [...o.node.colnums];
951
+ x[l.index] = l.draft, s("update", { colnums: x });
952
+ }
953
+ k();
954
+ }
955
+ function j(x, p) {
956
+ x.isshow = p ? 1 : 0, s("update", { colnums: [...o.node.colnums] });
957
+ }
958
+ async function _() {
959
+ const x = {
960
+ name: `col_${Date.now().toString(36)}`,
961
+ isshow: 1,
962
+ major: "",
963
+ showname: "新列",
964
+ showwidth: "",
965
+ background: "",
966
+ prospect: "",
967
+ issum: 0,
968
+ index: o.node.colnums.length + 1,
969
+ align: "",
970
+ iscompletehide: 0,
971
+ iscompletehidecode: "",
972
+ issamecolmerge: 0,
973
+ bindLink: "",
974
+ editmode: { editmode: "text", title: "文本" },
975
+ events: []
976
+ };
977
+ s("update", { colnums: [...o.node.colnums, x] }), await De(), v(o.node.colnums.length - 1);
978
+ }
979
+ function D(x) {
980
+ const p = o.node.colnums.slice();
981
+ p.splice(x, 1), s("update", { colnums: p });
982
+ }
983
+ function m(x) {
984
+ return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(x) ? x : "#ffffff";
985
+ }
986
+ function g(x, p) {
987
+ l.draft && (l.draft[x] = p.target.value);
988
+ }
989
+ const $ = M(() => {
990
+ var x;
991
+ return ((x = a.subTables.find((p) => p.name === o.node.secondtable)) == null ? void 0 : x.fields) ?? [];
992
+ });
993
+ function B(x) {
994
+ if (!l.draft) return;
995
+ const p = x.target.value;
996
+ l.draft.name = p;
997
+ const w = $.value.find((C) => C.name === p);
998
+ if (w) {
999
+ l.draft.showname = w.label;
1000
+ const C = w.dataType === "file";
1001
+ l.draft.editmode.editmode = C ? "files" : "text", l.draft.editmode.title = C ? "文件" : "文本", l.draft.bindLink = w.dataType === "link" ? p : "";
1002
+ }
1003
+ }
1004
+ function q(x) {
1005
+ u("tablestyle", x || "table");
1006
+ }
1007
+ return (x, p) => (d(), c(T, null, [
1008
+ t("div", oo, [
1009
+ t("div", so, [
1010
+ p[13] || (p[13] = t("label", null, "选择子表", -1)),
1011
+ F(h(re), {
1012
+ "model-value": e.node.secondtable,
1013
+ filterable: "",
1014
+ clearable: "",
1015
+ placeholder: "请选择子表",
1016
+ style: { width: "100%" },
1017
+ "onUpdate:modelValue": r
1018
+ }, {
1019
+ default: A(() => [
1020
+ (d(!0), c(T, null, N(i.value, (w) => (d(), V(h(oe), {
1021
+ key: w.name,
1022
+ label: `${w.label}(${w.name})`,
1023
+ value: w.name
1024
+ }, null, 8, ["label", "value"]))), 128))
1025
+ ]),
1026
+ _: 1
1027
+ }, 8, ["model-value"])
1028
+ ]),
1029
+ t("div", lo, [
1030
+ p[14] || (p[14] = t("label", null, "只读", -1)),
1031
+ F(se, {
1032
+ "model-value": e.node.isreadonly === "1",
1033
+ "onUpdate:modelValue": p[0] || (p[0] = (w) => u("isreadonly", w ? "1" : "0"))
1034
+ }, null, 8, ["model-value"])
1035
+ ]),
1036
+ t("div", ao, [
1037
+ p[15] || (p[15] = t("label", null, "序号列", -1)),
1038
+ F(se, {
1039
+ "model-value": e.node.secondtableindex === "1",
1040
+ "onUpdate:modelValue": p[1] || (p[1] = (w) => u("secondtableindex", w ? "1" : "0"))
1041
+ }, null, 8, ["model-value"])
1042
+ ]),
1043
+ t("div", io, [
1044
+ p[16] || (p[16] = t("label", null, "表格样式", -1)),
1045
+ F(h(re), {
1046
+ "model-value": e.node.tablestyle || "table",
1047
+ style: { width: "100%" },
1048
+ "onUpdate:modelValue": q
1049
+ }, {
1050
+ default: A(() => [
1051
+ F(h(oe), {
1052
+ label: "表格",
1053
+ value: "table"
1054
+ }),
1055
+ F(h(oe), {
1056
+ label: "卡片列表",
1057
+ value: "cards"
1058
+ })
1059
+ ]),
1060
+ _: 1
1061
+ }, 8, ["model-value"])
1062
+ ]),
1063
+ t("div", ro, [
1064
+ t("div", uo, [
1065
+ t("span", null, "列配置(" + y(e.node.colnums.length) + ")", 1),
1066
+ t("button", {
1067
+ class: "fd-btn fd-btn--primary fd-btn--sm",
1068
+ onClick: _
1069
+ }, "+ 新增列")
1070
+ ]),
1071
+ e.node.colnums.length === 0 ? (d(), c("div", co, " 暂无列,点击「新增列」添加 ")) : I("", !0),
1072
+ (d(!0), c(T, null, N(e.node.colnums, (w, C) => (d(), c("div", {
1073
+ key: w.name,
1074
+ class: "fd-col-card"
1075
+ }, [
1076
+ t("div", fo, [
1077
+ t("span", mo, y(C + 1), 1),
1078
+ t("div", po, [
1079
+ t("span", vo, y(w.showname || "未命名列"), 1),
1080
+ t("span", bo, y(w.name), 1)
1081
+ ]),
1082
+ t("span", go, y(w.bindLink ? "链接" : "文本"), 1)
1083
+ ]),
1084
+ t("div", ho, [
1085
+ t("label", yo, [
1086
+ p[17] || (p[17] = t("span", null, "显示", -1)),
1087
+ F(se, {
1088
+ "model-value": w.isshow === 1,
1089
+ "onUpdate:modelValue": (b) => j(w, b)
1090
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
1091
+ ]),
1092
+ t("div", ko, [
1093
+ t("button", {
1094
+ class: "fd-btn fd-btn--ghost fd-btn--sm",
1095
+ onClick: (b) => v(C)
1096
+ }, "设置", 8, wo),
1097
+ t("button", {
1098
+ class: "fd-btn fd-btn--danger fd-btn--sm",
1099
+ onClick: (b) => D(C)
1100
+ }, "删除", 8, $o)
1101
+ ])
1102
+ ])
1103
+ ]))), 128))
1104
+ ])
1105
+ ]),
1106
+ (d(), V(pe, { to: "body" }, [
1107
+ l.open && l.draft ? (d(), c("div", {
1108
+ key: 0,
1109
+ class: "fd-dialog-mask",
1110
+ onClick: J(k, ["self"])
1111
+ }, [
1112
+ t("div", xo, [
1113
+ t("div", Co, [
1114
+ t("span", null, "列设置 · " + y(l.draft.showname || l.draft.name || "新列"), 1),
1115
+ t("button", {
1116
+ class: "fd-dialog-close",
1117
+ onClick: k,
1118
+ title: "关闭"
1119
+ }, "×")
1120
+ ]),
1121
+ t("div", _o, [
1122
+ t("section", Io, [
1123
+ p[23] || (p[23] = t("h5", { class: "fd-form-section-h" }, "基本信息", -1)),
1124
+ t("div", Do, [
1125
+ t("div", So, [
1126
+ p[19] || (p[19] = t("label", null, "列字段", -1)),
1127
+ t("select", {
1128
+ value: l.draft.name,
1129
+ onChange: p[2] || (p[2] = (w) => B(w))
1130
+ }, [
1131
+ p[18] || (p[18] = t("option", { value: "" }, "请选择字段", -1)),
1132
+ (d(!0), c(T, null, N($.value, (w) => (d(), c("option", {
1133
+ key: w.name,
1134
+ value: w.name
1135
+ }, y(w.label) + "(" + y(w.name) + ")", 9, Fo))), 128))
1136
+ ], 40, To)
1137
+ ]),
1138
+ t("div", Lo, [
1139
+ p[20] || (p[20] = t("label", null, "显示标题", -1)),
1140
+ t("input", {
1141
+ value: l.draft.showname,
1142
+ onInput: p[3] || (p[3] = (w) => l.draft.showname = w.target.value),
1143
+ placeholder: "如 姓名"
1144
+ }, null, 40, Mo)
1145
+ ]),
1146
+ t("div", No, [
1147
+ p[21] || (p[21] = t("label", null, "主表头分组", -1)),
1148
+ t("input", {
1149
+ value: l.draft.major,
1150
+ onInput: p[4] || (p[4] = (w) => l.draft.major = w.target.value),
1151
+ placeholder: "可合并表头分组名"
1152
+ }, null, 40, Eo)
1153
+ ]),
1154
+ t("div", Po, [
1155
+ p[22] || (p[22] = t("label", null, "列序号", -1)),
1156
+ t("input", {
1157
+ type: "number",
1158
+ min: "1",
1159
+ value: l.draft.index,
1160
+ onInput: p[5] || (p[5] = (w) => l.draft.index = Number(w.target.value))
1161
+ }, null, 40, Oo)
1162
+ ])
1163
+ ])
1164
+ ]),
1165
+ t("section", Uo, [
1166
+ p[29] || (p[29] = t("h5", { class: "fd-form-section-h" }, "显示与样式", -1)),
1167
+ t("div", Bo, [
1168
+ t("div", Vo, [
1169
+ p[24] || (p[24] = t("label", null, "列宽", -1)),
1170
+ t("input", {
1171
+ value: l.draft.showwidth,
1172
+ onInput: p[6] || (p[6] = (w) => l.draft.showwidth = w.target.value),
1173
+ placeholder: "如 120px 或 20%"
1174
+ }, null, 40, jo)
1175
+ ]),
1176
+ t("div", Ro, [
1177
+ p[26] || (p[26] = t("label", null, "对齐方式", -1)),
1178
+ t("select", {
1179
+ value: l.draft.align,
1180
+ onChange: p[7] || (p[7] = (w) => l.draft.align = w.target.value)
1181
+ }, [...p[25] || (p[25] = [
1182
+ t("option", { value: "" }, "默认(左)", -1),
1183
+ t("option", { value: "left" }, "左对齐", -1),
1184
+ t("option", { value: "center" }, "居中", -1),
1185
+ t("option", { value: "right" }, "右对齐", -1)
1186
+ ])], 40, Ao)
1187
+ ]),
1188
+ t("div", zo, [
1189
+ p[27] || (p[27] = t("label", null, "背景色", -1)),
1190
+ t("div", Jo, [
1191
+ t("input", {
1192
+ type: "color",
1193
+ value: m(l.draft.background),
1194
+ onInput: p[8] || (p[8] = (w) => g("background", w))
1195
+ }, null, 40, Wo),
1196
+ t("input", {
1197
+ value: l.draft.background,
1198
+ onInput: p[9] || (p[9] = (w) => l.draft.background = w.target.value),
1199
+ placeholder: "如 #f5f7fa 或空"
1200
+ }, null, 40, Ho)
1201
+ ])
1202
+ ]),
1203
+ t("div", qo, [
1204
+ p[28] || (p[28] = t("label", null, "字体色", -1)),
1205
+ t("div", Go, [
1206
+ t("input", {
1207
+ type: "color",
1208
+ value: m(l.draft.prospect),
1209
+ onInput: p[10] || (p[10] = (w) => g("prospect", w))
1210
+ }, null, 40, Yo),
1211
+ t("input", {
1212
+ value: l.draft.prospect,
1213
+ onInput: p[11] || (p[11] = (w) => l.draft.prospect = w.target.value),
1214
+ placeholder: "如 #f5523a 或空"
1215
+ }, null, 40, Ko)
1216
+ ])
1217
+ ])
1218
+ ])
1219
+ ]),
1220
+ t("section", Qo, [
1221
+ p[32] || (p[32] = t("h5", { class: "fd-form-section-h" }, "编辑模式", -1)),
1222
+ t("div", Xo, [
1223
+ t("div", Zo, [
1224
+ p[30] || (p[30] = t("label", null, "同内容合并", -1)),
1225
+ F(se, {
1226
+ "model-value": l.draft.issamecolmerge === 1,
1227
+ "onUpdate:modelValue": p[12] || (p[12] = (w) => l.draft.issamecolmerge = w ? 1 : 0)
1228
+ }, null, 8, ["model-value"])
1229
+ ]),
1230
+ t("div", es, [
1231
+ p[31] || (p[31] = t("label", null, "链接", -1)),
1232
+ t("input", {
1233
+ value: l.draft.bindLink ? `${l.draft.bindLink}(链接字段自动绑定)` : "非链接字段",
1234
+ readonly: ""
1235
+ }, null, 8, ts)
1236
+ ])
1237
+ ])
1238
+ ])
1239
+ ]),
1240
+ t("div", { class: "fd-dialog-foot" }, [
1241
+ t("button", {
1242
+ class: "fd-btn fd-btn--ghost",
1243
+ onClick: k
1244
+ }, "取消"),
1245
+ t("button", {
1246
+ class: "fd-btn fd-btn--primary",
1247
+ onClick: P
1248
+ }, "确定")
1249
+ ])
1250
+ ])
1251
+ ])) : I("", !0)
1252
+ ]))
1253
+ ], 64));
1254
+ }
1255
+ }), os = /* @__PURE__ */ E(ns, [["__scopeId", "data-v-e1fd519d"]]);
1256
+ function ss() {
1257
+ return [
1258
+ {
1259
+ name: "field1",
1260
+ isshow: 1,
1261
+ major: "",
1262
+ showname: "字段一",
1263
+ showwidth: "",
1264
+ background: "",
1265
+ prospect: "",
1266
+ issum: 0,
1267
+ index: 1,
1268
+ align: "",
1269
+ iscompletehide: 0,
1270
+ iscompletehidecode: "",
1271
+ issamecolmerge: 0,
1272
+ bindLink: "",
1273
+ editmode: { editmode: "text", title: "文本" },
1274
+ events: []
1275
+ },
1276
+ {
1277
+ name: "field2",
1278
+ isshow: 1,
1279
+ major: "",
1280
+ showname: "字段二",
1281
+ showwidth: "",
1282
+ background: "",
1283
+ prospect: "",
1284
+ issum: 0,
1285
+ index: 2,
1286
+ align: "",
1287
+ iscompletehide: 0,
1288
+ iscompletehidecode: "",
1289
+ issamecolmerge: 0,
1290
+ bindLink: "",
1291
+ editmode: { editmode: "text", title: "文本" },
1292
+ events: []
1293
+ }
1294
+ ];
1295
+ }
1296
+ const ls = {
1297
+ type: "subtable",
1298
+ title: "子表",
1299
+ design: Nn,
1300
+ render: to,
1301
+ panel: os,
1302
+ isContainer: !1,
1303
+ createDefaultProps: () => ({
1304
+ id: "",
1305
+ type: "subtable",
1306
+ label: "子表",
1307
+ bindField: "",
1308
+ firsttable: "",
1309
+ secondtable: "",
1310
+ primarytablefiled: "",
1311
+ secondtableprimarykey: "",
1312
+ secondtablerelationfield: "",
1313
+ tabletype: "subtable",
1314
+ displaytitle: "",
1315
+ tablestyle: "table",
1316
+ isreadonly: "1",
1317
+ isnull: "0",
1318
+ issave: "0",
1319
+ secondtableindex: "0",
1320
+ nodatahidetable: "0",
1321
+ nodatatitle: "1",
1322
+ fixedcolumn: 0,
1323
+ tablewidth: 0,
1324
+ tableheight: 0,
1325
+ iscompletehide: "0",
1326
+ iscompletehidecode: "",
1327
+ colnums: ss(),
1328
+ events: []
1329
+ }),
1330
+ serialize: (e) => e
1331
+ }, as = /* @__PURE__ */ L({
1332
+ __name: "GridDesign",
1333
+ props: {
1334
+ node: {}
1335
+ },
1336
+ setup(e) {
1337
+ const n = W();
1338
+ return (o, s) => (d(), c("div", {
1339
+ class: R(["fd-grid-design", { "is-mobile": h(n).device === "mobile" }])
1340
+ }, [
1341
+ Q(o.$slots, "children", {}, void 0, !0)
1342
+ ], 2));
1343
+ }
1344
+ }), is = /* @__PURE__ */ E(as, [["__scopeId", "data-v-25511a77"]]), ge = /* @__PURE__ */ L({
1345
+ __name: "WidgetHost",
1346
+ props: {
1347
+ node: {},
1348
+ mode: {},
1349
+ formMode: {},
1350
+ formData: {},
1351
+ formId: {}
1352
+ },
1353
+ setup(e) {
1354
+ const n = e, o = M(() => K(n.node.type)), s = M(() => o.value ? n.mode === "design" ? o.value.design : o.value.render : null), a = (i) => i && n.formData ? n.formData[i] : void 0;
1355
+ return (i, u) => {
1356
+ var l;
1357
+ const r = Se("WidgetHost", !0);
1358
+ return s.value ? (d(), V(me(s.value), de({
1359
+ key: 0,
1360
+ node: e.node,
1361
+ value: a(e.node.bindField),
1362
+ "form-data": e.formData
1363
+ }, e.mode === "render" ? { formMode: e.formMode, formId: e.formId } : null), ae({ _: 2 }, [
1364
+ N(i.$slots, (f, v) => ({
1365
+ name: v,
1366
+ fn: A((k) => [
1367
+ Q(i.$slots, v, Ue(Be(k || {})))
1368
+ ])
1369
+ })),
1370
+ (l = o.value) != null && l.isContainer && !i.$slots.children ? {
1371
+ name: "children",
1372
+ fn: A(() => [
1373
+ (d(!0), c(T, null, N(e.node.children, (f) => (d(), V(r, {
1374
+ key: f.id,
1375
+ node: f,
1376
+ mode: e.mode,
1377
+ "form-mode": e.formMode,
1378
+ "form-data": e.formData,
1379
+ "form-id": e.formId
1380
+ }, ae({ _: 2 }, [
1381
+ N(i.$slots, (v, k) => ({
1382
+ name: k,
1383
+ fn: A((P) => [
1384
+ Q(i.$slots, k, de({ ref_for: !0 }, P || {}))
1385
+ ])
1386
+ }))
1387
+ ]), 1032, ["node", "mode", "form-mode", "form-data", "form-id"]))), 128))
1388
+ ]),
1389
+ key: "0"
1390
+ } : void 0
1391
+ ]), 1040, ["node", "value", "form-data"])) : I("", !0);
1392
+ };
1393
+ }
1394
+ }), ds = 24;
1395
+ function Fe(e, n, o, s, a = !1) {
1396
+ if (e.type !== "label" || !o.length) return "";
1397
+ const i = a ? 1 : ds, u = (D) => Math.min(Math.max(D.gridSpan || s || i, 1), i), r = [];
1398
+ let l = 0, f = 0;
1399
+ for (const D of o) {
1400
+ const m = u(D);
1401
+ l + m > i && (l = 0, f++);
1402
+ const g = l === 0;
1403
+ l += m;
1404
+ const $ = l >= i;
1405
+ r.push({ row: f, rowFirst: g, rowLast: $ }), l >= i && (l = 0, f++);
1406
+ }
1407
+ const v = r[n];
1408
+ if (!v) return "";
1409
+ const k = r[r.length - 1].row, P = v.row === 0, j = v.row === k, _ = [];
1410
+ return v.rowFirst && P && _.push("is-g-corner-tl"), v.rowLast && P && _.push("is-g-corner-tr"), v.rowFirst && j && _.push("is-g-corner-bl"), v.rowLast && j && _.push("is-g-corner-br"), _.join(" ");
1411
+ }
1412
+ const rs = /* @__PURE__ */ L({
1413
+ __name: "GridRender",
1414
+ props: {
1415
+ node: {},
1416
+ formMode: {},
1417
+ formData: {},
1418
+ formId: {}
1419
+ },
1420
+ setup(e) {
1421
+ const n = W(), o = O(!1);
1422
+ let s = null;
1423
+ ie(() => {
1424
+ s = window.matchMedia("(max-width: 768px)"), o.value = s.matches, s.addEventListener("change", (i) => {
1425
+ o.value = i.matches;
1426
+ });
1427
+ }), Ce(() => {
1428
+ s && s.removeEventListener("change", () => {
1429
+ });
1430
+ });
1431
+ const a = M(() => n.device === "mobile" || o.value);
1432
+ return (i, u) => (d(), c("div", {
1433
+ class: R(["fd-grid-render", { "is-mobile": a.value }])
1434
+ }, [
1435
+ (d(!0), c(T, null, N(e.node.children, (r, l) => (d(), c("div", {
1436
+ key: r.id,
1437
+ class: R(["fd-grid-cell", h(Fe)(r, l, e.node.children || [], e.node.layout || 24, a.value)]),
1438
+ style: G({ gridColumn: `span ${r.gridSpan || e.node.layout}` })
1439
+ }, [
1440
+ F(ge, {
1441
+ node: r,
1442
+ mode: "render",
1443
+ "form-mode": e.formMode,
1444
+ "form-data": e.formData,
1445
+ "form-id": e.formId
1446
+ }, ae({ _: 2 }, [
1447
+ N(i.$slots, (f, v) => ({
1448
+ name: v,
1449
+ fn: A((k) => [
1450
+ Q(i.$slots, v, de({ ref_for: !0 }, k || {}), void 0, !0)
1451
+ ])
1452
+ }))
1453
+ ]), 1032, ["node", "form-mode", "form-data", "form-id"])
1454
+ ], 6))), 128))
1455
+ ], 2));
1456
+ }
1457
+ }), us = /* @__PURE__ */ E(rs, [["__scopeId", "data-v-417035f9"]]), cs = { class: "fd-panel" }, fs = { class: "fd-panel-item" }, ms = ["value"], ps = ["value"], vs = { class: "fd-panel-item" }, bs = /* @__PURE__ */ L({
1458
+ __name: "GridPanel",
1459
+ props: {
1460
+ node: {},
1461
+ fields: {}
1462
+ },
1463
+ emits: ["update"],
1464
+ setup(e, { emit: n }) {
1465
+ const o = e, s = n, a = [
1466
+ { label: "2列布局", value: 24 },
1467
+ { label: "4列布局", value: 12 },
1468
+ { label: "6列布局", value: 8 },
1469
+ { label: "8列布局", value: 6 }
1470
+ ];
1471
+ function i() {
1472
+ const u = o.node.layout || 24, r = (o.node.children ?? []).map((l) => ({ ...l, gridSpan: u }));
1473
+ s("update", { children: r });
1474
+ }
1475
+ return (u, r) => (d(), c("div", cs, [
1476
+ t("div", fs, [
1477
+ r[1] || (r[1] = t("label", null, "布局", -1)),
1478
+ t("select", {
1479
+ value: e.node.layout,
1480
+ onChange: r[0] || (r[0] = (l) => s("update", { layout: Number(l.target.value) }))
1481
+ }, [
1482
+ (d(), c(T, null, N(a, (l) => t("option", {
1483
+ key: l.value,
1484
+ value: l.value
1485
+ }, y(l.label), 9, ps)), 64))
1486
+ ], 40, ms)
1487
+ ]),
1488
+ t("div", vs, [
1489
+ r[2] || (r[2] = t("label", null, "一键布局", -1)),
1490
+ t("button", {
1491
+ class: "fd-btn fd-btn--primary fd-btn--sm fd-grid-apply",
1492
+ onClick: i
1493
+ }, " 应用到全部子组件(每项占比 " + y(e.node.layout || 24) + "/24) ", 1)
1494
+ ])
1495
+ ]));
1496
+ }
1497
+ }), gs = /* @__PURE__ */ E(bs, [["__scopeId", "data-v-a333d2ea"]]), hs = {
1498
+ type: "grid",
1499
+ title: "栅栏格",
1500
+ design: is,
1501
+ render: us,
1502
+ panel: gs,
1503
+ isContainer: !0,
1504
+ createDefaultProps: () => ({
1505
+ id: "",
1506
+ type: "grid",
1507
+ label: "栅栏格",
1508
+ bindField: "",
1509
+ // 默认 6 列布局
1510
+ layout: 8,
1511
+ children: []
1512
+ }),
1513
+ serialize: (e) => e
1514
+ }, ys = /* @__PURE__ */ L({
1515
+ __name: "TextDesign",
1516
+ props: {
1517
+ node: {}
1518
+ },
1519
+ setup(e) {
1520
+ return (n, o) => (d(), c("div", {
1521
+ class: "fd-text-design",
1522
+ style: G({ display: e.node.display })
1523
+ }, y(e.node.text || "文本内容"), 5));
1524
+ }
1525
+ }), ks = /* @__PURE__ */ E(ys, [["__scopeId", "data-v-ba382e6c"]]), ws = /* @__PURE__ */ L({
1526
+ __name: "TextRender",
1527
+ props: {
1528
+ node: {},
1529
+ value: {}
1530
+ },
1531
+ setup(e) {
1532
+ const n = e, o = M(() => {
1533
+ if (!n.node.bindField) return n.node.text;
1534
+ const s = n.value;
1535
+ return s == null ? "" : String(s);
1536
+ });
1537
+ return (s, a) => (d(), c("div", {
1538
+ class: "fd-text-render",
1539
+ style: G({ display: e.node.display })
1540
+ }, y(o.value), 5));
1541
+ }
1542
+ }), $s = /* @__PURE__ */ E(ws, [["__scopeId", "data-v-3ed7b0f0"]]), xs = { class: "fd-panel" }, Cs = { class: "fd-panel-item" }, _s = ["value"], Is = { class: "fd-panel-item" }, Ds = ["value"], Ss = ["value"], Ts = { class: "fd-panel-item" }, Fs = ["value"], Ls = /* @__PURE__ */ L({
1543
+ __name: "TextPanel",
1544
+ props: {
1545
+ node: {},
1546
+ fields: {}
1547
+ },
1548
+ emits: ["update"],
1549
+ setup(e, { emit: n }) {
1550
+ const o = n;
1551
+ return (s, a) => (d(), c("div", xs, [
1552
+ t("div", Cs, [
1553
+ a[3] || (a[3] = t("label", null, "文本", -1)),
1554
+ t("textarea", {
1555
+ rows: "4",
1556
+ value: e.node.text,
1557
+ onInput: a[0] || (a[0] = (i) => o("update", { text: i.target.value }))
1558
+ }, null, 40, _s)
1559
+ ]),
1560
+ t("div", Is, [
1561
+ a[5] || (a[5] = t("label", null, "绑定字段", -1)),
1562
+ t("select", {
1563
+ value: e.node.bindField,
1564
+ onChange: a[1] || (a[1] = (i) => o("update", { bindField: i.target.value }))
1565
+ }, [
1566
+ a[4] || (a[4] = t("option", { value: "" }, "不绑定", -1)),
1567
+ (d(!0), c(T, null, N(e.fields, (i) => (d(), c("option", {
1568
+ key: i.name,
1569
+ value: i.name
1570
+ }, y(i.label) + "(" + y(i.name) + ")", 9, Ss))), 128))
1571
+ ], 40, Ds)
1572
+ ]),
1573
+ t("div", Ts, [
1574
+ a[7] || (a[7] = t("label", null, "对齐方式", -1)),
1575
+ t("select", {
1576
+ value: e.node.display,
1577
+ onChange: a[2] || (a[2] = (i) => o("update", { display: i.target.value }))
1578
+ }, [...a[6] || (a[6] = [
1579
+ t("option", { value: "inline-block" }, "对齐", -1),
1580
+ t("option", { value: "block" }, "换行", -1)
1581
+ ])], 40, Fs)
1582
+ ])
1583
+ ]));
1584
+ }
1585
+ }), Ms = /* @__PURE__ */ E(Ls, [["__scopeId", "data-v-3201879c"]]), Ns = {
1586
+ type: "text",
1587
+ title: "文本",
1588
+ design: ks,
1589
+ render: $s,
1590
+ panel: Ms,
1591
+ isContainer: !1,
1592
+ createDefaultProps: () => ({
1593
+ id: "",
1594
+ type: "text",
1595
+ label: "文本",
1596
+ bindField: "",
1597
+ text: "文本内容",
1598
+ display: "inline-block"
1599
+ }),
1600
+ serialize: (e) => e
1601
+ };
1602
+ let $e = !1;
1603
+ function he() {
1604
+ $e || ($e = !0, ee(Ct), ee(on), ee($n), ee(ls), ee(hs), ee(Ns));
1605
+ }
1606
+ he();
1607
+ const Es = { baseUrl: "/bpmapi-uat" };
1608
+ let ye = {}, fe = {}, Ps = {};
1609
+ const Os = "api/formdesigner/v1";
1610
+ function Le(e) {
1611
+ fe = { ...fe, ...e };
1612
+ }
1613
+ function Us(e) {
1614
+ ye.baseUrl = e;
1615
+ }
1616
+ function Ya(e) {
1617
+ ye.baseUrl = e ? e.startsWith("/") ? e : `/${e}` : "";
1618
+ }
1619
+ function Ka(e) {
1620
+ }
1621
+ function Bs() {
1622
+ return {
1623
+ baseUrl: Ps.baseUrl ?? ye.baseUrl ?? fe.baseUrl ?? Es.baseUrl
1624
+ };
1625
+ }
1626
+ function X(e, n) {
1627
+ const { baseUrl: o } = Bs(), s = new URLSearchParams();
1628
+ Object.entries(n ?? {}).forEach(([i, u]) => {
1629
+ u != null && u !== "" && s.append(i, u);
1630
+ });
1631
+ const a = s.toString();
1632
+ return `${o}/${Os}/${e}${a ? `?${a}` : ""}`;
1633
+ }
1634
+ class Me extends Error {
1635
+ constructor(n, o) {
1636
+ super(o), this.status = n, this.name = "ApiError";
1637
+ }
1638
+ }
1639
+ function Vs(e) {
1640
+ if (!e) return "";
1641
+ try {
1642
+ const n = JSON.parse(e), o = n.error ?? n.message ?? n.title ?? n.detail;
1643
+ if (typeof o == "string" && o) return o;
1644
+ } catch {
1645
+ }
1646
+ return e;
1647
+ }
1648
+ async function Z(e, n) {
1649
+ const o = await fetch(e, {
1650
+ ...n,
1651
+ headers: { "Content-Type": "application/json", ...(n == null ? void 0 : n.headers) ?? {} }
1652
+ }), s = await o.text();
1653
+ if (!o.ok)
1654
+ throw new Me(o.status, Vs(s) || `请求失败(${o.status})`);
1655
+ if ((o.headers.get("content-type") ?? "").includes("text/plain")) return s;
1656
+ if (!s) return null;
1657
+ try {
1658
+ return JSON.parse(s);
1659
+ } catch {
1660
+ return s;
1661
+ }
1662
+ }
1663
+ function js(e) {
1664
+ if (e == null) return null;
1665
+ if (typeof e != "string") return e;
1666
+ try {
1667
+ return JSON.parse(e);
1668
+ } catch {
1669
+ return null;
1670
+ }
1671
+ }
1672
+ function Ne(e) {
1673
+ return e == null ? { success: !1, message: "无响应" } : typeof e == "string" ? { success: e.includes("成功"), message: e } : e;
1674
+ }
1675
+ async function Rs(e, n) {
1676
+ return Z(X("opendesigner"), {
1677
+ method: "POST",
1678
+ body: JSON.stringify(e)
1679
+ });
1680
+ }
1681
+ async function As(e, n) {
1682
+ return Z(X("formconfig", { id: e }));
1683
+ }
1684
+ async function zs(e, n, o) {
1685
+ return Z(X("fieldbinding/allfields", { dbtable: e, formid: n }));
1686
+ }
1687
+ async function Js(e, n) {
1688
+ return Ne(await Z(X("save"), { method: "POST", body: JSON.stringify(e) }));
1689
+ }
1690
+ async function Ws(e, n) {
1691
+ return Ne(await Z(X("publish"), { method: "POST", body: JSON.stringify(e) }));
1692
+ }
1693
+ async function Hs(e, n) {
1694
+ return Z(X("saveas"), { method: "POST", body: JSON.stringify(e) });
1695
+ }
1696
+ async function qs(e, n) {
1697
+ return Z(X("effectcount", { formId: e }));
1698
+ }
1699
+ async function Gs(e, n) {
1700
+ return Z(
1701
+ X("effectprocesses", {
1702
+ id: e.id,
1703
+ processName: e.processName,
1704
+ page: String(e.page ?? 1),
1705
+ pageSize: String(e.pageSize ?? 10)
1706
+ })
1707
+ );
1708
+ }
1709
+ function Ys(e) {
1710
+ return { name: e.name, label: e.label, dataType: e.dataType };
1711
+ }
1712
+ function Ks(e) {
1713
+ return { name: e.name, label: e.label, dataType: e.dataType || "string" };
1714
+ }
1715
+ function Qs(e, n) {
1716
+ return (e ?? []).filter((o) => o.name && o.name !== n).map((o) => ({ name: o.name, label: o.name, fields: (o.fields ?? []).map(Ks) }));
1717
+ }
1718
+ function Xs(e) {
1719
+ return js(e);
1720
+ }
1721
+ function ne(e) {
1722
+ return e instanceof Me || e instanceof Error ? e.message : String(e);
1723
+ }
1724
+ const te = (e) => JSON.parse(JSON.stringify(e));
1725
+ function Y(e, n) {
1726
+ for (const o of e) {
1727
+ if (o.id === n) return o;
1728
+ if (o.children) {
1729
+ const s = Y(o.children, n);
1730
+ if (s) return s;
1731
+ }
1732
+ }
1733
+ return null;
1734
+ }
1735
+ function Ee(e, n) {
1736
+ const o = e.findIndex((s) => s.id === n);
1737
+ if (o >= 0)
1738
+ return e.splice(o, 1), !0;
1739
+ for (const s of e)
1740
+ if (s.children && Ee(s.children, n)) return !0;
1741
+ return !1;
1742
+ }
1743
+ const W = We("designer", {
1744
+ state: () => ({
1745
+ workFormId: "",
1746
+ originFormId: "",
1747
+ formId: "",
1748
+ formVersion: "",
1749
+ formName: "",
1750
+ dbtable: "",
1751
+ attribute: {},
1752
+ fields: [],
1753
+ subTables: [],
1754
+ widgets: [],
1755
+ selectedId: null,
1756
+ past: [],
1757
+ future: [],
1758
+ draggingId: null,
1759
+ device: "pc",
1760
+ dragOverId: null,
1761
+ dragBefore: !1,
1762
+ dropContainerId: null,
1763
+ selectedForm: !1,
1764
+ events: { lifecycle: {}, custom: [] },
1765
+ loading: !1,
1766
+ errorMsg: "",
1767
+ noticeMsg: ""
1768
+ }),
1769
+ getters: {
1770
+ selectedNode: (e) => e.selectedId ? Y(e.widgets, e.selectedId) : null,
1771
+ canUndo: (e) => e.past.length > 0,
1772
+ canRedo: (e) => e.future.length > 0,
1773
+ /** 供控件「事件」下拉选择使用的自定义事件列表 */
1774
+ customEventOptions: (e) => e.events.custom,
1775
+ /** 属性 JSON:attribute.id 缺省时补工作表单 ID(后端回写版本行时会替换为真实表单 ID) */
1776
+ attJson: (e) => JSON.stringify({ ...e.attribute, id: e.attribute.id || e.workFormId })
1777
+ },
1778
+ actions: {
1779
+ /** 提交一次变更快照(用于撤销重做) */
1780
+ commit() {
1781
+ this.past.push(te(this.widgets)), this.past.length > 50 && this.past.shift(), this.future = [];
1782
+ },
1783
+ undo() {
1784
+ const e = this.past.pop();
1785
+ e && (this.future.push(te(this.widgets)), this.widgets = e, this.selectedId && !Y(this.widgets, this.selectedId) && (this.selectedId = null));
1786
+ },
1787
+ redo() {
1788
+ const e = this.future.pop();
1789
+ e && (this.past.push(te(this.widgets)), this.widgets = e);
1790
+ },
1791
+ select(e) {
1792
+ this.selectedId = e, this.selectedForm = !1;
1793
+ },
1794
+ /** 点击画板空白处:选中表单本身(用于配置表单级属性) */
1795
+ selectForm() {
1796
+ this.selectedId = null, this.selectedForm = !0;
1797
+ },
1798
+ /** 设置生命周期事件代码片段 */
1799
+ setLifecycleHook(e, n) {
1800
+ this.events.lifecycle[e] = n;
1801
+ },
1802
+ /** 新增一条自定义事件(默认占位) */
1803
+ addCustomEvent() {
1804
+ const e = this.events.custom.length + 1;
1805
+ this.events.custom.push({ name: `event_${e}`, title: `自定义事件${e}`, handler: "" });
1806
+ },
1807
+ /** 更新某条自定义事件 */
1808
+ updateCustomEvent(e, n) {
1809
+ const o = this.events.custom[e];
1810
+ o && Object.assign(o, n);
1811
+ },
1812
+ /** 删除某条自定义事件 */
1813
+ removeCustomEvent(e) {
1814
+ this.events.custom.splice(e, 1);
1815
+ },
1816
+ /** 新增控件:parentId 指定容器,index 指定插入位置(不传则末尾) */
1817
+ addWidget(e, n, o) {
1818
+ var i;
1819
+ const s = nt(e);
1820
+ this.commit();
1821
+ const a = n ? Y(this.widgets, n) : null;
1822
+ a && ((i = K(a.type)) != null && i.isContainer) ? (a.children = a.children || [], a.type === "grid" && s.gridSpan == null && (s.gridSpan = a.layout || 24), o == null || o > a.children.length ? a.children.push(s) : a.children.splice(Math.max(0, o), 0, s)) : o == null || o > this.widgets.length ? this.widgets.push(s) : this.widgets.splice(Math.max(0, o), 0, s), this.selectedId = s.id;
1823
+ },
1824
+ /** 判断 maybeChild 是否为 node 的后代(防止把容器拖进自己) */
1825
+ isDescendant(e, n) {
1826
+ if (!e.children) return !1;
1827
+ for (const o of e.children)
1828
+ if (o.id === n || this.isDescendant(o, n)) return !0;
1829
+ return !1;
1830
+ },
1831
+ /** 移动已有控件到指定容器 / 根,插入位置 index */
1832
+ moveNode(e, n, o) {
1833
+ var v;
1834
+ if (e === n) return;
1835
+ const s = Y(this.widgets, e);
1836
+ if (!s || n && this.isDescendant(s, n)) return;
1837
+ const a = n ? Y(this.widgets, n) : null, i = (k) => {
1838
+ const P = k.findIndex((j) => j.id === e);
1839
+ if (P >= 0) return { list: k, index: P };
1840
+ for (const j of k)
1841
+ if (j.children) {
1842
+ const _ = i(j.children);
1843
+ if (_) return _;
1844
+ }
1845
+ return null;
1846
+ }, u = i(this.widgets);
1847
+ if (!u) return;
1848
+ let r;
1849
+ a && ((v = K(a.type)) != null && v.isContainer) ? (a.children = a.children || [], r = a.children) : r = this.widgets, this.commit();
1850
+ let l = o;
1851
+ r === u.list && u.index < o && (l = o - 1);
1852
+ const [f] = u.list.splice(u.index, 1);
1853
+ if (l = Math.max(0, Math.min(l, r.length)), r.splice(l, 0, f), a && a.type === "grid") {
1854
+ const k = a.layout || 24;
1855
+ (u.list !== r || f.gridSpan == null) && (f.gridSpan = k);
1856
+ } else
1857
+ delete f.gridSpan;
1858
+ this.selectedId = f.id;
1859
+ },
1860
+ removeWidget(e) {
1861
+ this.commit(), Ee(this.widgets, e), this.selectedId === e && (this.selectedId = null);
1862
+ },
1863
+ moveSibling(e, n) {
1864
+ const o = (r) => {
1865
+ if (r.findIndex((f) => f.id === e) >= 0) return r;
1866
+ for (const f of r)
1867
+ if (f.children) {
1868
+ const v = o(f.children);
1869
+ if (v) return v;
1870
+ }
1871
+ return null;
1872
+ }, s = o(this.widgets);
1873
+ if (!s) return;
1874
+ const a = s.findIndex((r) => r.id === e), i = a + n;
1875
+ if (i < 0 || i >= s.length) return;
1876
+ this.commit();
1877
+ const [u] = s.splice(a, 1);
1878
+ s.splice(i, 0, u);
1879
+ },
1880
+ updateNode(e, n) {
1881
+ const o = Y(this.widgets, e);
1882
+ o && (Object.assign(o, n), this.commit());
1883
+ },
1884
+ setDragging(e) {
1885
+ this.draggingId = e;
1886
+ },
1887
+ /** 展开/收起容器(设计器视图操作,不写入撤销历史) */
1888
+ setExpanded(e, n) {
1889
+ const o = Y(this.widgets, e);
1890
+ o && "expanded" in o && (o.expanded = n);
1891
+ },
1892
+ /** 将 draggingId 控件移动到 targetId(容器)或根 */
1893
+ dropTo(e) {
1894
+ var a;
1895
+ const n = this.draggingId;
1896
+ if (!n || n === e) return;
1897
+ this.commit();
1898
+ const o = (i) => {
1899
+ const u = i.findIndex((r) => r.id === n);
1900
+ if (u >= 0) {
1901
+ const [r] = i.splice(u, 1);
1902
+ return r;
1903
+ }
1904
+ for (const r of i)
1905
+ if (r.children) {
1906
+ const l = o(r.children);
1907
+ if (l) return l;
1908
+ }
1909
+ return null;
1910
+ }, s = o(this.widgets);
1911
+ if (!s) {
1912
+ this.draggingId = null;
1913
+ return;
1914
+ }
1915
+ if (e) {
1916
+ const i = Y(this.widgets, e);
1917
+ i && ((a = K(i.type)) != null && a.isContainer) ? (i.children = i.children || [], i.children.push(s)) : this.widgets.push(s);
1918
+ } else
1919
+ this.widgets.push(s);
1920
+ this.draggingId = null, this.selectedId = s.id;
1921
+ },
1922
+ loadSchema(e) {
1923
+ this.formId = e.formId, this.dbtable = e.dbtable, this.fields = e.fields, this.widgets = te(e.widgets), this.events = e.events ? te(e.events) : { lifecycle: {}, custom: [] }, this.selectedId = null, this.selectedForm = !1, this.past = [], this.future = [];
1924
+ },
1925
+ toSchema() {
1926
+ return {
1927
+ formId: this.formId,
1928
+ dbtable: this.dbtable,
1929
+ fields: this.fields,
1930
+ widgets: this.widgets,
1931
+ events: te(this.events)
1932
+ };
1933
+ },
1934
+ /**
1935
+ * 保存 / 发布回传后端的模板 JSON。
1936
+ * 不含 fields:字段清单由 allfields 接口独立下发(后端本就持有),
1937
+ * 打开时前端重新获取并覆盖,回传属冗余(后端对 json 仅黑盒存取,不强解析内部)。
1938
+ */
1939
+ toSaveJson() {
1940
+ const { formId: e, dbtable: n, widgets: o, events: s } = this.toSchema();
1941
+ return JSON.stringify({ formId: e, dbtable: n, widgets: o, events: s });
1942
+ },
1943
+ setFields(e) {
1944
+ this.fields = e;
1945
+ },
1946
+ setSubTables(e) {
1947
+ this.subTables = e;
1948
+ },
1949
+ /**
1950
+ * 打开表单完整流程(1+1+1,与子表数量无关,见 API-backend.md):
1951
+ * ① opendesigner 建版本取工作表单 ID → ② formconfig 取模板 → ③ allfields 取字段。
1952
+ * 保存 / 发布 / 另存为均基于 opendesigner 返回的工作表单 ID(临时记录,Status=4)。
1953
+ *
1954
+ * openType:**直接使用 URL 路径参数(无默认值)**——newEdit = 新建版本;edit = 编辑指定版本;
1955
+ * 缺省或非法值时后端返回「OpenType无效!」,前端原样提示
1956
+ *
1957
+ * 模板兼容:formconfig.json 为新设计器 FormSchema 时正常装载;
1958
+ * 为老设计器 HTML / 空模板时**降级为空表单**(字段与子表照常加载),
1959
+ * 用户可手动设计后保存,noticeMsg 给出提示(非阻断)。
1960
+ */
1961
+ async openForm(e, n = "", o = "") {
1962
+ this.loading = !0, this.errorMsg = "", this.noticeMsg = "";
1963
+ try {
1964
+ if (!e) {
1965
+ this.errorMsg = "缺少表单 ID:请通过 URL 参数 ?id=<GUID> 打开已有表单";
1966
+ return;
1967
+ }
1968
+ this.originFormId = e;
1969
+ const s = await Rs({ openType: o, id: e, formVersion: n });
1970
+ this.workFormId = s.newFormID, this.formId = s.newFormID;
1971
+ const a = await As(s.newFormID);
1972
+ this.attribute = a.attribute ?? {}, this.formName = this.attribute.name ?? "", this.device = a.templateType === "App" ? "mobile" : "pc";
1973
+ const i = this.attribute.dbtable || "", u = await zs(i, s.newFormID);
1974
+ this.dbtable = i || u.dbtable;
1975
+ const r = this.enrichFields((u.fields ?? []).map(Ys));
1976
+ this.setFields(r), this.setSubTables(Qs(u.subtables, this.dbtable));
1977
+ const l = Xs(a.json);
1978
+ l && Array.isArray(l.widgets) ? this.loadSchema({
1979
+ ...l,
1980
+ formId: s.newFormID,
1981
+ templateType: a.templateType,
1982
+ dbtable: this.dbtable,
1983
+ fields: r,
1984
+ widgets: l.widgets,
1985
+ events: l.events ?? { lifecycle: {}, custom: [] }
1986
+ }) : (this.noticeMsg = "未能解析表单模板(老设计器 HTML 模板或空模板),已加载为空表单:字段与子表可正常绑定,请手动设计后保存", this.loadSchema({
1987
+ formId: s.newFormID,
1988
+ templateType: a.templateType,
1989
+ dbtable: this.dbtable,
1990
+ fields: r,
1991
+ widgets: [],
1992
+ events: { lifecycle: {}, custom: [] }
1993
+ }));
1994
+ } catch (s) {
1995
+ this.errorMsg = `加载失败:${ne(s)}`;
1996
+ } finally {
1997
+ this.loading = !1;
1998
+ }
1999
+ },
2000
+ /**
2001
+ * 字段类型细化:当前后端 dataType 统一 string,
2002
+ * 按 attribute.settings 的 isdatetime / ismoney 补充日期 / 金额类型
2003
+ * (实测真实数据的类型权威来源,见 API-backend-realdata.md 结论 4)。
2004
+ */
2005
+ enrichFields(e) {
2006
+ const n = this.attribute.settings ?? {}, o = (s) => s === !0 || s === "true" || s === "1";
2007
+ return e.map((s) => {
2008
+ const a = n[s.name];
2009
+ return a ? o(a.isdatetime) ? { ...s, dataType: "date" } : o(a.ismoney) ? { ...s, dataType: "money" } : s : s;
2010
+ });
2011
+ },
2012
+ /** 保存:保存到工作表单(opendesigner 返回的临时记录,Status=4 → 后端同步回写版本行) */
2013
+ async save() {
2014
+ this.errorMsg = "";
2015
+ try {
2016
+ return await Js({
2017
+ id: this.workFormId,
2018
+ name: this.formName,
2019
+ att: this.attJson,
2020
+ json: this.toSaveJson(),
2021
+ formNature: "1",
2022
+ // isentity=0 的表单后端会走表结构 XML 生成,dataObject 为空会 500(2026-10-19 联调实测);
2023
+ // 新设计器不管理数据对象,传空 table 使其跳过生成
2024
+ dataObject: this.attribute.isentity === "0" ? JSON.stringify({ table: "" }) : void 0
2025
+ });
2026
+ } catch (e) {
2027
+ throw this.errorMsg = `保存失败:${ne(e)}`, e;
2028
+ }
2029
+ },
2030
+ /**
2031
+ * 另存为:以当前工作表单为源,复制成一个新表单(后端写设计器库 + 主库 + 复制标签)。
2032
+ * 源为工作表单(临时记录)——其中保存着最新设计,需先「保存」再另存为。
2033
+ */
2034
+ async saveAs(e, n, o = "start") {
2035
+ this.errorMsg = "";
2036
+ try {
2037
+ return await Hs({ id: this.workFormId, name: e, code: n, saveSelect: o });
2038
+ } catch (s) {
2039
+ throw this.errorMsg = `另存为失败:${ne(s)}`, s;
2040
+ }
2041
+ },
2042
+ /** 发布:以工作表单 ID 发布(Status=4 → 回写版本行置 Status=1 + 一口收直写业务库) */
2043
+ async publish(e = "") {
2044
+ this.errorMsg = "";
2045
+ try {
2046
+ return await Ws({
2047
+ id: this.workFormId,
2048
+ name: this.formName,
2049
+ att: this.attJson,
2050
+ json: this.toSaveJson(),
2051
+ text: e
2052
+ });
2053
+ } catch (n) {
2054
+ throw this.errorMsg = `发布失败:${ne(n)}`, n;
2055
+ }
2056
+ },
2057
+ /**
2058
+ * 发布前检查:查询表单被流程绑定的数量,命中则需弹确认列表。
2059
+ * effectcount 按主库 WF_Form(正式表单)查询,故用打开时的原始表单 ID(originFormId),
2060
+ * 不能用工作表单 ID(临时记录在主库无对应行,会恒为 0)。
2061
+ */
2062
+ async checkPublish() {
2063
+ this.errorMsg = "";
2064
+ try {
2065
+ const e = await qs(this.originFormId);
2066
+ return { needConfirm: e.result || e.count > 0, count: e.count };
2067
+ } catch (e) {
2068
+ throw this.errorMsg = `发布检查失败:${ne(e)}`, e;
2069
+ }
2070
+ }
2071
+ }
2072
+ }), Pe = "fd:form:";
2073
+ function Zs(e, n) {
2074
+ localStorage.setItem(Pe + e, JSON.stringify(n));
2075
+ }
2076
+ function Qa(e) {
2077
+ const n = localStorage.getItem(Pe + e);
2078
+ if (!n) return null;
2079
+ try {
2080
+ return JSON.parse(n);
2081
+ } catch {
2082
+ return null;
2083
+ }
2084
+ }
2085
+ const el = "fdFireEvent";
2086
+ function xe(e, n = {}) {
2087
+ if (!(!e || !e.trim()))
2088
+ try {
2089
+ return new Function("ctx", `"use strict";
2090
+ ${e}`)(n);
2091
+ } catch (o) {
2092
+ console.error("[form-designer] 事件处理函数执行失败:", o);
2093
+ return;
2094
+ }
2095
+ }
2096
+ function tl(e) {
2097
+ if (!(!e || !e.trim() || typeof document > "u"))
2098
+ try {
2099
+ const n = document.createElement("script");
2100
+ n.text = e, document.head.appendChild(n), n.remove();
2101
+ } catch (n) {
2102
+ console.error("[form-designer] 自定义方法挂载失败:", n);
2103
+ }
2104
+ }
2105
+ const nl = { class: "fd-renderer" }, ol = /* @__PURE__ */ L({
2106
+ __name: "Renderer",
2107
+ props: {
2108
+ widgets: {},
2109
+ formMode: {},
2110
+ formData: {},
2111
+ events: {},
2112
+ formId: {}
2113
+ },
2114
+ setup(e, { expose: n }) {
2115
+ const o = e, s = M(
2116
+ () => o.widgets.filter((u) => {
2117
+ var l;
2118
+ const r = (l = K(u.type)) == null ? void 0 : l.visibleModes;
2119
+ return !r || r.length === 0 ? !0 : o.formMode ? r.includes(o.formMode) : !0;
2120
+ })
2121
+ );
2122
+ function a(u) {
2123
+ var l;
2124
+ const r = (l = o.events) == null ? void 0 : l.lifecycle[u];
2125
+ xe(r, { formData: o.formData, event: u });
2126
+ }
2127
+ function i(u, r) {
2128
+ var f;
2129
+ const l = (f = o.events) == null ? void 0 : f.custom.find((v) => v.name === u);
2130
+ l && xe(l.handler, { formData: o.formData, event: u, payload: r });
2131
+ }
2132
+ return Ve(el, i), ie(() => {
2133
+ var u;
2134
+ a("onLoad"), a("onMounted"), tl((u = o.events) == null ? void 0 : u.lifecycle.custom);
2135
+ }), le(
2136
+ () => o.formData,
2137
+ () => a("onValueChange"),
2138
+ { deep: !0 }
2139
+ ), n({ fireEvent: i, runLifecycle: a }), (u, r) => (d(), c("div", nl, [
2140
+ (d(!0), c(T, null, N(s.value, (l) => (d(), V(ge, {
2141
+ key: l.id,
2142
+ node: l,
2143
+ mode: "render",
2144
+ "form-mode": e.formMode,
2145
+ "form-data": e.formData,
2146
+ "form-id": e.formId
2147
+ }, ae({ _: 2 }, [
2148
+ N(u.$slots, (f, v) => ({
2149
+ name: v,
2150
+ fn: A((k) => [
2151
+ Q(u.$slots, v, de({ ref_for: !0 }, k || {}), void 0, !0)
2152
+ ])
2153
+ }))
2154
+ ]), 1032, ["node", "form-mode", "form-data", "form-id"]))), 128))
2155
+ ]));
2156
+ }
2157
+ }), Oe = /* @__PURE__ */ E(ol, [["__scopeId", "data-v-82088c12"]]), sl = { class: "fd-tree" }, ll = { class: "fd-tree-head" }, al = {
2158
+ key: 0,
2159
+ class: "fd-tree-count"
2160
+ }, il = {
2161
+ key: 0,
2162
+ class: "fd-tree-empty"
2163
+ }, dl = { class: "fd-tree-name" }, rl = ["title"], ul = /* @__PURE__ */ L({
2164
+ __name: "ComponentTree",
2165
+ setup(e) {
2166
+ const n = W();
2167
+ function o(u) {
2168
+ var v;
2169
+ const r = K(u.type), l = u.label, f = (r == null ? void 0 : r.title) ?? u.type;
2170
+ return {
2171
+ id: u.id,
2172
+ label: l ? `${f} · ${l}` : f,
2173
+ name: f,
2174
+ sub: l ?? "",
2175
+ children: (v = u.children) == null ? void 0 : v.map(o)
2176
+ };
2177
+ }
2178
+ const s = M(() => n.widgets.map(o)), a = M(() => {
2179
+ const u = (r) => r.reduce((l, f) => l + 1 + u(f.children ?? []), 0);
2180
+ return u(n.widgets);
2181
+ });
2182
+ function i(u) {
2183
+ n.select(u.id), De(() => {
2184
+ var r;
2185
+ (r = document.querySelector(".fd-canvas-node.is-selected")) == null || r.scrollIntoView({ block: "nearest" });
2186
+ });
2187
+ }
2188
+ return (u, r) => (d(), c("div", sl, [
2189
+ t("div", ll, [
2190
+ r[0] || (r[0] = ve('<svg class="fd-tree-head-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-e38c14ec><rect x="3" y="3" width="7" height="7" rx="1" data-v-e38c14ec></rect><rect x="14" y="3" width="7" height="7" rx="1" data-v-e38c14ec></rect><rect x="3" y="14" width="7" height="7" rx="1" data-v-e38c14ec></rect><rect x="14" y="14" width="7" height="7" rx="1" data-v-e38c14ec></rect></svg><span class="fd-tree-title" data-v-e38c14ec>组件树</span>', 2)),
2191
+ a.value ? (d(), c("span", al, y(a.value), 1)) : I("", !0)
2192
+ ]),
2193
+ a.value ? (d(), V(h(He), {
2194
+ key: 1,
2195
+ class: "fd-tree-el",
2196
+ data: s.value,
2197
+ "node-key": "id",
2198
+ "current-node-key": h(n).selectedId || "",
2199
+ "highlight-current": "",
2200
+ "default-expand-all": "",
2201
+ "show-line": "",
2202
+ "expand-on-click-node": !1,
2203
+ onNodeClick: i
2204
+ }, {
2205
+ default: A(({ data: l }) => [
2206
+ t("span", dl, y(l.name), 1),
2207
+ l.sub ? (d(), c("span", {
2208
+ key: 0,
2209
+ class: "fd-tree-sub",
2210
+ title: l.sub
2211
+ }, y(l.sub), 9, rl)) : I("", !0)
2212
+ ]),
2213
+ _: 1
2214
+ }, 8, ["data", "current-node-key"])) : (d(), c("div", il, [...r[1] || (r[1] = [
2215
+ t("svg", {
2216
+ viewBox: "0 0 24 24",
2217
+ fill: "none",
2218
+ stroke: "currentColor",
2219
+ "stroke-width": "1.5",
2220
+ "stroke-linecap": "round",
2221
+ "stroke-linejoin": "round"
2222
+ }, [
2223
+ t("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
2224
+ t("polyline", { points: "17 8 12 3 7 8" }),
2225
+ t("line", {
2226
+ x1: "12",
2227
+ y1: "3",
2228
+ x2: "12",
2229
+ y2: "15"
2230
+ })
2231
+ ], -1),
2232
+ t("span", null, "暂无组件,从左侧拖拽控件到画布", -1)
2233
+ ])]))
2234
+ ]));
2235
+ }
2236
+ }), cl = /* @__PURE__ */ E(ul, [["__scopeId", "data-v-e38c14ec"]]);
2237
+ var fl = {
2238
+ name: "zh-cn",
2239
+ el: {
2240
+ breadcrumb: { label: "面包屑" },
2241
+ colorpicker: {
2242
+ confirm: "确定",
2243
+ clear: "清空",
2244
+ defaultLabel: "颜色选择器",
2245
+ description: "当前颜色 {color},按 Enter 键选择新颜色",
2246
+ alphaLabel: "选择透明度的值",
2247
+ alphaDescription: "透明度 {alpha}, 当前颜色 {color}",
2248
+ hueLabel: "选择色相值",
2249
+ hueDescription: "色相 {hue}, 当前颜色 {color}",
2250
+ svLabel: "选择饱和度与明度的值",
2251
+ svDescription: "饱和度 {saturation}, 明度 {brightness}, 当前颜色 {color}",
2252
+ predefineDescription: "选择 {value} 作为颜色"
2253
+ },
2254
+ datepicker: {
2255
+ now: "此刻",
2256
+ today: "今天",
2257
+ cancel: "取消",
2258
+ clear: "清空",
2259
+ confirm: "确定",
2260
+ dateTablePrompt: "使用方向键与 Enter 键可选择日期",
2261
+ monthTablePrompt: "使用方向键与 Enter 键可选择月份",
2262
+ quarterTablePrompt: "使用方向键与 Enter 键可选择季度",
2263
+ yearTablePrompt: "使用方向键与 Enter 键可选择年份",
2264
+ selectedDate: "已选日期",
2265
+ selectDate: "选择日期",
2266
+ selectTime: "选择时间",
2267
+ startDate: "开始日期",
2268
+ startTime: "开始时间",
2269
+ endDate: "结束日期",
2270
+ endTime: "结束时间",
2271
+ prevYear: "前一年",
2272
+ nextYear: "后一年",
2273
+ prevMonth: "上个月",
2274
+ nextMonth: "下个月",
2275
+ year: "年",
2276
+ month1: "1 月",
2277
+ month2: "2 月",
2278
+ month3: "3 月",
2279
+ month4: "4 月",
2280
+ month5: "5 月",
2281
+ month6: "6 月",
2282
+ month7: "7 月",
2283
+ month8: "8 月",
2284
+ month9: "9 月",
2285
+ month10: "10 月",
2286
+ month11: "11 月",
2287
+ month12: "12 月",
2288
+ weeks: {
2289
+ sun: "日",
2290
+ mon: "一",
2291
+ tue: "二",
2292
+ wed: "三",
2293
+ thu: "四",
2294
+ fri: "五",
2295
+ sat: "六"
2296
+ },
2297
+ weeksFull: {
2298
+ sun: "星期日",
2299
+ mon: "星期一",
2300
+ tue: "星期二",
2301
+ wed: "星期三",
2302
+ thu: "星期四",
2303
+ fri: "星期五",
2304
+ sat: "星期六"
2305
+ },
2306
+ months: {
2307
+ jan: "一月",
2308
+ feb: "二月",
2309
+ mar: "三月",
2310
+ apr: "四月",
2311
+ may: "五月",
2312
+ jun: "六月",
2313
+ jul: "七月",
2314
+ aug: "八月",
2315
+ sep: "九月",
2316
+ oct: "十月",
2317
+ nov: "十一月",
2318
+ dec: "十二月"
2319
+ }
2320
+ },
2321
+ input: { characters: "{count} / {max} 个字符" },
2322
+ inputNumber: {
2323
+ decrease: "减少数值",
2324
+ increase: "增加数值"
2325
+ },
2326
+ select: {
2327
+ loading: "加载中",
2328
+ noMatch: "无匹配数据",
2329
+ noData: "无数据",
2330
+ placeholder: "请选择"
2331
+ },
2332
+ mention: { loading: "加载中" },
2333
+ dropdown: { toggleDropdown: "切换下拉选项" },
2334
+ cascader: {
2335
+ noMatch: "无匹配数据",
2336
+ loading: "加载中",
2337
+ placeholder: "请选择",
2338
+ noData: "暂无数据"
2339
+ },
2340
+ pagination: {
2341
+ goto: "前往",
2342
+ pagesize: "条/页",
2343
+ total: "共 {total} 条",
2344
+ pageClassifier: "页",
2345
+ page: "页",
2346
+ prev: "上一页",
2347
+ next: "下一页",
2348
+ currentPage: "第 {pager} 页",
2349
+ prevPages: "向前 {pager} 页",
2350
+ nextPages: "向后 {pager} 页",
2351
+ deprecationWarning: "你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"
2352
+ },
2353
+ dialog: { close: "关闭此对话框" },
2354
+ drawer: { close: "关闭此对话框" },
2355
+ messagebox: {
2356
+ title: "提示",
2357
+ confirm: "确定",
2358
+ cancel: "取消",
2359
+ error: "输入的数据不合法!",
2360
+ close: "关闭此对话框"
2361
+ },
2362
+ upload: {
2363
+ deleteTip: "按 Delete 键可删除",
2364
+ delete: "删除",
2365
+ preview: "查看图片",
2366
+ continue: "继续上传"
2367
+ },
2368
+ slider: {
2369
+ defaultLabel: "滑块介于 {min} 至 {max}",
2370
+ defaultRangeStartLabel: "选择起始值",
2371
+ defaultRangeEndLabel: "选择结束值"
2372
+ },
2373
+ table: {
2374
+ emptyText: "暂无数据",
2375
+ confirmFilter: "筛选",
2376
+ resetFilter: "重置",
2377
+ clearFilter: "全部",
2378
+ sumText: "合计",
2379
+ selectAllLabel: "选择所有行",
2380
+ selectRowLabel: "选择当前行",
2381
+ expandRowLabel: "展开当前行",
2382
+ collapseRowLabel: "收起当前行",
2383
+ sortLabel: "按 {column} 排序",
2384
+ filterLabel: "按 {column} 过滤"
2385
+ },
2386
+ tag: { close: "关闭此标签" },
2387
+ tour: {
2388
+ next: "下一步",
2389
+ previous: "上一步",
2390
+ finish: "结束导览",
2391
+ close: "关闭此对话框"
2392
+ },
2393
+ tree: { emptyText: "暂无数据" },
2394
+ transfer: {
2395
+ noMatch: "无匹配数据",
2396
+ noData: "无数据",
2397
+ titles: ["列表 1", "列表 2"],
2398
+ filterPlaceholder: "请输入搜索内容",
2399
+ noCheckedFormat: "共 {total} 项",
2400
+ hasCheckedFormat: "已选 {checked}/{total} 项"
2401
+ },
2402
+ image: { error: "加载失败" },
2403
+ pageHeader: { title: "返回" },
2404
+ popconfirm: {
2405
+ confirmButtonText: "确定",
2406
+ cancelButtonText: "取消"
2407
+ },
2408
+ carousel: {
2409
+ leftArrow: "上一张幻灯片",
2410
+ rightArrow: "下一张幻灯片",
2411
+ indicator: "幻灯片切换至索引 {index}"
2412
+ },
2413
+ inputOTP: {
2414
+ groupLabel: "一次性密码输入框",
2415
+ defaultLabel: "请输入第 {index} 位 OTP 字符"
2416
+ }
2417
+ }
2418
+ };
2419
+ const ml = { class: "fd-publish-tip" }, pl = { class: "fd-publish-tip-text" }, vl = { class: "fd-publish-toolbar" }, bl = { class: "fd-publish-table-wrap" }, gl = { class: "fd-publish-table" }, hl = ["title"], yl = ["href", "title"], kl = ["title"], wl = ["title"], $l = {
2420
+ key: 1,
2421
+ class: "fd-publish-error"
2422
+ }, xl = { class: "fd-publish-pager" }, Cl = /* @__PURE__ */ L({
2423
+ __name: "PublishConfirmDialog",
2424
+ props: {
2425
+ modelValue: { type: Boolean },
2426
+ formId: {},
2427
+ count: {}
2428
+ },
2429
+ emits: ["update:modelValue", "confirm"],
2430
+ setup(e, { emit: n }) {
2431
+ const o = qe.directive, s = e, a = n, i = O(!1), u = O(""), r = O(""), l = O(1), f = O(10), v = O(0), k = O([]);
2432
+ async function P() {
2433
+ if (s.formId) {
2434
+ i.value = !0, u.value = "";
2435
+ try {
2436
+ const D = await Gs({
2437
+ id: s.formId,
2438
+ processName: r.value,
2439
+ page: l.value,
2440
+ pageSize: f.value
2441
+ });
2442
+ k.value = D.items ?? [], v.value = D.total ?? 0;
2443
+ } catch (D) {
2444
+ k.value = [], v.value = 0, u.value = ne(D);
2445
+ } finally {
2446
+ i.value = !1;
2447
+ }
2448
+ }
2449
+ }
2450
+ le(
2451
+ () => s.modelValue,
2452
+ (D) => {
2453
+ D && (r.value = "", l.value = 1, P());
2454
+ }
2455
+ ), le(r, () => {
2456
+ l.value = 1, P();
2457
+ }), le(l, () => P());
2458
+ function j() {
2459
+ a("update:modelValue", !1);
2460
+ }
2461
+ function _() {
2462
+ a("confirm");
2463
+ }
2464
+ return (D, m) => (d(), V(h(Ge), { locale: h(fl) }, {
2465
+ default: A(() => [
2466
+ F(h(Ye), {
2467
+ "model-value": e.modelValue,
2468
+ title: "发布确认",
2469
+ width: "70rem",
2470
+ "close-on-click-modal": !1,
2471
+ "onUpdate:modelValue": m[3] || (m[3] = (g) => a("update:modelValue", g))
2472
+ }, {
2473
+ footer: A(() => [
2474
+ F(h(we), { onClick: j }, {
2475
+ default: A(() => [...m[9] || (m[9] = [
2476
+ U("取消", -1)
2477
+ ])]),
2478
+ _: 1
2479
+ }),
2480
+ F(h(we), {
2481
+ type: "primary",
2482
+ disabled: i.value,
2483
+ onClick: _
2484
+ }, {
2485
+ default: A(() => [...m[10] || (m[10] = [
2486
+ U("确认发布", -1)
2487
+ ])]),
2488
+ _: 1
2489
+ }, 8, ["disabled"])
2490
+ ]),
2491
+ default: A(() => [
2492
+ t("div", ml, [
2493
+ m[6] || (m[6] = t("span", { class: "fd-publish-tip-icon" }, "!", -1)),
2494
+ t("span", pl, [
2495
+ m[4] || (m[4] = U(" 该表单正在被 ", -1)),
2496
+ t("b", null, y(e.count), 1),
2497
+ m[5] || (m[5] = U(" 个流程使用,发布后将影响以下流程,确定发布? ", -1))
2498
+ ])
2499
+ ]),
2500
+ t("div", vl, [
2501
+ F(h(Ke), {
2502
+ modelValue: r.value,
2503
+ "onUpdate:modelValue": m[0] || (m[0] = (g) => r.value = g),
2504
+ placeholder: "输入流程名搜索",
2505
+ clearable: "",
2506
+ class: "fd-publish-search"
2507
+ }, null, 8, ["modelValue"])
2508
+ ]),
2509
+ ce((d(), c("div", bl, [
2510
+ t("table", gl, [
2511
+ m[7] || (m[7] = t("colgroup", null, [
2512
+ t("col", { style: { width: "24%" } }),
2513
+ t("col", { style: { width: "40%" } }),
2514
+ t("col", { style: { width: "36%" } })
2515
+ ], -1)),
2516
+ m[8] || (m[8] = t("thead", null, [
2517
+ t("tr", null, [
2518
+ t("th", null, "表单名称"),
2519
+ t("th", null, "流程模板"),
2520
+ t("th", null, "模板ID")
2521
+ ])
2522
+ ], -1)),
2523
+ t("tbody", null, [
2524
+ (d(!0), c(T, null, N(k.value, (g) => (d(), c("tr", {
2525
+ key: g.templateId || g.formId
2526
+ }, [
2527
+ t("td", {
2528
+ title: g.formNameCN || g.formCode
2529
+ }, y(g.formNameCN || g.formCode), 9, hl),
2530
+ t("td", null, [
2531
+ g.templateUrl ? (d(), c("a", {
2532
+ key: 0,
2533
+ class: "fd-publish-link",
2534
+ href: g.templateUrl,
2535
+ target: "_blank",
2536
+ rel: "noopener noreferrer",
2537
+ title: g.templateName
2538
+ }, y(g.templateName), 9, yl)) : (d(), c("span", {
2539
+ key: 1,
2540
+ title: g.templateName
2541
+ }, y(g.templateName), 9, kl))
2542
+ ]),
2543
+ t("td", {
2544
+ class: "fd-publish-id",
2545
+ title: g.templateId
2546
+ }, y(g.templateId), 9, wl)
2547
+ ]))), 128))
2548
+ ])
2549
+ ]),
2550
+ !k.value.length && !u.value && !i.value ? (d(), V(h(Qe), {
2551
+ key: 0,
2552
+ description: "暂无可用流程模板",
2553
+ "image-size": 60
2554
+ })) : I("", !0),
2555
+ !k.value.length && u.value ? (d(), c("div", $l, y(u.value), 1)) : I("", !0)
2556
+ ])), [
2557
+ [h(o), i.value]
2558
+ ]),
2559
+ t("div", xl, [
2560
+ F(h(Xe), {
2561
+ "current-page": l.value,
2562
+ "onUpdate:currentPage": m[1] || (m[1] = (g) => l.value = g),
2563
+ "page-size": f.value,
2564
+ "onUpdate:pageSize": m[2] || (m[2] = (g) => f.value = g),
2565
+ total: v.value,
2566
+ "page-sizes": [10, 20, 50],
2567
+ layout: "total, sizes, prev, pager, next",
2568
+ background: ""
2569
+ }, null, 8, ["current-page", "page-size", "total"])
2570
+ ])
2571
+ ]),
2572
+ _: 1
2573
+ }, 8, ["model-value"])
2574
+ ]),
2575
+ _: 1
2576
+ }, 8, ["locale"]));
2577
+ }
2578
+ }), _l = /* @__PURE__ */ E(Cl, [["__scopeId", "data-v-6fdc08dc"]]), Il = { class: "fd-toolbar" }, Dl = { class: "fd-toolbar-left flex-align-center" }, Sl = ["value"], Tl = { class: "fd-device" }, Fl = {
2579
+ key: 0,
2580
+ class: "is-active",
2581
+ title: "移动端比例(由 URL 参数 templateType 决定)"
2582
+ }, Ll = {
2583
+ key: 1,
2584
+ class: "is-active",
2585
+ title: "电脑端比例(由 URL 参数 templateType 决定)"
2586
+ }, Ml = { class: "fd-toolbar-right flex-align-center" }, Nl = ["disabled"], El = ["disabled"], Pl = { class: "fd-dialog fd-dialog--preview" }, Ol = { class: "fd-dialog-head" }, Ul = { class: "fd-preview-width" }, Bl = { class: "fd-dialog-body" }, Vl = { class: "fd-dialog" }, jl = { class: "fd-dialog-head" }, Rl = { class: "fd-dialog-code" }, Al = { class: "fd-dialog" }, zl = { class: "fd-dialog-head" }, Jl = { class: "fd-dialog-body" }, Wl = /* @__PURE__ */ L({
2587
+ __name: "Toolbar",
2588
+ setup(e) {
2589
+ const n = W(), o = O(!1), s = O(!1), a = O(!1), i = O(!1), u = O(!1), r = O(0);
2590
+ function l() {
2591
+ const C = new URLSearchParams(window.location.search).get("templateType") || "";
2592
+ return C === "mobile" || C === "2";
2593
+ }
2594
+ const f = O(l() ? 375 : 1200);
2595
+ function v() {
2596
+ const C = Number(f.value);
2597
+ f.value = Math.min(1200, Math.max(270, Number.isFinite(C) ? C : 1200));
2598
+ }
2599
+ le(
2600
+ () => n.device,
2601
+ (C) => {
2602
+ f.value = C === "mobile" ? 375 : 1200;
2603
+ }
2604
+ );
2605
+ const k = O("");
2606
+ function P() {
2607
+ const C = k.value.trim();
2608
+ if (!C) {
2609
+ window.alert("请先粘贴表单 JSON");
2610
+ return;
2611
+ }
2612
+ try {
2613
+ n.loadSchema(JSON.parse(C));
2614
+ } catch {
2615
+ window.alert("JSON 解析失败");
2616
+ return;
2617
+ }
2618
+ k.value = "", i.value = !1;
2619
+ }
2620
+ const j = M(() => JSON.stringify(n.toSchema(), null, 2)), _ = M(() => {
2621
+ const C = {};
2622
+ n.fields.forEach((S) => {
2623
+ C[S.name] = S.name;
2624
+ });
2625
+ const b = (S, H) => (S.forEach((z) => {
2626
+ var ke;
2627
+ z.type === "subtable" && H.push(z), (ke = z.children) != null && ke.length && b(z.children, H);
2628
+ }), H);
2629
+ return b(n.widgets, []).forEach((S) => {
2630
+ if (S.type !== "subtable" || !S.secondtable) return;
2631
+ const H = {};
2632
+ (S.colnums ?? []).forEach((z) => {
2633
+ H[z.name] = z.name, z.bindLink && (H[z.bindLink] = z.bindLink);
2634
+ }), C[S.secondtable] = [H];
2635
+ }), C;
2636
+ });
2637
+ async function D() {
2638
+ if (!n.workFormId) {
2639
+ window.alert("尚未打开表单,无法保存");
2640
+ return;
2641
+ }
2642
+ if (!n.formName.trim()) {
2643
+ window.alert("请先填写表单名称(保存必填)");
2644
+ return;
2645
+ }
2646
+ try {
2647
+ const C = await n.save();
2648
+ C.success ? (Zs(n.formId, n.toSchema()), window.alert(`${C.message}
2649
+ 工作表单 ID:${n.workFormId}`)) : window.alert(`保存失败:${C.message}`);
2650
+ } catch {
2651
+ window.alert(n.errorMsg || "保存失败");
2652
+ }
2653
+ }
2654
+ async function m() {
2655
+ var S, H;
2656
+ if (!n.workFormId) {
2657
+ window.alert("尚未打开表单,无法另存为");
2658
+ return;
2659
+ }
2660
+ const C = (S = window.prompt("新表单名称", `${n.formName || "表单"} 副本`)) == null ? void 0 : S.trim();
2661
+ if (!C) return;
2662
+ const b = (H = window.prompt("新表单编码(如 SG_ZL_YYQHTSP,_M 结尾为移动端模板)", "")) == null ? void 0 : H.trim();
2663
+ if (b)
2664
+ try {
2665
+ const z = await n.saveAs(C, b);
2666
+ z.success ? window.alert(`${z.message}
2667
+ 新表单 ID:${z.newFormID}`) : window.alert(`另存为失败:${z.message}`);
2668
+ } catch {
2669
+ window.alert(n.errorMsg || "另存为失败");
2670
+ }
2671
+ }
2672
+ function g() {
2673
+ location.reload();
2674
+ }
2675
+ async function $() {
2676
+ if (!n.workFormId) {
2677
+ window.alert("尚未打开表单,无法发布");
2678
+ return;
2679
+ }
2680
+ if (!n.formName.trim()) {
2681
+ window.alert("请先填写表单名称(发布必填)");
2682
+ return;
2683
+ }
2684
+ try {
2685
+ const { needConfirm: C, count: b } = await n.checkPublish();
2686
+ if (C) {
2687
+ r.value = b, u.value = !0;
2688
+ return;
2689
+ }
2690
+ await B();
2691
+ } catch {
2692
+ window.alert(n.errorMsg || "发布检查失败");
2693
+ }
2694
+ }
2695
+ async function B() {
2696
+ try {
2697
+ const C = await n.publish();
2698
+ window.alert(C.success ? C.message : `发布失败:${C.message}`);
2699
+ } catch {
2700
+ window.alert(n.errorMsg || "发布失败");
2701
+ }
2702
+ }
2703
+ async function q() {
2704
+ u.value = !1, await B();
2705
+ }
2706
+ const x = O(null), p = O(null);
2707
+ function w(C) {
2708
+ var S, H;
2709
+ if (!a.value) return;
2710
+ const b = C.target;
2711
+ (S = x.value) != null && S.contains(b) || (H = p.value) != null && H.contains(b) || (a.value = !1);
2712
+ }
2713
+ return ie(() => document.addEventListener("click", w)), je(() => document.removeEventListener("click", w)), (C, b) => (d(), c("div", Il, [
2714
+ t("div", Dl, [
2715
+ b[18] || (b[18] = t("span", { class: "fd-toolbar-title" }, "表单设计器", -1)),
2716
+ t("input", {
2717
+ class: "fd-toolbar-name",
2718
+ value: h(n).formName,
2719
+ placeholder: "表单名称(保存必填)",
2720
+ onInput: b[0] || (b[0] = (S) => h(n).formName = S.target.value)
2721
+ }, null, 40, Sl),
2722
+ t("div", Tl, [
2723
+ h(n).device === "mobile" ? (d(), c("button", Fl, [...b[16] || (b[16] = [
2724
+ t("svg", {
2725
+ class: "fd-tool-btn-icon",
2726
+ viewBox: "0 0 24 24",
2727
+ fill: "none",
2728
+ stroke: "currentColor",
2729
+ "stroke-width": "1.8",
2730
+ "stroke-linecap": "round",
2731
+ "stroke-linejoin": "round"
2732
+ }, [
2733
+ t("rect", {
2734
+ x: "5",
2735
+ y: "2",
2736
+ width: "14",
2737
+ height: "20",
2738
+ rx: "2"
2739
+ }),
2740
+ t("line", {
2741
+ x1: "12",
2742
+ y1: "18",
2743
+ x2: "12.01",
2744
+ y2: "18"
2745
+ })
2746
+ ], -1),
2747
+ U(" 移动端 ", -1)
2748
+ ])])) : (d(), c("button", Ll, [...b[17] || (b[17] = [
2749
+ t("svg", {
2750
+ class: "fd-tool-btn-icon",
2751
+ viewBox: "0 0 24 24",
2752
+ fill: "none",
2753
+ stroke: "currentColor",
2754
+ "stroke-width": "1.8",
2755
+ "stroke-linecap": "round",
2756
+ "stroke-linejoin": "round"
2757
+ }, [
2758
+ t("rect", {
2759
+ x: "2",
2760
+ y: "3",
2761
+ width: "20",
2762
+ height: "14",
2763
+ rx: "2"
2764
+ }),
2765
+ t("line", {
2766
+ x1: "8",
2767
+ y1: "21",
2768
+ x2: "16",
2769
+ y2: "21"
2770
+ }),
2771
+ t("line", {
2772
+ x1: "12",
2773
+ y1: "17",
2774
+ x2: "12",
2775
+ y2: "21"
2776
+ })
2777
+ ], -1),
2778
+ U(" 电脑端 ", -1)
2779
+ ])]))
2780
+ ])
2781
+ ]),
2782
+ t("div", Ml, [
2783
+ t("button", {
2784
+ class: "fd-tool-btn",
2785
+ onClick: b[1] || (b[1] = (S) => o.value = !0)
2786
+ }, [...b[19] || (b[19] = [
2787
+ t("svg", {
2788
+ class: "fd-tool-btn-icon",
2789
+ viewBox: "0 0 24 24",
2790
+ fill: "none",
2791
+ stroke: "currentColor",
2792
+ "stroke-width": "1.8",
2793
+ "stroke-linecap": "round",
2794
+ "stroke-linejoin": "round"
2795
+ }, [
2796
+ t("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
2797
+ t("circle", {
2798
+ cx: "12",
2799
+ cy: "12",
2800
+ r: "3"
2801
+ })
2802
+ ], -1),
2803
+ U(" 预览 ", -1)
2804
+ ])]),
2805
+ t("button", {
2806
+ class: "fd-tool-btn",
2807
+ onClick: b[2] || (b[2] = (S) => s.value = !0)
2808
+ }, [...b[20] || (b[20] = [
2809
+ t("svg", {
2810
+ class: "fd-tool-btn-icon",
2811
+ viewBox: "0 0 24 24",
2812
+ fill: "none",
2813
+ stroke: "currentColor",
2814
+ "stroke-width": "1.8",
2815
+ "stroke-linecap": "round",
2816
+ "stroke-linejoin": "round"
2817
+ }, [
2818
+ t("polyline", { points: "16 18 22 12 16 6" }),
2819
+ t("polyline", { points: "8 6 2 12 8 18" })
2820
+ ], -1),
2821
+ U(" 查看代码 ", -1)
2822
+ ])]),
2823
+ t("button", {
2824
+ class: "fd-tool-btn",
2825
+ onClick: b[3] || (b[3] = (S) => i.value = !0)
2826
+ }, [...b[21] || (b[21] = [
2827
+ t("svg", {
2828
+ class: "fd-tool-btn-icon",
2829
+ viewBox: "0 0 24 24",
2830
+ fill: "none",
2831
+ stroke: "currentColor",
2832
+ "stroke-width": "1.8",
2833
+ "stroke-linecap": "round",
2834
+ "stroke-linejoin": "round"
2835
+ }, [
2836
+ t("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
2837
+ t("polyline", { points: "17 8 12 3 7 8" }),
2838
+ t("line", {
2839
+ x1: "12",
2840
+ y1: "3",
2841
+ x2: "12",
2842
+ y2: "15"
2843
+ })
2844
+ ], -1),
2845
+ U(" 导入 ", -1)
2846
+ ])]),
2847
+ t("button", {
2848
+ class: "fd-tool-btn",
2849
+ onClick: g
2850
+ }, [...b[22] || (b[22] = [
2851
+ t("svg", {
2852
+ class: "fd-tool-btn-icon",
2853
+ viewBox: "0 0 24 24",
2854
+ fill: "none",
2855
+ stroke: "currentColor",
2856
+ "stroke-width": "1.8",
2857
+ "stroke-linecap": "round",
2858
+ "stroke-linejoin": "round"
2859
+ }, [
2860
+ t("polyline", { points: "23 4 23 10 17 10" }),
2861
+ t("path", { d: "M20.49 15a9 9 0 1 1-2.12-9.36L23 10" })
2862
+ ], -1),
2863
+ U(" 加载 ", -1)
2864
+ ])]),
2865
+ t("button", {
2866
+ class: "fd-tool-btn",
2867
+ onClick: D
2868
+ }, [...b[23] || (b[23] = [
2869
+ t("svg", {
2870
+ class: "fd-tool-btn-icon",
2871
+ viewBox: "0 0 24 24",
2872
+ fill: "none",
2873
+ stroke: "currentColor",
2874
+ "stroke-width": "1.8",
2875
+ "stroke-linecap": "round",
2876
+ "stroke-linejoin": "round"
2877
+ }, [
2878
+ t("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
2879
+ t("polyline", { points: "17 21 17 13 7 13 7 21" }),
2880
+ t("polyline", { points: "7 3 7 8 15 8" })
2881
+ ], -1),
2882
+ U(" 保存 ", -1)
2883
+ ])]),
2884
+ t("button", {
2885
+ class: "fd-tool-btn",
2886
+ onClick: m
2887
+ }, [...b[24] || (b[24] = [
2888
+ t("svg", {
2889
+ class: "fd-tool-btn-icon",
2890
+ viewBox: "0 0 24 24",
2891
+ fill: "none",
2892
+ stroke: "currentColor",
2893
+ "stroke-width": "1.8",
2894
+ "stroke-linecap": "round",
2895
+ "stroke-linejoin": "round"
2896
+ }, [
2897
+ t("rect", {
2898
+ x: "9",
2899
+ y: "9",
2900
+ width: "13",
2901
+ height: "13",
2902
+ rx: "2"
2903
+ }),
2904
+ t("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
2905
+ ], -1),
2906
+ U(" 另存为 ", -1)
2907
+ ])]),
2908
+ t("button", {
2909
+ class: "fd-tool-btn fd-tool-btn--primary",
2910
+ onClick: $
2911
+ }, [...b[25] || (b[25] = [
2912
+ t("svg", {
2913
+ class: "fd-tool-btn-icon",
2914
+ viewBox: "0 0 24 24",
2915
+ fill: "none",
2916
+ stroke: "currentColor",
2917
+ "stroke-width": "1.8",
2918
+ "stroke-linecap": "round",
2919
+ "stroke-linejoin": "round"
2920
+ }, [
2921
+ t("line", {
2922
+ x1: "22",
2923
+ y1: "2",
2924
+ x2: "11",
2925
+ y2: "13"
2926
+ }),
2927
+ t("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
2928
+ ], -1),
2929
+ U(" 发布 ", -1)
2930
+ ])]),
2931
+ b[29] || (b[29] = t("span", { class: "fd-toolbar-divider" }, null, -1)),
2932
+ t("button", {
2933
+ class: "fd-tool-btn fd-tool-icon-btn",
2934
+ disabled: !h(n).canUndo,
2935
+ title: "撤销",
2936
+ onClick: b[4] || (b[4] = (S) => h(n).undo())
2937
+ }, [...b[26] || (b[26] = [
2938
+ t("svg", {
2939
+ class: "fd-tool-icon",
2940
+ viewBox: "0 0 24 24",
2941
+ fill: "none",
2942
+ stroke: "currentColor",
2943
+ "stroke-width": "1.8",
2944
+ "stroke-linecap": "round",
2945
+ "stroke-linejoin": "round"
2946
+ }, [
2947
+ t("polyline", { points: "9 14 4 9 9 4" }),
2948
+ t("path", { d: "M20 20v-7a4 4 0 0 0-4-4H4" })
2949
+ ], -1)
2950
+ ])], 8, Nl),
2951
+ t("button", {
2952
+ class: "fd-tool-btn fd-tool-icon-btn",
2953
+ disabled: !h(n).canRedo,
2954
+ title: "重做",
2955
+ onClick: b[5] || (b[5] = (S) => h(n).redo())
2956
+ }, [...b[27] || (b[27] = [
2957
+ t("svg", {
2958
+ class: "fd-tool-icon",
2959
+ viewBox: "0 0 24 24",
2960
+ fill: "none",
2961
+ stroke: "currentColor",
2962
+ "stroke-width": "1.8",
2963
+ "stroke-linecap": "round",
2964
+ "stroke-linejoin": "round"
2965
+ }, [
2966
+ t("polyline", { points: "15 14 20 9 15 4" }),
2967
+ t("path", { d: "M4 20v-7a4 4 0 0 1 4-4h12" })
2968
+ ], -1)
2969
+ ])], 8, El),
2970
+ t("button", {
2971
+ ref_key: "treeBtnRef",
2972
+ ref: p,
2973
+ class: "fd-tool-btn",
2974
+ onClick: b[6] || (b[6] = (S) => a.value = !a.value)
2975
+ }, [...b[28] || (b[28] = [
2976
+ ve('<svg class="fd-tool-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-eae12460><line x1="8" y1="6" x2="21" y2="6" data-v-eae12460></line><line x1="8" y1="12" x2="21" y2="12" data-v-eae12460></line><line x1="8" y1="18" x2="21" y2="18" data-v-eae12460></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-eae12460></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-eae12460></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-eae12460></line></svg> 组件树 ', 2)
2977
+ ])], 512)
2978
+ ]),
2979
+ (d(), V(pe, { to: "body" }, [
2980
+ o.value ? (d(), c("div", {
2981
+ key: 0,
2982
+ class: "fd-dialog-mask",
2983
+ onClick: b[9] || (b[9] = J((S) => o.value = !1, ["self"]))
2984
+ }, [
2985
+ t("div", Pl, [
2986
+ t("div", Ol, [
2987
+ b[32] || (b[32] = t("span", null, "预览", -1)),
2988
+ t("div", Ul, [
2989
+ b[30] || (b[30] = t("label", { for: "fd-preview-width-input" }, "宽度", -1)),
2990
+ F(h(Ze), {
2991
+ id: "fd-preview-width-input",
2992
+ modelValue: f.value,
2993
+ "onUpdate:modelValue": b[7] || (b[7] = (S) => f.value = S),
2994
+ min: 270,
2995
+ max: 1200,
2996
+ step: 10,
2997
+ size: "small",
2998
+ "controls-position": "right",
2999
+ onChange: v
3000
+ }, null, 8, ["modelValue"]),
3001
+ b[31] || (b[31] = t("span", { class: "fd-preview-width-unit" }, "px", -1))
3002
+ ]),
3003
+ t("button", {
3004
+ class: "fd-tool-btn",
3005
+ onClick: b[8] || (b[8] = (S) => o.value = !1)
3006
+ }, "关闭")
3007
+ ]),
3008
+ t("div", Bl, [
3009
+ t("div", {
3010
+ class: "fd-preview-stage",
3011
+ style: G({ width: f.value + "px" })
3012
+ }, [
3013
+ F(Oe, {
3014
+ widgets: h(n).widgets,
3015
+ "form-data": _.value
3016
+ }, null, 8, ["widgets", "form-data"])
3017
+ ], 4)
3018
+ ])
3019
+ ])
3020
+ ])) : I("", !0),
3021
+ s.value ? (d(), c("div", {
3022
+ key: 1,
3023
+ class: "fd-dialog-mask",
3024
+ onClick: b[11] || (b[11] = J((S) => s.value = !1, ["self"]))
3025
+ }, [
3026
+ t("div", Vl, [
3027
+ t("div", jl, [
3028
+ b[33] || (b[33] = t("span", null, "JSON Schema", -1)),
3029
+ t("button", {
3030
+ class: "fd-tool-btn",
3031
+ onClick: b[10] || (b[10] = (S) => s.value = !1)
3032
+ }, "关闭")
3033
+ ]),
3034
+ t("pre", Rl, y(j.value), 1)
3035
+ ])
3036
+ ])) : I("", !0),
3037
+ i.value ? (d(), c("div", {
3038
+ key: 2,
3039
+ class: "fd-dialog-mask",
3040
+ onClick: b[14] || (b[14] = J((S) => i.value = !1, ["self"]))
3041
+ }, [
3042
+ t("div", Al, [
3043
+ t("div", zl, [
3044
+ b[34] || (b[34] = t("span", null, "导入(粘贴 JSON)", -1)),
3045
+ t("button", {
3046
+ class: "fd-tool-btn",
3047
+ onClick: b[12] || (b[12] = (S) => i.value = !1)
3048
+ }, "取消"),
3049
+ t("button", {
3050
+ class: "fd-tool-btn fd-tool-btn--primary",
3051
+ onClick: P
3052
+ }, "确认")
3053
+ ]),
3054
+ t("div", Jl, [
3055
+ ce(t("textarea", {
3056
+ "onUpdate:modelValue": b[13] || (b[13] = (S) => k.value = S),
3057
+ class: "fd-dialog-import-text",
3058
+ placeholder: "请粘贴表单 JSON(可从「查看代码」复制),确认后将覆盖当前表单"
3059
+ }, null, 512), [
3060
+ [Re, k.value]
3061
+ ])
3062
+ ])
3063
+ ])
3064
+ ])) : I("", !0),
3065
+ a.value ? (d(), c("div", {
3066
+ key: 3,
3067
+ ref_key: "treeDrawerRef",
3068
+ ref: x,
3069
+ class: "fd-tree-drawer"
3070
+ }, [
3071
+ F(cl)
3072
+ ], 512)) : I("", !0),
3073
+ F(_l, {
3074
+ modelValue: u.value,
3075
+ "onUpdate:modelValue": b[15] || (b[15] = (S) => u.value = S),
3076
+ "form-id": h(n).originFormId,
3077
+ count: r.value,
3078
+ onConfirm: q
3079
+ }, null, 8, ["modelValue", "form-id", "count"])
3080
+ ]))
3081
+ ]));
3082
+ }
3083
+ }), Hl = /* @__PURE__ */ E(Wl, [["__scopeId", "data-v-eae12460"]]), ql = { class: "fd-palette" }, Gl = { class: "fd-palette-group-title" }, Yl = ["onDragstart", "onClick"], Kl = { class: "fd-palette-icon" }, Ql = /* @__PURE__ */ L({
3084
+ __name: "WidgetPalette",
3085
+ setup(e) {
3086
+ const n = W(), o = tt(), s = [
3087
+ {
3088
+ title: "基础控件",
3089
+ types: ["label", "text"]
3090
+ },
3091
+ {
3092
+ title: "高级控件",
3093
+ types: ["subtable"]
3094
+ },
3095
+ {
3096
+ title: "布局控件",
3097
+ types: ["grid", "card", "slot"]
3098
+ }
3099
+ ], a = {
3100
+ grid: "▦",
3101
+ card: "▤",
3102
+ slot: "⧉",
3103
+ label: "T",
3104
+ text: "¶",
3105
+ subtable: "☰"
3106
+ };
3107
+ function i(l) {
3108
+ return o.find((f) => f.type === l);
3109
+ }
3110
+ function u(l, f) {
3111
+ var v;
3112
+ (v = l.dataTransfer) == null || v.setData("application/x-fd-new", f), l.dataTransfer && (l.dataTransfer.effectAllowed = "copy");
3113
+ }
3114
+ function r(l) {
3115
+ n.addWidget(l);
3116
+ }
3117
+ return (l, f) => (d(), c("div", ql, [
3118
+ f[0] || (f[0] = t("div", { class: "fd-palette-title" }, "控件库", -1)),
3119
+ (d(), c(T, null, N(s, (v) => t("div", {
3120
+ key: v.title,
3121
+ class: "fd-palette-group"
3122
+ }, [
3123
+ t("div", Gl, y(v.title), 1),
3124
+ (d(!0), c(T, null, N(v.types, (k) => (d(), c(T, { key: k }, [
3125
+ i(k) ? (d(), c("div", {
3126
+ key: 0,
3127
+ class: "fd-palette-item",
3128
+ draggable: "true",
3129
+ onDragstart: (P) => u(P, k),
3130
+ onClick: (P) => r(k)
3131
+ }, [
3132
+ t("span", Kl, y(a[k]), 1),
3133
+ t("span", null, y(i(k).title), 1)
3134
+ ], 40, Yl)) : I("", !0)
3135
+ ], 64))), 128))
3136
+ ])), 64))
3137
+ ]));
3138
+ }
3139
+ }), Xl = /* @__PURE__ */ E(Ql, [["__scopeId", "data-v-6a2bab90"]]), Zl = [
3140
+ { key: "onLoad", label: "加载完成", desc: "表单数据就绪后触发" },
3141
+ { key: "onMounted", label: "渲染挂载", desc: "渲染完成并挂载到 DOM 后触发" },
3142
+ { key: "onValueChange", label: "值变化", desc: "任意字段值变化时触发" },
3143
+ { key: "custom", label: "自定义方法", desc: "写入的方法将挂载至全局 window,可在其他事件处理中调用" }
3144
+ ], ea = { class: "fd-form-events" }, ta = { class: "fd-form-meta" }, na = { class: "fd-events-section" }, oa = { class: "fd-event-head" }, sa = ["title"], la = { class: "fd-event-key" }, aa = ["onClick", "title"], ia = {
3145
+ key: 0,
3146
+ class: "fd-event-trigger-text"
3147
+ }, da = {
3148
+ key: 1,
3149
+ class: "fd-event-trigger-placeholder"
3150
+ }, ra = {
3151
+ class: "fd-dialog",
3152
+ style: { "max-width": "600px" }
3153
+ }, ua = { class: "fd-dialog-head" }, ca = { class: "fd-dialog-body" }, fa = /* @__PURE__ */ L({
3154
+ __name: "FormEventsPanel",
3155
+ setup(e) {
3156
+ const n = Ae(() => import("./CodeEditor-CJeYvarM.js")), o = W(), s = Ie({
3157
+ open: !1,
3158
+ type: "",
3159
+ hookKey: "",
3160
+ index: -1,
3161
+ title: "",
3162
+ draft: ""
3163
+ });
3164
+ function a(r) {
3165
+ s.open = !0, s.type = "lifecycle", s.hookKey = r.key, s.title = `${r.label}(${r.key})`, s.draft = o.events.lifecycle[r.key] ?? "";
3166
+ }
3167
+ function i() {
3168
+ s.type === "lifecycle" && s.hookKey ? o.setLifecycleHook(s.hookKey, s.draft) : s.type === "custom" && s.index >= 0 && o.updateCustomEvent(s.index, { handler: s.draft }), s.open = !1;
3169
+ }
3170
+ function u() {
3171
+ s.open = !1;
3172
+ }
3173
+ return (r, l) => (d(), c("div", ea, [
3174
+ l[4] || (l[4] = t("div", { class: "fd-property-title" }, "表单属性", -1)),
3175
+ t("div", ta, [
3176
+ t("span", null, "表单:" + y(h(o).formId), 1),
3177
+ t("span", null, "主表:" + y(h(o).dbtable), 1)
3178
+ ]),
3179
+ t("section", na, [
3180
+ l[2] || (l[2] = t("h4", { class: "fd-events-h" }, "全局事件 · 生命周期", -1)),
3181
+ l[3] || (l[3] = t("p", { class: "fd-events-tip" }, "渲染时绑定至对应钩子函数中执行", -1)),
3182
+ (d(!0), c(T, null, N(h(Zl), (f) => (d(), c("div", {
3183
+ key: f.key,
3184
+ class: "fd-event-row"
3185
+ }, [
3186
+ t("div", oa, [
3187
+ t("label", {
3188
+ title: f.desc
3189
+ }, y(f.label), 9, sa),
3190
+ t("code", la, y(f.key), 1)
3191
+ ]),
3192
+ t("div", {
3193
+ class: "fd-event-trigger",
3194
+ onClick: (v) => a(f),
3195
+ title: h(o).events.lifecycle[f.key] || "点击编写处理函数"
3196
+ }, [
3197
+ h(o).events.lifecycle[f.key] ? (d(), c("span", ia, y(h(o).events.lifecycle[f.key]), 1)) : (d(), c("span", da, "点击编写")),
3198
+ l[1] || (l[1] = t("span", { class: "fd-event-trigger-arrow" }, "›", -1))
3199
+ ], 8, aa)
3200
+ ]))), 128))
3201
+ ]),
3202
+ (d(), V(pe, { to: "body" }, [
3203
+ s.open ? (d(), c("div", {
3204
+ key: 0,
3205
+ class: "fd-dialog-mask",
3206
+ onClick: J(u, ["self"])
3207
+ }, [
3208
+ t("div", ra, [
3209
+ t("div", ua, [
3210
+ t("span", null, "编写处理函数 - " + y(s.title), 1),
3211
+ t("button", {
3212
+ class: "fd-dialog-close",
3213
+ onClick: u,
3214
+ title: "关闭"
3215
+ }, "×")
3216
+ ]),
3217
+ t("div", ca, [
3218
+ F(h(n), {
3219
+ modelValue: s.draft,
3220
+ "onUpdate:modelValue": l[0] || (l[0] = (f) => s.draft = f),
3221
+ language: "javascript"
3222
+ }, null, 8, ["modelValue"])
3223
+ ]),
3224
+ t("div", { class: "fd-dialog-foot" }, [
3225
+ t("button", {
3226
+ class: "fd-btn fd-btn--primary",
3227
+ onClick: i
3228
+ }, "确定")
3229
+ ])
3230
+ ])
3231
+ ])) : I("", !0)
3232
+ ]))
3233
+ ]));
3234
+ }
3235
+ }), ma = /* @__PURE__ */ E(fa, [["__scopeId", "data-v-7e5a3f15"]]), pa = { class: "fd-property" }, va = {
3236
+ key: 1,
3237
+ class: "fd-property-empty"
3238
+ }, ba = {
3239
+ key: 1,
3240
+ class: "fd-property-item"
3241
+ }, ga = ["value"], ha = { class: "fd-property-foot" }, ya = { class: "fd-property-type" }, ka = /* @__PURE__ */ L({
3242
+ __name: "PropertyPanel",
3243
+ setup(e) {
3244
+ const n = W(), o = M(() => n.selectedNode), s = M(() => o.value ? K(o.value.type) : void 0), a = M(() => {
3245
+ var l;
3246
+ return (l = s.value) == null ? void 0 : l.panel;
3247
+ });
3248
+ function i(l) {
3249
+ o.value && n.updateNode(o.value.id, l);
3250
+ }
3251
+ const u = M(() => o.value != null && o.value.gridSpan != null);
3252
+ function r(l) {
3253
+ if (!o.value) return;
3254
+ const f = Number(l.target.value), v = Math.min(24, Math.max(1, Number.isFinite(f) ? Math.round(f) : 24));
3255
+ n.updateNode(o.value.id, { gridSpan: v });
3256
+ }
3257
+ return (l, f) => {
3258
+ var v;
3259
+ return d(), c("div", pa, [
3260
+ f[2] || (f[2] = t("div", { class: "fd-property-title" }, "属性", -1)),
3261
+ h(n).selectedForm ? (d(), V(ma, { key: 0 })) : o.value ? (d(), c(T, { key: 2 }, [
3262
+ a.value ? (d(), V(me(a.value), {
3263
+ key: 0,
3264
+ node: o.value,
3265
+ fields: h(n).fields,
3266
+ onUpdate: i
3267
+ }, null, 40, ["node", "fields"])) : I("", !0),
3268
+ u.value ? (d(), c("div", ba, [
3269
+ f[1] || (f[1] = t("label", null, "占比", -1)),
3270
+ t("input", {
3271
+ type: "number",
3272
+ min: "1",
3273
+ max: "24",
3274
+ value: o.value.gridSpan,
3275
+ onChange: r
3276
+ }, null, 40, ga)
3277
+ ])) : I("", !0),
3278
+ t("div", ha, [
3279
+ t("span", ya, "类型:" + y((v = s.value) == null ? void 0 : v.title), 1)
3280
+ ])
3281
+ ], 64)) : (d(), c("div", va, [...f[0] || (f[0] = [
3282
+ t("span", { class: "fd-property-empty-icon" }, "⚙", -1),
3283
+ t("span", null, [
3284
+ U("请选择左侧控件"),
3285
+ t("br"),
3286
+ U("或点击画板空白处设置表单属性")
3287
+ ], -1)
3288
+ ])]))
3289
+ ]);
3290
+ };
3291
+ }
3292
+ }), wa = /* @__PURE__ */ E(ka, [["__scopeId", "data-v-e89617c7"]]), $a = {
3293
+ key: 0,
3294
+ class: "fd-canvas-dropzone"
3295
+ }, xa = /* @__PURE__ */ L({
3296
+ __name: "CanvasNode",
3297
+ props: {
3298
+ node: {},
3299
+ parentId: {},
3300
+ index: {}
3301
+ },
3302
+ setup(e) {
3303
+ const n = e, o = W(), s = O(null), a = M(() => {
3304
+ const m = {};
3305
+ return n.node.gridSpan != null && (m.gridColumn = `span ${n.node.gridSpan}`), n.node.type === "text" && (m.display = n.node.display || "inline-block"), Object.keys(m).length ? m : void 0;
3306
+ }), i = () => {
3307
+ var m;
3308
+ return (m = K(n.node.type)) == null ? void 0 : m.isContainer;
3309
+ };
3310
+ function u(m, g) {
3311
+ if (n.node.type !== "grid") return "";
3312
+ const $ = n.node.layout || 24;
3313
+ return Fe(m, g, n.node.children || [], $, o.device === "mobile");
3314
+ }
3315
+ function r(m) {
3316
+ const g = m.dataTransfer;
3317
+ return !!g && (g.types.includes("application/x-fd-new") || g.types.includes("application/x-fd-move"));
3318
+ }
3319
+ function l() {
3320
+ o.select(n.node.id);
3321
+ }
3322
+ function f(m) {
3323
+ var g;
3324
+ m.stopPropagation(), o.setDragging(n.node.id), (g = m.dataTransfer) == null || g.setData("application/x-fd-move", n.node.id), m.dataTransfer && (m.dataTransfer.effectAllowed = "move");
3325
+ }
3326
+ function v() {
3327
+ o.dragOverId = null, o.dropContainerId = null, o.dragBefore = !1, o.setDragging(null);
3328
+ }
3329
+ function k(m) {
3330
+ m.stopPropagation(), v();
3331
+ }
3332
+ function P() {
3333
+ o.dragOverId === n.node.id && (o.dragOverId = null), o.dropContainerId === n.node.id && (o.dropContainerId = null);
3334
+ }
3335
+ function j(m) {
3336
+ if (r(m))
3337
+ if (m.preventDefault(), m.stopPropagation(), i())
3338
+ o.dragOverId = null, o.dragBefore = !1, o.dropContainerId = n.node.id;
3339
+ else {
3340
+ o.dropContainerId = null, o.dragOverId = n.node.id;
3341
+ const g = s.value;
3342
+ if (g) {
3343
+ const $ = g.getBoundingClientRect();
3344
+ o.dragBefore = m.clientY - $.top < $.height / 2;
3345
+ }
3346
+ }
3347
+ }
3348
+ function _() {
3349
+ P();
3350
+ }
3351
+ function D(m) {
3352
+ var B, q, x;
3353
+ if (!r(m)) return;
3354
+ m.preventDefault(), m.stopPropagation();
3355
+ const g = (B = m.dataTransfer) == null ? void 0 : B.getData("application/x-fd-new"), $ = (q = m.dataTransfer) == null ? void 0 : q.getData("application/x-fd-move");
3356
+ if (i())
3357
+ g ? o.addWidget(g, n.node.id) : $ && o.moveNode($, n.node.id, ((x = n.node.children) == null ? void 0 : x.length) ?? 0);
3358
+ else {
3359
+ const p = o.dragBefore ? n.index : n.index + 1;
3360
+ g ? o.addWidget(g, n.parentId, p) : $ && o.moveNode($, n.parentId, p);
3361
+ }
3362
+ o.dragOverId = null, o.dragBefore = !1, o.dropContainerId = null;
3363
+ }
3364
+ return (m, g) => {
3365
+ const $ = Se("CanvasNode", !0);
3366
+ return d(), c("div", {
3367
+ ref_key: "rootEl",
3368
+ ref: s,
3369
+ class: R(["fd-canvas-node", [
3370
+ `fd-canvas-node--${e.node.type}`,
3371
+ {
3372
+ "is-selected": h(o).selectedId === e.node.id,
3373
+ "drop-before": h(o).dragOverId === e.node.id && h(o).dragBefore,
3374
+ "drop-target": h(o).dropContainerId === e.node.id,
3375
+ "dragging-source": h(o).draggingId === e.node.id
3376
+ }
3377
+ ]]),
3378
+ style: G(a.value),
3379
+ draggable: "true",
3380
+ onMousedown: J(l, ["stop"]),
3381
+ onClick: g[4] || (g[4] = J(() => {
3382
+ }, ["stop"])),
3383
+ onDragstart: f,
3384
+ onDragend: k,
3385
+ onDragover: j,
3386
+ onDragleave: _,
3387
+ onDrop: D
3388
+ }, [
3389
+ t("div", {
3390
+ class: "fd-canvas-node-actions",
3391
+ onMousedown: g[3] || (g[3] = J(() => {
3392
+ }, ["stop"]))
3393
+ }, [
3394
+ t("span", {
3395
+ class: "fd-node-action",
3396
+ title: "上移",
3397
+ onClick: g[0] || (g[0] = J((B) => h(o).moveSibling(e.node.id, -1), ["stop"]))
3398
+ }, [...g[5] || (g[5] = [
3399
+ t("svg", {
3400
+ class: "fd-node-icon",
3401
+ viewBox: "0 0 24 24",
3402
+ fill: "none",
3403
+ stroke: "currentColor",
3404
+ "stroke-width": "1.8",
3405
+ "stroke-linecap": "round",
3406
+ "stroke-linejoin": "round"
3407
+ }, [
3408
+ t("line", {
3409
+ x1: "12",
3410
+ y1: "20",
3411
+ x2: "12",
3412
+ y2: "5"
3413
+ }),
3414
+ t("polyline", { points: "6 11 12 5 18 11" })
3415
+ ], -1)
3416
+ ])]),
3417
+ t("span", {
3418
+ class: "fd-node-action",
3419
+ title: "下移",
3420
+ onClick: g[1] || (g[1] = J((B) => h(o).moveSibling(e.node.id, 1), ["stop"]))
3421
+ }, [...g[6] || (g[6] = [
3422
+ t("svg", {
3423
+ class: "fd-node-icon",
3424
+ viewBox: "0 0 24 24",
3425
+ fill: "none",
3426
+ stroke: "currentColor",
3427
+ "stroke-width": "1.8",
3428
+ "stroke-linecap": "round",
3429
+ "stroke-linejoin": "round"
3430
+ }, [
3431
+ t("line", {
3432
+ x1: "12",
3433
+ y1: "4",
3434
+ x2: "12",
3435
+ y2: "19"
3436
+ }),
3437
+ t("polyline", { points: "6 13 12 19 18 13" })
3438
+ ], -1)
3439
+ ])]),
3440
+ t("span", {
3441
+ class: "fd-node-action delete",
3442
+ title: "删除",
3443
+ onClick: g[2] || (g[2] = J((B) => h(o).removeWidget(e.node.id), ["stop"]))
3444
+ }, [...g[7] || (g[7] = [
3445
+ ve('<svg class="fd-node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-3f3a43d3><path d="M4 7h16" data-v-3f3a43d3></path><path d="M9 7V5.5a1.5 1.5 0 0 1 1.5-1.5h3A1.5 1.5 0 0 1 15 5.5V7" data-v-3f3a43d3></path><path d="M6.5 7l1 12.5h9l1-12.5" data-v-3f3a43d3></path><line x1="10" y1="11" x2="10" y2="16.5" data-v-3f3a43d3></line><line x1="14" y1="11" x2="14" y2="16.5" data-v-3f3a43d3></line></svg>', 1)
3446
+ ])])
3447
+ ], 32),
3448
+ F(ge, {
3449
+ node: e.node,
3450
+ mode: "design"
3451
+ }, ae({ _: 2 }, [
3452
+ i() && e.node.children ? {
3453
+ name: "children",
3454
+ fn: A(() => [
3455
+ (d(!0), c(T, null, N(e.node.children, (B, q) => (d(), V($, {
3456
+ key: B.id,
3457
+ node: B,
3458
+ "parent-id": e.node.id,
3459
+ index: q,
3460
+ class: R(u(B, q))
3461
+ }, null, 8, ["node", "parent-id", "index", "class"]))), 128)),
3462
+ !e.node.children || e.node.children.length === 0 ? (d(), c("div", $a, "拖拽控件到此容器")) : I("", !0)
3463
+ ]),
3464
+ key: "0"
3465
+ } : void 0
3466
+ ]), 1032, ["node"])
3467
+ ], 38);
3468
+ };
3469
+ }
3470
+ }), Ca = /* @__PURE__ */ E(xa, [["__scopeId", "data-v-3f3a43d3"]]), _a = { class: "fd-designer" }, Ia = { class: "fd-designer-body" }, Da = { class: "fd-designer-left" }, Sa = {
3471
+ key: 0,
3472
+ class: "fd-canvas-notice"
3473
+ }, Ta = {
3474
+ key: 1,
3475
+ class: "fd-canvas-state"
3476
+ }, Fa = {
3477
+ key: 2,
3478
+ class: "fd-canvas-state fd-canvas-state--error"
3479
+ }, La = {
3480
+ key: 0,
3481
+ class: "fd-canvas-empty"
3482
+ }, Ma = { class: "fd-designer-right" }, Na = /* @__PURE__ */ L({
3483
+ __name: "Designer",
3484
+ props: {
3485
+ formId: {}
3486
+ },
3487
+ setup(e) {
3488
+ const n = e, o = W();
3489
+ ie(async () => {
3490
+ const a = new URLSearchParams(window.location.search), i = a.get("baseUrl");
3491
+ i && Us(i);
3492
+ const u = n.formId || a.get("id") || "", r = a.get("formVersion") || a.get("FormVersion") || "", l = a.get("openType") || a.get("OpenType") || "";
3493
+ await o.openForm(u, r, l);
3494
+ });
3495
+ function s(a) {
3496
+ var r, l;
3497
+ a.preventDefault();
3498
+ const i = (r = a.dataTransfer) == null ? void 0 : r.getData("application/x-fd-new"), u = (l = a.dataTransfer) == null ? void 0 : l.getData("application/x-fd-move");
3499
+ i ? o.addWidget(i, null, o.widgets.length) : u && o.moveNode(u, null, o.widgets.length);
3500
+ }
3501
+ return (a, i) => (d(), c("div", _a, [
3502
+ F(Hl),
3503
+ t("div", Ia, [
3504
+ t("aside", Da, [
3505
+ F(Xl)
3506
+ ]),
3507
+ t("main", {
3508
+ class: "fd-designer-center",
3509
+ onDragover: i[1] || (i[1] = J(() => {
3510
+ }, ["prevent"])),
3511
+ onDrop: s
3512
+ }, [
3513
+ h(o).noticeMsg ? (d(), c("div", Sa, y(h(o).noticeMsg), 1)) : I("", !0),
3514
+ h(o).loading ? (d(), c("div", Ta, "正在加载表单…")) : h(o).errorMsg ? (d(), c("div", Fa, y(h(o).errorMsg), 1)) : (d(), c("div", {
3515
+ key: 3,
3516
+ class: R(["fd-canvas", { "is-mobile": h(o).device === "mobile", "is-selected": h(o).selectedForm }]),
3517
+ onClick: i[0] || (i[0] = (u) => h(o).selectForm())
3518
+ }, [
3519
+ h(o).widgets.length === 0 ? (d(), c("div", La, [...i[2] || (i[2] = [
3520
+ t("span", { class: "fd-canvas-empty-icon" }, "▦", -1),
3521
+ t("span", null, "从左侧拖拽控件到此处", -1)
3522
+ ])])) : I("", !0),
3523
+ (d(!0), c(T, null, N(h(o).widgets, (u, r) => (d(), V(Ca, {
3524
+ key: u.id,
3525
+ node: u,
3526
+ "parent-id": null,
3527
+ index: r
3528
+ }, null, 8, ["node", "index"]))), 128))
3529
+ ], 2))
3530
+ ], 32),
3531
+ t("aside", Ma, [
3532
+ F(wa)
3533
+ ])
3534
+ ])
3535
+ ]));
3536
+ }
3537
+ }), Ea = /* @__PURE__ */ E(Na, [["__scopeId", "data-v-86f01272"]]);
3538
+ function Xa(e) {
3539
+ he(), e.baseUrl && Le({ baseUrl: e.baseUrl });
3540
+ let n = null;
3541
+ const s = ze({
3542
+ render: () => Je(Oe, {
3543
+ widgets: e.widgets,
3544
+ formMode: e.formMode,
3545
+ formData: e.formData,
3546
+ events: e.events,
3547
+ formId: e.formId,
3548
+ ref: (a) => {
3549
+ n = a;
3550
+ }
3551
+ })
3552
+ });
3553
+ return s.mount(e.container), {
3554
+ fireEvent: (a, i) => {
3555
+ var u;
3556
+ return (u = n == null ? void 0 : n.fireEvent) == null ? void 0 : u.call(n, a, i);
3557
+ },
3558
+ unmount: () => s.unmount()
3559
+ };
3560
+ }
3561
+ const Za = {
3562
+ install(e, n = {}) {
3563
+ he(), n.baseUrl && Le({ baseUrl: n.baseUrl }), e.component("FdDesigner", Ea);
3564
+ }
3565
+ };
3566
+ export {
3567
+ Ea as D,
3568
+ Zl as L,
3569
+ Oe as R,
3570
+ E as _,
3571
+ Za as a,
3572
+ Xa as b,
3573
+ Le as c,
3574
+ Ya as d,
3575
+ Qa as l,
3576
+ ee as r,
3577
+ Ka as s
3578
+ };