[feat] GridLayout 和 GridLayoutForm 支持

This commit is contained in:
what 2023-06-12 11:44:52 +08:00
parent a72e15f305
commit cffbf8eef0
4 changed files with 118 additions and 0 deletions

24
base/grid_layout.go Normal file
View File

@ -0,0 +1,24 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type GridLayout struct {
Uuid string `db:"uuid"`
ResourceUuid string `db:"resource_uuid"` // 所属资源UUID
Code string `db:"code"` // 布局标识
Name string `db:"name"` // 布局名称
PrimaryKey string `db:"primaryKey"` // 主键
MarginX int `db:"marginX"` // 栅格 x 间距
MarginY int `db:"marginY"` // 栅格 y 间距
Cols int `db:"cols"` // 网格列基数
RowHeight int `db:"rowHeight"` // 栅格行高
Css res_type.ResFieldByMap `db:"css"` // 布局CSS
Props res_type.ResFieldByAnys `db:"props"` // 布局PROPS
Roles res_type.ResFieldByAnys `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}
type GetGridLayout func(code string) (GridLayout, bool)

32
base/grid_layout_field.go Normal file
View File

@ -0,0 +1,32 @@
package base
import "git.fsdpf.net/go/contracts/res_type"
type GridLayoutField struct {
Uuid string `db:"uuid"`
GridLayoutUuid string `db:"grid_layout_uuid"` // 所属布局 UUID
Type string `db:"type"`
X int `db:"x"`
Y int `db:"y"`
W int `db:"w"`
H int `db:"h"`
MinH int `db:"minH"`
MinW int `db:"minW"`
MaxH int `db:"maxH"`
MaxW int `db:"maxW"`
Code string `db:"code"`
Label string `db:"label"`
Widget string `db:"widget"`
WidgetPerfix string `db:"widgetPerfix"`
WidgetDecorator res_type.ResFieldByString `db:"widgetDecorator"`
SubWidgets res_type.ResFieldByAnys `db:"subWidgets"`
InitialValue string `db:"initialValue"`
Css res_type.ResFieldByMap `db:"css"`
Extras res_type.ResFieldByMap `db:"extras"`
Hidden bool `db:"hidden"`
IsVirtual bool `db:"isVirtual"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}
type GetGridLayoutField func(code string) (GridLayoutField, bool)

25
base/grid_layout_form.go Normal file
View File

@ -0,0 +1,25 @@
package base
import "git.fsdpf.net/go/contracts/res_type"
type GridLayoutForm struct {
Uuid string `db:"uuid"`
ResourceUuid string `db:"resource_uuid"` // 所属资源UUID
Code string `db:"code"` // 布局标识
Name string `db:"name"` // 布局名称
Type int `db:"type"` // 布局类型
Align string `db:"align"` // 方向
PrimaryKey string `db:"primaryKey"` // 主键
AutoComplete string `db:"autoComplete"` // 自动填充表单, off | on
RowHeight int `db:"rowHeight"` // 栅格行高
MarginX int `db:"marginX"` // 栅格 x 间距
MarginY int `db:"marginY"` // 栅格 y 间距
FormProps res_type.ResFieldByAnys `db:"formProps"` // 表单PROPS
ListenChangeFields res_type.ResFieldByAnys `db:"listenChangeFields"` // 监听字段
ListenChangeFieldsFunc res_type.ResFieldByString `db:"listenChangeFieldsFunc"` // 监听字段回调方法
Roles res_type.ResFieldByAnys `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}
type GetGridLayoutForm func(code string) (GridLayoutForm, bool)

View File

@ -0,0 +1,37 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type GridLayoutFormField struct {
Uuid string `db:"uuid"`
GridLayoutFormUuid string `db:"grid_layout_form_uuid"` // 所属布局 UUID
Type string `db:"type"`
X int `db:"x"`
Y int `db:"y"`
W int `db:"w"`
H int `db:"h"`
MinH int `db:"minH"`
MinW int `db:"minW"`
MaxH int `db:"maxH"`
MaxW int `db:"maxW"`
Code string `db:"code"`
Label string `db:"label"`
Widget string `db:"widget"`
WidgetPerfix string `db:"widgetPerfix"`
WidgetDecorator res_type.ResFieldByString `db:"widgetDecorator"`
SubWidgets res_type.ResFieldByAnys `db:"subWidgets"`
Placeholder string `db:"placeholder"`
Help string `db:"help"`
Disabled int `db:"disabled"`
InitialValue string `db:"initialValue"`
Extras res_type.ResFieldByMap `db:"extras"`
Validators res_type.ResFieldByMap `db:"validators"`
Hidden bool `db:"hidden"`
IsVirtual bool `db:"isVirtual"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}
type GetGridLayoutFormFields func(uuid string) []GridLayoutFormField