@questpie/admin 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -5
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +4 -1
- package/dist/client/builder/types/action-types.d.mts +31 -3
- package/dist/client/builder/types/collection-types.d.mts +140 -0
- package/dist/client/builder/types/ui-config.d.mts +16 -2
- package/dist/client/builder/types/views.d.mts +57 -0
- package/dist/client/builder/types/widget-types.d.mts +5 -0
- package/dist/client/components/actions/action-button.mjs +137 -199
- package/dist/client/components/actions/action-dialog.mjs +198 -156
- package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
- package/dist/client/components/actions/header-actions.mjs +52 -53
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/auth/auth-loading.mjs +41 -18
- package/dist/client/components/blocks/block-editor-layout.mjs +2 -2
- package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
- package/dist/client/components/blocks/block-insert-button.mjs +4 -4
- package/dist/client/components/blocks/block-item.mjs +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +91 -63
- package/dist/client/components/component-renderer.mjs +1 -1
- package/dist/client/components/fields/array-field.mjs +14 -14
- package/dist/client/components/fields/asset-preview-field.mjs +1 -1
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
- package/dist/client/components/fields/json-field.mjs +2 -2
- package/dist/client/components/fields/object-array-field.mjs +22 -22
- package/dist/client/components/fields/object-field.mjs +5 -5
- package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
- package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
- package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
- package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
- package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
- package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
- package/dist/client/components/fields/relation-picker.mjs +7 -6
- package/dist/client/components/fields/relation-select.mjs +71 -47
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
- package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
- package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
- package/dist/client/components/fields/upload-field.mjs +45 -49
- package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
- package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
- package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
- package/dist/client/components/history-sidebar.mjs +850 -340
- package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
- package/dist/client/components/locale-switcher.mjs +8 -8
- package/dist/client/components/media/media-grid.mjs +106 -86
- package/dist/client/components/media/media-picker-dialog.mjs +242 -230
- package/dist/client/components/preview/live-preview-mode.mjs +1 -1
- package/dist/client/components/primitives/asset-preview.mjs +37 -22
- package/dist/client/components/primitives/date-input.mjs +212 -249
- package/dist/client/components/primitives/dropzone.mjs +192 -159
- package/dist/client/components/primitives/field-select-control.mjs +93 -0
- package/dist/client/components/primitives/select-multi.mjs +406 -365
- package/dist/client/components/primitives/select-single.mjs +391 -323
- package/dist/client/components/primitives/time-input.mjs +2 -2
- package/dist/client/components/sheets/resource-sheet.mjs +2 -0
- package/dist/client/components/ui/accordion.mjs +4 -4
- package/dist/client/components/ui/alert.mjs +3 -3
- package/dist/client/components/ui/badge.mjs +4 -4
- package/dist/client/components/ui/button.mjs +47 -37
- package/dist/client/components/ui/card.mjs +2 -2
- package/dist/client/components/ui/checkbox.mjs +1 -1
- package/dist/client/components/ui/command.mjs +5 -5
- package/dist/client/components/ui/dialog.mjs +3 -3
- package/dist/client/components/ui/drawer.mjs +1 -1
- package/dist/client/components/ui/dropdown-menu.mjs +157 -15
- package/dist/client/components/ui/empty-state.mjs +88 -59
- package/dist/client/components/ui/field.mjs +2 -2
- package/dist/client/components/ui/input-group.mjs +3 -3
- package/dist/client/components/ui/input.mjs +1 -1
- package/dist/client/components/ui/kbd.mjs +1 -1
- package/dist/client/components/ui/label.mjs +1 -1
- package/dist/client/components/ui/popover.mjs +19 -11
- package/dist/client/components/ui/scroll-fade.mjs +170 -0
- package/dist/client/components/ui/search-input.mjs +1 -1
- package/dist/client/components/ui/select.mjs +129 -27
- package/dist/client/components/ui/sheet.mjs +54 -34
- package/dist/client/components/ui/sidebar.mjs +15 -14
- package/dist/client/components/ui/skeleton.mjs +28 -12
- package/dist/client/components/ui/switch.mjs +2 -2
- package/dist/client/components/ui/table.mjs +82 -74
- package/dist/client/components/ui/tabs.mjs +26 -31
- package/dist/client/components/ui/textarea.mjs +1 -1
- package/dist/client/components/ui/tooltip.mjs +1 -1
- package/dist/client/components/widgets/chart-widget.mjs +154 -100
- package/dist/client/components/widgets/progress-widget.mjs +63 -36
- package/dist/client/components/widgets/quick-actions-widget.mjs +207 -115
- package/dist/client/components/widgets/recent-items-widget.mjs +147 -103
- package/dist/client/components/widgets/stats-widget.mjs +91 -72
- package/dist/client/components/widgets/table-widget.mjs +161 -247
- package/dist/client/components/widgets/timeline-widget.mjs +119 -78
- package/dist/client/components/widgets/value-widget.mjs +286 -157
- package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
- package/dist/client/contexts/focus-context.d.mts +2 -2
- package/dist/client/hooks/use-action.mjs +63 -55
- package/dist/client/hooks/use-audit-history.mjs +1 -65
- package/dist/client/hooks/use-collection-validation.mjs +36 -23
- package/dist/client/hooks/use-collection.mjs +96 -1
- package/dist/client/hooks/use-saved-views.mjs +70 -49
- package/dist/client/hooks/use-server-actions.mjs +70 -46
- package/dist/client/hooks/use-server-validation.mjs +156 -41
- package/dist/client/hooks/use-server-widget-data.mjs +1 -1
- package/dist/client/hooks/use-setup-status.d.mts +3 -3
- package/dist/client/hooks/use-setup-status.mjs +2 -2
- package/dist/client/hooks/use-transition-stage.mjs +2 -10
- package/dist/client/hooks/use-validation-error-map.mjs +31 -13
- package/dist/client/hooks/use-view-state.mjs +238 -174
- package/dist/client/i18n/date-locale.mjs +33 -0
- package/dist/client/i18n/hooks.mjs +17 -1
- package/dist/client/lib/utils.mjs +3 -2
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-banner.mjs +75 -46
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +2 -2
- package/dist/client/runtime/provider.mjs +8 -1
- package/dist/client/runtime/translations-provider.mjs +1 -1
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/styles/base.css +1022 -0
- package/dist/client/styles/index.css +3 -589
- package/dist/client/utils/auto-expand-fields.mjs +4 -2
- package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
- package/dist/client/utils/use-lazy-component.mjs +80 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +17 -10
- package/dist/client/views/auth/auth-layout.mjs +291 -80
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +1 -1
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/auto-form-fields.mjs +11 -9
- package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
- package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
- package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
- package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
- package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
- package/dist/client/views/collection/columns/build-columns.mjs +29 -9
- package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
- package/dist/client/views/collection/field-renderer.mjs +50 -89
- package/dist/client/views/collection/form-view.mjs +237 -227
- package/dist/client/views/collection/table-view.mjs +1167 -234
- package/dist/client/views/collection/view-skeletons.mjs +222 -79
- package/dist/client/views/common/global-search.mjs +29 -18
- package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
- package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
- package/dist/client/views/dashboard/widget-card.mjs +23 -14
- package/dist/client/views/globals/global-form-view.mjs +634 -589
- package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
- package/dist/client/views/layout/admin-layout.d.mts +3 -6
- package/dist/client/views/layout/admin-layout.mjs +152 -155
- package/dist/client/views/layout/admin-router.mjs +936 -616
- package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
- package/dist/client/views/layout/admin-sidebar.mjs +762 -592
- package/dist/client/views/layout/admin-theme.d.mts +10 -0
- package/dist/client/views/layout/admin-theme.mjs +84 -0
- package/dist/client/views/layout/admin-view-layout.mjs +161 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +49 -26
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +2 -19
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +2 -19
- package/dist/client/views/pages/login-page.d.mts +3 -3
- package/dist/client/views/pages/login-page.mjs +4 -21
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +3 -20
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +70 -71
- package/dist/client.d.mts +6 -2
- package/dist/client.mjs +2 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +2 -1
- package/dist/server/augmentation/dashboard.d.mts +67 -3
- package/dist/server/augmentation/form-layout.d.mts +21 -0
- package/dist/server/augmentation/index.d.mts +1 -1
- package/dist/server/codegen/admin-client-template.mjs +4 -0
- package/dist/server/fields/blocks.d.mts +1 -1
- package/dist/server/fields/blocks.mjs +12 -0
- package/dist/server/fields/rich-text.d.mts +1 -1
- package/dist/server/fields/rich-text.mjs +8 -0
- package/dist/server/i18n/index.mjs +29 -7
- package/dist/server/i18n/messages/cs.mjs +414 -1
- package/dist/server/i18n/messages/de.mjs +412 -1
- package/dist/server/i18n/messages/en.mjs +166 -1
- package/dist/server/i18n/messages/es.mjs +412 -1
- package/dist/server/i18n/messages/fr.mjs +412 -1
- package/dist/server/i18n/messages/pl.mjs +416 -1
- package/dist/server/i18n/messages/pt.mjs +409 -1
- package/dist/server/i18n/messages/sk.mjs +216 -2
- package/dist/server/modules/admin/block/introspection.mjs +4 -1
- package/dist/server/modules/admin/block/prefetch.mjs +12 -2
- package/dist/server/modules/admin/collections/account.d.mts +2 -2
- package/dist/server/modules/admin/collections/admin-locks.d.mts +2 -2
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +42 -42
- package/dist/server/modules/admin/collections/assets.d.mts +20 -20
- package/dist/server/modules/admin/collections/assets.mjs +0 -1
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +40 -28
- package/dist/server/modules/admin/collections/user.mjs +40 -9
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
- package/dist/server/modules/admin/factories.mjs +7 -18
- package/dist/server/modules/admin/index.d.mts +1 -1
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +67 -28
- package/dist/server/modules/admin/routes/i18n-helpers.mjs +34 -0
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.mjs +25 -17
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/route-helpers.mjs +1 -1
- package/dist/server/modules/admin/routes/setup.d.mts +10 -10
- package/dist/server/modules/admin/routes/setup.mjs +16 -13
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/translations.mjs +5 -1
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +2 -2
- package/dist/server/modules/audit/.generated/module.d.mts +1 -1
- package/dist/server/modules/audit/.generated/module.mjs +1 -1
- package/dist/server/modules/audit/collections/audit-log.d.mts +2 -2
- package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
- package/dist/server/modules/audit/config/app.mjs +99 -42
- package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
- package/dist/server/plugin.mjs +4 -2
- package/dist/server/proxy-factories.d.mts +4 -3
- package/dist/server/proxy-factories.mjs +34 -8
- package/dist/shared/types/saved-views.types.d.mts +2 -0
- package/package.json +6 -4
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
- package/dist/client/components/ui/spinner.mjs +0 -52
- package/dist/client/components/ui/toolbar.mjs +0 -136
- package/dist/client/contexts/breadcrumb-context.mjs +0 -60
- package/dist/client/views/layout/admin-topbar.mjs +0 -236
|
@@ -18,19 +18,21 @@ import { ActionButton } from "../../components/actions/action-button.mjs";
|
|
|
18
18
|
import { useCollectionFields } from "../../hooks/use-collection-fields.mjs";
|
|
19
19
|
import { AutoFormFields } from "./auto-form-fields.mjs";
|
|
20
20
|
import { ActionDialog } from "../../components/actions/action-dialog.mjs";
|
|
21
|
+
import { EmptyState } from "../../components/ui/empty-state.mjs";
|
|
21
22
|
import { HistorySidebar } from "../../components/history-sidebar.mjs";
|
|
22
23
|
import { LivePreviewMode } from "../../components/preview/live-preview-mode.mjs";
|
|
23
24
|
import { useCollectionValidation } from "../../hooks/use-collection-validation.mjs";
|
|
24
25
|
import { useSearchParamToggle } from "../../hooks/use-search-param-toggle.mjs";
|
|
25
26
|
import { usePreferServerValidation } from "../../hooks/use-server-validation.mjs";
|
|
26
27
|
import { useSidebarSearchParam } from "../../hooks/use-sidebar-search-param.mjs";
|
|
27
|
-
import { useCollectionAuditHistory } from "../../hooks/use-audit-history.mjs";
|
|
28
28
|
import { useCollectionCreate, useCollectionDelete, useCollectionItem, useCollectionRestore, useCollectionRevertVersion, useCollectionUpdate, useCollectionVersions } from "../../hooks/use-collection.mjs";
|
|
29
29
|
import { getLockUser, useLock } from "../../hooks/use-locks.mjs";
|
|
30
30
|
import { useReactiveFields } from "../../hooks/use-reactive-fields.mjs";
|
|
31
31
|
import { useServerActions } from "../../hooks/use-server-actions.mjs";
|
|
32
32
|
import { useTransitionStage } from "../../hooks/use-transition-stage.mjs";
|
|
33
33
|
import { detectManyToManyRelations, hasManyToManyRelations } from "../../utils/detect-relations.mjs";
|
|
34
|
+
import { shouldHandleAdminShortcut } from "../../utils/keyboard-shortcuts.mjs";
|
|
35
|
+
import { AdminViewHeader } from "../layout/admin-view-layout.mjs";
|
|
34
36
|
import { FormViewSkeleton } from "./view-skeletons.mjs";
|
|
35
37
|
import { c } from "react/compiler-runtime";
|
|
36
38
|
import { Icon } from "@iconify/react";
|
|
@@ -415,6 +417,7 @@ const SaveSubmitButton = React.memo(function SaveSubmitButton$1(t0) {
|
|
|
415
417
|
if ($[5] !== t2 || $[6] !== t3) {
|
|
416
418
|
t4 = /* @__PURE__ */ jsx(Button, {
|
|
417
419
|
type: "submit",
|
|
420
|
+
size: "sm",
|
|
418
421
|
disabled: t2,
|
|
419
422
|
className: "gap-2",
|
|
420
423
|
children: t3
|
|
@@ -452,7 +455,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
452
455
|
const { t } = useTranslation();
|
|
453
456
|
const resolveText = useResolveText();
|
|
454
457
|
const isEditMode = !!id;
|
|
455
|
-
const { fields: resolvedFields, schema } = useCollectionFields(collection, { fallbackFields: config?.fields });
|
|
458
|
+
const { fields: resolvedFields, schema, isLoading: isFieldsLoading } = useCollectionFields(collection, { fallbackFields: config?.fields });
|
|
456
459
|
const resolvedFormConfig = React.useMemo(() => viewConfig ?? (config?.form)?.["~config"] ?? config?.form ?? schema?.admin?.form, [
|
|
457
460
|
viewConfig,
|
|
458
461
|
config?.form,
|
|
@@ -526,7 +529,6 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
526
529
|
const revertVersionMutation = useCollectionRevertVersion(collection);
|
|
527
530
|
const [pendingRevertVersion, setPendingRevertVersion] = React.useState(null);
|
|
528
531
|
const { data: versionsData, isLoading: versionsLoading } = useCollectionVersions(collection, id ?? "", { limit: 50 }, { enabled: isEditMode && !!id && isHistoryOpen && !!schema?.options?.versioning });
|
|
529
|
-
const { data: auditData, isLoading: auditLoading } = useCollectionAuditHistory(collection, id ?? "", { limit: 50 }, { enabled: isEditMode && !!id && isHistoryOpen });
|
|
530
532
|
const workflowConfig = schema?.options?.workflow;
|
|
531
533
|
const workflowEnabled = !!workflowConfig?.enabled;
|
|
532
534
|
/**
|
|
@@ -557,8 +559,13 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
557
559
|
const [transitionTarget, setTransitionTarget] = React.useState(null);
|
|
558
560
|
const [transitionSchedule, setTransitionSchedule] = React.useState(false);
|
|
559
561
|
const [transitionScheduledAt, setTransitionScheduledAt] = React.useState(null);
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
+
const validationMode = isEditMode ? "update" : "create";
|
|
563
|
+
const hasServerValidationSchema = validationMode === "update" ? !!schema?.validation?.update : !!schema?.validation?.insert;
|
|
564
|
+
const clientResolver = useCollectionValidation(collection, { enabled: !isFieldsLoading && !hasServerValidationSchema });
|
|
565
|
+
const resolver = usePreferServerValidation(collection, {
|
|
566
|
+
mode: validationMode,
|
|
567
|
+
schema
|
|
568
|
+
}, clientResolver);
|
|
562
569
|
const form = useForm({
|
|
563
570
|
defaultValues: transformedItem ?? defaultValuesProp ?? {},
|
|
564
571
|
resolver,
|
|
@@ -706,6 +713,9 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
706
713
|
pendingLocale: null
|
|
707
714
|
});
|
|
708
715
|
}, [form]);
|
|
716
|
+
const handleLocaleDialogOpenChange = React.useCallback((open) => {
|
|
717
|
+
if (!open) handleLocaleChangeCancel();
|
|
718
|
+
}, [handleLocaleChangeCancel]);
|
|
709
719
|
const onSubmit = React.useEffectEvent(async (data) => {
|
|
710
720
|
const savePromise = async () => {
|
|
711
721
|
if (isEditMode && id) return await updateMutation.mutateAsync({
|
|
@@ -756,7 +766,10 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
756
766
|
});
|
|
757
767
|
React.useEffect(() => {
|
|
758
768
|
const handleKeyDown = (e_0) => {
|
|
759
|
-
if ((e_0
|
|
769
|
+
if (shouldHandleAdminShortcut(e_0, {
|
|
770
|
+
allowEditableTarget: true,
|
|
771
|
+
key: "s"
|
|
772
|
+
})) {
|
|
760
773
|
e_0.preventDefault();
|
|
761
774
|
e_0.stopPropagation();
|
|
762
775
|
form.handleSubmit(onSubmitRef.current, (errors) => {
|
|
@@ -770,7 +783,10 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
770
783
|
}, [form, t]);
|
|
771
784
|
const isMutationPending = createMutation.isPending || updateMutation.isPending;
|
|
772
785
|
const configFormActions = resolvedFormConfig?.actions;
|
|
773
|
-
const { serverActions } = useServerActions({
|
|
786
|
+
const { serverActions } = useServerActions({
|
|
787
|
+
collection,
|
|
788
|
+
schema
|
|
789
|
+
});
|
|
774
790
|
const scopedServerFormActions = React.useMemo(() => isEditMode ? serverActions.filter((action) => {
|
|
775
791
|
const scope = action.scope;
|
|
776
792
|
return scope === "single" || scope === "row";
|
|
@@ -1030,6 +1046,32 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1030
1046
|
const handleConfirm = async () => {
|
|
1031
1047
|
if (confirmAction) await executeAction(confirmAction);
|
|
1032
1048
|
};
|
|
1049
|
+
const handleConfirmActionOpenChange = React.useCallback((open_0) => {
|
|
1050
|
+
if (!open_0) setConfirmAction(null);
|
|
1051
|
+
}, []);
|
|
1052
|
+
const handleActionDialogOpenChange = React.useCallback((open_1) => {
|
|
1053
|
+
if (!open_1) setDialogAction(null);
|
|
1054
|
+
}, []);
|
|
1055
|
+
const handleRevertDialogOpenChange = React.useCallback((open_2) => {
|
|
1056
|
+
if (!open_2) setPendingRevertVersion(null);
|
|
1057
|
+
}, []);
|
|
1058
|
+
const handleWorkflowDialogOpenChange = React.useCallback((open_3) => {
|
|
1059
|
+
if (!open_3) {
|
|
1060
|
+
setTransitionTarget(null);
|
|
1061
|
+
setTransitionSchedule(false);
|
|
1062
|
+
setTransitionScheduledAt(null);
|
|
1063
|
+
}
|
|
1064
|
+
}, []);
|
|
1065
|
+
const workflowTransitionTriggerRender = React.useMemo(() => /* @__PURE__ */ jsx(Button, {
|
|
1066
|
+
type: "button",
|
|
1067
|
+
variant: "outline",
|
|
1068
|
+
size: "sm",
|
|
1069
|
+
className: "gap-2"
|
|
1070
|
+
}), []);
|
|
1071
|
+
const secondaryActionsTriggerRender = React.useMemo(() => /* @__PURE__ */ jsx(Button, {
|
|
1072
|
+
variant: "outline",
|
|
1073
|
+
size: "icon-sm"
|
|
1074
|
+
}), []);
|
|
1033
1075
|
const formatDate = (date) => {
|
|
1034
1076
|
return new Date(date).toLocaleDateString(void 0, {
|
|
1035
1077
|
year: "numeric",
|
|
@@ -1049,20 +1091,16 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1049
1091
|
};
|
|
1050
1092
|
const lockRefreshTimerRef = React.useRef(null);
|
|
1051
1093
|
React.useEffect(() => {
|
|
1052
|
-
if (!isEditMode || isBlocked) return;
|
|
1094
|
+
if (!isEditMode || isBlocked || isLoading) return;
|
|
1095
|
+
const target = formElementRef.current;
|
|
1096
|
+
if (!target) return;
|
|
1053
1097
|
const scheduleLockRefresh = () => {
|
|
1054
1098
|
if (lockRefreshTimerRef.current) clearTimeout(lockRefreshTimerRef.current);
|
|
1055
1099
|
lockRefreshTimerRef.current = setTimeout(() => {
|
|
1056
1100
|
refreshLock();
|
|
1057
1101
|
}, 1e3);
|
|
1058
1102
|
};
|
|
1059
|
-
const events = [
|
|
1060
|
-
"input",
|
|
1061
|
-
"change",
|
|
1062
|
-
"keydown",
|
|
1063
|
-
"pointerdown"
|
|
1064
|
-
];
|
|
1065
|
-
const target = formElementRef.current ?? document;
|
|
1103
|
+
const events = ["input", "change"];
|
|
1066
1104
|
for (const event of events) target.addEventListener(event, scheduleLockRefresh, { capture: true });
|
|
1067
1105
|
scheduleLockRefresh();
|
|
1068
1106
|
return () => {
|
|
@@ -1072,6 +1110,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1072
1110
|
}, [
|
|
1073
1111
|
isEditMode,
|
|
1074
1112
|
isBlocked,
|
|
1113
|
+
isLoading,
|
|
1075
1114
|
refreshLock
|
|
1076
1115
|
]);
|
|
1077
1116
|
const { data: previewUrl = null } = useQuery({
|
|
@@ -1094,27 +1133,34 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1094
1133
|
});
|
|
1095
1134
|
if (isEditMode && itemError) {
|
|
1096
1135
|
const is404 = itemError != null && typeof itemError === "object" && "status" in itemError && itemError.status === 404;
|
|
1097
|
-
return /* @__PURE__ */
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
}),
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1136
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
1137
|
+
variant: is404 ? "empty" : "error",
|
|
1138
|
+
iconName: is404 ? "ph:file-dashed" : "ph:warning-circle",
|
|
1139
|
+
title: is404 ? t("error.notFound") : t("error.failedToLoad"),
|
|
1140
|
+
description: !is404 && itemError instanceof Error ? itemError.message : void 0,
|
|
1141
|
+
height: "h-64",
|
|
1142
|
+
action: is404 ? /* @__PURE__ */ jsxs(Button, {
|
|
1143
|
+
variant: "outline",
|
|
1144
|
+
size: "sm",
|
|
1145
|
+
className: "gap-2",
|
|
1146
|
+
onClick: () => navigate(`${basePath}/collections/${collection}`),
|
|
1147
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1148
|
+
icon: "ph:arrow-left",
|
|
1149
|
+
className: "size-3.5"
|
|
1150
|
+
}), t("common.backToList")]
|
|
1151
|
+
}) : /* @__PURE__ */ jsxs(Button, {
|
|
1152
|
+
variant: "outline",
|
|
1153
|
+
size: "sm",
|
|
1154
|
+
className: "gap-2",
|
|
1155
|
+
onClick: () => window.location.reload(),
|
|
1156
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1157
|
+
icon: "ph:arrow-clockwise",
|
|
1158
|
+
className: "size-3.5"
|
|
1159
|
+
}), t("common.retry")]
|
|
1160
|
+
})
|
|
1115
1161
|
});
|
|
1116
1162
|
}
|
|
1117
|
-
if (isEditMode && isLoading) return /* @__PURE__ */ jsx(FormViewSkeleton, {});
|
|
1163
|
+
if (isEditMode && isLoading || isFieldsLoading) return /* @__PURE__ */ jsx(FormViewSkeleton, {});
|
|
1118
1164
|
const collectionLabel = resolveText(config?.label ?? schema?.admin?.config?.label, collection);
|
|
1119
1165
|
const title = isEditMode ? item?._title || item?.id || t("collection.edit", { name: collectionLabel }) : t("collection.new", { name: collectionLabel });
|
|
1120
1166
|
const formShell = /* @__PURE__ */ jsx("div", {
|
|
@@ -1126,7 +1172,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1126
1172
|
blockedByUser.image ? /* @__PURE__ */ jsx("img", {
|
|
1127
1173
|
src: blockedByUser.image,
|
|
1128
1174
|
alt: "",
|
|
1129
|
-
className: "size-8 rounded-full"
|
|
1175
|
+
className: "image-outline size-8 rounded-full"
|
|
1130
1176
|
}) : /* @__PURE__ */ jsx("div", {
|
|
1131
1177
|
className: "bg-warning/20 flex size-8 items-center justify-center rounded-full",
|
|
1132
1178
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
@@ -1151,7 +1197,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1151
1197
|
]
|
|
1152
1198
|
}),
|
|
1153
1199
|
isOpenElsewhere && /* @__PURE__ */ jsxs("div", {
|
|
1154
|
-
className: "bg-info/10 border-info/30 mb-4 flex items-center gap-3 border p-3",
|
|
1200
|
+
className: "qa-form-view__open-elsewhere-banner bg-info/10 border-info/30 mb-4 flex items-center gap-3 border p-3",
|
|
1155
1201
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1156
1202
|
icon: "ph:browser",
|
|
1157
1203
|
className: "text-info size-5"
|
|
@@ -1206,180 +1252,155 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1206
1252
|
},
|
|
1207
1253
|
className: "qa-form-view__form space-y-4",
|
|
1208
1254
|
children: [
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
className: "qa-form-view__header
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1255
|
+
/* @__PURE__ */ jsx(AdminViewHeader, {
|
|
1256
|
+
className: "qa-form-view__header",
|
|
1257
|
+
title,
|
|
1258
|
+
titleAccessory: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1259
|
+
localeOptions.length > 0 && /* @__PURE__ */ jsx(LocaleSwitcher, {
|
|
1260
|
+
locales: localeOptions,
|
|
1261
|
+
value: contentLocale,
|
|
1262
|
+
onChange: setContentLocale
|
|
1263
|
+
}),
|
|
1264
|
+
/* @__PURE__ */ jsx(AutosaveIndicator, {
|
|
1265
|
+
control: form.control,
|
|
1266
|
+
enabled: autoSaveConfig.enabled,
|
|
1267
|
+
indicator: autoSaveConfig.indicator,
|
|
1268
|
+
isEditMode,
|
|
1269
|
+
isSaving,
|
|
1270
|
+
lastSaved,
|
|
1271
|
+
formatTimeAgo,
|
|
1272
|
+
t
|
|
1273
|
+
}),
|
|
1274
|
+
workflowEnabled && currentStage && /* @__PURE__ */ jsxs(Badge, {
|
|
1275
|
+
variant: "outline",
|
|
1276
|
+
className: "gap-1.5",
|
|
1277
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1278
|
+
icon: "ph:git-branch",
|
|
1279
|
+
className: "size-3"
|
|
1280
|
+
}), currentStageLabel]
|
|
1281
|
+
})
|
|
1282
|
+
] }),
|
|
1283
|
+
meta: showMeta && item ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1284
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1285
|
+
className: "opacity-60",
|
|
1286
|
+
children: [t("form.id"), ":"]
|
|
1287
|
+
}),
|
|
1288
|
+
/* @__PURE__ */ jsx("button", {
|
|
1289
|
+
type: "button",
|
|
1290
|
+
className: "hover:text-foreground cursor-pointer transition-colors",
|
|
1291
|
+
onClick: () => {
|
|
1292
|
+
navigator.clipboard.writeText(String(item.id)).then(() => toast.success(t("toast.idCopied")), () => toast.error(t("toast.copyFailed")));
|
|
1293
|
+
},
|
|
1294
|
+
title: t("common.copy"),
|
|
1295
|
+
children: item.id
|
|
1296
|
+
}),
|
|
1297
|
+
item.createdAt && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1298
|
+
className: "opacity-40",
|
|
1299
|
+
children: "·"
|
|
1300
|
+
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs("span", {
|
|
1301
|
+
className: "opacity-60",
|
|
1302
|
+
children: [t("form.created"), " "]
|
|
1303
|
+
}), formatDate(item.createdAt)] })] }),
|
|
1304
|
+
item.updatedAt && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1305
|
+
className: "opacity-40",
|
|
1306
|
+
children: "·"
|
|
1307
|
+
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs("span", {
|
|
1308
|
+
className: "opacity-60",
|
|
1309
|
+
children: [t("form.updated"), " "]
|
|
1310
|
+
}), formatDate(item.updatedAt)] })] })
|
|
1311
|
+
] }) : void 0,
|
|
1312
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1313
|
+
headerActions,
|
|
1314
|
+
canUseLivePreview && /* @__PURE__ */ jsxs(Button, {
|
|
1315
|
+
type: "button",
|
|
1316
|
+
variant: "outline",
|
|
1317
|
+
size: "icon-sm",
|
|
1318
|
+
onClick: () => setIsLivePreviewOpen(true),
|
|
1319
|
+
title: t("preview.livePreview"),
|
|
1320
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1321
|
+
icon: "ph:eye",
|
|
1322
|
+
className: "size-4"
|
|
1323
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1324
|
+
className: "sr-only",
|
|
1325
|
+
children: t("preview.livePreview")
|
|
1326
|
+
})]
|
|
1327
|
+
}),
|
|
1328
|
+
isEditMode && id && schema?.options?.versioning && /* @__PURE__ */ jsxs(Button, {
|
|
1329
|
+
type: "button",
|
|
1330
|
+
variant: "outline",
|
|
1331
|
+
size: "icon-sm",
|
|
1332
|
+
onClick: () => setIsHistoryOpen(true),
|
|
1333
|
+
title: t("history.title"),
|
|
1334
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1335
|
+
icon: "ph:clock-counter-clockwise",
|
|
1336
|
+
className: "size-4"
|
|
1337
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1338
|
+
className: "sr-only",
|
|
1339
|
+
children: t("history.title")
|
|
1340
|
+
})]
|
|
1341
|
+
}),
|
|
1342
|
+
workflowEnabled && isEditMode && id && allowedTransitions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
1343
|
+
render: workflowTransitionTriggerRender,
|
|
1344
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1345
|
+
icon: "ph:arrows-left-right",
|
|
1346
|
+
className: "size-4"
|
|
1347
|
+
}), t("workflow.transition")]
|
|
1348
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
1349
|
+
align: "end",
|
|
1350
|
+
children: allowedTransitions.map((stage) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1351
|
+
onClick: () => setTransitionTarget({
|
|
1352
|
+
name: stage.name,
|
|
1353
|
+
label: stage.label
|
|
1224
1354
|
}),
|
|
1225
|
-
/* @__PURE__ */ jsx(
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1355
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1356
|
+
icon: "ph:arrow-right",
|
|
1357
|
+
className: "mr-2 size-4"
|
|
1358
|
+
}), stage.label || stage.name]
|
|
1359
|
+
}, stage.name))
|
|
1360
|
+
})] }),
|
|
1361
|
+
visiblePrimaryActions.map((action_4) => /* @__PURE__ */ jsx(ActionButton, {
|
|
1362
|
+
action: action_4,
|
|
1363
|
+
collection,
|
|
1364
|
+
helpers: actionHelpers,
|
|
1365
|
+
size: "sm",
|
|
1366
|
+
onOpenDialog: (a_2) => setDialogAction(a_2)
|
|
1367
|
+
}, action_4.id)),
|
|
1368
|
+
/* @__PURE__ */ jsx(SaveSubmitButton, {
|
|
1369
|
+
control: form.control,
|
|
1370
|
+
isMutationPending,
|
|
1371
|
+
t
|
|
1372
|
+
}),
|
|
1373
|
+
visibleSecondaryActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
1374
|
+
render: secondaryActionsTriggerRender,
|
|
1375
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1376
|
+
icon: "ph:dots-three-vertical",
|
|
1377
|
+
className: "size-4"
|
|
1378
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1379
|
+
className: "sr-only",
|
|
1380
|
+
children: t("common.moreActions")
|
|
1381
|
+
})]
|
|
1382
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
1383
|
+
align: "end",
|
|
1384
|
+
children: [
|
|
1385
|
+
regularSecondary.map((action_5) => {
|
|
1386
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1387
|
+
onClick: () => handleActionClick(action_5),
|
|
1388
|
+
disabled: actionLoading,
|
|
1389
|
+
children: [resolveIconElement(action_5.icon, { className: "mr-2 size-4" }), resolveText(action_5.label)]
|
|
1390
|
+
}, action_5.id);
|
|
1234
1391
|
}),
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1392
|
+
regularSecondary.length > 0 && destructiveSecondary.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
1393
|
+
destructiveSecondary.map((action_6) => {
|
|
1394
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1395
|
+
variant: "destructive",
|
|
1396
|
+
onClick: () => handleActionClick(action_6),
|
|
1397
|
+
disabled: actionLoading,
|
|
1398
|
+
children: [resolveIconElement(action_6.icon, { className: "mr-2 size-4" }), resolveText(action_6.label)]
|
|
1399
|
+
}, action_6.id);
|
|
1242
1400
|
})
|
|
1243
1401
|
]
|
|
1244
|
-
})
|
|
1245
|
-
|
|
1246
|
-
children: /* @__PURE__ */ jsxs("p", {
|
|
1247
|
-
className: "text-muted-foreground flex items-center gap-2 font-mono text-xs whitespace-nowrap",
|
|
1248
|
-
children: [
|
|
1249
|
-
/* @__PURE__ */ jsxs("span", {
|
|
1250
|
-
className: "opacity-60",
|
|
1251
|
-
children: [t("form.id"), ":"]
|
|
1252
|
-
}),
|
|
1253
|
-
/* @__PURE__ */ jsx("button", {
|
|
1254
|
-
type: "button",
|
|
1255
|
-
className: "hover:text-foreground cursor-pointer transition-colors",
|
|
1256
|
-
onClick: () => {
|
|
1257
|
-
navigator.clipboard.writeText(String(item.id)).then(() => toast.success(t("toast.idCopied")), () => toast.error(t("toast.copyFailed")));
|
|
1258
|
-
},
|
|
1259
|
-
title: t("common.copy"),
|
|
1260
|
-
children: item.id
|
|
1261
|
-
}),
|
|
1262
|
-
item.createdAt && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1263
|
-
className: "opacity-40",
|
|
1264
|
-
children: "·"
|
|
1265
|
-
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs("span", {
|
|
1266
|
-
className: "opacity-60",
|
|
1267
|
-
children: [t("form.created"), " "]
|
|
1268
|
-
}), formatDate(item.createdAt)] })] }),
|
|
1269
|
-
item.updatedAt && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1270
|
-
className: "opacity-40",
|
|
1271
|
-
children: "·"
|
|
1272
|
-
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs("span", {
|
|
1273
|
-
className: "opacity-60",
|
|
1274
|
-
children: [t("form.updated"), " "]
|
|
1275
|
-
}), formatDate(item.updatedAt)] })] })
|
|
1276
|
-
]
|
|
1277
|
-
})
|
|
1278
|
-
})]
|
|
1279
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1280
|
-
className: "qa-form-view__actions flex w-auto shrink-0 items-center gap-2",
|
|
1281
|
-
children: [
|
|
1282
|
-
headerActions,
|
|
1283
|
-
canUseLivePreview && /* @__PURE__ */ jsxs(Button, {
|
|
1284
|
-
type: "button",
|
|
1285
|
-
variant: "outline",
|
|
1286
|
-
size: "icon",
|
|
1287
|
-
className: "size-9",
|
|
1288
|
-
onClick: () => setIsLivePreviewOpen(true),
|
|
1289
|
-
title: t("preview.livePreview"),
|
|
1290
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1291
|
-
icon: "ph:eye",
|
|
1292
|
-
className: "size-4"
|
|
1293
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1294
|
-
className: "sr-only",
|
|
1295
|
-
children: t("preview.livePreview")
|
|
1296
|
-
})]
|
|
1297
|
-
}),
|
|
1298
|
-
isEditMode && id && schema?.options?.versioning && /* @__PURE__ */ jsxs(Button, {
|
|
1299
|
-
type: "button",
|
|
1300
|
-
variant: "outline",
|
|
1301
|
-
size: "icon",
|
|
1302
|
-
className: "size-9",
|
|
1303
|
-
onClick: () => setIsHistoryOpen(true),
|
|
1304
|
-
title: t("history.title"),
|
|
1305
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1306
|
-
icon: "ph:clock-counter-clockwise",
|
|
1307
|
-
className: "size-4"
|
|
1308
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1309
|
-
className: "sr-only",
|
|
1310
|
-
children: t("history.title")
|
|
1311
|
-
})]
|
|
1312
|
-
}),
|
|
1313
|
-
workflowEnabled && isEditMode && id && allowedTransitions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
1314
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
1315
|
-
type: "button",
|
|
1316
|
-
variant: "outline",
|
|
1317
|
-
className: "gap-2"
|
|
1318
|
-
}),
|
|
1319
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1320
|
-
icon: "ph:arrows-left-right",
|
|
1321
|
-
className: "size-4"
|
|
1322
|
-
}), t("workflow.transition")]
|
|
1323
|
-
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
1324
|
-
align: "end",
|
|
1325
|
-
children: allowedTransitions.map((stage) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1326
|
-
onClick: () => setTransitionTarget({
|
|
1327
|
-
name: stage.name,
|
|
1328
|
-
label: stage.label
|
|
1329
|
-
}),
|
|
1330
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1331
|
-
icon: "ph:arrow-right",
|
|
1332
|
-
className: "mr-2 size-4"
|
|
1333
|
-
}), stage.label || stage.name]
|
|
1334
|
-
}, stage.name))
|
|
1335
|
-
})] }),
|
|
1336
|
-
visiblePrimaryActions.map((action_4) => /* @__PURE__ */ jsx(ActionButton, {
|
|
1337
|
-
action: action_4,
|
|
1338
|
-
collection,
|
|
1339
|
-
helpers: actionHelpers,
|
|
1340
|
-
onOpenDialog: (a_2) => setDialogAction(a_2)
|
|
1341
|
-
}, action_4.id)),
|
|
1342
|
-
/* @__PURE__ */ jsx(SaveSubmitButton, {
|
|
1343
|
-
control: form.control,
|
|
1344
|
-
isMutationPending,
|
|
1345
|
-
t
|
|
1346
|
-
}),
|
|
1347
|
-
visibleSecondaryActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
1348
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
1349
|
-
variant: "outline",
|
|
1350
|
-
size: "icon",
|
|
1351
|
-
className: "size-9"
|
|
1352
|
-
}),
|
|
1353
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1354
|
-
icon: "ph:dots-three-vertical",
|
|
1355
|
-
className: "size-4"
|
|
1356
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1357
|
-
className: "sr-only",
|
|
1358
|
-
children: t("common.moreActions")
|
|
1359
|
-
})]
|
|
1360
|
-
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
1361
|
-
align: "end",
|
|
1362
|
-
children: [
|
|
1363
|
-
regularSecondary.map((action_5) => {
|
|
1364
|
-
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1365
|
-
onClick: () => handleActionClick(action_5),
|
|
1366
|
-
disabled: actionLoading,
|
|
1367
|
-
children: [resolveIconElement(action_5.icon, { className: "mr-2 size-4" }), resolveText(action_5.label)]
|
|
1368
|
-
}, action_5.id);
|
|
1369
|
-
}),
|
|
1370
|
-
regularSecondary.length > 0 && destructiveSecondary.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
1371
|
-
destructiveSecondary.map((action_6) => {
|
|
1372
|
-
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1373
|
-
variant: "destructive",
|
|
1374
|
-
onClick: () => handleActionClick(action_6),
|
|
1375
|
-
disabled: actionLoading,
|
|
1376
|
-
children: [resolveIconElement(action_6.icon, { className: "mr-2 size-4" }), resolveText(action_6.label)]
|
|
1377
|
-
}, action_6.id);
|
|
1378
|
-
})
|
|
1379
|
-
]
|
|
1380
|
-
})] })
|
|
1381
|
-
]
|
|
1382
|
-
})]
|
|
1402
|
+
})] })
|
|
1403
|
+
] })
|
|
1383
1404
|
}),
|
|
1384
1405
|
item?.deletedAt && /* @__PURE__ */ jsxs("div", {
|
|
1385
1406
|
className: "qa-form-view__deleted-banner border-destructive/30 bg-destructive/5 text-destructive flex items-center gap-2 border px-4 py-3 text-sm",
|
|
@@ -1402,11 +1423,9 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1402
1423
|
})
|
|
1403
1424
|
]
|
|
1404
1425
|
}),
|
|
1405
|
-
/* @__PURE__ */ jsx(Dialog, {
|
|
1426
|
+
localeChangeDialog.open && /* @__PURE__ */ jsx(Dialog, {
|
|
1406
1427
|
open: localeChangeDialog.open,
|
|
1407
|
-
onOpenChange:
|
|
1408
|
-
if (!open) handleLocaleChangeCancel();
|
|
1409
|
-
},
|
|
1428
|
+
onOpenChange: handleLocaleDialogOpenChange,
|
|
1410
1429
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
1411
1430
|
showCloseButton: false,
|
|
1412
1431
|
children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsxs(DialogTitle, {
|
|
@@ -1428,25 +1447,24 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1428
1447
|
}),
|
|
1429
1448
|
confirmAction?.confirmation && /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
1430
1449
|
open: !!confirmAction,
|
|
1431
|
-
onOpenChange:
|
|
1450
|
+
onOpenChange: handleConfirmActionOpenChange,
|
|
1432
1451
|
config: confirmAction.confirmation,
|
|
1433
1452
|
onConfirm: handleConfirm,
|
|
1434
1453
|
loading: actionLoading
|
|
1435
1454
|
}),
|
|
1436
1455
|
dialogAction && /* @__PURE__ */ jsx(ActionDialog, {
|
|
1437
1456
|
open: !!dialogAction,
|
|
1438
|
-
onOpenChange:
|
|
1457
|
+
onOpenChange: handleActionDialogOpenChange,
|
|
1439
1458
|
action: dialogAction,
|
|
1440
1459
|
collection,
|
|
1441
1460
|
item: transformedItem,
|
|
1442
1461
|
helpers: actionHelpers
|
|
1443
1462
|
}),
|
|
1444
|
-
/* @__PURE__ */ jsx(HistorySidebar, {
|
|
1463
|
+
isHistoryOpen && /* @__PURE__ */ jsx(HistorySidebar, {
|
|
1445
1464
|
open: isHistoryOpen,
|
|
1446
1465
|
onOpenChange: setIsHistoryOpen,
|
|
1447
|
-
auditEntries: auditData ?? [],
|
|
1448
|
-
isLoadingAudit: auditLoading,
|
|
1449
1466
|
versions: versionsData ?? [],
|
|
1467
|
+
fields: schema?.fields,
|
|
1450
1468
|
isLoadingVersions: versionsLoading,
|
|
1451
1469
|
isReverting: revertVersionMutation.isPending,
|
|
1452
1470
|
onRevert: async (version_0) => {
|
|
@@ -1454,11 +1472,9 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1454
1472
|
},
|
|
1455
1473
|
showVersionsTab: !!schema?.options?.versioning
|
|
1456
1474
|
}),
|
|
1457
|
-
/* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
1475
|
+
pendingRevertVersion && /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
1458
1476
|
open: !!pendingRevertVersion,
|
|
1459
|
-
onOpenChange:
|
|
1460
|
-
if (!open_2) setPendingRevertVersion(null);
|
|
1461
|
-
},
|
|
1477
|
+
onOpenChange: handleRevertDialogOpenChange,
|
|
1462
1478
|
config: {
|
|
1463
1479
|
title: t("version.revertConfirmTitle"),
|
|
1464
1480
|
description: t("version.revertConfirmDescription", { number: pendingRevertVersion?.versionNumber ?? pendingRevertVersion?.versionId ?? "-" }),
|
|
@@ -1469,15 +1485,9 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
|
|
|
1469
1485
|
onConfirm: confirmRevertVersion,
|
|
1470
1486
|
loading: revertVersionMutation.isPending
|
|
1471
1487
|
}),
|
|
1472
|
-
/* @__PURE__ */ jsx(Dialog, {
|
|
1488
|
+
transitionTarget && /* @__PURE__ */ jsx(Dialog, {
|
|
1473
1489
|
open: !!transitionTarget,
|
|
1474
|
-
onOpenChange:
|
|
1475
|
-
if (!open_3) {
|
|
1476
|
-
setTransitionTarget(null);
|
|
1477
|
-
setTransitionSchedule(false);
|
|
1478
|
-
setTransitionScheduledAt(null);
|
|
1479
|
-
}
|
|
1480
|
-
},
|
|
1490
|
+
onOpenChange: handleWorkflowDialogOpenChange,
|
|
1481
1491
|
children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
1482
1492
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsxs(DialogTitle, {
|
|
1483
1493
|
className: "flex items-center gap-2",
|