feat: add list rendering to table cells

This commit is contained in:
Sebin Nyshkim 2022-01-11 13:29:45 +01:00
parent 64ff5792c9
commit 464c6eaf42

View file

@ -19,7 +19,21 @@
:key="idx" :key="idx"
:colspan="idx === 1 && !isHexValue(row[1]) ? 2 : 1" :colspan="idx === 1 && !isHexValue(row[1]) ? 2 : 1"
> >
<template v-if="Array.isArray(cell)">
<ul
:class="[
cell.length > 11 ? 'col-3' : cell.length > 4 ? 'col-2' : '',
]"
>
<li v-for="(item, idx) in cell" :key="idx">
{{ item }}
</li>
</ul>
</template>
<template v-else>
{{ cell }} {{ cell }}
</template>
</td> </td>
<td <td
v-if="isHexValue(row[1])" v-if="isHexValue(row[1])"
@ -49,7 +63,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
@import "@/scss/_variables.scss"; @import "@/scss/base.scss";
.datatable { .datatable {
border-collapse: collapse; border-collapse: collapse;
@ -64,6 +78,26 @@ export default {
@media (min-width: 35em) { @media (min-width: 35em) {
padding: 0.5em 1em; padding: 0.5em 1em;
} }
ul {
margin: 0;
padding: 0;
@media (min-width: 40em) {
&.col-2 {
columns: 2 auto;
}
&.col-3 {
columns: 3 auto;
}
}
}
li {
margin: 0 0 0 1em;
padding: 0;
}
} }
&__body { &__body {