@react-querybuilder/core 8.9.2 → 8.11.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.
- package/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-A_OXU9W1.mjs} +3 -75
- package/dist/arrayUtils-A_OXU9W1.mjs.map +1 -0
- package/dist/arrayUtils-QxZOZTf6.js +73 -0
- package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
- package/dist/basic-DEc65Kng.d.mts +363 -0
- package/dist/basic-Dd_M2f3M.d.ts +363 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +806 -1366
- package/dist/cjs/react-querybuilder_core.cjs.development.js +455 -116
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +806 -1366
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-H7RhQiIc.mjs → convertQuery-CqX3rPvj.mjs} +3 -3
- package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-CqX3rPvj.mjs.map} +1 -1
- package/dist/{export-DyrnTh6K.d.ts → export-Dy4FckB-.d.ts} +7 -6
- package/dist/{export-r-V7bU31.d.mts → export-t1V2N8pz.d.mts} +7 -6
- package/dist/formatQuery.d.mts +3 -2
- package/dist/formatQuery.d.ts +3 -2
- package/dist/formatQuery.js +217 -87
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +217 -87
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Cksobmln.d.ts → import-Cz8canKo.d.mts} +3 -3
- package/dist/{import-BwbbP4oU.d.mts → import-DtS9Ocx5.d.ts} +3 -3
- package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CYcfPgbg.mjs} +2 -2
- package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CYcfPgbg.mjs.map} +1 -1
- package/dist/lexer-C53tqS2p.js +406 -0
- package/dist/lexer-C53tqS2p.js.map +1 -0
- package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
- package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
- package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-VeZ3k7-1.mjs} +86 -3
- package/dist/optGroupUtils-VeZ3k7-1.mjs.map +1 -0
- package/dist/parseCEL.d.mts +292 -11
- package/dist/parseCEL.d.ts +292 -11
- package/dist/parseCEL.js +874 -1125
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +828 -1126
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +3 -2
- package/dist/parseJSONata.d.ts +3 -2
- package/dist/parseJSONata.js +49 -77
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +4 -5
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +4 -3
- package/dist/parseJsonLogic.d.ts +4 -3
- package/dist/parseJsonLogic.js +5 -6
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +5 -6
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +3 -2
- package/dist/parseMongoDB.d.ts +3 -2
- package/dist/parseMongoDB.js +15 -16
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +5 -6
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-CXdMVNFx.mjs} +2 -2
- package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-CXdMVNFx.mjs.map} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
- package/dist/parseSQL.d.mts +3 -2
- package/dist/parseSQL.d.ts +3 -2
- package/dist/parseSQL.js +2691 -3036
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +2691 -3037
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +3 -2
- package/dist/parseSpEL.d.ts +3 -2
- package/dist/parseSpEL.js +7 -9
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +5 -6
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
- package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
- package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-DPCC-iHp.mjs} +6 -7
- package/dist/prepareQueryObjects-DPCC-iHp.mjs.map +1 -0
- package/dist/query-builder-layout.css +1 -1
- package/dist/query-builder-layout.css.map +1 -1
- package/dist/query-builder.css +1 -1
- package/dist/query-builder.css.map +1 -1
- package/dist/react-querybuilder_core.d.mts +806 -1366
- package/dist/react-querybuilder_core.legacy-esm.d.ts +806 -1366
- package/dist/react-querybuilder_core.legacy-esm.js +455 -114
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +448 -117
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +806 -1366
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/styles/_layout.scss +61 -17
- package/dist/styles/_main.scss +22 -4
- package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
- package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
- package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DCCpjtyq.mjs} +3 -3
- package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DCCpjtyq.mjs.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +1 -1
- package/dist/transformQuery.mjs +2 -2
- package/package.json +14 -12
- package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
- package/dist/arrayUtils-D5EoIsKP.js +0 -164
- package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
- package/dist/basic-BfD-7CN3.d.mts +0 -1235
- package/dist/basic-C8xXKHIA.d.ts +0 -1235
- package/dist/objectUtils-BBZSfZJz.js +0 -17
- package/dist/objectUtils-BBZSfZJz.js.map +0 -1
- package/dist/objectUtils-BtWdcZVG.mjs +0 -11
- package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
- package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
- package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
- package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
- package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
|
@@ -1,77 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @group Defaults
|
|
4
|
-
*/
|
|
5
|
-
const defaultPlaceholderName = "~";
|
|
6
|
-
/**
|
|
7
|
-
* Default `name` for placeholder option in the `fields` array.
|
|
8
|
-
*
|
|
9
|
-
* @group Defaults
|
|
10
|
-
*/
|
|
11
|
-
const defaultPlaceholderFieldName = defaultPlaceholderName;
|
|
12
|
-
/**
|
|
13
|
-
* Default `name` for placeholder option in the `operators` array.
|
|
14
|
-
*
|
|
15
|
-
* @group Defaults
|
|
16
|
-
*/
|
|
17
|
-
const defaultPlaceholderOperatorName = defaultPlaceholderName;
|
|
18
|
-
/**
|
|
19
|
-
* Default character used to `.join` and `.split` arrays.
|
|
20
|
-
*
|
|
21
|
-
* @group Defaults
|
|
22
|
-
*/
|
|
23
|
-
const defaultJoinChar = ",";
|
|
24
|
-
/**
|
|
25
|
-
* Map of default operators to their respective opposite/negating operators.
|
|
26
|
-
*
|
|
27
|
-
* @group Defaults
|
|
28
|
-
*/
|
|
29
|
-
const defaultOperatorNegationMap = {
|
|
30
|
-
"=": "!=",
|
|
31
|
-
"!=": "=",
|
|
32
|
-
"<": ">=",
|
|
33
|
-
"<=": ">",
|
|
34
|
-
">": "<=",
|
|
35
|
-
">=": "<",
|
|
36
|
-
beginsWith: "doesNotBeginWith",
|
|
37
|
-
doesNotBeginWith: "beginsWith",
|
|
38
|
-
endsWith: "doesNotEndWith",
|
|
39
|
-
doesNotEndWith: "endsWith",
|
|
40
|
-
contains: "doesNotContain",
|
|
41
|
-
doesNotContain: "contains",
|
|
42
|
-
between: "notBetween",
|
|
43
|
-
notBetween: "between",
|
|
44
|
-
in: "notIn",
|
|
45
|
-
notIn: "in",
|
|
46
|
-
notNull: "null",
|
|
47
|
-
null: "notNull"
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Default combinator list.
|
|
51
|
-
*
|
|
52
|
-
* @group Defaults
|
|
53
|
-
*/
|
|
54
|
-
const defaultCombinators = [{
|
|
55
|
-
name: "and",
|
|
56
|
-
value: "and",
|
|
57
|
-
label: "AND"
|
|
58
|
-
}, {
|
|
59
|
-
name: "or",
|
|
60
|
-
value: "or",
|
|
61
|
-
label: "OR"
|
|
62
|
-
}];
|
|
63
|
-
/**
|
|
64
|
-
* Default combinator list, with `XOR` added.
|
|
65
|
-
*
|
|
66
|
-
* @group Defaults
|
|
67
|
-
*/
|
|
68
|
-
const defaultCombinatorsExtended = [...defaultCombinators, {
|
|
69
|
-
name: "xor",
|
|
70
|
-
value: "xor",
|
|
71
|
-
label: "XOR"
|
|
72
|
-
}];
|
|
1
|
+
import { c as defaultJoinChar } from "./optGroupUtils-VeZ3k7-1.mjs";
|
|
73
2
|
|
|
74
|
-
//#endregion
|
|
75
3
|
//#region src/utils/arrayUtils.ts
|
|
76
4
|
/**
|
|
77
5
|
* Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
|
|
@@ -118,5 +46,5 @@ const trimIfString = (val) => typeof val === "string" ? val.trim() : val;
|
|
|
118
46
|
const toArray = (v, { retainEmptyStrings } = {}) => Array.isArray(v) ? v.map((v$1) => trimIfString(v$1)) : typeof v === "string" ? splitBy(v, defaultJoinChar).filter(retainEmptyStrings ? () => true : (s) => !/^\s*$/.test(s)).map((s) => s.trim()) : typeof v === "number" ? [v] : [];
|
|
119
47
|
|
|
120
48
|
//#endregion
|
|
121
|
-
export {
|
|
122
|
-
//# sourceMappingURL=arrayUtils-
|
|
49
|
+
export { trimIfString as i, splitBy as n, toArray as r, joinWith as t };
|
|
50
|
+
//# sourceMappingURL=arrayUtils-A_OXU9W1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayUtils-A_OXU9W1.mjs","names":["v"],"sources":["../src/utils/arrayUtils.ts"],"sourcesContent":["import { defaultJoinChar } from '../defaults';\n\n/**\n * Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters\n * (characters preceded by a backslash) will not apply to the split, and the backslash will\n * be removed in the array element. Inverse of {@link joinWith}.\n *\n * @example\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,')\n * // or\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,', ',')\n * // would return\n * ['this,,that', '', 'the other', '', '', ',']\n */\nexport const splitBy = (str?: string, splitChar: string = defaultJoinChar): string[] =>\n typeof str === 'string'\n ? str\n .split(`\\\\${splitChar}`)\n .map(c => c.split(splitChar))\n .reduce((prev, curr, idx) => {\n if (idx === 0) {\n return curr;\n }\n return [...prev.slice(0, -1), `${prev.at(-1)}${splitChar}${curr[0]}`, ...curr.slice(1)];\n }, [])\n : [];\n\n/**\n * Joins an array of strings using the given character (see {@link defaultJoinChar}). When\n * the given character appears in an array element, a backslash will be added just before it\n * to distinguish it from the join character. Effectively the inverse of {@link splitBy}.\n *\n * TIP: The join character can actually be a string of any length. Only the first character\n * will be searched for in the array elements and preceded by a backslash.\n *\n * @example\n * joinWith(['this,,that', '', 'the other', '', '', ','], ', ')\n * // would return\n * 'this\\\\,\\\\,that, , the other, , , \\\\,'\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const joinWith = (strArr: any[], joinChar: string = defaultJoinChar): string =>\n strArr.map(str => `${str ?? ''}`.replaceAll(joinChar[0], `\\\\${joinChar[0]}`)).join(joinChar);\n\n/**\n * Trims the value if it is a string. Otherwise returns the value as is.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const trimIfString = (val: any): any => (typeof val === 'string' ? val.trim() : val);\n\n/**\n * Splits a string by comma then trims each element. Arrays are returned as is except\n * any string elements are trimmed.\n */\nexport const toArray = (\n // oxlint-disable-next-line typescript/no-explicit-any\n v: any,\n { retainEmptyStrings }: { retainEmptyStrings?: boolean } = {}\n // oxlint-disable-next-line typescript/no-explicit-any\n): any[] =>\n Array.isArray(v)\n ? v.map(v => trimIfString(v))\n : typeof v === 'string'\n ? splitBy(v, defaultJoinChar)\n .filter(retainEmptyStrings ? () => true : s => !/^\\s*$/.test(s))\n .map(s => s.trim())\n : typeof v === 'number'\n ? [v]\n : [];\n\n/**\n * Determines if an array is free of `null`/`undefined`.\n */\nexport const nullFreeArray = <T>(arr: T[]): arr is Exclude<T, null>[] =>\n arr.every(el => el === false || (el ?? false) !== false);\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,WAAW,KAAc,YAAoB,oBACxD,OAAO,QAAQ,WACX,IACG,MAAM,KAAK,YAAY,CACvB,KAAI,MAAK,EAAE,MAAM,UAAU,CAAC,CAC5B,QAAQ,MAAM,MAAM,QAAQ;AAC3B,KAAI,QAAQ,EACV,QAAO;AAET,QAAO;EAAC,GAAG,KAAK,MAAM,GAAG,GAAG;EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,YAAY,KAAK;EAAM,GAAG,KAAK,MAAM,EAAE;EAAC;GACtF,EAAE,CAAC,GACR,EAAE;;;;;;;;;;;;;;AAgBR,MAAa,YAAY,QAAe,WAAmB,oBACzD,OAAO,KAAI,QAAO,GAAG,OAAO,KAAK,WAAW,SAAS,IAAI,KAAK,SAAS,KAAK,CAAC,CAAC,KAAK,SAAS;;;;AAM9F,MAAa,gBAAgB,QAAmB,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG;;;;;AAMvF,MAAa,WAEX,GACA,EAAE,uBAAyD,EAAE,KAG7D,MAAM,QAAQ,EAAE,GACZ,EAAE,KAAI,QAAK,aAAaA,IAAE,CAAC,GAC3B,OAAO,MAAM,WACX,QAAQ,GAAG,gBAAgB,CACxB,OAAO,2BAA2B,QAAO,MAAK,CAAC,QAAQ,KAAK,EAAE,CAAC,CAC/D,KAAI,MAAK,EAAE,MAAM,CAAC,GACrB,OAAO,MAAM,WACX,CAAC,EAAE,GACH,EAAE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const require_optGroupUtils = require('./optGroupUtils-B0hTpodo.js');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/arrayUtils.ts
|
|
4
|
+
/**
|
|
5
|
+
* Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
|
|
6
|
+
* (characters preceded by a backslash) will not apply to the split, and the backslash will
|
|
7
|
+
* be removed in the array element. Inverse of {@link joinWith}.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* splitBy('this\\,\\,that,,the other,,,\\,')
|
|
11
|
+
* // or
|
|
12
|
+
* splitBy('this\\,\\,that,,the other,,,\\,', ',')
|
|
13
|
+
* // would return
|
|
14
|
+
* ['this,,that', '', 'the other', '', '', ',']
|
|
15
|
+
*/
|
|
16
|
+
const splitBy = (str, splitChar = require_optGroupUtils.defaultJoinChar) => typeof str === "string" ? str.split(`\\${splitChar}`).map((c) => c.split(splitChar)).reduce((prev, curr, idx) => {
|
|
17
|
+
if (idx === 0) return curr;
|
|
18
|
+
return [
|
|
19
|
+
...prev.slice(0, -1),
|
|
20
|
+
`${prev.at(-1)}${splitChar}${curr[0]}`,
|
|
21
|
+
...curr.slice(1)
|
|
22
|
+
];
|
|
23
|
+
}, []) : [];
|
|
24
|
+
/**
|
|
25
|
+
* Joins an array of strings using the given character (see {@link defaultJoinChar}). When
|
|
26
|
+
* the given character appears in an array element, a backslash will be added just before it
|
|
27
|
+
* to distinguish it from the join character. Effectively the inverse of {@link splitBy}.
|
|
28
|
+
*
|
|
29
|
+
* TIP: The join character can actually be a string of any length. Only the first character
|
|
30
|
+
* will be searched for in the array elements and preceded by a backslash.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
|
|
34
|
+
* // would return
|
|
35
|
+
* 'this\\,\\,that, , the other, , , \\,'
|
|
36
|
+
*/
|
|
37
|
+
const joinWith = (strArr, joinChar = require_optGroupUtils.defaultJoinChar) => strArr.map((str) => `${str ?? ""}`.replaceAll(joinChar[0], `\\${joinChar[0]}`)).join(joinChar);
|
|
38
|
+
/**
|
|
39
|
+
* Trims the value if it is a string. Otherwise returns the value as is.
|
|
40
|
+
*/
|
|
41
|
+
const trimIfString = (val) => typeof val === "string" ? val.trim() : val;
|
|
42
|
+
/**
|
|
43
|
+
* Splits a string by comma then trims each element. Arrays are returned as is except
|
|
44
|
+
* any string elements are trimmed.
|
|
45
|
+
*/
|
|
46
|
+
const toArray = (v, { retainEmptyStrings } = {}) => Array.isArray(v) ? v.map((v$1) => trimIfString(v$1)) : typeof v === "string" ? splitBy(v, require_optGroupUtils.defaultJoinChar).filter(retainEmptyStrings ? () => true : (s) => !/^\s*$/.test(s)).map((s) => s.trim()) : typeof v === "number" ? [v] : [];
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
Object.defineProperty(exports, 'joinWith', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return joinWith;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, 'splitBy', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return splitBy;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, 'toArray', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return toArray;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, 'trimIfString', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return trimIfString;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=arrayUtils-QxZOZTf6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayUtils-QxZOZTf6.js","names":["defaultJoinChar","v"],"sources":["../src/utils/arrayUtils.ts"],"sourcesContent":["import { defaultJoinChar } from '../defaults';\n\n/**\n * Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters\n * (characters preceded by a backslash) will not apply to the split, and the backslash will\n * be removed in the array element. Inverse of {@link joinWith}.\n *\n * @example\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,')\n * // or\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,', ',')\n * // would return\n * ['this,,that', '', 'the other', '', '', ',']\n */\nexport const splitBy = (str?: string, splitChar: string = defaultJoinChar): string[] =>\n typeof str === 'string'\n ? str\n .split(`\\\\${splitChar}`)\n .map(c => c.split(splitChar))\n .reduce((prev, curr, idx) => {\n if (idx === 0) {\n return curr;\n }\n return [...prev.slice(0, -1), `${prev.at(-1)}${splitChar}${curr[0]}`, ...curr.slice(1)];\n }, [])\n : [];\n\n/**\n * Joins an array of strings using the given character (see {@link defaultJoinChar}). When\n * the given character appears in an array element, a backslash will be added just before it\n * to distinguish it from the join character. Effectively the inverse of {@link splitBy}.\n *\n * TIP: The join character can actually be a string of any length. Only the first character\n * will be searched for in the array elements and preceded by a backslash.\n *\n * @example\n * joinWith(['this,,that', '', 'the other', '', '', ','], ', ')\n * // would return\n * 'this\\\\,\\\\,that, , the other, , , \\\\,'\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const joinWith = (strArr: any[], joinChar: string = defaultJoinChar): string =>\n strArr.map(str => `${str ?? ''}`.replaceAll(joinChar[0], `\\\\${joinChar[0]}`)).join(joinChar);\n\n/**\n * Trims the value if it is a string. Otherwise returns the value as is.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const trimIfString = (val: any): any => (typeof val === 'string' ? val.trim() : val);\n\n/**\n * Splits a string by comma then trims each element. Arrays are returned as is except\n * any string elements are trimmed.\n */\nexport const toArray = (\n // oxlint-disable-next-line typescript/no-explicit-any\n v: any,\n { retainEmptyStrings }: { retainEmptyStrings?: boolean } = {}\n // oxlint-disable-next-line typescript/no-explicit-any\n): any[] =>\n Array.isArray(v)\n ? v.map(v => trimIfString(v))\n : typeof v === 'string'\n ? splitBy(v, defaultJoinChar)\n .filter(retainEmptyStrings ? () => true : s => !/^\\s*$/.test(s))\n .map(s => s.trim())\n : typeof v === 'number'\n ? [v]\n : [];\n\n/**\n * Determines if an array is free of `null`/`undefined`.\n */\nexport const nullFreeArray = <T>(arr: T[]): arr is Exclude<T, null>[] =>\n arr.every(el => el === false || (el ?? false) !== false);\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,WAAW,KAAc,YAAoBA,0CACxD,OAAO,QAAQ,WACX,IACG,MAAM,KAAK,YAAY,CACvB,KAAI,MAAK,EAAE,MAAM,UAAU,CAAC,CAC5B,QAAQ,MAAM,MAAM,QAAQ;AAC3B,KAAI,QAAQ,EACV,QAAO;AAET,QAAO;EAAC,GAAG,KAAK,MAAM,GAAG,GAAG;EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,YAAY,KAAK;EAAM,GAAG,KAAK,MAAM,EAAE;EAAC;GACtF,EAAE,CAAC,GACR,EAAE;;;;;;;;;;;;;;AAgBR,MAAa,YAAY,QAAe,WAAmBA,0CACzD,OAAO,KAAI,QAAO,GAAG,OAAO,KAAK,WAAW,SAAS,IAAI,KAAK,SAAS,KAAK,CAAC,CAAC,KAAK,SAAS;;;;AAM9F,MAAa,gBAAgB,QAAmB,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG;;;;;AAMvF,MAAa,WAEX,GACA,EAAE,uBAAyD,EAAE,KAG7D,MAAM,QAAQ,EAAE,GACZ,EAAE,KAAI,QAAK,aAAaC,IAAE,CAAC,GAC3B,OAAO,MAAM,WACX,QAAQ,GAAGD,sCAAgB,CACxB,OAAO,2BAA2B,QAAO,MAAK,CAAC,QAAQ,KAAK,EAAE,CAAC,CAC/D,KAAI,MAAK,EAAE,MAAM,CAAC,GACrB,OAAO,MAAM,WACX,CAAC,EAAE,GACH,EAAE"}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { Except, SetRequired, Simplify } from "type-fest";
|
|
2
|
+
|
|
3
|
+
//#region src/types/options.d.ts
|
|
4
|
+
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { [Key in KeysType]-?: Required<Pick<ObjectType, Key>> & Partial<Pick<ObjectType, Exclude<KeysType, Key>>> }[KeysType] & Except<ObjectType, KeysType>;
|
|
5
|
+
/**
|
|
6
|
+
* Adds an `unknown` index property to an interface.
|
|
7
|
+
*/
|
|
8
|
+
type WithUnknownIndex<T> = T & {
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Do not use this type directly; use {@link Option}, {@link ValueOption},
|
|
13
|
+
* or {@link FullOption} instead. For specific option types, you can use
|
|
14
|
+
* {@link FullField}, {@link FullOperator}, or {@link FullCombinator},
|
|
15
|
+
* all of which extend {@link FullOption}.
|
|
16
|
+
*
|
|
17
|
+
* @group Option Lists
|
|
18
|
+
*/
|
|
19
|
+
interface BaseOption<N extends string = string> {
|
|
20
|
+
name?: N;
|
|
21
|
+
value?: N;
|
|
22
|
+
label: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A generic option. Used directly in {@link OptionList} or
|
|
27
|
+
* as the child element of an {@link OptionGroup}.
|
|
28
|
+
*
|
|
29
|
+
* @group Option Lists
|
|
30
|
+
*/
|
|
31
|
+
type Option<N extends string = string> = Simplify<WithUnknownIndex<SetRequired<BaseOption<N>, "name">>>;
|
|
32
|
+
/**
|
|
33
|
+
* A generic {@link Option} with either a `name` or `value` as its primary identifier.
|
|
34
|
+
* {@link OptionList}-type props on the {@link react-querybuilder!QueryBuilder QueryBuilder} component accept this type,
|
|
35
|
+
* but corresponding props passed down to subcomponents will always be augmented
|
|
36
|
+
* to {@link FullOption} first.
|
|
37
|
+
*
|
|
38
|
+
* @group Option Lists
|
|
39
|
+
*/
|
|
40
|
+
type FlexibleOption<N extends string = string> = Simplify<WithUnknownIndex<RequireAtLeastOne<BaseOption<N>, "name" | "value">>>;
|
|
41
|
+
/**
|
|
42
|
+
* Utility type to turn an {@link Option}, {@link ValueOption}, or {@link BaseOption}
|
|
43
|
+
* into a {@link FlexibleOption}.
|
|
44
|
+
*
|
|
45
|
+
* @group Option Lists
|
|
46
|
+
*/
|
|
47
|
+
type ToFlexibleOption<Opt$1 extends BaseOption | string> = WithUnknownIndex<RequireAtLeastOne<Opt$1 extends string ? FlexibleOption<Opt$1> : Opt$1, "name" | "value">>;
|
|
48
|
+
/**
|
|
49
|
+
* A generic {@link Option} requiring both `name` _and_ `value` properties.
|
|
50
|
+
* Props that extend {@link OptionList} accept {@link BaseOption}, but
|
|
51
|
+
* corresponding props sent to subcomponents will always be augmented to this
|
|
52
|
+
* type first to ensure both `name` and `value` are available.
|
|
53
|
+
*
|
|
54
|
+
* NOTE: Do not extend from this type directly. Use {@link BaseFullOption}
|
|
55
|
+
* (optionally wrapped in {@link WithUnknownIndex}) instead, otherwise
|
|
56
|
+
* the `unknown` index property will cause issues. See {@link Option} and
|
|
57
|
+
* {@link ValueOption} for examples.
|
|
58
|
+
*
|
|
59
|
+
* @group Option Lists
|
|
60
|
+
*/
|
|
61
|
+
type FullOption<N extends string = string> = Simplify<WithUnknownIndex<SetRequired<BaseOption<N>, "name" | "value">>>;
|
|
62
|
+
/**
|
|
63
|
+
* This type is identical to {@link FullOption} but without the `unknown` index
|
|
64
|
+
* property. Extend from this type instead of {@link FullOption} directly.
|
|
65
|
+
*
|
|
66
|
+
* @group Option Lists
|
|
67
|
+
*/
|
|
68
|
+
type BaseFullOption<N extends string = string> = Simplify<SetRequired<BaseOption<N>, "name" | "value">>;
|
|
69
|
+
/**
|
|
70
|
+
* Utility type to turn an {@link Option}, {@link ValueOption} or
|
|
71
|
+
* {@link BaseOption} into a {@link FullOption}.
|
|
72
|
+
*
|
|
73
|
+
* @group Option Lists
|
|
74
|
+
*/
|
|
75
|
+
type ToFullOption<Opt$1 extends BaseOption> = Opt$1 extends BaseFullOption ? Opt$1 : Opt$1 extends BaseOption<infer IdentifierType> ? WithUnknownIndex<Opt$1 & FullOption<IdentifierType>> : never;
|
|
76
|
+
/**
|
|
77
|
+
* A group of {@link Option}s, usually within an {@link OptionList}.
|
|
78
|
+
*
|
|
79
|
+
* @group Option Lists
|
|
80
|
+
*/
|
|
81
|
+
interface OptionGroup<Opt$1 extends BaseOption = FlexibleOption> {
|
|
82
|
+
label: string;
|
|
83
|
+
options: WithUnknownIndex<Opt$1>[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A group of {@link BaseOption}s, usually within a {@link FlexibleOptionList}.
|
|
87
|
+
*
|
|
88
|
+
* @group Option Lists
|
|
89
|
+
*/
|
|
90
|
+
type FlexibleOptionGroup<Opt$1 extends BaseOption | string = BaseOption> = {
|
|
91
|
+
label: string;
|
|
92
|
+
options: (Opt$1 extends BaseFullOption ? Opt$1 : ToFlexibleOption<Opt$1>)[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Either an array of {@link Option}s or an array of {@link OptionGroup}s.
|
|
96
|
+
*
|
|
97
|
+
* @group Option Lists
|
|
98
|
+
*/
|
|
99
|
+
type OptionList<Opt$1 extends Option = Option> = Opt$1[] | OptionGroup<Opt$1>[];
|
|
100
|
+
/**
|
|
101
|
+
* An array of options or option groups, like {@link OptionList} but the option type
|
|
102
|
+
* may use either `name` or `value` as the primary identifier.
|
|
103
|
+
*
|
|
104
|
+
* @group Option Lists
|
|
105
|
+
*/
|
|
106
|
+
type FlexibleOptionList<Opt$1 extends BaseOption> = ToFlexibleOption<Opt$1>[] | FlexibleOptionGroup<ToFlexibleOption<Opt$1>>[];
|
|
107
|
+
/**
|
|
108
|
+
* An array of options or option groups, like {@link OptionList}, but using
|
|
109
|
+
* {@link FullOption} instead of {@link Option}. This means that every member is
|
|
110
|
+
* guaranteed to have both `name` and `value`.
|
|
111
|
+
*
|
|
112
|
+
* @group Option Lists
|
|
113
|
+
*/
|
|
114
|
+
type FullOptionList<Opt$1 extends BaseOption> = Opt$1 extends BaseFullOption ? Opt$1[] | OptionGroup<Opt$1>[] : ToFullOption<Opt$1>[] | OptionGroup<ToFullOption<Opt$1>>[];
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/types/ruleGroups.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* Properties common to both rules and groups.
|
|
119
|
+
*/
|
|
120
|
+
interface CommonRuleAndGroupProperties {
|
|
121
|
+
path?: Path;
|
|
122
|
+
id?: string;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Whether this rule or group is muted. When muted, the rule or group
|
|
126
|
+
* is excluded from query export formats (SQL, JSON, MongoDB, etc.).
|
|
127
|
+
* For groups, muting recursively mutes all children.
|
|
128
|
+
*/
|
|
129
|
+
muted?: boolean;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The main rule type. The `field`, `operator`, and `value` properties
|
|
133
|
+
* can be narrowed with generics.
|
|
134
|
+
*/
|
|
135
|
+
interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string> extends CommonRuleAndGroupProperties {
|
|
136
|
+
field: F;
|
|
137
|
+
operator: O;
|
|
138
|
+
value: V;
|
|
139
|
+
valueSource?: ValueSource;
|
|
140
|
+
match?: MatchConfig;
|
|
141
|
+
/**
|
|
142
|
+
* Only used when adding a rule to a query that uses independent combinators.
|
|
143
|
+
*/
|
|
144
|
+
combinatorPreceding?: C;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The main rule group type. This type is used for query definitions as well as
|
|
148
|
+
* all sub-groups of queries.
|
|
149
|
+
*/
|
|
150
|
+
interface RuleGroupType<R extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
|
|
151
|
+
combinator: C;
|
|
152
|
+
rules: RuleGroupArray<RuleGroupType<R, C>, R>;
|
|
153
|
+
not?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The type of the `rules` array in a {@link RuleGroupType}.
|
|
157
|
+
*/
|
|
158
|
+
type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R extends RuleType = RuleType> = (R | RG)[];
|
|
159
|
+
/**
|
|
160
|
+
* The type of the `rules` array in a {@link DefaultRuleGroupType}.
|
|
161
|
+
*/
|
|
162
|
+
type DefaultRuleGroupArray<F extends string = string> = RuleGroupArray<DefaultRuleGroupType, DefaultRuleType<F>>;
|
|
163
|
+
/**
|
|
164
|
+
* {@link RuleGroupType} with the `combinator` property limited to
|
|
165
|
+
* {@link DefaultCombinatorNameExtended} and `rules` limited to {@link DefaultRuleType}.
|
|
166
|
+
*/
|
|
167
|
+
type DefaultRuleGroupType<F extends string = string> = RuleGroupType<DefaultRuleType<F>, DefaultCombinatorNameExtended> & {
|
|
168
|
+
rules: DefaultRuleGroupArray<F>;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* {@link RuleType} with the `operator` property limited to {@link DefaultOperatorName}.
|
|
172
|
+
*/
|
|
173
|
+
type DefaultRuleType<F extends string = string> = RuleType<F, DefaultOperatorName>;
|
|
174
|
+
/**
|
|
175
|
+
* Default allowed values for the `combinator` property.
|
|
176
|
+
*
|
|
177
|
+
* @group Option Lists
|
|
178
|
+
*/
|
|
179
|
+
type DefaultCombinatorName = "and" | "or";
|
|
180
|
+
/**
|
|
181
|
+
* Default allowed values for the `combinator` property, plus `"xor"`.
|
|
182
|
+
*
|
|
183
|
+
* @group Option Lists
|
|
184
|
+
*/
|
|
185
|
+
type DefaultCombinatorNameExtended = DefaultCombinatorName | "xor";
|
|
186
|
+
/**
|
|
187
|
+
* Default values for the `operator` property.
|
|
188
|
+
*
|
|
189
|
+
* @group Option Lists
|
|
190
|
+
*/
|
|
191
|
+
type DefaultOperatorName = "=" | "!=" | "<" | ">" | "<=" | ">=" | "contains" | "beginsWith" | "endsWith" | "doesNotContain" | "doesNotBeginWith" | "doesNotEndWith" | "null" | "notNull" | "in" | "notIn" | "between" | "notBetween";
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/types/ruleGroupsIC.utils.d.ts
|
|
194
|
+
type MAXIMUM_ALLOWED_BOUNDARY = 80;
|
|
195
|
+
type MappedTuple<Tuple extends Array<unknown>, Result extends Array<unknown> = [], Count extends ReadonlyArray<number> = []> = Count["length"] extends MAXIMUM_ALLOWED_BOUNDARY ? Result : Tuple extends [] ? [] : Result extends [] ? MappedTuple<Tuple, Tuple, [...Count, 1]> : MappedTuple<Tuple, Result | [...Result, ...Tuple], [...Count, 1]>;
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/types/ruleGroupsIC.d.ts
|
|
198
|
+
/**
|
|
199
|
+
* The main rule group interface when using independent combinators. This type is used
|
|
200
|
+
* for query definitions as well as all sub-groups of queries.
|
|
201
|
+
*/
|
|
202
|
+
interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R, C>, "combinator" | "rules"> {
|
|
203
|
+
combinator?: undefined;
|
|
204
|
+
rules: RuleGroupICArray<RuleGroupTypeIC<R, C>, R, C>;
|
|
205
|
+
/**
|
|
206
|
+
* Only used when adding a rule to a query that uses independent combinators
|
|
207
|
+
*/
|
|
208
|
+
combinatorPreceding?: C;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Shorthand for "either {@link RuleGroupType} or {@link RuleGroupTypeIC}".
|
|
212
|
+
*/
|
|
213
|
+
type RuleGroupTypeAny<R extends RuleType = RuleType, C extends string = string> = RuleGroupType<R, C> | RuleGroupTypeIC<R, C>;
|
|
214
|
+
/**
|
|
215
|
+
* The type of the `rules` array in a {@link RuleGroupTypeIC}.
|
|
216
|
+
*/
|
|
217
|
+
type RuleGroupICArray<RG extends RuleGroupTypeIC = RuleGroupTypeIC, R extends RuleType = RuleType, C extends string = string> = [R | RG] | [R | RG, ...MappedTuple<[C, R | RG]>] | ((R | RG)[] & {
|
|
218
|
+
length: 0;
|
|
219
|
+
});
|
|
220
|
+
/**
|
|
221
|
+
* The type of the `rules` array in a {@link DefaultRuleGroupTypeIC}.
|
|
222
|
+
*/
|
|
223
|
+
type DefaultRuleGroupICArray<F extends string = string> = RuleGroupICArray<DefaultRuleGroupTypeIC<F>, DefaultRuleType<F>, DefaultCombinatorName>;
|
|
224
|
+
/**
|
|
225
|
+
* {@link RuleGroupTypeIC} with combinators limited to
|
|
226
|
+
* {@link DefaultCombinatorName} and rules limited to {@link DefaultRuleType}.
|
|
227
|
+
*/
|
|
228
|
+
interface DefaultRuleGroupTypeIC<F extends string = string> extends RuleGroupTypeIC<DefaultRuleType<F>> {
|
|
229
|
+
rules: DefaultRuleGroupICArray<F>;
|
|
230
|
+
}
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/types/validation.d.ts
|
|
233
|
+
/**
|
|
234
|
+
* Object with a `valid` boolean value and optional `reasons`.
|
|
235
|
+
*/
|
|
236
|
+
interface ValidationResult {
|
|
237
|
+
valid: boolean;
|
|
238
|
+
reasons?: any[];
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Map of rule/group `id` to its respective {@link ValidationResult}.
|
|
242
|
+
*/
|
|
243
|
+
type ValidationMap = Record<string, boolean | ValidationResult>;
|
|
244
|
+
/**
|
|
245
|
+
* Function that validates a query.
|
|
246
|
+
*/
|
|
247
|
+
type QueryValidator = (query: RuleGroupTypeAny) => boolean | ValidationMap;
|
|
248
|
+
/**
|
|
249
|
+
* Function that validates a rule.
|
|
250
|
+
*/
|
|
251
|
+
type RuleValidator = (rule: RuleType) => boolean | ValidationResult;
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/types/basic.d.ts
|
|
254
|
+
/**
|
|
255
|
+
* @see https://react-querybuilder.js.org/docs/tips/path
|
|
256
|
+
*/
|
|
257
|
+
type Path = number[];
|
|
258
|
+
/**
|
|
259
|
+
* String of classnames, array of classname strings, or object where the
|
|
260
|
+
* keys are classnames and those with truthy values will be included.
|
|
261
|
+
* Suitable for passing to the `clsx` package.
|
|
262
|
+
*/
|
|
263
|
+
type Classname = string | string[] | Record<string, any>;
|
|
264
|
+
/**
|
|
265
|
+
* A source for the `value` property of a rule.
|
|
266
|
+
*/
|
|
267
|
+
type ValueSource = "value" | "field";
|
|
268
|
+
/**
|
|
269
|
+
* Type of {@link react-querybuilder!ValueEditor ValueEditor} that will be displayed.
|
|
270
|
+
*/
|
|
271
|
+
type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "switch" | "multiselect" | null;
|
|
272
|
+
/**
|
|
273
|
+
* A valid array of potential value sources.
|
|
274
|
+
*
|
|
275
|
+
* @see {@link ValueSource}
|
|
276
|
+
*/
|
|
277
|
+
type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
|
|
278
|
+
type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
|
|
279
|
+
type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption<Sources[K]> } : never;
|
|
280
|
+
type WithOptionalClassName<T> = T & {
|
|
281
|
+
className?: Classname;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* HTML5 input types
|
|
285
|
+
*/
|
|
286
|
+
type InputType = "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week" | "bigint" | (string & {});
|
|
287
|
+
/**
|
|
288
|
+
* Quantification mode describing how many elements of the value array must pass
|
|
289
|
+
* the filter for the rule itself to pass.
|
|
290
|
+
*
|
|
291
|
+
* For "atLeast", "atMost", and "exactly", the threshold value will be converted to
|
|
292
|
+
* a percentage if the number is less than 1. Non-numeric values and numbers less
|
|
293
|
+
* than 0 will be ignored.
|
|
294
|
+
*/
|
|
295
|
+
interface MatchConfig {
|
|
296
|
+
mode: MatchMode;
|
|
297
|
+
threshold?: number | null | undefined;
|
|
298
|
+
}
|
|
299
|
+
type MatchMode = "all" | "some" | "none" | "atLeast" | "atMost" | "exactly";
|
|
300
|
+
/**
|
|
301
|
+
* Base for all Field types/interfaces.
|
|
302
|
+
*/
|
|
303
|
+
interface BaseFullField<FieldName extends string = string, OperatorName extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName>, ValueObj extends FullOption = FullOption<ValueName>> extends WithOptionalClassName<BaseFullOption<FieldName>> {
|
|
304
|
+
id?: string;
|
|
305
|
+
operators?: FlexibleOptionList<OperatorObj> | OperatorName[] | FlexibleOption<OperatorName>[] | (OperatorName | FlexibleOption<OperatorName>)[];
|
|
306
|
+
valueEditorType?: ValueEditorType | ((operator: OperatorName) => ValueEditorType);
|
|
307
|
+
valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName) => ValueSources | ValueSourceFlexibleOptions);
|
|
308
|
+
inputType?: InputType | null;
|
|
309
|
+
values?: FlexibleOptionList<ValueObj>;
|
|
310
|
+
matchModes?: boolean | MatchMode[] | FlexibleOption<MatchMode>[];
|
|
311
|
+
/** Properties of items in the value. */
|
|
312
|
+
subproperties?: FlexibleOptionList<FullField>;
|
|
313
|
+
defaultOperator?: OperatorName;
|
|
314
|
+
defaultValue?: any;
|
|
315
|
+
placeholder?: string;
|
|
316
|
+
validator?: RuleValidator;
|
|
317
|
+
comparator?: string | ((f: FullField, operator: string) => boolean);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Full field definition used in the `fields` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
|
|
321
|
+
* This type requires both `name` and `value`, but the `fields` prop itself
|
|
322
|
+
* can use a {@link FlexibleOption} where only one of `name` or `value` is
|
|
323
|
+
* required (along with `label`), or {@link Field} where only `name` and
|
|
324
|
+
* `label` are required.
|
|
325
|
+
*
|
|
326
|
+
* The `name`/`value`, `operators`, and `values` properties of this interface
|
|
327
|
+
* can be narrowed with generics.
|
|
328
|
+
*
|
|
329
|
+
* @group Option Lists
|
|
330
|
+
*/
|
|
331
|
+
type FullField<FieldName extends string = string, OperatorName extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName>, ValueObj extends FullOption = FullOption<ValueName>> = Simplify<FullOption<FieldName> & BaseFullField<FieldName, OperatorName, ValueName, OperatorObj, ValueObj>>;
|
|
332
|
+
/**
|
|
333
|
+
* Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
|
|
334
|
+
* a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
|
|
335
|
+
*/
|
|
336
|
+
type Arity = number | "unary" | "binary" | "ternary";
|
|
337
|
+
/**
|
|
338
|
+
* Full operator definition used in the `operators`/`getOperators` props of
|
|
339
|
+
* {@link react-querybuilder!QueryBuilder QueryBuilder}. This type requires both `name` and `value`, but the
|
|
340
|
+
* `operators`/`getOperators` props themselves can use a {@link FlexibleOption}
|
|
341
|
+
* where only one of `name` or `value` is required, or {@link FullOperator} where
|
|
342
|
+
* only `name` is required.
|
|
343
|
+
*
|
|
344
|
+
* The `name`/`value` properties of this interface can be narrowed with generics.
|
|
345
|
+
*
|
|
346
|
+
* @group Option Lists
|
|
347
|
+
*/
|
|
348
|
+
interface FullOperator<N extends string = string> extends WithOptionalClassName<FullOption<N>> {
|
|
349
|
+
arity?: Arity;
|
|
350
|
+
}
|
|
351
|
+
type ParseNumberMethodName = "enhanced" | "native" | "strict";
|
|
352
|
+
/**
|
|
353
|
+
* Parsing algorithms used by {@link parseNumber}.
|
|
354
|
+
*/
|
|
355
|
+
|
|
356
|
+
type ParseNumbersModerationLevel = "-limited" | "";
|
|
357
|
+
/**
|
|
358
|
+
* Options for the `parseNumbers` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
|
|
359
|
+
*/
|
|
360
|
+
type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersModerationLevel}`;
|
|
361
|
+
//#endregion
|
|
362
|
+
export { RuleGroupType as _, ValueSource as a, FullOptionList as b, RuleValidator as c, DefaultRuleGroupTypeIC as d, RuleGroupTypeAny as f, DefaultRuleGroupType as g, DefaultOperatorName as h, ParseNumbersPropConfig as i, ValidationMap as l, DefaultCombinatorName as m, FullOperator as n, ValueSources as o, RuleGroupTypeIC as p, InputType as r, QueryValidator as s, FullField as t, ValidationResult as u, RuleType as v, OptionList as x, FlexibleOptionList as y };
|
|
363
|
+
//# sourceMappingURL=basic-DEc65Kng.d.mts.map
|