mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 08:30:42 +02:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/15643
This commit is contained in:
parent
f8bccc2d9f
commit
83af400f65
2 changed files with 11 additions and 4 deletions
|
@ -538,14 +538,19 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error
|
|||
if view.Group.HideEmpty != oldHideEmpty {
|
||||
if !oldHideEmpty && view.Group.HideEmpty { // 启用隐藏空分组
|
||||
for _, g := range view.Groups {
|
||||
if g.GroupHidden == 0 && 1 > len(g.GroupItemIDs) {
|
||||
groupViewable := sql.RenderGroupView(attrView, view, g, "")
|
||||
// 必须经过渲染才能得到最终的条目数
|
||||
renderViewableInstance(groupViewable, view, attrView, 1, -1)
|
||||
if g.GroupHidden == 0 && 1 > groupViewable.(av.Collection).CountItems() {
|
||||
g.GroupHidden = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if oldHideEmpty && !view.Group.HideEmpty { // 禁用隐藏空分组
|
||||
for _, g := range view.Groups {
|
||||
if g.GroupHidden == 1 && 1 > len(g.GroupItemIDs) {
|
||||
groupViewable := sql.RenderGroupView(attrView, view, g, "")
|
||||
renderViewableInstance(groupViewable, view, attrView, 1, -1)
|
||||
if g.GroupHidden == 1 && 1 > groupViewable.(av.Collection).CountItems() {
|
||||
g.GroupHidden = 0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue