@aws-amplify/ui-react-storage 3.13.1 → 3.14.0
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/browser.js +2 -2
- package/dist/{createStorageBrowser-DaVWyJzC.js → createStorageBrowser-CotOvK0A.js} +119 -22
- package/dist/esm/browser.mjs +1 -0
- package/dist/esm/components/StorageBrowser/ErrorBoundary/ErrorBoundary.mjs +1 -0
- package/dist/esm/components/StorageBrowser/StorageBrowserAmplify.mjs +1 -0
- package/dist/esm/components/StorageBrowser/actions/configs/defaults.mjs +1 -0
- package/dist/esm/components/StorageBrowser/actions/handlers/download.mjs +2 -1
- package/dist/esm/components/StorageBrowser/actions/handlers/listLocationItems.mjs +4 -2
- package/dist/esm/components/StorageBrowser/actions/handlers/utils.mjs +23 -2
- package/dist/esm/components/StorageBrowser/adapters/createManagedAuthAdapter/createManagedAuthAdapter.mjs +1 -0
- package/dist/esm/components/StorageBrowser/components/ComponentsProvider.mjs +1 -0
- package/dist/esm/components/StorageBrowser/components/base/preview/DownloadButton.mjs +1 -0
- package/dist/esm/components/StorageBrowser/controls/DataTableControl.mjs +1 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser/StorageBrowserDefault.mjs +1 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser/createProvider.mjs +1 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser/createStorageBrowser.mjs +1 -0
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/downloadView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/useAction/utils.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/FoldersMessageControl.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useCopyView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CreateFolderView/CreateFolderView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CreateFolderView/useCreateFolderView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadViewProvider.mjs +2 -3
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/useDownloadView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/LocationDetailView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationsView/LocationsView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationsView/LocationsViewProvider.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/context/actionViews.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/context/primaryViews.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/downloadResolvers.mjs +72 -4
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/utils.mjs +7 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/components/StorageBrowser/actions/handlers/utils.d.ts +2 -1
- package/dist/types/components/StorageBrowser/displayText/types.d.ts +2 -1
- package/dist/types/components/StorageBrowser/views/utils/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/downloadResolvers.d.ts +3 -2
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/types.d.ts +4 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/utils.d.ts +2 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
package/dist/browser.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var internals = require('@aws-amplify/storage/internals');
|
|
6
|
+
require('aws-amplify');
|
|
6
7
|
require('@aws-amplify/ui');
|
|
7
|
-
var createStorageBrowser = require('./createStorageBrowser-
|
|
8
|
+
var createStorageBrowser = require('./createStorageBrowser-CotOvK0A.js');
|
|
8
9
|
require('aws-amplify/storage');
|
|
9
10
|
require('react');
|
|
10
11
|
require('@aws-amplify/ui-react');
|
|
11
12
|
require('@aws-amplify/ui-react-core');
|
|
12
13
|
require('@aws-amplify/ui-react-core/elements');
|
|
13
|
-
require('aws-amplify');
|
|
14
14
|
require('aws-amplify/auth');
|
|
15
15
|
require('aws-amplify/utils');
|
|
16
16
|
require('@aws-amplify/ui-react/internal');
|
|
@@ -32,7 +32,7 @@ function _interopNamespace(e) {
|
|
|
32
32
|
|
|
33
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
34
|
|
|
35
|
-
const VERSION = '3.
|
|
35
|
+
const VERSION = '3.14.0';
|
|
36
36
|
|
|
37
37
|
const toAccessGrantPermission = (permission) => {
|
|
38
38
|
let result = '';
|
|
@@ -168,7 +168,27 @@ const DEFAULT_CHECKSUM_ALGORITHM = 'crc-32';
|
|
|
168
168
|
// https://github.com/aws-amplify/amplify-js/blob/1a5366d113c9af4ce994168653df3aadb142c581/packages/storage/src/providers/s3/utils/constants.ts#L16
|
|
169
169
|
const MULTIPART_UPLOAD_THRESHOLD_BYTES = 5 * 1024 * 1024;
|
|
170
170
|
|
|
171
|
-
const
|
|
171
|
+
const getBucketRegion = (bucketName, fallbackRegion) => {
|
|
172
|
+
try {
|
|
173
|
+
const config = awsAmplify.Amplify.getConfig()?.Storage?.S3;
|
|
174
|
+
if (!config?.buckets || typeof config.buckets !== 'object') {
|
|
175
|
+
return fallbackRegion;
|
|
176
|
+
}
|
|
177
|
+
for (const bucketConfig of Object.values(config.buckets)) {
|
|
178
|
+
if (bucketConfig.bucketName === bucketName && bucketConfig.region) {
|
|
179
|
+
return bucketConfig.region;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return fallbackRegion;
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
return fallbackRegion;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const constructBucket = ({ bucket: bucketName, region: globalRegion, }) => {
|
|
189
|
+
const bucketRegion = getBucketRegion(bucketName, globalRegion);
|
|
190
|
+
return { bucketName, region: bucketRegion };
|
|
191
|
+
};
|
|
172
192
|
const parseAccessGrantLocation = (location) => {
|
|
173
193
|
const { permission, scope, type } = location;
|
|
174
194
|
if (!scope.startsWith('s3://')) {
|
|
@@ -365,8 +385,9 @@ function downloadFromUrl(fileName, url) {
|
|
|
365
385
|
a.click();
|
|
366
386
|
document.body.removeChild(a);
|
|
367
387
|
}
|
|
368
|
-
const downloadHandler = ({ config, data
|
|
388
|
+
const downloadHandler = ({ config, data }) => {
|
|
369
389
|
const { accountId, credentials, customEndpoint } = config;
|
|
390
|
+
const { key } = data;
|
|
370
391
|
const result = internals.getUrl({
|
|
371
392
|
path: key,
|
|
372
393
|
options: {
|
|
@@ -421,9 +442,10 @@ const filterDotItems = (items, prefix) => items.filter((item) => {
|
|
|
421
442
|
const parseResult = ({ excludedSubpaths, items }, prefix) => filterDotItems([...parseExcludedPaths(excludedSubpaths), ...parseItems(items, prefix)], prefix);
|
|
422
443
|
const listLocationItemsHandler = async (input) => {
|
|
423
444
|
const { config, prefix, options } = input;
|
|
424
|
-
const { bucket: _bucket, credentials, customEndpoint, region, accountId, } = config;
|
|
445
|
+
const { bucket: _bucket, credentials, customEndpoint, region: globalRegion, accountId, } = config;
|
|
425
446
|
const { exclude, delimiter, nextToken, pageSize: _pageSize = DEFAULT_PAGE_SIZE$5, ..._options } = options ?? {};
|
|
426
|
-
const
|
|
447
|
+
const bucketRegion = getBucketRegion(_bucket, globalRegion);
|
|
448
|
+
const bucket = { bucketName: _bucket, region: bucketRegion };
|
|
427
449
|
const subpathStrategy = {
|
|
428
450
|
delimiter,
|
|
429
451
|
strategy: delimiter ? 'exclude' : 'include',
|
|
@@ -2382,6 +2404,7 @@ const DEFAULT_DOWNLOAD_VIEW_DISPLAY_TEXT = {
|
|
|
2382
2404
|
type: 'error',
|
|
2383
2405
|
};
|
|
2384
2406
|
},
|
|
2407
|
+
tableColumnProgressHeader: 'Progress',
|
|
2385
2408
|
};
|
|
2386
2409
|
|
|
2387
2410
|
const DEFAULT_STORAGE_BROWSER_DISPLAY_TEXT = {
|
|
@@ -3770,6 +3793,12 @@ const getUploadCellProgress = ({ progress, status, }) => {
|
|
|
3770
3793
|
const displayValue = `${Math.round(value * 100)}%`;
|
|
3771
3794
|
return { displayValue, value };
|
|
3772
3795
|
};
|
|
3796
|
+
const getDownloadCellProgress = ({ progress, status, }) => {
|
|
3797
|
+
// prefer `progress` if available, 1 if status is complete, default 0
|
|
3798
|
+
const value = progress ?? (status === 'COMPLETE' ? 1 : 0);
|
|
3799
|
+
const displayValue = `${Math.round(value * 100)}%`;
|
|
3800
|
+
return { displayValue, value };
|
|
3801
|
+
};
|
|
3773
3802
|
const getFileSize = (value, fallback = '-') => (!value ? fallback : ui.humanFileSize(value, true));
|
|
3774
3803
|
const getFileDataCancelCellContent = (data) => {
|
|
3775
3804
|
const { item, props } = data;
|
|
@@ -3801,31 +3830,31 @@ const getFileDataCancelCellContent = (data) => {
|
|
|
3801
3830
|
* Generates a unique key for a table cell based on the key and item id
|
|
3802
3831
|
*/
|
|
3803
3832
|
const getFileDataCellKey = ({ key, item, }) => `${key}-${item.data.id}`;
|
|
3804
|
-
const name$
|
|
3833
|
+
const name$2 = (data) => {
|
|
3805
3834
|
const key = getFileDataCellKey(data);
|
|
3806
3835
|
const { item } = data;
|
|
3807
3836
|
const text = item.data.fileKey;
|
|
3808
3837
|
const icon = STATUS_ICONS[item.status];
|
|
3809
3838
|
return { key, type: 'text', content: { icon, text } };
|
|
3810
3839
|
};
|
|
3811
|
-
const folder$
|
|
3840
|
+
const folder$2 = (data) => {
|
|
3812
3841
|
const key = getFileDataCellKey(data);
|
|
3813
3842
|
const text = getFileDataCellFolder(data.item);
|
|
3814
3843
|
return { key, type: 'text', content: { text } };
|
|
3815
3844
|
};
|
|
3816
|
-
const type$
|
|
3845
|
+
const type$2 = (data) => {
|
|
3817
3846
|
const key = getFileDataCellKey(data);
|
|
3818
3847
|
const { fileKey } = data.item.data;
|
|
3819
3848
|
const text = getFileType(fileKey);
|
|
3820
3849
|
return { key, type: 'text', content: { text } };
|
|
3821
3850
|
};
|
|
3822
|
-
const size$
|
|
3851
|
+
const size$2 = (data) => {
|
|
3823
3852
|
const key = getFileDataCellKey(data);
|
|
3824
3853
|
const { size: value } = data.item.data;
|
|
3825
3854
|
const displayValue = getFileSize(value);
|
|
3826
3855
|
return { key, type: 'number', content: { value, displayValue } };
|
|
3827
3856
|
};
|
|
3828
|
-
const cancel$
|
|
3857
|
+
const cancel$2 = (data) => {
|
|
3829
3858
|
const key = getFileDataCellKey(data);
|
|
3830
3859
|
const content = getFileDataCancelCellContent(data);
|
|
3831
3860
|
return { key, type: 'button', content };
|
|
@@ -3841,12 +3870,12 @@ const status$3 = (data) => {
|
|
|
3841
3870
|
return { key, type: 'text', content: { text } };
|
|
3842
3871
|
};
|
|
3843
3872
|
const COPY_CELL_RESOLVERS = {
|
|
3844
|
-
name: name$
|
|
3845
|
-
folder: folder$
|
|
3846
|
-
type: type$
|
|
3847
|
-
size: size$
|
|
3873
|
+
name: name$2,
|
|
3874
|
+
folder: folder$2,
|
|
3875
|
+
type: type$2,
|
|
3876
|
+
size: size$2,
|
|
3848
3877
|
status: status$3,
|
|
3849
|
-
cancel: cancel$
|
|
3878
|
+
cancel: cancel$2,
|
|
3850
3879
|
/**
|
|
3851
3880
|
* @deprecated
|
|
3852
3881
|
*
|
|
@@ -3878,12 +3907,12 @@ const status$2 = (data) => {
|
|
|
3878
3907
|
return { key, type: 'text', content: { text } };
|
|
3879
3908
|
};
|
|
3880
3909
|
const DELETE_CELL_RESOLVERS = {
|
|
3881
|
-
name: name$
|
|
3882
|
-
folder: folder$
|
|
3883
|
-
type: type$
|
|
3884
|
-
size: size$
|
|
3910
|
+
name: name$2,
|
|
3911
|
+
folder: folder$2,
|
|
3912
|
+
type: type$2,
|
|
3913
|
+
size: size$2,
|
|
3885
3914
|
status: status$2,
|
|
3886
|
-
cancel: cancel$
|
|
3915
|
+
cancel: cancel$2,
|
|
3887
3916
|
/**
|
|
3888
3917
|
* @deprecated
|
|
3889
3918
|
*
|
|
@@ -3905,8 +3934,42 @@ const DELETE_TABLE_RESOLVERS = {
|
|
|
3905
3934
|
getRowKey: ({ item }) => item.data.id,
|
|
3906
3935
|
};
|
|
3907
3936
|
|
|
3937
|
+
const DOWNLOAD_TABLE_KEYS = [
|
|
3938
|
+
'name',
|
|
3939
|
+
'folder',
|
|
3940
|
+
'type',
|
|
3941
|
+
'size',
|
|
3942
|
+
'status',
|
|
3943
|
+
'progress',
|
|
3944
|
+
'cancel',
|
|
3945
|
+
];
|
|
3946
|
+
const getDownloadCellKey = ({ key, item, }) => `${key}-${item.data.id}`;
|
|
3947
|
+
const name$1 = (data) => {
|
|
3948
|
+
const key = getDownloadCellKey(data);
|
|
3949
|
+
const { item } = data;
|
|
3950
|
+
const text = item.data.fileKey;
|
|
3951
|
+
const icon = STATUS_ICONS[item.status];
|
|
3952
|
+
return { key, type: 'text', content: { icon, text } };
|
|
3953
|
+
};
|
|
3954
|
+
const folder$1 = (data) => {
|
|
3955
|
+
const key = getDownloadCellKey(data);
|
|
3956
|
+
const text = getFileDataCellFolder(data.item);
|
|
3957
|
+
return { key, type: 'text', content: { text } };
|
|
3958
|
+
};
|
|
3959
|
+
const type$1 = (data) => {
|
|
3960
|
+
const key = getDownloadCellKey(data);
|
|
3961
|
+
const { item } = data;
|
|
3962
|
+
const text = getFileType(getCellName(item.data.key));
|
|
3963
|
+
return { key, type: 'text', content: { text } };
|
|
3964
|
+
};
|
|
3965
|
+
const size$1 = (data) => {
|
|
3966
|
+
const key = getDownloadCellKey(data);
|
|
3967
|
+
const { size: value } = data.item.data;
|
|
3968
|
+
const displayValue = getFileSize(value);
|
|
3969
|
+
return { key, type: 'number', content: { value, displayValue } };
|
|
3970
|
+
};
|
|
3908
3971
|
const status$1 = (data) => {
|
|
3909
|
-
const key =
|
|
3972
|
+
const key = getDownloadCellKey(data);
|
|
3910
3973
|
const { item: { status }, props: { displayText }, } = data;
|
|
3911
3974
|
const statusLabelKey = STATUS_LABELS[status];
|
|
3912
3975
|
const text = isDownloadViewDisplayTextKey(statusLabelKey)
|
|
@@ -3914,12 +3977,46 @@ const status$1 = (data) => {
|
|
|
3914
3977
|
: '';
|
|
3915
3978
|
return { key, type: 'text', content: { text } };
|
|
3916
3979
|
};
|
|
3980
|
+
const progress$1 = (data) => {
|
|
3981
|
+
const key = getDownloadCellKey(data);
|
|
3982
|
+
const content = getDownloadCellProgress(data.item);
|
|
3983
|
+
return { key, type: 'number', content };
|
|
3984
|
+
};
|
|
3985
|
+
const cancel$1 = (data) => {
|
|
3986
|
+
const key = getDownloadCellKey(data);
|
|
3987
|
+
const { item, props } = data;
|
|
3988
|
+
const { cancel, status } = item;
|
|
3989
|
+
const { isProcessing, onTaskRemove } = props;
|
|
3990
|
+
const isQueued = status === 'QUEUED';
|
|
3991
|
+
// a task is removable prior to processing start. Including `isQueued` ensures
|
|
3992
|
+
// that `isRemovable` is `false` on all tasks processing complete
|
|
3993
|
+
const isRemovable = isQueued && !isProcessing;
|
|
3994
|
+
// a task is cancelable while processing is true, and the task has a cancel handler
|
|
3995
|
+
const isCancelable = isProcessing && !!cancel;
|
|
3996
|
+
const ariaLabel = `${isRemovable ? 'Remove' : 'Cancel'} item: ${getCellName(item.data.fileKey)}`;
|
|
3997
|
+
const isDisabled = !isRemovable && !isCancelable;
|
|
3998
|
+
// resolve to `undefined` if not cancelable or removable
|
|
3999
|
+
const onClick = !isCancelable && !isRemovable
|
|
4000
|
+
? undefined
|
|
4001
|
+
: () => {
|
|
4002
|
+
if (isRemovable) {
|
|
4003
|
+
onTaskRemove?.(item);
|
|
4004
|
+
// do not run cancel handler on remove
|
|
4005
|
+
return;
|
|
4006
|
+
}
|
|
4007
|
+
if (isCancelable)
|
|
4008
|
+
cancel();
|
|
4009
|
+
};
|
|
4010
|
+
const content = { ariaLabel, isDisabled, onClick, icon: 'cancel' };
|
|
4011
|
+
return { key, type: 'button', content };
|
|
4012
|
+
};
|
|
3917
4013
|
const DOWNLOAD_CELL_RESOLVERS = {
|
|
3918
4014
|
name: name$1,
|
|
3919
4015
|
folder: folder$1,
|
|
3920
4016
|
type: type$1,
|
|
3921
4017
|
size: size$1,
|
|
3922
4018
|
status: status$1,
|
|
4019
|
+
progress: progress$1,
|
|
3923
4020
|
cancel: cancel$1,
|
|
3924
4021
|
};
|
|
3925
4022
|
const DOWNLOAD_TABLE_RESOLVERS = {
|
|
@@ -4950,7 +5047,7 @@ function DownloadViewProvider({ children, ...props }) {
|
|
|
4950
5047
|
const message = isProcessingComplete
|
|
4951
5048
|
? getActionCompleteMessage({ counts: statusCounts })
|
|
4952
5049
|
: undefined;
|
|
4953
|
-
const tableData = useResolveTableData(
|
|
5050
|
+
const tableData = useResolveTableData(DOWNLOAD_TABLE_KEYS, DOWNLOAD_TABLE_RESOLVERS, {
|
|
4954
5051
|
items,
|
|
4955
5052
|
props: { displayText, isProcessing, onTaskRemove },
|
|
4956
5053
|
});
|
package/dist/esm/browser.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../actions/configs/context.mjs';
|
|
16
17
|
import '../actions/configs/defaults.mjs';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { createAmplifyAuthAdapter } from './adapters/createAmplifyAuthAdapter/createAmplifyAuthAdapter.mjs';
|
|
3
3
|
import '@aws-amplify/storage/internals';
|
|
4
|
+
import 'aws-amplify';
|
|
4
5
|
import '@aws-amplify/ui';
|
|
5
6
|
import 'aws-amplify/storage';
|
|
6
7
|
import './actions/configs/context.mjs';
|
|
@@ -10,8 +10,9 @@ function downloadFromUrl(fileName, url) {
|
|
|
10
10
|
a.click();
|
|
11
11
|
document.body.removeChild(a);
|
|
12
12
|
}
|
|
13
|
-
const downloadHandler = ({ config, data
|
|
13
|
+
const downloadHandler = ({ config, data }) => {
|
|
14
14
|
const { accountId, credentials, customEndpoint } = config;
|
|
15
|
+
const { key } = data;
|
|
15
16
|
const result = getUrl({
|
|
16
17
|
path: key,
|
|
17
18
|
options: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBucketRegion } from './utils.mjs';
|
|
1
2
|
import { list } from '@aws-amplify/storage/internals';
|
|
2
3
|
|
|
3
4
|
const DEFAULT_PAGE_SIZE = 1000;
|
|
@@ -32,9 +33,10 @@ const filterDotItems = (items, prefix) => items.filter((item) => {
|
|
|
32
33
|
const parseResult = ({ excludedSubpaths, items }, prefix) => filterDotItems([...parseExcludedPaths(excludedSubpaths), ...parseItems(items, prefix)], prefix);
|
|
33
34
|
const listLocationItemsHandler = async (input) => {
|
|
34
35
|
const { config, prefix, options } = input;
|
|
35
|
-
const { bucket: _bucket, credentials, customEndpoint, region, accountId, } = config;
|
|
36
|
+
const { bucket: _bucket, credentials, customEndpoint, region: globalRegion, accountId, } = config;
|
|
36
37
|
const { exclude, delimiter, nextToken, pageSize: _pageSize = DEFAULT_PAGE_SIZE, ..._options } = options ?? {};
|
|
37
|
-
const
|
|
38
|
+
const bucketRegion = getBucketRegion(_bucket, globalRegion);
|
|
39
|
+
const bucket = { bucketName: _bucket, region: bucketRegion };
|
|
38
40
|
const subpathStrategy = {
|
|
39
41
|
delimiter,
|
|
40
42
|
strategy: delimiter ? 'exclude' : 'include',
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { MULTIPART_UPLOAD_THRESHOLD_BYTES } from './constants.mjs';
|
|
2
|
+
import { Amplify } from 'aws-amplify';
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const getBucketRegion = (bucketName, fallbackRegion) => {
|
|
5
|
+
try {
|
|
6
|
+
const config = Amplify.getConfig()?.Storage?.S3;
|
|
7
|
+
if (!config?.buckets || typeof config.buckets !== 'object') {
|
|
8
|
+
return fallbackRegion;
|
|
9
|
+
}
|
|
10
|
+
for (const bucketConfig of Object.values(config.buckets)) {
|
|
11
|
+
if (bucketConfig.bucketName === bucketName && bucketConfig.region) {
|
|
12
|
+
return bucketConfig.region;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return fallbackRegion;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return fallbackRegion;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const constructBucket = ({ bucket: bucketName, region: globalRegion, }) => {
|
|
22
|
+
const bucketRegion = getBucketRegion(bucketName, globalRegion);
|
|
23
|
+
return { bucketName, region: bucketRegion };
|
|
24
|
+
};
|
|
4
25
|
const parseAccessGrantLocation = (location) => {
|
|
5
26
|
const { permission, scope, type } = location;
|
|
6
27
|
if (!scope.startsWith('s3://')) {
|
|
@@ -87,4 +108,4 @@ const createFileDataItem = (data) => ({
|
|
|
87
108
|
const getProgress = ({ totalBytes, transferredBytes, }) => totalBytes ? transferredBytes / totalBytes : undefined;
|
|
88
109
|
const isMultipartUpload = (file) => file.size > MULTIPART_UPLOAD_THRESHOLD_BYTES;
|
|
89
110
|
|
|
90
|
-
export { constructBucket, createFileDataItem, getFileKey, getFilteredLocations, getProgress, isMultipartUpload, parseAccessGrantLocation, shouldExcludeLocation };
|
|
111
|
+
export { constructBucket, createFileDataItem, getBucketRegion, getFileKey, getFilteredLocations, getProgress, isMultipartUpload, parseAccessGrantLocation, shouldExcludeLocation };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLocationCredentialsHandler } from './createLocationCredentialsHandler.mjs';
|
|
2
2
|
import '@aws-amplify/storage/internals';
|
|
3
|
+
import 'aws-amplify';
|
|
3
4
|
import '@aws-amplify/ui';
|
|
4
5
|
import 'aws-amplify/storage';
|
|
5
6
|
import { listLocationsHandler } from '../../actions/handlers/listLocations.mjs';
|
|
@@ -11,6 +11,7 @@ import '../useAction/context.mjs';
|
|
|
11
11
|
import '../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../actions/configs/context.mjs';
|
|
16
17
|
import '../actions/configs/defaults.mjs';
|
|
@@ -12,6 +12,7 @@ import '../../../credentials/context.mjs';
|
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../../configuration/context.mjs';
|
|
14
14
|
import '@aws-amplify/ui';
|
|
15
|
+
import 'aws-amplify';
|
|
15
16
|
import 'aws-amplify/storage';
|
|
16
17
|
import '../../../actions/configs/context.mjs';
|
|
17
18
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../actions/configs/context.mjs';
|
|
16
17
|
import '../actions/configs/defaults.mjs';
|
|
@@ -10,6 +10,7 @@ import '../credentials/context.mjs';
|
|
|
10
10
|
import '@aws-amplify/storage/internals';
|
|
11
11
|
import '../configuration/context.mjs';
|
|
12
12
|
import '@aws-amplify/ui-react-core';
|
|
13
|
+
import 'aws-amplify';
|
|
13
14
|
import 'aws-amplify/storage';
|
|
14
15
|
import '../actions/configs/context.mjs';
|
|
15
16
|
import '../actions/configs/defaults.mjs';
|
|
@@ -9,6 +9,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
9
9
|
import '../credentials/context.mjs';
|
|
10
10
|
import '@aws-amplify/storage/internals';
|
|
11
11
|
import '../configuration/context.mjs';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import { assertRegisterAuthListener } from '../validators/assertRegisterAuthListener.mjs';
|
|
14
15
|
import '../actions/configs/context.mjs';
|
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../../actions/configs/context.mjs';
|
|
16
17
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../../actions/configs/context.mjs';
|
|
16
17
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -13,6 +13,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
13
13
|
import '../../../credentials/context.mjs';
|
|
14
14
|
import '@aws-amplify/storage/internals';
|
|
15
15
|
import '../../../configuration/context.mjs';
|
|
16
|
+
import 'aws-amplify';
|
|
16
17
|
import 'aws-amplify/storage';
|
|
17
18
|
import '../../../actions/configs/context.mjs';
|
|
18
19
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useCopyView.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
9
9
|
import '../../../credentials/context.mjs';
|
|
10
10
|
import '@aws-amplify/storage/internals';
|
|
11
11
|
import '../../../configuration/context.mjs';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import '../../../actions/configs/context.mjs';
|
|
14
15
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -6,6 +6,7 @@ import '@aws-amplify/storage/internals';
|
|
|
6
6
|
import '../../../configuration/context.mjs';
|
|
7
7
|
import '@aws-amplify/ui';
|
|
8
8
|
import { useList } from '../../../useAction/useList.mjs';
|
|
9
|
+
import 'aws-amplify';
|
|
9
10
|
import 'aws-amplify/storage';
|
|
10
11
|
import '../../../actions/configs/context.mjs';
|
|
11
12
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../../actions/configs/context.mjs';
|
|
16
17
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -7,6 +7,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
7
7
|
import '../../../credentials/context.mjs';
|
|
8
8
|
import '@aws-amplify/storage/internals';
|
|
9
9
|
import '../../../configuration/context.mjs';
|
|
10
|
+
import 'aws-amplify';
|
|
10
11
|
import 'aws-amplify/storage';
|
|
11
12
|
import '../../../actions/configs/context.mjs';
|
|
12
13
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteView.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
18
18
|
import '../../../credentials/context.mjs';
|
|
19
19
|
import '@aws-amplify/storage/internals';
|
|
20
20
|
import '../../../configuration/context.mjs';
|
|
21
|
+
import 'aws-amplify';
|
|
21
22
|
import 'aws-amplify/storage';
|
|
22
23
|
import '../../../actions/configs/context.mjs';
|
|
23
24
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
9
9
|
import '../../../credentials/context.mjs';
|
|
10
10
|
import '@aws-amplify/storage/internals';
|
|
11
11
|
import '../../../configuration/context.mjs';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import '../../../actions/configs/context.mjs';
|
|
14
15
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadView.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
18
18
|
import '../../../credentials/context.mjs';
|
|
19
19
|
import '@aws-amplify/storage/internals';
|
|
20
20
|
import '../../../configuration/context.mjs';
|
|
21
|
+
import 'aws-amplify';
|
|
21
22
|
import 'aws-amplify/storage';
|
|
22
23
|
import '../../../actions/configs/context.mjs';
|
|
23
24
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -3,8 +3,7 @@ import { ControlsContextProvider } from '../../../controls/context.mjs';
|
|
|
3
3
|
import { useDisplayText } from '../../../displayText/context.mjs';
|
|
4
4
|
import useResolveTableData from '../../hooks/useResolveTableData/useResolveTableData.mjs';
|
|
5
5
|
import '@aws-amplify/ui';
|
|
6
|
-
import {
|
|
7
|
-
import { DOWNLOAD_TABLE_RESOLVERS } from '../../utils/tableResolvers/downloadResolvers.mjs';
|
|
6
|
+
import { DOWNLOAD_TABLE_RESOLVERS, DOWNLOAD_TABLE_KEYS } from '../../utils/tableResolvers/downloadResolvers.mjs';
|
|
8
7
|
|
|
9
8
|
function DownloadViewProvider({ children, ...props }) {
|
|
10
9
|
const { DownloadView: displayText } = useDisplayText();
|
|
@@ -13,7 +12,7 @@ function DownloadViewProvider({ children, ...props }) {
|
|
|
13
12
|
const message = isProcessingComplete
|
|
14
13
|
? getActionCompleteMessage({ counts: statusCounts })
|
|
15
14
|
: undefined;
|
|
16
|
-
const tableData = useResolveTableData(
|
|
15
|
+
const tableData = useResolveTableData(DOWNLOAD_TABLE_KEYS, DOWNLOAD_TABLE_RESOLVERS, {
|
|
17
16
|
items,
|
|
18
17
|
props: { displayText, isProcessing, onTaskRemove },
|
|
19
18
|
});
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/useDownloadView.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
9
9
|
import '../../../credentials/context.mjs';
|
|
10
10
|
import '@aws-amplify/storage/internals';
|
|
11
11
|
import '../../../configuration/context.mjs';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import '../../../actions/configs/context.mjs';
|
|
14
15
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadView.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../../actions/configs/context.mjs';
|
|
16
17
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
9
9
|
import '../../../credentials/context.mjs';
|
|
10
10
|
import '@aws-amplify/storage/internals';
|
|
11
11
|
import '../../../configuration/context.mjs';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import '../../../actions/configs/context.mjs';
|
|
14
15
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../actions/configs/context.mjs';
|
|
16
17
|
import '../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import React__default, { useCallback } from 'react';
|
|
|
2
2
|
import { isUndefined, isFunction } from '@aws-amplify/ui';
|
|
3
3
|
import { usePaginate } from '../hooks/usePaginate.mjs';
|
|
4
4
|
import '@aws-amplify/storage/internals';
|
|
5
|
+
import 'aws-amplify';
|
|
5
6
|
import 'aws-amplify/storage';
|
|
6
7
|
import { useActionConfigs } from '../../actions/configs/context.mjs';
|
|
7
8
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../actions/configs/context.mjs';
|
|
16
17
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,7 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
11
11
|
import '../../credentials/context.mjs';
|
|
12
12
|
import '@aws-amplify/storage/internals';
|
|
13
13
|
import '../../configuration/context.mjs';
|
|
14
|
+
import 'aws-amplify';
|
|
14
15
|
import 'aws-amplify/storage';
|
|
15
16
|
import '../../actions/configs/context.mjs';
|
|
16
17
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -9,6 +9,7 @@ import '../../credentials/context.mjs';
|
|
|
9
9
|
import '@aws-amplify/storage/internals';
|
|
10
10
|
import '../../configuration/context.mjs';
|
|
11
11
|
import '@aws-amplify/ui-react-core';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import '../../actions/configs/context.mjs';
|
|
14
15
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -9,6 +9,7 @@ import '../../credentials/context.mjs';
|
|
|
9
9
|
import '@aws-amplify/storage/internals';
|
|
10
10
|
import '../../configuration/context.mjs';
|
|
11
11
|
import '@aws-amplify/ui-react-core';
|
|
12
|
+
import 'aws-amplify';
|
|
12
13
|
import 'aws-amplify/storage';
|
|
13
14
|
import '../../actions/configs/context.mjs';
|
|
14
15
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
import { capitalize } from '@aws-amplify/ui';
|
|
2
2
|
import '../../../displayText/context.mjs';
|
|
3
3
|
import { isDownloadViewDisplayTextKey } from '../../../displayText/utils.mjs';
|
|
4
|
-
import { STATUS_LABELS } from './constants.mjs';
|
|
5
|
-
import {
|
|
4
|
+
import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
|
|
5
|
+
import { getCellName, getDownloadCellProgress, getFileSize, getFileType, getFileDataCellFolder } from './utils.mjs';
|
|
6
6
|
|
|
7
|
+
const DOWNLOAD_TABLE_KEYS = [
|
|
8
|
+
'name',
|
|
9
|
+
'folder',
|
|
10
|
+
'type',
|
|
11
|
+
'size',
|
|
12
|
+
'status',
|
|
13
|
+
'progress',
|
|
14
|
+
'cancel',
|
|
15
|
+
];
|
|
16
|
+
const getDownloadCellKey = ({ key, item, }) => `${key}-${item.data.id}`;
|
|
17
|
+
const name = (data) => {
|
|
18
|
+
const key = getDownloadCellKey(data);
|
|
19
|
+
const { item } = data;
|
|
20
|
+
const text = item.data.fileKey;
|
|
21
|
+
const icon = STATUS_ICONS[item.status];
|
|
22
|
+
return { key, type: 'text', content: { icon, text } };
|
|
23
|
+
};
|
|
24
|
+
const folder = (data) => {
|
|
25
|
+
const key = getDownloadCellKey(data);
|
|
26
|
+
const text = getFileDataCellFolder(data.item);
|
|
27
|
+
return { key, type: 'text', content: { text } };
|
|
28
|
+
};
|
|
29
|
+
const type = (data) => {
|
|
30
|
+
const key = getDownloadCellKey(data);
|
|
31
|
+
const { item } = data;
|
|
32
|
+
const text = getFileType(getCellName(item.data.key));
|
|
33
|
+
return { key, type: 'text', content: { text } };
|
|
34
|
+
};
|
|
35
|
+
const size = (data) => {
|
|
36
|
+
const key = getDownloadCellKey(data);
|
|
37
|
+
const { size: value } = data.item.data;
|
|
38
|
+
const displayValue = getFileSize(value);
|
|
39
|
+
return { key, type: 'number', content: { value, displayValue } };
|
|
40
|
+
};
|
|
7
41
|
const status = (data) => {
|
|
8
|
-
const key =
|
|
42
|
+
const key = getDownloadCellKey(data);
|
|
9
43
|
const { item: { status }, props: { displayText }, } = data;
|
|
10
44
|
const statusLabelKey = STATUS_LABELS[status];
|
|
11
45
|
const text = isDownloadViewDisplayTextKey(statusLabelKey)
|
|
@@ -13,12 +47,46 @@ const status = (data) => {
|
|
|
13
47
|
: '';
|
|
14
48
|
return { key, type: 'text', content: { text } };
|
|
15
49
|
};
|
|
50
|
+
const progress = (data) => {
|
|
51
|
+
const key = getDownloadCellKey(data);
|
|
52
|
+
const content = getDownloadCellProgress(data.item);
|
|
53
|
+
return { key, type: 'number', content };
|
|
54
|
+
};
|
|
55
|
+
const cancel = (data) => {
|
|
56
|
+
const key = getDownloadCellKey(data);
|
|
57
|
+
const { item, props } = data;
|
|
58
|
+
const { cancel, status } = item;
|
|
59
|
+
const { isProcessing, onTaskRemove } = props;
|
|
60
|
+
const isQueued = status === 'QUEUED';
|
|
61
|
+
// a task is removable prior to processing start. Including `isQueued` ensures
|
|
62
|
+
// that `isRemovable` is `false` on all tasks processing complete
|
|
63
|
+
const isRemovable = isQueued && !isProcessing;
|
|
64
|
+
// a task is cancelable while processing is true, and the task has a cancel handler
|
|
65
|
+
const isCancelable = isProcessing && !!cancel;
|
|
66
|
+
const ariaLabel = `${isRemovable ? 'Remove' : 'Cancel'} item: ${getCellName(item.data.fileKey)}`;
|
|
67
|
+
const isDisabled = !isRemovable && !isCancelable;
|
|
68
|
+
// resolve to `undefined` if not cancelable or removable
|
|
69
|
+
const onClick = !isCancelable && !isRemovable
|
|
70
|
+
? undefined
|
|
71
|
+
: () => {
|
|
72
|
+
if (isRemovable) {
|
|
73
|
+
onTaskRemove?.(item);
|
|
74
|
+
// do not run cancel handler on remove
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (isCancelable)
|
|
78
|
+
cancel();
|
|
79
|
+
};
|
|
80
|
+
const content = { ariaLabel, isDisabled, onClick, icon: 'cancel' };
|
|
81
|
+
return { key, type: 'button', content };
|
|
82
|
+
};
|
|
16
83
|
const DOWNLOAD_CELL_RESOLVERS = {
|
|
17
84
|
name,
|
|
18
85
|
folder,
|
|
19
86
|
type,
|
|
20
87
|
size,
|
|
21
88
|
status,
|
|
89
|
+
progress,
|
|
22
90
|
cancel,
|
|
23
91
|
};
|
|
24
92
|
const DOWNLOAD_TABLE_RESOLVERS = {
|
|
@@ -33,4 +101,4 @@ const DOWNLOAD_TABLE_RESOLVERS = {
|
|
|
33
101
|
getRowKey: ({ item }) => item.data.id,
|
|
34
102
|
};
|
|
35
103
|
|
|
36
|
-
export { DOWNLOAD_TABLE_RESOLVERS };
|
|
104
|
+
export { DOWNLOAD_TABLE_KEYS, DOWNLOAD_TABLE_RESOLVERS };
|
|
@@ -25,6 +25,12 @@ const getUploadCellProgress = ({ progress, status, }) => {
|
|
|
25
25
|
const displayValue = `${Math.round(value * 100)}%`;
|
|
26
26
|
return { displayValue, value };
|
|
27
27
|
};
|
|
28
|
+
const getDownloadCellProgress = ({ progress, status, }) => {
|
|
29
|
+
// prefer `progress` if available, 1 if status is complete, default 0
|
|
30
|
+
const value = progress ?? (status === 'COMPLETE' ? 1 : 0);
|
|
31
|
+
const displayValue = `${Math.round(value * 100)}%`;
|
|
32
|
+
return { displayValue, value };
|
|
33
|
+
};
|
|
28
34
|
const getFileSize = (value, fallback = '-') => (!value ? fallback : humanFileSize(value, true));
|
|
29
35
|
const getFileDataCancelCellContent = (data) => {
|
|
30
36
|
const { item, props } = data;
|
|
@@ -86,4 +92,4 @@ const cancel = (data) => {
|
|
|
86
92
|
return { key, type: 'button', content };
|
|
87
93
|
};
|
|
88
94
|
|
|
89
|
-
export { cancel, folder, getCellName, getFileDataCancelCellContent, getFileDataCellFolder, getFileDataCellKey, getFileSize, getFileType, getUploadCellFolder, getUploadCellProgress, name, size, type };
|
|
95
|
+
export { cancel, folder, getCellName, getDownloadCellProgress, getFileDataCancelCellContent, getFileDataCellFolder, getFileDataCellKey, getFileSize, getFileType, getUploadCellFolder, getUploadCellProgress, name, size, type };
|
package/dist/esm/version.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var uiReactCore = require('@aws-amplify/ui-react-core');
|
|
|
9
9
|
var auth = require('aws-amplify/auth');
|
|
10
10
|
var storage = require('aws-amplify/storage');
|
|
11
11
|
var internal = require('@aws-amplify/ui-react/internal');
|
|
12
|
-
var createStorageBrowser = require('./createStorageBrowser-
|
|
12
|
+
var createStorageBrowser = require('./createStorageBrowser-CotOvK0A.js');
|
|
13
13
|
require('@aws-amplify/storage/internals');
|
|
14
14
|
require('aws-amplify');
|
|
15
15
|
require('aws-amplify/utils');
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TransferProgressEvent } from 'aws-amplify/storage';
|
|
2
2
|
import type { LocationAccess as AccessGrantLocation } from '../../storage-internal';
|
|
3
3
|
import type { ActionInputConfig, FileData, FileDataItem, FileItem, ListLocationsExcludeOptions, LocationData } from './types';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const getBucketRegion: (bucketName: string, fallbackRegion: string) => string;
|
|
5
|
+
export declare const constructBucket: ({ bucket: bucketName, region: globalRegion, }: Pick<ActionInputConfig, 'bucket' | 'region'>) => {
|
|
5
6
|
bucketName: string;
|
|
6
7
|
region: string;
|
|
7
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StatusCounts, Task } from '../tasks';
|
|
2
|
-
import type { CopyHandlerData, CreateFolderHandlerData, DeleteHandlerData, FolderData, LocationData, LocationItemData, TaskData, UploadHandlerData
|
|
2
|
+
import type { CopyHandlerData, CreateFolderHandlerData, DeleteHandlerData, DownloadHandlerData, FolderData, LocationData, LocationItemData, LocationPermissions, TaskData, UploadHandlerData } from '../actions';
|
|
3
3
|
import type { MessageType } from '../components';
|
|
4
4
|
import type { FileItems } from '../fileItems';
|
|
5
5
|
import type { LocationState } from '../store';
|
|
@@ -144,6 +144,7 @@ export interface DefaultDeleteViewDisplayText extends DefaultActionViewDisplayTe
|
|
|
144
144
|
tableColumnProgressHeader?: string;
|
|
145
145
|
}
|
|
146
146
|
export interface DefaultDownloadViewDisplayText extends DefaultActionViewDisplayText<DownloadHandlerData> {
|
|
147
|
+
tableColumnProgressHeader: string;
|
|
147
148
|
}
|
|
148
149
|
export interface DefaultUploadViewDisplayText extends DefaultActionViewDisplayText<UploadHandlerData> {
|
|
149
150
|
addFilesLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { COPY_TABLE_RESOLVERS, FILE_DATA_ITEM_TABLE_KEYS, DELETE_TABLE_RESOLVERS, UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, DOWNLOAD_TABLE_RESOLVERS, } from './tableResolvers';
|
|
1
|
+
export { COPY_TABLE_RESOLVERS, FILE_DATA_ITEM_TABLE_KEYS, DELETE_TABLE_RESOLVERS, UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, DOWNLOAD_TABLE_KEYS, DOWNLOAD_TABLE_RESOLVERS, } from './tableResolvers';
|
package/dist/types/components/StorageBrowser/views/utils/tableResolvers/downloadResolvers.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { DownloadTableResolvers } from './types';
|
|
2
|
+
export declare const DOWNLOAD_TABLE_KEYS: readonly ["name", "folder", "type", "size", "status", "progress", "cancel"];
|
|
3
|
+
export declare const DOWNLOAD_TABLE_RESOLVERS: DownloadTableResolvers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { COPY_TABLE_RESOLVERS } from './copyResolvers';
|
|
2
2
|
export { DELETE_TABLE_RESOLVERS } from './deleteResolvers';
|
|
3
|
-
export { DOWNLOAD_TABLE_RESOLVERS } from './downloadResolvers';
|
|
3
|
+
export { DOWNLOAD_TABLE_KEYS, DOWNLOAD_TABLE_RESOLVERS, } from './downloadResolvers';
|
|
4
4
|
export { UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS } from './uploadResolvers';
|
|
5
5
|
export { FILE_DATA_ITEM_TABLE_KEYS } from './constants';
|
|
@@ -31,10 +31,14 @@ export interface UploadTableResolverProps extends ActionTableResolverProps<Uploa
|
|
|
31
31
|
export type FileDataTaskTableResolverProps = CopyTableResolverProps | DeleteTableResolverProps;
|
|
32
32
|
export type ActionTableKey = 'name' | 'folder' | 'type' | 'size' | 'status' | 'cancel';
|
|
33
33
|
export type UploadTableKey = ActionTableKey | 'progress';
|
|
34
|
+
export type DownloadTableKey = ActionTableKey | 'progress';
|
|
34
35
|
export interface FileDataTaskTableResolvers extends DataTableResolvers<ActionTableKey, FileDataTaskTableResolverProps, FileDataTask> {
|
|
35
36
|
}
|
|
36
37
|
export interface UploadTableResolvers extends DataTableResolvers<UploadTableKey, UploadTableResolverProps, UploadActionTask> {
|
|
37
38
|
}
|
|
39
|
+
export interface DownloadTableResolvers extends DataTableResolvers<DownloadTableKey, DownloadTableResolverProps, DownloadActionTask> {
|
|
40
|
+
}
|
|
38
41
|
export type GetFileDataCell = FileDataTaskTableResolvers['getCell'];
|
|
42
|
+
export type GetDownloadCell = DownloadTableResolvers['getCell'];
|
|
39
43
|
export type GetUploadCell = UploadTableResolvers['getCell'];
|
|
40
44
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { DataTableButtonDataCell, DataTableNumberDataCell, WithKey } from '../../../components';
|
|
2
|
-
import type { FileDataTask, GetFileDataCell, UploadActionTask
|
|
2
|
+
import type { ActionTableKey, DownloadActionTask, FileDataTask, GetFileDataCell, UploadActionTask } from './types';
|
|
3
3
|
export declare const getFileType: (value: string, fallback?: string) => string;
|
|
4
4
|
export declare const getCellName: (value: string) => string;
|
|
5
5
|
export declare const getUploadCellFolder: ({ data: { file: { webkitRelativePath }, }, }: UploadActionTask, fallback?: string) => string;
|
|
6
6
|
export declare const getFileDataCellFolder: (task: FileDataTask) => string;
|
|
7
7
|
export declare const getUploadCellProgress: ({ progress, status, }: UploadActionTask) => DataTableNumberDataCell['content'];
|
|
8
|
+
export declare const getDownloadCellProgress: ({ progress, status, }: DownloadActionTask) => DataTableNumberDataCell['content'];
|
|
8
9
|
export declare const getFileSize: (value: number | undefined, fallback?: string) => string;
|
|
9
10
|
export declare const getFileDataCancelCellContent: <TInput extends WithKey<import("../../hooks/useResolveTableData/types").CellData<import("./types").FileDataTaskTableResolverProps, FileDataTask>, ActionTableKey>, TCallback extends TInput["props"]["onTaskRemove"] extends (item: infer TItem) => void ? (item: TItem) => void : never>(data: TInput) => DataTableButtonDataCell['content'];
|
|
10
11
|
/**
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.
|
|
1
|
+
export declare const VERSION = "3.14.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-storage",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"typecheck": "tsc --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@aws-amplify/ui": "6.
|
|
49
|
-
"@aws-amplify/ui-react": "6.13.
|
|
50
|
-
"@aws-amplify/ui-react-core": "3.4.
|
|
48
|
+
"@aws-amplify/ui": "6.13.0",
|
|
49
|
+
"@aws-amplify/ui-react": "6.13.2",
|
|
50
|
+
"@aws-amplify/ui-react-core": "3.4.7",
|
|
51
51
|
"tslib": "^2.5.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|