@kne/form-creator 0.1.4 → 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 +335 -39
- package/dist/index.css +150 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1867 -326
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1765 -326
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +35 -4
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +35 -4
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +37 -6
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +37 -6
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,11 +33,11 @@ npm i --save @kne/form-creator
|
|
|
33
33
|
#### 示例代码
|
|
34
34
|
|
|
35
35
|
- 配置式表单搭建(全屏)
|
|
36
|
-
-
|
|
36
|
+
- 通过模块列表添加/编辑/排序,右侧实时预览;默认示例含列表嵌套与选项切换
|
|
37
37
|
- _FormCreator(@kne/current-lib_form-creator)[import * as _FormCreator from "@kne/form-creator"],(@kne/current-lib_form-creator/dist/index.css)[import "@kne/form-creator/dist/index.css"],_JsonView(@kne/json-view)[import * as _JsonView from "@kne/json-view"],(@kne/json-view/dist/index.css)[import "@kne/json-view/dist/index.css"],antd(antd)[import antd from "antd"],_FormInfo(@kne/form-info)[import * as _FormInfo from "@kne/form-info"]
|
|
38
38
|
|
|
39
39
|
```jsx
|
|
40
|
-
const {default: FormCreator, defaultSchema, createBlock, createField, createStep} = _FormCreator;
|
|
40
|
+
const {default: FormCreator, defaultSchema, createBlock, createField, createStep, createChoiceOption} = _FormCreator;
|
|
41
41
|
const {default: JsonView} = _JsonView;
|
|
42
42
|
const {useState} = React;
|
|
43
43
|
const {Typography} = antd;
|
|
@@ -168,6 +168,167 @@ const BaseExample = () => {
|
|
|
168
168
|
})
|
|
169
169
|
]
|
|
170
170
|
}),
|
|
171
|
+
createBlock('list', {
|
|
172
|
+
title: '项目经历(含嵌套)',
|
|
173
|
+
name: 'projects',
|
|
174
|
+
addText: '添加项目',
|
|
175
|
+
minLength: 0,
|
|
176
|
+
list: [
|
|
177
|
+
createField({
|
|
178
|
+
type: 'Input',
|
|
179
|
+
name: 'projectName',
|
|
180
|
+
label: '项目名称',
|
|
181
|
+
rule: 'REQ',
|
|
182
|
+
props: {placeholder: '请输入项目名称'}
|
|
183
|
+
}),
|
|
184
|
+
createField({
|
|
185
|
+
type: 'Input',
|
|
186
|
+
name: 'role',
|
|
187
|
+
label: '担任角色',
|
|
188
|
+
props: {placeholder: '如:前端开发'}
|
|
189
|
+
})
|
|
190
|
+
],
|
|
191
|
+
itemBlocks: [
|
|
192
|
+
createBlock('object', {
|
|
193
|
+
name: 'period',
|
|
194
|
+
title: '项目周期',
|
|
195
|
+
column: 2,
|
|
196
|
+
list: [
|
|
197
|
+
createField({
|
|
198
|
+
type: 'DatePicker',
|
|
199
|
+
name: 'start',
|
|
200
|
+
label: '开始时间',
|
|
201
|
+
props: {placeholder: '请选择'}
|
|
202
|
+
}),
|
|
203
|
+
createField({
|
|
204
|
+
type: 'DatePicker',
|
|
205
|
+
name: 'end',
|
|
206
|
+
label: '结束时间',
|
|
207
|
+
props: {placeholder: '请选择'}
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
createBlock('list', {
|
|
212
|
+
title: '项目成果',
|
|
213
|
+
name: 'achievements',
|
|
214
|
+
addText: '添加成果',
|
|
215
|
+
list: [
|
|
216
|
+
createField({
|
|
217
|
+
type: 'Input',
|
|
218
|
+
name: 'content',
|
|
219
|
+
label: '成果说明',
|
|
220
|
+
props: {placeholder: '请输入成果'}
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
226
|
+
createBlock('choice', {
|
|
227
|
+
title: '客户类型',
|
|
228
|
+
mode: 'single',
|
|
229
|
+
selectorName: 'customerType',
|
|
230
|
+
selectorInData: true,
|
|
231
|
+
options: [
|
|
232
|
+
createChoiceOption({
|
|
233
|
+
id: 'enterprise',
|
|
234
|
+
title: '企业',
|
|
235
|
+
list: [
|
|
236
|
+
createField({
|
|
237
|
+
type: 'Input',
|
|
238
|
+
name: 'companyName',
|
|
239
|
+
label: '公司名',
|
|
240
|
+
rule: 'REQ',
|
|
241
|
+
props: {placeholder: '公司名称'}
|
|
242
|
+
}),
|
|
243
|
+
createField({
|
|
244
|
+
type: 'Input',
|
|
245
|
+
name: 'creditCode',
|
|
246
|
+
label: '信用代码',
|
|
247
|
+
props: {placeholder: '统一社会信用代码'}
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
}),
|
|
251
|
+
createChoiceOption({
|
|
252
|
+
id: 'person',
|
|
253
|
+
title: '个人',
|
|
254
|
+
list: [
|
|
255
|
+
createField({
|
|
256
|
+
type: 'Input',
|
|
257
|
+
name: 'idName',
|
|
258
|
+
label: '姓名',
|
|
259
|
+
rule: 'REQ',
|
|
260
|
+
props: {placeholder: '姓名'}
|
|
261
|
+
}),
|
|
262
|
+
createField({
|
|
263
|
+
type: 'Input',
|
|
264
|
+
name: 'idNo',
|
|
265
|
+
label: '证件号',
|
|
266
|
+
props: {placeholder: '证件号码'}
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
}),
|
|
270
|
+
createChoiceOption({
|
|
271
|
+
id: 'other',
|
|
272
|
+
title: '其他',
|
|
273
|
+
list: [
|
|
274
|
+
createField({
|
|
275
|
+
type: 'TextArea',
|
|
276
|
+
name: 'otherNote',
|
|
277
|
+
label: '说明',
|
|
278
|
+
block: true,
|
|
279
|
+
props: {rows: 3, placeholder: '补充说明'}
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
}),
|
|
285
|
+
createBlock('choice', {
|
|
286
|
+
title: '兴趣标签',
|
|
287
|
+
mode: 'multiple',
|
|
288
|
+
minLength: 1,
|
|
289
|
+
maxLength: 2,
|
|
290
|
+
selectorName: 'interests',
|
|
291
|
+
selectorInData: true,
|
|
292
|
+
options: [
|
|
293
|
+
createChoiceOption({
|
|
294
|
+
id: 'sports',
|
|
295
|
+
title: '运动',
|
|
296
|
+
list: [
|
|
297
|
+
createField({
|
|
298
|
+
type: 'Input',
|
|
299
|
+
name: 'sportsNote',
|
|
300
|
+
label: '擅长项目',
|
|
301
|
+
props: {placeholder: '如:篮球'}
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}),
|
|
305
|
+
createChoiceOption({
|
|
306
|
+
id: 'music',
|
|
307
|
+
title: '音乐',
|
|
308
|
+
list: [
|
|
309
|
+
createField({
|
|
310
|
+
type: 'Input',
|
|
311
|
+
name: 'musicNote',
|
|
312
|
+
label: '偏好风格',
|
|
313
|
+
props: {placeholder: '如:古典'}
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
}),
|
|
317
|
+
createChoiceOption({
|
|
318
|
+
id: 'reading',
|
|
319
|
+
title: '阅读',
|
|
320
|
+
list: [
|
|
321
|
+
createField({
|
|
322
|
+
type: 'TextArea',
|
|
323
|
+
name: 'readingNote',
|
|
324
|
+
label: '近期书单',
|
|
325
|
+
block: true,
|
|
326
|
+
props: {rows: 2, placeholder: '选填'}
|
|
327
|
+
})
|
|
328
|
+
]
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
}),
|
|
171
332
|
createBlock('multiField', {
|
|
172
333
|
title: '备用联系方式',
|
|
173
334
|
name: 'backupContacts',
|
|
@@ -254,7 +415,7 @@ const BaseExample = () => {
|
|
|
254
415
|
<FormCreator value={schema} onChange={setSchema} />
|
|
255
416
|
<div style={{marginTop: 16}}>
|
|
256
417
|
<JsonView data={schema} theme="light" collapsedFrom={2} searchable={false} />
|
|
257
|
-
<Text type="secondary"
|
|
418
|
+
<Text type="secondary">初始示例已包含表单分组、列表、表格列表、列表嵌套、选项切换、多字段、分步等模块。</Text>
|
|
258
419
|
</div>
|
|
259
420
|
</div>;
|
|
260
421
|
};
|
|
@@ -365,6 +526,134 @@ render(<SchemaRenderExample />);
|
|
|
365
526
|
|
|
366
527
|
```
|
|
367
528
|
|
|
529
|
+
- 列表嵌套与选项切换
|
|
530
|
+
- 列表每一条里可再放分组或子列表;选项切换支持单选/多选,每个选项可添加填写项
|
|
531
|
+
- _FormCreator(@kne/current-lib_form-creator)[import * as _FormCreator from "@kne/form-creator"],(@kne/current-lib_form-creator/dist/index.css)[import "@kne/form-creator/dist/index.css"],_JsonView(@kne/json-view)[import * as _JsonView from "@kne/json-view"],(@kne/json-view/dist/index.css)[import "@kne/json-view/dist/index.css"],antd(antd)[import antd from "antd"]
|
|
532
|
+
|
|
533
|
+
```jsx
|
|
534
|
+
const { SchemaRenderer, createBlock, createField, createChoiceOption } = _FormCreator;
|
|
535
|
+
const { default: JsonView } = _JsonView;
|
|
536
|
+
const { useState } = React;
|
|
537
|
+
const { Alert, Space, Switch } = antd;
|
|
538
|
+
|
|
539
|
+
const NestedChoiceExample = () => {
|
|
540
|
+
const [multiple, setMultiple] = useState(false);
|
|
541
|
+
const [result, setResult] = useState(null);
|
|
542
|
+
|
|
543
|
+
const schema = {
|
|
544
|
+
actions: {
|
|
545
|
+
showSubmit: true,
|
|
546
|
+
showReset: true,
|
|
547
|
+
submitText: '提交',
|
|
548
|
+
resetText: '重置'
|
|
549
|
+
},
|
|
550
|
+
blocks: [
|
|
551
|
+
createBlock('list', {
|
|
552
|
+
title: '教育经历',
|
|
553
|
+
name: 'education',
|
|
554
|
+
addText: '添加教育经历',
|
|
555
|
+
minLength: 1,
|
|
556
|
+
list: [
|
|
557
|
+
createField({ type: 'Input', name: 'schoolName', label: '学校', rule: 'REQ', props: { placeholder: '学校名称' } }),
|
|
558
|
+
createField({ type: 'Input', name: 'major', label: '专业', props: { placeholder: '专业' } })
|
|
559
|
+
],
|
|
560
|
+
itemBlocks: [
|
|
561
|
+
createBlock('object', {
|
|
562
|
+
name: 'time',
|
|
563
|
+
title: '在校时间',
|
|
564
|
+
column: 2,
|
|
565
|
+
list: [
|
|
566
|
+
createField({ type: 'Input', name: 'startTime', label: '开始', props: { placeholder: '开始时间' } }),
|
|
567
|
+
createField({ type: 'Input', name: 'endTime', label: '结束', props: { placeholder: '结束时间' } })
|
|
568
|
+
]
|
|
569
|
+
}),
|
|
570
|
+
createBlock('list', {
|
|
571
|
+
title: '课程',
|
|
572
|
+
name: 'courses',
|
|
573
|
+
addText: '添加课程',
|
|
574
|
+
list: [createField({ type: 'Input', name: 'courseName', label: '课程名', props: { placeholder: '课程名' } })]
|
|
575
|
+
})
|
|
576
|
+
]
|
|
577
|
+
}),
|
|
578
|
+
createBlock('choice', {
|
|
579
|
+
title: '客户类型',
|
|
580
|
+
mode: multiple ? 'multiple' : 'single',
|
|
581
|
+
minLength: multiple ? 1 : undefined,
|
|
582
|
+
maxLength: multiple ? 2 : undefined,
|
|
583
|
+
selectorName: 'customerType',
|
|
584
|
+
selectorInData: true,
|
|
585
|
+
options: [
|
|
586
|
+
createChoiceOption({
|
|
587
|
+
id: 'enterprise',
|
|
588
|
+
title: '企业',
|
|
589
|
+
blocks: [
|
|
590
|
+
createBlock('formInfo', {
|
|
591
|
+
title: '企业信息',
|
|
592
|
+
column: 2,
|
|
593
|
+
list: [
|
|
594
|
+
createField({ type: 'Input', name: 'companyName', label: '公司名', rule: 'REQ', props: { placeholder: '公司名称' } }),
|
|
595
|
+
createField({ type: 'Input', name: 'creditCode', label: '信用代码', props: { placeholder: '统一社会信用代码' } })
|
|
596
|
+
]
|
|
597
|
+
})
|
|
598
|
+
]
|
|
599
|
+
}),
|
|
600
|
+
createChoiceOption({
|
|
601
|
+
id: 'person',
|
|
602
|
+
title: '个人',
|
|
603
|
+
blocks: [
|
|
604
|
+
createBlock('formInfo', {
|
|
605
|
+
title: '个人信息',
|
|
606
|
+
column: 2,
|
|
607
|
+
list: [
|
|
608
|
+
createField({ type: 'Input', name: 'idName', label: '姓名', rule: 'REQ', props: { placeholder: '姓名' } }),
|
|
609
|
+
createField({ type: 'Input', name: 'idNo', label: '证件号', props: { placeholder: '证件号码' } })
|
|
610
|
+
]
|
|
611
|
+
})
|
|
612
|
+
]
|
|
613
|
+
}),
|
|
614
|
+
createChoiceOption({
|
|
615
|
+
id: 'other',
|
|
616
|
+
title: '其他',
|
|
617
|
+
blocks: [
|
|
618
|
+
createBlock('formInfo', {
|
|
619
|
+
column: 1,
|
|
620
|
+
list: [createField({ type: 'TextArea', name: 'otherNote', label: '说明', block: true, props: { rows: 3, placeholder: '补充说明' } })]
|
|
621
|
+
})
|
|
622
|
+
]
|
|
623
|
+
})
|
|
624
|
+
]
|
|
625
|
+
})
|
|
626
|
+
]
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
return (
|
|
630
|
+
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
631
|
+
<Alert
|
|
632
|
+
type="info"
|
|
633
|
+
showIcon
|
|
634
|
+
message="列表嵌套与选项切换"
|
|
635
|
+
description={<span>列表每一条里可以再放分组信息或子列表;选项切换可设为「只能选一个」或「可以选多个」(多选可限制最少/最多几项),下方会显示对应填写内容。</span>}
|
|
636
|
+
/>
|
|
637
|
+
<Space>
|
|
638
|
+
<span>允许多选</span>
|
|
639
|
+
<Switch checked={multiple} onChange={setMultiple} />
|
|
640
|
+
</Space>
|
|
641
|
+
<SchemaRenderer
|
|
642
|
+
key={multiple ? 'multiple' : 'single'}
|
|
643
|
+
schema={schema}
|
|
644
|
+
formProps={{
|
|
645
|
+
onSubmit: data => setResult(data)
|
|
646
|
+
}}
|
|
647
|
+
/>
|
|
648
|
+
{result ? <JsonView data={result} theme="light" collapsedFrom={2} searchable={false} /> : null}
|
|
649
|
+
</Space>
|
|
650
|
+
);
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
render(<NestedChoiceExample />);
|
|
654
|
+
|
|
655
|
+
```
|
|
656
|
+
|
|
368
657
|
- 扩展组件与校验规则
|
|
369
658
|
- 通过 preset({ rules, fields }) 一次扩展运行时校验、规则勾选面板与自定义填写项
|
|
370
659
|
- _FormCreator(@kne/current-lib_form-creator)[import * as _FormCreator from "@kne/form-creator"],(@kne/current-lib_form-creator/dist/index.css)[import "@kne/form-creator/dist/index.css"],_ReactFormAntd(@kne/react-form-antd)[import * as _ReactFormAntd from "@kne/react-form-antd"],_JsonView(@kne/json-view)[import * as _JsonView from "@kne/json-view"],(@kne/json-view/dist/index.css)[import "@kne/json-view/dist/index.css"],antd(antd)[import antd from "antd"]
|
|
@@ -618,11 +907,15 @@ import { Form, SubmitButton } from '@kne/form-info';
|
|
|
618
907
|
},
|
|
619
908
|
blocks: [{
|
|
620
909
|
id: string,
|
|
621
|
-
kind: 'formInfo' | 'list' | 'tableList' | 'multiField' | 'steps',
|
|
910
|
+
kind: 'formInfo' | 'list' | 'tableList' | 'multiField' | 'object' | 'choice' | 'steps',
|
|
622
911
|
title?, subtitle?, column?, gap?, bordered?, important?,
|
|
623
912
|
name?, label?, addText?, maxLength?, minLength?, fieldType?, autoStep?,
|
|
913
|
+
mode?, selectorName?, selectorInData?, discriminator?,
|
|
624
914
|
list?: [{ id, type, name, label, tips?, description?, rule?, block?, hidden?, props? }],
|
|
625
|
-
|
|
915
|
+
itemBlocks?: Block[], // list:列表项内子模块
|
|
916
|
+
blocks?: Block[], // formInfo / object:子模块
|
|
917
|
+
options?: [{ id, title, list?, blocks?: Block[] }], // choice
|
|
918
|
+
items?: [{ id, title, column, list: [...], blocks?: Block[] }] // steps 专用
|
|
626
919
|
}]
|
|
627
920
|
}
|
|
628
921
|
```
|
|
@@ -632,11 +925,15 @@ import { Form, SubmitButton } from '@kne/form-info';
|
|
|
632
925
|
|
|
633
926
|
| kind | 说明 | 主要参数 |
|
|
634
927
|
|------|------|----------|
|
|
635
|
-
| formInfo | 表单信息区块 | title, subtitle, column, gap, bordered, list |
|
|
636
|
-
| list | 动态列表 | name, title, important, bordered, maxLength, list |
|
|
637
|
-
| tableList | 表格列表 | name, title, bordered, maxLength, list |
|
|
638
|
-
|
|
|
639
|
-
|
|
|
928
|
+
| formInfo | 表单信息区块 | title, subtitle, column, gap, bordered, list, **blocks** |
|
|
929
|
+
| list | 动态列表 | name, title, important, bordered, maxLength, list, **itemBlocks** |
|
|
930
|
+
| tableList | 表格列表 | name, title, bordered, maxLength, list(不支持子模块) |
|
|
931
|
+
| object | 对象分组 | name, title, column, gap, list(字段名渲染为 `name.field`), **blocks** |
|
|
932
|
+
| choice | 选项分支 | title, **mode**(`single`\|`multiple`), **minLength** / **maxLength**(仅多选:最少/最多选几项), selectorName, selectorInData, options[{ title, list, **blocks** }] |
|
|
933
|
+
| multiField | 同类型多值 | name, label, fieldType, addText(不支持子模块) |
|
|
934
|
+
| steps | 步骤表单 | title, subtitle, bordered, autoStep, items[{ title, column, list, **blocks** }] |
|
|
935
|
+
|
|
936
|
+
`choice`:顶部同一条选项 UI;`single` 只挂载当前选项内容,`multiple` 平铺所有选中项。多选时可配置 `minLength` / `maxLength` 限制最少、最多选择几个(提交时校验;达到上限后未选项禁用)。JSON Schema 的 oneOf/anyOf 可分别映射为 `mode: 'single'/'multiple'`。`allOf` 无需独立 kind,展开为多个 sibling blocks 即可。
|
|
640
937
|
|
|
641
938
|
兼容旧版:若仅有顶层 `list` 且无 `blocks`,会自动迁移为一个 `formInfo` 区块。
|
|
642
939
|
|
|
@@ -647,7 +944,7 @@ import { Form, SubmitButton } from '@kne/form-info';
|
|
|
647
944
|
|
|
648
945
|
#### 工具方法
|
|
649
946
|
|
|
650
|
-
- `createBlock(kind)` / `createStep()` / `normalizeSchema(schema)`
|
|
947
|
+
- `createBlock(kind)` / `createStep()` / `createChoiceOption()` / `normalizeSchema(schema)`
|
|
651
948
|
- `preset({ rules, fields })` 一次注册扩展规则与填写项(推荐)
|
|
652
949
|
- `parseRuleString(rule)` / `buildRuleString(config)` 校验规则字符串解析/组装
|
|
653
950
|
|
|
@@ -697,42 +994,41 @@ preset({
|
|
|
697
994
|
| 配置 | 类型 | 说明 |
|
|
698
995
|
|------|------|------|
|
|
699
996
|
| `rules` | `Record<string, RuleDef>` | key 为规则 token;`RuleDef` 含 `label` + `reg/message` 或 `validator` |
|
|
700
|
-
| `fields` | `Record<string, FieldDef>` | key 为字段 type
|
|
701
|
-
|
|
702
|
-
#### 高级用法(一般请用 preset)
|
|
997
|
+
| `fields` | `Record<string, FieldDef>` | key 为字段 type;见下方 FieldDef |
|
|
703
998
|
|
|
704
|
-
|
|
705
|
-
- `registerRulePreset({ value, label })` 单独扩展规则勾选项
|
|
999
|
+
**FieldDef** 常用字段:`label`、`component`、`groupName`、`defaultProps`、`propsSchema`、`hasOptions`、`hasFieldProps` 等。
|
|
706
1000
|
|
|
707
|
-
扩展填写项时,用 `propsSchema` 声明可编辑的额外参数(写入字段 `props`),编辑器会按声明自动生成「填写项设置」表单:
|
|
1001
|
+
扩展填写项时,用 `fields` 内的 `propsSchema` 声明可编辑的额外参数(写入字段 `props`),编辑器会按声明自动生成「填写项设置」表单:
|
|
708
1002
|
|
|
709
1003
|
```js
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
1004
|
+
fields: {
|
|
1005
|
+
Slider: {
|
|
1006
|
+
label: '滑块',
|
|
1007
|
+
component: Slider,
|
|
1008
|
+
defaultProps: { min: 0, max: 100, step: 1 },
|
|
1009
|
+
propsSchema: [
|
|
1010
|
+
{ name: 'min', label: '最小值', type: 'number', defaultValue: 0 },
|
|
1011
|
+
{ name: 'max', label: '最大值', type: 'number', defaultValue: 100 },
|
|
1012
|
+
{ name: 'step', label: '步长', type: 'number', min: 0, defaultValue: 1 },
|
|
1013
|
+
{
|
|
1014
|
+
name: 'tooltipPlacement',
|
|
1015
|
+
label: '提示位置',
|
|
1016
|
+
type: 'select',
|
|
1017
|
+
defaultValue: 'top',
|
|
1018
|
+
options: [
|
|
1019
|
+
{ label: '上', value: 'top' },
|
|
1020
|
+
{ label: '下', value: 'bottom' }
|
|
1021
|
+
]
|
|
1022
|
+
},
|
|
1023
|
+
{ name: 'dots', label: '显示刻度点', type: 'boolean' }
|
|
1024
|
+
]
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
731
1027
|
```
|
|
732
1028
|
|
|
733
1029
|
#### 扩展组件与校验(示例见「扩展组件与校验规则」)
|
|
734
1030
|
|
|
735
|
-
使用 `preset({ rules, fields })` 即可,无需再单独调用
|
|
1031
|
+
使用 `preset({ rules, fields })` 即可,无需再单独调用 react-form-antd 的 `preset`。
|
|
736
1032
|
|
|
737
1033
|
`propsSchema` 项约定:
|
|
738
1034
|
|
package/dist/index.css
CHANGED
|
@@ -200,6 +200,82 @@
|
|
|
200
200
|
margin-top: 10px;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
.kne-form-creator_wq4bT {
|
|
204
|
+
margin-top: 12px;
|
|
205
|
+
padding-top: 10px;
|
|
206
|
+
border-top: 1px dashed rgba(0, 0, 0, 0.08);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.kne-form-creator_4NWH4 {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
gap: 8px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.kne-form-creator_mUKom {
|
|
216
|
+
padding: 10px 12px;
|
|
217
|
+
border-radius: 10px;
|
|
218
|
+
background: rgba(255, 255, 255, 0.55);
|
|
219
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
|
|
220
|
+
}
|
|
221
|
+
.kne-form-creator_mUKom:hover {
|
|
222
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.kne-form-creator_9JS0d {
|
|
226
|
+
min-width: 200px;
|
|
227
|
+
max-width: 280px;
|
|
228
|
+
max-height: 280px;
|
|
229
|
+
overflow-y: auto;
|
|
230
|
+
padding: 6px;
|
|
231
|
+
background: #ffffff;
|
|
232
|
+
border-radius: 8px;
|
|
233
|
+
box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.kne-form-creator_Ql1z3 {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
flex-wrap: wrap;
|
|
240
|
+
gap: 6px 8px;
|
|
241
|
+
padding: 8px 10px;
|
|
242
|
+
border-radius: 6px;
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
font-size: 13px;
|
|
245
|
+
line-height: 20px;
|
|
246
|
+
color: rgba(0, 0, 0, 0.88);
|
|
247
|
+
}
|
|
248
|
+
.kne-form-creator_Ql1z3:hover {
|
|
249
|
+
background: #f5f5f5;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.kne-form-creator_ZHB5O {
|
|
253
|
+
display: inline-flex;
|
|
254
|
+
color: #4183f0;
|
|
255
|
+
font-size: 14px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.kne-form-creator_dcsOS {
|
|
259
|
+
flex: 1 0 100%;
|
|
260
|
+
padding-left: 22px;
|
|
261
|
+
color: rgba(0, 0, 0, 0.45);
|
|
262
|
+
font-size: 12px;
|
|
263
|
+
line-height: 16px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.kne-form-creator_CUK0H {
|
|
267
|
+
height: 1px;
|
|
268
|
+
margin: 4px 6px;
|
|
269
|
+
background: rgba(0, 0, 0, 0.06);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.kne-form-creator_bPJ-2 {
|
|
273
|
+
padding: 6px 10px 2px;
|
|
274
|
+
color: rgba(0, 0, 0, 0.45);
|
|
275
|
+
font-size: 12px;
|
|
276
|
+
line-height: 18px;
|
|
277
|
+
}
|
|
278
|
+
|
|
203
279
|
.kne-form-creator_LUO8S {
|
|
204
280
|
display: flex;
|
|
205
281
|
align-items: center;
|
|
@@ -320,7 +396,8 @@
|
|
|
320
396
|
.kne-form-creator_22ajp:focus-within > .kne-form-creator_wkhEX .kne-form-creator_773yo,
|
|
321
397
|
.kne-form-creator_22ajp:focus-within > .kne-form-creator_wkhEX .kne-form-creator_S234h,
|
|
322
398
|
.kne-form-creator_XMkdt:hover .kne-form-creator_773yo,
|
|
323
|
-
.kne-form-creator_XMkdt:focus-within .kne-form-creator_773yo
|
|
399
|
+
.kne-form-creator_XMkdt:focus-within .kne-form-creator_773yo,
|
|
400
|
+
.kne-form-creator_AE-6r {
|
|
324
401
|
opacity: 1;
|
|
325
402
|
pointer-events: auto;
|
|
326
403
|
}
|
|
@@ -493,6 +570,78 @@
|
|
|
493
570
|
width: 100%;
|
|
494
571
|
}
|
|
495
572
|
|
|
573
|
+
.kne-form-creator_RllJe {
|
|
574
|
+
width: 100%;
|
|
575
|
+
min-width: 0;
|
|
576
|
+
box-sizing: border-box;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.kne-form-creator_5A1eM {
|
|
580
|
+
margin-bottom: 4px;
|
|
581
|
+
}
|
|
582
|
+
.kne-form-creator_5A1eM .react-form__field {
|
|
583
|
+
margin-bottom: 8px;
|
|
584
|
+
}
|
|
585
|
+
.kne-form-creator_5A1eM .ant-checkbox-group {
|
|
586
|
+
display: flex;
|
|
587
|
+
flex-wrap: wrap;
|
|
588
|
+
gap: 8px;
|
|
589
|
+
}
|
|
590
|
+
.kne-form-creator_5A1eM .ant-radio-group {
|
|
591
|
+
display: inline-flex;
|
|
592
|
+
flex-wrap: wrap;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.kne-form-creator_IO0MY {
|
|
596
|
+
display: flex;
|
|
597
|
+
flex-direction: column;
|
|
598
|
+
gap: 16px;
|
|
599
|
+
width: 100%;
|
|
600
|
+
margin-top: 12px;
|
|
601
|
+
padding-top: 16px;
|
|
602
|
+
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
|
603
|
+
box-sizing: border-box;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.kne-form-creator_T0nND {
|
|
607
|
+
margin-top: 12px;
|
|
608
|
+
padding: 16px 0 4px;
|
|
609
|
+
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
|
610
|
+
font-size: 13px;
|
|
611
|
+
line-height: 20px;
|
|
612
|
+
color: rgba(0, 0, 0, 0.45);
|
|
613
|
+
text-align: center;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.kne-form-creator_FQixN {
|
|
617
|
+
width: 100%;
|
|
618
|
+
min-width: 0;
|
|
619
|
+
box-sizing: border-box;
|
|
620
|
+
padding: 12px 14px;
|
|
621
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
622
|
+
border-radius: 8px;
|
|
623
|
+
background: #fafafa;
|
|
624
|
+
}
|
|
625
|
+
.kne-form-creator_FQixN .ant-card,
|
|
626
|
+
.kne-form-creator_FQixN .ant-card-body {
|
|
627
|
+
background: transparent;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.kne-form-creator_ofRo2 {
|
|
631
|
+
margin-bottom: 12px;
|
|
632
|
+
font-size: 14px;
|
|
633
|
+
font-weight: 600;
|
|
634
|
+
line-height: 22px;
|
|
635
|
+
color: rgba(0, 0, 0, 0.88);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.kne-form-creator_pksH8 {
|
|
639
|
+
display: flex;
|
|
640
|
+
flex-wrap: wrap;
|
|
641
|
+
gap: 8px;
|
|
642
|
+
margin-top: 8px;
|
|
643
|
+
}
|
|
644
|
+
|
|
496
645
|
.kne-form-creator_PGPHL {
|
|
497
646
|
display: flex;
|
|
498
647
|
flex-direction: column;
|