@react-querybuilder/core 8.20.2 → 8.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +2261 -2113
  3. package/dist/cjs/react-querybuilder_core.cjs.development.js +319 -22
  4. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  5. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +2261 -2113
  6. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  7. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  8. package/dist/{convertQuery-BJKNgecE.js → convertQuery-Cw76XFIn.js} +8 -8
  9. package/dist/{convertQuery-BJKNgecE.js.map → convertQuery-Cw76XFIn.js.map} +1 -1
  10. package/dist/{convertQuery-J1CaoDxe.mjs → convertQuery-D_4J7E-Z.mjs} +2 -2
  11. package/dist/{convertQuery-J1CaoDxe.mjs.map → convertQuery-D_4J7E-Z.mjs.map} +1 -1
  12. package/dist/formatQuery.d.mts +499 -459
  13. package/dist/formatQuery.d.ts +499 -459
  14. package/dist/formatQuery.js +170 -88
  15. package/dist/formatQuery.js.map +1 -1
  16. package/dist/formatQuery.mjs +97 -20
  17. package/dist/formatQuery.mjs.map +1 -1
  18. package/dist/import-BVdxeIBO.d.mts +26 -0
  19. package/dist/import-Ddc3d_8q.d.ts +26 -0
  20. package/dist/{index-DlVg-QXo.d.mts → index-BSwFvkeI.d.mts} +679 -648
  21. package/dist/{index-DlVg-QXo.d.ts → index-BSwFvkeI.d.ts} +679 -648
  22. package/dist/{objectUtils-DBJI82bl.js → isRuleGroup-0JNiQgLg.js} +1 -26
  23. package/dist/isRuleGroup-0JNiQgLg.js.map +1 -0
  24. package/dist/{objectUtils-ZvPkF6u6.mjs → isRuleGroup-CqLThsbu.mjs} +2 -15
  25. package/dist/isRuleGroup-CqLThsbu.mjs.map +1 -0
  26. package/dist/objectUtils-Cr02aGxb.js +27 -0
  27. package/dist/objectUtils-Cr02aGxb.js.map +1 -0
  28. package/dist/objectUtils-DBlmJgBf.mjs +16 -0
  29. package/dist/objectUtils-DBlmJgBf.mjs.map +1 -0
  30. package/dist/parseCEL.d.mts +64 -30
  31. package/dist/parseCEL.d.ts +64 -30
  32. package/dist/parseCEL.js +91 -12
  33. package/dist/parseCEL.js.map +1 -1
  34. package/dist/parseCEL.mjs +85 -8
  35. package/dist/parseCEL.mjs.map +1 -1
  36. package/dist/parseCypher.d.mts +24 -25
  37. package/dist/parseCypher.d.ts +24 -25
  38. package/dist/parseGremlin.d.mts +18 -19
  39. package/dist/parseGremlin.d.ts +18 -19
  40. package/dist/parseJSONata.d.mts +207 -20
  41. package/dist/parseJSONata.d.ts +207 -20
  42. package/dist/parseJSONata.js +92 -7
  43. package/dist/parseJSONata.js.map +1 -1
  44. package/dist/parseJSONata.mjs +80 -4
  45. package/dist/parseJSONata.mjs.map +1 -1
  46. package/dist/parseJsonLogic.d.mts +51 -18
  47. package/dist/parseJsonLogic.d.ts +51 -18
  48. package/dist/parseJsonLogic.js +95 -34
  49. package/dist/parseJsonLogic.js.map +1 -1
  50. package/dist/parseJsonLogic.mjs +65 -6
  51. package/dist/parseJsonLogic.mjs.map +1 -1
  52. package/dist/parseMongoDB.d.mts +89 -58
  53. package/dist/parseMongoDB.d.ts +89 -58
  54. package/dist/parseMongoDB.js +140 -15
  55. package/dist/parseMongoDB.js.map +1 -1
  56. package/dist/parseMongoDB.mjs +128 -5
  57. package/dist/parseMongoDB.mjs.map +1 -1
  58. package/dist/parseSPARQL.d.mts +17 -18
  59. package/dist/parseSPARQL.d.ts +17 -18
  60. package/dist/parseSPARQL.js.map +1 -1
  61. package/dist/parseSPARQL.mjs.map +1 -1
  62. package/dist/parseSQL.d.mts +266 -18
  63. package/dist/parseSQL.d.ts +266 -18
  64. package/dist/parseSQL.js +163 -10
  65. package/dist/parseSQL.js.map +1 -1
  66. package/dist/parseSQL.mjs +149 -7
  67. package/dist/parseSQL.mjs.map +1 -1
  68. package/dist/parseSpEL.d.mts +193 -19
  69. package/dist/parseSpEL.d.ts +193 -19
  70. package/dist/parseSpEL.js +166 -7
  71. package/dist/parseSpEL.js.map +1 -1
  72. package/dist/parseSpEL.mjs +142 -6
  73. package/dist/parseSpEL.mjs.map +1 -1
  74. package/dist/{prepareQueryObjects-Bni5VgYM.js → prepareQueryObjects-C2-kTZvR.js} +5 -5
  75. package/dist/prepareQueryObjects-C2-kTZvR.js.map +1 -0
  76. package/dist/{prepareQueryObjects-BCLU20Cg.mjs → prepareQueryObjects-Q18lHCKl.mjs} +3 -3
  77. package/dist/prepareQueryObjects-Q18lHCKl.mjs.map +1 -0
  78. package/dist/query-builder-layout.css.map +1 -1
  79. package/dist/query-builder.css.map +1 -1
  80. package/dist/react-querybuilder_core.d.mts +2261 -2113
  81. package/dist/react-querybuilder_core.legacy-esm.d.ts +2261 -2113
  82. package/dist/react-querybuilder_core.legacy-esm.js +335 -40
  83. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  84. package/dist/react-querybuilder_core.mjs +309 -23
  85. package/dist/react-querybuilder_core.mjs.map +1 -1
  86. package/dist/react-querybuilder_core.production.d.mts +2261 -2113
  87. package/dist/react-querybuilder_core.production.mjs +1 -1
  88. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  89. package/dist/styles/_layout.scss +4 -10
  90. package/dist/transformQuery.d.mts +91 -92
  91. package/dist/transformQuery.d.ts +91 -92
  92. package/dist/transformQuery.js +4 -3
  93. package/dist/transformQuery.js.map +1 -1
  94. package/dist/transformQuery.mjs +2 -1
  95. package/dist/transformQuery.mjs.map +1 -1
  96. package/dist/{utils-BpaOtylk.js → utils-DEwV7F6B.js} +108 -12
  97. package/dist/utils-DEwV7F6B.js.map +1 -0
  98. package/dist/{utils-CJRGiPb-.mjs → utils-Dt0D_DMV.mjs} +69 -3
  99. package/dist/utils-Dt0D_DMV.mjs.map +1 -0
  100. package/package.json +14 -14
  101. package/dist/import-Qs1-kgv5.d.ts +0 -27
  102. package/dist/import-ShTj5IdB.d.mts +0 -27
  103. package/dist/objectUtils-DBJI82bl.js.map +0 -1
  104. package/dist/objectUtils-ZvPkF6u6.mjs.map +0 -1
  105. package/dist/prepareQueryObjects-BCLU20Cg.mjs.map +0 -1
  106. package/dist/prepareQueryObjects-Bni5VgYM.js.map +0 -1
  107. package/dist/utils-BpaOtylk.js.map +0 -1
  108. package/dist/utils-CJRGiPb-.mjs.map +0 -1
