mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 Improve av https://github.com/siyuan-note/siyuan/issues/15476
This commit is contained in:
parent
9f5f5e128b
commit
30802ca97f
1 changed files with 14 additions and 2 deletions
|
|
@ -25,6 +25,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
|
"github.com/jinzhu/copier"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/av"
|
"github.com/siyuan-note/siyuan/kernel/av"
|
||||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||||
|
|
@ -33,12 +34,23 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func RenderGroupView(attrView *av.AttributeView, view, groupView *av.View, query string) (ret av.Viewable) {
|
func RenderGroupView(attrView *av.AttributeView, view, groupView *av.View, query string) (ret av.Viewable) {
|
||||||
|
var err error
|
||||||
|
switch groupView.LayoutType {
|
||||||
|
case av.LayoutTypeTable:
|
||||||
|
// 这里需要使用深拷贝,因为字段上可能会带有计算(FieldCalc),每个分组视图的计算结果都需要分别存储在不同的字段实例上
|
||||||
|
err = copier.CopyWithOption(&groupView.Table.Columns, &view.Table.Columns, copier.Option{DeepCopy: true})
|
||||||
|
case av.LayoutTypeGallery:
|
||||||
|
err = copier.CopyWithOption(&groupView.Gallery.CardFields, &view.Gallery.CardFields, copier.Option{DeepCopy: true})
|
||||||
|
}
|
||||||
|
if nil != err {
|
||||||
|
logging.LogErrorf("copy view fields [%s] to group [%s] failed: %s", view.ID, groupView.ID, err)
|
||||||
switch groupView.LayoutType {
|
switch groupView.LayoutType {
|
||||||
case av.LayoutTypeTable:
|
case av.LayoutTypeTable:
|
||||||
groupView.Table.Columns = view.Table.Columns
|
groupView.Table.Columns = view.Table.Columns
|
||||||
case av.LayoutTypeGallery:
|
case av.LayoutTypeGallery:
|
||||||
groupView.Gallery.CardFields = view.Gallery.CardFields
|
groupView.Gallery.CardFields = view.Gallery.CardFields
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
groupView.Filters = view.Filters
|
groupView.Filters = view.Filters
|
||||||
groupView.Sorts = view.Sorts
|
groupView.Sorts = view.Sorts
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue