@rebasepro/admin 0.0.1-canary.f81da60 → 0.1.2

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 (95) hide show
  1. package/dist/{CollectionEditorDialog-D509-IMx.js → CollectionEditorDialog-ywdxhs1L.js} +18 -18
  2. package/dist/CollectionEditorDialog-ywdxhs1L.js.map +1 -0
  3. package/dist/{CollectionsStudioView-B549BDpU.js → CollectionsStudioView-BDzMFzqH.js} +4 -4
  4. package/dist/{CollectionsStudioView-B549BDpU.js.map → CollectionsStudioView-BDzMFzqH.js.map} +1 -1
  5. package/dist/{ContentHomePage--Bl1FXk7.js → ContentHomePage-0tHuEIm_.js} +26 -26
  6. package/dist/ContentHomePage-0tHuEIm_.js.map +1 -0
  7. package/dist/{ExportCollectionAction-CttNAdM1.js → ExportCollectionAction-BIrq92To.js} +2 -2
  8. package/dist/{ExportCollectionAction-CttNAdM1.js.map → ExportCollectionAction-BIrq92To.js.map} +1 -1
  9. package/dist/{ImportCollectionAction-BB33kxAN.js → ImportCollectionAction-h8yg_To8.js} +2 -2
  10. package/dist/{ImportCollectionAction-BB33kxAN.js.map → ImportCollectionAction-h8yg_To8.js.map} +1 -1
  11. package/dist/{PropertyEditView-UtDO8g0A.js → PropertyEditView-BuZrNnBN.js} +79 -101
  12. package/dist/PropertyEditView-BuZrNnBN.js.map +1 -0
  13. package/dist/{RolesView-B0E7L0hE.js → RolesView-CMPsaIXo.js} +2 -2
  14. package/dist/{RolesView-B0E7L0hE.js.map → RolesView-CMPsaIXo.js.map} +1 -1
  15. package/dist/{UsersView-BM2_7VPV.js → UsersView-BkeblMVT.js} +6 -28
  16. package/dist/UsersView-BkeblMVT.js.map +1 -0
  17. package/dist/collection_editor/ConfigControllerProvider.d.ts +0 -4
  18. package/dist/collection_editor/ui/collection_editor/CollectionDetailsForm.d.ts +1 -3
  19. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +0 -2
  20. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -2
  21. package/dist/collection_editor_ui.js +3 -3
  22. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +5 -1
  23. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +2 -1
  24. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +2 -1
  25. package/dist/components/EntityEditView.d.ts +6 -0
  26. package/dist/components/RebaseCMS.d.ts +1 -1
  27. package/dist/{index-C9YDsMC9.js → index-BuZaHcyc.js} +3 -3
  28. package/dist/index-BuZaHcyc.js.map +1 -0
  29. package/dist/{index-CNDetux9.js → index-CS6uJ7oW.js} +2 -2
  30. package/dist/{index-CNDetux9.js.map → index-CS6uJ7oW.js.map} +1 -1
  31. package/dist/{index-DO7lMeNB.js → index-eRJbMvHi.js} +3 -3
  32. package/dist/index-eRJbMvHi.js.map +1 -0
  33. package/dist/index.js +18 -14
  34. package/dist/index.js.map +1 -1
  35. package/dist/util/navigation_utils.d.ts +10 -1
  36. package/dist/{util-DK1O3uM0.js → util-zfU1zOCX.js} +713 -603
  37. package/dist/util-zfU1zOCX.js.map +1 -0
  38. package/package.json +8 -8
  39. package/src/collection_editor/ConfigControllerProvider.tsx +1 -10
  40. package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +3 -47
  41. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +2 -10
  42. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +1 -3
  43. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +3 -3
  44. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +0 -1
  45. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +6 -6
  46. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
  47. package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +15 -49
  48. package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +2 -3
  49. package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +1 -1
  50. package/src/collection_editor/ui/collection_editor/templates/products_template.ts +2 -2
  51. package/src/components/DefaultAppBar.tsx +2 -2
  52. package/src/components/DefaultDrawer.tsx +25 -17
  53. package/src/components/DrawerNavigationGroup.tsx +4 -4
  54. package/src/components/DrawerNavigationItem.tsx +6 -6
  55. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +5 -3
  56. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +1 -1
  57. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +8 -2
  58. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +2 -2
  59. package/src/components/EntityCollectionTable/table_bindings.tsx +37 -27
  60. package/src/components/EntityCollectionView/EntityCard.tsx +2 -2
  61. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +4 -3
  62. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +7 -6
  63. package/src/components/EntityCollectionView/EntityCollectionView.tsx +50 -7
  64. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +17 -8
  65. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +8 -4
  66. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +33 -5
  67. package/src/components/EntityEditView.tsx +80 -81
  68. package/src/components/EntitySidePanel.tsx +11 -7
  69. package/src/components/HomePage/ContentHomePage.tsx +24 -15
  70. package/src/components/HomePage/NavigationCard.tsx +4 -4
  71. package/src/components/HomePage/NavigationGroup.tsx +2 -2
  72. package/src/components/RebaseAuthGate.tsx +2 -0
  73. package/src/components/RebaseCMS.tsx +4 -3
  74. package/src/components/RebaseNavigation.tsx +7 -4
  75. package/src/components/RelationSelector.tsx +30 -2
  76. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  77. package/src/components/UserSelector.tsx +1 -1
  78. package/src/components/admin/UsersView.tsx +2 -17
  79. package/src/components/app/Scaffold.tsx +3 -3
  80. package/src/components/field_configs.tsx +3 -3
  81. package/src/form/PropertyFieldBinding.tsx +10 -6
  82. package/src/hooks/navigation/useResolvedViews.tsx +1 -3
  83. package/src/hooks/navigation/useTopLevelNavigation.ts +1 -1
  84. package/src/hooks/navigation/utils.ts +1 -1
  85. package/src/preview/PropertyPreview.tsx +17 -13
  86. package/src/routes/RebaseRoute.tsx +27 -2
  87. package/src/util/navigation_utils.ts +16 -2
  88. package/src/util/previews.ts +14 -5
  89. package/dist/CollectionEditorDialog-D509-IMx.js.map +0 -1
  90. package/dist/ContentHomePage--Bl1FXk7.js.map +0 -1
  91. package/dist/PropertyEditView-UtDO8g0A.js.map +0 -1
  92. package/dist/UsersView-BM2_7VPV.js.map +0 -1
  93. package/dist/index-C9YDsMC9.js.map +0 -1
  94. package/dist/index-DO7lMeNB.js.map +0 -1
  95. package/dist/util-DK1O3uM0.js.map +0 -1
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import { DialogActions, Typography, IconButton, Button, LoadingButton, cls, defaultBorderMixin, Tooltip, Skeleton, Chip, getColorSchemeForSeed, ErrorBoundary, iconSize, useDebouncedCallback, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, useInjectStyles, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, CircularProgress, Separator, paperMixin, Menu, MenuItem, Checkbox, Badge, SearchBar, Label, TextField, BooleanSwitchWithLabel, useOutsideAlerter, VirtualTable, CircularProgressCenter, Tab, Tabs, CenteredView, Sheet, iconKeys, debounce, coolIconKeys, ExpandablePanel, HandleIcon, Collapse, FileUpload, TableRow, TableCell, TableHeader, Table, TableBody, Popover, CHIP_COLORS, Card, ResizablePanels, getColorSchemeForKey, Markdown, Dialog, DialogContent, ToggleButtonGroup, DialogTitle, Avatar, Alert } from "@rebasepro/ui";
4
4
  import { AlertCircleIcon, CopyIcon, ImageOffIcon, ExternalLinkIcon, FileTextIcon, FunctionSquareIcon, CircleIcon, LinkIcon, Rows3Icon, UploadIcon, RepeatIcon, VoteIcon, CalendarIcon, FlagIcon, HashIcon, GlobeIcon, MailIcon, AlignLeftIcon, TextIcon, ArrowRightToLineIcon, XIcon, ChevronDownIcon, SearchIcon, PencilIcon, CheckIcon, MoreVerticalIcon, HistoryIcon, Maximize2Icon, CodeIcon, PlusIcon, icons, MinusIcon, ChevronUpIcon, FolderUpIcon, ListOrderedIcon, UserIcon, ListIcon, QuoteIcon, ChevronRightIcon, SettingsIcon, Trash2Icon, RefreshCwIcon, TableIcon, LayoutGridIcon, KanbanIcon, ColumnsIcon, FilterXIcon, ArrowLeftIcon, FilterIcon, MoonIcon, SunIcon, SunMoonIcon, LogOutIcon, ChevronsLeftIcon, ChevronsRightIcon, MenuIcon, AlertTriangleIcon, EyeIcon, XCircleIcon } from "lucide-react";
5
- import { useTranslation, useStorageSource, ErrorView, buildEnumLabel, getColorScheme, useAuthController, useCustomizationController, useAnalyticsController, IconForView, useEntityFetch, useUserSelector, UserDisplay, useSnackbarController, ErrorTooltip, useStorageUploadController, useData, useRelationSelector, getRowHeight, useLargeLayout, getEntityFromCache, getColumnKeysForProperty, DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE$1, useRebaseContext, usePermissions, useModeController, getEntityFromMemoryCache, useSlot, createFormexStub, PluginProviderStack, saveEntityToMemoryCache, CONTAINER_FULL_WIDTH, ADDITIONAL_TAB_WIDTH, FORM_CONTAINER_WIDTH, useUnsavedChangesDialog, UnsavedChangesDialog, useColumnIds, useDataTableController, saveEntityWithCallbacks, iconSynonyms, iconsSearch, deleteEntityWithCallbacks, useUserConfigurationPersistence, useScrollRestoration, useBridgeRegistration, useAdminModeController, RebaseLogo, LanguageToggle, useEffectiveRoleController, useRebaseRegistry, useCollapsedGroups, STUDIO_NAVIGATION_GROUPS, useInternalUserManagementController, useBuildLocalConfigurationPersistence, useRebaseClient, CustomizationControllerContext, StudioBridgeRegistryProvider, NotFoundPage, UIReferenceView, RebaseRoutes, UserSettingsView, flattenKeys, removeEntityFromCache, saveEntityToCache, removeEntityFromMemoryCache, getFormFieldKeys } from "@rebasepro/core";
5
+ import { useTranslation, useStorageSource, ErrorView, buildEnumLabel, getColorScheme, useAuthController, useCustomizationController, useAnalyticsController, IconForView, useEntityFetch, useUserSelector, UserDisplay, useSnackbarController, ErrorTooltip, useStorageUploadController, useData, useRelationSelector, getRowHeight, useLargeLayout, getEntityFromCache, getColumnKeysForProperty, DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE$1, useRebaseContext, usePermissions, useModeController, getEntityFromMemoryCache, useSlot, createFormexStub, resolveComponentRef, PluginProviderStack, saveEntityToMemoryCache, CONTAINER_FULL_WIDTH, ADDITIONAL_TAB_WIDTH, FORM_CONTAINER_WIDTH, useUnsavedChangesDialog, UnsavedChangesDialog, useColumnIds, useDataTableController, saveEntityWithCallbacks, iconSynonyms, iconsSearch, deleteEntityWithCallbacks, useUserConfigurationPersistence, useScrollRestoration, useBridgeRegistration, useAdminModeController, RebaseLogo, LanguageToggle, useRebaseRegistry, buildCollapsedDefaults, useCollapsedGroups, useInternalUserManagementController, useBuildLocalConfigurationPersistence, useRebaseClient, CustomizationControllerContext, StudioBridgeRegistryProvider, NotFoundPage, UIReferenceView, RebaseRoutes, UserSettingsView, flattenKeys, removeEntityFromCache, saveEntityToCache, removeEntityFromMemoryCache, getFormFieldKeys } from "@rebasepro/core";
6
6
  import * as React from "react";
7
7
  import React__default, { useRef, useEffect, useState, useMemo, useCallback, useSyncExternalStore, useContext, lazy, Suspense, createContext, forwardRef, memo, useLayoutEffect, createElement } from "react";
