@hostlink/nuxt-light 1.1.3 → 1.1.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.json
CHANGED
|
@@ -3,7 +3,6 @@ import { computed, ref } from "vue";
|
|
|
3
3
|
import { useLight } from '#imports';
|
|
4
4
|
import { type QSelectProps } from "quasar";
|
|
5
5
|
import { useI18n } from "vue-i18n";
|
|
6
|
-
import { normalizeOptions } from "@formkit/inputs"
|
|
7
6
|
|
|
8
7
|
const emits = defineEmits(["update:modelValue"]);
|
|
9
8
|
|
|
@@ -44,7 +43,40 @@ if (props.required) {
|
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
function normalizeOptions(options: any, i = { count: 1 }) {
|
|
47
|
+
if (Array.isArray(options)) {
|
|
48
|
+
return options.map(
|
|
49
|
+
(option): any => {
|
|
50
|
+
if (typeof option === 'string' || typeof option === 'number') {
|
|
51
|
+
return {
|
|
52
|
+
label: String(option),
|
|
53
|
+
value: String(option),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (typeof option == 'object') {
|
|
57
|
+
if ('group' in option) {
|
|
58
|
+
option.options = normalizeOptions(option.options || [], i)
|
|
59
|
+
return option as any
|
|
60
|
+
} else if ('value' in option && typeof option.value !== 'string') {
|
|
61
|
+
Object.assign(option, {
|
|
62
|
+
value: option.value,
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return option as any
|
|
67
|
+
}
|
|
68
|
+
) as any
|
|
69
|
+
}
|
|
70
|
+
return Object.keys(options).map((value: string) => {
|
|
71
|
+
return {
|
|
72
|
+
label: options[value],
|
|
73
|
+
value,
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const select_options = ref(props.options);
|
|
48
80
|
|
|
49
81
|
const filterFn = (val, update, abort) => {
|
|
50
82
|
|
|
@@ -91,11 +123,15 @@ const attrs = computed(() => {
|
|
|
91
123
|
|
|
92
124
|
const localValue = computed({
|
|
93
125
|
get: () => props.modelValue,
|
|
94
|
-
set: (value) =>
|
|
126
|
+
set: (value) => {
|
|
127
|
+
emits('update:modelValue', value)
|
|
128
|
+
}
|
|
95
129
|
});
|
|
96
130
|
|
|
131
|
+
|
|
97
132
|
</script>
|
|
98
133
|
<template>
|
|
134
|
+
{{ select_options }}
|
|
99
135
|
<q-select v-bind="attrs" v-model="localValue" :options="select_options" @filter="filterFn" :option-label="optionLabel"
|
|
100
136
|
hide-bottom-space :rules="rules" :clearable="clearable" />
|
|
101
137
|
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
|
|
4
|
+
export interface LSmallBoxProps {
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
color: 'red' | 'pink' | 'purple' | 'deep-purple' | 'indigo' | 'blue' | 'light-blue' | 'cyan' | 'teal' | 'green' | 'light-green' | 'lime' | 'yellow' | 'amber' | 'orange' | 'deep-orange' | 'brown' | 'grey' | 'blue-grey'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<LSmallBoxProps>(), {
|
|
12
|
+
title: '',
|
|
13
|
+
subtitle: '',
|
|
14
|
+
icon: 'local_offer',
|
|
15
|
+
color: 'indigo'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const item_class = computed(() => {
|
|
19
|
+
return ["bg-" + props.color + "-4"]
|
|
20
|
+
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const section_class = computed(() => {
|
|
24
|
+
return ["text-white", "bg-" + props.color]
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<q-item :class="item_class" class="no-wrap q-pa-none text-white">
|
|
32
|
+
<q-item-section class="q-pa-lg q-mr-none text-white" :class="section_class" side>
|
|
33
|
+
<q-icon :name="icon" size="2rem" />
|
|
34
|
+
</q-item-section>
|
|
35
|
+
<q-item-section class="q-pa-md q-ml-none">
|
|
36
|
+
<q-item-label class="text-h6 text-white">{{ title }}</q-item-label>
|
|
37
|
+
<q-item-label caption class="text-white">{{ subtitle }}</q-item-label>
|
|
38
|
+
</q-item-section>
|
|
39
|
+
</q-item>
|
|
40
|
+
</template>
|