@rebasepro/admin 0.3.0 → 0.5.0

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 (106) hide show
  1. package/README.md +135 -0
  2. package/dist/{CollectionEditorDialog-D0VqpLPO.js → CollectionEditorDialog-C8E440oK.js} +22 -5
  3. package/dist/CollectionEditorDialog-C8E440oK.js.map +1 -0
  4. package/dist/{CollectionsStudioView-Bc3Rxxc2.js → CollectionsStudioView-Brr_b06v.js} +4 -4
  5. package/dist/{CollectionsStudioView-Bc3Rxxc2.js.map → CollectionsStudioView-Brr_b06v.js.map} +1 -1
  6. package/dist/{ExportCollectionAction-Ckc-09BQ.js → ExportCollectionAction-D3TTYXrq.js} +35 -27
  7. package/dist/ExportCollectionAction-D3TTYXrq.js.map +1 -0
  8. package/dist/{ImportCollectionAction-BqjIrC3Z.js → ImportCollectionAction-Dn7lya6E.js} +2 -2
  9. package/dist/{ImportCollectionAction-BqjIrC3Z.js.map → ImportCollectionAction-Dn7lya6E.js.map} +1 -1
  10. package/dist/{PropertyEditView-CvRSV-A2.js → PropertyEditView-ChBleIbN.js} +4 -4
  11. package/dist/PropertyEditView-ChBleIbN.js.map +1 -0
  12. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +1 -0
  13. package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +1 -1
  14. package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +1 -1
  15. package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +1 -1
  16. package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +1 -1
  17. package/dist/collection_editor_ui.js +3 -3
  18. package/dist/components/CollectionPanel.d.ts +83 -0
  19. package/dist/components/EntityDetailView.d.ts +0 -3
  20. package/dist/components/EntityEditView.d.ts +2 -3
  21. package/dist/components/RebaseRouteDefs.d.ts +1 -1
  22. package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
  23. package/dist/components/SelectableTable/SelectableTableContext.d.ts +1 -1
  24. package/dist/components/SelectableTable/SelectionStore.d.ts +3 -3
  25. package/dist/components/admin/index.d.ts +1 -3
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/editor.js +15 -5
  28. package/dist/editor.js.map +1 -1
  29. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +1 -1
  30. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -5
  31. package/dist/{index-BCcLwgfe.js → index-D3S9x_RP.js} +2 -2
  32. package/dist/{index-BCcLwgfe.js.map → index-D3S9x_RP.js.map} +1 -1
  33. package/dist/{index-DY2k5TtG.js → index-D9RNzm01.js} +3 -3
  34. package/dist/index-D9RNzm01.js.map +1 -0
  35. package/dist/{index-UQOMHwt1.js → index-DrrT332R.js} +3 -3
  36. package/dist/index-DrrT332R.js.map +1 -0
  37. package/dist/index.d.ts +2 -4
  38. package/dist/index.js +228 -295
  39. package/dist/index.js.map +1 -1
  40. package/dist/util/entity_view_constants.d.ts +6 -0
  41. package/dist/util/resolutions.d.ts +1 -2
  42. package/dist/{util-ZM9gQuCv.js → util-COYYD8zr.js} +473 -880
  43. package/dist/util-COYYD8zr.js.map +1 -0
  44. package/package.json +9 -10
  45. package/src/collection_editor/pgColumnToProperty.ts +19 -2
  46. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +2 -2
  47. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +2 -1
  48. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +2 -2
  49. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +2 -1
  50. package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +1 -1
  51. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
  52. package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +1 -1
  53. package/src/collection_editor/ui/collection_editor/templates/products_template.ts +1 -1
  54. package/src/collection_editor/ui/collection_editor/templates/users_template.ts +1 -1
  55. package/src/collection_editor/validateCollectionJson.ts +12 -12
  56. package/src/components/CollectionPanel.tsx +155 -0
  57. package/src/components/DefaultDrawer.tsx +2 -2
  58. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +5 -2
  59. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +64 -34
  60. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +8 -1
  61. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -1
  62. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -0
  63. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +68 -18
  64. package/src/components/EntityDetailView.tsx +32 -36
  65. package/src/components/EntityEditView.tsx +101 -50
  66. package/src/components/EntityEditViewFormActions.tsx +4 -4
  67. package/src/components/EntitySidePanel.tsx +50 -14
  68. package/src/components/PropertyCollectionView.tsx +1 -0
  69. package/src/components/RebaseRouteDefs.tsx +4 -6
  70. package/src/components/SelectableTable/SelectableTable.tsx +24 -22
  71. package/src/components/SelectableTable/SelectableTableContext.tsx +2 -1
  72. package/src/components/SelectableTable/SelectionStore.ts +4 -4
  73. package/src/components/admin/index.ts +1 -3
  74. package/src/components/index.ts +3 -3
  75. package/src/data_export/export/BasicExportAction.tsx +11 -9
  76. package/src/data_export/export/ExportCollectionAction.tsx +15 -13
  77. package/src/editor/editor.tsx +20 -4
  78. package/src/form/EntityForm.tsx +3 -3
  79. package/src/form/PropertyFieldBinding.tsx +1 -1
  80. package/src/form/field_bindings/KeyValueFieldBinding.tsx +1 -1
  81. package/src/form/field_bindings/MapFieldBinding.tsx +3 -45
  82. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +3 -1
  83. package/src/hooks/navigation/useBuildNavigationStateController.tsx +2 -3
  84. package/src/hooks/navigation/useResolvedCollections.ts +2 -10
  85. package/src/hooks/navigation/useResolvedViews.tsx +6 -48
  86. package/src/hooks/useBuildSideEntityController.tsx +20 -3
  87. package/src/index.ts +6 -5
  88. package/src/util/entity_view_constants.ts +6 -0
  89. package/src/util/previews.ts +9 -1
  90. package/src/util/resolutions.ts +2 -6
  91. package/dist/CollectionEditorDialog-D0VqpLPO.js.map +0 -1
  92. package/dist/ExportCollectionAction-Ckc-09BQ.js.map +0 -1
  93. package/dist/PropertyEditView-CvRSV-A2.js.map +0 -1
  94. package/dist/components/admin/RoleChip.d.ts +0 -4
  95. package/dist/components/admin/RolesFilterSelect.d.ts +0 -2
  96. package/dist/components/admin/RolesView.d.ts +0 -4
  97. package/dist/components/admin/UserRolesSelectField.d.ts +0 -2
  98. package/dist/components/admin/UsersView.d.ts +0 -4
  99. package/dist/index-DY2k5TtG.js.map +0 -1
  100. package/dist/index-UQOMHwt1.js.map +0 -1
  101. package/dist/util-ZM9gQuCv.js.map +0 -1
  102. package/src/components/admin/RoleChip.tsx +0 -23
  103. package/src/components/admin/RolesFilterSelect.tsx +0 -45
  104. package/src/components/admin/RolesView.tsx +0 -470
  105. package/src/components/admin/UserRolesSelectField.tsx +0 -50
  106. package/src/components/admin/UsersView.tsx +0 -693
@@ -1,15 +1,15 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { DialogActions, Typography, IconButton, Button, AlertCircleIcon, LoadingButton, cls, defaultBorderMixin, Tooltip, CopyIcon, ImageOffIcon, ExternalLinkIcon, FileTextIcon, Skeleton, Table, TableBody, TableRow, TableCell, Chip, getColorSchemeForSeed, ErrorBoundary, FunctionSquareIcon, iconSize, CircleIcon, HashIcon, LinkIcon, Rows3Icon, UploadIcon, RepeatIcon, VoteIcon, CalendarIcon, FlagIcon, GlobeIcon, MailIcon, AlignLeftIcon, TextIcon, ArrowRightToLineIcon, HistoryIcon, CircularProgressCenter, Tab, Maximize2Icon, PencilIcon, Alert, Tabs, CodeIcon, CenteredView, useDebouncedCallback, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, TextField, BooleanSwitch, DateTimeField, useInjectStyles, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, XIcon, PopoverPrimitive, SearchIcon, CircularProgress, ChevronDownIcon, Separator, paperMixin, CheckIcon, Menu, MenuItem, MoreVerticalIcon, Checkbox, Badge, SearchBar, Label, BooleanSwitchWithLabel, useOutsideAlerter, VirtualTable, getColorSchemeForKey, Container, PlusIcon, TableHeader, Trash2Icon, Dialog, DialogTitle, DialogContent, Sheet, debounce, coolIconKeys, lucideIcons, ExpandablePanel, HandleIcon, MinusIcon, ChevronUpIcon, Collapse, EyeOffIcon, EyeIcon, FolderUpIcon, ListOrderedIcon, UserIcon, ListIcon, QuoteIcon, FileUpload, ChevronRightIcon, SettingsIcon, Popover, CHIP_COLORS, Card, ResizablePanels, Markdown, RefreshCwIcon, TableIcon, LayoutGridIcon, KanbanIcon, ToggleButtonGroup, ColumnsIcon, CheckCircleIcon, KeyRoundIcon, Portal, FilterXIcon, FilterChip, ChevronsUpDownIcon, ArrowLeftIcon, FilterIcon, MoonIcon, SunIcon, SunMoonIcon, LogOutIcon, Avatar, ChevronsLeftIcon, ChevronsRightIcon, MenuIcon, ArrowRightIcon, AlertTriangleIcon, XCircleIcon } from "@rebasepro/ui";
3
+ import { DialogActions, Typography, IconButton, Button, AlertCircleIcon, LoadingButton, cls, defaultBorderMixin, Tooltip, CopyIcon, ImageOffIcon, ExternalLinkIcon, FileTextIcon, Skeleton, Table, TableBody, TableRow, TableCell, Chip, getColorSchemeForSeed, ErrorBoundary, FunctionSquareIcon, iconSize, CircleIcon, HashIcon, LinkIcon, Rows3Icon, UploadIcon, RepeatIcon, VoteIcon, CalendarIcon, FlagIcon, GlobeIcon, MailIcon, AlignLeftIcon, TextIcon, ArrowRightToLineIcon, HistoryIcon, CircularProgressCenter, Tab, Maximize2Icon, PencilIcon, Alert, Tabs, CodeIcon, CenteredView, useDebouncedCallback, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, TextField, BooleanSwitch, DateTimeField, useInjectStyles, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, XIcon, PopoverPrimitive, SearchIcon, CircularProgress, ChevronDownIcon, Separator, paperMixin, CheckIcon, Menu, MenuItem, MoreVerticalIcon, Checkbox, Badge, SearchBar, Label, BooleanSwitchWithLabel, useOutsideAlerter, VirtualTable, Dialog, Sheet, PlusIcon, debounce, coolIconKeys, lucideIcons, ExpandablePanel, HandleIcon, MinusIcon, ChevronUpIcon, Collapse, EyeOffIcon, EyeIcon, Trash2Icon, FolderUpIcon, ListOrderedIcon, UserIcon, ListIcon, QuoteIcon, FileUpload, ChevronRightIcon, TableHeader, SettingsIcon, Popover, CHIP_COLORS, Card, ResizablePanels, getColorSchemeForKey, Markdown, RefreshCwIcon, DialogContent, TableIcon, LayoutGridIcon, KanbanIcon, ToggleButtonGroup, ColumnsIcon, DialogTitle, CheckCircleIcon, KeyRoundIcon, Portal, FilterXIcon, FilterChip, ChevronsUpDownIcon, ArrowLeftIcon, FilterIcon, MoonIcon, SunIcon, SunMoonIcon, LogOutIcon, Avatar, ChevronsLeftIcon, ChevronsRightIcon, MenuIcon, ArrowRightIcon, AlertTriangleIcon, XCircleIcon } from "@rebasepro/ui";
4
4
  import * as React from "react";
5
5
  import React__default, { useRef, useEffect, useState, useMemo, lazy, Suspense, useCallback, useSyncExternalStore, useContext, createContext, forwardRef, memo, useLayoutEffect, createElement } from "react";
6
- import { useTranslation, useStorageSource, ErrorView, buildEnumLabel, getColorScheme, useAuthController, useCustomizationController, useAnalyticsController, IconForView, useEntityFetch, useModeController, useRebaseContext, usePermissions, createFormexStub, useSlot, resolveComponentRef, getIcon, PluginProviderStack, useUserSelector, UserDisplay, useSnackbarController, ErrorTooltip, useStorageUploadController, useData, useRelationSelector, getRowHeight, getEntityFromCache, useLargeLayout, getColumnKeysForProperty, DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE$1, getEntityFromMemoryCache, saveEntityToMemoryCache, CONTAINER_FULL_WIDTH, ADDITIONAL_TAB_WIDTH, FORM_CONTAINER_WIDTH, useInternalUserManagementController, ConfirmationDialog, useUnsavedChangesDialog, UnsavedChangesDialog, useColumnIds, useDataTableController, saveEntityWithCallbacks, iconsSearch, deleteEntityWithCallbacks, useUserConfigurationPersistence, useScrollRestoration, useBridgeRegistration, useAdminModeController, RebaseLogo, LanguageToggle, useRebaseRegistry, buildCollapsedDefaults, useCollapsedGroups, useBuildLocalConfigurationPersistence, useRebaseClient, CustomizationControllerContext, StudioBridgeRegistryProvider, flattenKeys, removeEntityFromCache, saveEntityToCache, removeEntityFromMemoryCache, getFormFieldKeys } from "@rebasepro/core";
6
+ import { useTranslation, useStorageSource, ErrorView, buildEnumLabel, getColorScheme, useAuthController, useCustomizationController, useAnalyticsController, IconForView, useEntityFetch, useModeController, useRebaseContext, usePermissions, createFormexStub, useSlot, resolveComponentRef, getIcon, PluginProviderStack, useUserSelector, UserDisplay, useSnackbarController, ErrorTooltip, useStorageUploadController, useData, useRelationSelector, getRowHeight, getEntityFromCache, useLargeLayout, getColumnKeysForProperty, DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE$1, getEntityFromMemoryCache, saveEntityToMemoryCache, CONTAINER_FULL_WIDTH, ADDITIONAL_TAB_WIDTH, FORM_CONTAINER_WIDTH, useUnsavedChangesDialog, UnsavedChangesDialog, useColumnIds, useDataTableController, saveEntityWithCallbacks, iconsSearch, deleteEntityWithCallbacks, useInternalUserManagementController, ConfirmationDialog, useUserConfigurationPersistence, useScrollRestoration, useBridgeRegistration, useAdminModeController, RebaseLogo, LanguageToggle, useRebaseRegistry, buildCollapsedDefaults, useCollapsedGroups, useBuildLocalConfigurationPersistence, useRebaseClient, CustomizationControllerContext, StudioBridgeRegistryProvider, flattenKeys, removeEntityFromCache, saveEntityToCache, removeEntityFromMemoryCache, getFormFieldKeys } from "@rebasepro/core";
7
7
  import ExcelJS from "exceljs";
8
- import { isPropertyBuilder, enumToObjectEntries, getLabelOrConfigFrom, resolveArrayProperties, getEntityImagePreviewPropertyKey, resolveDefaultSelectedView, getSubcollections, removeInitialAndTrailingSlashes, resolveEnumValues, getReferenceFrom, normalizeToEntityRelation, getRelationFrom, isReadOnly, getLocalChangesBackup, getNavigationEntriesFromPath, CollectionRegistry, getParentReferencesFromPath, canReadCollection, defaultUsersCollection, resolveCollectionPathIds, resolveProperty, isHidden, getArrayResolvedProperties, DEFAULT_ONE_OF_VALUE, getDefaultValueFor, DEFAULT_ONE_OF_TYPE, getDefaultValueFortype, resolveStorageFilenameString, resolveStoragePathString, resolveRelationProperty, getTableName, getDefaultValuesFor } from "@rebasepro/common";
9
- import { EntityRelation, EntityReference, getDataSourceCapabilities, GeoPoint, Vector } from "@rebasepro/types";
8
+ import { isPropertyBuilder, enumToObjectEntries, getLabelOrConfigFrom, resolveArrayProperties, getEntityImagePreviewPropertyKey, resolveDefaultSelectedView, getSubcollections, removeInitialAndTrailingSlashes, resolveEnumValues, getReferenceFrom, normalizeToEntityRelation, getRelationFrom, isReadOnly, getLocalChangesBackup, getNavigationEntriesFromPath, CollectionRegistry, getParentReferencesFromPath, canReadCollection, resolveCollectionPathIds, resolveProperty, isHidden, getArrayResolvedProperties, DEFAULT_ONE_OF_VALUE, getDefaultValueFor, DEFAULT_ONE_OF_TYPE, getDefaultValueFortype, resolveStorageFilenameString, resolveStoragePathString, resolveRelationProperty, getTableName, getDefaultValuesFor } from "@rebasepro/common";
9
+ import { EntityRelation, EntityReference, GeoPoint, getDataSourceCapabilities, Vector } from "@rebasepro/types";
10
10
  import { useFormex, setIn, Field, getIn, useCreateFormex, Formex } from "@rebasepro/formex";
11
11
  import { inferTypeFromValue } from "@rebasepro/schema-inference";
12
- import { hydrateRegExp, getValueInPath, mergeDeep, getHashValue, pick, randomString, toArray, defaultDateFormat, isObject } from "@rebasepro/utils";
12
+ import { hydrateRegExp, getValueInPath, mergeDeep, getHashValue, randomString, toArray, defaultDateFormat, isObject } from "@rebasepro/utils";
13
13
  import { deepEqual as deepEqual$1 } from "fast-equals";
14
14
  import { z } from "zod";
15
15
  import { useSensor, PointerSensor, KeyboardSensor, useSensors, DndContext, closestCenter, useDroppable, DragOverlay, pointerWithin, rectIntersection } from "@dnd-kit/core";
@@ -1951,6 +1951,10 @@ function getDefaultPropertiesOrder(collection) {
1951
1951
  if (collection.propertiesOrder) return collection.propertiesOrder;
1952
1952
  return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map((field) => field.key)];
1953
1953
  }
1954
+ function isHiddenProperty(property) {
1955
+ if (!property) return false;
1956
+ return Boolean(property.ui?.hideFromCollection);
1957
+ }
1954
1958
  function getEntityPreviewKeys(authController, targetCollection, fields, previewProperties, limit = 3) {
1955
1959
  const allProperties = Object.keys(targetCollection.properties);
1956
1960
  let listProperties = previewProperties?.filter((p) => allProperties.includes(p));
@@ -1967,7 +1971,7 @@ function getEntityPreviewKeys(authController, targetCollection, fields, previewP
1967
1971
  return !isIdProp;
1968
1972
  }).filter((key) => {
1969
1973
  const property = targetCollection.properties[key];
1970
- return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property);
1974
+ return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property) && !isHiddenProperty(property);
1971
1975
  }).slice(0, limit);
1972
1976
  }
1973
1977
  }
@@ -1981,6 +1985,9 @@ function getEntityTitlePropertyKey(collection, propertyConfigs) {
1981
1985
  const property = collection.properties[key];
1982
1986
  if (property && !isPropertyBuilder(property)) {
1983
1987
  const prop = property;
1988
+ if (isHiddenProperty(prop)) {
1989
+ continue;
1990
+ }
1984
1991
  if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
1985
1992
  if (!firstStringCandidate) {
1986
1993
  firstStringCandidate = key;
@@ -2612,9 +2619,6 @@ function EntityView(t0) {
2612
2619
  }
2613
2620
  return t8;
2614
2621
  }
2615
- const EntityHistoryView$2 = lazy(() => import("./index-BCcLwgfe.js").then((m) => ({
2616
- default: m.EntityHistoryView
2617
- })));
2618
2622
  const BUILTIN_ENTITY_VIEWS = {
2619
2623
  "__rebase_history": {
2620
2624
  key: "__rebase_history",
@@ -2622,7 +2626,6 @@ const BUILTIN_ENTITY_VIEWS = {
2622
2626
  tabComponent: React__default.createElement(HistoryIcon, {
2623
2627
  size: 20
2624
2628
  }),
2625
- Builder: EntityHistoryView$2,
2626
2629
  position: "end"
2627
2630
  }
2628
2631
  };
@@ -2702,12 +2705,12 @@ function EntityJsonPreview(t0) {
2702
2705
  }
2703
2706
  return t4;
2704
2707
  }
2705
- const EntityHistoryView$1 = lazy(() => import("./index-BCcLwgfe.js").then((m) => ({
2708
+ const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
2709
+ const JSON_TAB_VALUE = "__json";
2710
+ const HISTORY_TAB_VALUE = "__rebase_history";
2711
+ const EntityHistoryView$1 = lazy(() => import("./index-D3S9x_RP.js").then((m) => ({
2706
2712
  default: m.EntityHistoryView
2707
2713
  })));
2708
- const MAIN_TAB_VALUE$1 = "__main_##Q$SC^#S6";
2709
- const JSON_TAB_VALUE$1 = "__json";
2710
- const HISTORY_TAB_VALUE$1 = "__rebase_history";
2711
2714
  function EntityDetailView(t0) {
2712
2715
  const $ = c(15);
2713
2716
  let entityId;
@@ -2815,9 +2818,14 @@ function EntityDetailViewInner({
2815
2818
  status: "existing",
2816
2819
  entityId
2817
2820
  }), [collection, entityId]);
2818
- const [selectedTab, setSelectedTab] = useState(selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE$1);
2821
+ const userHasChangedTab = useRef(false);
2822
+ const [selectedTab, setSelectedTab] = useState(() => {
2823
+ const val = selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;
2824
+ return val === "edit" ? MAIN_TAB_VALUE : val;
2825
+ });
2819
2826
  useEffect(() => {
2820
- const target = selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE$1;
2827
+ const val_0 = userHasChangedTab.current ? selectedTabProp ?? MAIN_TAB_VALUE : selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;
2828
+ const target = val_0 === "edit" ? MAIN_TAB_VALUE : val_0;
2821
2829
  if (target !== selectedTab) {
2822
2830
  setSelectedTab(target);
2823
2831
  }
@@ -2832,7 +2840,7 @@ function EntityDetailViewInner({
2832
2840
  const {
2833
2841
  resolvedEntityViews
2834
2842
  } = resolvedSelectedEntityView(customViews, customizationController, selectedTab);
2835
- const mainViewVisible = selectedTab === MAIN_TAB_VALUE$1;
2843
+ const mainViewVisible = selectedTab === MAIN_TAB_VALUE;
2836
2844
  const mountedTabsRef = useRef(/* @__PURE__ */ new Set());
2837
2845
  if (selectedTab) {
2838
2846
  mountedTabsRef.current.add(selectedTab);
@@ -2873,7 +2881,8 @@ function EntityDetailViewInner({
2873
2881
  disabled: true
2874
2882
  }), [entityId, parentCollectionSlugs, parentEntityIds, path, collection, context, readOnlyFormContext, layout]);
2875
2883
  const pluginActionsTop = useSlot("form.actions.top", formActionTopProps);
2876
- const detailViewConfig = collection.detailView;
2884
+ const formViewConfig = collection.formView;
2885
+ const FormViewBuilder = formViewConfig?.Builder ? resolveComponentRef(formViewConfig.Builder) : null;
2877
2886
  const titlePropertyKey = getEntityTitlePropertyKey(collection, customizationController.propertyConfigs);
2878
2887
  const title = (usedEntity?.values && titlePropertyKey ? getValueInPath(usedEntity.values, titlePropertyKey) : void 0) ?? collection.singularName ?? collection.name;
2879
2888
  const nonActionCustomViews = useMemo(() => resolvedEntityViews.filter((e) => !e.includeActions), [resolvedEntityViews]);
@@ -2890,11 +2899,11 @@ function EntityDetailViewInner({
2890
2899
  }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: readOnlyFormContext && /* @__PURE__ */ jsx(Builder, { collection, parentCollectionSlugs, parentEntityIds, entity: usedEntity, modifiedValues: usedEntity?.values, formContext: readOnlyFormContext }) }) }) }, `custom_view_${customView.key}`);
2891
2900
  }).filter(Boolean);
2892
2901
  const globalLoading = dataLoading && !usedEntity;
2893
- const jsonTabMounted = mountedTabsRef.current.has(JSON_TAB_VALUE$1);
2894
- const jsonView = selectedTab === JSON_TAB_VALUE$1 || jsonTabMounted ? /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
2895
- "hidden": selectedTab !== JSON_TAB_VALUE$1
2902
+ const jsonTabMounted = mountedTabsRef.current.has(JSON_TAB_VALUE);
2903
+ const jsonView = selectedTab === JSON_TAB_VALUE || jsonTabMounted ? /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
2904
+ "hidden": selectedTab !== JSON_TAB_VALUE
2896
2905
  }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(EntityJsonPreview, { values: usedEntity?.values ?? {} }) }) }, "json_view") : null;
