@scaleflex/widget-explorer 4.3.0 → 4.5.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/CHANGELOG.md +23 -0
- package/lib/components/AssetsList/AssetsList.styled.js +1 -1
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTabNavigator.js +9 -6
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/index.js +4 -4
- package/lib/components/common/DeleteModalItemText/index.js +7 -2
- package/lib/components/common/Sort/Sort.styled.js +2 -2
- package/lib/index.js +33 -4
- package/lib/slices/folders.slice.js +35 -21
- package/lib/slices/selections.slice.js +3 -3
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.5.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.4.0...v4.5.0) (2025-10-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* enhance VariationsTab functionality by integrating selectedVariant handling ([e68cbe0](https://code.scaleflex.cloud/scaleflex/widget/commits/e68cbe0875b90f93fbba37a657ee0adb7fdb23d0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.4.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.4.0) (2025-10-07)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add `hideTopBarAddFolderButton` option and implement new folder modal functionality in the explorer component ([7129309](https://code.scaleflex.cloud/scaleflex/widget/commits/712930995f6dfd4a0d874c0638dde61065fd0683))
|
|
23
|
+
* enhance folder management and file upload handling in the explorer component ([04b8ec5](https://code.scaleflex.cloud/scaleflex/widget/commits/04b8ec545c4f10be89f5a44eed954acf8433360c))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
# [4.3.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.3.0) (2025-10-02)
|
|
7
30
|
|
|
8
31
|
|
|
@@ -135,7 +135,7 @@ var Accordion = styled(SfxAccordion)(function (_ref17) {
|
|
|
135
135
|
_ref17$theme = _ref17.theme,
|
|
136
136
|
typography = _ref17$theme.typography,
|
|
137
137
|
palette = _ref17$theme.palette;
|
|
138
|
-
return css(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n margin-bottom: 12px;\n margin-top: ", ";\n\n ", "\n\n .SfxAccordionHeader-root {\n padding: 0 24px;\n display: ", "
|
|
138
|
+
return css(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n margin-bottom: 12px;\n margin-top: ", ";\n\n ", "\n\n .SfxAccordionHeader-root {\n padding: 0 24px;\n display: ", ";\n position: sticky;\n left: -24px;\n }\n\n .SfxAccordionHeader-label {\n ", ";\n color: ", "\n }\n"])), noTopMargin ? 0 : '12px', isListView && "\n max-width: max-content;\n width: max-content;\n ", hideHeader ? 'none' : 'inline-flex', typography.font[FV.LabelMediumEmphasis], palette[PC.TextSecondary]);
|
|
139
139
|
});
|
|
140
140
|
var RelevanceScore = styled.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n text-align: center;\n margin: 6px 0px;\n font-size: 20px;\n"])));
|
|
141
141
|
var FileRelevanceBadge = styled.div(function (_ref18) {
|
|
@@ -9,22 +9,25 @@ var VariationsTabNavigator = function VariationsTabNavigator(_ref) {
|
|
|
9
9
|
activeTabId = _ref.activeTabId,
|
|
10
10
|
setActiveTabId = _ref.setActiveTabId,
|
|
11
11
|
customVariants = _ref.customVariants,
|
|
12
|
-
presetsVariants = _ref.presetsVariants
|
|
12
|
+
presetsVariants = _ref.presetsVariants,
|
|
13
|
+
selectedVariant = _ref.selectedVariant;
|
|
13
14
|
var dispatch = useDispatch();
|
|
14
|
-
var
|
|
15
|
-
return tabId === VARIATIONS_TAB_IDS.AUTOMATIC ? presetsVariants === null || presetsVariants === void 0 ? void 0 : presetsVariants
|
|
16
|
-
|
|
15
|
+
var getActiveVariant = useCallback(function (tabId) {
|
|
16
|
+
return tabId === VARIATIONS_TAB_IDS.AUTOMATIC ? selectedVariant && (presetsVariants === null || presetsVariants === void 0 ? void 0 : presetsVariants.find(function (variant) {
|
|
17
|
+
return variant.name === selectedVariant.name;
|
|
18
|
+
})) || (presetsVariants === null || presetsVariants === void 0 ? void 0 : presetsVariants[0]) : customVariants === null || customVariants === void 0 ? void 0 : customVariants[0];
|
|
19
|
+
}, [customVariants, presetsVariants, selectedVariant]);
|
|
17
20
|
var handleChangeTab = useCallback(function (newTabId) {
|
|
18
21
|
if ((presetsVariants === null || presetsVariants === void 0 ? void 0 : presetsVariants.length) === 0) {
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
|
-
var firstVariant =
|
|
24
|
+
var firstVariant = getActiveVariant(newTabId);
|
|
22
25
|
dispatch(filesVariationsUpdated(firstVariant));
|
|
23
26
|
setActiveTabId(newTabId);
|
|
24
27
|
}, [dispatch]);
|
|
25
28
|
useEffect(function () {
|
|
26
29
|
if (activeTabId === VARIATIONS_TAB_IDS.AUTOMATIC) {
|
|
27
|
-
var firstVariant =
|
|
30
|
+
var firstVariant = getActiveVariant(activeTabId);
|
|
28
31
|
dispatch(filesVariationsUpdated(firstVariant));
|
|
29
32
|
}
|
|
30
33
|
}, []);
|
|
@@ -491,6 +491,7 @@ var VariationsTab = function VariationsTab(_ref) {
|
|
|
491
491
|
dispatch(filesVariationsUpdated(mainVariants[0]));
|
|
492
492
|
}, setIsLoading);
|
|
493
493
|
} else {
|
|
494
|
+
dispatch(filesVariationsUpdated(mainFile));
|
|
494
495
|
setIsLoading(false);
|
|
495
496
|
}
|
|
496
497
|
if (mainFile.removedBackground && !mainFile.info.remove_background) {
|
|
@@ -508,9 +509,7 @@ var VariationsTab = function VariationsTab(_ref) {
|
|
|
508
509
|
}, setIsLoading);
|
|
509
510
|
}
|
|
510
511
|
return function () {
|
|
511
|
-
|
|
512
|
-
dispatch(filesVariationsUpdated({}));
|
|
513
|
-
}
|
|
512
|
+
dispatch(filesVariationsUpdated({}));
|
|
514
513
|
_isUnMounting = true;
|
|
515
514
|
};
|
|
516
515
|
}, [previewedFile.uuid]);
|
|
@@ -548,7 +547,8 @@ var VariationsTab = function VariationsTab(_ref) {
|
|
|
548
547
|
activeTabId: activeVariationsTabId,
|
|
549
548
|
setActiveTabId: setActiveVariationsTabId,
|
|
550
549
|
customVariants: customVariants,
|
|
551
|
-
presetsVariants: presetsVariants
|
|
550
|
+
presetsVariants: presetsVariants,
|
|
551
|
+
selectedVariant: selectedVariant
|
|
552
552
|
}), /*#__PURE__*/_jsxs(StyledVariants.Actions, {
|
|
553
553
|
children: [/*#__PURE__*/_jsx(StyledVariants.Title, {
|
|
554
554
|
children: isAutomaticTabActive ? i18n('explorerFileWindowVariationsPresetsTabLabel') : i18n('explorerFileWindowVariationsCustomTabLabel')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
2
|
import { EllipsedText } from '@scaleflex/ui/core';
|
|
3
|
+
import Styled from './DeleteModalItemText.styled';
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
var TOOLTIP_PROPS = {
|
|
5
6
|
size: 'md',
|
|
@@ -17,7 +18,11 @@ var DeleteModalItemText = function DeleteModalItemText(_ref) {
|
|
|
17
18
|
tooltipProps: TOOLTIP_PROPS,
|
|
18
19
|
tooltipTitle: "\"".concat(itemTitle, "\""),
|
|
19
20
|
textSuffix: "\"?",
|
|
20
|
-
children: itemText
|
|
21
|
+
children: Array.isArray(itemText) ? itemText.map(function (text, index) {
|
|
22
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
23
|
+
children: text
|
|
24
|
+
}, index);
|
|
25
|
+
}) : itemText
|
|
21
26
|
})
|
|
22
27
|
});
|
|
23
28
|
};
|
|
@@ -14,14 +14,14 @@ var ArrowDown = styled(SfxArrowDown)(function (_ref2) {
|
|
|
14
14
|
var $isActive = _ref2.$isActive,
|
|
15
15
|
$isActiveOption = _ref2.$isActiveOption,
|
|
16
16
|
palette = _ref2.theme.palette;
|
|
17
|
-
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n opacity: ", ";\n visibility: ", ";\n margin-left: auto;\n margin-right: 4px;\n color: ", ";\n transition: all 150ms linear;\n padding: 4px;\n box-sizing: content-box;\n"])), $isActiveOption ? 1 : 0, $isActiveOption && 'visible', $isActive ? palette[PC.AccentStateless] : palette[PC.IconsSecondary]);
|
|
17
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n opacity: ", ";\n visibility: ", ";\n margin-left: auto;\n margin-right: 4px;\n color: ", ";\n transition: all 150ms linear;\n padding: 4px;\n box-sizing: content-box!important;\n"])), $isActiveOption ? 1 : 0, $isActiveOption && 'visible', $isActive ? palette[PC.AccentStateless] : palette[PC.IconsSecondary]);
|
|
18
18
|
});
|
|
19
19
|
var ArrowUp = styled(SfxArrowUp)(function (_ref3) {
|
|
20
20
|
var $isActive = _ref3.$isActive,
|
|
21
21
|
$isActiveOption = _ref3.$isActiveOption,
|
|
22
22
|
disabled = _ref3.disabled,
|
|
23
23
|
palette = _ref3.theme.palette;
|
|
24
|
-
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n opacity: ", ";\n visibility: ", ";\n color: ", ";\n transition: all 150ms ease-out;\n padding: 4px;\n box-sizing: content-box;\n\n ", "\n"])), $isActiveOption ? 1 : 0, $isActiveOption && 'visible', $isActive ? palette[PC.AccentStateless] : palette[PC.IconsSecondary], disabled ? 'cursor: not-allowed;' : "\n &:hover {\n color: ".concat(palette[PC.IconsSecondaryHover], ";\n }"));
|
|
24
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n opacity: ", ";\n visibility: ", ";\n color: ", ";\n transition: all 150ms ease-out;\n padding: 4px;\n box-sizing: content-box!important;\n\n ", "\n"])), $isActiveOption ? 1 : 0, $isActiveOption && 'visible', $isActive ? palette[PC.AccentStateless] : palette[PC.IconsSecondary], disabled ? 'cursor: not-allowed;' : "\n &:hover {\n color: ".concat(palette[PC.IconsSecondaryHover], ";\n }"));
|
|
25
25
|
});
|
|
26
26
|
var IconButton = styled(SfxIconButton)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref4) {
|
|
27
27
|
var preventSortButtonFocus = _ref4.preventSortButtonFocus;
|
package/lib/index.js
CHANGED
|
@@ -46,7 +46,7 @@ import explorerReducer from './slices';
|
|
|
46
46
|
import { targetAdded, targetRemoved } from './slices/targets.slice';
|
|
47
47
|
import { allPanelsClosed, detailsViewToggled, facetedSearchSidebarToggled, fileWindowUpdated, selectActiveOverlayType, selectFileWindowFor, showAddFilesPanelUpdated, uploadsPanelOpened } from './slices/panels.slice';
|
|
48
48
|
import { /* darkModeUpdated, */accessRolesUpdated, explorerCommonStateUpdated, selectIsPluginModalHidden, explorerPluginLoadingSet, pluginModalClosing, pluginModalHidden, selectIsPluginModalClosing } from './slices/common.slice';
|
|
49
|
-
import { foldersAdded, foldersSortingUpdated, foldersStateUpdated, selectBaseFolderPath, selectCurrentFolder, selectCurrentFolderPath, selectFolderByPath, selectFolders } from './slices/folders.slice';
|
|
49
|
+
import { fetchFolders, folderUpdated, foldersAdded, foldersSortingUpdated, foldersStateUpdated, selectBaseFolderPath, selectCurrentFolder, selectCurrentFolderPath, selectFolderByPath, selectFolders } from './slices/folders.slice';
|
|
50
50
|
import { fileAdded, filesSortingUpdated, selectCurrentFileByIdOrUuid } from './slices/files.slice';
|
|
51
51
|
import { changeView, selectActiveView, selectIsAssetsView, viewsStateUpdated } from './slices/views.slice';
|
|
52
52
|
import { foldersTreeFoldersUpdated, recursivelyFetchFoldersTree } from './slices/foldersTree.slice';
|
|
@@ -834,7 +834,7 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
834
834
|
return _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
835
835
|
count: {
|
|
836
836
|
files_direct: isUploadDirectChild ? 1 : 0,
|
|
837
|
-
files_recursive:
|
|
837
|
+
files_recursive: 1
|
|
838
838
|
},
|
|
839
839
|
size: {
|
|
840
840
|
total_recursive_bytes: ((_otherProps$fileSize = otherProps.fileSize) === null || _otherProps$fileSize === void 0 ? void 0 : _otherProps$fileSize.bytes) || 0,
|
|
@@ -872,7 +872,7 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
872
872
|
var fileParentFolder = uploadedFile.toFolder || uploadedFile.folder || '';
|
|
873
873
|
var fileParentFolderPath = fileParentFolder.name || fileParentFolder || '';
|
|
874
874
|
var localFolderPathNoFileName = (localParentFolderPath === null || localParentFolderPath === void 0 ? void 0 : localParentFolderPath.substr(0, localParentFolderPath === null || localParentFolderPath === void 0 ? void 0 : localParentFolderPath.lastIndexOf('/'))) || '';
|
|
875
|
-
var targetFolderPath = fileParentFolderPath.substr(0, fileParentFolderPath.indexOf(localFolderPathNoFileName));
|
|
875
|
+
var targetFolderPath = fileParentFolderPath.substr(0, fileParentFolderPath.indexOf(localFolderPathNoFileName)) || selectBaseFolderPath(state) || '/';
|
|
876
876
|
if (isFileWindowOpened && isFileVersion({
|
|
877
877
|
newVersion: uploadedFile,
|
|
878
878
|
originalFile: originalFile
|
|
@@ -898,6 +898,15 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
898
898
|
// otherwise add the file.
|
|
899
899
|
_this.dispatch(fileAdded(uploadedFile));
|
|
900
900
|
return;
|
|
901
|
+
} else if (folders[fileParentFolder.uuid]) {
|
|
902
|
+
var _folders$fileParentFo, _folders$fileParentFo2;
|
|
903
|
+
_this.dispatch(folderUpdated({
|
|
904
|
+
uuid: fileParentFolder.uuid,
|
|
905
|
+
count: {
|
|
906
|
+
files_direct: (((_folders$fileParentFo = folders[fileParentFolder.uuid].count) === null || _folders$fileParentFo === void 0 ? void 0 : _folders$fileParentFo.files_direct) || 0) + 1,
|
|
907
|
+
files_recursive: (((_folders$fileParentFo2 = folders[fileParentFolder.uuid].count) === null || _folders$fileParentFo2 === void 0 ? void 0 : _folders$fileParentFo2.files_recursive) || 0) + 1
|
|
908
|
+
}
|
|
909
|
+
}));
|
|
901
910
|
}
|
|
902
911
|
var fileDirectParentFolderPathIndex = fileParentFolderPath.indexOf('/', (currentFolder === null || currentFolder === void 0 ? void 0 : (_currentFolder$path = currentFolder.path) === null || _currentFolder$path === void 0 ? void 0 : _currentFolder$path.length) + 1 || 0);
|
|
903
912
|
var fileDirectParentFolderPath = fileParentFolderPath.slice(0, fileDirectParentFolderPathIndex > -1 ? fileDirectParentFolderPathIndex : undefined);
|
|
@@ -927,11 +936,31 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
927
936
|
* @param {Object} uploadResultObject
|
|
928
937
|
*/
|
|
929
938
|
_defineProperty(_this, "handleComplete", function (_ref6) {
|
|
930
|
-
var failed = _ref6.failed
|
|
939
|
+
var failed = _ref6.failed,
|
|
940
|
+
successful = _ref6.successful;
|
|
931
941
|
if (_this.opts.closeAfterFinish && failed.length === 0) {
|
|
932
942
|
// All uploads are done
|
|
933
943
|
_this.requestCloseModal();
|
|
934
944
|
}
|
|
945
|
+
var currentFolderPath = selectCurrentFolderPath(_this.getGlobalState());
|
|
946
|
+
var folderPathsToFetch = successful.reduce(function (folderPaths, file) {
|
|
947
|
+
var _file$data2, _file$data3, _file$data3$relativeP;
|
|
948
|
+
var fileParentFolderPath = (_file$data2 = file.data) !== null && _file$data2 !== void 0 && _file$data2.relativePath ? "".concat(currentFolderPath, "/").concat((_file$data3 = file.data) === null || _file$data3 === void 0 ? void 0 : (_file$data3$relativeP = _file$data3.relativePath) === null || _file$data3$relativeP === void 0 ? void 0 : _file$data3$relativeP.split('/')[1]).replace(/\/\//g, '/') : currentFolderPath;
|
|
949
|
+
folderPaths.add(fileParentFolderPath);
|
|
950
|
+
return folderPaths;
|
|
951
|
+
}, new Set());
|
|
952
|
+
folderPathsToFetch.forEach(function (folderPath) {
|
|
953
|
+
_this.dispatch(fetchFolders({
|
|
954
|
+
path: folderPath,
|
|
955
|
+
withPreviews: true,
|
|
956
|
+
limit: 0,
|
|
957
|
+
offset: 0,
|
|
958
|
+
replaceOldFolders: false,
|
|
959
|
+
skipPendingDispatch: true,
|
|
960
|
+
id: undefined,
|
|
961
|
+
addFolderRequestBaseToEntities: true
|
|
962
|
+
}));
|
|
963
|
+
});
|
|
935
964
|
});
|
|
936
965
|
_defineProperty(_this, "handleUploadStart", function () {
|
|
937
966
|
if (_this.opts.closeAfterUploadStart && !_this.opts.inline) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["sortBy", "sortOrder", "fetchFiles", "replaceOldFolders"],
|
|
2
|
-
_excluded2 = ["path", "options", "limit", "offset", "withStats", "replaceOldFolders", "abortSignal", "skipDispatch", "skipPendingDispatch", "withPreviews"];
|
|
2
|
+
_excluded2 = ["path", "options", "limit", "offset", "withStats", "replaceOldFolders", "abortSignal", "skipDispatch", "skipPendingDispatch", "withPreviews", "addFolderRequestBaseToEntities"];
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
5
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -332,6 +332,8 @@ export var fetchFolders = createThunk(async function (_ref12, thunkApi) {
|
|
|
332
332
|
skipPendingDispatch = _ref12$skipPendingDis === void 0 ? false : _ref12$skipPendingDis,
|
|
333
333
|
_ref12$withPreviews = _ref12.withPreviews,
|
|
334
334
|
withPreviews = _ref12$withPreviews === void 0 ? true : _ref12$withPreviews,
|
|
335
|
+
_ref12$addFolderReque = _ref12.addFolderRequestBaseToEntities,
|
|
336
|
+
addFolderRequestBaseToEntities = _ref12$addFolderReque === void 0 ? false : _ref12$addFolderReque,
|
|
335
337
|
otherParams = _objectWithoutProperties(_ref12, _excluded2);
|
|
336
338
|
if (skipDispatch) {
|
|
337
339
|
thunkApi.skipDispatch();
|
|
@@ -359,6 +361,7 @@ export var fetchFolders = createThunk(async function (_ref12, thunkApi) {
|
|
|
359
361
|
},
|
|
360
362
|
noRecursiveParam: false
|
|
361
363
|
});
|
|
364
|
+
var currFolder = selectFolderByPath(state, path);
|
|
362
365
|
var selectedItemsCount = selectAllSelectedItemsCount(thunkApi.getState());
|
|
363
366
|
if ((replaceOldFolders || usedOffset === 0) && selectedItemsCount > 0) {
|
|
364
367
|
thunkApi.dispatch(selectionsCleared());
|
|
@@ -379,7 +382,7 @@ export var fetchFolders = createThunk(async function (_ref12, thunkApi) {
|
|
|
379
382
|
var currentFolder = ((_foldersResponse$base = foldersResponse.base) === null || _foldersResponse$base === void 0 ? void 0 : _foldersResponse$base.path) === '/' ? _objectSpread(_objectSpread({}, foldersResponse.base), {}, {
|
|
380
383
|
name: i18n('mutualizedBaseFolderTitle')
|
|
381
384
|
}) : foldersResponse.base || {};
|
|
382
|
-
if (viewLayout === LAYOUTS_IDS.GRID && !isFastToken && withPreviews
|
|
385
|
+
if (viewLayout === LAYOUTS_IDS.GRID && !isFastToken && withPreviews) {
|
|
383
386
|
thunkApi.dispatch(fetchFoldersPreviews({
|
|
384
387
|
uuids: [currentFolder.uuid].concat(_toConsumableArray(folders.map(function (_ref14) {
|
|
385
388
|
var uuid = _ref14.uuid;
|
|
@@ -388,8 +391,7 @@ export var fetchFolders = createThunk(async function (_ref12, thunkApi) {
|
|
|
388
391
|
abortSignal: requestAttrs.abortSignal
|
|
389
392
|
}));
|
|
390
393
|
}
|
|
391
|
-
return {
|
|
392
|
-
currentFolder: currentFolder,
|
|
394
|
+
return _objectSpread({
|
|
393
395
|
folders: folders,
|
|
394
396
|
// Need to hide system folders but must be included in /list API response.
|
|
395
397
|
stats: withStats ? {
|
|
@@ -397,9 +399,14 @@ export var fetchFolders = createThunk(async function (_ref12, thunkApi) {
|
|
|
397
399
|
totalFoldersCount: ((_foldersResponse$stat2 = foldersResponse.stats) === null || _foldersResponse$stat2 === void 0 ? void 0 : _foldersResponse$stat2.approx_folders_count) || ((_foldersResponse$info2 = foldersResponse.info) === null || _foldersResponse$info2 === void 0 ? void 0 : _foldersResponse$info2.total_dirs_count) || ((_foldersResponse$info3 = foldersResponse.info) === null || _foldersResponse$info3 === void 0 ? void 0 : _foldersResponse$info3.total_folders_count)
|
|
398
400
|
} : undefined,
|
|
399
401
|
replaceOldFolders: replaceOldFolders,
|
|
402
|
+
addFolderRequestBaseToEntities: addFolderRequestBaseToEntities,
|
|
403
|
+
currentFolder: currFolder !== null && currFolder !== void 0 && currFolder.permissions ? _objectSpread(_objectSpread({}, currentFolder), {}, {
|
|
404
|
+
permissions: currFolder.permissions
|
|
405
|
+
}) : currentFolder
|
|
406
|
+
}, !addFolderRequestBaseToEntities && {
|
|
400
407
|
offset: usedOffset + usedLimit,
|
|
401
408
|
noMoreFolders: folders.length < usedLimit
|
|
402
|
-
};
|
|
409
|
+
});
|
|
403
410
|
}, {
|
|
404
411
|
actionType: "".concat(sliceName, "/fetchFolders")
|
|
405
412
|
});
|
|
@@ -563,14 +570,18 @@ var foldersSlice = createSlice({
|
|
|
563
570
|
});
|
|
564
571
|
},
|
|
565
572
|
foldersAdded: function foldersAdded(state, action) {
|
|
573
|
+
var _state$currentFolder;
|
|
566
574
|
var _action$payload = action.payload,
|
|
567
|
-
|
|
575
|
+
_action$payload$folde = _action$payload.folders,
|
|
576
|
+
folders = _action$payload$folde === void 0 ? [] : _action$payload$folde,
|
|
568
577
|
currentFolder = _action$payload.currentFolder,
|
|
569
578
|
noMoreFolders = _action$payload.noMoreFolders,
|
|
570
579
|
offset = _action$payload.offset,
|
|
571
580
|
stats = _action$payload.stats,
|
|
572
|
-
parentFolder = _action$payload.parentFolder
|
|
573
|
-
|
|
581
|
+
parentFolder = _action$payload.parentFolder,
|
|
582
|
+
_action$payload$addFo = _action$payload.addFolderRequestBaseToEntities,
|
|
583
|
+
addFolderRequestBaseToEntities = _action$payload$addFo === void 0 ? false : _action$payload$addFo;
|
|
584
|
+
var currentOpenedFolder = (currentFolder === null || currentFolder === void 0 ? void 0 : currentFolder.uuid) === ((_state$currentFolder = state.currentFolder) === null || _state$currentFolder === void 0 ? void 0 : _state$currentFolder.uuid) && _objectSpread(_objectSpread({}, state.currentFolder), currentFolder) || !addFolderRequestBaseToEntities && currentFolder || state.currentFolder;
|
|
574
585
|
var baseFolderPath = state.baseFolderPath;
|
|
575
586
|
if (parentFolder !== null && parentFolder !== void 0 && parentFolder.uuid && currentOpenedFolder !== null && currentOpenedFolder !== void 0 && currentOpenedFolder.uuid && parentFolder.uuid !== currentOpenedFolder.uuid) {
|
|
576
587
|
return state;
|
|
@@ -585,18 +596,21 @@ var foldersSlice = createSlice({
|
|
|
585
596
|
}),
|
|
586
597
|
normalizedSlices = _getNormalizedItems.normalizedSlices,
|
|
587
598
|
uuids = _getNormalizedItems.uuids;
|
|
588
|
-
var newFolders = _objectSpread(_objectSpread({}, state.entities), normalizedSlices);
|
|
599
|
+
var newFolders = _objectSpread(_objectSpread(_objectSpread({}, state.entities), addFolderRequestBaseToEntities ? _defineProperty({}, currentFolder.uuid, _objectSpread(_objectSpread(_objectSpread({}, state.entities[currentFolder.uuid]), currentFolder), addedFolderExtraProps)) : {}), normalizedSlices);
|
|
589
600
|
var newUuids = [].concat(_toConsumableArray(state.uuids), _toConsumableArray(uuids));
|
|
590
601
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
591
602
|
uuids: newUuids,
|
|
592
603
|
entities: newFolders,
|
|
593
|
-
stats: stats || state.stats,
|
|
604
|
+
stats: stats || _objectSpread(_objectSpread({}, state.stats), {}, {
|
|
605
|
+
totalFoldersCount: (state.stats.totalFoldersCount || 0) + foldersToAdd.length
|
|
606
|
+
}),
|
|
594
607
|
currentFolder: currentOpenedFolder,
|
|
595
608
|
noMoreFolders: noMoreFolders,
|
|
596
609
|
offset: offset !== null && offset !== void 0 ? offset : state.offset
|
|
597
610
|
});
|
|
598
611
|
},
|
|
599
612
|
foldersReplaced: function foldersReplaced(state, action) {
|
|
613
|
+
var _state$currentFolder2;
|
|
600
614
|
var _action$payload2 = action.payload,
|
|
601
615
|
folders = _action$payload2.folders,
|
|
602
616
|
currentFolder = _action$payload2.currentFolder,
|
|
@@ -625,7 +639,7 @@ var foldersSlice = createSlice({
|
|
|
625
639
|
uuids: newUuids,
|
|
626
640
|
entities: newFolders,
|
|
627
641
|
stats: stats || state.stats,
|
|
628
|
-
currentFolder: currentFolder || state.currentFolder,
|
|
642
|
+
currentFolder: (currentFolder === null || currentFolder === void 0 ? void 0 : currentFolder.uuid) === ((_state$currentFolder2 = state.currentFolder) === null || _state$currentFolder2 === void 0 ? void 0 : _state$currentFolder2.uuid) && _objectSpread(_objectSpread({}, state.currentFolder), currentFolder) || currentFolder || state.currentFolder,
|
|
629
643
|
offset: offset,
|
|
630
644
|
loading: false,
|
|
631
645
|
error: null,
|
|
@@ -675,10 +689,10 @@ var foldersSlice = createSlice({
|
|
|
675
689
|
});
|
|
676
690
|
},
|
|
677
691
|
foldersUpdated: function foldersUpdated(state, action) {
|
|
678
|
-
var _state$
|
|
692
|
+
var _state$currentFolder3;
|
|
679
693
|
var folders = action.payload;
|
|
680
694
|
var updatedFolders = _objectSpread({}, state.entities);
|
|
681
|
-
var currentFolderUuid = (_state$
|
|
695
|
+
var currentFolderUuid = (_state$currentFolder3 = state.currentFolder) === null || _state$currentFolder3 === void 0 ? void 0 : _state$currentFolder3.uuid;
|
|
682
696
|
var isFolderUpdated = false;
|
|
683
697
|
var updatedCurrentFolder = null;
|
|
684
698
|
folders.forEach(function (folder) {
|
|
@@ -790,8 +804,8 @@ var foldersSlice = createSlice({
|
|
|
790
804
|
loading: false
|
|
791
805
|
})
|
|
792
806
|
});
|
|
793
|
-
}).addMatcher(function (
|
|
794
|
-
var type =
|
|
807
|
+
}).addMatcher(function (_ref23) {
|
|
808
|
+
var type = _ref23.type;
|
|
795
809
|
return type.startsWith(sliceNameWithSeparator) && Boolean(type.match(/\/updateFolder.*\/pending/));
|
|
796
810
|
}, function (state, action) {
|
|
797
811
|
var _action$meta$arg, _action$meta$arg2;
|
|
@@ -802,8 +816,8 @@ var foldersSlice = createSlice({
|
|
|
802
816
|
error: null
|
|
803
817
|
}
|
|
804
818
|
});
|
|
805
|
-
}).addMatcher(function (
|
|
806
|
-
var type =
|
|
819
|
+
}).addMatcher(function (_ref24) {
|
|
820
|
+
var type = _ref24.type;
|
|
807
821
|
return type.startsWith(sliceNameWithSeparator) && Boolean(type.match(/\/updateFolder.*\/fulfilled/));
|
|
808
822
|
}, function (state, action) {
|
|
809
823
|
return foldersSlice.caseReducers.folderUpdated(state, {
|
|
@@ -812,8 +826,8 @@ var foldersSlice = createSlice({
|
|
|
812
826
|
error: null
|
|
813
827
|
})
|
|
814
828
|
});
|
|
815
|
-
}).addMatcher(function (
|
|
816
|
-
var type =
|
|
829
|
+
}).addMatcher(function (_ref25) {
|
|
830
|
+
var type = _ref25.type;
|
|
817
831
|
return type.startsWith(sliceNameWithSeparator) && Boolean(type.match(/\/updateFolder.*\/rejected/));
|
|
818
832
|
}, function (state, action) {
|
|
819
833
|
var _action$meta$arg3, _action$meta$arg4;
|
|
@@ -884,8 +898,8 @@ export var selectFolderByUuid = function selectFolderByUuid(state, folderUuid) {
|
|
|
884
898
|
return selectFolders(state)[folderUuid] || selectCurrentFolderUuid(state) === folderUuid && selectCurrentFolder(state);
|
|
885
899
|
};
|
|
886
900
|
export var selectFolderByPath = function selectFolderByPath(state, folderPath) {
|
|
887
|
-
return Object.values(selectFolders(state)).find(function (
|
|
888
|
-
var path =
|
|
901
|
+
return Object.values(selectFolders(state)).find(function (_ref22) {
|
|
902
|
+
var path = _ref22.path;
|
|
889
903
|
return path === folderPath;
|
|
890
904
|
});
|
|
891
905
|
};
|
|
@@ -14,8 +14,8 @@ import { createSelector, createSlice, isAnyOf } from '@reduxjs/toolkit';
|
|
|
14
14
|
import createThunk from '@scaleflex/widget-utils/lib/createThunk';
|
|
15
15
|
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
16
16
|
import { uploadsAdded } from '@scaleflex/widget-core/lib/slices/uploads.slice';
|
|
17
|
-
import { filesReplaced, selectCurrentFileByIdOrUuid, selectCurrentFiles, selectCurrentFilesByIdsOrUuids, selectFiles } from './files.slice';
|
|
18
|
-
import { foldersReplaced, selectFolderByUuid, selectFolders } from './folders.slice';
|
|
17
|
+
import { filesRemoved, filesReplaced, selectCurrentFileByIdOrUuid, selectCurrentFiles, selectCurrentFilesByIdsOrUuids, selectFiles } from './files.slice';
|
|
18
|
+
import { foldersRemoved, foldersReplaced, selectFolderByUuid, selectFolders } from './folders.slice';
|
|
19
19
|
import { viewChanged, selectIsFoldersView } from './views.slice';
|
|
20
20
|
import { showAddFilesPanelUpdated } from './panels.slice';
|
|
21
21
|
var slicePropName = 'selections';
|
|
@@ -214,7 +214,7 @@ var selectionsSlice = createSlice({
|
|
|
214
214
|
return selectionsSlice.caseReducers.foldersSelected(state, {
|
|
215
215
|
payload: []
|
|
216
216
|
});
|
|
217
|
-
}).addMatcher(isAnyOf(viewChanged, uploadsAdded, showAddFilesPanelUpdated), function (state) {
|
|
217
|
+
}).addMatcher(isAnyOf(viewChanged, uploadsAdded, showAddFilesPanelUpdated, filesRemoved, foldersRemoved), function (state) {
|
|
218
218
|
return selectionsSlice.caseReducers.selectionsCleared(state);
|
|
219
219
|
});
|
|
220
220
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-explorer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Scaleflex explorer for the files uploaded on filerobot, handling them & upload new files.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"style": "dist/style.min.css",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"@scaleflex/icons": "^3.0.0-beta.11",
|
|
19
19
|
"@scaleflex/react-url-builder": "^0.0.72",
|
|
20
20
|
"@scaleflex/ui": "^3.0.0-beta.11",
|
|
21
|
-
"@scaleflex/widget-common": "^4.
|
|
22
|
-
"@scaleflex/widget-icons": "^4.
|
|
23
|
-
"@scaleflex/widget-informer": "^4.
|
|
24
|
-
"@scaleflex/widget-provider-views": "^4.
|
|
25
|
-
"@scaleflex/widget-thumbnail-generator": "^4.
|
|
26
|
-
"@scaleflex/widget-utils": "^4.
|
|
21
|
+
"@scaleflex/widget-common": "^4.5.0",
|
|
22
|
+
"@scaleflex/widget-icons": "^4.5.0",
|
|
23
|
+
"@scaleflex/widget-informer": "^4.5.0",
|
|
24
|
+
"@scaleflex/widget-provider-views": "^4.5.0",
|
|
25
|
+
"@scaleflex/widget-thumbnail-generator": "^4.5.0",
|
|
26
|
+
"@scaleflex/widget-utils": "^4.5.0",
|
|
27
27
|
"@transloadit/prettier-bytes": "0.1.0",
|
|
28
28
|
"akamai-filerobot-converter": "^0.1.6",
|
|
29
29
|
"classnames": "^2.2.6",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"react-konva": ">=19.0.3"
|
|
52
52
|
},
|
|
53
53
|
"license": "MIT",
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "df64ca68034ed6c33e123e7dfa215176aa0a1196"
|
|
55
55
|
}
|