Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2025-06-29 17:53:41 +08:00
commit af468c3dd2
5 changed files with 22 additions and 12 deletions

View file

@ -247,6 +247,7 @@ func NewGalleryView() (ret *View) {
type Viewable interface {
Filterable
Sortable
Groupable
Calculable
GetType() LayoutType

View file

@ -34,7 +34,7 @@ func upgradeSpec2(av *AttributeView) {
return
}
// 如果存在 view.table.filters/sorts/pageSize 则复制覆盖到 view.filters/sorts/pageSize 下后置空
// 如果存在 view.table.filters/sorts/pageSize 则复制覆盖到 view.filters/sorts/pageSize
for _, view := range av.Views {
if 1 > len(view.Filters) {
view.Filters = []*ViewFilter{}
@ -47,17 +47,14 @@ func upgradeSpec2(av *AttributeView) {
}
if nil != view.Table {
if 0 < len(view.Table.Filters) {
if 0 < len(view.Table.Filters) && 1 > len(view.Filters) {
view.Filters = append(view.Filters, view.Table.Filters...)
view.Table.Filters = nil
}
if 0 < len(view.Table.Sorts) {
if 0 < len(view.Table.Sorts) && 1 > len(view.Sorts) {
view.Sorts = append(view.Sorts, view.Table.Sorts...)
view.Table.Sorts = nil
}
if 0 < view.Table.PageSize {
view.PageSize = view.Table.PageSize
view.Table.PageSize = 0
}
}
@ -80,7 +77,7 @@ func upgradeSpec2(av *AttributeView) {
}
av.Spec = 2
logging.LogInfof("av [%s] upgraded to spec 2", av.ID)
logging.LogInfof("av [%s] upgraded to spec [%d]", av.ID, av.Spec)
}
func upgradeSpec1(av *AttributeView) {
@ -213,5 +210,5 @@ func upgradeSpec1(av *AttributeView) {
}
av.Spec = 1
logging.LogInfof("av [%s] upgraded to spec 1", av.ID)
logging.LogInfof("av [%s] upgraded to spec [%d]", av.ID, av.Spec)
}

View file

@ -23,14 +23,14 @@ type BaseLayout struct {
Spec int `json:"spec"` // 布局格式版本
ID string `json:"id"` // 布局 ID
// 以下三个字段已经废弃,计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15162
// TODO 以下三个字段已经废弃,计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15162
//Deprecated
Filters []*ViewFilter `json:"filters,omitempty"` //Deprecated 过滤规则
Filters []*ViewFilter `json:"filters,omitempty"` // 过滤规则
//Deprecated
Sorts []*ViewSort `json:"sorts,omitempty"` //Deprecated 排序规则
Sorts []*ViewSort `json:"sorts,omitempty"` // 排序规则
//Deprecated
PageSize int `json:"pageSize,omitempty"` //Deprecated 每页条目数
PageSize int `json:"pageSize,omitempty"` // 每页条目数
}
// BaseValue 描述了字段值的基础结构。
@ -300,3 +300,7 @@ func filter0(collection Collection, attrView *AttributeView) {
}
collection.SetItems(items)
}
func group0(collection Collection, attrView *AttributeView) {
// TODO 分组 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
}

View file

@ -196,3 +196,7 @@ func (gallery *Gallery) Sort(attrView *AttributeView) {
func (gallery *Gallery) Filter(attrView *AttributeView) {
filter0(gallery, attrView)
}
func (gallery *Gallery) Group(attrView *AttributeView) {
group0(gallery, attrView)
}

View file

@ -169,3 +169,7 @@ func (table *Table) Sort(attrView *AttributeView) {
func (table *Table) Filter(attrView *AttributeView) {
filter0(table, attrView)
}
func (table *Table) Group(attrView *AttributeView) {
group0(table, attrView)
}