@firecms/core 3.0.0-canary.113 → 3.0.0-canary.115

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 (31) hide show
  1. package/dist/components/ArrayContainer.d.ts +2 -1
  2. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
  3. package/dist/components/EntityPreview.d.ts +1 -1
  4. package/dist/form/components/FormikArrayContainer.d.ts +2 -1
  5. package/dist/index.es.js +114 -74
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +113 -73
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  10. package/dist/types/side_dialogs_controller.d.ts +10 -0
  11. package/dist/util/icons.d.ts +1 -0
  12. package/package.json +5 -5
  13. package/src/components/ArrayContainer.tsx +7 -4
  14. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +13 -8
  15. package/src/components/EntityPreview.tsx +20 -22
  16. package/src/components/HomePage/DefaultHomePage.tsx +7 -9
  17. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +6 -2
  18. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -3
  19. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -1
  20. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
  21. package/src/core/EntityEditView.tsx +18 -16
  22. package/src/form/components/FormikArrayContainer.tsx +4 -1
  23. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -4
  24. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
  25. package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -4
  26. package/src/hooks/useBuildNavigationController.tsx +0 -3
  27. package/src/internal/useBuildSideDialogsController.tsx +1 -0
  28. package/src/internal/useBuildSideEntityController.tsx +13 -2
  29. package/src/preview/components/ReferencePreview.tsx +2 -13
  30. package/src/types/side_dialogs_controller.tsx +13 -0
  31. package/src/util/icons.tsx +8 -2
package/dist/index.umd.js CHANGED
@@ -2688,7 +2688,11 @@
2688
2688
  return iconKey in iconKeysMap ? /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { iconKey, size: "medium", className }) : void 0;
2689
2689
  }
2690
2690
  const IconForView = React.memo(
2691
- function IconForView2({ collectionOrView, className }) {
2691
+ function IconForView2({
2692
+ collectionOrView,
2693
+ className,
2694
+ size = "medium"
2695
+ }) {
2692
2696
  if (!collectionOrView) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
2693
2697
  const icon = getIcon(collectionOrView.icon, className);
2694
2698
  if (collectionOrView?.icon && icon)
@@ -2705,7 +2709,7 @@
2705
2709
  const iconsCount = ui.coolIconKeys.length;
2706
2710
  if (!key)
2707
2711
  key = ui.coolIconKeys[hashString(collectionOrView.path) % iconsCount];
2708
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { iconKey: key, size: "medium", className });
2712
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { iconKey: key, size, className });
2709
2713
  },
2710
2714
  (prevProps, nextProps) => {
2711
2715
  return equal(prevProps.collectionOrView?.icon, nextProps.collectionOrView?.icon);
@@ -4084,7 +4088,6 @@
4084
4088
  );
4085
4089
  let shouldUpdateTopLevelNav = false;
4086
4090
  if (!areCollectionListsEqual(collectionsRef.current ?? [], resolvedCollections)) {
4087
- console.log("Collections need to be updated");
4088
4091
  collectionsRef.current = resolvedCollections;
4089
4092
  shouldUpdateTopLevelNav = true;
4090
4093
  }
@@ -4093,12 +4096,10 @@
4093
4096
  shouldUpdateTopLevelNav = true;
4094
4097
  }
4095
4098
  if (!equal(viewsRef.current, resolvedViews)) {
4096
- console.log("Views need to be updated");
4097
4099
  viewsRef.current = resolvedViews;
4098
4100
  shouldUpdateTopLevelNav = true;
4099
4101
  }
4100
4102
  if (!equal(adminViewsRef.current, resolvedAdminViews)) {
4101
- console.log("Admin views need to be updated");
4102
4103
  adminViewsRef.current = resolvedAdminViews;
4103
4104
  shouldUpdateTopLevelNav = true;
4104
4105
  }
@@ -4968,8 +4969,8 @@
4968
4969
  function renderSkeletonIcon() {
4969
4970
  return /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { width: 24, height: 24 });
4970
4971
  }
4971
- const StorageThumbnail = React.memo(StorageThumbnailInternal, areEqual$2);
4972
- function areEqual$2(prevProps, nextProps) {
4972
+ const StorageThumbnail = React.memo(StorageThumbnailInternal, areEqual$1);
4973
+ function areEqual$1(prevProps, nextProps) {
4973
4974
  return prevProps.size === nextProps.size && prevProps.storagePathOrDownloadUrl === nextProps.storagePathOrDownloadUrl && prevProps.storeUrl === nextProps.storeUrl && prevProps.interactive === nextProps.interactive;
4974
4975
  }
4975
4976
  const URL_CACHE = {};
@@ -5176,15 +5177,18 @@
5176
5177
  hover: disabled ? void 0 : hover,
5177
5178
  size,
5178
5179
  children: [
5179
- imageProperty && /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "smallest" ? "my-0.5" : "m-2 self-start"), children: /* @__PURE__ */ jsxRuntime.jsx(
5180
- PropertyPreview,
5181
- {
5182
- property: imageProperty,
5183
- propertyKey: imagePropertyKey,
5184
- size: "smallest",
5185
- value: getValueInPath(entity.values, imagePropertyKey)
5186
- }
5187
- ) }),
5180
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "smallest" ? "my-0.5" : "m-2 self-start"), children: [
5181
+ imageProperty && /* @__PURE__ */ jsxRuntime.jsx(
5182
+ PropertyPreview,
5183
+ {
5184
+ property: imageProperty,
5185
+ propertyKey: imagePropertyKey,
5186
+ size: "smallest",
5187
+ value: getValueInPath(entity.values, imagePropertyKey)
5188
+ }
5189
+ ),
5190
+ !imageProperty && /* @__PURE__ */ jsxRuntime.jsx(IconForView, { collectionOrView: collection, size, className: "mr-2" })
5191
+ ] }),
5188
5192
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col flex-grow w-full m-1", children: [
5189
5193
  size !== "smallest" && includeId && (entity ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${size !== "medium" ? "block whitespace-nowrap overflow-hidden truncate" : ""}`, children: /* @__PURE__ */ jsxRuntime.jsx(
5190
5194
  ui.Typography,
@@ -5264,7 +5268,7 @@
5264
5268
  }
5265
5269
  );
5266
5270
  }
5267
- const EntityPreviewContainerInner = React__namespace.forwardRef(({
5271
+ const EntityPreviewContainer = React__namespace.forwardRef(({
5268
5272
  children,
5269
5273
  hover,
5270
5274
  onClick,
@@ -5306,9 +5310,7 @@
5306
5310
  }
5307
5311
  );
5308
5312
  });
5309
- EntityPreviewContainerInner.displayName = "EntityPreviewContainer";
5310
- const EntityPreviewContainer = React__namespace.memo(EntityPreviewContainerInner);
5311
- const ReferencePreview = React__namespace.memo(function ReferencePreview2(props) {
5313
+ const ReferencePreview = function ReferencePreview2(props) {
5312
5314
  const reference = props.reference;
5313
5315
  if (!(typeof reference === "object" && "isEntityReference" in reference && reference.isEntityReference())) {
5314
5316
  console.warn("Reference preview received value of type", typeof reference);
@@ -5328,10 +5330,7 @@
5328
5330
  );
5329
5331
  }
5330
5332
  return /* @__PURE__ */ jsxRuntime.jsx(ReferencePreviewInternal, { ...props });
5331
- }, areEqual$1);
5332
- function areEqual$1(prevProps, nextProps) {
5333
- return prevProps.disabled === nextProps.disabled && prevProps.size === nextProps.size && prevProps.hover === nextProps.hover && prevProps.reference?.id === nextProps.reference?.id && prevProps.reference?.path === nextProps.reference?.path && prevProps.includeEntityLink === nextProps.includeEntityLink && prevProps.onClick === nextProps.onClick;
5334
- }
5333
+ };
5335
5334
  function ReferencePreviewInternal({
5336
5335
  disabled,
5337
5336
  reference,
@@ -6292,6 +6291,7 @@
6292
6291
  return /* @__PURE__ */ jsxRuntime.jsx(
6293
6292
  ui.TextareaAutosize,
6294
6293
  {
6294
+ className: ui.focusedDisabled,
6295
6295
  ref,
6296
6296
  style: {
6297
6297
  padding: 0,
@@ -6492,7 +6492,7 @@
6492
6492
  "input",
6493
6493
  {
6494
6494
  ref,
6495
- className: "w-full text-right p-0 m-0 bg-transparent border-none resize-none outline-none font-normal leading-normal text-unset",
6495
+ className: ui.cls("w-full text-right p-0 m-0 bg-transparent border-none resize-none outline-none font-normal leading-normal text-unset", ui.focusedDisabled),
6496
6496
  style: {
6497
6497
  textAlign: align
6498
6498
  },
@@ -6545,8 +6545,8 @@
6545
6545
  onChange: (dateValue) => updateValue(dateValue ?? null),
6546
6546
  size: "medium",
6547
6547
  invisible: true,
6548
- className: "w-full h-full",
6549
- inputClassName: "w-full h-full",
6548
+ inputClassName: ui.cls("w-full h-full", ui.focusedDisabled),
6549
+ className: ui.cls("w-full h-full", ui.focusedDisabled),
6550
6550
  mode,
6551
6551
  locale
6552
6552
  }
@@ -7157,10 +7157,10 @@
7157
7157
  throw Error(`Couldn't find the corresponding collection view for the path: ${path}`);
7158
7158
  }
