nuxt-glorious 1.2.0 → 1.2.9-5
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.d.mts +38 -1
- package/dist/module.d.ts +38 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +45 -36
- package/dist/runtime/assets/icons/glorious-eye-fill.svg +1 -1
- package/dist/runtime/assets/icons/glorious-eye-off-fill.svg +1 -1
- package/dist/runtime/assets/icons/glorious-star-fill.svg +3 -0
- package/dist/runtime/assets/icons/glorious-star-half.svg +3 -0
- package/dist/runtime/assets/icons/glorious-star-line.svg +3 -0
- package/dist/runtime/components/G/Alert.vue +16 -0
- package/dist/runtime/components/G/Avatar.vue +16 -0
- package/dist/runtime/components/G/Breadcrumb.vue +37 -0
- package/dist/runtime/components/G/Button.vue +13 -154
- package/dist/runtime/components/G/Checkbox.vue +26 -0
- package/dist/runtime/components/G/CountDown.vue +33 -43
- package/dist/runtime/components/G/Drawer.vue +16 -75
- package/dist/runtime/components/G/Dropdown.vue +17 -31
- package/dist/runtime/components/G/ErrorText.vue +7 -11
- package/dist/runtime/components/G/File.vue +25 -117
- package/dist/runtime/components/G/Icon.vue +125 -0
- package/dist/runtime/components/G/Input.vue +126 -250
- package/dist/runtime/components/G/Loading.vue +4 -21
- package/dist/runtime/components/G/Modal.vue +51 -138
- package/dist/runtime/components/G/Paginate.vue +24 -57
- package/dist/runtime/components/G/Radio.vue +18 -27
- package/dist/runtime/components/G/Rating.vue +30 -0
- package/dist/runtime/components/G/Select.vue +27 -112
- package/dist/runtime/components/G/Switch.vue +28 -0
- package/dist/runtime/components/G/Tab.vue +80 -44
- package/dist/runtime/components/G/Table.vue +62 -0
- package/dist/runtime/components/G/textarea.vue +17 -120
- package/dist/runtime/components/G/timeline.vue +28 -0
- package/dist/runtime/components/helper.d.ts +3 -0
- package/dist/runtime/components/helper.mjs +37 -0
- package/dist/runtime/components/props/Alert.d.ts +8 -0
- package/dist/runtime/components/props/Alert.mjs +4 -0
- package/dist/runtime/components/props/Avatar.d.ts +12 -0
- package/dist/runtime/components/props/Avatar.mjs +9 -0
- package/dist/runtime/components/props/Breadcrumb.d.ts +26 -0
- package/dist/runtime/components/props/Breadcrumb.mjs +11 -0
- package/dist/runtime/components/props/Button.d.ts +47 -0
- package/dist/runtime/components/props/Button.mjs +14 -0
- package/dist/runtime/components/props/CheckBox.d.ts +23 -0
- package/dist/runtime/components/props/CheckBox.mjs +7 -0
- package/dist/runtime/components/props/CountDown.d.ts +7 -0
- package/dist/runtime/components/props/CountDown.mjs +6 -0
- package/dist/runtime/components/props/Drawer.d.ts +8 -0
- package/dist/runtime/components/props/Drawer.mjs +7 -0
- package/dist/runtime/components/props/ErrorText.d.ts +8 -0
- package/dist/runtime/components/props/ErrorText.mjs +4 -0
- package/dist/runtime/components/props/File.d.ts +28 -0
- package/dist/runtime/components/props/File.mjs +9 -0
- package/dist/runtime/components/props/Icon.d.ts +23 -0
- package/dist/runtime/components/props/Icon.mjs +7 -0
- package/dist/runtime/components/props/Input.d.ts +91 -0
- package/dist/runtime/components/props/Input.mjs +50 -0
- package/dist/runtime/components/props/Loading.d.ts +18 -0
- package/dist/runtime/components/props/Loading.mjs +6 -0
- package/dist/runtime/components/props/Modal.d.ts +48 -0
- package/dist/runtime/components/props/Modal.mjs +38 -0
- package/dist/runtime/components/props/Paginate.d.ts +18 -0
- package/dist/runtime/components/props/Paginate.mjs +17 -0
- package/dist/runtime/components/props/Radio.d.ts +33 -0
- package/dist/runtime/components/props/Radio.mjs +9 -0
- package/dist/runtime/components/props/Select.d.ts +61 -0
- package/dist/runtime/components/props/Select.mjs +23 -0
- package/dist/runtime/components/props/Switch.d.ts +13 -0
- package/dist/runtime/components/props/Switch.mjs +5 -0
- package/dist/runtime/components/props/Tab.d.ts +21 -0
- package/dist/runtime/components/props/Tab.mjs +7 -0
- package/dist/runtime/components/props/Table.d.ts +49 -0
- package/dist/runtime/components/props/Table.mjs +19 -0
- package/dist/runtime/components/props/Textarea.d.ts +38 -0
- package/dist/runtime/components/props/Textarea.mjs +14 -0
- package/dist/runtime/components/props/Timeline.d.ts +11 -0
- package/dist/runtime/components/props/Timeline.mjs +7 -0
- package/dist/runtime/components/props/common/index.d.ts +161 -0
- package/dist/runtime/components/props/common/index.mjs +147 -0
- package/dist/runtime/composables/useGloriousCore.d.ts +1 -1
- package/dist/runtime/composables/useGloriousCore.mjs +1 -1
- package/dist/runtime/composables/useGloriousFetch.d.ts +4 -3
- package/dist/runtime/composables/useGloriousFetch.mjs +6 -5
- package/dist/runtime/middlewares/AuthStrategy.mjs +2 -6
- package/dist/runtime/middlewares/ResponseGloriousStore.mjs +9 -0
- package/dist/runtime/plugins/InputComponent.d.ts +2 -0
- package/dist/runtime/plugins/InputComponent.mjs +13 -0
- package/dist/runtime/plugins/module.d.ts +4 -0
- package/dist/runtime/plugins/module.mjs +94 -0
- package/dist/runtime/stores/GloriousStore.d.ts +0 -1
- package/dist/runtime/stores/GloriousStore.mjs +3 -13
- package/dist/runtime/style/components/alert.css +33 -0
- package/dist/runtime/style/components/alert.scss +7 -0
- package/dist/runtime/style/components/avatar.css +57 -0
- package/dist/runtime/style/components/avatar.scss +13 -0
- package/dist/runtime/style/components/breadcrumb.css +6 -0
- package/dist/runtime/style/components/breadcrumb.scss +6 -0
- package/dist/runtime/style/components/button.css +113 -0
- package/dist/runtime/style/components/button.scss +30 -0
- package/dist/runtime/style/components/checkbox.css +94 -0
- package/dist/runtime/style/components/checkbox.scss +52 -0
- package/dist/runtime/{assets/style → style}/components/drawer.css +14 -18
- package/dist/runtime/style/components/drawer.scss +57 -0
- package/dist/runtime/style/components/dropdown.scss +19 -0
- package/dist/runtime/style/components/editor.scss +4 -0
- package/dist/runtime/style/components/file.css +134 -0
- package/dist/runtime/style/components/file.scss +19 -0
- package/dist/runtime/style/components/input.css +187 -0
- package/dist/runtime/style/components/input.scss +87 -0
- package/dist/runtime/style/components/loading.css +43 -0
- package/dist/runtime/style/components/loading.scss +92 -0
- package/dist/runtime/style/components/modal.css +66 -0
- package/dist/runtime/style/components/modal.scss +76 -0
- package/dist/runtime/style/components/paginate.scss +18 -0
- package/dist/runtime/style/components/radio.css +121 -0
- package/dist/runtime/style/components/radio.scss +59 -0
- package/dist/runtime/style/components/rating.css +26 -0
- package/dist/runtime/style/components/rating.scss +25 -0
- package/dist/runtime/style/components/select.css +46 -0
- package/dist/runtime/style/components/select.scss +40 -0
- package/dist/runtime/style/components/switch.css +61 -0
- package/dist/runtime/style/components/switch.scss +74 -0
- package/dist/runtime/{assets/style → style}/components/tab.css +3 -3
- package/dist/runtime/style/components/tab.scss +11 -0
- package/dist/runtime/style/components/table.css +99 -0
- package/dist/runtime/style/components/table.scss +41 -0
- package/dist/runtime/style/components/textarea.css +64 -0
- package/dist/runtime/style/components/textarea.scss +43 -0
- package/dist/runtime/style/components/timeline.css +47 -0
- package/dist/runtime/style/components/timeline.scss +40 -0
- package/dist/runtime/style/mixin.css +0 -0
- package/dist/runtime/style/mixin.scss +40 -0
- package/dist/runtime/style/variable.css +0 -0
- package/dist/runtime/style/variable.scss +19 -0
- package/dist/types.d.mts +2 -10
- package/dist/types.d.ts +2 -10
- package/package.json +9 -7
- package/dist/runtime/assets/style/components/buttons.css +0 -107
- package/dist/runtime/assets/style/components/file.css +0 -65
- package/dist/runtime/assets/style/components/input.css +0 -91
- package/dist/runtime/assets/style/components/modal.css +0 -57
- package/dist/runtime/assets/style/components/select.css +0 -54
- package/dist/runtime/assets/style/components/textarea.css +0 -64
- package/dist/runtime/components/G/Breadcrump.vue +0 -46
- package/dist/runtime/components/G/Icon/index.vue +0 -143
- package/dist/runtime/plugins/Drawer.mjs +0 -35
- package/dist/runtime/utils/gTailwindColor.d.ts +0 -1
- package/dist/runtime/utils/gTailwindColor.mjs +0 -5
- /package/dist/runtime/{plugins/Drawer.d.ts → middlewares/ResponseGloriousStore.d.ts} +0 -0
- /package/dist/runtime/{assets/style → style}/components/dropdown.css +0 -0
- /package/dist/runtime/{assets/style → style}/components/editor.css +0 -0
- /package/dist/runtime/{assets/style → style}/components/paginate.css +0 -0
@@ -1,113 +1,84 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
required: true,
|
6
|
-
default: false,
|
7
|
-
type: Boolean,
|
8
|
-
},
|
9
|
-
size: {
|
10
|
-
required: false,
|
11
|
-
default: "md",
|
12
|
-
type: String as () => "xl" | "lg" | "md" | "sm" | "full",
|
13
|
-
},
|
14
|
-
title: {
|
15
|
-
required: false,
|
16
|
-
default: "",
|
17
|
-
type: String,
|
18
|
-
},
|
19
|
-
okBtn: {
|
20
|
-
required: false,
|
21
|
-
default: "",
|
22
|
-
type: String,
|
23
|
-
},
|
24
|
-
okBtnLoading: {
|
25
|
-
required: false,
|
26
|
-
default: false,
|
27
|
-
type: Boolean,
|
28
|
-
},
|
29
|
-
closeBtn: {
|
30
|
-
required: false,
|
31
|
-
default: "",
|
32
|
-
type: String,
|
33
|
-
},
|
34
|
-
rtl: {
|
35
|
-
required: false,
|
36
|
-
default: "rtl",
|
37
|
-
type: String as () => "rtl" | "ltr",
|
38
|
-
},
|
39
|
-
blur: {
|
40
|
-
required: false,
|
41
|
-
default: true,
|
42
|
-
type: Boolean,
|
43
|
-
},
|
44
|
-
blurClose: {
|
45
|
-
required: false,
|
46
|
-
default: true,
|
47
|
-
type: Boolean,
|
48
|
-
},
|
49
|
-
});
|
2
|
+
import { watch } from '#imports'
|
3
|
+
import { createBlurDom, removeBlurDom } from '../helper'
|
4
|
+
import _props from '../props/Modal'
|
50
5
|
|
51
|
-
const
|
52
|
-
|
53
|
-
const
|
54
|
-
const backgroundBlur = document.createElement("div");
|
55
|
-
backgroundBlur.classList.add("g-scafold-modal-bg-blur");
|
56
|
-
const nuxt: any = document.getElementById("__nuxt");
|
57
|
-
nuxt.appendChild(backgroundBlur);
|
58
|
-
backgroundBlur.addEventListener("click", () => {
|
59
|
-
if (props.blurClose) {
|
60
|
-
emits("update:modelValue", false);
|
61
|
-
backgroundBlur.remove();
|
62
|
-
}
|
63
|
-
});
|
64
|
-
};
|
6
|
+
const props = defineProps(_props)
|
7
|
+
const emits = defineEmits(['ok', 'close'])
|
8
|
+
const modelValue = defineModel()
|
65
9
|
|
66
10
|
watch(
|
67
|
-
() =>
|
11
|
+
() => modelValue.value,
|
68
12
|
() => {
|
69
|
-
|
70
|
-
|
13
|
+
const modals = document.querySelectorAll('.glorious-scaffold-modal')
|
14
|
+
if (modelValue.value && props.blur) {
|
15
|
+
createBlurDom(() => (modelValue.value = false))
|
16
|
+
setTimeout(() => {
|
17
|
+
modals.forEach((el: any) => {
|
18
|
+
el.classList.remove('animation')
|
19
|
+
})
|
20
|
+
}, 500)
|
71
21
|
} else {
|
72
|
-
|
73
|
-
|
22
|
+
modals.forEach((el: any) => {
|
23
|
+
el.classList.add('animation')
|
24
|
+
})
|
25
|
+
removeBlurDom()
|
74
26
|
}
|
75
27
|
}
|
76
|
-
)
|
28
|
+
)
|
77
29
|
</script>
|
78
30
|
|
79
31
|
<template>
|
80
32
|
<div
|
81
|
-
class="
|
82
|
-
:class="[
|
33
|
+
class="glorious-scaffold-modal animation"
|
34
|
+
:class="[modelValue ? 'open' : 'close', `size-${props.size}`]"
|
83
35
|
>
|
84
36
|
<!-- header -->
|
85
|
-
<div
|
37
|
+
<div
|
38
|
+
v-show="props?.title !== ''"
|
39
|
+
class="glorious-scaffold-modal-header"
|
40
|
+
>
|
86
41
|
<span class="font-medium">{{ props.title }}</span>
|
87
42
|
<GButton
|
88
43
|
class="flex justify-center items-center w-6 h-6"
|
89
44
|
size="sm"
|
90
45
|
color="red"
|
91
|
-
@click="
|
46
|
+
@click="modelValue = false"
|
92
47
|
>
|
93
|
-
<GIcon
|
48
|
+
<GIcon
|
49
|
+
name="glorious-x"
|
50
|
+
color="#fff"
|
51
|
+
:size="10"
|
52
|
+
/>
|
94
53
|
</GButton>
|
95
54
|
</div>
|
96
|
-
<hr
|
97
|
-
|
55
|
+
<hr
|
56
|
+
v-show="props.title !== ''"
|
57
|
+
class="my-3"
|
58
|
+
/>
|
59
|
+
<!-- end header -->
|
98
60
|
|
99
|
-
<div class="
|
61
|
+
<div class="glorious-scaffold-modal-content">
|
100
62
|
<slot />
|
101
63
|
</div>
|
102
64
|
|
103
65
|
<!-- start footer -->
|
104
|
-
<div
|
105
|
-
|
66
|
+
<div
|
67
|
+
v-show="props.okBtn !== ''"
|
68
|
+
class="glorious-scaffold-modal-footer"
|
69
|
+
>
|
70
|
+
<GButton
|
71
|
+
:color="props.colorBtn"
|
72
|
+
:loading="props.okBtnLoading"
|
73
|
+
@click="emits('ok')"
|
74
|
+
>
|
106
75
|
{{ props.okBtn }}
|
107
76
|
</GButton>
|
108
77
|
<GButton
|
78
|
+
:color="props.colorBtn"
|
109
79
|
v-show="props.closeBtn !== ''"
|
110
|
-
|
80
|
+
outline
|
81
|
+
@click="modelValue = false"
|
111
82
|
>
|
112
83
|
{{ props.closeBtn }}
|
113
84
|
</GButton>
|
@@ -116,62 +87,4 @@ watch(
|
|
116
87
|
</div>
|
117
88
|
</template>
|
118
89
|
|
119
|
-
<style
|
120
|
-
.g-scafold-modal {
|
121
|
-
@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;
|
122
|
-
}
|
123
|
-
.g-scafold-modal-header {
|
124
|
-
@apply flex justify-between items-center;
|
125
|
-
}
|
126
|
-
.g-scafold-modal-footer {
|
127
|
-
@apply flex justify-center gap-3;
|
128
|
-
}
|
129
|
-
.g-scafold-modal-footer > button {
|
130
|
-
@apply min-w-24;
|
131
|
-
}
|
132
|
-
.g-scafold-modal-bg-blur {
|
133
|
-
@apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
|
134
|
-
}
|
135
|
-
.g-scafold-modal.size-full {
|
136
|
-
@apply w-full h-full top-0 rounded-none;
|
137
|
-
}
|
138
|
-
.g-scafold-modal.size-xl {
|
139
|
-
@apply md:w-[70%] w-full md:h-max max-h-[70%];
|
140
|
-
}
|
141
|
-
.g-scafold-modal.size-lg {
|
142
|
-
@apply md:w-[60%] w-full md:h-max max-h-[70%];
|
143
|
-
}
|
144
|
-
.g-scafold-modal.size-md {
|
145
|
-
@apply md:w-[50%] w-full md:h-max max-h-[70%];
|
146
|
-
}
|
147
|
-
.g-scafold-modal.size-sm {
|
148
|
-
@apply lg:w-[25%] md:w-[35%] w-full md:h-max max-h-[70%];
|
149
|
-
}
|
150
|
-
.g-scafold-modal.close {
|
151
|
-
@apply hidden;
|
152
|
-
}
|
153
|
-
@screen md {
|
154
|
-
.g-scafold-modal.open {
|
155
|
-
animation: animationOpacity 0.2s normal forwards;
|
156
|
-
}
|
157
|
-
}
|
158
|
-
.g-scafold-modal.open {
|
159
|
-
animation: animationMobile 0.3s normal forwards;
|
160
|
-
}
|
161
|
-
@keyframes animationOpacity {
|
162
|
-
from {
|
163
|
-
opacity: 0;
|
164
|
-
}
|
165
|
-
to {
|
166
|
-
opacity: 1;
|
167
|
-
}
|
168
|
-
}
|
169
|
-
@keyframes animationMobile {
|
170
|
-
from {
|
171
|
-
transform: translateY(100%);
|
172
|
-
}
|
173
|
-
to {
|
174
|
-
transform: translateY(0);
|
175
|
-
}
|
176
|
-
}
|
177
|
-
</style>
|
90
|
+
<style lang="scss" src="../../style/components/modal.scss" />
|
@@ -1,58 +1,43 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { watch, ref } from
|
3
|
-
|
4
|
-
currentPage: {
|
5
|
-
required: true,
|
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,
|
18
|
-
},
|
19
|
-
modelValue: {
|
20
|
-
required: true,
|
21
|
-
type: Number,
|
22
|
-
},
|
23
|
-
});
|
2
|
+
import { watch, ref } from '#imports'
|
3
|
+
import _props from '../props/Paginate'
|
24
4
|
|
25
|
-
const
|
5
|
+
const props = defineProps(_props)
|
6
|
+
const modelValue = defineModel()
|
7
|
+
const emits = defineEmits(['change'])
|
26
8
|
|
27
9
|
const emit = (item: any) => {
|
28
|
-
if (props.currentPage !== item)
|
29
|
-
|
10
|
+
if (props.currentPage !== item) {
|
11
|
+
modelValue.value = item
|
12
|
+
emits('change', { page: item })
|
13
|
+
}
|
14
|
+
}
|
30
15
|
|
31
|
-
const listPage = ref<Array<Number>>([])
|
16
|
+
const listPage = ref<Array<Number>>([])
|
32
17
|
|
33
18
|
const computeListPage = () => {
|
34
|
-
listPage.value = []
|
35
|
-
let firstPage = props.currentPage - props.
|
36
|
-
const endPage = props.currentPage + (props.
|
19
|
+
listPage.value = []
|
20
|
+
let firstPage = props.currentPage - props.numberSuggestPage
|
21
|
+
const endPage = props.currentPage + (props.numberSuggestPage + 1)
|
37
22
|
|
38
23
|
while (firstPage <= endPage) {
|
39
24
|
if (firstPage > 0 && firstPage <= props.lastPage)
|
40
|
-
listPage.value.push(firstPage)
|
41
|
-
firstPage
|
25
|
+
listPage.value.push(firstPage)
|
26
|
+
firstPage++
|
42
27
|
}
|
43
|
-
}
|
44
|
-
computeListPage()
|
28
|
+
}
|
29
|
+
computeListPage()
|
45
30
|
watch(
|
46
31
|
() => props.currentPage,
|
47
32
|
() => computeListPage()
|
48
|
-
)
|
33
|
+
)
|
49
34
|
|
50
35
|
const arrowPrevious = () => {
|
51
|
-
if (props.currentPage !== 1) emit(props.currentPage - 1)
|
52
|
-
}
|
36
|
+
if (props.currentPage !== 1) emit(props.currentPage - 1)
|
37
|
+
}
|
53
38
|
const arrowNext = () => {
|
54
|
-
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
|
55
|
-
}
|
39
|
+
if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
|
40
|
+
}
|
56
41
|
</script>
|
57
42
|
|
58
43
|
<template>
|
@@ -90,22 +75,4 @@ const arrowNext = () => {
|
|
90
75
|
</div>
|
91
76
|
</template>
|
92
77
|
|
93
|
-
<style
|
94
|
-
.glorious-paginate > div {
|
95
|
-
@apply border border-gray-50 rounded-xl h-8 flex items-center px-1 bg-white shadow-md gap-1 w-max;
|
96
|
-
direction: rtl;
|
97
|
-
}
|
98
|
-
.glorious-paginate > div > div {
|
99
|
-
@apply px-2;
|
100
|
-
}
|
101
|
-
.glorious-paginate > div > div:last-child {
|
102
|
-
@apply rotate-[180deg];
|
103
|
-
}
|
104
|
-
|
105
|
-
.paginate {
|
106
|
-
@apply text-[13px];
|
107
|
-
}
|
108
|
-
.paginate.active {
|
109
|
-
@apply bg-green-500 rounded-lg text-white font-bold text-[13px];
|
110
|
-
}
|
111
|
-
</style>
|
78
|
+
<style lang="scss" src="../../style/components/paginate.scss" />
|
@@ -1,38 +1,29 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
default: "radio",
|
6
|
-
type: String,
|
7
|
-
},
|
8
|
-
value: {
|
9
|
-
required: false,
|
10
|
-
default: "radio",
|
11
|
-
type: [String, Number, null],
|
12
|
-
},
|
13
|
-
modelValue: {
|
14
|
-
required: false,
|
15
|
-
default: "",
|
16
|
-
type: [String, Number, null],
|
17
|
-
},
|
18
|
-
checked: {
|
19
|
-
required: false,
|
20
|
-
default: false,
|
21
|
-
type: Boolean,
|
22
|
-
},
|
23
|
-
});
|
2
|
+
import _props from '../props/Radio'
|
3
|
+
const props = defineProps(_props)
|
4
|
+
const modelValue = defineModel()
|
24
5
|
|
25
|
-
const
|
6
|
+
const inputFunction = (event: Event) => {
|
7
|
+
const target = event.currentTarget as HTMLInputElement
|
8
|
+
modelValue.value = target.value
|
9
|
+
}
|
26
10
|
</script>
|
27
11
|
|
28
12
|
<template>
|
29
|
-
<
|
13
|
+
<label
|
14
|
+
class="glorious-radio"
|
15
|
+
:class="[props.color, `size-${props.size}`]"
|
16
|
+
>
|
30
17
|
<input
|
31
|
-
type="radio"
|
32
18
|
:name="props.name"
|
19
|
+
type="radio"
|
20
|
+
:disabled="props.disabled"
|
33
21
|
:value="props.value"
|
34
|
-
@click="emits('update:modelValue', props.value)"
|
35
22
|
:checked="props.checked"
|
23
|
+
@input="inputFunction($event)"
|
36
24
|
/>
|
37
|
-
|
25
|
+
<div></div>
|
26
|
+
</label>
|
38
27
|
</template>
|
28
|
+
|
29
|
+
<style lang="scss" src="../../style/components/radio.scss" />
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
const modelValue = defineModel()
|
3
|
+
const computeModelValue = (event: Event) => {
|
4
|
+
const target = event.target as HTMLInputElement
|
5
|
+
modelValue.value = target.value
|
6
|
+
}
|
7
|
+
|
8
|
+
const id = useId()
|
9
|
+
const value = [5, 4, 3, 2, 1]
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<template>
|
13
|
+
<div class="rating">
|
14
|
+
<template
|
15
|
+
v-for="(item, index) in 5"
|
16
|
+
:key="index"
|
17
|
+
>
|
18
|
+
<input
|
19
|
+
type="radio"
|
20
|
+
:id="`star${item}-${id}`"
|
21
|
+
:name="`star-name${id}`"
|
22
|
+
:value="value[index]"
|
23
|
+
@input="computeModelValue"
|
24
|
+
/>
|
25
|
+
<label :for="`star${item}-${id}`"></label>
|
26
|
+
</template>
|
27
|
+
</div>
|
28
|
+
</template>
|
29
|
+
|
30
|
+
<style scoped lang="scss" src="../../style/components/rating.scss" />
|
@@ -1,88 +1,58 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { ref, watch } from
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
},
|
9
|
-
options: {
|
10
|
-
required: true,
|
11
|
-
default: [],
|
12
|
-
type: Array<object>,
|
13
|
-
},
|
14
|
-
color: {
|
15
|
-
required: false,
|
16
|
-
default: "primary",
|
17
|
-
type: String,
|
18
|
-
},
|
19
|
-
size: {
|
20
|
-
required: false,
|
21
|
-
default: "md",
|
22
|
-
type: String,
|
23
|
-
},
|
24
|
-
title: {
|
25
|
-
required: false,
|
26
|
-
default: "",
|
27
|
-
type: String,
|
28
|
-
},
|
29
|
-
error: {
|
30
|
-
required: false,
|
31
|
-
default: "|",
|
32
|
-
type: String,
|
33
|
-
},
|
34
|
-
disabled: {
|
35
|
-
required: false,
|
36
|
-
default: false,
|
37
|
-
type: Boolean,
|
38
|
-
},
|
39
|
-
placeholder: {
|
40
|
-
require: false,
|
41
|
-
default: "",
|
42
|
-
type: String,
|
43
|
-
},
|
44
|
-
});
|
45
|
-
const selectValue = ref(null);
|
46
|
-
const emits = defineEmits(["update:modelValue"]);
|
2
|
+
import { ref, watch } from '#imports'
|
3
|
+
import _props from '../props/Select'
|
4
|
+
|
5
|
+
const props: any = defineProps(_props)
|
6
|
+
const modelValue = defineModel()
|
7
|
+
const selectValue: any = ref(null)
|
47
8
|
watch(
|
48
9
|
() => selectValue.value,
|
49
10
|
() => {
|
50
|
-
|
11
|
+
modelValue.value = selectValue.value
|
51
12
|
}
|
52
|
-
)
|
13
|
+
)
|
53
14
|
|
54
15
|
// -------------------------------------- init value
|
55
|
-
selectValue.value = props.modelValue
|
16
|
+
selectValue.value = props.modelValue
|
56
17
|
watch(
|
57
18
|
() => props.modelValue,
|
58
19
|
() => {
|
59
|
-
selectValue.value = props.modelValue
|
20
|
+
selectValue.value = props.modelValue
|
60
21
|
}
|
61
|
-
)
|
22
|
+
)
|
23
|
+
|
24
|
+
modelValue.value = null
|
25
|
+
selectValue.value = null
|
62
26
|
</script>
|
63
27
|
|
64
28
|
<template>
|
65
29
|
<div class="flex flex-col">
|
66
|
-
<span class="text-
|
30
|
+
<span class="glorious-title text-sm font-medium text-gray-500">
|
31
|
+
{{ props.title }}
|
32
|
+
</span>
|
67
33
|
<div class="grow flex relative">
|
68
34
|
<select
|
69
35
|
v-model="selectValue"
|
70
36
|
aria-label="glorious select"
|
71
37
|
:disabled="props.disabled"
|
72
|
-
class="grow"
|
73
|
-
:class="[`
|
38
|
+
class="grow glorious-select"
|
39
|
+
:class="[`color-${props.color}`, props.size]"
|
74
40
|
>
|
75
41
|
<option
|
76
42
|
v-for="(item, index) in props.options"
|
77
43
|
:key="index"
|
78
44
|
:value="item.value"
|
79
45
|
>
|
80
|
-
{{ item.
|
46
|
+
{{ item[props.displayTextKey] }}
|
81
47
|
</option>
|
82
48
|
</select>
|
83
49
|
<span
|
84
|
-
v-if="
|
85
|
-
|
50
|
+
v-if="
|
51
|
+
selectValue === null ||
|
52
|
+
selectValue === '' ||
|
53
|
+
typeof selectValue === 'undefined'
|
54
|
+
"
|
55
|
+
class="absolute top-0 bottom-0 my-auto px-3 h-max text-gray-500"
|
86
56
|
>
|
87
57
|
{{ props.placeholder }}
|
88
58
|
</span>
|
@@ -91,59 +61,4 @@ watch(
|
|
91
61
|
</div>
|
92
62
|
</template>
|
93
63
|
|
94
|
-
<style
|
95
|
-
.xl.glorious-select-orange, .xl.glorious-select-blue, .xl.glorious-select-gray, .xl.glorious-select-red, .xl.glorious-select-primary {
|
96
|
-
@apply py-[0.657rem];
|
97
|
-
}
|
98
|
-
.lg.glorious-select-orange, .lg.glorious-select-blue, .lg.glorious-select-gray, .lg.glorious-select-red, .lg.glorious-select-primary {
|
99
|
-
@apply py-[0.532rem];
|
100
|
-
}
|
101
|
-
.md.glorious-select-orange, .md.glorious-select-blue, .md.glorious-select-gray, .md.glorious-select-red, .md.glorious-select-primary {
|
102
|
-
@apply py-[0.407rem];
|
103
|
-
}
|
104
|
-
.sm.glorious-select-orange, .sm.glorious-select-blue, .sm.glorious-select-gray, .sm.glorious-select-red, .sm.glorious-select-primary {
|
105
|
-
@apply py-[0.282rem];
|
106
|
-
}
|
107
|
-
.xsm.glorious-select-orange, .xsm.glorious-select-blue, .xsm.glorious-select-gray, .xsm.glorious-select-red, .xsm.glorious-select-primary {
|
108
|
-
@apply py-[0.157rem];
|
109
|
-
}
|
110
|
-
|
111
|
-
.glorious-select-orange:focus-visible, .glorious-select-blue:focus-visible, .glorious-select-gray:focus-visible, .glorious-select-red:focus-visible, .glorious-select-primary:focus-visible {
|
112
|
-
@apply outline-none ring-2;
|
113
|
-
}
|
114
|
-
|
115
|
-
.glorious-select-primary {
|
116
|
-
@apply rounded-md ring-1 ring-green-500 px-3 text-gray-500 text-[14px];
|
117
|
-
}
|
118
|
-
.glorious-select-primary:disabled {
|
119
|
-
@apply cursor-not-allowed;
|
120
|
-
}
|
121
|
-
|
122
|
-
.glorious-select-red {
|
123
|
-
@apply rounded-md ring-1 ring-red-500 px-3;
|
124
|
-
}
|
125
|
-
.glorious-select-red:disabled {
|
126
|
-
@apply cursor-not-allowed;
|
127
|
-
}
|
128
|
-
|
129
|
-
.glorious-select-gray {
|
130
|
-
@apply rounded-md ring-1 ring-gray-500 px-3;
|
131
|
-
}
|
132
|
-
.glorious-select-gray:disabled {
|
133
|
-
@apply cursor-not-allowed;
|
134
|
-
}
|
135
|
-
|
136
|
-
.glorious-select-blue {
|
137
|
-
@apply rounded-md ring-1 ring-blue-500 px-3;
|
138
|
-
}
|
139
|
-
.glorious-select-blue:disabled {
|
140
|
-
@apply cursor-not-allowed;
|
141
|
-
}
|
142
|
-
|
143
|
-
.glorious-select-orange {
|
144
|
-
@apply rounded-md ring-1 ring-orange-500 px-3;
|
145
|
-
}
|
146
|
-
.glorious-select-orange:disabled {
|
147
|
-
@apply cursor-not-allowed;
|
148
|
-
}
|
149
|
-
</style>
|
64
|
+
<style lang="scss" src="../../style/components/select.scss" />
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import _props from '../props/Switch'
|
3
|
+
|
4
|
+
const props = defineProps(_props)
|
5
|
+
const modelValue = defineModel()
|
6
|
+
const input = (e: Event) => {
|
7
|
+
const target = e.target as HTMLInputElement
|
8
|
+
modelValue.value = target.checked
|
9
|
+
}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<template>
|
13
|
+
<div>
|
14
|
+
<label
|
15
|
+
class="switch"
|
16
|
+
:class="[`color-${props.color}`]"
|
17
|
+
>
|
18
|
+
<input
|
19
|
+
type="checkbox"
|
20
|
+
@input="input"
|
21
|
+
:checked="props.checked"
|
22
|
+
/>
|
23
|
+
<span class="switch-slider"></span>
|
24
|
+
</label>
|
25
|
+
</div>
|
26
|
+
</template>
|
27
|
+
|
28
|
+
<style lang="scss" src="../../style/components/switch.scss" />
|