8
8
  import { isPropertyBuilder, enumToObjectEntries, getLabelOrConfigFrom, resolveArrayProperties, getEntityImagePreviewPropertyKey, resolveEnumValues, getReferenceFrom, normalizeToEntityRelation, getRelationFrom, isReadOnly, getLocalChangesBackup, resolveDefaultSelectedView, getSubcollections, removeInitialAndTrailingSlashes, 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";
@@ -1902,16 +1902,24 @@ function getEntityTitlePropertyKey(collection, propertyConfigs) {
1902
1902
  if (collection.titleProperty) {
1903
1903
  return collection.titleProperty;
1904
1904
  }
1905
- for (const key in collection.properties) {
1905
+ const orderToSearch = collection.propertiesOrder || Object.keys(collection.properties);
1906
+ let firstStringCandidate;
1907
+ for (const key of orderToSearch) {
1906
1908
  const property = collection.properties[key];
1907
- if (!isPropertyBuilder(property)) {
1909
+ if (property && !isPropertyBuilder(property)) {
1908
1910
  const prop = property;
1909
1911
  if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
1910
- return key;
1912
+ if (!firstStringCandidate) {
1913
+ firstStringCandidate = key;
1914
+ }
1915
+ const lowerKey = key.toLowerCase();
1916
+ if (["name", "title", "label", "displayname", "username"].includes(lowerKey)) {
1917
+ return key;
1918
+ }
1911
1919
  }
1912
1920
  }
1913
1921
  }
1914
- return void 0;
1922
+ return firstStringCandidate;
1915
1923
  }
1916
1924
  function EntityPreviewData({
1917
1925
  actions,
@@ -2969,7 +2977,7 @@ const UserSelector = React.forwardRef(({
2969
2977
  clearable = true,
2970
2978
  className,
2971
2979
  pageSize,
2972
- searchPlaceholder = "SearchIcon users...",
2980
+ searchPlaceholder = "Search users...",
2973
2981
  noResultsText = "No users found.",
2974
2982
  loadingText = "Loading..."
2975
2983
  }, ref) => {
@@ -4442,6 +4450,7 @@ const RelationSelector = React.forwardRef(({
4442
4450
  const [isLoadingSelectedItems, setIsLoadingSelectedItems] = useState(false);
4443
4451
  const [searchString, setSearchString] = useState("");
4444
4452
  const localSelectionIdsRef = useRef(null);
4453
+ const pinnedIdsRef = useRef(null);
4445
4454
  const {
4446
4455
  items: availableItems,
4447
4456
  isLoading,
@@ -4627,6 +4636,7 @@ const RelationSelector = React.forwardRef(({
4627
4636
  newSelected = [item_0];
4628
4637
  setIsPopoverOpen(false);
4629
4638
  isPopoverOpenRef.current = false;
4639
+ pinnedIdsRef.current = null;
4630
4640
  }
4631
4641
  setSelectedItems(newSelected);
4632
4642
  localSelectionIdsRef.current = computeSelectionFingerprint(newSelected);
@@ -4646,10 +4656,11 @@ const RelationSelector = React.forwardRef(({
4646
4656
  const handleRootOpenChange = useCallback((next) => {
4647
4657
  if (disabled) return;
4648
4658
  if (next) {
4659
+ pinnedIdsRef.current = new Set(selectedItems.map((i_1) => String(i_1.id)));
4649
4660
  setIsPopoverOpen(true);
4650
4661
  isPopoverOpenRef.current = true;
4651
4662
  }
4652
- }, [disabled]);
4663
+ }, [disabled, selectedItems]);
4653
4664
  useEffect(() => {
4654
4665
  if (!isPopoverOpen) return;
4655
4666
  function handlePointerDown(ev) {
@@ -4660,11 +4671,13 @@ const RelationSelector = React.forwardRef(({
4660
4671
  if (contentEl?.contains(target)) return;
4661
4672
  setIsPopoverOpen(false);
4662
4673
  isPopoverOpenRef.current = false;
4674
+ pinnedIdsRef.current = null;
4663
4675
  }
4664
4676
  function handleKey(ev_0) {
4665
4677
  if (ev_0.key === "Escape") {
4666
4678
  setIsPopoverOpen(false);
4667
4679
  isPopoverOpenRef.current = false;
4680
+ pinnedIdsRef.current = null;
4668
4681
  }
4669
4682
  }
4670
4683
  document.addEventListener("mousedown", handlePointerDown, true);
@@ -4678,6 +4691,7 @@ const RelationSelector = React.forwardRef(({
4678
4691
  const closePopover = useCallback(() => {
4679
4692
  setIsPopoverOpen(false);
4680
4693
  isPopoverOpenRef.current = false;
4694
+ pinnedIdsRef.current = null;
4681
4695
  }, []);
4682
4696
  const resolvedPlaceholder = placeholder || emptyPlaceholder || /* @__PURE__ */ jsx(EmptyValue, { className: "ml-2" });
4683
4697
  const portalContainer = typeof document !== "undefined" ? document.body : void 0;
@@ -4687,6 +4701,11 @@ const RelationSelector = React.forwardRef(({
4687
4701
  setIsPopoverOpen((o) => {
4688
4702
  const next_0 = !o;
4689
4703
  isPopoverOpenRef.current = next_0;
4704
+ if (next_0) {
4705
+ pinnedIdsRef.current = new Set(selectedItems.map((i_2) => String(i_2.id)));
4706
+ } else {
4707
+ pinnedIdsRef.current = null;
4708
+ }
4690
4709
  return next_0;
4691
4710
  });
4692
4711
  }, className: cls({
@@ -4763,7 +4782,15 @@ const RelationSelector = React.forwardRef(({
4763
4782
  ] }),
4764
4783
  !isLoading && availableItems.length === 0 && /* @__PURE__ */ jsx(Command.Empty, { className: "px-4 py-6 text-center text-text-secondary dark:text-text-secondary-dark", children: noResultsText }),
4765
4784
  /* @__PURE__ */ jsxs(Command.Group, { children: [
4766
- availableItems.map((item_2) => {
4785
+ (() => {
4786
+ const pinned = pinnedIdsRef.current;
4787
+ const sortedItems = pinned && pinned.size > 0 ? [...availableItems].sort((a, b) => {
4788
+ const aP = pinned.has(String(a.id)) ? 0 : 1;
4789
+ const bP = pinned.has(String(b.id)) ? 0 : 1;
4790
+ return aP - bP;
4791
+ }) : availableItems;
4792
+ return sortedItems;
4793
+ })().map((item_2) => {
4767
4794
  const isSelected_0 = selectedItems.some((v_2) => String(v_2.id) === String(item_2.id));
4768
4795
  return /* @__PURE__ */ jsxs(Command.Item, { value: String(item_2.id), onMouseDown: (e_2) => {
4769
4796
  e_2.preventDefault();
@@ -5041,25 +5068,12 @@ function getTableBindingForProperty(property, selected) {
5041
5068
  if (property.relation) {
5042
5069
  if (property.ui?.widget === "dialog") {
5043
5070
  return {
5044
- Component: ({
5045
- propertyKey,
5046
- internalValue,
5047
- updateValue,
5048
- disabled,
5049
- size,
5050
- property: property2
5051
- }) => /* @__PURE__ */ jsx(TableRelationField, { name: propertyKey, internalValue, updateValue, disabled, size, multiselect: false, relation: property2.relation, previewProperties: property2.ui?.previewProperties, includeId: property2.includeId, includeEntityLink: property2.includeEntityLink, title: property2.name ?? propertyKey, fixedFilter: property2.fixedFilter }),
5071
+ Component: RelationDialogBindingComponent,
5052
5072
  allowScroll: false
5053
5073
  };
5054
5074
  } else {
5055
5075
  return {
5056
- Component: ({
5057
- propertyKey,
5058
- internalValue,
5059
- updateValue,
5060
- disabled,
5061
- property: property2
5062
- }) => /* @__PURE__ */ jsx(TableRelationSelectorField, { name: propertyKey, internalValue, updateValue, disabled, size: "small", relation: property2.relation, fixedFilter: property2.fixedFilter }),
5076
+ Component: RelationSelectorBindingComponent,
5063
5077
  allowScroll: false
5064
5078
  };
5065
5079
  }
@@ -5106,6 +5120,64 @@ function getTableBindingForProperty(property, selected) {
5106
5120
  }
5107
5121
  return void 0;
5108
5122
  }
5123
+ function RelationDialogBindingComponent(t0) {
5124
+ const $ = c(12);
5125
+ const {
5126
+ propertyKey,
5127
+ internalValue,
5128
+ updateValue,
5129
+ disabled,
5130
+ size,
5131
+ property
5132
+ } = t0;
5133
+ const t1 = internalValue;
5134
+ const t2 = property.ui?.previewProperties;
5135
+ const t3 = property.name ?? propertyKey;
5136
+ let t4;
5137
+ if ($[0] !== disabled || $[1] !== property.fixedFilter || $[2] !== property.includeEntityLink || $[3] !== property.includeId || $[4] !== property.relation || $[5] !== propertyKey || $[6] !== size || $[7] !== t1 || $[8] !== t2 || $[9] !== t3 || $[10] !== updateValue) {
5138
+ t4 = /* @__PURE__ */ jsx(TableRelationField, { name: propertyKey, internalValue: t1, updateValue, disabled, size, multiselect: false, relation: property.relation, previewProperties: t2, includeId: property.includeId, includeEntityLink: property.includeEntityLink, title: t3, fixedFilter: property.fixedFilter });
5139
+ $[0] = disabled;
5140
+ $[1] = property.fixedFilter;
5141
+ $[2] = property.includeEntityLink;
5142
+ $[3] = property.includeId;
5143
+ $[4] = property.relation;
5144
+ $[5] = propertyKey;
5145
+ $[6] = size;
5146
+ $[7] = t1;
5147
+ $[8] = t2;
5148
+ $[9] = t3;
5149
+ $[10] = updateValue;
5150
+ $[11] = t4;
5151
+ } else {
5152
+ t4 = $[11];
5153
+ }
5154
+ return t4;
5155
+ }
5156
+ function RelationSelectorBindingComponent(t0) {
5157
+ const $ = c(7);
5158
+ const {
5159
+ propertyKey,
5160
+ internalValue,
5161
+ updateValue,
5162
+ disabled,
5163
+ property
5164
+ } = t0;
5165
+ const t1 = internalValue;
5166
+ let t2;
5167
+ if ($[0] !== disabled || $[1] !== property.fixedFilter || $[2] !== property.relation || $[3] !== propertyKey || $[4] !== t1 || $[5] !== updateValue) {
5168
+ t2 = /* @__PURE__ */ jsx(TableRelationSelectorField, { name: propertyKey, internalValue: t1, updateValue, disabled, size: "small", relation: property.relation, fixedFilter: property.fixedFilter });
5169
+ $[0] = disabled;
5170
+ $[1] = property.fixedFilter;
5171
+ $[2] = property.relation;
5172
+ $[3] = propertyKey;
5173
+ $[4] = t1;
5174
+ $[5] = updateValue;
5175
+ $[6] = t2;
5176
+ } else {
5177
+ t2 = $[6];
5178
+ }
5179
+ return t2;
5180
+ }
5109
5181
  const TableCellInner = (t0) => {
5110
5182
  const $ = c(12);
5111
5183
  const {
@@ -5316,7 +5388,7 @@ const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
5316
5388
  const t11 = `flex relative h-full rounded-md p-${p} border-4`;
5317
5389
  const t12 = showSaved ? "bg-primary/20 dark:bg-primary/20" : onHover && !disabled ? "bg-surface-50 dark:bg-surface-900" : "";
5318
5390
  const t13 = hideOverflow ? "overflow-hidden" : "";
5319
- const t14 = isSelected && !showSaved ? "bg-surface-50 dark:bg-surface-900" : "";
5391
+ const t14 = isSelected && !showSaved ? "bg-surface-accent-50 dark:bg-surface-accent-900" : "";
5320
5392
  let t15;
5321
5393
  if ($[11] !== borderClass || $[12] !== t11 || $[13] !== t12 || $[14] !== t13 || $[15] !== t14) {
5322
5394
  t15 = cls("transition-colors duration-500", t11, t12, t13, t14, borderClass);
@@ -5418,7 +5490,7 @@ const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
5418
5490
  }
5419
5491
  let t25;
5420
5492
  if ($[43] !== error?.message || $[44] !== frozen || $[45] !== result || $[46] !== showError || $[47] !== sortableAttrsWithoutTabIndex || $[48] !== sortableNodeRef || $[49] !== sortableStyle) {
5421
- t25 = sortableNodeRef ? /* @__PURE__ */ jsx("div", { ref: sortableNodeRef, style: sortableStyle, className: cls("flex-shrink-0", frozen && "sticky left-0 z-10 bg-white dark:bg-surface-800"), ...sortableAttrsWithoutTabIndex, children: showError ? /* @__PURE__ */ jsx(ErrorTooltip, { className: "flex h-full w-full", align: "start", title: error?.message ?? "Error", children: result }) : result }) : showError ? /* @__PURE__ */ jsx(ErrorTooltip, { className: "flex h-full w-full", align: "start", title: error?.message ?? "Error", children: result }) : result;
5493
+ t25 = sortableNodeRef ? /* @__PURE__ */ jsx("div", { ref: sortableNodeRef, style: sortableStyle, className: cls("flex-shrink-0", frozen && "sticky left-0 z-10 bg-white dark:bg-surface-900"), ...sortableAttrsWithoutTabIndex, children: showError ? /* @__PURE__ */ jsx(ErrorTooltip, { className: "flex h-full w-full", align: "start", title: error?.message ?? "Error", children: result }) : result }) : showError ? /* @__PURE__ */ jsx(ErrorTooltip, { className: "flex h-full w-full", align: "start", title: error?.message ?? "Error", children: result }) : result;
5422
5494
  $[43] = error?.message;
5423
5495
  $[44] = frozen;
5424
5496
  $[45] = result;
@@ -5684,7 +5756,7 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
5684
5756
  const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;
5685
5757
  const hasDraft = enableLocalChangesBackup ? getEntityFromCache(path + "/" + entity.id) : false;
5686
5758
  const iconSize2 = "small";
5687
- const content = /* @__PURE__ */ jsxs("div", { className: cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-800 bg-opacity-90 bg-surface-50/90 dark:bg-opacity-90 dark:bg-surface-800/90 z-10", "h-full flex items-center justify-center flex-col bg-surface-50/90 dark:bg-surface-800/90 z-10", frozen ? "sticky left-0" : ""), onClick: useCallback((event) => {
5759
+ const content = /* @__PURE__ */ jsxs("div", { className: cls("h-full flex items-center justify-center flex-col z-10", isSelected ? "bg-surface-accent-50 dark:bg-surface-accent-900" : "bg-surface-50/90 dark:bg-surface-900/90", frozen ? "sticky left-0" : ""), onClick: useCallback((event) => {
5688
5760
  event.stopPropagation();
5689
5761
  }, []), style: {
5690
5762
  width,
@@ -5747,12 +5819,12 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
5747
5819
  tabIndex: _tabIndex,
5748
5820
  ...sortableAttrsWithoutTabIndex
5749
5821
  } = sortableAttributes ?? {};
5750
- return /* @__PURE__ */ jsx("div", { ref: sortableNodeRef, style: sortableStyle, className: cls("flex-shrink-0", frozen && "sticky left-0 z-10 bg-white dark:bg-surface-800"), ...sortableAttrsWithoutTabIndex, children: content });
5822
+ return /* @__PURE__ */ jsx("div", { ref: sortableNodeRef, style: sortableStyle, className: cls("flex-shrink-0", frozen && "sticky left-0 z-10 bg-white dark:bg-surface-900"), ...sortableAttrsWithoutTabIndex, children: content });
5751
5823
  }
5752
5824
  return content;
5753
5825
  };
5754
5826
  function CollectionTableToolbar(t0) {
5755
- const $ = c(37);
5827
+ const $ = c(38);
5756
5828
  const {
5757
5829
  actions,
5758
5830
  actionsStart,
@@ -5760,6 +5832,7 @@ function CollectionTableToolbar(t0) {
5760
5832
  onTextSearch,
5761
5833
  title,
5762
5834
  viewModeToggle,
5835
+ initialSearchText,
5763
5836
  compact: t1
5764
5837
  } = t0;
5765
5838
  const compact = t1 === void 0 ? false : t1;
@@ -5808,7 +5881,7 @@ function CollectionTableToolbar(t0) {
5808
5881
  }
5809
5882
  let t7;
5810
5883
  if ($[9] !== title) {
5811
- t7 = title && /* @__PURE__ */ jsx("div", { className: "hidden lg:block", children: title });
5884
+ t7 = title && /* @__PURE__ */ jsx("div", { className: "flex items-center", children: title });
5812
5885
  $[9] = title;
5813
5886
  $[10] = t7;
5814
5887
  } else {
@@ -5848,58 +5921,59 @@ function CollectionTableToolbar(t0) {
5848
5921
  t11 = $[20];
5849
5922
  }
5850
5923
  let t12;
5851
- if ($[21] !== onTextSearch || $[22] !== t) {
5852
- t12 = onTextSearch && /* @__PURE__ */ jsx(SearchBar, { size: "small", placeholder: t("search"), onTextSearch, expandable: true }, "search-bar");
5853
- $[21] = onTextSearch;
5854
- $[22] = t;
5855
- $[23] = t12;
5924
+ if ($[21] !== initialSearchText || $[22] !== onTextSearch || $[23] !== t) {
5925
+ t12 = onTextSearch && /* @__PURE__ */ jsx(SearchBar, { size: "small", placeholder: t("search"), onTextSearch, expandable: true, initialValue: initialSearchText }, "search-bar");
5926
+ $[21] = initialSearchText;
5927
+ $[22] = onTextSearch;
5928
+ $[23] = t;
5929
+ $[24] = t12;
5856
5930
  } else {
5857
- t12 = $[23];
5931
+ t12 = $[24];
5858
5932
  }
5859
5933
  let t13;
5860
- if ($[24] !== t11 || $[25] !== t12) {
5934
+ if ($[25] !== t11 || $[26] !== t12) {
5861
5935
  t13 = /* @__PURE__ */ jsx("div", { className: t11, children: t12 });
5862
- $[24] = t11;
5863
- $[25] = t12;
5864
- $[26] = t13;
5936
+ $[25] = t11;
5937
+ $[26] = t12;
5938
+ $[27] = t13;
5865
5939
  } else {
5866
- t13 = $[26];
5940
+ t13 = $[27];
5867
5941
  }
5868
5942
  let t14;
5869
- if ($[27] !== secondaryActions) {
5943
+ if ($[28] !== secondaryActions) {
5870
5944
  t14 = /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: secondaryActions });
5871
- $[27] = secondaryActions;
5872
- $[28] = t14;
5945
+ $[28] = secondaryActions;
5946
+ $[29] = t14;
5873
5947
  } else {
5874
- t14 = $[28];
5948
+ t14 = $[29];
5875
5949
  }
5876
5950
  let t15;
5877
- if ($[29] !== addButton || $[30] !== t13 || $[31] !== t14 || $[32] !== t9) {
5951
+ if ($[30] !== addButton || $[31] !== t13 || $[32] !== t14 || $[33] !== t9) {
5878
5952
  t15 = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
5879
5953
  t9,
5880
5954
  t13,
5881
5955
  t14,
5882
5956
  addButton
5883
5957
  ] });
5884
- $[29] = addButton;
5885
- $[30] = t13;
5886
- $[31] = t14;
5887
- $[32] = t9;
5888
- $[33] = t15;
5958
+ $[30] = addButton;
5959
+ $[31] = t13;
5960
+ $[32] = t14;
5961
+ $[33] = t9;
5962
+ $[34] = t15;
5889
5963
  } else {
5890
- t15 = $[33];
5964
+ t15 = $[34];
5891
5965
  }
5892
5966
  let t16;
5893
- if ($[34] !== t15 || $[35] !== t8) {
5967
+ if ($[35] !== t15 || $[36] !== t8) {
5894
5968
  t16 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
5895
5969
  t8,
5896
5970
  t15
5897
5971
  ] });
5898
- $[34] = t15;
5899
- $[35] = t8;
5900
- $[36] = t16;
5972
+ $[35] = t15;
5973
+ $[36] = t8;
5974
+ $[37] = t16;
5901
5975
  } else {
5902
- t16 = $[36];
5976
+ t16 = $[37];
5903
5977
  }
5904
5978
  return t16;
5905
5979
  }
@@ -6868,7 +6942,7 @@ const SelectableTable = function SelectableTable2({
6868
6942
  size: size ?? "m",
6869
6943
  selectionStore
6870
6944
  }), [setPopupCell, select, onValueChange, size, selectionStore]);
6871
- return /* @__PURE__ */ jsx(SelectableTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full flex flex-col bg-white dark:bg-surface-800", ref, children: /* @__PURE__ */ jsx(
6945
+ 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(
6872
6946
  VirtualTable,
6873
6947
  {
6874
6948
  data,
@@ -6891,7 +6965,7 @@ const SelectableTable = function SelectableTable2({
6891
6965
  checkFilterCombination,
6892
6966
  createFilterField: filterable ? createFilterField : void 0,
6893
6967
  rowClassName: useCallback((entity) => {
6894
- return highlightedRow?.(entity) ? "bg-surface-50/75 bg-surface-100/75 dark:!bg-surface-800/60" : "";
6968
+ return highlightedRow?.(entity) ? "bg-surface-accent-50 dark:!bg-surface-accent-900" : "";
6895
6969
  }, [highlightedRow]),
6896
6970
  className: "grow",
6897
6971
  emptyComponent,
@@ -7113,7 +7187,7 @@ const EntityCollectionTable = function EntityCollectionTable2({
7113
7187
  return /* @__PURE__ */ jsx(EntityTableCell, { size, width: column_1.width, savedTimestamp: void 0, value: null, align: "left", fullHeight: false, disabled: true, sortableNodeRef: props.sortableNodeRef, sortableStyle: props.sortableStyle, sortableAttributes: props.sortableAttributes, isDragging: props.isDragging, isDraggable: props.isDraggable, frozen: props.frozen, children: /* @__PURE__ */ jsx(ErrorView, { error: e instanceof Error ? e : new Error(String(e)) }) });
7114
7188
  }
7115
7189
  }, [tableRowActionsBuilder, additionalCellRenderer, propertyCellRenderer, size]);
7116
- return /* @__PURE__ */ jsxs("div", { ref, style, className: cls("h-full w-full flex flex-col bg-white dark:bg-surface-800", className), children: [
7190
+ return /* @__PURE__ */ jsxs("div", { ref, style, className: cls("h-full w-full flex flex-col bg-white dark:bg-surface-900", className), children: [
7117
7191
  !hideToolbar && /* @__PURE__ */ jsx(CollectionTableToolbar, { onTextSearch, title, actionsStart, actions, viewModeToggle, loading: tableController.dataLoading }),
7118
7192
  /* @__PURE__ */ jsx(SelectableTable, { columns, size, inlineEditing, cellRenderer, onEntityClick, highlightedRow: useCallback((entity_1) => Boolean(selectedEntities?.find((e_0) => e_0.id === entity_1.id && e_0.path === entity_1.path)), [selectedEntities]), tableController, onValueChange, initialScroll, onScroll, onColumnResize, hoverRow, filterable, emptyComponent, endAdornment, AddColumnComponent, onColumnsOrderChange, extraData: useMemo(() => ({
7119
7193
  selectedEntityIds: selectedEntities?.map((e_1) => e_1.id)
@@ -7148,7 +7222,7 @@ function useSelectionController(onSelectionChange) {
7148
7222
  toggleEntitySelection
7149
7223
  }), [selectedEntities, setSelectedEntities, isEntitySelected, toggleEntitySelection]);
7150
7224
  }
7151
- const EntityHistoryView$1 = lazy(() => import("./index-CNDetux9.js").then((m) => ({
7225
+ const EntityHistoryView$1 = lazy(() => import("./index-CS6uJ7oW.js").then((m) => ({
7152
7226
  default: m.EntityHistoryView
7153
7227
  })));
7154
7228
  const BUILTIN_ENTITY_VIEWS = {
@@ -7524,14 +7598,14 @@ function EntityJsonPreview(t0) {
7524
7598
  }
7525
7599
  return t4;
7526
7600
  }
7527
- const EntityHistoryView = lazy(() => import("./index-CNDetux9.js").then((m) => ({
7601
+ const EntityHistoryView = lazy(() => import("./index-CS6uJ7oW.js").then((m) => ({
7528
7602
  default: m.EntityHistoryView
7529
7603
  })));
7530
7604
  const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
7531
7605
  const JSON_TAB_VALUE = "__json";
7532
7606
  const HISTORY_TAB_VALUE = "__rebase_history";
7533
7607
  function EntityEditView(t0) {
7534
- const $ = c(27);
7608
+ const $ = c(28);
7535
7609
  let entityId;
7536
7610
  let props;
7537
7611
  if ($[0] !== t0) {
@@ -7569,13 +7643,14 @@ function EntityEditView(t0) {
7569
7643
  dataLoadingError
7570
7644
  } = useEntityFetch(t1);
7571
7645
  let t2;
7572
- if ($[8] !== entityId || $[9] !== props.path) {
7573
- t2 = entityId ? getEntityFromMemoryCache(props.path + "/" + entityId) : getEntityFromMemoryCache(props.path + "#new");
7646
+ if ($[8] !== entityId || $[9] !== props.defaultValues || $[10] !== props.path) {
7647
+ t2 = entityId ? getEntityFromMemoryCache(props.path + "/" + entityId) : props.defaultValues ?? getEntityFromMemoryCache(props.path + "#new");
7574
7648
  $[8] = entityId;
7575
- $[9] = props.path;
7576
- $[10] = t2;
7649
+ $[9] = props.defaultValues;
7650
+ $[10] = props.path;
7651
+ $[11] = t2;
7577
7652
  } else {
7578
- t2 = $[10];
7653
+ t2 = $[11];
7579
7654
  }
7580
7655
  const initialDirtyValues = t2;
7581
7656
  const {
@@ -7588,55 +7663,55 @@ function EntityEditView(t0) {
7588
7663
  t3 = true;
7589
7664
  } else {
7590
7665
  let t42;
7591
- if ($[11] !== canEditHook || $[12] !== entity || $[13] !== props.collection || $[14] !== props.path) {
7666
+ if ($[12] !== canEditHook || $[13] !== entity || $[14] !== props.collection || $[15] !== props.path) {
7592
7667
  t42 = entity ? canEditHook(props.collection, props.path, entity ?? null) : void 0;
7593
- $[11] = canEditHook;
7594
- $[12] = entity;
7595
- $[13] = props.collection;
7596
- $[14] = props.path;
7597
- $[15] = t42;
7668
+ $[12] = canEditHook;
7669
+ $[13] = entity;
7670
+ $[14] = props.collection;
7671
+ $[15] = props.path;
7672
+ $[16] = t42;
7598
7673
  } else {
7599
- t42 = $[15];
7674
+ t42 = $[16];
7600
7675
  }
7601
7676
  t3 = t42;
7602
7677
  }
7603
7678
  const canEdit = t3;
7604
7679
  if (!dataLoading && dataLoadingError) {
7605
7680
  let t42;
7606
- if ($[16] !== dataLoadingError) {
7681
+ if ($[17] !== dataLoadingError) {
7607
7682
  t42 = /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(ErrorView, { error: dataLoadingError }) });
7608
- $[16] = dataLoadingError;
7609
- $[17] = t42;
7683
+ $[17] = dataLoadingError;
7684
+ $[18] = t42;
7610
7685
  } else {
7611
- t42 = $[17];
7686
+ t42 = $[18];
7612
7687
  }
7613
7688
  return t42;
7614
7689
  }
7615
7690
  if (!dataLoading && !initialDirtyValues && !entity && (status === "existing" || status === "copy")) {
7616
7691
  console.error(`Entity with id ${entityId} not found in collection ${props.path}`);
7617
7692
  let t42;
7618
- if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
7693
+ if ($[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
7619
7694
  t42 = /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(Typography, { variant: "label", children: "Entity not found" }) });
7620
- $[18] = t42;
7695
+ $[19] = t42;
7621
7696
  } else {
7622
- t42 = $[18];
7697
+ t42 = $[19];
7623
7698
  }
7624
7699
  return t42;
7625
7700
  }
7626
7701
  const t4 = initialDirtyValues;
7627
7702
  let t5;
7628
- if ($[19] !== canEdit || $[20] !== dataLoading || $[21] !== entity || $[22] !== entityId || $[23] !== props || $[24] !== status || $[25] !== t4) {
7703
+ if ($[20] !== canEdit || $[21] !== dataLoading || $[22] !== entity || $[23] !== entityId || $[24] !== props || $[25] !== status || $[26] !== t4) {
7629
7704
  t5 = /* @__PURE__ */ jsx(EntityEditViewInner, { ...props, entityId, entity, initialDirtyValues: t4, dataLoading, status, setStatus, canEdit });
7630
- $[19] = canEdit;
7631
- $[20] = dataLoading;
7632
- $[21] = entity;
7633
- $[22] = entityId;
7634
- $[23] = props;
7635
- $[24] = status;
7636
- $[25] = t4;
7637
- $[26] = t5;
7705
+ $[20] = canEdit;
7706
+ $[21] = dataLoading;
7707
+ $[22] = entity;
7708
+ $[23] = entityId;
7709
+ $[24] = props;
7710
+ $[25] = status;
7711
+ $[26] = t4;
7712
+ $[27] = t5;
7638
7713
  } else {
7639
- t5 = $[26];
7714
+ t5 = $[27];
7640
7715
  }
7641
7716
  return t5;
7642
7717
  }
@@ -7671,7 +7746,7 @@ function EntityEditViewInner({
7671
7746
  useLargeLayout();
7672
7747
  const customizationController = useCustomizationController();
7673
7748
  const plugins = customizationController.plugins;
7674
- const formActionTopProps = {
7749
+ const formActionTopProps = useMemo(() => ({
7675
7750
  entityId,
7676
7751
  parentCollectionSlugs,
7677
7752
  parentEntityIds,
@@ -7682,7 +7757,7 @@ function EntityEditViewInner({
7682
7757
  formContext,
7683
7758
  openEntityMode: layout,
7684
7759
  disabled: false
7685
- };
7760
+ }), [entityId, parentCollectionSlugs, parentEntityIds, path, status, collection, context, formContext, layout]);
7686
7761
  const pluginActionsTop = useSlot("form.actions.top", formActionTopProps);
7687
7762
  const defaultSelectedView = useMemo(() => resolveDefaultSelectedView(collection ? collection.defaultSelectedView : void 0, {
7688
7763
  status,
@@ -7709,18 +7784,15 @@ function EntityEditViewInner({
7709
7784
  } = resolvedSelectedEntityView(customViews, customizationController, selectedTab);
7710
7785
  const actionsAtTheBottom = layout === "side_panel" || selectedEntityView?.includeActions === "bottom";
7711
7786
  const mainViewVisible = selectedTab === MAIN_TAB_VALUE || Boolean(selectedSecondaryForm);
7712
- const customViewsView = customViews && resolvedEntityViews.filter((e) => !e.includeActions).map((customView) => {
7713
- if (!customView) return null;
7714
- const Builder = customView.Builder;
7715
- if (!Builder) {
7716
- console.error("INTERNAL: customView.Builder is not defined");
7717
- return null;
7718
- }
7719
- if (!entityId) {
7720
- return null;
7721
- }
7787
+ const mountedTabsRef = useRef(/* @__PURE__ */ new Set());
7788
+ if (selectedTab) {
7789
+ mountedTabsRef.current.add(selectedTab);
7790
+ }
7791
+ const readOnlyFormContext = useMemo(() => {
7792
+ if (formContext) return void 0;
7793
+ if (!entityId) return void 0;
7722
7794
  const formexStub = createFormexStub(usedEntity?.values ?? {});
7723
- const usedFormContext = formContext ?? {
7795
+ return {
7724
7796
  entityId,
7725
7797
  disabled: false,
7726
7798
  openEntityMode: layout,
@@ -7738,17 +7810,34 @@ function EntityEditViewInner({
7738
7810
  savingError: void 0,
7739
7811
  formex: formexStub
7740
7812
  };
7813
+ }, [formContext, entityId, layout, status, usedEntity, collection, path]);
7814
+ const nonActionCustomViews = useMemo(() => resolvedEntityViews.filter((e) => !e.includeActions), [resolvedEntityViews]);
7815
+ const customViewsView = customViews && nonActionCustomViews.map((customView) => {
7816
+ if (!customView) return null;
7817
+ const Builder = resolveComponentRef(customView.Builder);
7818
+ if (!Builder) {
7819
+ console.error("INTERNAL: customView.Builder is not defined or could not be resolved");
7820
+ return null;
7821
+ }
7822
+ if (!entityId) {
7823
+ return null;
7824
+ }
7825
+ const isActive = selectedTab === customView.key;
7826
+ const hasBeenMounted = mountedTabsRef.current.has(customView.key);
7827
+ if (!isActive && !hasBeenMounted) {
7828
+ return null;
7829
+ }
7830
+ const usedFormContext = formContext ?? readOnlyFormContext;
7741
7831
  return /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
7742
- "hidden": selectedTab !== customView.key
7743
- }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: usedFormContext && /* @__PURE__ */ jsx(Builder, { collection, parentCollectionSlugs, parentEntityIds, entity: usedEntity, modifiedValues: usedFormContext?.formex?.values ?? usedEntity?.values, formContext: usedFormContext }) }) }, `custom_view_${customView.key}`);
7832
+ "hidden": !isActive
7833
+ }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: usedFormContext && /* @__PURE__ */ jsx(Builder, { collection, parentCollectionSlugs, parentEntityIds, entity: usedEntity, modifiedValues: usedFormContext?.formex?.values ?? usedEntity?.values, formContext: usedFormContext }) }) }) }, `custom_view_${customView.key}`);
7744
7834
  }).filter(Boolean);
7745
7835
  const globalLoading = dataLoading && !usedEntity || canEdit === void 0 && (status === "existing" || status === "copy");
7746
- const jsonView = /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
7836
+ const jsonTabMounted = mountedTabsRef.current.has(JSON_TAB_VALUE);
7837
+ const jsonView = selectedTab === JSON_TAB_VALUE || jsonTabMounted ? /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
7747
7838
  "hidden": selectedTab !== JSON_TAB_VALUE
7748
- }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(EntityJsonPreview, { values: formContext?.values ?? entity?.values ?? {} }) }) }, "json_view");
7749
- const historyView = includeHistoryView ? /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
7750
- "hidden": selectedTab !== HISTORY_TAB_VALUE
7751
- }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: /* @__PURE__ */ jsx(EntityHistoryView, { collection, entity: usedEntity, formContext, modifiedValues: formContext?.values ?? usedEntity?.values }) }) }) }, "history_view") : null;
7839
+ }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(EntityJsonPreview, { values: formContext?.values ?? entity?.values ?? {} }) }) }, "json_view") : null;
7840
+ 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, { collection, entity: usedEntity, formContext, modifiedValues: formContext?.values ?? usedEntity?.values }) }) }) }, "history_view") : null;
7752
7841
  const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
7753
7842
  const subcollectionId = subcollection.slug;
7754
7843
  const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.slug)}` : void 0;
@@ -7758,7 +7847,7 @@ function EntityEditViewInner({
7758
7847
  !globalLoading && (usedEntity && newFullPath ? /* @__PURE__ */ jsx(EntityCollectionView, { path: newFullPath, parentCollectionSlugs: [...parentCollectionSlugs, collection.slug], parentEntityIds: [...parentEntityIds, String(usedEntity?.id)], updateUrl: false, ...subcollection, openEntityMode: layout }) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-full h-full p-3", children: /* @__PURE__ */ jsx(Typography, { variant: "label", children: "You need to save your entity before adding additional collections" }) }))
7759
7848
  ] }, `subcol_${subcollectionId}`);
7760
7849
  }).filter(Boolean);
7761
- const onSideTabClick = (value_0) => {
7850
+ const onSideTabClick = useCallback((value_0) => {
7762
7851
  setSelectedTab(value_0);
7763
7852
  if (status === "existing") {
7764
7853
  onTabChange?.({
@@ -7768,7 +7857,7 @@ function EntityEditViewInner({
7768
7857
  collection
7769
7858
  });
7770
7859
  }
7771
- };
7860
+ }, [status, onTabChange, path, entityId, collection]);
7772
7861
  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: [
7773
7862
  /* @__PURE__ */ jsx(Typography, { className: "mt-16 mb-8 mx-8", variant: "h4", children: collection.singularName ?? collection.name }),
7774
7863
  /* @__PURE__ */ jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
@@ -7790,7 +7879,7 @@ function EntityEditViewInner({
7790
7879
  };
7791
7880
  onSaved?.(res);
7792
7881
  formProps?.onSaved?.(res);
7793
- }, Builder: selectedSecondaryForm?.Builder });
7882
+ }, Builder: resolveComponentRef(selectedSecondaryForm?.Builder) });
7794
7883
  const subcollectionTabs = subcollections && subcollections.map((subcollection_0) => /* @__PURE__ */ jsx(Tab, { className: "text-sm min-w-[90px]", value: subcollection_0.slug, children: subcollection_0.name }, `entity_detail_collection_tab_${subcollection_0.name}`));
7795
7884
  const customViewTabsStart = resolvedEntityViews.filter((view) => view.position === "start").map((view_0) => /* @__PURE__ */ jsx(Tab, { className: !view_0.tabComponent ? "text-sm min-w-[90px]" : void 0, value: view_0.key, children: view_0.tabComponent ?? view_0.name }, `entity_detail_collection_tab_${view_0.name}`));
7796
7885
  const customViewTabsEnd = resolvedEntityViews.filter((view_1) => !view_1.position || view_1.position === "end").map((view_2) => /* @__PURE__ */ jsx(Tab, { className: !view_2.tabComponent ? "text-sm min-w-[90px]" : void 0, value: view_2.key, children: view_2.tabComponent ?? view_2.name }, `entity_detail_collection_tab_${view_2.name}`));
@@ -7799,29 +7888,6 @@ function EntityEditViewInner({
7799
7888
  const entityUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);
7800
7889
  navigate(`${entityUrl}#full`);
7801
7890
  }, children: /* @__PURE__ */ jsx(Maximize2Icon, { size: iconSize.smallest }) }) }) : null;
7802
- const subcollectionContextTitle = useMemo(() => {
7803
- if (selectedTab === MAIN_TAB_VALUE || selectedTab === JSON_TAB_VALUE || selectedTab === HISTORY_TAB_VALUE) {
7804
- return null;
7805
- }
7806
- const matchedSubcollection = subcollections.find((sc) => sc.slug === selectedTab);
7807
- if (!matchedSubcollection) {
7808
- return null;
7809
- }
7810
- const isCustomView = resolvedEntityViews.some((v) => v.key === selectedTab);
7811
- if (isCustomView) {
7812
- return null;
7813
- }
7814
- const titleKey = getEntityTitlePropertyKey(collection, customizationController.propertyConfigs);
7815
- const entityValues = usedEntity?.values;
7816
- if (!titleKey || !entityValues) {
7817
- return matchedSubcollection.name;
7818
- }
7819
- const titleValue = entityValues[titleKey];
7820
- if (!titleValue || typeof titleValue !== "string") {
7821
- return matchedSubcollection.name;
7822
- }
7823
- return `${matchedSubcollection.name} of ${titleValue}`;
7824
- }, [selectedTab, subcollections, resolvedEntityViews, collection, customizationController.propertyConfigs, usedEntity?.values]);
7825
7891
  let result = /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col h-full w-full bg-white dark:bg-surface-800", children: [
7826
7892
  shouldShowTopBar && /* @__PURE__ */ jsxs("div", { className: cls("h-[52px] items-center flex overflow-hidden w-full border-b pl-2 pr-2 flex bg-surface-50 dark:bg-surface-900", defaultBorderMixin), children: [
7827
7893
  fullScreenButton,
@@ -7831,7 +7897,6 @@ function EntityEditViewInner({
7831
7897
  values: formContext?.values ?? usedEntity?.values ?? {},
7832
7898
  status
7833
7899
  }),
7834
- subcollectionContextTitle && /* @__PURE__ */ jsx(Typography, { variant: "label", className: "truncate min-w-0 shrink ml-2 text-surface-600 dark:text-surface-400", children: subcollectionContextTitle }),
7835
7900
  pluginActionsTop,
7836
7901
  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_1) => {
7837
7902
  onSideTabClick(value_1);
@@ -7972,7 +8037,7 @@ function EntitySidePanel(props) {
7972
8037
  close
7973
8038
  } = useSideDialogContext();
7974
8039
  const navigate = useNavigate();
7975
- useLocation();
8040
+ const location = useLocation();
7976
8041
  const sideEntityController = useSideEntityController();
7977
8042
  const collectionRegistryController = useCollectionRegistryController();
7978
8043
  const sideDialogsController = useSideDialogContext();
@@ -8047,13 +8112,15 @@ function EntitySidePanel(props) {
8047
8112
  selectedTab,
8048
8113
  collection: collection_0
8049
8114
  }) => {
8050
- sideEntityController.replace({
8051
- path,
8052
- entityId: entityId_0,
8053
- selectedTab,
8054
- updateUrl: true,
8055
- collection: collection_0
8056
- });
8115
+ if (entityId_0) {
8116
+ const collectionPath = removeInitialAndTrailingSlashes(path);
8117
+ const tabSuffix = selectedTab ? "/" + selectedTab : "";
8118
+ const fullUrl = urlController.buildUrlCollectionPath(`${collectionPath}/${entityId_0}${tabSuffix}#side`);
8119
+ navigate(fullUrl, {
8120
+ replace: true,
8121
+ state: location.state
8122
+ });
8123
+ }
8057
8124
  }, formProps }) }) });
8058
8125
  }
8059
8126
  const NEW_URL_HASH = "new_side";
@@ -8546,7 +8613,7 @@ function getGroup(collectionOrView) {
8546
8613
  if (!trimmed || trimmed === "") {
8547
8614
  return NAVIGATION_DEFAULT_GROUP_NAME;
8548
8615
  }
8549
- return trimmed ?? NAVIGATION_DEFAULT_GROUP_NAME;
8616
+ return trimmed;
8550
8617
  }
8551
8618
  function computeNavigationGroups({
8552
8619
  navigationGroupMappings,
@@ -8742,10 +8809,10 @@ function viewSlugsEqual(a, b) {
8742
8809
  }
8743
8810
  return true;
8744
8811
  }
8745
- const UsersView$1 = lazy(() => import("./UsersView-BM2_7VPV.js").then((m) => ({
8812
+ const UsersView$1 = lazy(() => import("./UsersView-BkeblMVT.js").then((m) => ({
8746
8813
  default: m.UsersView
8747
8814
  })));
8748
- const RolesView$1 = lazy(() => import("./RolesView-B0E7L0hE.js").then((m) => ({
8815
+ const RolesView$1 = lazy(() => import("./RolesView-CMPsaIXo.js").then((m) => ({
8749
8816
  default: m.RolesView
8750
8817
  })));
8751
8818
  function useResolvedViews(props) {
@@ -8797,7 +8864,6 @@ function useResolvedViews(props) {
8797
8864
  views.push({
8798
8865
  slug: "users",
8799
8866
  name: "Users",
8800
- group: NAVIGATION_ADMIN_GROUP_NAME,
8801
8867
  icon: "Headset",
8802
8868
  view: usersViewElement
8803
8869
  });
@@ -8805,7 +8871,6 @@ function useResolvedViews(props) {
8805
8871
  views.push({
8806
8872
  slug: "roles",
8807
8873
  name: "Roles",
8808
- group: NAVIGATION_ADMIN_GROUP_NAME,
8809
8874
  icon: "Shield",
8810
8875
  view: rolesViewElement
8811
8876
  });
@@ -8949,7 +9014,7 @@ function useTopLevelNavigation(props) {
8949
9014
  }, []), ...(adminViews ?? []).reduce((acc_1, adminView) => {
8950
9015
  if (adminView.hideFromNavigation) return acc_1;
8951
9016
  const pathKey_1 = adminView.slug;
8952
- let groupName_1 = adminView.group?.trim() || NAVIGATION_ADMIN_GROUP_NAME;
9017
+ let groupName_1 = NAVIGATION_ADMIN_GROUP_NAME;
8953
9018
  if (finalNavigationGroupMappings) {
8954
9019
  for (const pluginGroupDef_1 of finalNavigationGroupMappings) {
8955
9020
  if (pluginGroupDef_1.entries.includes(pathKey_1)) {
@@ -9779,6 +9844,7 @@ function navigateToEntity({
9779
9844
  copy,
9780
9845
  path,
9781
9846
  selectedTab,
9847
+ defaultValues,
9782
9848
  sideEntityController,
9783
9849
  onClose,
9784
9850
  navigation
@@ -9791,7 +9857,8 @@ function navigateToEntity({
9791
9857
  selectedTab,
9792
9858
  collection,
9793
9859
  updateUrl: true,
9794
- onClose
9860
+ onClose,
9861
+ defaultValues
9795
9862
  });
9796
9863
  } else {
9797
9864
  let to = navigation.buildUrlCollectionPath(entityId ? `${path ?? path}/${entityId}` : path ?? path);
@@ -9808,7 +9875,11 @@ function navigateToEntity({
9808
9875
  if (copy) {
9809
9876
  to += "#copy";
9810
9877
  }
9811
- navigation.navigate(to);
9878
+ navigation.navigate(to, defaultValues ? {
9879
+ state: {
9880
+ defaultValues
9881
+ }
9882
+ } : void 0);
9812
9883
  }
9813
9884
  }
9814
9885
  function FieldCaption(t0) {
@@ -10427,8 +10498,9 @@ function PropertyFieldBindingInternal(t0) {
10427
10498
  Component = ReadOnlyFieldBinding;
10428
10499
  } else {
10429
10500
  if (resolvedProperty.ui?.Field) {
10430
- if (typeof resolvedProperty.ui?.Field === "function") {
10431
- Component = resolvedProperty.ui?.Field;
10501
+ const resolved = resolveComponentRef(resolvedProperty.ui.Field);
10502
+ if (resolved) {
10503
+ Component = resolved;
10432
10504
  }
10433
10505
  } else {
10434
10506
  const propertyConfig = getFieldConfig(resolvedProperty, customizationController.propertyConfigs);
@@ -10452,7 +10524,7 @@ function PropertyFieldBindingInternal(t0) {
10452
10524
  index,
10453
10525
  authController
10454
10526
  });
10455
- Component = configProperty?.ui?.Field;
10527
+ Component = resolveComponentRef(configProperty?.ui?.Field);
10456
10528
  }
10457
10529
  }
10458
10530
  }
@@ -10574,7 +10646,7 @@ function FieldInternal({
10574
10646
  onPropertyChange
10575
10647
  };
10576
10648
  return /* @__PURE__ */ jsxs(ErrorBoundary, { children: [
10577
- /* @__PURE__ */ jsx(UsedComponent, { ...cmsFieldProps }),
10649
+ /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(UsedComponent, { ...cmsFieldProps }) }),
10578
10650
  underlyingValueHasChanged && !isSubmitting && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "ml-3.5", children: "This value has been updated elsewhere" })
10579
10651
  ] });
10580
10652
  }
@@ -15021,10 +15093,10 @@ function getFieldConfig(property, propertyConfigs) {
15021
15093
  }
15022
15094
  function getDefaultFieldId(property) {
15023
15095
  if (property.type === "string") {
15024
- if (property.ui?.multiline) {
15025
- return "multiline";
15026
- } else if (property.ui?.markdown) {
15096
+ if (property.ui?.markdown) {
15027
15097
  return "markdown";
15098
+ } else if (property.ui?.multiline) {
15099
+ return "multiline";
15028
15100
  } else if (property.storage) {
15029
15101
  return "file_upload";
15030
15102
  } else if (property.ui?.url) {
@@ -16224,12 +16296,11 @@ function useCollectionEditorDialogsState() {
16224
16296
  const ConfigControllerContext = React__default.createContext({});
16225
16297
  const CollectionEditorContext = React__default.createContext({});
16226
16298
  const ConfigControllerProvider = React__default.memo(function ConfigControllerProvider2(t0) {
16227
- const $ = c(86);
16299
+ const $ = c(85);
16228
16300
  const {
16229
16301
  children,
16230
16302
  collectionConfigController,
16231
16303
  configPermissions,
16232
- reservedGroups,
16233
16304
  collectionInference,
16234
16305
  extraView,
16235
16306
  getUser,
@@ -16439,14 +16510,13 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16439
16510
  t92 = $[20];
16440
16511
  }
16441
16512
  let t102;
16442
- if ($[21] !== collectionConfigController || $[22] !== collectionInference || $[23] !== currentDialog || $[24] !== extraView || $[25] !== generateCollection || $[26] !== getData || $[27] !== getUser || $[28] !== onAnalyticsEvent || $[29] !== onFetchTableMetadata || $[30] !== reservedGroups || $[31] !== t92 || $[32] !== unmappedTables) {
16513
+ if ($[21] !== collectionConfigController || $[22] !== collectionInference || $[23] !== currentDialog || $[24] !== extraView || $[25] !== generateCollection || $[26] !== getData || $[27] !== getUser || $[28] !== onAnalyticsEvent || $[29] !== onFetchTableMetadata || $[30] !== t92 || $[31] !== unmappedTables) {
16443
16514
  t102 = {
16444
16515
  open: true,
16445
16516
  configController: collectionConfigController,
16446
16517
  collectionInference,
16447
16518
  ...currentDialog,
16448
16519
  getData,
16449
- reservedGroups,
16450
16520
  extraView,
16451
16521
  getUser,
16452
16522
  generateCollection,
@@ -16464,12 +16534,11 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16464
16534
  $[27] = getUser;
16465
16535
  $[28] = onAnalyticsEvent;
16466
16536
  $[29] = onFetchTableMetadata;
16467
- $[30] = reservedGroups;
16468
- $[31] = t92;
16469
- $[32] = unmappedTables;
16470
- $[33] = t102;
16537
+ $[30] = t92;
16538
+ $[31] = unmappedTables;
16539
+ $[32] = t102;
16471
16540
  } else {
16472
- t102 = $[33];
16541
+ t102 = $[32];
16473
16542
  }
16474
16543
  t8 = t102;
16475
16544
  }
@@ -16484,7 +16553,7 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16484
16553
  const t112 = !currentPropertyDialog.propertyKey;
16485
16554
  const t122 = !currentPropertyDialog.propertyKey;
16486
16555
  let t132;
16487
- if ($[34] !== currentPropertyDialog.editedCollectionId || $[35] !== currentPropertyDialog.existingEntities || $[36] !== getData || $[37] !== urlController) {
16556
+ if ($[33] !== currentPropertyDialog.editedCollectionId || $[34] !== currentPropertyDialog.existingEntities || $[35] !== getData || $[36] !== urlController) {
16488
16557
  t132 = currentPropertyDialog.existingEntities || getData && currentPropertyDialog.editedCollectionId ? async () => {
16489
16558
  let data = [];
16490
16559
  if (currentPropertyDialog.existingEntities) {
@@ -16498,16 +16567,16 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16498
16567
  }
16499
16568
  return data;
16500
16569
  } : void 0;
16501
- $[34] = currentPropertyDialog.editedCollectionId;
16502
- $[35] = currentPropertyDialog.existingEntities;
16503
- $[36] = getData;
16504
- $[37] = urlController;
16505
- $[38] = t132;
16570
+ $[33] = currentPropertyDialog.editedCollectionId;
16571
+ $[34] = currentPropertyDialog.existingEntities;
16572
+ $[35] = getData;
16573
+ $[36] = urlController;
16574
+ $[37] = t132;
16506
16575
  } else {
16507
- t132 = $[38];
16576
+ t132 = $[37];
16508
16577
  }
16509
16578
  let t142;
16510
- if ($[39] !== collectionConfigController || $[40] !== currentPropertyDialog || $[41] !== snackbarController) {
16579
+ if ($[38] !== collectionConfigController || $[39] !== currentPropertyDialog || $[40] !== snackbarController) {
16511
16580
  t142 = (t153) => {
16512
16581
  const {
16513
16582
  id: id_0,
@@ -16536,15 +16605,15 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16536
16605
  return false;
16537
16606
  });
16538
16607
  };
16539
- $[39] = collectionConfigController;
16540
- $[40] = currentPropertyDialog;
16541
- $[41] = snackbarController;
16542
- $[42] = t142;
16608
+ $[38] = collectionConfigController;
16609
+ $[39] = currentPropertyDialog;
16610
+ $[40] = snackbarController;
16611
+ $[41] = t142;
16543
16612
  } else {
16544
- t142 = $[42];
16613
+ t142 = $[41];
16545
16614
  }
16546
16615
  let t152;
16547
- if ($[43] !== collectionConfigController || $[44] !== currentPropertyDialog.currentPropertiesOrder || $[45] !== currentPropertyDialog.editedCollectionId || $[46] !== currentPropertyDialog.namespace || $[47] !== currentPropertyDialog.parentCollectionSlugs || $[48] !== currentPropertyDialog.propertyKey || $[49] !== snackbarController) {
16616
+ if ($[42] !== collectionConfigController || $[43] !== currentPropertyDialog.currentPropertiesOrder || $[44] !== currentPropertyDialog.editedCollectionId || $[45] !== currentPropertyDialog.namespace || $[46] !== currentPropertyDialog.parentCollectionSlugs || $[47] !== currentPropertyDialog.propertyKey || $[48] !== snackbarController) {
16548
16617
  t152 = () => {
16549
16618
  if (!currentPropertyDialog.propertyKey) {
16550
16619
  return;
@@ -16567,21 +16636,21 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16567
16636
  return false;
16568
16637
  });
16569
16638
  };
16570
- $[43] = collectionConfigController;
16571
- $[44] = currentPropertyDialog.currentPropertiesOrder;
16572
- $[45] = currentPropertyDialog.editedCollectionId;
16573
- $[46] = currentPropertyDialog.namespace;
16574
- $[47] = currentPropertyDialog.parentCollectionSlugs;
16575
- $[48] = currentPropertyDialog.propertyKey;
16576
- $[49] = snackbarController;
16577
- $[50] = t152;
16639
+ $[42] = collectionConfigController;
16640
+ $[43] = currentPropertyDialog.currentPropertiesOrder;
16641
+ $[44] = currentPropertyDialog.editedCollectionId;
16642
+ $[45] = currentPropertyDialog.namespace;
16643
+ $[46] = currentPropertyDialog.parentCollectionSlugs;
16644
+ $[47] = currentPropertyDialog.propertyKey;
16645
+ $[48] = snackbarController;
16646
+ $[49] = t152;
16578
16647
  } else {
16579
- t152 = $[50];
16648
+ t152 = $[49];
16580
16649
  }
16581
16650
  let t162;
16582
16651
  let t172;
16583
16652
  let t18;
16584
- if ($[51] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
16653
+ if ($[50] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
16585
16654
  t162 = () => {
16586
16655
  setCurrentPropertyDialog(void 0);
16587
16656
  };
@@ -16589,24 +16658,24 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16589
16658
  setCurrentPropertyDialog(void 0);
16590
16659
  };
16591
16660
  t18 = {};
16592
- $[51] = t162;
16593
- $[52] = t172;
16594
- $[53] = t18;
16661
+ $[50] = t162;
16662
+ $[51] = t172;
16663
+ $[52] = t18;
16595
16664
  } else {
16596
- t162 = $[51];
16597
- t172 = $[52];
16598
- t18 = $[53];
16665
+ t162 = $[50];
16666
+ t172 = $[51];
16667
+ t18 = $[52];
16599
16668
  }
16600
16669
  let t19;
16601
- if ($[54] !== currentPropertyDialog.collection) {
16670
+ if ($[53] !== currentPropertyDialog.collection) {
16602
16671
  t19 = currentPropertyDialog.collection?.properties ? Object.keys(currentPropertyDialog.collection.properties) : [];
16603
- $[54] = currentPropertyDialog.collection;
16604
- $[55] = t19;
16672
+ $[53] = currentPropertyDialog.collection;
16673
+ $[54] = t19;
16605
16674
  } else {
16606
- t19 = $[55];
16675
+ t19 = $[54];
16607
16676
  }
16608
16677
  let t20;
16609
- if ($[56] !== currentPropertyDialog.property || $[57] !== currentPropertyDialog.propertyKey || $[58] !== propertyConfigs || $[59] !== t102 || $[60] !== t112 || $[61] !== t122 || $[62] !== t132 || $[63] !== t142 || $[64] !== t152 || $[65] !== t19) {
16678
+ if ($[55] !== currentPropertyDialog.property || $[56] !== currentPropertyDialog.propertyKey || $[57] !== propertyConfigs || $[58] !== t102 || $[59] !== t112 || $[60] !== t122 || $[61] !== t132 || $[62] !== t142 || $[63] !== t152 || $[64] !== t19) {
16610
16679
  t20 = {
16611
16680
  open: true,
16612
16681
  includeIdAndName: true,
@@ -16629,42 +16698,42 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16629
16698
  property: currentPropertyDialog.property,
16630
16699
  propertyKey: currentPropertyDialog.propertyKey
16631
16700
  };
16632
- $[56] = currentPropertyDialog.property;
16633
- $[57] = currentPropertyDialog.propertyKey;
16634
- $[58] = propertyConfigs;
16635
- $[59] = t102;
16636
- $[60] = t112;
16637
- $[61] = t122;
16638
- $[62] = t132;
16639
- $[63] = t142;
16640
- $[64] = t152;
16641
- $[65] = t19;
16642
- $[66] = t20;
16701
+ $[55] = currentPropertyDialog.property;
16702
+ $[56] = currentPropertyDialog.propertyKey;
16703
+ $[57] = propertyConfigs;
16704
+ $[58] = t102;
16705
+ $[59] = t112;
16706
+ $[60] = t122;
16707
+ $[61] = t132;
16708
+ $[62] = t142;
16709
+ $[63] = t152;
16710
+ $[64] = t19;
16711
+ $[65] = t20;
16643
16712
  } else {
16644
- t20 = $[66];
16713
+ t20 = $[65];
16645
16714
  }
16646
16715
  t9 = t20;
16647
16716
  }
16648
16717
  const propertyDialogProps = t9;
16649
16718
  let t10;
16650
16719
  let t11;
16651
- if ($[67] !== collectionDialogProps || $[68] !== propertyDialogProps) {
16720
+ if ($[66] !== collectionDialogProps || $[67] !== propertyDialogProps) {
16652
16721
  t11 = {
16653
16722
  collectionDialogProps,
16654
16723
  propertyDialogProps
16655
16724
  };
16656
- $[67] = collectionDialogProps;
16657
- $[68] = propertyDialogProps;
16658
- $[69] = t11;
16725
+ $[66] = collectionDialogProps;
16726
+ $[67] = propertyDialogProps;
16727
+ $[68] = t11;
16659
16728
  } else {
16660
- t11 = $[69];
16729
+ t11 = $[68];
16661
16730
  }
16662
16731
  t10 = t11;
16663
16732
  const dialogsState = t10;
16664
16733
  let t12;
16665
16734
  const t13 = configPermissions ?? defaultConfigPermissions;
16666
16735
  let t14;
16667
- if ($[70] !== collectionConfigController || $[71] !== createCollection || $[72] !== editCollection || $[73] !== editProperty || $[74] !== pathSuggestions || $[75] !== t13) {
16736
+ if ($[69] !== collectionConfigController || $[70] !== createCollection || $[71] !== editCollection || $[72] !== editProperty || $[73] !== pathSuggestions || $[74] !== t13) {
16668
16737
  t14 = {
16669
16738
  editCollection,
16670
16739
  createCollection,
@@ -16673,44 +16742,44 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
16673
16742
  pathSuggestions,
16674
16743
  configController: collectionConfigController
16675
16744
  };
16676
- $[70] = collectionConfigController;
16677
- $[71] = createCollection;
16678
- $[72] = editCollection;
16679
- $[73] = editProperty;
16680
- $[74] = pathSuggestions;
16681
- $[75] = t13;
16682
- $[76] = t14;
16745
+ $[69] = collectionConfigController;
16746
+ $[70] = createCollection;
16747
+ $[71] = editCollection;
16748
+ $[72] = editProperty;
16749
+ $[73] = pathSuggestions;
16750
+ $[74] = t13;
16751
+ $[75] = t14;
16683
16752
  } else {
16684
- t14 = $[76];
16753
+ t14 = $[75];
16685
16754
  }
16686
16755
  t12 = t14;
16687
16756
  const collectionEditorContextValue = t12;
16688
16757
  let t15;
16689
- if ($[77] !== children || $[78] !== dialogsState) {
16758
+ if ($[76] !== children || $[77] !== dialogsState) {
16690
16759
  t15 = /* @__PURE__ */ jsx(CollectionEditorDialogsContext.Provider, { value: dialogsState, children });
16691
- $[77] = children;
16692
- $[78] = dialogsState;
16693
- $[79] = t15;
16760
+ $[76] = children;
16761
+ $[77] = dialogsState;
16762
+ $[78] = t15;
16694
16763
  } else {
16695
- t15 = $[79];
16764
+ t15 = $[78];
16696
16765
  }
16697
16766
  let t16;
16698
- if ($[80] !== collectionEditorContextValue || $[81] !== t15) {
16767
+ if ($[79] !== collectionEditorContextValue || $[80] !== t15) {
16699
16768
  t16 = /* @__PURE__ */ jsx(CollectionEditorContext.Provider, { value: collectionEditorContextValue, children: t15 });
16700
- $[80] = collectionEditorContextValue;
16701
- $[81] = t15;
16702
- $[82] = t16;
16769
+ $[79] = collectionEditorContextValue;
16770
+ $[80] = t15;
16771
+ $[81] = t16;
16703
16772
  } else {
16704
- t16 = $[82];
16773
+ t16 = $[81];
16705
16774
  }
16706
16775
  let t17;
16707
- if ($[83] !== collectionConfigController || $[84] !== t16) {
16776
+ if ($[82] !== collectionConfigController || $[83] !== t16) {
16708
16777
  t17 = /* @__PURE__ */ jsx(ConfigControllerContext.Provider, { value: collectionConfigController, children: t16 });
16709
- $[83] = collectionConfigController;
16710
- $[84] = t16;
16711
- $[85] = t17;
16778
+ $[82] = collectionConfigController;
16779
+ $[83] = t16;
16780
+ $[84] = t17;
16712
16781
  } else {
16713
- t17 = $[85];
16782
+ t17 = $[84];
16714
16783
  }
16715
16784
  return t17;
16716
16785
  }, deepEqual);
@@ -16844,14 +16913,14 @@ function EditorCollectionAction(t0) {
16844
16913
  }
16845
16914
  return t9;
16846
16915
  }
16847
- const ImportCollectionAction = lazy(() => import("./index-C9YDsMC9.js").then((m) => ({
16916
+ const ImportCollectionAction = lazy(() => import("./index-BuZaHcyc.js").then((m) => ({
16848
16917
  default: m.ImportCollectionAction
16849
16918
  })));
16850
- const ExportCollectionAction = lazy(() => import("./index-DO7lMeNB.js").then((m) => ({
16919
+ const ExportCollectionAction = lazy(() => import("./index-eRJbMvHi.js").then((m) => ({
16851
16920
  default: m.ExportCollectionAction
16852
16921
  })));
16853
16922
  function EntityCollectionViewActions(t0) {
16854
- const $ = c(62);
16923
+ const $ = c(63);
16855
16924
  const {
16856
16925
  collection,
16857
16926
  relativePath,
@@ -16864,7 +16933,8 @@ function EntityCollectionViewActions(t0) {
16864
16933
  tableController,
16865
16934
  collectionEntitiesCount,
16866
16935
  compact,
16867
- children
16936
+ children,
16937
+ openNewDocument
16868
16938
  } = t0;
16869
16939
  const context = useCMSContext();
16870
16940
  const {
@@ -16944,7 +17014,7 @@ function EntityCollectionViewActions(t0) {
16944
17014
  }
16945
17015
  multipleDeleteButton = t5;
16946
17016
  let t6;
16947
- if ($[23] !== collection || $[24] !== collectionEntitiesCount || $[25] !== context || $[26] !== parentCollectionSlugs || $[27] !== parentEntityIds || $[28] !== path || $[29] !== relativePath || $[30] !== selectionController || $[31] !== tableController) {
17017
+ if ($[23] !== collection || $[24] !== collectionEntitiesCount || $[25] !== context || $[26] !== openNewDocument || $[27] !== parentCollectionSlugs || $[28] !== parentEntityIds || $[29] !== path || $[30] !== relativePath || $[31] !== selectionController || $[32] !== tableController) {
16948
17018
  t6 = {
16949
17019
  path,
16950
17020
  relativePath,
@@ -16954,82 +17024,90 @@ function EntityCollectionViewActions(t0) {
16954
17024
  selectionController,
16955
17025
  context,
16956
17026
  tableController,
16957
- collectionEntitiesCount
17027
+ collectionEntitiesCount,
17028
+ openNewDocument
16958
17029
  };
16959
17030
  $[23] = collection;
16960
17031
  $[24] = collectionEntitiesCount;
16961
17032
  $[25] = context;
16962
- $[26] = parentCollectionSlugs;
16963
- $[27] = parentEntityIds;
16964
- $[28] = path;
16965
- $[29] = relativePath;
16966
- $[30] = selectionController;
16967
- $[31] = tableController;
16968
- $[32] = t6;
17033
+ $[26] = openNewDocument;
17034
+ $[27] = parentCollectionSlugs;
17035
+ $[28] = parentEntityIds;
17036
+ $[29] = path;
17037
+ $[30] = relativePath;
17038
+ $[31] = selectionController;
17039
+ $[32] = tableController;
17040
+ $[33] = t6;
16969
17041
  } else {
16970
- t6 = $[32];
17042
+ t6 = $[33];
16971
17043
  }
16972
17044
  const actionProps = t6;
16973
17045
  let t7;
16974
- if ($[33] !== actionProps || $[34] !== collection.Actions) {
17046
+ if ($[34] !== actionProps || $[35] !== collection.Actions) {
16975
17047
  let t82;
16976
- if ($[36] !== actionProps) {
16977
- t82 = (Action, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Action, { ...actionProps }) }, `actions_${i}`);
16978
- $[36] = actionProps;
16979
- $[37] = t82;
17048
+ if ($[37] !== actionProps) {
17049
+ t82 = (actionRef, i) => {
17050
+ const Action = resolveComponentRef(actionRef);
17051
+ if (!Action) {
17052
+ return null;
17053
+ }
17054
+ return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Action, { ...actionProps }) }) }, `actions_${i}`);
17055
+ };
17056
+ $[37] = actionProps;
17057
+ $[38] = t82;
16980
17058
  } else {
16981
- t82 = $[37];
17059
+ t82 = $[38];
16982
17060
  }
16983
17061
  t7 = toArray(collection.Actions).map(t82);
16984
- $[33] = actionProps;
16985
- $[34] = collection.Actions;
16986
- $[35] = t7;
17062
+ $[34] = actionProps;
17063
+ $[35] = collection.Actions;
17064
+ $[36] = t7;
16987
17065
  } else {
16988
- t7 = $[35];
17066
+ t7 = $[36];
16989
17067
  }
16990
17068
  const actions = t7;
16991
17069
  const pluginActions = useSlot("collection.actions", actionProps);
16992
17070
  let t8;
16993
- if ($[38] !== actions || $[39] !== pluginActions) {
17071
+ if ($[39] !== actions || $[40] !== pluginActions) {
16994
17072
  t8 = /* @__PURE__ */ jsxs(ErrorBoundary, { children: [
16995
17073
  actions,
16996
17074
  pluginActions
16997
17075
  ] });
16998
- $[38] = actions;
16999
- $[39] = pluginActions;
17000
- $[40] = t8;
17076
+ $[39] = actions;
17077
+ $[40] = pluginActions;
17078
+ $[41] = t8;
17001
17079
  } else {
17002
- t8 = $[40];
17080
+ t8 = $[41];
17003
17081
  }
17004
17082
  const t9 = actionProps;
17005
17083
  let t10;
17006
- if ($[41] !== t9) {
17084
+ if ($[42] !== t9) {
17007
17085
  t10 = /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ImportCollectionAction, { ...t9 }) }) });
17008
- $[41] = t9;
17009
- $[42] = t10;
17086
+ $[42] = t9;
17087
+ $[43] = t10;
17010
17088
  } else {
17011
- t10 = $[42];
17089
+ t10 = $[43];
17012
17090
  }
17013
17091
  const t11 = actionProps;
17014
17092
  let t12;
17015
- if ($[43] !== t11) {
17093
+ if ($[44] !== t11) {
17016
17094
  t12 = /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ExportCollectionAction, { ...t11 }) }) });
17017
- $[43] = t11;
17018
- $[44] = t12;
17095
+ $[44] = t11;
17096
+ $[45] = t12;
17019
17097
  } else {
17020
- t12 = $[44];
17098
+ t12 = $[45];
17021
17099
  }
17022
17100
  let t13;
17023
- if ($[45] !== actionProps || $[46] !== hasCollectionEditor) {
17101
+ if ($[46] !== actionProps || $[47] !== hasCollectionEditor) {
17024
17102
  t13 = hasCollectionEditor && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(EditorCollectionAction, { ...actionProps }) });
17025
- $[45] = actionProps;
17026
- $[46] = hasCollectionEditor;
17027
- $[47] = t13;
17103
+ $[46] = actionProps;
17104
+ $[47] = hasCollectionEditor;
17105
+ $[48] = t13;
17028
17106
  } else {
17029
- t13 = $[47];
17107
+ t13 = $[48];
17030
17108
  }
17031
17109
  let t14;
17032
- if ($[48] !== children || $[49] !== t10 || $[50] !== t12 || $[51] !== t13 || $[52] !== t8) {
17110
+ if ($[49] !== children || $[50] !== t10 || $[51] !== t12 || $[52] !== t13 || $[53] !== t8) {
17033
17111
  t14 = /* @__PURE__ */ jsxs(Fragment, { children: [
17034
17112
  children,
17035
17113
  t8,
@@ -17037,40 +17115,40 @@ function EntityCollectionViewActions(t0) {
17037
17115
  t12,
17038
17116
  t13
17039
17117
  ] });
17040
- $[48] = children;
17041
- $[49] = t10;
17042
- $[50] = t12;
17043
- $[51] = t13;
17044
- $[52] = t8;
17045
- $[53] = t14;
17118
+ $[49] = children;
17119
+ $[50] = t10;
17120
+ $[51] = t12;
17121
+ $[52] = t13;
17122
+ $[53] = t8;
17123
+ $[54] = t14;
17046
17124
  } else {
17047
- t14 = $[53];
17125
+ t14 = $[54];
17048
17126
  }
17049
17127
  const secondaryActions = t14;
17050
17128
  const [overflowOpen, setOverflowOpen] = React__default.useState(false);
17051
17129
  let t15;
17052
- if ($[54] !== compact || $[55] !== overflowOpen || $[56] !== secondaryActions) {
17130
+ if ($[55] !== compact || $[56] !== overflowOpen || $[57] !== secondaryActions) {
17053
17131
  t15 = !compact ? secondaryActions : /* @__PURE__ */ jsx(Popover, { open: overflowOpen, onOpenChange: setOverflowOpen, trigger: /* @__PURE__ */ jsx(IconButton, { size: "small", children: /* @__PURE__ */ jsx(MoreVerticalIcon, { size: iconSize.smallest }) }), children: /* @__PURE__ */ jsx("div", { className: "flex flex-row items-center gap-1 p-2", children: secondaryActions }) });
17054
- $[54] = compact;
17055
- $[55] = overflowOpen;
17056
- $[56] = secondaryActions;
17057
- $[57] = t15;
17132
+ $[55] = compact;
17133
+ $[56] = overflowOpen;
17134
+ $[57] = secondaryActions;
17135
+ $[58] = t15;
17058
17136
  } else {
17059
- t15 = $[57];
17137
+ t15 = $[58];
17060
17138
  }
17061
17139
  let t16;
17062
- if ($[58] !== addButton || $[59] !== multipleDeleteButton || $[60] !== t15) {
17140
+ if ($[59] !== addButton || $[60] !== multipleDeleteButton || $[61] !== t15) {
17063
17141
  t16 = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
17064
17142
  t15,
17065
17143
  multipleDeleteButton,
17066
17144
  addButton
17067
17145
  ] });
17068
- $[58] = addButton;
17069
- $[59] = multipleDeleteButton;
17070
- $[60] = t15;
17071
- $[61] = t16;
17146
+ $[59] = addButton;
17147
+ $[60] = multipleDeleteButton;
17148
+ $[61] = t15;
17149
+ $[62] = t16;
17072
17150
  } else {
17073
- t16 = $[61];
17151
+ t16 = $[62];
17074
17152
  }
17075
17153
  return t16;
17076
17154
  }
@@ -17078,11 +17156,33 @@ function resolveCollectionSlotKeys(collection, authController, propertyConfigs)
17078
17156
  const titleKey = getEntityTitlePropertyKey(collection);
17079
17157
  const imageKey = getEntityImagePreviewPropertyKey(collection);
17080
17158
  let statusKey;
17081
- for (const [key, prop] of Object.entries(collection.properties)) {
17082
- const p = prop;
17083
- if (p.type === "string" && "enum" in p && p.enum && key !== titleKey) {
17084
- statusKey = key;
17085
- break;
17159
+ if (!statusKey && collection.previewProperties) {
17160
+ for (const key of collection.previewProperties) {
17161
+ const p = collection.properties[key];
17162
+ if (p?.type === "string" && "enum" in p && p.enum && key !== titleKey) {
17163
+ statusKey = key;
17164
+ break;
17165
+ }
17166
+ }
17167
+ }
17168
+ if (!statusKey && collection.propertiesOrder) {
17169
+ for (const key of collection.propertiesOrder) {
17170
+ if (typeof key === "string" && !key.startsWith("subcollection:")) {
17171
+ const p = collection.properties[key];
17172
+ if (p?.type === "string" && "enum" in p && p.enum && key !== titleKey) {
17173
+ statusKey = key;
17174
+ break;
17175
+ }
17176
+ }
17177
+ }
17178
+ }
17179
+ if (!statusKey) {
17180
+ for (const [key, prop] of Object.entries(collection.properties)) {
17181
+ const p = prop;
17182
+ if (p.type === "string" && "enum" in p && p.enum && key !== titleKey) {
17183
+ statusKey = key;
17184
+ break;
17185
+ }
17086
17186
  }
17087
17187
  }
17088
17188
  let dateKey;
@@ -17365,7 +17465,7 @@ function EntityCard({
17365
17465
  const handleSelectionChange = (checked) => {
17366
17466
  onSelectionChange?.(entity, checked);
17367
17467
  };
17368
- return /* @__PURE__ */ jsxs(Card, { className: cls("cursor-pointer overflow-hidden group relative", "transition-all duration-200", "hover:shadow-lg hover:-translate-y-0.5", selected && "ring-2 ring-primary", highlighted && !selected && "ring-2 ring-primary ring-opacity-50"), onClick: handleClick, children: [
17468
+ return /* @__PURE__ */ jsxs(Card, { className: cls("cursor-pointer overflow-hidden group relative", "transition-all duration-200", "hover:shadow-lg hover:-translate-y-0.5", selected && "ring-2 ring-primary bg-surface-accent-50 dark:bg-surface-accent-900", highlighted && !selected && "ring-2 ring-primary ring-opacity-50 bg-surface-accent-50/50 dark:bg-surface-accent-900"), onClick: handleClick, children: [
17369
17469
  /* @__PURE__ */ jsxs("div", { className: "aspect-[4/3] relative overflow-hidden bg-surface-100 dark:bg-surface-900", children: [
17370
17470
  slots.image ? /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsx(PropertyPreview, { property: slots.image.property, propertyKey: slots.image.propertyKey, size: "medium", value: slots.image.value, fill: true }) }) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(IconForView, { collectionOrView: collection, color: "disabled" }) }),
17371
17471
  /* @__PURE__ */ jsx("div", { className: cls("absolute inset-0 bg-black/0 group-hover:bg-black/10", "transition-colors duration-200") }),
@@ -17507,7 +17607,7 @@ function EntityCollectionCardView({
17507
17607
  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: [
17508
17608
  "Error loading data: ",
17509
17609
  dataLoadingError.message
17510
- ] }) }) : isInitialLoading ? /* @__PURE__ */ jsx(CircularProgressCenter, {}) : isEmpty ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center p-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: [
17610
+ ] }) }) : 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: [
17511
17611
  /* @__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}`)) }),
17512
17612
  /* @__PURE__ */ jsxs("div", { ref: loadMoreRef, className: "flex items-center justify-center py-8", children: [
17513
17613
  dataLoading && /* @__PURE__ */ jsx(CircularProgress, { size: "small" }),
@@ -18119,7 +18219,7 @@ function EntityCollectionListView(t0) {
18119
18219
  t22 = /* @__PURE__ */ jsx("div", { ref: containerRef, className: t24, children: dataLoadingError ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs(Typography, { className: "text-red-500", children: [
18120
18220
  "Error loading data: ",
18121
18221
  dataLoadingError.message
18122
- ] }) }) : isInitialLoading ? /* @__PURE__ */ jsx(CircularProgressCenter, {}) : isEmpty ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-8", children: emptyComponent ?? /* @__PURE__ */ jsx(Typography, { variant: "label", color: "secondary", children: "No entries found" }) }) : /* @__PURE__ */ jsxs("div", { style: {
18222
+ ] }) }) : 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__ */ jsxs("div", { style: {
18123
18223
  height: totalHeight + footerHeight,
18124
18224
  position: "relative"
18125
18225
  }, children: [
@@ -18259,7 +18359,7 @@ const ListRow = React__default.memo(function ListRow2(t0) {
18259
18359
  const handleCheckboxChange = t6;
18260
18360
  const useColumnMode = !!collection.listProperties && collection.listProperties.length > 0;
18261
18361
  const extraColumns = useColumnMode ? columns.filter(_temp5) : [];
18262
- const t7 = isActive ? "bg-surface-accent-100 dark:bg-surface-accent-950 hover:bg-surface-accent-200 dark:hover:bg-surface-accent-900" : selected ? "bg-primary-50 dark:bg-primary-900/20 hover:bg-surface-50 dark:hover:bg-surface-800/40" : highlighted ? "bg-surface-accent-50 dark:bg-surface-accent-950 hover:bg-surface-50 dark:hover:bg-surface-800/40" : "bg-white dark:bg-surface-900 hover:bg-surface-50 dark:hover:bg-surface-800/40";
18362
+ const t7 = isActive ? "bg-surface-accent-100 dark:bg-surface-accent-950 hover:bg-surface-accent-200 dark:hover:bg-surface-accent-950" : selected ? "bg-surface-accent-50 dark:bg-surface-accent-900 hover:bg-surface-accent-100 dark:hover:bg-surface-accent-950" : highlighted ? "bg-surface-accent-50 dark:bg-surface-accent-900 hover:bg-surface-50 dark:hover:bg-surface-800/40" : "bg-white dark:bg-surface-900 hover:bg-surface-50 dark:hover:bg-surface-800/40";
18263
18363
  let t8;
18264
18364
  if ($[24] !== rowClasses || $[25] !== t7) {
18265
18365
  t8 = cls("flex items-center gap-4 cursor-pointer group transition-colors duration-200 relative h-full", rowClasses, t7);
@@ -21444,7 +21544,7 @@ function FiltersDialog({
21444
21544
  ] });
21445
21545
  }
21446
21546
  function EntityCollectionViewStartActions(t0) {
21447
- const $ = c(44);
21547
+ const $ = c(45);
21448
21548
  const {
21449
21549
  collection,
21450
21550
  relativePath,
@@ -21455,7 +21555,8 @@ function EntityCollectionViewStartActions(t0) {
21455
21555
  tableController,
21456
21556
  collectionEntitiesCount,
21457
21557
  resolvedProperties,
21458
- compact
21558
+ compact,
21559
+ openNewDocument
21459
21560
  } = t0;
21460
21561
  const context = useCMSContext();
21461
21562
  const largeLayout = useLargeLayout();
@@ -21478,7 +21579,7 @@ function EntityCollectionViewStartActions(t0) {
21478
21579
  }
21479
21580
  const activeFilterCount = t1;
21480
21581
  let t2;
21481
- if ($[3] !== collection || $[4] !== collectionEntitiesCount || $[5] !== context || $[6] !== parentCollectionSlugs || $[7] !== parentEntityIds || $[8] !== path || $[9] !== relativePath || $[10] !== selectionController || $[11] !== tableController) {
21582
+ if ($[3] !== collection || $[4] !== collectionEntitiesCount || $[5] !== context || $[6] !== openNewDocument || $[7] !== parentCollectionSlugs || $[8] !== parentEntityIds || $[9] !== path || $[10] !== relativePath || $[11] !== selectionController || $[12] !== tableController) {
21482
21583
  t2 = {
21483
21584
  path,
21484
21585
  relativePath,
@@ -21488,24 +21589,26 @@ function EntityCollectionViewStartActions(t0) {
21488
21589
  selectionController,
21489
21590
  context,
21490
21591
  tableController,
21491
- collectionEntitiesCount
21592
+ collectionEntitiesCount,
21593
+ openNewDocument
21492
21594
  };
21493
21595
  $[3] = collection;
21494
21596
  $[4] = collectionEntitiesCount;
21495
21597
  $[5] = context;
21496
- $[6] = parentCollectionSlugs;
21497
- $[7] = parentEntityIds;
21498
- $[8] = path;
21499
- $[9] = relativePath;
21500
- $[10] = selectionController;
21501
- $[11] = tableController;
21502
- $[12] = t2;
21598
+ $[6] = openNewDocument;
21599
+ $[7] = parentCollectionSlugs;
21600
+ $[8] = parentEntityIds;
21601
+ $[9] = path;
21602
+ $[10] = relativePath;
21603
+ $[11] = selectionController;
21604
+ $[12] = tableController;
21605
+ $[13] = t2;
21503
21606
  } else {
21504
- t2 = $[12];
21607
+ t2 = $[13];
21505
21608
  }
21506
21609
  const actionProps = t2;
21507
21610
  let t3;
21508
- if ($[13] !== navigate || $[14] !== path || $[15] !== urlController) {
21611
+ if ($[14] !== navigate || $[15] !== path || $[16] !== urlController) {
21509
21612
  t3 = () => {
21510
21613
  let collectionUrl = urlController.buildUrlCollectionPath(path);
21511
21614
  const currentViewParam = new URLSearchParams(window.location.search).get("__view");
@@ -21514,88 +21617,88 @@ function EntityCollectionViewStartActions(t0) {
21514
21617
  }
21515
21618
  navigate(collectionUrl);
21516
21619
  };
21517
- $[13] = navigate;
21518
- $[14] = path;
21519
- $[15] = urlController;
21520
- $[16] = t3;
21620
+ $[14] = navigate;
21621
+ $[15] = path;
21622
+ $[16] = urlController;
21623
+ $[17] = t3;
21521
21624
  } else {
21522
- t3 = $[16];
21625
+ t3 = $[17];
21523
21626
  }
21524
21627
  const handleBackClick = t3;
21525
21628
  let t4;
21526
- if ($[17] !== compact || $[18] !== handleBackClick || $[19] !== t) {
21629
+ if ($[18] !== compact || $[19] !== handleBackClick || $[20] !== t) {
21527
21630
  t4 = compact && /* @__PURE__ */ jsx(Tooltip, { title: t("back"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: handleBackClick, className: "mr-1", children: /* @__PURE__ */ jsx(ArrowLeftIcon, { size: iconSize.small }) }) }, "back_tooltip");
21528
- $[17] = compact;
21529
- $[18] = handleBackClick;
21530
- $[19] = t;
21531
- $[20] = t4;
21631
+ $[18] = compact;
21632
+ $[19] = handleBackClick;
21633
+ $[20] = t;
21634
+ $[21] = t4;
21532
21635
  } else {
21533
- t4 = $[20];
21636
+ t4 = $[21];
21534
21637
  }
21535
21638
  const backButton = t4;
21536
21639
  let t5;
21537
- if ($[21] !== activeFilterCount || $[22] !== compact || $[23] !== largeLayout || $[24] !== resolvedProperties || $[25] !== t || $[26] !== tableController.setFilterValues) {
21640
+ if ($[22] !== activeFilterCount || $[23] !== compact || $[24] !== largeLayout || $[25] !== resolvedProperties || $[26] !== t || $[27] !== tableController.setFilterValues) {
21538
21641
  t5 = resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ jsx(Tooltip, { title: t("filters"), children: /* @__PURE__ */ jsx(Badge, { color: "primary", invisible: activeFilterCount === 0, children: largeLayout && !compact ? /* @__PURE__ */ jsxs(Button, { variant: "text", size: "small", onClick: () => setFiltersDialogOpen(true), startIcon: /* @__PURE__ */ jsx(FilterIcon, { size: iconSize.small }), className: cls(activeFilterCount > 0 && "text-primary"), children: [
21539
21642
  t("filters"),
21540
21643
  activeFilterCount > 0 ? ` (${activeFilterCount})` : ""
21541
- ] }) : /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => setFiltersDialogOpen(true), className: cls(activeFilterCount > 0 && "text-primary"), children: /* @__PURE__ */ jsx(FilterIcon, { size: iconSize.small }) }) }) }, "filters_tooltip");
21542
- $[21] = activeFilterCount;
21543
- $[22] = compact;
21544
- $[23] = largeLayout;
21545
- $[24] = resolvedProperties;
21546
- $[25] = t;
21547
- $[26] = tableController.setFilterValues;
21548
- $[27] = t5;
21644
+ ] }) : /* @__PURE__ */ jsx(Button, { variant: "text", size: "small", onClick: () => setFiltersDialogOpen(true), className: cls(activeFilterCount > 0 && "text-primary"), children: /* @__PURE__ */ jsx(FilterIcon, { size: iconSize.small }) }) }) }, "filters_tooltip");
21645
+ $[22] = activeFilterCount;
21646
+ $[23] = compact;
21647
+ $[24] = largeLayout;
21648
+ $[25] = resolvedProperties;
21649
+ $[26] = t;
21650
+ $[27] = tableController.setFilterValues;
21651
+ $[28] = t5;
21549
21652
  } else {
21550
- t5 = $[27];
21653
+ t5 = $[28];
21551
21654
  }
21552
21655
  const filtersButton = t5;
21553
21656
  const t6 = !collection.fixedFilter;
21554
21657
  let t7;
21555
- if ($[28] !== t6 || $[29] !== tableController) {
21658
+ if ($[29] !== t6 || $[30] !== tableController) {
21556
21659
  t7 = /* @__PURE__ */ jsx(ClearFilterSortButton, { tableController, enabled: t6 }, "clear_filter");
21557
- $[28] = t6;
21558
- $[29] = tableController;
21559
- $[30] = t7;
21660
+ $[29] = t6;
21661
+ $[30] = tableController;
21662
+ $[31] = t7;
21560
21663
  } else {
21561
- t7 = $[30];
21664
+ t7 = $[31];
21562
21665
  }
21563
21666
  let t8;
21564
- if ($[31] !== backButton || $[32] !== filtersButton || $[33] !== t7) {
21667
+ if ($[32] !== backButton || $[33] !== filtersButton || $[34] !== t7) {
21565
21668
  t8 = [backButton, filtersButton, t7];
21566
- $[31] = backButton;
21567
- $[32] = filtersButton;
21568
- $[33] = t7;
21569
- $[34] = t8;
21669
+ $[32] = backButton;
21670
+ $[33] = filtersButton;
21671
+ $[34] = t7;
21672
+ $[35] = t8;
21570
21673
  } else {
21571
- t8 = $[34];
21674
+ t8 = $[35];
21572
21675
  }
21573
21676
  const actions = t8;
21574
21677
  const pluginActionsStart = useSlot("collection.actions.start", actionProps);
21575
21678
  let t9;
21576
- if ($[35] !== collection.fixedFilter || $[36] !== filtersDialogOpen || $[37] !== resolvedProperties || $[38] !== tableController) {
21679
+ if ($[36] !== collection.fixedFilter || $[37] !== filtersDialogOpen || $[38] !== resolvedProperties || $[39] !== tableController) {
21577
21680
  t9 = resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ jsx(FiltersDialog, { open: filtersDialogOpen, onOpenChange: setFiltersDialogOpen, properties: resolvedProperties, filterValues: tableController.filterValues, setFilterValues: (filterValues_0) => tableController.setFilterValues?.(filterValues_0 ?? {}), fixedFilter: collection.fixedFilter });
21578
- $[35] = collection.fixedFilter;
21579
- $[36] = filtersDialogOpen;
21580
- $[37] = resolvedProperties;
21581
- $[38] = tableController;
21582
- $[39] = t9;
21681
+ $[36] = collection.fixedFilter;
21682
+ $[37] = filtersDialogOpen;
21683
+ $[38] = resolvedProperties;
21684
+ $[39] = tableController;
21685
+ $[40] = t9;
21583
21686
  } else {
21584
- t9 = $[39];
21687
+ t9 = $[40];
21585
21688
  }
21586
21689
  let t10;
21587
- if ($[40] !== actions || $[41] !== pluginActionsStart || $[42] !== t9) {
21690
+ if ($[41] !== actions || $[42] !== pluginActionsStart || $[43] !== t9) {
21588
21691
  t10 = /* @__PURE__ */ jsxs(Fragment, { children: [
21589
21692
  actions,
21590
21693
  pluginActionsStart,
21591
21694
  t9
21592
21695
  ] });
21593
- $[40] = actions;
21594
- $[41] = pluginActionsStart;
21595
- $[42] = t9;
21596
- $[43] = t10;
21696
+ $[41] = actions;
21697
+ $[42] = pluginActionsStart;
21698
+ $[43] = t9;
21699
+ $[44] = t10;
21597
21700
  } else {
21598
- t10 = $[43];
21701
+ t10 = $[44];
21599
21702
  }
21600
21703
  return t10;
21601
21704
  }
@@ -21782,6 +21885,22 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
21782
21885
  onClose: unselectNavigatedEntity
21783
21886
  });
21784
21887
  }, [path, sideEntityController]);
21888
+ const openNewDocument = useCallback((defaultValues) => {
21889
+ const collection_3 = collectionRef.current;
21890
+ analyticsController.onAnalyticsEvent?.("new_entity_click", {
21891
+ path
21892
+ });
21893
+ navigateToEntity({
21894
+ openEntityMode,
21895
+ collection: collection_3,
21896
+ entityId: void 0,
21897
+ defaultValues,
21898
+ path,
21899
+ sideEntityController,
21900
+ navigation: urlController,
21901
+ onClose: unselectNavigatedEntity
21902
+ });
21903
+ }, [path, sideEntityController, openEntityMode, urlController, unselectNavigatedEntity]);
21785
21904
  const onMultipleDeleteClick = () => {
21786
21905
  analyticsController.onAnalyticsEvent?.("multiple_delete_dialog_open", {
21787
21906
  path
@@ -21845,8 +21964,8 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
21845
21964
  width,
21846
21965
  key
21847
21966
  }) => {
21848
- const collection_3 = collectionRef.current;
21849
- if (!getPropertyInPath(collection_3.properties, key)) return;
21967
+ const collection_4 = collectionRef.current;
21968
+ if (!getPropertyInPath(collection_4.properties, key)) return;
21850
21969
  const localCollection = buildPropertyWidthOverwrite(key, width);
21851
21970
  onCollectionModifiedForUser(path, localCollection);
21852
21971
  }, [onCollectionModifiedForUser, path]);
@@ -22050,13 +22169,13 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
22050
22169
  propertyKey: propertyKey_0,
22051
22170
  onHover
22052
22171
  }) => {
22053
- const collection_4 = collectionRef.current;
22172
+ const collection_5 = collectionRef.current;
22054
22173
  const headerSlotProps = {
22055
22174
  property: property_3,
22056
22175
  propertyKey: propertyKey_0,
22057
22176
  onHover,
22058
22177
  path,
22059
- collection: collection_4,
22178
+ collection: collection_5,
22060
22179
  tableController,
22061
22180
  parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
22062
22181
  parentEntityIds: parentEntityIds ?? EMPTY_ARRAY
@@ -22096,15 +22215,18 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
22096
22215
  error: tableController.dataLoadingError
22097
22216
  });
22098
22217
  tableController.dataLoadingError && pluginErrorViews.length > 0 ? pluginErrorViews[0] : null;
22099
- const isFilteredOrSorted = tableController.filterValues !== void 0 || tableController.sortBy !== void 0;
22218
+ const isSearching = !!tableController.searchString;
22219
+ const isFilteredOrSorted = tableController.filterValues !== void 0 || tableController.sortBy !== void 0 || isSearching;
22100
22220
  const emptyComponent = pluginEmptyStates.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: pluginEmptyStates }) : canCreateEntities && !isFilteredOrSorted ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
22101
22221
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: t("so_empty") }),
22102
22222
  /* @__PURE__ */ jsxs(Button, { onClick: onNewClick, className: "mt-4", children: [
22103
22223
  /* @__PURE__ */ jsx(PlusIcon, {}),
22104
22224
  t("create_your_first_entry")
22105
22225
  ] })
22106
- ] }) : /* @__PURE__ */ jsx(Typography, { variant: "label", children: t("no_results_filter_sort") });
22107
- const toolbarNode = /* @__PURE__ */ jsx(CollectionTableToolbar, { compact: isCompact, loading: tableController.dataLoading, onTextSearch: tableController.setSearchString, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsx(EntityCollectionViewStartActions, { parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY, parentEntityIds: parentEntityIds ?? EMPTY_ARRAY, collection, tableController, path, relativePath: collection.slug, selectionController: usedSelectionController, collectionEntitiesCount: docsCount ?? void 0, resolvedProperties: resolvedCollection.properties, compact: isCompact }), actions: /* @__PURE__ */ jsx(EntityCollectionViewActions, { parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY, parentEntityIds: parentEntityIds ?? EMPTY_ARRAY, collection, tableController, onMultipleDeleteClick, onNewClick, path, relativePath: collection.slug, selectionController: usedSelectionController, selectionEnabled: activeSelectionEnabled, collectionEntitiesCount: docsCount ?? void 0, compact: isCompact, children: pluginToolbarWidgets }) });
22226
+ ] }) : /* @__PURE__ */ jsx(Typography, { variant: "label", children: isSearching ? t("no_results_search", {
22227
+ search: tableController.searchString ?? ""
22228
+ }) : t("no_results_filter_sort") });
22229
+ const toolbarNode = /* @__PURE__ */ jsx(CollectionTableToolbar, { compact: isCompact, loading: tableController.dataLoading, onTextSearch: tableController.setSearchString, initialSearchText: tableController.searchString, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsx(EntityCollectionViewStartActions, { parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY, parentEntityIds: parentEntityIds ?? EMPTY_ARRAY, collection, tableController, path, relativePath: collection.slug, selectionController: usedSelectionController, collectionEntitiesCount: docsCount ?? void 0, resolvedProperties: resolvedCollection.properties, openNewDocument, compact: isCompact }), actions: /* @__PURE__ */ jsx(EntityCollectionViewActions, { parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY, parentEntityIds: parentEntityIds ?? EMPTY_ARRAY, collection, tableController, onMultipleDeleteClick, onNewClick, openNewDocument, path, relativePath: collection.slug, selectionController: usedSelectionController, selectionEnabled: activeSelectionEnabled, collectionEntitiesCount: docsCount ?? void 0, compact: isCompact, children: pluginToolbarWidgets }) });
22108
22230
  const innerView = viewMode === "kanban" ? /* @__PURE__ */ jsx(EntityCollectionBoardView, { collection, tableController, fullPath: path, parentCollectionSlugs, parentEntityIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent }, `kanban-view-${path}-${selectedKanbanProperty}`) : viewMode === "cards" ? /* @__PURE__ */ jsx(EntityCollectionCardView, { collection, tableController, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], onScroll: tableController.onScroll, initialScroll: tableController.initialScroll, size: cardSize, emptyComponent }, `cards-view-${path}`) : viewMode === "list" ? /* @__PURE__ */ jsx(EntityCollectionListView, { collection, tableController, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], size: listSize, emptyComponent }, `list-view-${path}`) : /* @__PURE__ */ jsx(EntityCollectionTable, { hideToolbar: true, additionalFields, tableController, enablePopupIcon: true, displayedColumnIds, onSizeChanged: onTableSizeChanged, onEntityClick, onColumnResize, onValueChange, tableRowActionsBuilder, uniqueFieldValidator, selectionController: usedSelectionController, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], defaultSize: tableSize, properties: resolvedCollection.properties, getPropertyFor, onScroll: tableController.onScroll, initialScroll: tableController.initialScroll, emptyComponent, hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsx(EntityIdHeaderWidget, { path, idPath: path, collection }), openEntityMode, onColumnsOrderChange }, `collection_table_${path}`);
22109
22231
  return /* @__PURE__ */ jsxs("div", { className: cls("overflow-hidden h-full w-full rounded-md flex flex-col dark:bg-surface-800", className), ref: containerRef, children: [
22110
22232
  countFetcher,
@@ -22126,6 +22248,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
22126
22248
  }, (a, b) => {
22127
22249
  return deepEqual(a.path, b.path) && deepEqual(a.parentCollectionSlugs, b.parentCollectionSlugs) && deepEqual(a.parentEntityIds, b.parentEntityIds) && deepEqual(a.isSubCollection, b.isSubCollection) && deepEqual(a.className, b.className) && deepEqual(a.properties, b.properties) && deepEqual(a.propertiesOrder, b.propertiesOrder) && deepEqual(a.hideIdFromCollection, b.hideIdFromCollection) && deepEqual(a.inlineEditing, b.inlineEditing) && deepEqual(a.selectionEnabled, b.selectionEnabled) && deepEqual(a.selectionController, b.selectionController) && deepEqual(a.Actions, b.Actions) && deepEqual(a.defaultSize, b.defaultSize) && deepEqual(a.includeJsonView, b.includeJsonView) && deepEqual(a.additionalFields, b.additionalFields) && deepEqual(a.sideDialogWidth, b.sideDialogWidth) && deepEqual(a.openEntityMode, b.openEntityMode) && deepEqual(a.exportable, b.exportable) && deepEqual(a.history, b.history) && deepEqual(a.fixedFilter, b.fixedFilter) && deepEqual(a.selectedEntityId, b.selectedEntityId) && deepEqual(a.selectedTab, b.selectedTab);
22128
22250
  });
22251
+ const inflightCountRequests = /* @__PURE__ */ new Map();
22129
22252
  function EntitiesCount({
22130
22253
  path,
22131
22254
  collection,
@@ -22166,10 +22289,17 @@ function EntitiesCount({
22166
22289
  }
22167
22290
  const whereParams = Object.keys(whereMap).length > 0 ? whereMap : void 0;
22168
22291
  const orderByParams = sortByProperty ? `${String(sortByProperty)}:${currentSort}` : void 0;
22169
- accessor.count({
22170
- where: whereParams,
22171
- orderBy: orderByParams
22172
- }).then((c2) => {
22292
+ const cacheKey = `${path}|${filterKey}|${sortByProperty ?? ""}|${currentSort ?? ""}`;
22293
+ let countPromise = inflightCountRequests.get(cacheKey);
22294
+ if (!countPromise) {
22295
+ countPromise = accessor.count({
22296
+ where: whereParams,
22297
+ orderBy: orderByParams
22298
+ });
22299
+ inflightCountRequests.set(cacheKey, countPromise);
22300
+ countPromise.finally(() => inflightCountRequests.delete(cacheKey));
22301
+ }
22302
+ countPromise.then((c2) => {
22173
22303
  if (!cancelled) onCountChangeRef.current?.(c2);
22174
22304
  }).catch((e) => {
22175
22305
  console.warn("Error fetching count", e);
@@ -22635,7 +22765,7 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
22635
22765
  const t4 = drawerOpen && largeLayout;
22636
22766
  let t5;
22637
22767
  if ($[7] !== className || $[8] !== largeLayout || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
22638
- t5 = cls("w-full h-16 transition-all ease-in duration-75 absolute top-0 max-w-full overflow-x-auto no-scrollbar", "flex flex-row gap-2 px-4 items-center", "backdrop-blur-md bg-surface-50/80 dark:bg-surface-900/80", {
22768
+ t5 = cls("w-full h-14 transition-all ease-in duration-75 absolute top-0 max-w-full overflow-x-auto no-scrollbar", "flex flex-row gap-2 px-4 items-center", "backdrop-blur-sm bg-surface-50/95 dark:bg-surface-900/80", {
22639
22769
  "pl-[19rem]": t2,
22640
22770
  "pl-24": t3,
22641
22771
  "z-10": largeLayout,
@@ -22873,7 +23003,7 @@ function DrawerNavigationItem(t0) {
22873
23003
  } = t0;
22874
23004
  let t1;
22875
23005
  if ($[0] !== icon) {
22876
- t1 = /* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center justify-center w-[56px] h-[40px] text-text-secondary dark:text-text-secondary-dark", children: icon });
23006
+ t1 = /* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center justify-center w-[44px] h-[30px] text-surface-500 dark:text-text-secondary-dark [&>svg]:size-4", children: icon });
22877
23007
  $[0] = icon;
22878
23008
  $[1] = t1;
22879
23009
  } else {
@@ -22898,7 +23028,7 @@ function DrawerNavigationItem(t0) {
22898
23028
  const {
22899
23029
  isActive
22900
23030
  } = t52;
22901
- return cls("rounded-lg truncate", "hover:bg-surface-100 dark:hover:bg-surface-800/60 text-text-primary dark:text-surface-300 hover:text-surface-900 dark:hover:text-white", "flex flex-row items-center", drawerOpen ? "pr-4 h-10" : "h-10", "font-semibold text-xs", isActive ? "bg-surface-100 dark:bg-surface-800/50 text-surface-900 dark:text-white" : "");
23031
+ return cls("rounded-md truncate", "hover:bg-surface-100 dark:hover:bg-surface-800/60 text-surface-700 dark:text-surface-300 hover:text-surface-900 dark:hover:text-white", "flex flex-row items-center", drawerOpen ? "pr-4 h-[30px]" : "h-[30px]", "font-medium text-[13px]", isActive ? "bg-surface-900/[0.06] dark:bg-surface-800/50 text-surface-900 dark:text-white" : "");
22902
23032
  };
22903
23033
  $[4] = drawerOpen;
22904
23034
  $[5] = t4;
@@ -22954,7 +23084,7 @@ function DrawerNavigationItem(t0) {
22954
23084
  return t10;
22955
23085
  }
22956
23086
  function DrawerNavigationGroup(t0) {
22957
- const $ = c(33);
23087
+ const $ = c(32);
22958
23088
  const {
22959
23089
  group,
22960
23090
  entries,
@@ -22973,9 +23103,9 @@ function DrawerNavigationGroup(t0) {
22973
23103
  const t1 = `drawer_group_${group}`;
22974
23104
  let t2;
22975
23105
  if ($[0] !== collapsed || $[1] !== drawerOpen || $[2] !== group || $[3] !== headerActions || $[4] !== hideHeader || $[5] !== onToggleCollapsed || $[6] !== t) {
22976
- t2 = !hideHeader && /* @__PURE__ */ jsxs("div", { className: cls("pl-4 pr-2 py-0.5 flex flex-row items-center transition-colors", drawerOpen ? "cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-800/40 rounded-lg" : "opacity-0 invisible pointer-events-none"), onClick: drawerOpen ? onToggleCollapsed : void 0, children: [
22977
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: iconSize.small, className: cls("text-surface-500 dark:text-surface-400 transition-transform duration-200 mr-1", collapsed ? "-rotate-90" : "rotate-0") }),
22978
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "font-medium flex-grow line-clamp-1", children: group || t("views_group") }),
23106
+ t2 = !hideHeader && /* @__PURE__ */ jsxs("div", { className: cls("pl-3 pr-2 py-0.5 flex flex-row items-center transition-colors", drawerOpen ? "cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-800/40 rounded-lg" : "opacity-0 invisible pointer-events-none"), onClick: drawerOpen ? onToggleCollapsed : void 0, children: [
23107
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: iconSize.small, className: cls("text-surface-400 dark:text-surface-400 transition-transform duration-200 mr-1", collapsed ? "-rotate-90" : "rotate-0") }),
23108
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "font-semibold text-[11px] uppercase tracking-wider flex-grow line-clamp-1 text-surface-400 dark:text-surface-400", children: group || t("views_group") }),
22979
23109
  headerActions && /* @__PURE__ */ jsx("div", { onClick: _temp$6, children: headerActions })
22980
23110
  ] });
22981
23111
  $[0] = collapsed;
@@ -22989,75 +23119,73 @@ function DrawerNavigationGroup(t0) {
22989
23119
  } else {
22990
23120
  t2 = $[7];
22991
23121
  }
22992
- const t3 = !hideHeader && collapsed ? "overflow-hidden" : "overflow-visible";
22993
- const t4 = !hideHeader && "dark:bg-transparent";
22994
- const t5 = !hideHeader ? drawerOpen ? "rounded-lg" : "rounded-lg" : "rounded-lg";
22995
- const t6 = !hideHeader && collapsed ? "max-h-0 opacity-0" : "max-h-[2000px] opacity-100";
22996
- let t7;
22997
- if ($[8] !== t3 || $[9] !== t4 || $[10] !== t5 || $[11] !== t6) {
22998
- t7 = cls("transition-all duration-200 ease-in-out", t3, t4, t5, t6);
23122
+ const t3 = !hideHeader && "dark:bg-transparent";
23123
+ const t4 = !hideHeader ? drawerOpen ? "rounded-lg" : "rounded-lg" : "rounded-lg";
23124
+ const t5 = !hideHeader && collapsed ? "max-h-0 opacity-0" : "max-h-[2000px] opacity-100";
23125
+ let t6;
23126
+ if ($[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
23127
+ t6 = cls("transition-all duration-200 ease-in-out", "overflow-hidden", t3, t4, t5);
22999
23128
  $[8] = t3;
23000
23129
  $[9] = t4;
23001
23130
  $[10] = t5;
23002
23131
  $[11] = t6;
23003
- $[12] = t7;
23004
23132
  } else {
23005
- t7 = $[12];
23133
+ t6 = $[11];
23006
23134
  }
23007
- let t8;
23008
- if ($[13] !== adminMenuOpen || $[14] !== collapsed || $[15] !== drawerOpen || $[16] !== entries || $[17] !== onItemClick || $[18] !== tooltipsOpen) {
23009
- let t92;
23010
- if ($[20] !== adminMenuOpen || $[21] !== collapsed || $[22] !== drawerOpen || $[23] !== onItemClick || $[24] !== tooltipsOpen) {
23011
- t92 = (entry) => /* @__PURE__ */ jsx(DrawerNavigationItem, { icon: /* @__PURE__ */ jsx(IconForView, { collectionOrView: entry.collection ?? entry.view, size: "small" }), tooltipsOpen: !collapsed && tooltipsOpen, adminMenuOpen, drawerOpen, onClick: () => onItemClick?.(entry), url: entry.url, name: entry.name }, entry.id);
23012
- $[20] = adminMenuOpen;
23013
- $[21] = collapsed;
23014
- $[22] = drawerOpen;
23015
- $[23] = onItemClick;
23016
- $[24] = tooltipsOpen;
23017
- $[25] = t92;
23135
+ let t7;
23136
+ if ($[12] !== adminMenuOpen || $[13] !== collapsed || $[14] !== drawerOpen || $[15] !== entries || $[16] !== onItemClick || $[17] !== tooltipsOpen) {
23137
+ let t82;
23138
+ if ($[19] !== adminMenuOpen || $[20] !== collapsed || $[21] !== drawerOpen || $[22] !== onItemClick || $[23] !== tooltipsOpen) {
23139
+ t82 = (entry) => /* @__PURE__ */ jsx(DrawerNavigationItem, { icon: /* @__PURE__ */ jsx(IconForView, { collectionOrView: entry.collection ?? entry.view, size: "small" }), tooltipsOpen: !collapsed && tooltipsOpen, adminMenuOpen, drawerOpen, onClick: () => onItemClick?.(entry), url: entry.url, name: entry.name }, entry.id);
23140
+ $[19] = adminMenuOpen;
23141
+ $[20] = collapsed;
23142
+ $[21] = drawerOpen;
23143
+ $[22] = onItemClick;
23144
+ $[23] = tooltipsOpen;
23145
+ $[24] = t82;
23018
23146
  } else {
23019
- t92 = $[25];
23020
- }
23021
- t8 = entries.map(t92);
23022
- $[13] = adminMenuOpen;
23023
- $[14] = collapsed;
23024
- $[15] = drawerOpen;
23025
- $[16] = entries;
23026
- $[17] = onItemClick;
23027
- $[18] = tooltipsOpen;
23028
- $[19] = t8;
23147
+ t82 = $[24];
23148
+ }
23149
+ t7 = entries.map(t82);
23150
+ $[12] = adminMenuOpen;
23151
+ $[13] = collapsed;
23152
+ $[14] = drawerOpen;
23153
+ $[15] = entries;
23154
+ $[16] = onItemClick;
23155
+ $[17] = tooltipsOpen;
23156
+ $[18] = t7;
23029
23157
  } else {
23030
- t8 = $[19];
23158
+ t7 = $[18];
23031
23159
  }
23032
- let t9;
23033
- if ($[26] !== t7 || $[27] !== t8) {
23034
- t9 = /* @__PURE__ */ jsx("div", { className: t7, children: t8 });
23160
+ let t8;
23161
+ if ($[25] !== t6 || $[26] !== t7) {
23162
+ t8 = /* @__PURE__ */ jsx("div", { className: t6, children: t7 });
23163
+ $[25] = t6;
23035
23164
  $[26] = t7;
23036
23165
  $[27] = t8;
23037
- $[28] = t9;
23038
23166
  } else {
23039
- t9 = $[28];
23167
+ t8 = $[27];
23040
23168
  }
23041
- let t10;
23042
- if ($[29] !== t1 || $[30] !== t2 || $[31] !== t9) {
23043
- t10 = /* @__PURE__ */ jsxs("div", { className: "my-2 mx-2 flex flex-col", children: [
23169
+ let t9;
23170
+ if ($[28] !== t1 || $[29] !== t2 || $[30] !== t8) {
23171
+ t9 = /* @__PURE__ */ jsxs("div", { className: "my-2 mx-2 flex flex-col", children: [
23044
23172
  t2,
23045
- t9
23173
+ t8
23046
23174
  ] }, t1);
23047
- $[29] = t1;
23048
- $[30] = t2;
23175
+ $[28] = t1;
23176
+ $[29] = t2;
23177
+ $[30] = t8;
23049
23178
  $[31] = t9;
23050
- $[32] = t10;
23051
23179
  } else {
23052
- t10 = $[32];
23180
+ t9 = $[31];
23053
23181
  }
23054
- return t10;
23182
+ return t9;
23055
23183
  }
23056
23184
  function _temp$6(e) {
23057
23185
  return e.stopPropagation();
23058
23186
  }
23059
23187
  function DefaultDrawer(t0) {
23060
- const $ = c(71);
23188
+ const $ = c(52);
23061
23189
  const {
23062
23190
  title,
23063
23191
  logo,
@@ -23094,48 +23222,49 @@ function DefaultDrawer(t0) {
23094
23222
  const context = useRebaseContext();
23095
23223
  const tooltipsOpen = drawerHovered && !drawerOpen && !adminMenuOpen;
23096
23224
  const largeLayout = useLargeLayout();
23097
- useNavigate();
23098
23225
  const adminModeController = useAdminModeController();
23099
- useEffectiveRoleController();
23100
23226
  const registry = useRebaseRegistry();
23101
- navigationState.topLevelNavigation?.navigationEntries.filter(_temp$5) ?? [];
23102
23227
  let t2;
23103
- if ($[1] !== navigationState.topLevelNavigation?.groups) {
23104
- t2 = navigationState.topLevelNavigation?.groups ?? [];
23105
- $[1] = navigationState.topLevelNavigation?.groups;
23228
+ if ($[1] !== navigationState.topLevelNavigation?.navigationEntries) {
23229
+ t2 = navigationState.topLevelNavigation?.navigationEntries ?? [];
23230
+ $[1] = navigationState.topLevelNavigation?.navigationEntries;
23106
23231
  $[2] = t2;
23107
23232
  } else {
23108
23233
  t2 = $[2];
23109
23234
  }
23110
- let groupsToRender = t2;
23111
- if (adminModeController.mode === "studio") {
23112
- let t32;
23113
- if ($[3] !== groupsToRender) {
23114
- t32 = groupsToRender.filter(_temp2$2);
23115
- $[3] = groupsToRender;
23116
- $[4] = t32;
23117
- } else {
23118
- t32 = $[4];
23119
- }
23120
- groupsToRender = t32;
23235
+ const allNavigationEntries = t2;
23236
+ const filteredEntries = adminModeController.mode === "studio" ? allNavigationEntries.filter(_temp$5) : allNavigationEntries.filter(_temp2$2);
23237
+ const entryGroups = new Set(filteredEntries.map(_temp3$2).filter(Boolean));
23238
+ let t3;
23239
+ if ($[3] !== navigationState.topLevelNavigation?.groups) {
23240
+ t3 = navigationState.topLevelNavigation?.groups ?? [];
23241
+ $[3] = navigationState.topLevelNavigation?.groups;
23242
+ $[4] = t3;
23121
23243
  } else {
23122
- let t32;
23123
- if ($[5] !== groupsToRender) {
23124
- t32 = groupsToRender.filter(_temp3$2);
23125
- $[5] = groupsToRender;
23126
- $[6] = t32;
23127
- } else {
23128
- t32 = $[6];
23129
- }
23130
- groupsToRender = t32;
23244
+ t3 = $[4];
23131
23245
  }
23246
+ const orderedGroups = t3;
23247
+ const groupsToRender = [...orderedGroups.filter((g) => entryGroups.has(g)), ...[...entryGroups].filter((g_0) => !orderedGroups.includes(g_0))];
23248
+ registry.cmsConfig?.navigationGroupMappings;
23249
+ let t4;
23250
+ const t5 = registry.cmsConfig?.navigationGroupMappings;
23251
+ let t6;
23252
+ if ($[5] !== t5) {
23253
+ t6 = buildCollapsedDefaults(t5, "drawer");
23254
+ $[5] = t5;
23255
+ $[6] = t6;
23256
+ } else {
23257
+ t6 = $[6];
23258
+ }
23259
+ t4 = t6;
23260
+ const collapsedDefaults = t4;
23132
23261
  const {
23133
23262
  isGroupCollapsed,
23134
23263
  toggleGroupCollapsed
23135
- } = useCollapsedGroups(groupsToRender, "drawer");
23136
- let t3;
23264
+ } = useCollapsedGroups(groupsToRender, "drawer", collapsedDefaults);
23265
+ let t7;
23137
23266
  if ($[7] !== context || $[8] !== drawerHovered || $[9] !== drawerOpen) {
23138
- t3 = {
23267
+ t7 = {
23139
23268
  drawerOpen,
23140
23269
  drawerHovered,
23141
23270
  context
@@ -23143,14 +23272,14 @@ function DefaultDrawer(t0) {
23143
23272
  $[7] = context;
23144
23273
  $[8] = drawerHovered;
23145
23274
  $[9] = drawerOpen;
23146
- $[10] = t3;
23275
+ $[10] = t7;
23147
23276
  } else {
23148
- t3 = $[10];
23277
+ t7 = $[10];
23149
23278
  }
23150
- const headerSlot = useSlot("navigation.header", t3);
23151
- let t4;
23279
+ const headerSlot = useSlot("navigation.header", t7);
23280
+ let t8;
23152
23281
  if ($[11] !== context || $[12] !== drawerHovered || $[13] !== drawerOpen) {
23153
- t4 = {
23282
+ t8 = {
23154
23283
  drawerOpen,
23155
23284
  drawerHovered,
23156
23285
  context
@@ -23158,18 +23287,17 @@ function DefaultDrawer(t0) {
23158
23287
  $[11] = context;
23159
23288
  $[12] = drawerHovered;
23160
23289
  $[13] = drawerOpen;
23161
- $[14] = t4;
23290
+ $[14] = t8;
23162
23291
  } else {
23163
- t4 = $[14];
23292
+ t8 = $[14];
23164
23293
  }
23165
- const footerSlot = useSlot("navigation.footer", t4);
23294
+ const footerSlot = useSlot("navigation.footer", t8);
23166
23295
  if (!navigationState.topLevelNavigation) {
23167
23296
  return null;
23168
23297
  }
23169
- const navigationEntries = navigationState.topLevelNavigation.navigationEntries;
23170
- let t5;
23298
+ let t9;
23171
23299
  if ($[15] !== analyticsController || $[16] !== closeDrawer || $[17] !== closeHover || $[18] !== drawerOpen || $[19] !== largeLayout) {
23172
- t5 = (view) => {
23300
+ t9 = (view) => {
23173
23301
  const eventName = view.type === "collection" ? "drawer_navigate_to_collection" : view.type === "view" ? "drawer_navigate_to_view" : "unmapped_event";
23174
23302
  analyticsController.onAnalyticsEvent?.(eventName, {
23175
23303
  url: view.url
@@ -23187,139 +23315,112 @@ function DefaultDrawer(t0) {
23187
23315
  $[17] = closeHover;
23188
23316
  $[18] = drawerOpen;
23189
23317
  $[19] = largeLayout;
23190
- $[20] = t5;
23318
+ $[20] = t9;
23191
23319
  } else {
23192
- t5 = $[20];
23320
+ t9 = $[20];
23193
23321
  }
23194
- const onItemClick = t5;
23322
+ const onItemClick = t9;
23195
23323
  const drawerVisuallyOpen = drawerOpen || drawerHovered;
23196
- let t6;
23324
+ const t10 = "navigation";
23325
+ const t11 = "Main navigation";
23326
+ let t12;
23197
23327
  if ($[21] !== className) {
23198
- t6 = cls("flex flex-col h-full relative grow w-full", className);
23328
+ t12 = cls("flex flex-col h-full relative grow w-full", className);
23199
23329
  $[21] = className;
23200
- $[22] = t6;
23330
+ $[22] = t12;
23201
23331
  } else {
23202
- t6 = $[22];
23332
+ t12 = $[22];
23203
23333
  }
23204
- let t7;
23334
+ let t13;
23205
23335
  if ($[23] !== drawerHovered || $[24] !== drawerOpen || $[25] !== logoDestination || $[26] !== resolvedLogo || $[27] !== title) {
23206
- t7 = /* @__PURE__ */ jsx(DrawerLogo, { logo: resolvedLogo, title, logoDestination, drawerOpen, drawerHovered });
23336
+ t13 = /* @__PURE__ */ jsx(DrawerLogo, { logo: resolvedLogo, title, logoDestination, drawerOpen, drawerHovered });
23207
23337
  $[23] = drawerHovered;
23208
23338
  $[24] = drawerOpen;
23209
23339
  $[25] = logoDestination;
23210
23340
  $[26] = resolvedLogo;
23211
23341
  $[27] = title;
23212
- $[28] = t7;
23342
+ $[28] = t13;
23213
23343
  } else {
23214
- t7 = $[28];
23344
+ t13 = $[28];
23215
23345
  }
23216
- let t8;
23346
+ let t14;
23217
23347
  if ($[29] !== drawerHovered || $[30] !== drawerOpen || $[31] !== registry.studioConfig) {
23218
- t8 = registry.studioConfig && /* @__PURE__ */ jsx(DrawerModeSwitch, { drawerOpen, drawerHovered });
23348
+ t14 = registry.studioConfig && /* @__PURE__ */ jsx(DrawerModeSwitch, { drawerOpen, drawerHovered });
23219
23349
  $[29] = drawerHovered;
23220
23350
  $[30] = drawerOpen;
23221
23351
  $[31] = registry.studioConfig;
23222
- $[32] = t8;
23352
+ $[32] = t14;
23223
23353
  } else {
23224
- t8 = $[32];
23354
+ t14 = $[32];
23225
23355
  }
23226
- const t9 = scrolled ? "linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 20px), transparent 100%)" : "linear-gradient(to bottom, black 0, black calc(100% - 20px), transparent 100%)";
23227
- let t10;
23228
- if ($[33] !== t9) {
23229
- t10 = {
23230
- maskImage: t9
23356
+ const t15 = "flex-grow min-h-0 overflow-y-auto overflow-x-hidden no-scrollbar";
23357
+ const t16 = scrolled ? "linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 20px), transparent 100%)" : "linear-gradient(to bottom, black 0, black calc(100% - 20px), transparent 100%)";
23358
+ let t17;
23359
+ if ($[33] !== t16) {
23360
+ t17 = {
23361
+ maskImage: t16
23231
23362
  };
23232
- $[33] = t9;
23233
- $[34] = t10;
23234
- } else {
23235
- t10 = $[34];
23236
- }
23237
- let t11;
23238
- if ($[35] !== adminMenuOpen || $[36] !== adminModeController.mode || $[37] !== drawerVisuallyOpen || $[38] !== groupsToRender || $[39] !== isGroupCollapsed || $[40] !== navigationEntries || $[41] !== onItemClick || $[42] !== toggleGroupCollapsed || $[43] !== tooltipsOpen) {
23239
- let t122;
23240
- if ($[45] !== adminMenuOpen || $[46] !== adminModeController.mode || $[47] !== drawerVisuallyOpen || $[48] !== isGroupCollapsed || $[49] !== navigationEntries || $[50] !== onItemClick || $[51] !== toggleGroupCollapsed || $[52] !== tooltipsOpen) {
23241
- t122 = (group) => {
23242
- const entriesInGroup = Object.values(navigationEntries).filter((e_0) => e_0.group === group);
23243
- return /* @__PURE__ */ jsx(DrawerNavigationGroup, { group, entries: entriesInGroup, collapsed: isGroupCollapsed(group), onToggleCollapsed: () => toggleGroupCollapsed(group), drawerOpen: drawerVisuallyOpen, tooltipsOpen, adminMenuOpen, onItemClick, hideHeader: adminModeController.mode === "studio" }, `drawer_group_${group}`);
23244
- };
23245
- $[45] = adminMenuOpen;
23246
- $[46] = adminModeController.mode;
23247
- $[47] = drawerVisuallyOpen;
23248
- $[48] = isGroupCollapsed;
23249
- $[49] = navigationEntries;
23250
- $[50] = onItemClick;
23251
- $[51] = toggleGroupCollapsed;
23252
- $[52] = tooltipsOpen;
23253
- $[53] = t122;
23254
- } else {
23255
- t122 = $[53];
23256
- }
23257
- t11 = groupsToRender.map(t122);
23258
- $[35] = adminMenuOpen;
23259
- $[36] = adminModeController.mode;
23260
- $[37] = drawerVisuallyOpen;
23261
- $[38] = groupsToRender;
23262
- $[39] = isGroupCollapsed;
23263
- $[40] = navigationEntries;
23264
- $[41] = onItemClick;
23265
- $[42] = toggleGroupCollapsed;
23266
- $[43] = tooltipsOpen;
23267
- $[44] = t11;
23363
+ $[33] = t16;
23364
+ $[34] = t17;
23268
23365
  } else {
23269
- t11 = $[44];
23366
+ t17 = $[34];
23270
23367
  }
23271
- let t12;
23272
- if ($[54] !== t10 || $[55] !== t11) {
23273
- t12 = /* @__PURE__ */ jsx("div", { ref: scrollRef, onScroll: handleScroll, className: "flex-grow min-h-0 overflow-y-auto overflow-x-visible no-scrollbar", style: t10, children: t11 });
23274
- $[54] = t10;
23275
- $[55] = t11;
23276
- $[56] = t12;
23368
+ const t18 = groupsToRender.map((group) => {
23369
+ const entriesInGroup = filteredEntries.filter((e_2) => e_2.group === group);
23370
+ return /* @__PURE__ */ jsx(DrawerNavigationGroup, { group, entries: entriesInGroup, collapsed: isGroupCollapsed(group), onToggleCollapsed: () => toggleGroupCollapsed(group), drawerOpen: drawerVisuallyOpen, tooltipsOpen, adminMenuOpen, onItemClick }, `drawer_group_${group}`);
23371
+ });
23372
+ let t19;
23373
+ if ($[35] !== t17 || $[36] !== t18) {
23374
+ t19 = /* @__PURE__ */ jsx("div", { ref: scrollRef, onScroll: handleScroll, className: t15, style: t17, children: t18 });
23375
+ $[35] = t17;
23376
+ $[36] = t18;
23377
+ $[37] = t19;
23277
23378
  } else {
23278
- t12 = $[56];
23379
+ t19 = $[37];
23279
23380
  }
23280
- let t13;
23281
- if ($[57] !== closeDrawer || $[58] !== drawerHovered || $[59] !== drawerOpen || $[60] !== openDrawer) {
23282
- t13 = /* @__PURE__ */ jsx(DrawerToggle, { drawerOpen, drawerHovered, openDrawer, closeDrawer });
23283
- $[57] = closeDrawer;
23284
- $[58] = drawerHovered;
23285
- $[59] = drawerOpen;
23286
- $[60] = openDrawer;
23287
- $[61] = t13;
23381
+ let t20;
23382
+ if ($[38] !== closeDrawer || $[39] !== drawerHovered || $[40] !== drawerOpen || $[41] !== openDrawer) {
23383
+ t20 = /* @__PURE__ */ jsx(DrawerToggle, { drawerOpen, drawerHovered, openDrawer, closeDrawer });
23384
+ $[38] = closeDrawer;
23385
+ $[39] = drawerHovered;
23386
+ $[40] = drawerOpen;
23387
+ $[41] = openDrawer;
23388
+ $[42] = t20;
23288
23389
  } else {
23289
- t13 = $[61];
23390
+ t20 = $[42];
23290
23391
  }
23291
- let t14;
23292
- if ($[62] !== footerSlot || $[63] !== headerSlot || $[64] !== style || $[65] !== t12 || $[66] !== t13 || $[67] !== t6 || $[68] !== t7 || $[69] !== t8) {
23293
- t14 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { role: "navigation", "aria-label": "Main navigation", className: t6, style, children: [
23294
- t7,
23295
- t8,
23392
+ let t21;
23393
+ if ($[43] !== footerSlot || $[44] !== headerSlot || $[45] !== style || $[46] !== t12 || $[47] !== t13 || $[48] !== t14 || $[49] !== t19 || $[50] !== t20) {
23394
+ t21 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { role: t10, "aria-label": t11, className: t12, style, children: [
23395
+ t13,
23396
+ t14,
23296
23397
  headerSlot,
23297
- t12,
23398
+ t19,
23298
23399
  footerSlot,
23299
- t13
23400
+ t20
23300
23401
  ] }) });
23301
- $[62] = footerSlot;
23302
- $[63] = headerSlot;
23303
- $[64] = style;
23304
- $[65] = t12;
23305
- $[66] = t13;
23306
- $[67] = t6;
23307
- $[68] = t7;
23308
- $[69] = t8;
23309
- $[70] = t14;
23310
- } else {
23311
- t14 = $[70];
23402
+ $[43] = footerSlot;
23403
+ $[44] = headerSlot;
23404
+ $[45] = style;
23405
+ $[46] = t12;
23406
+ $[47] = t13;
23407
+ $[48] = t14;
23408
+ $[49] = t19;
23409
+ $[50] = t20;
23410
+ $[51] = t21;
23411
+ } else {
23412
+ t21 = $[51];
23312
23413
  }
23313
- return t14;
23414
+ return t21;
23314
23415
  }
23315
- function _temp3$2(g_0) {
23316
- return !STUDIO_NAVIGATION_GROUPS.includes(g_0);
23416
+ function _temp3$2(e_1) {
23417
+ return e_1.group;
23317
23418
  }
23318
- function _temp2$2(g) {
23319
- return STUDIO_NAVIGATION_GROUPS.includes(g);
23419
+ function _temp2$2(e_0) {
23420
+ return e_0.type !== "view";
23320
23421
  }
23321
23422
  function _temp$5(e) {
23322
- return e.type === "admin";
23423
+ return e.type === "view" || e.type === "admin";
23323
23424
  }
23324
23425
  function DrawerLogo(t0) {
23325
23426
  const $ = c(17);
@@ -23526,7 +23627,7 @@ function DrawerModeSwitch(t0) {
23526
23627
  const t1 = showSwitch ? "opacity-100 h-7 mt-2 mb-0" : "opacity-0 pointer-events-none h-7 mt-2 mb-0";
23527
23628
  let t2;
23528
23629
  if ($[0] !== t1) {
23529
- t2 = cls("overflow-hidden transition-all duration-200 ease-in-out px-3", t1);
23630
+ t2 = cls("shrink-0 overflow-hidden transition-all duration-200 ease-in-out px-3", t1);
23530
23631
  $[0] = t1;
23531
23632
  $[1] = t2;
23532
23633
  } else {
@@ -23816,7 +23917,7 @@ const Scaffold = React__default.memo(function Scaffold2(props) {
23816
23917
  const t17 = hasAppBar && !padding;
23817
23918
  let t18;
23818
23919
  if ($[27] !== padding || $[28] !== t16 || $[29] !== t17) {
23819
- t18 = cls(defaultBorderMixin, "bg-white dark:bg-surface-800", "grow overflow-auto m-0", {
23920
+ t18 = cls(defaultBorderMixin, "bg-surface-50 dark:bg-surface-800", "grow overflow-auto m-0", {
23820
23921
  "lg:mt-4": t16,
23821
23922
  "mt-1 lg:m-0 lg:mx-2 lg:mb-2 lg:rounded-lg lg:border-t lg:border-x lg:border-solid": padding,
23822
23923
  "border-t": t17
@@ -23888,7 +23989,7 @@ const DrawerHeader = () => {
23888
23989
  const $ = c(1);
23889
23990
  let t0;
23890
23991
  if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
23891
- t0 = /* @__PURE__ */ jsx("div", { className: "flex flex-col min-h-16" });
23992
+ t0 = /* @__PURE__ */ jsx("div", { className: "flex flex-col min-h-14" });
23892
23993
  $[0] = t0;
23893
23994
  } else {
23894
23995
  t0 = $[0];
@@ -23903,7 +24004,7 @@ function DrawerWrapper(props) {
23903
24004
  const {
23904
24005
  t
23905
24006
  } = useTranslation();
23906
- const t0 = isFloating ? `absolute top-0 left-0 bottom-0 z-50 bg-surface-50 ${"dark:bg-surface-900"} shadow-2xl border-r` : `relative bg-surface-50 ${"dark:bg-surface-900"}`;
24007
+ const t0 = isFloating ? `absolute top-0 left-0 bottom-0 z-50 bg-surface-50 ${"dark:bg-surface-900"} shadow-lg border-r` : `relative bg-surface-50 ${"dark:bg-surface-900"}`;
23907
24008
  let t1;
23908
24009
  if ($[0] !== t0) {
23909
24010
  t1 = cls("h-full overflow-hidden", defaultBorderMixin, t0);
@@ -24191,7 +24292,7 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
24191
24292
  }
24192
24293
  const EMPTY_PLUGINS = [];
24193
24294
  const EMPTY_COLLECTIONS = [];
24194
- const CollectionsStudioView = lazy(() => import("./CollectionsStudioView-B549BDpU.js").then((n) => n.b).then((m) => ({
24295
+ const CollectionsStudioView = lazy(() => import("./CollectionsStudioView-BDzMFzqH.js").then((n) => n.b).then((m) => ({
24195
24296
  default: m.CollectionsStudioView
24196
24297
  })));
24197
24298
  function RebaseNavigation({
@@ -24203,10 +24304,9 @@ function RebaseNavigation({
24203
24304
  const userManagement = useInternalUserManagementController();
24204
24305
  const userConfigPersistence = useBuildLocalConfigurationPersistence();
24205
24306
  const collectionEditorConfig = registry.cmsConfig?.collectionEditor;
24206
- const collectionEditorEnabled = Boolean(collectionEditorConfig);
24307
+ const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);
24207
24308
  const collectionEditorOptions = useMemo(() => {
24208
- if (!collectionEditorConfig) return void 0;
24209
- if (collectionEditorConfig === true) return {};
24309
+ if (collectionEditorConfig === true || !collectionEditorConfig) return {};
24210
24310
  return collectionEditorConfig;
24211
24311
  }, [collectionEditorConfig]);
24212
24312
  const cmsCollections = registry.cmsConfig?.collections ?? EMPTY_COLLECTIONS;
@@ -24235,7 +24335,6 @@ function RebaseNavigation({
24235
24335
  return {
24236
24336
  slug: "schema",
24237
24337
  name: "Edit collections",
24238
- group: "Database",
24239
24338
  icon: "LayoutList",
24240
24339
  nestedRoutes: true,
24241
24340
  view: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}), children: /* @__PURE__ */ jsx(CollectionsStudioView, { configController: internalConfigController }) })
@@ -24250,6 +24349,7 @@ function RebaseNavigation({
24250
24349
  plugins: registry.cmsConfig?.plugins ?? EMPTY_PLUGINS,
24251
24350
  collections: collectionsBuilder,
24252
24351
  views: devViews,
24352
+ navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,
24253
24353
  authController: context.authController,
24254
24354
  data: context.data,
24255
24355
  collectionRegistryController,
@@ -24670,6 +24770,7 @@ function EntityFullScreenRoute({
24670
24770
  const urlController = useUrlController();
24671
24771
  const navigate = useNavigate();
24672
24772
  const location = useLocation$1();
24773
+ const defaultValues = location.state?.defaultValues;
24673
24774
  const hash = location.hash;
24674
24775
  const navigationPath = urlController.urlPathToDataPath(pathname);
24675
24776
  const blocked = useRef(false);
@@ -24702,9 +24803,14 @@ function EntityFullScreenRoute({
24702
24803
  let blocker = void 0;
24703
24804
  try {
24704
24805
  blocker = useBlocker(({
24806
+ currentLocation,
24705
24807
  nextLocation
24706
24808
  }) => {
24707
24809
  if (nextLocation.pathname.startsWith(entityPath)) return false;
24810
+ const nextHash = nextLocation.hash;
24811
+ if (nextHash === "#side" || nextHash === "#new_side") return false;
24812
+ const currentHash = currentLocation.hash;
24813
+ if ((currentHash === "#side" || currentHash === "#new_side") && (nextLocation.pathname === basePath || nextLocation.pathname.startsWith(entityPath))) return false;
24708
24814
  return blocked.current;
24709
24815
  });
24710
24816
  } catch (e) {
@@ -24727,15 +24833,16 @@ function EntityFullScreenRoute({
24727
24833
  const fullIdPath = isNew ? lastCollectionEntry.slug : lastEntityEntry.slug;
24728
24834
  const collectionPath = urlController.resolveDatabasePathsFrom(fullIdPath);
24729
24835
  return /* @__PURE__ */ jsxs(Fragment, { children: [
24730
- /* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
24836
+ /* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, defaultValues: isNew ? defaultValues : void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
24731
24837
  const newSelectedTab = params.selectedTab;
24732
24838
  const newEntityId = params.entityId;
24839
+ const savedHash = isNew ? "" : hash;
24733
24840
  if (newSelectedTab) {
24734
- navigate(`${basePath}/${newEntityId}/${newSelectedTab}${hash}`, {
24841
+ navigate(`${basePath}/${newEntityId}/${newSelectedTab}${savedHash}`, {
24735
24842
  replace: true
24736
24843
  });
24737
24844
  } else {
24738
- navigate(`${basePath}/${newEntityId}${hash}`, {
24845
+ navigate(`${basePath}/${newEntityId}${savedHash}`, {
24739
24846
  replace: true
24740
24847
  });
24741
24848
  }
@@ -24795,10 +24902,10 @@ function CustomViewRoute(t0) {
24795
24902
  useEffect(t1, t2);
24796
24903
  return view.view;
24797
24904
  }
24798
- const CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-D509-IMx.js").then((m) => ({
24905
+ const CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-ywdxhs1L.js").then((m) => ({
24799
24906
  default: m.CollectionEditorDialog
24800
24907
  })));
24801
- const PropertyFormDialog = lazy(() => import("./PropertyEditView-UtDO8g0A.js").then((n) => n.d).then((m) => ({
24908
+ const PropertyFormDialog = lazy(() => import("./PropertyEditView-BuZrNnBN.js").then((n) => n.d).then((m) => ({
24802
24909
  default: m.PropertyFormDialog
24803
24910
  })));
24804
24911
  function CollectionEditorDialogs() {
@@ -24847,13 +24954,13 @@ function CollectionEditorDialogs() {
24847
24954
  }
24848
24955
  function _temp$2() {
24849
24956
  }
24850
- const ContentHomePage = lazy(() => import("./ContentHomePage--Bl1FXk7.js").then((m) => ({
24957
+ const ContentHomePage = lazy(() => import("./ContentHomePage-0tHuEIm_.js").then((m) => ({
24851
24958
  default: m.ContentHomePage
24852
24959
  })));
24853
- const UsersView = lazy(() => import("./UsersView-BM2_7VPV.js").then((m) => ({
24960
+ const UsersView = lazy(() => import("./UsersView-BkeblMVT.js").then((m) => ({
24854
24961
  default: m.UsersView
24855
24962
  })));
24856
- const RolesView = lazy(() => import("./RolesView-B0E7L0hE.js").then((m) => ({
24963
+ const RolesView = lazy(() => import("./RolesView-CMPsaIXo.js").then((m) => ({
24857
24964
  default: m.RolesView
24858
24965
  })));
24859
24966
  function SettingsView() {
@@ -25881,15 +25988,18 @@ const PropertyPreview = React__default.memo(function PropertyPreview2(props) {
25881
25988
  content = t02;
25882
25989
  } else {
25883
25990
  if (property.ui?.Preview) {
25884
- content = createElement(property.ui?.Preview, {
25885
- propertyKey,
25886
- value,
25887
- property,
25888
- size,
25889
- height,
25890
- width,
25891
- customProps: property.ui?.customProps
25892
- });
25991
+ const ResolvedPreview = resolveComponentRef(property.ui.Preview);
25992
+ if (ResolvedPreview) {
25993
+ content = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: createElement(ResolvedPreview, {
25994
+ propertyKey,
25995
+ value,
25996
+ property,
25997
+ size,
25998
+ height,
25999
+ width,
26000
+ customProps: property.ui?.customProps
26001
+ }) });
26002
+ }
25893
26003
  } else {
25894
26004
  if (value === void 0 || value === null) {
25895
26005
  let t02;
@@ -28003,4 +28113,4 @@ export {
28003
28113
  ArrayOfReferencesPreview as y,
28004
28114
  ArrayOfStorageComponentsPreview as z
28005
28115
  };
28006
- //# sourceMappingURL=util-DK1O3uM0.js.map
28116
+ //# sourceMappingURL=util-zfU1zOCX.js.map