@react-querybuilder/antd
Advanced tools
Changelog
[v4.5.2] - 2022-08-19
formatQuery
generates JSON.parse
-able strings ("mongodb" and "json_without_ids" formats).parse*
import methods properly handle backslashes.moment
package is no longer included in the build for @react-querybuilder/antd
.operator
of "between"/"notBetween" and either valueSource: "field"
or valueEditorType: "select"
, the default ValueEditor
will display two drop-down lists. The values of the drop-down lists will be joined with a comma when the rule's value
property is updated.<QueryBuilder />
called listsAsArrays
. This prop works in a similar manner to the parse*
option of the same name. When the prop is true
, ValueEditor
(and ValueSelector
for multiple: true
) will store lists of values, including "between" value pairs, as proper arrays instead of comma-separated strings.
{ field: "f1", operator: "between", value: "f2,f3", valueSource: "field" }
listsAsArrays
format:
{ field: "f1", operator: "between", value: ["f2", "f3"], valueSource: "field" }
Changelog
[v4.5.1] - 2022-06-21
ValueProcessor
was incorrectly including the new ValueProcessorByRule
type. ValueProcessor
is now simply an alias for ValueProcessorLegacy
, which should undo a breaking change from [v4.5.0].Changelog
[v4.5.0] - 2022-06-19
TL;DR: These are probably not breaking changes.
<details> <summary>While a breaking change in a minor release technically violates <a href="https://semver.org/">semver</a>, the change in question is only "breaking" in a very rare--possibly non-existent--case. The <em>only</em> case where this change will break anything is if you use <code>formatQuery</code> with a custom <code>valueProcessor</code> that accepts fewer than three (3) arguments. Click for details...</summary>formatQuery
will now invoke custom valueProcessor
functions with different arguments based on the function's .length
property, which is the number of arguments a function accepts excluding those with default values:
valueProcessor
function accepts fewer than three (3) arguments, it will be called like this:valueProcessor(rule, { parseNumbers });
The first argument is the RuleType
object directly from the query. The second argument is of type ValueProcessorOptions
, which is a subset of FormatQueryOptions
(currently { parseNumbers?: boolean; }
).
valueProcessor(field, operator, value, valueSource)
), make sure the valueProcessor
function accepts at least three arguments with no default values (do not use =
for the first three arguments). For example, the following code will log length: 1
:const valueProcessor = (field: string, operator = '=', value = '') => '...';
console.log(`length: ${valueProcessor.length}`);
valueProcessor
with the full RuleType
object provides access to much more information about specific rules. Standard properties that were previously unavailable include path
, id
, and disabled
, but any custom properties will also be accessible.
fn(rule, options)
signature are now available:
defaultValueProcessorByRule
defaultValueProcessorCELByRule
defaultValueProcessorMongoDBByRule
defaultValueProcessorSpELByRule
dist
folder). Click the respective "Import from [format]" button in the demo to try them out.
transformQuery
recursively processes rule groups and rules with the provided ruleProcessor
, ruleGroupProcessor
, and other options (documentation).formatQuery
outputs will now escape quotation marks when appropriate:
(firstName = 'Ra''s')
firstName == 'Ra\'s'
or firstName == "Ra\"s"
).formatQuery
and parseSQL
no longer include React and are not minified.Changelog
[v4.4.1] - 2022-06-03
formatQuery
docs, JsonLogic.com)formatQuery
docs, docs.spring.io)RuleGroupTypeIC
(independent combinators).Changelog
[v4.4.0] - 2022-05-30
(This list may look long, but the breaking changes should only affect a small minority of users.)
react-querybuilder
. To see which ones, check the internal
folder. All exports from that folder were previously exported from the utils
folder, which is re-exported in its entirety from the main entry point.RuleProps
and RuleGroupProps
interfaces have deprecated the props that were individual properties of rules/groups, and have added a prop containing the full rule or group object. This should only affect users that implement a custom <RuleGroup />
component but use the default <Rule />
component, since <Rule />
now expects a rule
prop.
RuleProps
: field
, operator
, value
, and valueSource
are deprecated and replaced by rule: RuleType
.RuleGroupProps
: combinator
, rules
, and not
are deprecated and replaced by ruleGroup: RuleGroupTypeAny
.schema
prop to the new actions
prop on both RuleProps
and RuleGroupProps
. Custom <Rule />
and <RuleGroup />
components will need to adjust their prop declarations.vite-tsconfig-paths
was mistakenly added to the dependencies
list instead of devDependencies
for the main package in [v4.1.3].debugMode
now triggers logging when the query or options are updated and when a query update fails for some reason (e.g. the path is disabled).onLog
callback prop is used instead of console.log
when debugMode
is true
.RuleProps
and RuleGroupProps
(rule
and ruleGroup
, respectively), custom <Rule />
and <RuleGroup />
components now have access to their full rule/group objects, including any non-standard properties. This can greatly simplify the use of customized query objects.<QueryBuilder />
will detect potential problems with using the component in a controlled vs uncontrolled manner and will log errors to the console (in "development" mode only). This includes the following situations:
query
and defaultQuery
props are defined (TypeScript will complain about this at compile time, errors will be logged at run time)query
prop is undefined in one render and then defined in the next renderquery
prop is defined in one render and then undefined in the next renderChangelog
[v4.3.1] - 2022-05-21
operatorSelector
components will now need to accommodate OptionGroup<NameLabelPair>[]
in addition to the normal NameLabelPair[]
.autoSelectOperator
(documentation) behaves like autoSelectField
but for the operator selector.
fields
and operators
properties of the translations
prop object now accept placeholderName
, placeholderLabel
, and placeholderGroupLabel
properties (documentation). These translatable strings set the default field and operator values and labels when autoSelectField
and/or autoSelectOperator
are set to false
.formatQuery
, which will now ignore rules where the field
or operator
match the placeholder values for most export formats.parseSQL
. Examples:SQL
</th> <th>Generated RuleType
object
"lastName LIKE firstName || '%'"
{
"field": "lastName",
"operator": "beginsWith",
"value": "firstName",
"valueSource": "field"
}
</td>
</tr>
<tr>
<td>
"lastName NOT LIKE '%' || firstName || '%'"
{
"field": "lastName",
"operator": "doesNotContain",
"value": "firstName",
"valueSource": "field"
}
</td>
</tr>
</table>
react-querybuilder
and the compatibility packages are all built with React v18 now (the peerDependencies
version is still ">=16.8.0"
). Previous 4.x versions were usable within React 18 applications, but now the build and tests explicitly use it.Changelog
[v4.2.5] - 2022-05-12
translations
prop: fields.placeholderLabel
and fields.placeholderGroupLabel
. These will be used in place of the default "------"
when the autoSelectField
prop is set to false
.Changelog
[v4.2.4] - 2022-05-12
parseNumbers
option for formatQuery
.debugMode
prop on <QueryBuilder />
.