🎨 Add number type column to Attribute View https://github.com/siyuan-note/siyuan/issues/8690

This commit is contained in:
Daniel 2023-07-07 09:38:12 +08:00
parent ae881f0e4b
commit b0bf3e568c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 6 deletions

View file

@ -22,13 +22,13 @@ type ColumnType string
const (
ColumnTypeBlock ColumnType = "block"
ColumnTypeDate ColumnType = "date"
ColumnTypeText ColumnType = "text"
ColumnTypeNumber ColumnType = "number"
ColumnTypeRelation ColumnType = "relation"
ColumnTypeRollup ColumnType = "rollup"
ColumnTypeDate ColumnType = "date"
ColumnTypeSelect ColumnType = "select"
ColumnTypeMSelect ColumnType = "mSelect"
ColumnTypeText ColumnType = "text"
ColumnTypeRelation ColumnType = "relation"
ColumnTypeRollup ColumnType = "rollup"
)
// Column 描述了属性视图的基础结构。

View file

@ -246,7 +246,7 @@ func addAttributeViewColumn(name string, typ string, avID string) (err error) {
colType := av.ColumnType(typ)
switch colType {
case av.ColumnTypeText:
case av.ColumnTypeText, av.ColumnTypeNumber, av.ColumnTypeDate, av.ColumnTypeSelect, av.ColumnTypeMSelect:
col := &av.Column{ID: ast.NewNodeID(), Name: name, Type: colType}
attrView.Columns = append(attrView.Columns, col)
for _, row := range attrView.Rows {
@ -271,7 +271,7 @@ func updateAttributeViewColumn(id, name string, typ string, avID string) (err er
colType := av.ColumnType(typ)
switch colType {
case av.ColumnTypeText:
case av.ColumnTypeText, av.ColumnTypeNumber, av.ColumnTypeDate, av.ColumnTypeSelect, av.ColumnTypeMSelect:
for _, col := range attrView.Columns {
if col.ID == id {
col.Name = name