@community-release/nx-ui 0.0.53 → 0.0.54
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
|
@@ -17,9 +17,18 @@
|
|
|
17
17
|
:disabled="disabled"
|
|
18
18
|
autocomplete="off"
|
|
19
19
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
<template v-if="withGroups">
|
|
21
|
+
<optgroup v-for="group of options" :label="group.name">
|
|
22
|
+
<option v-for="option in group.items" :value="option.value" :key="option.value" :selected="option.value == modelValue">
|
|
23
|
+
{{ option.name }}
|
|
24
|
+
</option>
|
|
25
|
+
</optgroup>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-else>
|
|
28
|
+
<option v-for="option in options" :value="option.value" :key="option.value" :selected="option.value == modelValue">
|
|
29
|
+
{{ option.name }}
|
|
30
|
+
</option>
|
|
31
|
+
</template>
|
|
23
32
|
</select>
|
|
24
33
|
</div>
|
|
25
34
|
</div>
|
|
@@ -51,6 +60,10 @@ const props = defineProps({
|
|
|
51
60
|
type: Array,
|
|
52
61
|
default: () => []
|
|
53
62
|
},
|
|
63
|
+
withGroups: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
54
67
|
required: {
|
|
55
68
|
type: Boolean,
|
|
56
69
|
default: false
|
|
@@ -81,9 +94,23 @@ const valueName = computed(() => {
|
|
|
81
94
|
let result = '...';
|
|
82
95
|
|
|
83
96
|
const value = props.modelValue;
|
|
84
|
-
|
|
97
|
+
|
|
98
|
+
// If it's options with groups
|
|
99
|
+
if (props.withGroups) {
|
|
100
|
+
for (let group of props.options) {
|
|
101
|
+
for (let o of group.items) {
|
|
102
|
+
if (o.value == value) {
|
|
103
|
+
return o.name;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// If it's flat options
|
|
109
|
+
} else {
|
|
110
|
+
let option = props.options.find(option => option.value == value);
|
|
85
111
|
|
|
86
|
-
|
|
112
|
+
if (typeof option !== 'undefined') result = option.name;
|
|
113
|
+
}
|
|
87
114
|
|
|
88
115
|
return result;
|
|
89
116
|
});
|