🎨 Database supports setting display field icons https://github.com/siyuan-note/siyuan/issues/15089

This commit is contained in:
Daniel 2025-06-30 15:06:43 +08:00
parent 921cddd2fa
commit 1991e2b76f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 60 additions and 51 deletions

View file

@ -223,10 +223,10 @@ func NewTableViewWithBlockKey(blockKeyID string) (view *View, blockKey, selectKe
Table: NewLayoutTable(),
}
blockKey = NewKey(blockKeyID, GetAttributeViewI18n("key"), "", KeyTypeBlock)
view.Table.Columns = []*ViewTableColumn{{ID: blockKeyID}}
view.Table.Columns = []*ViewTableColumn{{BaseField: &BaseField{ID: blockKeyID}}}
selectKey = NewKey(ast.NewNodeID(), GetAttributeViewI18n("select"), "", KeyTypeSelect)
view.Table.Columns = append(view.Table.Columns, &ViewTableColumn{ID: selectKey.ID})
view.Table.Columns = append(view.Table.Columns, &ViewTableColumn{BaseField: &BaseField{ID: selectKey.ID}})
return
}

View file

@ -36,6 +36,14 @@ type BaseLayout struct {
PageSize int `json:"pageSize,omitempty"` // 每页条目数
}
// BaseField 描述了字段的基础结构。
type BaseField struct {
ID string `json:"id"` // 字段 ID
Wrap bool `json:"wrap"` // 是否换行
Hidden bool `json:"hidden"` // 是否隐藏
Desc string `json:"desc,omitempty"` // 字段描述
}
// BaseValue 描述了字段值的基础结构。
type BaseValue struct {
ID string `json:"id"` // 字段值 ID

View file

@ -82,11 +82,7 @@ const (
// ViewGalleryCardField 描述了画廊卡片字段的结构。
type ViewGalleryCardField struct {
ID string `json:"id"` // 字段 ID
Wrap bool `json:"wrap"` // 是否换行
Hidden bool `json:"hidden"` // 是否隐藏
Desc string `json:"desc,omitempty"` // 字段描述
*BaseField
}
// Gallery 描述了画廊实例的结构。

View file

@ -44,14 +44,11 @@ func NewLayoutTable() *LayoutTable {
// ViewTableColumn 描述了表格列的结构。
type ViewTableColumn struct {
ID string `json:"id"` // 列 ID
*BaseField
Wrap bool `json:"wrap"` // 是否换行
Hidden bool `json:"hidden"` // 是否隐藏
Pin bool `json:"pin"` // 是否固定
Width string `json:"width"` // 列宽度
Desc string `json:"desc,omitempty"` // 列描述
Calc *ColumnCalc `json:"calc,omitempty"` // 计算
Pin bool `json:"pin"` // 是否固定
Width string `json:"width"` // 列宽度
Calc *ColumnCalc `json:"calc,omitempty"` // 计算
}
// Table 描述了表格实例的结构。