@skopon-cool/form-sdk 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/a2uiAdapter.d.ts.map +1 -1
- package/dist/adapter/formSchema.d.ts.map +1 -1
- package/dist/blocks/{case_singleselect → case_multiselect}/adapter.d.ts +2 -2
- 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/catalog/resumeSearchContext.d.ts +9 -0
- package/dist/catalog/resumeSearchContext.d.ts.map +1 -1
- package/dist/catalog/skoponCaseSelect.d.ts.map +1 -1
- package/dist/catalog/skoponResumeSelect.d.ts.map +1 -1
- package/dist/components/AskUserFormCard.d.ts.map +1 -1
- package/dist/components/CurlSubmitBlock.d.ts +4 -1
- package/dist/components/CurlSubmitBlock.d.ts.map +1 -1
- package/dist/components/SkoponA2uiStreamRenderer.d.ts.map +1 -1
- package/dist/form-sdk.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +901 -852
- package/dist/submit/buildCurlStatement.d.ts +3 -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 +11 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapter/a2uiAdapter.test.ts +37 -14
- package/src/adapter/a2uiAdapter.ts +1 -4
- package/src/adapter/formSchema.ts +49 -29
- package/src/blocks/case_multiselect/adapter.ts +90 -0
- package/src/blocks/case_multiselect/index.ts +14 -0
- package/src/blocks/registry.ts +2 -2
- package/src/catalog/resumeSearchContext.tsx +10 -0
- package/src/catalog/skoponCaseSelect.tsx +38 -13
- package/src/catalog/skoponResumeSelect.tsx +76 -10
- package/src/components/AskUserFormCard.tsx +3 -1
- package/src/components/CurlSubmitBlock.tsx +28 -7
- package/src/components/SkoponA2uiStreamRenderer.tsx +11 -4
- package/src/index.ts +6 -1
- package/src/styles/a2ui-preview.css +4 -4
- package/src/styles/index.css +148 -17
- package/src/submit/buildCurlStatement.ts +18 -23
- package/src/submit/intersectPayloadBlocksWithForm.ts +14 -2
- package/src/submit/submit.test.ts +66 -3
- package/src/types/index.ts +10 -3
- package/dist/blocks/case_singleselect/adapter.d.ts.map +0 -1
- package/dist/blocks/case_singleselect/index.d.ts +0 -3
- package/dist/blocks/case_singleselect/index.d.ts.map +0 -1
- package/src/blocks/case_singleselect/adapter.ts +0 -74
- package/src/blocks/case_singleselect/index.ts +0 -14
package/src/types/index.ts
CHANGED
|
@@ -56,6 +56,8 @@ export type FormBlockType =
|
|
|
56
56
|
| 'time'
|
|
57
57
|
| 'file'
|
|
58
58
|
| 'resume_multiselect'
|
|
59
|
+
| 'case_multiselect'
|
|
60
|
+
/** @deprecated 加载时自动迁移为 case_multiselect */
|
|
59
61
|
| 'case_singleselect'
|
|
60
62
|
| 'image'
|
|
61
63
|
| 'video'
|
|
@@ -92,13 +94,18 @@ export interface FormResumeFilter {
|
|
|
92
94
|
pageSize?: number
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
/**
|
|
97
|
+
/** 案例多选组件:渲染时用于 /univ/case/list 的筛选条件 */
|
|
96
98
|
export interface FormCaseFilter {
|
|
97
99
|
/** Agent 类型(编辑器辅助,运行时不用) */
|
|
98
100
|
agentKind?: string
|
|
99
|
-
/** Agent unique_id
|
|
101
|
+
/** Agent unique_id(运行时用于限定所属 Agent) */
|
|
100
102
|
agentUniqueId?: string
|
|
101
|
-
|
|
103
|
+
/** 流类型 unique_id */
|
|
104
|
+
flowType?: string
|
|
105
|
+
/** 流类别 unique_id */
|
|
106
|
+
category?: string
|
|
107
|
+
/** 流程编号(flow_unique_id)多选 */
|
|
108
|
+
flowUniqueIds?: string[]
|
|
102
109
|
pageSize?: number
|
|
103
110
|
}
|
|
104
111
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/blocks/case_singleselect/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE3E,iBAAS,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAErD;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,mBAAmB,GACvB,sBAAsB,CAiBxB;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,SAAS,EAC9C,OAAO,EAAE;IACP,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAA;CAC1C,GACA,SAAS,CAmCX;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/case_singleselect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAOlD,eAAO,MAAM,uBAAuB,EAAE,kBAMrC,CAAA"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { A2uiComponentNode, FormBlock } from '../../types/index'
|
|
2
|
-
import type { BlockAdapterContext, BlockToComponentResult } from '../types'
|
|
3
|
-
|
|
4
|
-
function asLiteral(value: unknown): string | undefined {
|
|
5
|
-
return typeof value === 'string' ? value : undefined
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function caseSingleselectToComponent(
|
|
9
|
-
block: FormBlock,
|
|
10
|
-
ctx: BlockAdapterContext,
|
|
11
|
-
): BlockToComponentResult {
|
|
12
|
-
const { id, label, path, withData } = ctx
|
|
13
|
-
return withData({
|
|
14
|
-
id,
|
|
15
|
-
component: 'SkoponCaseSelect',
|
|
16
|
-
label,
|
|
17
|
-
placeholder: block.placeholder ?? '',
|
|
18
|
-
help: block.help ?? '',
|
|
19
|
-
enableRefresh: block.caseEnableRefresh !== false,
|
|
20
|
-
caseFilter: {
|
|
21
|
-
agentKind: block.caseFilter?.agentKind,
|
|
22
|
-
agentUniqueId: block.caseFilter?.agentUniqueId,
|
|
23
|
-
flowId: block.caseFilter?.flowId,
|
|
24
|
-
pageSize: block.caseFilter?.pageSize ?? 20,
|
|
25
|
-
},
|
|
26
|
-
value: { path },
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function caseSingleselectFromComponent(
|
|
31
|
-
node: A2uiComponentNode,
|
|
32
|
-
base: (type: 'case_singleselect') => FormBlock,
|
|
33
|
-
helpers: {
|
|
34
|
-
asLiteral: (value: unknown) => string | undefined
|
|
35
|
-
nameFromValue: (value: unknown) => string
|
|
36
|
-
},
|
|
37
|
-
): FormBlock {
|
|
38
|
-
const name = helpers.nameFromValue(node.value)
|
|
39
|
-
const block: FormBlock = {
|
|
40
|
-
...base('case_singleselect'),
|
|
41
|
-
name,
|
|
42
|
-
caseEnableRefresh: node.enableRefresh !== false,
|
|
43
|
-
}
|
|
44
|
-
const placeholder = helpers.asLiteral(node.placeholder)
|
|
45
|
-
if (placeholder) block.placeholder = placeholder
|
|
46
|
-
const help = helpers.asLiteral(node.help)
|
|
47
|
-
if (help) block.help = help
|
|
48
|
-
if (node.caseFilter && typeof node.caseFilter === 'object') {
|
|
49
|
-
const cf = node.caseFilter as Record<string, unknown>
|
|
50
|
-
const flowIdRaw = typeof cf.flowId === 'number' ? cf.flowId : Number(cf.flowId)
|
|
51
|
-
const pageSizeRaw = typeof cf.pageSize === 'number' ? cf.pageSize : Number(cf.pageSize)
|
|
52
|
-
const agentKind =
|
|
53
|
-
typeof cf.agentKind === 'string' && cf.agentKind.trim()
|
|
54
|
-
? cf.agentKind.trim()
|
|
55
|
-
: undefined
|
|
56
|
-
const agentUniqueId =
|
|
57
|
-
typeof cf.agentUniqueId === 'string' && cf.agentUniqueId.trim()
|
|
58
|
-
? cf.agentUniqueId.trim()
|
|
59
|
-
: undefined
|
|
60
|
-
block.caseFilter = {
|
|
61
|
-
agentKind,
|
|
62
|
-
agentUniqueId,
|
|
63
|
-
flowId:
|
|
64
|
-
Number.isFinite(flowIdRaw) && flowIdRaw > 0 ? Math.floor(flowIdRaw) : undefined,
|
|
65
|
-
pageSize:
|
|
66
|
-
Number.isFinite(pageSizeRaw) && pageSizeRaw >= 1 && pageSizeRaw <= 100
|
|
67
|
-
? Math.floor(pageSizeRaw)
|
|
68
|
-
: 20,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return block
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { asLiteral }
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BlockAdapterPlugin } from '../types'
|
|
2
|
-
import {
|
|
3
|
-
caseSingleselectFromComponent,
|
|
4
|
-
caseSingleselectToComponent,
|
|
5
|
-
} from './adapter'
|
|
6
|
-
import { SkoponCaseSelectImpl } from './catalog'
|
|
7
|
-
|
|
8
|
-
export const caseSingleselectAdapter: BlockAdapterPlugin = {
|
|
9
|
-
type: 'case_singleselect',
|
|
10
|
-
componentName: 'SkoponCaseSelect',
|
|
11
|
-
toComponent: caseSingleselectToComponent,
|
|
12
|
-
fromComponent: caseSingleselectFromComponent,
|
|
13
|
-
catalogComponents: [SkoponCaseSelectImpl],
|
|
14
|
-
}
|