mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
♻️ Refactor av
This commit is contained in:
parent
28095c5ef7
commit
9ab2033242
5 changed files with 37 additions and 46 deletions
|
|
@ -52,4 +52,13 @@ type BaseInstanceField struct {
|
||||||
Icon string `json:"icon"` // 字段图标
|
Icon string `json:"icon"` // 字段图标
|
||||||
Hidden bool `json:"hidden"` // 是否隐藏
|
Hidden bool `json:"hidden"` // 是否隐藏
|
||||||
Desc string `json:"desc"` // 字段描述
|
Desc string `json:"desc"` // 字段描述
|
||||||
|
|
||||||
|
// 以下是某些字段类型的特有属性
|
||||||
|
|
||||||
|
Options []*SelectOption `json:"options,omitempty"` // 选项列表
|
||||||
|
NumberFormat NumberFormat `json:"numberFormat"` // 数字字段格式化
|
||||||
|
Template string `json:"template"` // 模板字段内容
|
||||||
|
Relation *Relation `json:"relation,omitempty"` // 关联字段
|
||||||
|
Rollup *Rollup `json:"rollup,omitempty"` // 汇总字段
|
||||||
|
Date *Date `json:"date,omitempty"` // 日期设置
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,15 +56,6 @@ type GalleryCard struct {
|
||||||
// GalleryField 描述了画廊实例卡片字段的结构。
|
// GalleryField 描述了画廊实例卡片字段的结构。
|
||||||
type GalleryField struct {
|
type GalleryField struct {
|
||||||
*BaseInstanceField
|
*BaseInstanceField
|
||||||
|
|
||||||
// 以下是某些字段类型的特有属性
|
|
||||||
|
|
||||||
Options []*SelectOption `json:"options,omitempty"` // 选项字段表
|
|
||||||
NumberFormat NumberFormat `json:"numberFormat"` // 数字字段格式化
|
|
||||||
Template string `json:"template"` // 模板字段内容
|
|
||||||
Relation *Relation `json:"relation,omitempty"` // 关联字段
|
|
||||||
Rollup *Rollup `json:"rollup,omitempty"` // 汇总字段
|
|
||||||
Date *Date `json:"date,omitempty"` // 日期设置
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GalleryFieldValue 描述了画廊实例字段值的结构。
|
// GalleryFieldValue 描述了画廊实例字段值的结构。
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,6 @@ type TableColumn struct {
|
||||||
Pin bool `json:"pin"` // 是否固定
|
Pin bool `json:"pin"` // 是否固定
|
||||||
Width string `json:"width"` // 列宽度
|
Width string `json:"width"` // 列宽度
|
||||||
Calc *ColumnCalc `json:"calc"` // 计算
|
Calc *ColumnCalc `json:"calc"` // 计算
|
||||||
|
|
||||||
// 以下是某些列类型的特有属性
|
|
||||||
|
|
||||||
Options []*SelectOption `json:"options,omitempty"` // 选项列表
|
|
||||||
NumberFormat NumberFormat `json:"numberFormat"` // 数字列格式化
|
|
||||||
Template string `json:"template"` // 模板列内容
|
|
||||||
Relation *Relation `json:"relation,omitempty"` // 关联列
|
|
||||||
Rollup *Rollup `json:"rollup,omitempty"` // 汇总列
|
|
||||||
Date *Date `json:"date,omitempty"` // 日期设置
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableRow 描述了表格实例行的结构。
|
// TableRow 描述了表格实例行的结构。
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,19 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
|
||||||
|
|
||||||
ret.Fields = append(ret.Fields, &av.GalleryField{
|
ret.Fields = append(ret.Fields, &av.GalleryField{
|
||||||
BaseInstanceField: &av.BaseInstanceField{
|
BaseInstanceField: &av.BaseInstanceField{
|
||||||
ID: key.ID,
|
ID: key.ID,
|
||||||
Name: key.Name,
|
Name: key.Name,
|
||||||
Type: key.Type,
|
Type: key.Type,
|
||||||
Icon: key.Icon,
|
Icon: key.Icon,
|
||||||
Hidden: field.Hidden,
|
Hidden: field.Hidden,
|
||||||
Desc: key.Desc,
|
Desc: key.Desc,
|
||||||
|
Options: key.Options,
|
||||||
|
NumberFormat: key.NumberFormat,
|
||||||
|
Template: key.Template,
|
||||||
|
Relation: key.Relation,
|
||||||
|
Rollup: key.Rollup,
|
||||||
|
Date: key.Date,
|
||||||
},
|
},
|
||||||
Options: key.Options,
|
|
||||||
NumberFormat: key.NumberFormat,
|
|
||||||
Template: key.Template,
|
|
||||||
Relation: key.Relation,
|
|
||||||
Rollup: key.Rollup,
|
|
||||||
Date: key.Date,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,23 +52,23 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
|
||||||
|
|
||||||
ret.Columns = append(ret.Columns, &av.TableColumn{
|
ret.Columns = append(ret.Columns, &av.TableColumn{
|
||||||
BaseInstanceField: &av.BaseInstanceField{
|
BaseInstanceField: &av.BaseInstanceField{
|
||||||
ID: key.ID,
|
ID: key.ID,
|
||||||
Name: key.Name,
|
Name: key.Name,
|
||||||
Type: key.Type,
|
Type: key.Type,
|
||||||
Icon: key.Icon,
|
Icon: key.Icon,
|
||||||
Hidden: col.Hidden,
|
Hidden: col.Hidden,
|
||||||
Desc: key.Desc,
|
Desc: key.Desc,
|
||||||
|
Options: key.Options,
|
||||||
|
NumberFormat: key.NumberFormat,
|
||||||
|
Template: key.Template,
|
||||||
|
Relation: key.Relation,
|
||||||
|
Rollup: key.Rollup,
|
||||||
|
Date: key.Date,
|
||||||
},
|
},
|
||||||
Options: key.Options,
|
Wrap: col.Wrap,
|
||||||
NumberFormat: key.NumberFormat,
|
Width: col.Width,
|
||||||
Template: key.Template,
|
Pin: col.Pin,
|
||||||
Relation: key.Relation,
|
Calc: col.Calc,
|
||||||
Rollup: key.Rollup,
|
|
||||||
Date: key.Date,
|
|
||||||
Wrap: col.Wrap,
|
|
||||||
Width: col.Width,
|
|
||||||
Pin: col.Pin,
|
|
||||||
Calc: col.Calc,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue