@firecms/core 3.0.0-canary.162 → 3.0.0-canary.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -352,6 +352,7 @@ function isPropertyBuilder(propertyOrBuilder) {
352
352
  function getDefaultValuesFor(properties) {
353
353
  if (!properties) return {};
354
354
  return Object.entries(properties).map(([key, property]) => {
355
+ if (!property) return {};
355
356
  const value = getDefaultValueFor(property);
356
357
  return value === void 0 ? {} : {
357
358
  [key]: value
@@ -362,6 +363,7 @@ function getDefaultValuesFor(properties) {
362
363
  }), {});
363
364
  }
364
365
  function getDefaultValueFor(property) {
366
+ if (!property) return void 0;
365
367
  if (isPropertyBuilder(property)) return void 0;
366
368
  if (property.defaultValue || property.defaultValue === null) {
367
369
  return property.defaultValue;
@@ -8852,7 +8854,6 @@ const EntityCollectionTable = function EntityCollectionTable2({
8852
8854
  const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
8853
8855
  const context = useFireCMSContext();
8854
8856
  const [size, setSize] = React__default.useState(defaultSize ?? "m");
8855
- const selectedEntityIds = selectedEntities?.map((e) => e.id);
8856
8857
  const updateSize = useCallback((size_0) => {
8857
8858
  if (onSizeChanged) onSizeChanged(size_0);
8858
8859
  setSize(size_0);
@@ -8908,7 +8909,7 @@ const EntityCollectionTable = function EntityCollectionTable2({
8908
8909
  context
8909
8910
  })?.toString() });
8910
8911
  return /* @__PURE__ */ jsx(EntityTableCell, { width, size, value: value_0, selected: false, disabled: true, align: "left", allowScroll: false, showExpandIcon: false, disabledTooltip: "This column can't be edited directly", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: child }) }, `additional_table_cell_${entity_0.id}_${column_0.key}`);
8911
- }, [size, selectedEntityIds]);
8912
+ }, [size]);
8912
8913
  const collectionColumns = (() => {
8913
8914
  const columnsResult = propertiesToColumns({
8914
8915
  properties,
@@ -8958,14 +8959,14 @@ const EntityCollectionTable = function EntityCollectionTable2({
8958
8959
  } else {
8959
8960
  throw Error("Internal: columns not mapped properly");
8960
8961
  }
8961
- } catch (e_0) {
8962
- console.error("Error rendering cell", e_0);
8963
- return /* @__PURE__ */ jsx(EntityTableCell, { size, width: column_1.width, saved: false, value: null, align: "left", fullHeight: false, disabled: true, children: /* @__PURE__ */ jsx(ErrorView, { error: e_0 }) });
8962
+ } catch (e) {
8963
+ console.error("Error rendering cell", e);
8964
+ return /* @__PURE__ */ jsx(EntityTableCell, { size, width: column_1.width, saved: false, value: null, align: "left", fullHeight: false, disabled: true, children: /* @__PURE__ */ jsx(ErrorView, { error: e }) });
8964
8965
  }
8965
8966
  }, [tableRowActionsBuilder, additionalCellRenderer, propertyCellRenderer, size]);
8966
8967
  return /* @__PURE__ */ jsxs("div", { ref, style, className: cls("h-full w-full flex flex-col bg-white dark:bg-surface-950", className), children: [
8967
8968
  /* @__PURE__ */ jsx(CollectionTableToolbar, { onTextSearch: textSearchEnabled ? onTextSearch : void 0, textSearchLoading, onTextSearchClick: textSearchEnabled ? onTextSearchClick : void 0, size, onSizeChanged: updateSize, title, actionsStart, actions, loading: tableController.dataLoading }),
8968
- /* @__PURE__ */ jsx(SelectableTable, { columns, size, inlineEditing, cellRenderer, onEntityClick, highlightedRow: useCallback((entity_1) => selectedEntityIds?.includes(entity_1.id) ?? false, [selectedEntityIds]), tableController, onValueChange, onColumnResize, hoverRow, filterable, emptyComponent, endAdornment, AddColumnComponent })
8969
+ /* @__PURE__ */ jsx(SelectableTable, { columns, size, inlineEditing, cellRenderer, onEntityClick, highlightedRow: (entity_1) => Boolean(selectedEntities?.find((e_0) => e_0.id === entity_1.id && e_0.path === entity_1.path)), tableController, onValueChange, onColumnResize, hoverRow, filterable, emptyComponent, endAdornment, AddColumnComponent })
8969
8970
  ] });
8970
8971
  };
8971
8972
  function useDataOrder({
@@ -9160,9 +9161,10 @@ function useSelectionController(onSelectionChange) {
9160
9161
  const toggleEntitySelection = useCallback((entity, newSelectedState) => {
9161
9162
  let newValue;
9162
9163
  if (newSelectedState === void 0) {
9163
- if (selectedEntities.map((e) => e.id).includes(entity.id)) {
9164
+ const isSelected = Boolean(selectedEntities.find((e) => e.id === entity.id && e.path === entity.path));
9165
+ if (isSelected) {
9164
9166
  onSelectionChange?.(entity, false);
9165
- newValue = selectedEntities.filter((item) => item.id !== entity.id);
9167
+ newValue = selectedEntities.filter((item) => !(item.id === entity.id && item.path === entity.path));
9166
9168
  } else {
9167
9169
  onSelectionChange?.(entity, true);
9168
9170
  newValue = [...selectedEntities, entity];
@@ -9173,13 +9175,13 @@ function useSelectionController(onSelectionChange) {
9173
9175
  newValue = [...selectedEntities, entity];
9174
9176
  } else {
9175
9177
  onSelectionChange?.(entity, false);
9176
- newValue = selectedEntities.filter((item_0) => item_0.id !== entity.id);
9178
+ newValue = selectedEntities.filter((item_0) => !(item_0.id === entity.id && item_0.path === entity.path));
9177
9179
  }
9178
9180
  }
9179
9181
  setSelectedEntities(newValue);
9180
9182
  }, [selectedEntities]);
9181
9183
  const isEntitySelected = useCallback((entity_0) => {
9182
- return selectedEntities.map((e_0) => e_0.id).includes(entity_0.id);
9184
+ return Boolean(selectedEntities.find((e_0) => e_0.id === entity_0.id && e_0.path === entity_0.path));
9183
9185
  }, [selectedEntities]);
9184
9186
  return {
9185
9187
  selectedEntities,
@@ -12389,7 +12391,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
12389
12391
  width: width_0,
12390
12392
  frozen
12391
12393
  }) => {
12392
- const isSelected = usedSelectionController.selectedEntities.map((e_1) => e_1.id).includes(entity_6.id);
12394
+ const isSelected = Boolean(usedSelectionController.selectedEntities.find((e_1) => e_1.id == entity_6.id && e_1.path == entity_6.path));
12393
12395
  const actions_0 = getActionsForEntity({
12394
12396
  entity: entity_6,
12395
12397
  customEntityActions: collection.entityActions
@@ -12873,7 +12875,7 @@ function useApp() {
12873
12875
  return React__default.useContext(AppContext);
12874
12876
  }
12875
12877
  const DefaultAppBar = function DefaultAppBar2(t0) {
12876
- const $ = c(45);
12878
+ const $ = c(44);
12877
12879
  const {
12878
12880
  title,
12879
12881
  endAdornment,
@@ -12957,58 +12959,57 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
12957
12959
  t5 = $[12];
12958
12960
  }
12959
12961
  let t6;
12960
- if ($[13] !== drawerOpen || $[14] !== hasDrawer || $[15] !== logo || $[16] !== navigation || $[17] !== title) {
12961
- t6 = navigation && /* @__PURE__ */ jsx("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsx(Link, { className: "visited:text-inherit visited:dark:text-inherit", to: navigation?.basePath ?? "/", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-4", children: [
12962
+ if ($[13] !== hasDrawer || $[14] !== logo || $[15] !== navigation || $[16] !== title) {
12963
+ t6 = navigation && /* @__PURE__ */ jsx("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsx(Link, { className: "visited:text-inherit visited:dark:text-inherit block", to: navigation?.basePath ?? "/", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-4", children: [
12962
12964
  !hasDrawer && (logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "Logo", className: cls("w-[32px] h-[32px] object-contain") }) : /* @__PURE__ */ jsx(FireCMSLogo, { width: "32px", height: "32px" })),
12963
- typeof title === "string" ? /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", noWrap: true, className: cls("transition-all", drawerOpen ? "ml-2" : ""), children: title }) : title
12965
+ typeof title === "string" ? /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", noWrap: true, children: title }) : title
12964
12966
  ] }) }) });
12965
- $[13] = drawerOpen;
12966
- $[14] = hasDrawer;
12967
- $[15] = logo;
12968
- $[16] = navigation;
12969
- $[17] = title;
12970
- $[18] = t6;
12967
+ $[13] = hasDrawer;
12968
+ $[14] = logo;
12969
+ $[15] = navigation;
12970
+ $[16] = title;
12971
+ $[17] = t6;
12971
12972
  } else {
12972
- t6 = $[18];
12973
+ t6 = $[17];
12973
12974
  }
12974
12975
  let t7;
12975
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
12976
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
12976
12977
  t7 = /* @__PURE__ */ jsx("div", { className: "flex-grow" });
12977
- $[19] = t7;
12978
+ $[18] = t7;
12978
12979
  } else {
12979
- t7 = $[19];
12980
+ t7 = $[18];
12980
12981
  }
12981
12982
  let t8;
12982
- if ($[20] !== endAdornment) {
12983
+ if ($[19] !== endAdornment) {
12983
12984
  t8 = endAdornment && /* @__PURE__ */ jsx(ErrorBoundary, { children: endAdornment });
12984
- $[20] = endAdornment;
12985
- $[21] = t8;
12985
+ $[19] = endAdornment;
12986
+ $[20] = t8;
12986
12987
  } else {
12987
- t8 = $[21];
12988
+ t8 = $[20];
12988
12989
  }
12989
12990
  let t9;
12990
- if ($[22] !== includeModeToggle || $[23] !== mode || $[24] !== toggleMode) {
12991
+ if ($[21] !== includeModeToggle || $[22] !== mode || $[23] !== toggleMode) {
12991
12992
  t9 = includeModeToggle && /* @__PURE__ */ jsx(IconButton, { color: "inherit", "aria-label": "Open drawer", onClick: toggleMode, size: "large", children: mode === "dark" ? /* @__PURE__ */ jsx(DarkModeIcon, {}) : /* @__PURE__ */ jsx(LightModeIcon, {}) });
12992
- $[22] = includeModeToggle;
12993
- $[23] = mode;
12994
- $[24] = toggleMode;
12995
- $[25] = t9;
12993
+ $[21] = includeModeToggle;
12994
+ $[22] = mode;
12995
+ $[23] = toggleMode;
12996
+ $[24] = t9;
12996
12997
  } else {
12997
- t9 = $[25];
12998
+ t9 = $[24];
12998
12999
  }
12999
13000
  let t10;
13000
- if ($[26] !== user) {
13001
+ if ($[25] !== user) {
13001
13002
  t10 = user && /* @__PURE__ */ jsxs("div", { className: "px-4 py-2 mb-2", children: [
13002
13003
  user.displayName && /* @__PURE__ */ jsx(Typography, { variant: "body1", color: "secondary", children: user.displayName }),
13003
13004
  user.email && /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "secondary", children: user.email })
13004
13005
  ] });
13005
- $[26] = user;
13006
- $[27] = t10;
13006
+ $[25] = user;
13007
+ $[26] = t10;
13007
13008
  } else {
13008
- t10 = $[27];
13009
+ t10 = $[26];
13009
13010
  }
13010
13011
  let t11;
13011
- if ($[28] !== authController || $[29] !== dropDownActions || $[30] !== navigate) {
13012
+ if ($[27] !== authController || $[28] !== dropDownActions || $[29] !== navigate) {
13012
13013
  t11 = !dropDownActions && /* @__PURE__ */ jsxs(MenuItem, { onClick: async () => {
13013
13014
  await authController.signOut();
13014
13015
  navigate("/");
@@ -13016,30 +13017,30 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
13016
13017
  /* @__PURE__ */ jsx(LogoutIcon, {}),
13017
13018
  "Log Out"
13018
13019
  ] });
13019
- $[28] = authController;
13020
- $[29] = dropDownActions;
13021
- $[30] = navigate;
13022
- $[31] = t11;
13020
+ $[27] = authController;
13021
+ $[28] = dropDownActions;
13022
+ $[29] = navigate;
13023
+ $[30] = t11;
13023
13024
  } else {
13024
- t11 = $[31];
13025
+ t11 = $[30];
13025
13026
  }
13026
13027
  let t12;
13027
- if ($[32] !== avatarComponent || $[33] !== dropDownActions || $[34] !== t10 || $[35] !== t11) {
13028
+ if ($[31] !== avatarComponent || $[32] !== dropDownActions || $[33] !== t10 || $[34] !== t11) {
13028
13029
  t12 = /* @__PURE__ */ jsxs(Menu, { trigger: avatarComponent, children: [
13029
13030
  t10,
13030
13031
  dropDownActions,
13031
13032
  t11
13032
13033
  ] });
13033
- $[32] = avatarComponent;
13034
- $[33] = dropDownActions;
13035
- $[34] = t10;
13036
- $[35] = t11;
13037
- $[36] = t12;
13034
+ $[31] = avatarComponent;
13035
+ $[32] = dropDownActions;
13036
+ $[33] = t10;
13037
+ $[34] = t11;
13038
+ $[35] = t12;
13038
13039
  } else {
13039
- t12 = $[36];
13040
+ t12 = $[35];
13040
13041
  }
13041
13042
  let t13;
13042
- if ($[37] !== startAdornment || $[38] !== style || $[39] !== t12 || $[40] !== t5 || $[41] !== t6 || $[42] !== t8 || $[43] !== t9) {
13043
+ if ($[36] !== startAdornment || $[37] !== style || $[38] !== t12 || $[39] !== t5 || $[40] !== t6 || $[41] !== t8 || $[42] !== t9) {
13043
13044
  t13 = /* @__PURE__ */ jsxs("div", { style, className: t5, children: [
13044
13045
  t6,
13045
13046
  startAdornment,
@@ -13048,16 +13049,16 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
13048
13049
  t9,
13049
13050
  t12
13050
13051
  ] });
13051
- $[37] = startAdornment;
13052
- $[38] = style;
13053
- $[39] = t12;
13054
- $[40] = t5;
13055
- $[41] = t6;
13056
- $[42] = t8;
13057
- $[43] = t9;
13058
- $[44] = t13;
13052
+ $[36] = startAdornment;
13053
+ $[37] = style;
13054
+ $[38] = t12;
13055
+ $[39] = t5;
13056
+ $[40] = t6;
13057
+ $[41] = t8;
13058
+ $[42] = t9;
13059
+ $[43] = t13;
13059
13060
  } else {
13060
- t13 = $[44];
13061
+ t13 = $[43];
13061
13062
  }
13062
13063
  return t13;
13063
13064
  };
@@ -22372,7 +22373,7 @@ function DrawerLogo(t0) {
22372
22373
  }
22373
22374
  let t3;
22374
22375
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
22375
- t3 = cls("cursor-pointer ml-3 mr-1");
22376
+ t3 = cls("cursor-pointer rounded ml-3 mr-1");
22376
22377
  $[2] = t3;
22377
22378
  } else {
22378
22379
  t3 = $[2];
@@ -22388,7 +22389,7 @@ function DrawerLogo(t0) {
22388
22389
  }
22389
22390
  let t5;
22390
22391
  if ($[6] !== navigation.basePath || $[7] !== t4) {
22391
- t5 = /* @__PURE__ */ jsx(Tooltip, { title: "Home", sideOffset: 20, side: "right", children: /* @__PURE__ */ jsx(Link, { to: navigation.basePath, children: t4 }) });
22392
+ t5 = /* @__PURE__ */ jsx(Tooltip, { title: "Home", sideOffset: 20, side: "right", children: /* @__PURE__ */ jsx(Link, { className: "block", to: navigation.basePath, children: t4 }) });
22392
22393
  $[6] = navigation.basePath;
22393
22394
  $[7] = t4;
22394
22395
  $[8] = t5;