2897
- const historyView = includeHistoryView && selectedTab === HISTORY_TAB_VALUE$1 ? /* @__PURE__ */ jsx("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: /* @__PURE__ */ jsx(EntityHistoryView$1, { collection, entity: usedEntity, formContext: readOnlyFormContext, modifiedValues: usedEntity?.values }) }) }) }, "history_view") : null;
2906
+ const historyView = includeHistoryView && selectedTab === HISTORY_TAB_VALUE ? /* @__PURE__ */ jsx("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: /* @__PURE__ */ jsx(EntityHistoryView$1, { collection, entity: usedEntity, formContext: readOnlyFormContext, modifiedValues: usedEntity?.values }) }) }) }, "history_view") : null;
2898
2907
  const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
2899
2908
  const subcollectionId = subcollection.slug;
2900
2909
  const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.slug)}` : void 0;
@@ -2905,31 +2914,20 @@ function EntityDetailViewInner({
2905
2914
  ] }, `subcol_${subcollectionId}`);
2906
2915
  }).filter(Boolean);
2907
2916
  const onSideTabClick = useCallback((value) => {
2917
+ userHasChangedTab.current = true;
2908
2918
  setSelectedTab(value);
2909
2919
  onTabChange?.({
2910
2920
  path,
2911
2921
  entityId,
2912
- selectedTab: value === MAIN_TAB_VALUE$1 ? void 0 : value,
2922
+ selectedTab: value === MAIN_TAB_VALUE ? void 0 : value,
2913
2923
  collection
2914
2924
  });
2915
2925
  }, [onTabChange, path, entityId, collection]);
2916
2926
  const propertyDetailView = () => {
2917
- if (detailViewConfig?.Builder) {
2918
- const CustomBuilder = resolveComponentRef(detailViewConfig.Builder);
2919
- if (CustomBuilder && usedEntity) {
2920
- return /* @__PURE__ */ jsx(CustomBuilder, { collection, entity: usedEntity, path, onEditClick: onEditClick ?? (() => {
2921
- }) });
2922
- }
2927
+ if (FormViewBuilder && usedEntity) {
2928
+ return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: /* @__PURE__ */ jsx(FormViewBuilder, { collection, parentCollectionSlugs, parentEntityIds, entity: usedEntity, modifiedValues: usedEntity?.values, formContext: readOnlyFormContext }) }) });
2923
2929
  }
2924
- const HeaderComponent = detailViewConfig?.Header ? resolveComponentRef(detailViewConfig.Header) : null;
2925
- const FooterComponent = detailViewConfig?.Footer ? resolveComponentRef(detailViewConfig.Footer) : null;
2926
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2927
- HeaderComponent && usedEntity && /* @__PURE__ */ jsx(HeaderComponent, { collection, entity: usedEntity, path, onEditClick: onEditClick ?? (() => {
2928
- }) }),
2929
- usedEntity && /* @__PURE__ */ jsx(EntityView, { entity: usedEntity, collection, path }),
2930
- FooterComponent && usedEntity && /* @__PURE__ */ jsx(FooterComponent, { collection, entity: usedEntity, path, onEditClick: onEditClick ?? (() => {
2931
- }) })
2932
- ] });
2930
+ return /* @__PURE__ */ jsx(Fragment, { children: usedEntity && /* @__PURE__ */ jsx(EntityView, { entity: usedEntity, collection, path }) });
2933
2931
  };
2934
2932
  const subcollectionTabs = subcollections && subcollections.map((subcollection_0) => {
2935
2933
  const icon = getIcon(subcollection_0.icon, void 0, void 0, "small");
@@ -2989,9 +2987,9 @@ function EntityDetailViewInner({
2989
2987
  hasAdditionalViews && /* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end min-w-0 shrink-0", children: /* @__PURE__ */ jsxs(Tabs, { className: "!w-fit max-w-full", value: selectedTab, onValueChange: (value_0) => {
2990
2988
  onSideTabClick(value_0);
2991
2989
  }, children: [
2992
- includeJsonView && /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: JSON_TAB_VALUE$1, className: "text-sm", children: /* @__PURE__ */ jsx(CodeIcon, { size: iconSize.small }) }),
2993
- includeHistoryView && /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: HISTORY_TAB_VALUE$1, className: "text-sm", children: /* @__PURE__ */ jsx(HistoryIcon, { size: iconSize.small }) }),
2994
- /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: MAIN_TAB_VALUE$1, className: "text-sm min-w-[90px]", children: collection.singularName ?? collection.name }),
2990
+ includeJsonView && /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: JSON_TAB_VALUE, className: "text-sm", children: /* @__PURE__ */ jsx(CodeIcon, { size: iconSize.small }) }),
2991
+ includeHistoryView && /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: HISTORY_TAB_VALUE, className: "text-sm", children: /* @__PURE__ */ jsx(HistoryIcon, { size: iconSize.small }) }),
2992
+ /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: MAIN_TAB_VALUE, className: "text-sm min-w-[90px]", children: collection.singularName ?? collection.name }),
2995
2993
  customViewTabsStart,
2996
2994
  customViewTabsEnd,
2997
2995
  subcollectionTabs
@@ -7903,17 +7901,19 @@ const SelectableTable = function SelectableTable2({
7903
7901
  };
7904
7902
  }, [unselect]);
7905
7903
  const onFilterUpdate = useCallback((updatedFilterValues) => {
7906
- setFilterValues?.({
7907
- ...updatedFilterValues,
7908
- ...fixedFilter
7909
- });
7910
- }, [fixedFilter]);
7904
+ if (setFilterValues) {
7905
+ setFilterValues({
7906
+ ...updatedFilterValues,
7907
+ ...fixedFilter
7908
+ });
7909
+ }
7910
+ }, [fixedFilter, setFilterValues]);
7911
7911
  const contextValue = useMemo(() => ({
7912
- setPopupCell,
7913
7912
  select,
7914
7913
  onValueChange,
7915
7914
  size: size ?? "m",
7916
- selectionStore
7915
+ selectionStore,
7916
+ setPopupCell
7917
7917
  }), [setPopupCell, select, onValueChange, size, selectionStore]);
7918
7918
  return /* @__PURE__ */ jsx(SelectableTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full flex flex-col bg-white dark:bg-surface-900", ref, children: /* @__PURE__ */ jsx(
7919
7919
  VirtualTable,
@@ -8322,7 +8322,7 @@ function buildBottomActions({
8322
8322
  const canClose = openEntityMode === "side_panel" || openEntityMode === "dialog";
8323
8323
  return /* @__PURE__ */ jsxs(DialogActions, { className, position: "absolute", children: [
8324
8324
  savingError && /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx(Typography, { color: "error", children: savingError.message }) }),
8325
- formActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "grow flex overflow-auto no-scrollbar", children: formActions.map((action) => {
8325
+ formActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "grow flex overflow-auto no-scrollbar", children: formActions.map((action, index) => {
8326
8326
  const props = {
8327
8327
  view: "form",
8328
8328
  entity,
@@ -8335,7 +8335,7 @@ function buildBottomActions({
8335
8335
  formContext
8336
8336
  };
8337
8337
  const isEnabled = !action.isEnabled || action.isEnabled(props);
8338
- return /* @__PURE__ */ jsx(EntityActionButton, { action, enabled: isEnabled, props }, action.key);
8338
+ return /* @__PURE__ */ jsx(EntityActionButton, { action, enabled: isEnabled, props }, action.key ?? action.name ?? index);
8339
8339
  }) }),
8340
8340
  pluginActions,
8341
8341
  hasErrors ? /* @__PURE__ */ jsx(ErrorTooltip, { title: "This form has errors", children: /* @__PURE__ */ jsx(AlertCircleIcon, { className: "ml-4 text-red-500", size: iconSize.smallest }) }) : null,
@@ -8387,7 +8387,7 @@ function buildSideActions({
8387
8387
  /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "text", disabled: disabled || formex.isSubmitting, type: "reset", children: status === "existing" ? t("discard") : t("clear") }),
8388
8388
  collection.defaultEntityAction === "view" && status === "existing" && /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "text", disabled, onClick: navigateBack, children: t("back_to_detail") ?? "Back to details" }),
8389
8389
  pluginActions,
8390
- formActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-row flex-wrap mt-2", children: formActions.map((action) => {
8390
+ formActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-row flex-wrap mt-2", children: formActions.map((action, index) => {
8391
8391
  const props = {
8392
8392
  view: "form",
8393
8393
  entity,
@@ -8400,7 +8400,7 @@ function buildSideActions({
8400
8400
  formContext
8401
8401
  };
8402
8402
  const isEnabled = !action.isEnabled || action.isEnabled(props);
8403
- return /* @__PURE__ */ jsx(EntityActionButton, { action, enabled: isEnabled, props }, action.key);
8403
+ return /* @__PURE__ */ jsx(EntityActionButton, { action, enabled: isEnabled, props }, action.key ?? action.name ?? index);
8404
8404
  }) }),
8405
8405
  savingError && /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx(Typography, { color: "error", children: savingError.message }) })
8406
8406
  ] });
@@ -8485,12 +8485,9 @@ function EntityActionButton(t0) {
8485
8485
  }
8486
8486
  return t5;
8487
8487
  }
8488
- const EntityHistoryView = lazy(() => import("./index-BCcLwgfe.js").then((m) => ({
8488
+ const EntityHistoryView = lazy(() => import("./index-D3S9x_RP.js").then((m) => ({
8489
8489
  default: m.EntityHistoryView
8490
8490
  })));
8491
- const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
8492
- const JSON_TAB_VALUE = "__json";
8493
- const HISTORY_TAB_VALUE = "__rebase_history";
8494
8491
  function EntityEditView(t0) {
8495
8492
  const $ = c(28);
8496
8493
  let entityId;
@@ -8651,9 +8648,14 @@ function EntityEditViewInner({
8651
8648
  status,
8652
8649
  entityId
8653
8650
  }), [collection, status, entityId]);
8654
- const [selectedTab, setSelectedTab] = useState(selectedTabProp === "edit" ? MAIN_TAB_VALUE : selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE);
8651
+ const userHasChangedTab = useRef(false);
8652
+ const [selectedTab, setSelectedTab] = useState(() => {
8653
+ const val = selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;
8654
+ return val === "edit" ? MAIN_TAB_VALUE : val;
8655
+ });
8655
8656
  useEffect(() => {
8656
- const target = selectedTabProp === "edit" ? MAIN_TAB_VALUE : selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;
8657
+ const val_0 = userHasChangedTab.current ? selectedTabProp ?? MAIN_TAB_VALUE : selectedTabProp ?? defaultSelectedView ?? MAIN_TAB_VALUE;
8658
+ const target = val_0 === "edit" ? MAIN_TAB_VALUE : val_0;
8657
8659
  if (target !== selectedTab) {
8658
8660
  setSelectedTab(target);
8659
8661
  }
@@ -8683,6 +8685,7 @@ function EntityEditViewInner({
8683
8685
  return {
8684
8686
  entityId,
8685
8687
  disabled: false,
8688
+ readOnly: true,
8686
8689
  openEntityMode: layout,
8687
8690
  status,
8688
8691
  values: usedEntity?.values ?? {},
@@ -8736,6 +8739,7 @@ function EntityEditViewInner({
8736
8739
  ] }, `subcol_${subcollectionId}`);
8737
8740
  }).filter(Boolean);
8738
8741
  const onSideTabClick = useCallback((value_0) => {
8742
+ userHasChangedTab.current = true;
8739
8743
  setSelectedTab(value_0);
8740
8744
  if (status === "existing") {
8741
8745
  onTabChange?.({
@@ -8746,12 +8750,18 @@ function EntityEditViewInner({
8746
8750
  });
8747
8751
  }
8748
8752
  }, [status, onTabChange, path, entityId, collection]);
8753
+ const formViewConfig = collection.formView;
8754
+ const FormViewBuilder = formViewConfig?.Builder ? resolveComponentRef(formViewConfig.Builder) : null;
8755
+ formViewConfig?.includeActions !== false;
8749
8756
  const entityReadOnlyView = !canEdit && entity ? /* @__PURE__ */ jsx("div", { className: cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", canEdit || !mainViewVisible || selectedSecondaryForm ? "hidden" : ""), children: /* @__PURE__ */ jsxs("div", { className: cls("relative flex flex-col max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: [
8750
8757
  /* @__PURE__ */ jsx(Typography, { className: "mt-16 mb-8 mx-8", variant: "h4", children: collection.singularName ?? collection.name }),
8751
- /* @__PURE__ */ jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
8758
+ FormViewBuilder && readOnlyFormContext ? /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: /* @__PURE__ */ jsx(FormViewBuilder, { collection, parentCollectionSlugs, parentEntityIds, entity: usedEntity, modifiedValues: usedEntity?.values, formContext: readOnlyFormContext }) }) }) : /* @__PURE__ */ jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
8752
8759
  /* @__PURE__ */ jsx("div", { className: "h-16" })
8753
8760
  ] }) }) : null;
8754
- const entityView = /* @__PURE__ */ jsx(EntityForm, { collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, navigateBack, ...formProps, onEntityChange: (entity_0) => {
8761
+ const entityView = FormViewBuilder ? (
8762
+ // formView.Builder replaces the default form
8763
+ /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 w-full h-full overflow-auto", (!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : ""), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: (formContext ?? readOnlyFormContext) && /* @__PURE__ */ jsx(FormViewBuilder, { collection, parentCollectionSlugs, parentEntityIds, entity: usedEntity, modifiedValues: (formContext ?? readOnlyFormContext)?.formex?.values ?? usedEntity?.values, formContext: formContext ?? readOnlyFormContext }) }) }) })
8764
+ ) : /* @__PURE__ */ jsx(EntityForm, { collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, navigateBack, ...formProps, onEntityChange: (entity_0) => {
8755
8765
  setUsedEntity(entity_0);
8756
8766
  formProps?.onEntityChange?.(entity_0);
8757
8767
  }, onStatusChange: (status_0) => {
@@ -8945,7 +8955,6 @@ function EntitySidePanel(props) {
8945
8955
  close
8946
8956
  } = useSideDialogContext();
8947
8957
  const navigate = useNavigate();
8948
- const location = useLocation();
8949
8958
  const sideEntityController = useSideEntityController();
8950
8959
  const collectionRegistryController = useCollectionRegistryController();
8951
8960
  const sideDialogsController = useSideDialogContext();
@@ -8988,6 +8997,29 @@ function EntitySidePanel(props) {
8988
8997
  useEffect(() => {
8989
8998
  setShowEditInPanel(selectedTab === "edit");
8990
8999
  }, [entityId, selectedTab]);
9000
+ const hasCorrectedDefaultView = useRef(false);
9001
+ useEffect(() => {
9002
+ hasCorrectedDefaultView.current = false;
9003
+ }, [entityId]);
9004
+ useEffect(() => {
9005
+ if (hasCorrectedDefaultView.current) return;
9006
+ if (selectedTab) return;
9007
+ if (!entityId || !collection?.defaultSelectedView) return;
9008
+ const effectiveDefault = resolveDefaultSelectedView(collection.defaultSelectedView, {
9009
+ status: "existing",
9010
+ entityId
9011
+ });
9012
+ if (effectiveDefault && effectiveDefault !== "edit") {
9013
+ hasCorrectedDefaultView.current = true;
9014
+ sideEntityController.replace({
9015
+ path,
9016
+ entityId,
9017
+ selectedTab: effectiveDefault,
9018
+ updateUrl: collection.openEntityMode !== "dialog",
9019
+ collection
9020
+ });
9021
+ }
9022
+ }, [selectedTab, entityId, collection, path, sideEntityController]);
8991
9023
  const onValuesModified = useCallback((modified) => {
8992
9024
  setBlockedNavigationMessage(modified ? /* @__PURE__ */ jsxs(Fragment, { children: [
8993
9025
  " You have unsaved changes in this ",
@@ -9021,12 +9053,12 @@ function EntitySidePanel(props) {
9021
9053
  return;
9022
9054
  }
9023
9055
  if (tabEntityId) {
9024
- const collectionPath = removeInitialAndTrailingSlashes(path);
9025
- const tabSuffix = selectedTab_0 ? "/" + selectedTab_0 : "";
9026
- const fullUrl = urlController.buildUrlCollectionPath(`${collectionPath}/${tabEntityId}${tabSuffix}#side`);
9027
- navigate(fullUrl, {
9028
- replace: true,
9029
- state: location.state
9056
+ sideEntityController.replace({
9057
+ path,
9058
+ entityId: tabEntityId,
9059
+ selectedTab: selectedTab_0,
9060
+ updateUrl: true,
9061
+ collection: paramCollection ?? collection
9030
9062
  });
9031
9063
  }
9032
9064
  } }) : /* @__PURE__ */ jsx(EntityEditView, { ...props, layout: collection?.openEntityMode === "dialog" ? "dialog" : "side_panel", collection, parentCollectionSlugs, parentEntityIds, onValuesModified, onSaved: onUpdate, navigateBack: () => setShowEditInPanel(false), barActions: ({
@@ -9052,20 +9084,20 @@ function EntitySidePanel(props) {
9052
9084
  }
9053
9085
  }, children: /* @__PURE__ */ jsx(Maximize2Icon, {}) })
9054
9086
  ] }), onTabChange: ({
9055
- entityId: entityId_0,
9087
+ entityId: tabEntityId_0,
9056
9088
  selectedTab: selectedTab_1,
9057
9089
  collection: paramCollection_0
9058
9090
  }) => {
9059
9091
  if (collection?.openEntityMode === "dialog" || paramCollection_0?.openEntityMode === "dialog") {
9060
9092
  return;
9061
9093
  }
9062
- if (entityId_0) {
9063
- const collectionPath_0 = removeInitialAndTrailingSlashes(path);
9064
- const tabSuffix_0 = selectedTab_1 ? "/" + selectedTab_1 : "";
9065
- const fullUrl_0 = urlController.buildUrlCollectionPath(`${collectionPath_0}/${entityId_0}${tabSuffix_0}#side`);
9066
- navigate(fullUrl_0, {
9067
- replace: true,
9068
- state: location.state
9094
+ if (tabEntityId_0) {
9095
+ sideEntityController.replace({
9096
+ path,
9097
+ entityId: tabEntityId_0,
9098
+ selectedTab: selectedTab_1,
9099
+ updateUrl: true,
9100
+ collection: paramCollection_0 ?? collection
9069
9101
  });
9070
9102
  }
9071
9103
  }, formProps }) }) });
@@ -9077,7 +9109,7 @@ function getEntityViewWidth(props, small, customizationController) {
9077
9109
  const {
9078
9110
  selectedSecondaryForm
9079
9111
  } = resolvedSelectedEntityView(props.collection?.entityViews, customizationController, props.selectedTab);
9080
- const shouldUseSmallLayout = !props.selectedTab || props.selectedTab === JSON_TAB_VALUE || props.selectedTab === HISTORY_TAB_VALUE || Boolean(selectedSecondaryForm);
9112
+ const shouldUseSmallLayout = !props.selectedTab || props.selectedTab === "edit" || props.selectedTab === JSON_TAB_VALUE || props.selectedTab === HISTORY_TAB_VALUE || Boolean(selectedSecondaryForm);
9081
9113
  let resolvedWidth;
9082
9114
  if (props.width) {
9083
9115
  resolvedWidth = typeof props.width === "number" ? `${props.width}px` : props.width;
@@ -9200,8 +9232,8 @@ const useBuildSideEntityController = (collectionRegistryController, urlControlle
9200
9232
  entityId: props_0.entityId
9201
9233
  });
9202
9234
  sideDialogsController.open(propsToSidePanel({
9203
- selectedTab: defaultSelectedView,
9204
- ...props_0
9235
+ ...props_0,
9236
+ selectedTab: props_0.selectedTab ?? defaultSelectedView
9205
9237
  }, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController, location.search));
9206
9238
  }, [sideDialogsController, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, authController.user, location.search]);
9207
9239
  const replace = useCallback((props_1) => {
@@ -9235,6 +9267,7 @@ function buildSidePanelsFromUrl(path, collections, newFlag) {
9235
9267
  path: navigationEntry.slug,
9236
9268
  entityId: navigationEntry.entityId,
9237
9269
  copy: false,
9270
+ collection: navigationEntry.parentCollection,
9238
9271
  width: navigationEntry.parentCollection?.sideDialogWidth
9239
9272
  };
9240
9273
  } else if (navigationEntry.type === "custom_view") {
@@ -9247,6 +9280,15 @@ function buildSidePanelsFromUrl(path, collections, newFlag) {
9247
9280
  }
9248
9281
  }
9249
9282
  }
