yy-forms 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 (62) hide show
  1. package/.fatherrc.js +37 -0
  2. package/CHANGELOG.md +254 -0
  3. package/LICENSE +21 -0
  4. package/README.md +99 -0
  5. package/dist/index.d.ts +145 -0
  6. package/dist/index.esm.js +4006 -0
  7. package/dist/index.js +4041 -0
  8. package/es/Provider.js +248 -0
  9. package/es/index.d.ts +145 -0
  10. package/es/index.js +44 -0
  11. package/es/settings/index.js +975 -0
  12. package/es/styles/atom.less +1134 -0
  13. package/es/styles/index.less +358 -0
  14. package/es/transformer/form-render.js +75 -0
  15. package/es/utils/context.js +3 -0
  16. package/es/utils/hooks.js +48 -0
  17. package/es/utils/index.js +706 -0
  18. package/es/utils/mapping.js +31 -0
  19. package/es/utils/serialize.js +276 -0
  20. package/es/widgets/htmlInput.js +20 -0
  21. package/es/widgets/idInput.js +23 -0
  22. package/es/widgets/index.js +5 -0
  23. package/es/widgets/jsonInput.js +24 -0
  24. package/es/widgets/list.js +24 -0
  25. package/es/widgets/percentSlider.js +89 -0
  26. package/package.json +53 -0
  27. package/src/Provider.jsx +239 -0
  28. package/src/components/Canvas/core/RenderChildren.jsx +18 -0
  29. package/src/components/Canvas/core/RenderField.jsx +129 -0
  30. package/src/components/Canvas/core/Wrapper.jsx +298 -0
  31. package/src/components/Canvas/core/Wrapper.less +57 -0
  32. package/src/components/Canvas/core/index.jsx +171 -0
  33. package/src/components/Canvas/index.jsx +178 -0
  34. package/src/components/Settings/GlobalSettings.jsx +48 -0
  35. package/src/components/Settings/ItemSettings.jsx +143 -0
  36. package/src/components/Settings/index.jsx +75 -0
  37. package/src/components/Settings/index.less +25 -0
  38. package/src/components/Sidebar/Element.jsx +80 -0
  39. package/src/components/Sidebar/Element.less +18 -0
  40. package/src/components/Sidebar/index.jsx +47 -0
  41. package/src/components/Sidebar/index.less +23 -0
  42. package/src/i18next/index.ts +14 -0
  43. package/src/i18next/locales/enUS.json +60 -0
  44. package/src/i18next/locales/resources.ts +7 -0
  45. package/src/i18next/locales/zhCN.json +3 -0
  46. package/src/index.d.ts +145 -0
  47. package/src/index.js +45 -0
  48. package/src/settings/index.js +1058 -0
  49. package/src/styles/atom.less +1134 -0
  50. package/src/styles/index.less +358 -0
  51. package/src/transformer/form-render.js +65 -0
  52. package/src/utils/context.js +4 -0
  53. package/src/utils/hooks.js +35 -0
  54. package/src/utils/index.js +678 -0
  55. package/src/utils/mapping.js +29 -0
  56. package/src/utils/serialize.js +368 -0
  57. package/src/widgets/htmlInput.jsx +24 -0
  58. package/src/widgets/idInput.jsx +27 -0
  59. package/src/widgets/index.js +6 -0
  60. package/src/widgets/jsonInput.jsx +29 -0
  61. package/src/widgets/list.jsx +28 -0
  62. package/src/widgets/percentSlider.jsx +74 -0
