mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Database gallery view https://github.com/siyuan-note/siyuan/issues/10414
This commit is contained in:
parent
05d1085633
commit
e1c1c806d6
3 changed files with 28 additions and 48 deletions
|
|
@ -101,30 +101,7 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
|
|||
}
|
||||
tableRow.ID = rowID
|
||||
|
||||
switch tableCell.ValueType {
|
||||
case av.KeyTypeNumber: // 格式化数字
|
||||
if nil != tableCell.Value && nil != tableCell.Value.Number && tableCell.Value.Number.IsNotEmpty {
|
||||
tableCell.Value.Number.Format = col.NumberFormat
|
||||
tableCell.Value.Number.FormatNumber()
|
||||
}
|
||||
case av.KeyTypeTemplate: // 渲染模板列
|
||||
tableCell.Value = &av.Value{ID: tableCell.ID, KeyID: col.ID, BlockID: rowID, Type: av.KeyTypeTemplate, Template: &av.ValueTemplate{Content: col.Template}}
|
||||
case av.KeyTypeCreated: // 填充创建时间列值,后面再渲染
|
||||
tableCell.Value = &av.Value{ID: tableCell.ID, KeyID: col.ID, BlockID: rowID, Type: av.KeyTypeCreated}
|
||||
case av.KeyTypeUpdated: // 填充更新时间列值,后面再渲染
|
||||
tableCell.Value = &av.Value{ID: tableCell.ID, KeyID: col.ID, BlockID: rowID, Type: av.KeyTypeUpdated}
|
||||
case av.KeyTypeRelation: // 清空关联列值,后面再渲染 https://ld246.com/article/1703831044435
|
||||
if nil != tableCell.Value && nil != tableCell.Value.Relation {
|
||||
tableCell.Value.Relation.Contents = nil
|
||||
}
|
||||
}
|
||||
|
||||
if nil == tableCell.Value {
|
||||
tableCell.Value = av.GetAttributeViewDefaultValue(tableCell.ID, col.ID, rowID, tableCell.ValueType)
|
||||
} else {
|
||||
fillAttributeViewNilValue(tableCell.Value, tableCell.ValueType)
|
||||
}
|
||||
|
||||
fillAttributeViewBaseValue(tableCell.BaseValue, col.ID, rowID, col.NumberFormat, col.Template)
|
||||
tableRow.Cells = append(tableRow.Cells, tableCell)
|
||||
}
|
||||
ret.Rows = append(ret.Rows, &tableRow)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue