@budibase/frontend-core 2.2.3 → 2.2.4-alpha.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/package.json +3 -3
- package/src/utils/lucene.js +23 -10
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4-alpha.0",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"svelte": "src/index.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@budibase/bbui": "
|
|
9
|
+
"@budibase/bbui": "2.2.4-alpha.0",
|
|
10
10
|
"lodash": "^4.17.21",
|
|
11
11
|
"svelte": "^3.46.2"
|
|
12
12
|
},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "e4f14f013c9627ba5c97aed22a30b697dc9bbcb9"
|
|
14
14
|
}
|
package/src/utils/lucene.js
CHANGED
|
@@ -7,7 +7,7 @@ const HBS_REGEX = /{{([^{].*?)}}/g
|
|
|
7
7
|
* Returns the valid operator options for a certain data type
|
|
8
8
|
* @param type the data type
|
|
9
9
|
*/
|
|
10
|
-
export const getValidOperatorsForType = type => {
|
|
10
|
+
export const getValidOperatorsForType = (type, field, datasource) => {
|
|
11
11
|
const Op = OperatorOptions
|
|
12
12
|
const stringOps = [
|
|
13
13
|
Op.Equals,
|
|
@@ -27,24 +27,37 @@ export const getValidOperatorsForType = type => {
|
|
|
27
27
|
Op.NotEmpty,
|
|
28
28
|
Op.In,
|
|
29
29
|
]
|
|
30
|
+
let ops = []
|
|
30
31
|
if (type === "string") {
|
|
31
|
-
|
|
32
|
+
ops = stringOps
|
|
32
33
|
} else if (type === "number") {
|
|
33
|
-
|
|
34
|
+
ops = numOps
|
|
34
35
|
} else if (type === "options") {
|
|
35
|
-
|
|
36
|
+
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
|
36
37
|
} else if (type === "array") {
|
|
37
|
-
|
|
38
|
+
ops = [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty, Op.ContainsAny]
|
|
38
39
|
} else if (type === "boolean") {
|
|
39
|
-
|
|
40
|
+
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
|
|
40
41
|
} else if (type === "longform") {
|
|
41
|
-
|
|
42
|
+
ops = stringOps
|
|
42
43
|
} else if (type === "datetime") {
|
|
43
|
-
|
|
44
|
+
ops = numOps
|
|
44
45
|
} else if (type === "formula") {
|
|
45
|
-
|
|
46
|
+
ops = stringOps.concat([Op.MoreThan, Op.LessThan])
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
|
|
49
|
+
// Filter out "like" for internal tables
|
|
50
|
+
const externalTable = datasource?.tableId?.includes("datasource_plus")
|
|
51
|
+
if (datasource?.type === "table" && !externalTable) {
|
|
52
|
+
ops = ops.filter(x => x !== Op.Like)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Only allow equal/not equal for _id in SQL tables
|
|
56
|
+
if (field === "_id" && externalTable) {
|
|
57
|
+
ops = [Op.Equals, Op.NotEquals]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return ops
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
/**
|