@scaleflex/widget-explorer 4.8.5 → 4.8.7
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/LICENSE +21 -21
- package/README.md +1293 -1293
- package/dist/style.css +18 -10
- package/dist/style.min.css +1 -1
- package/lib/components/AssetsList/GridView/FilesSection/FileCell.js +2 -2
- package/lib/components/AssetsList/GridView/FilesSection/index.js +2 -2
- package/lib/components/AssetsList/GridView/FoldersSection/FolderCell.js +2 -2
- package/lib/components/AssetsList/GridView/FoldersSection/FolderTopOptions.js +2 -2
- package/lib/components/AssetsList/GridView/FoldersSection/index.js +2 -2
- package/lib/components/AssetsList/GridView/index.js +2 -2
- package/lib/components/AssetsList/SearchView.hook.js +24 -24
- package/lib/components/AssetsList/__SearchTestPannel.js +27 -27
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/columns.utils.js +2 -2
- package/lib/components/CropPanel/ImageOptions.js +2 -2
- package/lib/components/CropPanel/index.scss +55 -55
- package/lib/components/Details/FileItem/style.scss +11 -11
- package/lib/components/Details/TabPanels.js +2 -2
- package/lib/components/Drawer/Drawer.utils.js +0 -9
- package/lib/components/Drawer/ResizerCore.js +3 -3
- package/lib/components/ExploreView.js +2 -2
- package/lib/components/FileItem/FileUploadTopOptions.js +2 -2
- package/lib/components/FileItem/PreUploadFileThumbnail/index.scss +19 -19
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTopOptions.js +4 -4
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/index.js +2 -2
- package/lib/components/FileWindowPanel/Header/BeforeUploadActionBtns.js +4 -4
- package/lib/components/Filters/Placeholder.js +2 -2
- package/lib/components/FoldersView/FoldersTree/SearchedFoldersItem.js +2 -2
- package/lib/components/GalleryRoleSelect/GalleryRoleSelect.utils.js +3 -3
- package/lib/components/GalleryRoleSelect/index.js +11 -11
- package/lib/components/Modals/TransformedDownload/TransformedDownload.hooks.js +11 -11
- package/lib/components/Modals/TransformedDownload/TransformedDownload.utils.js +4 -4
- package/lib/components/TopBar/index.scss +20 -20
- package/lib/components/UploadsPanel/UploadsList/UploadsVirtualGrid.js +2 -2
- package/lib/components/common/FileMetadataFieldValue/FileMetadataFieldValue.utils.js +2 -2
- package/lib/components/metadata.adapter.js +20 -20
- package/lib/hooks/useAssetsPicker.js +2 -2
- package/lib/hooks/useEditFileDetails.js +7 -7
- package/lib/hooks/useIsSmallScreen.js +6 -6
- package/lib/hooks/useValidateFileName.js +22 -22
- package/lib/index.js +150 -150
- package/lib/slices/files.slice.js +17 -17
- package/lib/slices/filters.slice.js +2 -2
- package/lib/slices/folders.slice.js +17 -13
- package/lib/slices/metadata.slice.js +2 -2
- package/lib/slices/search.slice.js +2 -2
- package/lib/slices/views.slice.js +2 -2
- package/lib/style.scss +276 -268
- package/lib/thunks/uploads.thunks.js +2 -2
- package/lib/utils/SearchSuggestions/SearchSuggestionsMenu.js +4 -4
- package/lib/utils/createSuperFocus.js +5 -5
- package/lib/utils/filters.js +5 -5
- package/lib/utils/formatPinSubTitle.js +6 -6
- package/lib/utils/getActiveOverlayEl.js +2 -2
- package/lib/utils/truncateString.js +7 -7
- package/package.json +54 -54
- package/types/index.d.ts +102 -102
- package/CHANGELOG.md +0 -12305
|
@@ -2,12 +2,12 @@ import { useSelector } from 'react-redux';
|
|
|
2
2
|
import { useTheme } from '@scaleflex/ui/theme/hooks';
|
|
3
3
|
import { selectContainerWidth } from '../slices/common.slice';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* check if the widget container <= 1085px
|
|
7
|
-
*
|
|
8
|
-
* @param {containerWidth} Number container width
|
|
9
|
-
* @param {theme} Object Scaleflex theme
|
|
10
|
-
* @returns {Boolean}
|
|
5
|
+
/**
|
|
6
|
+
* check if the widget container <= 1085px
|
|
7
|
+
*
|
|
8
|
+
* @param {containerWidth} Number container width
|
|
9
|
+
* @param {theme} Object Scaleflex theme
|
|
10
|
+
* @returns {Boolean}
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
var useIsSmallScreen = function useIsSmallScreen() {
|
|
@@ -45,16 +45,16 @@ var handleError = function handleError(_ref) {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* Validate file name changes, to be able to control extension remove/update.
|
|
50
|
-
* Details: T7195 https://sfx.li/IFr4y01tgqL1wg
|
|
51
|
-
*
|
|
52
|
-
* @param {string} oldName - Old file name that should be changed
|
|
53
|
-
* @param {strign} newName - New file name
|
|
54
|
-
* @param {object} [opts] - Options object
|
|
55
|
-
* @param {boolean} [opts.ignoreChangedNameExtension=false] - If TRUE, fn will ignore extension updates
|
|
56
|
-
*
|
|
57
|
-
* @returns {object} - Object with validation details
|
|
48
|
+
/**
|
|
49
|
+
* Validate file name changes, to be able to control extension remove/update.
|
|
50
|
+
* Details: T7195 https://sfx.li/IFr4y01tgqL1wg
|
|
51
|
+
*
|
|
52
|
+
* @param {string} oldName - Old file name that should be changed
|
|
53
|
+
* @param {strign} newName - New file name
|
|
54
|
+
* @param {object} [opts] - Options object
|
|
55
|
+
* @param {boolean} [opts.ignoreChangedNameExtension=false] - If TRUE, fn will ignore extension updates
|
|
56
|
+
*
|
|
57
|
+
* @returns {object} - Object with validation details
|
|
58
58
|
*/
|
|
59
59
|
var checkFileRenameValidation = function checkFileRenameValidation(oldName, newName) {
|
|
60
60
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
@@ -100,10 +100,10 @@ var checkFileRenameValidation = function checkFileRenameValidation(oldName, newN
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
/**
|
|
104
|
-
* @param {string} name - file name
|
|
105
|
-
*
|
|
106
|
-
* @returns {object} - Object with validation details
|
|
103
|
+
/**
|
|
104
|
+
* @param {string} name - file name
|
|
105
|
+
*
|
|
106
|
+
* @returns {object} - Object with validation details
|
|
107
107
|
*/
|
|
108
108
|
var checkFileNameValidation = function checkFileNameValidation(name) {
|
|
109
109
|
if (checkFileOrFolderNameValidation(name)) {
|
|
@@ -118,14 +118,14 @@ var checkFileNameValidation = function checkFileNameValidation(name) {
|
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* Change file name extension.
|
|
123
|
-
*
|
|
124
|
-
* @param {string} fileName - File name with extension that should be changed
|
|
125
|
-
* @param {string} nextExtension - Extension without dot. For example: 'jpg'
|
|
126
|
-
* @param {string} [prevExtension] - Extension without dot. For example: 'jpg'
|
|
127
|
-
*
|
|
128
|
-
* @returns {string} - File name with updated extension. For example: changeFileNameExtension('file-name.jpg', 'jpg', 'gif') will return file-name.gif
|
|
121
|
+
/**
|
|
122
|
+
* Change file name extension.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} fileName - File name with extension that should be changed
|
|
125
|
+
* @param {string} nextExtension - Extension without dot. For example: 'jpg'
|
|
126
|
+
* @param {string} [prevExtension] - Extension without dot. For example: 'jpg'
|
|
127
|
+
*
|
|
128
|
+
* @returns {string} - File name with updated extension. For example: changeFileNameExtension('file-name.jpg', 'jpg', 'gif') will return file-name.gif
|
|
129
129
|
*/
|
|
130
130
|
var changeFileNameExtension = function changeFileNameExtension(fileName, nextExtension) {
|
|
131
131
|
var prevExtension = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
package/lib/index.js
CHANGED
|
@@ -280,21 +280,21 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
280
280
|
var url = _this._getDeletedUrlQueryParams(keys);
|
|
281
281
|
_this.replaceUrlInBrowser(url);
|
|
282
282
|
});
|
|
283
|
-
/**
|
|
284
|
-
* Initialize the i18n translations provided (default, core and from options) and inits the i18n class's attribute.
|
|
285
|
-
*
|
|
283
|
+
/**
|
|
284
|
+
* Initialize the i18n translations provided (default, core and from options) and inits the i18n class's attribute.
|
|
285
|
+
*
|
|
286
286
|
*/
|
|
287
287
|
_defineProperty(_this, "i18nInit", function () {
|
|
288
288
|
_this.translator = new Translator([_this.defaultLocale, _this.filerobot.locale, _this.opts.locale]);
|
|
289
289
|
_this.i18n = _this.translator.translate.bind(_this.translator);
|
|
290
290
|
_this.i18nArray = _this.translator.translateArray.bind(_this.translator);
|
|
291
291
|
});
|
|
292
|
-
/**
|
|
293
|
-
* Adds the provided plugin to the explorer state for possiblity to be used/called/checked through the explroer.
|
|
294
|
-
*
|
|
295
|
-
* @param {Plugin} plugin - the plugin would be added to the explorer.
|
|
296
|
-
* Plugin = @scaleflex/widget-core/lib/Plugin.js
|
|
297
|
-
* @returns {HTMLElement} this.el - the plugin's wrapper HTML element.
|
|
292
|
+
/**
|
|
293
|
+
* Adds the provided plugin to the explorer state for possiblity to be used/called/checked through the explroer.
|
|
294
|
+
*
|
|
295
|
+
* @param {Plugin} plugin - the plugin would be added to the explorer.
|
|
296
|
+
* Plugin = @scaleflex/widget-core/lib/Plugin.js
|
|
297
|
+
* @returns {HTMLElement} this.el - the plugin's wrapper HTML element.
|
|
298
298
|
*/
|
|
299
299
|
_defineProperty(_this, "addTarget", function (plugin) {
|
|
300
300
|
var callerPluginId = plugin.id || plugin.constructor.name;
|
|
@@ -315,18 +315,18 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
315
315
|
_this.dispatch(targetAdded(target));
|
|
316
316
|
return _this.el;
|
|
317
317
|
});
|
|
318
|
-
/**
|
|
319
|
-
* Removes the provided Plugin from the explorer state.
|
|
320
|
-
*
|
|
321
|
-
* @param {Plugin} plugin - The plugin to be removed from the state
|
|
322
|
-
* Plugin = @scaleflex/widget-core/lib/Plugin.js
|
|
318
|
+
/**
|
|
319
|
+
* Removes the provided Plugin from the explorer state.
|
|
320
|
+
*
|
|
321
|
+
* @param {Plugin} plugin - The plugin to be removed from the state
|
|
322
|
+
* Plugin = @scaleflex/widget-core/lib/Plugin.js
|
|
323
323
|
*/
|
|
324
324
|
_defineProperty(_this, "removeTarget", function (plugin) {
|
|
325
325
|
_this.dispatch(targetRemoved(plugin.id));
|
|
326
326
|
});
|
|
327
|
-
/**
|
|
328
|
-
* Hides all the opened/shown panels in case any is opened.
|
|
329
|
-
*
|
|
327
|
+
/**
|
|
328
|
+
* Hides all the opened/shown panels in case any is opened.
|
|
329
|
+
*
|
|
330
330
|
*/
|
|
331
331
|
_defineProperty(_this, "hideAllPanels", function (cb) {
|
|
332
332
|
if (typeof cb === 'function') {
|
|
@@ -340,11 +340,11 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
340
340
|
closeOthers: true
|
|
341
341
|
}));
|
|
342
342
|
});
|
|
343
|
-
/**
|
|
344
|
-
* Opens the Explorer plugin main modal which is responsible for showing the plugin.
|
|
345
|
-
*
|
|
346
|
-
* @emits {Event} explorer:modal-open
|
|
347
|
-
* @returns {Promise | undefined} promsie
|
|
343
|
+
/**
|
|
344
|
+
* Opens the Explorer plugin main modal which is responsible for showing the plugin.
|
|
345
|
+
*
|
|
346
|
+
* @emits {Event} explorer:modal-open
|
|
347
|
+
* @returns {Promise | undefined} promsie
|
|
348
348
|
*/
|
|
349
349
|
_defineProperty(_this, "openModal", function () {
|
|
350
350
|
var _createPromise = createPromise(),
|
|
@@ -377,12 +377,12 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
377
377
|
_this.filerobot.emit('explorer:modal-open');
|
|
378
378
|
return promise;
|
|
379
379
|
});
|
|
380
|
-
/**
|
|
381
|
-
* Closes the Explorer plugin main modal.
|
|
382
|
-
*
|
|
383
|
-
* @param {Object} opts - options to be used while closing the modal.
|
|
384
|
-
* @emits {Event} explorer:modal-close
|
|
385
|
-
* @returns {Promise | undefeined} promise
|
|
380
|
+
/**
|
|
381
|
+
* Closes the Explorer plugin main modal.
|
|
382
|
+
*
|
|
383
|
+
* @param {Object} opts - options to be used while closing the modal.
|
|
384
|
+
* @emits {Event} explorer:modal-close
|
|
385
|
+
* @returns {Promise | undefeined} promise
|
|
386
386
|
*/
|
|
387
387
|
_defineProperty(_this, "closeModal", function () {
|
|
388
388
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -434,18 +434,18 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
434
434
|
_this._getDeletedUrlQueryParams();
|
|
435
435
|
return promise;
|
|
436
436
|
});
|
|
437
|
-
/**
|
|
438
|
-
* Checks whether the Explorer plugin main modal is opened or not.
|
|
439
|
-
*
|
|
440
|
-
* @returns {Boolean} Anonymous - The state of the main modal whether opened or closed.
|
|
437
|
+
/**
|
|
438
|
+
* Checks whether the Explorer plugin main modal is opened or not.
|
|
439
|
+
*
|
|
440
|
+
* @returns {Boolean} Anonymous - The state of the main modal whether opened or closed.
|
|
441
441
|
*/
|
|
442
442
|
_defineProperty(_this, "isModalOpen", function () {
|
|
443
443
|
return !selectIsPluginModalHidden(_this.getGlobalState());
|
|
444
444
|
});
|
|
445
|
-
/**
|
|
446
|
-
* Calls the modal closing function either the function provided by the user from options or the default one.
|
|
447
|
-
*
|
|
448
|
-
* @returns {Any} Anonymous - The returned value of the user's provided closing fn. or the default closing fn.
|
|
445
|
+
/**
|
|
446
|
+
* Calls the modal closing function either the function provided by the user from options or the default one.
|
|
447
|
+
*
|
|
448
|
+
* @returns {Any} Anonymous - The returned value of the user's provided closing fn. or the default closing fn.
|
|
449
449
|
*/
|
|
450
450
|
_defineProperty(_this, "requestCloseModal", function () {
|
|
451
451
|
if (_this.opts.onRequestCloseModal) {
|
|
@@ -453,29 +453,29 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
453
453
|
}
|
|
454
454
|
return _this.closeModal();
|
|
455
455
|
});
|
|
456
|
-
/**
|
|
457
|
-
* Sets the widget's dark mode ON/OFF.
|
|
458
|
-
*
|
|
459
|
-
* @param {Boolean} isDarkModeOn - Defines whether to turn the dark mode ON or OFF.
|
|
456
|
+
/**
|
|
457
|
+
* Sets the widget's dark mode ON/OFF.
|
|
458
|
+
*
|
|
459
|
+
* @param {Boolean} isDarkModeOn - Defines whether to turn the dark mode ON or OFF.
|
|
460
460
|
*/
|
|
461
461
|
_defineProperty(_this, "setDarkModeCapability", function (isDarkModeOn) {
|
|
462
462
|
// TODO: enable darkMode when it is ready
|
|
463
463
|
// this.dispatch(darkModeUpdated(false))
|
|
464
464
|
});
|
|
465
|
-
/**
|
|
466
|
-
* Handles the widget's dark mode changing.
|
|
467
|
-
*
|
|
468
|
-
* @param {Event} event
|
|
465
|
+
/**
|
|
466
|
+
* Handles the widget's dark mode changing.
|
|
467
|
+
*
|
|
468
|
+
* @param {Event} event
|
|
469
469
|
*/
|
|
470
470
|
_defineProperty(_this, "handleSystemDarkModeChange", function (event) {
|
|
471
471
|
var isDarkModeOnNow = event.matches;
|
|
472
472
|
_this.filerobot.log("[Explorer] Dark mode is ".concat(isDarkModeOnNow ? 'on' : 'off'));
|
|
473
473
|
_this.setDarkModeCapability(isDarkModeOnNow);
|
|
474
474
|
});
|
|
475
|
-
/**
|
|
476
|
-
* Adds files to the widget's state for being uploaded.
|
|
477
|
-
*
|
|
478
|
-
* @param {Array} files - Array of files objects that would be added to the widget's state.
|
|
475
|
+
/**
|
|
476
|
+
* Adds files to the widget's state for being uploaded.
|
|
477
|
+
*
|
|
478
|
+
* @param {Array} files - Array of files objects that would be added to the widget's state.
|
|
479
479
|
*/
|
|
480
480
|
_defineProperty(_this, "addFiles", function (files) {
|
|
481
481
|
var targetFolder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -511,13 +511,13 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
511
511
|
_this.filerobot.log(err);
|
|
512
512
|
}
|
|
513
513
|
});
|
|
514
|
-
/**
|
|
515
|
-
* Listens to resizing of the Explorer plugin container element.
|
|
516
|
-
*
|
|
517
|
-
* * Why make insides/inner of Explorer invisible until first ResizeObserver event is emitted?
|
|
518
|
-
* - ResizeOberserver doesn't emit the first resize event fast enough, users can see the jump from one .filerobot-size-- to another (e.g. in Safari)
|
|
519
|
-
* * Why not apply visibility property to .filerobot-Explorer-inner?
|
|
520
|
-
* - Because ideally, acc to specs, ResizeObserver should see invisible elements as of width 0. So even though applying invisibility to .filerobot-Explorer-inner works now, it may not work in the future.
|
|
514
|
+
/**
|
|
515
|
+
* Listens to resizing of the Explorer plugin container element.
|
|
516
|
+
*
|
|
517
|
+
* * Why make insides/inner of Explorer invisible until first ResizeObserver event is emitted?
|
|
518
|
+
* - ResizeOberserver doesn't emit the first resize event fast enough, users can see the jump from one .filerobot-size-- to another (e.g. in Safari)
|
|
519
|
+
* * Why not apply visibility property to .filerobot-Explorer-inner?
|
|
520
|
+
* - Because ideally, acc to specs, ResizeObserver should see invisible elements as of width 0. So even though applying invisibility to .filerobot-Explorer-inner works now, it may not work in the future.
|
|
521
521
|
*/
|
|
522
522
|
_defineProperty(_this, "startListeningToResize", function () {
|
|
523
523
|
// Watch for Explorer container (`.filerobot-Explorer-inner`) resize
|
|
@@ -555,19 +555,19 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
555
555
|
}
|
|
556
556
|
}, 1000);
|
|
557
557
|
});
|
|
558
|
-
/**
|
|
559
|
-
* Stops the tracking or listening to Explorer plugin container element resizing.
|
|
560
|
-
*
|
|
558
|
+
/**
|
|
559
|
+
* Stops the tracking or listening to Explorer plugin container element resizing.
|
|
560
|
+
*
|
|
561
561
|
*/
|
|
562
562
|
_defineProperty(_this, "stopListeningToResize", function () {
|
|
563
563
|
var _this$resizeObserver;
|
|
564
564
|
(_this$resizeObserver = _this.resizeObserver) === null || _this$resizeObserver === void 0 ? void 0 : _this$resizeObserver.disconnect();
|
|
565
565
|
clearTimeout(_this.makeExplorerInsidesVisibleAnywayTimeout);
|
|
566
566
|
});
|
|
567
|
-
/**
|
|
568
|
-
* Records whether we have been interacting with filerobot/explorer right now, which is then used to determine whether state updates should trigger a refocusing.
|
|
569
|
-
*
|
|
570
|
-
* @param {Event} event
|
|
567
|
+
/**
|
|
568
|
+
* Records whether we have been interacting with filerobot/explorer right now, which is then used to determine whether state updates should trigger a refocusing.
|
|
569
|
+
*
|
|
570
|
+
* @param {Event} event
|
|
571
571
|
*/
|
|
572
572
|
_defineProperty(_this, "recordIfFocusedOnFilerobotRecently", function (event) {
|
|
573
573
|
var _this$el, _this$el$contains;
|
|
@@ -581,9 +581,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
581
581
|
_this.superFocus.cancel();
|
|
582
582
|
}
|
|
583
583
|
});
|
|
584
|
-
/**
|
|
585
|
-
* Updates the history of the browser with the plugin's main modal's name.
|
|
586
|
-
*
|
|
584
|
+
/**
|
|
585
|
+
* Updates the history of the browser with the plugin's main modal's name.
|
|
586
|
+
*
|
|
587
587
|
*/
|
|
588
588
|
_defineProperty(_this, "updateBrowserHistory", function () {
|
|
589
589
|
// Ensure history state does not already contain our modal name to avoid double-pushing
|
|
@@ -595,10 +595,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
595
595
|
// Listen for back button presses
|
|
596
596
|
window.addEventListener('popstate', _this.handlePopState, false);
|
|
597
597
|
});
|
|
598
|
-
/**
|
|
599
|
-
* browser's history popstate event handler fired when back button of the browser pressed.
|
|
600
|
-
*
|
|
601
|
-
* @param {Event} event
|
|
598
|
+
/**
|
|
599
|
+
* browser's history popstate event handler fired when back button of the browser pressed.
|
|
600
|
+
*
|
|
601
|
+
* @param {Event} event
|
|
602
602
|
*/
|
|
603
603
|
_defineProperty(_this, "handlePopState", function (event) {
|
|
604
604
|
// Close the modal if the history state no longer contains our modal name
|
|
@@ -614,10 +614,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
614
614
|
history.go(-1);
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
|
-
/**
|
|
618
|
-
* Event handler for keydown inside the plugin's base/main modal
|
|
619
|
-
*
|
|
620
|
-
* @param {*} event
|
|
617
|
+
/**
|
|
618
|
+
* Event handler for keydown inside the plugin's base/main modal
|
|
619
|
+
*
|
|
620
|
+
* @param {*} event
|
|
621
621
|
*/
|
|
622
622
|
_defineProperty(_this, "handleKeyDownInModal", function (event) {
|
|
623
623
|
// close modal on esc key press, Escape key = 27
|
|
@@ -629,9 +629,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
629
629
|
trapFocus.forModal(event, selectActiveOverlayType(_this.getGlobalState()), _this.el);
|
|
630
630
|
}
|
|
631
631
|
});
|
|
632
|
-
/**
|
|
633
|
-
* Requests modal closing if the user provided closeModalOnClickOutside property with true value.
|
|
634
|
-
*
|
|
632
|
+
/**
|
|
633
|
+
* Requests modal closing if the user provided closeModalOnClickOutside property with true value.
|
|
634
|
+
*
|
|
635
635
|
*/
|
|
636
636
|
_defineProperty(_this, "handleClickOutside", function () {
|
|
637
637
|
if (_this.opts.closeModalOnClickOutside) {
|
|
@@ -644,10 +644,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
});
|
|
647
|
-
/**
|
|
648
|
-
* Adds the found copies files in the clipboard on pasting them.
|
|
649
|
-
*
|
|
650
|
-
* @param {Event} event
|
|
647
|
+
/**
|
|
648
|
+
* Adds the found copies files in the clipboard on pasting them.
|
|
649
|
+
*
|
|
650
|
+
* @param {Event} event
|
|
651
651
|
*/
|
|
652
652
|
_defineProperty(_this, "handlePaste", function (event) {
|
|
653
653
|
if (_this._isPasteAndDnDUploadDisabled() || ['TEXTAREA', 'INPUT'].includes(event.target.tagName)) {
|
|
@@ -668,10 +668,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
668
668
|
_this.addFiles(files);
|
|
669
669
|
}
|
|
670
670
|
});
|
|
671
|
-
/**
|
|
672
|
-
* Event handler for dragOver event for preparing the drag & drop functionality.
|
|
673
|
-
*
|
|
674
|
-
* @param {Event} event
|
|
671
|
+
/**
|
|
672
|
+
* Event handler for dragOver event for preparing the drag & drop functionality.
|
|
673
|
+
*
|
|
674
|
+
* @param {Event} event
|
|
675
675
|
*/
|
|
676
676
|
_defineProperty(_this, "handleDragOver", function (event) {
|
|
677
677
|
if (_this._isPasteAndDnDUploadDisabled()) {
|
|
@@ -689,10 +689,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
689
689
|
isDraggingOver: true
|
|
690
690
|
});
|
|
691
691
|
});
|
|
692
|
-
/**
|
|
693
|
-
* Event handler for dragLeave event for removing the classes shown while dragOver event.
|
|
694
|
-
*
|
|
695
|
-
* @param {Event} event
|
|
692
|
+
/**
|
|
693
|
+
* Event handler for dragLeave event for removing the classes shown while dragOver event.
|
|
694
|
+
*
|
|
695
|
+
* @param {Event} event
|
|
696
696
|
*/
|
|
697
697
|
_defineProperty(_this, "handleDragLeave", function (event) {
|
|
698
698
|
if (_this._isPasteAndDnDUploadDisabled()) {
|
|
@@ -708,10 +708,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
708
708
|
});
|
|
709
709
|
}, 50);
|
|
710
710
|
});
|
|
711
|
-
/**
|
|
712
|
-
* Event handler for drop event for handling the adding of dropped files.
|
|
713
|
-
*
|
|
714
|
-
* @param {Event} event
|
|
711
|
+
/**
|
|
712
|
+
* Event handler for drop event for handling the adding of dropped files.
|
|
713
|
+
*
|
|
714
|
+
* @param {Event} event
|
|
715
715
|
*/
|
|
716
716
|
_defineProperty(_this, "handleDrop", function (event) {
|
|
717
717
|
var _event$dataTransfer$f, _event$dataTransfer$i;
|
|
@@ -759,30 +759,30 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
759
759
|
}
|
|
760
760
|
});
|
|
761
761
|
});
|
|
762
|
-
/**
|
|
763
|
-
* Requests thumbnails for files for being shown to the user.
|
|
764
|
-
*
|
|
765
|
-
* @param {Object} file - The object of the file that thumbnail would be generated for.
|
|
762
|
+
/**
|
|
763
|
+
* Requests thumbnails for files for being shown to the user.
|
|
764
|
+
*
|
|
765
|
+
* @param {Object} file - The object of the file that thumbnail would be generated for.
|
|
766
766
|
*/
|
|
767
767
|
_defineProperty(_this, "handleRequestThumbnail", function (file) {
|
|
768
768
|
if (!_this.opts.waitForThumbnailsBeforeUpload) {
|
|
769
769
|
_this.filerobot.emit('thumbnail:request', file);
|
|
770
770
|
}
|
|
771
771
|
});
|
|
772
|
-
/**
|
|
773
|
-
* Cancels thumbnail requests when a file item component unmounts to avoid clogging up the queue when the user scrolls past many elements.
|
|
774
|
-
*
|
|
775
|
-
* @param {Object} file - the file which its thumbnail generating request should be canceled.
|
|
772
|
+
/**
|
|
773
|
+
* Cancels thumbnail requests when a file item component unmounts to avoid clogging up the queue when the user scrolls past many elements.
|
|
774
|
+
*
|
|
775
|
+
* @param {Object} file - the file which its thumbnail generating request should be canceled.
|
|
776
776
|
*/
|
|
777
777
|
_defineProperty(_this, "handleCancelThumbnail", function (file) {
|
|
778
778
|
if (!_this.opts.waitForThumbnailsBeforeUpload) {
|
|
779
779
|
_this.filerobot.emit('thumbnail:cancel', file);
|
|
780
780
|
}
|
|
781
781
|
});
|
|
782
|
-
/**
|
|
783
|
-
* Event handler for keydown event in plugin's inline mode.
|
|
784
|
-
*
|
|
785
|
-
* @param {Event} event
|
|
782
|
+
/**
|
|
783
|
+
* Event handler for keydown event in plugin's inline mode.
|
|
784
|
+
*
|
|
785
|
+
* @param {Event} event
|
|
786
786
|
*/
|
|
787
787
|
_defineProperty(_this, "handleKeyDownInInline", function (event) {
|
|
788
788
|
// Trap focus on tab key press, Tab key = 9.
|
|
@@ -790,17 +790,17 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
790
790
|
trapFocus.forInline(event, selectActiveOverlayType(_this.getGlobalState()), _this.el);
|
|
791
791
|
}
|
|
792
792
|
});
|
|
793
|
-
/**
|
|
794
|
-
* Event handler for paste event.
|
|
795
|
-
*
|
|
796
|
-
* * Why do we listen to the 'paste' event on a document instead of onPaste={props.handlePaste} prop, or this.el.addEventListener('paste')?
|
|
797
|
-
* - Because (at least) Chrome doesn't handle paste if focus is on some button, e.g. 'My Device'...
|
|
798
|
-
* Therefore, the best option is to listen to all 'paste' events, and only react to them when we are focused on our particular Filerobot instance.
|
|
799
|
-
* * Why do we still need onPaste={props.handlePaste} for the ExplorerUi?
|
|
800
|
-
* - Because if we click on the 'Drop files here' caption e.g., `document.activeElement` will be 'body'. Which means our standard determination of whether we're pasting into our Filerobot instance won't work...
|
|
801
|
-
* Therefore, we need a traditional onPaste={props.handlePaste} handler too.
|
|
802
|
-
*
|
|
803
|
-
* @param {Event} event
|
|
793
|
+
/**
|
|
794
|
+
* Event handler for paste event.
|
|
795
|
+
*
|
|
796
|
+
* * Why do we listen to the 'paste' event on a document instead of onPaste={props.handlePaste} prop, or this.el.addEventListener('paste')?
|
|
797
|
+
* - Because (at least) Chrome doesn't handle paste if focus is on some button, e.g. 'My Device'...
|
|
798
|
+
* Therefore, the best option is to listen to all 'paste' events, and only react to them when we are focused on our particular Filerobot instance.
|
|
799
|
+
* * Why do we still need onPaste={props.handlePaste} for the ExplorerUi?
|
|
800
|
+
* - Because if we click on the 'Drop files here' caption e.g., `document.activeElement` will be 'body'. Which means our standard determination of whether we're pasting into our Filerobot instance won't work...
|
|
801
|
+
* Therefore, we need a traditional onPaste={props.handlePaste} handler too.
|
|
802
|
+
*
|
|
803
|
+
* @param {Event} event
|
|
804
804
|
*/
|
|
805
805
|
_defineProperty(_this, "handlePasteOnBody", function (event) {
|
|
806
806
|
var isFocusInOverlay = _this.el.contains(document.activeElement);
|
|
@@ -808,11 +808,11 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
808
808
|
_this.handlePaste(event);
|
|
809
809
|
}
|
|
810
810
|
});
|
|
811
|
-
/**
|
|
812
|
-
* Public method that used on Hub to sync with burger menu.
|
|
813
|
-
*
|
|
814
|
-
* @param {string} newViewId
|
|
815
|
-
* @param {Object} activationOptions - optional object for providing options used in activation, ex. if the view's activation might accept an initial value to activate for example opening specific label once activating.
|
|
811
|
+
/**
|
|
812
|
+
* Public method that used on Hub to sync with burger menu.
|
|
813
|
+
*
|
|
814
|
+
* @param {string} newViewId
|
|
815
|
+
* @param {Object} activationOptions - optional object for providing options used in activation, ex. if the view's activation might accept an initial value to activate for example opening specific label once activating.
|
|
816
816
|
*/
|
|
817
817
|
_defineProperty(_this, "changeView", function () {
|
|
818
818
|
var newViewId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : VIEW_IDS.FOLDERS;
|
|
@@ -849,11 +849,11 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
849
849
|
name: firstFolderName
|
|
850
850
|
});
|
|
851
851
|
});
|
|
852
|
-
/**
|
|
853
|
-
* Handler which is fired on file uploaded that adds the new uploaded file to the state for being shown without refresh.
|
|
854
|
-
*
|
|
855
|
-
* @param {Object} _file - upload file object.
|
|
856
|
-
* @param {Object} uploadResponse - The uploading process response object.
|
|
852
|
+
/**
|
|
853
|
+
* Handler which is fired on file uploaded that adds the new uploaded file to the state for being shown without refresh.
|
|
854
|
+
*
|
|
855
|
+
* @param {Object} _file - upload file object.
|
|
856
|
+
* @param {Object} uploadResponse - The uploading process response object.
|
|
857
857
|
*/
|
|
858
858
|
_defineProperty(_this, "handleFileUploaded", function (_file, response) {
|
|
859
859
|
var _response$body, _file$data, _currentFolder$path;
|
|
@@ -930,10 +930,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
930
930
|
}));
|
|
931
931
|
}
|
|
932
932
|
});
|
|
933
|
-
/**
|
|
934
|
-
* Event handler fired after the whole upload process is done whether with success, failure or both.
|
|
935
|
-
*
|
|
936
|
-
* @param {Object} uploadResultObject
|
|
933
|
+
/**
|
|
934
|
+
* Event handler fired after the whole upload process is done whether with success, failure or both.
|
|
935
|
+
*
|
|
936
|
+
* @param {Object} uploadResultObject
|
|
937
937
|
*/
|
|
938
938
|
_defineProperty(_this, "handleComplete", function (_ref6) {
|
|
939
939
|
var failed = _ref6.failed,
|
|
@@ -978,9 +978,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
978
978
|
_this.initEvents();
|
|
979
979
|
}
|
|
980
980
|
});
|
|
981
|
-
/**
|
|
982
|
-
* Initializes event handlers for different event listeners on the plugin capturing/loading.
|
|
983
|
-
*
|
|
981
|
+
/**
|
|
982
|
+
* Initializes event handlers for different event listeners on the plugin capturing/loading.
|
|
983
|
+
*
|
|
984
984
|
*/
|
|
985
985
|
_defineProperty(_this, "initEvents", function () {
|
|
986
986
|
if (!_this.el) {
|
|
@@ -1043,9 +1043,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1043
1043
|
window.history.replaceState = _this._replaceStateProxy.proxy;
|
|
1044
1044
|
}
|
|
1045
1045
|
});
|
|
1046
|
-
/**
|
|
1047
|
-
* Removes the event handlers assigned on the plugin's capturing/initialization.
|
|
1048
|
-
*
|
|
1046
|
+
/**
|
|
1047
|
+
* Removes the event handlers assigned on the plugin's capturing/initialization.
|
|
1048
|
+
*
|
|
1049
1049
|
*/
|
|
1050
1050
|
_defineProperty(_this, "removeEvents", function () {
|
|
1051
1051
|
var showModalTrigger = findAllDOMElements(_this.opts.trigger);
|
|
@@ -1074,9 +1074,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1074
1074
|
window.history.replaceState = _this._replaceStateProxy.nativeFn || window.history.replaceState;
|
|
1075
1075
|
}
|
|
1076
1076
|
});
|
|
1077
|
-
/**
|
|
1078
|
-
* Handles focusing after each state update of the plugin.
|
|
1079
|
-
*
|
|
1077
|
+
/**
|
|
1078
|
+
* Handles focusing after each state update of the plugin.
|
|
1079
|
+
*
|
|
1080
1080
|
*/
|
|
1081
1081
|
_defineProperty(_this, "superFocusOnEachUpdate", function () {
|
|
1082
1082
|
if (!_this.el) {
|
|
@@ -1104,23 +1104,23 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1104
1104
|
_this.superFocus.cancel();
|
|
1105
1105
|
}
|
|
1106
1106
|
});
|
|
1107
|
-
/**
|
|
1108
|
-
* The function fired after each state update, debounced.
|
|
1109
|
-
*
|
|
1107
|
+
/**
|
|
1108
|
+
* The function fired after each state update, debounced.
|
|
1109
|
+
*
|
|
1110
1110
|
*/
|
|
1111
1111
|
_defineProperty(_this, "afterUpdate", function () {
|
|
1112
1112
|
_this.superFocusOnEachUpdate();
|
|
1113
1113
|
});
|
|
1114
|
-
/**
|
|
1115
|
-
* pause uploading for the provided file.
|
|
1116
|
-
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1114
|
+
/**
|
|
1115
|
+
* pause uploading for the provided file.
|
|
1116
|
+
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1117
1117
|
*/
|
|
1118
1118
|
_defineProperty(_this, "pauseUpload", function (fileId) {
|
|
1119
1119
|
_this.filerobot.pauseResume(fileId);
|
|
1120
1120
|
});
|
|
1121
|
-
/**
|
|
1122
|
-
* retry uploading for the provided file.
|
|
1123
|
-
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1121
|
+
/**
|
|
1122
|
+
* retry uploading for the provided file.
|
|
1123
|
+
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1124
1124
|
*/
|
|
1125
1125
|
_defineProperty(_this, "retryUpload", function (fileId) {
|
|
1126
1126
|
_this.filerobot.retryUpload(fileId);
|
|
@@ -1454,9 +1454,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1454
1454
|
return _this;
|
|
1455
1455
|
}
|
|
1456
1456
|
|
|
1457
|
-
/**
|
|
1458
|
-
* Any state value that doesn't have a proper slice (container) then it will be stored in the common state here.
|
|
1459
|
-
* @param {Object} update - the object with the new values to be updated in the common state.
|
|
1457
|
+
/**
|
|
1458
|
+
* Any state value that doesn't have a proper slice (container) then it will be stored in the common state here.
|
|
1459
|
+
* @param {Object} update - the object with the new values to be updated in the common state.
|
|
1460
1460
|
*/
|
|
1461
1461
|
_inherits(Explorer, _Plugin);
|
|
1462
1462
|
return _createClass(Explorer, [{
|