@bagelink/vue 1.9.90 → 1.9.94
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/Dropdown.vue.d.ts.map +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.mjs +3629 -3588
- package/dist/plugins/useToast.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Dropdown.vue +8 -2
- package/src/plugins/useToast.ts +25 -8
- package/src/styles/toast-overrides.css +0 -6
- package/src/utils/index.ts +13 -2
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ import { Attributes, BglFormSchemaT, Path } from '../types/BagelForm';
|
|
|
4
4
|
* Popovers rendered inside it will appear above showModal() dialogs.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getTopLayerContainer(): HTMLElement | string;
|
|
7
|
+
/**
|
|
8
|
+
* Re-stacks the top-layer container above any currently open dialogs.
|
|
9
|
+
* Call this just before showing a popper/dropdown.
|
|
10
|
+
*/
|
|
11
|
+
export declare function restackTopLayerContainer(): void;
|
|
7
12
|
export declare function debounce(fn: () => void, wait?: number): void;
|
|
8
13
|
export declare function slugify(str: string): string;
|
|
9
14
|
export declare function keyToLabel(key?: string): string | undefined;
|
|
@@ -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;AAE1E;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,GAAG,MAAM,
|
|
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,oBA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G,SAAS,CAQzF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,QA6BpE;AAED,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { IconType, ThemeType } from '@bagelink/vue'
|
|
3
3
|
import type { TriggerEvent } from 'floating-vue'
|
|
4
4
|
import type { ComponentExposed } from 'vue-component-type-helpers'
|
|
5
|
-
import { Btn, useDevice, getTopLayerContainer } from '@bagelink/vue'
|
|
5
|
+
import { Btn, useDevice, getTopLayerContainer, restackTopLayerContainer } from '@bagelink/vue'
|
|
6
6
|
import { Dropdown as DDown } from 'floating-vue'
|
|
7
7
|
import { computed, ref } from 'vue'
|
|
8
8
|
|
|
@@ -193,6 +193,12 @@ const computedAutoHide = computed(() => autoHide)
|
|
|
193
193
|
|
|
194
194
|
const container = computed(() => getTopLayerContainer())
|
|
195
195
|
|
|
196
|
+
function onShow() {
|
|
197
|
+
// Re-stack the container above any dialog that opened after it
|
|
198
|
+
restackTopLayerContainer()
|
|
199
|
+
emit('show')
|
|
200
|
+
}
|
|
201
|
+
|
|
196
202
|
const computedDelay = computed((): number | { show: number, hide: number } | undefined => {
|
|
197
203
|
if (delay !== undefined) { return delay }
|
|
198
204
|
// For hover dropdowns, add a hide delay (but only on large screens)
|
|
@@ -213,7 +219,7 @@ defineExpose({ show, hide, shown })
|
|
|
213
219
|
:showTriggers="computedShowTriggers" :hideTriggers="computedHideTriggers"
|
|
214
220
|
:popperTriggers="computedPopperTriggers" :popperShowTriggers="computedPopperShowTriggers"
|
|
215
221
|
:popperHideTriggers="computedPopperHideTriggers" :showGroup="showGroup" :container="container"
|
|
216
|
-
@hide="emit('hide')" @show="
|
|
222
|
+
@hide="emit('hide')" @show="onShow"
|
|
217
223
|
>
|
|
218
224
|
<div ref="triggerRef" />
|
|
219
225
|
<slot name="trigger" :show :hide :shown>
|
package/src/plugins/useToast.ts
CHANGED
|
@@ -38,20 +38,24 @@ export function useToast(): ToastApi {
|
|
|
38
38
|
|
|
39
39
|
export type BagelToastOptions = Partial<ToastOptions>
|
|
40
40
|
|
|
41
|
-
function
|
|
41
|
+
function getToastContainer(): HTMLElement | undefined {
|
|
42
42
|
if (typeof document === 'undefined') return undefined
|
|
43
|
-
|
|
44
|
-
el
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
let el = document.getElementById('bgl-toast-container')
|
|
44
|
+
if (!el) {
|
|
45
|
+
el = document.createElement('div')
|
|
46
|
+
el.setAttribute('popover', 'manual')
|
|
47
|
+
el.setAttribute('id', 'bgl-toast-container')
|
|
48
|
+
document.body.appendChild(el)
|
|
49
|
+
}
|
|
50
|
+
// Re-stack on top of any open dialogs
|
|
51
|
+
try { (el as any).hidePopover() } catch {}
|
|
52
|
+
try { (el as any).showPopover() } catch {}
|
|
49
53
|
return el
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
export const ToastPlugin: Plugin<BagelToastOptions[]> = {
|
|
53
57
|
install: (app: App, options: BagelToastOptions = {}) => {
|
|
54
|
-
const container =
|
|
58
|
+
const container = getToastContainer()
|
|
55
59
|
|
|
56
60
|
const defaultOptions: ToastOptions = {
|
|
57
61
|
position: POSITION.TOP_RIGHT,
|
|
@@ -78,9 +82,18 @@ export const ToastPlugin: Plugin<BagelToastOptions[]> = {
|
|
|
78
82
|
// Install vue-toastification
|
|
79
83
|
app.use(Toast, defaultOptions)
|
|
80
84
|
|
|
85
|
+
function restackToastContainer() {
|
|
86
|
+
const el = typeof document !== 'undefined' ? document.getElementById('bgl-toast-container') : null
|
|
87
|
+
if (el) {
|
|
88
|
+
try { (el as any).hidePopover() } catch {}
|
|
89
|
+
try { (el as any).showPopover() } catch {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
// Create the API wrapper using lazy evaluation
|
|
82
94
|
const api: ToastApi = {
|
|
83
95
|
success: (message: string, opts?: any) => {
|
|
96
|
+
restackToastContainer()
|
|
84
97
|
const toast = useVueToast()
|
|
85
98
|
return toast({
|
|
86
99
|
component: CustomToast,
|
|
@@ -91,6 +104,7 @@ export const ToastPlugin: Plugin<BagelToastOptions[]> = {
|
|
|
91
104
|
}, opts)
|
|
92
105
|
},
|
|
93
106
|
error: (message: string, opts?: any) => {
|
|
107
|
+
restackToastContainer()
|
|
94
108
|
const toast = useVueToast()
|
|
95
109
|
return toast({
|
|
96
110
|
component: CustomToast,
|
|
@@ -101,6 +115,7 @@ export const ToastPlugin: Plugin<BagelToastOptions[]> = {
|
|
|
101
115
|
}, opts)
|
|
102
116
|
},
|
|
103
117
|
info: (message: string, opts?: any) => {
|
|
118
|
+
restackToastContainer()
|
|
104
119
|
const toast = useVueToast()
|
|
105
120
|
return toast({
|
|
106
121
|
component: CustomToast,
|
|
@@ -111,6 +126,7 @@ export const ToastPlugin: Plugin<BagelToastOptions[]> = {
|
|
|
111
126
|
}, opts)
|
|
112
127
|
},
|
|
113
128
|
warning: (message: string, opts?: any) => {
|
|
129
|
+
restackToastContainer()
|
|
114
130
|
const toast = useVueToast()
|
|
115
131
|
return toast({
|
|
116
132
|
component: CustomToast,
|
|
@@ -121,6 +137,7 @@ export const ToastPlugin: Plugin<BagelToastOptions[]> = {
|
|
|
121
137
|
}, opts)
|
|
122
138
|
},
|
|
123
139
|
show: (message: string, opts?: any) => {
|
|
140
|
+
restackToastContainer()
|
|
124
141
|
const toast = useVueToast()
|
|
125
142
|
return toast({
|
|
126
143
|
component: CustomToast,
|
|
@@ -6,15 +6,9 @@
|
|
|
6
6
|
inset: 0;
|
|
7
7
|
width: 100%;
|
|
8
8
|
height: 100%;
|
|
9
|
-
pointer-events: none;
|
|
10
9
|
overflow: visible;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
#bgl-toast-container > *,
|
|
14
|
-
#bgl-toplayer-container > * {
|
|
15
|
-
pointer-events: auto;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
12
|
/* Override vue-toastification default styles */
|
|
19
13
|
.custom-toast-wrapper {
|
|
20
14
|
padding: 0 !important;
|
package/src/utils/index.ts
CHANGED
|
@@ -11,12 +11,23 @@ export function getTopLayerContainer(): HTMLElement | string {
|
|
|
11
11
|
el = document.createElement('div')
|
|
12
12
|
el.id = 'bgl-toplayer-container'
|
|
13
13
|
el.setAttribute('popover', 'manual')
|
|
14
|
-
document.body.appendChild(el)
|
|
15
|
-
(el as any).showPopover?.()
|
|
14
|
+
document.body.appendChild(el)
|
|
16
15
|
}
|
|
17
16
|
return el
|
|
18
17
|
}
|
|
19
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Re-stacks the top-layer container above any currently open dialogs.
|
|
21
|
+
* Call this just before showing a popper/dropdown.
|
|
22
|
+
*/
|
|
23
|
+
export function restackTopLayerContainer(): void {
|
|
24
|
+
if (typeof document === 'undefined') return
|
|
25
|
+
const el = document.getElementById('bgl-toplayer-container')
|
|
26
|
+
if (!el) return
|
|
27
|
+
try { (el as any).hidePopover() } catch {}
|
|
28
|
+
try { (el as any).showPopover() } catch {}
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
const debouncers = new Map<() => void, ReturnType<typeof setTimeout>>()
|
|
21
32
|
|
|
22
33
|
export function debounce(fn: () => void, wait: number = 500) {
|