This commit is contained in:
Daniel 2025-08-09 17:10:22 +08:00
parent 8ca9f119d0
commit a9c2ae7351
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 35 additions and 0 deletions

View file

@ -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 })