@firecms/core 3.0.0-canary.295 → 3.0.0-canary.297

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
@@ -220,6 +220,15 @@
220
220
  get pathWithId() {
221
221
  return `${this.path}/${this.id}`;
222
222
  }
223
+ get pathWithIdAndDatabase() {
224
+ if (this.databaseId) {
225
+ if (this.databaseId === "(default)") {
226
+ return this.pathWithId;
227
+ }
228
+ return `${this.databaseId}:::${this.path}/${this.id}`;
229
+ }
230
+ return this.pathWithId;
231
+ }
223
232
  isEntityReference() {
224
233
  return true;
225
234
  }
@@ -6010,7 +6019,7 @@
6010
6019
  const t7 = onClick ? "cursor-pointer" : "";
6011
6020
  let t8;
6012
6021
  if ($[11] !== className || $[12] !== t4 || $[13] !== t5 || $[14] !== t6 || $[15] !== t7) {
6013
- t8 = ui.cls("bg-white dark:bg-surface-900", "min-h-[42px]", t4, "items-center", t5, t6, "flex border rounded-lg", t7, ui.defaultBorderMixin, className);
6022
+ t8 = ui.cls("bg-white dark:bg-surface-900", "min-h-[44px]", t4, "items-center", t5, t6, "flex border rounded-lg", t7, ui.defaultBorderMixin, className);
6014
6023
  $[11] = className;
6015
6024
  $[12] = t4;
6016
6025
  $[13] = t5;
@@ -6095,7 +6104,7 @@
6095
6104
  return t0;
6096
6105
  };
6097
6106
  function ReferencePreviewInternal(t0) {
6098
- const $ = reactCompilerRuntime.c(16);
6107
+ const $ = reactCompilerRuntime.c(22);
6099
6108
  const {
6100
6109
  disabled,
6101
6110
  reference,
@@ -6133,24 +6142,43 @@
6133
6142
  }
6134
6143
  return t42;
6135
6144
  } else {
6136
- throw Error(`Couldn't find the corresponding collection view for the path: ${reference.path}`);
6145
+ const t42 = size ?? "medium";
6146
+ let t5;
6147
+ if ($[6] !== reference.pathWithId) {
6148
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Unexpected reference value. Click to edit", tooltip: reference.pathWithId });
6149
+ $[6] = reference.pathWithId;
6150
+ $[7] = t5;
6151
+ } else {
6152
+ t5 = $[7];
6153
+ }
6154
+ let t6;
6155
+ if ($[8] !== onClick || $[9] !== t42 || $[10] !== t5) {
6156
+ t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick, size: t42, children: t5 });
6157
+ $[8] = onClick;
6158
+ $[9] = t42;
6159
+ $[10] = t5;
6160
+ $[11] = t6;
6161
+ } else {
6162
+ t6 = $[11];
6163
+ }
6164
+ return t6;
6137
6165
  }
6138
6166
  }
6139
6167
  let t4;
6140
- if ($[6] !== collection || $[7] !== disabled || $[8] !== hover || $[9] !== includeEntityLink || $[10] !== includeId || $[11] !== onClick || $[12] !== previewProperties || $[13] !== reference || $[14] !== size) {
6168
+ if ($[12] !== collection || $[13] !== disabled || $[14] !== hover || $[15] !== includeEntityLink || $[16] !== includeId || $[17] !== onClick || $[18] !== previewProperties || $[19] !== reference || $[20] !== size) {
6141
6169
  t4 = /* @__PURE__ */ jsxRuntime.jsx(ReferencePreviewExisting, { reference, collection, previewProperties, size, disabled, includeEntityLink, includeId, onClick, hover });
6142
- $[6] = collection;
6143
- $[7] = disabled;
6144
- $[8] = hover;
6145
- $[9] = includeEntityLink;
6146
- $[10] = includeId;
6147
- $[11] = onClick;
6148
- $[12] = previewProperties;
6149
- $[13] = reference;
6150
- $[14] = size;
6151
- $[15] = t4;
6170
+ $[12] = collection;
6171
+ $[13] = disabled;
6172
+ $[14] = hover;
6173
+ $[15] = includeEntityLink;
6174
+ $[16] = includeId;
6175
+ $[17] = onClick;
6176
+ $[18] = previewProperties;
6177
+ $[19] = reference;
6178
+ $[20] = size;
6179
+ $[21] = t4;
6152
6180
  } else {
6153
- t4 = $[15];
6181
+ t4 = $[21];
6154
6182
  }
6155
6183
  return t4;
6156
6184
  }
@@ -8357,9 +8385,16 @@
8357
8385
  propertyKey
8358
8386
  }) ?? "/";
8359
8387
  }, [entityId, entityValues, path, resolvedProperty, propertyKey, storage]);
8360
- const onFileUploadComplete = React.useCallback(async (uploadedPath, entry, metadata_0) => {
8388
+ const onFileUploadComplete = React.useCallback(async (uploadedPath, entry, metadata_0, uploadedUrl) => {
8361
8389
  console.debug("onFileUploadComplete", uploadedPath, entry);
8362
8390
  let uploadPathOrDownloadUrl = uploadedPath;
8391
+ if (storage.includeBucketUrl) {
8392
+ if (!uploadedUrl) {
8393
+ console.warn("includeBucketUrl is set but no fully-qualified storage URL was returned by the StorageSource. Falling back to the storage path.");
8394
+ } else {
8395
+ uploadPathOrDownloadUrl = uploadedUrl;
8396
+ }
8397
+ }
8363
8398
  if (storage.storeUrl) {
8364
8399
  uploadPathOrDownloadUrl = (await storageSource.getDownloadURL(uploadedPath)).url;
8365
8400
  }
@@ -8532,10 +8567,11 @@
8532
8567
  path: storagePath,
8533
8568
  metadata
8534
8569
  }).then(async ({
8535
- path
8570
+ path,
8571
+ storageUrl
8536
8572
  }) => {
8537
8573
  console.debug("Upload successful", path);
8538
- await onFileUploadComplete(path, entry, metadata);
8574
+ await onFileUploadComplete(path, entry, metadata, storageUrl);
8539
8575
  if (mounted.current) setLoading(false);
8540
8576
  }).catch((e) => {
8541
8577
  console.warn("Upload error", e);
@@ -10211,10 +10247,6 @@
10211
10247
  const entityString = localStorage.getItem(key);
10212
10248
  if (entityString) {
10213
10249
  const entity = JSON.parse(entityString, customReviver);
10214
- console.log("Loaded entity from localStorage:", {
10215
- key,
10216
- entity
10217
- });
10218
10250
  return entity;
10219
10251
  }
10220
10252
  } catch (error) {
@@ -11518,7 +11550,7 @@
11518
11550
  /* @__PURE__ */ jsxRuntime.jsx(ui.AssignmentIcon, {}),
11519
11551
  emptyComponent
11520
11552
  ] }) : void 0;
11521
- const virtualListController = {
11553
+ const virtualListController = React.useMemo(() => ({
11522
11554
  data,
11523
11555
  rowHeight,
11524
11556
  cellRenderer,
@@ -11537,7 +11569,7 @@
11537
11569
  rowClassName,
11538
11570
  endAdornment,
11539
11571
  AddColumnComponent
11540
- };
11572
+ }), [data, rowHeight, cellRenderer, columns, currentSort, onRowClick, customView, onColumnResizeInternal, onColumnResizeEndInternal, filterInput, onColumnSort, onFilterUpdateInternal, sortByProperty, hoverRow, createFilterField2, rowClassName, endAdornment, AddColumnComponent]);
11541
11573
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: measureRef, style, className: ui.cls("h-full w-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(VirtualListContext.Provider, { value: virtualListController, children: /* @__PURE__ */ jsxRuntime.jsx(MemoizedList, { outerRef: tableRef, width: bounds.width, height: bounds.height, itemCount: (data?.length ?? 0) + (endAdornment ? 1 : 0), onScroll, includeAddColumn: Boolean(AddColumnComponent), itemSize: rowHeight }, rowHeight) }) });
11542
11574
  }, equal);
11543
11575
  function MemoizedList({
@@ -23691,7 +23723,15 @@
23691
23723
  pendingClose,
23692
23724
  setPendingClose
23693
23725
  }, children: [
23694
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Sheet, { open: Boolean(panel), onOpenChange: (open) => !open && onCloseRequest(), title: "Side dialog " + panel?.key, children: [
23726
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Sheet, { open: Boolean(panel), onOpenChange: (open) => {
23727
+ if (!open) {
23728
+ const suggestionMenu = document.querySelector('[data-suggestion-menu="true"]');
23729
+ if (suggestionMenu && window.getComputedStyle(suggestionMenu).visibility !== "hidden") {
23730
+ return;
23731
+ }
23732
+ onCloseRequest();
23733
+ }
23734
+ }, title: "Side dialog " + panel?.key, children: [
23695
23735
  panel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "transform max-w-[100vw] lg:max-w-[95vw] flex flex-col h-full transition-all duration-250 ease-in-out bg-white dark:bg-surface-900 ", style: {
23696
23736
  width: panel.width,
23697
23737
  transform: `translateX(-${offsetPosition * 200}px)`