@bagelink/vue 0.0.466 → 0.0.471
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/Accordion.vue.d.ts.map +1 -1
- package/dist/components/AccordionItem.vue.d.ts.map +1 -1
- package/dist/components/Alert.vue.d.ts +2 -2
- package/dist/components/Alert.vue.d.ts.map +1 -1
- package/dist/components/Avatar.vue.d.ts.map +1 -1
- package/dist/components/Badge.vue.d.ts +2 -2
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/BglVideo.vue.d.ts +2 -2
- package/dist/components/BglVideo.vue.d.ts.map +1 -1
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/Card.vue.d.ts.map +1 -1
- package/dist/components/Carousel.vue.d.ts +4 -2
- package/dist/components/Carousel.vue.d.ts.map +1 -1
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/Flag.vue.d.ts.map +1 -1
- package/dist/components/ListItem.vue.d.ts.map +1 -1
- package/dist/components/ListView.vue.d.ts.map +1 -1
- package/dist/components/MapEmbed.vue.d.ts +2 -2
- package/dist/components/MapEmbed.vue.d.ts.map +1 -1
- package/dist/components/MaterialIcon.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts +2 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalConfirm.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/PageTitle.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Title.vue.d.ts.map +1 -1
- package/dist/components/dashboard/Lineart.vue.d.ts.map +1 -1
- package/dist/components/dashboard/index.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +4 -2
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts +2 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/JSONInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SignaturePad.vue.d.ts +56 -0
- package/dist/components/form/inputs/SignaturePad.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts +2 -2
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +1 -0
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/BottomMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts +2 -2
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -1
- package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsBody.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/index.cjs +17616 -20818
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +17616 -20818
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +14 -14
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +330 -309
- package/dist/types/BagelForm.d.ts +16 -16
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/BtnOptions.d.ts +1 -1
- package/dist/types/BtnOptions.d.ts.map +1 -1
- package/dist/types/NavLink.d.ts +2 -2
- package/dist/types/NavLink.d.ts.map +1 -1
- package/dist/types/file.d.ts +2 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/materialIcons.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/allCountries.d.ts +2 -2
- package/dist/utils/allCountries.d.ts.map +1 -1
- package/dist/utils/clickOutside.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +19 -17
- package/src/components/Accordion.vue +10 -10
- package/src/components/AccordionItem.vue +47 -47
- package/src/components/Alert.vue +21 -21
- package/src/components/Avatar.vue +15 -15
- package/src/components/Badge.vue +17 -16
- package/src/components/BglVideo.vue +43 -43
- package/src/components/Btn.vue +64 -65
- package/src/components/Card.vue +26 -26
- package/src/components/Carousel.vue +130 -134
- package/src/components/DataPreview.vue +30 -30
- package/src/components/Flag.vue +26 -26
- package/src/components/ListItem.vue +13 -13
- package/src/components/ListView.vue +2 -2
- package/src/components/MapEmbed.vue +33 -33
- package/src/components/MaterialIcon.vue +12 -12
- package/src/components/Modal.vue +73 -66
- package/src/components/ModalConfirm.vue +18 -18
- package/src/components/ModalForm.vue +79 -76
- package/src/components/NavBar.vue +33 -30
- package/src/components/PageTitle.vue +10 -8
- package/src/components/TableSchema.vue +123 -113
- package/src/components/Title.vue +8 -8
- package/src/components/dashboard/Lineart.vue +103 -96
- package/src/components/dashboard/index.ts +1 -1
- package/src/components/form/BglField.vue +61 -61
- package/src/components/form/BglFieldSet.vue +9 -8
- package/src/components/form/BglForm.vue +71 -70
- package/src/components/form/index.ts +4 -4
- package/src/components/form/inputs/CheckInput.vue +25 -23
- package/src/components/form/inputs/Checkbox.vue +10 -10
- package/src/components/form/inputs/ColorPicker.vue +26 -24
- package/src/components/form/inputs/DateInput.vue +39 -39
- package/src/components/form/inputs/DatePicker.vue +37 -36
- package/src/components/form/inputs/FileUpload.vue +165 -161
- package/src/components/form/inputs/FileUploadURL.vue +134 -132
- package/src/components/form/inputs/JSONInput.vue +29 -29
- package/src/components/form/inputs/RadioPillsInput.vue +49 -49
- package/src/components/form/inputs/RichText.vue +62 -63
- package/src/components/form/inputs/SelectInput.vue +173 -167
- package/src/components/form/inputs/SignaturePad.vue +150 -0
- package/src/components/form/inputs/TableField.vue +77 -76
- package/src/components/form/inputs/TelInput.vue +280 -285
- package/src/components/form/inputs/TextInput.vue +81 -76
- package/src/components/form/inputs/ToggleInput.vue +13 -13
- package/src/components/form/inputs/index.ts +17 -15
- package/src/components/formkit/FileUploader.vue +162 -158
- package/src/components/formkit/MiscFields.vue +20 -20
- package/src/components/formkit/Toggle.vue +13 -13
- package/src/components/index.ts +28 -28
- package/src/components/layout/BottomMenu.vue +25 -21
- package/src/components/layout/Layout.vue +29 -29
- package/src/components/layout/SidebarMenu.vue +31 -27
- package/src/components/layout/TabbedLayout.vue +47 -45
- package/src/components/layout/Tabs.vue +32 -32
- package/src/components/layout/TabsBody.vue +10 -10
- package/src/components/layout/TabsNav.vue +44 -44
- package/src/components/layout/index.ts +7 -7
- package/src/components/layout/tabsManager.ts +6 -6
- package/src/index.ts +13 -8
- package/src/plugins/bagel.ts +37 -37
- package/src/plugins/modal.ts +66 -67
- package/src/styles/layout.css +5 -3
- package/src/styles/mobilLayout.css +7 -0
- package/src/types/BagelForm.ts +27 -27
- package/src/types/BtnOptions.ts +13 -13
- package/src/types/NavLink.ts +8 -8
- package/src/types/file.ts +11 -11
- package/src/types/index.ts +16 -12
- package/src/types/materialIcons.ts +3249 -3249
- package/src/utils/BagelFormUtils.ts +23 -23
- package/src/utils/allCountries.ts +11 -12
- package/src/utils/clickOutside.ts +6 -6
- package/src/utils/index.ts +39 -41
- package/src/utils/lang.ts +13 -13
- package/src/utils/strings.ts +9 -9
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -8
- package/dist/components/Popover.vue.d.ts +0 -10
- package/dist/components/Popover.vue.d.ts.map +0 -1
- package/dist/types/materialIcon.d.ts +0 -2
- package/dist/types/materialIcon.d.ts.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, reactive } from 'vue'
|
|
2
2
|
|
|
3
|
-
const state = reactive(new Map())
|
|
3
|
+
const state = reactive(new Map())
|
|
4
4
|
|
|
5
5
|
export function useTabs(group: string) {
|
|
6
6
|
if (!state.has(group)) {
|
|
7
|
-
state.set(group, reactive({ currentTab: null }))
|
|
7
|
+
state.set(group, reactive({ currentTab: null }))
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const currentTab = computed({
|
|
11
11
|
get: () => state.get(group).currentTab,
|
|
12
12
|
set: (val) => {
|
|
13
|
-
state.get(group).currentTab = val
|
|
13
|
+
state.get(group).currentTab = val
|
|
14
14
|
},
|
|
15
|
-
})
|
|
15
|
+
})
|
|
16
16
|
|
|
17
|
-
return { currentTab }
|
|
17
|
+
return { currentTab }
|
|
18
18
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export {
|
|
2
|
-
BagelVue,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
BagelVue,
|
|
3
|
+
type BagelOptions,
|
|
4
|
+
bagelInjectionKey,
|
|
5
|
+
useBagel,
|
|
6
|
+
useI18nT,
|
|
7
|
+
i18nTInjectionKey,
|
|
8
|
+
} from './plugins/bagel'
|
|
9
|
+
export { ModalPlugin, useModal } from './plugins/modal'
|
|
10
|
+
export * from './utils'
|
|
11
|
+
export * from './types'
|
|
12
|
+
export * from './components'
|
|
13
|
+
export * from './utils/allCountries'
|
|
14
|
+
import './styles/bagel.css'
|
package/src/plugins/bagel.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
// import { vTooltip } from 'floating-vue';
|
|
2
|
-
import FloatingVue from 'floating-vue'
|
|
3
|
-
import { inject } from 'vue'
|
|
4
|
-
import type { InjectionKey, Plugin } from 'vue'
|
|
5
|
-
import { Bagel } from '@bagelink/sdk'
|
|
6
|
-
import clickOutside from '../utils/clickOutside'
|
|
7
|
-
import { useLang } from '../utils'
|
|
8
|
-
|
|
9
|
-
export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel
|
|
2
|
+
import FloatingVue from 'floating-vue'
|
|
3
|
+
import { inject } from 'vue'
|
|
4
|
+
import type { InjectionKey, Plugin } from 'vue'
|
|
5
|
+
import { Bagel } from '@bagelink/sdk'
|
|
6
|
+
import clickOutside from '../utils/clickOutside'
|
|
7
|
+
import { useLang } from '../utils'
|
|
8
|
+
|
|
9
|
+
export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel>
|
|
10
10
|
export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
(key: string) => string
|
|
13
|
-
|
|
13
|
+
>
|
|
14
14
|
|
|
15
15
|
export function useBagel() {
|
|
16
|
-
const bagel = inject(bagelInjectionKey)
|
|
17
|
-
if (!bagel) throw new Error('No bagel provided')
|
|
16
|
+
const bagel = inject(bagelInjectionKey)
|
|
17
|
+
if (!bagel) throw new Error('No bagel provided')
|
|
18
18
|
|
|
19
|
-
return bagel
|
|
19
|
+
return bagel
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function useI18nT() {
|
|
23
|
-
const i18nT = inject(i18nTInjectionKey)
|
|
24
|
-
if (!i18nT) throw new Error('No i18nT provided')
|
|
23
|
+
const i18nT = inject(i18nTInjectionKey)
|
|
24
|
+
if (!i18nT) throw new Error('No i18nT provided')
|
|
25
25
|
|
|
26
|
-
return i18nT
|
|
26
|
+
return i18nT
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export interface BagelOptions {
|
|
30
|
-
availableLangs?: string[]
|
|
31
|
-
defaultLang?: string
|
|
32
|
-
language?: string
|
|
33
|
-
host: string
|
|
34
|
-
|
|
35
|
-
onError?: (err: Error) => void
|
|
36
|
-
|
|
37
|
-
i18nT?: (key: string) => string
|
|
30
|
+
availableLangs?: string[]
|
|
31
|
+
defaultLang?: string
|
|
32
|
+
language?: string
|
|
33
|
+
host: string
|
|
34
|
+
|
|
35
|
+
onError?: (err: Error) => void
|
|
36
|
+
|
|
37
|
+
i18nT?: (key: string) => string
|
|
38
38
|
}
|
|
39
39
|
export const BagelVue: Plugin = {
|
|
40
40
|
install: (app, options: BagelOptions) => {
|
|
41
|
-
const bagel = new Bagel({ host: options.host, onError: options.onError })
|
|
42
|
-
app.directive('click-outside', clickOutside)
|
|
41
|
+
const bagel = new Bagel({ host: options.host, onError: options.onError })
|
|
42
|
+
app.directive('click-outside', clickOutside)
|
|
43
43
|
|
|
44
44
|
app.use(FloatingVue, {
|
|
45
45
|
themes: {
|
|
@@ -49,15 +49,15 @@ export const BagelVue: Plugin = {
|
|
|
49
49
|
placement: 'bottom',
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
|
-
})
|
|
53
|
-
const { availableLangs, defaultLang, lang } = useLang()
|
|
54
|
-
if (options.availableLangs) availableLangs.value = options.availableLangs
|
|
55
|
-
if (options.defaultLang) defaultLang.value = options.defaultLang
|
|
56
|
-
if (options.language) lang.value = options.language
|
|
57
|
-
app.config.globalProperties.$bagel = bagel
|
|
58
|
-
app.provide(bagelInjectionKey, bagel)
|
|
59
|
-
app.config.globalProperties.$i18T
|
|
60
|
-
options
|
|
61
|
-
app.provide(i18nTInjectionKey, options
|
|
52
|
+
})
|
|
53
|
+
const { availableLangs, defaultLang, lang } = useLang()
|
|
54
|
+
if (options.availableLangs) availableLangs.value = options.availableLangs
|
|
55
|
+
if (options.defaultLang) defaultLang.value = options.defaultLang
|
|
56
|
+
if (options.language) lang.value = options.language
|
|
57
|
+
app.config.globalProperties.$bagel = bagel
|
|
58
|
+
app.provide(bagelInjectionKey, bagel)
|
|
59
|
+
app.config.globalProperties.$i18T
|
|
60
|
+
= options.i18nT || ((key?: string) => key)
|
|
61
|
+
app.provide(i18nTInjectionKey, options.i18nT || ((key: string) => key))
|
|
62
62
|
},
|
|
63
|
-
}
|
|
63
|
+
}
|
package/src/plugins/modal.ts
CHANGED
|
@@ -1,87 +1,86 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from 'vue'
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
6
|
-
import { Modal, ModalForm, ModalConfirm } from '@bagelink/vue';
|
|
1
|
+
import { defineComponent, h, inject,
|
|
2
|
+
} from 'vue'
|
|
3
|
+
import type { InjectionKey, Plugin } from 'vue'
|
|
4
|
+
import type { BglFormSchemaT, BtnOptions } from '@bagelink/vue'
|
|
5
|
+
import { Modal, ModalConfirm, ModalForm } from '@bagelink/vue'
|
|
7
6
|
|
|
8
7
|
export interface ModalOptions {
|
|
9
|
-
title?: string
|
|
10
|
-
dismissable?: boolean
|
|
11
|
-
side?: boolean
|
|
12
|
-
width?: string
|
|
13
|
-
actions?: BtnOptions[]
|
|
14
|
-
class?: string
|
|
15
|
-
visible?: boolean
|
|
8
|
+
title?: string
|
|
9
|
+
dismissable?: boolean
|
|
10
|
+
side?: boolean
|
|
11
|
+
width?: string
|
|
12
|
+
actions?: BtnOptions[]
|
|
13
|
+
class?: string
|
|
14
|
+
visible?: boolean
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export interface ModalFormOptions {
|
|
19
|
-
side?: boolean
|
|
20
|
-
title?: string
|
|
21
|
-
visible?: boolean
|
|
22
|
-
width?: string
|
|
23
|
-
dismissable?: boolean
|
|
24
|
-
schema: BglFormSchemaT<any> | (() => BglFormSchemaT) | BglFormSchemaT
|
|
25
|
-
onSubmit?: (formData: any) => any
|
|
26
|
-
onDelete?: (id: string) => Promise<void
|
|
27
|
-
onError?: ((err: any) => void)
|
|
28
|
-
modelValue?: Record<string, any
|
|
29
|
-
'onUpdate:modelValue'?: (val: any) => void
|
|
18
|
+
'side'?: boolean
|
|
19
|
+
'title'?: string
|
|
20
|
+
'visible'?: boolean
|
|
21
|
+
'width'?: string
|
|
22
|
+
'dismissable'?: boolean
|
|
23
|
+
'schema': BglFormSchemaT<any> | (() => BglFormSchemaT) | BglFormSchemaT
|
|
24
|
+
'onSubmit'?: (formData: any) => any
|
|
25
|
+
'onDelete'?: (id: string) => Promise<void>
|
|
26
|
+
'onError'?: ((err: any) => void)
|
|
27
|
+
'modelValue'?: Record<string, any>
|
|
28
|
+
'onUpdate:modelValue'?: (val: any) => void
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export
|
|
33
|
-
title?: string
|
|
34
|
-
message?: string
|
|
35
|
-
resolve: (val: boolean) => void
|
|
36
|
-
}
|
|
31
|
+
export interface ModalConfirmOptions {
|
|
32
|
+
title?: string
|
|
33
|
+
message?: string
|
|
34
|
+
resolve: (val: boolean) => void
|
|
35
|
+
}
|
|
37
36
|
|
|
38
|
-
type ModalType = 'modal' | 'modalForm' | 'confirm'
|
|
37
|
+
type ModalType = 'modal' | 'modalForm' | 'confirm'
|
|
39
38
|
|
|
40
|
-
type ConfirmModalUserOptions = string | { title: string
|
|
39
|
+
type ConfirmModalUserOptions = string | { title: string, message: string }
|
|
41
40
|
|
|
42
41
|
export interface ModalComponentProps {
|
|
43
|
-
componentSlots: Record<string, any
|
|
44
|
-
modalType: ModalType
|
|
45
|
-
modalOptions: ModalOptions | ModalFormOptions | ModalConfirmOptions
|
|
42
|
+
componentSlots: Record<string, any>
|
|
43
|
+
modalType: ModalType
|
|
44
|
+
modalOptions: ModalOptions | ModalFormOptions | ModalConfirmOptions
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
export interface ModalFormComponentProps {
|
|
49
|
-
componentSlots: Record<string, any
|
|
50
|
-
modalType: 'modalForm'
|
|
51
|
-
modalOptions: ModalFormOptions
|
|
48
|
+
componentSlots: Record<string, any>
|
|
49
|
+
modalType: 'modalForm'
|
|
50
|
+
modalOptions: ModalFormOptions
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export interface ModalApi {
|
|
55
|
-
showModal: (options: ModalOptions, slots?: Record<string, any>) => void
|
|
56
|
-
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => ModalFormComponentProps | undefined
|
|
57
|
-
hideModal: (index?: number) => void
|
|
58
|
-
confirm: (options: ConfirmModalUserOptions) => Promise<boolean
|
|
54
|
+
showModal: (options: ModalOptions, slots?: Record<string, any>) => void
|
|
55
|
+
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => ModalFormComponentProps | undefined
|
|
56
|
+
hideModal: (index?: number) => void
|
|
57
|
+
confirm: (options: ConfirmModalUserOptions) => Promise<boolean>
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
export const ModalSymbol: InjectionKey<ModalApi> = Symbol('modal')
|
|
60
|
+
export const ModalSymbol: InjectionKey<ModalApi> = Symbol('modal')
|
|
62
61
|
|
|
63
|
-
export
|
|
64
|
-
const modalApi = inject(ModalSymbol)
|
|
65
|
-
if (!modalApi) throw new Error('Modal API not provided')
|
|
66
|
-
return modalApi
|
|
67
|
-
}
|
|
62
|
+
export function useModal(): ModalApi {
|
|
63
|
+
const modalApi = inject(ModalSymbol)
|
|
64
|
+
if (!modalApi) throw new Error('Modal API not provided')
|
|
65
|
+
return modalApi
|
|
66
|
+
}
|
|
68
67
|
|
|
69
68
|
export const ModalPlugin: Plugin = {
|
|
70
69
|
install: (app) => {
|
|
71
|
-
const modalStack = $ref<ModalComponentProps[]>([])
|
|
70
|
+
const modalStack = $ref<ModalComponentProps[]>([])
|
|
72
71
|
|
|
73
72
|
const hideModal = (index: number) => {
|
|
74
|
-
modalStack.splice(index, 1)
|
|
75
|
-
}
|
|
73
|
+
modalStack.splice(index, 1)
|
|
74
|
+
}
|
|
76
75
|
|
|
77
76
|
const modalConfirm = (options: ConfirmModalUserOptions) => new Promise<boolean>((resolve) => {
|
|
78
|
-
if (typeof options === 'string') options = { title: options, message: '' }
|
|
77
|
+
if (typeof options === 'string') options = { title: options, message: '' }
|
|
79
78
|
modalStack.push({
|
|
80
79
|
modalOptions: { ...options, resolve },
|
|
81
80
|
modalType: 'confirm',
|
|
82
81
|
componentSlots: {},
|
|
83
|
-
})
|
|
84
|
-
})
|
|
82
|
+
})
|
|
83
|
+
})
|
|
85
84
|
|
|
86
85
|
const showModal = (
|
|
87
86
|
modalType: ModalType,
|
|
@@ -92,29 +91,29 @@ export const ModalPlugin: Plugin = {
|
|
|
92
91
|
modalOptions: options,
|
|
93
92
|
modalType,
|
|
94
93
|
componentSlots: slots,
|
|
95
|
-
})
|
|
96
|
-
if (modalType === 'modalForm') return modalStack.at(-1) as ModalFormComponentProps | undefined
|
|
97
|
-
return modalStack.at(-1)
|
|
98
|
-
}
|
|
94
|
+
})
|
|
95
|
+
if (modalType === 'modalForm') return modalStack.at(-1) as ModalFormComponentProps | undefined
|
|
96
|
+
return modalStack.at(-1)
|
|
97
|
+
}
|
|
99
98
|
|
|
100
99
|
app.provide(ModalSymbol, {
|
|
101
100
|
showModal: (options: ModalOptions, slots?: Record<string, any>) => showModal('modal', options, slots),
|
|
102
101
|
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => showModal('modalForm', options, slots) as ModalFormComponentProps,
|
|
103
102
|
confirm: (userOptions: ConfirmModalUserOptions) => modalConfirm(userOptions),
|
|
104
|
-
hideModal: (index = modalStack.length - 1) => hideModal(index),
|
|
105
|
-
})
|
|
103
|
+
hideModal: (index = modalStack.length - 1) => { hideModal(index) },
|
|
104
|
+
})
|
|
106
105
|
|
|
107
106
|
const ModalComponent = defineComponent({
|
|
108
107
|
data: () => ({ modalStack }),
|
|
109
108
|
render() {
|
|
110
109
|
return this.modalStack.map((modal, index) => {
|
|
111
|
-
const props = { ...modal.modalOptions, visible: true, 'onUpdate:visible': () => hideModal(index) }
|
|
112
|
-
if (modal.modalType === 'modalForm') return h(ModalForm, props as ModalFormOptions, modal.componentSlots)
|
|
113
|
-
if (modal.modalType === 'confirm') return h(ModalConfirm, props as any, {})
|
|
114
|
-
return h(Modal, props, modal.componentSlots)
|
|
115
|
-
})
|
|
110
|
+
const props = { ...modal.modalOptions, 'visible': true, 'onUpdate:visible': () => { hideModal(index) } }
|
|
111
|
+
if (modal.modalType === 'modalForm') return h(ModalForm, props as ModalFormOptions, modal.componentSlots)
|
|
112
|
+
if (modal.modalType === 'confirm') return h(ModalConfirm, props as any, {})
|
|
113
|
+
return h(Modal, props, modal.componentSlots)
|
|
114
|
+
})
|
|
116
115
|
},
|
|
117
|
-
})
|
|
118
|
-
app.component('ModalContainer', ModalComponent)
|
|
116
|
+
})
|
|
117
|
+
app.component('ModalContainer', ModalComponent)
|
|
119
118
|
},
|
|
120
|
-
}
|
|
119
|
+
}
|
package/src/styles/layout.css
CHANGED
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.flex-center {
|
|
23
|
-
justify-
|
|
23
|
+
justify-content: center;
|
|
24
24
|
align-items: center;
|
|
25
|
-
display: flex;
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
26
27
|
|
|
27
28
|
.justify-items-center {
|
|
28
29
|
justify-items: center;
|
|
@@ -126,7 +127,8 @@
|
|
|
126
127
|
inset-inline-end: 0px;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
.positioned-full
|
|
130
|
+
.positioned-full,
|
|
131
|
+
.p-all {
|
|
130
132
|
top: 0;
|
|
131
133
|
bottom: 0;
|
|
132
134
|
inset-inline-start: 0;
|
package/src/types/BagelForm.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { SelectInput, TextInput } from '@bagelink/vue'
|
|
1
|
+
import type { SelectInput, TextInput } from '@bagelink/vue'
|
|
2
2
|
|
|
3
|
-
export type AttributeValue = string | number | boolean | null | undefined | Record<string, any
|
|
3
|
+
export type AttributeValue = string | number | boolean | null | undefined | Record<string, any>
|
|
4
4
|
|
|
5
|
-
export type AttributeFn<T = Record<string, any>> = (field: any, row: T) => AttributeValue
|
|
5
|
+
export type AttributeFn<T = Record<string, any>> = (field: any, row: T) => AttributeValue
|
|
6
6
|
|
|
7
7
|
export interface Attributes<T = any> {
|
|
8
|
-
|
|
8
|
+
[key: string]: AttributeValue | AttributeFn<T>
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
$el?: any
|
|
13
|
-
id?: string
|
|
14
|
-
label?: string
|
|
15
|
-
placeholder?: string
|
|
16
|
-
children?: Field<T>[]
|
|
17
|
-
class?: AttributeValue | AttributeFn<T
|
|
18
|
-
attrs?: Attributes<T
|
|
19
|
-
required?: boolean
|
|
20
|
-
disabled?: boolean
|
|
21
|
-
helptext?: string
|
|
22
|
-
options?: string | ({ label?: string
|
|
23
|
-
defaultValue?: any
|
|
24
|
-
transform?: (val?: any, rowData?: Record<string, any>) => any
|
|
25
|
-
onUpdate?: (val: any, rowData?: Record<string, any>) => void
|
|
26
|
-
'v-if'?: string | boolean | ((val: any, row: T) => boolean)
|
|
11
|
+
export interface BaseBagelField<T = Record<string, any>> {
|
|
12
|
+
'$el'?: any
|
|
13
|
+
'id'?: string
|
|
14
|
+
'label'?: string
|
|
15
|
+
'placeholder'?: string
|
|
16
|
+
'children'?: Field<T>[]
|
|
17
|
+
'class'?: AttributeValue | AttributeFn<T>
|
|
18
|
+
'attrs'?: Attributes<T>
|
|
19
|
+
'required'?: boolean
|
|
20
|
+
'disabled'?: boolean
|
|
21
|
+
'helptext'?: string
|
|
22
|
+
'options'?: string | ({ label?: string, value: string | number } | string | number | Record<string, any>)[] | ((val: any, rowData?: Record<string, any>) => void)
|
|
23
|
+
'defaultValue'?: any
|
|
24
|
+
'transform'?: (val?: any, rowData?: Record<string, any>) => any
|
|
25
|
+
'onUpdate'?: (val: any, rowData?: Record<string, any>) => void
|
|
26
|
+
'v-if'?: string | boolean | ((val: any, row: T) => boolean)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export interface InputBagelField<T> extends BaseBagelField<T> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
$el: 'text' | typeof TextInput
|
|
31
|
+
id: string
|
|
32
|
+
type?: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface SelectBagelField<T> extends BaseBagelField<T> {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
$el: 'select' | typeof SelectInput
|
|
37
|
+
id: string
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export type Field<T = Record<string, any>> = BaseBagelField<T> | InputBagelField<T> | SelectBagelField<T
|
|
40
|
+
export type Field<T = Record<string, any>> = BaseBagelField<T> | InputBagelField<T> | SelectBagelField<T>
|
|
41
41
|
|
|
42
|
-
export type BglFormSchemaT<T = Record<string, any>> = Field<T>[]
|
|
42
|
+
export type BglFormSchemaT<T = Record<string, any>> = Field<T>[]
|
package/src/types/BtnOptions.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MaterialIcons, ThemeType } from '.'
|
|
2
2
|
|
|
3
3
|
export interface BtnOptions {
|
|
4
|
-
onClick?: () => void
|
|
5
|
-
color?:ThemeType
|
|
6
|
-
theme?:ThemeType
|
|
7
|
-
disabled?: boolean
|
|
8
|
-
icon?: MaterialIcons
|
|
9
|
-
flat?: boolean
|
|
10
|
-
thin?: boolean
|
|
11
|
-
type?: 'button' | 'submit' | 'reset'
|
|
12
|
-
loading?: boolean
|
|
13
|
-
role?: string
|
|
14
|
-
value?: string
|
|
15
|
-
border?: boolean
|
|
4
|
+
onClick?: () => void
|
|
5
|
+
color?: ThemeType
|
|
6
|
+
theme?: ThemeType
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
icon?: MaterialIcons
|
|
9
|
+
flat?: boolean
|
|
10
|
+
thin?: boolean
|
|
11
|
+
type?: 'button' | 'submit' | 'reset'
|
|
12
|
+
loading?: boolean
|
|
13
|
+
role?: string
|
|
14
|
+
value?: string
|
|
15
|
+
border?: boolean
|
|
16
16
|
}
|
package/src/types/NavLink.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MaterialIcons } from './materialIcons'
|
|
1
|
+
import type { MaterialIcons } from './materialIcons'
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export interface NavLink {
|
|
4
|
+
label: string
|
|
5
|
+
to?: string
|
|
6
|
+
icon: MaterialIcons
|
|
7
|
+
localized?: string
|
|
8
|
+
children?: NavLink[]
|
|
9
|
+
onClick?: () => void
|
|
10
10
|
}
|
package/src/types/file.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
export interface StorageFile {
|
|
2
|
+
organization?: string[]
|
|
3
|
+
name: string
|
|
4
|
+
url: string
|
|
5
|
+
mimetype?: string
|
|
6
|
+
size?: number
|
|
7
|
+
extension?: string
|
|
8
|
+
path?: string
|
|
9
|
+
id?: string
|
|
10
|
+
created_at?: Date | string
|
|
11
|
+
updated_at?: Date | string
|
|
12
12
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
export type {
|
|
2
|
-
ModalFormComponentProps,
|
|
3
|
-
|
|
2
|
+
ModalFormComponentProps,
|
|
3
|
+
ModalApi,
|
|
4
|
+
ModalComponentProps,
|
|
5
|
+
ModalFormOptions,
|
|
6
|
+
ModalOptions,
|
|
7
|
+
} from '../plugins/modal'
|
|
4
8
|
|
|
5
|
-
import type { MaterialIcons } from './materialIcons'
|
|
9
|
+
import type { MaterialIcons } from './materialIcons'
|
|
6
10
|
|
|
7
|
-
export type { MaterialIcons }
|
|
8
|
-
export type { Tables, TableToTypeMapping } from '@bagelink/sdk'
|
|
9
|
-
export type { StorageFile } from './file'
|
|
10
|
-
export type { NavLink } from './NavLink'
|
|
11
|
+
export type { MaterialIcons }
|
|
12
|
+
export type { Tables, TableToTypeMapping } from '@bagelink/sdk'
|
|
13
|
+
export type { StorageFile } from './file'
|
|
14
|
+
export type { NavLink } from './NavLink'
|
|
11
15
|
|
|
12
|
-
export * from './BtnOptions'
|
|
13
|
-
export * from './BagelForm'
|
|
16
|
+
export * from './BtnOptions'
|
|
17
|
+
export * from './BagelForm'
|
|
14
18
|
|
|
15
19
|
export type Tab = {
|
|
16
|
-
label: string
|
|
17
|
-
id: string
|
|
18
|
-
icon?: MaterialIcons
|
|
20
|
+
label: string
|
|
21
|
+
id: string
|
|
22
|
+
icon?: MaterialIcons
|
|
19
23
|
} | string
|
|
20
24
|
|
|
21
25
|
export type ThemeType = |
|