@rebasepro/cms 0.27.0 → 0.28.1
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/collection_editor/serializable_utils.js +5 -2
- package/dist/collection_editor/serializable_utils.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +17 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +31 -17
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +6 -5
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +3 -2
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +32 -16
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/DetailViewBinding.js +4 -3
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditViewBinding.js +23 -5
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +3 -3
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
- package/dist/components/SidePanelBinding.js +7 -6
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/app/Scaffold.js +16 -1
- package/dist/components/app/Scaffold.js.map +1 -1
- package/dist/components/history/EntityHistoryView.js +2 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/data_export/export/export.js +3 -3
- package/dist/data_export/export/export.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.js +10 -12
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/data_import/utils/id_column.d.ts +19 -0
- package/dist/data_import/utils/id_column.js +19 -1
- package/dist/data_import/utils/id_column.js.map +1 -1
- package/dist/data_import/utils/transforms.js +24 -7
- package/dist/data_import/utils/transforms.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/EntityForm.js +14 -4
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormBinding.js +12 -8
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/components/FieldBlock.js +2 -1
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.js +3 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +0 -2
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/TextFieldBinding.js +3 -2
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
- package/dist/form/validation.js +12 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hooks/navigation/url_segments.d.ts +33 -0
- package/dist/hooks/navigation/url_segments.js +56 -0
- package/dist/hooks/navigation/url_segments.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +4 -2
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.js +6 -5
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useHistory.js +4 -3
- package/dist/hooks/useHistory.js.map +1 -1
- package/dist/routes/RebaseRoute.js +20 -30
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/util/navigation_utils.js +4 -3
- package/dist/util/navigation_utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditViewBinding.js","names":[],"sources":["../../src/components/EditViewBinding.tsx"],"sourcesContent":["import type { ComponentRef } from \"@rebasepro/types\";\nimport type { EntityCustomViewParams, FormViewConfig, AdminCollection } from \"@rebasepro/cms-types\";\nimport type { FormContext } from \"../types/fields\";\nimport type { PluginFormActionProps } from \"@rebasepro/cms-types\";\nimport React, { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Entity, EntityStatus } from \"@rebasepro/types\";\nimport { PluginProviderStack, resolveComponentRef, useComponentOverride, CollectionScopeProvider, getAdminEntityChildViews } from \"@rebasepro/app\";\n\nimport { CollectionViewBinding } from \"./CollectionViewBinding/CollectionViewBinding\";\nimport { EntityViewBinding } from \"./EntityViewBinding\";\nimport { CircularProgressCenter, iconSize } from \"@rebasepro/ui\";\nimport {\n Alert,\n Button,\n CenteredView,\n CircularProgress,\n cls,\n CodeIcon,\n defaultBorderMixin,\n DialogActions,\n HistoryIcon,\n IconButton,\n Maximize2Icon,\n Skeleton,\n Tab,\n Tabs,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { ErrorView } from \"@rebasepro/app\";\n\nimport { removeInitialAndTrailingSlashes, resolveDefaultSelectedView } from \"@rebasepro/app\";\nimport { resolvedSelectedEntityView } from \"../util/resolutions\";\nimport {\n useCustomizationController,\n useFetch,\n useRebaseContext,\n useLargeLayout,\n useSlot,\n getIcon\n} from \"@rebasepro/app\";\nimport { getEntityFromMemoryCache, removeEntityFromMemoryCache, saveEntityToMemoryCache } from \"@rebasepro/app\";\nimport { EntityFormBinding } from \"../form\";\nimport { getEditHandoffValues } from \"../form/form_utils\";\nimport type { EntityFormBindingProps } from \"../form\";\nimport type { OnUpdateParams } from \"../types/components/EntityFormProps\";\nimport { EditFormActions } from \"./EditFormActions\";\nimport { EntityIdentityBar, EntitySaveActions } from \"./EntityIdentityBar\";\nimport { useUndoableDiscard } from \"../form/useUndoableDiscard\";\nimport { SplitListCloseButton } from \"./CollectionViewBinding/SplitListCloseButton\";\nimport { SplitListShowButton } from \"./CollectionViewBinding/SplitListShowButton\";\nimport { useLeaveRecord, useRecordActions } from \"../hooks/useRecordActions\";\nimport { useSideDialogContext } from \"./SideDialogs\";\nimport { useAdminContext } from \"../hooks/useAdminContext\";\nimport { EntityInspector, InspectorTab } from \"./EntityInspector\";\nimport { useEntityDisplayTitle } from \"../hooks/useEntityDisplayTitle\";\nimport { createFormexStub, getEntityFromCache } from \"@rebasepro/app\";\nimport { usePermissions, useTranslation } from \"@rebasepro/app\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { withListState } from \"../util/view_mode\";\nimport { navigateToEntity } from \"../util/navigation_utils\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport {\n MAIN_TAB_VALUE,\n JSON_TAB_VALUE,\n HISTORY_TAB_VALUE,\n ENTITY_VIEW_TAB_BAR_CLASS,\n ENTITY_VIEW_TAB_CLASS,\n ENTITY_VIEW_TAB_LABEL_CLASS\n} from \"../util/view_constants\";\nexport { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE };\n\nexport type BarActionsParams = {\n values: object,\n status: EntityStatus,\n path: string,\n entityId?: string | number;\n /** Whether `values` differ from what is stored. */\n dirty: boolean;\n /**\n * Hand the edit in progress to the layout this action is about to open, so\n * the record arrives showing — and still holding — what the user typed here.\n * Call it from any action that changes layout without leaving the record;\n * it decides on its own whether there is anything worth carrying, so a\n * record nobody edited still arrives clean.\n *\n * Only supplied where there is a form to carry: the detail view passes no\n * such thing.\n */\n carryEdit?: () => void;\n};\n\nexport type OnTabChangeParams<M extends Record<string, unknown>> = {\n path: string;\n entityId?: string | number;\n selectedTab?: string;\n collection: AdminCollection<M>;\n\n};\n\nexport interface EditViewBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {\n /**\n * The admin path of the entity, e.g. \"users\" or \"products\".\n */\n path: string;\n collection: AdminCollection<M>;\n entityId?: string | number;\n databaseId?: string;\n copy?: boolean;\n selectedTab?: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n onValuesModified?: (modified: boolean, values: M) => void;\n onSaved?: (params: OnUpdateParams) => void;\n onTabChange?: (props: OnTabChangeParams<M>) => void;\n navigateBack?: () => void;\n /**\n * Dismiss this record — the ✕ at the identity bar's trailing edge, and what\n * \"save and close\" reaches once the save lands.\n *\n * Set by the layouts that own the record's place on screen but are not side\n * dialogs: the split, where dismissing is navigating back to the collection.\n * The side panel and the dialog close through {@link useSideDialogContext}\n * instead, which is what runs their unsaved-changes prompt.\n */\n onCloseRequest?: () => void;\n layout?: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n barActions?: (params: BarActionsParams) => React.ReactNode;\n /**\n * Controls the owning panel puts at the identity bar's leading edge, ahead\n * of the breadcrumb — the side panel's close button.\n */\n barActionsStart?: React.ReactNode;\n /**\n * Full screen only: bring the list back beside this record. Set when the\n * record was opened out of a split collection, so folding the list away is\n * reversible; it takes the place of the back arrow when present.\n */\n onShowList?: () => void;\n formProps?: Partial<EntityFormBindingProps<M>>,\n /**\n * Pre-populate the form with these values when creating a new entity.\n * Only applied when the form is in \"new\" mode (no entityId).\n * Sourced from SidePanelBindingProps (side panel) or location.state (full screen).\n */\n defaultValues?: Partial<M>;\n}\n\n/**\n * This is the default view that is used as the content of a side panel when\n * a record is opened.\n */\nexport function EditViewBinding<M extends Record<string, unknown>>({\n entityId,\n ...props\n}: EditViewBindingProps<M>) {\n\n const {\n entity,\n dataLoading,\n\n dataLoadingError\n } = useFetch<M>({\n path: props.path,\n entityId: entityId,\n collection: props.collection,\n // The relation fields' values, read with the record (see `useFetch`).\n relations: true,\n databaseId: props.databaseId,\n useCache: false\n });\n\n // The edit handed over by another layout of this same record — see\n // {@link carryEdit} below for the sending half.\n //\n // Read once per record and consumed: this is a handoff, and an edit left in\n // the channel after it has been picked up is one that reopens the record\n // dirty on a later, unrelated visit, carrying values the user walked away\n // from. Held in a ref rather than re-read each render, because the read has\n // to survive the clear — {@link EntityFormBinding} measures the\n // local-changes banner against what the form opens showing, and a prop that\n // reverted to `undefined` once the cache was cleared would raise the banner\n // over the very edit that was just carried in.\n //\n // A copy is keyed with the new records, not under the record it was copied\n // from: it is going to be stored as its own row, and both the handoff and\n // the local-changes backup have always keyed it that way from the writing\n // side. Reading it under `path/id` meant a copy in progress was written to\n // one key and looked for under another.\n const carriesAsNew = props.copy || entityId === undefined;\n const handoffKey = carriesAsNew ? props.path + \"#new\" : props.path + \"/\" + entityId;\n const handoff = useRef<{ key: string, values: object | undefined } | null>(null);\n if (handoff.current?.key !== handoffKey) {\n handoff.current = {\n key: handoffKey,\n values: getEntityFromMemoryCache(handoffKey)\n };\n }\n useEffect(() => {\n removeEntityFromMemoryCache(handoffKey);\n }, [handoffKey]);\n\n const initialDirtyValues = carriesAsNew\n ? (props.defaultValues ?? handoff.current.values)\n : handoff.current.values;\n\n const { canEdit: canEditHook } = usePermissions();\n const { t } = useTranslation();\n const urlController = useUrlController();\n\n const initialStatus = props.copy ? \"copy\" : (entityId ? \"existing\" : \"new\");\n const [status, setStatus] = useState<EntityStatus>(initialStatus);\n\n // The record as it was last delivered while this view had it open. A live\n // read that stops delivering it — someone deleted it — is not a record\n // that was never there, and must not be shown as one: the not-found screen\n // below used to replace the form mid-edit, taking what had been typed off\n // the screen and blaming row-level security for it.\n const [lastSeenEntity, setLastSeenEntity] = useState<Entity<M> | undefined>(undefined);\n useEffect(() => {\n if (entity) setLastSeenEntity(entity);\n }, [entity]);\n const deletedElsewhere = status === \"existing\" && !dataLoading && !entity && entityId !== undefined\n && lastSeenEntity !== undefined && String(lastSeenEntity.id) === String(entityId);\n\n // The record the form shows: the stored one, or the last one seen of it.\n const shownEntity = deletedElsewhere ? lastSeenEntity : entity;\n\n const canEdit = useMemo(() => {\n if (status === \"new\" || status === \"copy\") {\n return true;\n } else {\n return shownEntity ? canEditHook(props.collection, props.path, shownEntity ?? null) : undefined;\n }\n }, [canEditHook, shownEntity, status, props.collection, props.path]);\n\n if (!dataLoading && dataLoadingError) {\n return <CenteredView>\n <ErrorView error={dataLoadingError} />\n </CenteredView>\n }\n\n /**\n * There is no id, so there is no record that could have been missing.\n *\n * The branch below answers \"the record this URL names is not there\", and\n * with no id nothing is named. Without this it fired on every successful\n * *create*: `EntityFormBinding` sets `status` to `\"existing\"` the moment a\n * save lands, and the `entityId` prop arrives one render later from the\n * URL, so for one frame the component reported a record with no id as\n * missing — `Entity with id undefined not found in collection posts`,\n * twice under StrictMode, beside a \"Saved successfully\" toast, with\n * \"Entity not found\" flashed over the record that had just been created.\n *\n * Written against the id rather than against `status === \"existing\"`\n * because the same thing is true of a copy in flight, and because \"we have\n * nothing to look up\" is the actual reason.\n */\n const nothingToLookUp = !entityId;\n\n if (!dataLoading && !initialDirtyValues && !entity && !nothingToLookUp && !deletedElsewhere\n && (status === \"existing\" || status === \"copy\")) {\n // A `warn`, and only for a real id: an unknown record in the URL is\n // something a person did, not a fault in the panel — the screen below\n // says so, and this is for whoever is reading the console at the time.\n console.warn(`Entity with id ${entityId} not found in collection ${props.path}`);\n return <CenteredView>\n <div className=\"flex flex-col items-center gap-2 text-center\">\n <Typography variant=\"label\">{t(\"entity_not_found\")}</Typography>\n <Typography variant=\"body2\" color=\"secondary\">{t(\"entity_not_found_body\")}</Typography>\n {/* No CMS route serves an embedded page, so there is no collection to go back to. */}\n {urlController.routesMounted !== false && <Button\n variant=\"text\"\n component={Link}\n to={urlController.buildUrlCollectionPath(props.path)}\n >\n {t(\"back_to_collection\", { name: props.collection.name ?? props.path })}\n </Button>}\n </div>\n </CenteredView>;\n }\n\n const content = (\n <EditViewBindingInner<M> {...props}\n entityId={entityId}\n entity={shownEntity}\n deletedElsewhere={deletedElsewhere}\n initialDirtyValues={initialDirtyValues as Partial<M>}\n dataLoading={dataLoading}\n status={status}\n setStatus={setStatus}\n canEdit={canEdit}\n />\n );\n\n return (\n <CollectionScopeProvider collection={props.collection}>\n {content}\n </CollectionScopeProvider>\n );\n}\n\nexport function EditViewBindingInner<M extends Record<string, unknown>>({\n path,\n entityId,\n selectedTab: selectedTabProp,\n collection,\n parentCollectionSlugs, parentEntityIds,\n onValuesModified,\n onSaved,\n onTabChange,\n navigateBack,\n onCloseRequest,\n entity,\n initialDirtyValues,\n dataLoading,\n layout = \"side_panel\",\n barActions,\n barActionsStart,\n onShowList,\n status,\n setStatus,\n formProps,\n canEdit,\n deletedElsewhere\n}: EditViewBindingProps<M> & {\n entity?: Entity<M>,\n initialDirtyValues?: Partial<M>, // dirty cached entity in memory\n dataLoading: boolean,\n status: EntityStatus,\n setStatus: (status: EntityStatus) => void,\n canEdit?: boolean,\n /**\n * The record was deleted by someone else while this form had it open. The\n * form keeps its values; saving them over the record is no longer\n * possible, saving them as a new one is.\n */\n deletedElsewhere?: boolean,\n}) {\n\n const ResolvedFormActions = useComponentOverride(\"EditView.FormActions\", EditFormActions);\n const ResolvedEntityForm = useComponentOverride(\"Entity.Form\", EntityFormBinding) as typeof EntityFormBinding;\n const ResolvedCollectionView = useComponentOverride(\"Collection.View\", CollectionViewBinding);\n\n const context = useRebaseContext();\n const adminContext = useAdminContext();\n const urlController = useUrlController();\n const navigate = useNavigate();\n const { t } = useTranslation();\n\n const [usedEntity, setUsedEntity] = useState<Entity<M> | undefined>(entity);\n\n useEffect(() => {\n if (entity)\n setUsedEntity(entity);\n }, [entity]);\n\n const [formContext, setFormContext] = useState<FormContext<M> | undefined>(undefined);\n\n const largeLayout = useLargeLayout();\n\n const discard = useUndoableDiscard();\n\n const customizationController = useCustomizationController();\n const plugins = customizationController.plugins;\n\n const formActionTopProps: PluginFormActionProps = useMemo(() => ({\n entityId,\n parentCollectionSlugs,\nparentEntityIds,\n path: path,\n status,\n collection: collection!,\n context,\n formContext: formContext as FormContext<Record<string, unknown>> | undefined,\n openEntityMode: layout,\n disabled: false\n }), [entityId, parentCollectionSlugs, parentEntityIds, path, status, collection, context, formContext, layout]);\n const pluginActionsTop = useSlot(\"form.actions.top\", formActionTopProps);\n\n const defaultSelectedView = useMemo(() => resolveDefaultSelectedView(\n collection ? collection.defaultSelectedView : undefined,\n {\n status,\n entityId\n }\n ), [collection, status, entityId]);\n\n // Track whether the user has explicitly clicked a tab in this component\n // instance. When false, we fall back to defaultSelectedView (which may\n // resolve asynchronously if the collection loads from the registry after\n // mount). Once true, selectedTabProp=undefined means the user selected\n // the form tab, so we must NOT re-apply defaultSelectedView.\n const userHasChangedTab = useRef(false);\n\n const [selectedTab, setSelectedTab] = useState<string>(() => {\n const val = selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;\n return val === \"edit\" ? MAIN_TAB_VALUE : val;\n });\n useEffect(() => {\n const val = userHasChangedTab.current\n ? (selectedTabProp ?? MAIN_TAB_VALUE)\n : (selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE);\n const target = val === \"edit\" ? MAIN_TAB_VALUE : val;\n if (target !== selectedTab) {\n setSelectedTab(target);\n }\n }, [selectedTabProp, defaultSelectedView]);\n\n // See DetailViewBinding: tabs are governed by `hideFromEntityViews`, the\n // drawer by `hideFromNavigation`. They are separate roles.\n const childViews = getAdminEntityChildViews(collection).filter(v => !v.collection.hideFromEntityViews);\n const subcollections = childViews.map(v => v.collection);\n const subcollectionsCount = subcollections?.length ?? 0;\n const customViews = collection.entityViews ?? [];\n const customViewsCount = customViews?.length ?? 0;\n const includeJsonView = collection.includeJsonView === undefined ? true : collection.includeJsonView;\n const includeHistoryView = Boolean(collection.history);\n // The inspector holds the developer tools; the tab strip holds destinations.\n // A strip with only the record in it has nothing to choose between, so it\n // does not render at all.\n const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;\n\n const {\n resolvedEntityViews\n } = resolvedSelectedEntityView(customViews, customizationController, undefined, canEdit);\n\n // JSON and history are no longer tab values, but a bookmarked or in-flight\n // URL may still name one. They resolve to the record, and open the\n // inspector on that pane, so an old link keeps working.\n const legacyInspectorTab = selectedTab === JSON_TAB_VALUE\n ? \"json\"\n : selectedTab === HISTORY_TAB_VALUE ? \"history\" : undefined;\n\n const validTabValues = useMemo(() => {\n const set = new Set<string>([\n MAIN_TAB_VALUE,\n ...resolvedEntityViews.map(v => v.key),\n ...subcollections.map(s => s.slug)\n ]);\n return set;\n }, [resolvedEntityViews, subcollections]);\n\n const activeTab = validTabValues.has(selectedTab) ? selectedTab : MAIN_TAB_VALUE;\n\n const {\n selectedEntityView,\n selectedSecondaryForm\n } = resolvedSelectedEntityView(customViews, customizationController, activeTab, canEdit);\n\n\n const mainViewVisible = activeTab === MAIN_TAB_VALUE || Boolean(selectedSecondaryForm);\n\n // Track which custom view tabs have been visited so we keep them mounted\n // (preserving their state) but don't eagerly mount tabs never visited.\n const mountedTabsRef = useRef<Set<string>>(new Set());\n if (activeTab) {\n mountedTabsRef.current.add(activeTab);\n }\n\n /**\n * The record as a context with no form behind it: what a view is handed\n * where nothing can edit the record — the read-only rendering for a user\n * without permission, and the entity-view tabs until the form has mounted\n * and published its own. Its writes throw, so it says `disabled`: that is\n * the flag every control already honours, and a stand-in reporting\n * `disabled: false` invited the very write it was about to refuse.\n *\n * Not dropped once the form's context arrives. The form mounts even where\n * it is hidden — for a user who cannot edit, the read-only view is shown\n * beside a hidden form — so its context always arrives, and the read-only\n * view lost its context the moment it did: a `formView` flipped to the\n * default rendering, and `additionalFields` vanished from the default one.\n */\n const readOnlyFormContext = useMemo<FormContext<M> | undefined>(() => {\n if (!entityId) return undefined;\n const formexStub = createFormexStub<M>(usedEntity?.values ?? {} as M);\n return {\n entityId,\n disabled: true,\n readOnly: true,\n openEntityMode: layout,\n status: status,\n values: usedEntity?.values ?? ({} as M),\n setFieldValue: (key: string, value: unknown) => {\n throw new Error(\"You can't update values in read only mode\");\n },\n save: () => {\n throw new Error(\"You can't save in read only mode\");\n },\n submit: () => {\n throw new Error(\"You can't submit in read only mode\");\n },\n collection,\n path: path,\n entity: usedEntity,\n savingError: undefined,\n formex: formexStub\n };\n }, [entityId, layout, status, usedEntity, collection, path]);\n\n const nonActionCustomViews = useMemo(() =>\n resolvedEntityViews.filter(e => !e.includeActions),\n [resolvedEntityViews]\n );\n\n const customViewsView: React.ReactNode[] | undefined = customViews && nonActionCustomViews\n .map((customView) => {\n\n if (!customView)\n return null;\n const Builder = resolveComponentRef<EntityCustomViewParams>(customView.Builder);\n if (!Builder) {\n console.error(\"INTERNAL: customView.Builder is not defined or could not be resolved\");\n return null;\n }\n\n if (!entityId) {\n return null;\n }\n\n // Only mount tabs that have been visited at least once\n const isActive = activeTab === customView.key;\n const hasBeenMounted = mountedTabsRef.current.has(customView.key);\n if (!isActive && !hasBeenMounted) {\n return null;\n }\n\n const usedFormContext: FormContext<M> = formContext ?? readOnlyFormContext!;\n\n return <div\n className={cls(defaultBorderMixin,\n \"relative flex-1 w-full h-full overflow-auto\",\n { \"hidden\": !isActive }\n )}\n key={`custom_view_${customView.key}`}\n role=\"tabpanel\">\n <ErrorBoundary>\n <Suspense fallback={<CircularProgressCenter />}>\n {usedFormContext && <Builder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedFormContext?.formex?.values ?? usedEntity?.values}\n formContext={usedFormContext as FormContext<Record<string, unknown>>}\n />}\n </Suspense>\n </ErrorBoundary>\n </div>;\n }).filter(Boolean);\n\n const globalLoading = (dataLoading && !usedEntity) || (canEdit === undefined && (status === \"existing\" || status === \"copy\"));\n\n /* ---- identity bar ---------------------------------------------------- */\n\n const displayTitle = useEntityDisplayTitle({\n collection,\n entity: usedEntity,\n values: (formContext?.values ?? usedEntity?.values) as Record<string, unknown> | undefined,\n status\n });\n\n const formex = formContext?.formex;\n const hasFormErrors = Boolean(formex && Object.keys(formex.errors).length > 0 && formex.submitCount > 0);\n // Same rule the footer used: an untouched existing record has nothing to save.\n const saveDisabled = Boolean(\n !formContext\n || formContext.disabled\n || formex?.isSubmitting\n || (status === \"existing\" && !formex?.dirty)\n // There is no record left to save over.\n || deletedElsewhere\n );\n\n /**\n * Hand this record's edit in progress to the layout about to replace this\n * one — the split's \"hide list\", full screen's \"show list\", the side panel's\n * \"open full screen\". None of them is a navigation *away* from the record:\n * the same record is about to be shown by a different form, and what the\n * user has typed belongs to the record, not to the pane it was typed in.\n *\n * Every control that changes layout has to call this, and none of them is\n * blocked by the unsaved-changes prompt — the prompt asks about leaving, and\n * these do not leave. What used to happen instead is that the edit reached\n * the next layout only as its local-changes backup, which is the channel for\n * a draft left behind by a closed tab: the record reopened *clean*, with a\n * banner offering to apply changes the user had never walked away from.\n */\n const carryEdit = useCallback(() => {\n const carried = formex\n ? getEditHandoffValues<M>({\n status,\n dirty: formex.dirty,\n values: formex.values,\n touched: formex.touched,\n storedValues: usedEntity?.values\n })\n : undefined;\n if (!carried) return;\n const key = (status === \"new\" || status === \"copy\") ? path + \"#new\" : path + \"/\" + entityId;\n saveEntityToMemoryCache(key, carried);\n }, [formex, status, path, entityId, usedEntity]);\n\n /**\n * The record was deleted elsewhere: open a new one holding what this form\n * holds, so that nothing typed here is lost. The values travel as the new\n * form's defaults — the same channel \"new with values\" uses everywhere —\n * and they are carried, so leaving this form does not ask about them.\n */\n const saveAsNew = useCallback(() => {\n const values = formex?.values ?? usedEntity?.values;\n if (values) onValuesModified?.(false, values);\n navigateToEntity({\n openEntityMode: layout,\n collection,\n path,\n defaultValues: values,\n sidePanelController: adminContext.sidePanelController,\n navigation: urlController,\n replace: true\n });\n }, [formex, usedEntity, onValuesModified, layout, collection, path, adminContext.sidePanelController, urlController]);\n\n const [inspectorTab, setInspectorTab] = useState<InspectorTab | null>(null);\n // A save adds a revision, and the inspector can be open while it happens:\n // Save lives in the identity bar, above the panel. Counting saves gives the\n // history list something to react to.\n const [savedCount, setSavedCount] = useState(0);\n\n /* ---- record actions, in the bar's overflow menu ---------------------- */\n\n const sideDialogContext = useSideDialogContext();\n\n /**\n * Whether the save in flight was asked to dismiss the record afterwards.\n *\n * A ref, and for the reason {@link SideDialogs} keeps its own as one: the\n * flag is raised and the form submitted in a single click handler, and the\n * `onSaved` that has to act on it was captured before React could re-render.\n * As state it read one save late — the first \"save and close\" saved and\n * stayed open, and the *next* save closed the record.\n *\n * The side panel and the dialog use the side-dialog controller's flag,\n * which their own close path consumes; this one covers the layouts that\n * close by calling {@link onCloseRequest} instead.\n */\n const pendingCloseRef = useRef(false);\n\n // The split can close after a save the same way the overlays do — through\n // the callback its layout supplies. Without one there is nothing to close.\n const canCloseAfterSave = layout === \"side_panel\" || layout === \"dialog\"\n || (layout === \"split\" && Boolean(onCloseRequest));\n\n const leaveRecord = useLeaveRecord({ layout, path, onCloseRequest });\n\n const recordActionClickProps = useMemo(() => usedEntity\n ? {\n view: \"form\" as const,\n entity: usedEntity as Entity<Record<string, unknown>>,\n path,\n collection: collection as AdminCollection,\n context,\n sidePanelController: adminContext.sidePanelController,\n openEntityMode: layout,\n navigateBack: leaveRecord,\n formContext: formContext as FormContext<Record<string, unknown>> | undefined\n }\n : undefined, [usedEntity, path, collection, context, adminContext.sidePanelController, layout, leaveRecord, formContext]);\n\n const recordActions = useRecordActions({\n collection,\n path,\n entity: usedEntity,\n clickProps: recordActionClickProps\n });\n\n // Plugin form actions (Autofill and friends) render inline in the bar; the\n // form no longer has a footer to put them in.\n const formPluginActions = useSlot(\"form.actions\", formActionTopProps);\n\n // A URL still naming the old `json`/`history` tab opens the inspector on\n // that pane instead of 404-ing into the record with nothing shown.\n useEffect(() => {\n if (legacyInspectorTab) setInspectorTab(legacyInspectorTab);\n }, [legacyInspectorTab]);\n\n const subCollectionsViews = childViews && childViews.map(({ collection: subcollection }) => {\n const subcollectionId = subcollection.slug;\n // By slug, like the path it extends: the data layer hands the driver\n // the stored path, `path` included, for the whole of it at once.\n const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.slug)}` : undefined;\n\n if (activeTab !== subcollectionId) return null;\n return (\n <div\n className={\"relative flex-1 h-full overflow-auto w-full\"}\n key={`subcol_${subcollectionId}`}\n role=\"tabpanel\">\n\n {globalLoading && <CircularProgressCenter />}\n\n {!globalLoading &&\n (usedEntity && newFullPath\n ? <ResolvedCollectionView\n path={newFullPath}\n parentCollectionSlugs={[...parentCollectionSlugs, collection.slug]}\n parentEntityIds={[...parentEntityIds, String(usedEntity?.id)]}\n updateUrl={false}\n {...subcollection}\n openEntityMode={layout} />\n : <div className=\"flex items-center justify-center w-full h-full p-3\">\n <Typography variant={\"label\"}>\n {t(\"save_entity_before_subcollections\")}\n </Typography>\n </div>)\n }\n\n </div>\n );\n }).filter(Boolean);\n\n const onSideTabClick = useCallback((value: string) => {\n userHasChangedTab.current = true;\n setSelectedTab(value);\n if (status === \"existing\") {\n onTabChange?.({\n path: path,\n entityId,\n selectedTab: value === MAIN_TAB_VALUE ? undefined : value,\n collection\n });\n }\n }, [status, onTabChange, path, entityId, collection]);\n\n const formViewConfig = (collection as AdminCollection<M> & { formView?: FormViewConfig<M> }).formView;\n const FormViewBuilder = resolveComponentRef<EntityCustomViewParams<M>>(formViewConfig?.Builder);\n const formViewIncludeActions = formViewConfig?.includeActions !== false;\n\n /**\n * What the record form renders in place of its generated fields.\n *\n * A `formView` Builder is rendered *by the form*, never instead of it. It\n * used to be drawn here in the form's place, and the form is the only\n * thing that can hand it a working context — the real one arrives through\n * `onFormContextReady`, and with no form mounted it never did. Every\n * Builder got the read-only stand-in above: each keystroke threw inside\n * `setFieldValue`, and Save and Discard, which wait on that same context,\n * never appeared. A new record was worse: with no id there is not even a\n * stand-in, and the screen stayed blank.\n *\n * An entity view declared with `includeActions` is a second form over the\n * same record, and takes the place while its tab is open.\n */\n const FormBuilder = selectedSecondaryForm\n ? resolveComponentRef(selectedSecondaryForm.Builder as ComponentRef<EntityCustomViewParams<M>> | undefined)\n : FormViewBuilder;\n\n /**\n * `formView.includeActions: false` leaves saving to the Builder — it holds\n * `formContext.submit` and `save` — so the bar offers no Save or Discard of\n * its own. Only for the collection's form: an entity view that declared\n * `includeActions` is on screen because it asked for them. Delete is a\n * record action, in the bar's overflow menu, and is not affected.\n */\n const formActionsContext = canEdit && formContext\n && (!FormViewBuilder || formViewIncludeActions || selectedSecondaryForm)\n ? formContext\n : undefined;\n\n // Without edit permission the record is rendered read-only — the same\n // sections, spans and rail as the form, so losing the permission changes the\n // controls and nothing else. The `h4` that used to head this repeated the\n // collection name the identity bar above it already carries.\n const entityReadOnlyView = !canEdit && entity ? (\n FormViewBuilder && readOnlyFormContext\n ? <div className={cls(\n \"@container/form flex-1 flex flex-row w-full overflow-y-auto justify-center\",\n (canEdit || !mainViewVisible || selectedSecondaryForm) ? \"hidden\" : \"\"\n )}>\n {/* Same widths as the default form (see EntityForm). */}\n <div className={\"w-full max-w-3xl @7xl/form:max-w-4xl 2xl:max-w-4xl flex flex-col pt-6 pb-16 px-5 sm:px-8\"}>\n <ErrorBoundary>\n <Suspense fallback={<CircularProgressCenter />}>\n <FormViewBuilder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedEntity?.values}\n formContext={readOnlyFormContext}\n />\n </Suspense>\n </ErrorBoundary>\n </div>\n </div>\n : <EntityViewBinding\n className={cls((canEdit || !mainViewVisible || selectedSecondaryForm) ? \"hidden\" : \"\")}\n entity={entity}\n path={path}\n collection={collection}\n asPage\n openEntityMode={layout}\n formContext={readOnlyFormContext}/>\n ) : null;\n\n const entityView = (\n <ResolvedEntityForm<M>\n collection={collection}\n path={path}\n entityId={entityId ?? usedEntity?.id}\n onValuesModified={onValuesModified}\n entity={entity}\n initialDirtyValues={initialDirtyValues}\n openEntityMode={layout}\n // Save and Discard live in the identity bar now, where they stay\n // visible while the form scrolls. The form's own footer would be a\n // second copy of them.\n showDefaultActions={false}\n initialStatus={status}\n className={cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? \"hidden\" : \"\", formProps?.className)}\n EntityFormActionsComponent={ResolvedFormActions as React.FC<typeof ResolvedFormActions extends React.ComponentType<infer P> ? P : never>}\n disabled={!canEdit}\n navigateBack={navigateBack}\n {...formProps}\n onEntityChange={(entity) => {\n setUsedEntity(entity);\n formProps?.onEntityChange?.(entity);\n }}\n onStatusChange={(status) => {\n setStatus(status);\n formProps?.onStatusChange?.(status);\n }}\n onFormContextReady={(formContext) => {\n setFormContext(formContext);\n formProps?.onFormContextReady?.(formContext);\n }}\n onSaved={(params) => {\n setSavedCount(count => count + 1);\n const res = {\n ...params,\n selectedTab: MAIN_TAB_VALUE === activeTab ? undefined : activeTab\n };\n // Two caller-supplied callbacks for one save, and either may\n // navigate — the layouts' `onSaved` all do. Where both do, the\n // second one's destination is what survives (docs/bug-classes.md\n // #28), so `formProps.onSaved` is deliberately last: it belongs\n // to whoever embedded this view, which outranks the layout.\n onSaved?.(res);\n formProps?.onSaved?.(res);\n\n // After `onSaved`, never instead of it: the layout's own handler\n // is what lowers its dirty flag, and closing is a navigation the\n // unsaved-changes blocker would otherwise stop on values that\n // are already stored.\n //\n // And after this handler returns, not inside it. The layouts\n // that close this way close by navigating, and they have just\n // navigated themselves — the split leaves `…/edit` for the\n // record's own URL. Deferring keeps the close unambiguously\n // last, which is what decides it: of two navigations raised for\n // one action the final one survives, measured in\n // `router_two_navigations_one_handler.test.tsx`. It also lets\n // the state those handlers just set settle before the blocker\n // reads it. See docs/bug-classes.md #28.\n if (pendingCloseRef.current) {\n pendingCloseRef.current = false;\n setTimeout(() => onCloseRequest?.(), 0);\n }\n }}\n Builder={FormBuilder}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n >\n {deletedElsewhere &&\n <Alert color={\"warning\"} size={\"small\"} outerClassName={\"w-full mb-4\"}\n action={<Button size={\"small\"} variant={\"text\"} onClick={saveAsNew}>{t(\"save_as_new\")}</Button>}>\n {t(\"entity_deleted_elsewhere\")}\n </Alert>}\n </ResolvedEntityForm>\n );\n\n const subcollectionTabs = subcollections && subcollections.map((subcollection) => {\n const icon = getIcon(subcollection.icon, undefined, undefined, \"smallest\");\n return (\n <Tab\n className={cls(ENTITY_VIEW_TAB_CLASS, ENTITY_VIEW_TAB_LABEL_CLASS)}\n value={subcollection.slug}\n key={`entity_detail_collection_tab_${subcollection.name}`}>\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {subcollection.name}\n </span>\n </Tab>\n );\n });\n\n const customViewTabsStart = resolvedEntityViews.filter(view => view.position === \"start\")\n .map((view) => {\n const icon = getIcon(view.icon, undefined, undefined, \"smallest\");\n return (\n <Tab\n className={cls(ENTITY_VIEW_TAB_CLASS, !view.tabComponent && ENTITY_VIEW_TAB_LABEL_CLASS)}\n value={view.key}\n key={`entity_detail_collection_tab_${view.name}`}>\n {view.tabComponent ?? (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {view.name}\n </span>\n )}\n </Tab>\n );\n });\n const customViewTabsEnd = resolvedEntityViews.filter(view => !view.position || view.position === \"end\")\n .map((view) => {\n const icon = getIcon(view.icon, undefined, undefined, \"smallest\");\n return (\n <Tab\n className={cls(ENTITY_VIEW_TAB_CLASS, !view.tabComponent && ENTITY_VIEW_TAB_LABEL_CLASS)}\n value={view.key}\n key={`entity_detail_collection_tab_${view.name}`}>\n {view.tabComponent ?? (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {view.name}\n </span>\n )}\n </Tab>\n );\n });\n\n const onSave = formActionsContext ? () => {\n sideDialogContext.setPendingClose?.(false);\n pendingCloseRef.current = false;\n formActionsContext.submit();\n } : undefined;\n\n const onSaveAndClose = formActionsContext && canCloseAfterSave ? () => {\n // Lowered again once the submit settles. A submit the form\n // rejects never reaches `onSaved`, so nothing would consume the\n // flag and the *next* save — a keyboard ⌘S, say — would close\n // the panel out from under an edit nobody asked to finish. A\n // save that succeeds has already closed by the time this runs.\n if (layout === \"split\") {\n pendingCloseRef.current = true;\n Promise.resolve(formActionsContext.submit())\n .finally(() => { pendingCloseRef.current = false; });\n return;\n }\n sideDialogContext.setPendingClose?.(true);\n Promise.resolve(formActionsContext.submit())\n .finally(() => sideDialogContext.setPendingClose?.(false));\n } : undefined;\n\n // Unlike the form's own Discard, this one does not stop to ask — so it has\n // to be reversible. See {@link useUndoableDiscard}.\n const onDiscard = formActionsContext\n ? () => discard(formActionsContext.formex, status)\n : undefined;\n\n /**\n * The dialog keeps Save at its foot, not in the bar.\n *\n * A dialog is filled in top to bottom and finished at the bottom, which is\n * where every other dialog in the app puts its buttons; up in the bar's\n * right-hand corner, Create was the one thing on screen the eye had to\n * travel back up to reach. The bar keeps what the record is and the ways\n * out of it. The side panel and the pages keep Save in the bar, where it\n * stays in view while a long form scrolls.\n */\n const actionsInFooter = layout === \"dialog\";\n\n const fullScreenButton = !barActions && // Not in split: the list panel beside it carries the close control,\n // and an expand button there competes with it.\n (layout === \"side_panel\" || layout === \"dialog\") && entityId ? (\n <Tooltip title={\"Open full screen\"}>\n <IconButton aria-label={\"Open full screen\"}\n size=\"small\"\n onClick={() => {\n carryEdit();\n const editSuffix = collection.defaultEntityAction === \"view\" ? \"/edit\" : \"\";\n const entityUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}${editSuffix}`);\n navigate(`${entityUrl}#full`);\n }}\n >\n <Maximize2Icon size={iconSize.smallest} />\n </IconButton>\n </Tooltip>\n ) : null;\n\n let result = <div className=\"relative flex flex-col h-full w-full bg-surface-card\">\n\n <EntityIdentityBar\n collection={collection as AdminCollection}\n collectionUrl={layout === \"full_screen\" || layout === \"split\"\n ? withListState(urlController.buildUrlCollectionPath(path))\n : undefined}\n title={displayTitle}\n entityId={status === \"existing\" ? entityId : undefined}\n status={status}\n dirty={Boolean(formContext?.formex?.dirty)}\n saving={Boolean(formContext?.isSaving)}\n hasErrors={hasFormErrors}\n saveDisabled={!canEdit || saveDisabled}\n // Full screen replaces the collection entirely, leaving browser Back\n // as the only route to it. The detail view has carried this arrow\n // for that reason; the edit view is reached the same way. Where the\n // list can be unfolded back beside the record, that chevron reaches\n // the same collection and the arrow beside it is noise.\n onBack={layout === \"full_screen\" && !onShowList\n ? () => navigate(withListState(urlController.buildUrlCollectionPath(path)))\n : undefined}\n onSave={actionsInFooter ? undefined : onSave}\n onSaveAndClose={actionsInFooter ? undefined : onSaveAndClose}\n // Welded to Save in the split, its own button in the overlays.\n saveAndClosePlacement={layout === \"split\" ? \"menu\" : \"button\"}\n onClose={onCloseRequest}\n onDiscard={actionsInFooter ? undefined : onDiscard}\n onInspect={includeJsonView ? () => setInspectorTab(\"json\") : undefined}\n onViewHistory={includeHistoryView ? () => setInspectorTab(\"history\") : undefined}\n externalLink={usedEntity\n ? customizationController?.entityLinkBuilder?.({ entity: usedEntity })\n : undefined}\n recordActions={recordActions}\n pluginActions={formPluginActions}\n leading={<>\n {barActionsStart}\n {/* Split view: closing the list is opening this record\n full screen, and the control for it belongs at this\n bar's leading edge. Full screen carries its mirror.\n Both change layout, so both hand the edit over. */}\n {layout === \"split\" && <SplitListCloseButton onBeforeHide={carryEdit}/>}\n {layout === \"full_screen\" && onShowList && <SplitListShowButton onClick={() => {\n carryEdit();\n onShowList();\n }}/>}\n </>}\n trailing={<>\n {pluginActionsTop}\n {fullScreenButton}\n {barActions?.({\n path,\n entityId,\n values: formContext?.values ?? usedEntity?.values ?? {},\n status,\n dirty: Boolean(formContext?.formex?.dirty),\n carryEdit\n })}\n </>}\n />\n\n {/* Destinations only: the record is the page, so its tab leads rather\n than sitting third behind two unlabelled developer tools. The row\n disappears entirely when there is nowhere else to go. */}\n {hasAdditionalViews && <div className={cls(\n \"h-10 shrink-0 flex items-stretch border-b px-2 min-w-0\",\n ENTITY_VIEW_TAB_BAR_CLASS,\n defaultBorderMixin\n )}>\n <Tabs\n className={\"!w-full items-stretch\"}\n innerClassName={\"h-full\"}\n variant={\"boxy\"}\n value={activeTab}\n onValueChange={(value) => {\n onSideTabClick(value);\n }}>\n\n {/* Before the record, not after it.\n\n `position: \"start\"` used to mean \"first among the custom\n views\", which put it after a tab it was already after: the\n record's own tab is drawn here unconditionally, so \"start\"\n and \"end\" only ever ordered the custom views against each\n other, and no collection could open with anything but the\n form on the left.\n\n A cover — a read-only summary of the record, the thing an\n operator opens a row to see — belongs in front of the form\n that edits it. That is what `defaultSelectedView` already\n allowed, and the strip contradicted it by drawing the\n selected tab second. Views that say nothing still land after\n the record, so nothing moves for a collection that never\n asked. */}\n {customViewTabsStart}\n\n <Tab value={MAIN_TAB_VALUE}\n className={cls(ENTITY_VIEW_TAB_CLASS, ENTITY_VIEW_TAB_LABEL_CLASS)}>\n <span className=\"flex items-center gap-1.5\">\n {getIcon(collection.icon, undefined, undefined, \"smallest\")}\n {collection.singularName ?? collection.name}\n </span>\n </Tab>\n\n\n {customViewTabsEnd}\n\n {subcollectionTabs}\n </Tabs>\n </div>}\n\n {/* The record and the inspector share the space below the bar rather\n than stacking, so the form stays reachable while the panel is open.\n `min-w-0` keeps a wide form from pushing the panel off the edge. */}\n <div className={\"flex-1 min-h-0 flex\"}>\n\n <div className={\"flex-1 min-w-0 flex flex-col\"}>\n {globalLoading\n ? <EntityFormSkeleton collection={collection} />\n : <>\n {entityReadOnlyView}\n {entityView}\n </>}\n\n {customViewsView}\n\n {subCollectionsViews}\n </div>\n\n <EntityInspector\n tab={inspectorTab}\n onTabChange={setInspectorTab}\n onClose={() => setInspectorTab(null)}\n collection={collection as AdminCollection}\n entity={usedEntity as Entity<Record<string, unknown>> | undefined}\n formContext={formContext as FormContext<Record<string, unknown>> | undefined}\n values={formContext?.values ?? usedEntity?.values}\n refreshToken={savedCount}\n includeHistory={includeHistoryView}/>\n </div>\n\n {actionsInFooter && onSave && (\n <DialogActions translucent={false}>\n <EntitySaveActions\n status={status}\n dirty={Boolean(formContext?.formex?.dirty)}\n saving={Boolean(formContext?.isSaving)}\n hasErrors={hasFormErrors}\n saveDisabled={!canEdit || saveDisabled}\n onSave={onSave}\n onSaveAndClose={onSaveAndClose}\n onDiscard={onDiscard}/>\n </DialogActions>\n )}\n\n </div>;\n\n if (plugins && plugins.length > 0) {\n result = (\n <PluginProviderStack\n plugins={plugins}\n scope=\"form\"\n scopeProps={{\n status,\n path,\n collection,\n entity: usedEntity,\n context,\n formContext\n }}>\n {result}\n </PluginProviderStack>\n );\n }\n\n return result;\n}\n\nfunction EntityFormSkeleton({ collection }: { collection: AdminCollection }) {\n return (\n <div className=\"flex-1 flex flex-row w-full overflow-y-auto justify-center\">\n <div className=\"relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit\">\n <div className=\"flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10\">\n\n <div className=\"flex flex-row gap-4 self-end sticky top-4 z-10\">\n <Skeleton height={24} className=\"w-8 rounded-full\" />\n </div>\n\n <div className=\"w-full flex flex-col items-start my-4 lg:my-6\">\n <div className={`py-1 my-4 w-2/3 ${collection.hideIdFromForm ? \"mb-6\" : \"\"}`}>\n <Skeleton height={28} className=\"w-full rounded-md\" />\n </div>\n <Skeleton height={32} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"mt-12 flex flex-col gap-8\">\n <div className=\"flex flex-wrap gap-x-4 w-full space-y-8\">\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,SAAgB,gBAAmD,EAC/D,UACA,GAAG,SACqB;CAExB,MAAM,EACF,QACA,aAEA,qBACA,SAAY;EACZ,MAAM,MAAM;EACF;EACV,YAAY,MAAM;EAElB,WAAW;EACX,YAAY,MAAM;EAClB,UAAU;CACd,CAAC;CAmBD,MAAM,eAAe,MAAM,QAAQ,aAAa,KAAA;CAChD,MAAM,aAAa,eAAe,MAAM,OAAO,SAAS,MAAM,OAAO,MAAM;CAC3E,MAAM,UAAU,OAA2D,IAAI;CAC/E,IAAI,QAAQ,SAAS,QAAQ,YACzB,QAAQ,UAAU;EACd,KAAK;EACL,QAAQ,yBAAyB,UAAU;CAC/C;CAEJ,gBAAgB;EACZ,4BAA4B,UAAU;CA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pD,CAAA;QAEL,oBAAC,OAAD;SAAK,WAAU;mBACX,oBAAC,UAAD;UAAU,QAAQ;UAAI,WAAU;SAAqB,CAAA;QACpD,CAAA;QAEL,oBAAC,OAAD;SAAK,WAAU;mBACX,oBAAC,UAAD;UAAU,QAAQ;UAAI,WAAU;SAAqB,CAAA;QACpD,CAAA;OAEJ;;KACJ,CAAA;IACJ;;EACJ,CAAA;CACJ,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"EditViewBinding.js","names":[],"sources":["../../src/components/EditViewBinding.tsx"],"sourcesContent":["import type { ComponentRef } from \"@rebasepro/types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport type { EntityCustomViewParams, FormViewConfig, AdminCollection } from \"@rebasepro/cms-types\";\nimport type { FormContext } from \"../types/fields\";\nimport type { PluginFormActionProps } from \"@rebasepro/cms-types\";\nimport React, { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Entity, EntityStatus } from \"@rebasepro/types\";\nimport { PluginProviderStack, resolveComponentRef, useComponentOverride, CollectionScopeProvider, getAdminEntityChildViews } from \"@rebasepro/app\";\n\nimport { CollectionViewBinding } from \"./CollectionViewBinding/CollectionViewBinding\";\nimport { EntityViewBinding } from \"./EntityViewBinding\";\nimport { CircularProgressCenter, iconSize } from \"@rebasepro/ui\";\nimport {\n Alert,\n Button,\n CenteredView,\n CircularProgress,\n cls,\n CodeIcon,\n defaultBorderMixin,\n DialogActions,\n HistoryIcon,\n IconButton,\n Maximize2Icon,\n Skeleton,\n Tab,\n Tabs,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { ErrorView } from \"@rebasepro/app\";\n\nimport { removeInitialAndTrailingSlashes, resolveDefaultSelectedView } from \"@rebasepro/app\";\nimport { resolvedSelectedEntityView } from \"../util/resolutions\";\nimport {\n useCustomizationController,\n useFetch,\n useRebaseContext,\n useLargeLayout,\n useSlot,\n getIcon\n} from \"@rebasepro/app\";\nimport { getEntityFromMemoryCache, removeEntityFromMemoryCache, saveEntityToMemoryCache } from \"@rebasepro/app\";\nimport { EntityFormBinding } from \"../form\";\nimport { getEditHandoffValues } from \"../form/form_utils\";\nimport type { EntityFormBindingProps } from \"../form\";\nimport type { OnUpdateParams } from \"../types/components/EntityFormProps\";\nimport { EditFormActions } from \"./EditFormActions\";\nimport { EntityIdentityBar, EntitySaveActions } from \"./EntityIdentityBar\";\nimport { useUndoableDiscard } from \"../form/useUndoableDiscard\";\nimport { SplitListCloseButton } from \"./CollectionViewBinding/SplitListCloseButton\";\nimport { SplitListShowButton } from \"./CollectionViewBinding/SplitListShowButton\";\nimport { useLeaveRecord, useRecordActions } from \"../hooks/useRecordActions\";\nimport { useSideDialogContext } from \"./SideDialogs\";\nimport { useAdminContext } from \"../hooks/useAdminContext\";\nimport { EntityInspector, InspectorTab } from \"./EntityInspector\";\nimport { useEntityDisplayTitle } from \"../hooks/useEntityDisplayTitle\";\nimport { createFormexStub, getEntityFromCache } from \"@rebasepro/app\";\nimport { usePermissions, useTranslation } from \"@rebasepro/app\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { withListState } from \"../util/view_mode\";\nimport { navigateToEntity } from \"../util/navigation_utils\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport {\n MAIN_TAB_VALUE,\n JSON_TAB_VALUE,\n HISTORY_TAB_VALUE,\n ENTITY_VIEW_TAB_BAR_CLASS,\n ENTITY_VIEW_TAB_CLASS,\n ENTITY_VIEW_TAB_LABEL_CLASS\n} from \"../util/view_constants\";\nexport { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE };\n\nexport type BarActionsParams = {\n values: object,\n status: EntityStatus,\n path: string,\n entityId?: string | number;\n /** Whether `values` differ from what is stored. */\n dirty: boolean;\n /**\n * Hand the edit in progress to the layout this action is about to open, so\n * the record arrives showing — and still holding — what the user typed here.\n * Call it from any action that changes layout without leaving the record;\n * it decides on its own whether there is anything worth carrying, so a\n * record nobody edited still arrives clean.\n *\n * Only supplied where there is a form to carry: the detail view passes no\n * such thing.\n */\n carryEdit?: () => void;\n};\n\nexport type OnTabChangeParams<M extends Record<string, unknown>> = {\n path: string;\n entityId?: string | number;\n selectedTab?: string;\n collection: AdminCollection<M>;\n\n};\n\nexport interface EditViewBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {\n /**\n * The admin path of the entity, e.g. \"users\" or \"products\".\n */\n path: string;\n collection: AdminCollection<M>;\n entityId?: string | number;\n databaseId?: string;\n copy?: boolean;\n selectedTab?: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n onValuesModified?: (modified: boolean, values: M) => void;\n onSaved?: (params: OnUpdateParams) => void;\n onTabChange?: (props: OnTabChangeParams<M>) => void;\n navigateBack?: () => void;\n /**\n * Dismiss this record — the ✕ at the identity bar's trailing edge, and what\n * \"save and close\" reaches once the save lands.\n *\n * Set by the layouts that own the record's place on screen but are not side\n * dialogs: the split, where dismissing is navigating back to the collection.\n * The side panel and the dialog close through {@link useSideDialogContext}\n * instead, which is what runs their unsaved-changes prompt.\n */\n onCloseRequest?: () => void;\n layout?: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n barActions?: (params: BarActionsParams) => React.ReactNode;\n /**\n * Controls the owning panel puts at the identity bar's leading edge, ahead\n * of the breadcrumb — the side panel's close button.\n */\n barActionsStart?: React.ReactNode;\n /**\n * Full screen only: bring the list back beside this record. Set when the\n * record was opened out of a split collection, so folding the list away is\n * reversible; it takes the place of the back arrow when present.\n */\n onShowList?: () => void;\n formProps?: Partial<EntityFormBindingProps<M>>,\n /**\n * Pre-populate the form with these values when creating a new entity.\n * Only applied when the form is in \"new\" mode (no entityId).\n * Sourced from SidePanelBindingProps (side panel) or location.state (full screen).\n */\n defaultValues?: Partial<M>;\n}\n\n/**\n * This is the default view that is used as the content of a side panel when\n * a record is opened.\n */\nexport function EditViewBinding<M extends Record<string, unknown>>({\n entityId,\n ...props\n}: EditViewBindingProps<M>) {\n\n const {\n entity,\n dataLoading,\n\n dataLoadingError\n } = useFetch<M>({\n path: props.path,\n entityId: entityId,\n collection: props.collection,\n // The relation fields' values, read with the record (see `useFetch`).\n relations: true,\n databaseId: props.databaseId,\n useCache: false\n });\n\n // The edit handed over by another layout of this same record — see\n // {@link carryEdit} below for the sending half.\n //\n // Read once per record and consumed: this is a handoff, and an edit left in\n // the channel after it has been picked up is one that reopens the record\n // dirty on a later, unrelated visit, carrying values the user walked away\n // from. Held in a ref rather than re-read each render, because the read has\n // to survive the clear — {@link EntityFormBinding} measures the\n // local-changes banner against what the form opens showing, and a prop that\n // reverted to `undefined` once the cache was cleared would raise the banner\n // over the very edit that was just carried in.\n //\n // A copy is keyed with the new records, not under the record it was copied\n // from: it is going to be stored as its own row, and both the handoff and\n // the local-changes backup have always keyed it that way from the writing\n // side. Reading it under `path/id` meant a copy in progress was written to\n // one key and looked for under another.\n const carriesAsNew = props.copy || entityId === undefined;\n const handoffKey = carriesAsNew ? props.path + \"#new\" : props.path + \"/\" + entityId;\n const handoff = useRef<{ key: string, values: object | undefined } | null>(null);\n if (handoff.current?.key !== handoffKey) {\n handoff.current = {\n key: handoffKey,\n values: getEntityFromMemoryCache(handoffKey)\n };\n }\n useEffect(() => {\n removeEntityFromMemoryCache(handoffKey);\n }, [handoffKey]);\n\n const initialDirtyValues = carriesAsNew\n ? (props.defaultValues ?? handoff.current.values)\n : handoff.current.values;\n\n const { canEdit: canEditHook } = usePermissions();\n const { t } = useTranslation();\n const urlController = useUrlController();\n\n const initialStatus = props.copy ? \"copy\" : (hasEntityId(entityId) ? \"existing\" : \"new\");\n const [status, setStatus] = useState<EntityStatus>(initialStatus);\n\n // The record as it was last delivered while this view had it open. A live\n // read that stops delivering it — someone deleted it — is not a record\n // that was never there, and must not be shown as one: the not-found screen\n // below used to replace the form mid-edit, taking what had been typed off\n // the screen and blaming row-level security for it.\n const [lastSeenEntity, setLastSeenEntity] = useState<Entity<M> | undefined>(undefined);\n useEffect(() => {\n if (entity) setLastSeenEntity(entity);\n }, [entity]);\n const deletedElsewhere = status === \"existing\" && !dataLoading && !entity && entityId !== undefined\n && lastSeenEntity !== undefined && String(lastSeenEntity.id) === String(entityId);\n\n // The record the form shows: the stored one, or the last one seen of it.\n const shownEntity = deletedElsewhere ? lastSeenEntity : entity;\n\n const canEdit = useMemo(() => {\n if (status === \"new\" || status === \"copy\") {\n return true;\n } else {\n return shownEntity ? canEditHook(props.collection, props.path, shownEntity ?? null) : undefined;\n }\n }, [canEditHook, shownEntity, status, props.collection, props.path]);\n\n if (!dataLoading && dataLoadingError) {\n return <CenteredView>\n <ErrorView error={dataLoadingError} />\n </CenteredView>\n }\n\n /**\n * There is no id, so there is no record that could have been missing.\n *\n * The branch below answers \"the record this URL names is not there\", and\n * with no id nothing is named. Without this it fired on every successful\n * *create*: `EntityFormBinding` sets `status` to `\"existing\"` the moment a\n * save lands, and the `entityId` prop arrives one render later from the\n * URL, so for one frame the component reported a record with no id as\n * missing — `Entity with id undefined not found in collection posts`,\n * twice under StrictMode, beside a \"Saved successfully\" toast, with\n * \"Entity not found\" flashed over the record that had just been created.\n *\n * Written against the id rather than against `status === \"existing\"`\n * because the same thing is true of a copy in flight, and because \"we have\n * nothing to look up\" is the actual reason.\n */\n const nothingToLookUp = !hasEntityId(entityId);\n\n if (!dataLoading && !initialDirtyValues && !entity && !nothingToLookUp && !deletedElsewhere\n && (status === \"existing\" || status === \"copy\")) {\n // A `warn`, and only for a real id: an unknown record in the URL is\n // something a person did, not a fault in the panel — the screen below\n // says so, and this is for whoever is reading the console at the time.\n console.warn(`Entity with id ${entityId} not found in collection ${props.path}`);\n return <CenteredView>\n <div className=\"flex flex-col items-center gap-2 text-center\">\n <Typography variant=\"label\">{t(\"entity_not_found\")}</Typography>\n <Typography variant=\"body2\" color=\"secondary\">{t(\"entity_not_found_body\")}</Typography>\n {/* No CMS route serves an embedded page, so there is no collection to go back to. */}\n {urlController.routesMounted !== false && <Button\n variant=\"text\"\n component={Link}\n to={urlController.buildUrlCollectionPath(props.path)}\n >\n {t(\"back_to_collection\", { name: props.collection.name ?? props.path })}\n </Button>}\n </div>\n </CenteredView>;\n }\n\n const content = (\n <EditViewBindingInner<M> {...props}\n entityId={entityId}\n entity={shownEntity}\n deletedElsewhere={deletedElsewhere}\n initialDirtyValues={initialDirtyValues as Partial<M>}\n dataLoading={dataLoading}\n status={status}\n setStatus={setStatus}\n canEdit={canEdit}\n />\n );\n\n return (\n <CollectionScopeProvider collection={props.collection}>\n {content}\n </CollectionScopeProvider>\n );\n}\n\nexport function EditViewBindingInner<M extends Record<string, unknown>>({\n path,\n entityId,\n selectedTab: selectedTabProp,\n collection,\n parentCollectionSlugs, parentEntityIds,\n onValuesModified,\n onSaved,\n onTabChange,\n navigateBack,\n onCloseRequest,\n entity,\n initialDirtyValues,\n dataLoading,\n layout = \"side_panel\",\n barActions,\n barActionsStart,\n onShowList,\n status,\n setStatus,\n formProps,\n canEdit,\n deletedElsewhere\n}: EditViewBindingProps<M> & {\n entity?: Entity<M>,\n initialDirtyValues?: Partial<M>, // dirty cached entity in memory\n dataLoading: boolean,\n status: EntityStatus,\n setStatus: (status: EntityStatus) => void,\n canEdit?: boolean,\n /**\n * The record was deleted by someone else while this form had it open. The\n * form keeps its values; saving them over the record is no longer\n * possible, saving them as a new one is.\n */\n deletedElsewhere?: boolean,\n}) {\n\n const ResolvedFormActions = useComponentOverride(\"EditView.FormActions\", EditFormActions);\n const ResolvedEntityForm = useComponentOverride(\"Entity.Form\", EntityFormBinding) as typeof EntityFormBinding;\n const ResolvedCollectionView = useComponentOverride(\"Collection.View\", CollectionViewBinding);\n\n const context = useRebaseContext();\n const adminContext = useAdminContext();\n const urlController = useUrlController();\n const navigate = useNavigate();\n const { t } = useTranslation();\n\n const [usedEntity, setUsedEntity] = useState<Entity<M> | undefined>(entity);\n\n useEffect(() => {\n if (entity)\n setUsedEntity(entity);\n }, [entity]);\n\n const [formContext, setFormContext] = useState<FormContext<M> | undefined>(undefined);\n\n const largeLayout = useLargeLayout();\n\n const discard = useUndoableDiscard();\n\n const customizationController = useCustomizationController();\n const plugins = customizationController.plugins;\n\n const formActionTopProps: PluginFormActionProps = useMemo(() => ({\n entityId,\n parentCollectionSlugs,\nparentEntityIds,\n path: path,\n status,\n collection: collection!,\n context,\n formContext: formContext as FormContext<Record<string, unknown>> | undefined,\n openEntityMode: layout,\n disabled: false\n }), [entityId, parentCollectionSlugs, parentEntityIds, path, status, collection, context, formContext, layout]);\n const pluginActionsTop = useSlot(\"form.actions.top\", formActionTopProps);\n\n const defaultSelectedView = useMemo(() => resolveDefaultSelectedView(\n collection ? collection.defaultSelectedView : undefined,\n {\n status,\n entityId\n }\n ), [collection, status, entityId]);\n\n // Track whether the user has explicitly clicked a tab in this component\n // instance. When false, we fall back to defaultSelectedView (which may\n // resolve asynchronously if the collection loads from the registry after\n // mount). Once true, selectedTabProp=undefined means the user selected\n // the form tab, so we must NOT re-apply defaultSelectedView.\n const userHasChangedTab = useRef(false);\n\n const [selectedTab, setSelectedTab] = useState<string>(() => {\n const val = selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;\n return val === \"edit\" ? MAIN_TAB_VALUE : val;\n });\n useEffect(() => {\n const val = userHasChangedTab.current\n ? (selectedTabProp ?? MAIN_TAB_VALUE)\n : (selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE);\n const target = val === \"edit\" ? MAIN_TAB_VALUE : val;\n if (target !== selectedTab) {\n setSelectedTab(target);\n }\n }, [selectedTabProp, defaultSelectedView]);\n\n // See DetailViewBinding: tabs are governed by `hideFromEntityViews`, the\n // drawer by `hideFromNavigation`. They are separate roles.\n const childViews = getAdminEntityChildViews(collection).filter(v => !v.collection.hideFromEntityViews);\n const subcollections = childViews.map(v => v.collection);\n const subcollectionsCount = subcollections?.length ?? 0;\n const customViews = collection.entityViews ?? [];\n const customViewsCount = customViews?.length ?? 0;\n const includeJsonView = collection.includeJsonView === undefined ? true : collection.includeJsonView;\n const includeHistoryView = Boolean(collection.history);\n // The inspector holds the developer tools; the tab strip holds destinations.\n // A strip with only the record in it has nothing to choose between, so it\n // does not render at all.\n const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;\n\n const {\n resolvedEntityViews\n } = resolvedSelectedEntityView(customViews, customizationController, undefined, canEdit);\n\n // JSON and history are no longer tab values, but a bookmarked or in-flight\n // URL may still name one. They resolve to the record, and open the\n // inspector on that pane, so an old link keeps working.\n const legacyInspectorTab = selectedTab === JSON_TAB_VALUE\n ? \"json\"\n : selectedTab === HISTORY_TAB_VALUE ? \"history\" : undefined;\n\n const validTabValues = useMemo(() => {\n const set = new Set<string>([\n MAIN_TAB_VALUE,\n ...resolvedEntityViews.map(v => v.key),\n ...subcollections.map(s => s.slug)\n ]);\n return set;\n }, [resolvedEntityViews, subcollections]);\n\n const activeTab = validTabValues.has(selectedTab) ? selectedTab : MAIN_TAB_VALUE;\n\n const {\n selectedEntityView,\n selectedSecondaryForm\n } = resolvedSelectedEntityView(customViews, customizationController, activeTab, canEdit);\n\n\n const mainViewVisible = activeTab === MAIN_TAB_VALUE || Boolean(selectedSecondaryForm);\n\n // Track which custom view tabs have been visited so we keep them mounted\n // (preserving their state) but don't eagerly mount tabs never visited.\n const mountedTabsRef = useRef<Set<string>>(new Set());\n if (activeTab) {\n mountedTabsRef.current.add(activeTab);\n }\n\n /**\n * The record as a context with no form behind it: what a view is handed\n * where nothing can edit the record — the read-only rendering for a user\n * without permission, and the entity-view tabs until the form has mounted\n * and published its own. Its writes throw, so it says `disabled`: that is\n * the flag every control already honours, and a stand-in reporting\n * `disabled: false` invited the very write it was about to refuse.\n *\n * Not dropped once the form's context arrives. The form mounts even where\n * it is hidden — for a user who cannot edit, the read-only view is shown\n * beside a hidden form — so its context always arrives, and the read-only\n * view lost its context the moment it did: a `formView` flipped to the\n * default rendering, and `additionalFields` vanished from the default one.\n */\n const readOnlyFormContext = useMemo<FormContext<M> | undefined>(() => {\n if (!hasEntityId(entityId)) return undefined;\n const formexStub = createFormexStub<M>(usedEntity?.values ?? {} as M);\n return {\n entityId,\n disabled: true,\n readOnly: true,\n openEntityMode: layout,\n status: status,\n values: usedEntity?.values ?? ({} as M),\n setFieldValue: (key: string, value: unknown) => {\n throw new Error(\"You can't update values in read only mode\");\n },\n save: () => {\n throw new Error(\"You can't save in read only mode\");\n },\n submit: () => {\n throw new Error(\"You can't submit in read only mode\");\n },\n collection,\n path: path,\n entity: usedEntity,\n savingError: undefined,\n formex: formexStub\n };\n }, [entityId, layout, status, usedEntity, collection, path]);\n\n const nonActionCustomViews = useMemo(() =>\n resolvedEntityViews.filter(e => !e.includeActions),\n [resolvedEntityViews]\n );\n\n const customViewsView: React.ReactNode[] | undefined = customViews && nonActionCustomViews\n .map((customView) => {\n\n if (!customView)\n return null;\n const Builder = resolveComponentRef<EntityCustomViewParams>(customView.Builder);\n if (!Builder) {\n console.error(\"INTERNAL: customView.Builder is not defined or could not be resolved\");\n return null;\n }\n\n if (!hasEntityId(entityId)) {\n return null;\n }\n\n // Only mount tabs that have been visited at least once\n const isActive = activeTab === customView.key;\n const hasBeenMounted = mountedTabsRef.current.has(customView.key);\n if (!isActive && !hasBeenMounted) {\n return null;\n }\n\n const usedFormContext: FormContext<M> = formContext ?? readOnlyFormContext!;\n\n return <div\n className={cls(defaultBorderMixin,\n \"relative flex-1 w-full h-full overflow-auto\",\n { \"hidden\": !isActive }\n )}\n key={`custom_view_${customView.key}`}\n role=\"tabpanel\">\n <ErrorBoundary>\n <Suspense fallback={<CircularProgressCenter />}>\n {usedFormContext && <Builder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedFormContext?.formex?.values ?? usedEntity?.values}\n formContext={usedFormContext as FormContext<Record<string, unknown>>}\n />}\n </Suspense>\n </ErrorBoundary>\n </div>;\n }).filter(Boolean);\n\n const globalLoading = (dataLoading && !usedEntity) || (canEdit === undefined && (status === \"existing\" || status === \"copy\"));\n\n /* ---- identity bar ---------------------------------------------------- */\n\n const displayTitle = useEntityDisplayTitle({\n collection,\n entity: usedEntity,\n values: (formContext?.values ?? usedEntity?.values) as Record<string, unknown> | undefined,\n status\n });\n\n const formex = formContext?.formex;\n const hasFormErrors = Boolean(formex && Object.keys(formex.errors).length > 0 && formex.submitCount > 0);\n // Same rule the footer used: an untouched existing record has nothing to save.\n const saveDisabled = Boolean(\n !formContext\n || formContext.disabled\n || formex?.isSubmitting\n || (status === \"existing\" && !formex?.dirty)\n // There is no record left to save over.\n || deletedElsewhere\n );\n\n /**\n * Hand this record's edit in progress to the layout about to replace this\n * one — the split's \"hide list\", full screen's \"show list\", the side panel's\n * \"open full screen\". None of them is a navigation *away* from the record:\n * the same record is about to be shown by a different form, and what the\n * user has typed belongs to the record, not to the pane it was typed in.\n *\n * Every control that changes layout has to call this, and none of them is\n * blocked by the unsaved-changes prompt — the prompt asks about leaving, and\n * these do not leave. What used to happen instead is that the edit reached\n * the next layout only as its local-changes backup, which is the channel for\n * a draft left behind by a closed tab: the record reopened *clean*, with a\n * banner offering to apply changes the user had never walked away from.\n */\n const carryEdit = useCallback(() => {\n const carried = formex\n ? getEditHandoffValues<M>({\n status,\n dirty: formex.dirty,\n values: formex.values,\n touched: formex.touched,\n storedValues: usedEntity?.values\n })\n : undefined;\n if (!carried) return;\n const key = (status === \"new\" || status === \"copy\") ? path + \"#new\" : path + \"/\" + entityId;\n saveEntityToMemoryCache(key, carried);\n }, [formex, status, path, entityId, usedEntity]);\n\n /**\n * The record was deleted elsewhere: open a new one holding what this form\n * holds, so that nothing typed here is lost. The values travel as the new\n * form's defaults — the same channel \"new with values\" uses everywhere —\n * and they are carried, so leaving this form does not ask about them.\n */\n const saveAsNew = useCallback(() => {\n const values = formex?.values ?? usedEntity?.values;\n if (values) onValuesModified?.(false, values);\n navigateToEntity({\n openEntityMode: layout,\n collection,\n path,\n defaultValues: values,\n sidePanelController: adminContext.sidePanelController,\n navigation: urlController,\n replace: true\n });\n }, [formex, usedEntity, onValuesModified, layout, collection, path, adminContext.sidePanelController, urlController]);\n\n const [inspectorTab, setInspectorTab] = useState<InspectorTab | null>(null);\n // A save adds a revision, and the inspector can be open while it happens:\n // Save lives in the identity bar, above the panel. Counting saves gives the\n // history list something to react to.\n const [savedCount, setSavedCount] = useState(0);\n\n /* ---- record actions, in the bar's overflow menu ---------------------- */\n\n const sideDialogContext = useSideDialogContext();\n\n /**\n * Whether the save in flight was asked to dismiss the record afterwards.\n *\n * A ref, and for the reason {@link SideDialogs} keeps its own as one: the\n * flag is raised and the form submitted in a single click handler, and the\n * `onSaved` that has to act on it was captured before React could re-render.\n * As state it read one save late — the first \"save and close\" saved and\n * stayed open, and the *next* save closed the record.\n *\n * The side panel and the dialog use the side-dialog controller's flag,\n * which their own close path consumes; this one covers the layouts that\n * close by calling {@link onCloseRequest} instead.\n */\n const pendingCloseRef = useRef(false);\n\n // The split can close after a save the same way the overlays do — through\n // the callback its layout supplies. Without one there is nothing to close.\n const canCloseAfterSave = layout === \"side_panel\" || layout === \"dialog\"\n || (layout === \"split\" && Boolean(onCloseRequest));\n\n const leaveRecord = useLeaveRecord({ layout, path, onCloseRequest });\n\n const recordActionClickProps = useMemo(() => usedEntity\n ? {\n view: \"form\" as const,\n entity: usedEntity as Entity<Record<string, unknown>>,\n path,\n collection: collection as AdminCollection,\n context,\n sidePanelController: adminContext.sidePanelController,\n openEntityMode: layout,\n navigateBack: leaveRecord,\n formContext: formContext as FormContext<Record<string, unknown>> | undefined\n }\n : undefined, [usedEntity, path, collection, context, adminContext.sidePanelController, layout, leaveRecord, formContext]);\n\n const recordActions = useRecordActions({\n collection,\n path,\n entity: usedEntity,\n clickProps: recordActionClickProps\n });\n\n // Plugin form actions (Autofill and friends) render inline in the bar; the\n // form no longer has a footer to put them in.\n const formPluginActions = useSlot(\"form.actions\", formActionTopProps);\n\n // A URL still naming the old `json`/`history` tab opens the inspector on\n // that pane instead of 404-ing into the record with nothing shown.\n useEffect(() => {\n if (legacyInspectorTab) setInspectorTab(legacyInspectorTab);\n }, [legacyInspectorTab]);\n\n const subCollectionsViews = childViews && childViews.map(({ collection: subcollection }) => {\n const subcollectionId = subcollection.slug;\n // By slug, like the path it extends: the data layer hands the driver\n // the stored path, `path` included, for the whole of it at once.\n const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.slug)}` : undefined;\n\n if (activeTab !== subcollectionId) return null;\n return (\n <div\n className={\"relative flex-1 h-full overflow-auto w-full\"}\n key={`subcol_${subcollectionId}`}\n role=\"tabpanel\">\n\n {globalLoading && <CircularProgressCenter />}\n\n {!globalLoading &&\n (usedEntity && newFullPath\n ? <ResolvedCollectionView\n path={newFullPath}\n parentCollectionSlugs={[...parentCollectionSlugs, collection.slug]}\n parentEntityIds={[...parentEntityIds, String(usedEntity?.id)]}\n updateUrl={false}\n {...subcollection}\n openEntityMode={layout} />\n : <div className=\"flex items-center justify-center w-full h-full p-3\">\n <Typography variant={\"label\"}>\n {t(\"save_entity_before_subcollections\")}\n </Typography>\n </div>)\n }\n\n </div>\n );\n }).filter(Boolean);\n\n const onSideTabClick = useCallback((value: string) => {\n userHasChangedTab.current = true;\n setSelectedTab(value);\n if (status === \"existing\") {\n onTabChange?.({\n path: path,\n entityId,\n selectedTab: value === MAIN_TAB_VALUE ? undefined : value,\n collection\n });\n }\n }, [status, onTabChange, path, entityId, collection]);\n\n const formViewConfig = (collection as AdminCollection<M> & { formView?: FormViewConfig<M> }).formView;\n const FormViewBuilder = resolveComponentRef<EntityCustomViewParams<M>>(formViewConfig?.Builder);\n const formViewIncludeActions = formViewConfig?.includeActions !== false;\n\n /**\n * What the record form renders in place of its generated fields.\n *\n * A `formView` Builder is rendered *by the form*, never instead of it. It\n * used to be drawn here in the form's place, and the form is the only\n * thing that can hand it a working context — the real one arrives through\n * `onFormContextReady`, and with no form mounted it never did. Every\n * Builder got the read-only stand-in above: each keystroke threw inside\n * `setFieldValue`, and Save and Discard, which wait on that same context,\n * never appeared. A new record was worse: with no id there is not even a\n * stand-in, and the screen stayed blank.\n *\n * An entity view declared with `includeActions` is a second form over the\n * same record, and takes the place while its tab is open.\n */\n const FormBuilder = selectedSecondaryForm\n ? resolveComponentRef(selectedSecondaryForm.Builder as ComponentRef<EntityCustomViewParams<M>> | undefined)\n : FormViewBuilder;\n\n /**\n * `formView.includeActions: false` leaves saving to the Builder — it holds\n * `formContext.submit` and `save` — so the bar offers no Save or Discard of\n * its own. Only for the collection's form: an entity view that declared\n * `includeActions` is on screen because it asked for them. Delete is a\n * record action, in the bar's overflow menu, and is not affected.\n */\n const formActionsContext = canEdit && formContext\n && (!FormViewBuilder || formViewIncludeActions || selectedSecondaryForm)\n ? formContext\n : undefined;\n\n // Without edit permission the record is rendered read-only — the same\n // sections, spans and rail as the form, so losing the permission changes the\n // controls and nothing else. The `h4` that used to head this repeated the\n // collection name the identity bar above it already carries.\n const entityReadOnlyView = !canEdit && entity ? (\n FormViewBuilder && readOnlyFormContext\n ? <div className={cls(\n \"@container/form flex-1 flex flex-row w-full overflow-y-auto justify-center\",\n (canEdit || !mainViewVisible || selectedSecondaryForm) ? \"hidden\" : \"\"\n )}>\n {/* Same widths as the default form (see EntityForm). */}\n <div className={\"w-full max-w-3xl @7xl/form:max-w-4xl 2xl:max-w-4xl flex flex-col pt-6 pb-16 px-5 sm:px-8\"}>\n <ErrorBoundary>\n <Suspense fallback={<CircularProgressCenter />}>\n <FormViewBuilder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedEntity?.values}\n formContext={readOnlyFormContext}\n />\n </Suspense>\n </ErrorBoundary>\n </div>\n </div>\n : <EntityViewBinding\n className={cls((canEdit || !mainViewVisible || selectedSecondaryForm) ? \"hidden\" : \"\")}\n entity={entity}\n path={path}\n collection={collection}\n asPage\n openEntityMode={layout}\n formContext={readOnlyFormContext}/>\n ) : null;\n\n const entityView = (\n <ResolvedEntityForm<M>\n collection={collection}\n path={path}\n entityId={entityId ?? usedEntity?.id}\n onValuesModified={onValuesModified}\n entity={entity}\n initialDirtyValues={initialDirtyValues}\n openEntityMode={layout}\n // Save and Discard live in the identity bar now, where they stay\n // visible while the form scrolls. The form's own footer would be a\n // second copy of them.\n showDefaultActions={false}\n initialStatus={status}\n className={cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? \"hidden\" : \"\", formProps?.className)}\n EntityFormActionsComponent={ResolvedFormActions as React.FC<typeof ResolvedFormActions extends React.ComponentType<infer P> ? P : never>}\n disabled={!canEdit}\n navigateBack={navigateBack}\n {...formProps}\n onEntityChange={(entity) => {\n setUsedEntity(entity);\n formProps?.onEntityChange?.(entity);\n }}\n onStatusChange={(status) => {\n setStatus(status);\n formProps?.onStatusChange?.(status);\n }}\n onFormContextReady={(formContext) => {\n setFormContext(formContext);\n formProps?.onFormContextReady?.(formContext);\n }}\n onSaved={(params) => {\n setSavedCount(count => count + 1);\n const res = {\n ...params,\n selectedTab: MAIN_TAB_VALUE === activeTab ? undefined : activeTab\n };\n // Two caller-supplied callbacks for one save, and either may\n // navigate — the layouts' `onSaved` all do. Where both do, the\n // second one's destination is what survives (docs/bug-classes.md\n // #28), so `formProps.onSaved` is deliberately last: it belongs\n // to whoever embedded this view, which outranks the layout.\n onSaved?.(res);\n formProps?.onSaved?.(res);\n\n // After `onSaved`, never instead of it: the layout's own handler\n // is what lowers its dirty flag, and closing is a navigation the\n // unsaved-changes blocker would otherwise stop on values that\n // are already stored.\n //\n // And after this handler returns, not inside it. The layouts\n // that close this way close by navigating, and they have just\n // navigated themselves — the split leaves `…/edit` for the\n // record's own URL. Deferring keeps the close unambiguously\n // last, which is what decides it: of two navigations raised for\n // one action the final one survives, measured in\n // `router_two_navigations_one_handler.test.tsx`. It also lets\n // the state those handlers just set settle before the blocker\n // reads it. See docs/bug-classes.md #28.\n if (pendingCloseRef.current) {\n pendingCloseRef.current = false;\n setTimeout(() => onCloseRequest?.(), 0);\n }\n }}\n Builder={FormBuilder}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n >\n {deletedElsewhere &&\n <Alert color={\"warning\"} size={\"small\"} outerClassName={\"w-full mb-4\"}\n action={<Button size={\"small\"} variant={\"text\"} onClick={saveAsNew}>{t(\"save_as_new\")}</Button>}>\n {t(\"entity_deleted_elsewhere\")}\n </Alert>}\n </ResolvedEntityForm>\n );\n\n const subcollectionTabs = subcollections && subcollections.map((subcollection) => {\n const icon = getIcon(subcollection.icon, undefined, undefined, \"smallest\");\n return (\n <Tab\n className={cls(ENTITY_VIEW_TAB_CLASS, ENTITY_VIEW_TAB_LABEL_CLASS)}\n value={subcollection.slug}\n key={`entity_detail_collection_tab_${subcollection.name}`}>\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {subcollection.name}\n </span>\n </Tab>\n );\n });\n\n const customViewTabsStart = resolvedEntityViews.filter(view => view.position === \"start\")\n .map((view) => {\n const icon = getIcon(view.icon, undefined, undefined, \"smallest\");\n return (\n <Tab\n className={cls(ENTITY_VIEW_TAB_CLASS, !view.tabComponent && ENTITY_VIEW_TAB_LABEL_CLASS)}\n value={view.key}\n key={`entity_detail_collection_tab_${view.name}`}>\n {view.tabComponent ?? (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {view.name}\n </span>\n )}\n </Tab>\n );\n });\n const customViewTabsEnd = resolvedEntityViews.filter(view => !view.position || view.position === \"end\")\n .map((view) => {\n const icon = getIcon(view.icon, undefined, undefined, \"smallest\");\n return (\n <Tab\n className={cls(ENTITY_VIEW_TAB_CLASS, !view.tabComponent && ENTITY_VIEW_TAB_LABEL_CLASS)}\n value={view.key}\n key={`entity_detail_collection_tab_${view.name}`}>\n {view.tabComponent ?? (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {view.name}\n </span>\n )}\n </Tab>\n );\n });\n\n const onSave = formActionsContext ? () => {\n sideDialogContext.setPendingClose?.(false);\n pendingCloseRef.current = false;\n formActionsContext.submit();\n } : undefined;\n\n const onSaveAndClose = formActionsContext && canCloseAfterSave ? () => {\n // Lowered again once the submit settles. A submit the form\n // rejects never reaches `onSaved`, so nothing would consume the\n // flag and the *next* save — a keyboard ⌘S, say — would close\n // the panel out from under an edit nobody asked to finish. A\n // save that succeeds has already closed by the time this runs.\n if (layout === \"split\") {\n pendingCloseRef.current = true;\n Promise.resolve(formActionsContext.submit())\n .finally(() => { pendingCloseRef.current = false; });\n return;\n }\n sideDialogContext.setPendingClose?.(true);\n Promise.resolve(formActionsContext.submit())\n .finally(() => sideDialogContext.setPendingClose?.(false));\n } : undefined;\n\n // Unlike the form's own Discard, this one does not stop to ask — so it has\n // to be reversible. See {@link useUndoableDiscard}.\n const onDiscard = formActionsContext\n ? () => discard(formActionsContext.formex, status)\n : undefined;\n\n /**\n * The dialog keeps Save at its foot, not in the bar.\n *\n * A dialog is filled in top to bottom and finished at the bottom, which is\n * where every other dialog in the app puts its buttons; up in the bar's\n * right-hand corner, Create was the one thing on screen the eye had to\n * travel back up to reach. The bar keeps what the record is and the ways\n * out of it. The side panel and the pages keep Save in the bar, where it\n * stays in view while a long form scrolls.\n */\n const actionsInFooter = layout === \"dialog\";\n\n const fullScreenButton = !barActions && // Not in split: the list panel beside it carries the close control,\n // and an expand button there competes with it.\n (layout === \"side_panel\" || layout === \"dialog\") && hasEntityId(entityId) ? (\n <Tooltip title={\"Open full screen\"}>\n <IconButton aria-label={\"Open full screen\"}\n size=\"small\"\n onClick={() => {\n carryEdit();\n const editSuffix = collection.defaultEntityAction === \"view\" ? \"/edit\" : \"\";\n const entityUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}${editSuffix}`);\n navigate(`${entityUrl}#full`);\n }}\n >\n <Maximize2Icon size={iconSize.smallest} />\n </IconButton>\n </Tooltip>\n ) : null;\n\n let result = <div className=\"relative flex flex-col h-full w-full bg-surface-card\">\n\n <EntityIdentityBar\n collection={collection as AdminCollection}\n collectionUrl={layout === \"full_screen\" || layout === \"split\"\n ? withListState(urlController.buildUrlCollectionPath(path))\n : undefined}\n title={displayTitle}\n entityId={status === \"existing\" ? entityId : undefined}\n status={status}\n dirty={Boolean(formContext?.formex?.dirty)}\n saving={Boolean(formContext?.isSaving)}\n hasErrors={hasFormErrors}\n saveDisabled={!canEdit || saveDisabled}\n // Full screen replaces the collection entirely, leaving browser Back\n // as the only route to it. The detail view has carried this arrow\n // for that reason; the edit view is reached the same way. Where the\n // list can be unfolded back beside the record, that chevron reaches\n // the same collection and the arrow beside it is noise.\n onBack={layout === \"full_screen\" && !onShowList\n ? () => navigate(withListState(urlController.buildUrlCollectionPath(path)))\n : undefined}\n onSave={actionsInFooter ? undefined : onSave}\n onSaveAndClose={actionsInFooter ? undefined : onSaveAndClose}\n // Welded to Save in the split, its own button in the overlays.\n saveAndClosePlacement={layout === \"split\" ? \"menu\" : \"button\"}\n onClose={onCloseRequest}\n onDiscard={actionsInFooter ? undefined : onDiscard}\n onInspect={includeJsonView ? () => setInspectorTab(\"json\") : undefined}\n onViewHistory={includeHistoryView ? () => setInspectorTab(\"history\") : undefined}\n externalLink={usedEntity\n ? customizationController?.entityLinkBuilder?.({ entity: usedEntity })\n : undefined}\n recordActions={recordActions}\n pluginActions={formPluginActions}\n leading={<>\n {barActionsStart}\n {/* Split view: closing the list is opening this record\n full screen, and the control for it belongs at this\n bar's leading edge. Full screen carries its mirror.\n Both change layout, so both hand the edit over. */}\n {layout === \"split\" && <SplitListCloseButton onBeforeHide={carryEdit}/>}\n {layout === \"full_screen\" && onShowList && <SplitListShowButton onClick={() => {\n carryEdit();\n onShowList();\n }}/>}\n </>}\n trailing={<>\n {pluginActionsTop}\n {fullScreenButton}\n {barActions?.({\n path,\n entityId,\n values: formContext?.values ?? usedEntity?.values ?? {},\n status,\n dirty: Boolean(formContext?.formex?.dirty),\n carryEdit\n })}\n </>}\n />\n\n {/* Destinations only: the record is the page, so its tab leads rather\n than sitting third behind two unlabelled developer tools. The row\n disappears entirely when there is nowhere else to go. */}\n {hasAdditionalViews && <div className={cls(\n \"h-10 shrink-0 flex items-stretch border-b px-2 min-w-0\",\n ENTITY_VIEW_TAB_BAR_CLASS,\n defaultBorderMixin\n )}>\n <Tabs\n className={\"!w-full items-stretch\"}\n innerClassName={\"h-full\"}\n variant={\"boxy\"}\n value={activeTab}\n onValueChange={(value) => {\n onSideTabClick(value);\n }}>\n\n {/* Before the record, not after it.\n\n `position: \"start\"` used to mean \"first among the custom\n views\", which put it after a tab it was already after: the\n record's own tab is drawn here unconditionally, so \"start\"\n and \"end\" only ever ordered the custom views against each\n other, and no collection could open with anything but the\n form on the left.\n\n A cover — a read-only summary of the record, the thing an\n operator opens a row to see — belongs in front of the form\n that edits it. That is what `defaultSelectedView` already\n allowed, and the strip contradicted it by drawing the\n selected tab second. Views that say nothing still land after\n the record, so nothing moves for a collection that never\n asked. */}\n {customViewTabsStart}\n\n <Tab value={MAIN_TAB_VALUE}\n className={cls(ENTITY_VIEW_TAB_CLASS, ENTITY_VIEW_TAB_LABEL_CLASS)}>\n <span className=\"flex items-center gap-1.5\">\n {getIcon(collection.icon, undefined, undefined, \"smallest\")}\n {collection.singularName ?? collection.name}\n </span>\n </Tab>\n\n\n {customViewTabsEnd}\n\n {subcollectionTabs}\n </Tabs>\n </div>}\n\n {/* The record and the inspector share the space below the bar rather\n than stacking, so the form stays reachable while the panel is open.\n `min-w-0` keeps a wide form from pushing the panel off the edge. */}\n <div className={\"flex-1 min-h-0 flex\"}>\n\n <div className={\"flex-1 min-w-0 flex flex-col\"}>\n {globalLoading\n ? <EntityFormSkeleton collection={collection} />\n : <>\n {entityReadOnlyView}\n {entityView}\n </>}\n\n {customViewsView}\n\n {subCollectionsViews}\n </div>\n\n <EntityInspector\n tab={inspectorTab}\n onTabChange={setInspectorTab}\n onClose={() => setInspectorTab(null)}\n collection={collection as AdminCollection}\n entity={usedEntity as Entity<Record<string, unknown>> | undefined}\n formContext={formContext as FormContext<Record<string, unknown>> | undefined}\n values={formContext?.values ?? usedEntity?.values}\n refreshToken={savedCount}\n includeHistory={includeHistoryView}/>\n </div>\n\n {actionsInFooter && onSave && (\n <DialogActions translucent={false}>\n <EntitySaveActions\n status={status}\n dirty={Boolean(formContext?.formex?.dirty)}\n saving={Boolean(formContext?.isSaving)}\n hasErrors={hasFormErrors}\n saveDisabled={!canEdit || saveDisabled}\n onSave={onSave}\n onSaveAndClose={onSaveAndClose}\n onDiscard={onDiscard}/>\n </DialogActions>\n )}\n\n </div>;\n\n if (plugins && plugins.length > 0) {\n result = (\n <PluginProviderStack\n plugins={plugins}\n scope=\"form\"\n scopeProps={{\n status,\n path,\n collection,\n entity: usedEntity,\n context,\n formContext\n }}>\n {result}\n </PluginProviderStack>\n );\n }\n\n return result;\n}\n\nfunction EntityFormSkeleton({ collection }: { collection: AdminCollection }) {\n return (\n <div className=\"flex-1 flex flex-row w-full overflow-y-auto justify-center\">\n <div className=\"relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit\">\n <div className=\"flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10\">\n\n <div className=\"flex flex-row gap-4 self-end sticky top-4 z-10\">\n <Skeleton height={24} className=\"w-8 rounded-full\" />\n </div>\n\n <div className=\"w-full flex flex-col items-start my-4 lg:my-6\">\n <div className={`py-1 my-4 w-2/3 ${collection.hideIdFromForm ? \"mb-6\" : \"\"}`}>\n <Skeleton height={28} className=\"w-full rounded-md\" />\n </div>\n <Skeleton height={32} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"mt-12 flex flex-col gap-8\">\n <div className=\"flex flex-wrap gap-x-4 w-full space-y-8\">\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full r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U;YACX,oBAAC,OAAD;GAAK,WAAU;aACX,qBAAC,OAAD;IAAK,WAAU;cAAf;KAEI,oBAAC,OAAD;MAAK,WAAU;gBACX,oBAAC,UAAD;OAAU,QAAQ;OAAI,WAAU;MAAoB,CAAA;KACnD,CAAA;KAEL,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACI,oBAAC,OAAD;OAAK,WAAW,mBAAmB,WAAW,iBAAiB,SAAS;iBACpE,oBAAC,UAAD;QAAU,QAAQ;QAAI,WAAU;OAAqB,CAAA;MACpD,CAAA,GACL,oBAAC,UAAD;OAAU,QAAQ;OAAI,WAAU;MAAqB,CAAA,CACpD;;KAEL,oBAAC,OAAD;MAAK,WAAU;gBACX,qBAAC,OAAD;OAAK,WAAU;iBAAf;QAEI,oBAAC,OAAD;SAAK,WAAU;mBACX,oBAAC,UAAD;UAAU,QAAQ;UAAI,WAAU;SAAqB,CAAA;QACpD,CAAA;QAEL,oBAAC,OAAD;SAAK,WAAU;mBACX,oBAAC,UAAD;UAAU,QAAQ;UAAI,WAAU;SAAqB,CAAA;QACpD,CAAA;QAEL,oBAAC,OAAD;SAAK,WAAU;mBACX,oBAAC,UAAD;UAAU,QAAQ;UAAI,WAAU;SAAqB,CAAA;QACpD,CAAA;QAEL,oBAAC,OAAD;SAAK,WAAU;mBACX,oBAAC,UAAD;UAAU,QAAQ;UAAI,WAAU;SAAqB,CAAA;QACpD,CAAA;OAEJ;;KACJ,CAAA;IACJ;;EACJ,CAAA;CACJ,CAAA;AAEb"}
|
|
@@ -11,6 +11,7 @@ import * as React$1 from "react";
|
|
|
11
11
|
import { useMemo } from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ArrowRightToLineIcon, IconButton, Skeleton, Tooltip, Typography, cls, defaultBorderMixin } from "@rebasepro/ui";
|
|
14
|
+
import "@rebasepro/common";
|
|
14
15
|
import { ErrorView, IconForView, getEntityImagePreviewPropertyKey, useAnalyticsController, useAuthController, useCustomizationController } from "@rebasepro/app";
|
|
15
16
|
import { getValueInPath } from "@rebasepro/utils";
|
|
16
17
|
//#region src/components/EntityPreviewBinding.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPreviewBinding.js","names":[],"sources":["../../src/components/EntityPreviewBinding.tsx"],"sourcesContent":["\nimport type { Property } from \"@rebasepro/types\";\nimport * as React from \"react\";\nimport { useEffect, useMemo } from \"react\";\n\nimport { Entity } from \"@rebasepro/types\";\nimport type { PreviewSize } from \"../types/components/PropertyPreviewProps\";\nimport { getEntityImagePreviewPropertyKey } from \"@rebasepro/app\";\nimport {\n ArrowRightToLineIcon,\n cls,\n defaultBorderMixin,\n IconButton,\n Skeleton,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { PropertyPreview, SkeletonPropertyComponent } from \"../preview\";\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n ErrorView\n} from \"@rebasepro/app\";\nimport { useAnalyticsController } from \"@rebasepro/app\";\nimport { IconForView } from \"@rebasepro/app\";\nimport { getPropertyInPath } from \"../util/property_utils\";\nimport { resolveCollectionSlotKeys } from \"./CollectionViewBinding/usePreviewSlots\";\nimport { useEntityTitle } from \"../hooks/useEntityDisplay\";\nimport { getValueInPath } from \"@rebasepro/utils\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { EntityPreviewLayout, NestedEntityPreviewBoundary } from \"./EntityPreviewNesting\";\nimport { isEmptyPreviewValue } from \"../preview/util\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nexport type EntityPreviewBindingProps = {\n size?: PreviewSize,\n actions?: React.ReactNode,\n collection?: AdminCollection,\n hover?: boolean;\n previewKeys?: string[],\n disabled?: boolean,\n entity: Entity<any>,\n includeId?: boolean,\n includeTitle?: boolean,\n includeEntityLink?: boolean,\n includeImage?: boolean,\n onClick?: (e: React.SyntheticEvent) => void;\n onSidePanelClick?: (entity: Entity) => void,\n};\n\nexport type EntityPreviewBindingDataProps = {\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n actions?: React.ReactNode,\n collection?: AdminCollection,\n previewKeys?: string[],\n entity: Entity<any>,\n onSidePanelClick?: (entity: Entity) => void,\n includeId?: boolean,\n includeTitle?: boolean,\n includeEntityLink?: boolean,\n includeImage?: boolean,\n /**\n * `row` draws the record as a line of a table row instead of a card: see\n * {@link EntityPreviewLayout}. No id, no open button — the title opens the\n * record — and only as many supporting lines as the row has room for.\n */\n layout?: EntityPreviewLayout,\n};\n\n/**\n * This component contains the main logic and content for displaying a entity preview,\n * without any container wrapper. Used internally by EntityPreviewBinding.\n */\nexport function EntityPreviewBindingData({\n actions,\n collection: collectionProp,\n previewKeys,\n size = \"medium\",\n includeId = true,\n onSidePanelClick,\n includeTitle = true,\n includeEntityLink = true,\n includeImage = true,\n layout = \"card\",\n entity\n}: EntityPreviewBindingDataProps) {\n\n const authController = useAuthController();\n const analyticsController = useAnalyticsController();\n const sidePanelController = useSidePanel();\n const customizationController = useCustomizationController();\n\n const collectionRegistryController = useCollectionRegistryController();\n\n const collection = collectionProp ?? collectionRegistryController.getCollection(entity.path);\n\n // Above the `!collection` return, because hooks are. `useEntityTitle`\n // tolerates a missing collection for exactly this reason.\n const title = useEntityTitle({\n collection,\n entity\n });\n\n // What the card says under the title.\n //\n // A stated list wins outright — `previewProperties` is the one place a\n // developer says \"show these\", and nothing here is allowed to second-guess\n // it. Failing that, the card fills the same slots as every other surface\n // that renders one record in a row: a supporting line and a status. It used\n // to take the first few properties in declaration order instead, which is\n // how an author card ended up rendering an entire Markdown biography.\n const statedKeys = previewKeys ?? (collection?.previewProperties as string[] | undefined);\n const listProperties = useMemo(() => {\n if (!collection) return [];\n if (statedKeys && statedKeys.length > 0) {\n return statedKeys.filter(key => getPropertyInPath(collection.properties, key));\n }\n const slotKeys = resolveCollectionSlotKeys(\n collection as AdminCollection<Record<string, unknown>>,\n authController,\n customizationController.propertyConfigs);\n return [slotKeys.subtitleKey, slotKeys.statusKey].filter(Boolean) as string[];\n }, [statedKeys, collection, authController, customizationController.propertyConfigs]);\n\n if (!collection) {\n return (\n <>\n <ErrorView error={`Collection not found: ${entity.path}`}/>\n </>\n );\n }\n\n const titleProperty = includeTitle ? title.source?.key : undefined;\n const imagePropertyKey = includeImage ? getEntityImagePreviewPropertyKey(collection) : undefined;\n const imageProperty = imagePropertyKey ? collection.properties[imagePropertyKey] : undefined;\n const ofProp = imageProperty && \"of\" in imageProperty ? imageProperty.of : undefined;\n const usedImageProperty = ofProp ? (Array.isArray(ofProp) ? ofProp[0] : ofProp) : imageProperty;\n const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);\n\n const openInSidePanel = () => {\n onSidePanelClick?.(entity);\n analyticsController.onAnalyticsEvent?.(\"entity_click_from_reference\", {\n path: entity.path,\n entityId: entity.id\n });\n sidePanelController.open({\n entityId: entity.id,\n path: entity.path,\n collection,\n updateUrl: true\n });\n };\n\n const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : undefined;\n const usedImageValue = imageProperty !== undefined ? (\"of\" in imageProperty\n ? (((imageValue as unknown[]) ?? []).length > 0\n ? (imageValue as unknown[])[0] : undefined)\n : imageValue)\n : undefined;\n\n if (layout === \"row\")\n return <EntityRowPreviewContent size={size}\n entity={entity}\n collection={collection}\n title={title.value ?? String(entity.id)}\n imageProperty={usedImageProperty}\n imagePropertyKey={imagePropertyKey}\n imageValue={usedImageValue}\n supportingKeys={restProperties}\n onOpen={includeEntityLink ? openInSidePanel : undefined}/>;\n\n return (\n // Everything below renders *inside* this preview: a reference or\n // relation among the preview properties collapses to one line instead\n // of nesting another bordered card with its own id and action button.\n <NestedEntityPreviewBoundary>\n {/* `overflow-hidden`: the image slot is a fixed box, and a thumbnail\n that fails to load renders a \"file not found\" message sized for a\n full preview — which spilled across the title beside it. */}\n <div className={cls(\"flex shrink-0 overflow-hidden\", {\n \"w-6 h-6 mx-1 my-0.5\": size === \"small\" || size === \"smallest\",\n \"w-8 h-8 ml-1 mr-2 m-2 self-start\": size === \"medium\",\n \"w-10 h-10 ml-2 mr-2 m-2 self-start\": size === \"large\"\n })}>\n {usedImageProperty && usedImageValue ? <PropertyPreview property={usedImageProperty}\n propertyKey={imagePropertyKey as string}\n size={\"small\"}\n value={usedImageValue as never}/> : null}\n {(!usedImageProperty || !usedImageValue) ? <IconForView collectionOrView={collection}\n color={\"primary\"}\n size={size}\n className={\"m-auto\"}/> : null}\n </div>\n\n <div\n className={\"flex flex-col grow w-full m-1 shrink min-w-0 text-text-primary dark:text-text-primary-dark flex-1 mr-2\"}>\n\n {includeId && (\n entity\n ? <div className={\"block whitespace-nowrap overflow-hidden truncate\"}>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"font-mono\"}>\n {entity.id}\n </Typography>\n </div>\n : <Skeleton/>)}\n\n {/* A title that came from a property keeps that property's own\n rendering — an enum stays its coloured chip, a relation stays\n a link. A computed one is text, because that is all a\n resolver returns. */}\n {includeTitle && (titleProperty || title.value) && (\n <div\n className={\"truncate my-0.5 text-sm font-medium text-text-primary dark:text-text-primary-dark\"}>\n {!entity && titleProperty\n ? <SkeletonPropertyComponent\n property={getPropertyInPath(collection.properties, titleProperty) as Property}\n size={\"medium\"}/>\n : titleProperty\n ? <PropertyPreview\n propertyKey={titleProperty}\n value={title.source?.value as never}\n property={getPropertyInPath(collection.properties, titleProperty) as Property}\n size={\"medium\"}/>\n : title.value}\n </div>\n )}\n\n {restProperties && restProperties.map((key) => {\n const childProperty = getPropertyInPath(collection.properties, key);\n if (!childProperty) return null;\n\n const valueInPath = getValueInPath(entity.values, key);\n return (\n // `truncate` clamps a line of text; it does nothing to a\n // preview that renders blocks. Custom `admin.Preview`\n // components can render anything at all, so the height\n // is capped here as well — a card that loses the tail of\n // an unusual value beats a card the size of a document.\n <div key={\"ref_prev_\" + key}\n className={cls(\"truncate min-w-0 max-h-8 overflow-hidden\",\n restProperties.length > 1 ? \"my-0.5\" : \"my-0\")}>\n {\n entity\n ? <PropertyPreview\n propertyKey={key as string}\n value={valueInPath as never}\n property={childProperty as Property}\n size={\"small\"}/>\n : <SkeletonPropertyComponent\n property={childProperty as Property}\n size={\"small\"}/>\n }\n </div>\n );\n })}\n\n </div>\n\n {entity && includeEntityLink &&\n <div className=\"flex-shrink-0\">\n <Tooltip title={`See details for ${entity.id}`} className={\"shrink-0\"}>\n <IconButton aria-label={`See details for ${entity.id}`}\n size={\"small\"}\n className={size !== \"small\" ? \"self-start\" : \"\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n openInSidePanel();\n }}>\n <ArrowRightToLineIcon/>\n </IconButton>\n </Tooltip>\n </div>}\n\n {actions && <div className=\"flex-shrink-0\">{actions}</div>}\n </NestedEntityPreviewBoundary>\n );\n}\n\n/**\n * A record as a line of a table row: its image, a title that opens it, and the\n * supporting lines that fit — one at `medium`, two at `large`. Supporting\n * values that are empty are skipped rather than drawn as an empty bar, so the\n * line under a name is the first thing the record actually has to say.\n */\nfunction EntityRowPreviewContent({\n size,\n entity,\n collection,\n title,\n imageProperty,\n imagePropertyKey,\n imageValue,\n supportingKeys,\n onOpen\n}: {\n size: \"smallest\" | \"small\" | \"medium\" | \"large\";\n entity: Entity<Record<string, unknown>>;\n collection: AdminCollection;\n title: string;\n imageProperty?: Property;\n imagePropertyKey?: string;\n imageValue: unknown;\n supportingKeys: string[];\n onOpen?: () => void;\n}) {\n const maxLines = size === \"large\" ? 2 : 1;\n const lines = supportingKeys\n .map(key => ({\n key,\n property: getPropertyInPath(collection.properties, key),\n value: getValueInPath(entity.values, key)\n }))\n .filter((line): line is { key: string, property: Property, value: unknown } =>\n Boolean(line.property) && !isEmptyPreviewValue(line.value))\n .slice(0, maxLines);\n\n const titleNode = <span className={\"truncate\"}>{title}</span>;\n\n return (\n <NestedEntityPreviewBoundary>\n <div className={\"flex items-center gap-2.5 min-w-0 w-full text-left\"}>\n {imagePropertyKey && <div className={cls(\"flex shrink-0 items-center justify-center overflow-hidden rounded-md\",\n size === \"large\" ? \"w-10 h-10\" : \"w-8 h-8\")}>\n {imageProperty && imageValue\n ? <PropertyPreview property={imageProperty}\n propertyKey={imagePropertyKey}\n size={\"small\"}\n value={imageValue as never}/>\n : <IconForView collectionOrView={collection}\n color={\"primary\"}\n size={\"small\"}/>}\n </div>}\n <div className={\"flex flex-col min-w-0 flex-1\"}>\n <div className={\"flex min-w-0 text-sm font-medium text-text-primary dark:text-text-primary-dark\"}>\n {onOpen\n ? <Tooltip title={`See details for ${title}`} asChild={true}>\n <span role={\"button\"}\n tabIndex={0}\n className={\"inline-flex min-w-0 max-w-full cursor-pointer hover:underline underline-offset-2\"}\n // See InlineEntityPreview: a press does not\n // move the focus, or a table cell would\n // select itself mid-click.\n onMouseDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onOpen();\n }}\n onKeyDown={(event) => {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n event.stopPropagation();\n onOpen();\n }}>\n {titleNode}\n </span>\n </Tooltip>\n : titleNode}\n </div>\n {lines.map(({ key, property, value }) =>\n <div key={key}\n className={\"truncate min-w-0 max-h-5 overflow-hidden text-xs text-text-secondary dark:text-text-secondary-dark\"}>\n <PropertyPreview propertyKey={key}\n value={value as never}\n property={property}\n size={\"small\"}/>\n </div>)}\n </div>\n </div>\n </NestedEntityPreviewBoundary>\n );\n}\n\nexport function EntityPreviewBindingWithId({\n entityId,\n path,\n ...props\n}: Omit<EntityPreviewBindingProps, \"entity\"> & {\n entityId: string | number;\n path: string;\n databaseId?: string;\n}) {\n\n const [entity, setEntity] = React.useState<Entity | undefined>();\n const [dataLoading, setDataLoading] = React.useState(false);\n const dataClient = useData();\n\n useEffect(() => {\n let isMounted = true;\n if (!entityId || !path) {\n setEntity(undefined);\n return;\n }\n const fetchOne = async () => {\n setDataLoading(true);\n try {\n const fetchedEntity = await dataClient.collection(path).findById(entityId);\n if (isMounted) {\n setEntity(fetchedEntity);\n }\n } catch (error) {\n console.error(\"Error fetching entity:\", error);\n if (isMounted) {\n setEntity(undefined);\n }\n } finally {\n if (isMounted) {\n setDataLoading(false);\n }\n }\n }\n\n fetchOne();\n\n return () => {\n isMounted = false;\n }\n }, [entityId, path]);\n\n if (dataLoading && !entity) {\n return (\n <EntityPreviewContainer\n hover={props.hover}\n size={props.size}>\n <Skeleton/>\n </EntityPreviewContainer>\n );\n }\n\n if (!entity) {\n return (\n <EntityPreviewContainer\n hover={props.hover}\n size={props.size}>\n <div className={\"text-text-secondary dark:text-text-secondary-dark\"}>\n Entity not found\n </div>\n </EntityPreviewContainer>\n );\n }\n\n return <EntityPreviewBindingData\n {...props}\n entity={entity}/>;\n}\n\n/**\n * This view is used to display a preview of a entity.\n * It is used by default in reference fields and whenever a reference is displayed.\n */\nexport function EntityPreviewBinding({\n actions,\n disabled,\n hover,\n collection,\n previewKeys,\n onClick,\n size = \"medium\",\n includeId = true,\n includeTitle = true,\n includeEntityLink = true,\n includeImage = true,\n onSidePanelClick,\n entity\n}: EntityPreviewBindingProps) {\n\n return (\n <EntityPreviewContainer\n onClick={disabled ? undefined : onClick}\n hover={disabled ? undefined : hover}\n size={size}>\n <EntityPreviewBindingData\n actions={actions}\n collection={collection}\n previewKeys={previewKeys}\n size={size}\n includeId={includeId}\n includeTitle={includeTitle}\n includeEntityLink={includeEntityLink}\n includeImage={includeImage}\n onSidePanelClick={onSidePanelClick}\n entity={entity}\n />\n </EntityPreviewContainer>\n );\n}\n\nexport type EntityPreviewContainerProps = {\n children: React.ReactNode;\n hover?: boolean;\n fullwidth?: boolean;\n size?: PreviewSize;\n className?: string;\n style?: React.CSSProperties;\n onClick?: (e: React.SyntheticEvent) => void;\n};\n\nexport const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({\n children,\n hover,\n onClick,\n size = \"medium\",\n style,\n className,\n fullwidth = true,\n ...props\n}, ref) => {\n return <div\n ref={ref}\n tabIndex={0}\n style={style}\n className={cls(\n \"bg-surface-card\",\n // On the shared 28/32/40/48 control scale. `44px` was between two\n // steps of it, so a reference in a form was 4px short of the field\n // next to it and their boxes never quite agreed.\n size === \"small\" ? \"min-h-[32px]\" : \"min-h-[48px]\",\n fullwidth ? \"w-full\" : \"\",\n \"items-center overflow-hidden\",\n hover ? \"hover:bg-surface-hover group-hover:bg-surface-hover\" : \"\",\n size === \"small\" ? \"p-1\" : \"px-2 py-1\",\n \"flex border rounded-lg\",\n onClick ? \"cursor-pointer\" : \"\",\n defaultBorderMixin,\n className)}\n role={onClick ? \"button\" : undefined}\n onClick={(event) => {\n if (onClick) {\n event.preventDefault();\n onClick(event);\n }\n }}\n onKeyDown={(event) => {\n if (onClick && (event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n onClick(event);\n }\n }}\n {...props}>\n {children}\n </div>;\n});\n\nEntityPreviewContainer.displayName = \"EntityPreviewContainer\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,yBAAyB,EACrC,SACA,YAAY,gBACZ,aACA,OAAO,UACP,YAAY,MACZ,kBACA,eAAe,MACf,oBAAoB,MACpB,eAAe,MACf,SAAS,QACT,UAC8B;CAE9B,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,sBAAsB,aAAa;CACzC,MAAM,0BAA0B,2BAA2B;CAE3D,MAAM,+BAA+B,gCAAgC;CAErE,MAAM,aAAa,kBAAkB,6BAA6B,cAAc,OAAO,IAAI;CAI3F,MAAM,QAAQ,eAAe;EACzB;EACA;CACJ,CAAC;CAUD,MAAM,aAAa,eAAgB,YAAY;CAC/C,MAAM,iBAAiB,cAAc;EACjC,IAAI,CAAC,YAAY,OAAO,CAAC;EACzB,IAAI,cAAc,WAAW,SAAS,GAClC,OAAO,WAAW,QAAO,QAAO,oBAAkB,WAAW,YAAY,GAAG,CAAC;EAEjF,MAAM,WAAW,0BACb,YACA,g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U,mBAAmB,IAC7B,oBACA,SAAS;EACb,MAAM,UAAU,WAAW,KAAA;EAC3B,UAAU,UAAU;GAChB,IAAI,SAAS;IACT,MAAM,eAAe;IACrB,QAAQ,KAAK;GACjB;EACJ;EACA,YAAY,UAAU;GAClB,IAAI,YAAY,MAAM,QAAQ,WAAW,MAAM,QAAQ,MAAM;IACzD,MAAM,eAAe;IACrB,QAAQ,KAAK;GACjB;EACJ;EACA,GAAI;EACH;CACA,CAAA;AACT,CAAC;AAED,uBAAuB,cAAc"}
|
|
1
|
+
{"version":3,"file":"EntityPreviewBinding.js","names":[],"sources":["../../src/components/EntityPreviewBinding.tsx"],"sourcesContent":["\nimport type { Property } from \"@rebasepro/types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport * as React from \"react\";\nimport { useEffect, useMemo } from \"react\";\n\nimport { Entity } from \"@rebasepro/types\";\nimport type { PreviewSize } from \"../types/components/PropertyPreviewProps\";\nimport { getEntityImagePreviewPropertyKey } from \"@rebasepro/app\";\nimport {\n ArrowRightToLineIcon,\n cls,\n defaultBorderMixin,\n IconButton,\n Skeleton,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { PropertyPreview, SkeletonPropertyComponent } from \"../preview\";\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n ErrorView\n} from \"@rebasepro/app\";\nimport { useAnalyticsController } from \"@rebasepro/app\";\nimport { IconForView } from \"@rebasepro/app\";\nimport { getPropertyInPath } from \"../util/property_utils\";\nimport { resolveCollectionSlotKeys } from \"./CollectionViewBinding/usePreviewSlots\";\nimport { useEntityTitle } from \"../hooks/useEntityDisplay\";\nimport { getValueInPath } from \"@rebasepro/utils\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { EntityPreviewLayout, NestedEntityPreviewBoundary } from \"./EntityPreviewNesting\";\nimport { isEmptyPreviewValue } from \"../preview/util\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nexport type EntityPreviewBindingProps = {\n size?: PreviewSize,\n actions?: React.ReactNode,\n collection?: AdminCollection,\n hover?: boolean;\n previewKeys?: string[],\n disabled?: boolean,\n entity: Entity<any>,\n includeId?: boolean,\n includeTitle?: boolean,\n includeEntityLink?: boolean,\n includeImage?: boolean,\n onClick?: (e: React.SyntheticEvent) => void;\n onSidePanelClick?: (entity: Entity) => void,\n};\n\nexport type EntityPreviewBindingDataProps = {\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n actions?: React.ReactNode,\n collection?: AdminCollection,\n previewKeys?: string[],\n entity: Entity<any>,\n onSidePanelClick?: (entity: Entity) => void,\n includeId?: boolean,\n includeTitle?: boolean,\n includeEntityLink?: boolean,\n includeImage?: boolean,\n /**\n * `row` draws the record as a line of a table row instead of a card: see\n * {@link EntityPreviewLayout}. No id, no open button — the title opens the\n * record — and only as many supporting lines as the row has room for.\n */\n layout?: EntityPreviewLayout,\n};\n\n/**\n * This component contains the main logic and content for displaying a entity preview,\n * without any container wrapper. Used internally by EntityPreviewBinding.\n */\nexport function EntityPreviewBindingData({\n actions,\n collection: collectionProp,\n previewKeys,\n size = \"medium\",\n includeId = true,\n onSidePanelClick,\n includeTitle = true,\n includeEntityLink = true,\n includeImage = true,\n layout = \"card\",\n entity\n}: EntityPreviewBindingDataProps) {\n\n const authController = useAuthController();\n const analyticsController = useAnalyticsController();\n const sidePanelController = useSidePanel();\n const customizationController = useCustomizationController();\n\n const collectionRegistryController = useCollectionRegistryController();\n\n const collection = collectionProp ?? collectionRegistryController.getCollection(entity.path);\n\n // Above the `!collection` return, because hooks are. `useEntityTitle`\n // tolerates a missing collection for exactly this reason.\n const title = useEntityTitle({\n collection,\n entity\n });\n\n // What the card says under the title.\n //\n // A stated list wins outright — `previewProperties` is the one place a\n // developer says \"show these\", and nothing here is allowed to second-guess\n // it. Failing that, the card fills the same slots as every other surface\n // that renders one record in a row: a supporting line and a status. It used\n // to take the first few properties in declaration order instead, which is\n // how an author card ended up rendering an entire Markdown biography.\n const statedKeys = previewKeys ?? (collection?.previewProperties as string[] | undefined);\n const listProperties = useMemo(() => {\n if (!collection) return [];\n if (statedKeys && statedKeys.length > 0) {\n return statedKeys.filter(key => getPropertyInPath(collection.properties, key));\n }\n const slotKeys = resolveCollectionSlotKeys(\n collection as AdminCollection<Record<string, unknown>>,\n authController,\n customizationController.propertyConfigs);\n return [slotKeys.subtitleKey, slotKeys.statusKey].filter(Boolean) as string[];\n }, [statedKeys, collection, authController, customizationController.propertyConfigs]);\n\n if (!collection) {\n return (\n <>\n <ErrorView error={`Collection not found: ${entity.path}`}/>\n </>\n );\n }\n\n const titleProperty = includeTitle ? title.source?.key : undefined;\n const imagePropertyKey = includeImage ? getEntityImagePreviewPropertyKey(collection) : undefined;\n const imageProperty = imagePropertyKey ? collection.properties[imagePropertyKey] : undefined;\n const ofProp = imageProperty && \"of\" in imageProperty ? imageProperty.of : undefined;\n const usedImageProperty = ofProp ? (Array.isArray(ofProp) ? ofProp[0] : ofProp) : imageProperty;\n const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);\n\n const openInSidePanel = () => {\n onSidePanelClick?.(entity);\n analyticsController.onAnalyticsEvent?.(\"entity_click_from_reference\", {\n path: entity.path,\n entityId: entity.id\n });\n sidePanelController.open({\n entityId: entity.id,\n path: entity.path,\n collection,\n updateUrl: true\n });\n };\n\n const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : undefined;\n const usedImageValue = imageProperty !== undefined ? (\"of\" in imageProperty\n ? (((imageValue as unknown[]) ?? []).length > 0\n ? (imageValue as unknown[])[0] : undefined)\n : imageValue)\n : undefined;\n\n if (layout === \"row\")\n return <EntityRowPreviewContent size={size}\n entity={entity}\n collection={collection}\n title={title.value ?? String(entity.id)}\n imageProperty={usedImageProperty}\n imagePropertyKey={imagePropertyKey}\n imageValue={usedImageValue}\n supportingKeys={restProperties}\n onOpen={includeEntityLink ? openInSidePanel : undefined}/>;\n\n return (\n // Everything below renders *inside* this preview: a reference or\n // relation among the preview properties collapses to one line instead\n // of nesting another bordered card with its own id and action button.\n <NestedEntityPreviewBoundary>\n {/* `overflow-hidden`: the image slot is a fixed box, and a thumbnail\n that fails to load renders a \"file not found\" message sized for a\n full preview — which spilled across the title beside it. */}\n <div className={cls(\"flex shrink-0 overflow-hidden\", {\n \"w-6 h-6 mx-1 my-0.5\": size === \"small\" || size === \"smallest\",\n \"w-8 h-8 ml-1 mr-2 m-2 self-start\": size === \"medium\",\n \"w-10 h-10 ml-2 mr-2 m-2 self-start\": size === \"large\"\n })}>\n {usedImageProperty && usedImageValue ? <PropertyPreview property={usedImageProperty}\n propertyKey={imagePropertyKey as string}\n size={\"small\"}\n value={usedImageValue as never}/> : null}\n {(!usedImageProperty || !usedImageValue) ? <IconForView collectionOrView={collection}\n color={\"primary\"}\n size={size}\n className={\"m-auto\"}/> : null}\n </div>\n\n <div\n className={\"flex flex-col grow w-full m-1 shrink min-w-0 text-text-primary dark:text-text-primary-dark flex-1 mr-2\"}>\n\n {includeId && (\n entity\n ? <div className={\"block whitespace-nowrap overflow-hidden truncate\"}>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"font-mono\"}>\n {entity.id}\n </Typography>\n </div>\n : <Skeleton/>)}\n\n {/* A title that came from a property keeps that property's own\n rendering — an enum stays its coloured chip, a relation stays\n a link. A computed one is text, because that is all a\n resolver returns. */}\n {includeTitle && (titleProperty || title.value) && (\n <div\n className={\"truncate my-0.5 text-sm font-medium text-text-primary dark:text-text-primary-dark\"}>\n {!entity && titleProperty\n ? <SkeletonPropertyComponent\n property={getPropertyInPath(collection.properties, titleProperty) as Property}\n size={\"medium\"}/>\n : titleProperty\n ? <PropertyPreview\n propertyKey={titleProperty}\n value={title.source?.value as never}\n property={getPropertyInPath(collection.properties, titleProperty) as Property}\n size={\"medium\"}/>\n : title.value}\n </div>\n )}\n\n {restProperties && restProperties.map((key) => {\n const childProperty = getPropertyInPath(collection.properties, key);\n if (!childProperty) return null;\n\n const valueInPath = getValueInPath(entity.values, key);\n return (\n // `truncate` clamps a line of text; it does nothing to a\n // preview that renders blocks. Custom `admin.Preview`\n // components can render anything at all, so the height\n // is capped here as well — a card that loses the tail of\n // an unusual value beats a card the size of a document.\n <div key={\"ref_prev_\" + key}\n className={cls(\"truncate min-w-0 max-h-8 overflow-hidden\",\n restProperties.length > 1 ? \"my-0.5\" : \"my-0\")}>\n {\n entity\n ? <PropertyPreview\n propertyKey={key as string}\n value={valueInPath as never}\n property={childProperty as Property}\n size={\"small\"}/>\n : <SkeletonPropertyComponent\n property={childProperty as Property}\n size={\"small\"}/>\n }\n </div>\n );\n })}\n\n </div>\n\n {entity && includeEntityLink &&\n <div className=\"flex-shrink-0\">\n <Tooltip title={`See details for ${entity.id}`} className={\"shrink-0\"}>\n <IconButton aria-label={`See details for ${entity.id}`}\n size={\"small\"}\n className={size !== \"small\" ? \"self-start\" : \"\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n openInSidePanel();\n }}>\n <ArrowRightToLineIcon/>\n </IconButton>\n </Tooltip>\n </div>}\n\n {actions && <div className=\"flex-shrink-0\">{actions}</div>}\n </NestedEntityPreviewBoundary>\n );\n}\n\n/**\n * A record as a line of a table row: its image, a title that opens it, and the\n * supporting lines that fit — one at `medium`, two at `large`. Supporting\n * values that are empty are skipped rather than drawn as an empty bar, so the\n * line under a name is the first thing the record actually has to say.\n */\nfunction EntityRowPreviewContent({\n size,\n entity,\n collection,\n title,\n imageProperty,\n imagePropertyKey,\n imageValue,\n supportingKeys,\n onOpen\n}: {\n size: \"smallest\" | \"small\" | \"medium\" | \"large\";\n entity: Entity<Record<string, unknown>>;\n collection: AdminCollection;\n title: string;\n imageProperty?: Property;\n imagePropertyKey?: string;\n imageValue: unknown;\n supportingKeys: string[];\n onOpen?: () => void;\n}) {\n const maxLines = size === \"large\" ? 2 : 1;\n const lines = supportingKeys\n .map(key => ({\n key,\n property: getPropertyInPath(collection.properties, key),\n value: getValueInPath(entity.values, key)\n }))\n .filter((line): line is { key: string, property: Property, value: unknown } =>\n Boolean(line.property) && !isEmptyPreviewValue(line.value))\n .slice(0, maxLines);\n\n const titleNode = <span className={\"truncate\"}>{title}</span>;\n\n return (\n <NestedEntityPreviewBoundary>\n <div className={\"flex items-center gap-2.5 min-w-0 w-full text-left\"}>\n {imagePropertyKey && <div className={cls(\"flex shrink-0 items-center justify-center overflow-hidden rounded-md\",\n size === \"large\" ? \"w-10 h-10\" : \"w-8 h-8\")}>\n {imageProperty && imageValue\n ? <PropertyPreview property={imageProperty}\n propertyKey={imagePropertyKey}\n size={\"small\"}\n value={imageValue as never}/>\n : <IconForView collectionOrView={collection}\n color={\"primary\"}\n size={\"small\"}/>}\n </div>}\n <div className={\"flex flex-col min-w-0 flex-1\"}>\n <div className={\"flex min-w-0 text-sm font-medium text-text-primary dark:text-text-primary-dark\"}>\n {onOpen\n ? <Tooltip title={`See details for ${title}`} asChild={true}>\n <span role={\"button\"}\n tabIndex={0}\n className={\"inline-flex min-w-0 max-w-full cursor-pointer hover:underline underline-offset-2\"}\n // See InlineEntityPreview: a press does not\n // move the focus, or a table cell would\n // select itself mid-click.\n onMouseDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onOpen();\n }}\n onKeyDown={(event) => {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n event.stopPropagation();\n onOpen();\n }}>\n {titleNode}\n </span>\n </Tooltip>\n : titleNode}\n </div>\n {lines.map(({ key, property, value }) =>\n <div key={key}\n className={\"truncate min-w-0 max-h-5 overflow-hidden text-xs text-text-secondary dark:text-text-secondary-dark\"}>\n <PropertyPreview propertyKey={key}\n value={value as never}\n property={property}\n size={\"small\"}/>\n </div>)}\n </div>\n </div>\n </NestedEntityPreviewBoundary>\n );\n}\n\nexport function EntityPreviewBindingWithId({\n entityId,\n path,\n ...props\n}: Omit<EntityPreviewBindingProps, \"entity\"> & {\n entityId: string | number;\n path: string;\n databaseId?: string;\n}) {\n\n const [entity, setEntity] = React.useState<Entity | undefined>();\n const [dataLoading, setDataLoading] = React.useState(false);\n const dataClient = useData();\n\n useEffect(() => {\n let isMounted = true;\n if (!hasEntityId(entityId) || !path) {\n setEntity(undefined);\n return;\n }\n const fetchOne = async () => {\n setDataLoading(true);\n try {\n const fetchedEntity = await dataClient.collection(path).findById(entityId);\n if (isMounted) {\n setEntity(fetchedEntity);\n }\n } catch (error) {\n console.error(\"Error fetching entity:\", error);\n if (isMounted) {\n setEntity(undefined);\n }\n } finally {\n if (isMounted) {\n setDataLoading(false);\n }\n }\n }\n\n fetchOne();\n\n return () => {\n isMounted = false;\n }\n }, [entityId, path]);\n\n if (dataLoading && !entity) {\n return (\n <EntityPreviewContainer\n hover={props.hover}\n size={props.size}>\n <Skeleton/>\n </EntityPreviewContainer>\n );\n }\n\n if (!entity) {\n return (\n <EntityPreviewContainer\n hover={props.hover}\n size={props.size}>\n <div className={\"text-text-secondary dark:text-text-secondary-dark\"}>\n Entity not found\n </div>\n </EntityPreviewContainer>\n );\n }\n\n return <EntityPreviewBindingData\n {...props}\n entity={entity}/>;\n}\n\n/**\n * This view is used to display a preview of a entity.\n * It is used by default in reference fields and whenever a reference is displayed.\n */\nexport function EntityPreviewBinding({\n actions,\n disabled,\n hover,\n collection,\n previewKeys,\n onClick,\n size = \"medium\",\n includeId = true,\n includeTitle = true,\n includeEntityLink = true,\n includeImage = true,\n onSidePanelClick,\n entity\n}: EntityPreviewBindingProps) {\n\n return (\n <EntityPreviewContainer\n onClick={disabled ? undefined : onClick}\n hover={disabled ? undefined : hover}\n size={size}>\n <EntityPreviewBindingData\n actions={actions}\n collection={collection}\n previewKeys={previewKeys}\n size={size}\n includeId={includeId}\n includeTitle={includeTitle}\n includeEntityLink={includeEntityLink}\n includeImage={includeImage}\n onSidePanelClick={onSidePanelClick}\n entity={entity}\n />\n </EntityPreviewContainer>\n );\n}\n\nexport type EntityPreviewContainerProps = {\n children: React.ReactNode;\n hover?: boolean;\n fullwidth?: boolean;\n size?: PreviewSize;\n className?: string;\n style?: React.CSSProperties;\n onClick?: (e: React.SyntheticEvent) => void;\n};\n\nexport const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({\n children,\n hover,\n onClick,\n size = \"medium\",\n style,\n className,\n fullwidth = true,\n ...props\n}, ref) => {\n return <div\n ref={ref}\n tabIndex={0}\n style={style}\n className={cls(\n \"bg-surface-card\",\n // On the shared 28/32/40/48 control scale. `44px` was between two\n // steps of it, so a reference in a form was 4px short of the field\n // next to it and their boxes never quite agreed.\n size === \"small\" ? \"min-h-[32px]\" : \"min-h-[48px]\",\n fullwidth ? \"w-full\" : \"\",\n \"items-center overflow-hidden\",\n hover ? \"hover:bg-surface-hover group-hover:bg-surface-hover\" : \"\",\n size === \"small\" ? \"p-1\" : \"px-2 py-1\",\n \"flex border rounded-lg\",\n onClick ? \"cursor-pointer\" : \"\",\n defaultBorderMixin,\n className)}\n role={onClick ? \"button\" : undefined}\n onClick={(event) => {\n if (onClick) {\n event.preventDefault();\n onClick(event);\n }\n }}\n onKeyDown={(event) => {\n if (onClick && (event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n onClick(event);\n }\n }}\n {...props}>\n {children}\n </div>;\n});\n\nEntityPreviewContainer.displayName = \"EntityPreviewContainer\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4EA,SAAgB,yBAAyB,EACrC,SACA,YAAY,gBACZ,aACA,OAAO,UACP,YAAY,MACZ,kBACA,eAAe,MACf,oBAAoB,MACpB,eAAe,MACf,SAAS,QACT,UAC8B;CAE9B,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,sBAAsB,aAAa;CACzC,MAAM,0BAA0B,2BAA2B;CAE3D,MAAM,+BAA+B,gCAAgC;CAErE,MAAM,aAAa,kBAAkB,6BAA6B,cAAc,OAAO,IAAI;CAI3F,MAAM,QAAQ,e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jG,UACA,OACA,SACA,OAAO,UACP,OACA,WACA,YAAY,MACZ,GAAG,SACJ,QAAQ;CACP,OAAO,oBAAC,OAAD;EACE;EACL,UAAU;EACH;EACP,WAAW,IACP,mBAIA,SAAS,UAAU,iBAAiB,gBACpC,YAAY,WAAW,IACvB,gCACA,QAAQ,wDAAwD,IAChE,SAAS,UAAU,QAAQ,aAC3B,0BACA,UAAU,mBAAmB,IAC7B,oBACA,SAAS;EACb,MAAM,UAAU,WAAW,KAAA;EAC3B,UAAU,UAAU;GAChB,IAAI,SAAS;IACT,MAAM,eAAe;IACrB,QAAQ,KAAK;GACjB;EACJ;EACA,YAAY,UAAU;GAClB,IAAI,YAAY,MAAM,QAAQ,WAAW,MAAM,QAAQ,MAAM;IACzD,MAAM,eAAe;IACrB,QAAQ,KAAK;GACjB;EACJ;EACA,GAAI;EACH;CACA,CAAA;AACT,CAAC;AAED,uBAAuB,cAAc"}
|
|
@@ -113,7 +113,7 @@ function StringNumberFilterField({ name, value, setValue, type, isArray, enumVal
|
|
|
113
113
|
disabled: isNullOperation,
|
|
114
114
|
placeholder: isNullOperation ? "null" : void 0,
|
|
115
115
|
onChange: (evt) => {
|
|
116
|
-
const val = type === "number" ? parseFloat(evt.target.value) : evt.target.value;
|
|
116
|
+
const val = evt.target.value === "" ? void 0 : type === "number" ? parseFloat(evt.target.value) : evt.target.value;
|
|
117
117
|
updateFilter(operation, val);
|
|
118
118
|
},
|
|
119
119
|
endAdornment: internalValue !== void 0 && internalValue != null && /* @__PURE__ */ jsx(IconButton, {
|
|
@@ -129,7 +129,7 @@ function StringNumberFilterField({ name, value, setValue, type, isArray, enumVal
|
|
|
129
129
|
disabled: isNullOperation,
|
|
130
130
|
value: hasSingleValue ? String(internalValue) : "",
|
|
131
131
|
onValueChange: (value) => {
|
|
132
|
-
if (value !== "") updateFilter(operation, type === "number" ?
|
|
132
|
+
if (value !== "") updateFilter(operation, type === "number" ? parseFloat(value) : value);
|
|
133
133
|
},
|
|
134
134
|
endAdornment: hasSingleValue && /* @__PURE__ */ jsx(IconButton, {
|
|
135
135
|
"aria-label": t("clear"),
|
|
@@ -160,7 +160,7 @@ function StringNumberFilterField({ name, value, setValue, type, isArray, enumVal
|
|
|
160
160
|
value: Array.isArray(internalValue) ? internalValue.map((e) => String(e)) : [],
|
|
161
161
|
disabled: isNullOperation,
|
|
162
162
|
onValueChange: (value) => {
|
|
163
|
-
updateFilter(operation, type === "number" ? (value ?? []).map((v) =>
|
|
163
|
+
updateFilter(operation, type === "number" ? (value ?? []).map((v) => parseFloat(v)) : value);
|
|
164
164
|
},
|
|
165
165
|
children: enumValues.map((enumConfig) => /* @__PURE__ */ jsx(MultiSelectItem, {
|
|
166
166
|
value: String(enumConfig.id),
|