@skopon-cool/form-sdk 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +191 -191
- package/package.json +1 -1
- package/src/adapter/a2uiAdapter.test.ts +25 -0
- package/src/adapter/a2uiAdapter.ts +1 -1
- package/src/adapter/formSchema.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -3,10 +3,10 @@ var Kn = Object.defineProperty;
|
|
|
3
3
|
var Wn = (e, t, n) => t in e ? Kn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
4
|
var G = (e, t, n) => Wn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
5
|
import { jsx as c, jsxs as x } from "react/jsx-runtime";
|
|
6
|
-
import { useRef as A, useState as E, useCallback as j, useMemo as V, createContext as
|
|
7
|
-
import { Spin as yt, Button as
|
|
6
|
+
import { useRef as A, useState as E, useCallback as j, useMemo as V, createContext as Te, useContext as xe, useEffect as B, useSyncExternalStore as Gn, forwardRef as Jn, useImperativeHandle as Yn } from "react";
|
|
7
|
+
import { Spin as yt, Button as Me, Typography as ee, Avatar as Xn, Tag as be, Tooltip as ge, Modal as Qn, Select as ct, Checkbox as Zn, Radio as er, Switch as tr, TimePicker as nr, DatePicker as rr, Upload as Ze, Input as et, InputNumber as or, ConfigProvider as ir } from "antd";
|
|
8
8
|
import { ReloadOutlined as nn, FileTextOutlined as rn, UserOutlined as sr, FileImageOutlined as ar, FullscreenOutlined as lr, FileExcelOutlined as cr, FileOutlined as on, PictureOutlined as ur, SoundOutlined as mr, VideoCameraOutlined as dr } from "@ant-design/icons";
|
|
9
|
-
import { createBinderlessComponentImplementation as J, basicCatalog as
|
|
9
|
+
import { createBinderlessComponentImplementation as J, basicCatalog as ze, A2uiSurface as sn } from "@a2ui/react/v0_9";
|
|
10
10
|
import { z as f } from "zod";
|
|
11
11
|
import { Catalog as pr, MessageProcessor as an } from "@a2ui/web_core/v0_9";
|
|
12
12
|
import { injectBasicCatalogStyles as ln } from "@a2ui/web_core/v0_9/basic_catalog";
|
|
@@ -19,20 +19,20 @@ const Rs = "v0.9", fr = [
|
|
|
19
19
|
"small",
|
|
20
20
|
"icon"
|
|
21
21
|
];
|
|
22
|
-
function
|
|
22
|
+
function Se(e) {
|
|
23
23
|
return e === "image" || e === "video" || e === "audio";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function ke(e) {
|
|
26
26
|
return e === "web";
|
|
27
27
|
}
|
|
28
28
|
function un(e) {
|
|
29
29
|
return e === "heading" || e === "paragraph";
|
|
30
30
|
}
|
|
31
31
|
function Z(e) {
|
|
32
|
-
return !un(e) && !
|
|
32
|
+
return !un(e) && !Se(e) && !ke(e);
|
|
33
33
|
}
|
|
34
34
|
function mn(e) {
|
|
35
|
-
return un(e) ||
|
|
35
|
+
return un(e) || Se(e) || ke(e);
|
|
36
36
|
}
|
|
37
37
|
function dn(e) {
|
|
38
38
|
return e === "select" || e === "multiselect" || e === "radio" || e === "checkbox";
|
|
@@ -41,7 +41,7 @@ function ws(e) {
|
|
|
41
41
|
return Z(e) && e !== "file" && e !== "resume_multiselect" && e !== "case_multiselect";
|
|
42
42
|
}
|
|
43
43
|
const ut = 360, hr = 200, gr = 1200;
|
|
44
|
-
function
|
|
44
|
+
function Ne(e) {
|
|
45
45
|
if (e == null || e === "")
|
|
46
46
|
return ut;
|
|
47
47
|
const t = typeof e == "number" ? e : Number(e);
|
|
@@ -78,7 +78,7 @@ function vr() {
|
|
|
78
78
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function ce(e) {
|
|
82
82
|
const t = vr().replace(/-/g, "").slice(0, 8);
|
|
83
83
|
return `${e}${t}`;
|
|
84
84
|
}
|
|
@@ -174,7 +174,7 @@ function Mr(e) {
|
|
|
174
174
|
return n ? n.startsWith(".") ? n : `.${n}` : "";
|
|
175
175
|
}).filter(Boolean) : [];
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function Fe(e) {
|
|
178
178
|
if (!Array.isArray(e)) return [];
|
|
179
179
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
180
180
|
for (const r of e) {
|
|
@@ -184,13 +184,13 @@ function Ne(e) {
|
|
|
184
184
|
return t;
|
|
185
185
|
}
|
|
186
186
|
function Nr(e) {
|
|
187
|
-
const t =
|
|
187
|
+
const t = Fe(e), n = [];
|
|
188
188
|
for (const r of t)
|
|
189
189
|
n.push(...br[r] ?? [r]);
|
|
190
190
|
return n;
|
|
191
191
|
}
|
|
192
192
|
function Fr(e) {
|
|
193
|
-
const t =
|
|
193
|
+
const t = Fe(e);
|
|
194
194
|
if (t.length === 0) return [];
|
|
195
195
|
const n = /* @__PURE__ */ new Set();
|
|
196
196
|
for (const r of t)
|
|
@@ -199,7 +199,7 @@ function Fr(e) {
|
|
|
199
199
|
return vt.filter((r) => n.has(r.value));
|
|
200
200
|
}
|
|
201
201
|
function bt(e, t) {
|
|
202
|
-
const n = Mr(t), r =
|
|
202
|
+
const n = Mr(t), r = Fe(e);
|
|
203
203
|
if (r.length === 0)
|
|
204
204
|
return n.filter((i) => Tr.has(i));
|
|
205
205
|
const o = new Set(
|
|
@@ -212,7 +212,7 @@ function Ir(e, t) {
|
|
|
212
212
|
return o.length > 0 ? o.join(",") : void 0;
|
|
213
213
|
}
|
|
214
214
|
function Er(e, t) {
|
|
215
|
-
const n =
|
|
215
|
+
const n = Fe(e), r = bt(
|
|
216
216
|
n,
|
|
217
217
|
t
|
|
218
218
|
), o = [
|
|
@@ -232,7 +232,7 @@ const Ur = [
|
|
|
232
232
|
function wr(e) {
|
|
233
233
|
return e && Rr.has(e) ? e : "file";
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Ie(e) {
|
|
236
236
|
return typeof e == "string" && fr.includes(e) ? e : "medium";
|
|
237
237
|
}
|
|
238
238
|
function Pr(e, t) {
|
|
@@ -246,7 +246,7 @@ function zr(e) {
|
|
|
246
246
|
return Array.isArray(e.mediaUrls) ? e.mediaUrls.map((n) => n.trim()).filter(Boolean) : (t = e.mediaUrl) != null && t.trim() ? [e.mediaUrl.trim()] : [];
|
|
247
247
|
}
|
|
248
248
|
function Or(e) {
|
|
249
|
-
return `form-media-size-${
|
|
249
|
+
return `form-media-size-${Ie(e)}`;
|
|
250
250
|
}
|
|
251
251
|
function Br(e) {
|
|
252
252
|
return `form-media-preview form-media-list ${Or(e)}`;
|
|
@@ -259,7 +259,7 @@ function Wt(e) {
|
|
|
259
259
|
if (!(!t || t.toLowerCase() === "null"))
|
|
260
260
|
return t;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function se(e) {
|
|
263
263
|
if (!Array.isArray(e)) return [];
|
|
264
264
|
const t = [];
|
|
265
265
|
for (const n of e) {
|
|
@@ -269,26 +269,26 @@ function Le(e) {
|
|
|
269
269
|
}
|
|
270
270
|
return t;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return !dn(e.type) ||
|
|
272
|
+
function ue(e) {
|
|
273
|
+
return !dn(e.type) || se(e.options).length > 0;
|
|
274
274
|
}
|
|
275
275
|
const qr = 10;
|
|
276
276
|
function fn(e) {
|
|
277
277
|
return e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Ee(e) {
|
|
280
280
|
return e === !0 || e === "true" || e === 1 || e === "1";
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function Oe(e, t = 1) {
|
|
283
283
|
const n = typeof e == "number" ? e : Number(e);
|
|
284
284
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : t;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function fe(e, t = 1) {
|
|
287
287
|
const n = typeof e == "number" ? e : Number(e);
|
|
288
288
|
return Number.isFinite(n) ? Math.max(1, Math.floor(n)) : t;
|
|
289
289
|
}
|
|
290
290
|
function hn(e, t) {
|
|
291
|
-
return t == null ? void 0 : e === "toggle" ?
|
|
291
|
+
return t == null ? void 0 : e === "toggle" ? Ee(t) : e === "multiselect" || e === "checkbox" || e === "resume_multiselect" || e === "case_multiselect" ? Array.isArray(t) ? t.map(String).map((o) => o.trim()).filter(Boolean) : typeof t == "string" && t.trim() ? [t.trim()] : [] : typeof t == "boolean" ? t ? "true" : "false" : Array.isArray(t) ? t.map(String) : String(t).trim() || void 0;
|
|
292
292
|
}
|
|
293
293
|
function Lr(e) {
|
|
294
294
|
if (Array.isArray(e)) return e.map(String).filter(Boolean);
|
|
@@ -321,56 +321,56 @@ function $r(e) {
|
|
|
321
321
|
}
|
|
322
322
|
function Dr(e) {
|
|
323
323
|
var o, i, s, a, l;
|
|
324
|
-
const t = $r(e), n =
|
|
324
|
+
const t = $r(e), n = Fe(t.fileAcceptTypes), r = t.type;
|
|
325
325
|
return {
|
|
326
|
-
id: ((o = t.id) == null ? void 0 : o.trim()) ||
|
|
326
|
+
id: ((o = t.id) == null ? void 0 : o.trim()) || ce("block-"),
|
|
327
327
|
type: r,
|
|
328
328
|
name: ((i = t.name) == null ? void 0 : i.trim()) || void 0,
|
|
329
329
|
label: t.label ?? "",
|
|
330
330
|
placeholder: t.placeholder ?? "",
|
|
331
331
|
help: t.help ?? "",
|
|
332
332
|
required: t.required === !0,
|
|
333
|
-
mediaUrls:
|
|
334
|
-
mediaSize:
|
|
335
|
-
webUrl:
|
|
336
|
-
webHeight:
|
|
333
|
+
mediaUrls: Se(r) ? Pr(t, qr) : void 0,
|
|
334
|
+
mediaSize: Se(r) ? Ie(t.mediaSize) : void 0,
|
|
335
|
+
webUrl: ke(r) ? ((s = t.webUrl) == null ? void 0 : s.trim()) ?? "" : void 0,
|
|
336
|
+
webHeight: ke(r) ? Ne(t.webHeight) : void 0,
|
|
337
337
|
fileAcceptTypes: n,
|
|
338
338
|
fileAcceptExtensions: bt(
|
|
339
339
|
n,
|
|
340
340
|
t.fileAcceptExtensions
|
|
341
341
|
),
|
|
342
342
|
filePlaceholderIcon: wr(t.filePlaceholderIcon),
|
|
343
|
-
fileMinCount: r === "file" ?
|
|
344
|
-
fileMaxCount: r === "file" ?
|
|
343
|
+
fileMinCount: r === "file" ? Oe(t.fileMinCount, 1) : void 0,
|
|
344
|
+
fileMaxCount: r === "file" ? Oe(t.fileMaxCount, 1) : void 0,
|
|
345
345
|
defaultValue: hn(r, t.defaultValue),
|
|
346
346
|
jsonSchemaDescription: ((a = t.jsonSchemaDescription) == null ? void 0 : a.trim()) ?? "",
|
|
347
347
|
hidden: r === "text" ? t.hidden === !0 : void 0,
|
|
348
348
|
needLLM: t.needLLM === !0 ? !0 : void 0,
|
|
349
|
-
options: Array.isArray(t.options) ?
|
|
349
|
+
options: Array.isArray(t.options) ? se(t.options) : void 0,
|
|
350
350
|
condition: (l = t.condition) != null && l.fieldName ? {
|
|
351
351
|
fieldName: t.condition.fieldName.trim(),
|
|
352
352
|
operator: t.condition.operator ?? "eq",
|
|
353
353
|
value: t.condition.value
|
|
354
354
|
} : void 0,
|
|
355
355
|
resumeEnableRefresh: r === "resume_multiselect" ? t.resumeEnableRefresh !== !1 : void 0,
|
|
356
|
-
resumeMinCount: r === "resume_multiselect" && t.resumeMinCount != null ?
|
|
357
|
-
resumeMaxCount: r === "resume_multiselect" && t.resumeMaxCount != null ?
|
|
356
|
+
resumeMinCount: r === "resume_multiselect" && t.resumeMinCount != null ? fe(t.resumeMinCount, 1) : void 0,
|
|
357
|
+
resumeMaxCount: r === "resume_multiselect" && t.resumeMaxCount != null ? fe(t.resumeMaxCount, 1) : void 0,
|
|
358
358
|
resumeFilter: r === "resume_multiselect" ? jr(t.resumeFilter) : void 0,
|
|
359
359
|
caseEnableRefresh: r === "case_multiselect" ? t.caseEnableRefresh !== !1 : void 0,
|
|
360
|
-
caseMinCount: r === "case_multiselect" && t.caseMinCount != null ?
|
|
361
|
-
caseMaxCount: r === "case_multiselect" && t.caseMaxCount != null ?
|
|
360
|
+
caseMinCount: r === "case_multiselect" && t.caseMinCount != null ? fe(t.caseMinCount, 1) : void 0,
|
|
361
|
+
caseMaxCount: r === "case_multiselect" && t.caseMaxCount != null ? fe(t.caseMaxCount, 1) : void 0,
|
|
362
362
|
caseFilter: r === "case_multiselect" ? Vr(t.caseFilter) : void 0
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
365
|
function Hr(e) {
|
|
366
|
-
return new Set((e.options
|
|
366
|
+
return new Set(se(e.options).map((t) => t.value));
|
|
367
367
|
}
|
|
368
368
|
function Gt(e, t) {
|
|
369
369
|
const n = {
|
|
370
370
|
type: "array",
|
|
371
371
|
items: { type: "string" }
|
|
372
372
|
};
|
|
373
|
-
return e !== void 0 && (n.minItems =
|
|
373
|
+
return e !== void 0 && (n.minItems = fe(e, 1)), t !== void 0 && (n.maxItems = fe(t, 1)), n;
|
|
374
374
|
}
|
|
375
375
|
function Kr(e) {
|
|
376
376
|
const t = hn(e.type, e.defaultValue);
|
|
@@ -416,13 +416,13 @@ function Wr(e) {
|
|
|
416
416
|
case "select":
|
|
417
417
|
case "radio": {
|
|
418
418
|
n = { type: "string" };
|
|
419
|
-
const a = (e.options
|
|
419
|
+
const a = se(e.options).map((l) => l.value);
|
|
420
420
|
a.length > 0 && (n.enum = a);
|
|
421
421
|
break;
|
|
422
422
|
}
|
|
423
423
|
case "multiselect":
|
|
424
424
|
case "checkbox": {
|
|
425
|
-
const a = (e.options
|
|
425
|
+
const a = se(e.options).map((l) => l.value);
|
|
426
426
|
n = {
|
|
427
427
|
type: "array",
|
|
428
428
|
items: a.length > 0 ? { type: "string", enum: a } : { type: "string" }
|
|
@@ -430,7 +430,7 @@ function Wr(e) {
|
|
|
430
430
|
break;
|
|
431
431
|
}
|
|
432
432
|
case "file": {
|
|
433
|
-
const a =
|
|
433
|
+
const a = Oe(e.fileMinCount, 1), l = Oe(e.fileMaxCount, 1);
|
|
434
434
|
l <= 1 ? n = { type: "string" } : n = {
|
|
435
435
|
type: "array",
|
|
436
436
|
items: { type: "string" },
|
|
@@ -462,7 +462,7 @@ function Gr(e, t, n) {
|
|
|
462
462
|
const r = {}, o = [];
|
|
463
463
|
for (const u of e) {
|
|
464
464
|
const m = (l = u.name) == null ? void 0 : l.trim();
|
|
465
|
-
if (!m || !Z(u.type) || !
|
|
465
|
+
if (!m || !Z(u.type) || !ue(u)) continue;
|
|
466
466
|
const d = Wr(u);
|
|
467
467
|
d && (r[m] = d, u.required && o.push(m));
|
|
468
468
|
}
|
|
@@ -474,7 +474,7 @@ function Gr(e, t, n) {
|
|
|
474
474
|
}, s = t == null ? void 0 : t.trim(), a = n == null ? void 0 : n.trim();
|
|
475
475
|
return s && (i.title = s), a && (i.description = a), i;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Ce(e) {
|
|
478
478
|
const t = e.title ?? "", n = e.description ?? "";
|
|
479
479
|
return {
|
|
480
480
|
title: t,
|
|
@@ -485,24 +485,24 @@ function ke(e) {
|
|
|
485
485
|
}
|
|
486
486
|
function Ve(e) {
|
|
487
487
|
if (!e || !Array.isArray(e.blocks))
|
|
488
|
-
return
|
|
488
|
+
return Ce({ title: "", description: "", blocks: [] });
|
|
489
489
|
const t = e.blocks.map(Dr);
|
|
490
|
-
return
|
|
490
|
+
return Ce({
|
|
491
491
|
title: typeof e.title == "string" ? e.title : "",
|
|
492
492
|
description: typeof e.description == "string" ? e.description : "",
|
|
493
493
|
blocks: t
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
496
|
function Ps() {
|
|
497
|
-
return
|
|
497
|
+
return Ce({ title: "", description: "", blocks: [] });
|
|
498
498
|
}
|
|
499
499
|
function zs(e) {
|
|
500
500
|
const t = {
|
|
501
|
-
id:
|
|
501
|
+
id: ce("block-"),
|
|
502
502
|
type: e,
|
|
503
503
|
label: e
|
|
504
504
|
};
|
|
505
|
-
return Z(e) && (t.label = "", t.name =
|
|
505
|
+
return Z(e) && (t.label = "", t.name = ce("field_"), t.placeholder = "", t.required = !1), Se(e) && (t.label = "", t.placeholder = "", t.help = "", t.mediaUrls = [""], t.mediaSize = "medium"), ke(e) && (t.label = "", t.help = "", t.webUrl = "", t.webHeight = ut), dn(e) && (t.options = [
|
|
506
506
|
{ value: "option_1", label: "选项 1" },
|
|
507
507
|
{ value: "option_2", label: "选项 2" }
|
|
508
508
|
]), e === "file" && (t.fileAcceptTypes = [], t.fileAcceptExtensions = [], t.filePlaceholderIcon = "file", t.fileMinCount = 1, t.fileMaxCount = 1), e === "resume_multiselect" && (t.resumeEnableRefresh = !0, t.resumeMinCount = 1, t.resumeMaxCount = 1, t.resumeFilter = {
|
|
@@ -566,7 +566,7 @@ function Xr(e, t, n) {
|
|
|
566
566
|
const l = Jt(e.maxCount);
|
|
567
567
|
return l !== void 0 && (o.caseMaxCount = l), o;
|
|
568
568
|
}
|
|
569
|
-
const gn =
|
|
569
|
+
const gn = Te(
|
|
570
570
|
null
|
|
571
571
|
);
|
|
572
572
|
function Qr(e) {
|
|
@@ -620,19 +620,19 @@ function eo({ children: e }) {
|
|
|
620
620
|
return /* @__PURE__ */ c(gn.Provider, { value: b, children: e });
|
|
621
621
|
}
|
|
622
622
|
function St() {
|
|
623
|
-
return
|
|
623
|
+
return xe(gn) ?? Zr;
|
|
624
624
|
}
|
|
625
|
-
const yn =
|
|
625
|
+
const yn = Te({ interactive: !0 });
|
|
626
626
|
function mt({
|
|
627
627
|
interactive: e,
|
|
628
628
|
children: t
|
|
629
629
|
}) {
|
|
630
630
|
return /* @__PURE__ */ c(yn.Provider, { value: { interactive: e }, children: t });
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function ae() {
|
|
633
|
+
return xe(yn);
|
|
634
634
|
}
|
|
635
|
-
const vn =
|
|
635
|
+
const vn = Te(null);
|
|
636
636
|
function to(e) {
|
|
637
637
|
return e != null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
638
638
|
}
|
|
@@ -699,7 +699,7 @@ function oo({
|
|
|
699
699
|
return /* @__PURE__ */ c(vn.Provider, { value: l, children: t });
|
|
700
700
|
}
|
|
701
701
|
function bn() {
|
|
702
|
-
return
|
|
702
|
+
return xe(vn) ?? no;
|
|
703
703
|
}
|
|
704
704
|
const io = 300;
|
|
705
705
|
function Sn(e) {
|
|
@@ -716,7 +716,7 @@ function Yt(e, t = "value") {
|
|
|
716
716
|
if (!(!Sn(r) || r === void 0))
|
|
717
717
|
return e.dataContext.resolveDynamicValue(r);
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function le(e, t = "value", n = {}) {
|
|
720
720
|
const o = e.componentModel.properties[t], i = Sn(o), s = so(i), a = bn(), {
|
|
721
721
|
component: l = "Unknown",
|
|
722
722
|
changeAction: u = "change",
|
|
@@ -794,7 +794,7 @@ function ae(e, t = "value", n = {}) {
|
|
|
794
794
|
reportFocus: C
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
|
-
function
|
|
797
|
+
function Ae(e) {
|
|
798
798
|
if (typeof e == "string") return e || void 0;
|
|
799
799
|
if (typeof e == "number") return String(e);
|
|
800
800
|
}
|
|
@@ -804,7 +804,7 @@ function Q(e) {
|
|
|
804
804
|
function kn(e, t) {
|
|
805
805
|
return t ? Array.isArray(e) ? null : Q(e) : Array.isArray(e) ? e.length > 0 ? String(e[0]) : "" : e == null || typeof e == "string" || typeof e == "number" ? null : "";
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function Be(e) {
|
|
808
808
|
if (e == null) return;
|
|
809
809
|
const t = typeof e == "number" ? e : Number(e);
|
|
810
810
|
if (!(!Number.isFinite(t) || t < 1))
|
|
@@ -819,7 +819,7 @@ function An(e, t, n, r, o) {
|
|
|
819
819
|
function _n(e, t) {
|
|
820
820
|
return t === void 0 || e.length <= t ? null : e.slice(0, t);
|
|
821
821
|
}
|
|
822
|
-
const Tn =
|
|
822
|
+
const Tn = Te(null);
|
|
823
823
|
function dt({
|
|
824
824
|
caseSearch: e,
|
|
825
825
|
children: t
|
|
@@ -827,7 +827,7 @@ function dt({
|
|
|
827
827
|
return /* @__PURE__ */ c(Tn.Provider, { value: e ?? null, children: t });
|
|
828
828
|
}
|
|
829
829
|
function ao() {
|
|
830
|
-
return
|
|
830
|
+
return xe(Tn);
|
|
831
831
|
}
|
|
832
832
|
function tt(e) {
|
|
833
833
|
return typeof e == "string" ? e : "";
|
|
@@ -898,10 +898,10 @@ function mo({
|
|
|
898
898
|
);
|
|
899
899
|
}
|
|
900
900
|
function po({ context: e }) {
|
|
901
|
-
const { interactive: t } =
|
|
901
|
+
const { interactive: t } = ae(), n = ao(), { publishLiveOptions: r } = St(), { value: o, setValue: i, setValueSilent: s, fieldName: a } = le(e, "value", {
|
|
902
902
|
component: "SkoponCaseSelect",
|
|
903
903
|
changeAction: "click"
|
|
904
|
-
}), l = e.componentModel.properties, u = tt(l.label), m = tt(l.placeholder), d = tt(l.help), b = l.enableRefresh !== !1, y =
|
|
904
|
+
}), l = e.componentModel.properties, u = tt(l.label), m = tt(l.placeholder), d = tt(l.help), b = l.enableRefresh !== !1, y = Be(l.minCount), S = Be(l.maxCount), g = V(() => nt(l.caseFilter), [l.caseFilter]), k = co(g), [h, p] = E(1), [v, M] = E(!1), [N, _] = E(""), [z, C] = E([]), [q, L] = E(0), [re, K] = E(g.pageSize ?? 20), $ = A(0), Y = Q(o);
|
|
905
905
|
B(() => {
|
|
906
906
|
const T = _n(Y, S);
|
|
907
907
|
T !== null && s(T);
|
|
@@ -978,7 +978,7 @@ function po({ context: e }) {
|
|
|
978
978
|
T.caseUniqueId
|
|
979
979
|
)) }) : null,
|
|
980
980
|
b && n && rt(g) ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ c(
|
|
981
|
-
|
|
981
|
+
Me,
|
|
982
982
|
{
|
|
983
983
|
type: "default",
|
|
984
984
|
size: "small",
|
|
@@ -1053,7 +1053,7 @@ function yo(e, t, n) {
|
|
|
1053
1053
|
const l = Xt(e.maxCount);
|
|
1054
1054
|
return l !== void 0 && (o.resumeMaxCount = l), o;
|
|
1055
1055
|
}
|
|
1056
|
-
const xn =
|
|
1056
|
+
const xn = Te(null);
|
|
1057
1057
|
function pt({
|
|
1058
1058
|
resumeSearch: e,
|
|
1059
1059
|
children: t
|
|
@@ -1061,7 +1061,7 @@ function pt({
|
|
|
1061
1061
|
return /* @__PURE__ */ c(xn.Provider, { value: e ?? null, children: t });
|
|
1062
1062
|
}
|
|
1063
1063
|
function vo() {
|
|
1064
|
-
return
|
|
1064
|
+
return xe(xn);
|
|
1065
1065
|
}
|
|
1066
1066
|
function ot(e) {
|
|
1067
1067
|
return typeof e == "string" ? e : "";
|
|
@@ -1093,8 +1093,8 @@ function st(e, t) {
|
|
|
1093
1093
|
return /* @__PURE__ */ x("div", { className: "skopon-resume-select-card-tags", children: [
|
|
1094
1094
|
/* @__PURE__ */ c("span", { className: "skopon-resume-select-card-tags-label", children: e }),
|
|
1095
1095
|
n.length > 0 ? /* @__PURE__ */ x("div", { className: "skopon-resume-select-card-tags-list", children: [
|
|
1096
|
-
r.map((i) => /* @__PURE__ */ c(
|
|
1097
|
-
o > 0 ? /* @__PURE__ */ x(
|
|
1096
|
+
r.map((i) => /* @__PURE__ */ c(be, { className: "skopon-resume-select-card-tag", children: i }, i)),
|
|
1097
|
+
o > 0 ? /* @__PURE__ */ x(be, { className: "skopon-resume-select-card-tag", children: [
|
|
1098
1098
|
"+",
|
|
1099
1099
|
o
|
|
1100
1100
|
] }) : null
|
|
@@ -1153,10 +1153,10 @@ function To({
|
|
|
1153
1153
|
);
|
|
1154
1154
|
}
|
|
1155
1155
|
function xo({ context: e }) {
|
|
1156
|
-
const { interactive: t } =
|
|
1156
|
+
const { interactive: t } = ae(), n = vo(), { publishLiveOptions: r } = St(), { value: o, setValue: i, setValueSilent: s, fieldName: a } = le(e, "value", {
|
|
1157
1157
|
component: "SkoponResumeSelect",
|
|
1158
1158
|
changeAction: "click"
|
|
1159
|
-
}), l = e.componentModel.properties, u = ot(l.label), m = ot(l.placeholder), d = ot(l.help), b = l.enableRefresh !== !1, y =
|
|
1159
|
+
}), l = e.componentModel.properties, u = ot(l.label), m = ot(l.placeholder), d = ot(l.help), b = l.enableRefresh !== !1, y = Be(l.minCount), S = Be(l.maxCount), g = V(() => it(l.resumeFilter), [l.resumeFilter]), k = bo(g), [h, p] = E(1), [v, M] = E(!1), [N, _] = E(""), [z, C] = E([]), [q, L] = E(0), [re, K] = E(g.pageSize ?? 20), $ = A(0), Y = Q(o);
|
|
1160
1160
|
B(() => {
|
|
1161
1161
|
const T = _n(Y, S);
|
|
1162
1162
|
T !== null && s(T);
|
|
@@ -1234,7 +1234,7 @@ function xo({ context: e }) {
|
|
|
1234
1234
|
T.resumeUniqueId
|
|
1235
1235
|
)) }) : null,
|
|
1236
1236
|
b && n ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ c(
|
|
1237
|
-
|
|
1237
|
+
Me,
|
|
1238
1238
|
{
|
|
1239
1239
|
type: "default",
|
|
1240
1240
|
size: "small",
|
|
@@ -1267,7 +1267,7 @@ function Fo(e, t) {
|
|
|
1267
1267
|
id: t.id,
|
|
1268
1268
|
component: "SkoponWeb",
|
|
1269
1269
|
url: ((n = e.webUrl) == null ? void 0 : n.trim()) ?? "",
|
|
1270
|
-
height:
|
|
1270
|
+
height: Ne(e.webHeight),
|
|
1271
1271
|
label: t.label,
|
|
1272
1272
|
help: e.help ?? ""
|
|
1273
1273
|
}
|
|
@@ -1279,7 +1279,7 @@ function Io(e, t, n) {
|
|
|
1279
1279
|
return {
|
|
1280
1280
|
...t("web"),
|
|
1281
1281
|
webUrl: ((i = n.asLiteral(e.url)) == null ? void 0 : i.trim()) ?? "",
|
|
1282
|
-
webHeight:
|
|
1282
|
+
webHeight: Ne(e.height),
|
|
1283
1283
|
...r ? { help: r } : {}
|
|
1284
1284
|
};
|
|
1285
1285
|
}
|
|
@@ -1310,7 +1310,7 @@ function Eo({
|
|
|
1310
1310
|
label: n,
|
|
1311
1311
|
help: r
|
|
1312
1312
|
}) {
|
|
1313
|
-
const [o, i] = E(!1), [s, a] = E(!0), l = A(null), u = e.trim(), m = yr(u) ? u : null, d =
|
|
1313
|
+
const [o, i] = E(!1), [s, a] = E(!0), l = A(null), u = e.trim(), m = yr(u) ? u : null, d = Ne(t), b = (n == null ? void 0 : n.trim()) || "网页展示", y = r == null ? void 0 : r.trim(), S = u ? "网页 URL 无效" : "未设置网页 URL";
|
|
1314
1314
|
return /* @__PURE__ */ x("div", { className: "form-block-preview skopon-web-preview", children: [
|
|
1315
1315
|
n != null && n.trim() ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: n.trim() }) : null,
|
|
1316
1316
|
/* @__PURE__ */ x(
|
|
@@ -1329,8 +1329,8 @@ function Eo({
|
|
|
1329
1329
|
}
|
|
1330
1330
|
) : null,
|
|
1331
1331
|
m ? null : /* @__PURE__ */ c("div", { className: "skopon-web-empty", role: "status", children: S }),
|
|
1332
|
-
m ? /* @__PURE__ */ c(
|
|
1333
|
-
|
|
1332
|
+
m ? /* @__PURE__ */ c(ge, { title: "扩展显示", children: /* @__PURE__ */ c(
|
|
1333
|
+
Me,
|
|
1334
1334
|
{
|
|
1335
1335
|
type: "default",
|
|
1336
1336
|
shape: "circle",
|
|
@@ -1389,7 +1389,7 @@ const Uo = {
|
|
|
1389
1389
|
Eo,
|
|
1390
1390
|
{
|
|
1391
1391
|
url: typeof t.url == "string" ? t.url : "",
|
|
1392
|
-
height:
|
|
1392
|
+
height: Ne(t.height),
|
|
1393
1393
|
label: typeof t.label == "string" ? t.label : "",
|
|
1394
1394
|
help: typeof t.help == "string" ? t.help : ""
|
|
1395
1395
|
}
|
|
@@ -1422,7 +1422,7 @@ function qo() {
|
|
|
1422
1422
|
function Lo() {
|
|
1423
1423
|
return je.map((e) => e.componentName);
|
|
1424
1424
|
}
|
|
1425
|
-
const
|
|
1425
|
+
const qe = "root", ft = "__title__", ht = "__desc__", kt = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
|
|
1426
1426
|
function Vo(e) {
|
|
1427
1427
|
return `/${e}`;
|
|
1428
1428
|
}
|
|
@@ -1433,13 +1433,13 @@ function H(e) {
|
|
|
1433
1433
|
if (typeof e == "string") return e;
|
|
1434
1434
|
}
|
|
1435
1435
|
function jo(e) {
|
|
1436
|
-
const t = e.id ||
|
|
1436
|
+
const t = e.id || ce("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
|
|
1437
1437
|
return {
|
|
1438
1438
|
id: t,
|
|
1439
1439
|
component: "SkoponMedia",
|
|
1440
1440
|
mediaType: n,
|
|
1441
1441
|
urls: zr(e),
|
|
1442
|
-
mediaSize:
|
|
1442
|
+
mediaSize: Ie(e.mediaSize),
|
|
1443
1443
|
label: e.label ?? "",
|
|
1444
1444
|
help: e.help ?? "",
|
|
1445
1445
|
placeholder: e.placeholder ?? ""
|
|
@@ -1451,8 +1451,8 @@ function $o(e) {
|
|
|
1451
1451
|
const t = H(e.url);
|
|
1452
1452
|
return t != null && t.trim() ? [t.trim()] : [];
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1455
|
-
const r = typeof e.id == "string" ? e.id :
|
|
1454
|
+
function we(e, t, n) {
|
|
1455
|
+
const r = typeof e.id == "string" ? e.id : ce("block-"), o = $o(e), i = H(e.label) ?? H(e.description) ?? n, s = H(e.help), a = H(e.placeholder), l = Ie(e.mediaSize);
|
|
1456
1456
|
return {
|
|
1457
1457
|
id: r,
|
|
1458
1458
|
type: t,
|
|
@@ -1466,7 +1466,7 @@ function Re(e, t, n) {
|
|
|
1466
1466
|
function en(e) {
|
|
1467
1467
|
switch (e.type) {
|
|
1468
1468
|
case "toggle":
|
|
1469
|
-
return
|
|
1469
|
+
return Ee(e.defaultValue);
|
|
1470
1470
|
case "multiselect":
|
|
1471
1471
|
case "checkbox":
|
|
1472
1472
|
case "resume_multiselect":
|
|
@@ -1482,7 +1482,7 @@ function en(e) {
|
|
|
1482
1482
|
}
|
|
1483
1483
|
function Do(e) {
|
|
1484
1484
|
var u;
|
|
1485
|
-
const t = e.id ||
|
|
1485
|
+
const t = e.id || ce("a2-"), n = e.label ?? "", r = ((u = e.name) == null ? void 0 : u.trim()) || "", o = r ? Vo(r) : void 0, i = se(e.options), s = (m) => r ? { node: m, dataKey: r, dataValue: en(e) } : { node: m }, a = { id: t, label: n, name: r, path: o, withData: s }, l = Oo(e.type);
|
|
1486
1486
|
if (l)
|
|
1487
1487
|
return l.toComponent(e, a);
|
|
1488
1488
|
switch (e.type) {
|
|
@@ -1620,7 +1620,7 @@ function Do(e) {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
function gt(e) {
|
|
1622
1622
|
if (!e || !Array.isArray(e.components) || e.components.length === 0) return !0;
|
|
1623
|
-
const t = e.components.find((r) => r.id ===
|
|
1623
|
+
const t = e.components.find((r) => r.id === qe);
|
|
1624
1624
|
if (!t) return e.components.length === 0;
|
|
1625
1625
|
const n = t.children;
|
|
1626
1626
|
return !Array.isArray(n) || n.length === 0;
|
|
@@ -1629,12 +1629,12 @@ function Mn(e, t) {
|
|
|
1629
1629
|
const n = [], r = [], o = {}, i = (t == null ? void 0 : t.includeHeader) !== !1, s = (e.title ?? "").trim(), a = (e.description ?? "").trim();
|
|
1630
1630
|
i && s && (n.push({ id: ft, component: "Text", text: s, variant: "h2" }), r.push(ft)), i && a && (n.push({ id: ht, component: "Text", text: a, variant: "body" }), r.push(ht));
|
|
1631
1631
|
for (const m of e.blocks ?? []) {
|
|
1632
|
-
if (!
|
|
1632
|
+
if (!ue(m)) continue;
|
|
1633
1633
|
const { node: d, dataKey: b, dataValue: y } = Do(m);
|
|
1634
1634
|
b && (o[b] = y), d && (n.push(d), r.push(d.id));
|
|
1635
1635
|
}
|
|
1636
|
-
n.unshift({ id:
|
|
1637
|
-
const l = { root:
|
|
1636
|
+
n.unshift({ id: qe, component: "Column", children: r });
|
|
1637
|
+
const l = { root: qe, components: n, dataModel: o }, u = t == null ? void 0 : t.styleId;
|
|
1638
1638
|
return u !== void 0 && (l.surfaceProperties = { styleId: u ?? null }), l;
|
|
1639
1639
|
}
|
|
1640
1640
|
function Ho(e) {
|
|
@@ -1644,10 +1644,10 @@ function Ho(e) {
|
|
|
1644
1644
|
return t;
|
|
1645
1645
|
}
|
|
1646
1646
|
function at(e) {
|
|
1647
|
-
return
|
|
1647
|
+
return se(e.options);
|
|
1648
1648
|
}
|
|
1649
1649
|
function Ko(e) {
|
|
1650
|
-
const t = typeof e.id == "string" ? e.id :
|
|
1650
|
+
const t = typeof e.id == "string" ? e.id : ce("block-"), n = String(e.component ?? ""), r = H(e.label) ?? H(e.text) ?? "", o = Zt(e.value), i = (a) => ({ id: t, type: a, label: r }), s = Bo(n);
|
|
1651
1651
|
if (s)
|
|
1652
1652
|
return s.fromComponent(e, i, { asLiteral: H, nameFromValue: Zt });
|
|
1653
1653
|
switch (n) {
|
|
@@ -1691,14 +1691,14 @@ function Ko(e) {
|
|
|
1691
1691
|
}
|
|
1692
1692
|
case "SkoponMedia": {
|
|
1693
1693
|
const a = String(e.mediaType ?? "image");
|
|
1694
|
-
return
|
|
1694
|
+
return we(e, a === "video" ? "video" : a === "audio" ? "audio" : "image", r);
|
|
1695
1695
|
}
|
|
1696
1696
|
case "Image":
|
|
1697
|
-
return
|
|
1697
|
+
return we(e, "image", r);
|
|
1698
1698
|
case "Video":
|
|
1699
|
-
return
|
|
1699
|
+
return we(e, "video", r);
|
|
1700
1700
|
case "AudioPlayer":
|
|
1701
|
-
return
|
|
1701
|
+
return we(e, "audio", r);
|
|
1702
1702
|
case "FileUpload": {
|
|
1703
1703
|
const a = H(e.accept) ?? "", l = { ...i("file"), name: o };
|
|
1704
1704
|
return a && (l.fileAcceptExtensions = a.split(",").map((u) => u.trim()).filter(Boolean)), Array.isArray(e.fileAcceptTypes) && (l.fileAcceptTypes = e.fileAcceptTypes.map(String)), typeof e.filePlaceholderIcon == "string" && (l.filePlaceholderIcon = e.filePlaceholderIcon), typeof e.minCount == "number" && (l.fileMinCount = e.minCount), typeof e.maxCount == "number" && (l.fileMaxCount = e.maxCount), l;
|
|
@@ -1726,14 +1726,14 @@ function Wo(e, t) {
|
|
|
1726
1726
|
const r = (i = n.name) == null ? void 0 : i.trim();
|
|
1727
1727
|
if (!r || !(r in t)) return n;
|
|
1728
1728
|
const o = t[r];
|
|
1729
|
-
return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue:
|
|
1729
|
+
return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue: Ee(o) } : { ...n, defaultValue: o };
|
|
1730
1730
|
}) : e;
|
|
1731
1731
|
}
|
|
1732
1732
|
function Go(e) {
|
|
1733
1733
|
if (!e || !Array.isArray(e.components))
|
|
1734
|
-
return
|
|
1734
|
+
return Ce({ title: "", description: "", blocks: [] });
|
|
1735
1735
|
const t = Ho(e), n = [];
|
|
1736
|
-
Nn(e.root ??
|
|
1736
|
+
Nn(e.root ?? qe, t, /* @__PURE__ */ new Set(), n);
|
|
1737
1737
|
let r = "", o = "";
|
|
1738
1738
|
const i = [];
|
|
1739
1739
|
for (const s of n) {
|
|
@@ -1748,7 +1748,7 @@ function Go(e) {
|
|
|
1748
1748
|
const a = Ko(s);
|
|
1749
1749
|
a && i.push(a);
|
|
1750
1750
|
}
|
|
1751
|
-
return
|
|
1751
|
+
return Ce({
|
|
1752
1752
|
title: r,
|
|
1753
1753
|
description: o,
|
|
1754
1754
|
blocks: Wo(i, e.dataModel)
|
|
@@ -1843,7 +1843,7 @@ function ti(e, t) {
|
|
|
1843
1843
|
const a = (i = s.name) == null ? void 0 : i.trim();
|
|
1844
1844
|
if (!a) continue;
|
|
1845
1845
|
const l = n.get(a);
|
|
1846
|
-
l && (Ct(l) ||
|
|
1846
|
+
l && (Ct(l) || ue(l) && r.push(l));
|
|
1847
1847
|
}
|
|
1848
1848
|
return r;
|
|
1849
1849
|
}
|
|
@@ -1913,11 +1913,11 @@ function In(e) {
|
|
|
1913
1913
|
const { type: t, defaultValue: n } = e;
|
|
1914
1914
|
return n !== void 0 ? t === "toggle" ? n === !0 || n === "true" : t === "multiselect" || t === "checkbox" || t === "resume_multiselect" || t === "case_multiselect" ? Array.isArray(n) ? n.map(String) : typeof n == "string" && n ? [n] : [] : n : t === "toggle" ? !1 : t === "multiselect" || t === "checkbox" || t === "resume_multiselect" || t === "case_multiselect" ? [] : t === "number" ? null : "";
|
|
1915
1915
|
}
|
|
1916
|
-
function
|
|
1916
|
+
function Le(e) {
|
|
1917
1917
|
var n;
|
|
1918
1918
|
const t = {};
|
|
1919
1919
|
for (const r of e) {
|
|
1920
|
-
if (!Z(r.type) || !
|
|
1920
|
+
if (!Z(r.type) || !ue(r)) continue;
|
|
1921
1921
|
const o = (n = r.name) == null ? void 0 : n.trim();
|
|
1922
1922
|
o && (t[o] = In(r));
|
|
1923
1923
|
}
|
|
@@ -1927,21 +1927,21 @@ function ii(e) {
|
|
|
1927
1927
|
return e.blocks.some(
|
|
1928
1928
|
(t) => {
|
|
1929
1929
|
var n;
|
|
1930
|
-
return Z(t.type) && !!((n = t.name) != null && n.trim()) &&
|
|
1930
|
+
return Z(t.type) && !!((n = t.name) != null && n.trim()) && ue(t);
|
|
1931
1931
|
}
|
|
1932
1932
|
);
|
|
1933
1933
|
}
|
|
1934
1934
|
function si(e) {
|
|
1935
1935
|
return e.blocks.filter((t) => {
|
|
1936
1936
|
var n;
|
|
1937
|
-
return mn(t.type) ? !0 : !Z(t.type) || !((n = t.name) != null && n.trim()) || !
|
|
1937
|
+
return mn(t.type) ? !0 : !Z(t.type) || !((n = t.name) != null && n.trim()) || !ue(t) ? !1 : !Ct(t);
|
|
1938
1938
|
});
|
|
1939
1939
|
}
|
|
1940
1940
|
function Os(e) {
|
|
1941
1941
|
return e.blocks.filter(
|
|
1942
1942
|
(t) => {
|
|
1943
1943
|
var n;
|
|
1944
|
-
return Z(t.type) && ((n = t.name) == null ? void 0 : n.trim()) &&
|
|
1944
|
+
return Z(t.type) && ((n = t.name) == null ? void 0 : n.trim()) && ue(t);
|
|
1945
1945
|
}
|
|
1946
1946
|
).map((t) => t.name.trim());
|
|
1947
1947
|
}
|
|
@@ -1994,7 +1994,7 @@ function ci({
|
|
|
1994
1994
|
function Bs(e, t, n) {
|
|
1995
1995
|
const r = $e(e);
|
|
1996
1996
|
if (!r) return Un(e, t, n);
|
|
1997
|
-
const o =
|
|
1997
|
+
const o = Le(r.blocks);
|
|
1998
1998
|
return ci({ cardValues: o, callbackUrl: t, headers: n });
|
|
1999
1999
|
}
|
|
2000
2000
|
async function Rn(e, t, n) {
|
|
@@ -2371,7 +2371,7 @@ function Fi(e, t) {
|
|
|
2371
2371
|
case "case_multiselect":
|
|
2372
2372
|
return Q(t).length === 0;
|
|
2373
2373
|
case "toggle":
|
|
2374
|
-
return !
|
|
2374
|
+
return !Ee(t);
|
|
2375
2375
|
case "number":
|
|
2376
2376
|
return t == null || t === "";
|
|
2377
2377
|
default:
|
|
@@ -2462,8 +2462,8 @@ const Ln = "skopon-form-v0_9", Ri = /* @__PURE__ */ new Set([
|
|
|
2462
2462
|
"Text",
|
|
2463
2463
|
...Lo()
|
|
2464
2464
|
]), wi = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
|
|
2465
|
-
function
|
|
2466
|
-
const t = [...
|
|
2465
|
+
function Ue(e) {
|
|
2466
|
+
const t = [...ze.components.values()].find((n) => n.name === e);
|
|
2467
2467
|
if (!t) throw new Error(`Missing basic catalog component: ${e}`);
|
|
2468
2468
|
return t.schema;
|
|
2469
2469
|
}
|
|
@@ -2471,7 +2471,7 @@ function w(e) {
|
|
|
2471
2471
|
return typeof e == "string" ? e : "";
|
|
2472
2472
|
}
|
|
2473
2473
|
function Vn(e) {
|
|
2474
|
-
return
|
|
2474
|
+
return se(e);
|
|
2475
2475
|
}
|
|
2476
2476
|
function De({
|
|
2477
2477
|
mediaType: e,
|
|
@@ -2517,7 +2517,7 @@ function He(e, t) {
|
|
|
2517
2517
|
return {
|
|
2518
2518
|
mediaType: t,
|
|
2519
2519
|
urls: n,
|
|
2520
|
-
mediaSize:
|
|
2520
|
+
mediaSize: Ie(e.mediaSize),
|
|
2521
2521
|
label: w(e.label) || w(e.description),
|
|
2522
2522
|
help: w(e.help),
|
|
2523
2523
|
placeholder: w(e.placeholder)
|
|
@@ -2537,13 +2537,13 @@ const Pi = {
|
|
|
2537
2537
|
const t = e.componentModel.properties, n = w(t.mediaType);
|
|
2538
2538
|
return /* @__PURE__ */ c(De, { ...He(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
|
|
2539
2539
|
}), Oi = J(
|
|
2540
|
-
{ name: "Image", schema:
|
|
2540
|
+
{ name: "Image", schema: Ue("Image") },
|
|
2541
2541
|
({ context: e }) => /* @__PURE__ */ c(De, { ...He(e.componentModel.properties, "image") })
|
|
2542
2542
|
), Bi = J(
|
|
2543
|
-
{ name: "Video", schema:
|
|
2543
|
+
{ name: "Video", schema: Ue("Video") },
|
|
2544
2544
|
({ context: e }) => /* @__PURE__ */ c(De, { ...He(e.componentModel.properties, "video") })
|
|
2545
2545
|
), qi = J(
|
|
2546
|
-
{ name: "AudioPlayer", schema:
|
|
2546
|
+
{ name: "AudioPlayer", schema: Ue("AudioPlayer") },
|
|
2547
2547
|
({ context: e }) => /* @__PURE__ */ c(De, { ...He(e.componentModel.properties, "audio") })
|
|
2548
2548
|
), Li = {
|
|
2549
2549
|
name: "SkoponSelect",
|
|
@@ -2556,7 +2556,7 @@ const Pi = {
|
|
|
2556
2556
|
}).passthrough()
|
|
2557
2557
|
};
|
|
2558
2558
|
function Vi({ context: e }) {
|
|
2559
|
-
const { interactive: t } =
|
|
2559
|
+
const { interactive: t } = ae(), { value: n, setValue: r, setValueSilent: o, fieldName: i } = le(e, "value", {
|
|
2560
2560
|
component: "SkoponSelect",
|
|
2561
2561
|
changeAction: "select"
|
|
2562
2562
|
}), s = e.componentModel.properties, a = w(s.label), l = w(s.placeholder), u = Vn(s.options), m = w(s.mode) === "multiple";
|
|
@@ -2575,7 +2575,7 @@ function Vi({ context: e }) {
|
|
|
2575
2575
|
style: { width: "100%" },
|
|
2576
2576
|
placeholder: l || (m ? "请选择多项" : "请选择"),
|
|
2577
2577
|
options: u,
|
|
2578
|
-
value: m ? Q(n) :
|
|
2578
|
+
value: m ? Q(n) : Ae(n),
|
|
2579
2579
|
onChange: (d) => r(m ? d ?? [] : d ?? "")
|
|
2580
2580
|
}
|
|
2581
2581
|
)
|
|
@@ -2586,7 +2586,7 @@ const ji = J(
|
|
|
2586
2586
|
Vi
|
|
2587
2587
|
);
|
|
2588
2588
|
function $i({ context: e }) {
|
|
2589
|
-
const { interactive: t } =
|
|
2589
|
+
const { interactive: t } = ae(), { value: n, setValue: r, setValueSilent: o, fieldName: i } = le(e, "value", {
|
|
2590
2590
|
component: "ChoicePicker",
|
|
2591
2591
|
changeAction: "select"
|
|
2592
2592
|
}), s = e.componentModel.properties, a = w(s.label), l = w(s.variant) || "mutuallyExclusive", u = w(s.skoponPickerType), m = w(s.placeholder), d = Vn(s.options), y = u === "select" || u === "multiselect" || u === "radio" || u === "checkbox" ? u : l === "multipleSelection" ? "checkbox" : "radio", S = y === "multiselect" || y === "checkbox";
|
|
@@ -2604,7 +2604,7 @@ function $i({ context: e }) {
|
|
|
2604
2604
|
style: { width: "100%" },
|
|
2605
2605
|
placeholder: m || "请选择",
|
|
2606
2606
|
options: d,
|
|
2607
|
-
value:
|
|
2607
|
+
value: Ae(n),
|
|
2608
2608
|
onChange: (g) => r(g ?? "")
|
|
2609
2609
|
}
|
|
2610
2610
|
) : y === "multiselect" ? /* @__PURE__ */ c(
|
|
@@ -2635,7 +2635,7 @@ function $i({ context: e }) {
|
|
|
2635
2635
|
disabled: !t,
|
|
2636
2636
|
className: "form-block-preview-control",
|
|
2637
2637
|
options: d,
|
|
2638
|
-
value:
|
|
2638
|
+
value: Ae(n),
|
|
2639
2639
|
onChange: (g) => r(g.target.value)
|
|
2640
2640
|
}
|
|
2641
2641
|
)
|
|
@@ -2656,7 +2656,7 @@ const Di = J(
|
|
|
2656
2656
|
$i
|
|
2657
2657
|
);
|
|
2658
2658
|
function Hi({ context: e }) {
|
|
2659
|
-
const { interactive: t } =
|
|
2659
|
+
const { interactive: t } = ae(), { value: n, setValue: r, fieldName: o } = le(e, "value", {
|
|
2660
2660
|
component: "CheckBox",
|
|
2661
2661
|
changeAction: "change"
|
|
2662
2662
|
}), i = e.componentModel.properties, s = w(i.label);
|
|
@@ -2667,18 +2667,18 @@ function Hi({ context: e }) {
|
|
|
2667
2667
|
{
|
|
2668
2668
|
disabled: !t,
|
|
2669
2669
|
className: "form-block-preview-control",
|
|
2670
|
-
checked:
|
|
2670
|
+
checked: Ee(n),
|
|
2671
2671
|
onChange: (a) => r(a)
|
|
2672
2672
|
}
|
|
2673
2673
|
)
|
|
2674
2674
|
] });
|
|
2675
2675
|
}
|
|
2676
2676
|
const Ki = J(
|
|
2677
|
-
{ name: "CheckBox", schema:
|
|
2677
|
+
{ name: "CheckBox", schema: Ue("CheckBox") },
|
|
2678
2678
|
Hi
|
|
2679
2679
|
);
|
|
2680
2680
|
function Wi(e, t, n) {
|
|
2681
|
-
const r =
|
|
2681
|
+
const r = Ae(e);
|
|
2682
2682
|
if (!r) return;
|
|
2683
2683
|
if (!t && n) {
|
|
2684
2684
|
const i = Kt(r, "HH:mm", !0);
|
|
@@ -2688,7 +2688,7 @@ function Wi(e, t, n) {
|
|
|
2688
2688
|
return o.isValid() ? o : void 0;
|
|
2689
2689
|
}
|
|
2690
2690
|
function Gi({ context: e }) {
|
|
2691
|
-
const { interactive: t } =
|
|
2691
|
+
const { interactive: t } = ae(), { value: n, setValue: r, fieldName: o, reportFocus: i } = le(e, "value", {
|
|
2692
2692
|
component: "DateTimeInput",
|
|
2693
2693
|
changeAction: "change"
|
|
2694
2694
|
}), s = e.componentModel.properties, a = w(s.label), l = w(s.placeholder), u = s.enableDate === !0, m = s.enableTime === !0, d = Wi(n, u, m), b = (y) => {
|
|
@@ -2761,7 +2761,7 @@ const Ji = J(
|
|
|
2761
2761
|
}).passthrough()
|
|
2762
2762
|
};
|
|
2763
2763
|
function Xi({ context: e }) {
|
|
2764
|
-
const { interactive: t } =
|
|
2764
|
+
const { interactive: t } = ae(), { value: n, setValue: r, fieldName: o } = le(e, "value", {
|
|
2765
2765
|
component: "FileUpload",
|
|
2766
2766
|
changeAction: "change"
|
|
2767
2767
|
}), i = e.componentModel.properties, s = w(i.label), a = w(i.accept), l = Array.isArray(i.fileAcceptTypes) ? i.fileAcceptTypes.map(String) : void 0, u = a ? a.split(",").map((p) => p.trim()).filter(Boolean) : void 0, m = Er(l, u), d = typeof i.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
|
|
@@ -2814,11 +2814,11 @@ const Qi = J(
|
|
|
2814
2814
|
Xi
|
|
2815
2815
|
);
|
|
2816
2816
|
function Zi({ context: e }) {
|
|
2817
|
-
const { interactive: t } =
|
|
2817
|
+
const { interactive: t } = ae(), { value: n, setValue: r, fieldName: o, reportFocus: i } = le(e, "value", {
|
|
2818
2818
|
component: "TextField",
|
|
2819
2819
|
changeAction: "change",
|
|
2820
2820
|
debounceChange: !0
|
|
2821
|
-
}), s = e.componentModel.properties, a = w(s.label), l = w(s.placeholder), u = w(s.variant) || "shortText", m = w(s.validationRegexp), d =
|
|
2821
|
+
}), s = e.componentModel.properties, a = w(s.label), l = w(s.placeholder), u = w(s.variant) || "shortText", m = w(s.validationRegexp), d = Ae(n) ?? "", b = !t, [y, S] = E(""), g = (p) => {
|
|
2822
2822
|
if (!m || !p.trim()) {
|
|
2823
2823
|
S("");
|
|
2824
2824
|
return;
|
|
@@ -2912,12 +2912,12 @@ function ts({ context: e }) {
|
|
|
2912
2912
|
return wi.has(r) ? r === "caption" ? /* @__PURE__ */ c(ee.Text, { type: "secondary", className: "form-block-preview-paragraph", children: /* @__PURE__ */ c("em", { children: n }) }) : /* @__PURE__ */ c(r, { className: "form-block-preview-heading", children: n }) : /* @__PURE__ */ c(ee.Paragraph, { className: "form-block-preview-paragraph", children: n });
|
|
2913
2913
|
}
|
|
2914
2914
|
const ns = J(
|
|
2915
|
-
{ name: "Text", schema:
|
|
2915
|
+
{ name: "Text", schema: Ue("Text") },
|
|
2916
2916
|
ts
|
|
2917
2917
|
);
|
|
2918
2918
|
function jn() {
|
|
2919
2919
|
const t = [
|
|
2920
|
-
...[...
|
|
2920
|
+
...[...ze.components.values()].filter(
|
|
2921
2921
|
(r) => !Ri.has(r.name)
|
|
2922
2922
|
),
|
|
2923
2923
|
zi,
|
|
@@ -2932,8 +2932,8 @@ function jn() {
|
|
|
2932
2932
|
es,
|
|
2933
2933
|
ns,
|
|
2934
2934
|
...qo()
|
|
2935
|
-
], n = [...
|
|
2936
|
-
return new pr(Ln, t, n,
|
|
2935
|
+
], n = [...ze.functions.values()];
|
|
2936
|
+
return new pr(Ln, t, n, ze.themeSchema);
|
|
2937
2937
|
}
|
|
2938
2938
|
const ie = {
|
|
2939
2939
|
jade9: "#29a383",
|
|
@@ -3032,7 +3032,7 @@ const ie = {
|
|
|
3032
3032
|
}
|
|
3033
3033
|
}
|
|
3034
3034
|
};
|
|
3035
|
-
function
|
|
3035
|
+
function _e({
|
|
3036
3036
|
children: e,
|
|
3037
3037
|
locale: t,
|
|
3038
3038
|
theme: n
|
|
@@ -3101,13 +3101,13 @@ const os = Jn(
|
|
|
3101
3101
|
[n]
|
|
3102
3102
|
), S.length === 0) {
|
|
3103
3103
|
const h = /* @__PURE__ */ c(pt, { resumeSearch: s, children: /* @__PURE__ */ c(dt, { caseSearch: a, children: /* @__PURE__ */ c(mt, { interactive: o, children: r }) }) });
|
|
3104
|
-
return l ? /* @__PURE__ */ c(
|
|
3104
|
+
return l ? /* @__PURE__ */ c(_e, { children: h }) : h;
|
|
3105
3105
|
}
|
|
3106
3106
|
const k = /* @__PURE__ */ c(pt, { resumeSearch: s, children: /* @__PURE__ */ c(dt, { caseSearch: a, children: /* @__PURE__ */ c(mt, { interactive: o, children: /* @__PURE__ */ c("div", { className: "a2ui-surface a2ui-container", children: S.map((h) => /* @__PURE__ */ c(sn, { surface: h }, h.id)) }) }) }) });
|
|
3107
|
-
return l ? /* @__PURE__ */ c(
|
|
3107
|
+
return l ? /* @__PURE__ */ c(_e, { children: k }) : k;
|
|
3108
3108
|
}
|
|
3109
3109
|
);
|
|
3110
|
-
function
|
|
3110
|
+
function Pe() {
|
|
3111
3111
|
return new an([jn()]);
|
|
3112
3112
|
}
|
|
3113
3113
|
function js({
|
|
@@ -3122,7 +3122,7 @@ function js({
|
|
|
3122
3122
|
cn(), ln();
|
|
3123
3123
|
}, []);
|
|
3124
3124
|
const s = A(null);
|
|
3125
|
-
s.current === null && (s.current =
|
|
3125
|
+
s.current === null && (s.current = Pe());
|
|
3126
3126
|
const a = A(0), l = A(""), u = A(!0), m = A(t);
|
|
3127
3127
|
function d(h, p) {
|
|
3128
3128
|
s.current = h, a.current = p.length, l.current = JSON.stringify(p), u.current && (S(h), k(Array.from(h.model.surfacesMap.values())));
|
|
@@ -3160,14 +3160,14 @@ function js({
|
|
|
3160
3160
|
let h = !1;
|
|
3161
3161
|
const p = m.current !== t;
|
|
3162
3162
|
if (m.current = t, p) {
|
|
3163
|
-
const _ =
|
|
3163
|
+
const _ = Pe();
|
|
3164
3164
|
return Array.isArray(e) && e.length > 0 ? (_.processMessages(e), h || d(_, e)) : (s.current = _, a.current = 0, l.current = "", h || (S(_), k([]))), () => {
|
|
3165
3165
|
h = !0;
|
|
3166
3166
|
};
|
|
3167
3167
|
}
|
|
3168
3168
|
if (!Array.isArray(e) || e.length === 0) {
|
|
3169
3169
|
if (a.current > 0) {
|
|
3170
|
-
const _ =
|
|
3170
|
+
const _ = Pe();
|
|
3171
3171
|
s.current = _, a.current = 0, l.current = "", h || (S(_), k([]));
|
|
3172
3172
|
}
|
|
3173
3173
|
return () => {
|
|
@@ -3176,7 +3176,7 @@ function js({
|
|
|
3176
3176
|
}
|
|
3177
3177
|
const v = s.current, M = a.current;
|
|
3178
3178
|
if (e.length < M || b(e, M)) {
|
|
3179
|
-
const _ =
|
|
3179
|
+
const _ = Pe();
|
|
3180
3180
|
return _.processMessages(e), h || d(_, e), () => {
|
|
3181
3181
|
h = !0;
|
|
3182
3182
|
};
|
|
@@ -3187,13 +3187,13 @@ function js({
|
|
|
3187
3187
|
} : (v.processMessages(N), a.current = e.length, l.current = JSON.stringify(e), h || k(Array.from(v.model.surfacesMap.values())), () => {
|
|
3188
3188
|
h = !0;
|
|
3189
3189
|
});
|
|
3190
|
-
}, [e, t]), g.length === 0 ? /* @__PURE__ */ c(
|
|
3190
|
+
}, [e, t]), g.length === 0 ? /* @__PURE__ */ c(_e, { children: n }) : /* @__PURE__ */ c(_e, { children: /* @__PURE__ */ c(pt, { resumeSearch: o, children: /* @__PURE__ */ c(dt, { caseSearch: i, children: /* @__PURE__ */ c(mt, { interactive: r, children: /* @__PURE__ */ c("div", { className: "a2ui-surface a2ui-container", children: g.map((h) => /* @__PURE__ */ c(sn, { surface: h }, h.id)) }) }) }) }) });
|
|
3191
3191
|
}
|
|
3192
|
-
const is = 100, ss = 3e4, as = 1500,
|
|
3192
|
+
const is = 100, ss = 3e4, as = 1500, he = /* @__PURE__ */ new Map();
|
|
3193
3193
|
function ls(e) {
|
|
3194
3194
|
const t = e.trim();
|
|
3195
|
-
let n =
|
|
3196
|
-
return n || (n = new cs(t),
|
|
3195
|
+
let n = he.get(t);
|
|
3196
|
+
return n || (n = new cs(t), he.set(t, n)), n.acquire(), n;
|
|
3197
3197
|
}
|
|
3198
3198
|
class cs {
|
|
3199
3199
|
constructor(t) {
|
|
@@ -3213,12 +3213,12 @@ class cs {
|
|
|
3213
3213
|
}
|
|
3214
3214
|
release() {
|
|
3215
3215
|
this.refCount = Math.max(0, this.refCount - 1), !(this.refCount > 0) && (this.clearReleaseTimer(), this.releaseTimer = setTimeout(() => {
|
|
3216
|
-
this.releaseTimer = null, !(this.refCount > 0) && (this.teardown(),
|
|
3216
|
+
this.releaseTimer = null, !(this.refCount > 0) && (this.teardown(), he.get(this.url) === this && he.delete(this.url));
|
|
3217
3217
|
}, as));
|
|
3218
3218
|
}
|
|
3219
3219
|
/** 强制关闭(测试用),跳过宽限期。 */
|
|
3220
3220
|
forceClose() {
|
|
3221
|
-
this.refCount = 0, this.teardown(),
|
|
3221
|
+
this.refCount = 0, this.teardown(), he.get(this.url) === this && he.delete(this.url);
|
|
3222
3222
|
}
|
|
3223
3223
|
subscribe(t, n) {
|
|
3224
3224
|
const r = t.trim();
|
|
@@ -3445,7 +3445,7 @@ function gs(e) {
|
|
|
3445
3445
|
}
|
|
3446
3446
|
function ys(e) {
|
|
3447
3447
|
const t = $e(e);
|
|
3448
|
-
return t ?
|
|
3448
|
+
return t ? Le(t.blocks) : e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
3449
3449
|
}
|
|
3450
3450
|
function vs({
|
|
3451
3451
|
payload: e,
|
|
@@ -3501,11 +3501,11 @@ function vs({
|
|
|
3501
3501
|
/* @__PURE__ */ x("div", { className: "ask-user-curl-card-header", children: [
|
|
3502
3502
|
/* @__PURE__ */ x("div", { className: "ask-user-curl-card-header-title", children: [
|
|
3503
3503
|
/* @__PURE__ */ c(ee.Text, { type: "secondary", children: n ?? "curl 命令" }),
|
|
3504
|
-
r ? /* @__PURE__ */ c(
|
|
3505
|
-
o ? /* @__PURE__ */ c(
|
|
3504
|
+
r ? /* @__PURE__ */ c(ge, { title: r, children: /* @__PURE__ */ c(be, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
|
|
3505
|
+
o ? /* @__PURE__ */ c(ge, { title: o, children: /* @__PURE__ */ c(be, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
|
|
3506
3506
|
] }),
|
|
3507
|
-
/* @__PURE__ */ c(
|
|
3508
|
-
|
|
3507
|
+
/* @__PURE__ */ c(ge, { title: "提交到 answer_agent_callback_url", children: /* @__PURE__ */ c(
|
|
3508
|
+
Me,
|
|
3509
3509
|
{
|
|
3510
3510
|
size: "small",
|
|
3511
3511
|
type: "text",
|
|
@@ -3565,8 +3565,8 @@ function ks({
|
|
|
3565
3565
|
var W;
|
|
3566
3566
|
if (!F) {
|
|
3567
3567
|
k(!1), S(null);
|
|
3568
|
-
const
|
|
3569
|
-
(W = C.current) == null || W.call(C, "error",
|
|
3568
|
+
const Re = O instanceof Error ? O.message : "获取表单定义失败";
|
|
3569
|
+
(W = C.current) == null || W.call(C, "error", Re);
|
|
3570
3570
|
}
|
|
3571
3571
|
}).finally(() => {
|
|
3572
3572
|
F || p(!1);
|
|
@@ -3579,8 +3579,8 @@ function ks({
|
|
|
3579
3579
|
const U = V(() => $e(e), [e]), P = V(() => U ? oi(U, y ?? void 0) : null, [U, y]), T = (P == null ? void 0 : P.matchedBlocks) ?? [], D = !!(U && ii(U) && T.length === 0), R = V(() => D && U ? si(U) : P && P.renderBlocks.length > 0 ? P.renderBlocks : [], [P, D, U]), I = V(() => {
|
|
3580
3580
|
if (D && U)
|
|
3581
3581
|
return ai(U);
|
|
3582
|
-
const F =
|
|
3583
|
-
return { ...
|
|
3582
|
+
const F = Le((P == null ? void 0 : P.extraBlocks) ?? []);
|
|
3583
|
+
return { ...Le(
|
|
3584
3584
|
((P == null ? void 0 : P.matchedBlocks) ?? []).filter(
|
|
3585
3585
|
(W) => W.type === "text" && W.hidden === !0
|
|
3586
3586
|
)
|
|
@@ -3591,17 +3591,17 @@ function ks({
|
|
|
3591
3591
|
return Z(F.type) && ((O = F.name) == null ? void 0 : O.trim());
|
|
3592
3592
|
}).map((F) => F.name.trim()),
|
|
3593
3593
|
[R]
|
|
3594
|
-
),
|
|
3595
|
-
{ title:
|
|
3594
|
+
), me = (P == null ? void 0 : P.title) ?? (U == null ? void 0 : U.title) ?? "", de = (P == null ? void 0 : P.description) ?? (U == null ? void 0 : U.description) ?? "", pe = V(() => R.length === 0 ? null : Xo(
|
|
3595
|
+
{ title: me, description: de },
|
|
3596
3596
|
R
|
|
3597
|
-
), [
|
|
3598
|
-
if (!
|
|
3597
|
+
), [me, de, R]), Ke = V(() => {
|
|
3598
|
+
if (!pe) return "";
|
|
3599
3599
|
try {
|
|
3600
|
-
return JSON.stringify(
|
|
3600
|
+
return JSON.stringify(pe);
|
|
3601
3601
|
} catch {
|
|
3602
|
-
return String(
|
|
3602
|
+
return String(pe);
|
|
3603
3603
|
}
|
|
3604
|
-
}, [
|
|
3604
|
+
}, [pe]), We = $ ? `ask-user-${$}` : "ask-user-payload", oe = !!(!h && U && R.length > 0 && pe);
|
|
3605
3605
|
B(() => (d(oe), () => d(!1)), [oe, d]);
|
|
3606
3606
|
const Rt = j(() => {
|
|
3607
3607
|
var O;
|
|
@@ -3610,11 +3610,11 @@ function ks({
|
|
|
3610
3610
|
wt.current = L.liveOptions;
|
|
3611
3611
|
const Ge = A(L.pendingChangeFields);
|
|
3612
3612
|
Ge.current = L.pendingChangeFields;
|
|
3613
|
-
const
|
|
3613
|
+
const ye = j(
|
|
3614
3614
|
(F) => {
|
|
3615
3615
|
const O = gs({
|
|
3616
|
-
title:
|
|
3617
|
-
description:
|
|
3616
|
+
title: me,
|
|
3617
|
+
description: de,
|
|
3618
3618
|
blocks: R,
|
|
3619
3619
|
values: Rt(),
|
|
3620
3620
|
liveOptions: wt.current,
|
|
@@ -3622,9 +3622,9 @@ function ks({
|
|
|
3622
3622
|
});
|
|
3623
3623
|
q.reportData(O);
|
|
3624
3624
|
},
|
|
3625
|
-
[
|
|
3626
|
-
), Je = A(
|
|
3627
|
-
Je.current =
|
|
3625
|
+
[me, de, R, Rt, q]
|
|
3626
|
+
), Je = A(ye);
|
|
3627
|
+
Je.current = ye, B(() => {
|
|
3628
3628
|
if (!oe) {
|
|
3629
3629
|
re.current = "";
|
|
3630
3630
|
return;
|
|
@@ -3647,11 +3647,11 @@ function ks({
|
|
|
3647
3647
|
};
|
|
3648
3648
|
}, [oe, L.version, L.clearPendingChangeFields]);
|
|
3649
3649
|
const Ye = j(async () => {
|
|
3650
|
-
var F, O, W,
|
|
3650
|
+
var F, O, W, Re, Ot, Bt, qt, Lt;
|
|
3651
3651
|
if (!v) {
|
|
3652
3652
|
M(!0);
|
|
3653
3653
|
try {
|
|
3654
|
-
const
|
|
3654
|
+
const ve = { ...((F = N.current) == null ? void 0 : F.getValues(X)) ?? {}, ...I }, Vt = Ii(R, ve);
|
|
3655
3655
|
if (Vt) {
|
|
3656
3656
|
(O = C.current) == null || O.call(C, "error", Vt.message);
|
|
3657
3657
|
return;
|
|
@@ -3662,32 +3662,32 @@ function ks({
|
|
|
3662
3662
|
(W = C.current) == null || W.call(C, "error", "callback_url 为空,无法提交");
|
|
3663
3663
|
return;
|
|
3664
3664
|
}
|
|
3665
|
-
|
|
3665
|
+
ye([]), q.reportEvent({
|
|
3666
3666
|
action: "submit",
|
|
3667
3667
|
component: "SubmitButton"
|
|
3668
3668
|
});
|
|
3669
|
-
const Qe = await Rn(Ht,
|
|
3669
|
+
const Qe = await Rn(Ht, ve, {
|
|
3670
3670
|
headers: te
|
|
3671
3671
|
});
|
|
3672
3672
|
if (!z.current) return;
|
|
3673
|
-
Qe.ok ? (
|
|
3673
|
+
Qe.ok ? (Re = C.current) == null || Re.call(C, "success", "提交成功") : (Ot = C.current) == null || Ot.call(C, "error", Ss(Qe.status, Qe.body));
|
|
3674
3674
|
return;
|
|
3675
3675
|
}
|
|
3676
3676
|
const Dn = R.length > 0 ? {
|
|
3677
|
-
title:
|
|
3678
|
-
description:
|
|
3677
|
+
title: me,
|
|
3678
|
+
description: de,
|
|
3679
3679
|
blocks: R
|
|
3680
3680
|
} : U ?? void 0, jt = Et({
|
|
3681
3681
|
context: ne,
|
|
3682
3682
|
payload: e,
|
|
3683
3683
|
form: Dn,
|
|
3684
|
-
answer:
|
|
3684
|
+
answer: ve
|
|
3685
3685
|
}), $t = Ut(jt);
|
|
3686
3686
|
if ($t) {
|
|
3687
3687
|
(Bt = C.current) == null || Bt.call(C, "error", $t);
|
|
3688
3688
|
return;
|
|
3689
3689
|
}
|
|
3690
|
-
|
|
3690
|
+
ye([]), q.reportEvent({
|
|
3691
3691
|
action: "submit",
|
|
3692
3692
|
component: "SubmitButton"
|
|
3693
3693
|
});
|
|
@@ -3699,8 +3699,8 @@ function ks({
|
|
|
3699
3699
|
(qt = C.current) == null || qt.call(C, Dt.type, Dt.message);
|
|
3700
3700
|
} catch (Xe) {
|
|
3701
3701
|
if (!z.current) return;
|
|
3702
|
-
const
|
|
3703
|
-
(Lt = C.current) == null || Lt.call(C, "error",
|
|
3702
|
+
const ve = Xe instanceof Error ? Xe.message : "提交失败";
|
|
3703
|
+
(Lt = C.current) == null || Lt.call(C, "error", ve);
|
|
3704
3704
|
} finally {
|
|
3705
3705
|
z.current && M(!1);
|
|
3706
3706
|
}
|
|
@@ -3709,10 +3709,10 @@ function ks({
|
|
|
3709
3709
|
v,
|
|
3710
3710
|
X,
|
|
3711
3711
|
R,
|
|
3712
|
-
ue,
|
|
3713
3712
|
me,
|
|
3713
|
+
de,
|
|
3714
3714
|
I,
|
|
3715
|
-
|
|
3715
|
+
ye,
|
|
3716
3716
|
q,
|
|
3717
3717
|
o,
|
|
3718
3718
|
r,
|
|
@@ -3769,12 +3769,12 @@ function ks({
|
|
|
3769
3769
|
ref: _,
|
|
3770
3770
|
"data-ask-user-message-id": Y || void 0,
|
|
3771
3771
|
children: [
|
|
3772
|
-
g && $ ? /* @__PURE__ */ c("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ c(
|
|
3772
|
+
g && $ ? /* @__PURE__ */ c("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ c(ge, { title: $, children: /* @__PURE__ */ c(be, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) }) : null,
|
|
3773
3773
|
/* @__PURE__ */ c(
|
|
3774
3774
|
os,
|
|
3775
3775
|
{
|
|
3776
3776
|
ref: N,
|
|
3777
|
-
doc:
|
|
3777
|
+
doc: pe,
|
|
3778
3778
|
surfaceId: We,
|
|
3779
3779
|
fieldNames: X,
|
|
3780
3780
|
interactive: !0,
|
|
@@ -3784,11 +3784,11 @@ function ks({
|
|
|
3784
3784
|
}
|
|
3785
3785
|
),
|
|
3786
3786
|
/* @__PURE__ */ c("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ c(
|
|
3787
|
-
|
|
3787
|
+
ge,
|
|
3788
3788
|
{
|
|
3789
3789
|
title: o === "post" ? "提交 JSON 到 callback_url" : "提交到 answer_agent_callback_url",
|
|
3790
3790
|
children: /* @__PURE__ */ c(
|
|
3791
|
-
|
|
3791
|
+
Me,
|
|
3792
3792
|
{
|
|
3793
3793
|
type: "primary",
|
|
3794
3794
|
size: "small",
|
|
@@ -3828,7 +3828,7 @@ function $s(e) {
|
|
|
3828
3828
|
};
|
|
3829
3829
|
}, [l]), B(() => {
|
|
3830
3830
|
!l || !r || l.connect();
|
|
3831
|
-
}, [l, r]), /* @__PURE__ */ c(
|
|
3831
|
+
}, [l, r]), /* @__PURE__ */ c(_e, { children: /* @__PURE__ */ c(oo, { client: l, children: /* @__PURE__ */ c(eo, { children: /* @__PURE__ */ c(
|
|
3832
3832
|
ks,
|
|
3833
3833
|
{
|
|
3834
3834
|
...e,
|
|
@@ -3853,7 +3853,7 @@ export {
|
|
|
3853
3853
|
hr as FORM_WEB_MIN_HEIGHT,
|
|
3854
3854
|
pt as ResumeSearchProvider,
|
|
3855
3855
|
js as SkoponA2uiStreamRenderer,
|
|
3856
|
-
|
|
3856
|
+
_e as SkoponFormProvider,
|
|
3857
3857
|
os as SkoponFormRenderer,
|
|
3858
3858
|
Go as a2uiToBlocks,
|
|
3859
3859
|
Mn as blocksToA2ui,
|
|
@@ -3864,7 +3864,7 @@ export {
|
|
|
3864
3864
|
Bs as buildAskUserSubmitCurlFromPayload,
|
|
3865
3865
|
Xo as buildAskUserSurface,
|
|
3866
3866
|
Un as buildCurlStatement,
|
|
3867
|
-
|
|
3867
|
+
Ee as coerceToggleValue,
|
|
3868
3868
|
qs as copyTextToClipboard,
|
|
3869
3869
|
Ni as createCaseSearchClient,
|
|
3870
3870
|
zs as createEmptyBlock,
|
|
@@ -3872,7 +3872,7 @@ export {
|
|
|
3872
3872
|
yi as createFormClient,
|
|
3873
3873
|
_i as createResumeSearchClient,
|
|
3874
3874
|
Vs as createSkoponSdkClients,
|
|
3875
|
-
|
|
3875
|
+
Le as extractExtraBlockValues,
|
|
3876
3876
|
Zo as extractSurfaceValues,
|
|
3877
3877
|
zn as formatAnswerAgentSubmitMessage,
|
|
3878
3878
|
ai as getPayloadHiddenBlockValues,
|
|
@@ -3883,14 +3883,14 @@ export {
|
|
|
3883
3883
|
mn as isDisplayBlockType,
|
|
3884
3884
|
Z as isInputBlockType,
|
|
3885
3885
|
un as isLayoutBlockType,
|
|
3886
|
-
|
|
3886
|
+
Se as isMediaBlockType,
|
|
3887
3887
|
dn as isOptionsBlockType,
|
|
3888
3888
|
yr as isSupportedWebUrl,
|
|
3889
|
-
|
|
3889
|
+
ke as isWebBlockType,
|
|
3890
3890
|
Qo as mapFormDefinitionFromDto,
|
|
3891
3891
|
Ve as normalizeFormDefinition,
|
|
3892
|
-
|
|
3893
|
-
|
|
3892
|
+
fe as normalizeMultiselectCount,
|
|
3893
|
+
Ne as normalizeWebHeight,
|
|
3894
3894
|
$e as parsePayloadBlocksJson,
|
|
3895
3895
|
ii as payloadHasInputBlocks,
|
|
3896
3896
|
hi as resolveAnswerAgentCallbackUrl,
|
|
@@ -3906,7 +3906,7 @@ export {
|
|
|
3906
3906
|
Rn as submitFormJson,
|
|
3907
3907
|
ws as supportsDefaultValue,
|
|
3908
3908
|
Jo as surfaceDocToMessages,
|
|
3909
|
-
|
|
3909
|
+
Ce as syncFormDefinition,
|
|
3910
3910
|
ao as useCaseSearch,
|
|
3911
3911
|
vo as useResumeSearch,
|
|
3912
3912
|
Ut as validateAnswerAgentBody,
|
package/package.json
CHANGED
|
@@ -137,6 +137,31 @@ describe('a2uiAdapter blocks <-> surface', () => {
|
|
|
137
137
|
expect(back.blocks[0]?.options).toEqual([{ value: '0', label: '123' }])
|
|
138
138
|
})
|
|
139
139
|
|
|
140
|
+
it('sanitizes untrusted FormBlock options while building an A2UI document', () => {
|
|
141
|
+
const doc = blocksToA2ui(
|
|
142
|
+
{
|
|
143
|
+
title: '',
|
|
144
|
+
description: '',
|
|
145
|
+
blocks: [
|
|
146
|
+
{
|
|
147
|
+
id: 'choice',
|
|
148
|
+
type: 'select',
|
|
149
|
+
name: 'choice',
|
|
150
|
+
options: [
|
|
151
|
+
{ value: 0, label: 123 },
|
|
152
|
+
{ value: {}, label: '异常' },
|
|
153
|
+
] as never,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
{ includeHeader: false },
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
expect(doc.components.find((component) => component.id === 'choice')?.options).toEqual([
|
|
161
|
+
{ value: '0', label: '123' },
|
|
162
|
+
])
|
|
163
|
+
})
|
|
164
|
+
|
|
140
165
|
it('blocksToA2ui emits SkoponMedia for image blocks', () => {
|
|
141
166
|
const doc = blocksToA2ui(makeDefinition(), { includeHeader: false })
|
|
142
167
|
const imgNode = doc.components.find((c) => c.id === 'b-img')
|
|
@@ -127,7 +127,7 @@ function blockToComponent(block: FormBlock): {
|
|
|
127
127
|
const label = block.label ?? ''
|
|
128
128
|
const name = block.name?.trim() || ''
|
|
129
129
|
const path = name ? pathFor(name) : undefined
|
|
130
|
-
const options = (block.options
|
|
130
|
+
const options = normalizeFormOptions(block.options)
|
|
131
131
|
|
|
132
132
|
const withData = (node: A2uiComponentNode): {
|
|
133
133
|
node: A2uiComponentNode
|
|
@@ -221,7 +221,7 @@ function normalizeBlock(raw: FormBlock): FormBlock {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
function getOptionValueSet(block: FormBlock): Set<string> {
|
|
224
|
-
return new Set((block.options
|
|
224
|
+
return new Set(normalizeFormOptions(block.options).map((opt) => opt.value))
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
function buildMultiselectCountJsonSchema(
|
|
@@ -292,13 +292,13 @@ function blockToJsonSchemaProperty(block: FormBlock): Record<string, unknown> |
|
|
|
292
292
|
case 'select':
|
|
293
293
|
case 'radio': {
|
|
294
294
|
property = { type: 'string' }
|
|
295
|
-
const enumValues = (block.options
|
|
295
|
+
const enumValues = normalizeFormOptions(block.options).map((opt) => opt.value)
|
|
296
296
|
if (enumValues.length > 0) property.enum = enumValues
|
|
297
297
|
break
|
|
298
298
|
}
|
|
299
299
|
case 'multiselect':
|
|
300
300
|
case 'checkbox': {
|
|
301
|
-
const enumValues = (block.options
|
|
301
|
+
const enumValues = normalizeFormOptions(block.options).map((opt) => opt.value)
|
|
302
302
|
property = {
|
|
303
303
|
type: 'array',
|
|
304
304
|
items:
|