9283
+ if (sidePanel && !sidePanel.selectedTab && sidePanel.collection) {
9284
+ const defaultView = resolveDefaultSelectedView(sidePanel.collection.defaultSelectedView, {
9285
+ status: sidePanel.copy ? "copy" : sidePanel.entityId ? "existing" : "new",
9286
+ entityId: sidePanel.entityId
9287
+ });
9288
+ if (defaultView) {
9289
+ sidePanel.selectedTab = defaultView;
9290
+ }
9291
+ }
9250
9292
  if (newFlag) {
9251
9293
  sidePanel = {
9252
9294
  path: lastCollectionPath,
@@ -9719,11 +9761,7 @@ function useResolvedCollections(props) {
9719
9761
  try {
9720
9762
  const resolved = await resolveCollections(collectionsProp, authControllerRef.current, dataRef.current, pluginsRef.current);
9721
9763
  if (cancelled) return;
9722
- const defaults = [];
9723
- if (userManagementRef.current) {
9724
- defaults.push(defaultUsersCollection);
9725
- }
9726
- const deduped = Array.from(new Map([...defaults, ...resolved].map((c2) => [c2.slug, c2])).values());
9764
+ const deduped = [...resolved];
9727
9765
  const changed = collectionRegistryController.collectionRegistryRef.current.registerMultiple(deduped);
9728
9766
  if (changed) {
9729
9767
  console.debug("Collections have changed", deduped);
@@ -9755,481 +9793,6 @@ function useResolvedCollections(props) {
9755
9793
  refresh
9756
9794
  }), [resolvedCollections, loading, error, refresh]);
9757
9795
  }
9758
- function RoleChip(t0) {
9759
- const $ = c(9);
9760
- const {
9761
- role
9762
- } = t0;
9763
- let colorScheme;
9764
- if (role.isAdmin) {
9765
- let t12;
9766
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
9767
- t12 = getColorSchemeForKey("blue");
9768
- $[0] = t12;
9769
- } else {
9770
- t12 = $[0];
9771
- }
9772
- colorScheme = t12;
9773
- } else {
9774
- if (role.id === "editor") {
9775
- let t12;
9776
- if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
9777
- t12 = getColorSchemeForKey("yellow");
9778
- $[1] = t12;
9779
- } else {
9780
- t12 = $[1];
9781
- }
9782
- colorScheme = t12;
9783
- } else {
9784
- if (role.id === "viewer") {
9785
- let t12;
9786
- if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
9787
- t12 = getColorSchemeForKey("gray");
9788
- $[2] = t12;
9789
- } else {
9790
- t12 = $[2];
9791
- }
9792
- colorScheme = t12;
9793
- } else {
9794
- let t12;
9795
- if ($[3] !== role.id) {
9796
- t12 = getColorSchemeForSeed(role.id);
9797
- $[3] = role.id;
9798
- $[4] = t12;
9799
- } else {
9800
- t12 = $[4];
9801
- }
9802
- colorScheme = t12;
9803
- }
9804
- }
9805
- }
9806
- let t1;
9807
- if ($[5] !== colorScheme || $[6] !== role.id || $[7] !== role.name) {
9808
- t1 = /* @__PURE__ */ jsx(Chip, { colorScheme, children: role.name }, role.id);
9809
- $[5] = colorScheme;
9810
- $[6] = role.id;
9811
- $[7] = role.name;
9812
- $[8] = t1;
9813
- } else {
9814
- t1 = $[8];
9815
- }
9816
- return t1;
9817
- }
9818
- function RolesView({
9819
- userManagement: userManagementProp
9820
- }) {
9821
- const userManagementContext = useInternalUserManagementController();
9822
- const userManagement = userManagementProp ?? userManagementContext;
9823
- if (!userManagement) {
9824
- return null;
9825
- }
9826
- const {
9827
- roles,
9828
- saveRole,
9829
- deleteRole,
9830
- loading,
9831
- allowDefaultRolesCreation,
9832
- rolesError
9833
- } = userManagement;
9834
- const snackbarController = useSnackbarController();
9835
- const {
9836
- t
9837
- } = useTranslation();
9838
- const breadcrumbs = useBreadcrumbsController();
9839
- React__default.useEffect(() => {
9840
- breadcrumbs.set({
9841
- breadcrumbs: [{
9842
- title: t("roles"),
9843
- url: "/roles"
9844
- }]
9845
- });
9846
- }, []);
9847
- const [dialogOpen, setDialogOpen] = useState(false);
9848
- const [selectedRole, setSelectedRole] = useState();
9849
- const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false);
9850
- const [roleToDelete, setRoleToDelete] = useState();
9851
- const [deleteInProgress, setDeleteInProgress] = useState(false);
9852
- const handleAddRole = () => {
9853
- setSelectedRole(void 0);
9854
- setDialogOpen(true);
9855
- };
9856
- const handleEditRole = (role) => {
9857
- setSelectedRole(role);
9858
- setDialogOpen(true);
9859
- };
9860
- const handleClose = () => {
9861
- setDialogOpen(false);
9862
- setSelectedRole(void 0);
9863
- };
9864
- const handleDelete = async () => {
9865
- if (!roleToDelete || !deleteRole) return;
9866
- setDeleteInProgress(true);
9867
- try {
9868
- await deleteRole(roleToDelete);
9869
- snackbarController.open({
9870
- type: "success",
9871
- message: t("role_deleted_successfully")
9872
- });
9873
- setDeleteConfirmOpen(false);
9874
- setRoleToDelete(void 0);
9875
- } catch (error) {
9876
- snackbarController.open({
9877
- type: "error",
9878
- message: error instanceof Error ? error.message : t("error_deleting_role")
9879
- });
9880
- } finally {
9881
- setDeleteInProgress(false);
9882
- }
9883
- };
9884
- const createDefaultRoles = async () => {
9885
- if (!saveRole) return;
9886
- const defaultRoles = [{
9887
- id: "admin",
9888
- name: "Admin",
9889
- isAdmin: true
9890
- }, {
9891
- id: "editor",
9892
- name: "Editor",
9893
- isAdmin: false
9894
- }, {
9895
- id: "viewer",
9896
- name: "Viewer",
9897
- isAdmin: false
9898
- }];
9899
- try {
9900
- for (const role_0 of defaultRoles) {
9901
- await saveRole(role_0);
9902
- }
9903
- snackbarController.open({
9904
- type: "success",
9905
- message: t("saved_correctly")
9906
- });
9907
- } catch (error_0) {
9908
- snackbarController.open({
9909
- type: "error",
9910
- message: error_0 instanceof Error ? error_0.message : t("error_saving_role")
9911
- });
9912
- }
9913
- };
9914
- if (loading) {
9915
- return /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(CircularProgress, {}) });
9916
- }
9917
- return /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
9918
- /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12 mb-4 gap-4", children: [
9919
- /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "grow mb-0", component: "h4", children: t("roles") }),
9920
- /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(PlusIcon, {}), onClick: handleAddRole, disabled: !saveRole, children: t("add_role") })
9921
- ] }),
9922
- /* @__PURE__ */ jsx("div", { className: "w-full overflow-auto", children: /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
9923
- /* @__PURE__ */ jsxs(TableHeader, { children: [
9924
- /* @__PURE__ */ jsx(TableCell, { header: true, children: t("role") }),
9925
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "items-center", children: t("is_admin") }),
9926
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "w-24 text-right", children: t("actions") })
9927
- ] }),
9928
- /* @__PURE__ */ jsxs(TableBody, { children: [
9929
- roles && roles.map((role_1) => {
9930
- return /* @__PURE__ */ jsxs(TableRow, { onClick: () => saveRole && handleEditRole(role_1), children: [
9931
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(RoleChip, { role: role_1 }) }),
9932
- /* @__PURE__ */ jsx(TableCell, { className: "items-center", children: /* @__PURE__ */ jsx(Checkbox, { checked: role_1.isAdmin ?? false, disabled: true }) }),
9933
- /* @__PURE__ */ jsx(TableCell, { className: "text-right whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "flex justify-end items-center gap-1", children: !role_1.isAdmin && deleteRole && /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: t("delete_this_role"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
9934
- e.stopPropagation();
9935
- setRoleToDelete(role_1);
9936
- setDeleteConfirmOpen(true);
9937
- }, children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.small }) }) }) }) })
9938
- ] }, role_1.id);
9939
- }),
9940
- (!roles || roles.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 3, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
9941
- /* @__PURE__ */ jsx(Typography, { variant: "label", children: rolesError ? t("no_permission_to_view_roles") : t("no_roles_yet") }),
9942
- rolesError && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: t("no_permission_description") }),
9943
- !rolesError && allowDefaultRolesCreation && saveRole && /* @__PURE__ */ jsx(Button, { onClick: createDefaultRoles, children: t("create_default_roles") })
9944
- ] }) }) })
9945
- ] })
9946
- ] }) }),
9947
- saveRole && /* @__PURE__ */ jsx(RoleDetailsForm, { open: dialogOpen, role: selectedRole, saveRole, handleClose }, selectedRole?.id ?? "new"),
9948
- /* @__PURE__ */ jsx(ConfirmationDialog, { open: deleteConfirmOpen, loading: deleteInProgress, onAccept: handleDelete, onCancel: () => {
9949
- setDeleteConfirmOpen(false);
9950
- setRoleToDelete(void 0);
9951
- }, title: /* @__PURE__ */ jsx(Fragment, { children: t("delete_confirmation_title") }), body: /* @__PURE__ */ jsx(Fragment, { children: t("delete_role_confirmation") }) })
9952
- ] });
9953
- }
9954
- function RoleDetailsForm({
9955
- open,
9956
- role: roleProp,
9957
- saveRole,
9958
- handleClose
9959
- }) {
9960
- const snackbarController = useSnackbarController();
9961
- const {
9962
- t
9963
- } = useTranslation();
9964
- const isNewRole = !roleProp;
9965
- const [roleId, setRoleId] = useState(roleProp?.id || "");
9966
- const [roleName, setRoleName] = useState(roleProp?.name || "");
9967
- const [isAdmin, setIsAdmin] = useState(roleProp?.isAdmin ?? false);
9968
- const [isSubmitting, setIsSubmitting] = useState(false);
9969
- const [errors, setErrors] = useState({});
9970
- const [submitCount, setSubmitCount] = useState(0);
9971
- const validate = () => {
9972
- const newErrors = {};
9973
- if (!roleId) newErrors.id = "Required";
9974
- if (!roleName) newErrors.name = "Required";
9975
- setErrors(newErrors);
9976
- return Object.keys(newErrors).length === 0;
9977
- };
9978
- const handleSubmit = async (e) => {
9979
- e.preventDefault();
9980
- setSubmitCount((c2) => c2 + 1);
9981
- if (!validate()) return;
9982
- setIsSubmitting(true);
9983
- try {
9984
- await saveRole({
9985
- id: roleId,
9986
- name: roleName,
9987
- isAdmin
9988
- });
9989
- handleClose();
9990
- } catch (error) {
9991
- snackbarController.open({
9992
- type: "error",
9993
- message: error instanceof Error ? error.message : "Failed to save role"
9994
- });
9995
- } finally {
9996
- setIsSubmitting(false);
9997
- }
9998
- };
9999
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (open_0) => !open_0 ? handleClose() : void 0, maxWidth: "4xl", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: {
10000
- display: "flex",
10001
- flexDirection: "column",
10002
- position: "relative",
10003
- height: "100%"
10004
- }, children: [
10005
- /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: t("role") }),
10006
- /* @__PURE__ */ jsx(DialogContent, { className: "h-full grow overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
10007
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-4", children: [
10008
- /* @__PURE__ */ jsx(TextField, { name: "id", required: true, error: submitCount > 0 && Boolean(errors.id), value: roleId, onChange: (e_0) => setRoleId(e_0.target.value), label: t("role_id"), disabled: !isNewRole }),
10009
- submitCount > 0 && errors.id && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: errors.id })
10010
- ] }),
10011
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-4", children: [
10012
- /* @__PURE__ */ jsx(TextField, { name: "name", required: true, error: submitCount > 0 && Boolean(errors.name), value: roleName, onChange: (e_1) => setRoleName(e_1.target.value), label: t("role_name") }),
10013
- submitCount > 0 && errors.name && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: errors.name })
10014
- ] }),
10015
- /* @__PURE__ */ jsx("div", { className: "col-span-12 sm:col-span-4 flex items-start pt-2", children: /* @__PURE__ */ jsxs(Label, { className: "flex items-center gap-2 cursor-pointer mt-3", children: [
10016
- /* @__PURE__ */ jsx(Checkbox, { checked: isAdmin, onCheckedChange: (checked) => setIsAdmin(Boolean(checked)) }),
10017
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-medium", children: t("is_admin") })
10018
- ] }) }),
10019
- /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(CollectionPermissionsMatrix, { roleId, isAdmin }) })
10020
- ] }) }),
10021
- /* @__PURE__ */ jsxs(DialogActions, { children: [
10022
- /* @__PURE__ */ jsx(Button, { variant: "text", onClick: handleClose, children: t("cancel") }),
10023
- /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: isSubmitting, loading: isSubmitting, children: isNewRole ? t("create_role") : t("update") })
10024
- ] })
10025
- ] }) });
10026
- }
10027
- const CRUD_OPS = [{
10028
- op: "select",
10029
- label: "read"
10030
- }, {
10031
- op: "insert",
10032
- label: "create"
10033
- }, {
10034
- op: "update",
10035
- label: "edit"
10036
- }, {
10037
- op: "delete",
10038
- label: "delete"
10039
- }];
10040
- function hasRoleAccess(rules, roleId, op) {
10041
- if (!rules || rules.length === 0) return true;
10042
- const applicable = rules.filter((r) => r.operation === op || r.operation === "all" || r.operations?.includes(op) || r.operations?.includes("all"));
10043
- if (applicable.length === 0) return false;
10044
- const forRole = applicable.filter((r) => !r.roles || r.roles.length === 0 || r.roles.includes(roleId) || r.roles.includes("public"));
10045
- if (forRole.length === 0) return false;
10046
- for (const r of forRole) {
10047
- if ((r.mode ?? "permissive") === "restrictive") return false;
10048
- }
10049
- return forRole.some((r) => (r.mode ?? "permissive") === "permissive");
10050
- }
10051
- function PermCell(t0) {
10052
- const $ = c(3);
10053
- const {
10054
- granted
10055
- } = t0;
10056
- const t1 = granted ? "text-green-500 dark:text-green-400 font-bold" : "text-surface-300 dark:text-surface-600";
10057
- const t2 = granted ? "✓" : "✗";
10058
- let t3;
10059
- if ($[0] !== t1 || $[1] !== t2) {
10060
- t3 = /* @__PURE__ */ jsx("span", { className: t1, children: t2 });
10061
- $[0] = t1;
10062
- $[1] = t2;
10063
- $[2] = t3;
10064
- } else {
10065
- t3 = $[2];
10066
- }
10067
- return t3;
10068
- }
10069
- function CollectionPermissionsMatrix(t0) {
10070
- const $ = c(34);
10071
- const {
10072
- roleId,
10073
- isAdmin
10074
- } = t0;
10075
- const {
10076
- collections
10077
- } = useCollectionRegistryController();
10078
- const {
10079
- t
10080
- } = useTranslation();
10081
- if (!collections || collections.length === 0) {
10082
- let t12;
10083
- if ($[0] !== t) {
10084
- t12 = t("no_collections_configured");
10085
- $[0] = t;
10086
- $[1] = t12;
10087
- } else {
10088
- t12 = $[1];
10089
- }
10090
- let t22;
10091
- if ($[2] !== t12) {
10092
- t22 = /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(Typography, { variant: "label", className: "text-surface-400", children: t12 }) });
10093
- $[2] = t12;
10094
- $[3] = t22;
10095
- } else {
10096
- t22 = $[3];
10097
- }
10098
- return t22;
10099
- }
10100
- const topLevel = collections;
10101
- let t1;
10102
- if ($[4] !== t) {
10103
- t1 = t("collection_permissions");
10104
- $[4] = t;
10105
- $[5] = t1;
10106
- } else {
10107
- t1 = $[5];
10108
- }
10109
- let t2;
10110
- if ($[6] !== t1) {
10111
- t2 = /* @__PURE__ */ jsx(Typography, { variant: "label", className: "mb-2 block text-surface-500 dark:text-surface-400 uppercase tracking-wide text-xs", children: t1 });
10112
- $[6] = t1;
10113
- $[7] = t2;
10114
- } else {
10115
- t2 = $[7];
10116
- }
10117
- let t3;
10118
- if ($[8] !== t) {
10119
- t3 = t("collection");
10120
- $[8] = t;
10121
- $[9] = t3;
10122
- } else {
10123
- t3 = $[9];
10124
- }
10125
- let t4;
10126
- if ($[10] !== t3) {
10127
- t4 = /* @__PURE__ */ jsx(TableCell, { header: true, children: t3 });
10128
- $[10] = t3;
10129
- $[11] = t4;
10130
- } else {
10131
- t4 = $[11];
10132
- }
10133
- let t5;
10134
- if ($[12] !== t) {
10135
- t5 = CRUD_OPS.map((t62) => {
10136
- const {
10137
- op,
10138
- label
10139
- } = t62;
10140
- return /* @__PURE__ */ jsx(TableCell, { header: true, align: "center", className: "w-20", children: t(label) }, op);
10141
- });
10142
- $[12] = t;
10143
- $[13] = t5;
10144
- } else {
10145
- t5 = $[13];
10146
- }
10147
- let t6;
10148
- if ($[14] !== t4 || $[15] !== t5) {
10149
- t6 = /* @__PURE__ */ jsxs(TableHeader, { children: [
10150
- t4,
10151
- t5
10152
- ] });
10153
- $[14] = t4;
10154
- $[15] = t5;
10155
- $[16] = t6;
10156
- } else {
10157
- t6 = $[16];
10158
- }
10159
- let t7;
10160
- if ($[17] !== isAdmin || $[18] !== roleId || $[19] !== t || $[20] !== topLevel) {
10161
- let t82;
10162
- if ($[22] !== isAdmin || $[23] !== roleId || $[24] !== t) {
10163
- t82 = (collection) => {
10164
- const capabilities = getDataSourceCapabilities(collection.driver);
10165
- const rules = capabilities.supportsRLS && "securityRules" in collection ? collection.securityRules : void 0;
10166
- const noRules = !rules || rules.length === 0;
10167
- return /* @__PURE__ */ jsxs(TableRow, { children: [
10168
- /* @__PURE__ */ jsxs(TableCell, { children: [
10169
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
10170
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: collection.name }),
10171
- noRules && !isAdmin && /* @__PURE__ */ jsx(Tooltip, { title: t("no_security_rules_defined"), children: /* @__PURE__ */ jsx(Chip, { size: "smallest", colorScheme: "gray", children: t("no_rules") }) })
10172
- ] }),
10173
- /* @__PURE__ */ jsx("span", { className: "text-xs text-surface-400 font-mono", children: collection.slug })
10174
- ] }),
10175
- CRUD_OPS.map((t92) => {
10176
- const {
10177
- op: op_0
10178
- } = t92;
10179
- return /* @__PURE__ */ jsx(TableCell, { align: "center", className: "w-20", children: /* @__PURE__ */ jsx(PermCell, { granted: isAdmin || hasRoleAccess(rules, roleId, op_0) }) }, op_0);
10180
- })
10181
- ] }, collection.slug);
10182
- };
10183
- $[22] = isAdmin;
10184
- $[23] = roleId;
10185
- $[24] = t;
10186
- $[25] = t82;
10187
- } else {
10188
- t82 = $[25];
10189
- }
10190
- t7 = topLevel.map(t82);
10191
- $[17] = isAdmin;
10192
- $[18] = roleId;
10193
- $[19] = t;
10194
- $[20] = topLevel;
10195
- $[21] = t7;
10196
- } else {
10197
- t7 = $[21];
10198
- }
10199
- let t8;
10200
- if ($[26] !== t7) {
10201
- t8 = /* @__PURE__ */ jsx(TableBody, { children: t7 });
10202
- $[26] = t7;
10203
- $[27] = t8;
10204
- } else {
10205
- t8 = $[27];
10206
- }
10207
- let t9;
10208
- if ($[28] !== t6 || $[29] !== t8) {
10209
- t9 = /* @__PURE__ */ jsx("div", { className: `rounded-lg overflow-hidden border w-full ${defaultBorderMixin}`, children: /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
10210
- t6,
10211
- t8
10212
- ] }) });
10213
- $[28] = t6;
10214
- $[29] = t8;
10215
- $[30] = t9;
10216
- } else {
10217
- t9 = $[30];
10218
- }
10219
- let t10;
10220
- if ($[31] !== t2 || $[32] !== t9) {
10221
- t10 = /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
10222
- t2,
10223
- t9
10224
- ] });
10225
- $[31] = t2;
10226
- $[32] = t9;
10227
- $[33] = t10;
10228
- } else {
10229
- t10 = $[33];
10230
- }
10231
- return t10;
10232
- }
10233
9796
  function viewSlugsEqual(a, b) {
10234
9797
  if (a === b) return true;
10235
9798
  if (!a || !b) return false;
@@ -10247,8 +9810,7 @@ function useResolvedViews(props) {
10247
9810
  data,
10248
9811
  plugins,
10249
9812
  adminMode = "content",
10250
- effectiveRoleController,
10251
- userManagement
9813
+ effectiveRoleController
10252
9814
  } = props;
10253
9815
  const [loading, setLoading] = useState(true);
10254
9816
  const [error, setError] = useState(void 0);
@@ -10280,24 +9842,6 @@ function useResolvedViews(props) {
10280
9842
  }, [adminMode, effectiveRoleController?.effectiveRole, authController]);
