Skip to content

Commit

Permalink
add readonly property (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmister authored Apr 29, 2021
1 parent 5f5f9fa commit 954c5b3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions apps/field.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package apps

type FieldType string
type TextFieldSubtype string

const (
// Text field. "subtype":"textarea" for multi-line text input (Modal only?).
Expand All @@ -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 {
Expand All @@ -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"`
Expand Down Expand Up @@ -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"`
}

0 comments on commit 954c5b3

Please sign in to comment.