@v1nt1248/3nclient-lib 0.3.5 → 0.3.7
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/ui3n-dialog/types.d.ts +4 -3
- package/dist/components/ui3n-dialog/ui3n-dialog-provider.vue.d.ts +1 -1
- package/dist/components/ui3n-dialog/ui3n-dialog.vue.d.ts +3 -3
- package/dist/plugins/dialogs/dialogs.d.ts +4 -4
- package/dist/plugins/dialogs/store-dialog.d.ts +4 -4
- package/dist/plugins/dialogs/types.d.ts +7 -7
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ui3n-dialog/types.ts +5 -3
- package/src/components/ui3n-dialog/ui3n-dialog-provider.vue +3 -3
- package/src/components/ui3n-dialog/ui3n-dialog.vue +26 -37
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { VNode } from 'vue';
|
|
2
2
|
import type { Ui3nIconField } from '@/types';
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type Ui3nDialogEventBase = 'close' | 'confirm' | 'cancel' | 'click-overlay';
|
|
5
|
+
|
|
6
|
+
export type Ui3nDialogEvent<E extends string = never> = Ui3nDialogEventBase | E;
|
|
5
7
|
|
|
6
8
|
export interface Ui3nDialogComponentProps<V> {
|
|
7
9
|
id?: string;
|
|
@@ -28,8 +30,8 @@ export interface Ui3nDialogComponentProps<V> {
|
|
|
28
30
|
isValid?: boolean;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
export interface Ui3nDialogComponentEmits<V> {
|
|
32
|
-
(event: 'action', value: { event: Ui3nDialogEvent
|
|
33
|
+
export interface Ui3nDialogComponentEmits<V, E extends string = never> {
|
|
34
|
+
(event: 'action', value: { event: Ui3nDialogEvent<E>; data?: V }): void;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export interface Ui3nDialogComponentSlots {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts" setup generic="V extends any">
|
|
1
|
+
<script lang="ts" setup generic="V extends any, E extends string = never">
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
import { type Component, inject } from 'vue';
|
|
4
4
|
import type { DialogsPlugin } from '@/plugins';
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
if (
|
|
13
13
|
(modalProps as Ui3nDialogComponentProps<any>).closeOnClickOverlay ||
|
|
14
14
|
((modalProps as any).dialogProps as Ui3nDialogComponentProps<any>)?.closeOnClickOverlay
|
|
15
|
-
|
|
15
|
+
) {
|
|
16
16
|
dialogs.$closeDialog(id, { event: 'click-overlay' });
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function onAction(id: string, value: { event: Ui3nDialogEvent
|
|
20
|
+
function onAction(id: string, value: { event: Ui3nDialogEvent<E>; data?: V }) {
|
|
21
21
|
dialogs.$closeDialog(id, value);
|
|
22
22
|
}
|
|
23
23
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts" setup generic="V extends any">
|
|
1
|
+
<script lang="ts" setup generic="V extends any, E extends string = never">
|
|
2
2
|
import { computed, nextTick, onMounted, ref, useTemplateRef } from 'vue';
|
|
3
3
|
import omit from 'lodash/omit';
|
|
4
4
|
import { determineWindowWidth } from './util';
|
|
@@ -6,24 +6,22 @@
|
|
|
6
6
|
import Ui3nButton from '../ui3n-button/ui3n-button.vue';
|
|
7
7
|
import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
|
|
8
8
|
|
|
9
|
-
const props = withDefaults(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
26
|
-
const emits = defineEmits<Ui3nDialogComponentEmits<V>>();
|
|
9
|
+
const props = withDefaults(defineProps<Ui3nDialogComponentProps<V>>(), {
|
|
10
|
+
cssClass: () => [],
|
|
11
|
+
cssStyle: () => ({}),
|
|
12
|
+
contentCssClass: () => [],
|
|
13
|
+
contentCssStyle: () => ({}),
|
|
14
|
+
confirmButton: true,
|
|
15
|
+
cancelButton: true,
|
|
16
|
+
confirmButtonText: 'Done',
|
|
17
|
+
cancelButtonText: 'Cancel',
|
|
18
|
+
confirmButtonColor: 'var(--color-text-button-primary-default)',
|
|
19
|
+
cancelButtonColor: 'var(--color-text-button-secondary-default)',
|
|
20
|
+
confirmButtonBackground: 'var(--color-bg-button-primary-default)',
|
|
21
|
+
cancelButtonBackground: 'var(--color-bg-button-secondary-default)',
|
|
22
|
+
isValid: true,
|
|
23
|
+
});
|
|
24
|
+
const emits = defineEmits<Ui3nDialogComponentEmits<V, E>>();
|
|
27
25
|
defineSlots<Ui3nDialogComponentSlots>();
|
|
28
26
|
|
|
29
27
|
const dialogElement = useTemplateRef('dialog-el');
|
|
@@ -105,22 +103,13 @@
|
|
|
105
103
|
|
|
106
104
|
onMounted(() => {
|
|
107
105
|
if (dialogElement.value) {
|
|
108
|
-
dialogElement.value.style.setProperty(
|
|
109
|
-
|
|
110
|
-
props.confirmButtonColor,
|
|
111
|
-
);
|
|
112
|
-
dialogElement.value.style.setProperty(
|
|
113
|
-
'--ui3n-dialog-cancel-button-color',
|
|
114
|
-
props.cancelButtonColor,
|
|
115
|
-
);
|
|
106
|
+
dialogElement.value.style.setProperty('--ui3n-dialog-confirm-button-color', props.confirmButtonColor);
|
|
107
|
+
dialogElement.value.style.setProperty('--ui3n-dialog-cancel-button-color', props.cancelButtonColor);
|
|
116
108
|
dialogElement.value.style.setProperty(
|
|
117
109
|
'--ui3n-dialog-confirm-background-color',
|
|
118
110
|
props.confirmButtonBackground,
|
|
119
111
|
);
|
|
120
|
-
dialogElement.value.style.setProperty(
|
|
121
|
-
'--ui3n-dialog-cancel-background-color',
|
|
122
|
-
props.cancelButtonBackground,
|
|
123
|
-
);
|
|
112
|
+
dialogElement.value.style.setProperty('--ui3n-dialog-cancel-background-color', props.cancelButtonBackground);
|
|
124
113
|
|
|
125
114
|
nextTick(() => {
|
|
126
115
|
dialogElement.value!.focus();
|
|
@@ -145,12 +134,12 @@
|
|
|
145
134
|
v-on="
|
|
146
135
|
draggable
|
|
147
136
|
? {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
dragstart: onDragstart,
|
|
138
|
+
mousedown: onMousedown,
|
|
139
|
+
mouseup: onMouseup,
|
|
140
|
+
mousemove: onMousemove,
|
|
141
|
+
keydown: onKeydown,
|
|
142
|
+
}
|
|
154
143
|
: { keydown: onKeydown }
|
|
155
144
|
"
|
|
156
145
|
>
|