10281
9843
  const resolvedAuthControllerRef = useRef(resolvedAuthController);
10282
9844
  resolvedAuthControllerRef.current = resolvedAuthController;
10283
- const hasRoles = !!userManagement?.roles;
10284
- const rolesViewElement = useMemo(() => hasRoles ? /* @__PURE__ */ jsx(RolesView, {}) : null, [hasRoles]);
10285
- const injectedAdminViews = useMemo(() => {
10286
- const views = [];
10287
- const isUserAdmin = userManagement?.isAdmin !== false;
10288
- if (userManagement && isUserAdmin && userManagement.roles && rolesViewElement) {
10289
- views.push({
10290
- slug: "roles",
10291
- name: "Roles",
10292
- icon: "Shield",
10293
- view: rolesViewElement,
10294
- group: "Settings"
10295
- });
10296
- }
10297
- return views;
10298
- }, [userManagement, rolesViewElement]);
10299
- const injectedAdminViewsRef = useRef(injectedAdminViews);
10300
- injectedAdminViewsRef.current = injectedAdminViews;
10301
9845
  const initialLoading = resolvedAuthController.initialLoading;
10302
9846
  const user = resolvedAuthController.user;
10303
9847
  useEffect(() => {
@@ -10305,13 +9849,7 @@ function useResolvedViews(props) {
10305
9849
  let cancelled = false;
10306
9850
  (async () => {
10307
9851
  try {
10308
- const [newViews, newAdminViewsProp] = await Promise.all([resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current), resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)]);
10309
- const customSlugs = new Set(newAdminViewsProp.flatMap((v) => Array.isArray(v.slug) ? v.slug : [v.slug]));
10310
- const finalInjected = injectedAdminViewsRef.current.filter((v_0) => {
10311
- const slugs = Array.isArray(v_0.slug) ? v_0.slug : [v_0.slug];
10312
- return slugs.every((s) => !customSlugs.has(s));
10313
- });
10314
- const newAdminViews = [...newAdminViewsProp, ...finalInjected];
9852
+ const [newViews, newAdminViews] = await Promise.all([resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current), resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)]);
10315
9853
  if (!viewSlugsEqual(viewsRef.current, newViews)) {
10316
9854
  viewsRef.current = newViews;
10317
9855
  setResolvedViews(newViews);
@@ -10502,7 +10040,7 @@ function useTopLevelNavigation(props) {
10502
10040
  }), [topLevelNavigation]);
10503
10041
  }
