@budibase/frontend-core 1.2.57 → 1.2.58-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.57",
3
+ "version": "1.2.58-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.57",
9
+ "@budibase/bbui": "1.2.58-alpha.2",
10
10
  "lodash": "^4.17.21",
11
11
  "svelte": "^3.46.2"
12
12
  },
13
- "gitHead": "605b91baf8bed0f1ffbb2d3304d4525c866bdd77"
13
+ "gitHead": "675fdd4b88456e4a663f8e2efb148556e0a35aab"
14
14
  }
@@ -61,5 +61,32 @@ export const buildAttachmentEndpoints = API => {
61
61
  })
62
62
  return { publicUrl }
63
63
  },
64
+
65
+ /**
66
+ * Deletes attachments from the bucket.
67
+ * @param keys the attachments to delete
68
+ * @param tableId the associated table ID
69
+ */
70
+ deleteAttachments: async ({ keys, tableId }) => {
71
+ return await API.post({
72
+ url: `/api/attachments/${tableId}/delete`,
73
+ body: {
74
+ keys,
75
+ },
76
+ })
77
+ },
78
+
79
+ /**
80
+ * Deletes attachments from the builder bucket.
81
+ * @param keys the attachments to delete
82
+ */
83
+ deleteBuilderAttachments: async keys => {
84
+ return await API.post({
85
+ url: `/api/attachments/delete`,
86
+ body: {
87
+ keys,
88
+ },
89
+ })
90
+ },
64
91
  }
65
92
  }
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
@@ -245,6 +257,18 @@ export const runLuceneQuery = (docs, query) => {
245
257
  return !testValue?.includes(docValue)
246
258
  })
247
259
 
260
+ const containsAny = match("containsAny", (docValue, testValue) => {
261
+ return !docValue?.includes(...testValue)
262
+ })
263
+
264
+ const contains = match("contains", (docValue, testValue) => {
265
+ return !testValue?.every(item => docValue?.includes(item))
266
+ })
267
+
268
+ const notContains = match("notContains", (docValue, testValue) => {
269
+ return testValue?.every(item => docValue?.includes(item))
270
+ })
271
+
248
272
  // Match a document against all criteria
249
273
  const docMatch = doc => {
250
274
  return (
@@ -255,7 +279,10 @@ export const runLuceneQuery = (docs, query) => {
255
279
  notEqualMatch(doc) &&
256
280
  emptyMatch(doc) &&
257
281
  notEmptyMatch(doc) &&
258
- oneOf(doc)
282
+ oneOf(doc) &&
283
+ contains(doc) &&
284
+ containsAny(doc) &&
285
+ notContains(doc)
259
286
  )
260
287
  }
261
288