@@ -20,18 +20,19 @@ function DevExpressConverter() {
20
20
* @param {Object } ast - The abstract syntax tree
21
21
* @param {Array } vars - Array of variable names
22
22
* @param {Object } ResultObject - Optional object for placeholder resolution
23
- * @param {string } primaryEntity - Optional primary entity name
24
- * @param {string } primaryKey - Optional primary key value
25
23
* @returns {Array|null } DevExpress format filter
26
24
*/
27
- function convert ( ast , vars , ResultObject = null , PrimaryEntity = null , PrimaryKey = null ) {
25
+ function convert ( ast , vars , ResultObject = null ) {
28
26
// Set up global context
29
27
variables = vars ;
30
- primaryKey = PrimaryKey ;
31
- primaryEntity = PrimaryEntity ;
32
28
resultObject = ResultObject ;
33
29
34
30
// Process the AST
31
+ let result = processAstNode ( ast ) ;
32
+
33
+ // Handle special cases for short circuit
34
+ if ( result === true || result === false || result === null ) return [ ] ;
35
+
35
36
return processAstNode ( ast ) ;
36
37
}
37
38
@@ -191,6 +192,16 @@ function DevExpressConverter() {
191
192
}
192
193
}
193
194
195
+ if ( Array . isArray ( resolvedValue ) && resolvedValue . length ) {
196
+
197
+ return Array . prototype . concat
198
+ . apply (
199
+ [ ] ,
200
+ resolvedValue . map ( ( i ) => [ [ ast . field , '=' , i ] , 'or' ] ) ,
201
+ )
202
+ . slice ( 0 , - 1 )
203
+ }
204
+
194
205
return [ ast . field , "in" , resolvedValue ] ;
195
206
}
196
207
@@ -346,6 +357,6 @@ const devExpressConverter = DevExpressConverter();
346
357
* @param {string } primaryKey - Optional primary key value
347
358
* @returns {Array|null } DevExpress format filter
348
359
*/
349
- export function convertToDevExpressFormat ( { ast, variables, resultObject = null , primaryEntity = null , primaryKey = null } ) {
350
- return devExpressConverter . init ( ast , variables , resultObject , primaryEntity , primaryKey ) ;
360
+ export function convertToDevExpressFormat ( { ast, variables, resultObject = null } ) {
361
+ return devExpressConverter . init ( ast , variables , resultObject ) ;
351
362
}
0 commit comments