Migrating from RAQB
From react-awesome-query-builder's config and Immutable tree to a typed schema and plain JSON.
Keep stored RAQB trees working with the raqb format: value / onChange read and write RAQB's
JSON tree (QbUtils.getTree output), including rule_group array groups, functions mapped to RAQB's
BasicFuncs, and locks.
import { QueryBuilder } from '@qnot/react';
import { raqb } from '@qnot/core/formats/raqb';
<QueryBuilder fields={fields} format={raqb} value={tree} onChange={setTree} />;There's no Immutable.js and no Redux store: the value is plain JSON.
Config to schema
RAQB config | qnot |
|---|---|
fields.x.type: 'text' | 'number' | 'boolean' | 'date' | 'time' | 'datetime' | f.text(), f.number(), … |
type: 'select' + listValues | f.enum([...]) |
type: 'multiselect' | f.multiEnum([...]) |
treeselect / treemultiselect + treeValues | f.enum / f.multiEnum with nested children; treeSelectOnlyLeafs → leafOnly |
!struct + subfields | f.struct({...}) (flattened to a.b paths) |
!group (mode: 'some' / 'array') | f.array({...}) + array groups |
fieldSettings.min/max/step | min, max, step |
fieldSettings.validateValue | validate |
fieldSettings.asyncFetch | search |
allowCustomValues | allowCustom |
fieldName | column |
label2, tooltip | description |
hideForSelect / hideForCompare | hidden / comparable: false |
excludeOperators | excludeOperators |
preferWidgets: ['slider'], textarea | widget: 'slider', widget: 'textarea' |
funcs | defineFunction + defineFields(…, { functions }) |
| custom operators | defineOperator + extraOperators |
settings.* | store settings |
removeIncompleteRulesOnLoad etc. | sanitizeQuery or the store's sanitize option |
compressConfig | fieldsToJSON / fieldsFromJSON |
| ternary mode | compileCases |
Exports
QbUtils.sqlFormat, mongodbFormat, jsonLogicFormat, spelFormat, elasticSearchFormat and
queryString map to the sql, mongo, jsonlogic, spel, elasticsearch and text codecs.
loadFromJsonLogic, loadFromSpel and SqlUtils.loadFromSql map to decode with those codecs.
Not carried over
- Custom conjunctions (XOR, NOR). NOR is NOT + OR; XOR has no portable meaning in SQL or MongoDB.
validateValuereturning afixedValue. Validation reports; it doesn't rewrite values.- Slider
marks,rowsfor textareas, price formatting options. The schema carrieswidget,step,prefixandsuffix; anything more goes inmetafor your UI. - RAQB's antd / MUI / Bootstrap / Fluent widget packages. Build the UI from the hooks with your kit instead.
Speed
At 1,000 rules, adding a rule drops from about 95 ms to 1.5 ms, a keystroke from about 8 ms to 0.4 ms, first render from about 590 ms to 120 ms, and the JavaScript from 193 KB to about 22 KB gzipped, both counting their SQL export (see the benchmarks).
On this page