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/15491
This commit is contained in:
parent
7b3acc642c
commit
580ecd617d
2 changed files with 62 additions and 7 deletions
|
|
@ -202,6 +202,7 @@ type View struct {
|
|||
GroupHidden int `json:"groupHidden"` // 分组是否隐藏,0:显示,1:空白隐藏,2:手动隐藏
|
||||
}
|
||||
|
||||
// GetGroupValue 获取分组视图的分组值。
|
||||
func (view *View) GetGroupValue() string {
|
||||
if nil == view.GroupVal {
|
||||
return ""
|
||||
|
|
@ -209,8 +210,8 @@ func (view *View) GetGroupValue() string {
|
|||
return view.GroupVal.String(false)
|
||||
}
|
||||
|
||||
// GetGroup 获取指定分组 ID 的分组视图。
|
||||
func (view *View) GetGroup(groupID string) *View {
|
||||
// GetGroupByID 获取指定分组 ID 的分组视图。
|
||||
func (view *View) GetGroupByID(groupID string) *View {
|
||||
if nil == view.Groups {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -222,6 +223,32 @@ func (view *View) GetGroup(groupID string) *View {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetGroupByGroupValue 获取指定分组值的分组视图。
|
||||
func (view *View) GetGroupByGroupValue(groupVal string) *View {
|
||||
if nil == view.Groups {
|
||||
return nil
|
||||
}
|
||||
for _, group := range view.Groups {
|
||||
if group.GetGroupValue() == groupVal {
|
||||
return group
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveGroupByID 从分组视图列表中移除指定 ID 的分组视图。
|
||||
func (view *View) RemoveGroupByID(groupID string) {
|
||||
if nil == view.Groups {
|
||||
return
|
||||
}
|
||||
for i, group := range view.Groups {
|
||||
if group.ID == groupID {
|
||||
view.Groups = append(view.Groups[:i], view.Groups[i+1:]...)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetGroupKey 获取分组视图的分组字段。
|
||||
func (view *View) GetGroupKey(attrView *AttributeView) (ret *Key) {
|
||||
if nil == view.Group || "" == view.Group.Field {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue