Daniel 2025-06-30 12:50:50 +08:00
parent 60d44fec3d
commit 3c21d39e52
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 52 additions and 23 deletions

View file

@ -23,6 +23,9 @@ type BaseLayout struct {
Spec int `json:"spec"` // 布局格式版本
ID string `json:"id"` // 布局 ID
ShowIcon bool `json:"showIcon"` // 是否显示字段图标
WrapField bool `json:"wrapField"` // 是否换行字段内容
// TODO 以下三个字段已经废弃,计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15162
//Deprecated
@ -51,6 +54,8 @@ type BaseInstance struct {
Sorts []*ViewSort `json:"sorts"` // 排序规则
Group *ViewGroup `json:"group"` // 分组规则
PageSize int `json:"pageSize"` // 每页项目数
ShowIcon bool `json:"showIcon"` // 是否显示字段图标
WrapField bool `json:"wrapField"` // 是否换行字段内容
}
func (baseInstance *BaseInstance) GetSorts() []*ViewSort {
@ -64,11 +69,12 @@ func (baseInstance *BaseInstance) GetFilters() []*ViewFilter {
// BaseInstanceField 描述了实例字段的基础结构。
type BaseInstanceField struct {
ID string `json:"id"` // ID
Name string `json:"name"` // 字段名
Type KeyType `json:"type"` // 字段类型
Icon string `json:"icon"` // 字段图标
Name string `json:"name"` // 名称
Type KeyType `json:"type"` // 类型
Icon string `json:"icon"` // 图标
Wrap bool `json:"wrap"` // 是否换行
Hidden bool `json:"hidden"` // 是否隐藏
Desc string `json:"desc"` // 字段描述
Desc string `json:"desc"` // 描述
// 以下是某些字段类型的特有属性

View file

@ -29,8 +29,6 @@ type LayoutGallery struct {
CardAspectRatio CardAspectRatio `json:"cardAspectRatio"` // 卡片宽高比
CardSize CardSize `json:"cardSize"` // 卡片大小0小卡片1中卡片2大卡片
FitImage bool `json:"fitImage"` // 是否适应封面图片大小
ShowIcon bool `json:"showIcon"` // 是否显示字段图标
WrapField bool `json:"wrapField"` // 是否换行字段内容
CardFields []*ViewGalleryCardField `json:"fields"` // 画廊卡片字段
CardIDs []string `json:"cardIds"` // 卡片 ID用于自定义排序
@ -43,13 +41,13 @@ func (layoutGallery *LayoutGallery) GetItemIDs() (ret []string) {
func NewLayoutGallery() *LayoutGallery {
return &LayoutGallery{
BaseLayout: &BaseLayout{
Spec: 0,
ID: ast.NewNodeID(),
Spec: 0,
ID: ast.NewNodeID(),
ShowIcon: true,
},
CoverFrom: CoverFromContentImage,
CardAspectRatio: CardAspectRatio16_9,
CardSize: CardSizeMedium,
ShowIcon: true,
}
}
@ -86,6 +84,7 @@ const (
type ViewGalleryCardField struct {
ID string `json:"id"` // 字段 ID
Wrap bool `json:"wrap"` // 是否换行
Hidden bool `json:"hidden"` // 是否隐藏
Desc string `json:"desc,omitempty"` // 字段描述
}

View file

@ -35,8 +35,9 @@ func (layoutTable *LayoutTable) GetItemIDs() (ret []string) {
func NewLayoutTable() *LayoutTable {
return &LayoutTable{
BaseLayout: &BaseLayout{
Spec: 0,
ID: ast.NewNodeID(),
Spec: 0,
ID: ast.NewNodeID(),
ShowIcon: true,
},
}
}
@ -66,7 +67,6 @@ type Table struct {
type TableColumn struct {
*BaseInstanceField
Wrap bool `json:"wrap"` // 是否换行
Pin bool `json:"pin"` // 是否固定
Width string `json:"width"` // 列宽度
Calc *ColumnCalc `json:"calc"` // 计算