@agentprismform/render-vue 0.0.0-stage → 1.3.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.
Files changed (33) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/index.d.ts +61 -0
  3. package/dist/index.mjs +2995 -0
  4. package/dist/style.css +2 -0
  5. package/package.json +40 -4
  6. package/src/components/FormGroup.vue +50 -0
  7. package/src/components/FormItem.vue +171 -0
  8. package/src/components/FormRender.vue +127 -0
  9. package/src/components/PrismForm.vue +608 -0
  10. package/src/components/controls/AddressControl.vue +255 -0
  11. package/src/components/controls/AgreementControl.vue +49 -0
  12. package/src/components/controls/CascaderControl.vue +159 -0
  13. package/src/components/controls/DateControl.vue +96 -0
  14. package/src/components/controls/ImageUploadControl.vue +135 -0
  15. package/src/components/controls/InputControl.vue +80 -0
  16. package/src/components/controls/ListControl.vue +149 -0
  17. package/src/components/controls/SearchControl.vue +193 -0
  18. package/src/components/controls/SelectControl.vue +206 -0
  19. package/src/components/controls/SliderControl.vue +61 -0
  20. package/src/components/controls/TaskControl.vue +39 -0
  21. package/src/components/controls/VerifyCodeControl.vue +135 -0
  22. package/src/components/controls/task/ApiTask.vue +99 -0
  23. package/src/components/controls/task/CustomerTask.vue +91 -0
  24. package/src/components/controls/task/H5JumpTask.vue +125 -0
  25. package/src/components/controls/task/InlineTask.vue +116 -0
  26. package/src/components/controls/task/NativeTask.vue +299 -0
  27. package/src/components/controls/task/SubFormTask.vue +156 -0
  28. package/src/composables/useFormRender.ts +63 -0
  29. package/src/composables/useTaskHandler.ts +11 -0
  30. package/src/helpers.ts +143 -0
  31. package/src/index.ts +8 -0
  32. package/src/taskHandlers.ts +4 -0
  33. package/README.md +0 -3
