types

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: Apache-2.0 Imports: 24 Imported by: 398

Documentation

Index

Constants

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 DisplayProcessFn)

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

Types

type Action added in v1.1.0

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

type ActionButton added in v1.1.7

type ActionButton struct {
	Id     string
	Title  template.HTML
	Action Action
}

func (ActionButton) Content added in v1.1.7

func (b ActionButton) Content() (template.HTML, template.JS)

type AlertAttribute

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

type Attribute

type Attribute struct {
	TemplateList map[string]string
}

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

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
	SetStyle(value template.HTMLAttr) BoxAttribute
	SetHeadColor(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() (template.HTML, template.JS)
}

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
	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) Content added in v1.1.0

func (b Buttons) Content() (template.HTML, template.JS)

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 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
	SetAction(action template.HTML) DataTableAttribute
	SetIsTab(value bool) DataTableAttribute
	SetLayout(value string) DataTableAttribute
	SetButtons(btns template.HTML) DataTableAttribute
	SetHideFilterArea(value bool) DataTableAttribute
	SetHideRowSelector(value bool) DataTableAttribute
	SetActionJs(aj template.JS) DataTableAttribute
	SetInfoUrl(value string) DataTableAttribute
	SetDetailUrl(value string) DataTableAttribute
	SetHasFilter(hasFilter bool) 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() template.HTML

func (*DefaultAction) FooterContent added in v1.2.6

func (def *DefaultAction) FooterContent() 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 {
	Id        string
	Title     template.HTML
	Color     template.HTML
	TextColor template.HTML
	Action    Action
	Icon      string
}

func (DefaultButton) Content added in v1.1.7

func (b DefaultButton) Content() (template.HTML, template.JS)

type DefaultSelection added in v1.2.4

type DefaultSelection struct {
	Id          string
	Options     FieldOptions
	Placeholder string
	Width       int
	Action      Action
}

func (DefaultSelection) Content added in v1.2.4

func (b DefaultSelection) Content() (template.HTML, template.JS)

type DeleteFn added in v1.1.0

type DeleteFn func(ids []string) error

type DisplayProcessFn added in v1.0.0

type DisplayProcessFn func(string) string

type DisplayProcessFnChains added in v1.0.0

type DisplayProcessFnChains []DisplayProcessFn

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 Field added in v1.0.0

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

	Join Join

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

	EditType    table.Type
	EditOptions FieldOptions

	FilterFormFields []FilterFormField

	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) []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) ToDisplay added in v1.0.0

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

type FieldFilterFn added in v1.0.0

type FieldFilterFn func(value FieldModel) interface{}

FieldDisplay is filter function of data.

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) (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{}
}

FieldModel is the single query result.

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"`
	Selected      bool              `json:"-"`
	SelectedLabel template.HTML     `json:"-"`
	Extra         map[string]string `json:"-"`
}

type FieldOptions added in v1.0.9

type FieldOptions []FieldOption

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 FilterFormField added in v1.2.3

type FilterFormField struct {
	Type        form.Type
	Options     FieldOptions
	Width       int
	Operator    FilterOperator
	OptionExt   template.JS
	Head        string
	Placeholder string
	HelpMsg     template.HTML
	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 {
	FormType    form.Type
	Operator    FilterOperator
	Head        string
	Placeholder string
	NoHead      bool
	Width       int
	HelpMsg     template.HTML
	Options     FieldOptions
	Process     func(string) string
	OptionExt   map[string]interface{}
}

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
	SetHiddenFields(fields map[string]string) 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() 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
	TypeName db.DatabaseType
	Head     string
	FormType form2.Type

	Default                template.HTML
	Value                  template.HTML
	Value2                 string
	Options                FieldOptions
	DefaultOptionDelimiter string
	Label                  template.HTML

	Placeholder string

	CustomContent template.HTML
	CustomJs      template.JS
	CustomCss     template.CSS

	Editable    bool
	NotAllowAdd bool
	Must        bool
	Hide        bool

	Width int

	HelpMsg template.HTML

	OptionExt    template.JS
	OptionInitFn OptionInitFn
	OptionTable  OptionTable

	FieldDisplay
	PostFilterFn PostFieldFilterFn
}

