mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 Improve adding rows of the filtered database table view https://github.com/siyuan-note/siyuan/issues/10025
This commit is contained in:
parent
76dd5a2d28
commit
456feff45a
3 changed files with 12 additions and 4 deletions
|
|
@ -267,6 +267,12 @@ func SaveAttributeView(av *AttributeView) (err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range kv.Values {
|
||||
if "" == v.KeyID {
|
||||
v.KeyID = kv.Key.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 数据订正
|
||||
|
|
|
|||
|
|
@ -141,11 +141,11 @@ func (filter *ViewFilter) GetAffectValue(key *Key) (ret *Value) {
|
|||
switch filter.Operator {
|
||||
case FilterOperatorIsEqual, FilterOperatorContains:
|
||||
if 0 < len(filter.Value.MSelect) {
|
||||
ret.MSelect = []*ValueSelect{{Content: filter.Value.MSelect[0].Content}}
|
||||
ret.MSelect = []*ValueSelect{{Content: filter.Value.MSelect[0].Content, Color: filter.Value.MSelect[0].Color}}
|
||||
}
|
||||
case FilterOperatorIsNotEqual, FilterOperatorDoesNotContain:
|
||||
if 0 < len(filter.Value.MSelect) {
|
||||
ret.MSelect = []*ValueSelect{{Content: filter.Value.MSelect[0].Content + " Untitled"}}
|
||||
ret.MSelect = []*ValueSelect{{Content: filter.Value.MSelect[0].Content + " Untitled", Color: "1"}}
|
||||
}
|
||||
case FilterOperatorIsEmpty:
|
||||
ret.MSelect = []*ValueSelect{}
|
||||
|
|
|
|||
|
|
@ -1520,6 +1520,7 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
|
|||
newValue.IsDetached = operation.IsDetached
|
||||
values, _ := attrView.GetKeyValues(filter.Column)
|
||||
values.Values = append(values.Values, newValue)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1533,10 +1534,11 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
|
|||
if keyValues.Key.ID == filter.Column {
|
||||
newValue := filter.GetAffectValue(keyValues.Key)
|
||||
newValue.ID = ast.NewNodeID()
|
||||
newValue.KeyID = keyValues.Key.ID
|
||||
newValue.BlockID = blockID
|
||||
newValue.IsDetached = operation.IsDetached
|
||||
values, _ := attrView.GetKeyValues(filter.Column)
|
||||
values.Values = append(values.Values, newValue)
|
||||
keyValues.Values = append(keyValues.Values, newValue)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue