mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
c64d68c71d
commit
8dd1585adb
1 changed files with 2 additions and 22 deletions
|
|
@ -273,27 +273,8 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
oldHideEmpty := false
|
|
||||||
if nil != view.Group {
|
|
||||||
oldHideEmpty = view.Group.HideEmpty
|
|
||||||
}
|
|
||||||
|
|
||||||
view.Group = group
|
view.Group = group
|
||||||
genAttrViewViewGroups(view, attrView)
|
regenAttrViewViewGroups(attrView, "force")
|
||||||
|
|
||||||
if view.Group.HideEmpty != oldHideEmpty {
|
|
||||||
for _, g := range view.Groups {
|
|
||||||
if view.Group.HideEmpty {
|
|
||||||
if 2 != g.GroupHidden && 1 > len(g.GroupItemIDs) {
|
|
||||||
g.GroupHidden = 1
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if 2 != g.GroupHidden {
|
|
||||||
g.GroupHidden = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = av.SaveAttributeView(attrView)
|
err = av.SaveAttributeView(attrView)
|
||||||
ReloadAttrView(avID)
|
ReloadAttrView(avID)
|
||||||
|
|
@ -3169,8 +3150,7 @@ func addAttributeViewBlock(now int64, avID, blockID, groupID, previousBlockID, a
|
||||||
if av.KeyTypeSelect == groupKey.Type || av.KeyTypeMSelect == groupKey.Type {
|
if av.KeyTypeSelect == groupKey.Type || av.KeyTypeMSelect == groupKey.Type {
|
||||||
// 因为单选或多选只能按选项分组,并且可能存在空白分组(前面可能找不到临近项) ,所以单选或多选类型的分组字段使用分组值内容对应的选项
|
// 因为单选或多选只能按选项分组,并且可能存在空白分组(前面可能找不到临近项) ,所以单选或多选类型的分组字段使用分组值内容对应的选项
|
||||||
if opt := groupKey.GetOption(groupView.GroupValue); nil != opt && groupValueDefault != groupView.GroupValue {
|
if opt := groupKey.GetOption(groupView.GroupValue); nil != opt && groupValueDefault != groupView.GroupValue {
|
||||||
newValue.MSelect[0].Content = opt.Name
|
newValue.MSelect = append(newValue.MSelect, &av.ValueSelect{Content: opt.Name, Color: opt.Color})
|
||||||
newValue.MSelect[0].Color = opt.Color
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue