Create VnTable and use it
gitea/hedera-web/pipeline/pr-4922-vueMigration This commit looks good Details

This commit is contained in:
William Buezas 2024-08-14 09:08:46 -03:00
parent b728ecaf29
commit f36eb1bd88
3 changed files with 82 additions and 62 deletions

View File

@ -0,0 +1,39 @@
<script setup>
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const props = defineProps({
noDataLabel: {
type: String,
default: ''
},
hideBottom: {
type: Boolean,
default: true
},
rowsPerPageOptions: {
type: Array,
default: () => [0]
}
});
</script>
<template>
<QTable
v-bind="$attrs"
:no-data-label="props.noDataLabel || t('noInvoicesFound')"
:hide-bottom="props.hideBottom"
:rows-per-page-options="props.rowsPerPageOptions"
table-header-class="vnTable-header-default"
>
<slot />
</QTable>
</template>
<style lang="scss">
.vnTable-header-default {
background-color: $accent !important;
color: white;
}
</style>

View File

@ -2,6 +2,8 @@
import { ref, inject, onMounted, computed } from 'vue'; import { ref, inject, onMounted, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnTable from 'src/components/ui/VnTable.vue';
const jApi = inject('jApi'); const jApi = inject('jApi');
const { t } = useI18n(); const { t } = useI18n();
@ -53,32 +55,15 @@ onMounted(() => getPackages());
<template> <template>
<QPage class="flex justify-center q-pa-md"> <QPage class="flex justify-center q-pa-md">
<QTable <VnTable
:columns="columns" :columns="columns"
:rows="packages" :rows="packages"
:loading="loading" :loading="loading"
class="q-mt-lg" style="height: max-content; max-width: 100%"
style="max-width: 100%; height: max-content" />
table-header-class="packages-table-header"
hide-bottom
>
<template #body-cell-id="{ row }">
<QTd auto-width @click.stop>
<QBtn flat color="blue">{{ row.id }}</QBtn>
<ItemDescriptorProxy :id="row.id" />
</QTd>
</template>
</QTable>
</QPage> </QPage>
</template> </template>
<style lang="scss">
.packages-table-header {
background-color: $accent !important;
color: white;
}
</style>
<i18n lang="yaml"> <i18n lang="yaml">
en-US: en-US:
agency: Agency agency: Agency

View File

@ -2,6 +2,8 @@
import { ref, onMounted, inject, computed } from 'vue'; import { ref, onMounted, inject, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnTable from 'src/components/ui/VnTable.vue';
import { currency } from 'src/lib/filters.js'; import { currency } from 'src/lib/filters.js';
import { date as qdate } from 'quasar'; import { date as qdate } from 'quasar';
import { userStore as useUserStore } from 'stores/user'; import { userStore as useUserStore } from 'stores/user';
@ -80,15 +82,10 @@ onMounted(async () => {
/> />
</Teleport> </Teleport>
<div class="vn-w-sm"> <div class="vn-w-sm">
<QCard> <VnTable
<!-- -->
<QTable
:columns="columns" :columns="columns"
:rows="invoices" :rows="invoices"
:no-data-label="t('noInvoicesFound')"
row-key="id"
:hide-header="!invoices.length" :hide-header="!invoices.length"
:rows-per-page-options="[0]"
> >
<template #body-cell-hasPdf="{ row }"> <template #body-cell-hasPdf="{ row }">
<QTd <QTd
@ -121,8 +118,7 @@ onMounted(async () => {
</QIcon> </QIcon>
</QTd> </QTd>
</template> </template>
</QTable> </VnTable>
</QCard>
</div> </div>
</template> </template>