mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 21:38:48 +01:00
This commit is contained in:
parent
8fb83d1156
commit
cf06f74e1b
1 changed files with 18 additions and 6 deletions
|
|
@ -135,7 +135,24 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool
|
|||
}
|
||||
|
||||
if nil != value.Block && nil != other.Block {
|
||||
return strings.Contains(value.Block.Content, other.Block.Content)
|
||||
switch operator {
|
||||
case FilterOperatorIsEqual:
|
||||
return value.Block.Content == other.Block.Content
|
||||
case FilterOperatorIsNotEqual:
|
||||
return value.Block.Content != other.Block.Content
|
||||
case FilterOperatorContains:
|
||||
return strings.Contains(value.Block.Content, other.Block.Content)
|
||||
case FilterOperatorDoesNotContain:
|
||||
return !strings.Contains(value.Block.Content, other.Block.Content)
|
||||
case FilterOperatorStartsWith:
|
||||
return strings.HasPrefix(value.Block.Content, other.Block.Content)
|
||||
case FilterOperatorEndsWith:
|
||||
return strings.HasSuffix(value.Block.Content, other.Block.Content)
|
||||
case FilterOperatorIsEmpty:
|
||||
return "" == strings.TrimSpace(value.Block.Content)
|
||||
case FilterOperatorIsNotEmpty:
|
||||
return "" != strings.TrimSpace(value.Block.Content)
|
||||
}
|
||||
}
|
||||
|
||||
if nil != value.Text && nil != other.Text {
|
||||
|
|
@ -326,11 +343,6 @@ func (table *Table) SortRows() {
|
|||
|
||||
sort.Slice(table.Rows, func(i, j int) bool {
|
||||
for _, colIndexSort := range colIndexSorts {
|
||||
c := table.Columns[colIndexSort.Index]
|
||||
if c.Type == KeyTypeBlock {
|
||||
continue
|
||||
}
|
||||
|
||||
result := table.Rows[i].Cells[colIndexSort.Index].Value.Compare(table.Rows[j].Cells[colIndexSort.Index].Value)
|
||||
if 0 == result {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue