@budibase/frontend-core 1.2.40 → 1.2.41-alpha.2

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 CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "1.2.40",
3
+ "version": "1.2.41-alpha.2",
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": "^1.2.40",
9
+ "@budibase/bbui": "1.2.41-alpha.2",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "849aa083c79bffc75057411e422ba9df045663bb"
13
+ "gitHead": "38f5b81fbe16edc53e54a2d98a772bc93342bcde"
14
14
  }
package/src/constants.js CHANGED
@@ -39,13 +39,17 @@ export const OperatorOptions = {
39
39
  label: "Contains",
40
40
  },
41
41
  NotContains: {
42
- value: "notEqual",
42
+ value: "notContains",
43
43
  label: "Does Not Contain",
44
44
  },
45
45
  In: {
46
46
  value: "oneOf",
47
47
  label: "Is in",
48
48
  },
49
+ ContainsAny: {
50
+ value: "containsAny",
51
+ label: "Has any",
52
+ },
49
53
  }
50
54
 
51
55
  // Cookie names
@@ -12,5 +12,7 @@
12
12
  --spectrum-global-color-gray-700: hsl(var(--hue), var(--sat), 70%);
13
13
  --spectrum-global-color-gray-800: hsl(var(--hue), var(--sat), 80%);
14
14
  --spectrum-global-color-gray-900: hsl(var(--hue), var(--sat), 95%);
15
+
16
+ --modal-background: var(--spectrum-global-color-gray-50);
15
17
  }
16
18
 
@@ -43,4 +43,7 @@
43
43
 
44
44
  --spectrum-alias-highlight-hover: rgba(169, 177, 193, 0.1);
45
45
  --spectrum-alias-highlight-active: rgba(169, 177, 193, 0.1);
46
+ --spectrum-alias-background-color-hover-overlay: rgba(169, 177, 193, 0.1);
47
+
48
+ --modal-background: var(--spectrum-global-color-gray-50);
46
49
  }
@@ -32,9 +32,9 @@ export const getValidOperatorsForType = type => {
32
32
  } else if (type === "number") {
33
33
  return numOps
34
34
  } else if (type === "options") {
35
- return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
35
+ return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
36
36
  } else if (type === "array") {
37
- return [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty]
37
+ return [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty, Op.ContainsAny]
38
38
  } else if (type === "boolean") {
39
39
  return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
40
40
  } else if (type === "longform") {
@@ -96,6 +96,7 @@ export const buildLuceneQuery = filter => {
96
96
  contains: {},
97
97
  notContains: {},
98
98
  oneOf: {},
99
+ containsAny: {},
99
100
  }
100
101
  if (Array.isArray(filter)) {
101
102
  filter.forEach(expression => {
@@ -103,6 +104,10 @@ export const buildLuceneQuery = filter => {
103
104
  const isHbs =
104
105
  typeof value === "string" && value.match(HBS_REGEX)?.length > 0
105
106
  // Parse all values into correct types
107
+ if (operator === "allOr") {
108
+ query.allOr = true
109
+ return
110
+ }
106
111
  if (type === "datetime") {
107
112
  // Ensure date value is a valid date and parse into correct format
108
113
  if (!value) {
@@ -124,6 +129,13 @@ export const buildLuceneQuery = filter => {
124
129
  if (type === "boolean") {
125
130
  value = `${value}`?.toLowerCase() === "true"
126
131
  }
132
+ if (
133
+ ["contains", "notContains", "containsAny"].includes(operator) &&
134
+ type === "array" &&
135
+ typeof value === "string"
136
+ ) {
137
+ value = value.split(",")
138
+ }
127
139
  if (operator.startsWith("range")) {
128
140
  const minint =
129
141
  SqlNumberTypeRangeMap[externalType]?.min || Number.MIN_SAFE_INTEGER
@@ -240,6 +252,18 @@ export const runLuceneQuery = (docs, query) => {
240
252
  return !testValue?.includes(docValue)
241
253
  })
242
254
 
255
+ const containsAny = match("containsAny", (docValue, testValue) => {
256
+ return !docValue?.includes(...testValue)
257
+ })
258
+
259
+ const contains = match("contains", (docValue, testValue) => {
260
+ return !testValue?.every(item => docValue?.includes(item))
261
+ })
262
+
263
+ const notContains = match("notContains", (docValue, testValue) => {
264
+ return testValue?.every(item => docValue?.includes(item))
265
+ })
266
+
243
267
  // Match a document against all criteria
244
268
  const docMatch = doc => {
245
269
  return (
@@ -250,7 +274,10 @@ export const runLuceneQuery = (docs, query) => {
250
274
  notEqualMatch(doc) &&
251
275
  emptyMatch(doc) &&
252
276
  notEmptyMatch(doc) &&
253
- oneOf(doc)
277
+ oneOf(doc) &&
278
+ contains(doc) &&
279
+ containsAny(doc) &&
280
+ notContains(doc)
254
281
  )
255
282
  }
256
283