Move table cell selection to table cell component (#2436)

This commit is contained in:
Andrew Henry 2019-07-31 10:08:27 -07:00 committed by Deep Tailor
parent 97230bb21f
commit e6a7b4ed6c
3 changed files with 34 additions and 2 deletions

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
<template>
<td>{{formattedValue}}</td>
<td @click="selectCell($event.currentTarget, columnKey)">{{formattedValue}}</td>
</template>
<script>
export default {
@ -33,11 +33,38 @@ export default {
columnKey: {
type: String,
require: true
},
objectPath: {
type: Array,
require: false
}
},
methods: {
selectCell(element, columnKey) {
if (this.isSelectable) {
this.openmct.selection.select([{
element: element,
context: {
type: 'table-cell',
row: this.row.objectKeyString,
column: columnKey
}
},{
element: this.openmct.layout.$refs.browseObject.$el,
context: {
item: this.objectPath[0]
}
}], false);
event.stopPropagation();
}
},
},
computed: {
formattedValue() {
return this.row.getFormattedValue(this.columnKey);
},
isSelectable() {
return this.row.columns[this.columnKey].selectable;
}
}
};

View File

@ -34,7 +34,7 @@
:style="columnWidths[key] === undefined ? {} : { width: columnWidths[key] + 'px', 'max-width': columnWidths[key] + 'px'}"
:title="formattedRow[key]"
:class="[cellLimitClasses[key], selectableColumns[key] ? 'is-selectable' : '']"
@click="selectCell($event.currentTarget, key)"
:objectPath="objectPath"
:row="row">
</component>
</tr>
@ -86,6 +86,10 @@ export default {
type: Object,
required: true
},
objectPath: {
type: Array,
required: false
},
rowIndex: {
type: Number,
required: false,

View File

@ -120,6 +120,7 @@
:headers="headers"
:columnWidths="columnWidths"
:rowIndex="rowIndex"
:objectPath="objectPath"
:rowOffset="rowOffset"
:rowHeight="rowHeight"
:row="row"