inquirer-form 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,2099 @@
1
+ import { defineComponent as h, computed as V, createBlock as x, openBlock as u, unref as o, withCtx as w, createElementVNode as c, createElementBlock as d, createCommentVNode as y, toDisplayString as f, Fragment as S, renderList as I, toRefs as B, createVNode as b, createSlots as re, createTextVNode as Y, renderSlot as ne, ref as L, Transition as Ie, mergeProps as D, onBeforeUnmount as ue, watch as ee, resolveComponent as Ne, resolveDynamicComponent as ae, normalizeProps as Be, guardReactiveProps as Ae, onMounted as Re, withDirectives as W, normalizeClass as Te, vShow as X } from "vue";
2
+ import { FormItemWrapper as de, TextSetting as N, SwitchSetting as le, OptionsEditor as ce, registry as Q, SchemaEngine as pe, FormDesigner as me, serialize as De } from "agilebuilder-form";
3
+ import { ElInput as H, ElTooltip as ze, ElIcon as Fe, ElInputNumber as fe, ElSwitch as Le, ElSelect as ve, ElOption as be, ElCheckboxGroup as Me, ElCheckbox as Oe, ElForm as Je } from "element-plus";
4
+ import { useI18n as Pe } from "vue-i18n";
5
+ const Qe = { class: "inquirer-designer-card" }, je = { class: "card-header" }, Ge = { class: "type-badge" }, Ye = { class: "message" }, He = {
6
+ key: 0,
7
+ class: "description"
8
+ }, Ke = {
9
+ key: 1,
10
+ class: "options-preview"
11
+ }, We = {
12
+ key: 0,
13
+ class: "more"
14
+ }, Xe = /* @__PURE__ */ h({
15
+ inheritAttrs: !1,
16
+ __name: "BaseQuestionDesigner",
17
+ props: {
18
+ label: {},
19
+ message: {},
20
+ description: {},
21
+ typeLabel: {},
22
+ options: {},
23
+ isActive: { type: Boolean },
24
+ previewCount: {}
25
+ },
26
+ emits: ["select"],
27
+ setup(e, { emit: t }) {
28
+ const l = e, s = t, a = V(() => l.previewCount ?? 3), i = V(() => l.options?.slice(0, a.value) ?? []), n = V(() => (l.options?.length ?? 0) > a.value), r = V(() => l.label || l.message || l.typeLabel), g = V(() => l.message || "未设置 message");
29
+ return (m, p) => (u(), x(o(de), {
30
+ selectable: "",
31
+ label: r.value,
32
+ "is-active": e.isActive,
33
+ onSelect: p[0] || (p[0] = (v) => s("select"))
34
+ }, {
35
+ default: w(() => [
36
+ c("div", Qe, [
37
+ c("header", je, [
38
+ c("span", Ge, f(e.typeLabel), 1)
39
+ ]),
40
+ c("div", Ye, f(g.value), 1),
41
+ e.description ? (u(), d("p", He, f(e.description), 1)) : y("", !0),
42
+ i.value.length ? (u(), d("ul", Ke, [
43
+ (u(!0), d(S, null, I(i.value, (v) => (u(), d("li", {
44
+ key: v.value
45
+ }, f(v.label || v.value), 1))), 128)),
46
+ n.value ? (u(), d("li", We, "…")) : y("", !0)
47
+ ])) : y("", !0)
48
+ ])
49
+ ]),
50
+ _: 1
51
+ }, 8, ["label", "is-active"]));
52
+ }
53
+ }), _ = (e, t) => {
54
+ const l = e.__vccOpts || e;
55
+ for (const [s, a] of t)
56
+ l[s] = a;
57
+ return l;
58
+ }, A = /* @__PURE__ */ _(Xe, [["__scopeId", "data-v-5aa173c3"]]), Ze = /* @__PURE__ */ h({
59
+ __name: "designer",
60
+ props: {
61
+ label: {},
62
+ message: {},
63
+ description: {},
64
+ isActive: { type: Boolean }
65
+ },
66
+ emits: ["select"],
67
+ setup(e, { emit: t }) {
68
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r } = B(l);
69
+ return (g, m) => (u(), x(A, {
70
+ label: o(a),
71
+ message: o(i),
72
+ description: o(n),
73
+ "type-label": "Inquirer Input",
74
+ "is-active": o(r),
75
+ onSelect: m[0] || (m[0] = (p) => s("select"))
76
+ }, null, 8, ["label", "message", "description", "is-active"]));
77
+ }
78
+ }), el = { class: "inquirer-input" }, ll = {
79
+ key: 0,
80
+ class: "transformer-preview"
81
+ }, tl = /* @__PURE__ */ h({
82
+ __name: "runtime",
83
+ props: {
84
+ modelValue: {},
85
+ placeholder: {},
86
+ disabled: { type: Boolean },
87
+ prefix: {},
88
+ suffix: {},
89
+ displayValue: {}
90
+ },
91
+ emits: ["update:modelValue"],
92
+ setup(e, { emit: t }) {
93
+ const l = e, s = t, a = V(() => l.displayValue === void 0 ? !1 : l.displayValue !== l.modelValue);
94
+ return (i, n) => (u(), d("div", el, [
95
+ b(o(H), {
96
+ "model-value": e.modelValue ?? "",
97
+ placeholder: e.placeholder,
98
+ disabled: e.disabled,
99
+ clearable: "",
100
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => s("update:modelValue", r ?? ""))
101
+ }, re({ _: 2 }, [
102
+ e.prefix ? {
103
+ name: "prepend",
104
+ fn: w(() => [
105
+ Y(f(e.prefix), 1)
106
+ ]),
107
+ key: "0"
108
+ } : void 0,
109
+ e.suffix ? {
110
+ name: "append",
111
+ fn: w(() => [
112
+ Y(f(e.suffix), 1)
113
+ ]),
114
+ key: "1"
115
+ } : void 0
116
+ ]), 1032, ["model-value", "placeholder", "disabled"]),
117
+ a.value ? (u(), d("p", ll, f(e.displayValue), 1)) : y("", !0)
118
+ ]));
119
+ }
120
+ }), nl = /* @__PURE__ */ _(tl, [["__scopeId", "data-v-b9ac497e"]]), sl = { class: "base-input-config" }, ol = /* @__PURE__ */ h({
121
+ __name: "BaseInputConfig",
122
+ props: {
123
+ label: {},
124
+ field: {}
125
+ },
126
+ emits: ["update"],
127
+ setup(e, { emit: t }) {
128
+ const l = t;
129
+ function s(i) {
130
+ l("update", { field: i });
131
+ }
132
+ function a(i, n) {
133
+ l("update", { props: { [i]: n } });
134
+ }
135
+ return (i, n) => (u(), d("div", sl, [
136
+ b(o(N), {
137
+ label: i.$t("designer.node.field_label"),
138
+ modelValue: e.field,
139
+ "onUpdate:modelValue": s
140
+ }, null, 8, ["label", "modelValue"]),
141
+ b(o(N), {
142
+ label: i.$t("designer.form.fields.label_label"),
143
+ modelValue: e.label,
144
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => a("label", r))
145
+ }, null, 8, ["label", "modelValue"]),
146
+ ne(i.$slots, "default", { updateProp: a }, void 0, !0)
147
+ ]));
148
+ }
149
+ }), al = /* @__PURE__ */ _(ol, [["__scopeId", "data-v-bd4a89f6"]]), il = { class: "textarea-setting" }, rl = {
150
+ key: 0,
151
+ class: "hint"
152
+ }, ul = /* @__PURE__ */ h({
153
+ __name: "TextareaSetting",
154
+ props: {
155
+ label: {},
156
+ modelValue: {},
157
+ hint: {},
158
+ minRows: { default: 2 },
159
+ maxRows: { default: 4 }
160
+ },
161
+ emits: ["update:modelValue"],
162
+ setup(e, { emit: t }) {
163
+ const l = t;
164
+ return (s, a) => (u(), d("div", il, [
165
+ c("label", null, f(e.label), 1),
166
+ b(o(H), {
167
+ type: "textarea",
168
+ "model-value": e.modelValue,
169
+ autosize: { minRows: e.minRows, maxRows: e.maxRows },
170
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => l("update:modelValue", i ?? ""))
171
+ }, null, 8, ["model-value", "autosize"]),
172
+ e.hint ? (u(), d("p", rl, f(e.hint), 1)) : y("", !0)
173
+ ]));
174
+ }
175
+ }), dl = /* @__PURE__ */ _(ul, [["__scopeId", "data-v-2c386165"]]);
176
+ var cl = /* @__PURE__ */ h({
177
+ name: "InfoFilled",
178
+ __name: "info-filled",
179
+ setup(e) {
180
+ return (t, l) => (u(), d("svg", {
181
+ xmlns: "http://www.w3.org/2000/svg",
182
+ viewBox: "0 0 1024 1024"
183
+ }, [
184
+ c("path", {
185
+ fill: "currentColor",
186
+ d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
187
+ })
188
+ ]));
189
+ }
190
+ }), pl = cl;
191
+ const ml = {
192
+ "zh-CN": {
193
+ config: {
194
+ message: "提问文案 (message)",
195
+ description: "描述 / 帮助信息 (description)",
196
+ placeholder: "占位提示",
197
+ default_value: "默认值",
198
+ prefix: "前缀",
199
+ suffix: "后缀",
200
+ required: "必填",
201
+ expressions: {
202
+ when_label: "when 表达式",
203
+ when_info: "控制是否展示该问题,可使用 input、answers,返回 true/false。",
204
+ validate_label: "validate 表达式",
205
+ validate_info: "校验输入,返回 true 表示通过,返回字符串为错误提示。",
206
+ filter_label: "filter 表达式",
207
+ filter_info: "提交前对值做处理,返回值会写入 answers 并导出给 inquirer。",
208
+ transformer_label: "transformer 表达式",
209
+ transformer_info: "仅影响展示,返回值用于实时提示,不写入 answers。"
210
+ }
211
+ },
212
+ editor: {
213
+ placeholder: "请输入 JavaScript 函数体",
214
+ show_examples: "查看示例",
215
+ hide_examples: "收起示例",
216
+ examples_title: "示例"
217
+ }
218
+ },
219
+ "en-US": {
220
+ config: {
221
+ message: "Prompt message",
222
+ description: "Description / helper text",
223
+ placeholder: "Placeholder",
224
+ default_value: "Default value",
225
+ prefix: "Prefix",
226
+ suffix: "Suffix",
227
+ required: "Required",
228
+ expressions: {
229
+ when_label: "when expression",
230
+ when_info: "Control whether this question is shown. Use input / answers and return true or false.",
231
+ validate_label: "validate expression",
232
+ validate_info: "Validate the input. Return true to pass or a string as the error.",
233
+ filter_label: "filter expression",
234
+ filter_info: "Transform the value before submit. Returned value is written to answers and exported.",
235
+ transformer_label: "transformer expression",
236
+ transformer_info: "Affects display only. Returned value is shown but not written to answers."
237
+ }
238
+ },
239
+ editor: {
240
+ placeholder: "Enter JavaScript function body",
241
+ show_examples: "Show examples",
242
+ hide_examples: "Hide examples",
243
+ examples_title: "Examples"
244
+ }
245
+ }
246
+ };
247
+ function xe() {
248
+ return Pe({
249
+ inheritLocale: !0,
250
+ useScope: "local",
251
+ messages: ml
252
+ });
253
+ }
254
+ const fl = { class: "expression-editor" }, vl = { class: "expression-editor__label" }, bl = {
255
+ key: 0,
256
+ class: "expression-editor__examples"
257
+ }, xl = { class: "examples-title" }, hl = { class: "examples-list" }, gl = { class: "expression-editor__footer" }, yl = /* @__PURE__ */ h({
258
+ __name: "ExpressionEditor",
259
+ props: {
260
+ label: {},
261
+ modelValue: {},
262
+ hint: {},
263
+ info: {},
264
+ placeholder: {},
265
+ minRows: { default: 6 },
266
+ maxRows: { default: 10 },
267
+ suggestions: { default: () => [] }
268
+ },
269
+ emits: ["update:modelValue"],
270
+ setup(e, { emit: t }) {
271
+ const l = e, s = t, { t: a } = xe(), i = [
272
+ "return input;",
273
+ 'return input?.trim() ?? "";',
274
+ "return input ? input.toUpperCase() : input;",
275
+ "return answers.otherField;"
276
+ ], n = V(() => l.placeholder || a("editor.placeholder")), r = V(() => a("editor.show_examples")), g = V(() => a("editor.hide_examples")), m = V(() => a("editor.examples_title")), p = V(() => l.suggestions && l.suggestions.length > 0 ? l.suggestions : i), v = L(!1);
277
+ function O() {
278
+ v.value = !v.value;
279
+ }
280
+ return (j, J) => (u(), d("div", fl, [
281
+ c("label", vl, [
282
+ c("span", null, f(e.label), 1),
283
+ e.info ? (u(), x(o(ze), {
284
+ key: 0,
285
+ placement: "top",
286
+ effect: "dark",
287
+ content: e.info
288
+ }, {
289
+ default: w(() => [
290
+ b(o(Fe), { class: "info-icon" }, {
291
+ default: w(() => [
292
+ b(o(pl))
293
+ ]),
294
+ _: 1
295
+ })
296
+ ]),
297
+ _: 1
298
+ }, 8, ["content"])) : y("", !0)
299
+ ]),
300
+ b(o(H), {
301
+ class: "code-input",
302
+ type: "textarea",
303
+ "model-value": e.modelValue,
304
+ autosize: { minRows: e.minRows, maxRows: e.maxRows },
305
+ placeholder: n.value,
306
+ "onUpdate:modelValue": J[0] || (J[0] = (C) => s("update:modelValue", C ?? ""))
307
+ }, null, 8, ["model-value", "autosize", "placeholder"]),
308
+ b(Ie, { name: "fade" }, {
309
+ default: w(() => [
310
+ v.value ? (u(), d("div", bl, [
311
+ c("p", xl, f(m.value), 1),
312
+ c("ul", hl, [
313
+ (u(!0), d(S, null, I(p.value, (C) => (u(), d("li", { key: C }, [
314
+ c("code", null, f(C), 1)
315
+ ]))), 128))
316
+ ])
317
+ ])) : y("", !0)
318
+ ]),
319
+ _: 1
320
+ }),
321
+ c("div", gl, [
322
+ c("button", {
323
+ class: "example-toggle",
324
+ type: "button",
325
+ onClick: O
326
+ }, f(v.value ? g.value : r.value), 1)
327
+ ])
328
+ ]));
329
+ }
330
+ }), Z = /* @__PURE__ */ _(yl, [["__scopeId", "data-v-91ba45bb"]]), Vl = { class: "inline-settings" }, wl = /* @__PURE__ */ h({
331
+ __name: "BaseQuestionConfig",
332
+ props: {
333
+ label: {},
334
+ field: {},
335
+ message: {},
336
+ description: {},
337
+ placeholder: {},
338
+ defaultValue: {},
339
+ prefix: {},
340
+ suffix: {},
341
+ required: { type: Boolean },
342
+ whenExpression: {},
343
+ validateExpression: {},
344
+ filterExpression: {},
345
+ transformerExpression: {},
346
+ showPlaceholder: { type: Boolean, default: !0 },
347
+ showDefaultInput: { type: Boolean, default: !0 }
348
+ },
349
+ emits: ["update"],
350
+ setup(e, { emit: t }) {
351
+ const l = [
352
+ "return answers.age >= 18;",
353
+ "return answers.role === 'admin';",
354
+ "return Boolean(input);"
355
+ ], s = [
356
+ `if (!input) return '必填';
357
+ return true;`,
358
+ `if ((input || "").length < 3) return "至少 3 个字符";
359
+ return true;`,
360
+ 'return Array.isArray(input) && input.length > 0 ? true : "请选择至少一项";'
361
+ ], a = [
362
+ 'return input?.trim() ?? "";',
363
+ "return Number(input) || 0;",
364
+ "return input?.toLowerCase();"
365
+ ], i = [
366
+ "return input ? `⭐ ${input}` : input;",
367
+ 'return input ? `${input} (${answers.unit || ""})` : input;',
368
+ "return input ? input.toUpperCase() : input;"
369
+ ], { t: n } = xe(), r = t;
370
+ return (g, m) => (u(), x(al, {
371
+ label: e.label,
372
+ field: e.field,
373
+ onUpdate: m[0] || (m[0] = (p) => r("update", p))
374
+ }, {
375
+ default: w(({ updateProp: p }) => [
376
+ b(o(N), {
377
+ label: o(n)("config.message"),
378
+ "model-value": e.message,
379
+ "onUpdate:modelValue": (v) => p("message", v)
380
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"]),
381
+ b(dl, {
382
+ label: o(n)("config.description"),
383
+ "model-value": e.description,
384
+ "min-rows": 2,
385
+ "max-rows": 3,
386
+ "onUpdate:modelValue": (v) => p("description", v)
387
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"]),
388
+ e.showPlaceholder ? (u(), x(o(N), {
389
+ key: 0,
390
+ label: o(n)("config.placeholder"),
391
+ "model-value": e.placeholder,
392
+ "onUpdate:modelValue": (v) => p("placeholder", v)
393
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"])) : y("", !0),
394
+ ne(g.$slots, "defaultValue", { updateProp: p }, () => [
395
+ e.showDefaultInput ? (u(), x(o(N), {
396
+ key: 0,
397
+ label: o(n)("config.default_value"),
398
+ "model-value": e.defaultValue,
399
+ "onUpdate:modelValue": (v) => p("defaultValue", v)
400
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"])) : y("", !0)
401
+ ], !0),
402
+ c("div", Vl, [
403
+ b(o(N), {
404
+ label: o(n)("config.prefix"),
405
+ "model-value": e.prefix,
406
+ "onUpdate:modelValue": (v) => p("prefix", v)
407
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"]),
408
+ b(o(N), {
409
+ label: o(n)("config.suffix"),
410
+ "model-value": e.suffix,
411
+ "onUpdate:modelValue": (v) => p("suffix", v)
412
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"])
413
+ ]),
414
+ b(o(le), {
415
+ label: o(n)("config.required"),
416
+ "model-value": e.required,
417
+ "onUpdate:modelValue": (v) => p("required", v)
418
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"]),
419
+ ne(g.$slots, "extra", { updateProp: p }, void 0, !0),
420
+ b(Z, {
421
+ label: o(n)("config.expressions.when_label"),
422
+ info: o(n)("config.expressions.when_info"),
423
+ "model-value": e.whenExpression,
424
+ "min-rows": 2,
425
+ "max-rows": 3,
426
+ placeholder: o(n)("editor.placeholder"),
427
+ suggestions: l,
428
+ "onUpdate:modelValue": (v) => p("whenExpression", v)
429
+ }, null, 8, ["label", "info", "model-value", "placeholder", "onUpdate:modelValue"]),
430
+ b(Z, {
431
+ label: o(n)("config.expressions.validate_label"),
432
+ info: o(n)("config.expressions.validate_info"),
433
+ "model-value": e.validateExpression,
434
+ "min-rows": 3,
435
+ "max-rows": 5,
436
+ placeholder: o(n)("editor.placeholder"),
437
+ suggestions: s,
438
+ "onUpdate:modelValue": (v) => p("validateExpression", v)
439
+ }, null, 8, ["label", "info", "model-value", "placeholder", "onUpdate:modelValue"]),
440
+ b(Z, {
441
+ label: o(n)("config.expressions.filter_label"),
442
+ info: o(n)("config.expressions.filter_info"),
443
+ "model-value": e.filterExpression,
444
+ "min-rows": 2,
445
+ "max-rows": 4,
446
+ placeholder: o(n)("editor.placeholder"),
447
+ suggestions: a,
448
+ "onUpdate:modelValue": (v) => p("filterExpression", v)
449
+ }, null, 8, ["label", "info", "model-value", "placeholder", "onUpdate:modelValue"]),
450
+ b(Z, {
451
+ label: o(n)("config.expressions.transformer_label"),
452
+ info: o(n)("config.expressions.transformer_info"),
453
+ "model-value": e.transformerExpression,
454
+ "min-rows": 2,
455
+ "max-rows": 4,
456
+ placeholder: o(n)("editor.placeholder"),
457
+ suggestions: i,
458
+ "onUpdate:modelValue": (v) => p("transformerExpression", v)
459
+ }, null, 8, ["label", "info", "model-value", "placeholder", "onUpdate:modelValue"])
460
+ ]),
461
+ _: 3
462
+ }, 8, ["label", "field"]));
463
+ }
464
+ }), M = /* @__PURE__ */ _(wl, [["__scopeId", "data-v-c4882c52"]]), _l = /* @__PURE__ */ h({
465
+ __name: "config",
466
+ props: {
467
+ label: {},
468
+ field: {},
469
+ message: {},
470
+ placeholder: {},
471
+ defaultValue: {},
472
+ prefix: {},
473
+ suffix: {},
474
+ required: { type: Boolean },
475
+ whenExpression: {},
476
+ validateExpression: {},
477
+ filterExpression: {},
478
+ transformerExpression: {}
479
+ },
480
+ emits: ["update"],
481
+ setup(e, { emit: t }) {
482
+ const l = e, s = t;
483
+ return (a, i) => (u(), x(M, D(l, {
484
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
485
+ }), null, 16));
486
+ }
487
+ });
488
+ function R(e) {
489
+ return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
490
+ }
491
+ function k(e, t) {
492
+ return {
493
+ label: e,
494
+ value: t ?? e
495
+ };
496
+ }
497
+ const he = {
498
+ type: "inq-input",
499
+ category: "inputControl",
500
+ label: "输入",
501
+ icon: "⌨️",
502
+ isContainer: !1,
503
+ initialSchema: () => ({
504
+ id: R("inq_input"),
505
+ type: "inq-input",
506
+ field: "question_" + Math.random().toString(36).slice(2, 6),
507
+ props: {
508
+ label: "普通输入",
509
+ message: "请输入内容",
510
+ promptType: "input",
511
+ placeholder: "例如:姓名",
512
+ defaultValue: "",
513
+ prefix: "",
514
+ suffix: "",
515
+ required: !1,
516
+ whenExpression: "",
517
+ validateExpression: "",
518
+ filterExpression: "",
519
+ transformerExpression: ""
520
+ }
521
+ }),
522
+ designer: Ze,
523
+ runtime: nl,
524
+ config: _l,
525
+ locales: {
526
+ "zh-CN": { control: { "inq-input": { label: "输入" } } },
527
+ "en-US": { control: { "inq-input": { label: "Input" } } }
528
+ }
529
+ }, ql = /* @__PURE__ */ h({
530
+ __name: "designer",
531
+ props: {
532
+ label: {},
533
+ message: {},
534
+ description: {},
535
+ isActive: { type: Boolean }
536
+ },
537
+ emits: ["select"],
538
+ setup(e, { emit: t }) {
539
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r } = B(l);
540
+ return (g, m) => (u(), x(A, {
541
+ label: o(a),
542
+ message: o(i),
543
+ description: o(n),
544
+ "type-label": "Inquirer Password",
545
+ "is-active": o(r),
546
+ onSelect: m[0] || (m[0] = (p) => s("select"))
547
+ }, null, 8, ["label", "message", "description", "is-active"]));
548
+ }
549
+ }), El = { class: "inquirer-password" }, Sl = {
550
+ key: 0,
551
+ class: "mask-hint"
552
+ }, kl = /* @__PURE__ */ h({
553
+ __name: "runtime",
554
+ props: {
555
+ modelValue: {},
556
+ placeholder: {},
557
+ disabled: { type: Boolean },
558
+ prefix: {},
559
+ suffix: {},
560
+ maskEnabled: { type: Boolean },
561
+ maskSymbol: {}
562
+ },
563
+ emits: ["update:modelValue"],
564
+ setup(e, { emit: t }) {
565
+ const l = t;
566
+ return (s, a) => (u(), d("div", El, [
567
+ b(o(H), {
568
+ "model-value": e.modelValue ?? "",
569
+ placeholder: e.placeholder,
570
+ disabled: e.disabled,
571
+ type: "password",
572
+ "show-password": "",
573
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => l("update:modelValue", i ?? ""))
574
+ }, re({ _: 2 }, [
575
+ e.prefix ? {
576
+ name: "prepend",
577
+ fn: w(() => [
578
+ Y(f(e.prefix), 1)
579
+ ]),
580
+ key: "0"
581
+ } : void 0,
582
+ e.suffix ? {
583
+ name: "append",
584
+ fn: w(() => [
585
+ Y(f(e.suffix), 1)
586
+ ]),
587
+ key: "1"
588
+ } : void 0
589
+ ]), 1032, ["model-value", "placeholder", "disabled"]),
590
+ e.maskEnabled ? (u(), d("p", Sl, " 输出将使用 " + f(e.maskSymbol || "掩码") + " 掩码 ", 1)) : y("", !0)
591
+ ]));
592
+ }
593
+ }), Cl = /* @__PURE__ */ _(kl, [["__scopeId", "data-v-0cb418f2"]]), $l = /* @__PURE__ */ h({
594
+ __name: "config",
595
+ props: {
596
+ label: {},
597
+ field: {},
598
+ message: {},
599
+ placeholder: {},
600
+ defaultValue: {},
601
+ prefix: {},
602
+ suffix: {},
603
+ required: { type: Boolean },
604
+ whenExpression: {},
605
+ validateExpression: {},
606
+ filterExpression: {},
607
+ transformerExpression: {},
608
+ maskEnabled: { type: Boolean },
609
+ maskSymbol: {}
610
+ },
611
+ emits: ["update"],
612
+ setup(e, { emit: t }) {
613
+ const l = e, s = t;
614
+ return (a, i) => (u(), x(M, D(l, {
615
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
616
+ }), {
617
+ extra: w(({ updateProp: n }) => [
618
+ b(o(le), {
619
+ label: "掩码输出",
620
+ "model-value": e.maskEnabled,
621
+ "onUpdate:modelValue": (r) => n("maskEnabled", r)
622
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
623
+ e.maskEnabled ? (u(), x(o(N), {
624
+ key: 0,
625
+ label: "掩码符号",
626
+ "model-value": e.maskSymbol,
627
+ "onUpdate:modelValue": (r) => n("maskSymbol", r)
628
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : y("", !0)
629
+ ]),
630
+ _: 1
631
+ }, 16));
632
+ }
633
+ }), ge = {
634
+ type: "inq-password",
635
+ category: "inputControl",
636
+ label: "密码",
637
+ icon: "🔒",
638
+ isContainer: !1,
639
+ initialSchema: () => ({
640
+ id: R("inq_password"),
641
+ type: "inq-password",
642
+ field: "secret_" + Math.random().toString(36).slice(2, 6),
643
+ props: {
644
+ label: "密码",
645
+ message: "请输入密码",
646
+ promptType: "password",
647
+ placeholder: "******",
648
+ defaultValue: "",
649
+ prefix: "",
650
+ suffix: "",
651
+ maskEnabled: !0,
652
+ maskSymbol: "*",
653
+ required: !0,
654
+ whenExpression: "",
655
+ validateExpression: "",
656
+ filterExpression: "",
657
+ transformerExpression: ""
658
+ }
659
+ }),
660
+ designer: ql,
661
+ runtime: Cl,
662
+ config: $l,
663
+ locales: {
664
+ "zh-CN": { control: { "inq-password": { label: "密码" } } },
665
+ "en-US": { control: { "inq-password": { label: "Password" } } }
666
+ }
667
+ }, Ul = /* @__PURE__ */ h({
668
+ __name: "designer",
669
+ props: {
670
+ label: {},
671
+ message: {},
672
+ description: {},
673
+ isActive: { type: Boolean }
674
+ },
675
+ emits: ["select"],
676
+ setup(e, { emit: t }) {
677
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r } = B(l);
678
+ return (g, m) => (u(), x(A, {
679
+ label: o(a),
680
+ message: o(i),
681
+ description: o(n),
682
+ "type-label": "Inquirer Number",
683
+ "is-active": o(r),
684
+ onSelect: m[0] || (m[0] = (p) => s("select"))
685
+ }, null, 8, ["label", "message", "description", "is-active"]));
686
+ }
687
+ }), Il = { class: "number-runtime" }, Nl = {
688
+ key: 0,
689
+ class: "affix"
690
+ }, Bl = {
691
+ key: 1,
692
+ class: "affix"
693
+ }, Al = /* @__PURE__ */ h({
694
+ __name: "runtime",
695
+ props: {
696
+ modelValue: {},
697
+ placeholder: {},
698
+ disabled: { type: Boolean },
699
+ min: {},
700
+ max: {},
701
+ step: {},
702
+ prefix: {},
703
+ suffix: {}
704
+ },
705
+ emits: ["update:modelValue"],
706
+ setup(e, { emit: t }) {
707
+ const l = t;
708
+ return (s, a) => (u(), d("div", Il, [
709
+ e.prefix ? (u(), d("span", Nl, f(e.prefix), 1)) : y("", !0),
710
+ b(o(fe), {
711
+ class: "number-runtime__input",
712
+ "model-value": e.modelValue,
713
+ placeholder: e.placeholder,
714
+ disabled: e.disabled,
715
+ min: e.min,
716
+ max: e.max,
717
+ step: e.step || 1,
718
+ "controls-position": "right",
719
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => l("update:modelValue", i ?? void 0))
720
+ }, null, 8, ["model-value", "placeholder", "disabled", "min", "max", "step"]),
721
+ e.suffix ? (u(), d("span", Bl, f(e.suffix), 1)) : y("", !0)
722
+ ]));
723
+ }
724
+ }), Rl = /* @__PURE__ */ _(Al, [["__scopeId", "data-v-ade0684b"]]), Tl = { class: "number-setting" }, Dl = /* @__PURE__ */ h({
725
+ __name: "NumberSetting",
726
+ props: {
727
+ label: {},
728
+ modelValue: {},
729
+ min: { default: Number.NEGATIVE_INFINITY },
730
+ max: { default: Number.POSITIVE_INFINITY },
731
+ step: { default: 1 }
732
+ },
733
+ emits: ["update:modelValue"],
734
+ setup(e, { emit: t }) {
735
+ const l = t;
736
+ return (s, a) => (u(), d("div", Tl, [
737
+ c("label", null, f(e.label), 1),
738
+ b(o(fe), {
739
+ "model-value": e.modelValue,
740
+ min: e.min,
741
+ max: e.max,
742
+ step: e.step,
743
+ "controls-position": "right",
744
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => l("update:modelValue", i ?? void 0))
745
+ }, null, 8, ["model-value", "min", "max", "step"])
746
+ ]));
747
+ }
748
+ }), P = /* @__PURE__ */ _(Dl, [["__scopeId", "data-v-4fb22ad3"]]), zl = /* @__PURE__ */ h({
749
+ __name: "config",
750
+ props: {
751
+ label: {},
752
+ field: {},
753
+ message: {},
754
+ defaultValue: {},
755
+ prefix: {},
756
+ suffix: {},
757
+ required: { type: Boolean },
758
+ whenExpression: {},
759
+ validateExpression: {},
760
+ filterExpression: {},
761
+ transformerExpression: {},
762
+ min: {},
763
+ max: {},
764
+ step: {}
765
+ },
766
+ emits: ["update"],
767
+ setup(e, { emit: t }) {
768
+ const l = e, s = t;
769
+ return (a, i) => (u(), x(M, D(l, {
770
+ "show-placeholder": !1,
771
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
772
+ }), {
773
+ defaultValue: w(({ updateProp: n }) => [
774
+ b(P, {
775
+ label: "默认值",
776
+ "model-value": e.defaultValue,
777
+ "onUpdate:modelValue": (r) => n("defaultValue", r)
778
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
779
+ ]),
780
+ extra: w(({ updateProp: n }) => [
781
+ b(P, {
782
+ label: "最小值",
783
+ "model-value": e.min,
784
+ "onUpdate:modelValue": (r) => n("min", r)
785
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
786
+ b(P, {
787
+ label: "最大值",
788
+ "model-value": e.max,
789
+ "onUpdate:modelValue": (r) => n("max", r)
790
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
791
+ b(P, {
792
+ label: "步长",
793
+ "model-value": e.step,
794
+ min: 0,
795
+ step: 0.1,
796
+ "onUpdate:modelValue": (r) => n("step", r)
797
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
798
+ ]),
799
+ _: 1
800
+ }, 16));
801
+ }
802
+ }), ye = {
803
+ type: "inq-number",
804
+ category: "inputControl",
805
+ label: "数字",
806
+ icon: "🔢",
807
+ isContainer: !1,
808
+ initialSchema: () => ({
809
+ id: R("inq_number"),
810
+ type: "inq-number",
811
+ field: "amount_" + Math.random().toString(36).slice(2, 6),
812
+ props: {
813
+ label: "数字输入",
814
+ message: "请输入数字",
815
+ promptType: "number",
816
+ defaultValue: 0,
817
+ min: 0,
818
+ max: 100,
819
+ step: 1,
820
+ prefix: "",
821
+ suffix: "",
822
+ required: !1,
823
+ whenExpression: "",
824
+ validateExpression: "",
825
+ filterExpression: "",
826
+ transformerExpression: ""
827
+ }
828
+ }),
829
+ designer: Ul,
830
+ runtime: Rl,
831
+ config: zl,
832
+ locales: {
833
+ "zh-CN": { control: { "inq-number": { label: "数字" } } },
834
+ "en-US": { control: { "inq-number": { label: "Number" } } }
835
+ }
836
+ }, Fl = /* @__PURE__ */ h({
837
+ __name: "designer",
838
+ props: {
839
+ label: {},
840
+ message: {},
841
+ description: {},
842
+ isActive: { type: Boolean }
843
+ },
844
+ emits: ["select"],
845
+ setup(e, { emit: t }) {
846
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r } = B(l);
847
+ return (g, m) => (u(), x(A, {
848
+ label: o(a),
849
+ message: o(i),
850
+ description: o(n),
851
+ "type-label": "Inquirer Confirm",
852
+ "is-active": o(r),
853
+ onSelect: m[0] || (m[0] = (p) => s("select"))
854
+ }, null, 8, ["label", "message", "description", "is-active"]));
855
+ }
856
+ }), Ll = { class: "confirm-runtime" }, Ml = {
857
+ key: 0,
858
+ class: "affix"
859
+ }, Ol = { class: "state" }, Jl = {
860
+ key: 1,
861
+ class: "affix"
862
+ }, Pl = /* @__PURE__ */ h({
863
+ __name: "runtime",
864
+ props: {
865
+ modelValue: { type: Boolean },
866
+ disabled: { type: Boolean },
867
+ prefix: {},
868
+ suffix: {}
869
+ },
870
+ emits: ["update:modelValue"],
871
+ setup(e, { emit: t }) {
872
+ const l = t;
873
+ function s(a) {
874
+ l("update:modelValue", !!a);
875
+ }
876
+ return (a, i) => (u(), d("div", Ll, [
877
+ e.prefix ? (u(), d("span", Ml, f(e.prefix), 1)) : y("", !0),
878
+ b(o(Le), {
879
+ "model-value": e.modelValue ?? !1,
880
+ disabled: e.disabled,
881
+ "onUpdate:modelValue": s
882
+ }, null, 8, ["model-value", "disabled"]),
883
+ c("span", Ol, f(e.modelValue ?? !1 ? "Yes" : "No"), 1),
884
+ e.suffix ? (u(), d("span", Jl, f(e.suffix), 1)) : y("", !0)
885
+ ]));
886
+ }
887
+ }), Ql = /* @__PURE__ */ _(Pl, [["__scopeId", "data-v-f41e6b08"]]), jl = /* @__PURE__ */ h({
888
+ __name: "config",
889
+ props: {
890
+ label: {},
891
+ field: {},
892
+ message: {},
893
+ defaultValue: { type: Boolean },
894
+ prefix: {},
895
+ suffix: {},
896
+ required: { type: Boolean },
897
+ whenExpression: {},
898
+ validateExpression: {},
899
+ filterExpression: {},
900
+ transformerExpression: {}
901
+ },
902
+ emits: ["update"],
903
+ setup(e, { emit: t }) {
904
+ const l = e, s = t;
905
+ return (a, i) => (u(), x(M, D(l, {
906
+ "show-placeholder": !1,
907
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
908
+ }), {
909
+ defaultValue: w(({ updateProp: n }) => [
910
+ b(o(le), {
911
+ label: "默认值 (Yes/No)",
912
+ "model-value": e.defaultValue ?? !1,
913
+ "onUpdate:modelValue": (r) => n("defaultValue", r)
914
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
915
+ ]),
916
+ _: 1
917
+ }, 16));
918
+ }
919
+ }), Ve = {
920
+ type: "inq-confirm",
921
+ category: "inputControl",
922
+ label: "确认",
923
+ icon: "❓",
924
+ isContainer: !1,
925
+ initialSchema: () => ({
926
+ id: R("inq_confirm"),
927
+ type: "inq-confirm",
928
+ field: "confirm_" + Math.random().toString(36).slice(2, 6),
929
+ props: {
930
+ label: "是否继续",
931
+ message: "请确认是否执行",
932
+ promptType: "confirm",
933
+ defaultValue: !1,
934
+ prefix: "",
935
+ suffix: "",
936
+ required: !1,
937
+ whenExpression: "",
938
+ validateExpression: "",
939
+ filterExpression: "",
940
+ transformerExpression: ""
941
+ }
942
+ }),
943
+ designer: Fl,
944
+ runtime: Ql,
945
+ config: jl,
946
+ locales: {
947
+ "zh-CN": { control: { "inq-confirm": { label: "确认" } } },
948
+ "en-US": { control: { "inq-confirm": { label: "Confirm" } } }
949
+ }
950
+ }, Gl = /* @__PURE__ */ h({
951
+ __name: "designer",
952
+ props: {
953
+ label: {},
954
+ message: {},
955
+ description: {},
956
+ isActive: { type: Boolean },
957
+ choices: {}
958
+ },
959
+ emits: ["select"],
960
+ setup(e, { emit: t }) {
961
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r, choices: g } = B(l);
962
+ return (m, p) => (u(), x(A, {
963
+ label: o(a),
964
+ message: o(i),
965
+ description: o(n),
966
+ options: o(g),
967
+ "type-label": "Inquirer List",
968
+ "is-active": o(r),
969
+ onSelect: p[0] || (p[0] = (v) => s("select"))
970
+ }, null, 8, ["label", "message", "description", "options", "is-active"]));
971
+ }
972
+ }), Yl = { class: "inquirer-list" }, Hl = {
973
+ key: 0,
974
+ class: "affix"
975
+ }, Kl = {
976
+ key: 1,
977
+ class: "affix"
978
+ }, Wl = {
979
+ key: 2,
980
+ class: "list-hint"
981
+ }, Xl = { key: 0 }, Zl = { key: 1 }, et = /* @__PURE__ */ h({
982
+ __name: "runtime",
983
+ props: {
984
+ modelValue: {},
985
+ placeholder: {},
986
+ disabled: { type: Boolean },
987
+ choices: {},
988
+ prefix: {},
989
+ suffix: {},
990
+ pageSize: {},
991
+ loop: { type: Boolean }
992
+ },
993
+ emits: ["update:modelValue"],
994
+ setup(e, { emit: t }) {
995
+ const l = e, s = t, a = V(
996
+ () => (l.choices ?? []).map((i) => ({
997
+ label: i.label || i.value,
998
+ value: i.value
999
+ }))
1000
+ );
1001
+ return (i, n) => (u(), d("div", Yl, [
1002
+ e.prefix ? (u(), d("span", Hl, f(e.prefix), 1)) : y("", !0),
1003
+ b(o(ve), {
1004
+ class: "select-runtime",
1005
+ "model-value": e.modelValue,
1006
+ placeholder: e.placeholder,
1007
+ disabled: e.disabled,
1008
+ filterable: "",
1009
+ clearable: "",
1010
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => s("update:modelValue", r))
1011
+ }, {
1012
+ default: w(() => [
1013
+ (u(!0), d(S, null, I(a.value, (r) => (u(), x(o(be), {
1014
+ key: r.value,
1015
+ label: r.label,
1016
+ value: r.value
1017
+ }, null, 8, ["label", "value"]))), 128))
1018
+ ]),
1019
+ _: 1
1020
+ }, 8, ["model-value", "placeholder", "disabled"]),
1021
+ e.suffix ? (u(), d("span", Kl, f(e.suffix), 1)) : y("", !0),
1022
+ e.loop || e.pageSize ? (u(), d("p", Wl, [
1023
+ e.pageSize ? (u(), d("span", Xl, "每页 " + f(e.pageSize) + " 项", 1)) : y("", !0),
1024
+ e.loop ? (u(), d("span", Zl, " · 循环导航开启")) : y("", !0)
1025
+ ])) : y("", !0)
1026
+ ]));
1027
+ }
1028
+ }), se = /* @__PURE__ */ _(et, [["__scopeId", "data-v-ad8b9ebc"]]), oe = /* @__PURE__ */ h({
1029
+ __name: "config",
1030
+ props: {
1031
+ label: {},
1032
+ field: {},
1033
+ message: {},
1034
+ placeholder: {},
1035
+ defaultValue: {},
1036
+ prefix: {},
1037
+ suffix: {},
1038
+ required: { type: Boolean },
1039
+ whenExpression: {},
1040
+ validateExpression: {},
1041
+ filterExpression: {},
1042
+ transformerExpression: {},
1043
+ choices: {},
1044
+ defaultChoice: {},
1045
+ pageSize: {},
1046
+ loop: { type: Boolean }
1047
+ },
1048
+ emits: ["update"],
1049
+ setup(e, { emit: t }) {
1050
+ const l = e, s = t;
1051
+ return (a, i) => (u(), x(M, D(l, {
1052
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
1053
+ }), {
1054
+ extra: w(({ updateProp: n }) => [
1055
+ b(o(ce), {
1056
+ label: "选项",
1057
+ "model-value": e.choices,
1058
+ "onUpdate:modelValue": (r) => n("choices", r)
1059
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
1060
+ b(o(N), {
1061
+ label: "默认选项值",
1062
+ "model-value": e.defaultChoice,
1063
+ "onUpdate:modelValue": (r) => n("defaultChoice", r)
1064
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
1065
+ b(P, {
1066
+ label: "pageSize",
1067
+ "model-value": e.pageSize,
1068
+ min: 1,
1069
+ "onUpdate:modelValue": (r) => n("pageSize", r)
1070
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
1071
+ b(o(le), {
1072
+ label: "循环 (loop)",
1073
+ "model-value": e.loop,
1074
+ "onUpdate:modelValue": (r) => n("loop", r)
1075
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
1076
+ ]),
1077
+ _: 1
1078
+ }, 16));
1079
+ }
1080
+ }), we = {
1081
+ type: "inq-list",
1082
+ category: "inputControl",
1083
+ label: "列表",
1084
+ icon: "📋",
1085
+ isContainer: !1,
1086
+ initialSchema: () => ({
1087
+ id: R("inq_list"),
1088
+ type: "inq-list",
1089
+ field: "list_" + Math.random().toString(36).slice(2, 6),
1090
+ props: {
1091
+ label: "单选列表",
1092
+ message: "请选择一个选项",
1093
+ promptType: "list",
1094
+ placeholder: "请选择",
1095
+ defaultChoice: "opt_1",
1096
+ choices: [k("选项 1", "opt_1"), k("选项 2", "opt_2")],
1097
+ pageSize: 7,
1098
+ loop: !0,
1099
+ prefix: "",
1100
+ suffix: "",
1101
+ required: !0,
1102
+ whenExpression: "",
1103
+ validateExpression: "",
1104
+ filterExpression: "",
1105
+ transformerExpression: ""
1106
+ }
1107
+ }),
1108
+ designer: Gl,
1109
+ runtime: se,
1110
+ config: oe,
1111
+ locales: {
1112
+ "zh-CN": { control: { "inq-list": { label: "列表" } } },
1113
+ "en-US": { control: { "inq-list": { label: "List" } } }
1114
+ }
1115
+ }, lt = /* @__PURE__ */ h({
1116
+ __name: "designer",
1117
+ props: {
1118
+ label: {},
1119
+ message: {},
1120
+ description: {},
1121
+ isActive: { type: Boolean },
1122
+ choices: {}
1123
+ },
1124
+ emits: ["select"],
1125
+ setup(e, { emit: t }) {
1126
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r, choices: g } = B(l);
1127
+ return (m, p) => (u(), x(A, {
1128
+ label: o(a),
1129
+ message: o(i),
1130
+ description: o(n),
1131
+ options: o(g),
1132
+ "type-label": "Inquirer Raw List",
1133
+ "is-active": o(r),
1134
+ onSelect: p[0] || (p[0] = (v) => s("select"))
1135
+ }, null, 8, ["label", "message", "description", "options", "is-active"]));
1136
+ }
1137
+ }), tt = {
1138
+ type: "inq-rawlist",
1139
+ category: "inputControl",
1140
+ label: "序号列表",
1141
+ icon: "🔢",
1142
+ isContainer: !1,
1143
+ initialSchema: () => ({
1144
+ id: R("inq_rawlist"),
1145
+ type: "inq-rawlist",
1146
+ field: "rawlist_" + Math.random().toString(36).slice(2, 6),
1147
+ props: {
1148
+ label: "数字选择题",
1149
+ message: "请输入序号选择",
1150
+ promptType: "rawlist",
1151
+ placeholder: "输入编号",
1152
+ defaultChoice: "opt_a",
1153
+ choices: [k("Alpha", "opt_a"), k("Beta", "opt_b"), k("Gamma", "opt_c")],
1154
+ pageSize: 5,
1155
+ loop: !1,
1156
+ prefix: "#",
1157
+ suffix: "",
1158
+ required: !0,
1159
+ whenExpression: "",
1160
+ validateExpression: "",
1161
+ filterExpression: "",
1162
+ transformerExpression: ""
1163
+ }
1164
+ }),
1165
+ designer: lt,
1166
+ runtime: se,
1167
+ config: oe,
1168
+ locales: {
1169
+ "zh-CN": { control: { "inq-rawlist": { label: "序号列表" } } },
1170
+ "en-US": { control: { "inq-rawlist": { label: "Raw List" } } }
1171
+ }
1172
+ }, nt = /* @__PURE__ */ h({
1173
+ __name: "designer",
1174
+ props: {
1175
+ label: {},
1176
+ message: {},
1177
+ description: {},
1178
+ isActive: { type: Boolean },
1179
+ choices: {}
1180
+ },
1181
+ emits: ["select"],
1182
+ setup(e, { emit: t }) {
1183
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r, choices: g } = B(l);
1184
+ return (m, p) => (u(), x(A, {
1185
+ label: o(a),
1186
+ message: o(i),
1187
+ description: o(n),
1188
+ options: o(g),
1189
+ "type-label": "Inquirer Expand",
1190
+ "is-active": o(r),
1191
+ onSelect: p[0] || (p[0] = (v) => s("select"))
1192
+ }, null, 8, ["label", "message", "description", "options", "is-active"]));
1193
+ }
1194
+ }), st = {
1195
+ type: "inq-expand",
1196
+ category: "inputControl",
1197
+ label: "扩展列表",
1198
+ icon: "🧩",
1199
+ isContainer: !1,
1200
+ initialSchema: () => ({
1201
+ id: R("inq_expand"),
1202
+ type: "inq-expand",
1203
+ field: "expand_" + Math.random().toString(36).slice(2, 6),
1204
+ props: {
1205
+ label: "扩展选择",
1206
+ message: "通过按键选择",
1207
+ promptType: "expand",
1208
+ placeholder: "按键选择",
1209
+ defaultChoice: "opt_1",
1210
+ choices: [
1211
+ k("继续", "opt_1"),
1212
+ k("跳过", "opt_2"),
1213
+ k("退出", "opt_3")
1214
+ ],
1215
+ pageSize: 5,
1216
+ loop: !1,
1217
+ prefix: "",
1218
+ suffix: "",
1219
+ required: !1,
1220
+ whenExpression: "",
1221
+ validateExpression: "",
1222
+ filterExpression: "",
1223
+ transformerExpression: ""
1224
+ }
1225
+ }),
1226
+ designer: nt,
1227
+ runtime: se,
1228
+ config: oe,
1229
+ locales: {
1230
+ "zh-CN": { control: { "inq-expand": { label: "扩展列表" } } },
1231
+ "en-US": { control: { "inq-expand": { label: "Expand" } } }
1232
+ }
1233
+ }, ot = /* @__PURE__ */ h({
1234
+ __name: "designer",
1235
+ props: {
1236
+ label: {},
1237
+ message: {},
1238
+ description: {},
1239
+ isActive: { type: Boolean },
1240
+ choices: {}
1241
+ },
1242
+ emits: ["select"],
1243
+ setup(e, { emit: t }) {
1244
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r, choices: g } = B(l);
1245
+ return (m, p) => (u(), x(A, {
1246
+ label: o(a),
1247
+ message: o(i),
1248
+ description: o(n),
1249
+ options: o(g),
1250
+ "type-label": "Inquirer Checkbox",
1251
+ "is-active": o(r),
1252
+ onSelect: p[0] || (p[0] = (v) => s("select"))
1253
+ }, null, 8, ["label", "message", "description", "options", "is-active"]));
1254
+ }
1255
+ }), at = { class: "checkbox-wrapper" }, it = {
1256
+ key: 0,
1257
+ class: "affix"
1258
+ }, rt = {
1259
+ key: 1,
1260
+ class: "affix"
1261
+ }, ut = /* @__PURE__ */ h({
1262
+ __name: "runtime",
1263
+ props: {
1264
+ modelValue: {},
1265
+ disabled: { type: Boolean },
1266
+ choices: {},
1267
+ prefix: {},
1268
+ suffix: {}
1269
+ },
1270
+ emits: ["update:modelValue"],
1271
+ setup(e, { emit: t }) {
1272
+ const l = e, s = t, a = V(
1273
+ () => (l.choices ?? []).map((i) => ({
1274
+ label: i.label || i.value,
1275
+ value: i.value
1276
+ }))
1277
+ );
1278
+ return (i, n) => (u(), d("div", at, [
1279
+ e.prefix ? (u(), d("span", it, f(e.prefix), 1)) : y("", !0),
1280
+ b(o(Me), {
1281
+ class: "checkbox-runtime",
1282
+ "model-value": e.modelValue || [],
1283
+ disabled: e.disabled,
1284
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => s("update:modelValue", r))
1285
+ }, {
1286
+ default: w(() => [
1287
+ (u(!0), d(S, null, I(a.value, (r) => (u(), x(o(Oe), {
1288
+ key: r.value,
1289
+ label: r.value
1290
+ }, {
1291
+ default: w(() => [
1292
+ Y(f(r.label), 1)
1293
+ ]),
1294
+ _: 2
1295
+ }, 1032, ["label"]))), 128))
1296
+ ]),
1297
+ _: 1
1298
+ }, 8, ["model-value", "disabled"]),
1299
+ e.suffix ? (u(), d("span", rt, f(e.suffix), 1)) : y("", !0)
1300
+ ]));
1301
+ }
1302
+ }), dt = /* @__PURE__ */ _(ut, [["__scopeId", "data-v-86b287ae"]]), ct = { class: "multi-default" }, pt = /* @__PURE__ */ h({
1303
+ __name: "config",
1304
+ props: {
1305
+ label: {},
1306
+ field: {},
1307
+ message: {},
1308
+ placeholder: {},
1309
+ defaultValue: {},
1310
+ prefix: {},
1311
+ suffix: {},
1312
+ required: { type: Boolean },
1313
+ whenExpression: {},
1314
+ validateExpression: {},
1315
+ filterExpression: {},
1316
+ transformerExpression: {},
1317
+ choices: {},
1318
+ defaultChoices: {}
1319
+ },
1320
+ emits: ["update"],
1321
+ setup(e, { emit: t }) {
1322
+ const l = e, s = t;
1323
+ return (a, i) => (u(), x(M, D(l, {
1324
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
1325
+ }), {
1326
+ defaultValue: w(({ updateProp: n }) => [
1327
+ c("div", ct, [
1328
+ i[1] || (i[1] = c("label", null, "默认选中值", -1)),
1329
+ b(o(ve), {
1330
+ multiple: "",
1331
+ "collapse-tags": "",
1332
+ "collapse-tags-tooltip": "",
1333
+ "model-value": e.defaultChoices || [],
1334
+ "onUpdate:modelValue": (r) => n("defaultChoices", r)
1335
+ }, {
1336
+ default: w(() => [
1337
+ (u(!0), d(S, null, I(e.choices || [], (r) => (u(), x(o(be), {
1338
+ key: r.value,
1339
+ label: r.label,
1340
+ value: r.value
1341
+ }, null, 8, ["label", "value"]))), 128))
1342
+ ]),
1343
+ _: 1
1344
+ }, 8, ["model-value", "onUpdate:modelValue"])
1345
+ ])
1346
+ ]),
1347
+ extra: w(({ updateProp: n }) => [
1348
+ b(o(ce), {
1349
+ label: "选项",
1350
+ "model-value": e.choices,
1351
+ "onUpdate:modelValue": (r) => n("choices", r)
1352
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
1353
+ ]),
1354
+ _: 1
1355
+ }, 16));
1356
+ }
1357
+ }), mt = /* @__PURE__ */ _(pt, [["__scopeId", "data-v-c571b549"]]), _e = {
1358
+ type: "inq-checkbox",
1359
+ category: "inputControl",
1360
+ label: "多选",
1361
+ icon: "☑️",
1362
+ isContainer: !1,
1363
+ initialSchema: () => ({
1364
+ id: R("inq_checkbox"),
1365
+ type: "inq-checkbox",
1366
+ field: "checkbox_" + Math.random().toString(36).slice(2, 6),
1367
+ props: {
1368
+ label: "多选题",
1369
+ message: "选择一个或多个选项",
1370
+ promptType: "checkbox",
1371
+ choices: [
1372
+ k("JavaScript", "js"),
1373
+ k("TypeScript", "ts"),
1374
+ k("Rust", "rust")
1375
+ ],
1376
+ defaultChoices: ["js"],
1377
+ prefix: "",
1378
+ suffix: "",
1379
+ required: !1,
1380
+ whenExpression: "",
1381
+ validateExpression: "",
1382
+ filterExpression: "",
1383
+ transformerExpression: ""
1384
+ }
1385
+ }),
1386
+ designer: ot,
1387
+ runtime: dt,
1388
+ config: mt,
1389
+ locales: {
1390
+ "zh-CN": { control: { "inq-checkbox": { label: "多选" } } },
1391
+ "en-US": { control: { "inq-checkbox": { label: "Checkbox" } } }
1392
+ }
1393
+ }, ft = /* @__PURE__ */ h({
1394
+ __name: "designer",
1395
+ props: {
1396
+ label: {},
1397
+ message: {},
1398
+ description: {},
1399
+ isActive: { type: Boolean }
1400
+ },
1401
+ emits: ["select"],
1402
+ setup(e, { emit: t }) {
1403
+ const l = e, s = t, { label: a, message: i, description: n, isActive: r } = B(l);
1404
+ return (g, m) => (u(), x(A, {
1405
+ label: o(a),
1406
+ message: o(i),
1407
+ description: o(n),
1408
+ "type-label": "Inquirer Editor",
1409
+ "is-active": o(r),
1410
+ onSelect: m[0] || (m[0] = (p) => s("select"))
1411
+ }, null, 8, ["label", "message", "description", "is-active"]));
1412
+ }
1413
+ }), vt = { class: "editor-runtime" }, bt = {
1414
+ key: 0,
1415
+ class: "affix"
1416
+ }, xt = {
1417
+ key: 1,
1418
+ class: "affix"
1419
+ }, ht = {
1420
+ key: 2,
1421
+ class: "transformer-preview"
1422
+ }, gt = /* @__PURE__ */ h({
1423
+ __name: "runtime",
1424
+ props: {
1425
+ modelValue: {},
1426
+ placeholder: {},
1427
+ rows: {},
1428
+ disabled: { type: Boolean },
1429
+ prefix: {},
1430
+ suffix: {},
1431
+ displayValue: {}
1432
+ },
1433
+ emits: ["update:modelValue"],
1434
+ setup(e, { emit: t }) {
1435
+ const l = e, s = t, a = V(() => l.displayValue === void 0 ? !1 : l.displayValue !== l.modelValue);
1436
+ return (i, n) => (u(), d("div", vt, [
1437
+ e.prefix ? (u(), d("span", bt, f(e.prefix), 1)) : y("", !0),
1438
+ b(o(H), {
1439
+ type: "textarea",
1440
+ rows: e.rows || 6,
1441
+ "model-value": e.modelValue ?? "",
1442
+ placeholder: e.placeholder,
1443
+ disabled: e.disabled,
1444
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => s("update:modelValue", r ?? ""))
1445
+ }, null, 8, ["rows", "model-value", "placeholder", "disabled"]),
1446
+ e.suffix ? (u(), d("span", xt, f(e.suffix), 1)) : y("", !0),
1447
+ a.value ? (u(), d("p", ht, f(e.displayValue), 1)) : y("", !0)
1448
+ ]));
1449
+ }
1450
+ }), yt = /* @__PURE__ */ _(gt, [["__scopeId", "data-v-bd13db5a"]]), Vt = /* @__PURE__ */ h({
1451
+ __name: "config",
1452
+ props: {
1453
+ label: {},
1454
+ field: {},
1455
+ message: {},
1456
+ placeholder: {},
1457
+ defaultValue: {},
1458
+ prefix: {},
1459
+ suffix: {},
1460
+ required: { type: Boolean },
1461
+ whenExpression: {},
1462
+ validateExpression: {},
1463
+ filterExpression: {},
1464
+ transformerExpression: {},
1465
+ rows: {}
1466
+ },
1467
+ emits: ["update"],
1468
+ setup(e, { emit: t }) {
1469
+ const l = e, s = t;
1470
+ return (a, i) => (u(), x(M, D(l, {
1471
+ onUpdate: i[0] || (i[0] = (n) => s("update", n))
1472
+ }), {
1473
+ extra: w(({ updateProp: n }) => [
1474
+ b(P, {
1475
+ label: "行数",
1476
+ "model-value": e.rows,
1477
+ min: 2,
1478
+ max: 20,
1479
+ "onUpdate:modelValue": (r) => n("rows", r)
1480
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
1481
+ ]),
1482
+ _: 1
1483
+ }, 16));
1484
+ }
1485
+ }), qe = {
1486
+ type: "inq-editor",
1487
+ category: "inputControl",
1488
+ label: "长文本",
1489
+ icon: "📝",
1490
+ isContainer: !1,
1491
+ initialSchema: () => ({
1492
+ id: R("inq_editor"),
1493
+ type: "inq-editor",
1494
+ field: "editor_" + Math.random().toString(36).slice(2, 6),
1495
+ props: {
1496
+ label: "长文本",
1497
+ message: "请输入长文本",
1498
+ promptType: "editor",
1499
+ placeholder: "多行输入",
1500
+ rows: 6,
1501
+ defaultValue: "",
1502
+ prefix: "",
1503
+ suffix: "",
1504
+ required: !1,
1505
+ whenExpression: "",
1506
+ validateExpression: "",
1507
+ filterExpression: "",
1508
+ transformerExpression: ""
1509
+ }
1510
+ }),
1511
+ designer: ft,
1512
+ runtime: yt,
1513
+ config: Vt,
1514
+ locales: {
1515
+ "zh-CN": { control: { "inq-editor": { label: "长文本" } } },
1516
+ "en-US": { control: { "inq-editor": { label: "Editor" } } }
1517
+ }
1518
+ }, Ee = [
1519
+ he,
1520
+ ge,
1521
+ ye,
1522
+ Ve,
1523
+ we,
1524
+ tt,
1525
+ st,
1526
+ _e,
1527
+ qe
1528
+ ];
1529
+ function Se() {
1530
+ Q.replaceAll(Ee);
1531
+ }
1532
+ function z(e, t) {
1533
+ const l = e.initialSchema();
1534
+ return {
1535
+ ...l,
1536
+ ...t,
1537
+ props: {
1538
+ ...l.props,
1539
+ ...t.props
1540
+ }
1541
+ };
1542
+ }
1543
+ function ke() {
1544
+ return [
1545
+ z(he, {
1546
+ field: "fullName",
1547
+ props: {
1548
+ label: "姓名",
1549
+ message: "请输入您的姓名",
1550
+ placeholder: "张三",
1551
+ description: "该信息将用于生成问候语"
1552
+ }
1553
+ }),
1554
+ z(ge, {
1555
+ field: "accountPassword",
1556
+ props: {
1557
+ label: "账户密码",
1558
+ message: "请输入账户密码",
1559
+ description: "密码不会被保存在示例应用中"
1560
+ }
1561
+ }),
1562
+ z(ye, {
1563
+ field: "age",
1564
+ props: {
1565
+ label: "年龄",
1566
+ message: "请输入年龄",
1567
+ min: 0,
1568
+ max: 120,
1569
+ required: !0,
1570
+ description: "用于计算问卷分层,必填"
1571
+ }
1572
+ }),
1573
+ z(Ve, {
1574
+ field: "allowContact",
1575
+ props: {
1576
+ label: "是否允许联系",
1577
+ message: "我们可以通过邮件联系您吗?",
1578
+ defaultValue: !0,
1579
+ description: "若选择是,将会收到提效工具邮件"
1580
+ }
1581
+ }),
1582
+ z(we, {
1583
+ field: "favoriteStack",
1584
+ props: {
1585
+ label: "技术栈",
1586
+ message: "请选择主要技术栈",
1587
+ defaultChoice: "ts",
1588
+ description: "用于统计语言偏好"
1589
+ }
1590
+ }),
1591
+ z(_e, {
1592
+ field: "tools",
1593
+ props: {
1594
+ label: "常用工具",
1595
+ message: "请选择常用工具",
1596
+ defaultChoices: ["git", "eslint"],
1597
+ choices: [
1598
+ { label: "Git", value: "git" },
1599
+ { label: "ESLint", value: "eslint" },
1600
+ { label: "Vite", value: "vite" },
1601
+ { label: "Vitest", value: "vitest" }
1602
+ ],
1603
+ description: "可多选"
1604
+ }
1605
+ }),
1606
+ z(qe, {
1607
+ field: "bio",
1608
+ props: {
1609
+ label: "自我介绍",
1610
+ message: "请输入自我介绍",
1611
+ rows: 5,
1612
+ description: "可用于在 inquirer 中展示更丰富的信息"
1613
+ }
1614
+ })
1615
+ ];
1616
+ }
1617
+ const wt = /* @__PURE__ */ h({
1618
+ name: "InquirerFormDesigner",
1619
+ __name: "InquirerFormDesigner",
1620
+ props: {
1621
+ engine: {},
1622
+ seedSample: { type: Boolean, default: !1 },
1623
+ autoRegisterControls: { type: Boolean, default: !0 }
1624
+ },
1625
+ setup(e) {
1626
+ const t = e, l = new pe(), s = V(() => t.engine ?? l);
1627
+ let a = null;
1628
+ const i = t.autoRegisterControls;
1629
+ return i && (a = [...Q.getAll()], Se()), t.seedSample && s.value.getSchema().controls.length === 0 && (s.value.getSchema().controls = ke()), ue(() => {
1630
+ i && a && Q.replaceAll(a);
1631
+ }), (n, r) => (u(), x(o(me), { engine: s.value }, null, 8, ["engine"]));
1632
+ }
1633
+ }), _t = {
1634
+ "inq-input": "input",
1635
+ "inq-password": "password",
1636
+ "inq-number": "number",
1637
+ "inq-confirm": "confirm",
1638
+ "inq-list": "list",
1639
+ "inq-rawlist": "rawlist",
1640
+ "inq-expand": "expand",
1641
+ "inq-checkbox": "checkbox",
1642
+ "inq-editor": "editor"
1643
+ }, qt = ["list", "rawlist", "expand", "checkbox"];
1644
+ function Ce(e) {
1645
+ const t = e.props?.promptType;
1646
+ return t || (_t[e.type] ?? null);
1647
+ }
1648
+ function Et(e) {
1649
+ return qt.includes(e);
1650
+ }
1651
+ function $e(e) {
1652
+ const t = Ce(e);
1653
+ if (!t) return;
1654
+ const l = e.props || {};
1655
+ if (t === "confirm")
1656
+ return typeof l.defaultValue == "boolean" ? l.defaultValue : !1;
1657
+ if (t === "checkbox")
1658
+ return Array.isArray(l.defaultChoices) ? l.defaultChoices : Array.isArray(l.defaultValue) ? l.defaultValue : [];
1659
+ if (t === "number") {
1660
+ const s = Number(l.defaultValue);
1661
+ return Number.isNaN(s) ? void 0 : s;
1662
+ }
1663
+ if ((t === "list" || t === "rawlist" || t === "expand") && typeof l.defaultChoice == "string")
1664
+ return l.defaultChoice;
1665
+ if (l.defaultValue !== void 0 && l.defaultValue !== null)
1666
+ return l.defaultValue;
1667
+ if (t === "input" || t === "password" || t === "editor")
1668
+ return "";
1669
+ }
1670
+ function te(e, t) {
1671
+ if (!(!e || typeof e != "string"))
1672
+ try {
1673
+ return new Function("input", "answers", e)(t.input, t.answers);
1674
+ } catch (l) {
1675
+ console.warn("[inquirer-demo] 表达式执行失败:", l);
1676
+ return;
1677
+ }
1678
+ }
1679
+ function St(e, t) {
1680
+ const l = e.props?.whenExpression;
1681
+ if (!l) return !0;
1682
+ const s = te(l, { input: t[e.field || ""], answers: t });
1683
+ return typeof s == "boolean" ? s : !0;
1684
+ }
1685
+ function kt(e, t, l) {
1686
+ const s = e.props?.filterExpression;
1687
+ if (!s) return t;
1688
+ const a = te(s, { input: t, answers: l });
1689
+ return a === void 0 ? t : a;
1690
+ }
1691
+ function Ct(e, t, l) {
1692
+ const s = e.props?.transformerExpression;
1693
+ if (!s) return t;
1694
+ const a = te(s, { input: t, answers: l });
1695
+ return a === void 0 ? t : a;
1696
+ }
1697
+ function ie(e, t, l) {
1698
+ const s = e.props?.validateExpression;
1699
+ if (!s && !e.props?.required)
1700
+ return null;
1701
+ if (s) {
1702
+ const a = te(s, { input: t, answers: l });
1703
+ if (a === !0 || a === void 0)
1704
+ return null;
1705
+ if (typeof a == "string")
1706
+ return a;
1707
+ } else if (e.props?.required) {
1708
+ if (t == null || t === "")
1709
+ return "该问题为必填项";
1710
+ if (Array.isArray(t) && t.length === 0)
1711
+ return "至少选择一项";
1712
+ }
1713
+ return null;
1714
+ }
1715
+ function $t(e, t) {
1716
+ if (!t.field || e[t.field] !== void 0) return;
1717
+ const l = $e(t);
1718
+ l !== void 0 && (e[t.field] = l);
1719
+ }
1720
+ function Ut(e) {
1721
+ if (typeof e.props?.description == "string" && e.props.description.trim().length > 0)
1722
+ return e.props.description.trim();
1723
+ if (typeof e.props?.message == "string" && e.props.message.trim().length > 0)
1724
+ return e.props.message.trim();
1725
+ }
1726
+ const It = {
1727
+ key: 0,
1728
+ class: "inquirer-container"
1729
+ }, Nt = {
1730
+ key: 0,
1731
+ class: "node-description"
1732
+ }, Bt = {
1733
+ key: 1,
1734
+ class: "node-error"
1735
+ }, At = /* @__PURE__ */ h({
1736
+ name: "InquirerRuntimeNode",
1737
+ __name: "InquirerRuntimeNode",
1738
+ props: {
1739
+ node: {},
1740
+ formData: {}
1741
+ },
1742
+ emits: ["update"],
1743
+ setup(e, { emit: t }) {
1744
+ const l = e, s = t, a = V(() => Q.get(l.node.type)), i = V(() => a.value?.runtime || null), n = V(() => l.formData || {}), r = V(() => {
1745
+ if (l.node.field)
1746
+ return n.value[l.node.field];
1747
+ }), g = V(() => Ut(l.node)), m = L(null), p = V(() => St(l.node, n.value));
1748
+ ee(
1749
+ p,
1750
+ ($) => {
1751
+ !$ && l.node.field && n.value[l.node.field] !== void 0 && (s("update", l.node.field, void 0), m.value = null);
1752
+ },
1753
+ { immediate: !0 }
1754
+ ), ee(
1755
+ () => r.value,
1756
+ ($) => {
1757
+ m.value = ie(l.node, $, n.value);
1758
+ },
1759
+ { immediate: !0 }
1760
+ );
1761
+ function v($) {
1762
+ if (!l.node.field) return;
1763
+ const T = kt(l.node, $, n.value);
1764
+ s("update", l.node.field, T), m.value = ie(l.node, T, n.value);
1765
+ }
1766
+ const O = V(() => typeof l.node.props?.message == "string" && l.node.props.message.trim() ? l.node.props.message : typeof l.node.props?.label == "string" && l.node.props.label.trim() ? l.node.props.label : l.node.field || "未命名控件"), j = V(() => Ct(l.node, r.value, n.value)), J = V(() => a.value?.isContainer ?? !1);
1767
+ function C($, T) {
1768
+ s("update", $, T);
1769
+ }
1770
+ return ($, T) => {
1771
+ const K = Ne("InquirerRuntimeNode", !0);
1772
+ return p.value ? (u(), d(S, { key: 0 }, [
1773
+ J.value ? (u(), d("div", It, [
1774
+ (u(), x(ae(i.value), Be(Ae(e.node.props)), {
1775
+ default: w(() => [
1776
+ e.node.children && e.node.children.length ? (u(!0), d(S, { key: 0 }, I(e.node.children, (U) => (u(), x(K, {
1777
+ key: U.id,
1778
+ node: U,
1779
+ formData: e.formData,
1780
+ onUpdate: C
1781
+ }, null, 8, ["node", "formData"]))), 128)) : y("", !0)
1782
+ ]),
1783
+ _: 1
1784
+ }, 16))
1785
+ ])) : (u(), x(o(de), {
1786
+ key: 1,
1787
+ label: O.value
1788
+ }, {
1789
+ default: w(() => [
1790
+ (u(), x(ae(i.value), D(e.node.props, {
1791
+ modelValue: r.value,
1792
+ displayValue: j.value,
1793
+ "onUpdate:modelValue": v
1794
+ }), {
1795
+ default: w(() => [
1796
+ e.node.children && e.node.children.length ? (u(!0), d(S, { key: 0 }, I(e.node.children, (U) => (u(), x(K, {
1797
+ key: U.id,
1798
+ node: U,
1799
+ formData: e.formData,
1800
+ onUpdate: C
1801
+ }, null, 8, ["node", "formData"]))), 128)) : y("", !0)
1802
+ ]),
1803
+ _: 1
1804
+ }, 16, ["modelValue", "displayValue"])),
1805
+ g.value ? (u(), d("p", Nt, f(g.value), 1)) : y("", !0),
1806
+ m.value ? (u(), d("p", Bt, f(m.value), 1)) : y("", !0)
1807
+ ]),
1808
+ _: 1
1809
+ }, 8, ["label"]))
1810
+ ], 64)) : y("", !0);
1811
+ };
1812
+ }
1813
+ }), Rt = /* @__PURE__ */ _(At, [["__scopeId", "data-v-762f3565"]]), Tt = { class: "inquirer-web-runtime" }, Dt = {
1814
+ key: 0,
1815
+ class: "runtime-empty"
1816
+ }, zt = /* @__PURE__ */ h({
1817
+ name: "InquirerFormRuntime",
1818
+ __name: "InquirerFormRuntime",
1819
+ props: {
1820
+ schema: {},
1821
+ modelValue: {}
1822
+ },
1823
+ emits: ["update:modelValue"],
1824
+ setup(e, { emit: t }) {
1825
+ const l = e, s = t, a = L({ ...l.modelValue || {} });
1826
+ ee(
1827
+ () => l.modelValue,
1828
+ (g) => {
1829
+ a.value = { ...g || {} };
1830
+ },
1831
+ { deep: !0 }
1832
+ ), ee(
1833
+ () => l.schema.controls,
1834
+ () => {
1835
+ i();
1836
+ },
1837
+ { deep: !0, immediate: !0 }
1838
+ );
1839
+ function i() {
1840
+ n(l.schema.controls), s("update:modelValue", { ...a.value });
1841
+ }
1842
+ function n(g) {
1843
+ g && g.forEach((m) => {
1844
+ $t(a.value, m), m.children?.length && n(m.children);
1845
+ });
1846
+ }
1847
+ function r(g, m) {
1848
+ m === void 0 ? delete a.value[g] : a.value[g] = m, s("update:modelValue", { ...a.value });
1849
+ }
1850
+ return (g, m) => (u(), d("div", Tt, [
1851
+ b(o(Je), {
1852
+ class: "form-content",
1853
+ "label-position": "top",
1854
+ model: a.value
1855
+ }, {
1856
+ default: w(() => [
1857
+ !e.schema.controls || e.schema.controls.length === 0 ? (u(), d("div", Dt, " 暂无表单内容 ")) : (u(!0), d(S, { key: 1 }, I(e.schema.controls, (p) => (u(), x(Rt, {
1858
+ key: p.id,
1859
+ node: p,
1860
+ formData: a.value,
1861
+ onUpdate: r
1862
+ }, null, 8, ["node", "formData"]))), 128))
1863
+ ]),
1864
+ _: 1
1865
+ }, 8, ["model"])
1866
+ ]));
1867
+ }
1868
+ }), Ue = /* @__PURE__ */ _(zt, [["__scopeId", "data-v-2ef727bc"]]);
1869
+ function Ft(e, t = {}) {
1870
+ const l = [];
1871
+ function s(a) {
1872
+ a && a.forEach((i) => {
1873
+ const n = Lt(i, t);
1874
+ n && l.push(n), i.children?.length && s(i.children);
1875
+ });
1876
+ }
1877
+ return s(e.controls), l;
1878
+ }
1879
+ function Lt(e, t) {
1880
+ const l = Ce(e);
1881
+ if (!l || e.props?.disabled && !t.includeDisabled)
1882
+ return null;
1883
+ const s = e.field?.trim() || e.props?.alias || e.id, a = e.props?.message?.trim() || e.props?.label || s, i = $e(e), n = {
1884
+ type: l,
1885
+ name: s,
1886
+ message: a,
1887
+ default: i,
1888
+ prefix: F(e.props?.prefix),
1889
+ suffix: F(e.props?.suffix),
1890
+ pageSize: G(e.props?.pageSize),
1891
+ loop: typeof e.props?.loop == "boolean" ? e.props.loop : void 0,
1892
+ whenExpression: F(e.props?.whenExpression),
1893
+ validateExpression: Ot(e),
1894
+ filterExpression: F(e.props?.filterExpression),
1895
+ transformerExpression: F(e.props?.transformerExpression),
1896
+ mask: Mt(e.props),
1897
+ choices: Jt(l, e.props),
1898
+ metadata: {
1899
+ schemaNodeId: e.id,
1900
+ label: e.props?.label,
1901
+ placeholder: e.props?.placeholder,
1902
+ required: !!e.props?.required,
1903
+ inquirerType: l,
1904
+ group: e.props?.groupLabel,
1905
+ description: e.props?.description
1906
+ }
1907
+ };
1908
+ return l === "checkbox" && (n.metadata = {
1909
+ ...n.metadata,
1910
+ defaultChoices: Array.isArray(e.props?.defaultChoices) ? e.props.defaultChoices : void 0
1911
+ }), l === "number" && (n.metadata = {
1912
+ ...n.metadata,
1913
+ min: G(e.props?.min),
1914
+ max: G(e.props?.max),
1915
+ step: G(e.props?.step)
1916
+ }), l === "editor" && (n.metadata = {
1917
+ ...n.metadata,
1918
+ rows: G(e.props?.rows)
1919
+ }), n;
1920
+ }
1921
+ function Mt(e = {}) {
1922
+ if (e.maskEnabled)
1923
+ return typeof e.maskSymbol == "string" && e.maskSymbol.trim().length > 0 ? e.maskSymbol : !0;
1924
+ }
1925
+ function Ot(e) {
1926
+ const t = F(e.props?.validateExpression);
1927
+ if (t) return t;
1928
+ if (e.props?.required)
1929
+ return "return input ? true : '该问题为必填项'";
1930
+ }
1931
+ function Jt(e, t = {}) {
1932
+ if (!Et(e))
1933
+ return;
1934
+ const l = t.choices;
1935
+ return !Array.isArray(l) || l.length === 0 ? [] : l.filter((s) => typeof s?.label == "string" && typeof s?.value == "string").map((s) => ({
1936
+ name: s.label,
1937
+ value: s.value,
1938
+ short: F(s.short)
1939
+ }));
1940
+ }
1941
+ function F(e) {
1942
+ if (typeof e != "string") return;
1943
+ const t = e.trim();
1944
+ return t.length ? t : void 0;
1945
+ }
1946
+ function G(e) {
1947
+ if (e == null) return;
1948
+ const t = Number(e);
1949
+ return Number.isNaN(t) ? void 0 : t;
1950
+ }
1951
+ const Pt = { class: "inquirer-demo" }, Qt = { class: "demo-workspace" }, jt = { class: "workspace-tabs" }, Gt = ["onClick"], Yt = { class: "workspace-panel designer-panel" }, Ht = { class: "workspace-panel runtime-panel" }, Kt = { class: "runtime-json" }, Wt = { class: "workspace-panel export-panel" }, Xt = { class: "json-viewer" }, Zt = { class: "code-snippet" }, en = { class: "workspace-panel docs-panel" }, ln = { class: "callout-controls" }, tn = { class: "type" }, nn = { class: "meta" }, sn = /* @__PURE__ */ h({
1952
+ __name: "InquirerFormPlayground",
1953
+ setup(e) {
1954
+ const t = new pe();
1955
+ t.updateInfo({
1956
+ title: "Inquirer 表单定义",
1957
+ description: "通过拖拽生成 Inquirer QuestionCollection"
1958
+ });
1959
+ const l = [...Q.getAll()];
1960
+ Se(), Re(() => {
1961
+ t.getSchema().controls.length || j();
1962
+ }), ue(() => {
1963
+ Q.replaceAll(l);
1964
+ });
1965
+ const s = L({}), a = L(0), i = L(0), n = [
1966
+ { key: "designer", label: "可视化设计器", desc: "拖拽字段,构建 Schema" },
1967
+ { key: "runtime", label: "运行态预览", desc: "实时数据与交互" },
1968
+ { key: "export", label: "Inquirer 输出", desc: "生成 QuestionCollection + 调用" },
1969
+ { key: "docs", label: "说明", desc: "当前已注册控件" }
1970
+ ], r = L(n[0]?.key ?? "designer"), g = V(() => Ft(t.getSchema())), m = V(() => JSON.stringify(g.value, null, 2)), p = V(() => JSON.stringify(s.value, null, 2));
1971
+ function v() {
1972
+ a.value++, i.value++;
1973
+ }
1974
+ function O(U) {
1975
+ const q = t.getSchema().controls;
1976
+ q.splice(0, q.length, ...U), t.selectNode(void 0), t.snapshot("update"), v();
1977
+ }
1978
+ function j() {
1979
+ O(ke());
1980
+ }
1981
+ function J() {
1982
+ O([]), s.value = {};
1983
+ }
1984
+ async function C(U, q) {
1985
+ try {
1986
+ await navigator.clipboard.writeText(U), alert(`${q} 已复制到剪贴板`);
1987
+ } catch (E) {
1988
+ console.warn("clipboard failed", E);
1989
+ }
1990
+ }
1991
+ function $() {
1992
+ C(De(t.getSchema()), "Schema JSON");
1993
+ }
1994
+ function T() {
1995
+ C(m.value, "Inquirer JSON");
1996
+ }
1997
+ const K = V(() => `import inquirer from 'inquirer'
1998
+ import { schemaToInquirer } from 'inquirer-form'
1999
+
2000
+ const questions = schemaToInquirer(schema)
2001
+ const answers = await inquirer.prompt(questions)
2002
+ console.log(answers)`);
2003
+ return (U, q) => (u(), d("div", Pt, [
2004
+ c("section", { class: "callout-panel" }, [
2005
+ c("div", { class: "callout-header" }, [
2006
+ q[1] || (q[1] = c("div", null, [
2007
+ c("h1", null, "🧭 Inquirer 表单调用示例")
2008
+ ], -1)),
2009
+ c("div", { class: "callout-actions" }, [
2010
+ c("button", { onClick: j }, "生成示例表单"),
2011
+ c("button", { onClick: J }, "清空表单"),
2012
+ c("button", { onClick: $ }, "复制 Schema JSON"),
2013
+ c("button", { onClick: T }, "复制 Inquirer JSON")
2014
+ ])
2015
+ ])
2016
+ ]),
2017
+ c("main", Qt, [
2018
+ c("div", jt, [
2019
+ (u(), d(S, null, I(n, (E) => c("button", {
2020
+ key: E.key,
2021
+ class: Te(["tab-item", { active: E.key === r.value }]),
2022
+ onClick: (on) => r.value = E.key
2023
+ }, [
2024
+ c("span", null, f(E.label), 1),
2025
+ c("small", null, f(E.desc), 1)
2026
+ ], 10, Gt)), 64))
2027
+ ]),
2028
+ W(c("section", Yt, [
2029
+ (u(), x(o(me), {
2030
+ key: a.value,
2031
+ engine: o(t)
2032
+ }, null, 8, ["engine"]))
2033
+ ], 512), [
2034
+ [X, r.value === "designer"]
2035
+ ]),
2036
+ W(c("section", Ht, [
2037
+ (u(), x(Ue, {
2038
+ key: i.value,
2039
+ schema: o(t).getSchema(),
2040
+ modelValue: s.value,
2041
+ "onUpdate:modelValue": q[0] || (q[0] = (E) => s.value = E)
2042
+ }, null, 8, ["schema", "modelValue"])),
2043
+ c("div", Kt, [
2044
+ q[2] || (q[2] = c("header", null, "FormData(实时)", -1)),
2045
+ c("pre", null, f(p.value), 1)
2046
+ ])
2047
+ ], 512), [
2048
+ [X, r.value === "runtime"]
2049
+ ]),
2050
+ W(c("section", Wt, [
2051
+ c("div", { class: "panel-header" }, [
2052
+ q[3] || (q[3] = c("div", null, null, -1)),
2053
+ c("button", {
2054
+ class: "btn-copy",
2055
+ onClick: T
2056
+ }, "复制 JSON")
2057
+ ]),
2058
+ c("pre", Xt, f(m.value), 1),
2059
+ c("div", Zt, [
2060
+ q[4] || (q[4] = c("header", null, "调用示例", -1)),
2061
+ c("pre", null, [
2062
+ c("code", null, f(K.value), 1)
2063
+ ])
2064
+ ])
2065
+ ], 512), [
2066
+ [X, r.value === "export"]
2067
+ ]),
2068
+ W(c("section", en, [
2069
+ c("div", ln, [
2070
+ c("ul", null, [
2071
+ (u(!0), d(S, null, I(o(Ee), (E) => (u(), d("li", {
2072
+ key: E.type
2073
+ }, [
2074
+ c("span", tn, f(E.label), 1),
2075
+ c("span", nn, f(E.type), 1)
2076
+ ]))), 128))
2077
+ ])
2078
+ ])
2079
+ ], 512), [
2080
+ [X, r.value === "docs"]
2081
+ ])
2082
+ ])
2083
+ ]));
2084
+ }
2085
+ }), cn = /* @__PURE__ */ _(sn, [["__scopeId", "data-v-cdc491b8"]]), pn = {
2086
+ install(e) {
2087
+ e.component("InquirerFormDesigner", wt), e.component("InquirerFormRuntime", Ue);
2088
+ }
2089
+ };
2090
+ export {
2091
+ wt as InquirerFormDesigner,
2092
+ cn as InquirerFormPlayground,
2093
+ Ue as InquirerFormRuntime,
2094
+ ke as createInquirerSampleControls,
2095
+ pn as default,
2096
+ Ee as inquirerControls,
2097
+ Se as registerInquirerControls,
2098
+ Ft as schemaToInquirer
2099
+ };