package/dist/index.mjs ADDED
@@ -0,0 +1,2995 @@
1
+ import { defineComponent as U, ref as E, watch as Z, computed as b, openBlock as s, createElementBlock as i, createCommentVNode as x, createElementVNode as l, normalizeClass as K, toDisplayString as $, createVNode as se, Transition as ie, withCtx as te, withModifiers as ae, Fragment as q, renderList as W, createBlock as ee, Teleport as Ie, normalizeStyle as re, createTextVNode as X, withDirectives as Oe, vModelText as Me, useCssVars as Ve, nextTick as Ee, resolveDynamicComponent as ce, inject as le, onBeforeUnmount as Pe, unref as ne, provide as G, renderSlot as ye, shallowRef as Fe, reactive as ke, onUnmounted as be, mergeProps as De, getCurrentInstance as Re } from "vue";
2
+ import { FormCore as he } from "@agentprismform/core";
3
+ import { resolveLabelPosition as Ne, createFormRenderState as _e } from "@agentprismform/render";
4
+ import { createFetchHostHandlers as yn } from "@agentprismform/render";
5
+ import { FORM_UI_HOST_HANDLERS_KEY as ue, normalizeModernLocale as Le, resolveModernThemeVars as je, getModernShellComponents as Be, MODERN_SHELL_SKIN_KEY as Ke, MODERN_THEME_OVERRIDE_KEY as Ue, MODERN_COLLAPSIBLE_KEY as He, MODERN_KEYBOARD_POLICY_KEY as Ye, MODERN_READONLY_KEY as qe, MODERN_TELEMETRY_KEY as ze, MODERN_LOCALE_KEY as Ge, MODERN_CUSTOM_CONTROLS_KEY as We, computeFormProgress as Je } from "@agentprismform/render-ui";
6
+ import { completeTask as Q, getTaskHandlers as Xe, classifyTask as Qe, resolveTaskByKey as Ce } from "@agentprismform/render-task";
7
+ import { setTaskHandlers as bn } from "@agentprismform/render-task";
8
+ const Ze = { class: "ctrl-input-wrapper" }, et = ["value", "placeholder", "disabled", "maxlength"], tt = ["type", "value", "placeholder", "disabled", "maxlength"], lt = /* @__PURE__ */ U({
9
+ __name: "InputControl",
10
+ props: {
11
+ item: {},
12
+ field: {},
13
+ formCore: {}
14
+ },
15
+ emits: ["change"],
16
+ setup(t, { emit: n }) {
17
+ var g;
18
+ const e = t, r = n, f = E(((g = e.field) == null ? void 0 : g.value) || "");
19
+ Z(() => {
20
+ var a;
21
+ return (a = e.field) == null ? void 0 : a.value;
22
+ }, (a) => {
23
+ f.value = a || "";
24
+ });
25
+ const p = b(() => e.item.type === "textarea");
26
+ function m(a) {
27
+ const o = a.target;
28
+ f.value = o.value;
29
+ }
30
+ function h(a) {
31
+ var y;
32
+ const c = ((y = a.target.value) == null ? void 0 : y.trim()) || "";
33
+ f.value = c, r("change", { value: c, eventType: "inputBlur" });
34
+ }
35
+ return (a, o) => {
36
+ var c, y, M, v, T;
37
+ return s(), i("div", Ze, [
38
+ p.value ? (s(), i("textarea", {
39
+ key: 0,
40
+ class: "ctrl-input ctrl-textarea",
41
+ value: f.value,
42
+ placeholder: t.item.placeholder || "请输入",
43
+ disabled: (c = t.field) == null ? void 0 : c.disabled,
44
+ maxlength: (y = t.item.props) == null ? void 0 : y.maxlength,
45
+ rows: "3",
46
+ onInput: m,
47
+ onBlur: h
48
+ }, null, 40, et)) : (s(), i("input", {
49
+ key: 1,
50
+ class: "ctrl-input",
51
+ type: t.item.type === "number" ? "number" : t.item.type === "phone" ? "tel" : "text",
52
+ value: f.value,
53
+ placeholder: t.item.placeholder || "请输入",
54
+ disabled: (M = t.field) == null ? void 0 : M.disabled,
55
+ maxlength: (v = t.item.props) == null ? void 0 : v.maxlength,
56
+ onInput: m,
57
+ onBlur: h
58
+ }, null, 40, tt)),
59
+ (T = t.item.props) != null && T.guideText ? (s(), i("span", {
60
+ key: 2,
61
+ class: "ctrl-guide",
62
+ onClick: o[0] || (o[0] = (A) => r("change", { eventType: "guideClick" }))
63
+ }, "查看示例")) : x("v-if", !0)
64
+ ]);
65
+ };
66
+ }
67
+ }), Y = (t, n) => {
68
+ const e = t.__vccOpts || t;
69
+ for (const [r, f] of n)
70
+ e[r] = f;
71
+ return e;
72
+ }, at = /* @__PURE__ */ Y(lt, [["__scopeId", "data-v-c8af62aa"]]), nt = { class: "ctrl-select" }, ot = { class: "panel-header" }, st = { class: "panel-title" }, it = {
73
+ class: "panel-body",
74
+ role: "listbox"
75
+ }, rt = ["aria-selected", "onClick"], ct = { class: "option-text" }, ut = /* @__PURE__ */ U({
76
+ __name: "SelectControl",
77
+ props: {
78
+ item: {},
79
+ field: {},
80
+ formCore: {}
81
+ },
82
+ emits: ["change"],
83
+ setup(t, { emit: n }) {
84
+ const e = t, r = n, f = E(!1), p = b(() => {
85
+ var M, v;
86
+ const c = ((M = e.item) == null ? void 0 : M.initOptions) || [], y = (v = e.field) == null ? void 0 : v.value;
87
+ return y ? c.map((T) => {
88
+ var A;
89
+ return {
90
+ ...T,
91
+ _selected: ((A = e.item.props) == null ? void 0 : A.isSingle) !== !1 ? (y == null ? void 0 : y.code) === T.code : Array.isArray(y) ? y.some((L) => L.code === T.code) : y === T.code
92
+ };
93
+ }) : c;
94
+ }), m = b(() => {
95
+ var y, M;
96
+ const c = (y = e.field) == null ? void 0 : y.value;
97
+ return c ? typeof c == "object" && c.name ? c.name : (M = e.field) != null && M.showValue ? e.field.showValue : String(c) : "";
98
+ }), h = b(() => {
99
+ var c;
100
+ return ((c = e.item.props) == null ? void 0 : c.dialogTitle) || "请选择";
101
+ });
102
+ function g() {
103
+ var c;
104
+ (c = e.field) != null && c.disabled || (f.value = !0);
105
+ }
106
+ function a() {
107
+ f.value = !1;
108
+ }
109
+ function o(c) {
110
+ var M;
111
+ ((M = e.item.props) == null ? void 0 : M.isSingle) !== !1 && (r("change", { value: { code: c.code, name: c.name }, eventType: "pickChange" }), f.value = !1);
112
+ }
113
+ return (c, y) => {
114
+ var M;
115
+ return s(), i("div", nt, [
116
+ x(" 触发器 "),
117
+ l(
118
+ "div",
119
+ {
120
+ class: K(["select-trigger", { disabled: (M = t.field) == null ? void 0 : M.disabled, placeholder: !m.value }]),
121
+ onClick: g
122
+ },
123
+ [
124
+ l(
125
+ "span",
126
+ null,
127
+ $(m.value || t.item.placeholder || "请选择"),
128
+ 1
129
+ /* TEXT */
130
+ )
131
+ ],
132
+ 2
133
+ /* CLASS */
134
+ ),
135
+ x(" 遮罩 + 底部弹窗 "),
136
+ se(ie, { name: "panel" }, {
137
+ default: te(() => [
138
+ f.value ? (s(), i("div", {
139
+ key: 0,
140
+ class: "select-overlay",
141
+ onClick: a
142
+ }, [
143
+ l("div", {
144
+ class: "select-panel",
145
+ role: "dialog",
146
+ "aria-label": "选择选项",
147
+ onClick: y[0] || (y[0] = ae(() => {
148
+ }, ["stop"]))
149
+ }, [
150
+ x(" 头部 "),
151
+ l("div", ot, [
152
+ l(
153
+ "span",
154
+ st,
155
+ $(h.value),
156
+ 1
157
+ /* TEXT */
158
+ ),
159
+ l("button", {
160
+ class: "panel-close",
161
+ onClick: a,
162
+ "aria-label": "关闭"
163
+ }, "×")
164
+ ]),
165
+ x(" 选项列表 "),
166
+ l("div", it, [
167
+ (s(!0), i(
168
+ q,
169
+ null,
170
+ W(p.value, (v) => (s(), i("div", {
171
+ key: v.code,
172
+ class: K(["option-card", { "option-selected": v._selected }]),
173
+ role: "option",
174
+ "aria-selected": v._selected,
175
+ onClick: (T) => o(v)
176
+ }, [
177
+ l(
178
+ "span",
179
+ ct,
180
+ $(v.name),
181
+ 1
182
+ /* TEXT */
183
+ ),
184
+ l(
185
+ "span",
186
+ {
187
+ class: K(["option-btn", { "option-btn-selected": v._selected }])
188
+ },
189
+ $(v._selected ? "✓ 已选" : "选择"),
190
+ 3
191
+ /* TEXT, CLASS */
192
+ )
193
+ ], 10, rt))),
194
+ 128
195
+ /* KEYED_FRAGMENT */
196
+ ))
197
+ ]),
198
+ x(" iOS 安全区占位 "),
199
+ y[1] || (y[1] = l(
200
+ "div",
201
+ { class: "safe-area-bottom" },
202
+ null,
203
+ -1
204
+ /* CACHED */
205
+ ))
206
+ ])
207
+ ])) : x("v-if", !0)
208
+ ]),
209
+ _: 1
210
+ /* STABLE */
211
+ })
212
+ ]);
213
+ };
214
+ }
215
+ }), dt = /* @__PURE__ */ Y(ut, [["__scopeId", "data-v-352c2c2f"]]), vt = { class: "ctrl-cascader" }, ft = ["aria-label"], mt = { class: "panel-header" }, pt = { class: "panel-title" }, ht = {
216
+ key: 0,
217
+ class: "panel-path"
218
+ }, gt = {
219
+ class: "panel-body",
220
+ role: "listbox"
221
+ }, yt = ["onClick"], kt = { class: "option-text" }, bt = {
222
+ key: 0,
223
+ class: "option-arrow"
224
+ }, _t = {
225
+ key: 0,
226
+ class: "option-empty"
227
+ }, Ct = /* @__PURE__ */ U({
228
+ __name: "CascaderControl",
229
+ props: {
230
+ item: {},
231
+ field: {},
232
+ formCore: {}
233
+ },
234
+ emits: ["change"],
235
+ setup(t, { emit: n }) {
236
+ const e = t, r = n, f = E(!1), p = E([]), m = b(() => {
237
+ var v;
238
+ return ((v = e.item) == null ? void 0 : v.initOptions) || [];
239
+ }), h = b(() => {
240
+ var v;
241
+ return p.value.length === 0 ? m.value : ((v = p.value[p.value.length - 1]) == null ? void 0 : v.child) || [];
242
+ }), g = b(() => {
243
+ var T, A;
244
+ const v = (T = e.field) == null ? void 0 : T.value;
245
+ if (!v) return "";
246
+ if (typeof v == "object" && v !== null) {
247
+ if (Array.isArray(v.pathNames)) return v.pathNames.join(" / ");
248
+ if (v.name) return String(v.name);
249
+ if (v.showValue) return String(v.showValue);
250
+ }
251
+ return (A = e.field) != null && A.showValue ? String(e.field.showValue) : String(v);
252
+ }), a = b(() => {
253
+ var v;
254
+ return ((v = e.item.props) == null ? void 0 : v.dialogTitle) || e.item.label || "请选择";
255
+ });
256
+ function o() {
257
+ var v;
258
+ (v = e.field) != null && v.disabled || (p.value = [], f.value = !0);
259
+ }
260
+ function c() {
261
+ f.value = !1;
262
+ }
263
+ function y(v) {
264
+ const T = [...p.value, v];
265
+ if (v.child && v.child.length > 0) {
266
+ p.value = T;
267
+ return;
268
+ }
269
+ r("change", {
270
+ value: {
271
+ code: v.code,
272
+ name: v.name,
273
+ pathCodes: T.map((A) => A.code),
274
+ pathNames: T.map((A) => A.name)
275
+ },
276
+ eventType: "pickChange"
277
+ }), f.value = !1;
278
+ }
279
+ function M() {
280
+ p.value = p.value.slice(0, -1);
281
+ }
282
+ return (v, T) => {
283
+ var A;
284
+ return s(), i("div", vt, [
285
+ l(
286
+ "div",
287
+ {
288
+ class: K(["cascader-trigger", { disabled: (A = t.field) == null ? void 0 : A.disabled, placeholder: !g.value }]),
289
+ onClick: o
290
+ },
291
+ [
292
+ l(
293
+ "span",
294
+ null,
295
+ $(g.value || t.item.placeholder || "请选择"),
296
+ 1
297
+ /* TEXT */
298
+ )
299
+ ],
300
+ 2
301
+ /* CLASS */
302
+ ),
303
+ se(ie, { name: "panel" }, {
304
+ default: te(() => [
305
+ f.value ? (s(), i("div", {
306
+ key: 0,
307
+ class: "cascader-overlay",
308
+ onClick: c
309
+ }, [
310
+ l("div", {
311
+ class: "cascader-panel",
312
+ role: "dialog",
313
+ "aria-label": a.value,
314
+ onClick: T[0] || (T[0] = ae(() => {
315
+ }, ["stop"]))
316
+ }, [
317
+ l("div", mt, [
318
+ p.value.length ? (s(), i("button", {
319
+ key: 0,
320
+ type: "button",
321
+ class: "panel-back",
322
+ "aria-label": "返回上一级",
323
+ onClick: M
324
+ }, " ‹ ")) : x("v-if", !0),
325
+ l(
326
+ "span",
327
+ pt,
328
+ $(a.value),
329
+ 1
330
+ /* TEXT */
331
+ ),
332
+ l("button", {
333
+ type: "button",
334
+ class: "panel-close",
335
+ "aria-label": "关闭",
336
+ onClick: c
337
+ }, "×")
338
+ ]),
339
+ p.value.length ? (s(), i(
340
+ "div",
341
+ ht,
342
+ $(p.value.map((L) => L.name).join(" / ")),
343
+ 1
344
+ /* TEXT */
345
+ )) : x("v-if", !0),
346
+ l("div", gt, [
347
+ (s(!0), i(
348
+ q,
349
+ null,
350
+ W(h.value, (L) => {
351
+ var P;
352
+ return s(), i("div", {
353
+ key: L.code,
354
+ class: "option-card",
355
+ role: "option",
356
+ onClick: (u) => y(L)
357
+ }, [
358
+ l(
359
+ "span",
360
+ kt,
361
+ $(L.name),
362
+ 1
363
+ /* TEXT */
364
+ ),
365
+ (P = L.child) != null && P.length ? (s(), i("span", bt, "›")) : x("v-if", !0)
366
+ ], 8, yt);
367
+ }),
368
+ 128
369
+ /* KEYED_FRAGMENT */
370
+ )),
371
+ h.value.length ? x("v-if", !0) : (s(), i("div", _t, "暂无选项"))
372
+ ]),
373
+ T[1] || (T[1] = l(
374
+ "div",
375
+ { class: "safe-area-bottom" },
376
+ null,
377
+ -1
378
+ /* CACHED */
379
+ ))
380
+ ], 8, ft)
381
+ ])) : x("v-if", !0)
382
+ ]),
383
+ _: 1
384
+ /* STABLE */
385
+ })
386
+ ]);
387
+ };
388
+ }
389
+ }), $t = /* @__PURE__ */ Y(Ct, [["__scopeId", "data-v-a66f7439"]]), Tt = { class: "ctrl-search" }, wt = ["value", "placeholder", "disabled"], St = {
390
+ key: 0,
391
+ class: "search-icon loading"
392
+ }, xt = ["onClick"], At = { class: "result-name" }, It = {
393
+ key: 0,
394
+ class: "result-code"
395
+ }, Ot = {
396
+ key: 0,
397
+ class: "search-hint"
398
+ }, Mt = /* @__PURE__ */ U({
399
+ __name: "SearchControl",
400
+ props: {
401
+ item: {},
402
+ field: {},
403
+ formCore: {}
404
+ },
405
+ emits: ["change"],
406
+ setup(t, { emit: n }) {
407
+ const e = t, r = n, f = E(""), p = E([]), m = E(!1), h = E(!1), g = E(!1), a = b(() => {
408
+ var u;
409
+ return ((u = e.item.props) == null ? void 0 : u.searchApi) || "";
410
+ }), o = E(null), c = E({});
411
+ Z(() => {
412
+ var u;
413
+ return (u = e.field) == null ? void 0 : u.value;
414
+ }, (u) => {
415
+ g.value || (u && typeof u == "object" && u.name ? f.value = u.name : typeof u == "string" && u ? f.value = u : f.value = "");
416
+ }, { immediate: !0 }), b(() => {
417
+ var k, V;
418
+ const u = (k = e.field) == null ? void 0 : k.value;
419
+ return u ? typeof u == "object" && u.name ? u.name : (V = e.field) != null && V.showValue ? e.field.showValue : String(u) : "";
420
+ });
421
+ function y() {
422
+ if (!o.value) return;
423
+ const u = o.value.getBoundingClientRect();
424
+ c.value = {
425
+ position: "fixed",
426
+ top: `${u.bottom + 2}px`,
427
+ left: `${u.left}px`,
428
+ width: `${u.width}px`
429
+ };
430
+ }
431
+ let M = null;
432
+ function v(u) {
433
+ const k = u.target;
434
+ f.value = k.value, g.value = !0, M && clearTimeout(M), M = setTimeout(() => {
435
+ f.value.trim() ? T(f.value.trim()) : (p.value = [], m.value = !1);
436
+ }, 200);
437
+ }
438
+ async function T(u) {
439
+ if (a.value) {
440
+ h.value = !0;
441
+ try {
442
+ const k = await e.formCore.fetchApi(a.value, { keywords: u }), V = Array.isArray(k) ? k : (k == null ? void 0 : k.data) || (k == null ? void 0 : k.list) || [];
443
+ p.value = V, V.length > 0 && (y(), m.value = !0);
444
+ } catch {
445
+ p.value = [], m.value = !1;
446
+ } finally {
447
+ h.value = !1;
448
+ }
449
+ }
450
+ }
451
+ function A(u) {
452
+ r("change", { value: u.name, eventType: "searchChange" }), f.value = u.name, g.value = !1, m.value = !1;
453
+ }
454
+ function L() {
455
+ p.value.length > 0 && f.value && (y(), m.value = !0);
456
+ }
457
+ function P() {
458
+ m.value = !1, p.value = [], g.value && r("change", { value: f.value.trim(), eventType: "inputBlur" }), g.value = !1;
459
+ }
460
+ return (u, k) => {
461
+ var V;
462
+ return s(), i("div", Tt, [
463
+ l(
464
+ "div",
465
+ {
466
+ ref_key: "wrapRef",
467
+ ref: o,
468
+ class: "search-input-wrap"
469
+ },
470
+ [
471
+ l("input", {
472
+ class: "search-input",
473
+ type: "text",
474
+ value: f.value,
475
+ placeholder: t.item.placeholder || "请输入关键词搜索",
476
+ disabled: (V = t.field) == null ? void 0 : V.disabled,
477
+ onInput: v,
478
+ onFocus: L,
479
+ onBlur: P
480
+ }, null, 40, wt),
481
+ h.value ? (s(), i("span", St, "⏳")) : x("v-if", !0)
482
+ ],
483
+ 512
484
+ /* NEED_PATCH */
485
+ ),
486
+ x(" 下拉结果列表 — Teleport 到 body,fixed 定位避免被父容器裁剪 "),
487
+ (s(), ee(Ie, { to: "body" }, [
488
+ m.value && p.value.length > 0 ? (s(), i(
489
+ "div",
490
+ {
491
+ key: 0,
492
+ class: "search-dropdown",
493
+ style: re(c.value)
494
+ },
495
+ [
496
+ (s(!0), i(
497
+ q,
498
+ null,
499
+ W(p.value, (d) => (s(), i("div", {
500
+ key: d.code,
501
+ class: "search-result-item",
502
+ onMousedown: k[0] || (k[0] = ae(() => {
503
+ }, ["prevent"])),
504
+ onClick: (_) => A(d)
505
+ }, [
506
+ l(
507
+ "span",
508
+ At,
509
+ $(d.name),
510
+ 1
511
+ /* TEXT */
512
+ ),
513
+ d.code ? (s(), i(
514
+ "span",
515
+ It,
516
+ $(d.code),
517
+ 1
518
+ /* TEXT */
519
+ )) : x("v-if", !0)
520
+ ], 40, xt))),
521
+ 128
522
+ /* KEYED_FRAGMENT */
523
+ ))
524
+ ],
525
+ 4
526
+ /* STYLE */
527
+ )) : x("v-if", !0)
528
+ ])),
529
+ a.value ? x("v-if", !0) : (s(), i("div", Ot, " ⚠ 未配置 searchApi "))
530
+ ]);
531
+ };
532
+ }
533
+ }), Vt = /* @__PURE__ */ Y(Mt, [["__scopeId", "data-v-1e915735"]]), Et = { class: "ctrl-address" }, Pt = { class: "addr-hd" }, Ft = { class: "addr-crumbs" }, Dt = ["onClick"], Rt = { class: "addr-body" }, Nt = {
534
+ key: 0,
535
+ class: "addr-loading"
536
+ }, Lt = ["onClick"], jt = {
537
+ key: 0,
538
+ class: "addr-check"
539
+ }, Bt = {
540
+ key: 1,
541
+ class: "addr-empty"
542
+ }, Kt = /* @__PURE__ */ U({
543
+ __name: "AddressControl",
544
+ props: {
545
+ item: {},
546
+ field: {},
547
+ formCore: {},
548
+ onFetchLinkage: {}
549
+ },
550
+ emits: ["change"],
551
+ setup(t, { emit: n }) {
552
+ const e = t, r = n, f = b(() => {
553
+ var d, _;
554
+ return ((_ = (d = e.item) == null ? void 0 : d.props) == null ? void 0 : _.linkageUrl) || "service/geo_code";
555
+ }), p = b(() => {
556
+ var d, _;
557
+ return ((_ = (d = e.item) == null ? void 0 : d.props) == null ? void 0 : _.mapLevel) || 3;
558
+ }), m = E(!1), h = E(0), g = E(!1), a = E(!1), o = E([]), c = E([{ adcode: "", name: "请选择" }]), y = /* @__PURE__ */ new Map(), M = b(() => {
559
+ var _, I, w;
560
+ const d = (_ = e.field) == null ? void 0 : _.value;
561
+ if (Array.isArray(d) && d.length) return d.map((O) => O.name).join("");
562
+ if ((I = e.field) != null && I.showValue) return e.field.showValue;
563
+ if (d && typeof d == "object") {
564
+ const O = [d.province, d.city, d.country].filter(Boolean);
565
+ if (O.length) return O.join("");
566
+ }
567
+ return (w = e.field) != null && w.province ? [e.field.province, e.field.city, e.field.country].filter(Boolean).join("") : typeof d == "string" && d ? d : "";
568
+ }), v = b(() => c.value.slice(0, p.value));
569
+ function T() {
570
+ var d;
571
+ return e.onFetchLinkage ? e.onFetchLinkage : (d = e.formCore) != null && d._linkageFetcher ? e.formCore._linkageFetcher : async () => ({ data: [] });
572
+ }
573
+ async function A(d) {
574
+ var O, S, C;
575
+ g.value = !0;
576
+ const _ = T(), I = c.value.filter((j) => j.adcode), w = {
577
+ province_code: ((O = I[0]) == null ? void 0 : O.adcode) || "",
578
+ city_code: ((S = I[1]) == null ? void 0 : S.adcode) || "",
579
+ district_code: ((C = I[2]) == null ? void 0 : C.adcode) || ""
580
+ };
581
+ try {
582
+ const j = await _(w, f.value);
583
+ if (j.data === null) {
584
+ c.value = c.value.filter((B) => B.adcode), a.value = !0, g.value = !1, V();
585
+ return;
586
+ }
587
+ o.value = j.data || [];
588
+ const z = d || w.district_code || w.city_code || w.province_code || "root";
589
+ o.value.length > 0 && y.set(z, o.value);
590
+ } catch {
591
+ } finally {
592
+ g.value = !1;
593
+ }
594
+ }
595
+ function L() {
596
+ var I, w;
597
+ if ((I = e.field) != null && I.disabled) return;
598
+ h.value = 0;
599
+ const d = (w = e.field) == null ? void 0 : w.value;
600
+ Array.isArray(d) && d.length && d[0].code ? (c.value = d.map((O) => ({ adcode: O.code, name: O.name })), a.value = c.value.length >= 2) : (c.value = [{ adcode: "", name: "请选择" }], a.value = !1), m.value = !0;
601
+ const _ = y.get("root");
602
+ _ ? o.value = _ : A("root");
603
+ }
604
+ function P() {
605
+ m.value = !1;
606
+ }
607
+ function u(d) {
608
+ if (g.value || !d.adcode) return;
609
+ const _ = { 71e4: 1, 81e4: 2, 82e4: 2 }, I = [...c.value];
610
+ d.brother = o.value, I[h.value] = d;
611
+ const w = _[d.adcode];
612
+ if (w !== void 0) {
613
+ I.splice(w, I.length - w), c.value = I.filter((C) => C.adcode), a.value = !0, V();
614
+ return;
615
+ }
616
+ if (h.value < p.value - 1 && (I[h.value + 1] = { adcode: "", name: "" }, I.splice(h.value + 2)), h.value += 1, c.value = I.slice(0, p.value), I.filter((C) => C.adcode).length >= p.value) {
617
+ a.value = !0, V();
618
+ return;
619
+ }
620
+ const S = y.get(d.adcode);
621
+ S ? o.value = S : A(d.adcode);
622
+ }
623
+ function k(d) {
624
+ var w;
625
+ h.value = d, a.value = !1;
626
+ const _ = c.value.slice(0, d + 1);
627
+ _[d].adcode || (_[d] = { adcode: "", name: "请选择" }), c.value = _;
628
+ const I = c.value[d];
629
+ if (I.adcode && I.brother)
630
+ o.value = I.brother;
631
+ else {
632
+ const O = d > 0 ? (w = c.value[d - 1]) == null ? void 0 : w.adcode : "root", S = y.get(O);
633
+ S ? o.value = S : A(O);
634
+ }
635
+ }
636
+ function V() {
637
+ const d = c.value.filter((w) => w.adcode);
638
+ if (d.length === 0) return;
639
+ const _ = d.map((w) => ({ code: w.adcode, name: w.name })), I = { showValue: "" };
640
+ _.forEach((w, O) => {
641
+ I.showValue += w.name, O === 0 && (I.province_code = w.code, I.province = w.name), O === 1 && (I.city_code = w.code, I.city = w.name), O === 2 && (I.country_code = w.code, I.country = w.name);
642
+ }), r("change", { value: _, eventType: "pickChange", ...I }), m.value = !1;
643
+ }
644
+ return Z(() => {
645
+ var d;
646
+ return (d = e.field) == null ? void 0 : d.value;
647
+ }, (d) => {
648
+ !m.value && Array.isArray(d) && d.length && (c.value = d.map((_) => ({ adcode: _.code, name: _.name })));
649
+ }), (d, _) => {
650
+ var I;
651
+ return s(), i("div", Et, [
652
+ l(
653
+ "div",
654
+ {
655
+ class: K(["address-trigger", { disabled: (I = t.field) == null ? void 0 : I.disabled, placeholder: !M.value }]),
656
+ onClick: L
657
+ },
658
+ [
659
+ l(
660
+ "span",
661
+ null,
662
+ $(M.value || t.item.placeholder || "请选择省市区"),
663
+ 1
664
+ /* TEXT */
665
+ )
666
+ ],
667
+ 2
668
+ /* CLASS */
669
+ ),
670
+ se(ie, { name: "addr-fade" }, {
671
+ default: te(() => [
672
+ m.value ? (s(), i("div", {
673
+ key: 0,
674
+ class: "addr-mask",
675
+ onClick: P
676
+ }, [
677
+ se(ie, { name: "addr-slide" }, {
678
+ default: te(() => [
679
+ m.value ? (s(), i("div", {
680
+ key: 0,
681
+ class: "addr-panel",
682
+ onClick: _[1] || (_[1] = ae(() => {
683
+ }, ["stop"]))
684
+ }, [
685
+ l("div", Pt, [
686
+ l("span", {
687
+ class: "addr-hd-cancel",
688
+ onClick: P
689
+ }, "取消"),
690
+ _[2] || (_[2] = l(
691
+ "span",
692
+ { class: "addr-hd-title" },
693
+ "选择地址",
694
+ -1
695
+ /* CACHED */
696
+ )),
697
+ l(
698
+ "span",
699
+ {
700
+ class: K(["addr-hd-ok", { on: a.value }]),
701
+ onClick: _[0] || (_[0] = (w) => a.value ? V() : null)
702
+ },
703
+ "确定",
704
+ 2
705
+ /* CLASS */
706
+ )
707
+ ]),
708
+ l("div", Ft, [
709
+ (s(!0), i(
710
+ q,
711
+ null,
712
+ W(v.value, (w, O) => (s(), i(
713
+ q,
714
+ { key: O },
715
+ [
716
+ l(
717
+ "span",
718
+ {
719
+ class: K(["addr-dot", { cur: O === h.value, done: !!w.adcode && O < h.value }])
720
+ },
721
+ null,
722
+ 2
723
+ /* CLASS */
724
+ ),
725
+ l("span", {
726
+ class: K(["addr-label", { cur: O === h.value, done: !!w.adcode }]),
727
+ onClick: (S) => w.adcode ? k(O) : null
728
+ }, $(w.adcode ? w.name : "请选择"), 11, Dt),
729
+ O < v.value.length - 1 ? (s(), i(
730
+ "span",
731
+ {
732
+ key: 0,
733
+ class: K(["addr-line", { done: !!w.adcode && O < h.value }])
734
+ },
735
+ null,
736
+ 2
737
+ /* CLASS */
738
+ )) : x("v-if", !0)
739
+ ],
740
+ 64
741
+ /* STABLE_FRAGMENT */
742
+ ))),
743
+ 128
744
+ /* KEYED_FRAGMENT */
745
+ ))
746
+ ]),
747
+ l("div", Rt, [
748
+ g.value ? (s(), i("div", Nt, [..._[3] || (_[3] = [
749
+ l(
750
+ "span",
751
+ { class: "addr-spinner" },
752
+ null,
753
+ -1
754
+ /* CACHED */
755
+ ),
756
+ X(
757
+ "加载中...",
758
+ -1
759
+ /* CACHED */
760
+ )
761
+ ])])) : x("v-if", !0),
762
+ (s(!0), i(
763
+ q,
764
+ null,
765
+ W(o.value, (w) => {
766
+ var O, S;
767
+ return s(), i("div", {
768
+ key: w.adcode,
769
+ class: K(["addr-item", { sel: ((O = c.value[h.value]) == null ? void 0 : O.adcode) === w.adcode }]),
770
+ onClick: (C) => u(w)
771
+ }, [
772
+ l(
773
+ "span",
774
+ null,
775
+ $(w.name),
776
+ 1
777
+ /* TEXT */
778
+ ),
779
+ ((S = c.value[h.value]) == null ? void 0 : S.adcode) === w.adcode ? (s(), i("span", jt, "✓")) : x("v-if", !0)
780
+ ], 10, Lt);
781
+ }),
782
+ 128
783
+ /* KEYED_FRAGMENT */
784
+ )),
785
+ !g.value && o.value.length === 0 ? (s(), i("div", Bt, "暂无数据")) : x("v-if", !0)
786
+ ]),
787
+ _[4] || (_[4] = l(
788
+ "div",
789
+ { class: "addr-safe" },
790
+ null,
791
+ -1
792
+ /* CACHED */
793
+ ))
794
+ ])) : x("v-if", !0)
795
+ ]),
796
+ _: 1
797
+ /* STABLE */
798
+ })
799
+ ])) : x("v-if", !0)
800
+ ]),
801
+ _: 1
802
+ /* STABLE */
803
+ })
804
+ ]);
805
+ };
806
+ }
807
+ }), Ut = /* @__PURE__ */ Y(Kt, [["__scopeId", "data-v-e9b83ac3"]]), Ht = { class: "ctrl-agreement" }, Yt = {
808
+ key: 0,
809
+ class: "check-mark"
810
+ }, qt = { class: "agreement-text" }, zt = /* @__PURE__ */ U({
811
+ __name: "AgreementControl",
812
+ props: {
813
+ item: {},
814
+ field: {},
815
+ formCore: {}
816
+ },
817
+ emits: ["change"],
818
+ setup(t, { emit: n }) {
819
+ const e = t, r = n, f = b(() => {
820
+ var a;
821
+ return ((a = e.item.props) == null ? void 0 : a.trueValue) ?? "true";
822
+ }), p = b(() => {
823
+ var a;
824
+ return ((a = e.item.props) == null ? void 0 : a.falseValue) ?? "";
825
+ }), m = b(() => {
826
+ var o;
827
+ const a = (o = e.field) == null ? void 0 : o.value;
828
+ return a === f.value || a === !0 || a === 1 || a === "1";
829
+ }), h = b(
830
+ () => {
831
+ var a;
832
+ return e.item.label || ((a = e.item.props) == null ? void 0 : a.guideText) || "本人已阅读并同意相关协议";
833
+ }
834
+ );
835
+ function g() {
836
+ var o;
837
+ if ((o = e.field) != null && o.disabled) return;
838
+ const a = m.value ? p.value : f.value;
839
+ r("change", { value: a, eventType: "pickChange" });
840
+ }
841
+ return (a, o) => {
842
+ var c;
843
+ return s(), i("div", Ht, [
844
+ l("label", {
845
+ class: "agreement-row",
846
+ onClick: ae(g, ["prevent"])
847
+ }, [
848
+ l(
849
+ "span",
850
+ {
851
+ class: K(["checkbox", { checked: m.value, disabled: (c = t.field) == null ? void 0 : c.disabled }])
852
+ },
853
+ [
854
+ m.value ? (s(), i("span", Yt, "✓")) : x("v-if", !0)
855
+ ],
856
+ 2
857
+ /* CLASS */
858
+ ),
859
+ l(
860
+ "span",
861
+ qt,
862
+ $(h.value),
863
+ 1
864
+ /* TEXT */
865
+ )
866
+ ])
867
+ ]);
868
+ };
869
+ }
870
+ }), Gt = /* @__PURE__ */ Y(zt, [["__scopeId", "data-v-16bbffa8"]]), Wt = { class: "task-label" }, Jt = { class: "modal-card" }, Xt = { class: "modal-header" }, Qt = { class: "modal-body" }, Zt = ["onUpdate:modelValue", "placeholder"], el = /* @__PURE__ */ U({
871
+ __name: "SubFormTask",
872
+ props: {
873
+ item: {},
874
+ field: {},
875
+ formCore: {}
876
+ },
877
+ setup(t) {
878
+ const n = t, e = E(!1), r = E({}), f = b(() => {
879
+ var y;
880
+ const o = (y = n.item.props) == null ? void 0 : y.taskType, c = {
881
+ contact_info: [
882
+ { label: "联系人姓名", key: "name", placeholder: "请输入姓名" },
883
+ { label: "关系", key: "relation", placeholder: "如:朋友、同事" },
884
+ { label: "联系电话", key: "phone", placeholder: "请输入手机号" }
885
+ ],
886
+ business_info: [
887
+ { label: "企业名称", key: "company", placeholder: "请输入企业名称" },
888
+ { label: "经营范围", key: "scope", placeholder: "请输入经营范围" }
889
+ ],
890
+ card_info_auth: [
891
+ { label: "姓名", key: "name", placeholder: "请输入姓名" },
892
+ { label: "身份证号", key: "idNumber", placeholder: "请输入身份证号" }
893
+ ],
894
+ default: [
895
+ { label: "字段1", key: "field1", placeholder: "请输入" },
896
+ { label: "字段2", key: "field2", placeholder: "请输入" }
897
+ ]
898
+ };
899
+ return c[o] || c.default;
900
+ });
901
+ function p() {
902
+ r.value = {}, f.value.forEach((o) => {
903
+ r.value[o.key] = "";
904
+ }), e.value = !0;
905
+ }
906
+ function m() {
907
+ e.value = !1, Q(n.formCore, n.item.key, {
908
+ ...r.value,
909
+ _completed: !0,
910
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
911
+ });
912
+ }
913
+ function h() {
914
+ e.value = !1;
915
+ }
916
+ function g(o) {
917
+ o.stopPropagation(), o.target === o.currentTarget && h();
918
+ }
919
+ const a = b(() => {
920
+ var c;
921
+ const o = (c = n.field) == null ? void 0 : c.value;
922
+ return o && typeof o == "object" && o._completed;
923
+ });
924
+ return (o, c) => (s(), i("div", {
925
+ class: "task-subform",
926
+ onClick: p
927
+ }, [
928
+ l(
929
+ "div",
930
+ {
931
+ class: K(["task-trigger", { completed: a.value }])
932
+ },
933
+ [
934
+ c[0] || (c[0] = l(
935
+ "span",
936
+ { class: "task-icon" },
937
+ "📋",
938
+ -1
939
+ /* CACHED */
940
+ )),
941
+ l(
942
+ "span",
943
+ Wt,
944
+ $(a.value ? "✅ 已完成" : t.item.placeholder || "点击填写子表单"),
945
+ 1
946
+ /* TEXT */
947
+ ),
948
+ c[1] || (c[1] = l(
949
+ "span",
950
+ { class: "task-arrow" },
951
+ "▸",
952
+ -1
953
+ /* CACHED */
954
+ ))
955
+ ],
956
+ 2
957
+ /* CLASS */
958
+ ),
959
+ x(" Modal "),
960
+ e.value ? (s(), i("div", {
961
+ key: 0,
962
+ class: "modal-overlay",
963
+ onClick: g
964
+ }, [
965
+ l("div", Jt, [
966
+ l("div", Xt, [
967
+ l(
968
+ "span",
969
+ null,
970
+ $(t.item.label || "子表单"),
971
+ 1
972
+ /* TEXT */
973
+ ),
974
+ l("button", {
975
+ class: "modal-close",
976
+ onClick: h
977
+ }, "✕")
978
+ ]),
979
+ l("div", Qt, [
980
+ (s(!0), i(
981
+ q,
982
+ null,
983
+ W(f.value, (y) => (s(), i("div", {
984
+ key: y.key,
985
+ class: "modal-field"
986
+ }, [
987
+ l(
988
+ "label",
989
+ null,
990
+ $(y.label),
991
+ 1
992
+ /* TEXT */
993
+ ),
994
+ Oe(l("input", {
995
+ "onUpdate:modelValue": (M) => r.value[y.key] = M,
996
+ placeholder: y.placeholder,
997
+ class: "modal-input"
998
+ }, null, 8, Zt), [
999
+ [Me, r.value[y.key]]
1000
+ ])
1001
+ ]))),
1002
+ 128
1003
+ /* KEYED_FRAGMENT */
1004
+ ))
1005
+ ]),
1006
+ l("div", { class: "modal-footer" }, [
1007
+ l("button", {
1008
+ class: "btn-cancel",
1009
+ onClick: h
1010
+ }, "取消"),
1011
+ l("button", {
1012
+ class: "btn-confirm",
1013
+ onClick: m
1014
+ }, "确认")
1015
+ ])
1016
+ ])
1017
+ ])) : x("v-if", !0)
1018
+ ]));
1019
+ }
1020
+ }), ge = /* @__PURE__ */ Y(el, [["__scopeId", "data-v-f15e7819"]]), tl = { class: "task-label" }, ll = { class: "confirm-card" }, al = { class: "confirm-url" }, nl = /* @__PURE__ */ U({
1021
+ __name: "H5JumpTask",
1022
+ props: {
1023
+ item: {},
1024
+ field: {},
1025
+ formCore: {}
1026
+ },
1027
+ setup(t) {
1028
+ const n = t, e = E(!1), r = b(() => {
1029
+ var a, o;
1030
+ return ((a = n.item.props) == null ? void 0 : a.h5link) || ((o = n.item.props) == null ? void 0 : o.taxLink) || "https://example.com/task";
1031
+ });
1032
+ function f() {
1033
+ e.value = !0;
1034
+ }
1035
+ function p() {
1036
+ e.value = !1, setTimeout(() => {
1037
+ Q(n.formCore, n.item.key, {
1038
+ url: r.value,
1039
+ _completed: !0,
1040
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString(),
1041
+ _mock: "模拟 H5 跳转已返回"
1042
+ });
1043
+ }, 500);
1044
+ }
1045
+ function m() {
1046
+ e.value = !1;
1047
+ }
1048
+ function h(a, o) {
1049
+ a.stopPropagation(), a.target === a.currentTarget && o();
1050
+ }
1051
+ const g = b(() => {
1052
+ var o;
1053
+ const a = (o = n.field) == null ? void 0 : o.value;
1054
+ return a && typeof a == "object" && a._completed;
1055
+ });
1056
+ return (a, o) => (s(), i("div", {
1057
+ class: "task-h5",
1058
+ onClick: f
1059
+ }, [
1060
+ l(
1061
+ "div",
1062
+ {
1063
+ class: K(["task-trigger", { completed: g.value }])
1064
+ },
1065
+ [
1066
+ o[1] || (o[1] = l(
1067
+ "span",
1068
+ { class: "task-icon" },
1069
+ "🌐",
1070
+ -1
1071
+ /* CACHED */
1072
+ )),
1073
+ l(
1074
+ "span",
1075
+ tl,
1076
+ $(g.value ? "✅ 已完成" : t.item.placeholder || "点击跳转 H5 页面"),
1077
+ 1
1078
+ /* TEXT */
1079
+ ),
1080
+ o[2] || (o[2] = l(
1081
+ "span",
1082
+ { class: "task-badge" },
1083
+ "H5",
1084
+ -1
1085
+ /* CACHED */
1086
+ )),
1087
+ o[3] || (o[3] = l(
1088
+ "span",
1089
+ { class: "task-arrow" },
1090
+ "▸",
1091
+ -1
1092
+ /* CACHED */
1093
+ ))
1094
+ ],
1095
+ 2
1096
+ /* CLASS */
1097
+ ),
1098
+ x(" 确认弹窗 "),
1099
+ e.value ? (s(), i("div", {
1100
+ key: 0,
1101
+ class: "modal-overlay",
1102
+ onClick: o[0] || (o[0] = (c) => h(c, m))
1103
+ }, [
1104
+ l("div", ll, [
1105
+ o[4] || (o[4] = l(
1106
+ "div",
1107
+ { class: "confirm-icon" },
1108
+ "🌐",
1109
+ -1
1110
+ /* CACHED */
1111
+ )),
1112
+ o[5] || (o[5] = l(
1113
+ "div",
1114
+ { class: "confirm-title" },
1115
+ "即将跳转到外部页面",
1116
+ -1
1117
+ /* CACHED */
1118
+ )),
1119
+ l(
1120
+ "div",
1121
+ al,
1122
+ $(r.value),
1123
+ 1
1124
+ /* TEXT */
1125
+ ),
1126
+ o[6] || (o[6] = l(
1127
+ "div",
1128
+ { class: "confirm-hint" },
1129
+ "(Demo 模拟:实际将打开外部链接)",
1130
+ -1
1131
+ /* CACHED */
1132
+ )),
1133
+ l("div", { class: "confirm-actions" }, [
1134
+ l("button", {
1135
+ class: "btn-cancel",
1136
+ onClick: m
1137
+ }, "取消"),
1138
+ l("button", {
1139
+ class: "btn-confirm",
1140
+ onClick: p
1141
+ }, "确认跳转")
1142
+ ])
1143
+ ])
1144
+ ])) : x("v-if", !0)
1145
+ ]));
1146
+ }
1147
+ }), ol = /* @__PURE__ */ Y(nl, [["__scopeId", "data-v-2f7717cb"]]), sl = { class: "task-icon" }, il = { class: "task-label" }, rl = { class: "sig-card" }, cl = { class: "sig-header" }, ul = { class: "sig-body" }, dl = {
1148
+ key: 0,
1149
+ class: "sig-placeholder"
1150
+ }, vl = { class: "sig-footer" }, fl = ["disabled"], ml = { class: "map-card" }, pl = { class: "map-header" }, hl = { class: "native-card" }, gl = { class: "native-icon" }, yl = { class: "native-title" }, kl = { class: "native-desc" }, bl = { class: "native-actions" }, _l = /* @__PURE__ */ U({
1151
+ __name: "NativeTask",
1152
+ props: {
1153
+ item: {},
1154
+ field: {},
1155
+ formCore: {}
1156
+ },
1157
+ setup(t) {
1158
+ Ve((S) => ({
1159
+ v9ce02c4c: O.value
1160
+ }));
1161
+ const n = t, e = b(() => {
1162
+ var S;
1163
+ return ((S = n.item.props) == null ? void 0 : S.taskType) || "";
1164
+ }), r = E(!1), f = E(null), p = E(!1), m = E(null), h = E(!1);
1165
+ function g() {
1166
+ r.value = !0, h.value = !1, Ee(() => {
1167
+ const S = f.value;
1168
+ if (!S) return;
1169
+ const C = window.devicePixelRatio || 1, j = S.getBoundingClientRect();
1170
+ S.width = j.width * C, S.height = j.height * C;
1171
+ const z = S.getContext("2d");
1172
+ z.scale(C, C), z.strokeStyle = "#333", z.lineWidth = 3, z.lineCap = "round", z.lineJoin = "round", m.value = z;
1173
+ });
1174
+ }
1175
+ function a(S) {
1176
+ const j = f.value.getBoundingClientRect(), z = "touches" in S ? S.touches[0].clientX : S.clientX, B = "touches" in S ? S.touches[0].clientY : S.clientY;
1177
+ return { x: z - j.left, y: B - j.top };
1178
+ }
1179
+ function o(S) {
1180
+ S.preventDefault(), p.value = !0, h.value = !0;
1181
+ const { x: C, y: j } = a(S);
1182
+ m.value.beginPath(), m.value.moveTo(C, j);
1183
+ }
1184
+ function c(S) {
1185
+ if (S.preventDefault(), !p.value) return;
1186
+ const { x: C, y: j } = a(S);
1187
+ m.value.lineTo(C, j), m.value.stroke();
1188
+ }
1189
+ function y() {
1190
+ p.value = !1;
1191
+ }
1192
+ function M() {
1193
+ const S = f.value;
1194
+ m.value.clearRect(0, 0, S.width, S.height), h.value = !1;
1195
+ }
1196
+ function v() {
1197
+ const S = f.value.toDataURL("image/png");
1198
+ r.value = !1, Q(n.formCore, n.item.key, {
1199
+ signatureDataUrl: S,
1200
+ _completed: !0,
1201
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
1202
+ });
1203
+ }
1204
+ function T() {
1205
+ r.value = !1;
1206
+ }
1207
+ const A = E(!1);
1208
+ function L() {
1209
+ A.value = !0;
1210
+ }
1211
+ function P() {
1212
+ A.value = !1, Q(n.formCore, n.item.key, {
1213
+ lng: 116.404 + Math.random() * 0.1,
1214
+ lat: 39.915 + Math.random() * 0.1,
1215
+ address: `模拟选点地址 ${Date.now()}`,
1216
+ _completed: !0,
1217
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
1218
+ });
1219
+ }
1220
+ const u = E(!1);
1221
+ function k() {
1222
+ u.value = !0;
1223
+ }
1224
+ function V() {
1225
+ u.value = !1, Q(n.formCore, n.item.key, {
1226
+ _completed: !0,
1227
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString(),
1228
+ _mock: `已完成原生任务: ${e.value}`
1229
+ });
1230
+ }
1231
+ function d(S, C) {
1232
+ S.stopPropagation(), S.target === S.currentTarget && C();
1233
+ }
1234
+ function _() {
1235
+ e.value === "signature" ? g() : e.value === "map" ? L() : k();
1236
+ }
1237
+ const I = b(() => {
1238
+ var C;
1239
+ const S = (C = n.field) == null ? void 0 : C.value;
1240
+ return S && typeof S == "object" && S._completed;
1241
+ }), w = b(() => e.value === "signature" ? "✍️" : e.value === "map" ? "📍" : "📱"), O = b(() => e.value === "signature" ? "#eb2f96" : e.value === "map" ? "#2f54eb" : "#fa8c16");
1242
+ return (S, C) => (s(), i("div", {
1243
+ class: "task-native",
1244
+ onClick: _
1245
+ }, [
1246
+ l(
1247
+ "div",
1248
+ {
1249
+ class: K(["task-trigger", { completed: I.value }])
1250
+ },
1251
+ [
1252
+ l(
1253
+ "span",
1254
+ sl,
1255
+ $(w.value),
1256
+ 1
1257
+ /* TEXT */
1258
+ ),
1259
+ l(
1260
+ "span",
1261
+ il,
1262
+ $(I.value ? "✅ 已完成" : t.item.placeholder || `点击完成${t.item.label}`),
1263
+ 1
1264
+ /* TEXT */
1265
+ ),
1266
+ C[4] || (C[4] = l(
1267
+ "span",
1268
+ { class: "task-arrow" },
1269
+ "▸",
1270
+ -1
1271
+ /* CACHED */
1272
+ ))
1273
+ ],
1274
+ 2
1275
+ /* CLASS */
1276
+ ),
1277
+ x(" Signature Modal "),
1278
+ r.value ? (s(), i("div", {
1279
+ key: 0,
1280
+ class: "modal-overlay",
1281
+ onClick: C[0] || (C[0] = (j) => d(j, T))
1282
+ }, [
1283
+ l("div", rl, [
1284
+ l("div", cl, [
1285
+ l(
1286
+ "span",
1287
+ null,
1288
+ $(t.item.label || "手写签名"),
1289
+ 1
1290
+ /* TEXT */
1291
+ ),
1292
+ l("button", {
1293
+ class: "modal-close",
1294
+ onClick: T
1295
+ }, "✕")
1296
+ ]),
1297
+ l("div", ul, [
1298
+ l(
1299
+ "canvas",
1300
+ {
1301
+ ref_key: "canvasRef",
1302
+ ref: f,
1303
+ class: "sig-canvas",
1304
+ onMousedown: o,
1305
+ onMousemove: c,
1306
+ onMouseup: y,
1307
+ onMouseleave: y,
1308
+ onTouchstart: o,
1309
+ onTouchmove: c,
1310
+ onTouchend: y
1311
+ },
1312
+ null,
1313
+ 544
1314
+ /* NEED_HYDRATION, NEED_PATCH */
1315
+ ),
1316
+ h.value ? x("v-if", !0) : (s(), i("div", dl, "在此处签名"))
1317
+ ]),
1318
+ l("div", vl, [
1319
+ l("button", {
1320
+ class: "btn-clear",
1321
+ onClick: M
1322
+ }, "清除"),
1323
+ l("button", {
1324
+ class: "btn-confirm-sig",
1325
+ onClick: v,
1326
+ disabled: !h.value
1327
+ }, "确认签名", 8, fl)
1328
+ ])
1329
+ ])
1330
+ ])) : x("v-if", !0),
1331
+ x(" Map Modal "),
1332
+ A.value ? (s(), i("div", {
1333
+ key: 1,
1334
+ class: "modal-overlay",
1335
+ onClick: C[1] || (C[1] = (j) => d(j, P))
1336
+ }, [
1337
+ l("div", ml, [
1338
+ l("div", pl, [
1339
+ l(
1340
+ "span",
1341
+ null,
1342
+ $(t.item.label || "地图选点"),
1343
+ 1
1344
+ /* TEXT */
1345
+ ),
1346
+ l("button", {
1347
+ class: "modal-close",
1348
+ onClick: P
1349
+ }, "✕")
1350
+ ]),
1351
+ C[5] || (C[5] = l(
1352
+ "div",
1353
+ { class: "map-placeholder" },
1354
+ [
1355
+ l("span", { class: "map-pin" }, "📍"),
1356
+ l("p", null, "地图选点(Demo 模拟)"),
1357
+ l("p", { class: "map-hint" }, "点击任意位置确认选点")
1358
+ ],
1359
+ -1
1360
+ /* CACHED */
1361
+ )),
1362
+ l("div", { class: "map-footer" }, [
1363
+ l("button", {
1364
+ class: "btn-confirm-sig",
1365
+ onClick: P
1366
+ }, "在此位置选点")
1367
+ ])
1368
+ ])
1369
+ ])) : x("v-if", !0),
1370
+ x(" Generic Native Modal "),
1371
+ u.value ? (s(), i("div", {
1372
+ key: 2,
1373
+ class: "modal-overlay",
1374
+ onClick: C[3] || (C[3] = (j) => d(j, () => u.value = !1))
1375
+ }, [
1376
+ l("div", hl, [
1377
+ l(
1378
+ "div",
1379
+ gl,
1380
+ $(w.value),
1381
+ 1
1382
+ /* TEXT */
1383
+ ),
1384
+ l(
1385
+ "div",
1386
+ yl,
1387
+ $(t.item.label || "原生页面任务"),
1388
+ 1
1389
+ /* TEXT */
1390
+ ),
1391
+ C[6] || (C[6] = l(
1392
+ "div",
1393
+ { class: "native-hint" },
1394
+ "(Demo 模拟:实际将拉起原生页面)",
1395
+ -1
1396
+ /* CACHED */
1397
+ )),
1398
+ l(
1399
+ "div",
1400
+ kl,
1401
+ "taskType: " + $(e.value),
1402
+ 1
1403
+ /* TEXT */
1404
+ ),
1405
+ l("div", bl, [
1406
+ l("button", {
1407
+ class: "btn-cancel",
1408
+ onClick: C[2] || (C[2] = (j) => u.value = !1)
1409
+ }, "取消"),
1410
+ l("button", {
1411
+ class: "btn-confirm-sig",
1412
+ onClick: V
1413
+ }, "模拟完成")
1414
+ ])
1415
+ ])
1416
+ ])) : x("v-if", !0)
1417
+ ]));
1418
+ }
1419
+ }), ve = /* @__PURE__ */ Y(_l, [["__scopeId", "data-v-d1a3f489"]]), Cl = { class: "task-icon" }, $l = { class: "task-label" }, Tl = {
1420
+ key: 0,
1421
+ class: "spinner"
1422
+ }, wl = {
1423
+ key: 1,
1424
+ class: "task-arrow"
1425
+ }, Sl = /* @__PURE__ */ U({
1426
+ __name: "ApiTask",
1427
+ props: {
1428
+ item: {},
1429
+ field: {},
1430
+ formCore: {}
1431
+ },
1432
+ setup(t) {
1433
+ const n = t, e = E(!1), r = E(""), f = b(() => {
1434
+ var g;
1435
+ return ((g = n.item.props) == null ? void 0 : g.taskType) || "";
1436
+ }), p = b(() => Xe()[f.value]);
1437
+ async function m() {
1438
+ if (!e.value) {
1439
+ e.value = !0, r.value = "";
1440
+ try {
1441
+ if (p.value) {
1442
+ const g = await p.value(n.formCore, n.item.key);
1443
+ e.value = !1, Q(n.formCore, n.item.key, {
1444
+ ...g,
1445
+ _completed: !0,
1446
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
1447
+ });
1448
+ } else
1449
+ await new Promise((g) => setTimeout(g, 800)), e.value = !1, Q(n.formCore, n.item.key, {
1450
+ code: "00",
1451
+ data: { id: `mock_${Date.now()}`, name: `模拟${n.item.label}结果` },
1452
+ _completed: !0,
1453
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
1454
+ });
1455
+ } catch (g) {
1456
+ e.value = !1, r.value = (g == null ? void 0 : g.message) || "请求失败", setTimeout(() => {
1457
+ r.value = "";
1458
+ }, 3e3);
1459
+ }
1460
+ }
1461
+ }
1462
+ const h = b(() => {
1463
+ var a;
1464
+ const g = (a = n.field) == null ? void 0 : a.value;
1465
+ return g && typeof g == "object" && g._completed;
1466
+ });
1467
+ return (g, a) => (s(), i("div", {
1468
+ class: "task-api",
1469
+ onClick: m
1470
+ }, [
1471
+ l(
1472
+ "div",
1473
+ {
1474
+ class: K(["task-trigger", { completed: h.value, loading: e.value, error: !!r.value }])
1475
+ },
1476
+ [
1477
+ l(
1478
+ "span",
1479
+ Cl,
1480
+ $(e.value ? "⏳" : r.value ? "⚠️" : "🔌"),
1481
+ 1
1482
+ /* TEXT */
1483
+ ),
1484
+ l("span", $l, [
1485
+ e.value ? (s(), i(
1486
+ q,
1487
+ { key: 0 },
1488
+ [
1489
+ X("请求中...")
1490
+ ],
1491
+ 64
1492
+ /* STABLE_FRAGMENT */
1493
+ )) : r.value ? (s(), i(
1494
+ q,
1495
+ { key: 1 },
1496
+ [
1497
+ X(
1498
+ $(r.value),
1499
+ 1
1500
+ /* TEXT */
1501
+ )
1502
+ ],
1503
+ 64
1504
+ /* STABLE_FRAGMENT */
1505
+ )) : h.value ? (s(), i(
1506
+ q,
1507
+ { key: 2 },
1508
+ [
1509
+ X("✅ 已完成")
1510
+ ],
1511
+ 64
1512
+ /* STABLE_FRAGMENT */
1513
+ )) : (s(), i(
1514
+ q,
1515
+ { key: 3 },
1516
+ [
1517
+ X(
1518
+ $(t.item.placeholder || `点击获取${t.item.label}`),
1519
+ 1
1520
+ /* TEXT */
1521
+ )
1522
+ ],
1523
+ 64
1524
+ /* STABLE_FRAGMENT */
1525
+ ))
1526
+ ]),
1527
+ e.value ? (s(), i("span", Tl)) : (s(), i("span", wl, "▸"))
1528
+ ],
1529
+ 2
1530
+ /* CLASS */
1531
+ )
1532
+ ]));
1533
+ }
1534
+ }), xl = /* @__PURE__ */ Y(Sl, [["__scopeId", "data-v-33fee019"]]), Al = { class: "task-icon" }, Il = { class: "task-label" }, Ol = {
1535
+ key: 0,
1536
+ class: "progress-bar"
1537
+ }, Ml = /* @__PURE__ */ U({
1538
+ __name: "CustomerTask",
1539
+ props: {
1540
+ item: {},
1541
+ field: {},
1542
+ formCore: {}
1543
+ },
1544
+ setup(t) {
1545
+ const n = t, e = E(!1), r = E(0), f = b(() => {
1546
+ var g;
1547
+ return ((g = n.item.props) == null ? void 0 : g.taskType) || "";
1548
+ });
1549
+ function p() {
1550
+ if (e.value) return;
1551
+ e.value = !0, r.value = 0;
1552
+ const g = setInterval(() => {
1553
+ r.value += 20, r.value >= 100 && (clearInterval(g), e.value = !1, Q(n.formCore, n.item.key, {
1554
+ score: Math.floor(Math.random() * 30) + 70,
1555
+ passed: !0,
1556
+ _completed: !0,
1557
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
1558
+ }));
1559
+ }, 400);
1560
+ }
1561
+ const m = b(() => {
1562
+ var a;
1563
+ const g = (a = n.field) == null ? void 0 : a.value;
1564
+ return g && typeof g == "object" && g._completed;
1565
+ }), h = b(() => f.value === "face_verify_sign" ? "👤" : "📷");
1566
+ return (g, a) => (s(), i("div", {
1567
+ class: "task-customer",
1568
+ onClick: p
1569
+ }, [
1570
+ l(
1571
+ "div",
1572
+ {
1573
+ class: K(["task-trigger", { completed: m.value, loading: e.value }])
1574
+ },
1575
+ [
1576
+ l(
1577
+ "span",
1578
+ Al,
1579
+ $(h.value),
1580
+ 1
1581
+ /* TEXT */
1582
+ ),
1583
+ l(
1584
+ "span",
1585
+ Il,
1586
+ $(e.value ? "检测中..." : m.value ? "✅ 已完成" : t.item.placeholder || `点击启动${t.item.label}`),
1587
+ 1
1588
+ /* TEXT */
1589
+ ),
1590
+ a[0] || (a[0] = l(
1591
+ "span",
1592
+ { class: "task-badge" },
1593
+ "SDK",
1594
+ -1
1595
+ /* CACHED */
1596
+ ))
1597
+ ],
1598
+ 2
1599
+ /* CLASS */
1600
+ ),
1601
+ x(" Progress overlay "),
1602
+ e.value ? (s(), i("div", Ol, [
1603
+ l(
1604
+ "div",
1605
+ {
1606
+ class: "progress-fill",
1607
+ style: re({ width: r.value + "%" })
1608
+ },
1609
+ null,
1610
+ 4
1611
+ /* STYLE */
1612
+ )
1613
+ ])) : x("v-if", !0)
1614
+ ]));
1615
+ }
1616
+ }), Vl = /* @__PURE__ */ Y(Ml, [["__scopeId", "data-v-bb43982b"]]), El = { class: "task-label" }, Pl = { class: "inline-card" }, Fl = { class: "inline-link" }, Dl = /* @__PURE__ */ U({
1617
+ __name: "InlineTask",
1618
+ props: {
1619
+ item: {},
1620
+ field: {},
1621
+ formCore: {}
1622
+ },
1623
+ setup(t) {
1624
+ const n = t, e = E(!1), r = b(() => {
1625
+ var a;
1626
+ return ((a = n.item.props) == null ? void 0 : a.taxLink) || `https://tax.example.com/copy?id=${Date.now()}`;
1627
+ });
1628
+ function f() {
1629
+ e.value = !0;
1630
+ }
1631
+ function p() {
1632
+ var a;
1633
+ e.value = !1, (a = navigator.clipboard) == null || a.writeText(r.value).catch(() => {
1634
+ }), Q(n.formCore, n.item.key, {
1635
+ copied: !0,
1636
+ url: r.value,
1637
+ _completed: !0,
1638
+ _completedAt: (/* @__PURE__ */ new Date()).toISOString()
1639
+ });
1640
+ }
1641
+ function m() {
1642
+ e.value = !1;
1643
+ }
1644
+ function h(a, o) {
1645
+ a.stopPropagation(), a.target === a.currentTarget && o();
1646
+ }
1647
+ const g = b(() => {
1648
+ var o;
1649
+ const a = (o = n.field) == null ? void 0 : o.value;
1650
+ return a && typeof a == "object" && a._completed;
1651
+ });
1652
+ return (a, o) => (s(), i("div", {
1653
+ class: "task-inline",
1654
+ onClick: f
1655
+ }, [
1656
+ l(
1657
+ "div",
1658
+ {
1659
+ class: K(["task-trigger", { completed: g.value }])
1660
+ },
1661
+ [
1662
+ o[1] || (o[1] = l(
1663
+ "span",
1664
+ { class: "task-icon" },
1665
+ "🔗",
1666
+ -1
1667
+ /* CACHED */
1668
+ )),
1669
+ l(
1670
+ "span",
1671
+ El,
1672
+ $(g.value ? "✅ 已复制" : t.item.placeholder || "复制链接"),
1673
+ 1
1674
+ /* TEXT */
1675
+ ),
1676
+ o[2] || (o[2] = l(
1677
+ "span",
1678
+ { class: "task-badge" },
1679
+ "inline",
1680
+ -1
1681
+ /* CACHED */
1682
+ ))
1683
+ ],
1684
+ 2
1685
+ /* CLASS */
1686
+ ),
1687
+ x(" Confirm "),
1688
+ e.value ? (s(), i("div", {
1689
+ key: 0,
1690
+ class: "modal-overlay",
1691
+ onClick: o[0] || (o[0] = (c) => h(c, m))
1692
+ }, [
1693
+ l("div", Pl, [
1694
+ o[3] || (o[3] = l(
1695
+ "div",
1696
+ { class: "inline-icon" },
1697
+ "🔗",
1698
+ -1
1699
+ /* CACHED */
1700
+ )),
1701
+ o[4] || (o[4] = l(
1702
+ "div",
1703
+ { class: "inline-title" },
1704
+ "复制链接",
1705
+ -1
1706
+ /* CACHED */
1707
+ )),
1708
+ l(
1709
+ "div",
1710
+ Fl,
1711
+ $(r.value),
1712
+ 1
1713
+ /* TEXT */
1714
+ ),
1715
+ o[5] || (o[5] = l(
1716
+ "div",
1717
+ { class: "inline-hint" },
1718
+ "(Demo 模拟:实际将复制并跳转)",
1719
+ -1
1720
+ /* CACHED */
1721
+ )),
1722
+ l("div", { class: "inline-actions" }, [
1723
+ l("button", {
1724
+ class: "btn-cancel",
1725
+ onClick: m
1726
+ }, "取消"),
1727
+ l("button", {
1728
+ class: "btn-confirm",
1729
+ onClick: p
1730
+ }, "复制并完成")
1731
+ ])
1732
+ ])
1733
+ ])) : x("v-if", !0)
1734
+ ]));
1735
+ }
1736
+ }), Rl = /* @__PURE__ */ Y(Dl, [["__scopeId", "data-v-612f91c9"]]), Nl = /* @__PURE__ */ U({
1737
+ __name: "TaskControl",
1738
+ props: {
1739
+ item: {},
1740
+ field: {},
1741
+ formCore: {}
1742
+ },
1743
+ setup(t) {
1744
+ const n = t, e = b(() => {
1745
+ const r = Qe(n.item.props);
1746
+ return {
1747
+ subForm: ge,
1748
+ h5: ol,
1749
+ signature: ve,
1750
+ map: ve,
1751
+ native: ve,
1752
+ api: xl,
1753
+ customer: Vl,
1754
+ inline: Rl
1755
+ }[r] || ge;
1756
+ });
1757
+ return (r, f) => (s(), ee(ce(e.value), {
1758
+ item: t.item,
1759
+ field: t.field,
1760
+ formCore: t.formCore
1761
+ }, null, 8, ["item", "field", "formCore"]));
1762
+ }
1763
+ }), Ll = { class: "list-row-head" }, jl = ["disabled", "onClick"], Bl = ["value", "disabled", "onChange"], Kl = { value: "" }, Ul = ["value"], Hl = ["type", "value", "placeholder", "disabled", "onBlur"], Yl = {
1764
+ key: 2,
1765
+ class: "list-error"
1766
+ }, ql = {
1767
+ key: 0,
1768
+ class: "list-summary-error"
1769
+ }, zl = ["disabled"], Gl = { class: "list-hint" }, Wl = /* @__PURE__ */ U({
1770
+ __name: "ListControl",
1771
+ props: {
1772
+ item: {},
1773
+ field: {},
1774
+ formCore: {}
1775
+ },
1776
+ emits: ["change"],
1777
+ setup(t, { emit: n }) {
1778
+ const e = t, r = n, f = b(
1779
+ () => {
1780
+ var u;
1781
+ return Array.isArray((u = e.field) == null ? void 0 : u.value) ? e.field.value : [];
1782
+ }
1783
+ ), p = b(() => e.item.subItems ?? []), m = b(() => {
1784
+ var u;
1785
+ return ((u = e.item.listMeta) == null ? void 0 : u.minItems) ?? 1;
1786
+ }), h = b(() => {
1787
+ var u;
1788
+ return (u = e.item.listMeta) == null ? void 0 : u.maxItems;
1789
+ }), g = b(() => h.value === void 0 || f.value.length < h.value), a = b(() => {
1790
+ var u;
1791
+ return ((u = e.item.listMeta) == null ? void 0 : u.removable) !== !1 && f.value.length > m.value;
1792
+ }), o = b(
1793
+ () => {
1794
+ var u;
1795
+ return ((u = e.field) == null ? void 0 : u.collectionErrors) ?? {};
1796
+ }
1797
+ );
1798
+ function c(u, k) {
1799
+ var V;
1800
+ return ((V = f.value[u]) == null ? void 0 : V[k.key]) ?? "";
1801
+ }
1802
+ function y(u) {
1803
+ return u && typeof u == "object" ? u.code || "" : u == null ? "" : String(u);
1804
+ }
1805
+ function M(u, k, V) {
1806
+ const d = f.value.map((_) => ({ ..._ }));
1807
+ d[u] = { ...d[u] ?? {}, [k.key]: V }, r("change", { value: d, eventType: "inputBlur" });
1808
+ }
1809
+ function v(u, k, V) {
1810
+ const d = V.target;
1811
+ M(u, k, d.value.trim());
1812
+ }
1813
+ function T(u, k, V) {
1814
+ const d = V.target, _ = (k.initOptions ?? []).find((I) => I.code === d.value);
1815
+ M(u, k, _ ? { code: _.code, name: _.name } : "");
1816
+ }
1817
+ function A() {
1818
+ var u;
1819
+ !g.value || (u = e.field) != null && u.disabled || r("change", { value: [...f.value, {}], eventType: "inputChange" });
1820
+ }
1821
+ function L(u) {
1822
+ var k;
1823
+ !a.value || (k = e.field) != null && k.disabled || r("change", {
1824
+ value: f.value.filter((V, d) => d !== u),
1825
+ eventType: "inputChange"
1826
+ });
1827
+ }
1828
+ function P(u, k) {
1829
+ return o.value[`${e.item.key}[${u}].${k}`];
1830
+ }
1831
+ return (u, k) => {
1832
+ var V, d, _;
1833
+ return s(), i(
1834
+ "div",
1835
+ {
1836
+ class: K(["ctrl-list", { disabled: (V = t.field) == null ? void 0 : V.disabled }])
1837
+ },
1838
+ [
1839
+ (s(!0), i(
1840
+ q,
1841
+ null,
1842
+ W(f.value, (I, w) => {
1843
+ var O, S;
1844
+ return s(), i("article", {
1845
+ key: w,
1846
+ class: "list-row"
1847
+ }, [
1848
+ l("div", Ll, [
1849
+ l(
1850
+ "strong",
1851
+ null,
1852
+ "联系人 " + $(w + 1),
1853
+ 1
1854
+ /* TEXT */
1855
+ ),
1856
+ ((O = t.item.listMeta) == null ? void 0 : O.removable) !== !1 ? (s(), i("button", {
1857
+ key: 0,
1858
+ type: "button",
1859
+ class: "remove-button",
1860
+ disabled: !a.value || ((S = t.field) == null ? void 0 : S.disabled),
1861
+ onClick: (C) => L(w)
1862
+ }, " 删除 ", 8, jl)) : x("v-if", !0)
1863
+ ]),
1864
+ (s(!0), i(
1865
+ q,
1866
+ null,
1867
+ W(p.value, (C) => {
1868
+ var j, z;
1869
+ return s(), i("label", {
1870
+ key: C.key,
1871
+ class: "list-field"
1872
+ }, [
1873
+ l(
1874
+ "span",
1875
+ {
1876
+ class: K(["list-field-label", { required: C.required }])
1877
+ },
1878
+ $(C.label || C.key),
1879
+ 3
1880
+ /* TEXT, CLASS */
1881
+ ),
1882
+ C.type === "select" || C.type === "cascader" ? (s(), i("select", {
1883
+ key: 0,
1884
+ class: "list-input",
1885
+ value: y(c(w, C)),
1886
+ disabled: ((j = t.field) == null ? void 0 : j.disabled) || C.disabled,
1887
+ onChange: (B) => T(w, C, B)
1888
+ }, [
1889
+ l(
1890
+ "option",
1891
+ Kl,
1892
+ $(C.placeholder || "请选择"),
1893
+ 1
1894
+ /* TEXT */
1895
+ ),
1896
+ (s(!0), i(
1897
+ q,
1898
+ null,
1899
+ W(C.initOptions || [], (B) => (s(), i("option", {
1900
+ key: B.code,
1901
+ value: B.code
1902
+ }, $(B.name), 9, Ul))),
1903
+ 128
1904
+ /* KEYED_FRAGMENT */
1905
+ ))
1906
+ ], 40, Bl)) : (s(), i("input", {
1907
+ key: 1,
1908
+ class: "list-input",
1909
+ type: C.type === "number" ? "number" : C.type === "phone" ? "tel" : "text",
1910
+ value: c(w, C),
1911
+ placeholder: C.placeholder || "请输入",
1912
+ disabled: ((z = t.field) == null ? void 0 : z.disabled) || C.disabled,
1913
+ onBlur: (B) => v(w, C, B)
1914
+ }, null, 40, Hl)),
1915
+ P(w, C.key) ? (s(), i(
1916
+ "span",
1917
+ Yl,
1918
+ $(P(w, C.key)),
1919
+ 1
1920
+ /* TEXT */
1921
+ )) : x("v-if", !0)
1922
+ ]);
1923
+ }),
1924
+ 128
1925
+ /* KEYED_FRAGMENT */
1926
+ ))
1927
+ ]);
1928
+ }),
1929
+ 128
1930
+ /* KEYED_FRAGMENT */
1931
+ )),
1932
+ Object.keys(o.value).length ? (s(), i("p", ql, " 请修改重复或冲突的联系人手机号。 ")) : x("v-if", !0),
1933
+ l("button", {
1934
+ type: "button",
1935
+ class: "add-button",
1936
+ disabled: !g.value || ((d = t.field) == null ? void 0 : d.disabled),
1937
+ onClick: A
1938
+ }, $(((_ = t.item.listMeta) == null ? void 0 : _.addButtonText) || "+ 添加联系人"), 9, zl),
1939
+ l(
1940
+ "p",
1941
+ Gl,
1942
+ $(m.value) + "–" + $(h.value ?? "∞") + " 项,当前 " + $(f.value.length) + " 项",
1943
+ 1
1944
+ /* TEXT */
1945
+ )
1946
+ ],
1947
+ 2
1948
+ /* CLASS */
1949
+ );
1950
+ };
1951
+ }
1952
+ }), Jl = /* @__PURE__ */ Y(Wl, [["__scopeId", "data-v-e320f716"]]), Xl = { class: "ctrl-date" }, Ql = ["value", "disabled", "aria-label"], Zl = ["value", "disabled", "aria-label"], ea = ["value", "disabled", "aria-label"], ta = /* @__PURE__ */ U({
1953
+ __name: "DateControl",
1954
+ props: {
1955
+ item: {},
1956
+ field: {},
1957
+ formCore: {}
1958
+ },
1959
+ emits: ["change"],
1960
+ setup(t, { emit: n }) {
1961
+ var y, M, v;
1962
+ const e = t, r = n, f = b(() => e.item.type === "dateRange"), p = E(g((y = e.field) == null ? void 0 : y.value)), m = E(a((M = e.field) == null ? void 0 : M.value)[0]), h = E(a((v = e.field) == null ? void 0 : v.value)[1]);
1963
+ Z(
1964
+ () => {
1965
+ var T;
1966
+ return (T = e.field) == null ? void 0 : T.value;
1967
+ },
1968
+ (T) => {
1969
+ if (f.value) {
1970
+ const [A, L] = a(T);
1971
+ m.value = A, h.value = L;
1972
+ } else
1973
+ p.value = g(T);
1974
+ }
1975
+ );
1976
+ function g(T) {
1977
+ return T == null || T === "" ? "" : String(T);
1978
+ }
1979
+ function a(T) {
1980
+ if (Array.isArray(T)) return [String(T[0] || ""), String(T[1] || "")];
1981
+ if (T && typeof T == "object") {
1982
+ const A = T;
1983
+ return [String(A.start || ""), String(A.end || "")];
1984
+ }
1985
+ return ["", ""];
1986
+ }
1987
+ function o(T) {
1988
+ const A = T.target.value || "";
1989
+ p.value = A, r("change", { value: A, eventType: "pickChange" });
1990
+ }
1991
+ function c() {
1992
+ const T = m.value, A = h.value;
1993
+ r("change", { value: T || A ? [T, A] : "", eventType: "pickChange" });
1994
+ }
1995
+ return (T, A) => {
1996
+ var L, P, u;
1997
+ return s(), i("div", Xl, [
1998
+ f.value ? (s(), i(
1999
+ q,
2000
+ { key: 0 },
2001
+ [
2002
+ l("input", {
2003
+ class: "ctrl-date-input",
2004
+ type: "date",
2005
+ value: m.value,
2006
+ disabled: (L = t.field) == null ? void 0 : L.disabled,
2007
+ "aria-label": (t.item.label || "日期") + "开始",
2008
+ onChange: A[0] || (A[0] = (k) => {
2009
+ m.value = k.target.value, c();
2010
+ })
2011
+ }, null, 40, Ql),
2012
+ A[2] || (A[2] = l(
2013
+ "span",
2014
+ { class: "ctrl-date-sep" },
2015
+ "至",
2016
+ -1
2017
+ /* CACHED */
2018
+ )),
2019
+ l("input", {
2020
+ class: "ctrl-date-input",
2021
+ type: "date",
2022
+ value: h.value,
2023
+ disabled: (P = t.field) == null ? void 0 : P.disabled,
2024
+ "aria-label": (t.item.label || "日期") + "结束",
2025
+ onChange: A[1] || (A[1] = (k) => {
2026
+ h.value = k.target.value, c();
2027
+ })
2028
+ }, null, 40, Zl)
2029
+ ],
2030
+ 64
2031
+ /* STABLE_FRAGMENT */
2032
+ )) : (s(), i("input", {
2033
+ key: 1,
2034
+ class: "ctrl-date-input",
2035
+ type: "date",
2036
+ value: p.value,
2037
+ disabled: (u = t.field) == null ? void 0 : u.disabled,
2038
+ "aria-label": t.item.label || "日期",
2039
+ onChange: o
2040
+ }, null, 40, ea))
2041
+ ]);
2042
+ };
2043
+ }
2044
+ }), la = /* @__PURE__ */ Y(ta, [["__scopeId", "data-v-fdf889db"]]), aa = { class: "ctrl-verify-wrap" }, na = { class: "ctrl-verify" }, oa = ["value", "placeholder", "disabled", "maxlength"], sa = ["disabled"], ia = {
2045
+ key: 0,
2046
+ class: "ctrl-verify-error"
2047
+ }, ra = /* @__PURE__ */ U({
2048
+ __name: "VerifyCodeControl",
2049
+ props: {
2050
+ item: {},
2051
+ field: {},
2052
+ formCore: {}
2053
+ },
2054
+ emits: ["change"],
2055
+ setup(t, { emit: n }) {
2056
+ var u;
2057
+ const e = t, r = n, f = le(ue, null), p = E(String(((u = e.field) == null ? void 0 : u.value) || "")), m = E(0), h = E(!1), g = E("");
2058
+ let a = null;
2059
+ Z(
2060
+ () => {
2061
+ var k;
2062
+ return (k = e.field) == null ? void 0 : k.value;
2063
+ },
2064
+ (k) => {
2065
+ p.value = k == null ? "" : String(k);
2066
+ }
2067
+ );
2068
+ const o = b(() => {
2069
+ var k;
2070
+ return Number((k = e.item.props) == null ? void 0 : k.countTime) || 60;
2071
+ }), c = b(
2072
+ () => {
2073
+ var k, V;
2074
+ return ((k = e.item.props) == null ? void 0 : k.verifyText) || ((V = e.item.props) == null ? void 0 : V.reVerifyText) || "获取验证码";
2075
+ }
2076
+ ), y = b(() => m.value > 0), M = b(() => m.value > 0 ? `${m.value}s` : h.value ? "发送中" : c.value);
2077
+ function v(k) {
2078
+ p.value = k.target.value;
2079
+ }
2080
+ function T() {
2081
+ const k = p.value.trim();
2082
+ p.value = k, r("change", { value: k, eventType: "inputBlur" });
2083
+ }
2084
+ function A() {
2085
+ a && (clearInterval(a), a = null);
2086
+ }
2087
+ function L() {
2088
+ m.value = o.value, A(), a = setInterval(() => {
2089
+ m.value -= 1, m.value <= 0 && A();
2090
+ }, 1e3);
2091
+ }
2092
+ async function P() {
2093
+ var k, V, d, _, I, w;
2094
+ if (!(y.value || h.value || (k = e.field) != null && k.disabled)) {
2095
+ g.value = "", h.value = !0;
2096
+ try {
2097
+ const O = ne(f);
2098
+ if (O != null && O.sendVerifyCode) {
2099
+ const S = ((V = e.item.props) == null ? void 0 : V.mobileKey) || ((d = e.item.props) == null ? void 0 : d.bindMobileKey), C = S && ((w = (I = (_ = e.formCore) == null ? void 0 : _.fields) == null ? void 0 : I[S]) == null ? void 0 : w.value) != null ? String(e.formCore.fields[S].value) : void 0;
2100
+ await O.sendVerifyCode({ item: e.item, mobile: C });
2101
+ }
2102
+ L();
2103
+ } catch (O) {
2104
+ g.value = (O == null ? void 0 : O.message) || "发送失败";
2105
+ } finally {
2106
+ h.value = !1;
2107
+ }
2108
+ }
2109
+ }
2110
+ return Pe(A), (k, V) => {
2111
+ var d, _, I;
2112
+ return s(), i("div", aa, [
2113
+ l("div", na, [
2114
+ l("input", {
2115
+ class: "ctrl-verify-input",
2116
+ type: "text",
2117
+ inputmode: "numeric",
2118
+ value: p.value,
2119
+ placeholder: t.item.placeholder || "请输入验证码",
2120
+ disabled: (d = t.field) == null ? void 0 : d.disabled,
2121
+ maxlength: ((_ = t.item.props) == null ? void 0 : _.maxlength) || 6,
2122
+ onInput: v,
2123
+ onBlur: T
2124
+ }, null, 40, oa),
2125
+ l("button", {
2126
+ type: "button",
2127
+ class: "ctrl-verify-btn",
2128
+ disabled: ((I = t.field) == null ? void 0 : I.disabled) || y.value || h.value,
2129
+ onClick: P
2130
+ }, $(M.value), 9, sa)
2131
+ ]),
2132
+ g.value ? (s(), i(
2133
+ "div",
2134
+ ia,
2135
+ $(g.value),
2136
+ 1
2137
+ /* TEXT */
2138
+ )) : x("v-if", !0)
2139
+ ]);
2140
+ };
2141
+ }
2142
+ }), ca = /* @__PURE__ */ Y(ra, [["__scopeId", "data-v-53229668"]]), ua = { class: "ctrl-upload-wrap" }, da = { class: "ctrl-upload" }, va = ["src"], fa = ["onClick"], ma = {
2143
+ key: 0,
2144
+ class: "ctrl-upload-add"
2145
+ }, pa = { class: "ctrl-upload-hint" }, ha = ["multiple"], ga = {
2146
+ key: 0,
2147
+ class: "ctrl-upload-error"
2148
+ }, ya = /* @__PURE__ */ U({
2149
+ __name: "ImageUploadControl",
2150
+ props: {
2151
+ item: {},
2152
+ field: {},
2153
+ formCore: {}
2154
+ },
2155
+ emits: ["change"],
2156
+ setup(t, { emit: n }) {
2157
+ var M;
2158
+ const e = t, r = n, f = le(ue, null), p = E(o((M = e.field) == null ? void 0 : M.value)), m = E(!1), h = E("");
2159
+ Z(
2160
+ () => {
2161
+ var v;
2162
+ return (v = e.field) == null ? void 0 : v.value;
2163
+ },
2164
+ (v) => {
2165
+ p.value = o(v);
2166
+ }
2167
+ );
2168
+ const g = b(() => {
2169
+ var v;
2170
+ return Number((v = e.item.props) == null ? void 0 : v.maxCount) || 1;
2171
+ }), a = b(
2172
+ () => {
2173
+ var v;
2174
+ return p.value.length < g.value && !((v = e.field) != null && v.disabled) && !m.value;
2175
+ }
2176
+ );
2177
+ function o(v) {
2178
+ return Array.isArray(v) ? v.map(String).filter(Boolean) : typeof v == "string" && v ? [v] : [];
2179
+ }
2180
+ async function c(v) {
2181
+ var u;
2182
+ const T = v.target, A = Array.from(T.files || []);
2183
+ if (T.value = "", !A.length || (u = e.field) != null && u.disabled) return;
2184
+ const L = g.value - p.value.length, P = A.slice(0, Math.max(0, L));
2185
+ if (P.length) {
2186
+ h.value = "", m.value = !0;
2187
+ try {
2188
+ const k = ne(f);
2189
+ let V;
2190
+ if (k != null && k.uploadFile) {
2191
+ const d = [];
2192
+ for (const _ of P) {
2193
+ const I = await k.uploadFile(
2194
+ { name: _.name, size: _.size, raw: _ },
2195
+ { item: e.item }
2196
+ );
2197
+ if (!(I != null && I.url)) throw new Error("上传未返回 url");
2198
+ d.push(I.url);
2199
+ }
2200
+ V = [...p.value, ...d];
2201
+ } else
2202
+ V = [...p.value, ...P.map((d) => URL.createObjectURL(d))];
2203
+ p.value = V, r("change", { value: V, eventType: "pickChange" });
2204
+ } catch (k) {
2205
+ h.value = (k == null ? void 0 : k.message) || "上传失败";
2206
+ } finally {
2207
+ m.value = !1;
2208
+ }
2209
+ }
2210
+ }
2211
+ function y(v) {
2212
+ var A;
2213
+ if ((A = e.field) != null && A.disabled) return;
2214
+ const T = p.value.filter((L, P) => P !== v);
2215
+ p.value = T, r("change", { value: T, eventType: "pickChange" });
2216
+ }
2217
+ return (v, T) => (s(), i("div", ua, [
2218
+ l("div", da, [
2219
+ (s(!0), i(
2220
+ q,
2221
+ null,
2222
+ W(p.value, (A, L) => {
2223
+ var P;
2224
+ return s(), i("div", {
2225
+ key: A + L,
2226
+ class: "ctrl-upload-thumb"
2227
+ }, [
2228
+ l("img", {
2229
+ src: A,
2230
+ alt: ""
2231
+ }, null, 8, va),
2232
+ (P = t.field) != null && P.disabled ? x("v-if", !0) : (s(), i("button", {
2233
+ key: 0,
2234
+ type: "button",
2235
+ class: "ctrl-upload-remove",
2236
+ "aria-label": "删除图片",
2237
+ onClick: (u) => y(L)
2238
+ }, " × ", 8, fa))
2239
+ ]);
2240
+ }),
2241
+ 128
2242
+ /* KEYED_FRAGMENT */
2243
+ )),
2244
+ a.value ? (s(), i("label", ma, [
2245
+ T[0] || (T[0] = l(
2246
+ "span",
2247
+ null,
2248
+ "+",
2249
+ -1
2250
+ /* CACHED */
2251
+ )),
2252
+ l(
2253
+ "span",
2254
+ pa,
2255
+ $(m.value ? "…" : t.item.placeholder || "上传"),
2256
+ 1
2257
+ /* TEXT */
2258
+ ),
2259
+ l("input", {
2260
+ type: "file",
2261
+ accept: "image/*",
2262
+ multiple: g.value > 1,
2263
+ hidden: "",
2264
+ onChange: c
2265
+ }, null, 40, ha)
2266
+ ])) : x("v-if", !0)
2267
+ ]),
2268
+ h.value ? (s(), i(
2269
+ "div",
2270
+ ga,
2271
+ $(h.value),
2272
+ 1
2273
+ /* TEXT */
2274
+ )) : x("v-if", !0)
2275
+ ]));
2276
+ }
2277
+ }), ka = /* @__PURE__ */ Y(ya, [["__scopeId", "data-v-f549efb4"]]), ba = { class: "ctrl-slider" }, _a = ["min", "max", "step", "value", "disabled", "aria-label"], Ca = { class: "ctrl-slider-value" }, $a = /* @__PURE__ */ U({
2278
+ __name: "SliderControl",
2279
+ props: {
2280
+ item: {},
2281
+ field: {},
2282
+ formCore: {}
2283
+ },
2284
+ emits: ["change"],
2285
+ setup(t, { emit: n }) {
2286
+ var c;
2287
+ const e = t, r = n, f = b(() => {
2288
+ var y;
2289
+ return Number(((y = e.item.props) == null ? void 0 : y.min) ?? 0);
2290
+ }), p = b(() => {
2291
+ var y;
2292
+ return Number(((y = e.item.props) == null ? void 0 : y.max) ?? 100);
2293
+ }), m = b(() => {
2294
+ var y;
2295
+ return Number(((y = e.item.props) == null ? void 0 : y.step) ?? 1);
2296
+ }), h = E(g((c = e.field) == null ? void 0 : c.value, f.value));
2297
+ Z(
2298
+ () => {
2299
+ var y;
2300
+ return (y = e.field) == null ? void 0 : y.value;
2301
+ },
2302
+ (y) => {
2303
+ h.value = g(y, f.value);
2304
+ }
2305
+ );
2306
+ function g(y, M) {
2307
+ const v = Number(y);
2308
+ return Number.isFinite(v) ? v : M;
2309
+ }
2310
+ function a(y) {
2311
+ h.value = Number(y.target.value);
2312
+ }
2313
+ function o(y) {
2314
+ const M = Number(y.target.value);
2315
+ h.value = M, r("change", { value: M, eventType: "pickChange" });
2316
+ }
2317
+ return (y, M) => {
2318
+ var v;
2319
+ return s(), i("div", ba, [
2320
+ l("input", {
2321
+ class: "ctrl-slider-input",
2322
+ type: "range",
2323
+ min: f.value,
2324
+ max: p.value,
2325
+ step: m.value,
2326
+ value: h.value,
2327
+ disabled: (v = t.field) == null ? void 0 : v.disabled,
2328
+ "aria-label": t.item.label || "滑块",
2329
+ onInput: a,
2330
+ onChange: o
2331
+ }, null, 40, _a),
2332
+ l(
2333
+ "span",
2334
+ Ca,
2335
+ $(h.value),
2336
+ 1
2337
+ /* TEXT */
2338
+ )
2339
+ ]);
2340
+ };
2341
+ }
2342
+ }), Ta = /* @__PURE__ */ Y($a, [["__scopeId", "data-v-ac8f0c27"]]), wa = {
2343
+ input: "InputControl",
2344
+ textarea: "InputControl",
2345
+ number: "InputControl",
2346
+ idcard: "InputControl",
2347
+ phone: "InputControl",
2348
+ bankCard: "InputControl",
2349
+ select: "SelectControl",
2350
+ cascader: "CascaderControl",
2351
+ address: "AddressControl",
2352
+ address5: "AddressControl",
2353
+ addressPinyin: "AddressControl",
2354
+ search: "SearchControl",
2355
+ agreement: "AgreementControl",
2356
+ task: "TaskControl",
2357
+ date: "DateControl",
2358
+ dateRange: "DateControl",
2359
+ verifyCode: "VerifyCodeControl",
2360
+ imageUpload: "ImageUploadControl",
2361
+ slider: "SliderControl",
2362
+ signature: "TaskControl",
2363
+ custom: "InputControl",
2364
+ list: "ListControl"
2365
+ };
2366
+ function Sa(t, n) {
2367
+ return Ce(t) ? "TaskControl" : wa[n] || "InputControl";
2368
+ }
2369
+ function xa(t, n, e) {
2370
+ const r = Ce(t);
2371
+ return r ? {
2372
+ ...e || {},
2373
+ taskType: t,
2374
+ taskCategory: r === "customer" ? "CUSTOMER_TASK" : r === "inline" ? "inline" : "TASKS"
2375
+ } : e;
2376
+ }
2377
+ function Aa(t) {
2378
+ if (typeof t != "object" || t === null)
2379
+ return { value: t };
2380
+ const n = t.value !== void 0 ? t.value : t, e = t.eventType, { value: r, eventType: f, ...p } = t;
2381
+ return Object.keys(p).length > 0 ? { value: n, eventType: e, extraFields: p } : { value: n, eventType: e };
2382
+ }
2383
+ const Ia = ["data-label-position", "data-field-key"], Oa = {
2384
+ key: 0,
2385
+ class: "form-error"
2386
+ }, Ma = {
2387
+ key: 1,
2388
+ class: "form-icon"
2389
+ }, Va = { key: 0 }, Ea = { key: 1 }, Pa = { key: 2 }, Fa = /* @__PURE__ */ U({
2390
+ __name: "FormItem",
2391
+ props: {
2392
+ item: {},
2393
+ field: {},
2394
+ formCore: {}
2395
+ },
2396
+ setup(t) {
2397
+ const n = t, e = le("customControls", {}), r = le("themeLabelPosition", void 0), f = {
2398
+ InputControl: at,
2399
+ SelectControl: dt,
2400
+ CascaderControl: $t,
2401
+ SearchControl: Vt,
2402
+ AddressControl: Ut,
2403
+ AgreementControl: Gt,
2404
+ TaskControl: Nl,
2405
+ ListControl: Jl,
2406
+ DateControl: la,
2407
+ VerifyCodeControl: ca,
2408
+ ImageUploadControl: ka,
2409
+ SliderControl: Ta
2410
+ }, p = b(() => {
2411
+ const a = xa(
2412
+ n.item.key,
2413
+ n.item.type,
2414
+ n.item.raw.props || {}
2415
+ );
2416
+ return a === n.item.raw.props ? n.item : {
2417
+ ...n.item,
2418
+ raw: {
2419
+ ...n.item.raw,
2420
+ props: a
2421
+ }
2422
+ };
2423
+ }), m = b(
2424
+ () => {
2425
+ var a;
2426
+ return Ne(
2427
+ (a = n.item.raw) == null ? void 0 : a.labelPosition,
2428
+ ne(r)
2429
+ );
2430
+ }
2431
+ ), h = b(() => {
2432
+ var o;
2433
+ if (n.item.type === "custom") {
2434
+ const c = (o = n.item.raw) == null ? void 0 : o.customRender;
2435
+ if (c && e[c])
2436
+ return e[c];
2437
+ if (c && typeof c != "string")
2438
+ return c;
2439
+ }
2440
+ const a = Sa(n.item.key, n.item.type);
2441
+ return f[a];
2442
+ });
2443
+ function g(a) {
2444
+ const { value: o, eventType: c, extraFields: y } = Aa(a);
2445
+ n.formCore.setControlData(n.item.key, o, {
2446
+ eventType: c,
2447
+ ...y ? { extraFields: y } : {}
2448
+ });
2449
+ }
2450
+ return (a, o) => {
2451
+ var c, y;
2452
+ return s(), i("div", {
2453
+ class: K(["form-item", {
2454
+ "form-item-error": (c = t.field) == null ? void 0 : c.errMsg,
2455
+ "form-item--top": m.value === "top",
2456
+ "form-item--left": m.value === "left"
2457
+ }]),
2458
+ "data-label-position": m.value,
2459
+ "data-field-key": t.item.key
2460
+ }, [
2461
+ t.item.hideLabel ? x("v-if", !0) : (s(), i(
2462
+ "label",
2463
+ {
2464
+ key: 0,
2465
+ class: K(["form-label", { required: t.item.required }])
2466
+ },
2467
+ $(t.item.label),
2468
+ 3
2469
+ /* TEXT, CLASS */
2470
+ )),
2471
+ l(
2472
+ "div",
2473
+ {
2474
+ class: K(["form-control", { "form-control-full": t.item.hideLabel }])
2475
+ },
2476
+ [
2477
+ (s(), ee(ce(h.value), {
2478
+ item: p.value.raw,
2479
+ field: t.field,
2480
+ formCore: t.formCore,
2481
+ onChange: g
2482
+ }, null, 40, ["item", "field", "formCore"])),
2483
+ (y = t.field) != null && y.errMsg ? (s(), i(
2484
+ "div",
2485
+ Oa,
2486
+ $(t.field.errMsg),
2487
+ 1
2488
+ /* TEXT */
2489
+ )) : x("v-if", !0)
2490
+ ],
2491
+ 2
2492
+ /* CLASS */
2493
+ ),
2494
+ t.item.rightIcon && !t.item.hideLabel && m.value === "left" ? (s(), i("span", Ma, [
2495
+ t.item.rightIcon === "arrow" ? (s(), i("span", Va, "›")) : t.item.rightIcon === "location" ? (s(), i("span", Ea, "📍")) : t.item.rightIcon === "search" ? (s(), i("span", Pa, "🔍")) : x("v-if", !0)
2496
+ ])) : x("v-if", !0)
2497
+ ], 10, Ia);
2498
+ };
2499
+ }
2500
+ }), $e = /* @__PURE__ */ Y(Fa, [["__scopeId", "data-v-177bcff2"]]), Da = { class: "form-group" }, Ra = { class: "group-body" }, Na = /* @__PURE__ */ U({
2501
+ __name: "FormGroup",
2502
+ props: {
2503
+ group: {},
2504
+ fields: {},
2505
+ formCore: {}
2506
+ },
2507
+ setup(t) {
2508
+ const n = t, e = le(
2509
+ "FormItemComponent",
2510
+ void 0
2511
+ ), r = b(
2512
+ () => e ? ne(e) : $e
2513
+ ), f = b(
2514
+ () => n.group.items.filter((p) => {
2515
+ const m = n.fields[p.key];
2516
+ return !m || m.visible;
2517
+ })
2518
+ );
2519
+ return (p, m) => (s(), i("div", Da, [
2520
+ l("div", Ra, [
2521
+ (s(!0), i(
2522
+ q,
2523
+ null,
2524
+ W(f.value, (h) => (s(), ee(ce(r.value), {
2525
+ key: h.key,
2526
+ item: h,
2527
+ field: t.fields[h.key],
2528
+ formCore: t.formCore
2529
+ }, null, 8, ["item", "field", "formCore"]))),
2530
+ 128
2531
+ /* KEYED_FRAGMENT */
2532
+ ))
2533
+ ])
2534
+ ]));
2535
+ }
2536
+ }), La = /* @__PURE__ */ Y(Na, [["__scopeId", "data-v-83eda13b"]]), ja = ["data-shell", "data-label-align", "data-content-align"], Ba = {
2537
+ key: 0,
2538
+ class: "form-render__title"
2539
+ }, Ka = /* @__PURE__ */ U({
2540
+ __name: "FormRender",
2541
+ props: {
2542
+ groups: {},
2543
+ fields: {},
2544
+ formCore: {},
2545
+ customControls: {},
2546
+ labelPosition: {},
2547
+ title: {},
2548
+ labelAlign: {},
2549
+ labelWidth: {},
2550
+ contentAlign: {},
2551
+ FormGroupComponent: {},
2552
+ FormItemComponent: {},
2553
+ hostHandlers: {}
2554
+ },
2555
+ setup(t) {
2556
+ const n = t, e = b(() => n.labelAlign === "left" || n.labelAlign === "right" || n.labelAlign === "top" ? n.labelAlign : n.labelPosition === "top" ? "top" : (n.labelPosition === "left", "left")), r = b(
2557
+ () => e.value === "top" ? "top" : "left"
2558
+ );
2559
+ G("customControls", n.customControls || {}), G("themeLabelPosition", r), G("formUiLayout", b(() => ({
2560
+ labelAlign: e.value,
2561
+ labelWidth: n.labelWidth ?? "81px",
2562
+ contentAlign: n.contentAlign ?? "left"
2563
+ }))), G(
2564
+ "FormItemComponent",
2565
+ b(() => n.FormItemComponent || $e)
2566
+ ), G(
2567
+ ue,
2568
+ b(() => n.hostHandlers ?? null)
2569
+ );
2570
+ const f = b(() => n.FormGroupComponent || La);
2571
+ return (p, m) => (s(), i("div", {
2572
+ class: "form-render",
2573
+ "data-shell": t.FormGroupComponent ? "override" : "default",
2574
+ "data-label-align": e.value,
2575
+ "data-content-align": t.contentAlign || "left"
2576
+ }, [
2577
+ t.title ? (s(), i(
2578
+ "div",
2579
+ Ba,
2580
+ $(t.title),
2581
+ 1
2582
+ /* TEXT */
2583
+ )) : x("v-if", !0),
2584
+ (s(!0), i(
2585
+ q,
2586
+ null,
2587
+ W(t.groups, (h) => (s(), ee(ce(f.value), {
2588
+ key: h.key,
2589
+ group: h,
2590
+ fields: t.fields,
2591
+ formCore: t.formCore
2592
+ }, null, 8, ["group", "fields", "formCore"]))),
2593
+ 128
2594
+ /* KEYED_FRAGMENT */
2595
+ )),
2596
+ ye(p.$slots, "footer", {}, void 0, !0)
2597
+ ], 8, ja));
2598
+ }
2599
+ }), Ua = /* @__PURE__ */ Y(Ka, [["__scopeId", "data-v-c936694c"]]), Ha = ["data-modern-skin"], Ya = {
2600
+ key: 0,
2601
+ class: "apf-prism-form__header"
2602
+ }, qa = { class: "apf-prism-form__title" }, za = {
2603
+ key: 0,
2604
+ class: "apf-prism-form__desc"
2605
+ }, Ga = {
2606
+ key: 1,
2607
+ class: "apf-prism-form__progress",
2608
+ "data-testid": "prism-form-progress"
2609
+ }, Wa = { class: "apf-prism-form__progress-row" }, Ja = { key: 0 }, Xa = { key: 1 }, Qa = { class: "apf-prism-form__bar" }, Za = {
2610
+ key: 2,
2611
+ class: "apf-prism-form__steps",
2612
+ "data-testid": "prism-form-steps"
2613
+ }, en = ["onClick"], tn = {
2614
+ key: 0,
2615
+ class: "apf-prism-form__step-nav"
2616
+ }, ln = ["disabled"], an = { class: "apf-prism-form__step-count" }, nn = ["disabled"], on = {
2617
+ key: 0,
2618
+ class: "apf-prism-form__footer"
2619
+ }, sn = ["disabled"], rn = /* @__PURE__ */ U({
2620
+ __name: "PrismForm",
2621
+ props: {
2622
+ schema: { default: null },
2623
+ bundle: { default: null },
2624
+ themeConfig: { default: null },
2625
+ initialValues: { default: void 0 },
2626
+ skin: { default: void 0 },
2627
+ themeOverride: { default: void 0 },
2628
+ formMode: { default: void 0 },
2629
+ showProgressBar: { type: Boolean, default: void 0 },
2630
+ readOnly: { type: Boolean, default: void 0 },
2631
+ keyboardPolicy: { default: void 0 },
2632
+ locale: { default: void 0 },
2633
+ hostHandlers: { default: null },
2634
+ customControls: { default: void 0 },
2635
+ onTelemetry: { default: void 0 },
2636
+ storageAdapter: { default: void 0 },
2637
+ submitText: { default: void 0 },
2638
+ showSubmit: { type: Boolean, default: !0 },
2639
+ submitting: { type: Boolean, default: !1 },
2640
+ maxWidth: { default: "680px" }
2641
+ },
2642
+ emits: ["submit", "change", "validate-error"],
2643
+ setup(t, { expose: n, emit: e }) {
2644
+ const r = t, f = e, p = b(() => {
2645
+ var F;
2646
+ return r.schema || ((F = r.bundle) == null ? void 0 : F.schema) || null;
2647
+ }), m = b(() => {
2648
+ var F;
2649
+ return {
2650
+ ...((F = r.bundle) == null ? void 0 : F.themeConfig) || {},
2651
+ ...r.themeConfig || {}
2652
+ };
2653
+ }), h = b(
2654
+ () => r.skin || m.value.skin || "fin-minimal"
2655
+ ), g = b(
2656
+ () => r.themeOverride ?? m.value.override ?? null
2657
+ ), a = b(
2658
+ () => r.formMode || m.value.formMode || "flat"
2659
+ ), o = b(() => typeof r.showProgressBar == "boolean" ? r.showProgressBar : typeof m.value.showProgressBar == "boolean" ? m.value.showProgressBar : !0), c = b(() => typeof r.readOnly == "boolean" ? r.readOnly : !!m.value.readOnly), y = b(
2660
+ () => r.keyboardPolicy || m.value.keyboardPolicy || "auto"
2661
+ ), M = b(
2662
+ () => Le(r.locale || m.value.locale || "zh-CN")
2663
+ ), v = b(() => M.value === "en-US"), T = b(() => je(h.value, g.value)), A = Be();
2664
+ G(Ke, h), G(Ue, g), G(
2665
+ He,
2666
+ b(() => a.value === "collapsible")
2667
+ ), G(Ye, y), G(qe, c), G(
2668
+ ze,
2669
+ b(() => r.onTelemetry || null)
2670
+ ), G(Ge, M), G(
2671
+ We,
2672
+ b(() => r.customControls || {})
2673
+ ), G(
2674
+ ue,
2675
+ b(() => r.hostHandlers ?? null)
2676
+ );
2677
+ const L = E(null), P = Fe(null), u = ke({}), k = E([]), V = E(0), d = E(!1);
2678
+ let _ = null;
2679
+ function I() {
2680
+ const F = /* @__PURE__ */ new Map();
2681
+ return {
2682
+ get: (D) => F.get(D),
2683
+ set: (D, R) => F.set(D, R),
2684
+ remove: (D) => F.delete(D)
2685
+ };
2686
+ }
2687
+ function w(F) {
2688
+ return JSON.parse(JSON.stringify(F));
2689
+ }
2690
+ function O(F, D) {
2691
+ const R = new Set(Object.keys(F.fields));
2692
+ for (const H of Object.keys(u))
2693
+ R.has(H) || delete u[H];
2694
+ const N = {};
2695
+ for (const H of R) {
2696
+ const J = { ...F.fields[H] };
2697
+ u[H] = J, N[H] = J;
2698
+ }
2699
+ k.value = _e(D, N, { excludeTaskAndAgreement: !1 }).groups;
2700
+ }
2701
+ async function S(F) {
2702
+ if (_ && (_(), _ = null), d.value = !1, V.value = 0, !F) {
2703
+ P.value = null, k.value = [];
2704
+ return;
2705
+ }
2706
+ const D = w(F), R = new he(D, r.storageAdapter || I());
2707
+ P.value = R;
2708
+ const N = () => {
2709
+ O(R, D), f("change", {
2710
+ values: R.collectFormData({ skipVerify: !0 }),
2711
+ fields: { ...u }
2712
+ });
2713
+ };
2714
+ await R.init(r.initialValues ? { ...r.initialValues } : {}), R.on("afterChange", N), _ = () => {
2715
+ R.off("afterChange", N);
2716
+ }, O(R, D), d.value = !0;
2717
+ }
2718
+ Z(
2719
+ p,
2720
+ (F) => {
2721
+ S(F);
2722
+ },
2723
+ { immediate: !0 }
2724
+ ), be(() => {
2725
+ _ && (_(), _ = null);
2726
+ });
2727
+ const C = b(() => a.value === "step" && k.value.length > 1), j = b(() => Math.min(V.value, Math.max(0, k.value.length - 1))), z = b(
2728
+ () => C.value ? [k.value[j.value]].filter(Boolean) : k.value
2729
+ ), B = b(
2730
+ () => o.value ? Je(k.value, u) : null
2731
+ ), Te = b(
2732
+ () => r.submitText || m.value.submitText || (v.value ? "Submit Form" : "提交表单")
2733
+ );
2734
+ function fe(F) {
2735
+ var H;
2736
+ if (!F || typeof document > "u") return;
2737
+ if (C.value) {
2738
+ const J = k.value.findIndex((oe) => (oe.items || []).some((Ae) => Ae.key === F));
2739
+ J >= 0 && (V.value = J);
2740
+ }
2741
+ const D = L.value || document, R = D.querySelector(`[data-field-key="${F}"]`) || D.querySelector('[data-has-error="1"], .m-field-error');
2742
+ R && typeof R.scrollIntoView == "function" && R.scrollIntoView({ behavior: "smooth", block: "center" });
2743
+ const N = R == null ? void 0 : R.querySelector("input, textarea, select");
2744
+ (H = N == null ? void 0 : N.focus) == null || H.call(N, { preventScroll: !0 });
2745
+ }
2746
+ function we(F) {
2747
+ var N;
2748
+ const D = {};
2749
+ let R = null;
2750
+ for (const H of k.value)
2751
+ for (const J of H.items || []) {
2752
+ const oe = (N = F.fields[J.key]) == null ? void 0 : N.errMsg;
2753
+ oe && (D[J.key] = String(oe), R || (R = J.key));
2754
+ }
2755
+ return { firstErrorKey: R, errors: D };
2756
+ }
2757
+ function de() {
2758
+ const F = P.value, D = p.value;
2759
+ if (!F || !D) return !1;
2760
+ const R = F.validateAll();
2761
+ if (O(F, D), !R) {
2762
+ const N = we(F);
2763
+ f("validate-error", N), fe(N.firstErrorKey);
2764
+ }
2765
+ return R;
2766
+ }
2767
+ function me() {
2768
+ return P.value ? P.value.collectFormData({ skipVerify: !0 }) : {};
2769
+ }
2770
+ function Se(F, D, R) {
2771
+ var N;
2772
+ (N = P.value) == null || N.setControlData(F, D, R);
2773
+ }
2774
+ async function xe(F) {
2775
+ const D = p.value;
2776
+ if (D) {
2777
+ if (F !== void 0) {
2778
+ const R = w(D);
2779
+ _ && (_(), _ = null);
2780
+ const N = new he(R, r.storageAdapter || I());
2781
+ P.value = N;
2782
+ const H = () => {
2783
+ O(N, R), f("change", {
2784
+ values: N.collectFormData({ skipVerify: !0 }),
2785
+ fields: { ...u }
2786
+ });
2787
+ };
2788
+ await N.init({ ...F }), N.on("afterChange", H), _ = () => N.off("afterChange", H), O(N, R), d.value = !0;
2789
+ return;
2790
+ }
2791
+ await S(D);
2792
+ }
2793
+ }
2794
+ function pe() {
2795
+ r.submitting || c.value || de() && f("submit", me());
2796
+ }
2797
+ return n({
2798
+ validate: de,
2799
+ getValues: me,
2800
+ setValue: Se,
2801
+ reset: xe,
2802
+ getCore: () => P.value
2803
+ }), (F, D) => {
2804
+ var R;
2805
+ return s(), i("div", {
2806
+ ref_key: "rootEl",
2807
+ ref: L,
2808
+ class: "apf-prism-form",
2809
+ "data-modern-skin": h.value,
2810
+ style: re({ ...T.value, maxWidth: t.maxWidth })
2811
+ }, [
2812
+ (R = p.value) != null && R.title ? (s(), i("div", Ya, [
2813
+ l(
2814
+ "div",
2815
+ qa,
2816
+ $(p.value.title),
2817
+ 1
2818
+ /* TEXT */
2819
+ ),
2820
+ p.value.description ? (s(), i(
2821
+ "div",
2822
+ za,
2823
+ $(p.value.description),
2824
+ 1
2825
+ /* TEXT */
2826
+ )) : x("v-if", !0)
2827
+ ])) : x("v-if", !0),
2828
+ d.value && B.value && B.value.total > 0 ? (s(), i("div", Ga, [
2829
+ l("div", Wa, [
2830
+ v.value ? (s(), i("span", Ja, [
2831
+ D[3] || (D[3] = X(
2832
+ " Progress ",
2833
+ -1
2834
+ /* CACHED */
2835
+ )),
2836
+ l(
2837
+ "strong",
2838
+ null,
2839
+ $(B.value.percent) + "%",
2840
+ 1
2841
+ /* TEXT */
2842
+ ),
2843
+ X(
2844
+ " (Required " + $(B.value.requiredFilled) + "/" + $(B.value.requiredTotal) + ") ",
2845
+ 1
2846
+ /* TEXT */
2847
+ )
2848
+ ])) : (s(), i("span", Xa, [
2849
+ D[4] || (D[4] = X(
2850
+ " 填写进度 ",
2851
+ -1
2852
+ /* CACHED */
2853
+ )),
2854
+ l(
2855
+ "strong",
2856
+ null,
2857
+ $(B.value.percent) + "%",
2858
+ 1
2859
+ /* TEXT */
2860
+ ),
2861
+ X(
2862
+ "(必填 " + $(B.value.requiredFilled) + "/" + $(B.value.requiredTotal) + ") ",
2863
+ 1
2864
+ /* TEXT */
2865
+ )
2866
+ ])),
2867
+ B.value.firstMissingRequiredKey ? (s(), i(
2868
+ "button",
2869
+ {
2870
+ key: 2,
2871
+ type: "button",
2872
+ class: "apf-prism-form__jump",
2873
+ onClick: D[0] || (D[0] = (N) => fe(B.value.firstMissingRequiredKey))
2874
+ },
2875
+ $(v.value ? "Next required ›" : "定位未填 ›"),
2876
+ 1
2877
+ /* TEXT */
2878
+ )) : x("v-if", !0)
2879
+ ]),
2880
+ l("div", Qa, [
2881
+ l(
2882
+ "div",
2883
+ {
2884
+ class: "apf-prism-form__bar-fill",
2885
+ style: re({ width: `${B.value.percent}%` })
2886
+ },
2887
+ null,
2888
+ 4
2889
+ /* STYLE */
2890
+ )
2891
+ ])
2892
+ ])) : x("v-if", !0),
2893
+ d.value && C.value ? (s(), i("div", Za, [
2894
+ (s(!0), i(
2895
+ q,
2896
+ null,
2897
+ W(k.value, (N, H) => (s(), i("button", {
2898
+ key: N.key || H,
2899
+ type: "button",
2900
+ class: K(["apf-prism-form__step-pill", { "is-active": j.value === H }]),
2901
+ onClick: (J) => V.value = H
2902
+ }, $(H + 1) + ". " + $(N.title || (v.value ? `Step ${H + 1}` : `第${H + 1}步`)), 11, en))),
2903
+ 128
2904
+ /* KEYED_FRAGMENT */
2905
+ ))
2906
+ ])) : x("v-if", !0),
2907
+ d.value && P.value ? (s(), ee(Ua, De({
2908
+ key: 3,
2909
+ groups: z.value,
2910
+ fields: u,
2911
+ "form-core": P.value,
2912
+ "custom-controls": t.customControls,
2913
+ "host-handlers": t.hostHandlers
2914
+ }, ne(A)), {
2915
+ footer: te(() => [
2916
+ C.value ? (s(), i("div", tn, [
2917
+ l("button", {
2918
+ type: "button",
2919
+ class: "apf-prism-form__step-btn",
2920
+ disabled: j.value <= 0,
2921
+ onClick: D[1] || (D[1] = (N) => V.value = Math.max(0, j.value - 1))
2922
+ }, $(v.value ? "Previous" : "上一步"), 9, ln),
2923
+ l(
2924
+ "span",
2925
+ an,
2926
+ $(j.value + 1) + " / " + $(k.value.length),
2927
+ 1
2928
+ /* TEXT */
2929
+ ),
2930
+ l("button", {
2931
+ type: "button",
2932
+ class: "apf-prism-form__step-btn is-primary",
2933
+ disabled: j.value >= k.value.length - 1,
2934
+ onClick: D[2] || (D[2] = (N) => V.value = Math.min(k.value.length - 1, j.value + 1))
2935
+ }, $(v.value ? "Next" : "下一步"), 9, nn)
2936
+ ])) : x("v-if", !0),
2937
+ ye(F.$slots, "footer", {
2938
+ submit: pe,
2939
+ validate: de,
2940
+ submitting: t.submitting
2941
+ }, () => [
2942
+ t.showSubmit && !c.value ? (s(), i("div", on, [
2943
+ l("button", {
2944
+ type: "button",
2945
+ class: "apf-prism-form__submit",
2946
+ disabled: t.submitting,
2947
+ onClick: pe
2948
+ }, $(t.submitting ? v.value ? "Submitting…" : "提交中…" : Te.value), 9, sn)
2949
+ ])) : x("v-if", !0)
2950
+ ], !0)
2951
+ ]),
2952
+ _: 3
2953
+ /* FORWARDED */
2954
+ }, 16, ["groups", "fields", "form-core", "custom-controls", "host-handlers"])) : x("v-if", !0)
2955
+ ], 12, Ha);
2956
+ };
2957
+ }
2958
+ }), mn = /* @__PURE__ */ Y(rn, [["__scopeId", "data-v-0355ca79"]]);
2959
+ function pn(t, n, e) {
2960
+ const r = _e(t, void 0, e), f = ke({
2961
+ groups: r.groups,
2962
+ fields: {}
2963
+ });
2964
+ function p() {
2965
+ const a = {};
2966
+ for (const o of Object.keys(n.fields))
2967
+ a[o] = { ...n.fields[o] };
2968
+ Object.assign(f.fields, a);
2969
+ }
2970
+ function m() {
2971
+ p();
2972
+ const a = {};
2973
+ for (const o of Object.keys(n.fields))
2974
+ a[o] = n.fields[o];
2975
+ r.update(a), f.groups.splice(0, f.groups.length, ...r.groups);
2976
+ }
2977
+ n.on("afterChange", m);
2978
+ function h() {
2979
+ n.off("afterChange", m);
2980
+ }
2981
+ Re() && be(h), p();
2982
+ const g = {};
2983
+ for (const a of Object.keys(n.fields))
2984
+ g[a] = n.fields[a];
2985
+ return r.update(g), f.groups = r.groups, { groups: f.groups, fields: f.fields, formCore: n, destroy: h };
2986
+ }
2987
+ export {
2988
+ La as FormGroup,
2989
+ $e as FormItem,
2990
+ Ua as FormRender,
2991
+ mn as PrismForm,
2992
+ yn as createFetchHostHandlers,
2993
+ bn as setTaskHandlers,
2994
+ pn as useFormRender
2995
+ };