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