@questpie/admin 3.2.4 → 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.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 +103 -230
- 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 +94 -296
- 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 -180
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
- 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 +285 -605
- 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 +176 -476
- package/dist/client/components/preview/live-preview-mode.mjs +233 -458
- 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.mjs +63 -146
- 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/preview-banner.d.mts +2 -2
- 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 +167 -348
- package/dist/client/preview/use-collection-preview.mjs +121 -215
- 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.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.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- 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 -379
- 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 +58 -182
- package/dist/client/views/collection/form-view.mjs +284 -518
- package/dist/client/views/collection/table-view.mjs +231 -463
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -560
- 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 +477 -1301
- 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 +458 -1274
- 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.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- 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.mjs +46 -173
- 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 +46 -46
- package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
- 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 +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +41 -41
- package/dist/server/modules/admin/collections/user.d.mts +63 -63
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/index.d.mts +20 -19
- 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 +45 -45
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- package/package.json +3 -5
|
@@ -24,7 +24,6 @@ import { detectManyToManyRelations, hasManyToManyRelations } from "../../utils/d
|
|
|
24
24
|
import { shouldHandleAdminShortcut } from "../../utils/keyboard-shortcuts.mjs";
|
|
25
25
|
import { AdminViewHeader } from "../layout/admin-view-layout.mjs";
|
|
26
26
|
import { useGlobalAuditHistory } from "../../hooks/use-audit-history.mjs";
|
|
27
|
-
import { c } from "react/compiler-runtime";
|
|
28
27
|
import { Icon } from "@iconify/react";
|
|
29
28
|
import * as React from "react";
|
|
30
29
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -50,1350 +49,527 @@ function extractReactiveConfigs(schema) {
|
|
|
50
49
|
return configs;
|
|
51
50
|
}
|
|
52
51
|
function GlobalFormViewSkeleton() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$[0] = t0;
|
|
61
|
-
} else t0 = $[0];
|
|
62
|
-
let t1;
|
|
63
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
-
t1 = /* @__PURE__ */ jsx(AdminViewHeader, {
|
|
65
|
-
title: /* @__PURE__ */ jsx(Skeleton, {
|
|
66
|
-
variant: "text",
|
|
67
|
-
className: "h-7 w-48"
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "qa-global-form w-full space-y-4",
|
|
54
|
+
"aria-busy": "true",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "sr-only",
|
|
58
|
+
children: "Loading global form"
|
|
68
59
|
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
/* @__PURE__ */ jsx(AdminViewHeader, {
|
|
61
|
+
title: /* @__PURE__ */ jsx(Skeleton, {
|
|
62
|
+
variant: "text",
|
|
63
|
+
className: "h-7 w-48"
|
|
64
|
+
}),
|
|
65
|
+
meta: /* @__PURE__ */ jsx(Skeleton, {
|
|
66
|
+
variant: "text",
|
|
67
|
+
className: "h-3 w-36"
|
|
68
|
+
}),
|
|
69
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Skeleton, { className: "size-8" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-20" })] })
|
|
72
70
|
}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
t4 = /* @__PURE__ */ jsxs("div", {
|
|
102
|
-
className: "qa-global-form w-full space-y-4",
|
|
103
|
-
"aria-busy": "true",
|
|
104
|
-
children: [
|
|
105
|
-
t0,
|
|
106
|
-
t1,
|
|
107
|
-
/* @__PURE__ */ jsxs("div", {
|
|
108
|
-
className: "space-y-4",
|
|
109
|
-
children: [
|
|
110
|
-
t2,
|
|
111
|
-
t3,
|
|
112
|
-
/* @__PURE__ */ jsxs("div", {
|
|
113
|
-
className: "space-y-2",
|
|
114
|
-
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
115
|
-
variant: "text",
|
|
116
|
-
className: "h-4 w-28"
|
|
117
|
-
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-full" })]
|
|
118
|
-
})
|
|
119
|
-
]
|
|
120
|
-
})
|
|
121
|
-
]
|
|
122
|
-
});
|
|
123
|
-
$[4] = t4;
|
|
124
|
-
} else t4 = $[4];
|
|
125
|
-
return t4;
|
|
71
|
+
/* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: "space-y-4",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: "space-y-2",
|
|
76
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
77
|
+
variant: "text",
|
|
78
|
+
className: "h-4 w-24"
|
|
79
|
+
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })]
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsxs("div", {
|
|
82
|
+
className: "space-y-2",
|
|
83
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
84
|
+
variant: "text",
|
|
85
|
+
className: "h-4 w-32"
|
|
86
|
+
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })]
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", {
|
|
89
|
+
className: "space-y-2",
|
|
90
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
91
|
+
variant: "text",
|
|
92
|
+
className: "h-4 w-28"
|
|
93
|
+
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-full" })]
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
});
|
|
126
99
|
}
|
|
127
100
|
/**
|
|
128
101
|
* GlobalFormView - Default form-based edit view for globals
|
|
129
102
|
*/
|
|
130
|
-
function GlobalFormView(
|
|
131
|
-
const $ = c(312);
|
|
132
|
-
const { global: globalName, config, viewConfig, registry, showMeta: t1, headerActions, onSuccess, onError } = t0;
|
|
133
|
-
const showMeta = t1 === void 0 ? true : t1;
|
|
103
|
+
function GlobalFormView({ global: globalName, config, viewConfig, registry, showMeta = true, headerActions, onSuccess, onError }) {
|
|
134
104
|
const { t } = useTranslation();
|
|
135
105
|
const resolveText = useResolveText();
|
|
136
106
|
const { fields: schemaFields, schema: globalSchema } = useGlobalFields(globalName);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
$[2] = t4;
|
|
149
|
-
} else t4 = $[2];
|
|
150
|
-
const withRelations = t4;
|
|
151
|
-
let t5;
|
|
152
|
-
if ($[3] !== withRelations) {
|
|
153
|
-
t5 = hasManyToManyRelations(withRelations) ? { with: withRelations } : void 0;
|
|
154
|
-
$[3] = withRelations;
|
|
155
|
-
$[4] = t5;
|
|
156
|
-
} else t5 = $[4];
|
|
157
|
-
const { data: globalDataRaw, isLoading: dataLoading, error: dataError } = useGlobal(globalName, t5);
|
|
158
|
-
let t6;
|
|
159
|
-
bb0: {
|
|
160
|
-
if (!globalDataRaw || !hasManyToManyRelations(withRelations)) {
|
|
161
|
-
t6 = globalDataRaw;
|
|
162
|
-
break bb0;
|
|
107
|
+
const withRelations = React.useMemo(() => detectManyToManyRelations({
|
|
108
|
+
fields: config?.fields,
|
|
109
|
+
schema: globalSchema
|
|
110
|
+
}), [config?.fields, globalSchema]);
|
|
111
|
+
const { data: globalDataRaw, isLoading: dataLoading, error: dataError } = useGlobal(globalName, hasManyToManyRelations(withRelations) ? { with: withRelations } : void 0);
|
|
112
|
+
const globalData = React.useMemo(() => {
|
|
113
|
+
if (!globalDataRaw || !hasManyToManyRelations(withRelations)) return globalDataRaw;
|
|
114
|
+
const result = { ...globalDataRaw };
|
|
115
|
+
for (const key of Object.keys(withRelations)) {
|
|
116
|
+
const value = result[key];
|
|
117
|
+
if (Array.isArray(value) && value.length > 0 && typeof value[0] === "object" && value[0]?.id) result[key] = value.map((v) => v.id);
|
|
163
118
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if ($[5] !== t7$1 || $[6] !== withRelations) {
|
|
167
|
-
result = { ...t7$1 };
|
|
168
|
-
for (const key of Object.keys(withRelations)) {
|
|
169
|
-
const value = result[key];
|
|
170
|
-
if (Array.isArray(value) && value.length > 0 && typeof value[0] === "object" && value[0]?.id) result[key] = value.map(_temp);
|
|
171
|
-
}
|
|
172
|
-
$[5] = t7$1;
|
|
173
|
-
$[6] = withRelations;
|
|
174
|
-
$[7] = result;
|
|
175
|
-
} else result = $[7];
|
|
176
|
-
t6 = result;
|
|
177
|
-
}
|
|
178
|
-
const globalData = t6;
|
|
119
|
+
return result;
|
|
120
|
+
}, [globalDataRaw, withRelations]);
|
|
179
121
|
const { locale: contentLocale, setLocale: setContentLocale } = useScopedLocale();
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
t7 = contentLocales?.locales ?? [];
|
|
184
|
-
$[8] = contentLocales?.locales;
|
|
185
|
-
$[9] = t7;
|
|
186
|
-
} else t7 = $[9];
|
|
187
|
-
const localeOptions = t7;
|
|
188
|
-
let t8;
|
|
189
|
-
if ($[10] !== onSuccess || $[11] !== t) {
|
|
190
|
-
t8 = (data) => {
|
|
122
|
+
const localeOptions = useSafeContentLocales()?.locales ?? [];
|
|
123
|
+
const updateMutation = useGlobalUpdate(globalName, {
|
|
124
|
+
onSuccess: (data) => {
|
|
191
125
|
toast.success(t("toast.saveSuccess"));
|
|
192
126
|
onSuccess?.(data);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
$[11] = t;
|
|
196
|
-
$[12] = t8;
|
|
197
|
-
} else t8 = $[12];
|
|
198
|
-
let t9;
|
|
199
|
-
if ($[13] !== onError) {
|
|
200
|
-
t9 = (error) => {
|
|
127
|
+
},
|
|
128
|
+
onError: (error) => {
|
|
201
129
|
onError?.(error);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
$[14] = t9;
|
|
205
|
-
} else t9 = $[14];
|
|
206
|
-
let t10;
|
|
207
|
-
if ($[15] !== t8 || $[16] !== t9) {
|
|
208
|
-
t10 = {
|
|
209
|
-
onSuccess: t8,
|
|
210
|
-
onError: t9
|
|
211
|
-
};
|
|
212
|
-
$[15] = t8;
|
|
213
|
-
$[16] = t9;
|
|
214
|
-
$[17] = t10;
|
|
215
|
-
} else t10 = $[17];
|
|
216
|
-
const updateMutation = useGlobalUpdate(globalName, t10);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
217
132
|
const revertVersionMutation = useGlobalRevertVersion(globalName);
|
|
218
|
-
|
|
219
|
-
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
220
|
-
t11 = { legacyKey: "history" };
|
|
221
|
-
$[18] = t11;
|
|
222
|
-
} else t11 = $[18];
|
|
223
|
-
const [isHistoryOpen, setIsHistoryOpen] = useSidebarSearchParam("history", t11);
|
|
133
|
+
const [isHistoryOpen, setIsHistoryOpen] = useSidebarSearchParam("history", { legacyKey: "history" });
|
|
224
134
|
const [pendingRevertVersion, setPendingRevertVersion] = React.useState(null);
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
limit: 50
|
|
231
|
-
};
|
|
232
|
-
$[19] = t12;
|
|
233
|
-
$[20] = t13;
|
|
234
|
-
} else t13 = $[20];
|
|
235
|
-
const t14 = isHistoryOpen && !!globalSchema?.options?.versioning;
|
|
236
|
-
let t15;
|
|
237
|
-
if ($[21] !== t14) {
|
|
238
|
-
t15 = { enabled: t14 };
|
|
239
|
-
$[21] = t14;
|
|
240
|
-
$[22] = t15;
|
|
241
|
-
} else t15 = $[22];
|
|
242
|
-
const { data: versionsData, isLoading: versionsLoading } = useGlobalVersions(globalName, t13, t15);
|
|
243
|
-
let t16;
|
|
244
|
-
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
245
|
-
t16 = { limit: 50 };
|
|
246
|
-
$[23] = t16;
|
|
247
|
-
} else t16 = $[23];
|
|
248
|
-
let t17;
|
|
249
|
-
if ($[24] !== isHistoryOpen) {
|
|
250
|
-
t17 = { enabled: isHistoryOpen };
|
|
251
|
-
$[24] = isHistoryOpen;
|
|
252
|
-
$[25] = t17;
|
|
253
|
-
} else t17 = $[25];
|
|
254
|
-
const { data: auditData, isLoading: auditLoading } = useGlobalAuditHistory(globalName, t16, t17);
|
|
135
|
+
const { data: versionsData, isLoading: versionsLoading } = useGlobalVersions(globalName, {
|
|
136
|
+
id: globalData?.id,
|
|
137
|
+
limit: 50
|
|
138
|
+
}, { enabled: isHistoryOpen && !!globalSchema?.options?.versioning });
|
|
139
|
+
const { data: auditData, isLoading: auditLoading } = useGlobalAuditHistory(globalName, { limit: 50 }, { enabled: isHistoryOpen });
|
|
255
140
|
const workflowConfig = globalSchema?.options?.workflow;
|
|
256
141
|
const workflowEnabled = !!workflowConfig?.enabled;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
limit: 1
|
|
263
|
-
};
|
|
264
|
-
$[26] = t18;
|
|
265
|
-
$[27] = t19;
|
|
266
|
-
} else t19 = $[27];
|
|
267
|
-
const t20 = workflowEnabled && !!globalData?.id;
|
|
268
|
-
let t21;
|
|
269
|
-
if ($[28] !== t20) {
|
|
270
|
-
t21 = { enabled: t20 };
|
|
271
|
-
$[28] = t20;
|
|
272
|
-
$[29] = t21;
|
|
273
|
-
} else t21 = $[29];
|
|
274
|
-
const { data: latestVersionData } = useGlobalVersions(globalName, t19, t21);
|
|
142
|
+
/** Lightweight versions query (limit: 1) to read the current stage. */
|
|
143
|
+
const { data: latestVersionData } = useGlobalVersions(globalName, {
|
|
144
|
+
id: globalData?.id,
|
|
145
|
+
limit: 1
|
|
146
|
+
}, { enabled: workflowEnabled && !!globalData?.id });
|
|
275
147
|
const currentStage = latestVersionData?.[0]?.versionStage ?? workflowConfig?.initialStage ?? null;
|
|
276
|
-
workflowConfig?.stages;
|
|
277
|
-
let t22;
|
|
278
|
-
if ($[30] !== currentStage || $[31] !== workflowConfig?.stages) {
|
|
279
|
-
t22 = workflowConfig?.stages?.find((s) => s.name === currentStage) ?? null;
|
|
280
|
-
$[30] = currentStage;
|
|
281
|
-
$[31] = workflowConfig?.stages;
|
|
282
|
-
$[32] = t22;
|
|
283
|
-
} else t22 = $[32];
|
|
284
|
-
const currentStageConfig = t22;
|
|
148
|
+
const currentStageConfig = React.useMemo(() => workflowConfig?.stages?.find((s) => s.name === currentStage) ?? null, [workflowConfig?.stages, currentStage]);
|
|
285
149
|
const currentStageLabel = currentStageConfig?.label ?? currentStage ?? "";
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if (!workflowConfig?.stages || !currentStage)
|
|
289
|
-
let t24$2;
|
|
290
|
-
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
291
|
-
t24$2 = [];
|
|
292
|
-
$[33] = t24$2;
|
|
293
|
-
} else t24$2 = $[33];
|
|
294
|
-
t23 = t24$2;
|
|
295
|
-
break bb1;
|
|
296
|
-
}
|
|
150
|
+
/** Allowed transitions from the current stage. */
|
|
151
|
+
const allowedTransitions = React.useMemo(() => {
|
|
152
|
+
if (!workflowConfig?.stages || !currentStage) return [];
|
|
297
153
|
const stageNames = currentStageConfig?.transitions;
|
|
298
|
-
if (stageNames && stageNames.length > 0)
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
} else t25$1 = $[38];
|
|
307
|
-
t24$2 = stageNames.map(t25$1).filter(Boolean);
|
|
308
|
-
$[34] = stageNames;
|
|
309
|
-
$[35] = workflowConfig;
|
|
310
|
-
$[36] = t24$2;
|
|
311
|
-
} else t24$2 = $[36];
|
|
312
|
-
t23 = t24$2;
|
|
313
|
-
break bb1;
|
|
314
|
-
}
|
|
315
|
-
let t24$1;
|
|
316
|
-
if ($[39] !== currentStage || $[40] !== workflowConfig.stages) {
|
|
317
|
-
let t25$1;
|
|
318
|
-
if ($[42] !== currentStage) {
|
|
319
|
-
t25$1 = (s_1) => s_1.name !== currentStage;
|
|
320
|
-
$[42] = currentStage;
|
|
321
|
-
$[43] = t25$1;
|
|
322
|
-
} else t25$1 = $[43];
|
|
323
|
-
t24$1 = workflowConfig.stages.filter(t25$1);
|
|
324
|
-
$[39] = currentStage;
|
|
325
|
-
$[40] = workflowConfig.stages;
|
|
326
|
-
$[41] = t24$1;
|
|
327
|
-
} else t24$1 = $[41];
|
|
328
|
-
t23 = t24$1;
|
|
329
|
-
}
|
|
330
|
-
const allowedTransitions = t23;
|
|
331
|
-
let t24;
|
|
332
|
-
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
|
|
333
|
-
t24 = { mode: "global" };
|
|
334
|
-
$[44] = t24;
|
|
335
|
-
} else t24 = $[44];
|
|
336
|
-
const transitionMutation = useTransitionStage(globalName, t24);
|
|
154
|
+
if (stageNames && stageNames.length > 0) return stageNames.map((name) => workflowConfig.stages.find((s) => s.name === name)).filter(Boolean);
|
|
155
|
+
return workflowConfig.stages.filter((s) => s.name !== currentStage);
|
|
156
|
+
}, [
|
|
157
|
+
workflowConfig,
|
|
158
|
+
currentStage,
|
|
159
|
+
currentStageConfig
|
|
160
|
+
]);
|
|
161
|
+
const transitionMutation = useTransitionStage(globalName, { mode: "global" });
|
|
337
162
|
const [transitionTarget, setTransitionTarget] = React.useState(null);
|
|
338
163
|
const [transitionSchedule, setTransitionSchedule] = React.useState(false);
|
|
339
164
|
const [transitionScheduledAt, setTransitionScheduledAt] = React.useState(null);
|
|
340
165
|
const { resolver } = useGlobalServerValidation(globalName);
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
166
|
+
const form = useForm({
|
|
167
|
+
defaultValues: globalData ?? {},
|
|
168
|
+
resolver
|
|
169
|
+
});
|
|
170
|
+
/** Execute the confirmed workflow transition (immediate or scheduled). */
|
|
171
|
+
const confirmTransition = React.useCallback(() => {
|
|
172
|
+
if (!transitionTarget) return;
|
|
173
|
+
const params = { stage: transitionTarget.name };
|
|
174
|
+
if (transitionSchedule) {
|
|
175
|
+
if (transitionScheduledAt) params.scheduledAt = transitionScheduledAt;
|
|
176
|
+
}
|
|
177
|
+
const stageLabel = transitionTarget.label ? transitionTarget.label : transitionTarget.name;
|
|
178
|
+
const resetTransitionState = () => {
|
|
179
|
+
setTransitionTarget(null);
|
|
180
|
+
setTransitionSchedule(false);
|
|
181
|
+
setTransitionScheduledAt(null);
|
|
353
182
|
};
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
} else t27 = $[49];
|
|
358
|
-
const form = useForm(t27);
|
|
359
|
-
let t28;
|
|
360
|
-
if ($[50] !== form || $[51] !== t || $[52] !== transitionMutation || $[53] !== transitionSchedule || $[54] !== transitionScheduledAt || $[55] !== transitionTarget) {
|
|
361
|
-
t28 = () => {
|
|
362
|
-
if (!transitionTarget) return;
|
|
363
|
-
const params = { stage: transitionTarget.name };
|
|
364
|
-
if (transitionSchedule) {
|
|
365
|
-
if (transitionScheduledAt) params.scheduledAt = transitionScheduledAt;
|
|
183
|
+
transitionMutation.mutateAsync(params).then((result) => {
|
|
184
|
+
if (result) {
|
|
185
|
+
if (typeof result === "object") form.reset(result);
|
|
366
186
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
resetTransitionState();
|
|
390
|
-
});
|
|
391
|
-
};
|
|
392
|
-
$[50] = form;
|
|
393
|
-
$[51] = t;
|
|
394
|
-
$[52] = transitionMutation;
|
|
395
|
-
$[53] = transitionSchedule;
|
|
396
|
-
$[54] = transitionScheduledAt;
|
|
397
|
-
$[55] = transitionTarget;
|
|
398
|
-
$[56] = t28;
|
|
399
|
-
} else t28 = $[56];
|
|
400
|
-
const confirmTransition = t28;
|
|
187
|
+
if (transitionSchedule) if (transitionScheduledAt) toast.success(t("workflow.scheduledSuccess", {
|
|
188
|
+
stage: stageLabel,
|
|
189
|
+
date: transitionScheduledAt.toLocaleString()
|
|
190
|
+
}));
|
|
191
|
+
else toast.success(t("workflow.transitionSuccess", { stage: stageLabel }));
|
|
192
|
+
else toast.success(t("workflow.transitionSuccess", { stage: stageLabel }));
|
|
193
|
+
resetTransitionState();
|
|
194
|
+
}, (err) => {
|
|
195
|
+
let description;
|
|
196
|
+
if (err instanceof Error) description = err.message;
|
|
197
|
+
else description = t("error.unknown");
|
|
198
|
+
toast.error(t("workflow.transitionFailed"), { description });
|
|
199
|
+
resetTransitionState();
|
|
200
|
+
});
|
|
201
|
+
}, [
|
|
202
|
+
transitionTarget,
|
|
203
|
+
transitionSchedule,
|
|
204
|
+
transitionScheduledAt,
|
|
205
|
+
transitionMutation,
|
|
206
|
+
form,
|
|
207
|
+
t
|
|
208
|
+
]);
|
|
401
209
|
const prevLocaleRef = React.useRef(contentLocale);
|
|
402
210
|
const skipResetRef = React.useRef(false);
|
|
403
211
|
const localeSnapshotRef = React.useRef(null);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
212
|
+
const [localeChangeDialog, setLocaleChangeDialog] = React.useState({
|
|
213
|
+
open: false,
|
|
214
|
+
pendingLocale: null
|
|
215
|
+
});
|
|
216
|
+
const handleContentLocaleChange = React.useCallback((nextLocale) => {
|
|
217
|
+
if (nextLocale === prevLocaleRef.current) return;
|
|
218
|
+
if (form.formState.isDirty && !localeChangeDialog.open) {
|
|
219
|
+
skipResetRef.current = true;
|
|
220
|
+
localeSnapshotRef.current = form.getValues();
|
|
221
|
+
setLocaleChangeDialog({
|
|
222
|
+
open: true,
|
|
223
|
+
pendingLocale: nextLocale
|
|
224
|
+
});
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
prevLocaleRef.current = nextLocale;
|
|
228
|
+
skipResetRef.current = false;
|
|
229
|
+
setContentLocale(nextLocale);
|
|
230
|
+
}, [
|
|
231
|
+
form,
|
|
232
|
+
form.formState.isDirty,
|
|
233
|
+
localeChangeDialog.open,
|
|
234
|
+
setContentLocale
|
|
235
|
+
]);
|
|
236
|
+
const handleLocaleChangeConfirm = React.useCallback(() => {
|
|
237
|
+
skipResetRef.current = false;
|
|
238
|
+
localeSnapshotRef.current = null;
|
|
239
|
+
if (localeChangeDialog.pendingLocale) {
|
|
240
|
+
prevLocaleRef.current = localeChangeDialog.pendingLocale;
|
|
241
|
+
setContentLocale(localeChangeDialog.pendingLocale);
|
|
242
|
+
}
|
|
243
|
+
setLocaleChangeDialog({
|
|
244
|
+
open: false,
|
|
245
|
+
pendingLocale: null
|
|
246
|
+
});
|
|
247
|
+
}, [localeChangeDialog.pendingLocale, setContentLocale]);
|
|
248
|
+
React.useEffect(() => {
|
|
249
|
+
if (!localeChangeDialog.open) prevLocaleRef.current = contentLocale;
|
|
250
|
+
}, [contentLocale, localeChangeDialog.open]);
|
|
251
|
+
const handleLocaleChangeCancel = React.useCallback(() => {
|
|
252
|
+
skipResetRef.current = false;
|
|
253
|
+
if (localeSnapshotRef.current) form.reset(localeSnapshotRef.current, {
|
|
254
|
+
keepDirty: true,
|
|
255
|
+
keepDirtyValues: true,
|
|
256
|
+
keepErrors: true,
|
|
257
|
+
keepTouched: true
|
|
258
|
+
});
|
|
259
|
+
localeSnapshotRef.current = null;
|
|
260
|
+
setLocaleChangeDialog({
|
|
407
261
|
open: false,
|
|
408
262
|
pendingLocale: null
|
|
263
|
+
});
|
|
264
|
+
}, [form]);
|
|
265
|
+
React.useEffect(() => {
|
|
266
|
+
if (skipResetRef.current) return;
|
|
267
|
+
if (globalData) form.reset(globalData);
|
|
268
|
+
}, [form, globalData]);
|
|
269
|
+
const reactiveConfigs = React.useMemo(() => extractReactiveConfigs(globalSchema), [globalSchema]);
|
|
270
|
+
useReactiveFields({
|
|
271
|
+
collection: globalName,
|
|
272
|
+
mode: "global",
|
|
273
|
+
reactiveConfigs,
|
|
274
|
+
enabled: !dataLoading && Object.keys(reactiveConfigs).length > 0,
|
|
275
|
+
debounce: 300,
|
|
276
|
+
form
|
|
277
|
+
});
|
|
278
|
+
const resolvedConfig = React.useMemo(() => {
|
|
279
|
+
if (!viewConfig) return config;
|
|
280
|
+
return {
|
|
281
|
+
...config ?? {},
|
|
282
|
+
form: viewConfig
|
|
409
283
|
};
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
setLocaleChangeDialog({
|
|
421
|
-
open: true,
|
|
422
|
-
pendingLocale: nextLocale
|
|
284
|
+
}, [config, viewConfig]);
|
|
285
|
+
const onSubmit = React.useCallback(async (data) => {
|
|
286
|
+
try {
|
|
287
|
+
const result = await updateMutation.mutateAsync({ data });
|
|
288
|
+
if (result) form.reset(result);
|
|
289
|
+
} catch (error) {
|
|
290
|
+
if (error instanceof QuestpieClientError && error.fieldErrors && error.fieldErrors.length > 0) {
|
|
291
|
+
for (const fieldError of error.fieldErrors) form.setError(fieldError.path, {
|
|
292
|
+
type: "server",
|
|
293
|
+
message: fieldError.message
|
|
423
294
|
});
|
|
295
|
+
toast.error(t("toast.validationFailed"), { description: t("toast.validationDescription") });
|
|
424
296
|
return;
|
|
425
297
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
setContentLocale(nextLocale);
|
|
429
|
-
};
|
|
430
|
-
$[58] = form;
|
|
431
|
-
$[59] = localeChangeDialog.open;
|
|
432
|
-
$[60] = setContentLocale;
|
|
433
|
-
$[61] = t30;
|
|
434
|
-
} else t30 = $[61];
|
|
435
|
-
const handleContentLocaleChange = t30;
|
|
436
|
-
let t31;
|
|
437
|
-
if ($[62] !== localeChangeDialog.pendingLocale || $[63] !== setContentLocale) {
|
|
438
|
-
t31 = () => {
|
|
439
|
-
skipResetRef.current = false;
|
|
440
|
-
localeSnapshotRef.current = null;
|
|
441
|
-
if (localeChangeDialog.pendingLocale) {
|
|
442
|
-
prevLocaleRef.current = localeChangeDialog.pendingLocale;
|
|
443
|
-
setContentLocale(localeChangeDialog.pendingLocale);
|
|
444
|
-
}
|
|
445
|
-
setLocaleChangeDialog({
|
|
446
|
-
open: false,
|
|
447
|
-
pendingLocale: null
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
$[62] = localeChangeDialog.pendingLocale;
|
|
451
|
-
$[63] = setContentLocale;
|
|
452
|
-
$[64] = t31;
|
|
453
|
-
} else t31 = $[64];
|
|
454
|
-
const handleLocaleChangeConfirm = t31;
|
|
455
|
-
let t32;
|
|
456
|
-
let t33;
|
|
457
|
-
if ($[65] !== contentLocale || $[66] !== localeChangeDialog.open) {
|
|
458
|
-
t32 = () => {
|
|
459
|
-
if (!localeChangeDialog.open) prevLocaleRef.current = contentLocale;
|
|
460
|
-
};
|
|
461
|
-
t33 = [contentLocale, localeChangeDialog.open];
|
|
462
|
-
$[65] = contentLocale;
|
|
463
|
-
$[66] = localeChangeDialog.open;
|
|
464
|
-
$[67] = t32;
|
|
465
|
-
$[68] = t33;
|
|
466
|
-
} else {
|
|
467
|
-
t32 = $[67];
|
|
468
|
-
t33 = $[68];
|
|
469
|
-
}
|
|
470
|
-
React.useEffect(t32, t33);
|
|
471
|
-
let t34;
|
|
472
|
-
if ($[69] !== form) {
|
|
473
|
-
t34 = () => {
|
|
474
|
-
skipResetRef.current = false;
|
|
475
|
-
if (localeSnapshotRef.current) form.reset(localeSnapshotRef.current, {
|
|
476
|
-
keepDirty: true,
|
|
477
|
-
keepDirtyValues: true,
|
|
478
|
-
keepErrors: true,
|
|
479
|
-
keepTouched: true
|
|
480
|
-
});
|
|
481
|
-
localeSnapshotRef.current = null;
|
|
482
|
-
setLocaleChangeDialog({
|
|
483
|
-
open: false,
|
|
484
|
-
pendingLocale: null
|
|
485
|
-
});
|
|
486
|
-
};
|
|
487
|
-
$[69] = form;
|
|
488
|
-
$[70] = t34;
|
|
489
|
-
} else t34 = $[70];
|
|
490
|
-
const handleLocaleChangeCancel = t34;
|
|
491
|
-
let t35;
|
|
492
|
-
let t36;
|
|
493
|
-
if ($[71] !== form || $[72] !== globalData) {
|
|
494
|
-
t35 = () => {
|
|
495
|
-
if (skipResetRef.current) return;
|
|
496
|
-
if (globalData) form.reset(globalData);
|
|
497
|
-
};
|
|
498
|
-
t36 = [form, globalData];
|
|
499
|
-
$[71] = form;
|
|
500
|
-
$[72] = globalData;
|
|
501
|
-
$[73] = t35;
|
|
502
|
-
$[74] = t36;
|
|
503
|
-
} else {
|
|
504
|
-
t35 = $[73];
|
|
505
|
-
t36 = $[74];
|
|
506
|
-
}
|
|
507
|
-
React.useEffect(t35, t36);
|
|
508
|
-
let t37;
|
|
509
|
-
if ($[75] !== globalSchema) {
|
|
510
|
-
t37 = extractReactiveConfigs(globalSchema);
|
|
511
|
-
$[75] = globalSchema;
|
|
512
|
-
$[76] = t37;
|
|
513
|
-
} else t37 = $[76];
|
|
514
|
-
const reactiveConfigs = t37;
|
|
515
|
-
let t38;
|
|
516
|
-
if ($[77] !== dataLoading || $[78] !== reactiveConfigs) {
|
|
517
|
-
t38 = !dataLoading && Object.keys(reactiveConfigs).length > 0;
|
|
518
|
-
$[77] = dataLoading;
|
|
519
|
-
$[78] = reactiveConfigs;
|
|
520
|
-
$[79] = t38;
|
|
521
|
-
} else t38 = $[79];
|
|
522
|
-
let t39;
|
|
523
|
-
if ($[80] !== form || $[81] !== globalName || $[82] !== reactiveConfigs || $[83] !== t38) {
|
|
524
|
-
t39 = {
|
|
525
|
-
collection: globalName,
|
|
526
|
-
mode: "global",
|
|
527
|
-
reactiveConfigs,
|
|
528
|
-
enabled: t38,
|
|
529
|
-
debounce: 300,
|
|
530
|
-
form
|
|
531
|
-
};
|
|
532
|
-
$[80] = form;
|
|
533
|
-
$[81] = globalName;
|
|
534
|
-
$[82] = reactiveConfigs;
|
|
535
|
-
$[83] = t38;
|
|
536
|
-
$[84] = t39;
|
|
537
|
-
} else t39 = $[84];
|
|
538
|
-
useReactiveFields(t39);
|
|
539
|
-
let t40;
|
|
540
|
-
bb2: {
|
|
541
|
-
if (!viewConfig) {
|
|
542
|
-
t40 = config;
|
|
543
|
-
break bb2;
|
|
298
|
+
const message = error instanceof Error ? error.message : t("error.unknown");
|
|
299
|
+
toast.error(t("toast.settingsSaveFailed") || "Failed to save settings", { description: message });
|
|
544
300
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
$[88] = viewConfig;
|
|
559
|
-
$[89] = t42$1;
|
|
560
|
-
} else t42$1 = $[89];
|
|
561
|
-
t40 = t42$1;
|
|
562
|
-
}
|
|
563
|
-
const resolvedConfig = t40;
|
|
564
|
-
let t41;
|
|
565
|
-
if ($[90] !== form || $[91] !== t || $[92] !== updateMutation) {
|
|
566
|
-
t41 = async (data_0) => {
|
|
567
|
-
try {
|
|
568
|
-
const result_1 = await updateMutation.mutateAsync({ data: data_0 });
|
|
569
|
-
if (result_1) form.reset(result_1);
|
|
570
|
-
} catch (t42$1) {
|
|
571
|
-
const error_0 = t42$1;
|
|
572
|
-
if (error_0 instanceof QuestpieClientError && error_0.fieldErrors && error_0.fieldErrors.length > 0) {
|
|
573
|
-
for (const fieldError of error_0.fieldErrors) form.setError(fieldError.path, {
|
|
574
|
-
type: "server",
|
|
575
|
-
message: fieldError.message
|
|
576
|
-
});
|
|
577
|
-
toast.error(t("toast.validationFailed"), { description: t("toast.validationDescription") });
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
const message = error_0 instanceof Error ? error_0.message : t("error.unknown");
|
|
581
|
-
toast.error(t("toast.settingsSaveFailed") || "Failed to save settings", { description: message });
|
|
301
|
+
}, [
|
|
302
|
+
updateMutation,
|
|
303
|
+
form,
|
|
304
|
+
t
|
|
305
|
+
]);
|
|
306
|
+
React.useEffect(() => {
|
|
307
|
+
const handleKeyDown = (e) => {
|
|
308
|
+
if (shouldHandleAdminShortcut(e, {
|
|
309
|
+
allowEditableTarget: true,
|
|
310
|
+
key: "s"
|
|
311
|
+
})) {
|
|
312
|
+
e.preventDefault();
|
|
313
|
+
form.handleSubmit(onSubmit)();
|
|
582
314
|
}
|
|
583
315
|
};
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
$[93] = t41;
|
|
588
|
-
} else t41 = $[93];
|
|
589
|
-
const onSubmit = t41;
|
|
590
|
-
let t42;
|
|
591
|
-
let t43;
|
|
592
|
-
if ($[94] !== form || $[95] !== onSubmit) {
|
|
593
|
-
t42 = () => {
|
|
594
|
-
const handleKeyDown = (e) => {
|
|
595
|
-
if (shouldHandleAdminShortcut(e, {
|
|
596
|
-
allowEditableTarget: true,
|
|
597
|
-
key: "s"
|
|
598
|
-
})) {
|
|
599
|
-
e.preventDefault();
|
|
600
|
-
form.handleSubmit(onSubmit)();
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
604
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
605
|
-
};
|
|
606
|
-
t43 = [form, onSubmit];
|
|
607
|
-
$[94] = form;
|
|
608
|
-
$[95] = onSubmit;
|
|
609
|
-
$[96] = t42;
|
|
610
|
-
$[97] = t43;
|
|
611
|
-
} else {
|
|
612
|
-
t42 = $[96];
|
|
613
|
-
t43 = $[97];
|
|
614
|
-
}
|
|
615
|
-
React.useEffect(t42, t43);
|
|
316
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
317
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
318
|
+
}, [form, onSubmit]);
|
|
616
319
|
const isSubmitting = updateMutation.isPending || form.formState.isSubmitting;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
icon: "ph:arrow-clockwise",
|
|
651
|
-
className: "size-3.5"
|
|
652
|
-
});
|
|
653
|
-
$[106] = t47$1;
|
|
654
|
-
} else t47$1 = $[106];
|
|
655
|
-
let t48$1;
|
|
656
|
-
if ($[107] !== t) {
|
|
657
|
-
t48$1 = t("common.retry");
|
|
658
|
-
$[107] = t;
|
|
659
|
-
$[108] = t48$1;
|
|
660
|
-
} else t48$1 = $[108];
|
|
661
|
-
let t49$1;
|
|
662
|
-
if ($[109] !== t48$1) {
|
|
663
|
-
t49$1 = /* @__PURE__ */ jsxs(Button, {
|
|
664
|
-
variant: "outline",
|
|
665
|
-
size: "sm",
|
|
666
|
-
className: "gap-2",
|
|
667
|
-
onClick: _temp3,
|
|
668
|
-
children: [t47$1, t48$1]
|
|
669
|
-
});
|
|
670
|
-
$[109] = t48$1;
|
|
671
|
-
$[110] = t49$1;
|
|
672
|
-
} else t49$1 = $[110];
|
|
673
|
-
let t50$1;
|
|
674
|
-
if ($[111] !== t45$1 || $[112] !== t46$1 || $[113] !== t49$1) {
|
|
675
|
-
t50$1 = /* @__PURE__ */ jsx(EmptyState, {
|
|
676
|
-
variant: "error",
|
|
677
|
-
iconName: "ph:warning-circle",
|
|
678
|
-
title: t45$1,
|
|
679
|
-
description: t46$1,
|
|
680
|
-
height: "h-64",
|
|
681
|
-
action: t49$1
|
|
682
|
-
});
|
|
683
|
-
$[111] = t45$1;
|
|
684
|
-
$[112] = t46$1;
|
|
685
|
-
$[113] = t49$1;
|
|
686
|
-
$[114] = t50$1;
|
|
687
|
-
} else t50$1 = $[114];
|
|
688
|
-
return t50$1;
|
|
689
|
-
}
|
|
690
|
-
if (dataLoading) {
|
|
691
|
-
let t45$1;
|
|
692
|
-
if ($[115] === Symbol.for("react.memo_cache_sentinel")) {
|
|
693
|
-
t45$1 = /* @__PURE__ */ jsx(GlobalFormViewSkeleton, {});
|
|
694
|
-
$[115] = t45$1;
|
|
695
|
-
} else t45$1 = $[115];
|
|
696
|
-
return t45$1;
|
|
697
|
-
}
|
|
698
|
-
const t45 = resolvedConfig?.label ?? schemaFields?._globalLabel;
|
|
699
|
-
let t46;
|
|
700
|
-
if ($[116] !== globalName || $[117] !== resolveText || $[118] !== t45) {
|
|
701
|
-
t46 = resolveText(t45, globalName);
|
|
702
|
-
$[116] = globalName;
|
|
703
|
-
$[117] = resolveText;
|
|
704
|
-
$[118] = t45;
|
|
705
|
-
$[119] = t46;
|
|
706
|
-
} else t46 = $[119];
|
|
707
|
-
const globalLabel = t46;
|
|
708
|
-
let t47;
|
|
709
|
-
if ($[120] !== form || $[121] !== onSubmit) {
|
|
710
|
-
t47 = form.handleSubmit(onSubmit);
|
|
711
|
-
$[120] = form;
|
|
712
|
-
$[121] = onSubmit;
|
|
713
|
-
$[122] = t47;
|
|
714
|
-
} else t47 = $[122];
|
|
715
|
-
let t48;
|
|
716
|
-
if ($[123] !== contentLocale || $[124] !== handleContentLocaleChange || $[125] !== localeOptions) {
|
|
717
|
-
t48 = localeOptions.length > 0 && /* @__PURE__ */ jsx(LocaleSwitcher, {
|
|
718
|
-
locales: localeOptions,
|
|
719
|
-
value: contentLocale,
|
|
720
|
-
onChange: handleContentLocaleChange
|
|
721
|
-
});
|
|
722
|
-
$[123] = contentLocale;
|
|
723
|
-
$[124] = handleContentLocaleChange;
|
|
724
|
-
$[125] = localeOptions;
|
|
725
|
-
$[126] = t48;
|
|
726
|
-
} else t48 = $[126];
|
|
727
|
-
let t49;
|
|
728
|
-
if ($[127] !== currentStage || $[128] !== currentStageLabel || $[129] !== workflowEnabled) {
|
|
729
|
-
t49 = workflowEnabled && currentStage && /* @__PURE__ */ jsxs(Badge, {
|
|
730
|
-
variant: "outline",
|
|
731
|
-
className: "gap-1.5",
|
|
732
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
733
|
-
icon: "ph:git-branch",
|
|
734
|
-
className: "size-3"
|
|
735
|
-
}), currentStageLabel]
|
|
736
|
-
});
|
|
737
|
-
$[127] = currentStage;
|
|
738
|
-
$[128] = currentStageLabel;
|
|
739
|
-
$[129] = workflowEnabled;
|
|
740
|
-
$[130] = t49;
|
|
741
|
-
} else t49 = $[130];
|
|
742
|
-
let t50;
|
|
743
|
-
if ($[131] !== t48 || $[132] !== t49) {
|
|
744
|
-
t50 = /* @__PURE__ */ jsxs(Fragment, { children: [t48, t49] });
|
|
745
|
-
$[131] = t48;
|
|
746
|
-
$[132] = t49;
|
|
747
|
-
$[133] = t50;
|
|
748
|
-
} else t50 = $[133];
|
|
749
|
-
let t51;
|
|
750
|
-
if ($[134] !== globalData || $[135] !== showMeta || $[136] !== t) {
|
|
751
|
-
t51 = showMeta && globalData?.updatedAt ? /* @__PURE__ */ jsxs("span", { children: [
|
|
752
|
-
t("form.lastUpdated"),
|
|
753
|
-
": ",
|
|
754
|
-
formatDate(globalData.updatedAt)
|
|
755
|
-
] }) : void 0;
|
|
756
|
-
$[134] = globalData;
|
|
757
|
-
$[135] = showMeta;
|
|
758
|
-
$[136] = t;
|
|
759
|
-
$[137] = t51;
|
|
760
|
-
} else t51 = $[137];
|
|
761
|
-
let t52;
|
|
762
|
-
if ($[138] !== allowedTransitions || $[139] !== t || $[140] !== workflowEnabled) {
|
|
763
|
-
t52 = workflowEnabled && allowedTransitions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
764
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
765
|
-
type: "button",
|
|
766
|
-
variant: "outline",
|
|
767
|
-
size: "sm",
|
|
768
|
-
className: "gap-2"
|
|
769
|
-
}),
|
|
770
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
771
|
-
icon: "ph:arrows-left-right",
|
|
772
|
-
className: "size-3.5"
|
|
773
|
-
}), t("workflow.transition")]
|
|
774
|
-
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
775
|
-
align: "end",
|
|
776
|
-
children: allowedTransitions.map((stage) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
777
|
-
onClick: () => setTransitionTarget({
|
|
778
|
-
name: stage.name,
|
|
779
|
-
label: stage.label
|
|
780
|
-
}),
|
|
781
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
782
|
-
icon: "ph:arrow-right",
|
|
783
|
-
className: "mr-2 size-4"
|
|
784
|
-
}), stage.label || stage.name]
|
|
785
|
-
}, stage.name))
|
|
786
|
-
})] });
|
|
787
|
-
$[138] = allowedTransitions;
|
|
788
|
-
$[139] = t;
|
|
789
|
-
$[140] = workflowEnabled;
|
|
790
|
-
$[141] = t52;
|
|
791
|
-
} else t52 = $[141];
|
|
792
|
-
let t53;
|
|
793
|
-
if ($[142] !== setIsHistoryOpen) {
|
|
794
|
-
t53 = () => setIsHistoryOpen(true);
|
|
795
|
-
$[142] = setIsHistoryOpen;
|
|
796
|
-
$[143] = t53;
|
|
797
|
-
} else t53 = $[143];
|
|
798
|
-
let t54;
|
|
799
|
-
if ($[144] !== t) {
|
|
800
|
-
t54 = t("history.title");
|
|
801
|
-
$[144] = t;
|
|
802
|
-
$[145] = t54;
|
|
803
|
-
} else t54 = $[145];
|
|
804
|
-
let t55;
|
|
805
|
-
if ($[146] === Symbol.for("react.memo_cache_sentinel")) {
|
|
806
|
-
t55 = /* @__PURE__ */ jsx(Icon, {
|
|
807
|
-
icon: "ph:clock-counter-clockwise",
|
|
808
|
-
className: "size-3.5"
|
|
809
|
-
});
|
|
810
|
-
$[146] = t55;
|
|
811
|
-
} else t55 = $[146];
|
|
812
|
-
let t56;
|
|
813
|
-
if ($[147] !== t) {
|
|
814
|
-
t56 = t("history.title");
|
|
815
|
-
$[147] = t;
|
|
816
|
-
$[148] = t56;
|
|
817
|
-
} else t56 = $[148];
|
|
818
|
-
let t57;
|
|
819
|
-
if ($[149] !== t56) {
|
|
820
|
-
t57 = /* @__PURE__ */ jsx("span", {
|
|
821
|
-
className: "sr-only",
|
|
822
|
-
children: t56
|
|
823
|
-
});
|
|
824
|
-
$[149] = t56;
|
|
825
|
-
$[150] = t57;
|
|
826
|
-
} else t57 = $[150];
|
|
827
|
-
let t58;
|
|
828
|
-
if ($[151] !== t53 || $[152] !== t54 || $[153] !== t57) {
|
|
829
|
-
t58 = /* @__PURE__ */ jsxs(Button, {
|
|
830
|
-
type: "button",
|
|
320
|
+
const confirmRevertVersion = React.useCallback(async () => {
|
|
321
|
+
if (!pendingRevertVersion) return;
|
|
322
|
+
const payload = {};
|
|
323
|
+
if (typeof globalData?.id === "string") payload.id = globalData.id;
|
|
324
|
+
if (typeof pendingRevertVersion.versionId === "string") payload.versionId = pendingRevertVersion.versionId;
|
|
325
|
+
else if (typeof pendingRevertVersion.versionNumber === "number") payload.version = pendingRevertVersion.versionNumber;
|
|
326
|
+
const result = await revertVersionMutation.mutateAsync(payload);
|
|
327
|
+
form.reset(result);
|
|
328
|
+
toast.success(t("version.revertSuccess"));
|
|
329
|
+
setPendingRevertVersion(null);
|
|
330
|
+
}, [
|
|
331
|
+
pendingRevertVersion,
|
|
332
|
+
globalData,
|
|
333
|
+
revertVersionMutation,
|
|
334
|
+
form,
|
|
335
|
+
t
|
|
336
|
+
]);
|
|
337
|
+
const formatDate = (date) => {
|
|
338
|
+
return new Date(date).toLocaleDateString(void 0, {
|
|
339
|
+
year: "numeric",
|
|
340
|
+
month: "short",
|
|
341
|
+
day: "numeric",
|
|
342
|
+
hour: "2-digit",
|
|
343
|
+
minute: "2-digit"
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
if (dataError) return /* @__PURE__ */ jsx(EmptyState, {
|
|
347
|
+
variant: "error",
|
|
348
|
+
iconName: "ph:warning-circle",
|
|
349
|
+
title: t("error.failedToLoad"),
|
|
350
|
+
description: dataError instanceof Error ? dataError.message : void 0,
|
|
351
|
+
height: "h-64",
|
|
352
|
+
action: /* @__PURE__ */ jsxs(Button, {
|
|
831
353
|
variant: "outline",
|
|
832
|
-
size: "icon-sm",
|
|
833
|
-
onClick: t53,
|
|
834
|
-
title: t54,
|
|
835
|
-
children: [t55, t57]
|
|
836
|
-
});
|
|
837
|
-
$[151] = t53;
|
|
838
|
-
$[152] = t54;
|
|
839
|
-
$[153] = t57;
|
|
840
|
-
$[154] = t58;
|
|
841
|
-
} else t58 = $[154];
|
|
842
|
-
let t59;
|
|
843
|
-
if ($[155] !== isSubmitting || $[156] !== t) {
|
|
844
|
-
t59 = isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
845
|
-
icon: "ph:spinner-gap",
|
|
846
|
-
className: "size-4 animate-spin"
|
|
847
|
-
}), t("common.loading")] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
848
|
-
icon: "ph:check",
|
|
849
|
-
width: 16,
|
|
850
|
-
height: 16
|
|
851
|
-
}), t("common.save")] });
|
|
852
|
-
$[155] = isSubmitting;
|
|
853
|
-
$[156] = t;
|
|
854
|
-
$[157] = t59;
|
|
855
|
-
} else t59 = $[157];
|
|
856
|
-
let t60;
|
|
857
|
-
if ($[158] !== isSubmitting || $[159] !== t59) {
|
|
858
|
-
t60 = /* @__PURE__ */ jsx(Button, {
|
|
859
|
-
type: "submit",
|
|
860
354
|
size: "sm",
|
|
861
|
-
disabled: isSubmitting,
|
|
862
|
-
className: "gap-2",
|
|
863
|
-
children: t59
|
|
864
|
-
});
|
|
865
|
-
$[158] = isSubmitting;
|
|
866
|
-
$[159] = t59;
|
|
867
|
-
$[160] = t60;
|
|
868
|
-
} else t60 = $[160];
|
|
869
|
-
let t61;
|
|
870
|
-
if ($[161] !== headerActions || $[162] !== t52 || $[163] !== t58 || $[164] !== t60) {
|
|
871
|
-
t61 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
872
|
-
headerActions,
|
|
873
|
-
t52,
|
|
874
|
-
t58,
|
|
875
|
-
t60
|
|
876
|
-
] });
|
|
877
|
-
$[161] = headerActions;
|
|
878
|
-
$[162] = t52;
|
|
879
|
-
$[163] = t58;
|
|
880
|
-
$[164] = t60;
|
|
881
|
-
$[165] = t61;
|
|
882
|
-
} else t61 = $[165];
|
|
883
|
-
let t62;
|
|
884
|
-
if ($[166] !== globalLabel || $[167] !== t50 || $[168] !== t51 || $[169] !== t61) {
|
|
885
|
-
t62 = /* @__PURE__ */ jsx(AdminViewHeader, {
|
|
886
|
-
className: "qa-global-form__header",
|
|
887
|
-
title: globalLabel,
|
|
888
|
-
titleAccessory: t50,
|
|
889
|
-
meta: t51,
|
|
890
|
-
actions: t61
|
|
891
|
-
});
|
|
892
|
-
$[166] = globalLabel;
|
|
893
|
-
$[167] = t50;
|
|
894
|
-
$[168] = t51;
|
|
895
|
-
$[169] = t61;
|
|
896
|
-
$[170] = t62;
|
|
897
|
-
} else t62 = $[170];
|
|
898
|
-
let t63;
|
|
899
|
-
if ($[171] !== globalName || $[172] !== registry || $[173] !== resolvedConfig) {
|
|
900
|
-
t63 = /* @__PURE__ */ jsx(AutoFormFields, {
|
|
901
|
-
collection: globalName,
|
|
902
|
-
mode: "global",
|
|
903
|
-
config: resolvedConfig,
|
|
904
|
-
registry
|
|
905
|
-
});
|
|
906
|
-
$[171] = globalName;
|
|
907
|
-
$[172] = registry;
|
|
908
|
-
$[173] = resolvedConfig;
|
|
909
|
-
$[174] = t63;
|
|
910
|
-
} else t63 = $[174];
|
|
911
|
-
let t64;
|
|
912
|
-
if ($[175] !== t47 || $[176] !== t62 || $[177] !== t63) {
|
|
913
|
-
t64 = /* @__PURE__ */ jsxs("form", {
|
|
914
|
-
onSubmit: t47,
|
|
915
|
-
className: "qa-global-form w-full space-y-4",
|
|
916
|
-
children: [t62, t63]
|
|
917
|
-
});
|
|
918
|
-
$[175] = t47;
|
|
919
|
-
$[176] = t62;
|
|
920
|
-
$[177] = t63;
|
|
921
|
-
$[178] = t64;
|
|
922
|
-
} else t64 = $[178];
|
|
923
|
-
let t65;
|
|
924
|
-
if ($[179] !== auditData) {
|
|
925
|
-
t65 = auditData ?? [];
|
|
926
|
-
$[179] = auditData;
|
|
927
|
-
$[180] = t65;
|
|
928
|
-
} else t65 = $[180];
|
|
929
|
-
let t66;
|
|
930
|
-
if ($[181] !== versionsData) {
|
|
931
|
-
t66 = versionsData ?? [];
|
|
932
|
-
$[181] = versionsData;
|
|
933
|
-
$[182] = t66;
|
|
934
|
-
} else t66 = $[182];
|
|
935
|
-
const t67 = t66;
|
|
936
|
-
const t68 = globalSchema?.fields;
|
|
937
|
-
let t69;
|
|
938
|
-
if ($[183] === Symbol.for("react.memo_cache_sentinel")) {
|
|
939
|
-
t69 = async (version) => {
|
|
940
|
-
setPendingRevertVersion(version);
|
|
941
|
-
};
|
|
942
|
-
$[183] = t69;
|
|
943
|
-
} else t69 = $[183];
|
|
944
|
-
const t70 = !!globalSchema?.options?.versioning;
|
|
945
|
-
let t71;
|
|
946
|
-
if ($[184] !== auditLoading || $[185] !== isHistoryOpen || $[186] !== revertVersionMutation.isPending || $[187] !== setIsHistoryOpen || $[188] !== t65 || $[189] !== t67 || $[190] !== t68 || $[191] !== t70 || $[192] !== versionsLoading) {
|
|
947
|
-
t71 = /* @__PURE__ */ jsx(HistorySidebar, {
|
|
948
|
-
open: isHistoryOpen,
|
|
949
|
-
onOpenChange: setIsHistoryOpen,
|
|
950
|
-
auditEntries: t65,
|
|
951
|
-
isLoadingAudit: auditLoading,
|
|
952
|
-
versions: t67,
|
|
953
|
-
fields: t68,
|
|
954
|
-
isLoadingVersions: versionsLoading,
|
|
955
|
-
isReverting: revertVersionMutation.isPending,
|
|
956
|
-
onRevert: t69,
|
|
957
|
-
showVersionsTab: t70
|
|
958
|
-
});
|
|
959
|
-
$[184] = auditLoading;
|
|
960
|
-
$[185] = isHistoryOpen;
|
|
961
|
-
$[186] = revertVersionMutation.isPending;
|
|
962
|
-
$[187] = setIsHistoryOpen;
|
|
963
|
-
$[188] = t65;
|
|
964
|
-
$[189] = t67;
|
|
965
|
-
$[190] = t68;
|
|
966
|
-
$[191] = t70;
|
|
967
|
-
$[192] = versionsLoading;
|
|
968
|
-
$[193] = t71;
|
|
969
|
-
} else t71 = $[193];
|
|
970
|
-
const t72 = !!pendingRevertVersion;
|
|
971
|
-
let t73;
|
|
972
|
-
if ($[194] === Symbol.for("react.memo_cache_sentinel")) {
|
|
973
|
-
t73 = (open) => {
|
|
974
|
-
if (!open) setPendingRevertVersion(null);
|
|
975
|
-
};
|
|
976
|
-
$[194] = t73;
|
|
977
|
-
} else t73 = $[194];
|
|
978
|
-
let t74;
|
|
979
|
-
if ($[195] !== t) {
|
|
980
|
-
t74 = t("version.revertConfirmTitle");
|
|
981
|
-
$[195] = t;
|
|
982
|
-
$[196] = t74;
|
|
983
|
-
} else t74 = $[196];
|
|
984
|
-
const t75 = pendingRevertVersion?.versionNumber ?? pendingRevertVersion?.versionId ?? "-";
|
|
985
|
-
let t76;
|
|
986
|
-
if ($[197] !== t || $[198] !== t75) {
|
|
987
|
-
t76 = t("version.revertConfirmDescription", { number: t75 });
|
|
988
|
-
$[197] = t;
|
|
989
|
-
$[198] = t75;
|
|
990
|
-
$[199] = t76;
|
|
991
|
-
} else t76 = $[199];
|
|
992
|
-
let t77;
|
|
993
|
-
if ($[200] !== t) {
|
|
994
|
-
t77 = t("version.revert");
|
|
995
|
-
$[200] = t;
|
|
996
|
-
$[201] = t77;
|
|
997
|
-
} else t77 = $[201];
|
|
998
|
-
let t78;
|
|
999
|
-
if ($[202] !== t) {
|
|
1000
|
-
t78 = t("common.cancel");
|
|
1001
|
-
$[202] = t;
|
|
1002
|
-
$[203] = t78;
|
|
1003
|
-
} else t78 = $[203];
|
|
1004
|
-
let t79;
|
|
1005
|
-
if ($[204] !== t74 || $[205] !== t76 || $[206] !== t77 || $[207] !== t78) {
|
|
1006
|
-
t79 = {
|
|
1007
|
-
title: t74,
|
|
1008
|
-
description: t76,
|
|
1009
|
-
confirmLabel: t77,
|
|
1010
|
-
cancelLabel: t78,
|
|
1011
|
-
destructive: false
|
|
1012
|
-
};
|
|
1013
|
-
$[204] = t74;
|
|
1014
|
-
$[205] = t76;
|
|
1015
|
-
$[206] = t77;
|
|
1016
|
-
$[207] = t78;
|
|
1017
|
-
$[208] = t79;
|
|
1018
|
-
} else t79 = $[208];
|
|
1019
|
-
let t80;
|
|
1020
|
-
if ($[209] !== confirmRevertVersion || $[210] !== revertVersionMutation.isPending || $[211] !== t72 || $[212] !== t79) {
|
|
1021
|
-
t80 = /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
1022
|
-
open: t72,
|
|
1023
|
-
onOpenChange: t73,
|
|
1024
|
-
config: t79,
|
|
1025
|
-
onConfirm: confirmRevertVersion,
|
|
1026
|
-
loading: revertVersionMutation.isPending
|
|
1027
|
-
});
|
|
1028
|
-
$[209] = confirmRevertVersion;
|
|
1029
|
-
$[210] = revertVersionMutation.isPending;
|
|
1030
|
-
$[211] = t72;
|
|
1031
|
-
$[212] = t79;
|
|
1032
|
-
$[213] = t80;
|
|
1033
|
-
} else t80 = $[213];
|
|
1034
|
-
const t81 = !!transitionTarget;
|
|
1035
|
-
let t82;
|
|
1036
|
-
if ($[214] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1037
|
-
t82 = (open_0) => {
|
|
1038
|
-
if (!open_0) {
|
|
1039
|
-
setTransitionTarget(null);
|
|
1040
|
-
setTransitionSchedule(false);
|
|
1041
|
-
setTransitionScheduledAt(null);
|
|
1042
|
-
}
|
|
1043
|
-
};
|
|
1044
|
-
$[214] = t82;
|
|
1045
|
-
} else t82 = $[214];
|
|
1046
|
-
let t83;
|
|
1047
|
-
if ($[215] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1048
|
-
t83 = /* @__PURE__ */ jsx(Icon, {
|
|
1049
|
-
icon: "ph:arrows-left-right",
|
|
1050
|
-
className: "size-5"
|
|
1051
|
-
});
|
|
1052
|
-
$[215] = t83;
|
|
1053
|
-
} else t83 = $[215];
|
|
1054
|
-
const t84 = transitionTarget?.label ?? transitionTarget?.name ?? "";
|
|
1055
|
-
let t85;
|
|
1056
|
-
if ($[216] !== t || $[217] !== t84) {
|
|
1057
|
-
t85 = t("workflow.transitionTo", { stage: t84 });
|
|
1058
|
-
$[216] = t;
|
|
1059
|
-
$[217] = t84;
|
|
1060
|
-
$[218] = t85;
|
|
1061
|
-
} else t85 = $[218];
|
|
1062
|
-
let t86;
|
|
1063
|
-
if ($[219] !== t85) {
|
|
1064
|
-
t86 = /* @__PURE__ */ jsxs(DialogTitle, {
|
|
1065
|
-
className: "flex items-center gap-2",
|
|
1066
|
-
children: [t83, t85]
|
|
1067
|
-
});
|
|
1068
|
-
$[219] = t85;
|
|
1069
|
-
$[220] = t86;
|
|
1070
|
-
} else t86 = $[220];
|
|
1071
|
-
const t87 = transitionTarget?.label ?? transitionTarget?.name ?? "";
|
|
1072
|
-
let t88;
|
|
1073
|
-
if ($[221] !== currentStageLabel || $[222] !== t || $[223] !== t87) {
|
|
1074
|
-
t88 = t("workflow.transitionDescription", {
|
|
1075
|
-
from: currentStageLabel,
|
|
1076
|
-
to: t87
|
|
1077
|
-
});
|
|
1078
|
-
$[221] = currentStageLabel;
|
|
1079
|
-
$[222] = t;
|
|
1080
|
-
$[223] = t87;
|
|
1081
|
-
$[224] = t88;
|
|
1082
|
-
} else t88 = $[224];
|
|
1083
|
-
let t89;
|
|
1084
|
-
if ($[225] !== t88) {
|
|
1085
|
-
t89 = /* @__PURE__ */ jsx(DialogDescription, { children: t88 });
|
|
1086
|
-
$[225] = t88;
|
|
1087
|
-
$[226] = t89;
|
|
1088
|
-
} else t89 = $[226];
|
|
1089
|
-
let t90;
|
|
1090
|
-
if ($[227] !== t86 || $[228] !== t89) {
|
|
1091
|
-
t90 = /* @__PURE__ */ jsxs(DialogHeader, { children: [t86, t89] });
|
|
1092
|
-
$[227] = t86;
|
|
1093
|
-
$[228] = t89;
|
|
1094
|
-
$[229] = t90;
|
|
1095
|
-
} else t90 = $[229];
|
|
1096
|
-
let t91;
|
|
1097
|
-
if ($[230] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1098
|
-
t91 = (val) => {
|
|
1099
|
-
setTransitionSchedule(!!val);
|
|
1100
|
-
if (!val) setTransitionScheduledAt(null);
|
|
1101
|
-
};
|
|
1102
|
-
$[230] = t91;
|
|
1103
|
-
} else t91 = $[230];
|
|
1104
|
-
let t92;
|
|
1105
|
-
if ($[231] !== transitionSchedule) {
|
|
1106
|
-
t92 = /* @__PURE__ */ jsx(Checkbox, {
|
|
1107
|
-
checked: transitionSchedule,
|
|
1108
|
-
onCheckedChange: t91,
|
|
1109
|
-
id: "global-transition-schedule"
|
|
1110
|
-
});
|
|
1111
|
-
$[231] = transitionSchedule;
|
|
1112
|
-
$[232] = t92;
|
|
1113
|
-
} else t92 = $[232];
|
|
1114
|
-
let t93;
|
|
1115
|
-
if ($[233] !== t) {
|
|
1116
|
-
t93 = t("workflow.scheduleLabel");
|
|
1117
|
-
$[233] = t;
|
|
1118
|
-
$[234] = t93;
|
|
1119
|
-
} else t93 = $[234];
|
|
1120
|
-
let t94;
|
|
1121
|
-
if ($[235] !== t93) {
|
|
1122
|
-
t94 = /* @__PURE__ */ jsx(Label, {
|
|
1123
|
-
htmlFor: "global-transition-schedule",
|
|
1124
|
-
className: "cursor-pointer text-sm",
|
|
1125
|
-
children: t93
|
|
1126
|
-
});
|
|
1127
|
-
$[235] = t93;
|
|
1128
|
-
$[236] = t94;
|
|
1129
|
-
} else t94 = $[236];
|
|
1130
|
-
let t95;
|
|
1131
|
-
if ($[237] !== t92 || $[238] !== t94) {
|
|
1132
|
-
t95 = /* @__PURE__ */ jsxs("div", {
|
|
1133
|
-
className: "flex items-center gap-2",
|
|
1134
|
-
children: [t92, t94]
|
|
1135
|
-
});
|
|
1136
|
-
$[237] = t92;
|
|
1137
|
-
$[238] = t94;
|
|
1138
|
-
$[239] = t95;
|
|
1139
|
-
} else t95 = $[239];
|
|
1140
|
-
let t96;
|
|
1141
|
-
if ($[240] !== t || $[241] !== transitionSchedule || $[242] !== transitionScheduledAt) {
|
|
1142
|
-
t96 = transitionSchedule && /* @__PURE__ */ jsxs("div", {
|
|
1143
|
-
className: "space-y-1.5 pl-6",
|
|
1144
|
-
children: [
|
|
1145
|
-
/* @__PURE__ */ jsx(Label, {
|
|
1146
|
-
className: "text-muted-foreground text-xs",
|
|
1147
|
-
children: t("workflow.scheduledAt")
|
|
1148
|
-
}),
|
|
1149
|
-
/* @__PURE__ */ jsx(DateTimeInput, {
|
|
1150
|
-
value: transitionScheduledAt,
|
|
1151
|
-
onChange: setTransitionScheduledAt,
|
|
1152
|
-
minDate: /* @__PURE__ */ new Date()
|
|
1153
|
-
}),
|
|
1154
|
-
/* @__PURE__ */ jsx("p", {
|
|
1155
|
-
className: "text-muted-foreground text-xs",
|
|
1156
|
-
children: t("workflow.scheduledDescription")
|
|
1157
|
-
})
|
|
1158
|
-
]
|
|
1159
|
-
});
|
|
1160
|
-
$[240] = t;
|
|
1161
|
-
$[241] = transitionSchedule;
|
|
1162
|
-
$[242] = transitionScheduledAt;
|
|
1163
|
-
$[243] = t96;
|
|
1164
|
-
} else t96 = $[243];
|
|
1165
|
-
let t97;
|
|
1166
|
-
if ($[244] !== t95 || $[245] !== t96) {
|
|
1167
|
-
t97 = /* @__PURE__ */ jsxs("div", {
|
|
1168
|
-
className: "space-y-3 py-2",
|
|
1169
|
-
children: [t95, t96]
|
|
1170
|
-
});
|
|
1171
|
-
$[244] = t95;
|
|
1172
|
-
$[245] = t96;
|
|
1173
|
-
$[246] = t97;
|
|
1174
|
-
} else t97 = $[246];
|
|
1175
|
-
let t98;
|
|
1176
|
-
if ($[247] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1177
|
-
t98 = () => {
|
|
1178
|
-
setTransitionTarget(null);
|
|
1179
|
-
setTransitionSchedule(false);
|
|
1180
|
-
setTransitionScheduledAt(null);
|
|
1181
|
-
};
|
|
1182
|
-
$[247] = t98;
|
|
1183
|
-
} else t98 = $[247];
|
|
1184
|
-
let t99;
|
|
1185
|
-
if ($[248] !== t) {
|
|
1186
|
-
t99 = t("common.cancel");
|
|
1187
|
-
$[248] = t;
|
|
1188
|
-
$[249] = t99;
|
|
1189
|
-
} else t99 = $[249];
|
|
1190
|
-
let t100;
|
|
1191
|
-
if ($[250] !== t99) {
|
|
1192
|
-
t100 = /* @__PURE__ */ jsx(Button, {
|
|
1193
|
-
type: "button",
|
|
1194
|
-
variant: "outline",
|
|
1195
|
-
onClick: t98,
|
|
1196
|
-
children: t99
|
|
1197
|
-
});
|
|
1198
|
-
$[250] = t99;
|
|
1199
|
-
$[251] = t100;
|
|
1200
|
-
} else t100 = $[251];
|
|
1201
|
-
const t101 = transitionMutation.isPending || transitionSchedule && !transitionScheduledAt;
|
|
1202
|
-
let t102;
|
|
1203
|
-
if ($[252] !== transitionMutation.isPending) {
|
|
1204
|
-
t102 = transitionMutation.isPending && /* @__PURE__ */ jsx(Icon, {
|
|
1205
|
-
icon: "ph:spinner-gap",
|
|
1206
|
-
className: "size-4 animate-spin"
|
|
1207
|
-
});
|
|
1208
|
-
$[252] = transitionMutation.isPending;
|
|
1209
|
-
$[253] = t102;
|
|
1210
|
-
} else t102 = $[253];
|
|
1211
|
-
let t103;
|
|
1212
|
-
if ($[254] !== t || $[255] !== transitionSchedule) {
|
|
1213
|
-
t103 = transitionSchedule ? t("workflow.scheduleLabel") : t("workflow.transition");
|
|
1214
|
-
$[254] = t;
|
|
1215
|
-
$[255] = transitionSchedule;
|
|
1216
|
-
$[256] = t103;
|
|
1217
|
-
} else t103 = $[256];
|
|
1218
|
-
let t104;
|
|
1219
|
-
if ($[257] !== confirmTransition || $[258] !== t101 || $[259] !== t102 || $[260] !== t103) {
|
|
1220
|
-
t104 = /* @__PURE__ */ jsxs(Button, {
|
|
1221
|
-
type: "button",
|
|
1222
|
-
onClick: confirmTransition,
|
|
1223
|
-
disabled: t101,
|
|
1224
355
|
className: "gap-2",
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
356
|
+
onClick: () => window.location.reload(),
|
|
357
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
358
|
+
icon: "ph:arrow-clockwise",
|
|
359
|
+
className: "size-3.5"
|
|
360
|
+
}), t("common.retry")]
|
|
361
|
+
})
|
|
362
|
+
});
|
|
363
|
+
if (dataLoading) return /* @__PURE__ */ jsx(GlobalFormViewSkeleton, {});
|
|
364
|
+
const globalLabel = resolveText(resolvedConfig?.label ?? schemaFields?._globalLabel, globalName);
|
|
365
|
+
return /* @__PURE__ */ jsxs(FormProvider, {
|
|
366
|
+
...form,
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ jsxs("form", {
|
|
369
|
+
onSubmit: form.handleSubmit(onSubmit),
|
|
370
|
+
className: "qa-global-form w-full space-y-4",
|
|
371
|
+
children: [/* @__PURE__ */ jsx(AdminViewHeader, {
|
|
372
|
+
className: "qa-global-form__header",
|
|
373
|
+
title: globalLabel,
|
|
374
|
+
titleAccessory: /* @__PURE__ */ jsxs(Fragment, { children: [localeOptions.length > 0 && /* @__PURE__ */ jsx(LocaleSwitcher, {
|
|
375
|
+
locales: localeOptions,
|
|
376
|
+
value: contentLocale,
|
|
377
|
+
onChange: handleContentLocaleChange
|
|
378
|
+
}), workflowEnabled && currentStage && /* @__PURE__ */ jsxs(Badge, {
|
|
379
|
+
variant: "outline",
|
|
380
|
+
className: "gap-1.5",
|
|
381
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
382
|
+
icon: "ph:git-branch",
|
|
383
|
+
className: "size-3"
|
|
384
|
+
}), currentStageLabel]
|
|
385
|
+
})] }),
|
|
386
|
+
meta: showMeta && globalData?.updatedAt ? /* @__PURE__ */ jsxs("span", { children: [
|
|
387
|
+
t("form.lastUpdated"),
|
|
388
|
+
": ",
|
|
389
|
+
formatDate(globalData.updatedAt)
|
|
390
|
+
] }) : void 0,
|
|
391
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
392
|
+
headerActions,
|
|
393
|
+
workflowEnabled && allowedTransitions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
394
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
395
|
+
type: "button",
|
|
396
|
+
variant: "outline",
|
|
397
|
+
size: "sm",
|
|
398
|
+
className: "gap-2"
|
|
399
|
+
}),
|
|
400
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
401
|
+
icon: "ph:arrows-left-right",
|
|
402
|
+
className: "size-3.5"
|
|
403
|
+
}), t("workflow.transition")]
|
|
404
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
405
|
+
align: "end",
|
|
406
|
+
children: allowedTransitions.map((stage) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
407
|
+
onClick: () => setTransitionTarget({
|
|
408
|
+
name: stage.name,
|
|
409
|
+
label: stage.label
|
|
410
|
+
}),
|
|
411
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
412
|
+
icon: "ph:arrow-right",
|
|
413
|
+
className: "mr-2 size-4"
|
|
414
|
+
}), stage.label || stage.name]
|
|
415
|
+
}, stage.name))
|
|
416
|
+
})] }),
|
|
417
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
418
|
+
type: "button",
|
|
419
|
+
variant: "outline",
|
|
420
|
+
size: "icon-sm",
|
|
421
|
+
onClick: () => setIsHistoryOpen(true),
|
|
422
|
+
title: t("history.title"),
|
|
423
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
424
|
+
icon: "ph:clock-counter-clockwise",
|
|
425
|
+
className: "size-3.5"
|
|
426
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
427
|
+
className: "sr-only",
|
|
428
|
+
children: t("history.title")
|
|
429
|
+
})]
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ jsx(Button, {
|
|
432
|
+
type: "submit",
|
|
433
|
+
size: "sm",
|
|
434
|
+
disabled: isSubmitting,
|
|
435
|
+
className: "gap-2",
|
|
436
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
437
|
+
icon: "ph:spinner-gap",
|
|
438
|
+
className: "size-4 animate-spin"
|
|
439
|
+
}), t("common.loading")] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
440
|
+
icon: "ph:check",
|
|
441
|
+
width: 16,
|
|
442
|
+
height: 16
|
|
443
|
+
}), t("common.save")] })
|
|
444
|
+
})
|
|
445
|
+
] })
|
|
446
|
+
}), /* @__PURE__ */ jsx(AutoFormFields, {
|
|
447
|
+
collection: globalName,
|
|
448
|
+
mode: "global",
|
|
449
|
+
config: resolvedConfig,
|
|
450
|
+
registry
|
|
451
|
+
})]
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ jsx(HistorySidebar, {
|
|
454
|
+
open: isHistoryOpen,
|
|
455
|
+
onOpenChange: setIsHistoryOpen,
|
|
456
|
+
auditEntries: auditData ?? [],
|
|
457
|
+
isLoadingAudit: auditLoading,
|
|
458
|
+
versions: versionsData ?? [],
|
|
459
|
+
fields: globalSchema?.fields,
|
|
460
|
+
isLoadingVersions: versionsLoading,
|
|
461
|
+
isReverting: revertVersionMutation.isPending,
|
|
462
|
+
onRevert: async (version) => {
|
|
463
|
+
setPendingRevertVersion(version);
|
|
464
|
+
},
|
|
465
|
+
showVersionsTab: !!globalSchema?.options?.versioning
|
|
466
|
+
}),
|
|
467
|
+
/* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
468
|
+
open: !!pendingRevertVersion,
|
|
469
|
+
onOpenChange: (open) => {
|
|
470
|
+
if (!open) setPendingRevertVersion(null);
|
|
471
|
+
},
|
|
472
|
+
config: {
|
|
473
|
+
title: t("version.revertConfirmTitle"),
|
|
474
|
+
description: t("version.revertConfirmDescription", { number: pendingRevertVersion?.versionNumber ?? pendingRevertVersion?.versionId ?? "-" }),
|
|
475
|
+
confirmLabel: t("version.revert"),
|
|
476
|
+
cancelLabel: t("common.cancel"),
|
|
477
|
+
destructive: false
|
|
478
|
+
},
|
|
479
|
+
onConfirm: confirmRevertVersion,
|
|
480
|
+
loading: revertVersionMutation.isPending
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ jsx(Dialog, {
|
|
483
|
+
open: !!transitionTarget,
|
|
484
|
+
onOpenChange: (open) => {
|
|
485
|
+
if (!open) {
|
|
486
|
+
setTransitionTarget(null);
|
|
487
|
+
setTransitionSchedule(false);
|
|
488
|
+
setTransitionScheduledAt(null);
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
492
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsxs(DialogTitle, {
|
|
493
|
+
className: "flex items-center gap-2",
|
|
494
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
495
|
+
icon: "ph:arrows-left-right",
|
|
496
|
+
className: "size-5"
|
|
497
|
+
}), t("workflow.transitionTo", { stage: transitionTarget?.label ?? transitionTarget?.name ?? "" })]
|
|
498
|
+
}), /* @__PURE__ */ jsx(DialogDescription, { children: t("workflow.transitionDescription", {
|
|
499
|
+
from: currentStageLabel,
|
|
500
|
+
to: transitionTarget?.label ?? transitionTarget?.name ?? ""
|
|
501
|
+
}) })] }),
|
|
502
|
+
/* @__PURE__ */ jsxs("div", {
|
|
503
|
+
className: "space-y-3 py-2",
|
|
504
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
505
|
+
className: "flex items-center gap-2",
|
|
506
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
507
|
+
checked: transitionSchedule,
|
|
508
|
+
onCheckedChange: (val) => {
|
|
509
|
+
setTransitionSchedule(!!val);
|
|
510
|
+
if (!val) setTransitionScheduledAt(null);
|
|
511
|
+
},
|
|
512
|
+
id: "global-transition-schedule"
|
|
513
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
514
|
+
htmlFor: "global-transition-schedule",
|
|
515
|
+
className: "cursor-pointer text-sm",
|
|
516
|
+
children: t("workflow.scheduleLabel")
|
|
517
|
+
})]
|
|
518
|
+
}), transitionSchedule && /* @__PURE__ */ jsxs("div", {
|
|
519
|
+
className: "space-y-1.5 pl-6",
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ jsx(Label, {
|
|
522
|
+
className: "text-muted-foreground text-xs",
|
|
523
|
+
children: t("workflow.scheduledAt")
|
|
524
|
+
}),
|
|
525
|
+
/* @__PURE__ */ jsx(DateTimeInput, {
|
|
526
|
+
value: transitionScheduledAt,
|
|
527
|
+
onChange: setTransitionScheduledAt,
|
|
528
|
+
minDate: /* @__PURE__ */ new Date()
|
|
529
|
+
}),
|
|
530
|
+
/* @__PURE__ */ jsx("p", {
|
|
531
|
+
className: "text-muted-foreground text-xs",
|
|
532
|
+
children: t("workflow.scheduledDescription")
|
|
533
|
+
})
|
|
534
|
+
]
|
|
535
|
+
})]
|
|
536
|
+
}),
|
|
537
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
538
|
+
type: "button",
|
|
539
|
+
variant: "outline",
|
|
540
|
+
onClick: () => {
|
|
541
|
+
setTransitionTarget(null);
|
|
542
|
+
setTransitionSchedule(false);
|
|
543
|
+
setTransitionScheduledAt(null);
|
|
544
|
+
},
|
|
545
|
+
children: t("common.cancel")
|
|
546
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
547
|
+
type: "button",
|
|
548
|
+
onClick: confirmTransition,
|
|
549
|
+
disabled: transitionMutation.isPending || transitionSchedule && !transitionScheduledAt,
|
|
550
|
+
className: "gap-2",
|
|
551
|
+
children: [transitionMutation.isPending && /* @__PURE__ */ jsx(Icon, {
|
|
552
|
+
icon: "ph:spinner-gap",
|
|
553
|
+
className: "size-4 animate-spin"
|
|
554
|
+
}), transitionSchedule ? t("workflow.scheduleLabel") : t("workflow.transition")]
|
|
555
|
+
})] })
|
|
556
|
+
] })
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ jsx(Dialog, {
|
|
559
|
+
open: localeChangeDialog.open,
|
|
560
|
+
onOpenChange: (open) => !open && handleLocaleChangeCancel(),
|
|
561
|
+
children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("locale.unsavedChanges") }), /* @__PURE__ */ jsx(DialogDescription, { children: t("locale.unsavedChangesDescription") })] }), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
562
|
+
variant: "outline",
|
|
563
|
+
onClick: handleLocaleChangeCancel,
|
|
564
|
+
children: t("common.cancel")
|
|
565
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
566
|
+
variant: "default",
|
|
567
|
+
onClick: handleLocaleChangeConfirm,
|
|
568
|
+
children: t("locale.discardChanges")
|
|
569
|
+
})] })] })
|
|
570
|
+
})
|
|
571
|
+
]
|
|
1393
572
|
});
|
|
1394
|
-
}
|
|
1395
|
-
function _temp(v) {
|
|
1396
|
-
return v.id;
|
|
1397
573
|
}
|
|
1398
574
|
|
|
1399
575
|
//#endregion
|