mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
♻️ Refactor av render
This commit is contained in:
parent
34647490f2
commit
f4699c9fad
3 changed files with 175 additions and 164 deletions
|
|
@ -107,25 +107,10 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
|
|||
ials := BatchGetBlockAttrs(ialIDs)
|
||||
|
||||
// 渲染自动生成的列值,比如关联列、汇总列、创建时间列和更新时间列
|
||||
avCache := map[string]*av.AttributeView{}
|
||||
avCache[attrView.ID] = attrView
|
||||
for _, row := range ret.Rows {
|
||||
for _, cell := range row.Cells {
|
||||
fillAttributeViewAutoGeneratedValues(attrView, ials, cell.Value, row, rowsValues, &avCache)
|
||||
}
|
||||
}
|
||||
fillAttributeViewAutoGeneratedValues(attrView, ret, ials, rowsValues)
|
||||
|
||||
// 最后单独渲染模板列,这样模板列就可以使用汇总、关联、创建时间和更新时间列的值了
|
||||
// Database table view template columns support reading relation, rollup, created and updated columns https://github.com/siyuan-note/siyuan/issues/10442
|
||||
var renderTemplateErr error
|
||||
for _, row := range ret.Rows {
|
||||
for _, cell := range row.Cells {
|
||||
err := fillAttributeViewTemplateValue(cell.Value, row, attrView, ials, rowsValues)
|
||||
if nil != err {
|
||||
renderTemplateErr = err
|
||||
}
|
||||
}
|
||||
}
|
||||
renderTemplateErr := fillAttributeViewTemplateValues(attrView, ret, ials, rowsValues)
|
||||
if nil != renderTemplateErr {
|
||||
util.PushErrMsg(fmt.Sprintf(util.Langs[util.Lang][44], util.EscapeHTML(renderTemplateErr.Error())), 30000)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue