@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.
Files changed (63) hide show
  1. package/dist/collection_editor/serializable_utils.js +5 -2
  2. package/dist/collection_editor/serializable_utils.js.map +1 -1
  3. package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +17 -0
  4. package/dist/collection_editor/ui/collection_editor/EnumForm.js +31 -17
  5. package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
  6. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +6 -5
  7. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
  8. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +3 -2
  9. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
  10. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +32 -16
  11. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
  12. package/dist/components/DetailViewBinding.js +4 -3
  13. package/dist/components/DetailViewBinding.js.map +1 -1
  14. package/dist/components/EditViewBinding.js +23 -5
  15. package/dist/components/EditViewBinding.js.map +1 -1
  16. package/dist/components/EntityPreviewBinding.js +1 -0
  17. package/dist/components/EntityPreviewBinding.js.map +1 -1
  18. package/dist/components/SelectableTable/filters/StringNumberFilterField.js +3 -3
  19. package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
  20. package/dist/components/SidePanelBinding.js +7 -6
  21. package/dist/components/SidePanelBinding.js.map +1 -1
  22. package/dist/components/app/Scaffold.js +16 -1
  23. package/dist/components/app/Scaffold.js.map +1 -1
  24. package/dist/components/history/EntityHistoryView.js +2 -1
  25. package/dist/components/history/EntityHistoryView.js.map +1 -1
  26. package/dist/data_export/export/export.js +3 -3
  27. package/dist/data_export/export/export.js.map +1 -1
  28. package/dist/data_import/import/ImportCollectionAction.js +10 -12
  29. package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
  30. package/dist/data_import/utils/id_column.d.ts +19 -0
  31. package/dist/data_import/utils/id_column.js +19 -1
  32. package/dist/data_import/utils/id_column.js.map +1 -1
  33. package/dist/data_import/utils/transforms.js +24 -7
  34. package/dist/data_import/utils/transforms.js.map +1 -1
  35. package/dist/form/EntityForm.d.ts +1 -1
  36. package/dist/form/EntityForm.js +14 -4
  37. package/dist/form/EntityForm.js.map +1 -1
  38. package/dist/form/EntityFormBinding.js +12 -8
  39. package/dist/form/EntityFormBinding.js.map +1 -1
  40. package/dist/form/components/FieldBlock.js +2 -1
  41. package/dist/form/components/FieldBlock.js.map +1 -1
  42. package/dist/form/field_bindings/KeyValueFieldBinding.js +3 -1
  43. package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
  44. package/dist/form/field_bindings/ReadOnlyFieldBinding.js +0 -2
  45. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
  46. package/dist/form/field_bindings/TextFieldBinding.js +3 -2
  47. package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
  48. package/dist/form/validation.js +12 -1
  49. package/dist/form/validation.js.map +1 -1
  50. package/dist/hooks/navigation/url_segments.d.ts +33 -0
  51. package/dist/hooks/navigation/url_segments.js +56 -0
  52. package/dist/hooks/navigation/url_segments.js.map +1 -0
  53. package/dist/hooks/navigation/useBuildUrlController.js +4 -2
  54. package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
  55. package/dist/hooks/useBuildSidePanel.js +6 -5
  56. package/dist/hooks/useBuildSidePanel.js.map +1 -1
  57. package/dist/hooks/useHistory.js +4 -3
  58. package/dist/hooks/useHistory.js.map +1 -1
  59. package/dist/routes/RebaseRoute.js +20 -30
  60. package/dist/routes/RebaseRoute.js.map +1 -1
  61. package/dist/util/navigation_utils.js +4 -3
  62. package/dist/util/navigation_utils.js.map +1 -1
  63. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"DetailViewBinding.js","names":[],"sources":["../../src/components/DetailViewBinding.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, Property } from \"@rebasepro/types\";\nimport { PluginProviderStack, resolveComponentRef, useComponentOverride, CollectionScopeProvider, getAdminEntityChildViews } from \"@rebasepro/app\";\n\nimport { CollectionViewBinding } from \"./CollectionViewBinding/CollectionViewBinding\";\nimport { EntityViewBinding } from \"./EntityViewBinding\";\nimport { EntityIdentityBar } from \"./EntityIdentityBar\";\nimport { SplitListCloseButton } from \"./CollectionViewBinding/SplitListCloseButton\";\nimport { SplitListShowButton } from \"./CollectionViewBinding/SplitListShowButton\";\nimport { EntityInspector, InspectorTab } from \"./EntityInspector\";\nimport { CircularProgressCenter, iconSize } from \"@rebasepro/ui\";\nimport {\n Alert,\n Button,\n CenteredView,\n cls,\n CodeIcon,\n defaultBorderMixin,\n HistoryIcon,\n IconButton,\n Maximize2Icon,\n PencilIcon,\n Skeleton,\n Tab,\n Tabs,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { ErrorView, createFormexStub, usePermissions, useTranslation, getIcon } from \"@rebasepro/app\";\n\nimport { removeInitialAndTrailingSlashes, resolveDefaultSelectedView } from \"@rebasepro/app\";\nimport { withListState } from \"../util/view_mode\";\nimport { resolvedSelectedEntityView } from \"../util/resolutions\";\nimport {\n useCustomizationController,\n useFetch,\n useRebaseContext,\n useLargeLayout,\n useSlot\n} from \"@rebasepro/app\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useNavigate } from \"react-router\";\nimport { useEntityDisplayTitle } from \"../hooks/useEntityDisplayTitle\";\nimport { useAdminContext } from \"../hooks/useAdminContext\";\nimport { useLeaveRecord, useRecordActions } from \"../hooks/useRecordActions\";\n\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\";\n\nexport type BarActionsParams = {\n values: object,\n status: EntityStatus,\n path: string,\n entityId?: string | number;\n /** Always false here — this view reads a record, it does not edit one. */\n dirty: boolean;\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\nexport interface DetailViewBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {\n path: string;\n collection: AdminCollection<M>;\n entityId: string | number;\n selectedTab?: string;\n parentCollectionSlugs: string[];\n parentEntityIds: string[];\n onTabChange?: (props: OnTabChangeParams<M>) => void;\n onEditClick?: () => void;\n /**\n * Dismiss this record — the ✕ at the identity bar's trailing edge.\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 */\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}\n\nexport function DetailViewBinding<M extends Record<string, unknown>>({\n entityId,\n ...props\n}: DetailViewBindingProps<M>) {\n\n const {\n entity,\n dataLoading,\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 useCache: false\n });\n\n if (!dataLoading && dataLoadingError) {\n return <CenteredView>\n <ErrorView error={dataLoadingError} />\n </CenteredView>;\n }\n\n if (!dataLoading && !entity) {\n return <CenteredView>\n <Typography variant=\"label\">Entity not found</Typography>\n </CenteredView>;\n }\n\n const content = (\n <DetailViewBindingInner<M>\n {...props}\n entityId={entityId}\n entity={entity}\n dataLoading={dataLoading}\n />\n );\n\n return (\n <CollectionScopeProvider collection={props.collection}>\n {content}\n </CollectionScopeProvider>\n );\n}\n\nfunction DetailViewBindingInner<M extends Record<string, unknown>>({\n path,\n entityId,\n selectedTab: selectedTabProp,\n collection,\n parentCollectionSlugs,\n parentEntityIds,\n onTabChange,\n onEditClick,\n onCloseRequest,\n entity,\n dataLoading,\n layout = \"full_screen\",\n barActions,\n barActionsStart,\n onShowList\n}: DetailViewBindingProps<M> & {\n entity?: Entity<M>,\n dataLoading: boolean,\n}) {\n const ResolvedCollectionView = useComponentOverride(\"Collection.View\", CollectionViewBinding);\n const { t } = useTranslation();\n const context = useRebaseContext();\n const urlController = useUrlController();\n const navigate = useNavigate();\n const customizationController = useCustomizationController();\n const plugins = customizationController.plugins;\n const collectionRegistryController = useCollectionRegistryController();\n const { canEdit: canEditHook } = usePermissions();\n\n const canEdit = useMemo(() => {\n return entity ? canEditHook(collection, path, entity) : false;\n }, [canEditHook, entity, collection, path]);\n\n const [usedEntity, setUsedEntity] = useState<Entity<M> | undefined>(entity);\n useEffect(() => {\n if (entity) setUsedEntity(entity);\n }, [entity]);\n\n const defaultSelectedView = useMemo(() => resolveDefaultSelectedView(\n collection.defaultSelectedView,\n { status: \"existing\",\nentityId }\n ), [collection, entityId]);\n\n // Track whether the user has explicitly clicked a tab in this component\n // instance. See EditViewBindingInner for full explanation.\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 // `hideFromEntityViews`, not `hideFromNavigation`: the latter governs the\n // drawer. Filtering tabs on it defeated the introspection generator, which\n // sets `hideFromNavigation` on owned-child tables precisely *because* \"every\n // inbound foreign key renders as a tab on the parent\" — so the rows it\n // deliberately kept out of the drawer became reachable from nowhere.\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 // Same split as the edit view: the strip is for destinations, the inspector\n // for the developer tools that used to sit in front of them.\n const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;\n\n const [inspectorTab, setInspectorTab] = useState<InspectorTab | null>(null);\n\n const legacyInspectorTab: InspectorTab | undefined = selectedTab === JSON_TAB_VALUE\n ? \"json\"\n : selectedTab === HISTORY_TAB_VALUE ? \"history\" : undefined;\n useEffect(() => {\n if (legacyInspectorTab) setInspectorTab(legacyInspectorTab);\n }, [legacyInspectorTab]);\n\n const {\n resolvedEntityViews\n } = resolvedSelectedEntityView(customViews, customizationController, undefined, canEdit);\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 } = resolvedSelectedEntityView(customViews, customizationController, activeTab, canEdit);\n\n const mainViewVisible = activeTab === MAIN_TAB_VALUE;\n\n // Track which custom view tabs have been visited\n const mountedTabsRef = useRef<Set<string>>(new Set());\n if (activeTab) {\n mountedTabsRef.current.add(activeTab);\n }\n\n // Read-only form context for custom entity views\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: \"existing\",\n values: usedEntity?.values ?? ({} as M),\n setFieldValue: () => {\n throw new Error(\"Cannot update values in read-only detail view\");\n },\n save: () => {\n throw new Error(\"Cannot save in read-only detail view\");\n },\n submit: () => {\n throw new Error(\"Cannot submit in read-only detail view\");\n },\n collection,\n path,\n entity: usedEntity,\n savingError: undefined,\n formex: formexStub\n };\n }, [entityId, layout, usedEntity, collection, path]);\n\n // Plugin slots\n const formActionTopProps: PluginFormActionProps = useMemo(() => ({\n entityId,\n parentCollectionSlugs,\n parentEntityIds,\n path,\n status: \"existing\",\n collection: collection!,\n context,\n formContext: readOnlyFormContext as FormContext<Record<string, unknown>> | undefined,\n openEntityMode: layout,\n disabled: true\n }), [entityId, parentCollectionSlugs, parentEntityIds, path, collection, context, readOnlyFormContext, layout]);\n const pluginActionsTop = useSlot(\"form.actions.top\", formActionTopProps);\n\n // The record's own actions, as on the edit view: a read-only record is\n // still one you can recalculate, resend or delete. There is no form here,\n // so they are called without a `formContext`.\n const adminContext = useAdminContext();\n const leaveRecord = useLeaveRecord({ layout, path, onCloseRequest });\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 }\n : undefined, [usedEntity, path, collection, context, adminContext.sidePanelController, layout, leaveRecord]);\n const recordActions = useRecordActions({\n collection,\n path,\n entity: usedEntity,\n clickProps: recordActionClickProps\n });\n\n // Resolve formView.Builder if provided\n const formViewConfig = (collection as AdminCollection<M> & { formView?: FormViewConfig<M> }).formView;\n const FormViewBuilder = formViewConfig?.Builder ? resolveComponentRef<EntityCustomViewParams>(formViewConfig.Builder as ComponentRef<EntityCustomViewParams>) : null;\n\n // The heading, resolved the one way — this used to be a copy of\n // `useEntityDisplayTitle`'s body, and the two had already drifted.\n const title = useEntityDisplayTitle({\n collection,\n entity: usedEntity,\n status: \"existing\"\n });\n\n // Non-action custom views\n const nonActionCustomViews = useMemo(() =>\n resolvedEntityViews.filter(e => !e.includeActions),\n [resolvedEntityViews]\n );\n\n const customViewsView = customViews && nonActionCustomViews\n .map((customView) => {\n if (!customView) return null;\n const Builder = resolveComponentRef<EntityCustomViewParams>(customView.Builder);\n if (!Builder) return null;\n if (!entityId) return null;\n\n const isActive = activeTab === customView.key;\n const hasBeenMounted = mountedTabsRef.current.has(customView.key);\n if (!isActive && !hasBeenMounted) return null;\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 {readOnlyFormContext && <Builder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedEntity?.values}\n formContext={readOnlyFormContext as FormContext<Record<string, unknown>>}\n />}\n </Suspense>\n </ErrorBoundary>\n </div>;\n }).filter(Boolean);\n\n const globalLoading = dataLoading && !usedEntity;\n\n // Subcollection views\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 {globalLoading && <CircularProgressCenter />}\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 {/* No `?? \"…\"` here: `t` returns the key itself\n when it cannot find one, never null, so the\n fallback never ran and this rendered the raw\n `save_entity_before_subcollections`. The key\n exists now, in all seven locales. */}\n {t(\"save_entity_before_subcollections\")}\n </Typography>\n </div>)\n }\n </div>\n );\n }).filter(Boolean);\n\n const onSideTabClick = useCallback((value: string) => {\n userHasChangedTab.current = true;\n setSelectedTab(value);\n onTabChange?.({\n path,\n entityId,\n selectedTab: value === MAIN_TAB_VALUE ? undefined : value,\n collection\n });\n }, [onTabChange, path, entityId, collection]);\n\n const propertyDetailView = () => {\n // formView.Builder replaces the default property display. It gets the\n // centred column the record used to be given here; the default display\n // now lays itself out, rail included.\n if (FormViewBuilder && usedEntity) {\n return <div className={\"@container/form flex-1 min-w-0 overflow-y-auto flex justify-center items-start\"}>\n <div className={cls(\n // Same widths as the default form (see EntityForm).\n \"w-full max-w-3xl @7xl/form:max-w-4xl 2xl:max-w-4xl flex flex-col\",\n layout === \"dialog\"\n ? \"pt-5 pb-12 px-6 sm:px-8\"\n : \"pt-6 pb-16 px-5 sm:px-8\"\n )}>\n <ErrorBoundary>\n <Suspense fallback={<CircularProgressCenter />}>\n <FormViewBuilder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedEntity?.values}\n formContext={readOnlyFormContext as FormContext<Record<string, unknown>>}\n />\n </Suspense>\n </ErrorBoundary>\n </div>\n </div>;\n }\n\n return (\n <>\n {usedEntity && <EntityViewBinding\n entity={usedEntity}\n collection={collection}\n path={path}\n asPage\n openEntityMode={layout}\n formContext={readOnlyFormContext}\n />}\n </>\n );\n };\n\n // Tabs\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 // The breadcrumb's destination, and the back arrow's when it renders. Both\n // keep the list's whole URL state: a collection reached from one of its own\n // records must come back as the user left it — the same view mode, search,\n // filters and sort.\n const collectionUrl = withListState(urlController.buildUrlCollectionPath(path));\n\n // Full screen is the one layout with no way out of its own: a side panel and a\n // dialog can be dismissed, and a split keeps the list beside it, but opening an\n // entity full screen replaces the collection entirely and left browser Back as\n // the only route back to it — which is not an affordance the page shows, and is\n // wrong anyway once the user has moved between tabs inside the entity.\n //\n // Unless the list can be unfolded back beside the record: that chevron\n // leads to the same collection while keeping the record open, so it stands\n // alone rather than beside an arrow going almost the same place.\n //\n // It goes to the bar's leading edge — where a back control reads as back,\n // and where the edit view has always put the same arrow — rather than to\n // the trailing edge among the record's own actions.\n const backToCollection = layout === \"full_screen\" && !onShowList\n ? () => navigate(collectionUrl)\n : undefined;\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 const entityUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);\n navigate(`${entityUrl}#full`);\n }}\n >\n <Maximize2Icon size={iconSize.smallest} />\n </IconButton>\n </Tooltip>\n ) : null;\n\n // Edit button — only rendered when the user has edit permissions\n const editButton = canEdit && onEditClick ? (\n <Button\n variant=\"filled\"\n color=\"primary\"\n size=\"small\"\n startIcon={<PencilIcon size={iconSize.smallest} />}\n onClick={onEditClick}>\n {t(\"edit_entity\")}\n </Button>\n ) : null;\n\n // Main content view. The title, the `path/id` chip and the empty band under\n // them have moved into the identity bar, and the `w-80 2xl:w-96` rail that\n // held a single Edit button is gone — the bar holds it now.\n //\n // The scroll now lives on the record's own column rather than on this row,\n // so the metadata rail beside it stays put while the record scrolls — the\n // same arrangement the form uses.\n const mainView = <div\n className={cls(\n \"flex-1 flex flex-row w-full min-h-0\",\n !mainViewVisible ? \"hidden\" : \"\"\n )}>\n {propertyDetailView()}\n </div>;\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\" ? collectionUrl : undefined}\n title={title}\n entityId={entityId}\n status={\"existing\"}\n dirty={false}\n saving={false}\n onBack={backToCollection}\n onClose={onCloseRequest}\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 // Where Save stands on the edit view: after the record's own\n // buttons, ahead of the menu.\n primaryAction={editButton}\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 {layout === \"split\" && <SplitListCloseButton/>}\n {layout === \"full_screen\" && onShowList && <SplitListShowButton onClick={onShowList}/>}\n </>}\n trailing={<>\n {pluginActionsTop}\n {fullScreenButton}\n {barActions?.({\n path,\n entityId,\n values: usedEntity?.values ?? {},\n status: \"existing\",\n dirty: false\n })}\n </>}\n />\n\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 {customViewTabsEnd}\n {subcollectionTabs}\n </Tabs>\n </div>}\n\n {/* See EditViewBinding: the inspector docks beside the record rather\n than over it, so the record stays readable and scrollable. */}\n <div className={\"flex-1 min-h-0 flex\"}>\n\n <div className={\"flex-1 min-w-0 flex flex-col\"}>\n {globalLoading\n ? <DetailViewSkeleton collection={collection} />\n : mainView}\n\n {customViewsView}\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={readOnlyFormContext as FormContext<Record<string, unknown>> | undefined}\n values={usedEntity?.values}\n includeHistory={includeHistoryView}/>\n </div>\n\n </div>;\n\n if (plugins && plugins.length > 0) {\n result = (\n <PluginProviderStack\n plugins={plugins}\n scope=\"form\"\n scopeProps={{\n status: \"existing\",\n path,\n collection,\n entity: usedEntity,\n context,\n formContext: readOnlyFormContext\n }}>\n {result}\n </PluginProviderStack>\n );\n }\n\n return result;\n}\n\nfunction DetailViewSkeleton({ collection }: { collection: AdminCollection<Record<string, unknown>> }) {\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 <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 <div className=\"mt-12 flex flex-col gap-8\">\n <div className=\"flex flex-wrap gap-x-4 w-full space-y-8\">\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6GA,SAAgB,kBAAqD,EACjE,UACA,GAAG,SACuB;CAE1B,MAAM,EACF,QACA,aACA,qBACA,SAAY;EACZ,MAAM,MAAM;EACF;EACV,YAAY,MAAM;EAElB,WAAW;EACX,UAAU;CACd,CAAC;CAED,IAAI,CAAC,eAAe,kBAChB,OAAO,oBAAC,cAAD,EAAA,UACH,oBAAC,WAAD,EAAW,OAAO,iBAAmB,CAAA,EAC3B,CAAA;CAGlB,IAAI,CAAC,eAAe,CAAC,QACjB,OAAO,oBAAC,cAAD,EAAA,UACH,oBAAC,YAAD;EAAY,SAAQ;YAAQ;CAA4B,CAAA,EAC9C,CAAA;CAGlB,MAAM,UACF,oBAAC,wBAAD;EACI,GAAI;EACM;EACF;EACK;CAChB,CAAA;CAGL,OACI,oBAAC,yBAAD;EAAyB,YAAY,MAAM;YACtC;CACoB,CAAA;AAEjC;AAEA,SAAS,uBAA0D,EAC/D,MACA,UACA,aAAa,iBACb,YACA,uBACA,iBACA,aACA,aACA,gBACA,QACA,aACA,SAAS,eACT,YACA,iBACA,cAID;CACC,MAAM,yBAAyB,qBAAqB,mBAAmB,qBAAqB;CAC5F,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,UAAU,iBAAiB;CACjC,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,WAAW,YAAY;CAC7B,MAAM,0BAA0B,2BAA2B;CAC3D,MAAM,UAAU,wBAAwB;CACH,gCAAgC;CACrE,MAAM,EAAE,SAAS,gBAAgB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,OAAD;IAAK,WAAU;cAAf,CACI,qBAAC,OAAD;KAAK,WAAU;eAAf,CACI,oBAAC,OAAD;MAAK,WAAW,mBAAmB,WAAW,iBAAiB,SAAS;gBACpE,oBAAC,UAAD;OAAU,QAAQ;OAAI,WAAU;MAAqB,CAAA;KACpD,CAAA,GACL,oBAAC,UAAD;MAAU,QAAQ;MAAI,WAAU;KAAqB,CAAA,CACpD;QACL,oBAAC,OAAD;KAAK,WAAU;eACX,qBAAC,OAAD;MAAK,WAAU;gBAAf;OACI,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;OACL,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;OACL,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;OACL,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;MACJ;;IACJ,CAAA,CACJ;;EACJ,CAAA;CACJ,CAAA;AAEb"}
1
+ {"version":3,"file":"DetailViewBinding.js","names":[],"sources":["../../src/components/DetailViewBinding.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, Property } from \"@rebasepro/types\";\nimport { PluginProviderStack, resolveComponentRef, useComponentOverride, CollectionScopeProvider, getAdminEntityChildViews } from \"@rebasepro/app\";\n\nimport { CollectionViewBinding } from \"./CollectionViewBinding/CollectionViewBinding\";\nimport { EntityViewBinding } from \"./EntityViewBinding\";\nimport { EntityIdentityBar } from \"./EntityIdentityBar\";\nimport { SplitListCloseButton } from \"./CollectionViewBinding/SplitListCloseButton\";\nimport { SplitListShowButton } from \"./CollectionViewBinding/SplitListShowButton\";\nimport { EntityInspector, InspectorTab } from \"./EntityInspector\";\nimport { CircularProgressCenter, iconSize } from \"@rebasepro/ui\";\nimport {\n Alert,\n Button,\n CenteredView,\n cls,\n CodeIcon,\n defaultBorderMixin,\n HistoryIcon,\n IconButton,\n Maximize2Icon,\n PencilIcon,\n Skeleton,\n Tab,\n Tabs,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { ErrorView, createFormexStub, usePermissions, useTranslation, getIcon } from \"@rebasepro/app\";\n\nimport { removeInitialAndTrailingSlashes, resolveDefaultSelectedView } from \"@rebasepro/app\";\nimport { withListState } from \"../util/view_mode\";\nimport { resolvedSelectedEntityView } from \"../util/resolutions\";\nimport {\n useCustomizationController,\n useFetch,\n useRebaseContext,\n useLargeLayout,\n useSlot\n} from \"@rebasepro/app\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useNavigate } from \"react-router\";\nimport { useEntityDisplayTitle } from \"../hooks/useEntityDisplayTitle\";\nimport { useAdminContext } from \"../hooks/useAdminContext\";\nimport { useLeaveRecord, useRecordActions } from \"../hooks/useRecordActions\";\n\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\";\n\nexport type BarActionsParams = {\n values: object,\n status: EntityStatus,\n path: string,\n entityId?: string | number;\n /** Always false here — this view reads a record, it does not edit one. */\n dirty: boolean;\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\nexport interface DetailViewBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {\n path: string;\n collection: AdminCollection<M>;\n entityId: string | number;\n selectedTab?: string;\n parentCollectionSlugs: string[];\n parentEntityIds: string[];\n onTabChange?: (props: OnTabChangeParams<M>) => void;\n onEditClick?: () => void;\n /**\n * Dismiss this record — the ✕ at the identity bar's trailing edge.\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 */\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}\n\nexport function DetailViewBinding<M extends Record<string, unknown>>({\n entityId,\n ...props\n}: DetailViewBindingProps<M>) {\n\n const {\n entity,\n dataLoading,\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 useCache: false\n });\n\n if (!dataLoading && dataLoadingError) {\n return <CenteredView>\n <ErrorView error={dataLoadingError} />\n </CenteredView>;\n }\n\n if (!dataLoading && !entity) {\n return <CenteredView>\n <Typography variant=\"label\">Entity not found</Typography>\n </CenteredView>;\n }\n\n const content = (\n <DetailViewBindingInner<M>\n {...props}\n entityId={entityId}\n entity={entity}\n dataLoading={dataLoading}\n />\n );\n\n return (\n <CollectionScopeProvider collection={props.collection}>\n {content}\n </CollectionScopeProvider>\n );\n}\n\nfunction DetailViewBindingInner<M extends Record<string, unknown>>({\n path,\n entityId,\n selectedTab: selectedTabProp,\n collection,\n parentCollectionSlugs,\n parentEntityIds,\n onTabChange,\n onEditClick,\n onCloseRequest,\n entity,\n dataLoading,\n layout = \"full_screen\",\n barActions,\n barActionsStart,\n onShowList\n}: DetailViewBindingProps<M> & {\n entity?: Entity<M>,\n dataLoading: boolean,\n}) {\n const ResolvedCollectionView = useComponentOverride(\"Collection.View\", CollectionViewBinding);\n const { t } = useTranslation();\n const context = useRebaseContext();\n const urlController = useUrlController();\n const navigate = useNavigate();\n const customizationController = useCustomizationController();\n const plugins = customizationController.plugins;\n const collectionRegistryController = useCollectionRegistryController();\n const { canEdit: canEditHook } = usePermissions();\n\n const canEdit = useMemo(() => {\n return entity ? canEditHook(collection, path, entity) : false;\n }, [canEditHook, entity, collection, path]);\n\n const [usedEntity, setUsedEntity] = useState<Entity<M> | undefined>(entity);\n useEffect(() => {\n if (entity) setUsedEntity(entity);\n }, [entity]);\n\n const defaultSelectedView = useMemo(() => resolveDefaultSelectedView(\n collection.defaultSelectedView,\n { status: \"existing\",\nentityId }\n ), [collection, entityId]);\n\n // Track whether the user has explicitly clicked a tab in this component\n // instance. See EditViewBindingInner for full explanation.\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 // `hideFromEntityViews`, not `hideFromNavigation`: the latter governs the\n // drawer. Filtering tabs on it defeated the introspection generator, which\n // sets `hideFromNavigation` on owned-child tables precisely *because* \"every\n // inbound foreign key renders as a tab on the parent\" — so the rows it\n // deliberately kept out of the drawer became reachable from nowhere.\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 // Same split as the edit view: the strip is for destinations, the inspector\n // for the developer tools that used to sit in front of them.\n const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;\n\n const [inspectorTab, setInspectorTab] = useState<InspectorTab | null>(null);\n\n const legacyInspectorTab: InspectorTab | undefined = selectedTab === JSON_TAB_VALUE\n ? \"json\"\n : selectedTab === HISTORY_TAB_VALUE ? \"history\" : undefined;\n useEffect(() => {\n if (legacyInspectorTab) setInspectorTab(legacyInspectorTab);\n }, [legacyInspectorTab]);\n\n const {\n resolvedEntityViews\n } = resolvedSelectedEntityView(customViews, customizationController, undefined, canEdit);\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 } = resolvedSelectedEntityView(customViews, customizationController, activeTab, canEdit);\n\n const mainViewVisible = activeTab === MAIN_TAB_VALUE;\n\n // Track which custom view tabs have been visited\n const mountedTabsRef = useRef<Set<string>>(new Set());\n if (activeTab) {\n mountedTabsRef.current.add(activeTab);\n }\n\n // Read-only form context for custom entity views\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: \"existing\",\n values: usedEntity?.values ?? ({} as M),\n setFieldValue: () => {\n throw new Error(\"Cannot update values in read-only detail view\");\n },\n save: () => {\n throw new Error(\"Cannot save in read-only detail view\");\n },\n submit: () => {\n throw new Error(\"Cannot submit in read-only detail view\");\n },\n collection,\n path,\n entity: usedEntity,\n savingError: undefined,\n formex: formexStub\n };\n }, [entityId, layout, usedEntity, collection, path]);\n\n // Plugin slots\n const formActionTopProps: PluginFormActionProps = useMemo(() => ({\n entityId,\n parentCollectionSlugs,\n parentEntityIds,\n path,\n status: \"existing\",\n collection: collection!,\n context,\n formContext: readOnlyFormContext as FormContext<Record<string, unknown>> | undefined,\n openEntityMode: layout,\n disabled: true\n }), [entityId, parentCollectionSlugs, parentEntityIds, path, collection, context, readOnlyFormContext, layout]);\n const pluginActionsTop = useSlot(\"form.actions.top\", formActionTopProps);\n\n // The record's own actions, as on the edit view: a read-only record is\n // still one you can recalculate, resend or delete. There is no form here,\n // so they are called without a `formContext`.\n const adminContext = useAdminContext();\n const leaveRecord = useLeaveRecord({ layout, path, onCloseRequest });\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 }\n : undefined, [usedEntity, path, collection, context, adminContext.sidePanelController, layout, leaveRecord]);\n const recordActions = useRecordActions({\n collection,\n path,\n entity: usedEntity,\n clickProps: recordActionClickProps\n });\n\n // Resolve formView.Builder if provided\n const formViewConfig = (collection as AdminCollection<M> & { formView?: FormViewConfig<M> }).formView;\n const FormViewBuilder = formViewConfig?.Builder ? resolveComponentRef<EntityCustomViewParams>(formViewConfig.Builder as ComponentRef<EntityCustomViewParams>) : null;\n\n // The heading, resolved the one way — this used to be a copy of\n // `useEntityDisplayTitle`'s body, and the two had already drifted.\n const title = useEntityDisplayTitle({\n collection,\n entity: usedEntity,\n status: \"existing\"\n });\n\n // Non-action custom views\n const nonActionCustomViews = useMemo(() =>\n resolvedEntityViews.filter(e => !e.includeActions),\n [resolvedEntityViews]\n );\n\n const customViewsView = customViews && nonActionCustomViews\n .map((customView) => {\n if (!customView) return null;\n const Builder = resolveComponentRef<EntityCustomViewParams>(customView.Builder);\n if (!Builder) return null;\n if (!hasEntityId(entityId)) return null;\n\n const isActive = activeTab === customView.key;\n const hasBeenMounted = mountedTabsRef.current.has(customView.key);\n if (!isActive && !hasBeenMounted) return null;\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 {readOnlyFormContext && <Builder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedEntity?.values}\n formContext={readOnlyFormContext as FormContext<Record<string, unknown>>}\n />}\n </Suspense>\n </ErrorBoundary>\n </div>;\n }).filter(Boolean);\n\n const globalLoading = dataLoading && !usedEntity;\n\n // Subcollection views\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 {globalLoading && <CircularProgressCenter />}\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 {/* No `?? \"…\"` here: `t` returns the key itself\n when it cannot find one, never null, so the\n fallback never ran and this rendered the raw\n `save_entity_before_subcollections`. The key\n exists now, in all seven locales. */}\n {t(\"save_entity_before_subcollections\")}\n </Typography>\n </div>)\n }\n </div>\n );\n }).filter(Boolean);\n\n const onSideTabClick = useCallback((value: string) => {\n userHasChangedTab.current = true;\n setSelectedTab(value);\n onTabChange?.({\n path,\n entityId,\n selectedTab: value === MAIN_TAB_VALUE ? undefined : value,\n collection\n });\n }, [onTabChange, path, entityId, collection]);\n\n const propertyDetailView = () => {\n // formView.Builder replaces the default property display. It gets the\n // centred column the record used to be given here; the default display\n // now lays itself out, rail included.\n if (FormViewBuilder && usedEntity) {\n return <div className={\"@container/form flex-1 min-w-0 overflow-y-auto flex justify-center items-start\"}>\n <div className={cls(\n // Same widths as the default form (see EntityForm).\n \"w-full max-w-3xl @7xl/form:max-w-4xl 2xl:max-w-4xl flex flex-col\",\n layout === \"dialog\"\n ? \"pt-5 pb-12 px-6 sm:px-8\"\n : \"pt-6 pb-16 px-5 sm:px-8\"\n )}>\n <ErrorBoundary>\n <Suspense fallback={<CircularProgressCenter />}>\n <FormViewBuilder\n collection={collection}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n entity={usedEntity}\n modifiedValues={usedEntity?.values}\n formContext={readOnlyFormContext as FormContext<Record<string, unknown>>}\n />\n </Suspense>\n </ErrorBoundary>\n </div>\n </div>;\n }\n\n return (\n <>\n {usedEntity && <EntityViewBinding\n entity={usedEntity}\n collection={collection}\n path={path}\n asPage\n openEntityMode={layout}\n formContext={readOnlyFormContext}\n />}\n </>\n );\n };\n\n // Tabs\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 // The breadcrumb's destination, and the back arrow's when it renders. Both\n // keep the list's whole URL state: a collection reached from one of its own\n // records must come back as the user left it — the same view mode, search,\n // filters and sort.\n const collectionUrl = withListState(urlController.buildUrlCollectionPath(path));\n\n // Full screen is the one layout with no way out of its own: a side panel and a\n // dialog can be dismissed, and a split keeps the list beside it, but opening an\n // entity full screen replaces the collection entirely and left browser Back as\n // the only route back to it — which is not an affordance the page shows, and is\n // wrong anyway once the user has moved between tabs inside the entity.\n //\n // Unless the list can be unfolded back beside the record: that chevron\n // leads to the same collection while keeping the record open, so it stands\n // alone rather than beside an arrow going almost the same place.\n //\n // It goes to the bar's leading edge — where a back control reads as back,\n // and where the edit view has always put the same arrow — rather than to\n // the trailing edge among the record's own actions.\n const backToCollection = layout === \"full_screen\" && !onShowList\n ? () => navigate(collectionUrl)\n : undefined;\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 const entityUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);\n navigate(`${entityUrl}#full`);\n }}\n >\n <Maximize2Icon size={iconSize.smallest} />\n </IconButton>\n </Tooltip>\n ) : null;\n\n // Edit button — only rendered when the user has edit permissions\n const editButton = canEdit && onEditClick ? (\n <Button\n variant=\"filled\"\n color=\"primary\"\n size=\"small\"\n startIcon={<PencilIcon size={iconSize.smallest} />}\n onClick={onEditClick}>\n {t(\"edit_entity\")}\n </Button>\n ) : null;\n\n // Main content view. The title, the `path/id` chip and the empty band under\n // them have moved into the identity bar, and the `w-80 2xl:w-96` rail that\n // held a single Edit button is gone — the bar holds it now.\n //\n // The scroll now lives on the record's own column rather than on this row,\n // so the metadata rail beside it stays put while the record scrolls — the\n // same arrangement the form uses.\n const mainView = <div\n className={cls(\n \"flex-1 flex flex-row w-full min-h-0\",\n !mainViewVisible ? \"hidden\" : \"\"\n )}>\n {propertyDetailView()}\n </div>;\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\" ? collectionUrl : undefined}\n title={title}\n entityId={entityId}\n status={\"existing\"}\n dirty={false}\n saving={false}\n onBack={backToCollection}\n onClose={onCloseRequest}\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 // Where Save stands on the edit view: after the record's own\n // buttons, ahead of the menu.\n primaryAction={editButton}\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 {layout === \"split\" && <SplitListCloseButton/>}\n {layout === \"full_screen\" && onShowList && <SplitListShowButton onClick={onShowList}/>}\n </>}\n trailing={<>\n {pluginActionsTop}\n {fullScreenButton}\n {barActions?.({\n path,\n entityId,\n values: usedEntity?.values ?? {},\n status: \"existing\",\n dirty: false\n })}\n </>}\n />\n\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 {customViewTabsEnd}\n {subcollectionTabs}\n </Tabs>\n </div>}\n\n {/* See EditViewBinding: the inspector docks beside the record rather\n than over it, so the record stays readable and scrollable. */}\n <div className={\"flex-1 min-h-0 flex\"}>\n\n <div className={\"flex-1 min-w-0 flex flex-col\"}>\n {globalLoading\n ? <DetailViewSkeleton collection={collection} />\n : mainView}\n\n {customViewsView}\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={readOnlyFormContext as FormContext<Record<string, unknown>> | undefined}\n values={usedEntity?.values}\n includeHistory={includeHistoryView}/>\n </div>\n\n </div>;\n\n if (plugins && plugins.length > 0) {\n result = (\n <PluginProviderStack\n plugins={plugins}\n scope=\"form\"\n scopeProps={{\n status: \"existing\",\n path,\n collection,\n entity: usedEntity,\n context,\n formContext: readOnlyFormContext\n }}>\n {result}\n </PluginProviderStack>\n );\n }\n\n return result;\n}\n\nfunction DetailViewSkeleton({ collection }: { collection: AdminCollection<Record<string, unknown>> }) {\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 <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 <div className=\"mt-12 flex flex-col gap-8\">\n <div className=\"flex flex-wrap gap-x-4 w-full space-y-8\">\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n <div className=\"relative w-full\">\n <Skeleton height={60} className=\"w-full rounded-md\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8GA,SAAgB,kBAAqD,EACjE,U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,WAAU;gBAAf;OACI,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;OACL,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;OACL,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;OACL,oBAAC,OAAD;QAAK,WAAU;kBACX,oBAAC,UAAD;SAAU,QAAQ;SAAI,WAAU;QAAqB,CAAA;OACpD,CAAA;MACJ;;IACJ,CAAA,CACJ;;EACJ,CAAA;CACJ,CAAA;AAEb"}
@@ -20,6 +20,7 @@ import { CollectionViewBinding } from "./CollectionViewBinding/CollectionViewBin
20
20
  import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
21
21
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
22
  import { Alert, Button, CenteredView, CircularProgressCenter, DialogActions, ErrorBoundary, IconButton, Maximize2Icon, Skeleton, Tab, Tabs, Tooltip, Typography, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
23
+ import { hasEntityId } from "@rebasepro/common";
23
24
  import { CollectionScopeProvider, ErrorView, PluginProviderStack, createFormexStub, getAdminEntityChildViews, getEntityFromMemoryCache, getIcon, removeEntityFromMemoryCache, removeInitialAndTrailingSlashes, resolveComponentRef, resolveDefaultSelectedView, saveEntityToMemoryCache, useComponentOverride, useCustomizationController, useFetch, useLargeLayout, usePermissions, useRebaseContext, useSlot, useTranslation } from "@rebasepro/app";
24
25
  import { Link, useNavigate } from "react-router";
25
26
  //#region src/components/EditViewBinding.tsx
@@ -50,7 +51,7 @@ function EditViewBinding({ entityId, ...props }) {
50
51
  const { canEdit: canEditHook } = usePermissions();
51
52
  const { t } = useTranslation();
52
53
  const urlController = useUrlController();
53
- const [status, setStatus] = useState(props.copy ? "copy" : entityId ? "existing" : "new");
54
+ const [status, setStatus] = useState(props.copy ? "copy" : hasEntityId(entityId) ? "existing" : "new");
54
55
  const [lastSeenEntity, setLastSeenEntity] = useState(void 0);
55
56
  useEffect(() => {
56
57
  if (entity) setLastSeenEntity(entity);
@@ -68,7 +69,24 @@ function EditViewBinding({ entityId, ...props }) {
68
69
  props.path
69
70
  ]);
70
71
  if (!dataLoading && dataLoadingError) return /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(ErrorView, { error: dataLoadingError }) });
71
- if (!dataLoading && !initialDirtyValues && !entity && !!entityId && !deletedElsewhere && (status === "existing" || status === "copy")) {
72
+ /**
73
+ * There is no id, so there is no record that could have been missing.
74
+ *
75
+ * The branch below answers "the record this URL names is not there", and
76
+ * with no id nothing is named. Without this it fired on every successful
77
+ * *create*: `EntityFormBinding` sets `status` to `"existing"` the moment a
78
+ * save lands, and the `entityId` prop arrives one render later from the
79
+ * URL, so for one frame the component reported a record with no id as
80
+ * missing — `Entity with id undefined not found in collection posts`,
81
+ * twice under StrictMode, beside a "Saved successfully" toast, with
82
+ * "Entity not found" flashed over the record that had just been created.
83
+ *
84
+ * Written against the id rather than against `status === "existing"`
85
+ * because the same thing is true of a copy in flight, and because "we have
86
+ * nothing to look up" is the actual reason.
87
+ */
88
+ const nothingToLookUp = !hasEntityId(entityId);
89
+ if (!dataLoading && !initialDirtyValues && !entity && !nothingToLookUp && !deletedElsewhere && (status === "existing" || status === "copy")) {
72
90
  console.warn(`Entity with id ${entityId} not found in collection ${props.path}`);
73
91
  return /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsxs("div", {
74
92
  className: "flex flex-col items-center gap-2 text-center",
@@ -202,7 +220,7 @@ function EditViewBindingInner({ path, entityId, selectedTab: selectedTabProp, co
202
220
  * default rendering, and `additionalFields` vanished from the default one.
203
221
  */
204
222
  const readOnlyFormContext = useMemo(() => {
205
- if (!entityId) return void 0;
223
+ if (!hasEntityId(entityId)) return void 0;
206
224
  const formexStub = createFormexStub(usedEntity?.values ?? {});
207
225
  return {
208
226
  entityId,
@@ -242,7 +260,7 @@ function EditViewBindingInner({ path, entityId, selectedTab: selectedTabProp, co
242
260
  console.error("INTERNAL: customView.Builder is not defined or could not be resolved");
243
261
  return null;
244
262
  }
245
- if (!entityId) return null;
263
+ if (!hasEntityId(entityId)) return null;
246
264
  const isActive = activeTab === customView.key;
247
265
  const hasBeenMounted = mountedTabsRef.current.has(customView.key);
248
266
  if (!isActive && !hasBeenMounted) return null;
@@ -592,7 +610,7 @@ function EditViewBindingInner({ path, entityId, selectedTab: selectedTabProp, co
592
610
  * stays in view while a long form scrolls.
593
611
  */
594
612
  const actionsInFooter = layout === "dialog";
595
- const fullScreenButton = !barActions && (layout === "side_panel" || layout === "dialog") && entityId ? /* @__PURE__ */ jsx(Tooltip, {
613
+ const fullScreenButton = !barActions && (layout === "side_panel" || layout === "dialog") && hasEntityId(entityId) ? /* @__PURE__ */ jsx(Tooltip, {
596
614
  title: "Open full screen",
597
615
  children: /* @__PURE__ */ jsx(IconButton, {
598
616
  "aria-label": "Open full screen",