@questpie/admin 3.0.3 → 3.0.5
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/README.md +34 -5
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +4 -1
- package/dist/client/builder/types/action-types.d.mts +31 -3
- package/dist/client/builder/types/collection-types.d.mts +140 -0
- package/dist/client/builder/types/ui-config.d.mts +16 -2
- package/dist/client/builder/types/views.d.mts +57 -0
- package/dist/client/builder/types/widget-types.d.mts +5 -0
- package/dist/client/components/actions/action-button.mjs +137 -199
- package/dist/client/components/actions/action-dialog.mjs +198 -156
- package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
- package/dist/client/components/actions/header-actions.mjs +52 -53
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/auth/auth-loading.mjs +41 -18
- package/dist/client/components/blocks/block-editor-layout.mjs +2 -2
- package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
- package/dist/client/components/blocks/block-insert-button.mjs +4 -4
- package/dist/client/components/blocks/block-item.mjs +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +91 -63
- package/dist/client/components/component-renderer.mjs +1 -1
- package/dist/client/components/fields/array-field.mjs +14 -14
- package/dist/client/components/fields/asset-preview-field.mjs +1 -1
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
- package/dist/client/components/fields/json-field.mjs +2 -2
- package/dist/client/components/fields/object-array-field.mjs +22 -22
- package/dist/client/components/fields/object-field.mjs +5 -5
- package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
- package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
- package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
- package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
- package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
- package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
- package/dist/client/components/fields/relation-picker.mjs +7 -6
- package/dist/client/components/fields/relation-select.mjs +71 -47
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
- package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
- package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
- package/dist/client/components/fields/upload-field.mjs +45 -49
- package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
- package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
- package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
- package/dist/client/components/history-sidebar.mjs +850 -340
- package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
- package/dist/client/components/locale-switcher.mjs +8 -8
- package/dist/client/components/media/media-grid.mjs +106 -86
- package/dist/client/components/media/media-picker-dialog.mjs +242 -230
- package/dist/client/components/preview/live-preview-mode.mjs +1 -1
- package/dist/client/components/primitives/asset-preview.mjs +37 -22
- package/dist/client/components/primitives/date-input.mjs +212 -249
- package/dist/client/components/primitives/dropzone.mjs +192 -159
- package/dist/client/components/primitives/field-select-control.mjs +93 -0
- package/dist/client/components/primitives/select-multi.mjs +406 -365
- package/dist/client/components/primitives/select-single.mjs +391 -323
- package/dist/client/components/primitives/time-input.mjs +2 -2
- package/dist/client/components/sheets/resource-sheet.mjs +2 -0
- package/dist/client/components/ui/accordion.mjs +4 -4
- package/dist/client/components/ui/alert.mjs +3 -3
- package/dist/client/components/ui/badge.mjs +4 -4
- package/dist/client/components/ui/button.mjs +47 -37
- package/dist/client/components/ui/card.mjs +2 -2
- package/dist/client/components/ui/checkbox.mjs +1 -1
- package/dist/client/components/ui/command.mjs +5 -5
- package/dist/client/components/ui/dialog.mjs +3 -3
- package/dist/client/components/ui/drawer.mjs +1 -1
- package/dist/client/components/ui/dropdown-menu.mjs +157 -15
- package/dist/client/components/ui/empty-state.mjs +88 -59
- package/dist/client/components/ui/field.mjs +2 -2
- package/dist/client/components/ui/input-group.mjs +3 -3
- package/dist/client/components/ui/input.mjs +1 -1
- package/dist/client/components/ui/kbd.mjs +1 -1
- package/dist/client/components/ui/label.mjs +1 -1
- package/dist/client/components/ui/popover.mjs +19 -11
- package/dist/client/components/ui/scroll-fade.mjs +170 -0
- package/dist/client/components/ui/search-input.mjs +1 -1
- package/dist/client/components/ui/select.mjs +129 -27
- package/dist/client/components/ui/sheet.mjs +54 -34
- package/dist/client/components/ui/sidebar.mjs +15 -14
- package/dist/client/components/ui/skeleton.mjs +28 -12
- package/dist/client/components/ui/switch.mjs +2 -2
- package/dist/client/components/ui/table.mjs +82 -74
- package/dist/client/components/ui/tabs.mjs +26 -31
- package/dist/client/components/ui/textarea.mjs +1 -1
- package/dist/client/components/ui/tooltip.mjs +1 -1
- package/dist/client/components/widgets/chart-widget.mjs +154 -100
- package/dist/client/components/widgets/progress-widget.mjs +63 -36
- package/dist/client/components/widgets/quick-actions-widget.mjs +207 -115
- package/dist/client/components/widgets/recent-items-widget.mjs +147 -103
- package/dist/client/components/widgets/stats-widget.mjs +91 -72
- package/dist/client/components/widgets/table-widget.mjs +161 -247
- package/dist/client/components/widgets/timeline-widget.mjs +119 -78
- package/dist/client/components/widgets/value-widget.mjs +286 -157
- package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
- package/dist/client/contexts/focus-context.d.mts +2 -2
- package/dist/client/hooks/use-action.mjs +63 -55
- package/dist/client/hooks/use-audit-history.mjs +1 -65
- package/dist/client/hooks/use-collection-validation.mjs +36 -23
- package/dist/client/hooks/use-collection.mjs +96 -1
- package/dist/client/hooks/use-saved-views.mjs +70 -49
- package/dist/client/hooks/use-server-actions.mjs +70 -46
- package/dist/client/hooks/use-server-validation.mjs +156 -41
- package/dist/client/hooks/use-server-widget-data.mjs +1 -1
- package/dist/client/hooks/use-setup-status.d.mts +3 -3
- package/dist/client/hooks/use-setup-status.mjs +2 -2
- package/dist/client/hooks/use-transition-stage.mjs +2 -10
- package/dist/client/hooks/use-validation-error-map.mjs +31 -13
- package/dist/client/hooks/use-view-state.mjs +238 -174
- package/dist/client/i18n/date-locale.mjs +33 -0
- package/dist/client/i18n/hooks.mjs +17 -1
- package/dist/client/lib/utils.mjs +3 -2
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-banner.mjs +75 -46
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +2 -2
- package/dist/client/runtime/provider.mjs +8 -1
- package/dist/client/runtime/translations-provider.mjs +1 -1
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/styles/base.css +1022 -0
- package/dist/client/styles/index.css +3 -589
- package/dist/client/utils/auto-expand-fields.mjs +4 -2
- package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
- package/dist/client/utils/use-lazy-component.mjs +80 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +17 -10
- package/dist/client/views/auth/auth-layout.mjs +291 -80
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +1 -1
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/auto-form-fields.mjs +11 -9
- package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
- package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
- package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
- package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
- package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
- package/dist/client/views/collection/columns/build-columns.mjs +29 -9
- package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
- package/dist/client/views/collection/field-renderer.mjs +50 -89
- package/dist/client/views/collection/form-view.mjs +237 -227
- package/dist/client/views/collection/table-view.mjs +1167 -234
- package/dist/client/views/collection/view-skeletons.mjs +222 -79
- package/dist/client/views/common/global-search.mjs +29 -18
- package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
- package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
- package/dist/client/views/dashboard/widget-card.mjs +23 -14
- package/dist/client/views/globals/global-form-view.mjs +634 -589
- package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
- package/dist/client/views/layout/admin-layout.d.mts +3 -6
- package/dist/client/views/layout/admin-layout.mjs +152 -155
- package/dist/client/views/layout/admin-router.mjs +936 -616
- package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
- package/dist/client/views/layout/admin-sidebar.mjs +762 -592
- package/dist/client/views/layout/admin-theme.d.mts +10 -0
- package/dist/client/views/layout/admin-theme.mjs +84 -0
- package/dist/client/views/layout/admin-view-layout.mjs +161 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +49 -26
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +2 -19
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +2 -19
- package/dist/client/views/pages/login-page.d.mts +3 -3
- package/dist/client/views/pages/login-page.mjs +4 -21
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +3 -20
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +70 -71
- package/dist/client.d.mts +6 -2
- package/dist/client.mjs +2 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +2 -1
- package/dist/server/augmentation/dashboard.d.mts +67 -3
- package/dist/server/augmentation/form-layout.d.mts +21 -0
- package/dist/server/augmentation/index.d.mts +1 -1
- package/dist/server/codegen/admin-client-template.mjs +4 -0
- package/dist/server/fields/blocks.d.mts +1 -1
- package/dist/server/fields/blocks.mjs +12 -0
- package/dist/server/fields/rich-text.d.mts +1 -1
- package/dist/server/fields/rich-text.mjs +8 -0
- package/dist/server/i18n/index.mjs +29 -7
- package/dist/server/i18n/messages/cs.mjs +414 -1
- package/dist/server/i18n/messages/de.mjs +412 -1
- package/dist/server/i18n/messages/en.mjs +166 -1
- package/dist/server/i18n/messages/es.mjs +412 -1
- package/dist/server/i18n/messages/fr.mjs +412 -1
- package/dist/server/i18n/messages/pl.mjs +416 -1
- package/dist/server/i18n/messages/pt.mjs +409 -1
- package/dist/server/i18n/messages/sk.mjs +216 -2
- package/dist/server/modules/admin/block/introspection.mjs +4 -1
- package/dist/server/modules/admin/block/prefetch.mjs +12 -2
- package/dist/server/modules/admin/collections/account.d.mts +2 -2
- package/dist/server/modules/admin/collections/admin-locks.d.mts +2 -2
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +42 -42
- package/dist/server/modules/admin/collections/assets.d.mts +20 -20
- package/dist/server/modules/admin/collections/assets.mjs +0 -1
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +40 -28
- package/dist/server/modules/admin/collections/user.mjs +40 -9
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
- package/dist/server/modules/admin/factories.mjs +7 -18
- package/dist/server/modules/admin/index.d.mts +1 -1
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +67 -28
- package/dist/server/modules/admin/routes/i18n-helpers.mjs +34 -0
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.mjs +25 -17
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/route-helpers.mjs +1 -1
- package/dist/server/modules/admin/routes/setup.d.mts +10 -10
- package/dist/server/modules/admin/routes/setup.mjs +16 -13
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/translations.mjs +5 -1
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +2 -2
- package/dist/server/modules/audit/.generated/module.d.mts +1 -1
- package/dist/server/modules/audit/.generated/module.mjs +1 -1
- package/dist/server/modules/audit/collections/audit-log.d.mts +2 -2
- package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
- package/dist/server/modules/audit/config/app.mjs +99 -42
- package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
- package/dist/server/plugin.mjs +4 -2
- package/dist/server/proxy-factories.d.mts +4 -3
- package/dist/server/proxy-factories.mjs +34 -8
- package/dist/shared/types/saved-views.types.d.mts +2 -0
- package/package.json +6 -4
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
- package/dist/client/components/ui/spinner.mjs +0 -52
- package/dist/client/components/ui/toolbar.mjs +0 -136
- package/dist/client/contexts/breadcrumb-context.mjs +0 -60
- package/dist/client/views/layout/admin-topbar.mjs +0 -236
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useResolveText } from "../../i18n/hooks.mjs";
|
|
1
|
+
import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
|
|
2
2
|
import { formatLabel } from "../../lib/utils.mjs";
|
|
3
3
|
import { useCollectionList } from "../../hooks/use-collection.mjs";
|
|
4
4
|
import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
|
|
5
5
|
import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
|
|
6
|
+
import { WidgetEmptyState } from "./widget-empty-state.mjs";
|
|
6
7
|
import { ChartWidgetSkeleton } from "./widget-skeletons.mjs";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
8
9
|
import "react";
|
|
@@ -74,9 +75,10 @@ function _temp(entry) {
|
|
|
74
75
|
}, String(entry.name));
|
|
75
76
|
}
|
|
76
77
|
function ChartWidget(t0) {
|
|
77
|
-
const $ = c(
|
|
78
|
+
const $ = c(56);
|
|
78
79
|
const { config } = t0;
|
|
79
80
|
const resolveText = useResolveText();
|
|
81
|
+
const { t } = useTranslation();
|
|
80
82
|
const { collection, field, chartType: t1, timeRange: t2, label, color: t3, showGrid: t4, realtime, hasLoader, refreshInterval } = config;
|
|
81
83
|
const chartType = t1 === void 0 ? "area" : t1;
|
|
82
84
|
const timeRange = t2 === void 0 ? "30d" : t2;
|
|
@@ -99,55 +101,75 @@ function ChartWidget(t0) {
|
|
|
99
101
|
t7 = { limit: 1e3 };
|
|
100
102
|
$[3] = t7;
|
|
101
103
|
} else t7 = $[3];
|
|
102
|
-
|
|
103
|
-
if ($[4] !== realtime) {
|
|
104
|
-
t8 = { realtime };
|
|
105
|
-
$[4] = realtime;
|
|
106
|
-
$[5] = t8;
|
|
107
|
-
} else t8 = $[5];
|
|
108
|
-
const collectionQuery = useCollectionList(collection, t7, void 0, t8);
|
|
109
|
-
const { isLoading, error, refetch } = hasLoader ? serverQuery : collectionQuery;
|
|
104
|
+
const t8 = !hasLoader;
|
|
110
105
|
let t9;
|
|
111
|
-
if ($[
|
|
112
|
-
t9 =
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
|
|
116
|
-
} else t9 = $[8];
|
|
117
|
-
const collectionItems = t9;
|
|
106
|
+
if ($[4] !== t8) {
|
|
107
|
+
t9 = { enabled: t8 };
|
|
108
|
+
$[4] = t8;
|
|
109
|
+
$[5] = t9;
|
|
110
|
+
} else t9 = $[5];
|
|
118
111
|
let t10;
|
|
119
|
-
if ($[
|
|
120
|
-
t10 =
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} else t10 = $[13];
|
|
127
|
-
const displayLabel = t10;
|
|
112
|
+
if ($[6] !== realtime) {
|
|
113
|
+
t10 = { realtime };
|
|
114
|
+
$[6] = realtime;
|
|
115
|
+
$[7] = t10;
|
|
116
|
+
} else t10 = $[7];
|
|
117
|
+
const collectionQuery = useCollectionList(collection, t7, t9, t10);
|
|
118
|
+
const { isLoading, error, refetch, isFetching } = hasLoader ? serverQuery : collectionQuery;
|
|
128
119
|
let t11;
|
|
129
120
|
bb0: {
|
|
130
121
|
if (hasLoader) {
|
|
131
122
|
let t12$2;
|
|
132
|
-
if ($[
|
|
133
|
-
t12$2 = serverQuery.data ?? [];
|
|
134
|
-
$[14] = serverQuery.data;
|
|
135
|
-
$[15] = t12$2;
|
|
136
|
-
} else t12$2 = $[15];
|
|
137
|
-
t11 = t12$2;
|
|
138
|
-
break bb0;
|
|
139
|
-
}
|
|
140
|
-
if (!collectionItems.length) {
|
|
141
|
-
let t12$2;
|
|
142
|
-
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
143
124
|
t12$2 = [];
|
|
144
|
-
$[
|
|
145
|
-
} else t12$2 = $[
|
|
125
|
+
$[8] = t12$2;
|
|
126
|
+
} else t12$2 = $[8];
|
|
146
127
|
t11 = t12$2;
|
|
147
128
|
break bb0;
|
|
148
129
|
}
|
|
149
130
|
let t12$1;
|
|
150
|
-
if ($[
|
|
131
|
+
if ($[9] !== collectionQuery.data) {
|
|
132
|
+
t12$1 = Array.isArray(collectionQuery.data?.docs) ? collectionQuery.data.docs : [];
|
|
133
|
+
$[9] = collectionQuery.data;
|
|
134
|
+
$[10] = t12$1;
|
|
135
|
+
} else t12$1 = $[10];
|
|
136
|
+
t11 = t12$1;
|
|
137
|
+
}
|
|
138
|
+
const collectionItems = t11;
|
|
139
|
+
let t12;
|
|
140
|
+
if ($[11] !== collection || $[12] !== config.title || $[13] !== field || $[14] !== label || $[15] !== resolveText) {
|
|
141
|
+
t12 = config.title ? resolveText(config.title) : label ? resolveText(label) : `${formatLabel(collection)} by ${field}`;
|
|
142
|
+
$[11] = collection;
|
|
143
|
+
$[12] = config.title;
|
|
144
|
+
$[13] = field;
|
|
145
|
+
$[14] = label;
|
|
146
|
+
$[15] = resolveText;
|
|
147
|
+
$[16] = t12;
|
|
148
|
+
} else t12 = $[16];
|
|
149
|
+
const displayLabel = t12;
|
|
150
|
+
let t13;
|
|
151
|
+
bb1: {
|
|
152
|
+
if (hasLoader) {
|
|
153
|
+
let t14$2;
|
|
154
|
+
if ($[17] !== serverQuery.data) {
|
|
155
|
+
t14$2 = serverQuery.data ?? [];
|
|
156
|
+
$[17] = serverQuery.data;
|
|
157
|
+
$[18] = t14$2;
|
|
158
|
+
} else t14$2 = $[18];
|
|
159
|
+
t13 = t14$2;
|
|
160
|
+
break bb1;
|
|
161
|
+
}
|
|
162
|
+
if (!collectionItems.length) {
|
|
163
|
+
let t14$2;
|
|
164
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
165
|
+
t14$2 = [];
|
|
166
|
+
$[19] = t14$2;
|
|
167
|
+
} else t14$2 = $[19];
|
|
168
|
+
t13 = t14$2;
|
|
169
|
+
break bb1;
|
|
170
|
+
}
|
|
171
|
+
let t14$1;
|
|
172
|
+
if ($[20] !== collectionItems || $[21] !== field || $[22] !== timeRange) {
|
|
151
173
|
const grouped = collectionItems.reduce((acc, item) => {
|
|
152
174
|
const value = item[field];
|
|
153
175
|
if (value === void 0 || value === null) return acc;
|
|
@@ -157,30 +179,43 @@ function ChartWidget(t0) {
|
|
|
157
179
|
acc[key] = (acc[key] || 0) + 1;
|
|
158
180
|
return acc;
|
|
159
181
|
}, {});
|
|
160
|
-
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
} else
|
|
166
|
-
|
|
182
|
+
t14$1 = Object.entries(grouped).map(_temp2).sort(_temp3);
|
|
183
|
+
$[20] = collectionItems;
|
|
184
|
+
$[21] = field;
|
|
185
|
+
$[22] = timeRange;
|
|
186
|
+
$[23] = t14$1;
|
|
187
|
+
} else t14$1 = $[23];
|
|
188
|
+
t13 = t14$1;
|
|
167
189
|
}
|
|
168
|
-
const chartData =
|
|
169
|
-
let
|
|
170
|
-
if ($[
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
190
|
+
const chartData = t13;
|
|
191
|
+
let t14;
|
|
192
|
+
if ($[24] !== t) {
|
|
193
|
+
t14 = t("widget.chart.emptyTitle");
|
|
194
|
+
$[24] = t;
|
|
195
|
+
$[25] = t14;
|
|
196
|
+
} else t14 = $[25];
|
|
197
|
+
let t15;
|
|
198
|
+
if ($[26] !== t) {
|
|
199
|
+
t15 = t("widget.chart.emptyDescription");
|
|
200
|
+
$[26] = t;
|
|
201
|
+
$[27] = t15;
|
|
202
|
+
} else t15 = $[27];
|
|
203
|
+
let t16;
|
|
204
|
+
if ($[28] !== t14 || $[29] !== t15) {
|
|
205
|
+
t16 = /* @__PURE__ */ jsx(WidgetEmptyState, {
|
|
206
|
+
iconName: "ph:chart-line",
|
|
207
|
+
title: t14,
|
|
208
|
+
description: t15,
|
|
209
|
+
className: "min-h-48"
|
|
177
210
|
});
|
|
178
|
-
$[
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
211
|
+
$[28] = t14;
|
|
212
|
+
$[29] = t15;
|
|
213
|
+
$[30] = t16;
|
|
214
|
+
} else t16 = $[30];
|
|
215
|
+
const emptyContent = t16;
|
|
216
|
+
let t17;
|
|
217
|
+
if ($[31] !== chartData || $[32] !== chartType || $[33] !== color || $[34] !== emptyContent || $[35] !== showGrid) {
|
|
218
|
+
t17 = chartData.length === 0 ? emptyContent : /* @__PURE__ */ jsx("div", {
|
|
184
219
|
className: "h-48 w-full",
|
|
185
220
|
children: /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
186
221
|
width: "100%",
|
|
@@ -193,48 +228,67 @@ function ChartWidget(t0) {
|
|
|
193
228
|
})
|
|
194
229
|
})
|
|
195
230
|
});
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
231
|
+
$[31] = chartData;
|
|
232
|
+
$[32] = chartType;
|
|
233
|
+
$[33] = color;
|
|
234
|
+
$[34] = emptyContent;
|
|
235
|
+
$[35] = showGrid;
|
|
236
|
+
$[36] = t17;
|
|
237
|
+
} else t17 = $[36];
|
|
238
|
+
const chartContent = t17;
|
|
239
|
+
let t18;
|
|
240
|
+
if ($[37] !== config.description || $[38] !== resolveText) {
|
|
241
|
+
t18 = config.description ? resolveText(config.description) : void 0;
|
|
242
|
+
$[37] = config.description;
|
|
243
|
+
$[38] = resolveText;
|
|
244
|
+
$[39] = t18;
|
|
245
|
+
} else t18 = $[39];
|
|
246
|
+
const t19 = isFetching && !isLoading;
|
|
247
|
+
let t20;
|
|
248
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
249
|
+
t20 = /* @__PURE__ */ jsx(ChartWidgetSkeleton, {});
|
|
250
|
+
$[40] = t20;
|
|
251
|
+
} else t20 = $[40];
|
|
252
|
+
let t21;
|
|
253
|
+
if ($[41] !== error) {
|
|
254
|
+
t21 = error instanceof Error ? error : error ? new Error(String(error)) : null;
|
|
255
|
+
$[41] = error;
|
|
256
|
+
$[42] = t21;
|
|
257
|
+
} else t21 = $[42];
|
|
258
|
+
let t22;
|
|
259
|
+
if ($[43] !== refetch) {
|
|
260
|
+
t22 = () => refetch();
|
|
261
|
+
$[43] = refetch;
|
|
262
|
+
$[44] = t22;
|
|
263
|
+
} else t22 = $[44];
|
|
264
|
+
let t23;
|
|
265
|
+
if ($[45] !== chartContent || $[46] !== config.actions || $[47] !== config.cardVariant || $[48] !== config.className || $[49] !== displayLabel || $[50] !== isLoading || $[51] !== t18 || $[52] !== t19 || $[53] !== t21 || $[54] !== t22) {
|
|
266
|
+
t23 = /* @__PURE__ */ jsx(WidgetCard, {
|
|
223
267
|
title: displayLabel,
|
|
268
|
+
description: t18,
|
|
269
|
+
variant: config.cardVariant,
|
|
224
270
|
isLoading,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
271
|
+
isRefreshing: t19,
|
|
272
|
+
loadingSkeleton: t20,
|
|
273
|
+
error: t21,
|
|
274
|
+
onRefresh: t22,
|
|
275
|
+
actions: config.actions,
|
|
276
|
+
className: config.className,
|
|
228
277
|
children: chartContent
|
|
229
278
|
});
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
|
|
237
|
-
|
|
279
|
+
$[45] = chartContent;
|
|
280
|
+
$[46] = config.actions;
|
|
281
|
+
$[47] = config.cardVariant;
|
|
282
|
+
$[48] = config.className;
|
|
283
|
+
$[49] = displayLabel;
|
|
284
|
+
$[50] = isLoading;
|
|
285
|
+
$[51] = t18;
|
|
286
|
+
$[52] = t19;
|
|
287
|
+
$[53] = t21;
|
|
288
|
+
$[54] = t22;
|
|
289
|
+
$[55] = t23;
|
|
290
|
+
} else t23 = $[55];
|
|
291
|
+
return t23;
|
|
238
292
|
}
|
|
239
293
|
/**
|
|
240
294
|
* Renders the appropriate chart type as a proper component
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useResolveText } from "../../i18n/hooks.mjs";
|
|
1
|
+
import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
|
|
2
2
|
import { cn } from "../../lib/utils.mjs";
|
|
3
3
|
import { selectClient, useAdminStore } from "../../runtime/provider.mjs";
|
|
4
4
|
import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
|
|
5
5
|
import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
|
|
6
|
+
import { WidgetEmptyState } from "./widget-empty-state.mjs";
|
|
6
7
|
import { ProgressWidgetSkeleton } from "./widget-skeletons.mjs";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
8
9
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -38,10 +39,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
38
39
|
* ```
|
|
39
40
|
*/
|
|
40
41
|
function ProgressWidget(t0) {
|
|
41
|
-
const $ = c(
|
|
42
|
+
const $ = c(48);
|
|
42
43
|
const { config } = t0;
|
|
43
44
|
const client = useAdminStore(selectClient);
|
|
44
45
|
const resolveText = useResolveText();
|
|
46
|
+
const { t } = useTranslation();
|
|
45
47
|
const { color, showPercentage: t1 } = config;
|
|
46
48
|
const showPercentage = t1 === void 0 ? true : t1;
|
|
47
49
|
const useServerData = !!config.hasLoader;
|
|
@@ -89,7 +91,7 @@ function ProgressWidget(t0) {
|
|
|
89
91
|
$[12] = t6;
|
|
90
92
|
} else t6 = $[12];
|
|
91
93
|
const clientQuery = useQuery(t6);
|
|
92
|
-
const { data, isLoading, error, refetch } = useServerData ? serverQuery : clientQuery;
|
|
94
|
+
const { data, isLoading, error, refetch, isFetching } = useServerData ? serverQuery : clientQuery;
|
|
93
95
|
let t7;
|
|
94
96
|
if ($[13] !== config.title || $[14] !== resolveText) {
|
|
95
97
|
t7 = config.title ? resolveText(config.title) : void 0;
|
|
@@ -121,7 +123,7 @@ function ProgressWidget(t0) {
|
|
|
121
123
|
} else t9 = $[20];
|
|
122
124
|
const getProgressColor = t9;
|
|
123
125
|
let t10;
|
|
124
|
-
if ($[21] !== data || $[22] !== getProgressColor || $[23] !== percentage || $[24] !== percentageFormatted || $[25] !== showPercentage) {
|
|
126
|
+
if ($[21] !== data || $[22] !== getProgressColor || $[23] !== percentage || $[24] !== percentageFormatted || $[25] !== showPercentage || $[26] !== t) {
|
|
125
127
|
t10 = data ? /* @__PURE__ */ jsxs("div", {
|
|
126
128
|
className: "space-y-3",
|
|
127
129
|
children: [
|
|
@@ -130,7 +132,7 @@ function ProgressWidget(t0) {
|
|
|
130
132
|
children: /* @__PURE__ */ jsx("div", {
|
|
131
133
|
className: "bg-muted h-2 w-full overflow-hidden rounded-full",
|
|
132
134
|
children: /* @__PURE__ */ jsx("div", {
|
|
133
|
-
className: cn("h-full rounded-full transition-
|
|
135
|
+
className: cn("h-full rounded-full transition-[width] duration-500", getProgressColor()),
|
|
134
136
|
style: { width: `${percentage}%` }
|
|
135
137
|
})
|
|
136
138
|
})
|
|
@@ -138,10 +140,10 @@ function ProgressWidget(t0) {
|
|
|
138
140
|
/* @__PURE__ */ jsxs("div", {
|
|
139
141
|
className: "flex items-center justify-between text-sm",
|
|
140
142
|
children: [/* @__PURE__ */ jsx("span", {
|
|
141
|
-
className: "text-muted-foreground",
|
|
143
|
+
className: "text-muted-foreground tabular-nums",
|
|
142
144
|
children: data.label || `${data.current.toLocaleString()} / ${data.target.toLocaleString()}`
|
|
143
145
|
}), showPercentage && /* @__PURE__ */ jsxs("span", {
|
|
144
|
-
className: "font-medium",
|
|
146
|
+
className: "font-medium tabular-nums",
|
|
145
147
|
children: [percentageFormatted, "%"]
|
|
146
148
|
})]
|
|
147
149
|
}),
|
|
@@ -150,50 +152,75 @@ function ProgressWidget(t0) {
|
|
|
150
152
|
children: data.subtitle
|
|
151
153
|
})
|
|
152
154
|
]
|
|
153
|
-
}) :
|
|
155
|
+
}) : /* @__PURE__ */ jsx(WidgetEmptyState, {
|
|
156
|
+
iconName: "ph:target",
|
|
157
|
+
title: t("widget.progress.emptyTitle"),
|
|
158
|
+
description: t("widget.progress.emptyDescription")
|
|
159
|
+
});
|
|
154
160
|
$[21] = data;
|
|
155
161
|
$[22] = getProgressColor;
|
|
156
162
|
$[23] = percentage;
|
|
157
163
|
$[24] = percentageFormatted;
|
|
158
164
|
$[25] = showPercentage;
|
|
159
|
-
$[26] =
|
|
160
|
-
|
|
165
|
+
$[26] = t;
|
|
166
|
+
$[27] = t10;
|
|
167
|
+
} else t10 = $[27];
|
|
161
168
|
const progressContent = t10;
|
|
162
169
|
let t11;
|
|
163
|
-
if ($[
|
|
164
|
-
t11 =
|
|
165
|
-
$[
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
$[28] = error;
|
|
171
|
-
$[29] = t12;
|
|
172
|
-
} else t12 = $[29];
|
|
170
|
+
if ($[28] !== config.description || $[29] !== resolveText) {
|
|
171
|
+
t11 = config.description ? resolveText(config.description) : void 0;
|
|
172
|
+
$[28] = config.description;
|
|
173
|
+
$[29] = resolveText;
|
|
174
|
+
$[30] = t11;
|
|
175
|
+
} else t11 = $[30];
|
|
176
|
+
const t12 = isFetching && !isLoading;
|
|
173
177
|
let t13;
|
|
174
|
-
if ($[
|
|
175
|
-
t13 =
|
|
176
|
-
$[30] = refetch;
|
|
178
|
+
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t13 = /* @__PURE__ */ jsx(ProgressWidgetSkeleton, {});
|
|
177
180
|
$[31] = t13;
|
|
178
181
|
} else t13 = $[31];
|
|
179
182
|
let t14;
|
|
180
|
-
if ($[32] !==
|
|
181
|
-
t14 =
|
|
183
|
+
if ($[32] !== error) {
|
|
184
|
+
t14 = error instanceof Error ? error : error ? new Error(String(error)) : null;
|
|
185
|
+
$[32] = error;
|
|
186
|
+
$[33] = t14;
|
|
187
|
+
} else t14 = $[33];
|
|
188
|
+
let t15;
|
|
189
|
+
if ($[34] !== refetch) {
|
|
190
|
+
t15 = () => refetch();
|
|
191
|
+
$[34] = refetch;
|
|
192
|
+
$[35] = t15;
|
|
193
|
+
} else t15 = $[35];
|
|
194
|
+
let t16;
|
|
195
|
+
if ($[36] !== config.actions || $[37] !== config.cardVariant || $[38] !== config.className || $[39] !== config.icon || $[40] !== isLoading || $[41] !== progressContent || $[42] !== t11 || $[43] !== t12 || $[44] !== t14 || $[45] !== t15 || $[46] !== title) {
|
|
196
|
+
t16 = /* @__PURE__ */ jsx(WidgetCard, {
|
|
182
197
|
title,
|
|
198
|
+
description: t11,
|
|
199
|
+
icon: config.icon,
|
|
200
|
+
variant: config.cardVariant,
|
|
183
201
|
isLoading,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
202
|
+
isRefreshing: t12,
|
|
203
|
+
loadingSkeleton: t13,
|
|
204
|
+
error: t14,
|
|
205
|
+
onRefresh: t15,
|
|
206
|
+
actions: config.actions,
|
|
207
|
+
className: config.className,
|
|
187
208
|
children: progressContent
|
|
188
209
|
});
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
|
|
196
|
-
|
|
210
|
+
$[36] = config.actions;
|
|
211
|
+
$[37] = config.cardVariant;
|
|
212
|
+
$[38] = config.className;
|
|
213
|
+
$[39] = config.icon;
|
|
214
|
+
$[40] = isLoading;
|
|
215
|
+
$[41] = progressContent;
|
|
216
|
+
$[42] = t11;
|
|
217
|
+
$[43] = t12;
|
|
218
|
+
$[44] = t14;
|
|
219
|
+
$[45] = t15;
|
|
220
|
+
$[46] = title;
|
|
221
|
+
$[47] = t16;
|
|
222
|
+
} else t16 = $[47];
|
|
223
|
+
return t16;
|
|
197
224
|
}
|
|
198
225
|
|
|
199
226
|
//#endregion
|