@skopon-cool/form-sdk 0.1.3 → 0.1.5
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/README.md +2 -0
- package/dist/adapter/a2uiAdapter.d.ts +0 -1
- package/dist/adapter/a2uiAdapter.d.ts.map +1 -1
- package/dist/adapter/formSchema.d.ts.map +1 -1
- package/dist/blocks/case_multiselect/adapter.d.ts +10 -0
- package/dist/blocks/case_multiselect/adapter.d.ts.map +1 -0
- package/dist/blocks/case_multiselect/index.d.ts +3 -0
- package/dist/blocks/case_multiselect/index.d.ts.map +1 -0
- package/dist/blocks/case_singleselect/catalog.d.ts +2 -0
- package/dist/blocks/case_singleselect/catalog.d.ts.map +1 -0
- package/dist/blocks/registry.d.ts +8 -0
- package/dist/blocks/registry.d.ts.map +1 -0
- package/dist/blocks/resume_multiselect/adapter.d.ts +10 -0
- package/dist/blocks/resume_multiselect/adapter.d.ts.map +1 -0
- package/dist/blocks/resume_multiselect/catalog.d.ts +2 -0
- package/dist/blocks/resume_multiselect/catalog.d.ts.map +1 -0
- package/dist/blocks/resume_multiselect/index.d.ts +3 -0
- package/dist/blocks/resume_multiselect/index.d.ts.map +1 -0
- package/dist/blocks/types.d.ts +27 -0
- package/dist/blocks/types.d.ts.map +1 -0
- package/dist/catalog/a2uiCustomCatalog.d.ts.map +1 -1
- package/dist/catalog/caseSearchContext.d.ts +28 -0
- package/dist/catalog/caseSearchContext.d.ts.map +1 -0
- package/dist/catalog/resumeSearchContext.d.ts +39 -0
- package/dist/catalog/resumeSearchContext.d.ts.map +1 -0
- package/dist/catalog/skoponCaseSelect.d.ts +2 -0
- package/dist/catalog/skoponCaseSelect.d.ts.map +1 -0
- package/dist/catalog/skoponResumeSelect.d.ts +2 -0
- package/dist/catalog/skoponResumeSelect.d.ts.map +1 -0
- package/dist/components/AskUserFormCard.d.ts +7 -1
- package/dist/components/AskUserFormCard.d.ts.map +1 -1
- package/dist/components/SkoponA2uiStreamRenderer.d.ts +7 -1
- package/dist/components/SkoponA2uiStreamRenderer.d.ts.map +1 -1
- package/dist/components/SkoponFormRenderer.d.ts +6 -0
- package/dist/components/SkoponFormRenderer.d.ts.map +1 -1
- package/dist/form-sdk.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1374 -889
- package/dist/submit/buildCurlStatement.d.ts +1 -1
- package/dist/submit/buildCurlStatement.d.ts.map +1 -1
- package/dist/submit/intersectPayloadBlocksWithForm.d.ts.map +1 -1
- package/dist/types/index.d.ts +33 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapter/a2uiAdapter.test.ts +71 -0
- package/src/adapter/a2uiAdapter.ts +41 -4
- package/src/adapter/formSchema.ts +102 -19
- package/src/blocks/case_multiselect/adapter.ts +90 -0
- package/src/blocks/case_multiselect/index.ts +14 -0
- package/src/blocks/case_singleselect/catalog.ts +1 -0
- package/src/blocks/registry.ts +34 -0
- package/src/blocks/resume_multiselect/adapter.ts +57 -0
- package/src/blocks/resume_multiselect/catalog.ts +1 -0
- package/src/blocks/resume_multiselect/index.ts +14 -0
- package/src/blocks/types.ts +34 -0
- package/src/catalog/a2uiCustomCatalog.tsx +6 -0
- package/src/catalog/caseSearchContext.tsx +46 -0
- package/src/catalog/resumeSearchContext.tsx +58 -0
- package/src/catalog/skoponCaseSelect.tsx +240 -0
- package/src/catalog/skoponResumeSelect.tsx +293 -0
- package/src/components/AskUserFormCard.tsx +13 -1
- package/src/components/SkoponA2uiStreamRenderer.test.ts +18 -2
- package/src/components/SkoponA2uiStreamRenderer.test.tsx +26 -2
- package/src/components/SkoponA2uiStreamRenderer.tsx +71 -27
- package/src/components/SkoponFormRenderer.tsx +32 -10
- package/src/index.ts +23 -0
- package/src/styles/a2ui-preview.css +4 -4
- package/src/styles/index.css +191 -0
- package/src/submit/buildCurlStatement.ts +2 -23
- package/src/submit/intersectPayloadBlocksWithForm.ts +14 -2
- package/src/submit/submit.test.ts +34 -3
- package/src/types/index.ts +37 -0
package/dist/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import './form-sdk.css';
|
|
2
|
-
import { jsx as s, jsxs as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
const
|
|
2
|
+
import { jsx as s, jsxs as x, Fragment as De } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as Pe, useContext as Ee, useCallback as W, useSyncExternalStore as ht, useMemo as O, useState as E, useRef as B, useEffect as V, forwardRef as gt, useImperativeHandle as yt } from "react";
|
|
4
|
+
import { Spin as Ue, Button as ue, Typography as L, Avatar as vt, Tag as Z, Select as Ce, Checkbox as bt, Radio as St, Switch as kt, TimePicker as xt, DatePicker as At, Upload as ge, Input as ye, InputNumber as Tt, Tooltip as ie } from "antd";
|
|
5
|
+
import { ReloadOutlined as Ke, FileTextOutlined as Je, UserOutlined as Ct, FileImageOutlined as It, FileExcelOutlined as Nt, FileOutlined as He, PictureOutlined as Ft, SoundOutlined as Mt, VideoCameraOutlined as Pt } from "@ant-design/icons";
|
|
6
|
+
import { createBinderlessComponentImplementation as z, basicCatalog as le, A2uiSurface as Ye } from "@a2ui/react/v0_9";
|
|
7
|
+
import { z as d } from "zod";
|
|
8
|
+
import { Catalog as Et, MessageProcessor as Xe } from "@a2ui/web_core/v0_9";
|
|
9
|
+
import { injectBasicCatalogStyles as Ge } from "@a2ui/web_core/v0_9/basic_catalog";
|
|
10
|
+
import { injectStyles as We } from "@a2ui/react/styles";
|
|
11
|
+
import qe from "dayjs";
|
|
12
|
+
const Gr = "v0.9", Ut = [
|
|
13
13
|
"huge",
|
|
14
14
|
"large",
|
|
15
15
|
"medium",
|
|
16
16
|
"small",
|
|
17
17
|
"icon"
|
|
18
18
|
];
|
|
19
|
-
function
|
|
19
|
+
function Ie(e) {
|
|
20
20
|
return e === "image" || e === "video" || e === "audio";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function _e(e) {
|
|
23
23
|
return e === "heading" || e === "paragraph";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return !
|
|
25
|
+
function J(e) {
|
|
26
|
+
return !_e(e) && !Ie(e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function _t() {
|
|
29
29
|
if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
|
|
30
30
|
return crypto.randomUUID();
|
|
31
31
|
if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") {
|
|
32
32
|
const e = new Uint8Array(16);
|
|
33
33
|
crypto.getRandomValues(e), e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
34
|
-
const t = Array.from(e, (
|
|
34
|
+
const t = Array.from(e, (n) => n.toString(16).padStart(2, "0")).join("");
|
|
35
35
|
return `${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20)}`;
|
|
36
36
|
}
|
|
37
37
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
@@ -39,11 +39,11 @@ function vt() {
|
|
|
39
39
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const t =
|
|
42
|
+
function ee(e) {
|
|
43
|
+
const t = _t().replace(/-/g, "").slice(0, 8);
|
|
44
44
|
return `${e}${t}`;
|
|
45
45
|
}
|
|
46
|
-
const
|
|
46
|
+
const Ze = [
|
|
47
47
|
{ value: "image/*", label: "图片" },
|
|
48
48
|
{ value: "video/*", label: "视频" },
|
|
49
49
|
{ value: "audio/*", label: "音频" },
|
|
@@ -54,7 +54,7 @@ const Ve = [
|
|
|
54
54
|
{ value: "text/plain", label: "纯文本" },
|
|
55
55
|
{ value: "application/zip", label: "ZIP 压缩包" },
|
|
56
56
|
{ value: "application/x-rar-compressed", label: "RAR 压缩包" }
|
|
57
|
-
],
|
|
57
|
+
], zt = {
|
|
58
58
|
"image/*": ["image/*"],
|
|
59
59
|
"video/*": ["video/*"],
|
|
60
60
|
"audio/*": ["audio/*"],
|
|
@@ -74,7 +74,7 @@ const Ve = [
|
|
|
74
74
|
"text/plain": ["text/plain"],
|
|
75
75
|
"application/zip": ["application/zip"],
|
|
76
76
|
"application/x-rar-compressed": ["application/x-rar-compressed"]
|
|
77
|
-
},
|
|
77
|
+
}, Rt = {
|
|
78
78
|
"image/*": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"],
|
|
79
79
|
"video/*": [".mp4", ".mov", ".avi", ".webm"],
|
|
80
80
|
"audio/*": [".mp3", ".wav", ".ogg", ".m4a"],
|
|
@@ -85,14 +85,14 @@ const Ve = [
|
|
|
85
85
|
"text/plain": [".txt"],
|
|
86
86
|
"application/zip": [".zip", ".7z"],
|
|
87
87
|
"application/x-rar-compressed": [".rar"]
|
|
88
|
-
},
|
|
88
|
+
}, wt = {
|
|
89
89
|
"application/msword": "office/word",
|
|
90
90
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "office/word",
|
|
91
91
|
"application/vnd.ms-excel": "office/excel",
|
|
92
92
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "office/excel",
|
|
93
93
|
"application/vnd.ms-powerpoint": "office/ppt",
|
|
94
94
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "office/ppt"
|
|
95
|
-
},
|
|
95
|
+
}, ze = [
|
|
96
96
|
{ value: ".jpg", label: ".jpg" },
|
|
97
97
|
{ value: ".jpeg", label: ".jpeg" },
|
|
98
98
|
{ value: ".png", label: ".png" },
|
|
@@ -118,144 +118,166 @@ const Ve = [
|
|
|
118
118
|
{ value: ".zip", label: ".zip" },
|
|
119
119
|
{ value: ".rar", label: ".rar" },
|
|
120
120
|
{ value: ".7z", label: ".7z" }
|
|
121
|
-
],
|
|
122
|
-
|
|
123
|
-
),
|
|
124
|
-
|
|
125
|
-
),
|
|
126
|
-
|
|
121
|
+
], Ot = Object.fromEntries(
|
|
122
|
+
Ze.map((e) => [e.value, e.label])
|
|
123
|
+
), Bt = Object.fromEntries(
|
|
124
|
+
ze.map((e) => [e.value, e.label])
|
|
125
|
+
), Vt = new Set(Ze.map((e) => e.value)), qt = new Set(
|
|
126
|
+
ze.map((e) => e.value)
|
|
127
127
|
);
|
|
128
|
-
function
|
|
128
|
+
function jt(e) {
|
|
129
129
|
const t = e.trim();
|
|
130
|
-
return t ?
|
|
130
|
+
return t ? Vt.has(t) ? t : wt[t] ?? null : null;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Lt(e) {
|
|
133
133
|
return Array.isArray(e) ? e.map((t) => {
|
|
134
|
-
const
|
|
135
|
-
return
|
|
134
|
+
const n = t.trim().toLowerCase();
|
|
135
|
+
return n ? n.startsWith(".") ? n : `.${n}` : "";
|
|
136
136
|
}).filter(Boolean) : [];
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function te(e) {
|
|
139
139
|
if (!Array.isArray(e)) return [];
|
|
140
|
-
const t = [],
|
|
141
|
-
for (const
|
|
142
|
-
const o =
|
|
143
|
-
o && !
|
|
140
|
+
const t = [], n = /* @__PURE__ */ new Set();
|
|
141
|
+
for (const r of e) {
|
|
142
|
+
const o = jt(r);
|
|
143
|
+
o && !n.has(o) && (n.add(o), t.push(o));
|
|
144
144
|
}
|
|
145
145
|
return t;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const t =
|
|
149
|
-
for (const
|
|
150
|
-
|
|
151
|
-
return
|
|
147
|
+
function $t(e) {
|
|
148
|
+
const t = te(e), n = [];
|
|
149
|
+
for (const r of t)
|
|
150
|
+
n.push(...zt[r] ?? [r]);
|
|
151
|
+
return n;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const t =
|
|
153
|
+
function Dt(e) {
|
|
154
|
+
const t = te(e);
|
|
155
155
|
if (t.length === 0) return [];
|
|
156
|
-
const
|
|
157
|
-
for (const
|
|
158
|
-
for (const o of
|
|
159
|
-
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
156
|
+
const n = /* @__PURE__ */ new Set();
|
|
157
|
+
for (const r of t)
|
|
158
|
+
for (const o of Rt[r] ?? [])
|
|
159
|
+
n.add(o);
|
|
160
|
+
return ze.filter((r) => n.has(r.value));
|
|
161
|
+
}
|
|
162
|
+
function Re(e, t) {
|
|
163
|
+
const n = Lt(t), r = te(e);
|
|
164
|
+
if (r.length === 0)
|
|
165
|
+
return n.filter((a) => qt.has(a));
|
|
166
166
|
const o = new Set(
|
|
167
|
-
|
|
167
|
+
Dt(r).map((a) => a.value)
|
|
168
168
|
);
|
|
169
|
-
return
|
|
169
|
+
return n.filter((a) => o.has(a));
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
171
|
+
function Kt(e, t) {
|
|
172
|
+
const n = $t(e), r = Re(e, t), o = [...n, ...r];
|
|
173
173
|
return o.length > 0 ? o.join(",") : void 0;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
|
|
175
|
+
function Jt(e, t) {
|
|
176
|
+
const n = te(e), r = Re(
|
|
177
|
+
n,
|
|
178
178
|
t
|
|
179
179
|
), o = [
|
|
180
|
-
...
|
|
181
|
-
...
|
|
180
|
+
...n.map((a) => Ot[a] ?? a),
|
|
181
|
+
...r.map((a) => Bt[a] ?? a)
|
|
182
182
|
];
|
|
183
183
|
return o.length === 0 ? null : o.join("、");
|
|
184
184
|
}
|
|
185
|
-
const
|
|
185
|
+
const Ht = [
|
|
186
186
|
"video",
|
|
187
187
|
"audio",
|
|
188
188
|
"image",
|
|
189
189
|
"file",
|
|
190
190
|
"spreadsheet",
|
|
191
191
|
"document"
|
|
192
|
-
],
|
|
193
|
-
function
|
|
194
|
-
return e &&
|
|
192
|
+
], Yt = new Set(Ht);
|
|
193
|
+
function Xt(e) {
|
|
194
|
+
return e && Yt.has(e) ? e : "file";
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
return typeof e == "string" &&
|
|
196
|
+
function ne(e) {
|
|
197
|
+
return typeof e == "string" && Ut.includes(e) ? e : "medium";
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Gt(e, t) {
|
|
200
200
|
var o;
|
|
201
|
-
const
|
|
202
|
-
let
|
|
203
|
-
return Array.isArray(e.mediaUrls) ?
|
|
201
|
+
const n = Math.max(1, t);
|
|
202
|
+
let r = [];
|
|
203
|
+
return Array.isArray(e.mediaUrls) ? r = e.mediaUrls.map((a) => String(a).trim()) : (o = e.mediaUrl) != null && o.trim() && (r = [e.mediaUrl.trim()]), r.length === 0 ? [""] : r.slice(0, n);
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Wt(e) {
|
|
206
206
|
var t;
|
|
207
|
-
return Array.isArray(e.mediaUrls) ? e.mediaUrls.map((
|
|
207
|
+
return Array.isArray(e.mediaUrls) ? e.mediaUrls.map((n) => n.trim()).filter(Boolean) : (t = e.mediaUrl) != null && t.trim() ? [e.mediaUrl.trim()] : [];
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return `form-media-size-${
|
|
209
|
+
function Zt(e) {
|
|
210
|
+
return `form-media-size-${ne(e)}`;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
return `form-media-preview form-media-list ${
|
|
212
|
+
function Qt(e) {
|
|
213
|
+
return `form-media-preview form-media-list ${Zt(e)}`;
|
|
214
214
|
}
|
|
215
|
-
const
|
|
216
|
-
function
|
|
215
|
+
const en = 10;
|
|
216
|
+
function we(e) {
|
|
217
217
|
return e === !0 || e === "true";
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
const
|
|
221
|
-
return Number.isFinite(
|
|
219
|
+
function je(e, t = 1) {
|
|
220
|
+
const n = typeof e == "number" ? e : Number(e);
|
|
221
|
+
return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : t;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function tn(e, t) {
|
|
224
224
|
if (t !== void 0)
|
|
225
|
-
return e === "toggle" ?
|
|
225
|
+
return e === "toggle" ? we(t) : e === "multiselect" || e === "checkbox" || e === "resume_multiselect" || e === "case_multiselect" ? Array.isArray(t) ? t.map(String) : typeof t == "string" && t ? [t] : [] : typeof t == "boolean" ? t ? "true" : "false" : Array.isArray(t) ? t.map(String) : String(t);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
function nn(e) {
|
|
228
|
+
const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20, r = typeof (e == null ? void 0 : e.agentKind) == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, o = typeof (e == null ? void 0 : e.agentUniqueId) == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, a = typeof (e == null ? void 0 : e.flowType) == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, l = typeof (e == null ? void 0 : e.category) == "string" && e.category.trim() ? e.category.trim() : void 0, i = Array.isArray(e == null ? void 0 : e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
|
|
229
|
+
return { agentKind: r, agentUniqueId: o, flowType: a, category: l, flowUniqueIds: i, pageSize: n };
|
|
230
|
+
}
|
|
231
|
+
function rn(e) {
|
|
232
|
+
const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20;
|
|
233
|
+
return {
|
|
234
|
+
names: Array.isArray(e == null ? void 0 : e.names) ? e.names.map(String).filter(Boolean) : [],
|
|
235
|
+
agentUniqueIds: Array.isArray(e == null ? void 0 : e.agentUniqueIds) ? e.agentUniqueIds.map(String).filter(Boolean) : [],
|
|
236
|
+
resumeUniqueIds: Array.isArray(e == null ? void 0 : e.resumeUniqueIds) ? e.resumeUniqueIds.map(String).filter(Boolean) : [],
|
|
237
|
+
pageSize: n
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function on(e) {
|
|
241
|
+
if (e.type !== "case_singleselect") return e;
|
|
242
|
+
const t = typeof e.defaultValue == "string" && e.defaultValue.trim() ? [e.defaultValue.trim()] : Array.isArray(e.defaultValue) ? e.defaultValue.map(String).filter(Boolean) : [];
|
|
243
|
+
return { ...e, type: "case_multiselect", defaultValue: t };
|
|
244
|
+
}
|
|
245
|
+
function an(e) {
|
|
246
|
+
var o, a;
|
|
247
|
+
const t = on(e), n = te(t.fileAcceptTypes), r = t.type;
|
|
230
248
|
return {
|
|
231
|
-
id: ((
|
|
249
|
+
id: ((o = t.id) == null ? void 0 : o.trim()) || ee("block-"),
|
|
232
250
|
type: r,
|
|
233
|
-
name: ((
|
|
234
|
-
label:
|
|
235
|
-
placeholder:
|
|
236
|
-
help:
|
|
237
|
-
required:
|
|
238
|
-
mediaUrls:
|
|
239
|
-
mediaSize:
|
|
240
|
-
fileAcceptTypes:
|
|
241
|
-
fileAcceptExtensions:
|
|
242
|
-
|
|
243
|
-
|
|
251
|
+
name: ((a = t.name) == null ? void 0 : a.trim()) || void 0,
|
|
252
|
+
label: t.label ?? "",
|
|
253
|
+
placeholder: t.placeholder ?? "",
|
|
254
|
+
help: t.help ?? "",
|
|
255
|
+
required: t.required === !0,
|
|
256
|
+
mediaUrls: Ie(r) ? Gt(t, en) : void 0,
|
|
257
|
+
mediaSize: Ie(r) ? ne(t.mediaSize) : void 0,
|
|
258
|
+
fileAcceptTypes: n,
|
|
259
|
+
fileAcceptExtensions: Re(
|
|
260
|
+
n,
|
|
261
|
+
t.fileAcceptExtensions
|
|
244
262
|
),
|
|
245
|
-
filePlaceholderIcon:
|
|
246
|
-
fileMinCount: r === "file" ?
|
|
247
|
-
fileMaxCount: r === "file" ?
|
|
248
|
-
defaultValue:
|
|
249
|
-
options: Array.isArray(
|
|
250
|
-
var
|
|
263
|
+
filePlaceholderIcon: Xt(t.filePlaceholderIcon),
|
|
264
|
+
fileMinCount: r === "file" ? je(t.fileMinCount, 1) : void 0,
|
|
265
|
+
fileMaxCount: r === "file" ? je(t.fileMaxCount, 1) : void 0,
|
|
266
|
+
defaultValue: tn(r, t.defaultValue),
|
|
267
|
+
options: Array.isArray(t.options) ? t.options.map((l, i) => {
|
|
268
|
+
var c, u;
|
|
251
269
|
return {
|
|
252
|
-
value: ((
|
|
253
|
-
label: ((
|
|
270
|
+
value: ((c = l.value) == null ? void 0 : c.trim()) || `option_${i + 1}`,
|
|
271
|
+
label: ((u = l.label) == null ? void 0 : u.trim()) || `选项 ${i + 1}`
|
|
254
272
|
};
|
|
255
|
-
}) : void 0
|
|
273
|
+
}) : void 0,
|
|
274
|
+
resumeEnableRefresh: r === "resume_multiselect" ? t.resumeEnableRefresh !== !1 : void 0,
|
|
275
|
+
resumeFilter: r === "resume_multiselect" ? rn(t.resumeFilter) : void 0,
|
|
276
|
+
caseEnableRefresh: r === "case_multiselect" ? t.caseEnableRefresh !== !1 : void 0,
|
|
277
|
+
caseFilter: r === "case_multiselect" ? nn(t.caseFilter) : void 0
|
|
256
278
|
};
|
|
257
279
|
}
|
|
258
|
-
function
|
|
280
|
+
function se(e) {
|
|
259
281
|
return {
|
|
260
282
|
title: e.title ?? "",
|
|
261
283
|
description: e.description ?? "",
|
|
@@ -263,176 +285,636 @@ function ee(e) {
|
|
|
263
285
|
jsonSchema: e.jsonSchema ?? {}
|
|
264
286
|
};
|
|
265
287
|
}
|
|
266
|
-
function
|
|
288
|
+
function H(e) {
|
|
267
289
|
if (!e || !Array.isArray(e.blocks))
|
|
268
|
-
return
|
|
269
|
-
const t = e.blocks.map(
|
|
270
|
-
return
|
|
290
|
+
return se({ title: "", description: "", blocks: [], jsonSchema: {} });
|
|
291
|
+
const t = e.blocks.map(an);
|
|
292
|
+
return se({
|
|
271
293
|
title: typeof e.title == "string" ? e.title : "",
|
|
272
294
|
description: typeof e.description == "string" ? e.description : "",
|
|
273
295
|
blocks: t,
|
|
274
296
|
jsonSchema: {}
|
|
275
297
|
});
|
|
276
298
|
}
|
|
277
|
-
|
|
278
|
-
|
|
299
|
+
function ln(e) {
|
|
300
|
+
const t = typeof e.pageSize == "number" ? e.pageSize : Number(e.pageSize), n = typeof e.agentKind == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, r = typeof e.agentUniqueId == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, o = typeof e.flowType == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, a = typeof e.category == "string" && e.category.trim() ? e.category.trim() : void 0, l = Array.isArray(e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
|
|
301
|
+
return {
|
|
302
|
+
agentKind: n,
|
|
303
|
+
agentUniqueId: r,
|
|
304
|
+
flowType: o,
|
|
305
|
+
category: a,
|
|
306
|
+
flowUniqueIds: l,
|
|
307
|
+
pageSize: Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function sn(e, t) {
|
|
311
|
+
var l, i, c, u, m, p;
|
|
312
|
+
const { id: n, label: r, path: o, withData: a } = t;
|
|
313
|
+
return a({
|
|
314
|
+
id: n,
|
|
315
|
+
component: "SkoponCaseSelect",
|
|
316
|
+
label: r,
|
|
317
|
+
placeholder: e.placeholder ?? "",
|
|
318
|
+
help: e.help ?? "",
|
|
319
|
+
enableRefresh: e.caseEnableRefresh !== !1,
|
|
320
|
+
caseFilter: {
|
|
321
|
+
agentKind: (l = e.caseFilter) == null ? void 0 : l.agentKind,
|
|
322
|
+
agentUniqueId: (i = e.caseFilter) == null ? void 0 : i.agentUniqueId,
|
|
323
|
+
flowType: (c = e.caseFilter) == null ? void 0 : c.flowType,
|
|
324
|
+
category: (u = e.caseFilter) == null ? void 0 : u.category,
|
|
325
|
+
flowUniqueIds: ((m = e.caseFilter) == null ? void 0 : m.flowUniqueIds) ?? [],
|
|
326
|
+
pageSize: ((p = e.caseFilter) == null ? void 0 : p.pageSize) ?? 20
|
|
327
|
+
},
|
|
328
|
+
value: { path: o }
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
function cn(e, t, n) {
|
|
332
|
+
const r = n.nameFromValue(e.value), o = {
|
|
333
|
+
...t("case_multiselect"),
|
|
334
|
+
name: r,
|
|
335
|
+
caseEnableRefresh: e.enableRefresh !== !1
|
|
336
|
+
}, a = n.asLiteral(e.placeholder);
|
|
337
|
+
a && (o.placeholder = a);
|
|
338
|
+
const l = n.asLiteral(e.help);
|
|
339
|
+
return l && (o.help = l), e.caseFilter && typeof e.caseFilter == "object" && (o.caseFilter = ln(e.caseFilter)), o;
|
|
340
|
+
}
|
|
341
|
+
const Qe = Pe({ interactive: !0 });
|
|
342
|
+
function et({
|
|
343
|
+
interactive: e,
|
|
344
|
+
children: t
|
|
345
|
+
}) {
|
|
346
|
+
return /* @__PURE__ */ s(Qe.Provider, { value: { interactive: e }, children: t });
|
|
347
|
+
}
|
|
348
|
+
function $() {
|
|
349
|
+
return Ee(Qe);
|
|
350
|
+
}
|
|
351
|
+
function tt(e) {
|
|
352
|
+
return e && typeof e == "object" && "path" in e && String(e.path ?? "").trim() || null;
|
|
353
|
+
}
|
|
354
|
+
function Le(e, t = "value") {
|
|
355
|
+
const r = e.componentModel.properties[t];
|
|
356
|
+
if (!(!tt(r) || r === void 0))
|
|
357
|
+
return e.dataContext.resolveDynamicValue(r);
|
|
358
|
+
}
|
|
359
|
+
function D(e, t = "value") {
|
|
360
|
+
const r = e.componentModel.properties[t], o = tt(r), a = W(
|
|
361
|
+
(u) => {
|
|
362
|
+
if (!o || r === void 0) return () => {
|
|
363
|
+
};
|
|
364
|
+
const m = e.dataContext.subscribeDynamicValue(r, () => u());
|
|
365
|
+
return () => m.unsubscribe();
|
|
366
|
+
},
|
|
367
|
+
[e, r, o]
|
|
368
|
+
), l = W(() => {
|
|
369
|
+
if (!(!o || r === void 0))
|
|
370
|
+
return e.dataContext.resolveDynamicValue(r);
|
|
371
|
+
}, [e, r, o]), i = ht(a, l, l), c = W(
|
|
372
|
+
(u) => {
|
|
373
|
+
!o || !r || typeof r != "object" || !("path" in r) || e.dataContext.set(String(r.path), u);
|
|
374
|
+
},
|
|
375
|
+
[e, r, o]
|
|
376
|
+
);
|
|
377
|
+
return { value: i, setValue: c, hasBinding: !!o };
|
|
378
|
+
}
|
|
379
|
+
function Q(e) {
|
|
380
|
+
if (typeof e == "string") return e || void 0;
|
|
381
|
+
if (typeof e == "number") return String(e);
|
|
382
|
+
}
|
|
383
|
+
function j(e) {
|
|
384
|
+
return Array.isArray(e) ? e.map(String) : typeof e == "string" && e ? [e] : [];
|
|
385
|
+
}
|
|
386
|
+
const nt = Pe(null);
|
|
387
|
+
function rt({
|
|
388
|
+
caseSearch: e,
|
|
389
|
+
children: t
|
|
390
|
+
}) {
|
|
391
|
+
return /* @__PURE__ */ s(nt.Provider, { value: e ?? null, children: t });
|
|
392
|
+
}
|
|
393
|
+
function un() {
|
|
394
|
+
return Ee(nt);
|
|
395
|
+
}
|
|
396
|
+
function ve(e) {
|
|
397
|
+
return typeof e == "string" ? e : "";
|
|
398
|
+
}
|
|
399
|
+
function be(e) {
|
|
400
|
+
if (!e || typeof e != "object")
|
|
401
|
+
return { flowUniqueIds: [], pageSize: 20 };
|
|
402
|
+
const t = e, n = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), r = Number.isFinite(n) && n >= 1 && n <= 100 ? Math.floor(n) : 20, o = typeof t.agentKind == "string" && t.agentKind.trim() ? t.agentKind.trim() : void 0, a = typeof t.agentUniqueId == "string" && t.agentUniqueId.trim() ? t.agentUniqueId.trim() : void 0, l = typeof t.flowType == "string" && t.flowType.trim() ? t.flowType.trim() : void 0, i = typeof t.category == "string" && t.category.trim() ? t.category.trim() : void 0, c = Array.isArray(t.flowUniqueIds) ? t.flowUniqueIds.map(String).filter(Boolean) : [];
|
|
403
|
+
return { agentKind: o, agentUniqueId: a, flowType: l, category: i, flowUniqueIds: c, pageSize: r };
|
|
404
|
+
}
|
|
405
|
+
function Se(e) {
|
|
406
|
+
var r;
|
|
407
|
+
const t = !!((r = e.flowUniqueIds) != null && r.length), n = !!(e.agentUniqueId && e.flowType && e.category);
|
|
408
|
+
return t || n;
|
|
409
|
+
}
|
|
410
|
+
function pn(e) {
|
|
411
|
+
return JSON.stringify(e);
|
|
412
|
+
}
|
|
413
|
+
const mn = {
|
|
414
|
+
name: "SkoponCaseSelect",
|
|
415
|
+
schema: d.object({
|
|
416
|
+
label: d.any().optional(),
|
|
417
|
+
placeholder: d.any().optional(),
|
|
418
|
+
help: d.any().optional(),
|
|
419
|
+
enableRefresh: d.any().optional(),
|
|
420
|
+
caseFilter: d.any().optional(),
|
|
421
|
+
value: d.any().optional()
|
|
422
|
+
}).passthrough()
|
|
423
|
+
};
|
|
424
|
+
function dn({
|
|
425
|
+
item: e,
|
|
426
|
+
selected: t,
|
|
427
|
+
disabled: n,
|
|
428
|
+
onToggle: r
|
|
429
|
+
}) {
|
|
430
|
+
return /* @__PURE__ */ x(
|
|
431
|
+
"button",
|
|
432
|
+
{
|
|
433
|
+
type: "button",
|
|
434
|
+
className: `skopon-resume-select-card${t ? " skopon-resume-select-card--selected" : ""}`,
|
|
435
|
+
disabled: n,
|
|
436
|
+
onClick: r,
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ s("div", { className: "skopon-resume-select-card-avatar", children: /* @__PURE__ */ s(Je, { style: { fontSize: 24, color: "var(--color-primary, #1677ff)" } }) }),
|
|
439
|
+
/* @__PURE__ */ x("div", { className: "skopon-resume-select-card-body", children: [
|
|
440
|
+
/* @__PURE__ */ s("div", { className: "skopon-resume-select-card-name", children: e.name }),
|
|
441
|
+
e.description ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-card-desc", children: e.description }) : null,
|
|
442
|
+
/* @__PURE__ */ x("div", { className: "skopon-resume-select-card-meta", children: [
|
|
443
|
+
e.caseUniqueId,
|
|
444
|
+
e.platform ? ` · ${e.platform}` : "",
|
|
445
|
+
e.link ? ` · ${e.link}` : ""
|
|
446
|
+
] })
|
|
447
|
+
] })
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
function fn({ context: e }) {
|
|
453
|
+
const { interactive: t } = $(), n = un(), { value: r, setValue: o } = D(e), a = e.componentModel.properties, l = ve(a.label), i = ve(a.placeholder), c = ve(a.help), u = a.enableRefresh !== !1, m = O(() => be(a.caseFilter), [a.caseFilter]), p = pn(m), [y, S] = E(1), [C, F] = E(!1), [T, f] = E(""), [h, k] = E([]), [v, b] = E(0), [P, R] = E(m.pageSize ?? 20), _ = B(0), w = j(r), q = O(() => n ? Se(m) ? T || i || "暂无匹配的案例" : "未配置案例列表筛选条件" : "未配置案例搜索服务", [n, m, T, i]), K = W(
|
|
454
|
+
async (g) => {
|
|
455
|
+
const A = be(JSON.parse(p)), M = ++_.current;
|
|
456
|
+
if (!n || !Se(A)) {
|
|
457
|
+
k([]), b(0), f("");
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
F(!0), f("");
|
|
461
|
+
try {
|
|
462
|
+
const I = await n({ filter: A, page: g });
|
|
463
|
+
if (M !== _.current) return;
|
|
464
|
+
k(I.list), b(I.total), S(I.page), R(I.pageSize);
|
|
465
|
+
} catch (I) {
|
|
466
|
+
if (M !== _.current) return;
|
|
467
|
+
k([]), b(0), f(I instanceof Error ? I.message : "加载案例列表失败");
|
|
468
|
+
} finally {
|
|
469
|
+
M === _.current && F(!1);
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
[n, p]
|
|
473
|
+
);
|
|
474
|
+
V(() => {
|
|
475
|
+
S(1), K(1);
|
|
476
|
+
}, [p, K]);
|
|
477
|
+
const Y = (g) => {
|
|
478
|
+
if (!t) return;
|
|
479
|
+
const A = w.includes(g) ? w.filter((M) => M !== g) : [...w, g];
|
|
480
|
+
o(A);
|
|
481
|
+
}, X = () => {
|
|
482
|
+
const g = be(JSON.parse(p)), A = P || g.pageSize || 20, M = Math.max(1, Math.ceil(v / A)), I = y >= M ? 1 : y + 1;
|
|
483
|
+
K(I);
|
|
484
|
+
};
|
|
485
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview skopon-resume-select", children: [
|
|
486
|
+
l ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: l }) : null,
|
|
487
|
+
C && h.length === 0 ? /* @__PURE__ */ x("div", { className: "skopon-resume-select-status", children: [
|
|
488
|
+
/* @__PURE__ */ s(Ue, { size: "small" }),
|
|
489
|
+
" 加载案例…"
|
|
490
|
+
] }) : null,
|
|
491
|
+
!C && h.length === 0 ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-empty", children: q }) : null,
|
|
492
|
+
h.length > 0 ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-list", children: h.map((g) => /* @__PURE__ */ s(
|
|
493
|
+
dn,
|
|
494
|
+
{
|
|
495
|
+
item: g,
|
|
496
|
+
selected: w.includes(g.caseUniqueId),
|
|
497
|
+
disabled: !t,
|
|
498
|
+
onToggle: () => Y(g.caseUniqueId)
|
|
499
|
+
},
|
|
500
|
+
g.caseUniqueId
|
|
501
|
+
)) }) : null,
|
|
502
|
+
u && n && Se(m) ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ s(
|
|
503
|
+
ue,
|
|
504
|
+
{
|
|
505
|
+
type: "default",
|
|
506
|
+
size: "small",
|
|
507
|
+
icon: /* @__PURE__ */ s(Ke, {}),
|
|
508
|
+
loading: C,
|
|
509
|
+
disabled: !t,
|
|
510
|
+
onClick: X,
|
|
511
|
+
children: "换一批"
|
|
512
|
+
}
|
|
513
|
+
) }) : null,
|
|
514
|
+
c ? /* @__PURE__ */ s(L.Text, { type: "secondary", className: "form-block-preview-help", children: c }) : null
|
|
515
|
+
] });
|
|
516
|
+
}
|
|
517
|
+
const hn = z(
|
|
518
|
+
mn,
|
|
519
|
+
fn
|
|
520
|
+
), gn = {
|
|
521
|
+
type: "case_multiselect",
|
|
522
|
+
componentName: "SkoponCaseSelect",
|
|
523
|
+
toComponent: sn,
|
|
524
|
+
fromComponent: cn,
|
|
525
|
+
catalogComponents: [hn]
|
|
526
|
+
};
|
|
527
|
+
function yn(e, t) {
|
|
528
|
+
var l, i, c, u;
|
|
529
|
+
const { id: n, label: r, path: o, withData: a } = t;
|
|
530
|
+
return a({
|
|
531
|
+
id: n,
|
|
532
|
+
component: "SkoponResumeSelect",
|
|
533
|
+
label: r,
|
|
534
|
+
placeholder: e.placeholder ?? "",
|
|
535
|
+
help: e.help ?? "",
|
|
536
|
+
enableRefresh: e.resumeEnableRefresh !== !1,
|
|
537
|
+
resumeFilter: {
|
|
538
|
+
names: ((l = e.resumeFilter) == null ? void 0 : l.names) ?? [],
|
|
539
|
+
agentUniqueIds: ((i = e.resumeFilter) == null ? void 0 : i.agentUniqueIds) ?? [],
|
|
540
|
+
resumeUniqueIds: ((c = e.resumeFilter) == null ? void 0 : c.resumeUniqueIds) ?? [],
|
|
541
|
+
pageSize: ((u = e.resumeFilter) == null ? void 0 : u.pageSize) ?? 20
|
|
542
|
+
},
|
|
543
|
+
value: { path: o }
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
function vn(e, t, n) {
|
|
547
|
+
const r = n.nameFromValue(e.value), o = {
|
|
548
|
+
...t("resume_multiselect"),
|
|
549
|
+
name: r,
|
|
550
|
+
resumeEnableRefresh: e.enableRefresh !== !1
|
|
551
|
+
}, a = n.asLiteral(e.placeholder);
|
|
552
|
+
a && (o.placeholder = a);
|
|
553
|
+
const l = n.asLiteral(e.help);
|
|
554
|
+
if (l && (o.help = l), e.resumeFilter && typeof e.resumeFilter == "object") {
|
|
555
|
+
const i = e.resumeFilter;
|
|
556
|
+
o.resumeFilter = {
|
|
557
|
+
names: Array.isArray(i.names) ? i.names.map(String) : [],
|
|
558
|
+
agentUniqueIds: Array.isArray(i.agentUniqueIds) ? i.agentUniqueIds.map(String) : [],
|
|
559
|
+
resumeUniqueIds: Array.isArray(i.resumeUniqueIds) ? i.resumeUniqueIds.map(String) : [],
|
|
560
|
+
pageSize: typeof i.pageSize == "number" ? i.pageSize : 20
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
return o;
|
|
564
|
+
}
|
|
565
|
+
const ot = Pe(null);
|
|
566
|
+
function at({
|
|
567
|
+
resumeSearch: e,
|
|
568
|
+
children: t
|
|
569
|
+
}) {
|
|
570
|
+
return /* @__PURE__ */ s(ot.Provider, { value: e ?? null, children: t });
|
|
571
|
+
}
|
|
572
|
+
function bn() {
|
|
573
|
+
return Ee(ot);
|
|
574
|
+
}
|
|
575
|
+
function ke(e) {
|
|
576
|
+
return typeof e == "string" ? e : "";
|
|
577
|
+
}
|
|
578
|
+
function xe(e) {
|
|
579
|
+
if (!e || typeof e != "object")
|
|
580
|
+
return { names: [], agentUniqueIds: [], resumeUniqueIds: [], pageSize: 20 };
|
|
581
|
+
const t = e, n = Array.isArray(t.names) ? t.names.map(String).filter(Boolean) : [], r = Array.isArray(t.agentUniqueIds) ? t.agentUniqueIds.map(String).filter(Boolean) : [], o = Array.isArray(t.resumeUniqueIds) ? t.resumeUniqueIds.map(String).filter(Boolean) : [], a = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), l = Number.isFinite(a) && a >= 1 && a <= 100 ? Math.floor(a) : 20;
|
|
582
|
+
return { names: n, agentUniqueIds: r, resumeUniqueIds: o, pageSize: l };
|
|
583
|
+
}
|
|
584
|
+
function Sn(e) {
|
|
585
|
+
return JSON.stringify(e);
|
|
586
|
+
}
|
|
587
|
+
const kn = {
|
|
588
|
+
name: "SkoponResumeSelect",
|
|
589
|
+
schema: d.object({
|
|
590
|
+
label: d.any().optional(),
|
|
591
|
+
placeholder: d.any().optional(),
|
|
592
|
+
help: d.any().optional(),
|
|
593
|
+
enableRefresh: d.any().optional(),
|
|
594
|
+
resumeFilter: d.any().optional(),
|
|
595
|
+
value: d.any().optional()
|
|
596
|
+
}).passthrough()
|
|
597
|
+
}, xn = 3, An = 2;
|
|
598
|
+
function Ae(e, t) {
|
|
599
|
+
const n = (t ?? []).filter(Boolean), r = n.slice(0, xn), o = n.length - r.length;
|
|
600
|
+
return /* @__PURE__ */ x("div", { className: "skopon-resume-select-card-tags", children: [
|
|
601
|
+
/* @__PURE__ */ s("span", { className: "skopon-resume-select-card-tags-label", children: e }),
|
|
602
|
+
n.length > 0 ? /* @__PURE__ */ x("div", { className: "skopon-resume-select-card-tags-list", children: [
|
|
603
|
+
r.map((a) => /* @__PURE__ */ s(Z, { className: "skopon-resume-select-card-tag", children: a }, a)),
|
|
604
|
+
o > 0 ? /* @__PURE__ */ x(Z, { className: "skopon-resume-select-card-tag", children: [
|
|
605
|
+
"+",
|
|
606
|
+
o
|
|
607
|
+
] }) : null
|
|
608
|
+
] }) : /* @__PURE__ */ s("span", { className: "skopon-resume-select-card-tags-empty", children: "暂无" })
|
|
609
|
+
] });
|
|
610
|
+
}
|
|
611
|
+
function Tn(e) {
|
|
612
|
+
return /* @__PURE__ */ x("div", { className: "skopon-resume-select-card-field", children: [
|
|
613
|
+
/* @__PURE__ */ s("span", { className: "skopon-resume-select-card-tags-label", children: "满意度" }),
|
|
614
|
+
/* @__PURE__ */ s("span", { className: "skopon-resume-select-card-field-value", children: typeof e == "number" ? `${e}%` : "暂无" })
|
|
615
|
+
] });
|
|
616
|
+
}
|
|
617
|
+
function Cn({ work: e }) {
|
|
618
|
+
return /* @__PURE__ */ x("div", { className: "skopon-resume-select-card-work", children: [
|
|
619
|
+
/* @__PURE__ */ s("div", { className: "skopon-resume-select-card-work-cover", children: e.coverUrl ? /* @__PURE__ */ s("img", { src: e.coverUrl, alt: "", className: "skopon-resume-select-card-work-img" }) : /* @__PURE__ */ s(It, { className: "skopon-resume-select-card-work-placeholder" }) }),
|
|
620
|
+
/* @__PURE__ */ s("div", { className: "skopon-resume-select-card-work-title", children: e.title || "未命名作品" })
|
|
621
|
+
] });
|
|
622
|
+
}
|
|
623
|
+
function In({
|
|
624
|
+
item: e,
|
|
625
|
+
selected: t,
|
|
626
|
+
disabled: n,
|
|
627
|
+
onToggle: r
|
|
628
|
+
}) {
|
|
629
|
+
const o = (e.works ?? []).slice(0, An);
|
|
630
|
+
return /* @__PURE__ */ x(
|
|
631
|
+
"button",
|
|
632
|
+
{
|
|
633
|
+
type: "button",
|
|
634
|
+
className: `skopon-resume-select-card skopon-resume-select-card--profile${t ? " skopon-resume-select-card--selected" : ""}`,
|
|
635
|
+
disabled: n,
|
|
636
|
+
onClick: r,
|
|
637
|
+
children: [
|
|
638
|
+
/* @__PURE__ */ s(
|
|
639
|
+
vt,
|
|
640
|
+
{
|
|
641
|
+
size: 48,
|
|
642
|
+
src: e.avatarUrl || void 0,
|
|
643
|
+
icon: e.avatarUrl ? void 0 : /* @__PURE__ */ s(Ct, {}),
|
|
644
|
+
className: "skopon-resume-select-card-avatar"
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
/* @__PURE__ */ s("div", { className: "skopon-resume-select-card-name", children: e.name || "未命名简历" }),
|
|
648
|
+
/* @__PURE__ */ x("div", { className: "skopon-resume-select-card-body", children: [
|
|
649
|
+
Tn(e.satisfaction),
|
|
650
|
+
Ae("性格", e.personality),
|
|
651
|
+
Ae("专长", e.specialties),
|
|
652
|
+
Ae("擅长领域", e.traits),
|
|
653
|
+
/* @__PURE__ */ x("div", { className: "skopon-resume-select-card-works", children: [
|
|
654
|
+
/* @__PURE__ */ s("span", { className: "skopon-resume-select-card-works-label", children: "过往作品" }),
|
|
655
|
+
o.length > 0 ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-card-works-list", children: o.map((a, l) => /* @__PURE__ */ s(Cn, { work: a }, `${a.title}-${l}`)) }) : /* @__PURE__ */ s("div", { className: "skopon-resume-select-card-works-empty", children: "暂无作品" })
|
|
656
|
+
] })
|
|
657
|
+
] })
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
function Nn({ context: e }) {
|
|
663
|
+
const { interactive: t } = $(), n = bn(), { value: r, setValue: o } = D(e), a = e.componentModel.properties, l = ke(a.label), i = ke(a.placeholder), c = ke(a.help), u = a.enableRefresh !== !1, m = O(() => xe(a.resumeFilter), [a.resumeFilter]), p = Sn(m), [y, S] = E(1), [C, F] = E(!1), [T, f] = E(""), [h, k] = E([]), [v, b] = E(0), [P, R] = E(m.pageSize ?? 20), _ = B(0), w = j(r), q = W(
|
|
664
|
+
async (g) => {
|
|
665
|
+
const A = xe(JSON.parse(p)), M = ++_.current;
|
|
666
|
+
if (!n) {
|
|
667
|
+
k([]), b(0), f("未配置简历搜索服务");
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
F(!0), f("");
|
|
671
|
+
try {
|
|
672
|
+
const I = await n({ filter: A, page: g });
|
|
673
|
+
if (M !== _.current) return;
|
|
674
|
+
k(I.list), b(I.total), S(I.page), R(I.pageSize);
|
|
675
|
+
} catch (I) {
|
|
676
|
+
if (M !== _.current) return;
|
|
677
|
+
k([]), b(0), f(I instanceof Error ? I.message : "加载简历列表失败");
|
|
678
|
+
} finally {
|
|
679
|
+
M === _.current && F(!1);
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
[n, p]
|
|
683
|
+
);
|
|
684
|
+
V(() => {
|
|
685
|
+
S(1), q(1);
|
|
686
|
+
}, [p, q]);
|
|
687
|
+
const K = (g) => {
|
|
688
|
+
if (!t) return;
|
|
689
|
+
const A = w.includes(g) ? w.filter((M) => M !== g) : [...w, g];
|
|
690
|
+
o(A);
|
|
691
|
+
}, Y = () => {
|
|
692
|
+
const g = xe(JSON.parse(p)), A = P || g.pageSize || 20, M = Math.max(1, Math.ceil(v / A)), I = y >= M ? 1 : y + 1;
|
|
693
|
+
q(I);
|
|
694
|
+
}, X = i || "暂无匹配的简历";
|
|
695
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview skopon-resume-select", children: [
|
|
696
|
+
l ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: l }) : null,
|
|
697
|
+
C && h.length === 0 ? /* @__PURE__ */ x("div", { className: "skopon-resume-select-status", children: [
|
|
698
|
+
/* @__PURE__ */ s(Ue, { size: "small" }),
|
|
699
|
+
" 加载简历…"
|
|
700
|
+
] }) : null,
|
|
701
|
+
!C && T ? /* @__PURE__ */ s(L.Text, { type: "danger", className: "skopon-resume-select-status", children: T }) : null,
|
|
702
|
+
!C && !T && h.length === 0 ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-empty", children: X }) : null,
|
|
703
|
+
h.length > 0 ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-list", children: h.map((g) => /* @__PURE__ */ s(
|
|
704
|
+
In,
|
|
705
|
+
{
|
|
706
|
+
item: g,
|
|
707
|
+
selected: w.includes(g.resumeUniqueId),
|
|
708
|
+
disabled: !t,
|
|
709
|
+
onToggle: () => K(g.resumeUniqueId)
|
|
710
|
+
},
|
|
711
|
+
g.resumeUniqueId
|
|
712
|
+
)) }) : null,
|
|
713
|
+
u && n ? /* @__PURE__ */ s("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ s(
|
|
714
|
+
ue,
|
|
715
|
+
{
|
|
716
|
+
type: "default",
|
|
717
|
+
size: "small",
|
|
718
|
+
icon: /* @__PURE__ */ s(Ke, {}),
|
|
719
|
+
loading: C,
|
|
720
|
+
disabled: !t,
|
|
721
|
+
onClick: Y,
|
|
722
|
+
children: "换一批"
|
|
723
|
+
}
|
|
724
|
+
) }) : null,
|
|
725
|
+
c ? /* @__PURE__ */ s(L.Text, { type: "secondary", className: "form-block-preview-help", children: c }) : null
|
|
726
|
+
] });
|
|
727
|
+
}
|
|
728
|
+
const Fn = z(
|
|
729
|
+
kn,
|
|
730
|
+
Nn
|
|
731
|
+
), Mn = {
|
|
732
|
+
type: "resume_multiselect",
|
|
733
|
+
componentName: "SkoponResumeSelect",
|
|
734
|
+
toComponent: yn,
|
|
735
|
+
fromComponent: vn,
|
|
736
|
+
catalogComponents: [Fn]
|
|
737
|
+
}, pe = [Mn, gn], Pn = new Map(
|
|
738
|
+
pe.map((e) => [e.type, e])
|
|
739
|
+
), En = new Map(
|
|
740
|
+
pe.map((e) => [e.componentName, e])
|
|
741
|
+
);
|
|
742
|
+
function Un(e) {
|
|
743
|
+
return Pn.get(e);
|
|
744
|
+
}
|
|
745
|
+
function _n(e) {
|
|
746
|
+
return En.get(e);
|
|
747
|
+
}
|
|
748
|
+
function zn() {
|
|
749
|
+
return pe.flatMap((e) => e.catalogComponents);
|
|
750
|
+
}
|
|
751
|
+
function Rn() {
|
|
752
|
+
return pe.map((e) => e.componentName);
|
|
753
|
+
}
|
|
754
|
+
const ce = "root", Ne = "__title__", Fe = "__desc__", lt = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
|
|
755
|
+
function wn(e) {
|
|
279
756
|
return `/${e}`;
|
|
280
757
|
}
|
|
281
|
-
function $
|
|
758
|
+
function $e(e) {
|
|
282
759
|
return e && typeof e == "object" && "path" in e ? String(e.path ?? "").replace(/^\//, "") : "";
|
|
283
760
|
}
|
|
284
|
-
function
|
|
761
|
+
function U(e) {
|
|
285
762
|
if (typeof e == "string") return e;
|
|
286
763
|
}
|
|
287
|
-
function
|
|
288
|
-
const t = e.id ||
|
|
764
|
+
function On(e) {
|
|
765
|
+
const t = e.id || ee("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
|
|
289
766
|
return {
|
|
290
767
|
id: t,
|
|
291
768
|
component: "SkoponMedia",
|
|
292
|
-
mediaType:
|
|
293
|
-
urls:
|
|
294
|
-
mediaSize:
|
|
769
|
+
mediaType: n,
|
|
770
|
+
urls: Wt(e),
|
|
771
|
+
mediaSize: ne(e.mediaSize),
|
|
295
772
|
label: e.label ?? "",
|
|
296
773
|
help: e.help ?? "",
|
|
297
774
|
placeholder: e.placeholder ?? ""
|
|
298
775
|
};
|
|
299
776
|
}
|
|
300
|
-
function
|
|
777
|
+
function Bn(e) {
|
|
301
778
|
if (Array.isArray(e.urls))
|
|
302
|
-
return e.urls.map((
|
|
303
|
-
const t =
|
|
779
|
+
return e.urls.map((n) => String(n).trim()).filter(Boolean);
|
|
780
|
+
const t = U(e.url);
|
|
304
781
|
return t != null && t.trim() ? [t.trim()] : [];
|
|
305
782
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
783
|
+
function oe(e, t, n) {
|
|
784
|
+
const r = typeof e.id == "string" ? e.id : ee("block-"), o = Bn(e), a = U(e.label) ?? U(e.description) ?? n, l = U(e.help), i = U(e.placeholder), c = ne(e.mediaSize);
|
|
308
785
|
return {
|
|
309
|
-
id:
|
|
786
|
+
id: r,
|
|
310
787
|
type: t,
|
|
311
|
-
label:
|
|
312
|
-
...
|
|
313
|
-
...
|
|
788
|
+
label: a,
|
|
789
|
+
...l ? { help: l } : {},
|
|
790
|
+
...i ? { placeholder: i } : {},
|
|
314
791
|
mediaSize: c,
|
|
315
792
|
mediaUrls: o.length > 0 ? o : [""]
|
|
316
793
|
};
|
|
317
794
|
}
|
|
318
|
-
function
|
|
795
|
+
function Vn(e) {
|
|
319
796
|
switch (e.type) {
|
|
320
797
|
case "toggle":
|
|
321
|
-
return
|
|
798
|
+
return we(e.defaultValue);
|
|
322
799
|
case "multiselect":
|
|
323
800
|
case "checkbox":
|
|
801
|
+
case "resume_multiselect":
|
|
802
|
+
case "case_multiselect":
|
|
324
803
|
return Array.isArray(e.defaultValue) ? e.defaultValue : typeof e.defaultValue == "string" && e.defaultValue ? [e.defaultValue] : [];
|
|
325
804
|
case "select":
|
|
326
805
|
case "radio":
|
|
327
|
-
|
|
806
|
+
case "number":
|
|
807
|
+
return typeof e.defaultValue == "number" || typeof e.defaultValue == "string" && e.defaultValue ? e.defaultValue : null;
|
|
328
808
|
default:
|
|
329
809
|
return typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
330
810
|
}
|
|
331
811
|
}
|
|
332
|
-
function
|
|
333
|
-
var
|
|
334
|
-
const t = e.id ||
|
|
812
|
+
function qn(e) {
|
|
813
|
+
var u;
|
|
814
|
+
const t = e.id || ee("a2-"), n = e.label ?? "", r = ((u = e.name) == null ? void 0 : u.trim()) || "", o = r ? wn(r) : void 0, a = (e.options ?? []).map((m) => ({ label: m.label, value: m.value })), l = (m) => r ? { node: m, dataKey: r, dataValue: Vn(e) } : { node: m }, i = { id: t, label: n, name: r, path: o, withData: l }, c = Un(e.type);
|
|
815
|
+
if (c)
|
|
816
|
+
return c.toComponent(e, i);
|
|
335
817
|
switch (e.type) {
|
|
336
818
|
case "heading":
|
|
337
|
-
return { node: { id: t, component: "Text", text:
|
|
819
|
+
return { node: { id: t, component: "Text", text: n, variant: "h3" } };
|
|
338
820
|
case "paragraph":
|
|
339
|
-
return { node: { id: t, component: "Text", text:
|
|
821
|
+
return { node: { id: t, component: "Text", text: n, variant: "body" } };
|
|
340
822
|
case "text":
|
|
341
823
|
case "tel":
|
|
342
824
|
case "url":
|
|
343
|
-
return
|
|
825
|
+
return l({
|
|
344
826
|
id: t,
|
|
345
827
|
component: "TextField",
|
|
346
|
-
label:
|
|
828
|
+
label: n,
|
|
347
829
|
variant: "shortText",
|
|
348
830
|
...e.placeholder ? { placeholder: e.placeholder } : {},
|
|
349
831
|
value: { path: o }
|
|
350
832
|
});
|
|
351
833
|
case "email":
|
|
352
|
-
return
|
|
834
|
+
return l({
|
|
353
835
|
id: t,
|
|
354
836
|
component: "TextField",
|
|
355
|
-
label:
|
|
837
|
+
label: n,
|
|
356
838
|
variant: "shortText",
|
|
357
|
-
validationRegexp:
|
|
839
|
+
validationRegexp: lt,
|
|
358
840
|
...e.placeholder ? { placeholder: e.placeholder } : {},
|
|
359
841
|
value: { path: o }
|
|
360
842
|
});
|
|
361
843
|
case "textarea":
|
|
362
|
-
return
|
|
844
|
+
return l({
|
|
363
845
|
id: t,
|
|
364
846
|
component: "TextField",
|
|
365
|
-
label:
|
|
847
|
+
label: n,
|
|
366
848
|
variant: "longText",
|
|
367
849
|
...e.placeholder ? { placeholder: e.placeholder } : {},
|
|
368
850
|
value: { path: o }
|
|
369
851
|
});
|
|
370
852
|
case "number":
|
|
371
|
-
return
|
|
853
|
+
return l({
|
|
372
854
|
id: t,
|
|
373
855
|
component: "TextField",
|
|
374
|
-
label:
|
|
856
|
+
label: n,
|
|
375
857
|
variant: "number",
|
|
376
858
|
...e.placeholder ? { placeholder: e.placeholder } : {},
|
|
377
859
|
value: { path: o }
|
|
378
860
|
});
|
|
379
861
|
case "select":
|
|
380
|
-
return
|
|
862
|
+
return l({
|
|
381
863
|
id: t,
|
|
382
864
|
component: "SkoponSelect",
|
|
383
|
-
label:
|
|
865
|
+
label: n,
|
|
384
866
|
mode: "single",
|
|
385
867
|
placeholder: e.placeholder ?? "",
|
|
386
|
-
options:
|
|
868
|
+
options: a,
|
|
387
869
|
value: { path: o }
|
|
388
870
|
});
|
|
389
871
|
case "radio":
|
|
390
|
-
return
|
|
872
|
+
return l({
|
|
391
873
|
id: t,
|
|
392
874
|
component: "ChoicePicker",
|
|
393
|
-
label:
|
|
875
|
+
label: n,
|
|
394
876
|
variant: "mutuallyExclusive",
|
|
395
877
|
skoponPickerType: "radio",
|
|
396
|
-
options:
|
|
878
|
+
options: a,
|
|
397
879
|
value: { path: o }
|
|
398
880
|
});
|
|
399
881
|
case "multiselect":
|
|
400
|
-
return
|
|
882
|
+
return l({
|
|
401
883
|
id: t,
|
|
402
884
|
component: "SkoponSelect",
|
|
403
|
-
label:
|
|
885
|
+
label: n,
|
|
404
886
|
mode: "multiple",
|
|
405
887
|
placeholder: e.placeholder ?? "",
|
|
406
|
-
options:
|
|
888
|
+
options: a,
|
|
407
889
|
value: { path: o }
|
|
408
890
|
});
|
|
409
891
|
case "checkbox":
|
|
410
|
-
return
|
|
892
|
+
return l({
|
|
411
893
|
id: t,
|
|
412
894
|
component: "ChoicePicker",
|
|
413
|
-
label:
|
|
895
|
+
label: n,
|
|
414
896
|
variant: "multipleSelection",
|
|
415
897
|
skoponPickerType: "checkbox",
|
|
416
|
-
options:
|
|
898
|
+
options: a,
|
|
417
899
|
value: { path: o }
|
|
418
900
|
});
|
|
419
901
|
case "toggle":
|
|
420
|
-
return
|
|
902
|
+
return l({ id: t, component: "CheckBox", label: n, value: { path: o } });
|
|
421
903
|
case "datetime":
|
|
422
|
-
return
|
|
904
|
+
return l({
|
|
423
905
|
id: t,
|
|
424
906
|
component: "DateTimeInput",
|
|
425
|
-
label:
|
|
907
|
+
label: n,
|
|
426
908
|
enableDate: !0,
|
|
427
909
|
enableTime: !0,
|
|
428
910
|
placeholder: e.placeholder ?? "",
|
|
429
911
|
value: { path: o }
|
|
430
912
|
});
|
|
431
913
|
case "time":
|
|
432
|
-
return
|
|
914
|
+
return l({
|
|
433
915
|
id: t,
|
|
434
916
|
component: "DateTimeInput",
|
|
435
|
-
label:
|
|
917
|
+
label: n,
|
|
436
918
|
enableTime: !0,
|
|
437
919
|
placeholder: e.placeholder ?? "",
|
|
438
920
|
value: { path: o }
|
|
@@ -440,12 +922,12 @@ function Yt(e) {
|
|
|
440
922
|
case "image":
|
|
441
923
|
case "video":
|
|
442
924
|
case "audio":
|
|
443
|
-
return { node:
|
|
925
|
+
return { node: On(e) };
|
|
444
926
|
case "file":
|
|
445
|
-
return
|
|
927
|
+
return l({
|
|
446
928
|
id: t,
|
|
447
929
|
component: "FileUpload",
|
|
448
|
-
label:
|
|
930
|
+
label: n,
|
|
449
931
|
accept: (e.fileAcceptExtensions ?? []).join(","),
|
|
450
932
|
fileAcceptTypes: e.fileAcceptTypes ?? [],
|
|
451
933
|
filePlaceholderIcon: e.filePlaceholderIcon ?? "document",
|
|
@@ -457,371 +939,377 @@ function Yt(e) {
|
|
|
457
939
|
return { node: null };
|
|
458
940
|
}
|
|
459
941
|
}
|
|
460
|
-
function
|
|
942
|
+
function Me(e) {
|
|
461
943
|
if (!e || !Array.isArray(e.components) || e.components.length === 0) return !0;
|
|
462
|
-
const t = e.components.find((
|
|
944
|
+
const t = e.components.find((r) => r.id === ce);
|
|
463
945
|
if (!t) return e.components.length === 0;
|
|
464
|
-
const
|
|
465
|
-
return !Array.isArray(
|
|
466
|
-
}
|
|
467
|
-
function
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
for (const
|
|
471
|
-
const { node:
|
|
472
|
-
|
|
946
|
+
const n = t.children;
|
|
947
|
+
return !Array.isArray(n) || n.length === 0;
|
|
948
|
+
}
|
|
949
|
+
function it(e, t) {
|
|
950
|
+
const n = [], r = [], o = {}, a = (t == null ? void 0 : t.includeHeader) !== !1, l = (e.title ?? "").trim(), i = (e.description ?? "").trim();
|
|
951
|
+
a && l && (n.push({ id: Ne, component: "Text", text: l, variant: "h2" }), r.push(Ne)), a && i && (n.push({ id: Fe, component: "Text", text: i, variant: "body" }), r.push(Fe));
|
|
952
|
+
for (const m of e.blocks ?? []) {
|
|
953
|
+
const { node: p, dataKey: y, dataValue: S } = qn(m);
|
|
954
|
+
p && (n.push(p), r.push(p.id), y && (o[y] = S));
|
|
473
955
|
}
|
|
474
|
-
|
|
475
|
-
const c = { root:
|
|
956
|
+
n.unshift({ id: ce, component: "Column", children: r });
|
|
957
|
+
const c = { root: ce, components: n, dataModel: o }, u = t == null ? void 0 : t.styleId;
|
|
476
958
|
return u !== void 0 && (c.surfaceProperties = { styleId: u ?? null }), c;
|
|
477
959
|
}
|
|
478
|
-
function
|
|
960
|
+
function jn(e) {
|
|
479
961
|
const t = /* @__PURE__ */ new Map();
|
|
480
|
-
for (const
|
|
481
|
-
|
|
962
|
+
for (const n of e.components ?? [])
|
|
963
|
+
n && typeof n.id == "string" && t.set(n.id, n);
|
|
482
964
|
return t;
|
|
483
965
|
}
|
|
484
|
-
function
|
|
966
|
+
function Te(e) {
|
|
485
967
|
const t = e.options;
|
|
486
|
-
return Array.isArray(t) ? t.map((
|
|
487
|
-
if (!
|
|
488
|
-
const
|
|
968
|
+
return Array.isArray(t) ? t.map((n) => {
|
|
969
|
+
if (!n || typeof n != "object") return null;
|
|
970
|
+
const r = n;
|
|
489
971
|
return {
|
|
490
|
-
value: String(
|
|
491
|
-
label: String(
|
|
972
|
+
value: String(r.value ?? r.label ?? ""),
|
|
973
|
+
label: String(r.label ?? r.value ?? "")
|
|
492
974
|
};
|
|
493
|
-
}).filter((
|
|
975
|
+
}).filter((n) => !!n) : [];
|
|
494
976
|
}
|
|
495
|
-
function
|
|
496
|
-
const t = typeof e.id == "string" ? e.id :
|
|
497
|
-
|
|
977
|
+
function Ln(e) {
|
|
978
|
+
const t = typeof e.id == "string" ? e.id : ee("block-"), n = String(e.component ?? ""), r = U(e.label) ?? U(e.text) ?? "", o = $e(e.value), a = (i) => ({ id: t, type: i, label: r }), l = _n(n);
|
|
979
|
+
if (l)
|
|
980
|
+
return l.fromComponent(e, a, { asLiteral: U, nameFromValue: $e });
|
|
981
|
+
switch (n) {
|
|
498
982
|
case "Text": {
|
|
499
|
-
const
|
|
500
|
-
return { id: t, type:
|
|
983
|
+
const i = String(e.variant ?? "body"), c = /^h[1-6]$/i.test(i) || i === "title" || i === "subtitle";
|
|
984
|
+
return { id: t, type: c ? "heading" : "paragraph", label: r };
|
|
501
985
|
}
|
|
502
986
|
case "TextField": {
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
return
|
|
987
|
+
const i = String(e.variant ?? "shortText");
|
|
988
|
+
let c = "text";
|
|
989
|
+
i === "longText" ? c = "textarea" : i === "number" ? c = "number" : U(e.validationRegexp) === lt && (c = "email");
|
|
990
|
+
const u = { ...a(c), name: o }, m = U(e.placeholder);
|
|
991
|
+
return m && (u.placeholder = m), u;
|
|
508
992
|
}
|
|
509
993
|
case "CheckBox":
|
|
510
|
-
return { ...
|
|
994
|
+
return { ...a("toggle"), name: o };
|
|
511
995
|
case "SkoponSelect": {
|
|
512
|
-
const
|
|
513
|
-
...
|
|
996
|
+
const c = String(e.mode ?? "single") === "multiple" ? "multiselect" : "select", u = {
|
|
997
|
+
...a(c),
|
|
514
998
|
name: o,
|
|
515
|
-
options:
|
|
516
|
-
},
|
|
517
|
-
return
|
|
999
|
+
options: Te(e)
|
|
1000
|
+
}, m = U(e.placeholder);
|
|
1001
|
+
return m && (u.placeholder = m), u;
|
|
518
1002
|
}
|
|
519
1003
|
case "ChoicePicker": {
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
const
|
|
523
|
-
...i
|
|
1004
|
+
const i = U(e.skoponPickerType);
|
|
1005
|
+
if (i === "select" || i === "multiselect" || i === "radio" || i === "checkbox") {
|
|
1006
|
+
const m = {
|
|
1007
|
+
...a(i),
|
|
524
1008
|
name: o,
|
|
525
|
-
options:
|
|
526
|
-
},
|
|
527
|
-
return
|
|
1009
|
+
options: Te(e)
|
|
1010
|
+
}, p = U(e.placeholder);
|
|
1011
|
+
return p && (m.placeholder = p), m;
|
|
528
1012
|
}
|
|
529
|
-
const
|
|
530
|
-
return { ...
|
|
1013
|
+
const u = String(e.variant ?? "mutuallyExclusive") === "multipleSelection" ? "checkbox" : "radio";
|
|
1014
|
+
return { ...a(u), name: o, options: Te(e) };
|
|
531
1015
|
}
|
|
532
1016
|
case "DateTimeInput": {
|
|
533
|
-
const
|
|
534
|
-
return
|
|
1017
|
+
const i = e.enableDate === !0, c = e.enableTime === !0, m = { ...a(!i && c ? "time" : "datetime"), name: o }, p = U(e.placeholder);
|
|
1018
|
+
return p && (m.placeholder = p), m;
|
|
535
1019
|
}
|
|
536
1020
|
case "SkoponMedia": {
|
|
537
|
-
const
|
|
538
|
-
return
|
|
1021
|
+
const i = String(e.mediaType ?? "image");
|
|
1022
|
+
return oe(e, i === "video" ? "video" : i === "audio" ? "audio" : "image", r);
|
|
539
1023
|
}
|
|
540
1024
|
case "Image":
|
|
541
|
-
return
|
|
1025
|
+
return oe(e, "image", r);
|
|
542
1026
|
case "Video":
|
|
543
|
-
return
|
|
1027
|
+
return oe(e, "video", r);
|
|
544
1028
|
case "AudioPlayer":
|
|
545
|
-
return
|
|
1029
|
+
return oe(e, "audio", r);
|
|
546
1030
|
case "FileUpload": {
|
|
547
|
-
const
|
|
548
|
-
return
|
|
1031
|
+
const i = U(e.accept) ?? "", c = { ...a("file"), name: o };
|
|
1032
|
+
return i && (c.fileAcceptExtensions = i.split(",").map((u) => u.trim()).filter(Boolean)), Array.isArray(e.fileAcceptTypes) && (c.fileAcceptTypes = e.fileAcceptTypes.map(String)), typeof e.filePlaceholderIcon == "string" && (c.filePlaceholderIcon = e.filePlaceholderIcon), typeof e.minCount == "number" && (c.fileMinCount = e.minCount), typeof e.maxCount == "number" && (c.fileMaxCount = e.maxCount), c;
|
|
549
1033
|
}
|
|
550
1034
|
default:
|
|
551
1035
|
return null;
|
|
552
1036
|
}
|
|
553
1037
|
}
|
|
554
|
-
function
|
|
555
|
-
if (
|
|
556
|
-
|
|
1038
|
+
function st(e, t, n, r) {
|
|
1039
|
+
if (n.has(e)) return;
|
|
1040
|
+
n.add(e);
|
|
557
1041
|
const o = t.get(e);
|
|
558
1042
|
if (!o) return;
|
|
559
|
-
const
|
|
560
|
-
if ((
|
|
561
|
-
for (const
|
|
562
|
-
typeof
|
|
1043
|
+
const a = String(o.component ?? "");
|
|
1044
|
+
if ((a === "Column" || a === "Row") && Array.isArray(o.children)) {
|
|
1045
|
+
for (const l of o.children)
|
|
1046
|
+
typeof l == "string" && st(l, t, n, r);
|
|
563
1047
|
return;
|
|
564
1048
|
}
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
function
|
|
1049
|
+
r.push(o);
|
|
1050
|
+
}
|
|
1051
|
+
function $n(e, t) {
|
|
1052
|
+
return t ? e.map((n) => {
|
|
1053
|
+
var a;
|
|
1054
|
+
const r = (a = n.name) == null ? void 0 : a.trim();
|
|
1055
|
+
if (!r || !(r in t)) return n;
|
|
1056
|
+
const o = t[r];
|
|
1057
|
+
return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue: o === !0 || o === "true" } : { ...n, defaultValue: o };
|
|
1058
|
+
}) : e;
|
|
1059
|
+
}
|
|
1060
|
+
function Dn(e) {
|
|
568
1061
|
if (!e || !Array.isArray(e.components))
|
|
569
|
-
return
|
|
570
|
-
const t =
|
|
571
|
-
|
|
572
|
-
let
|
|
573
|
-
const
|
|
574
|
-
for (const
|
|
575
|
-
if (
|
|
576
|
-
|
|
1062
|
+
return se({ title: "", description: "", blocks: [], jsonSchema: {} });
|
|
1063
|
+
const t = jn(e), n = [];
|
|
1064
|
+
st(e.root ?? ce, t, /* @__PURE__ */ new Set(), n);
|
|
1065
|
+
let r = "", o = "";
|
|
1066
|
+
const a = [];
|
|
1067
|
+
for (const l of n) {
|
|
1068
|
+
if (l.id === Ne) {
|
|
1069
|
+
r = U(l.text) ?? r;
|
|
577
1070
|
continue;
|
|
578
1071
|
}
|
|
579
|
-
if (
|
|
580
|
-
o =
|
|
1072
|
+
if (l.id === Fe) {
|
|
1073
|
+
o = U(l.text) ?? o;
|
|
581
1074
|
continue;
|
|
582
1075
|
}
|
|
583
|
-
const
|
|
584
|
-
|
|
1076
|
+
const i = Ln(l);
|
|
1077
|
+
i && a.push(i);
|
|
585
1078
|
}
|
|
586
|
-
return
|
|
1079
|
+
return se({
|
|
1080
|
+
title: r,
|
|
1081
|
+
description: o,
|
|
1082
|
+
blocks: $n(a, e.dataModel),
|
|
1083
|
+
jsonSchema: {}
|
|
1084
|
+
});
|
|
587
1085
|
}
|
|
588
|
-
function
|
|
589
|
-
const { surfaceId:
|
|
590
|
-
{ version: "v0.9", createSurface: { surfaceId:
|
|
1086
|
+
function Kn(e, t) {
|
|
1087
|
+
const { surfaceId: n, catalogId: r } = t, o = [
|
|
1088
|
+
{ version: "v0.9", createSurface: { surfaceId: n, catalogId: r } },
|
|
591
1089
|
{
|
|
592
1090
|
version: "v0.9",
|
|
593
|
-
updateComponents: { surfaceId:
|
|
1091
|
+
updateComponents: { surfaceId: n, components: e.components }
|
|
594
1092
|
}
|
|
595
1093
|
];
|
|
596
1094
|
return e.dataModel && Object.keys(e.dataModel).length > 0 && o.push({
|
|
597
1095
|
version: "v0.9",
|
|
598
|
-
updateDataModel: { surfaceId:
|
|
1096
|
+
updateDataModel: { surfaceId: n, path: "/", value: e.dataModel }
|
|
599
1097
|
}), o;
|
|
600
1098
|
}
|
|
601
|
-
function
|
|
1099
|
+
function ct(e) {
|
|
602
1100
|
return !!e && typeof e == "object" && !Array.isArray(e) && Array.isArray(e.components);
|
|
603
1101
|
}
|
|
604
|
-
function
|
|
1102
|
+
function Jn(e, t) {
|
|
605
1103
|
if (!e || typeof e != "object") return null;
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
const o = Array.isArray(
|
|
1104
|
+
const n = e, r = ct(n.a2ui) ? n.a2ui : void 0;
|
|
1105
|
+
if (r && !Me(r)) return r;
|
|
1106
|
+
const o = Array.isArray(n.blocks) ? n.blocks : [];
|
|
609
1107
|
if (o.length === 0) return null;
|
|
610
|
-
const
|
|
611
|
-
title: typeof
|
|
612
|
-
description: typeof
|
|
1108
|
+
const a = H({
|
|
1109
|
+
title: typeof n.title == "string" ? n.title : "",
|
|
1110
|
+
description: typeof n.description == "string" ? n.description : "",
|
|
613
1111
|
blocks: o
|
|
614
|
-
}),
|
|
615
|
-
return
|
|
1112
|
+
}), l = it(a, t);
|
|
1113
|
+
return Me(l) ? null : l;
|
|
616
1114
|
}
|
|
617
|
-
function
|
|
618
|
-
return
|
|
1115
|
+
function Hn(e, t, n) {
|
|
1116
|
+
return it(
|
|
619
1117
|
{
|
|
620
1118
|
title: e.title,
|
|
621
1119
|
description: e.description,
|
|
622
1120
|
blocks: t
|
|
623
1121
|
},
|
|
624
|
-
|
|
1122
|
+
n
|
|
625
1123
|
);
|
|
626
1124
|
}
|
|
627
|
-
function
|
|
1125
|
+
function Yn(e) {
|
|
628
1126
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
629
1127
|
return;
|
|
630
1128
|
const t = e;
|
|
631
|
-
return !(Array.isArray(t.blocks) && t.blocks.length > 0) &&
|
|
1129
|
+
return !(Array.isArray(t.blocks) && t.blocks.length > 0) && ct(t.a2ui) ? Dn(t.a2ui) : H({
|
|
632
1130
|
title: typeof t.title == "string" ? t.title : "",
|
|
633
1131
|
description: typeof t.description == "string" ? t.description : "",
|
|
634
1132
|
blocks: Array.isArray(t.blocks) ? t.blocks : []
|
|
635
1133
|
});
|
|
636
1134
|
}
|
|
637
|
-
function
|
|
638
|
-
const
|
|
639
|
-
if (!
|
|
1135
|
+
function Xn(e, t, n) {
|
|
1136
|
+
const r = e.model.surfacesMap.get(t);
|
|
1137
|
+
if (!r) return {};
|
|
640
1138
|
const o = {};
|
|
641
|
-
for (const
|
|
642
|
-
const
|
|
643
|
-
|
|
1139
|
+
for (const a of n) {
|
|
1140
|
+
const l = a.trim();
|
|
1141
|
+
l && (o[l] = r.dataModel.get(`/${l}`));
|
|
644
1142
|
}
|
|
645
1143
|
return o;
|
|
646
1144
|
}
|
|
647
|
-
function
|
|
1145
|
+
function ut(e) {
|
|
648
1146
|
return e.replace(/'/g, "'\\''");
|
|
649
1147
|
}
|
|
650
|
-
function
|
|
651
|
-
const
|
|
1148
|
+
function Gn(e, t) {
|
|
1149
|
+
const n = (t ?? "").trim() || "<callback_url>", r = JSON.stringify(e ?? {}, null, 2);
|
|
652
1150
|
return [
|
|
653
|
-
`curl -X POST '${
|
|
1151
|
+
`curl -X POST '${n}' \\`,
|
|
654
1152
|
" -H 'Content-Type: application/json' \\",
|
|
655
|
-
` -d '${
|
|
1153
|
+
` -d '${ut(r)}'`
|
|
656
1154
|
].join(`
|
|
657
1155
|
`);
|
|
658
1156
|
}
|
|
659
|
-
function
|
|
660
|
-
return
|
|
1157
|
+
function Wn(e, t) {
|
|
1158
|
+
return JSON.stringify({ ...e, ...t }, null, 2);
|
|
661
1159
|
}
|
|
662
|
-
function
|
|
663
|
-
const r = ["{"], n = Object.entries(e), o = Object.entries(t);
|
|
664
|
-
return n.forEach(([i, a], l) => {
|
|
665
|
-
const c = l < n.length - 1 || o.length > 0;
|
|
666
|
-
r.push(Me(i, a, c));
|
|
667
|
-
}), o.length > 0 && (r.push(" // 额外字段(未在卡片展示)"), o.forEach(([i, a], l) => {
|
|
668
|
-
r.push(Me(i, a, l < o.length - 1));
|
|
669
|
-
})), r.push("}"), r.join(`
|
|
670
|
-
`);
|
|
671
|
-
}
|
|
672
|
-
function rr({
|
|
1160
|
+
function Zn({
|
|
673
1161
|
cardValues: e,
|
|
674
1162
|
extraValues: t = {},
|
|
675
|
-
callbackUrl:
|
|
1163
|
+
callbackUrl: n
|
|
676
1164
|
}) {
|
|
677
|
-
const
|
|
1165
|
+
const r = (n ?? "").trim() || "<callback_url>", o = Wn(e, t);
|
|
678
1166
|
return [
|
|
679
|
-
`curl -X POST '${
|
|
1167
|
+
`curl -X POST '${r}' \\`,
|
|
680
1168
|
" -H 'Content-Type: application/json' \\",
|
|
681
|
-
` -d '${
|
|
1169
|
+
` -d '${ut(o)}'`
|
|
682
1170
|
].join(`
|
|
683
1171
|
`);
|
|
684
1172
|
}
|
|
685
|
-
function
|
|
686
|
-
return
|
|
1173
|
+
function Qn(e) {
|
|
1174
|
+
return H({
|
|
687
1175
|
title: "",
|
|
688
1176
|
description: "",
|
|
689
1177
|
blocks: [e]
|
|
690
1178
|
}).blocks[0];
|
|
691
1179
|
}
|
|
692
|
-
function
|
|
693
|
-
var o,
|
|
694
|
-
const
|
|
695
|
-
for (const
|
|
696
|
-
const
|
|
697
|
-
|
|
1180
|
+
function er(e, t) {
|
|
1181
|
+
var o, a;
|
|
1182
|
+
const n = /* @__PURE__ */ new Map();
|
|
1183
|
+
for (const l of t) {
|
|
1184
|
+
const i = (o = l.name) == null ? void 0 : o.trim();
|
|
1185
|
+
i && n.set(i, l);
|
|
698
1186
|
}
|
|
699
|
-
const
|
|
700
|
-
for (const
|
|
701
|
-
if (
|
|
702
|
-
|
|
1187
|
+
const r = [];
|
|
1188
|
+
for (const l of e.blocks) {
|
|
1189
|
+
if (_e(l.type)) {
|
|
1190
|
+
r.push(Qn(l));
|
|
703
1191
|
continue;
|
|
704
1192
|
}
|
|
705
|
-
if (!
|
|
706
|
-
const
|
|
707
|
-
if (!
|
|
708
|
-
const c =
|
|
709
|
-
c &&
|
|
1193
|
+
if (!J(l.type)) continue;
|
|
1194
|
+
const i = (a = l.name) == null ? void 0 : a.trim();
|
|
1195
|
+
if (!i) continue;
|
|
1196
|
+
const c = n.get(i);
|
|
1197
|
+
c && r.push(c);
|
|
710
1198
|
}
|
|
711
|
-
return
|
|
1199
|
+
return r;
|
|
712
1200
|
}
|
|
713
|
-
function
|
|
714
|
-
var
|
|
715
|
-
const
|
|
1201
|
+
function tr(e, t) {
|
|
1202
|
+
var r;
|
|
1203
|
+
const n = {
|
|
716
1204
|
...e,
|
|
717
|
-
name: ((
|
|
1205
|
+
name: ((r = e.name) == null ? void 0 : r.trim()) || t.name
|
|
718
1206
|
};
|
|
719
|
-
return t.defaultValue !== void 0 && (
|
|
1207
|
+
return t.defaultValue !== void 0 && (n.defaultValue = t.defaultValue), H({
|
|
720
1208
|
title: "",
|
|
721
1209
|
description: "",
|
|
722
|
-
blocks: [
|
|
1210
|
+
blocks: [n]
|
|
723
1211
|
}).blocks[0];
|
|
724
1212
|
}
|
|
725
|
-
function
|
|
1213
|
+
function nr(e) {
|
|
726
1214
|
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
727
1215
|
const t = e;
|
|
728
|
-
return Array.isArray(t.blocks) ?
|
|
1216
|
+
return Array.isArray(t.blocks) ? H({
|
|
729
1217
|
title: typeof t.title == "string" ? t.title : "",
|
|
730
1218
|
description: typeof t.description == "string" ? t.description : "",
|
|
731
1219
|
blocks: t.blocks
|
|
732
1220
|
}) : null;
|
|
733
1221
|
}
|
|
734
|
-
function
|
|
735
|
-
var
|
|
736
|
-
const
|
|
737
|
-
for (const
|
|
738
|
-
|
|
739
|
-
const
|
|
740
|
-
for (const
|
|
741
|
-
if (!
|
|
742
|
-
const
|
|
743
|
-
if (!
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
1222
|
+
function rr(e, t) {
|
|
1223
|
+
var a, l, i, c, u, m;
|
|
1224
|
+
const n = /* @__PURE__ */ new Map();
|
|
1225
|
+
for (const p of (t == null ? void 0 : t.blocks) ?? [])
|
|
1226
|
+
J(p.type) && ((a = p.name) != null && a.trim()) && n.set(p.name.trim(), p);
|
|
1227
|
+
const r = [], o = [];
|
|
1228
|
+
for (const p of e.blocks) {
|
|
1229
|
+
if (!J(p.type)) continue;
|
|
1230
|
+
const y = (l = p.name) == null ? void 0 : l.trim();
|
|
1231
|
+
if (!y) continue;
|
|
1232
|
+
const S = n.get(y);
|
|
1233
|
+
S ? r.push(tr(S, p)) : o.push(
|
|
1234
|
+
H({
|
|
747
1235
|
title: "",
|
|
748
1236
|
description: "",
|
|
749
|
-
blocks: [
|
|
1237
|
+
blocks: [p]
|
|
750
1238
|
}).blocks[0]
|
|
751
1239
|
);
|
|
752
1240
|
}
|
|
753
1241
|
return {
|
|
754
|
-
matchedBlocks:
|
|
1242
|
+
matchedBlocks: r,
|
|
755
1243
|
extraBlocks: o,
|
|
756
|
-
renderBlocks:
|
|
757
|
-
title: ((
|
|
758
|
-
description: ((u = e.description) == null ? void 0 : u.trim()) || ((
|
|
1244
|
+
renderBlocks: er(e, r),
|
|
1245
|
+
title: ((i = e.title) == null ? void 0 : i.trim()) || ((c = t == null ? void 0 : t.title) == null ? void 0 : c.trim()) || "",
|
|
1246
|
+
description: ((u = e.description) == null ? void 0 : u.trim()) || ((m = t == null ? void 0 : t.description) == null ? void 0 : m.trim()) || ""
|
|
759
1247
|
};
|
|
760
1248
|
}
|
|
761
|
-
function
|
|
762
|
-
const { type: t, defaultValue:
|
|
763
|
-
return
|
|
1249
|
+
function or(e) {
|
|
1250
|
+
const { type: t, defaultValue: n } = e;
|
|
1251
|
+
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 : "";
|
|
764
1252
|
}
|
|
765
|
-
function
|
|
766
|
-
var
|
|
1253
|
+
function ar(e) {
|
|
1254
|
+
var n;
|
|
767
1255
|
const t = {};
|
|
768
|
-
for (const
|
|
769
|
-
if (!
|
|
770
|
-
const o = (
|
|
771
|
-
o && (t[o] =
|
|
1256
|
+
for (const r of e) {
|
|
1257
|
+
if (!J(r.type)) continue;
|
|
1258
|
+
const o = (n = r.name) == null ? void 0 : n.trim();
|
|
1259
|
+
o && (t[o] = or(r));
|
|
772
1260
|
}
|
|
773
1261
|
return t;
|
|
774
1262
|
}
|
|
775
|
-
function
|
|
1263
|
+
function lr(e) {
|
|
776
1264
|
return e.blocks.some(
|
|
777
1265
|
(t) => {
|
|
778
|
-
var
|
|
779
|
-
return
|
|
1266
|
+
var n;
|
|
1267
|
+
return J(t.type) && !!((n = t.name) != null && n.trim());
|
|
780
1268
|
}
|
|
781
1269
|
);
|
|
782
1270
|
}
|
|
783
|
-
function
|
|
1271
|
+
function ir(e) {
|
|
784
1272
|
return e.blocks.filter((t) => {
|
|
785
|
-
var
|
|
786
|
-
return
|
|
1273
|
+
var n;
|
|
1274
|
+
return _e(t.type) ? !0 : J(t.type) && !!((n = t.name) != null && n.trim());
|
|
787
1275
|
});
|
|
788
1276
|
}
|
|
789
|
-
function
|
|
1277
|
+
function sr(e) {
|
|
790
1278
|
return e.blocks.filter((t) => {
|
|
791
|
-
var
|
|
792
|
-
return
|
|
1279
|
+
var n;
|
|
1280
|
+
return J(t.type) && ((n = t.name) == null ? void 0 : n.trim());
|
|
793
1281
|
}).map((t) => t.name.trim());
|
|
794
1282
|
}
|
|
795
|
-
async function
|
|
796
|
-
const
|
|
797
|
-
if (!
|
|
1283
|
+
async function cr(e, t, n) {
|
|
1284
|
+
const r = e.trim();
|
|
1285
|
+
if (!r)
|
|
798
1286
|
throw new Error("callback_url 为空");
|
|
799
|
-
const
|
|
1287
|
+
const a = await ((n == null ? void 0 : n.fetch) ?? fetch)(r, {
|
|
800
1288
|
method: "POST",
|
|
801
1289
|
headers: {
|
|
802
1290
|
"Content-Type": "application/json",
|
|
803
|
-
...(
|
|
1291
|
+
...(n == null ? void 0 : n.headers) ?? {}
|
|
804
1292
|
},
|
|
805
1293
|
body: JSON.stringify(t ?? {})
|
|
806
1294
|
});
|
|
807
|
-
let
|
|
808
|
-
if ((
|
|
1295
|
+
let l;
|
|
1296
|
+
if ((a.headers.get("content-type") ?? "").includes("application/json"))
|
|
809
1297
|
try {
|
|
810
|
-
|
|
1298
|
+
l = await a.json();
|
|
811
1299
|
} catch {
|
|
812
|
-
|
|
1300
|
+
l = void 0;
|
|
813
1301
|
}
|
|
814
1302
|
else
|
|
815
1303
|
try {
|
|
816
|
-
|
|
1304
|
+
l = await a.text();
|
|
817
1305
|
} catch {
|
|
818
|
-
|
|
1306
|
+
l = void 0;
|
|
819
1307
|
}
|
|
820
|
-
return { ok:
|
|
1308
|
+
return { ok: a.ok, status: a.status, body: l };
|
|
821
1309
|
}
|
|
822
|
-
async function
|
|
823
|
-
var
|
|
824
|
-
if (typeof navigator < "u" && ((
|
|
1310
|
+
async function pt(e) {
|
|
1311
|
+
var n;
|
|
1312
|
+
if (typeof navigator < "u" && ((n = navigator.clipboard) != null && n.writeText)) {
|
|
825
1313
|
await navigator.clipboard.writeText(e);
|
|
826
1314
|
return;
|
|
827
1315
|
}
|
|
@@ -835,7 +1323,7 @@ async function $e(e) {
|
|
|
835
1323
|
document.body.removeChild(t);
|
|
836
1324
|
}
|
|
837
1325
|
}
|
|
838
|
-
async function
|
|
1326
|
+
async function ur(e) {
|
|
839
1327
|
let t;
|
|
840
1328
|
try {
|
|
841
1329
|
t = await e.json();
|
|
@@ -848,100 +1336,55 @@ async function fr(e) {
|
|
|
848
1336
|
throw new Error(t.message || `响应缺少 data (${e.status})`);
|
|
849
1337
|
return t.data;
|
|
850
1338
|
}
|
|
851
|
-
function
|
|
852
|
-
const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""),
|
|
853
|
-
async function o(
|
|
854
|
-
var
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
else if (
|
|
859
|
-
|
|
1339
|
+
function Wr(e = {}) {
|
|
1340
|
+
const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.detailPath ?? "/dev/form/detail", r = e.fetch ?? fetch;
|
|
1341
|
+
async function o(a) {
|
|
1342
|
+
var p;
|
|
1343
|
+
const l = new URLSearchParams();
|
|
1344
|
+
if (a.formId !== void 0)
|
|
1345
|
+
l.set("form_id", String(a.formId));
|
|
1346
|
+
else if (a.formUniqueId)
|
|
1347
|
+
l.set("form_unique_id", a.formUniqueId);
|
|
860
1348
|
else
|
|
861
1349
|
throw new Error("form_id 或 form_unique_id 至少传一个");
|
|
862
|
-
const
|
|
1350
|
+
const i = await ((p = e.getHeaders) == null ? void 0 : p.call(e)) ?? {}, c = await r(`${t}${n}?${l.toString()}`, {
|
|
863
1351
|
method: "GET",
|
|
864
|
-
headers:
|
|
865
|
-
}), u = await
|
|
1352
|
+
headers: i
|
|
1353
|
+
}), u = await ur(c), m = Yn(u.form_definition);
|
|
866
1354
|
return {
|
|
867
1355
|
formUniqueId: u.form_unique_id,
|
|
868
1356
|
formId: u.form_id,
|
|
869
1357
|
disabled: u.disabled === 1,
|
|
870
|
-
formDefinition:
|
|
871
|
-
a2ui:
|
|
1358
|
+
formDefinition: m,
|
|
1359
|
+
a2ui: Jn(u.form_definition) ?? void 0
|
|
872
1360
|
};
|
|
873
1361
|
}
|
|
874
1362
|
return { fetchDetail: o };
|
|
875
1363
|
}
|
|
876
|
-
const
|
|
877
|
-
video:
|
|
878
|
-
audio:
|
|
879
|
-
image:
|
|
880
|
-
file:
|
|
881
|
-
spreadsheet:
|
|
882
|
-
document:
|
|
1364
|
+
const pr = {
|
|
1365
|
+
video: Pt,
|
|
1366
|
+
audio: Mt,
|
|
1367
|
+
image: Ft,
|
|
1368
|
+
file: He,
|
|
1369
|
+
spreadsheet: Nt,
|
|
1370
|
+
document: Je
|
|
883
1371
|
};
|
|
884
|
-
function
|
|
1372
|
+
function mr({
|
|
885
1373
|
type: e,
|
|
886
1374
|
size: t = 40,
|
|
887
|
-
className:
|
|
1375
|
+
className: n
|
|
888
1376
|
}) {
|
|
889
|
-
const
|
|
1377
|
+
const r = pr[e] ?? He;
|
|
890
1378
|
return /* @__PURE__ */ s(
|
|
891
|
-
|
|
1379
|
+
r,
|
|
892
1380
|
{
|
|
893
|
-
className:
|
|
1381
|
+
className: n ?? "skopon-form-file-placeholder-icon",
|
|
894
1382
|
style: { fontSize: t, color: "var(--color-primary, #1677ff)" },
|
|
895
1383
|
"aria-hidden": !0
|
|
896
1384
|
}
|
|
897
1385
|
);
|
|
898
1386
|
}
|
|
899
|
-
const
|
|
900
|
-
function De({
|
|
901
|
-
interactive: e,
|
|
902
|
-
children: t
|
|
903
|
-
}) {
|
|
904
|
-
return /* @__PURE__ */ s(Re.Provider, { value: { interactive: e }, children: t });
|
|
905
|
-
}
|
|
906
|
-
function j() {
|
|
907
|
-
return Ze(Re);
|
|
908
|
-
}
|
|
909
|
-
function He(e) {
|
|
910
|
-
return e && typeof e == "object" && "path" in e && String(e.path ?? "").trim() || null;
|
|
911
|
-
}
|
|
912
|
-
function Ee(e, t = "value") {
|
|
913
|
-
const n = e.componentModel.properties[t];
|
|
914
|
-
if (!(!He(n) || n === void 0))
|
|
915
|
-
return e.dataContext.resolveDynamicValue(n);
|
|
916
|
-
}
|
|
917
|
-
function L(e, t = "value") {
|
|
918
|
-
const n = e.componentModel.properties[t], o = He(n), i = ie(
|
|
919
|
-
(u) => {
|
|
920
|
-
if (!o || n === void 0) return () => {
|
|
921
|
-
};
|
|
922
|
-
const f = e.dataContext.subscribeDynamicValue(n, () => u());
|
|
923
|
-
return () => f.unsubscribe();
|
|
924
|
-
},
|
|
925
|
-
[e, n, o]
|
|
926
|
-
), a = ie(() => {
|
|
927
|
-
if (!(!o || n === void 0))
|
|
928
|
-
return e.dataContext.resolveDynamicValue(n);
|
|
929
|
-
}, [e, n, o]), l = Qe(i, a, a), c = ie(
|
|
930
|
-
(u) => {
|
|
931
|
-
!o || !n || typeof n != "object" || !("path" in n) || e.dataContext.set(String(n.path), u);
|
|
932
|
-
},
|
|
933
|
-
[e, n, o]
|
|
934
|
-
);
|
|
935
|
-
return { value: l, setValue: c, hasBinding: !!o };
|
|
936
|
-
}
|
|
937
|
-
function D(e) {
|
|
938
|
-
if (typeof e == "string") return e || void 0;
|
|
939
|
-
if (typeof e == "number") return String(e);
|
|
940
|
-
}
|
|
941
|
-
function V(e) {
|
|
942
|
-
return Array.isArray(e) ? e.map(String) : typeof e == "string" && e ? [e] : [];
|
|
943
|
-
}
|
|
944
|
-
const Ye = "skopon-form-v0_9", yr = /* @__PURE__ */ new Set([
|
|
1387
|
+
const mt = "skopon-form-v0_9", dr = /* @__PURE__ */ new Set([
|
|
945
1388
|
"SkoponMedia",
|
|
946
1389
|
"SkoponSelect",
|
|
947
1390
|
"Image",
|
|
@@ -952,135 +1395,136 @@ const Ye = "skopon-form-v0_9", yr = /* @__PURE__ */ new Set([
|
|
|
952
1395
|
"DateTimeInput",
|
|
953
1396
|
"FileUpload",
|
|
954
1397
|
"TextField",
|
|
955
|
-
"Text"
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1398
|
+
"Text",
|
|
1399
|
+
...Rn()
|
|
1400
|
+
]), fr = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
|
|
1401
|
+
function re(e) {
|
|
1402
|
+
const t = [...le.components.values()].find((n) => n.name === e);
|
|
959
1403
|
if (!t) throw new Error(`Missing basic catalog component: ${e}`);
|
|
960
1404
|
return t.schema;
|
|
961
1405
|
}
|
|
962
|
-
function
|
|
1406
|
+
function N(e) {
|
|
963
1407
|
return typeof e == "string" ? e : "";
|
|
964
1408
|
}
|
|
965
|
-
function
|
|
1409
|
+
function dt(e) {
|
|
966
1410
|
return Array.isArray(e) ? e.map((t) => {
|
|
967
1411
|
if (!t || typeof t != "object") return null;
|
|
968
|
-
const
|
|
969
|
-
return { value:
|
|
1412
|
+
const n = t, r = String(n.value ?? n.label ?? ""), o = String(n.label ?? n.value ?? "");
|
|
1413
|
+
return { value: r, label: o };
|
|
970
1414
|
}).filter((t) => !!t) : [];
|
|
971
1415
|
}
|
|
972
|
-
function
|
|
1416
|
+
function me({
|
|
973
1417
|
mediaType: e,
|
|
974
1418
|
urls: t,
|
|
975
|
-
mediaSize:
|
|
976
|
-
label:
|
|
1419
|
+
mediaSize: n,
|
|
1420
|
+
label: r,
|
|
977
1421
|
help: o,
|
|
978
|
-
placeholder:
|
|
1422
|
+
placeholder: a
|
|
979
1423
|
}) {
|
|
980
|
-
const
|
|
981
|
-
return /* @__PURE__ */
|
|
982
|
-
|
|
983
|
-
t.length === 0 ? /* @__PURE__ */ s("div", { className: "form-media-preview form-media-preview--empty", children: u }) : /* @__PURE__ */ s("div", { className: c, children: t.map((
|
|
1424
|
+
const l = r == null ? void 0 : r.trim(), i = o == null ? void 0 : o.trim(), c = Qt(n), u = (a == null ? void 0 : a.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
|
|
1425
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1426
|
+
l ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: l }) : null,
|
|
1427
|
+
t.length === 0 ? /* @__PURE__ */ s("div", { className: "form-media-preview form-media-preview--empty", children: u }) : /* @__PURE__ */ s("div", { className: c, children: t.map((m, p) => e === "image" ? /* @__PURE__ */ s(
|
|
984
1428
|
"img",
|
|
985
1429
|
{
|
|
986
|
-
src:
|
|
987
|
-
alt:
|
|
1430
|
+
src: m,
|
|
1431
|
+
alt: l || "图片",
|
|
988
1432
|
className: "form-media-item"
|
|
989
1433
|
},
|
|
990
|
-
`media-${
|
|
1434
|
+
`media-${p}`
|
|
991
1435
|
) : e === "video" ? /* @__PURE__ */ s(
|
|
992
1436
|
"video",
|
|
993
1437
|
{
|
|
994
|
-
src:
|
|
1438
|
+
src: m,
|
|
995
1439
|
controls: !0,
|
|
996
1440
|
className: "form-media-item"
|
|
997
1441
|
},
|
|
998
|
-
`media-${
|
|
1442
|
+
`media-${p}`
|
|
999
1443
|
) : /* @__PURE__ */ s(
|
|
1000
1444
|
"audio",
|
|
1001
1445
|
{
|
|
1002
|
-
src:
|
|
1446
|
+
src: m,
|
|
1003
1447
|
controls: !0,
|
|
1004
1448
|
className: "form-media-item form-media-item--audio"
|
|
1005
1449
|
},
|
|
1006
|
-
`media-${
|
|
1450
|
+
`media-${p}`
|
|
1007
1451
|
)) }),
|
|
1008
|
-
|
|
1452
|
+
i ? /* @__PURE__ */ s(L.Text, { type: "secondary", className: "form-block-preview-help", children: i }) : null
|
|
1009
1453
|
] });
|
|
1010
1454
|
}
|
|
1011
|
-
function
|
|
1012
|
-
const
|
|
1455
|
+
function de(e, t) {
|
|
1456
|
+
const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : N(e.url).trim() ? [N(e.url).trim()] : [];
|
|
1013
1457
|
return {
|
|
1014
1458
|
mediaType: t,
|
|
1015
|
-
urls:
|
|
1016
|
-
mediaSize:
|
|
1017
|
-
label:
|
|
1018
|
-
help:
|
|
1019
|
-
placeholder:
|
|
1459
|
+
urls: n,
|
|
1460
|
+
mediaSize: ne(e.mediaSize),
|
|
1461
|
+
label: N(e.label) || N(e.description),
|
|
1462
|
+
help: N(e.help),
|
|
1463
|
+
placeholder: N(e.placeholder)
|
|
1020
1464
|
};
|
|
1021
1465
|
}
|
|
1022
|
-
const
|
|
1466
|
+
const hr = {
|
|
1023
1467
|
name: "SkoponMedia",
|
|
1024
|
-
schema:
|
|
1025
|
-
mediaType:
|
|
1026
|
-
urls:
|
|
1027
|
-
mediaSize:
|
|
1028
|
-
label:
|
|
1029
|
-
help:
|
|
1030
|
-
placeholder:
|
|
1468
|
+
schema: d.object({
|
|
1469
|
+
mediaType: d.any().optional(),
|
|
1470
|
+
urls: d.any().optional(),
|
|
1471
|
+
mediaSize: d.any().optional(),
|
|
1472
|
+
label: d.any().optional(),
|
|
1473
|
+
help: d.any().optional(),
|
|
1474
|
+
placeholder: d.any().optional()
|
|
1031
1475
|
}).passthrough()
|
|
1032
|
-
},
|
|
1033
|
-
const t = e.componentModel.properties,
|
|
1034
|
-
return /* @__PURE__ */ s(
|
|
1035
|
-
}),
|
|
1036
|
-
{ name: "Image", schema:
|
|
1037
|
-
({ context: e }) => /* @__PURE__ */ s(
|
|
1038
|
-
),
|
|
1039
|
-
{ name: "Video", schema:
|
|
1040
|
-
({ context: e }) => /* @__PURE__ */ s(
|
|
1041
|
-
),
|
|
1042
|
-
{ name: "AudioPlayer", schema:
|
|
1043
|
-
({ context: e }) => /* @__PURE__ */ s(
|
|
1044
|
-
),
|
|
1476
|
+
}, gr = z(hr, ({ context: e }) => {
|
|
1477
|
+
const t = e.componentModel.properties, n = N(t.mediaType);
|
|
1478
|
+
return /* @__PURE__ */ s(me, { ...de(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
|
|
1479
|
+
}), yr = z(
|
|
1480
|
+
{ name: "Image", schema: re("Image") },
|
|
1481
|
+
({ context: e }) => /* @__PURE__ */ s(me, { ...de(e.componentModel.properties, "image") })
|
|
1482
|
+
), vr = z(
|
|
1483
|
+
{ name: "Video", schema: re("Video") },
|
|
1484
|
+
({ context: e }) => /* @__PURE__ */ s(me, { ...de(e.componentModel.properties, "video") })
|
|
1485
|
+
), br = z(
|
|
1486
|
+
{ name: "AudioPlayer", schema: re("AudioPlayer") },
|
|
1487
|
+
({ context: e }) => /* @__PURE__ */ s(me, { ...de(e.componentModel.properties, "audio") })
|
|
1488
|
+
), Sr = {
|
|
1045
1489
|
name: "SkoponSelect",
|
|
1046
|
-
schema:
|
|
1047
|
-
label:
|
|
1048
|
-
mode:
|
|
1049
|
-
placeholder:
|
|
1050
|
-
options:
|
|
1051
|
-
value:
|
|
1490
|
+
schema: d.object({
|
|
1491
|
+
label: d.any().optional(),
|
|
1492
|
+
mode: d.any().optional(),
|
|
1493
|
+
placeholder: d.any().optional(),
|
|
1494
|
+
options: d.any().optional(),
|
|
1495
|
+
value: d.any().optional()
|
|
1052
1496
|
}).passthrough()
|
|
1053
1497
|
};
|
|
1054
|
-
function
|
|
1055
|
-
const { interactive: t } =
|
|
1056
|
-
return /* @__PURE__ */
|
|
1057
|
-
|
|
1498
|
+
function kr({ context: e }) {
|
|
1499
|
+
const { interactive: t } = $(), { value: n, setValue: r } = D(e), o = e.componentModel.properties, a = N(o.label), l = N(o.placeholder), i = dt(o.options), c = N(o.mode) === "multiple";
|
|
1500
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1501
|
+
a ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: a }) : null,
|
|
1058
1502
|
/* @__PURE__ */ s(
|
|
1059
|
-
|
|
1503
|
+
Ce,
|
|
1060
1504
|
{
|
|
1061
1505
|
mode: c ? "multiple" : void 0,
|
|
1062
1506
|
disabled: !t,
|
|
1063
1507
|
allowClear: !0,
|
|
1064
1508
|
className: "form-block-preview-control",
|
|
1065
1509
|
style: { width: "100%" },
|
|
1066
|
-
placeholder:
|
|
1067
|
-
options:
|
|
1068
|
-
value: c ?
|
|
1069
|
-
onChange: (u) =>
|
|
1510
|
+
placeholder: l || (c ? "请选择多项" : "请选择"),
|
|
1511
|
+
options: i,
|
|
1512
|
+
value: c ? j(n) : Q(n),
|
|
1513
|
+
onChange: (u) => r(c ? u ?? [] : u ?? "")
|
|
1070
1514
|
}
|
|
1071
1515
|
)
|
|
1072
1516
|
] });
|
|
1073
1517
|
}
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
|
|
1518
|
+
const xr = z(
|
|
1519
|
+
Sr,
|
|
1520
|
+
kr
|
|
1077
1521
|
);
|
|
1078
|
-
function
|
|
1079
|
-
const { interactive: t } =
|
|
1080
|
-
return /* @__PURE__ */
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1522
|
+
function Ar({ context: e }) {
|
|
1523
|
+
const { interactive: t } = $(), { value: n, setValue: r } = D(e), o = e.componentModel.properties, a = N(o.label), l = N(o.variant) || "mutuallyExclusive", i = N(o.skoponPickerType), c = N(o.placeholder), u = dt(o.options), p = i === "select" || i === "multiselect" || i === "radio" || i === "checkbox" ? i : l === "multipleSelection" ? "checkbox" : "radio";
|
|
1524
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1525
|
+
a ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: a }) : null,
|
|
1526
|
+
p === "select" ? /* @__PURE__ */ s(
|
|
1527
|
+
Ce,
|
|
1084
1528
|
{
|
|
1085
1529
|
disabled: !t,
|
|
1086
1530
|
allowClear: !0,
|
|
@@ -1088,11 +1532,11 @@ function Er({ context: e }) {
|
|
|
1088
1532
|
style: { width: "100%" },
|
|
1089
1533
|
placeholder: c || "请选择",
|
|
1090
1534
|
options: u,
|
|
1091
|
-
value:
|
|
1092
|
-
onChange: (
|
|
1535
|
+
value: Q(n),
|
|
1536
|
+
onChange: (y) => r(y ?? "")
|
|
1093
1537
|
}
|
|
1094
|
-
) :
|
|
1095
|
-
|
|
1538
|
+
) : p === "multiselect" ? /* @__PURE__ */ s(
|
|
1539
|
+
Ce,
|
|
1096
1540
|
{
|
|
1097
1541
|
mode: "multiple",
|
|
1098
1542
|
disabled: !t,
|
|
@@ -1101,563 +1545,604 @@ function Er({ context: e }) {
|
|
|
1101
1545
|
style: { width: "100%" },
|
|
1102
1546
|
placeholder: c || "请选择多项",
|
|
1103
1547
|
options: u,
|
|
1104
|
-
value:
|
|
1105
|
-
onChange: (
|
|
1548
|
+
value: j(n),
|
|
1549
|
+
onChange: (y) => r(y ?? [])
|
|
1106
1550
|
}
|
|
1107
|
-
) :
|
|
1108
|
-
|
|
1551
|
+
) : p === "checkbox" ? /* @__PURE__ */ s(
|
|
1552
|
+
bt.Group,
|
|
1109
1553
|
{
|
|
1110
1554
|
disabled: !t,
|
|
1111
1555
|
className: "form-block-preview-control",
|
|
1112
1556
|
options: u,
|
|
1113
|
-
value:
|
|
1114
|
-
onChange: (
|
|
1557
|
+
value: j(n),
|
|
1558
|
+
onChange: (y) => r(y)
|
|
1115
1559
|
}
|
|
1116
1560
|
) : /* @__PURE__ */ s(
|
|
1117
|
-
|
|
1561
|
+
St.Group,
|
|
1118
1562
|
{
|
|
1119
1563
|
disabled: !t,
|
|
1120
1564
|
className: "form-block-preview-control",
|
|
1121
1565
|
options: u,
|
|
1122
|
-
value:
|
|
1123
|
-
onChange: (
|
|
1566
|
+
value: Q(n),
|
|
1567
|
+
onChange: (y) => r(y.target.value)
|
|
1124
1568
|
}
|
|
1125
1569
|
)
|
|
1126
1570
|
] });
|
|
1127
1571
|
}
|
|
1128
|
-
const
|
|
1572
|
+
const Tr = z(
|
|
1129
1573
|
{
|
|
1130
1574
|
name: "ChoicePicker",
|
|
1131
|
-
schema:
|
|
1132
|
-
label:
|
|
1133
|
-
variant:
|
|
1134
|
-
options:
|
|
1135
|
-
value:
|
|
1136
|
-
skoponPickerType:
|
|
1137
|
-
placeholder:
|
|
1575
|
+
schema: d.object({
|
|
1576
|
+
label: d.any().optional(),
|
|
1577
|
+
variant: d.any().optional(),
|
|
1578
|
+
options: d.any().optional(),
|
|
1579
|
+
value: d.any().optional(),
|
|
1580
|
+
skoponPickerType: d.any().optional(),
|
|
1581
|
+
placeholder: d.any().optional()
|
|
1138
1582
|
}).passthrough()
|
|
1139
1583
|
},
|
|
1140
|
-
|
|
1584
|
+
Ar
|
|
1141
1585
|
);
|
|
1142
|
-
function
|
|
1143
|
-
const { interactive: t } =
|
|
1144
|
-
return /* @__PURE__ */
|
|
1145
|
-
|
|
1586
|
+
function Cr({ context: e }) {
|
|
1587
|
+
const { interactive: t } = $(), { value: n, setValue: r } = D(e), o = e.componentModel.properties, a = N(o.label);
|
|
1588
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1589
|
+
a ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: a }) : null,
|
|
1146
1590
|
/* @__PURE__ */ s(
|
|
1147
|
-
|
|
1591
|
+
kt,
|
|
1148
1592
|
{
|
|
1149
1593
|
disabled: !t,
|
|
1150
1594
|
className: "form-block-preview-control",
|
|
1151
|
-
checked:
|
|
1152
|
-
onChange: (
|
|
1595
|
+
checked: we(n),
|
|
1596
|
+
onChange: (l) => r(l)
|
|
1153
1597
|
}
|
|
1154
1598
|
)
|
|
1155
1599
|
] });
|
|
1156
1600
|
}
|
|
1157
|
-
const
|
|
1158
|
-
{ name: "CheckBox", schema:
|
|
1159
|
-
|
|
1601
|
+
const Ir = z(
|
|
1602
|
+
{ name: "CheckBox", schema: re("CheckBox") },
|
|
1603
|
+
Cr
|
|
1160
1604
|
);
|
|
1161
|
-
function Nr(e, t,
|
|
1162
|
-
const
|
|
1163
|
-
if (!
|
|
1164
|
-
if (!t &&
|
|
1165
|
-
const
|
|
1166
|
-
return
|
|
1605
|
+
function Nr(e, t, n) {
|
|
1606
|
+
const r = Q(e);
|
|
1607
|
+
if (!r) return;
|
|
1608
|
+
if (!t && n) {
|
|
1609
|
+
const a = qe(r, "HH:mm", !0);
|
|
1610
|
+
return a.isValid() ? a : void 0;
|
|
1167
1611
|
}
|
|
1168
|
-
const o =
|
|
1612
|
+
const o = qe(r);
|
|
1169
1613
|
return o.isValid() ? o : void 0;
|
|
1170
1614
|
}
|
|
1171
|
-
function
|
|
1172
|
-
const { interactive: t } =
|
|
1173
|
-
if (!
|
|
1174
|
-
|
|
1615
|
+
function Fr({ context: e }) {
|
|
1616
|
+
const { interactive: t } = $(), { value: n, setValue: r } = D(e), o = e.componentModel.properties, a = N(o.label), l = N(o.placeholder), i = o.enableDate === !0, c = o.enableTime === !0, u = Nr(n, i, c), m = (p) => {
|
|
1617
|
+
if (!p) {
|
|
1618
|
+
r("");
|
|
1175
1619
|
return;
|
|
1176
1620
|
}
|
|
1177
|
-
if (!
|
|
1178
|
-
|
|
1621
|
+
if (!i && c) {
|
|
1622
|
+
r(p.format("HH:mm"));
|
|
1179
1623
|
return;
|
|
1180
1624
|
}
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1625
|
+
if (i && c) {
|
|
1626
|
+
r(p.format("YYYY-MM-DDTHH:mm"));
|
|
1183
1627
|
return;
|
|
1184
1628
|
}
|
|
1185
|
-
|
|
1629
|
+
r(p.format("YYYY-MM-DD"));
|
|
1186
1630
|
};
|
|
1187
|
-
return /* @__PURE__ */
|
|
1188
|
-
|
|
1189
|
-
!
|
|
1190
|
-
|
|
1631
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1632
|
+
a ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: a }) : null,
|
|
1633
|
+
!i && c ? /* @__PURE__ */ s(
|
|
1634
|
+
xt,
|
|
1191
1635
|
{
|
|
1192
1636
|
disabled: !t,
|
|
1193
1637
|
className: "form-block-preview-control",
|
|
1194
1638
|
style: { width: "100%" },
|
|
1195
|
-
placeholder:
|
|
1639
|
+
placeholder: l || "选择时间",
|
|
1196
1640
|
value: u,
|
|
1197
|
-
onChange:
|
|
1641
|
+
onChange: m
|
|
1198
1642
|
}
|
|
1199
1643
|
) : /* @__PURE__ */ s(
|
|
1200
|
-
|
|
1644
|
+
At,
|
|
1201
1645
|
{
|
|
1202
|
-
showTime:
|
|
1646
|
+
showTime: i && c,
|
|
1203
1647
|
disabled: !t,
|
|
1204
1648
|
className: "form-block-preview-control",
|
|
1205
1649
|
style: { width: "100%" },
|
|
1206
|
-
placeholder:
|
|
1650
|
+
placeholder: l || (i && c ? "选择日期时间" : "选择日期"),
|
|
1207
1651
|
value: u,
|
|
1208
|
-
onChange:
|
|
1652
|
+
onChange: m
|
|
1209
1653
|
}
|
|
1210
1654
|
)
|
|
1211
1655
|
] });
|
|
1212
1656
|
}
|
|
1213
|
-
const
|
|
1657
|
+
const Mr = z(
|
|
1214
1658
|
{
|
|
1215
1659
|
name: "DateTimeInput",
|
|
1216
|
-
schema:
|
|
1217
|
-
label:
|
|
1218
|
-
enableDate:
|
|
1219
|
-
enableTime:
|
|
1220
|
-
placeholder:
|
|
1221
|
-
value:
|
|
1222
|
-
min:
|
|
1223
|
-
max:
|
|
1660
|
+
schema: d.object({
|
|
1661
|
+
label: d.any().optional(),
|
|
1662
|
+
enableDate: d.any().optional(),
|
|
1663
|
+
enableTime: d.any().optional(),
|
|
1664
|
+
placeholder: d.any().optional(),
|
|
1665
|
+
value: d.any().optional(),
|
|
1666
|
+
min: d.any().optional(),
|
|
1667
|
+
max: d.any().optional()
|
|
1224
1668
|
}).passthrough()
|
|
1225
1669
|
},
|
|
1226
|
-
|
|
1227
|
-
),
|
|
1670
|
+
Fr
|
|
1671
|
+
), Pr = {
|
|
1228
1672
|
name: "FileUpload",
|
|
1229
|
-
schema:
|
|
1230
|
-
label:
|
|
1231
|
-
accept:
|
|
1232
|
-
fileAcceptTypes:
|
|
1233
|
-
filePlaceholderIcon:
|
|
1234
|
-
minCount:
|
|
1235
|
-
maxCount:
|
|
1236
|
-
value:
|
|
1673
|
+
schema: d.object({
|
|
1674
|
+
label: d.any().optional(),
|
|
1675
|
+
accept: d.any().optional(),
|
|
1676
|
+
fileAcceptTypes: d.any().optional(),
|
|
1677
|
+
filePlaceholderIcon: d.any().optional(),
|
|
1678
|
+
minCount: d.any().optional(),
|
|
1679
|
+
maxCount: d.any().optional(),
|
|
1680
|
+
value: d.any().optional()
|
|
1237
1681
|
}).passthrough()
|
|
1238
1682
|
};
|
|
1239
|
-
function
|
|
1240
|
-
const { interactive: t } =
|
|
1683
|
+
function Er({ context: e }) {
|
|
1684
|
+
const { interactive: t } = $(), { value: n, setValue: r } = D(e), o = e.componentModel.properties, a = N(o.label), l = N(o.accept), i = Array.isArray(o.fileAcceptTypes) ? o.fileAcceptTypes.map(String) : void 0, c = l ? l.split(",").map((f) => f.trim()).filter(Boolean) : void 0, u = Jt(i, c), m = typeof o.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
|
|
1241
1685
|
o.filePlaceholderIcon
|
|
1242
|
-
) ? o.filePlaceholderIcon : "document",
|
|
1243
|
-
return /* @__PURE__ */
|
|
1244
|
-
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
|
|
1686
|
+
) ? o.filePlaceholderIcon : "document", p = typeof o.minCount == "number" ? Math.max(0, o.minCount) : 0, y = typeof o.maxCount == "number" ? o.maxCount : 1, S = y > 0, C = j(n), F = S && C.length >= y, T = C.length < p;
|
|
1687
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1688
|
+
a ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: a }) : null,
|
|
1689
|
+
/* @__PURE__ */ x(
|
|
1690
|
+
ge.Dragger,
|
|
1247
1691
|
{
|
|
1248
|
-
disabled: !t ||
|
|
1249
|
-
accept:
|
|
1692
|
+
disabled: !t || F,
|
|
1693
|
+
accept: Kt(i, c),
|
|
1250
1694
|
className: "form-file-upload-preview",
|
|
1251
|
-
showUploadList: t &&
|
|
1252
|
-
fileList: t ?
|
|
1253
|
-
uid: `${
|
|
1254
|
-
name:
|
|
1695
|
+
showUploadList: t && C.length > 0,
|
|
1696
|
+
fileList: t ? C.map((f, h) => ({
|
|
1697
|
+
uid: `${h}-${f}`,
|
|
1698
|
+
name: f,
|
|
1255
1699
|
status: "done"
|
|
1256
1700
|
})) : [],
|
|
1257
|
-
beforeUpload: (
|
|
1258
|
-
if (!t) return
|
|
1259
|
-
const
|
|
1260
|
-
if (
|
|
1261
|
-
const
|
|
1262
|
-
return
|
|
1701
|
+
beforeUpload: (f) => {
|
|
1702
|
+
if (!t) return ge.LIST_IGNORE;
|
|
1703
|
+
const h = j(Le(e));
|
|
1704
|
+
if (S && h.length >= y) return ge.LIST_IGNORE;
|
|
1705
|
+
const k = S ? [...h, f.name].slice(0, y) : [...h, f.name];
|
|
1706
|
+
return r(k), !1;
|
|
1263
1707
|
},
|
|
1264
|
-
onRemove: (
|
|
1265
|
-
const
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1708
|
+
onRemove: (f) => {
|
|
1709
|
+
const h = j(Le(e)), k = /^(\d+)-/.exec(f.uid ?? ""), v = k ? Number(k[1]) : -1, b = v >= 0 && v < h.length ? h.filter((P, R) => R !== v) : h.filter((P) => P !== f.name);
|
|
1710
|
+
if (b.length < p) return !1;
|
|
1711
|
+
r(b);
|
|
1268
1712
|
},
|
|
1269
1713
|
children: [
|
|
1270
|
-
/* @__PURE__ */ s("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ s(
|
|
1714
|
+
/* @__PURE__ */ s("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ s(mr, { type: m, size: 40 }) }),
|
|
1271
1715
|
/* @__PURE__ */ s("p", { className: "form-file-upload-preview-text", children: "点击或拖拽文件到此处上传" })
|
|
1272
1716
|
]
|
|
1273
1717
|
}
|
|
1274
1718
|
),
|
|
1275
|
-
/* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ x(L.Text, { type: "secondary", className: "form-block-preview-help", children: [
|
|
1276
1720
|
"允许:",
|
|
1277
1721
|
u ?? "全部类型",
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1722
|
+
p > 0 ? `;至少 ${p} 个文件` : "",
|
|
1723
|
+
S ? `;最多 ${y} 个文件` : "",
|
|
1724
|
+
T && t ? `(当前 ${C.length} 个,未达下限)` : ""
|
|
1281
1725
|
] })
|
|
1282
1726
|
] });
|
|
1283
1727
|
}
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
|
|
1728
|
+
const Ur = z(
|
|
1729
|
+
Pr,
|
|
1730
|
+
Er
|
|
1287
1731
|
);
|
|
1288
|
-
function
|
|
1289
|
-
const { interactive: t } =
|
|
1290
|
-
let
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1293
|
-
|
|
1732
|
+
function _r({ context: e }) {
|
|
1733
|
+
const { interactive: t } = $(), { value: n, setValue: r } = D(e), o = e.componentModel.properties, a = N(o.label), l = N(o.placeholder), i = N(o.variant) || "shortText", c = Q(n) ?? "", u = !t, m = "form-block-preview-control";
|
|
1734
|
+
let p;
|
|
1735
|
+
if (i === "longText")
|
|
1736
|
+
p = /* @__PURE__ */ s(
|
|
1737
|
+
ye.TextArea,
|
|
1294
1738
|
{
|
|
1295
1739
|
disabled: u,
|
|
1296
|
-
className:
|
|
1297
|
-
placeholder:
|
|
1740
|
+
className: m,
|
|
1741
|
+
placeholder: l || "长文本回答...",
|
|
1298
1742
|
autoSize: { minRows: 2, maxRows: 6 },
|
|
1299
1743
|
value: c,
|
|
1300
|
-
onChange: (
|
|
1744
|
+
onChange: (y) => r(y.target.value)
|
|
1301
1745
|
}
|
|
1302
1746
|
);
|
|
1303
|
-
else if (
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1306
|
-
|
|
1747
|
+
else if (i === "number") {
|
|
1748
|
+
const y = c && Number.isFinite(Number(c)) ? Number(c) : void 0;
|
|
1749
|
+
p = /* @__PURE__ */ s(
|
|
1750
|
+
Tt,
|
|
1307
1751
|
{
|
|
1308
1752
|
disabled: u,
|
|
1309
|
-
className:
|
|
1753
|
+
className: m,
|
|
1310
1754
|
style: { width: "100%" },
|
|
1311
|
-
placeholder:
|
|
1312
|
-
value:
|
|
1313
|
-
onChange: (
|
|
1755
|
+
placeholder: l || "数字",
|
|
1756
|
+
value: y,
|
|
1757
|
+
onChange: (S) => r(S == null ? "" : String(S))
|
|
1314
1758
|
}
|
|
1315
1759
|
);
|
|
1316
|
-
} else
|
|
1317
|
-
|
|
1760
|
+
} else i === "obscured" ? p = /* @__PURE__ */ s(
|
|
1761
|
+
ye.Password,
|
|
1318
1762
|
{
|
|
1319
1763
|
disabled: u,
|
|
1320
|
-
className:
|
|
1321
|
-
placeholder:
|
|
1764
|
+
className: m,
|
|
1765
|
+
placeholder: l,
|
|
1322
1766
|
value: c,
|
|
1323
|
-
onChange: (
|
|
1767
|
+
onChange: (y) => r(y.target.value)
|
|
1324
1768
|
}
|
|
1325
|
-
) :
|
|
1326
|
-
|
|
1769
|
+
) : p = /* @__PURE__ */ s(
|
|
1770
|
+
ye,
|
|
1327
1771
|
{
|
|
1328
1772
|
disabled: u,
|
|
1329
|
-
className:
|
|
1330
|
-
placeholder:
|
|
1773
|
+
className: m,
|
|
1774
|
+
placeholder: l,
|
|
1331
1775
|
value: c,
|
|
1332
|
-
onChange: (
|
|
1776
|
+
onChange: (y) => r(y.target.value)
|
|
1333
1777
|
}
|
|
1334
1778
|
);
|
|
1335
|
-
return /* @__PURE__ */
|
|
1336
|
-
|
|
1337
|
-
|
|
1779
|
+
return /* @__PURE__ */ x("div", { className: "form-block-preview", children: [
|
|
1780
|
+
a ? /* @__PURE__ */ s("div", { className: "form-block-preview-label", children: a }) : null,
|
|
1781
|
+
p
|
|
1338
1782
|
] });
|
|
1339
1783
|
}
|
|
1340
|
-
const
|
|
1784
|
+
const zr = z(
|
|
1341
1785
|
{
|
|
1342
1786
|
name: "TextField",
|
|
1343
|
-
schema:
|
|
1344
|
-
label:
|
|
1345
|
-
variant:
|
|
1346
|
-
placeholder:
|
|
1347
|
-
validationRegexp:
|
|
1348
|
-
value:
|
|
1787
|
+
schema: d.object({
|
|
1788
|
+
label: d.any().optional(),
|
|
1789
|
+
variant: d.any().optional(),
|
|
1790
|
+
placeholder: d.any().optional(),
|
|
1791
|
+
validationRegexp: d.any().optional(),
|
|
1792
|
+
value: d.any().optional()
|
|
1349
1793
|
}).passthrough()
|
|
1350
1794
|
},
|
|
1351
|
-
|
|
1795
|
+
_r
|
|
1352
1796
|
);
|
|
1353
|
-
function
|
|
1354
|
-
const t = e.componentModel.properties,
|
|
1355
|
-
return
|
|
1797
|
+
function Rr({ context: e }) {
|
|
1798
|
+
const t = e.componentModel.properties, n = N(t.text), r = N(t.variant) || "body";
|
|
1799
|
+
return fr.has(r) ? r === "caption" ? /* @__PURE__ */ s(L.Text, { type: "secondary", className: "form-block-preview-paragraph", children: /* @__PURE__ */ s("em", { children: n }) }) : /* @__PURE__ */ s(r, { className: "form-block-preview-heading", children: n }) : /* @__PURE__ */ s(L.Paragraph, { className: "form-block-preview-paragraph", children: n });
|
|
1356
1800
|
}
|
|
1357
|
-
const
|
|
1358
|
-
{ name: "Text", schema:
|
|
1359
|
-
|
|
1801
|
+
const wr = z(
|
|
1802
|
+
{ name: "Text", schema: re("Text") },
|
|
1803
|
+
Rr
|
|
1360
1804
|
);
|
|
1361
|
-
function
|
|
1805
|
+
function ft() {
|
|
1362
1806
|
const t = [
|
|
1363
|
-
...[...
|
|
1364
|
-
(
|
|
1807
|
+
...[...le.components.values()].filter(
|
|
1808
|
+
(r) => !dr.has(r.name)
|
|
1365
1809
|
),
|
|
1810
|
+
gr,
|
|
1366
1811
|
xr,
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1812
|
+
yr,
|
|
1813
|
+
vr,
|
|
1814
|
+
br,
|
|
1815
|
+
Tr,
|
|
1371
1816
|
Ir,
|
|
1817
|
+
Mr,
|
|
1818
|
+
Ur,
|
|
1819
|
+
zr,
|
|
1372
1820
|
wr,
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
return new rt(Ye, t, r, Z.themeSchema);
|
|
1379
|
-
}
|
|
1380
|
-
const $r = et(
|
|
1821
|
+
...zn()
|
|
1822
|
+
], n = [...le.functions.values()];
|
|
1823
|
+
return new Et(mt, t, n, le.themeSchema);
|
|
1824
|
+
}
|
|
1825
|
+
const Or = gt(
|
|
1381
1826
|
function({
|
|
1382
1827
|
doc: t,
|
|
1383
|
-
surfaceId:
|
|
1384
|
-
emptyHint:
|
|
1828
|
+
surfaceId: n = "skopon-form",
|
|
1829
|
+
emptyHint: r = null,
|
|
1385
1830
|
interactive: o = !0,
|
|
1386
|
-
fieldNames:
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1831
|
+
fieldNames: a = [],
|
|
1832
|
+
resumeSearch: l = null,
|
|
1833
|
+
caseSearch: i = null
|
|
1834
|
+
}, c) {
|
|
1835
|
+
V(() => {
|
|
1836
|
+
We(), Ge();
|
|
1390
1837
|
}, []);
|
|
1391
|
-
const
|
|
1392
|
-
|
|
1393
|
-
const
|
|
1394
|
-
if (
|
|
1838
|
+
const u = B(null), m = B(a);
|
|
1839
|
+
m.current = a;
|
|
1840
|
+
const p = O(() => {
|
|
1841
|
+
if (Me(t)) return "";
|
|
1842
|
+
try {
|
|
1843
|
+
return JSON.stringify(t);
|
|
1844
|
+
} catch {
|
|
1845
|
+
return String(t);
|
|
1846
|
+
}
|
|
1847
|
+
}, [t]), y = O(() => {
|
|
1848
|
+
if (!p)
|
|
1395
1849
|
return { surfaces: [], processor: null };
|
|
1396
1850
|
try {
|
|
1397
|
-
const p = new
|
|
1398
|
-
surfaceId:
|
|
1399
|
-
catalogId:
|
|
1851
|
+
const F = JSON.parse(p), T = new Xe([ft()]), f = Kn(F, {
|
|
1852
|
+
surfaceId: n,
|
|
1853
|
+
catalogId: mt
|
|
1400
1854
|
});
|
|
1401
|
-
return
|
|
1402
|
-
surfaces: Array.from(
|
|
1403
|
-
processor:
|
|
1855
|
+
return T.processMessages(f), {
|
|
1856
|
+
surfaces: Array.from(T.model.surfacesMap.values()),
|
|
1857
|
+
processor: T
|
|
1404
1858
|
};
|
|
1405
|
-
} catch (
|
|
1406
|
-
return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败",
|
|
1859
|
+
} catch (F) {
|
|
1860
|
+
return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", F), { surfaces: [], processor: null };
|
|
1407
1861
|
}
|
|
1408
|
-
}, [
|
|
1409
|
-
return
|
|
1410
|
-
|
|
1862
|
+
}, [p, n]), { surfaces: S, processor: C } = y;
|
|
1863
|
+
return u.current = C, yt(
|
|
1864
|
+
c,
|
|
1411
1865
|
() => ({
|
|
1412
|
-
getValues(
|
|
1413
|
-
const
|
|
1414
|
-
if (!
|
|
1415
|
-
const
|
|
1416
|
-
return
|
|
1866
|
+
getValues(F) {
|
|
1867
|
+
const T = u.current;
|
|
1868
|
+
if (!T) return {};
|
|
1869
|
+
const f = (F ?? m.current).map((h) => h.trim()).filter(Boolean);
|
|
1870
|
+
return Xn(T, n, f);
|
|
1417
1871
|
}
|
|
1418
1872
|
}),
|
|
1419
|
-
[
|
|
1420
|
-
),
|
|
1873
|
+
[n]
|
|
1874
|
+
), S.length === 0 ? /* @__PURE__ */ s(De, { children: r }) : /* @__PURE__ */ s(at, { resumeSearch: l, children: /* @__PURE__ */ s(rt, { caseSearch: i, children: /* @__PURE__ */ s(et, { interactive: o, children: /* @__PURE__ */ s("div", { className: "a2ui-surface a2ui-container", children: S.map((F) => /* @__PURE__ */ s(Ye, { surface: F }, F.id)) }) }) }) });
|
|
1421
1875
|
}
|
|
1422
1876
|
);
|
|
1423
|
-
function
|
|
1424
|
-
return new
|
|
1877
|
+
function ae() {
|
|
1878
|
+
return new Xe([ft()]);
|
|
1425
1879
|
}
|
|
1426
|
-
function
|
|
1880
|
+
function Zr({
|
|
1427
1881
|
messages: e,
|
|
1428
1882
|
surfaceId: t = "skopon-form-stream",
|
|
1429
|
-
emptyHint:
|
|
1430
|
-
interactive:
|
|
1883
|
+
emptyHint: n = null,
|
|
1884
|
+
interactive: r = !0,
|
|
1885
|
+
resumeSearch: o = null,
|
|
1886
|
+
caseSearch: a = null
|
|
1431
1887
|
}) {
|
|
1432
|
-
|
|
1433
|
-
|
|
1888
|
+
V(() => {
|
|
1889
|
+
We(), Ge();
|
|
1434
1890
|
}, []);
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1891
|
+
const l = B(null);
|
|
1892
|
+
l.current === null && (l.current = ae());
|
|
1893
|
+
const i = B(0), c = B(""), u = B(!0), m = B(t);
|
|
1894
|
+
function p(f, h) {
|
|
1895
|
+
l.current = f, i.current = h.length, c.current = JSON.stringify(h), u.current && (C(f), T(Array.from(f.model.surfacesMap.values())));
|
|
1896
|
+
}
|
|
1897
|
+
function y(f, h) {
|
|
1898
|
+
if (h <= 0) return !1;
|
|
1899
|
+
const k = JSON.stringify(f.slice(0, h)), v = c.current;
|
|
1900
|
+
if (!v) return !0;
|
|
1901
|
+
try {
|
|
1902
|
+
const b = JSON.parse(v);
|
|
1903
|
+
return JSON.stringify(b.slice(0, h)) !== k;
|
|
1904
|
+
} catch {
|
|
1905
|
+
return !0;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
const [S, C] = E(
|
|
1909
|
+
() => l.current
|
|
1910
|
+
), [F, T] = E(
|
|
1911
|
+
() => Array.from(
|
|
1912
|
+
l.current.model.surfacesMap.values()
|
|
1913
|
+
)
|
|
1437
1914
|
);
|
|
1438
|
-
return
|
|
1439
|
-
|
|
1440
|
-
}), []),
|
|
1441
|
-
|
|
1442
|
-
}, [
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
},
|
|
1915
|
+
return V(() => (u.current = !0, () => {
|
|
1916
|
+
u.current = !1;
|
|
1917
|
+
}), []), V(() => {
|
|
1918
|
+
l.current = S;
|
|
1919
|
+
}, [S]), V(() => {
|
|
1920
|
+
const f = () => {
|
|
1921
|
+
u.current && T(Array.from(S.model.surfacesMap.values()));
|
|
1922
|
+
}, h = S.onSurfaceCreated(f), k = S.onSurfaceDeleted(f);
|
|
1446
1923
|
return () => {
|
|
1447
|
-
|
|
1924
|
+
h.unsubscribe(), k.unsubscribe();
|
|
1448
1925
|
};
|
|
1449
|
-
}, [
|
|
1450
|
-
let
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1453
|
-
const
|
|
1454
|
-
return
|
|
1455
|
-
|
|
1926
|
+
}, [S]), V(() => {
|
|
1927
|
+
let f = !1;
|
|
1928
|
+
const h = m.current !== t;
|
|
1929
|
+
if (m.current = t, h) {
|
|
1930
|
+
const P = ae();
|
|
1931
|
+
return Array.isArray(e) && e.length > 0 ? (P.processMessages(e), f || p(P, e)) : (l.current = P, i.current = 0, c.current = "", f || (C(P), T([]))), () => {
|
|
1932
|
+
f = !0;
|
|
1456
1933
|
};
|
|
1457
1934
|
}
|
|
1458
1935
|
if (!Array.isArray(e) || e.length === 0) {
|
|
1459
1936
|
if (i.current > 0) {
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1937
|
+
const P = ae();
|
|
1938
|
+
l.current = P, i.current = 0, c.current = "", f || (C(P), T([]));
|
|
1462
1939
|
}
|
|
1463
1940
|
return () => {
|
|
1464
|
-
|
|
1941
|
+
f = !0;
|
|
1465
1942
|
};
|
|
1466
1943
|
}
|
|
1467
|
-
const k =
|
|
1468
|
-
if (e.length <
|
|
1469
|
-
const
|
|
1470
|
-
return
|
|
1471
|
-
|
|
1944
|
+
const k = l.current, v = i.current;
|
|
1945
|
+
if (e.length < v || y(e, v)) {
|
|
1946
|
+
const P = ae();
|
|
1947
|
+
return P.processMessages(e), f || p(P, e), () => {
|
|
1948
|
+
f = !0;
|
|
1472
1949
|
};
|
|
1473
1950
|
}
|
|
1474
|
-
const
|
|
1475
|
-
return
|
|
1476
|
-
|
|
1477
|
-
} : (k.processMessages(
|
|
1478
|
-
|
|
1951
|
+
const b = e.slice(v);
|
|
1952
|
+
return b.length === 0 ? () => {
|
|
1953
|
+
f = !0;
|
|
1954
|
+
} : (k.processMessages(b), i.current = e.length, c.current = JSON.stringify(e), f || T(Array.from(k.model.surfacesMap.values())), () => {
|
|
1955
|
+
f = !0;
|
|
1479
1956
|
});
|
|
1480
|
-
}, [e, t]),
|
|
1957
|
+
}, [e, t]), F.length === 0 ? /* @__PURE__ */ s(De, { children: n }) : /* @__PURE__ */ s(at, { resumeSearch: o, children: /* @__PURE__ */ s(rt, { caseSearch: a, children: /* @__PURE__ */ s(et, { interactive: r, children: /* @__PURE__ */ s("div", { className: "a2ui-surface a2ui-container", children: F.map((f) => /* @__PURE__ */ s(Ye, { surface: f }, f.id)) }) }) }) });
|
|
1481
1958
|
}
|
|
1482
|
-
function
|
|
1959
|
+
function Br({
|
|
1483
1960
|
payload: e,
|
|
1484
1961
|
callbackUrl: t,
|
|
1485
|
-
title:
|
|
1486
|
-
unpublishedFormId:
|
|
1962
|
+
title: n,
|
|
1963
|
+
unpublishedFormId: r,
|
|
1487
1964
|
incompleteFormId: o,
|
|
1488
|
-
onNotify:
|
|
1965
|
+
onNotify: a
|
|
1489
1966
|
}) {
|
|
1490
|
-
const
|
|
1491
|
-
() =>
|
|
1967
|
+
const l = O(
|
|
1968
|
+
() => Gn(e, t),
|
|
1492
1969
|
[e, t]
|
|
1493
1970
|
);
|
|
1494
|
-
async function
|
|
1971
|
+
async function i() {
|
|
1495
1972
|
try {
|
|
1496
|
-
await
|
|
1973
|
+
await pt(l), a == null || a("success", "已复制到剪贴板");
|
|
1497
1974
|
} catch {
|
|
1498
|
-
|
|
1975
|
+
a == null || a("error", "复制失败");
|
|
1499
1976
|
}
|
|
1500
1977
|
}
|
|
1501
|
-
return /* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */ s(
|
|
1505
|
-
|
|
1506
|
-
o ? /* @__PURE__ */ s(
|
|
1978
|
+
return /* @__PURE__ */ x("div", { className: "ask-user-curl-card", children: [
|
|
1979
|
+
/* @__PURE__ */ x("div", { className: "ask-user-curl-card-header", children: [
|
|
1980
|
+
/* @__PURE__ */ x("div", { className: "ask-user-curl-card-header-title", children: [
|
|
1981
|
+
/* @__PURE__ */ s(L.Text, { type: "secondary", children: n ?? "curl 命令" }),
|
|
1982
|
+
r ? /* @__PURE__ */ s(ie, { title: r, children: /* @__PURE__ */ s(Z, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
|
|
1983
|
+
o ? /* @__PURE__ */ s(ie, { title: o, children: /* @__PURE__ */ s(Z, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
|
|
1507
1984
|
] }),
|
|
1508
|
-
/* @__PURE__ */ s(
|
|
1985
|
+
/* @__PURE__ */ s(ue, { size: "small", type: "text", onClick: () => void i(), children: "复制" })
|
|
1509
1986
|
] }),
|
|
1510
|
-
/* @__PURE__ */ s("pre", { className: "skopon-form-curl-json", children:
|
|
1987
|
+
/* @__PURE__ */ s("pre", { className: "skopon-form-curl-json", children: l })
|
|
1511
1988
|
] });
|
|
1512
1989
|
}
|
|
1513
|
-
function
|
|
1990
|
+
function Vr(e, t) {
|
|
1514
1991
|
if (t && typeof t == "object" && t !== null && "message" in t) {
|
|
1515
|
-
const
|
|
1516
|
-
if (typeof
|
|
1517
|
-
return `提交失败 (${e}): ${
|
|
1992
|
+
const n = t.message;
|
|
1993
|
+
if (typeof n == "string" && n.trim())
|
|
1994
|
+
return `提交失败 (${e}): ${n.trim()}`;
|
|
1518
1995
|
}
|
|
1519
1996
|
return typeof t == "string" && t.trim() ? `提交失败 (${e}): ${t.trim()}` : `提交失败 (${e})`;
|
|
1520
1997
|
}
|
|
1521
|
-
function
|
|
1998
|
+
function Qr({
|
|
1522
1999
|
payload: e,
|
|
1523
2000
|
formUniqueId: t,
|
|
1524
|
-
callbackUrl:
|
|
1525
|
-
submitMode:
|
|
2001
|
+
callbackUrl: n,
|
|
2002
|
+
submitMode: r = "curl",
|
|
1526
2003
|
fetchFormDetail: o,
|
|
1527
|
-
onNotify:
|
|
2004
|
+
onNotify: a,
|
|
2005
|
+
resumeSearch: l = null,
|
|
2006
|
+
caseSearch: i = null
|
|
1528
2007
|
}) {
|
|
1529
|
-
const [
|
|
1530
|
-
h.current =
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
}), []),
|
|
1535
|
-
let
|
|
1536
|
-
return
|
|
1537
|
-
|
|
1538
|
-
}).catch((
|
|
1539
|
-
var
|
|
1540
|
-
if (!
|
|
1541
|
-
|
|
1542
|
-
const
|
|
1543
|
-
(
|
|
2008
|
+
const [c, u] = E(null), [m, p] = E(!1), [y, S] = E(!0), [C, F] = E(!1), T = B(null), f = B(!0), h = B(a);
|
|
2009
|
+
h.current = a;
|
|
2010
|
+
const k = (t == null ? void 0 : t.trim()) ?? "";
|
|
2011
|
+
V(() => (f.current = !0, () => {
|
|
2012
|
+
f.current = !1;
|
|
2013
|
+
}), []), V(() => {
|
|
2014
|
+
let g = !1;
|
|
2015
|
+
return k ? (S(!0), p(!1), o({ formUniqueId: k }).then((A) => {
|
|
2016
|
+
g || (p(!!A.disabled), u(A.formDefinition ?? null));
|
|
2017
|
+
}).catch((A) => {
|
|
2018
|
+
var M;
|
|
2019
|
+
if (!g) {
|
|
2020
|
+
p(!1), u(null);
|
|
2021
|
+
const I = A instanceof Error ? A.message : "获取表单定义失败";
|
|
2022
|
+
(M = h.current) == null || M.call(h, "error", I);
|
|
1544
2023
|
}
|
|
1545
2024
|
}).finally(() => {
|
|
1546
|
-
|
|
2025
|
+
g || S(!1);
|
|
1547
2026
|
}), () => {
|
|
1548
|
-
|
|
1549
|
-
}) : (
|
|
1550
|
-
|
|
2027
|
+
g = !0;
|
|
2028
|
+
}) : (S(!1), p(!1), u(null), () => {
|
|
2029
|
+
g = !0;
|
|
1551
2030
|
});
|
|
1552
|
-
}, [
|
|
1553
|
-
const v =
|
|
1554
|
-
() =>
|
|
1555
|
-
[
|
|
1556
|
-
),
|
|
1557
|
-
var
|
|
1558
|
-
return (
|
|
1559
|
-
}).map((
|
|
1560
|
-
if (
|
|
1561
|
-
const
|
|
1562
|
-
return
|
|
1563
|
-
}, [b, v,
|
|
1564
|
-
if (
|
|
1565
|
-
return /* @__PURE__ */ s("div", { className: "ask-user-form-card", children: /* @__PURE__ */ s(
|
|
1566
|
-
if (!v ||
|
|
2031
|
+
}, [k, o]);
|
|
2032
|
+
const v = O(() => nr(e), [e]), b = O(() => v ? rr(v, c ?? void 0) : null, [v, c]), P = (b == null ? void 0 : b.matchedBlocks) ?? [], R = !!(v && lr(v) && P.length === 0), _ = O(() => R && v ? ir(v) : b && b.renderBlocks.length > 0 ? b.renderBlocks : [], [b, R, v]), w = O(
|
|
2033
|
+
() => R ? {} : ar((b == null ? void 0 : b.extraBlocks) ?? []),
|
|
2034
|
+
[R, b]
|
|
2035
|
+
), q = O(() => R && v ? sr(v) : _.filter((g) => {
|
|
2036
|
+
var A;
|
|
2037
|
+
return (A = g.name) == null ? void 0 : A.trim();
|
|
2038
|
+
}).map((g) => g.name.trim()), [R, v, _]), K = O(() => {
|
|
2039
|
+
if (_.length === 0) return null;
|
|
2040
|
+
const g = (b == null ? void 0 : b.title) ?? (v == null ? void 0 : v.title) ?? "", A = (b == null ? void 0 : b.description) ?? (v == null ? void 0 : v.description) ?? "";
|
|
2041
|
+
return Hn({ title: g, description: A }, _);
|
|
2042
|
+
}, [b, v, _]), Y = k ? `ask-user-${k}` : "ask-user-payload";
|
|
2043
|
+
if (y)
|
|
2044
|
+
return /* @__PURE__ */ s("div", { className: "ask-user-form-card", children: /* @__PURE__ */ s(Ue, { size: "small" }) });
|
|
2045
|
+
if (!v || _.length === 0)
|
|
1567
2046
|
return /* @__PURE__ */ s(
|
|
1568
|
-
|
|
2047
|
+
Br,
|
|
1569
2048
|
{
|
|
1570
2049
|
payload: e,
|
|
1571
|
-
callbackUrl:
|
|
1572
|
-
unpublishedFormId:
|
|
1573
|
-
onNotify:
|
|
2050
|
+
callbackUrl: n,
|
|
2051
|
+
unpublishedFormId: m && k ? k : void 0,
|
|
2052
|
+
onNotify: a
|
|
1574
2053
|
}
|
|
1575
2054
|
);
|
|
1576
|
-
async function
|
|
1577
|
-
var
|
|
1578
|
-
if (!
|
|
1579
|
-
|
|
2055
|
+
async function X() {
|
|
2056
|
+
var g, A, M, I, Oe, Be;
|
|
2057
|
+
if (!C) {
|
|
2058
|
+
F(!0);
|
|
1580
2059
|
try {
|
|
1581
|
-
const
|
|
1582
|
-
if (
|
|
1583
|
-
const
|
|
1584
|
-
if (!
|
|
1585
|
-
(
|
|
2060
|
+
const G = ((g = T.current) == null ? void 0 : g.getValues(q)) ?? {}, fe = { ...G, ...w };
|
|
2061
|
+
if (r === "post") {
|
|
2062
|
+
const Ve = (n ?? "").trim();
|
|
2063
|
+
if (!Ve) {
|
|
2064
|
+
(A = h.current) == null || A.call(h, "error", "callback_url 为空,无法提交");
|
|
1586
2065
|
return;
|
|
1587
2066
|
}
|
|
1588
|
-
const
|
|
1589
|
-
if (!
|
|
1590
|
-
|
|
2067
|
+
const he = await cr(Ve, fe);
|
|
2068
|
+
if (!f.current) return;
|
|
2069
|
+
he.ok ? (M = h.current) == null || M.call(h, "success", "提交成功") : (I = h.current) == null || I.call(h, "error", Vr(he.status, he.body));
|
|
1591
2070
|
return;
|
|
1592
2071
|
}
|
|
1593
|
-
if (await
|
|
1594
|
-
|
|
1595
|
-
), !
|
|
1596
|
-
(
|
|
1597
|
-
} catch (
|
|
1598
|
-
if (!
|
|
1599
|
-
const
|
|
1600
|
-
(
|
|
2072
|
+
if (await pt(
|
|
2073
|
+
Zn({ cardValues: G, extraValues: w, callbackUrl: n })
|
|
2074
|
+
), !f.current) return;
|
|
2075
|
+
(Oe = h.current) == null || Oe.call(h, "success", "已复制 curl 到剪贴板");
|
|
2076
|
+
} catch (G) {
|
|
2077
|
+
if (!f.current) return;
|
|
2078
|
+
const fe = G instanceof Error ? G.message : "复制失败";
|
|
2079
|
+
(Be = h.current) == null || Be.call(h, "error", fe);
|
|
1601
2080
|
} finally {
|
|
1602
|
-
|
|
2081
|
+
f.current && F(!1);
|
|
1603
2082
|
}
|
|
1604
2083
|
}
|
|
1605
2084
|
}
|
|
1606
|
-
return /* @__PURE__ */
|
|
1607
|
-
|
|
2085
|
+
return /* @__PURE__ */ x("div", { className: "ask-user-form-card", children: [
|
|
2086
|
+
m && k ? /* @__PURE__ */ s("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ s(ie, { title: k, children: /* @__PURE__ */ s(Z, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) }) : null,
|
|
1608
2087
|
/* @__PURE__ */ s(
|
|
1609
|
-
|
|
2088
|
+
Or,
|
|
1610
2089
|
{
|
|
1611
|
-
ref:
|
|
1612
|
-
doc:
|
|
1613
|
-
surfaceId:
|
|
1614
|
-
fieldNames:
|
|
1615
|
-
interactive: !0
|
|
2090
|
+
ref: T,
|
|
2091
|
+
doc: K,
|
|
2092
|
+
surfaceId: Y,
|
|
2093
|
+
fieldNames: q,
|
|
2094
|
+
interactive: !0,
|
|
2095
|
+
resumeSearch: l,
|
|
2096
|
+
caseSearch: i
|
|
1616
2097
|
}
|
|
1617
2098
|
),
|
|
1618
|
-
/* @__PURE__ */ s("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ s(
|
|
1619
|
-
|
|
2099
|
+
/* @__PURE__ */ s("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ s(ie, { title: r === "curl" ? "点击复制 curl" : "提交 JSON 到 callback_url", children: /* @__PURE__ */ s(
|
|
2100
|
+
ue,
|
|
1620
2101
|
{
|
|
1621
2102
|
type: "primary",
|
|
1622
2103
|
size: "small",
|
|
1623
|
-
loading:
|
|
1624
|
-
disabled:
|
|
1625
|
-
onClick: () => void
|
|
2104
|
+
loading: C,
|
|
2105
|
+
disabled: C,
|
|
2106
|
+
onClick: () => void X(),
|
|
1626
2107
|
children: "提交"
|
|
1627
2108
|
}
|
|
1628
2109
|
) }) })
|
|
1629
2110
|
] });
|
|
1630
2111
|
}
|
|
1631
2112
|
export {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
2113
|
+
Gr as A2UI_PROTOCOL_VERSION,
|
|
2114
|
+
Qr as AskUserFormCard,
|
|
2115
|
+
rt as CaseSearchProvider,
|
|
2116
|
+
Br as CurlSubmitBlock,
|
|
2117
|
+
Ut as FORM_MEDIA_SIZES,
|
|
2118
|
+
at as ResumeSearchProvider,
|
|
2119
|
+
Zr as SkoponA2uiStreamRenderer,
|
|
2120
|
+
Or as SkoponFormRenderer,
|
|
2121
|
+
Dn as a2uiToBlocks,
|
|
2122
|
+
it as blocksToA2ui,
|
|
2123
|
+
Wn as buildAskUserCurlBodyJson,
|
|
2124
|
+
Zn as buildAskUserCurlStatement,
|
|
2125
|
+
Hn as buildAskUserSurface,
|
|
2126
|
+
Gn as buildCurlStatement,
|
|
2127
|
+
pt as copyTextToClipboard,
|
|
2128
|
+
Wr as createFormClient,
|
|
2129
|
+
ar as extractExtraBlockValues,
|
|
2130
|
+
Xn as extractSurfaceValues,
|
|
2131
|
+
sr as getPayloadInputFieldNames,
|
|
2132
|
+
ir as getPayloadRenderableBlocks,
|
|
2133
|
+
rr as intersectPayloadBlocksWithForm,
|
|
2134
|
+
Me as isA2uiSurfaceEmpty,
|
|
2135
|
+
J as isInputBlockType,
|
|
2136
|
+
_e as isLayoutBlockType,
|
|
2137
|
+
Ie as isMediaBlockType,
|
|
2138
|
+
Yn as mapFormDefinitionFromDto,
|
|
2139
|
+
H as normalizeFormDefinition,
|
|
2140
|
+
nr as parsePayloadBlocksJson,
|
|
2141
|
+
lr as payloadHasInputBlocks,
|
|
2142
|
+
Jn as resolveSurfaceFromFormDefinition,
|
|
2143
|
+
cr as submitFormJson,
|
|
2144
|
+
Kn as surfaceDocToMessages,
|
|
2145
|
+
se as syncFormDefinition,
|
|
2146
|
+
un as useCaseSearch,
|
|
2147
|
+
bn as useResumeSearch
|
|
1663
2148
|
};
|