@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/components/VirtualTable/VirtualTable.performance.test.d.ts +1 -0
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/index.es.js +65 -25
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +65 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/properties.d.ts +9 -0
- package/dist/types/storage.d.ts +8 -0
- package/dist/util/entity_cache.d.ts +0 -1
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/package.json +6 -5
- package/src/components/EntityPreview.tsx +1 -1
- package/src/components/VirtualTable/VirtualTable.performance.test.tsx +386 -0
- package/src/components/VirtualTable/VirtualTable.tsx +3 -3
- package/src/core/SideDialogs.tsx +19 -8
- package/src/form/components/StorageUploadProgress.tsx +4 -3
- package/src/preview/components/ReferencePreview.tsx +6 -1
- package/src/types/entities.ts +10 -0
- package/src/types/properties.ts +10 -0
- package/src/types/storage.ts +9 -0
- package/src/util/entity_cache.ts +0 -5
- package/src/util/useStorageUploadController.tsx +11 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ export interface StorageUploadItemProps {
|
|
|
3
3
|
storagePath: string;
|
|
4
4
|
metadata?: any;
|
|
5
5
|
entry: StorageFieldItem;
|
|
6
|
-
onFileUploadComplete: (value: string, entry: StorageFieldItem, metadata?: any) => Promise<void>;
|
|
6
|
+
onFileUploadComplete: (value: string, entry: StorageFieldItem, metadata?: any, uploadedUrl?: string) => Promise<void>;
|
|
7
7
|
imageSize: number;
|
|
8
8
|
simple: boolean;
|
|
9
9
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -222,6 +222,15 @@ class EntityReference {
|
|
|
222
222
|
get pathWithId() {
|
|
223
223
|
return `${this.path}/${this.id}`;
|
|
224
224
|
}
|
|
225
|
+
get pathWithIdAndDatabase() {
|
|
226
|
+
if (this.databaseId) {
|
|
227
|
+
if (this.databaseId === "(default)") {
|
|
228
|
+
return this.pathWithId;
|
|
229
|
+
}
|
|
230
|
+
return `${this.databaseId}:::${this.path}/${this.id}`;
|
|
231
|
+
}
|
|
232
|
+
return this.pathWithId;
|
|
233
|
+
}
|
|
225
234
|
isEntityReference() {
|
|
226
235
|
return true;
|
|
227
236
|
}
|
|
@@ -6012,7 +6021,7 @@ const EntityPreviewContainer = React.forwardRef((t0, ref) => {
|
|
|
6012
6021
|
const t7 = onClick ? "cursor-pointer" : "";
|
|
6013
6022
|
let t8;
|
|
6014
6023
|
if ($[11] !== className || $[12] !== t4 || $[13] !== t5 || $[14] !== t6 || $[15] !== t7) {
|
|
6015
|
-
t8 = cls("bg-white dark:bg-surface-900", "min-h-[
|
|
6024
|
+
t8 = cls("bg-white dark:bg-surface-900", "min-h-[44px]", t4, "items-center", t5, t6, "flex border rounded-lg", t7, defaultBorderMixin, className);
|
|
6016
6025
|
$[11] = className;
|
|
6017
6026
|
$[12] = t4;
|
|
6018
6027
|
$[13] = t5;
|
|
@@ -6097,7 +6106,7 @@ const ReferencePreview = function ReferencePreview2(props) {
|
|
|
6097
6106
|
return t0;
|
|
6098
6107
|
};
|
|
6099
6108
|
function ReferencePreviewInternal(t0) {
|
|
6100
|
-
const $ = c(
|
|
6109
|
+
const $ = c(22);
|
|
6101
6110
|
const {
|
|
6102
6111
|
disabled,
|
|
6103
6112
|
reference,
|
|
@@ -6135,24 +6144,43 @@ function ReferencePreviewInternal(t0) {
|
|
|
6135
6144
|
}
|
|
6136
6145
|
return t42;
|
|
6137
6146
|
} else {
|
|
6138
|
-
|
|
6147
|
+
const t42 = size ?? "medium";
|
|
6148
|
+
let t5;
|
|
6149
|
+
if ($[6] !== reference.pathWithId) {
|
|
6150
|
+
t5 = /* @__PURE__ */ jsx(ErrorView, { error: "Unexpected reference value. Click to edit", tooltip: reference.pathWithId });
|
|
6151
|
+
$[6] = reference.pathWithId;
|
|
6152
|
+
$[7] = t5;
|
|
6153
|
+
} else {
|
|
6154
|
+
t5 = $[7];
|
|
6155
|
+
}
|
|
6156
|
+
let t6;
|
|
6157
|
+
if ($[8] !== onClick || $[9] !== t42 || $[10] !== t5) {
|
|
6158
|
+
t6 = /* @__PURE__ */ jsx(EntityPreviewContainer, { onClick, size: t42, children: t5 });
|
|
6159
|
+
$[8] = onClick;
|
|
6160
|
+
$[9] = t42;
|
|
6161
|
+
$[10] = t5;
|
|
6162
|
+
$[11] = t6;
|
|
6163
|
+
} else {
|
|
6164
|
+
t6 = $[11];
|
|
6165
|
+
}
|
|
6166
|
+
return t6;
|
|
6139
6167
|
}
|
|
6140
6168
|
}
|
|
6141
6169
|
let t4;
|
|
6142
|
-
if ($[
|
|
6170
|
+
if ($[12] !== collection || $[13] !== disabled || $[14] !== hover || $[15] !== includeEntityLink || $[16] !== includeId || $[17] !== onClick || $[18] !== previewProperties || $[19] !== reference || $[20] !== size) {
|
|
6143
6171
|
t4 = /* @__PURE__ */ jsx(ReferencePreviewExisting, { reference, collection, previewProperties, size, disabled, includeEntityLink, includeId, onClick, hover });
|
|
6144
|
-
$[
|
|
6145
|
-
$[
|
|
6146
|
-
$[
|
|
6147
|
-
$[
|
|
6148
|
-
$[
|
|
6149
|
-
$[
|
|
6150
|
-
$[
|
|
6151
|
-
$[
|
|
6152
|
-
$[
|
|
6153
|
-
$[
|
|
6172
|
+
$[12] = collection;
|
|
6173
|
+
$[13] = disabled;
|
|
6174
|
+
$[14] = hover;
|
|
6175
|
+
$[15] = includeEntityLink;
|
|
6176
|
+
$[16] = includeId;
|
|
6177
|
+
$[17] = onClick;
|
|
6178
|
+
$[18] = previewProperties;
|
|
6179
|
+
$[19] = reference;
|
|
6180
|
+
$[20] = size;
|
|
6181
|
+
$[21] = t4;
|
|
6154
6182
|
} else {
|
|
6155
|
-
t4 = $[
|
|
6183
|
+
t4 = $[21];
|
|
6156
6184
|
}
|
|
6157
6185
|
return t4;
|
|
6158
6186
|
}
|
|
@@ -8359,9 +8387,16 @@ function useStorageUploadController({
|
|
|
8359
8387
|
propertyKey
|
|
8360
8388
|
}) ?? "/";
|
|
8361
8389
|
}, [entityId, entityValues, path, resolvedProperty, propertyKey, storage]);
|
|
8362
|
-
const onFileUploadComplete = useCallback(async (uploadedPath, entry, metadata_0) => {
|
|
8390
|
+
const onFileUploadComplete = useCallback(async (uploadedPath, entry, metadata_0, uploadedUrl) => {
|
|
8363
8391
|
console.debug("onFileUploadComplete", uploadedPath, entry);
|
|
8364
8392
|
let uploadPathOrDownloadUrl = uploadedPath;
|
|
8393
|
+
if (storage.includeBucketUrl) {
|
|
8394
|
+
if (!uploadedUrl) {
|
|
8395
|
+
console.warn("includeBucketUrl is set but no fully-qualified storage URL was returned by the StorageSource. Falling back to the storage path.");
|
|
8396
|
+
} else {
|
|
8397
|
+
uploadPathOrDownloadUrl = uploadedUrl;
|
|
8398
|
+
}
|
|
8399
|
+
}
|
|
8365
8400
|
if (storage.storeUrl) {
|
|
8366
8401
|
uploadPathOrDownloadUrl = (await storageSource.getDownloadURL(uploadedPath)).url;
|
|
8367
8402
|
}
|
|
@@ -8534,10 +8569,11 @@ function StorageUploadProgress({
|
|
|
8534
8569
|
path: storagePath,
|
|
8535
8570
|
metadata
|
|
8536
8571
|
}).then(async ({
|
|
8537
|
-
path
|
|
8572
|
+
path,
|
|
8573
|
+
storageUrl
|
|
8538
8574
|
}) => {
|
|
8539
8575
|
console.debug("Upload successful", path);
|
|
8540
|
-
await onFileUploadComplete(path, entry, metadata);
|
|
8576
|
+
await onFileUploadComplete(path, entry, metadata, storageUrl);
|
|
8541
8577
|
if (mounted.current) setLoading(false);
|
|
8542
8578
|
}).catch((e) => {
|
|
8543
8579
|
console.warn("Upload error", e);
|
|
@@ -10213,10 +10249,6 @@ function getEntityFromCache(path) {
|
|
|
10213
10249
|
const entityString = localStorage.getItem(key);
|
|
10214
10250
|
if (entityString) {
|
|
10215
10251
|
const entity = JSON.parse(entityString, customReviver);
|
|
10216
|
-
console.log("Loaded entity from localStorage:", {
|
|
10217
|
-
key,
|
|
10218
|
-
entity
|
|
10219
|
-
});
|
|
10220
10252
|
return entity;
|
|
10221
10253
|
}
|
|
10222
10254
|
} catch (error) {
|
|
@@ -11520,7 +11552,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
11520
11552
|
/* @__PURE__ */ jsx(AssignmentIcon, {}),
|
|
11521
11553
|
emptyComponent
|
|
11522
11554
|
] }) : void 0;
|
|
11523
|
-
const virtualListController = {
|
|
11555
|
+
const virtualListController = useMemo(() => ({
|
|
11524
11556
|
data,
|
|
11525
11557
|
rowHeight,
|
|
11526
11558
|
cellRenderer,
|
|
@@ -11539,7 +11571,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
11539
11571
|
rowClassName,
|
|
11540
11572
|
endAdornment,
|
|
11541
11573
|
AddColumnComponent
|
|
11542
|
-
};
|
|
11574
|
+
}), [data, rowHeight, cellRenderer, columns, currentSort, onRowClick, customView, onColumnResizeInternal, onColumnResizeEndInternal, filterInput, onColumnSort, onFilterUpdateInternal, sortByProperty, hoverRow, createFilterField2, rowClassName, endAdornment, AddColumnComponent]);
|
|
11543
11575
|
return /* @__PURE__ */ jsx("div", { ref: measureRef, style, className: cls("h-full w-full", className), children: /* @__PURE__ */ jsx(VirtualListContext.Provider, { value: virtualListController, children: /* @__PURE__ */ jsx(MemoizedList, { outerRef: tableRef, width: bounds.width, height: bounds.height, itemCount: (data?.length ?? 0) + (endAdornment ? 1 : 0), onScroll, includeAddColumn: Boolean(AddColumnComponent), itemSize: rowHeight }, rowHeight) }) });
|
|
11544
11576
|
}, equal);
|
|
11545
11577
|
function MemoizedList({
|
|
@@ -23693,7 +23725,15 @@ function SideDialogView({
|
|
|
23693
23725
|
pendingClose,
|
|
23694
23726
|
setPendingClose
|
|
23695
23727
|
}, children: [
|
|
23696
|
-
/* @__PURE__ */ jsxs(Sheet, { open: Boolean(panel), onOpenChange: (open) =>
|
|
23728
|
+
/* @__PURE__ */ jsxs(Sheet, { open: Boolean(panel), onOpenChange: (open) => {
|
|
23729
|
+
if (!open) {
|
|
23730
|
+
const suggestionMenu = document.querySelector('[data-suggestion-menu="true"]');
|
|
23731
|
+
if (suggestionMenu && window.getComputedStyle(suggestionMenu).visibility !== "hidden") {
|
|
23732
|
+
return;
|
|
23733
|
+
}
|
|
23734
|
+
onCloseRequest();
|
|
23735
|
+
}
|
|
23736
|
+
}, title: "Side dialog " + panel?.key, children: [
|
|
23697
23737
|
panel && /* @__PURE__ */ 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: {
|
|
23698
23738
|
width: panel.width,
|
|
23699
23739
|
transform: `translateX(-${offsetPosition * 200}px)`
|