package base

import (
	"git.fsdpf.net/go/contracts/res_type"
)

type DataListField struct {
	Uuid                string                    `db:"uuid"`
	DataListUuid        string                    `db:"data_list_uuid"`      // 所属列表 UUID
	Title               res_type.ResFieldByString `db:"title"`               // 列表标题
	Code                string                    `db:"code"`                // 字段名称
	CodeResource        string                    `db:"codeResource"`        // 字段所属资源
	Alias               string                    `db:"alias"`               // 字段别名
	IsExpr              bool                      `db:"isExpr"`              // 字段名是否为SQL表达式
	FieldDataType       string                    `db:"fieldDataType"`       // 字段数据类型
	Width               int                       `db:"width"`               // 列宽
	IsWidthFixed        bool                      `db:"isWidthFixed"`        // 列宽固定
	Fixed               bool                      `db:"fixed"`               // 字段冻结
	Align               string                    `db:"align"`               // 对齐方式
	IsShow              int                       `db:"isShow"`              // 是否显示
	WidgetByJs          string                    `db:"widgetByJs"`          // 前端数据渲染控件
	WidgetByJsSetting   res_type.ResFieldByMap    `db:"widgetByJsSetting"`   // 前端数据渲染控件设置参数
	IsSearch            bool                      `db:"isSearch"`            // 允许关键字搜索
	IsVirtual           bool                      `db:"isVirtual"`           // 是否虚拟字段
	IsSort              bool                      `db:"isSort"`              // 允许字段排序
	EditableByJs        string                    `db:"editableByJs"`        // 字段更新组件
	EditableByJsSetting res_type.ResFieldByMap    `db:"editableByJsSetting"` // 字段更新组件设置
	FilterByJs          string                    `db:"filterByJs"`          // 字段筛选组件
	FilterByJsSetting   res_type.ResFieldByMap    `db:"filterByJsSetting"`   // 字段筛选组件设置参数
	FilterOperator      string                    `db:"filterOperator"`      // 字段筛选符号
	EditableRoles       res_type.ResFieldByAnys   `db:"editableRoles"`       // 字段编辑权限
	UpdatedAt           string                    `db:"updated_at"`
	CreatedAt           string                    `db:"created_at"`
}

type GetDataListFields func(listUuid string) []DataListField