File tree 3 files changed +18
-3
lines changed
3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,13 @@ function DevExpressConverter() {
228
228
// Handle object-based values
229
229
if ( typeof val === "object" ) {
230
230
if ( val . type === "placeholder" ) {
231
- return resolvePlaceholderFromResultObject ( val . value ) ;
231
+ const placeholderValue = resolvePlaceholderFromResultObject ( val . value ) ;
232
+
233
+ if ( val ?. dataType === "string" ) {
234
+ return placeholderValue ?. toString ( ) ;
235
+ }
236
+
237
+ return placeholderValue ;
232
238
}
233
239
234
240
// Special handling for ISNULL function
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ export function parse(input, variables = []) {
237
237
case "placeholder" : {
238
238
const val = token . value . slice ( 1 , - 1 ) ;
239
239
if ( ! variables . includes ( val ) ) variables . push ( val ) ;
240
- return { type : "placeholder" , value : val } ;
240
+ return { ... token , type : "placeholder" , value : val } ;
241
241
}
242
242
243
243
case "paren" : {
Original file line number Diff line number Diff line change @@ -45,8 +45,17 @@ class Tokenizer {
45
45
if ( ! type || type === "whitespace" ) return this . nextToken ( ) ;
46
46
47
47
let value = match . groups [ type ] ;
48
+ let dataType = null ;
48
49
49
50
// Remove surrounding single quotes from placeholders
51
+ if ( type === "placeholder" ) {
52
+
53
+ if ( value . startsWith ( "'" ) && value . endsWith ( "'" ) ) {
54
+ dataType = "string" ;
55
+ }
56
+
57
+ value = value . replace ( / ^ [ \s ' " \( \) ] + | [ \s ' " \( \) ] + | [ \s ] + / g, "" ) ;
58
+ }
50
59
if ( type === "placeholder" ) value = value . replace ( / ^ [ \s ' " \( \) ] + | [ \s ' " \( \) ] + | [ \s ] + / g, "" ) ;
51
60
52
61
if ( type === "operator" ) {
@@ -68,7 +77,7 @@ class Tokenizer {
68
77
}
69
78
70
79
71
- return { type, value } ;
80
+ return { type, value, ... ( dataType !== null && { dataType } ) } ;
72
81
}
73
82
74
83
// If no valid token is found, throw an error with the remaining input for debugging
You can’t perform that action at this time.
0 commit comments