ads-nuxt 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +573 -577
- package/app/app.config.ts +25 -25
- package/app/assets/ads/checkbox-check.svg +5 -5
- package/app/assets/ads/checkbox-minus.svg +5 -5
- package/app/assets/brand/farmarcas.svg +6 -6
- package/app/assets/brand/radar-symbol.svg +9 -0
- package/app/assets/brand/radar.svg +9 -9
- package/app/assets/css/ads-colors.css +257 -246
- package/app/assets/css/component-tokens.css +367 -403
- package/app/assets/css/main.css +624 -617
- package/app/components/AdsBadge.vue +47 -48
- package/app/components/AdsBroadcast.vue +24 -45
- package/app/components/AdsButton.vue +539 -569
- package/app/components/AdsButtonGroup.vue +39 -39
- package/app/components/AdsButtonMenu.vue +48 -48
- package/app/components/AdsCard.vue +188 -117
- package/app/components/AdsCardHint.vue +22 -0
- package/app/components/AdsCardPeriod.vue +43 -0
- package/app/components/AdsCardVariation.vue +31 -0
- package/app/components/AdsCharttip.vue +78 -78
- package/app/components/AdsCheckbox.vue +77 -77
- package/app/components/AdsDatePicker.vue +492 -491
- package/app/components/AdsDropdownMenu.vue +30 -19
- package/app/components/AdsEmptyState.vue +58 -58
- package/app/components/AdsFeatureCard.vue +210 -219
- package/app/components/AdsFileCard.vue +98 -101
- package/app/components/AdsFooter.vue +25 -25
- package/app/components/AdsHeavyAccountCell.vue +59 -0
- package/app/components/AdsHeavyHeaderCell.vue +70 -0
- package/app/components/AdsHeavyTable.vue +135 -0
- package/app/components/AdsInput.vue +147 -147
- package/app/components/AdsLoading.vue +217 -109
- package/app/components/AdsMenuBar.vue +103 -103
- package/app/components/AdsMetricCard.vue +216 -119
- package/app/components/AdsModal.vue +157 -157
- package/app/components/AdsMonthPicker.vue +80 -80
- package/app/components/AdsNavbarApp.vue +67 -67
- package/app/components/AdsNavbarDesk.vue +62 -62
- package/app/components/AdsNotabilityPill.vue +24 -27
- package/app/components/AdsNumberInput.vue +173 -173
- package/app/components/AdsPagination.vue +91 -91
- package/app/components/AdsPanelCard.vue +99 -0
- package/app/components/AdsPill.vue +144 -92
- package/app/components/AdsProductTag.vue +61 -61
- package/app/components/AdsRadio.vue +70 -70
- package/app/components/AdsSearchInput.vue +122 -122
- package/app/components/AdsSegmentedTabs.vue +62 -28
- package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -210
- package/app/components/AdsSelectItem.vue +128 -0
- package/app/components/AdsSelectPanel.vue +150 -0
- package/app/components/AdsSideMenu.vue +101 -101
- package/app/components/AdsSmalltip.vue +44 -44
- package/app/components/AdsStepper.vue +222 -0
- package/app/components/AdsSteptip.vue +101 -101
- package/app/components/AdsSwitch.vue +59 -59
- package/app/components/AdsTable.vue +161 -100
- package/app/components/AdsTableHeaderCell.vue +80 -0
- package/app/components/AdsTableSkeleton.vue +113 -0
- package/app/components/AdsTableToolbar.vue +44 -44
- package/app/components/AdsTabs.vue +51 -51
- package/app/components/AdsTextarea.vue +116 -116
- package/app/components/AdsToast.vue +183 -181
- package/app/components/AdsTooltip.vue +73 -73
- package/app/components/OverlayLoading.vue +173 -173
- package/app/components/ProgressBarLoading.vue +235 -256
- package/app/composables/useOverlayLoading.ts +66 -66
- package/app/constants/ads-color-swatches.ts +240 -239
- package/app/locale/pt-br.ts +6 -6
- package/app/plugins/ads-toast.client.ts +24 -24
- package/app/theme/ads-theme.ts +374 -370
- package/app/theme/ads-tokens.ts +391 -379
- package/app/theme/component-tokens.json +366 -402
- package/app/theme/component-tokens.ts +807 -815
- package/app/types/overlay-loading.types.ts +26 -26
- package/app/utils/ads-filter-select.ts +191 -172
- package/app/utils/ads-table.ts +395 -204
- package/app/utils/calendar-date.ts +163 -163
- package/app/utils/category-role.ts +45 -45
- package/app/utils/money.ts +77 -77
- package/app/utils/notability.ts +8 -8
- package/app/utils/parser.ts +134 -134
- package/app/utils/percentage.ts +54 -54
- package/nuxt.config.ts +31 -31
- package/package.json +1 -1
- package/app/components/AdsFarmarcasPill.vue +0 -74
- package/app/components/AdsFilterDropdown.vue +0 -174
- package/app/components/AdsFilterOption.vue +0 -74
- package/app/components/AdsListDropdown.vue +0 -44
- package/app/components/AdsMiniPill.vue +0 -40
|
@@ -1,101 +1,98 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
import
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const surface = computed(() => surfaces[props.status]);
|
|
100
|
-
const resolvedIcon = computed(() => props.icon || surface.value.glyph);
|
|
101
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex w-full flex-col items-start gap-2" :role="status === 'error' ? 'alert' : 'status'">
|
|
3
|
+
<!-- Erro: o problema fica acima do arquivo -->
|
|
4
|
+
<p
|
|
5
|
+
v-if="status === 'error' && message"
|
|
6
|
+
class="flex items-center gap-1 text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-status-warning-800)]"
|
|
7
|
+
>
|
|
8
|
+
<UIcon name="i-lucide-circle-alert" class="size-4 shrink-0" aria-hidden="true" />
|
|
9
|
+
{{ message }}
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
class="flex min-h-[var(--ads-file-min-height)] w-full items-center gap-3 rounded-[var(--ads-file-radius)] px-[var(--ads-file-padding-x)] py-[var(--ads-file-padding-y)]"
|
|
14
|
+
:class="surface.card"
|
|
15
|
+
>
|
|
16
|
+
<span
|
|
17
|
+
class="inline-flex size-[var(--ads-file-icon-box)] shrink-0 items-center justify-center rounded-[var(--ads-file-radius)]"
|
|
18
|
+
:class="surface.icon"
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
>
|
|
21
|
+
<UIcon :name="resolvedIcon" class="size-6" />
|
|
22
|
+
</span>
|
|
23
|
+
|
|
24
|
+
<div class="flex min-w-0 flex-1 flex-col items-start gap-0.5">
|
|
25
|
+
<AdsTooltip :description="name" :show-title="false" align="start" class="max-w-full">
|
|
26
|
+
<p class="max-w-full truncate text-[length:var(--ads-file-title-size)] font-medium leading-[1.3] text-[var(--ads-text-primary)]">
|
|
27
|
+
{{ name }}
|
|
28
|
+
</p>
|
|
29
|
+
</AdsTooltip>
|
|
30
|
+
<p v-if="detail" class="text-[length:var(--ads-file-detail-size)] leading-[1.2] text-[var(--ads-text-secondary)]">
|
|
31
|
+
{{ detail }}
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<AdsButton
|
|
36
|
+
v-if="removable"
|
|
37
|
+
type="unfilled"
|
|
38
|
+
color="neutral"
|
|
39
|
+
size="sm"
|
|
40
|
+
icon="i-lucide-trash-2"
|
|
41
|
+
:aria-label="removeLabel"
|
|
42
|
+
@click="emit('remove')"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { computed } from "vue";
|
|
50
|
+
import AdsButton from "./AdsButton.vue";
|
|
51
|
+
import AdsTooltip from "./AdsTooltip.vue";
|
|
52
|
+
|
|
53
|
+
export type AdsFileCardStatus = "success" | "error";
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(
|
|
56
|
+
defineProps<{
|
|
57
|
+
/** Nome do arquivo. */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Linha de apoio, como o tamanho. */
|
|
60
|
+
detail?: string;
|
|
61
|
+
status?: AdsFileCardStatus;
|
|
62
|
+
/** Texto do problema, acima do arquivo. Só aparece no erro. */
|
|
63
|
+
message?: string;
|
|
64
|
+
/** Ícone Lucide. Padrão: planilha no sucesso, arquivo com X no erro. */
|
|
65
|
+
icon?: string;
|
|
66
|
+
removable?: boolean;
|
|
67
|
+
removeLabel?: string;
|
|
68
|
+
}>(),
|
|
69
|
+
{
|
|
70
|
+
detail: undefined,
|
|
71
|
+
status: "success",
|
|
72
|
+
message: undefined,
|
|
73
|
+
icon: undefined,
|
|
74
|
+
removable: false,
|
|
75
|
+
removeLabel: "Remover arquivo",
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const emit = defineEmits<{
|
|
80
|
+
remove: [];
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
const surfaces: Record<AdsFileCardStatus, { card: string; icon: string; glyph: string }> = {
|
|
84
|
+
success: {
|
|
85
|
+
card: "border border-[var(--ads-status-success-600)] bg-[color-mix(in_srgb,var(--ads-status-success-100)_var(--ads-opacity-medium),transparent)]",
|
|
86
|
+
icon: "bg-[var(--ads-status-success-100)] text-[var(--ads-status-success-800)]",
|
|
87
|
+
glyph: "i-lucide-file-spreadsheet",
|
|
88
|
+
},
|
|
89
|
+
error: {
|
|
90
|
+
card: "border-[1.5px] border-[var(--ads-status-warning-300)] bg-[color-mix(in_srgb,var(--ads-status-warning-100)_30%,transparent)]",
|
|
91
|
+
icon: "bg-[color-mix(in_srgb,var(--ads-status-warning-100)_var(--ads-opacity-medium),transparent)] text-[var(--ads-status-warning-800)]",
|
|
92
|
+
glyph: "i-lucide-file-x",
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const surface = computed(() => surfaces[props.status]);
|
|
97
|
+
const resolvedIcon = computed(() => props.icon || surface.value.glyph);
|
|
98
|
+
</script>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<footer class="flex min-h-[var(--ads-footer-min-height)] w-full flex-wrap items-center justify-between gap-3 bg-[var(--ads-surface-card)] px-10 py-2">
|
|
3
|
-
<p class="text-xs leading-4 text-[var(--ads-footer-text)]">
|
|
4
|
-
<span class="font-bold">© Copyright Radar Farmarcas </span>
|
|
5
|
-
<span>- Todos os direitos reservados.</span>
|
|
6
|
-
</p>
|
|
7
|
-
<p class="flex items-center gap-2 text-xs leading-4 text-[var(--ads-footer-text)]">
|
|
8
|
-
<span>{{ developerLabel }}</span>
|
|
9
|
-
<img :src="logoUrl" alt="Farmarcas" class="h-[var(--ads-footer-logo-height)] w-auto" />
|
|
10
|
-
</p>
|
|
11
|
-
</footer>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import logoUrl from "../assets/brand/farmarcas.svg?url";
|
|
16
|
-
|
|
17
|
-
withDefaults(
|
|
18
|
-
defineProps<{
|
|
19
|
-
developerLabel?: string;
|
|
20
|
-
}>(),
|
|
21
|
-
{
|
|
22
|
-
developerLabel: "Desenvolvido por",
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<footer class="flex min-h-[var(--ads-footer-min-height)] w-full flex-wrap items-center justify-between gap-3 bg-[var(--ads-surface-card)] px-10 py-2">
|
|
3
|
+
<p class="text-xs leading-4 text-[var(--ads-footer-text)]">
|
|
4
|
+
<span class="font-bold">© Copyright Radar Farmarcas </span>
|
|
5
|
+
<span>- Todos os direitos reservados.</span>
|
|
6
|
+
</p>
|
|
7
|
+
<p class="flex items-center gap-2 text-xs leading-4 text-[var(--ads-footer-text)]">
|
|
8
|
+
<span>{{ developerLabel }}</span>
|
|
9
|
+
<img :src="logoUrl" alt="Farmarcas" class="h-[var(--ads-footer-logo-height)] w-auto" />
|
|
10
|
+
</p>
|
|
11
|
+
</footer>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import logoUrl from "../assets/brand/farmarcas.svg?url";
|
|
16
|
+
|
|
17
|
+
withDefaults(
|
|
18
|
+
defineProps<{
|
|
19
|
+
developerLabel?: string;
|
|
20
|
+
}>(),
|
|
21
|
+
{
|
|
22
|
+
developerLabel: "Desenvolvido por",
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AdsHeavyAccountCell — Primeira coluna da AdsHeavyTable (Figma: "_Fin Account Cell" e "_Fin Toggle").
|
|
3
|
+
|
|
4
|
+
O nível sai da profundidade da linha: 0 é Grupo, 1 é Item, 2 ou mais é Subitem.
|
|
5
|
+
Marca a linha para o fundo azul do grupo e para a zebra dos itens.
|
|
6
|
+
|
|
7
|
+
@example
|
|
8
|
+
```vue
|
|
9
|
+
<template #name-cell="{ row }">
|
|
10
|
+
<AdsHeavyAccountCell :row="row" :label="row.original.name" />
|
|
11
|
+
</template>
|
|
12
|
+
```
|
|
13
|
+
-->
|
|
14
|
+
<template>
|
|
15
|
+
<div
|
|
16
|
+
class="flex items-center gap-3 pe-4"
|
|
17
|
+
:class="INDENT[Math.min(row.depth, INDENT.length - 1)]"
|
|
18
|
+
:data-heavy-group="isGroup ? '' : undefined"
|
|
19
|
+
:data-heavy-zebra="isZebra ? '' : undefined"
|
|
20
|
+
>
|
|
21
|
+
<button
|
|
22
|
+
v-if="row.subRows.length"
|
|
23
|
+
type="button"
|
|
24
|
+
class="relative flex size-5 shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] border border-[var(--ads-neutral-mid-60)] bg-[var(--ads-surface-card)] after:absolute after:-inset-1.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-button-primary)]"
|
|
25
|
+
:aria-expanded="row.getIsExpanded()"
|
|
26
|
+
:aria-label="`${row.getIsExpanded() ? 'Recolher' : 'Expandir'} ${label}`"
|
|
27
|
+
@click="row.toggleExpanded()"
|
|
28
|
+
>
|
|
29
|
+
<UIcon
|
|
30
|
+
:name="row.getIsExpanded() ? 'i-lucide-minus' : 'i-lucide-plus'"
|
|
31
|
+
class="size-4 text-[var(--ads-text-secondary)]"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
/>
|
|
34
|
+
</button>
|
|
35
|
+
<span class="min-w-0 flex-1 overflow-hidden text-ellipsis">{{ label }}</span>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import { computed } from "vue";
|
|
41
|
+
|
|
42
|
+
const INDENT = ["ps-4", "ps-12", "ps-18"] as const;
|
|
43
|
+
|
|
44
|
+
const props = defineProps<{
|
|
45
|
+
/** Linha do TanStack, recebida no slot da célula. */
|
|
46
|
+
row: {
|
|
47
|
+
depth: number;
|
|
48
|
+
index: number;
|
|
49
|
+
subRows: unknown[];
|
|
50
|
+
getIsExpanded: () => boolean;
|
|
51
|
+
toggleExpanded: () => void;
|
|
52
|
+
};
|
|
53
|
+
label: string;
|
|
54
|
+
}>();
|
|
55
|
+
|
|
56
|
+
const isGroup = computed(() => props.row.depth === 0);
|
|
57
|
+
/** `index` recomeça em cada grupo, então a zebra também recomeça. */
|
|
58
|
+
const isZebra = computed(() => !isGroup.value && props.row.index % 2 === 1);
|
|
59
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AdsHeavyHeaderCell — Título de coluna da AdsHeavyTable (Figma: "_Fin Header Cell").
|
|
3
|
+
|
|
4
|
+
Ordenar só aparece em coluna ordenável. Grupo não ordena sozinho no TanStack: passe em
|
|
5
|
+
`sort-column` a subcoluna que ele ordena. Fixar some com `enablePinning: false` e pede
|
|
6
|
+
`v-model:column-pinning` na tabela.
|
|
7
|
+
|
|
8
|
+
@example
|
|
9
|
+
```ts
|
|
10
|
+
{ id: "jul", header: ({ column, table }) => h(AdsHeavyHeaderCell, {
|
|
11
|
+
column, label: "Jul/2026", sortColumn: table.getColumn("jul-real"),
|
|
12
|
+
}) }
|
|
13
|
+
```
|
|
14
|
+
-->
|
|
15
|
+
<template>
|
|
16
|
+
<div class="flex items-center justify-center">
|
|
17
|
+
<component
|
|
18
|
+
:is="sortTarget?.getCanSort() ? 'button' : 'span'"
|
|
19
|
+
:type="sortTarget?.getCanSort() ? 'button' : undefined"
|
|
20
|
+
class="flex items-center gap-2 rounded-[var(--ads-radius-xsm)] font-bold text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-button-primary)]"
|
|
21
|
+
:aria-label="sortTarget?.getCanSort() ? `Ordenar por ${label}` : undefined"
|
|
22
|
+
@click="sortTarget?.getCanSort() && sortTarget.toggleSorting()"
|
|
23
|
+
>
|
|
24
|
+
<UIcon
|
|
25
|
+
v-if="sortTarget?.getCanSort()"
|
|
26
|
+
:name="sortIcon"
|
|
27
|
+
class="size-4 shrink-0 text-[var(--ads-border-icon-support)]"
|
|
28
|
+
aria-hidden="true"
|
|
29
|
+
/>
|
|
30
|
+
{{ label }}
|
|
31
|
+
</component>
|
|
32
|
+
<button
|
|
33
|
+
v-if="column?.getCanPin()"
|
|
34
|
+
type="button"
|
|
35
|
+
class="flex size-6 shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-button-primary)]"
|
|
36
|
+
:aria-label="`${column.getIsPinned() ? 'Soltar' : 'Fixar'} coluna ${label}`"
|
|
37
|
+
:aria-pressed="Boolean(column.getIsPinned())"
|
|
38
|
+
@click="column.pin(column.getIsPinned() ? false : 'left')"
|
|
39
|
+
>
|
|
40
|
+
<UIcon
|
|
41
|
+
name="i-lucide-pin"
|
|
42
|
+
class="size-4"
|
|
43
|
+
:class="column.getIsPinned() ? 'text-[var(--ads-text-brand)]' : 'text-[var(--ads-border-icon-support)]'"
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
/>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { computed } from "vue";
|
|
52
|
+
import type { AdsTableHeaderColumn } from "../utils/ads-table";
|
|
53
|
+
|
|
54
|
+
const props = defineProps<{
|
|
55
|
+
label: string;
|
|
56
|
+
/** Coluna do TanStack, recebida na função `header`. */
|
|
57
|
+
column?: AdsTableHeaderColumn;
|
|
58
|
+
/** Coluna que o título ordena, quando não é a própria (grupos). */
|
|
59
|
+
sortColumn?: AdsTableHeaderColumn;
|
|
60
|
+
}>();
|
|
61
|
+
|
|
62
|
+
const sortTarget = computed(() => props.sortColumn ?? props.column);
|
|
63
|
+
|
|
64
|
+
const SORT_ICON = { asc: "i-lucide-arrow-up", desc: "i-lucide-arrow-down" } as const;
|
|
65
|
+
|
|
66
|
+
const sortIcon = computed(() => {
|
|
67
|
+
const sorted = sortTarget.value?.getIsSorted();
|
|
68
|
+
return sorted ? SORT_ICON[sorted] : "i-lucide-chevrons-up-down";
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AdsHeavyTable — Tabela financeira (Figma: "Heavy Table").
|
|
3
|
+
|
|
4
|
+
Baseada no UTable (via AdsTable) com:
|
|
5
|
+
- Cabeçalho em dois níveis (grupos de colunas via nested `columns`).
|
|
6
|
+
- Grupos de linhas em accordion expandir/recolher (_Fin Group):
|
|
7
|
+
passe `get-sub-rows`, `get-row-id` e `v-model:expanded`;
|
|
8
|
+
na primeira coluna, use `AdsHeavyAccountCell`.
|
|
9
|
+
- Títulos com ordenar e fixar via `AdsHeavyHeaderCell`.
|
|
10
|
+
- Larguras e divisórias de período via `adsHeavyColumn` e `adsHeavyAccountColumn()`.
|
|
11
|
+
- Cabeçalho fixo por padrão (`sticky="header"`).
|
|
12
|
+
- Tons de variação e projeção via `adsHeavyVariationClass()`.
|
|
13
|
+
|
|
14
|
+
Props não declaradas (column-pinning, get-row-id, get-sub-rows, v-model:expanded,
|
|
15
|
+
footer, row-class, etc.) são repassadas ao UTable via attrs fallthrough.
|
|
16
|
+
Para o botão de fixar funcionar, use `v-model:column-pinning`.
|
|
17
|
+
|
|
18
|
+
@example
|
|
19
|
+
```vue
|
|
20
|
+
<AdsHeavyTable
|
|
21
|
+
:data="rows"
|
|
22
|
+
:columns="cols"
|
|
23
|
+
:get-sub-rows="(row) => row.children"
|
|
24
|
+
:get-row-id="(row) => row.id"
|
|
25
|
+
v-model:expanded="expanded"
|
|
26
|
+
v-model:column-pinning="pinning"
|
|
27
|
+
class="max-h-96"
|
|
28
|
+
>
|
|
29
|
+
<template #name-cell="{ row }">
|
|
30
|
+
<AdsHeavyAccountCell :row="row" :label="row.original.name" />
|
|
31
|
+
</template>
|
|
32
|
+
</AdsHeavyTable>
|
|
33
|
+
```
|
|
34
|
+
-->
|
|
35
|
+
<template>
|
|
36
|
+
<AdsTable
|
|
37
|
+
:data="data"
|
|
38
|
+
:columns="columns"
|
|
39
|
+
:loading="loading"
|
|
40
|
+
:skeleton-rows="skeletonRows"
|
|
41
|
+
:skeleton-variant="skeletonVariant"
|
|
42
|
+
:skeleton-cell-size="adsHeavyCellSize(density)"
|
|
43
|
+
:sticky="sticky"
|
|
44
|
+
:framed="framed"
|
|
45
|
+
:density="density"
|
|
46
|
+
:striped="false"
|
|
47
|
+
:borders="borders"
|
|
48
|
+
:depth="false"
|
|
49
|
+
:pinned-edge="false"
|
|
50
|
+
:empty-label="emptyLabel"
|
|
51
|
+
:empty-icon="emptyIcon"
|
|
52
|
+
:loading-label="loadingLabel"
|
|
53
|
+
:ui="mergedUi"
|
|
54
|
+
v-bind="$attrs"
|
|
55
|
+
>
|
|
56
|
+
<template v-for="(_, name) in $slots" #[name]="slotProps">
|
|
57
|
+
<slot :name="name" v-bind="slotProps ?? {}" />
|
|
58
|
+
</template>
|
|
59
|
+
</AdsTable>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script setup lang="ts" generic="T extends TableData">
|
|
63
|
+
import { computed } from "vue";
|
|
64
|
+
import type { TableColumn, TableData } from "@nuxt/ui";
|
|
65
|
+
import AdsTable from "./AdsTable.vue";
|
|
66
|
+
import type { AdsTableSkeletonVariant } from "./AdsTableSkeleton.vue";
|
|
67
|
+
import {
|
|
68
|
+
adsHeavyCellSize,
|
|
69
|
+
buildAdsHeavyTableUi,
|
|
70
|
+
type AdsTableBorders,
|
|
71
|
+
type AdsTableDensity,
|
|
72
|
+
type AdsTableUi,
|
|
73
|
+
} from "../utils/ads-table";
|
|
74
|
+
|
|
75
|
+
defineOptions({ inheritAttrs: false });
|
|
76
|
+
|
|
77
|
+
const props = withDefaults(
|
|
78
|
+
defineProps<{
|
|
79
|
+
data: T[];
|
|
80
|
+
columns: TableColumn<T>[];
|
|
81
|
+
/** md: padrão financeiro. sm: tabela compacta. */
|
|
82
|
+
density?: AdsTableDensity;
|
|
83
|
+
/** Borda e raio próprios. Dentro de AdsCard, false. */
|
|
84
|
+
framed?: boolean;
|
|
85
|
+
/** lines: só horizontal. grid: horizontal e vertical. */
|
|
86
|
+
borders?: AdsTableBorders;
|
|
87
|
+
loading?: boolean;
|
|
88
|
+
/** Número de linhas do skeleton de carregamento (1–8). */
|
|
89
|
+
skeletonRows?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Estilo do skeleton padrão.
|
|
92
|
+
* skeleton: barras de placeholder. logo: loader do Radar.
|
|
93
|
+
*/
|
|
94
|
+
skeletonVariant?: AdsTableSkeletonVariant;
|
|
95
|
+
/**
|
|
96
|
+
* Cabeçalho fixo quando a tabela tem altura máxima.
|
|
97
|
+
* Padrão: "header" — cabeçalho fica no topo ao rolar horizontalmente.
|
|
98
|
+
*/
|
|
99
|
+
sticky?: boolean | "header" | "footer";
|
|
100
|
+
emptyLabel?: string;
|
|
101
|
+
emptyIcon?: string;
|
|
102
|
+
loadingLabel?: string;
|
|
103
|
+
/** Ajuste pontual de um slot; soma ao padrão. */
|
|
104
|
+
ui?: Partial<AdsTableUi>;
|
|
105
|
+
}>(),
|
|
106
|
+
{
|
|
107
|
+
density: "md",
|
|
108
|
+
framed: true,
|
|
109
|
+
borders: "lines",
|
|
110
|
+
loading: false,
|
|
111
|
+
skeletonRows: 5,
|
|
112
|
+
skeletonVariant: "skeleton",
|
|
113
|
+
sticky: "header",
|
|
114
|
+
emptyLabel: "Nenhum registro encontrado",
|
|
115
|
+
emptyIcon: "i-lucide-inbox",
|
|
116
|
+
loadingLabel: undefined,
|
|
117
|
+
ui: undefined,
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const mergedUi = computed((): AdsTableUi => {
|
|
122
|
+
const base = buildAdsHeavyTableUi({
|
|
123
|
+
density: props.density,
|
|
124
|
+
framed: props.framed,
|
|
125
|
+
borders: props.borders,
|
|
126
|
+
stickyHeader: props.sticky === true || props.sticky === "header",
|
|
127
|
+
});
|
|
128
|
+
if (!props.ui) return base;
|
|
129
|
+
const merged = { ...base };
|
|
130
|
+
for (const key of Object.keys(props.ui) as (keyof AdsTableUi)[]) {
|
|
131
|
+
merged[key] = `${base[key]} ${props.ui[key] ?? ""}`.trim();
|
|
132
|
+
}
|
|
133
|
+
return merged;
|
|
134
|
+
});
|
|
135
|
+
</script>
|