@scaleflex/widget-provider-views 0.1.2 → 0.2.1
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
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
## [0.2.1](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.2.0...v0.2.1) (2025-08-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @scaleflex/widget-provider-views
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.2.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.2...v0.2.0) (2025-08-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* implement the recursive remote upload for 3rd parties [FRA-1343] ([4db5cba](https://code.scaleflex.cloud/scaleflex/widget/commits/4db5cba125d155b1d1ab6cdbc68c28ae07d78f4c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.1.2](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.1...v0.1.2) (2025-07-30)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @scaleflex/widget-provider-views
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
2
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
+
import styled, { keyframes } from 'styled-components';
|
|
4
|
+
import { PC, FV } from '@scaleflex/widget-common';
|
|
5
|
+
import { Button } from '@scaleflex/ui/core';
|
|
6
|
+
var dotsLoaderAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n color: #6879eb;\n box-shadow: 10px 0 #d1d5db, -10px 0 #6879eb;\n opacity: 1;\n }\n 50% {\n color: #d1d5db;\n box-shadow: 10px 0 #6879eb, -10px 0 #d1d5db;\n opacity: 0.6;\n }\n 100% {\n color: #d1d5db;\n box-shadow: 10px 0 #d1d5db, -10px 0 #6879eb;\n opacity: 0.2;\n }\n"])));
|
|
7
|
+
var ProgressOverlay = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n position: absolute;\n top: 48px; // height of the header\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1200;\n background: rgba(255, 255, 255, 0.75);\n backdrop-filter: blur(2px);\n"])));
|
|
8
|
+
var ProgressWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n margin: auto;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: sticky;\n box-sizing: border-box;\n"])));
|
|
9
|
+
var ProgressContent = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 20px;\n padding: 32px;\n background: ", ";\n border-radius: 12px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);\n min-width: 300px;\n text-align: center;\n"])), function (_ref) {
|
|
10
|
+
var theme = _ref.theme;
|
|
11
|
+
return theme.palette[PC.BackgroundSecondary];
|
|
12
|
+
});
|
|
13
|
+
var ProgressLabel = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", ";\n color: ", ";\n margin-bottom: 8px;\n"])), function (_ref2) {
|
|
14
|
+
var typography = _ref2.theme.typography;
|
|
15
|
+
return typography.font[FV.LabelLarge];
|
|
16
|
+
}, function (_ref3) {
|
|
17
|
+
var theme = _ref3.theme;
|
|
18
|
+
return theme.palette[PC.TextPrimary];
|
|
19
|
+
});
|
|
20
|
+
var ProgressStats = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n gap: 32px;\n align-items: center;\n"])));
|
|
21
|
+
var StatItem = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n"])));
|
|
22
|
+
var StatNumber = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", ";\n color: ", ";\n font-weight: 600;\n"])), function (_ref4) {
|
|
23
|
+
var typography = _ref4.theme.typography;
|
|
24
|
+
return typography.font[FV.HeadingLarge];
|
|
25
|
+
}, function (_ref5) {
|
|
26
|
+
var theme = _ref5.theme;
|
|
27
|
+
return theme.palette[PC.AccentStatePrimary];
|
|
28
|
+
});
|
|
29
|
+
var StatLabel = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", ";\n color: ", ";\n text-transform: uppercase;\n letter-spacing: 0.5px;\n"])), function (_ref6) {
|
|
30
|
+
var typography = _ref6.theme.typography;
|
|
31
|
+
return typography.font[FV.LabelSmall];
|
|
32
|
+
}, function (_ref7) {
|
|
33
|
+
var theme = _ref7.theme;
|
|
34
|
+
return theme.palette[PC.TextSecondary];
|
|
35
|
+
});
|
|
36
|
+
var DotsLoader = styled.span(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: #6879eb;\n display: flex;\n box-sizing: border-box;\n animation: ", " 1.5s linear infinite;\n"])), dotsLoaderAnimation);
|
|
37
|
+
var CancelButton = styled(Button)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: 12px;\n"])));
|
|
38
|
+
var Styled = {
|
|
39
|
+
ProgressOverlay: ProgressOverlay,
|
|
40
|
+
ProgressWrapper: ProgressWrapper,
|
|
41
|
+
ProgressContent: ProgressContent,
|
|
42
|
+
ProgressLabel: ProgressLabel,
|
|
43
|
+
ProgressStats: ProgressStats,
|
|
44
|
+
StatItem: StatItem,
|
|
45
|
+
StatNumber: StatNumber,
|
|
46
|
+
StatLabel: StatLabel,
|
|
47
|
+
DotsLoader: DotsLoader,
|
|
48
|
+
CancelButton: CancelButton
|
|
49
|
+
};
|
|
50
|
+
export default Styled;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["foldersCount", "filesCount", "message", "i18n", "cancel"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
+
import Styled from './FolderImportProgress.styled';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var FolderImportProgress = function FolderImportProgress(_ref) {
|
|
13
|
+
var _ref$foldersCount = _ref.foldersCount,
|
|
14
|
+
foldersCount = _ref$foldersCount === void 0 ? 0 : _ref$foldersCount,
|
|
15
|
+
_ref$filesCount = _ref.filesCount,
|
|
16
|
+
filesCount = _ref$filesCount === void 0 ? 0 : _ref$filesCount,
|
|
17
|
+
message = _ref.message,
|
|
18
|
+
i18n = _ref.i18n,
|
|
19
|
+
cancel = _ref.cancel,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
return /*#__PURE__*/_jsx(Styled.ProgressOverlay, _objectSpread(_objectSpread({}, props), {}, {
|
|
22
|
+
children: /*#__PURE__*/_jsx(Styled.ProgressWrapper, {
|
|
23
|
+
children: /*#__PURE__*/_jsxs(Styled.ProgressContent, {
|
|
24
|
+
children: [/*#__PURE__*/_jsx(Styled.ProgressLabel, {
|
|
25
|
+
children: message
|
|
26
|
+
}), /*#__PURE__*/_jsxs(Styled.ProgressStats, {
|
|
27
|
+
children: [/*#__PURE__*/_jsxs(Styled.StatItem, {
|
|
28
|
+
children: [/*#__PURE__*/_jsx(Styled.StatNumber, {
|
|
29
|
+
children: foldersCount
|
|
30
|
+
}), /*#__PURE__*/_jsx(Styled.StatLabel, {
|
|
31
|
+
children: i18n('remoteUploadFolderImportProgressFoldersLabel')
|
|
32
|
+
})]
|
|
33
|
+
}), /*#__PURE__*/_jsxs(Styled.StatItem, {
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Styled.StatNumber, {
|
|
35
|
+
children: filesCount
|
|
36
|
+
}), /*#__PURE__*/_jsx(Styled.StatLabel, {
|
|
37
|
+
children: i18n('remoteUploadFolderImportProgressFilesLabel')
|
|
38
|
+
})]
|
|
39
|
+
})]
|
|
40
|
+
}), /*#__PURE__*/_jsx(Styled.DotsLoader, {}), /*#__PURE__*/_jsx(Styled.CancelButton, {
|
|
41
|
+
onClick: cancel,
|
|
42
|
+
color: "basic",
|
|
43
|
+
size: "md",
|
|
44
|
+
children: i18n('remoteUploadFolderImportProgressCancelButton')
|
|
45
|
+
})]
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
export default FolderImportProgress;
|
|
@@ -71,7 +71,7 @@ var SearchProviderView = /*#__PURE__*/function (_View) {
|
|
|
71
71
|
_this.clearSearch = _this.clearSearch.bind(_this);
|
|
72
72
|
_this.resetPluginCommonState = _this.resetPluginCommonState.bind(_this);
|
|
73
73
|
_this.handleScroll = _this.handleScroll.bind(_this);
|
|
74
|
-
_this.
|
|
74
|
+
_this.addSelectedItems = _this.addSelectedItems.bind(_this);
|
|
75
75
|
|
|
76
76
|
// Visual
|
|
77
77
|
_this.render = _this.render.bind(_this);
|
|
@@ -167,8 +167,8 @@ var SearchProviderView = /*#__PURE__*/function (_View) {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}, {
|
|
170
|
-
key: "
|
|
171
|
-
value: function
|
|
170
|
+
key: "addSelectedItems",
|
|
171
|
+
value: function addSelectedItems() {
|
|
172
172
|
var _this2 = this;
|
|
173
173
|
var _this$plugin$getPlugi3 = this.plugin.getPluginCommonState(),
|
|
174
174
|
currentSelection = _this$plugin$getPlugi3.currentSelection;
|
|
@@ -207,7 +207,7 @@ var SearchProviderView = /*#__PURE__*/function (_View) {
|
|
|
207
207
|
files: hasInput ? filterItems(files) : files,
|
|
208
208
|
folders: hasInput ? filterItems(folders) : folders,
|
|
209
209
|
handleScroll: this.handleScroll,
|
|
210
|
-
done: this.
|
|
210
|
+
done: this.addSelectedItems,
|
|
211
211
|
cancel: this.cancelPicking,
|
|
212
212
|
// For SearchFilterInput component
|
|
213
213
|
showSearchFilter: targetViewOptions.showFilter,
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
3
7
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
8
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
5
9
|
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."); }
|
|
@@ -22,8 +26,10 @@ import { LoaderView } from '@scaleflex/widget-common';
|
|
|
22
26
|
import generateFileId from '@scaleflex/widget-utils/lib/generateFileId';
|
|
23
27
|
import isFolder from '@scaleflex/widget-utils/lib/isFolder';
|
|
24
28
|
import { LIST_VIEW_COLS_IDS, LAYOUTS_IDS, LIST_VIEW_FOLDERS_COLS_IDS, PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
29
|
+
import { CheckBoxGroup } from '@scaleflex/ui/core';
|
|
25
30
|
import AuthView from './components/AuthView';
|
|
26
31
|
import Browser from './components/Browser';
|
|
32
|
+
import FolderImportProgress from './components/FolderImportProgress';
|
|
27
33
|
// TODO: find a way to show version of the current plugin
|
|
28
34
|
// why solution below isn't good?
|
|
29
35
|
// first import doesn't work with webpack 5 as it was deprecated
|
|
@@ -38,7 +44,7 @@ import Browser from './components/Browser';
|
|
|
38
44
|
/**
|
|
39
45
|
* Array.prototype.findIndex ponyfill for old browsers.
|
|
40
46
|
*/
|
|
41
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
47
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
42
48
|
function findIndex(array, predicate) {
|
|
43
49
|
for (var i = 0; i < array.length; i++) {
|
|
44
50
|
if (predicate(array[i])) return i;
|
|
@@ -210,6 +216,62 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
210
216
|
_defineProperty(this, "checkIfAllSelected", function (currentSelection, items) {
|
|
211
217
|
return currentSelection.length === items.length;
|
|
212
218
|
});
|
|
219
|
+
/**
|
|
220
|
+
* Validates restrictions during import that require backend requests
|
|
221
|
+
*/
|
|
222
|
+
_defineProperty(this, "validateDuringImport", function (fileCount, totalSize, depth) {
|
|
223
|
+
var folderCount = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
224
|
+
if (_this.importState.shouldStop) {
|
|
225
|
+
return false; // Already stopped due to previous restriction
|
|
226
|
+
}
|
|
227
|
+
var _this$plugin$filerobo = _this.plugin.filerobot.opts.restrictions,
|
|
228
|
+
remoteMaxFolderImportCount = _this$plugin$filerobo.remoteMaxFolderImportCount,
|
|
229
|
+
remoteMaxFolderImportSize = _this$plugin$filerobo.remoteMaxFolderImportSize,
|
|
230
|
+
remoteMaxFolderDepth = _this$plugin$filerobo.remoteMaxFolderDepth,
|
|
231
|
+
remoteMaxFolderCount = _this$plugin$filerobo.remoteMaxFolderCount;
|
|
232
|
+
var _this$plugin$getPlugi9 = _this.plugin.getPluginCommonState(),
|
|
233
|
+
shouldIncludeSubFolders = _this$plugin$getPlugi9.shouldIncludeSubFolders;
|
|
234
|
+
|
|
235
|
+
// Update tracking state
|
|
236
|
+
_this.importState.totalFilesImported += fileCount;
|
|
237
|
+
_this.importState.totalFoldersImported += folderCount;
|
|
238
|
+
_this.importState.totalSizeImported += totalSize;
|
|
239
|
+
_this.importState.currentDepth = Math.max(_this.importState.currentDepth, depth);
|
|
240
|
+
|
|
241
|
+
// Check file count restriction
|
|
242
|
+
if (remoteMaxFolderImportCount && _this.importState.totalFilesImported > remoteMaxFolderImportCount) {
|
|
243
|
+
_this.importState.shouldStop = true;
|
|
244
|
+
throw new Error(_this.plugin.filerobot.i18n('remoteUploadTooManyFilesSelectedError', {
|
|
245
|
+
limit: remoteMaxFolderImportCount
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Check total file size restriction
|
|
250
|
+
if (remoteMaxFolderImportSize && _this.importState.totalSizeImported > remoteMaxFolderImportSize) {
|
|
251
|
+
_this.importState.shouldStop = true;
|
|
252
|
+
var maxSizeGB = Math.round(remoteMaxFolderImportSize / (1024 * 1024 * 1024));
|
|
253
|
+
throw new Error(_this.plugin.filerobot.i18n('remoteUploadTotalFileSizeTooBigError', {
|
|
254
|
+
limit: "".concat(maxSizeGB, " GB")
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Check total folder count restriction during import (only for recursive imports)
|
|
259
|
+
if (shouldIncludeSubFolders && remoteMaxFolderCount && _this.importState.totalFoldersImported > remoteMaxFolderCount) {
|
|
260
|
+
_this.importState.shouldStop = true;
|
|
261
|
+
throw new Error(_this.plugin.filerobot.i18n('remoteUploadTooManyFoldersSelectedError', {
|
|
262
|
+
limit: remoteMaxFolderCount
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Check folder depth restriction (only for recursive imports)
|
|
267
|
+
if (shouldIncludeSubFolders && remoteMaxFolderDepth && _this.importState.currentDepth > remoteMaxFolderDepth) {
|
|
268
|
+
_this.importState.shouldStop = true;
|
|
269
|
+
throw new Error(_this.plugin.filerobot.i18n('remoteUploadPathTooLongError', {
|
|
270
|
+
limit: remoteMaxFolderDepth
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
return true; // Continue importing
|
|
274
|
+
});
|
|
213
275
|
this.id = PLUGINS_IDS.PROVIDER_VIEWS;
|
|
214
276
|
this.plugin = plugin;
|
|
215
277
|
this.provider = opts.provider;
|
|
@@ -235,6 +297,8 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
235
297
|
|
|
236
298
|
// Logic
|
|
237
299
|
this.addFile = this.addFile.bind(this);
|
|
300
|
+
this.enqueueFile = this.enqueueFile.bind(this);
|
|
301
|
+
this.addFolder = this.addFolder.bind(this);
|
|
238
302
|
this.filterItems = this.filterItems.bind(this);
|
|
239
303
|
this.filterQuery = this.filterQuery.bind(this);
|
|
240
304
|
this.toggleSearch = this.toggleSearch.bind(this);
|
|
@@ -250,11 +314,11 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
250
314
|
this.toggleCheckbox = this.toggleCheckbox.bind(this);
|
|
251
315
|
this.handleError = this.handleError.bind(this);
|
|
252
316
|
this.handleScroll = this.handleScroll.bind(this);
|
|
253
|
-
this.
|
|
254
|
-
this.donePicking = this.donePicking.bind(this);
|
|
317
|
+
this.list = this.list.bind(this);
|
|
255
318
|
this.cancelPicking = this.cancelPicking.bind(this);
|
|
256
319
|
this.clearSelection = this.clearSelection.bind(this);
|
|
257
320
|
this.addSelectedItems = this.addSelectedItems.bind(this);
|
|
321
|
+
this.renderPanelUploadActionButtons = this.renderPanelUploadActionButtons.bind(this);
|
|
258
322
|
|
|
259
323
|
// Visual
|
|
260
324
|
this.render = this.render.bind(this);
|
|
@@ -355,10 +419,30 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
355
419
|
}
|
|
356
420
|
}
|
|
357
421
|
}
|
|
422
|
+
}, {
|
|
423
|
+
key: "enqueueFile",
|
|
424
|
+
value: function enqueueFile(file) {
|
|
425
|
+
var _this$importState;
|
|
426
|
+
// Check if we should stop due to previous restriction hits
|
|
427
|
+
if ((_this$importState = this.importState) !== null && _this$importState !== void 0 && _this$importState.shouldStop) {
|
|
428
|
+
return; // Stop processing
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// For individual files (not from folders), validate restrictions during import
|
|
432
|
+
if (this.importState && !file.relativePath) {
|
|
433
|
+
try {
|
|
434
|
+
this.validateDuringImport(1, file.size || 0, 0);
|
|
435
|
+
} catch (error) {
|
|
436
|
+
this.importState.shouldStop = true;
|
|
437
|
+
throw error;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
this.importState.filesQueue.push(file);
|
|
441
|
+
}
|
|
358
442
|
}, {
|
|
359
443
|
key: "addFile",
|
|
360
444
|
value: function addFile(file) {
|
|
361
|
-
var tagFile = {
|
|
445
|
+
var tagFile = _objectSpread(_objectSpread({
|
|
362
446
|
id: this.providerFileToId(file),
|
|
363
447
|
source: this.plugin.id,
|
|
364
448
|
data: file,
|
|
@@ -367,7 +451,12 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
367
451
|
isRemote: true,
|
|
368
452
|
body: {
|
|
369
453
|
fileId: file.id
|
|
370
|
-
}
|
|
454
|
+
}
|
|
455
|
+
}, file.relativePath && {
|
|
456
|
+
info: {
|
|
457
|
+
relativePath: "".concat(file.relativePath).concat(file.name)
|
|
458
|
+
}
|
|
459
|
+
}), {}, {
|
|
371
460
|
remote: {
|
|
372
461
|
companionUrl: this.plugin.provider.companionUrl,
|
|
373
462
|
url: "".concat(this.provider.fileUrl(file.requestPath)),
|
|
@@ -376,7 +465,7 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
376
465
|
},
|
|
377
466
|
providerOptions: this.provider.opts
|
|
378
467
|
}
|
|
379
|
-
};
|
|
468
|
+
});
|
|
380
469
|
if (file.thumbnail || file.preview) {
|
|
381
470
|
tagFile.preview = file.thumbnail || file.preview;
|
|
382
471
|
}
|
|
@@ -392,8 +481,8 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
392
481
|
}, {
|
|
393
482
|
key: "removeFile",
|
|
394
483
|
value: function removeFile(id) {
|
|
395
|
-
var _this$plugin$
|
|
396
|
-
currentSelection = _this$plugin$
|
|
484
|
+
var _this$plugin$getPlugi10 = this.plugin.getPluginCommonState(),
|
|
485
|
+
currentSelection = _this$plugin$getPlugi10.currentSelection;
|
|
397
486
|
this.plugin.setPluginCommonState({
|
|
398
487
|
currentSelection: currentSelection.filter(function (file) {
|
|
399
488
|
return file.id !== id;
|
|
@@ -541,8 +630,8 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
541
630
|
}, {
|
|
542
631
|
key: "isChecked",
|
|
543
632
|
value: function isChecked(file) {
|
|
544
|
-
var _this$plugin$
|
|
545
|
-
currentSelection = _this$plugin$
|
|
633
|
+
var _this$plugin$getPlugi11 = this.plugin.getPluginCommonState(),
|
|
634
|
+
currentSelection = _this$plugin$getPlugi11.currentSelection;
|
|
546
635
|
// comparing id instead of the file object, because the reference to the object
|
|
547
636
|
// changes when we switch folders, and the file list is updated
|
|
548
637
|
return currentSelection.some(function (item) {
|
|
@@ -559,7 +648,14 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
559
648
|
}, {
|
|
560
649
|
key: "addFolder",
|
|
561
650
|
value: function addFolder(folder) {
|
|
562
|
-
var
|
|
651
|
+
var _this$importState2,
|
|
652
|
+
_this4 = this;
|
|
653
|
+
var parentRelativePath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
654
|
+
var currentDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
655
|
+
// Check if we should stop due to previous restriction hits
|
|
656
|
+
if ((_this$importState2 = this.importState) !== null && _this$importState2 !== void 0 && _this$importState2.shouldStop) {
|
|
657
|
+
return Promise.resolve();
|
|
658
|
+
}
|
|
563
659
|
var folderId = this.providerFileToId(folder);
|
|
564
660
|
var folders = _objectSpread({}, this.plugin.getPluginCommonState().selectedFolders);
|
|
565
661
|
if (folderId in folders && folders[folderId].loading) {
|
|
@@ -572,9 +668,41 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
572
668
|
this.plugin.setPluginCommonState({
|
|
573
669
|
selectedFolders: folders
|
|
574
670
|
});
|
|
575
|
-
|
|
671
|
+
var _this$plugin$getPlugi12 = this.plugin.getPluginCommonState(),
|
|
672
|
+
shouldIncludeSubFolders = _this$plugin$getPlugi12.shouldIncludeSubFolders;
|
|
673
|
+
var relativePath = "".concat(parentRelativePath || folder.relativePath || '').concat(folder.name, "/");
|
|
674
|
+
return this.list(folder.requestPath).then(function (_ref2) {
|
|
675
|
+
var _this4$importState, _this4$importState2;
|
|
676
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
677
|
+
files = _ref3[0],
|
|
678
|
+
_ref3$ = _ref3[1],
|
|
679
|
+
subFolders = _ref3$ === void 0 ? [] : _ref3$;
|
|
680
|
+
// Check if we should stop due to restriction hit during list operation
|
|
681
|
+
if ((_this4$importState = _this4.importState) !== null && _this4$importState !== void 0 && _this4$importState.shouldStop) {
|
|
682
|
+
return Promise.resolve();
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Calculate total size of files in this folder
|
|
686
|
+
var totalSize = files.reduce(function (sum, file) {
|
|
687
|
+
return sum + (file.size || 0);
|
|
688
|
+
}, 0);
|
|
689
|
+
|
|
690
|
+
// Validate restrictions during import (this may throw and stop the process)
|
|
691
|
+
try {
|
|
692
|
+
_this4.validateDuringImport(files.length, totalSize, currentDepth, 1); // Count this folder as 1
|
|
693
|
+
} catch (error) {
|
|
694
|
+
// Stop the import process and propagate the error
|
|
695
|
+
_this4.importState.shouldStop = true;
|
|
696
|
+
return Promise.reject(error);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// Update progress during import
|
|
700
|
+
_this4.updateImportProgress(1, files.length);
|
|
576
701
|
files.forEach(function (file) {
|
|
577
|
-
|
|
702
|
+
// Add relativePath for recursive folder structure replication
|
|
703
|
+
_this4.enqueueFile(_objectSpread(_objectSpread({}, file), {}, {
|
|
704
|
+
relativePath: relativePath
|
|
705
|
+
}));
|
|
578
706
|
});
|
|
579
707
|
var ids = files.map(_this4.providerFileToId);
|
|
580
708
|
folders = _objectSpread(_objectSpread({}, _this4.plugin.getPluginCommonState().selectedFolders), {}, _defineProperty({}, folderId, {
|
|
@@ -594,7 +722,16 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
594
722
|
message = _this4.plugin.filerobot.i18n('filerobotEmptyFolderAddedMessage');
|
|
595
723
|
}
|
|
596
724
|
_this4.plugin.filerobot.info(message);
|
|
597
|
-
|
|
725
|
+
|
|
726
|
+
// Process subfolders if recursion is enabled and we haven't hit any restrictions
|
|
727
|
+
if (shouldIncludeSubFolders && !((_this4$importState2 = _this4.importState) !== null && _this4$importState2 !== void 0 && _this4$importState2.shouldStop)) {
|
|
728
|
+
return Promise.all(subFolders.map(function (subFolder) {
|
|
729
|
+
return _this4.addFolder(_objectSpread(_objectSpread({}, subFolder), {}, {
|
|
730
|
+
relativePath: relativePath
|
|
731
|
+
}), relativePath, currentDepth + 1);
|
|
732
|
+
}));
|
|
733
|
+
}
|
|
734
|
+
})["catch"](function (e) {
|
|
598
735
|
folders = _objectSpread({}, _this4.plugin.getPluginCommonState().selectedFolders);
|
|
599
736
|
delete folders[folderId];
|
|
600
737
|
_this4.plugin.setPluginCommonState({
|
|
@@ -605,29 +742,22 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
605
742
|
}
|
|
606
743
|
|
|
607
744
|
/**
|
|
608
|
-
*
|
|
609
|
-
* if folder it would retrieve its files
|
|
610
|
-
* if files they would be added directly
|
|
611
|
-
*
|
|
745
|
+
* Updates the progressive loading UI with current import progress
|
|
612
746
|
*/
|
|
613
747
|
}, {
|
|
614
|
-
key: "
|
|
615
|
-
value: function
|
|
616
|
-
var
|
|
617
|
-
var
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
isAllFoldersSelected: false,
|
|
628
|
-
isAllFilesSelected: false,
|
|
629
|
-
currentSelection: []
|
|
630
|
-
});
|
|
748
|
+
key: "updateImportProgress",
|
|
749
|
+
value: function updateImportProgress(foldersCount, filesCount) {
|
|
750
|
+
var _state$folderImportPr;
|
|
751
|
+
var state = this.plugin.getPluginCommonState();
|
|
752
|
+
if ((_state$folderImportPr = state.folderImportProgress) !== null && _state$folderImportPr !== void 0 && _state$folderImportPr.isVisible) {
|
|
753
|
+
var currentProgress = state.folderImportProgress;
|
|
754
|
+
this.plugin.setPluginCommonState({
|
|
755
|
+
folderImportProgress: _objectSpread(_objectSpread({}, currentProgress), {}, {
|
|
756
|
+
foldersCount: (currentProgress.foldersCount || 0) + foldersCount,
|
|
757
|
+
filesCount: (currentProgress.filesCount || 0) + filesCount
|
|
758
|
+
})
|
|
759
|
+
});
|
|
760
|
+
}
|
|
631
761
|
}
|
|
632
762
|
}, {
|
|
633
763
|
key: "providerFileToId",
|
|
@@ -641,7 +771,7 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
641
771
|
}, {
|
|
642
772
|
key: "handleAuth",
|
|
643
773
|
value: function handleAuth() {
|
|
644
|
-
var
|
|
774
|
+
var _this5 = this;
|
|
645
775
|
var authState = btoa(JSON.stringify({
|
|
646
776
|
origin: getOrigin()
|
|
647
777
|
}));
|
|
@@ -650,7 +780,7 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
650
780
|
var authWindow = window.open(link, '_blank');
|
|
651
781
|
var _handleToken = function handleToken(e) {
|
|
652
782
|
if (e.source !== authWindow) {
|
|
653
|
-
|
|
783
|
+
_this5.plugin.filerobot.log("rejecting event from ".concat(e.origin));
|
|
654
784
|
return;
|
|
655
785
|
}
|
|
656
786
|
|
|
@@ -658,13 +788,13 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
658
788
|
// for older Companion versions that used object references
|
|
659
789
|
var data = typeof e.data === 'string' ? JSON.parse(e.data) : e.data;
|
|
660
790
|
if (!data.token) {
|
|
661
|
-
|
|
791
|
+
_this5.plugin.filerobot.log('did not receive token from auth window');
|
|
662
792
|
return;
|
|
663
793
|
}
|
|
664
794
|
authWindow.close();
|
|
665
795
|
window.removeEventListener('message', _handleToken);
|
|
666
|
-
|
|
667
|
-
|
|
796
|
+
_this5.provider.setAuthToken(data.token);
|
|
797
|
+
_this5.preFirstRender();
|
|
668
798
|
};
|
|
669
799
|
window.addEventListener('message', _handleToken);
|
|
670
800
|
}
|
|
@@ -676,85 +806,212 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
676
806
|
if (error.isAuthError) {
|
|
677
807
|
return;
|
|
678
808
|
}
|
|
679
|
-
var message = filerobot.i18n('providerViewCompanionError');
|
|
809
|
+
var message = error.message || error.toString() || filerobot.i18n('providerViewCompanionError');
|
|
680
810
|
filerobot.info({
|
|
681
|
-
message: message
|
|
682
|
-
details: error.toString()
|
|
811
|
+
message: message
|
|
683
812
|
}, 'error', 5000);
|
|
684
813
|
}
|
|
685
814
|
}, {
|
|
686
815
|
key: "handleScroll",
|
|
687
816
|
value: function handleScroll(e) {
|
|
688
|
-
var
|
|
817
|
+
var _this6 = this;
|
|
689
818
|
var scrollPos = e.target.scrollHeight - (e.target.scrollTop + e.target.offsetHeight);
|
|
690
819
|
var path = this.nextPagePath || null;
|
|
691
820
|
if (scrollPos < 50 && path && !this._isHandlingScroll) {
|
|
692
821
|
this.provider.list(path).then(function (res) {
|
|
693
|
-
var
|
|
694
|
-
files =
|
|
695
|
-
folders =
|
|
696
|
-
|
|
822
|
+
var _this6$plugin$getPlug = _this6.plugin.getPluginCommonState(),
|
|
823
|
+
files = _this6$plugin$getPlug.files,
|
|
824
|
+
folders = _this6$plugin$getPlug.folders;
|
|
825
|
+
_this6._updateFilesAndFolders(res, files, folders);
|
|
697
826
|
})["catch"](this.handleError).then(function () {
|
|
698
|
-
|
|
827
|
+
_this6._isHandlingScroll = false;
|
|
699
828
|
}); // always called
|
|
700
829
|
|
|
701
830
|
this._isHandlingScroll = true;
|
|
702
831
|
}
|
|
703
832
|
}
|
|
704
833
|
}, {
|
|
705
|
-
key: "
|
|
706
|
-
value: function
|
|
707
|
-
var
|
|
834
|
+
key: "list",
|
|
835
|
+
value: function list(path) {
|
|
836
|
+
var _this7 = this;
|
|
708
837
|
var files = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
838
|
+
var folders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
709
839
|
files = files || [];
|
|
840
|
+
folders = folders || [];
|
|
710
841
|
return new Promise(function (resolve, reject) {
|
|
711
|
-
|
|
842
|
+
_this7.provider.list(path).then(function (res) {
|
|
712
843
|
res.items.forEach(function (item) {
|
|
713
|
-
if (
|
|
844
|
+
if (item.isFolder) {
|
|
845
|
+
folders.push(item);
|
|
846
|
+
} else {
|
|
714
847
|
files.push(item);
|
|
715
848
|
}
|
|
716
849
|
});
|
|
717
|
-
var
|
|
718
|
-
if (
|
|
719
|
-
return
|
|
720
|
-
|
|
850
|
+
var nextPagePath = res.nextPagePath || null;
|
|
851
|
+
if (nextPagePath) {
|
|
852
|
+
return _this7.list(nextPagePath, files, folders).then(function (_ref4) {
|
|
853
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
854
|
+
files = _ref5[0],
|
|
855
|
+
folders = _ref5[1];
|
|
856
|
+
return resolve([files, folders]);
|
|
721
857
|
})["catch"](function (e) {
|
|
722
858
|
return reject(e);
|
|
723
859
|
});
|
|
724
860
|
} else {
|
|
725
|
-
return resolve(files);
|
|
861
|
+
return resolve([files, folders]);
|
|
726
862
|
}
|
|
727
863
|
})["catch"](function (e) {
|
|
728
864
|
return reject(e);
|
|
729
865
|
});
|
|
730
866
|
});
|
|
731
867
|
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* gets all the current selection items adds them to the uploading panel
|
|
871
|
+
* if folder it would retrieve its files
|
|
872
|
+
* if files they would be added directly
|
|
873
|
+
*
|
|
874
|
+
*/
|
|
732
875
|
}, {
|
|
733
|
-
key: "
|
|
734
|
-
value: function
|
|
876
|
+
key: "addSelectedItems",
|
|
877
|
+
value: async function addSelectedItems() {
|
|
878
|
+
var _this8 = this;
|
|
879
|
+
try {
|
|
880
|
+
var _this$plugin$getPlugi13 = this.plugin.getPluginCommonState(),
|
|
881
|
+
currentSelection = _this$plugin$getPlugi13.currentSelection;
|
|
882
|
+
var remoteMaxFolderCount = this.plugin.filerobot.opts.restrictions.remoteMaxFolderCount;
|
|
883
|
+
|
|
884
|
+
// Pre-validate only restrictions that don't need backend requests
|
|
885
|
+
this.validatePreImportRestrictions(currentSelection, {
|
|
886
|
+
remoteMaxFolderCount: remoteMaxFolderCount
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
// Initialize import tracking state
|
|
890
|
+
this.importState = {
|
|
891
|
+
totalFilesImported: 0,
|
|
892
|
+
totalFoldersImported: 0,
|
|
893
|
+
totalSizeImported: 0,
|
|
894
|
+
filesQueue: [],
|
|
895
|
+
currentDepth: 0,
|
|
896
|
+
shouldStop: false
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
// Set up progressive loading state
|
|
900
|
+
this.plugin.setPluginCommonState({
|
|
901
|
+
folderImportProgress: {
|
|
902
|
+
isVisible: true,
|
|
903
|
+
foldersCount: 0,
|
|
904
|
+
filesCount: 0
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
var promises = currentSelection.map(function (file) {
|
|
908
|
+
if (file.isFolder) {
|
|
909
|
+
return _this8.addFolder(file, '', 1); // Start at depth 1
|
|
910
|
+
} else {
|
|
911
|
+
return _this8.enqueueFile(file);
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
Promise.all(promises).then(function () {
|
|
915
|
+
var _this8$importState, _this8$importState2;
|
|
916
|
+
_this8.plugin.setPluginCommonState({
|
|
917
|
+
folderImportProgress: {
|
|
918
|
+
isVisible: false
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
if (!((_this8$importState = _this8.importState) !== null && _this8$importState !== void 0 && _this8$importState.shouldStop) && ((_this8$importState2 = _this8.importState) === null || _this8$importState2 === void 0 ? void 0 : _this8$importState2.filesQueue.length) > 0) {
|
|
922
|
+
_this8.importState.filesQueue.forEach(function (file) {
|
|
923
|
+
return _this8.addFile(file);
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
_this8.importState = null;
|
|
927
|
+
})["catch"](function (error) {
|
|
928
|
+
_this8.plugin.setPluginCommonState({
|
|
929
|
+
folderImportProgress: {
|
|
930
|
+
isVisible: false
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
_this8.handleImportError(error);
|
|
934
|
+
_this8.importState = null;
|
|
935
|
+
});
|
|
936
|
+
} catch (error) {
|
|
937
|
+
// Hide any loading state and maintain selection
|
|
938
|
+
this.plugin.setPluginCommonState({
|
|
939
|
+
folderImportProgress: {
|
|
940
|
+
isVisible: false
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
// Show error message without clearing selection
|
|
945
|
+
this.plugin.filerobot.info(error.message, 'error', 5000);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Validates restrictions that don't require backend requests
|
|
951
|
+
*/
|
|
952
|
+
}, {
|
|
953
|
+
key: "validatePreImportRestrictions",
|
|
954
|
+
value: function validatePreImportRestrictions(currentSelection, restrictions) {
|
|
955
|
+
var _this$plugin$getPlugi14 = this.plugin.getPluginCommonState(),
|
|
956
|
+
shouldIncludeSubFolders = _this$plugin$getPlugi14.shouldIncludeSubFolders;
|
|
957
|
+
var remoteMaxFolderCount = restrictions.remoteMaxFolderCount;
|
|
958
|
+
var folders = currentSelection.filter(function (item) {
|
|
959
|
+
return item.isFolder;
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
// Check folder count restriction (no backend request needed)
|
|
963
|
+
if (shouldIncludeSubFolders && remoteMaxFolderCount && folders.length > remoteMaxFolderCount) {
|
|
964
|
+
throw new Error(this.plugin.filerobot.i18n('remoteUploadTooManyFoldersSelectedError', {
|
|
965
|
+
limit: remoteMaxFolderCount
|
|
966
|
+
}));
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}, {
|
|
970
|
+
key: "handleImportError",
|
|
971
|
+
value:
|
|
972
|
+
/**
|
|
973
|
+
* Handles import errors by cleaning up state
|
|
974
|
+
*/
|
|
975
|
+
function handleImportError(error) {
|
|
735
976
|
var _this9 = this;
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
if (
|
|
740
|
-
|
|
741
|
-
} else {
|
|
742
|
-
return _this9.addFile(file);
|
|
977
|
+
// Remove any partially imported files from this session
|
|
978
|
+
var files = this.plugin.filerobot.getUploads();
|
|
979
|
+
Object.keys(files).forEach(function (fileId) {
|
|
980
|
+
if (files[fileId].source === _this9.plugin.id) {
|
|
981
|
+
_this9.plugin.filerobot.removeFile(fileId);
|
|
743
982
|
}
|
|
744
983
|
});
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
984
|
+
|
|
985
|
+
// Clear any folder loading states
|
|
986
|
+
this.plugin.setPluginCommonState({
|
|
987
|
+
selectedFolders: {}
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
// Show error message without clearing selection (so user can adjust and try again)
|
|
991
|
+
this.plugin.filerobot.info(error.message, 'error', 5000);
|
|
748
992
|
}
|
|
749
993
|
}, {
|
|
750
994
|
key: "cancelPicking",
|
|
751
995
|
value: function cancelPicking() {
|
|
752
|
-
|
|
996
|
+
var clearSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
997
|
+
if (clearSelection) {
|
|
998
|
+
this.clearSelection();
|
|
999
|
+
}
|
|
1000
|
+
this.plugin.setPluginCommonState({
|
|
1001
|
+
folderImportProgress: {
|
|
1002
|
+
isVisible: false
|
|
1003
|
+
},
|
|
1004
|
+
selectedFolders: {}
|
|
1005
|
+
});
|
|
1006
|
+
this.importState = null;
|
|
1007
|
+
this.provider.cancel();
|
|
753
1008
|
}
|
|
754
1009
|
}, {
|
|
755
1010
|
key: "clearSelection",
|
|
756
1011
|
value: function clearSelection() {
|
|
757
1012
|
this.plugin.setPluginCommonState({
|
|
1013
|
+
isAllFoldersSelected: false,
|
|
1014
|
+
isAllFilesSelected: false,
|
|
758
1015
|
currentSelection: []
|
|
759
1016
|
});
|
|
760
1017
|
}
|
|
@@ -764,7 +1021,10 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
764
1021
|
key: "_loaderWrapper",
|
|
765
1022
|
value: function _loaderWrapper(promise, then, catch_) {
|
|
766
1023
|
var _this10 = this;
|
|
767
|
-
|
|
1024
|
+
this.plugin.setPluginCommonState({
|
|
1025
|
+
loading: true
|
|
1026
|
+
});
|
|
1027
|
+
return promise.then(function (result) {
|
|
768
1028
|
_this10.plugin.setPluginCommonState({
|
|
769
1029
|
loading: false
|
|
770
1030
|
});
|
|
@@ -775,18 +1035,43 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
775
1035
|
});
|
|
776
1036
|
catch_(err);
|
|
777
1037
|
});
|
|
778
|
-
|
|
779
|
-
|
|
1038
|
+
}
|
|
1039
|
+
}, {
|
|
1040
|
+
key: "renderPanelUploadActionButtons",
|
|
1041
|
+
value: function renderPanelUploadActionButtons() {
|
|
1042
|
+
var _this11 = this;
|
|
1043
|
+
if (!this.plugin.filerobot.opts.enableRemoteRecursiveUpload) {
|
|
1044
|
+
return null;
|
|
1045
|
+
}
|
|
1046
|
+
var _this$plugin$getPlugi15 = this.plugin.getPluginCommonState(),
|
|
1047
|
+
shouldIncludeSubFolders = _this$plugin$getPlugi15.shouldIncludeSubFolders,
|
|
1048
|
+
currentSelection = _this$plugin$getPlugi15.currentSelection;
|
|
1049
|
+
var handleToggleIncludeSubfoldersOption = function handleToggleIncludeSubfoldersOption() {
|
|
1050
|
+
return _this11.plugin.setPluginCommonState({
|
|
1051
|
+
shouldIncludeSubFolders: !shouldIncludeSubFolders
|
|
1052
|
+
});
|
|
1053
|
+
};
|
|
1054
|
+
return /*#__PURE__*/_jsx(CheckBoxGroup, {
|
|
1055
|
+
checked: shouldIncludeSubFolders,
|
|
1056
|
+
label: this.plugin.filerobot.i18n('remoteUploadIncludeSubFoldersCheckbox'),
|
|
1057
|
+
labelPosition: "after",
|
|
1058
|
+
disabled: currentSelection.length === 0 || !currentSelection.some(function (item) {
|
|
1059
|
+
return item.isFolder;
|
|
1060
|
+
}),
|
|
1061
|
+
onChange: handleToggleIncludeSubfoldersOption,
|
|
1062
|
+
size: "sm",
|
|
1063
|
+
type: "checkbox"
|
|
780
1064
|
});
|
|
781
1065
|
}
|
|
782
1066
|
}, {
|
|
783
1067
|
key: "render",
|
|
784
1068
|
value: function render(state) {
|
|
785
|
-
var
|
|
1069
|
+
var _this12 = this;
|
|
786
1070
|
var viewOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
787
|
-
var _this$plugin$
|
|
788
|
-
authenticated = _this$plugin$
|
|
789
|
-
didFirstRender = _this$plugin$
|
|
1071
|
+
var _this$plugin$getPlugi16 = this.plugin.getPluginCommonState(),
|
|
1072
|
+
authenticated = _this$plugin$getPlugi16.authenticated,
|
|
1073
|
+
didFirstRender = _this$plugin$getPlugi16.didFirstRender,
|
|
1074
|
+
folderImportProgress = _this$plugin$getPlugi16.folderImportProgress;
|
|
790
1075
|
if (!didFirstRender) {
|
|
791
1076
|
this.preFirstRender();
|
|
792
1077
|
}
|
|
@@ -795,7 +1080,7 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
795
1080
|
// have changed above.
|
|
796
1081
|
if (this.plugin.getPluginCommonState().loading) {
|
|
797
1082
|
return /*#__PURE__*/_jsx(CloseWrapper, {
|
|
798
|
-
onUnmount: this.
|
|
1083
|
+
onUnmount: this.cancelPicking,
|
|
799
1084
|
children: /*#__PURE__*/_jsx(LoaderView, {
|
|
800
1085
|
loaderLabel: this.plugin.filerobot.i18n('loaderLoadingLabel')
|
|
801
1086
|
})
|
|
@@ -803,7 +1088,7 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
803
1088
|
}
|
|
804
1089
|
if (!authenticated) {
|
|
805
1090
|
return /*#__PURE__*/_jsx(CloseWrapper, {
|
|
806
|
-
onUnmount: this.
|
|
1091
|
+
onUnmount: this.cancelPicking,
|
|
807
1092
|
children: /*#__PURE__*/_jsx(AuthView, {
|
|
808
1093
|
pluginName: this.plugin.title,
|
|
809
1094
|
pluginIcon: this.plugin.icon,
|
|
@@ -828,21 +1113,29 @@ var ProviderView = /*#__PURE__*/function () {
|
|
|
828
1113
|
isChecked: this.isChecked,
|
|
829
1114
|
toggleCheckbox: this.toggleCheckbox,
|
|
830
1115
|
handleScroll: this.handleScroll,
|
|
831
|
-
|
|
832
|
-
done: this.
|
|
1116
|
+
list: this.list,
|
|
1117
|
+
done: this.addSelectedItems,
|
|
833
1118
|
cancel: this.cancelPicking,
|
|
834
1119
|
title: this.plugin.title,
|
|
835
1120
|
pluginIcon: this.plugin.icon,
|
|
836
1121
|
i18n: this.plugin.filerobot.i18n,
|
|
837
1122
|
updateFilesAndFolders: function updateFilesAndFolders() {
|
|
838
|
-
return
|
|
1123
|
+
return _this12._updateFilesAndFolders.apply(_this12, arguments);
|
|
839
1124
|
},
|
|
840
1125
|
toggleAllFilesSelection: this.toggleAllFilesSelection,
|
|
841
1126
|
toggleAllFoldersSelection: this.toggleAllFoldersSelection
|
|
842
1127
|
}));
|
|
843
|
-
return /*#__PURE__*/
|
|
844
|
-
onUnmount: this.
|
|
845
|
-
children: /*#__PURE__*/_jsx(Browser, _objectSpread({}, browserProps))
|
|
1128
|
+
return /*#__PURE__*/_jsxs(CloseWrapper, {
|
|
1129
|
+
onUnmount: this.cancelPicking,
|
|
1130
|
+
children: [/*#__PURE__*/_jsx(Browser, _objectSpread({}, browserProps)), (folderImportProgress === null || folderImportProgress === void 0 ? void 0 : folderImportProgress.isVisible) && /*#__PURE__*/_jsx(FolderImportProgress, {
|
|
1131
|
+
i18n: this.plugin.filerobot.i18n,
|
|
1132
|
+
foldersCount: folderImportProgress.foldersCount || 0,
|
|
1133
|
+
filesCount: folderImportProgress.filesCount || 0,
|
|
1134
|
+
message: this.plugin.filerobot.i18n('remoteUploadFolderImportProgressMessage'),
|
|
1135
|
+
cancel: function cancel() {
|
|
1136
|
+
return _this12.cancelPicking(false);
|
|
1137
|
+
}
|
|
1138
|
+
})]
|
|
846
1139
|
});
|
|
847
1140
|
}
|
|
848
1141
|
}]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-provider-views",
|
|
3
3
|
"description": "View library for Scaleflex remote provider plugins.",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"style": "dist/style.min.css",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@scaleflex/icons": "^3.0.0-beta.11",
|
|
19
19
|
"@scaleflex/ui": "^3.0.0-beta.11",
|
|
20
|
-
"@scaleflex/widget-common": "^0.1
|
|
21
|
-
"@scaleflex/widget-icons": "^0.1
|
|
22
|
-
"@scaleflex/widget-utils": "^0.1
|
|
20
|
+
"@scaleflex/widget-common": "^0.2.1",
|
|
21
|
+
"@scaleflex/widget-icons": "^0.2.1",
|
|
22
|
+
"@scaleflex/widget-utils": "^0.2.1",
|
|
23
23
|
"classnames": "^2.2.6",
|
|
24
24
|
"use-context-selector": "^1.3.9"
|
|
25
25
|
},
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"react": ">=19.0.0",
|
|
33
33
|
"react-dom": ">=19.0.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a195e3fe116e2bec65550e5390ae71496eec0d90"
|
|
36
36
|
}
|