mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
3d7191b13d
commit
211648b95e
1 changed files with 11 additions and 1 deletions
|
|
@ -1781,7 +1781,7 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
||||||
} else {
|
} else {
|
||||||
if av.GroupMethodDateRelative == view.Group.Method {
|
if av.GroupMethodDateRelative == view.Group.Method {
|
||||||
var relativeDateGroups []*av.View
|
var relativeDateGroups []*av.View
|
||||||
var last30Days, last7Days, yesterday, today, tomorrow, next7Days, next30Days *av.View
|
var last30Days, last7Days, yesterday, today, tomorrow, next7Days, next30Days, defaultGroup *av.View
|
||||||
for _, groupView := range view.Groups {
|
for _, groupView := range view.Groups {
|
||||||
_, err := time.Parse("2006-01", groupView.GroupValue)
|
_, err := time.Parse("2006-01", groupView.GroupValue)
|
||||||
if nil == err { // 如果能解析出来说明是 30 天之前或 30 天之后的分组形式
|
if nil == err { // 如果能解析出来说明是 30 天之前或 30 天之后的分组形式
|
||||||
|
|
@ -1802,6 +1802,8 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
||||||
next7Days = groupView
|
next7Days = groupView
|
||||||
case groupValueNext30Days:
|
case groupValueNext30Days:
|
||||||
next30Days = groupView
|
next30Days = groupView
|
||||||
|
case groupValueDefault:
|
||||||
|
defaultGroup = groupView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1847,6 +1849,14 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
||||||
for _, g := range lastNext30Days {
|
for _, g := range lastNext30Days {
|
||||||
relativeDateGroups = util.InsertElem(relativeDateGroups, startIdx, g)
|
relativeDateGroups = util.InsertElem(relativeDateGroups, startIdx, g)
|
||||||
}
|
}
|
||||||
|
if nil != defaultGroup {
|
||||||
|
relativeDateGroups = append([]*av.View{defaultGroup}, relativeDateGroups...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if av.GroupOrderDesc == view.Group.Order {
|
||||||
|
slices.Reverse(relativeDateGroups)
|
||||||
|
}
|
||||||
|
|
||||||
view.Groups = relativeDateGroups
|
view.Groups = relativeDateGroups
|
||||||
} else {
|
} else {
|
||||||
sort.SliceStable(view.Groups, func(i, j int) bool {
|
sort.SliceStable(view.Groups, func(i, j int) bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue