@budibase/frontend-core 3.34.3 → 3.34.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "3.34.3",
3
+ "version": "3.34.5",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -18,11 +18,10 @@
18
18
  "ai": "^6.0.116",
19
19
  "dayjs": "^1.10.8",
20
20
  "lodash": "4.17.23",
21
- "shortid": "2.2.15",
22
21
  "socket.io-client": "^4.7.5"
23
22
  },
24
23
  "devDependencies": {
25
24
  "vitest": "^3.2.4"
26
25
  },
27
- "gitHead": "9c56751662ed542fe5398a29d207dd55198c9f83"
26
+ "gitHead": "3cd6b13566b94f609768435eba58baec699ce040"
28
27
  }
package/src/api/index.ts CHANGED
@@ -158,7 +158,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
158
158
  headers["Content-Type"] = "application/json"
159
159
  }
160
160
  if (config?.attachHeaders) {
161
- config.attachHeaders(headers)
161
+ config.attachHeaders(headers, { url, method })
162
162
  }
163
163
 
164
164
  // Build request body
package/src/api/types.ts CHANGED
@@ -60,7 +60,10 @@ export type Headers = Record<string, string>
60
60
 
61
61
  export type APIClientConfig = {
62
62
  enableCaching?: boolean
63
- attachHeaders?: (headers: Headers) => void
63
+ attachHeaders?: (
64
+ headers: Headers,
65
+ request?: { url: string; method: HTTPMethod }
66
+ ) => void
64
67
  onError?: (error: APIError) => void
65
68
  onMigrationDetected?: (migration: string) => void
66
69
  }
@@ -23,7 +23,8 @@
23
23
  let isOpen = false
24
24
  let anchor
25
25
 
26
- $: editable = focused && !readonly
26
+ $: hasAttachments = Array.isArray(value) && value.length > 0
27
+ $: openable = readonly ? hasAttachments : focused
27
28
  $: {
28
29
  if (!focused) {
29
30
  close()
@@ -35,6 +36,9 @@
35
36
  }
36
37
 
37
38
  const open = () => {
39
+ if (!openable) {
40
+ return
41
+ }
38
42
  isOpen = true
39
43
  }
40
44
 
@@ -87,8 +91,8 @@
87
91
  <!-- svelte-ignore a11y-click-events-have-key-events -->
88
92
  <div
89
93
  class="attachment-cell"
90
- class:editable
91
- on:click={editable ? open : null}
94
+ class:openable
95
+ on:click={openable ? open : null}
92
96
  bind:this={anchor}
93
97
  >
94
98
  {#each value || [] as attachment}
@@ -113,6 +117,7 @@
113
117
  <Dropzone
114
118
  {value}
115
119
  compact
120
+ disabled={readonly}
116
121
  on:change={e => onChange(e.detail)}
117
122
  maximum={maximum || schema.constraints?.length?.maximum}
118
123
  {processFiles}
@@ -135,7 +140,7 @@
135
140
  overflow: hidden;
136
141
  user-select: none;
137
142
  }
138
- .attachment-cell.editable:hover {
143
+ .attachment-cell.openable:hover {
139
144
  cursor: pointer;
140
145
  }
141
146
  .file {