7159
7159
  }
7160
- return /* @__PURE__ */ jsxRuntime.jsx(TableReferenceFieldSuccess, { ...props, collection });
7160
+ return /* @__PURE__ */ jsxRuntime.jsx(TableReferenceFieldInternal, { ...props, collection });
7161
7161
  }
7162
- const TableReferenceFieldSuccess = React.memo(
7163
- function TableReferenceFieldSuccess2(props) {
7162
+ const TableReferenceFieldInternal = React.memo(
7163
+ function TableReferenceFieldInternal2(props) {
7164
7164
  const {
7165
7165
  name,
7166
7166
  internalValue,
@@ -7195,11 +7195,11 @@
7195
7195
  forceFilter
7196
7196
  }
7197
7197
  );
7198
- const handleOpen = React.useCallback(() => {
7198
+ const handleOpen = () => {
7199
7199
  if (disabled)
7200
7200
  return;
7201
7201
  referenceDialogController.open();
7202
- }, [disabled, referenceDialogController]);
7202
+ };
7203
7203
  const valueNotSet = !internalValue || Array.isArray(internalValue) && internalValue.length === 0;
7204
7204
  const buildSingleReferenceField = () => {
7205
7205
  if (internalValue && !Array.isArray(internalValue) && internalValue.isEntityReference && internalValue.isEntityReference())
@@ -7262,12 +7262,21 @@
7262
7262
  EntityPreviewContainer,
7263
7263
  {
7264
7264
  className: ui.cls(
7265
- "p-4 text-sm font-medium flex items-center gap-4 uppercase",
7265
+ "p-4 text-sm font-medium flex items-center uppercase",
7266
+ multiselect ? "gap-4" : "gap-6",
7266
7267
  disabled ? "text-slate-500" : "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800"
7267
7268
  ),
7268
7269
  onClick: handleOpen,
7269
7270
  size: "medium",
7270
7271
  children: [
7272
+ /* @__PURE__ */ jsxRuntime.jsx(
7273
+ IconForView,
7274
+ {
7275
+ size: "small",
7276
+ collectionOrView: collection,
7277
+ className: "text-gray-300 dark:text-gray-600"
7278
+ }
7279
+ ),
7271
7280
  "Edit ",
7272
7281
  title
7273
7282
  ]
@@ -11050,7 +11059,17 @@
11050
11059
  tableController,
11051
11060
  enablePopupIcon: false,
11052
11061
  tableRowActionsBuilder,
11053
- title: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}` }),
11062
+ title: /* @__PURE__ */ jsxRuntime.jsxs(ui.Typography, { variant: "subtitle2", className: "flex flex-row gap-2", children: [
11063
+ /* @__PURE__ */ jsxRuntime.jsx(
11064
+ IconForView,
11065
+ {
11066
+ size: "small",
11067
+ collectionOrView: collection,
11068
+ className: "text-gray-300 dark:text-gray-600"
11069
+ }
11070
+ ),
11071
+ collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`
11072
+ ] }),
11054
11073
  defaultSize: collection.defaultSize,
11055
11074
  properties: resolvedCollection.properties,
11056
11075
  forceFilter,
@@ -11482,15 +11501,11 @@
11482
11501
  groups
11483
11502
  } = navigationController.topLevelNavigation;
