diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-03-27 08:48:05 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-03-27 08:48:05 +0100 |
| commit | 830e7c5d27d161b91402414e6ecd49f1ed818bfb (patch) | |
| tree | 448864635d29b1ea66424cbb9e0816fbcf1e1907 /lib/model/field.mli | |
Initial commit
Diffstat (limited to 'lib/model/field.mli')
| -rw-r--r-- | lib/model/field.mli | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/model/field.mli b/lib/model/field.mli new file mode 100644 index 0000000..a121871 --- /dev/null +++ b/lib/model/field.mli @@ -0,0 +1,35 @@ +type textI18n = (string * string) list +(** A label is just an association list*) + +type validation = { rule : string list Dsl.t; message : textI18n } +type 't field_ex = T : ('a, 't) Typ.t -> 't field_ex + +type 'ref t +(** Description of a field *) + +val create : + 'ref field_ex -> + textI18n -> + ?placeholder:textI18n -> + ?icon:unit -> + ?required:bool -> + ?validation:validation list -> + ?criteria:string list Dsl.t -> + string -> + 'ref t + +val name : _ t -> string +(** Name (identifier) for the field*) + +val label : _ t -> textI18n +val placeholder : _ t -> textI18n option +val icon : _ t -> unit option +val type_ : 'ref t -> 'ref field_ex +val required : _ t -> bool +val validation : _ t -> validation list +val criteria : _ t -> string list Dsl.t option + +val map : ('a -> 'b) -> 'a t -> 'b t +(** Change the type of reference in the field. Used when loading the + configuration to switch between fields referencing string (the name given in + the configuration) and actual contents *) |
