@questpie/admin 3.2.3 → 3.2.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/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +164 -339
- package/dist/client/components/actions/action-button.mjs +9 -9
- package/dist/client/components/actions/action-dialog.mjs +195 -493
- package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
- package/dist/client/components/actions/header-actions.mjs +73 -165
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/admin-link.mjs +40 -126
- package/dist/client/components/auth/auth-loading.mjs +9 -44
- package/dist/client/components/blocks/block-canvas.mjs +31 -95
- package/dist/client/components/blocks/block-editor-context.mjs +13 -57
- package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
- package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
- package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
- package/dist/client/components/blocks/block-insert-button.mjs +49 -165
- package/dist/client/components/blocks/block-item-menu.mjs +102 -301
- package/dist/client/components/blocks/block-item.mjs +136 -370
- package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
- package/dist/client/components/blocks/block-tree.mjs +12 -68
- package/dist/client/components/blocks/block-type-icon.mjs +14 -56
- package/dist/client/components/brand-logo.mjs +35 -149
- package/dist/client/components/component-renderer.mjs +42 -118
- package/dist/client/components/error-boundary.mjs +14 -58
- package/dist/client/components/fields/array-field.mjs +209 -521
- package/dist/client/components/fields/asset-preview-field.mjs +41 -141
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
- package/dist/client/components/fields/boolean-field.mjs +29 -59
- package/dist/client/components/fields/date-field.mjs +7 -37
- package/dist/client/components/fields/datetime-field.mjs +7 -38
- package/dist/client/components/fields/email-field.mjs +25 -54
- package/dist/client/components/fields/field-wrapper.mjs +30 -105
- package/dist/client/components/fields/json-field.mjs +107 -313
- package/dist/client/components/fields/locale-badge.mjs +6 -15
- package/dist/client/components/fields/number-field.mjs +27 -60
- package/dist/client/components/fields/object-array-field.mjs +283 -659
- package/dist/client/components/fields/object-field.mjs +165 -633
- package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
- package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
- package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
- package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
- package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
- package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
- package/dist/client/components/fields/relation-field.mjs +10 -66
- package/dist/client/components/fields/relation-picker.mjs +18 -18
- package/dist/client/components/fields/relation-select.mjs +12 -12
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
- package/dist/client/components/fields/rich-text-field.mjs +14 -53
- package/dist/client/components/fields/select-field.mjs +39 -74
- package/dist/client/components/fields/text-field.mjs +26 -59
- package/dist/client/components/fields/textarea-field.mjs +26 -58
- package/dist/client/components/fields/time-field.mjs +7 -35
- package/dist/client/components/fields/upload-field.mjs +47 -165
- package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
- package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
- package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
- package/dist/client/components/history-sidebar.mjs +306 -611
- package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
- package/dist/client/components/locale-switcher.mjs +106 -228
- package/dist/client/components/media/media-grid.mjs +84 -273
- package/dist/client/components/media/media-picker-dialog.mjs +177 -494
- package/dist/client/components/preview/live-preview-mode.mjs +240 -438
- package/dist/client/components/preview/preview-pane.mjs +22 -22
- package/dist/client/components/primitives/asset-preview.mjs +290 -666
- package/dist/client/components/primitives/checkbox-input.mjs +9 -35
- package/dist/client/components/primitives/date-input.mjs +109 -327
- package/dist/client/components/primitives/dropzone.mjs +209 -336
- package/dist/client/components/primitives/field-select-control.mjs +12 -80
- package/dist/client/components/primitives/number-input.mjs +4 -4
- package/dist/client/components/primitives/select-multi.mjs +200 -559
- package/dist/client/components/primitives/select-single.mjs +165 -499
- package/dist/client/components/primitives/time-input.mjs +43 -117
- package/dist/client/components/primitives/toggle-input.mjs +9 -29
- package/dist/client/components/sheets/resource-sheet.mjs +61 -70
- package/dist/client/components/ui/accordion.mjs +35 -155
- package/dist/client/components/ui/alert.mjs +13 -68
- package/dist/client/components/ui/badge.mjs +9 -51
- package/dist/client/components/ui/button.mjs +8 -54
- package/dist/client/components/ui/card.mjs +37 -193
- package/dist/client/components/ui/checkbox.mjs +12 -68
- package/dist/client/components/ui/command.mjs +48 -219
- package/dist/client/components/ui/dialog.mjs +50 -262
- package/dist/client/components/ui/drawer.mjs +55 -259
- package/dist/client/components/ui/dropdown-menu.mjs +86 -427
- package/dist/client/components/ui/empty-state.mjs +28 -98
- package/dist/client/components/ui/field.mjs +73 -309
- package/dist/client/components/ui/input-group.mjs +42 -167
- package/dist/client/components/ui/input.mjs +7 -37
- package/dist/client/components/ui/kbd.mjs +6 -36
- package/dist/client/components/ui/label.mjs +7 -37
- package/dist/client/components/ui/popover.mjs +34 -169
- package/dist/client/components/ui/responsive-dialog.mjs +67 -273
- package/dist/client/components/ui/scroll-fade.mjs +63 -158
- package/dist/client/components/ui/search-input.mjs +33 -100
- package/dist/client/components/ui/select.mjs +72 -393
- package/dist/client/components/ui/separator.mjs +7 -38
- package/dist/client/components/ui/sheet.mjs +49 -269
- package/dist/client/components/ui/sidebar.mjs +171 -690
- package/dist/client/components/ui/skeleton.mjs +7 -38
- package/dist/client/components/ui/sonner.mjs +11 -42
- package/dist/client/components/ui/switch.mjs +9 -45
- package/dist/client/components/ui/table.mjs +48 -266
- package/dist/client/components/ui/tabs.mjs +26 -139
- package/dist/client/components/ui/textarea.mjs +6 -32
- package/dist/client/components/ui/tooltip.mjs +27 -129
- package/dist/client/components/widgets/chart-widget.mjs +174 -522
- package/dist/client/components/widgets/progress-widget.mjs +66 -172
- package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
- package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
- package/dist/client/components/widgets/stats-widget.mjs +41 -175
- package/dist/client/components/widgets/table-widget.mjs +9 -9
- package/dist/client/components/widgets/timeline-widget.mjs +86 -226
- package/dist/client/components/widgets/value-widget.mjs +74 -381
- package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
- package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
- package/dist/client/contexts/focus-context.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +87 -150
- package/dist/client/hooks/typed-hooks.mjs +241 -701
- package/dist/client/hooks/use-action.mjs +62 -198
- package/dist/client/hooks/use-admin-config.mjs +5 -35
- package/dist/client/hooks/use-admin-preferences.mjs +16 -88
- package/dist/client/hooks/use-admin-routes.mjs +22 -56
- package/dist/client/hooks/use-audit-history.mjs +21 -69
- package/dist/client/hooks/use-brand.mjs +1 -9
- package/dist/client/hooks/use-collection-fields.mjs +17 -57
- package/dist/client/hooks/use-collection-meta.mjs +12 -44
- package/dist/client/hooks/use-collection-schema.mjs +10 -33
- package/dist/client/hooks/use-collection-validation.mjs +23 -53
- package/dist/client/hooks/use-collection.mjs +194 -614
- package/dist/client/hooks/use-current-user.mjs +0 -1
- package/dist/client/hooks/use-field-hooks.mjs +10 -10
- package/dist/client/hooks/use-field-options.mjs +61 -202
- package/dist/client/hooks/use-global-fields.mjs +14 -46
- package/dist/client/hooks/use-global-meta.mjs +9 -30
- package/dist/client/hooks/use-global-schema.mjs +9 -30
- package/dist/client/hooks/use-global.mjs +63 -219
- package/dist/client/hooks/use-locks.mjs +117 -325
- package/dist/client/hooks/use-media-query.mjs +16 -36
- package/dist/client/hooks/use-prefill-params.mjs +0 -1
- package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
- package/dist/client/hooks/use-reactive-fields.mjs +1 -1
- package/dist/client/hooks/use-reactive-prop.mjs +65 -223
- package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
- package/dist/client/hooks/use-saved-views.mjs +22 -103
- package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
- package/dist/client/hooks/use-search.mjs +31 -143
- package/dist/client/hooks/use-server-actions.mjs +18 -50
- package/dist/client/hooks/use-server-validation.mjs +72 -166
- package/dist/client/hooks/use-server-widget-data.mjs +7 -33
- package/dist/client/hooks/use-setup-status.mjs +12 -25
- package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
- package/dist/client/hooks/use-transition-stage.mjs +8 -38
- package/dist/client/hooks/use-upload.mjs +54 -152
- package/dist/client/hooks/use-validation-error-map.mjs +6 -26
- package/dist/client/hooks/use-view-state.mjs +187 -437
- package/dist/client/i18n/hooks.mjs +65 -197
- package/dist/client/lib/render-profiler.mjs +14 -41
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/diff.mjs +110 -0
- package/dist/client/preview/preview-banner.mjs +42 -108
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +166 -409
- package/dist/client/preview/use-collection-preview.mjs +135 -201
- package/dist/client/runtime/content-locales-provider.mjs +31 -83
- package/dist/client/runtime/locale-scope.mjs +22 -63
- package/dist/client/runtime/provider.mjs +100 -255
- package/dist/client/runtime/translations-provider.mjs +41 -107
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/accept-invite-form.mjs +121 -412
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/auth-layout.mjs +104 -284
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +94 -325
- package/dist/client/views/auth/invite-form.mjs +107 -442
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +116 -337
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.mjs +140 -478
- package/dist/client/views/collection/auto-form-fields.mjs +243 -615
- package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
- package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
- package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
- package/dist/client/views/collection/columns/build-columns.mjs +8 -48
- package/dist/client/views/collection/field-renderer.mjs +11 -24
- package/dist/client/views/collection/form-view.mjs +288 -560
- package/dist/client/views/collection/table-view.mjs +239 -469
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -543
- package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
- package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
- package/dist/client/views/dashboard/widget-card.mjs +61 -269
- package/dist/client/views/globals/global-form-view.mjs +478 -1298
- package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
- package/dist/client/views/layout/admin-layout.mjs +83 -246
- package/dist/client/views/layout/admin-router.mjs +457 -1289
- package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
- package/dist/client/views/layout/admin-theme.mjs +30 -64
- package/dist/client/views/layout/admin-view-layout.mjs +40 -144
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.mjs +41 -121
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +46 -173
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +33 -95
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- 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 +34 -34
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +53 -53
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/index.d.mts +21 -20
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- 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 +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- package/package.json +3 -5
|
@@ -9,9 +9,8 @@ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./
|
|
|
9
9
|
import { Skeleton } from "./ui/skeleton.mjs";
|
|
10
10
|
import { EmptyState } from "./ui/empty-state.mjs";
|
|
11
11
|
import { ScrollFade } from "./ui/scroll-fade.mjs";
|
|
12
|
-
import { c } from "react/compiler-runtime";
|
|
13
12
|
import { Icon } from "@iconify/react";
|
|
14
|
-
import "react";
|
|
13
|
+
import * as React from "react";
|
|
15
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
15
|
|
|
17
16
|
//#region src/client/components/history-sidebar.tsx
|
|
@@ -26,13 +25,22 @@ const VERSION_META_KEYS = new Set([
|
|
|
26
25
|
"versionCreatedAt"
|
|
27
26
|
]);
|
|
28
27
|
const EMPTY_AUDIT_ENTRIES = [];
|
|
28
|
+
const RELATIVE_TIME_FORMATTERS = /* @__PURE__ */ new Map();
|
|
29
|
+
function getRelativeTimeFormatter(locale) {
|
|
30
|
+
let formatter = RELATIVE_TIME_FORMATTERS.get(locale);
|
|
31
|
+
if (!formatter) {
|
|
32
|
+
formatter = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
33
|
+
RELATIVE_TIME_FORMATTERS.set(locale, formatter);
|
|
34
|
+
}
|
|
35
|
+
return formatter;
|
|
36
|
+
}
|
|
29
37
|
function formatRelativeTime(date, locale) {
|
|
30
38
|
const diff = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
|
|
31
39
|
const absSeconds = Math.max(0, Math.floor(Math.abs(diff) / 1e3));
|
|
32
40
|
const minutes = Math.floor(absSeconds / 60);
|
|
33
41
|
const hours = Math.floor(minutes / 60);
|
|
34
42
|
const days = Math.floor(hours / 24);
|
|
35
|
-
const formatter =
|
|
43
|
+
const formatter = getRelativeTimeFormatter(locale);
|
|
36
44
|
if (days > 0) return formatter.format(-days, "day");
|
|
37
45
|
if (hours > 0) return formatter.format(-hours, "hour");
|
|
38
46
|
if (minutes > 0) return formatter.format(-minutes, "minute");
|
|
@@ -136,16 +144,22 @@ function extractRichText(value) {
|
|
|
136
144
|
return summary ? truncate(summary, 180) : null;
|
|
137
145
|
}
|
|
138
146
|
function summarizeObjectArray(value) {
|
|
139
|
-
const labels =
|
|
147
|
+
const labels = [];
|
|
148
|
+
for (const item of value) {
|
|
149
|
+
if (!isObjectRecord(item)) continue;
|
|
150
|
+
const label = summarizeObject(item);
|
|
151
|
+
if (label) labels.push(label);
|
|
152
|
+
}
|
|
140
153
|
if (labels.length === 0) return null;
|
|
141
154
|
return labels.length === value.length ? truncate(labels.join(", "), 180) : null;
|
|
142
155
|
}
|
|
143
156
|
function summarizeBlocks(value) {
|
|
144
|
-
const blockNames =
|
|
145
|
-
|
|
157
|
+
const blockNames = [];
|
|
158
|
+
for (const item of value) {
|
|
159
|
+
if (!isObjectRecord(item)) continue;
|
|
146
160
|
const type = item.blockType ?? item.block ?? item.type ?? item._type ?? item.name;
|
|
147
|
-
|
|
148
|
-
}
|
|
161
|
+
if (typeof type === "string") blockNames.push(formatLabel(type));
|
|
162
|
+
}
|
|
149
163
|
if (blockNames.length === 0) return null;
|
|
150
164
|
return truncate([...new Set(blockNames)].join(", "), 180);
|
|
151
165
|
}
|
|
@@ -230,38 +244,20 @@ function formatFieldValue({ field, value, t, locale, resolveText }) {
|
|
|
230
244
|
}
|
|
231
245
|
return { summary: String(value) };
|
|
232
246
|
}
|
|
233
|
-
function ValuePreview(
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
});
|
|
245
|
-
$[0] = field;
|
|
246
|
-
$[1] = locale;
|
|
247
|
-
$[2] = resolveText;
|
|
248
|
-
$[3] = t;
|
|
249
|
-
$[4] = value;
|
|
250
|
-
$[5] = t1;
|
|
251
|
-
} else t1 = $[5];
|
|
252
|
-
const formatted = t1;
|
|
253
|
-
let t2;
|
|
254
|
-
if ($[6] !== formatted.summary) {
|
|
255
|
-
t2 = /* @__PURE__ */ jsx("div", {
|
|
247
|
+
function ValuePreview({ field, value, t, locale, resolveText }) {
|
|
248
|
+
const formatted = formatFieldValue({
|
|
249
|
+
field,
|
|
250
|
+
value,
|
|
251
|
+
t,
|
|
252
|
+
locale,
|
|
253
|
+
resolveText
|
|
254
|
+
});
|
|
255
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
256
|
+
className: "min-w-0 space-y-2",
|
|
257
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
256
258
|
className: "text-foreground text-xs leading-relaxed text-pretty break-words",
|
|
257
259
|
children: formatted.summary
|
|
258
|
-
})
|
|
259
|
-
$[6] = formatted.summary;
|
|
260
|
-
$[7] = t2;
|
|
261
|
-
} else t2 = $[7];
|
|
262
|
-
let t3;
|
|
263
|
-
if ($[8] !== formatted.detail) {
|
|
264
|
-
t3 = formatted.detail && /* @__PURE__ */ jsx(ScrollFade, {
|
|
260
|
+
}), formatted.detail && /* @__PURE__ */ jsx(ScrollFade, {
|
|
265
261
|
orientation: "both",
|
|
266
262
|
fadeSize: 16,
|
|
267
263
|
children: /* @__PURE__ */ jsx("pre", {
|
|
@@ -269,21 +265,8 @@ function ValuePreview(t0) {
|
|
|
269
265
|
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",
|
|
270
266
|
children: formatted.detail
|
|
271
267
|
})
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
$[9] = t3;
|
|
275
|
-
} else t3 = $[9];
|
|
276
|
-
let t4;
|
|
277
|
-
if ($[10] !== t2 || $[11] !== t3) {
|
|
278
|
-
t4 = /* @__PURE__ */ jsxs("div", {
|
|
279
|
-
className: "min-w-0 space-y-2",
|
|
280
|
-
children: [t2, t3]
|
|
281
|
-
});
|
|
282
|
-
$[10] = t2;
|
|
283
|
-
$[11] = t3;
|
|
284
|
-
$[12] = t4;
|
|
285
|
-
} else t4 = $[12];
|
|
286
|
-
return t4;
|
|
268
|
+
})]
|
|
269
|
+
});
|
|
287
270
|
}
|
|
288
271
|
function getDiffKind(from, to) {
|
|
289
272
|
if (isEmptyValue(from) && !isEmptyValue(to)) return "added";
|
|
@@ -309,61 +292,27 @@ function getDiffKindConfig(kind) {
|
|
|
309
292
|
};
|
|
310
293
|
}
|
|
311
294
|
}
|
|
312
|
-
function VersionDiffPanel(
|
|
313
|
-
const $ = c(26);
|
|
314
|
-
const { previousVersion, changes, fields } = t0;
|
|
295
|
+
function VersionDiffPanel({ previousVersion, changes, fields }) {
|
|
315
296
|
const { t, locale } = useTranslation();
|
|
316
297
|
const resolveText = useResolveText();
|
|
317
298
|
const previousNumber = previousVersion?.versionNumber;
|
|
318
|
-
if (changes.length === 0) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
t2$1 = /* @__PURE__ */ jsx(EmptyState, {
|
|
328
|
-
title: t1$1,
|
|
329
|
-
iconName: "ph:git-diff",
|
|
330
|
-
height: "h-32",
|
|
331
|
-
className: "panel-surface"
|
|
332
|
-
});
|
|
333
|
-
$[2] = t1$1;
|
|
334
|
-
$[3] = t2$1;
|
|
335
|
-
} else t2$1 = $[3];
|
|
336
|
-
return t2$1;
|
|
337
|
-
}
|
|
338
|
-
let t1;
|
|
339
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
340
|
-
t1 = /* @__PURE__ */ jsx(Icon, {
|
|
341
|
-
icon: "ph:git-diff",
|
|
342
|
-
className: "size-3.5"
|
|
343
|
-
});
|
|
344
|
-
$[4] = t1;
|
|
345
|
-
} else t1 = $[4];
|
|
346
|
-
let t2;
|
|
347
|
-
if ($[5] !== previousNumber || $[6] !== t) {
|
|
348
|
-
t2 = previousNumber ? t("history.diffAgainstVersion", { number: previousNumber }) : t("history.initialSnapshot");
|
|
349
|
-
$[5] = previousNumber;
|
|
350
|
-
$[6] = t;
|
|
351
|
-
$[7] = t2;
|
|
352
|
-
} else t2 = $[7];
|
|
353
|
-
let t3;
|
|
354
|
-
if ($[8] !== t2) {
|
|
355
|
-
t3 = /* @__PURE__ */ jsxs("div", {
|
|
299
|
+
if (changes.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
|
|
300
|
+
title: t("history.noFieldChanges"),
|
|
301
|
+
iconName: "ph:git-diff",
|
|
302
|
+
height: "h-32",
|
|
303
|
+
className: "panel-surface"
|
|
304
|
+
});
|
|
305
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
306
|
+
className: "space-y-3",
|
|
307
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
356
308
|
className: "text-muted-foreground flex items-center gap-2 text-xs text-pretty",
|
|
357
|
-
children: [
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
let t5$1;
|
|
365
|
-
if ($[16] !== fields || $[17] !== locale || $[18] !== resolveText || $[19] !== t) {
|
|
366
|
-
t5$1 = (change) => {
|
|
309
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
310
|
+
icon: "ph:git-diff",
|
|
311
|
+
className: "size-3.5"
|
|
312
|
+
}), /* @__PURE__ */ jsx("span", { children: previousNumber ? t("history.diffAgainstVersion", { number: previousNumber }) : t("history.initialSnapshot") })]
|
|
313
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
314
|
+
className: "space-y-2",
|
|
315
|
+
children: changes.map((change) => {
|
|
367
316
|
const field = fields?.[change.name];
|
|
368
317
|
const kind = getDiffKindConfig(change.kind);
|
|
369
318
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -444,430 +393,244 @@ function VersionDiffPanel(t0) {
|
|
|
444
393
|
})
|
|
445
394
|
]
|
|
446
395
|
}, change.name);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
$[18] = resolveText;
|
|
451
|
-
$[19] = t;
|
|
452
|
-
$[20] = t5$1;
|
|
453
|
-
} else t5$1 = $[20];
|
|
454
|
-
t4 = changes.map(t5$1);
|
|
455
|
-
$[10] = changes;
|
|
456
|
-
$[11] = fields;
|
|
457
|
-
$[12] = locale;
|
|
458
|
-
$[13] = resolveText;
|
|
459
|
-
$[14] = t;
|
|
460
|
-
$[15] = t4;
|
|
461
|
-
} else t4 = $[15];
|
|
462
|
-
let t5;
|
|
463
|
-
if ($[21] !== t4) {
|
|
464
|
-
t5 = /* @__PURE__ */ jsx("div", {
|
|
465
|
-
className: "space-y-2",
|
|
466
|
-
children: t4
|
|
467
|
-
});
|
|
468
|
-
$[21] = t4;
|
|
469
|
-
$[22] = t5;
|
|
470
|
-
} else t5 = $[22];
|
|
471
|
-
let t6;
|
|
472
|
-
if ($[23] !== t3 || $[24] !== t5) {
|
|
473
|
-
t6 = /* @__PURE__ */ jsxs("div", {
|
|
474
|
-
className: "space-y-3",
|
|
475
|
-
children: [t3, t5]
|
|
476
|
-
});
|
|
477
|
-
$[23] = t3;
|
|
478
|
-
$[24] = t5;
|
|
479
|
-
$[25] = t6;
|
|
480
|
-
} else t6 = $[25];
|
|
481
|
-
return t6;
|
|
482
|
-
}
|
|
483
|
-
function HistoryListSkeleton(t0) {
|
|
484
|
-
const $ = c(2);
|
|
485
|
-
const { rows: t1 } = t0;
|
|
486
|
-
const rows = t1 === void 0 ? 4 : t1;
|
|
487
|
-
let t2;
|
|
488
|
-
if ($[0] !== rows) {
|
|
489
|
-
t2 = /* @__PURE__ */ jsx("div", {
|
|
490
|
-
className: "space-y-4 py-2",
|
|
491
|
-
"aria-busy": "true",
|
|
492
|
-
children: Array.from({ length: rows }, _temp)
|
|
493
|
-
});
|
|
494
|
-
$[0] = rows;
|
|
495
|
-
$[1] = t2;
|
|
496
|
-
} else t2 = $[1];
|
|
497
|
-
return t2;
|
|
396
|
+
})
|
|
397
|
+
})]
|
|
398
|
+
});
|
|
498
399
|
}
|
|
499
|
-
function
|
|
500
|
-
return /* @__PURE__ */
|
|
501
|
-
className: "
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
className: "
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
400
|
+
function HistoryListSkeleton({ rows = 4 }) {
|
|
401
|
+
return /* @__PURE__ */ jsx("div", {
|
|
402
|
+
className: "space-y-4 py-2",
|
|
403
|
+
"aria-busy": "true",
|
|
404
|
+
children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxs("div", {
|
|
405
|
+
className: "flex gap-3",
|
|
406
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "mt-1 size-7 shrink-0 rounded-full" }), /* @__PURE__ */ jsxs("div", {
|
|
407
|
+
className: "min-w-0 flex-1 space-y-2",
|
|
408
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
409
|
+
variant: "text",
|
|
410
|
+
className: "h-4 w-28"
|
|
411
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
412
|
+
variant: "text",
|
|
413
|
+
className: "h-3 w-40"
|
|
414
|
+
})]
|
|
510
415
|
})]
|
|
511
|
-
})
|
|
512
|
-
}
|
|
416
|
+
}, index))
|
|
417
|
+
});
|
|
513
418
|
}
|
|
514
|
-
function ActivityTimeline(
|
|
515
|
-
const $ = c(13);
|
|
516
|
-
const { entries, isLoading } = t0;
|
|
419
|
+
function ActivityTimeline({ entries, isLoading }) {
|
|
517
420
|
const { locale, t } = useTranslation();
|
|
518
|
-
if (isLoading) {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const date = new Date(entry.createdAt);
|
|
552
|
-
const isLast = index === entries.length - 1;
|
|
553
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
554
|
-
className: "flex gap-3",
|
|
555
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
556
|
-
className: "flex flex-col items-center",
|
|
557
|
-
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" })]
|
|
558
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
559
|
-
className: "min-w-0 flex-1 pb-4",
|
|
560
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
561
|
-
className: "flex items-start justify-between gap-2",
|
|
562
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
563
|
-
className: "text-sm leading-snug",
|
|
564
|
-
children: entry.title
|
|
565
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
566
|
-
className: "text-muted-foreground shrink-0 text-xs whitespace-nowrap",
|
|
567
|
-
children: formatRelativeTime(date, locale)
|
|
568
|
-
})]
|
|
569
|
-
})
|
|
570
|
-
})]
|
|
571
|
-
}, entry.id);
|
|
572
|
-
};
|
|
573
|
-
$[8] = entries.length;
|
|
574
|
-
$[9] = locale;
|
|
575
|
-
$[10] = t2$1;
|
|
576
|
-
} else t2$1 = $[10];
|
|
577
|
-
t1 = entries.map(t2$1);
|
|
578
|
-
$[5] = entries;
|
|
579
|
-
$[6] = locale;
|
|
580
|
-
$[7] = t1;
|
|
581
|
-
} else t1 = $[7];
|
|
582
|
-
let t2;
|
|
583
|
-
if ($[11] !== t1) {
|
|
584
|
-
t2 = /* @__PURE__ */ jsx("div", {
|
|
585
|
-
className: "space-y-0",
|
|
586
|
-
children: t1
|
|
587
|
-
});
|
|
588
|
-
$[11] = t1;
|
|
589
|
-
$[12] = t2;
|
|
590
|
-
} else t2 = $[12];
|
|
591
|
-
return t2;
|
|
421
|
+
if (isLoading) return /* @__PURE__ */ jsx(HistoryListSkeleton, {});
|
|
422
|
+
if (entries.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
|
|
423
|
+
title: t("history.empty"),
|
|
424
|
+
iconName: "ph:clock-counter-clockwise",
|
|
425
|
+
height: "h-48"
|
|
426
|
+
});
|
|
427
|
+
return /* @__PURE__ */ jsx("div", {
|
|
428
|
+
className: "space-y-0",
|
|
429
|
+
children: entries.map((entry, index) => {
|
|
430
|
+
const config = getActionConfig(entry.action);
|
|
431
|
+
const date = new Date(entry.createdAt);
|
|
432
|
+
const isLast = index === entries.length - 1;
|
|
433
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
434
|
+
className: "flex gap-3",
|
|
435
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
436
|
+
className: "flex flex-col items-center",
|
|
437
|
+
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" })]
|
|
438
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
439
|
+
className: "min-w-0 flex-1 pb-4",
|
|
440
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
441
|
+
className: "flex items-start justify-between gap-2",
|
|
442
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
443
|
+
className: "text-sm leading-snug",
|
|
444
|
+
children: entry.title
|
|
445
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
446
|
+
className: "text-muted-foreground shrink-0 text-xs whitespace-nowrap",
|
|
447
|
+
children: formatRelativeTime(date, locale)
|
|
448
|
+
})]
|
|
449
|
+
})
|
|
450
|
+
})]
|
|
451
|
+
}, entry.id);
|
|
452
|
+
})
|
|
453
|
+
});
|
|
592
454
|
}
|
|
593
|
-
function VersionsList(
|
|
594
|
-
const $ = c(41);
|
|
595
|
-
const { versions, fields, isLoading, isReverting, onRevert } = t0;
|
|
455
|
+
function VersionsList({ versions, fields, isLoading, isReverting, onRevert }) {
|
|
596
456
|
const { formatDate, locale, t } = useTranslation();
|
|
597
457
|
const resolveText = useResolveText();
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
458
|
+
const sortedAscVersions = React.useMemo(() => {
|
|
459
|
+
return versions.slice().sort((a, b) => {
|
|
460
|
+
return (a.versionNumber ?? 0) - (b.versionNumber ?? 0);
|
|
461
|
+
});
|
|
462
|
+
}, [versions]);
|
|
463
|
+
const sortedVersions = React.useMemo(() => versions.slice().sort((a, b) => {
|
|
464
|
+
const aNum = a.versionNumber ?? 0;
|
|
465
|
+
return (b.versionNumber ?? 0) - aNum;
|
|
466
|
+
}), [versions]);
|
|
467
|
+
const fieldsForDiff = React.useMemo(() => {
|
|
468
|
+
if (fields && Object.keys(fields).length > 0) return fields;
|
|
469
|
+
const inferred = {};
|
|
470
|
+
for (const version of versions) for (const key of Object.keys(version)) {
|
|
471
|
+
if (VERSION_META_KEYS.has(key)) continue;
|
|
472
|
+
inferred[key] = {
|
|
473
|
+
name: key,
|
|
474
|
+
metadata: {
|
|
475
|
+
type: "unknown",
|
|
476
|
+
label: formatLabel(key)
|
|
477
|
+
}
|
|
478
|
+
};
|
|
617
479
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
name: key,
|
|
625
|
-
metadata: {
|
|
626
|
-
type: "unknown",
|
|
627
|
-
label: formatLabel(key)
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
$[4] = versions;
|
|
632
|
-
$[5] = inferred;
|
|
633
|
-
} else inferred = $[5];
|
|
634
|
-
t3 = inferred;
|
|
635
|
-
}
|
|
636
|
-
const fieldsForDiff = t3;
|
|
637
|
-
let byKey;
|
|
638
|
-
if ($[6] !== fieldsForDiff || $[7] !== resolveText || $[8] !== sortedAscVersions) {
|
|
639
|
-
byKey = /* @__PURE__ */ new Map();
|
|
640
|
-
for (let index = 0; index < sortedAscVersions.length; index = index + 1) {
|
|
641
|
-
const version_0 = sortedAscVersions[index];
|
|
480
|
+
return inferred;
|
|
481
|
+
}, [fields, versions]);
|
|
482
|
+
const versionDetails = React.useMemo(() => {
|
|
483
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
484
|
+
for (let index = 0; index < sortedAscVersions.length; index += 1) {
|
|
485
|
+
const version = sortedAscVersions[index];
|
|
642
486
|
const previousVersion = sortedAscVersions[index - 1];
|
|
643
|
-
const
|
|
644
|
-
byKey.set(
|
|
645
|
-
key
|
|
487
|
+
const key = getVersionKey(version, index);
|
|
488
|
+
byKey.set(key, {
|
|
489
|
+
key,
|
|
646
490
|
previousVersion,
|
|
647
491
|
changes: buildVersionDiff({
|
|
648
|
-
version
|
|
492
|
+
version,
|
|
649
493
|
previousVersion,
|
|
650
494
|
fields: fieldsForDiff,
|
|
651
495
|
resolveText
|
|
652
496
|
})
|
|
653
497
|
});
|
|
654
498
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
default: return operation || t("version.operationUnknown");
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
$[10] = t;
|
|
672
|
-
$[11] = t4;
|
|
673
|
-
} else t4 = $[11];
|
|
674
|
-
const operationLabel = t4;
|
|
675
|
-
let t5;
|
|
676
|
-
if ($[12] !== formatDate) {
|
|
677
|
-
t5 = (value) => {
|
|
678
|
-
if (!value) return "-";
|
|
679
|
-
const date = new Date(value);
|
|
680
|
-
if (Number.isNaN(date.getTime())) return "-";
|
|
681
|
-
return formatDate(date, {
|
|
682
|
-
dateStyle: "medium",
|
|
683
|
-
timeStyle: "short"
|
|
684
|
-
});
|
|
685
|
-
};
|
|
686
|
-
$[12] = formatDate;
|
|
687
|
-
$[13] = t5;
|
|
688
|
-
} else t5 = $[13];
|
|
689
|
-
const formatDateTime = t5;
|
|
690
|
-
if (isLoading) {
|
|
691
|
-
let t6$1;
|
|
692
|
-
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
693
|
-
t6$1 = /* @__PURE__ */ jsx(HistoryListSkeleton, {});
|
|
694
|
-
$[14] = t6$1;
|
|
695
|
-
} else t6$1 = $[14];
|
|
696
|
-
return t6$1;
|
|
697
|
-
}
|
|
698
|
-
if (sortedVersions.length === 0) {
|
|
699
|
-
let t6$1;
|
|
700
|
-
if ($[15] !== t) {
|
|
701
|
-
t6$1 = t("version.empty");
|
|
702
|
-
$[15] = t;
|
|
703
|
-
$[16] = t6$1;
|
|
704
|
-
} else t6$1 = $[16];
|
|
705
|
-
let t7$1;
|
|
706
|
-
if ($[17] !== t6$1) {
|
|
707
|
-
t7$1 = /* @__PURE__ */ jsx(EmptyState, {
|
|
708
|
-
title: t6$1,
|
|
709
|
-
iconName: "ph:clock-counter-clockwise",
|
|
710
|
-
height: "h-48"
|
|
711
|
-
});
|
|
712
|
-
$[17] = t6$1;
|
|
713
|
-
$[18] = t7$1;
|
|
714
|
-
} else t7$1 = $[18];
|
|
715
|
-
return t7$1;
|
|
499
|
+
return byKey;
|
|
500
|
+
}, [
|
|
501
|
+
fieldsForDiff,
|
|
502
|
+
resolveText,
|
|
503
|
+
sortedAscVersions
|
|
504
|
+
]);
|
|
505
|
+
function operationLabel(operation) {
|
|
506
|
+
switch (operation) {
|
|
507
|
+
case "create": return t("version.operationCreate");
|
|
508
|
+
case "delete": return t("version.operationDelete");
|
|
509
|
+
case "update": return t("version.operationUpdate");
|
|
510
|
+
default: return operation || t("version.operationUnknown");
|
|
511
|
+
}
|
|
716
512
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
/* @__PURE__ */ jsxs(Badge, {
|
|
753
|
-
variant: "outline",
|
|
754
|
-
className: cn(action.badge),
|
|
755
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
756
|
-
icon: action.icon,
|
|
757
|
-
className: "size-2.5"
|
|
758
|
-
}), operationLabel(version_1.versionOperation)]
|
|
759
|
-
}),
|
|
760
|
-
version_1.versionStage && /* @__PURE__ */ jsxs(Badge, {
|
|
761
|
-
variant: "outline",
|
|
762
|
-
children: [
|
|
763
|
-
t("history.stage"),
|
|
764
|
-
": ",
|
|
765
|
-
version_1.versionStage
|
|
766
|
-
]
|
|
767
|
-
}),
|
|
768
|
-
/* @__PURE__ */ jsx(Badge, {
|
|
769
|
-
variant: "outline",
|
|
770
|
-
className: "tabular-nums",
|
|
771
|
-
children: t("history.changedFields", { count: changes.length })
|
|
772
|
-
})
|
|
773
|
-
]
|
|
774
|
-
}),
|
|
775
|
-
/* @__PURE__ */ jsxs("div", {
|
|
776
|
-
className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",
|
|
777
|
-
children: [
|
|
778
|
-
/* @__PURE__ */ jsx("span", {
|
|
779
|
-
className: "tabular-nums",
|
|
780
|
-
children: date_0 ? formatDateTime(version_1.versionCreatedAt) : "-"
|
|
781
|
-
}),
|
|
782
|
-
date_0 && /* @__PURE__ */ jsx("span", {
|
|
783
|
-
className: "tabular-nums",
|
|
784
|
-
children: formatRelativeTime(date_0, locale)
|
|
785
|
-
}),
|
|
786
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
787
|
-
t("version.user"),
|
|
788
|
-
":",
|
|
789
|
-
" ",
|
|
790
|
-
version_1.versionUserId || t("history.systemUser")
|
|
791
|
-
] })
|
|
792
|
-
]
|
|
793
|
-
}),
|
|
794
|
-
/* @__PURE__ */ jsxs("p", {
|
|
795
|
-
className: "text-muted-foreground truncate text-xs text-pretty",
|
|
796
|
-
children: [changedPreview || t("history.noFieldChanges"), remainingChangedFields > 0 && ` + ${t("history.moreFields", { count: remainingChangedFields })}`]
|
|
797
|
-
})
|
|
798
|
-
]
|
|
799
|
-
})
|
|
800
|
-
}), /* @__PURE__ */ jsxs(AccordionContent, {
|
|
801
|
-
className: "px-3 pt-0 pb-3",
|
|
513
|
+
const formatDateTime = (value) => {
|
|
514
|
+
if (!value) return "-";
|
|
515
|
+
const date = new Date(value);
|
|
516
|
+
if (Number.isNaN(date.getTime())) return "-";
|
|
517
|
+
return formatDate(date, {
|
|
518
|
+
dateStyle: "medium",
|
|
519
|
+
timeStyle: "short"
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
if (isLoading) return /* @__PURE__ */ jsx(HistoryListSkeleton, {});
|
|
523
|
+
if (sortedVersions.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
|
|
524
|
+
title: t("version.empty"),
|
|
525
|
+
iconName: "ph:clock-counter-clockwise",
|
|
526
|
+
height: "h-48"
|
|
527
|
+
});
|
|
528
|
+
return /* @__PURE__ */ jsx(Accordion, {
|
|
529
|
+
defaultValue: [],
|
|
530
|
+
className: "panel-surface bg-card",
|
|
531
|
+
children: sortedVersions.map((version, index) => {
|
|
532
|
+
const key = getVersionKey(version, index);
|
|
533
|
+
const details = versionDetails.get(key);
|
|
534
|
+
const changes = details?.changes ?? [];
|
|
535
|
+
const visibleChangedFields = changes.slice(0, 3);
|
|
536
|
+
const remainingChangedFields = Math.max(0, changes.length - visibleChangedFields.length);
|
|
537
|
+
const changedPreview = visibleChangedFields.map((change) => change.label).join(", ");
|
|
538
|
+
const date = version.versionCreatedAt ? new Date(version.versionCreatedAt) : null;
|
|
539
|
+
const canRevert = typeof version.versionId === "string" || typeof version.versionNumber === "number";
|
|
540
|
+
const action = getActionConfig(version.versionOperation ?? "");
|
|
541
|
+
return /* @__PURE__ */ jsxs(AccordionItem, {
|
|
542
|
+
value: key,
|
|
543
|
+
className: "px-0",
|
|
544
|
+
children: [/* @__PURE__ */ jsx(AccordionTrigger, {
|
|
545
|
+
className: "min-h-20 items-start px-3 py-3 hover:no-underline",
|
|
546
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
547
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
802
548
|
children: [
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
549
|
+
/* @__PURE__ */ jsxs("div", {
|
|
550
|
+
className: "flex flex-wrap items-center gap-2",
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
553
|
+
variant: "secondary",
|
|
554
|
+
className: "tabular-nums",
|
|
555
|
+
children: t("version.label", { number: version.versionNumber ?? "-" })
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ jsxs(Badge, {
|
|
558
|
+
variant: "outline",
|
|
559
|
+
className: cn(action.badge),
|
|
560
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
561
|
+
icon: action.icon,
|
|
562
|
+
className: "size-2.5"
|
|
563
|
+
}), operationLabel(version.versionOperation)]
|
|
564
|
+
}),
|
|
565
|
+
version.versionStage && /* @__PURE__ */ jsxs(Badge, {
|
|
566
|
+
variant: "outline",
|
|
567
|
+
children: [
|
|
568
|
+
t("history.stage"),
|
|
569
|
+
": ",
|
|
570
|
+
version.versionStage
|
|
571
|
+
]
|
|
572
|
+
}),
|
|
573
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
574
|
+
variant: "outline",
|
|
575
|
+
className: "tabular-nums",
|
|
576
|
+
children: t("history.changedFields", { count: changes.length })
|
|
577
|
+
})
|
|
578
|
+
]
|
|
811
579
|
}),
|
|
812
|
-
|
|
813
|
-
className: "
|
|
814
|
-
children:
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
580
|
+
/* @__PURE__ */ jsxs("div", {
|
|
581
|
+
className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",
|
|
582
|
+
children: [
|
|
583
|
+
/* @__PURE__ */ jsx("span", {
|
|
584
|
+
className: "tabular-nums",
|
|
585
|
+
children: date ? formatDateTime(version.versionCreatedAt) : "-"
|
|
586
|
+
}),
|
|
587
|
+
date && /* @__PURE__ */ jsx("span", {
|
|
588
|
+
className: "tabular-nums",
|
|
589
|
+
children: formatRelativeTime(date, locale)
|
|
590
|
+
}),
|
|
591
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
592
|
+
t("version.user"),
|
|
593
|
+
":",
|
|
594
|
+
" ",
|
|
595
|
+
version.versionUserId || t("history.systemUser")
|
|
596
|
+
] })
|
|
597
|
+
]
|
|
598
|
+
}),
|
|
599
|
+
/* @__PURE__ */ jsxs("p", {
|
|
600
|
+
className: "text-muted-foreground truncate text-xs text-pretty",
|
|
601
|
+
children: [changedPreview || t("history.noFieldChanges"), remainingChangedFields > 0 && ` + ${t("history.moreFields", { count: remainingChangedFields })}`]
|
|
823
602
|
})
|
|
824
603
|
]
|
|
825
|
-
})
|
|
826
|
-
},
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
children: t7
|
|
856
|
-
});
|
|
857
|
-
$[39] = t7;
|
|
858
|
-
$[40] = t8;
|
|
859
|
-
} else t8 = $[40];
|
|
860
|
-
return t8;
|
|
861
|
-
}
|
|
862
|
-
function _temp4(change) {
|
|
863
|
-
return change.label;
|
|
864
|
-
}
|
|
865
|
-
function _temp3(a_0, b_0) {
|
|
866
|
-
const aNum_0 = a_0.versionNumber ?? 0;
|
|
867
|
-
return (b_0.versionNumber ?? 0) - aNum_0;
|
|
868
|
-
}
|
|
869
|
-
function _temp2(a, b) {
|
|
870
|
-
return (a.versionNumber ?? 0) - (b.versionNumber ?? 0);
|
|
604
|
+
})
|
|
605
|
+
}), /* @__PURE__ */ jsxs(AccordionContent, {
|
|
606
|
+
className: "px-3 pt-0 pb-3",
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ jsx(Separator, { className: "mb-3" }),
|
|
609
|
+
/* @__PURE__ */ jsx("div", {
|
|
610
|
+
className: "space-y-3",
|
|
611
|
+
children: /* @__PURE__ */ jsx(VersionDiffPanel, {
|
|
612
|
+
previousVersion: details?.previousVersion,
|
|
613
|
+
changes,
|
|
614
|
+
fields: fieldsForDiff
|
|
615
|
+
})
|
|
616
|
+
}),
|
|
617
|
+
onRevert && /* @__PURE__ */ jsx("div", {
|
|
618
|
+
className: "mt-3 flex justify-end",
|
|
619
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
620
|
+
variant: "outline",
|
|
621
|
+
size: "sm",
|
|
622
|
+
disabled: !canRevert || isReverting,
|
|
623
|
+
onClick: () => {
|
|
624
|
+
onRevert(version);
|
|
625
|
+
},
|
|
626
|
+
children: t("version.revert")
|
|
627
|
+
})
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
})]
|
|
631
|
+
}, key);
|
|
632
|
+
})
|
|
633
|
+
});
|
|
871
634
|
}
|
|
872
635
|
function getVersionKey(version, index) {
|
|
873
636
|
if (version.versionId) return version.versionId;
|
|
@@ -897,116 +660,48 @@ function buildVersionDiff({ version, previousVersion, fields, resolveText }) {
|
|
|
897
660
|
}
|
|
898
661
|
return changes;
|
|
899
662
|
}
|
|
900
|
-
function HistorySidebar(
|
|
901
|
-
const $ = c(29);
|
|
902
|
-
const { open, onOpenChange, auditEntries: t1, isLoadingAudit: t2, versions, fields, isLoadingVersions: t3, isReverting: t4, onRevert, showVersionsTab: t5 } = t0;
|
|
903
|
-
const auditEntries = t1 === void 0 ? EMPTY_AUDIT_ENTRIES : t1;
|
|
904
|
-
const isLoadingAudit = t2 === void 0 ? false : t2;
|
|
905
|
-
const isLoadingVersions = t3 === void 0 ? false : t3;
|
|
906
|
-
const isReverting = t4 === void 0 ? false : t4;
|
|
907
|
-
const showVersionsTab = t5 === void 0 ? false : t5;
|
|
663
|
+
function HistorySidebar({ open, onOpenChange, auditEntries = EMPTY_AUDIT_ENTRIES, isLoadingAudit = false, versions, fields, isLoadingVersions = false, isReverting = false, onRevert, showVersionsTab = false }) {
|
|
908
664
|
const { t } = useTranslation();
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
$[2] = t6;
|
|
915
|
-
} else t6 = $[2];
|
|
916
|
-
let t7;
|
|
917
|
-
if ($[3] !== t6) {
|
|
918
|
-
t7 = /* @__PURE__ */ jsx(SheetTitle, { children: t6 });
|
|
919
|
-
$[3] = t6;
|
|
920
|
-
$[4] = t7;
|
|
921
|
-
} else t7 = $[4];
|
|
922
|
-
let t8;
|
|
923
|
-
if ($[5] !== showVersionsTab || $[6] !== t) {
|
|
924
|
-
t8 = showVersionsTab ? t("history.versionDescription") : t("history.description");
|
|
925
|
-
$[5] = showVersionsTab;
|
|
926
|
-
$[6] = t;
|
|
927
|
-
$[7] = t8;
|
|
928
|
-
} else t8 = $[7];
|
|
929
|
-
let t9;
|
|
930
|
-
if ($[8] !== t8) {
|
|
931
|
-
t9 = /* @__PURE__ */ jsx(SheetDescription, { children: t8 });
|
|
932
|
-
$[8] = t8;
|
|
933
|
-
$[9] = t9;
|
|
934
|
-
} else t9 = $[9];
|
|
935
|
-
let t10;
|
|
936
|
-
if ($[10] !== t7 || $[11] !== t9) {
|
|
937
|
-
t10 = /* @__PURE__ */ jsxs(SheetHeader, {
|
|
938
|
-
className: "border-b px-6 py-5",
|
|
939
|
-
children: [t7, t9]
|
|
940
|
-
});
|
|
941
|
-
$[10] = t7;
|
|
942
|
-
$[11] = t9;
|
|
943
|
-
$[12] = t10;
|
|
944
|
-
} else t10 = $[12];
|
|
945
|
-
let t11;
|
|
946
|
-
if ($[13] !== auditEntries || $[14] !== fields || $[15] !== isLoadingAudit || $[16] !== isLoadingVersions || $[17] !== isReverting || $[18] !== onRevert || $[19] !== showVersionsTab || $[20] !== versions) {
|
|
947
|
-
t11 = showVersionsTab ? /* @__PURE__ */ jsx(ScrollFade, {
|
|
948
|
-
orientation: "vertical",
|
|
949
|
-
className: "min-h-0 flex-1",
|
|
950
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
951
|
-
"data-scroll-fade-target": true,
|
|
952
|
-
className: "h-full overflow-y-auto px-6 py-4",
|
|
953
|
-
children: /* @__PURE__ */ jsx(VersionsList, {
|
|
954
|
-
versions: versions ?? [],
|
|
955
|
-
fields,
|
|
956
|
-
isLoading: isLoadingVersions,
|
|
957
|
-
isReverting,
|
|
958
|
-
onRevert
|
|
959
|
-
})
|
|
960
|
-
})
|
|
961
|
-
}) : /* @__PURE__ */ jsx(ScrollFade, {
|
|
962
|
-
orientation: "vertical",
|
|
963
|
-
className: "min-h-0 flex-1",
|
|
964
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
965
|
-
"data-scroll-fade-target": true,
|
|
966
|
-
className: "h-full overflow-y-auto px-6 py-4",
|
|
967
|
-
children: /* @__PURE__ */ jsx(ActivityTimeline, {
|
|
968
|
-
entries: auditEntries,
|
|
969
|
-
isLoading: isLoadingAudit
|
|
970
|
-
})
|
|
971
|
-
})
|
|
972
|
-
});
|
|
973
|
-
$[13] = auditEntries;
|
|
974
|
-
$[14] = fields;
|
|
975
|
-
$[15] = isLoadingAudit;
|
|
976
|
-
$[16] = isLoadingVersions;
|
|
977
|
-
$[17] = isReverting;
|
|
978
|
-
$[18] = onRevert;
|
|
979
|
-
$[19] = showVersionsTab;
|
|
980
|
-
$[20] = versions;
|
|
981
|
-
$[21] = t11;
|
|
982
|
-
} else t11 = $[21];
|
|
983
|
-
let t12;
|
|
984
|
-
if ($[22] !== t10 || $[23] !== t11) {
|
|
985
|
-
t12 = /* @__PURE__ */ jsxs(SheetContent, {
|
|
665
|
+
return /* @__PURE__ */ jsx(Sheet, {
|
|
666
|
+
open,
|
|
667
|
+
onOpenChange,
|
|
668
|
+
modal: false,
|
|
669
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
986
670
|
side: "right",
|
|
987
671
|
animated: false,
|
|
988
672
|
showOverlay: false,
|
|
989
673
|
className: "qa-history-sidebar flex flex-col p-0 sm:max-w-2xl",
|
|
990
|
-
children: [
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
674
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
675
|
+
className: "border-b px-6 py-5",
|
|
676
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: showVersionsTab ? t("version.history") : t("history.title") }), /* @__PURE__ */ jsx(SheetDescription, { children: showVersionsTab ? t("history.versionDescription") : t("history.description") })]
|
|
677
|
+
}), showVersionsTab ? /* @__PURE__ */ jsx(ScrollFade, {
|
|
678
|
+
orientation: "vertical",
|
|
679
|
+
className: "min-h-0 flex-1",
|
|
680
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
681
|
+
"data-scroll-fade-target": true,
|
|
682
|
+
className: "h-full overflow-y-auto px-6 py-4",
|
|
683
|
+
children: /* @__PURE__ */ jsx(VersionsList, {
|
|
684
|
+
versions: versions ?? [],
|
|
685
|
+
fields,
|
|
686
|
+
isLoading: isLoadingVersions,
|
|
687
|
+
isReverting,
|
|
688
|
+
onRevert
|
|
689
|
+
})
|
|
690
|
+
})
|
|
691
|
+
}) : /* @__PURE__ */ jsx(ScrollFade, {
|
|
692
|
+
orientation: "vertical",
|
|
693
|
+
className: "min-h-0 flex-1",
|
|
694
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
695
|
+
"data-scroll-fade-target": true,
|
|
696
|
+
className: "h-full overflow-y-auto px-6 py-4",
|
|
697
|
+
children: /* @__PURE__ */ jsx(ActivityTimeline, {
|
|
698
|
+
entries: auditEntries,
|
|
699
|
+
isLoading: isLoadingAudit
|
|
700
|
+
})
|
|
701
|
+
})
|
|
702
|
+
})]
|
|
703
|
+
})
|
|
704
|
+
});
|
|
1010
705
|
}
|
|
1011
706
|
|
|
1012
707
|
//#endregion
|