@bagelink/vue 1.4.115 → 1.4.118

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.
@@ -1,4 +1,4 @@
1
- import type { Attributes, BglFormSchemaT, Path } from '@bagelink/vue'
1
+ import type { Attributes, BglFormSchemaT, Path } from '../types/BagelForm'
2
2
 
3
3
  const debouncers = new Map<() => void, ReturnType<typeof setTimeout>>()
4
4
 
@@ -93,7 +93,7 @@ export function iffer(field: any, itemData: any) {
93
93
  }
94
94
 
95
95
  export function denullify(itemData?: { [key: string]: any }, fieldID?: string) {
96
- if (!fieldID) return
96
+ if (!fieldID) return undefined
97
97
  return itemData ? itemData[fieldID] : undefined
98
98
  }
99
99
 
@@ -132,7 +132,8 @@ export async function appendScript(src: string, options?: { id?: string }): Prom
132
132
  await sleep(1)
133
133
  // If this script is already loading, return the existing promise
134
134
  if (scriptsLoading.has(scriptId)) {
135
- return scriptsLoading.get(scriptId)!
135
+ const existingPromise = scriptsLoading.get(scriptId)
136
+ if (existingPromise) return existingPromise
136
137
  }
137
138
 
138
139
  // Check if script is already in the document
@@ -157,7 +158,7 @@ export async function appendScript(src: string, options?: { id?: string }): Prom
157
158
  }
158
159
 
159
160
  script.onerror = (err) => {
160
- reject(err)
161
+ reject(new Error(String(err)))
161
162
  // Remove from loading scripts map on error
162
163
  scriptsLoading.delete(scriptId)
163
164
  }
@@ -241,7 +242,8 @@ export function downloadFile(source: string | Blob, fileName?: string) {
241
242
 
242
243
  if (typeof source === 'string') {
243
244
  link.href = upgradeHeaders(source)
244
- link.download = fileName || source.split('/').pop() || 'download'
245
+ const fileNameFromSource = source.split('/').pop()
246
+ link.download = fileName || fileNameFromSource || 'download'
245
247
  } else {
246
248
  const url = URL.createObjectURL(source)
247
249
  link.href = url