Skip to content

Commit

Permalink
fix search panel issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ctf0 committed May 6, 2021
1 parent eec2df6 commit 831caac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
24 changes: 18 additions & 6 deletions src/resources/assets/js/components/globalSearch/panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,32 @@
<style scoped lang="scss" src="../../../sass/modules/global-search.scss"></style>

<script>
import Fuse from 'fuse.js'
import debounce from 'lodash/debounce'
import VueInputAutowidth from 'vue-input-autowidth'
import panels from '../../mixins/panels'
import VueInputAutowidth from 'vue-input-autowidth'
export default {
components: {
imageIntersect: require('./image.vue').default
},
directives: {
VueInputAutowidth
},
mixins : [panels],
props : [
props: [
'trans',
'fileTypeIs',
'noScroll',
'browserSupport',
'addToMovableList',
'inMovableList'
],
directives: {
autowidth: {
beforeMount : VueInputAutowidth.bind,
mounted : VueInputAutowidth.inserted,
updated : VueInputAutowidth.componentUpdated,
unmounted : VueInputAutowidth.unbind
}
},
mixins: [panels],
data() {
return {
filesIndex : [],
Expand Down Expand Up @@ -166,6 +172,8 @@ export default {
EventHub.listen('global-search-deleted', (path) => {
let list = this.filterdFilesList
console.log(list)
return list.some((e, i) => {
if (e.path == path) {
list.splice(i, 1)
Expand Down Expand Up @@ -199,6 +207,10 @@ export default {
if (search) {
this.filterdFilesList = this.fuseLib.search(search)
this.filterdFilesList = this.filterdFilesList.map((e) => {
return e.item
})
return this.noData = this.listCount ? false : true
}
Expand Down
6 changes: 5 additions & 1 deletion src/resources/assets/js/modules/filtration.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ export default {
},
fileTypeIs(item, val) {
let mimes = this.config.mimeTypes
let type = item.type || item
let type = item.hasOwnProperty('type')
? item.type
: item.hasOwnProperty('item')
? item.item.type
: item

if (type) {
if (val == 'image' && mimes.image.includes(type)) {
Expand Down

0 comments on commit 831caac

Please sign in to comment.