Skip to content

Commit

Permalink
Merge pull request #15 from uncaughtxcptn/feature/data-table-enhancem…
Browse files Browse the repository at this point in the history
…ents

Inspector page enhancements
  • Loading branch information
emanlodovice committed Jun 7, 2020
2 parents e828de5 + d4f6c36 commit 5471979
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
36 changes: 21 additions & 15 deletions src/components/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<td></td>
</tr>

<DataTableInsertRow @create="setValue" />
<DataTableInsertRow @create="handleCreate" />
</tbody>
</table>
</template>
Expand All @@ -44,7 +44,17 @@ export default {
}
},
methods: mapActions(['setValue', 'deleteKey'])
methods: {
...mapActions(['setValue', 'deleteKey']),
async handleCreate(data) {
await this.setValue(data);
// Scroll to last row in the table
const element = document.scrollingElement;
element.scrollTop = element.scrollHeight;
}
}
};
</script>

Expand All @@ -53,32 +63,28 @@ table {
width: 100%;
min-height: 100vh;
border-collapse: collapse;
}
thead tr {
border-bottom: 1px solid #bbbbbb;
background-color: #f2f2f2;
position: relative;
}
.data-table-row:not(.editing):nth-child(2n) {
background-color: #f0f4ff;
}
th {
font-weight: 400;
}
th {
height: 2.67em;
padding: 0 2em;
font-size: 0.75em;
font-weight: 400;
text-align: left;
max-width: 0; /* required for ellipsis overflow to work */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: sticky;
top: 0;
background-color: #f2f2f2;
/* Here we're using an inset shadow instead of a bottom border to achieve the
same effect. This is to prevent the border from disappearing when the
table cells become sticky. */
box-shadow: inset 0 -1px 0 0 #bbbbbb;
}
th:first-child,
Expand Down
10 changes: 8 additions & 2 deletions src/components/DataTableInsertRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,22 @@ td:first-child {
td {
height: 2.67em;
border-top: 1px solid #bbb;
font-size: 0.75em;
text-align: left;
background-color: #f2f2f2;
max-width: 0; /* required for ellipsis overflow to work */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: sticky;
bottom: 0;
background-color: #f2f2f2;
/* Here we're using an inset shadow instead of a top border to achieve the
same effect. This is to prevent the border from disappearing when the
table cells become sticky. */
box-shadow: inset 0 1px 0 0 #bbbbbb;
}
tr:not(.creating) td {
Expand Down

0 comments on commit 5471979

Please sign in to comment.