Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonL9vov committed Apr 18, 2024
1 parent 570430c commit cff0b96
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue3-hive-ui-kit",
"private": false,
"version": "0.7.17",
"version": "0.7.18",
"type": "module",
"description": "UI kit for Vue 3",
"files": [
Expand Down
5 changes: 3 additions & 2 deletions src/common/hooks/use-list-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const useListMethods = ({

const updateActiveValue = (value: Value) => {
activeValue.value = value;
let element = menuRef.value?.querySelector(`[data-value='${value}']`);
let element = menuRef.value?.querySelector(`[data-value='${JSON.stringify(value)}']`);
if (element) {
(element as unknown as HTMLElement).scrollIntoView({
behavior: 'smooth',
Expand Down Expand Up @@ -158,8 +158,9 @@ export const useListMethods = ({
const setFirstActiveValue = () => {
for (const key of filteredOptions.value.keys()) {
updateActiveValue(key);
break;
return;
}
updateActiveValue(null);
};

return {
Expand Down
9 changes: 7 additions & 2 deletions src/components/hive-multiselect/hive-multiselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const changeValue = (value: Value) => {
}
searchQuery.value = '';
onUpdateModelValue<Value[]>(emit, currentValue.value);
setFirstActiveValue();
};
const deleteLast = (value: Value) => {
Expand Down Expand Up @@ -130,7 +131,7 @@ watch(
filteredOptions.value = res.filteredOptions.value;
current.value = res.current.value;
activeValue.value = res.activeValue.value;
res.setFirstActiveValue();
setFirstActiveValue();
},
{ deep: true },
);
Expand All @@ -149,6 +150,10 @@ watch(searchQuery, () => {
setFirstActiveValue();
});
watch(filteredOptions, () => {
setFirstActiveValue();
});
const computedPlaceholder = computed(() =>
current.value ? String(current.value[props.titleField]) : props.isPlaceholderSeenWithValues ? props.placeholder : '',
);
Expand Down Expand Up @@ -222,7 +227,7 @@ onMounted(() => {
@click="changeValue(item[1][valueField])"
@mouseover="updateActiveValue(item[1][valueField])"
@mousedown.prevent
:data-value="item[1][valueField]"
:data-value="JSON.stringify(item[1][valueField])"
>
{{ item[1][titleField] ?? nullTitle }}
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/examples/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ const a = 1;
</script>

<template>
<hive-splitter style="min-height: 100vh">
<!-- <hive-splitter style="min-height: 100vh">
<hive-pane id="light">
<all-widgets />
</hive-pane>
<!-- <hive-pane id="dark">
<hive-pane id="dark">
<div hive-theme="dark" style="background: black; color: white">
<all-widgets dark />
</div>
</hive-pane> -->
</hive-splitter>
<!-- <div>
</hive-pane>
</hive-splitter> -->
<div>
<filter-new />
</div> -->
</div>
</template>

<style lang="scss"></style>
2 changes: 1 addition & 1 deletion src/examples/stores/cityhaze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const _useFilterStore = defineStore('filter', () => {
{ name: 'мини-конкурс', value: 'миниконкурс' },
{ name: 'Игра в одиноком октябре', value: 'Игра_в_одиноком_октябре' },
]);
const categoriesValues: Ref<string[]> = ref([]);
const categoriesValues: Ref<string[]> = ref(['стихи', 'мнимая_проза', 'Игра_в_одиноком_октябре', 'ночной_эфир']);

const authorsOptions: Ref<PostAuthor[]> = ref([]);
const authorsValues: Ref<string[]> = ref([]);
Expand Down

0 comments on commit cff0b96

Please sign in to comment.