11484
11503
  const [filteredUrls, setFilteredUrls] = React.useState(null);
11485
- const filteredNavigationEntries = filteredUrls ? navigationEntries.filter((entry) => filteredUrls.includes(entry.url)) : navigationEntries;
11504
+ const performingSearch = Boolean(filteredUrls);
11505
+ const filteredNavigationEntries = filteredUrls ? filteredUrls.map((url) => navigationEntries.find((e) => e.url === url)).filter(Boolean) : navigationEntries;
11486
11506
  React.useEffect(() => {
11487
11507
  fuse.current = new Fuse(navigationEntries, {
11488
- keys: [
11489
- "name",
11490
- "description",
11491
- "group",
11492
- "path"
11493
- ]
11508
+ keys: ["name", "description", "group", "path"]
11494
11509
  });
11495
11510
  }, [navigationEntries]);
11496
11511
  const updateSearchResults = React.useCallback(
@@ -11507,7 +11522,8 @@
11507
11522
  },
11508
11523
  []
11509
11524
  );
11510
- const allGroups = [...groups];
11525
+ const filteredGroups = filteredUrls ? filteredNavigationEntries.map((entry) => entry.group) : [];
11526
+ const allGroups = filteredUrls ? filteredGroups.filter((group, index) => filteredGroups.indexOf(group) === index) : [...groups];
11511
11527
  if (filteredNavigationEntries.filter((e) => !e.group).length > 0 || filteredNavigationEntries.length === 0) {
11512
11528
  allGroups.push(void 0);
11513
11529
  }
@@ -11563,7 +11579,7 @@
11563
11579
  ]
11564
11580
  }
11565
11581
  ),
11566
- /* @__PURE__ */ jsxRuntime.jsx(FavouritesView, { hidden: Boolean(filteredUrls) }),
11582
+ /* @__PURE__ */ jsxRuntime.jsx(FavouritesView, { hidden: performingSearch }),
11567
11583
  additionalChildrenStart,
11568
11584
  additionalPluginChildrenStart,
11569
11585
  allGroups.map((group, index) => {
@@ -11580,7 +11596,7 @@
11580
11596
  });
11581
11597
  }
11582
11598
  const thisGroupCollections = filteredNavigationEntries.filter((entry) => entry.group === group || !entry.group && group === void 0);
11583
- if (thisGroupCollections.length === 0 && AdditionalCards.length === 0)
11599
+ if (thisGroupCollections.length === 0 && (AdditionalCards.length === 0 || performingSearch))
11584
11600
  return null;
