melissa/templates: usa DataView pros templates do tenant
Substitui o <div class="mdt-grid"> v-for simples por <DataView> do PrimeVue na coluna "Seus documentos". Beneficios: - Paginacao automatica quando passa de 12 templates (era scroll infinito virando lento) - Slot #grid permite manter o layout de cards atual - Footer com paginator integrado ao design (border-top + bg transparente) CSS: - .mdt-dataview flex column ocupando o main - :deep(.p-dataview-content) flex 1 + overflow auto = scroll interno dos cards - :deep(.p-dataview-paginator-bottom) flex-shrink 0 = paginator sempre visivel no fundo - .mdt-main .mdt-grid passa a ter padding 12 e gap 10 (era herdado do .mdt-grid global) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import { useDocumentTemplates } from '@/features/documents/composables/useDocume
|
|||||||
import DocumentTemplateEditor from '@/features/documents/components/DocumentTemplateEditor.vue';
|
import DocumentTemplateEditor from '@/features/documents/components/DocumentTemplateEditor.vue';
|
||||||
// Button/Menu/Skeleton: auto via PrimeVueResolver
|
// Button/Menu/Skeleton: auto via PrimeVueResolver
|
||||||
import Menu from 'primevue/menu';
|
import Menu from 'primevue/menu';
|
||||||
|
import DataView from 'primevue/dataview';
|
||||||
|
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close']);
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
@@ -411,55 +412,66 @@ onMounted(() => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Grid dos templates do tenant -->
|
<!-- DataView dos templates do tenant — paginação + layout grid -->
|
||||||
<div v-else class="mdt-grid">
|
<DataView
|
||||||
<div
|
v-else
|
||||||
v-for="tpl in tenantTemplates"
|
:value="tenantTemplates"
|
||||||
:key="tpl.id"
|
layout="grid"
|
||||||
class="mdt-card mdt-card--tenant"
|
:paginator="tenantTemplates.length > 12"
|
||||||
role="button"
|
:rows="12"
|
||||||
tabindex="0"
|
class="mdt-dataview"
|
||||||
@click="openEdit(tpl)"
|
>
|
||||||
@keydown.enter.prevent="openEdit(tpl)"
|
<template #grid="slotProps">
|
||||||
>
|
<div class="mdt-grid">
|
||||||
<div class="mdt-card__head">
|
<div
|
||||||
<span class="mdt-card__icon mdt-card__icon--primary">
|
v-for="tpl in slotProps.items"
|
||||||
<i class="pi pi-file-edit" />
|
:key="tpl.id"
|
||||||
</span>
|
class="mdt-card mdt-card--tenant"
|
||||||
<div class="mdt-card__main">
|
role="button"
|
||||||
<div class="mdt-card__name">{{ tpl.nome_template }}</div>
|
tabindex="0"
|
||||||
<div class="mdt-card__tipo">{{ tipoLabel(tpl.tipo) }}</div>
|
@click="openEdit(tpl)"
|
||||||
<div v-if="tpl.descricao" class="mdt-card__desc">{{ tpl.descricao }}</div>
|
@keydown.enter.prevent="openEdit(tpl)"
|
||||||
|
>
|
||||||
|
<div class="mdt-card__head">
|
||||||
|
<span class="mdt-card__icon mdt-card__icon--primary">
|
||||||
|
<i class="pi pi-file-edit" />
|
||||||
|
</span>
|
||||||
|
<div class="mdt-card__main">
|
||||||
|
<div class="mdt-card__name">{{ tpl.nome_template }}</div>
|
||||||
|
<div class="mdt-card__tipo">{{ tipoLabel(tpl.tipo) }}</div>
|
||||||
|
<div v-if="tpl.descricao" class="mdt-card__desc">{{ tpl.descricao }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Menu de ações -->
|
||||||
|
<div class="mdt-card__menu" @click.stop>
|
||||||
|
<Button
|
||||||
|
icon="pi pi-ellipsis-v"
|
||||||
|
text
|
||||||
|
rounded
|
||||||
|
size="small"
|
||||||
|
class="!w-7 !h-7 mdt-card__menu-btn"
|
||||||
|
@click.stop="$refs[`menu_${tpl.id}`]?.[0]?.toggle($event)"
|
||||||
|
/>
|
||||||
|
<Menu
|
||||||
|
:ref="`menu_${tpl.id}`"
|
||||||
|
:model="getCardMenuItems(tpl)"
|
||||||
|
:popup="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mdt-card__foot">
|
||||||
|
<span v-if="!tpl.ativo" class="mdt-card__badge mdt-card__badge--inactive">
|
||||||
|
inativo
|
||||||
|
</span>
|
||||||
|
<span class="mdt-card__vars">
|
||||||
|
< {{ tpl.variaveis?.length || 0 }} variáveis >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
<!-- Menu de ações -->
|
</DataView>
|
||||||
<div class="mdt-card__menu" @click.stop>
|
|
||||||
<Button
|
|
||||||
icon="pi pi-ellipsis-v"
|
|
||||||
text
|
|
||||||
rounded
|
|
||||||
size="small"
|
|
||||||
class="!w-7 !h-7 mdt-card__menu-btn"
|
|
||||||
@click.stop="$refs[`menu_${tpl.id}`]?.[0]?.toggle($event)"
|
|
||||||
/>
|
|
||||||
<Menu
|
|
||||||
:ref="`menu_${tpl.id}`"
|
|
||||||
:model="getCardMenuItems(tpl)"
|
|
||||||
:popup="true"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mdt-card__foot">
|
|
||||||
<span v-if="!tpl.ativo" class="mdt-card__badge mdt-card__badge--inactive">
|
|
||||||
inativo
|
|
||||||
</span>
|
|
||||||
<span class="mdt-card__vars">
|
|
||||||
< {{ tpl.variaveis?.length || 0 }} variáveis >
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -834,15 +846,38 @@ onMounted(() => {
|
|||||||
.mdt-main__empty-btn { margin-top: 10px; }
|
.mdt-main__empty-btn { margin-top: 10px; }
|
||||||
|
|
||||||
.mdt-main .mdt-grid {
|
.mdt-main .mdt-grid {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
||||||
|
padding: 12px;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DataView wrapper — preenche o main e quebra em paginator/grid */
|
||||||
|
.mdt-dataview {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.mdt-dataview :deep(.p-dataview-content) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
background: transparent;
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
scrollbar-color: var(--m-border-strong) transparent;
|
scrollbar-color: var(--m-border-strong) transparent;
|
||||||
}
|
}
|
||||||
.mdt-main .mdt-grid::-webkit-scrollbar { width: 5px; }
|
.mdt-dataview :deep(.p-dataview-content)::-webkit-scrollbar { width: 5px; }
|
||||||
.mdt-main .mdt-grid::-webkit-scrollbar-thumb { background: var(--m-border-strong); border-radius: 3px; }
|
.mdt-dataview :deep(.p-dataview-content)::-webkit-scrollbar-thumb {
|
||||||
|
background: var(--m-border-strong);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.mdt-dataview :deep(.p-dataview-paginator-bottom) {
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: transparent;
|
||||||
|
border-top: 1px solid var(--m-border);
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Preview de template do sistema ── */
|
/* ── Preview de template do sistema ── */
|
||||||
.mdt-preview-actions {
|
.mdt-preview-actions {
|
||||||
|
|||||||
Reference in New Issue
Block a user