From 01c57929151de9a0a2f68ab64c9d929139ac47c4 Mon Sep 17 00:00:00 2001 From: Michael Kochell <6913320+mickmister@users.noreply.github.com> Date: Fri, 23 Apr 2021 20:05:06 -0400 Subject: [PATCH] add readonly property --- apps/field.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/field.go b/apps/field.go index d7768da60..aa998d2b2 100644 --- a/apps/field.go +++ b/apps/field.go @@ -1,6 +1,7 @@ package apps type FieldType string +type TextFieldSubtype string const ( // Text field. "subtype":"textarea" for multi-line text input (Modal only?). @@ -22,6 +23,14 @@ const ( // A mattermost channel reference (~name). FieldTypeChannel FieldType = "channel" + + TextFieldSubtypeInput TextFieldSubtype = "input" + TextFieldSubtypeTextarea TextFieldSubtype = "textarea" + TextFieldSubtypeNumber TextFieldSubtype = "number" + TextFieldSubtypeEmail TextFieldSubtype = "email" + TextFieldSubtypeTelephone TextFieldSubtype = "tel" + TextFieldSubtypeURL TextFieldSubtype = "url" + TextFieldSubtypePassword TextFieldSubtype = "password" ) type SelectOption struct { @@ -38,6 +47,7 @@ type Field struct { Type FieldType `json:"type"` IsRequired bool `json:"is_required,omitempty"` + ReadOnly bool `json:"readonly,omitempty"` // Present (default) value of the field Value interface{} `json:"value,omitempty"` @@ -72,7 +82,7 @@ type Field struct { SelectStaticOptions []SelectOption `json:"options,omitempty"` // Text props - TextSubtype string `json:"subtype,omitempty"` - TextMinLength int `json:"min_length,omitempty"` - TextMaxLength int `json:"max_length,omitempty"` + TextSubtype TextFieldSubtype `json:"subtype,omitempty"` + TextMinLength int `json:"min_length,omitempty"` + TextMaxLength int `json:"max_length,omitempty"` }