mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/15499
This commit is contained in:
parent
8ca9f119d0
commit
a9c2ae7351
5 changed files with 35 additions and 0 deletions
|
|
@ -162,6 +162,8 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
|
|||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
hideEmptyGroupViews(view, groupViewable)
|
||||
groups = append(groups, groupViewable)
|
||||
|
||||
// 将分组视图的分组字段清空,减少冗余(字段信息可以在总的视图 view 对象上获取到)
|
||||
|
|
@ -179,6 +181,20 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
|
|||
return
|
||||
}
|
||||
|
||||
func hideEmptyGroupViews(view *av.View, viewable av.Viewable) {
|
||||
if nil == view.Group {
|
||||
return
|
||||
}
|
||||
|
||||
if !view.Group.HideEmpty {
|
||||
return
|
||||
}
|
||||
|
||||
if 2 != viewable.GetGroupHidden() && 1 > viewable.(av.Collection).CountItems() {
|
||||
viewable.SetGroupHidden(1)
|
||||
}
|
||||
}
|
||||
|
||||
func sortGroupViews(todayStart time.Time, view *av.View) {
|
||||
if av.GroupOrderMan == view.Group.Order {
|
||||
sort.Slice(view.Groups, func(i, j int) bool { return view.Groups[i].GroupSort < view.Groups[j].GroupSort })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue