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,10 @@
|
|
|
1
|
+
import type { GenericObject } from '../../types/index.js';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
modelValue: boolean | 'indeterminate';
|
|
3
|
-
|
|
4
|
+
/** The record this checkbox selects; without one it selects every row. */
|
|
5
|
+
row?: GenericObject;
|
|
6
|
+
/** Where the record sits in the rendered rows: it names the record when the schema has no `rowLabel`. */
|
|
7
|
+
index?: number;
|
|
4
8
|
};
|
|
5
9
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
10
|
toggle: (event: MouseEvent) => any;
|
|
@@ -6,6 +6,7 @@ import type { UseTableDataReturn } from './use-table-data.js';
|
|
|
6
6
|
import type { useTableFilters } from './use-table-filters.js';
|
|
7
7
|
import type { useTableLayout } from './use-table-layout.js';
|
|
8
8
|
import type { useTablePagination } from './use-table-pagination.js';
|
|
9
|
+
import type { useTableRowSummary } from './use-table-row-summary.js';
|
|
9
10
|
import type { useTableSelection } from './use-table-selection.js';
|
|
10
11
|
import type { useTableState } from './use-table-state.js';
|
|
11
12
|
import type { useTableTree } from './use-table-tree.js';
|
|
@@ -21,5 +22,6 @@ export interface UseTableApiParams<TSchema = TableSchemaView> {
|
|
|
21
22
|
filters: ReturnType<typeof useTableFilters>;
|
|
22
23
|
pagination: ReturnType<typeof useTablePagination>;
|
|
23
24
|
queryContent: UseTableDataReturn;
|
|
25
|
+
rowSummary: ReturnType<typeof useTableRowSummary>;
|
|
24
26
|
}
|
|
25
27
|
export declare function useTableApi<TSchema = TableSchemaView>(params: UseTableApiParams<TSchema>): TableApi<TSchema>;
|
|
@@ -49,6 +49,13 @@ export function useTableApi(params) {
|
|
|
49
49
|
},
|
|
50
50
|
state: params.controls.layoutState
|
|
51
51
|
};
|
|
52
|
+
const summary = {
|
|
53
|
+
set: params.rowSummary.setActive,
|
|
54
|
+
state: computed(() => ({
|
|
55
|
+
active: params.rowSummary.active.value,
|
|
56
|
+
available: params.rowSummary.available.value
|
|
57
|
+
}))
|
|
58
|
+
};
|
|
52
59
|
const filters = {
|
|
53
60
|
activeCount: computed(() => params.filters.activeUiFilters.value.length),
|
|
54
61
|
clear: params.filters.clearAllFilters,
|
|
@@ -111,6 +118,7 @@ export function useTableApi(params) {
|
|
|
111
118
|
selection,
|
|
112
119
|
sorting,
|
|
113
120
|
state,
|
|
121
|
+
summary,
|
|
114
122
|
updateRow: data.updateRow,
|
|
115
123
|
updateRows: data.updateRows
|
|
116
124
|
};
|
|
@@ -41,6 +41,8 @@ export declare function useTableColumns(params: UseTableColumnsParams): {
|
|
|
41
41
|
cell: ({ row }: {
|
|
42
42
|
row: {
|
|
43
43
|
id: string;
|
|
44
|
+
original: import("../types/index.js").GenericObject;
|
|
45
|
+
index: number;
|
|
44
46
|
};
|
|
45
47
|
}) => import("vue/jsx-runtime").JSX.Element;
|
|
46
48
|
enableHiding: boolean;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ComputedRef } from 'vue';
|
|
2
2
|
import type { TableControlsSchema, TableLayout, TableSchemaView } from '../types/index.js';
|
|
3
3
|
import type { useTableLayout } from './use-table-layout.js';
|
|
4
|
+
import type { useTableRowSummary } from './use-table-row-summary.js';
|
|
4
5
|
export interface UseTableControlsParams {
|
|
5
6
|
schema: ComputedRef<TableSchemaView>;
|
|
6
7
|
layout: ReturnType<typeof useTableLayout>;
|
|
8
|
+
rowSummary: ReturnType<typeof useTableRowSummary>;
|
|
7
9
|
}
|
|
8
10
|
export declare function useTableControls(options: UseTableControlsParams): {
|
|
9
11
|
columnsPanelOpen: import("vue").Ref<boolean, boolean>;
|
|
@@ -39,6 +41,10 @@ export declare function useTableControls(options: UseTableControlsParams): {
|
|
|
39
41
|
grid: ComputedRef<boolean | null>;
|
|
40
42
|
table: ComputedRef<boolean | null>;
|
|
41
43
|
};
|
|
44
|
+
summary: {
|
|
45
|
+
grid: ComputedRef<boolean | null>;
|
|
46
|
+
table: ComputedRef<boolean | null>;
|
|
47
|
+
};
|
|
42
48
|
};
|
|
43
49
|
setTableLayout: (layout: TableLayout) => void;
|
|
44
50
|
tableEnabled: ComputedRef<boolean>;
|
|
@@ -13,15 +13,18 @@ export function useTableControls(options) {
|
|
|
13
13
|
filters: responsiveControl("filters"),
|
|
14
14
|
layout: responsiveControl("layout"),
|
|
15
15
|
refresh: responsiveControl("refresh"),
|
|
16
|
-
sort: responsiveControl("sort")
|
|
16
|
+
sort: responsiveControl("sort"),
|
|
17
|
+
summary: responsiveControl("summary")
|
|
17
18
|
};
|
|
18
19
|
const headerControls = computed(() => ({
|
|
19
20
|
actions: Boolean(rawControls.actions[tableLayout.value].value) && Boolean(options.schema.value.toolbarActions?.length),
|
|
20
|
-
columns: Boolean(rawControls.columns[tableLayout.value].value) && tableLayout.value === "table",
|
|
21
|
+
columns: Boolean(rawControls.columns[tableLayout.value].value) && tableLayout.value === "table" && !options.rowSummary.active.value,
|
|
21
22
|
filters: Boolean(rawControls.filters[tableLayout.value].value) && Boolean(options.schema.value.filters?.ui?.length),
|
|
22
23
|
layout: Boolean(rawControls.layout[tableLayout.value].value) && gridEnabled.value && tableEnabled.value,
|
|
23
24
|
refresh: Boolean(rawControls.refresh[tableLayout.value].value),
|
|
24
|
-
|
|
25
|
+
/* Summary rows have no column headers to sort by, so the menu stands in for them. */
|
|
26
|
+
sort: Boolean(rawControls.sort[tableLayout.value].value) && (tableLayout.value === "grid" && Boolean(options.schema.value.grid?.sortOptions?.length) || options.rowSummary.active.value),
|
|
27
|
+
summary: Boolean(rawControls.summary[tableLayout.value].value) && options.rowSummary.available.value
|
|
25
28
|
}));
|
|
26
29
|
const layoutState = computed(() => {
|
|
27
30
|
const available = [];
|
|
@@ -60,6 +60,10 @@ declare function createTableInternals<TSchema>(options: {
|
|
|
60
60
|
grid: import("vue").ComputedRef<boolean | null>;
|
|
61
61
|
table: import("vue").ComputedRef<boolean | null>;
|
|
62
62
|
};
|
|
63
|
+
summary: {
|
|
64
|
+
grid: import("vue").ComputedRef<boolean | null>;
|
|
65
|
+
table: import("vue").ComputedRef<boolean | null>;
|
|
66
|
+
};
|
|
63
67
|
};
|
|
64
68
|
setTableLayout: (layout: import("../types/index.js").TableLayout) => void;
|
|
65
69
|
tableEnabled: import("vue").ComputedRef<boolean>;
|
|
@@ -327,6 +331,11 @@ declare function createTableInternals<TSchema>(options: {
|
|
|
327
331
|
} | null>;
|
|
328
332
|
};
|
|
329
333
|
resolvedFilterState: import("vue").ComputedRef<import("../types/index.js").TableResolvedFilterGroup<string>>;
|
|
334
|
+
rowSummary: {
|
|
335
|
+
active: import("vue").ComputedRef<boolean>;
|
|
336
|
+
available: import("vue").ComputedRef<boolean>;
|
|
337
|
+
setActive: (next: boolean) => void;
|
|
338
|
+
};
|
|
330
339
|
schema: import("vue").ComputedRef<TableSchemaView>;
|
|
331
340
|
selection: {
|
|
332
341
|
allSelected: import("vue").ComputedRef<boolean>;
|
|
@@ -433,6 +442,8 @@ declare function createTableInternals<TSchema>(options: {
|
|
|
433
442
|
cell: ({ row }: {
|
|
434
443
|
row: {
|
|
435
444
|
id: string;
|
|
445
|
+
original: import("../types/index.js").GenericObject;
|
|
446
|
+
index: number;
|
|
436
447
|
};
|
|
437
448
|
}) => import("vue/jsx-runtime").JSX.Element;
|
|
438
449
|
enableHiding: boolean;
|
|
@@ -672,6 +683,10 @@ declare function useProvideTableInternals<TSchema>(options: {
|
|
|
672
683
|
grid: import("vue").ComputedRef<boolean | null>;
|
|
673
684
|
table: import("vue").ComputedRef<boolean | null>;
|
|
674
685
|
};
|
|
686
|
+
summary: {
|
|
687
|
+
grid: import("vue").ComputedRef<boolean | null>;
|
|
688
|
+
table: import("vue").ComputedRef<boolean | null>;
|
|
689
|
+
};
|
|
675
690
|
};
|
|
676
691
|
setTableLayout: (layout: import("../types/index.js").TableLayout) => void;
|
|
677
692
|
tableEnabled: import("vue").ComputedRef<boolean>;
|
|
@@ -939,6 +954,11 @@ declare function useProvideTableInternals<TSchema>(options: {
|
|
|
939
954
|
} | null>;
|
|
940
955
|
};
|
|
941
956
|
resolvedFilterState: import("vue").ComputedRef<import("../types/index.js").TableResolvedFilterGroup<string>>;
|
|
957
|
+
rowSummary: {
|
|
958
|
+
active: import("vue").ComputedRef<boolean>;
|
|
959
|
+
available: import("vue").ComputedRef<boolean>;
|
|
960
|
+
setActive: (next: boolean) => void;
|
|
961
|
+
};
|
|
942
962
|
schema: import("vue").ComputedRef<TableSchemaView>;
|
|
943
963
|
selection: {
|
|
944
964
|
allSelected: import("vue").ComputedRef<boolean>;
|
|
@@ -1045,6 +1065,8 @@ declare function useProvideTableInternals<TSchema>(options: {
|
|
|
1045
1065
|
cell: ({ row }: {
|
|
1046
1066
|
row: {
|
|
1047
1067
|
id: string;
|
|
1068
|
+
original: import("../types/index.js").GenericObject;
|
|
1069
|
+
index: number;
|
|
1048
1070
|
};
|
|
1049
1071
|
}) => import("vue/jsx-runtime").JSX.Element;
|
|
1050
1072
|
enableHiding: boolean;
|
|
@@ -1281,6 +1303,10 @@ declare function useTableInternals(): {
|
|
|
1281
1303
|
grid: import("vue").ComputedRef<boolean | null>;
|
|
1282
1304
|
table: import("vue").ComputedRef<boolean | null>;
|
|
1283
1305
|
};
|
|
1306
|
+
summary: {
|
|
1307
|
+
grid: import("vue").ComputedRef<boolean | null>;
|
|
1308
|
+
table: import("vue").ComputedRef<boolean | null>;
|
|
1309
|
+
};
|
|
1284
1310
|
};
|
|
1285
1311
|
setTableLayout: (layout: import("../types/index.js").TableLayout) => void;
|
|
1286
1312
|
tableEnabled: import("vue").ComputedRef<boolean>;
|
|
@@ -1548,6 +1574,11 @@ declare function useTableInternals(): {
|
|
|
1548
1574
|
} | null>;
|
|
1549
1575
|
};
|
|
1550
1576
|
resolvedFilterState: import("vue").ComputedRef<import("../types/index.js").TableResolvedFilterGroup<string>>;
|
|
1577
|
+
rowSummary: {
|
|
1578
|
+
active: import("vue").ComputedRef<boolean>;
|
|
1579
|
+
available: import("vue").ComputedRef<boolean>;
|
|
1580
|
+
setActive: (next: boolean) => void;
|
|
1581
|
+
};
|
|
1551
1582
|
schema: import("vue").ComputedRef<TableSchemaView>;
|
|
1552
1583
|
selection: {
|
|
1553
1584
|
allSelected: import("vue").ComputedRef<boolean>;
|
|
@@ -1654,6 +1685,8 @@ declare function useTableInternals(): {
|
|
|
1654
1685
|
cell: ({ row }: {
|
|
1655
1686
|
row: {
|
|
1656
1687
|
id: string;
|
|
1688
|
+
original: import("../types/index.js").GenericObject;
|
|
1689
|
+
index: number;
|
|
1657
1690
|
};
|
|
1658
1691
|
}) => import("vue/jsx-runtime").JSX.Element;
|
|
1659
1692
|
enableHiding: boolean;
|
|
@@ -10,6 +10,7 @@ import { useTableFilters } from "./use-table-filters.js";
|
|
|
10
10
|
import { useTableGrid } from "./use-table-grid.js";
|
|
11
11
|
import { useTableLayout } from "./use-table-layout.js";
|
|
12
12
|
import { useTablePagination } from "./use-table-pagination.js";
|
|
13
|
+
import { useTableRowSummary } from "./use-table-row-summary.js";
|
|
13
14
|
import { useTableSelection } from "./use-table-selection.js";
|
|
14
15
|
import { useTableStartup } from "./use-table-startup.js";
|
|
15
16
|
import { useTableState } from "./use-table-state.js";
|
|
@@ -39,8 +40,14 @@ function createTableInternals(options) {
|
|
|
39
40
|
schema,
|
|
40
41
|
tree
|
|
41
42
|
});
|
|
43
|
+
const rowSummary = useTableRowSummary({
|
|
44
|
+
layout,
|
|
45
|
+
schema,
|
|
46
|
+
tree
|
|
47
|
+
});
|
|
42
48
|
const controls = useTableControls({
|
|
43
49
|
layout,
|
|
50
|
+
rowSummary,
|
|
44
51
|
schema
|
|
45
52
|
});
|
|
46
53
|
const filters = useTableFilters({
|
|
@@ -84,6 +91,7 @@ function createTableInternals(options) {
|
|
|
84
91
|
pagination,
|
|
85
92
|
publicSchema,
|
|
86
93
|
queryContent,
|
|
94
|
+
rowSummary,
|
|
87
95
|
runtimeSchema: schema,
|
|
88
96
|
selection,
|
|
89
97
|
state,
|
|
@@ -109,6 +117,7 @@ function createTableInternals(options) {
|
|
|
109
117
|
queryContent,
|
|
110
118
|
queryState: state.queryState,
|
|
111
119
|
resolvedFilterState: state.resolvedFilterState,
|
|
120
|
+
rowSummary,
|
|
112
121
|
schema,
|
|
113
122
|
selection,
|
|
114
123
|
startup,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GenericObject } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Accessible names for the controls of a record. A record is named by the schema's `rowLabel`;
|
|
4
|
+
* without one, or when it returns nothing for this record, by its position on the page.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTableRowLabels(): {
|
|
7
|
+
rowActions: (params: {
|
|
8
|
+
row: GenericObject;
|
|
9
|
+
index: number;
|
|
10
|
+
}) => string;
|
|
11
|
+
selectAll: () => string;
|
|
12
|
+
selectRow: (params: {
|
|
13
|
+
row: GenericObject;
|
|
14
|
+
index: number;
|
|
15
|
+
}) => string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useUiToolsLocale } from "#ui-tools/i18n";
|
|
2
|
+
import { isNullish } from "../../shared/utils/predicate.js";
|
|
3
|
+
import { useTableInternals } from "./use-table-internals.js";
|
|
4
|
+
const ROW_NAME_KEYS = {
|
|
5
|
+
actions: { named: "table.rowActions.label", positioned: "table.rowActions.labelAt" },
|
|
6
|
+
select: { named: "table.selection.selectRow", positioned: "table.selection.selectRowAt" }
|
|
7
|
+
};
|
|
8
|
+
export function useTableRowLabels() {
|
|
9
|
+
const internals = useTableInternals();
|
|
10
|
+
const { t } = useUiToolsLocale();
|
|
11
|
+
function name(kind, params) {
|
|
12
|
+
const keys = ROW_NAME_KEYS[kind];
|
|
13
|
+
const label = internals.schema.value.rowLabel?.(params.row);
|
|
14
|
+
const text = isNullish(label) ? "" : String(label).trim();
|
|
15
|
+
return text ? t(keys.named, { label: text }) : t(keys.positioned, { position: params.index + 1 });
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
rowActions: (params) => name("actions", params),
|
|
19
|
+
selectAll: () => t("table.selection.selectAll"),
|
|
20
|
+
selectRow: (params) => name("select", params)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { TableSchemaView } from '../types/index.js';
|
|
3
|
+
import type { useTableLayout } from './use-table-layout.js';
|
|
4
|
+
import type { useTableTree } from './use-table-tree.js';
|
|
5
|
+
export interface UseTableRowSummaryParams {
|
|
6
|
+
schema: ComputedRef<TableSchemaView>;
|
|
7
|
+
layout: ReturnType<typeof useTableLayout>;
|
|
8
|
+
tree: ReturnType<typeof useTableTree>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Decides whether the table layout reads as summary rows. `available` is what the schema and the
|
|
12
|
+
* viewport allow; `active` also honours the reader's choice, which the toggle changes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useTableRowSummary(params: UseTableRowSummaryParams): {
|
|
15
|
+
active: ComputedRef<boolean>;
|
|
16
|
+
available: ComputedRef<boolean>;
|
|
17
|
+
setActive: (next: boolean) => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useCookie } from "nuxt/app";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { useResponsiveValue } from "#ui-tools/shared";
|
|
4
|
+
import { isFunction } from "../../shared/utils/predicate.js";
|
|
5
|
+
import {
|
|
6
|
+
TABLE_SUMMARY_DEFAULT_ENABLED,
|
|
7
|
+
TABLE_SUMMARY_PREFERENCE_MAX_AGE
|
|
8
|
+
} from "../constants/summary.js";
|
|
9
|
+
export function useTableRowSummary(params) {
|
|
10
|
+
const summary = computed(() => params.schema.value.table?.summary);
|
|
11
|
+
const enabled = useResponsiveValue(() => {
|
|
12
|
+
const configured = summary.value?.enabled;
|
|
13
|
+
const resolved = isFunction(configured) ? configured() : configured;
|
|
14
|
+
return String(resolved ?? TABLE_SUMMARY_DEFAULT_ENABLED);
|
|
15
|
+
}, "boolean");
|
|
16
|
+
const available = computed(
|
|
17
|
+
() => summary.value !== void 0 && !params.tree.enabled.value && params.layout.tableEnabled.value && params.layout.activeLayout.value === "table" && (enabled.value ?? true)
|
|
18
|
+
);
|
|
19
|
+
const persistPreferences = computed(() => params.schema.value.persistence?.preferences !== false);
|
|
20
|
+
const cookieName = `${encodeURIComponent(params.schema.value.tableKey)}::view`;
|
|
21
|
+
const stored = useCookie(cookieName, {
|
|
22
|
+
decode: (value) => value === "table" ? "table" : null,
|
|
23
|
+
default: () => null,
|
|
24
|
+
encode: (value) => value ?? "",
|
|
25
|
+
maxAge: TABLE_SUMMARY_PREFERENCE_MAX_AGE
|
|
26
|
+
});
|
|
27
|
+
const session = ref(null);
|
|
28
|
+
const choice = computed({
|
|
29
|
+
get: () => persistPreferences.value ? stored.value : session.value,
|
|
30
|
+
set: (next) => {
|
|
31
|
+
if (persistPreferences.value) stored.value = next;
|
|
32
|
+
else session.value = next;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const active = computed(() => available.value && choice.value === null);
|
|
36
|
+
function setActive(next) {
|
|
37
|
+
if (!available.value) return;
|
|
38
|
+
choice.value = next ? null : "table";
|
|
39
|
+
}
|
|
40
|
+
return { active, available, setActive };
|
|
41
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The classes the package adds below the `md` breakpoint, so every control a thumb reaches has a
|
|
3
|
+
* 44px tap target. `layerDataListMobileDefaults` puts them under the classes a slot already has,
|
|
4
|
+
* which keeps the app's own slot classes and lets them win where they conflict. Desktop sizing is
|
|
5
|
+
* untouched.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DATA_LIST_MOBILE_DEFAULTS: {
|
|
8
|
+
readonly columnPanel: {
|
|
9
|
+
readonly ui: {
|
|
10
|
+
readonly trigger: "min-h-11 min-w-11";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
readonly content: {
|
|
14
|
+
readonly ui: {
|
|
15
|
+
readonly retry: "min-h-11 min-w-11";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly filterPanel: {
|
|
19
|
+
readonly ui: {
|
|
20
|
+
readonly trigger: "min-h-11 min-w-11";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly filterTags: {
|
|
24
|
+
readonly ui: {
|
|
25
|
+
readonly sheetTrigger: "min-h-11 min-w-11";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly infiniteLoader: {
|
|
29
|
+
readonly ui: {
|
|
30
|
+
readonly loadMore: "min-h-11 min-w-11";
|
|
31
|
+
readonly retry: "min-h-11 min-w-11";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly layoutSwitch: {
|
|
35
|
+
readonly ui: {
|
|
36
|
+
readonly trigger: "min-h-11 min-w-11";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly pagination: {
|
|
40
|
+
readonly ui: {
|
|
41
|
+
readonly button: "min-h-11 min-w-11";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly refresh: {
|
|
45
|
+
readonly ui: {
|
|
46
|
+
readonly base: "min-h-11 min-w-11";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly search: {
|
|
50
|
+
readonly ui: {
|
|
51
|
+
readonly base: "min-h-11";
|
|
52
|
+
readonly clear: "min-h-11 min-w-11";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly selectionActions: {
|
|
56
|
+
readonly ui: {
|
|
57
|
+
readonly action: "h-11 min-w-11";
|
|
58
|
+
readonly dismiss: "size-11";
|
|
59
|
+
readonly overflow: "size-11";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly sortMenu: {
|
|
63
|
+
readonly ui: {
|
|
64
|
+
readonly trigger: "min-h-11 min-w-11";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly table: {
|
|
68
|
+
readonly ui: {
|
|
69
|
+
readonly emptyAction: "min-h-11 min-w-11";
|
|
70
|
+
readonly rowAction: "min-h-11 min-w-11";
|
|
71
|
+
readonly selectControl: "relative before:absolute before:top-1/2 before:left-1/2 before:size-11 before:-translate-x-1/2 before:-translate-y-1/2";
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly viewToggle: {
|
|
75
|
+
readonly ui: {
|
|
76
|
+
readonly base: "min-h-11 min-w-11";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const TOUCH_TARGET = "min-h-11 min-w-11";
|
|
2
|
+
const TOUCH_AREA = "relative before:absolute before:top-1/2 before:left-1/2 before:size-11 before:-translate-x-1/2 before:-translate-y-1/2";
|
|
3
|
+
export const DATA_LIST_MOBILE_DEFAULTS = {
|
|
4
|
+
columnPanel: { ui: { trigger: TOUCH_TARGET } },
|
|
5
|
+
content: { ui: { retry: TOUCH_TARGET } },
|
|
6
|
+
filterPanel: { ui: { trigger: TOUCH_TARGET } },
|
|
7
|
+
filterTags: { ui: { sheetTrigger: TOUCH_TARGET } },
|
|
8
|
+
infiniteLoader: { ui: { loadMore: TOUCH_TARGET, retry: TOUCH_TARGET } },
|
|
9
|
+
layoutSwitch: { ui: { trigger: TOUCH_TARGET } },
|
|
10
|
+
pagination: { ui: { button: TOUCH_TARGET } },
|
|
11
|
+
refresh: { ui: { base: TOUCH_TARGET } },
|
|
12
|
+
search: { ui: { base: "min-h-11", clear: TOUCH_TARGET } },
|
|
13
|
+
selectionActions: { ui: { action: "h-11 min-w-11", dismiss: "size-11", overflow: "size-11" } },
|
|
14
|
+
sortMenu: { ui: { trigger: TOUCH_TARGET } },
|
|
15
|
+
table: { ui: { emptyAction: TOUCH_TARGET, rowAction: TOUCH_TARGET, selectControl: TOUCH_AREA } },
|
|
16
|
+
viewToggle: { ui: { base: TOUCH_TARGET } }
|
|
17
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Summary rows below the `md` breakpoint, the full table from `md` up. */
|
|
2
|
+
export declare const TABLE_SUMMARY_DEFAULT_ENABLED = "true md:false";
|
|
3
|
+
/** How long the reader's summary/table choice is remembered, in seconds. */
|
|
4
|
+
export declare const TABLE_SUMMARY_PREFERENCE_MAX_AGE: number;
|
|
5
|
+
/** Separates the values of a summary row's detail line. */
|
|
6
|
+
export declare const TABLE_SUMMARY_DETAILS_SEPARATOR = " \u00B7 ";
|
|
7
|
+
/** From this many rows on, only the rows on screen are rendered, as in the table. */
|
|
8
|
+
export declare const TABLE_SUMMARY_VIRTUALIZE_THRESHOLD = 40;
|
|
9
|
+
/** Placeholder rows of a first load, however short the viewport is. */
|
|
10
|
+
export declare const TABLE_SUMMARY_SKELETON_MIN_ROWS = 6;
|
|
11
|
+
/** Rows from the end of a cursor list at which the next page is requested. */
|
|
12
|
+
export declare const TABLE_SUMMARY_LOAD_MORE_THRESHOLD = 6;
|
|
13
|
+
/** What each control size gives a row, in px: its font, side gutter, height and leading tile. */
|
|
14
|
+
export declare const TABLE_SUMMARY_SIZE_TOKENS: {
|
|
15
|
+
lg: {
|
|
16
|
+
font: number;
|
|
17
|
+
gutter: number;
|
|
18
|
+
row: number;
|
|
19
|
+
tile: number;
|
|
20
|
+
};
|
|
21
|
+
md: {
|
|
22
|
+
font: number;
|
|
23
|
+
gutter: number;
|
|
24
|
+
row: number;
|
|
25
|
+
tile: number;
|
|
26
|
+
};
|
|
27
|
+
sm: {
|
|
28
|
+
font: number;
|
|
29
|
+
gutter: number;
|
|
30
|
+
row: number;
|
|
31
|
+
tile: number;
|
|
32
|
+
};
|
|
33
|
+
xl: {
|
|
34
|
+
font: number;
|
|
35
|
+
gutter: number;
|
|
36
|
+
row: number;
|
|
37
|
+
tile: number;
|
|
38
|
+
};
|
|
39
|
+
xs: {
|
|
40
|
+
font: number;
|
|
41
|
+
gutter: number;
|
|
42
|
+
row: number;
|
|
43
|
+
tile: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The classes of every summary slot. Rows sit on the default surface, never on the page's tint,
|
|
48
|
+
* with a hairline between them; the app's `ui.summary.ui` is merged over these.
|
|
49
|
+
*/
|
|
50
|
+
export declare const TABLE_SUMMARY_SLOT_CLASSES: {
|
|
51
|
+
readonly actions: "nut-dl-summary__actions flex shrink-0 items-center pe-[calc(var(--nut-dl-summary-x)/2)]";
|
|
52
|
+
readonly body: "nut-dl-summary__body min-w-0 flex-1";
|
|
53
|
+
readonly details: "nut-dl-summary__details min-w-0 truncate";
|
|
54
|
+
readonly header: "nut-dl-summary__header flex min-h-11 shrink-0 items-center gap-1 border-b border-muted bg-default pe-[var(--nut-dl-summary-x)] text-[length:var(--nut-dl-summary-meta)] font-medium text-muted";
|
|
55
|
+
readonly leading: "nut-dl-summary__leading flex size-[var(--nut-dl-summary-tile)] shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accented text-xs font-semibold text-muted empty:hidden";
|
|
56
|
+
readonly list: "nut-dl-summary__list";
|
|
57
|
+
readonly loadingMore: "nut-dl-summary__more flex min-h-[var(--nut-dl-summary-row-h)] items-center justify-center gap-2.5 text-[12.5px] text-muted";
|
|
58
|
+
readonly main: "nut-dl-summary__main flex min-w-0 flex-1 items-center gap-3 py-2.5 text-start focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
|
|
59
|
+
readonly meta: "nut-dl-summary__meta mt-0.5 flex min-w-0 items-center gap-2 text-[length:var(--nut-dl-summary-meta)] leading-snug text-muted";
|
|
60
|
+
readonly root: "nut-dl-summary relative flex min-h-0 flex-col bg-default";
|
|
61
|
+
readonly row: "nut-dl-summary__row relative flex min-h-[var(--nut-dl-summary-row-h)] items-stretch border-b border-muted bg-default";
|
|
62
|
+
readonly select: "nut-dl-summary__select flex shrink-0 items-center";
|
|
63
|
+
readonly skeleton: "nut-dl-summary__skeleton flex min-h-[var(--nut-dl-summary-row-h)] items-center gap-3 border-b border-muted px-[var(--nut-dl-summary-x)]";
|
|
64
|
+
readonly status: "nut-dl-summary__status shrink-0 empty:hidden";
|
|
65
|
+
readonly title: "nut-dl-summary__title block truncate text-[length:var(--nut-dl-summary-font)] leading-snug font-semibold text-highlighted";
|
|
66
|
+
readonly viewport: "nut-dl-summary__viewport relative min-h-0 overflow-x-hidden overflow-y-auto";
|
|
67
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const TABLE_SUMMARY_DEFAULT_ENABLED = "true md:false";
|
|
2
|
+
export const TABLE_SUMMARY_PREFERENCE_MAX_AGE = 60 * 60 * 24 * 365;
|
|
3
|
+
export const TABLE_SUMMARY_DETAILS_SEPARATOR = " \xB7 ";
|
|
4
|
+
export const TABLE_SUMMARY_VIRTUALIZE_THRESHOLD = 40;
|
|
5
|
+
export const TABLE_SUMMARY_SKELETON_MIN_ROWS = 6;
|
|
6
|
+
export const TABLE_SUMMARY_LOAD_MORE_THRESHOLD = 6;
|
|
7
|
+
export const TABLE_SUMMARY_SIZE_TOKENS = {
|
|
8
|
+
lg: { font: 14, gutter: 16, row: 72, tile: 36 },
|
|
9
|
+
md: { font: 13.5, gutter: 14, row: 64, tile: 32 },
|
|
10
|
+
sm: { font: 13, gutter: 12, row: 60, tile: 32 },
|
|
11
|
+
xl: { font: 15, gutter: 16, row: 80, tile: 40 },
|
|
12
|
+
xs: { font: 12.5, gutter: 12, row: 56, tile: 28 }
|
|
13
|
+
};
|
|
14
|
+
export const TABLE_SUMMARY_SLOT_CLASSES = {
|
|
15
|
+
actions: "nut-dl-summary__actions flex shrink-0 items-center pe-[calc(var(--nut-dl-summary-x)/2)]",
|
|
16
|
+
body: "nut-dl-summary__body min-w-0 flex-1",
|
|
17
|
+
details: "nut-dl-summary__details min-w-0 truncate",
|
|
18
|
+
header: "nut-dl-summary__header flex min-h-11 shrink-0 items-center gap-1 border-b border-muted bg-default pe-[var(--nut-dl-summary-x)] text-[length:var(--nut-dl-summary-meta)] font-medium text-muted",
|
|
19
|
+
leading: "nut-dl-summary__leading flex size-[var(--nut-dl-summary-tile)] shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accented text-xs font-semibold text-muted empty:hidden",
|
|
20
|
+
list: "nut-dl-summary__list",
|
|
21
|
+
loadingMore: "nut-dl-summary__more flex min-h-[var(--nut-dl-summary-row-h)] items-center justify-center gap-2.5 text-[12.5px] text-muted",
|
|
22
|
+
main: "nut-dl-summary__main flex min-w-0 flex-1 items-center gap-3 py-2.5 text-start focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",
|
|
23
|
+
meta: "nut-dl-summary__meta mt-0.5 flex min-w-0 items-center gap-2 text-[length:var(--nut-dl-summary-meta)] leading-snug text-muted",
|
|
24
|
+
root: "nut-dl-summary relative flex min-h-0 flex-col bg-default",
|
|
25
|
+
row: "nut-dl-summary__row relative flex min-h-[var(--nut-dl-summary-row-h)] items-stretch border-b border-muted bg-default",
|
|
26
|
+
select: "nut-dl-summary__select flex shrink-0 items-center",
|
|
27
|
+
skeleton: "nut-dl-summary__skeleton flex min-h-[var(--nut-dl-summary-row-h)] items-center gap-3 border-b border-muted px-[var(--nut-dl-summary-x)]",
|
|
28
|
+
status: "nut-dl-summary__status shrink-0 empty:hidden",
|
|
29
|
+
title: "nut-dl-summary__title block truncate text-[length:var(--nut-dl-summary-font)] leading-snug font-semibold text-highlighted",
|
|
30
|
+
viewport: "nut-dl-summary__viewport relative min-h-0 overflow-x-hidden overflow-y-auto"
|
|
31
|
+
};
|