Software /
code /
prosody
Annotate
teal-src/util/dataforms.d.tl @ 11434:66d4067bdfb2
util.jsonschema: Library for JSON Schema validation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 06 Mar 2021 21:07:53 +0100 |
parent | 11432:113f3912c7cb |
child | 12614:d498e7e7853a |
rev | line source |
---|---|
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local stanza_t = require "util.stanza".stanza_t |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local enum form_type |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 "form" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 "submit" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 "cancel" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 "result" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 end |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 local enum field_type |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 "boolean" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 "fixed" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 "hidden" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 "jid-multi" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 "jid-single" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 "list-multi" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 "list-single" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 "text-multi" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 "text-private" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 "text-single" |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 end |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 local record form_field |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 type : field_type |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 var : string -- protocol name |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 name : string -- internal name |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 label : string |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 desc : string |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 datatype : string |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 range_min : number |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 range_max : number |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 value : any -- depends on field_type |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 options : table |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 end |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 local record dataform |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 title : string |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 instructions : string |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 { form_field } -- XXX https://github.com/teal-language/tl/pull/415 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 form : function ( dataform, table, form_type ) : stanza_t |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 end |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
48 local record lib |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 new : function ( dataform ) : dataform |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 end |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
52 return lib |