Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Change selection model on rightclick
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Aug 11, 2021
1 parent 7c4ed54 commit 41bae12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/table/OcTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:draggable="dragDrop"
@click.native="$emit(constants.EVENT_TROW_CLICKED, item)"
@contextmenu.native="
$emit(constants.EVENT_TROW_CONTEXTMENU, $refs[`row-${trIndex}`][0], $event)
$emit(constants.EVENT_TROW_CONTEXTMENU, $refs[`row-${trIndex}`][0], $event, item)
"
@hook:mounted="$emit(constants.EVENT_TROW_MOUNTED, item, $refs[`row-${trIndex}`][0])"
@dragstart.native.stop="dragStart(item)"
Expand Down
20 changes: 9 additions & 11 deletions src/components/table/OcTableFiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
class="oc-table-files-btn-action-dropdown"
appearance="raw"
@click.stop.prevent="
resetDropPosition(`context-menu-drop-ref-${item.id.replace(/=+/, '')}`, $event)
resetDropPosition(`context-menu-drop-ref-${item.id.replace(/=+/, '')}`, $event, item)
"
>
<oc-icon name="more_vert" />
Expand Down Expand Up @@ -390,21 +390,19 @@ export default {
this.$emit("select", this.selection)
}
},
resetDropPosition(id, event) {
resetDropPosition(id, event, item) {
const instance = this.$refs[id].tippy
if (instance === undefined) {
return
}
if (instance === undefined) return
this.fileClicked(item)
this.displayPositionedDropdown(instance, event)
},
showContextMenu(rows, event) {
showContextMenu(row, event, item) {
event.preventDefault()
const instance = rows.$el.getElementsByClassName("oc-table-files-btn-action-dropdown")[0]
if (instance === undefined) {
return
}
const instance = row.$el.getElementsByClassName("oc-table-files-btn-action-dropdown")[0]
if (instance === undefined) return
this.fileClicked(item)
this.displayPositionedDropdown(instance._tippy, event)
},
Expand Down Expand Up @@ -442,7 +440,7 @@ export default {
* Triggered when the showDetails button in the actions column is clicked
* @property {object} resource The resource for which the event is triggered
*/
this.emitSelect([resource])
this.fileClicked(resource)
this.$emit("showDetails")
},
formatDate(date) {
Expand Down

0 comments on commit 41bae12

Please sign in to comment.