@firecms/core 3.0.0-canary.125 → 3.0.0-canary.127

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
@@ -2964,9 +2964,11 @@
2964
2964
  function makePropertiesEditable(properties) {
2965
2965
  Object.keys(properties).forEach((key) => {
2966
2966
  const property = properties[key];
2967
- property.editable = true;
2968
- if (property.dataType === "map" && property.properties) {
2969
- makePropertiesEditable(property.properties);
2967
+ if (property) {
2968
+ property.editable = true;
2969
+ if (property.dataType === "map" && property.properties) {
2970
+ makePropertiesEditable(property.properties);
2971
+ }
2970
2972
  }
2971
2973
  });
2972
2974
  return properties;
@@ -2974,13 +2976,19 @@
2974
2976
  function makePropertiesNonEditable(properties) {
2975
2977
  return Object.entries(properties).reduce((acc, [key, property]) => {
2976
2978
  if (!isPropertyBuilder(property) && property.dataType === "map" && property.properties) {
2977
- const updated = { ...property, properties: makePropertiesNonEditable(property.properties) };
2979
+ const updated = {
2980
+ ...property,
2981
+ properties: makePropertiesNonEditable(property.properties)
2982
+ };
2978
2983
  acc[key] = updated;
2979
2984
  }
2980
2985
  if (isPropertyBuilder(property)) {
2981
2986
  acc[key] = property;
2982
2987
  } else {
2983
- acc[key] = { ...property, editable: false };
2988
+ acc[key] = {
2989
+ ...property,
2990
+ editable: false
2991
+ };
2984
2992
  }
2985
2993
  return acc;
2986
2994
  }, {});
@@ -7001,7 +7009,7 @@
7001
7009
  onDropRejected: (fileRejections, event) => {
7002
7010
  for (const fileRejection of fileRejections) {
7003
7011
  for (const error2 of fileRejection.errors) {
7004
- console.log("Error uploading file: ", error2);
7012
+ console.error("Error uploading file: ", error2);
7005
7013
  if (error2.code === "file-too-large") {
7006
7014
  snackbarContext.open({
7007
7015
  type: "error",
@@ -7165,7 +7173,6 @@
7165
7173
  updateValue(entity ? getReferenceFrom(entity) : null);
7166
7174
  }, [updateValue]);
7167
7175
  const onMultipleEntitiesSelected = React.useCallback((entities) => {
7168
- console.log("onMultipleEntitiesSelected", entities);
7169
7176
  updateValue(entities.map((e) => getReferenceFrom(e)));
7170
7177
  }, [updateValue]);
7171
7178
  const selectedEntityIds = internalValue ? Array.isArray(internalValue) ? internalValue.map((ref) => ref.id) : internalValue.id ? [internalValue.id] : [] : [];
@@ -9606,7 +9613,6 @@
9606
9613
  }
9607
9614
  }
9608
9615
  const multiple = multipleSelectOperations$1.includes(operation);
9609
- console.log("internalValue", { internalValue });
9610
9616
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[440px]", children: [
9611
9617
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[80px]", children: /* @__PURE__ */ jsxRuntime.jsx(
9612
9618
  ui.Select,
@@ -10788,6 +10794,23 @@
10788
10794
  }
10789
10795
  );
10790
10796
  }
10797
+ function addRecentId(collectionId, id) {
10798
+ const recentIds = getRecentIds(collectionId);
10799
+ const newRecentIds = [id, ...recentIds.filter((i) => i !== id)];
10800
+ if (newRecentIds.length > 5) {
10801
+ newRecentIds.pop();
10802
+ }
10803
+ saveSearchedIdsLocally(collectionId, newRecentIds);
10804
+ return newRecentIds;
10805
+ }
10806
+ function saveSearchedIdsLocally(collectionId, ids) {
10807
+ localStorage.setItem("recent_id_searches::" + collectionId, JSON.stringify(ids));
10808
+ }
10809
+ function getRecentIds(collectionId) {
10810
+ const stored = localStorage.getItem("recent_id_searches::" + collectionId);
10811
+ if (!stored) return [];
10812
+ return JSON.parse(stored);
10813
+ }
10791
10814
  const editEntityAction = {
10792
10815
  icon: /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, {}),
10793
10816
  name: "Edit",
@@ -10805,6 +10828,9 @@
10805
10828
  path: entity.path,
10806
10829
  entityId: entity.id
10807
10830
  });
