nuxt-ui-tools 1.2.0 → 1.4.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 +18 -2
- package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +2 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +4 -1
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +2 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.d.vue.ts +20 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.vue +42 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.vue.d.ts +20 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.d.vue.ts +8 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue +29 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue.d.ts +8 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.d.vue.ts +21 -0
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue.d.ts +21 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +30 -9
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-bars.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-card.vue +28 -6
- package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +6 -1
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +13 -3
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +6 -1
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +5 -5
- package/dist/runtime/dashboard/components/dashboard-feed.vue +1 -1
- package/dist/runtime/dashboard/components/dashboard-filter.d.vue.ts +67 -0
- package/dist/runtime/dashboard/components/dashboard-filter.vue +134 -0
- package/dist/runtime/dashboard/components/dashboard-filter.vue.d.ts +67 -0
- package/dist/runtime/dashboard/components/dashboard-filters.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-filters.vue +96 -0
- package/dist/runtime/dashboard/components/dashboard-filters.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue +5 -5
- package/dist/runtime/dashboard/components/dashboard-gauge.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +10 -3
- package/dist/runtime/dashboard/components/dashboard-grid.vue +24 -9
- package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +10 -3
- package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue +30 -9
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +3 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue +18 -6
- package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +3 -0
- package/dist/runtime/dashboard/components/dashboard-page.d.vue.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-page.vue +156 -0
- package/dist/runtime/dashboard/components/dashboard-page.vue.d.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-refresh.vue +1 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +14 -2
- package/dist/runtime/dashboard/components/dashboard-stat.vue +28 -10
- package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +14 -2
- package/dist/runtime/dashboard/components/dashboard-stats.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-table.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +7 -2
- package/dist/runtime/dashboard/components/dashboard-total.vue +10 -2
- package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +7 -2
- package/dist/runtime/dashboard/components/dashboard-view-tabs.d.vue.ts +33 -0
- package/dist/runtime/dashboard/components/dashboard-view-tabs.vue +66 -0
- package/dist/runtime/dashboard/components/dashboard-view-tabs.vue.d.ts +33 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue +1 -1
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.d.vue.ts +44 -0
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue +220 -0
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue.d.ts +44 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +6 -1
- package/dist/runtime/dashboard/composables/use-dashboard-api.js +29 -6
- package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +5 -4
- package/dist/runtime/dashboard/composables/use-dashboard-block.js +32 -15
- package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +8 -1
- package/dist/runtime/dashboard/composables/use-dashboard-chart.js +16 -4
- package/dist/runtime/dashboard/composables/use-dashboard-context.d.ts +50 -0
- package/dist/runtime/dashboard/composables/use-dashboard-context.js +56 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.js +6 -1
- package/dist/runtime/dashboard/composables/use-dashboard-filter-control.d.ts +16 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-control.js +161 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.d.ts +37 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.js +107 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +46 -6
- package/dist/runtime/dashboard/composables/use-dashboard-format.js +51 -8
- package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +11 -4
- package/dist/runtime/dashboard/composables/use-dashboard-options.js +33 -47
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +8 -5
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +59 -70
- package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +15 -4
- package/dist/runtime/dashboard/composables/use-dashboard-resource.js +52 -17
- package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +10 -7
- package/dist/runtime/dashboard/composables/use-dashboard-scope.js +26 -16
- package/dist/runtime/dashboard/composables/use-dashboard-series-picker.d.ts +20 -0
- package/dist/runtime/dashboard/composables/use-dashboard-series-picker.js +30 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +2 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.js +4 -1
- package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +12 -2
- package/dist/runtime/dashboard/composables/use-dashboard-ui.js +3 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +15 -3
- package/dist/runtime/dashboard/composables/use-dashboard-views.js +33 -10
- package/dist/runtime/dashboard/composables/use-dashboard.d.ts +18 -12
- package/dist/runtime/dashboard/composables/use-dashboard.js +98 -9
- package/dist/runtime/dashboard/index.d.ts +3 -1
- package/dist/runtime/dashboard/index.js +3 -1
- package/dist/runtime/dashboard/schema/index.d.ts +62 -30
- package/dist/runtime/dashboard/schema/index.js +3 -0
- package/dist/runtime/dashboard/types/blocks.d.ts +30 -4
- package/dist/runtime/dashboard/types/charts.d.ts +2 -2
- package/dist/runtime/dashboard/types/controls.d.ts +123 -0
- package/dist/runtime/dashboard/types/filters.d.ts +236 -0
- package/dist/runtime/dashboard/types/index.d.ts +3 -2
- package/dist/runtime/dashboard/types/page.d.ts +17 -0
- package/dist/runtime/dashboard/types/page.js +0 -0
- package/dist/runtime/dashboard/types/resource.d.ts +66 -28
- package/dist/runtime/dashboard/types/runtime.d.ts +39 -8
- package/dist/runtime/dashboard/types/schema.d.ts +94 -54
- package/dist/runtime/dashboard/types/ui.d.ts +78 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-filters.d.ts +142 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-filters.js +135 -0
- package/dist/runtime/dashboard/utils/charts.d.ts +4 -15
- package/dist/runtime/dashboard/utils/charts.js +26 -28
- package/dist/runtime/dashboard/utils/{params/codecs.d.ts → codecs.d.ts} +2 -2
- package/dist/runtime/dashboard/utils/{params/codecs.js → codecs.js} +1 -1
- package/dist/runtime/dashboard/utils/environment.d.ts +36 -0
- package/dist/runtime/dashboard/utils/environment.js +30 -0
- package/dist/runtime/dashboard/utils/filters.d.ts +44 -0
- package/dist/runtime/dashboard/utils/filters.js +62 -0
- package/dist/runtime/dashboard/utils/format.d.ts +25 -0
- package/dist/runtime/dashboard/utils/format.js +66 -0
- package/dist/runtime/dashboard/utils/grid.d.ts +17 -0
- package/dist/runtime/dashboard/utils/grid.js +14 -0
- package/dist/runtime/dashboard/utils/options.d.ts +3 -1
- package/dist/runtime/dashboard/utils/options.js +6 -0
- package/dist/runtime/dashboard/utils/remote.d.ts +7 -0
- package/dist/runtime/dashboard/utils/remote.js +14 -0
- package/dist/runtime/dashboard/utils/resource.d.ts +16 -7
- package/dist/runtime/dashboard/utils/resource.js +15 -9
- package/dist/runtime/dashboard/utils/schema.d.ts +8 -3
- package/dist/runtime/dashboard/utils/schema.js +9 -4
- package/dist/runtime/dashboard/utils/state.d.ts +11 -6
- package/dist/runtime/dashboard/utils/state.js +10 -5
- package/dist/runtime/dashboard/utils/time.d.ts +2 -0
- package/dist/runtime/dashboard/utils/time.js +11 -1
- package/dist/runtime/dashboard/utils/ui.d.ts +1 -1
- package/dist/runtime/dashboard/utils/ui.js +1 -1
- package/dist/runtime/form/components/actions/form-actions.vue +13 -127
- package/dist/runtime/form/components/page/form-page-actions.d.vue.ts +3 -0
- package/dist/runtime/form/components/page/form-page-actions.vue +40 -0
- package/dist/runtime/form/components/page/form-page-actions.vue.d.ts +3 -0
- package/dist/runtime/form/components/page/form-page-header.d.vue.ts +24 -0
- package/dist/runtime/form/components/page/form-page-header.vue +99 -0
- package/dist/runtime/form/components/page/form-page-header.vue.d.ts +24 -0
- package/dist/runtime/form/components/page/form-page-navigation.d.vue.ts +34 -0
- package/dist/runtime/form/components/page/form-page-navigation.vue +229 -0
- package/dist/runtime/form/components/page/form-page-navigation.vue.d.ts +34 -0
- package/dist/runtime/form/components/page/form-page-section.d.vue.ts +19 -0
- package/dist/runtime/form/components/page/form-page-section.vue +114 -0
- package/dist/runtime/form/components/page/form-page-section.vue.d.ts +19 -0
- package/dist/runtime/form/components/page/form-page-sections.d.vue.ts +21 -0
- package/dist/runtime/form/components/page/form-page-sections.vue +75 -0
- package/dist/runtime/form/components/page/form-page-sections.vue.d.ts +21 -0
- package/dist/runtime/form/components/page/form-page.d.vue.ts +80 -0
- package/dist/runtime/form/components/page/form-page.vue +91 -0
- package/dist/runtime/form/components/page/form-page.vue.d.ts +80 -0
- package/dist/runtime/form/components/renderer/form-field-shell.vue +7 -11
- package/dist/runtime/form/components/root/form.vue +26 -195
- package/dist/runtime/form/composables/use-form-action-buttons.d.ts +32 -0
- package/dist/runtime/form/composables/use-form-action-buttons.js +89 -0
- package/dist/runtime/form/composables/use-form-actions.d.ts +8 -5
- package/dist/runtime/form/composables/use-form-actions.js +1 -1
- package/dist/runtime/form/composables/use-form-page-scroll.d.ts +22 -0
- package/dist/runtime/form/composables/use-form-page-scroll.js +178 -0
- package/dist/runtime/form/composables/use-form-page.d.ts +114 -0
- package/dist/runtime/form/composables/use-form-page.js +83 -0
- package/dist/runtime/form/composables/use-form-root.d.ts +34 -0
- package/dist/runtime/form/composables/use-form-root.js +171 -0
- package/dist/runtime/form/composables/use-form-runtime.js +13 -4
- package/dist/runtime/form/composables/use-form.js +2 -22
- package/dist/runtime/form/fields/card-selection.d.ts +1 -0
- package/dist/runtime/form/fields/card-selection.js +1 -0
- package/dist/runtime/form/fields/checkbox-card/component.vue +28 -17
- package/dist/runtime/form/fields/checkbox-card/types.d.ts +2 -5
- package/dist/runtime/form/fields/checkbox-group/component.vue +5 -0
- package/dist/runtime/form/fields/choice-card/choice-card-label.d.vue.ts +17 -0
- package/dist/runtime/form/fields/choice-card/choice-card-label.vue +50 -0
- package/dist/runtime/form/fields/choice-card/choice-card-label.vue.d.ts +17 -0
- package/dist/runtime/form/fields/choice-card/types.d.ts +31 -0
- package/dist/runtime/form/fields/choice-card/types.js +0 -0
- package/dist/runtime/form/fields/choice-card/use-choice-card.d.ts +22 -0
- package/dist/runtime/form/fields/choice-card/use-choice-card.js +52 -0
- package/dist/runtime/form/fields/radio/component.vue +10 -0
- package/dist/runtime/form/fields/radio-card/component.vue +17 -16
- package/dist/runtime/form/fields/radio-card/types.d.ts +2 -4
- package/dist/runtime/form/index.d.ts +1 -1
- package/dist/runtime/form/index.js +7 -1
- package/dist/runtime/form/schema/index.d.ts +1 -1
- package/dist/runtime/form/schema/index.js +1 -0
- package/dist/runtime/form/schema/page.d.ts +50 -0
- package/dist/runtime/form/schema/page.js +25 -0
- package/dist/runtime/form/types/index.d.ts +1 -0
- package/dist/runtime/form/types/options.d.ts +1 -11
- package/dist/runtime/form/types/page.d.ts +172 -0
- package/dist/runtime/form/types/page.js +0 -0
- package/dist/runtime/form/types/ui.d.ts +60 -0
- package/dist/runtime/form/utils/controls.d.ts +15 -0
- package/dist/runtime/form/utils/controls.js +38 -0
- package/dist/runtime/form/utils/focus.js +1 -1
- package/dist/runtime/form/utils/layout.js +3 -1
- package/dist/runtime/form/utils/page.d.ts +20 -0
- package/dist/runtime/form/utils/page.js +107 -0
- package/dist/runtime/form/utils/state.d.ts +2 -0
- package/dist/runtime/form/utils/state.js +1 -1
- package/dist/runtime/form/utils/ui.js +1 -0
- package/dist/runtime/i18n/locales/en.js +47 -0
- package/dist/runtime/i18n/locales/fr.js +47 -0
- package/dist/runtime/i18n/types.d.ts +70 -0
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/types/query.d.ts +8 -0
- package/dist/runtime/table/types/index.d.ts +1 -0
- package/dist/runtime/table/types/remote-options.d.ts +64 -0
- package/dist/runtime/table/types/remote-options.js +0 -0
- package/dist/runtime/table/types/source.d.ts +10 -1
- package/dist/runtime/table/utils/builders/table-source.d.ts +2 -6
- package/dist/runtime/table/utils/index.d.ts +1 -0
- package/dist/runtime/table/utils/index.js +1 -0
- package/dist/runtime/table/utils/remote-table-options.d.ts +26 -0
- package/dist/runtime/table/utils/remote-table-options.js +88 -0
- package/package.json +4 -1
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +0 -30
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +0 -71
- package/dist/runtime/dashboard/types/options.d.ts +0 -46
- package/dist/runtime/dashboard/types/params.d.ts +0 -115
- package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +0 -85
- package/dist/runtime/dashboard/utils/builders/dashboard-params.js +0 -87
- /package/dist/runtime/dashboard/types/{options.js → controls.js} +0 -0
- /package/dist/runtime/dashboard/types/{params.js → filters.js} +0 -0
|
@@ -19,6 +19,27 @@ export default defineUiToolsLocale({
|
|
|
19
19
|
series: "{label} (previous period)",
|
|
20
20
|
year: "Previous year"
|
|
21
21
|
},
|
|
22
|
+
filters: {
|
|
23
|
+
all: "All",
|
|
24
|
+
clear: "Clear {label}",
|
|
25
|
+
clearSelection: "Clear selection",
|
|
26
|
+
empty: "No results",
|
|
27
|
+
label: "Filters",
|
|
28
|
+
loadError: "Options could not be loaded",
|
|
29
|
+
loading: "Loading\u2026",
|
|
30
|
+
more: "{label} +{count}",
|
|
31
|
+
no: "No",
|
|
32
|
+
presets: "Presets",
|
|
33
|
+
reset: "Reset",
|
|
34
|
+
retry: "Retry",
|
|
35
|
+
search: "Search\u2026",
|
|
36
|
+
views: "Views",
|
|
37
|
+
yes: "Yes"
|
|
38
|
+
},
|
|
39
|
+
format: {
|
|
40
|
+
pointsOne: "{value} pt",
|
|
41
|
+
pointsOther: "{value} pts"
|
|
42
|
+
},
|
|
22
43
|
freshness: {
|
|
23
44
|
prefix: "Updated",
|
|
24
45
|
updated: "Updated {time}"
|
|
@@ -39,6 +60,14 @@ export default defineUiToolsLocale({
|
|
|
39
60
|
label: "Refresh",
|
|
40
61
|
off: "Off"
|
|
41
62
|
},
|
|
63
|
+
page: {
|
|
64
|
+
loading: "loading\u2026",
|
|
65
|
+
updated: "updated"
|
|
66
|
+
},
|
|
67
|
+
series: {
|
|
68
|
+
add: "Add",
|
|
69
|
+
remove: "Remove {label}"
|
|
70
|
+
},
|
|
42
71
|
rowActions: "Actions for {label}",
|
|
43
72
|
stat: {
|
|
44
73
|
goal: "Goal {value}"
|
|
@@ -72,6 +101,24 @@ export default defineUiToolsLocale({
|
|
|
72
101
|
resetButton: "Reset",
|
|
73
102
|
submitButton: "Submit"
|
|
74
103
|
},
|
|
104
|
+
page: {
|
|
105
|
+
complete: "Everything is ready.",
|
|
106
|
+
modifiedOne: "{count} modified.",
|
|
107
|
+
modifiedOther: "{count} modified.",
|
|
108
|
+
navigation: "Form sections",
|
|
109
|
+
optional: "optional",
|
|
110
|
+
remaining: "{count} left to complete.",
|
|
111
|
+
resetSection: "Reset",
|
|
112
|
+
sectionsOne: "{count} section",
|
|
113
|
+
sectionsOther: "{count} sections",
|
|
114
|
+
status: {
|
|
115
|
+
complete: "Complete",
|
|
116
|
+
invalid: "Has errors",
|
|
117
|
+
pending: "To complete"
|
|
118
|
+
},
|
|
119
|
+
unmodified: "No unsaved changes.",
|
|
120
|
+
unsavedChanges: "Unsaved changes"
|
|
121
|
+
},
|
|
75
122
|
fields: {
|
|
76
123
|
array: {
|
|
77
124
|
addItem: "Add item",
|
|
@@ -19,6 +19,27 @@ export default defineUiToolsLocale({
|
|
|
19
19
|
series: "{label} (p\xE9riode pr\xE9c\xE9dente)",
|
|
20
20
|
year: "Ann\xE9e pr\xE9c\xE9dente"
|
|
21
21
|
},
|
|
22
|
+
filters: {
|
|
23
|
+
all: "Tous",
|
|
24
|
+
clear: "Effacer le filtre {label}",
|
|
25
|
+
clearSelection: "Effacer la s\xE9lection",
|
|
26
|
+
empty: "Aucun r\xE9sultat",
|
|
27
|
+
label: "Filtres",
|
|
28
|
+
loadError: "Impossible de charger les options",
|
|
29
|
+
loading: "Chargement\u2026",
|
|
30
|
+
more: "{label} +{count}",
|
|
31
|
+
no: "Non",
|
|
32
|
+
presets: "Pr\xE9r\xE9glages",
|
|
33
|
+
reset: "R\xE9initialiser",
|
|
34
|
+
retry: "R\xE9essayer",
|
|
35
|
+
search: "Rechercher\u2026",
|
|
36
|
+
views: "Vues",
|
|
37
|
+
yes: "Oui"
|
|
38
|
+
},
|
|
39
|
+
format: {
|
|
40
|
+
pointsOne: "{value} pt",
|
|
41
|
+
pointsOther: "{value} pts"
|
|
42
|
+
},
|
|
22
43
|
freshness: {
|
|
23
44
|
prefix: "Mis \xE0 jour",
|
|
24
45
|
updated: "Mis \xE0 jour {time}"
|
|
@@ -39,6 +60,14 @@ export default defineUiToolsLocale({
|
|
|
39
60
|
label: "Actualiser",
|
|
40
61
|
off: "D\xE9sactiv\xE9e"
|
|
41
62
|
},
|
|
63
|
+
page: {
|
|
64
|
+
loading: "chargement\u2026",
|
|
65
|
+
updated: "mis \xE0 jour"
|
|
66
|
+
},
|
|
67
|
+
series: {
|
|
68
|
+
add: "Ajouter",
|
|
69
|
+
remove: "Retirer {label}"
|
|
70
|
+
},
|
|
42
71
|
rowActions: "Actions pour {label}",
|
|
43
72
|
stat: {
|
|
44
73
|
goal: "Objectif {value}"
|
|
@@ -72,6 +101,24 @@ export default defineUiToolsLocale({
|
|
|
72
101
|
resetButton: "R\xE9initialiser",
|
|
73
102
|
submitButton: "Soumettre"
|
|
74
103
|
},
|
|
104
|
+
page: {
|
|
105
|
+
complete: "Tout est pr\xEAt.",
|
|
106
|
+
modifiedOne: "{count} modifi\xE9e.",
|
|
107
|
+
modifiedOther: "{count} modifi\xE9es.",
|
|
108
|
+
navigation: "Sections du formulaire",
|
|
109
|
+
optional: "optionnel",
|
|
110
|
+
remaining: "{count} \xE0 compl\xE9ter.",
|
|
111
|
+
resetSection: "R\xE9initialiser",
|
|
112
|
+
sectionsOne: "{count} section",
|
|
113
|
+
sectionsOther: "{count} sections",
|
|
114
|
+
status: {
|
|
115
|
+
complete: "Compl\xE8te",
|
|
116
|
+
invalid: "Contient des erreurs",
|
|
117
|
+
pending: "\xC0 compl\xE9ter"
|
|
118
|
+
},
|
|
119
|
+
unmodified: "Aucune modification en cours.",
|
|
120
|
+
unsavedChanges: "Modifications non enregistr\xE9es"
|
|
121
|
+
},
|
|
75
122
|
fields: {
|
|
76
123
|
array: {
|
|
77
124
|
addItem: "Ajouter un \xE9l\xE9ment",
|
|
@@ -275,6 +275,35 @@ export interface UiToolsFormMessages {
|
|
|
275
275
|
cancelButton: string;
|
|
276
276
|
resetButton: string;
|
|
277
277
|
};
|
|
278
|
+
/** Form page chrome. Counts use `Intl.PluralRules`: `One` for "one", `Other` otherwise. */
|
|
279
|
+
page: {
|
|
280
|
+
/** Accessible name of the section navigation when the schema gives it no title. */
|
|
281
|
+
navigation: string;
|
|
282
|
+
/** Marks an optional section, in the navigation and on its card. */
|
|
283
|
+
optional: string;
|
|
284
|
+
/** Badge under the page title and name of a section's dirty marker. */
|
|
285
|
+
unsavedChanges: string;
|
|
286
|
+
/** Button of a modified section that puts its values back. */
|
|
287
|
+
resetSection: string;
|
|
288
|
+
/** Bold count inserted in `remaining` and `modified`: "{count} sections". */
|
|
289
|
+
sectionsOne: string;
|
|
290
|
+
sectionsOther: string;
|
|
291
|
+
/** Navigation summary while required sections are incomplete: "{count} to complete." */
|
|
292
|
+
remaining: string;
|
|
293
|
+
/** Navigation summary once every required section is complete. */
|
|
294
|
+
complete: string;
|
|
295
|
+
/** Navigation summary of a form with dirty checking: "{count} modified." */
|
|
296
|
+
modifiedOne: string;
|
|
297
|
+
modifiedOther: string;
|
|
298
|
+
/** Navigation summary of a form with dirty checking and no change. */
|
|
299
|
+
unmodified: string;
|
|
300
|
+
/** Accessible status of a navigation entry. */
|
|
301
|
+
status: {
|
|
302
|
+
complete: string;
|
|
303
|
+
pending: string;
|
|
304
|
+
invalid: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
278
307
|
states: {
|
|
279
308
|
contextError: {
|
|
280
309
|
title: string;
|
|
@@ -419,6 +448,47 @@ export interface UiToolsDashboardMessages {
|
|
|
419
448
|
auto: string;
|
|
420
449
|
off: string;
|
|
421
450
|
};
|
|
451
|
+
page: {
|
|
452
|
+
/** Before the time the data on screen was fetched, after the date: "updated" 3 min ago. */
|
|
453
|
+
updated: string;
|
|
454
|
+
/** While the first data loads, after the date. */
|
|
455
|
+
loading: string;
|
|
456
|
+
};
|
|
457
|
+
series: {
|
|
458
|
+
/** Button of a chart whose series a filter picks, listing the options. */
|
|
459
|
+
add: string;
|
|
460
|
+
/** Accessible name of a series chip's remove button: "Remove {label}". */
|
|
461
|
+
remove: string;
|
|
462
|
+
};
|
|
463
|
+
filters: {
|
|
464
|
+
/** Accessible name of a filter bar. */
|
|
465
|
+
label: string;
|
|
466
|
+
/** Accessible name of the view tabs. */
|
|
467
|
+
views: string;
|
|
468
|
+
/** Text of an empty selection. */
|
|
469
|
+
all: string;
|
|
470
|
+
/** Items of a boolean filter. */
|
|
471
|
+
yes: string;
|
|
472
|
+
no: string;
|
|
473
|
+
/** Pill text of several selected values: "{label} +{count}". */
|
|
474
|
+
more: string;
|
|
475
|
+
search: string;
|
|
476
|
+
empty: string;
|
|
477
|
+
loading: string;
|
|
478
|
+
loadError: string;
|
|
479
|
+
retry: string;
|
|
480
|
+
clearSelection: string;
|
|
481
|
+
/** Heading of the presets under a filter's options. */
|
|
482
|
+
presets: string;
|
|
483
|
+
/** Accessible name of a pill's clear button: "Clear {label}". */
|
|
484
|
+
clear: string;
|
|
485
|
+
reset: string;
|
|
486
|
+
};
|
|
487
|
+
format: {
|
|
488
|
+
/** Signed difference of two percentages, `Intl.PluralRules` "one" form: "{value} pt". */
|
|
489
|
+
pointsOne: string;
|
|
490
|
+
pointsOther: string;
|
|
491
|
+
};
|
|
422
492
|
/** Accessible name of a row's `⋮` menu. */
|
|
423
493
|
rowActions: string;
|
|
424
494
|
alerts: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--nut-form-veil:rgba(31,29,26,.18)}.dark{--nut-form-veil:rgba(0,0,0,.45)}:where(:root){--nut-dash-s1:var(--ui-primary);--nut-dash-s2:var(--ui-color-neutral-400);--nut-dash-s3:var(--ui-secondary);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 20%,var(--ui-bg));--nut-dash-s5:var(--ui-warning);--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 35%,var(--ui-bg));--nut-dash-up:var(--ui-success);--nut-dash-up-mark:var(--nut-dash-up);--nut-dash-down:var(--ui-error);--nut-dash-muted:var(--ui-border-accented);--nut-dash-track:var(--ui-bg-elevated);--nut-dash-grid:var(--ui-border-muted);--nut-dash-axis:var(--ui-text-dimmed);--nut-dash-ref:var(--ui-text-dimmed);--nut-dash-ref-label:var(--ui-text-muted);--nut-dash-ghost:var(--ui-bg-accented);--nut-dash-ghost-shine:color-mix(in oklab,var(--ui-bg) 70%,transparent)}:where(.dark){--nut-dash-s2:var(--ui-color-neutral-500);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 30%,var(--ui-bg));--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 40%,var(--ui-bg))}@supports (color:oklch(from red l c h)){:where(:root){--nut-dash-s4:oklch(from var(--ui-primary) 0.88 calc(c * 0.45) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.8 calc(c * 0.55) h)}:where(.dark){--nut-dash-s4:oklch(from var(--ui-primary) 0.42 calc(c * 0.6) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.45 calc(c * 0.65) h)}}.nut-dash-chart{--vis-font-family:inherit;--vis-axis-tick-label-color:var(--nut-dash-axis);--vis-axis-tick-label-font-size:10px;--vis-axis-grid-color:var(--nut-dash-grid);--vis-axis-domain-color:var(--nut-dash-grid);--vis-crosshair-line-stroke-color:var(--ui-border-accented);--vis-crosshair-circle-stroke-color:var(--ui-bg);--vis-tooltip-background-color:var(--ui-bg);--vis-tooltip-border-color:var(--ui-border);--vis-tooltip-text-color:var(--ui-text);--vis-tooltip-padding:8px 10px;--vis-tooltip-border-radius:calc(var(--ui-radius)*1.5);--vis-tooltip-shadow-color:rgb(0 0 0/8%);--vis-plotline-label-font-size:10px}.nut-dash-chart--bars [data-vis-component] rect:hover{opacity:.8}.nut-dash-tip{display:flex;flex-direction:column;font-size:12px;gap:4px;min-width:9rem}.nut-dash-tip-title{color:var(--ui-text-muted);font-weight:500}.nut-dash-tip-row{align-items:center;display:flex;gap:6px}.nut-dash-tip-row i{border-radius:2px;height:8px;width:8px}.nut-dash-tip-row span{color:var(--ui-text-muted);flex:1}.nut-dash-tip-row b{font-variant-numeric:tabular-nums;font-weight:600}.nut-dash-ghost{background:var(--nut-dash-ghost)}.nut-dash-shimmer{overflow:hidden;position:relative}.nut-dash-shimmer:after{animation:nut-dash-shimmer 1.6s ease-in-out infinite;background:linear-gradient(100deg,transparent 25%,var(--nut-dash-ghost-shine) 50%,transparent 75%);content:"";inset:0;pointer-events:none;position:absolute;transform:translateX(-100%);will-change:transform}@keyframes nut-dash-shimmer{to{transform:translateX(100%)}}.nut-dash-enter{animation:nut-dash-enter .28s ease-out}@keyframes nut-dash-enter{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}.nut-dash-progress{animation:nut-dash-progress 1.1s ease-in-out infinite}@keyframes nut-dash-progress{0%{transform:translateX(-100%)}to{transform:translateX(300%)}}@media (prefers-reduced-motion:reduce){.nut-dash-shimmer:after{display:none}.nut-dash-enter{animation:none}.nut-dash-progress{animation-duration:3s}}
|
|
1
|
+
:root{--nut-form-veil:rgba(31,29,26,.18)}.dark{--nut-form-veil:rgba(0,0,0,.45)}:where(:root){--nut-dash-s1:var(--ui-primary);--nut-dash-s2:var(--ui-color-neutral-400);--nut-dash-s3:var(--ui-secondary);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 20%,var(--ui-bg));--nut-dash-s5:var(--ui-warning);--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 35%,var(--ui-bg));--nut-dash-up:var(--ui-success);--nut-dash-up-mark:var(--nut-dash-up);--nut-dash-down:var(--ui-error);--nut-dash-muted:var(--ui-border-accented);--nut-dash-track:var(--ui-bg-elevated);--nut-dash-grid:var(--ui-border-muted);--nut-dash-axis:var(--ui-text-dimmed);--nut-dash-ref:var(--ui-text-dimmed);--nut-dash-ref-label:var(--ui-text-muted);--nut-dash-ghost:var(--ui-bg-accented);--nut-dash-ghost-shine:color-mix(in oklab,var(--ui-bg) 70%,transparent);--nut-dash-filter-active:color-mix(in oklab,var(--ui-primary) 9%,var(--ui-bg));--nut-dash-filter-active-line:color-mix(in oklab,var(--ui-primary) 35%,var(--ui-border));--nut-dash-filter-ink:var(--nut-dl-accent-ink,var(--ui-primary));--nut-dash-row-hover:var(--ui-bg-elevated)}:where(.dark){--nut-dash-s2:var(--ui-color-neutral-500);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 30%,var(--ui-bg));--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 40%,var(--ui-bg))}@supports (color:oklch(from red l c h)){:where(:root){--nut-dash-s4:oklch(from var(--ui-primary) 0.88 calc(c * 0.45) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.8 calc(c * 0.55) h)}:where(.dark){--nut-dash-s4:oklch(from var(--ui-primary) 0.42 calc(c * 0.6) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.45 calc(c * 0.65) h)}}.nut-dash-chart{--vis-font-family:inherit;--vis-axis-tick-label-color:var(--nut-dash-axis);--vis-axis-tick-label-font-size:10px;--vis-axis-grid-color:var(--nut-dash-grid);--vis-axis-domain-color:var(--nut-dash-grid);--vis-crosshair-line-stroke-color:var(--ui-border-accented);--vis-crosshair-circle-stroke-color:var(--ui-bg);--vis-tooltip-background-color:var(--ui-bg);--vis-tooltip-border-color:var(--ui-border);--vis-tooltip-text-color:var(--ui-text);--vis-tooltip-padding:8px 10px;--vis-tooltip-border-radius:calc(var(--ui-radius)*1.5);--vis-tooltip-shadow-color:rgb(0 0 0/8%);--vis-plotline-label-font-size:10px}.nut-dash-chart--bars [data-vis-component] rect:hover{opacity:.8}.nut-dash-tip{display:flex;flex-direction:column;font-size:12px;gap:4px;min-width:9rem}.nut-dash-tip-title{color:var(--ui-text-muted);font-weight:500}.nut-dash-tip-row{align-items:center;display:flex;gap:6px}.nut-dash-tip-row i{border-radius:2px;height:8px;width:8px}.nut-dash-tip-row span{color:var(--ui-text-muted);flex:1}.nut-dash-tip-row b{font-variant-numeric:tabular-nums;font-weight:600}.nut-dash-ghost{background:var(--nut-dash-ghost)}.nut-dash-shimmer{overflow:hidden;position:relative}.nut-dash-shimmer:after{animation:nut-dash-shimmer 1.6s ease-in-out infinite;background:linear-gradient(100deg,transparent 25%,var(--nut-dash-ghost-shine) 50%,transparent 75%);content:"";inset:0;pointer-events:none;position:absolute;transform:translateX(-100%);will-change:transform}@keyframes nut-dash-shimmer{to{transform:translateX(100%)}}.nut-dash-enter{animation:nut-dash-enter .28s ease-out}@keyframes nut-dash-enter{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}.nut-dash-progress{animation:nut-dash-progress 1.1s ease-in-out infinite}@keyframes nut-dash-progress{0%{transform:translateX(-100%)}to{transform:translateX(300%)}}@media (prefers-reduced-motion:reduce){.nut-dash-shimmer:after{display:none}.nut-dash-enter{animation:none}.nut-dash-progress{animation-duration:3s}}
|
|
@@ -8,3 +8,11 @@ export type QueryDefinition<TData = unknown> = Omit<UseQueryOptions<TData>, 'que
|
|
|
8
8
|
queryKey: QueryKey;
|
|
9
9
|
queryFn?: QueryFunction<TData, QueryKey, string | null>;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* The smallest query definition: a key and the function that fetches it. Covariant in its data, so
|
|
13
|
+
* a definition of specific options fits wherever a broader option type is expected.
|
|
14
|
+
*/
|
|
15
|
+
export interface QueryFnDefinition<TData = unknown> {
|
|
16
|
+
queryKey: QueryKey;
|
|
17
|
+
queryFn: QueryFunction<TData, QueryKey, string | null>;
|
|
18
|
+
}
|
|
@@ -5,6 +5,7 @@ export type * from './data-list';
|
|
|
5
5
|
export type * from './filters';
|
|
6
6
|
export type * from './layout';
|
|
7
7
|
export type * from './query-state';
|
|
8
|
+
export type * from './remote-options';
|
|
8
9
|
export type * from './schema';
|
|
9
10
|
export type * from './source';
|
|
10
11
|
export type * from './state';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
+
import type { QueryFnDefinition } from '../../shared/types/query.js';
|
|
3
|
+
import type { RemoteOptionsPageRequest, RemoteOptionsPagination, RemoteOptionsResult, RemoteOptionsSearch } from '../../shared/types/remote-options.js';
|
|
4
|
+
import type { TableResolvedFilterGroup } from './filters.js';
|
|
5
|
+
import type { TableCursorPageResult, TableOffsetPageResult, TableRemoteSourceRequest, TableSourceExecutionResult, TableSourceQueryResult, TableSourceRow } from './source.js';
|
|
6
|
+
import type { GenericObject, TableKnownFieldPath, TableSortingRule, TableSortKey } from './utils.js';
|
|
7
|
+
/** Response of an endpoint speaking the table request protocol. */
|
|
8
|
+
export type RemoteTableResult<TRow extends GenericObject> = TableOffsetPageResult<TRow, string> | TableCursorPageResult<TRow, string> | TableSourceExecutionResult<TRow, string>;
|
|
9
|
+
/** Option built from one row: a value and a label, plus any extra option fields. */
|
|
10
|
+
export interface RemoteTableOption {
|
|
11
|
+
value: string | number;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
/** A TanStack query definition: its key, and a `queryFn` or the options that carry one. */
|
|
15
|
+
export interface RemoteTableQueryDefinition {
|
|
16
|
+
queryKey: QueryKey;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Query definition of one table request, typically the endpoint a remote table already uses:
|
|
20
|
+
* `(request) => $api.accounts.query.queryOptions({ body: request })`. The row type is read from
|
|
21
|
+
* its result, as `tableSource` does.
|
|
22
|
+
*/
|
|
23
|
+
export type RemoteTableQuery<TQuery extends RemoteTableQueryDefinition = RemoteTableQueryDefinition> = (request: TableRemoteSourceRequest) => TQuery;
|
|
24
|
+
/** Row type of the table response a `RemoteTableQuery` resolves to. */
|
|
25
|
+
export type RemoteTableQueryRow<TQuery> = TableSourceRow<TableSourceQueryResult<TQuery>>;
|
|
26
|
+
export interface RemoteTableOptionsConfig<TRow extends GenericObject, TOption extends RemoteTableOption> {
|
|
27
|
+
/** Option of one row. A method, so the typed callback fits the builder's erased signature. */
|
|
28
|
+
option(row: TRow): TOption;
|
|
29
|
+
/**
|
|
30
|
+
* Fields the search term looks in, or those fields with the debounce (default 250 ms) and
|
|
31
|
+
* minimum term length (default 0).
|
|
32
|
+
*/
|
|
33
|
+
search?: readonly TableKnownFieldPath<TRow>[] | ({
|
|
34
|
+
fields: readonly TableKnownFieldPath<TRow>[];
|
|
35
|
+
} & RemoteOptionsSearch);
|
|
36
|
+
/** Order of the options: a field, ascending, or explicit sorting rules. */
|
|
37
|
+
sort?: TableSortKey<TRow> | readonly TableSortingRule<TableSortKey<TRow>>[];
|
|
38
|
+
/**
|
|
39
|
+
* Field holding the option value, matched with `isAnyOf` to resolve the labels of selected
|
|
40
|
+
* values the loaded pages do not contain. Defaults to `'id'`.
|
|
41
|
+
*/
|
|
42
|
+
valueKey?: TableKnownFieldPath<TRow> | 'id';
|
|
43
|
+
/** Filters applied to every request, e.g. active accounts only. */
|
|
44
|
+
filters?: readonly TableResolvedFilterGroup<TableKnownFieldPath<TRow> | string>[];
|
|
45
|
+
/** Page type and size. Must match what the endpoint pages by. Defaults to cursor pages of 25. */
|
|
46
|
+
pagination?: RemoteOptionsPagination;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Remote option source built by `remoteTableOptions()`. It fits dashboard `p.remote()`, table
|
|
50
|
+
* option filters (`source.remote`), and form remote options (`source: options.load`).
|
|
51
|
+
*/
|
|
52
|
+
export interface RemoteTableOptions<TOption> {
|
|
53
|
+
/** Query definition of one page of options for a search term. */
|
|
54
|
+
load: (request: {
|
|
55
|
+
search: string;
|
|
56
|
+
page: RemoteOptionsPageRequest;
|
|
57
|
+
}) => QueryFnDefinition<RemoteOptionsResult<TOption>>;
|
|
58
|
+
/** Query definition of the options of selected values. */
|
|
59
|
+
resolveSelected: (request: {
|
|
60
|
+
values: readonly (string | number | boolean)[];
|
|
61
|
+
}) => QueryFnDefinition<readonly TOption[]>;
|
|
62
|
+
pagination: RemoteOptionsPagination;
|
|
63
|
+
search?: RemoteOptionsSearch;
|
|
64
|
+
}
|
|
File without changes
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import type { InfiniteData, QueryFunction, QueryKey } from '@tanstack/vue-query';
|
|
1
|
+
import type { InfiniteData, QueryFunction, QueryKey, UseQueryOptions } from '@tanstack/vue-query';
|
|
2
2
|
import type { QueryDefinition } from '../../shared/types/query.js';
|
|
3
3
|
import type { TableResolvedFilterGroup } from './filters.js';
|
|
4
4
|
import type { GenericObject, TableKnownFieldPath, TablePaginationState, TableSortKey, TableSortingRule, TableRowsFromSourceResult } from './utils.js';
|
|
5
5
|
/** Table name of the shared `QueryDefinition`, kept for public type compatibility. */
|
|
6
6
|
export type TableQueryDefinition<TData = unknown> = QueryDefinition<TData>;
|
|
7
|
+
/**
|
|
8
|
+
* Result of a query definition: what its `queryFn` resolves to, or the data type of TanStack
|
|
9
|
+
* options whose `queryFn` may be a ref or `skipToken` (Tuyau's `queryOptions()`).
|
|
10
|
+
*/
|
|
11
|
+
export type TableSourceQueryResult<TQuery> = TQuery extends {
|
|
12
|
+
queryFn: (...args: never[]) => infer TResult;
|
|
13
|
+
} ? Awaited<TResult> : TQuery extends UseQueryOptions<infer _TQueryFnData, infer _TError, infer TResult, infer _TQueryData, infer _TQueryKey> ? Awaited<TResult> : never;
|
|
14
|
+
/** Row of a table query result: an array of rows, or a page (`{ rows }`). */
|
|
15
|
+
export type TableSourceRow<TResult> = TableRowsFromSourceResult<Awaited<TResult>> extends infer TRow ? TRow extends GenericObject ? TRow : GenericObject : GenericObject;
|
|
7
16
|
export interface TableInfiniteQueryDefinition<TData = unknown> {
|
|
8
17
|
queryKey: QueryKey;
|
|
9
18
|
queryFn: QueryFunction<TData, QueryKey, string | null>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { QueryKey
|
|
2
|
-
import type { GenericObject, TableClientSource, TableCursorPageResult, TableGlobalFacetDescriptor, TableOffsetPageResult, TablePaginationState, TableRemoteSource, TableRemoteSourceRequest, TableResolvedFilterGroup,
|
|
3
|
-
type TableSourceRow<TResult> = TableRowsFromSourceResult<Awaited<TResult>> extends infer TRow ? TRow extends GenericObject ? TRow : GenericObject : GenericObject;
|
|
1
|
+
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
+
import type { GenericObject, TableClientSource, TableCursorPageResult, TableGlobalFacetDescriptor, TableOffsetPageResult, TablePaginationState, TableRemoteSource, TableRemoteSourceRequest, TableResolvedFilterGroup, TableSourceExecutionResult, TableSourceQueryResult, TableSourceRow, TableSortingRule } from '../../types/index.js';
|
|
4
3
|
type ClientTableSourceResult<TResult> = TResult extends readonly GenericObject[] ? TableSourceRow<TResult>[] : TableSourceExecutionResult<TableSourceRow<TResult>>;
|
|
5
4
|
type RemoteTableSourceResult<TResult> = TResult extends {
|
|
6
5
|
pageInfo: {
|
|
@@ -25,9 +24,6 @@ interface TableSourceInferenceContext {
|
|
|
25
24
|
interface TableSourceQueryDefinition {
|
|
26
25
|
queryKey: QueryKey;
|
|
27
26
|
}
|
|
28
|
-
type TableSourceQueryResult<TQuery> = TQuery extends {
|
|
29
|
-
queryFn: (...args: never[]) => infer TResult;
|
|
30
|
-
} ? Awaited<TResult> : TQuery extends UseQueryOptions<infer _TQueryFnData, infer _TError, infer TResult, infer _TQueryData, infer _TQueryKey> ? Awaited<TResult> : never;
|
|
31
27
|
interface ClientTableSourceInput<TQuery extends TableSourceQueryDefinition> {
|
|
32
28
|
mode?: 'client';
|
|
33
29
|
query: (context: TableSourceInferenceContext) => TQuery;
|
|
@@ -8,6 +8,7 @@ export * from './filters/index.js';
|
|
|
8
8
|
export * from './pagination.js';
|
|
9
9
|
export * from './prefetch.js';
|
|
10
10
|
export * from './query-state.js';
|
|
11
|
+
export * from './remote-table-options.js';
|
|
11
12
|
export * from './resolved-filters.js';
|
|
12
13
|
export * from './rows.js';
|
|
13
14
|
export * from './schema.js';
|
|
@@ -8,6 +8,7 @@ export * from "./filters/index.js";
|
|
|
8
8
|
export * from "./pagination.js";
|
|
9
9
|
export * from "./prefetch.js";
|
|
10
10
|
export * from "./query-state.js";
|
|
11
|
+
export * from "./remote-table-options.js";
|
|
11
12
|
export * from "./resolved-filters.js";
|
|
12
13
|
export * from "./rows.js";
|
|
13
14
|
export * from "./schema.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RemoteTableOption, RemoteTableOptions, RemoteTableOptionsConfig, RemoteTableQuery, RemoteTableQueryDefinition, RemoteTableQueryRow } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Turns an endpoint that speaks the table request protocol into a remote option source: searchable,
|
|
4
|
+
* paged, with labels of selected values resolved by an `isAnyOf` filter on `valueKey`. Use it for
|
|
5
|
+
* dashboard filters (`p.remote(...)`), table option filters (`source.remote`), and form remote
|
|
6
|
+
* options (`source: options.load`).
|
|
7
|
+
*
|
|
8
|
+
* Each page is its own query, keyed after the endpoint's key, so pages are cached and shared by
|
|
9
|
+
* every picker using the same source.
|
|
10
|
+
*
|
|
11
|
+
* The query comes first: the row type is read from its result, so `option` and `search` are typed
|
|
12
|
+
* whatever order the options are written in.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const accounts = remoteTableOptions(
|
|
17
|
+
* (request) => $api.accounts.query.queryOptions({ body: request }),
|
|
18
|
+
* {
|
|
19
|
+
* search: ['name'],
|
|
20
|
+
* sort: 'name',
|
|
21
|
+
* option: (account) => ({ label: account.name, value: account.id }),
|
|
22
|
+
* },
|
|
23
|
+
* )
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function remoteTableOptions<TQuery extends RemoteTableQueryDefinition, const TOption extends RemoteTableOption>(query: RemoteTableQuery<TQuery>, config: RemoteTableOptionsConfig<RemoteTableQueryRow<TQuery>, TOption>): RemoteTableOptions<TOption>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isArray, isFunction, isObject } from "../../shared/utils/predicate.js";
|
|
2
|
+
const DEFAULT_PAGINATION = { size: 25, type: "cursor" };
|
|
3
|
+
export function remoteTableOptions(query, config) {
|
|
4
|
+
const pagination = config.pagination ?? DEFAULT_PAGINATION;
|
|
5
|
+
const { fields, search } = resolveSearch(config.search);
|
|
6
|
+
const sorting = resolveSorting(config.sort);
|
|
7
|
+
function request(params) {
|
|
8
|
+
const { page } = params;
|
|
9
|
+
return {
|
|
10
|
+
filters: [...config.filters ?? [], ...params.filters ?? []],
|
|
11
|
+
pagination: pagination.type === "cursor" ? { count: "none", cursor: page.cursor, mode: "cursor", pageSize: page.size } : { count: "exact", mode: "offset", pageIndex: page.index - 1, pageSize: page.size },
|
|
12
|
+
search: { fields: [...fields], value: params.search },
|
|
13
|
+
sorting: params.filters ? [] : [...sorting]
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
load: ({ page, search: term }) => mapQuery(query(request({ page, search: term })), (result) => ({
|
|
18
|
+
...resolvePage(result),
|
|
19
|
+
options: result.rows.map(config.option)
|
|
20
|
+
})),
|
|
21
|
+
pagination,
|
|
22
|
+
resolveSelected: ({ values }) => mapQuery(
|
|
23
|
+
query(
|
|
24
|
+
request({
|
|
25
|
+
filters: [
|
|
26
|
+
{
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
key: config.valueKey ?? "id",
|
|
30
|
+
operator: "isAnyOf",
|
|
31
|
+
type: "condition",
|
|
32
|
+
value: [...values]
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
combinator: "and",
|
|
36
|
+
type: "group"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
page: { cursor: null, index: 1, size: Math.max(1, values.length) },
|
|
40
|
+
search: ""
|
|
41
|
+
})
|
|
42
|
+
),
|
|
43
|
+
(result) => result.rows.map(config.option)
|
|
44
|
+
),
|
|
45
|
+
search
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function mapQuery(definition, map) {
|
|
49
|
+
const { queryKey } = definition;
|
|
50
|
+
const queryFn = "queryFn" in definition ? definition.queryFn : void 0;
|
|
51
|
+
return {
|
|
52
|
+
async queryFn(context) {
|
|
53
|
+
if (!isQueryFn(queryFn))
|
|
54
|
+
throw new Error("[remoteTableOptions] `query` must return a query with a queryFn.");
|
|
55
|
+
const result = await queryFn({ ...context, queryKey });
|
|
56
|
+
if (!isTableResult(result))
|
|
57
|
+
throw new Error("[remoteTableOptions] the query must resolve to a table response (`rows`).");
|
|
58
|
+
return map(result);
|
|
59
|
+
},
|
|
60
|
+
queryKey: [...queryKey, "remote-options"]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function isQueryFn(value) {
|
|
64
|
+
return isFunction(value);
|
|
65
|
+
}
|
|
66
|
+
function isTableResult(value) {
|
|
67
|
+
return isObject(value) && isArray(value.rows);
|
|
68
|
+
}
|
|
69
|
+
function resolvePage(result) {
|
|
70
|
+
if (!("pageInfo" in result)) return { hasMore: false };
|
|
71
|
+
return result.pageInfo.mode === "cursor" ? { nextCursor: result.pageInfo.nextCursor } : { hasMore: result.pageInfo.hasNextPage };
|
|
72
|
+
}
|
|
73
|
+
function resolveSearch(search) {
|
|
74
|
+
if (!search) return { fields: [], search: void 0 };
|
|
75
|
+
if (isFieldList(search)) return { fields: search, search: void 0 };
|
|
76
|
+
const { fields, ...options } = search;
|
|
77
|
+
return { fields, search: options };
|
|
78
|
+
}
|
|
79
|
+
function isFieldList(value) {
|
|
80
|
+
return Array.isArray(value);
|
|
81
|
+
}
|
|
82
|
+
function resolveSorting(sort) {
|
|
83
|
+
if (sort === void 0) return [];
|
|
84
|
+
return isSortingRules(sort) ? sort : [{ dir: "asc", key: sort }];
|
|
85
|
+
}
|
|
86
|
+
function isSortingRules(sort) {
|
|
87
|
+
return Array.isArray(sort);
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ui-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
|
|
5
5
|
"homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
|
|
6
6
|
"bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",
|
|
@@ -182,18 +182,21 @@
|
|
|
182
182
|
"@nuxt/module-builder": "^1.0.3",
|
|
183
183
|
"@nuxt/schema": "^4.5.2",
|
|
184
184
|
"@nuxt/ui": "^4.10.0",
|
|
185
|
+
"@tailwindcss/vite": "4.3.3",
|
|
185
186
|
"@tiptap/y-tiptap": "3.0.9",
|
|
186
187
|
"@types/node": "25.4.0",
|
|
187
188
|
"@unovis/ts": "1.7.0",
|
|
188
189
|
"@unovis/vue": "1.7.0",
|
|
189
190
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
190
191
|
"@vitejs/plugin-vue-jsx": "^5.1.6",
|
|
192
|
+
"@vitest/browser-playwright": "4.1.11",
|
|
191
193
|
"@vue/test-utils": "2.5.1",
|
|
192
194
|
"changelogen": "^0.6.2",
|
|
193
195
|
"happy-dom": "20.14.5",
|
|
194
196
|
"nuxt": "^4.5.2",
|
|
195
197
|
"oxfmt": "0.64.0",
|
|
196
198
|
"oxlint": "^1.82.0",
|
|
199
|
+
"playwright": "1.63.0",
|
|
197
200
|
"typescript": "~5.9.3",
|
|
198
201
|
"ultracite": "7.12.0",
|
|
199
202
|
"vitest": "^4.1.11",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
-
import type { DashboardOptionsHandle, DashboardParamMap } from '../types/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* What one param scope exposes. Declared rather than inferred: the inferred type would carry Vue's
|
|
5
|
-
* `Raw<…>` marker, which declaration files cannot name.
|
|
6
|
-
*/
|
|
7
|
-
export interface DashboardParamScope {
|
|
8
|
-
keys: readonly string[];
|
|
9
|
-
/** Option handles of option-backed params, by param key. */
|
|
10
|
-
options: Readonly<Record<string, DashboardOptionsHandle>>;
|
|
11
|
-
/** URL segments of this scope's params, before the scope prefix. */
|
|
12
|
-
urlKeys: readonly string[];
|
|
13
|
-
/** Writable facade: one getter / setter per param. */
|
|
14
|
-
values: object;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Owns the params of one scope (dashboard root, a view, or a query's widget params): exactly one
|
|
18
|
-
* `useQueryStates` instance, a writable values facade, and the option handles of option-backed
|
|
19
|
-
* params. Scopes without params allocate nothing.
|
|
20
|
-
*/
|
|
21
|
-
export declare function useDashboardParamScope(params: {
|
|
22
|
-
definitions: DashboardParamMap;
|
|
23
|
-
prefix: string;
|
|
24
|
-
queryKey: QueryKey;
|
|
25
|
-
}): DashboardParamScope;
|
|
26
|
-
/**
|
|
27
|
-
* Exposes several scopes' values through one object, e.g. shared params plus a view's own params
|
|
28
|
-
* inside the view's query factories. Reads and writes go straight to the owning scope.
|
|
29
|
-
*/
|
|
30
|
-
export declare function mergeDashboardParamValues(scopes: readonly DashboardParamScope[]): object;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { markRaw } from "vue";
|
|
2
|
-
import { useQueryStates } from "../../query-state/index.js";
|
|
3
|
-
import { hasProperty } from "../../shared/utils/predicate.js";
|
|
4
|
-
import { useDashboardOptions } from "./use-dashboard-options.js";
|
|
5
|
-
const emptyFacade = markRaw({});
|
|
6
|
-
const noUrlKeys = [];
|
|
7
|
-
export function useDashboardParamScope(params) {
|
|
8
|
-
const entries = Object.entries(params.definitions).flatMap(
|
|
9
|
-
([key, definition]) => isRuntimeParam(definition) ? [[key, definition]] : []
|
|
10
|
-
);
|
|
11
|
-
if (entries.length === 0)
|
|
12
|
-
return { keys: [], options: emptyFacade, urlKeys: noUrlKeys, values: emptyFacade };
|
|
13
|
-
const schema = {};
|
|
14
|
-
for (const [key, definition] of entries) {
|
|
15
|
-
schema[key] = {
|
|
16
|
-
codec: definition.codec,
|
|
17
|
-
defaultValue: definition.defaultValue,
|
|
18
|
-
historyMode: definition.historyMode,
|
|
19
|
-
omitDefault: definition.omitDefault,
|
|
20
|
-
urlKey: definition.urlKey
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const state = useQueryStates({ historyMode: "replace", prefix: params.prefix, schema });
|
|
24
|
-
function read(key) {
|
|
25
|
-
const current = state.value;
|
|
26
|
-
return current[key];
|
|
27
|
-
}
|
|
28
|
-
function write(key, value) {
|
|
29
|
-
state.value = { ...state.value, [key]: value ?? params.definitions[key]?.defaultValue };
|
|
30
|
-
}
|
|
31
|
-
const values = {};
|
|
32
|
-
for (const [key] of entries) {
|
|
33
|
-
Object.defineProperty(values, key, {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: () => read(key),
|
|
36
|
-
set: (value) => write(key, value)
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
const options = {};
|
|
40
|
-
for (const [key, definition] of entries) {
|
|
41
|
-
if (!definition.items && !definition.remote) continue;
|
|
42
|
-
options[key] = useDashboardOptions({
|
|
43
|
-
definition,
|
|
44
|
-
queryKey: [...params.queryKey, key],
|
|
45
|
-
value: () => read(key)
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
keys: entries.map(([key]) => key),
|
|
50
|
-
options: markRaw(options),
|
|
51
|
-
/** URL segments of this scope's params, before the scope prefix. */
|
|
52
|
-
urlKeys: entries.map(([key, definition]) => definition.urlKey ?? key),
|
|
53
|
-
values: markRaw(values)
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export function mergeDashboardParamValues(scopes) {
|
|
57
|
-
const merged = {};
|
|
58
|
-
for (const scope of scopes) {
|
|
59
|
-
for (const key of scope.keys) {
|
|
60
|
-
Object.defineProperty(merged, key, {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: () => Reflect.get(scope.values, key),
|
|
63
|
-
set: (value) => Reflect.set(scope.values, key, value)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return markRaw(merged);
|
|
68
|
-
}
|
|
69
|
-
function isRuntimeParam(definition) {
|
|
70
|
-
return hasProperty(definition, "codec");
|
|
71
|
-
}
|