· 6 years ago · Dec 09, 2019, 12:44 AM
1Formio.builder(document.getElementById('builder'), {}, {
2 builder: {
3 basic: false,
4 advanced: false,
5 data: false,
6 customBasic: {
7 title: 'Basic Components',
8 default: true,
9 weight: 0,
10 components: {
11 textfield: true,
12 textarea: true,
13 email: true,
14 phoneNumber: true
15 }
16 },
17 custom: {
18 title: 'User Fields',
19 weight: 10,
20 components: {
21 firstName: {
22 title: 'First Name',
23 key: 'firstName',
24 icon: 'terminal',
25 schema: {
26 label: 'First Name',
27 type: 'textfield',
28 key: 'firstName',
29 input: true
30 }
31 },
32 lastName: {
33 title: 'Last Name',
34 key: 'lastName',
35 icon: 'terminal',
36 schema: {
37 label: 'Last Name',
38 type: 'textfield',
39 key: 'lastName',
40 input: true
41 }
42 },
43 email: {
44 title: 'Email',
45 key: 'email',
46 icon: 'at',
47 schema: {
48 label: 'Email',
49 type: 'email',
50 key: 'email',
51 input: true
52 }
53 },
54 phoneNumber: {
55 title: 'Mobile Phone',
56 key: 'mobilePhone',
57 icon: 'phone-square',
58 schema: {
59 label: 'Mobile Phone',
60 type: 'phoneNumber',
61 key: 'mobilePhone',
62 input: true
63 }
64 }
65 }
66 },
67 layout: {
68 components: {
69 table: false
70 }
71 }
72 },
73 editForm: {
74 textfield: [
75 {
76 key: 'display',
77 components: [
78 {key: "placeholder", ignore: true},
79 {key: "tooltip", ignore: true},
80 {key: "description", ignore: true},
81 {key: "prefix", ignore: true},
82 {key: "suffix", ignore: true},
83 {key: "inputMask", ignore: true},
84 {key: "customClass", ignore: true},
85 {key: "widget.type", ignore: true},
86 {key: "allowMultipleMasks", ignore: true},
87 {key: "hidden", ignore: true},
88 {key: "hideLabel", ignore: true},
89 {key: "showWordCount", ignore: true},
90 {key: "showCharCount", ignore: true},
91 {key: "hideInput", ignore: true},
92 {key: "autofocus", ignore: true},
93 {key: "spellcheck", ignore: true},
94 {key: "disabled", ignore: true},
95 {key: "tableView", ignore: true},
96 {key: "mask", ignore: true},
97 {key: "tabindex", ignore: true},
98 ]
99 } ,
100 {key: 'data', ignore: true},
101 {key: 'api', ignore: true},
102 {key: 'conditional', ignore: true},
103 {key: 'layout', ignore: true},
104
105 ]
106 }
107}).then(function(builder) {
108 builder.on('saveComponent', function() {
109 console.log(builder.schema);
110 });
111});