FormField is the form field with different options.

func (FormField) FillCustomContent added in v1.2.6

func (f FormField) FillCustomContent() FormField

func (FormField) UpdateDefaultValue added in v1.2.2

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

func (FormField) UpdateValue added in v1.0.9

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

type FormFields added in v1.0.0

type FormFields []FormField

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

type FormPanel

type FormPanel struct {
	FieldList FormFields

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

	Table       string
	Title       string
	Description string

	Validator    FormPostFn
	PostHook     FormPostFn
	PreProcessFn FormPreProcessFn

	Callbacks Callbacks

	UpdateFn FormPostFn
	InsertFn FormPostFn

	HeaderHtml template.HTML
	FooterHtml template.HTML
	// contains filtered or unexported fields
}

FormPanel

func NewFormPanel added in v1.0.0

func NewFormPanel() *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) AddLimitFilter added in v1.0.9

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

func (*FormPanel) AddSubstrFilter added in v1.0.9

func (f *FormPanel) AddSubstrFilter(start int, end int) *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) 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) FieldDisplay added in v1.0.0

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

func (*FormPanel) FieldEnableFileUpload added in v1.2.6

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

func (*FormPanel) FieldFormType added in v1.0.0

func (f *FormPanel) FieldFormType(formType form2.Type) *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) FieldLimit added in v1.0.0

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

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

func (*FormPanel) FieldNotAllowEdit added in v1.0.2

func (f *FormPanel) FieldNotAllowEdit() *FormPanel

func (*FormPanel) FieldOnChoose added in v1.2.3

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

func (*FormPanel) FieldOnChooseAjax added in v1.2.3

func (f *FormPanel) FieldOnChooseAjax(field, url string, handler Handler) *FormPanel

func (*FormPanel) FieldOnChooseCustom added in v1.2.3

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

func (*FormPanel) FieldOnChooseDisable added in v1.2.3

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

func (*FormPanel) FieldOnChooseHide added in v1.2.3

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

func (*FormPanel) FieldOnChooseMap added in v1.2.3

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

func (*FormPanel) FieldOnSearch added in v1.2.3

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

func (*FormPanel) FieldOptionExt added in v1.1.0

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

func (*FormPanel) FieldOptionExtJS added in v1.2.3

func (f *FormPanel) FieldOptionExtJS(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

func (*FormPanel) FieldOptionsFromTable added in v1.2.5

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

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) FieldSubstr added in v1.0.0

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

func (*FormPanel) FieldToLower added in v1.0.0

func (f *FormPanel) FieldToLower() *FormPanel

func (*FormPanel) FieldToTitle added in v1.0.0

func (f *FormPanel) FieldToTitle() *FormPanel

func (*FormPanel) FieldToUpper added in v1.0.0

func (f *FormPanel) FieldToUpper() *FormPanel

func (*FormPanel) FieldTrimSpace added in v1.0.0

func (f *FormPanel) FieldTrimSpace() *FormPanel

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

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(id string, columns []string, res map[string]interface{}, sql ...func() *db.SQL) FormFields

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(id string, columns []string, res map[string]interface{}, sql ...func() *db.SQL) ([]FormFields, []string)

func (*FormPanel) SetDescription added in v1.0.0

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

func (*FormPanel) SetFooterHtml added in v1.0.0

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

func (*FormPanel) SetHeaderHtml added in v1.0.0

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

func (*FormPanel) SetInsertFn added in v1.1.0

func (f *FormPanel) SetInsertFn(fn FormPostFn) *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) 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

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
	Value   string
}

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 {
	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

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

	Wheres    Wheres
	WhereRaws WhereRaw

	Callbacks Callbacks

	Buttons Buttons

	TableLayout string

	DeleteHook  DeleteFn
	PreDeleteFn DeleteFn
	DeleteFn    DeleteFn

	GetDataFn GetDataFn

	ActionButtons Buttons
	Action        template.HTML
	HeaderHtml    template.HTML
	FooterHtml    template.HTML
	// contains filtered or unexported fields
}

