Improvements :)

This commit is contained in:
Henrique Dias committed 2017-06-28 22:20:28 +01:00
1 parent 7aa6a549f9
commit 84ddad027f
21 files changed
+467 -445

No files matched your search

+9 -10
View File
@@ -33,7 +33,10 @@ import array from '../array.js'
export default {
name: 'item',
props: ['name', 'isDir', 'url', 'type', 'size', 'modified', 'selected'],
props: ['name', 'isDir', 'url', 'type', 'size', 'modified', 'index'],
data: function () {
return window.info.listing
},
methods: {
icon: function () {
if (this.isDir) return 'folder'
@@ -97,22 +100,18 @@ export default {
})
this.selected.length = 0
// listing.handleSelectionChange()
return false
},
click: function (event) {
let el = event.currentTarget
if (this.selected.length !== 0) event.preventDefault()
if (this.selected.indexOf(el.id) === -1) {
if (this.selected.indexOf(this.index) === -1) {
if (!event.ctrlKey && !this.multiple) this.unselectAll()
el.setAttribute('aria-selected', true)
this.selected.push(el.id)
this.$el.setAttribute('aria-selected', true)
this.selected.push(this.index)
} else {
el.setAttribute('aria-selected', false)
this.selected = array.remove(this.selected, el.id)
this.$el.setAttribute('aria-selected', false)
this.selected = array.remove(this.selected, this.index)
}
// this.handleSelectionChange()