Documentation
¶
Index ¶
- Constants
- Variables
- func AddGlobalDisplayProcessFn(f FieldFilterFn)
- func GetJoinField(field string) string
- func JoinField(table, field string) string
- func ParseTableDataTmpl(content interface{}) string
- func ParseTableDataTmplWithID(id template.HTML, content string, value ...map[string]InfoItem) string
- func RegisterDisplayFnGenerator(key string, gen DisplayFnGenerator)
- type Action
- type ActionButton
- type ActionIconButton
- type Actions
- type AddFormFieldFn
- type AjaxData
- type AlertAttribute
- type Attribute
- type BaseButton
- func (b *BaseButton) Content() (template.HTML, template.JS)
- func (b *BaseButton) GetAction() Action
- func (b *BaseButton) GetName() string
- func (b *BaseButton) ID() string
- func (b *BaseButton) IsType(t string) bool
- func (b *BaseButton) METHOD() string
- func (b *BaseButton) SetName(name string)
- func (b *BaseButton) Type() string
- func (b *BaseButton) URL() string
- type BaseDisplayFnGenerator
- type BoxAttribute
- type Button
- type ButtonAttribute
- type Buttons
- func (b Buttons) Add(btn Button) Buttons
- func (b Buttons) AddNavButton(ico, name string, action Action) Buttons
- func (b Buttons) Callbacks() []context.Node
- func (b Buttons) CheckExist(name string) bool
- func (b Buttons) CheckPermission(user models.UserModel) Buttons
- func (b Buttons) CheckPermissionWhenURLAndMethodNotEmpty(user models.UserModel) Buttons
- func (b Buttons) Content(ctx *context.Context) (template.HTML, template.JS)
- func (b Buttons) Copy() Buttons
- func (b Buttons) FooterContent(ctx *context.Context) template.HTML
- func (b Buttons) RemoveButtonByName(name string) Buttons
- func (b Buttons) RemoveInfoNavButton() Buttons
- func (b Buttons) RemovePlugNavButton() Buttons
- func (b Buttons) RemoveSiteNavButton() Buttons
- func (b Buttons) RemoveToolNavButton() Buttons
- type Callbacks
- type ColAttribute
- type Component
- type ContentWrapper
- type DataTableAttribute
- type DefaultAction
- func (def *DefaultAction) BtnAttribute() template.HTML
- func (def *DefaultAction) BtnClass() template.HTML
- func (def *DefaultAction) ExtContent(ctx *context.Context) template.HTML
- func (def *DefaultAction) FooterContent(ctx *context.Context) template.HTML
- func (def *DefaultAction) GetCallbacks() context.Node
- func (def *DefaultAction) Js() template.JS
- func (def *DefaultAction) SetBtnData(data interface{})
- func (def *DefaultAction) SetBtnId(btnId string)
- type DefaultButton
- func GetColumnButton(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton
- func GetDefaultButton(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton
- func GetDefaultButtonGroup(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton
- type DefaultSelection
- type DeleteFn
- type DeleteFnWithRes
- type DisplayFnGenerator
- type DisplayProcessFnChains
- func AddLimit(limit int) DisplayProcessFnChains
- func AddSubstr(start int, end int) DisplayProcessFnChains
- func AddToLower() DisplayProcessFnChains
- func AddToTitle() DisplayProcessFnChains
- func AddToUpper() DisplayProcessFnChains
- func AddTrimSpace() DisplayProcessFnChains
- func AddXssFilter() DisplayProcessFnChains
- func AddXssJsFilter() DisplayProcessFnChains
- type ExportProcessFn
- type Field
- type FieldDisplay
- func (f FieldDisplay) AddLimit(limit int) DisplayProcessFnChains
- func (f FieldDisplay) AddSubstr(start int, end int) DisplayProcessFnChains
- func (f FieldDisplay) AddToLower() DisplayProcessFnChains
- func (f FieldDisplay) AddToTitle() DisplayProcessFnChains
- func (f FieldDisplay) AddToUpper() DisplayProcessFnChains
- func (f FieldDisplay) AddTrimSpace() DisplayProcessFnChains
- func (f FieldDisplay) IsNotSelectRes(v interface{}) bool
- func (f FieldDisplay) ToDisplay(value FieldModel) interface{}
- func (f FieldDisplay) ToDisplayHTML(value FieldModel) template.HTML
- func (f FieldDisplay) ToDisplayString(value FieldModel) string
- func (f FieldDisplay) ToDisplayStringArray(value FieldModel) []string
- func (f FieldDisplay) ToDisplayStringArrayArray(value FieldModel) [][]string
- type FieldDotColor
- type FieldFilterFn
- type FieldGetImgArrFn
- type FieldLabelParam
- type FieldList
- func (f FieldList) GetFieldByFieldName(name string) Field
- func (f FieldList) GetFieldFilterProcessValue(key, value, keyIndex string) string
- func (f FieldList) GetFieldJoinTable(key string) string
- func (f FieldList) GetThead(info TableInfo, params parameter.Parameters, columns []string) (Thead, string, string)
- func (f FieldList) GetTheadAndFilterForm(info TableInfo, params parameter.Parameters, columns []string, ...) (Thead, string, string, string, []string, []FormField)
- type FieldModel
- type FieldModelValue
- type FieldOption
- type FieldOptions
- type FieldProgressBarData
- type FilterFormField
- type FilterOperator
- type FilterType
- type FormAttribute
- type FormField
- type FormFields
- func (f FormFields) Add(field *FormField) FormFields
- func (f FormFields) Copy() FormFields
- func (f FormFields) FillCustomContent() FormFields
- func (f FormFields) FindByFieldName(field string) *FormField
- func (f FormFields) FindIndexByFieldName(field string) int
- func (f FormFields) FindTableChildren(father string) []*FormField
- func (f FormFields) FindTableField(field, father string) *FormField
- func (f FormFields) RemoveNotShow() FormFields
- type FormPanel
- func (f *FormPanel) AddCSS(css template.CSS) *FormPanel
- func (f *FormPanel) AddField(head, field string, filedType db.DatabaseType, formType form2.Type) *FormPanel
- func (f *FormPanel) AddFieldTr(ctx *context.Context, head, field string, filedType db.DatabaseType, ...) *FormPanel
- func (f *FormPanel) AddFieldWithTranslation(ctx *context.Context, head, field string, filedType db.DatabaseType, ...) *FormPanel
- func (f *FormPanel) AddJS(js template.JS) *FormPanel
- func (f *FormPanel) AddLimitFilter(limit int) *FormPanel
- func (f *FormPanel) AddRow(addFields AddFormFieldFn) *FormPanel
- func (f *FormPanel) AddSubstrFilter(start int, end int) *FormPanel
- func (f *FormPanel) AddTable(head, field string, addFields AddFormFieldFn) *FormPanel
- func (f *FormPanel) AddToLowerFilter() *FormPanel
- func (f *FormPanel) AddToTitleFilter() *FormPanel
- func (f *FormPanel) AddToUpperFilter() *FormPanel
- func (f *FormPanel) AddTrimSpaceFilter() *FormPanel
- func (f *FormPanel) AddXssFilter() *FormPanel
- func (f *FormPanel) AddXssJsFilter() *FormPanel
- func (f *FormPanel) EnableAjax(msgs ...string) *FormPanel
- func (f *FormPanel) EnableAjaxData(data AjaxData) *FormPanel
- func (f *FormPanel) FieldCustomContent(content template.HTML) *FormPanel
- func (f *FormPanel) FieldCustomCss(css template.CSS) *FormPanel
- func (f *FormPanel) FieldCustomJs(js template.JS) *FormPanel
- func (f *FormPanel) FieldDefault(def string) *FormPanel
- func (f *FormPanel) FieldDefaultOptionDelimiter(delimiter string) *FormPanel
- func (f *FormPanel) FieldDisableWhenCreate() *FormPanel
- func (f *FormPanel) FieldDisableWhenUpdate() *FormPanel
- func (f *FormPanel) FieldDisplay(filter FieldFilterFn) *FormPanel
- func (f *FormPanel) FieldDisplayButCanNotEditWhenCreate() *FormPanel
- func (f *FormPanel) FieldDisplayButCanNotEditWhenUpdate() *FormPanel
- func (f *FormPanel) FieldDivider(title ...string) *FormPanel
- func (f *FormPanel) FieldEnableFileUpload(data ...interface{}) *FormPanel
- func (f *FormPanel) FieldFoot(foot template.HTML) *FormPanel
- func (f *FormPanel) FieldFormType(formType form2.Type) *FormPanel
- func (f *FormPanel) FieldHeadWidth(width int) *FormPanel
- func (f *FormPanel) FieldHelpMsg(s template.HTML) *FormPanel
- func (f *FormPanel) FieldHide() *FormPanel
- func (f *FormPanel) FieldHideLabel() *FormPanel
- func (f *FormPanel) FieldHideWhenCreate() *FormPanel
- func (f *FormPanel) FieldHideWhenUpdate() *FormPanel
- func (f *FormPanel) FieldInputWidth(width int) *FormPanel
- func (f *FormPanel) FieldLimit(limit int) *FormPanel
- func (f *FormPanel) FieldMust() *FormPanel
- func (f *FormPanel) FieldNotAllowAdd() *FormPanel
- func (f *FormPanel) FieldNotAllowEdit() *FormPanel
- func (f *FormPanel) FieldNow() *FormPanel
- func (f *FormPanel) FieldNowWhenInsert() *FormPanel
- func (f *FormPanel) FieldNowWhenUpdate() *FormPanel
- func (f *FormPanel) FieldOnChoose(val, field string, value template.HTML) *FormPanel
- func (f *FormPanel) FieldOnChooseAjax(field, url string, handler Handler, custom ...template.HTML) *FormPanel
- func (f *FormPanel) FieldOnChooseCustom(js template.HTML) *FormPanel
- func (f *FormPanel) FieldOnChooseDisable(value string, field ...string) *FormPanel
- func (f *FormPanel) FieldOnChooseHide(value string, field ...string) *FormPanel
- func (f *FormPanel) FieldOnChooseMap(m map[string]LinkField) *FormPanel
- func (f *FormPanel) FieldOnChooseOptionsHide(values []string, field ...string) *FormPanel
- func (f *FormPanel) FieldOnChooseOptionsShow(values []string, field ...string) *FormPanel
- func (f *FormPanel) FieldOnChooseShow(value string, field ...string) *FormPanel
- func (f *FormPanel) FieldOnSearch(url string, handler Handler, delay ...int) *FormPanel
- func (f *FormPanel) FieldOptionExt(m map[string]interface{}) *FormPanel
- func (f *FormPanel) FieldOptionExt2(m map[string]interface{}) *FormPanel
- func (f *FormPanel) FieldOptionExtJS(js template.JS) *FormPanel
- func (f *FormPanel) FieldOptionExtJS2(js template.JS) *FormPanel
- func (f *FormPanel) FieldOptionInitFn(fn OptionInitFn) *FormPanel
- func (f *FormPanel) FieldOptions(options FieldOptions) *FormPanel
- func (f *FormPanel) FieldOptionsFromTable(table, textFieldName, valueFieldName string, ...) *FormPanel
- func (f *FormPanel) FieldOptionsTableProcessFn(fn OptionProcessFn) *FormPanel
- func (f *FormPanel) FieldPlaceholder(placeholder string) *FormPanel
- func (f *FormPanel) FieldPostFilterFn(post PostFieldFilterFn) *FormPanel
- func (f *FormPanel) FieldRowWidth(width int) *FormPanel
- func (f *FormPanel) FieldSubstr(start int, end int) *FormPanel
- func (f *FormPanel) FieldToLower() *FormPanel
- func (f *FormPanel) FieldToTitle() *FormPanel
- func (f *FormPanel) FieldToUpper() *FormPanel
- func (f *FormPanel) FieldTrimSpace() *FormPanel
- func (f *FormPanel) FieldValue(value string) *FormPanel
- func (f *FormPanel) FieldWidth(width int) *FormPanel
- func (f *FormPanel) FieldXssFilter() *FormPanel
- func (f *FormPanel) FieldsWithDefaultValue(sql ...func() *db.SQL) FormFields
- func (f *FormPanel) FieldsWithValue(pk, id string, columns []string, res map[string]interface{}, ...) FormFields
- func (f *FormPanel) GetNewFormFields(sql ...func() *db.SQL) (FormFields, []FormFields, []string)
- func (f *FormPanel) GroupField(sql ...func() *db.SQL) ([]FormFields, []string)
- func (f *FormPanel) GroupFieldWithValue(pk, id string, columns []string, res map[string]interface{}, ...) ([]FormFields, []string)
- func (f *FormPanel) HasError() bool
- func (f *FormPanel) HideBackButton() *FormPanel
- func (f *FormPanel) HideContinueEditCheckBox() *FormPanel
- func (f *FormPanel) HideContinueNewCheckBox() *FormPanel
- func (f *FormPanel) HideResetButton() *FormPanel
- func (f *FormPanel) OperationURL(id string) string
- func (f *FormPanel) Set400Error(content ...template.HTML) *FormPanel
- func (f *FormPanel) Set403Error(content ...template.HTML) *FormPanel
- func (f *FormPanel) Set404Error(content ...template.HTML) *FormPanel
- func (f *FormPanel) Set500Error(content ...template.HTML) *FormPanel
- func (f *FormPanel) SetAjaxErrorJS(js template.JS) *FormPanel
- func (f *FormPanel) SetAjaxSuccessJS(js template.JS) *FormPanel
- func (f *FormPanel) SetDescription(desc string) *FormPanel
- func (f *FormPanel) SetError(err errors.PageError, content ...template.HTML) *FormPanel
- func (f *FormPanel) SetFooterHtml(footer template.HTML) *FormPanel
- func (f *FormPanel) SetFormEditBtnWord(word template.HTML) *FormPanel
- func (f *FormPanel) SetFormEditTitle(title template.HTML) *FormPanel
- func (f *FormPanel) SetFormNewBtnWord(word template.HTML) *FormPanel
- func (f *FormPanel) SetFormNewTitle(title template.HTML) *FormPanel
- func (f *FormPanel) SetHTMLContent(content template.HTML) *FormPanel
- func (f *FormPanel) SetHeadWidth(width int) *FormPanel
- func (f *FormPanel) SetHeader(content template.HTML) *FormPanel
- func (f *FormPanel) SetHeaderHtml(header template.HTML) *FormPanel
- func (f *FormPanel) SetHideSideBar() *FormPanel
- func (f *FormPanel) SetInputWidth(width int) *FormPanel
- func (f *FormPanel) SetInsertFn(fn FormPostFn) *FormPanel
- func (f *FormPanel) SetLayout(layout form2.Layout) *FormPanel
- func (f *FormPanel) SetNoCompress() *FormPanel
- func (f *FormPanel) SetPostHook(fn FormPostFn) *FormPanel
- func (f *FormPanel) SetPostValidator(va FormPostFn) *FormPanel
- func (f *FormPanel) SetPreProcessFn(fn FormPreProcessFn) *FormPanel
- func (f *FormPanel) SetPrimaryKey(name string, typ db.DatabaseType) *FormPanel
- func (f *FormPanel) SetResponder(responder Responder) *FormPanel
- func (f *FormPanel) SetTabGroups(groups TabGroups) *FormPanel
- func (f *FormPanel) SetTabHeaders(headers ...string) *FormPanel
- func (f *FormPanel) SetTable(table string) *FormPanel
- func (f *FormPanel) SetTitle(title string) *FormPanel
- func (f *FormPanel) SetUpdateFn(fn FormPostFn) *FormPanel
- func (f *FormPanel) SetWrapper(wrapper ContentWrapper) *FormPanel
- type FormPostFn
- type FormPreProcessFn
- type GetDataFn
- type GetPanelFn
- type GetPanelInfoFn
- type GroupFieldHeaders
- type GroupFormFields
- type Handler
- type ImgAttribute
- type InfoItem
- type InfoList
- type InfoPanel
- func (i *InfoPanel) AddActionButton(ctx *context.Context, title template.HTML, action Action, ids ...string) *InfoPanel
- func (i *InfoPanel) AddActionButtonFront(ctx *context.Context, title template.HTML, action Action, ids ...string) *InfoPanel
- func (i *InfoPanel) AddActionIconButton(ctx *context.Context, icon string, action Action, ids ...string) *InfoPanel
- func (i *InfoPanel) AddButton(ctx *context.Context, title template.HTML, icon string, action Action, ...) *InfoPanel
- func (i *InfoPanel) AddButtonRaw(ctx *context.Context, btn Button, action Action) *InfoPanel
- func (i *InfoPanel) AddCSS(css template.CSS) *InfoPanel
- func (i *InfoPanel) AddColumn(head string, fun FieldFilterFn) *InfoPanel
- func (i *InfoPanel) AddColumnButtons(ctx *context.Context, head string, buttons ...Button) *InfoPanel
- func (i *InfoPanel) AddField(head, field string, typeName db.DatabaseType) *InfoPanel
- func (i *InfoPanel) AddFieldTr(ctx *context.Context, head, field string, typeName db.DatabaseType) *InfoPanel
- func (i *InfoPanel) AddFieldWithTranslation(ctx *context.Context, head, field string, typeName db.DatabaseType) *InfoPanel
- func (i *InfoPanel) AddFilter(head, field string, typeName db.DatabaseType, fn UpdateParametersFn, ...) *InfoPanel
- func (i *InfoPanel) AddJS(js template.JS) *InfoPanel
- func (i *InfoPanel) AddJSModule(js template.JS) *InfoPanel
- func (i *InfoPanel) AddLimitFilter(limit int) *InfoPanel
- func (i *InfoPanel) AddSelectBox(ctx *context.Context, placeholder string, options FieldOptions, action Action, ...) *InfoPanel
- func (i *InfoPanel) AddSubstrFilter(start int, end int) *InfoPanel
- func (i *InfoPanel) AddToLowerFilter() *InfoPanel
- func (i *InfoPanel) AddToTitleFilter() *InfoPanel
- func (i *InfoPanel) AddToUpperFilter() *InfoPanel
- func (i *InfoPanel) AddTrimSpaceFilter() *InfoPanel
- func (i *InfoPanel) AddUpdateParametersFn(fn UpdateParametersFn) *InfoPanel
- func (i *InfoPanel) AddXssFilter() *InfoPanel
- func (i *InfoPanel) AddXssJsFilter() *InfoPanel
- func (i *InfoPanel) ExportValue() *InfoPanel
- func (i *InfoPanel) FieldAsDeleteParam() *InfoPanel
- func (i *InfoPanel) FieldAsDetailParam() *InfoPanel
- func (i *InfoPanel) FieldAsEditParam() *InfoPanel
- func (i *InfoPanel) FieldBool(flags ...string) *InfoPanel
- func (i *InfoPanel) FieldCarousel(fn FieldGetImgArrFn, size ...int) *InfoPanel
- func (i *InfoPanel) FieldCopyable(prefix ...string) *InfoPanel
- func (i *InfoPanel) FieldDate(format string) *InfoPanel
- func (i *InfoPanel) FieldDisplay(filter FieldFilterFn) *InfoPanel
- func (i *InfoPanel) FieldDot(icons map[string]FieldDotColor, defaultDot FieldDotColor) *InfoPanel
- func (i *InfoPanel) FieldDownLoadable(prefix ...string) *InfoPanel
- func (i *InfoPanel) FieldEditAble(editType ...table.Type) *InfoPanel
- func (i *InfoPanel) FieldEditOptions(options FieldOptions, extra ...map[string]string) *InfoPanel
- func (i *InfoPanel) FieldFileSize() *InfoPanel
- func (i *InfoPanel) FieldFilterOnChoose(val, field string, value template.HTML) *InfoPanel
- func (i *InfoPanel) FieldFilterOnChooseAjax(field, url string, handler Handler) *InfoPanel
- func (i *InfoPanel) FieldFilterOnChooseCustom(js template.HTML) *InfoPanel
- func (i *InfoPanel) FieldFilterOnChooseDisable(value string, field ...string) *InfoPanel
- func (i *InfoPanel) FieldFilterOnChooseHide(value string, field ...string) *InfoPanel
- func (i *InfoPanel) FieldFilterOnChooseMap(m map[string]LinkField) *InfoPanel
- func (i *InfoPanel) FieldFilterOnChooseShow(value string, field ...string) *InfoPanel
- func (i *InfoPanel) FieldFilterOnSearch(url string, handler Handler, delay ...int) *InfoPanel
- func (i *InfoPanel) FieldFilterOptionExt(m map[string]interface{}) *InfoPanel
- func (i *InfoPanel) FieldFilterOptions(options FieldOptions) *InfoPanel
- func (i *InfoPanel) FieldFilterOptionsFromTable(table, textFieldName, valueFieldName string, ...) *InfoPanel
- func (i *InfoPanel) FieldFilterProcess(process func(string) string) *InfoPanel
- func (i *InfoPanel) FieldFilterable(filterType ...FilterType) *InfoPanel
- func (i *InfoPanel) FieldFixed() *InfoPanel
- func (i *InfoPanel) FieldHide() *InfoPanel
- func (i *InfoPanel) FieldHideForList() *InfoPanel
- func (i *InfoPanel) FieldIcon(icons map[string]string, defaultIcon string) *InfoPanel
- func (i *InfoPanel) FieldImage(width, height string, prefix ...string) *InfoPanel
- func (i *InfoPanel) FieldJoin(join Join) *InfoPanel
- func (i *InfoPanel) FieldLabel(args ...FieldLabelParam) *InfoPanel
- func (i *InfoPanel) FieldLimit(limit int) *InfoPanel
- func (i *InfoPanel) FieldLink(src string, openInNewTab ...bool) *InfoPanel
- func (i *InfoPanel) FieldLoading(data []string) *InfoPanel
- func (i *InfoPanel) FieldProgressBar(data ...FieldProgressBarData) *InfoPanel
- func (i *InfoPanel) FieldQrcode() *InfoPanel
- func (i *InfoPanel) FieldSortable() *InfoPanel
- func (i *InfoPanel) FieldSubstr(start int, end int) *InfoPanel
- func (i *InfoPanel) FieldToLower() *InfoPanel
- func (i *InfoPanel) FieldToTitle() *InfoPanel
- func (i *InfoPanel) FieldToUpper() *InfoPanel
- func (i *InfoPanel) FieldTrimSpace() *InfoPanel
- func (i *InfoPanel) FieldWidth(width int) *InfoPanel
- func (i *InfoPanel) FieldXssFilter() *InfoPanel
- func (i *InfoPanel) GetPageSizeList() []string
- func (i *InfoPanel) GetSort() string
- func (i *InfoPanel) HasError() bool
- func (i *InfoPanel) HideCheckBoxColumn() *InfoPanel
- func (i *InfoPanel) HideColumn(n int) *InfoPanel
- func (i *InfoPanel) HideDeleteButton() *InfoPanel
- func (i *InfoPanel) HideDetailButton() *InfoPanel
- func (i *InfoPanel) HideEditButton() *InfoPanel
- func (i *InfoPanel) HideExportButton() *InfoPanel
- func (i *InfoPanel) HideFilterArea() *InfoPanel
- func (i *InfoPanel) HideFilterButton() *InfoPanel
- func (i *InfoPanel) HideNewButton() *InfoPanel
- func (i *InfoPanel) HidePagination() *InfoPanel
- func (i *InfoPanel) HideQueryInfo() *InfoPanel
- func (i *InfoPanel) HideRowSelector() *InfoPanel
- func (i *InfoPanel) IsExportValue() bool
- func (i *InfoPanel) OperationURL(id string) string
- func (i *InfoPanel) Set400Error(content ...template.HTML) *InfoPanel
- func (i *InfoPanel) Set403Error(content ...template.HTML) *InfoPanel
- func (i *InfoPanel) Set404Error(content ...template.HTML) *InfoPanel
- func (i *InfoPanel) Set500Error(content ...template.HTML) *InfoPanel
- func (i *InfoPanel) SetAction(action template.HTML) *InfoPanel
- func (i *InfoPanel) SetActionButtonFold() *InfoPanel
- func (i *InfoPanel) SetAutoRefresh(interval uint) *InfoPanel
- func (i *InfoPanel) SetDefaultPageSize(defaultPageSize int) *InfoPanel
- func (i *InfoPanel) SetDeleteFn(fn DeleteFn) *InfoPanel
- func (i *InfoPanel) SetDeleteHook(fn DeleteFn) *InfoPanel
- func (i *InfoPanel) SetDeleteHookWithRes(fn DeleteFnWithRes) *InfoPanel
- func (i *InfoPanel) SetDescription(desc string) *InfoPanel
- func (i *InfoPanel) SetError(err errors.PageError, content ...template.HTML) *InfoPanel
- func (i *InfoPanel) SetExportProcessFn(fn ExportProcessFn) *InfoPanel
- func (i *InfoPanel) SetFilterFormHeadWidth(w int) *InfoPanel
- func (i *InfoPanel) SetFilterFormInputWidth(w int) *InfoPanel
- func (i *InfoPanel) SetFilterFormLayout(layout form.Layout) *InfoPanel
- func (i *InfoPanel) SetFooterHtml(footer template.HTML) *InfoPanel
- func (i *InfoPanel) SetGetDataFn(fn GetDataFn) *InfoPanel
- func (i *InfoPanel) SetHeaderHtml(header template.HTML) *InfoPanel
- func (i *InfoPanel) SetHideSideBar() *InfoPanel
- func (i *InfoPanel) SetNoCompress() *InfoPanel
- func (i *InfoPanel) SetPageSizeList(pageSizeList []int) *InfoPanel
- func (i *InfoPanel) SetPreDeleteFn(fn DeleteFn) *InfoPanel
- func (i *InfoPanel) SetPrimaryKey(name string, typ db.DatabaseType) *InfoPanel
- func (i *InfoPanel) SetQueryFilterFn(fn QueryFilterFn) *InfoPanel
- func (i *InfoPanel) SetSortAsc() *InfoPanel
- func (i *InfoPanel) SetSortDesc() *InfoPanel
- func (i *InfoPanel) SetSortField(field string) *InfoPanel
- func (i *InfoPanel) SetTabGroups(groups TabGroups) *InfoPanel
- func (i *InfoPanel) SetTabHeaders(headers ...string) *InfoPanel
- func (i *InfoPanel) SetTable(table string) *InfoPanel
- func (i *InfoPanel) SetTableFixed() *InfoPanel
- func (i *InfoPanel) SetTitle(title string) *InfoPanel
- func (i *InfoPanel) SetWrapper(wrapper ContentWrapper) *InfoPanel
- func (i *InfoPanel) Where(field string, operator string, arg interface{}) *InfoPanel
- func (i *InfoPanel) WhereOr(field string, operator string, arg interface{}) *InfoPanel
- func (i *InfoPanel) WhereRaw(raw string, arg ...interface{}) *InfoPanel
- type Join
- type Joins
- type LabelAttribute
- type LinkAttribute
- type LinkField
- type NavButton
- type NavDropDownButton
- type NavDropDownItemButton
- type NewPageParam
- type NilAction
- func (def *NilAction) BtnAttribute() template.HTML
- func (def *NilAction) BtnClass() template.HTML
- func (def *NilAction) ExtContent(ctx *context.Context) template.HTML
- func (def *NilAction) FooterContent(ctx *context.Context) template.HTML
- func (def *NilAction) GetCallbacks() context.Node
- func (def *NilAction) Js() template.JS
- func (def *NilAction) SetBtnData(data interface{})
- func (def *NilAction) SetBtnId(btnId string)
- type OptionArrInitFn
- type OptionInitFn
- type OptionProcessFn
- type OptionTable
- type OptionTableQueryProcessFn
- type Page
- type PaginatorAttribute
- type Panel
- type PanelInfo
- type PopupAttribute
- type PostFieldFilterFn
- type PostFieldModel
- type PostType
- type QueryFilterFn
- type Responder
- type RowAttribute
- type S
- type Sort
- type SystemInfo
- type TabGroups
- type TabHeaders
- type TableAttribute
- type TableInfo
- type TableRowData
- type TabsAttribute
- type Thead
- type TheadItem
- type TreeAttribute
- type TreeViewAttribute
- type TreeViewData
- type TreeViewItem
- type TreeViewItemState
- type TreeViewItems
- type UpdateParametersFn
- type Where
- type WhereRaw
- type Wheres
Constants ¶
const ( )
const ( )
const ( PostTypeCreate = iota PostTypeUpdate )
const DefaultPageSize = 10
DefaultPageSize 是默认页面大小
Variables ¶
var DefaultPageSizeList = []int{10, 20, 30, 50, 100}
DefaultPageSizeList 是默认页面大小列表
var JoinFieldValueDelimiter = utils.Uuid(8)
Functions ¶
func AddGlobalDisplayProcessFn ¶
func AddGlobalDisplayProcessFn(f FieldFilterFn)
AddGlobalDisplayProcessFn 添加全局显示处理函数
func GetJoinField ¶
func ParseTableDataTmpl ¶
func ParseTableDataTmpl(content interface{}) string
ParseTableDataTmpl 解析表格数据模板 参数:
- content: 模板内容
返回: 解析后的字符串
func ParseTableDataTmplWithID ¶
func ParseTableDataTmplWithID(id template.HTML, content string, value ...map[string]InfoItem) string
ParseTableDataTmplWithID 解析带ID的表格数据模板 参数:
- id: 行ID
- content: 模板内容
- value: 可选的值映射
返回: 解析后的字符串
func RegisterDisplayFnGenerator ¶
func RegisterDisplayFnGenerator(key string, gen DisplayFnGenerator)
RegisterDisplayFnGenerator 注册显示函数生成器
Types ¶
type Action ¶
type Action interface {
Js() template.JS // 获取JavaScript
BtnAttribute() template.HTML // 获取按钮属性
BtnClass() template.HTML // 获取按钮类名
ExtContent(ctx *context.Context) template.HTML // 获取扩展内容
SetBtnId(btnId string) // 设置按钮ID
SetBtnData(data interface{}) // 设置按钮数据
GetCallbacks() context.Node // 获取回调
}
Action 是操作接口
type ActionButton ¶
type ActionButton struct {
*BaseButton
}
ActionButton 是动作按钮结构体
func GetActionButton ¶
func GetActionButton(title template.HTML, action Action, ids ...string) *ActionButton
GetActionButton 创建动作按钮
type ActionIconButton ¶
type ActionIconButton struct {
Icon template.HTML // 图标
*BaseButton
}
ActionIconButton 是动作图标按钮结构体
func GetActionIconButton ¶
func GetActionIconButton(icon string, action Action, ids ...string) *ActionIconButton
GetActionIconButton 创建动作图标按钮
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 // 获取内容
}
AlertAttribute 警告属性接口
type BaseButton ¶
type BaseButton struct {
Id, Url, Method, Name, TypeName string // 按钮ID、URL、方法、名称和类型名称
Title template.HTML // 按钮标题
Action Action // 按钮动作
}
BaseButton 是按钮的基础结构体
type BaseDisplayFnGenerator ¶
type BaseDisplayFnGenerator struct{}
BaseDisplayFnGenerator 基础显示函数生成器结构体
func (*BaseDisplayFnGenerator) HTML ¶
func (base *BaseDisplayFnGenerator) HTML() template.HTML
func (*BaseDisplayFnGenerator) JS ¶
func (base *BaseDisplayFnGenerator) JS() template.HTML
type BoxAttribute ¶
type BoxAttribute interface {
SetHeader(value template.HTML) BoxAttribute // 设置头部
SetBody(value template.HTML) BoxAttribute // 设置主体
SetNoPadding() BoxAttribute // 设置无内边距
SetTitle(value template.HTML) BoxAttribute // 设置标题
WithHeadBorder() BoxAttribute // 设置头部边框
SetIframeStyle(iframe bool) BoxAttribute // 设置iframe样式
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 // 获取内容
}
BoxAttribute 盒子属性接口
type Button ¶
type Button interface {
// Content 返回按钮的HTML内容和JavaScript代码
Content(ctx *context.Context) (template.HTML, template.JS)
// GetAction 获取按钮的动作
GetAction() Action
// URL 返回按钮的URL
URL() string
// METHOD 返回按钮的HTTP方法
METHOD() string
// ID 返回按钮的ID
ID() string
// Type 返回按钮的类型
Type() string
// GetName 返回按钮的名称
GetName() string
// SetName 设置按钮的名称
SetName(name string)
// IsType 检查按钮是否为指定类型
IsType(t string) bool
}
Button 接口定义了按钮的基本行为
type ButtonAttribute ¶
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 // 设置ID
SetMiddleSize() ButtonAttribute // 设置中等尺寸
SetHref(string) ButtonAttribute // 设置链接地址
SetThemeWarning() ButtonAttribute // 设置警告主题
SetTheme(value string) ButtonAttribute // 设置主题
SetLoadingText(value template.HTML) ButtonAttribute // 设置加载文本
SetThemeDefault() ButtonAttribute // 设置默认主题
SetType(string) ButtonAttribute // 设置类型
GetContent() template.HTML // 获取内容
}
ButtonAttribute 按钮属性接口
type Buttons ¶
type Buttons []Button
Buttons 是按钮切片类型
func (Buttons) AddNavButton ¶
AddNavButton 添加导航按钮
func (Buttons) CheckPermission ¶
CheckPermission 检查用户是否有权限访问按钮
func (Buttons) CheckPermissionWhenURLAndMethodNotEmpty ¶
CheckPermissionWhenURLAndMethodNotEmpty 当URL和方法不为空时检查权限
func (Buttons) FooterContent ¶
FooterContent 生成所有按钮的页脚内容
func (Buttons) RemoveButtonByName ¶
RemoveButtonByName 根据名称移除按钮
func (Buttons) RemoveInfoNavButton ¶
RemoveInfoNavButton 移除站点信息导航按钮
func (Buttons) RemovePlugNavButton ¶
RemovePlugNavButton 移除插件导航按钮
func (Buttons) RemoveSiteNavButton ¶
RemoveSiteNavButton 移除站点设置导航按钮
func (Buttons) RemoveToolNavButton ¶
RemoveToolNavButton 移除工具导航按钮
type ColAttribute ¶
type ColAttribute interface {
SetSize(value S) ColAttribute // 设置大小
SetContent(value template.HTML) ColAttribute // 设置内容
AddContent(value template.HTML) ColAttribute // 添加内容
GetContent() template.HTML // 获取内容
}
ColAttribute 列属性接口
type Component ¶
type Component interface {
GetContent() template.HTML // 获取内容
GetJS() template.JS // 获取JavaScript
GetCSS() template.CSS // 获取样式
GetCallbacks() Callbacks // 获取回调
}
Component 是组件接口
type ContentWrapper ¶
ContentWrapper 是内容包装函数类型
type DataTableAttribute ¶
type DataTableAttribute interface {
GetDataTableHeader() template.HTML // 获取数据表格头部
SetThead(value Thead) DataTableAttribute // 设置表头
SetInfoList(value []map[string]InfoItem) DataTableAttribute // 设置信息列表
SetEditUrl(value string) DataTableAttribute // 设置编辑URL
SetDeleteUrl(value string) DataTableAttribute // 设置删除URL
SetNewUrl(value string) DataTableAttribute // 设置新建URL
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 // 设置操作JavaScript
SetNoAction() DataTableAttribute // 设置无操作
SetInfoUrl(value string) DataTableAttribute // 设置信息URL
SetDetailUrl(value string) DataTableAttribute // 设置详情URL
SetHasFilter(hasFilter bool) DataTableAttribute // 设置是否有过滤器
SetSortUrl(value string) DataTableAttribute // 设置排序URL
SetExportUrl(value string) DataTableAttribute // 设置导出URL
SetUpdateUrl(value string) DataTableAttribute // 设置更新URL
GetContent() template.HTML // 获取内容
}
DataTableAttribute 数据表格属性接口
type DefaultAction ¶
type DefaultAction struct {
Attr template.HTML // 属性
JS template.JS // JavaScript
Ext template.HTML // 扩展内容
}
DefaultAction 是默认操作结构体
func NewDefaultAction ¶
func NewDefaultAction(attr, ext, footer template.HTML, js template.JS) *DefaultAction
NewDefaultAction 创建默认操作 参数:
- attr: 属性HTML
- ext: 扩展内容HTML
- footer: 底部内容HTML
- js: JavaScript代码
返回: 默认操作对象
func (*DefaultAction) BtnAttribute ¶
func (def *DefaultAction) BtnAttribute() template.HTML
func (*DefaultAction) BtnClass ¶
func (def *DefaultAction) BtnClass() template.HTML
func (*DefaultAction) ExtContent ¶
func (def *DefaultAction) ExtContent(ctx *context.Context) template.HTML
func (*DefaultAction) FooterContent ¶
func (def *DefaultAction) FooterContent(ctx *context.Context) template.HTML
func (*DefaultAction) GetCallbacks ¶
func (def *DefaultAction) GetCallbacks() context.Node
func (*DefaultAction) Js ¶
func (def *DefaultAction) Js() template.JS
func (*DefaultAction) SetBtnData ¶
func (def *DefaultAction) SetBtnData(data interface{})
func (*DefaultAction) SetBtnId ¶
func (def *DefaultAction) SetBtnId(btnId string)
type DefaultButton ¶
type DefaultButton struct {
*BaseButton
Color template.HTML // 按钮背景色
TextColor template.HTML // 按钮文字颜色
Icon string // 按钮图标
Direction template.HTML // 按钮方向
Group bool // 是否为按钮组
}
DefaultButton 是默认按钮结构体
func GetColumnButton ¶
func GetColumnButton(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton
GetColumnButton 创建列按钮
func GetDefaultButton ¶
func GetDefaultButton(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton
GetDefaultButton 创建默认按钮
func GetDefaultButtonGroup ¶
func GetDefaultButtonGroup(title template.HTML, icon string, action Action, colors ...template.HTML) *DefaultButton
GetDefaultButtonGroup 创建默认按钮组
type DefaultSelection ¶
type DefaultSelection struct {
*BaseButton // 基础按钮
Options FieldOptions // 选项列表
Placeholder string // 占位符
Width int // 宽度
}
DefaultSelection 是默认选择框结构体
func GetDefaultSelection ¶
func GetDefaultSelection(placeholder string, options FieldOptions, action Action, widths ...int) *DefaultSelection
GetDefaultSelection 获取默认选择框 参数:
- placeholder: 占位符
- options: 选项列表
- action: 操作对象
- widths: 可选的宽度
返回: 默认选择框对象
type DeleteFnWithRes ¶
type DisplayFnGenerator ¶
type DisplayFnGenerator interface {
Get(ctx *context.Context, args ...interface{}) FieldFilterFn // 获取显示函数
JS() template.HTML // 返回JavaScript代码
HTML() template.HTML // 返回HTML代码
}
DisplayFnGenerator 显示函数生成器接口
type DisplayProcessFnChains ¶
type DisplayProcessFnChains []FieldFilterFn
DisplayProcessFnChains 显示处理函数链类型
func AddXssJsFilter ¶
func AddXssJsFilter() DisplayProcessFnChains
AddXssJsFilter 添加XSS JavaScript过滤处理函数到全局链
func (DisplayProcessFnChains) Add ¶
func (d DisplayProcessFnChains) Add(f FieldFilterFn) DisplayProcessFnChains
Add 添加处理函数到链中
func (DisplayProcessFnChains) Append ¶
func (d DisplayProcessFnChains) Append(f DisplayProcessFnChains) DisplayProcessFnChains
Append 追加处理函数链
func (DisplayProcessFnChains) Copy ¶
func (d DisplayProcessFnChains) Copy() DisplayProcessFnChains
Copy 复制处理函数链
type ExportProcessFn ¶
type ExportProcessFn func(param parameter.Parameters) (PanelInfo, error)
type Field ¶
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 表示表字段
func (Field) GetFilterFormFields ¶
func (f Field) GetFilterFormFields(params parameter.Parameters, headField string, sql ...*db.SQL) []FormField
GetFilterFormFields 获取筛选表单字段 参数:
- params: 参数对象
- headField: 头字段名
- sql: 可选的SQL对象
返回: 筛选表单字段列表
type FieldDisplay ¶
type FieldDisplay struct {
Display FieldFilterFn // 显示函数
DisplayProcessChains DisplayProcessFnChains // 显示处理函数链
}
FieldDisplay 字段显示结构体
func (FieldDisplay) AddLimit ¶
func (f FieldDisplay) AddLimit(limit int) DisplayProcessFnChains
AddLimit 添加长度限制处理函数
func (FieldDisplay) AddSubstr ¶
func (f FieldDisplay) AddSubstr(start int, end int) DisplayProcessFnChains
AddSubstr 添加子字符串处理函数
func (FieldDisplay) AddToLower ¶
func (f FieldDisplay) AddToLower() DisplayProcessFnChains
AddToLower 添加小写转换处理函数
func (FieldDisplay) AddToTitle ¶
func (f FieldDisplay) AddToTitle() DisplayProcessFnChains
AddToTitle 添加标题格式处理函数
func (FieldDisplay) AddToUpper ¶
func (f FieldDisplay) AddToUpper() DisplayProcessFnChains
AddToUpper 添加大写转换处理函数
func (FieldDisplay) AddTrimSpace ¶
func (f FieldDisplay) AddTrimSpace() DisplayProcessFnChains
AddTrimSpace 添加去除空格处理函数
func (FieldDisplay) IsNotSelectRes ¶
func (f FieldDisplay) IsNotSelectRes(v interface{}) bool
IsNotSelectRes 检查值是否不是选择结果
func (FieldDisplay) ToDisplay ¶
func (f FieldDisplay) ToDisplay(value FieldModel) interface{}
ToDisplay 将字段值转换为显示格式
func (FieldDisplay) ToDisplayHTML ¶
func (f FieldDisplay) ToDisplayHTML(value FieldModel) template.HTML
ToDisplayHTML 将字段值转换为HTML格式
func (FieldDisplay) ToDisplayString ¶
func (f FieldDisplay) ToDisplayString(value FieldModel) string
ToDisplayString 将字段值转换为字符串格式
func (FieldDisplay) ToDisplayStringArray ¶
func (f FieldDisplay) ToDisplayStringArray(value FieldModel) []string
ToDisplayStringArray 将字段值转换为字符串数组格式
func (FieldDisplay) ToDisplayStringArrayArray ¶
func (f FieldDisplay) ToDisplayStringArrayArray(value FieldModel) [][]string
ToDisplayStringArrayArray 将字段值转换为字符串二维数组格式
type FieldDotColor ¶
type FieldDotColor string
FieldDotColor 是字段点颜色类型
const ( FieldDotColorDanger FieldDotColor = "danger" // 危险颜色 FieldDotColorInfo FieldDotColor = "info" // 信息颜色 FieldDotColorPrimary FieldDotColor = "primary" // 主要颜色 FieldDotColorSuccess FieldDotColor = "success" // 成功颜色 )
type FieldGetImgArrFn ¶
FieldGetImgArrFn 是获取图片数组函数类型
type FieldLabelParam ¶
FieldLabelParam 是字段标签参数结构体
type FieldList ¶
type FieldList []Field
FieldList 是字段列表类型
func (FieldList) GetFieldByFieldName ¶
func (FieldList) GetFieldFilterProcessValue ¶
func (FieldList) GetFieldJoinTable ¶
func (FieldList) GetTheadAndFilterForm ¶
func (f FieldList) GetTheadAndFilterForm(info TableInfo, params parameter.Parameters, columns []string, sql ...func() *db.SQL) (Thead, string, string, string, []string, []FormField)
GetTheadAndFilterForm 获取表头和筛选表单 参数:
- info: 表信息
- params: 参数对象
- columns: 列名数组
- sql: 可选的SQL函数
返回: 表头、字段、关联字段、关联SQL、筛选表单
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{}
// Post type
PostType PostType
}
FieldModel is the single query result.
func (FieldModel) IsCreate ¶
func (m FieldModel) IsCreate() bool
func (FieldModel) IsUpdate ¶
func (m FieldModel) IsUpdate() bool
type FieldModelValue ¶
type FieldModelValue []string
FieldModelValue 是字段模型值类型
func (FieldModelValue) First ¶
func (r FieldModelValue) First() string
First 获取第一个值 返回: 第一个值,如果不存在则返回空字符串
type FieldOption ¶
type FieldOption struct {
Text string `json:"text"` // 选项显示的文本内容
Value string `json:"value"` // 选项的实际值
TextHTML template.HTML `json:"-"` // 选项的HTML格式文本
Selected bool `json:"-"` // 是否被选中
SelectedLabel template.HTML `json:"-"` // 选中状态的标签
Extra map[string]string `json:"-"` // 额外的属性配置
}
FieldOption 表示表单字段的选项配置
type FieldOptions ¶
type FieldOptions []FieldOption
FieldOptions 是 FieldOption 的切片类型,用于表示多个选项
func (FieldOptions) Copy ¶
func (fo FieldOptions) Copy() FieldOptions
Copy 创建 FieldOptions 的副本,返回一个新的选项列表
func (FieldOptions) Marshal ¶
func (fo FieldOptions) Marshal() string
Marshal 将 FieldOptions 序列化为 JSON 字符串 返回: JSON 格式的字符串,如果选项列表为空或序列化失败则返回空字符串
func (FieldOptions) SetSelected ¶
func (fo FieldOptions) SetSelected(val interface{}, labels []template.HTML) FieldOptions
SetSelected 根据给定的值设置选项的选中状态,并设置对应的标签 参数:
- val: 要匹配的值,可以是字符串数组或单个值
- labels: 包含两个元素的标签数组,第一个用于选中状态,第二个用于未选中状态
返回: 更新后的 FieldOptions
func (FieldOptions) SetSelectedLabel ¶
func (fo FieldOptions) SetSelectedLabel(labels []template.HTML) FieldOptions
SetSelectedLabel 为所有选项设置选中状态的标签 参数:
- labels: 包含两个元素的标签数组,第一个用于选中状态,第二个用于未选中状态
返回: 更新后的 FieldOptions
type FieldProgressBarData ¶
FieldProgressBarData 是进度条数据结构体
type FilterFormField ¶
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 // 处理函数
}
FilterFormField 是筛选表单字段结构体
type FilterOperator ¶
type FilterOperator string
FilterOperator 是筛选操作符类型
const ( FilterOperatorLike FilterOperator = "like" // 模糊匹配操作符 FilterOperatorGreater FilterOperator = ">" // 大于操作符 FilterOperatorGreaterOrEqual FilterOperator = ">=" // 大于等于操作符 FilterOperatorEqual FilterOperator = "=" // 等于操作符 FilterOperatorNotEqual FilterOperator = "!=" // 不等于操作符 FilterOperatorLess FilterOperator = "<" // 小于操作符 FilterOperatorLessOrEqual FilterOperator = "<=" // 小于等于操作符 FilterOperatorFree FilterOperator = "free" // 自由操作符 )
func GetOperatorFromValue ¶
func GetOperatorFromValue(value string) FilterOperator
GetOperatorFromValue 根据值获取对应的筛选操作符 参数:
- value: 操作符值字符串
返回: 对应的筛选操作符
func (FilterOperator) AddOrNot ¶
func (o FilterOperator) AddOrNot() bool
AddOrNot 判断是否需要添加操作符字段 对于空字符串、free和like操作符返回false,其他返回true 返回: 是否需要添加操作符字段
func (FilterOperator) Label ¶
func (o FilterOperator) Label() template.HTML
Label 返回操作符的标签HTML 对于like操作符返回空字符串,其他操作符返回其自身 返回: 操作符标签HTML
func (FilterOperator) String ¶
func (o FilterOperator) String() string
String 返回操作符的字符串表示 返回: 操作符字符串
type FilterType ¶
type FormAttribute ¶
type FormAttribute interface {
SetHeader(value template.HTML) FormAttribute // 设置表单头部
SetContent(value FormFields) FormAttribute // 设置表单内容
SetTabContents(value []FormFields) FormAttribute // 设置标签页内容
SetTabHeaders(value []string) FormAttribute // 设置标签页头部
SetPrefix(value string) FormAttribute // 设置前缀
SetUrl(value string) FormAttribute // 设置URL
SetPrimaryKey(value string) FormAttribute // 设置主键
SetHorizontal(value bool) FormAttribute // 设置水平布局
SetId(id string) FormAttribute // 设置ID
SetAjax(successJS, errorJS template.JS) FormAttribute // 设置AJAX成功和失败的JavaScript
SetHiddenFields(fields map[string]string) FormAttribute // 设置隐藏字段
SetFieldsHTML(html template.HTML) FormAttribute // 设置字段HTML
SetMethod(value string) FormAttribute // 设置HTTP方法
SetHeadWidth(width int) FormAttribute // 设置头部宽度
SetInputWidth(width int) FormAttribute // 设置输入框宽度
SetTitle(value template.HTML) FormAttribute // 设置标题
SetLayout(layout form.Layout) FormAttribute // 设置布局
GetDefaultBoxHeader(hideBack bool) template.HTML // 获取默认盒子头部
GetDetailBoxHeader(editUrl, deleteUrl string) template.HTML // 获取详情盒子头部
GetBoxHeaderNoButton() template.HTML // 获取无按钮的盒子头部
GetContent() template.HTML // 获取内容
}
FormAttribute 表单属性接口
type FormField ¶
type FormField struct {
Field string `json:"field"` // 字段名称
FieldClass string `json:"field_class"` // 字段CSS类名
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"` // 自定义JavaScript
CustomCss template.CSS `json:"custom_css"` // 自定义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"` // 选项扩展配置(JSON格式)
OptionExt2 template.JS `json:"option_ext_2"` // 选项扩展配置2(JSON格式)
OptionInitFn OptionInitFn `json:"-"` // 选项初始化函数
OptionArrInitFn OptionArrInitFn `json:"-"` // 选项数组初始化函数
OptionTable OptionTable `json:"-"` // 选项表配置
FieldDisplay `json:"-"` // 字段显示配置
PostFilterFn PostFieldFilterFn `json:"-"` // 后置过滤函数
}
FormField 是表单字段结构体,包含字段的各种配置选项
func (*FormField) FillCustomContent ¶
FillCustomContent 填充自定义内容,包括自定义HTML、JavaScript和CSS 返回: 更新后的 FormField 指针
func (*FormField) UpdateDefaultValue ¶
UpdateDefaultValue 更新字段默认值 参数:
- sql: SQL对象
返回: 更新后的 FormField 指针
type FormFields ¶
type FormFields []FormField
func (FormFields) Add ¶
func (f FormFields) Add(field *FormField) FormFields
func (FormFields) Copy ¶
func (f FormFields) Copy() FormFields
func (FormFields) FillCustomContent ¶
func (f FormFields) FillCustomContent() FormFields
func (FormFields) FindByFieldName ¶
func (f FormFields) FindByFieldName(field string) *FormField
func (FormFields) FindIndexByFieldName ¶
func (f FormFields) FindIndexByFieldName(field string) int
func (FormFields) FindTableChildren ¶
func (f FormFields) FindTableChildren(father string) []*FormField
func (FormFields) FindTableField ¶
func (f FormFields) FindTableField(field, father string) *FormField
func (FormFields) RemoveNotShow ¶
func (f FormFields) RemoveNotShow() FormFields
type FormPanel ¶
type FormPanel struct {
FieldList FormFields `json:"field_list"` // 字段列表
// 警告: 将来可能会被弃用 `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"` // HTML内容
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"` // 是否使用Ajax提交
AjaxSuccessJS template.JS `json:"ajax_success_js"` // Ajax成功回调JavaScript
AjaxErrorJS template.JS `json:"ajax_error_js"` // Ajax错误回调JavaScript
Responder Responder `json:"responder"` // 响应处理函数
Wrapper ContentWrapper `json:"wrapper"` // 内容包装器
HideSideBar bool `json:"hide_side_bar"` // 是否隐藏侧边栏
HeaderHtml template.HTML `json:"header_html"` // 头部HTML
PageError errors.PageError `json:"page_error"` // 页面错误
PageErrorHTML template.HTML `json:"page_error_html"` // 页面错误HTML
NoCompress bool `json:"no_compress"` // 是否不压缩
// contains filtered or unexported fields
}
FormPanel 是表单面板结构体,用于管理表单的所有配置和字段
func (*FormPanel) AddField ¶
func (f *FormPanel) AddField(head, field string, filedType db.DatabaseType, formType form2.Type) *FormPanel
AddField 添加一个字段到表单 参数:
- head: 字段标题
- field: 字段名
- filedType: 数据库类型
- formType: 表单类型
返回: 更新后的 FormPanel 指针
func (*FormPanel) AddFieldTr ¶
func (f *FormPanel) AddFieldTr(ctx *context.Context, head, field string, filedType db.DatabaseType, formType form2.Type) *FormPanel
AddFieldTr 添加带翻译的字段(AddFieldWithTranslation的别名) 参数:
- ctx: 上下文对象
- head: 字段标题
- field: 字段名
- filedType: 数据库类型
- formType: 表单类型
返回: 更新后的 FormPanel 指针
func (*FormPanel) AddFieldWithTranslation ¶
func (f *FormPanel) AddFieldWithTranslation(ctx *context.Context, head, field string, filedType db.DatabaseType, formType form2.Type) *FormPanel
AddFieldWithTranslation 添加带翻译的字段 参数:
- ctx: 上下文对象
- head: 字段标题
- field: 字段名
- filedType: 数据库类型
- formType: 表单类型
返回: 更新后的 FormPanel 指针
func (*FormPanel) AddRow ¶
func (f *FormPanel) AddRow(addFields AddFormFieldFn) *FormPanel
AddRow 添加一行字段 参数:
- addFields: 添加字段的函数
返回: 更新后的 FormPanel 指针
func (*FormPanel) AddSubstrFilter ¶
AddSubstrFilter 添加子字符串过滤器 参数:
- start: 起始位置
- end: 结束位置
返回: 更新后的 FormPanel 指针
func (*FormPanel) AddTable ¶
func (f *FormPanel) AddTable(head, field string, addFields AddFormFieldFn) *FormPanel
AddTable 添加一个表格类型的字段 参数:
- head: 字段标题
- field: 字段名
- addFields: 添加字段的函数
返回: 更新后的 FormPanel 指针
func (*FormPanel) AddToLowerFilter ¶
AddToLowerFilter 添加小写转换过滤器 返回: 更新后的 FormPanel 指针
func (*FormPanel) AddToTitleFilter ¶
AddToTitleFilter 添加标题转换过滤器(将字符串转为标题格式) 返回: 更新后的 FormPanel 指针
func (*FormPanel) AddToUpperFilter ¶
AddToUpperFilter 添加大写转换过滤器 返回: 更新后的 FormPanel 指针
func (*FormPanel) AddTrimSpaceFilter ¶
AddTrimSpaceFilter 添加去除空格过滤器 返回: 更新后的 FormPanel 指针
func (*FormPanel) AddXssFilter ¶
AddXssFilter 添加XSS过滤器 返回: 更新后的 FormPanel 指针
func (*FormPanel) AddXssJsFilter ¶
AddXssJsFilter 添加JavaScript XSS过滤器 返回: 更新后的 FormPanel 指针
func (*FormPanel) EnableAjax ¶
func (*FormPanel) EnableAjaxData ¶
func (*FormPanel) FieldCustomContent ¶
func (*FormPanel) FieldDefault ¶
func (*FormPanel) FieldDefaultOptionDelimiter ¶
func (*FormPanel) FieldDisableWhenCreate ¶
FieldDisableWhenCreate means when create record the field can not be edited, displayed and submitted.
func (*FormPanel) FieldDisableWhenUpdate ¶
FieldDisableWhenUpdate means when update record the field can not be edited, displayed and submitted.
func (*FormPanel) FieldDisplay ¶
func (f *FormPanel) FieldDisplay(filter FieldFilterFn) *FormPanel
FieldDisplay 设置字段显示函数 参数:
- filter: 字段过滤函数
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldDisplayButCanNotEditWhenCreate ¶
FieldDisplayButCanNotEditWhenCreate means when create record the field can not be edited but will still be displayed and submitted.
func (*FormPanel) FieldDisplayButCanNotEditWhenUpdate ¶
FieldDisplayButCanNotEditWhenUpdate means when update record the field can not be edited but will still be displayed and submitted.
func (*FormPanel) FieldEnableFileUpload ¶
FieldEnableFileUpload 启用文件上传功能 参数:
- data: 可选参数,第一个为上传URL,第二个为文件上传处理器
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldHeadWidth ¶
FieldHeadWidth 设置当前字段标题的宽度 参数:
- width: 标题宽度值
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldHideLabel ¶
FieldHideLabel 隐藏当前字段的标签 返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldHideWhenCreate ¶
FieldHideWhenCreate means when create record the field can not be edited and displayed, but will be submitted.
func (*FormPanel) FieldHideWhenUpdate ¶
FieldHideWhenUpdate means when update record the field can not be edited and displayed, but will be submitted.
func (*FormPanel) FieldInputWidth ¶
FieldInputWidth 设置当前字段输入框的宽度 参数:
- width: 输入框宽度值
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldLimit ¶
FieldLimit limit the field length.
func (*FormPanel) FieldNotAllowAdd ¶
FieldNotAllowAdd means when create record the field can not be edited, displayed and submitted. Deprecated: Use FieldDisableWhenCreate instead.
func (*FormPanel) FieldNotAllowEdit ¶
FieldNotAllowEdit means when update record the field can not be edited but will still be displayed and submitted. Deprecated: Use FieldDisplayButCanNotEditWhenUpdate instead.
func (*FormPanel) FieldNowWhenInsert ¶
func (*FormPanel) FieldNowWhenUpdate ¶
func (*FormPanel) FieldOnChoose ¶
FieldOnChoose set the given value of the given field when choose the value of val.
func (*FormPanel) FieldOnChooseAjax ¶
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 ¶
FieldOnChooseCustom set the js that will be called when filter option be selected.
func (*FormPanel) FieldOnChooseDisable ¶
FieldOnChooseDisable disable the fields when value to be chosen.
func (*FormPanel) FieldOnChooseHide ¶
FieldOnChooseHide hide the fields when value to be chosen.
func (*FormPanel) FieldOnChooseMap ¶
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 ¶
FieldOnChooseOptionsHide display the fields when value to be chosen.
func (*FormPanel) FieldOnChooseOptionsShow ¶
FieldOnChooseOptionsShow display the fields when values to be chosen.
func (*FormPanel) FieldOnChooseShow ¶
FieldFilterOnChooseShow display the fields when value to be chosen.
func (*FormPanel) FieldOnSearch ¶
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 ¶
FieldOptionExt 设置字段的选项扩展JavaScript配置 参数:
- m: 包含扩展配置的映射
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldOptionExt2 ¶
FieldOptionExt2 设置字段的第二个选项扩展JavaScript配置 参数:
- m: 包含扩展配置的映射
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldOptionExtJS ¶
FieldOptionExtJS 直接设置字段的选项扩展JavaScript 参数:
- js: JavaScript代码
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldOptionExtJS2 ¶
FieldOptionExtJS2 直接设置字段的第二个选项扩展JavaScript 参数:
- js: JavaScript代码
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldOptionInitFn ¶
func (f *FormPanel) FieldOptionInitFn(fn OptionInitFn) *FormPanel
FieldOptionInitFn 设置当前字段的选项初始化函数 参数:
- fn: 选项初始化函数
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldOptions ¶
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 ¶
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 ¶
func (f *FormPanel) FieldOptionsTableProcessFn(fn OptionProcessFn) *FormPanel
func (*FormPanel) FieldPlaceholder ¶
FieldPlaceholder 设置当前字段的占位符文本 参数:
- placeholder: 占位符文本
返回: 更新后的 FormPanel 指针
func (*FormPanel) FieldPostFilterFn ¶
func (f *FormPanel) FieldPostFilterFn(post PostFieldFilterFn) *FormPanel
func (*FormPanel) FieldSubstr ¶
FieldSubstr intercept string of the field.
func (*FormPanel) FieldToLower ¶
FieldToLower update the field to a string with all Unicode letters mapped to their lower case.
func (*FormPanel) FieldToTitle ¶
FieldToTitle update the field to a string that begin words mapped to their Unicode title case.
func (*FormPanel) FieldToUpper ¶
FieldToUpper update the field to a string with all Unicode letters mapped to their upper case.
func (*FormPanel) FieldTrimSpace ¶
FieldTrimSpace trim space of the field.
func (*FormPanel) FieldValue ¶
func (*FormPanel) FieldXssFilter ¶
FieldXssFilter escape field with html.Escape.
func (*FormPanel) FieldsWithDefaultValue ¶
func (f *FormPanel) FieldsWithDefaultValue(sql ...func() *db.SQL) FormFields
func (*FormPanel) FieldsWithValue ¶
func (*FormPanel) GetNewFormFields ¶
func (f *FormPanel) GetNewFormFields(sql ...func() *db.SQL) (FormFields, []FormFields, []string)
func (*FormPanel) GroupField ¶
func (f *FormPanel) GroupField(sql ...func() *db.SQL) ([]FormFields, []string)
func (*FormPanel) GroupFieldWithValue ¶
func (*FormPanel) HideBackButton ¶
HideBackButton 隐藏返回按钮 返回: 更新后的 FormPanel 指针
func (*FormPanel) HideContinueEditCheckBox ¶
HideContinueEditCheckBox 隐藏继续编辑复选框 返回: 更新后的 FormPanel 指针
func (*FormPanel) HideContinueNewCheckBox ¶
HideContinueNewCheckBox 隐藏继续新建复选框 返回: 更新后的 FormPanel 指针
func (*FormPanel) HideResetButton ¶
HideResetButton 隐藏重置按钮 返回: 更新后的 FormPanel 指针
func (*FormPanel) OperationURL ¶
func (*FormPanel) Set400Error ¶
func (*FormPanel) Set403Error ¶
func (*FormPanel) Set404Error ¶
func (*FormPanel) Set500Error ¶
func (*FormPanel) SetAjaxSuccessJS ¶
func (*FormPanel) SetDescription ¶
func (*FormPanel) SetFooterHtml ¶
func (*FormPanel) SetFormEditBtnWord ¶
func (*FormPanel) SetFormEditTitle ¶
func (*FormPanel) SetFormNewBtnWord ¶
func (*FormPanel) SetFormNewTitle ¶
func (*FormPanel) SetHTMLContent ¶
func (*FormPanel) SetHeadWidth ¶
func (*FormPanel) SetHeaderHtml ¶
func (*FormPanel) SetHideSideBar ¶
func (*FormPanel) SetInputWidth ¶
func (*FormPanel) SetInsertFn ¶
func (f *FormPanel) SetInsertFn(fn FormPostFn) *FormPanel
func (*FormPanel) SetNoCompress ¶
func (*FormPanel) SetPostHook ¶
func (f *FormPanel) SetPostHook(fn FormPostFn) *FormPanel
func (*FormPanel) SetPostValidator ¶
func (f *FormPanel) SetPostValidator(va FormPostFn) *FormPanel
func (*FormPanel) SetPreProcessFn ¶
func (f *FormPanel) SetPreProcessFn(fn FormPreProcessFn) *FormPanel
func (*FormPanel) SetPrimaryKey ¶
func (f *FormPanel) SetPrimaryKey(name string, typ db.DatabaseType) *FormPanel
SetPrimaryKey 设置主键 参数:
- name: 主键字段名
- typ: 数据库类型
返回: 更新后的 FormPanel 指针
func (*FormPanel) SetResponder ¶
func (*FormPanel) SetTabGroups ¶
func (*FormPanel) SetTabHeaders ¶
func (*FormPanel) SetUpdateFn ¶
func (f *FormPanel) SetUpdateFn(fn FormPostFn) *FormPanel
func (*FormPanel) SetWrapper ¶
func (f *FormPanel) SetWrapper(wrapper ContentWrapper) *FormPanel
type FormPostFn ¶
type GetPanelInfoFn ¶
GetPanelInfoFn 是获取面板信息的函数类型
type GroupFieldHeaders ¶
type GroupFieldHeaders []string
type GroupFormFields ¶
type GroupFormFields []FormFields
type ImgAttribute ¶
type ImgAttribute interface {
SetWidth(value string) ImgAttribute // 设置宽度
SetHeight(value string) ImgAttribute // 设置高度
WithModal() ImgAttribute // 使用模态框
SetSrc(value template.HTML) ImgAttribute // 设置源地址
GetContent() template.HTML // 获取内容
}
ImgAttribute 图片属性接口
type InfoItem ¶
type InfoItem struct {
Content template.HTML `json:"content"` // HTML内容
Value string `json:"value"` // 值
}
InfoItem 表示信息项
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
PageError errors.PageError
PageErrorHTML template.HTML
NoCompress bool
HideSideBar bool
AutoRefresh uint
// contains filtered or unexported fields
}
InfoPanel
func (*InfoPanel) AddActionButton ¶
func (i *InfoPanel) AddActionButton(ctx *context.Context, title template.HTML, action Action, ids ...string) *InfoPanel
AddActionButton 添加操作按钮 参数:
- ctx: 上下文对象
- title: 按钮标题
- action: 操作对象
- ids: 可选的ID列表
返回: 更新后的信息面板
func (*InfoPanel) AddActionButtonFront ¶
func (i *InfoPanel) AddActionButtonFront(ctx *context.Context, title template.HTML, action Action, ids ...string) *InfoPanel
AddActionButtonFront 在前面添加操作按钮 参数:
- ctx: 上下文对象
- title: 按钮标题
- action: 操作对象
- ids: 可选的ID列表
返回: 更新后的信息面板
func (*InfoPanel) AddActionIconButton ¶
func (i *InfoPanel) AddActionIconButton(ctx *context.Context, icon string, action Action, ids ...string) *InfoPanel
AddActionIconButton 添加操作图标按钮 参数:
- ctx: 上下文对象
- icon: 图标
- action: 操作对象
- ids: 可选的ID列表
返回: 更新后的信息面板
func (*InfoPanel) AddButton ¶
func (i *InfoPanel) AddButton(ctx *context.Context, title template.HTML, icon string, action Action, color ...template.HTML) *InfoPanel
AddButton 添加按钮 参数:
- ctx: 上下文对象
- title: 按钮标题
- icon: 图标
- action: 操作对象
- color: 可选的颜色
返回: 更新后的信息面板
func (*InfoPanel) AddButtonRaw ¶
AddButtonRaw 添加原始按钮 参数:
- ctx: 上下文对象
- btn: 按钮对象
- action: 操作对象
返回: 更新后的信息面板
func (*InfoPanel) AddColumn ¶
func (i *InfoPanel) AddColumn(head string, fun FieldFilterFn) *InfoPanel
AddColumn 添加列 参数:
- head: 列标题
- fun: 字段过滤函数
返回: 更新后的信息面板
func (*InfoPanel) AddColumnButtons ¶
func (i *InfoPanel) AddColumnButtons(ctx *context.Context, head string, buttons ...Button) *InfoPanel
AddColumnButtons 添加按钮列 参数:
- ctx: 上下文对象
- head: 列标题
- buttons: 按钮列表
返回: 更新后的信息面板
func (*InfoPanel) AddField ¶
func (i *InfoPanel) AddField(head, field string, typeName db.DatabaseType) *InfoPanel
AddField 添加字段 参数:
- head: 字段标题
- field: 字段名
- typeName: 数据库类型
返回: 更新后的信息面板
func (*InfoPanel) AddFieldTr ¶
func (i *InfoPanel) AddFieldTr(ctx *context.Context, head, field string, typeName db.DatabaseType) *InfoPanel
AddFieldTr 添加带翻译的字段 参数:
- ctx: 上下文对象
- head: 字段标题
- field: 字段名
- typeName: 数据库类型
返回: 更新后的信息面板
func (*InfoPanel) AddFieldWithTranslation ¶
func (i *InfoPanel) AddFieldWithTranslation(ctx *context.Context, head, field string, typeName db.DatabaseType) *InfoPanel
AddFieldWithTranslation 添加带翻译的字段 参数:
- ctx: 上下文对象
- head: 字段标题
- field: 字段名
- typeName: 数据库类型
返回: 更新后的信息面板
func (*InfoPanel) AddFilter ¶
func (i *InfoPanel) AddFilter(head, field string, typeName db.DatabaseType, fn UpdateParametersFn, filterType ...FilterType) *InfoPanel
AddFilter 添加筛选字段 参数:
- head: 字段标题
- field: 字段名
- typeName: 数据库类型
- fn: 更新参数函数
- filterType: 可选的筛选类型
返回: 更新后的信息面板
func (*InfoPanel) AddSelectBox ¶
func (i *InfoPanel) AddSelectBox(ctx *context.Context, placeholder string, options FieldOptions, action Action, width ...int) *InfoPanel
AddSelectBox 添加选择框 参数:
- ctx: 上下文对象
- placeholder: 占位符
- options: 选项列表
- action: 操作对象
- width: 可选的宽度
返回: 更新后的信息面板
func (*InfoPanel) AddSubstrFilter ¶
AddSubstrFilter 添加子字符串过滤器 参数:
- start: 起始位置
- end: 结束位置
返回: 更新后的信息面板
func (*InfoPanel) AddToLowerFilter ¶
AddToLowerFilter 添加小写过滤器 返回: 更新后的信息面板
func (*InfoPanel) AddToTitleFilter ¶
AddToTitleFilter 添加标题过滤器 返回: 更新后的信息面板
func (*InfoPanel) AddToUpperFilter ¶
AddToUpperFilter 添加大写过滤器 返回: 更新后的信息面板
func (*InfoPanel) AddTrimSpaceFilter ¶
AddTrimSpaceFilter 添加去空格过滤器 返回: 更新后的信息面板
func (*InfoPanel) AddUpdateParametersFn ¶
func (i *InfoPanel) AddUpdateParametersFn(fn UpdateParametersFn) *InfoPanel
AddUpdateParametersFn 添加更新参数函数 参数:
- fn: 更新参数函数
返回: 更新后的信息面板
func (*InfoPanel) AddXssFilter ¶
AddXssFilter 添加XSS过滤器 返回: 更新后的信息面板
func (*InfoPanel) AddXssJsFilter ¶
AddXssJsFilter 添加XSS JS过滤器 返回: 更新后的信息面板
func (*InfoPanel) ExportValue ¶
ExportValue 设置导出类型为值 返回: 更新后的信息面板
func (*InfoPanel) FieldAsDeleteParam ¶
func (*InfoPanel) FieldAsDetailParam ¶
func (*InfoPanel) FieldAsEditParam ¶
func (*InfoPanel) FieldCarousel ¶
func (i *InfoPanel) FieldCarousel(fn FieldGetImgArrFn, size ...int) *InfoPanel
FieldCarousel 设置字段为轮播图显示 参数:
- fn: 获取图片数组函数
- size: 可选的大小
返回: 更新后的信息面板
func (*InfoPanel) FieldDisplay ¶
func (i *InfoPanel) FieldDisplay(filter FieldFilterFn) *InfoPanel
FieldDisplay 设置字段显示函数 参数:
- filter: 字段过滤函数
返回: 更新后的信息面板
func (*InfoPanel) FieldDot ¶
func (i *InfoPanel) FieldDot(icons map[string]FieldDotColor, defaultDot FieldDotColor) *InfoPanel
FieldDot 设置字段为点显示 参数:
- icons: 图标映射
- defaultDot: 默认点颜色
返回: 更新后的信息面板
func (*InfoPanel) FieldEditAble ¶
func (*InfoPanel) FieldEditOptions ¶
func (i *InfoPanel) FieldEditOptions(options FieldOptions, extra ...map[string]string) *InfoPanel
func (*InfoPanel) FieldFileSize ¶
FieldFileSize 设置字段为文件大小显示 返回: 更新后的信息面板
func (*InfoPanel) FieldFilterOnChoose ¶
FieldFilterOnChoose set the given value of the given field when choose the value of val.
func (*InfoPanel) FieldFilterOnChooseAjax ¶
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 ¶
FieldFilterOnChooseCustom set the js that will be called when filter option be selected.
func (*InfoPanel) FieldFilterOnChooseDisable ¶
FieldFilterOnChooseDisable disable the fields when value to be chosen.
func (*InfoPanel) FieldFilterOnChooseHide ¶
FieldFilterOnChooseHide hide the fields when value to be chosen.
func (*InfoPanel) FieldFilterOnChooseMap ¶
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 ¶
FieldFilterOnChooseShow display the fields when value to be chosen.
func (*InfoPanel) FieldFilterOnSearch ¶
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 ¶
FieldFilterOptionExt set the option extension js of the field.
func (*InfoPanel) FieldFilterOptions ¶
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 ¶
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 ¶
FieldFilterProcess process the field content. For example:
FieldFilterProcess(func(val string) string {
return val + "ms"
})
func (*InfoPanel) FieldFilterable ¶
func (i *InfoPanel) FieldFilterable(filterType ...FilterType) *InfoPanel
FieldFilterable set a field filterable which will display in the filter box.
func (*InfoPanel) FieldFixed ¶
func (*InfoPanel) FieldHideForList ¶
FieldHide hide field for only the table.
func (*InfoPanel) FieldImage ¶
FieldImage 设置字段为图片显示 参数:
- width: 宽度
- height: 高度
- prefix: 可选的前缀
返回: 更新后的信息面板
func (*InfoPanel) FieldJoin ¶
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 ¶
func (i *InfoPanel) FieldLabel(args ...FieldLabelParam) *InfoPanel
FieldLabel 设置字段标签 参数:
- args: 标签参数
返回: 更新后的信息面板
func (*InfoPanel) FieldLimit ¶
FieldLimit limit the field length.
func (*InfoPanel) FieldLink ¶
FieldLink 设置字段为链接显示 参数:
- src: 链接地址
- openInNewTab: 是否在新标签页打开
返回: 更新后的信息面板
func (*InfoPanel) FieldProgressBar ¶
func (i *InfoPanel) FieldProgressBar(data ...FieldProgressBarData) *InfoPanel
FieldProgressBar 设置字段为进度条显示 参数:
- data: 进度条数据
返回: 更新后的信息面板
func (*InfoPanel) FieldQrcode ¶
FieldQrcode 设置字段为二维码显示 返回: 更新后的信息面板
func (*InfoPanel) FieldSortable ¶
FieldSortable 设置字段可排序 返回: 更新后的信息面板
func (*InfoPanel) FieldSubstr ¶
FieldSubstr intercept string of the field.
func (*InfoPanel) FieldToLower ¶
FieldToLower update the field to a string with all Unicode letters mapped to their lower case.
func (*InfoPanel) FieldToTitle ¶
FieldToTitle update the field to a string that begin words mapped to their Unicode title case.
func (*InfoPanel) FieldToUpper ¶
FieldToUpper update the field to a string with all Unicode letters mapped to their upper case.
func (*InfoPanel) FieldTrimSpace ¶
FieldTrimSpace trim space of the field.
func (*InfoPanel) FieldXssFilter ¶
FieldXssFilter escape field with html.Escape.
func (*InfoPanel) GetPageSizeList ¶
func (*InfoPanel) HideCheckBoxColumn ¶
func (*InfoPanel) HideColumn ¶
func (*InfoPanel) HideDeleteButton ¶
func (*InfoPanel) HideDetailButton ¶
func (*InfoPanel) HideEditButton ¶
func (*InfoPanel) HideExportButton ¶
func (*InfoPanel) HideFilterArea ¶
func (*InfoPanel) HideFilterButton ¶
func (*InfoPanel) HideNewButton ¶
func (*InfoPanel) HidePagination ¶
func (*InfoPanel) HideQueryInfo ¶
func (*InfoPanel) HideRowSelector ¶
func (*InfoPanel) IsExportValue ¶
IsExportValue 判断是否导出值 返回: 如果是导出值返回true,否则返回false
func (*InfoPanel) OperationURL ¶
OperationURL get the operation api url.
func (*InfoPanel) Set400Error ¶
func (*InfoPanel) Set403Error ¶
func (*InfoPanel) Set404Error ¶
func (*InfoPanel) Set500Error ¶
func (*InfoPanel) SetActionButtonFold ¶
SetActionButtonFold 设置操作按钮折叠 返回: 更新后的信息面板
func (*InfoPanel) SetAutoRefresh ¶
func (*InfoPanel) SetDefaultPageSize ¶
func (*InfoPanel) SetDeleteHookWithRes ¶
func (i *InfoPanel) SetDeleteHookWithRes(fn DeleteFnWithRes) *InfoPanel
SetDeleteHookWithRes 设置带结果的删除钩子 参数:
- fn: 带结果的删除函数
返回: 更新后的信息面板
func (*InfoPanel) SetDescription ¶
func (*InfoPanel) SetExportProcessFn ¶
func (i *InfoPanel) SetExportProcessFn(fn ExportProcessFn) *InfoPanel
SetExportProcessFn 设置导出处理函数 参数:
- fn: 导出处理函数
返回: 更新后的信息面板
func (*InfoPanel) SetFilterFormHeadWidth ¶
func (*InfoPanel) SetFilterFormInputWidth ¶
func (*InfoPanel) SetFilterFormLayout ¶
func (*InfoPanel) SetFooterHtml ¶
func (*InfoPanel) SetHeaderHtml ¶
func (*InfoPanel) SetHideSideBar ¶
func (*InfoPanel) SetNoCompress ¶
func (*InfoPanel) SetPageSizeList ¶
func (*InfoPanel) SetPrimaryKey ¶
func (i *InfoPanel) SetPrimaryKey(name string, typ db.DatabaseType) *InfoPanel
SetPrimaryKey 设置主键 参数:
- name: 主键名
- typ: 数据库类型
返回: 更新后的信息面板
func (*InfoPanel) SetQueryFilterFn ¶
func (i *InfoPanel) SetQueryFilterFn(fn QueryFilterFn) *InfoPanel
SetQueryFilterFn 设置查询过滤函数 参数:
- fn: 查询过滤函数
返回: 更新后的信息面板
func (*InfoPanel) SetSortAsc ¶
func (*InfoPanel) SetSortDesc ¶
func (*InfoPanel) SetSortField ¶
func (*InfoPanel) SetTabGroups ¶
func (*InfoPanel) SetTabHeaders ¶
func (*InfoPanel) SetTableFixed ¶
SetTableFixed 设置表格布局为固定 返回: 更新后的信息面板
func (*InfoPanel) SetWrapper ¶
func (i *InfoPanel) SetWrapper(wrapper ContentWrapper) *InfoPanel
SetWrapper 设置内容包装器 参数:
- wrapper: 内容包装函数
返回: 更新后的信息面板
type Join ¶
type Join struct {
Table string // 关联表名
TableAlias string // 表别名
Field string // 当前表字段
JoinField string // 关联表字段
BaseTable string // 基础表名
}
Join 存储关联表信息。例如:
Join {
BaseTable: "users",
Field: "role_id",
Table: "roles",
JoinField: "id",
}
它将生成如下关联表SQL:
... left join roles on roles.id = users.role_id ...
func (Join) GetTableName ¶
type LabelAttribute ¶
type LabelAttribute interface {
SetContent(value template.HTML) LabelAttribute // 设置内容
SetColor(value template.HTML) LabelAttribute // 设置颜色
SetType(value string) LabelAttribute // 设置类型
GetContent() template.HTML // 获取内容
}
LabelAttribute 标签属性接口
type LinkAttribute ¶
type LinkAttribute interface {
OpenInNewTab() LinkAttribute // 在新标签页打开
SetURL(value string) LinkAttribute // 设置URL
SetAttributes(attr template.HTMLAttr) LinkAttribute // 设置属性
SetClass(class template.HTML) LinkAttribute // 设置类名
NoPjax() LinkAttribute // 不使用pjax
SetTabTitle(value template.HTML) LinkAttribute // 设置标签页标题
SetContent(value template.HTML) LinkAttribute // 设置内容
GetContent() template.HTML // 获取内容
}
LinkAttribute 链接属性接口
type NavButton ¶
type NavButton struct {
}
NavButton 是导航按钮结构体
func GetNavButton ¶
GetNavButton 创建导航按钮
type NavDropDownButton ¶
type NavDropDownButton struct {
}
NavDropDownButton 是导航下拉按钮结构体
func GetDropDownButton ¶
func GetDropDownButton(title template.HTML, icon string, items []*NavDropDownItemButton, names ...string) *NavDropDownButton
GetDropDownButton 创建下拉按钮
func (*NavDropDownButton) AddItem ¶
func (n *NavDropDownButton) AddItem(item *NavDropDownItemButton)
AddItem 添加下拉菜单项
func (*NavDropDownButton) SetItems ¶
func (n *NavDropDownButton) SetItems(items []*NavDropDownItemButton)
SetItems 设置下拉菜单项
type NavDropDownItemButton ¶
type NavDropDownItemButton struct {
}
NavDropDownItemButton 是导航下拉菜单项按钮结构体
func GetDropDownItemButton ¶
func GetDropDownItemButton(title template.HTML, action Action, names ...string) *NavDropDownItemButton
GetDropDownItemButton 创建下拉菜单项按钮
type NewPageParam ¶
type NewPageParam struct {
User models.UserModel // 用户模型
Menu *menu.Menu // 菜单
UpdateMenu bool // 是否更新菜单
Panel Panel // 面板
Logo template.HTML // Logo
Assets template.HTML // 资源
Buttons Buttons // 按钮
Iframe bool // 是否以iframe加载
TmplHeadHTML template.HTML // 模板头部HTML
TmplFootJS template.HTML // 模板底部JS
}
NewPageParam 是创建新页面的参数结构体
type NilAction ¶
type NilAction struct{}
NilAction 是空操作结构体
func (*NilAction) BtnAttribute ¶
func (*NilAction) FooterContent ¶
func (*NilAction) GetCallbacks ¶
func (*NilAction) SetBtnData ¶
func (def *NilAction) SetBtnData(data interface{})
type OptionArrInitFn ¶
type OptionArrInitFn func(val FieldModel) []FieldOptions
OptionArrInitFn 是选项数组初始化函数类型,根据字段模型生成多个选项列表
type OptionInitFn ¶
type OptionInitFn func(val FieldModel) FieldOptions
OptionInitFn 是选项初始化函数类型,根据字段模型生成选项列表
type OptionProcessFn ¶
type OptionProcessFn func(options FieldOptions) FieldOptions
OptionProcessFn 是选项处理函数类型,用于对选项进行自定义处理
type OptionTable ¶
type OptionTable struct {
Table string // 数据库表名
TextField string // 用于显示文本的字段名
ValueField string // 用于值的字段名
QueryProcessFn OptionTableQueryProcessFn // 查询处理函数
ProcessFn OptionProcessFn // 选项处理函数
}
OptionTable 定义了从数据库表中获取选项的配置
type OptionTableQueryProcessFn ¶
OptionTableQueryProcessFn 是表查询处理函数类型,用于处理 SQL 查询
type Page ¶
type Page struct {
// User 是登录用户
User models.UserModel
// Menu 是模板的左侧菜单
Menu menu.Menu
// Panel 是模板的主要内容
Panel Panel
// System 包含一些系统信息
System SystemInfo
// UrlPrefix 是URL的前缀
UrlPrefix string
// Title 是网页的标题
Title string
// Logo 是模板的logo
Logo template.HTML
// MiniLogo 是模板的缩小版logo
MiniLogo template.HTML
// ColorScheme 是模板的颜色方案
ColorScheme string
// IndexUrl 是站点的主页URL
IndexUrl string
// AssetUrl 是资源的CDN链接
CdnUrl string
// Custom html in the tag head -> 自定义head标签内的HTML
CustomHeadHtml template.HTML
// Custom html after body -> 自定义body后的HTML
CustomFootHtml template.HTML
TmplHeadHTML template.HTML // 模板头部HTML
TmplFootJS template.HTML // 模板底部JS
// Components assets -> 组件资源
AssetsList template.HTML
FooterInfo template.HTML
// Load as Iframe or not -> 是否以iframe加载
Iframe bool
// Whether update menu or not -> 是否更新菜单
UpdateMenu bool
// contains filtered or unexported fields
}
Page 在模板中用作顶级变量
func NewPage ¶
func NewPage(ctx *context.Context, param *NewPageParam) *Page
NewPage 创建新页面 参数:
- ctx: 上下文对象
- param: 页面参数
返回: 页面对象
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 // 设置上一页URL
SetPages(value []map[string]string) PaginatorAttribute // 设置页码列表
SetPageSizeList(value []string) PaginatorAttribute // 设置每页条数列表
SetNextClass(value string) PaginatorAttribute // 设置下一页类名
SetNextUrl(value string) PaginatorAttribute // 设置下一页URL
SetOption(value map[string]template.HTML) PaginatorAttribute // 设置选项
SetUrl(value string) PaginatorAttribute // 设置URL
SetExtraInfo(value template.HTML) PaginatorAttribute // 设置额外信息
SetEntriesInfo(value template.HTML) PaginatorAttribute // 设置条目信息
GetContent() template.HTML // 获取内容
}
PaginatorAttribute 分页器属性接口
type Panel ¶
type Panel struct {
Title template.HTML // 标题
Description template.HTML // 描述
Content template.HTML // 内容
CSS template.CSS // 样式
JS template.JS // JavaScript
Url string // URL
// 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 包含模板的主要内容,用作pjax
type PanelInfo ¶
type PanelInfo struct {
Thead Thead `json:"thead"` // 表头
InfoList InfoList `json:"info_list"` // 信息列表
}
PanelInfo 面板信息结构体
type PopupAttribute ¶
type PopupAttribute interface {
SetID(value string) PopupAttribute // 设置ID
SetTitle(value template.HTML) PopupAttribute // 设置标题
SetDraggable() PopupAttribute // 设置可拖动
SetWidth(width string) PopupAttribute // 设置宽度
SetHeight(height string) PopupAttribute // 设置高度
SetBody(value template.HTML) PopupAttribute // 设置主体
SetSize(value string) PopupAttribute // 设置尺寸
GetContent() template.HTML // 获取内容
}
PopupAttribute 弹窗属性接口
type PostFieldFilterFn ¶
type PostFieldFilterFn func(value PostFieldModel) interface{}
PostFieldFilterFn 是数据过滤函数类型
type PostFieldModel ¶
type PostFieldModel struct {
ID string // 记录ID
Value FieldModelValue // 字段模型值
Row map[string]string // 当前行数据
// 提交类型
PostType PostType
}
PostFieldModel 包含单个查询结果的ID和值以及当前行数据
func (PostFieldModel) IsCreate ¶
func (m PostFieldModel) IsCreate() bool
IsCreate 判断是否为创建操作 返回: 如果是创建操作返回true,否则返回false
func (PostFieldModel) IsUpdate ¶
func (m PostFieldModel) IsUpdate() bool
IsUpdate 判断是否为更新操作 返回: 如果是更新操作返回true,否则返回false
type QueryFilterFn ¶
type QueryFilterFn func(param parameter.Parameters, conn db.Connection) (ids []string, stopQuery bool)
QueryFilterFn 是查询过滤函数类型
type RowAttribute ¶
type RowAttribute interface {
SetContent(value template.HTML) RowAttribute // 设置内容
AddContent(value template.HTML) RowAttribute // 添加内容
GetContent() template.HTML // 获取内容
}
RowAttribute 行属性接口
type SystemInfo ¶
SystemInfo 包含系统的基本信息
type TabHeaders ¶
type TabHeaders []string
func (TabHeaders) Add ¶
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 // 获取内容
}
TableAttribute 表格属性接口
type TableInfo ¶
type TableInfo struct {
Table string // 表名
PrimaryKey string // 主键
Delimiter string // 左分隔符
Delimiter2 string // 右分隔符
Driver string // 数据库驱动
}
TableInfo 是表信息结构体
type TableRowData ¶
type TableRowData struct {
Id template.HTML // 行ID
Ids template.HTML // 行ID列表
Value map[string]InfoItem // 值映射
}
TableRowData 是表格行数据结构体
type TabsAttribute ¶
type TabsAttribute interface {
SetData(value []map[string]template.HTML) TabsAttribute // 设置数据
GetContent() template.HTML // 获取内容
}
TabsAttribute 标签页属性接口
type TheadItem ¶
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"` // 宽度
}
TheadItem 表头项结构体
type TreeAttribute ¶
type TreeAttribute interface {
SetTree(value []menu.Item) TreeAttribute // 设置树数据
SetEditUrl(value string) TreeAttribute // 设置编辑URL
SetOrderUrl(value string) TreeAttribute // 设置排序URL
SetUrlPrefix(value string) TreeAttribute // 设置URL前缀
SetDeleteUrl(value string) TreeAttribute // 设置删除URL
GetContent() template.HTML // 获取内容
GetTreeHeader() template.HTML // 获取树头部
}
TreeAttribute 树属性接口
type TreeViewAttribute ¶
type TreeViewAttribute interface {
SetTree(value TreeViewData) TreeViewAttribute // 设置树数据
SetUrlPrefix(value string) TreeViewAttribute // 设置URL前缀
SetID(id string) TreeViewAttribute // 设置ID
GetContent() template.HTML // 获取内容
}
TreeViewAttribute 树视图属性接口
type TreeViewData ¶
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"` // 高亮搜索结果
}
TreeViewData 树视图数据结构体
type TreeViewItem ¶
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"` // 子节点列表
}
TreeViewItem 树视图项结构体
type TreeViewItemState ¶
type TreeViewItemState struct {
Checked bool `json:"checked,omitempty"` // 是否选中
Disabled bool `json:"disabled,omitempty"` // 是否禁用
Expanded bool `json:"expanded,omitempty"` // 是否展开
Selected bool `json:"selected,omitempty"` // 是否被选择
}
TreeViewItemState 树视图项状态结构体
type UpdateParametersFn ¶
type UpdateParametersFn func(param *parameter.Parameters)
UpdateParametersFn 是更新参数函数类型