nuxt-glorious 1.2.3-3 → 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 +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/assets/style/components/input.css +3 -0
- package/dist/runtime/assets/style/components/modal.css +4 -4
- package/dist/runtime/assets/style/components/tab.css +3 -3
- package/dist/runtime/assets/style/components/timeline.css +47 -0
- package/dist/runtime/components/G/Input.vue +3 -0
- package/dist/runtime/components/G/Modal.vue +64 -40
- package/dist/runtime/components/G/Paginate.vue +22 -19
- package/dist/runtime/components/G/Select.vue +28 -20
- package/dist/runtime/components/G/Tab.vue +84 -24
- package/dist/runtime/components/G/Table.vue +23 -11
- package/dist/runtime/components/G/timeline.vue +84 -0
- package/dist/runtime/composables/useGloriousFetch.d.ts +4 -3
- package/dist/runtime/composables/useGloriousFetch.mjs +6 -2
- package/dist/runtime/middlewares/ResponseGloriousStore.d.ts +2 -0
- package/dist/runtime/middlewares/ResponseGloriousStore.mjs +8 -0
- package/dist/runtime/stores/GloriousStore.mjs +3 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
@@ -76,6 +76,11 @@ const module = defineNuxtModule({
|
|
76
76
|
path: resolver.resolve("./runtime/middlewares/AuthStrategy"),
|
77
77
|
global: true
|
78
78
|
});
|
79
|
+
addRouteMiddleware({
|
80
|
+
name: "response-glorious-store",
|
81
|
+
path: resolver.resolve("./runtime/middlewares/ResponseGloriousStore"),
|
82
|
+
global: true
|
83
|
+
});
|
79
84
|
addRouteMiddleware({
|
80
85
|
name: "g-auth",
|
81
86
|
path: resolver.resolve("./runtime/middlewares/Auth")
|
@@ -17,16 +17,16 @@
|
|
17
17
|
@apply w-full h-full top-0 rounded-none;
|
18
18
|
}
|
19
19
|
.glorious-scaffold-modal.size-xl {
|
20
|
-
@apply md:w-[70%] w-full md:h-max max-h-[
|
20
|
+
@apply md:w-[70%] w-full md:h-max max-h-[calc(100%-15%)];
|
21
21
|
}
|
22
22
|
.glorious-scaffold-modal.size-lg {
|
23
|
-
@apply md:w-[60%] w-full md:h-max max-h-[
|
23
|
+
@apply md:w-[60%] w-full md:h-max max-h-[calc(100%-15%)];
|
24
24
|
}
|
25
25
|
.glorious-scaffold-modal.size-md {
|
26
|
-
@apply md:w-[50%] w-full md:h-max max-h-[
|
26
|
+
@apply md:w-[50%] w-full md:h-max max-h-[calc(100%-15%)];
|
27
27
|
}
|
28
28
|
.glorious-scaffold-modal.size-sm {
|
29
|
-
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[
|
29
|
+
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[calc(100%-15%)];
|
30
30
|
}
|
31
31
|
.glorious-scaffold-modal.close {
|
32
32
|
@apply hidden;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
.glorious-tab {
|
2
|
-
@apply flex justify-between bg-green-100
|
2
|
+
@apply flex justify-between bg-green-100 rounded-lg gap-3 w-max max-w-full shadow-md;
|
3
3
|
}
|
4
|
-
.glorious-tab > div > button {
|
4
|
+
.glorious-tab div > div > button {
|
5
5
|
@apply text-gray-700 text-[14px] hover:bg-green-200 hover:text-gray-800 cursor-pointer px-2 py-1 rounded-lg;
|
6
6
|
}
|
7
|
-
.glorious-tab > div > button.active {
|
7
|
+
.glorious-tab div > div > button.active {
|
8
8
|
@apply font-bold text-white bg-green-700;
|
9
9
|
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
.glorious-timeline-items {
|
2
|
+
@apply relative;
|
3
|
+
}
|
4
|
+
.glorious-timeline-items div {
|
5
|
+
@apply relative;
|
6
|
+
}
|
7
|
+
.glorious-timeline-items div::before {
|
8
|
+
content: "";
|
9
|
+
@apply absolute w-[2px] right-[-15px];
|
10
|
+
}
|
11
|
+
.glorious-timeline-items div::before:not(:last-child) {
|
12
|
+
@apply h-[calc(100%+20px)];
|
13
|
+
}
|
14
|
+
.glorious-timeline-items-count {
|
15
|
+
@apply absolute w-5 h-5 top-0 right-[-24px] rounded-full !important;
|
16
|
+
@apply text-white flex justify-center items-center font-medium;
|
17
|
+
}
|
18
|
+
.glorious-timeline-items.color-orange > div::before {
|
19
|
+
@apply bg-orange-500;
|
20
|
+
}
|
21
|
+
.glorious-timeline-items.color-blue > div::before {
|
22
|
+
@apply bg-blue-500;
|
23
|
+
}
|
24
|
+
.glorious-timeline-items.color-gray > div::before {
|
25
|
+
@apply bg-gray-500;
|
26
|
+
}
|
27
|
+
.glorious-timeline-items.color-red > div::before {
|
28
|
+
@apply bg-red-500;
|
29
|
+
}
|
30
|
+
.glorious-timeline-items.color-green > div::before {
|
31
|
+
@apply bg-green-500;
|
32
|
+
}
|
33
|
+
.glorious-timeline-items.color-orange .glorious-timeline-items-count {
|
34
|
+
@apply bg-orange-500;
|
35
|
+
}
|
36
|
+
.glorious-timeline-items.color-blue .glorious-timeline-items-count {
|
37
|
+
@apply bg-blue-500;
|
38
|
+
}
|
39
|
+
.glorious-timeline-items.color-gray .glorious-timeline-items-count {
|
40
|
+
@apply bg-gray-500;
|
41
|
+
}
|
42
|
+
.glorious-timeline-items.color-red .glorious-timeline-items-count {
|
43
|
+
@apply bg-red-500;
|
44
|
+
}
|
45
|
+
.glorious-timeline-items.color-green .glorious-timeline-items-count {
|
46
|
+
@apply bg-green-500;
|
47
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { watch } from
|
3
|
-
|
2
|
+
import { watch } from '#imports'
|
3
|
+
|
4
4
|
const props = defineProps({
|
5
5
|
modelValue: {
|
6
6
|
required: true,
|
@@ -9,17 +9,17 @@ const props = defineProps({
|
|
9
9
|
},
|
10
10
|
size: {
|
11
11
|
required: false,
|
12
|
-
default:
|
13
|
-
type: String as () =>
|
12
|
+
default: 'md',
|
13
|
+
type: String as () => 'xl' | 'lg' | 'md' | 'sm' | 'full',
|
14
14
|
},
|
15
15
|
title: {
|
16
16
|
required: false,
|
17
|
-
default:
|
17
|
+
default: '',
|
18
18
|
type: String,
|
19
19
|
},
|
20
20
|
okBtn: {
|
21
21
|
required: false,
|
22
|
-
default:
|
22
|
+
default: '',
|
23
23
|
type: String,
|
24
24
|
},
|
25
25
|
okBtnLoading: {
|
@@ -29,13 +29,13 @@ const props = defineProps({
|
|
29
29
|
},
|
30
30
|
closeBtn: {
|
31
31
|
required: false,
|
32
|
-
default:
|
32
|
+
default: '',
|
33
33
|
type: String,
|
34
34
|
},
|
35
35
|
rtl: {
|
36
36
|
required: false,
|
37
|
-
default:
|
38
|
-
type: String as () =>
|
37
|
+
default: 'rtl',
|
38
|
+
type: String as () => 'rtl' | 'ltr',
|
39
39
|
},
|
40
40
|
blur: {
|
41
41
|
required: false,
|
@@ -47,45 +47,50 @@ const props = defineProps({
|
|
47
47
|
default: true,
|
48
48
|
type: Boolean,
|
49
49
|
},
|
50
|
-
|
50
|
+
colorBtn: {
|
51
|
+
required: false,
|
52
|
+
default: 'primary',
|
53
|
+
type: String as () => 'orange' | 'blue' | 'gray' | 'red' | 'primary',
|
54
|
+
},
|
55
|
+
})
|
51
56
|
|
52
|
-
const emits = defineEmits([
|
57
|
+
const emits = defineEmits(['ok', 'close', 'update:modelValue'])
|
53
58
|
|
54
59
|
const addBlurBackground = (): void => {
|
55
|
-
const backgroundBlur = document.createElement(
|
56
|
-
backgroundBlur.classList.add(
|
57
|
-
const nuxt: any = document.getElementById(
|
58
|
-
nuxt.appendChild(backgroundBlur)
|
59
|
-
backgroundBlur.addEventListener(
|
60
|
+
const backgroundBlur = document.createElement('div')
|
61
|
+
backgroundBlur.classList.add('glorious-scaffold-modal-bg-blur')
|
62
|
+
const nuxt: any = document.getElementById('__nuxt')
|
63
|
+
nuxt.appendChild(backgroundBlur)
|
64
|
+
backgroundBlur.addEventListener('click', () => {
|
60
65
|
if (props.blurClose) {
|
61
|
-
emits(
|
62
|
-
backgroundBlur.remove()
|
66
|
+
emits('update:modelValue', false)
|
67
|
+
backgroundBlur.remove()
|
63
68
|
}
|
64
|
-
})
|
65
|
-
}
|
69
|
+
})
|
70
|
+
}
|
66
71
|
|
67
72
|
watch(
|
68
73
|
() => props.modelValue,
|
69
74
|
() => {
|
70
|
-
const modals = document.querySelectorAll(
|
75
|
+
const modals = document.querySelectorAll('.glorious-scaffold-modal')
|
71
76
|
if (props.modelValue && props.blur) {
|
72
|
-
addBlurBackground()
|
77
|
+
addBlurBackground()
|
73
78
|
setTimeout(() => {
|
74
79
|
modals.forEach((el: any) => {
|
75
|
-
el.classList.remove(
|
76
|
-
})
|
77
|
-
}, 500)
|
80
|
+
el.classList.remove('animation')
|
81
|
+
})
|
82
|
+
}, 500)
|
78
83
|
} else {
|
79
84
|
const blur: any = document.querySelector(
|
80
|
-
|
81
|
-
)
|
85
|
+
'.glorious-scaffold-modal-bg-blur'
|
86
|
+
)
|
82
87
|
modals.forEach((el: any) => {
|
83
|
-
el.classList.add(
|
84
|
-
})
|
85
|
-
if (blur !== null) blur.remove()
|
88
|
+
el.classList.add('animation')
|
89
|
+
})
|
90
|
+
if (blur !== null) blur.remove()
|
86
91
|
}
|
87
92
|
}
|
88
|
-
)
|
93
|
+
)
|
89
94
|
</script>
|
90
95
|
|
91
96
|
<template>
|
@@ -94,7 +99,10 @@ watch(
|
|
94
99
|
:class="[props.modelValue ? 'open' : 'close', `size-${props.size}`]"
|
95
100
|
>
|
96
101
|
<!-- header -->
|
97
|
-
<div
|
102
|
+
<div
|
103
|
+
v-show="props?.title !== ''"
|
104
|
+
class="glorious-scaffold-modal-header"
|
105
|
+
>
|
98
106
|
<span class="font-medium">{{ props.title }}</span>
|
99
107
|
<GButton
|
100
108
|
class="flex justify-center items-center w-6 h-6"
|
@@ -102,10 +110,17 @@ watch(
|
|
102
110
|
color="red"
|
103
111
|
@click="emits('update:modelValue', false)"
|
104
112
|
>
|
105
|
-
<GIcon
|
113
|
+
<GIcon
|
114
|
+
name="glorious-x"
|
115
|
+
color="#fff"
|
116
|
+
:size="10"
|
117
|
+
/>
|
106
118
|
</GButton>
|
107
119
|
</div>
|
108
|
-
<hr
|
120
|
+
<hr
|
121
|
+
v-show="props.title !== ''"
|
122
|
+
class="my-3"
|
123
|
+
/>
|
109
124
|
<!-- end header -->
|
110
125
|
|
111
126
|
<div class="glorious-scaffold-modal-content">
|
@@ -113,12 +128,21 @@ watch(
|
|
113
128
|
</div>
|
114
129
|
|
115
130
|
<!-- start footer -->
|
116
|
-
<div
|
117
|
-
|
131
|
+
<div
|
132
|
+
v-show="props.okBtn !== ''"
|
133
|
+
class="glorious-scaffold-modal-footer"
|
134
|
+
>
|
135
|
+
<GButton
|
136
|
+
:color="props.colorBtn"
|
137
|
+
:loading="props.okBtnLoading"
|
138
|
+
@click="emits('ok')"
|
139
|
+
>
|
118
140
|
{{ props.okBtn }}
|
119
141
|
</GButton>
|
120
142
|
<GButton
|
143
|
+
:color="props.colorBtn"
|
121
144
|
v-show="props.closeBtn !== ''"
|
145
|
+
outline
|
122
146
|
@click="emits('update:modelValue', false)"
|
123
147
|
>
|
124
148
|
{{ props.closeBtn }}
|
@@ -148,16 +172,16 @@ watch(
|
|
148
172
|
@apply w-full h-full top-0 rounded-none;
|
149
173
|
}
|
150
174
|
.glorious-scaffold-modal.size-xl {
|
151
|
-
@apply md:w-[70%] w-full md:h-max max-h-[
|
175
|
+
@apply md:w-[70%] w-full md:h-max max-h-[calc(100%-15%)];
|
152
176
|
}
|
153
177
|
.glorious-scaffold-modal.size-lg {
|
154
|
-
@apply md:w-[60%] w-full md:h-max max-h-[
|
178
|
+
@apply md:w-[60%] w-full md:h-max max-h-[calc(100%-15%)];
|
155
179
|
}
|
156
180
|
.glorious-scaffold-modal.size-md {
|
157
|
-
@apply md:w-[50%] w-full md:h-max max-h-[
|
181
|
+
@apply md:w-[50%] w-full md:h-max max-h-[calc(100%-15%)];
|
158
182
|
}
|
159
183
|
.glorious-scaffold-modal.size-sm {
|
160
|
-
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[
|
184
|
+
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[calc(100%-15%)];
|
161
185
|
}
|
162
186
|
.glorious-scaffold-modal.close {
|
163
187
|
@apply hidden;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { watch, ref } from
|
2
|
+
import { watch, ref } from '#imports'
|
3
3
|
const props = defineProps({
|
4
4
|
currentPage: {
|
5
5
|
required: true,
|
@@ -17,42 +17,45 @@ const props = defineProps({
|
|
17
17
|
default: 3,
|
18
18
|
},
|
19
19
|
modelValue: {
|
20
|
-
required:
|
20
|
+
required: false,
|
21
21
|
type: Number,
|
22
22
|
},
|
23
|
-
})
|
23
|
+
})
|
24
24
|
|
25
|
-
const emits = defineEmits([
|
25
|
+
const emits = defineEmits(['update:modelValue', 'change'])
|
26
26
|
|
27
27
|
const emit = (item: any) => {
|
28
|
-
if (props.currentPage !== item)
|
29
|
-
|
28
|
+
if (props.currentPage !== item) {
|
29
|
+
emits('update:modelValue', item)
|
30
|
+
emits('change', { page: item })
|
31
|
+
}
|
32
|
+
}
|
30
33
|
|
31
|
-
const listPage = ref<Array<Number>>([])
|
34
|
+
const listPage = ref<Array<Number>>([])
|
32
35
|
|
33
36
|
const computeListPage = () => {
|
34
|
-
listPage.value = []
|
35
|
-
let firstPage = props.currentPage - props.numberSugestPage
|
36
|
-
const endPage = props.currentPage + (props.numberSugestPage + 1)
|
37
|
+
listPage.value = []
|
38
|
+
let firstPage = props.currentPage - props.numberSugestPage
|
39
|
+
const endPage = props.currentPage + (props.numberSugestPage + 1)
|
37
40
|
|
38
41
|
while (firstPage <= endPage) {
|
39
42
|
if (firstPage > 0 && firstPage <= props.lastPage)
|
40
|
-
listPage.value.push(firstPage)
|
41
|
-
firstPage
|
43
|
+
listPage.value.push(firstPage)
|
44
|
+
firstPage++
|
42
45
|
}
|
43
|
-
}
|
44
|
-
computeListPage()
|
46
|
+
}
|
47
|
+
computeListPage()
|
45
48
|
watch(
|
46
49
|
() => props.currentPage,
|
47
50
|
() => computeListPage()
|
48
|
-
)
|
51
|
+
)
|
49
52
|
|
50
53
|
const arrowPrevious = () => {
|
51
|
-
if (props.currentPage !== 1) emit(props.currentPage - 1)
|
52
|
-
}
|
54
|
+
if (props.currentPage !== 1) emit(props.currentPage - 1)
|
55
|
+
}
|
53
56
|
const arrowNext = () => {
|
54
|
-
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
|
55
|
-
}
|
57
|
+
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
|
58
|
+
}
|
56
59
|
</script>
|
57
60
|
|
58
61
|
<template>
|
@@ -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>
|
@@ -1,10 +1,9 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
interface itemsType {
|
3
|
-
active: boolean
|
4
|
-
text: string
|
5
|
-
key: string
|
3
|
+
active: boolean
|
4
|
+
text: string
|
5
|
+
key: string
|
6
6
|
}
|
7
|
-
|
8
7
|
const props = defineProps({
|
9
8
|
items: {
|
10
9
|
required: true,
|
@@ -15,43 +14,104 @@ const props = defineProps({
|
|
15
14
|
required: true,
|
16
15
|
type: String,
|
17
16
|
},
|
18
|
-
})
|
19
|
-
const emits = defineEmits([
|
17
|
+
})
|
18
|
+
const emits = defineEmits(['update:modelValue'])
|
20
19
|
const tabClicked: any = (key: string, event: any) => {
|
21
|
-
emits(
|
20
|
+
emits('update:modelValue', key)
|
22
21
|
Array.from(event.currentTarget.parentElement.parentElement.children).map(
|
23
|
-
(item: any) => item.children[0].classList.remove(
|
24
|
-
)
|
25
|
-
event.currentTarget.classList.add(
|
26
|
-
}
|
22
|
+
(item: any) => item.children[0].classList.remove('active')
|
23
|
+
)
|
24
|
+
event.currentTarget.classList.add('active')
|
25
|
+
}
|
26
|
+
|
27
|
+
const setArrow = () => {
|
28
|
+
document.querySelectorAll('.glorious-tab-content').forEach((element) => {
|
29
|
+
if (element.scrollWidth > element.clientWidth) {
|
30
|
+
element.previousElementSibling?.classList.replace('hidden', 'flex')
|
31
|
+
|
32
|
+
element.previousElementSibling?.parentElement?.classList.add('!px-7')
|
33
|
+
element.nextElementSibling?.classList.replace('hidden', 'flex')
|
34
|
+
} else {
|
35
|
+
element.previousElementSibling?.classList.add('hidden')
|
36
|
+
element.previousElementSibling?.parentElement?.classList.remove('!px-7')
|
37
|
+
element.nextElementSibling?.classList.add('hidden')
|
38
|
+
}
|
39
|
+
})
|
40
|
+
}
|
41
|
+
onMounted(() => {
|
42
|
+
window.addEventListener('resize', () => setArrow())
|
43
|
+
setArrow()
|
44
|
+
})
|
45
|
+
|
46
|
+
const scrollNext = (event: Event) => {
|
47
|
+
const currentTarget = event.currentTarget as HTMLDivElement
|
48
|
+
const nextElement = currentTarget.nextElementSibling as HTMLDivElement
|
49
|
+
nextElement.scrollBy({
|
50
|
+
left: 80,
|
51
|
+
behavior: 'smooth',
|
52
|
+
})
|
53
|
+
}
|
54
|
+
const scrollPrevious = (event: Event) => {
|
55
|
+
const currentTarget = event.currentTarget as HTMLDivElement
|
56
|
+
const previousElement = currentTarget.previousElementSibling as HTMLDivElement
|
57
|
+
previousElement.scrollBy({
|
58
|
+
left: -80,
|
59
|
+
behavior: 'smooth',
|
60
|
+
})
|
61
|
+
}
|
27
62
|
</script>
|
28
63
|
|
29
64
|
<template>
|
30
|
-
<div class="glorious-tab">
|
65
|
+
<div class="glorious-tab relative">
|
31
66
|
<div
|
32
|
-
|
33
|
-
|
34
|
-
class="flex justify-center"
|
35
|
-
:style="{ flexBasis: `${100 / props.items.length}%` }"
|
67
|
+
@click="scrollNext($event)"
|
68
|
+
class="bg-green-700 absolute right-0 h-full top-0 w-8 justify-center items-center rounded-r-lg hidden cursor-auto"
|
36
69
|
>
|
37
|
-
<
|
38
|
-
|
39
|
-
|
70
|
+
<GIcon
|
71
|
+
name="glorious-arrow"
|
72
|
+
:size="15"
|
73
|
+
color="#fff"
|
74
|
+
/>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div class="flex overflow-auto px-3 py-2 gap-3 glorious-tab-content">
|
78
|
+
<div
|
79
|
+
v-for="(item, index) in props.items"
|
80
|
+
:key="index"
|
81
|
+
class="flex justify-center tab-item"
|
82
|
+
:style="{ flexBasis: `${100 / props.items.length}%` }"
|
40
83
|
>
|
41
|
-
|
42
|
-
|
84
|
+
<button
|
85
|
+
:class="item.active ? `active` : ''"
|
86
|
+
@click="tabClicked(item.key, $event)"
|
87
|
+
>
|
88
|
+
{{ item.text }}
|
89
|
+
</button>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div
|
94
|
+
@click="scrollPrevious($event)"
|
95
|
+
class="bg-green-700 absolute left-0 h-full top-0 w-8 justify-center items-center rounded-l-lg hidden cursor-pointer"
|
96
|
+
>
|
97
|
+
<GIcon
|
98
|
+
name="glorious-arrow"
|
99
|
+
class="rotate-180"
|
100
|
+
:size="15"
|
101
|
+
color="#fff"
|
102
|
+
/>
|
43
103
|
</div>
|
44
104
|
</div>
|
45
105
|
</template>
|
46
106
|
|
47
107
|
<style>
|
48
108
|
.glorious-tab {
|
49
|
-
@apply flex justify-between bg-green-100
|
109
|
+
@apply flex justify-between bg-green-100 rounded-lg gap-3 w-max max-w-full shadow-md;
|
50
110
|
}
|
51
|
-
.glorious-tab > div > button {
|
111
|
+
.glorious-tab div > div > button {
|
52
112
|
@apply text-gray-700 text-[14px] hover:bg-green-200 hover:text-gray-800 cursor-pointer px-2 py-1 rounded-lg;
|
53
113
|
}
|
54
|
-
.glorious-tab > div > button.active {
|
114
|
+
.glorious-tab div > div > button.active {
|
55
115
|
@apply font-bold text-white bg-green-700;
|
56
116
|
}
|
57
117
|
</style>
|
@@ -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>
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const props = defineProps({
|
3
|
+
items: {
|
4
|
+
required: true,
|
5
|
+
},
|
6
|
+
color: {
|
7
|
+
required: false,
|
8
|
+
default: 'green',
|
9
|
+
type: String as () => 'orange' | 'blue' | 'gray' | 'red' | 'green',
|
10
|
+
},
|
11
|
+
})
|
12
|
+
</script>
|
13
|
+
<template>
|
14
|
+
<div class="flex gap-3 mr-4">
|
15
|
+
<div
|
16
|
+
class="flex flex-col gap-5 glorious-timeline-items"
|
17
|
+
:class="[`color-${props.color}`]"
|
18
|
+
>
|
19
|
+
<div
|
20
|
+
v-for="(item, index) in props.items.reverse()"
|
21
|
+
:key="index"
|
22
|
+
>
|
23
|
+
<div class="glorious-timeline-items-count">
|
24
|
+
{{ props.items.length - index }}
|
25
|
+
</div>
|
26
|
+
<slot
|
27
|
+
name="item"
|
28
|
+
:item="item"
|
29
|
+
>
|
30
|
+
</slot>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</template>
|
35
|
+
|
36
|
+
<style scoped>
|
37
|
+
.glorious-timeline-items {
|
38
|
+
@apply relative;
|
39
|
+
}
|
40
|
+
.glorious-timeline-items div {
|
41
|
+
@apply relative;
|
42
|
+
}
|
43
|
+
.glorious-timeline-items div::before {
|
44
|
+
content: "";
|
45
|
+
@apply absolute w-[2px] right-[-15px];
|
46
|
+
}
|
47
|
+
.glorious-timeline-items div::before:not(:last-child) {
|
48
|
+
@apply h-[calc(100%+20px)];
|
49
|
+
}
|
50
|
+
.glorious-timeline-items-count {
|
51
|
+
@apply absolute w-5 h-5 top-0 right-[-24px] rounded-full !important;
|
52
|
+
@apply text-white flex justify-center items-center font-medium;
|
53
|
+
}
|
54
|
+
.glorious-timeline-items.color-orange > div::before {
|
55
|
+
@apply bg-orange-500;
|
56
|
+
}
|
57
|
+
.glorious-timeline-items.color-blue > div::before {
|
58
|
+
@apply bg-blue-500;
|
59
|
+
}
|
60
|
+
.glorious-timeline-items.color-gray > div::before {
|
61
|
+
@apply bg-gray-500;
|
62
|
+
}
|
63
|
+
.glorious-timeline-items.color-red > div::before {
|
64
|
+
@apply bg-red-500;
|
65
|
+
}
|
66
|
+
.glorious-timeline-items.color-green > div::before {
|
67
|
+
@apply bg-green-500;
|
68
|
+
}
|
69
|
+
.glorious-timeline-items.color-orange .glorious-timeline-items-count {
|
70
|
+
@apply bg-orange-500;
|
71
|
+
}
|
72
|
+
.glorious-timeline-items.color-blue .glorious-timeline-items-count {
|
73
|
+
@apply bg-blue-500;
|
74
|
+
}
|
75
|
+
.glorious-timeline-items.color-gray .glorious-timeline-items-count {
|
76
|
+
@apply bg-gray-500;
|
77
|
+
}
|
78
|
+
.glorious-timeline-items.color-red .glorious-timeline-items-count {
|
79
|
+
@apply bg-red-500;
|
80
|
+
}
|
81
|
+
.glorious-timeline-items.color-green .glorious-timeline-items-count {
|
82
|
+
@apply bg-green-500;
|
83
|
+
}
|
84
|
+
</style>
|
@@ -6,9 +6,10 @@ interface gloriousFetchOptions {
|
|
6
6
|
lazy?: Boolean;
|
7
7
|
headers?: Object;
|
8
8
|
body?: Object;
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
keepResponse?: Boolean;
|
10
|
+
bodyType?: 'formData' | 'formDataCustom' | 'normal';
|
11
|
+
method?: 'POST' | 'GET' | 'PATCH' | 'PUT' | 'DELETE' | 'HEAD';
|
12
|
+
credentials?: 'same-origin' | 'include';
|
12
13
|
watch?: Array<Object>;
|
13
14
|
}
|
14
15
|
export default function (url: string, options?: gloriousFetchOptions): Promise<unknown>;
|
@@ -6,6 +6,7 @@ const defaultOptions = {
|
|
6
6
|
method: "GET",
|
7
7
|
lazy: true,
|
8
8
|
is$: true,
|
9
|
+
keepResponse: false,
|
9
10
|
params: {},
|
10
11
|
headers: {
|
11
12
|
Accept: "application/json"
|
@@ -29,7 +30,8 @@ export default function(url, options = defaultOptions) {
|
|
29
30
|
} catch (e) {
|
30
31
|
}
|
31
32
|
},
|
32
|
-
onResponse() {
|
33
|
+
onResponse({ response }) {
|
34
|
+
gs.response[gKey] = response._data;
|
33
35
|
try {
|
34
36
|
gs.loading[gKey] = false;
|
35
37
|
gs.forms[gKey].errors = [];
|
@@ -53,6 +55,8 @@ export default function(url, options = defaultOptions) {
|
|
53
55
|
}
|
54
56
|
}
|
55
57
|
};
|
58
|
+
if (opt.keepResponse && !gs.keepResponse.includes(gKey))
|
59
|
+
gs.keepResponse.push(gKey);
|
56
60
|
if (opt.method === "GET" && typeof opt.body !== "undefined") {
|
57
61
|
opt.method = "POST";
|
58
62
|
return $fetch(url, opt);
|
@@ -83,7 +87,7 @@ function computeFormData(options) {
|
|
83
87
|
Object.entries(options.body).forEach((item) => {
|
84
88
|
console.log(item[1]);
|
85
89
|
if (item[1] === null) return;
|
86
|
-
if (typeof item[1] === "object" && typeof item[1].lastModifiedDate === "undefined" &&
|
90
|
+
if (typeof item[1] === "object" && typeof item[1].lastModifiedDate === "undefined" && typeof item[1].type === "undefined" && typeof item[1].size === "undefined")
|
87
91
|
Object.entries(item[1]).forEach((nestedItem, index) => {
|
88
92
|
form.append(`${item[0]}[${index}]`, nestedItem[1]);
|
89
93
|
});
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { defineNuxtRouteMiddleware } from "#imports";
|
2
|
+
import { GloriousStore } from "../stores/GloriousStore.mjs";
|
3
|
+
export default defineNuxtRouteMiddleware(() => {
|
4
|
+
const gs = GloriousStore();
|
5
|
+
Object.entries(gs.response).forEach((element) => {
|
6
|
+
if (!gs.keepResponse.includes(element[0])) delete gs.response[element[0]];
|
7
|
+
});
|
8
|
+
});
|
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",
|