11585
11601
  return /* @__PURE__ */ jsxRuntime.jsx(
11586
11602
  NavigationGroup,
@@ -13279,7 +13295,8 @@
13279
13295
  onInternalIdAdded,
13280
13296
  includeAddButton,
13281
13297
  newDefaultEntry,
13282
- onValueChange
13298
+ onValueChange,
13299
+ className
13283
13300
  }) {
13284
13301
  const hasValue = value && Array.isArray(value) && value.length > 0;
13285
13302
  const internalIdsRef = React.useRef(buildIdsMap(value));
@@ -13368,6 +13385,7 @@
13368
13385
  children: (droppableProvided, droppableSnapshot) => /* @__PURE__ */ jsxRuntime.jsxs(
13369
13386
  "div",
13370
13387
  {
13388
+ className,
13371
13389
  ...droppableProvided.droppableProps,
13372
13390
  ref: droppableProvided.innerRef,
13373
13391
  children: [
@@ -13438,7 +13456,7 @@
13438
13456
  ref: provided.innerRef,
13439
13457
  ...provided.draggableProps,
13440
13458
  style: provided.draggableProps.style,
13441
- className: `${isDragging || onHover ? ui.fieldBackgroundHoverMixin : ""} mb-1 rounded-md opacity-100`,
13459
+ className: `${isDragging || onHover ? "hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-20" : ""} mb-1 rounded-md opacity-100`,
13442
13460
  children: /* @__PURE__ */ jsxRuntime.jsxs(
13443
13461
  "div",
13444
13462
  {
@@ -13447,7 +13465,7 @@
13447
13465
  /* @__PURE__ */ jsxRuntime.jsx(
13448
13466
  "div",
13449
13467
  {
13450
- className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark bg-white dark:bg-gray-900 bg-opacity-80 dark:bg-opacity-80",
13468
+ className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark",
13451
13469
  children: buildEntry(index, internalId)
13452
13470
  }
13453
13471
  ),
@@ -13757,7 +13775,8 @@
13757
13775
  onInternalIdAdded,
13758
13776
  includeAddButton,
13759
13777
  newDefaultEntry = null,
13760
- setFieldValue
13778
+ setFieldValue,
13779
+ className
13761
13780
  }) {
13762
13781
  return /* @__PURE__ */ jsxRuntime.jsx(
13763
13782
  ArrayContainer,
@@ -13771,6 +13790,7 @@
13771
13790
  onInternalIdAdded,
13772
13791
  includeAddButton,
13773
13792
  newDefaultEntry,
13793
+ className,
13774
13794
  onValueChange: (value2) => setFieldValue(name, value2)
13775
13795
  }
13776
13796
  );
@@ -14110,10 +14130,10 @@
14110
14130
  forceFilter: ofProperty.forceFilter
14111
14131
  }
14112
14132
  );
14113
- const onEntryClick = React.useCallback((e) => {
14133
+ const onEntryClick = (e) => {
14114
14134
  e.preventDefault();
14115
14135
  referenceDialogController.open();
14116
- }, [referenceDialogController]);
14136
+ };
14117
14137
  const buildEntry = React.useCallback((index, internalId) => {
14118
14138
  const entryValue = value && value.length > index ? value[index] : void 0;
14119
14139
  if (!entryValue)
@@ -14141,7 +14161,7 @@
14141
14161
  icon: getIconForProperty(property, "small"),
14142
14162
  required: property.validation?.required,
14143
14163
  title: property.name,
14144
- className: "flex-grow text-text-secondary dark:text-text-secondary-dark"
14164
+ className: "flex flex-grow text-text-secondary dark:text-text-secondary-dark"
14145
14165
  }
14146
14166
  ),
14147
14167
  Array.isArray(value) && /* @__PURE__ */ jsxRuntime.jsxs(ui.Typography, { variant: "caption", className: "px-4", children: [
@@ -14174,7 +14194,7 @@
14174
14194
  ui.Button,
14175
14195
  {
14176
14196
  className: "my-4 justify-center text-left",
14177
- variant: "outlined",
14197
+ variant: "text",
14178
14198
  color: "primary",
14179
14199
  disabled: isSubmitting,
14180
14200
  onClick: onEntryClick,
@@ -14933,10 +14953,10 @@
14933
14953
  forceFilter: property.forceFilter
14934
14954
  }
14935
14955
  );
14936
- const onEntryClick = React.useCallback((e) => {
14956
+ const onEntryClick = (e) => {
14937
14957
  e.preventDefault();
14938
14958
  referenceDialogController.open();
14939
- }, [referenceDialogController]);
14959
+ };
14940
14960
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14941
14961
  !minimalistView && /* @__PURE__ */ jsxRuntime.jsx(
14942
14962
  LabelWithIconAndTooltip,
@@ -14978,7 +14998,13 @@
14978
14998
  onClick: onEntryClick,
14979
14999
  size: "medium",
14980
15000
  children: [
14981
- /* @__PURE__ */ jsxRuntime.jsx(EmptyValue, {}),
15001
+ /* @__PURE__ */ jsxRuntime.jsx(
15002
+ IconForView,
15003
+ {
15004
+ collectionOrView: collection,
15005
+ className: "text-gray-300 dark:text-gray-600"
15006
+ }
15007
+ ),
14982
15008
  `Edit ${property.name}`.toUpperCase()
14983
15009
  ]
14984
15010
  }
@@ -16083,6 +16109,7 @@
16083
16109
  FormikArrayContainer,
16084
16110
  {
16085
16111
  value,
16112
+ className: "flex flex-col gap-3",
16086
16113
  name: propertyKey,
16087
16114
  addLabel: property.name ? "Add entry to " + property.name : "Add entry",
16088
16115
  buildEntry,
@@ -16164,7 +16191,7 @@
16164
16191
  formex$1.setFieldValue(typeFieldName, newType);
16165
16192
  formex$1.setFieldValue(valueFieldName, newSelectedProperty ? getDefaultValueFor(newSelectedProperty) : null);
16166
16193
  };
16167
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls(ui.paperMixin, "bg-transparent p-2 mb-4"), children: [
16194
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls(ui.paperMixin, "bg-transparent p-2"), children: [
16168
16195
  /* @__PURE__ */ jsxRuntime.jsx(
16169
16196
  formex.Field,
16170
16197
  {
@@ -17354,8 +17381,8 @@
17354
17381
  entityId
17355
17382
  }
17356
17383
  );
17357
- const selectedTabRef = React.useRef(defaultSelectedView ?? MAIN_TAB_VALUE);
17358
- const mainViewVisible = selectedTabRef.current === MAIN_TAB_VALUE;
17384
+ const [selectedTab, setSelectedTab] = React.useState(defaultSelectedView ?? MAIN_TAB_VALUE);
17385
+ const mainViewVisible = selectedTab === MAIN_TAB_VALUE;
17359
17386
  const subcollections = (collection.subcollections ?? []).filter((c) => !c.hideFromNavigation);
17360
17387
  const subcollectionsCount = subcollections?.length ?? 0;
17361
17388
  const customViews = collection.entityViews;
@@ -17415,7 +17442,7 @@
17415
17442
  sideEntityController.replace({
17416
17443
  path,
17417
17444
  entityId: updatedEntity.id,
17418
- selectedSubPath: MAIN_TAB_VALUE === selectedTabRef.current ? void 0 : selectedTabRef.current,
17445
+ selectedSubPath: MAIN_TAB_VALUE === selectedTab ? void 0 : selectedTab,
17419
17446
  updateUrl: true,
17420
17447
  collection
17421
17448
  });
@@ -17563,13 +17590,13 @@
17563
17590
  formex: formex$1
17564
17591
  };
17565
17592
  const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
17566
- const selectedEntityView = resolvedEntityViews.find((e) => e.key === selectedTabRef.current);
17567
- const shouldShowEntityActions = !autoSave && (selectedTabRef.current === MAIN_TAB_VALUE || selectedEntityView?.includeActions);
17593
+ const selectedEntityView = resolvedEntityViews.find((e) => e.key === selectedTab);
17594
+ const shouldShowEntityActions = !autoSave && (selectedTab === MAIN_TAB_VALUE || selectedEntityView?.includeActions);
17568
17595
  const customViewsView = customViews && resolvedEntityViews.map(
17569
17596
  (customView, colIndex) => {
17570
17597
  if (!customView)
17571
17598
  return null;
17572
- if (selectedTabRef.current !== customView.key)
17599
+ if (selectedTab !== customView.key)
17573
17600
  return null;
17574
17601
  const Builder = customView.Builder;
17575
17602
  if (!Builder) {
@@ -17604,7 +17631,7 @@
17604
17631
  (subcollection, colIndex) => {
17605
17632
  const subcollectionId = subcollection.id ?? subcollection.path;
17606
17633
  const fullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
17607
- if (selectedTabRef.current !== subcollectionId)
17634
+ if (selectedTab !== subcollectionId)
17608
17635
  return null;
17609
17636
  return /* @__PURE__ */ jsxRuntime.jsxs(
17610
17637
  "div",
@@ -17638,14 +17665,16 @@
17638
17665
  onValuesAreModified(false);
17639
17666
  }, []);
17640
17667
  const onSideTabClick = (value) => {
17641
- selectedTabRef.current = value;
17642
- sideEntityController.replace({
17643
- path,
17644
- entityId,
17645
- selectedSubPath: value === MAIN_TAB_VALUE ? void 0 : value,
17646
- updateUrl: true,
17647
- collection
17648
- });
17668
+ setSelectedTab(value);
17669
+ if (status === "existing") {
17670
+ sideEntityController.replace({
17671
+ path,
17672
+ entityId,
17673
+ selectedSubPath: value === MAIN_TAB_VALUE ? void 0 : value,
17674
+ updateUrl: true,
17675
+ collection
17676
+ });
17677
+ }
17649
17678
  };
17650
17679
  const onIdUpdateError = React.useCallback((error) => {
17651
17680
  snackbarController.open({
@@ -18048,7 +18077,7 @@
18048
18077
  /* @__PURE__ */ jsxRuntime.jsxs(
18049
18078
  ui.Tabs,
18050
18079
  {
18051
- value: selectedTabRef.current,
18080
+ value: selectedTab,
18052
18081
  onValueChange: (value) => {
18053
18082
  onSideTabClick(value);
18054
18083
  },
@@ -18459,6 +18488,15 @@
18459
18488
  initialised.current = true;
18460
18489
  }
18461
18490
  }, [location, navigation.loading, navigation.isUrlCollectionPath, navigation.buildUrlCollectionPath, navigation.resolveAliasesFrom, sideDialogsController, smallLayout, navigation]);
18491
+ React.useEffect(() => {
18492
+ const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
18493
+ if (sidePanelProps.additional) {
18494
+ return propsToSidePanel(sidePanelProps.additional, navigation.buildUrlCollectionPath, navigation.resolveAliasesFrom, smallLayout);
18495
+ }
18496
+ return sidePanelProps;
18497
+ });
18498
+ sideDialogsController.setSidePanels(updatedSidePanels);
18499
+ }, [smallLayout]);
18462
18500
  const close = React.useCallback(() => {
18463
18501
  sideDialogsController.close();
18464
18502
  }, [sideDialogsController]);
@@ -18551,7 +18589,8 @@
18551
18589
  urlPath: newPath,
18552
18590
  parentUrlPath: buildUrlCollectionPath(collectionPath),
18553
18591
  width: entityViewWidth,
18554
- onClose: props.onClose
18592
+ onClose: props.onClose,
18593
+ additional: props
18555
18594
  };
18556
18595
  };
18557
18596
  function useBuildSideDialogsController() {
@@ -18644,6 +18683,7 @@
18644
18683
  }, [location, navigate, sidePanels]);
18645
18684
  return {
18646
18685
  sidePanels,
18686
+ setSidePanels: updateSidePanels,
18647
18687
  close,
18648
18688
  open,
18649
18689
  replace