Documentation
¶
Overview ¶
templ: version: v0.3.1020
Index ¶
- Constants
- func ErrorListComponent(forElem string, errors []error, attrs ...templ.Attributes) templ.Component
- func HelpTextComponent(forElem, helpText string, attrs ...templ.Attributes) templ.Component
- func LabelComponent(forElem, label, labelFor string, attrs ...templ.Attributes) templ.Component
- type BaseWidget
- func (b *BaseWidget) BindField(f Field)
- func (b *BaseWidget) Field() Field
- func (b *BaseWidget) FormType() string
- func (b *BaseWidget) GetContextData(c context.Context, 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(ctx context.Context, w io.Writer, id, name string, value interface{}, ...) error
- func (b *BaseWidget) RenderWithErrors(ctx context.Context, w io.Writer, id, name string, value interface{}, ...) error
- func (b *BaseWidget) SetAttrs(attrs map[string]string)
- func (b *BaseWidget) Validate(ctx context.Context, value interface{}) []error
- func (b *BaseWidget) ValueFromDataDict(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, ...) (interface{}, []error)
- func (b *BaseWidget) ValueOmittedFromData(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, ...) 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 Field
- type FileObject
- type FileWidget
- func (f *FileWidget) GetContextData(c context.Context, id, name string, value interface{}, attrs map[string]string) ctx.Context
- func (f *FileWidget) Render(ctx context.Context, w io.Writer, id string, name string, value interface{}, ...) error
- func (f *FileWidget) Validate(ctx context.Context, value interface{}) []error
- func (f *FileWidget) ValueFromDataDict(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, ...) (interface{}, []error)
- func (f *FileWidget) ValueOmittedFromData(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, ...) bool
- func (f *FileWidget) ValueToForm(value interface{}) interface{}
- type FormOption
- type FormValueConverter
- type FormValueGetter
- type FormValueOmitter
- type FormValuer
- type MultiWidget
- func (b *MultiWidget) AddWidget(name string, widget Widget)
- func (b *MultiWidget) GetContextData(widgetCtx context.Context, id string, name string, value interface{}, ...) ctx.Context
- func (b *MultiWidget) Media() media.Media
- func (b *MultiWidget) Render(ctx context.Context, w io.Writer, id, name string, value interface{}, ...) error
- func (b *MultiWidget) RenderWithErrors(c context.Context, w io.Writer, id, name string, value interface{}, ...) error
- func (b *MultiWidget) Validate(ctx context.Context, value interface{}) []error
- func (b *MultiWidget) ValueFromDataDict(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, ...) (interface{}, []error)
- func (b *MultiWidget) ValueOmittedFromData(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, ...) bool
- func (b *MultiWidget) ValueToForm(value interface{}) interface{}
- func (b *MultiWidget) ValueToGo(value interface{}) (interface{}, error)
- type NumberType
- type NumberWidget
- type Option
- type Widget
- func NewBooleanInput(attrs map[string]string) 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, allowedMimeTypes []string, ...) Widget
- func NewHiddenInput(attrs map[string]string) Widget
- func NewNumberInput[T NumberType](attrs map[string]string) Widget
- func NewPasswordInput(attrs map[string]string) Widget
- func NewTextInput(attrs map[string]string) Widget
- func NewTextarea(attrs map[string]string) Widget
- type WrappedOption
Constants ¶
View Source
const ( DateWidgetTypeDate DateWidgetType = "date" DateWidgetTypeDateTime DateWidgetType = "datetime-local" DateWidgetDateFormat = "2006-01-02" DateWidgetDateTimeFormat = "2006-01-02T15:04" DateWidgetDateTimeSecFormat = "2006-01-02T15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func ErrorListComponent ¶
func HelpTextComponent ¶
func HelpTextComponent(forElem, helpText string, attrs ...templ.Attributes) templ.Component
func LabelComponent ¶
func LabelComponent(forElem, label, labelFor string, attrs ...templ.Attributes) templ.Component
Types ¶
type BaseWidget ¶
type BaseWidget struct {
Type string
TemplateName string
InputIsHidden bool
BaseAttrs map[string]string
FormField Field
}
func NewBaseWidget ¶
func NewBaseWidget(type_ string, templateName string, attrs map[string]string) *BaseWidget
func (*BaseWidget) BindField ¶ added in v1.7.2
func (b *BaseWidget) BindField(f Field)
func (*BaseWidget) Field ¶ added in v1.7.2
func (b *BaseWidget) Field() Field
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(ctx context.Context, value interface{}) []error
func (*BaseWidget) ValueFromDataDict ¶
func (b *BaseWidget) ValueFromDataDict(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*BaseWidget) ValueOmittedFromData ¶
func (b *BaseWidget) ValueOmittedFromData(ctx context.Context, 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
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
Extensions []string
Validators []func(filename string, file io.Reader) error
}
func (*FileWidget) GetContextData ¶ added in v1.7.2
func (*FileWidget) Validate ¶ added in v1.7.2
func (f *FileWidget) Validate(ctx context.Context, value interface{}) []error
func (*FileWidget) ValueFromDataDict ¶
func (f *FileWidget) ValueFromDataDict(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*FileWidget) ValueOmittedFromData ¶
func (f *FileWidget) ValueOmittedFromData(ctx context.Context, 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 = forms.FormValueConverter
type FormValueGetter ¶
type FormValueGetter = forms.FormValueGetter
type FormValueOmitter ¶
type FormValueOmitter = forms.FormValueOmitter
type FormValuer ¶
type FormValuer = forms.FormValuer
type MultiWidget ¶ added in v1.7.2
type MultiWidget struct {
BaseWidget
Widgets *orderedmap.OrderedMap[string, Widget]
}
func NewMultiWidget ¶ added in v1.7.2
func NewMultiWidget(attrs map[string]string) *MultiWidget
func (*MultiWidget) AddWidget ¶ added in v1.7.2
func (b *MultiWidget) AddWidget(name string, widget Widget)
func (*MultiWidget) GetContextData ¶ added in v1.7.2
func (*MultiWidget) Media ¶ added in v1.7.2
func (b *MultiWidget) Media() media.Media
func (*MultiWidget) RenderWithErrors ¶ added in v1.7.2
func (*MultiWidget) Validate ¶ added in v1.7.2
func (b *MultiWidget) Validate(ctx context.Context, value interface{}) []error
func (*MultiWidget) ValueFromDataDict ¶ added in v1.7.2
func (b *MultiWidget) ValueFromDataDict(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*MultiWidget) ValueOmittedFromData ¶ added in v1.7.2
func (b *MultiWidget) ValueOmittedFromData(ctx context.Context, data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*MultiWidget) ValueToForm ¶ added in v1.7.2
func (b *MultiWidget) ValueToForm(value interface{}) interface{}
func (*MultiWidget) ValueToGo ¶ added in v1.7.2
func (b *MultiWidget) ValueToGo(value interface{}) (interface{}, error)
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 Widget ¶
func NewBooleanInput ¶
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 NewPasswordInput ¶
func NewTextInput ¶
func NewTextarea ¶
type WrappedOption ¶ added in v1.6.9
func WrapOptions ¶ added in v1.6.9
func WrapOptions(options []Option, selectedValues []string) []WrappedOption
func (*WrappedOption) Label ¶ added in v1.6.9
func (w *WrappedOption) Label() string
func (*WrappedOption) Value ¶ added in v1.6.9
func (w *WrappedOption) Value() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.