0
0
Fork 0

feat: refs #6825 qchip color

This commit is contained in:
Alex Moreno 2024-05-02 15:01:54 +02:00
parent ed3c9db919
commit a75b33a824
3 changed files with 75 additions and 56 deletions

View File

@ -17,8 +17,8 @@ const $props = defineProps({
default: () => [], default: () => [],
}, },
defaultMode: { defaultMode: {
type: String, // 'table', 'list', 'card 2/3' type: String,
default: 'list', default: 'list', // 'table', 'list', 'card'
}, },
reponsive: { reponsive: {
type: Boolean, type: Boolean,
@ -135,26 +135,32 @@ onMounted(() => {
/> />
</QTh> </QTh>
</template> </template>
<template #body-cell="{ row, col }"> <template #body-cell="{ row, col }">
<QTd auto-width :class="`text-${col.align ?? 'left'}`"> <QTd auto-width :class="`text-${col.align ?? 'left'}`">
<VnTableColumn :column="col" :row /> <VnTableColumn :column="col" :row />
</QTd> </QTd>
</template> </template>
<template #item="{ row, cols, colsMap }"> <template #item="{ row, colsMap }">
<TransitionGroup name="grid" tag="div" class="grid">
<QCard bordered flat> <QCard bordered flat>
<QCardSection horizontal> <QCardSection horizontal>
<span <span v-for="(col, index) of colsMap" :key="col.field">
v-for="(prop, index) of Object.entries(row)" {{ index }}
:key="index"
>
<QChip <QChip
color="primary-light" :class="
col.color
? col.color(row)
: col.isId == 1
? 'bg-primary-light'
: 'bg-secondary'
"
square square
v-if="cols[index]?.isId" v-if="col.isId"
:title="t(cols[index].label)" :title="t(col.label)"
class="no-margin" class="no-margin"
> >
{{ prop[1] }} {{ row[col.field] }}
</QChip> </QChip>
</span> </span>
</QCardSection> </QCardSection>
@ -178,7 +184,8 @@ onMounted(() => {
</div> </div>
<div v-if="colsMap.tableActions" class="column"> <div v-if="colsMap.tableActions" class="column">
<QBtn <QBtn
v-for="(btn, index) of colsMap.tableActions.actions" v-for="(btn, index) of colsMap.tableActions
.actions"
:key="index" :key="index"
:title="btn.title" :title="btn.title"
:icon="btn.icon" :icon="btn.icon"
@ -191,6 +198,7 @@ onMounted(() => {
</div> </div>
</QCardSection> </QCardSection>
</QCard> </QCard>
</TransitionGroup>
</template> </template>
</QTable> </QTable>
</template> </template>
@ -204,6 +212,11 @@ onMounted(() => {
background-color: var(--primary-light); background-color: var(--primary-light);
color: var(--vn-section-color); color: var(--vn-section-color);
} }
.bg-secondary {
background-color: var(--vn-page-color);
color: var(--vn-text-colo);
}
.text-primary-light { .text-primary-light {
color: var(--primary-light); color: var(--primary-light);
} }
@ -260,6 +273,17 @@ onMounted(() => {
grid-gap: 10px; grid-gap: 10px;
} }
// WIP TRANSITIONS
// .grid-item {
// background-color: red;
// transition: all 500ms ease;
// }
// .grid-move {
// background-color: #6b7280 !important;
// transform: scale(0.9);
// }
.divisor-line { .divisor-line {
height: 1px; height: 1px;
background-color: var(--vn-section-color); background-color: var(--vn-section-color);

View File

@ -192,12 +192,6 @@ defineExpose({ fetch, addFilter });
<QSpinner color="orange" size="md" /> <QSpinner color="orange" size="md" />
</div> </div>
</QInfiniteScroll> </QInfiniteScroll>
<div
v-if="!isLoading && store.hasMoreData"
class="w-full flex justify-center q-mt-md"
>
<QBtn color="primary" :label="t('Load more data')" @click="paginate()" />
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -271,13 +271,14 @@ const columns = computed(() => [
field: 'id', field: 'id',
label: t('customer.extendedList.tableVisibleColumns.id'), label: t('customer.extendedList.tableVisibleColumns.id'),
name: 'id', name: 'id',
isId: true, isId: 1,
}, },
{ {
align: 'left', align: 'left',
field: 'name', field: 'name',
label: t('customer.extendedList.tableVisibleColumns.name'), label: t('customer.extendedList.tableVisibleColumns.name'),
name: 'name', name: 'name',
isId: 2,
}, },
{ {
align: 'left', align: 'left',