Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertModeToMap(data any) map[string]any
- func InitializeTemplateFun() template.FuncMap
- type ActionType
- type EditSourceDataFun
- type Field
- type FieldDisplayFun
- type FieldList
- type FieldModel
- type Form
- func (f *Form) AddField(fieldName string, field string, formType Type) *Form
- func (f *Form) Default(defaultValue any) *Form
- func (f *Form) DefaultValueTow(defaultValue any) *Form
- func (f *Form) Disable() *Form
- func (f *Form) EditForm() *Form
- func (f *Form) Editable() *Form
- func (f *Form) GetField() FormFieldList
- func (f *Form) GetForm(data any) *Form
- func (f *Form) HelpMsg(msg string) *Form
- func (f *Form) HideBackButton(hideBackButton bool) *Form
- func (f *Form) NotAllowEdit(notAllowEdit bool) *Form
- func (f *Form) OptionGroup(optionGroups []OptionGroup) *Form
- func (f *Form) Options(options []SelectOption) *Form
- func (f *Form) ParseForm() *Form
- func (f *Form) Placeholder(label string) *Form
- func (f *Form) Readonly() *Form
- func (f *Form) Require() *Form
- func (f *Form) SetAction(actionType ActionType) *Form
- func (f *Form) SetEditSourceDataFun(fun EditSourceDataFun) *Form
- func (f *Form) SetModel(model handler.ModelAction) *Form
- func (f *Form) SetSelectedLabel(labels template.HTML) *Form
- func (f *Form) Unique() *Form
- type FormField
- type FormFieldList
- type Grid
- func (t *Grid) AddField(head string, field string) *Grid
- func (t *Grid) BaseUrl() string
- func (t *Grid) CurrentUrl(params ...any) string
- func (t *Grid) DisableAddData() *Grid
- func (t *Grid) DisableDelete() *Grid
- func (t *Grid) DisableDetail() *Grid
- func (t *Grid) DisableEdit() *Grid
- func (t *Grid) Display(displayFun FieldDisplayFun) *Grid
- func (t *Grid) EnableDelete() *Grid
- func (t *Grid) EnableDetail() *Grid
- func (t *Grid) EnableEdit() *Grid
- func (t *Grid) FieldSortable() *Grid
- func (t *Grid) GetField() FieldList
- func (t *Grid) GetSelectWhere() WhereClosure
- func (t *Grid) GetTable(pageData handler.PageData) *Grid
- func (t *Grid) Icon() *Grid
- func (t *Grid) Image() *Grid
- func (t *Grid) Label() *Grid
- func (t *Grid) Search(searchFields ...SearchField) *Grid
- func (t *Grid) SearchValue(params any) any
- func (t *Grid) SetInitSearch(optionGroups []OptionGroup, defaultValue string) *Grid
- func (t *Grid) SetSelectWhere(where WhereClosure) *Grid
- func (t *Grid) SetTips(tips string) *Grid
- type Info
- func (s *Info) AddField(fieldName string, field string, formType ...Type) *Info
- func (s *Info) Display(fun FieldDisplayFun) *Info
- func (s *Info) GetField() FormFieldList
- func (s *Info) GetInfo(data any) *Info
- func (s *Info) HelpMsg(msg string) *Info
- func (s *Info) HideBackButton(hideBackButton bool) *Info
- func (s *Info) Options(options []SelectOption) *Info
- func (s *Info) SetSelectedLabel(labels template.HTML) *Info
- type InitSearch
- type OptionGroup
- type SearchField
- type SelectOption
- type TableField
- type Type
- type Validator
- type ValidatorItem
- type ValidatorType
- type WhereClosure
Constants ¶
const StaticPath = "/static/application/server/resource"
StaticPath 静态文件路由地址
Variables ¶
var ValidatorList = map[string]map[ActionType]map[string][]ValidatorItem{}
ValidatorList 待验证数据集合 表:操作类型:字段:[]规则
Functions ¶
func ConvertModeToMap ¶
ConvertModeToMap 转换model 为map格式
func InitializeTemplateFun ¶
InitializeTemplateFun 定义模板方法
Types ¶
type EditSourceDataFun ¶
EditSourceDataFun 自定义编辑元数据修改方法
type Field ¶
type Field struct {
Field string
Row map[string]any
Value any
Display FieldDisplayFun
Label bool
Icon bool
Image bool
Array []string
}
Field 显示字段信息
type FieldList ¶
type FieldList []TableField
type FieldModel ¶
FieldModel display 元素
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Form Form表单
func (*Form) DefaultValueTow ¶
DefaultValueTow 默认值
func (*Form) HideBackButton ¶
HideBackButton 隐藏返回按钮
func (*Form) OptionGroup ¶
func (f *Form) OptionGroup(optionGroups []OptionGroup) *Form
OptionGroup 设置select标记的options数据
func (*Form) Options ¶
func (f *Form) Options(options []SelectOption) *Form
Options 设置select标记的options数据
func (*Form) SetAction ¶
func (f *Form) SetAction(actionType ActionType) *Form
func (*Form) SetEditSourceDataFun ¶
func (f *Form) SetEditSourceDataFun(fun EditSourceDataFun) *Form
SetEditSourceDataFun 增加当前字段编辑器修改方法
func (*Form) SetSelectedLabel ¶
SetSelectedLabel 设置select选择项
type FormField ¶
type FormField struct {
Field string
Value any
Value2 any
FormType Type
FieldName string
FieldClass string
Placeholder string
Must bool
HelpMsg string
NotAllowEdit bool
HideBackButton bool
Editable bool
NoIcon bool
Readonly bool
Validator []ValidatorItem
OptionGroups []OptionGroup
Options []SelectOption
SelectedLabel template.HTML
OptionExt template.JS
OptionExt2 template.JS
ValueArr []string
Label string
Display FieldDisplayFun
CustomContent any
CustomJs template.JS
CustomCss template.CSS
}
FormField form表单原数据定义
type Grid ¶
type Grid struct {
PageData handler.PageData
SearchFields []SearchField
// 页面提示
Tips string
DeleteAble bool
EditAble bool
DetailAble bool
// ===============================
Export bool
DataAdd bool
HasSearch bool
InitSearch InitSearch
// contains filtered or unexported fields
}
Grid 当前显示数据表格
func (*Grid) GetSelectWhere ¶
func (t *Grid) GetSelectWhere() WhereClosure
GetSelectWhere 获取当前数据查询条件
func (*Grid) SetInitSearch ¶
func (t *Grid) SetInitSearch(optionGroups []OptionGroup, defaultValue string) *Grid
SetInitSearch 设置提示
func (*Grid) SetSelectWhere ¶
func (t *Grid) SetSelectWhere(where WhereClosure) *Grid
SetSelectWhere 设置当前数据查询条件
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info 显示结构体
func (*Info) HideBackButton ¶
HideBackButton 隐藏返回按钮
type InitSearch ¶
type InitSearch struct {
OptionGroups []OptionGroup
DefaultValue string
}
type OptionGroup ¶
type OptionGroup struct {
Group string `json:"group"`
Options []SelectOption `json:"options"`
}
type SearchField ¶
SearchField 搜索字段定义
type SelectOption ¶
type SelectOption struct {
Text string `json:"text"`
Value string `json:"value"`
TextHTML template.HTML `json:"-"`
Selected bool `json:"-"`
SelectedLabel template.HTML `json:"-"`
Extra map[string]string `json:"-"`
}
SelectOption 下来框元数据
type TableField ¶
type TableField struct {
Field string
ShowName string
Sortable bool
Display FieldDisplayFun
Export bool
}
TableField table 元数据
type Type ¶
type Type uint8
Type 组件类型
const ( Default Type = iota Text Hidden SelectSingle SelectSingleGroup Select IconPicker SelectBox File Password RichText Datetime DatetimeRange Radio Checkbox CheckboxStacked CheckboxSingle Email Date DateRange Url Ip Color Array Currency Rate Number NumberRange TextArea Custom Switch Code Slider Image )
组件类型定义
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator(model handler.ModelAction) *Validator
func (*Validator) AddValidator ¶
func (v *Validator) AddValidator(actionType ActionType, formField FormField, validatorItem []ValidatorItem)
AddValidator 添加验证规则--内部方法
func (*Validator) DataValidator ¶
func (v *Validator) DataValidator(actionType ActionType, params map[string]string) error
DataValidator 添加验证方法 --内部
func (*Validator) SetBaseModel ¶
func (v *Validator) SetBaseModel(model *handler.CommonModel) *Validator
SetBaseModel 设置基础model
type ValidatorItem ¶
type ValidatorItem struct {
ValidatorType ValidatorType
ValidatorMsg string
}
ValidatorItem Validator 数据验证体定义
type ValidatorType ¶
type ValidatorType int
ValidatorType 验证类型
const ( ValidatorRequire ValidatorType = iota ValidatorUnique )
验证类型定义