mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
729fe0674f
1 changed files with 15 additions and 7 deletions
|
@ -310,10 +310,6 @@ func fillAttributeViewBaseValue(baseValue *av.BaseValue, fieldID, itemID string,
|
|||
baseValue.Value = &av.Value{ID: baseValue.ID, KeyID: fieldID, BlockID: itemID, Type: av.KeyTypeCreated}
|
||||
case av.KeyTypeUpdated: // 填充更新时间字段值,后面再渲染
|
||||
baseValue.Value = &av.Value{ID: baseValue.ID, KeyID: fieldID, BlockID: itemID, Type: av.KeyTypeUpdated}
|
||||
case av.KeyTypeRelation: // 清空关联字段值,后面再渲染 https://ld246.com/article/1703831044435
|
||||
if nil != baseValue.Value && nil != baseValue.Value.Relation {
|
||||
baseValue.Value.Relation.Contents = nil
|
||||
}
|
||||
}
|
||||
|
||||
if nil == baseValue.Value {
|
||||
|
@ -340,7 +336,7 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
|
|||
}
|
||||
}
|
||||
}
|
||||
case av.KeyTypeRollup: // 渲染汇总列
|
||||
case av.KeyTypeRollup: // 渲染汇总字段
|
||||
rollupKey, _ := attrView.GetKey(value.KeyID)
|
||||
if nil == rollupKey || nil == rollupKey.Rollup {
|
||||
break
|
||||
|
@ -402,12 +398,13 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
|
|||
|
||||
value.Rollup.RenderContents(rollupKey.Rollup.Calc, destKey)
|
||||
|
||||
// 将汇总列的值保存到 rowsValues 中,后续渲染模板列的时候会用到,下同
|
||||
// 将汇总字段的值保存到 rowsValues 中,后续渲染模板字段的时候会用到,下同
|
||||
// Database table view template columns support reading relation, rollup, created and updated columns https://github.com/siyuan-note/siyuan/issues/10442
|
||||
keyValues := items[itemID]
|
||||
keyValues = append(keyValues, &av.KeyValues{Key: rollupKey, Values: []*av.Value{{ID: value.ID, KeyID: rollupKey.ID, BlockID: itemID, Type: av.KeyTypeRollup, Rollup: value.Rollup}}})
|
||||
items[itemID] = keyValues
|
||||
case av.KeyTypeRelation: // 渲染关联列
|
||||
case av.KeyTypeRelation: // 渲染关联字段
|
||||
value.Relation.Contents = nil
|
||||
relKey, _ := attrView.GetKey(value.KeyID)
|
||||
if nil != relKey && nil != relKey.Relation {
|
||||
destAv := avCache[relKey.Relation.AvID]
|
||||
|
@ -480,6 +477,17 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
|
|||
}
|
||||
|
||||
func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.Collection, ials map[string]map[string]string, items map[string][]*av.KeyValues) (err error) {
|
||||
existTemplateField := false
|
||||
for _, kVals := range attrView.KeyValues {
|
||||
if av.KeyTypeTemplate == kVals.Key.Type {
|
||||
existTemplateField = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !existTemplateField {
|
||||
return
|
||||
}
|
||||
|
||||
var renderTemplateErr error
|
||||
for _, item := range collection.GetItems() {
|
||||
for _, value := range item.GetValues() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue