@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.umd.js CHANGED
@@ -355,6 +355,7 @@
355
355
  function getDefaultValuesFor(properties) {
356
356
  if (!properties) return {};
357
357
  return Object.entries(properties).map(([key, property]) => {
358
+ if (!property) return {};
358
359
  const value = getDefaultValueFor(property);
359
360
  return value === void 0 ? {} : {
360
361
  [key]: value
@@ -365,6 +366,7 @@
365
366
  }), {});
366
367
  }
367
368
  function getDefaultValueFor(property) {
369
+ if (!property) return void 0;
368
370
  if (isPropertyBuilder(property)) return void 0;
369
371
  if (property.defaultValue || property.defaultValue === null) {
370
372
  return property.defaultValue;
@@ -8855,7 +8857,6 @@
8855
8857
  const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
8856
8858
  const context = useFireCMSContext();
8857
8859
  const [size, setSize] = React.useState(defaultSize ?? "m");
8858
- const selectedEntityIds = selectedEntities?.map((e) => e.id);
8859
8860
  const updateSize = React.useCallback((size_0) => {
8860
8861
  if (onSizeChanged) onSizeChanged(size_0);
8861
8862
  setSize(size_0);
@@ -8911,7 +8912,7 @@
8911
8912
  context
8912
8913
  })?.toString() });
8913
8914
  return /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(ErrorBoundary, { children: child }) }, `additional_table_cell_${entity_0.id}_${column_0.key}`);
8914
- }, [size, selectedEntityIds]);
8915
+ }, [size]);
8915
8916
  const collectionColumns = (() => {
8916
8917
  const columnsResult = propertiesToColumns({
8917
8918
  properties,
@@ -8961,14 +8962,14 @@
8961
8962
  } else {
8962
8963
  throw Error("Internal: columns not mapped properly");
8963
8964
  }
8964
- } catch (e_0) {
8965
- console.error("Error rendering cell", e_0);
8966
- return /* @__PURE__ */ jsxRuntime.jsx(EntityTableCell, { size, width: column_1.width, saved: false, value: null, align: "left", fullHeight: false, disabled: true, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: e_0 }) });
8965
+ } catch (e) {
8966
+ console.error("Error rendering cell", e);
8967
+ return /* @__PURE__ */ jsxRuntime.jsx(EntityTableCell, { size, width: column_1.width, saved: false, value: null, align: "left", fullHeight: false, disabled: true, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: e }) });
8967
8968
  }
8968
8969
  }, [tableRowActionsBuilder, additionalCellRenderer, propertyCellRenderer, size]);
8969
8970
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, style, className: ui.cls("h-full w-full flex flex-col bg-white dark:bg-surface-950", className), children: [
8970
8971
  /* @__PURE__ */ jsxRuntime.jsx(CollectionTableToolbar, { onTextSearch: textSearchEnabled ? onTextSearch : void 0, textSearchLoading, onTextSearchClick: textSearchEnabled ? onTextSearchClick : void 0, size, onSizeChanged: updateSize, title, actionsStart, actions, loading: tableController.dataLoading }),
8971
- /* @__PURE__ */ jsxRuntime.jsx(SelectableTable, { columns, size, inlineEditing, cellRenderer, onEntityClick, highlightedRow: React.useCallback((entity_1) => selectedEntityIds?.includes(entity_1.id) ?? false, [selectedEntityIds]), tableController, onValueChange, onColumnResize, hoverRow, filterable, emptyComponent, endAdornment, AddColumnComponent })
8972
+ /* @__PURE__ */ jsxRuntime.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 })
8972
8973
  ] });
8973
8974
  };
8974
8975
  function useDataOrder({
@@ -9163,9 +9164,10 @@
9163
9164
  const toggleEntitySelection = React.useCallback((entity, newSelectedState) => {
9164
9165
  let newValue;
9165
9166
  if (newSelectedState === void 0) {
9166
- if (selectedEntities.map((e) => e.id).includes(entity.id)) {
9167
+ const isSelected = Boolean(selectedEntities.find((e) => e.id === entity.id && e.path === entity.path));
9168
+ if (isSelected) {
9167
9169
  onSelectionChange?.(entity, false);
9168
- newValue = selectedEntities.filter((item) => item.id !== entity.id);
9170
+ newValue = selectedEntities.filter((item) => !(item.id === entity.id && item.path === entity.path));
9169
9171
  } else {
9170
9172
  onSelectionChange?.(entity, true);
9171
9173
  newValue = [...selectedEntities, entity];
@@ -9176,13 +9178,13 @@
9176
9178
  newValue = [...selectedEntities, entity];
9177
9179
  } else {
9178
9180
  onSelectionChange?.(entity, false);
9179
- newValue = selectedEntities.filter((item_0) => item_0.id !== entity.id);
9181
+ newValue = selectedEntities.filter((item_0) => !(item_0.id === entity.id && item_0.path === entity.path));
9180
9182
  }
9181
9183
  }
9182
9184
  setSelectedEntities(newValue);
9183
9185
  }, [selectedEntities]);
9184
9186
  const isEntitySelected = React.useCallback((entity_0) => {
9185
- return selectedEntities.map((e_0) => e_0.id).includes(entity_0.id);
9187
+ return Boolean(selectedEntities.find((e_0) => e_0.id === entity_0.id && e_0.path === entity_0.path));
9186
9188
  }, [selectedEntities]);
9187
9189
  return {
9188
9190
  selectedEntities,
@@ -12392,7 +12394,7 @@
12392
12394
  width: width_0,
12393
12395
  frozen
12394
12396
  }) => {
12395
- const isSelected = usedSelectionController.selectedEntities.map((e_1) => e_1.id).includes(entity_6.id);
12397
+ const isSelected = Boolean(usedSelectionController.selectedEntities.find((e_1) => e_1.id == entity_6.id && e_1.path == entity_6.path));
12396
12398
  const actions_0 = getActionsForEntity({
12397
12399
  entity: entity_6,
12398
12400
  customEntityActions: collection.entityActions
@@ -12876,7 +12878,7 @@
12876
12878
  return React.useContext(AppContext);
12877
12879
  }
12878
12880
  const DefaultAppBar = function DefaultAppBar2(t0) {
12879
- const $ = reactCompilerRuntime.c(45);
12881
+ const $ = reactCompilerRuntime.c(44);
12880
12882
  const {
12881
12883
  title,
12882
12884
  endAdornment,
@@ -12960,58 +12962,57 @@
12960
12962
  t5 = $[12];
12961
12963
  }
12962
12964
  let t6;
12963
- if ($[13] !== drawerOpen || $[14] !== hasDrawer || $[15] !== logo || $[16] !== navigation || $[17] !== title) {
12964
- t6 = navigation && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { className: "visited:text-inherit visited:dark:text-inherit", to: navigation?.basePath ?? "/", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-4", children: [
12965
+ if ($[13] !== hasDrawer || $[14] !== logo || $[15] !== navigation || $[16] !== title) {
12966
+ t6 = navigation && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { className: "visited:text-inherit visited:dark:text-inherit block", to: navigation?.basePath ?? "/", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-4", children: [
12965
12967
  !hasDrawer && (logo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "Logo", className: ui.cls("w-[32px] h-[32px] object-contain") }) : /* @__PURE__ */ jsxRuntime.jsx(FireCMSLogo, { width: "32px", height: "32px" })),
12966
- typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle1", noWrap: true, className: ui.cls("transition-all", drawerOpen ? "ml-2" : ""), children: title }) : title
12968
+ typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle1", noWrap: true, children: title }) : title
12967
12969
  ] }) }) });
12968
- $[13] = drawerOpen;
12969
- $[14] = hasDrawer;
12970
- $[15] = logo;
12971
- $[16] = navigation;
12972
- $[17] = title;
12973
- $[18] = t6;
12970
+ $[13] = hasDrawer;
12971
+ $[14] = logo;
12972
+ $[15] = navigation;
12973
+ $[16] = title;
12974
+ $[17] = t6;
12974
12975
  } else {
12975
- t6 = $[18];
12976
+ t6 = $[17];
12976
12977
  }
12977
12978
  let t7;
12978
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
12979
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
12979
12980
  t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow" });
12980
- $[19] = t7;
12981
+ $[18] = t7;
12981
12982
  } else {
12982
- t7 = $[19];
12983
+ t7 = $[18];
12983
12984
  }
12984
12985
  let t8;
12985
- if ($[20] !== endAdornment) {
12986
+ if ($[19] !== endAdornment) {
12986
12987
  t8 = endAdornment && /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: endAdornment });
12987
- $[20] = endAdornment;
12988
- $[21] = t8;
12988
+ $[19] = endAdornment;
12989
+ $[20] = t8;
12989
12990
  } else {
12990
- t8 = $[21];
12991
+ t8 = $[20];
12991
12992
  }
12992
12993
  let t9;
12993
- if ($[22] !== includeModeToggle || $[23] !== mode || $[24] !== toggleMode) {
12994
+ if ($[21] !== includeModeToggle || $[22] !== mode || $[23] !== toggleMode) {
12994
12995
  t9 = includeModeToggle && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", "aria-label": "Open drawer", onClick: toggleMode, size: "large", children: mode === "dark" ? /* @__PURE__ */ jsxRuntime.jsx(ui.DarkModeIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(ui.LightModeIcon, {}) });
12995
- $[22] = includeModeToggle;
12996
- $[23] = mode;
12997
- $[24] = toggleMode;
12998
- $[25] = t9;
12996
+ $[21] = includeModeToggle;
12997
+ $[22] = mode;
12998
+ $[23] = toggleMode;
12999
+ $[24] = t9;
12999
13000
  } else {
13000
- t9 = $[25];
13001
+ t9 = $[24];
13001
13002
  }
13002
13003
  let t10;
13003
- if ($[26] !== user) {
13004
+ if ($[25] !== user) {
13004
13005
  t10 = user && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-2 mb-2", children: [
13005
13006
  user.displayName && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body1", color: "secondary", children: user.displayName }),
13006
13007
  user.email && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body2", color: "secondary", children: user.email })
13007
13008
  ] });
13008
- $[26] = user;
13009
- $[27] = t10;
13009
+ $[25] = user;
13010
+ $[26] = t10;
13010
13011
  } else {
13011
- t10 = $[27];
13012
+ t10 = $[26];
13012
13013
  }
13013
13014
  let t11;
13014
- if ($[28] !== authController || $[29] !== dropDownActions || $[30] !== navigate) {
13015
+ if ($[27] !== authController || $[28] !== dropDownActions || $[29] !== navigate) {
13015
13016
  t11 = !dropDownActions && /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { onClick: async () => {
13016
13017
  await authController.signOut();
13017
13018
  navigate("/");
@@ -13019,30 +13020,30 @@
13019
13020
  /* @__PURE__ */ jsxRuntime.jsx(ui.LogoutIcon, {}),
13020
13021
  "Log Out"
13021
13022
  ] });
13022
- $[28] = authController;
13023
- $[29] = dropDownActions;
13024
- $[30] = navigate;
13025
- $[31] = t11;
13023
+ $[27] = authController;
13024
+ $[28] = dropDownActions;
13025
+ $[29] = navigate;
13026
+ $[30] = t11;
13026
13027
  } else {
13027
- t11 = $[31];
13028
+ t11 = $[30];
13028
13029
  }
13029
13030
  let t12;
13030
- if ($[32] !== avatarComponent || $[33] !== dropDownActions || $[34] !== t10 || $[35] !== t11) {
13031
+ if ($[31] !== avatarComponent || $[32] !== dropDownActions || $[33] !== t10 || $[34] !== t11) {
13031
13032
  t12 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Menu, { trigger: avatarComponent, children: [
13032
13033
  t10,
13033
13034
  dropDownActions,
13034
13035
  t11
13035
13036
  ] });
13036
- $[32] = avatarComponent;
13037
- $[33] = dropDownActions;
13038
- $[34] = t10;
13039
- $[35] = t11;
13040
- $[36] = t12;
13037
+ $[31] = avatarComponent;
13038
+ $[32] = dropDownActions;
13039
+ $[33] = t10;
13040
+ $[34] = t11;
13041
+ $[35] = t12;
13041
13042
  } else {
13042
- t12 = $[36];
13043
+ t12 = $[35];
13043
13044
  }
13044
13045
  let t13;
13045
- if ($[37] !== startAdornment || $[38] !== style || $[39] !== t12 || $[40] !== t5 || $[41] !== t6 || $[42] !== t8 || $[43] !== t9) {
13046
+ if ($[36] !== startAdornment || $[37] !== style || $[38] !== t12 || $[39] !== t5 || $[40] !== t6 || $[41] !== t8 || $[42] !== t9) {
13046
13047
  t13 = /* @__PURE__ */ jsxRuntime.jsxs("div", { style, className: t5, children: [
13047
13048
  t6,
13048
13049
  startAdornment,
@@ -13051,16 +13052,16 @@
13051
13052
  t9,
13052
13053
  t12
13053
13054
  ] });
13054
- $[37] = startAdornment;
13055
- $[38] = style;
13056
- $[39] = t12;
13057
- $[40] = t5;
13058
- $[41] = t6;
13059
- $[42] = t8;
13060
- $[43] = t9;
13061
- $[44] = t13;
13055
+ $[36] = startAdornment;
13056
+ $[37] = style;
13057
+ $[38] = t12;
13058
+ $[39] = t5;
13059
+ $[40] = t6;
13060
+ $[41] = t8;
13061
+ $[42] = t9;
13062
+ $[43] = t13;
13062
13063
  } else {
13063
- t13 = $[44];
13064
+ t13 = $[43];
13064
13065
  }
13065
13066
  return t13;
13066
13067
  };
@@ -22375,7 +22376,7 @@
22375
22376
  }
22376
22377
  let t3;
22377
22378
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
22378
- t3 = ui.cls("cursor-pointer ml-3 mr-1");
22379
+ t3 = ui.cls("cursor-pointer rounded ml-3 mr-1");
22379
22380
  $[2] = t3;
22380
22381
  } else {
22381
22382
  t3 = $[2];
@@ -22391,7 +22392,7 @@
22391
22392
  }
22392
22393
  let t5;
22393
22394
  if ($[6] !== navigation.basePath || $[7] !== t4) {
22394
- t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Home", sideOffset: 20, side: "right", children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: navigation.basePath, children: t4 }) });
22395
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Home", sideOffset: 20, side: "right", children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { className: "block", to: navigation.basePath, children: t4 }) });
22395
22396
  $[6] = navigation.basePath;
22396
22397
  $[7] = t4;
22397
22398
  $[8] = t5;