fix: pass drops directly to filters/tags

This commit is contained in:
harttle
2019-05-12 20:03:32 +08:00
parent 4282accaa2
commit bef290923c
15 changed files with 93 additions and 42 deletions
+2 -3
View File
@@ -1,11 +1,10 @@
import { isNil, isString } from '../util/underscore'
import { Drop } from '../drop/drop'
import { isNil, isString, toValue } from '../util/underscore'
import { EmptyDrop } from '../drop/empty-drop'
export class BlankDrop extends EmptyDrop {
equals (value: any) {
if (value === false) return true
if (isNil(value instanceof Drop ? value.valueOf() : value)) return true
if (isNil(toValue(value))) return true
if (isString(value)) return /^\s*$/.test(value)
return super.equals(value)
}
+2 -2
View File
@@ -1,11 +1,11 @@
import { Drop } from './drop'
import { IComparable } from './icomparable'
import { isNil } from '../util/underscore'
import { isNil, toValue } from '../util/underscore'
import { BlankDrop } from '../drop/blank-drop'
export class NullDrop extends Drop implements IComparable {
equals (value: any) {
return isNil(value instanceof Drop ? value.valueOf() : value) || value instanceof BlankDrop
return isNil(toValue(value)) || value instanceof BlankDrop
}
gt () {
return false