nuxt-glorious 1.3.3 → 1.9.0
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/module.mjs +5 -23
- package/dist/runtime/components/G/Alert.vue +2 -3
- package/dist/runtime/components/G/Avatar.vue +9 -4
- package/dist/runtime/components/G/Breadcrumb.vue +4 -3
- package/dist/runtime/components/G/Button.vue +10 -11
- package/dist/runtime/components/G/Checkbox.vue +7 -5
- package/dist/runtime/components/G/Drawer.vue +6 -3
- package/dist/runtime/components/G/File.vue +11 -8
- package/dist/runtime/components/G/Icon.vue +37 -70
- package/dist/runtime/components/G/Input.vue +43 -25
- package/dist/runtime/components/G/Loading.vue +8 -4
- package/dist/runtime/components/G/Modal.vue +16 -7
- package/dist/runtime/components/G/Paginate.vue +41 -13
- package/dist/runtime/components/G/Radio.vue +8 -5
- package/dist/runtime/components/G/Rating.vue +0 -2
- package/dist/runtime/components/G/Select.vue +9 -9
- package/dist/runtime/components/G/Switch.vue +0 -2
- package/dist/runtime/components/G/Tab.vue +1 -2
- package/dist/runtime/components/G/Table.vue +0 -2
- package/dist/runtime/components/G/Tooltip.vue +17 -0
- package/dist/runtime/components/G/Wizard.vue +71 -25
- package/dist/runtime/components/G/textarea.vue +10 -9
- package/dist/runtime/components/G/timeline.vue +0 -2
- package/dist/runtime/components/helper.d.ts +1 -0
- package/dist/runtime/components/helper.mjs +13 -2
- package/dist/runtime/components/props/Alert.d.ts +1 -1
- package/dist/runtime/components/props/Avatar.d.ts +9 -0
- package/dist/runtime/components/props/Avatar.mjs +4 -6
- package/dist/runtime/components/props/Button.d.ts +1 -1
- package/dist/runtime/components/props/CheckBox.d.ts +1 -1
- package/dist/runtime/components/props/File.d.ts +1 -1
- package/dist/runtime/components/props/Icon.d.ts +4 -0
- package/dist/runtime/components/props/Icon.mjs +5 -1
- package/dist/runtime/components/props/Input.d.ts +1 -1
- package/dist/runtime/components/props/Loading.d.ts +1 -1
- package/dist/runtime/components/props/Modal.d.ts +1 -1
- package/dist/runtime/components/props/Paginate.d.ts +5 -0
- package/dist/runtime/components/props/Paginate.mjs +2 -0
- package/dist/runtime/components/props/Radio.d.ts +1 -1
- package/dist/runtime/components/props/Select.d.ts +1 -1
- package/dist/runtime/components/props/Switch.d.ts +1 -1
- package/dist/runtime/components/props/Table.d.ts +1 -1
- package/dist/runtime/components/props/Textarea.d.ts +1 -6
- package/dist/runtime/components/props/Textarea.mjs +0 -2
- package/dist/runtime/components/props/Timeline.d.ts +1 -1
- package/dist/runtime/components/props/common/index.d.ts +14 -2
- package/dist/runtime/components/props/common/index.mjs +13 -1
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeAuth.d.ts +2 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeAuth.mjs +8 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeFormData.d.ts +3 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeFormData.mjs +14 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeGKey.d.ts +2 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeGKey.mjs +3 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeHeaderFetch.d.ts +2 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeHeaderFetch.mjs +9 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeParams.d.ts +2 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeParams.mjs +7 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeValidation.d.ts +2 -0
- package/dist/runtime/composables/helper/useGloriousFetch/functionComputeValidation.mjs +30 -0
- package/dist/runtime/composables/helper/useGloriousFetch/gloriousFetchDefaultOptions.d.ts +3 -0
- package/dist/runtime/composables/helper/useGloriousFetch/gloriousFetchDefaultOptions.mjs +15 -0
- package/dist/runtime/composables/helper/useGloriousFetch/gloriousFetchOptionsInterface.d.ts +15 -0
- package/dist/runtime/composables/useGloriousCore.d.ts +0 -1
- package/dist/runtime/composables/useGloriousCore.mjs +1 -3
- package/dist/runtime/composables/useGloriousFetch.d.ts +1 -15
- package/dist/runtime/composables/useGloriousFetch.mjs +11 -57
- package/dist/runtime/composables/useGloriousHead.mjs +1 -1
- package/dist/runtime/middlewares/AuthStrategy.mjs +1 -9
- package/dist/runtime/plugins/InputComponent.mjs +0 -2
- package/dist/runtime/style/components/drawer.css +4 -35
- package/dist/runtime/style/components/dropdown.css +17 -15
- package/dist/{runtime/style/components → scss}/alert.scss +7 -7
- package/dist/scss/avatar.scss +13 -0
- package/dist/scss/breadcrumb.scss +6 -0
- package/dist/{runtime/style/components → scss}/button.scss +30 -30
- package/dist/{runtime/style/components → scss}/checkbox.scss +1 -1
- package/dist/scss/drawer.scss +64 -0
- package/dist/{runtime/style/components → scss}/file.scss +2 -2
- package/dist/scss/glorious.scss +22 -0
- package/dist/{runtime/style/components → scss}/input.scss +9 -3
- package/dist/{runtime/style → scss}/mixin.scss +1 -1
- package/dist/scss/modal.scss +76 -0
- package/dist/scss/paginate.scss +28 -0
- package/dist/{runtime/style/components → scss}/radio.scss +1 -1
- package/dist/{runtime/style/components → scss}/select.scss +2 -2
- package/dist/{runtime/style/components → scss}/switch.scss +1 -1
- package/dist/{runtime/style/components → scss}/tab.scss +1 -1
- package/dist/{runtime/style/components → scss}/table.scss +1 -1
- package/dist/{runtime/style/components → scss}/textarea.scss +2 -2
- package/dist/{runtime/style/components → scss}/timeline.scss +2 -2
- package/dist/scss/tooltip.scss +14 -0
- package/package.json +9 -7
- package/dist/runtime/style/components/alert.css +0 -33
- package/dist/runtime/style/components/avatar.css +0 -57
- package/dist/runtime/style/components/avatar.scss +0 -13
- package/dist/runtime/style/components/breadcrumb.css +0 -6
- package/dist/runtime/style/components/breadcrumb.scss +0 -6
- package/dist/runtime/style/components/drawer.scss +0 -57
- package/dist/runtime/style/components/dropdown.scss +0 -19
- package/dist/runtime/style/components/editor.scss +0 -4
- package/dist/runtime/style/components/input.css +0 -184
- package/dist/runtime/style/components/loading.css +0 -43
- package/dist/runtime/style/components/modal.css +0 -66
- package/dist/runtime/style/components/modal.scss +0 -76
- package/dist/runtime/style/components/paginate.css +0 -17
- package/dist/runtime/style/components/paginate.scss +0 -18
- package/dist/runtime/style/components/radio.css +0 -121
- package/dist/runtime/style/components/rating.css +0 -30
- package/dist/runtime/style/components/select.css +0 -49
- package/dist/runtime/style/components/switch.css +0 -61
- package/dist/runtime/style/components/table.css +0 -99
- package/dist/runtime/style/components/textarea.css +0 -67
- /package/dist/{runtime/style/components → scss}/loading.scss +0 -0
- /package/dist/{runtime/style/components → scss}/rating.scss +0 -0
- /package/dist/{runtime/style → scss}/variable.scss +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineNuxtModule, createResolver, installModule, addImportsDir, addComponentsDir, addPlugin, addRouteMiddleware } from '@nuxt/kit';
|
1
|
+
import { defineNuxtModule, createResolver, installModule, addImportsDir, addComponentsDir, addVitePlugin, addPlugin, addRouteMiddleware } from '@nuxt/kit';
|
2
2
|
import defu from 'defu';
|
3
3
|
|
4
4
|
const defaultModuleOption = {
|
@@ -23,13 +23,6 @@ const defaultModuleOption = {
|
|
23
23
|
strategy: {
|
24
24
|
provider: ""
|
25
25
|
}
|
26
|
-
},
|
27
|
-
components: {
|
28
|
-
alert: {
|
29
|
-
props: {
|
30
|
-
color: "green"
|
31
|
-
}
|
32
|
-
}
|
33
26
|
}
|
34
27
|
};
|
35
28
|
|
@@ -46,35 +39,24 @@ const module = defineNuxtModule({
|
|
46
39
|
nuxt.options.glorious,
|
47
40
|
defaultModuleOption
|
48
41
|
);
|
49
|
-
await installModule("@nuxtjs/tailwindcss", {
|
50
|
-
// module configuration
|
51
|
-
exposeConfig: true,
|
52
|
-
config: {
|
53
|
-
darkMode: "class",
|
54
|
-
content: {
|
55
|
-
files: [
|
56
|
-
resolver.resolve("./runtime/components/**/*.{vue,mjs,ts}"),
|
57
|
-
resolver.resolve("./runtime/*.{mjs,js,ts}")
|
58
|
-
]
|
59
|
-
}
|
60
|
-
}
|
61
|
-
});
|
62
42
|
await installModule("@pinia/nuxt");
|
63
43
|
await installModule("@nuxt/image");
|
64
44
|
addImportsDir(resolver.resolve("runtime/composables"));
|
65
45
|
addImportsDir(resolver.resolve("runtime/stores"));
|
66
|
-
addImportsDir(resolver.resolve("runtime/middlewares"));
|
67
46
|
addComponentsDir({
|
68
47
|
path: resolver.resolve("runtime/components"),
|
69
48
|
global: true,
|
70
49
|
watch: false
|
71
50
|
});
|
51
|
+
if (nuxt.options.builder === "@nuxt/vite-builder") {
|
52
|
+
const plugin = await import('@tailwindcss/vite').then((r) => r.default);
|
53
|
+
addVitePlugin(plugin());
|
54
|
+
}
|
72
55
|
nuxt.hook("nitro:config", async (nitro) => {
|
73
56
|
nitro.publicAssets.push({
|
74
57
|
dir: resolver.resolve("./runtime/assets")
|
75
58
|
});
|
76
59
|
});
|
77
|
-
addPlugin(resolver.resolve("./runtime/plugins/glorious-app-setting"));
|
78
60
|
addPlugin(resolver.resolve("./runtime/plugins/InputComponent"));
|
79
61
|
addRouteMiddleware({
|
80
62
|
name: "g-auth-strategy",
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import _props from './../props/Alert'
|
3
|
+
import { getAttribute } from '../helper'
|
3
4
|
|
4
5
|
const props = defineProps(_props)
|
5
6
|
</script>
|
@@ -7,10 +8,8 @@ const props = defineProps(_props)
|
|
7
8
|
<template>
|
8
9
|
<div
|
9
10
|
class="glorious-alert"
|
10
|
-
:class="[`color-${props.color}`]"
|
11
|
+
:class="[`color-${getAttribute(props.color, 'alert', 'color')}`]"
|
11
12
|
>
|
12
13
|
<slot />
|
13
14
|
</div>
|
14
15
|
</template>
|
15
|
-
|
16
|
-
<style lang="scss" src="../../style/components/alert.scss" />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import _props from '../props/Avatar'
|
3
|
+
import { getAttribute } from '../helper'
|
3
4
|
|
4
5
|
const props: any = defineProps(_props)
|
5
6
|
</script>
|
@@ -7,10 +8,14 @@ const props: any = defineProps(_props)
|
|
7
8
|
<template>
|
8
9
|
<div
|
9
10
|
class="glorious-avatar"
|
10
|
-
:class="[
|
11
|
+
:class="[
|
12
|
+
`size-${getAttribute(props.size, 'avatar', 'size')}`,
|
13
|
+
`rounded-${getAttribute(props.rounded, 'avatar', 'rounded')}`,
|
14
|
+
]"
|
11
15
|
>
|
12
|
-
<nuxt-img
|
16
|
+
<nuxt-img
|
17
|
+
:src="props.src"
|
18
|
+
:alt="getAttribute(props.rounded, 'avatar', 'rounded')"
|
19
|
+
/>
|
13
20
|
</div>
|
14
21
|
</template>
|
15
|
-
|
16
|
-
<style lang="scss" src="../../style/components/avatar.scss" />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import _props from '../props/Breadcrumb'
|
3
|
+
import { getAttribute } from '../helper'
|
3
4
|
|
4
5
|
const props: any = defineProps(_props)
|
5
6
|
</script>
|
@@ -29,9 +30,9 @@ const props: any = defineProps(_props)
|
|
29
30
|
>
|
30
31
|
{{ item.text }}
|
31
32
|
</span>
|
32
|
-
<span v-if="index + 1 !== props.items.length">
|
33
|
+
<span v-if="index + 1 !== props.items.length">
|
34
|
+
{{ getAttribute(props.divider, 'breadcrumb', 'divider') }}
|
35
|
+
</span>
|
33
36
|
</div>
|
34
37
|
</div>
|
35
38
|
</template>
|
36
|
-
|
37
|
-
<style lang="scss" src="../../style/components/breadcrumb.scss" />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import _props from '../props/Button'
|
3
|
+
import { getAttribute } from '../helper'
|
3
4
|
|
4
5
|
const props: any = defineProps(_props)
|
5
6
|
</script>
|
@@ -10,14 +11,14 @@ const props: any = defineProps(_props)
|
|
10
11
|
:aria-label="props.ariaLabel"
|
11
12
|
:class="[
|
12
13
|
`glorious-button`,
|
13
|
-
`button-color-${props.color}`,
|
14
|
-
`size-${props.size}`,
|
15
|
-
props.outline ? 'outline' : '',
|
14
|
+
`button-color-${getAttribute(props.color, 'button', 'color')}`,
|
15
|
+
`size-${getAttribute(props.size, 'button', 'size')}`,
|
16
|
+
getAttribute(props.outline, 'button', 'outline') ? 'outline' : '',
|
16
17
|
]"
|
17
|
-
:disabled="props.disabled"
|
18
|
+
:disabled="getAttribute(props.disabled, 'button', 'disable')"
|
18
19
|
>
|
19
20
|
<div
|
20
|
-
v-if="props.loading"
|
21
|
+
v-if="getAttribute(props.loading, 'button', 'loading')"
|
21
22
|
class="loading flex justify-center"
|
22
23
|
>
|
23
24
|
<GLoading />
|
@@ -29,14 +30,12 @@ const props: any = defineProps(_props)
|
|
29
30
|
:to="props.to"
|
30
31
|
:class="[
|
31
32
|
`glorious-button`,
|
32
|
-
`button-color-${props.color}`,
|
33
|
-
`size-${props.size}`,
|
34
|
-
props.outline ? 'outline' : '',
|
33
|
+
`button-color-${getAttribute(props.color, 'button', 'color')}`,
|
34
|
+
`size-${getAttribute(props.size, 'button', 'size')}`,
|
35
|
+
getAttribute(props.outline, 'button', 'outline') ? 'outline' : '',
|
35
36
|
]"
|
36
|
-
:disabled="props.disabled"
|
37
|
+
:disabled="getAttribute(props.disabled, 'button', 'disable')"
|
37
38
|
>
|
38
39
|
<slot />
|
39
40
|
</NuxtLink>
|
40
41
|
</template>
|
41
|
-
|
42
|
-
<style lang="scss" src="../../style/components/button.scss" />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import _props from '../props/CheckBox'
|
3
|
+
import { getAttribute } from '../helper'
|
3
4
|
|
4
5
|
const props: any = defineProps(_props)
|
5
6
|
const model = defineModel()
|
@@ -11,16 +12,17 @@ model.value = props.checked
|
|
11
12
|
<template>
|
12
13
|
<label
|
13
14
|
class="glorious-checkbox"
|
14
|
-
:class="[
|
15
|
+
:class="[
|
16
|
+
`color-${getAttribute(props.color, 'checkbox', 'color')}`,
|
17
|
+
`size-${getAttribute(props.size, 'checkbox', 'size')}`,
|
18
|
+
]"
|
15
19
|
>
|
16
20
|
<input
|
17
21
|
type="checkbox"
|
18
|
-
:checked="props.checked"
|
19
|
-
:disabled="props.disabled"
|
22
|
+
:checked="getAttribute(props.checked, 'checkbox', 'checked')"
|
23
|
+
:disabled="getAttribute(props.disabled, 'checkbox', 'disable')"
|
20
24
|
@input="inputFunction($event)"
|
21
25
|
/>
|
22
26
|
<div></div>
|
23
27
|
</label>
|
24
28
|
</template>
|
25
|
-
|
26
|
-
<style lang="scss" src="../../style/components/checkbox.scss" />
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { watch } from '#imports'
|
3
3
|
import _props from '../props/Drawer'
|
4
|
+
import { getAttribute } from '../helper'
|
4
5
|
import { createBlurDom, removeBlurDom } from '../helper'
|
5
6
|
|
6
7
|
const props = defineProps(_props)
|
@@ -14,9 +15,13 @@ watch(
|
|
14
15
|
}
|
15
16
|
)
|
16
17
|
</script>
|
18
|
+
|
17
19
|
<template>
|
18
20
|
<div
|
19
|
-
:class="[
|
21
|
+
:class="[
|
22
|
+
getAttribute(props.position, 'drawer', 'position'),
|
23
|
+
modelValue ? 'open' : 'close',
|
24
|
+
]"
|
20
25
|
class="glorious-drawer close hidden"
|
21
26
|
>
|
22
27
|
<div class="w-full">
|
@@ -24,5 +29,3 @@ watch(
|
|
24
29
|
</div>
|
25
30
|
</div>
|
26
31
|
</template>
|
27
|
-
|
28
|
-
<style lang="scss" src="../../style/components/drawer.scss" />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import _props from '../props/File'
|
3
|
+
import { getAttribute } from '../helper'
|
3
4
|
|
4
5
|
const props: any = defineProps(_props)
|
5
6
|
const modelValue = defineModel()
|
@@ -22,30 +23,34 @@ const deleteFile = (event: any) => {
|
|
22
23
|
v-if="props.title !== ''"
|
23
24
|
class="glorious-title text-sm font-medium text-gray-500"
|
24
25
|
>
|
25
|
-
{{ props.title }}
|
26
|
+
{{ getAttribute(props.title, 'file', 'title') }}
|
26
27
|
<span
|
27
|
-
v-if="props.required"
|
28
|
+
v-if="getAttribute(props.required, 'file', 'required')"
|
28
29
|
class="text-red-500"
|
29
30
|
>
|
30
31
|
*
|
31
32
|
</span>
|
32
33
|
</span>
|
33
34
|
<label
|
34
|
-
:class="[`glorious-file-${props.color}`]"
|
35
|
+
:class="[`glorious-file-${getAttribute(props.color, 'file', 'color')}`]"
|
35
36
|
class="flex items-center gap-3 text-gray-500 bg-white"
|
36
37
|
>
|
37
38
|
<div
|
38
39
|
class="placeholder"
|
39
|
-
:class="[`size-${props.size}`]"
|
40
|
+
:class="[`size-${getAttribute(props.size, 'file', 'size')}`]"
|
40
41
|
>
|
41
|
-
<span>{{
|
42
|
+
<span>{{
|
43
|
+
getAttribute(props.placeholder, 'file', 'placeholder')
|
44
|
+
}}</span>
|
42
45
|
</div>
|
43
46
|
<input
|
44
47
|
type="file"
|
45
48
|
class="hidden"
|
46
49
|
@change="changeInput($event)"
|
47
50
|
/>
|
48
|
-
<span class="text-xs">{{
|
51
|
+
<span class="text-xs">{{
|
52
|
+
getAttribute(props.text, 'file', 'text')
|
53
|
+
}}</span>
|
49
54
|
<GIcon
|
50
55
|
name="glorious-x"
|
51
56
|
color="#ff0000"
|
@@ -55,5 +60,3 @@ const deleteFile = (event: any) => {
|
|
55
60
|
<GErrorText :error="props.error" />
|
56
61
|
</div>
|
57
62
|
</template>
|
58
|
-
|
59
|
-
<style lang="scss" src="../../style/components/file.scss" />
|
@@ -1,82 +1,46 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { ref, watch } from '#imports'
|
3
3
|
import _props from '../props/Icon'
|
4
|
-
|
4
|
+
import { getAttribute } from '../helper'
|
5
5
|
|
6
|
+
const props = defineProps(_props)
|
7
|
+
const isHover = ref(false)
|
6
8
|
const icon = ref('')
|
9
|
+
const computeProps = (icon: any) => {
|
10
|
+
const size = getAttribute(props.size, 'icon', 'size')
|
11
|
+
const color = getAttribute(props.color, 'icon', 'color')
|
12
|
+
const strokeWidth = getAttribute(props.stroke, 'icon', 'stroke')
|
13
|
+
const stroke = getAttribute(props.color, 'icon', 'color')
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
//fill
|
23
|
-
if (typeof props.color !== 'undefined') {
|
24
|
-
icon = icon
|
25
|
-
.split(' ')
|
26
|
-
.map((item: any) => {
|
27
|
-
if (!item.includes('fill="none"')) {
|
28
|
-
if (item.includes('fill="') && !item.includes('"/>'))
|
29
|
-
return `fill="${props.color}"`
|
30
|
-
else if (item.includes('fill="') && item.includes('"/>'))
|
31
|
-
return `fill="${props.color}"/>`
|
32
|
-
else return item
|
33
|
-
} else return item
|
34
|
-
})
|
35
|
-
.join(' ')
|
36
|
-
}
|
37
|
-
|
38
|
-
//size
|
39
|
-
icon = icon.replaceAll('\n', ' ')
|
40
|
-
|
41
|
-
//width
|
42
|
-
icon = icon
|
43
|
-
.split(' ')
|
44
|
-
.map((item: any) =>
|
45
|
-
item.includes('width="') &&
|
46
|
-
!item.includes('stroke-width') &&
|
47
|
-
typeof props.size !== 'undefined'
|
48
|
-
? 'width="' + props.size + '"'
|
49
|
-
: item
|
50
|
-
)
|
51
|
-
.join(' ')
|
15
|
+
return icon
|
16
|
+
.replace(/width="(\d+)"/g, `width="${size}"`)
|
17
|
+
.replace(/height="(\d+)"/g, `height="${size}"`)
|
18
|
+
.replace(/fill="(?!none)([^"]+)"/g, `fill="${color}"`)
|
19
|
+
.replace(/stroke="(?!none)([^"]+)"/g, `stroke="${stroke}"`)
|
20
|
+
.replace(/stroke-width="[^"]*"/g, `stroke-width="${strokeWidth}"`)
|
21
|
+
}
|
22
|
+
const changeColorIcon = (color: string) => {
|
23
|
+
icon.value = icon.value
|
24
|
+
.replace(/fill="(?!none)([^"]+)"/g, `fill="${color}"`)
|
25
|
+
.replace(/stroke="(?!none)([^"]+)"/g, `stroke="${color}"`)
|
26
|
+
}
|
27
|
+
const mouseover = () => {
|
28
|
+
if (props.hoverColor === '') return
|
52
29
|
|
53
|
-
|
54
|
-
|
55
|
-
.map((item: any) =>
|
56
|
-
item.includes('height="') && typeof props.size !== 'undefined'
|
57
|
-
? 'height="' + props.size + '"'
|
58
|
-
: item
|
59
|
-
)
|
60
|
-
.join(' ')
|
30
|
+
if (!isHover.value) {
|
31
|
+
const color = getAttribute(props.hoverColor, 'icon', 'hoverColor')
|
61
32
|
|
62
|
-
|
63
|
-
|
64
|
-
icon = icon.replaceAll('\n', ' ')
|
65
|
-
icon = icon
|
66
|
-
.split(' ')
|
67
|
-
.map((item: any) =>
|
68
|
-
item.includes('stroke-width') && typeof props.stroke !== 'undefined'
|
69
|
-
? 'stroke-width="' + props.stroke + '"'
|
70
|
-
: item
|
71
|
-
)
|
72
|
-
.join(' ')
|
73
|
-
}
|
33
|
+
changeColorIcon(color)
|
34
|
+
}
|
74
35
|
|
75
|
-
|
76
|
-
},
|
36
|
+
isHover.value = true
|
77
37
|
}
|
78
|
-
|
79
|
-
|
38
|
+
const mouseleave = () => {
|
39
|
+
isHover.value = false
|
40
|
+
const color = getAttribute(props.color, 'icon', 'color')
|
41
|
+
changeColorIcon(color)
|
42
|
+
}
|
43
|
+
const getIcon = async () => {
|
80
44
|
try {
|
81
45
|
const iconsImport = import.meta.glob('assets/icons/**/**.svg', {
|
82
46
|
query: '?raw',
|
@@ -99,7 +63,7 @@ async function getIcon() {
|
|
99
63
|
rawIcon = icon.default
|
100
64
|
}
|
101
65
|
|
102
|
-
icon.value =
|
66
|
+
icon.value = computeProps(rawIcon)
|
103
67
|
} catch (e) {
|
104
68
|
console.error(
|
105
69
|
`glorious error -> Icon '${props.name}' doesn't exist in 'assets/icons'`
|
@@ -117,9 +81,12 @@ watch(
|
|
117
81
|
}
|
118
82
|
)
|
119
83
|
</script>
|
84
|
+
|
120
85
|
<template>
|
121
86
|
<div
|
122
87
|
class="w-max h-max"
|
88
|
+
@mouseover="mouseover"
|
89
|
+
@mouseleave="mouseleave"
|
123
90
|
v-html="icon"
|
124
91
|
/>
|
125
92
|
</template>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<script setup lang="ts">
|
2
2
|
import { computed, ref, watch, useGloriousCore } from '#imports'
|
3
|
-
import { hasValidationError } from '../helper'
|
3
|
+
import { hasValidationError, getAttribute } from '../helper'
|
4
4
|
import _props from '../props/Input'
|
5
5
|
|
6
6
|
const props: any = defineProps(_props)
|
@@ -12,9 +12,9 @@ const inputValue: any = ref(null)
|
|
12
12
|
watch(
|
13
13
|
() => inputValue.value,
|
14
14
|
() => {
|
15
|
-
if (props.mode === 'tag') return
|
15
|
+
if (getAttribute(props.mode, 'icon', 'mode') === 'tag') return
|
16
16
|
|
17
|
-
switch (props.display) {
|
17
|
+
switch (getAttribute(props.display, 'icon', 'display')) {
|
18
18
|
case 'price':
|
19
19
|
inputValue.value = numbersWithSeparateSamePrice(inputValue.value)
|
20
20
|
modelValue.value = inputValue.value.toString().replaceAll(',', '')
|
@@ -57,11 +57,11 @@ const computeIconSize = computed(() => {
|
|
57
57
|
const tags: any = ref([])
|
58
58
|
|
59
59
|
const addTag = (event: any) => {
|
60
|
-
if (props.tagLockOption) return
|
60
|
+
if (getAttribute(props.tagLockOption, 'icon', 'tagLockOption')) return
|
61
61
|
|
62
62
|
if (tags.value.length === 0) tags.value = []
|
63
63
|
|
64
|
-
if (props.mode !== 'tag') return
|
64
|
+
if (getAttribute(props.mode, 'icon', 'mode') !== 'tag') return
|
65
65
|
const value: any = event.target.value
|
66
66
|
tags.value.push(value)
|
67
67
|
modelValue.value = tags.value
|
@@ -94,7 +94,7 @@ const removeTag = (tag: string) => {
|
|
94
94
|
|
95
95
|
// -------------------------------------- init value
|
96
96
|
const initValue = () => {
|
97
|
-
if (props.mode === 'tag') {
|
97
|
+
if (getAttribute(props.mode, 'icon', 'mode') === 'tag') {
|
98
98
|
tags.value = modelValue.value
|
99
99
|
return
|
100
100
|
}
|
@@ -107,10 +107,10 @@ watch(
|
|
107
107
|
() => initValue()
|
108
108
|
)
|
109
109
|
|
110
|
-
const typeInput = ref(props.type)
|
110
|
+
const typeInput = ref(getAttribute(props.type, 'icon', 'type'))
|
111
111
|
|
112
112
|
const inputClicked = (event: any) => {
|
113
|
-
if (props.mode === 'tag' && props.options) {
|
113
|
+
if (getAttribute(props.mode, 'icon', 'mode') === 'tag' && props.options) {
|
114
114
|
const gio = document.querySelectorAll('.glorious-input-options')
|
115
115
|
gio.forEach((element: any) => element.classList.add('hidden'))
|
116
116
|
|
@@ -127,9 +127,9 @@ const inputClicked = (event: any) => {
|
|
127
127
|
<template>
|
128
128
|
<div class="flex flex-col">
|
129
129
|
<span class="glorious-title text-sm font-medium text-gray-500">
|
130
|
-
{{ props.title }}
|
130
|
+
{{ getAttribute(props.title, 'icon', 'title') }}
|
131
131
|
<span
|
132
|
-
v-if="props.required"
|
132
|
+
v-if="getAttribute(props.required, 'icon', 'required')"
|
133
133
|
class="text-red-500"
|
134
134
|
>
|
135
135
|
*
|
@@ -146,30 +146,40 @@ const inputClicked = (event: any) => {
|
|
146
146
|
<div class="relative">
|
147
147
|
<input
|
148
148
|
v-model="inputValue"
|
149
|
-
:inputmode="props.inputMode"
|
150
|
-
:autocomplete="
|
149
|
+
:inputmode="getAttribute(props.inputMode, 'icon', 'inputMode')"
|
150
|
+
:autocomplete="
|
151
|
+
getAttribute(props.autocomplete, 'icon', 'autocomplete')
|
152
|
+
"
|
151
153
|
class="w-full glorious-input-field"
|
152
154
|
:class="[
|
153
155
|
`size-${props.size}`,
|
154
|
-
`glorious-input-${props.color}`,
|
155
|
-
props.type
|
156
|
-
|
156
|
+
`glorious-input-${getAttribute(props.color, 'icon', 'color')}`,
|
157
|
+
getAttribute(props.type, 'icon', 'type') === 'password'
|
158
|
+
? 'pl-[30px] pr-3'
|
159
|
+
: 'px-3',
|
160
|
+
`mode-${getAttribute(props.mode, 'icon', 'mode')}`,
|
157
161
|
]"
|
158
|
-
:placeholder="props.placeholder"
|
159
|
-
:disabled="props.
|
162
|
+
:placeholder="getAttribute(props.placeholder, 'icon', 'placeholder')"
|
163
|
+
:disabled="getAttribute(props.disable, 'icon', 'disable')"
|
160
164
|
:type="typeInput"
|
161
165
|
@keyup.enter="addTag($event)"
|
162
166
|
@click="inputClicked($event)"
|
163
167
|
/>
|
164
168
|
<GIcon
|
165
|
-
v-if="
|
169
|
+
v-if="
|
170
|
+
getAttribute(props.type, 'icon', 'type') === 'password' &&
|
171
|
+
typeInput === 'password'
|
172
|
+
"
|
166
173
|
class="absolute left-0 top-0 bottom-0 my-auto ml-1 cursor-pointer"
|
167
174
|
:size="23"
|
168
175
|
name="glorious-eye-fill"
|
169
176
|
@click="typeInput = 'text'"
|
170
177
|
></GIcon>
|
171
178
|
<GIcon
|
172
|
-
v-if="
|
179
|
+
v-if="
|
180
|
+
getAttribute(props.type, 'icon', 'type') === 'password' &&
|
181
|
+
typeInput === 'text'
|
182
|
+
"
|
173
183
|
class="absolute left-0 top-0 bottom-0 my-auto ml-1 cursor-pointer"
|
174
184
|
:size="23"
|
175
185
|
name="glorious-eye-off-fill"
|
@@ -182,7 +192,7 @@ const inputClicked = (event: any) => {
|
|
182
192
|
:class="[`size-${props.size}`]"
|
183
193
|
>
|
184
194
|
<div
|
185
|
-
v-if="props.loading"
|
195
|
+
v-if="getAttribute(props.loading, 'icon', 'loading')"
|
186
196
|
class="flex justify-center"
|
187
197
|
>
|
188
198
|
<GLoading color="green" />
|
@@ -193,7 +203,11 @@ const inputClicked = (event: any) => {
|
|
193
203
|
:key="index"
|
194
204
|
@click="addTagViaOption(option, $event)"
|
195
205
|
>
|
196
|
-
{{
|
206
|
+
{{
|
207
|
+
option[
|
208
|
+
getAttribute(props.displayTextKey, 'icon', 'displayTextKey')
|
209
|
+
]
|
210
|
+
}}
|
197
211
|
</div>
|
198
212
|
</div>
|
199
213
|
</div>
|
@@ -206,7 +220,13 @@ const inputClicked = (event: any) => {
|
|
206
220
|
v-for="(item, index) in tags"
|
207
221
|
:key="index"
|
208
222
|
>
|
209
|
-
{{
|
223
|
+
{{
|
224
|
+
typeof item === 'object'
|
225
|
+
? item[
|
226
|
+
getAttribute(props.displayTextKey, 'icon', 'displayTextKey')
|
227
|
+
]
|
228
|
+
: item
|
229
|
+
}}
|
210
230
|
<GIcon
|
211
231
|
name="glorious-x"
|
212
232
|
:size="10"
|
@@ -222,7 +242,7 @@ const inputClicked = (event: any) => {
|
|
222
242
|
:size="computeIconSize"
|
223
243
|
/>
|
224
244
|
<div
|
225
|
-
v-if="props.
|
245
|
+
v-if="getAttribute(props.loading, 'icon', 'loading')"
|
226
246
|
class="absolute top-1 bottom-0 my-auto left-1"
|
227
247
|
>
|
228
248
|
<GLoading color="green" />
|
@@ -231,5 +251,3 @@ const inputClicked = (event: any) => {
|
|
231
251
|
<GErrorText :error="props.error" />
|
232
252
|
</div>
|
233
253
|
</template>
|
234
|
-
|
235
|
-
<style lang="scss" src="../../style/components/input.scss" />
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<script setup lang="ts">
|
2
2
|
import _props from '../props/Loading'
|
3
|
+
import { getAttribute } from '../helper'
|
4
|
+
|
3
5
|
const props: any = defineProps(_props)
|
4
6
|
</script>
|
5
7
|
|
@@ -8,11 +10,13 @@ const props: any = defineProps(_props)
|
|
8
10
|
<div
|
9
11
|
class="glorious-loading"
|
10
12
|
:style="{
|
11
|
-
width: `${props.size}px`,
|
12
|
-
border: `${
|
13
|
+
width: `${getAttribute(props.size, 'icon', 'size')}px`,
|
14
|
+
border: `${getAttribute(
|
15
|
+
props.stroke,
|
16
|
+
'icon',
|
17
|
+
'stroke'
|
18
|
+
)}px solid ${getAttribute(props.color, 'icon', 'color')}`,
|
13
19
|
}"
|
14
20
|
/>
|
15
21
|
</div>
|
16
22
|
</template>
|
17
|
-
|
18
|
-
<style lang="scss" src="../../style/components/loading.scss" />
|