mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
🎨 Add Relation column to database table view https://github.com/siyuan-note/siyuan/issues/9888
This commit is contained in:
@@ -724,6 +724,20 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
||||
}
|
||||
content := renderTemplateCol(ial, cell.Value.Template.Content, keyValues)
|
||||
cell.Value.Template.Content = content
|
||||
case av.KeyTypeRelation: // 渲染关联列
|
||||
relKey, _ := attrView.GetKey(cell.Value.KeyID)
|
||||
if nil != relKey && nil != relKey.Relation {
|
||||
destAv, _ := av.ParseAttributeView(relKey.Relation.AvID)
|
||||
if nil != destAv {
|
||||
blocks := map[string]string{}
|
||||
for _, blockValue := range destAv.GetBlockKeyValues().Values {
|
||||
blocks[blockValue.BlockID] = blockValue.Block.Content
|
||||
}
|
||||
for _, blockID := range cell.Value.Relation.BlockIDs {
|
||||
cell.Value.Relation.Contents = append(cell.Value.Relation.Contents, blocks[blockID])
|
||||
}
|
||||
}
|
||||
}
|
||||
case av.KeyTypeCreated: // 渲染创建时间
|
||||
createdStr := row.ID[:len("20060102150405")]
|
||||
created, parseErr := time.ParseInLocation("20060102150405", createdStr, time.Local)
|
||||
|
||||
Reference in New Issue
Block a user