Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 8087b40

Browse files
author
Marc-André Rivet
committed
re-apply syntax tree changes for tests to pass
1 parent 04bbe1d commit 8087b40

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/dash-table/syntax-tree/SingleColumnSyntaxTree.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@ import { LexemeType, boundLexeme } from 'core/syntax-tree/lexicon';
66
import { ColumnType, IColumn } from 'dash-table/components/Table/props';
77

88
import { fieldExpression } from './lexeme/expression';
9-
import { equal, RelationalOperator } from './lexeme/relational';
9+
import { equal, RelationalOperator, contains, dateStartsWith } from './lexeme/relational';
1010

1111
import columnLexicon from './lexicon/column';
1212

13-
function getDefaultRelationalOperator(type: ColumnType = ColumnType.Any): RelationalOperator {
13+
function getImplicitLexeme(type: ColumnType = ColumnType.Any): ILexemeResult {
1414
switch (type) {
1515
case ColumnType.Any:
1616
case ColumnType.Text:
17-
return RelationalOperator.Contains;
17+
return {
18+
lexeme: boundLexeme(contains),
19+
value: RelationalOperator.Contains
20+
};
1821
case ColumnType.Datetime:
19-
return RelationalOperator.DateStartsWith;
22+
return {
23+
lexeme: boundLexeme(dateStartsWith),
24+
value: RelationalOperator.DateStartsWith
25+
};
2026
case ColumnType.Numeric:
21-
return RelationalOperator.Equal;
27+
return {
28+
lexeme: boundLexeme(equal),
29+
value: RelationalOperator.Equal
30+
};
2231
}
2332
}
2433

@@ -49,10 +58,7 @@ function modifyLex(config: SingleColumnConfig, res: ILexerResult) {
4958
} else if (isExpression(res.lexemes)) {
5059
res.lexemes = [
5160
{ lexeme: boundLexeme(fieldExpression), value: `{${config.id}}` },
52-
{
53-
lexeme: boundLexeme(equal),
54-
value: getDefaultRelationalOperator(config.type)
55-
},
61+
getImplicitLexeme(config.type),
5662
...res.lexemes
5763
];
5864
}

0 commit comments

Comments
 (0)