Software /
code /
prosody
Changeset
12614:d498e7e7853a
util.dataforms: Restructure Teal definition file
The PR has been merged and there's no reason not to have nested records
and other definitions.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 15 Nov 2021 17:07:23 +0100 |
parents | 12613:a27870dcaf24 |
children | 12615:b2047b82ec85 |
files | teal-src/util/dataforms.d.tl |
diffstat | 1 files changed, 38 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/teal-src/util/dataforms.d.tl Wed Nov 10 15:12:03 2021 +0100 +++ b/teal-src/util/dataforms.d.tl Mon Nov 15 17:07:23 2021 +0100 @@ -1,51 +1,52 @@ local stanza_t = require "util.stanza".stanza_t -local enum form_type - "form" - "submit" - "cancel" - "result" -end +local record lib + record dataform + title : string + instructions : string + + record form_field -local enum field_type - "boolean" - "fixed" - "hidden" - "jid-multi" - "jid-single" - "list-multi" - "list-single" - "text-multi" - "text-private" - "text-single" -end + enum field_type + "boolean" + "fixed" + "hidden" + "jid-multi" + "jid-single" + "list-multi" + "list-single" + "text-multi" + "text-private" + "text-single" + end -local record form_field + type : field_type + var : string -- protocol name + name : string -- internal name - type : field_type - var : string -- protocol name - name : string -- internal name + label : string + desc : string - label : string - desc : string + datatype : string + range_min : number + range_max : number - datatype : string - range_min : number - range_max : number + value : any -- depends on field_type + options : table + end - value : any -- depends on field_type - options : table -end + { form_field } -local record dataform - title : string - instructions : string - { form_field } -- XXX https://github.com/teal-language/tl/pull/415 + enum form_type + "form" + "submit" + "cancel" + "result" + end - form : function ( dataform, table, form_type ) : stanza_t -end + form : function ( dataform, { string : any }, form_type ) : stanza_t + end -local record lib new : function ( dataform ) : dataform end