@@ -1,33 +1,207 @@
1
- import { E as DefaultRuleGroupType, j as Except, x as DefaultRuleGroupTypeIC } from "./index-DlVg-QXo.mjs";
2
- import { t as ParserCommonOptions } from "./import-ShTj5IdB.mjs";
3
-
1
+ import { A as DefaultOperatorName, L as Except, O as DefaultCombinatorName, P as ExpressionNode, T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-BSwFvkeI.mjs";
2
+ import { t as ParserCommonOptions } from "./import-BVdxeIBO.mjs";
3
+ //#region src/utils/parseSpEL/types.d.ts
4
+ type SpELNodeType = "invalid" | SpELOperationType | SpELPrimitiveType | SpELRelOp | SpELIdentifierType | "assign" | "beanref" | "constructorref" | "elvis" | "function" | "identifier" | "indexer" | "list" | "map" | "method" | "between" | "instanceof" | "matches" | "projection" | "qualifiedidentifier" | "selection" | "ternary" | "typeref";
5
+ type SpELOperationType = "op-and" | "op-dec" | "op-divide" | "op-eq" | "op-ge" | "op-gt" | "op-inc" | "op-le" | "op-lt" | "op-minus" | "op-modulus" | "op-multiply" | "op-ne" | "op-not" | "op-or" | "op-plus" | "op-power";
6
+ type SpELPrimitiveType = "number" | "string" | "boolean" | "null";
7
+ type SpELRelOp = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in";
8
+ type SpELRelOpType = "op-eq" | "op-ge" | "op-gt" | "op-le" | "op-lt" | "op-ne";
9
+ type SpELIdentifierType = "property" | "compound" | "variable";
10
+ interface SpELBaseNode<T extends SpELNodeType> {
11
+ _type: T;
12
+ getType: () => T;
13
+ getChildren: () => SpELBaseNode<T>[];
14
+ getStartPosition: () => number;
15
+ getEndPosition: () => number;
16
+ getValue: () => boolean | number | string | null;
17
+ toString: () => string;
18
+ }
19
+ interface SpELPropertyNode extends SpELBaseNode<SpELIdentifierType> {
20
+ getRaw: () => string;
21
+ getName: () => string;
22
+ }
23
+ interface SpELListNode extends SpELBaseNode<"list"> {
24
+ getRaw: () => SpELPropertyNode[];
25
+ }
26
+ interface SpELCompoundNode extends SpELBaseNode<SpELIdentifierType> {
27
+ getChildren: () => SpELPropertyNode[];
28
+ }
29
+ /**
30
+ * A SpEL method/function invocation node. Note that arguments are _not_ children — they are
31
+ * exposed as raw (unprocessed) nodes through `getRaw()`.
32
+ */
33
+ interface SpELMethodNode extends SpELBaseNode<"method"> {
34
+ getRaw: () => {
35
+ methodName: string;
36
+ args: SpELExpressionNode[];
37
+ };
38
+ }
39
+ /** The dotted segments of a `T(...)` type reference, e.g. `["java", "lang", "Math"]`. */
40
+ interface SpELQualifiedIdentifierNode extends SpELBaseNode<"qualifiedidentifier"> {
41
+ getRaw: () => string[];
42
+ }
43
+ interface SpELExpressionNode extends SpELBaseNode<SpELNodeType> {
44
+ getChildren: () => SpELExpressionNode[];
45
+ }
46
+ interface SpELProcessedExpression {
47
+ type: SpELNodeType;
48
+ children: SpELProcessedExpression[];
49
+ value: number | string | boolean | null;
50
+ startPosition: number;
51
+ endPosition: number;
52
+ identifier: string | null;
53
+ /** Method/function name, present when `type` is `"method"`. */
54
+ methodName?: string;
55
+ /**
56
+ * The receiver of an instance method call (e.g. `name` in `name.toUpperCase()`), or `null` for
57
+ * static (`T(...)`) and bare function calls.
58
+ */
59
+ target?: SpELProcessedExpression | null;
60
+ /** Dotted type name of a `T(...)` static call target, e.g. `"java.lang.Math"`. */
61
+ typeRef?: string | null;
62
+ }
63
+ /**
64
+ * A method/function invocation. Arguments are stored as `children`; instance-call receivers are
65
+ * stored as {@link SpELProcessedExpression.target}, and static-call types as
66
+ * {@link SpELProcessedExpression.typeRef}.
67
+ */
68
+ interface SpELMethodCall extends SpELProcessedExpression {
69
+ type: "method";
70
+ methodName: string;
71
+ }
72
+ interface SpELOpAnd extends SpELProcessedExpression {
73
+ type: "op-and";
74
+ }
75
+ interface SpELOpOr extends SpELProcessedExpression {
76
+ type: "op-or";
77
+ }
78
+ interface SpELOpMatches extends SpELProcessedExpression {
79
+ type: "matches";
80
+ children: [SpELIdentifier, SpELStringLiteral] | [SpELStringLiteral, SpELIdentifier] | [SpELIdentifier, SpELIdentifier];
81
+ }
82
+ interface SpELIdentifier extends SpELProcessedExpression {
83
+ type: "compound" | "property" | "variable";
84
+ identifier: string;
85
+ }
86
+ interface SpELRelation extends SpELProcessedExpression {
87
+ type: SpELRelOpType;
88
+ }
89
+ interface SpELBetweenValues extends SpELProcessedExpression {
90
+ type: "between";
91
+ children: [SpELIdentifier, SpELListOfValues];
92
+ }
93
+ interface SpELBetweenFields extends SpELProcessedExpression {
94
+ type: "between";
95
+ children: [SpELIdentifier, SpELListOfFields];
96
+ }
97
+ interface SpELListOfValues extends SpELProcessedExpression {
98
+ type: "list";
99
+ children: [SpELPrimitive, SpELPrimitive, ...SpELPrimitive[]];
100
+ }
101
+ interface SpELListOfFields extends SpELProcessedExpression {
102
+ type: "list";
103
+ children: [SpELIdentifier, SpELIdentifier, ...SpELIdentifier[]];
104
+ }
105
+ type SpELPrimitive = SpELBooleanLiteral | SpELNumericLiteral | SpELStringLiteral | SpELNullLiteral;
106
+ interface SpELStringLiteral extends SpELProcessedExpression {
107
+ type: "string";
108
+ value: string;
109
+ }
110
+ interface SpELNumericLiteral extends SpELProcessedExpression {
111
+ type: "number";
112
+ value: number;
113
+ }
114
+ interface SpELBooleanLiteral extends SpELProcessedExpression {
115
+ type: "boolean";
116
+ value: boolean;
117
+ }
118
+ interface SpELNullLiteral extends SpELProcessedExpression {
119
+ type: "null";
120
+ value: null;
121
+ }
122
+ /**
123
+ * A SpEL operand subtree that {@link parseSpEL!ParseSpELOptions.getExpression} may receive — either
124
+ * an arithmetic infix node (`op-plus`/`op-minus`/`op-multiply`/`op-divide`/`op-modulus`) or a
125
+ * method/function invocation ({@link SpELMethodCall}), which covers `T(java.lang.Math).abs/min/max(...)`,
126
+ * `.toUpperCase()`/`.toLowerCase()`, and custom calls like `myFunc(a, b)`.
127
+ */
128
+ type SpELExpressionOperand = SpELProcessedExpression;
129
+ /** Context passed to {@link parseSpEL!ParseSpELOptions.getExpression}. */
130
+ interface ParseSpELExpressionContext {
131
+ /** Returns `true` if the field is configured (or if no `fields` were supplied). */
132
+ fieldExists: (fieldName: string) => boolean;
133
+ }
134
+ //#endregion
4
135
  //#region src/utils/parseSpEL/parseSpEL.d.ts
5
136
  /**
6
- * Options object for {@link parseSpEL!parseSpEL}.
7
- */
8
- interface ParseSpELOptions extends ParserCommonOptions {}
137
+ * Options object for {@link parseSpEL!parseSpEL}.
138
+ */
139
+ interface ParseSpELOptions extends ParserCommonOptions {
140
+ /**
141
+ * Handler that converts a SpEL expression operand subtree into an {@link ExpressionNode}.
142
+ * Return `null` to reject (the rule is dropped). Supplied by `@react-querybuilder/expr`
143
+ * (`expressionParserSpEL`). When omitted, expression operands are ignored (rule dropped).
144
+ *
145
+ * Arithmetic infix operands and method/function invocations
146
+ * (`T(java.lang.Math).abs/min/max(...)`, `.toUpperCase()`/`.toLowerCase()`, and custom calls)
147
+ * are both supported. See {@link SpELExpressionOperand}.
148
+ */
149
+ getExpression?: (node: SpELExpressionOperand, ctx: ParseSpELExpressionContext) => ExpressionNode | null;
150
+ }
9
151
  /**
10
- * Converts a SpEL string expression into a query suitable for the
11
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
12
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
13
- */
152
+ * Converts a SpEL string expression into a query suitable for the
153
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
154
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
155
+ */
14
156
  declare function parseSpEL(spel: string): DefaultRuleGroupType;
15
157
  /**
16
- * Converts a SpEL string expression into a query suitable for the
17
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
18
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
19
- */
158
+ * Converts a SpEL string expression into a query suitable for the
159
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
160
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
161
+ */
20
162
  declare function parseSpEL(spel: string, options: Except<ParseSpELOptions, "independentCombinators"> & {
21
163
  independentCombinators?: false;
22
164
  }): DefaultRuleGroupType;
23
165
  /**
24
- * Converts a SpEL string expression into a query suitable for the
25
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
26
- * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
27
- */
166
+ * Converts a SpEL string expression into a query suitable for the
167
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
168
+ * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
169
+ */
28
170
  declare function parseSpEL(spel: string, options: Except<ParseSpELOptions, "independentCombinators"> & {
29
171
  independentCombinators: true;
30
172
  }): DefaultRuleGroupTypeIC;
31
173
  //#endregion
32
- export { ParseSpELOptions, parseSpEL };
174
+ //#region src/utils/parseSpEL/utils.d.ts
175
+ declare const isSpELPropertyNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELPropertyNode;
176
+ declare const isSpELCompoundNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELCompoundNode;
177
+ declare const isSpELListNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELListNode;
178
+ declare const isSpELOpAnd: (expr: SpELProcessedExpression) => expr is SpELOpAnd;
179
+ declare const isSpELOpOr: (expr: SpELProcessedExpression) => expr is SpELOpOr;
180
+ declare const isSpELOpMatches: (expr: SpELProcessedExpression) => expr is SpELOpMatches;
181
+ declare const isSpELIdentifier: (expr: SpELProcessedExpression) => expr is SpELIdentifier;
182
+ declare const isSpELStringLiteral: (expr: SpELProcessedExpression) => expr is SpELStringLiteral;
183
+ declare const isSpELNumericLiteral: (expr: SpELProcessedExpression) => expr is SpELNumericLiteral;
184
+ declare const isSpELBooleanLiteral: (expr: SpELProcessedExpression) => expr is SpELBooleanLiteral;
185
+ declare const isSpELNullLiteral: (expr: SpELProcessedExpression) => expr is SpELNullLiteral;
186
+ declare const isSpELRelationOp: (expr: SpELProcessedExpression) => expr is SpELRelation;
187
+ declare const isSpELPrimitive: (expr: SpELProcessedExpression) => expr is SpELPrimitive;
188
+ declare const isSpELBetweenValues: (expr: SpELProcessedExpression) => expr is SpELBetweenValues;
189
+ declare const isSpELBetweenFields: (expr: SpELProcessedExpression) => expr is SpELBetweenFields;
190
+ /** A SpEL arithmetic infix node (`op-plus`/`op-minus`/`op-multiply`/`op-divide`/`op-modulus`). */
191
+ declare const isSpELMathOperation: (expr: SpELProcessedExpression) => boolean;
192
+ /** A method/function invocation node (`.toUpperCase()`, `T(java.lang.Math).abs(x)`, `myFunc(a)`). */
193
+ declare const isSpELMethodCall: (expr: SpELProcessedExpression) => expr is SpELMethodCall;
194
+ /**
195
+ * Whether a relation operand should be routed to `getExpression`: an arithmetic infix node or a
196
+ * method/function invocation. Bare identifiers, chains, and literals are not expression operands
197
+ * (they retain their normal handling).
198
+ */
199
+ declare const isSpELExpressionOperand: (expr: SpELProcessedExpression) => boolean;
200
+ declare const isSpELMethodNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELMethodNode;
201
+ declare const processCompiledExpression: (ce: SpELPropertyNode | SpELExpressionNode) => SpELProcessedExpression;
202
+ declare const normalizeOperator: (opType: SpELRelOpType, flip?: boolean) => DefaultOperatorName;
203
+ declare const generateFlatAndOrList: (expr: SpELProcessedExpression) => (DefaultCombinatorName | SpELProcessedExpression)[];
204
+ declare const generateMixedAndOrList: (expr: SpELOpAnd | SpELOpOr) => (DefaultCombinatorName | SpELProcessedExpression | ("and" | SpELProcessedExpression)[])[];
205
+ //#endregion
206
+ export { ParseSpELExpressionContext, ParseSpELOptions, SpELBaseNode, SpELBetweenFields, SpELBetweenValues, SpELBooleanLiteral, SpELCompoundNode, SpELExpressionNode, SpELExpressionOperand, SpELIdentifier, SpELIdentifierType, SpELListNode, SpELListOfFields, SpELListOfValues, SpELMethodCall, SpELMethodNode, SpELNodeType, SpELNullLiteral, SpELNumericLiteral, SpELOpAnd, SpELOpMatches, SpELOpOr, SpELPrimitive, SpELPrimitiveType, SpELProcessedExpression, SpELPropertyNode, SpELQualifiedIdentifierNode, SpELRelOp, SpELRelOpType, SpELRelation, SpELStringLiteral, generateFlatAndOrList, generateMixedAndOrList, isSpELBetweenFields, isSpELBetweenValues, isSpELBooleanLiteral, isSpELCompoundNode, isSpELExpressionOperand, isSpELIdentifier, isSpELListNode, isSpELMathOperation, isSpELMethodCall, isSpELMethodNode, isSpELNullLiteral, isSpELNumericLiteral, isSpELOpAnd, isSpELOpMatches, isSpELOpOr, isSpELPrimitive, isSpELPropertyNode, isSpELRelationOp, isSpELStringLiteral, normalizeOperator, parseSpEL, processCompiledExpression };
33
207
  //# sourceMappingURL=parseSpEL.d.mts.map
@@ -1,33 +1,207 @@
1
- import { E as DefaultRuleGroupType, j as Except, x as DefaultRuleGroupTypeIC } from "./index-DlVg-QXo.js";
2
- import { t as ParserCommonOptions } from "./import-Qs1-kgv5.js";
3
-
1
+ import { A as DefaultOperatorName, L as Except, O as DefaultCombinatorName, P as ExpressionNode, T as DefaultRuleGroupTypeIC, j as DefaultRuleGroupType } from "./index-BSwFvkeI.js";
2
+ import { t as ParserCommonOptions } from "./import-Ddc3d_8q.js";
3
+ //#region src/utils/parseSpEL/types.d.ts
4
+ type SpELNodeType = "invalid" | SpELOperationType | SpELPrimitiveType | SpELRelOp | SpELIdentifierType | "assign" | "beanref" | "constructorref" | "elvis" | "function" | "identifier" | "indexer" | "list" | "map" | "method" | "between" | "instanceof" | "matches" | "projection" | "qualifiedidentifier" | "selection" | "ternary" | "typeref";
5
+ type SpELOperationType = "op-and" | "op-dec" | "op-divide" | "op-eq" | "op-ge" | "op-gt" | "op-inc" | "op-le" | "op-lt" | "op-minus" | "op-modulus" | "op-multiply" | "op-ne" | "op-not" | "op-or" | "op-plus" | "op-power";
6
+ type SpELPrimitiveType = "number" | "string" | "boolean" | "null";
7
+ type SpELRelOp = "==" | ">=" | ">" | "<=" | "<" | "!=" | "in";
8
+ type SpELRelOpType = "op-eq" | "op-ge" | "op-gt" | "op-le" | "op-lt" | "op-ne";
9
+ type SpELIdentifierType = "property" | "compound" | "variable";
10
+ interface SpELBaseNode<T extends SpELNodeType> {
11
+ _type: T;
12
+ getType: () => T;
13
+ getChildren: () => SpELBaseNode<T>[];
14
+ getStartPosition: () => number;
15
+ getEndPosition: () => number;
16
+ getValue: () => boolean | number | string | null;
17
+ toString: () => string;
18
+ }
19
+ interface SpELPropertyNode extends SpELBaseNode<SpELIdentifierType> {
20
+ getRaw: () => string;
21
+ getName: () => string;
22
+ }
23
+ interface SpELListNode extends SpELBaseNode<"list"> {
24
+ getRaw: () => SpELPropertyNode[];
25
+ }
26
+ interface SpELCompoundNode extends SpELBaseNode<SpELIdentifierType> {
27
+ getChildren: () => SpELPropertyNode[];
28
+ }
29
+ /**
30
+ * A SpEL method/function invocation node. Note that arguments are _not_ children — they are
31
+ * exposed as raw (unprocessed) nodes through `getRaw()`.
32
+ */
33
+ interface SpELMethodNode extends SpELBaseNode<"method"> {
34
+ getRaw: () => {
35
+ methodName: string;
36
+ args: SpELExpressionNode[];
37
+ };
38
+ }
39
+ /** The dotted segments of a `T(...)` type reference, e.g. `["java", "lang", "Math"]`. */
40
+ interface SpELQualifiedIdentifierNode extends SpELBaseNode<"qualifiedidentifier"> {
41
+ getRaw: () => string[];
42
+ }
43
+ interface SpELExpressionNode extends SpELBaseNode<SpELNodeType> {
44
+ getChildren: () => SpELExpressionNode[];
45
+ }
46
+ interface SpELProcessedExpression {
47
+ type: SpELNodeType;
48
+ children: SpELProcessedExpression[];
49
+ value: number | string | boolean | null;
50
+ startPosition: number;
51
+ endPosition: number;
52
+ identifier: string | null;
53
+ /** Method/function name, present when `type` is `"method"`. */
54
+ methodName?: string;
55
+ /**
56
+ * The receiver of an instance method call (e.g. `name` in `name.toUpperCase()`), or `null` for
57
+ * static (`T(...)`) and bare function calls.
58
+ */
59
+ target?: SpELProcessedExpression | null;
60
+ /** Dotted type name of a `T(...)` static call target, e.g. `"java.lang.Math"`. */
61
+ typeRef?: string | null;
62
+ }
63
+ /**
64
+ * A method/function invocation. Arguments are stored as `children`; instance-call receivers are
65
+ * stored as {@link SpELProcessedExpression.target}, and static-call types as
66
+ * {@link SpELProcessedExpression.typeRef}.
67
+ */
68
+ interface SpELMethodCall extends SpELProcessedExpression {
69
+ type: "method";
70
+ methodName: string;
71
+ }
72
+ interface SpELOpAnd extends SpELProcessedExpression {
73
+ type: "op-and";
74
+ }
75
+ interface SpELOpOr extends SpELProcessedExpression {
76
+ type: "op-or";
77
+ }
78
+ interface SpELOpMatches extends SpELProcessedExpression {
79
+ type: "matches";
80
+ children: [SpELIdentifier, SpELStringLiteral] | [SpELStringLiteral, SpELIdentifier] | [SpELIdentifier, SpELIdentifier];
81
+ }
82
+ interface SpELIdentifier extends SpELProcessedExpression {
83
+ type: "compound" | "property" | "variable";
84
+ identifier: string;
85
+ }
86
+ interface SpELRelation extends SpELProcessedExpression {
87
+ type: SpELRelOpType;
88
+ }
89
+ interface SpELBetweenValues extends SpELProcessedExpression {
90
+ type: "between";
91
+ children: [SpELIdentifier, SpELListOfValues];
92
+ }
93
+ interface SpELBetweenFields extends SpELProcessedExpression {
94
+ type: "between";
95
+ children: [SpELIdentifier, SpELListOfFields];
96
+ }
97
+ interface SpELListOfValues extends SpELProcessedExpression {
98
+ type: "list";
99
+ children: [SpELPrimitive, SpELPrimitive, ...SpELPrimitive[]];
100
+ }
101
+ interface SpELListOfFields extends SpELProcessedExpression {
102
+ type: "list";
103
+ children: [SpELIdentifier, SpELIdentifier, ...SpELIdentifier[]];
104
+ }
105
+ type SpELPrimitive = SpELBooleanLiteral | SpELNumericLiteral | SpELStringLiteral | SpELNullLiteral;
106
+ interface SpELStringLiteral extends SpELProcessedExpression {
107
+ type: "string";
108
+ value: string;
109
+ }
110
+ interface SpELNumericLiteral extends SpELProcessedExpression {
111
+ type: "number";
112
+ value: number;
113
+ }
114
+ interface SpELBooleanLiteral extends SpELProcessedExpression {
115
+ type: "boolean";
116
+ value: boolean;
117
+ }
118
+ interface SpELNullLiteral extends SpELProcessedExpression {
119
+ type: "null";
120
+ value: null;
121
+ }
122
+ /**
123
+ * A SpEL operand subtree that {@link parseSpEL!ParseSpELOptions.getExpression} may receive — either
124
+ * an arithmetic infix node (`op-plus`/`op-minus`/`op-multiply`/`op-divide`/`op-modulus`) or a
125
+ * method/function invocation ({@link SpELMethodCall}), which covers `T(java.lang.Math).abs/min/max(...)`,
126
+ * `.toUpperCase()`/`.toLowerCase()`, and custom calls like `myFunc(a, b)`.
127
+ */
128
+ type SpELExpressionOperand = SpELProcessedExpression;
129
+ /** Context passed to {@link parseSpEL!ParseSpELOptions.getExpression}. */
130
+ interface ParseSpELExpressionContext {
131
+ /** Returns `true` if the field is configured (or if no `fields` were supplied). */
132
+ fieldExists: (fieldName: string) => boolean;
133
+ }
134
+ //#endregion
4
135
  //#region src/utils/parseSpEL/parseSpEL.d.ts
5
136
  /**
6
- * Options object for {@link parseSpEL!parseSpEL}.
7
- */
8
- interface ParseSpELOptions extends ParserCommonOptions {}
137
+ * Options object for {@link parseSpEL!parseSpEL}.
138
+ */
139
+ interface ParseSpELOptions extends ParserCommonOptions {
140
+ /**
141
+ * Handler that converts a SpEL expression operand subtree into an {@link ExpressionNode}.
142
+ * Return `null` to reject (the rule is dropped). Supplied by `@react-querybuilder/expr`
143
+ * (`expressionParserSpEL`). When omitted, expression operands are ignored (rule dropped).
144
+ *
145
+ * Arithmetic infix operands and method/function invocations
146
+ * (`T(java.lang.Math).abs/min/max(...)`, `.toUpperCase()`/`.toLowerCase()`, and custom calls)
147
+ * are both supported. See {@link SpELExpressionOperand}.
148
+ */
149
+ getExpression?: (node: SpELExpressionOperand, ctx: ParseSpELExpressionContext) => ExpressionNode | null;
150
+ }
9
151
  /**
10
- * Converts a SpEL string expression into a query suitable for the
11
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
12
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
13
- */
152
+ * Converts a SpEL string expression into a query suitable for the
153
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
154
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
155
+ */
14
156
  declare function parseSpEL(spel: string): DefaultRuleGroupType;
15
157
  /**
16
- * Converts a SpEL string expression into a query suitable for the
17
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
18
- * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
19
- */
158
+ * Converts a SpEL string expression into a query suitable for the
159
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
160
+ * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}).
161
+ */
20
162
  declare function parseSpEL(spel: string, options: Except<ParseSpELOptions, "independentCombinators"> & {
21
163
  independentCombinators?: false;
22
164
  }): DefaultRuleGroupType;
