mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-21 06:24:06 +01:00
♻️ Refactor av
This commit is contained in:
parent
67b8566047
commit
28095c5ef7
6 changed files with 112 additions and 87 deletions
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package av
|
||||
|
||||
// BaseLayout 描述了布局的基础结构,包含通用的过滤、排序和分页信息。
|
||||
// BaseLayout 描述了布局的基础结构。
|
||||
type BaseLayout struct {
|
||||
Spec int `json:"spec"` // 布局格式版本
|
||||
ID string `json:"id"` // 布局 ID
|
||||
|
|
@ -24,3 +24,32 @@ type BaseLayout struct {
|
|||
Sorts []*ViewSort `json:"sorts"` // 排序规则
|
||||
PageSize int `json:"pageSize"` // 每页行数
|
||||
}
|
||||
|
||||
// BaseValue 描述了字段值的基础结构。
|
||||
type BaseValue struct {
|
||||
ID string `json:"id"` // 字段值 ID
|
||||
Value *Value `json:"value"` // 字段值
|
||||
ValueType KeyType `json:"valueType"` // 字段值类型
|
||||
}
|
||||
|
||||
// BaseInstance 描述了实例的基础结构。
|
||||
type BaseInstance struct {
|
||||
ID string `json:"id"` // ID
|
||||
Icon string `json:"icon"` // 图标
|
||||
Name string `json:"name"` // 名称
|
||||
Desc string `json:"desc"` // 描述
|
||||
HideAttrViewName bool `json:"hideAttrViewName"` // 是否隐藏属性视图名称
|
||||
Filters []*ViewFilter `json:"filters"` // 过滤规则
|
||||
Sorts []*ViewSort `json:"sorts"` // 排序规则
|
||||
PageSize int `json:"pageSize"` // 每页项目
|
||||
}
|
||||
|
||||
// BaseInstanceField 描述了实例字段的基础结构。
|
||||
type BaseInstanceField struct {
|
||||
ID string `json:"id"` // ID
|
||||
Name string `json:"name"` // 字段名
|
||||
Type KeyType `json:"type"` // 字段类型
|
||||
Icon string `json:"icon"` // 字段图标
|
||||
Hidden bool `json:"hidden"` // 是否隐藏
|
||||
Desc string `json:"desc"` // 字段描述
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,17 +38,11 @@ type ViewGalleryCardField struct {
|
|||
|
||||
// Gallery 描述了画廊实例的结构。
|
||||
type Gallery struct {
|
||||
ID string `json:"id"` // 画廊布局 ID
|
||||
Icon string `json:"icon"` // 画廊图标
|
||||
Name string `json:"name"` // 画廊名称
|
||||
Desc string `json:"desc"` // 画廊描述
|
||||
HideAttrViewName bool `json:"hideAttrViewName"` // 是否隐藏属性视图名称
|
||||
Filters []*ViewFilter `json:"filters"` // 过滤规则
|
||||
Sorts []*ViewSort `json:"sorts"` // 排序规则
|
||||
Fields []*GalleryField `json:"fields"` // 画廊字段
|
||||
Cards []*GalleryCard `json:"cards"` // 画廊卡片
|
||||
CardCount int `json:"cardCount"` // 画廊总卡片数
|
||||
PageSize int `json:"pageSize"` // 每页卡片数
|
||||
*BaseInstance
|
||||
|
||||
Fields []*GalleryField `json:"fields"` // 画廊字段
|
||||
Cards []*GalleryCard `json:"cards"` // 画廊卡片
|
||||
CardCount int `json:"cardCount"` // 画廊总卡片数
|
||||
}
|
||||
|
||||
// GalleryCard 描述了画廊实例卡片的结构。
|
||||
|
|
@ -61,12 +55,7 @@ type GalleryCard struct {
|
|||
|
||||
// GalleryField 描述了画廊实例卡片字段的结构。
|
||||
type GalleryField struct {
|
||||
ID string `json:"id"` // 字段 ID
|
||||
Name string `json:"name"` // 字段名
|
||||
Type KeyType `json:"type"` // 字段类型
|
||||
Icon string `json:"icon"` // 字段图标
|
||||
Hidden bool `json:"hidden"` // 是否隐藏
|
||||
Desc string `json:"desc"` // 字段描述
|
||||
*BaseInstanceField
|
||||
|
||||
// 以下是某些字段类型的特有属性
|
||||
|
||||
|
|
@ -80,9 +69,7 @@ type GalleryField struct {
|
|||
|
||||
// GalleryFieldValue 描述了画廊实例字段值的结构。
|
||||
type GalleryFieldValue struct {
|
||||
ID string `json:"id"` // 字段值 ID
|
||||
Value *Value `json:"value"` // 字段值
|
||||
ValueType KeyType `json:"valueType"` // 字段值类型
|
||||
*BaseValue
|
||||
}
|
||||
|
||||
func (card *GalleryCard) GetBlockValue() (ret *Value) {
|
||||
|
|
|
|||
|
|
@ -42,31 +42,21 @@ type ViewTableColumn struct {
|
|||
|
||||
// Table 描述了表格实例的结构。
|
||||
type Table struct {
|
||||
ID string `json:"id"` // 表格布局 ID
|
||||
Icon string `json:"icon"` // 表格图标
|
||||
Name string `json:"name"` // 表格名称
|
||||
Desc string `json:"desc"` // 表格描述
|
||||
HideAttrViewName bool `json:"hideAttrViewName"` // 是否隐藏属性视图名称
|
||||
Filters []*ViewFilter `json:"filters"` // 过滤规则
|
||||
Sorts []*ViewSort `json:"sorts"` // 排序规则
|
||||
Columns []*TableColumn `json:"columns"` // 表格列
|
||||
Rows []*TableRow `json:"rows"` // 表格行
|
||||
RowCount int `json:"rowCount"` // 表格总行数
|
||||
PageSize int `json:"pageSize"` // 每页行数
|
||||
*BaseInstance
|
||||
|
||||
Columns []*TableColumn `json:"columns"` // 表格列
|
||||
Rows []*TableRow `json:"rows"` // 表格行
|
||||
RowCount int `json:"rowCount"` // 表格总行数
|
||||
}
|
||||
|
||||
// TableColumn 描述了表格实例列的结构。
|
||||
type TableColumn struct {
|
||||
ID string `json:"id"` // 列 ID
|
||||
Name string `json:"name"` // 列名
|
||||
Type KeyType `json:"type"` // 列类型
|
||||
Icon string `json:"icon"` // 列图标
|
||||
Wrap bool `json:"wrap"` // 是否换行
|
||||
Hidden bool `json:"hidden"` // 是否隐藏
|
||||
Pin bool `json:"pin"` // 是否固定
|
||||
Width string `json:"width"` // 列宽度
|
||||
Desc string `json:"desc"` // 列描述
|
||||
Calc *ColumnCalc `json:"calc"` // 计算
|
||||
*BaseInstanceField
|
||||
|
||||
Wrap bool `json:"wrap"` // 是否换行
|
||||
Pin bool `json:"pin"` // 是否固定
|
||||
Width string `json:"width"` // 列宽度
|
||||
Calc *ColumnCalc `json:"calc"` // 计算
|
||||
|
||||
// 以下是某些列类型的特有属性
|
||||
|
||||
|
|
@ -86,11 +76,10 @@ type TableRow struct {
|
|||
|
||||
// TableCell 描述了表格实例单元格的结构。
|
||||
type TableCell struct {
|
||||
ID string `json:"id"` // 单元格 ID
|
||||
Value *Value `json:"value"` // 单元格值
|
||||
ValueType KeyType `json:"valueType"` // 单元格值类型
|
||||
Color string `json:"color"` // 单元格颜色
|
||||
BgColor string `json:"bgColor"` // 单元格背景颜色
|
||||
*BaseValue
|
||||
|
||||
Color string `json:"color"` // 单元格颜色
|
||||
BgColor string `json:"bgColor"` // 单元格背景颜色
|
||||
}
|
||||
|
||||
func (row *TableRow) GetBlockValue() (ret *Value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue