@bagelink/vue 1.6.73 → 1.6.77
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/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Upload/upload.d.ts +0 -1
- package/dist/components/form/inputs/Upload/upload.d.ts.map +1 -1
- package/dist/components/form/inputs/Upload/useFileUpload.d.ts.map +1 -1
- package/dist/composables/index.d.ts +0 -1
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/index.cjs +25 -25
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4200 -4396
- package/dist/plugins/bagel.d.ts +2 -6
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ModalForm.vue +6 -5
- package/src/components/form/inputs/Upload/upload.ts +7 -14
- package/src/components/form/inputs/Upload/useFileUpload.ts +0 -3
- package/src/composables/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/plugins/bagel.ts +17 -23
- package/src/utils/index.ts +7 -13
- package/src/composables/useBagel.ts +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,IAAI,GAAE,MAAY,QAO1D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,UAMlC;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ3D;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,I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AE,MAAM,sBAc5C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG,CAa1F;AAID,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,GAAG,SAAS,CAQzF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,QA6BpE"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Path } from '@bagelink/vue'
|
|
3
3
|
import type { ComponentExposed } from 'vue-component-type-helpers'
|
|
4
4
|
import type { ModalFormOptions } from '../plugins/modalTypes'
|
|
5
|
-
import { Btn, Modal,
|
|
5
|
+
import { Btn, Modal, BagelForm } from '@bagelink/vue'
|
|
6
6
|
import { ref } from 'vue'
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line vue/prop-name-casing
|
|
@@ -16,8 +16,6 @@ const emit = defineEmits<{
|
|
|
16
16
|
'update:visible': [value: boolean]
|
|
17
17
|
}>()
|
|
18
18
|
|
|
19
|
-
const bagel = useBagel()
|
|
20
|
-
|
|
21
19
|
const modal = ref<ComponentExposed<typeof Modal>>()
|
|
22
20
|
|
|
23
21
|
const formData = defineModel<T>('modelValue', {
|
|
@@ -40,8 +38,11 @@ async function runSubmit() {
|
|
|
40
38
|
closeModal()
|
|
41
39
|
} catch (err: any) {
|
|
42
40
|
submitting.value = false
|
|
43
|
-
if (props.onError) {
|
|
44
|
-
|
|
41
|
+
if (props.onError) {
|
|
42
|
+
props.onError(err)
|
|
43
|
+
} else {
|
|
44
|
+
console.error('[ModalForm] Submit error:', err)
|
|
45
|
+
}
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import type { AxiosResponse } from 'axios'
|
|
2
2
|
import type { BglFile, BglFilePatch, UploadOptions } from './upload.types.d.ts'
|
|
3
3
|
import axios from 'axios'
|
|
4
|
-
import { getBagelInstance } from '../../../../composables/useBagel'
|
|
5
4
|
|
|
6
|
-
//
|
|
7
|
-
const
|
|
5
|
+
// Using default 'files' endpoint - axios baseURL will be configured via SDK init
|
|
6
|
+
const FILES_ENDPOINT = 'files'
|
|
8
7
|
|
|
9
8
|
export const files = {
|
|
10
|
-
setBaseUrl: (baseUrl?: string) => {
|
|
11
|
-
if (baseUrl === undefined || baseUrl === '') { return }
|
|
12
|
-
baseUrl = baseUrl.replace(/\/$/, '')
|
|
13
|
-
axios.defaults.baseURL = baseUrl
|
|
14
|
-
},
|
|
15
|
-
|
|
16
9
|
get: async (pathKey?: string): Promise<AxiosResponse<BglFile>> => {
|
|
17
|
-
return axios.get(`/${
|
|
10
|
+
return axios.get(`/${FILES_ENDPOINT}/`, { params: { path_key: pathKey } })
|
|
18
11
|
},
|
|
19
12
|
|
|
20
13
|
put: async (
|
|
21
14
|
bglFilePatch: BglFilePatch,
|
|
22
15
|
pathKey?: string
|
|
23
16
|
): Promise<AxiosResponse<BglFile>> => {
|
|
24
|
-
return axios.put(`/${
|
|
17
|
+
return axios.put(`/${FILES_ENDPOINT}/`, bglFilePatch, { params: { path_key: pathKey } })
|
|
25
18
|
},
|
|
26
19
|
|
|
27
20
|
delete: async (pathKey?: string) => {
|
|
28
|
-
return axios.delete(`/${
|
|
21
|
+
return axios.delete(`/${FILES_ENDPOINT}/`, { params: { path_key: pathKey } })
|
|
29
22
|
},
|
|
30
23
|
|
|
31
24
|
upload: async (
|
|
@@ -36,7 +29,7 @@ export const files = {
|
|
|
36
29
|
// Backend expects multipart field name "file"
|
|
37
30
|
formData.append('file', file)
|
|
38
31
|
formData.append('upload', file)
|
|
39
|
-
return axios.post(`/${
|
|
32
|
+
return axios.post(`/${FILES_ENDPOINT}/upload`, formData, {
|
|
40
33
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
41
34
|
onUploadProgress: options?.onUploadProgress,
|
|
42
35
|
params: { dir_path: options?.dirPath, tags: options?.tags },
|
|
@@ -44,6 +37,6 @@ export const files = {
|
|
|
44
37
|
},
|
|
45
38
|
|
|
46
39
|
list: async (dirPath?: string): Promise<AxiosResponse<BglFile[]>> => {
|
|
47
|
-
return axios.get(`/${
|
|
40
|
+
return axios.get(`/${FILES_ENDPOINT}/list`, { params: { dir_path: dirPath } })
|
|
48
41
|
}
|
|
49
42
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MaybeRefOrGetter } from 'vue'
|
|
2
2
|
import type { BglFile, QueueFile } from './upload.types'
|
|
3
|
-
import { useBagel } from '@bagelink/vue'
|
|
4
3
|
import { ref, computed, onMounted, toValue, } from 'vue'
|
|
5
4
|
import { files } from './upload'
|
|
6
5
|
|
|
@@ -14,8 +13,6 @@ interface UseFileUploadProps {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export function useFileUpload(props: UseFileUploadProps = {}) {
|
|
17
|
-
files.setBaseUrl(useBagel().host)
|
|
18
|
-
|
|
19
16
|
const namespace = props.namespace || 'default'
|
|
20
17
|
|
|
21
18
|
const fileQueue = ref<QueueFile[]>([])
|
package/src/composables/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { getFallbackSchema } from '@bagelink/vue'
|
|
|
5
5
|
import { computed, ref, toValue, watch } from 'vue'
|
|
6
6
|
|
|
7
7
|
export { useAddToCalendar } from './useAddToCalendar'
|
|
8
|
-
export { getBagelInstance, setBagelInstance, useBagel } from './useBagel'
|
|
9
8
|
export { useDevice } from './useDevice'
|
|
10
9
|
export { useExcel } from './useExcel'
|
|
11
10
|
export { usePolling } from './usePolling'
|
package/src/index.ts
CHANGED
package/src/plugins/bagel.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { InjectionKey, Plugin } from 'vue'
|
|
2
|
-
import { Bagel } from '@bagelink/sdk'
|
|
3
2
|
import FloatingVue from 'floating-vue'
|
|
4
3
|
import { inject } from 'vue'
|
|
5
4
|
|
|
6
5
|
import lightboxPlugin from '../components/lightbox/index'
|
|
7
|
-
import { setBagelInstance } from '../composables/useBagel'
|
|
8
6
|
import { ripple, pattern } from '../directives'
|
|
9
7
|
import { useLang } from '../utils'
|
|
10
8
|
import clickOutside from '../utils/clickOutside'
|
|
9
|
+
import { ModalPlugin } from './useModal'
|
|
10
|
+
import { ToastPlugin, type BagelToastOptions } from './useToast'
|
|
11
11
|
|
|
12
|
-
export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel>
|
|
13
12
|
export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<(key: string) => string>
|
|
14
13
|
|
|
15
14
|
export function injectI18nT(injectionKey: typeof i18nTInjectionKey = i18nTInjectionKey) {
|
|
@@ -22,29 +21,23 @@ export interface BagelOptions {
|
|
|
22
21
|
availableLangs?: string[]
|
|
23
22
|
defaultLang?: string
|
|
24
23
|
language?: string
|
|
25
|
-
host?: string
|
|
26
|
-
fileBaseUrl?: string
|
|
27
|
-
fileVersion?: string
|
|
28
|
-
onError?: (err: Error) => void
|
|
29
|
-
|
|
30
24
|
i18nT?: (key: string) => string
|
|
25
|
+
toast?: BagelToastOptions
|
|
31
26
|
}
|
|
32
|
-
export const BagelVue: Plugin<BagelOptions> = {
|
|
33
|
-
install: (app, options) => {
|
|
34
|
-
const bagel = new Bagel({
|
|
35
|
-
host: options.host,
|
|
36
|
-
fileBaseUrl: options.fileBaseUrl,
|
|
37
|
-
fileVersion: options.fileVersion,
|
|
38
|
-
onError: options.onError
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
// Set global Bagel instance for the composable
|
|
42
|
-
setBagelInstance(bagel)
|
|
43
27
|
|
|
28
|
+
export const BagelVue: Plugin<BagelOptions> = {
|
|
29
|
+
install: (app, options = {}) => {
|
|
30
|
+
// Install directives
|
|
44
31
|
app.directive('click-outside', clickOutside)
|
|
45
32
|
app.directive('ripple', ripple)
|
|
46
33
|
app.directive('pattern', pattern)
|
|
34
|
+
|
|
35
|
+
// Install UI plugins
|
|
47
36
|
app.use(lightboxPlugin)
|
|
37
|
+
app.use(ModalPlugin)
|
|
38
|
+
app.use(ToastPlugin, options.toast || {})
|
|
39
|
+
|
|
40
|
+
// Install FloatingVue for tooltips/popovers
|
|
48
41
|
app.use(FloatingVue, {
|
|
49
42
|
themes: {
|
|
50
43
|
'bgl-theme': {
|
|
@@ -54,14 +47,15 @@ export const BagelVue: Plugin<BagelOptions> = {
|
|
|
54
47
|
},
|
|
55
48
|
},
|
|
56
49
|
})
|
|
50
|
+
|
|
51
|
+
// Setup language configuration
|
|
57
52
|
const { availableLangs, defaultLang, lang } = useLang()
|
|
58
53
|
if (options.availableLangs) { availableLangs.value = options.availableLangs }
|
|
59
54
|
if (options.defaultLang) { defaultLang.value = options.defaultLang }
|
|
60
55
|
if (options.language) { lang.value = options.language }
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
app.config.globalProperties.$i18T
|
|
64
|
-
= options.i18nT || ((key?: string) => key)
|
|
56
|
+
|
|
57
|
+
// Setup i18n translation function
|
|
58
|
+
app.config.globalProperties.$i18T = options.i18nT || ((key?: string) => key)
|
|
65
59
|
app.provide(i18nTInjectionKey, options.i18nT || ((key: string) => key))
|
|
66
60
|
},
|
|
67
61
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -206,27 +206,21 @@ export { useLang } from './lang'
|
|
|
206
206
|
export { formatString } from './strings'
|
|
207
207
|
export { useDebounceFn } from '@vueuse/core'
|
|
208
208
|
|
|
209
|
-
import { getBagelInstance } from '../composables/useBagel'
|
|
210
|
-
|
|
211
209
|
const URL_REGEX = /^https?:\/\/|^\/\//
|
|
212
210
|
|
|
213
211
|
export function pathKeyToURL(pathKey?: string) {
|
|
214
|
-
if (pathKey === undefined || pathKey === '' || URL_REGEX.test(pathKey)) {
|
|
215
|
-
|
|
216
|
-
const bagel = getBagelInstance()
|
|
217
|
-
if (!bagel) {
|
|
218
|
-
console.warn('Bagel instance is not initialized. Please install BagelVue plugin.')
|
|
212
|
+
if (pathKey === undefined || pathKey === '' || URL_REGEX.test(pathKey)) {
|
|
219
213
|
return pathKey
|
|
220
214
|
}
|
|
221
215
|
|
|
216
|
+
// For static files from the API server, return relative path
|
|
222
217
|
if (pathKey.startsWith('static/')) {
|
|
223
|
-
|
|
224
|
-
console.warn('Bagel host is not configured. Please set it in BagelVue options.')
|
|
225
|
-
return pathKey
|
|
226
|
-
}
|
|
227
|
-
return `${bagel.host}/${pathKey}`
|
|
218
|
+
return `/${pathKey}`
|
|
228
219
|
}
|
|
229
|
-
|
|
220
|
+
|
|
221
|
+
// For uploaded files, use the default file server
|
|
222
|
+
// TODO: Make this configurable via SDK init
|
|
223
|
+
const baseUrl = 'https://files.bagel.design'
|
|
230
224
|
return `${baseUrl}/${pathKey}`
|
|
231
225
|
}
|
|
232
226
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Bagel } from '@bagelink/sdk'
|
|
2
|
-
import { shallowRef } from 'vue'
|
|
3
|
-
|
|
4
|
-
// Global state for the Bagel instance (using shallowRef to avoid deep reactivity on class instance)
|
|
5
|
-
const bagelInstance = shallowRef<Bagel | null>(null)
|
|
6
|
-
|
|
7
|
-
export function useBagel(): Bagel {
|
|
8
|
-
const instance = bagelInstance.value
|
|
9
|
-
if (!instance) {
|
|
10
|
-
throw new Error('Bagel instance is not initialized. Please install BagelVue plugin first.')
|
|
11
|
-
}
|
|
12
|
-
return instance
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function setBagelInstance(instance: Bagel) {
|
|
16
|
-
bagelInstance.value = instance
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function getBagelInstance(): Bagel | null {
|
|
20
|
-
return bagelInstance.value
|
|
21
|
-
}
|