23
165
  /**
24
- * Converts a SpEL string expression into a query suitable for the
25
- * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
26
- * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
27
- */
166
+ * Converts a SpEL string expression into a query suitable for the
167
+ * {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props
168
+ * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}).
169
+ */
28
170
  declare function parseSpEL(spel: string, options: Except<ParseSpELOptions, "independentCombinators"> & {
29
171
  independentCombinators: true;
30
172
  }): DefaultRuleGroupTypeIC;
31
173
  //#endregion
32
- export { ParseSpELOptions, parseSpEL };
174
+ //#region src/utils/parseSpEL/utils.d.ts
175
+ declare const isSpELPropertyNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELPropertyNode;
176
+ declare const isSpELCompoundNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELCompoundNode;
177
+ declare const isSpELListNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELListNode;
178
+ declare const isSpELOpAnd: (expr: SpELProcessedExpression) => expr is SpELOpAnd;
179
+ declare const isSpELOpOr: (expr: SpELProcessedExpression) => expr is SpELOpOr;
180
+ declare const isSpELOpMatches: (expr: SpELProcessedExpression) => expr is SpELOpMatches;
181
+ declare const isSpELIdentifier: (expr: SpELProcessedExpression) => expr is SpELIdentifier;
182
+ declare const isSpELStringLiteral: (expr: SpELProcessedExpression) => expr is SpELStringLiteral;
183
+ declare const isSpELNumericLiteral: (expr: SpELProcessedExpression) => expr is SpELNumericLiteral;
184
+ declare const isSpELBooleanLiteral: (expr: SpELProcessedExpression) => expr is SpELBooleanLiteral;
185
+ declare const isSpELNullLiteral: (expr: SpELProcessedExpression) => expr is SpELNullLiteral;
186
+ declare const isSpELRelationOp: (expr: SpELProcessedExpression) => expr is SpELRelation;
187
+ declare const isSpELPrimitive: (expr: SpELProcessedExpression) => expr is SpELPrimitive;
188
+ declare const isSpELBetweenValues: (expr: SpELProcessedExpression) => expr is SpELBetweenValues;
189
+ declare const isSpELBetweenFields: (expr: SpELProcessedExpression) => expr is SpELBetweenFields;
190
+ /** A SpEL arithmetic infix node (`op-plus`/`op-minus`/`op-multiply`/`op-divide`/`op-modulus`). */
191
+ declare const isSpELMathOperation: (expr: SpELProcessedExpression) => boolean;
192
+ /** A method/function invocation node (`.toUpperCase()`, `T(java.lang.Math).abs(x)`, `myFunc(a)`). */
193
+ declare const isSpELMethodCall: (expr: SpELProcessedExpression) => expr is SpELMethodCall;
194
+ /**
195
+ * Whether a relation operand should be routed to `getExpression`: an arithmetic infix node or a
196
+ * method/function invocation. Bare identifiers, chains, and literals are not expression operands
197
+ * (they retain their normal handling).
198
+ */
199
+ declare const isSpELExpressionOperand: (expr: SpELProcessedExpression) => boolean;
200
+ declare const isSpELMethodNode: (expr: SpELBaseNode<SpELNodeType>) => expr is SpELMethodNode;
201
+ declare const processCompiledExpression: (ce: SpELPropertyNode | SpELExpressionNode) => SpELProcessedExpression;
202
+ declare const normalizeOperator: (opType: SpELRelOpType, flip?: boolean) => DefaultOperatorName;
203
+ declare const generateFlatAndOrList: (expr: SpELProcessedExpression) => (DefaultCombinatorName | SpELProcessedExpression)[];
204
+ declare const generateMixedAndOrList: (expr: SpELOpAnd | SpELOpOr) => (DefaultCombinatorName | SpELProcessedExpression | ("and" | SpELProcessedExpression)[])[];
205
+ //#endregion
206
+ export { ParseSpELExpressionContext, ParseSpELOptions, SpELBaseNode, SpELBetweenFields, SpELBetweenValues, SpELBooleanLiteral, SpELCompoundNode, SpELExpressionNode, SpELExpressionOperand, SpELIdentifier, SpELIdentifierType, SpELListNode, SpELListOfFields, SpELListOfValues, SpELMethodCall, SpELMethodNode, SpELNodeType, SpELNullLiteral, SpELNumericLiteral, SpELOpAnd, SpELOpMatches, SpELOpOr, SpELPrimitive, SpELPrimitiveType, SpELProcessedExpression, SpELPropertyNode, SpELQualifiedIdentifierNode, SpELRelOp, SpELRelOpType, SpELRelation, SpELStringLiteral, generateFlatAndOrList, generateMixedAndOrList, isSpELBetweenFields, isSpELBetweenValues, isSpELBooleanLiteral, isSpELCompoundNode, isSpELExpressionOperand, isSpELIdentifier, isSpELListNode, isSpELMathOperation, isSpELMethodCall, isSpELMethodNode, isSpELNullLiteral, isSpELNumericLiteral, isSpELOpAnd, isSpELOpMatches, isSpELOpOr, isSpELPrimitive, isSpELPropertyNode, isSpELRelationOp, isSpELStringLiteral, normalizeOperator, parseSpEL, processCompiledExpression };
33
207
  //# sourceMappingURL=parseSpEL.d.ts.map