types

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertAttribute

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

type AreaChartAttribute

type AreaChartAttribute interface {
	SetTitle(value template.HTML) AreaChartAttribute
	SetID(value string) AreaChartAttribute
	SetData(value string) AreaChartAttribute
	SetHeight(value int) AreaChartAttribute
	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 BarChartAttribute

type BarChartAttribute interface {
	SetID(value string) BarChartAttribute
	SetTitle(value template.HTML) BarChartAttribute
	SetWidth(value int) BarChartAttribute
	SetData(value string) BarChartAttribute
	GetContent() template.HTML
}

type BoxAttribute

type BoxAttribute interface {
	SetHeader(value template.HTML) BoxAttribute
	SetBody(value template.HTML) BoxAttribute
	SetFooter(value template.HTML) BoxAttribute
	SetTitle(value template.HTML) BoxAttribute
	WithHeadBorder(has bool) BoxAttribute
	SetHeadColor(value string) BoxAttribute
	SetTheme(value string) BoxAttribute
	GetContent() template.HTML
}

type ChartLegendAttribute

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

type ColAttribute

type ColAttribute interface {
	SetSize(value map[string]string) ColAttribute
	SetContent(value template.HTML) ColAttribute
	GetContent() template.HTML
}

type DataTableAttribute

type DataTableAttribute interface {
	GetDataTableHeader() template.HTML
	SetThead(value []map[string]string) DataTableAttribute
	SetInfoList(value []map[string]template.HTML) 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
	SetFilterUrl(value string) DataTableAttribute
	SetInfoUrl(value string) DataTableAttribute
	SetExportUrl(value string) DataTableAttribute
	SetFilters(value []map[string]string) DataTableAttribute
	GetContent() template.HTML
}

type DescriptionAttribute

type DescriptionAttribute interface {
	SetNumber(value template.HTML) DescriptionAttribute
	SetTitle(value template.HTML) DescriptionAttribute
	SetArrow(value string) DescriptionAttribute
	SetPercent(value template.HTML) DescriptionAttribute
	SetBorder(value string) DescriptionAttribute
	SetColor(value template.HTML) DescriptionAttribute
	GetContent() template.HTML
}

type DisplayProcessFn

type DisplayProcessFn func(string) string

type DisplayProcessFnChains

type DisplayProcessFnChains []DisplayProcessFn

func (DisplayProcessFnChains) Add

func (DisplayProcessFnChains) Valid

func (d DisplayProcessFnChains) Valid() bool

type Field added in v0.0.4

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

	Join Join

	Width      int
	Sortable   bool
	Fixed      bool
	Filterable bool
	Hide       bool

	FieldDisplay
}

Field is the table field.

type FieldDisplay

type FieldDisplay struct {
	Display              FieldFilterFn
	DisplayProcessChains DisplayProcessFnChains
}

func (FieldDisplay) AddLimit

func (f FieldDisplay) AddLimit(limit int) DisplayProcessFnChains

func (FieldDisplay) AddSubstr

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

func (FieldDisplay) AddToLower

func (f FieldDisplay) AddToLower() DisplayProcessFnChains

func (FieldDisplay) AddToTitle

func (f FieldDisplay) AddToTitle() DisplayProcessFnChains

func (FieldDisplay) AddToUpper

func (f FieldDisplay) AddToUpper() DisplayProcessFnChains

func (FieldDisplay) AddTrimSpace

func (f FieldDisplay) AddTrimSpace() DisplayProcessFnChains

func (FieldDisplay) ToDisplay

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

type FieldFilterFn added in v0.0.5

type FieldFilterFn func(value FieldModel) interface{}

FieldDisplay is filter function of data.

type FieldModel

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

type FieldModelValue []string

func (FieldModelValue) First

func (r FieldModelValue) First() string

func (FieldModelValue) Value

func (r FieldModelValue) Value() string

type FormAttribute

type FormAttribute interface {
	SetHeader(value template.HTML) FormAttribute
	SetContent(value []FormField) FormAttribute
	SetTabContents(value [][]FormField) FormAttribute
	SetTabHeaders(value []string) FormAttribute
	SetFooter(value template.HTML) FormAttribute
	SetPrefix(value string) FormAttribute
	SetUrl(value string) FormAttribute
	SetPrimaryKey(value string) FormAttribute
	SetInfoUrl(value string) FormAttribute
	SetMethod(value string) FormAttribute
	SetTitle(value template.HTML) FormAttribute
	SetToken(value string) FormAttribute
	GetContent() template.HTML
}

