@sim-design/training 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +33 -0
  2. package/dist/ArrowLeftOutlined-CiSQq3bL.js +12 -0
  3. package/dist/AssessmentPlugin-Bx4VrBdV.js +607 -0
  4. package/dist/CaseAnalysisPlugin-CQvF9_zr.js +416 -0
  5. package/dist/CharacterDialoguePanel-Bvdab3qj.js +776 -0
  6. package/dist/CheckCircleFilled-Byo8CDfW.js +12 -0
  7. package/dist/CustomLayoutRenderer--rnQrqQ2.js +122524 -0
  8. package/dist/DecisionSelectPlugin-DtQ2KV34.js +863 -0
  9. package/dist/DecisionShared-Dh9oeQFT.js +65 -0
  10. package/dist/DialogueFormPlugin-C9ssnVMr.js +959 -0
  11. package/dist/DialoguePlugin-DU00QpmQ.js +416 -0
  12. package/dist/DocumentReviewPlugin-HNOZY1T4.js +977 -0
  13. package/dist/EyeOutlined-XvOAKlLs.js +12 -0
  14. package/dist/FormFillingPlugin-DURWsioi.js +445 -0
  15. package/dist/ModelEditor-BPJsPR0S.js +8264 -0
  16. package/dist/PluginHeader-B-GESJmT.js +87 -0
  17. package/dist/ProcessOperationPlugin-IijngDlX.js +88 -0
  18. package/dist/QAPlugin-Bh_UjK1N.js +184 -0
  19. package/dist/RadarChart-C5ZM0kWt.js +24963 -0
  20. package/dist/ReloadOutlined-Daor2m11.js +12 -0
  21. package/dist/SettingOutlined-CLEOgXB-.js +92 -0
  22. package/dist/StrategyLabPlugin-DGeZsr_7.js +14361 -0
  23. package/dist/ThunderboltOutlined-nH_FO_4A.js +44 -0
  24. package/dist/ToolOutlined-DtuNJDB2.js +28 -0
  25. package/dist/TrainingModelContainer-DpW-uB8O.js +11883 -0
  26. package/dist/UndoOutlined-ChUQYUul.js +84 -0
  27. package/dist/WarningFilled-1Rc4hr0C.js +12 -0
  28. package/dist/WarningOutlined-5g1d66hO.js +164 -0
  29. package/dist/adapters-D1FFZFoA.js +51 -0
  30. package/dist/analysisTools-CXyOvSZT.js +237 -0
  31. package/dist/creator.js +5 -0
  32. package/dist/index-CYjdXPgc.js +6568 -0
  33. package/dist/index-XuBVjlmu.js +44651 -0
  34. package/dist/index.js +11 -0
  35. package/dist/judgement-D_9i7x9S.js +20 -0
  36. package/dist/runtime.js +4 -0
  37. package/dist/types.js +8 -0
  38. package/dist/useDialogueLogic-IHELcN3X.js +368 -0
  39. package/dist-types/client/src/lib/adapters.d.ts +10 -0
  40. package/dist-types/client/src/lib/creator.d.ts +3 -0
  41. package/dist-types/client/src/lib/creatorIntegrationContext.d.ts +8 -0
  42. package/dist-types/client/src/lib/index.d.ts +5 -0
  43. package/dist-types/client/src/lib/public-types.d.ts +2 -0
  44. package/dist-types/client/src/lib/runtime.d.ts +3 -0
  45. package/dist-types/client/src/lib/types.d.ts +301 -0
  46. package/package.json +83 -0
