nuxt-glorious 1.2.3-4 → 1.2.3-5
Sign up to get free protection for your applications and to get access to all the features.
package/dist/module.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { ref, watch } from
|
2
|
+
import { ref, watch } from '#imports'
|
3
3
|
interface selectOptionsInterface {
|
4
|
-
text: string
|
5
|
-
value: [string, object]
|
4
|
+
text: string
|
5
|
+
value: [string, object]
|
6
6
|
}
|
7
|
-
const props = defineProps({
|
7
|
+
const props: any = defineProps({
|
8
8
|
modelValue: {
|
9
9
|
required: false,
|
10
10
|
default: null,
|
@@ -17,22 +17,22 @@ const props = defineProps({
|
|
17
17
|
},
|
18
18
|
color: {
|
19
19
|
required: false,
|
20
|
-
default:
|
20
|
+
default: 'primary',
|
21
21
|
type: String,
|
22
22
|
},
|
23
23
|
size: {
|
24
24
|
required: false,
|
25
|
-
default:
|
25
|
+
default: 'md',
|
26
26
|
type: String,
|
27
27
|
},
|
28
28
|
title: {
|
29
29
|
required: false,
|
30
|
-
default:
|
30
|
+
default: '',
|
31
31
|
type: String,
|
32
32
|
},
|
33
33
|
error: {
|
34
34
|
required: false,
|
35
|
-
default:
|
35
|
+
default: '|',
|
36
36
|
type: String,
|
37
37
|
},
|
38
38
|
disabled: {
|
@@ -41,28 +41,36 @@ const props = defineProps({
|
|
41
41
|
type: Boolean,
|
42
42
|
},
|
43
43
|
placeholder: {
|
44
|
-
|
45
|
-
default:
|
44
|
+
required: false,
|
45
|
+
default: '',
|
46
46
|
type: String,
|
47
47
|
},
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
displayTextKey: {
|
49
|
+
required: false,
|
50
|
+
default: 'text',
|
51
|
+
type: String,
|
52
|
+
},
|
53
|
+
})
|
54
|
+
const selectValue: any = ref(null)
|
55
|
+
const emits = defineEmits(['update:modelValue'])
|
51
56
|
watch(
|
52
57
|
() => selectValue.value,
|
53
58
|
() => {
|
54
|
-
emits(
|
59
|
+
emits('update:modelValue', selectValue.value)
|
55
60
|
}
|
56
|
-
)
|
61
|
+
)
|
57
62
|
|
58
63
|
// -------------------------------------- init value
|
59
|
-
selectValue.value = props.modelValue
|
64
|
+
selectValue.value = props.modelValue
|
60
65
|
watch(
|
61
66
|
() => props.modelValue,
|
62
67
|
() => {
|
63
|
-
selectValue.value = props.modelValue
|
68
|
+
selectValue.value = props.modelValue
|
64
69
|
}
|
65
|
-
)
|
70
|
+
)
|
71
|
+
|
72
|
+
emits('update:modelValue', null)
|
73
|
+
selectValue.value = null
|
66
74
|
</script>
|
67
75
|
|
68
76
|
<template>
|
@@ -81,12 +89,12 @@ watch(
|
|
81
89
|
:key="index"
|
82
90
|
:value="item.value"
|
83
91
|
>
|
84
|
-
{{ item.
|
92
|
+
{{ item[props.displayTextKey] }}
|
85
93
|
</option>
|
86
94
|
</select>
|
87
95
|
<span
|
88
96
|
v-if="selectValue === null"
|
89
|
-
class="absolute top-0 bottom-0 my-auto pr-2 h-max"
|
97
|
+
class="absolute top-0 bottom-0 my-auto pr-2 h-max text-gray-500"
|
90
98
|
>
|
91
99
|
{{ props.placeholder }}
|
92
100
|
</span>
|
@@ -2,8 +2,8 @@
|
|
2
2
|
const props = defineProps({
|
3
3
|
color: {
|
4
4
|
required: false,
|
5
|
-
default:
|
6
|
-
type: String as () =>
|
5
|
+
default: 'blue',
|
6
|
+
type: String as () => 'orange' | 'blue' | 'gray' | 'red' | 'green',
|
7
7
|
},
|
8
8
|
header: {
|
9
9
|
required: true,
|
@@ -21,28 +21,37 @@ const props = defineProps({
|
|
21
21
|
loadingOption: {
|
22
22
|
required: false,
|
23
23
|
default: {
|
24
|
-
color:
|
24
|
+
color: 'green',
|
25
25
|
},
|
26
26
|
type: {
|
27
27
|
color: String,
|
28
28
|
},
|
29
29
|
},
|
30
|
-
})
|
30
|
+
})
|
31
31
|
</script>
|
32
32
|
|
33
33
|
<template>
|
34
34
|
<div class="flex flex-col">
|
35
|
-
<div
|
35
|
+
<div
|
36
|
+
class="glorious-table"
|
37
|
+
:class="[`color-${props.color}`]"
|
38
|
+
>
|
36
39
|
<table>
|
37
40
|
<thead>
|
38
41
|
<tr>
|
39
|
-
<th
|
42
|
+
<th
|
43
|
+
v-for="(headItem, index) in props.header"
|
44
|
+
:key="index"
|
45
|
+
>
|
40
46
|
{{ headItem }}
|
41
47
|
</th>
|
42
48
|
</tr>
|
43
49
|
</thead>
|
44
|
-
<tbody>
|
45
|
-
<tr
|
50
|
+
<tbody v-if="!props.loading">
|
51
|
+
<tr
|
52
|
+
v-for="(bodyItem, bodyIndex) in props.body"
|
53
|
+
:key="bodyIndex"
|
54
|
+
>
|
46
55
|
<td
|
47
56
|
v-for="(headItem, headKey, headIndex) in props.header"
|
48
57
|
:key="headIndex"
|
@@ -50,7 +59,7 @@ const props = defineProps({
|
|
50
59
|
<slot
|
51
60
|
v-if="typeof $slots[headKey] !== 'undefined'"
|
52
61
|
:name="headKey"
|
53
|
-
:item="bodyItem"
|
62
|
+
:item="{ ...bodyItem, index: bodyIndex }"
|
54
63
|
/>
|
55
64
|
<template v-else>
|
56
65
|
{{ bodyItem[headKey] }}
|
@@ -60,8 +69,11 @@ const props = defineProps({
|
|
60
69
|
</tbody>
|
61
70
|
</table>
|
62
71
|
</div>
|
63
|
-
<div
|
64
|
-
|
72
|
+
<div
|
73
|
+
v-if="props.loading"
|
74
|
+
class="flex justify-center mt-3"
|
75
|
+
>
|
76
|
+
<GLoading :color="props.loadingOption.color" />
|
65
77
|
</div>
|
66
78
|
</div>
|
67
79
|
</template>
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "1.2.3-
|
2
|
+
"version": "1.2.3-5",
|
3
3
|
"name": "nuxt-glorious",
|
4
4
|
"description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
|
5
5
|
"repository": "sajadhzj/nuxt-glorious",
|