nuxt-ui-tools 1.17.0 → 1.18.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.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/form/components/page/form-page-navigation.d.vue.ts +5 -3
- package/dist/runtime/form/components/page/form-page-navigation.vue +6 -3
- package/dist/runtime/form/components/page/form-page-navigation.vue.d.ts +5 -3
- package/dist/runtime/form/components/page/form-page-section.vue +6 -5
- package/dist/runtime/form/components/page/form-page-sections.d.vue.ts +4 -3
- package/dist/runtime/form/components/page/form-page-sections.vue +7 -2
- package/dist/runtime/form/components/page/form-page-sections.vue.d.ts +4 -3
- package/dist/runtime/form/components/page/form-page.d.vue.ts +2 -0
- package/dist/runtime/form/components/page/form-page.vue +10 -2
- package/dist/runtime/form/components/page/form-page.vue.d.ts +2 -0
- package/dist/runtime/form/components/renderer/form-field-renderer.vue +6 -4
- package/dist/runtime/form/components/renderer/form-field-shell.d.vue.ts +4 -4
- package/dist/runtime/form/components/renderer/form-field-shell.vue +28 -4
- package/dist/runtime/form/components/renderer/form-field-shell.vue.d.ts +4 -4
- package/dist/runtime/form/components/root/form.vue +2 -2
- package/dist/runtime/form/composables/use-field-control.d.ts +1 -1
- package/dist/runtime/form/composables/use-field-control.js +9 -21
- package/dist/runtime/form/composables/use-field-options.js +8 -4
- package/dist/runtime/form/composables/use-form-page.d.ts +11 -1
- package/dist/runtime/form/composables/use-form-page.js +12 -6
- package/dist/runtime/form/composables/use-form-runtime.js +1 -1
- package/dist/runtime/form/fields/array-primitive/types.d.ts +1 -1
- package/dist/runtime/form/fields/checkbox-card/component.vue +54 -28
- package/dist/runtime/form/fields/checkbox-card/config.d.ts +1 -0
- package/dist/runtime/form/fields/checkbox-card/config.js +1 -1
- package/dist/runtime/form/fields/checkbox-card/types.d.ts +3 -3
- package/dist/runtime/form/fields/choice-card/choice-card-label.d.vue.ts +7 -0
- package/dist/runtime/form/fields/choice-card/choice-card-label.vue +27 -1
- package/dist/runtime/form/fields/choice-card/choice-card-label.vue.d.ts +7 -0
- package/dist/runtime/form/fields/choice-card/types.d.ts +54 -1
- package/dist/runtime/form/fields/choice-card/use-choice-card.d.ts +7 -3
- package/dist/runtime/form/fields/choice-card/use-choice-card.js +37 -15
- package/dist/runtime/form/fields/choice-card/utils.d.ts +27 -0
- package/dist/runtime/form/fields/choice-card/utils.js +17 -0
- package/dist/runtime/form/fields/hierarchy/component.vue +3 -2
- package/dist/runtime/form/fields/index.d.ts +2 -0
- package/dist/runtime/form/fields/radio-card/component.vue +58 -28
- package/dist/runtime/form/fields/radio-card/config.d.ts +1 -0
- package/dist/runtime/form/fields/radio-card/config.js +1 -1
- package/dist/runtime/form/fields/radio-card/types.d.ts +3 -3
- package/dist/runtime/form/types/field-base.d.ts +6 -0
- package/dist/runtime/form/types/field-kind.d.ts +3 -1
- package/dist/runtime/form/types/field.d.ts +1 -0
- package/dist/runtime/form/types/page.d.ts +20 -8
- package/dist/runtime/form/types/ui.d.ts +24 -4
- package/dist/runtime/form/utils/disabled.d.ts +11 -0
- package/dist/runtime/form/utils/disabled.js +11 -0
- package/dist/runtime/form/utils/field-instance.js +3 -0
- package/dist/runtime/form/utils/options.d.ts +22 -1
- package/dist/runtime/form/utils/options.js +15 -0
- package/dist/runtime/form/utils/page-surface.d.ts +21 -0
- package/dist/runtime/form/utils/page-surface.js +27 -0
- package/dist/runtime/form/utils/page.d.ts +21 -1
- package/dist/runtime/form/utils/page.js +24 -2
- package/dist/runtime/i18n/locales/en.js +28 -8
- package/dist/runtime/i18n/locales/fr.js +28 -8
- package/dist/runtime/i18n/types.d.ts +46 -7
- package/dist/runtime/table/components/actions/row-actions.d.vue.ts +2 -0
- package/dist/runtime/table/components/actions/row-actions.vue +8 -3
- package/dist/runtime/table/components/actions/row-actions.vue.d.ts +2 -0
- package/dist/runtime/table/components/data-list/data-list-content.vue +7 -1
- package/dist/runtime/table/components/data-list/data-list-default.d.vue.ts +16 -16
- package/dist/runtime/table/components/data-list/data-list-default.vue +3 -0
- package/dist/runtime/table/components/data-list/data-list-default.vue.d.ts +16 -16
- package/dist/runtime/table/components/data-list/data-list-layout-switch.vue +7 -9
- package/dist/runtime/table/components/data-list/data-list-root.vue +5 -6
- package/dist/runtime/table/components/data-list/data-list-sort-menu.vue +3 -1
- package/dist/runtime/table/components/data-list/data-list-table.d.vue.ts +8 -1
- package/dist/runtime/table/components/data-list/data-list-table.vue +18 -1
- package/dist/runtime/table/components/data-list/data-list-table.vue.d.ts +8 -1
- package/dist/runtime/table/components/data-list/data-list-view-toggle.d.vue.ts +25 -0
- package/dist/runtime/table/components/data-list/data-list-view-toggle.vue +57 -0
- package/dist/runtime/table/components/data-list/data-list-view-toggle.vue.d.ts +25 -0
- package/dist/runtime/table/components/data-list/sort-menu-panel.vue +1 -1
- package/dist/runtime/table/components/layout/table-footer.d.vue.ts +6 -4
- package/dist/runtime/table/components/layout/table-footer.vue +80 -3
- package/dist/runtime/table/components/layout/table-footer.vue.d.ts +6 -4
- package/dist/runtime/table/components/summary/summary-content.d.ts +13 -0
- package/dist/runtime/table/components/summary/summary-content.js +5 -0
- package/dist/runtime/table/components/summary/summary-renderer.d.vue.ts +31 -0
- package/dist/runtime/table/components/summary/summary-renderer.vue +282 -0
- package/dist/runtime/table/components/summary/summary-renderer.vue.d.ts +31 -0
- package/dist/runtime/table/components/summary/summary-row.d.vue.ts +19 -0
- package/dist/runtime/table/components/summary/summary-row.vue +102 -0
- package/dist/runtime/table/components/summary/summary-row.vue.d.ts +19 -0
- package/dist/runtime/table/components/table/table-empty-state.vue +39 -9
- package/dist/runtime/table/components/table/table-renderer.vue +1 -1
- package/dist/runtime/table/components/table/table-row-actions-control.vue +10 -6
- package/dist/runtime/table/components/table/table-selection-control.d.vue.ts +5 -1
- package/dist/runtime/table/components/table/table-selection-control.vue +17 -4
- package/dist/runtime/table/components/table/table-selection-control.vue.d.ts +5 -1
- package/dist/runtime/table/components/table/table-tree-control.vue +2 -1
- package/dist/runtime/table/components/table/table-tree-header.vue +0 -1
- package/dist/runtime/table/composables/use-table-api.d.ts +2 -0
- package/dist/runtime/table/composables/use-table-api.js +8 -0
- package/dist/runtime/table/composables/use-table-columns.d.ts +2 -0
- package/dist/runtime/table/composables/use-table-controls.d.ts +6 -0
- package/dist/runtime/table/composables/use-table-controls.js +6 -3
- package/dist/runtime/table/composables/use-table-internals.d.ts +33 -0
- package/dist/runtime/table/composables/use-table-internals.js +9 -0
- package/dist/runtime/table/composables/use-table-row-labels.d.ts +16 -0
- package/dist/runtime/table/composables/use-table-row-labels.js +22 -0
- package/dist/runtime/table/composables/use-table-row-summary.d.ts +18 -0
- package/dist/runtime/table/composables/use-table-row-summary.js +41 -0
- package/dist/runtime/table/constants/mobile.d.ts +79 -0
- package/dist/runtime/table/constants/mobile.js +17 -0
- package/dist/runtime/table/constants/summary.d.ts +67 -0
- package/dist/runtime/table/constants/summary.js +31 -0
- package/dist/runtime/table/types/data-list.d.ts +58 -8
- package/dist/runtime/table/types/layout.d.ts +73 -0
- package/dist/runtime/table/types/schema.d.ts +9 -1
- package/dist/runtime/table/types/source.d.ts +6 -1
- package/dist/runtime/table/types/table-api.d.ts +12 -0
- package/dist/runtime/table/utils/columns/defs.js +3 -1
- package/dist/runtime/table/utils/columns/render.d.ts +2 -0
- package/dist/runtime/table/utils/columns/render.js +2 -2
- package/dist/runtime/table/utils/data-list-ui.js +3 -1
- package/dist/runtime/table/utils/mobile-defaults.d.ts +7 -0
- package/dist/runtime/table/utils/mobile-defaults.js +25 -0
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { useDataListUi } from "../../composables/use-data-list-ui";
|
|
4
|
+
import { useTableInternals } from "../../composables/use-table-internals";
|
|
5
|
+
import SummaryRenderer from "../summary/summary-renderer.vue";
|
|
4
6
|
import TableRenderer from "../table/table-renderer.vue";
|
|
5
7
|
const props = defineProps({
|
|
6
8
|
height: { type: String, required: false },
|
|
@@ -8,10 +10,14 @@ const props = defineProps({
|
|
|
8
10
|
fill: { type: Boolean, required: false },
|
|
9
11
|
ui: { type: Object, required: false }
|
|
10
12
|
});
|
|
13
|
+
const internals = useTableInternals();
|
|
11
14
|
const dataListUi = useDataListUi();
|
|
12
15
|
const resolvedSize = computed(
|
|
13
16
|
() => props.size ?? dataListUi.ui.value.table?.size ?? dataListUi.controlSize.value
|
|
14
17
|
);
|
|
18
|
+
const summarySize = computed(
|
|
19
|
+
() => props.size ?? dataListUi.ui.value.summary?.size ?? resolvedSize.value
|
|
20
|
+
);
|
|
15
21
|
const resolvedUi = computed(() => ({
|
|
16
22
|
...dataListUi.ui.value.table?.ui,
|
|
17
23
|
...props.ui
|
|
@@ -19,7 +25,18 @@ const resolvedUi = computed(() => ({
|
|
|
19
25
|
</script>
|
|
20
26
|
|
|
21
27
|
<template>
|
|
22
|
-
<
|
|
28
|
+
<SummaryRenderer
|
|
29
|
+
v-if="internals.rowSummary.active.value"
|
|
30
|
+
:height="height"
|
|
31
|
+
:size="summarySize"
|
|
32
|
+
:fill="fill"
|
|
33
|
+
:ui="dataListUi.ui.value.summary?.ui"
|
|
34
|
+
>
|
|
35
|
+
<template v-for="(_, name) in $slots" #[name]="scope">
|
|
36
|
+
<slot :name="name" v-bind="scope ?? {}" />
|
|
37
|
+
</template>
|
|
38
|
+
</SummaryRenderer>
|
|
39
|
+
<TableRenderer v-else :height="height" :size="resolvedSize" :fill="fill" :ui="resolvedUi">
|
|
23
40
|
<template v-for="(_, name) in $slots" #[name]="scope">
|
|
24
41
|
<slot :name="name" v-bind="scope ?? {}" />
|
|
25
42
|
</template>
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { DataListControlSize, DataListTableUi } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The table layout. Summary rows are its compact presentation, so they share its states and slots.
|
|
4
|
+
* The template carries no comment on purpose: in development a root comment turns the root into a
|
|
5
|
+
* fragment, which a transition around this component cannot leave, so the next view never comes in.
|
|
6
|
+
*/
|
|
2
7
|
type __VLS_Props = {
|
|
3
8
|
height?: string;
|
|
4
9
|
size?: DataListControlSize;
|
|
5
10
|
fill?: boolean;
|
|
6
11
|
ui?: DataListTableUi;
|
|
7
12
|
};
|
|
8
|
-
declare var __VLS_10: string, __VLS_11: any;
|
|
13
|
+
declare var __VLS_10: string, __VLS_11: any, __VLS_22: string, __VLS_23: any;
|
|
9
14
|
type __VLS_Slots = {} & {
|
|
10
15
|
[K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
|
|
16
|
+
} & {
|
|
17
|
+
[K in NonNullable<typeof __VLS_22>]?: (props: typeof __VLS_23) => any;
|
|
11
18
|
};
|
|
12
19
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
20
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataListControlSize, DataListViewToggleProps, DataListViewToggleUi } from '../../types/index.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
size?: DataListControlSize;
|
|
4
|
+
ui?: DataListViewToggleUi;
|
|
5
|
+
props?: DataListViewToggleProps;
|
|
6
|
+
};
|
|
7
|
+
declare function toggle(): void;
|
|
8
|
+
declare var __VLS_1: {
|
|
9
|
+
active: boolean;
|
|
10
|
+
available: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
toggle: typeof toggle;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_1) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UButton from "@nuxt/ui/components/Button.vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useUiToolsLocale } from "#ui-tools/i18n";
|
|
5
|
+
import { useDataListUi } from "../../composables/use-data-list-ui";
|
|
6
|
+
import { useTableInternals } from "../../composables/use-table-internals";
|
|
7
|
+
import { mergeDataListProps, mergeDataListUiClass } from "../../utils";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
size: { type: String, required: false },
|
|
10
|
+
ui: { type: Object, required: false },
|
|
11
|
+
props: { type: Object, required: false }
|
|
12
|
+
});
|
|
13
|
+
const internals = useTableInternals();
|
|
14
|
+
const dataListUi = useDataListUi();
|
|
15
|
+
const { t } = useUiToolsLocale();
|
|
16
|
+
const { rowSummary } = internals;
|
|
17
|
+
const resolvedSize = computed(
|
|
18
|
+
() => props.size ?? dataListUi.ui.value.viewToggle?.size ?? dataListUi.controlSize.value
|
|
19
|
+
);
|
|
20
|
+
const resolvedUi = computed(() => ({
|
|
21
|
+
...dataListUi.ui.value.viewToggle?.ui,
|
|
22
|
+
...props.ui
|
|
23
|
+
}));
|
|
24
|
+
const label = computed(
|
|
25
|
+
() => t(rowSummary.active.value ? "table.header.tableView" : "table.header.summaryView")
|
|
26
|
+
);
|
|
27
|
+
const buttonProps = computed(
|
|
28
|
+
() => mergeDataListProps(
|
|
29
|
+
{ color: "primary", size: resolvedSize.value, variant: "link" },
|
|
30
|
+
dataListUi.ui.value.viewToggle?.props?.button,
|
|
31
|
+
props.props?.button
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
function toggle() {
|
|
35
|
+
rowSummary.setActive(!rowSummary.active.value);
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<slot
|
|
41
|
+
:active="rowSummary.active.value"
|
|
42
|
+
:available="rowSummary.available.value"
|
|
43
|
+
:label="label"
|
|
44
|
+
:toggle="toggle"
|
|
45
|
+
>
|
|
46
|
+
<UButton
|
|
47
|
+
v-if="internals.controls.headerControls.value.summary"
|
|
48
|
+
v-bind="buttonProps"
|
|
49
|
+
:label="label"
|
|
50
|
+
:ui="{
|
|
51
|
+
...resolvedUi,
|
|
52
|
+
base: mergeDataListUiClass('nut-dl-view-toggle font-semibold', void 0, resolvedUi.base)
|
|
53
|
+
}"
|
|
54
|
+
@click="toggle"
|
|
55
|
+
/>
|
|
56
|
+
</slot>
|
|
57
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataListControlSize, DataListViewToggleProps, DataListViewToggleUi } from '../../types/index.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
size?: DataListControlSize;
|
|
4
|
+
ui?: DataListViewToggleUi;
|
|
5
|
+
props?: DataListViewToggleProps;
|
|
6
|
+
};
|
|
7
|
+
declare function toggle(): void;
|
|
8
|
+
declare var __VLS_1: {
|
|
9
|
+
active: boolean;
|
|
10
|
+
available: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
toggle: typeof toggle;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_1) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -77,7 +77,7 @@ function humanize(value) {
|
|
|
77
77
|
:aria-checked="activeDirection === dir"
|
|
78
78
|
class="flex min-w-0 items-center justify-center gap-1.5 overflow-hidden rounded-[5px] px-1 font-medium whitespace-nowrap outline-none transition-colors focus-visible:ring-2 focus-visible:ring-primary/40"
|
|
79
79
|
:class="[
|
|
80
|
-
compact ? 'h-7 text-[12px]' : 'h-
|
|
80
|
+
compact ? 'h-7 text-[12px]' : 'h-11 text-[13px]',
|
|
81
81
|
activeDirection === dir ? 'nut-dl-sort__dir--active bg-default text-highlighted shadow-[0_0_0_1px_var(--ui-border)]' : 'text-muted hover:text-default'
|
|
82
82
|
]"
|
|
83
83
|
@click="emit('selectDirection', dir)"
|
|
@@ -14,10 +14,10 @@ declare var __VLS_1: {
|
|
|
14
14
|
pageSize: number;
|
|
15
15
|
options: number[];
|
|
16
16
|
setPageSize: (nextPageSize: number) => void;
|
|
17
|
-
}, __VLS_12: {
|
|
17
|
+
}, __VLS_12: {}, __VLS_19: {
|
|
18
18
|
current: number;
|
|
19
19
|
total: number;
|
|
20
|
-
},
|
|
20
|
+
}, __VLS_21: {
|
|
21
21
|
state: {
|
|
22
22
|
hasNextPage: boolean;
|
|
23
23
|
hasPreviousPage: boolean;
|
|
@@ -39,9 +39,11 @@ type __VLS_Slots = {} & {
|
|
|
39
39
|
} & {
|
|
40
40
|
'page-size'?: (props: typeof __VLS_3) => any;
|
|
41
41
|
} & {
|
|
42
|
-
'
|
|
42
|
+
'view-toggle'?: (props: typeof __VLS_12) => any;
|
|
43
43
|
} & {
|
|
44
|
-
|
|
44
|
+
'page-count'?: (props: typeof __VLS_19) => any;
|
|
45
|
+
} & {
|
|
46
|
+
navigation?: (props: typeof __VLS_21) => any;
|
|
45
47
|
};
|
|
46
48
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
47
49
|
compact: boolean;
|
|
@@ -12,6 +12,41 @@ import {
|
|
|
12
12
|
mergeDataListUiClass,
|
|
13
13
|
resolveDataListControlGeometry
|
|
14
14
|
} from "../../utils";
|
|
15
|
+
import DataListViewToggle from "../data-list/data-list-view-toggle.vue";
|
|
16
|
+
const PAGER_CONTROLS = [
|
|
17
|
+
{
|
|
18
|
+
icon: "i-lucide-chevrons-left",
|
|
19
|
+
iconProp: "firstIcon",
|
|
20
|
+
label: "table.footer.firstPage",
|
|
21
|
+
mirrored: "i-lucide-chevrons-right",
|
|
22
|
+
slot: "first",
|
|
23
|
+
target: () => 1
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
icon: "i-lucide-chevron-left",
|
|
27
|
+
iconProp: "prevIcon",
|
|
28
|
+
label: "table.footer.previousPage",
|
|
29
|
+
mirrored: "i-lucide-chevron-right",
|
|
30
|
+
slot: "prev",
|
|
31
|
+
target: (page2) => page2 > 1 ? page2 - 1 : void 0
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
icon: "i-lucide-chevron-right",
|
|
35
|
+
iconProp: "nextIcon",
|
|
36
|
+
label: "table.footer.nextPage",
|
|
37
|
+
mirrored: "i-lucide-chevron-left",
|
|
38
|
+
slot: "next",
|
|
39
|
+
target: (page2, pages) => page2 < pages ? page2 + 1 : void 0
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
icon: "i-lucide-chevrons-right",
|
|
43
|
+
iconProp: "lastIcon",
|
|
44
|
+
label: "table.footer.lastPage",
|
|
45
|
+
mirrored: "i-lucide-chevrons-left",
|
|
46
|
+
slot: "last",
|
|
47
|
+
target: (_page, pages) => pages
|
|
48
|
+
}
|
|
49
|
+
];
|
|
15
50
|
const props = defineProps({
|
|
16
51
|
size: { type: String, required: false },
|
|
17
52
|
compact: { type: Boolean, required: false, default: void 0 },
|
|
@@ -22,7 +57,7 @@ const internals = useTableInternals();
|
|
|
22
57
|
const { isMobile } = useDataListBreakpoint();
|
|
23
58
|
const compact = computed(() => props.compact ?? isMobile.value);
|
|
24
59
|
const dataListUi = useDataListUi();
|
|
25
|
-
const { locale, t } = useUiToolsLocale();
|
|
60
|
+
const { dir, locale, t } = useUiToolsLocale();
|
|
26
61
|
const controlSize = computed(
|
|
27
62
|
() => props.size ?? dataListUi.ui.value.pagination?.size ?? dataListUi.controlSize.value
|
|
28
63
|
);
|
|
@@ -49,6 +84,24 @@ const paginationProps = computed(
|
|
|
49
84
|
controlProps.value.pagination
|
|
50
85
|
)
|
|
51
86
|
);
|
|
87
|
+
const pagerControls = computed(() => {
|
|
88
|
+
const resolved = paginationProps.value;
|
|
89
|
+
if (resolved.showControls === false) return [];
|
|
90
|
+
return PAGER_CONTROLS.map((control) => {
|
|
91
|
+
const target = control.target(page.value, internals.pagination.totalPages.value);
|
|
92
|
+
return {
|
|
93
|
+
label: t(control.label),
|
|
94
|
+
props: {
|
|
95
|
+
color: resolved.color,
|
|
96
|
+
icon: resolved[control.iconProp] || (dir.value === "rtl" ? control.mirrored : control.icon),
|
|
97
|
+
size: resolved.size,
|
|
98
|
+
to: target === void 0 ? void 0 : resolved.to?.(target),
|
|
99
|
+
variant: resolved.variant
|
|
100
|
+
},
|
|
101
|
+
slot: control.slot
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
});
|
|
52
105
|
const pageSizeProps = computed(
|
|
53
106
|
() => mergeDataListProps({ color: "neutral", size: controlSize.value, variant: "none" }, controlProps.value.pageSize)
|
|
54
107
|
);
|
|
@@ -93,8 +146,9 @@ const paginationControls = computed(() => {
|
|
|
93
146
|
showPagesList: pagination.showPagesList ?? true
|
|
94
147
|
};
|
|
95
148
|
});
|
|
149
|
+
const showViewToggle = computed(() => internals.controls.headerControls.value.summary);
|
|
96
150
|
const showFooter = computed(
|
|
97
|
-
() => internals.pagination.mode.value === "offset" && (paginationControls.value.showPageSizePicker || paginationControls.value.showPagesCount || paginationControls.value.showPagesList)
|
|
151
|
+
() => internals.pagination.mode.value === "offset" && (paginationControls.value.showPageSizePicker || paginationControls.value.showPagesCount || paginationControls.value.showPagesList || showViewToggle.value)
|
|
98
152
|
);
|
|
99
153
|
function formatCount(value) {
|
|
100
154
|
return new Intl.NumberFormat(locale.value.code).format(value);
|
|
@@ -184,6 +238,10 @@ function formatCount(value) {
|
|
|
184
238
|
</slot>
|
|
185
239
|
</div>
|
|
186
240
|
|
|
241
|
+
<div v-if="showViewToggle" class="nut-dl-footer__view mx-auto">
|
|
242
|
+
<slot name="view-toggle"><DataListViewToggle /></slot>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
187
245
|
<div
|
|
188
246
|
v-if="paginationControls.showPagesList"
|
|
189
247
|
:class="
|
|
@@ -273,7 +331,26 @@ function formatCount(value) {
|
|
|
273
331
|
ui.button
|
|
274
332
|
)
|
|
275
333
|
}"
|
|
276
|
-
|
|
334
|
+
>
|
|
335
|
+
<template v-for="control in pagerControls" #[control.slot]>
|
|
336
|
+
<UButton v-bind="control.props" :aria-label="control.label" />
|
|
337
|
+
</template>
|
|
338
|
+
<template #item="{ item, page: current, pageCount }">
|
|
339
|
+
<UButton
|
|
340
|
+
v-if="item.type === 'page'"
|
|
341
|
+
:color="current === item.value ? paginationProps.activeColor : paginationProps.color"
|
|
342
|
+
:variant="
|
|
343
|
+
current === item.value ? paginationProps.activeVariant : paginationProps.variant
|
|
344
|
+
"
|
|
345
|
+
:size="paginationProps.size"
|
|
346
|
+
:label="String(item.value)"
|
|
347
|
+
:aria-label="t('table.footer.page', { current: item.value, total: pageCount })"
|
|
348
|
+
:to="paginationProps.to?.(item.value)"
|
|
349
|
+
:ui="{ label: 'min-w-5 text-center' }"
|
|
350
|
+
square
|
|
351
|
+
/>
|
|
352
|
+
</template>
|
|
353
|
+
</UPagination>
|
|
277
354
|
</slot>
|
|
278
355
|
</div>
|
|
279
356
|
</footer>
|
|
@@ -14,10 +14,10 @@ declare var __VLS_1: {
|
|
|
14
14
|
pageSize: number;
|
|
15
15
|
options: number[];
|
|
16
16
|
setPageSize: (nextPageSize: number) => void;
|
|
17
|
-
}, __VLS_12: {
|
|
17
|
+
}, __VLS_12: {}, __VLS_19: {
|
|
18
18
|
current: number;
|
|
19
19
|
total: number;
|
|
20
|
-
},
|
|
20
|
+
}, __VLS_21: {
|
|
21
21
|
state: {
|
|
22
22
|
hasNextPage: boolean;
|
|
23
23
|
hasPreviousPage: boolean;
|
|
@@ -39,9 +39,11 @@ type __VLS_Slots = {} & {
|
|
|
39
39
|
} & {
|
|
40
40
|
'page-size'?: (props: typeof __VLS_3) => any;
|
|
41
41
|
} & {
|
|
42
|
-
'
|
|
42
|
+
'view-toggle'?: (props: typeof __VLS_12) => any;
|
|
43
43
|
} & {
|
|
44
|
-
|
|
44
|
+
'page-count'?: (props: typeof __VLS_19) => any;
|
|
45
|
+
} & {
|
|
46
|
+
navigation?: (props: typeof __VLS_21) => any;
|
|
45
47
|
};
|
|
46
48
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
47
49
|
compact: boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'vue';
|
|
2
|
+
import type { RenderableType } from '../../../shared/index.js';
|
|
3
|
+
import type { TableInjectedRowActionScope } from '../../composables/use-table-row-actions.js';
|
|
4
|
+
interface SummaryContentProps {
|
|
5
|
+
params: TableInjectedRowActionScope;
|
|
6
|
+
render: (params: TableInjectedRowActionScope) => RenderableType;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders one of a summary row's schema callbacks. The callback runs while this component renders,
|
|
10
|
+
* so each render gets fresh vnodes and the reactive reads inside it belong to this component only.
|
|
11
|
+
*/
|
|
12
|
+
declare const SummaryContent: FunctionalComponent<SummaryContentProps>;
|
|
13
|
+
export default SummaryContent;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { renderVNode } from "../../../shared/utils/render.js";
|
|
2
|
+
const SummaryContent = (props) => renderVNode(props.render(props.params));
|
|
3
|
+
SummaryContent.props = ["params", "render"];
|
|
4
|
+
SummaryContent.displayName = "DataListSummaryContent";
|
|
5
|
+
export default SummaryContent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DataListControlSize, DataListSummaryUi } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The table layout read as one compact row per record, the way a phone screen needs it. It takes
|
|
4
|
+
* the table renderer's place while `table.summary` is active and keeps its states: first-load
|
|
5
|
+
* placeholders, error, empty, refreshing, cursor pages and a virtualized window for long lists.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
height?: string;
|
|
9
|
+
size?: DataListControlSize;
|
|
10
|
+
fill?: boolean;
|
|
11
|
+
ui?: DataListSummaryUi;
|
|
12
|
+
};
|
|
13
|
+
declare function refresh(): void;
|
|
14
|
+
declare var __VLS_8: {
|
|
15
|
+
error: {};
|
|
16
|
+
retry: typeof refresh;
|
|
17
|
+
}, __VLS_17: {};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
error?: (props: typeof __VLS_8) => any;
|
|
20
|
+
} & {
|
|
21
|
+
empty?: (props: typeof __VLS_17) => any;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|