@@ -0,0 +1,12 @@
1
+ import { I as r, _ as n } from "./RadarChart-C5ZM0kWt.js";
2
+ import * as e from "react";
3
+ var c = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, name: "eye", theme: "outlined" }, o = function(t, a) {
4
+ return /* @__PURE__ */ e.createElement(r, n({}, t, {
5
+ ref: a,
6
+ icon: c
7
+ }));
8
+ }, i = /* @__PURE__ */ e.forwardRef(o);
9
+ process.env.NODE_ENV !== "production" && (i.displayName = "EyeOutlined");
10
+ export {
11
+ i as R
12
+ };
@@ -0,0 +1,445 @@
1
+ import { j as r, c as D } from "./RadarChart-C5ZM0kWt.js";
2
+ import { useState as J, useRef as K, useCallback as ee, useMemo as re } from "react";
3
+ import { Form as z, Button as M, Row as oe, Col as te, Collapse as W, Typography as Q, Card as se, Divider as ne, Steps as le, Space as ae, Alert as H, Input as U, InputNumber as ce, Select as X } from "antd";
4
+ import { P as ie } from "./PluginHeader-B-GESJmT.js";
5
+ import { a as _ } from "./judgement-D_9i7x9S.js";
6
+ import { u as me, C as ue } from "./CustomLayoutRenderer--rnQrqQ2.js";
7
+ const Y = ({ buttonText: e, theme: a, onSubmit: c }) => /* @__PURE__ */ r.jsx(z.Item, { children: /* @__PURE__ */ r.jsx(
8
+ M,
9
+ {
10
+ type: "primary",
11
+ size: "large",
12
+ onClick: c,
13
+ block: !0,
14
+ style: { backgroundColor: a.primaryColor, borderColor: a.primaryColor },
15
+ children: e
16
+ }
17
+ ) });
18
+ function de(e, a) {
19
+ if (!a || a.length === 0)
20
+ return [{ group: null, fields: e }];
21
+ const c = new Map(e.map((m) => [m.name, m])), i = /* @__PURE__ */ new Set(), s = [];
22
+ for (const m of a) {
23
+ const C = m.fields.map((f) => c.get(f)).filter(Boolean);
24
+ C.forEach((f) => i.add(f.name)), s.push({ group: m, fields: C });
25
+ }
26
+ const n = e.filter((m) => !i.has(m.name));
27
+ return n.length > 0 && s.push({ group: null, fields: n }), s;
28
+ }
29
+ function P(e, a, c, i) {
30
+ const s = Math.floor(24 / a);
31
+ return /* @__PURE__ */ r.jsx(oe, { gutter: 16, children: e.map((n) => {
32
+ const m = Math.min((n.colSpan || 1) * s, 24);
33
+ return /* @__PURE__ */ r.jsx(te, { span: m, style: n.style, children: /* @__PURE__ */ r.jsx(
34
+ z.Item,
35
+ {
36
+ name: n.name,
37
+ label: n.label,
38
+ required: n.required,
39
+ validateStatus: c[n.name] ? "error" : "",
40
+ help: c[n.name],
41
+ rules: [
42
+ {
43
+ required: n.required,
44
+ message: `${n.label}为必填项`
45
+ }
46
+ ],
47
+ children: i(n)
48
+ }
49
+ ) }, n.name);
50
+ }) });
51
+ }
52
+ const { Text: V } = Q, Z = ({
53
+ fields: e,
54
+ groups: a,
55
+ columns: c,
56
+ theme: i,
57
+ labelLayout: s,
58
+ groupStyle: n,
59
+ formInstance: m,
60
+ formData: C,
61
+ validationErrors: f,
62
+ renderFormField: L,
63
+ onValuesChange: S,
64
+ onSubmit: k,
65
+ submitButtonText: b
66
+ }) => {
67
+ const j = de(e, a), [I, o] = J(
68
+ () => j.filter((t) => !t.group || t.group.defaultExpanded !== !1).map((t, u) => String(u))
69
+ ), w = (t, u) => {
70
+ var $;
71
+ const T = (($ = t.group) == null ? void 0 : $.columns) || c, l = P(t.fields, T, f, L);
72
+ if (!t.group)
73
+ return /* @__PURE__ */ r.jsx("div", { children: l }, `ungrouped-${u}`);
74
+ const { title: g, description: d, style: v, collapsible: E } = t.group;
75
+ return n === "none" ? /* @__PURE__ */ r.jsx("div", { style: v, children: l }, t.group.key) : n === "card" ? E ? /* @__PURE__ */ r.jsx(
76
+ W,
77
+ {
78
+ defaultActiveKey: t.group.defaultExpanded !== !1 ? [t.group.key] : [],
79
+ style: { marginBottom: 16, ...v },
80
+ items: [{
81
+ key: t.group.key,
82
+ label: /* @__PURE__ */ r.jsxs("span", { children: [
83
+ g,
84
+ d && /* @__PURE__ */ r.jsx(V, { type: "secondary", style: { marginLeft: 8, fontSize: 12 }, children: d })
85
+ ] }),
86
+ children: l
87
+ }]
88
+ },
89
+ t.group.key
90
+ ) : /* @__PURE__ */ r.jsx(
91
+ se,
92
+ {
93
+ title: /* @__PURE__ */ r.jsxs("span", { children: [
94
+ g,
95
+ d && /* @__PURE__ */ r.jsx(V, { type: "secondary", style: { marginLeft: 8, fontSize: 12, fontWeight: "normal" }, children: d })
96
+ ] }),
97
+ size: "small",
98
+ style: {
99
+ marginBottom: 16,
100
+ borderColor: i.borderColor,
101
+ borderRadius: i.borderRadius,
102
+ ...v
103
+ },
104
+ styles: {
105
+ header: {
106
+ backgroundColor: i.headerBg,
107
+ color: i.headerColor
108
+ }
109
+ },
110
+ children: l
111
+ },
112
+ t.group.key
113
+ ) : E ? /* @__PURE__ */ r.jsx(
114
+ W,
115
+ {
116
+ ghost: !0,
117
+ defaultActiveKey: t.group.defaultExpanded !== !1 ? [t.group.key] : [],
118
+ activeKey: I.includes(String(u)) ? [t.group.key] : [],
119
+ onChange: (O) => {
120
+ o(
121
+ (y) => O.length > 0 ? [...y, String(u)] : y.filter((x) => x !== String(u))
122
+ );
123
+ },
124
+ style: v,
125
+ items: [{
126
+ key: t.group.key,
127
+ label: /* @__PURE__ */ r.jsxs("span", { children: [
128
+ g,
129
+ d && /* @__PURE__ */ r.jsx(V, { type: "secondary", style: { marginLeft: 8, fontSize: 12 }, children: d })
130
+ ] }),
131
+ children: l
132
+ }]
133
+ },
134
+ t.group.key
135
+ ) : /* @__PURE__ */ r.jsxs("div", { style: v, children: [
136
+ /* @__PURE__ */ r.jsxs(ne, { orientation: "left", style: { marginTop: 8, marginBottom: 16 }, children: [
137
+ g,
138
+ d && /* @__PURE__ */ r.jsx(V, { type: "secondary", style: { marginLeft: 8, fontSize: 12 }, children: d })
139
+ ] }),
140
+ l
141
+ ] }, t.group.key);
142
+ };
143
+ return /* @__PURE__ */ r.jsxs(
144
+ z,
145
+ {
146
+ form: m,
147
+ layout: s,
148
+ labelCol: s === "horizontal" ? { span: 8 } : void 0,
149
+ wrapperCol: s === "horizontal" ? { span: 16 } : void 0,
150
+ initialValues: C,
151
+ onValuesChange: (t) => S(t),
152
+ children: [
153
+ j.map((t, u) => w(t, u)),
154
+ k && /* @__PURE__ */ r.jsx(
155
+ Y,
156
+ {
157
+ buttonText: b || "提交",
158
+ theme: i,
159
+ onSubmit: k
160
+ }
161
+ )
162
+ ]
163
+ }
164
+ );
165
+ }, { Text: pe } = Q, ye = ({
166
+ fields: e,
167
+ groups: a,
168
+ columns: c,
169
+ theme: i,
170
+ labelLayout: s,
171
+ formInstance: n,
172
+ formData: m,
173
+ validationErrors: C,
174
+ renderFormField: f,
175
+ onValuesChange: L,
176
+ onSubmit: S,
177
+ submitButtonText: k
178
+ }) => {
179
+ const [b, j] = J(0), I = new Map(e.map((l) => [l.name, l]));
180
+ if (!a || a.length === 0)
181
+ return /* @__PURE__ */ r.jsxs(
182
+ z,
183
+ {
184
+ form: n,
185
+ layout: s,
186
+ labelCol: s === "horizontal" ? { span: 8 } : void 0,
187
+ wrapperCol: s === "horizontal" ? { span: 16 } : void 0,
188
+ initialValues: m,
189
+ onValuesChange: (l) => L(l),
190
+ children: [
191
+ P(e, c, C, f),
192
+ S && /* @__PURE__ */ r.jsx(
193
+ Y,
194
+ {
195
+ buttonText: k || "提交",
196
+ theme: i,
197
+ onSubmit: S
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ );
203
+ const o = a[b], w = o ? o.fields.map((l) => I.get(l)).filter(Boolean) : [], t = (o == null ? void 0 : o.columns) || c, u = async () => {
204
+ const l = w.map((g) => g.name);
205
+ try {
206
+ await n.validateFields(l), j((g) => Math.min(g + 1, a.length - 1));
207
+ } catch {
208
+ }
209
+ }, T = () => {
210
+ j((l) => Math.max(l - 1, 0));
211
+ };
212
+ return /* @__PURE__ */ r.jsxs("div", { children: [
213
+ /* @__PURE__ */ r.jsx(
214
+ le,
215
+ {
216
+ current: b,
217
+ items: a.map((l) => ({ title: l.title })),
218
+ style: { marginBottom: 24 },
219
+ size: "small"
220
+ }
221
+ ),
222
+ /* @__PURE__ */ r.jsxs(
223
+ z,
224
+ {
225
+ form: n,
226
+ layout: s,
227
+ labelCol: s === "horizontal" ? { span: 8 } : void 0,
228
+ wrapperCol: s === "horizontal" ? { span: 16 } : void 0,
229
+ initialValues: m,
230
+ onValuesChange: (l) => L(l),
231
+ children: [
232
+ (o == null ? void 0 : o.description) && /* @__PURE__ */ r.jsx(pe, { type: "secondary", style: { display: "block", marginBottom: 16 }, children: o.description }),
233
+ /* @__PURE__ */ r.jsx("div", { style: o == null ? void 0 : o.style, children: P(w, t, C, f) }),
234
+ /* @__PURE__ */ r.jsx(z.Item, { children: /* @__PURE__ */ r.jsxs(ae, { children: [
235
+ b > 0 && /* @__PURE__ */ r.jsx(M, { onClick: T, children: "上一步" }),
236
+ b < a.length - 1 ? /* @__PURE__ */ r.jsx(
237
+ M,
238
+ {
239
+ type: "primary",
240
+ onClick: u,
241
+ style: {
242
+ backgroundColor: i.primaryColor,
243
+ borderColor: i.primaryColor
244
+ },
245
+ children: "下一步"
246
+ }
247
+ ) : /* @__PURE__ */ r.jsx(
248
+ M,
249
+ {
250
+ type: "primary",
251
+ onClick: S,
252
+ style: {
253
+ backgroundColor: i.primaryColor,
254
+ borderColor: i.primaryColor
255
+ },
256
+ children: k || "提交"
257
+ }
258
+ )
259
+ ] }) })
260
+ ]
261
+ }
262
+ )
263
+ ] });
264
+ }, { Option: he } = X, { TextArea: fe } = U, ge = {
265
+ form: Z,
266
+ stepper: ye
267
+ }, we = ({
268
+ initData: e,
269
+ checkRules: a,
270
+ onFinish: c,
271
+ onRealtimeData: i
272
+ }) => {
273
+ const s = (e == null ? void 0 : e.uiConfig) || {}, n = D(s.theme), m = s.layout || "form", C = s.labelLayout || "vertical", f = s.groupStyle || "divider", L = s.columns || 1, S = s.groups || [], k = s.headerVariant || "card", b = s.submitButtonText || "提交申请书", j = s.customLayoutCode, o = me(e, { onRealtimeData: i, isCustomLayout: !!j }), w = K(c), t = K(e), u = K(o);
274
+ w.current = c, t.current = e, u.current = o;
275
+ const T = ee(async () => {
276
+ var y, x, F, B, p;
277
+ try {
278
+ await u.current.stableOnSubmit();
279
+ const h = u.current.formData, R = ((y = u.current.resolvedTemplate) == null ? void 0 : y.fields) || [], q = Object.keys(h).filter(
280
+ (N) => h[N] != null && h[N] !== ""
281
+ );
282
+ w.current({
283
+ stepId: ((x = t.current) == null ? void 0 : x.stepId) || "unknown",
284
+ operationType: "form-submit",
285
+ operationData: h,
286
+ operationLog: [
287
+ {
288
+ action: "submit",
289
+ data: h,
290
+ timestamp: Date.now()
291
+ }
292
+ ],
293
+ timestamp: Date.now(),
294
+ evidenceSummary: _({
295
+ sourceStepId: ((F = t.current) == null ? void 0 : F.stepId) || "unknown",
296
+ sourceStepName: ((B = t.current) == null ? void 0 : B.stepName) || "表单填写",
297
+ sourceType: "form-filling",
298
+ title: `${((p = t.current) == null ? void 0 : p.stepName) || "表单填写"}摘要`,
299
+ summary: `已完成表单填写,共 ${q.length} 个字段。`,
300
+ keyFacts: q.slice(0, 5).map((N) => {
301
+ var A;
302
+ return {
303
+ label: ((A = R.find((G) => G.name === N)) == null ? void 0 : A.label) || N,
304
+ value: String(h[N] ?? "")
305
+ };
306
+ })
307
+ })
308
+ });
309
+ } catch (h) {
310
+ console.error("表单提交失败:", h);
311
+ }
312
+ }, []), l = re(() => ({
313
+ theme: n,
314
+ formData: { ...o.formData },
315
+ onValueChange: o.stableOnValueChange,
316
+ onSubmit: T
317
+ }), [n, o.formData, o.stableOnValueChange, T]), g = async () => {
318
+ var y;
319
+ try {
320
+ if (await o.form.validateFields(), Object.keys(o.validationErrors).some(
321
+ (p) => o.validationErrors[p] && !o.validationErrors[p].startsWith("⚠️")
322
+ )) {
323
+ console.error("请修正表单错误后再提交");
324
+ return;
325
+ }
326
+ const F = Object.keys(o.formData).filter((p) => o.formData[p] != null && o.formData[p] !== ""), B = ((y = o.resolvedTemplate) == null ? void 0 : y.fields) || [];
327
+ c({
328
+ stepId: (e == null ? void 0 : e.stepId) || "unknown",
329
+ operationType: "form-submit",
330
+ operationData: o.formData,
331
+ operationLog: [
332
+ {
333
+ action: "submit",
334
+ data: o.formData,
335
+ timestamp: Date.now()
336
+ }
337
+ ],
338
+ timestamp: Date.now(),
339
+ evidenceSummary: _({
340
+ sourceStepId: (e == null ? void 0 : e.stepId) || "unknown",
341
+ sourceStepName: (e == null ? void 0 : e.stepName) || "表单填写",
342
+ sourceType: "form-filling",
343
+ title: `${(e == null ? void 0 : e.stepName) || "表单填写"}摘要`,
344
+ summary: `已完成表单填写,共 ${F.length} 个字段。`,
345
+ keyFacts: F.slice(0, 5).map((p) => {
346
+ var h;
347
+ return {
348
+ label: ((h = B.find((R) => R.name === p)) == null ? void 0 : h.label) || p,
349
+ value: String(o.formData[p] ?? "")
350
+ };
351
+ })
352
+ })
353
+ });
354
+ } catch (x) {
355
+ console.error("表单验证失败:", x);
356
+ }
357
+ }, d = e == null ? void 0 : e.formTemplate, v = d == null ? void 0 : d.formName;
358
+ if (!d)
359
+ return /* @__PURE__ */ r.jsx(H, { message: "表单模板未找到", type: "error" });
360
+ if (!o.resolvedTemplate)
361
+ return /* @__PURE__ */ r.jsx(
362
+ H,
363
+ {
364
+ message: `表单 "${v}" 的模板未找到`,
365
+ description: "该表单引用了一个尚未注册的表单模板,请确保定义该表单的步骤已先执行过。",
366
+ type: "error",
367
+ showIcon: !0
368
+ }
369
+ );
370
+ const E = o.resolvedTemplate.fields || [], $ = ge[m] || Z, O = (y) => {
371
+ const x = Object.keys(y)[0], F = y[x];
372
+ o.handleFieldChange(x, F);
373
+ };
374
+ return j ? /* @__PURE__ */ r.jsx("div", { style: { padding: "20px", ...s.styleOverrides }, children: /* @__PURE__ */ r.jsx(
375
+ ue,
376
+ {
377
+ code: j,
378
+ scope: l
379
+ }
380
+ ) }) : /* @__PURE__ */ r.jsxs("div", { style: { padding: "20px", ...s.styleOverrides }, children: [
381
+ /* @__PURE__ */ r.jsx(
382
+ ie,
383
+ {
384
+ title: o.resolvedTemplate.formName || v,
385
+ variant: k,
386
+ theme: n
387
+ }
388
+ ),
389
+ /* @__PURE__ */ r.jsx(
390
+ $,
391
+ {
392
+ fields: E,
393
+ groups: S,
394
+ columns: L,
395
+ theme: n,
396
+ labelLayout: C,
397
+ groupStyle: f,
398
+ formInstance: o.form,
399
+ formData: o.formData,
400
+ validationErrors: o.validationErrors,
401
+ renderFormField: xe,
402
+ onValuesChange: O,
403
+ onSubmit: g,
404
+ submitButtonText: b
405
+ }
406
+ )
407
+ ] });
408
+ };
409
+ function xe(e) {
410
+ var a;
411
+ switch (e.type) {
412
+ case "select":
413
+ return /* @__PURE__ */ r.jsx(X, { placeholder: `请选择${e.label}`, children: (a = e.options) == null ? void 0 : a.map((c) => /* @__PURE__ */ r.jsx(he, { value: c, children: c }, c)) });
414
+ case "number":
415
+ return /* @__PURE__ */ r.jsx(
416
+ ce,
417
+ {
418
+ placeholder: `请输入${e.label}`,
419
+ min: e.min,
420
+ max: e.max,
421
+ style: { width: "100%" }
422
+ }
423
+ );
424
+ case "text":
425
+ default:
426
+ return e.maxLength && e.maxLength > 30 ? /* @__PURE__ */ r.jsx(
427
+ fe,
428
+ {
429
+ placeholder: `请输入${e.label}`,
430
+ maxLength: e.maxLength,
431
+ rows: 4,
432
+ showCount: !0
433
+ }
434
+ ) : /* @__PURE__ */ r.jsx(
435
+ U,
436
+ {
437
+ placeholder: `请输入${e.label}`,
438
+ maxLength: e.maxLength
439
+ }
440
+ );
441
+ }
442
+ }
443
+ export {
444
+ we as default
445
+ };