@firecms/core 3.0.0 → 3.0.1
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/LocalChangesMenu.d.ts +2 -2
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/index.es.js +204 -224
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +204 -224
- 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/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/form/EntityForm.tsx +3 -10
- package/src/form/components/LocalChangesMenu.tsx +6 -6
- 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/useStorageUploadController.tsx +11 -1
package/src/types/storage.ts
CHANGED
|
@@ -21,6 +21,15 @@ export interface UploadFileResult {
|
|
|
21
21
|
* Bucket where the file was uploaded
|
|
22
22
|
*/
|
|
23
23
|
bucket: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Fully qualified storage URL for the uploaded file.
|
|
27
|
+
*
|
|
28
|
+
* For example: `gs://my-bucket/path/to/file.png`.
|
|
29
|
+
*
|
|
30
|
+
* This is optional for backwards compatibility.
|
|
31
|
+
*/
|
|
32
|
+
storageUrl?: string;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
/**
|
|
@@ -134,11 +134,21 @@ export function useStorageUploadController<M extends object>({
|
|
|
134
134
|
|
|
135
135
|
const onFileUploadComplete = useCallback(async (uploadedPath: string,
|
|
136
136
|
entry: StorageFieldItem,
|
|
137
|
-
metadata?: any
|
|
137
|
+
metadata?: any,
|
|
138
|
+
uploadedUrl?: string) => {
|
|
138
139
|
|
|
139
140
|
console.debug("onFileUploadComplete", uploadedPath, entry);
|
|
140
141
|
|
|
141
142
|
let uploadPathOrDownloadUrl: string | null = uploadedPath;
|
|
143
|
+
|
|
144
|
+
if (storage.includeBucketUrl) {
|
|
145
|
+
if (!uploadedUrl) {
|
|
146
|
+
console.warn("includeBucketUrl is set but no fully-qualified storage URL was returned by the StorageSource. Falling back to the storage path.");
|
|
147
|
+
} else {
|
|
148
|
+
uploadPathOrDownloadUrl = uploadedUrl;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
142
152
|
if (storage.storeUrl) {
|
|
143
153
|
uploadPathOrDownloadUrl = (await storageSource.getDownloadURL(uploadedPath)).url;
|
|
144
154
|
}
|