@budibase/frontend-core 2.24.1 → 2.25.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 CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.24.1",
3
+ "version": "2.25.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": "2.24.1",
10
- "@budibase/shared-core": "2.24.1",
11
- "@budibase/types": "2.24.1",
9
+ "@budibase/bbui": "2.25.0",
10
+ "@budibase/shared-core": "2.25.0",
11
+ "@budibase/types": "2.25.0",
12
12
  "dayjs": "^1.10.8",
13
13
  "lodash": "4.17.21",
14
14
  "shortid": "2.2.15",
15
15
  "socket.io-client": "^4.6.1"
16
16
  },
17
- "gitHead": "5cb6ac027c7f45e174e3545a7399d425822970d8"
17
+ "gitHead": "75d949ef66bf20519446d3999c3412e106ef561d"
18
18
  }
@@ -124,6 +124,7 @@
124
124
  const fieldSchema = schemaFields.find(x => x.name === filter.field)
125
125
  filter.type = fieldSchema?.type
126
126
  filter.subtype = fieldSchema?.subtype
127
+ filter.formulaType = fieldSchema?.formulaType
127
128
 
128
129
  // Update external type based on field
129
130
  filter.externalType = getSchema(filter)?.externalType
@@ -288,6 +289,7 @@
288
289
  OperatorOptions.ContainsAny.value,
289
290
  ].includes(filter.operator)}
290
291
  disabled={filter.noValue}
292
+ type={filter.valueType}
291
293
  />
292
294
  {:else}
293
295
  <Input disabled />
@@ -324,8 +326,6 @@
324
326
  <style>
325
327
  .container {
326
328
  width: 100%;
327
- max-width: 1000px;
328
- margin: 0 auto;
329
329
  }
330
330
  .fields {
331
331
  display: grid;
@@ -4,6 +4,7 @@
4
4
  import { createAPIClient } from "../api"
5
5
 
6
6
  export let API = createAPIClient()
7
+
7
8
  export let value = null
8
9
  export let disabled
9
10
  export let multiselect = false
@@ -23,12 +24,14 @@
23
24
  $: component = multiselect ? Multiselect : Select
24
25
  </script>
25
26
 
26
- <svelte:component
27
- this={component}
28
- bind:value
29
- autocomplete
30
- {options}
31
- getOptionLabel={option => option.email}
32
- getOptionValue={option => option._id}
33
- {disabled}
34
- />
27
+ <div class="user-control">
28
+ <svelte:component
29
+ this={component}
30
+ bind:value
31
+ autocomplete
32
+ {options}
33
+ getOptionLabel={option => option.email}
34
+ getOptionValue={option => option._id}
35
+ {disabled}
36
+ />
37
+ </div>
@@ -121,8 +121,14 @@
121
121
 
122
122
  const onContextMenu = e => {
123
123
  e.preventDefault()
124
- ui.actions.blur()
125
- open = !open
124
+
125
+ // The timeout allows time for clickoutside to close other open popvers
126
+ // before we show this one. Without the timeout, this popover closes again
127
+ // before it's even visible as clickoutside closes it.
128
+ setTimeout(() => {
129
+ ui.actions.blur()
130
+ open = !open
131
+ }, 10)
126
132
  }
127
133
 
128
134
  const sortAscending = () => {
@@ -18,7 +18,7 @@
18
18
  focusedCellAPI,
19
19
  focusedRowId,
20
20
  notifications,
21
- isDatasourcePlus,
21
+ hasBudibaseIdentifiers,
22
22
  } = getContext("grid")
23
23
 
24
24
  let anchor
@@ -82,7 +82,7 @@
82
82
  </MenuItem>
83
83
  <MenuItem
84
84
  icon="Copy"
85
- disabled={isNewRow || !$focusedRow?._id || !$isDatasourcePlus}
85
+ disabled={isNewRow || !$focusedRow?._id || !$hasBudibaseIdentifiers}
86
86
  on:click={() => copyToClipboard($focusedRow?._id)}
87
87
  on:click={menu.actions.close}
88
88
  >
@@ -90,7 +90,7 @@
90
90
  </MenuItem>
91
91
  <MenuItem
92
92
  icon="Copy"
93
- disabled={isNewRow || !$focusedRow?._rev}
93
+ disabled={isNewRow || !$focusedRow?._rev || !$hasBudibaseIdentifiers}
94
94
  on:click={() => copyToClipboard($focusedRow?._rev)}
95
95
  on:click={menu.actions.close}
96
96
  >
@@ -75,14 +75,18 @@ export const deriveStores = context => {
75
75
  }
76
76
  )
77
77
 
78
- const isDatasourcePlus = derived(datasource, $datasource => {
79
- return ["table", "viewV2"].includes($datasource?.type)
78
+ const hasBudibaseIdentifiers = derived(datasource, $datasource => {
79
+ let type = $datasource?.type
80
+ if (type === "provider") {
81
+ type = $datasource.value?.datasource?.type
82
+ }
83
+ return ["table", "viewV2", "link"].includes(type)
80
84
  })
81
85
 
82
86
  return {
83
87
  schema,
84
88
  enrichedSchema,
85
- isDatasourcePlus,
89
+ hasBudibaseIdentifiers,
86
90
  }
87
91
  }
88
92
 
@@ -17,6 +17,7 @@ export const createActions = context => {
17
17
 
18
18
  const open = (cellId, e) => {
19
19
  e.preventDefault()
20
+ e.stopPropagation()
20
21
 
21
22
  // Get DOM node for grid data wrapper to compute relative position to
22
23
  const gridNode = document.getElementById(gridID)
@@ -83,7 +83,7 @@ export const createActions = context => {
83
83
  error,
84
84
  notifications,
85
85
  fetch,
86
- isDatasourcePlus,
86
+ hasBudibaseIdentifiers,
87
87
  refreshing,
88
88
  } = context
89
89
  const instanceLoaded = writable(false)
@@ -196,9 +196,16 @@ export const createActions = context => {
196
196
  // Handles validation errors from the rows API and updates local validation
197
197
  // state, storing error messages against relevant cells
198
198
  const handleValidationError = (rowId, error) => {
199
+ let errorString
200
+ if (typeof error === "string") {
201
+ errorString = error
202
+ } else if (typeof error?.message === "string") {
203
+ errorString = error.message
204
+ }
205
+
199
206
  // If the server doesn't reply with a valid error, assume that the source
200
207
  // of the error is the focused cell's column
201
- if (!error?.json?.validationErrors && error?.message) {
208
+ if (!error?.json?.validationErrors && errorString) {
202
209
  const focusedColumn = get(focusedCellId)?.split("-")[1]
203
210
  if (focusedColumn) {
204
211
  error = {
@@ -261,7 +268,7 @@ export const createActions = context => {
261
268
  focusedCellId.set(`${rowId}-${erroredColumns[0]}`)
262
269
  }
263
270
  } else {
264
- get(notifications).error(error?.message || "An unknown error occurred")
271
+ get(notifications).error(errorString || "An unknown error occurred")
265
272
  }
266
273
  }
267
274
 
@@ -458,14 +465,14 @@ export const createActions = context => {
458
465
  }
459
466
  let rowsToAppend = []
460
467
  let newRow
461
- const $isDatasourcePlus = get(isDatasourcePlus)
468
+ const $hasBudibaseIdentifiers = get(hasBudibaseIdentifiers)
462
469
  for (let i = 0; i < newRows.length; i++) {
463
470
  newRow = newRows[i]
464
471
 
465
472
  // Ensure we have a unique _id.
466
473
  // This means generating one for non DS+, overwriting any that may already
467
474
  // exist as we cannot allow duplicates.
468
- if (!$isDatasourcePlus) {
475
+ if (!$hasBudibaseIdentifiers) {
469
476
  newRow._id = Helpers.uuid()
470
477
  }
471
478
 
@@ -510,7 +517,7 @@ export const createActions = context => {
510
517
  const cleanRow = row => {
511
518
  let clone = { ...row }
512
519
  delete clone.__idx
513
- if (!get(isDatasourcePlus)) {
520
+ if (!get(hasBudibaseIdentifiers)) {
514
521
  delete clone._id
515
522
  }
516
523
  return clone
package/src/constants.js CHANGED
@@ -57,6 +57,7 @@ export const PlanType = {
57
57
  PRO: "pro",
58
58
  BUSINESS: "business",
59
59
  ENTERPRISE: "enterprise",
60
+ ENTERPRISE_BASIC_TRIAL: "enterprise_basic_trial",
60
61
  }
61
62
 
62
63
  /**
@@ -124,8 +125,8 @@ export const TypeIconMap = {
124
125
  [FieldType.ARRAY]: "Duplicate",
125
126
  [FieldType.NUMBER]: "123",
126
127
  [FieldType.BOOLEAN]: "Boolean",
127
- [FieldType.ATTACHMENTS]: "Attach",
128
- [FieldType.ATTACHMENT_SINGLE]: "Attach",
128
+ [FieldType.ATTACHMENTS]: "DocumentFragmentGroup",
129
+ [FieldType.ATTACHMENT_SINGLE]: "DocumentFragment",
129
130
  [FieldType.LINK]: "DataCorrelated",
130
131
  [FieldType.FORMULA]: "Calculator",
131
132
  [FieldType.JSON]: "Brackets",