You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -37,7 +38,7 @@ Optionally you can override some options in basic config or add your own types/w
37
38
There are functions for building query string: `formatConj`, `formatValue`, `formatOp`, `formatField`, `formatFunc` which are used for `QbUtils.queryString()`. +
38
39
They have common param `isForDisplay` - false by default, true will be used for {queryString}[`QbUtils.queryString(immutableTree, config, true)`] (see 3rd param true). +
39
40
Also there are similar `mongoConj`, `mongoFormatOp`, `mongoFormatValue`, `mongoFunc`, `mongoFormatFunc`, `mongoArgsAsObject` for building MongoDb query with `QbUtils.mongodbFormat()`. +
40
-
And `sqlFormatConj`, `sqlOp`, `sqlFormatOp`, `sqlFormatValue`, `sqlFormatReverse`, `formatSpelField`, `sqlFunc`, `sqlFormatFunc` for building SQL where query with `QbUtils.sqlFormat()`. +
41
+
And `sqlFormatConj`, `sqlOp`, `sqlOps`, `sqlFormatOp`, `sqlFormatValue`, `sqlFormatReverse`, `formatSpelField`, `sqlFunc`, `sqlFormatFunc`, `sqlImport` for building SQL where query with `QbUtils.sqlFormat()`. +
41
42
And `spelFormatConj`, `spelOp`, `spelFormatOp`, `spelFormatValue`, `spelFormatReverse`, `spelFunc`, `spelFormatFunc` for building query in (https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/expressions.html)[Spring Expression Language (SpEL)] with `QbUtils.spelFormat()`. +
42
43
And `jsonLogic` for building http://jsonlogic.com[JsonLogic] with `QbUtils.jsonLogicFormat()`. +
43
44
@@ -347,7 +348,7 @@ Behaviour settings:
347
348
|removeEmptyGroupsOnLoad |true |Remove empty groups during initial validation of `value` prop passed to `<Query>`
348
349
|removeInvalidMultiSelectValuesOnLoad |true |Remove values that are not in `listValues` during initial validation of `value` prop passed to `<Query>`? +
349
350
By default `true`, but `false` for AntDesign as can be removed manually
350
-
|useConfigCompress |false |Set to `true` if you use `Utils.decompressConfig()`
351
+
|useConfigCompress |false |Set to `true` if you use `Utils.ConfigUtils.decompressConfig()`
351
352
|fieldItemKeysForSearch |`["label", "path", "altLabel", "grouplabel"]` |Keys in field item (see {d_ts}[type] `FieldItem`) available for search. Available keys: "key", "path", "label", "altLabel" (label2), "tooltip", "grouplabel" (label of parent group, for subfields of complex fields)
352
353
|listKeysForSearch |`["title", "value"]` |Keys in list item (see {d_ts}[type] `ListItem`) available for search. Available keys: "title", "value", "groupTitle"
353
354
|reverseOperatorsForNot |false |True to convert "!(x == 1)" to "x != 1" on import and export
@@ -549,9 +550,11 @@ where `AND` and `OR` - available conjuctions (logical operators). You can add `N
549
550
`value` - mixed for `cardinality==1` -or- `Array` for `cardinality>2` +
550
551
`useExpr` - true if resulted expression will be wrapped in https://docs.mongodb.com/manual/reference/operator/query/expr/index.html[`{'$expr': {...}}`] (used only if you compare field with another field or function) (you need to use aggregation operators in this case, like https://docs.mongodb.com/manual/reference/operator/aggregation/eq/[$eq (aggregation)] instead of https://docs.mongodb.com/manual/reference/operator/query/eq/[$eq])
551
552
|sqlOp |+ for SQL format | |Operator name in SQL
553
+
|sqlOps |- for SQL format | |Operator names in SQL
552
554
|sqlFormatOp |- for SQL format | |Function for advanced formatting SQL WHERE query when just `sqlOp` is not enough. +
`value` - mixed for `cardinality==1` -or- `Array` for `cardinality>2`
557
+
|sqlImport |- for SQL format | |Function to convert given raw SQL value (not string, but object got from `node-sql-parser`) to `{ children: Array }`. If given expression can't be parsed into current operator, throw an error.
555
558
|spelOp |+ for SpEL format | |Operator name in SpEL
556
559
|spelFormatOp |- for SpEL format | |Function for advanced formatting query in SpEL when just `spelOp` is not enough. +
@@ -768,6 +771,7 @@ To enable this feature set `valueSources` of type to `['value', 'func']` (see be
768
771
|sqlFunc |- for SQL format |same as func key |Func name in SQL
769
772
|sqlFormatFunc |- for SQL format | |Can be used instead of `sqlFunc`. Function with 1 param - args object `{<arg name> : <arg value>}`, should return formatted function expression string. +
770
773
Example: SUM function can be formatted with `({a, b}) => a + " + " + b`
774
+
|sqlImport |- for SQL format | |Function to convert given raw SQL value (not string, but object got from `node-sql-parser`) to `{args: Object}`. If given expression can't be parsed into current function, throw an error.
771
775
|spelFunc |- for SpEL format |same as func key |Func name in SpEL
772
776
|spelFormatFunc |- for SpEL format | |Can be used instead of `spelFunc`. Function with 1 param - args object `{<arg name> : <arg value>}`, should return formatted function expression string. +
773
777
Example: SUM function can be formatted with `({a, b}) => a + " + " + b`
@@ -776,7 +780,7 @@ To enable this feature set `valueSources` of type to `['value', 'func']` (see be
776
780
|mongoFormatFunc |- for MongoDB format | |Can be used instead of `mongoFunc`. Function with 1 param - args object `{<arg name> : <arg value>}`, should return formatted function expression object.
777
781
|jsonLogic |+ for http://jsonlogic.com[JsonLogic] | |String (function name) or function with 1 param - args object `{<arg name> : <arg value>}`, should return formatted function expression for JsonLogic.
778
782
|jsonLogicImport | | |Function to convert given JsonLogic expression to array of arguments of current function. If given expression can't be parsed into current function, throw an error.
779
-
|spelImport | | |Function to convert given raw SpEL value to array of arguments of current function. If given value can't be parsed into current function, throw an error.
783
+
|spelImport | | |Function to convert given raw SpEL value to object of arguments of current function. If given value can't be parsed into current function, throw an error or return undefined.
780
784
|args.* | | |Arguments of function. Config is almost same as for simple link:#configfields[fields]
781
785
|args.<arg>.label | |arg's key |Label to be displayed in arg's label or placeholder (if `config.settings.showLabels` is false)
782
786
|args.<arg>.type |+ | |One of types described in link:#configtypes[config.types]
@@ -850,13 +854,13 @@ const ctx = {
850
854
const zipConfig = {
851
855
fields,
852
856
settings: {
853
-
useConfigCompress: true, // this is required to use Utils.decompressConfig()
857
+
useConfigCompress: true, // this is required to use Utils.ConfigUtils.decompressConfig()
854
858
},
855
859
// you can add here other sections like `widgets` or `types`, but don't add `ctx`
856
860
};
857
861
858
862
// Config can be loaded from backend with providing `ctx`
In order to generate zip config corretly (to JSON-serializable object), you should put your custom functions to `ctx` and refer to them by names as in examples above.
Convert query value from [Spring Expression Language (SpEL)](https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/expressions.html) format to internal Immutable format.
You need these utils because you can't just send config *as-is* to server, as it contains functions that can't be serialized to JSON.
680
687
Note that you need to set `config.settings.useConfigCompress = true` to enable this feature.
681
688
682
689
To put it simple:
683
690
-`ZipConfig` type is a JSON that contains only changes against basic config (differences). At minimum it contains your `fields`. It does not contain [`ctx`](#ctx).
684
-
-`Utils.decompressConfig()` will merge `ZipConfig` to basic config (and add `ctx` if passed).
691
+
-`Utils.ConfigUtils.decompressConfig()` will merge `ZipConfig` to basic config (and add `ctx` if passed).
685
692
686
693
See [sandbox_next demo app](/packages/sandbox_next) that demonstrates server-side features.
0 commit comments