@aws-amplify/ui-react-storage 3.13.1 → 3.15.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 +9 -3
- package/dist/{createStorageBrowser-DaVWyJzC.js → createStorageBrowser-CG-6mXiT.js} +487 -146
- package/dist/esm/browser.mjs +2 -0
- package/dist/esm/components/StorageBrowser/ErrorBoundary/ErrorBoundary.mjs +2 -0
- package/dist/esm/components/StorageBrowser/StorageBrowserAmplify.mjs +2 -0
- package/dist/esm/components/StorageBrowser/actions/configs/defaults.mjs +2 -0
- package/dist/esm/components/StorageBrowser/actions/handlers/defaults.mjs +1 -1
- package/dist/esm/components/StorageBrowser/actions/handlers/listLocationItems.mjs +4 -2
- package/dist/esm/components/StorageBrowser/actions/handlers/listLocations.mjs +7 -2
- package/dist/esm/components/StorageBrowser/actions/handlers/utils.mjs +87 -2
- package/dist/esm/components/StorageBrowser/actions/handlers/zipdownload.mjs +195 -0
- package/dist/esm/components/StorageBrowser/adapters/createAmplifyAuthAdapter/createAmplifyListLocationsHandler.mjs +3 -1
- package/dist/esm/components/StorageBrowser/adapters/createManagedAuthAdapter/createManagedAuthAdapter.mjs +2 -0
- package/dist/esm/components/StorageBrowser/components/ComponentsProvider.mjs +2 -0
- package/dist/esm/components/StorageBrowser/components/base/preview/DownloadButton.mjs +2 -0
- package/dist/esm/components/StorageBrowser/controls/DataTableControl.mjs +2 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser/StorageBrowserDefault.mjs +2 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser/createProvider.mjs +2 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser/createStorageBrowser.mjs +2 -0
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/downloadView.mjs +3 -0
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/shared.mjs +2 -0
- package/dist/esm/components/StorageBrowser/locationItems/context.mjs +1 -0
- package/dist/esm/components/StorageBrowser/tasks/constants.mjs +2 -0
- package/dist/esm/components/StorageBrowser/tasks/useProcessTasks.mjs +10 -4
- package/dist/esm/components/StorageBrowser/tasks/utils.mjs +4 -1
- package/dist/esm/components/StorageBrowser/useAction/useHandler.mjs +1 -1
- package/dist/esm/components/StorageBrowser/useAction/utils.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/FoldersMessageControl.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useCopyView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CreateFolderView/CreateFolderView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CreateFolderView/useCreateFolderView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadViewProvider.mjs +2 -3
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/useDownloadView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadViewProvider.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/LocationDetailView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/getLocationDetailViewTableData/getLocationDetailViewTableData.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationsView/LocationsView.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationsView/LocationsViewProvider.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/LocationsView/useLocationsView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/context/actionViews.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/context/primaryViews.mjs +2 -0
- package/dist/esm/components/StorageBrowser/views/hooks/useFilePreview/useFilePreview.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/constants.mjs +4 -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 +2 -1
- package/dist/styles.css +17 -0
- package/dist/types/components/StorageBrowser/actions/handlers/index.d.ts +1 -0
- package/dist/types/components/StorageBrowser/actions/handlers/types.d.ts +4 -2
- package/dist/types/components/StorageBrowser/actions/handlers/utils.d.ts +13 -1
- package/dist/types/components/StorageBrowser/actions/handlers/zipdownload.d.ts +3 -0
- package/dist/types/components/StorageBrowser/displayText/types.d.ts +4 -1
- package/dist/types/components/StorageBrowser/tasks/types.d.ts +3 -3
- package/dist/types/components/StorageBrowser/tasks/useProcessTasks.d.ts +1 -1
- package/dist/types/components/StorageBrowser/useAction/useHandler.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/utils/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/constants.d.ts +4 -0
- 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 +11 -8
- package/dist/esm/components/StorageBrowser/actions/handlers/download.mjs +0 -37
|
@@ -11,6 +11,8 @@ 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';
|
|
15
|
+
import 'jszip';
|
|
14
16
|
import 'aws-amplify/storage';
|
|
15
17
|
import '../../../actions/configs/context.mjs';
|
|
16
18
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -7,6 +7,8 @@ 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';
|
|
11
|
+
import 'jszip';
|
|
10
12
|
import 'aws-amplify/storage';
|
|
11
13
|
import '../../../actions/configs/context.mjs';
|
|
12
14
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteView.mjs
CHANGED
|
@@ -18,6 +18,8 @@ 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';
|
|
22
|
+
import 'jszip';
|
|
21
23
|
import 'aws-amplify/storage';
|
|
22
24
|
import '../../../actions/configs/context.mjs';
|
|
23
25
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs
CHANGED
|
@@ -9,6 +9,8 @@ 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';
|
|
13
|
+
import 'jszip';
|
|
12
14
|
import 'aws-amplify/storage';
|
|
13
15
|
import '../../../actions/configs/context.mjs';
|
|
14
16
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadView.mjs
CHANGED
|
@@ -18,6 +18,8 @@ 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';
|
|
22
|
+
import 'jszip';
|
|
21
23
|
import 'aws-amplify/storage';
|
|
22
24
|
import '../../../actions/configs/context.mjs';
|
|
23
25
|
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,8 @@ 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';
|
|
13
|
+
import 'jszip';
|
|
12
14
|
import 'aws-amplify/storage';
|
|
13
15
|
import '../../../actions/configs/context.mjs';
|
|
14
16
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadView.mjs
CHANGED
|
@@ -11,6 +11,8 @@ 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';
|
|
15
|
+
import 'jszip';
|
|
14
16
|
import 'aws-amplify/storage';
|
|
15
17
|
import '../../../actions/configs/context.mjs';
|
|
16
18
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -2,6 +2,7 @@ import React__default from 'react';
|
|
|
2
2
|
import '@aws-amplify/storage/internals';
|
|
3
3
|
import { isMultipartUpload } from '../../../actions/handlers/utils.mjs';
|
|
4
4
|
import '@aws-amplify/ui';
|
|
5
|
+
import 'jszip';
|
|
5
6
|
import 'aws-amplify/storage';
|
|
6
7
|
import '../../../actions/configs/context.mjs';
|
|
7
8
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs
CHANGED
|
@@ -9,6 +9,8 @@ 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';
|
|
13
|
+
import 'jszip';
|
|
12
14
|
import 'aws-amplify/storage';
|
|
13
15
|
import '../../../actions/configs/context.mjs';
|
|
14
16
|
import '../../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,8 @@ 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';
|
|
15
|
+
import 'jszip';
|
|
14
16
|
import 'aws-amplify/storage';
|
|
15
17
|
import '../../actions/configs/context.mjs';
|
|
16
18
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@aws-amplify/storage/internals';
|
|
2
2
|
import { createFileDataItem } from '../../../actions/handlers/utils.mjs';
|
|
3
3
|
import '@aws-amplify/ui';
|
|
4
|
+
import 'jszip';
|
|
4
5
|
import 'aws-amplify/storage';
|
|
5
6
|
import '../../../actions/configs/context.mjs';
|
|
6
7
|
import '../../../actions/configs/defaults.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs
CHANGED
|
@@ -2,6 +2,8 @@ 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';
|
|
6
|
+
import 'jszip';
|
|
5
7
|
import 'aws-amplify/storage';
|
|
6
8
|
import { useActionConfigs } from '../../actions/configs/context.mjs';
|
|
7
9
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,8 @@ 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';
|
|
15
|
+
import 'jszip';
|
|
14
16
|
import 'aws-amplify/storage';
|
|
15
17
|
import '../../actions/configs/context.mjs';
|
|
16
18
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -11,6 +11,8 @@ 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';
|
|
15
|
+
import 'jszip';
|
|
14
16
|
import 'aws-amplify/storage';
|
|
15
17
|
import '../../actions/configs/context.mjs';
|
|
16
18
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -2,6 +2,7 @@ import React__default from 'react';
|
|
|
2
2
|
import '@aws-amplify/storage/internals';
|
|
3
3
|
import { getFileKey } from '../../actions/handlers/utils.mjs';
|
|
4
4
|
import '@aws-amplify/ui';
|
|
5
|
+
import 'jszip';
|
|
5
6
|
import 'aws-amplify/storage';
|
|
6
7
|
import '../../actions/configs/context.mjs';
|
|
7
8
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -9,6 +9,8 @@ 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';
|
|
13
|
+
import 'jszip';
|
|
12
14
|
import 'aws-amplify/storage';
|
|
13
15
|
import '../../actions/configs/context.mjs';
|
|
14
16
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -9,6 +9,8 @@ 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';
|
|
13
|
+
import 'jszip';
|
|
12
14
|
import 'aws-amplify/storage';
|
|
13
15
|
import '../../actions/configs/context.mjs';
|
|
14
16
|
import '../../actions/configs/defaults.mjs';
|
|
@@ -8,6 +8,7 @@ import { safeGetProperties } from '../../utils/files/safeGetProperties.mjs';
|
|
|
8
8
|
import { getUrl } from '@aws-amplify/storage/internals';
|
|
9
9
|
import { constructBucket } from '../../../actions/handlers/utils.mjs';
|
|
10
10
|
import '@aws-amplify/ui';
|
|
11
|
+
import 'jszip';
|
|
11
12
|
import 'aws-amplify/storage';
|
|
12
13
|
import { useStore } from '../../../store/context.mjs';
|
|
13
14
|
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
const STATUS_LABELS = {
|
|
2
2
|
PENDING: 'statusDisplayInProgressLabel',
|
|
3
|
+
FINISHING: 'statusDisplayFinishingLabel',
|
|
3
4
|
CANCELED: 'statusDisplayCanceledLabel',
|
|
4
5
|
COMPLETE: 'statusDisplayCompletedLabel',
|
|
6
|
+
LOADED: 'statusDisplayLoadedLabel',
|
|
5
7
|
FAILED: 'statusDisplayFailedLabel',
|
|
6
8
|
QUEUED: 'statusDisplayQueuedLabel',
|
|
7
9
|
OVERWRITE_PREVENTED: 'statusDisplayOverwritePreventedLabel',
|
|
8
10
|
};
|
|
9
11
|
const STATUS_ICONS = {
|
|
10
12
|
PENDING: 'action-progress',
|
|
13
|
+
FINISHING: 'action-progress',
|
|
11
14
|
COMPLETE: 'action-success',
|
|
15
|
+
LOADED: 'action-success',
|
|
12
16
|
FAILED: 'action-error',
|
|
13
17
|
OVERWRITE_PREVENTED: 'action-info',
|
|
14
18
|
CANCELED: 'action-canceled',
|
|
@@ -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 === 'LOADED' || 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,9 +9,10 @@ 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-CG-6mXiT.js');
|
|
13
13
|
require('@aws-amplify/storage/internals');
|
|
14
14
|
require('aws-amplify');
|
|
15
|
+
require('jszip');
|
|
15
16
|
require('aws-amplify/utils');
|
|
16
17
|
require('@aws-amplify/ui-react-core/elements');
|
|
17
18
|
|
package/dist/styles.css
CHANGED
|
@@ -3565,6 +3565,23 @@ strong.amplify-text {
|
|
|
3565
3565
|
gap: var(--amplify-space-medium);
|
|
3566
3566
|
}
|
|
3567
3567
|
|
|
3568
|
+
[data-amplify-authenticator-passkeyprompt] .amplify-authenticator__passkey-success-icon {
|
|
3569
|
+
font-size: var(--amplify-font-sizes-xxxl);
|
|
3570
|
+
color: var(--amplify-colors-green-60, #34a853);
|
|
3571
|
+
}
|
|
3572
|
+
[data-amplify-authenticator-passkeyprompt] .amplify-authenticator__passkey-credential-item {
|
|
3573
|
+
padding: var(--amplify-space-medium);
|
|
3574
|
+
background-color: var(--amplify-colors-background-secondary);
|
|
3575
|
+
border-radius: var(--amplify-radii-small);
|
|
3576
|
+
}
|
|
3577
|
+
[data-amplify-authenticator-passkeyprompt] .amplify-authenticator__passkey-error {
|
|
3578
|
+
color: var(--amplify-colors-font-error);
|
|
3579
|
+
margin-top: var(--amplify-space-small);
|
|
3580
|
+
}
|
|
3581
|
+
[data-amplify-authenticator-passkeyprompt] .amplify-authenticator__passkey-icon {
|
|
3582
|
+
font-size: var(--amplify-components-authenticator-passkey-icon-size, 12rem);
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3568
3585
|
.amplify-avatar {
|
|
3569
3586
|
--avatar-color: var(--amplify-components-avatar-color);
|
|
3570
3587
|
--avatar-background-color: var(--amplify-components-avatar-background-color);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AllFileTypes } from '../../createStorageBrowser/types';
|
|
2
2
|
import type { LocationCredentialsProvider } from '../../storage-internal';
|
|
3
|
+
import type { TaskStatus } from '../../tasks';
|
|
3
4
|
/**
|
|
4
5
|
* `location` grant scope
|
|
5
6
|
*/
|
|
@@ -78,14 +79,15 @@ export interface TaskHandlerOptions {
|
|
|
78
79
|
onProgress?: (data: {
|
|
79
80
|
key: string;
|
|
80
81
|
id: string;
|
|
81
|
-
}, progress: number | undefined) => void;
|
|
82
|
+
}, progress: number | undefined, state?: TaskStatus) => void;
|
|
82
83
|
}
|
|
83
84
|
export interface TaskHandlerInput<TData extends TaskData = TaskData, TOptions extends TaskHandlerOptions = TaskHandlerOptions> {
|
|
84
85
|
config: ActionInputConfig;
|
|
85
86
|
data: TData;
|
|
87
|
+
all: TData[];
|
|
86
88
|
options?: TOptions;
|
|
87
89
|
}
|
|
88
|
-
export type TaskResultStatus = 'CANCELED' | 'COMPLETE' | 'FAILED' | 'OVERWRITE_PREVENTED';
|
|
90
|
+
export type TaskResultStatus = 'CANCELED' | 'COMPLETE' | 'FAILED' | 'LOADED' | 'OVERWRITE_PREVENTED';
|
|
89
91
|
export interface TaskResult<TStatus, TValue> {
|
|
90
92
|
/**
|
|
91
93
|
* result error (if any)
|
|
@@ -1,12 +1,24 @@
|
|
|
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
|
};
|
|
8
9
|
export declare const parseAccessGrantLocation: (location: AccessGrantLocation) => LocationData;
|
|
9
10
|
export declare const shouldExcludeLocation: ({ permissions, type }: LocationData, exclude?: ListLocationsExcludeOptions) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Deduplicates locations with the same bucket and prefix.
|
|
13
|
+
* Only deduplicates when one location's permissions are a superset of another's.
|
|
14
|
+
* This prevents deduplication of incompatible grants like READ + WRITE.
|
|
15
|
+
*
|
|
16
|
+
* Examples:
|
|
17
|
+
* - READ + READWRITE → Keep READWRITE (superset)
|
|
18
|
+
* - READ + READ → Keep first (identical)
|
|
19
|
+
* - READ + WRITE → Keep both (not superset, need separate locations)
|
|
20
|
+
*/
|
|
21
|
+
export declare const deduplicateLocations: (locations: LocationData[]) => LocationData[];
|
|
10
22
|
export declare const getFilteredLocations: (locations: AccessGrantLocation[], exclude?: ListLocationsExcludeOptions) => LocationData[];
|
|
11
23
|
export declare const getFileKey: (key: string) => string;
|
|
12
24
|
export declare const createFileDataItem: (data: FileData) => FileDataItem;
|
|
@@ -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';
|
|
@@ -102,8 +102,10 @@ export interface DefaultActionViewDisplayText<T extends TaskData = TaskData> {
|
|
|
102
102
|
} | undefined;
|
|
103
103
|
statusDisplayCanceledLabel: string;
|
|
104
104
|
statusDisplayCompletedLabel: string;
|
|
105
|
+
statusDisplayLoadedLabel: string;
|
|
105
106
|
statusDisplayFailedLabel: string;
|
|
106
107
|
statusDisplayInProgressLabel: string;
|
|
108
|
+
statusDisplayFinishingLabel: string;
|
|
107
109
|
statusDisplayQueuedLabel: string;
|
|
108
110
|
statusDisplayTotalLabel: string;
|
|
109
111
|
title: string;
|
|
@@ -144,6 +146,7 @@ export interface DefaultDeleteViewDisplayText extends DefaultActionViewDisplayTe
|
|
|
144
146
|
tableColumnProgressHeader?: string;
|
|
145
147
|
}
|
|
146
148
|
export interface DefaultDownloadViewDisplayText extends DefaultActionViewDisplayText<DownloadHandlerData> {
|
|
149
|
+
tableColumnProgressHeader: string;
|
|
147
150
|
}
|
|
148
151
|
export interface DefaultUploadViewDisplayText extends DefaultActionViewDisplayText<UploadHandlerData> {
|
|
149
152
|
addFilesLabel: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { TaskHandlerInput,
|
|
1
|
+
import type { TaskData, TaskHandlerInput, TaskHandlerOptions, TaskResult, TaskResultStatus } from '../actions';
|
|
2
2
|
/**
|
|
3
3
|
* extends {@link TaskResultStatus} to include `QUEUED` and `PENDING` statuses
|
|
4
4
|
* used in task processing
|
|
5
5
|
*/
|
|
6
|
-
export type TaskStatus = TaskResultStatus | 'QUEUED' | 'PENDING';
|
|
6
|
+
export type TaskStatus = TaskResultStatus | 'QUEUED' | 'PENDING' | 'FINISHING';
|
|
7
7
|
/**
|
|
8
8
|
* aggregate task status counts
|
|
9
9
|
*/
|
|
@@ -50,7 +50,7 @@ export type UseProcessTasksState<TTask, TInput> = [
|
|
|
50
50
|
interface HandleTasksOptions extends TaskHandlerOptions {
|
|
51
51
|
concurrency?: number;
|
|
52
52
|
}
|
|
53
|
-
export interface HandleBatchTasksInput<TData extends TaskData> extends Omit<TaskHandlerInput<TData, HandleTasksOptions>, 'data'> {
|
|
53
|
+
export interface HandleBatchTasksInput<TData extends TaskData> extends Omit<TaskHandlerInput<TData, HandleTasksOptions>, 'data' | 'all'> {
|
|
54
54
|
}
|
|
55
55
|
export interface HandleSingleTaskInput<TData extends TaskData> extends TaskHandlerInput<TData> {
|
|
56
56
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ActionHandler } from '../actions';
|
|
2
|
-
import type { InferHandleTasksInput,
|
|
2
|
+
import type { InferHandleTasksInput, ProcessTasksOptions, Task, UseProcessTasksState } from './types';
|
|
3
3
|
export declare function useProcessTasks<TData, TValue, TTask extends Task<TData, TValue>, TInput extends InferHandleTasksInput<TItems, TTask['data']>, TItems extends TTask['data'][] | undefined = undefined>(handler: ActionHandler<TData, TValue>, options?: ProcessTasksOptions<TTask, TItems>): UseProcessTasksState<TTask, TInput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ActionHandler } from '../actions';
|
|
2
|
-
import type {
|
|
2
|
+
import type { HandleTasksState, HandleTaskState, InferTask, UseHandlerOptions, UseHandlerOptionsWithItems } from './types';
|
|
3
3
|
export declare function useHandler<THandler extends ActionHandler, TTask extends InferTask<THandler>>(handler: THandler, options: UseHandlerOptionsWithItems<TTask>): HandleTasksState<TTask>;
|
|
4
4
|
export declare function useHandler<THandler extends ActionHandler, TTask extends InferTask<THandler>>(handler: THandler, options?: UseHandlerOptions<TTask>): HandleTaskState<TTask>;
|
|
@@ -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';
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
export declare const STATUS_LABELS: {
|
|
2
2
|
readonly PENDING: "statusDisplayInProgressLabel";
|
|
3
|
+
readonly FINISHING: "statusDisplayFinishingLabel";
|
|
3
4
|
readonly CANCELED: "statusDisplayCanceledLabel";
|
|
4
5
|
readonly COMPLETE: "statusDisplayCompletedLabel";
|
|
6
|
+
readonly LOADED: "statusDisplayLoadedLabel";
|
|
5
7
|
readonly FAILED: "statusDisplayFailedLabel";
|
|
6
8
|
readonly QUEUED: "statusDisplayQueuedLabel";
|
|
7
9
|
readonly OVERWRITE_PREVENTED: "statusDisplayOverwritePreventedLabel";
|
|
8
10
|
};
|
|
9
11
|
export declare const STATUS_ICONS: {
|
|
10
12
|
readonly PENDING: "action-progress";
|
|
13
|
+
readonly FINISHING: "action-progress";
|
|
11
14
|
readonly COMPLETE: "action-success";
|
|
15
|
+
readonly LOADED: "action-success";
|
|
12
16
|
readonly FAILED: "action-error";
|
|
13
17
|
readonly OVERWRITE_PREVENTED: "action-info";
|
|
14
18
|
readonly CANCELED: "action-canceled";
|
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.15.0";
|