nuxt-ui-tools 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +37 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +59 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-data-table.d.vue.ts +9 -0
- package/dist/runtime/dashboard/components/block/dashboard-data-table.vue +47 -0
- package/dist/runtime/dashboard/components/block/dashboard-data-table.vue.d.ts +9 -0
- package/dist/runtime/dashboard/components/block/dashboard-ring.d.vue.ts +34 -0
- package/dist/runtime/dashboard/components/block/dashboard-ring.vue +91 -0
- package/dist/runtime/dashboard/components/block/dashboard-ring.vue.d.ts +34 -0
- package/dist/runtime/dashboard/components/block/dashboard-row-actions.d.vue.ts +13 -0
- package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue +49 -0
- package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue.d.ts +13 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +34 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +315 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +34 -0
- package/dist/runtime/dashboard/components/charts/renderer.d.ts +43 -0
- package/dist/runtime/dashboard/components/charts/renderer.js +34 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.d.vue.ts +18 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue +45 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue.d.ts +18 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.d.vue.ts +14 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue +190 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue.d.ts +14 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.d.vue.ts +13 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue +72 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue.d.ts +13 -0
- package/dist/runtime/dashboard/components/charts/unovis/xy-layers.d.ts +43 -0
- package/dist/runtime/dashboard/components/charts/unovis/xy-layers.js +60 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue +226 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +131 -0
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-bars.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-bars.vue +187 -0
- package/dist/runtime/dashboard/components/dashboard-bars.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-card.d.vue.ts +47 -0
- package/dist/runtime/dashboard/components/dashboard-card.vue +316 -0
- package/dist/runtime/dashboard/components/dashboard-card.vue.d.ts +47 -0
- package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +128 -0
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-donut-chart.d.vue.ts +48 -0
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +216 -0
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue.d.ts +48 -0
- package/dist/runtime/dashboard/components/dashboard-feed.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-feed.vue +239 -0
- package/dist/runtime/dashboard/components/dashboard-feed.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.d.vue.ts +34 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue +157 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue.d.ts +34 -0
- package/dist/runtime/dashboard/components/dashboard-gauge.d.vue.ts +55 -0
- package/dist/runtime/dashboard/components/dashboard-gauge.vue +177 -0
- package/dist/runtime/dashboard/components/dashboard-gauge.vue.d.ts +55 -0
- package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-grid.vue +49 -0
- package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-legend.d.vue.ts +8 -0
- package/dist/runtime/dashboard/components/dashboard-legend.vue +37 -0
- package/dist/runtime/dashboard/components/dashboard-legend.vue.d.ts +8 -0
- package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +46 -0
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue +129 -0
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +46 -0
- package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +63 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue +239 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +63 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.d.vue.ts +43 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +194 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue.d.ts +43 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +29 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue +86 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +29 -0
- package/dist/runtime/dashboard/components/dashboard-relative-time.d.vue.ts +12 -0
- package/dist/runtime/dashboard/components/dashboard-relative-time.vue +23 -0
- package/dist/runtime/dashboard/components/dashboard-relative-time.vue.d.ts +12 -0
- package/dist/runtime/dashboard/components/dashboard-stack-bar.d.vue.ts +36 -0
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +162 -0
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue.d.ts +36 -0
- package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +69 -0
- package/dist/runtime/dashboard/components/dashboard-stat.vue +279 -0
- package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +69 -0
- package/dist/runtime/dashboard/components/dashboard-stats.d.vue.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-stats.vue +202 -0
- package/dist/runtime/dashboard/components/dashboard-stats.vue.d.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-table.vue +305 -0
- package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +35 -0
- package/dist/runtime/dashboard/components/dashboard-tabs.vue +55 -0
- package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +35 -0
- package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +10 -0
- package/dist/runtime/dashboard/components/dashboard-total.vue +32 -0
- package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +10 -0
- package/dist/runtime/dashboard/components/dashboard-widget.d.vue.ts +46 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue +84 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue.d.ts +46 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +15 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.js +91 -0
- package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +22 -0
- package/dist/runtime/dashboard/composables/use-dashboard-block.js +35 -0
- package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +36 -0
- package/dist/runtime/dashboard/composables/use-dashboard-chart.js +118 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.d.ts +12 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.js +47 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +6 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.js +12 -0
- package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +8 -0
- package/dist/runtime/dashboard/composables/use-dashboard-options.js +63 -0
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +30 -0
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +71 -0
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +12 -0
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +117 -0
- package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +35 -0
- package/dist/runtime/dashboard/composables/use-dashboard-resource.js +80 -0
- package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +46 -0
- package/dist/runtime/dashboard/composables/use-dashboard-scope.js +127 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +13 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.js +40 -0
- package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +22 -0
- package/dist/runtime/dashboard/composables/use-dashboard-ui.js +19 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +46 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.js +49 -0
- package/dist/runtime/dashboard/composables/use-dashboard.d.ts +24 -0
- package/dist/runtime/dashboard/composables/use-dashboard.js +42 -0
- package/dist/runtime/dashboard/constants/query.d.ts +16 -0
- package/dist/runtime/dashboard/constants/query.js +15 -0
- package/dist/runtime/dashboard/index.d.ts +4 -0
- package/dist/runtime/dashboard/index.js +3 -0
- package/dist/runtime/dashboard/schema/index.d.ts +57 -0
- package/dist/runtime/dashboard/schema/index.js +3 -0
- package/dist/runtime/dashboard/types/blocks.d.ts +251 -0
- package/dist/runtime/dashboard/types/blocks.js +0 -0
- package/dist/runtime/dashboard/types/charts.d.ts +60 -0
- package/dist/runtime/dashboard/types/charts.js +0 -0
- package/dist/runtime/dashboard/types/index.d.ts +7 -0
- package/dist/runtime/dashboard/types/index.js +0 -0
- package/dist/runtime/dashboard/types/options.d.ts +46 -0
- package/dist/runtime/dashboard/types/options.js +0 -0
- package/dist/runtime/dashboard/types/params.d.ts +115 -0
- package/dist/runtime/dashboard/types/params.js +0 -0
- package/dist/runtime/dashboard/types/resource.d.ts +106 -0
- package/dist/runtime/dashboard/types/resource.js +0 -0
- package/dist/runtime/dashboard/types/runtime.d.ts +44 -0
- package/dist/runtime/dashboard/types/runtime.js +0 -0
- package/dist/runtime/dashboard/types/schema.d.ts +171 -0
- package/dist/runtime/dashboard/types/schema.js +0 -0
- package/dist/runtime/dashboard/types/ui.d.ts +201 -0
- package/dist/runtime/dashboard/types/ui.js +0 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +85 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-params.js +87 -0
- package/dist/runtime/dashboard/utils/chart-frame.d.ts +5 -0
- package/dist/runtime/dashboard/utils/chart-frame.js +27 -0
- package/dist/runtime/dashboard/utils/charts.d.ts +61 -0
- package/dist/runtime/dashboard/utils/charts.js +142 -0
- package/dist/runtime/dashboard/utils/comparison.d.ts +15 -0
- package/dist/runtime/dashboard/utils/comparison.js +19 -0
- package/dist/runtime/dashboard/utils/export.d.ts +13 -0
- package/dist/runtime/dashboard/utils/export.js +45 -0
- package/dist/runtime/dashboard/utils/options.d.ts +5 -0
- package/dist/runtime/dashboard/utils/options.js +18 -0
- package/dist/runtime/dashboard/utils/params/codecs.d.ts +14 -0
- package/dist/runtime/dashboard/utils/params/codecs.js +69 -0
- package/dist/runtime/dashboard/utils/resource.d.ts +16 -0
- package/dist/runtime/dashboard/utils/resource.js +39 -0
- package/dist/runtime/dashboard/utils/schema.d.ts +9 -0
- package/dist/runtime/dashboard/utils/schema.js +31 -0
- package/dist/runtime/dashboard/utils/sparkline.d.ts +21 -0
- package/dist/runtime/dashboard/utils/sparkline.js +53 -0
- package/dist/runtime/dashboard/utils/state.d.ts +28 -0
- package/dist/runtime/dashboard/utils/state.js +32 -0
- package/dist/runtime/dashboard/utils/time.d.ts +17 -0
- package/dist/runtime/dashboard/utils/time.js +60 -0
- package/dist/runtime/dashboard/utils/tracker.d.ts +12 -0
- package/dist/runtime/dashboard/utils/tracker.js +31 -0
- package/dist/runtime/dashboard/utils/ui.d.ts +38 -0
- package/dist/runtime/dashboard/utils/ui.js +24 -0
- package/dist/runtime/dashboard/utils/visibility.d.ts +2 -0
- package/dist/runtime/dashboard/utils/visibility.js +25 -0
- package/dist/runtime/form/types/options.d.ts +15 -36
- package/dist/runtime/i18n/locales/en.js +65 -1
- package/dist/runtime/i18n/locales/fr.js +65 -1
- package/dist/runtime/i18n/types.d.ts +70 -0
- package/dist/runtime/shared/index.d.ts +2 -0
- package/dist/runtime/shared/styles/scrollbars.css +1 -1
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/types/query.d.ts +10 -0
- package/dist/runtime/shared/types/query.js +0 -0
- package/dist/runtime/shared/types/remote-options.d.ts +37 -0
- package/dist/runtime/shared/types/remote-options.js +0 -0
- package/dist/runtime/shared/utils/remote-options.d.ts +10 -0
- package/dist/runtime/shared/utils/remote-options.js +6 -0
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
- package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
- package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
- package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
- package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
- package/dist/runtime/table/components/filters/shared/filter-option-list-end.d.vue.ts +11 -0
- package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue +76 -0
- package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue.d.ts +11 -0
- package/dist/runtime/table/components/filters/shared/filter-option-loading-list.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue +2 -1
- package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +1 -1
- package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +13 -0
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.d.vue.ts +2 -0
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +1 -1
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue.d.ts +2 -0
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue +2 -2
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +1 -0
- package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
- package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
- package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
- package/dist/runtime/table/composables/use-option-filter-editor-state.d.ts +13 -1
- package/dist/runtime/table/composables/use-option-filter-editor-state.js +6 -2
- package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
- package/dist/runtime/table/composables/use-table-columns.d.ts +3 -3
- package/dist/runtime/table/composables/use-table-filter-options.d.ts +11 -1
- package/dist/runtime/table/composables/use-table-filter-options.js +128 -17
- package/dist/runtime/table/composables/use-table-filter-selected-options.d.ts +20 -0
- package/dist/runtime/table/composables/use-table-filter-selected-options.js +99 -0
- package/dist/runtime/table/composables/use-table-filters.d.ts +5 -0
- package/dist/runtime/table/composables/use-table-filters.js +20 -1
- package/dist/runtime/table/composables/use-table-internals.d.ts +42 -27
- package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
- package/dist/runtime/table/composables/use-table-remote-filter-options.d.ts +42 -0
- package/dist/runtime/table/composables/use-table-remote-filter-options.js +102 -0
- package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
- package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
- package/dist/runtime/table/types/filters.d.ts +42 -0
- package/dist/runtime/table/types/source.d.ts +9 -5
- package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
- package/dist/runtime/table/utils/columns/state.d.ts +1 -1
- package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
- package/dist/runtime/table/utils/filters/options.d.ts +2 -0
- package/dist/runtime/table/utils/filters/options.js +1 -1
- package/dist/runtime/table/utils/prefetch.js +21 -1
- package/package.json +28 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { isNullish } from "../../../../shared/utils/predicate";
|
|
3
|
+
import FilterOptionListEnd from "./filter-option-list-end.vue";
|
|
3
4
|
import FilterOptionLoadingList from "./filter-option-loading-list.vue";
|
|
4
5
|
import FilterOptionMultipleList from "./filter-option-multiple-list.vue";
|
|
5
6
|
import FilterOptionSingleList from "./filter-option-single-list.vue";
|
|
@@ -105,5 +106,17 @@ function handleSelect(options) {
|
|
|
105
106
|
:ui="props.ui"
|
|
106
107
|
/>
|
|
107
108
|
</template>
|
|
109
|
+
|
|
110
|
+
<FilterOptionListEnd
|
|
111
|
+
v-if="
|
|
112
|
+
props.state.optionSource.remote.enabled.value && !props.state.optionSource.isLoading.value
|
|
113
|
+
"
|
|
114
|
+
:remote="props.state.optionSource.remote"
|
|
115
|
+
:indicator="
|
|
116
|
+
props.state.filterUi.value.selection.mode === 'multiple' || props.state.filterUi.value.presentation === 'tree' ? 'checkbox' : 'radio'
|
|
117
|
+
"
|
|
118
|
+
:size="props.size"
|
|
119
|
+
:ui="props.ui"
|
|
120
|
+
/>
|
|
108
121
|
</FilterSearchablePanel>
|
|
109
122
|
</template>
|
|
@@ -71,7 +71,7 @@ const modelValue = defineModel({ type: null, ...{
|
|
|
71
71
|
{{ item.label }}
|
|
72
72
|
</span>
|
|
73
73
|
<USkeleton
|
|
74
|
-
v-if="countLoading"
|
|
74
|
+
v-if="countLoading || item.countPending"
|
|
75
75
|
:class="[sizeClasses.skeletonCount, 'shrink-0 rounded-full']"
|
|
76
76
|
/>
|
|
77
77
|
<span v-else-if="item.count != null" class="shrink-0 text-muted">
|
|
@@ -4,6 +4,8 @@ interface TreeEntry {
|
|
|
4
4
|
label: string;
|
|
5
5
|
value?: string | number | boolean;
|
|
6
6
|
count?: number;
|
|
7
|
+
/** Counts are shown but this option's is not known yet. */
|
|
8
|
+
countPending?: boolean;
|
|
7
9
|
icon?: string;
|
|
8
10
|
depth: number;
|
|
9
11
|
expandable: boolean;
|
|
@@ -21,6 +23,7 @@ type __VLS_Props = {
|
|
|
21
23
|
label: string;
|
|
22
24
|
value: string;
|
|
23
25
|
count?: number;
|
|
26
|
+
countPending?: boolean;
|
|
24
27
|
icon?: string;
|
|
25
28
|
truncate?: boolean;
|
|
26
29
|
depth: number;
|
|
@@ -138,7 +138,7 @@ function activateTreeEntry(entry) {
|
|
|
138
138
|
</button>
|
|
139
139
|
|
|
140
140
|
<USkeleton
|
|
141
|
-
v-if="countLoading"
|
|
141
|
+
v-if="countLoading || entry.countPending"
|
|
142
142
|
:class="[sizeClasses.skeletonCount, 'shrink-0 rounded-full']"
|
|
143
143
|
/>
|
|
144
144
|
<span
|
|
@@ -210,7 +210,7 @@ function activateTreeEntry(entry) {
|
|
|
210
210
|
{{ item.label }}
|
|
211
211
|
</span>
|
|
212
212
|
<USkeleton
|
|
213
|
-
v-if="countLoading"
|
|
213
|
+
v-if="countLoading || item.countPending"
|
|
214
214
|
:class="[sizeClasses.skeletonCount, 'shrink-0 rounded-full']"
|
|
215
215
|
/>
|
|
216
216
|
<span v-else-if="item.count != null" class="shrink-0 text-muted">
|
|
@@ -4,6 +4,8 @@ interface TreeEntry {
|
|
|
4
4
|
label: string;
|
|
5
5
|
value?: string | number | boolean;
|
|
6
6
|
count?: number;
|
|
7
|
+
/** Counts are shown but this option's is not known yet. */
|
|
8
|
+
countPending?: boolean;
|
|
7
9
|
icon?: string;
|
|
8
10
|
depth: number;
|
|
9
11
|
expandable: boolean;
|
|
@@ -21,6 +23,7 @@ type __VLS_Props = {
|
|
|
21
23
|
label: string;
|
|
22
24
|
value: string;
|
|
23
25
|
count?: number;
|
|
26
|
+
countPending?: boolean;
|
|
24
27
|
icon?: string;
|
|
25
28
|
truncate?: boolean;
|
|
26
29
|
depth: number;
|
|
@@ -26,8 +26,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
26
26
|
type: StringConstructor;
|
|
27
27
|
};
|
|
28
28
|
}>> & Readonly<{}>, {
|
|
29
|
-
title: string;
|
|
30
29
|
disabled: boolean;
|
|
30
|
+
title: string;
|
|
31
31
|
wrapperClass: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
33
|
export default _default;
|
|
@@ -30,6 +30,7 @@ export declare function useOptionFilterEditorState(options: UseOptionFilterEdito
|
|
|
30
30
|
flatRadioItems: ComputedRef<{
|
|
31
31
|
color: string | undefined;
|
|
32
32
|
count: number | undefined;
|
|
33
|
+
countPending: boolean;
|
|
33
34
|
icon: string | undefined;
|
|
34
35
|
label: string;
|
|
35
36
|
truncate: boolean;
|
|
@@ -47,7 +48,16 @@ export declare function useOptionFilterEditorState(options: UseOptionFilterEdito
|
|
|
47
48
|
isError: ComputedRef<boolean>;
|
|
48
49
|
isLoading: ComputedRef<boolean>;
|
|
49
50
|
isStaleLoading: ComputedRef<boolean>;
|
|
50
|
-
refresh: () => Promise<[import("@tanstack/vue-query").QueryObserverResult<TableFilterOptionEntry[] | import("../types/index.js").TableFilterOptionQueryResult, Error>, import("@tanstack/vue-query").QueryObserverResult<import("../types/index.js").TableFacetExecutionResult<string, unknown>, Error>]>;
|
|
51
|
+
refresh: () => Promise<[import("@tanstack/vue-query").QueryObserverResult<import("@tanstack/vue-query").InfiniteData<import("../../shared/index.js").RemoteOptionsPage<TableFilterOptionEntry> | import("../../shared/index.js").RemoteCursorOptionsPage<TableFilterOptionEntry>, import("../../shared/utils/remote-options.js").RemoteOptionsPageParam>, Error> | import("@tanstack/vue-query").QueryObserverResult<TableFilterOptionEntry[] | import("../types/index.js").TableFilterOptionQueryResult, Error>, import("@tanstack/vue-query").QueryObserverResult<import("../types/index.js").TableFacetExecutionResult<string, unknown>, Error>]>;
|
|
52
|
+
remote: {
|
|
53
|
+
enabled: ComputedRef<boolean>;
|
|
54
|
+
failed: ComputedRef<boolean>;
|
|
55
|
+
hasMore: ComputedRef<boolean>;
|
|
56
|
+
loadMore: () => void;
|
|
57
|
+
loadingMore: ComputedRef<boolean>;
|
|
58
|
+
prefetchDistance: ComputedRef<number | "viewport">;
|
|
59
|
+
retry: () => Promise<import("@tanstack/vue-query").QueryObserverResult<import("@tanstack/vue-query").InfiniteData<import("../../shared/index.js").RemoteOptionsPage<TableFilterOptionEntry> | import("../../shared/index.js").RemoteCursorOptionsPage<TableFilterOptionEntry>, import("../../shared/utils/remote-options.js").RemoteOptionsPageParam>, Error>>;
|
|
60
|
+
};
|
|
51
61
|
searchExpandedIds: ComputedRef<string[]>;
|
|
52
62
|
showCounts: ComputedRef<boolean>;
|
|
53
63
|
sourceEntries: ComputedRef<(TableResolvedFilterOptionEntry<import("../types/index.js").TableFilterPrimitiveValue> & {
|
|
@@ -68,6 +78,7 @@ export declare function useOptionFilterEditorState(options: UseOptionFilterEdito
|
|
|
68
78
|
treeRadioItems: ComputedRef<{
|
|
69
79
|
color: string | undefined;
|
|
70
80
|
count: number | undefined;
|
|
81
|
+
countPending: boolean;
|
|
71
82
|
depth: number;
|
|
72
83
|
disabled: boolean;
|
|
73
84
|
expandable: boolean;
|
|
@@ -82,6 +93,7 @@ export declare function useOptionFilterEditorState(options: UseOptionFilterEdito
|
|
|
82
93
|
treeRadioValue: import("vue").WritableComputedRef<string | undefined, string | undefined>;
|
|
83
94
|
triggerSummary: ComputedRef<string>;
|
|
84
95
|
visibleTreeEntries: ComputedRef<{
|
|
96
|
+
countPending: boolean;
|
|
85
97
|
expanded: boolean;
|
|
86
98
|
indeterminate: boolean;
|
|
87
99
|
id: string;
|
|
@@ -88,6 +88,7 @@ export function useOptionFilterEditorState(options) {
|
|
|
88
88
|
if (!entry.branchSelectable) {
|
|
89
89
|
return {
|
|
90
90
|
...entry,
|
|
91
|
+
countPending: optionSource.showCounts.value && isNullish(entry.count),
|
|
91
92
|
expanded: effectiveExpandedIds.value.has(entry.id),
|
|
92
93
|
indeterminate: false
|
|
93
94
|
};
|
|
@@ -102,6 +103,7 @@ export function useOptionFilterEditorState(options) {
|
|
|
102
103
|
).length;
|
|
103
104
|
return {
|
|
104
105
|
...entry,
|
|
106
|
+
countPending: optionSource.showCounts.value && isNullish(entry.count),
|
|
105
107
|
expanded: effectiveExpandedIds.value.has(entry.id),
|
|
106
108
|
indeterminate: selectedCount > 0 && selectedCount < descendantValues.length,
|
|
107
109
|
selected: descendantValues.length > 0 && selectedCount === descendantValues.length
|
|
@@ -111,7 +113,8 @@ export function useOptionFilterEditorState(options) {
|
|
|
111
113
|
const flatRadioItems = computed(
|
|
112
114
|
() => displayEntries.value.map((entry) => ({
|
|
113
115
|
color: entry.color,
|
|
114
|
-
count: optionSource.showCounts.value ? entry.count
|
|
116
|
+
count: optionSource.showCounts.value ? entry.count : void 0,
|
|
117
|
+
countPending: optionSource.showCounts.value && isNullish(entry.count),
|
|
115
118
|
icon: entry.icon,
|
|
116
119
|
label: entry.label,
|
|
117
120
|
truncate: filterUi.value.row.truncate,
|
|
@@ -134,7 +137,8 @@ export function useOptionFilterEditorState(options) {
|
|
|
134
137
|
const treeRadioItems = computed(
|
|
135
138
|
() => visibleTreeEntries.value.map((entry) => ({
|
|
136
139
|
color: entry.color,
|
|
137
|
-
count: optionSource.showCounts.value ? entry.count
|
|
140
|
+
count: optionSource.showCounts.value ? entry.count : void 0,
|
|
141
|
+
countPending: optionSource.showCounts.value && isNullish(entry.count),
|
|
138
142
|
depth: entry.depth,
|
|
139
143
|
disabled: !entry.selectable,
|
|
140
144
|
expandable: entry.expandable,
|
|
@@ -19,7 +19,7 @@ export declare function useQueryState(params: UseQueryStateParams): {
|
|
|
19
19
|
readonly pageSize?: undefined;
|
|
20
20
|
readonly pageIndex?: undefined;
|
|
21
21
|
} | {
|
|
22
|
-
readonly count: "
|
|
22
|
+
readonly count: "none" | "exact";
|
|
23
23
|
readonly cursor: null;
|
|
24
24
|
readonly mode: "cursor";
|
|
25
25
|
readonly pageSize: number;
|
|
@@ -31,7 +31,7 @@ export declare function useQueryState(params: UseQueryStateParams): {
|
|
|
31
31
|
readonly pageSize: number;
|
|
32
32
|
readonly cursor?: undefined;
|
|
33
33
|
}>;
|
|
34
|
-
paginationMode: "
|
|
34
|
+
paginationMode: "cursor" | "none" | "offset";
|
|
35
35
|
paginationRevision: import("vue").Ref<number, number>;
|
|
36
36
|
resetPagination: () => void;
|
|
37
37
|
setOffsetPagination: (value: {
|
|
@@ -39,7 +39,7 @@ export declare function useQueryState(params: UseQueryStateParams): {
|
|
|
39
39
|
pageSize: number;
|
|
40
40
|
}) => void;
|
|
41
41
|
sorting: import("vue").WritableComputedRef<{
|
|
42
|
-
dir: "
|
|
42
|
+
dir: "asc" | "desc";
|
|
43
43
|
key: string;
|
|
44
44
|
} | null, {
|
|
45
45
|
key: string;
|
|
@@ -7,10 +7,10 @@ export declare function useTableColumns(params: UseTableColumnsParams): {
|
|
|
7
7
|
}) => import("@nuxt/ui/runtime/components/DropdownMenu.d.vue.js").DropdownMenuItem[][];
|
|
8
8
|
getPinnedState: (options: {
|
|
9
9
|
columnId: string;
|
|
10
|
-
}) => "
|
|
10
|
+
}) => "left" | "right" | null;
|
|
11
11
|
getSortState: (options: {
|
|
12
12
|
columnId: string;
|
|
13
|
-
}) => "
|
|
13
|
+
}) => "asc" | "desc" | null;
|
|
14
14
|
orderedColumns: import("vue").ComputedRef<import("../utils/index.js").TableRuntimeColumn[]>;
|
|
15
15
|
reset: () => void;
|
|
16
16
|
runtimeColumns: import("vue").ComputedRef<import("../utils/index.js").TableRuntimeColumn[]>;
|
|
@@ -34,7 +34,7 @@ export declare function useTableColumns(params: UseTableColumnsParams): {
|
|
|
34
34
|
sortKeys: import("vue").ComputedRef<string[]>;
|
|
35
35
|
sortingState: import("vue").ComputedRef<{
|
|
36
36
|
active: boolean;
|
|
37
|
-
dir: "
|
|
37
|
+
dir: "asc" | "desc" | undefined;
|
|
38
38
|
key: string | undefined;
|
|
39
39
|
}>;
|
|
40
40
|
tableColumns: import("vue").ComputedRef<({
|
|
@@ -22,7 +22,17 @@ export declare function useTableFilterOptions(options: UseTableFilterOptionsPara
|
|
|
22
22
|
isError: ComputedRef<boolean>;
|
|
23
23
|
isLoading: ComputedRef<boolean>;
|
|
24
24
|
isStaleLoading: ComputedRef<boolean>;
|
|
25
|
-
refresh: () => Promise<[import("@tanstack/vue-query").QueryObserverResult<TableFilterOptionEntry[] | TableFilterOptionQueryResult, Error>, import("@tanstack/vue-query").QueryObserverResult<TableFacetExecutionResult<string, unknown>, Error>]>;
|
|
25
|
+
refresh: () => Promise<[import("@tanstack/vue-query").QueryObserverResult<import("@tanstack/vue-query").InfiniteData<import("../../shared/index.js").RemoteOptionsPage<TableFilterOptionEntry> | import("../../shared/index.js").RemoteCursorOptionsPage<TableFilterOptionEntry>, import("../../shared/utils/remote-options.js").RemoteOptionsPageParam>, Error> | import("@tanstack/vue-query").QueryObserverResult<TableFilterOptionEntry[] | TableFilterOptionQueryResult, Error>, import("@tanstack/vue-query").QueryObserverResult<TableFacetExecutionResult<string, unknown>, Error>]>;
|
|
26
|
+
/** Paging of `source.remote`: the editor list loads the next page ahead of the scroll. */
|
|
27
|
+
remote: {
|
|
28
|
+
enabled: ComputedRef<boolean>;
|
|
29
|
+
failed: ComputedRef<boolean>;
|
|
30
|
+
hasMore: ComputedRef<boolean>;
|
|
31
|
+
loadMore: () => void;
|
|
32
|
+
loadingMore: ComputedRef<boolean>;
|
|
33
|
+
prefetchDistance: ComputedRef<number | "viewport">;
|
|
34
|
+
retry: () => Promise<import("@tanstack/vue-query").QueryObserverResult<import("@tanstack/vue-query").InfiniteData<import("../../shared/index.js").RemoteOptionsPage<TableFilterOptionEntry> | import("../../shared/index.js").RemoteCursorOptionsPage<TableFilterOptionEntry>, import("../../shared/utils/remote-options.js").RemoteOptionsPageParam>, Error>>;
|
|
35
|
+
};
|
|
26
36
|
searchExpandedIds: ComputedRef<string[]>;
|
|
27
37
|
showCounts: ComputedRef<boolean>;
|
|
28
38
|
sourceEntries: ComputedRef<(TableResolvedFilterOptionEntry<import("../types/index.js").TableFilterPrimitiveValue> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/vue-query";
|
|
2
|
-
import { computed, unref } from "vue";
|
|
1
|
+
import { useQueries, useQuery } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, unref, watch } from "vue";
|
|
3
3
|
import {
|
|
4
4
|
isBoolean,
|
|
5
5
|
isFunction,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
resolveOptionFilterUi,
|
|
18
18
|
resolveTableFacetMode
|
|
19
19
|
} from "../utils/index.js";
|
|
20
|
+
import { useTableRemoteFilterOptions } from "./use-table-remote-filter-options.js";
|
|
20
21
|
export function useTableFilterOptions(options) {
|
|
21
22
|
const isActive = computed(() => options.active?.value ?? true);
|
|
22
23
|
const isReady = computed(() => options.ready?.value ?? true);
|
|
@@ -52,29 +53,36 @@ export function useTableFilterOptions(options) {
|
|
|
52
53
|
() => shouldDeriveCounts.value && isActive.value && isReady.value
|
|
53
54
|
);
|
|
54
55
|
const isRemoteTable = computed(() => options.schema.value.source.mode === "remote");
|
|
56
|
+
const remoteConfig = computed(() => optionDefinition.value?.source?.remote);
|
|
57
|
+
const hasRemotePages = computed(() => Boolean(remoteConfig.value));
|
|
55
58
|
const hasRemoteOptionQuery = computed(
|
|
56
|
-
() => options.definition.kind === "option" && isFunction(options.definition.source?.query)
|
|
59
|
+
() => !hasRemotePages.value && options.definition.kind === "option" && isFunction(options.definition.source?.query)
|
|
57
60
|
);
|
|
61
|
+
const hasServerOptions = computed(() => hasRemotePages.value || hasRemoteOptionQuery.value);
|
|
58
62
|
const facetSpec = computed(() => options.definition.source?.facet);
|
|
59
63
|
const facetConfig = computed(
|
|
60
64
|
() => isFacetConfig(facetSpec.value) ? facetSpec.value : null
|
|
61
65
|
);
|
|
62
66
|
const hasPerFilterFacetQuery = computed(() => isFunction(facetConfig.value?.query));
|
|
63
67
|
const usesFacetCounts = computed(
|
|
64
|
-
() => Boolean(facetSpec.value) && (options.schema.value.source.mode === "client" || hasPerFilterFacetQuery.value ||
|
|
68
|
+
() => Boolean(facetSpec.value) && (options.schema.value.source.mode === "client" || hasPerFilterFacetQuery.value || // The main request cannot count options it never lists: paged options need `facet.query`.
|
|
69
|
+
isRemoteTable.value && Boolean(remoteSource.value?.facets) && !hasRemotePages.value)
|
|
70
|
+
);
|
|
71
|
+
const countsPagesRemotely = computed(
|
|
72
|
+
() => hasRemotePages.value && isRemoteTable.value && hasPerFilterFacetQuery.value
|
|
65
73
|
);
|
|
66
74
|
const resolvedTreeSearchMode = computed(() => {
|
|
67
75
|
if (optionUi.value?.presentation !== "tree") {
|
|
68
|
-
return
|
|
76
|
+
return hasServerOptions.value ? "remote" : "local";
|
|
69
77
|
}
|
|
70
78
|
const configured = optionUi.value.tree.searchMode;
|
|
71
79
|
if (configured === "local" || configured === "remote") {
|
|
72
80
|
return configured;
|
|
73
81
|
}
|
|
74
|
-
return
|
|
82
|
+
return hasServerOptions.value ? "remote" : "local";
|
|
75
83
|
});
|
|
76
84
|
const querySearch = computed(() => {
|
|
77
|
-
if (!
|
|
85
|
+
if (!hasServerOptions.value) {
|
|
78
86
|
return;
|
|
79
87
|
}
|
|
80
88
|
if (resolvedTreeSearchMode.value === "local") {
|
|
@@ -97,6 +105,30 @@ export function useTableFilterOptions(options) {
|
|
|
97
105
|
key: options.definition.key
|
|
98
106
|
})
|
|
99
107
|
);
|
|
108
|
+
const remotePages = useTableRemoteFilterOptions({
|
|
109
|
+
config: remoteConfig,
|
|
110
|
+
enabled: computed(() => isActive.value && isReady.value),
|
|
111
|
+
search: computed(() => querySearch.value ?? "")
|
|
112
|
+
});
|
|
113
|
+
watch(
|
|
114
|
+
[remotePages.entries, selectedValues],
|
|
115
|
+
([entries, values]) => {
|
|
116
|
+
if (!hasRemotePages.value || !values.length) return;
|
|
117
|
+
const picked = new Set(values.map(String));
|
|
118
|
+
options.filters.selectedOptions.remember(
|
|
119
|
+
options.definition.key,
|
|
120
|
+
flattenRawOptionEntries(entries).filter((entry) => picked.has(String(entry.value)))
|
|
121
|
+
);
|
|
122
|
+
},
|
|
123
|
+
{ immediate: true }
|
|
124
|
+
);
|
|
125
|
+
const remotePageEntries = computed(() => {
|
|
126
|
+
const listed = new Set(
|
|
127
|
+
flattenRawOptionEntries(remotePages.entries.value).map((entry) => String(entry.value))
|
|
128
|
+
);
|
|
129
|
+
const selected = options.filters.selectedOptions.getSelectedOptions(options.definition.key).filter((entry) => !listed.has(String(entry.value)));
|
|
130
|
+
return [...selected, ...remotePages.entries.value];
|
|
131
|
+
});
|
|
100
132
|
const optionQuery = useQuery(
|
|
101
133
|
computed(() => {
|
|
102
134
|
const activeDefinition = optionDefinition.value;
|
|
@@ -126,7 +158,7 @@ export function useTableFilterOptions(options) {
|
|
|
126
158
|
);
|
|
127
159
|
const perFilterFacetQuery = useQuery(
|
|
128
160
|
computed(() => {
|
|
129
|
-
if (!isRemoteTable.value || !usesFacetCounts.value || !facetConfig.value?.query) {
|
|
161
|
+
if (!isRemoteTable.value || !usesFacetCounts.value || !facetConfig.value?.query || countsPagesRemotely.value) {
|
|
130
162
|
return {
|
|
131
163
|
enabled: false,
|
|
132
164
|
queryFn: async () => ({ facets: [] }),
|
|
@@ -168,10 +200,62 @@ export function useTableFilterOptions(options) {
|
|
|
168
200
|
}
|
|
169
201
|
return result?.options ? [...result.options] : [];
|
|
170
202
|
});
|
|
203
|
+
const pageFacetRequests = computed(() => {
|
|
204
|
+
if (!countsPagesRemotely.value || !shouldResolveCounts.value) return [];
|
|
205
|
+
const paged = remotePages.pageValues.value;
|
|
206
|
+
const listed = new Set(paged.flat().map(String));
|
|
207
|
+
const outside = options.filters.selectedOptions.getSelectedOptions(options.definition.key).map((entry) => entry.value).filter((value) => !listed.has(String(value)));
|
|
208
|
+
return [outside, ...paged].filter((values) => values.length > 0);
|
|
209
|
+
});
|
|
210
|
+
const pageFacetQueries = useQueries({
|
|
211
|
+
queries: computed(() => {
|
|
212
|
+
const config = facetConfig.value;
|
|
213
|
+
const query = config?.query;
|
|
214
|
+
if (!query) return [];
|
|
215
|
+
return pageFacetRequests.value.map((values) => {
|
|
216
|
+
const definition = unref(
|
|
217
|
+
query({
|
|
218
|
+
facets: [{ key: options.definition.key, mode: resolveTableFacetMode(config), values }],
|
|
219
|
+
table: options.queryContent.facetsBaseContext.value
|
|
220
|
+
})
|
|
221
|
+
);
|
|
222
|
+
return {
|
|
223
|
+
// The table's own cache entry: it keeps the requested values next to their counts.
|
|
224
|
+
queryFn: async (context) => {
|
|
225
|
+
if (!definition.queryFn) {
|
|
226
|
+
throw new Error("facet.query must return a query definition with a queryFn.");
|
|
227
|
+
}
|
|
228
|
+
const result = await definition.queryFn({
|
|
229
|
+
...context,
|
|
230
|
+
direction: "forward",
|
|
231
|
+
pageParam: null,
|
|
232
|
+
queryKey: definition.queryKey
|
|
233
|
+
});
|
|
234
|
+
return { result, values };
|
|
235
|
+
},
|
|
236
|
+
queryKey: ["table-filter-page-facets", ...definition.queryKey],
|
|
237
|
+
refetchOnWindowFocus: QUERY_DEFAULTS.refetchOnWindowFocus,
|
|
238
|
+
staleTime: QUERY_DEFAULTS.staleTime.filterOptions
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
})
|
|
242
|
+
});
|
|
243
|
+
const pageFacetCounts = computed(
|
|
244
|
+
() => pageFacetQueries.value.flatMap((query) => {
|
|
245
|
+
if (!query.data) return [];
|
|
246
|
+
const counted = new Map(
|
|
247
|
+
query.data.result.facets.filter((facet) => facet.key === options.definition.key).flatMap((facet) => facet.options).map((option) => [String(option.value), option.count])
|
|
248
|
+
);
|
|
249
|
+
return query.data.values.map((value) => ({ count: counted.get(String(value)) ?? 0, value }));
|
|
250
|
+
})
|
|
251
|
+
);
|
|
171
252
|
const facetCounts = computed(() => {
|
|
172
253
|
if (!usesFacetCounts.value) {
|
|
173
254
|
return [];
|
|
174
255
|
}
|
|
256
|
+
if (countsPagesRemotely.value) {
|
|
257
|
+
return pageFacetCounts.value;
|
|
258
|
+
}
|
|
175
259
|
const facets = isRemoteTable.value && hasPerFilterFacetQuery.value ? unref(perFilterFacetQuery.data)?.facets ?? [] : options.queryContent.facets.value.facets;
|
|
176
260
|
return facets.find((facet) => facet.key === options.definition.key)?.options ?? [];
|
|
177
261
|
});
|
|
@@ -185,8 +269,10 @@ export function useTableFilterOptions(options) {
|
|
|
185
269
|
definition: options.definition,
|
|
186
270
|
deriveCounts: false,
|
|
187
271
|
facetCounts: resolvedFacetCounts.value,
|
|
188
|
-
|
|
189
|
-
|
|
272
|
+
// Paged options without counts yet stay unknown (a placeholder) until their page is counted.
|
|
273
|
+
missingCountFallback: shouldResolveCounts.value && usesFacetCounts.value && !countsPagesRemotely.value ? 0 : void 0,
|
|
274
|
+
options: hasRemotePages.value ? remotePageEntries.value : hasRemoteOptionQuery.value ? remoteEntries.value : staticEntries.value,
|
|
275
|
+
authoritative: hasRemotePages.value,
|
|
190
276
|
rows: [],
|
|
191
277
|
selectedValues: selectedValues.value
|
|
192
278
|
})
|
|
@@ -228,7 +314,7 @@ export function useTableFilterOptions(options) {
|
|
|
228
314
|
(entry) => !isNullish(entry.value)
|
|
229
315
|
);
|
|
230
316
|
}
|
|
231
|
-
if (!normalizedSearch.value.length ||
|
|
317
|
+
if (!normalizedSearch.value.length || hasServerOptions.value) {
|
|
232
318
|
return selectableSourceEntries.value;
|
|
233
319
|
}
|
|
234
320
|
return selectableSourceEntries.value.filter(
|
|
@@ -236,28 +322,53 @@ export function useTableFilterOptions(options) {
|
|
|
236
322
|
);
|
|
237
323
|
});
|
|
238
324
|
const isInitialLoading = computed(
|
|
239
|
-
() => optionQuery.isLoading.value && !optionQuery.isPlaceholderData.value
|
|
325
|
+
() => hasRemotePages.value ? remotePages.isLoading.value : optionQuery.isLoading.value && !optionQuery.isPlaceholderData.value
|
|
326
|
+
);
|
|
327
|
+
const isStaleLoading = computed(
|
|
328
|
+
() => hasRemotePages.value ? remotePages.isRefreshing.value : !isInitialLoading.value && optionQuery.isFetching.value
|
|
240
329
|
);
|
|
241
|
-
const isStaleLoading = computed(() => !isInitialLoading.value && optionQuery.isFetching.value);
|
|
242
330
|
const isCountLoading = computed(
|
|
243
|
-
() => isRemoteTable.value && shouldResolveCounts.value && perFilterFacetQuery.isFetching.value
|
|
331
|
+
() => isRemoteTable.value && shouldResolveCounts.value && !countsPagesRemotely.value && perFilterFacetQuery.isFetching.value
|
|
244
332
|
);
|
|
245
333
|
return {
|
|
246
|
-
error: computed(
|
|
334
|
+
error: computed(
|
|
335
|
+
() => (hasRemotePages.value ? remotePages.error.value : optionQuery.error.value) ?? perFilterFacetQuery.error.value
|
|
336
|
+
),
|
|
247
337
|
facetCounts,
|
|
248
338
|
filteredEntries,
|
|
249
339
|
filteredTreeEntries: computed(() => filteredTreeState.value.entries),
|
|
250
340
|
isCountLoading,
|
|
251
|
-
isError: computed(
|
|
341
|
+
isError: computed(
|
|
342
|
+
() => (hasRemotePages.value ? remotePages.failed.value : optionQuery.isError.value) || perFilterFacetQuery.isError.value
|
|
343
|
+
),
|
|
252
344
|
isLoading: isInitialLoading,
|
|
253
345
|
isStaleLoading,
|
|
254
|
-
refresh: () => Promise.all([
|
|
346
|
+
refresh: () => Promise.all([
|
|
347
|
+
hasRemotePages.value ? remotePages.retry() : optionQuery.refetch(),
|
|
348
|
+
perFilterFacetQuery.refetch()
|
|
349
|
+
]),
|
|
350
|
+
/** Paging of `source.remote`: the editor list loads the next page ahead of the scroll. */
|
|
351
|
+
remote: {
|
|
352
|
+
enabled: hasRemotePages,
|
|
353
|
+
failed: remotePages.failed,
|
|
354
|
+
hasMore: remotePages.hasMore,
|
|
355
|
+
loadMore: remotePages.loadMore,
|
|
356
|
+
loadingMore: remotePages.loadingMore,
|
|
357
|
+
prefetchDistance: remotePages.prefetchDistance,
|
|
358
|
+
retry: remotePages.retry
|
|
359
|
+
},
|
|
255
360
|
searchExpandedIds: computed(() => filteredTreeState.value.expandedIds),
|
|
256
361
|
showCounts: computed(() => shouldDeriveCounts.value && usesFacetCounts.value),
|
|
257
362
|
sourceEntries: selectableSourceEntries,
|
|
258
363
|
sourceTreeEntries: resolvedSourceTreeEntries
|
|
259
364
|
};
|
|
260
365
|
}
|
|
366
|
+
function flattenRawOptionEntries(entries) {
|
|
367
|
+
return entries.flatMap((entry) => [
|
|
368
|
+
...isNullish(entry.value) ? [] : [entry],
|
|
369
|
+
...flattenRawOptionEntries(entry.children ?? [])
|
|
370
|
+
]);
|
|
371
|
+
}
|
|
261
372
|
function isFacetConfig(value) {
|
|
262
373
|
return isObject(value);
|
|
263
374
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { TableFilterOptionEntry, TableFilterOptionValueEntry, TableQueryStateFilterRule, TableUiFilterDefinition } from '../types/index.js';
|
|
3
|
+
export interface UseTableFilterSelectedOptionsParams {
|
|
4
|
+
definitions: ComputedRef<TableUiFilterDefinition[]>;
|
|
5
|
+
/** Committed filter rules. */
|
|
6
|
+
rules: ComputedRef<TableQueryStateFilterRule[]>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Options of the committed values of remote option filters, so tags, panel chips, and the mobile
|
|
10
|
+
* sheet show labels instead of raw values. Options the editors loaded are recorded as values get
|
|
11
|
+
* picked; the rest (for example values restored from the URL) resolve through each filter's
|
|
12
|
+
* `source.remote.resolveSelected`, under the consumer's query key so a prefetched result is reused.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useTableFilterSelectedOptions(params: UseTableFilterSelectedOptionsParams): {
|
|
15
|
+
getSelectedOptions: (key: string) => TableFilterOptionValueEntry[];
|
|
16
|
+
/** Options of committed values are resolving for this filter. */
|
|
17
|
+
isResolving: (key: string) => boolean;
|
|
18
|
+
remember: (key: string, options: readonly TableFilterOptionEntry[]) => void;
|
|
19
|
+
};
|
|
20
|
+
export type TableFilterSelectedOptions = ReturnType<typeof useTableFilterSelectedOptions>;
|