vueless 0.0.192 → 0.0.194
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/composable.ui/index.js +19 -7
- package/package.json +3 -3
- package/service.storybook/index.js +42 -8
- package/ui.button-toggle/index.vue +1 -1
- package/ui.button-toggle-item/index.vue +1 -3
- package/ui.dropdown-item/index.vue +1 -1
- package/ui.form-checkbox/index.vue +6 -8
- package/ui.form-input-rating/composables/attrs.composable.js +24 -22
- package/ui.form-input-rating/configs/default.config.js +28 -13
- package/ui.form-input-rating/index.stories.js +26 -21
- package/ui.form-input-rating/index.vue +99 -68
- package/ui.form-radio/index.vue +7 -8
- package/ui.form-select/composables/attrs.composable.js +9 -10
- package/ui.navigation-tab/index.vue +3 -3
- package/web-types.json +311 -61
|
@@ -1,43 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
v-for="star in starsNumber"
|
|
22
|
-
:key="star"
|
|
23
|
-
internal
|
|
24
|
-
color="yellow"
|
|
25
|
-
:size="iconSize"
|
|
26
|
-
:interactive="selectable"
|
|
27
|
-
:data-cy="`${dataCy}-rating-star-${star}`"
|
|
28
|
-
:name="star <= ratingCounter ? config.selectedIconName : config.unselectedIconName"
|
|
29
|
-
v-bind="iconAttrs"
|
|
30
|
-
@mouseover="onMouseHover(star)"
|
|
31
|
-
@mouseleave="onMouseHover()"
|
|
32
|
-
@click="onClickStar(star)"
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<!-- @slot Use it to add something right. -->
|
|
37
|
-
<slot name="right" />
|
|
2
|
+
<ULabel
|
|
3
|
+
:label="label"
|
|
4
|
+
:error="error"
|
|
5
|
+
:size="size"
|
|
6
|
+
:align="labelAlign"
|
|
7
|
+
:description="description"
|
|
8
|
+
v-bind="labelAttrs"
|
|
9
|
+
:data-cy="dataCy"
|
|
10
|
+
>
|
|
11
|
+
<div v-bind="wrapperAttrs">
|
|
12
|
+
<div v-if="counter || hasSlotContent($slots['counter'])" v-bind="counterAttrs">
|
|
13
|
+
<!--
|
|
14
|
+
@slot Use it to customise counter.
|
|
15
|
+
@binding {number} counter
|
|
16
|
+
@binding {number} total
|
|
17
|
+
-->
|
|
18
|
+
<slot name="counter" :counter="counterValue" :total="total">
|
|
19
|
+
{{ counterValue }}
|
|
20
|
+
</slot>
|
|
38
21
|
</div>
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
|
|
23
|
+
<div v-bind="starsAttrs">
|
|
24
|
+
<UIcon
|
|
25
|
+
v-for="star in stars"
|
|
26
|
+
:key="star"
|
|
27
|
+
internal
|
|
28
|
+
color="yellow"
|
|
29
|
+
:size="iconSize"
|
|
30
|
+
:interactive="selectable"
|
|
31
|
+
:name="star <= counterValue ? config.selectedIconName : config.unselectedIconName"
|
|
32
|
+
v-bind="starAttrs"
|
|
33
|
+
:data-cy="`${dataCy}-rating-star-${star}`"
|
|
34
|
+
@click="onClickStar(star)"
|
|
35
|
+
@mouseleave="onMouseHover()"
|
|
36
|
+
@mouseover="onMouseHover(star)"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div v-if="total || hasSlotContent($slots['total'])" v-bind="totalAttrs">
|
|
41
|
+
<!--
|
|
42
|
+
@slot Use it to customise total.
|
|
43
|
+
@binding {number} counter
|
|
44
|
+
@binding {number} total
|
|
45
|
+
-->
|
|
46
|
+
<slot name="total" :counter="counter" :total="total">({{ total }})</slot>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</ULabel>
|
|
41
50
|
</template>
|
|
42
51
|
|
|
43
52
|
<script setup>
|
|
@@ -56,31 +65,23 @@ defineOptions({ name: "UInputRating", inheritAttrs: false });
|
|
|
56
65
|
|
|
57
66
|
const props = defineProps({
|
|
58
67
|
/**
|
|
59
|
-
*
|
|
60
|
-
*/
|
|
61
|
-
label: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: "",
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Set input rating value.
|
|
68
|
+
* Rating value.
|
|
68
69
|
*/
|
|
69
70
|
modelValue: {
|
|
70
71
|
type: Number,
|
|
71
|
-
default:
|
|
72
|
+
default: 0,
|
|
72
73
|
},
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
|
-
*
|
|
76
|
+
* Rating number of stars.
|
|
76
77
|
*/
|
|
77
|
-
|
|
78
|
+
stars: {
|
|
78
79
|
type: Number,
|
|
79
|
-
default: UIService.get(defaultConfig, UInputRating).default.
|
|
80
|
+
default: UIService.get(defaultConfig, UInputRating).default.stars,
|
|
80
81
|
},
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
|
-
*
|
|
84
|
+
* Rating size.
|
|
84
85
|
* @values sm, md, lg
|
|
85
86
|
*/
|
|
86
87
|
size: {
|
|
@@ -89,15 +90,15 @@ const props = defineProps({
|
|
|
89
90
|
},
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
|
-
*
|
|
93
|
+
* Rating label.
|
|
93
94
|
*/
|
|
94
|
-
|
|
95
|
-
type:
|
|
96
|
-
default:
|
|
95
|
+
label: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "",
|
|
97
98
|
},
|
|
98
99
|
|
|
99
100
|
/**
|
|
100
|
-
*
|
|
101
|
+
* Rating label placement.
|
|
101
102
|
* @values top, topInside, topWithDesc, bottom, left, right
|
|
102
103
|
*/
|
|
103
104
|
labelAlign: {
|
|
@@ -106,7 +107,7 @@ const props = defineProps({
|
|
|
106
107
|
},
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
|
-
*
|
|
110
|
+
* Rating error message.
|
|
110
111
|
*/
|
|
111
112
|
error: {
|
|
112
113
|
type: String,
|
|
@@ -114,7 +115,7 @@ const props = defineProps({
|
|
|
114
115
|
},
|
|
115
116
|
|
|
116
117
|
/**
|
|
117
|
-
*
|
|
118
|
+
* Rating description.
|
|
118
119
|
*/
|
|
119
120
|
description: {
|
|
120
121
|
type: String,
|
|
@@ -122,15 +123,31 @@ const props = defineProps({
|
|
|
122
123
|
},
|
|
123
124
|
|
|
124
125
|
/**
|
|
125
|
-
*
|
|
126
|
+
* Rating total.
|
|
127
|
+
*/
|
|
128
|
+
total: {
|
|
129
|
+
type: Number,
|
|
130
|
+
default: 0,
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Show rating counter.
|
|
126
135
|
*/
|
|
127
|
-
|
|
136
|
+
counter: {
|
|
128
137
|
type: Boolean,
|
|
129
|
-
default: UIService.get(defaultConfig, UInputRating).default.
|
|
138
|
+
default: UIService.get(defaultConfig, UInputRating).default.counter,
|
|
130
139
|
},
|
|
131
140
|
|
|
132
141
|
/**
|
|
133
|
-
*
|
|
142
|
+
* Make rating selectable.
|
|
143
|
+
*/
|
|
144
|
+
selectable: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: UIService.get(defaultConfig, UInputRating).default.selectable,
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Component ui config object.
|
|
134
151
|
*/
|
|
135
152
|
config: {
|
|
136
153
|
type: Object,
|
|
@@ -138,7 +155,7 @@ const props = defineProps({
|
|
|
138
155
|
},
|
|
139
156
|
|
|
140
157
|
/**
|
|
141
|
-
*
|
|
158
|
+
* Data-cy attribute for automated testing.
|
|
142
159
|
*/
|
|
143
160
|
dataCy: {
|
|
144
161
|
type: String,
|
|
@@ -146,12 +163,26 @@ const props = defineProps({
|
|
|
146
163
|
},
|
|
147
164
|
});
|
|
148
165
|
|
|
149
|
-
const emit = defineEmits([
|
|
166
|
+
const emit = defineEmits([
|
|
167
|
+
/**
|
|
168
|
+
* Triggers when the rating is changes.
|
|
169
|
+
* @property {number} modelValue
|
|
170
|
+
*/
|
|
171
|
+
"update:modelValue",
|
|
172
|
+
]);
|
|
150
173
|
|
|
151
174
|
const hovered = ref(null);
|
|
152
175
|
|
|
153
|
-
const {
|
|
154
|
-
|
|
176
|
+
const {
|
|
177
|
+
config,
|
|
178
|
+
labelAttrs,
|
|
179
|
+
wrapperAttrs,
|
|
180
|
+
counterAttrs,
|
|
181
|
+
totalAttrs,
|
|
182
|
+
starsAttrs,
|
|
183
|
+
starAttrs,
|
|
184
|
+
hasSlotContent,
|
|
185
|
+
} = useAttrs(props);
|
|
155
186
|
|
|
156
187
|
const iconSize = computed(() => {
|
|
157
188
|
const sizes = {
|
|
@@ -163,7 +194,7 @@ const iconSize = computed(() => {
|
|
|
163
194
|
return sizes[props.size];
|
|
164
195
|
});
|
|
165
196
|
|
|
166
|
-
const
|
|
197
|
+
const counterValue = computed(() => {
|
|
167
198
|
return hovered.value || props.modelValue;
|
|
168
199
|
});
|
|
169
200
|
|
package/ui.form-radio/index.vue
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script setup>
|
|
33
|
-
import { computed, inject, onMounted, ref, watchEffect } from "vue";
|
|
33
|
+
import { computed, inject, onMounted, ref, watchEffect, toValue } from "vue";
|
|
34
34
|
|
|
35
35
|
import ULabel from "../ui.form-label";
|
|
36
36
|
import UIService, { getRandomId } from "../service.ui";
|
|
@@ -162,8 +162,8 @@ const emit = defineEmits(["update:modelValue"]);
|
|
|
162
162
|
|
|
163
163
|
const localValue = ref("");
|
|
164
164
|
const radioName = ref(null);
|
|
165
|
-
const radioColor = ref(getRadioGroupColor
|
|
166
|
-
const radioSize = ref(getRadioGroupSize
|
|
165
|
+
const radioColor = ref(toValue(getRadioGroupColor) || props.color);
|
|
166
|
+
const radioSize = ref(toValue(getRadioGroupSize) || props.size);
|
|
167
167
|
|
|
168
168
|
const isChecked = computed(() => {
|
|
169
169
|
const currentValue = props.modelValue ?? localValue.value;
|
|
@@ -182,14 +182,13 @@ const radioValue = computed(() => {
|
|
|
182
182
|
});
|
|
183
183
|
|
|
184
184
|
onMounted(() => {
|
|
185
|
-
radioName.value = props.name || getRadioGroupName
|
|
185
|
+
radioName.value = props.name || toValue(getRadioGroupName);
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
watchEffect(() => (radioColor.value = getRadioGroupColor
|
|
189
|
-
watchEffect(() => (radioSize.value = getRadioGroupSize
|
|
188
|
+
watchEffect(() => (radioColor.value = toValue(getRadioGroupColor) || props.color));
|
|
189
|
+
watchEffect(() => (radioSize.value = toValue(getRadioGroupSize) || props.size));
|
|
190
190
|
watchEffect(() => {
|
|
191
|
-
localValue.value = getRadioGroupSelectedItem
|
|
192
|
-
|
|
191
|
+
localValue.value = toValue(getRadioGroupSelectedItem) || null;
|
|
193
192
|
emit("update:modelValue", props.value);
|
|
194
193
|
});
|
|
195
194
|
|
|
@@ -21,20 +21,19 @@ export default function useAttrs(props, { isTop, isOpen, selectedLabel: selected
|
|
|
21
21
|
for (const key in defaultConfig) {
|
|
22
22
|
if (isSystemKey(key)) continue;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const classes = computed(() => {
|
|
25
|
+
const value = config.value[key];
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
classes = computed(() =>
|
|
31
|
-
getCVA({
|
|
27
|
+
if (value.variants || value.compoundVariants) {
|
|
28
|
+
return cva(value)({
|
|
32
29
|
...props,
|
|
33
30
|
error: Boolean(props.error),
|
|
34
31
|
label: Boolean(props.label),
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return "";
|
|
36
|
+
});
|
|
38
37
|
|
|
39
38
|
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
40
39
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script setup>
|
|
11
|
-
import { computed, inject } from "vue";
|
|
11
|
+
import { computed, inject, toValue } from "vue";
|
|
12
12
|
|
|
13
13
|
import UIService from "../service.ui";
|
|
14
14
|
|
|
@@ -68,11 +68,11 @@ const props = defineProps({
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
const selected = computed(() => {
|
|
71
|
-
return getUTabsSelectedItem
|
|
71
|
+
return toValue(getUTabsSelectedItem) === props.value && !props.disabled;
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
const size = computed(() => {
|
|
75
|
-
return getUTabsSize
|
|
75
|
+
return toValue(getUTabsSize) || UIService.get(defaultConfig, UTab).default.size;
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
const { wrapperAttrs } = useAttrs(props, { selected, size });
|