vueless 0.0.362 → 0.0.364
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/package.json +1 -1
- package/ui.dropdown-badge/UDropdownBadge.vue +10 -11
- package/ui.dropdown-button/UDropdownButton.vue +7 -8
- package/ui.dropdown-link/UDropdownLink.vue +8 -9
- package/ui.dropdown-list/UDropdownList.vue +10 -3
- package/ui.dropdown-list/storybook/stories.js +10 -0
- package/web-types.json +11 -7
package/package.json
CHANGED
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
<UDropdownList
|
|
53
53
|
v-if="isShownOptions"
|
|
54
54
|
ref="dropdownListRef"
|
|
55
|
-
v-model="selectedItem"
|
|
56
55
|
:size="size"
|
|
57
56
|
:options="options"
|
|
58
57
|
:value-key="valueKey"
|
|
59
58
|
:label-key="labelKey"
|
|
60
59
|
v-bind="dropdownListAttrs"
|
|
61
60
|
:data-test="`${dataTest}-list`"
|
|
61
|
+
@click-option="onClickOption"
|
|
62
62
|
/>
|
|
63
63
|
</div>
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<script setup>
|
|
67
|
-
import { nextTick, ref,
|
|
67
|
+
import { nextTick, ref, useId } from "vue";
|
|
68
68
|
|
|
69
69
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
70
70
|
import UBadge from "../ui.text-badge/UBadge.vue";
|
|
@@ -201,14 +201,13 @@ const props = defineProps({
|
|
|
201
201
|
|
|
202
202
|
const emit = defineEmits([
|
|
203
203
|
/**
|
|
204
|
-
* Triggers
|
|
204
|
+
* Triggers on dropdown option click.
|
|
205
205
|
* @property {string} value
|
|
206
206
|
*/
|
|
207
|
-
"
|
|
207
|
+
"clickOption",
|
|
208
208
|
]);
|
|
209
209
|
|
|
210
210
|
const isShownOptions = ref(false);
|
|
211
|
-
const selectedItem = ref("");
|
|
212
211
|
const dropdownListRef = ref(null);
|
|
213
212
|
|
|
214
213
|
const elementId = props.id || useId();
|
|
@@ -220,12 +219,6 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
|
|
|
220
219
|
},
|
|
221
220
|
);
|
|
222
221
|
|
|
223
|
-
watch(selectedItem, () => {
|
|
224
|
-
emit("select", selectedItem.value);
|
|
225
|
-
|
|
226
|
-
hideOptions();
|
|
227
|
-
});
|
|
228
|
-
|
|
229
222
|
function onClickBadge() {
|
|
230
223
|
isShownOptions.value = !isShownOptions.value;
|
|
231
224
|
|
|
@@ -237,4 +230,10 @@ function onClickBadge() {
|
|
|
237
230
|
function hideOptions() {
|
|
238
231
|
isShownOptions.value = false;
|
|
239
232
|
}
|
|
233
|
+
|
|
234
|
+
function onClickOption(option) {
|
|
235
|
+
emit("clickOption", option);
|
|
236
|
+
|
|
237
|
+
hideOptions();
|
|
238
|
+
}
|
|
240
239
|
</script>
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
<UDropdownList
|
|
54
54
|
v-if="isShownOptions"
|
|
55
55
|
ref="dropdownListRef"
|
|
56
|
-
v-model="selectedItem"
|
|
57
56
|
:size="size"
|
|
58
57
|
:options="options"
|
|
59
58
|
:value-key="valueKey"
|
|
@@ -61,12 +60,13 @@
|
|
|
61
60
|
v-bind="dropdownListAttrs"
|
|
62
61
|
:data-test="`${dataTest}-list`"
|
|
63
62
|
@click="onClickList"
|
|
63
|
+
@click-option="onClickOption"
|
|
64
64
|
/>
|
|
65
65
|
</div>
|
|
66
66
|
</template>
|
|
67
67
|
|
|
68
68
|
<script setup>
|
|
69
|
-
import { nextTick, computed, provide, ref,
|
|
69
|
+
import { nextTick, computed, provide, ref, useId } from "vue";
|
|
70
70
|
|
|
71
71
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
72
72
|
import UButton from "../ui.button/UButton.vue";
|
|
@@ -227,16 +227,15 @@ const props = defineProps({
|
|
|
227
227
|
|
|
228
228
|
const emit = defineEmits([
|
|
229
229
|
/**
|
|
230
|
-
* Triggers
|
|
230
|
+
* Triggers on dropdown option click.
|
|
231
231
|
* @property {string} value
|
|
232
232
|
*/
|
|
233
|
-
"
|
|
233
|
+
"clickOption",
|
|
234
234
|
]);
|
|
235
235
|
|
|
236
236
|
provide("hideDropdownOptions", hideOptions);
|
|
237
237
|
|
|
238
238
|
const isShownOptions = ref(false);
|
|
239
|
-
const selectedItem = ref("");
|
|
240
239
|
const dropdownListRef = ref(null);
|
|
241
240
|
|
|
242
241
|
const elementId = props.id || useId();
|
|
@@ -261,9 +260,9 @@ const iconSize = computed(() => {
|
|
|
261
260
|
return sizes[props.size];
|
|
262
261
|
});
|
|
263
262
|
|
|
264
|
-
|
|
265
|
-
emit("
|
|
266
|
-
}
|
|
263
|
+
function onClickOption(option) {
|
|
264
|
+
emit("clickOption", option);
|
|
265
|
+
}
|
|
267
266
|
|
|
268
267
|
function onClickButton() {
|
|
269
268
|
isShownOptions.value = !isShownOptions.value;
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
<UDropdownList
|
|
57
57
|
v-if="isShownOptions"
|
|
58
58
|
ref="dropdownListRef"
|
|
59
|
-
v-model="selectedItem"
|
|
60
59
|
:size="size"
|
|
61
60
|
:options="options"
|
|
62
61
|
:value-key="valueKey"
|
|
@@ -64,12 +63,13 @@
|
|
|
64
63
|
:data-test="`${dataTest}-list`"
|
|
65
64
|
v-bind="dropdownListAttrs"
|
|
66
65
|
@click="onClickList"
|
|
66
|
+
@click-option="onClickOption"
|
|
67
67
|
/>
|
|
68
68
|
</div>
|
|
69
69
|
</template>
|
|
70
70
|
|
|
71
71
|
<script setup>
|
|
72
|
-
import { nextTick, computed, provide, ref,
|
|
72
|
+
import { nextTick, computed, provide, ref, useId } from "vue";
|
|
73
73
|
|
|
74
74
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
75
75
|
import ULink from "../ui.button-link/ULink.vue";
|
|
@@ -221,16 +221,15 @@ const props = defineProps({
|
|
|
221
221
|
|
|
222
222
|
const emit = defineEmits([
|
|
223
223
|
/**
|
|
224
|
-
* Triggers
|
|
224
|
+
* Triggers on dropdown option click.
|
|
225
225
|
* @property {string} value
|
|
226
226
|
*/
|
|
227
|
-
"
|
|
227
|
+
"clickOption",
|
|
228
228
|
]);
|
|
229
229
|
|
|
230
230
|
provide("hideDropdownOptions", hideOptions);
|
|
231
231
|
|
|
232
232
|
const isShownOptions = ref(false);
|
|
233
|
-
const selectedItem = ref("");
|
|
234
233
|
const dropdownListRef = ref(null);
|
|
235
234
|
|
|
236
235
|
const elementId = props.id || useId();
|
|
@@ -250,10 +249,6 @@ const iconSize = computed(() => {
|
|
|
250
249
|
return sizes[props.size];
|
|
251
250
|
});
|
|
252
251
|
|
|
253
|
-
watch(selectedItem, () => {
|
|
254
|
-
emit("select", selectedItem.value);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
252
|
function onClickLink() {
|
|
258
253
|
isShownOptions.value = !isShownOptions.value;
|
|
259
254
|
|
|
@@ -269,4 +264,8 @@ function hideOptions() {
|
|
|
269
264
|
function onClickList() {
|
|
270
265
|
hideOptions();
|
|
271
266
|
}
|
|
267
|
+
|
|
268
|
+
function onClickOption(option) {
|
|
269
|
+
emit("clickOption", option);
|
|
270
|
+
}
|
|
272
271
|
</script>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
v-if="!(option && (option.groupLabel || option.isSubGroup)) && !option.isHidden"
|
|
24
24
|
v-bind="optionAttrs"
|
|
25
25
|
:class="optionHighlight(index, option)"
|
|
26
|
-
@click="select(option)"
|
|
26
|
+
@click="select(option), onClickOption(option), option.onClick(option)"
|
|
27
27
|
@mouseenter.self="pointerSet(index)"
|
|
28
28
|
>
|
|
29
29
|
<!--
|
|
@@ -98,8 +98,6 @@
|
|
|
98
98
|
</template>
|
|
99
99
|
</ul>
|
|
100
100
|
</div>
|
|
101
|
-
|
|
102
|
-
<!-- {{ !options.length }} -->
|
|
103
101
|
</template>
|
|
104
102
|
|
|
105
103
|
<script setup>
|
|
@@ -204,6 +202,10 @@ const emit = defineEmits([
|
|
|
204
202
|
* Triggers when option is added.
|
|
205
203
|
*/
|
|
206
204
|
"addOption",
|
|
205
|
+
/**
|
|
206
|
+
* Triggers on click option.
|
|
207
|
+
*/
|
|
208
|
+
"clickOption",
|
|
207
209
|
]);
|
|
208
210
|
|
|
209
211
|
const wrapperRef = ref(null);
|
|
@@ -299,8 +301,13 @@ function optionHighlight(index, option) {
|
|
|
299
301
|
function addPointerElement({ key } = "Enter") {
|
|
300
302
|
if (props.options.length > 0) {
|
|
301
303
|
select(props.options[pointer.value], key);
|
|
304
|
+
onClickOption(props.options[pointer.value]);
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
pointerReset();
|
|
305
308
|
}
|
|
309
|
+
|
|
310
|
+
function onClickOption(option) {
|
|
311
|
+
emit("clickOption", option);
|
|
312
|
+
}
|
|
306
313
|
</script>
|
|
@@ -76,3 +76,13 @@ MaxHeight.args = { maxHeight: 80 };
|
|
|
76
76
|
|
|
77
77
|
export const WithoutOptions = DefaultTemplate.bind({});
|
|
78
78
|
WithoutOptions.args = { options: [] };
|
|
79
|
+
|
|
80
|
+
export const OptionSettings = DefaultTemplate.bind({});
|
|
81
|
+
OptionSettings.args = {
|
|
82
|
+
options: [
|
|
83
|
+
{ label: "option 1", id: "1" },
|
|
84
|
+
{ label: "option 2", id: "2", isHidden: true },
|
|
85
|
+
// eslint-disable-next-line no-console
|
|
86
|
+
{ label: "option 3", id: "3", onClick: (option) => console.log("onClick option 3 ", option) },
|
|
87
|
+
],
|
|
88
|
+
};
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.364",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -3206,8 +3206,8 @@
|
|
|
3206
3206
|
],
|
|
3207
3207
|
"events": [
|
|
3208
3208
|
{
|
|
3209
|
-
"name": "
|
|
3210
|
-
"description": "Triggers
|
|
3209
|
+
"name": "clickOption",
|
|
3210
|
+
"description": "Triggers on dropdown option click.",
|
|
3211
3211
|
"properties": [
|
|
3212
3212
|
{
|
|
3213
3213
|
"type": [
|
|
@@ -3422,8 +3422,8 @@
|
|
|
3422
3422
|
],
|
|
3423
3423
|
"events": [
|
|
3424
3424
|
{
|
|
3425
|
-
"name": "
|
|
3426
|
-
"description": "Triggers
|
|
3425
|
+
"name": "clickOption",
|
|
3426
|
+
"description": "Triggers on dropdown option click.",
|
|
3427
3427
|
"properties": [
|
|
3428
3428
|
{
|
|
3429
3429
|
"type": [
|
|
@@ -3625,8 +3625,8 @@
|
|
|
3625
3625
|
],
|
|
3626
3626
|
"events": [
|
|
3627
3627
|
{
|
|
3628
|
-
"name": "
|
|
3629
|
-
"description": "Triggers
|
|
3628
|
+
"name": "clickOption",
|
|
3629
|
+
"description": "Triggers on dropdown option click.",
|
|
3630
3630
|
"properties": [
|
|
3631
3631
|
{
|
|
3632
3632
|
"type": [
|
|
@@ -3764,6 +3764,10 @@
|
|
|
3764
3764
|
{
|
|
3765
3765
|
"name": "addOption",
|
|
3766
3766
|
"description": "Triggers when option is added."
|
|
3767
|
+
},
|
|
3768
|
+
{
|
|
3769
|
+
"name": "clickOption",
|
|
3770
|
+
"description": "Triggers on click option."
|
|
3767
3771
|
}
|
|
3768
3772
|
],
|
|
3769
3773
|
"slots": [
|