10504
10042
  function useBuildNavigationStateController(props) {
10505
- const $ = c(38);
10043
+ const $ = c(37);
10506
10044
  const {
10507
10045
  authController,
10508
10046
  collections: collectionsProp,
@@ -10549,7 +10087,7 @@ function useBuildNavigationStateController(props) {
10549
10087
  refresh: refreshCollections
10550
10088
  } = useResolvedCollections(t1);
10551
10089
  let t2;
10552
- if ($[8] !== adminMode || $[9] !== adminViewsProp || $[10] !== authController || $[11] !== data || $[12] !== effectiveRoleController || $[13] !== plugins || $[14] !== userManagement || $[15] !== viewsProp) {
10090
+ if ($[8] !== adminMode || $[9] !== adminViewsProp || $[10] !== authController || $[11] !== data || $[12] !== effectiveRoleController || $[13] !== plugins || $[14] !== viewsProp) {
10553
10091
  t2 = {
10554
10092
  authController,
10555
10093
  views: viewsProp,
@@ -10557,8 +10095,7 @@ function useBuildNavigationStateController(props) {
10557
10095
  data,
10558
10096
  plugins,
10559
10097
  adminMode,
10560
- effectiveRoleController,
10561
- userManagement
10098
+ effectiveRoleController
10562
10099
  };
10563
10100
  $[8] = adminMode;
10564
10101
  $[9] = adminViewsProp;
@@ -10566,11 +10103,10 @@ function useBuildNavigationStateController(props) {
10566
10103
  $[11] = data;
10567
10104
  $[12] = effectiveRoleController;
10568
10105
  $[13] = plugins;
10569
- $[14] = userManagement;
10570
- $[15] = viewsProp;
10571
- $[16] = t2;
10106
+ $[14] = viewsProp;
10107
+ $[15] = t2;
10572
10108
  } else {
10573
- t2 = $[16];
10109
+ t2 = $[15];
10574
10110
  }
10575
10111
  const {
10576
10112
  views,
@@ -10580,7 +10116,7 @@ function useBuildNavigationStateController(props) {
10580
10116
  refresh: refreshViews
10581
10117
  } = useResolvedViews(t2);
10582
10118
  let t3;
10583
- if ($[17] !== adminMode || $[18] !== adminViews || $[19] !== collectionRegistryController || $[20] !== collections || $[21] !== navigationGroupMappings || $[22] !== plugins || $[23] !== urlController || $[24] !== views || $[25] !== viewsOrder) {
10119
+ if ($[16] !== adminMode || $[17] !== adminViews || $[18] !== collectionRegistryController || $[19] !== collections || $[20] !== navigationGroupMappings || $[21] !== plugins || $[22] !== urlController || $[23] !== views || $[24] !== viewsOrder) {
10584
10120
  t3 = {
10585
10121
  collections,
10586
10122
  views,
@@ -10592,40 +10128,40 @@ function useBuildNavigationStateController(props) {
10592
10128
  adminMode,
10593
10129
  collectionRegistryController
10594
10130
  };
10595
- $[17] = adminMode;
10596
- $[18] = adminViews;
10597
- $[19] = collectionRegistryController;
10598
- $[20] = collections;
10599
- $[21] = navigationGroupMappings;
10600
- $[22] = plugins;
10601
- $[23] = urlController;
10602
- $[24] = views;
10603
- $[25] = viewsOrder;
10604
- $[26] = t3;
10131
+ $[16] = adminMode;
10132
+ $[17] = adminViews;
10133
+ $[18] = collectionRegistryController;
10134
+ $[19] = collections;
10135
+ $[20] = navigationGroupMappings;
10136
+ $[21] = plugins;
10137
+ $[22] = urlController;
10138
+ $[23] = views;
10139
+ $[24] = viewsOrder;
10140
+ $[25] = t3;
10605
10141
  } else {
10606
- t3 = $[26];
10142
+ t3 = $[25];
10607
10143
  }
10608
10144
  const {
10609
10145
  topLevelNavigation
10610
10146
  } = useTopLevelNavigation(t3);
10611
10147
  let t4;
10612
- if ($[27] !== refreshCollections || $[28] !== refreshViews) {
10148
+ if ($[26] !== refreshCollections || $[27] !== refreshViews) {
10613
10149
  t4 = () => {
10614
10150
  refreshCollections();
10615
10151
  refreshViews();
10616
10152
  };
10617
- $[27] = refreshCollections;
10618
- $[28] = refreshViews;
10619
- $[29] = t4;
10153
+ $[26] = refreshCollections;
10154
+ $[27] = refreshViews;
10155
+ $[28] = t4;
10620
10156
  } else {
10621
- t4 = $[29];
10157
+ t4 = $[28];
10622
10158
  }
10623
10159
  const refreshNavigation = t4;
10624
10160
  let t5;
10625
10161
  const t6 = collectionsLoading || viewsLoading;
10626
10162
  const t7 = collectionsError ?? viewsError;
10627
10163
  let t8;
10628
- if ($[30] !== adminViews || $[31] !== plugins || $[32] !== refreshNavigation || $[33] !== t6 || $[34] !== t7 || $[35] !== topLevelNavigation || $[36] !== views) {
10164
+ if ($[29] !== adminViews || $[30] !== plugins || $[31] !== refreshNavigation || $[32] !== t6 || $[33] !== t7 || $[34] !== topLevelNavigation || $[35] !== views) {
10629
10165
  t8 = {
10630
10166
  views,
10631
10167
  adminViews,
@@ -10635,16 +10171,16 @@ function useBuildNavigationStateController(props) {
10635
10171
  refreshNavigation,
10636
10172
  plugins
10637
10173
  };
10638
- $[30] = adminViews;
10639
- $[31] = plugins;
10640
- $[32] = refreshNavigation;
10641
- $[33] = t6;
10642
- $[34] = t7;
10643
- $[35] = topLevelNavigation;
10644
- $[36] = views;
10645
- $[37] = t8;
10174
+ $[29] = adminViews;
10175
+ $[30] = plugins;
10176
+ $[31] = refreshNavigation;
10177
+ $[32] = t6;
10178
+ $[33] = t7;
10179
+ $[34] = topLevelNavigation;
10180
+ $[35] = views;
10181
+ $[36] = t8;
10646
10182
  } else {
10647
- t8 = $[37];
10183
+ t8 = $[36];
10648
10184
  }
10649
10185
  t5 = t8;
10650
10186
  return t5;
@@ -11443,6 +10979,9 @@ function useCollectionInlineEditor(t0) {
11443
10979
  setError,
11444
10980
  data: entity
11445
10981
  } = t32;
10982
+ if (!entity) {
10983
+ return;
10984
+ }
11446
10985
  const updatedValues = setIn({}, propertyKey, value_0);
11447
10986
  const saveProps = {
11448
10987
  path: entity.path ?? path,
@@ -12020,7 +11559,7 @@ function FormLayout(t0) {
12020
11559
  return t2;
12021
11560
  }
12022
11561
  function ReadOnlyFieldBinding(t0) {
12023
- const $ = c(18);
11562
+ const $ = c(23);
12024
11563
  const {
12025
11564
  propertyKey,
12026
11565
  value,
@@ -12030,6 +11569,7 @@ function ReadOnlyFieldBinding(t0) {
12030
11569
  property,
12031
11570
  includeDescription
12032
11571
  } = t0;
11572
+ const skipCardWrapper = property.type === "relation" || property.type === "reference";
12033
11573
  let t1;
12034
11574
  if ($[0] !== minimalistView || $[1] !== property || $[2] !== propertyKey) {
12035
11575
  t1 = !minimalistView && /* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey, icon: getIconForProperty(property, "small"), required: property.validation?.required, title: property.name ?? propertyKey, className: "h-8 text-text-secondary dark:text-text-secondary-dark ml-3.5" });
@@ -12040,49 +11580,62 @@ function ReadOnlyFieldBinding(t0) {
12040
11580
  } else {
12041
11581
  t1 = $[3];
12042
11582
  }
12043
- let t2;
12044
- if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
12045
- t2 = cls(paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar");
11583
+ const t2 = !skipCardWrapper && paperMixin;
11584
+ const t3 = !skipCardWrapper && "p-4 md:p-6";
11585
+ let t4;
11586
+ if ($[4] !== t2 || $[5] !== t3) {
11587
+ t4 = cls(t2, "w-full min-h-14 overflow-x-scroll no-scrollbar", t3);
12046
11588
  $[4] = t2;
11589
+ $[5] = t3;
11590
+ $[6] = t4;
12047
11591
  } else {
12048
- t2 = $[4];
11592
+ t4 = $[6];
12049
11593
  }
12050
- let t3;
12051
- if ($[5] !== property || $[6] !== propertyKey || $[7] !== value) {
12052
- t3 = /* @__PURE__ */ jsx("div", { className: t2, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey, value, property, size: "medium" }) }) });
12053
- $[5] = property;
12054
- $[6] = propertyKey;
12055
- $[7] = value;
12056
- $[8] = t3;
11594
+ let t5;
11595
+ if ($[7] !== property || $[8] !== propertyKey || $[9] !== value) {
11596
+ t5 = /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey, value, property, size: "medium" }) });
11597
+ $[7] = property;
11598
+ $[8] = propertyKey;
11599
+ $[9] = value;
11600
+ $[10] = t5;
12057
11601
  } else {
12058
- t3 = $[8];
11602
+ t5 = $[10];
12059
11603
  }
12060
- let t4;
12061
- if ($[9] !== error || $[10] !== includeDescription || $[11] !== property || $[12] !== showError) {
12062
- t4 = /* @__PURE__ */ jsx(FieldHelperText, { includeDescription, showError, error, property });
12063
- $[9] = error;
12064
- $[10] = includeDescription;
12065
- $[11] = property;
12066
- $[12] = showError;
12067
- $[13] = t4;
11604
+ let t6;
11605
+ if ($[11] !== t4 || $[12] !== t5) {
11606
+ t6 = /* @__PURE__ */ jsx("div", { className: t4, children: t5 });
11607
+ $[11] = t4;
11608
+ $[12] = t5;
11609
+ $[13] = t6;
12068
11610
  } else {
12069
- t4 = $[13];
11611
+ t6 = $[13];
12070
11612
  }
12071
- let t5;
12072
- if ($[14] !== t1 || $[15] !== t3 || $[16] !== t4) {
12073
- t5 = /* @__PURE__ */ jsxs(Fragment, { children: [
11613
+ let t7;
11614
+ if ($[14] !== error || $[15] !== includeDescription || $[16] !== property || $[17] !== showError) {
11615
+ t7 = /* @__PURE__ */ jsx(FieldHelperText, { includeDescription, showError, error, property });
11616
+ $[14] = error;
11617
+ $[15] = includeDescription;
11618
+ $[16] = property;
11619
+ $[17] = showError;
11620
+ $[18] = t7;
11621
+ } else {
11622
+ t7 = $[18];
11623
+ }
11624
+ let t8;
11625
+ if ($[19] !== t1 || $[20] !== t6 || $[21] !== t7) {
11626
+ t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
12074
11627
  t1,
12075
- t3,
12076
- t4
11628
+ t6,
11629
+ t7
12077
11630
  ] });
12078
- $[14] = t1;
12079
- $[15] = t3;
12080
- $[16] = t4;
12081
- $[17] = t5;
11631
+ $[19] = t1;
11632
+ $[20] = t6;
11633
+ $[21] = t7;
11634
+ $[22] = t8;
12082
11635
  } else {
12083
- t5 = $[17];
11636
+ t8 = $[22];
12084
11637
  }
12085
- return t5;
11638
+ return t8;
12086
11639
  }
12087
11640
  const PropertyFieldBinding = React__default.memo(PropertyFieldBindingInternal, (a, b) => {
12088
11641
  if (a.propertyKey !== b.propertyKey) {
@@ -12253,7 +11806,6 @@ function FieldInternal({
12253
11806
  propertyKey,
12254
11807
  property,
12255
11808
  Component,
12256
- // Cast component here since it is a generic component type
12257
11809
  plugins
12258
11810
  });
12259
11811
  const UsedComponent = WrappedComponent ?? Component;
@@ -14063,10 +13615,9 @@ function gettype(value) {
14063
13615
  return void 0;
14064
13616
  }
14065
13617
  function MapFieldBinding(t0) {
14066
- const $ = c(41);
13618
+ const $ = c(37);
14067
13619
  const {
14068
13620
  propertyKey,
14069
- value,
14070
13621
  showError,
14071
13622
  error,
14072
13623
  disabled,
@@ -14078,52 +13629,26 @@ function MapFieldBinding(t0) {
14078
13629
  context,
14079
13630
  onPropertyChange
14080
13631
  } = t0;
14081
- const pickOnlySomeKeys = property.pickOnlySomeKeys || false;
14082
13632
  const expanded = property.ui?.expanded === void 0 ? true : property.ui?.expanded;
14083
13633
  const minimalistView = minimalistViewProp || property.ui?.minimalistView;
14084
13634
  useTranslation();
14085
13635
  if (!property.properties) {
14086
13636
  throw Error(`You need to specify a 'properties' prop (or specify a custom field) in your map property ${propertyKey}`);
14087
13637
  }
14088
- let mapProperties;
14089
- if (pickOnlySomeKeys) {
14090
- if (value) {
14091
- let t12;
14092
- if ($[0] !== property.properties || $[1] !== value) {
14093
- t12 = pick(property.properties, ...Object.keys(value).filter((key) => key in property.properties));
14094
- $[0] = property.properties;
14095
- $[1] = value;
14096
- $[2] = t12;
14097
- } else {
14098
- t12 = $[2];
14099
- }
14100
- mapProperties = t12;
14101
- } else {
14102
- let t12;
14103
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
14104
- t12 = {};
14105
- $[3] = t12;
14106
- } else {
14107
- t12 = $[3];
14108
- }
14109
- mapProperties = t12;
14110
- }
14111
- } else {
14112
- mapProperties = property.properties;
14113
- }
13638
+ const mapProperties = property.properties;
14114
13639
  const t1 = minimalistView && property.ui?.widthPercentage !== void 0 ? "mt-8" : void 0;
14115
13640
  let t2;
14116
- if ($[4] !== t1) {
13641
+ if ($[0] !== t1) {
14117
13642
  t2 = cls("py-1 flex flex-col space-y-2", t1);
14118
- $[4] = t1;
14119
- $[5] = t2;
13643
+ $[0] = t1;
13644
+ $[1] = t2;
14120
13645
  } else {
14121
- t2 = $[5];
13646
+ t2 = $[1];
14122
13647
  }
14123
13648
  let t3;
14124
- if ($[6] !== autoFocus || $[7] !== context || $[8] !== disabled || $[9] !== includeDescription || $[10] !== mapProperties || $[11] !== onPropertyChange || $[12] !== propertyKey) {
13649
+ if ($[2] !== autoFocus || $[3] !== context || $[4] !== disabled || $[5] !== includeDescription || $[6] !== mapProperties || $[7] !== onPropertyChange || $[8] !== propertyKey) {
14125
13650
  let t42;
14126
- if ($[14] !== autoFocus || $[15] !== context || $[16] !== disabled || $[17] !== includeDescription || $[18] !== onPropertyChange || $[19] !== propertyKey) {
13651
+ if ($[10] !== autoFocus || $[11] !== context || $[12] !== disabled || $[13] !== includeDescription || $[14] !== onPropertyChange || $[15] !== propertyKey) {
14127
13652
  t42 = (t52, index) => {
14128
13653
  const [entryKey, childProperty] = t52;
14129
13654
  const thisDisabled = isReadOnly(childProperty) || Boolean(childProperty.ui?.disabled);
@@ -14146,40 +13671,40 @@ function MapFieldBinding(t0) {
14146
13671
  };
14147
13672
  return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...fieldBindingProps }) }) }, `map-${propertyKey}-${index}`);
14148
13673
  };
14149
- $[14] = autoFocus;
14150
- $[15] = context;
14151
- $[16] = disabled;
14152
- $[17] = includeDescription;
14153
- $[18] = onPropertyChange;
14154
- $[19] = propertyKey;
14155
- $[20] = t42;
13674
+ $[10] = autoFocus;
13675
+ $[11] = context;
13676
+ $[12] = disabled;
13677
+ $[13] = includeDescription;
13678
+ $[14] = onPropertyChange;
13679
+ $[15] = propertyKey;
13680
+ $[16] = t42;
14156
13681
  } else {
14157
- t42 = $[20];
13682
+ t42 = $[16];
14158
13683
  }
14159
13684
  t3 = Object.entries(mapProperties).filter(_temp$h).map(t42);
14160
- $[6] = autoFocus;
14161
- $[7] = context;
14162
- $[8] = disabled;
14163
- $[9] = includeDescription;
14164
- $[10] = mapProperties;
14165
- $[11] = onPropertyChange;
14166
- $[12] = propertyKey;
14167
- $[13] = t3;
13685
+ $[2] = autoFocus;
13686
+ $[3] = context;
13687
+ $[4] = disabled;
13688
+ $[5] = includeDescription;
13689
+ $[6] = mapProperties;
13690
+ $[7] = onPropertyChange;
13691
+ $[8] = propertyKey;
13692
+ $[9] = t3;
14168
13693
  } else {
14169
- t3 = $[13];
13694
+ t3 = $[9];
14170
13695
  }
14171
13696
  let t4;
14172
- if ($[21] !== t2 || $[22] !== t3) {
13697
+ if ($[17] !== t2 || $[18] !== t3) {
14173
13698
  t4 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: t2, children: t3 }) });
14174
- $[21] = t2;
14175
- $[22] = t3;
14176
- $[23] = t4;
13699
+ $[17] = t2;
13700
+ $[18] = t3;
13701
+ $[19] = t4;
14177
13702
  } else {
14178
- t4 = $[23];
13703
+ t4 = $[19];
14179
13704
  }
14180
13705
  const mapFormView = t4;
14181
13706
  let t5;
14182
- if ($[24] !== expanded || $[25] !== mapFormView || $[26] !== minimalistView || $[27] !== onPropertyChange || $[28] !== property || $[29] !== propertyKey) {
13707
+ if ($[20] !== expanded || $[21] !== mapFormView || $[22] !== minimalistView || $[23] !== onPropertyChange || $[24] !== property || $[25] !== propertyKey) {
14183
13708
  t5 = !minimalistView && /* @__PURE__ */ jsx(ExpandablePanel, { initiallyExpanded: expanded, onExpandedChange: (expanded_0) => {
14184
13709
  onPropertyChange?.({
14185
13710
  ui: {
@@ -14188,44 +13713,44 @@ function MapFieldBinding(t0) {
14188
13713
  }
14189
13714
  });
14190
13715
  }, className: property.ui?.widthPercentage !== void 0 ? "mt-8" : void 0, innerClassName: "px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-white dark:bg-surface-900", title: /* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey, icon: getIconForProperty(property, "small"), required: property.validation?.required, title: property.name ?? propertyKey, className: "text-text-secondary dark:text-text-secondary-dark" }), children: mapFormView });
14191
- $[24] = expanded;
14192
- $[25] = mapFormView;
14193
- $[26] = minimalistView;
14194
- $[27] = onPropertyChange;
14195
- $[28] = property;
14196
- $[29] = propertyKey;
14197
- $[30] = t5;
13716
+ $[20] = expanded;
13717
+ $[21] = mapFormView;
13718
+ $[22] = minimalistView;
13719
+ $[23] = onPropertyChange;
13720
+ $[24] = property;
13721
+ $[25] = propertyKey;
13722
+ $[26] = t5;
14198
13723
  } else {
14199
- t5 = $[30];
13724
+ t5 = $[26];
14200
13725
  }
14201
13726
  const t6 = minimalistView && mapFormView;
14202
13727
  const t7 = showError ?? false;
14203
13728
  const t8 = error && !partOfArray ? error : void 0;
14204
13729
  let t9;
14205
- if ($[31] !== disabled || $[32] !== includeDescription || $[33] !== property || $[34] !== t7 || $[35] !== t8) {
13730
+ if ($[27] !== disabled || $[28] !== includeDescription || $[29] !== property || $[30] !== t7 || $[31] !== t8) {
14206
13731
  t9 = /* @__PURE__ */ jsx(FieldHelperText, { includeDescription, showError: t7, error: t8, disabled, property });
14207
- $[31] = disabled;
14208
- $[32] = includeDescription;
14209
- $[33] = property;
14210
- $[34] = t7;
14211
- $[35] = t8;
14212
- $[36] = t9;
13732
+ $[27] = disabled;
13733
+ $[28] = includeDescription;
13734
+ $[29] = property;
13735
+ $[30] = t7;
13736
+ $[31] = t8;
13737
+ $[32] = t9;
14213
13738
  } else {
14214
- t9 = $[36];
13739
+ t9 = $[32];
14215
13740
  }
14216
13741
  let t10;
14217
- if ($[37] !== t5 || $[38] !== t6 || $[39] !== t9) {
13742
+ if ($[33] !== t5 || $[34] !== t6 || $[35] !== t9) {
14218
13743
  t10 = /* @__PURE__ */ jsxs(ErrorBoundary, { children: [
14219
13744
  t5,
14220
13745
  t6,
14221
13746
  t9
14222
13747
  ] });
14223
- $[37] = t5;
14224
- $[38] = t6;
14225
- $[39] = t9;
14226
- $[40] = t10;
13748
+ $[33] = t5;
13749
+ $[34] = t6;
13750
+ $[35] = t9;
13751
+ $[36] = t10;
14227
13752
  } else {
14228
- t10 = $[40];
13753
+ t10 = $[36];
14229
13754
  }
14230
13755
  return t10;
14231
13756
  }
@@ -19050,10 +18575,10 @@ function EditorCollectionAction(t0) {
19050
18575
  }
19051
18576
  return t8;
19052
18577
  }
19053
- const ImportCollectionAction = lazy(() => import("./index-UQOMHwt1.js").then((m) => ({
18578
+ const ImportCollectionAction = lazy(() => import("./index-DrrT332R.js").then((m) => ({
19054
18579
  default: m.ImportCollectionAction
19055
18580
  })));
19056
- const ExportCollectionAction = lazy(() => import("./index-DY2k5TtG.js").then((m) => ({
18581
+ const ExportCollectionAction = lazy(() => import("./index-D9RNzm01.js").then((m) => ({
19057
18582
  default: m.ExportCollectionAction
19058
18583
  })));
19059
18584
  function EntityCollectionViewActions(t0) {
@@ -19536,35 +19061,70 @@ function resolveEntitySlots(entity, collection, slotKeys) {
19536
19061
  }
19537
19062
  function resolveRelationDisplayName(relation, prop) {
19538
19063
  const data = "data" in relation ? relation.data : void 0;
19539
- if (!data || !data.values) {
19540
- const id2 = "id" in relation ? relation.id : void 0;
19541
- return id2 !== void 0 ? String(id2) : void 0;
19542
- }
19543
- const values = data.values;
19064
+ let targetCollection;
19544
19065
  try {
19545
- const targetCollection = prop.relation?.target?.();
19066
+ const resolved = prop.relation?.target?.() ?? (typeof prop.target === "function" ? prop.target() : void 0);
19067
+ if (resolved && typeof resolved === "object") {
19068
+ targetCollection = resolved;
19069
+ }
19070
+ } catch {
19071
+ }
19072
+ const extractDisplayName = (values) => {
19546
19073
  if (targetCollection) {
19547
19074
  const targetTitleKey = targetCollection.titleProperty;
19548
19075
  if (targetTitleKey && values[targetTitleKey] !== void 0) {
19549
19076
  return String(values[targetTitleKey]);
19550
19077
  }
19078
+ const isHiddenProp = (p) => {
19079
+ if (p.ui?.hideFromCollection) return true;
19080
+ if (typeof p.ui?.disabled === "object" && p.ui.disabled.hidden) return true;
19081
+ return false;
19082
+ };
19083
+ const isDisplayCandidate = (p) => {
19084
+ return p.type === "string" && !p.multiline && !p.markdown && !p.storage && !("isId" in p && p.isId) && !isHiddenProp(p);
19085
+ };
19086
+ const priorityKeys = ["name", "title", "label", "displayName"];
19087
+ for (const pk of priorityKeys) {
19088
+ const p = targetCollection.properties[pk];
19089
+ if (p && isDisplayCandidate(p) && values[pk] !== void 0 && values[pk] !== null) {
19090
+ return String(values[pk]);
19091
+ }
19092
+ }
19551
19093
  for (const [k, p] of Object.entries(targetCollection.properties)) {
19552
19094
  const tp = p;
19553
- if (tp.type === "string" && !tp.multiline && !tp.markdown && !tp.storage && !("isId" in tp && tp.isId)) {
19095
+ if (isDisplayCandidate(tp)) {
19554
19096
  if (values[k] !== void 0 && values[k] !== null) {
19555
19097
  return String(values[k]);
19556
19098
  }
19557
19099
  }
19558
19100
  }
19559
19101
  }
19560
- } catch {
19561
- }
19562
- for (const [, v] of Object.entries(values)) {
19563
- if (typeof v === "string" && v.length > 0 && v.length < 200) {
19564
- return v;
19102
+ for (const [, v] of Object.entries(values)) {
19103
+ if (typeof v === "string" && v.length > 0 && v.length < 200) {
19104
+ return v;
19105
+ }
19565
19106
  }
19107
+ return void 0;
19108
+ };
19109
+ if (data && data.values) {
19110
+ const result = extractDisplayName(data.values);
19111
+ if (result) return result;
19566
19112
  }
19567
19113
  const id = "id" in relation ? relation.id : void 0;
19114
+ if (id !== void 0 && targetCollection) {
19115
+ try {
19116
+ const slug = targetCollection.slug ?? ("table" in targetCollection ? targetCollection.table : void 0);
19117
+ if (slug) {
19118
+ const cacheKey = `${slug}/${id}`;
19119
+ const cached = getEntityFromCache(cacheKey);
19120
+ if (cached?.values) {
19121
+ const result = extractDisplayName(cached.values);
19122
+ if (result) return result;
19123
+ }
19124
+ }
19125
+ } catch {
19126
+ }
19127
+ }
19568
19128
  return id !== void 0 ? String(id) : void 0;
19569
19129
  }
19570
19130
  function EntityCard({
@@ -19639,6 +19199,18 @@ function getGridColumnsClass(size) {
19639
19199
  return "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6";
19640
19200
  }
19641
19201
  }
19202
+ function getScrollParent$1(element) {
19203
+ if (!element) return null;
19204
+ let parent = element.parentElement;
19205
+ while (parent) {
19206
+ const overflowY = window.getComputedStyle(parent).overflowY;
19207
+ if (overflowY === "auto" || overflowY === "scroll") {
19208
+ return parent;
19209
+ }
19210
+ parent = parent.parentElement;
19211
+ }
19212
+ return document.documentElement;
19213
+ }
19642
19214
  function EntityCollectionCardView({
19643
19215
  collection,
19644
19216
  tableController,
@@ -19652,7 +19224,6 @@ function EntityCollectionCardView({
19652
19224
  size = "m"
19653
19225
  }) {
19654
19226
  const containerRef = useRef(null);
19655
- const loadMoreRef = useRef(null);
19656
19227
  const hasRestoredScroll = useRef(false);
19657
19228
  const {
19658
19229
  data,
@@ -19685,37 +19256,48 @@ function EntityCollectionCardView({
19685
19256
  if (!dataLoading) isLoadingMore.current = false;
19686
19257
  }, [dataLoading]);
19687
19258
  useEffect(() => {
19688
- const observer = new IntersectionObserver((entries) => {
19259
+ const el = containerRef.current;
19260
+ if (!el) return;
19261
+ const scrollEl = getScrollParent$1(el);
19262
+ if (!scrollEl) return;
19263
+ let rafId = null;
19264
+ const update = () => {
19265
+ rafId = null;
19689
19266
  const {
19690
19267
  paginationEnabled: pe,
19691
19268
  noMoreToLoad: nm,
19692
- dataLoading: dl,
19693
19269
  itemCount: ic,
19694
19270
  pageSize: ps
19695
19271
  } = paginationStateRef.current;
19696
- if (entries[0].isIntersecting && pe && !dl && !nm && !isLoadingMore.current) {
19272
+ if (pe && !nm && !isLoadingMore.current && scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight < 400) {
19697
19273
  isLoadingMore.current = true;
19698
19274
  setItemCount?.((ic ?? ps) + ps);
19699
19275
  }
19700
- }, {
19701
- root: containerRef.current,
19702
- rootMargin: "400px",
19703
- threshold: 0
19276
+ };
19277
+ const onScrollEvent = () => {
19278
+ if (rafId === null) rafId = requestAnimationFrame(update);
19279
+ };
19280
+ scrollEl.addEventListener("scroll", onScrollEvent, {
19281
+ passive: true
19704
19282
  });
19705
- if (loadMoreRef.current) {
19706
- observer.observe(loadMoreRef.current);
19707
- }
19708
- return () => observer.disconnect();
19283
+ const ro = new ResizeObserver(() => update());
19284
+ ro.observe(scrollEl);
19285
+ update();
19286
+ return () => {
19287
+ scrollEl.removeEventListener("scroll", onScrollEvent);
19288
+ ro.disconnect();
19289
+ if (rafId !== null) cancelAnimationFrame(rafId);
19290
+ };
19709
19291
  }, [setItemCount]);
19710
19292
  useEffect(() => {
19711
19293
  if (!containerRef.current || !initialScroll || hasRestoredScroll.current || data.length === 0) return;
19294
+ const scrollEl_0 = getScrollParent$1(containerRef.current);
19295
+ if (!scrollEl_0) return;
19712
19296
  let attempts = 0;
19713
19297
  const maxAttempts = 5;
19714
19298
  const tryRestore = () => {
19715
- const el = containerRef.current;
19716
- if (!el) return;
19717
- if (el.scrollHeight >= initialScroll || attempts >= maxAttempts) {
19718
- el.scrollTop = initialScroll;
19299
+ if (scrollEl_0.scrollHeight >= initialScroll || attempts >= maxAttempts) {
19300
+ scrollEl_0.scrollTop = initialScroll;
19719
19301
  hasRestoredScroll.current = true;
19720
19302
  } else {
19721
19303
  attempts++;
@@ -19726,10 +19308,12 @@ function EntityCollectionCardView({
19726
19308
  }, [initialScroll, data.length]);
19727
19309
  const lastScrollOffset = useRef(0);
19728
19310
  useEffect(() => {
19729
- const container = containerRef.current;
19730
- if (!container || !onScroll) return;
19311
+ const el_0 = containerRef.current;
19312
+ if (!el_0 || !onScroll) return;
19313
+ const scrollEl_1 = getScrollParent$1(el_0);
19314
+ if (!scrollEl_1) return;
19731
19315
  const handleScroll = () => {
19732
- const currentOffset = container.scrollTop;
19316
+ const currentOffset = scrollEl_1.scrollTop;
19733
19317
  const direction = currentOffset > lastScrollOffset.current ? "forward" : "backward";
19734
19318
  lastScrollOffset.current = currentOffset;
19735
19319
  onScroll({
@@ -19738,10 +19322,10 @@ function EntityCollectionCardView({
19738
19322
  scrollUpdateWasRequested: false
19739
19323
  });
19740
19324
  };
19741
- container.addEventListener("scroll", handleScroll, {
19325
+ scrollEl_1.addEventListener("scroll", handleScroll, {
19742
19326
  passive: true
19743
19327
  });
19744
- return () => container.removeEventListener("scroll", handleScroll);
19328
+ return () => scrollEl_1.removeEventListener("scroll", handleScroll);
19745
19329
  }, [onScroll]);
19746
19330
  const handleEntityClick = useCallback((entity) => {
19747
19331
  onEntityClick?.(entity);
@@ -19758,12 +19342,12 @@ function EntityCollectionCardView({
19758
19342
  const gridColumnsClass = getGridColumnsClass(size);
19759
19343
  const isInitialLoading = dataLoading && data.length === 0 && !dataLoadingError;
19760
19344
  const isEmpty = !dataLoading && data.length === 0 && !dataLoadingError;
19761
- return /* @__PURE__ */ jsx("div", { ref: containerRef, className: "flex-1 overflow-auto p-4", children: dataLoadingError ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs(Typography, { className: "text-red-500", children: [
19345
+ return /* @__PURE__ */ jsx("div", { ref: containerRef, className: "w-full p-4", children: dataLoadingError ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs(Typography, { className: "text-red-500", children: [
19762
19346
  "Error loading data: ",
19763
19347
  dataLoadingError.message
19764
- ] }) }) : isInitialLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 px-8", children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" }) }) : isEmpty ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 px-8", children: emptyComponent ?? /* @__PURE__ */ jsx(Typography, { variant: "label", color: "secondary", children: "No entries found" }) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto", children: [
19348
+ ] }) }) : isInitialLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 px-8", children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" }) }) : isEmpty ? /* @__PURE__ */ jsx("div", { className: "w-full flex items-center justify-center py-12 px-8", children: emptyComponent ?? /* @__PURE__ */ jsx(Typography, { variant: "label", color: "secondary", children: "No entries found" }) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto", children: [
19765
19349
  /* @__PURE__ */ jsx("div", { className: cls("grid gap-4", gridColumnsClass), children: data.map((entity_3) => /* @__PURE__ */ jsx(EntityCard, { entity: entity_3, collection, onClick: handleEntityClick, selected: isEntitySelected(entity_3), highlighted: isEntityHighlighted(entity_3), onSelectionChange: handleSelectionChange, selectionEnabled, size }, `${entity_3.path}_${entity_3.id}`)) }),
19766
- /* @__PURE__ */ jsxs("div", { ref: loadMoreRef, className: "flex items-center justify-center py-8", children: [
19350
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-8", children: [
19767
19351
  dataLoading && /* @__PURE__ */ jsx(CircularProgress, { size: "small" }),
19768
19352
  !dataLoading && noMoreToLoad && data.length > 0 && /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
19769
19353
  "All ",
@@ -19820,6 +19404,13 @@ function getScrollParent(element) {
19820
19404
  return document.documentElement;
19821
19405
  }
19822
19406
  function isComplexPropertyType(property) {
19407
+ if (property.type === "array") {
19408
+ const ofProp = "of" in property ? property.of : void 0;
19409
+ const innerProp = ofProp ? Array.isArray(ofProp) ? ofProp[0] : ofProp : void 0;
19410
+ if (innerProp && typeof innerProp === "object" && "enum" in innerProp && innerProp.enum) {
19411
+ return false;
19412
+ }
19413
+ }
19823
19414
  return property.type === "array" || property.type === "map" || property.type === "reference" || property.type === "relation";
19824
19415
  }
19825
19416
  function compactValueSummary(value, property) {
@@ -20148,7 +19739,7 @@ function EntityCollectionListView({
20148
19739
  return /* @__PURE__ */ jsx("div", { ref: containerRef, className: cls("w-full", selectedEntityId === void 0 && "rounded-lg overflow-hidden border " + defaultBorderMixin), children: dataLoadingError ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs(Typography, { className: "text-red-500", children: [
20149
19740
  "Error loading data: ",
20150
19741
  dataLoadingError.message
20151
- ] }) }) : isInitialLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 px-8", children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" }) }) : isEmpty ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 px-8", children: emptyComponent ?? /* @__PURE__ */ jsx(Typography, { variant: "label", color: "secondary", children: "No entries found" }) }) : (
19742
+ ] }) }) : isInitialLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 px-8", children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" }) }) : isEmpty ? /* @__PURE__ */ jsx("div", { className: "w-full flex items-center justify-center py-12 px-8", children: emptyComponent ?? /* @__PURE__ */ jsx(Typography, { variant: "label", color: "secondary", children: "No entries found" }) }) : (
20152
19743
  /* Spacer with total height — no internal scroll.
20153
19744
  The nearest scrollable ancestor provides the scrollbar. */
20154
19745
  /* @__PURE__ */ jsxs("div", { style: {
@@ -23617,6 +23208,7 @@ const resetPasswordAction = {
23617
23208
  return Promise.resolve(void 0);
23618
23209
  }
23619
23210
  };
23211
+ const innerClicked = /* @__PURE__ */ new WeakSet();
23620
23212
  function useDraggable({
23621
23213
  containerRef,
23622
23214
  innerRef,
@@ -23628,7 +23220,7 @@ function useDraggable({
23628
23220
  let relY = 0;
23629
23221
  const listeningRef = React__default.useRef(false);
23630
23222
  const onMouseDown = useCallback((event) => {
23631
- if (event.button !== 0 || !containerRef.current || event.defaultPrevented || event.innerClicked) {
23223
+ if (event.button !== 0 || !containerRef.current || event.defaultPrevented || innerClicked.has(event)) {
23632
23224
  return;
23633
23225
  }
23634
23226
  const {
@@ -23643,7 +23235,7 @@ function useDraggable({
23643
23235
  listeningRef.current = true;
23644
23236
  }, [containerRef, onMove]);
23645
23237
  const onMouseDownInner = useCallback((event_0) => {
23646
- event_0.innerClicked = true;
23238
+ innerClicked.add(event_0);
23647
23239
  }, []);
23648
23240
  const onSelect = useCallback((event_1) => {
23649
23241
  event_1.preventDefault();
@@ -25237,7 +24829,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
25237
24829
  /* @__PURE__ */ jsx(EntityCollectionListView, { collection, tableController, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], size: listSize, emptyComponent, selectedEntityId: selectedEntityIdProp, getActionsForEntity, path, openEntityMode }, `list-view-${path}`)
25238
24830
  ] }) : innerView }, `split-list-view-${path}`) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col w-full h-full", children: [
25239
24831
  toolbarNode,
25240
- /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col overflow-y-auto", children: viewMode === "list" ? /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col w-full", selectedEntityIdProp === void 0 ? "max-w-6xl mx-auto px-3 md:px-4 lg:px-6 py-4" : ""), children: [
24832
+ /* @__PURE__ */ jsx("div", { className: cls("flex-1 flex flex-col", (viewMode === "list" || viewMode === "cards") && "overflow-y-auto"), children: viewMode === "list" ? /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col w-full", selectedEntityIdProp === void 0 ? "max-w-6xl mx-auto px-3 md:px-4 lg:px-6 py-4" : ""), children: [
25241
24833
  /* @__PURE__ */ jsx("div", { className: cls("grid transition-[grid-template-rows,transform,margin] duration-150 ease-out", selectedEntityIdProp === void 0 ? "grid-rows-[1fr] translate-y-0 mt-12 mb-6" : "grid-rows-[0fr] -translate-y-2 mt-0 mb-0"), children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden flex items-center gap-4", children: /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "grow mb-0", component: "h4", children: collection.name }) }) }),
25242
24834
  pluginInsights.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: pluginInsights }),
25243
24835
  innerView
@@ -26643,7 +26235,7 @@ function DrawerToggle(t0) {
26643
26235
  }
26644
26236
  let t14;
26645
26237
  if ($[31] !== t1 || $[32] !== t13 || $[33] !== t2) {
26646
- t14 = /* @__PURE__ */ jsx("div", { className: "shrink-0 mt-auto px-2 py-2", children: /* @__PURE__ */ jsx(Tooltip, { title: t1, side: "right", sideOffset: 12, asChild: true, open: t2, children: t13 }) });
26238
+ t14 = /* @__PURE__ */ jsx("div", { className: "shrink-0 mt-auto px-4 pt-0.5 pb-2", children: /* @__PURE__ */ jsx(Tooltip, { title: t1, side: "right", sideOffset: 12, asChild: true, open: t2, children: t13 }) });
26647
26239
  $[31] = t1;
26648
26240
  $[32] = t13;
26649
26241
  $[33] = t2;
@@ -26797,7 +26389,7 @@ function DrawerFooterActions({
26797
26389
  } else {
26798
26390
  avatarComponent = null;
26799
26391
  }
26800
- return /* @__PURE__ */ jsx("div", { className: "shrink-0 pb-1", ref: portalRef, children: avatarComponent && /* @__PURE__ */ jsxs("div", { className: "flex items-center px-[16px] py-1", children: [
26392
+ return /* @__PURE__ */ jsx("div", { className: "shrink-0 pt-2 pb-0", ref: portalRef, children: avatarComponent && /* @__PURE__ */ jsxs("div", { className: "flex items-center px-[16px] py-1", children: [
26801
26393
  /* @__PURE__ */ jsxs(Menu, { trigger: /* @__PURE__ */ jsx("div", { className: cls("shrink-0 flex items-center justify-center w-[44px] cursor-pointer", "rounded-md py-1", "hover:bg-surface-accent-100 dark:hover:bg-surface-800", "transition-colors duration-150"), role: "button", tabIndex: 0, "aria-label": t("user_menu") || "User menu", children: avatarComponent }), side: "top", align: "start", children: [
26802
26394
  user && /* @__PURE__ */ jsxs("div", { className: "px-4 py-2 mb-1", children: [
26803
26395
  user.displayName && /* @__PURE__ */ jsx(Typography, { variant: "body1", color: "secondary", children: user.displayName }),
@@ -27415,7 +27007,7 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
27415
27007
  }
27416
27008
  const EMPTY_PLUGINS = [];
27417
27009
  const EMPTY_COLLECTIONS = [];
27418
- const CollectionsStudioView = lazy(() => import("./CollectionsStudioView-Bc3Rxxc2.js").then((n) => n.b).then((m) => ({
27010
+ const CollectionsStudioView = lazy(() => import("./CollectionsStudioView-Brr_b06v.js").then((n) => n.b).then((m) => ({
27419
27011
  default: m.CollectionsStudioView
27420
27012
  })));
27421
27013
  function RebaseNavigation({
@@ -27653,10 +27245,10 @@ function _temp$3(event) {
27653
27245
  event.preventDefault();
27654
27246
  event.stopPropagation();
27655
27247
  }
27656
- const CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-D0VqpLPO.js").then((m) => ({
27248
+ const CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-C8E440oK.js").then((m) => ({
27657
27249
  default: m.CollectionEditorDialog
27658
27250
  })));
27659
- const PropertyFormDialog = lazy(() => import("./PropertyEditView-CvRSV-A2.js").then((n) => n.P).then((m) => ({
27251
+ const PropertyFormDialog = lazy(() => import("./PropertyEditView-ChBleIbN.js").then((n) => n.P).then((m) => ({
27660
27252
  default: m.PropertyFormDialog
27661
27253
  })));
27662
27254
  function CollectionEditorDialogs() {
@@ -29248,6 +28840,9 @@ const PropertyCollectionView = (t0) => {
29248
28840
  if (value === null || value === void 0) {
29249
28841
  return null;
29250
28842
  }
28843
+ if (baseKey === "" && !properties[key]) {
28844
+ return null;
28845
+ }
29251
28846
  const currentKey_0 = baseKey ? `${baseKey}.${key}` : key;
29252
28847
  return /* @__PURE__ */ jsx(PropertyCollectionView, { data: value, properties, baseKey: currentKey_0, size }, currentKey_0);
29253
28848
  };
@@ -30351,15 +29946,15 @@ function validateProperty(property, path, errors) {
30351
29946
  });
30352
29947
  return;
30353
29948
  }
30354
- if (!property.dataType) {
29949
+ if (!property.type) {
30355
29950
  errors.push({
30356
- path: `${path}.dataType`,
29951
+ path: `${path}.type`,
30357
29952
  message: "Required field is missing"
30358
29953
  });
30359
- } else if (!VALID_DATA_TYPES.includes(property.dataType)) {
29954
+ } else if (!VALID_DATA_TYPES.includes(property.type)) {
30360
29955
  errors.push({
30361
- path: `${path}.dataType`,
30362
- message: `Invalid value "${property.dataType}", expected one of: ${VALID_DATA_TYPES.join(", ")}`
29956
+ path: `${path}.type`,
29957
+ message: `Invalid value "${property.type}", expected one of: ${VALID_DATA_TYPES.join(", ")}`
30363
29958
  });
30364
29959
  }
30365
29960
  if (property.name !== void 0 && typeof property.name !== "string") {
@@ -30368,7 +29963,7 @@ function validateProperty(property, path, errors) {
30368
29963
  message: "Must be a string"
30369
29964
  });
30370
29965
  }
30371
- if (property.dataType === "array") {
29966
+ if (property.type === "array") {
30372
29967
  if (property.of) {
30373
29968
  if (Array.isArray(property.of)) {
30374
29969
  property.of.forEach((ofProp, index) => {
@@ -30389,10 +29984,10 @@ function validateProperty(property, path, errors) {
30389
29984
  }
30390
29985
  }
30391
29986
  }
30392
- if (property.dataType === "map" && property.properties) {
29987
+ if (property.type === "map" && property.properties) {
30393
29988
  validateProperties(property.properties, `${path}.properties`, errors);
30394
29989
  }
30395
- if (property.dataType === "reference") {
29990
+ if (property.type === "reference") {
30396
29991
  if (property.path !== void 0 && typeof property.path !== "string") {
30397
29992
  errors.push({
30398
29993
  path: `${path}.path`,
@@ -30400,7 +29995,7 @@ function validateProperty(property, path, errors) {
30400
29995
  });
30401
29996
  }
30402
29997
  }
30403
- if (property.dataType === "relation") {
29998
+ if (property.type === "relation") {
30404
29999
  if (property.target !== void 0 && typeof property.target !== "string" && typeof property.target !== "function") {
30405
30000
  errors.push({
30406
30001
  path: `${path}.target`,
@@ -30472,7 +30067,7 @@ function validateProperty(property, path, errors) {
30472
30067
  });
30473
30068
  }
30474
30069
  }
30475
- if (property.dataType === "vector") {
30070
+ if (property.type === "vector") {
30476
30071
  if (property.dimensions !== void 0 && (typeof property.dimensions !== "number" || isNaN(property.dimensions) || property.dimensions <= 0)) {
30477
30072
  errors.push({
30478
30073
  path: `${path}.dimensions`,
@@ -30480,7 +30075,7 @@ function validateProperty(property, path, errors) {
30480
30075
  });
30481
30076
  }
30482
30077
  }
30483
- if (property.dataType === "string" && property.storage) {
30078
+ if (property.type === "string" && property.storage) {
30484
30079
  if (typeof property.storage !== "object") {
30485
30080
  errors.push({
30486
30081
  path: `${path}.storage`,
@@ -30750,7 +30345,7 @@ export {
30750
30345
  MapFieldBinding as Z,
30751
30346
  MapPropertyPreview as _,
30752
30347
  ArrayContainer as a,
30753
- isReferenceProperty as a$,
30348
+ mergeEntityActions as a$,
30754
30349
  MultiSelectFieldBinding as a0,
30755
30350
  NavigationCard as a1,
30756
30351
  NavigationStateContext as a2,
@@ -30761,98 +30356,96 @@ export {
30761
30356
  PropertyPreview as a7,
30762
30357
  ReadOnlyFieldBinding as a8,
30763
30358
  RebaseNavigation as a9,
30764
- VirtualTableInput as aA,
30765
- buildCollectionGenerationCallback as aB,
30766
- buildSidePanelsFromUrl as aC,
30767
- convertDataToEntity as aD,
30768
- convertFileToJson as aE,
30769
- copyEntityAction as aF,
30770
- deleteEntityAction as aG,
30771
- editEntityAction as aH,
30772
- flattenEntry as aI,
30773
- getBracketNotation as aJ,
30774
- getDefaultFieldConfig as aK,
30775
- getDefaultFieldId as aL,
30776
- getDefaultPropertiesOrder as aM,
30777
- getEntityPreviewKeys as aN,
30778
- getEntityTitlePropertyKey as aO,
30779
- getEntityViewWidth as aP,
30780
- getFieldConfig as aQ,
30781
- getFieldId as aR,
30782
- getFullId as aS,
30783
- getFullIdPath as aT,
30784
- getIconForProperty as aU,
30785
- getIconForWidget as aV,
30786
- getInferenceType as aW,
30787
- getPropertiesWithPropertiesOrder as aX,
30788
- getPropertyInPath as aY,
30789
- getResolvedPropertyInPath as aZ,
30790
- idToPropertiesPath as a_,
30359
+ buildSidePanelsFromUrl as aA,
30360
+ convertDataToEntity as aB,
30361
+ convertFileToJson as aC,
30362
+ copyEntityAction as aD,
30363
+ deleteEntityAction as aE,
30364
+ editEntityAction as aF,
30365
+ flattenEntry as aG,
30366
+ getBracketNotation as aH,
30367
+ getDefaultFieldConfig as aI,
30368
+ getDefaultFieldId as aJ,
30369
+ getDefaultPropertiesOrder as aK,
30370
+ getEntityPreviewKeys as aL,
30371
+ getEntityTitlePropertyKey as aM,
30372
+ getEntityViewWidth as aN,
30373
+ getFieldConfig as aO,
30374
+ getFieldId as aP,
30375
+ getFullId as aQ,
30376
+ getFullIdPath as aR,
30377
+ getIconForProperty as aS,
30378
+ getIconForWidget as aT,
30379
+ getInferenceType as aU,
30380
+ getPropertiesWithPropertiesOrder as aV,
30381
+ getPropertyInPath as aW,
30382
+ getResolvedPropertyInPath as aX,
30383
+ idToPropertiesPath as aY,
30384
+ isReferenceProperty as aZ,
30385
+ isRelationProperty as a_,
30791
30386
  ReferenceAsStringFieldBinding as aa,
30792
30387
  ReferenceFieldBinding as ab,
30793
30388
  ReferencePreview as ac,
30794
30389
  RelationPreview as ad,
30795
30390
  RepeatFieldBinding as ae,
30796
- RoleChip as af,
30797
- RolesView as ag,
30798
- Scaffold as ah,
30799
- SearchIconsView as ai,
30800
- SelectFieldBinding as aj,
30801
- SelectableTable as ak,
30802
- SelectableTableContext as al,
30803
- SideDialogs as am,
30804
- SideEntityControllerContext as an,
30805
- SideEntityProvider as ao,
30806
- SkeletonPropertyComponent as ap,
30807
- StorageThumbnail as aq,
30808
- StorageThumbnailInternal as ar,
30809
- StorageUploadFieldBinding as as,
30810
- StringPropertyPreview as at,
30811
- SwitchFieldBinding as au,
30812
- TextFieldBinding as av,
30813
- UrlComponentPreview as aw,
30814
- UrlContext as ax,
30815
- UserPreview as ay,
30816
- VectorFieldBinding as az,
30391
+ Scaffold as af,
30392
+ SearchIconsView as ag,
30393
+ SelectFieldBinding as ah,
30394
+ SelectableTable as ai,
30395
+ SelectableTableContext as aj,
30396
+ SideDialogs as ak,
30397
+ SideEntityControllerContext as al,
30398
+ SideEntityProvider as am,
30399
+ SkeletonPropertyComponent as an,
30400
+ StorageThumbnail as ao,
30401
+ StorageThumbnailInternal as ap,
30402
+ StorageUploadFieldBinding as aq,
30403
+ StringPropertyPreview as ar,
30404
+ SwitchFieldBinding as as,
30405
+ TextFieldBinding as at,
30406
+ UrlComponentPreview as au,
30407
+ UrlContext as av,
30408
+ UserPreview as aw,
30409
+ VectorFieldBinding as ax,
30410
+ VirtualTableInput as ay,
30411
+ buildCollectionGenerationCallback as az,
30817
30412
  ArrayCustomShapedFieldBinding as b,
30818
- isRelationProperty as b0,
30819
- mergeEntityActions as b1,
30820
- namespaceToPropertiesOrderPath as b2,
30821
- namespaceToPropertiesPath as b3,
30822
- processValueMapping as b4,
30823
- renderSkeletonCaptionText as b5,
30824
- renderSkeletonIcon as b6,
30825
- renderSkeletonImageThumbnail as b7,
30826
- renderSkeletonText as b8,
30827
- resetPasswordAction as b9,
30828
- validateCollectionJson as bA,
30829
- zodToFormErrors as bB,
30830
- resolveEntityAction as ba,
30831
- resolveEntityView as bb,
30832
- sanitizeUrl as bc,
30833
- unflattenObject as bd,
30834
- useApp as be,
30835
- useBreadcrumbsController as bf,
30836
- useBuildCollectionRegistryController as bg,
30837
- useBuildNavigationStateController as bh,
30838
- useBuildSideEntityController as bi,
30839
- useBuildUrlController as bj,
30840
- useCMSContext as bk,
30841
- useClearRestoreValue as bl,
30842
- useCollectionEditorController as bm,
30843
- useCollectionRegistryController as bn,
30844
- useCollectionsConfigController as bo,
30845
- useEntitySelectionDialog as bp,
30846
- useImportConfig as bq,
30847
- useLocalCollectionsConfigController as br,
30848
- useNavigationStateController as bs,
30849
- useResolvedCollections as bt,
30850
- useResolvedViews as bu,
30851
- useSelectionController as bv,
30852
- useSideDialogsController as bw,
30853
- useSideEntityController as bx,
30854
- useTopLevelNavigation as by,
30855
- useUrlController as bz,
30413
+ namespaceToPropertiesOrderPath as b0,
30414
+ namespaceToPropertiesPath as b1,
30415
+ processValueMapping as b2,
30416
+ renderSkeletonCaptionText as b3,
30417
+ renderSkeletonIcon as b4,
30418
+ renderSkeletonImageThumbnail as b5,
30419
+ renderSkeletonText as b6,
30420
+ resetPasswordAction as b7,
30421
+ resolveEntityAction as b8,
30422
+ resolveEntityView as b9,
30423
+ sanitizeUrl as ba,
30424
+ unflattenObject as bb,
30425
+ useApp as bc,
30426
+ useBreadcrumbsController as bd,
30427
+ useBuildCollectionRegistryController as be,
30428
+ useBuildNavigationStateController as bf,
30429
+ useBuildSideEntityController as bg,
30430
+ useBuildUrlController as bh,
30431
+ useCMSContext as bi,
30432
+ useClearRestoreValue as bj,
30433
+ useCollectionEditorController as bk,
30434
+ useCollectionRegistryController as bl,
30435
+ useCollectionsConfigController as bm,
30436
+ useEntitySelectionDialog as bn,
30437
+ useImportConfig as bo,
30438
+ useLocalCollectionsConfigController as bp,
30439
+ useNavigationStateController as bq,
30440
+ useResolvedCollections as br,
30441
+ useResolvedViews as bs,
30442
+ useSelectionController as bt,
30443
+ useSideDialogsController as bu,
30444
+ useSideEntityController as bv,
30445
+ useTopLevelNavigation as bw,
30446
+ useUrlController as bx,
30447
+ validateCollectionJson as by,
30448
+ zodToFormErrors as bz,
30856
30449
  ArrayEnumPreview as c,
30857
30450
  ArrayOfReferencesFieldBinding as d,
30858
30451
  ArrayOfReferencesPreview as e,
@@ -30878,4 +30471,4 @@ export {
30878
30471
  EntityCollectionTable as y,
30879
30472
  EntityCollectionView as z
30880
30473
  };
30881
- //# sourceMappingURL=util-ZM9gQuCv.js.map
30474
+ //# sourceMappingURL=util-COYYD8zr.js.map