types

package
v1.2.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 30 Imported by: 398

Documentation

Index

Constants

View Source
const (
	NavBtnSiteName = "site setting"
	NavBtnInfoName = "site info"
	NavBtnToolName = "code generate tool"
	NavBtnPlugName = "plugins"
)
View Source
const (
	ButtonTypeNavDropDownItem = "navdropdownitem"
	ButtonTypeNavDropDown     = "navdropdown"
)
View Source
const (
	PostTypeCreate = iota
	PostTypeUpdate
)
View Source
const DefaultPageSize = 10

Variables

View Source
var DefaultPageSizeList = []int{10, 20, 30, 50, 100}
View Source
var JoinFieldValueDelimiter = utils.Uuid(8)

Functions

func AddGlobalDisplayProcessFn added in v1.0.7

func AddGlobalDisplayProcessFn(f FieldFilterFn)

func GetJoinField added in v1.2.6

func GetJoinField(field string) string

func JoinField added in v1.2.6

func JoinField(table, field string) string

func ParseTableDataTmpl added in v1.2.7

func ParseTableDataTmpl(content interface{}) string

func ParseTableDataTmplWithID added in v1.2.7

func ParseTableDataTmplWithID(id template.HTML, content string, value ...map[string]InfoItem) string

func RegisterDisplayFnGenerator added in v1.2.9

func RegisterDisplayFnGenerator(key string, gen DisplayFnGenerator)

Types

type Action added in v1.1.0

type Action interface {
	Js() template.JS
	BtnAttribute() template.HTML
	BtnClass() template.HTML
	ExtContent(ctx *context.Context) template.HTML
	FooterContent(ctx *context.Context) template.HTML
	SetBtnId(btnId string)
	SetBtnData(data interface{})
	GetCallbacks() context.Node
}

type ActionButton added in v1.1.7

type ActionButton struct {
	*BaseButton
}

func GetActionButton added in v1.2.7

func GetActionButton(title template.HTML, action Action, ids ...string) *ActionButton

func (*ActionButton) Content added in v1.1.7

func (b *ActionButton) Content(ctx *context.Context) (template.HTML, template.JS)

type ActionIconButton added in v1.2.18

type ActionIconButton struct {
	Icon template.HTML
	*BaseButton
}

func GetActionIconButton added in v1.2.18

func GetActionIconButton(icon string, action Action, ids ...string) *ActionIconButton

func (*ActionIconButton) Content added in v1.2.18

func (b *ActionIconButton) Content(ctx *context.Context) (template.HTML, template.JS)

type Actions added in v1.2.15

type Actions []Action

type AddFormFieldFn added in v1.2.11

type AddFormFieldFn func(panel *FormPanel)

type AjaxData added in v1.2.15

type AjaxData struct {
	SuccessTitle   string
	SuccessText    string
	ErrorTitle     string
	ErrorText      string
	SuccessJumpURL string
	DisableJump    bool
	SuccessJS      string
	JumpInNewTab   string
}

type AlertAttribute

type AlertAttribute interface {
	SetTheme(value string) AlertAttribute
	SetTitle(value template.HTML) AlertAttribute
	SetContent(value template.HTML) AlertAttribute
	Warning(msg string) template.HTML
	GetContent() template.HTML
}

type Attribute

type Attribute struct {
	TemplateList map[string]string
	Separation   bool
}

Attribute is the component interface of template. Every component of template should implement it.

type BaseButton added in v1.2.7

type BaseButton struct {
	Id, Url, Method, Name, TypeName string
	Title                           template.HTML
	Action                          Action
}

func (*BaseButton) Content added in v1.2.7

func (b *BaseButton) Content() (template.HTML, template.JS)

func (*BaseButton) GetAction added in v1.2.7

func (b *BaseButton) GetAction() Action

func (*BaseButton) GetName added in v1.2.12

func (b *BaseButton) GetName() string

func (*BaseButton) ID added in v1.2.7

func (b *BaseButton) ID() string

func (*BaseButton) IsType added in v1.2.15

func (b *BaseButton) IsType(t string) bool

func (*BaseButton) METHOD added in v1.2.8

func (b *BaseButton) METHOD() string

func (*BaseButton) SetName added in v1.2.12

func (b *BaseButton) SetName(name string)

func (*BaseButton) Type added in v1.2.15

func (b *BaseButton) Type() string

func (*BaseButton) URL added in v1.2.8

func (b *BaseButton) URL() string

type BaseDisplayFnGenerator added in v1.2.10

type BaseDisplayFnGenerator struct{}

func (*BaseDisplayFnGenerator) HTML added in v1.2.10

func (base *BaseDisplayFnGenerator) HTML() template.HTML

func (*BaseDisplayFnGenerator) JS added in v1.2.10

type BoxAttribute

type BoxAttribute interface {
	SetHeader(value template.HTML) BoxAttribute
	SetBody(value template.HTML) BoxAttribute
	SetNoPadding() BoxAttribute
	SetFooter(value template.HTML) BoxAttribute
	SetTitle(value template.HTML) BoxAttribute
	WithHeadBorder() BoxAttribute
	SetIframeStyle(iframe bool) BoxAttribute
	SetAttr(attr template.HTMLAttr) BoxAttribute
	SetStyle(value template.HTMLAttr) BoxAttribute
	SetHeadColor(value string) BoxAttribute
	SetClass(value string) BoxAttribute
	SetTheme(value string) BoxAttribute
	SetSecondHeader(value template.HTML) BoxAttribute
	SetSecondHeadColor(value string) BoxAttribute
	WithSecondHeadBorder() BoxAttribute
	SetSecondHeaderClass(value string) BoxAttribute
	GetContent() template.HTML
}

type Button added in v1.1.0

type Button interface {
	Content(ctx *context.Context) (template.HTML, template.JS)
	GetAction() Action
	URL() string
	METHOD() string
	ID() string
	Type() string
	GetName() string
	SetName(name string)
	IsType(t string) bool
}

type ButtonAttribute added in v1.1.2

type ButtonAttribute interface {
	SetContent(value template.HTML) ButtonAttribute
	SetOrientationRight() ButtonAttribute
	SetOrientationLeft() ButtonAttribute
	SetMarginLeft(int) ButtonAttribute
	SetMarginRight(int) ButtonAttribute
	SetThemePrimary() ButtonAttribute
	SetSmallSize() ButtonAttribute
	AddClass(class string) ButtonAttribute
	SetID(id string) ButtonAttribute
	SetMiddleSize() ButtonAttribute
	SetHref(string) ButtonAttribute
	SetThemeWarning() ButtonAttribute
	SetTheme(value string) ButtonAttribute
	SetLoadingText(value template.HTML) ButtonAttribute
	SetThemeDefault() ButtonAttribute
	SetType(string) ButtonAttribute
	GetContent() template.HTML
}

type Buttons added in v1.1.0

type Buttons []Button

func (Buttons) Add added in v1.2.15

func (b Buttons) Add(btn Button) Buttons

func (Buttons) AddNavButton added in v1.2.12

func (b Buttons) AddNavButton(ico, name string, action Action) Buttons

func (Buttons) Callbacks added in v1.2.16

func (b Buttons) Callbacks() []context.Node

func (Buttons) CheckExist added in v1.2.12

func (b Buttons) CheckExist(name string) bool

func (Buttons) CheckPermission added in v1.2.8

func (b Buttons) CheckPermission(user models.UserModel) Buttons

func (Buttons) CheckPermissionWhenURLAndMethodNotEmpty added in v1.2.18

func (b Buttons) CheckPermissionWhenURLAndMethodNotEmpty(user models.UserModel) Buttons

func (Buttons) Content added in v1.1.0

func (b Buttons) Content(ctx *context.Context) (template.HTML, template.JS)

func (Buttons) Copy added in v1.2.15

func (b Buttons) Copy() Buttons

func (Buttons) FooterContent added in v1.2.8

func (b Buttons) FooterContent(ctx *context.Context) template.HTML

func (Buttons) RemoveButtonByName added in v1.2.12

func (b Buttons) RemoveButtonByName(name string) Buttons

func (Buttons) RemoveInfoNavButton added in v1.2.12

func (b Buttons) RemoveInfoNavButton() Buttons

func (Buttons) RemovePlugNavButton added in v1.2.15

func (b Buttons) RemovePlugNavButton() Buttons

func (Buttons) RemoveSiteNavButton added in v1.2.12

func (b Buttons) RemoveSiteNavButton() Buttons

func (Buttons) RemoveToolNavButton added in v1.2.12

func (b Buttons) RemoveToolNavButton() Buttons

type Callbacks added in v1.1.8

type Callbacks []context.Node

func (Callbacks) AddCallback added in v1.1.8

func (c Callbacks) AddCallback(node context.Node) Callbacks

type ColAttribute

type ColAttribute interface {
	SetSize(value S) ColAttribute
	SetContent(value template.HTML) ColAttribute
	AddContent(value template.HTML) ColAttribute
	GetContent() template.HTML
}

type Component

type Component interface {
	GetContent() template.HTML
	GetJS() template.JS
	GetCSS() template.CSS
	GetCallbacks() Callbacks
}

type ContentWrapper added in v1.2.11

type ContentWrapper func(content template.HTML) template.HTML

type DataTableAttribute

type DataTableAttribute interface {
	GetDataTableHeader() template.HTML
	SetThead(value Thead) DataTableAttribute
	SetInfoList(value []map[string]InfoItem) DataTableAttribute
	SetEditUrl(value string) DataTableAttribute
	SetDeleteUrl(value string) DataTableAttribute
	SetNewUrl(value string) DataTableAttribute
	SetPrimaryKey(value string) DataTableAttribute
	SetStyle(style string) DataTableAttribute
	SetAction(action template.HTML) DataTableAttribute
	SetIsTab(value bool) DataTableAttribute
	SetActionFold(fold bool) DataTableAttribute
	SetHideThead() DataTableAttribute
	SetLayout(value string) DataTableAttribute
	SetButtons(btns template.HTML) DataTableAttribute
	SetSticky(sticky bool) DataTableAttribute
	SetHideFilterArea(value bool) DataTableAttribute
	SetHideRowSelector(value bool) DataTableAttribute
	SetActionJs(aj template.JS) DataTableAttribute
	SetNoAction() DataTableAttribute
	SetInfoUrl(value string) DataTableAttribute
	SetDetailUrl(value string) DataTableAttribute
	SetHasFilter(hasFilter bool) DataTableAttribute
	SetSortUrl(value string) DataTableAttribute
	SetExportUrl(value string) DataTableAttribute
	SetUpdateUrl(value string) DataTableAttribute
	GetContent() template.HTML
}

type DefaultAction added in v1.1.7

type DefaultAction struct {
	Attr   template.HTML
	JS     template.JS
	Ext    template.HTML
	Footer template.HTML
}

func NewDefaultAction added in v1.1.7

func NewDefaultAction(attr, ext, footer template.HTML, js template.JS) *DefaultAction

func (*DefaultAction) BtnAttribute added in v1.1.7

func (def *DefaultAction) BtnAttribute() template.HTML

func (*DefaultAction) BtnClass added in v1.2.0

func (def *DefaultAction) BtnClass() template.HTML

func (*DefaultAction) ExtContent added in v1.1.7

func (def *DefaultAction) ExtContent(ctx *context.Context) template.HTML

func (*DefaultAction) FooterContent added in v1.2.6

func (def *DefaultAction) FooterContent(ctx *context.Context) template.HTML

func (*DefaultAction) GetCallbacks added in v1.1.8

func (def *DefaultAction) GetCallbacks() context.Node

func (*DefaultAction) Js added in v1.1.7

func (def *DefaultAction) Js() template.JS

func (*DefaultAction) SetBtnData added in v1.2.4

