@autoafleveren/ui 1.4.15 → 1.5.1
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/types/components/AppDrawer/AppDrawer.vue.d.ts +1 -1
- package/dist/types/composables/useDrawer/index.d.ts +2 -0
- package/dist/ui.cjs +34 -34
- package/dist/ui.js +2316 -2310
- package/package.json +1 -1
- package/src/modules/components/AppActionBar/index.ts +1 -1
- package/src/modules/components/AppContextMenu/AppContextMenu.vue +5 -1
- package/src/modules/components/AppDrawer/AppDrawer.vue +2 -2
- package/src/modules/components/AppDrawer/index.d.ts +4 -0
- package/src/modules/composables/useDrawer/index.ts +9 -6
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ export const domClassesPerType: Record<Type, string[]> = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const domClassesPerMenu: Record<'contextMenu' | 'actionBar', string[]> = {
|
|
11
|
-
contextMenu: ['focus:bg-zinc-600', 'px-2', 'py-1'],
|
|
11
|
+
contextMenu: ['hover:bg-zinc-600', 'focus:bg-zinc-600', 'px-2', 'py-1'],
|
|
12
12
|
actionBar: ['hover:bg-black-100/20'],
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -67,6 +67,10 @@
|
|
|
67
67
|
openIndex.value = index;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
function focus(event: MouseEvent): void {
|
|
71
|
+
(event.target as HTMLDivElement | undefined)?.focus();
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
defineExpose({ isOpen, open, close, submit });
|
|
71
75
|
onClickOutside(contextMenuElement, close);
|
|
72
76
|
onEscape(close);
|
|
@@ -107,7 +111,7 @@
|
|
|
107
111
|
@confirm="deactivate"
|
|
108
112
|
@confirmed="activate"
|
|
109
113
|
@close="close"
|
|
110
|
-
@
|
|
114
|
+
@mouseenter="focus"
|
|
111
115
|
@open="() => onItemOpen(index)"
|
|
112
116
|
>
|
|
113
117
|
<span class="text-base">{{ action.name }}</span>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { DrawerProps } from './index.d';
|
|
7
7
|
|
|
8
|
-
withDefaults(defineProps<Omit<DrawerProps, 'router' | 'unique' | 'onOpen' | 'onClose' | 'plugins'>>(), {
|
|
8
|
+
withDefaults(defineProps<Omit<DrawerProps, 'router' | 'unique' | 'onOpen' | 'onClose' | 'plugins' | 'forceCreate'>>(), {
|
|
9
9
|
withBackdrop: true,
|
|
10
10
|
withFooter: true,
|
|
11
11
|
preventBackdropClose: false,
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
<span class="sr-only">Close panel</span>
|
|
111
111
|
|
|
112
112
|
<FontAwesomeIcon
|
|
113
|
-
:icon="byPrefixAndName.far?.['chevron-right']"
|
|
113
|
+
:icon="closeIcon ?? byPrefixAndName.far?.['chevron-right']"
|
|
114
114
|
class="size-6"
|
|
115
115
|
aria-hidden="true"
|
|
116
116
|
/>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Component, Plugin } from 'vue';
|
|
2
2
|
import type { RouteRecordRaw } from 'vue-router';
|
|
3
|
+
import type { FontAwesomeIconProps } from '@fortawesome/vue-fontawesome';
|
|
3
4
|
import type { AppDrawer } from '~components';
|
|
4
5
|
|
|
5
6
|
export type OnClose = () => unknown;
|
|
@@ -18,10 +19,13 @@ export interface DrawerProps {
|
|
|
18
19
|
onClose?: OnClose;
|
|
19
20
|
onOpen?: OnOpen;
|
|
20
21
|
router?: RouteRecordRaw;
|
|
22
|
+
forceCreate?: boolean;
|
|
23
|
+
closeIcon?: FontAwesomeIconProps['icon'];
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export interface ModalInstance {
|
|
24
27
|
ref: AppDrawer;
|
|
25
28
|
instance: App;
|
|
26
29
|
element: HTMLDivElement;
|
|
30
|
+
withRouter: boolean;
|
|
27
31
|
}
|
|
@@ -9,7 +9,7 @@ const state = {
|
|
|
9
9
|
instances: ref<ModalInstance[]>([]),
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
function closeDrawer(modalInstance: ModalInstance): void {
|
|
12
|
+
function closeDrawer(modalInstance: Omit<ModalInstance, 'withRouter'>): void {
|
|
13
13
|
modalInstance?.instance?.unmount();
|
|
14
14
|
modalInstance?.element?.remove();
|
|
15
15
|
|
|
@@ -23,7 +23,7 @@ function closeDrawer(modalInstance: ModalInstance): void {
|
|
|
23
23
|
export function useDrawer(component?: MaybeRef<Component | string>, options?: DrawerProps) {
|
|
24
24
|
const instance = ref<ModalInstance>();
|
|
25
25
|
|
|
26
|
-
function mountDrawer(modalInstance: ModalInstance['instance'], modalRootElement: ModalInstance['element']): void {
|
|
26
|
+
function mountDrawer(modalInstance: ModalInstance['instance'], modalRootElement: ModalInstance['element'], withRouter = false): void {
|
|
27
27
|
const modalRef = modalInstance.mount(modalRootElement) as unknown as typeof AppDrawer;
|
|
28
28
|
|
|
29
29
|
modalRef.open();
|
|
@@ -32,6 +32,7 @@ export function useDrawer(component?: MaybeRef<Component | string>, options?: Dr
|
|
|
32
32
|
ref: modalRef,
|
|
33
33
|
instance: modalInstance,
|
|
34
34
|
element: modalRootElement,
|
|
35
|
+
withRouter,
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
state.instances.value.push(instance.value);
|
|
@@ -55,8 +56,10 @@ export function useDrawer(component?: MaybeRef<Component | string>, options?: Dr
|
|
|
55
56
|
let modalRef = null as null | typeof AppDrawer;
|
|
56
57
|
|
|
57
58
|
return new Promise(resolve => {
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const instancesWithRouter = state.instances.value.filter(stateInstance => stateInstance.withRouter);
|
|
60
|
+
|
|
61
|
+
if (openOptions.forceCreate !== true && instancesWithRouter.length > 0 && openOptions.router) {
|
|
62
|
+
instancesWithRouter[instancesWithRouter.length - 1]?.instance?.config?.globalProperties?.$router?.push?.(openOptions.router);
|
|
60
63
|
|
|
61
64
|
return;
|
|
62
65
|
}
|
|
@@ -85,7 +88,7 @@ export function useDrawer(component?: MaybeRef<Component | string>, options?: Dr
|
|
|
85
88
|
});
|
|
86
89
|
|
|
87
90
|
if (!hasReadyListener) {
|
|
88
|
-
mountDrawer(modalInstance, modalRootElement);
|
|
91
|
+
mountDrawer(modalInstance, modalRootElement, !!openOptions.router);
|
|
89
92
|
|
|
90
93
|
if (openOptions.router) {
|
|
91
94
|
modalInstance?.config?.globalProperties?.$router?.push?.(openOptions.router);
|
|
@@ -95,7 +98,7 @@ export function useDrawer(component?: MaybeRef<Component | string>, options?: Dr
|
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
hasReadyListener?.isReady()?.then?.(() => {
|
|
98
|
-
mountDrawer(modalInstance, modalRootElement);
|
|
101
|
+
mountDrawer(modalInstance, modalRootElement, !!openOptions.router);
|
|
99
102
|
|
|
100
103
|
if (openOptions.router) {
|
|
101
104
|
modalInstance?.config?.globalProperties?.$router?.push?.(openOptions.router);
|