nuxt-glorious 0.7.9-7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +29 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.d.ts +7 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +93 -0
- package/dist/runtime/assets/icons/glorious-arrow.svg +3 -0
- package/dist/runtime/assets/icons/glorious-check-fill.svg +10 -0
- package/dist/runtime/assets/icons/glorious-x.svg +3 -0
- package/dist/runtime/assets/style/components/buttons.css +88 -0
- package/dist/runtime/assets/style/components/drawer.css +55 -0
- package/dist/runtime/assets/style/components/dropdown.css +18 -0
- package/dist/runtime/assets/style/components/editor.css +4 -0
- package/dist/runtime/assets/style/components/file.css +65 -0
- package/dist/runtime/assets/style/components/input.css +91 -0
- package/dist/runtime/assets/style/components/modal.css +46 -0
- package/dist/runtime/assets/style/components/paginate.css +17 -0
- package/dist/runtime/assets/style/components/select.css +54 -0
- package/dist/runtime/assets/style/components/tab.css +9 -0
- package/dist/runtime/assets/style/components/textarea.css +64 -0
- package/dist/runtime/components/G/Breadcrump.vue +41 -0
- package/dist/runtime/components/G/Button.vue +163 -0
- package/dist/runtime/components/G/CountDown.vue +65 -0
- package/dist/runtime/components/G/Drawer.vue +80 -0
- package/dist/runtime/components/G/Dropdown.vue +63 -0
- package/dist/runtime/components/G/File.vue +142 -0
- package/dist/runtime/components/G/Icon/index.vue +142 -0
- package/dist/runtime/components/G/Input.vue +269 -0
- package/dist/runtime/components/G/IntersectionObserve.vue +22 -0
- package/dist/runtime/components/G/Loading.vue +35 -0
- package/dist/runtime/components/G/Modal.vue +92 -0
- package/dist/runtime/components/G/Paginate.vue +130 -0
- package/dist/runtime/components/G/Radio.vue +38 -0
- package/dist/runtime/components/G/Select.vue +145 -0
- package/dist/runtime/components/G/Tab.vue +57 -0
- package/dist/runtime/components/G/Wizard.vue +123 -0
- package/dist/runtime/components/G/textarea.vue +141 -0
- package/dist/runtime/composables/useGloriousAppSetting.d.ts +11 -0
- package/dist/runtime/composables/useGloriousAppSetting.mjs +37 -0
- package/dist/runtime/composables/useGloriousFetch.d.ts +13 -0
- package/dist/runtime/composables/useGloriousFetch.mjs +107 -0
- package/dist/runtime/composables/useGloriousHead.d.ts +8 -0
- package/dist/runtime/composables/useGloriousHead.mjs +33 -0
- package/dist/runtime/middlewares/Auth.d.ts +2 -0
- package/dist/runtime/middlewares/Auth.mjs +37 -0
- package/dist/runtime/middlewares/AuthStrategy.d.ts +2 -0
- package/dist/runtime/middlewares/AuthStrategy.mjs +17 -0
- package/dist/runtime/plugins/Drawer.d.ts +2 -0
- package/dist/runtime/plugins/Drawer.mjs +35 -0
- package/dist/runtime/plugins/Modal.d.ts +2 -0
- package/dist/runtime/plugins/Modal.mjs +38 -0
- package/dist/runtime/plugins/TailwindColor.d.ts +6 -0
- package/dist/runtime/plugins/TailwindColor.mjs +10 -0
- package/dist/runtime/plugins/glorious-app-setting.d.ts +2 -0
- package/dist/runtime/plugins/glorious-app-setting.mjs +11 -0
- package/dist/runtime/plugins/shortcut-key.d.ts +2 -0
- package/dist/runtime/plugins/shortcut-key.mjs +11 -0
- package/dist/runtime/stores/GloriousStore.d.ts +9 -0
- package/dist/runtime/stores/GloriousStore.mjs +88 -0
- package/dist/types.d.mts +16 -0
- package/dist/types.d.ts +16 -0
- package/package.json +53 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
.xl.glorious-textarea-orange, .xl.glorious-textarea-blue, .xl.glorious-textarea-gray, .xl.glorious-textarea-red, .xl.glorious-textarea-primary {
|
2
|
+
@apply py-2.5;
|
3
|
+
}
|
4
|
+
.lg.glorious-textarea-orange, .lg.glorious-textarea-blue, .lg.glorious-textarea-gray, .lg.glorious-textarea-red, .lg.glorious-textarea-primary {
|
5
|
+
@apply py-2;
|
6
|
+
}
|
7
|
+
.md.glorious-textarea-orange, .md.glorious-textarea-blue, .md.glorious-textarea-gray, .md.glorious-textarea-red, .md.glorious-textarea-primary {
|
8
|
+
@apply py-1.5;
|
9
|
+
}
|
10
|
+
.sm.glorious-textarea-orange, .sm.glorious-textarea-blue, .sm.glorious-textarea-gray, .sm.glorious-textarea-red, .sm.glorious-textarea-primary {
|
11
|
+
@apply py-1;
|
12
|
+
}
|
13
|
+
.xsm.glorious-textarea-orange, .xsm.glorious-textarea-blue, .xsm.glorious-textarea-gray, .xsm.glorious-textarea-red, .xsm.glorious-textarea-primary {
|
14
|
+
@apply py-0.5;
|
15
|
+
}
|
16
|
+
|
17
|
+
.glorious-textarea-orange:focus-visible, .glorious-textarea-blue:focus-visible, .glorious-textarea-gray:focus-visible, .glorious-textarea-red:focus-visible, .glorious-textarea-primary:focus-visible {
|
18
|
+
@apply outline-none ring-2;
|
19
|
+
}
|
20
|
+
|
21
|
+
.glorious-textarea-primary {
|
22
|
+
@apply rounded-md ring-1 ring-green-500 px-3;
|
23
|
+
}
|
24
|
+
.glorious-textarea-primary:disabled {
|
25
|
+
@apply bg-green-300 cursor-not-allowed;
|
26
|
+
}
|
27
|
+
|
28
|
+
.glorious-textarea-red {
|
29
|
+
@apply rounded-md ring-1 ring-red-500 px-3;
|
30
|
+
}
|
31
|
+
.glorious-textarea-red:disabled {
|
32
|
+
@apply cursor-not-allowed;
|
33
|
+
}
|
34
|
+
|
35
|
+
.glorious-textarea-gray {
|
36
|
+
@apply rounded-md ring-1 ring-gray-500 px-3;
|
37
|
+
}
|
38
|
+
.glorious-textarea-gray:disabled {
|
39
|
+
@apply cursor-not-allowed;
|
40
|
+
}
|
41
|
+
|
42
|
+
.glorious-textarea-blue {
|
43
|
+
@apply rounded-md ring-1 ring-blue-500 px-3;
|
44
|
+
}
|
45
|
+
.glorious-textarea-blue:disabled {
|
46
|
+
@apply cursor-not-allowed;
|
47
|
+
}
|
48
|
+
|
49
|
+
.glorious-textarea-orange {
|
50
|
+
@apply rounded-md ring-1 ring-orange-500 px-3;
|
51
|
+
}
|
52
|
+
.glorious-textarea-orange:disabled {
|
53
|
+
@apply cursor-not-allowed;
|
54
|
+
}
|
55
|
+
|
56
|
+
.glorious-textarea {
|
57
|
+
@apply relative w-full;
|
58
|
+
}
|
59
|
+
.glorious-textarea > textarea {
|
60
|
+
@apply w-full;
|
61
|
+
}
|
62
|
+
.glorious-textarea > textarea::placeholder {
|
63
|
+
@apply text-[14px];
|
64
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const props = defineProps({
|
3
|
+
items: {
|
4
|
+
required: true,
|
5
|
+
type: Object,
|
6
|
+
},
|
7
|
+
});
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<template>
|
11
|
+
<div class="flex gap-1 flex-wrap">
|
12
|
+
<div
|
13
|
+
v-for="(item, key, index) in props.items"
|
14
|
+
:key="index"
|
15
|
+
class="flex items-center gap-1 flex-wrap"
|
16
|
+
>
|
17
|
+
<nuxt-link
|
18
|
+
v-if="index !== Object.entries(props.items).length - 1"
|
19
|
+
:to="key"
|
20
|
+
class="text-gray-500 hover:text-gray-800"
|
21
|
+
>
|
22
|
+
{{ item }}
|
23
|
+
</nuxt-link>
|
24
|
+
|
25
|
+
<span
|
26
|
+
v-if="index === Object.entries(props.items).length - 1"
|
27
|
+
class="text-gray-600 font-medium"
|
28
|
+
>
|
29
|
+
{{ item }}
|
30
|
+
</span>
|
31
|
+
|
32
|
+
<GIcon
|
33
|
+
v-if="index !== Object.entries(props.items).length - 1"
|
34
|
+
name="glorious-arrow"
|
35
|
+
style="rotate: 180deg"
|
36
|
+
:size="10"
|
37
|
+
color="#6b7280"
|
38
|
+
/>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</template>
|
@@ -0,0 +1,163 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const props = defineProps({
|
3
|
+
color: {
|
4
|
+
required: false,
|
5
|
+
default: "primary",
|
6
|
+
type: String,
|
7
|
+
},
|
8
|
+
size: {
|
9
|
+
required: false,
|
10
|
+
default: "md",
|
11
|
+
type: String,
|
12
|
+
},
|
13
|
+
outline: {
|
14
|
+
required: false,
|
15
|
+
default: false,
|
16
|
+
type: Boolean,
|
17
|
+
},
|
18
|
+
disabled: {
|
19
|
+
required: false,
|
20
|
+
default: false,
|
21
|
+
type: Boolean,
|
22
|
+
},
|
23
|
+
loading: {
|
24
|
+
requried: false,
|
25
|
+
default: false,
|
26
|
+
type: Boolean,
|
27
|
+
},
|
28
|
+
to: {
|
29
|
+
requried: false,
|
30
|
+
default: "",
|
31
|
+
type: String,
|
32
|
+
},
|
33
|
+
ariaLabel: {
|
34
|
+
requried: false,
|
35
|
+
default: "",
|
36
|
+
type: String,
|
37
|
+
},
|
38
|
+
});
|
39
|
+
</script>
|
40
|
+
|
41
|
+
<template>
|
42
|
+
<button
|
43
|
+
v-if="props.to === ''"
|
44
|
+
:aria-label="props.ariaLabel"
|
45
|
+
:class="[
|
46
|
+
`glorious-button-${props.color}`,
|
47
|
+
props.size,
|
48
|
+
props.outline ? 'outline' : '',
|
49
|
+
]"
|
50
|
+
:disabled="props.disabled"
|
51
|
+
>
|
52
|
+
<div v-if="props.loading" class="loading">
|
53
|
+
<GLoading />
|
54
|
+
</div>
|
55
|
+
<slot v-else />
|
56
|
+
</button>
|
57
|
+
<NuxtLink
|
58
|
+
v-else
|
59
|
+
:to="props.to"
|
60
|
+
:class="[
|
61
|
+
`glorious-button-${props.color}`,
|
62
|
+
props.size,
|
63
|
+
props.outline ? 'outline' : '',
|
64
|
+
]"
|
65
|
+
:disabled="props.disabled"
|
66
|
+
>
|
67
|
+
<div v-if="props.loading" class="loading">
|
68
|
+
<GLoading />
|
69
|
+
</div>
|
70
|
+
<slot v-else />
|
71
|
+
</NuxtLink>
|
72
|
+
</template>
|
73
|
+
|
74
|
+
<style>
|
75
|
+
.xl.glorious-button-orange, .xl.glorious-button-blue, .xl.glorious-button-gray, .xl.glorious-button-red, .xl.glorious-button-primary {
|
76
|
+
@apply py-2.5;
|
77
|
+
}
|
78
|
+
.xl.glorious-button-orange > div.loading > div > div, .xl.glorious-button-blue > div.loading > div > div, .xl.glorious-button-gray > div.loading > div > div, .xl.glorious-button-red > div.loading > div > div, .xl.glorious-button-primary > div.loading > div > div {
|
79
|
+
@apply w-[24px] !important;
|
80
|
+
}
|
81
|
+
.lg.glorious-button-orange, .lg.glorious-button-blue, .lg.glorious-button-gray, .lg.glorious-button-red, .lg.glorious-button-primary {
|
82
|
+
@apply py-2;
|
83
|
+
}
|
84
|
+
.lg.glorious-button-orange > div.loading > div > div, .lg.glorious-button-blue > div.loading > div > div, .lg.glorious-button-gray > div.loading > div > div, .lg.glorious-button-red > div.loading > div > div, .lg.glorious-button-primary > div.loading > div > div {
|
85
|
+
@apply w-[24px] !important;
|
86
|
+
}
|
87
|
+
.md.glorious-button-orange, .md.glorious-button-blue, .md.glorious-button-gray, .md.glorious-button-red, .md.glorious-button-primary {
|
88
|
+
@apply py-1.5;
|
89
|
+
}
|
90
|
+
.md.glorious-button-orange > div.loading > div > div, .md.glorious-button-blue > div.loading > div > div, .md.glorious-button-gray > div.loading > div > div, .md.glorious-button-red > div.loading > div > div, .md.glorious-button-primary > div.loading > div > div {
|
91
|
+
@apply w-[24px] !important;
|
92
|
+
}
|
93
|
+
.sm.glorious-button-orange, .sm.glorious-button-blue, .sm.glorious-button-gray, .sm.glorious-button-red, .sm.glorious-button-primary {
|
94
|
+
@apply py-1;
|
95
|
+
}
|
96
|
+
.sm.glorious-button-orange > div.loading > div > div, .sm.glorious-button-blue > div.loading > div > div, .sm.glorious-button-gray > div.loading > div > div, .sm.glorious-button-red > div.loading > div > div, .sm.glorious-button-primary > div.loading > div > div {
|
97
|
+
@apply w-[24px] !important;
|
98
|
+
}
|
99
|
+
.xsm.glorious-button-orange, .xsm.glorious-button-blue, .xsm.glorious-button-gray, .xsm.glorious-button-red, .xsm.glorious-button-primary {
|
100
|
+
@apply py-0.5;
|
101
|
+
}
|
102
|
+
.xsm.glorious-button-orange > div.loading > div > div, .xsm.glorious-button-blue > div.loading > div > div, .xsm.glorious-button-gray > div.loading > div > div, .xsm.glorious-button-red > div.loading > div > div, .xsm.glorious-button-primary > div.loading > div > div {
|
103
|
+
@apply w-[24px] !important;
|
104
|
+
}
|
105
|
+
|
106
|
+
.outline.glorious-button-orange, .outline.glorious-button-blue, .outline.glorious-button-gray, .outline.glorious-button-red, .outline.glorious-button-primary {
|
107
|
+
@apply bg-transparent border outline-none;
|
108
|
+
}
|
109
|
+
|
110
|
+
.glorious-button-orange > div.loading, .glorious-button-blue > div.loading, .glorious-button-gray > div.loading, .glorious-button-red > div.loading, .glorious-button-primary > div.loading {
|
111
|
+
@apply flex justify-center items-center;
|
112
|
+
}
|
113
|
+
|
114
|
+
.glorious-button-primary {
|
115
|
+
@apply bg-green-700 hover:bg-green-600 rounded-md text-white border-green-500 px-3;
|
116
|
+
}
|
117
|
+
.glorious-button-primary.outline {
|
118
|
+
@apply text-gray-500 hover:bg-green-100;
|
119
|
+
}
|
120
|
+
.glorious-button-primary:disabled {
|
121
|
+
@apply bg-green-300 cursor-not-allowed;
|
122
|
+
}
|
123
|
+
|
124
|
+
.glorious-button-red {
|
125
|
+
@apply bg-red-500 hover:bg-red-600 rounded-md text-white border-red-500 px-3;
|
126
|
+
}
|
127
|
+
.glorious-button-red.outline {
|
128
|
+
@apply text-gray-500 hover:bg-red-100;
|
129
|
+
}
|
130
|
+
.glorious-button-red:disabled {
|
131
|
+
@apply bg-red-300 cursor-not-allowed;
|
132
|
+
}
|
133
|
+
|
134
|
+
.glorious-button-gray {
|
135
|
+
@apply bg-gray-500 hover:bg-gray-600 rounded-md text-white border-gray-500 px-3;
|
136
|
+
}
|
137
|
+
.glorious-button-gray.outline {
|
138
|
+
@apply text-gray-500 hover:bg-gray-100;
|
139
|
+
}
|
140
|
+
.glorious-button-gray:disabled {
|
141
|
+
@apply bg-gray-300 cursor-not-allowed;
|
142
|
+
}
|
143
|
+
|
144
|
+
.glorious-button-blue {
|
145
|
+
@apply bg-blue-500 hover:bg-blue-600 rounded-md text-white border-blue-500 px-3;
|
146
|
+
}
|
147
|
+
.glorious-button-blue.outline {
|
148
|
+
@apply text-gray-500 hover:bg-blue-100;
|
149
|
+
}
|
150
|
+
.glorious-button-blue:disabled {
|
151
|
+
@apply bg-blue-300 cursor-not-allowed;
|
152
|
+
}
|
153
|
+
|
154
|
+
.glorious-button-orange {
|
155
|
+
@apply bg-orange-500 hover:bg-orange-600 rounded-md text-white border-orange-500 px-3;
|
156
|
+
}
|
157
|
+
.glorious-button-orange.outline {
|
158
|
+
@apply text-gray-500 hover:bg-orange-100;
|
159
|
+
}
|
160
|
+
.glorious-button-orange:disabled {
|
161
|
+
@apply bg-orange-300 cursor-not-allowed;
|
162
|
+
}
|
163
|
+
</style>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { onMounted, ref } from "#imports";
|
3
|
+
|
4
|
+
const isEnd = ref<Boolean>(false);
|
5
|
+
const props = defineProps({
|
6
|
+
second: {
|
7
|
+
required: true,
|
8
|
+
type: Number,
|
9
|
+
},
|
10
|
+
className: {
|
11
|
+
required: true,
|
12
|
+
type: String,
|
13
|
+
default: "flex text-gray-500 font-medium",
|
14
|
+
},
|
15
|
+
});
|
16
|
+
|
17
|
+
onMounted(() => {
|
18
|
+
const currentSecond = props.second;
|
19
|
+
let second = props.second;
|
20
|
+
const countInterval = setInterval(() => {
|
21
|
+
try {
|
22
|
+
second--;
|
23
|
+
let timeString = "";
|
24
|
+
|
25
|
+
if (currentSecond <= 60)
|
26
|
+
timeString =
|
27
|
+
"00:" + (second.toString().length === 1 ? "0" + second : second);
|
28
|
+
else {
|
29
|
+
let minute: number | string = Math.floor(second / 60);
|
30
|
+
if (minute >= 1) {
|
31
|
+
const computeSecond = second - minute * 60;
|
32
|
+
const computeSecond2 =
|
33
|
+
computeSecond.toString().length === 1
|
34
|
+
? "0" + computeSecond
|
35
|
+
: computeSecond;
|
36
|
+
minute = minute.toString().length === 1 ? "0" + minute : minute;
|
37
|
+
timeString = minute + ":" + computeSecond2;
|
38
|
+
} else {
|
39
|
+
timeString =
|
40
|
+
"00:" + (second.toString().length === 1 ? "0" + second : second);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
document.getElementById("countDown").innerText = timeString;
|
45
|
+
|
46
|
+
if (second === 0) {
|
47
|
+
isEnd.value = true;
|
48
|
+
clearInterval(countInterval);
|
49
|
+
}
|
50
|
+
} catch (e) {
|
51
|
+
clearInterval(countInterval);
|
52
|
+
}
|
53
|
+
}, 1000);
|
54
|
+
});
|
55
|
+
</script>
|
56
|
+
<template>
|
57
|
+
<div>
|
58
|
+
<slot v-if="isEnd" name="end" />
|
59
|
+
<div v-else :class="props.className">
|
60
|
+
<slot name="one"></slot>
|
61
|
+
<div id="countDown" />
|
62
|
+
<slot name="two"></slot>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</template>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { useGloriousAppSetting } from "../../composables/useGloriousAppSetting";
|
3
|
+
|
4
|
+
const props = defineProps({
|
5
|
+
id: {
|
6
|
+
required: false,
|
7
|
+
default: "drawer",
|
8
|
+
type: String,
|
9
|
+
},
|
10
|
+
});
|
11
|
+
</script>
|
12
|
+
<template>
|
13
|
+
<div
|
14
|
+
:id="props.id"
|
15
|
+
:class="[useGloriousAppSetting.getSetting().dir]"
|
16
|
+
class="drawer close hidden"
|
17
|
+
>
|
18
|
+
<div class="w-full">
|
19
|
+
<slot></slot>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</template>
|
23
|
+
|
24
|
+
<style>
|
25
|
+
.bg-blur-drawer {
|
26
|
+
@apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
|
27
|
+
}
|
28
|
+
|
29
|
+
.drawer {
|
30
|
+
@apply fixed top-0 bg-white h-full w-[300px] z-[50];
|
31
|
+
}
|
32
|
+
.drawer.close.rtl {
|
33
|
+
animation: drawer-close-right 250ms normal forwards;
|
34
|
+
}
|
35
|
+
.drawer.close.ltr {
|
36
|
+
animation: drawer-close-left 250ms normal forwards;
|
37
|
+
}
|
38
|
+
.drawer.open {
|
39
|
+
@apply flex;
|
40
|
+
}
|
41
|
+
.drawer.open.rtl {
|
42
|
+
animation: drawer-open-right 100ms normal forwards;
|
43
|
+
}
|
44
|
+
.drawer.open.ltr {
|
45
|
+
animation: drawer-open-left 100ms normal forwards;
|
46
|
+
}
|
47
|
+
|
48
|
+
@keyframes drawer-open-left {
|
49
|
+
from {
|
50
|
+
@apply left-[-300px];
|
51
|
+
}
|
52
|
+
to {
|
53
|
+
@apply left-0;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
@keyframes drawer-open-right {
|
57
|
+
from {
|
58
|
+
@apply right-[-300px];
|
59
|
+
}
|
60
|
+
to {
|
61
|
+
@apply right-0;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
@keyframes drawer-close-right {
|
65
|
+
from {
|
66
|
+
@apply right-0;
|
67
|
+
}
|
68
|
+
to {
|
69
|
+
@apply right-[-300px] hidden;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
@keyframes drawer-close-left {
|
73
|
+
from {
|
74
|
+
@apply left-0;
|
75
|
+
}
|
76
|
+
to {
|
77
|
+
@apply left-[-300px] hidden;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
</style>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { onMounted } from "#imports";
|
3
|
+
|
4
|
+
const props = defineProps({
|
5
|
+
icon: {
|
6
|
+
required: false,
|
7
|
+
default: "",
|
8
|
+
type: String,
|
9
|
+
},
|
10
|
+
});
|
11
|
+
|
12
|
+
const openDropdown = (event: any) =>
|
13
|
+
event.currentTarget.parentElement.parentElement.classList.toggle("open");
|
14
|
+
|
15
|
+
onMounted(() => {
|
16
|
+
window.onclick = (event: any) => {
|
17
|
+
if (!event.target.matches(".glorious-dropdown-button")) {
|
18
|
+
const allDropdown = document.querySelectorAll(".glorious-dropdown");
|
19
|
+
allDropdown.forEach((item: any) => {
|
20
|
+
item.classList.remove("open");
|
21
|
+
});
|
22
|
+
}
|
23
|
+
};
|
24
|
+
});
|
25
|
+
</script>
|
26
|
+
<template>
|
27
|
+
<div class="glorious-dropdown">
|
28
|
+
<div>
|
29
|
+
<button
|
30
|
+
aria-label="dots"
|
31
|
+
class="glorious-dropdown-button"
|
32
|
+
@click.prevent="openDropdown($event)"
|
33
|
+
>
|
34
|
+
|
35
|
+
</button>
|
36
|
+
<GIcon :name="props.icon" :color="$tailwindColor('gray', '500')" />
|
37
|
+
</div>
|
38
|
+
<div>
|
39
|
+
<slot />
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</template>
|
43
|
+
|
44
|
+
<style>
|
45
|
+
.glorious-dropdown {
|
46
|
+
@apply relative;
|
47
|
+
}
|
48
|
+
.glorious-dropdown > div:last-child {
|
49
|
+
@apply hidden;
|
50
|
+
}
|
51
|
+
.glorious-dropdown > div:first-child {
|
52
|
+
@apply relative;
|
53
|
+
}
|
54
|
+
.glorious-dropdown > div:first-child > button {
|
55
|
+
@apply z-[30] w-5 relative;
|
56
|
+
}
|
57
|
+
.glorious-dropdown > div:first-child > div:nth-child(2) {
|
58
|
+
@apply absolute top-0 bottom-0 my-auto z-[20];
|
59
|
+
}
|
60
|
+
.glorious-dropdown.open > div:last-child {
|
61
|
+
@apply bg-white px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
|
62
|
+
}
|
63
|
+
</style>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { GloriousStore } from "#imports";
|
3
|
+
const props = defineProps({
|
4
|
+
modelValue: {
|
5
|
+
required: false,
|
6
|
+
default: "",
|
7
|
+
type: String,
|
8
|
+
},
|
9
|
+
color: {
|
10
|
+
required: false,
|
11
|
+
default: "primary",
|
12
|
+
type: String,
|
13
|
+
},
|
14
|
+
placeholder: {
|
15
|
+
required: false,
|
16
|
+
default: "",
|
17
|
+
type: String,
|
18
|
+
},
|
19
|
+
title: {
|
20
|
+
required: false,
|
21
|
+
default: "",
|
22
|
+
type: String,
|
23
|
+
},
|
24
|
+
size: {
|
25
|
+
required: false,
|
26
|
+
default: "md",
|
27
|
+
type: String,
|
28
|
+
},
|
29
|
+
error: {
|
30
|
+
required: false,
|
31
|
+
default: "|",
|
32
|
+
type: String,
|
33
|
+
},
|
34
|
+
});
|
35
|
+
const gs: any = GloriousStore();
|
36
|
+
const error: any = props.error.split("|");
|
37
|
+
const emits = defineEmits(["update:modelValue"]);
|
38
|
+
|
39
|
+
const changeInput = (event: any) => {
|
40
|
+
if (!event.target.files[0]) return;
|
41
|
+
emits("update:modelValue", event.target.files[0]);
|
42
|
+
event.target.nextElementSibling.innerText = event.target.files[0].name;
|
43
|
+
event.target.nextElementSibling.nextElementSibling.style.display = "flex";
|
44
|
+
};
|
45
|
+
const deleteFile = (event: any) => {
|
46
|
+
event.currentTarget.style.display = "none";
|
47
|
+
event.currentTarget.previousElementSibling.innerText =
|
48
|
+
"فایلی انتخاب نشده است";
|
49
|
+
emits("update:modelValue", null);
|
50
|
+
};
|
51
|
+
</script>
|
52
|
+
<template>
|
53
|
+
<div class="flex flex-col">
|
54
|
+
<span class="text-[14px] font-medium text-gray-500">{{ props.title }}</span>
|
55
|
+
<label
|
56
|
+
:class="[`glorious-file-${props.color}`]"
|
57
|
+
class="flex items-center gap-3 text-gray-500"
|
58
|
+
>
|
59
|
+
<div class="placeholder" :class="[props.size]">
|
60
|
+
<span>{{ props.placeholder }}</span>
|
61
|
+
</div>
|
62
|
+
<input type="file" class="hidden" @change="changeInput($event)" />
|
63
|
+
<span class="text-[12px]">فایلی انتخاب نشده است</span>
|
64
|
+
<GIcon
|
65
|
+
name="glorious-x"
|
66
|
+
color="#ff0000"
|
67
|
+
@click.prevent="deleteFile($event)"
|
68
|
+
/>
|
69
|
+
</label>
|
70
|
+
<span v-if="gs.forms[error[0]]?.errors[error[1]]" class="text-red-500">
|
71
|
+
{{ gs.forms[error[0]].errors[error[1]][0] }}
|
72
|
+
</span>
|
73
|
+
</div>
|
74
|
+
</template>
|
75
|
+
|
76
|
+
<style>
|
77
|
+
.glorious-file-orange > div.xl.placeholder, .glorious-file-blue > div.xl.placeholder, .glorious-file-gray > div.xl.placeholder, .glorious-file-red > div.xl.placeholder, .glorious-file-primary > div.xl.placeholder {
|
78
|
+
@apply py-2.5;
|
79
|
+
}
|
80
|
+
.glorious-file-orange > div.lg.placeholder, .glorious-file-blue > div.lg.placeholder, .glorious-file-gray > div.lg.placeholder, .glorious-file-red > div.lg.placeholder, .glorious-file-primary > div.lg.placeholder {
|
81
|
+
@apply py-2;
|
82
|
+
}
|
83
|
+
.glorious-file-orange > div.md.placeholder, .glorious-file-blue > div.md.placeholder, .glorious-file-gray > div.md.placeholder, .glorious-file-red > div.md.placeholder, .glorious-file-primary > div.md.placeholder {
|
84
|
+
@apply py-1.5;
|
85
|
+
}
|
86
|
+
.glorious-file-orange > div.sm.placeholder, .glorious-file-blue > div.sm.placeholder, .glorious-file-gray > div.sm.placeholder, .glorious-file-red > div.sm.placeholder, .glorious-file-primary > div.sm.placeholder {
|
87
|
+
@apply py-1;
|
88
|
+
}
|
89
|
+
.glorious-file-orange > div.xsm.placeholder, .glorious-file-blue > div.xsm.placeholder, .glorious-file-gray > div.xsm.placeholder, .glorious-file-red > div.xsm.placeholder, .glorious-file-primary > div.xsm.placeholder {
|
90
|
+
@apply py-0.5;
|
91
|
+
}
|
92
|
+
|
93
|
+
.glorious-file-primary {
|
94
|
+
@apply rounded-md ring-1 ring-green-500 overflow-hidden cursor-pointer relative;
|
95
|
+
}
|
96
|
+
.glorious-file-primary > div.placeholder {
|
97
|
+
@apply bg-green-500 text-white px-3 w-max;
|
98
|
+
}
|
99
|
+
.glorious-file-primary > div:last-child {
|
100
|
+
@apply absolute left-3 hidden;
|
101
|
+
}
|
102
|
+
|
103
|
+
.glorious-file-red {
|
104
|
+
@apply rounded-md ring-1 ring-red-500 px-3 cursor-pointer relative;
|
105
|
+
}
|
106
|
+
.glorious-file-red > div.placeholder {
|
107
|
+
@apply bg-green-500 text-white px-3 w-max;
|
108
|
+
}
|
109
|
+
.glorious-file-red > div:last-child {
|
110
|
+
@apply absolute left-3;
|
111
|
+
}
|
112
|
+
|
113
|
+
.glorious-file-gray {
|
114
|
+
@apply rounded-md ring-1 ring-gray-500 px-3 cursor-pointer relative;
|
115
|
+
}
|
116
|
+
.glorious-file-gray > div.placeholder {
|
117
|
+
@apply bg-green-500 text-white px-3 w-max;
|
118
|
+
}
|
119
|
+
.glorious-file-gray > div:last-child {
|
120
|
+
@apply absolute left-3;
|
121
|
+
}
|
122
|
+
|
123
|
+
.glorious-file-blue {
|
124
|
+
@apply rounded-md ring-1 ring-blue-500 px-3 cursor-pointer relative;
|
125
|
+
}
|
126
|
+
.glorious-file-blue > div.placeholder {
|
127
|
+
@apply bg-green-500 text-white px-3 w-max;
|
128
|
+
}
|
129
|
+
.glorious-file-blue > div:last-child {
|
130
|
+
@apply absolute left-3;
|
131
|
+
}
|
132
|
+
|
133
|
+
.glorious-file-orange {
|
134
|
+
@apply rounded-md ring-1 ring-orange-500 px-3 cursor-pointer relative;
|
135
|
+
}
|
136
|
+
.glorious-file-orange > div.placeholder {
|
137
|
+
@apply bg-green-500 text-white px-3 w-max;
|
138
|
+
}
|
139
|
+
.glorious-file-orange > div:last-child {
|
140
|
+
@apply absolute left-3;
|
141
|
+
}
|
142
|
+
</style>
|