@@ -0,0 +1,975 @@
1
+ // 只需写配置,方便可扩展
2
+ export var baseCommonSettings = {
3
+ type: {
4
+ title: '类型',
5
+ type: 'string',
6
+ hidden: '{{true}}'
7
+ },
8
+ widget: {
9
+ title: '组件',
10
+ type: 'string',
11
+ hidden: '{{true}}'
12
+ },
13
+ format: {
14
+ title: '格式',
15
+ type: 'string',
16
+ hidden: '{{true}}'
17
+ }
18
+ };
19
+ export var defaultCommonSettings = {
20
+ $id: {
21
+ title: 'ID',
22
+ description: '字段名称/英文',
23
+ type: 'string',
24
+ widget: 'idInput',
25
+ require: true,
26
+ rules: [{
27
+ pattern: '^#/.+$',
28
+ message: 'ID 必填'
29
+ }]
30
+ },
31
+ title: {
32
+ title: '标题',
33
+ type: 'string',
34
+ widget: 'htmlInput'
35
+ },
36
+ displayType: {
37
+ title: '标题展示模式',
38
+ type: 'string',
39
+ enum: ['row', 'column'],
40
+ enumNames: ['同行', '单独一行'],
41
+ widget: 'radio'
42
+ },
43
+ description: {
44
+ title: '说明',
45
+ type: 'string'
46
+ },
47
+ default: {
48
+ title: '默认值',
49
+ type: 'string'
50
+ },
51
+ required: {
52
+ title: '必填',
53
+ type: 'boolean'
54
+ },
55
+ placeholder: {
56
+ title: '占位符',
57
+ type: 'string'
58
+ },
59
+ bind: {
60
+ title: 'Bind',
61
+ type: 'string'
62
+ },
63
+ min: {
64
+ title: '最小值',
65
+ type: 'number'
66
+ },
67
+ max: {
68
+ title: '最大值',
69
+ type: 'number'
70
+ },
71
+ disabled: {
72
+ title: '禁用',
73
+ type: 'boolean'
74
+ },
75
+ readOnly: {
76
+ title: '只读',
77
+ type: 'boolean'
78
+ },
79
+ hidden: {
80
+ title: '隐藏',
81
+ type: 'boolean'
82
+ },
83
+ readOnlyWidget: {
84
+ title: '只读组件',
85
+ type: 'string'
86
+ },
87
+ width: {
88
+ title: '元素宽度',
89
+ type: 'string',
90
+ widget: 'percentSlider'
91
+ },
92
+ labelWidth: {
93
+ title: '标签宽度',
94
+ description: '默认值120',
95
+ type: 'number',
96
+ widget: 'slider',
97
+ max: 400,
98
+ props: {
99
+ hideNumber: true
100
+ }
101
+ }
102
+ };
103
+
104
+ // widget 用于指定 schema 右侧配置对应的 setting
105
+ export var elements = [{
106
+ text: '输入框',
107
+ name: 'input',
108
+ schema: {
109
+ title: '输入框',
110
+ type: 'string'
111
+ },
112
+ setting: {
113
+ props: {
114
+ title: '选项',
115
+ type: 'object',
116
+ labelWidth: 80,
117
+ properties: {
118
+ allowClear: {
119
+ title: '是否带清除按钮',
120
+ description: '填写内容后才会出现x哦',
121
+ type: 'boolean'
122
+ },
123
+ addonBefore: {
124
+ title: '前tab',
125
+ type: 'string'
126
+ },
127
+ addonAfter: {
128
+ title: '后tab',
129
+ type: 'string'
130
+ },
131
+ prefix: {
132
+ title: '前缀',
133
+ type: 'string'
134
+ },
135
+ suffix: {
136
+ title: '后缀',
137
+ type: 'string'
138
+ }
139
+ }
140
+ },
141
+ minLength: {
142
+ title: '最短字数',
143
+ type: 'number'
144
+ },
145
+ maxLength: {
146
+ title: '最长字数',
147
+ type: 'number'
148
+ },
149
+ pattern: {
150
+ title: '校验正则表达式',
151
+ type: 'string',
152
+ props: {
153
+ placeholder: '填写正则表达式'
154
+ }
155
+ }
156
+ }
157
+ }, {
158
+ text: '大输入框',
159
+ name: 'textarea',
160
+ schema: {
161
+ title: '编辑框',
162
+ type: 'string',
163
+ format: 'textarea'
164
+ },
165
+ setting: {
166
+ props: {
167
+ title: '选项',
168
+ type: 'object',
169
+ labelWidth: 80,
170
+ properties: {
171
+ autoSize: {
172
+ title: '高度自动',
173
+ type: 'boolean'
174
+ },
175
+ rows: {
176
+ title: '指定高度',
177
+ type: 'number'
178
+ }
179
+ }
180
+ },
181
+ minLength: {
182
+ title: '最短字数',
183
+ type: 'number'
184
+ },
185
+ maxLength: {
186
+ title: '最长字数',
187
+ type: 'number'
188
+ },
189
+ pattern: {
190
+ title: '校验正则表达式',
191
+ type: 'string',
192
+ props: {
193
+ placeholder: '填写正则表达式'
194
+ }
195
+ }
196
+ }
197
+ }, {
198
+ text: '日期选择',
199
+ name: 'date',
200
+ schema: {
201
+ title: '日期选择',
202
+ type: 'string',
203
+ format: 'date'
204
+ },
205
+ setting: {
206
+ format: {
207
+ title: '格式',
208
+ type: 'string',
209
+ enum: ['dateTime', 'date', 'time'],
210
+ enumNames: ['日期时间', '日期', '时间']
211
+ }
212
+ }
213
+ }, {
214
+ text: '时间选择',
215
+ name: 'time',
216
+ show: false,
217
+ schema: {
218
+ title: '时间选择',
219
+ type: 'string',
220
+ format: 'time'
221
+ },
222
+ setting: {
223
+ format: {
224
+ title: '格式',
225
+ type: 'string',
226
+ enum: ['dateTime', 'date', 'time'],
227
+ enumNames: ['日期时间', '日期', '时间']
228
+ }
229
+ }
230
+ }, {
231
+ text: '数字输入框',
232
+ name: 'number',
233
+ schema: {
234
+ title: '数字输入框',
235
+ type: 'number'
236
+ },
237
+ setting: {
238
+ default: {
239
+ title: '默认值',
240
+ type: 'number'
241
+ }
242
+ }
243
+ }, {
244
+ text: '是否选择',
245
+ name: 'checkbox',
246
+ schema: {
247
+ title: '是否选择',
248
+ type: 'boolean',
249
+ widget: 'checkbox'
250
+ },
251
+ setting: {
252
+ default: {
253
+ title: '是否默认勾选',
254
+ type: 'boolean'
255
+ }
256
+ }
257
+ }, {
258
+ text: '是否switch',
259
+ name: 'switch',
260
+ schema: {
261
+ title: '是否选择',
262
+ type: 'boolean',
263
+ widget: 'switch'
264
+ },
265
+ setting: {
266
+ default: {
267
+ title: '是否默认开启',
268
+ type: 'boolean'
269
+ }
270
+ }
271
+ }, {
272
+ text: '下拉单选',
273
+ name: 'select',
274
+ schema: {
275
+ title: '单选',
276
+ type: 'string',
277
+ enum: ['a', 'b', 'c'],
278
+ enumNames: ['早', '中', '晚'],
279
+ widget: 'select'
280
+ },
281
+ setting: {
282
+ enumList: {
283
+ title: '选项',
284
+ type: 'array',
285
+ widget: 'simpleList',
286
+ className: 'frg-options-list',
287
+ items: {
288
+ type: 'object',
289
+ properties: {
290
+ value: {
291
+ title: '',
292
+ type: 'string',
293
+ className: 'frg-options-input',
294
+ props: {},
295
+ placeholder: '字段'
296
+ },
297
+ label: {
298
+ title: '',
299
+ type: 'string',
300
+ className: 'frg-options-input',
301
+ props: {},
302
+ placeholder: '名称'
303
+ }
304
+ }
305
+ },
306
+ props: {
307
+ hideMove: true,
308
+ hideCopy: true
309
+ }
310
+ }
311
+ }
312
+ }, {
313
+ text: '点击单选',
314
+ name: 'radio',
315
+ schema: {
316
+ title: '单选',
317
+ type: 'string',
318
+ enum: ['a', 'b', 'c'],
319
+ enumNames: ['早', '中', '晚'],
320
+ widget: 'radio'
321
+ },
322
+ setting: {
323
+ enumList: {
324
+ title: '选项',
325
+ type: 'array',
326
+ widget: 'simpleList',
327
+ className: 'frg-options-list',
328
+ items: {
329
+ type: 'object',
330
+ properties: {
331
+ value: {
332
+ title: '',
333
+ type: 'string',
334
+ className: 'frg-options-input',
335
+ props: {},
336
+ placeholder: '字段'
337
+ },
338
+ label: {
339
+ title: '',
340
+ type: 'string',
341
+ className: 'frg-options-input',
342
+ props: {},
343
+ placeholder: '名称'
344
+ }
345
+ }
346
+ },
347
+ props: {
348
+ hideMove: true,
349
+ hideCopy: true
350
+ }
351
+ }
352
+ }
353
+ }, {
354
+ text: '下拉多选',
355
+ name: 'multiSelect',
356
+ schema: {
357
+ title: '多选',
358
+ description: '下拉多选',
359
+ type: 'array',
360
+ items: {
361
+ type: 'string'
362
+ },
363
+ enum: ['A', 'B', 'C', 'D'],
364
+ enumNames: ['杭州', '武汉', '湖州', '贵阳'],
365
+ widget: 'multiSelect'
366
+ },
367
+ setting: {
368
+ default: {
369
+ title: '默认值',
370
+ type: 'array',
371
+ widget: 'jsonInput'
372
+ },
373
+ enumList: {
374
+ title: '选项',
375
+ type: 'array',
376
+ widget: 'simpleList',
377
+ className: 'frg-options-list',
378
+ items: {
379
+ type: 'object',
380
+ properties: {
381
+ value: {
382
+ title: '',
383
+ type: 'string',
384
+ className: 'frg-options-input',
385
+ props: {},
386
+ placeholder: '字段'
387
+ },
388
+ label: {
389
+ title: '',
390
+ type: 'string',
391
+ className: 'frg-options-input',
392
+ props: {},
393
+ placeholder: '名称'
394
+ }
395
+ }
396
+ },
397
+ props: {
398
+ hideMove: true,
399
+ hideCopy: true
400
+ }
401
+ }
402
+ }
403
+ }, {
404
+ text: '点击多选',
405
+ name: 'checkboxes',
406
+ schema: {
407
+ title: '多选',
408
+ type: 'array',
409
+ widget: 'checkboxes',
410
+ items: {
411
+ type: 'string'
412
+ },
413
+ enum: ['A', 'B', 'C', 'D'],
414
+ enumNames: ['杭州', '武汉', '湖州', '贵阳']
415
+ },
416
+ setting: {
417
+ default: {
418
+ title: '默认值',
419
+ type: 'array',
420
+ widget: 'jsonInput'
421
+ },
422
+ enumList: {
423
+ title: '选项',
424
+ type: 'array',
425
+ widget: 'simpleList',
426
+ className: 'frg-options-list',
427
+ items: {
428
+ type: 'object',
429
+ properties: {
430
+ value: {
431
+ title: '',
432
+ type: 'string',
433
+ className: 'frg-options-input',
434
+ props: {},
435
+ placeholder: '字段'
436
+ },
437
+ label: {
438
+ title: '',
439
+ type: 'string',
440
+ className: 'frg-options-input',
441
+ props: {},
442
+ placeholder: '名称'
443
+ }
444
+ }
445
+ },
446
+ props: {
447
+ hideMove: true,
448
+ hideCopy: true
449
+ }
450
+ }
451
+ }
452
+ }, {
453
+ text: 'HTML',
454
+ name: 'html',
455
+ schema: {
456
+ title: 'HTML',
457
+ type: 'string',
458
+ widget: 'html'
459
+ },
460
+ setting: {
461
+ props: {
462
+ type: 'object',
463
+ properties: {
464
+ value: {
465
+ title: '展示内容',
466
+ type: 'string'
467
+ }
468
+ }
469
+ }
470
+ }
471
+ }];
472
+ export var advancedElements = [{
473
+ text: '日期范围',
474
+ name: 'dateRange',
475
+ schema: {
476
+ title: '日期范围',
477
+ type: 'range',
478
+ format: 'dateTime',
479
+ props: {
480
+ placeholder: ['开始时间', '结束时间']
481
+ }
482
+ },
483
+ setting: {
484
+ format: {
485
+ title: '类型',
486
+ type: 'string',
487
+ enum: ['dateTime', 'date'],
488
+ enumNames: ['日期时间', '日期']
489
+ }
490
+ }
491
+ }, {
492
+ text: '数字(slider)',
493
+ name: 'slider',
494
+ schema: {
495
+ title: '带滑动条',
496
+ type: 'number',
497
+ widget: 'slider'
498
+ },
499
+ setting: {
500
+ default: {
501
+ title: '默认值',
502
+ type: 'number'
503
+ }
504
+ }
505
+ }, {
506
+ text: '图片展示',
507
+ name: 'image',
508
+ schema: {
509
+ title: '图片展示',
510
+ type: 'string',
511
+ format: 'image'
512
+ },
513
+ setting: {}
514
+ }, {
515
+ text: '颜色选择',
516
+ name: 'color',
517
+ schema: {
518
+ title: '颜色选择',
519
+ type: 'string',
520
+ format: 'color'
521
+ },
522
+ setting: {}
523
+ }];
524
+ export var layouts = [{
525
+ text: '对象',
526
+ name: 'object',
527
+ schema: {
528
+ title: '对象',
529
+ type: 'object',
530
+ properties: {}
531
+ },
532
+ setting: {
533
+ theme: {
534
+ title: '主题',
535
+ type: 'string',
536
+ enum: ['collapse', 'collapse:pure', 'collapse:ghost', 'card', 'tile', 'flex'],
537
+ enumNames: ['默认', '无框', '幽灵', '卡片', '平铺', '弹性'],
538
+ default: 'collapse',
539
+ widget: 'radio'
540
+ },
541
+ props: {
542
+ title: '弹性布局',
543
+ hidden: '{{"flex" !== formData.theme}}',
544
+ type: 'object',
545
+ theme: 'tile',
546
+ properties: {
547
+ style: {
548
+ title: '布局样式',
549
+ type: 'object',
550
+ theme: 'flex',
551
+ props: {
552
+ style: {
553
+ flexDirection: 'column'
554
+ }
555
+ },
556
+ properties: {
557
+ height: {
558
+ title: '高度',
559
+ description: 'height',
560
+ type: 'string',
561
+ widget: 'input'
562
+ },
563
+ flexDirection: {
564
+ title: '布局方向',
565
+ description: 'flex-direction',
566
+ type: 'string',
567
+ enum: ['row', 'row-reverse', 'column', 'column-reverse'],
568
+ enumNames: ['横向', '横向反转', '纵向', '纵向反转'],
569
+ widget: 'select'
570
+ },
571
+ flexWrap: {
572
+ title: '换行方式',
573
+ description: 'flex-wrap',
574
+ type: 'string',
575
+ enum: ['wrap', 'nowrap', 'wrap-reverse'],
576
+ enumNames: ['换行', '不换行', '反向换行'],
577
+ widget: 'select'
578
+ },
579
+ justifyContent: {
580
+ title: '对齐方式',
581
+ description: 'justify-content',
582
+ type: 'string',
583
+ enum: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around'],
584
+ enumNames: ['起点对齐', '终点对齐', '居中对齐', '两端对齐', '相同间距'],
585
+ widget: 'select'
586
+ },
587
+ alignItems: {
588
+ title: '轴对齐方式',
589
+ description: 'align-items',
590
+ type: 'string',
591
+ enum: ['flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
592
+ enumNames: ['起点对齐', '终点对齐', '居中对齐', '基线对齐', '拉伸铺满'],
593
+ widget: 'select'
594
+ },
595
+ alignContent: {
596
+ title: '多轴线对齐',
597
+ description: 'align-content',
598
+ type: 'string',
599
+ enum: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch'],
600
+ enumNames: ['起点对齐', '终点对齐', '居中对齐', '两端对齐', '相同间距', '拉伸铺满'],
601
+ widget: 'select'
602
+ }
603
+ }
604
+ }
605
+ }
606
+ },
607
+ style: {
608
+ title: '元素样式',
609
+ type: 'object',
610
+ properties: {
611
+ background: {
612
+ title: '背景',
613
+ description: 'background',
614
+ type: 'string',
615
+ widget: 'color'
616
+ },
617
+ margin: {
618
+ title: '外边距',
619
+ description: 'margin',
620
+ type: 'string',
621
+ widget: 'input'
622
+ },
623
+ padding: {
624
+ title: '内边距',
625
+ description: 'padding',
626
+ type: 'string',
627
+ widget: 'input'
628
+ },
629
+ borderWidth: {
630
+ title: '边框宽',
631
+ description: 'border-width',
632
+ type: 'string',
633
+ widget: 'input'
634
+ },
635
+ borderStyle: {
636
+ title: '边框样式',
637
+ description: 'border-style',
638
+ type: 'string',
639
+ widget: 'input'
640
+ },
641
+ borderColor: {
642
+ title: '边框颜色',
643
+ description: 'border-color',
644
+ type: 'string',
645
+ widget: 'color'
646
+ },
647
+ borderRadius: {
648
+ title: '圆角',
649
+ description: 'border-radius',
650
+ type: 'string',
651
+ widget: 'input'
652
+ },
653
+ flex: {
654
+ title: '弹性伸缩',
655
+ description: 'flex',
656
+ type: 'string',
657
+ widget: 'input'
658
+ },
659
+ order: {
660
+ title: '排列顺序',
661
+ description: 'order',
662
+ type: 'string',
663
+ widget: 'input'
664
+ },
665
+ alignSelf: {
666
+ title: '自身对齐',
667
+ description: 'align-self',
668
+ type: 'string',
669
+ widget: 'input'
670
+ }
671
+ }
672
+ }
673
+ }
674
+ }, {
675
+ text: '常规列表',
676
+ name: 'list',
677
+ schema: {
678
+ title: '数组',
679
+ type: 'array',
680
+ items: {
681
+ type: 'object',
682
+ properties: {}
683
+ }
684
+ },
685
+ setting: {
686
+ default: {
687
+ title: '默认值',
688
+ type: 'array',
689
+ widget: 'jsonInput'
690
+ },
691
+ items: {
692
+ type: 'object',
693
+ hidden: '{{true}}'
694
+ },
695
+ min: {
696
+ title: '最小长度',
697
+ type: 'number'
698
+ },
699
+ max: {
700
+ title: '最大长度',
701
+ type: 'number'
702
+ },
703
+ props: {
704
+ title: '选项',
705
+ type: 'object',
706
+ properties: {
707
+ // foldable: {
708
+ // title: '是否可折叠',
709
+ // type: 'boolean',
710
+ // },
711
+ hideDelete: {
712
+ title: '隐藏删除按钮',
713
+ type: 'string'
714
+ },
715
+ hideAdd: {
716
+ title: '隐藏新增/复制按钮',
717
+ type: 'string'
718
+ }
719
+ }
720
+ }
721
+ }
722
+ }, {
723
+ text: '简单列表',
724
+ name: 'simpleList',
725
+ schema: {
726
+ title: '数组',
727
+ type: 'array',
728
+ widget: 'simpleList',
729
+ items: {
730
+ type: 'object',
731
+ properties: {}
732
+ }
733
+ },
734
+ setting: {
735
+ default: {
736
+ title: '默认值',
737
+ type: 'array',
738
+ widget: 'jsonInput'
739
+ },
740
+ items: {
741
+ type: 'object',
742
+ hidden: '{{true}}'
743
+ },
744
+ min: {
745
+ title: '最小长度',
746
+ type: 'number'
747
+ },
748
+ max: {
749
+ title: '最大长度',
750
+ type: 'number'
751
+ },
752
+ props: {
753
+ title: '选项',
754
+ type: 'object',
755
+ properties: {
756
+ // foldable: {
757
+ // title: '是否可折叠',
758
+ // type: 'boolean',
759
+ // },
760
+ hideTitle: {
761
+ title: '隐藏标题',
762
+ type: 'boolean'
763
+ },
764
+ hideDelete: {
765
+ title: '隐藏删除按钮',
766
+ type: 'string'
767
+ },
768
+ hideAdd: {
769
+ title: '隐藏新增/复制按钮',
770
+ type: 'string'
771
+ }
772
+ }
773
+ }
774
+ }
775
+ }, {
776
+ text: '表格列表',
777
+ name: 'list2',
778
+ schema: {
779
+ title: '数组',
780
+ type: 'array',
781
+ widget: 'list2',
782
+ items: {
783
+ type: 'object',
784
+ properties: {}
785
+ }
786
+ },
787
+ setting: {
788
+ default: {
789
+ title: '默认值',
790
+ type: 'array',
791
+ widget: 'jsonInput'
792
+ },
793
+ items: {
794
+ type: 'object',
795
+ hidden: '{{true}}'
796
+ },
797
+ min: {
798
+ title: '最小长度',
799
+ type: 'number'
800
+ },
801
+ max: {
802
+ title: '最大长度',
803
+ type: 'number'
804
+ },
805
+ props: {
806
+ title: '选项',
807
+ type: 'object',
808
+ properties: {
809
+ // foldable: {
810
+ // title: '是否可折叠',
811
+ // type: 'boolean',
812
+ // },
813
+ hideDelete: {
814
+ title: '隐藏删除按钮',
815
+ type: 'string'
816
+ },
817
+ hideAdd: {
818
+ title: '隐藏新增/复制按钮',
819
+ type: 'string'
820
+ },
821
+ hideCopy: {
822
+ title: '隐藏复制按钮',
823
+ type: 'string'
824
+ },
825
+ hideMove: {
826
+ title: '隐藏上下移动按钮',
827
+ type: 'string'
828
+ }
829
+ }
830
+ }
831
+ }
832
+ }, {
833
+ text: '复杂表格列表',
834
+ name: 'drawerList',
835
+ schema: {
836
+ title: '数组',
837
+ type: 'array',
838
+ widget: 'drawerList',
839
+ items: {
840
+ type: 'object',
841
+ properties: {}
842
+ }
843
+ },
844
+ setting: {
845
+ default: {
846
+ title: '默认值',
847
+ type: 'array',
848
+ widget: 'jsonInput'
849
+ },
850
+ items: {
851
+ type: 'object',
852
+ hidden: '{{true}}'
853
+ },
854
+ min: {
855
+ title: '最小长度',
856
+ type: 'number'
857
+ },
858
+ max: {
859
+ title: '最大长度',
860
+ type: 'number'
861
+ },
862
+ props: {
863
+ title: '选项',
864
+ type: 'object',
865
+ properties: {
866
+ // foldable: {
867
+ // title: '是否可折叠',
868
+ // type: 'boolean',
869
+ // },
870
+ hideDelete: {
871
+ title: '隐藏删除按钮',
872
+ type: 'string'
873
+ },
874
+ hideAdd: {
875
+ title: '隐藏新增/复制按钮',
876
+ type: 'string'
877
+ }
878
+ }
879
+ }
880
+ }
881
+ }];
882
+ var saves = [{
883
+ text: '复杂结构样例',
884
+ name: 'something',
885
+ schema: {
886
+ title: '对象',
887
+ description: '这是一个对象类型',
888
+ type: 'object',
889
+ properties: {
890
+ inputName: {
891
+ title: '简单输入框',
892
+ type: 'string'
893
+ },
894
+ selectName: {
895
+ title: '单选',
896
+ type: 'string',
897
+ enum: ['a', 'b', 'c'],
898
+ enumNames: ['早', '中', '晚']
899
+ },
900
+ dateName: {
901
+ title: '时间选择',
902
+ type: 'string',
903
+ format: 'date'
904
+ },
905
+ listName: {
906
+ title: '对象数组',
907
+ description: '对象数组嵌套功能',
908
+ type: 'array',
909
+ items: {
910
+ type: 'object',
911
+ properties: {
912
+ rangeName: {
913
+ title: '日期/时间范围',
914
+ type: 'range',
915
+ format: 'date',
916
+ props: {
917
+ placeholder: ['开始日期', '结束日期']
918
+ }
919
+ }
920
+ }
921
+ }
922
+ }
923
+ }
924
+ }
925
+ }];
926
+ export var defaultSettings = [{
927
+ title: '基础组件',
928
+ widgets: elements,
929
+ show: true,
930
+ useCommon: true // TODO: 是否将common
931
+ }, {
932
+ title: '高级组件',
933
+ widgets: advancedElements
934
+ }
935
+ // {
936
+ // title: '布局组件',
937
+ // widgets: layouts,
938
+ // },
939
+ // {
940
+ // title: '模板',
941
+ // widgets: saves,
942
+ // },
943
+ ];
944
+ export var defaultGlobalSettings = {
945
+ type: 'object',
946
+ properties: {
947
+ column: {
948
+ title: '整体布局',
949
+ type: 'number',
950
+ enum: [1, 2, 3],
951
+ enumNames: ['一行一列', '一行二列', '一行三列'],
952
+ props: {
953
+ placeholder: '默认一行一列'
954
+ }
955
+ },
956
+ labelWidth: {
957
+ title: '标签宽度',
958
+ type: 'number',
959
+ widget: 'slider',
960
+ max: 300,
961
+ default: 120,
962
+ props: {
963
+ hideNumber: true
964
+ }
965
+ },
966
+ displayType: {
967
+ title: '标签展示模式',
968
+ type: 'string',
969
+ default: 'row',
970
+ enum: ['row', 'column'],
971
+ enumNames: ['同行', '单独一行'],
972
+ widget: 'radio'
973
+ }
974
+ }
975
+ };