@@ -6,19 +6,28 @@ import { LexemeType, boundLexeme } from 'core/syntax-tree/lexicon';
6
6
import { ColumnType , IColumn } from 'dash-table/components/Table/props' ;
7
7
8
8
import { fieldExpression } from './lexeme/expression' ;
9
- import { equal , RelationalOperator } from './lexeme/relational' ;
9
+ import { equal , RelationalOperator , contains , dateStartsWith } from './lexeme/relational' ;
10
10
11
11
import columnLexicon from './lexicon/column' ;
12
12
13
- function getDefaultRelationalOperator ( type : ColumnType = ColumnType . Any ) : RelationalOperator {
13
+ function getImplicitLexeme ( type : ColumnType = ColumnType . Any ) : ILexemeResult {
14
14
switch ( type ) {
15
15
case ColumnType . Any :
16
16
case ColumnType . Text :
17
- return RelationalOperator . Contains ;
17
+ return {
18
+ lexeme : boundLexeme ( contains ) ,
19
+ value : RelationalOperator . Contains
20
+ } ;
18
21
case ColumnType . Datetime :
19
- return RelationalOperator . DateStartsWith ;
22
+ return {
23
+ lexeme : boundLexeme ( dateStartsWith ) ,
24
+ value : RelationalOperator . DateStartsWith
25
+ } ;
20
26
case ColumnType . Numeric :
21
- return RelationalOperator . Equal ;
27
+ return {
28
+ lexeme : boundLexeme ( equal ) ,
29
+ value : RelationalOperator . Equal
30
+ } ;
22
31
}
23
32
}
24
33
@@ -49,10 +58,7 @@ function modifyLex(config: SingleColumnConfig, res: ILexerResult) {
49
58
} else if ( isExpression ( res . lexemes ) ) {
50
59
res . lexemes = [
51
60
{ lexeme : boundLexeme ( fieldExpression ) , value : `{${ config . id } }` } ,
52
- {
53
- lexeme : boundLexeme ( equal ) ,
54
- value : getDefaultRelationalOperator ( config . type )
55
- } ,
61
+ getImplicitLexeme ( config . type ) ,
56
62
...res . lexemes
57
63
] ;
58
64
}
0 commit comments