index.ui
Components
| Function | Description |
|---|---|
| QueryBuilderExpressions | Context provider enabling arithmetic/function expression support for a wrapped QueryBuilder: overrides the field selector, value-source selector, and value editor to host left- and right-hand side expressions, and supplies the function registry. Any control inherited from an outer compat provider is captured first so non-expression rules continue to render with it. |
Props
| Name | Description |
|---|---|
| TranslationsExpr | The shape of the translations prop for QueryBuilderExpressions. |
| TranslationsFullExpr | The full translations interface for QueryBuilderExpressions, with all properties required. |
Functions
| Function | Description |
|---|---|
| ExpressionEditor | Recursive editor for a single ExpressionNode. A kind selector switches between a field reference, a literal value (parsed as a number when the host's parseNumbers is enabled), a named parameter reference (a selector over schema.getParameters(), or a free-text input when none are configured), and a function call whose arguments are themselves ExpressionEditors — enabling arbitrary nesting. |
| ExpressionFieldSelector | Field-selector override hosting the rule's left-hand side. The inherited (or default) field selector still picks the rule's field — the governing field, which drives operator selection and validation — while an optional wrapper selector in front of it applies a function around that field, stored as rule.lhs = fn(field, …args). The governing field always occupies argument 0; any further arguments of a multi-argument function are edited by nested ExpressionEditors and may themselves be fields, literals, or further function calls. Selecting "no function" clears rule.lhs. Field changes re-point arg 0 (or drop the wrapper) atomically so the stored expression always references the current field, preserving the extra arguments. |
| ExpressionValueEditor | Value-editor override hosting the rule's right-hand side. When valueSource is expression, the rule's value holds an ExpressionNode (rooted at a function call) edited by ExpressionEditor. For between/notBetween the value is a 2-tuple of nodes [lower, upper], rendered as two editors flanking the separator. Every other value source renders the inherited (or default) value editor unchanged. The expression source is offered by ExpressionValueSourceSelector, which seeds the initial node(s). |
| ExpressionValueSourceSelector | Value-source selector override. Relabels the expression option (core emits a raw, lowercase label) and, when it is selected, atomically seeds value with a default function node so the ExpressionValueEditor has an expression to render — a 2-tuple of nodes for between/notBetween, a single node otherwise. Every other value source delegates to the inherited (or default) selector unchanged. |
| useExpressionUI | Reads the ExpressionUIContext. |
Interfaces
| Interface | Description |
|---|---|
| ExpressionEditorProps | Props for ExpressionEditor. |
| ExpressionUIContextValue | Value carried by ExpressionUIContext. |
| QueryBuilderExpressionsProps | Props for QueryBuilderExpressions. |
Type Aliases
| Type Alias | Description |
|---|---|
| AllowFunctionsOnLHS | Whether (and when) the left-hand side may wrap its field in a function. boolean applies globally; a predicate decides per field/operator. |
Variables
| Variable | Description |
|---|---|
| defaultTranslationsExpr | Default TranslationsExpr for QueryBuilderExpressions — the LHS function-wrapper selector title/option and the expression value-source label. Override per-key via the translations prop. |
| ExpressionUIContext | Carries the registry + inherited controls down to the expression control elements. |
| ExprTestID | Stable data-testid values for the expression UI's selectors and nested editor. Exposed so host tests can target the expression controls without hardcoding strings. |
caution
API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.