fix: refs #7404 sticky footer and transparent header for vnTable

This commit is contained in:
Pablo Natek 2024-09-30 09:46:00 +02:00
parent a2b7e81982
commit cb0d3c5bca
4 changed files with 41 additions and 41 deletions

View File

@ -44,7 +44,6 @@ const itemComputed = computed(() => {
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.q-item { .q-item {
min-height: 5vh; min-height: 5vh;

View File

@ -73,7 +73,6 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
hasSubToolbar: { hasSubToolbar: {
type: Boolean, type: Boolean,
default: null, default: null,
@ -685,17 +684,15 @@ function handleOnDataSaved(_) {
</QCard> </QCard>
</component> </component>
</template> </template>
<template #bottom-row="{ cols }" v-if="footer"> <template #bottom-row="{ cols }" v-if="$props.footer">
<QTr v-if="rows.length" class="bg-header" style="height: 30px"> <QTr v-if="rows.length" style="height: 30px">
<QTh <QTh
v-for="col of cols.filter((cols) => cols.visible ?? true)" v-for="col of cols.filter((cols) => cols.visible ?? true)"
:key="col?.id" :key="col?.id"
class="text-center" class="text-center"
:class="getColAlign(col)"
> >
<slot <slot :name="`column-footer-${col.name}`" />
:name="`column-footer-${col.name}`"
:class="getColAlign(col)"
/>
</QTh> </QTh>
</QTr> </QTr>
</template> </template>
@ -774,16 +771,6 @@ es:
color: var(--vn-text-color); color: var(--vn-text-color);
} }
.q-table--dark .q-table__bottom,
.q-table--dark thead,
.q-table--dark tr {
border-color: var(--vn-section-color);
}
.q-table__container > div:first-child {
background-color: var(--vn-page-color);
}
.grid-three { .grid-three {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, max-content)); grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
@ -857,6 +844,15 @@ es:
background-color: var(--vn-section-color); background-color: var(--vn-section-color);
z-index: 1; z-index: 1;
} }
table tbody th {
position: relative;
}
tbody:nth-last-child(1) {
@extend .bg-header;
position: sticky;
z-index: 2;
bottom: 0;
}
} }
.vn-label-value { .vn-label-value {
@ -903,12 +899,12 @@ es:
user-select: all; user-select: all;
} }
.full-width-slot { .q-table__container.q-table--horizontal-separator.column.no-wrap.q-table__card.q-table__card--dark.q-dark.q-table--flat.q-table--dark.q-table--no-wrap.vnTable,
width: 100%; .q-table__container.q-table--horizontal-separator.column.no-wrap.q-table__card.q-table--flat.q-table--no-wrap.vnTable {
display: flex; background-color: transparent;
text-align: center; }
color: var(--vn-text-color);
margin-bottom: -1%; .q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
background-color: var(--vn-header-color); background-color: var(--vn-section-color);
} }
</style> </style>

View File

@ -47,7 +47,7 @@ const columns = [
}, },
}, },
{ {
align: 'left', align: 'center',
label: t('Reserve'), label: t('Reserve'),
name: 'reserve', name: 'reserve',
columnFilter: false, columnFilter: false,
@ -141,6 +141,10 @@ function setFooter(data) {
}); });
tableRef.value.footer = footer; tableRef.value.footer = footer;
} }
function round(value) {
return Math.round(value * 100) / 100;
}
</script> </script>
<template> <template>
<VnSubToolbar> <VnSubToolbar>
@ -152,7 +156,9 @@ function setFooter(data) {
:filter="filter" :filter="filter"
@on-fetch=" @on-fetch="
(data) => { (data) => {
travel = data.find((data) => data.warehouseIn.code === 'VNH'); travel = data.find(
(data) => data.warehouseIn.code.toLowerCase() === 'vnh'
);
} }
" "
/> />
@ -205,8 +211,9 @@ function setFooter(data) {
/> />
</template> </template>
</RightMenu> </RightMenu>
<div class="table-container"> <div class="table-container">
<QPage class="column items-center q-pa-md"> <div class="column items-center">
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="StockBoughts" data-key="StockBoughts"
@ -228,6 +235,7 @@ function setFooter(data) {
:columns="columns" :columns="columns"
:user-params="userParams" :user-params="userParams"
:footer="true" :footer="true"
table-height="80vh"
auto-load auto-load
> >
<template #column-workerFk="{ row }"> <template #column-workerFk="{ row }">
@ -243,7 +251,7 @@ function setFooter(data) {
</template> </template>
<template #column-footer-reserve> <template #column-footer-reserve>
<span> <span>
{{ tableRef.footer.reserve }} {{ round(tableRef.footer.reserve) }}
</span> </span>
</template> </template>
<template #column-footer-bought> <template #column-footer-bought>
@ -253,11 +261,11 @@ function setFooter(data) {
tableRef.footer.reserve < tableRef.footer.bought, tableRef.footer.reserve < tableRef.footer.bought,
}" }"
> >
{{ tableRef.footer.bought }} {{ round(tableRef.footer.bought) }}
</span> </span>
</template> </template>
</VnTable> </VnTable>
</QPage> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -272,7 +280,7 @@ function setFooter(data) {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 40%; width: 45%;
} }
.text-negative { .text-negative {
color: $negative !important; color: $negative !important;

View File

@ -77,18 +77,10 @@ const columns = [
:columns="columns" :columns="columns"
:right-search="false" :right-search="false"
:disable-infinite-scroll="true" :disable-infinite-scroll="true"
:disable-option="{ card: true }"
:limit="0" :limit="0"
auto-load auto-load
> >
<template #top-left>
<QBtn
flat
icon="Close"
color="primary"
class="bg-vn-section-color q-pa-xs"
v-close-popup
/>
</template>
<template #column-entryFk="{ row }"> <template #column-entryFk="{ row }">
<span class="link"> <span class="link">
{{ row?.entryFk }} {{ row?.entryFk }}
@ -112,6 +104,11 @@ const columns = [
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin: auto; margin: auto;
background-color: var(--vn-section-color);
padding: 4px;
}
.container > div > div > .q-table__top.relative-position.row.items-center {
background-color: red !important;
} }
</style> </style>
<i18n> <i18n>