nuxt-unified-ui 0.2.1 → 0.2.3
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.
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
<script setup>
|
|
1
|
+
<script setup lang="ts">
|
|
2
2
|
|
|
3
3
|
/* interface */
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import type { ButtonProps } from '@nuxt/ui';
|
|
6
6
|
|
|
7
|
-
icon: String,
|
|
8
|
-
title: String,
|
|
9
|
-
subtitle: String,
|
|
10
|
-
text: String,
|
|
11
|
-
iconClasses: String,
|
|
12
|
-
titleClasses: String,
|
|
13
|
-
subtitleClasses: String,
|
|
14
|
-
textClasses: String,
|
|
15
7
|
|
|
16
|
-
|
|
8
|
+
const props = defineProps<{
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
icon?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
iconClasses?: string;
|
|
15
|
+
titleClasses?: string;
|
|
16
|
+
subtitleClasses?: string;
|
|
17
|
+
textClasses?: string;
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
fluidBody?: boolean;
|
|
20
|
+
|
|
21
|
+
actions?: ( ButtonProps & { actionType?: 'button' | 'spacer' } )[];
|
|
22
|
+
verticalActions?: boolean;
|
|
23
|
+
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const slots = useSlots();
|
|
22
28
|
|
|
23
29
|
</script>
|
|
24
30
|
|
|
@@ -34,13 +40,13 @@ const props = defineProps({
|
|
|
34
40
|
:title-classes="props.titleClasses"
|
|
35
41
|
:subtitle-classes="props.subtitleClasses"
|
|
36
42
|
class="p-3">
|
|
37
|
-
<template v-if="
|
|
43
|
+
<template v-if="slots.append" #append>
|
|
38
44
|
<slot name="append" />
|
|
39
45
|
</template>
|
|
40
46
|
</un-typography>
|
|
41
47
|
|
|
42
48
|
<div
|
|
43
|
-
v-if="
|
|
49
|
+
v-if="slots.default || props.text"
|
|
44
50
|
:class="{
|
|
45
51
|
'p-3': !props.fluidBody,
|
|
46
52
|
}">
|
|
@@ -49,7 +55,7 @@ const props = defineProps({
|
|
|
49
55
|
v-if="props.text"
|
|
50
56
|
:class="[
|
|
51
57
|
{
|
|
52
|
-
'mb-3':
|
|
58
|
+
'mb-3': !!slots.default,
|
|
53
59
|
},
|
|
54
60
|
props.textClasses,
|
|
55
61
|
]">
|
|
@@ -44,13 +44,8 @@ const emit = defineEmits([
|
|
|
44
44
|
/* actions */
|
|
45
45
|
|
|
46
46
|
async function handleButtonClick(button) {
|
|
47
|
-
|
|
48
|
-
if (button.onClick) {
|
|
49
|
-
await button.onClick(button.value);
|
|
50
|
-
}
|
|
51
|
-
|
|
47
|
+
await button.onClick?.(button.value);
|
|
52
48
|
emit('close', button.value);
|
|
53
|
-
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
</script>
|
|
@@ -59,36 +54,25 @@ async function handleButtonClick(button) {
|
|
|
59
54
|
<template>
|
|
60
55
|
<u-modal @update:open="!$event && emit('close')">
|
|
61
56
|
<template #content>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<u-button
|
|
83
|
-
v-for="button of props.endButtons" :key="button.value || button.label || button.icon"
|
|
84
|
-
v-bind="radOmit(button, [ 'value', 'onClick' ])"
|
|
85
|
-
loading-auto
|
|
86
|
-
@click="handleButtonClick(button)"
|
|
87
|
-
/>
|
|
88
|
-
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
</u-card>
|
|
57
|
+
<un-card
|
|
58
|
+
:icon="props.icon"
|
|
59
|
+
:title="props.title"
|
|
60
|
+
:subtitle="props.subtitle"
|
|
61
|
+
:text="props.text"
|
|
62
|
+
:actions="[
|
|
63
|
+
...(props.startButtons || []).map(button => ({
|
|
64
|
+
...button,
|
|
65
|
+
onClick: () => handleButtonClick(button),
|
|
66
|
+
})),
|
|
67
|
+
{
|
|
68
|
+
actionType: 'spacer',
|
|
69
|
+
},
|
|
70
|
+
...(props.endButtons || []).map(button => ({
|
|
71
|
+
...button,
|
|
72
|
+
onClick: () => handleButtonClick(button),
|
|
73
|
+
})),
|
|
74
|
+
]"
|
|
75
|
+
/>
|
|
92
76
|
</template>
|
|
93
77
|
</u-modal>
|
|
94
78
|
</template>
|
|
@@ -46,13 +46,8 @@ const { form, formTag } = useForm({
|
|
|
46
46
|
/* actions */
|
|
47
47
|
|
|
48
48
|
async function handleSubmit() {
|
|
49
|
-
|
|
50
|
-
if (props.submitButton?.onClick) {
|
|
51
|
-
await props.submitButton?.onClick(form.value);
|
|
52
|
-
}
|
|
53
|
-
|
|
49
|
+
await props.submitButton?.onClick?.(form.value);
|
|
54
50
|
emit('close', form.value);
|
|
55
|
-
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
</script>
|
|
@@ -61,41 +56,31 @@ async function handleSubmit() {
|
|
|
61
56
|
<template>
|
|
62
57
|
<u-modal @update:open="!$event && emit('close')">
|
|
63
58
|
<template #content>
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
variant="ghost"
|
|
90
|
-
label="Cancel"
|
|
91
|
-
v-bind="radOmit(props.cancelButton, [ 'onClick' ])"
|
|
92
|
-
loading-auto
|
|
93
|
-
@click="emit('close')"
|
|
94
|
-
/>
|
|
95
|
-
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
</u-card>
|
|
59
|
+
<un-card
|
|
60
|
+
:icon="props.icon"
|
|
61
|
+
:title="props.title"
|
|
62
|
+
:subtitle="props.subtitle"
|
|
63
|
+
:text="props.text"
|
|
64
|
+
:actions="[
|
|
65
|
+
{
|
|
66
|
+
label: 'Submit',
|
|
67
|
+
...props.submitButton,
|
|
68
|
+
loadingAuto: true,
|
|
69
|
+
onClick: handleSubmit,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
actionType: 'spacer',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
variant: 'ghost',
|
|
76
|
+
label: 'Cancel',
|
|
77
|
+
...props.cancelButton,
|
|
78
|
+
loadingAuto: true,
|
|
79
|
+
onClick: () => emit('close'),
|
|
80
|
+
},
|
|
81
|
+
]">
|
|
82
|
+
<form-tag />
|
|
83
|
+
</un-card>
|
|
99
84
|
</template>
|
|
100
85
|
</u-modal>
|
|
101
86
|
</template>
|