@aws-amplify/ui-react-storage 3.9.0 → 3.9.2
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 +3 -1
- package/dist/{createAmplifyAuthAdapter-BcuxpEzi.js → createAmplifyAuthAdapter-BJjOYxQA.js} +541 -394
- package/dist/esm/browser.mjs +6 -0
- package/dist/esm/components/StorageBrowser/StorageBrowserAmplify.mjs +1 -0
- package/dist/esm/components/StorageBrowser/StorageBrowserDefault.mjs +3 -2
- package/dist/esm/components/StorageBrowser/actions/configs/defaults.mjs +10 -12
- package/dist/esm/components/StorageBrowser/actions/handlers/constants.mjs +4 -1
- package/dist/esm/components/StorageBrowser/actions/handlers/copy.mjs +4 -1
- package/dist/esm/components/StorageBrowser/actions/handlers/createFolder.mjs +4 -3
- package/dist/esm/components/StorageBrowser/actions/handlers/defaults.mjs +17 -0
- package/dist/esm/components/StorageBrowser/actions/handlers/delete.mjs +4 -1
- package/dist/esm/components/StorageBrowser/actions/handlers/download.mjs +4 -1
- package/dist/esm/components/StorageBrowser/actions/handlers/upload.mjs +6 -11
- package/dist/esm/components/StorageBrowser/actions/handlers/utils.mjs +4 -3
- package/dist/esm/components/StorageBrowser/adapters/createManagedAuthAdapter/createManagedAuthAdapter.mjs +2 -1
- package/dist/esm/components/StorageBrowser/componentsDefault.mjs +4 -4
- package/dist/esm/components/StorageBrowser/createStorageBrowser.mjs +7 -1
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/shared.mjs +0 -1
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/uploadView.mjs +3 -2
- package/dist/esm/components/StorageBrowser/displayText/utils.mjs +7 -0
- package/dist/esm/components/StorageBrowser/providers/store/locationItems/context.mjs +1 -0
- package/dist/esm/components/StorageBrowser/tasks/useProcessTasks.mjs +20 -22
- package/dist/esm/components/StorageBrowser/useAction/useAction.mjs +14 -7
- package/dist/esm/components/StorageBrowser/useAction/useHandler.mjs +26 -32
- package/dist/esm/components/StorageBrowser/useAction/useList.mjs +0 -1
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs +8 -10
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useCopyView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.mjs +11 -13
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CreateFolderView/useCreateFolderView.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteViewProvider.mjs +6 -8
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs +6 -9
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadViewProvider.mjs +14 -10
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs +2 -1
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/getLocationDetailViewTableData/getLocationDetailViewTableData.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +7 -11
- package/dist/esm/components/StorageBrowser/views/LocationsView/useLocationsView.mjs +5 -5
- package/dist/esm/components/StorageBrowser/views/context/actionViews.mjs +3 -2
- package/dist/esm/components/StorageBrowser/views/context/getViews.mjs +4 -1
- package/dist/esm/components/StorageBrowser/views/context/primaryViews.mjs +3 -2
- package/dist/esm/components/StorageBrowser/views/hooks/usePaginate.mjs +19 -21
- package/dist/esm/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.mjs +15 -0
- package/dist/esm/components/StorageBrowser/views/useView.mjs +6 -7
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/constants.mjs +18 -0
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/copyResolvers.mjs +82 -0
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/deleteResolvers.mjs +82 -0
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/uploadResolvers.mjs +112 -0
- package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/utils.mjs +49 -0
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/components/StorageBrowser/ComponentsProvider.d.ts +4 -1
- package/dist/types/components/StorageBrowser/actions/configs/types.d.ts +41 -2
- package/dist/types/components/StorageBrowser/actions/handlers/constants.d.ts +1 -0
- package/dist/types/components/StorageBrowser/actions/handlers/copy.d.ts +4 -7
- package/dist/types/components/StorageBrowser/actions/handlers/createFolder.d.ts +1 -3
- package/dist/types/components/StorageBrowser/actions/handlers/defaults.d.ts +15 -0
- package/dist/types/components/StorageBrowser/actions/handlers/delete.d.ts +2 -2
- package/dist/types/components/StorageBrowser/actions/handlers/index.d.ts +1 -0
- package/dist/types/components/StorageBrowser/actions/handlers/listLocations.d.ts +4 -12
- package/dist/types/components/StorageBrowser/actions/handlers/types.d.ts +26 -17
- package/dist/types/components/StorageBrowser/actions/handlers/upload.d.ts +1 -4
- package/dist/types/components/StorageBrowser/actions/handlers/utils.d.ts +2 -2
- package/dist/types/components/StorageBrowser/actions/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/componentsDefault.d.ts +2 -2
- package/dist/types/components/StorageBrowser/createStorageBrowser.d.ts +6 -0
- package/dist/types/components/StorageBrowser/displayText/index.d.ts +1 -0
- package/dist/types/components/StorageBrowser/displayText/types.d.ts +16 -5
- package/dist/types/components/StorageBrowser/displayText/utils.d.ts +3 -0
- package/dist/types/components/StorageBrowser/index.d.ts +4 -3
- package/dist/types/components/StorageBrowser/providers/configuration/createConfigurationProvider.d.ts +1 -1
- package/dist/types/components/StorageBrowser/providers/configuration/types.d.ts +3 -3
- package/dist/types/components/StorageBrowser/providers/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/providers/store/actionType/types.d.ts +4 -0
- package/dist/types/components/StorageBrowser/providers/store/files/types.d.ts +1 -4
- package/dist/types/components/StorageBrowser/providers/store/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/providers/store/location/context.d.ts +6 -0
- package/dist/types/components/StorageBrowser/storage-internal.d.ts +1 -1
- package/dist/types/components/StorageBrowser/tasks/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/tasks/types.d.ts +41 -23
- package/dist/types/components/StorageBrowser/tasks/useProcessTasks.d.ts +3 -3
- package/dist/types/components/StorageBrowser/types.d.ts +191 -15
- package/dist/types/components/StorageBrowser/useAction/types.d.ts +60 -32
- package/dist/types/components/StorageBrowser/useAction/useHandler.d.ts +4 -3
- package/dist/types/components/StorageBrowser/useAction/useList.d.ts +10 -7
- package/dist/types/components/StorageBrowser/views/LocationActionView/CopyView/types.d.ts +5 -0
- package/dist/types/components/StorageBrowser/views/LocationActionView/UploadView/types.d.ts +2 -2
- package/dist/types/components/StorageBrowser/views/LocationActionView/types.d.ts +4 -4
- package/dist/types/components/StorageBrowser/views/LocationDetailView/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/LocationsView/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/context/getViews.d.ts +2 -2
- package/dist/types/components/StorageBrowser/views/context/views.d.ts +2 -2
- package/dist/types/components/StorageBrowser/views/hooks/usePaginate.d.ts +8 -8
- package/dist/types/components/StorageBrowser/views/hooks/useResolveTableData/index.d.ts +2 -0
- package/dist/types/components/StorageBrowser/views/hooks/useResolveTableData/types.d.ts +26 -0
- package/dist/types/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.d.ts +6 -0
- package/dist/types/components/StorageBrowser/views/types.d.ts +1 -1
- package/dist/types/components/StorageBrowser/views/useView.d.ts +16 -13
- package/dist/types/components/StorageBrowser/views/utils/index.d.ts +1 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/__testUtils__/tasks.d.ts +23 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/constants.d.ts +16 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/copyResolvers.d.ts +3 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/deleteResolvers.d.ts +3 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/index.d.ts +3 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/types.d.ts +36 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/uploadResolvers.d.ts +3 -0
- package/dist/types/components/StorageBrowser/views/utils/tableResolvers/utils.d.ts +12 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -5
- package/dist/esm/components/StorageBrowser/views/LocationActionView/getActionIcon.mjs +0 -25
- package/dist/esm/components/StorageBrowser/views/LocationActionView/getActionViewTableData.mjs +0 -155
- package/dist/esm/components/StorageBrowser/views/LocationActionView/getDefaultActionViewHeaders.mjs +0 -24
- package/dist/esm/components/StorageBrowser/views/LocationActionView/getFileTypeDisplayValue.mjs +0 -5
- package/dist/esm/components/StorageBrowser/views/LocationActionView/getPercentValue.mjs +0 -3
- package/dist/types/components/StorageBrowser/displayText/en.d.ts +0 -9
- package/dist/types/components/StorageBrowser/views/LocationActionView/getActionIcon.d.ts +0 -3
- package/dist/types/components/StorageBrowser/views/LocationActionView/getActionViewTableData.d.ts +0 -14
- package/dist/types/components/StorageBrowser/views/LocationActionView/getDefaultActionViewHeaders.d.ts +0 -5
- package/dist/types/components/StorageBrowser/views/LocationActionView/getFileTypeDisplayValue.d.ts +0 -1
- package/dist/types/components/StorageBrowser/views/LocationActionView/getPercentValue.d.ts +0 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import '../../../useAction/context.mjs';
|
|
3
|
-
import '@aws-amplify/ui';
|
|
3
|
+
import '@aws-amplify/ui-react-core/elements';
|
|
4
|
+
import '../../../providers/configuration/credentials/context.mjs';
|
|
4
5
|
import '../../../providers/configuration/context.mjs';
|
|
5
|
-
import '
|
|
6
|
-
import '../../../providers/store/files/context.mjs';
|
|
7
|
-
import '../../../providers/store/actionType/context.mjs';
|
|
8
|
-
import '../../../providers/store/locationItems/context.mjs';
|
|
6
|
+
import '@aws-amplify/ui';
|
|
9
7
|
import { useList } from '../../../useAction/useList.mjs';
|
|
10
8
|
import '@aws-amplify/storage/internals';
|
|
11
9
|
import 'aws-amplify/storage';
|
|
12
10
|
import '../../../actions/configs/context.mjs';
|
|
11
|
+
import '../../../actions/configs/defaults.mjs';
|
|
13
12
|
import { usePaginate } from '../../hooks/usePaginate.mjs';
|
|
14
13
|
import { useSearch } from '../../hooks/useSearch.mjs';
|
|
15
14
|
|
|
@@ -31,20 +30,19 @@ const useFolders = ({ destination, setDestination, }) => {
|
|
|
31
30
|
options: { ...DEFAULT_REFRESH_OPTIONS },
|
|
32
31
|
});
|
|
33
32
|
}, [handleList, key]);
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
33
|
+
const hasNextPage = !!nextToken;
|
|
34
|
+
const onPaginate = () => {
|
|
35
|
+
if (!hasNextPage)
|
|
37
36
|
return;
|
|
38
37
|
handleList({
|
|
39
38
|
prefix: key,
|
|
40
39
|
options: { ...DEFAULT_LIST_OPTIONS, nextToken },
|
|
41
40
|
});
|
|
42
41
|
};
|
|
43
|
-
const { currentPage: page,
|
|
42
|
+
const { currentPage: page, handlePaginate, highestPageVisited, pageItems, handleReset, } = usePaginate({
|
|
44
43
|
items,
|
|
45
|
-
|
|
44
|
+
onPaginate,
|
|
46
45
|
pageSize: DEFAULT_PAGE_SIZE,
|
|
47
|
-
hasNextToken,
|
|
48
46
|
});
|
|
49
47
|
const onSearch = (query) => {
|
|
50
48
|
handleReset();
|
|
@@ -70,7 +68,7 @@ const useFolders = ({ destination, setDestination, }) => {
|
|
|
70
68
|
};
|
|
71
69
|
return {
|
|
72
70
|
hasError,
|
|
73
|
-
hasNextPage
|
|
71
|
+
hasNextPage,
|
|
74
72
|
highestPageVisited,
|
|
75
73
|
isLoading,
|
|
76
74
|
message,
|
|
@@ -79,7 +77,7 @@ const useFolders = ({ destination, setDestination, }) => {
|
|
|
79
77
|
pageItems,
|
|
80
78
|
query,
|
|
81
79
|
hasExhaustedSearch,
|
|
82
|
-
onPaginate,
|
|
80
|
+
onPaginate: handlePaginate,
|
|
83
81
|
onQuery,
|
|
84
82
|
onSearch: onSearchSubmit,
|
|
85
83
|
onSearchClear: () => {
|
|
@@ -9,6 +9,7 @@ import '../../../providers/configuration/context.mjs';
|
|
|
9
9
|
import '@aws-amplify/storage/internals';
|
|
10
10
|
import 'aws-amplify/storage';
|
|
11
11
|
import '../../../actions/configs/context.mjs';
|
|
12
|
+
import '../../../actions/configs/defaults.mjs';
|
|
12
13
|
import '../../../providers/store/location/context.mjs';
|
|
13
14
|
import '../../../providers/store/files/context.mjs';
|
|
14
15
|
import '../../../providers/store/actionType/context.mjs';
|
|
@@ -2,21 +2,19 @@ import React__default from 'react';
|
|
|
2
2
|
import { ControlsContextProvider } from '../../../controls/context.mjs';
|
|
3
3
|
import { useDisplayText } from '../../../displayText/context.mjs';
|
|
4
4
|
import '@aws-amplify/ui';
|
|
5
|
-
import
|
|
5
|
+
import useResolveDataTable from '../../hooks/useResolveTableData/useResolveTableData.mjs';
|
|
6
|
+
import { DELETE_TABLE_RESOLVERS, DELETE_TABLE_KEYS } from '../../utils/tableResolvers/deleteResolvers.mjs';
|
|
6
7
|
|
|
7
8
|
function DeleteViewProvider({ children, ...props }) {
|
|
8
9
|
const { DeleteView: displayText } = useDisplayText();
|
|
9
10
|
const { actionCancelLabel, actionExitLabel, actionStartLabel, title, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, getActionCompleteMessage, } = displayText;
|
|
10
|
-
const { isProcessing, isProcessingComplete,
|
|
11
|
+
const { isProcessing, isProcessingComplete, statusCounts, tasks: items, onActionCancel, onActionStart, onActionExit, onTaskRemove, } = props;
|
|
11
12
|
const message = isProcessingComplete
|
|
12
13
|
? getActionCompleteMessage({ counts: statusCounts })
|
|
13
14
|
: undefined;
|
|
14
|
-
const tableData =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isProcessing,
|
|
18
|
-
displayText,
|
|
19
|
-
onTaskRemove,
|
|
15
|
+
const tableData = useResolveDataTable(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
|
|
16
|
+
items,
|
|
17
|
+
props: { displayText, isProcessing, onTaskRemove },
|
|
20
18
|
});
|
|
21
19
|
return (React__default.createElement(ControlsContextProvider, { data: {
|
|
22
20
|
actionCancelLabel,
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs
CHANGED
|
@@ -14,19 +14,16 @@ import '../../../providers/configuration/context.mjs';
|
|
|
14
14
|
import '@aws-amplify/storage/internals';
|
|
15
15
|
import 'aws-amplify/storage';
|
|
16
16
|
import '../../../actions/configs/context.mjs';
|
|
17
|
+
import '../../../actions/configs/defaults.mjs';
|
|
17
18
|
|
|
19
|
+
// assign to constant to ensure referential equality
|
|
20
|
+
const EMPTY_ITEMS = [];
|
|
18
21
|
const useDeleteView = (options) => {
|
|
19
22
|
const { onExit: _onExit } = options ?? {};
|
|
20
23
|
const [{ location, locationItems }, dispatchStoreAction] = useStore();
|
|
21
|
-
const {
|
|
22
|
-
const {
|
|
23
|
-
const
|
|
24
|
-
? []
|
|
25
|
-
: fileDataItems.map((item) => ({
|
|
26
|
-
...item,
|
|
27
|
-
key: `${key}${item.fileKey}`,
|
|
28
|
-
})), [fileDataItems, key]);
|
|
29
|
-
const [processState, handleProcess] = useAction('delete', { items: data });
|
|
24
|
+
const { current } = location;
|
|
25
|
+
const { fileDataItems: items = EMPTY_ITEMS } = locationItems;
|
|
26
|
+
const [processState, handleProcess] = useAction('delete', { items });
|
|
30
27
|
const { isProcessing, isProcessingComplete, statusCounts, tasks } = processState;
|
|
31
28
|
const onActionStart = () => {
|
|
32
29
|
if (!current)
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
+
import '@aws-amplify/storage/internals';
|
|
3
|
+
import { isMultipartUpload } from '../../../actions/handlers/utils.mjs';
|
|
4
|
+
import '@aws-amplify/ui';
|
|
5
|
+
import 'aws-amplify/storage';
|
|
6
|
+
import '../../../actions/configs/context.mjs';
|
|
7
|
+
import '../../../actions/configs/defaults.mjs';
|
|
2
8
|
import { ControlsContextProvider } from '../../../controls/context.mjs';
|
|
3
9
|
import { useDisplayText } from '../../../displayText/context.mjs';
|
|
4
|
-
import '
|
|
5
|
-
import {
|
|
10
|
+
import useResolveDataTable from '../../hooks/useResolveTableData/useResolveTableData.mjs';
|
|
11
|
+
import { UPLOAD_TABLE_RESOLVERS, UPLOAD_TABLE_KEYS } from '../../utils/tableResolvers/uploadResolvers.mjs';
|
|
6
12
|
|
|
7
13
|
function UploadViewProvider({ children, ...props }) {
|
|
8
14
|
const { UploadView: displayText } = useDisplayText();
|
|
9
15
|
const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, addFilesLabel, addFolderLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, overwriteToggleLabel, title, getActionCompleteMessage, getFilesValidationMessage, } = displayText;
|
|
10
|
-
const { isOverwritingEnabled, isProcessing, isProcessingComplete, location, tasks, statusCounts, invalidFiles, onActionStart, onActionCancel, onDropFiles, onActionExit, onTaskRemove, onSelectFiles, onToggleOverwrite, } = props;
|
|
16
|
+
const { isOverwritingEnabled, isProcessing, isProcessingComplete, location, tasks: items, statusCounts, invalidFiles, onActionStart, onActionCancel, onDropFiles, onActionExit, onTaskRemove, onSelectFiles, onToggleOverwrite, } = props;
|
|
11
17
|
const isActionStartDisabled = isProcessing || isProcessingComplete || statusCounts.TOTAL === 0;
|
|
12
18
|
const isActionCancelDisabled = !isProcessing || isProcessingComplete;
|
|
13
19
|
const isAddFilesDisabled = isProcessing || isProcessingComplete;
|
|
@@ -21,6 +27,10 @@ function UploadViewProvider({ children, ...props }) {
|
|
|
21
27
|
const filesValidationMessage = invalidFiles && !isProcessing
|
|
22
28
|
? getFilesValidationMessage({ invalidFiles })
|
|
23
29
|
: undefined;
|
|
30
|
+
const tableData = useResolveDataTable(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
|
|
31
|
+
items,
|
|
32
|
+
props: { displayText, isProcessing, isMultipartUpload, onTaskRemove },
|
|
33
|
+
});
|
|
24
34
|
return (React__default.createElement(ControlsContextProvider, { data: {
|
|
25
35
|
actionCancelLabel,
|
|
26
36
|
actionDestinationLabel,
|
|
@@ -44,13 +54,7 @@ function UploadViewProvider({ children, ...props }) {
|
|
|
44
54
|
statusDisplayCompletedLabel,
|
|
45
55
|
statusDisplayFailedLabel,
|
|
46
56
|
statusDisplayQueuedLabel,
|
|
47
|
-
tableData
|
|
48
|
-
tasks,
|
|
49
|
-
shouldDisplayProgress: true,
|
|
50
|
-
displayText,
|
|
51
|
-
isProcessing,
|
|
52
|
-
onTaskRemove,
|
|
53
|
-
}),
|
|
57
|
+
tableData,
|
|
54
58
|
title,
|
|
55
59
|
}, onActionCancel: onActionCancel, onActionExit: onActionExit, onActionStart: onActionStart, onAddFiles: () => {
|
|
56
60
|
onSelectFiles('FILE');
|
package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs
CHANGED
|
@@ -12,9 +12,10 @@ import '@aws-amplify/ui-react-core/elements';
|
|
|
12
12
|
import '../../../providers/configuration/credentials/context.mjs';
|
|
13
13
|
import '../../../providers/configuration/context.mjs';
|
|
14
14
|
import '@aws-amplify/storage/internals';
|
|
15
|
-
import { isFileTooBig } from '../../../validators/isFileTooBig.mjs';
|
|
16
15
|
import 'aws-amplify/storage';
|
|
16
|
+
import { isFileTooBig } from '../../../validators/isFileTooBig.mjs';
|
|
17
17
|
import '../../../actions/configs/context.mjs';
|
|
18
|
+
import '../../../actions/configs/defaults.mjs';
|
|
18
19
|
import { DEFAULT_OVERWRITE_ENABLED } from './constants.mjs';
|
|
19
20
|
|
|
20
21
|
const useUploadView = (options) => {
|
|
@@ -3,6 +3,7 @@ import { createFileDataItem } from '../../../actions/handlers/utils.mjs';
|
|
|
3
3
|
import '@aws-amplify/ui';
|
|
4
4
|
import 'aws-amplify/storage';
|
|
5
5
|
import '../../../actions/configs/context.mjs';
|
|
6
|
+
import '../../../actions/configs/defaults.mjs';
|
|
6
7
|
import { getFileRowContent } from './getFileRowContent.mjs';
|
|
7
8
|
import { getFolderRowContent } from './getFolderRowContent.mjs';
|
|
8
9
|
import { getHeaders } from './getHeaders.mjs';
|
package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { useStore } from '../../providers/store/useStore.mjs';
|
|
|
9
9
|
import '@aws-amplify/storage/internals';
|
|
10
10
|
import 'aws-amplify/storage';
|
|
11
11
|
import { useActionConfigs } from '../../actions/configs/context.mjs';
|
|
12
|
+
import '../../actions/configs/defaults.mjs';
|
|
12
13
|
import '../../useAction/context.mjs';
|
|
13
14
|
import { useAction } from '../../useAction/useAction.mjs';
|
|
14
15
|
import { useList } from '../../useAction/useList.mjs';
|
|
@@ -41,8 +42,7 @@ const useLocationDetailView = (options) => {
|
|
|
41
42
|
// set up pagination
|
|
42
43
|
const { items, nextToken, search } = data;
|
|
43
44
|
const { hasExhaustedSearch = false } = search ?? {};
|
|
44
|
-
const
|
|
45
|
-
const paginateCallback = () => {
|
|
45
|
+
const onPaginate = () => {
|
|
46
46
|
if (hasInvalidPrefix || !nextToken)
|
|
47
47
|
return;
|
|
48
48
|
dispatchStoreAction({ type: 'RESET_LOCATION_ITEMS' });
|
|
@@ -51,11 +51,10 @@ const useLocationDetailView = (options) => {
|
|
|
51
51
|
options: { ...listOptions, nextToken },
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
-
const { currentPage,
|
|
54
|
+
const { currentPage, handlePaginate, handleReset, highestPageVisited, pageItems, } = usePaginate({
|
|
55
55
|
items,
|
|
56
|
-
|
|
56
|
+
onPaginate,
|
|
57
57
|
pageSize: listOptions.pageSize,
|
|
58
|
-
hasNextToken,
|
|
59
58
|
});
|
|
60
59
|
const onSearch = (query, includeSubfolders) => {
|
|
61
60
|
if (hasInvalidPrefix)
|
|
@@ -123,13 +122,13 @@ const useLocationDetailView = (options) => {
|
|
|
123
122
|
fileDataItems,
|
|
124
123
|
hasError,
|
|
125
124
|
hasDownloadError: task?.status === 'FAILED',
|
|
126
|
-
hasNextPage:
|
|
125
|
+
hasNextPage: !!nextToken,
|
|
127
126
|
highestPageVisited,
|
|
128
127
|
message,
|
|
129
128
|
downloadErrorMessage: getDownloadErrorMessageFromFailedDownloadTask(task),
|
|
130
129
|
isLoading,
|
|
131
130
|
isSearchSubfoldersEnabled,
|
|
132
|
-
onPaginate,
|
|
131
|
+
onPaginate: handlePaginate,
|
|
133
132
|
searchQuery,
|
|
134
133
|
hasExhaustedSearch,
|
|
135
134
|
onRefresh,
|
|
@@ -185,10 +184,7 @@ const useLocationDetailView = (options) => {
|
|
|
185
184
|
resetSearch();
|
|
186
185
|
if (hasInvalidPrefix)
|
|
187
186
|
return;
|
|
188
|
-
handleList({
|
|
189
|
-
prefix: key,
|
|
190
|
-
options: { ...listOptions, refresh: true },
|
|
191
|
-
});
|
|
187
|
+
handleList({ prefix: key, options: { ...listOptions, refresh: true } });
|
|
192
188
|
handleReset();
|
|
193
189
|
},
|
|
194
190
|
onSearchQueryChange,
|
|
@@ -12,6 +12,7 @@ import '@aws-amplify/storage/internals';
|
|
|
12
12
|
import { getFileKey } from '../../actions/handlers/utils.mjs';
|
|
13
13
|
import 'aws-amplify/storage';
|
|
14
14
|
import '../../actions/configs/context.mjs';
|
|
15
|
+
import '../../actions/configs/defaults.mjs';
|
|
15
16
|
import { usePaginate } from '../hooks/usePaginate.mjs';
|
|
16
17
|
import { useSearch } from '../hooks/useSearch.mjs';
|
|
17
18
|
|
|
@@ -43,16 +44,15 @@ const useLocationsView = (options) => {
|
|
|
43
44
|
handleList({ options: { ...listOptions, refresh: true } });
|
|
44
45
|
}, [handleList, listOptions]);
|
|
45
46
|
// set up pagination
|
|
46
|
-
const
|
|
47
|
+
const onPaginate = () => {
|
|
47
48
|
if (!nextToken)
|
|
48
49
|
return;
|
|
49
50
|
handleList({ options: { ...listOptions, nextToken } });
|
|
50
51
|
};
|
|
51
|
-
const { currentPage,
|
|
52
|
+
const { currentPage, handlePaginate, handleReset, highestPageVisited, pageItems, } = usePaginate({
|
|
52
53
|
items,
|
|
53
|
-
|
|
54
|
+
onPaginate,
|
|
54
55
|
pageSize: listOptions.pageSize,
|
|
55
|
-
hasNextToken,
|
|
56
56
|
});
|
|
57
57
|
const onSearch = (query) => {
|
|
58
58
|
handleReset();
|
|
@@ -99,7 +99,7 @@ const useLocationsView = (options) => {
|
|
|
99
99
|
handleReset();
|
|
100
100
|
handleList({ options: { ...listOptions, refresh: true } });
|
|
101
101
|
},
|
|
102
|
-
onPaginate,
|
|
102
|
+
onPaginate: handlePaginate,
|
|
103
103
|
onSearch: onSearchSubmit,
|
|
104
104
|
onSearchQueryChange,
|
|
105
105
|
onSearchClear: () => {
|
|
@@ -6,13 +6,14 @@ import '../../providers/store/files/context.mjs';
|
|
|
6
6
|
import '../../providers/store/actionType/context.mjs';
|
|
7
7
|
import '../../providers/store/locationItems/context.mjs';
|
|
8
8
|
import '../../useAction/context.mjs';
|
|
9
|
-
import '../../providers/configuration/context.mjs';
|
|
10
|
-
import '@aws-amplify/ui-react-core';
|
|
11
9
|
import '@aws-amplify/ui-react-core/elements';
|
|
12
10
|
import '../../providers/configuration/credentials/context.mjs';
|
|
11
|
+
import '../../providers/configuration/context.mjs';
|
|
12
|
+
import '@aws-amplify/ui-react-core';
|
|
13
13
|
import '@aws-amplify/storage/internals';
|
|
14
14
|
import 'aws-amplify/storage';
|
|
15
15
|
import '../../actions/configs/context.mjs';
|
|
16
|
+
import '../../actions/configs/defaults.mjs';
|
|
16
17
|
import { CreateFolderView } from '../LocationActionView/CreateFolderView/CreateFolderView.mjs';
|
|
17
18
|
import { CopyView } from '../LocationActionView/CopyView/CopyView.mjs';
|
|
18
19
|
import { DeleteView } from '../LocationActionView/DeleteView/DeleteView.mjs';
|
|
@@ -17,7 +17,10 @@ const getViews = (views, customConfigs) => {
|
|
|
17
17
|
// ignore custom actions that are only handlers
|
|
18
18
|
return !isObject(config) || isFunction(config)
|
|
19
19
|
? acc
|
|
20
|
-
: {
|
|
20
|
+
: {
|
|
21
|
+
...acc,
|
|
22
|
+
[key]: views?.[config.viewName],
|
|
23
|
+
};
|
|
21
24
|
}, {});
|
|
22
25
|
return {
|
|
23
26
|
action: { ...resolvedDefaultActionViews, ...customActionViews },
|
|
@@ -6,13 +6,14 @@ import '../../providers/store/files/context.mjs';
|
|
|
6
6
|
import '../../providers/store/actionType/context.mjs';
|
|
7
7
|
import '../../providers/store/locationItems/context.mjs';
|
|
8
8
|
import '../../useAction/context.mjs';
|
|
9
|
-
import '../../providers/configuration/context.mjs';
|
|
10
|
-
import '@aws-amplify/ui-react-core';
|
|
11
9
|
import '@aws-amplify/ui-react-core/elements';
|
|
12
10
|
import '../../providers/configuration/credentials/context.mjs';
|
|
11
|
+
import '../../providers/configuration/context.mjs';
|
|
12
|
+
import '@aws-amplify/ui-react-core';
|
|
13
13
|
import '@aws-amplify/storage/internals';
|
|
14
14
|
import 'aws-amplify/storage';
|
|
15
15
|
import '../../actions/configs/context.mjs';
|
|
16
|
+
import '../../actions/configs/defaults.mjs';
|
|
16
17
|
import '../LocationActionView/CreateFolderView/CreateFolderView.mjs';
|
|
17
18
|
import '../LocationActionView/DeleteView/DeleteView.mjs';
|
|
18
19
|
import { LocationActionView } from '../LocationActionView/LocationActionView.mjs';
|
|
@@ -1,40 +1,38 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { isFunction } from '@aws-amplify/ui';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const DEFAULT_PAGE_SIZE = 100;
|
|
5
|
+
const usePaginate = ({ items, onPaginate, page = 1, pageSize = DEFAULT_PAGE_SIZE, }) => {
|
|
6
|
+
const [currentPage, setCurrentPage] = React__default.useState(page);
|
|
7
|
+
const visitedRef = React__default.useRef(page);
|
|
6
8
|
const handleReset = React__default.useRef(() => {
|
|
7
|
-
setCurrentPage(
|
|
9
|
+
setCurrentPage(page);
|
|
10
|
+
// set `visitedRef` to initially provided `page`
|
|
11
|
+
visitedRef.current = page;
|
|
8
12
|
}).current;
|
|
9
13
|
return React__default.useMemo(() => {
|
|
10
|
-
const
|
|
11
|
-
const highestPageVisited =
|
|
14
|
+
const hasItems = Array.isArray(items);
|
|
15
|
+
const highestPageVisited = visitedRef.current;
|
|
12
16
|
const isFirstPage = currentPage === 1;
|
|
13
17
|
const start = isFirstPage ? 0 : (currentPage - 1) * pageSize;
|
|
14
18
|
const end = isFirstPage ? pageSize : currentPage * pageSize;
|
|
15
|
-
const pageItems =
|
|
19
|
+
const pageItems = hasItems ? items.slice(start, end) : [];
|
|
16
20
|
return {
|
|
17
21
|
currentPage,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
handlePaginate: (page) => {
|
|
23
|
+
if (page < 1)
|
|
24
|
+
return;
|
|
25
|
+
if (isFunction(onPaginate))
|
|
26
|
+
onPaginate(page);
|
|
27
|
+
if (page > currentPage)
|
|
28
|
+
visitedRef.current = page;
|
|
29
|
+
setCurrentPage(page);
|
|
25
30
|
},
|
|
26
31
|
handleReset,
|
|
27
32
|
highestPageVisited,
|
|
28
33
|
pageItems,
|
|
29
34
|
};
|
|
30
|
-
}, [
|
|
31
|
-
currentPage,
|
|
32
|
-
handleReset,
|
|
33
|
-
hasNextToken,
|
|
34
|
-
items,
|
|
35
|
-
paginateCallback,
|
|
36
|
-
pageSize,
|
|
37
|
-
]);
|
|
35
|
+
}, [currentPage, handleReset, items, onPaginate, pageSize]);
|
|
38
36
|
};
|
|
39
37
|
|
|
40
38
|
export { usePaginate };
|
package/dist/esm/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
function useResolveDataTable(keys, { getCell, getHeader, getRowKey }, { items, props }) {
|
|
4
|
+
return React__default.useMemo(() => {
|
|
5
|
+
const getRow = (item) => ({
|
|
6
|
+
key: getRowKey({ item, props }),
|
|
7
|
+
content: keys.map((key) => getCell({ key, item, props })),
|
|
8
|
+
});
|
|
9
|
+
const headers = keys.map((key) => getHeader({ key, props }));
|
|
10
|
+
const rows = (items ?? []).map(getRow);
|
|
11
|
+
return { headers, rows };
|
|
12
|
+
}, [getCell, getHeader, getRowKey, keys, items, props]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useResolveDataTable as default };
|
|
@@ -13,12 +13,12 @@ import './context/actionViews.mjs';
|
|
|
13
13
|
import './LocationActionView/UploadView/UploadView.mjs';
|
|
14
14
|
import { useUploadView } from './LocationActionView/UploadView/useUploadView.mjs';
|
|
15
15
|
import '@aws-amplify/ui';
|
|
16
|
-
import './LocationsView/LocationsView.mjs';
|
|
17
|
-
import { useLocationsView } from './LocationsView/useLocationsView.mjs';
|
|
18
16
|
import './LocationDetailView/LocationDetailView.mjs';
|
|
19
17
|
import { useLocationDetailView } from './LocationDetailView/useLocationDetailView.mjs';
|
|
18
|
+
import './LocationsView/LocationsView.mjs';
|
|
19
|
+
import { useLocationsView } from './LocationsView/useLocationsView.mjs';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const USE_VIEW_HOOKS = {
|
|
22
22
|
Copy: useCopyView,
|
|
23
23
|
CreateFolder: useCreateFolderView,
|
|
24
24
|
Delete: useDeleteView,
|
|
@@ -26,13 +26,12 @@ const DEFAULT_VIEW_HOOKS = {
|
|
|
26
26
|
Locations: useLocationsView,
|
|
27
27
|
Upload: useUploadView,
|
|
28
28
|
};
|
|
29
|
-
const isUseViewType = (value) => !!
|
|
30
|
-
// @ts-expect-error
|
|
29
|
+
const isUseViewType = (value) => !!USE_VIEW_HOOKS?.[value];
|
|
31
30
|
const useView = (type) => {
|
|
32
31
|
if (!isUseViewType(type)) {
|
|
33
32
|
throw new Error(`Value of \`${type}\` cannot be used to index \`useView\``);
|
|
34
33
|
}
|
|
35
|
-
return
|
|
34
|
+
return USE_VIEW_HOOKS[type]();
|
|
36
35
|
};
|
|
37
36
|
|
|
38
|
-
export {
|
|
37
|
+
export { USE_VIEW_HOOKS, useView };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const STATUS_LABELS = {
|
|
2
|
+
PENDING: 'statusDisplayInProgressLabel',
|
|
3
|
+
CANCELED: 'statusDisplayCanceledLabel',
|
|
4
|
+
COMPLETE: 'statusDisplayCompletedLabel',
|
|
5
|
+
FAILED: 'statusDisplayFailedLabel',
|
|
6
|
+
QUEUED: 'statusDisplayQueuedLabel',
|
|
7
|
+
OVERWRITE_PREVENTED: 'statusDisplayOverwritePreventedLabel',
|
|
8
|
+
};
|
|
9
|
+
const STATUS_ICONS = {
|
|
10
|
+
PENDING: 'action-progress',
|
|
11
|
+
COMPLETE: 'action-success',
|
|
12
|
+
FAILED: 'action-error',
|
|
13
|
+
OVERWRITE_PREVENTED: 'action-info',
|
|
14
|
+
CANCELED: 'action-canceled',
|
|
15
|
+
QUEUED: 'action-queued',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { STATUS_ICONS, STATUS_LABELS };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { capitalize, noop } from '@aws-amplify/ui';
|
|
2
|
+
import '../../../displayText/context.mjs';
|
|
3
|
+
import { isCopyViewDisplayTextKey } from '../../../displayText/utils.mjs';
|
|
4
|
+
import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
|
|
5
|
+
import { getCopyCellFolder, getFileType, getFileSize, getCopyOrDeleteCancelCellContent } from './utils.mjs';
|
|
6
|
+
|
|
7
|
+
const COPY_TABLE_KEYS = [
|
|
8
|
+
'name',
|
|
9
|
+
'folder',
|
|
10
|
+
'type',
|
|
11
|
+
'size',
|
|
12
|
+
'status',
|
|
13
|
+
'cancel',
|
|
14
|
+
];
|
|
15
|
+
const getCopyCellKey = ({ key, item, }) => `${key}-${item.data.id}`;
|
|
16
|
+
const name = (data) => {
|
|
17
|
+
const key = getCopyCellKey(data);
|
|
18
|
+
const { item } = data;
|
|
19
|
+
const text = item.data.fileKey;
|
|
20
|
+
const icon = STATUS_ICONS[item.status];
|
|
21
|
+
return { key, type: 'text', content: { icon, text } };
|
|
22
|
+
};
|
|
23
|
+
const folder = (data) => {
|
|
24
|
+
const key = getCopyCellKey(data);
|
|
25
|
+
const text = getCopyCellFolder(data.item);
|
|
26
|
+
return { key, type: 'text', content: { text } };
|
|
27
|
+
};
|
|
28
|
+
const type = (data) => {
|
|
29
|
+
const key = getCopyCellKey(data);
|
|
30
|
+
const { fileKey } = data.item.data;
|
|
31
|
+
const text = getFileType(fileKey);
|
|
32
|
+
return { key, type: 'text', content: { text } };
|
|
33
|
+
};
|
|
34
|
+
const size = (data) => {
|
|
35
|
+
const key = getCopyCellKey(data);
|
|
36
|
+
const { size: value } = data.item.data;
|
|
37
|
+
const displayValue = getFileSize(value);
|
|
38
|
+
return { key, type: 'number', content: { value, displayValue } };
|
|
39
|
+
};
|
|
40
|
+
const status = (data) => {
|
|
41
|
+
const key = getCopyCellKey(data);
|
|
42
|
+
const { item: { status }, props: { displayText }, } = data;
|
|
43
|
+
const statusLabelKey = STATUS_LABELS[status];
|
|
44
|
+
const text = isCopyViewDisplayTextKey(statusLabelKey)
|
|
45
|
+
? displayText[statusLabelKey]
|
|
46
|
+
: '';
|
|
47
|
+
return { key, type: 'text', content: { text } };
|
|
48
|
+
};
|
|
49
|
+
const cancel = (data) => {
|
|
50
|
+
const key = getCopyCellKey(data);
|
|
51
|
+
const content = getCopyOrDeleteCancelCellContent(data);
|
|
52
|
+
return { key, type: 'button', content };
|
|
53
|
+
};
|
|
54
|
+
const COPY_CELL_RESOLVERS = {
|
|
55
|
+
name,
|
|
56
|
+
folder,
|
|
57
|
+
type,
|
|
58
|
+
size,
|
|
59
|
+
status,
|
|
60
|
+
cancel,
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
*
|
|
64
|
+
* non-upload view tables do not include "progress" headers but include here to
|
|
65
|
+
* keep TS happy as "progress" headers were included in display text interfaces
|
|
66
|
+
* and cannot be removed from the tables without a breaking change
|
|
67
|
+
*/
|
|
68
|
+
progress: noop,
|
|
69
|
+
};
|
|
70
|
+
const COPY_TABLE_RESOLVERS = {
|
|
71
|
+
getCell: (data) => COPY_CELL_RESOLVERS[data.key](data),
|
|
72
|
+
getHeader: ({ key, props: { displayText } }) => {
|
|
73
|
+
const text = displayText[`tableColumn${capitalize(key)}Header`];
|
|
74
|
+
if (key === 'cancel') {
|
|
75
|
+
return { key, type: 'text', content: { text } };
|
|
76
|
+
}
|
|
77
|
+
return { key, type: 'sort', content: { label: text } };
|
|
78
|
+
},
|
|
79
|
+
getRowKey: ({ item }) => item.data.id,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { COPY_TABLE_KEYS, COPY_TABLE_RESOLVERS };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { capitalize, noop } from '@aws-amplify/ui';
|
|
2
|
+
import '../../../displayText/context.mjs';
|
|
3
|
+
import { isDeleteViewDisplayTextKey } from '../../../displayText/utils.mjs';
|
|
4
|
+
import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
|
|
5
|
+
import { getDeleteCellFolder, getFileType, getFileSize, getCopyOrDeleteCancelCellContent } from './utils.mjs';
|
|
6
|
+
|
|
7
|
+
const DELETE_TABLE_KEYS = [
|
|
8
|
+
'name',
|
|
9
|
+
'folder',
|
|
10
|
+
'type',
|
|
11
|
+
'size',
|
|
12
|
+
'status',
|
|
13
|
+
'cancel',
|
|
14
|
+
];
|
|
15
|
+
const getDeleteCellKey = ({ key, item, }) => `${key}-${item.data.id}`;
|
|
16
|
+
const name = (data) => {
|
|
17
|
+
const key = getDeleteCellKey(data);
|
|
18
|
+
const { item } = data;
|
|
19
|
+
const text = item.data.fileKey;
|
|
20
|
+
const icon = STATUS_ICONS[item.status];
|
|
21
|
+
return { key, type: 'text', content: { icon, text } };
|
|
22
|
+
};
|
|
23
|
+
const folder = (data) => {
|
|
24
|
+
const key = getDeleteCellKey(data);
|
|
25
|
+
const text = getDeleteCellFolder(data.item);
|
|
26
|
+
return { key, type: 'text', content: { text } };
|
|
27
|
+
};
|
|
28
|
+
const type = (data) => {
|
|
29
|
+
const key = getDeleteCellKey(data);
|
|
30
|
+
const { fileKey } = data.item.data;
|
|
31
|
+
const text = getFileType(fileKey);
|
|
32
|
+
return { key, type: 'text', content: { text } };
|
|
33
|
+
};
|
|
34
|
+
const size = (data) => {
|
|
35
|
+
const key = getDeleteCellKey(data);
|
|
36
|
+
const { size: value } = data.item.data;
|
|
37
|
+
const displayValue = getFileSize(value);
|
|
38
|
+
return { key, type: 'number', content: { value, displayValue } };
|
|
39
|
+
};
|
|
40
|
+
const status = (data) => {
|
|
41
|
+
const key = getDeleteCellKey(data);
|
|
42
|
+
const { item: { status }, props: { displayText }, } = data;
|
|
43
|
+
const statusLabelKey = STATUS_LABELS[status];
|
|
44
|
+
const text = isDeleteViewDisplayTextKey(statusLabelKey)
|
|
45
|
+
? displayText[statusLabelKey]
|
|
46
|
+
: '';
|
|
47
|
+
return { key, type: 'text', content: { text } };
|
|
48
|
+
};
|
|
49
|
+
const cancel = (data) => {
|
|
50
|
+
const key = getDeleteCellKey(data);
|
|
51
|
+
const content = getCopyOrDeleteCancelCellContent(data);
|
|
52
|
+
return { key, type: 'button', content };
|
|
53
|
+
};
|
|
54
|
+
const DELETE_CELL_RESOLVERS = {
|
|
55
|
+
name,
|
|
56
|
+
folder,
|
|
57
|
+
type,
|
|
58
|
+
size,
|
|
59
|
+
status,
|
|
60
|
+
cancel,
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
*
|
|
64
|
+
* non-upload view tables do not include "progress" headers but include here to
|
|
65
|
+
* keep TS happy as "progress" headers were included in display text interfaces
|
|
66
|
+
* and cannot be removed from the tables without a breaking change
|
|
67
|
+
*/
|
|
68
|
+
progress: noop,
|
|
69
|
+
};
|
|
70
|
+
const DELETE_TABLE_RESOLVERS = {
|
|
71
|
+
getCell: (data) => DELETE_CELL_RESOLVERS[data.key](data),
|
|
72
|
+
getHeader: ({ key, props: { displayText } }) => {
|
|
73
|
+
const text = displayText[`tableColumn${capitalize(key)}Header`];
|
|
74
|
+
if (key === 'cancel') {
|
|
75
|
+
return { key, type: 'text', content: { text } };
|
|
76
|
+
}
|
|
77
|
+
return { key, type: 'sort', content: { label: text } };
|
|
78
|
+
},
|
|
79
|
+
getRowKey: ({ item }) => item.data.id,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS };
|