@strapi/upload 5.3.0 → 5.4.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/_chunks/{index-DCAQ4hHN.mjs → App-D1ayH-QS.mjs} +94 -87
- package/dist/_chunks/App-D1ayH-QS.mjs.map +1 -0
- package/dist/_chunks/{index-Bl2-6oC8.js → App-Dqqn78jO.js} +94 -87
- package/dist/_chunks/App-Dqqn78jO.js.map +1 -0
- package/dist/_chunks/{index-C_cWV2yS.mjs → ConfigureTheView-B2Syy3q5.mjs} +24 -23
- package/dist/_chunks/ConfigureTheView-B2Syy3q5.mjs.map +1 -0
- package/dist/_chunks/{index-BM9Ayh_r.js → ConfigureTheView-fwDgErsi.js} +42 -23
- package/dist/_chunks/ConfigureTheView-fwDgErsi.js.map +1 -0
- package/dist/_chunks/{index-BWIqjWzC.mjs → SettingsPage-BYC3ism8.mjs} +45 -43
- package/dist/_chunks/SettingsPage-BYC3ism8.mjs.map +1 -0
- package/dist/_chunks/{index-C1MSWEyZ.js → SettingsPage-oDEVs3XV.js} +61 -41
- package/dist/_chunks/SettingsPage-oDEVs3XV.js.map +1 -0
- package/dist/_chunks/{index-YwynuEzj.js → index-B7NW5XiM.js} +115 -211
- package/dist/_chunks/index-B7NW5XiM.js.map +1 -0
- package/dist/_chunks/{index-BwEfHu6y.mjs → index-Clesg6BA.mjs} +138 -233
- package/dist/_chunks/index-Clesg6BA.mjs.map +1 -0
- package/dist/admin/index.js +2 -2
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/AssetCard/AssetCardBase.d.ts +1 -1
- package/dist/admin/src/components/AssetCard/UploadingAssetCard.d.ts +1 -1
- package/dist/admin/src/components/AssetCard/VideoPreview.d.ts +1 -1
- package/dist/admin/src/components/AssetDialog/BrowseStep/{index.d.ts → BrowseStep.d.ts} +1 -1
- package/dist/admin/src/components/AssetDialog/BrowseStep/PageSize.d.ts +2 -2
- package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/Pagination.d.ts +4 -0
- package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/PaginationFooter.d.ts +9 -0
- package/dist/admin/src/components/AssetDialog/BrowseStep/SearchAsset/{index.d.ts → SearchAsset.d.ts} +2 -2
- package/dist/admin/src/components/AssetGridList/{index.d.ts → AssetGridList.d.ts} +1 -2
- package/dist/admin/src/components/Breadcrumbs/Breadcrumbs.d.ts +1 -2
- package/dist/admin/src/components/EditFolderDialog/EditFolderDialog.d.ts +3 -1
- package/dist/admin/src/components/EditFolderDialog/RemoveFolderDialog.d.ts +1 -1
- package/dist/admin/src/components/FilterList/{index.d.ts → FilterList.d.ts} +3 -3
- package/dist/admin/src/components/FilterList/FilterTag.d.ts +3 -3
- package/dist/admin/src/components/FilterPopover/{index.d.ts → FilterPopover.d.ts} +3 -3
- package/dist/admin/src/components/FilterPopover/FilterValueInput.d.ts +2 -2
- package/dist/admin/src/components/FilterPopover/utils/getFilterList.d.ts +2 -2
- package/dist/admin/src/components/FolderGridList/FolderGridList.d.ts +1 -2
- package/dist/admin/src/components/MediaLibraryDialog/{index.d.ts → MediaLibraryDialog.d.ts} +1 -2
- package/dist/admin/src/components/MediaLibraryInput/{index.d.ts → MediaLibraryInput.d.ts} +2 -2
- package/dist/admin/src/components/SelectTree/Option.d.ts +2 -2
- package/dist/admin/src/components/SelectTree/SelectTree.d.ts +2 -3
- package/dist/admin/src/components/SelectTree/utils/flattenTree.d.ts +1 -1
- package/dist/admin/src/components/SelectTree/utils/getOpenValues.d.ts +2 -2
- package/dist/admin/src/components/SelectTree/utils/getValuesToClose.d.ts +2 -2
- package/dist/admin/src/components/SortPicker/{index.d.ts → SortPicker.d.ts} +2 -2
- package/dist/admin/src/components/UploadAssetDialog/PendingAssetStep/PendingAssetStep.d.ts +1 -1
- package/dist/admin/src/components/UploadAssetDialog/UploadAssetDialog.d.ts +1 -1
- package/dist/admin/src/{newConstants.d.ts → constants.d.ts} +1 -0
- package/dist/admin/src/hooks/useEditAsset.d.ts +4 -4
- package/dist/admin/src/hooks/useEditFolder.d.ts +4 -4
- package/dist/admin/src/hooks/useFolderStructure.d.ts +1 -1
- package/dist/admin/src/hooks/useModalQueryParams.d.ts +1 -2
- package/dist/admin/src/hooks/useSelectionState.d.ts +1 -1
- package/dist/admin/src/hooks/useUpload.d.ts +1 -1
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App/App.d.ts +1 -0
- package/dist/admin/src/pages/App/ConfigureTheView/ConfigureTheView.d.ts +6 -0
- package/dist/admin/src/pages/App/ConfigureTheView/components/Settings.d.ts +13 -0
- package/dist/admin/src/pages/App/ConfigureTheView/state/actionTypes.d.ts +2 -0
- package/dist/admin/src/pages/App/ConfigureTheView/state/actions.d.ts +12 -0
- package/dist/admin/src/pages/App/ConfigureTheView/state/init.d.ts +8 -0
- package/dist/admin/src/pages/App/ConfigureTheView/state/reducer.d.ts +15 -0
- package/dist/admin/src/pages/App/MediaLibrary/MediaLibrary.d.ts +1 -0
- package/dist/admin/src/pages/App/MediaLibrary/components/BulkActions.d.ts +15 -0
- package/dist/admin/src/pages/App/MediaLibrary/components/BulkDeleteButton.d.ts +7 -0
- package/dist/admin/src/pages/App/MediaLibrary/components/BulkMoveButton.d.ts +15 -0
- package/dist/admin/src/pages/App/MediaLibrary/components/EmptyOrNoPermissions.d.ts +7 -0
- package/dist/admin/src/pages/App/MediaLibrary/components/Filters.d.ts +1 -0
- package/dist/admin/src/pages/App/MediaLibrary/components/Header.d.ts +22 -0
- package/dist/admin/src/pages/App/components/BulkActions.d.ts +15 -0
- package/dist/admin/src/pages/App/components/BulkDeleteButton.d.ts +10 -0
- package/dist/admin/src/pages/App/components/BulkMoveButton.d.ts +15 -0
- package/dist/admin/src/pages/App/components/EmptyOrNoPermissions.d.ts +8 -0
- package/dist/admin/src/pages/App/components/Filters.d.ts +1 -0
- package/dist/admin/src/pages/App/components/Header.d.ts +13 -0
- package/dist/admin/src/pages/SettingsPage/SettingsPage.d.ts +2 -0
- package/dist/admin/src/pages/SettingsPage/init.d.ts +2 -0
- package/dist/admin/src/pages/SettingsPage/reducer.d.ts +27 -0
- package/dist/admin/src/pluginId.d.ts +0 -1
- package/dist/admin/src/utils/getBreadcrumbDataML.d.ts +1 -1
- package/dist/admin/src/utils/rawFileToAsset.d.ts +2 -2
- package/dist/admin/src/utils/toSingularTypes.d.ts +0 -1
- package/dist/admin/src/utils/typeFromMime.d.ts +1 -1
- package/dist/admin/src/utils/urlsToAssets.d.ts +2 -2
- package/dist/shared/contracts/settings.d.ts +3 -2
- package/package.json +8 -8
- package/dist/_chunks/index-BM9Ayh_r.js.map +0 -1
- package/dist/_chunks/index-BWIqjWzC.mjs.map +0 -1
- package/dist/_chunks/index-Bl2-6oC8.js.map +0 -1
- package/dist/_chunks/index-BwEfHu6y.mjs.map +0 -1
- package/dist/_chunks/index-C1MSWEyZ.js.map +0 -1
- package/dist/_chunks/index-C_cWV2yS.mjs.map +0 -1
- package/dist/_chunks/index-DCAQ4hHN.mjs.map +0 -1
- package/dist/_chunks/index-YwynuEzj.js.map +0 -1
- package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/PaginationContext.d.ts +0 -9
- package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/components.d.ts +0 -15
- package/dist/admin/src/components/AssetDialog/BrowseStep/PaginationFooter/index.d.ts +0 -9
- package/dist/admin/src/components/Breadcrumbs/index.d.ts +0 -1
- package/dist/admin/src/components/BulkMoveDialog/index.d.ts +0 -1
- package/dist/admin/src/components/ContextInfo/index.d.ts +0 -1
- package/dist/admin/src/components/EditFolderDialog/ModalHeader/index.d.ts +0 -2
- package/dist/admin/src/components/EditFolderDialog/index.d.ts +0 -1
- package/dist/admin/src/components/FolderCard/FolderCard/index.d.ts +0 -1
- package/dist/admin/src/components/FolderCard/FolderCardBody/index.d.ts +0 -1
- package/dist/admin/src/components/FolderCard/FolderCardCheckbox/index.d.ts +0 -1
- package/dist/admin/src/components/FolderCard/index.d.ts +0 -4
- package/dist/admin/src/components/FolderGridList/index.d.ts +0 -1
- package/dist/admin/src/components/SelectTree/index.d.ts +0 -2
- /package/dist/admin/src/components/AssetDialog/{index.d.ts → AssetDialog.d.ts} +0 -0
- /package/dist/admin/src/components/AssetDialog/SelectedStep/{index.d.ts → SelectedStep.d.ts} +0 -0
- /package/dist/admin/src/components/CopyLinkButton/{index.d.ts → CopyLinkButton.d.ts} +0 -0
- /package/dist/admin/src/components/EditAssetDialog/{index.d.ts → EditAssetContent.d.ts} +0 -0
- /package/dist/admin/src/components/EditAssetDialog/PreviewBox/{index.d.ts → PreviewBox.d.ts} +0 -0
- /package/dist/admin/src/components/EditAssetDialog/PreviewBox/{components.d.ts → PreviewComponents.d.ts} +0 -0
- /package/dist/admin/src/components/EmptyAssets/{index.d.ts → EmptyAssets.d.ts} +0 -0
- /package/dist/admin/src/components/FolderCard/FolderCardBodyAction/{index.d.ts → FolderCardBodyAction.d.ts} +0 -0
- /package/dist/admin/src/components/TableList/{index.d.ts → TableList.d.ts} +0 -0
- /package/dist/admin/src/components/UploadProgress/{index.d.ts → UploadProgress.d.ts} +0 -0
- /package/dist/admin/src/hooks/utils/{rename-keys.d.ts → renameKeys.d.ts} +0 -0
|
@@ -18,10 +18,9 @@ import Cropper from "cropperjs";
|
|
|
18
18
|
import "cropperjs/dist/cropper.css";
|
|
19
19
|
import isEmpty from "lodash/isEmpty";
|
|
20
20
|
import { useDrop, useDrag } from "react-dnd";
|
|
21
|
-
import { useLocation,
|
|
21
|
+
import { useLocation, Link as Link$1, NavLink } from "react-router-dom";
|
|
22
22
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
23
23
|
import parseISO from "date-fns/parseISO";
|
|
24
|
-
import PropTypes from "prop-types";
|
|
25
24
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
26
25
|
const v = glob[path];
|
|
27
26
|
if (v) {
|
|
@@ -32,7 +31,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
|
32
31
|
});
|
|
33
32
|
};
|
|
34
33
|
const name$1 = "@strapi/upload";
|
|
35
|
-
const version = "5.
|
|
34
|
+
const version = "5.4.0";
|
|
36
35
|
const description = "Makes it easy to upload images and files to your Strapi Application.";
|
|
37
36
|
const license = "SEE LICENSE IN LICENSE";
|
|
38
37
|
const author = {
|
|
@@ -50,7 +49,7 @@ const maintainers = [
|
|
|
50
49
|
const exports = {
|
|
51
50
|
"./strapi-admin": {
|
|
52
51
|
types: "./dist/admin/src/index.d.ts",
|
|
53
|
-
source: "./admin/src/index.
|
|
52
|
+
source: "./admin/src/index.ts",
|
|
54
53
|
"import": "./dist/admin/index.mjs",
|
|
55
54
|
require: "./dist/admin/index.js",
|
|
56
55
|
"default": "./dist/admin/index.js"
|
|
@@ -90,8 +89,8 @@ const scripts = {
|
|
|
90
89
|
const dependencies = {
|
|
91
90
|
"@strapi/design-system": "2.0.0-rc.12",
|
|
92
91
|
"@strapi/icons": "2.0.0-rc.12",
|
|
93
|
-
"@strapi/provider-upload-local": "
|
|
94
|
-
"@strapi/utils": "
|
|
92
|
+
"@strapi/provider-upload-local": "5.4.0",
|
|
93
|
+
"@strapi/utils": "5.4.0",
|
|
95
94
|
"byte-size": "8.1.1",
|
|
96
95
|
cropperjs: "1.6.1",
|
|
97
96
|
"date-fns": "2.30.0",
|
|
@@ -113,9 +112,9 @@ const dependencies = {
|
|
|
113
112
|
yup: "0.32.9"
|
|
114
113
|
};
|
|
115
114
|
const devDependencies = {
|
|
116
|
-
"@strapi/admin": "
|
|
115
|
+
"@strapi/admin": "5.4.0",
|
|
117
116
|
"@strapi/pack-up": "5.0.0",
|
|
118
|
-
"@strapi/types": "
|
|
117
|
+
"@strapi/types": "5.4.0",
|
|
119
118
|
"@testing-library/dom": "10.1.0",
|
|
120
119
|
"@testing-library/react": "15.0.7",
|
|
121
120
|
"@testing-library/user-event": "14.5.2",
|
|
@@ -134,7 +133,7 @@ const devDependencies = {
|
|
|
134
133
|
"styled-components": "6.1.8"
|
|
135
134
|
};
|
|
136
135
|
const peerDependencies = {
|
|
137
|
-
"@strapi/admin": "^5.0.0
|
|
136
|
+
"@strapi/admin": "^5.0.0",
|
|
138
137
|
react: "^17.0.0 || ^18.0.0",
|
|
139
138
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
140
139
|
"react-router-dom": "^6.0.0",
|
|
@@ -151,6 +150,7 @@ const strapi = {
|
|
|
151
150
|
required: true,
|
|
152
151
|
kind: "plugin"
|
|
153
152
|
};
|
|
153
|
+
const gitHead = "7d785703f52464577d077c4618cbe68b44f8a9cd";
|
|
154
154
|
const pluginPkg = {
|
|
155
155
|
name: name$1,
|
|
156
156
|
version,
|
|
@@ -165,7 +165,8 @@ const pluginPkg = {
|
|
|
165
165
|
devDependencies,
|
|
166
166
|
peerDependencies,
|
|
167
167
|
engines,
|
|
168
|
-
strapi
|
|
168
|
+
strapi,
|
|
169
|
+
gitHead
|
|
169
170
|
};
|
|
170
171
|
const pluginId = pluginPkg.name.replace(/^@strapi\//i, "");
|
|
171
172
|
const useAssets = ({ skipWhen = false, query = {} } = {}) => {
|
|
@@ -480,7 +481,7 @@ function getAPIInnerErrors(error, { getTrad: getTrad2 }) {
|
|
|
480
481
|
}
|
|
481
482
|
const getTrad = (id) => `${pluginId}.${id}`;
|
|
482
483
|
const getBreadcrumbDataCM = (folder) => {
|
|
483
|
-
|
|
484
|
+
const data = [
|
|
484
485
|
{
|
|
485
486
|
id: null,
|
|
486
487
|
label: { id: getTrad("plugin.name"), defaultMessage: "Media Library" }
|
|
@@ -532,7 +533,7 @@ const getFolderParents = (folders, currentFolderId) => {
|
|
|
532
533
|
}
|
|
533
534
|
let { parent } = currentFolder;
|
|
534
535
|
while (parent !== void 0) {
|
|
535
|
-
|
|
536
|
+
const parentToStore = flatFolders.find(({ value }) => value === parent);
|
|
536
537
|
parents.push({ id: parentToStore?.value, label: parentToStore?.label });
|
|
537
538
|
parent = parentToStore?.parent;
|
|
538
539
|
}
|
|
@@ -545,9 +546,9 @@ const move = (array, oldIndex, newIndex) => {
|
|
|
545
546
|
array.splice(newIndex, 0, array.splice(oldIndex, 1)[0]);
|
|
546
547
|
return array;
|
|
547
548
|
};
|
|
548
|
-
const moveElement = (array,
|
|
549
|
-
const newIndex =
|
|
550
|
-
return move(array,
|
|
549
|
+
const moveElement = (array, index, offset) => {
|
|
550
|
+
const newIndex = index + offset;
|
|
551
|
+
return move(array, index, newIndex);
|
|
551
552
|
};
|
|
552
553
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
553
554
|
if (!pluginId2) {
|
|
@@ -666,7 +667,7 @@ var AssetSource = /* @__PURE__ */ ((AssetSource2) => {
|
|
|
666
667
|
AssetSource2["Computer"] = "computer";
|
|
667
668
|
return AssetSource2;
|
|
668
669
|
})(AssetSource || {});
|
|
669
|
-
const PERMISSIONS
|
|
670
|
+
const PERMISSIONS = {
|
|
670
671
|
// This permission regards the main component (App) and is used to tell
|
|
671
672
|
// If the plugin link should be displayed in the menu
|
|
672
673
|
// And also if the plugin is accessible. This use case is found when a user types the url of the
|
|
@@ -761,7 +762,7 @@ const tableHeaders = [
|
|
|
761
762
|
type: "date"
|
|
762
763
|
}
|
|
763
764
|
];
|
|
764
|
-
const sortOptions
|
|
765
|
+
const sortOptions = [
|
|
765
766
|
{ key: "sort.created_at_desc", value: "createdAt:DESC" },
|
|
766
767
|
{ key: "sort.created_at_asc", value: "createdAt:ASC" },
|
|
767
768
|
{ key: "sort.name_asc", value: "name:ASC" },
|
|
@@ -769,15 +770,16 @@ const sortOptions$1 = [
|
|
|
769
770
|
{ key: "sort.updated_at_desc", value: "updatedAt:DESC" },
|
|
770
771
|
{ key: "sort.updated_at_asc", value: "updatedAt:ASC" }
|
|
771
772
|
];
|
|
772
|
-
const
|
|
773
|
+
const pageSizes = [10, 20, 50, 100];
|
|
774
|
+
const localStorageKeys = {
|
|
773
775
|
modalView: `STRAPI_UPLOAD_MODAL_VIEW`,
|
|
774
776
|
view: `STRAPI_UPLOAD_LIBRARY_VIEW`
|
|
775
777
|
};
|
|
776
|
-
const viewOptions
|
|
778
|
+
const viewOptions = {
|
|
777
779
|
GRID: 0,
|
|
778
780
|
LIST: 1
|
|
779
781
|
};
|
|
780
|
-
const { main, ...restPermissions } = PERMISSIONS
|
|
782
|
+
const { main: _main, ...restPermissions } = PERMISSIONS;
|
|
781
783
|
const useMediaLibraryPermissions = () => {
|
|
782
784
|
const { allowedActions, isLoading } = useRBAC(restPermissions);
|
|
783
785
|
return { ...allowedActions, isLoading };
|
|
@@ -912,13 +914,13 @@ const useModalQueryParams = (initialState) => {
|
|
|
912
914
|
const useSelectionState = (keys, initialValue) => {
|
|
913
915
|
const [selections, setSelections] = React.useState(initialValue);
|
|
914
916
|
const selectOne = (selection) => {
|
|
915
|
-
const
|
|
917
|
+
const index = selections.findIndex(
|
|
916
918
|
(currentSelection) => keys.every((key) => currentSelection[key] === selection[key])
|
|
917
919
|
);
|
|
918
|
-
if (
|
|
920
|
+
if (index > -1) {
|
|
919
921
|
setSelections((prevSelected) => [
|
|
920
|
-
...prevSelected.slice(0,
|
|
921
|
-
...prevSelected.slice(
|
|
922
|
+
...prevSelected.slice(0, index),
|
|
923
|
+
...prevSelected.slice(index + 1)
|
|
922
924
|
]);
|
|
923
925
|
} else {
|
|
924
926
|
setSelections((prevSelected) => [...prevSelected, selection]);
|
|
@@ -932,10 +934,10 @@ const useSelectionState = (keys, initialValue) => {
|
|
|
932
934
|
}
|
|
933
935
|
};
|
|
934
936
|
const selectOnly = (nextSelection) => {
|
|
935
|
-
const
|
|
937
|
+
const index = selections.findIndex(
|
|
936
938
|
(currentSelection) => keys.every((key) => currentSelection[key] === nextSelection[key])
|
|
937
939
|
);
|
|
938
|
-
if (
|
|
940
|
+
if (index > -1) {
|
|
939
941
|
setSelections([]);
|
|
940
942
|
} else {
|
|
941
943
|
setSelections([nextSelection]);
|
|
@@ -1116,7 +1118,7 @@ const Option = ({ children, data, selectProps, ...props }) => {
|
|
|
1116
1118
|
] }) });
|
|
1117
1119
|
};
|
|
1118
1120
|
function getOpenValues(options, defaultValue = {}) {
|
|
1119
|
-
|
|
1121
|
+
const values = [];
|
|
1120
1122
|
const { value } = defaultValue;
|
|
1121
1123
|
const option = options.find((option2) => option2.value === value);
|
|
1122
1124
|
if (!option) {
|
|
@@ -1323,6 +1325,7 @@ const getSelectStyles = (theme, error) => {
|
|
|
1323
1325
|
paddingRight: theme.spaces[1],
|
|
1324
1326
|
paddingBottom: theme.spaces[1]
|
|
1325
1327
|
}),
|
|
1328
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1326
1329
|
option(base, state) {
|
|
1327
1330
|
let backgroundColor = base?.backgroundColor;
|
|
1328
1331
|
if (state.isFocused || state.isSelected) {
|
|
@@ -1842,7 +1845,7 @@ const PreviewBox = ({
|
|
|
1842
1845
|
nextAsset.mime,
|
|
1843
1846
|
nextAsset.updatedAt
|
|
1844
1847
|
);
|
|
1845
|
-
await upload({ name: file.name, rawFile: file }, asset.folder?.id);
|
|
1848
|
+
await upload({ name: file.name, rawFile: file }, asset.folder?.id ? asset.folder.id : null);
|
|
1846
1849
|
trackUsage("didCropFile", { duplicatedFile: true, location: trackedLocation });
|
|
1847
1850
|
setHasCropIntent(false);
|
|
1848
1851
|
onCropFinish();
|
|
@@ -1976,6 +1979,7 @@ const ReplaceMediaButton = ({
|
|
|
1976
1979
|
accept: acceptedMime,
|
|
1977
1980
|
type: "file",
|
|
1978
1981
|
name: "file",
|
|
1982
|
+
"data-testid": "file-input",
|
|
1979
1983
|
tabIndex: -1,
|
|
1980
1984
|
ref: inputRef,
|
|
1981
1985
|
onChange: handleChange,
|
|
@@ -2112,7 +2116,7 @@ const EditAssetContent = ({
|
|
|
2112
2116
|
id: getTrad("modal.file-details.size"),
|
|
2113
2117
|
defaultMessage: "Size"
|
|
2114
2118
|
}),
|
|
2115
|
-
value: formatBytes(asset?.size)
|
|
2119
|
+
value: formatBytes(asset?.size ? asset.size : 0)
|
|
2116
2120
|
},
|
|
2117
2121
|
{
|
|
2118
2122
|
label: formatMessage({
|
|
@@ -2126,7 +2130,7 @@ const EditAssetContent = ({
|
|
|
2126
2130
|
id: getTrad("modal.file-details.date"),
|
|
2127
2131
|
defaultMessage: "Date"
|
|
2128
2132
|
}),
|
|
2129
|
-
value: formatDate(new Date(asset?.createdAt))
|
|
2133
|
+
value: formatDate(new Date(asset?.createdAt ? asset.createdAt : ""))
|
|
2130
2134
|
},
|
|
2131
2135
|
{
|
|
2132
2136
|
label: formatMessage({
|
|
@@ -2140,7 +2144,7 @@ const EditAssetContent = ({
|
|
|
2140
2144
|
id: getTrad("modal.file-details.id"),
|
|
2141
2145
|
defaultMessage: "Asset ID"
|
|
2142
2146
|
}),
|
|
2143
|
-
value: asset?.id
|
|
2147
|
+
value: asset?.id ? asset.id : null
|
|
2144
2148
|
}
|
|
2145
2149
|
]
|
|
2146
2150
|
}
|
|
@@ -2237,13 +2241,13 @@ const EditAssetContent = ({
|
|
|
2237
2241
|
] }) })
|
|
2238
2242
|
] }) }),
|
|
2239
2243
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
2240
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => handleClose(values), variant: "tertiary", children: formatMessage({ id: "global.cancel", defaultMessage: "Cancel" }) }),
|
|
2244
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => handleClose({ ...values }), variant: "tertiary", children: formatMessage({ id: "global.cancel", defaultMessage: "Cancel" }) }),
|
|
2241
2245
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
2242
2246
|
/* @__PURE__ */ jsx(
|
|
2243
2247
|
ReplaceMediaButton,
|
|
2244
2248
|
{
|
|
2245
2249
|
onSelectMedia: setReplacementFile,
|
|
2246
|
-
acceptedMime: asset?.mime,
|
|
2250
|
+
acceptedMime: asset?.mime ?? "",
|
|
2247
2251
|
disabled: formDisabled,
|
|
2248
2252
|
trackedLocation
|
|
2249
2253
|
}
|
|
@@ -2793,7 +2797,6 @@ const VideoPreview = ({
|
|
|
2793
2797
|
onLoadDuration = () => {
|
|
2794
2798
|
},
|
|
2795
2799
|
alt,
|
|
2796
|
-
size = "M",
|
|
2797
2800
|
...props
|
|
2798
2801
|
}) => {
|
|
2799
2802
|
const handleTimeUpdate = (e) => {
|
|
@@ -2897,7 +2900,7 @@ const AssetCard = ({
|
|
|
2897
2900
|
}
|
|
2898
2901
|
return /* @__PURE__ */ jsx(DocAssetCard, { ...commonAssetCardProps });
|
|
2899
2902
|
};
|
|
2900
|
-
const Draggable = ({ children, id, index
|
|
2903
|
+
const Draggable = ({ children, id, index, moveItem }) => {
|
|
2901
2904
|
const ref = React.useRef(null);
|
|
2902
2905
|
const [, drop] = useDrop({
|
|
2903
2906
|
accept: "draggable",
|
|
@@ -2906,15 +2909,15 @@ const Draggable = ({ children, id, index: index2, moveItem }) => {
|
|
|
2906
2909
|
return;
|
|
2907
2910
|
}
|
|
2908
2911
|
if (hoveredOverItem.id !== id) {
|
|
2909
|
-
moveItem(hoveredOverItem.index,
|
|
2910
|
-
hoveredOverItem.index =
|
|
2912
|
+
moveItem(hoveredOverItem.index, index);
|
|
2913
|
+
hoveredOverItem.index = index;
|
|
2911
2914
|
}
|
|
2912
2915
|
}
|
|
2913
2916
|
});
|
|
2914
2917
|
const [{ isDragging }, drag] = useDrag({
|
|
2915
2918
|
type: "draggable",
|
|
2916
2919
|
item() {
|
|
2917
|
-
return { index
|
|
2920
|
+
return { index, id };
|
|
2918
2921
|
},
|
|
2919
2922
|
collect: (monitor) => ({
|
|
2920
2923
|
isDragging: monitor.isDragging()
|
|
@@ -2936,10 +2939,10 @@ const AssetGridList = ({
|
|
|
2936
2939
|
}) => {
|
|
2937
2940
|
return /* @__PURE__ */ jsxs(KeyboardNavigable, { tagName: "article", children: [
|
|
2938
2941
|
title && /* @__PURE__ */ jsx(Box, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "delta", fontWeight: "semiBold", children: title }) }),
|
|
2939
|
-
/* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: assets.map((asset,
|
|
2942
|
+
/* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: assets.map((asset, index) => {
|
|
2940
2943
|
const isSelected = !!selectedAssets.find((currentAsset) => currentAsset.id === asset.id);
|
|
2941
2944
|
if (onReorderAsset) {
|
|
2942
|
-
return /* @__PURE__ */ jsx(Grid.Item, { col: 3, height: "100%", children: /* @__PURE__ */ jsx(Draggable, { index
|
|
2945
|
+
return /* @__PURE__ */ jsx(Grid.Item, { col: 3, height: "100%", children: /* @__PURE__ */ jsx(Draggable, { index, moveItem: onReorderAsset, id: asset.id, children: /* @__PURE__ */ jsx(
|
|
2943
2946
|
AssetCard,
|
|
2944
2947
|
{
|
|
2945
2948
|
allowedTypes,
|
|
@@ -3025,12 +3028,12 @@ const Breadcrumbs = ({
|
|
|
3025
3028
|
...props
|
|
3026
3029
|
}) => {
|
|
3027
3030
|
const { formatMessage } = useIntl();
|
|
3028
|
-
return /* @__PURE__ */ jsx(Breadcrumbs$1, { ...props, children: breadcrumbs.map((crumb,
|
|
3031
|
+
return /* @__PURE__ */ jsx(Breadcrumbs$1, { ...props, children: breadcrumbs.map((crumb, index) => {
|
|
3029
3032
|
if (Array.isArray(crumb)) {
|
|
3030
3033
|
return /* @__PURE__ */ jsx(
|
|
3031
3034
|
CrumbSimpleMenuAsync,
|
|
3032
3035
|
{
|
|
3033
|
-
parentsToOmit: [...breadcrumbs].splice(
|
|
3036
|
+
parentsToOmit: [...breadcrumbs].splice(index + 1, breadcrumbs.length - 1).map((parent) => parent.id),
|
|
3034
3037
|
currentFolderId,
|
|
3035
3038
|
onChangeFolder
|
|
3036
3039
|
},
|
|
@@ -3043,7 +3046,6 @@ const Breadcrumbs = ({
|
|
|
3043
3046
|
return /* @__PURE__ */ jsx(
|
|
3044
3047
|
CrumbLink,
|
|
3045
3048
|
{
|
|
3046
|
-
tag: "button",
|
|
3047
3049
|
type: "button",
|
|
3048
3050
|
onClick: () => onChangeFolder(crumb.id, crumb.path),
|
|
3049
3051
|
children: typeof crumb.label !== "string" && crumb.label?.id ? formatMessage(crumb.label) : crumb.label
|
|
@@ -3054,8 +3056,8 @@ const Breadcrumbs = ({
|
|
|
3054
3056
|
return /* @__PURE__ */ jsx(
|
|
3055
3057
|
CrumbLink,
|
|
3056
3058
|
{
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
+
to: crumb.href,
|
|
3060
|
+
tag: Link$1,
|
|
3059
3061
|
children: typeof crumb.label !== "string" && crumb.label?.id ? formatMessage(crumb.label) : crumb.label
|
|
3060
3062
|
},
|
|
3061
3063
|
`breadcrumb-${crumb?.id ?? "root"}`
|
|
@@ -3064,7 +3066,7 @@ const Breadcrumbs = ({
|
|
|
3064
3066
|
return /* @__PURE__ */ jsx(
|
|
3065
3067
|
Crumb,
|
|
3066
3068
|
{
|
|
3067
|
-
isCurrent:
|
|
3069
|
+
isCurrent: index + 1 === breadcrumbs.length,
|
|
3068
3070
|
children: typeof crumb.label !== "string" && crumb.label?.id ? formatMessage(crumb.label) : crumb.label
|
|
3069
3071
|
},
|
|
3070
3072
|
`breadcrumb-${crumb?.id ?? "root"}`
|
|
@@ -3147,7 +3149,6 @@ const Card = styled(Box)`
|
|
|
3147
3149
|
const FolderCard = React.forwardRef(
|
|
3148
3150
|
({
|
|
3149
3151
|
children,
|
|
3150
|
-
id,
|
|
3151
3152
|
startAction = null,
|
|
3152
3153
|
cardActions = null,
|
|
3153
3154
|
ariaLabel,
|
|
@@ -3215,6 +3216,7 @@ const FolderCardBody = (props) => {
|
|
|
3215
3216
|
{
|
|
3216
3217
|
...props,
|
|
3217
3218
|
id: `${id}-title`,
|
|
3219
|
+
"data-testid": `${id}-title`,
|
|
3218
3220
|
alignItems: "flex-start",
|
|
3219
3221
|
direction: "column",
|
|
3220
3222
|
maxWidth: "100%",
|
|
@@ -3269,7 +3271,7 @@ const SortPicker = ({ onChangeSort, value }) => {
|
|
|
3269
3271
|
id: getTrad("sort.label"),
|
|
3270
3272
|
defaultMessage: "Sort by"
|
|
3271
3273
|
}),
|
|
3272
|
-
children: sortOptions
|
|
3274
|
+
children: sortOptions.map((filter) => /* @__PURE__ */ jsx(SingleSelectOption, { value: filter.value, children: formatMessage({ id: getTrad(filter.key), defaultMessage: `${filter.value}` }) }, filter.key))
|
|
3273
3275
|
}
|
|
3274
3276
|
);
|
|
3275
3277
|
};
|
|
@@ -3288,6 +3290,7 @@ const VideoPreviewWrapper$1 = styled(Box)`
|
|
|
3288
3290
|
}
|
|
3289
3291
|
`;
|
|
3290
3292
|
const PreviewCell = ({ type, content }) => {
|
|
3293
|
+
const { formatMessage } = useIntl();
|
|
3291
3294
|
if (type === "folder") {
|
|
3292
3295
|
return /* @__PURE__ */ jsx(
|
|
3293
3296
|
Flex,
|
|
@@ -3297,7 +3300,18 @@ const PreviewCell = ({ type, content }) => {
|
|
|
3297
3300
|
width: "3.2rem",
|
|
3298
3301
|
height: "3.2rem",
|
|
3299
3302
|
borderRadius: "50%",
|
|
3300
|
-
children: /* @__PURE__ */ jsx(
|
|
3303
|
+
children: /* @__PURE__ */ jsx(
|
|
3304
|
+
Folder,
|
|
3305
|
+
{
|
|
3306
|
+
"aria-label": formatMessage({
|
|
3307
|
+
id: getTrad("header.actions.add-assets.folder"),
|
|
3308
|
+
defaultMessage: "folder"
|
|
3309
|
+
}),
|
|
3310
|
+
fill: "secondary500",
|
|
3311
|
+
width: "1.6rem",
|
|
3312
|
+
height: "1.6rem"
|
|
3313
|
+
}
|
|
3314
|
+
)
|
|
3301
3315
|
}
|
|
3302
3316
|
);
|
|
3303
3317
|
}
|
|
@@ -3694,7 +3708,9 @@ const FilterValueInput = ({
|
|
|
3694
3708
|
}
|
|
3695
3709
|
);
|
|
3696
3710
|
};
|
|
3697
|
-
const getFilterList = ({
|
|
3711
|
+
const getFilterList = ({
|
|
3712
|
+
fieldSchema: { type: fieldType, mainField }
|
|
3713
|
+
}) => {
|
|
3698
3714
|
const type = mainField?.schema.type ? mainField.schema.type : fieldType;
|
|
3699
3715
|
switch (type) {
|
|
3700
3716
|
case "enumeration": {
|
|
@@ -3789,7 +3805,12 @@ const getFilterList = ({ fieldSchema: { type: fieldType, mainField } }) => {
|
|
|
3789
3805
|
];
|
|
3790
3806
|
}
|
|
3791
3807
|
};
|
|
3792
|
-
const FilterPopover = ({
|
|
3808
|
+
const FilterPopover = ({
|
|
3809
|
+
displayedFilters: displayedFilters2,
|
|
3810
|
+
filters,
|
|
3811
|
+
onSubmit,
|
|
3812
|
+
onToggle
|
|
3813
|
+
}) => {
|
|
3793
3814
|
const { formatMessage } = useIntl();
|
|
3794
3815
|
const [modifiedData, setModifiedData] = React.useState({
|
|
3795
3816
|
name: "createdAt",
|
|
@@ -3891,7 +3912,7 @@ const FilterPopover = ({ displayedFilters: displayedFilters2, filters, onSubmit,
|
|
|
3891
3912
|
return filter.mime?.[oppositeFilter] === modifiedData.value;
|
|
3892
3913
|
});
|
|
3893
3914
|
const hasOppositeFilter = oppositeFilterIndex !== -1;
|
|
3894
|
-
|
|
3915
|
+
const filterToAdd = { [modifiedData.name]: { [modifiedData.filter]: modifiedData.value } };
|
|
3895
3916
|
if (!hasOppositeFilter) {
|
|
3896
3917
|
const nextFilters = [...filtersWithoutFile, filterToAdd];
|
|
3897
3918
|
onSubmit(nextFilters);
|
|
@@ -3911,7 +3932,7 @@ const FilterPopover = ({ displayedFilters: displayedFilters2, filters, onSubmit,
|
|
|
3911
3932
|
return filter[modifiedDataName] && filter[modifiedDataName]?.[modifiedDataName] === encodedValue;
|
|
3912
3933
|
}) !== void 0;
|
|
3913
3934
|
if (!hasFilter) {
|
|
3914
|
-
|
|
3935
|
+
const filterToAdd = { [modifiedData.name]: { [modifiedData.filter]: encodedValue } };
|
|
3915
3936
|
const nextFilters = [...filters, filterToAdd];
|
|
3916
3937
|
onSubmit(nextFilters);
|
|
3917
3938
|
}
|
|
@@ -4020,6 +4041,15 @@ const PageSize = ({ onChangePageSize, pageSize }) => {
|
|
|
4020
4041
|
};
|
|
4021
4042
|
const PaginationContext = React.createContext({ activePage: 1, pageCount: 1 });
|
|
4022
4043
|
const usePagination = () => React.useContext(PaginationContext);
|
|
4044
|
+
const Pagination = ({
|
|
4045
|
+
children,
|
|
4046
|
+
activePage,
|
|
4047
|
+
pageCount,
|
|
4048
|
+
label = "pagination"
|
|
4049
|
+
}) => {
|
|
4050
|
+
const paginationValue = React.useMemo(() => ({ activePage, pageCount }), [activePage, pageCount]);
|
|
4051
|
+
return /* @__PURE__ */ jsx(PaginationContext.Provider, { value: paginationValue, children: /* @__PURE__ */ jsx(Box, { tag: "nav", "aria-label": label, children: /* @__PURE__ */ jsx(Flex, { tag: "ul", gap: 1, children }) }) });
|
|
4052
|
+
};
|
|
4023
4053
|
const PaginationText = styled(Typography)`
|
|
4024
4054
|
line-height: revert;
|
|
4025
4055
|
`;
|
|
@@ -4123,15 +4153,6 @@ const Dots = ({ children, ...props }) => /* @__PURE__ */ jsx("li", { children: /
|
|
|
4123
4153
|
/* @__PURE__ */ jsx(VisuallyHidden, { children }),
|
|
4124
4154
|
/* @__PURE__ */ jsx(PaginationText, { "aria-hidden": true, small: true, children: "…" })
|
|
4125
4155
|
] }) });
|
|
4126
|
-
const Pagination = ({
|
|
4127
|
-
children,
|
|
4128
|
-
activePage,
|
|
4129
|
-
pageCount,
|
|
4130
|
-
label = "pagination"
|
|
4131
|
-
}) => {
|
|
4132
|
-
const paginationValue = React.useMemo(() => ({ activePage, pageCount }), [activePage, pageCount]);
|
|
4133
|
-
return /* @__PURE__ */ jsx(PaginationContext.Provider, { value: paginationValue, children: /* @__PURE__ */ jsx(Box, { tag: "nav", "aria-label": label, children: /* @__PURE__ */ jsx(Flex, { tag: "ul", gap: 1, children }) }) });
|
|
4134
|
-
};
|
|
4135
4156
|
const PaginationFooter = ({
|
|
4136
4157
|
activePage,
|
|
4137
4158
|
onChangePage,
|
|
@@ -4176,7 +4197,7 @@ const PaginationFooter = ({
|
|
|
4176
4197
|
] });
|
|
4177
4198
|
}
|
|
4178
4199
|
let firstLinksToCreate = [];
|
|
4179
|
-
|
|
4200
|
+
const lastLinks = [];
|
|
4180
4201
|
let lastLinksToCreate = [];
|
|
4181
4202
|
const middleLinks = [];
|
|
4182
4203
|
if (pageCount > 1) {
|
|
@@ -4310,6 +4331,7 @@ const SearchAsset = ({ onChangeSearch, queryValue = null }) => {
|
|
|
4310
4331
|
id: getTrad("search.clear.label"),
|
|
4311
4332
|
defaultMessage: "Clear the search"
|
|
4312
4333
|
}),
|
|
4334
|
+
"aria-label": "search",
|
|
4313
4335
|
size: "S",
|
|
4314
4336
|
value,
|
|
4315
4337
|
placeholder: formatMessage({
|
|
@@ -4361,8 +4383,8 @@ const BrowseStep = ({
|
|
|
4361
4383
|
selectedAssets
|
|
4362
4384
|
}) => {
|
|
4363
4385
|
const { formatMessage } = useIntl();
|
|
4364
|
-
const [view, setView] = usePersistentState(localStorageKeys
|
|
4365
|
-
const isGridView = view === viewOptions
|
|
4386
|
+
const [view, setView] = usePersistentState(localStorageKeys.modalView, viewOptions.GRID);
|
|
4387
|
+
const isGridView = view === viewOptions.GRID;
|
|
4366
4388
|
const { data: currentFolder, isLoading: isCurrentFolderLoading } = useFolder(
|
|
4367
4389
|
queryObject?.folder,
|
|
4368
4390
|
{
|
|
@@ -4384,7 +4406,7 @@ const BrowseStep = ({
|
|
|
4384
4406
|
(asset) => selectedAssets.findIndex((currAsset) => currAsset.id === asset.id) !== -1
|
|
4385
4407
|
);
|
|
4386
4408
|
const isSearching = !!queryObject?._q;
|
|
4387
|
-
const isFiltering = queryObject?.filters?.$and?.length > 0;
|
|
4409
|
+
const isFiltering = !!queryObject?.filters?.$and?.length && queryObject.filters.$and.length > 0;
|
|
4388
4410
|
const isSearchingOrFiltering = isSearching || isFiltering;
|
|
4389
4411
|
const assetCount = assets.length;
|
|
4390
4412
|
const folderCount = folders.length;
|
|
@@ -4437,18 +4459,17 @@ const BrowseStep = ({
|
|
|
4437
4459
|
id: "view-switch.grid",
|
|
4438
4460
|
defaultMessage: "Grid View"
|
|
4439
4461
|
}),
|
|
4440
|
-
onClick: () => setView(isGridView ? viewOptions
|
|
4462
|
+
onClick: () => setView(isGridView ? viewOptions.LIST : viewOptions.GRID),
|
|
4441
4463
|
children: isGridView ? /* @__PURE__ */ jsx(List, {}) : /* @__PURE__ */ jsx(GridFour, {})
|
|
4442
4464
|
}
|
|
4443
4465
|
) }),
|
|
4444
4466
|
/* @__PURE__ */ jsx(SearchAsset, { onChangeSearch, queryValue: queryObject._q || "" })
|
|
4445
4467
|
] })
|
|
4446
4468
|
] }) }),
|
|
4447
|
-
canRead && breadcrumbs?.length > 0 && currentFolder && /* @__PURE__ */ jsx(Box, { paddingTop: 3, children: /* @__PURE__ */ jsx(
|
|
4469
|
+
canRead && breadcrumbs?.length && breadcrumbs.length > 0 && currentFolder && /* @__PURE__ */ jsx(Box, { paddingTop: 3, children: /* @__PURE__ */ jsx(
|
|
4448
4470
|
Breadcrumbs,
|
|
4449
4471
|
{
|
|
4450
4472
|
onChangeFolder,
|
|
4451
|
-
tag: "nav",
|
|
4452
4473
|
label: formatMessage({
|
|
4453
4474
|
id: getTrad("header.breadcrumbs.nav.label"),
|
|
4454
4475
|
defaultMessage: "Folders navigation"
|
|
@@ -4637,7 +4658,7 @@ const SelectedStep = ({
|
|
|
4637
4658
|
}) => {
|
|
4638
4659
|
const { formatMessage } = useIntl();
|
|
4639
4660
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
4640
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 0, children: [
|
|
4661
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 0, direction: "column", alignItems: "start", children: [
|
|
4641
4662
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
4642
4663
|
{
|
|
4643
4664
|
id: getTrad("list.assets.to-upload"),
|
|
@@ -4996,6 +5017,10 @@ const FromComputerForm = ({
|
|
|
4996
5017
|
type: "file",
|
|
4997
5018
|
multiple: true,
|
|
4998
5019
|
name: "files",
|
|
5020
|
+
"aria-label": formatMessage({
|
|
5021
|
+
id: getTrad("input.label"),
|
|
5022
|
+
defaultMessage: "Drag & Drop here or"
|
|
5023
|
+
}),
|
|
4999
5024
|
tabIndex: -1,
|
|
5000
5025
|
ref: inputRef,
|
|
5001
5026
|
zIndex: 1,
|
|
@@ -5729,7 +5754,7 @@ const CarouselAssets = React.forwardRef(
|
|
|
5729
5754
|
}
|
|
5730
5755
|
)
|
|
5731
5756
|
}
|
|
5732
|
-
) : assets.map((asset,
|
|
5757
|
+
) : assets.map((asset, index) => /* @__PURE__ */ jsx(
|
|
5733
5758
|
CarouselSlide,
|
|
5734
5759
|
{
|
|
5735
5760
|
label: formatMessage(
|
|
@@ -5737,7 +5762,7 @@ const CarouselAssets = React.forwardRef(
|
|
|
5737
5762
|
id: getTrad("mediaLibraryInput.slideCount"),
|
|
5738
5763
|
defaultMessage: "{n} of {m} slides"
|
|
5739
5764
|
},
|
|
5740
|
-
{ n:
|
|
5765
|
+
{ n: index + 1, m: assets.length }
|
|
5741
5766
|
),
|
|
5742
5767
|
children: /* @__PURE__ */ jsx(CarouselAsset, { asset })
|
|
5743
5768
|
},
|
|
@@ -5950,136 +5975,8 @@ const MediaLibraryInput = React.forwardRef(
|
|
|
5950
5975
|
] });
|
|
5951
5976
|
}
|
|
5952
5977
|
);
|
|
5953
|
-
const ParentFolderShape = {
|
|
5954
|
-
id: PropTypes.number.isRequired,
|
|
5955
|
-
createdAt: PropTypes.string.isRequired,
|
|
5956
|
-
name: PropTypes.string.isRequired,
|
|
5957
|
-
updatedAt: PropTypes.string.isRequired,
|
|
5958
|
-
pathId: PropTypes.number.isRequired,
|
|
5959
|
-
path: PropTypes.string.isRequired
|
|
5960
|
-
};
|
|
5961
|
-
ParentFolderShape.parent = PropTypes.shape(ParentFolderShape);
|
|
5962
|
-
const FolderShape = {
|
|
5963
|
-
id: PropTypes.number,
|
|
5964
|
-
children: PropTypes.shape({
|
|
5965
|
-
count: PropTypes.number.isRequired
|
|
5966
|
-
}),
|
|
5967
|
-
createdAt: PropTypes.string,
|
|
5968
|
-
createdBy: PropTypes.shape(),
|
|
5969
|
-
files: PropTypes.shape({
|
|
5970
|
-
count: PropTypes.number.isRequired
|
|
5971
|
-
}),
|
|
5972
|
-
name: PropTypes.string,
|
|
5973
|
-
updatedAt: PropTypes.string,
|
|
5974
|
-
updatedBy: PropTypes.shape(),
|
|
5975
|
-
pathId: PropTypes.number,
|
|
5976
|
-
path: PropTypes.string
|
|
5977
|
-
};
|
|
5978
|
-
FolderShape.parent = PropTypes.shape(ParentFolderShape);
|
|
5979
|
-
const FolderDefinition = PropTypes.shape(FolderShape);
|
|
5980
|
-
const FolderStructure = PropTypes.shape({
|
|
5981
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
5982
|
-
label: PropTypes.string.isRequired,
|
|
5983
|
-
children: PropTypes.array
|
|
5984
|
-
});
|
|
5985
|
-
FolderStructure.children = PropTypes.arrayOf(PropTypes.shape(FolderStructure));
|
|
5986
|
-
FolderStructure.defaultProps = {
|
|
5987
|
-
children: void 0
|
|
5988
|
-
};
|
|
5989
|
-
PropTypes.arrayOf(FolderStructure);
|
|
5990
|
-
const AssetDefinition = PropTypes.shape({
|
|
5991
|
-
id: PropTypes.number,
|
|
5992
|
-
height: PropTypes.number,
|
|
5993
|
-
width: PropTypes.number,
|
|
5994
|
-
size: PropTypes.number,
|
|
5995
|
-
createdAt: PropTypes.string,
|
|
5996
|
-
ext: PropTypes.string,
|
|
5997
|
-
mime: PropTypes.string,
|
|
5998
|
-
name: PropTypes.string,
|
|
5999
|
-
url: PropTypes.string,
|
|
6000
|
-
updatedAt: PropTypes.string,
|
|
6001
|
-
alternativeText: PropTypes.string,
|
|
6002
|
-
caption: PropTypes.string,
|
|
6003
|
-
folder: PropTypes.shape(FolderDefinition),
|
|
6004
|
-
formats: PropTypes.shape({
|
|
6005
|
-
thumbnail: PropTypes.shape({
|
|
6006
|
-
url: PropTypes.string
|
|
6007
|
-
})
|
|
6008
|
-
})
|
|
6009
|
-
});
|
|
6010
|
-
const CrumbDefinition = PropTypes.shape({
|
|
6011
|
-
id: PropTypes.number,
|
|
6012
|
-
label: PropTypes.oneOfType([
|
|
6013
|
-
PropTypes.string,
|
|
6014
|
-
PropTypes.shape({
|
|
6015
|
-
id: PropTypes.string.isRequired,
|
|
6016
|
-
defaultMessage: PropTypes.string.isRequired
|
|
6017
|
-
})
|
|
6018
|
-
]).isRequired,
|
|
6019
|
-
href: PropTypes.string
|
|
6020
|
-
});
|
|
6021
|
-
const CrumbMenuDefinition = PropTypes.arrayOf(CrumbDefinition);
|
|
6022
|
-
const BreadcrumbsDefinition = PropTypes.arrayOf(
|
|
6023
|
-
PropTypes.oneOfType([CrumbDefinition, CrumbMenuDefinition])
|
|
6024
|
-
);
|
|
6025
|
-
const viewOptions = {
|
|
6026
|
-
GRID: 0,
|
|
6027
|
-
LIST: 1
|
|
6028
|
-
};
|
|
6029
|
-
const pageSizes = [10, 20, 50, 100];
|
|
6030
|
-
const sortOptions = [
|
|
6031
|
-
{ key: "sort.created_at_desc", value: "createdAt:DESC" },
|
|
6032
|
-
{ key: "sort.created_at_asc", value: "createdAt:ASC" },
|
|
6033
|
-
{ key: "sort.name_asc", value: "name:ASC" },
|
|
6034
|
-
{ key: "sort.name_desc", value: "name:DESC" },
|
|
6035
|
-
{ key: "sort.updated_at_desc", value: "updatedAt:DESC" },
|
|
6036
|
-
{ key: "sort.updated_at_asc", value: "updatedAt:ASC" }
|
|
6037
|
-
];
|
|
6038
|
-
const localStorageKeys = {
|
|
6039
|
-
modalView: `STRAPI_UPLOAD_MODAL_VIEW`,
|
|
6040
|
-
view: `STRAPI_UPLOAD_LIBRARY_VIEW`
|
|
6041
|
-
};
|
|
6042
|
-
const PERMISSIONS = {
|
|
6043
|
-
// This permission regards the main component (App) and is used to tell
|
|
6044
|
-
// If the plugin link should be displayed in the menu
|
|
6045
|
-
// And also if the plugin is accessible. This use case is found when a user types the url of the
|
|
6046
|
-
// plugin directly in the browser
|
|
6047
|
-
main: [
|
|
6048
|
-
{ action: "plugin::upload.read", subject: null },
|
|
6049
|
-
{
|
|
6050
|
-
action: "plugin::upload.assets.create",
|
|
6051
|
-
subject: null
|
|
6052
|
-
},
|
|
6053
|
-
{
|
|
6054
|
-
action: "plugin::upload.assets.update",
|
|
6055
|
-
subject: null
|
|
6056
|
-
}
|
|
6057
|
-
],
|
|
6058
|
-
copyLink: [
|
|
6059
|
-
{
|
|
6060
|
-
action: "plugin::upload.assets.copy-link",
|
|
6061
|
-
subject: null
|
|
6062
|
-
}
|
|
6063
|
-
],
|
|
6064
|
-
create: [
|
|
6065
|
-
{
|
|
6066
|
-
action: "plugin::upload.assets.create",
|
|
6067
|
-
subject: null
|
|
6068
|
-
}
|
|
6069
|
-
],
|
|
6070
|
-
download: [
|
|
6071
|
-
{
|
|
6072
|
-
action: "plugin::upload.assets.download",
|
|
6073
|
-
subject: null
|
|
6074
|
-
}
|
|
6075
|
-
],
|
|
6076
|
-
read: [{ action: "plugin::upload.read", subject: null }],
|
|
6077
|
-
configureView: [{ action: "plugin::upload.configure-view", subject: null }],
|
|
6078
|
-
settings: [{ action: "plugin::upload.settings.read", subject: null }],
|
|
6079
|
-
update: [{ action: "plugin::upload.assets.update", subject: null, fields: null }]
|
|
6080
|
-
};
|
|
6081
5978
|
const name = pluginPkg.strapi.name;
|
|
6082
|
-
const
|
|
5979
|
+
const admin = {
|
|
6083
5980
|
register(app) {
|
|
6084
5981
|
app.addMenuLink({
|
|
6085
5982
|
to: `plugins/${pluginId}`,
|
|
@@ -6089,21 +5986,32 @@ const index = {
|
|
|
6089
5986
|
defaultMessage: "Media Library"
|
|
6090
5987
|
},
|
|
6091
5988
|
permissions: PERMISSIONS.main,
|
|
6092
|
-
Component: () => import("./
|
|
5989
|
+
Component: () => import("./App-D1ayH-QS.mjs").then((mod) => ({ default: mod.Upload })),
|
|
6093
5990
|
position: 4
|
|
6094
5991
|
});
|
|
6095
5992
|
app.addSettingsLink("global", {
|
|
6096
5993
|
id: "media-library-settings",
|
|
5994
|
+
to: "media-library",
|
|
6097
5995
|
intlLabel: {
|
|
6098
5996
|
id: getTrad("plugin.name"),
|
|
6099
5997
|
defaultMessage: "Media Library"
|
|
6100
5998
|
},
|
|
6101
|
-
|
|
6102
|
-
|
|
5999
|
+
async Component() {
|
|
6000
|
+
const { ProtectedSettingsPage } = await import("./SettingsPage-BYC3ism8.mjs");
|
|
6001
|
+
return { default: ProtectedSettingsPage };
|
|
6002
|
+
},
|
|
6103
6003
|
permissions: PERMISSIONS.settings
|
|
6104
6004
|
});
|
|
6105
|
-
app.addFields({
|
|
6106
|
-
|
|
6005
|
+
app.addFields({
|
|
6006
|
+
type: "media",
|
|
6007
|
+
Component: MediaLibraryInput
|
|
6008
|
+
});
|
|
6009
|
+
app.addComponents([
|
|
6010
|
+
{
|
|
6011
|
+
name: "media-library",
|
|
6012
|
+
Component: MediaLibraryDialog
|
|
6013
|
+
}
|
|
6014
|
+
]);
|
|
6107
6015
|
app.registerPlugin({
|
|
6108
6016
|
id: pluginId,
|
|
6109
6017
|
name
|
|
@@ -6129,16 +6037,13 @@ const index = {
|
|
|
6129
6037
|
}
|
|
6130
6038
|
};
|
|
6131
6039
|
export {
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6040
|
+
AssetGridList as A,
|
|
6041
|
+
Breadcrumbs as B,
|
|
6042
|
+
pageSizes as C,
|
|
6043
|
+
sortOptions as D,
|
|
6136
6044
|
EmptyAssets as E,
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
pageSizes as H,
|
|
6140
|
-
sortOptions as I,
|
|
6141
|
-
index as J,
|
|
6045
|
+
FilterPopover as F,
|
|
6046
|
+
admin as G,
|
|
6142
6047
|
PERMISSIONS as P,
|
|
6143
6048
|
SelectTree as S,
|
|
6144
6049
|
TableList as T,
|
|
@@ -6146,28 +6051,28 @@ export {
|
|
|
6146
6051
|
getFolderURL as a,
|
|
6147
6052
|
useBulkRemove as b,
|
|
6148
6053
|
useFolderStructure as c,
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6054
|
+
displayedFilters as d,
|
|
6055
|
+
FilterList as e,
|
|
6056
|
+
useMediaLibraryPermissions as f,
|
|
6152
6057
|
getTrad as g,
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6058
|
+
usePersistentState as h,
|
|
6059
|
+
useAssets as i,
|
|
6060
|
+
useFolders as j,
|
|
6061
|
+
containsAssetFilter as k,
|
|
6157
6062
|
localStorageKeys as l,
|
|
6158
|
-
|
|
6063
|
+
useFolder as m,
|
|
6159
6064
|
normalizeAPIError as n,
|
|
6160
|
-
|
|
6065
|
+
useSelectionState as o,
|
|
6161
6066
|
pluginId as p,
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6067
|
+
SortPicker as q,
|
|
6068
|
+
FolderGridList as r,
|
|
6069
|
+
FolderCard as s,
|
|
6070
|
+
FolderCardBody as t,
|
|
6166
6071
|
useFolderCard as u,
|
|
6167
6072
|
viewOptions as v,
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6073
|
+
FolderCardBodyAction as w,
|
|
6074
|
+
EditFolderDialog as x,
|
|
6075
|
+
EditAssetDialog as y,
|
|
6076
|
+
useConfig as z
|
|
6172
6077
|
};
|
|
6173
|
-
//# sourceMappingURL=index-
|
|
6078
|
+
//# sourceMappingURL=index-Clesg6BA.mjs.map
|