Documentation ¶
Overview ¶
templ: version: v0.2.707
Index ¶
- Variables
- func NewAppConfig() *apps.AppConfig
- func RenderBlock(w io.Writer, block Block, value any, context ctx.Context) error
- func RenderBlockForm(w io.Writer, widget *BlockWidget, ctx *BlockContext, errors []error) error
- func RenderBlockWidget(w io.Writer, widget *BlockWidget, blockCtx *BlockContext, errors []error) templ.Component
- type BaseBlock
- func (b *BaseBlock) Adapter() telepath.Adapter
- func (b *BaseBlock) Clean(value interface{}) (interface{}, error)
- func (b *BaseBlock) Field() fields.Field
- func (b *BaseBlock) FormContext(name string, value interface{}, context ctx.Context) *BlockContext
- func (b *BaseBlock) GetDefault() interface{}
- func (b *BaseBlock) HelpText() string
- func (b *BaseBlock) Label() string
- func (b *BaseBlock) Media() media.Media
- func (b *BaseBlock) Name() string
- func (b *BaseBlock) Render(w io.Writer, value interface{}, context ctx.Context) error
- func (b *BaseBlock) RenderForm(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (b *BaseBlock) SetField(field fields.Field)
- func (b *BaseBlock) SetName(name string)
- func (b *BaseBlock) Validate(value interface{}) []error
- func (b *BaseBlock) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
- func (b *BaseBlock) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
- func (b *BaseBlock) ValueToForm(value interface{}) interface{}
- func (b *BaseBlock) ValueToGo(value interface{}) (interface{}, error)
- type BaseBlockValidationError
- func (m *BaseBlockValidationError[T]) AddError(key T, err ...error) *BaseBlockValidationError[T]
- func (m *BaseBlockValidationError[T]) AddNonBlockError(err error)
- func (m *BaseBlockValidationError[T]) Error() string
- func (m *BaseBlockValidationError[T]) Get(key T) []error
- func (m *BaseBlockValidationError[T]) HasErrors() bool
- func (m *BaseBlockValidationError[T]) Len() int
- func (m *BaseBlockValidationError[T]) MarshalJSON() ([]byte, error)
- type Block
- type BlockContext
- type BlockFormField
- type BlockWidget
- func (bw *BlockWidget) Clean(value interface{}) (interface{}, error)
- func (bw *BlockWidget) FormType() string
- func (bw *BlockWidget) GetContextData(id, name string, value interface{}, attrs map[string]string) ctx.Context
- func (bw *BlockWidget) Hide(hidden bool)
- func (bw *BlockWidget) IdForLabel(name string) string
- func (bw *BlockWidget) IsHidden() bool
- func (bw *BlockWidget) Media() media.Media
- func (bw *BlockWidget) Render(w io.Writer, id, name string, value interface{}, attrs map[string]string) error
- func (bw *BlockWidget) RenderWithErrors(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (bw *BlockWidget) SetAttrs(attrs map[string]string)
- func (bw *BlockWidget) Validate(value interface{}) []error
- func (bw *BlockWidget) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
- func (bw *BlockWidget) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
- func (bw *BlockWidget) ValueToForm(value interface{}) interface{}
- func (bw *BlockWidget) ValueToGo(value interface{}) (interface{}, error)
- type FieldBlock
- func CharBlock(opts ...func(*FieldBlock)) *FieldBlock
- func DateBlock(opts ...func(*FieldBlock)) *FieldBlock
- func DateTimeBlock(opts ...func(*FieldBlock)) *FieldBlock
- func EmailBlock(opts ...func(*FieldBlock)) *FieldBlock
- func NewFieldBlock(opts ...func(*FieldBlock)) *FieldBlock
- func NumberBlock(opts ...func(*FieldBlock)) *FieldBlock
- func PasswordBlock(opts ...func(*FieldBlock)) *FieldBlock
- func TextBlock(opts ...func(*FieldBlock)) *FieldBlock
- func (b *FieldBlock) Adapter() telepath.Adapter
- func (b *FieldBlock) RenderForm(w io.Writer, id, name string, value interface{}, errors []error, c ctx.Context) error
- func (b *FieldBlock) RenderHTML() string
- func (b *FieldBlock) RenderTempl(w io.Writer, id, name string, value interface{}, telepath string, ...) templ.Component
- type Length
- type ListBlock
- func (m *ListBlock) Adapter() telepath.Adapter
- func (l *ListBlock) Clean(value interface{}) (interface{}, error)
- func (l *ListBlock) GetDefault() interface{}
- func (l *ListBlock) MaxNum() int
- func (l *ListBlock) MinNum() int
- func (l *ListBlock) RenderForm(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (l *ListBlock) RenderTempl(w io.Writer, id, name string, valueArr []*ListBlockValue, telepath string, ...) templ.Component
- func (l *ListBlock) Validate(value interface{}) []error
- func (l *ListBlock) ValueFromDataDict(d url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
- func (b *ListBlock) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
- func (l *ListBlock) ValueToForm(value interface{}) interface{}
- func (l *ListBlock) ValueToGo(value interface{}) (interface{}, error)
- type ListBlockValue
- type OptFunc
- type StructBlock
- func (m *StructBlock) Adapter() telepath.Adapter
- func (m *StructBlock) AddField(name string, block Block)
- func (m *StructBlock) Clean(value interface{}) (interface{}, error)
- func (m *StructBlock) Field() fields.Field
- func (m *StructBlock) GetDefault() interface{}
- func (m *StructBlock) Name() string
- func (m *StructBlock) RenderForm(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (b *StructBlock) RenderTempl(w io.Writer, id, name string, valueMap map[string]interface{}, telepath string, ...) templ.Component
- func (m *StructBlock) SetName(name string)
- func (m *StructBlock) Validate(value interface{}) []error
- func (m *StructBlock) ValueFromDataDict(d url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
- func (m *StructBlock) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
- func (m *StructBlock) ValueToForm(value interface{}) interface{}
- func (m *StructBlock) ValueToGo(value interface{}) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
AppConfig *apps.AppConfig
)
View Source
var (
JSContext = telepath.NewContext()
)
Functions ¶
func NewAppConfig ¶
func RenderBlockForm ¶
func RenderBlockForm(w io.Writer, widget *BlockWidget, ctx *BlockContext, errors []error) error
func RenderBlockWidget ¶
func RenderBlockWidget(w io.Writer, widget *BlockWidget, blockCtx *BlockContext, errors []error) templ.Component
Types ¶
type BaseBlock ¶
type BaseBlock struct { Name_ string Template string FormField fields.Field Validators []func(interface{}) error Default func() interface{} LabelFunc func() string HelpFunc func() string }
func NewBaseBlock ¶
func (*BaseBlock) FormContext ¶
func (b *BaseBlock) FormContext(name string, value interface{}, context ctx.Context) *BlockContext
func (*BaseBlock) GetDefault ¶
func (b *BaseBlock) GetDefault() interface{}
func (*BaseBlock) RenderForm ¶
func (*BaseBlock) ValueFromDataDict ¶
func (b *BaseBlock) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*BaseBlock) ValueOmittedFromData ¶
func (b *BaseBlock) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*BaseBlock) ValueToForm ¶
func (b *BaseBlock) ValueToForm(value interface{}) interface{}
type BaseBlockValidationError ¶
type BaseBlockValidationError[T comparable] struct { Errors map[T][]error NonBlockErrors []error }
func NewBlockErrors ¶
func NewBlockErrors[T comparable](errors ...error) *BaseBlockValidationError[T]
func (*BaseBlockValidationError[T]) AddError ¶
func (m *BaseBlockValidationError[T]) AddError(key T, err ...error) *BaseBlockValidationError[T]
func (*BaseBlockValidationError[T]) AddNonBlockError ¶
func (m *BaseBlockValidationError[T]) AddNonBlockError(err error)
func (*BaseBlockValidationError[T]) Error ¶
func (m *BaseBlockValidationError[T]) Error() string
func (*BaseBlockValidationError[T]) Get ¶
func (m *BaseBlockValidationError[T]) Get(key T) []error
func (*BaseBlockValidationError[T]) HasErrors ¶
func (m *BaseBlockValidationError[T]) HasErrors() bool
func (*BaseBlockValidationError[T]) Len ¶
func (m *BaseBlockValidationError[T]) Len() int
func (*BaseBlockValidationError[T]) MarshalJSON ¶
func (m *BaseBlockValidationError[T]) MarshalJSON() ([]byte, error)
type Block ¶
type Block interface { Name() string SetName(name string) Label() string HelpText() string Field() fields.Field SetField(field fields.Field) RenderForm(w io.Writer, id, name string, value interface{}, errors []error, context ctx.Context) error Render(w io.Writer, value interface{}, context ctx.Context) error GetDefault() interface{} telepath.AdapterGetter media.MediaDefiner widgets.FormValuer forms.Validator forms.Cleaner }
type BlockContext ¶
type BlockContext struct { Request_ *http.Request BlockDef Block ID string Name string BlockHTML template.HTML Value interface{} Errors []error Attrs map[string]string Context ctx.Context }
func NewBlockContext ¶
func NewBlockContext(b Block, context ctx.Context) *BlockContext
func (*BlockContext) Get ¶
func (bc *BlockContext) Get(name string) interface{}
func (*BlockContext) Request ¶
func (bc *BlockContext) Request() *http.Request
func (*BlockContext) Set ¶
func (bc *BlockContext) Set(name string, value interface{})
type BlockFormField ¶
func BlockField ¶
func BlockField(block Block, opts ...func(fields.Field)) *BlockFormField
func (*BlockFormField) Clean ¶
func (bw *BlockFormField) Clean(value interface{}) (interface{}, error)
func (*BlockFormField) Validate ¶
func (bw *BlockFormField) Validate(value interface{}) []error
func (*BlockFormField) ValueToForm ¶
func (bw *BlockFormField) ValueToForm(value interface{}) interface{}
func (*BlockFormField) ValueToGo ¶
func (bw *BlockFormField) ValueToGo(value interface{}) (interface{}, error)
type BlockWidget ¶
type BlockWidget struct {
BlockDef Block
}
func NewBlockWidget ¶
func NewBlockWidget(blockDef Block) *BlockWidget
func (*BlockWidget) Clean ¶
func (bw *BlockWidget) Clean(value interface{}) (interface{}, error)
func (*BlockWidget) FormType ¶ added in v1.6.7
func (bw *BlockWidget) FormType() string
func (*BlockWidget) GetContextData ¶
func (*BlockWidget) Hide ¶
func (bw *BlockWidget) Hide(hidden bool)
func (*BlockWidget) IdForLabel ¶
func (bw *BlockWidget) IdForLabel(name string) string
func (*BlockWidget) IsHidden ¶
func (bw *BlockWidget) IsHidden() bool
func (*BlockWidget) Media ¶
func (bw *BlockWidget) Media() media.Media
func (*BlockWidget) RenderWithErrors ¶
func (*BlockWidget) SetAttrs ¶
func (bw *BlockWidget) SetAttrs(attrs map[string]string)
func (*BlockWidget) Validate ¶
func (bw *BlockWidget) Validate(value interface{}) []error
func (*BlockWidget) ValueFromDataDict ¶
func (bw *BlockWidget) ValueFromDataDict(data url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*BlockWidget) ValueOmittedFromData ¶
func (bw *BlockWidget) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*BlockWidget) ValueToForm ¶
func (bw *BlockWidget) ValueToForm(value interface{}) interface{}
func (*BlockWidget) ValueToGo ¶
func (bw *BlockWidget) ValueToGo(value interface{}) (interface{}, error)
type FieldBlock ¶
type FieldBlock struct {
*BaseBlock
}
func CharBlock ¶
func CharBlock(opts ...func(*FieldBlock)) *FieldBlock
func DateBlock ¶
func DateBlock(opts ...func(*FieldBlock)) *FieldBlock
func DateTimeBlock ¶
func DateTimeBlock(opts ...func(*FieldBlock)) *FieldBlock
func EmailBlock ¶
func EmailBlock(opts ...func(*FieldBlock)) *FieldBlock
func NewFieldBlock ¶
func NewFieldBlock(opts ...func(*FieldBlock)) *FieldBlock
func NumberBlock ¶
func NumberBlock(opts ...func(*FieldBlock)) *FieldBlock
func PasswordBlock ¶
func PasswordBlock(opts ...func(*FieldBlock)) *FieldBlock
func TextBlock ¶
func TextBlock(opts ...func(*FieldBlock)) *FieldBlock
func (*FieldBlock) Adapter ¶
func (b *FieldBlock) Adapter() telepath.Adapter
func (*FieldBlock) RenderForm ¶
func (*FieldBlock) RenderHTML ¶
func (b *FieldBlock) RenderHTML() string
type ListBlock ¶
func NewListBlock ¶
func (*ListBlock) GetDefault ¶
func (l *ListBlock) GetDefault() interface{}
func (*ListBlock) RenderForm ¶
func (*ListBlock) RenderTempl ¶
func (*ListBlock) ValueFromDataDict ¶
func (l *ListBlock) ValueFromDataDict(d url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*ListBlock) ValueOmittedFromData ¶
func (b *ListBlock) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*ListBlock) ValueToForm ¶
func (l *ListBlock) ValueToForm(value interface{}) interface{}
type ListBlockValue ¶
type StructBlock ¶
type StructBlock struct { *BaseBlock Fields *orderedmap.OrderedMap[string, Block] ToGo func(map[string]interface{}) (interface{}, error) ToForm func(interface{}) (map[string]interface{}, error) }
func NewStructBlock ¶
func NewStructBlock() *StructBlock
func (*StructBlock) Adapter ¶
func (m *StructBlock) Adapter() telepath.Adapter
func (*StructBlock) AddField ¶
func (m *StructBlock) AddField(name string, block Block)
func (*StructBlock) Clean ¶
func (m *StructBlock) Clean(value interface{}) (interface{}, error)
func (*StructBlock) Field ¶
func (m *StructBlock) Field() fields.Field
func (*StructBlock) GetDefault ¶
func (m *StructBlock) GetDefault() interface{}
func (*StructBlock) Name ¶
func (m *StructBlock) Name() string
func (*StructBlock) RenderForm ¶
func (*StructBlock) RenderTempl ¶
func (*StructBlock) SetName ¶
func (m *StructBlock) SetName(name string)
func (*StructBlock) Validate ¶
func (m *StructBlock) Validate(value interface{}) []error
func (*StructBlock) ValueFromDataDict ¶
func (m *StructBlock) ValueFromDataDict(d url.Values, files map[string][]filesystem.FileHeader, name string) (interface{}, []error)
func (*StructBlock) ValueOmittedFromData ¶
func (m *StructBlock) ValueOmittedFromData(data url.Values, files map[string][]filesystem.FileHeader, name string) bool
func (*StructBlock) ValueToForm ¶
func (m *StructBlock) ValueToForm(value interface{}) interface{}
func (*StructBlock) ValueToGo ¶
func (m *StructBlock) ValueToGo(value interface{}) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.