nuxt-glorious 0.8.1-oteacher → 0.8.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.
- package/dist/module.json +1 -1
- package/dist/runtime/assets/style/components/buttons.css +1 -1
- package/dist/runtime/assets/style/components/drawer.css +1 -1
- package/dist/runtime/assets/style/components/dropdown.css +1 -1
- package/dist/runtime/assets/style/components/modal.css +1 -1
- package/dist/runtime/assets/style/components/paginate.css +1 -1
- package/dist/runtime/components/G/Button.vue +1 -1
- package/dist/runtime/components/G/Drawer.vue +1 -1
- package/dist/runtime/components/G/Dropdown.vue +1 -1
- package/dist/runtime/components/G/File.vue +5 -2
- package/dist/runtime/components/G/Input.vue +26 -2
- package/dist/runtime/components/G/Modal.vue +2 -2
- package/dist/runtime/components/G/Paginate.vue +56 -75
- package/dist/runtime/components/G/Select.vue +4 -6
- package/dist/runtime/components/G/textarea.vue +4 -1
- package/dist/runtime/composables/useGloriousCore.d.ts +3 -0
- package/dist/runtime/composables/useGloriousCore.mjs +16 -0
- package/dist/runtime/composables/useGloriousFetch.d.ts +2 -1
- package/dist/runtime/composables/useGloriousFetch.mjs +3 -5
- package/package.json +1 -1
package/dist/module.json
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
}
|
31
31
|
|
32
32
|
.outline.glorious-button-orange, .outline.glorious-button-blue, .outline.glorious-button-gray, .outline.glorious-button-red, .outline.glorious-button-primary {
|
33
|
-
@apply border outline-none;
|
33
|
+
@apply bg-transparent border outline-none;
|
34
34
|
}
|
35
35
|
|
36
36
|
.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 {
|
@@ -14,5 +14,5 @@
|
|
14
14
|
@apply absolute top-0 bottom-0 my-auto z-[20];
|
15
15
|
}
|
16
16
|
.glorious-dropdown.open > div:last-child {
|
17
|
-
@apply px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
|
17
|
+
@apply bg-white px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
|
18
18
|
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
}
|
4
4
|
|
5
5
|
.glorious-modal {
|
6
|
-
@apply fixed
|
6
|
+
@apply fixed bg-white md:top-[15%] z-50 right-0 left-0 mx-auto p-3 md:rounded-md rounded-t-md md:bottom-0 bottom-0 overflow-y-auto;
|
7
7
|
}
|
8
8
|
.glorious-modal.size-full {
|
9
9
|
@apply w-full h-full top-0 rounded-none;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.glorious-paginate > div {
|
2
|
-
@apply border border-gray-50 rounded-xl h-8 flex items-center px-1
|
2
|
+
@apply border border-gray-50 rounded-xl h-8 flex items-center px-1 bg-white shadow-md gap-1 w-max;
|
3
3
|
direction: rtl;
|
4
4
|
}
|
5
5
|
.glorious-paginate > div > div {
|
@@ -104,7 +104,7 @@ const props = defineProps({
|
|
104
104
|
}
|
105
105
|
|
106
106
|
.outline.glorious-button-orange, .outline.glorious-button-blue, .outline.glorious-button-gray, .outline.glorious-button-red, .outline.glorious-button-primary {
|
107
|
-
@apply border outline-none;
|
107
|
+
@apply bg-transparent border outline-none;
|
108
108
|
}
|
109
109
|
|
110
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 {
|
@@ -58,6 +58,6 @@ onMounted(() => {
|
|
58
58
|
@apply absolute top-0 bottom-0 my-auto z-[20];
|
59
59
|
}
|
60
60
|
.glorious-dropdown.open > div:last-child {
|
61
|
-
@apply px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
|
61
|
+
@apply bg-white px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
|
62
62
|
}
|
63
63
|
</style>
|
@@ -4,7 +4,7 @@ const props = defineProps({
|
|
4
4
|
modelValue: {
|
5
5
|
required: false,
|
6
6
|
default: "",
|
7
|
-
type: String,
|
7
|
+
type: [String, Object],
|
8
8
|
},
|
9
9
|
color: {
|
10
10
|
required: false,
|
@@ -67,7 +67,10 @@ const deleteFile = (event: any) => {
|
|
67
67
|
@click.prevent="deleteFile($event)"
|
68
68
|
/>
|
69
69
|
</label>
|
70
|
-
<span
|
70
|
+
<span
|
71
|
+
v-if="gs.forms[error[0]]?.errors[error[1]]"
|
72
|
+
class="text-red-500 text-[14px]"
|
73
|
+
>
|
71
74
|
{{ gs.forms[error[0]].errors[error[1]][0] }}
|
72
75
|
</span>
|
73
76
|
</div>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script setup lang="ts">
|
2
2
|
import { computed, ref, watch, GloriousStore } from "#imports";
|
3
|
+
import { useGloriousCore } from "../../composables/useGloriousCore";
|
3
4
|
const props = defineProps({
|
4
5
|
modelValue: {
|
5
6
|
required: false,
|
@@ -56,6 +57,11 @@ const props = defineProps({
|
|
56
57
|
default: "normal",
|
57
58
|
type: String,
|
58
59
|
},
|
60
|
+
display: {
|
61
|
+
required: false,
|
62
|
+
default: "",
|
63
|
+
type: String as () => "price",
|
64
|
+
},
|
59
65
|
});
|
60
66
|
|
61
67
|
const inputValue: any = ref(null);
|
@@ -66,7 +72,21 @@ watch(
|
|
66
72
|
() => inputValue.value,
|
67
73
|
() => {
|
68
74
|
if (props.mode === "tag") return;
|
69
|
-
|
75
|
+
|
76
|
+
switch (props.display) {
|
77
|
+
case "price":
|
78
|
+
inputValue.value = useGloriousCore.numbersWithSeperateSamePrice(
|
79
|
+
inputValue.value
|
80
|
+
);
|
81
|
+
emits(
|
82
|
+
"update:modelValue",
|
83
|
+
inputValue.value.toString().replaceAll(",", "")
|
84
|
+
);
|
85
|
+
break;
|
86
|
+
default:
|
87
|
+
emits("update:modelValue", inputValue.value);
|
88
|
+
break;
|
89
|
+
}
|
70
90
|
}
|
71
91
|
);
|
72
92
|
|
@@ -168,7 +188,11 @@ watch(
|
|
168
188
|
:color="$tailwindColor('gray', '500')"
|
169
189
|
/>
|
170
190
|
</div>
|
171
|
-
|
191
|
+
|
192
|
+
<span
|
193
|
+
v-if="gs.forms[error[0]]?.errors[error[1]]"
|
194
|
+
class="text-red-500 text-[14px]"
|
195
|
+
>
|
172
196
|
{{ gs.forms[error[0]].errors[error[1]][0] }}
|
173
197
|
</span>
|
174
198
|
</div>
|
@@ -28,7 +28,7 @@ const props = defineProps({
|
|
28
28
|
<div v-if="props?.title !== ''" class="flex justify-between items-center">
|
29
29
|
<span class="font-medium">{{ props.title }}</span>
|
30
30
|
<GButton
|
31
|
-
class="flex justify-center items-center w-
|
31
|
+
class="flex justify-center items-center w-6 h-6"
|
32
32
|
size="sm"
|
33
33
|
@click="$modal(`${props.id}`)"
|
34
34
|
>
|
@@ -48,7 +48,7 @@ const props = defineProps({
|
|
48
48
|
}
|
49
49
|
|
50
50
|
.glorious-modal {
|
51
|
-
@apply fixed
|
51
|
+
@apply fixed bg-white md:top-[15%] z-50 right-0 left-0 mx-auto p-3 md:rounded-md rounded-t-md md:bottom-0 bottom-0 overflow-y-auto;
|
52
52
|
}
|
53
53
|
.glorious-modal.size-full {
|
54
54
|
@apply w-full h-full top-0 rounded-none;
|
@@ -1,117 +1,98 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import {
|
2
|
+
import { watch } from "#imports";
|
3
3
|
const props = defineProps({
|
4
|
-
|
4
|
+
currentPage: {
|
5
5
|
required: true,
|
6
|
-
type:
|
6
|
+
type: Number,
|
7
|
+
default: 1,
|
8
|
+
},
|
9
|
+
lastPage: {
|
10
|
+
required: true,
|
11
|
+
type: Number,
|
12
|
+
default: 1,
|
13
|
+
},
|
14
|
+
numberSugestPage: {
|
15
|
+
required: false,
|
16
|
+
type: Number,
|
17
|
+
default: 3,
|
7
18
|
},
|
8
19
|
modelValue: {
|
9
20
|
required: true,
|
10
21
|
type: Number,
|
11
22
|
},
|
12
23
|
});
|
13
|
-
const el = reactive({
|
14
|
-
pageList: [],
|
15
|
-
});
|
16
24
|
|
17
25
|
const emits = defineEmits(["update:modelValue"]);
|
18
|
-
const methods = {
|
19
|
-
emit: (item: any) => {
|
20
|
-
if (props.data?.current_page !== item) emits("update:modelValue", item);
|
21
|
-
},
|
22
|
-
computePageList: () => {
|
23
|
-
let count: number = 0;
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
i--
|
29
|
-
) {
|
30
|
-
if (!el.pageList.includes(i)) el.pageList.push(i);
|
31
|
-
|
32
|
-
count++;
|
33
|
-
}
|
34
|
-
|
35
|
-
let page: number = props.data?.current_page;
|
36
|
-
while (count < 5 && page < props.data?.last_page) {
|
37
|
-
page++;
|
38
|
-
|
39
|
-
if (!el.pageList.includes(page)) el.pageList.push(page);
|
27
|
+
const emit = (item: any) => {
|
28
|
+
if (props.currentPage !== item) emits("update:modelValue", item);
|
29
|
+
};
|
40
30
|
|
41
|
-
|
42
|
-
}
|
31
|
+
const listPage = ref<Array<Number>>([]);
|
43
32
|
|
44
|
-
|
45
|
-
|
33
|
+
const computeListPage = () => {
|
34
|
+
listPage.value = [];
|
35
|
+
let firstPage = props.currentPage - props.numberSugestPage;
|
36
|
+
const endPage = props.currentPage + (props.numberSugestPage + 1);
|
46
37
|
|
47
|
-
|
48
|
-
|
38
|
+
while (firstPage < endPage) {
|
39
|
+
if (firstPage > 0 && firstPage <= props.lastPage)
|
40
|
+
listPage.value.push(firstPage);
|
41
|
+
firstPage++;
|
42
|
+
}
|
49
43
|
};
|
50
|
-
|
44
|
+
computeListPage();
|
51
45
|
watch(
|
52
|
-
() => props.
|
53
|
-
() =>
|
54
|
-
{ deep: true }
|
46
|
+
() => props.currentPage,
|
47
|
+
() => computeListPage()
|
55
48
|
);
|
49
|
+
|
50
|
+
const arrowPrevious = () => {
|
51
|
+
if (props.currentPage !== 1) emit(props.currentPage - 1);
|
52
|
+
};
|
53
|
+
const arrowNext = () => {
|
54
|
+
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1);
|
55
|
+
};
|
56
56
|
</script>
|
57
57
|
|
58
58
|
<template>
|
59
59
|
<div
|
60
|
-
v-if="props.
|
60
|
+
v-if="props.currentPage && props.lastPage !== 1"
|
61
61
|
class="w-max glorious-paginate"
|
62
62
|
>
|
63
63
|
<div>
|
64
|
-
<
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
/>
|
72
|
-
<GIcon
|
73
|
-
v-else
|
74
|
-
name="glorious-arrow"
|
75
|
-
:size="15"
|
76
|
-
class="ml-2"
|
77
|
-
color="#cbd5e1"
|
78
|
-
/>
|
79
|
-
</ClientOnly>
|
64
|
+
<GIcon
|
65
|
+
:color="props.currentPage !== 1 ? '#000' : '#cbd5e1'"
|
66
|
+
class="ml-2 cursor-pointer"
|
67
|
+
name="glorious-arrow"
|
68
|
+
:size="15"
|
69
|
+
@click="arrowPrevious()"
|
70
|
+
/>
|
80
71
|
|
81
72
|
<div
|
82
|
-
v-for="(item, index) in
|
73
|
+
v-for="(item, index) in listPage"
|
83
74
|
:key="index"
|
84
75
|
class="w-6 h-6 rounded-lg flex items-center justify-center paginate"
|
85
|
-
:class="[
|
86
|
-
|
87
|
-
]"
|
88
|
-
@click="methods.emit(item)"
|
76
|
+
:class="[props.currentPage === item ? 'active' : 'cursor-pointer']"
|
77
|
+
@click="emit(item)"
|
89
78
|
>
|
90
79
|
{{ item }}
|
91
80
|
</div>
|
92
81
|
|
93
|
-
<
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
/>
|
101
|
-
<GIcon
|
102
|
-
v-else
|
103
|
-
name="glorious-arrow"
|
104
|
-
color="#cbd5e1"
|
105
|
-
class="mr-2 cursor-pointer"
|
106
|
-
/>
|
107
|
-
</ClientOnly>
|
82
|
+
<GIcon
|
83
|
+
:color="props.currentPage !== props.lastPage ? '#000' : '#cbd5e1'"
|
84
|
+
name="glorious-arrow"
|
85
|
+
class="mr-2 cursor-pointer"
|
86
|
+
:size="15"
|
87
|
+
@click="arrowNext"
|
88
|
+
/>
|
108
89
|
</div>
|
109
90
|
</div>
|
110
91
|
</template>
|
111
92
|
|
112
93
|
<style>
|
113
94
|
.glorious-paginate > div {
|
114
|
-
@apply border border-gray-50 rounded-xl h-8 flex items-center px-1
|
95
|
+
@apply border border-gray-50 rounded-xl h-8 flex items-center px-1 bg-white shadow-md gap-1 w-max;
|
115
96
|
direction: rtl;
|
116
97
|
}
|
117
98
|
.glorious-paginate > div > div {
|
@@ -36,11 +36,6 @@ const props = defineProps({
|
|
36
36
|
default: false,
|
37
37
|
type: Boolean,
|
38
38
|
},
|
39
|
-
placeholder: {
|
40
|
-
required: false,
|
41
|
-
default: "",
|
42
|
-
type: String,
|
43
|
-
},
|
44
39
|
});
|
45
40
|
const selectValue = ref(null);
|
46
41
|
const emits = defineEmits(["update:modelValue"]);
|
@@ -81,7 +76,10 @@ watch(
|
|
81
76
|
{{ item.text }}
|
82
77
|
</option>
|
83
78
|
</select>
|
84
|
-
<span
|
79
|
+
<span
|
80
|
+
v-if="gs.forms[error[0]]?.errors[error[1]]"
|
81
|
+
class="text-red-500 text-[14px]"
|
82
|
+
>
|
85
83
|
{{ gs.forms[error[0]].errors[error[1]][0] }}
|
86
84
|
</span>
|
87
85
|
</div>
|
@@ -67,7 +67,10 @@ const error: any = props.error.split("|");
|
|
67
67
|
:disabled="props.disabled"
|
68
68
|
/>
|
69
69
|
</div>
|
70
|
-
<span
|
70
|
+
<span
|
71
|
+
v-if="gs.forms[error[0]]?.errors[error[1]]"
|
72
|
+
class="text-red-500 text-[14px]"
|
73
|
+
>
|
71
74
|
{{ gs.forms[error[0]].errors[error[1]][0] }}
|
72
75
|
</span>
|
73
76
|
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export const useGloriousCore = {
|
2
|
+
numbersWithSeperateSamePrice: (value) => {
|
3
|
+
let nStr = value.match(/\d+/g)?.join("") + "";
|
4
|
+
nStr = nStr.replace(/\,/g, "");
|
5
|
+
if (nStr === "undefined")
|
6
|
+
nStr = "";
|
7
|
+
const x = nStr.split(".");
|
8
|
+
let x1 = x[0];
|
9
|
+
const x2 = x.length > 1 ? "." + x[1] : "";
|
10
|
+
let rgx = /(\d+)(\d{3})/;
|
11
|
+
while (rgx.test(x1)) {
|
12
|
+
x1 = x1.replace(rgx, "$1,$2");
|
13
|
+
}
|
14
|
+
return x1 + x2;
|
15
|
+
}
|
16
|
+
};
|
@@ -6,9 +6,10 @@ interface gloriousFetchOptions {
|
|
6
6
|
lazy?: Boolean;
|
7
7
|
headers?: Object;
|
8
8
|
body?: Object;
|
9
|
-
bodyType
|
9
|
+
bodyType?: "formData" | "formDataCustom" | "normal";
|
10
10
|
method?: "POST" | "GET" | "PATCH" | "PUT" | "DELETE" | "HEAD";
|
11
11
|
credentials?: "same-origin" | "include";
|
12
|
+
watch?: Array<Object>;
|
12
13
|
}
|
13
14
|
export default function (url: string, options: gloriousFetchOptions): Promise<unknown>;
|
14
15
|
export {};
|
@@ -55,11 +55,8 @@ export default function(url, options) {
|
|
55
55
|
} catch (e) {
|
56
56
|
}
|
57
57
|
}
|
58
|
-
if (res.status === 401 && process.client)
|
59
|
-
|
60
|
-
if (typeof cookieToken.value !== "undefined")
|
61
|
-
gs.authLogout();
|
62
|
-
}
|
58
|
+
if (res.status === 401 && process.client)
|
59
|
+
gs.authLogout();
|
63
60
|
}
|
64
61
|
}
|
65
62
|
};
|
@@ -91,6 +88,7 @@ function computeAuth() {
|
|
91
88
|
return header;
|
92
89
|
}
|
93
90
|
function computeFormData(options) {
|
91
|
+
console.log(options.body);
|
94
92
|
const form = new FormData();
|
95
93
|
Object.entries(options.body).forEach((item) => {
|
96
94
|
if (item[1] === null)
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "0.8.
|
2
|
+
"version": "0.8.3",
|
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",
|