Skip to content

Commit

Permalink
removed vue-click-outside
Browse files Browse the repository at this point in the history
  • Loading branch information
theorm committed Jun 6, 2024
1 parent 4345404 commit cae8db4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"vee-validate": "3.2.4",
"vue": "2.7.14",
"vue-awesome": "4.0.2",
"vue-click-outside": "1.0.7",
"vue-flatpickr-component": "8.1.5",
"vue-gtag": "1.1.2",
"vue-i18n": "8.15.3",
Expand Down
18 changes: 13 additions & 5 deletions src/components/Autocomplete.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<section class="search-bar" v-ClickOutside="hideSuggestions">
<section class="search-bar" ref="autocomplete">
<div class="input-group">
<b-form-input
:class="`search-input ${showSuggestions ? 'has-suggestions' : ''}`"
Expand All @@ -12,6 +12,7 @@
/>
<div class="input-group-append">
<button type="button" class="btn btn-outline-primary"
ref="searchButton"
:title="$tc('placeholder.search', filterCount)"
@click="submit({ type: 'string', q })"
>
Expand Down Expand Up @@ -105,12 +106,13 @@
</template>

<script>
import ClickOutside from 'vue-click-outside'
import { ref } from 'vue'
import { mapStores } from 'pinia'
import FilterFactory from '@/models/FilterFactory'
import { useAutocompleteStore } from '@/stores/autocomplete'
import { useUserStore } from '@/stores/user'
import Explorer from './Explorer'
import { useClickOutside } from '@/composables/useClickOutside'
const AVAILABLE_TYPES = ['mention', 'newspaper', 'topic', 'location', 'person', 'collection']
Expand Down Expand Up @@ -151,6 +153,15 @@ export default {
default: () => [],
},
},
beforeMount() {
const autocomplete = ref(this.$refs.autocomplete)
const button = ref(this.$refs.searchButton)
useClickOutside(
autocomplete,
() => this.hideSuggestions(),
button,
)
},
computed: {
...mapStores(useAutocompleteStore, useUserStore),
user() {
Expand Down Expand Up @@ -376,9 +387,6 @@ export default {
components: {
Explorer,
},
directives: {
ClickOutside,
},
}
</script>

Expand Down

0 comments on commit cae8db4

Please sign in to comment.