type FormField

type FormField struct {
	Field    string
	TypeName db.DatabaseType
	Head     string
	FormType form.Type

	Default                string
	Value                  string
	Options                []map[string]string
	DefaultOptionDelimiter string

	Editable    bool
	NotAllowAdd bool
	Must        bool

	FieldDisplay
	PostFilterFn PostFieldFilterFn
}

FormField is the form field with different options.

type FormFields

type FormFields []FormField

func (FormFields) Copy

func (f FormFields) Copy() FormFields

func (FormFields) FindByFieldName

func (f FormFields) FindByFieldName(field string) FormField

type FormPanel

type FormPanel struct {
	FieldList FormFields

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

	Table       string
	Title       string
	Description string

	Validator FormValidator
	PostHook  FormPostHookFn

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

FormPanel

func NewFormPanel

func NewFormPanel() *FormPanel

func (*FormPanel) AddField

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

func (*FormPanel) FieldDefaultOptionDelimiter

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

func (*FormPanel) FieldDisplay

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

func (*FormPanel) FieldEditable

func (f *FormPanel) FieldEditable(edit bool) *FormPanel

func (*FormPanel) FieldFormType

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

func (*FormPanel) FieldLimit

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

func (*FormPanel) FieldMust

func (f *FormPanel) FieldMust(must bool) *FormPanel

func (*FormPanel) FieldNotAllowAdd

func (f *FormPanel) FieldNotAllowAdd(add bool) *FormPanel

func (*FormPanel) FieldOptions

func (f *FormPanel) FieldOptions(options []map[string]string) *FormPanel

func (*FormPanel) FieldPostFilterFn

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

func (*FormPanel) FieldSubstr

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

func (*FormPanel) FieldToLower

func (f *FormPanel) FieldToLower() *FormPanel

func (*FormPanel) FieldToTitle

func (f *FormPanel) FieldToTitle() *FormPanel

func (*FormPanel) FieldToUpper

func (f *FormPanel) FieldToUpper() *FormPanel

func (*FormPanel) FieldTrimSpace

func (f *FormPanel) FieldTrimSpace() *FormPanel

func (*FormPanel) FieldValue

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

func (*FormPanel) SetDescription

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

func (*FormPanel) SetFooterHtml

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

func (*FormPanel) SetHeaderHtml

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

func (*FormPanel) SetPostHook

func (f *FormPanel) SetPostHook(po FormPostHookFn) *FormPanel

func (*FormPanel) SetPostValidator

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

func (*FormPanel) SetTabGroups

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

func (*FormPanel) SetTabHeaders

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

func (*FormPanel) SetTable

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

func (*FormPanel) SetTitle

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

type FormPostHookFn

type FormPostHookFn func(values form2.Values)

type FormValidator

type FormValidator func(values form2.Values) error

type GetPanel

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

type ImgAttribute

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

type InfoBoxAttribute

type InfoBoxAttribute interface {
	SetIcon(value template.HTML) InfoBoxAttribute
	SetText(value template.HTML) InfoBoxAttribute
	SetNumber(value template.HTML) InfoBoxAttribute
	SetContent(value template.HTML) InfoBoxAttribute
	SetColor(value template.HTML) InfoBoxAttribute
	GetContent() template.HTML
}

type InfoPanel

type InfoPanel struct {
	FieldList []Field

	Table       string
	Title       string
	Description string

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

	Sort Sort

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

InfoPanel

func NewInfoPanel

func NewInfoPanel() *InfoPanel

func (*InfoPanel) AddField

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

func (*InfoPanel) FieldDisplay

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

func (*InfoPanel) FieldFilterable

func (i *InfoPanel) FieldFilterable(filter bool) *InfoPanel

func (*InfoPanel) FieldFixed

func (i *InfoPanel) FieldFixed(fixed bool) *InfoPanel

func (*InfoPanel) FieldHide

func (i *InfoPanel) FieldHide(hide bool) *InfoPanel

func (*InfoPanel) FieldJoin

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

func (*InfoPanel) FieldLimit

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

func (*InfoPanel) FieldSortable

func (i *InfoPanel) FieldSortable(sort bool) *InfoPanel

func (*InfoPanel) FieldSubstr

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

func (*InfoPanel) FieldToLower

func (i *InfoPanel) FieldToLower() *InfoPanel

func (*InfoPanel) FieldToTitle

func (i *InfoPanel) FieldToTitle() *InfoPanel

func (*InfoPanel) FieldToUpper

func (i *InfoPanel) FieldToUpper() *InfoPanel

func (*InfoPanel) FieldTrimSpace

func (i *InfoPanel) FieldTrimSpace() *InfoPanel

func (*InfoPanel) FieldWidth

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

func (*InfoPanel) SetAction

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

func (*InfoPanel) SetDescription

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

func (*InfoPanel) SetFooterHtml

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

func (*InfoPanel) SetHeaderHtml

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

func (*InfoPanel) SetSort

func (i *InfoPanel) SetSort(sort Sort) *InfoPanel

func (*InfoPanel) SetTabGroups

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

func (*InfoPanel) SetTabHeaders

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

func (*InfoPanel) SetTable

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

func (*InfoPanel) SetTitle

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

type Join added in v0.0.4

type Join struct {
	Table     string
	Field     string
	JoinField string
}

func (Join) Valid added in v0.2.6

func (j Join) Valid() bool

type LabelAttribute

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

type LineChartAttribute

type LineChartAttribute interface {
	SetID(value string) LineChartAttribute
	SetTitle(value template.HTML) LineChartAttribute
	SetHeight(value int) LineChartAttribute
	SetData(value string) LineChartAttribute
	GetContent() template.HTML
}

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

	// CdnUrl is the cdn link of assets
	CdnUrl string

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

	// Custom html after body.
	CustomFootHtml template.HTML
}

Page used in the template as a top variable.

func NewPage

func NewPage(user models.UserModel, menu menu.Menu, panel Panel, cfg config.Config) 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
	SetNextClass(value string) PaginatorAttribute
	SetNextUrl(value string) PaginatorAttribute
	SetOption(value map[string]template.HTML) PaginatorAttribute
	SetUrl(value string) PaginatorAttribute
	GetContent() template.HTML
}

