@jxyszb/jxy-form-designer 0.1.0

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,3023 @@
1
+ import { ref as re, reactive as ke, computed as oe, onMounted as He, onBeforeUnmount as _l, inject as hl, resolveComponent as y, openBlock as s, createElementBlock as v, createElementVNode as _, createVNode as t, unref as o, toDisplayString as Y, withCtx as n, createTextVNode as F, Fragment as q, renderList as G, createBlock as E, resolveDynamicComponent as We, normalizeClass as Oe, pushScopeId as he, popScopeId as ve, withModifiers as ce, withDirectives as vl, vShow as gl, createCommentVNode as W, normalizeStyle as bl, createSlots as Ge, renderSlot as $e, normalizeProps as Ze, guardReactiveProps as Qe, provide as kl } from "vue";
2
+ import { defineStore as Sl } from "pinia";
3
+ import { c as Ee, k as xe, h as De, e as Re, l as _e, r as Cl, o as Me, g as xl, i as el, f as $l, j as ll, p as Ye, m as qe, n as Vl, C as tl, q as wl, s as Nl, t as Pl, u as Tl, v as El, w as Dl } from "./chunks/compositeField-98c1b192.js";
4
+ import { validateJxyFormSchema as Xe } from "./schema.js";
5
+ import { ElMessageBox as Ve, ElMessage as le } from "element-plus";
6
+ import { Back as Ul, Right as Ol, Delete as ue, CopyDocument as we, DocumentCopy as Al, SetUp as Be, ArrowDown as ol, Calendar as Il, Coin as Fl, Document as Rl, Edit as zl, Finished as Jl, Grid as ze, List as Ll, Location as jl, Lock as Ml, Memo as Yl, Notebook as ql, Odometer as Xl, Open as Bl, Picture as Kl, Share as Hl, Tickets as Wl, Upload as al, UploadFilled as Gl, Rank as Zl, Plus as Ae, InfoFilled as nl, Connection as sl, Setting as Ql } from "@element-plus/icons-vue";
7
+ import { _ as ne, r as et, b as lt } from "./chunks/RuntimePreviewPanel-3704c8f8.js";
8
+ import Je from "vuedraggable";
9
+ import { v as Ie } from "./chunks/dataSourceUrl-4b17feb8.js";
10
+ const rl = "jxy-form-designer-draft", il = "jxy-form-designer-published:";
11
+ function tt(e) {
12
+ try {
13
+ localStorage.setItem(rl, JSON.stringify(e));
14
+ } catch (l) {
15
+ console.warn("[FormDesigner] 草稿保存到 localStorage 失败", l);
16
+ }
17
+ }
18
+ function ot() {
19
+ try {
20
+ const e = localStorage.getItem(rl);
21
+ return e ? JSON.parse(e) : null;
22
+ } catch (e) {
23
+ return console.warn("[FormDesigner] 从 localStorage 加载草稿失败", e), null;
24
+ }
25
+ }
26
+ function at(e, l) {
27
+ try {
28
+ localStorage.setItem(il + e, JSON.stringify(l));
29
+ } catch (g) {
30
+ console.warn("[FormDesigner] 发布 schema 保存到 localStorage 失败", g);
31
+ }
32
+ }
33
+ function nt(e) {
34
+ try {
35
+ const l = localStorage.getItem(il + e);
36
+ return l ? JSON.parse(l) : null;
37
+ } catch {
38
+ return null;
39
+ }
40
+ }
41
+ const se = Sl("jxyFormDesigner", () => {
42
+ const e = re(Ee()), l = re(""), g = re("props"), r = re(null), u = ke({
43
+ isDragging: !1,
44
+ sourceType: "",
45
+ // 来源
46
+ dragItem: null
47
+ // 拖拽中的条目
48
+ }), h = ke({
49
+ scale: 1,
50
+ showGrid: !0
51
+ }), p = ke({
52
+ stack: [],
53
+ pointer: -1,
54
+ limit: 50
55
+ }), c = oe(() => l.value ? xe(e.value, l.value) : null), m = oe(() => p.pointer > 0), O = oe(() => p.pointer < p.stack.length - 1), P = oe(() => De(e.value)), C = oe(() => P.value.map((i) => i.prop).filter(Boolean));
56
+ function x() {
57
+ const i = JSON.stringify(e.value);
58
+ p.pointer < p.stack.length - 1 && p.stack.splice(p.pointer + 1), p.stack.push(i), p.stack.length > p.limit && p.stack.shift(), p.pointer = p.stack.length - 1;
59
+ }
60
+ function A() {
61
+ p.stack = [JSON.stringify(e.value)], p.pointer = 0;
62
+ }
63
+ function j() {
64
+ m.value && (p.pointer--, e.value = JSON.parse(p.stack[p.pointer]), l.value && !xe(e.value, l.value) && (l.value = ""));
65
+ }
66
+ function U() {
67
+ O.value && (p.pointer++, e.value = JSON.parse(p.stack[p.pointer]), l.value && !xe(e.value, l.value) && (l.value = ""));
68
+ }
69
+ function d(i) {
70
+ l.value = i;
71
+ }
72
+ function S() {
73
+ l.value = "";
74
+ }
75
+ function b(i, $, V) {
76
+ const z = Re(i);
77
+ $.splice(V, 0, z), _e(e.value), d(z.id), x();
78
+ }
79
+ function w(i) {
80
+ const $ = Cl(e.value, i);
81
+ return $ && (l.value === i && (l.value = ""), _e(e.value), x()), $;
82
+ }
83
+ function M() {
84
+ return l.value ? w(l.value) : !1;
85
+ }
86
+ function R(i) {
87
+ const $ = i || l.value;
88
+ if (!$)
89
+ return;
90
+ const V = xe(e.value, $);
91
+ V && (r.value = JSON.parse(JSON.stringify(V)));
92
+ }
93
+ function a(i, $) {
94
+ if (!r.value)
95
+ return;
96
+ const V = JSON.parse(JSON.stringify(r.value));
97
+ k(V), i.splice($, 0, V), _e(e.value), d(V.id), x();
98
+ }
99
+ function k(i) {
100
+ i.id = Me(i.nodeType || "node"), i.nodeType === "field" && i.prop && (i.prop = N(i.prop)), i.nodeType === "grid" && Array.isArray(i.columns) && i.columns.forEach(($) => {
101
+ $.id = Me("col"), Array.isArray($.children) && $.children.forEach((V) => k(V));
102
+ });
103
+ }
104
+ function N(i) {
105
+ const $ = new Set(
106
+ De(e.value).map((K) => K.prop).filter(Boolean)
107
+ ), V = i.replace(/_copy(_[a-z0-9]+)?$/, "");
108
+ let z = `${V}_copy`;
109
+ if (!$.has(z))
110
+ return z;
111
+ for (let K = 0; K < 20; K++) {
112
+ const ae = Math.random().toString(36).slice(2, 6);
113
+ if (z = `${V}_copy_${ae}`, !$.has(z))
114
+ return z;
115
+ }
116
+ return z;
117
+ }
118
+ function Z(i, $) {
119
+ const V = c.value;
120
+ if (!V)
121
+ return;
122
+ let z = $;
123
+ if (i.endsWith("labelWidth") && z == null && (z = ""), V.nodeType === "grid" && i === "columnCount") {
124
+ te(V, z), _e(e.value), x();
125
+ return;
126
+ }
127
+ Q(V, i, z);
128
+ const K = i.split(".");
129
+ let ae = V;
130
+ for (let X = 0; X < K.length - 1; X++)
131
+ ae[K[X]] === void 0 && (ae[K[X]] = {}), ae = ae[K[X]];
132
+ ae[K[K.length - 1]] = z, V.nodeType === "field" && V.type === "select" && i === "props.multiple" && (V.defaultValue = z ? [] : ""), x();
133
+ }
134
+ function Q(i, $, V) {
135
+ if (i.nodeType === "field") {
136
+ if (i.type === "addressSelector" && [
137
+ "props.provinceProp",
138
+ "props.cityProp",
139
+ "props.countyProp",
140
+ "props.detailAddressProp"
141
+ ].includes($)) {
142
+ const z = xl(i), K = i.defaultValue && typeof i.defaultValue == "object" && !Array.isArray(i.defaultValue) ? i.defaultValue : {}, ae = {
143
+ province: K[z.province] ?? "",
144
+ city: K[z.city] ?? "",
145
+ county: K[z.county] ?? "",
146
+ detailAddress: K[z.detailAddress] ?? ""
147
+ }, X = $.replace("props.", "");
148
+ i.defaultValue = el({ props: { ...i.props, [X]: V } }, ae);
149
+ }
150
+ if (i.type === "linkedSelectList" && [
151
+ "props.parentValueProp",
152
+ "props.childValueProp"
153
+ ].includes($)) {
154
+ const z = $l(i), K = Array.isArray(i.defaultValue) ? i.defaultValue.map((X) => ({
155
+ parentValue: (X == null ? void 0 : X[z.parentValue]) ?? "",
156
+ childValue: (X == null ? void 0 : X[z.childValue]) ?? ""
157
+ })) : [], ae = $.replace("props.", "");
158
+ i.defaultValue = ll({ props: { ...i.props, [ae]: V } }, K);
159
+ }
160
+ }
161
+ }
162
+ function te(i, $) {
163
+ const V = ie($);
164
+ Array.isArray(i.columns) || (i.columns = []);
165
+ const z = i.columns.length;
166
+ if (V > z)
167
+ for (let X = z; X < V; X++)
168
+ i.columns.push(Ye());
169
+ else if (V < z) {
170
+ const X = i.columns.splice(V);
171
+ i.columns.length === 0 && i.columns.push(Ye());
172
+ const Se = i.columns[i.columns.length - 1];
173
+ Array.isArray(Se.children) || (Se.children = []), X.forEach((Te) => {
174
+ Array.isArray(Te.children) && Te.children.length > 0 && Se.children.push(...Te.children);
175
+ });
176
+ }
177
+ const K = Math.floor(24 / V);
178
+ i.columns.forEach((X, Se) => {
179
+ X.sort = Se, X.span = K;
180
+ });
181
+ const ae = K * V;
182
+ ae < 24 && i.columns.length > 0 && (i.columns[i.columns.length - 1].span += 24 - ae), i.columnCount = V;
183
+ }
184
+ function ie(i) {
185
+ const $ = Number(i);
186
+ return Number.isFinite($) ? Math.min(4, Math.max(1, Math.round($))) : 2;
187
+ }
188
+ function fe() {
189
+ _e(e.value), x();
190
+ }
191
+ function H(i) {
192
+ e.value.dataSources.push(i), x();
193
+ }
194
+ function L(i) {
195
+ const $ = e.value.dataSources.findIndex((V) => V.id === i);
196
+ $ !== -1 && (e.value.dataSources.splice($, 1), De(e.value).forEach((z) => {
197
+ z.dataSourceId === i && (z.dataSourceId = "");
198
+ }), x());
199
+ }
200
+ function I(i, $) {
201
+ const V = e.value.dataSources.find((z) => z.id === i);
202
+ V && (Object.assign(V, $), x());
203
+ }
204
+ function de(i) {
205
+ e.value.reactions.push(i), x();
206
+ }
207
+ function f(i) {
208
+ const $ = e.value.reactions.findIndex((V) => V.id === i);
209
+ $ !== -1 && (e.value.reactions.splice($, 1), x());
210
+ }
211
+ function T(i, $) {
212
+ const V = e.value.reactions.find((z) => z.id === i);
213
+ V && (Object.assign(V, $), x());
214
+ }
215
+ function ge(i, $) {
216
+ e.value.config && (e.value.config[i] = $, x());
217
+ }
218
+ function ee(i, $) {
219
+ e.value.meta && (e.value.meta[i] = $);
220
+ }
221
+ function Ne(i, $) {
222
+ e.value.dataSourceConfig || (e.value.dataSourceConfig = { dictUrl: "" }), e.value.dataSourceConfig[i] = $, x();
223
+ }
224
+ function Pe(i) {
225
+ const $ = JSON.parse(JSON.stringify(i)), V = qe($);
226
+ V.warnings.length > 0 && console.warn("[FormDesigner] Schema 迁移提示:", V.warnings), e.value = V.schema, l.value = "", A();
227
+ }
228
+ function D() {
229
+ e.value = Ee(), l.value = "", r.value = null, A();
230
+ }
231
+ function J() {
232
+ const i = ot();
233
+ if (i && i.schemaVersion) {
234
+ const $ = qe(i);
235
+ $.warnings.length > 0 && console.warn("[FormDesigner] 草稿迁移提示:", $.warnings), e.value = $.schema;
236
+ } else
237
+ e.value = Ee();
238
+ l.value = "", r.value = null, A();
239
+ }
240
+ function ye() {
241
+ return _e(e.value), tt(e.value), { success: !0 };
242
+ }
243
+ function B() {
244
+ var V;
245
+ _e(e.value);
246
+ const i = Xe(e.value, { mode: "publish" });
247
+ if (!i.valid)
248
+ return { success: !1, errors: i.errors, warnings: i.warnings };
249
+ const $ = ((V = e.value.meta) == null ? void 0 : V.formCode) || "default";
250
+ return at($, e.value), { success: !0, warnings: i.warnings };
251
+ }
252
+ function ml() {
253
+ return Xe(e.value, { mode: "draft" });
254
+ }
255
+ function fl(i) {
256
+ return nt(i);
257
+ }
258
+ function yl(i) {
259
+ g.value = i;
260
+ }
261
+ return {
262
+ // 状态
263
+ schema: e,
264
+ selectedNodeId: l,
265
+ selectedNode: c,
266
+ activePanel: g,
267
+ clipboard: r,
268
+ draggingState: u,
269
+ canvasState: h,
270
+ history: p,
271
+ // 计算
272
+ canUndo: m,
273
+ canRedo: O,
274
+ allFieldNodes: P,
275
+ allFieldProps: C,
276
+ // History
277
+ undo: j,
278
+ redo: U,
279
+ // 节点操作
280
+ selectNode: d,
281
+ clearSelection: S,
282
+ addNodeFromPalette: b,
283
+ deleteNode: w,
284
+ deleteSelectedNode: M,
285
+ copyNode: R,
286
+ pasteNode: a,
287
+ updateNodeProp: Z,
288
+ onDragSortEnd: fe,
289
+ // 数据源
290
+ addDataSource: H,
291
+ removeDataSource: L,
292
+ updateDataSource: I,
293
+ // 联动
294
+ addReaction: de,
295
+ removeReaction: f,
296
+ updateReaction: T,
297
+ // 表单配置
298
+ updateFormConfig: ge,
299
+ updateFormMeta: ee,
300
+ updateDataSourceConfig: Ne,
301
+ // Schema 级
302
+ loadSchema: Pe,
303
+ resetSchema: D,
304
+ initDesigner: J,
305
+ // 保存/发布
306
+ saveDraft: ye,
307
+ publish: B,
308
+ validateDraft: ml,
309
+ getPublishedSchema: fl,
310
+ // 面板
311
+ setActivePanel: yl
312
+ };
313
+ });
314
+ function Ce() {
315
+ const e = document.activeElement;
316
+ if (!e)
317
+ return !1;
318
+ const l = e.tagName.toLowerCase();
319
+ return !!(l === "input" || l === "textarea" || e.getAttribute("contenteditable") === "true" || e.closest(".el-dialog") || e.closest(".el-drawer"));
320
+ }
321
+ function st() {
322
+ const e = se();
323
+ function l(u) {
324
+ const h = u.ctrlKey || u.metaKey;
325
+ if (h && u.key === "z" && !u.shiftKey) {
326
+ if (Ce())
327
+ return;
328
+ u.preventDefault(), e.undo();
329
+ return;
330
+ }
331
+ if (h && u.key === "y") {
332
+ if (Ce())
333
+ return;
334
+ u.preventDefault(), e.redo();
335
+ return;
336
+ }
337
+ if (u.key === "Delete" || u.key === "Backspace") {
338
+ if (Ce())
339
+ return;
340
+ u.preventDefault(), e.deleteSelectedNode();
341
+ return;
342
+ }
343
+ if (h && u.key === "c") {
344
+ if (Ce())
345
+ return;
346
+ u.preventDefault(), e.copyNode();
347
+ return;
348
+ }
349
+ if (h && u.key === "v") {
350
+ if (Ce() || !e.clipboard)
351
+ return;
352
+ u.preventDefault(), e.pasteNode(e.schema.nodes, e.schema.nodes.length);
353
+ return;
354
+ }
355
+ }
356
+ function g() {
357
+ document.addEventListener("keydown", l);
358
+ }
359
+ function r() {
360
+ document.removeEventListener("keydown", l);
361
+ }
362
+ return He(() => g()), _l(() => r()), {
363
+ register: g,
364
+ unregister: r
365
+ };
366
+ }
367
+ const Fe = /* @__PURE__ */ new Set(["addressSelector", "integerUppercase", "linkedSelectList"]);
368
+ function be(e) {
369
+ return " ".repeat(e);
370
+ }
371
+ function rt(e) {
372
+ return !e || e >= 24 ? 100 : Math.round(e / 24 * 1e4) / 100;
373
+ }
374
+ function it(e) {
375
+ const l = e.defaultValue;
376
+ return e.type === "addressSelector" ? el(e, l) : e.type === "linkedSelectList" ? ll(e, l) : l != null && l !== "" ? l : ["checkBox", "file", "dragFile", "imgFile", "daterange", "datetimerange", "cascader", "linkedSelectList"].includes(e.type) ? [] : e.type === "number" || e.type === "floatNum" ? null : "";
377
+ }
378
+ function dt(e) {
379
+ const l = [];
380
+ return Le(e.nodes, (r) => {
381
+ r.nodeType === "field" && r.prop && l.push(r);
382
+ }), l.length === 0 ? "export const formModel = reactive({})" : `export const formModel = reactive({
383
+ ${l.map((r) => {
384
+ const u = it(r);
385
+ return `${be(1)}${r.prop}: ${JSON.stringify(u)}, // ${r.label || r.prop}`;
386
+ }).join(`
387
+ `)}
388
+ })`;
389
+ }
390
+ function dl(e, l, g = 100) {
391
+ const r = [];
392
+ for (const u of e) {
393
+ if (u.nodeType === "title") {
394
+ r.push(`${be(1)}// ── ${u.title || "标题"} ──`);
395
+ continue;
396
+ }
397
+ if (u.nodeType === "grid") {
398
+ for (const h of u.columns || []) {
399
+ const p = rt(h.span), c = dl(h.children || [], l, p);
400
+ r.push(...c);
401
+ }
402
+ continue;
403
+ }
404
+ u.nodeType === "field" && r.push(ct(u, l, g));
405
+ }
406
+ return r;
407
+ }
408
+ function ct(e, l, g) {
409
+ var p;
410
+ const r = [];
411
+ r.push(`prop: ${JSON.stringify(e.prop)}`), r.push(`label: ${JSON.stringify(e.label || e.prop)}`);
412
+ const u = Fe.has(e.type) ? "custom" : e.type;
413
+ if (r.push(`type: ${JSON.stringify(u)}`), Fe.has(e.type) && r.push(`/* 扩展组件 ${e.type}:请在 #${e.prop} 插槽中渲染对应组件 */`), g !== 100 && r.push(`width: ${g}`), e.required && r.push("required: true"), e.disabled && r.push("disabled: true"), e.hidden && r.push("hidden: true"), e.placeholder && r.push(`placeholder: ${JSON.stringify(e.placeholder)}`), e.labelWidth !== void 0 && e.labelWidth !== "" && r.push(`labelWidth: ${JSON.stringify(e.labelWidth)}`), e.props) {
414
+ const c = e.props;
415
+ c.max !== void 0 && c.max !== null && r.push(`max: ${JSON.stringify(c.max)}`), c.rows && r.push(`rows: ${c.rows}`), c.multiple && r.push("multiple: true"), c.decimal !== void 0 && e.type === "floatNum" && r.push(`decimal: ${c.decimal}`), c.fileType && c.fileType.length > 0 && r.push(`fileType: ${JSON.stringify(c.fileType)}`), c.fileSize && r.push(`fileSize: ${c.fileSize}`), c.limit && r.push(`limit: ${c.limit}`), c.format && r.push(`format: ${JSON.stringify(c.format)}`), c.valueFormat && r.push(`valueFormat: ${JSON.stringify(c.valueFormat)}`), c.startPlaceholder && r.push(`placeUp: ${JSON.stringify(c.startPlaceholder)}`), c.endPlaceholder && r.push(`placeEnd: ${JSON.stringify(c.endPlaceholder)}`), c.height && r.push(`height: ${c.height}`);
416
+ }
417
+ if (e.dataSourceId) {
418
+ const c = (l.dataSources || []).find((m) => m.id === e.dataSourceId);
419
+ if (c) {
420
+ if (c.type === "static" && Array.isArray(c.options)) {
421
+ const m = Ue(e.type);
422
+ m && r.push(`${m}: ${JSON.stringify(c.options)}`);
423
+ } else if (c.type === "dict") {
424
+ const m = Ue(e.type), O = ((p = l.dataSourceConfig) == null ? void 0 : p.dictUrl) || "";
425
+ r.push(`// TODO: ${m} → 字典 [${c.dictType}],总接口:${O || "未配置"}`), m && r.push(`${m}: [] /* 字典:${c.dictType} */`);
426
+ } else if (c.type === "api") {
427
+ const m = Ue(e.type);
428
+ r.push(`// TODO: ${m} → API [${c.url || "未配置"}],请从接口加载`), m && r.push(`${m}: [] /* API:${c.url || "未配置"} */`);
429
+ }
430
+ }
431
+ }
432
+ e.type === "custom" && e.componentKey && r.push(`// 自定义组件: ${e.componentKey}`);
433
+ const h = `{ ${r.join(", ")} }`;
434
+ return h.length <= 100 ? `${be(1)}${h},` : `${be(1)}{
435
+ ${r.map((c) => be(2) + c).join(`,
436
+ `)}
437
+ ${be(1)}},`;
438
+ }
439
+ function Ue(e) {
440
+ return {
441
+ select: "select",
442
+ radio: "radio",
443
+ checkBox: "checkBox",
444
+ cascader: "cascader"
445
+ }[e] || null;
446
+ }
447
+ function Le(e, l) {
448
+ if (Array.isArray(e)) {
449
+ for (const g of e)
450
+ if (l(g), g.nodeType === "grid" && Array.isArray(g.columns))
451
+ for (const r of g.columns)
452
+ Le(r.children || [], l);
453
+ }
454
+ }
455
+ function ut(e) {
456
+ var P, C;
457
+ const l = ((P = e == null ? void 0 : e.meta) == null ? void 0 : P.formName) || "未命名表单", g = ((C = e == null ? void 0 : e.meta) == null ? void 0 : C.formCode) || "form", r = (/* @__PURE__ */ new Date()).toLocaleString("zh-CN", { hour12: !1 }), u = [];
458
+ Le((e == null ? void 0 : e.nodes) || [], (x) => {
459
+ x.nodeType === "field" && Fe.has(x.type) && u.push(x);
460
+ });
461
+ const h = u.map(
462
+ (x) => ` * #${x.prop}: ${x.type}(JXYFormExtensionFields)`
463
+ ), p = [
464
+ "/**",
465
+ " * 由 JXY Form Designer 自动生成",
466
+ ` * 表单名称: ${l}`,
467
+ ` * 表单编码: ${g}`,
468
+ ` * 生成时间: ${r}`,
469
+ " *",
470
+ " * 使用方式:",
471
+ " * import { formModel, formCols } from './custom.js'",
472
+ ' * <JXY-form :cols="formCols" :model="formModel" />',
473
+ ...h.length ? [
474
+ " *",
475
+ " * 扩展组件需通过旧 JXYForm 的同名插槽接入:",
476
+ ...h
477
+ ] : [],
478
+ " */",
479
+ "",
480
+ "import { reactive } from 'vue'"
481
+ ].join(`
482
+ `), c = dt(e), m = dl(e.nodes || [], e, 100), O = m.length > 0 ? `export const formCols = [
483
+ ${m.join(`
484
+ `)}
485
+ ]` : "export const formCols = []";
486
+ return [p, "", c, "", O, ""].join(`
487
+ `);
488
+ }
489
+ function pt(e) {
490
+ var p;
491
+ const l = ut(e), g = ((p = e == null ? void 0 : e.meta) == null ? void 0 : p.formCode) || "form", r = new Blob([l], { type: "text/javascript;charset=utf-8" }), u = URL.createObjectURL(r), h = document.createElement("a");
492
+ h.href = u, h.download = `${g}-custom.js`, h.click(), URL.revokeObjectURL(u);
493
+ }
494
+ const mt = { class: "jxy-designer-toolbar" }, ft = { class: "toolbar-left" }, yt = { class: "toolbar-center" }, _t = { class: "toolbar-title" }, ht = { class: "toolbar-right" }, vt = {
495
+ __name: "DesignerToolbar",
496
+ setup(e) {
497
+ const l = se(), g = hl("designerPreview"), r = re(!1), u = re("");
498
+ function h() {
499
+ l.pasteNode(l.schema.nodes, l.schema.nodes.length);
500
+ }
501
+ function p() {
502
+ Ve.confirm("确定清空所有节点和配置吗?此操作不可撤销。", "清空表单", {
503
+ type: "warning"
504
+ }).then(() => {
505
+ l.resetSchema(), le.success("已清空");
506
+ }).catch(() => {
507
+ });
508
+ }
509
+ function c() {
510
+ u.value = "", r.value = !0;
511
+ }
512
+ function m() {
513
+ if (!u.value.trim()) {
514
+ le.warning("请输入 JSON");
515
+ return;
516
+ }
517
+ const d = Vl(u.value);
518
+ if (d.errors.length > 0) {
519
+ le.error("导入失败:" + d.errors[0]);
520
+ return;
521
+ }
522
+ d.warnings.length > 0 && le.warning("导入成功,但有警告:" + d.warnings.join("; ")), l.loadSchema(d.schema), r.value = !1, le.success("导入成功");
523
+ }
524
+ function O() {
525
+ var M, R;
526
+ const d = JSON.stringify(l.schema, null, 2), S = new Blob([d], { type: "application/json" }), b = URL.createObjectURL(S), w = document.createElement("a");
527
+ w.href = b, w.download = `${((R = (M = l.schema) == null ? void 0 : M.meta) == null ? void 0 : R.formCode) || "form"}-schema.json`, w.click(), URL.revokeObjectURL(b), le.success("已导出");
528
+ }
529
+ function P() {
530
+ const d = l.allFieldNodes;
531
+ if (!d || d.length === 0) {
532
+ le.warning("表单中没有字段,无法导出 JS");
533
+ return;
534
+ }
535
+ pt(l.schema), le.success("已导出 JS 文件");
536
+ }
537
+ function C() {
538
+ g && g.open();
539
+ }
540
+ function x() {
541
+ l.saveDraft().success && le.success("草稿已保存");
542
+ }
543
+ function A() {
544
+ var S;
545
+ const d = l.publish();
546
+ d.success ? (S = d.warnings) != null && S.length ? le.warning("发布成功,但有警告:" + d.warnings.slice(0, 3).join("; ")) : le.success("发布成功") : Ve.alert(
547
+ j(d.errors),
548
+ "发布校验失败",
549
+ {
550
+ type: "error",
551
+ dangerouslyUseHTMLString: !0,
552
+ customClass: "jxy-publish-error-box"
553
+ }
554
+ );
555
+ }
556
+ function j(d = []) {
557
+ return `<ol class="jxy-publish-error-list">${d.map((b) => `<li>${U(b)}</li>`).join("")}</ol>`;
558
+ }
559
+ function U(d) {
560
+ return String(d).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
561
+ }
562
+ return (d, S) => {
563
+ var a, k;
564
+ const b = y("el-button"), w = y("el-divider"), M = y("el-input"), R = y("el-dialog");
565
+ return s(), v("div", mt, [
566
+ _("div", ft, [
567
+ t(b, {
568
+ icon: o(Ul),
569
+ disabled: !o(l).canUndo,
570
+ title: "撤销 (Ctrl+Z)",
571
+ onClick: S[0] || (S[0] = (N) => o(l).undo())
572
+ }, null, 8, ["icon", "disabled"]),
573
+ t(b, {
574
+ icon: o(Ol),
575
+ disabled: !o(l).canRedo,
576
+ title: "重做 (Ctrl+Y)",
577
+ onClick: S[1] || (S[1] = (N) => o(l).redo())
578
+ }, null, 8, ["icon", "disabled"]),
579
+ t(w, { direction: "vertical" }),
580
+ t(b, {
581
+ icon: o(ue),
582
+ disabled: !o(l).selectedNodeId,
583
+ title: "删除选中",
584
+ onClick: S[2] || (S[2] = (N) => o(l).deleteSelectedNode())
585
+ }, null, 8, ["icon", "disabled"]),
586
+ t(b, {
587
+ icon: o(we),
588
+ disabled: !o(l).selectedNodeId,
589
+ title: "复制 (Ctrl+C)",
590
+ onClick: S[3] || (S[3] = (N) => o(l).copyNode())
591
+ }, null, 8, ["icon", "disabled"]),
592
+ t(b, {
593
+ icon: o(Al),
594
+ disabled: !o(l).clipboard,
595
+ title: "粘贴 (Ctrl+V)",
596
+ onClick: h
597
+ }, null, 8, ["icon", "disabled"])
598
+ ]),
599
+ _("div", yt, [
600
+ _("span", _t, Y(((k = (a = o(l).schema) == null ? void 0 : a.meta) == null ? void 0 : k.formName) || "表单设计器"), 1)
601
+ ]),
602
+ _("div", ht, [
603
+ t(b, { onClick: p }, {
604
+ default: n(() => [
605
+ F("清空")
606
+ ]),
607
+ _: 1
608
+ }),
609
+ t(b, { onClick: c }, {
610
+ default: n(() => [
611
+ F("导入JSON")
612
+ ]),
613
+ _: 1
614
+ }),
615
+ t(b, { onClick: O }, {
616
+ default: n(() => [
617
+ F("导出JSON")
618
+ ]),
619
+ _: 1
620
+ }),
621
+ t(b, { onClick: P }, {
622
+ default: n(() => [
623
+ F("导出JS")
624
+ ]),
625
+ _: 1
626
+ }),
627
+ t(b, {
628
+ type: "primary",
629
+ onClick: C
630
+ }, {
631
+ default: n(() => [
632
+ F("预览")
633
+ ]),
634
+ _: 1
635
+ }),
636
+ t(b, {
637
+ type: "primary",
638
+ onClick: x
639
+ }, {
640
+ default: n(() => [
641
+ F("保存草稿")
642
+ ]),
643
+ _: 1
644
+ }),
645
+ t(b, {
646
+ type: "primary",
647
+ onClick: A
648
+ }, {
649
+ default: n(() => [
650
+ F("发布")
651
+ ]),
652
+ _: 1
653
+ })
654
+ ]),
655
+ t(R, {
656
+ modelValue: r.value,
657
+ "onUpdate:modelValue": S[6] || (S[6] = (N) => r.value = N),
658
+ title: "导入 JSON",
659
+ width: "600px",
660
+ "destroy-on-close": ""
661
+ }, {
662
+ footer: n(() => [
663
+ t(b, {
664
+ onClick: S[5] || (S[5] = (N) => r.value = !1)
665
+ }, {
666
+ default: n(() => [
667
+ F("取消")
668
+ ]),
669
+ _: 1
670
+ }),
671
+ t(b, {
672
+ type: "primary",
673
+ onClick: m
674
+ }, {
675
+ default: n(() => [
676
+ F("确认导入")
677
+ ]),
678
+ _: 1
679
+ })
680
+ ]),
681
+ default: n(() => [
682
+ t(M, {
683
+ modelValue: u.value,
684
+ "onUpdate:modelValue": S[4] || (S[4] = (N) => u.value = N),
685
+ type: "textarea",
686
+ rows: 12,
687
+ placeholder: "粘贴 JSON schema..."
688
+ }, null, 8, ["modelValue"])
689
+ ]),
690
+ _: 1
691
+ }, 8, ["modelValue"])
692
+ ]);
693
+ };
694
+ }
695
+ }, gt = /* @__PURE__ */ ne(vt, [["__scopeId", "data-v-d6e3dd8d"]]);
696
+ function je() {
697
+ const e = se(), l = {
698
+ name: "jxy-designer",
699
+ pull: "clone",
700
+ put: !1
701
+ }, g = {
702
+ name: "jxy-designer",
703
+ pull: !0,
704
+ put: !0
705
+ };
706
+ function r(C) {
707
+ return Re(C);
708
+ }
709
+ function u(C, x = "canvas") {
710
+ var A, j;
711
+ e.draggingState.isDragging = !0, e.draggingState.sourceType = x, e.draggingState.dragItem = ((j = (A = C.item) == null ? void 0 : A.__draggable_context) == null ? void 0 : j.element) || null;
712
+ }
713
+ function h() {
714
+ e.draggingState.isDragging = !1, e.draggingState.sourceType = "", e.draggingState.dragItem = null, e.onDragSortEnd();
715
+ }
716
+ function p(C) {
717
+ var A;
718
+ const x = (A = C == null ? void 0 : C.added) == null ? void 0 : A.element;
719
+ x && x.id && e.selectNode(x.id);
720
+ }
721
+ function c(C, x) {
722
+ var j, U;
723
+ const A = (j = C == null ? void 0 : C.added) == null ? void 0 : j.element;
724
+ if (A) {
725
+ if (P(A)) {
726
+ m(x == null ? void 0 : x.children, A, (U = C.added) == null ? void 0 : U.newIndex), e.selectNode((x == null ? void 0 : x.id) || ""), le.warning("请勿栅格嵌套");
727
+ return;
728
+ }
729
+ A.id && e.selectNode(A.id);
730
+ }
731
+ }
732
+ function m(C, x, A) {
733
+ var U;
734
+ if (!Array.isArray(C))
735
+ return;
736
+ if (typeof A == "number" && ((U = C[A]) == null ? void 0 : U.id) === x.id) {
737
+ C.splice(A, 1);
738
+ return;
739
+ }
740
+ const j = C.findIndex((d) => (d == null ? void 0 : d.id) === x.id);
741
+ j > -1 && C.splice(j, 1);
742
+ }
743
+ function O(C) {
744
+ var A, j, U, d, S;
745
+ const x = (A = C.draggedContext) == null ? void 0 : A.element;
746
+ if (!x)
747
+ return !0;
748
+ if (P(x)) {
749
+ const b = (j = C.to) == null ? void 0 : j.__draggable_component__;
750
+ if ((((d = (U = C.to) == null ? void 0 : U.dataset) == null ? void 0 : d.parentType) || ((S = b == null ? void 0 : b.$attrs) == null ? void 0 : S["data-parent-type"])) === "grid-column")
751
+ return !1;
752
+ }
753
+ return !0;
754
+ }
755
+ function P(C) {
756
+ return (C == null ? void 0 : C.nodeType) === "grid" || (C == null ? void 0 : C.type) === "grid";
757
+ }
758
+ return {
759
+ paletteGroupOptions: l,
760
+ canvasGroupOptions: g,
761
+ cloneFromPalette: r,
762
+ onDragStart: u,
763
+ onDragEnd: h,
764
+ onCanvasChange: p,
765
+ onGridColumnChange: c,
766
+ onMoveCheck: O
767
+ };
768
+ }
769
+ const bt = { class: "jxy-component-palette" }, kt = { class: "palette-group-title" }, St = ["title"], Ct = { class: "palette-item-label" }, xt = {
770
+ __name: "ComponentPalette",
771
+ setup(e) {
772
+ const { paletteGroupOptions: l, onDragStart: g, onDragEnd: r } = je(), u = Object.freeze({
773
+ ArrowDown: ol,
774
+ Calendar: Il,
775
+ Coin: Fl,
776
+ Document: Rl,
777
+ Edit: zl,
778
+ Finished: Jl,
779
+ Grid: ze,
780
+ List: Ll,
781
+ Location: jl,
782
+ Lock: Ml,
783
+ Memo: Yl,
784
+ Notebook: ql,
785
+ Odometer: Xl,
786
+ Open: Bl,
787
+ Picture: Kl,
788
+ SetUp: Be,
789
+ Share: Hl,
790
+ Tickets: Wl,
791
+ Upload: al,
792
+ UploadFilled: Gl
793
+ });
794
+ function h(p) {
795
+ return Re(p);
796
+ }
797
+ return (p, c) => {
798
+ const m = y("el-icon");
799
+ return s(), v("div", bt, [
800
+ (s(!0), v(q, null, G(o(tl), (O) => (s(), v("div", {
801
+ key: O.groupName,
802
+ class: "palette-group"
803
+ }, [
804
+ _("div", kt, Y(O.groupName), 1),
805
+ t(o(Je), {
806
+ list: O.items,
807
+ group: o(l),
808
+ sort: !1,
809
+ clone: h,
810
+ "item-key": "type",
811
+ class: "palette-item-list",
812
+ onStart: c[0] || (c[0] = (P) => o(g)(P, "palette")),
813
+ onEnd: o(r)
814
+ }, {
815
+ item: n(({ element: P }) => [
816
+ _("div", {
817
+ class: "palette-item",
818
+ title: P.label
819
+ }, [
820
+ t(m, { class: "palette-item-icon" }, {
821
+ default: n(() => [
822
+ (s(), E(We(o(u)[P.icon] || o(Be))))
823
+ ]),
824
+ _: 2
825
+ }, 1024),
826
+ _("span", Ct, Y(P.label), 1)
827
+ ], 8, St)
828
+ ]),
829
+ _: 2
830
+ }, 1032, ["list", "group", "onEnd"])
831
+ ]))), 128))
832
+ ]);
833
+ };
834
+ }
835
+ }, $t = /* @__PURE__ */ ne(xt, [["__scopeId", "data-v-20210c01"]]);
836
+ const Vt = (e) => (he("data-v-5338ecd2"), e = e(), ve(), e), wt = { class: "field-preview" }, Nt = {
837
+ key: 6,
838
+ class: "preview-radio"
839
+ }, Pt = {
840
+ key: 7,
841
+ class: "preview-checkbox"
842
+ }, Tt = {
843
+ key: 8,
844
+ class: "preview-upload"
845
+ }, Et = {
846
+ key: 9,
847
+ class: "preview-editor"
848
+ }, Dt = /* @__PURE__ */ Vt(() => /* @__PURE__ */ _("div", { class: "preview-editor-box" }, "富文本编辑器", -1)), Ut = [
849
+ Dt
850
+ ], Ot = {
851
+ key: 10,
852
+ class: "preview-address"
853
+ }, At = { class: "preview-address-selects" }, It = {
854
+ key: 11,
855
+ class: "preview-integer-uppercase"
856
+ }, Ft = {
857
+ key: 12,
858
+ class: "preview-linked-select"
859
+ }, Rt = {
860
+ key: 13,
861
+ class: "preview-custom"
862
+ }, zt = {
863
+ key: 14,
864
+ class: "preview-unknown"
865
+ }, Jt = {
866
+ __name: "FieldPreview",
867
+ props: {
868
+ node: { type: Object, required: !0 }
869
+ },
870
+ setup(e) {
871
+ const l = e, g = oe(() => ["text", "password"].includes(l.node.type)), r = oe(() => ["date", "month", "year", "daterange", "datetimerange"].includes(l.node.type)), u = oe(() => ["file", "dragFile", "imgFile"].includes(l.node.type)), h = oe(() => ({ date: "date", month: "month", year: "year", daterange: "daterange", datetimerange: "datetimerange" })[l.node.type] || "date");
872
+ return (p, c) => {
873
+ var b, w, M, R, a;
874
+ const m = y("el-input"), O = y("el-input-number"), P = y("el-date-picker"), C = y("el-select"), x = y("el-cascader"), A = y("el-radio"), j = y("el-checkbox"), U = y("el-icon"), d = y("el-button"), S = y("el-tag");
875
+ return s(), v("div", wt, [
876
+ o(g) ? (s(), E(m, {
877
+ key: 0,
878
+ placeholder: e.node.placeholder || "请输入",
879
+ disabled: "",
880
+ size: "small"
881
+ }, null, 8, ["placeholder"])) : e.node.type === "textarea" ? (s(), E(m, {
882
+ key: 1,
883
+ type: "textarea",
884
+ rows: 2,
885
+ placeholder: e.node.placeholder || "请输入",
886
+ disabled: "",
887
+ size: "small"
888
+ }, null, 8, ["placeholder"])) : e.node.type === "number" || e.node.type === "floatNum" ? (s(), E(O, {
889
+ key: 2,
890
+ placeholder: e.node.placeholder,
891
+ disabled: "",
892
+ size: "small",
893
+ controls: !1,
894
+ style: { width: "100%" }
895
+ }, null, 8, ["placeholder"])) : o(r) ? (s(), E(P, {
896
+ key: 3,
897
+ type: o(h),
898
+ placeholder: e.node.placeholder || "请选择",
899
+ disabled: "",
900
+ size: "small",
901
+ style: { width: "100%" }
902
+ }, null, 8, ["type", "placeholder"])) : e.node.type === "select" ? (s(), E(C, {
903
+ key: 4,
904
+ placeholder: e.node.placeholder || "请选择",
905
+ disabled: "",
906
+ size: "small",
907
+ style: { width: "100%" }
908
+ }, null, 8, ["placeholder"])) : e.node.type === "cascader" ? (s(), E(x, {
909
+ key: 5,
910
+ placeholder: e.node.placeholder || "请选择",
911
+ disabled: "",
912
+ size: "small",
913
+ style: { width: "100%" }
914
+ }, null, 8, ["placeholder"])) : e.node.type === "radio" ? (s(), v("div", Nt, [
915
+ t(A, { disabled: "" }, {
916
+ default: n(() => [
917
+ F("选项1")
918
+ ]),
919
+ _: 1
920
+ }),
921
+ t(A, { disabled: "" }, {
922
+ default: n(() => [
923
+ F("选项2")
924
+ ]),
925
+ _: 1
926
+ })
927
+ ])) : e.node.type === "checkBox" ? (s(), v("div", Pt, [
928
+ t(j, { disabled: "" }, {
929
+ default: n(() => [
930
+ F("选项1")
931
+ ]),
932
+ _: 1
933
+ }),
934
+ t(j, { disabled: "" }, {
935
+ default: n(() => [
936
+ F("选项2")
937
+ ]),
938
+ _: 1
939
+ })
940
+ ])) : o(u) ? (s(), v("div", Tt, [
941
+ t(d, {
942
+ size: "small",
943
+ disabled: ""
944
+ }, {
945
+ default: n(() => [
946
+ t(U, null, {
947
+ default: n(() => [
948
+ t(o(al))
949
+ ]),
950
+ _: 1
951
+ }),
952
+ F(" " + Y(e.node.type === "imgFile" ? "上传图片" : "上传文件"), 1)
953
+ ]),
954
+ _: 1
955
+ })
956
+ ])) : e.node.type === "editor" ? (s(), v("div", Et, Ut)) : e.node.type === "addressSelector" ? (s(), v("div", Ot, [
957
+ _("div", At, [
958
+ t(C, {
959
+ disabled: "",
960
+ size: "small",
961
+ placeholder: "省份"
962
+ }),
963
+ t(C, {
964
+ disabled: "",
965
+ size: "small",
966
+ placeholder: "城市"
967
+ }),
968
+ t(C, {
969
+ disabled: "",
970
+ size: "small",
971
+ placeholder: "区县"
972
+ })
973
+ ]),
974
+ t(m, {
975
+ disabled: "",
976
+ size: "small",
977
+ placeholder: ((b = e.node.props) == null ? void 0 : b.detailPlaceholder) || "请输入详细地址"
978
+ }, null, 8, ["placeholder"])
979
+ ])) : e.node.type === "integerUppercase" ? (s(), v("div", It, [
980
+ t(m, {
981
+ disabled: "",
982
+ size: "small",
983
+ placeholder: e.node.placeholder || "请输入整数"
984
+ }, null, 8, ["placeholder"]),
985
+ _("span", null, "壹佰" + Y(((w = e.node.props) == null ? void 0 : w.suffixText) || ""), 1)
986
+ ])) : e.node.type === "linkedSelectList" ? (s(), v("div", Ft, [
987
+ _("div", null, [
988
+ t(C, {
989
+ disabled: "",
990
+ size: "small",
991
+ placeholder: ((M = e.node.props) == null ? void 0 : M.firstPlaceholder) || "请选择一级选项"
992
+ }, null, 8, ["placeholder"]),
993
+ t(C, {
994
+ disabled: "",
995
+ size: "small",
996
+ placeholder: ((R = e.node.props) == null ? void 0 : R.secondPlaceholder) || "请选择二级选项"
997
+ }, null, 8, ["placeholder"])
998
+ ]),
999
+ t(d, {
1000
+ class: Oe(["preview-linked-select-add", `is-${((a = e.node.props) == null ? void 0 : a.addButtonAlign) || "center"}`]),
1001
+ link: "",
1002
+ type: "primary",
1003
+ size: "small",
1004
+ disabled: ""
1005
+ }, {
1006
+ default: n(() => {
1007
+ var k;
1008
+ return [
1009
+ F("+ " + Y(((k = e.node.props) == null ? void 0 : k.addText) || "点击新增"), 1)
1010
+ ];
1011
+ }),
1012
+ _: 1
1013
+ }, 8, ["class"])
1014
+ ])) : e.node.type === "custom" ? (s(), v("div", Rt, [
1015
+ t(S, {
1016
+ size: "small",
1017
+ type: "info"
1018
+ }, {
1019
+ default: n(() => [
1020
+ F(Y(e.node.componentKey || "自定义组件"), 1)
1021
+ ]),
1022
+ _: 1
1023
+ })
1024
+ ])) : (s(), v("div", zt, [
1025
+ t(S, {
1026
+ size: "small",
1027
+ type: "danger"
1028
+ }, {
1029
+ default: n(() => [
1030
+ F(Y(e.node.type), 1)
1031
+ ]),
1032
+ _: 1
1033
+ })
1034
+ ]))
1035
+ ]);
1036
+ };
1037
+ }
1038
+ }, Lt = /* @__PURE__ */ ne(Jt, [["__scopeId", "data-v-5338ecd2"]]);
1039
+ const jt = (e) => (he("data-v-b4ea2b4e"), e = e(), ve(), e), Mt = { class: "canvas-node-actions" }, Yt = {
1040
+ key: 0,
1041
+ class: "canvas-field-node"
1042
+ }, qt = { class: "canvas-field-label" }, Xt = {
1043
+ key: 0,
1044
+ class: "required-mark"
1045
+ }, Bt = { class: "canvas-field-preview" }, Kt = {
1046
+ key: 1,
1047
+ class: "canvas-title-node"
1048
+ }, Ht = {
1049
+ key: 0,
1050
+ class: "canvas-title-desc"
1051
+ }, Wt = {
1052
+ key: 2,
1053
+ class: "canvas-grid-node"
1054
+ }, Gt = { class: "canvas-grid-label" }, Zt = /* @__PURE__ */ jt(() => /* @__PURE__ */ _("span", null, "栅格布局", -1)), Qt = ["onClick"], eo = { class: "col-span-badge" }, lo = {
1055
+ key: 0,
1056
+ class: "col-empty"
1057
+ }, to = {
1058
+ __name: "CanvasNode",
1059
+ props: {
1060
+ node: { type: Object, required: !0 },
1061
+ selected: { type: Boolean, default: !1 }
1062
+ },
1063
+ emits: ["select", "delete", "copy"],
1064
+ setup(e) {
1065
+ const l = se(), { canvasGroupOptions: g, onDragStart: r, onDragEnd: u, onGridColumnChange: h, onMoveCheck: p } = je();
1066
+ return (c, m) => {
1067
+ var A, j;
1068
+ const O = y("el-icon"), P = y("CanvasNode", !0), C = y("el-col"), x = y("el-row");
1069
+ return s(), v("div", {
1070
+ class: Oe(["canvas-node", {
1071
+ "is-selected": e.selected,
1072
+ [`node-type-${e.node.nodeType}`]: !0
1073
+ }]),
1074
+ onClick: m[3] || (m[3] = ce((U) => c.$emit("select"), ["stop"]))
1075
+ }, [
1076
+ vl(_("div", Mt, [
1077
+ t(O, {
1078
+ class: "canvas-node-drag-handle",
1079
+ title: "拖拽移动"
1080
+ }, {
1081
+ default: n(() => [
1082
+ t(o(Zl))
1083
+ ]),
1084
+ _: 1
1085
+ }),
1086
+ t(O, {
1087
+ title: "复制",
1088
+ onClick: m[0] || (m[0] = ce((U) => c.$emit("copy"), ["stop"]))
1089
+ }, {
1090
+ default: n(() => [
1091
+ t(o(we))
1092
+ ]),
1093
+ _: 1
1094
+ }),
1095
+ t(O, {
1096
+ title: "删除",
1097
+ onClick: m[1] || (m[1] = ce((U) => c.$emit("delete"), ["stop"]))
1098
+ }, {
1099
+ default: n(() => [
1100
+ t(o(ue))
1101
+ ]),
1102
+ _: 1
1103
+ })
1104
+ ], 512), [
1105
+ [gl, e.selected]
1106
+ ]),
1107
+ e.node.nodeType === "field" ? (s(), v("div", Yt, [
1108
+ _("div", qt, [
1109
+ e.node.required ? (s(), v("span", Xt, "*")) : W("", !0),
1110
+ F(" " + Y(e.node.label || "未命名字段"), 1)
1111
+ ]),
1112
+ _("div", Bt, [
1113
+ t(Lt, { node: e.node }, null, 8, ["node"])
1114
+ ]),
1115
+ (j = (A = e.node.extensions) == null ? void 0 : A.suffix) != null && j.enabled ? (s(), v("div", {
1116
+ key: 0,
1117
+ class: "canvas-field-suffix-placeholder",
1118
+ style: bl({ width: `${o(et)(e.node, o(l).schema.config)}px` })
1119
+ }, " 扩展位 ", 4)) : W("", !0)
1120
+ ])) : e.node.nodeType === "title" ? (s(), v("div", Kt, [
1121
+ (s(), E(We("h" + (e.node.level || 2)), { class: "canvas-title-text" }, {
1122
+ default: n(() => [
1123
+ F(Y(e.node.title || "未命名标题"), 1)
1124
+ ]),
1125
+ _: 1
1126
+ })),
1127
+ e.node.description ? (s(), v("p", Ht, Y(e.node.description), 1)) : W("", !0)
1128
+ ])) : e.node.nodeType === "grid" ? (s(), v("div", Wt, [
1129
+ _("div", Gt, [
1130
+ t(O, null, {
1131
+ default: n(() => [
1132
+ t(o(ze))
1133
+ ]),
1134
+ _: 1
1135
+ }),
1136
+ Zt
1137
+ ]),
1138
+ t(x, {
1139
+ gutter: e.node.gutter || 16,
1140
+ class: "canvas-grid-row"
1141
+ }, {
1142
+ default: n(() => [
1143
+ (s(!0), v(q, null, G(e.node.columns, (U) => (s(), E(C, {
1144
+ key: U.id,
1145
+ span: U.span
1146
+ }, {
1147
+ default: n(() => [
1148
+ _("div", {
1149
+ class: Oe(["canvas-grid-col", { "col-selected": o(l).selectedNodeId === U.id }]),
1150
+ onClick: ce((d) => o(l).selectNode(U.id), ["stop"])
1151
+ }, [
1152
+ _("div", eo, Y(U.span), 1),
1153
+ t(o(Je), {
1154
+ modelValue: U.children,
1155
+ "onUpdate:modelValue": (d) => U.children = d,
1156
+ group: o(g),
1157
+ "item-key": "id",
1158
+ handle: ".canvas-node-drag-handle",
1159
+ "ghost-class": "canvas-drag-ghost",
1160
+ "chosen-class": "canvas-drag-chosen",
1161
+ class: "canvas-col-children",
1162
+ "data-parent-type": "grid-column",
1163
+ onStart: m[2] || (m[2] = (d) => o(r)(d, "canvas")),
1164
+ onEnd: o(u),
1165
+ onChange: (d) => o(h)(d, U),
1166
+ move: o(p)
1167
+ }, {
1168
+ item: n(({ element: d }) => [
1169
+ t(P, {
1170
+ node: d,
1171
+ selected: o(l).selectedNodeId === d.id,
1172
+ onSelect: (S) => o(l).selectNode(d.id),
1173
+ onDelete: (S) => o(l).deleteNode(d.id),
1174
+ onCopy: (S) => o(l).copyNode(d.id)
1175
+ }, null, 8, ["node", "selected", "onSelect", "onDelete", "onCopy"])
1176
+ ]),
1177
+ _: 2
1178
+ }, 1032, ["modelValue", "onUpdate:modelValue", "group", "onEnd", "onChange", "move"]),
1179
+ !U.children || U.children.length === 0 ? (s(), v("div", lo, " 拖入组件 ")) : W("", !0)
1180
+ ], 10, Qt)
1181
+ ]),
1182
+ _: 2
1183
+ }, 1032, ["span"]))), 128))
1184
+ ]),
1185
+ _: 1
1186
+ }, 8, ["gutter"])
1187
+ ])) : W("", !0)
1188
+ ], 2);
1189
+ };
1190
+ }
1191
+ }, oo = /* @__PURE__ */ ne(to, [["__scopeId", "data-v-b4ea2b4e"]]);
1192
+ const ao = (e) => (he("data-v-face1280"), e = e(), ve(), e), no = { class: "canvas-form-wrapper" }, so = {
1193
+ key: 0,
1194
+ class: "canvas-empty"
1195
+ }, ro = /* @__PURE__ */ ao(() => /* @__PURE__ */ _("p", null, "从左侧拖入组件开始设计", -1)), io = {
1196
+ __name: "DesignerCanvas",
1197
+ setup(e) {
1198
+ const l = se(), { canvasGroupOptions: g, onDragStart: r, onDragEnd: u, onCanvasChange: h, onMoveCheck: p } = je();
1199
+ return (c, m) => {
1200
+ const O = y("el-icon");
1201
+ return s(), v("div", {
1202
+ class: "jxy-designer-canvas",
1203
+ onClick: m[2] || (m[2] = ce((P) => o(l).clearSelection(), ["self"]))
1204
+ }, [
1205
+ _("div", no, [
1206
+ !o(l).schema.nodes || o(l).schema.nodes.length === 0 ? (s(), v("div", so, [
1207
+ t(O, {
1208
+ size: 48,
1209
+ color: "#c0c4cc"
1210
+ }, {
1211
+ default: n(() => [
1212
+ t(o(ze))
1213
+ ]),
1214
+ _: 1
1215
+ }),
1216
+ ro
1217
+ ])) : W("", !0),
1218
+ t(o(Je), {
1219
+ modelValue: o(l).schema.nodes,
1220
+ "onUpdate:modelValue": m[0] || (m[0] = (P) => o(l).schema.nodes = P),
1221
+ group: o(g),
1222
+ "item-key": "id",
1223
+ handle: ".canvas-node-drag-handle",
1224
+ "ghost-class": "canvas-drag-ghost",
1225
+ "chosen-class": "canvas-drag-chosen",
1226
+ class: "canvas-node-list",
1227
+ onStart: m[1] || (m[1] = (P) => o(r)(P, "canvas")),
1228
+ onEnd: o(u),
1229
+ onChange: o(h),
1230
+ move: o(p)
1231
+ }, {
1232
+ item: n(({ element: P }) => [
1233
+ t(oo, {
1234
+ node: P,
1235
+ selected: o(l).selectedNodeId === P.id,
1236
+ onSelect: (C) => o(l).selectNode(P.id),
1237
+ onDelete: (C) => o(l).deleteNode(P.id),
1238
+ onCopy: (C) => o(l).copyNode(P.id)
1239
+ }, null, 8, ["node", "selected", "onSelect", "onDelete", "onCopy"])
1240
+ ]),
1241
+ _: 1
1242
+ }, 8, ["modelValue", "group", "onEnd", "onChange", "move"])
1243
+ ])
1244
+ ]);
1245
+ };
1246
+ }
1247
+ }, co = /* @__PURE__ */ ne(io, [["__scopeId", "data-v-face1280"]]), uo = tl.flatMap((e) => e.items).filter((e) => !e.isLayout).map((e) => ({
1248
+ label: `${e.label}(${e.type})`,
1249
+ value: e.type
1250
+ })), cl = [
1251
+ { key: "prop", label: "字段标识(prop)", type: "text", required: !0, placeholder: "如:userName" },
1252
+ { key: "label", label: "标题", type: "text", required: !0, placeholder: "如:用户名" },
1253
+ { key: "type", label: "组件类型", type: "select", required: !0, options: uo, disabled: !0 },
1254
+ { key: "placeholder", label: "占位文本", type: "text", placeholder: "请输入/请选择" },
1255
+ { key: "defaultValue", label: "默认值", type: "text" },
1256
+ { key: "required", label: "是否必填", type: "switch" },
1257
+ { key: "validations", label: "校验规则", type: "validations" },
1258
+ { key: "disabled", label: "是否禁用", type: "switch" },
1259
+ { key: "hidden", label: "是否隐藏", type: "switch" },
1260
+ { key: "extensions.suffix.enabled", label: "启用右侧扩展位", type: "switch" },
1261
+ { key: "extensions.suffix.width", label: "右侧扩展位宽度(px)", type: "number", placeholder: "留空继承表单配置", min: 0, step: 1, allowEmpty: !0 },
1262
+ { key: "labelWidth", label: "标签宽度", type: "number", placeholder: "留空继承", min: 0, step: 4 },
1263
+ { key: "customClass", label: "自定义样式类", type: "text", placeholder: "CSS class" }
1264
+ ], po = [
1265
+ { key: "props.max", label: "最大长度", type: "number", min: 0 }
1266
+ ], mo = [
1267
+ { key: "props.max", label: "最大长度", type: "number", min: 0 }
1268
+ ], fo = [
1269
+ { key: "props.rows", label: "行数", type: "number", min: 1, max: 20 },
1270
+ { key: "props.max", label: "最大长度", type: "number", min: 0 }
1271
+ ], yo = [
1272
+ { key: "props.max", label: "最大值", type: "number" }
1273
+ ], _o = [
1274
+ { key: "props.max", label: "最大值", type: "number" },
1275
+ { key: "props.decimal", label: "小数位数", type: "number", min: 0, max: 10 }
1276
+ ], ho = [
1277
+ { key: "props.format", label: "显示格式", type: "text", placeholder: "YYYY-MM-DD" },
1278
+ { key: "props.valueFormat", label: "值格式", type: "text", placeholder: "YYYY-MM-DD" }
1279
+ ], vo = [
1280
+ { key: "props.format", label: "显示格式", type: "text", placeholder: "YYYY-MM" },
1281
+ { key: "props.valueFormat", label: "值格式", type: "text", placeholder: "YYYY-MM" }
1282
+ ], go = [
1283
+ { key: "props.format", label: "显示格式", type: "text", placeholder: "YYYY" },
1284
+ { key: "props.valueFormat", label: "值格式", type: "text", placeholder: "YYYY" }
1285
+ ], bo = [
1286
+ { key: "props.format", label: "显示格式", type: "text", placeholder: "YYYY-MM-DD" },
1287
+ { key: "props.valueFormat", label: "值格式", type: "text", placeholder: "YYYY-MM-DD" },
1288
+ { key: "props.startPlaceholder", label: "开始占位", type: "text", placeholder: "开始日期" },
1289
+ { key: "props.endPlaceholder", label: "结束占位", type: "text", placeholder: "结束日期" }
1290
+ ], ko = [
1291
+ { key: "props.format", label: "显示格式", type: "text", placeholder: "YYYY-MM-DD HH:mm:ss" },
1292
+ { key: "props.valueFormat", label: "值格式", type: "text", placeholder: "YYYY-MM-DD HH:mm:ss" },
1293
+ { key: "props.startPlaceholder", label: "开始占位", type: "text", placeholder: "开始时间" },
1294
+ { key: "props.endPlaceholder", label: "结束占位", type: "text", placeholder: "结束时间" }
1295
+ ], So = [
1296
+ { key: "props.multiple", label: "多选", type: "switch" },
1297
+ { key: "props.clearable", label: "可清空", type: "switch" },
1298
+ { key: "dataSourceId", label: "数据源", type: "dataSource" }
1299
+ ], Co = [
1300
+ { key: "props.multiple", label: "多选", type: "switch" },
1301
+ { key: "props.checkStrictly", label: "父子不关联", type: "switch" },
1302
+ { key: "dataSourceId", label: "数据源", type: "dataSource" }
1303
+ ], xo = [
1304
+ { key: "dataSourceId", label: "数据源", type: "dataSource" }
1305
+ ], $o = [
1306
+ { key: "dataSourceId", label: "数据源", type: "dataSource" }
1307
+ ], Ke = [
1308
+ { key: "props.fileType", label: "允许文件类型", type: "tags", placeholder: "如 docx, xlsx, pdf" },
1309
+ { key: "props.fileSize", label: "文件大小限制(MB)", type: "number", min: 0 },
1310
+ { key: "props.limit", label: "最大数量", type: "number", min: 0 }
1311
+ ], Vo = [
1312
+ { key: "props.fileType", label: "允许图片类型", type: "tags", placeholder: "如 jpg, jpeg, png" },
1313
+ { key: "props.fileSize", label: "图片大小限制(MB)", type: "number", min: 0 },
1314
+ { key: "props.limit", label: "最大数量", type: "number", min: 0 }
1315
+ ], wo = [
1316
+ { key: "props.height", label: "编辑器高度", type: "number", min: 100, step: 50 }
1317
+ ], No = [
1318
+ { key: "dataSourceId", label: "行政区数据源", type: "dataSource" },
1319
+ { key: "props.provinceProp", label: "省份字段标识(prop)", type: "text", required: !0 },
1320
+ { key: "props.cityProp", label: "城市字段标识(prop)", type: "text", required: !0 },
1321
+ { key: "props.countyProp", label: "区县字段标识(prop)", type: "text", required: !0 },
1322
+ { key: "props.detailAddressProp", label: "详细地址字段标识(prop)", type: "text", required: !0 },
1323
+ { key: "props.provincePlaceholder", label: "省份占位文本", type: "text" },
1324
+ { key: "props.cityPlaceholder", label: "城市占位文本", type: "text" },
1325
+ { key: "props.countyPlaceholder", label: "区县占位文本", type: "text" },
1326
+ { key: "props.detailPlaceholder", label: "详细地址占位文本", type: "text" },
1327
+ { key: "props.detailRequired", label: "详细地址必填", type: "switch" }
1328
+ ], Po = [
1329
+ { key: "props.suffixText", label: "大写展示后缀", type: "text", placeholder: "如:千瓦" },
1330
+ { key: "props.maxLength", label: "最大位数", type: "number", min: 1, max: 16 }
1331
+ ], To = [
1332
+ { key: "dataSourceId", label: "两级树数据源", type: "dataSource" },
1333
+ { key: "props.parentValueProp", label: "一级值字段标识(prop)", type: "text", required: !0 },
1334
+ { key: "props.childValueProp", label: "二级值字段标识(prop)", type: "text", required: !0 },
1335
+ { key: "props.firstPlaceholder", label: "一级占位文本", type: "text" },
1336
+ { key: "props.secondPlaceholder", label: "二级占位文本", type: "text" },
1337
+ { key: "props.addText", label: "新增按钮文字", type: "text" },
1338
+ { key: "props.minItems", label: "最少行数", type: "number", min: 1, max: 20 },
1339
+ { key: "props.maxItems", label: "最多行数", type: "number", min: 1, max: 20 },
1340
+ { key: "props.allowDuplicate", label: "允许重复选择", type: "switch" },
1341
+ { key: "props.addButtonAlign", label: "新增按钮对齐", type: "select", options: [
1342
+ { label: "左对齐", value: "left" },
1343
+ { label: "居中", value: "center" },
1344
+ { label: "右对齐", value: "right" }
1345
+ ] }
1346
+ ], Eo = [
1347
+ { key: "componentKey", label: "组件标识", type: "text", required: !0, placeholder: "注册名称" },
1348
+ { key: "componentProps", label: "组件参数", type: "json", placeholder: "{}" }
1349
+ ], Do = {
1350
+ text: po,
1351
+ password: mo,
1352
+ textarea: fo,
1353
+ number: yo,
1354
+ floatNum: _o,
1355
+ date: ho,
1356
+ month: vo,
1357
+ year: go,
1358
+ daterange: bo,
1359
+ datetimerange: ko,
1360
+ select: So,
1361
+ cascader: Co,
1362
+ checkBox: $o,
1363
+ radio: xo,
1364
+ file: Ke,
1365
+ dragFile: Ke,
1366
+ // 与 file 共用
1367
+ imgFile: Vo,
1368
+ editor: wo,
1369
+ addressSelector: No,
1370
+ integerUppercase: Po,
1371
+ linkedSelectList: To,
1372
+ custom: Eo
1373
+ }, ul = {
1374
+ addressSelector: [
1375
+ "props.provinceProp",
1376
+ "props.cityProp",
1377
+ "props.countyProp",
1378
+ "props.detailAddressProp"
1379
+ ],
1380
+ linkedSelectList: [
1381
+ "props.parentValueProp",
1382
+ "props.childValueProp"
1383
+ ]
1384
+ }, Uo = {
1385
+ addressSelector: [
1386
+ "props.provincePlaceholder",
1387
+ "props.cityPlaceholder",
1388
+ "props.countyPlaceholder",
1389
+ "props.detailPlaceholder"
1390
+ ],
1391
+ linkedSelectList: [
1392
+ "props.firstPlaceholder",
1393
+ "props.secondPlaceholder"
1394
+ ]
1395
+ };
1396
+ function Oo(e, l) {
1397
+ const g = new Set(ul[e]), r = new Set(Uo[e]), u = l.filter((m) => g.has(m.key)), h = l.filter((m) => r.has(m.key)), p = l.filter((m) => !g.has(m.key) && !r.has(m.key)), c = [];
1398
+ return cl.forEach((m) => {
1399
+ if (m.key !== "defaultValue") {
1400
+ if (m.key === "prop") {
1401
+ c.push(m, ...u);
1402
+ return;
1403
+ }
1404
+ if (m.key === "placeholder") {
1405
+ c.push(...h);
1406
+ return;
1407
+ }
1408
+ c.push(m);
1409
+ }
1410
+ }), [...c, ...p];
1411
+ }
1412
+ const Ao = [
1413
+ { key: "title", label: "标题文本", type: "text", required: !0 },
1414
+ { key: "description", label: "描述", type: "textarea" },
1415
+ { key: "level", label: "标题级别", type: "select", options: [
1416
+ { label: "H1", value: 1 },
1417
+ { label: "H2", value: 2 },
1418
+ { label: "H3", value: 3 },
1419
+ { label: "H4", value: 4 }
1420
+ ] },
1421
+ { key: "customClass", label: "自定义样式类", type: "text" }
1422
+ ], Io = [
1423
+ { key: "columnCount", label: "列数", type: "number", min: 1, max: 4, step: 1 },
1424
+ { key: "gutter", label: "栅格间距", type: "number", min: 0, max: 48, step: 4 },
1425
+ { key: "labelWidth", label: "标签宽度", type: "number", placeholder: "留空继承", min: 0, step: 4 },
1426
+ { key: "customClass", label: "自定义样式类", type: "text" }
1427
+ ], Fo = [
1428
+ { key: "span", label: "栅格宽度", type: "number", min: 1, max: 24, step: 1, required: !0 },
1429
+ { key: "labelWidth", label: "标签宽度", type: "number", placeholder: "留空继承", min: 0, step: 4 },
1430
+ { key: "customClass", label: "自定义样式类", type: "text" }
1431
+ ], Ro = [
1432
+ { key: "labelPosition", label: "标签位置", type: "select", options: [
1433
+ { label: "右对齐", value: "right" },
1434
+ { label: "左对齐", value: "left" },
1435
+ { label: "顶部", value: "top" }
1436
+ ] },
1437
+ { key: "labelWidth", label: "默认标签宽度", type: "number", min: 0, step: 4 },
1438
+ { key: "suffixWidth", label: "右侧扩展位宽度(px)", type: "number", min: 0, step: 1 },
1439
+ { key: "size", label: "组件尺寸", type: "select", options: [
1440
+ { label: "默认", value: "default" },
1441
+ { label: "大", value: "large" },
1442
+ { label: "小", value: "small" }
1443
+ ] },
1444
+ { key: "gutter", label: "默认栅格间距", type: "number", min: 0, max: 48, step: 4 },
1445
+ { key: "disabled", label: "全表单禁用", type: "switch" },
1446
+ { key: "customClass", label: "自定义样式类", type: "text" }
1447
+ ];
1448
+ function zo(e) {
1449
+ if (!e)
1450
+ return [];
1451
+ if (e.nodeType === "field") {
1452
+ const l = Do[e.type] || [];
1453
+ return ul[e.type] ? Oo(e.type, l) : [...cl.filter((r) => r.key !== "defaultValue" ? !0 : !["addressSelector", "linkedSelectList"].includes(e.type)), ...l];
1454
+ }
1455
+ return e.nodeType === "title" ? [...Ao] : e.nodeType === "grid" ? [...Io] : e.span !== void 0 && e.children !== void 0 ? [...Fo] : [];
1456
+ }
1457
+ const Jo = (e) => (he("data-v-8cb9e83e"), e = e(), ve(), e), Lo = { class: "jxy-props-panel" }, jo = {
1458
+ key: 0,
1459
+ class: "props-empty"
1460
+ }, Mo = /* @__PURE__ */ Jo(() => /* @__PURE__ */ _("p", null, "请在画布中选择一个组件", -1)), Yo = [
1461
+ Mo
1462
+ ], qo = {
1463
+ key: 1,
1464
+ class: "props-form"
1465
+ }, Xo = { class: "props-node-type" }, Bo = { class: "props-node-id" }, Ko = { class: "props-switch-row" }, Ho = { class: "props-switch-label" }, Wo = { class: "validation-editor" }, Go = { class: "validation-main-row" }, Zo = {
1466
+ __name: "PropsPanel",
1467
+ setup(e) {
1468
+ const l = se(), g = oe(() => {
1469
+ const a = l.selectedNode;
1470
+ return a ? a.nodeType === "field" ? a.type || "field" : a.nodeType === "title" ? "标题" : a.nodeType === "grid" ? "栅格" : a.span !== void 0 ? "列" : a.nodeType || "未知" : "";
1471
+ }), r = oe(() => zo(l.selectedNode)), u = oe(() => {
1472
+ const a = l.selectedNode;
1473
+ return !a || a.nodeType !== "field" ? [] : (Array.isArray(a.validations) || (a.validations = []), a.validations);
1474
+ }), h = [
1475
+ { label: "正则", value: "pattern" },
1476
+ { label: "最小长度", value: "minLength" },
1477
+ { label: "最大长度", value: "maxLength" },
1478
+ { label: "最小值", value: "min" },
1479
+ { label: "最大值", value: "max" },
1480
+ { label: "邮箱", value: "email" },
1481
+ { label: "URL", value: "url" }
1482
+ ];
1483
+ function p(a, k) {
1484
+ if (!a || !k)
1485
+ return;
1486
+ const N = k.split(".");
1487
+ let Z = a;
1488
+ for (const Q of N) {
1489
+ if (Z == null)
1490
+ return;
1491
+ Z = Z[Q];
1492
+ }
1493
+ return Z;
1494
+ }
1495
+ function c(a, k) {
1496
+ const N = p(a, k.key);
1497
+ if (k.key === "columnCount" && (N == null || N === ""))
1498
+ return Array.isArray(a == null ? void 0 : a.columns) ? a.columns.length : 2;
1499
+ if (!((k.allowEmpty || k.key.endsWith("labelWidth")) && (N === "" || N === null)))
1500
+ return N;
1501
+ }
1502
+ function m(a, k) {
1503
+ const N = a.allowEmpty || a.key.endsWith("labelWidth");
1504
+ l.updateNodeProp(a.key, N && k == null ? "" : k);
1505
+ }
1506
+ async function O() {
1507
+ var k;
1508
+ const a = (k = l.selectedNode) == null ? void 0 : k.id;
1509
+ if (a)
1510
+ try {
1511
+ await navigator.clipboard.writeText(a), le.success("节点 ID 已复制");
1512
+ } catch {
1513
+ le.error("复制失败,请手动复制");
1514
+ }
1515
+ }
1516
+ function P(a) {
1517
+ return Array.isArray(a) ? a.join(", ") : "";
1518
+ }
1519
+ function C(a) {
1520
+ return a ? a.split(/[,,\s]+/).filter(Boolean).map((k) => k.trim()) : [];
1521
+ }
1522
+ function x(a) {
1523
+ if (a == null)
1524
+ return "";
1525
+ try {
1526
+ return JSON.stringify(a, null, 2);
1527
+ } catch {
1528
+ return "";
1529
+ }
1530
+ }
1531
+ function A(a, k) {
1532
+ try {
1533
+ const N = JSON.parse(k);
1534
+ l.updateNodeProp(a, N);
1535
+ } catch {
1536
+ }
1537
+ }
1538
+ function j() {
1539
+ const a = l.selectedNode;
1540
+ !a || a.nodeType !== "field" || (Array.isArray(a.validations) || (a.validations = []), a.validations.push({
1541
+ type: "email",
1542
+ value: "",
1543
+ message: "",
1544
+ trigger: "blur"
1545
+ }), R());
1546
+ }
1547
+ function U(a) {
1548
+ const k = l.selectedNode;
1549
+ !k || !Array.isArray(k.validations) || (k.validations.splice(a, 1), R());
1550
+ }
1551
+ function d(a) {
1552
+ w(a.type) ? M(a.type) && (a.value === "" || a.value === void 0 || a.value === null) && (a.value = 0) : a.value = "", R();
1553
+ }
1554
+ function S(a) {
1555
+ return Array.isArray(a) ? a.includes("blur") && a.includes("change") ? "both" : a[0] || "blur" : a || "blur";
1556
+ }
1557
+ function b(a, k) {
1558
+ a.trigger = k === "both" ? ["change", "blur"] : k, R();
1559
+ }
1560
+ function w(a) {
1561
+ return ["pattern", "minLength", "maxLength", "min", "max"].includes(a);
1562
+ }
1563
+ function M(a) {
1564
+ return ["minLength", "maxLength", "min", "max"].includes(a);
1565
+ }
1566
+ function R() {
1567
+ l.onDragSortEnd();
1568
+ }
1569
+ return (a, k) => {
1570
+ const N = y("el-tag"), Z = y("el-button"), Q = y("el-input"), te = y("el-form-item"), ie = y("el-input-number"), fe = y("el-switch"), H = y("el-option"), L = y("el-select"), I = y("el-icon"), de = y("el-form");
1571
+ return s(), v("div", Lo, [
1572
+ o(l).selectedNode ? (s(), v("div", qo, [
1573
+ _("div", Xo, [
1574
+ t(N, { size: "small" }, {
1575
+ default: n(() => [
1576
+ F(Y(o(g)), 1)
1577
+ ]),
1578
+ _: 1
1579
+ }),
1580
+ _("span", Bo, Y(o(l).selectedNode.id), 1),
1581
+ t(Z, {
1582
+ class: "props-node-copy",
1583
+ text: "",
1584
+ size: "small",
1585
+ icon: o(we),
1586
+ title: "复制节点 ID",
1587
+ onClick: O
1588
+ }, null, 8, ["icon"])
1589
+ ]),
1590
+ t(de, {
1591
+ "label-position": "top",
1592
+ size: "small",
1593
+ class: "props-field-list"
1594
+ }, {
1595
+ default: n(() => [
1596
+ (s(!0), v(q, null, G(o(r), (f) => (s(), v(q, {
1597
+ key: f.key
1598
+ }, [
1599
+ f.type === "text" ? (s(), E(te, {
1600
+ key: 0,
1601
+ label: f.label,
1602
+ required: f.required
1603
+ }, {
1604
+ default: n(() => [
1605
+ t(Q, {
1606
+ "model-value": p(o(l).selectedNode, f.key),
1607
+ placeholder: f.placeholder,
1608
+ disabled: f.disabled,
1609
+ "onUpdate:modelValue": (T) => o(l).updateNodeProp(f.key, T)
1610
+ }, null, 8, ["model-value", "placeholder", "disabled", "onUpdate:modelValue"])
1611
+ ]),
1612
+ _: 2
1613
+ }, 1032, ["label", "required"])) : f.type === "textarea" ? (s(), E(te, {
1614
+ key: 1,
1615
+ label: f.label
1616
+ }, {
1617
+ default: n(() => [
1618
+ t(Q, {
1619
+ type: "textarea",
1620
+ rows: 3,
1621
+ "model-value": p(o(l).selectedNode, f.key),
1622
+ placeholder: f.placeholder,
1623
+ "onUpdate:modelValue": (T) => o(l).updateNodeProp(f.key, T)
1624
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1625
+ ]),
1626
+ _: 2
1627
+ }, 1032, ["label"])) : f.type === "number" ? (s(), E(te, {
1628
+ key: 2,
1629
+ label: f.label
1630
+ }, {
1631
+ default: n(() => [
1632
+ t(ie, {
1633
+ "model-value": c(o(l).selectedNode, f),
1634
+ min: f.min,
1635
+ max: f.max,
1636
+ step: f.step || 1,
1637
+ placeholder: f.placeholder,
1638
+ "controls-position": "right",
1639
+ style: { width: "100%" },
1640
+ "onUpdate:modelValue": (T) => m(f, T)
1641
+ }, null, 8, ["model-value", "min", "max", "step", "placeholder", "onUpdate:modelValue"])
1642
+ ]),
1643
+ _: 2
1644
+ }, 1032, ["label"])) : f.type === "switch" ? (s(), E(te, {
1645
+ key: 3,
1646
+ class: "props-switch-form-item"
1647
+ }, {
1648
+ default: n(() => [
1649
+ _("div", Ko, [
1650
+ _("span", Ho, Y(f.label), 1),
1651
+ t(fe, {
1652
+ "model-value": p(o(l).selectedNode, f.key),
1653
+ "onUpdate:modelValue": (T) => o(l).updateNodeProp(f.key, T)
1654
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
1655
+ ])
1656
+ ]),
1657
+ _: 2
1658
+ }, 1024)) : f.type === "validations" ? (s(), E(te, {
1659
+ key: 4,
1660
+ label: f.label
1661
+ }, {
1662
+ default: n(() => [
1663
+ _("div", Wo, [
1664
+ (s(!0), v(q, null, G(o(u), (T, ge) => (s(), v("div", {
1665
+ key: ge,
1666
+ class: "validation-row"
1667
+ }, [
1668
+ _("div", Go, [
1669
+ t(L, {
1670
+ modelValue: T.type,
1671
+ "onUpdate:modelValue": (ee) => T.type = ee,
1672
+ size: "small",
1673
+ class: "validation-type",
1674
+ onChange: () => d(T)
1675
+ }, {
1676
+ default: n(() => [
1677
+ (s(), v(q, null, G(h, (ee) => t(H, {
1678
+ key: ee.value,
1679
+ label: ee.label,
1680
+ value: ee.value
1681
+ }, null, 8, ["label", "value"])), 64))
1682
+ ]),
1683
+ _: 2
1684
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
1685
+ M(T.type) ? (s(), E(ie, {
1686
+ key: 0,
1687
+ modelValue: T.value,
1688
+ "onUpdate:modelValue": (ee) => T.value = ee,
1689
+ size: "small",
1690
+ class: "validation-value",
1691
+ "controls-position": "right",
1692
+ onChange: R
1693
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : w(T.type) ? (s(), E(Q, {
1694
+ key: 1,
1695
+ modelValue: T.value,
1696
+ "onUpdate:modelValue": (ee) => T.value = ee,
1697
+ size: "small",
1698
+ class: "validation-value",
1699
+ placeholder: "规则值",
1700
+ onChange: R
1701
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : W("", !0),
1702
+ t(L, {
1703
+ "model-value": S(T.trigger),
1704
+ size: "small",
1705
+ class: "validation-trigger",
1706
+ "onUpdate:modelValue": (ee) => b(T, ee)
1707
+ }, {
1708
+ default: n(() => [
1709
+ t(H, {
1710
+ label: "失焦",
1711
+ value: "blur"
1712
+ }),
1713
+ t(H, {
1714
+ label: "变化",
1715
+ value: "change"
1716
+ }),
1717
+ t(H, {
1718
+ label: "变化和失焦",
1719
+ value: "both"
1720
+ })
1721
+ ]),
1722
+ _: 2
1723
+ }, 1032, ["model-value", "onUpdate:modelValue"]),
1724
+ t(I, {
1725
+ class: "validation-delete",
1726
+ title: "删除规则",
1727
+ onClick: (ee) => U(ge)
1728
+ }, {
1729
+ default: n(() => [
1730
+ t(o(ue))
1731
+ ]),
1732
+ _: 2
1733
+ }, 1032, ["onClick"])
1734
+ ]),
1735
+ t(Q, {
1736
+ modelValue: T.message,
1737
+ "onUpdate:modelValue": (ee) => T.message = ee,
1738
+ size: "small",
1739
+ placeholder: "校验失败提示",
1740
+ onChange: R
1741
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
1742
+ ]))), 128)),
1743
+ t(Z, {
1744
+ size: "small",
1745
+ icon: o(Ae),
1746
+ onClick: j
1747
+ }, {
1748
+ default: n(() => [
1749
+ F("添加校验规则")
1750
+ ]),
1751
+ _: 1
1752
+ }, 8, ["icon"])
1753
+ ])
1754
+ ]),
1755
+ _: 2
1756
+ }, 1032, ["label"])) : f.type === "select" ? (s(), E(te, {
1757
+ key: 5,
1758
+ label: f.label,
1759
+ required: f.required
1760
+ }, {
1761
+ default: n(() => [
1762
+ t(L, {
1763
+ "model-value": p(o(l).selectedNode, f.key),
1764
+ disabled: f.disabled,
1765
+ style: { width: "100%" },
1766
+ "onUpdate:modelValue": (T) => o(l).updateNodeProp(f.key, T)
1767
+ }, {
1768
+ default: n(() => [
1769
+ (s(!0), v(q, null, G(f.options, (T) => (s(), E(H, {
1770
+ key: T.value,
1771
+ label: T.label,
1772
+ value: T.value
1773
+ }, null, 8, ["label", "value"]))), 128))
1774
+ ]),
1775
+ _: 2
1776
+ }, 1032, ["model-value", "disabled", "onUpdate:modelValue"])
1777
+ ]),
1778
+ _: 2
1779
+ }, 1032, ["label", "required"])) : f.type === "dataSource" ? (s(), E(te, {
1780
+ key: 6,
1781
+ label: f.label
1782
+ }, {
1783
+ default: n(() => [
1784
+ t(L, {
1785
+ "model-value": p(o(l).selectedNode, f.key),
1786
+ placeholder: "选择数据源",
1787
+ clearable: "",
1788
+ style: { width: "100%" },
1789
+ "onUpdate:modelValue": (T) => o(l).updateNodeProp(f.key, T)
1790
+ }, {
1791
+ default: n(() => [
1792
+ (s(!0), v(q, null, G(o(l).schema.dataSources, (T) => (s(), E(H, {
1793
+ key: T.id,
1794
+ label: T.name || T.id,
1795
+ value: T.id
1796
+ }, null, 8, ["label", "value"]))), 128))
1797
+ ]),
1798
+ _: 2
1799
+ }, 1032, ["model-value", "onUpdate:modelValue"])
1800
+ ]),
1801
+ _: 2
1802
+ }, 1032, ["label"])) : f.type === "tags" ? (s(), E(te, {
1803
+ key: 7,
1804
+ label: f.label
1805
+ }, {
1806
+ default: n(() => [
1807
+ t(Q, {
1808
+ "model-value": P(p(o(l).selectedNode, f.key)),
1809
+ placeholder: f.placeholder,
1810
+ "onUpdate:modelValue": (T) => o(l).updateNodeProp(f.key, C(T))
1811
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1812
+ ]),
1813
+ _: 2
1814
+ }, 1032, ["label"])) : f.type === "json" ? (s(), E(te, {
1815
+ key: 8,
1816
+ label: f.label
1817
+ }, {
1818
+ default: n(() => [
1819
+ t(Q, {
1820
+ type: "textarea",
1821
+ rows: 3,
1822
+ "model-value": x(p(o(l).selectedNode, f.key)),
1823
+ placeholder: f.placeholder,
1824
+ "onUpdate:modelValue": (T) => A(f.key, T)
1825
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1826
+ ]),
1827
+ _: 2
1828
+ }, 1032, ["label"])) : W("", !0)
1829
+ ], 64))), 128))
1830
+ ]),
1831
+ _: 1
1832
+ })
1833
+ ])) : (s(), v("div", jo, Yo))
1834
+ ]);
1835
+ };
1836
+ }
1837
+ }, Qo = /* @__PURE__ */ ne(Zo, [["__scopeId", "data-v-8cb9e83e"]]);
1838
+ const pe = (e) => (he("data-v-a3a65c84"), e = e(), ve(), e), ea = { class: "jxy-datasource-panel" }, la = { class: "panel-header" }, ta = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", null, "数据源列表", -1)), oa = {
1839
+ key: 0,
1840
+ class: "ds-empty"
1841
+ }, aa = { class: "ds-item-title" }, na = {
1842
+ key: 1,
1843
+ class: "tree-options-editor"
1844
+ }, sa = {
1845
+ key: 0,
1846
+ class: "tree-options-error"
1847
+ }, ra = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("div", { class: "tree-options-tip" }, "地址选择需要三级 children,关联选择列表需要两级 children。", -1)), ia = {
1848
+ key: 0,
1849
+ class: "legacy-api-tip"
1850
+ }, da = { class: "api-params-wrap" }, ca = {
1851
+ key: 0,
1852
+ class: "api-param-header"
1853
+ }, ua = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", { class: "param-col-key" }, "参数名", -1)), pa = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", { class: "param-col-type" }, "取值类型", -1)), ma = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", { class: "param-col-source" }, "来源", -1)), fa = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", { class: "param-col-req" }, "必需", -1)), ya = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", { class: "param-col-del" }, null, -1)), _a = [
1854
+ ua,
1855
+ pa,
1856
+ ma,
1857
+ fa,
1858
+ ya
1859
+ ], ha = { class: "api-param-tip" }, va = /* @__PURE__ */ pe(() => /* @__PURE__ */ _("span", null, "取值类型为「字段」时,参数值从表单字段实时读取;勾选「必需」则该字段为空时不发起请求。", -1)), ga = {
1860
+ __name: "DataSourcePanel",
1861
+ setup(e) {
1862
+ const l = se(), g = re([]), r = ke({}), u = ke({}), h = ke({});
1863
+ function p(a) {
1864
+ return { static: "", dict: "success", api: "warning" }[a] || "info";
1865
+ }
1866
+ function c(a) {
1867
+ const N = { static: Nl, dict: Pl, api: Tl }[a]();
1868
+ N.name = `新${a === "static" ? "静态" : a === "dict" ? "字典" : "API"}数据源`, l.addDataSource(N), g.value.push(N.id);
1869
+ }
1870
+ function m(a) {
1871
+ Ve.confirm("删除此数据源?引用它的字段将被清除绑定。", "确认", { type: "warning" }).then(() => l.removeDataSource(a)).catch(() => {
1872
+ });
1873
+ }
1874
+ function O(a) {
1875
+ a.options.push({ label: "", value: "", disabled: !1 }), w();
1876
+ }
1877
+ function P(a, k) {
1878
+ a.options.splice(k, 1), w();
1879
+ }
1880
+ function C(a) {
1881
+ return Array.isArray(a) && a.some((k) => Array.isArray(k == null ? void 0 : k.children));
1882
+ }
1883
+ function x(a) {
1884
+ return r[a.id] || (C(a.options) ? "tree" : "flat");
1885
+ }
1886
+ function A(a, k) {
1887
+ r[a.id] = k, k === "tree" && (u[a.id] = JSON.stringify(a.options || [], null, 2));
1888
+ }
1889
+ function j(a) {
1890
+ return u[a.id] === void 0 && (u[a.id] = JSON.stringify(a.options || [], null, 2)), u[a.id];
1891
+ }
1892
+ function U(a, k) {
1893
+ u[a.id] = k, h[a.id] = "";
1894
+ }
1895
+ function d(a, k) {
1896
+ try {
1897
+ const N = JSON.parse(k);
1898
+ if (!Array.isArray(N))
1899
+ throw new Error("根节点必须是数组");
1900
+ a.options = N, u[a.id] = JSON.stringify(N, null, 2), h[a.id] = "", w();
1901
+ } catch (N) {
1902
+ h[a.id] = `JSON 无效:${N.message}`;
1903
+ }
1904
+ }
1905
+ function S(a) {
1906
+ Array.isArray(a.params) || (a.params = []), a.params.push(wl()), w();
1907
+ }
1908
+ function b(a, k) {
1909
+ a.params.splice(k, 1), w();
1910
+ }
1911
+ function w() {
1912
+ l.onDragSortEnd();
1913
+ }
1914
+ function M(a) {
1915
+ if (!a)
1916
+ return "";
1917
+ const k = Ie(a);
1918
+ return k.valid ? "" : k.message;
1919
+ }
1920
+ function R(a) {
1921
+ Ie(a.url, { required: !0 }).valid && a.apiKey && delete a.apiKey, w();
1922
+ }
1923
+ return (a, k) => {
1924
+ const N = y("el-icon"), Z = y("el-button"), Q = y("el-dropdown-item"), te = y("el-dropdown-menu"), ie = y("el-dropdown"), fe = y("el-tag"), H = y("el-input"), L = y("el-form-item"), I = y("el-radio-button"), de = y("el-radio-group"), f = y("el-option"), T = y("el-select"), ge = y("el-checkbox"), ee = y("el-form"), Ne = y("el-collapse-item"), Pe = y("el-collapse");
1925
+ return s(), v("div", ea, [
1926
+ _("div", la, [
1927
+ ta,
1928
+ t(ie, { onCommand: c }, {
1929
+ dropdown: n(() => [
1930
+ t(te, null, {
1931
+ default: n(() => [
1932
+ t(Q, { command: "static" }, {
1933
+ default: n(() => [
1934
+ F("静态选项")
1935
+ ]),
1936
+ _: 1
1937
+ }),
1938
+ t(Q, { command: "dict" }, {
1939
+ default: n(() => [
1940
+ F("字典")
1941
+ ]),
1942
+ _: 1
1943
+ }),
1944
+ t(Q, { command: "api" }, {
1945
+ default: n(() => [
1946
+ F("API")
1947
+ ]),
1948
+ _: 1
1949
+ })
1950
+ ]),
1951
+ _: 1
1952
+ })
1953
+ ]),
1954
+ default: n(() => [
1955
+ t(Z, {
1956
+ size: "small",
1957
+ type: "primary"
1958
+ }, {
1959
+ default: n(() => [
1960
+ F(" 添加"),
1961
+ t(N, { class: "el-icon--right" }, {
1962
+ default: n(() => [
1963
+ t(o(ol))
1964
+ ]),
1965
+ _: 1
1966
+ })
1967
+ ]),
1968
+ _: 1
1969
+ })
1970
+ ]),
1971
+ _: 1
1972
+ })
1973
+ ]),
1974
+ o(l).schema.dataSources.length === 0 ? (s(), v("div", oa, " 暂无数据源 ")) : W("", !0),
1975
+ t(Pe, {
1976
+ modelValue: g.value,
1977
+ "onUpdate:modelValue": k[0] || (k[0] = (D) => g.value = D),
1978
+ class: "ds-list"
1979
+ }, {
1980
+ default: n(() => [
1981
+ (s(!0), v(q, null, G(o(l).schema.dataSources, (D) => (s(), E(Ne, {
1982
+ key: D.id,
1983
+ name: D.id
1984
+ }, {
1985
+ title: n(() => [
1986
+ _("div", aa, [
1987
+ t(fe, {
1988
+ size: "small",
1989
+ type: p(D.type)
1990
+ }, {
1991
+ default: n(() => [
1992
+ F(Y(D.type), 1)
1993
+ ]),
1994
+ _: 2
1995
+ }, 1032, ["type"]),
1996
+ _("span", null, Y(D.name || D.id), 1),
1997
+ t(N, {
1998
+ class: "ds-delete-btn",
1999
+ onClick: ce((J) => m(D.id), ["stop"])
2000
+ }, {
2001
+ default: n(() => [
2002
+ t(o(ue))
2003
+ ]),
2004
+ _: 2
2005
+ }, 1032, ["onClick"])
2006
+ ])
2007
+ ]),
2008
+ default: n(() => [
2009
+ t(ee, {
2010
+ "label-position": "top",
2011
+ size: "small"
2012
+ }, {
2013
+ default: n(() => [
2014
+ t(L, { label: "名称" }, {
2015
+ default: n(() => [
2016
+ t(H, {
2017
+ modelValue: D.name,
2018
+ "onUpdate:modelValue": (J) => D.name = J,
2019
+ placeholder: "数据源名称",
2020
+ onChange: w
2021
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
2022
+ ]),
2023
+ _: 2
2024
+ }, 1024),
2025
+ D.type === "static" ? (s(), E(L, {
2026
+ key: 0,
2027
+ label: "选项列表"
2028
+ }, {
2029
+ default: n(() => [
2030
+ t(de, {
2031
+ "model-value": x(D),
2032
+ size: "small",
2033
+ class: "static-editor-mode",
2034
+ "onUpdate:modelValue": (J) => A(D, J)
2035
+ }, {
2036
+ default: n(() => [
2037
+ t(I, { label: "flat" }, {
2038
+ default: n(() => [
2039
+ F("平铺选项")
2040
+ ]),
2041
+ _: 1
2042
+ }),
2043
+ t(I, { label: "tree" }, {
2044
+ default: n(() => [
2045
+ F("树形 JSON")
2046
+ ]),
2047
+ _: 1
2048
+ })
2049
+ ]),
2050
+ _: 2
2051
+ }, 1032, ["model-value", "onUpdate:modelValue"]),
2052
+ x(D) === "flat" ? (s(), v(q, { key: 0 }, [
2053
+ (s(!0), v(q, null, G(D.options, (J, ye) => (s(), v("div", {
2054
+ key: ye,
2055
+ class: "static-option-row"
2056
+ }, [
2057
+ t(H, {
2058
+ modelValue: J.label,
2059
+ "onUpdate:modelValue": (B) => J.label = B,
2060
+ placeholder: "显示文本",
2061
+ onChange: w
2062
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
2063
+ t(H, {
2064
+ modelValue: J.value,
2065
+ "onUpdate:modelValue": (B) => J.value = B,
2066
+ placeholder: "值",
2067
+ onChange: w
2068
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
2069
+ t(N, {
2070
+ class: "opt-delete",
2071
+ onClick: (B) => P(D, ye)
2072
+ }, {
2073
+ default: n(() => [
2074
+ t(o(ue))
2075
+ ]),
2076
+ _: 2
2077
+ }, 1032, ["onClick"])
2078
+ ]))), 128)),
2079
+ t(Z, {
2080
+ size: "small",
2081
+ onClick: (J) => O(D)
2082
+ }, {
2083
+ default: n(() => [
2084
+ F("添加选项")
2085
+ ]),
2086
+ _: 2
2087
+ }, 1032, ["onClick"])
2088
+ ], 64)) : (s(), v("div", na, [
2089
+ t(H, {
2090
+ type: "textarea",
2091
+ rows: 10,
2092
+ "model-value": j(D),
2093
+ placeholder: '[{ "label": "一级", "value": "1", "children": [] }]',
2094
+ "onUpdate:modelValue": (J) => U(D, J),
2095
+ onChange: (J) => d(D, J)
2096
+ }, null, 8, ["model-value", "onUpdate:modelValue", "onChange"]),
2097
+ h[D.id] ? (s(), v("div", sa, Y(h[D.id]), 1)) : W("", !0),
2098
+ ra
2099
+ ]))
2100
+ ]),
2101
+ _: 2
2102
+ }, 1024)) : W("", !0),
2103
+ D.type === "dict" ? (s(), E(L, {
2104
+ key: 1,
2105
+ label: "字典类型"
2106
+ }, {
2107
+ default: n(() => [
2108
+ t(H, {
2109
+ modelValue: D.dictType,
2110
+ "onUpdate:modelValue": (J) => D.dictType = J,
2111
+ placeholder: "如 sys_user_sex",
2112
+ onChange: w
2113
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
2114
+ ]),
2115
+ _: 2
2116
+ }, 1024)) : W("", !0),
2117
+ D.type === "api" ? (s(), v(q, { key: 2 }, [
2118
+ t(L, {
2119
+ label: "API 地址",
2120
+ error: M(D.url)
2121
+ }, {
2122
+ default: n(() => [
2123
+ t(H, {
2124
+ modelValue: D.url,
2125
+ "onUpdate:modelValue": (J) => D.url = J,
2126
+ placeholder: "如:/form-datasource/region/cities",
2127
+ clearable: "",
2128
+ onChange: (J) => R(D)
2129
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"]),
2130
+ D.apiKey && !D.url ? (s(), v("div", ia, " 旧 API Key:" + Y(D.apiKey) + ",请重新配置接口地址。 ", 1)) : W("", !0)
2131
+ ]),
2132
+ _: 2
2133
+ }, 1032, ["error"]),
2134
+ t(L, { label: "请求参数" }, {
2135
+ default: n(() => [
2136
+ _("div", da, [
2137
+ D.params && D.params.length > 0 ? (s(), v("div", ca, _a)) : W("", !0),
2138
+ (s(!0), v(q, null, G(D.params, (J, ye) => (s(), v("div", {
2139
+ key: ye,
2140
+ class: "api-param-row"
2141
+ }, [
2142
+ t(H, {
2143
+ modelValue: J.key,
2144
+ "onUpdate:modelValue": (B) => J.key = B,
2145
+ placeholder: "参数名",
2146
+ class: "param-col-key",
2147
+ onChange: w
2148
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
2149
+ t(T, {
2150
+ modelValue: J.valueType,
2151
+ "onUpdate:modelValue": (B) => J.valueType = B,
2152
+ class: "param-col-type",
2153
+ onChange: w
2154
+ }, {
2155
+ default: n(() => [
2156
+ t(f, {
2157
+ label: "字段",
2158
+ value: "field"
2159
+ }),
2160
+ t(f, {
2161
+ label: "常量",
2162
+ value: "constant"
2163
+ })
2164
+ ]),
2165
+ _: 2
2166
+ }, 1032, ["modelValue", "onUpdate:modelValue"]),
2167
+ J.valueType === "field" ? (s(), E(T, {
2168
+ key: 0,
2169
+ modelValue: J.field,
2170
+ "onUpdate:modelValue": (B) => J.field = B,
2171
+ placeholder: "选择字段",
2172
+ class: "param-col-source",
2173
+ clearable: "",
2174
+ onChange: w
2175
+ }, {
2176
+ default: n(() => [
2177
+ (s(!0), v(q, null, G(o(l).allFieldProps, (B) => (s(), E(f, {
2178
+ key: B,
2179
+ label: B,
2180
+ value: B
2181
+ }, null, 8, ["label", "value"]))), 128))
2182
+ ]),
2183
+ _: 2
2184
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : (s(), E(H, {
2185
+ key: 1,
2186
+ modelValue: J.value,
2187
+ "onUpdate:modelValue": (B) => J.value = B,
2188
+ placeholder: "常量值",
2189
+ class: "param-col-source",
2190
+ onChange: w
2191
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])),
2192
+ t(ge, {
2193
+ modelValue: J.required,
2194
+ "onUpdate:modelValue": (B) => J.required = B,
2195
+ class: "param-col-req",
2196
+ title: "必需:为空时不发起请求",
2197
+ onChange: w
2198
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
2199
+ t(N, {
2200
+ class: "param-col-del opt-delete",
2201
+ onClick: (B) => b(D, ye)
2202
+ }, {
2203
+ default: n(() => [
2204
+ t(o(ue))
2205
+ ]),
2206
+ _: 2
2207
+ }, 1032, ["onClick"])
2208
+ ]))), 128)),
2209
+ t(Z, {
2210
+ size: "small",
2211
+ onClick: (J) => S(D)
2212
+ }, {
2213
+ default: n(() => [
2214
+ F(" + 添加参数 ")
2215
+ ]),
2216
+ _: 2
2217
+ }, 1032, ["onClick"]),
2218
+ _("div", ha, [
2219
+ t(N, {
2220
+ color: "#909399",
2221
+ size: 12
2222
+ }, {
2223
+ default: n(() => [
2224
+ t(o(nl))
2225
+ ]),
2226
+ _: 1
2227
+ }),
2228
+ va
2229
+ ])
2230
+ ])
2231
+ ]),
2232
+ _: 2
2233
+ }, 1024)
2234
+ ], 64)) : W("", !0)
2235
+ ]),
2236
+ _: 2
2237
+ }, 1024)
2238
+ ]),
2239
+ _: 2
2240
+ }, 1032, ["name"]))), 128))
2241
+ ]),
2242
+ _: 1
2243
+ }, 8, ["modelValue"])
2244
+ ]);
2245
+ };
2246
+ }
2247
+ }, ba = /* @__PURE__ */ ne(ga, [["__scopeId", "data-v-a3a65c84"]]);
2248
+ const pl = (e) => (he("data-v-c7063ca9"), e = e(), ve(), e), ka = { class: "jxy-reaction-panel" }, Sa = { class: "panel-header" }, Ca = /* @__PURE__ */ pl(() => /* @__PURE__ */ _("span", null, "联动规则", -1)), xa = {
2249
+ key: 0,
2250
+ class: "reaction-empty"
2251
+ }, $a = /* @__PURE__ */ pl(() => /* @__PURE__ */ _("p", null, "暂无联动规则", -1)), Va = { class: "reaction-item-title" }, wa = { class: "reaction-item-label" }, Na = { class: "condition-row" }, Pa = { class: "effects-list" }, Ta = {
2252
+ __name: "ReactionPanel",
2253
+ setup(e) {
2254
+ const l = se(), g = re([]), r = [
2255
+ { label: "始终触发", value: "always" },
2256
+ { label: "等于", value: "eq" },
2257
+ { label: "不等于", value: "neq" },
2258
+ { label: "包含", value: "in" },
2259
+ { label: "不包含", value: "notIn" },
2260
+ { label: "为空", value: "empty" },
2261
+ { label: "不为空", value: "notEmpty" }
2262
+ ], u = [
2263
+ { label: "清空值", value: "clearValue" },
2264
+ { label: "设置值", value: "setValue" },
2265
+ { label: "设置显隐", value: "setHidden" },
2266
+ { label: "设置禁用", value: "setDisabled" },
2267
+ { label: "设置必填", value: "setRequired" },
2268
+ { label: "刷新选项", value: "reloadOptions" }
2269
+ ];
2270
+ function h(b) {
2271
+ return ["eq", "neq", "in", "notIn"].includes(b);
2272
+ }
2273
+ function p(b) {
2274
+ return ["setValue", "setHidden", "setDisabled", "setRequired"].includes(b);
2275
+ }
2276
+ function c(b) {
2277
+ return ["setHidden", "setDisabled", "setRequired"].includes(b);
2278
+ }
2279
+ function m(b) {
2280
+ var w, M;
2281
+ return ((M = (w = l.allFieldNodes) == null ? void 0 : w.find) == null ? void 0 : M.call(w, (R) => R.prop === b)) || null;
2282
+ }
2283
+ function O(b) {
2284
+ if (b.type !== "setValue")
2285
+ return !1;
2286
+ const w = m(b.targetField);
2287
+ return ["addressSelector", "linkedSelectList"].includes(w == null ? void 0 : w.type);
2288
+ }
2289
+ function P(b) {
2290
+ try {
2291
+ return JSON.stringify(b, null, 2);
2292
+ } catch {
2293
+ return "";
2294
+ }
2295
+ }
2296
+ function C(b, w) {
2297
+ try {
2298
+ b.value = JSON.parse(w), S();
2299
+ } catch (M) {
2300
+ le.error(`JSON 格式错误:${M.message}`);
2301
+ }
2302
+ }
2303
+ function x(b) {
2304
+ return c(b) ? !0 : "";
2305
+ }
2306
+ function A() {
2307
+ const b = El();
2308
+ l.addReaction(b), g.value = [b.id];
2309
+ }
2310
+ function j(b) {
2311
+ Ve.confirm("删除此联动规则?", "确认删除", { type: "warning" }).then(() => l.removeReaction(b)).catch(() => {
2312
+ });
2313
+ }
2314
+ function U(b) {
2315
+ Array.isArray(b.effects) || (b.effects = []), b.effects.push(Dl()), S();
2316
+ }
2317
+ function d(b, w) {
2318
+ b.effects.splice(w, 1), S();
2319
+ }
2320
+ function S() {
2321
+ l.onDragSortEnd();
2322
+ }
2323
+ return (b, w) => {
2324
+ const M = y("el-button"), R = y("el-icon"), a = y("el-tag"), k = y("el-option"), N = y("el-select"), Z = y("el-form-item"), Q = y("el-input"), te = y("el-switch"), ie = y("el-form"), fe = y("el-collapse-item"), H = y("el-collapse");
2325
+ return s(), v("div", ka, [
2326
+ _("div", Sa, [
2327
+ Ca,
2328
+ t(M, {
2329
+ size: "small",
2330
+ type: "primary",
2331
+ icon: o(Ae),
2332
+ onClick: A
2333
+ }, {
2334
+ default: n(() => [
2335
+ F("添加规则")
2336
+ ]),
2337
+ _: 1
2338
+ }, 8, ["icon"])
2339
+ ]),
2340
+ o(l).schema.reactions.length === 0 ? (s(), v("div", xa, [
2341
+ t(R, {
2342
+ size: 36,
2343
+ color: "#c0c4cc"
2344
+ }, {
2345
+ default: n(() => [
2346
+ t(o(sl))
2347
+ ]),
2348
+ _: 1
2349
+ }),
2350
+ $a
2351
+ ])) : W("", !0),
2352
+ t(H, {
2353
+ modelValue: g.value,
2354
+ "onUpdate:modelValue": w[0] || (w[0] = (L) => g.value = L),
2355
+ class: "reaction-list"
2356
+ }, {
2357
+ default: n(() => [
2358
+ (s(!0), v(q, null, G(o(l).schema.reactions, (L) => (s(), E(fe, {
2359
+ key: L.id,
2360
+ name: L.id
2361
+ }, {
2362
+ title: n(() => [
2363
+ _("div", Va, [
2364
+ t(a, {
2365
+ size: "small",
2366
+ type: "warning"
2367
+ }, {
2368
+ default: n(() => [
2369
+ F("联动")
2370
+ ]),
2371
+ _: 1
2372
+ }),
2373
+ _("span", wa, Y(L.sourceField || "未配置触发字段"), 1),
2374
+ t(R, {
2375
+ class: "reaction-delete-btn",
2376
+ title: "删除此规则",
2377
+ onClick: ce((I) => j(L.id), ["stop"])
2378
+ }, {
2379
+ default: n(() => [
2380
+ t(o(ue))
2381
+ ]),
2382
+ _: 2
2383
+ }, 1032, ["onClick"])
2384
+ ])
2385
+ ]),
2386
+ default: n(() => [
2387
+ t(ie, {
2388
+ "label-position": "top",
2389
+ size: "small",
2390
+ class: "reaction-form"
2391
+ }, {
2392
+ default: n(() => [
2393
+ t(Z, {
2394
+ label: "触发字段(sourceField)",
2395
+ required: ""
2396
+ }, {
2397
+ default: n(() => [
2398
+ t(N, {
2399
+ modelValue: L.sourceField,
2400
+ "onUpdate:modelValue": (I) => L.sourceField = I,
2401
+ placeholder: "选择触发字段",
2402
+ style: { width: "100%" },
2403
+ onChange: S
2404
+ }, {
2405
+ default: n(() => [
2406
+ (s(!0), v(q, null, G(o(l).allFieldProps, (I) => (s(), E(k, {
2407
+ key: I,
2408
+ label: I,
2409
+ value: I
2410
+ }, null, 8, ["label", "value"]))), 128))
2411
+ ]),
2412
+ _: 2
2413
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
2414
+ ]),
2415
+ _: 2
2416
+ }, 1024),
2417
+ t(Z, { label: "触发条件" }, {
2418
+ default: n(() => [
2419
+ _("div", Na, [
2420
+ t(N, {
2421
+ modelValue: L.condition.type,
2422
+ "onUpdate:modelValue": (I) => L.condition.type = I,
2423
+ style: { width: "108px", "flex-shrink": "0" },
2424
+ onChange: () => {
2425
+ L.condition.value = "", S();
2426
+ }
2427
+ }, {
2428
+ default: n(() => [
2429
+ (s(), v(q, null, G(r, (I) => t(k, {
2430
+ key: I.value,
2431
+ label: I.label,
2432
+ value: I.value
2433
+ }, null, 8, ["label", "value"])), 64))
2434
+ ]),
2435
+ _: 2
2436
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
2437
+ h(L.condition.type) ? (s(), E(Q, {
2438
+ key: 0,
2439
+ modelValue: L.condition.value,
2440
+ "onUpdate:modelValue": (I) => L.condition.value = I,
2441
+ placeholder: "条件值",
2442
+ style: { flex: "1", "min-width": "0" },
2443
+ onChange: S
2444
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : W("", !0)
2445
+ ])
2446
+ ]),
2447
+ _: 2
2448
+ }, 1024),
2449
+ t(Z, { label: "执行动作" }, {
2450
+ default: n(() => [
2451
+ _("div", Pa, [
2452
+ (s(!0), v(q, null, G(L.effects, (I, de) => (s(), v("div", {
2453
+ key: de,
2454
+ class: "effect-row"
2455
+ }, [
2456
+ t(N, {
2457
+ modelValue: I.type,
2458
+ "onUpdate:modelValue": (f) => I.type = f,
2459
+ style: { width: "106px", "flex-shrink": "0" },
2460
+ size: "small",
2461
+ onChange: () => {
2462
+ I.value = x(I.type), S();
2463
+ }
2464
+ }, {
2465
+ default: n(() => [
2466
+ (s(), v(q, null, G(u, (f) => t(k, {
2467
+ key: f.value,
2468
+ label: f.label,
2469
+ value: f.value
2470
+ }, null, 8, ["label", "value"])), 64))
2471
+ ]),
2472
+ _: 2
2473
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
2474
+ t(N, {
2475
+ modelValue: I.targetField,
2476
+ "onUpdate:modelValue": (f) => I.targetField = f,
2477
+ placeholder: "目标字段",
2478
+ style: { flex: "1", "min-width": "0" },
2479
+ size: "small",
2480
+ onChange: S
2481
+ }, {
2482
+ default: n(() => [
2483
+ (s(!0), v(q, null, G(o(l).allFieldProps.filter((f) => f !== L.sourceField), (f) => (s(), E(k, {
2484
+ key: f,
2485
+ label: f,
2486
+ value: f
2487
+ }, null, 8, ["label", "value"]))), 128))
2488
+ ]),
2489
+ _: 2
2490
+ }, 1032, ["modelValue", "onUpdate:modelValue"]),
2491
+ p(I.type) ? (s(), v(q, { key: 0 }, [
2492
+ c(I.type) ? (s(), E(te, {
2493
+ key: 0,
2494
+ modelValue: I.value,
2495
+ "onUpdate:modelValue": (f) => I.value = f,
2496
+ size: "small",
2497
+ onChange: S
2498
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : O(I) ? (s(), E(Q, {
2499
+ key: 2,
2500
+ type: "textarea",
2501
+ rows: 2,
2502
+ "model-value": P(I.value),
2503
+ placeholder: "JSON 值",
2504
+ class: "effect-json-value",
2505
+ size: "small",
2506
+ onChange: (f) => C(I, f)
2507
+ }, null, 8, ["model-value", "onChange"])) : (s(), E(Q, {
2508
+ key: 1,
2509
+ modelValue: I.value,
2510
+ "onUpdate:modelValue": (f) => I.value = f,
2511
+ placeholder: "值",
2512
+ style: { width: "72px", "flex-shrink": "0" },
2513
+ size: "small",
2514
+ onChange: S
2515
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]))
2516
+ ], 64)) : W("", !0),
2517
+ t(R, {
2518
+ class: "effect-delete",
2519
+ title: "删除此动作",
2520
+ onClick: (f) => d(L, de)
2521
+ }, {
2522
+ default: n(() => [
2523
+ t(o(ue))
2524
+ ]),
2525
+ _: 2
2526
+ }, 1032, ["onClick"])
2527
+ ]))), 128)),
2528
+ t(M, {
2529
+ size: "small",
2530
+ icon: o(Ae),
2531
+ onClick: (I) => U(L)
2532
+ }, {
2533
+ default: n(() => [
2534
+ F("添加动作")
2535
+ ]),
2536
+ _: 2
2537
+ }, 1032, ["icon", "onClick"])
2538
+ ])
2539
+ ]),
2540
+ _: 2
2541
+ }, 1024)
2542
+ ]),
2543
+ _: 2
2544
+ }, 1024)
2545
+ ]),
2546
+ _: 2
2547
+ }, 1032, ["name"]))), 128))
2548
+ ]),
2549
+ _: 1
2550
+ }, 8, ["modelValue"])
2551
+ ]);
2552
+ };
2553
+ }
2554
+ }, Ea = /* @__PURE__ */ ne(Ta, [["__scopeId", "data-v-c7063ca9"]]);
2555
+ const me = (e) => (he("data-v-99b3e94a"), e = e(), ve(), e), Da = { class: "jxy-form-config-panel" }, Ua = { class: "section-title" }, Oa = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", null, "表单信息", -1)), Aa = { class: "section-title" }, Ia = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", null, "数据源配置", -1)), Fa = /* @__PURE__ */ me(() => /* @__PURE__ */ _("div", { class: "config-tip" }, " 当前表单所有字典通过该接口一次性加载;没有 DICT 数据源时可以留空。 ", -1)), Ra = { class: "section-title" }, za = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", null, "布局配置", -1)), Ja = { class: "schema-info" }, La = { class: "schema-info-row" }, ja = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", { class: "schema-info-label" }, "Schema 版本", -1)), Ma = { class: "schema-info-row" }, Ya = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", { class: "schema-info-label" }, "节点数量", -1)), qa = { class: "schema-info-row" }, Xa = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", { class: "schema-info-label" }, "数据源", -1)), Ba = { class: "schema-info-row" }, Ka = /* @__PURE__ */ me(() => /* @__PURE__ */ _("span", { class: "schema-info-label" }, "联动规则", -1)), Ha = {
2556
+ __name: "FormConfigPanel",
2557
+ setup(e) {
2558
+ const l = se(), g = oe(() => {
2559
+ var p;
2560
+ const u = ((p = l.schema.dataSourceConfig) == null ? void 0 : p.dictUrl) || "";
2561
+ if (!u)
2562
+ return "";
2563
+ const h = Ie(u);
2564
+ return h.valid ? "" : h.message;
2565
+ }), r = oe(() => {
2566
+ const u = l.schema.nodes || [];
2567
+ let h = 0;
2568
+ function p(c) {
2569
+ c.forEach((m) => {
2570
+ h++, m.nodeType === "grid" && Array.isArray(m.columns) && m.columns.forEach((O) => {
2571
+ Array.isArray(O.children) && p(O.children);
2572
+ });
2573
+ });
2574
+ }
2575
+ return p(u), h;
2576
+ });
2577
+ return (u, h) => {
2578
+ const p = y("el-icon"), c = y("el-input"), m = y("el-form-item"), O = y("el-form"), P = y("el-divider"), C = y("el-option"), x = y("el-select"), A = y("el-input-number"), j = y("el-switch"), U = y("el-tag");
2579
+ return s(), v("div", Da, [
2580
+ _("div", Ua, [
2581
+ t(p, null, {
2582
+ default: n(() => [
2583
+ t(o(nl))
2584
+ ]),
2585
+ _: 1
2586
+ }),
2587
+ Oa
2588
+ ]),
2589
+ t(O, {
2590
+ "label-position": "top",
2591
+ size: "small",
2592
+ class: "config-form"
2593
+ }, {
2594
+ default: n(() => [
2595
+ t(m, { label: "表单名称" }, {
2596
+ default: n(() => {
2597
+ var d;
2598
+ return [
2599
+ t(c, {
2600
+ "model-value": (d = o(l).schema.meta) == null ? void 0 : d.formName,
2601
+ placeholder: "如:请假申请",
2602
+ "onUpdate:modelValue": h[0] || (h[0] = (S) => o(l).updateFormMeta("formName", S))
2603
+ }, null, 8, ["model-value"])
2604
+ ];
2605
+ }),
2606
+ _: 1
2607
+ }),
2608
+ t(m, { label: "表单编码(formCode)" }, {
2609
+ default: n(() => {
2610
+ var d;
2611
+ return [
2612
+ t(c, {
2613
+ "model-value": (d = o(l).schema.meta) == null ? void 0 : d.formCode,
2614
+ placeholder: "如:leaveApply(发布时必填)",
2615
+ "onUpdate:modelValue": h[1] || (h[1] = (S) => o(l).updateFormMeta("formCode", S))
2616
+ }, null, 8, ["model-value"])
2617
+ ];
2618
+ }),
2619
+ _: 1
2620
+ }),
2621
+ t(m, { label: "表单描述" }, {
2622
+ default: n(() => {
2623
+ var d;
2624
+ return [
2625
+ t(c, {
2626
+ type: "textarea",
2627
+ rows: 2,
2628
+ "model-value": (d = o(l).schema.meta) == null ? void 0 : d.description,
2629
+ placeholder: "表单用途说明(选填)",
2630
+ "onUpdate:modelValue": h[2] || (h[2] = (S) => o(l).updateFormMeta("description", S))
2631
+ }, null, 8, ["model-value"])
2632
+ ];
2633
+ }),
2634
+ _: 1
2635
+ })
2636
+ ]),
2637
+ _: 1
2638
+ }),
2639
+ t(P, { class: "config-divider" }),
2640
+ _("div", Aa, [
2641
+ t(p, null, {
2642
+ default: n(() => [
2643
+ t(o(sl))
2644
+ ]),
2645
+ _: 1
2646
+ }),
2647
+ Ia
2648
+ ]),
2649
+ t(O, {
2650
+ "label-position": "top",
2651
+ size: "small",
2652
+ class: "config-form"
2653
+ }, {
2654
+ default: n(() => [
2655
+ t(m, {
2656
+ label: "DICT 总接口地址",
2657
+ error: o(g)
2658
+ }, {
2659
+ default: n(() => {
2660
+ var d;
2661
+ return [
2662
+ t(c, {
2663
+ "model-value": (d = o(l).schema.dataSourceConfig) == null ? void 0 : d.dictUrl,
2664
+ placeholder: "如:/form-datasource/leave-apply/dicts",
2665
+ clearable: "",
2666
+ "onUpdate:modelValue": h[3] || (h[3] = (S) => o(l).updateDataSourceConfig("dictUrl", S))
2667
+ }, null, 8, ["model-value"]),
2668
+ Fa
2669
+ ];
2670
+ }),
2671
+ _: 1
2672
+ }, 8, ["error"])
2673
+ ]),
2674
+ _: 1
2675
+ }),
2676
+ t(P, { class: "config-divider" }),
2677
+ _("div", Ra, [
2678
+ t(p, null, {
2679
+ default: n(() => [
2680
+ t(o(Ql))
2681
+ ]),
2682
+ _: 1
2683
+ }),
2684
+ za
2685
+ ]),
2686
+ t(O, {
2687
+ "label-position": "top",
2688
+ size: "small",
2689
+ class: "config-form"
2690
+ }, {
2691
+ default: n(() => [
2692
+ (s(!0), v(q, null, G(o(Ro), (d) => (s(), E(m, {
2693
+ key: d.key,
2694
+ label: d.label
2695
+ }, {
2696
+ default: n(() => {
2697
+ var S, b, w, M;
2698
+ return [
2699
+ d.type === "select" ? (s(), E(x, {
2700
+ key: 0,
2701
+ "model-value": (S = o(l).schema.config) == null ? void 0 : S[d.key],
2702
+ style: { width: "100%" },
2703
+ "onUpdate:modelValue": (R) => o(l).updateFormConfig(d.key, R)
2704
+ }, {
2705
+ default: n(() => [
2706
+ (s(!0), v(q, null, G(d.options, (R) => (s(), E(C, {
2707
+ key: R.value,
2708
+ label: R.label,
2709
+ value: R.value
2710
+ }, null, 8, ["label", "value"]))), 128))
2711
+ ]),
2712
+ _: 2
2713
+ }, 1032, ["model-value", "onUpdate:modelValue"])) : d.type === "number" ? (s(), E(A, {
2714
+ key: 1,
2715
+ "model-value": (b = o(l).schema.config) == null ? void 0 : b[d.key],
2716
+ min: d.min ?? 0,
2717
+ max: d.max,
2718
+ step: d.step || 1,
2719
+ placeholder: d.placeholder,
2720
+ "controls-position": "right",
2721
+ style: { width: "100%" },
2722
+ "onUpdate:modelValue": (R) => o(l).updateFormConfig(d.key, R)
2723
+ }, null, 8, ["model-value", "min", "max", "step", "placeholder", "onUpdate:modelValue"])) : d.type === "switch" ? (s(), E(j, {
2724
+ key: 2,
2725
+ "model-value": (w = o(l).schema.config) == null ? void 0 : w[d.key],
2726
+ "onUpdate:modelValue": (R) => o(l).updateFormConfig(d.key, R)
2727
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : (s(), E(c, {
2728
+ key: 3,
2729
+ "model-value": (M = o(l).schema.config) == null ? void 0 : M[d.key],
2730
+ placeholder: d.placeholder,
2731
+ "onUpdate:modelValue": (R) => o(l).updateFormConfig(d.key, R)
2732
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]))
2733
+ ];
2734
+ }),
2735
+ _: 2
2736
+ }, 1032, ["label"]))), 128))
2737
+ ]),
2738
+ _: 1
2739
+ }),
2740
+ t(P, { class: "config-divider" }),
2741
+ _("div", Ja, [
2742
+ _("div", La, [
2743
+ ja,
2744
+ t(U, {
2745
+ size: "small",
2746
+ type: "info"
2747
+ }, {
2748
+ default: n(() => [
2749
+ F(Y(o(l).schema.schemaVersion), 1)
2750
+ ]),
2751
+ _: 1
2752
+ })
2753
+ ]),
2754
+ _("div", Ma, [
2755
+ Ya,
2756
+ t(U, { size: "small" }, {
2757
+ default: n(() => [
2758
+ F(Y(o(r)), 1)
2759
+ ]),
2760
+ _: 1
2761
+ })
2762
+ ]),
2763
+ _("div", qa, [
2764
+ Xa,
2765
+ t(U, { size: "small" }, {
2766
+ default: n(() => {
2767
+ var d;
2768
+ return [
2769
+ F(Y(((d = o(l).schema.dataSources) == null ? void 0 : d.length) ?? 0), 1)
2770
+ ];
2771
+ }),
2772
+ _: 1
2773
+ })
2774
+ ]),
2775
+ _("div", Ba, [
2776
+ Ka,
2777
+ t(U, { size: "small" }, {
2778
+ default: n(() => {
2779
+ var d;
2780
+ return [
2781
+ F(Y(((d = o(l).schema.reactions) == null ? void 0 : d.length) ?? 0), 1)
2782
+ ];
2783
+ }),
2784
+ _: 1
2785
+ })
2786
+ ])
2787
+ ])
2788
+ ]);
2789
+ };
2790
+ }
2791
+ }, Wa = /* @__PURE__ */ ne(Ha, [["__scopeId", "data-v-99b3e94a"]]);
2792
+ const Ga = { class: "jxy-designer-right-panel" }, Za = {
2793
+ __name: "DesignerRightPanel",
2794
+ setup(e) {
2795
+ const l = se();
2796
+ return (g, r) => {
2797
+ const u = y("el-tab-pane"), h = y("el-tabs");
2798
+ return s(), v("div", Ga, [
2799
+ t(h, {
2800
+ modelValue: o(l).activePanel,
2801
+ "onUpdate:modelValue": r[0] || (r[0] = (p) => o(l).activePanel = p),
2802
+ class: "right-panel-tabs"
2803
+ }, {
2804
+ default: n(() => [
2805
+ t(u, {
2806
+ label: "属性",
2807
+ name: "props"
2808
+ }, {
2809
+ default: n(() => [
2810
+ t(Qo)
2811
+ ]),
2812
+ _: 1
2813
+ }),
2814
+ t(u, {
2815
+ label: "数据源",
2816
+ name: "dataSource"
2817
+ }, {
2818
+ default: n(() => [
2819
+ t(ba)
2820
+ ]),
2821
+ _: 1
2822
+ }),
2823
+ t(u, {
2824
+ label: "联动",
2825
+ name: "reaction"
2826
+ }, {
2827
+ default: n(() => [
2828
+ t(Ea)
2829
+ ]),
2830
+ _: 1
2831
+ }),
2832
+ t(u, {
2833
+ label: "表单",
2834
+ name: "formConfig"
2835
+ }, {
2836
+ default: n(() => [
2837
+ t(Wa)
2838
+ ]),
2839
+ _: 1
2840
+ })
2841
+ ]),
2842
+ _: 1
2843
+ }, 8, ["modelValue"])
2844
+ ]);
2845
+ };
2846
+ }
2847
+ }, Qa = /* @__PURE__ */ ne(Za, [["__scopeId", "data-v-82e44664"]]);
2848
+ const en = { class: "jxy-preview-content" }, ln = { class: "runtime-wrap" }, tn = { class: "schema-json-wrap" }, on = { class: "json-toolbar" }, an = { class: "schema-json-view" }, nn = {
2849
+ __name: "PreviewContent",
2850
+ props: {
2851
+ schema: { type: Object, required: !0 },
2852
+ dataSourceProvider: { type: Object, default: null },
2853
+ componentRegistry: { type: Object, default: () => ({}) }
2854
+ },
2855
+ setup(e) {
2856
+ const l = e, g = re("runtime"), r = oe(() => {
2857
+ try {
2858
+ return JSON.stringify(l.schema, null, 2);
2859
+ } catch {
2860
+ return "";
2861
+ }
2862
+ });
2863
+ async function u() {
2864
+ try {
2865
+ await navigator.clipboard.writeText(r.value), le.success("已复制 Schema JSON");
2866
+ } catch {
2867
+ le.error("复制失败,请手动选中复制");
2868
+ }
2869
+ }
2870
+ return (h, p) => {
2871
+ const c = y("el-tab-pane"), m = y("el-button"), O = y("el-tabs");
2872
+ return s(), v("div", en, [
2873
+ t(O, {
2874
+ modelValue: g.value,
2875
+ "onUpdate:modelValue": p[0] || (p[0] = (P) => g.value = P),
2876
+ class: "preview-tabs"
2877
+ }, {
2878
+ default: n(() => [
2879
+ t(c, {
2880
+ label: "🖥 表单预览",
2881
+ name: "runtime"
2882
+ }, {
2883
+ default: n(() => [
2884
+ _("div", ln, [
2885
+ t(lt, {
2886
+ schema: e.schema,
2887
+ "data-source-provider": e.dataSourceProvider,
2888
+ "component-registry": e.componentRegistry,
2889
+ layout: "dialog"
2890
+ }, Ge({ _: 2 }, [
2891
+ h.$slots["field-suffix"] ? {
2892
+ name: "field-suffix",
2893
+ fn: n((P) => [
2894
+ $e(h.$slots, "field-suffix", Ze(Qe(P)), void 0, !0)
2895
+ ]),
2896
+ key: "0"
2897
+ } : void 0,
2898
+ h.$slots["preview-actions"] ? {
2899
+ name: "preview-actions",
2900
+ fn: n(() => [
2901
+ $e(h.$slots, "preview-actions", {}, void 0, !0)
2902
+ ]),
2903
+ key: "1"
2904
+ } : void 0
2905
+ ]), 1032, ["schema", "data-source-provider", "component-registry"])
2906
+ ])
2907
+ ]),
2908
+ _: 3
2909
+ }),
2910
+ t(c, {
2911
+ label: "📋 Schema JSON",
2912
+ name: "json"
2913
+ }, {
2914
+ default: n(() => [
2915
+ _("div", tn, [
2916
+ _("div", on, [
2917
+ t(m, {
2918
+ size: "small",
2919
+ text: "",
2920
+ type: "primary",
2921
+ icon: o(we),
2922
+ onClick: u
2923
+ }, {
2924
+ default: n(() => [
2925
+ F("复制 JSON")
2926
+ ]),
2927
+ _: 1
2928
+ }, 8, ["icon"])
2929
+ ]),
2930
+ _("pre", an, Y(o(r)), 1)
2931
+ ])
2932
+ ]),
2933
+ _: 1
2934
+ })
2935
+ ]),
2936
+ _: 3
2937
+ }, 8, ["modelValue"])
2938
+ ]);
2939
+ };
2940
+ }
2941
+ }, sn = /* @__PURE__ */ ne(nn, [["__scopeId", "data-v-0779918e"]]);
2942
+ const rn = { class: "jxy-designer-body" }, dn = { class: "jxy-designer-left" }, cn = { class: "jxy-designer-center" }, un = { class: "jxy-designer-right" }, pn = {
2943
+ __name: "index",
2944
+ props: {
2945
+ dataSourceProvider: { type: Object, default: null },
2946
+ componentRegistry: { type: Object, default: () => ({}) }
2947
+ },
2948
+ setup(e, { expose: l }) {
2949
+ const g = se(), r = re(!1);
2950
+ return He(() => {
2951
+ g.initDesigner();
2952
+ }), st(), kl("designerPreview", {
2953
+ open: () => {
2954
+ r.value = !0;
2955
+ },
2956
+ close: () => {
2957
+ r.value = !1;
2958
+ }
2959
+ }), l({
2960
+ getSchema: () => g.schema,
2961
+ loadSchema: (u) => g.loadSchema(u),
2962
+ saveDraft: () => g.saveDraft(),
2963
+ publish: () => g.publish()
2964
+ }), (u, h) => {
2965
+ const p = y("el-dialog");
2966
+ return s(), v("div", {
2967
+ class: "jxy-form-designer",
2968
+ onClick: h[1] || (h[1] = ce((c) => o(g).clearSelection(), ["self"]))
2969
+ }, [
2970
+ t(gt),
2971
+ _("div", rn, [
2972
+ _("div", dn, [
2973
+ t($t)
2974
+ ]),
2975
+ _("div", cn, [
2976
+ t(co)
2977
+ ]),
2978
+ _("div", un, [
2979
+ t(Qa)
2980
+ ])
2981
+ ]),
2982
+ t(p, {
2983
+ modelValue: r.value,
2984
+ "onUpdate:modelValue": h[0] || (h[0] = (c) => r.value = c),
2985
+ title: "表单预览",
2986
+ fullscreen: "",
2987
+ "destroy-on-close": "",
2988
+ class: "jxy-designer-preview-dialog"
2989
+ }, {
2990
+ default: n(() => [
2991
+ r.value ? (s(), E(sn, {
2992
+ key: 0,
2993
+ schema: o(g).schema,
2994
+ "data-source-provider": e.dataSourceProvider,
2995
+ "component-registry": e.componentRegistry
2996
+ }, Ge({ _: 2 }, [
2997
+ u.$slots["field-suffix"] ? {
2998
+ name: "field-suffix",
2999
+ fn: n((c) => [
3000
+ $e(u.$slots, "field-suffix", Ze(Qe(c)), void 0, !0)
3001
+ ]),
3002
+ key: "0"
3003
+ } : void 0,
3004
+ u.$slots["preview-actions"] ? {
3005
+ name: "preview-actions",
3006
+ fn: n(() => [
3007
+ $e(u.$slots, "preview-actions", {}, void 0, !0)
3008
+ ]),
3009
+ key: "1"
3010
+ } : void 0
3011
+ ]), 1032, ["schema", "data-source-provider", "component-registry"])) : W("", !0)
3012
+ ]),
3013
+ _: 3
3014
+ }, 8, ["modelValue"])
3015
+ ]);
3016
+ };
3017
+ }
3018
+ }, Sn = /* @__PURE__ */ ne(pn, [["__scopeId", "data-v-aaf0899a"]]);
3019
+ export {
3020
+ Sn as JXYFormDesigner,
3021
+ Sn as default,
3022
+ se as useFormDesignerStore
3023
+ };