@skopon-cool/form-sdk 0.4.4 → 0.4.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/formSchema.d.ts +3 -0
- package/dist/adapter/formSchema.d.ts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1215 -1051
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapter/formSchema.test.ts +150 -10
- package/src/adapter/formSchema.ts +224 -20
- package/src/index.ts +17 -3
- package/src/submit/submit.test.ts +37 -0
- package/src/types/index.ts +34 -0
package/src/types/index.ts
CHANGED
|
@@ -86,9 +86,19 @@ export interface FormBlockOption {
|
|
|
86
86
|
label: string
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
export type FormConditionOperator = 'eq' | 'ne' | 'empty' | 'notEmpty'
|
|
90
|
+
|
|
91
|
+
export interface FormBlockCondition {
|
|
92
|
+
fieldName: string
|
|
93
|
+
operator: FormConditionOperator
|
|
94
|
+
value?: string
|
|
95
|
+
}
|
|
96
|
+
|
|
89
97
|
/** 简历多选组件:渲染时用于 /univ/resume/search 的筛选条件 */
|
|
90
98
|
export interface FormResumeFilter {
|
|
91
99
|
names?: string[]
|
|
100
|
+
/** Agent 类型(编辑器辅助,运行时不用) */
|
|
101
|
+
agentKind?: string
|
|
92
102
|
agentUniqueIds?: string[]
|
|
93
103
|
resumeUniqueIds?: string[]
|
|
94
104
|
pageSize?: number
|
|
@@ -127,6 +137,12 @@ export interface FormBlock {
|
|
|
127
137
|
fileMinCount?: number
|
|
128
138
|
fileMaxCount?: number
|
|
129
139
|
defaultValue?: string | string[] | boolean
|
|
140
|
+
/** 派生 JSON Schema 时写入 property.$comment */
|
|
141
|
+
jsonSchemaDescription?: string
|
|
142
|
+
/** 是否隐藏(仅 text 块;隐藏时仍提交) */
|
|
143
|
+
hidden?: boolean
|
|
144
|
+
/** 是否需要 LLM 处理(持久化进 block json) */
|
|
145
|
+
needLLM?: boolean
|
|
130
146
|
/** 简历多选:是否显示「换一批」 */
|
|
131
147
|
resumeEnableRefresh?: boolean
|
|
132
148
|
/** 简历多选:最少选中数量,配置值 ≥ 1 */
|
|
@@ -143,6 +159,7 @@ export interface FormBlock {
|
|
|
143
159
|
caseMaxCount?: number
|
|
144
160
|
/** 案例单选:列表筛选条件(持久化进 block json) */
|
|
145
161
|
caseFilter?: FormCaseFilter
|
|
162
|
+
condition?: FormBlockCondition
|
|
146
163
|
}
|
|
147
164
|
|
|
148
165
|
export interface FormSchema {
|
|
@@ -164,6 +181,23 @@ export function isInputBlockType(type: FormBlockType): boolean {
|
|
|
164
181
|
return !isLayoutBlockType(type) && !isMediaBlockType(type)
|
|
165
182
|
}
|
|
166
183
|
|
|
184
|
+
export function isDisplayBlockType(type: FormBlockType): boolean {
|
|
185
|
+
return isLayoutBlockType(type) || isMediaBlockType(type)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function isOptionsBlockType(type: FormBlockType): boolean {
|
|
189
|
+
return type === 'select' || type === 'multiselect' || type === 'radio' || type === 'checkbox'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function supportsDefaultValue(type: FormBlockType): boolean {
|
|
193
|
+
return (
|
|
194
|
+
isInputBlockType(type) &&
|
|
195
|
+
type !== 'file' &&
|
|
196
|
+
type !== 'resume_multiselect' &&
|
|
197
|
+
type !== 'case_multiselect'
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
167
201
|
export interface FormDefinitionPayload {
|
|
168
202
|
title?: string
|
|
169
203
|
description?: string
|