InfoPanel

func NewInfoPanel added in v1.0.0

func NewInfoPanel(pk string) *InfoPanel

func (*InfoPanel) AddActionButton added in v1.1.7

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

func (*InfoPanel) AddActionButtonFront added in v1.1.7

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

func (*InfoPanel) AddButton added in v1.1.0

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

func (*InfoPanel) AddButtonRaw added in v1.2.4

func (i *InfoPanel) AddButtonRaw(btn Button, action Action) *InfoPanel

func (*InfoPanel) AddField added in v1.0.0

func (i *InfoPanel) AddField(head, field string, typeName db.DatabaseType) *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(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) 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) FieldDisplay added in v1.0.0

func (i *InfoPanel) FieldDisplay(filter FieldFilterFn) *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) FieldFilterOnChoose added in v1.2.5

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

func (*InfoPanel) FieldFilterOnChooseAjax added in v1.2.5

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

func (*InfoPanel) FieldFilterOnChooseCustom added in v1.2.5

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

func (*InfoPanel) FieldFilterOnChooseDisable added in v1.2.5

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

func (*InfoPanel) FieldFilterOnChooseHide added in v1.2.5

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

func (*InfoPanel) FieldFilterOnChooseMap added in v1.2.5

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

func (*InfoPanel) FieldFilterOnSearch added in v1.2.5

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

func (*InfoPanel) FieldFilterOptionExt added in v1.1.2

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

func (*InfoPanel) FieldFilterOptions added in v1.1.2

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

func (*InfoPanel) FieldFilterProcess added in v1.2.0

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

func (*InfoPanel) FieldFilterable added in v1.0.0

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

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

func (*InfoPanel) FieldJoin added in v1.0.0

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

func (*InfoPanel) FieldLimit added in v1.0.0

func (i *InfoPanel) FieldLimit(limit int) *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

func (*InfoPanel) FieldToLower added in v1.0.0

func (i *InfoPanel) FieldToLower() *InfoPanel

func (*InfoPanel) FieldToTitle added in v1.0.0

func (i *InfoPanel) FieldToTitle() *InfoPanel

func (*InfoPanel) FieldToUpper added in v1.0.0

func (i *InfoPanel) FieldToUpper() *InfoPanel

func (*InfoPanel) FieldTrimSpace added in v1.0.0

func (i *InfoPanel) FieldTrimSpace() *InfoPanel

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

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) 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) 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) SetAction added in v1.0.0

func (i *InfoPanel) SetAction(action template.HTML) *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) SetDescription added in v1.0.0

func (i *InfoPanel) SetDescription(desc string) *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) 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) 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) 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
	Field     string
	JoinField string
}

func (Join) Valid added in v1.0.0

func (j Join) 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
	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 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

	// Components assets
	AssetsList template.HTML
}

Page used in the template as a top variable.

func NewPage added in v1.0.0

func NewPage(user models.UserModel, menu menu.Menu, panel Panel, cfg config.Config, assetsList template.HTML) Page

func NewPagePanel added in v1.2.5

func NewPagePanel(panel Panel) 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
	GetContent() template.HTML
}

type Panel

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

	// Whether to toggle the sidebar
	MiniSidebar bool

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

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

func (Panel) GetContent added in v1.2.0

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

type PopupAttribute added in v1.0.0

type PopupAttribute interface {
	SetID(value string) PopupAttribute
	SetTitle(value template.HTML) PopupAttribute
	SetFooter(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]interface{}
}

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

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
}

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
	SetMinWidth(value int) TableAttribute
	SetLayout(value string) TableAttribute
	GetContent() template.HTML
}

type TableInfo added in v1.2.3

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

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
	Sortable   bool
	Field      string
	Hide       bool
	Editable   bool
	EditType   string
	EditOption FieldOptions
	Width      int
}

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 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 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