10831
+ if (collection) {
10832
+ addRecentId(collection.id, entity.id);
10833
+ }
10808
10834
  const path = collection?.collectionGroup ? entity.path : fullPath ?? entity.path;
10809
10835
  context.sideEntityController.open({
10810
10836
  entityId: entity.id,
@@ -11536,7 +11562,6 @@
11536
11562
  setFilteredUrls(null);
11537
11563
  } else {
11538
11564
  const searchResult = fuse.current?.search(value);
11539
- console.log("Search result", searchResult);
11540
11565
  if (searchResult) {
11541
11566
  setFilteredUrls(searchResult.map((e) => e.item.url));
11542
11567
  }
@@ -12337,7 +12362,6 @@
12337
12362
  tableController.setPopupCell?.(void 0);
12338
12363
  }, [tableController.setPopupCell]);
12339
12364
  const onEntityClick = React.useCallback((clickedEntity) => {
12340
- console.log("Entity clicked", clickedEntity);
12341
12365
  const collection2 = collectionRef.current;
12342
12366
  setHighlightedEntity(clickedEntity);
12343
12367
  analyticsController.onAnalyticsEvent?.("edit_entity_clicked", {
@@ -12845,6 +12869,7 @@
12845
12869
  }) {
12846
12870
  const [openPopup, setOpenPopup] = React.useState(false);
12847
12871
  const [searchString, setSearchString] = React.useState("");
12872
+ const [recentIds, setRecentIds] = React.useState(getRecentIds(collection.id));
12848
12873
  const sideEntityController = useSideEntityController();
12849
12874
  return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: !openPopup ? "Find by ID" : void 0, asChild: false, children: /* @__PURE__ */ jsxRuntime.jsx(
12850
12875
  ui.Popover,
@@ -12855,47 +12880,69 @@
12855
12880
  align: "start",
12856
12881
  alignOffset: -117,
12857
12882
  trigger: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.SearchIcon, { size: "small" }) }),
12858
- children: /* @__PURE__ */ jsxRuntime.jsx(
12859
- "form",
12860
- {
12861
- noValidate: true,
12862
- onSubmit: (e) => {
12863
- e.preventDefault();
12864
- if (!searchString) return;
12865
- setOpenPopup(false);
12866
- return sideEntityController.open({
12867
- entityId: searchString.trim(),
12868
- path,
12869
- collection,
12870
- updateUrl: true
12871
- });
12883
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("my-2 rounded-lg bg-gray-50 dark:bg-gray-950 text-gray-900 dark:text-white"), children: [
12884
+ /* @__PURE__ */ jsxRuntime.jsx(
12885
+ "form",
12886
+ {
12887
+ noValidate: true,
12888
+ onSubmit: (e) => {
12889
+ e.preventDefault();
12890
+ if (!searchString) return;
12891
+ setOpenPopup(false);
12892
+ setRecentIds(addRecentId(collection.id, searchString.trim()));
12893
+ return sideEntityController.open({
12894
+ entityId: searchString.trim(),
12895
+ path,
12896
+ collection,
12897
+ updateUrl: true
12898
+ });
12899
+ },
12900
+ className: "w-96 max-w-full",
12901
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex p-2 w-full gap-2", children: [
12902
+ /* @__PURE__ */ jsxRuntime.jsx(
12903
+ "input",
12904
+ {
12905
+ autoFocus: openPopup,
12906
+ placeholder: "Find entity by ID",
12907
+ onChange: (e) => {
12908
+ setSearchString(e.target.value);
12909
+ },
12910
+ value: searchString,
12911
+ className: "rounded-lg bg-white dark:bg-gray-800 flex-grow bg-transparent outline-none p-2 " + ui.focusedDisabled
12912
+ }
12913
+ ),
12914
+ /* @__PURE__ */ jsxRuntime.jsx(
12915
+ ui.Button,
12916
+ {
12917
+ variant: "text",
12918
+ disabled: !searchString.trim(),
12919
+ type: "submit",
12920
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, {})
12921
+ }
12922
+ )
12923
+ ] })
12924
+ }
12925
+ ),
12926
+ recentIds && recentIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
12927
+ ReferencePreview,
12928
+ {
12929
+ reference: new EntityReference(id, path),
12930
+ hover: true,
12931
+ onClick: () => {
12932
+ setOpenPopup(false);
12933
+ sideEntityController.open({
12934
+ entityId: id,
12935
+ path,
12936
+ collection,
12937
+ updateUrl: true
12938
+ });
12939
+ },
12940
+ includeEntityLink: false,
12941
+ size: "small"
12872
12942
  },
12873
- className: "text-gray-900 dark:text-white w-96 max-w-full",
12874
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex p-2 w-full gap-4", children: [
12875
- /* @__PURE__ */ jsxRuntime.jsx(
12876
- "input",
12877
- {
12878
- autoFocus: openPopup,
12879
- placeholder: "Find entity by ID",
12880
- onChange: (e) => {
12881
- setSearchString(e.target.value);
12882
- },
12883
- value: searchString,
12884
- className: "flex-grow bg-transparent outline-none p-1 " + ui.focusedDisabled
12885
- }
12886
- ),
12887
- /* @__PURE__ */ jsxRuntime.jsx(
12888
- ui.Button,
12889
- {
12890
- variant: "outlined",
12891
- disabled: !searchString.trim(),
12892
- type: "submit",
12893
- children: "Go"
12894
- }
12895
- )
12896
- ] })
12897
- }
12898
- )
12943
+ id
12944
+ )) })
12945
+ ] })
12899
12946
  }
12900
12947
  ) });
12901
12948
  }
@@ -13750,7 +13797,6 @@
13750
13797
  };
13751
13798
  }, [query, updateSearchResults]);
13752
13799
  const icons = keys === null ? ui.coolIconKeys : keys;
13753
- console.log("Icons", icons);
13754
13800
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13755
13801
  /* @__PURE__ */ jsxRuntime.jsx(
13756
13802
  ui.SearchBar,
@@ -14441,7 +14487,7 @@
14441
14487
  onDropRejected: (fileRejections, event) => {
14442
14488
  for (const fileRejection of fileRejections) {
14443
14489
  for (const error of fileRejection.errors) {
14444
- console.log("Error uploading file: ", error);
14490
+ console.error("Error uploading file: ", error);
14445
14491
  if (error.code === "file-too-large") {
14446
14492
  snackbarContext.open({
14447
14493
  type: "error",
@@ -17498,7 +17544,6 @@
17498
17544
  if (onUpdate)
17499
17545
  onUpdate({ entity: updatedEntity });
17500
17546
  if (closeAfterSave) {
17501
- console.log("Closing side dialog");
17502
17547
  sideDialogContext.setBlocked(false);
17503
17548
  sideDialogContext.close(true);
17504
17549
  onClose?.();
@@ -18348,7 +18393,6 @@
18348
18393
  const handleDrawerCloseOk = () => {
18349
18394
  setBlocked(false);
18350
18395
  setDrawerCloseRequested(false);
18351
- console.log("handleDrawerCloseOk");
18352
18396
  sideDialogsController.close();
18353
18397
  panel?.onClose?.();
18354
18398
  };
@@ -19531,7 +19575,7 @@
19531
19575
  Object.values(navigationEntries).filter((e) => e.group === group).map((view, index) => /* @__PURE__ */ jsxRuntime.jsx(
19532
19576
  DrawerNavigationItem,
19533
19577
  {
19534
- icon: /* @__PURE__ */ jsxRuntime.jsx(IconForView, { collectionOrView: view.collection ?? view.view }),
19578
+ icon: /* @__PURE__ */ jsxRuntime.jsx(IconForView, { collectionOrView: view.collection ?? view.view, size: "small" }),
19535
19579
  tooltipsOpen,
19536
19580
  adminMenuOpen,
19537
19581
  drawerOpen,