func (def *DefaultAction) SetBtnData(data interface{})

func (*DefaultAction) SetBtnId added in v1.1.7

func (def *DefaultAction) SetBtnId(btnId string)

type DefaultButton added in v1.1.7

type DefaultButton struct {
	*BaseButton
	Color     template.HTML
	TextColor template.HTML
	Icon      string
	Direction template.HTML
	Group     bool
}

func GetColumnButton added in v1.2.7

func GetColumnButton(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton

func GetDefaultButton added in v1.2.7

func GetDefaultButton(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton

func GetDefaultButtonGroup added in v1.2.16

func GetDefaultButtonGroup(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton

func (*DefaultButton) Content added in v1.1.7

func (b *DefaultButton) Content(ctx *context.Context) (template.HTML, template.JS)

type DefaultSelection added in v1.2.4

type DefaultSelection struct {
	*BaseButton
	Options     FieldOptions
	Placeholder string
	Width       int
}

func GetDefaultSelection added in v1.2.7

func GetDefaultSelection(placeholder string, options FieldOptions, action Action, widths ...int) *DefaultSelection

func (*DefaultSelection) Content added in v1.2.4

func (b *DefaultSelection) Content(ctx *context.Context) (template.HTML, template.JS)

type DeleteFn added in v1.1.0

type DeleteFn func(ids []string) error

type DeleteFnWithRes added in v1.2.8

type DeleteFnWithRes func(ids []string, res error) error

type DisplayFnGenerator added in v1.2.9

type DisplayFnGenerator interface {
	Get(ctx *context.Context, args ...interface{}) FieldFilterFn
	JS() template.HTML
	HTML() template.HTML
}

type DisplayProcessFnChains added in v1.0.0

type DisplayProcessFnChains []FieldFilterFn

func AddLimit added in v1.0.7

func AddLimit(limit int) DisplayProcessFnChains

func AddSubstr added in v1.0.7

func AddSubstr(start int, end int) DisplayProcessFnChains

func AddToLower added in v1.0.7

func AddToLower() DisplayProcessFnChains

func AddToTitle added in v1.0.7

func AddToTitle() DisplayProcessFnChains

func AddToUpper added in v1.0.7

func AddToUpper() DisplayProcessFnChains

func AddTrimSpace added in v1.0.7

func AddTrimSpace() DisplayProcessFnChains

func AddXssFilter added in v1.0.7

func AddXssFilter() DisplayProcessFnChains

func AddXssJsFilter added in v1.0.7

func AddXssJsFilter() DisplayProcessFnChains

func (DisplayProcessFnChains) Add added in v1.0.0

func (DisplayProcessFnChains) Append added in v1.0.9

func (DisplayProcessFnChains) Copy added in v1.0.7

func (DisplayProcessFnChains) Valid added in v1.0.0

func (d DisplayProcessFnChains) Valid() bool

type ExportProcessFn added in v1.2.15

type ExportProcessFn func(param parameter.Parameters) (PanelInfo, error)

type Field added in v1.0.0

type Field struct {
	Head     string
	Field    string
	TypeName db.DatabaseType

	Joins Joins

	Width       int
	Sortable    bool
	EditAble    bool
	Fixed       bool
	Filterable  bool
	Hide        bool
	HideForList bool

	EditType    table.Type
	EditOptions FieldOptions

	FilterFormFields []FilterFormField

	IsEditParam   bool
	IsDeleteParam bool
	IsDetailParam bool

	FieldDisplay
}

Field is the table field.

func (Field) Exist added in v1.1.4

func (f Field) Exist() bool

func (Field) GetFilterFormFields added in v1.2.3

func (f Field) GetFilterFormFields(params parameter.Parameters, headField string, sql ...*db.SQL) []FormField

type FieldDisplay added in v1.0.0

type FieldDisplay struct {
	Display              FieldFilterFn
	DisplayProcessChains DisplayProcessFnChains
}

func (FieldDisplay) AddLimit added in v1.0.0

func (f FieldDisplay) AddLimit(limit int) DisplayProcessFnChains

func (FieldDisplay) AddSubstr added in v1.0.0

func (f FieldDisplay) AddSubstr(start int, end int) DisplayProcessFnChains

func (FieldDisplay) AddToLower added in v1.0.0

func (f FieldDisplay) AddToLower() DisplayProcessFnChains

func (FieldDisplay) AddToTitle added in v1.0.0

func (f FieldDisplay) AddToTitle() DisplayProcessFnChains

func (FieldDisplay) AddToUpper added in v1.0.0

func (f FieldDisplay) AddToUpper() DisplayProcessFnChains

func (FieldDisplay) AddTrimSpace added in v1.0.0

func (f FieldDisplay) AddTrimSpace() DisplayProcessFnChains

func (FieldDisplay) IsNotSelectRes added in v1.2.14

func (f FieldDisplay) IsNotSelectRes(v interface{}) bool

func (FieldDisplay) ToDisplay added in v1.0.0

func (f FieldDisplay) ToDisplay(value FieldModel) interface{}

func (FieldDisplay) ToDisplayHTML added in v1.2.14

func (f FieldDisplay) ToDisplayHTML(value FieldModel) template.HTML

func (FieldDisplay) ToDisplayString added in v1.2.14

func (f FieldDisplay) ToDisplayString(value FieldModel) string

func (FieldDisplay) ToDisplayStringArray added in v1.2.14

func (f FieldDisplay) ToDisplayStringArray(value FieldModel) []string

func (FieldDisplay) ToDisplayStringArrayArray added in v1.2.14

func (f FieldDisplay) ToDisplayStringArrayArray(value FieldModel) [][]string

type FieldDotColor added in v1.2.11

type FieldDotColor string
const (
	FieldDotColorDanger  FieldDotColor = "danger"
	FieldDotColorInfo    FieldDotColor = "info"
	FieldDotColorPrimary FieldDotColor = "primary"
	FieldDotColorSuccess FieldDotColor = "success"
)

type FieldFilterFn added in v1.0.0

type FieldFilterFn func(value FieldModel) interface{}

FieldDisplay is filter function of data.

type FieldGetImgArrFn added in v1.2.11

type FieldGetImgArrFn func(value string) []string

type FieldLabelParam added in v1.2.9

type FieldLabelParam struct {
	Color template.HTML
	Type  string
}

type FieldList added in v1.1.4

type FieldList []Field

func (FieldList) GetFieldByFieldName added in v1.1.4

func (f FieldList) GetFieldByFieldName(name string) Field

func (FieldList) GetFieldFilterProcessValue added in v1.2.3

func (f FieldList) GetFieldFilterProcessValue(key, value, keyIndex string) string

func (FieldList) GetFieldJoinTable added in v1.2.3

func (f FieldList) GetFieldJoinTable(key string) string

func (FieldList) GetThead added in v1.2.3

func (f FieldList) GetThead(info TableInfo, params parameter.Parameters, columns []string) (Thead, string, string)

func (FieldList) GetTheadAndFilterForm added in v1.2.3

func (f FieldList) GetTheadAndFilterForm(info TableInfo, params parameter.Parameters, columns []string,
	sql ...func() *db.SQL) (Thead, string, string, string, []string, []FormField)

type FieldModel added in v1.0.0

type FieldModel struct {
	// The primaryKey of the table.
	ID string

	// The value of the single query result.
	Value string

	// The current row data.
	Row map[string]interface{}

	// Post type
	PostType PostType
}

FieldModel is the single query result.

func (FieldModel) IsCreate added in v1.2.14

func (m FieldModel) IsCreate() bool

func (FieldModel) IsUpdate added in v1.2.14

func (m FieldModel) IsUpdate() bool

type FieldModelValue added in v1.0.0

type FieldModelValue []string

func (FieldModelValue) First added in v1.0.0

func (r FieldModelValue) First() string

func (FieldModelValue) Value added in v1.0.0

func (r FieldModelValue) Value() string

type FieldOption added in v1.2.3

type FieldOption struct {
	Text          string            `json:"text"`
	Value         string            `json:"value"`
	TextHTML      template.HTML     `json:"-"`
	Selected      bool              `json:"-"`
	SelectedLabel template.HTML     `json:"-"`
	Extra         map[string]string `json:"-"`
}

type FieldOptions added in v1.0.9

type FieldOptions []FieldOption

func (FieldOptions) Copy added in v1.2.14

func (fo FieldOptions) Copy() FieldOptions

func (FieldOptions) Marshal added in v1.2.4

func (fo FieldOptions) Marshal() string

func (FieldOptions) SetSelected added in v1.0.9

func (fo FieldOptions) SetSelected(val interface{}, labels []template.HTML) FieldOptions

func (FieldOptions) SetSelectedLabel added in v1.2.3

func (fo FieldOptions) SetSelectedLabel(labels []template.HTML) FieldOptions

type FieldProgressBarData added in v1.2.11

type FieldProgressBarData struct {
	Style string
	Size  string
	Max   int
}

type FilterFormField added in v1.2.3

type FilterFormField struct {
	Type        form.Type
	Options     FieldOptions
	OptionTable OptionTable
	Width       int
	HeadWidth   int
	InputWidth  int
	Style       template.HTMLAttr
	Operator    FilterOperator
	OptionExt   template.JS
	Head        string
	Placeholder string
	HelpMsg     template.HTML
	NoIcon      bool
	ProcessFn   func(string) string
}

type FilterOperator added in v1.1.2

type FilterOperator string
const (
	FilterOperatorLike           FilterOperator = "like"
	FilterOperatorGreater        FilterOperator = ">"
	FilterOperatorGreaterOrEqual FilterOperator = ">="
	FilterOperatorEqual          FilterOperator = "="
	FilterOperatorNotEqual       FilterOperator = "!="
	FilterOperatorLess           FilterOperator = "<"
	FilterOperatorLessOrEqual    FilterOperator = "<="
	FilterOperatorFree           FilterOperator = "free"
)

func GetOperatorFromValue added in v1.1.2

func GetOperatorFromValue(value string) FilterOperator

func (FilterOperator) AddOrNot added in v1.1.2

func (o FilterOperator) AddOrNot() bool

func (FilterOperator) Label added in v1.1.2

func (o FilterOperator) Label() template.HTML

func (FilterOperator) String added in v1.1.2

func (o FilterOperator) String() string

func (FilterOperator) Valid added in v1.1.2

func (o FilterOperator) Valid() bool

func (FilterOperator) Value added in v1.1.2

func (o FilterOperator) Value() string

type FilterType added in v1.1.2

type FilterType struct {
	Options     FieldOptions
	Process     func(string) string
	OptionExt   map[string]interface{}
	FormType    form.Type
	HelpMsg     template.HTML
	Style       template.HTMLAttr
	Operator    FilterOperator
	Head        string
	Placeholder string
	Width       int
	HeadWidth   int
	InputWidth  int
	NoHead      bool
	NoIcon      bool
}

type FormAttribute

type FormAttribute interface {
	SetHeader(value template.HTML) FormAttribute
	SetContent(value FormFields) FormAttribute
	SetTabContents(value []FormFields) FormAttribute
	SetTabHeaders(value []string) FormAttribute
	SetFooter(value template.HTML) FormAttribute
	SetPrefix(value string) FormAttribute
	SetUrl(value string) FormAttribute
	SetPrimaryKey(value string) FormAttribute
	SetHorizontal(value bool) FormAttribute
	SetId(id string) FormAttribute
	SetAjax(successJS, errorJS template.JS) FormAttribute
	SetHiddenFields(fields map[string]string) FormAttribute
	SetFieldsHTML(html template.HTML) FormAttribute
	SetMethod(value string) FormAttribute
	SetHeadWidth(width int) FormAttribute
	SetInputWidth(width int) FormAttribute
	SetTitle(value template.HTML) FormAttribute
	SetLayout(layout form.Layout) FormAttribute
	SetOperationFooter(value template.HTML) FormAttribute
	GetDefaultBoxHeader(hideBack bool) template.HTML
	GetDetailBoxHeader(editUrl, deleteUrl string) template.HTML
	GetBoxHeaderNoButton() template.HTML
	GetContent() template.HTML
}

type FormField added in v1.0.0

type FormField struct {
	Field          string          `json:"field"`
	FieldClass     string          `json:"field_class"`
	TypeName       db.DatabaseType `json:"type_name"`
	Head           string          `json:"head"`
	Foot           template.HTML   `json:"foot"`
	FormType       form2.Type      `json:"form_type"`
	FatherFormType form2.Type      `json:"father_form_type"`
	FatherField    string          `json:"father_field"`

	RowWidth int
	RowFlag  uint8

	Default                template.HTML  `json:"default"`
	DefaultArr             interface{}    `json:"default_arr"`
	Value                  template.HTML  `json:"value"`
	Value2                 string         `json:"value_2"`
	ValueArr               []string       `json:"value_arr"`
	Value2Arr              []string       `json:"value_2_arr"`
	Options                FieldOptions   `json:"options"`
	OptionsArr             []FieldOptions `json:"options_arr"`
	DefaultOptionDelimiter string         `json:"default_option_delimiter"`
	Label                  template.HTML  `json:"label"`
	HideLabel              bool           `json:"hide_label"`

	Placeholder string `json:"placeholder"`

	CustomContent template.HTML `json:"custom_content"`
	CustomJs      template.JS   `json:"custom_js"`
	CustomCss     template.CSS  `json:"custom_css"`

	Editable         bool `json:"editable"`
	NotAllowEdit     bool `json:"not_allow_edit"`
	NotAllowAdd      bool `json:"not_allow_add"`
	DisplayButNotAdd bool `json:"display_but_not_add"`
	Must             bool `json:"must"`
	Hide             bool `json:"hide"`
	CreateHide       bool `json:"create_hide"`
	EditHide         bool `json:"edit_hide"`

	Width int `json:"width"`

	InputWidth int `json:"input_width"`
	HeadWidth  int `json:"head_width"`

	Joins Joins `json:"-"`

	Divider      bool   `json:"divider"`
	DividerTitle string `json:"divider_title"`

	HelpMsg template.HTML `json:"help_msg"`

	TableFields FormFields

	Style  template.HTMLAttr `json:"style"`
	NoIcon bool              `json:"no_icon"`

	OptionExt       template.JS     `json:"option_ext"`
	OptionExt2      template.JS     `json:"option_ext_2"`
	OptionInitFn    OptionInitFn    `json:"-"`
	OptionArrInitFn OptionArrInitFn `json:"-"`
	OptionTable     OptionTable     `json:"-"`

	FieldDisplay `json:"-"`
	PostFilterFn PostFieldFilterFn `json:"-"`
}

FormField is the form field with different options.

func (*FormField) FillCustomContent added in v1.2.6

func (f *FormField) FillCustomContent() *FormField

func (*FormField) GetRawValue added in v1.2.14

func (f *FormField) GetRawValue(columns []string, v interface{}) string

func (*FormField) UpdateDefaultValue added in v1.2.2

func (f *FormField) UpdateDefaultValue(sql *db.SQL) *FormField

func (*FormField) UpdateValue added in v1.0.9

func (f *FormField) UpdateValue(id, val string, res map[string]interface{}, sql *db.SQL) *FormField

type FormFields added in v1.0.0

type FormFields []FormField

func (FormFields) Add added in v1.2.9

func (f FormFields) Add(field *FormField) FormFields

func (FormFields) Copy added in v1.0.0

func (f FormFields) Copy() FormFields

func (FormFields) FillCustomContent added in v1.2.6

func (f FormFields) FillCustomContent() FormFields

func (FormFields) FindByFieldName added in v1.0.0

func (f FormFields) FindByFieldName(field string) *FormField

func (FormFields) FindIndexByFieldName added in v1.2.11

func (f FormFields) FindIndexByFieldName(field string) int

func (FormFields) FindTableChildren added in v1.2.12

func (f FormFields) FindTableChildren(father string) []*FormField

func (FormFields) FindTableField added in v1.2.11

func (f FormFields) FindTableField(field, father string) *FormField

func (FormFields) RemoveNotShow added in v1.2.11

func (f FormFields) RemoveNotShow() FormFields

type FormPanel

type FormPanel struct {
	FieldList FormFields `json:"field_list"`

	// Warn: may be deprecated in the future. `json:""
	TabGroups  TabGroups  `json:"tab_groups"`
	TabHeaders TabHeaders `json:"tab_headers"`

	Table       string `json:"table"`
	Title       string `json:"title"`
	Description string `json:"description"`

	Validator    FormPostFn       `json:"validator"`
	PostHook     FormPostFn       `json:"post_hook"`
	PreProcessFn FormPreProcessFn `json:"pre_process_fn"`

	Callbacks Callbacks `json:"callbacks"`

	UpdateFn FormPostFn `json:"update_fn"`
	InsertFn FormPostFn `json:"insert_fn"`

	IsHideContinueEditCheckBox bool `json:"is_hide_continue_edit_check_box"`
	IsHideContinueNewCheckBox  bool `json:"is_hide_continue_new_check_box"`
	IsHideResetButton          bool `json:"is_hide_reset_button"`
	IsHideBackButton           bool `json:"is_hide_back_button"`

	Layout form2.Layout `json:"layout"`

	HTMLContent template.HTML `json:"html_content"`

	Header template.HTML `json:"header"`

	InputWidth int `json:"input_width"`
	HeadWidth  int `json:"head_width"`

	FormNewTitle    template.HTML `json:"form_new_title"`
	FormNewBtnWord  template.HTML `json:"form_new_btn_word"`
	FormEditTitle   template.HTML `json:"form_edit_title"`
	FormEditBtnWord template.HTML `json:"form_edit_btn_word"`

	Ajax          bool        `json:"ajax"`
	AjaxSuccessJS template.JS `json:"ajax_success_js"`
	AjaxErrorJS   template.JS `json:"ajax_error_js"`

	Responder Responder `json:"responder"`

	Wrapper ContentWrapper `json:"wrapper"`

	HideSideBar bool `json:"hide_side_bar"`

	HeaderHtml template.HTML `json:"header_html"`
	FooterHtml template.HTML `json:"footer_html"`

	PageError     errors.PageError `json:"page_error"`
	PageErrorHTML template.HTML    `json:"page_error_html"`

	NoCompress bool `json:"no_compress"`
	// contains filtered or unexported fields
}

FormPanel

func NewFormPanel added in v1.0.0

func NewFormPanel() *FormPanel

func (*FormPanel) AddCSS added in v1.2.23

func (f *FormPanel) AddCSS(css template.CSS) *FormPanel

func (*FormPanel) AddField added in v1.0.0

func (f *FormPanel) AddField(head, field string, filedType db.DatabaseType, formType form2.Type) *FormPanel

func (*FormPanel) AddFieldTr added in v1.2.18

func (f *FormPanel) AddFieldTr(ctx *context.Context, head, field string, filedType db.DatabaseType, formType form2.Type) *FormPanel

func (*FormPanel) AddFieldWithTranslation added in v1.2.18

func (f *FormPanel) AddFieldWithTranslation(ctx *context.Context, head, field string, filedType db.DatabaseType,
	formType form2.Type) *FormPanel

func (*FormPanel) AddJS added in v1.2.23

func (f *FormPanel) AddJS(js template.JS) *FormPanel

func (*FormPanel) AddLimitFilter added in v1.0.9

func (f *FormPanel) AddLimitFilter(limit int) *FormPanel

func (*FormPanel) AddRow added in v1.2.11

func (f *FormPanel) AddRow(addFields AddFormFieldFn) *FormPanel

func (*FormPanel) AddSubstrFilter added in v1.0.9

func (f *FormPanel) AddSubstrFilter(start int, end int) *FormPanel

func (*FormPanel) AddTable added in v1.2.11

func (f *FormPanel) AddTable(head, field string, addFields AddFormFieldFn) *FormPanel

func (*FormPanel) AddToLowerFilter added in v1.0.9

func (f *FormPanel) AddToLowerFilter() *FormPanel

func (*FormPanel) AddToTitleFilter added in v1.0.9

func (f *FormPanel) AddToTitleFilter() *FormPanel

func (*FormPanel) AddToUpperFilter added in v1.0.9

func (f *FormPanel) AddToUpperFilter() *FormPanel

func (*FormPanel) AddTrimSpaceFilter added in v1.0.9

func (f *FormPanel) AddTrimSpaceFilter() *FormPanel

func (*FormPanel) AddXssFilter added in v1.0.9

func (f *FormPanel) AddXssFilter() *FormPanel

func (*FormPanel) AddXssJsFilter added in v1.0.9

func (f *FormPanel) AddXssJsFilter() *FormPanel

func (*FormPanel) EnableAjax added in v1.2.12

func (f *FormPanel) EnableAjax(msgs ...string) *FormPanel

func (*FormPanel) EnableAjaxData added in v1.2.15

func (f *FormPanel) EnableAjaxData(data AjaxData) *FormPanel

func (*FormPanel) FieldCustomContent added in v1.0.6

func (f *FormPanel) FieldCustomContent(content template.HTML) *FormPanel

func (*FormPanel) FieldCustomCss added in v1.0.6

func (f *FormPanel) FieldCustomCss(css template.CSS) *FormPanel

func (*FormPanel) FieldCustomJs added in v1.0.6

func (f *FormPanel) FieldCustomJs(js template.JS) *FormPanel

func (*FormPanel) FieldDefault added in v1.0.1

func (f *FormPanel) FieldDefault(def string) *FormPanel

func (*FormPanel) FieldDefaultOptionDelimiter added in v1.0.0

func (f *FormPanel) FieldDefaultOptionDelimiter(delimiter string) *FormPanel

func (*FormPanel) FieldDisableWhenCreate added in v1.2.16

func (f *FormPanel) FieldDisableWhenCreate() *FormPanel

FieldDisableWhenCreate means when create record the field can not be edited, displayed and submitted.

func (*FormPanel) FieldDisableWhenUpdate added in v1.2.16

func (f *FormPanel) FieldDisableWhenUpdate() *FormPanel

FieldDisableWhenUpdate means when update record the field can not be edited, displayed and submitted.

func (*FormPanel) FieldDisplay added in v1.0.0

func (f *FormPanel) FieldDisplay(filter FieldFilterFn) *FormPanel

func (*FormPanel) FieldDisplayButCanNotEditWhenCreate added in v1.2.16

func (f *FormPanel) FieldDisplayButCanNotEditWhenCreate() *FormPanel

FieldDisplayButCanNotEditWhenCreate means when create record the field can not be edited but will still be displayed and submitted.

func (*FormPanel) FieldDisplayButCanNotEditWhenUpdate added in v1.2.16

func (f *FormPanel) FieldDisplayButCanNotEditWhenUpdate() *FormPanel

FieldDisplayButCanNotEditWhenUpdate means when update record the field can not be edited but will still be displayed and submitted.

func (*FormPanel) FieldDivider added in v1.2.9

func (f *FormPanel) FieldDivider(title ...string) *FormPanel

func (*FormPanel) FieldEnableFileUpload added in v1.2.6

func (f *FormPanel) FieldEnableFileUpload(data ...interface{}) *FormPanel

func (*FormPanel) FieldFoot added in v1.2.11

func (f *FormPanel) FieldFoot(foot template.HTML) *FormPanel

func (*FormPanel) FieldFormType added in v1.0.0

func (f *FormPanel) FieldFormType(formType form2.Type) *FormPanel

func (*FormPanel) FieldHeadWidth added in v1.2.11

func (f *FormPanel) FieldHeadWidth(width int) *FormPanel

func (*FormPanel) FieldHelpMsg added in v1.0.9

func (f *FormPanel) FieldHelpMsg(s template.HTML) *FormPanel

func (*FormPanel) FieldHide added in v1.0.9

func (f *FormPanel) FieldHide() *FormPanel

func (*FormPanel) FieldHideLabel added in v1.2.11

func (f *FormPanel) FieldHideLabel() *FormPanel

func (*FormPanel) FieldHideWhenCreate added in v1.2.16

func (f *FormPanel) FieldHideWhenCreate() *FormPanel

FieldHideWhenCreate means when create record the field can not be edited and displayed, but will be submitted.

func (*FormPanel) FieldHideWhenUpdate added in v1.2.16

func (f *FormPanel) FieldHideWhenUpdate() *FormPanel

FieldHideWhenUpdate means when update record the field can not be edited and displayed, but will be submitted.

func (*FormPanel) FieldInputWidth added in v1.2.11

func (f *FormPanel) FieldInputWidth(width int) *FormPanel

func (*FormPanel) FieldLimit added in v1.0.0

func (f *FormPanel) FieldLimit(limit int) *FormPanel

FieldLimit limit the field length.

func (*FormPanel) FieldMust added in v1.0.0

func (f *FormPanel) FieldMust() *FormPanel

func (*FormPanel) FieldNotAllowAdd added in v1.0.0

func (f *FormPanel) FieldNotAllowAdd() *FormPanel

FieldNotAllowAdd means when create record the field can not be edited, displayed and submitted. Deprecated: Use FieldDisableWhenCreate instead.

func (*FormPanel) FieldNotAllowEdit added in v1.0.2

func (f *FormPanel) FieldNotAllowEdit() *FormPanel

FieldNotAllowEdit means when update record the field can not be edited but will still be displayed and submitted. Deprecated: Use FieldDisplayButCanNotEditWhenUpdate instead.

func (*FormPanel) FieldNow added in v1.2.16

func (f *FormPanel) FieldNow() *FormPanel

func (*FormPanel) FieldNowWhenInsert added in v1.2.16

func (f *FormPanel) FieldNowWhenInsert() *FormPanel

func (*FormPanel) FieldNowWhenUpdate added in v1.2.16

func (f *FormPanel) FieldNowWhenUpdate() *FormPanel

func (*FormPanel) FieldOnChoose added in v1.2.3

func (f *FormPanel) FieldOnChoose(val, field string, value template.HTML) *FormPanel

FieldOnChoose set the given value of the given field when choose the value of val.

func (*FormPanel) FieldOnChooseAjax added in v1.2.3

func (f *FormPanel) FieldOnChooseAjax(field, url string, handler Handler, custom ...template.HTML) *FormPanel

FieldOnChooseAjax set the url and handler that will be called when field be choosed. The handler will return the option of the field. It will help to link two or more form items. For example:

FieldOnChooseAjax("city", "/search/city", func(ctx *context.Context) (success bool, msg string, data interface{}) {
	return true, "ok", selection.Data{
		Results: selection.Options{
			{Text: "GuangZhou", ID: "1"},
			{Text: "ShenZhen", ID: "2"},
			{Text: "BeiJing", ID: "3"},
			{Text: "ShangHai", ID: "4"},
		}
	}
})

When you choose the country, it trigger the action of ajax which be sent to the given handler, and return the city options to the field city.

func (*FormPanel) FieldOnChooseCustom added in v1.2.3

func (f *FormPanel) FieldOnChooseCustom(js template.HTML) *FormPanel

FieldOnChooseCustom set the js that will be called when filter option be selected.

func (*FormPanel) FieldOnChooseDisable added in v1.2.3

func (f *FormPanel) FieldOnChooseDisable(value string, field ...string) *FormPanel

FieldOnChooseDisable disable the fields when value to be chosen.

func (*FormPanel) FieldOnChooseHide added in v1.2.3

func (f *FormPanel) FieldOnChooseHide(value string, field ...string) *FormPanel

FieldOnChooseHide hide the fields when value to be chosen.

func (*FormPanel) FieldOnChooseMap added in v1.2.3

func (f *FormPanel) FieldOnChooseMap(m map[string]LinkField) *FormPanel

FieldOnChooseMap set the actions that will be taken when filter option be selected. For example:

map[string]types.LinkField{
     "men": {Field: "ip", Value:"127.0.0.1"},
     "women": {Field: "ip", Hide: true},
     "other": {Field: "ip", Disable: true}
}

mean when choose men, the value of field ip will be set to 127.0.0.1, when choose women, field ip will be hidden, and when choose other, field ip will be disabled.

func (*FormPanel) FieldOnChooseOptionsHide added in v1.2.23

func (f *FormPanel) FieldOnChooseOptionsHide(values []string, field ...string) *FormPanel

FieldOnChooseOptionsHide display the fields when value to be chosen.

func (*FormPanel) FieldOnChooseOptionsShow added in v1.2.23

func (f *FormPanel) FieldOnChooseOptionsShow(values []string, field ...string) *FormPanel

FieldOnChooseOptionsShow display the fields when values to be chosen.

func (*FormPanel) FieldOnChooseShow added in v1.2.9

func (f *FormPanel) FieldOnChooseShow(value string, field ...string) *FormPanel

FieldFilterOnChooseShow display the fields when value to be chosen.

func (*FormPanel) FieldOnSearch added in v1.2.3

func (f *FormPanel) FieldOnSearch(url string, handler Handler, delay ...int) *FormPanel

FieldOnSearch set the url and the corresponding handler which has some backend logic and return the options of the field. For example:

FieldOnSearch("/search/city", func(ctx *context.Context) (success bool, msg string, data interface{}) {
	return true, "ok", selection.Data{
		Results: selection.Options{
			{Text: "GuangZhou", ID: "1"},
			{Text: "ShenZhen", ID: "2"},
			{Text: "BeiJing", ID: "3"},
			{Text: "ShangHai", ID: "4"},
		}
	}
}, 1000)

func (*FormPanel) FieldOptionExt added in v1.1.0

func (f *FormPanel) FieldOptionExt(m map[string]interface{}) *FormPanel

FieldOptionExt set the option extension js of the field.

func (*FormPanel) FieldOptionExt2 added in v1.2.11

func (f *FormPanel) FieldOptionExt2(m map[string]interface{}) *FormPanel

func (*FormPanel) FieldOptionExtJS added in v1.2.3

func (f *FormPanel) FieldOptionExtJS(js template.JS) *FormPanel

func (*FormPanel) FieldOptionExtJS2 added in v1.2.11

func (f *FormPanel) FieldOptionExtJS2(js template.JS) *FormPanel

func (*FormPanel) FieldOptionInitFn added in v1.2.3

func (f *FormPanel) FieldOptionInitFn(fn OptionInitFn) *FormPanel

func (*FormPanel) FieldOptions added in v1.0.0

func (f *FormPanel) FieldOptions(options FieldOptions) *FormPanel

FieldOptions set options for a filterable field to select. It will work when you set the FormType of the field to SelectSingle/Select/SelectBox.

func (*FormPanel) FieldOptionsFromTable added in v1.2.5

func (f *FormPanel) FieldOptionsFromTable(table, textFieldName, valueFieldName string, process ...OptionTableQueryProcessFn) *FormPanel

FieldOptionsFromTable set options for a filterable field to select. The options is from other table. For example,

`FieldOptionsFromTable("roles", "name", "id")`

will generate the sql like:

`select id, name from roles`.

And the `id` will be the value of options, `name` is the text to be shown.

func (*FormPanel) FieldOptionsTableProcessFn added in v1.2.5

func (f *FormPanel) FieldOptionsTableProcessFn(fn OptionProcessFn) *FormPanel

func (*FormPanel) FieldPlaceholder added in v1.2.4

func (f *FormPanel) FieldPlaceholder(placeholder string) *FormPanel

func (*FormPanel) FieldPostFilterFn added in v1.0.0

func (f *FormPanel) FieldPostFilterFn(post PostFieldFilterFn) *FormPanel

func (*FormPanel) FieldRowWidth added in v1.2.11

func (f *FormPanel) FieldRowWidth(width int) *FormPanel

func (*FormPanel) FieldSubstr added in v1.0.0

func (f *FormPanel) FieldSubstr(start int, end int) *FormPanel

FieldSubstr intercept string of the field.

func (*FormPanel) FieldToLower added in v1.0.0

func (f *FormPanel) FieldToLower() *FormPanel

FieldToLower update the field to a string with all Unicode letters mapped to their lower case.

func (*FormPanel) FieldToTitle added in v1.0.0

func (f *FormPanel) FieldToTitle() *FormPanel

FieldToTitle update the field to a string that begin words mapped to their Unicode title case.

func (*FormPanel) FieldToUpper added in v1.0.0

func (f *FormPanel) FieldToUpper() *FormPanel

FieldToUpper update the field to a string with all Unicode letters mapped to their upper case.

func (*FormPanel) FieldTrimSpace added in v1.0.0

func (f *FormPanel) FieldTrimSpace() *FormPanel

FieldTrimSpace trim space of the field.

func (*FormPanel) FieldValue added in v1.0.0

func (f *FormPanel) FieldValue(value string) *FormPanel

func (*FormPanel) FieldWidth added in v1.2.4

func (f *FormPanel) FieldWidth(width int) *FormPanel

func (*FormPanel) FieldXssFilter added in v1.0.7

func (f *FormPanel) FieldXssFilter() *FormPanel

FieldXssFilter escape field with html.Escape.

func (*FormPanel) FieldsWithDefaultValue added in v1.2.5

func (f *FormPanel) FieldsWithDefaultValue(sql ...func() *db.SQL) FormFields

func (*FormPanel) FieldsWithValue added in v1.2.5

func (f *FormPanel) FieldsWithValue(pk, id string, columns []string, res map[string]interface{}, sql func() *db.SQL) FormFields

func (*FormPanel) GetNewFormFields added in v1.2.14

func (f *FormPanel) GetNewFormFields(sql ...func() *db.SQL) (FormFields, []FormFields, []string)

func (*FormPanel) GroupField added in v1.2.5

func (f *FormPanel) GroupField(sql ...func() *db.SQL) ([]FormFields, []string)

func (*FormPanel) GroupFieldWithValue added in v1.2.5

func (f *FormPanel) GroupFieldWithValue(pk, id string, columns []string, res map[string]interface{}, sql func() *db.SQL) ([]FormFields, []string)

func (*FormPanel) HasError added in v1.2.15

func (f *FormPanel) HasError() bool

func (*FormPanel) HideBackButton added in v1.2.8

func (f *FormPanel) HideBackButton() *FormPanel

func (*FormPanel) HideContinueEditCheckBox added in v1.2.8

func (f *FormPanel) HideContinueEditCheckBox() *FormPanel

func (*FormPanel) HideContinueNewCheckBox added in v1.2.8

func (f *FormPanel) HideContinueNewCheckBox() *FormPanel

func (*FormPanel) HideResetButton added in v1.2.8

func (f *FormPanel) HideResetButton() *FormPanel

func (*FormPanel) OperationURL added in v1.2.7

func (f *FormPanel) OperationURL(id string) string

func (*FormPanel) Set400Error added in v1.2.15

func (f *FormPanel) Set400Error(content ...template.HTML) *FormPanel

func (*FormPanel) Set403Error added in v1.2.15

func (f *FormPanel) Set403Error(content ...template.HTML) *FormPanel

func (*FormPanel) Set404Error added in v1.2.15

func (f *FormPanel) Set404Error(content ...template.HTML) *FormPanel

func (*FormPanel) Set500Error added in v1.2.15

func (f *FormPanel) Set500Error(content ...template.HTML) *FormPanel

func (*FormPanel) SetAjaxErrorJS added in v1.2.12

func (f *FormPanel) SetAjaxErrorJS(js template.JS) *FormPanel

func (*FormPanel) SetAjaxSuccessJS added in v1.2.12

func (f *FormPanel) SetAjaxSuccessJS(js template.JS) *FormPanel

func (*FormPanel) SetDescription added in v1.0.0

func (f *FormPanel) SetDescription(desc string) *FormPanel

func (*FormPanel) SetError added in v1.2.15

func (f *FormPanel) SetError(err errors.PageError, content ...template.HTML) *FormPanel

func (*FormPanel) SetFooterHtml added in v1.0.0

func (f *FormPanel) SetFooterHtml(footer template.HTML) *FormPanel

func (*FormPanel) SetFormEditBtnWord added in v1.2.15

func (f *FormPanel) SetFormEditBtnWord(word template.HTML) *FormPanel

func (*FormPanel) SetFormEditTitle added in v1.2.15

func (f *FormPanel) SetFormEditTitle(title template.HTML) *FormPanel

func (*FormPanel) SetFormNewBtnWord added in v1.2.15

func (f *FormPanel) SetFormNewBtnWord(word template.HTML) *FormPanel

func (*FormPanel) SetFormNewTitle added in v1.2.15

func (f *FormPanel) SetFormNewTitle(title template.HTML) *FormPanel

func (*FormPanel) SetHTMLContent added in v1.2.11

func (f *FormPanel) SetHTMLContent(content template.HTML) *FormPanel

func (*FormPanel) SetHeadWidth added in v1.2.11

func (f *FormPanel) SetHeadWidth(width int) *FormPanel

func (*FormPanel) SetHeader added in v1.2.11

func (f *FormPanel) SetHeader(content template.HTML) *FormPanel

func (*FormPanel) SetHeaderHtml added in v1.0.0

func (f *FormPanel) SetHeaderHtml(header template.HTML) *FormPanel

func (*FormPanel) SetHideSideBar added in v1.2.16

func (f *FormPanel) SetHideSideBar() *FormPanel

func (*FormPanel) SetInputWidth added in v1.2.11

func (f *FormPanel) SetInputWidth(width int) *FormPanel

func (*FormPanel) SetInsertFn added in v1.1.0

func (f *FormPanel) SetInsertFn(fn FormPostFn) *FormPanel

func (*FormPanel) SetLayout added in v1.2.11

func (f *FormPanel) SetLayout(layout form2.Layout) *FormPanel

func (*FormPanel) SetNoCompress added in v1.2.15

func (f *FormPanel) SetNoCompress() *FormPanel

func (*FormPanel) SetPostHook added in v1.0.0

func (f *FormPanel) SetPostHook(fn FormPostFn) *FormPanel

func (*FormPanel) SetPostValidator added in v1.0.0

func (f *FormPanel) SetPostValidator(va FormPostFn) *FormPanel

func (*FormPanel) SetPreProcessFn added in v1.2.2

func (f *FormPanel) SetPreProcessFn(fn FormPreProcessFn) *FormPanel

func (*FormPanel) SetPrimaryKey added in v1.2.7

func (f *FormPanel) SetPrimaryKey(name string, typ db.DatabaseType) *FormPanel

func (*FormPanel) SetResponder added in v1.2.11

func (f *FormPanel) SetResponder(responder Responder) *FormPanel

func (*FormPanel) SetTabGroups added in v1.0.0

func (f *FormPanel) SetTabGroups(groups TabGroups) *FormPanel

func (*FormPanel) SetTabHeaders added in v1.0.0

func (f *FormPanel) SetTabHeaders(headers ...string) *FormPanel

func (*FormPanel) SetTable added in v1.0.0

func (f *FormPanel) SetTable(table string) *FormPanel

func (*FormPanel) SetTitle added in v1.0.0

func (f *FormPanel) SetTitle(title string) *FormPanel

func (*FormPanel) SetUpdateFn added in v1.1.0

func (f *FormPanel) SetUpdateFn(fn FormPostFn) *FormPanel

func (*FormPanel) SetWrapper added in v1.2.11

func (f *FormPanel) SetWrapper(wrapper ContentWrapper) *FormPanel

type FormPostFn added in v1.1.0

type FormPostFn func(values form.Values) error

type FormPreProcessFn added in v1.2.2

type FormPreProcessFn func(values form.Values) form.Values

type GetDataFn added in v1.2.0

type GetDataFn func(param parameter.Parameters) ([]map[string]interface{}, int)

type GetPanelFn added in v1.0.9

type GetPanelFn func(ctx interface{}) (Panel, error)

type GetPanelInfoFn added in v1.2.5

type GetPanelInfoFn func(ctx *context.Context) (Panel, error)

type GroupFieldHeaders added in v1.2.5

type GroupFieldHeaders []string

type GroupFormFields added in v1.2.5

type GroupFormFields []FormFields

type Handler added in v1.2.3

type Handler func(ctx *context.Context) (success bool, msg string, data interface{})

func (Handler) Wrap added in v1.2.3

func (h Handler) Wrap() context.Handler

type ImgAttribute

type ImgAttribute interface {
	SetWidth(value string) ImgAttribute
	SetHeight(value string) ImgAttribute
	WithModal() ImgAttribute
	SetSrc(value template.HTML) ImgAttribute
	GetContent() template.HTML
}

type InfoItem added in v1.2.4

type InfoItem struct {
	Content template.HTML `json:"content"`
	Value   string        `json:"value"`
}

type InfoList added in v1.2.4

type InfoList []map[string]InfoItem

func (InfoList) GroupBy added in v1.2.4

func (i InfoList) GroupBy(groups TabGroups) []InfoList

type InfoPanel

type InfoPanel struct {
	Ctx *context.Context

	FieldList FieldList

	Table       string
	Title       string
	Description string

	// Warn: may be deprecated future.
	TabGroups  TabGroups
	TabHeaders TabHeaders

	Sort      Sort
	SortField string

	PageSizeList    []int
	DefaultPageSize int

	ExportType      int
	ExportProcessFn ExportProcessFn

	IsHideNewButton    bool
	IsHideExportButton bool
	IsHideEditButton   bool
	IsHideDeleteButton bool
	IsHideDetailButton bool
	IsHideFilterButton bool
	IsHideRowSelector  bool
	IsHidePagination   bool
	IsHideFilterArea   bool
	IsHideQueryInfo    bool
	FilterFormLayout   form.Layout

	FilterFormHeadWidth  int
	FilterFormInputWidth int

	Wheres    Wheres
	WhereRaws WhereRaw

	Callbacks Callbacks

	Buttons Buttons

	TableLayout string

	DeleteHook  DeleteFn
	PreDeleteFn DeleteFn
	DeleteFn    DeleteFn

	DeleteHookWithRes DeleteFnWithRes

	GetDataFn GetDataFn

	ActionButtons    Buttons
	ActionButtonFold bool

	DisplayGeneratorRecords map[string]struct{}

	QueryFilterFn       QueryFilterFn
	UpdateParametersFns []UpdateParametersFn

	Wrapper ContentWrapper

	// column operation buttons
	Action     template.HTML
	HeaderHtml template.HTML
	FooterHtml template.HTML

	PageError     errors.PageError
	PageErrorHTML template.HTML

	NoCompress  bool
	HideSideBar bool

	AutoRefresh uint
	// contains filtered or unexported fields
}

InfoPanel

func NewInfoPanel added in v1.0.0

func NewInfoPanel(ctx *context.Context, pk string) *InfoPanel

func (*InfoPanel) AddActionButton added in v1.1.7

func (i *InfoPanel) AddActionButton(ctx *context.Context, title template.HTML, action Action, ids ...string) *InfoPanel

func (*InfoPanel) AddActionButtonFront added in v1.1.7

func (i *InfoPanel) AddActionButtonFront(ctx *context.Context, title template.HTML, action Action, ids ...string) *InfoPanel

func (*InfoPanel) AddActionIconButton added in v1.2.18

func (i *InfoPanel) AddActionIconButton(ctx *context.Context, icon string, action Action, ids ...string) *InfoPanel

func (*InfoPanel) AddButton added in v1.1.0

func (i *InfoPanel) AddButton(ctx *context.Context, title template.HTML, icon string, action Action, color ...template.HTML) *InfoPanel

func (*InfoPanel) AddButtonRaw added in v1.2.4

func (i *InfoPanel) AddButtonRaw(ctx *context.Context, btn Button, action Action) *InfoPanel

func (*InfoPanel) AddCSS added in v1.2.23

func (i *InfoPanel) AddCSS(css template.CSS) *InfoPanel

func (*InfoPanel) AddColumn added in v1.2.7

func (i *InfoPanel) AddColumn(head string, fun FieldFilterFn) *InfoPanel

func (*InfoPanel) AddColumnButtons added in v1.2.7

func (i *InfoPanel) AddColumnButtons(ctx *context.Context, head string, buttons ...Button) *InfoPanel

func (*InfoPanel) AddField added in v1.0.0

func (i *InfoPanel) AddField(head, field string, typeName db.DatabaseType) *InfoPanel

func (*InfoPanel) AddFieldTr added in v1.2.18

func (i *InfoPanel) AddFieldTr(ctx *context.Context, head, field string, typeName db.DatabaseType) *InfoPanel

func (*InfoPanel) AddFieldWithTranslation added in v1.2.18

func (i *InfoPanel) AddFieldWithTranslation(ctx *context.Context, head, field string, typeName db.DatabaseType) *InfoPanel

func (*InfoPanel) AddFilter added in v1.2.15

func (i *InfoPanel) AddFilter(head, field string, typeName db.DatabaseType, fn UpdateParametersFn, filterType ...FilterType) *InfoPanel

func (*InfoPanel) AddJS added in v1.2.23

func (i *InfoPanel) AddJS(js template.JS) *InfoPanel

func (*InfoPanel) AddJSModule added in v1.2.24

func (i *InfoPanel) AddJSModule(js template.JS) *InfoPanel

func (*InfoPanel) AddLimitFilter added in v1.0.9

func (i *InfoPanel) AddLimitFilter(limit int) *InfoPanel

func (*InfoPanel) AddSelectBox added in v1.2.4

func (i *InfoPanel) AddSelectBox(ctx *context.Context, placeholder string, options FieldOptions, action Action, width ...int) *InfoPanel

func (*InfoPanel) AddSubstrFilter added in v1.0.9

func (i *InfoPanel) AddSubstrFilter(start int, end int) *InfoPanel

func (*InfoPanel) AddToLowerFilter added in v1.0.9

func (i *InfoPanel) AddToLowerFilter() *InfoPanel

func (*InfoPanel) AddToTitleFilter added in v1.0.9

func (i *InfoPanel) AddToTitleFilter() *InfoPanel

func (*InfoPanel) AddToUpperFilter added in v1.0.9

func (i *InfoPanel) AddToUpperFilter() *InfoPanel

func (*InfoPanel) AddTrimSpaceFilter added in v1.0.9

func (i *InfoPanel) AddTrimSpaceFilter() *InfoPanel

func (*InfoPanel) AddUpdateParametersFn added in v1.2.15

func (i *InfoPanel) AddUpdateParametersFn(fn UpdateParametersFn) *InfoPanel

func (*InfoPanel) AddXssFilter added in v1.0.9

func (i *InfoPanel) AddXssFilter() *InfoPanel

func (*InfoPanel) AddXssJsFilter added in v1.0.9

func (i *InfoPanel) AddXssJsFilter() *InfoPanel

func (*InfoPanel) ExportValue added in v1.2.4

func (i *InfoPanel) ExportValue() *InfoPanel

func (*InfoPanel) FieldAsDeleteParam added in v1.2.18

func (i *InfoPanel) FieldAsDeleteParam() *InfoPanel

func (*InfoPanel) FieldAsDetailParam added in v1.2.18

func (i *InfoPanel) FieldAsDetailParam() *InfoPanel

func (*InfoPanel) FieldAsEditParam added in v1.2.18

func (i *InfoPanel) FieldAsEditParam() *InfoPanel

func (*InfoPanel) FieldBool added in v1.2.11

func (i *InfoPanel) FieldBool(flags ...string) *InfoPanel

func (*InfoPanel) FieldCarousel added in v1.2.11

func (i *InfoPanel) FieldCarousel(fn FieldGetImgArrFn, size ...int) *InfoPanel

func (*InfoPanel) FieldCopyable added in v1.2.11

func (i *InfoPanel) FieldCopyable(prefix ...string) *InfoPanel

func (*InfoPanel) FieldDate added in v1.2.11

func (i *InfoPanel) FieldDate(format string) *InfoPanel

func (*InfoPanel) FieldDisplay added in v1.0.0

func (i *InfoPanel) FieldDisplay(filter FieldFilterFn) *InfoPanel

func (*InfoPanel) FieldDot added in v1.2.11

func (i *InfoPanel) FieldDot(icons map[string]FieldDotColor, defaultDot FieldDotColor) *InfoPanel

func (*InfoPanel) FieldDownLoadable added in v1.2.11

func (i *InfoPanel) FieldDownLoadable(prefix ...string) *InfoPanel

func (*InfoPanel) FieldEditAble added in v1.0.8

func (i *InfoPanel) FieldEditAble(editType ...table.Type) *InfoPanel

func (*InfoPanel) FieldEditOptions added in v1.0.8

func (i *InfoPanel) FieldEditOptions(options FieldOptions, extra ...map[string]string) *InfoPanel

func (*InfoPanel) FieldFileSize added in v1.2.11

func (i *InfoPanel) FieldFileSize() *InfoPanel

func (*InfoPanel) FieldFilterOnChoose added in v1.2.5

func (i *InfoPanel) FieldFilterOnChoose(val, field string, value template.HTML) *InfoPanel

FieldFilterOnChoose set the given value of the given field when choose the value of val.

func (*InfoPanel) FieldFilterOnChooseAjax added in v1.2.5

func (i *InfoPanel) FieldFilterOnChooseAjax(field, url string, handler Handler) *InfoPanel

FieldFilterOnChooseAjax set the url and handler that will be called when field be choosed. The handler will return the option of the field. It will help to link two or more form items. For example:

FieldFilterOnChooseAjax("city", "/search/city", func(ctx *context.Context) (success bool, msg string, data interface{}) {
	return true, "ok", selection.Data{
		Results: selection.Options{
			{Text: "GuangZhou", ID: "1"},
			{Text: "ShenZhen", ID: "2"},
			{Text: "BeiJing", ID: "3"},
			{Text: "ShangHai", ID: "4"},
		}
	}
})

When you choose the country, it trigger the action of ajax which be sent to the given handler, and return the city options to the field city.

func (*InfoPanel) FieldFilterOnChooseCustom added in v1.2.5

func (i *InfoPanel) FieldFilterOnChooseCustom(js template.HTML) *InfoPanel

FieldFilterOnChooseCustom set the js that will be called when filter option be selected.

func (*InfoPanel) FieldFilterOnChooseDisable added in v1.2.5

func (i *InfoPanel) FieldFilterOnChooseDisable(value string, field ...string) *InfoPanel

FieldFilterOnChooseDisable disable the fields when value to be chosen.

func (*InfoPanel) FieldFilterOnChooseHide added in v1.2.5

func (i *InfoPanel) FieldFilterOnChooseHide(value string, field ...string) *InfoPanel

FieldFilterOnChooseHide hide the fields when value to be chosen.

func (*InfoPanel) FieldFilterOnChooseMap added in v1.2.5

func (i *InfoPanel) FieldFilterOnChooseMap(m map[string]LinkField) *InfoPanel

FieldFilterOnChooseMap set the actions that will be taken when filter option be selected. For example:

map[string]types.LinkField{
     "men": {Field: "ip", Value:"127.0.0.1"},
     "women": {Field: "ip", Hide: true},
     "other": {Field: "ip", Disable: true}
}

mean when choose men, the value of field ip will be set to 127.0.0.1, when choose women, field ip will be hidden, and when choose other, field ip will be disabled.

func (*InfoPanel) FieldFilterOnChooseShow added in v1.2.9

func (i *InfoPanel) FieldFilterOnChooseShow(value string, field ...string) *InfoPanel

FieldFilterOnChooseShow display the fields when value to be chosen.

func (*InfoPanel) FieldFilterOnSearch added in v1.2.5

func (i *InfoPanel) FieldFilterOnSearch(url string, handler Handler, delay ...int) *InfoPanel

FieldFilterOnSearch set the url and the corresponding handler which has some backend logic and return the options of the field. For example:

FieldFilterOnSearch("/search/city", func(ctx *context.Context) (success bool, msg string, data interface{}) {
	return true, "ok", selection.Data{
		Results: selection.Options{
			{Text: "GuangZhou", ID: "1"},
			{Text: "ShenZhen", ID: "2"},
			{Text: "BeiJing", ID: "3"},
			{Text: "ShangHai", ID: "4"},
		}
	}
}, 1000)

func (*InfoPanel) FieldFilterOptionExt added in v1.1.2

func (i *InfoPanel) FieldFilterOptionExt(m map[string]interface{}) *InfoPanel

FieldFilterOptionExt set the option extension js of the field.

func (*InfoPanel) FieldFilterOptions added in v1.1.2

func (i *InfoPanel) FieldFilterOptions(options FieldOptions) *InfoPanel

FieldFilterOptions set options for a filterable field to select. It will work when you set the FormType of the field to SelectSingle/Select/SelectBox.

func (*InfoPanel) FieldFilterOptionsFromTable added in v1.2.8

func (i *InfoPanel) FieldFilterOptionsFromTable(table, textFieldName, valueFieldName string, process ...OptionTableQueryProcessFn) *InfoPanel

FieldFilterOptionsFromTable set options for a filterable field to select. The options is from other table. For example,

`FieldFilterOptionsFromTable("roles", "name", "id")`

will generate the sql like:

`select id, name from roles`.

And the `id` will be the value of options, `name` is the text to be shown.

func (*InfoPanel) FieldFilterProcess added in v1.2.0

func (i *InfoPanel) FieldFilterProcess(process func(string) string) *InfoPanel

FieldFilterProcess process the field content. For example:

FieldFilterProcess(func(val string) string {
		return val + "ms"
})

func (*InfoPanel) FieldFilterable added in v1.0.0

func (i *InfoPanel) FieldFilterable(filterType ...FilterType) *InfoPanel

FieldFilterable set a field filterable which will display in the filter box.

func (*InfoPanel) FieldFixed added in v1.0.0

func (i *InfoPanel) FieldFixed() *InfoPanel

func (*InfoPanel) FieldHide added in v1.0.0

func (i *InfoPanel) FieldHide() *InfoPanel

FieldHide hide field. Include the filter area.

func (*InfoPanel) FieldHideForList added in v1.2.24

func (i *InfoPanel) FieldHideForList() *InfoPanel

FieldHide hide field for only the table.

func (*InfoPanel) FieldIcon added in v1.2.11

func (i *InfoPanel) FieldIcon(icons map[string]string, defaultIcon string) *InfoPanel

func (*InfoPanel) FieldImage added in v1.2.9

func (i *InfoPanel) FieldImage(width, height string, prefix ...string) *InfoPanel

func (*InfoPanel) FieldJoin added in v1.0.0

func (i *InfoPanel) FieldJoin(join Join) *InfoPanel

FieldJoin gets the field of the concatenated table.

Join {
    BaseTable:   "users",
    Field:       "role_id",
    Table:       "roles",
    JoinField:   "id",
}

It will generate the join table sql like:

select ... from users left join roles on roles.id = users.role_id

func (*InfoPanel) FieldLabel added in v1.2.9

func (i *InfoPanel) FieldLabel(args ...FieldLabelParam) *InfoPanel

func (*InfoPanel) FieldLimit added in v1.0.0

func (i *InfoPanel) FieldLimit(limit int) *InfoPanel

FieldLimit limit the field length.

func (i *InfoPanel) FieldLink(src string, openInNewTab ...bool) *InfoPanel

func (*InfoPanel) FieldLoading added in v1.2.11

func (i *InfoPanel) FieldLoading(data []string) *InfoPanel

func (*InfoPanel) FieldProgressBar added in v1.2.11

func (i *InfoPanel) FieldProgressBar(data ...FieldProgressBarData) *InfoPanel

func (*InfoPanel) FieldQrcode added in v1.2.11

func (i *InfoPanel) FieldQrcode() *InfoPanel

func (*InfoPanel) FieldSortable added in v1.0.0

func (i *InfoPanel) FieldSortable() *InfoPanel

func (*InfoPanel) FieldSubstr added in v1.0.0

func (i *InfoPanel) FieldSubstr(start int, end int) *InfoPanel

FieldSubstr intercept string of the field.

func (*InfoPanel) FieldToLower added in v1.0.0

func (i *InfoPanel) FieldToLower() *InfoPanel

FieldToLower update the field to a string with all Unicode letters mapped to their lower case.

func (*InfoPanel) FieldToTitle added in v1.0.0

func (i *InfoPanel) FieldToTitle() *InfoPanel

FieldToTitle update the field to a string that begin words mapped to their Unicode title case.

func (*InfoPanel) FieldToUpper added in v1.0.0

func (i *InfoPanel) FieldToUpper() *InfoPanel

FieldToUpper update the field to a string with all Unicode letters mapped to their upper case.

func (*InfoPanel) FieldTrimSpace added in v1.0.0

func (i *InfoPanel) FieldTrimSpace() *InfoPanel

FieldTrimSpace trim space of the field.

func (*InfoPanel) FieldWidth added in v1.0.0

func (i *InfoPanel) FieldWidth(width int) *InfoPanel

func (*InfoPanel) FieldXssFilter added in v1.0.7

func (i *InfoPanel) FieldXssFilter() *InfoPanel

FieldXssFilter escape field with html.Escape.

func (*InfoPanel) GetPageSizeList added in v1.0.8

func (i *InfoPanel) GetPageSizeList() []string

func (*InfoPanel) GetSort added in v1.0.8

func (i *InfoPanel) GetSort() string

func (*InfoPanel) HasError added in v1.2.15

func (i *InfoPanel) HasError() bool

func (*InfoPanel) HideCheckBoxColumn added in v1.2.23

func (i *InfoPanel) HideCheckBoxColumn() *InfoPanel

func (*InfoPanel) HideColumn added in v1.2.23

func (i *InfoPanel) HideColumn(n int) *InfoPanel

func (*InfoPanel) HideDeleteButton added in v1.0.2

func (i *InfoPanel) HideDeleteButton() *InfoPanel

func (*InfoPanel) HideDetailButton added in v1.1.7

func (i *InfoPanel) HideDetailButton() *InfoPanel

func (*InfoPanel) HideEditButton added in v1.0.2

func (i *InfoPanel) HideEditButton() *InfoPanel

func (*InfoPanel) HideExportButton added in v1.0.2

func (i *InfoPanel) HideExportButton() *InfoPanel

func (*InfoPanel) HideFilterArea added in v1.1.4

func (i *InfoPanel) HideFilterArea() *InfoPanel

func (*InfoPanel) HideFilterButton added in v1.0.2

func (i *InfoPanel) HideFilterButton() *InfoPanel

func (*InfoPanel) HideNewButton added in v1.0.2

func (i *InfoPanel) HideNewButton() *InfoPanel

func (*InfoPanel) HidePagination added in v1.0.2

func (i *InfoPanel) HidePagination() *InfoPanel

func (*InfoPanel) HideQueryInfo added in v1.2.11

func (i *InfoPanel) HideQueryInfo() *InfoPanel

func (*InfoPanel) HideRowSelector added in v1.0.2

func (i *InfoPanel) HideRowSelector() *InfoPanel

func (*InfoPanel) IsExportValue added in v1.2.4

func (i *InfoPanel) IsExportValue() bool

func (*InfoPanel) OperationURL added in v1.2.18

func (i *InfoPanel) OperationURL(id string) string

OperationURL get the operation api url.

func (*InfoPanel) Set400Error added in v1.2.15

func (i *InfoPanel) Set400Error(content ...template.HTML) *InfoPanel

func (*InfoPanel) Set403Error added in v1.2.15

func (i *InfoPanel) Set403Error(content ...template.HTML) *InfoPanel

func (*InfoPanel) Set404Error added in v1.2.15

func (i *InfoPanel) Set404Error(content ...template.HTML) *InfoPanel

func (*InfoPanel) Set500Error added in v1.2.15

func (i *InfoPanel) Set500Error(content ...template.HTML) *InfoPanel

func (*InfoPanel) SetAction added in v1.0.0

func (i *InfoPanel) SetAction(action template.HTML) *InfoPanel

func (*InfoPanel) SetActionButtonFold added in v1.2.18

func (i *InfoPanel) SetActionButtonFold() *InfoPanel

func (*InfoPanel) SetAutoRefresh added in v1.2.15

func (i *InfoPanel) SetAutoRefresh(interval uint) *InfoPanel

func (*InfoPanel) SetDefaultPageSize added in v1.0.8

func (i *InfoPanel) SetDefaultPageSize(defaultPageSize int) *InfoPanel

func (*InfoPanel) SetDeleteFn added in v1.1.0

func (i *InfoPanel) SetDeleteFn(fn DeleteFn) *InfoPanel

func (*InfoPanel) SetDeleteHook added in v1.1.0

func (i *InfoPanel) SetDeleteHook(fn DeleteFn) *InfoPanel

func (*InfoPanel) SetDeleteHookWithRes added in v1.2.8

func (i *InfoPanel) SetDeleteHookWithRes(fn DeleteFnWithRes) *InfoPanel

func (*InfoPanel) SetDescription added in v1.0.0

func (i *InfoPanel) SetDescription(desc string) *InfoPanel

func (*InfoPanel) SetError added in v1.2.15

func (i *InfoPanel) SetError(err errors.PageError, content ...template.HTML) *InfoPanel

func (*InfoPanel) SetExportProcessFn added in v1.2.15

func (i *InfoPanel) SetExportProcessFn(fn ExportProcessFn) *InfoPanel

func (*InfoPanel) SetFilterFormHeadWidth added in v1.2.8

func (i *InfoPanel) SetFilterFormHeadWidth(w int) *InfoPanel

func (*InfoPanel) SetFilterFormInputWidth added in v1.2.8

func (i *InfoPanel) SetFilterFormInputWidth(w int) *InfoPanel

func (*InfoPanel) SetFilterFormLayout added in v1.1.4

func (i *InfoPanel) SetFilterFormLayout(layout form.Layout) *InfoPanel

func (*InfoPanel) SetFooterHtml added in v1.0.0

func (i *InfoPanel) SetFooterHtml(footer template.HTML) *InfoPanel

func (*InfoPanel) SetGetDataFn added in v1.2.0

func (i *InfoPanel) SetGetDataFn(fn GetDataFn) *InfoPanel

func (*InfoPanel) SetHeaderHtml added in v1.0.0

func (i *InfoPanel) SetHeaderHtml(header template.HTML) *InfoPanel

func (*InfoPanel) SetHideSideBar added in v1.2.17

func (i *InfoPanel) SetHideSideBar() *InfoPanel

func (*InfoPanel) SetNoCompress added in v1.2.17

func (i *InfoPanel) SetNoCompress() *InfoPanel

func (*InfoPanel) SetPageSizeList added in v1.0.8

func (i *InfoPanel) SetPageSizeList(pageSizeList []int) *InfoPanel

func (*InfoPanel) SetPreDeleteFn added in v1.1.0

func (i *InfoPanel) SetPreDeleteFn(fn DeleteFn) *InfoPanel

func (*InfoPanel) SetPrimaryKey added in v1.2.7

func (i *InfoPanel) SetPrimaryKey(name string, typ db.DatabaseType) *InfoPanel

func (*InfoPanel) SetQueryFilterFn added in v1.2.10

func (i *InfoPanel) SetQueryFilterFn(fn QueryFilterFn) *InfoPanel

func (*InfoPanel) SetSortAsc added in v1.0.8

func (i *InfoPanel) SetSortAsc() *InfoPanel

func (*InfoPanel) SetSortDesc added in v1.0.8

func (i *InfoPanel) SetSortDesc() *InfoPanel

func (*InfoPanel) SetSortField added in v1.2.0

func (i *InfoPanel) SetSortField(field string) *InfoPanel

func (*InfoPanel) SetTabGroups added in v1.0.0

func (i *InfoPanel) SetTabGroups(groups TabGroups) *InfoPanel

func (*InfoPanel) SetTabHeaders added in v1.0.0

func (i *InfoPanel) SetTabHeaders(headers ...string) *InfoPanel

func (*InfoPanel) SetTable added in v1.0.0

func (i *InfoPanel) SetTable(table string) *InfoPanel

func (*InfoPanel) SetTableFixed added in v1.2.0

func (i *InfoPanel) SetTableFixed() *InfoPanel

func (*InfoPanel) SetTitle added in v1.0.0

func (i *InfoPanel) SetTitle(title string) *InfoPanel

func (*InfoPanel) SetWrapper added in v1.2.11

func (i *InfoPanel) SetWrapper(wrapper ContentWrapper) *InfoPanel

func (*InfoPanel) Where added in v1.1.4

func (i *InfoPanel) Where(field string, operator string, arg interface{}) *InfoPanel

func (*InfoPanel) WhereOr added in v1.2.0

func (i *InfoPanel) WhereOr(field string, operator string, arg interface{}) *InfoPanel

func (*InfoPanel) WhereRaw added in v1.2.0

func (i *InfoPanel) WhereRaw(raw string, arg ...interface{}) *InfoPanel

type Join added in v1.0.0

type Join struct {
	Table      string
	TableAlias string
	Field      string
	JoinField  string
	BaseTable  string
}

Join store join table info. For example:

Join {
    BaseTable:   "users",
    Field:       "role_id",
    Table:       "roles",
    JoinField:   "id",
}

It will generate the join table sql like:

... left join roles on roles.id = users.role_id ...

func (Join) GetTableName added in v1.2.15

func (j Join) GetTableName(delimiter ...string) string

func (Join) Valid added in v1.0.0

func (j Join) Valid() bool

type Joins added in v1.2.10

type Joins []Join

func (Joins) Last added in v1.2.10

func (j Joins) Last() Join

func (Joins) Valid added in v1.2.10

func (j Joins) Valid() bool

type LabelAttribute

type LabelAttribute interface {
	SetContent(value template.HTML) LabelAttribute
	SetColor(value template.HTML) LabelAttribute
	SetType(value string) LabelAttribute
	GetContent() template.HTML
}

type LinkAttribute added in v1.1.8

type LinkAttribute interface {
	OpenInNewTab() LinkAttribute
	SetURL(value string) LinkAttribute
	SetAttributes(attr template.HTMLAttr) LinkAttribute
	SetClass(class template.HTML) LinkAttribute
	NoPjax() LinkAttribute
	SetTabTitle(value template.HTML) LinkAttribute
	SetContent(value template.HTML) LinkAttribute
	GetContent() template.HTML
}

type LinkField added in v1.2.3

type LinkField struct {
	Field   string
	Value   template.HTML
	Hide    bool
	Disable bool
}
type NavButton struct {
	*BaseButton
	Icon string
}

func GetNavButton added in v1.2.7

func GetNavButton(title template.HTML, icon string, action Action, names ...string) *NavButton
func (n *NavButton) Content(ctx *context.Context) (template.HTML, template.JS)
type NavDropDownButton struct {
	*BaseButton
	Icon  string
	Items []*NavDropDownItemButton
}

func GetDropDownButton added in v1.2.15

func GetDropDownButton(title template.HTML, icon string, items []*NavDropDownItemButton, names ...string) *NavDropDownButton
func (n *NavDropDownButton) AddItem(item *NavDropDownItemButton)
func (n *NavDropDownButton) SetItems(items []*NavDropDownItemButton)
type NavDropDownItemButton struct {
	*BaseButton
}

func GetDropDownItemButton added in v1.2.15

func GetDropDownItemButton(title template.HTML, action Action, names ...string) *NavDropDownItemButton

type NewPageParam added in v1.2.7

type NewPageParam struct {
	User           models.UserModel
	Menu           *menu.Menu
	UpdateMenu     bool
	Panel          Panel
	Assets         template.HTML
	Buttons        Buttons
	Iframe         bool
	TmplHeadHTML   template.HTML
	TmplFootJS     template.HTML
	NavButtonsHTML template.HTML
	NavButtonsJS   template.HTML
}

func (*NewPageParam) NavButtonsAndJS added in v1.2.7

func (param *NewPageParam) NavButtonsAndJS(ctx *context.Context) (template.HTML, template.HTML)

type NilAction added in v1.2.18

type NilAction struct{}

func (*NilAction) BtnAttribute added in v1.2.18

func (def *NilAction) BtnAttribute() template.HTML

func (*NilAction) BtnClass added in v1.2.18

func (def *NilAction) BtnClass() template.HTML

func (*NilAction) ExtContent added in v1.2.18

func (def *NilAction) ExtContent(ctx *context.Context) template.HTML

func (*NilAction) FooterContent added in v1.2.18

func (def *NilAction) FooterContent(ctx *context.Context) template.HTML

func (*NilAction) GetCallbacks added in v1.2.18

func (def *NilAction) GetCallbacks() context.Node

func (*NilAction) Js added in v1.2.18

func (def *NilAction) Js() template.JS

func (*NilAction) SetBtnData added in v1.2.18

func (def *NilAction) SetBtnData(data interface{})

func (*NilAction) SetBtnId added in v1.2.18

func (def *NilAction) SetBtnId(btnId string)

type OptionArrInitFn added in v1.2.11

type OptionArrInitFn func(val FieldModel) []FieldOptions

type OptionInitFn added in v1.2.3

type OptionInitFn func(val FieldModel) FieldOptions

type OptionProcessFn added in v1.2.5

type OptionProcessFn func(options FieldOptions) FieldOptions

type OptionTable added in v1.2.5

type OptionTable struct {
	Table          string
	TextField      string
	ValueField     string
	QueryProcessFn OptionTableQueryProcessFn
	ProcessFn      OptionProcessFn
}

type OptionTableQueryProcessFn added in v1.2.5

type OptionTableQueryProcessFn func(sql *db.SQL) *db.SQL

type Page

type Page struct {
	// User is the login user.
	User models.UserModel

	// Menu is the left side menu of the template.
	Menu menu.Menu

	// Panel is the main content of template.
	Panel Panel

	// System contains some system info.
	System SystemInfo

	// UrlPrefix is the prefix of url.
	UrlPrefix string

	// Title is the title of the web page.
	Title string

	Logo template.HTML

	MiniLogo template.HTML

	// ColorScheme is the color scheme of the template.
	ColorScheme string

	// IndexUrl is the home page url of the site.
	IndexUrl string

	// AssetUrl is the cdn link of assets
	CdnUrl string

	// Custom html in the tag head.
	CustomHeadHtml template.HTML

	// Custom html after body.
	CustomFootHtml template.HTML

	TmplHeadHTML template.HTML
	TmplFootJS   template.HTML

	// Components assets
	AssetsList template.HTML

	// Footer info
	FooterInfo template.HTML

	// Load as Iframe or not
	Iframe bool

	// Whether update menu or not
	UpdateMenu bool

	NavButtonsHTML template.HTML
	// contains filtered or unexported fields
}

Page used in the template as a top variable.

func NewPage added in v1.0.0

func NewPage(ctx *context.Context, param *NewPageParam) *Page

func NewPagePanel added in v1.2.5

func NewPagePanel(panel Panel) *Page

func (*Page) AddButton added in v1.2.7

func (page *Page) AddButton(ctx *context.Context, title template.HTML, icon string, action Action) *Page

type PaginatorAttribute

type PaginatorAttribute interface {
	SetCurPageStartIndex(value string) PaginatorAttribute
	SetCurPageEndIndex(value string) PaginatorAttribute
	SetTotal(value string) PaginatorAttribute
	SetPreviousClass(value string) PaginatorAttribute
	SetPreviousUrl(value string) PaginatorAttribute
	SetPages(value []map[string]string) PaginatorAttribute
	SetPageSizeList(value []string) PaginatorAttribute
	SetNextClass(value string) PaginatorAttribute
	SetNextUrl(value string) PaginatorAttribute
	SetOption(value map[string]template.HTML) PaginatorAttribute
	SetUrl(value string) PaginatorAttribute
	SetExtraInfo(value template.HTML) PaginatorAttribute
	SetEntriesInfo(value template.HTML) PaginatorAttribute
	GetContent() template.HTML
}

type Panel

type Panel struct {
	Title       template.HTML
	Description template.HTML
	Content     template.HTML

	CSS template.CSS
	JS  template.JS
	Url string

	// Whether to toggle the sidebar
	MiniSidebar bool

	// Auto refresh page switch.
	AutoRefresh bool
	// Refresh page intervals, the unit is second.
	RefreshInterval []int

	Callbacks Callbacks
}

Panel contains the main content of the template which used as pjax.

func (Panel) AddComponent added in v1.2.16

func (p Panel) AddComponent(comp Component) Panel

func (Panel) AddJS added in v1.2.15

func (p Panel) AddJS(js template.JS) Panel

func (Panel) GetContent added in v1.2.0

func (p Panel) GetContent(params ...bool) Panel

type PanelInfo added in v1.2.15

type PanelInfo struct {
	Thead    Thead    `json:"thead"`
	InfoList InfoList `json:"info_list"`
}

type PopupAttribute added in v1.0.0

type PopupAttribute interface {
	SetID(value string) PopupAttribute
	SetTitle(value template.HTML) PopupAttribute
	SetDraggable() PopupAttribute
	SetHideFooter() PopupAttribute
	SetWidth(width string) PopupAttribute
	SetHeight(height string) PopupAttribute
	SetFooter(value template.HTML) PopupAttribute
	SetFooterHTML(value template.HTML) PopupAttribute
	SetBody(value template.HTML) PopupAttribute
	SetSize(value string) PopupAttribute
	GetContent() template.HTML
}

type PostFieldFilterFn added in v1.0.0

type PostFieldFilterFn func(value PostFieldModel) interface{}

PostFieldFilterFn is filter function of data.

type PostFieldModel added in v1.0.0

type PostFieldModel struct {
	ID    string
	Value FieldModelValue
	Row   map[string]string
	// Post type
	PostType PostType
}

PostFieldModel contains ID and value of the single query result and the current row data.

func (PostFieldModel) IsCreate added in v1.2.14

func (m PostFieldModel) IsCreate() bool

func (PostFieldModel) IsUpdate added in v1.2.14

func (m PostFieldModel) IsUpdate() bool

type PostType added in v1.2.14

type PostType uint8

type QueryFilterFn added in v1.2.10

type QueryFilterFn func(param parameter.Parameters, conn db.Connection) (ids []string, stopQuery bool)

type Responder added in v1.2.11

type Responder func(ctx *context.Context)

type RowAttribute

type RowAttribute interface {
	SetContent(value template.HTML) RowAttribute
	AddContent(value template.HTML) RowAttribute
	GetContent() template.HTML
}

type S added in v1.2.2

type S map[string]string

func Size added in v1.2.2

func Size(sm, md, lg int) S

func SizeLG added in v1.2.2

func SizeLG(lg int) S

func SizeMD added in v1.2.2

func SizeMD(md int) S

func SizeSM added in v1.2.2

func SizeSM(sm int) S

func SizeXL added in v1.2.2

func SizeXL(xl int) S

func SizeXS added in v1.2.2

func SizeXS(xs int) S

func (S) LG added in v1.2.2

func (s S) LG(lg int) S

func (S) MD added in v1.2.2

func (s S) MD(md int) S

func (S) SM added in v1.2.2

func (s S) SM(sm int) S

func (S) XL added in v1.2.2

func (s S) XL(xl int) S

func (S) XS added in v1.2.2

func (s S) XS(xs int) S

type Sort added in v1.0.0

type Sort uint8
const (
	SortDesc Sort = iota
	SortAsc
)

type SystemInfo

type SystemInfo struct {
	Version string
	Theme   string
}

SystemInfo contains basic info of system.

type TabGroups added in v1.0.0

type TabGroups [][]string

func NewTabGroups added in v1.0.0

func NewTabGroups(items ...string) TabGroups

func (TabGroups) AddGroup added in v1.0.0

func (t TabGroups) AddGroup(items ...string) TabGroups

func (TabGroups) Valid added in v1.0.0

func (t TabGroups) Valid() bool

type TabHeaders added in v1.0.0

type TabHeaders []string

func (TabHeaders) Add added in v1.0.0

func (t TabHeaders) Add(header string) TabHeaders

type TableAttribute

type TableAttribute interface {
	SetThead(value Thead) TableAttribute
	SetInfoList(value []map[string]InfoItem) TableAttribute
	SetType(value string) TableAttribute
	SetName(name string) TableAttribute
	SetMinWidth(value string) TableAttribute
	SetHideThead() TableAttribute
	SetSticky(sticky bool) TableAttribute
	SetLayout(value string) TableAttribute
	SetStyle(style string) TableAttribute
	GetContent() template.HTML
}

type TableInfo added in v1.2.3

type TableInfo struct {
	Table      string
	PrimaryKey string
	Delimiter  string
	Delimiter2 string
	Driver     string
}

type TableRowData added in v1.2.7

type TableRowData struct {
	Id    template.HTML
	Ids   template.HTML
	Value map[string]InfoItem
}

type TabsAttribute

type TabsAttribute interface {
	SetData(value []map[string]template.HTML) TabsAttribute
	GetContent() template.HTML
}

type Thead added in v1.2.4

type Thead []TheadItem

func (Thead) GroupBy added in v1.2.4

func (t Thead) GroupBy(group [][]string) []Thead

type TheadItem added in v1.2.4

type TheadItem struct {
	Head       string       `json:"head"`
	Sortable   bool         `json:"sortable"`
	Field      string       `json:"field"`
	Hide       bool         `json:"hide"`
	Editable   bool         `json:"editable"`
	EditType   string       `json:"edit_type"`
	EditOption FieldOptions `json:"edit_option"`
	Width      string       `json:"width"`
}

type TreeAttribute

type TreeAttribute interface {
	SetTree(value []menu.Item) TreeAttribute
	SetEditUrl(value string) TreeAttribute
	SetOrderUrl(value string) TreeAttribute
	SetUrlPrefix(value string) TreeAttribute
	SetDeleteUrl(value string) TreeAttribute
	GetContent() template.HTML
	GetTreeHeader() template.HTML
}

type TreeViewAttribute added in v1.2.11

type TreeViewAttribute interface {
	SetTree(value TreeViewData) TreeViewAttribute
	SetUrlPrefix(value string) TreeViewAttribute
	SetID(id string) TreeViewAttribute
	GetContent() template.HTML
}

type TreeViewData added in v1.2.11

type TreeViewData struct {
	Data              TreeViewItems `json:"data,omitempty"`
	Levels            int           `json:"levels,omitempty"`
	BackColor         string        `json:"backColor,omitempty"`
	BorderColor       string        `json:"borderColor,omitempty"`
	CheckedIcon       string        `json:"checkedIcon,omitempty"`
	CollapseIcon      string        `json:"collapseIcon,omitempty"`
	Color             string        `json:"color,omitempty"`
	EmptyIcon         string        `json:"emptyIcon,omitempty"`
	EnableLinks       bool          `json:"enableLinks,omitempty"`
	ExpandIcon        string        `json:"expandIcon,omitempty"`
	MultiSelect       bool          `json:"multiSelect,omitempty"`
	NodeIcon          string        `json:"nodeIcon,omitempty"`
	OnhoverColor      string        `json:"onhoverColor,omitempty"`
	SelectedIcon      string        `json:"selectedIcon,omitempty"`
	SearchResultColor string        `json:"searchResultColor,omitempty"`
	SelectedBackColor string        `json:"selectedBackColor,omitempty"`
	SelectedColor     string        `json:"selectedColor,omitempty"`
	ShowBorder        bool          `json:"showBorder,omitempty"`
	ShowCheckbox      bool          `json:"showCheckbox,omitempty"`
	ShowIcon          bool          `json:"showIcon,omitempty"`
	ShowTags          bool          `json:"showTags,omitempty"`
	UncheckedIcon     string        `json:"uncheckedIcon,omitempty"`

	SearchResultBackColor  string `json:"searchResultBackColor,omitempty"`
	HighlightSearchResults bool   `json:"highlightSearchResults,omitempty"`
}

type TreeViewItem added in v1.2.11

type TreeViewItem struct {
	Text         string            `json:"text,omitempty"`
	Icon         string            `json:"icon,omitempty"`
	SelectedIcon string            `json:"selected_icon,omitempty"`
	Color        string            `json:"color,omitempty"`
	BackColor    string            `json:"backColor,omitempty"`
	Href         string            `json:"href,omitempty"`
	Selectable   bool              `json:"selectable,omitempty"`
	State        TreeViewItemState `json:"state,omitempty"`
	Tags         []string          `json:"tags,omitempty"`
	Nodes        TreeViewItems     `json:"nodes,omitempty"`
}

type TreeViewItemState added in v1.2.11

type TreeViewItemState struct {
	Checked  bool `json:"checked,omitempty"`
	Disabled bool `json:"disabled,omitempty"`
	Expanded bool `json:"expanded,omitempty"`
	Selected bool `json:"selected,omitempty"`
}

type TreeViewItems added in v1.2.11

type TreeViewItems []TreeViewItem

type UpdateParametersFn added in v1.2.15

type UpdateParametersFn func(param *parameter.Parameters)

type Where added in v1.1.4

type Where struct {
	Join     string
	Field    string
	Operator string
	Arg      interface{}
}

type WhereRaw added in v1.2.0

type WhereRaw struct {
	Raw  string
	Args []interface{}
}

func (WhereRaw) Statement added in v1.2.3

func (wh WhereRaw) Statement(wheres string, whereArgs []interface{}) (string, []interface{})

type Wheres added in v1.2.3

type Wheres []Where

func (Wheres) Statement added in v1.2.3

func (whs Wheres) Statement(wheres, delimiter, delimiter2 string, whereArgs []interface{}, existKeys, columns []string) (string, []interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL