mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
- SearchBar.vue refactored
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
"/chunks/files~chunks/platform~chunks/shared~chunks/shared-files~chunks/shared/file-browser.js": "/chunks/files~chunks/platform~chunks/shared~chunks/shared-files~chunks/shared/file-browser.js?id=c24a48c0af1929dfb4b6",
|
||||
"/chunks/files~chunks/platform~chunks/shared~chunks/shared-files~chunks/shared/file-browser~chunks/sha~8510f6c9.js": "/chunks/files~chunks/platform~chunks/shared~chunks/shared-files~chunks/shared/file-browser~chunks/sha~8510f6c9.js?id=ac54ac828e9a8667410f",
|
||||
"/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared/file-browser~chunks/user~9058a49f.js": "/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared/file-browser~chunks/user~9058a49f.js?id=a0dd218c154e83af8dee",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.js?id=c691649626200a8d505d",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.js?id=0de1be6a94d058c8dc47",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser~chunks/shared/single-file.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser~chunks/shared/single-file.js?id=7f84c4b09fcf5b890775",
|
||||
"/chunks/files~chunks/shared/file-browser.js": "/chunks/files~chunks/shared/file-browser.js?id=ff8043fe2c43e13a74e2",
|
||||
"/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=daaffc43387587cf4b57",
|
||||
@@ -344,5 +344,41 @@
|
||||
"/chunks/platform.9e7738e5f5875041d4a3.hot-update.js": "/chunks/platform.9e7738e5f5875041d4a3.hot-update.js",
|
||||
"/chunks/admin~chunks/platform~chunks/shared.c6c4ee94a52674f7a19e.hot-update.js": "/chunks/admin~chunks/platform~chunks/shared.c6c4ee94a52674f7a19e.hot-update.js",
|
||||
"/chunks/admin~chunks/platform.2b7aba86eb436dd15e06.hot-update.js": "/chunks/admin~chunks/platform.2b7aba86eb436dd15e06.hot-update.js",
|
||||
"/chunks/platform.867f74b98b09aba43464.hot-update.js": "/chunks/platform.867f74b98b09aba43464.hot-update.js"
|
||||
"/chunks/platform.867f74b98b09aba43464.hot-update.js": "/chunks/platform.867f74b98b09aba43464.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.50ae1ed9713ed053513a.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.50ae1ed9713ed053513a.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.a52c64c3336241820f95.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.a52c64c3336241820f95.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.6ab4c57c49357b7a58f0.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.6ab4c57c49357b7a58f0.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.cd9ac75a864605bc994b.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.cd9ac75a864605bc994b.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.946cab66d3ce5155b092.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.946cab66d3ce5155b092.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.7112bbb72a914e173fbc.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.7112bbb72a914e173fbc.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.5e5ddefa62849b670e89.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.5e5ddefa62849b670e89.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.8e85e80e728e17d37cc3.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.8e85e80e728e17d37cc3.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.8b7d817da63704a6d967.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.8b7d817da63704a6d967.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.6aa6e724fa7656a41447.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.6aa6e724fa7656a41447.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.5bf2e671096925366c70.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.5bf2e671096925366c70.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.d6fdfe749713a5c7e3f2.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.d6fdfe749713a5c7e3f2.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.bb972fc06dc156bdd682.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.bb972fc06dc156bdd682.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.ce6f21e65b95fb853979.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.ce6f21e65b95fb853979.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.f243f536d658fa026310.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.f243f536d658fa026310.hot-update.js",
|
||||
"/chunks/app-language.6b1d83f2fc4a5c88b888.hot-update.js": "/chunks/app-language.6b1d83f2fc4a5c88b888.hot-update.js",
|
||||
"/chunks/app-language.8d2f2eb61e97d884ff5c.hot-update.js": "/chunks/app-language.8d2f2eb61e97d884ff5c.hot-update.js",
|
||||
"/chunks/app-language.a3f4a45c7477ed4f7881.hot-update.js": "/chunks/app-language.a3f4a45c7477ed4f7881.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.6372c80702eb5f8e5685.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.6372c80702eb5f8e5685.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.a1e5a855eb5b2af44a33.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.a1e5a855eb5b2af44a33.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.496f2a9d4bdab0954668.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.496f2a9d4bdab0954668.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.4ea5a5f692b187f47ef4.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.4ea5a5f692b187f47ef4.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.6fec2f84668a669fe383.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.6fec2f84668a669fe383.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.97ee8eeec20575442e31.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.97ee8eeec20575442e31.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.78eaba52fd608a7855f2.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.78eaba52fd608a7855f2.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.b941a0da4c1627be7dfa.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.b941a0da4c1627be7dfa.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.34d79bfa232b9e670eba.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.34d79bfa232b9e670eba.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.a79960c8cff3716445f5.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.a79960c8cff3716445f5.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.f51f02e41167bf924a3b.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.f51f02e41167bf924a3b.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.538a22b379624a39c5bd.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.538a22b379624a39c5bd.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.799ff0b934c364b95386.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.799ff0b934c364b95386.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.64a8b12dd77c7ff41629.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.64a8b12dd77c7ff41629.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.f30f0effe0ed431276b7.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.f30f0effe0ed431276b7.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.6d08cc1d6ae12826e50b.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.6d08cc1d6ae12826e50b.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.c0e3ef61fbdffb4b3709.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.c0e3ef61fbdffb4b3709.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared/file-browser.d43d2dd92a4c7f7792df.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared/file-browser.d43d2dd92a4c7f7792df.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div id="desktop-toolbar">
|
||||
<div class="toolbar-wrapper">
|
||||
|
||||
<!-- Go back-->
|
||||
<div class="toolbar-go-back" v-if="homeDirectory">
|
||||
<div @click="goBack" class="go-back-button">
|
||||
@@ -18,9 +19,10 @@
|
||||
|
||||
<!-- Tools-->
|
||||
<div class="toolbar-tools">
|
||||
|
||||
<!--Search bar-->
|
||||
<div class="toolbar-button-wrapper">
|
||||
<SearchBar/>
|
||||
<SearchBar v-model="query" @reset-query="query = ''" :placeholder="$t('inputs.placeholder_search_files')" />
|
||||
</div>
|
||||
|
||||
<!--Creating controls-->
|
||||
@@ -50,12 +52,12 @@
|
||||
<script>
|
||||
import ToolbarButtonUpload from '@/components/FilesView/ToolbarButtonUpload'
|
||||
import { ChevronLeftIcon, MoreHorizontalIcon } from 'vue-feather-icons'
|
||||
import SearchBar from '@/components/FilesView/SearchBar'
|
||||
import UploadProgress from '@/components/FilesView/UploadProgress'
|
||||
import ToolbarButton from '@/components/FilesView/ToolbarButton'
|
||||
import SearchBar from '@/components/FilesView/SearchBar'
|
||||
import {debounce, last} from 'lodash'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { events } from '@/bus'
|
||||
import { last } from 'lodash'
|
||||
|
||||
export default {
|
||||
name: 'ToolBar',
|
||||
@@ -77,10 +79,10 @@ export default {
|
||||
'homeDirectory'
|
||||
]),
|
||||
hasCapacity() {
|
||||
// Check if set storage limitation
|
||||
// Check if storage limitation is set
|
||||
if (!this.$store.getters.config.storageLimit) return true
|
||||
|
||||
// Check if is loaded user
|
||||
// Check if user is loaded
|
||||
if (!this.$store.getters.user) return true
|
||||
|
||||
// Check if user has storage
|
||||
@@ -137,7 +139,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sortingAndPreview: false
|
||||
sortingAndPreview: false,
|
||||
query: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -149,7 +152,28 @@ export default {
|
||||
if (!this.sortingAndPreview) {
|
||||
events.$emit('unClick')
|
||||
}
|
||||
}
|
||||
},
|
||||
query: debounce(function (value) {
|
||||
|
||||
if (this.query !== '' && typeof this.query !== 'undefined') {
|
||||
|
||||
this.$store.dispatch('getSearchResult', value)
|
||||
|
||||
} else if (typeof value !== 'undefined') {
|
||||
|
||||
if (this.currentFolder) {
|
||||
|
||||
// Get back after delete query to previously folder
|
||||
if (this.$isThisLocation('public')) {
|
||||
this.$store.dispatch('browseShared', [{folder: this.currentFolder, back: true, init: false}])
|
||||
} else {
|
||||
this.$store.dispatch('getFolder', [{folder: this.currentFolder, back: true, init: false}])
|
||||
}
|
||||
}
|
||||
|
||||
this.$store.commit('CHANGE_SEARCHING_STATE', false)
|
||||
}
|
||||
}, 300),
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
@@ -206,10 +230,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// events.$on('sortingAndPreview', (state) => {
|
||||
// this.sortingAndPreview = state
|
||||
// })
|
||||
|
||||
events.$on('unClick', () => {
|
||||
this.sortingAndPreview = false
|
||||
})
|
||||
|
||||
@@ -7,29 +7,29 @@
|
||||
<x-icon class="pointer" size="19" />
|
||||
</div>
|
||||
<input
|
||||
v-model="query"
|
||||
class="query focus-border-theme"
|
||||
type="text"
|
||||
name="query"
|
||||
:placeholder="$t('inputs.placeholder_search_files')"
|
||||
v-model="query"
|
||||
@input="$emit('input', query)"
|
||||
class="query focus-border-theme"
|
||||
type="text"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { SearchIcon, XIcon } from 'vue-feather-icons'
|
||||
import {mapGetters} from 'vuex'
|
||||
import {debounce} from 'lodash'
|
||||
import {SearchIcon, XIcon} from 'vue-feather-icons'
|
||||
import {events} from '@/bus'
|
||||
|
||||
export default {
|
||||
name: 'SearchBar',
|
||||
name: 'DesktopSearchBar',
|
||||
props: [
|
||||
'placeholder'
|
||||
],
|
||||
components: {
|
||||
SearchIcon,
|
||||
XIcon,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['currentFolder']),
|
||||
isQuery() {
|
||||
return this.query !== '' && typeof this.query !== 'undefined'
|
||||
}
|
||||
@@ -39,36 +39,14 @@
|
||||
query: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
query(val) {
|
||||
return this.getResult(val)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resetQuery() {
|
||||
this.query = ''
|
||||
},
|
||||
getResult: debounce(function (value) {
|
||||
if (this.isQuery) {
|
||||
// Get search result if query is not empty
|
||||
this.$store.dispatch('getSearchResult', value)
|
||||
} else if (typeof value !== 'undefined') {
|
||||
if (this.currentFolder) {
|
||||
|
||||
// Get back after delete query to previosly folder
|
||||
if ( this.$isThisLocation('public') ) {
|
||||
this.$store.dispatch('browseShared', [{folder: this.currentFolder, back: true, init: false}])
|
||||
} else {
|
||||
this.$store.dispatch('getFolder', [{folder: this.currentFolder, back: true, init: false}])
|
||||
}
|
||||
}
|
||||
|
||||
this.$store.commit('CHANGE_SEARCHING_STATE', false)
|
||||
}
|
||||
}, 300)
|
||||
this.$emit('reset-query')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
events.$on('clear-query', () => (this.query = undefined))
|
||||
events.$on('clear-query', () => this.query = undefined)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="menu-list-wrapper vertical">
|
||||
<a class="menu-list-item link" @click="goHome">
|
||||
<div class="icon">
|
||||
<home-icon size="17"></home-icon>
|
||||
<home-icon size="17"/>
|
||||
</div>
|
||||
<div class="label">
|
||||
{{ $t('sidebar.home') }}
|
||||
|
||||
Reference in New Issue
Block a user