@v1nt1248/3nclient-lib 0.2.86 → 0.2.87
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/index.d.ts +1 -1
- package/dist/components/ui3n-notification/ui3n-notification.vue.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/plugins/dialogs/dialogs.d.ts +4 -4
- package/dist/plugins/dialogs/store-dialog.d.ts +2 -2
- package/dist/plugins/dialogs/types.d.ts +3 -3
- package/dist/ui3n-components.d.ts +1 -1
- package/dist/ui3n-components.js +1612 -1599
- package/dist/ui3n-plugins.d.ts +4 -4
- package/package.json +1 -1
- package/src/components/index.ts +1 -1
- package/src/components/ui3n-dialog/ui3n-dialog-provider.vue +52 -0
- package/src/components/ui3n-dialog/ui3n-dialog.vue +1 -1
- /package/dist/{plugins/dialogs → components/ui3n-dialog}/ui3n-dialog-provider.vue.d.ts +0 -0
package/dist/ui3n-plugins.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ declare module '../vue/dist/vue.esm-bundler.js' {
|
|
|
8
8
|
interface ComponentCustomProperties {
|
|
9
9
|
$openDialog: <V>(component: Component, props: ExtractComponentProps<Component>) => Promise<{
|
|
10
10
|
event: Ui3nDialogEvent;
|
|
11
|
-
data?: V
|
|
11
|
+
data?: V;
|
|
12
12
|
}>;
|
|
13
13
|
$closeDialog: <V>(id: string, value: {
|
|
14
14
|
event: Ui3nDialogEvent;
|
|
15
|
-
data?: V
|
|
15
|
+
data?: V;
|
|
16
16
|
}) => void;
|
|
17
17
|
$closeDialogs: () => void;
|
|
18
18
|
dialogStack: Reactive<DialogOptions<any>[]>;
|
|
@@ -35,11 +35,11 @@ declare module 'pinia' {
|
|
|
35
35
|
$dialogs: {
|
|
36
36
|
open: <V>(component: Component, props: ExtractComponentProps<Component>) => Promise<{
|
|
37
37
|
event: Ui3nDialogEvent;
|
|
38
|
-
data?: V
|
|
38
|
+
data?: V;
|
|
39
39
|
}>;
|
|
40
40
|
close: <V>(id: string, value: {
|
|
41
41
|
event: Ui3nDialogEvent;
|
|
42
|
-
data?: V
|
|
42
|
+
data?: V;
|
|
43
43
|
}) => void;
|
|
44
44
|
closeAll: () => void;
|
|
45
45
|
dialogStack: Reactive<DialogOptions<any>[]>;
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -42,7 +42,7 @@ import type {
|
|
|
42
42
|
Ui3nTableEmits,
|
|
43
43
|
Ui3nTableExpose,
|
|
44
44
|
} from './ui3n-table/types';
|
|
45
|
-
import Ui3nDialogProvider from '
|
|
45
|
+
import Ui3nDialogProvider from './ui3n-dialog/ui3n-dialog-provider.vue';
|
|
46
46
|
import Ui3nDialog from './ui3n-dialog/ui3n-dialog.vue';
|
|
47
47
|
import type {
|
|
48
48
|
Ui3nDialogComponentProps,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts" setup generic="V extends any">
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import { type Component, inject } from 'vue';
|
|
4
|
+
import { DIALOGS_KEY, type DialogsPlugin } from '@/plugins';
|
|
5
|
+
import type { ExtractComponentProps } from '@/types';
|
|
6
|
+
import type { Ui3nDialogComponentProps, Ui3nDialogEvent } from './types';
|
|
7
|
+
|
|
8
|
+
const { dialogStack, $closeDialog } = inject<DialogsPlugin>(DIALOGS_KEY)!
|
|
9
|
+
|
|
10
|
+
function clickOverlay(id: string, modalProps: ExtractComponentProps<Component>) {
|
|
11
|
+
if (
|
|
12
|
+
(modalProps as Ui3nDialogComponentProps<any>).closeOnClickOverlay ||
|
|
13
|
+
((modalProps as any).dialogProps as Ui3nDialogComponentProps<any>)?.closeOnClickOverlay
|
|
14
|
+
) {
|
|
15
|
+
$closeDialog(id, { event: 'click-overlay' });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function onAction(id: string, value: { event: Ui3nDialogEvent; data?: V }) {
|
|
20
|
+
$closeDialog(id, value);
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<teleport to="body">
|
|
26
|
+
<div
|
|
27
|
+
v-for="dialog in dialogStack"
|
|
28
|
+
:id="`dialog-wrapper-${dialog.id}`"
|
|
29
|
+
:key="dialog.id"
|
|
30
|
+
:class="$style['dialog-provider-overlay']"
|
|
31
|
+
@click.self.prevent="clickOverlay(dialog.id, dialog.props)"
|
|
32
|
+
>
|
|
33
|
+
<component
|
|
34
|
+
:is="dialog.component"
|
|
35
|
+
v-bind="dialog.props"
|
|
36
|
+
@action="onAction(dialog.id, $event)"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</teleport>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style lang="scss" module>
|
|
43
|
+
.dialog-provider-overlay {
|
|
44
|
+
position: fixed;
|
|
45
|
+
z-index: 1000;
|
|
46
|
+
inset: 0;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
background-color: var(--shadow-close);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup generic="V extends any">
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, nextTick, onMounted, ref, useTemplateRef } from 'vue';
|
|
3
3
|
import omit from 'lodash/omit';
|
|
4
4
|
import { determineWindowWidth } from './util';
|
|
5
5
|
import type { Ui3nDialogComponentProps, Ui3nDialogComponentEmits, Ui3nDialogComponentSlots } from './types';
|
|
File without changes
|