type Panel

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

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

type PieChartAttribute

type PieChartAttribute interface {
	SetID(value string) PieChartAttribute
	SetData(value string) PieChartAttribute
	SetTitle(value template.HTML) PieChartAttribute
	SetHeight(value int) PieChartAttribute
	GetContent() template.HTML
}

type PopupAttribute added in v0.0.4

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 v0.0.14

type PostFieldFilterFn func(value PostFieldModel) string

PostFieldFilterFn is filter function of data.

type PostFieldModel

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 ProductListAttribute

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

type ProgressAttribute

type ProgressAttribute interface{}

type ProgressGroupAttribute

type ProgressGroupAttribute interface {
	SetTitle(value template.HTML) ProgressGroupAttribute
	SetColor(value template.HTML) ProgressGroupAttribute
	SetPercent(value int) ProgressGroupAttribute
	SetDenominator(value int) ProgressGroupAttribute
	SetMolecular(value int) ProgressGroupAttribute
	GetContent() template.HTML
}

type RowAttribute

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

type SmallBoxAttribute

type SmallBoxAttribute interface {
	SetTitle(value template.HTML) SmallBoxAttribute
	SetValue(value template.HTML) SmallBoxAttribute
	SetColor(value template.HTML) SmallBoxAttribute
	SetIcon(value template.HTML) SmallBoxAttribute
	SetUrl(value string) SmallBoxAttribute
	GetContent() template.HTML
}

type Sort added in v0.3.0

type Sort uint8
const (
	SortDesc Sort = iota
	SortAsc
)

type SystemInfo

type SystemInfo struct {
	Version string
}

SystemInfo contains basic info of system.

type TabGroups

type TabGroups [][]string

func NewTabGroups

func NewTabGroups(items ...string) TabGroups

func (TabGroups) AddGroup

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

func (TabGroups) Valid

func (t TabGroups) Valid() bool

type TabHeaders

type TabHeaders []string

func (TabHeaders) Add

func (t TabHeaders) Add(header string) TabHeaders

type TableAttribute

type TableAttribute interface {
	SetThead(value []map[string]string) TableAttribute
	SetInfoList(value []map[string]template.HTML) TableAttribute
	SetType(value string) TableAttribute
	SetMinWidth(value int) TableAttribute
	GetContent() template.HTML
}

type TabsAttribute

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

type TreeAttribute

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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