nuxt-ui-tools 1.23.0 → 1.25.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/dist/module.d.mts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -0
- package/dist/runtime/display/components/blocks/display-accordion.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-accordion.vue +93 -0
- package/dist/runtime/display/components/blocks/display-accordion.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-alert.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-alert.vue +133 -0
- package/dist/runtime/display/components/blocks/display-alert.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-breakdown.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-breakdown.vue +178 -0
- package/dist/runtime/display/components/blocks/display-breakdown.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-chart.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-chart.vue +237 -0
- package/dist/runtime/display/components/blocks/display-chart.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-code.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-code.vue +143 -0
- package/dist/runtime/display/components/blocks/display-code.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-date.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-date.vue +174 -0
- package/dist/runtime/display/components/blocks/display-date.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-diff.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-diff.vue +142 -0
- package/dist/runtime/display/components/blocks/display-diff.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-empty.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-empty.vue +74 -0
- package/dist/runtime/display/components/blocks/display-empty.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-facts.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-facts.vue +180 -0
- package/dist/runtime/display/components/blocks/display-facts.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-heading.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-heading.vue +96 -0
- package/dist/runtime/display/components/blocks/display-heading.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-list.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-list.vue +295 -0
- package/dist/runtime/display/components/blocks/display-list.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-media.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-media.vue +326 -0
- package/dist/runtime/display/components/blocks/display-media.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-meter.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-meter.vue +301 -0
- package/dist/runtime/display/components/blocks/display-meter.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-person.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-person.vue +146 -0
- package/dist/runtime/display/components/blocks/display-person.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-record.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-record.vue +208 -0
- package/dist/runtime/display/components/blocks/display-record.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-stat.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-stat.vue +178 -0
- package/dist/runtime/display/components/blocks/display-stat.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-table.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-table.vue +132 -0
- package/dist/runtime/display/components/blocks/display-table.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-text.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-text.vue +135 -0
- package/dist/runtime/display/components/blocks/display-text.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-timeline.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-timeline.vue +232 -0
- package/dist/runtime/display/components/blocks/display-timeline.vue.d.ts +4 -0
- package/dist/runtime/display/components/display.d.vue.ts +24 -0
- package/dist/runtime/display/components/display.vue +21 -0
- package/dist/runtime/display/components/display.vue.d.ts +24 -0
- package/dist/runtime/display/components/parts/display-actions.d.vue.ts +9 -0
- package/dist/runtime/display/components/parts/display-actions.vue +24 -0
- package/dist/runtime/display/components/parts/display-actions.vue.d.ts +9 -0
- package/dist/runtime/display/components/parts/display-chip.d.vue.ts +11 -0
- package/dist/runtime/display/components/parts/display-chip.vue +45 -0
- package/dist/runtime/display/components/parts/display-chip.vue.d.ts +11 -0
- package/dist/runtime/display/components/parts/display-copy.d.vue.ts +6 -0
- package/dist/runtime/display/components/parts/display-copy.vue +27 -0
- package/dist/runtime/display/components/parts/display-copy.vue.d.ts +6 -0
- package/dist/runtime/display/components/parts/display-empty-line.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-empty-line.vue +21 -0
- package/dist/runtime/display/components/parts/display-empty-line.vue.d.ts +7 -0
- package/dist/runtime/display/components/parts/display-fact-value.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-fact-value.vue +35 -0
- package/dist/runtime/display/components/parts/display-fact-value.vue.d.ts +7 -0
- package/dist/runtime/display/components/parts/display-load-error.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-load-error.vue +29 -0
- package/dist/runtime/display/components/parts/display-load-error.vue.d.ts +7 -0
- package/dist/runtime/display/components/parts/display-more.d.vue.ts +10 -0
- package/dist/runtime/display/components/parts/display-more.vue +23 -0
- package/dist/runtime/display/components/parts/display-more.vue.d.ts +10 -0
- package/dist/runtime/display/components/parts/display-record-media.d.vue.ts +9 -0
- package/dist/runtime/display/components/parts/display-record-media.vue +59 -0
- package/dist/runtime/display/components/parts/display-record-media.vue.d.ts +9 -0
- package/dist/runtime/display/components/parts/display-render.d.ts +10 -0
- package/dist/runtime/display/components/parts/display-render.js +5 -0
- package/dist/runtime/display/components/parts/display-skeleton.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-skeleton.vue +67 -0
- package/dist/runtime/display/components/parts/display-skeleton.vue.d.ts +7 -0
- package/dist/runtime/display/composables/use-display-config.d.ts +6 -0
- package/dist/runtime/display/composables/use-display-config.js +11 -0
- package/dist/runtime/display/composables/use-display-file-preview.d.ts +9 -0
- package/dist/runtime/display/composables/use-display-file-preview.js +11 -0
- package/dist/runtime/display/composables/use-display-icons.d.ts +8 -0
- package/dist/runtime/display/composables/use-display-icons.js +62 -0
- package/dist/runtime/display/composables/use-display-locale.d.ts +5 -0
- package/dist/runtime/display/composables/use-display-locale.js +5 -0
- package/dist/runtime/display/composables/use-display-number.d.ts +2 -0
- package/dist/runtime/display/composables/use-display-number.js +7 -0
- package/dist/runtime/display/composables/use-display-reveal.d.ts +14 -0
- package/dist/runtime/display/composables/use-display-reveal.js +15 -0
- package/dist/runtime/display/composables/use-display-url.d.ts +26 -0
- package/dist/runtime/display/composables/use-display-url.js +46 -0
- package/dist/runtime/display/index.d.ts +4 -0
- package/dist/runtime/display/index.js +3 -0
- package/dist/runtime/display/plugins/display-tones.d.ts +3 -0
- package/dist/runtime/display/plugins/display-tones.js +17 -0
- package/dist/runtime/display/types/blocks/accordion.d.ts +18 -0
- package/dist/runtime/display/types/blocks/accordion.js +0 -0
- package/dist/runtime/display/types/blocks/alert.d.ts +31 -0
- package/dist/runtime/display/types/blocks/alert.js +0 -0
- package/dist/runtime/display/types/blocks/breakdown.d.ts +36 -0
- package/dist/runtime/display/types/blocks/breakdown.js +0 -0
- package/dist/runtime/display/types/blocks/chart.d.ts +23 -0
- package/dist/runtime/display/types/blocks/chart.js +0 -0
- package/dist/runtime/display/types/blocks/code.d.ts +21 -0
- package/dist/runtime/display/types/blocks/code.js +0 -0
- package/dist/runtime/display/types/blocks/date.d.ts +27 -0
- package/dist/runtime/display/types/blocks/date.js +0 -0
- package/dist/runtime/display/types/blocks/diff.d.ts +20 -0
- package/dist/runtime/display/types/blocks/diff.js +0 -0
- package/dist/runtime/display/types/blocks/empty.d.ts +13 -0
- package/dist/runtime/display/types/blocks/empty.js +0 -0
- package/dist/runtime/display/types/blocks/facts.d.ts +50 -0
- package/dist/runtime/display/types/blocks/facts.js +0 -0
- package/dist/runtime/display/types/blocks/heading.d.ts +19 -0
- package/dist/runtime/display/types/blocks/heading.js +0 -0
- package/dist/runtime/display/types/blocks/list.d.ts +36 -0
- package/dist/runtime/display/types/blocks/list.js +0 -0
- package/dist/runtime/display/types/blocks/media.d.ts +42 -0
- package/dist/runtime/display/types/blocks/media.js +0 -0
- package/dist/runtime/display/types/blocks/meter.d.ts +48 -0
- package/dist/runtime/display/types/blocks/meter.js +0 -0
- package/dist/runtime/display/types/blocks/person.d.ts +32 -0
- package/dist/runtime/display/types/blocks/person.js +0 -0
- package/dist/runtime/display/types/blocks/record.d.ts +42 -0
- package/dist/runtime/display/types/blocks/record.js +0 -0
- package/dist/runtime/display/types/blocks/stat.d.ts +44 -0
- package/dist/runtime/display/types/blocks/stat.js +0 -0
- package/dist/runtime/display/types/blocks/table.d.ts +28 -0
- package/dist/runtime/display/types/blocks/table.js +0 -0
- package/dist/runtime/display/types/blocks/text.d.ts +22 -0
- package/dist/runtime/display/types/blocks/text.js +0 -0
- package/dist/runtime/display/types/blocks/timeline.d.ts +37 -0
- package/dist/runtime/display/types/blocks/timeline.js +0 -0
- package/dist/runtime/display/types/config.d.ts +53 -0
- package/dist/runtime/display/types/config.js +0 -0
- package/dist/runtime/display/types/index.d.ts +22 -0
- package/dist/runtime/display/types/index.js +0 -0
- package/dist/runtime/display/types/registry.d.ts +57 -0
- package/dist/runtime/display/types/registry.js +0 -0
- package/dist/runtime/display/types/shared.d.ts +71 -0
- package/dist/runtime/display/types/shared.js +0 -0
- package/dist/runtime/display/utils/classes.d.ts +3 -0
- package/dist/runtime/display/utils/classes.js +7 -0
- package/dist/runtime/display/utils/config.d.ts +6 -0
- package/dist/runtime/display/utils/config.js +7 -0
- package/dist/runtime/display/utils/content.d.ts +7 -0
- package/dist/runtime/display/utils/content.js +13 -0
- package/dist/runtime/display/utils/dates.d.ts +16 -0
- package/dist/runtime/display/utils/dates.js +34 -0
- package/dist/runtime/display/utils/json.d.ts +7 -0
- package/dist/runtime/display/utils/json.js +15 -0
- package/dist/runtime/display/utils/meter.d.ts +7 -0
- package/dist/runtime/display/utils/meter.js +13 -0
- package/dist/runtime/display/utils/registry.d.ts +47 -0
- package/dist/runtime/display/utils/registry.js +64 -0
- package/dist/runtime/display/utils/tone-css.d.ts +7 -0
- package/dist/runtime/display/utils/tone-css.js +38 -0
- package/dist/runtime/display/utils/tone.d.ts +26 -0
- package/dist/runtime/display/utils/tone.js +38 -0
- package/dist/runtime/display/utils/urls.d.ts +10 -0
- package/dist/runtime/display/utils/urls.js +33 -0
- package/dist/runtime/file-preview/components/shell/file-preview-stage.vue +5 -3
- package/dist/runtime/file-preview/composables/use-file-preview-source.d.ts +7 -0
- package/dist/runtime/file-preview/composables/use-file-preview-source.js +7 -1
- package/dist/runtime/file-preview/index.d.ts +1 -0
- package/dist/runtime/file-preview/index.js +1 -0
- package/dist/runtime/file-preview/types/file.d.ts +9 -0
- package/dist/runtime/file-preview/utils/errors.d.ts +30 -0
- package/dist/runtime/file-preview/utils/errors.js +26 -0
- package/dist/runtime/form/components/utils/form-file-preview.vue +7 -2
- package/dist/runtime/form/composables/use-form-root.js +2 -0
- package/dist/runtime/form/composables/use-form-runtime.js +7 -2
- package/dist/runtime/form/fields/index.d.ts +5 -0
- package/dist/runtime/form/fields/info/component.vue +51 -19
- package/dist/runtime/form/fields/info/config.d.ts +5 -0
- package/dist/runtime/form/fields/info/config.js +2 -1
- package/dist/runtime/form/fields/info/types.d.ts +78 -4
- package/dist/runtime/form/fields/info/use-info-display.d.ts +20 -0
- package/dist/runtime/form/fields/info/use-info-display.js +82 -0
- package/dist/runtime/form/fields/upload/upload-item.vue +10 -2
- package/dist/runtime/form/types/api.d.ts +6 -0
- package/dist/runtime/form/types/runtime.d.ts +2 -0
- package/dist/runtime/form/utils/dynamic.d.ts +6 -0
- package/dist/runtime/form/utils/dynamic.js +7 -0
- package/dist/runtime/i18n/locales/en.js +32 -0
- package/dist/runtime/i18n/locales/fr.js +32 -0
- package/dist/runtime/i18n/types.d.ts +40 -0
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/utils/file.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-root.vue +2 -0
- package/dist/runtime/table/components/data-list/data-list-selection-actions.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-selection-actions.vue +32 -5
- package/dist/runtime/table/components/data-list/data-list-selection-actions.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-selection-sheet.d.vue.ts +10 -0
- package/dist/runtime/table/components/data-list/data-list-selection-sheet.vue +238 -0
- package/dist/runtime/table/components/data-list/data-list-selection-sheet.vue.d.ts +10 -0
- package/dist/runtime/table/components/grid/grid-renderer.vue +2 -0
- package/dist/runtime/table/components/summary/summary-renderer.vue +2 -0
- package/dist/runtime/table/components/table/table-renderer.vue +2 -0
- package/dist/runtime/table/components/utils/overlay-inset-spacer.d.vue.ts +3 -0
- package/dist/runtime/table/components/utils/overlay-inset-spacer.vue +13 -0
- package/dist/runtime/table/components/utils/overlay-inset-spacer.vue.d.ts +3 -0
- package/dist/runtime/table/composables/use-data-list-overlay-inset.d.ts +10 -0
- package/dist/runtime/table/composables/use-data-list-overlay-inset.js +11 -0
- package/dist/runtime/table/composables/use-table-actions.js +11 -2
- package/dist/runtime/table/constants/mobile.d.ts +0 -7
- package/dist/runtime/table/constants/mobile.js +0 -1
- package/dist/runtime/table/types/actions.d.ts +7 -0
- package/dist/runtime/table/types/data-list.d.ts +8 -1
- package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
- package/package.json +16 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
3
|
+
import ULink from "@nuxt/ui/components/Link.vue";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { useDisplayAppUi } from "../../composables/use-display-config";
|
|
6
|
+
import { useDisplayReveal } from "../../composables/use-display-reveal";
|
|
7
|
+
import { resolveDisplayClasses } from "../../utils/classes";
|
|
8
|
+
import { isDisplayContentEmpty } from "../../utils/content";
|
|
9
|
+
import { DISPLAY_SURFACE_CLASSES } from "../../utils/tone";
|
|
10
|
+
import DisplayChip from "../parts/display-chip.vue";
|
|
11
|
+
import DisplayEmptyLine from "../parts/display-empty-line.vue";
|
|
12
|
+
import DisplayMore from "../parts/display-more.vue";
|
|
13
|
+
import DisplayRecordMedia from "../parts/display-record-media.vue";
|
|
14
|
+
import DisplayRender from "../parts/display-render";
|
|
15
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
16
|
+
const {
|
|
17
|
+
variant = "row",
|
|
18
|
+
heading = void 0,
|
|
19
|
+
headingIcon = void 0,
|
|
20
|
+
items = void 0,
|
|
21
|
+
surface = "bordered",
|
|
22
|
+
max = void 0,
|
|
23
|
+
step = void 0,
|
|
24
|
+
empty = void 0,
|
|
25
|
+
loading = false,
|
|
26
|
+
ui = void 0,
|
|
27
|
+
...record
|
|
28
|
+
} = defineProps({
|
|
29
|
+
variant: { type: String, required: false },
|
|
30
|
+
heading: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
31
|
+
headingIcon: { type: String, required: false },
|
|
32
|
+
items: { type: Array, required: false },
|
|
33
|
+
surface: { type: String, required: false },
|
|
34
|
+
loading: { type: Boolean, required: false },
|
|
35
|
+
ui: { type: Object, required: false },
|
|
36
|
+
reference: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
37
|
+
title: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
38
|
+
meta: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
39
|
+
metaIcon: { type: String, required: false },
|
|
40
|
+
description: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
41
|
+
image: { type: Object, required: false },
|
|
42
|
+
avatar: { type: Object, required: false },
|
|
43
|
+
icon: { type: String, required: false },
|
|
44
|
+
tone: { type: String, required: false },
|
|
45
|
+
badges: { type: Array, required: false },
|
|
46
|
+
trailing: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
47
|
+
trailingCaption: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
48
|
+
chip: { type: Object, required: false },
|
|
49
|
+
to: { type: String, required: false },
|
|
50
|
+
onClick: { type: Function, required: false },
|
|
51
|
+
max: { type: Number, required: false },
|
|
52
|
+
step: { type: Number, required: false },
|
|
53
|
+
empty: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true }
|
|
54
|
+
});
|
|
55
|
+
const appUi = useDisplayAppUi("record");
|
|
56
|
+
const single = computed(() => ({ ...record, title: record.title ?? "" }));
|
|
57
|
+
const reveal = useDisplayReveal({ items: () => items ?? [], max: () => max, step: () => step });
|
|
58
|
+
const classes = computed(
|
|
59
|
+
() => resolveDisplayClasses(
|
|
60
|
+
{
|
|
61
|
+
badges: "mt-1.5 flex flex-wrap gap-1",
|
|
62
|
+
body: "min-w-0 flex-1",
|
|
63
|
+
description: "mt-1 line-clamp-2 text-sm text-muted",
|
|
64
|
+
empty: "",
|
|
65
|
+
header: "flex items-center gap-2 border-b border-default bg-elevated px-3 py-2 text-sm font-semibold text-toned",
|
|
66
|
+
icon: "size-4 shrink-0 text-dimmed",
|
|
67
|
+
item: "flex items-center gap-2.5 border-t border-muted px-3 py-2.5 first:border-t-0",
|
|
68
|
+
list: "",
|
|
69
|
+
media: "",
|
|
70
|
+
meta: "mt-0.5 flex min-w-0 items-center gap-1 text-xs text-muted",
|
|
71
|
+
more: "w-full justify-center rounded-none border-t border-muted",
|
|
72
|
+
reference: "font-mono text-[11px] text-dimmed",
|
|
73
|
+
root: variant === "card" || variant === "stack" ? `min-w-0 overflow-hidden ${DISPLAY_SURFACE_CLASSES[surface]}` : `flex min-w-0 items-center ${variant === "compact" ? "gap-2.5 p-2" : "gap-3 p-2.5"} ${DISPLAY_SURFACE_CLASSES[surface]}`,
|
|
74
|
+
title: "truncate font-semibold text-highlighted",
|
|
75
|
+
trailing: "shrink-0 text-end",
|
|
76
|
+
trailingCaption: "text-[11px] text-dimmed",
|
|
77
|
+
trailingValue: "font-extrabold text-highlighted tabular-nums"
|
|
78
|
+
},
|
|
79
|
+
appUi.value,
|
|
80
|
+
ui
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
function linkProps(item) {
|
|
84
|
+
if (item.to) return { is: ULink, to: item.to };
|
|
85
|
+
if (item.onClick) return { is: "button", type: "button", onClick: item.onClick };
|
|
86
|
+
return { is: "div" };
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<template>
|
|
91
|
+
<DisplaySkeleton v-if="loading" :layout="variant === 'stack' ? 'rows' : 'card'" :count="3" />
|
|
92
|
+
<div
|
|
93
|
+
v-else-if="variant === 'stack'"
|
|
94
|
+
:class="classes.root"
|
|
95
|
+
data-display="record"
|
|
96
|
+
data-variant="stack"
|
|
97
|
+
>
|
|
98
|
+
<div v-if="!isDisplayContentEmpty(heading)" :class="classes.header">
|
|
99
|
+
<UIcon v-if="headingIcon" :name="headingIcon" class="size-4 shrink-0 text-muted" />
|
|
100
|
+
<DisplayRender :content="heading" />
|
|
101
|
+
<span
|
|
102
|
+
class="ms-auto rounded-full bg-default px-2 py-px text-xs font-semibold text-toned tabular-nums"
|
|
103
|
+
>
|
|
104
|
+
{{ items?.length ?? 0 }}
|
|
105
|
+
</span>
|
|
106
|
+
</div>
|
|
107
|
+
<DisplayEmptyLine v-if="!items?.length" :content="empty" class="m-3" :class="classes.empty" />
|
|
108
|
+
<div v-else :class="classes.list">
|
|
109
|
+
<component
|
|
110
|
+
:is="linkProps(item).is"
|
|
111
|
+
v-for="(item, index) in reveal.visible.value"
|
|
112
|
+
:key="index"
|
|
113
|
+
v-bind="linkProps(item)"
|
|
114
|
+
:class="[
|
|
115
|
+
classes.item,
|
|
116
|
+
item.to || item.onClick ? 'w-full text-start hover:bg-elevated' : ''
|
|
117
|
+
]"
|
|
118
|
+
>
|
|
119
|
+
<DisplayRecordMedia :item="item" size="sm" />
|
|
120
|
+
<div :class="classes.body">
|
|
121
|
+
<div :class="[classes.title, 'text-sm']"><DisplayRender :content="item.title" /></div>
|
|
122
|
+
<div v-if="!isDisplayContentEmpty(item.meta)" :class="classes.meta">
|
|
123
|
+
<UIcon v-if="item.metaIcon" :name="item.metaIcon" class="size-3 shrink-0" />
|
|
124
|
+
<span class="truncate"><DisplayRender :content="item.meta" /></span>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<DisplayChip v-if="item.chip" :chip="item.chip" />
|
|
128
|
+
<div v-else-if="!isDisplayContentEmpty(item.trailing)" :class="classes.trailing">
|
|
129
|
+
<div :class="classes.trailingValue"><DisplayRender :content="item.trailing" /></div>
|
|
130
|
+
</div>
|
|
131
|
+
</component>
|
|
132
|
+
<DisplayMore
|
|
133
|
+
v-if="reveal.hidden.value"
|
|
134
|
+
:count="reveal.next.value"
|
|
135
|
+
:class="classes.more"
|
|
136
|
+
@reveal="reveal.reveal"
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
<component
|
|
141
|
+
:is="linkProps(single).is"
|
|
142
|
+
v-else-if="variant === 'card'"
|
|
143
|
+
v-bind="linkProps(single)"
|
|
144
|
+
:class="[classes.root, 'block text-start']"
|
|
145
|
+
data-display="record"
|
|
146
|
+
data-variant="card"
|
|
147
|
+
>
|
|
148
|
+
<DisplayRecordMedia :item="single" banner :class="classes.media" />
|
|
149
|
+
<div class="p-3.5">
|
|
150
|
+
<div v-if="!isDisplayContentEmpty(single.reference)" :class="classes.reference">
|
|
151
|
+
<DisplayRender :content="single.reference" />
|
|
152
|
+
</div>
|
|
153
|
+
<div :class="classes.title"><DisplayRender :content="single.title" /></div>
|
|
154
|
+
<div v-if="!isDisplayContentEmpty(single.meta)" :class="classes.meta">
|
|
155
|
+
<UIcon v-if="single.metaIcon" :name="single.metaIcon" class="size-3 shrink-0" />
|
|
156
|
+
<span class="truncate"><DisplayRender :content="single.meta" /></span>
|
|
157
|
+
</div>
|
|
158
|
+
<div v-if="single.badges?.length" :class="classes.badges">
|
|
159
|
+
<DisplayChip v-for="(badge, index) in single.badges" :key="index" :chip="badge" />
|
|
160
|
+
</div>
|
|
161
|
+
<div v-if="!isDisplayContentEmpty(single.description)" :class="classes.description">
|
|
162
|
+
<DisplayRender :content="single.description" />
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</component>
|
|
166
|
+
<component
|
|
167
|
+
:is="linkProps(single).is"
|
|
168
|
+
v-else
|
|
169
|
+
v-bind="linkProps(single)"
|
|
170
|
+
:class="[
|
|
171
|
+
classes.root,
|
|
172
|
+
single.to || single.onClick ? 'w-full text-start hover:bg-elevated' : ''
|
|
173
|
+
]"
|
|
174
|
+
data-display="record"
|
|
175
|
+
:data-variant="variant"
|
|
176
|
+
>
|
|
177
|
+
<DisplayRecordMedia
|
|
178
|
+
:item="single"
|
|
179
|
+
:size="variant === 'compact' ? 'sm' : 'lg'"
|
|
180
|
+
:class="classes.media"
|
|
181
|
+
/>
|
|
182
|
+
<div :class="classes.body">
|
|
183
|
+
<div v-if="!isDisplayContentEmpty(single.reference)" :class="classes.reference">
|
|
184
|
+
<DisplayRender :content="single.reference" />
|
|
185
|
+
</div>
|
|
186
|
+
<div :class="classes.title"><DisplayRender :content="single.title" /></div>
|
|
187
|
+
<div v-if="!isDisplayContentEmpty(single.meta)" :class="classes.meta">
|
|
188
|
+
<UIcon v-if="single.metaIcon" :name="single.metaIcon" class="size-3 shrink-0" />
|
|
189
|
+
<span class="truncate"><DisplayRender :content="single.meta" /></span>
|
|
190
|
+
</div>
|
|
191
|
+
<div v-if="single.badges?.length && variant === 'row'" :class="classes.badges">
|
|
192
|
+
<DisplayChip v-for="(badge, index) in single.badges" :key="index" :chip="badge" />
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
<DisplayChip v-if="single.chip" :chip="single.chip" />
|
|
196
|
+
<div v-if="!isDisplayContentEmpty(single.trailing)" :class="classes.trailing">
|
|
197
|
+
<div :class="classes.trailingValue"><DisplayRender :content="single.trailing" /></div>
|
|
198
|
+
<div v-if="!isDisplayContentEmpty(single.trailingCaption)" :class="classes.trailingCaption">
|
|
199
|
+
<DisplayRender :content="single.trailingCaption" />
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
<UIcon
|
|
203
|
+
v-if="variant === 'compact' && (single.to || single.onClick)"
|
|
204
|
+
name="i-lucide-chevron-right"
|
|
205
|
+
:class="classes.icon"
|
|
206
|
+
/>
|
|
207
|
+
</component>
|
|
208
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayRecordProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayRecordProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayRecordProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayStatProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayStatProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayStatProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { useDisplayAppUi } from "../../composables/use-display-config";
|
|
6
|
+
import { resolveDisplayClasses } from "../../utils/classes";
|
|
7
|
+
import { isDisplayContentEmpty, resolveDisplayText } from "../../utils/content";
|
|
8
|
+
import {
|
|
9
|
+
DISPLAY_SURFACE_CLASSES,
|
|
10
|
+
DISPLAY_SURFACE_PADDING,
|
|
11
|
+
displayToneClass
|
|
12
|
+
} from "../../utils/tone";
|
|
13
|
+
import DisplayChip from "../parts/display-chip.vue";
|
|
14
|
+
import DisplayRender from "../parts/display-render";
|
|
15
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
16
|
+
const {
|
|
17
|
+
variant = "hero",
|
|
18
|
+
label = void 0,
|
|
19
|
+
value = void 0,
|
|
20
|
+
unit = void 0,
|
|
21
|
+
caption = void 0,
|
|
22
|
+
chip = void 0,
|
|
23
|
+
status = void 0,
|
|
24
|
+
delta = void 0,
|
|
25
|
+
trend = void 0,
|
|
26
|
+
items = void 0,
|
|
27
|
+
tone = "primary",
|
|
28
|
+
size = "md",
|
|
29
|
+
surface = void 0,
|
|
30
|
+
loading = false,
|
|
31
|
+
ui = void 0
|
|
32
|
+
} = defineProps({
|
|
33
|
+
variant: { type: String, required: false },
|
|
34
|
+
label: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
35
|
+
value: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
36
|
+
unit: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
37
|
+
caption: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
38
|
+
chip: { type: Object, required: false },
|
|
39
|
+
status: { type: Object, required: false },
|
|
40
|
+
delta: { type: Object, required: false },
|
|
41
|
+
trend: { type: Array, required: false },
|
|
42
|
+
items: { type: Array, required: false },
|
|
43
|
+
tone: { type: String, required: false },
|
|
44
|
+
size: { type: String, required: false },
|
|
45
|
+
surface: { type: String, required: false },
|
|
46
|
+
loading: { type: Boolean, required: false },
|
|
47
|
+
ui: { type: Object, required: false }
|
|
48
|
+
});
|
|
49
|
+
const VALUE_SIZES = {
|
|
50
|
+
hero: { lg: "text-4xl", md: "text-3xl", sm: "text-xl" },
|
|
51
|
+
price: { lg: "text-3xl", md: "text-2xl", sm: "text-lg" },
|
|
52
|
+
row: { lg: "text-2xl", md: "text-xl", sm: "text-base" },
|
|
53
|
+
trend: { lg: "text-3xl", md: "text-2xl", sm: "text-lg" }
|
|
54
|
+
};
|
|
55
|
+
const appUi = useDisplayAppUi("stat");
|
|
56
|
+
const resolvedSurface = computed(
|
|
57
|
+
() => surface ?? (variant === "hero" ? "muted" : variant === "row" ? "bordered" : "plain")
|
|
58
|
+
);
|
|
59
|
+
const deltaTone = computed(() => {
|
|
60
|
+
if (!delta) return "neutral";
|
|
61
|
+
if (delta.tone) return delta.tone;
|
|
62
|
+
if (delta.direction === "down") return "error";
|
|
63
|
+
return delta.direction === "flat" ? "neutral" : "success";
|
|
64
|
+
});
|
|
65
|
+
const deltaIcon = computed(() => {
|
|
66
|
+
if (delta?.direction === "down") return "i-lucide-trending-down";
|
|
67
|
+
return delta?.direction === "flat" ? "i-lucide-minus" : "i-lucide-trending-up";
|
|
68
|
+
});
|
|
69
|
+
const sparkline = computed(() => {
|
|
70
|
+
if (!trend || trend.length < 2) return void 0;
|
|
71
|
+
const min = Math.min(...trend);
|
|
72
|
+
const span = Math.max(...trend) - min || 1;
|
|
73
|
+
const points = trend.map((point, index) => {
|
|
74
|
+
const x = index / (trend.length - 1) * 100;
|
|
75
|
+
const y = 30 - (point - min) / span * 26;
|
|
76
|
+
return `${x.toFixed(2)} ${y.toFixed(2)}`;
|
|
77
|
+
});
|
|
78
|
+
const line = `M${points.join(" L")}`;
|
|
79
|
+
return { area: `${line} L100 32 L0 32 Z`, line };
|
|
80
|
+
});
|
|
81
|
+
const classes = computed(
|
|
82
|
+
() => resolveDisplayClasses(
|
|
83
|
+
{
|
|
84
|
+
caption: variant === "hero" ? "mt-1 flex flex-wrap items-center justify-center gap-1.5 text-xs text-muted" : "mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted",
|
|
85
|
+
delta: "inline-flex items-center gap-1 rounded-full bg-[var(--nut-tone-soft)] px-2 py-0.5 text-xs font-bold text-[var(--nut-tone-ink)]",
|
|
86
|
+
item: "min-w-0 border-s border-default px-3.5 py-3 first:border-s-0",
|
|
87
|
+
itemCaption: "mt-0.5 text-xs text-muted",
|
|
88
|
+
itemLabel: "text-xs text-dimmed",
|
|
89
|
+
itemValue: `mt-0.5 font-extrabold text-highlighted tabular-nums ${VALUE_SIZES.row[size]}`,
|
|
90
|
+
items: "grid",
|
|
91
|
+
label: "text-xs font-semibold text-muted",
|
|
92
|
+
root: variant === "row" ? DISPLAY_SURFACE_CLASSES[resolvedSurface.value] : `flex min-w-0 ${variant === "hero" ? "flex-col items-center text-center" : variant === "trend" ? "items-end gap-4" : "flex-col"} ${DISPLAY_SURFACE_CLASSES[resolvedSurface.value]} ${DISPLAY_SURFACE_PADDING[resolvedSurface.value]}`,
|
|
93
|
+
sparkline: "h-11 min-w-0 flex-1 text-[var(--nut-tone)]",
|
|
94
|
+
status: "mt-1 flex items-center gap-1.5 text-sm font-semibold text-[var(--nut-tone-ink)]",
|
|
95
|
+
unit: "ms-1 text-sm font-semibold tracking-normal text-muted",
|
|
96
|
+
value: `my-0.5 leading-tight font-extrabold tracking-tight text-highlighted tabular-nums ${VALUE_SIZES[variant][size]}`
|
|
97
|
+
},
|
|
98
|
+
appUi.value,
|
|
99
|
+
ui
|
|
100
|
+
)
|
|
101
|
+
);
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<DisplaySkeleton
|
|
106
|
+
v-if="loading"
|
|
107
|
+
:layout="variant === 'row' ? 'tiles' : 'lines'"
|
|
108
|
+
:count="variant === 'row' ? 3 : 2"
|
|
109
|
+
/>
|
|
110
|
+
<div v-else-if="variant === 'row'" :class="classes.root" data-display="stat" data-variant="row">
|
|
111
|
+
<div
|
|
112
|
+
:class="classes.items"
|
|
113
|
+
:style="{ gridTemplateColumns: `repeat(${items?.length || 1}, minmax(0, 1fr))` }"
|
|
114
|
+
>
|
|
115
|
+
<div
|
|
116
|
+
v-for="(item, index) in items"
|
|
117
|
+
:key="index"
|
|
118
|
+
:class="[classes.item, item.tone ? displayToneClass(item.tone) : '']"
|
|
119
|
+
>
|
|
120
|
+
<div :class="classes.itemLabel"><DisplayRender :content="item.label" /></div>
|
|
121
|
+
<div :class="twMerge(classes.itemValue, item.tone ? 'text-[var(--nut-tone-ink)]' : '')">
|
|
122
|
+
<DisplayRender :content="item.value" />
|
|
123
|
+
</div>
|
|
124
|
+
<div v-if="!isDisplayContentEmpty(item.caption)" :class="classes.itemCaption">
|
|
125
|
+
<DisplayRender :content="item.caption" />
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
<div
|
|
131
|
+
v-else
|
|
132
|
+
:class="[classes.root, displayToneClass(tone)]"
|
|
133
|
+
data-display="stat"
|
|
134
|
+
:data-variant="variant"
|
|
135
|
+
>
|
|
136
|
+
<div :class="variant === 'trend' ? 'min-w-0' : 'contents'">
|
|
137
|
+
<div v-if="!isDisplayContentEmpty(label)" :class="classes.label">
|
|
138
|
+
<DisplayRender :content="label" />
|
|
139
|
+
</div>
|
|
140
|
+
<div :class="variant === 'trend' ? 'flex items-center gap-2' : 'contents'">
|
|
141
|
+
<div :class="classes.value">
|
|
142
|
+
<DisplayRender :content="value" />
|
|
143
|
+
<span v-if="!isDisplayContentEmpty(unit)" :class="classes.unit"
|
|
144
|
+
><DisplayRender :content="unit"
|
|
145
|
+
/></span>
|
|
146
|
+
</div>
|
|
147
|
+
<span v-if="delta" :class="[classes.delta, displayToneClass(deltaTone)]" data-display-delta>
|
|
148
|
+
<UIcon :name="deltaIcon" class="size-3.5" />{{ resolveDisplayText(delta.value) }}
|
|
149
|
+
</span>
|
|
150
|
+
</div>
|
|
151
|
+
<div v-if="status" :class="[classes.status, displayToneClass(status.tone ?? 'success')]">
|
|
152
|
+
<UIcon v-if="status.icon" :name="status.icon" class="size-4 shrink-0" />
|
|
153
|
+
<DisplayRender :content="status.text" />
|
|
154
|
+
</div>
|
|
155
|
+
<div v-if="!isDisplayContentEmpty(caption) || chip" :class="classes.caption">
|
|
156
|
+
<DisplayChip v-if="chip" :chip="chip" />
|
|
157
|
+
<DisplayRender :content="caption" />
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
<svg
|
|
161
|
+
v-if="variant === 'trend' && sparkline"
|
|
162
|
+
:class="classes.sparkline"
|
|
163
|
+
viewBox="0 0 100 32"
|
|
164
|
+
preserveAspectRatio="none"
|
|
165
|
+
aria-hidden="true"
|
|
166
|
+
>
|
|
167
|
+
<path :d="sparkline.area" fill="currentColor" fill-opacity="0.14" />
|
|
168
|
+
<path
|
|
169
|
+
:d="sparkline.line"
|
|
170
|
+
fill="none"
|
|
171
|
+
stroke="currentColor"
|
|
172
|
+
stroke-width="2"
|
|
173
|
+
stroke-linejoin="round"
|
|
174
|
+
vector-effect="non-scaling-stroke"
|
|
175
|
+
/>
|
|
176
|
+
</svg>
|
|
177
|
+
</div>
|
|
178
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayStatProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayStatProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayStatProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayTableProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayTableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayTableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { isNumber } from "../../../shared/utils/predicate";
|
|
4
|
+
import { useDisplayAppUi } from "../../composables/use-display-config";
|
|
5
|
+
import { useDisplayReveal } from "../../composables/use-display-reveal";
|
|
6
|
+
import { resolveDisplayClasses } from "../../utils/classes";
|
|
7
|
+
import { isDisplayContentEmpty } from "../../utils/content";
|
|
8
|
+
import { DISPLAY_SURFACE_CLASSES } from "../../utils/tone";
|
|
9
|
+
import DisplayEmptyLine from "../parts/display-empty-line.vue";
|
|
10
|
+
import DisplayMore from "../parts/display-more.vue";
|
|
11
|
+
import DisplayRender from "../parts/display-render";
|
|
12
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
13
|
+
const {
|
|
14
|
+
columns,
|
|
15
|
+
rows,
|
|
16
|
+
footer = void 0,
|
|
17
|
+
caption = void 0,
|
|
18
|
+
note = void 0,
|
|
19
|
+
maxHeight = void 0,
|
|
20
|
+
surface = "bordered",
|
|
21
|
+
max = void 0,
|
|
22
|
+
step = void 0,
|
|
23
|
+
empty = void 0,
|
|
24
|
+
loading = false,
|
|
25
|
+
ui = void 0
|
|
26
|
+
} = defineProps({
|
|
27
|
+
columns: { type: Array, required: true },
|
|
28
|
+
rows: { type: Array, required: true },
|
|
29
|
+
footer: { type: Object, required: false },
|
|
30
|
+
caption: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
31
|
+
note: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
32
|
+
maxHeight: { type: [Number, String], required: false },
|
|
33
|
+
surface: { type: String, required: false },
|
|
34
|
+
loading: { type: Boolean, required: false },
|
|
35
|
+
ui: { type: Object, required: false },
|
|
36
|
+
max: { type: Number, required: false },
|
|
37
|
+
step: { type: Number, required: false },
|
|
38
|
+
empty: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true }
|
|
39
|
+
});
|
|
40
|
+
const ALIGN_CLASSES = { center: "text-center", end: "text-end", start: "text-start" };
|
|
41
|
+
const appUi = useDisplayAppUi("table");
|
|
42
|
+
const reveal = useDisplayReveal({ items: () => rows, max: () => max, step: () => step });
|
|
43
|
+
const scrollerStyle = computed(
|
|
44
|
+
() => maxHeight === void 0 ? void 0 : { maxHeight: isNumber(maxHeight) ? `${maxHeight}px` : maxHeight }
|
|
45
|
+
);
|
|
46
|
+
const classes = computed(
|
|
47
|
+
() => resolveDisplayClasses(
|
|
48
|
+
{
|
|
49
|
+
cell: "px-3 py-2 align-middle text-default",
|
|
50
|
+
empty: "",
|
|
51
|
+
foot: "",
|
|
52
|
+
footCell: "sticky bottom-0 border-t border-default bg-elevated px-3 py-2 font-bold text-highlighted",
|
|
53
|
+
head: "",
|
|
54
|
+
headCell: "sticky top-0 z-[1] border-b border-default bg-elevated px-3 py-2 text-[11px] font-bold tracking-[0.07em] whitespace-nowrap text-muted uppercase",
|
|
55
|
+
meta: "mt-1.5 flex justify-between gap-3 text-xs text-dimmed",
|
|
56
|
+
more: "mt-1 self-center",
|
|
57
|
+
root: "flex min-w-0 flex-col",
|
|
58
|
+
row: "border-t border-muted first:border-t-0",
|
|
59
|
+
scroller: `min-w-0 overflow-auto ${DISPLAY_SURFACE_CLASSES[surface]}`,
|
|
60
|
+
table: "w-full border-collapse text-sm"
|
|
61
|
+
},
|
|
62
|
+
appUi.value,
|
|
63
|
+
ui
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
function alignClass(column) {
|
|
67
|
+
return [
|
|
68
|
+
ALIGN_CLASSES[column.align ?? (column.numeric ? "end" : "start")],
|
|
69
|
+
column.numeric ? "tabular-nums" : "",
|
|
70
|
+
column.mono ? "font-mono text-[13px]" : ""
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<DisplaySkeleton v-if="loading" layout="rows" :count="Math.min(Math.max(rows.length, 3), 6)" />
|
|
77
|
+
<DisplayEmptyLine v-else-if="!rows.length" :content="empty" :class="classes.empty" />
|
|
78
|
+
<div v-else :class="classes.root" data-display="table">
|
|
79
|
+
<div :class="classes.scroller" :style="scrollerStyle">
|
|
80
|
+
<table :class="classes.table">
|
|
81
|
+
<thead :class="classes.head">
|
|
82
|
+
<tr>
|
|
83
|
+
<th
|
|
84
|
+
v-for="column in columns"
|
|
85
|
+
:key="column.key"
|
|
86
|
+
scope="col"
|
|
87
|
+
:class="[classes.headCell, ...alignClass(column)]"
|
|
88
|
+
:style="column.width ? { width: column.width } : void 0"
|
|
89
|
+
>
|
|
90
|
+
<DisplayRender :content="column.label" />
|
|
91
|
+
</th>
|
|
92
|
+
</tr>
|
|
93
|
+
</thead>
|
|
94
|
+
<tbody>
|
|
95
|
+
<tr v-for="(row, index) in reveal.visible.value" :key="index" :class="classes.row">
|
|
96
|
+
<td
|
|
97
|
+
v-for="column in columns"
|
|
98
|
+
:key="column.key"
|
|
99
|
+
:class="[classes.cell, ...alignClass(column)]"
|
|
100
|
+
>
|
|
101
|
+
<DisplayRender :content="row[column.key]" />
|
|
102
|
+
</td>
|
|
103
|
+
</tr>
|
|
104
|
+
</tbody>
|
|
105
|
+
<tfoot v-if="footer" :class="classes.foot">
|
|
106
|
+
<tr>
|
|
107
|
+
<td
|
|
108
|
+
v-for="column in columns"
|
|
109
|
+
:key="column.key"
|
|
110
|
+
:class="[classes.footCell, ...alignClass(column)]"
|
|
111
|
+
>
|
|
112
|
+
<DisplayRender :content="footer[column.key]" />
|
|
113
|
+
</td>
|
|
114
|
+
</tr>
|
|
115
|
+
</tfoot>
|
|
116
|
+
</table>
|
|
117
|
+
</div>
|
|
118
|
+
<DisplayMore
|
|
119
|
+
v-if="reveal.hidden.value"
|
|
120
|
+
:count="reveal.next.value"
|
|
121
|
+
:class="classes.more"
|
|
122
|
+
@reveal="reveal.reveal"
|
|
123
|
+
/>
|
|
124
|
+
<div
|
|
125
|
+
v-if="!isDisplayContentEmpty(caption) || !isDisplayContentEmpty(note)"
|
|
126
|
+
:class="classes.meta"
|
|
127
|
+
>
|
|
128
|
+
<span><DisplayRender :content="caption" /></span>
|
|
129
|
+
<span><DisplayRender :content="note" /></span>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayTableProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayTableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayTableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayTextProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayTextProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayTextProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|