Vista table sync (#2423)

* Working version of integrated tables

* Fixed bug with multi-composition in tables

* Changes to support tables from VISTA
This commit is contained in:
Andrew Henry
2019-06-25 13:56:39 -07:00
committed by Deep Tailor
parent 884aec8ea0
commit f1494fd285
10 changed files with 166 additions and 47 deletions

View File

@@ -20,12 +20,18 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
<template>
<tr :style="{ top: rowTop }" :class="rowLimitClass">
<td v-for="(title, key) in headers"
<tr :style="{ top: rowTop }" :class="rowClass">
<component
v-for="(title, key) in headers"
:key="key"
:is="componentList[key]"
:columnKey="key"
:style="columnWidths[key] === undefined ? {} : { width: columnWidths[key] + 'px', 'max-width': columnWidths[key] + 'px'}"
:title="formattedRow[key]"
:class="cellLimitClasses[key]">{{formattedRow[key]}}</td>
:class="cellLimitClasses[key]"
class="is-selectable"
@click="selectCell($event.currentTarget, key)"
:row="row"></component>
</tr>
</template>
@@ -33,13 +39,19 @@
</style>
<script>
import TableCell from './table-cell.vue';
export default {
data: function () {
return {
rowTop: (this.rowOffset + this.rowIndex) * this.rowHeight + 'px',
formattedRow: this.row.getFormattedDatum(this.headers),
rowLimitClass: this.row.getRowLimitClass(),
cellLimitClasses: this.row.getCellLimitClasses()
rowClass: this.row.getRowClass(),
cellLimitClasses: this.row.getCellLimitClasses(),
componentList: Object.keys(this.headers).reduce((components, header) => {
components[header] = this.row.getCellComponentName(header) || 'table-cell';
return components
}, {})
}
},
props: {
@@ -77,8 +89,25 @@ export default {
},
formatRow: function (row) {
this.formattedRow = row.getFormattedDatum(this.headers);
this.rowLimitClass = row.getRowLimitClass();
this.rowClass = row.getRowClass();
this.cellLimitClasses = row.getCellLimitClasses();
},
selectCell(element, columnKey) {
//TODO: This is a hack. Cannot get parent this way.
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.openmct.router.path[0]
}
}], false);
event.stopPropagation();
}
},
// TODO: use computed properties
@@ -88,6 +117,9 @@ export default {
handler: 'formatRow',
deep: false
}
},
components: {
TableCell
}
}
</script>