@questpie/admin 3.0.3 → 3.0.4
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-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 +2 -2
- 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 +12 -9
- 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 +251 -230
- package/dist/client/components/primitives/select-single.mjs +345 -290
- 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 +134 -96
- package/dist/client/components/widgets/progress-widget.mjs +59 -34
- package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
- package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
- package/dist/client/components/widgets/stats-widget.mjs +91 -72
- package/dist/client/components/widgets/table-widget.mjs +159 -246
- package/dist/client/components/widgets/timeline-widget.mjs +66 -43
- package/dist/client/components/widgets/value-widget.mjs +261 -152
- 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 +59 -40
- 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-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/auth-layout.d.mts +18 -11
- 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 +1162 -229
- 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 +149 -172
- package/dist/client/views/layout/admin-router.mjs +747 -544
- package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
- package/dist/client/views/layout/admin-sidebar.mjs +751 -591
- 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 +1 -1
- 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 +3 -20
- 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 +17 -1
- package/dist/server/i18n/messages/cs.mjs +23 -0
- package/dist/server/i18n/messages/de.mjs +23 -0
- package/dist/server/i18n/messages/en.mjs +64 -1
- package/dist/server/i18n/messages/es.mjs +23 -0
- package/dist/server/i18n/messages/fr.mjs +23 -0
- package/dist/server/i18n/messages/pl.mjs +23 -0
- package/dist/server/i18n/messages/pt.mjs +23 -0
- package/dist/server/i18n/messages/sk.mjs +83 -1
- 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 +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- 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 +68 -68
- 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 +12 -0
- package/dist/server/modules/admin/collections/user.mjs +40 -9
- package/dist/server/modules/admin/collections/verification.d.mts +2 -2
- 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 +33 -0
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +10 -10
- package/dist/server/modules/admin/routes/setup.mjs +7 -7
- 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/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- 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,160 +1,511 @@
|
|
|
1
|
-
import { useTranslation } from "../i18n/hooks.mjs";
|
|
1
|
+
import { useResolveText, useTranslation } from "../i18n/hooks.mjs";
|
|
2
|
+
import { cn, formatLabel } from "../lib/utils.mjs";
|
|
2
3
|
import { Button } from "./ui/button.mjs";
|
|
3
4
|
import { Badge } from "./ui/badge.mjs";
|
|
4
5
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./ui/sheet.mjs";
|
|
5
|
-
import {
|
|
6
|
+
import { Separator } from "./ui/separator.mjs";
|
|
7
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./ui/accordion.mjs";
|
|
8
|
+
import { Skeleton } from "./ui/skeleton.mjs";
|
|
9
|
+
import { EmptyState } from "./ui/empty-state.mjs";
|
|
10
|
+
import { ScrollFade } from "./ui/scroll-fade.mjs";
|
|
6
11
|
import { c } from "react/compiler-runtime";
|
|
7
12
|
import { Icon } from "@iconify/react";
|
|
8
|
-
import
|
|
13
|
+
import "react";
|
|
9
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
15
|
|
|
11
16
|
//#region src/client/components/history-sidebar.tsx
|
|
12
|
-
|
|
17
|
+
const VERSION_META_KEYS = new Set([
|
|
18
|
+
"id",
|
|
19
|
+
"versionId",
|
|
20
|
+
"versionNumber",
|
|
21
|
+
"versionOperation",
|
|
22
|
+
"versionStage",
|
|
23
|
+
"versionFromStage",
|
|
24
|
+
"versionUserId",
|
|
25
|
+
"versionCreatedAt"
|
|
26
|
+
]);
|
|
27
|
+
function formatRelativeTime(date, locale) {
|
|
13
28
|
const diff = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
|
|
14
|
-
const
|
|
15
|
-
const minutes = Math.floor(
|
|
29
|
+
const absSeconds = Math.max(0, Math.floor(Math.abs(diff) / 1e3));
|
|
30
|
+
const minutes = Math.floor(absSeconds / 60);
|
|
16
31
|
const hours = Math.floor(minutes / 60);
|
|
17
32
|
const days = Math.floor(hours / 24);
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
33
|
+
const formatter = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
34
|
+
if (days > 0) return formatter.format(-days, "day");
|
|
35
|
+
if (hours > 0) return formatter.format(-hours, "hour");
|
|
36
|
+
if (minutes > 0) return formatter.format(-minutes, "minute");
|
|
37
|
+
return formatter.format(0, "second");
|
|
22
38
|
}
|
|
23
39
|
function getActionConfig(action) {
|
|
24
40
|
switch (action) {
|
|
25
41
|
case "create": return {
|
|
42
|
+
badge: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
|
26
43
|
color: "bg-emerald-500",
|
|
27
|
-
icon: "ph:plus"
|
|
28
|
-
variant: "success"
|
|
44
|
+
icon: "ph:plus"
|
|
29
45
|
};
|
|
30
46
|
case "update": return {
|
|
47
|
+
badge: "border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",
|
|
31
48
|
color: "bg-blue-500",
|
|
32
|
-
icon: "ph:pencil-simple"
|
|
33
|
-
variant: "info"
|
|
49
|
+
icon: "ph:pencil-simple"
|
|
34
50
|
};
|
|
35
51
|
case "delete": return {
|
|
52
|
+
badge: "border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300",
|
|
36
53
|
color: "bg-red-500",
|
|
37
|
-
icon: "ph:trash"
|
|
38
|
-
variant: "error"
|
|
54
|
+
icon: "ph:trash"
|
|
39
55
|
};
|
|
40
56
|
case "transition": return {
|
|
57
|
+
badge: "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
41
58
|
color: "bg-amber-500",
|
|
42
|
-
icon: "ph:arrows-left-right"
|
|
43
|
-
variant: "warning"
|
|
59
|
+
icon: "ph:arrows-left-right"
|
|
44
60
|
};
|
|
45
61
|
default: return {
|
|
62
|
+
badge: "border-border bg-muted text-muted-foreground",
|
|
46
63
|
color: "bg-gray-500",
|
|
47
|
-
icon: "ph:clock-counter-clockwise"
|
|
48
|
-
variant: "default"
|
|
64
|
+
icon: "ph:clock-counter-clockwise"
|
|
49
65
|
};
|
|
50
66
|
}
|
|
51
67
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
function isObjectRecord(value) {
|
|
69
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
70
|
+
}
|
|
71
|
+
function normalizeForCompare(value) {
|
|
72
|
+
if (value instanceof Date) return value.toISOString();
|
|
73
|
+
if (Array.isArray(value)) return value.map(normalizeForCompare);
|
|
74
|
+
if (isObjectRecord(value)) {
|
|
75
|
+
const sorted = {};
|
|
76
|
+
for (const key of Object.keys(value).sort()) sorted[key] = normalizeForCompare(value[key]);
|
|
77
|
+
return sorted;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
function stringifyComparable(value) {
|
|
82
|
+
try {
|
|
83
|
+
return JSON.stringify(normalizeForCompare(value));
|
|
58
84
|
} catch {
|
|
59
85
|
return String(value);
|
|
60
86
|
}
|
|
61
|
-
const str = String(value);
|
|
62
|
-
return str.length > 120 ? `${str.slice(0, 120)}…` : str;
|
|
63
87
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
function valuesEqual(a, b) {
|
|
89
|
+
return stringifyComparable(a) === stringifyComparable(b);
|
|
90
|
+
}
|
|
91
|
+
function isEmptyValue(value) {
|
|
92
|
+
if (value === null || value === void 0 || value === "") return true;
|
|
93
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
94
|
+
if (isObjectRecord(value)) return Object.keys(value).length === 0;
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
function toPrettyJson(value) {
|
|
98
|
+
try {
|
|
99
|
+
return JSON.stringify(value, null, 2);
|
|
100
|
+
} catch {
|
|
101
|
+
return String(value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function summarizeObject(value) {
|
|
105
|
+
for (const key of [
|
|
106
|
+
"_title",
|
|
107
|
+
"title",
|
|
108
|
+
"name",
|
|
109
|
+
"label",
|
|
110
|
+
"email",
|
|
111
|
+
"filename",
|
|
112
|
+
"id"
|
|
113
|
+
]) {
|
|
114
|
+
const candidate = value[key];
|
|
115
|
+
if (typeof candidate === "string" || typeof candidate === "number" || typeof candidate === "boolean") return String(candidate);
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function extractRichText(value) {
|
|
120
|
+
const parts = [];
|
|
121
|
+
function visit(node) {
|
|
122
|
+
if (parts.join(" ").length > 180) return;
|
|
123
|
+
if (Array.isArray(node)) {
|
|
124
|
+
for (const child of node) visit(child);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!isObjectRecord(node)) return;
|
|
128
|
+
const text = node.text;
|
|
129
|
+
if (typeof text === "string" && text.trim()) parts.push(text.trim());
|
|
130
|
+
if ("content" in node) visit(node.content);
|
|
131
|
+
}
|
|
132
|
+
visit(value);
|
|
133
|
+
const summary = parts.join(" ").replace(/\s+/g, " ").trim();
|
|
134
|
+
return summary ? truncate(summary, 180) : null;
|
|
135
|
+
}
|
|
136
|
+
function summarizeObjectArray(value) {
|
|
137
|
+
const labels = value.map((item) => isObjectRecord(item) ? summarizeObject(item) : null).filter((item) => !!item);
|
|
138
|
+
if (labels.length === 0) return null;
|
|
139
|
+
return labels.length === value.length ? truncate(labels.join(", "), 180) : null;
|
|
140
|
+
}
|
|
141
|
+
function summarizeBlocks(value) {
|
|
142
|
+
const blockNames = value.map((item) => {
|
|
143
|
+
if (!isObjectRecord(item)) return null;
|
|
144
|
+
const type = item.blockType ?? item.block ?? item.type ?? item._type ?? item.name;
|
|
145
|
+
return typeof type === "string" ? formatLabel(type) : null;
|
|
146
|
+
}).filter((item) => !!item);
|
|
147
|
+
if (blockNames.length === 0) return null;
|
|
148
|
+
return truncate([...new Set(blockNames)].join(", "), 180);
|
|
149
|
+
}
|
|
150
|
+
function truncate(value, max = 160) {
|
|
151
|
+
return value.length > max ? `${value.slice(0, max)}...` : value;
|
|
152
|
+
}
|
|
153
|
+
function resolveSelectValue({ field, value, resolveText }) {
|
|
154
|
+
const options = field?.metadata?.options;
|
|
155
|
+
if (!Array.isArray(options)) return null;
|
|
156
|
+
return (Array.isArray(value) ? value : [value]).map((item) => {
|
|
157
|
+
const option = options.find((candidate) => valuesEqual(candidate.value, item));
|
|
158
|
+
return option ? resolveText(option.label, String(option.value)) : String(item);
|
|
159
|
+
}).join(", ");
|
|
160
|
+
}
|
|
161
|
+
function formatFieldValue({ field, value, t, resolveText }) {
|
|
162
|
+
if (isEmptyValue(value)) return { summary: "-" };
|
|
163
|
+
const type = field?.metadata?.type;
|
|
164
|
+
if (type === "select") {
|
|
165
|
+
const selectLabel = resolveSelectValue({
|
|
166
|
+
field,
|
|
167
|
+
value,
|
|
168
|
+
resolveText
|
|
169
|
+
});
|
|
170
|
+
if (selectLabel) return { summary: selectLabel };
|
|
171
|
+
}
|
|
172
|
+
if (value instanceof Date) return { summary: value.toLocaleString() };
|
|
173
|
+
if (typeof value === "boolean") return { summary: value ? t("common.yes") : t("common.no") };
|
|
174
|
+
if (typeof value === "number") return { summary: String(value) };
|
|
175
|
+
if (typeof value === "string") {
|
|
176
|
+
if (type === "date" || type === "datetime" || type === "time") {
|
|
177
|
+
const date = new Date(value);
|
|
178
|
+
if (!Number.isNaN(date.getTime())) return { summary: date.toLocaleString() };
|
|
179
|
+
}
|
|
180
|
+
return value.length > 160 ? {
|
|
181
|
+
summary: truncate(value),
|
|
182
|
+
detail: value
|
|
183
|
+
} : { summary: value };
|
|
184
|
+
}
|
|
185
|
+
if (Array.isArray(value)) {
|
|
186
|
+
if (value.length === 0) return { summary: "-" };
|
|
187
|
+
if (value.every((item) => !isObjectRecord(item) && !Array.isArray(item))) {
|
|
188
|
+
const summary = value.map((item) => String(item)).join(", ");
|
|
189
|
+
return summary.length > 160 ? {
|
|
190
|
+
summary: truncate(summary),
|
|
191
|
+
detail: toPrettyJson(value)
|
|
192
|
+
} : { summary };
|
|
193
|
+
}
|
|
194
|
+
const objectSummary = summarizeObjectArray(value);
|
|
195
|
+
if (objectSummary) return {
|
|
196
|
+
summary: objectSummary,
|
|
197
|
+
detail: toPrettyJson(value)
|
|
198
|
+
};
|
|
199
|
+
const blockSummary = type === "blocks" ? summarizeBlocks(value) : null;
|
|
200
|
+
return {
|
|
201
|
+
summary: type === "blocks" && blockSummary ? `${t("history.blocksCount", { count: value.length })}: ${blockSummary}` : type === "blocks" ? t("history.blocksCount", { count: value.length }) : t("history.itemsCount", { count: value.length }),
|
|
202
|
+
detail: toPrettyJson(value)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (typeof value === "object") {
|
|
206
|
+
if (type === "richText") {
|
|
207
|
+
const richTextSummary = extractRichText(value);
|
|
208
|
+
if (richTextSummary) return {
|
|
209
|
+
summary: richTextSummary,
|
|
210
|
+
detail: toPrettyJson(value)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const record = value;
|
|
214
|
+
const objectSummary = summarizeObject(record);
|
|
215
|
+
if (objectSummary) return {
|
|
216
|
+
summary: objectSummary,
|
|
217
|
+
detail: toPrettyJson(value)
|
|
218
|
+
};
|
|
219
|
+
return {
|
|
220
|
+
summary: t("history.objectWithKeys", { count: Object.keys(record).length }),
|
|
221
|
+
detail: toPrettyJson(value)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return { summary: String(value) };
|
|
225
|
+
}
|
|
226
|
+
function ValuePreview(t0) {
|
|
227
|
+
const $ = c(12);
|
|
228
|
+
const { field, value, t, resolveText } = t0;
|
|
229
|
+
let t1;
|
|
230
|
+
if ($[0] !== field || $[1] !== resolveText || $[2] !== t || $[3] !== value) {
|
|
231
|
+
t1 = formatFieldValue({
|
|
232
|
+
field,
|
|
233
|
+
value,
|
|
234
|
+
t,
|
|
235
|
+
resolveText
|
|
236
|
+
});
|
|
237
|
+
$[0] = field;
|
|
238
|
+
$[1] = resolveText;
|
|
239
|
+
$[2] = t;
|
|
240
|
+
$[3] = value;
|
|
241
|
+
$[4] = t1;
|
|
242
|
+
} else t1 = $[4];
|
|
243
|
+
const formatted = t1;
|
|
244
|
+
let t2;
|
|
245
|
+
if ($[5] !== formatted.summary) {
|
|
246
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
247
|
+
className: "text-foreground text-xs leading-relaxed text-pretty break-words",
|
|
248
|
+
children: formatted.summary
|
|
249
|
+
});
|
|
250
|
+
$[5] = formatted.summary;
|
|
251
|
+
$[6] = t2;
|
|
252
|
+
} else t2 = $[6];
|
|
253
|
+
let t3;
|
|
254
|
+
if ($[7] !== formatted.detail) {
|
|
255
|
+
t3 = formatted.detail && /* @__PURE__ */ jsx(ScrollFade, {
|
|
256
|
+
orientation: "both",
|
|
257
|
+
fadeSize: 16,
|
|
258
|
+
children: /* @__PURE__ */ jsx("pre", {
|
|
259
|
+
"data-scroll-fade-target": true,
|
|
260
|
+
className: "control-surface text-muted-foreground h-auto max-h-36 overflow-auto p-2 font-mono text-[0.6875rem] leading-relaxed whitespace-pre-wrap",
|
|
261
|
+
children: formatted.detail
|
|
262
|
+
})
|
|
263
|
+
});
|
|
264
|
+
$[7] = formatted.detail;
|
|
265
|
+
$[8] = t3;
|
|
266
|
+
} else t3 = $[8];
|
|
267
|
+
let t4;
|
|
268
|
+
if ($[9] !== t2 || $[10] !== t3) {
|
|
269
|
+
t4 = /* @__PURE__ */ jsxs("div", {
|
|
270
|
+
className: "min-w-0 space-y-2",
|
|
271
|
+
children: [t2, t3]
|
|
272
|
+
});
|
|
273
|
+
$[9] = t2;
|
|
274
|
+
$[10] = t3;
|
|
275
|
+
$[11] = t4;
|
|
276
|
+
} else t4 = $[11];
|
|
277
|
+
return t4;
|
|
278
|
+
}
|
|
279
|
+
function getDiffKind(from, to) {
|
|
280
|
+
if (isEmptyValue(from) && !isEmptyValue(to)) return "added";
|
|
281
|
+
if (!isEmptyValue(from) && isEmptyValue(to)) return "removed";
|
|
282
|
+
return "changed";
|
|
283
|
+
}
|
|
284
|
+
function getDiffKindConfig(kind) {
|
|
285
|
+
switch (kind) {
|
|
286
|
+
case "added": return {
|
|
287
|
+
icon: "ph:plus",
|
|
288
|
+
labelKey: "history.changeAdded",
|
|
289
|
+
className: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"
|
|
290
|
+
};
|
|
291
|
+
case "removed": return {
|
|
292
|
+
icon: "ph:minus",
|
|
293
|
+
labelKey: "history.changeRemoved",
|
|
294
|
+
className: "border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300"
|
|
295
|
+
};
|
|
296
|
+
default: return {
|
|
297
|
+
icon: "ph:arrows-left-right",
|
|
298
|
+
labelKey: "history.changeChanged",
|
|
299
|
+
className: "border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300"
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function VersionDiffPanel(t0) {
|
|
304
|
+
const $ = c(24);
|
|
305
|
+
const { previousVersion, changes, fields } = t0;
|
|
67
306
|
const { t } = useTranslation();
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
|
|
307
|
+
const resolveText = useResolveText();
|
|
308
|
+
const previousNumber = previousVersion?.versionNumber;
|
|
309
|
+
if (changes.length === 0) {
|
|
310
|
+
let t1$1;
|
|
311
|
+
if ($[0] !== t) {
|
|
312
|
+
t1$1 = t("history.noFieldChanges");
|
|
313
|
+
$[0] = t;
|
|
314
|
+
$[1] = t1$1;
|
|
315
|
+
} else t1$1 = $[1];
|
|
316
|
+
let t2$1;
|
|
317
|
+
if ($[2] !== t1$1) {
|
|
318
|
+
t2$1 = /* @__PURE__ */ jsx(EmptyState, {
|
|
319
|
+
title: t1$1,
|
|
320
|
+
iconName: "ph:git-diff",
|
|
321
|
+
height: "h-32",
|
|
322
|
+
className: "panel-surface"
|
|
323
|
+
});
|
|
324
|
+
$[2] = t1$1;
|
|
325
|
+
$[3] = t2$1;
|
|
326
|
+
} else t2$1 = $[3];
|
|
327
|
+
return t2$1;
|
|
328
|
+
}
|
|
329
|
+
let t1;
|
|
330
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
331
|
+
t1 = /* @__PURE__ */ jsx(Icon, {
|
|
332
|
+
icon: "ph:git-diff",
|
|
333
|
+
className: "size-3.5"
|
|
334
|
+
});
|
|
335
|
+
$[4] = t1;
|
|
336
|
+
} else t1 = $[4];
|
|
72
337
|
let t2;
|
|
73
|
-
if ($[
|
|
74
|
-
t2 = ()
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
|
|
78
|
-
|
|
338
|
+
if ($[5] !== previousNumber || $[6] !== t) {
|
|
339
|
+
t2 = previousNumber ? t("history.diffAgainstVersion", { number: previousNumber }) : t("history.initialSnapshot");
|
|
340
|
+
$[5] = previousNumber;
|
|
341
|
+
$[6] = t;
|
|
342
|
+
$[7] = t2;
|
|
343
|
+
} else t2 = $[7];
|
|
344
|
+
let t3;
|
|
345
|
+
if ($[8] !== t2) {
|
|
346
|
+
t3 = /* @__PURE__ */ jsxs("div", {
|
|
347
|
+
className: "text-muted-foreground flex items-center gap-2 text-xs text-pretty",
|
|
348
|
+
children: [t1, /* @__PURE__ */ jsx("span", { children: t2 })]
|
|
349
|
+
});
|
|
350
|
+
$[8] = t2;
|
|
351
|
+
$[9] = t3;
|
|
352
|
+
} else t3 = $[9];
|
|
79
353
|
let t4;
|
|
80
|
-
if ($[
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
354
|
+
if ($[10] !== changes || $[11] !== fields || $[12] !== resolveText || $[13] !== t) {
|
|
355
|
+
let t5$1;
|
|
356
|
+
if ($[15] !== fields || $[16] !== resolveText || $[17] !== t) {
|
|
357
|
+
t5$1 = (change) => {
|
|
358
|
+
const field = fields?.[change.name];
|
|
359
|
+
const kind = getDiffKindConfig(change.kind);
|
|
360
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
361
|
+
className: "item-surface border-border-subtle bg-surface-low px-3 py-3",
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ jsxs("div", {
|
|
364
|
+
className: "flex items-start justify-between gap-3",
|
|
365
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
366
|
+
className: "min-w-0",
|
|
367
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
368
|
+
className: "text-foreground truncate text-sm font-medium text-balance",
|
|
369
|
+
children: change.label
|
|
370
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
371
|
+
className: "text-muted-foreground font-mono text-[0.6875rem]",
|
|
372
|
+
children: change.name
|
|
373
|
+
})]
|
|
374
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
375
|
+
className: "flex shrink-0 flex-wrap justify-end gap-1.5",
|
|
376
|
+
children: [/* @__PURE__ */ jsxs(Badge, {
|
|
377
|
+
variant: "outline",
|
|
378
|
+
className: cn(kind.className),
|
|
379
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
380
|
+
icon: kind.icon,
|
|
381
|
+
className: "size-2.5"
|
|
382
|
+
}), t(kind.labelKey)]
|
|
383
|
+
}), /* @__PURE__ */ jsx(Badge, {
|
|
384
|
+
variant: "outline",
|
|
385
|
+
children: change.type
|
|
386
|
+
})]
|
|
387
|
+
})]
|
|
388
|
+
}),
|
|
389
|
+
/* @__PURE__ */ jsx(Separator, { className: "my-3" }),
|
|
390
|
+
/* @__PURE__ */ jsxs("div", {
|
|
391
|
+
className: "grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]",
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ jsxs("div", {
|
|
394
|
+
className: "min-w-0",
|
|
395
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
396
|
+
className: "text-muted-foreground mb-2 flex items-center gap-1.5 text-[0.6875rem] font-medium uppercase",
|
|
397
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
398
|
+
icon: "ph:minus",
|
|
399
|
+
className: "size-3"
|
|
400
|
+
}), t("history.before")]
|
|
401
|
+
}), /* @__PURE__ */ jsx(ValuePreview, {
|
|
402
|
+
field,
|
|
403
|
+
value: change.from,
|
|
404
|
+
t,
|
|
405
|
+
resolveText
|
|
406
|
+
})]
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
409
|
+
orientation: "vertical",
|
|
410
|
+
className: "hidden sm:block",
|
|
411
|
+
"aria-hidden": true
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
414
|
+
className: "sm:hidden",
|
|
415
|
+
"aria-hidden": true
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ jsxs("div", {
|
|
418
|
+
className: "min-w-0",
|
|
419
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
420
|
+
className: "text-muted-foreground mb-2 flex items-center gap-1.5 text-[0.6875rem] font-medium uppercase",
|
|
421
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
422
|
+
icon: "ph:plus",
|
|
423
|
+
className: "size-3"
|
|
424
|
+
}), t("history.after")]
|
|
425
|
+
}), /* @__PURE__ */ jsx(ValuePreview, {
|
|
426
|
+
field,
|
|
427
|
+
value: change.to,
|
|
428
|
+
t,
|
|
429
|
+
resolveText
|
|
430
|
+
})]
|
|
431
|
+
})
|
|
432
|
+
]
|
|
433
|
+
})
|
|
434
|
+
]
|
|
435
|
+
}, change.name);
|
|
436
|
+
};
|
|
437
|
+
$[15] = fields;
|
|
438
|
+
$[16] = resolveText;
|
|
439
|
+
$[17] = t;
|
|
440
|
+
$[18] = t5$1;
|
|
441
|
+
} else t5$1 = $[18];
|
|
442
|
+
t4 = changes.map(t5$1);
|
|
443
|
+
$[10] = changes;
|
|
444
|
+
$[11] = fields;
|
|
445
|
+
$[12] = resolveText;
|
|
446
|
+
$[13] = t;
|
|
447
|
+
$[14] = t4;
|
|
448
|
+
} else t4 = $[14];
|
|
449
|
+
let t5;
|
|
450
|
+
if ($[19] !== t4) {
|
|
451
|
+
t5 = /* @__PURE__ */ jsx("div", {
|
|
452
|
+
className: "space-y-2",
|
|
453
|
+
children: t4
|
|
84
454
|
});
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
} else
|
|
88
|
-
const t5 = expanded ? t("history.hideChanges") : t("history.showChanges", { count: entries.length });
|
|
455
|
+
$[19] = t4;
|
|
456
|
+
$[20] = t5;
|
|
457
|
+
} else t5 = $[20];
|
|
89
458
|
let t6;
|
|
90
|
-
if ($[
|
|
91
|
-
t6 = /* @__PURE__ */ jsxs("
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onClick: t2,
|
|
95
|
-
children: [t4, t5]
|
|
459
|
+
if ($[21] !== t3 || $[22] !== t5) {
|
|
460
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
461
|
+
className: "space-y-3",
|
|
462
|
+
children: [t3, t5]
|
|
96
463
|
});
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
464
|
+
$[21] = t3;
|
|
465
|
+
$[22] = t5;
|
|
466
|
+
$[23] = t6;
|
|
467
|
+
} else t6 = $[23];
|
|
468
|
+
return t6;
|
|
469
|
+
}
|
|
470
|
+
function HistoryListSkeleton(t0) {
|
|
471
|
+
const $ = c(2);
|
|
472
|
+
const { rows: t1 } = t0;
|
|
473
|
+
const rows = t1 === void 0 ? 4 : t1;
|
|
474
|
+
let t2;
|
|
475
|
+
if ($[0] !== rows) {
|
|
476
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
477
|
+
className: "space-y-4 py-2",
|
|
478
|
+
"aria-busy": "true",
|
|
479
|
+
children: Array.from({ length: rows }, _temp)
|
|
111
480
|
});
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return t8;
|
|
481
|
+
$[0] = rows;
|
|
482
|
+
$[1] = t2;
|
|
483
|
+
} else t2 = $[1];
|
|
484
|
+
return t2;
|
|
117
485
|
}
|
|
118
|
-
function _temp(
|
|
119
|
-
const [field, t1] = t0;
|
|
120
|
-
const { from, to } = t1;
|
|
486
|
+
function _temp(_, index) {
|
|
121
487
|
return /* @__PURE__ */ jsxs("div", {
|
|
122
|
-
className: "
|
|
123
|
-
children: [/* @__PURE__ */ jsx("
|
|
124
|
-
className: "
|
|
125
|
-
children:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
className: "opacity-50",
|
|
132
|
-
children: "- "
|
|
133
|
-
}), formatChangeValue(from)]
|
|
134
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
135
|
-
className: "text-emerald-600 dark:text-emerald-400",
|
|
136
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
137
|
-
className: "opacity-50",
|
|
138
|
-
children: "+ "
|
|
139
|
-
}), formatChangeValue(to)]
|
|
488
|
+
className: "flex gap-3",
|
|
489
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "mt-1 size-7 shrink-0 rounded-full" }), /* @__PURE__ */ jsxs("div", {
|
|
490
|
+
className: "min-w-0 flex-1 space-y-2",
|
|
491
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
492
|
+
variant: "text",
|
|
493
|
+
className: "h-4 w-28"
|
|
494
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
495
|
+
variant: "text",
|
|
496
|
+
className: "h-3 w-40"
|
|
140
497
|
})]
|
|
141
498
|
})]
|
|
142
|
-
},
|
|
499
|
+
}, index);
|
|
143
500
|
}
|
|
144
501
|
function ActivityTimeline(t0) {
|
|
145
|
-
const $ = c(
|
|
502
|
+
const $ = c(13);
|
|
146
503
|
const { entries, isLoading } = t0;
|
|
147
|
-
const { t } = useTranslation();
|
|
504
|
+
const { locale, t } = useTranslation();
|
|
148
505
|
if (isLoading) {
|
|
149
506
|
let t1$1;
|
|
150
507
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
151
|
-
t1$1 = /* @__PURE__ */ jsx(
|
|
152
|
-
className: "text-muted-foreground flex items-center justify-center py-12",
|
|
153
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
154
|
-
icon: "ph:spinner-gap",
|
|
155
|
-
className: "size-5 animate-spin"
|
|
156
|
-
})
|
|
157
|
-
});
|
|
508
|
+
t1$1 = /* @__PURE__ */ jsx(HistoryListSkeleton, {});
|
|
158
509
|
$[0] = t1$1;
|
|
159
510
|
} else t1$1 = $[0];
|
|
160
511
|
return t1$1;
|
|
@@ -168,9 +519,10 @@ function ActivityTimeline(t0) {
|
|
|
168
519
|
} else t1$1 = $[2];
|
|
169
520
|
let t2$1;
|
|
170
521
|
if ($[3] !== t1$1) {
|
|
171
|
-
t2$1 = /* @__PURE__ */ jsx(
|
|
172
|
-
|
|
173
|
-
|
|
522
|
+
t2$1 = /* @__PURE__ */ jsx(EmptyState, {
|
|
523
|
+
title: t1$1,
|
|
524
|
+
iconName: "ph:clock-counter-clockwise",
|
|
525
|
+
height: "h-48"
|
|
174
526
|
});
|
|
175
527
|
$[3] = t1$1;
|
|
176
528
|
$[4] = t2$1;
|
|
@@ -178,9 +530,9 @@ function ActivityTimeline(t0) {
|
|
|
178
530
|
return t2$1;
|
|
179
531
|
}
|
|
180
532
|
let t1;
|
|
181
|
-
if ($[5] !== entries) {
|
|
533
|
+
if ($[5] !== entries || $[6] !== locale) {
|
|
182
534
|
let t2$1;
|
|
183
|
-
if ($[
|
|
535
|
+
if ($[8] !== entries.length || $[9] !== locale) {
|
|
184
536
|
t2$1 = (entry, index) => {
|
|
185
537
|
const config = getActionConfig(entry.action);
|
|
186
538
|
const date = new Date(entry.createdAt);
|
|
@@ -190,53 +542,112 @@ function ActivityTimeline(t0) {
|
|
|
190
542
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
191
543
|
className: "flex flex-col items-center",
|
|
192
544
|
children: [/* @__PURE__ */ jsx("div", { className: `mt-1.5 size-2.5 shrink-0 rounded-full ${config.color}` }), !isLast && /* @__PURE__ */ jsx("div", { className: "bg-border min-h-4 w-px flex-1" })]
|
|
193
|
-
}), /* @__PURE__ */
|
|
545
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
194
546
|
className: "min-w-0 flex-1 pb-4",
|
|
195
|
-
children:
|
|
547
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
196
548
|
className: "flex items-start justify-between gap-2",
|
|
197
549
|
children: [/* @__PURE__ */ jsx("p", {
|
|
198
550
|
className: "text-sm leading-snug",
|
|
199
551
|
children: entry.title
|
|
200
552
|
}), /* @__PURE__ */ jsx("span", {
|
|
201
553
|
className: "text-muted-foreground shrink-0 text-xs whitespace-nowrap",
|
|
202
|
-
children: formatRelativeTime(date)
|
|
554
|
+
children: formatRelativeTime(date, locale)
|
|
203
555
|
})]
|
|
204
|
-
})
|
|
556
|
+
})
|
|
205
557
|
})]
|
|
206
558
|
}, entry.id);
|
|
207
559
|
};
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
|
|
560
|
+
$[8] = entries.length;
|
|
561
|
+
$[9] = locale;
|
|
562
|
+
$[10] = t2$1;
|
|
563
|
+
} else t2$1 = $[10];
|
|
211
564
|
t1 = entries.map(t2$1);
|
|
212
565
|
$[5] = entries;
|
|
213
|
-
$[6] =
|
|
214
|
-
|
|
566
|
+
$[6] = locale;
|
|
567
|
+
$[7] = t1;
|
|
568
|
+
} else t1 = $[7];
|
|
215
569
|
let t2;
|
|
216
|
-
if ($[
|
|
570
|
+
if ($[11] !== t1) {
|
|
217
571
|
t2 = /* @__PURE__ */ jsx("div", {
|
|
218
572
|
className: "space-y-0",
|
|
219
573
|
children: t1
|
|
220
574
|
});
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
} else t2 = $[
|
|
575
|
+
$[11] = t1;
|
|
576
|
+
$[12] = t2;
|
|
577
|
+
} else t2 = $[12];
|
|
224
578
|
return t2;
|
|
225
579
|
}
|
|
226
580
|
function VersionsList(t0) {
|
|
227
|
-
const $ = c(
|
|
228
|
-
const { versions, isLoading, isReverting, onRevert } = t0;
|
|
229
|
-
const { t } = useTranslation();
|
|
581
|
+
const $ = c(41);
|
|
582
|
+
const { versions, fields, isLoading, isReverting, onRevert } = t0;
|
|
583
|
+
const { formatDate, locale, t } = useTranslation();
|
|
584
|
+
const resolveText = useResolveText();
|
|
230
585
|
let t1;
|
|
231
586
|
if ($[0] !== versions) {
|
|
232
587
|
t1 = [...versions].sort(_temp2);
|
|
233
588
|
$[0] = versions;
|
|
234
589
|
$[1] = t1;
|
|
235
590
|
} else t1 = $[1];
|
|
236
|
-
const
|
|
591
|
+
const sortedAscVersions = t1;
|
|
237
592
|
let t2;
|
|
238
|
-
if ($[2] !==
|
|
239
|
-
t2 =
|
|
593
|
+
if ($[2] !== sortedAscVersions) {
|
|
594
|
+
t2 = [...sortedAscVersions].sort(_temp3);
|
|
595
|
+
$[2] = sortedAscVersions;
|
|
596
|
+
$[3] = t2;
|
|
597
|
+
} else t2 = $[3];
|
|
598
|
+
const sortedVersions = t2;
|
|
599
|
+
let t3;
|
|
600
|
+
bb0: {
|
|
601
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
602
|
+
t3 = fields;
|
|
603
|
+
break bb0;
|
|
604
|
+
}
|
|
605
|
+
let inferred;
|
|
606
|
+
if ($[4] !== versions) {
|
|
607
|
+
inferred = {};
|
|
608
|
+
for (const version of versions) for (const key of Object.keys(version)) {
|
|
609
|
+
if (VERSION_META_KEYS.has(key)) continue;
|
|
610
|
+
inferred[key] = {
|
|
611
|
+
name: key,
|
|
612
|
+
metadata: {
|
|
613
|
+
type: "unknown",
|
|
614
|
+
label: formatLabel(key)
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
$[4] = versions;
|
|
619
|
+
$[5] = inferred;
|
|
620
|
+
} else inferred = $[5];
|
|
621
|
+
t3 = inferred;
|
|
622
|
+
}
|
|
623
|
+
const fieldsForDiff = t3;
|
|
624
|
+
let byKey;
|
|
625
|
+
if ($[6] !== fieldsForDiff || $[7] !== resolveText || $[8] !== sortedAscVersions) {
|
|
626
|
+
byKey = /* @__PURE__ */ new Map();
|
|
627
|
+
for (let index = 0; index < sortedAscVersions.length; index = index + 1) {
|
|
628
|
+
const version_0 = sortedAscVersions[index];
|
|
629
|
+
const previousVersion = sortedAscVersions[index - 1];
|
|
630
|
+
const key_0 = getVersionKey(version_0, index);
|
|
631
|
+
byKey.set(key_0, {
|
|
632
|
+
key: key_0,
|
|
633
|
+
previousVersion,
|
|
634
|
+
changes: buildVersionDiff({
|
|
635
|
+
version: version_0,
|
|
636
|
+
previousVersion,
|
|
637
|
+
fields: fieldsForDiff,
|
|
638
|
+
resolveText
|
|
639
|
+
})
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
$[6] = fieldsForDiff;
|
|
643
|
+
$[7] = resolveText;
|
|
644
|
+
$[8] = sortedAscVersions;
|
|
645
|
+
$[9] = byKey;
|
|
646
|
+
} else byKey = $[9];
|
|
647
|
+
const versionDetails = byKey;
|
|
648
|
+
let t4;
|
|
649
|
+
if ($[10] !== t) {
|
|
650
|
+
t4 = function operationLabel$1(operation) {
|
|
240
651
|
switch (operation) {
|
|
241
652
|
case "create": return t("version.operationCreate");
|
|
242
653
|
case "delete": return t("version.operationDelete");
|
|
@@ -244,252 +655,351 @@ function VersionsList(t0) {
|
|
|
244
655
|
default: return operation || t("version.operationUnknown");
|
|
245
656
|
}
|
|
246
657
|
};
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
} else
|
|
250
|
-
const operationLabel =
|
|
251
|
-
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
})
|
|
658
|
+
$[10] = t;
|
|
659
|
+
$[11] = t4;
|
|
660
|
+
} else t4 = $[11];
|
|
661
|
+
const operationLabel = t4;
|
|
662
|
+
let t5;
|
|
663
|
+
if ($[12] !== formatDate) {
|
|
664
|
+
t5 = (value) => {
|
|
665
|
+
if (!value) return "-";
|
|
666
|
+
const date = new Date(value);
|
|
667
|
+
if (Number.isNaN(date.getTime())) return "-";
|
|
668
|
+
return formatDate(date, {
|
|
669
|
+
dateStyle: "medium",
|
|
670
|
+
timeStyle: "short"
|
|
261
671
|
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
672
|
+
};
|
|
673
|
+
$[12] = formatDate;
|
|
674
|
+
$[13] = t5;
|
|
675
|
+
} else t5 = $[13];
|
|
676
|
+
const formatDateTime = t5;
|
|
677
|
+
if (isLoading) {
|
|
678
|
+
let t6$1;
|
|
679
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
680
|
+
t6$1 = /* @__PURE__ */ jsx(HistoryListSkeleton, {});
|
|
681
|
+
$[14] = t6$1;
|
|
682
|
+
} else t6$1 = $[14];
|
|
683
|
+
return t6$1;
|
|
265
684
|
}
|
|
266
685
|
if (sortedVersions.length === 0) {
|
|
267
|
-
let
|
|
268
|
-
if ($[
|
|
269
|
-
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
} else
|
|
273
|
-
let
|
|
274
|
-
if ($[
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
686
|
+
let t6$1;
|
|
687
|
+
if ($[15] !== t) {
|
|
688
|
+
t6$1 = t("version.empty");
|
|
689
|
+
$[15] = t;
|
|
690
|
+
$[16] = t6$1;
|
|
691
|
+
} else t6$1 = $[16];
|
|
692
|
+
let t7$1;
|
|
693
|
+
if ($[17] !== t6$1) {
|
|
694
|
+
t7$1 = /* @__PURE__ */ jsx(EmptyState, {
|
|
695
|
+
title: t6$1,
|
|
696
|
+
iconName: "ph:clock-counter-clockwise",
|
|
697
|
+
height: "h-48"
|
|
278
698
|
});
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
} else
|
|
282
|
-
return
|
|
699
|
+
$[17] = t6$1;
|
|
700
|
+
$[18] = t7$1;
|
|
701
|
+
} else t7$1 = $[18];
|
|
702
|
+
return t7$1;
|
|
283
703
|
}
|
|
284
|
-
let
|
|
285
|
-
if ($[
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
704
|
+
let t6;
|
|
705
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
706
|
+
t6 = [];
|
|
707
|
+
$[19] = t6;
|
|
708
|
+
} else t6 = $[19];
|
|
709
|
+
let t7;
|
|
710
|
+
if ($[20] !== fieldsForDiff || $[21] !== formatDateTime || $[22] !== isReverting || $[23] !== locale || $[24] !== onRevert || $[25] !== operationLabel || $[26] !== sortedVersions || $[27] !== t || $[28] !== versionDetails) {
|
|
711
|
+
let t8$1;
|
|
712
|
+
if ($[30] !== fieldsForDiff || $[31] !== formatDateTime || $[32] !== isReverting || $[33] !== locale || $[34] !== onRevert || $[35] !== operationLabel || $[36] !== t || $[37] !== versionDetails) {
|
|
713
|
+
t8$1 = (version_1, index_0) => {
|
|
714
|
+
const key_1 = getVersionKey(version_1, index_0);
|
|
715
|
+
const details = versionDetails.get(key_1);
|
|
716
|
+
const changes = details?.changes ?? [];
|
|
717
|
+
const visibleChangedFields = changes.slice(0, 3);
|
|
718
|
+
const remainingChangedFields = Math.max(0, changes.length - visibleChangedFields.length);
|
|
719
|
+
const changedPreview = visibleChangedFields.map(_temp4).join(", ");
|
|
720
|
+
const date_0 = version_1.versionCreatedAt ? new Date(version_1.versionCreatedAt) : null;
|
|
721
|
+
const canRevert = typeof version_1.versionId === "string" || typeof version_1.versionNumber === "number";
|
|
722
|
+
const action = getActionConfig(version_1.versionOperation ?? "");
|
|
723
|
+
return /* @__PURE__ */ jsxs(AccordionItem, {
|
|
724
|
+
value: key_1,
|
|
725
|
+
className: "px-0",
|
|
726
|
+
children: [/* @__PURE__ */ jsx(AccordionTrigger, {
|
|
727
|
+
className: "min-h-20 items-start px-3 py-3 hover:no-underline",
|
|
728
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
729
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
296
730
|
children: [
|
|
297
731
|
/* @__PURE__ */ jsxs("div", {
|
|
298
|
-
className: "flex items-center gap-2",
|
|
299
|
-
children: [/* @__PURE__ */ jsx(Badge, {
|
|
300
|
-
variant: "secondary",
|
|
301
|
-
children: t("version.label", { number: version.versionNumber ?? "-" })
|
|
302
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
303
|
-
className: "text-muted-foreground text-sm",
|
|
304
|
-
children: operationLabel(version.versionOperation)
|
|
305
|
-
})]
|
|
306
|
-
}),
|
|
307
|
-
/* @__PURE__ */ jsxs("p", {
|
|
308
|
-
className: "text-muted-foreground mt-1 text-xs",
|
|
732
|
+
className: "flex flex-wrap items-center gap-2",
|
|
309
733
|
children: [
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
734
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
735
|
+
variant: "secondary",
|
|
736
|
+
className: "tabular-nums",
|
|
737
|
+
children: t("version.label", { number: version_1.versionNumber ?? "-" })
|
|
738
|
+
}),
|
|
739
|
+
/* @__PURE__ */ jsxs(Badge, {
|
|
740
|
+
variant: "outline",
|
|
741
|
+
className: cn(action.badge),
|
|
742
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
743
|
+
icon: action.icon,
|
|
744
|
+
className: "size-2.5"
|
|
745
|
+
}), operationLabel(version_1.versionOperation)]
|
|
746
|
+
}),
|
|
747
|
+
version_1.versionStage && /* @__PURE__ */ jsxs(Badge, {
|
|
748
|
+
variant: "outline",
|
|
749
|
+
children: [
|
|
750
|
+
t("history.stage"),
|
|
751
|
+
": ",
|
|
752
|
+
version_1.versionStage
|
|
753
|
+
]
|
|
754
|
+
}),
|
|
755
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
756
|
+
variant: "outline",
|
|
757
|
+
className: "tabular-nums",
|
|
758
|
+
children: t("history.changedFields", { count: changes.length })
|
|
759
|
+
})
|
|
314
760
|
]
|
|
315
761
|
}),
|
|
316
|
-
/* @__PURE__ */ jsxs("
|
|
317
|
-
className: "text-muted-foreground text-xs",
|
|
762
|
+
/* @__PURE__ */ jsxs("div", {
|
|
763
|
+
className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",
|
|
318
764
|
children: [
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
765
|
+
/* @__PURE__ */ jsx("span", {
|
|
766
|
+
className: "tabular-nums",
|
|
767
|
+
children: date_0 ? formatDateTime(version_1.versionCreatedAt) : "-"
|
|
768
|
+
}),
|
|
769
|
+
date_0 && /* @__PURE__ */ jsx("span", {
|
|
770
|
+
className: "tabular-nums",
|
|
771
|
+
children: formatRelativeTime(date_0, locale)
|
|
772
|
+
}),
|
|
773
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
774
|
+
t("version.user"),
|
|
775
|
+
":",
|
|
776
|
+
" ",
|
|
777
|
+
version_1.versionUserId || t("history.systemUser")
|
|
778
|
+
] })
|
|
322
779
|
]
|
|
780
|
+
}),
|
|
781
|
+
/* @__PURE__ */ jsxs("p", {
|
|
782
|
+
className: "text-muted-foreground truncate text-xs text-pretty",
|
|
783
|
+
children: [changedPreview || t("history.noFieldChanges"), remainingChangedFields > 0 && ` + ${t("history.moreFields", { count: remainingChangedFields })}`]
|
|
323
784
|
})
|
|
324
785
|
]
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
786
|
+
})
|
|
787
|
+
}), /* @__PURE__ */ jsxs(AccordionContent, {
|
|
788
|
+
className: "px-3 pt-0 pb-3",
|
|
789
|
+
children: [
|
|
790
|
+
/* @__PURE__ */ jsx(Separator, { className: "mb-3" }),
|
|
791
|
+
/* @__PURE__ */ jsx("div", {
|
|
792
|
+
className: "space-y-3",
|
|
793
|
+
children: /* @__PURE__ */ jsx(VersionDiffPanel, {
|
|
794
|
+
previousVersion: details?.previousVersion,
|
|
795
|
+
changes,
|
|
796
|
+
fields: fieldsForDiff
|
|
797
|
+
})
|
|
798
|
+
}),
|
|
799
|
+
onRevert && /* @__PURE__ */ jsx("div", {
|
|
800
|
+
className: "mt-3 flex justify-end",
|
|
801
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
802
|
+
variant: "outline",
|
|
803
|
+
size: "sm",
|
|
804
|
+
disabled: !canRevert || isReverting,
|
|
805
|
+
onClick: () => {
|
|
806
|
+
onRevert(version_1);
|
|
807
|
+
},
|
|
808
|
+
children: t("version.revert")
|
|
809
|
+
})
|
|
810
|
+
})
|
|
811
|
+
]
|
|
812
|
+
})]
|
|
813
|
+
}, key_1);
|
|
336
814
|
};
|
|
337
|
-
$[
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
$
|
|
347
|
-
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
815
|
+
$[30] = fieldsForDiff;
|
|
816
|
+
$[31] = formatDateTime;
|
|
817
|
+
$[32] = isReverting;
|
|
818
|
+
$[33] = locale;
|
|
819
|
+
$[34] = onRevert;
|
|
820
|
+
$[35] = operationLabel;
|
|
821
|
+
$[36] = t;
|
|
822
|
+
$[37] = versionDetails;
|
|
823
|
+
$[38] = t8$1;
|
|
824
|
+
} else t8$1 = $[38];
|
|
825
|
+
t7 = sortedVersions.map(t8$1);
|
|
826
|
+
$[20] = fieldsForDiff;
|
|
827
|
+
$[21] = formatDateTime;
|
|
828
|
+
$[22] = isReverting;
|
|
829
|
+
$[23] = locale;
|
|
830
|
+
$[24] = onRevert;
|
|
831
|
+
$[25] = operationLabel;
|
|
832
|
+
$[26] = sortedVersions;
|
|
833
|
+
$[27] = t;
|
|
834
|
+
$[28] = versionDetails;
|
|
835
|
+
$[29] = t7;
|
|
836
|
+
} else t7 = $[29];
|
|
837
|
+
let t8;
|
|
838
|
+
if ($[39] !== t7) {
|
|
839
|
+
t8 = /* @__PURE__ */ jsx(Accordion, {
|
|
840
|
+
defaultValue: t6,
|
|
841
|
+
className: "panel-surface bg-card",
|
|
842
|
+
children: t7
|
|
356
843
|
});
|
|
357
|
-
$[
|
|
358
|
-
$[
|
|
359
|
-
} else
|
|
360
|
-
return
|
|
844
|
+
$[39] = t7;
|
|
845
|
+
$[40] = t8;
|
|
846
|
+
} else t8 = $[40];
|
|
847
|
+
return t8;
|
|
848
|
+
}
|
|
849
|
+
function _temp4(change) {
|
|
850
|
+
return change.label;
|
|
361
851
|
}
|
|
362
|
-
function _temp3(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (Number.isNaN(date.getTime())) return "-";
|
|
366
|
-
return date.toLocaleString();
|
|
852
|
+
function _temp3(a_0, b_0) {
|
|
853
|
+
const aNum_0 = a_0.versionNumber ?? 0;
|
|
854
|
+
return (b_0.versionNumber ?? 0) - aNum_0;
|
|
367
855
|
}
|
|
368
856
|
function _temp2(a, b) {
|
|
369
|
-
|
|
370
|
-
|
|
857
|
+
return (a.versionNumber ?? 0) - (b.versionNumber ?? 0);
|
|
858
|
+
}
|
|
859
|
+
function getVersionKey(version, index) {
|
|
860
|
+
if (version.versionId) return version.versionId;
|
|
861
|
+
if (typeof version.versionNumber === "number") return `version-${version.versionNumber}`;
|
|
862
|
+
return `version-${version.versionCreatedAt ?? index}`;
|
|
863
|
+
}
|
|
864
|
+
function shouldIncludeField(field) {
|
|
865
|
+
if (field?.metadata?.writeOnly) return false;
|
|
866
|
+
return field?.access?.read?.allowed !== false;
|
|
867
|
+
}
|
|
868
|
+
function buildVersionDiff({ version, previousVersion, fields, resolveText }) {
|
|
869
|
+
const changes = [];
|
|
870
|
+
for (const [name, field] of Object.entries(fields)) {
|
|
871
|
+
if (!shouldIncludeField(field)) continue;
|
|
872
|
+
const from = previousVersion?.[name];
|
|
873
|
+
const to = version[name];
|
|
874
|
+
if (valuesEqual(from, to)) continue;
|
|
875
|
+
if (!previousVersion && isEmptyValue(to)) continue;
|
|
876
|
+
changes.push({
|
|
877
|
+
name,
|
|
878
|
+
label: resolveText(field.metadata?.label, formatLabel(name)),
|
|
879
|
+
type: field.metadata?.type ?? "unknown",
|
|
880
|
+
kind: getDiffKind(from, to),
|
|
881
|
+
from,
|
|
882
|
+
to
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
return changes;
|
|
371
886
|
}
|
|
372
887
|
function HistorySidebar(t0) {
|
|
373
|
-
const $ = c(
|
|
374
|
-
const { open, onOpenChange, auditEntries, isLoadingAudit:
|
|
375
|
-
const isLoadingAudit = t1 === void 0 ? false : t1;
|
|
376
|
-
const isLoadingVersions = t2 === void 0 ? false : t2;
|
|
377
|
-
const isReverting = t3 === void 0 ? false : t3;
|
|
378
|
-
const showVersionsTab = t4 === void 0 ? false : t4;
|
|
379
|
-
const { t } = useTranslation();
|
|
380
|
-
let t5;
|
|
381
|
-
if ($[0] !== t) {
|
|
382
|
-
t5 = t("history.title");
|
|
383
|
-
$[0] = t;
|
|
384
|
-
$[1] = t5;
|
|
385
|
-
} else t5 = $[1];
|
|
888
|
+
const $ = c(31);
|
|
889
|
+
const { open, onOpenChange, auditEntries: t1, isLoadingAudit: t2, versions, fields, isLoadingVersions: t3, isReverting: t4, onRevert, showVersionsTab: t5 } = t0;
|
|
386
890
|
let t6;
|
|
387
|
-
if ($[
|
|
388
|
-
t6 =
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
391
|
-
} else t6 = $[
|
|
891
|
+
if ($[0] !== t1) {
|
|
892
|
+
t6 = t1 === void 0 ? [] : t1;
|
|
893
|
+
$[0] = t1;
|
|
894
|
+
$[1] = t6;
|
|
895
|
+
} else t6 = $[1];
|
|
896
|
+
const auditEntries = t6;
|
|
897
|
+
const isLoadingAudit = t2 === void 0 ? false : t2;
|
|
898
|
+
const isLoadingVersions = t3 === void 0 ? false : t3;
|
|
899
|
+
const isReverting = t4 === void 0 ? false : t4;
|
|
900
|
+
const showVersionsTab = t5 === void 0 ? false : t5;
|
|
901
|
+
const { t } = useTranslation();
|
|
392
902
|
let t7;
|
|
393
|
-
if ($[
|
|
394
|
-
t7 = t("history.
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
|
|
903
|
+
if ($[2] !== showVersionsTab || $[3] !== t) {
|
|
904
|
+
t7 = showVersionsTab ? t("version.history") : t("history.title");
|
|
905
|
+
$[2] = showVersionsTab;
|
|
906
|
+
$[3] = t;
|
|
907
|
+
$[4] = t7;
|
|
908
|
+
} else t7 = $[4];
|
|
398
909
|
let t8;
|
|
399
|
-
if ($[
|
|
400
|
-
t8 = /* @__PURE__ */ jsx(
|
|
401
|
-
$[
|
|
402
|
-
$[
|
|
403
|
-
} else t8 = $[
|
|
910
|
+
if ($[5] !== t7) {
|
|
911
|
+
t8 = /* @__PURE__ */ jsx(SheetTitle, { children: t7 });
|
|
912
|
+
$[5] = t7;
|
|
913
|
+
$[6] = t8;
|
|
914
|
+
} else t8 = $[6];
|
|
404
915
|
let t9;
|
|
405
|
-
if ($[
|
|
406
|
-
t9 =
|
|
916
|
+
if ($[7] !== showVersionsTab || $[8] !== t) {
|
|
917
|
+
t9 = showVersionsTab ? t("history.versionDescription") : t("history.description");
|
|
918
|
+
$[7] = showVersionsTab;
|
|
919
|
+
$[8] = t;
|
|
920
|
+
$[9] = t9;
|
|
921
|
+
} else t9 = $[9];
|
|
922
|
+
let t10;
|
|
923
|
+
if ($[10] !== t9) {
|
|
924
|
+
t10 = /* @__PURE__ */ jsx(SheetDescription, { children: t9 });
|
|
925
|
+
$[10] = t9;
|
|
926
|
+
$[11] = t10;
|
|
927
|
+
} else t10 = $[11];
|
|
928
|
+
let t11;
|
|
929
|
+
if ($[12] !== t10 || $[13] !== t8) {
|
|
930
|
+
t11 = /* @__PURE__ */ jsxs(SheetHeader, {
|
|
407
931
|
className: "border-b px-6 py-5",
|
|
408
|
-
children: [
|
|
932
|
+
children: [t8, t10]
|
|
409
933
|
});
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
413
|
-
} else
|
|
414
|
-
let
|
|
415
|
-
if ($[
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
className: "
|
|
419
|
-
children:
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
})
|
|
440
|
-
}),
|
|
441
|
-
/* @__PURE__ */ jsx(TabsContent, {
|
|
442
|
-
value: "versions",
|
|
443
|
-
className: "flex-1 overflow-y-auto px-6 py-4",
|
|
444
|
-
children: /* @__PURE__ */ jsx(VersionsList, {
|
|
445
|
-
versions: versions ?? [],
|
|
446
|
-
isLoading: isLoadingVersions,
|
|
447
|
-
isReverting,
|
|
448
|
-
onRevert
|
|
449
|
-
})
|
|
934
|
+
$[12] = t10;
|
|
935
|
+
$[13] = t8;
|
|
936
|
+
$[14] = t11;
|
|
937
|
+
} else t11 = $[14];
|
|
938
|
+
let t12;
|
|
939
|
+
if ($[15] !== auditEntries || $[16] !== fields || $[17] !== isLoadingAudit || $[18] !== isLoadingVersions || $[19] !== isReverting || $[20] !== onRevert || $[21] !== showVersionsTab || $[22] !== versions) {
|
|
940
|
+
t12 = showVersionsTab ? /* @__PURE__ */ jsx(ScrollFade, {
|
|
941
|
+
orientation: "vertical",
|
|
942
|
+
className: "min-h-0 flex-1",
|
|
943
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
944
|
+
"data-scroll-fade-target": true,
|
|
945
|
+
className: "h-full overflow-y-auto px-6 py-4",
|
|
946
|
+
children: /* @__PURE__ */ jsx(VersionsList, {
|
|
947
|
+
versions: versions ?? [],
|
|
948
|
+
fields,
|
|
949
|
+
isLoading: isLoadingVersions,
|
|
950
|
+
isReverting,
|
|
951
|
+
onRevert
|
|
952
|
+
})
|
|
953
|
+
})
|
|
954
|
+
}) : /* @__PURE__ */ jsx(ScrollFade, {
|
|
955
|
+
orientation: "vertical",
|
|
956
|
+
className: "min-h-0 flex-1",
|
|
957
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
958
|
+
"data-scroll-fade-target": true,
|
|
959
|
+
className: "h-full overflow-y-auto px-6 py-4",
|
|
960
|
+
children: /* @__PURE__ */ jsx(ActivityTimeline, {
|
|
961
|
+
entries: auditEntries,
|
|
962
|
+
isLoading: isLoadingAudit
|
|
450
963
|
})
|
|
451
|
-
]
|
|
452
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
453
|
-
className: "flex-1 overflow-y-auto px-6 py-4",
|
|
454
|
-
children: /* @__PURE__ */ jsx(ActivityTimeline, {
|
|
455
|
-
entries: auditEntries,
|
|
456
|
-
isLoading: isLoadingAudit
|
|
457
964
|
})
|
|
458
965
|
});
|
|
459
|
-
$[
|
|
460
|
-
$[
|
|
461
|
-
$[
|
|
462
|
-
$[
|
|
463
|
-
$[
|
|
464
|
-
$[
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
467
|
-
$[
|
|
468
|
-
} else
|
|
469
|
-
let
|
|
470
|
-
if ($[
|
|
471
|
-
|
|
966
|
+
$[15] = auditEntries;
|
|
967
|
+
$[16] = fields;
|
|
968
|
+
$[17] = isLoadingAudit;
|
|
969
|
+
$[18] = isLoadingVersions;
|
|
970
|
+
$[19] = isReverting;
|
|
971
|
+
$[20] = onRevert;
|
|
972
|
+
$[21] = showVersionsTab;
|
|
973
|
+
$[22] = versions;
|
|
974
|
+
$[23] = t12;
|
|
975
|
+
} else t12 = $[23];
|
|
976
|
+
let t13;
|
|
977
|
+
if ($[24] !== t11 || $[25] !== t12) {
|
|
978
|
+
t13 = /* @__PURE__ */ jsxs(SheetContent, {
|
|
472
979
|
side: "right",
|
|
473
|
-
|
|
474
|
-
|
|
980
|
+
animated: false,
|
|
981
|
+
showOverlay: false,
|
|
982
|
+
className: "qa-history-sidebar flex flex-col p-0 sm:max-w-2xl",
|
|
983
|
+
children: [t11, t12]
|
|
475
984
|
});
|
|
476
|
-
$[
|
|
477
|
-
$[
|
|
478
|
-
$[
|
|
479
|
-
} else
|
|
480
|
-
let
|
|
481
|
-
if ($[
|
|
482
|
-
|
|
985
|
+
$[24] = t11;
|
|
986
|
+
$[25] = t12;
|
|
987
|
+
$[26] = t13;
|
|
988
|
+
} else t13 = $[26];
|
|
989
|
+
let t14;
|
|
990
|
+
if ($[27] !== onOpenChange || $[28] !== open || $[29] !== t13) {
|
|
991
|
+
t14 = /* @__PURE__ */ jsx(Sheet, {
|
|
483
992
|
open,
|
|
484
993
|
onOpenChange,
|
|
485
|
-
|
|
994
|
+
modal: false,
|
|
995
|
+
children: t13
|
|
486
996
|
});
|
|
487
|
-
$[
|
|
488
|
-
$[
|
|
489
|
-
$[
|
|
490
|
-
$[
|
|
491
|
-
} else
|
|
492
|
-
return
|
|
997
|
+
$[27] = onOpenChange;
|
|
998
|
+
$[28] = open;
|
|
999
|
+
$[29] = t13;
|
|
1000
|
+
$[30] = t14;
|
|
1001
|
+
} else t14 = $[30];
|
|
1002
|
+
return t14;
|
|
493
1003
|
}
|
|
494
1004
|
|
|
495
1005
|
//#endregion
|