Documentation ¶
Index ¶
- Variables
- func AddMultiStepHandler(router echo.Router, handler echo.HandlerFunc)
- func Coalesce(ctx echo.Context, ws ...echo.Widget) (interface{}, error)
- func ConvertToHtml(v interface{}) (string, error)
- func FormatMessage(ctx echo.Context, layout interface{}, args ...interface{}) (string, error)
- func RenderDataSet(ctx echo.Context, dataset echo.DataSet, selected map[string]bool) ([]interface{}, error)
- func RenderLink(ctx echo.Context, v interface{}) (string, error)
- func RenderList(ctx echo.Context, list List) ([]interface{}, error)
- func RenderMap(ctx echo.Context, widgets Map) (map[string]interface{}, error)
- func RenderParams(ctx echo.Context, params []interface{}) ([]interface{}, error)
- func RenderValidationErrors(ctx echo.Context, errors echo.ValidationErrors) ([]string, error)
- type Action
- type ActionType
- type Alert
- type AlertType
- type BOOLEAN
- type Band
- type Breadcrumb
- type Breadcrumbs
- type DATETIME
- type DURATION
- type DataFunc
- type Detail
- type DetailView
- type Details
- type Document
- type ExpanderFunc
- type FLOAT32
- type FLOAT64
- type Form
- type FormFieldFilterFunc
- type FormFile
- func (field *FormFile) AddError(message echo.ValidationError)
- func (field *FormFile) GetBoolean() bool
- func (w *FormFile) GetDisabled() bool
- func (field *FormFile) GetErrors() echo.ValidationErrors
- func (field *FormFile) GetFloat32() float32
- func (field *FormFile) GetFloat64() float64
- func (w *FormFile) GetHidden() bool
- func (field *FormFile) GetInt() int
- func (field *FormFile) GetInt16() int16
- func (field *FormFile) GetInt32() int32
- func (field *FormFile) GetInt64() int64
- func (field *FormFile) GetInt8() int8
- func (w *FormFile) GetName() string
- func (field *FormFile) GetString() string
- func (field *FormFile) GetUint() uint
- func (field *FormFile) GetUint16() uint16
- func (field *FormFile) GetUint32() uint32
- func (field *FormFile) GetUint64() uint64
- func (field *FormFile) GetUint8() uint8
- func (field *FormFile) GetVal() interface{}
- func (field *FormFile) GetValue() []string
- func (field *FormFile) IsValid() bool
- func (w *FormFile) Render(ctx echo.Context) (interface{}, error)
- func (w *FormFile) Reset(ctx echo.Context) error
- func (field *FormFile) SetVal(ctx echo.Context, value interface{})
- func (field *FormFile) SetValue(ctx echo.Context, value []string) error
- func (w *FormFile) Upload(ctx echo.Context, path string, name string) (fileName string, err error)
- func (w *FormFile) Validate(ctx echo.Context) error
- type FormFlag
- func (field *FormFlag) AddError(message echo.ValidationError)
- func (field *FormFlag) GetBoolean() bool
- func (w *FormFlag) GetDisabled() bool
- func (field *FormFlag) GetErrors() echo.ValidationErrors
- func (field *FormFlag) GetFloat32() float32
- func (field *FormFlag) GetFloat64() float64
- func (w *FormFlag) GetHidden() bool
- func (field *FormFlag) GetInt() int
- func (field *FormFlag) GetInt16() int16
- func (field *FormFlag) GetInt32() int32
- func (field *FormFlag) GetInt64() int64
- func (field *FormFlag) GetInt8() int8
- func (w *FormFlag) GetName() string
- func (field *FormFlag) GetString() string
- func (field *FormFlag) GetUint() uint
- func (field *FormFlag) GetUint16() uint16
- func (field *FormFlag) GetUint32() uint32
- func (field *FormFlag) GetUint64() uint64
- func (field *FormFlag) GetUint8() uint8
- func (field *FormFlag) GetVal() interface{}
- func (field *FormFlag) GetValue() []string
- func (field *FormFlag) IsValid() bool
- func (w *FormFlag) Render(ctx echo.Context) (interface{}, error)
- func (w *FormFlag) Reset(ctx echo.Context) error
- func (w *FormFlag) SetVal(ctx echo.Context, value interface{})
- func (w *FormFlag) SetValue(ctx echo.Context, value []string) error
- func (field *FormFlag) Validate(ctx echo.Context) error
- type FormFlags
- func (field *FormFlags) AddError(message echo.ValidationError)
- func (field *FormFlags) GetBoolean() bool
- func (w *FormFlags) GetDisabled() bool
- func (field *FormFlags) GetErrors() echo.ValidationErrors
- func (field *FormFlags) GetFloat32() float32
- func (field *FormFlags) GetFloat64() float64
- func (w *FormFlags) GetHidden() bool
- func (field *FormFlags) GetInt() int
- func (field *FormFlags) GetInt16() int16
- func (field *FormFlags) GetInt32() int32
- func (field *FormFlags) GetInt64() int64
- func (field *FormFlags) GetInt8() int8
- func (w *FormFlags) GetName() string
- func (field *FormFlags) GetString() string
- func (field *FormFlags) GetUint() uint
- func (field *FormFlags) GetUint16() uint16
- func (field *FormFlags) GetUint32() uint32
- func (field *FormFlags) GetUint64() uint64
- func (field *FormFlags) GetUint8() uint8
- func (field *FormFlags) GetVal() interface{}
- func (field *FormFlags) GetValue() []string
- func (field *FormFlags) IsValid() bool
- func (w *FormFlags) Render(ctx echo.Context) (interface{}, error)
- func (w *FormFlags) Reset(ctx echo.Context) error
- func (w *FormFlags) SetVal(ctx echo.Context, value interface{})
- func (w *FormFlags) SetValue(ctx echo.Context, value []string) error
- func (field *FormFlags) Validate(ctx echo.Context) error
- type FormHidden
- func (field *FormHidden) AddError(message echo.ValidationError)
- func (field *FormHidden) GetBoolean() bool
- func (w *FormHidden) GetDisabled() bool
- func (field *FormHidden) GetErrors() echo.ValidationErrors
- func (field *FormHidden) GetFloat32() float32
- func (field *FormHidden) GetFloat64() float64
- func (w *FormHidden) GetHidden() bool
- func (field *FormHidden) GetInt() int
- func (field *FormHidden) GetInt16() int16
- func (field *FormHidden) GetInt32() int32
- func (field *FormHidden) GetInt64() int64
- func (field *FormHidden) GetInt8() int8
- func (w *FormHidden) GetName() string
- func (field *FormHidden) GetString() string
- func (field *FormHidden) GetUint() uint
- func (field *FormHidden) GetUint16() uint16
- func (field *FormHidden) GetUint32() uint32
- func (field *FormHidden) GetUint64() uint64
- func (field *FormHidden) GetUint8() uint8
- func (field *FormHidden) GetVal() interface{}
- func (field *FormHidden) GetValue() []string
- func (field *FormHidden) IsValid() bool
- func (w *FormHidden) Render(ctx echo.Context) (interface{}, error)
- func (w *FormHidden) Reset(ctx echo.Context) error
- func (field *FormHidden) SetVal(ctx echo.Context, value interface{})
- func (field *FormHidden) SetValue(ctx echo.Context, value []string) error
- func (w *FormHidden) Validate(ctx echo.Context) error
- type FormSelect
- func (field *FormSelect) AddError(message echo.ValidationError)
- func (field *FormSelect) GetBoolean() bool
- func (w *FormSelect) GetDisabled() bool
- func (field *FormSelect) GetErrors() echo.ValidationErrors
- func (field *FormSelect) GetFloat32() float32
- func (field *FormSelect) GetFloat64() float64
- func (w *FormSelect) GetHidden() bool
- func (field *FormSelect) GetInt() int
- func (field *FormSelect) GetInt16() int16
- func (field *FormSelect) GetInt32() int32
- func (field *FormSelect) GetInt64() int64
- func (field *FormSelect) GetInt8() int8
- func (w *FormSelect) GetName() string
- func (field *FormSelect) GetString() string
- func (field *FormSelect) GetUint() uint
- func (field *FormSelect) GetUint16() uint16
- func (field *FormSelect) GetUint32() uint32
- func (field *FormSelect) GetUint64() uint64
- func (field *FormSelect) GetUint8() uint8
- func (field *FormSelect) GetVal() interface{}
- func (field *FormSelect) GetValue() []string
- func (field *FormSelect) IsValid() bool
- func (w *FormSelect) Render(ctx echo.Context) (interface{}, error)
- func (w *FormSelect) Reset(ctx echo.Context) error
- func (field *FormSelect) SetVal(ctx echo.Context, value interface{})
- func (w *FormSelect) SetValue(ctx echo.Context, value []string) error
- func (w *FormSelect) Validate(ctx echo.Context) error
- type FormSubmit
- func (field *FormSubmit) AddError(message echo.ValidationError)
- func (field *FormSubmit) GetBoolean() bool
- func (w *FormSubmit) GetDisabled() bool
- func (field *FormSubmit) GetErrors() echo.ValidationErrors
- func (field *FormSubmit) GetFloat32() float32
- func (field *FormSubmit) GetFloat64() float64
- func (w *FormSubmit) GetHidden() bool
- func (field *FormSubmit) GetInt() int
- func (field *FormSubmit) GetInt16() int16
- func (field *FormSubmit) GetInt32() int32
- func (field *FormSubmit) GetInt64() int64
- func (field *FormSubmit) GetInt8() int8
- func (w *FormSubmit) GetName() string
- func (field *FormSubmit) GetString() string
- func (field *FormSubmit) GetUint() uint
- func (field *FormSubmit) GetUint16() uint16
- func (field *FormSubmit) GetUint32() uint32
- func (field *FormSubmit) GetUint64() uint64
- func (field *FormSubmit) GetUint8() uint8
- func (field *FormSubmit) GetVal() interface{}
- func (field *FormSubmit) GetValue() []string
- func (field *FormSubmit) IsValid() bool
- func (w *FormSubmit) Render(ctx echo.Context) (interface{}, error)
- func (w *FormSubmit) Reset(ctx echo.Context) error
- func (field *FormSubmit) SetVal(ctx echo.Context, value interface{})
- func (w *FormSubmit) SetValue(ctx echo.Context, value []string) error
- func (w *FormSubmit) Validate(ctx echo.Context) error
- type FormText
- func (field *FormText) AddError(message echo.ValidationError)
- func (field *FormText) GetBoolean() bool
- func (w *FormText) GetDisabled() bool
- func (field *FormText) GetErrors() echo.ValidationErrors
- func (field *FormText) GetFloat32() float32
- func (field *FormText) GetFloat64() float64
- func (w *FormText) GetHidden() bool
- func (field *FormText) GetInt() int
- func (field *FormText) GetInt16() int16
- func (field *FormText) GetInt32() int32
- func (field *FormText) GetInt64() int64
- func (field *FormText) GetInt8() int8
- func (w *FormText) GetName() string
- func (field *FormText) GetString() string
- func (field *FormText) GetUint() uint
- func (field *FormText) GetUint16() uint16
- func (field *FormText) GetUint32() uint32
- func (field *FormText) GetUint64() uint64
- func (field *FormText) GetUint8() uint8
- func (field *FormText) GetVal() interface{}
- func (field *FormText) GetValue() []string
- func (field *FormText) IsValid() bool
- func (w *FormText) Render(ctx echo.Context) (interface{}, error)
- func (w *FormText) Reset(ctx echo.Context) error
- func (w *FormText) SetVal(ctx echo.Context, value interface{})
- func (w *FormText) SetValue(ctx echo.Context, value []string) error
- func (w *FormText) Validate(ctx echo.Context) error
- type GuidMaker
- type HTML
- type INT
- type INT16
- type INT32
- type INT64
- type INT8
- type List
- type MESSAGE
- type Map
- type MultiForm
- type MultiStepBaseStage
- func (stage *MultiStepBaseStage) Consume(ctx echo.Context, state *MultiStepState, model echo.Model) (reply interface{}, err error)
- func (stage *MultiStepBaseStage) Publish(ctx echo.Context, state *MultiStepState, form *MultiStepForm) error
- func (stage *MultiStepBaseStage) Resolve(ctx echo.Context, state *MultiStepState, model echo.Model) error
- type MultiStepForm
- type MultiStepStage
- type MultiStepState
- type MultiStepStrategy
- type NavBar
- type NavBarDropDown
- type NavBarForm
- type NavBarItem
- type NavBarLink
- type NavBarText
- type Optional
- type Pager
- type PagerInfo
- type PagerReport
- type RESOURCE
- type Sprintf
- type TEXT
- type TIMESTAMP
- type Table
- type TableAction
- type TableActions
- type TableColumn
- type TableColumns
- type UINT
- type UINT16
- type UINT32
- type UINT64
- type UINT8
- type Variant
- type WidgetFunc
Constants ¶
This section is empty.
Variables ¶
var ( BoolFormatter echo.Formatter // Must be defined in application level StringFormatter = &echo.BaseFormatter{Decoder: echo.StringCodec} IntFormatter = &echo.BaseFormatter{Decoder: echo.IntCodec} Int8Formatter = &echo.BaseFormatter{Decoder: echo.Int8Codec} Int16Formatter = &echo.BaseFormatter{Decoder: echo.Int16Codec} Int32Formatter = &echo.BaseFormatter{Decoder: echo.Int32Codec} Int64Formatter = &echo.BaseFormatter{Decoder: echo.Int64Codec} UintFormatter = &echo.BaseFormatter{Decoder: echo.UintCodec} Uint8Formatter = &echo.BaseFormatter{Decoder: echo.Uint8Codec} Uint16Formatter = &echo.BaseFormatter{Decoder: echo.Uint16Codec} Uint32Formatter = &echo.BaseFormatter{Decoder: echo.Uint32Codec} Uint64Formatter = &echo.BaseFormatter{Decoder: echo.Uint64Codec} Float32Formatter = &echo.BaseFormatter{Decoder: echo.Float32Codec} Float64Formatter = &echo.BaseFormatter{Decoder: echo.Float64Codec} DefaultFormatter = StringFormatter )
Formatters for standard types
var ( MessagePagerPrev = DeclareDefaultMsg(1000, "Prev") MessagePagerNext = DeclareDefaultMsg(1001, "Next") MessageListRecords = DeclareDefaultMsg(1002, "Shows rows from %d to %d of %d") MessageListNoRecords = DeclareDefaultMsg(1003, "No data for display") MessageDetailsColumnKey = DeclareDefaultMsg(1004, "Key") MessageDetailsColumnVal = DeclareDefaultMsg(1005, "Value") MessageTableTooltipActionView = DeclareDefaultMsg(1006, "View") MessageTableTooltipActionUpdate = DeclareDefaultMsg(1007, "Update") MessageTableTooltipActionDelete = DeclareDefaultMsg(1008, "Delete this row") MessageTableConfirmActionDelete = DeclareDefaultMsg(1009, "Are you sure delete row?") MessageConstraintInvalid = DeclareDefaultMsg(1010, "Invalid value") MessageConstraintRequired = DeclareDefaultMsg(1011, "Required value") MessageConstraintPattern = DeclareDefaultMsg(1012, "Value don't match pattern") MessageConstraintMaxLength = DeclareDefaultMsg(1013, "Value too long") MessageSelectorEmpty = DeclareDefaultMsg(1014, "(Empty)") MessageMultistepFormPrev = DeclareDefaultMsg(1015, "Prev") MessageMultistepFormNext = DeclareDefaultMsg(1016, "Next") )
var ( DefaultDocumentParamRe = regexp.MustCompile(`(?i:{{\s*([\w\d.\-]+)\s*}})`) DefaultDocumentReferenceRe = regexp.MustCompile(`\[([^]]+)]\(([a-z0-9]+)\)`) )
var DefaultTableActionDelete = &TableAction{}
var DefaultTableActionUpdate = &TableAction{}
var DefaultTableActionView = &TableAction{}
var MultiStepNextBtn = &Action{ Label: MessageMultistepFormNext, }
Default definition of NEXT button for multistep form.
var MultiStepPrevBtn = &Action{ Label: MessageMultistepFormPrev, }
Default definition of PREV button for multistep form.
var (
TimeInfinity int64 = 0x7fffffffffffffff
)
Functions ¶
func AddMultiStepHandler ¶
func AddMultiStepHandler( router echo.Router, handler echo.HandlerFunc, )
Attach handler to MUX
func FormatMessage ¶
Simple message formatter with fmt.Sprintf util.
func RenderDataSet ¶
func RenderDataSet( ctx echo.Context, dataset echo.DataSet, selected map[string]bool, ) ([]interface{}, error)
Render data set
func RenderLink ¶
Render link without escape.
func RenderList ¶
Render list of values.
func RenderParams ¶
Translate striped parameters into plain representation.
func RenderValidationErrors ¶
Render all validation errors
Types ¶
type Action ¶
type Action struct { Label interface{} // Visible label Action interface{} // Action (url or url.URL or *url.URL) Confirm interface{} // Confirmation text Tooltip interface{} // Widget tooltip Type ActionType // Type of action (default Submit) Post bool // Use post request Hidden bool // Action is hidden and can't be render Disabled bool // Action is disabled Name string // Name of action Value interface{} // Value of action }
Widget for display button or hyperlink. Example:
apply := &widget.Action{ Label: "Apply", Action: "/user/update", Post: true, Hidden: !isOwner, Type: widget.ActionTypeButton, Value: "apply", } submit := &widget.Action{ Label: "Apply", Type: widget.ActionTypeSubmit, Value: "apply", }
type ActionType ¶
type ActionType string
const ( ActionTypeButton ActionType = "button" ActionTypeSubmit ActionType = "submit" ActionTypeReset ActionType = "reset" )
type Alert ¶
type Alert struct { Hidden bool // Message is hidden and can't be render Type AlertType // Type of message (default Info) Label interface{} // Content of message }
Widget for display highlighted message. May be used for display Flash messages. Example:
alert := &widget.Alert{ Label: "It`s OK" Type: widget.AlertSuccess, }
type Band ¶
type Band struct { Pager // Pager info Data DataFunc // Custom data Hidden bool // Band is hidden and not can't be render }
Widget for display band of items. Widget supports pager for navigate between pages.
type Breadcrumb ¶
type Breadcrumb struct { Label interface{} // Label for action Action interface{} // Action (optional). May be (string or url.Url or *url.Url) }
Single breadcrumb
type Detail ¶
type DetailView ¶
type DetailView struct { Hidden bool // Details is hidden and not can't be render Items Details // Rows KeyColumn interface{} // Label for key column ValColumn interface{} // Label for value column }
Widget for display list of key/value pairs. The widget generates the following structure: * Head ** Key - label for Key column ** Value - label for Value column * Body - contains sequence of details
type Document ¶
type Document struct { Layout interface{} // Layout Params generic.Params // Message arguments References map[string]interface{} // Map of hyperlinks name->action ParamRe *regexp.Regexp // RegEx pattern for replace params (default {{name@param}}) ReferenceRe *regexp.Regexp // RegEx pattern for replace reference (default [label](name)) }
Document is widget for format with complex named params and references.
type ExpanderFunc ¶
type Form ¶
type Form struct { Id string // Form identifier Name string // Form name Method string // Form method (default POST) Action interface{} // Form action (default current URL) Model echo.Model // Primary form model Hidden bool // Form is hidden and can't be render }
Form is widget, that based on a Model and produced html form.
type FormFieldFilterFunc ¶
type FormFile ¶
type FormFile struct { Id string // Field identifier Name string // Field name Label interface{} // Field label Disabled bool // Field disabled Hidden bool // Field is hidden and can't be render Accept string // Accept filter Required bool // Field is required // contains filtered or unexported fields }
FormFile represent html entity <input type="file">.
func (*FormFile) AddError ¶
func (field *FormFile) AddError(message echo.ValidationError)
Append a new error
func (*FormFile) GetBoolean ¶
func (field *FormFile) GetBoolean() bool
func (*FormFile) GetDisabled ¶
func (*FormFile) GetErrors ¶
func (field *FormFile) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormFile) GetFloat32 ¶
func (field *FormFile) GetFloat32() float32
func (*FormFile) GetFloat64 ¶
func (field *FormFile) GetFloat64() float64
type FormFlag ¶
type FormFlag struct { Id string // Field identifier Name string // Field name Label interface{} // Field label Disabled bool // Field disabled Hidden bool // Field is hidden and can't be render Default interface{} // Default value (optional) Placeholder interface{} // Placeholder text (optional) Filter FormFieldFilterFunc // Custom filter (optional) // contains filtered or unexported fields }
FormFlag represents single html entity <input tpe="ckeckbox> Example:
subscribe := widget.FormFlag{ Name: "Subscribe", Items: ...., }
func (*FormFlag) AddError ¶
func (field *FormFlag) AddError(message echo.ValidationError)
Append a new error
func (*FormFlag) GetBoolean ¶
func (field *FormFlag) GetBoolean() bool
func (*FormFlag) GetDisabled ¶
func (*FormFlag) GetErrors ¶
func (field *FormFlag) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormFlag) GetFloat32 ¶
func (field *FormFlag) GetFloat32() float32
func (*FormFlag) GetFloat64 ¶
func (field *FormFlag) GetFloat64() float64
type FormFlags ¶
type FormFlags struct { Id string // Field identifier Name string // Field name Label interface{} // Field label Disabled bool // Field disabled Hidden bool // Field is hidden and can't be render Filter FormFieldFilterFunc // Custom filter (optional) Default interface{} // Default value (optional) Items echo.DataSet // List labels for allowed values Placeholder interface{} // Placeholder text (optional) // contains filtered or unexported fields }
FormFlags represent html entity <input type="checkbox">. Example:
subscribe := &widget.FormFlags{ Name: "Subscribe", Items: ..., }
func (*FormFlags) AddError ¶
func (field *FormFlags) AddError(message echo.ValidationError)
Append a new error
func (*FormFlags) GetBoolean ¶
func (field *FormFlags) GetBoolean() bool
func (*FormFlags) GetDisabled ¶
func (*FormFlags) GetErrors ¶
func (field *FormFlags) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormFlags) GetFloat32 ¶
func (field *FormFlags) GetFloat32() float32
func (*FormFlags) GetFloat64 ¶
func (field *FormFlags) GetFloat64() float64
type FormHidden ¶
type FormHidden struct { Id string // Field identifier Name string // Field name Hidden bool // Field is hidden and can't be render Default interface{} // Default value (optional) Required bool // Field is required Pattern string // Field pattern MaxLength int // Field max length // contains filtered or unexported fields }
FormHidden represent html entity <input type="hidden">.
func (*FormHidden) AddError ¶
func (field *FormHidden) AddError(message echo.ValidationError)
Append a new error
func (*FormHidden) GetBoolean ¶
func (field *FormHidden) GetBoolean() bool
func (*FormHidden) GetDisabled ¶
func (w *FormHidden) GetDisabled() bool
func (*FormHidden) GetErrors ¶
func (field *FormHidden) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormHidden) GetFloat32 ¶
func (field *FormHidden) GetFloat32() float32
func (*FormHidden) GetFloat64 ¶
func (field *FormHidden) GetFloat64() float64
func (*FormHidden) GetHidden ¶
func (w *FormHidden) GetHidden() bool
func (*FormHidden) GetName ¶
func (w *FormHidden) GetName() string
type FormSelect ¶
type FormSelect struct { Id string // Field identifier Name string // Field name Label interface{} // Field label Disabled bool // Field disabled Hidden bool // Field is hidden and can't be render Filter FormFieldFilterFunc // Custom filter (optional) Default interface{} // Default value (optional) Required bool // Value is required Items echo.DataSet // Field items // contains filtered or unexported fields }
FormSelect represent html entity <select> or other same widget. Notice: Field Codec must be ignored (internal and external representations are same).
func (*FormSelect) AddError ¶
func (field *FormSelect) AddError(message echo.ValidationError)
Append a new error
func (*FormSelect) GetBoolean ¶
func (field *FormSelect) GetBoolean() bool
func (*FormSelect) GetDisabled ¶
func (w *FormSelect) GetDisabled() bool
func (*FormSelect) GetErrors ¶
func (field *FormSelect) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormSelect) GetFloat32 ¶
func (field *FormSelect) GetFloat32() float32
func (*FormSelect) GetFloat64 ¶
func (field *FormSelect) GetFloat64() float64
func (*FormSelect) GetHidden ¶
func (w *FormSelect) GetHidden() bool
func (*FormSelect) GetName ¶
func (w *FormSelect) GetName() string
type FormSubmit ¶
type FormSubmit struct { Id string // Field identifier Name string // Field name Label interface{} // Field label Disabled bool // Field disabled Hidden bool // Field is hidden and can't be render Filter FormFieldFilterFunc // Custom filter (optional) Default interface{} // Default value (optional) Required bool // Value is required Items echo.DataSet // Field items // contains filtered or unexported fields }
FormSubmit represents action Submit
func (*FormSubmit) AddError ¶
func (field *FormSubmit) AddError(message echo.ValidationError)
Append a new error
func (*FormSubmit) GetBoolean ¶
func (field *FormSubmit) GetBoolean() bool
func (*FormSubmit) GetDisabled ¶
func (w *FormSubmit) GetDisabled() bool
func (*FormSubmit) GetErrors ¶
func (field *FormSubmit) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormSubmit) GetFloat32 ¶
func (field *FormSubmit) GetFloat32() float32
func (*FormSubmit) GetFloat64 ¶
func (field *FormSubmit) GetFloat64() float64
func (*FormSubmit) GetHidden ¶
func (w *FormSubmit) GetHidden() bool
func (*FormSubmit) GetName ¶
func (w *FormSubmit) GetName() string
type FormText ¶
type FormText struct { Id string // Field identifier Name string // Field name Label interface{} // Field label Disabled bool // Field disabled Hidden bool // Field is hidden and can't be render Filter FormFieldFilterFunc // Custom filter (optional) Codec echo.Codec // Field codec (optional) Default interface{} // Default value (optional) Required bool // Field is required Pattern string // Field pattern (optional) Placeholder interface{} // Field placeholder (optional) MaxLength int // Field max length ReadOnly bool // Field is read only Rows int // Max count of visible rows // contains filtered or unexported fields }
FormText represent html entity <textarea> or <input type="text"> or <input type="password">.
func (*FormText) AddError ¶
func (field *FormText) AddError(message echo.ValidationError)
Append a new error
func (*FormText) GetBoolean ¶
func (field *FormText) GetBoolean() bool
func (*FormText) GetDisabled ¶
func (*FormText) GetErrors ¶
func (field *FormText) GetErrors() echo.ValidationErrors
Get list of field errors
func (*FormText) GetFloat32 ¶
func (field *FormText) GetFloat32() float32
func (*FormText) GetFloat64 ¶
func (field *FormText) GetFloat64() float64
type List ¶
type List []interface{}
List of widgets, that renders each widget. The list allows index access to the item.
type Map ¶
type Map map[string]interface{}
Map of widgets, that renders each widget. The map allows named access to the item.
type MultiForm ¶
type MultiForm struct { Id string // Form identifier Name string // Form name Method string // Form method (default POST) Action interface{} // Form action (default current url) Models echo.Models // Primary form model Hidden bool // Form is hidden and can't be render }
MultiForm is form, that contains list of models.
type MultiStepBaseStage ¶
Prototype for all MultiStepStages
func (*MultiStepBaseStage) Consume ¶
func (stage *MultiStepBaseStage) Consume( ctx echo.Context, state *MultiStepState, model echo.Model, ) (reply interface{}, err error)
func (*MultiStepBaseStage) Publish ¶
func (stage *MultiStepBaseStage) Publish( ctx echo.Context, state *MultiStepState, form *MultiStepForm, ) error
func (*MultiStepBaseStage) Resolve ¶
func (stage *MultiStepBaseStage) Resolve( ctx echo.Context, state *MultiStepState, model echo.Model, ) error
type MultiStepForm ¶
type MultiStepForm struct { Form Security GuidMaker // Optional Storage echo.Storage // Optional Strategy MultiStepStrategy Timeout time.Duration }
Multi step form (with standard buttons) Example:
func actionXXX(ctx echo.Context) error{ form := &widget.MultiStepForm{ Strategy: MyStrategy, Security: security, Timeout: 100, ... } return form.Execute(env) }
Define stages for the form (must implements MultiStepStage)
type MyStage struct { widgets.MultiStepBaseStage }
Initialize router
func Init(){ InitMultiStepRouter(router, actionXXX) }
func (*MultiStepForm) Execute ¶
func (w *MultiStepForm) Execute( ctx echo.Context, ) (state *MultiStepState, err error)
type MultiStepStage ¶
type MultiStepStage interface { // Get model of stage Model(ctx echo.Context, state *MultiStepState) (echo.Model, error) // Import data into the model and validate it. Resolve(ctx echo.Context, state *MultiStepState, model echo.Model) error // Consume stage data. Return new state reference or nil (see method MultiStepState.Become) Consume(ctx echo.Context, state *MultiStepState, model echo.Model) (reply interface{}, err error) // Publish form Publish(ctx echo.Context, state *MultiStepState, form *MultiStepForm) error }
Abstract stage of form
type MultiStepState ¶
type MultiStepState struct { Stage string `json:"stage"` // Stage name History []string `json:"history"` // List of stage names Params generic.Params `json:"values"` // Map of accepted parameters Expiration int64 `json:"expiration"` // Expiration (UNIX timestamp) }
MultiStepState is persistent state of form/
func (*MultiStepState) Become ¶
func (s *MultiStepState) Become( newState interface{}, ) error
Become to the new state newState is variant:
- string - name of new state
- numeric - relative offset for reduce
type MultiStepStrategy ¶
type NavBar ¶
type NavBar struct {}
Widget for display primary navigation bar. Example:
menu := &widget.NavBar{ Brand: "My brand", Items: widget.Map{ "Home": &widget.NavBarItem{ Label: "Home", Action: "/", }, "Auth": &widget.NavBarItem{ Label: "Login", Action: "/login", }, "Language": &widget.NavBarDropDown{ Label: &widget.Sprintf{ Layout: "Language (%s)", Params: []interface{}{curLang}, }, Items: widget.List{ &widget.NavBarItem{ Label: "English", Action: "/lang/english", }, &widget.NavBarItem{ Label: "Russian", Action: "/lang/russian", }, }, }, }, }
type NavBarDropDown ¶
type NavBarDropDown struct {}
Drop down submenu of navigation bar. Must be nested for NavBarNav
type NavBarForm ¶
type NavBarForm struct {
}Inline form, nested in navigation bar Must be nested for NavBarNav (not navbar link)
type NavBarItem ¶
type NavBarItem struct {}
Simple menu item of navigation bar. Must be nested for NavBarNav or NavBarDropDown.
type NavBarLink ¶
type NavBarLink struct {}
Hyperlink, nested in navigation bar. Must be nested for NavBarText (not in navbar link)
type NavBarText ¶
type NavBarText struct {}
Simple text, nested in navigatin bar. Must be nested for NavBarNav (not navbar link)
type Optional ¶
type Optional struct { Hidden bool // Content is hidden and can't be render Value interface{} // Internal content }
Optional content. Widget allows wrap optional content for disable it rendering.
type Pager ¶
type Pager struct { Id string // Pager identifier (optional) MsgEmpty echo.Widget // Message for empty record set (optional) MsgStats echo.Widget // Message for statistics )optional) Label echo.Widget // Pager label (optional) Prev echo.Widget // Previous page label (optional) Next echo.Widget // Next page label (optional) Param string // Hot parameter of URI for get page number (default "pg") Capacity int // Items count per page (default 10). Without data provider it is row count BtnCount int // Links count in pager (default 10) Url *url.URL // Base url (default used current request url) Provider data.Provider // Data provider }
Widget for make data pagination. It used for composition in complex widgets (band and table). This is widget get page number from URI. After that, it requests the required data from the provider in the required amount.
type PagerInfo ¶
type PagerInfo struct { CurPage int // Current page number (the numbering starts from 1) LastPage int // Last page number (the numbering starts from 1) FirstVisible int // First visible record number (the numbering starts from 1) LastVisible int // Last visible record number (the numbering starts from 1) Total int // Total records count Count int // Visible records count }
Pager statistics
type PagerReport ¶
type PagerReport struct { Id string // Pager identifier Info PagerInfo // Pager statistics Buttons map[string]interface{} // Buttons (prev, next, band) Message interface{} // Actual message }
Report of applying pager
type Sprintf ¶
type Sprintf struct { Layout interface{} // Layout Params []interface{} // Message parameters }
Sprintf is widget for format layout (using fmt.Sprintf)
type Table ¶
type Table struct { Pager Columns TableColumns // Columns declaration RowExpander ExpanderFunc // Row expander }
Widget for display simple html table. Example:
provider := &myDataProvider{ ... } table := &widget.Table{ Pager: widget.Pager{ Provider: provider, }, Columns: widget.TableColumns{ &widget.TableColumn{ Label: "Name", Data: func() (interface{}, error){ return provider.row.Name, nil }, }, &widget.TableActions{ RowId: func() interface{}{ return provider.row.Id }, Items: Map{ "View": widget.DefaultTableActionView, "Update": widget.DefaultTableActionUpdate, "Message": &widget.TableAction{ Action: fmt.Sptintf("/user/message/%d", row.Id), Tooltip: "Send message", }, }, }, }, // Highlight selected rows RowExpander: func(cell map[string]interface{}) error { if provider.row.Selected { cell["Class"] = "selected" } return nil }, }
type TableAction ¶
type TableAction struct { Action interface{} // Custom action (string or url.Url or *url.Url) Tooltip interface{} // Action tooltip Confirm interface{} // Confirmation text Post bool // Use post request Hidden bool // Action is hidden and can't be render }
Single table action
type TableActions ¶
type TableActions struct { RowId interface{} // Current row identifier or func for read it. Path string // Base path to family of actions (optional) Items Map // Action map. }
TableActions is widget for make column with action list.
type TableColumn ¶
type TableColumn struct { Label interface{} // Column label Hidden bool // Column is hidden and can't be render Data DataFunc // Column data provider Expander ExpanderFunc // Column expander for generate extra info }
Table column definition
type TableColumns ¶
type TableColumns map[string]*TableColumn