Documentation ¶
Overview ¶
templ: version: v0.2.707
Index ¶
- func ErrorListComponent(forElem string, errors []error) templ.Component
- func HelpTextComponent(forElem, helpText string) templ.Component
- func LabelComponent(forElem, label, labelFor string) templ.Component
- type BaseWidget
- func (b *BaseWidget) FormType() string
- func (b *BaseWidget) GetContextData(id, name string, value interface{}, attrs map[string]string) ctx.Context
- func (b *BaseWidget) Hide(hidden bool)
- func (b *BaseWidget) IdForLabel(id string) string
- func (b *BaseWidget) IsHidden() bool
- func (b *BaseWidget) Media() media.Media
- func (b *BaseWidget) Render(w io.Writer, id, name string, value interface{}, attrs map[string]string) error
- func (b *BaseWidget) RenderWithErrors(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (b *BaseWidget) SetAttrs(attrs map[string]string)
- func (b *BaseWidget) Validate(value interface{}) []error
- func (b *BaseWidget) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
- func (b *BaseWidget) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
- func (b *BaseWidget) ValueToForm(value interface{}) interface{}
- func (b *BaseWidget) ValueToGo(value interface{}) (interface{}, error)
- type BooleanWidget
- type DateWidget
- type DateWidgetType
- type DecimalWidget
- type FileObject
- type FileWidget
- func (f *FileWidget) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
- func (f *FileWidget) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
- func (f *FileWidget) ValueToForm(value interface{}) interface{}
- type FormOption
- type FormValueConverter
- type FormValueGetter
- type FormValueOmitter
- type FormValuer
- type NumberType
- type NumberWidget
- type Option
- type OptionsWidget
- func (o *OptionsWidget) GetContextData(id, name string, value interface{}, attrs map[string]string) ctx.Context
- func (b *OptionsWidget) Render(w io.Writer, id, name string, value interface{}, attrs map[string]string) error
- func (b *OptionsWidget) RenderWithErrors(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (o *OptionsWidget) Validate(value interface{}) []error
- type Widget
- func NewBooleanInput(attrs map[string]string) Widget
- func NewCheckboxInput(attrs map[string]string, choices func() []Option) Widget
- func NewDateInput(attrs map[string]string, t DateWidgetType) Widget
- func NewDecimalInput(attrs map[string]string, decimalPlaces int) Widget
- func NewEmailInput(attrs map[string]string) Widget
- func NewFileInput(attrs map[string]string, ...) Widget
- func NewHiddenInput(attrs map[string]string) Widget
- func NewNumberInput[T NumberType](attrs map[string]string) Widget
- func NewOptionWidget(type_ string, templateName string, attrs map[string]string, ...) Widget
- func NewPasswordInput(attrs map[string]string) Widget
- func NewRadioInput(attrs map[string]string, choices func() []Option) Widget
- func NewSelectInput(attrs map[string]string, choices func() []Option) Widget
- func NewTextInput(attrs map[string]string) Widget
- func NewTextarea(attrs map[string]string) Widget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HelpTextComponent ¶
func LabelComponent ¶
Types ¶
type BaseWidget ¶
type BaseWidget struct { Type string TemplateName string InputIsHidden bool BaseAttrs map[string]string }
func NewBaseWidget ¶
func NewBaseWidget(type_ string, templateName string, attrs map[string]string) *BaseWidget
func (*BaseWidget) FormType ¶ added in v1.6.7
func (b *BaseWidget) FormType() string
func (*BaseWidget) GetContextData ¶
func (*BaseWidget) Hide ¶
func (b *BaseWidget) Hide(hidden bool)
func (*BaseWidget) IdForLabel ¶
func (b *BaseWidget) IdForLabel(id string) string
func (*BaseWidget) IsHidden ¶
func (b *BaseWidget) IsHidden() bool
func (*BaseWidget) Media ¶
func (b *BaseWidget) Media() media.Media
func (*BaseWidget) RenderWithErrors ¶
func (*BaseWidget) SetAttrs ¶
func (b *BaseWidget) SetAttrs(attrs map[string]string)
func (*BaseWidget) Validate ¶ added in v1.6.7
func (b *BaseWidget) Validate(value interface{}) []error
func (*BaseWidget) ValueFromDataDict ¶
func (b *BaseWidget) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*BaseWidget) ValueOmittedFromData ¶
func (b *BaseWidget) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*BaseWidget) ValueToForm ¶
func (b *BaseWidget) ValueToForm(value interface{}) interface{}
func (*BaseWidget) ValueToGo ¶
func (b *BaseWidget) ValueToGo(value interface{}) (interface{}, error)
type BooleanWidget ¶
type BooleanWidget struct {
*BaseWidget
}
func (*BooleanWidget) ValueToForm ¶
func (b *BooleanWidget) ValueToForm(value interface{}) interface{}
func (*BooleanWidget) ValueToGo ¶
func (b *BooleanWidget) ValueToGo(value interface{}) (interface{}, error)
type DateWidget ¶
type DateWidget struct { *BaseWidget DateType DateWidgetType }
func (*DateWidget) ValueToForm ¶
func (d *DateWidget) ValueToForm(value interface{}) interface{}
func (*DateWidget) ValueToGo ¶
func (d *DateWidget) ValueToGo(value interface{}) (interface{}, error)
type DateWidgetType ¶
type DateWidgetType string
const ( DateWidgetTypeDate DateWidgetType = "date" DateWidgetTypeDateTime DateWidgetType = "datetime-local" )
type DecimalWidget ¶ added in v1.6.7
type DecimalWidget struct { *BaseWidget DecimalPlaces int }
func (*DecimalWidget) ValueToForm ¶ added in v1.6.7
func (d *DecimalWidget) ValueToForm(value interface{}) interface{}
func (*DecimalWidget) ValueToGo ¶ added in v1.6.7
func (d *DecimalWidget) ValueToGo(value interface{}) (interface{}, error)
type FileObject ¶ added in v1.6.8
type FileWidget ¶
type FileWidget struct { *BaseWidget Validators []func(filename string, file io.Reader) error }
func (*FileWidget) ValueFromDataDict ¶
func (f *FileWidget) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*FileWidget) ValueOmittedFromData ¶
func (f *FileWidget) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*FileWidget) ValueToForm ¶
func (f *FileWidget) ValueToForm(value interface{}) interface{}
type FormOption ¶
func (*FormOption) Label ¶
func (o *FormOption) Label() string
func (*FormOption) Value ¶
func (o *FormOption) Value() string
type FormValueConverter ¶
type FormValueConverter interface { // Convert the forms' string value to the appropriate GO type. ValueToGo(value interface{}) (interface{}, error) // Convert the GO type to the forms' string value. ValueToForm(value interface{}) interface{} }
type FormValueGetter ¶
type FormValueGetter interface { // Get the value from the provided data. ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error) }
type FormValueOmitter ¶
type FormValueOmitter interface { // Check if the value is omitted from the data provided. ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool }
type FormValuer ¶
type FormValuer interface { FormValueConverter FormValueOmitter FormValueGetter }
type NumberType ¶
type NumberType interface { constraints.Integer | constraints.Float }
type NumberWidget ¶
type NumberWidget[T NumberType] struct { *BaseWidget }
func (*NumberWidget[T]) ValueToForm ¶
func (n *NumberWidget[T]) ValueToForm(value interface{}) interface{}
func (*NumberWidget[T]) ValueToGo ¶
func (n *NumberWidget[T]) ValueToGo(value interface{}) (interface{}, error)
type OptionsWidget ¶
type OptionsWidget struct { *BaseWidget Choices func() []Option IncludeBlank bool BlankLabel string }
func (*OptionsWidget) GetContextData ¶
func (*OptionsWidget) RenderWithErrors ¶
func (*OptionsWidget) Validate ¶ added in v1.6.7
func (o *OptionsWidget) Validate(value interface{}) []error
type Widget ¶
type Widget interface { IsHidden() bool Hide(hidden bool) FormType() string SetAttrs(attrs map[string]string) IdForLabel(id string) string GetContextData(id, name string, value interface{}, attrs map[string]string) ctx.Context RenderWithErrors(w io.Writer, id, name string, value interface{}, errors []error, attrs map[string]string) error Render(w io.Writer, id, name string, value interface{}, attrs map[string]string) error Validate(value interface{}) []error FormValuer media.MediaDefiner }
func NewBooleanInput ¶
func NewCheckboxInput ¶
func NewDateInput ¶
func NewDateInput(attrs map[string]string, t DateWidgetType) Widget
func NewDecimalInput ¶ added in v1.6.7
func NewEmailInput ¶
func NewFileInput ¶
func NewHiddenInput ¶
func NewNumberInput ¶
func NewNumberInput[T NumberType](attrs map[string]string) Widget
func NewOptionWidget ¶
func NewPasswordInput ¶
func NewTextInput ¶
func NewTextarea ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.