forked from Fliplet/fliplet-widget-form-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.json
480 lines (479 loc) · 15.8 KB
/
schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Form component",
"description": "This is the schema for the form component. This schema is used to create the form component in the builder and to render the form component in the frontend.",
"type": "object",
"properties": {
"name": {
"title": "The title of this form",
"examples": ["Edit your profile"],
"type": "string",
"required": true
},
"displayName": {
"type": "string",
"title": "The text to display at the top of the form",
"description": "This is typically the same as the name of the form, but can be different if you want to display a different title at the top of the form.",
"examples": ["Edit your profile"],
"required": true
},
"onSubmit": {
"type": "array",
"title": "The actions to perform when the form is submitted",
"default": [],
"required": true
},
"resultHtml": {
"type": "string",
"title": "The HTML to display when the form is submitted",
"default": "Thank you for submitting the form."
},
"saveProgress": {
"type": "boolean",
"title": "Save the progress of the form when the user leaves the page",
"default": true
},
"offline": {
"type": "boolean",
"title": "Allow the form to be used offline",
"default": true
},
"fields": {
"title": "The fields of this form",
"description": "This is an array of fields that make up the form. The order of the fields in this array will be the order in which they appear on the form. The last field in this array should always be the 'flButtons' field.",
"type": "array",
"required": true,
"items": {
"type": "object",
"properties": {
"name": {
"title": "The name of the field",
"type": "string"
},
"_type": {
"title": "The type of the field",
"type": "string"
},
"label": {
"title": "The label of the field to display in the screen",
"type": "string"
},
"_submit": {
"type": "boolean",
"title": "Whether this field should be submitted with the form",
"default": true
},
"canHide": {
"type": "boolean",
"title": "Whether this field can be hidden",
"default": false
},
"isHidden": {
"type": "boolean",
"title": "Whether this field is hidden by default",
"default": false
},
"readonly": {
"type": "boolean",
"title": "Whether this field is readonly",
"default": false
},
"required": {
"type": "boolean",
"title": "Whether this field is required to submit the form",
"default": false
},
"showLabel": {
"type": "boolean",
"title": "Whether this field should show the label",
"default": true
},
"description": {
"title": "The description of the field",
"type": "string"
},
"placeholder": {
"title": "The placeholder of the field when there is no content added",
"type": "string"
},
"defaultValueSource": {
"type": "string",
"title": "The source of the default value",
"enum": ["default", "profile", "appStorage", "query"]
},
"defaultValueKey": {
"type": "string",
"title": "The key of the default value to look up in the defined source"
}
},
"required": [
"name",
"_type",
"label",
"_submit",
"canHide",
"isValid",
"isHidden",
"readonly",
"required",
"showLabel"
],
"oneOf": [
{
"title": "A generic input for text",
"description": "This is the most basic input field. It can be used for any text input.",
"properties": {
"_type": {
"enum": ["flInput"]
},
"generateGuid": {
"type": "boolean"
},
"idType": {
"type": "string"
}
},
"required": ["_type"]
},
{
"title": "A input to enter an email address",
"description": "This is a special input field that is used to enter an email address. It will validate the email address to ensure it is in the correct format.",
"properties": {
"_type": {
"enum": ["flEmail"]
}
},
"required": ["_type"]
},
{
"title": "A generic input for numbers",
"description": "This is a special input field that is used to enter a number. It will validate the number to ensure it is in the correct format.",
"properties": {
"_type": {
"enum": ["flNumber"]
},
"decimals": {
"type": "number"
},
"positiveOnly": {
"type": "boolean"
}
},
"required": ["_type"]
},
{
"title": "A generic input for telephone numbers",
"description": "This is a special input field that is used to enter a telephone number. It will validate the telephone number to ensure it is in the correct format.",
"properties": {
"_type": {
"enum": ["flTelephone"]
}
},
"required": ["_type"]
},
{
"title": "A generic input for urls and links",
"description": "This is a special input field that is used to enter a url or link. It will validate the url to ensure it is in the correct format.",
"properties": {
"_type": {
"enum": ["flUrl"]
}
},
"required": ["_type"]
},
{
"title": "The required form submit buttons.",
"description": "This is a special field that is required for the form to function properly. It should always be present as the last field of the form.",
"properties": {
"_type": {
"enum": ["flButtons"]
},
"clearType": {
"type": "string",
"default": "button"
},
"clearValue": {
"type": "string",
"default": "Clear"
},
"showClear": {
"type": "boolean",
"default": true
},
"showSubmit": {
"type": "boolean",
"default": true
},
"submitType": {
"type": "string",
"default": "submit"
},
"submitValue": {
"type": "string",
"default": "Submit"
}
},
"required": [
"_type",
"clearType",
"clearValue",
"showClear",
"showSubmit",
"submitType",
"submitValue"
]
},
{
"title": "A generic input for passwords",
"description": "This is a special input field that is used to enter a password. It will validate the password to ensure it is in the correct format. It will also have an optional confirmation field to ensure the password was entered correctly.",
"properties": {
"_type": {
"enum": ["flPassword"]
},
"autogenerate": {
"type": "boolean"
},
"hash": {
"type": "boolean",
"title": "Whether the password should be securely hashed before being saved to the database.",
"default": true
},
"confirm": {
"title": "Whether a confirmation field should be shown for this password field.",
"type": "boolean"
},
"saveProgress": {
"type": "boolean",
"default": false
},
"submitWhenFalsy": {
"type": "boolean",
"title": "Whether the form should be submitted when the password field is empty.",
"default": false
},
"populateOnUpdate": {
"type": "boolean",
"default": false
},
"autogenerateLength": {
"title": "The length of the password to autogenerate.",
"type": "number"
},
"hasConfirmationError": {
"type": "boolean",
"default": false
}
},
"required": [
"_type",
"autogenerate",
"confirm",
"saveProgress",
"submitWhenFalsy",
"populateOnUpdate",
"autogenerateLength",
"hasConfirmationError",
"passwordConfirmation"
]
},
{
"title": "A wysiwyg textarea editor with rich content text editing capabilities",
"properties": {
"_type": {
"enum": ["flWysiwyg"]
},
"rows": {
"type": "number",
"default": 5
}
},
"required": ["_type", "rows"]
},
{
"title": "A textarea editor with basic text editing capabilities",
"properties": {
"_type": {
"enum": ["flTextarea"]
},
"rows": {
"type": "number",
"default": 5
}
},
"required": ["_type", "rows"]
},
{
"title": "A field to select a date",
"properties": {
"_type": {
"enum": ["flDate"]
}
},
"required": ["_type"]
},
{
"title": "A field to select a time",
"properties": {
"_type": {
"enum": ["flTime"]
}
},
"required": ["_type"]
},
{
"title": "A select field to choose one option from a list",
"properties": {
"_type": {
"enum": ["flSelect"]
},
"options": {
"type": "array",
"items": {
"type": "object",
"title": "The options to choose from",
"properties": {
"label": {
"title": "The label to display for the option",
"type": "string"
},
"value": {
"title": "The value to save for the option",
"type": "string"
}
},
"required": ["label", "value"]
}
}
},
"required": ["_type", "options"]
},
{
"title": "A radio field to choose one option from a list",
"properties": {
"_type": {
"enum": ["flRadio"]
},
"options": {
"title": "The options to choose from",
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"title": "The label to display for the option",
"type": "string"
},
"value": {
"title": "The value to save for the option",
"type": "string"
}
},
"required": ["label", "value"]
}
}
}
},
{
"title": "A multi-select checkbox field to choose one or more options from a list",
"properties": {
"_type": {
"enum": ["flCheckbox"]
},
"value": {
"type": "array",
"title": "The list of selected values",
"default": [],
"required": true
},
"options": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"title": "The label to display for the option",
"type": "string"
},
"value": {
"title": "The value to save for the option",
"type": "string"
}
},
"required": ["label", "value"]
}
}
}
},
{
"title": "A field to select an image to upload",
"description": "This is a special input field that is used to upload an image. It will validate the image to ensure it is in the correct format.",
"properties": {
"_type": {
"enum": ["flImage"]
}
},
"required": ["_type"]
},
{
"title": "A field to select a file to upload",
"description": "This is a special input field that is used to upload a file. It will validate the file to ensure it is in the correct format.",
"properties": {
"_type": {
"enum": ["flFile"]
}
},
"required": ["_type"]
},
{
"title": "A field to add a read-only text string displayed as a title",
"description": "This is a special input field that is used to display a title. It will not be saved to the database.",
"properties": {
"_type": {
"enum": ["flTitle"]
},
"value": {
"title": "The text to display",
"type": "string"
}
},
"required": ["_type"]
},
{
"title": "A field to add a read-only text string displayed as a paragraph",
"description": "This is a special input field that is used to display a paragraph. It will not be saved to the database.",
"properties": {
"_type": {
"enum": ["flParagraph"]
},
"value": {
"title": "The text to display",
"type": "string"
}
},
"required": ["_type"]
},
{
"title": "A field to select a rating from 1 to 5 stars",
"description": "This is a special input field that is used to let the user select a rating.",
"properties": {
"_type": {
"enum": ["flStarRating"]
}
},
"required": ["_type"]
},
{
"title": "A field to write a signature",
"description": "This is a special input field that is used by the user write a signature using their finger.",
"properties": {
"_type": {
"enum": ["flSignature"]
}
},
"required": ["_type"]
}
]
}
}
}
}