@scaleflex/widget-explorer 4.0.7 → 4.3.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 +12145 -12100
- package/LICENSE +21 -21
- package/README.md +1267 -1235
- package/dist/style.css +1438 -1094
- package/dist/style.min.css +1 -1
- 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/index.scss +55 -55
- package/lib/components/Details/FileItem/style.scss +11 -11
- package/lib/components/Drawer/ResizerCore.js +3 -3
- package/lib/components/FileItem/PreUploadFileThumbnail/index.scss +19 -19
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/GeneralSection.js +1 -1
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.constants.js +7 -3
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.styled.js +4 -2
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.thunks.js +45 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsContent.js +15 -1
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTabs.js +11 -3
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTopOptions.js +4 -4
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/index.js +194 -27
- package/lib/components/FileWindowPanel/Header/BeforeUploadActionBtns.js +4 -4
- package/lib/components/FoldersView/index.js +29 -3
- package/lib/components/GalleryRoleSelect/GalleryRoleSelect.utils.js +3 -3
- package/lib/components/GalleryRoleSelect/index.js +11 -11
- package/lib/components/Modals/AddNewFolder/AddNewFolder.hooks.js +99 -0
- package/lib/components/Modals/AddNewFolder/index.js +1 -0
- package/lib/components/Modals/TransformedDownload/TransformedDownload.hooks.js +11 -11
- package/lib/components/Modals/TransformedDownload/TransformedDownload.utils.js +4 -4
- package/lib/components/Modals/index.js +1 -0
- package/lib/components/TopBar/index.scss +20 -20
- package/lib/components/UrlBuilderModal/index.js +6 -2
- package/lib/components/common/FileMetadataFieldValue/FileMetadataFieldValue.utils.js +12 -8
- package/lib/components/metadata.adapter.js +18 -18
- package/lib/defaultLocale.js +8 -1
- package/lib/hooks/useEditFileDetails.js +5 -5
- package/lib/hooks/useFileMetadata.js +5 -3
- package/lib/hooks/useIsSmallScreen.js +6 -6
- package/lib/hooks/useValidateFileName.js +22 -22
- package/lib/index.js +155 -151
- package/lib/slices/files.slice.js +15 -15
- package/lib/slices/folders.slice.js +9 -9
- package/lib/slices/metadata.slice.js +9 -2
- package/lib/style.scss +268 -268
- package/lib/utils/SearchSuggestions/SearchSuggestionsMenu.js +4 -4
- package/lib/utils/createSuperFocus.js +5 -5
- package/lib/utils/filters.js +3 -3
- package/lib/utils/formatPinSubTitle.js +6 -6
- package/lib/utils/getActiveOverlayEl.js +2 -2
- package/lib/utils/truncateString.js +7 -7
- package/package.json +8 -8
- package/types/index.d.ts +102 -102
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;
|
|
@@ -921,10 +921,10 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
921
921
|
}));
|
|
922
922
|
}
|
|
923
923
|
});
|
|
924
|
-
/**
|
|
925
|
-
* Event handler fired after the whole upload process is done whether with success, failure or both.
|
|
926
|
-
*
|
|
927
|
-
* @param {Object} uploadResultObject
|
|
924
|
+
/**
|
|
925
|
+
* Event handler fired after the whole upload process is done whether with success, failure or both.
|
|
926
|
+
*
|
|
927
|
+
* @param {Object} uploadResultObject
|
|
928
928
|
*/
|
|
929
929
|
_defineProperty(_this, "handleComplete", function (_ref6) {
|
|
930
930
|
var failed = _ref6.failed;
|
|
@@ -949,9 +949,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
949
949
|
_this.initEvents();
|
|
950
950
|
}
|
|
951
951
|
});
|
|
952
|
-
/**
|
|
953
|
-
* Initializes event handlers for different event listeners on the plugin capturing/loading.
|
|
954
|
-
*
|
|
952
|
+
/**
|
|
953
|
+
* Initializes event handlers for different event listeners on the plugin capturing/loading.
|
|
954
|
+
*
|
|
955
955
|
*/
|
|
956
956
|
_defineProperty(_this, "initEvents", function () {
|
|
957
957
|
if (!_this.el) {
|
|
@@ -1014,9 +1014,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1014
1014
|
window.history.replaceState = _this._replaceStateProxy.proxy;
|
|
1015
1015
|
}
|
|
1016
1016
|
});
|
|
1017
|
-
/**
|
|
1018
|
-
* Removes the event handlers assigned on the plugin's capturing/initialization.
|
|
1019
|
-
*
|
|
1017
|
+
/**
|
|
1018
|
+
* Removes the event handlers assigned on the plugin's capturing/initialization.
|
|
1019
|
+
*
|
|
1020
1020
|
*/
|
|
1021
1021
|
_defineProperty(_this, "removeEvents", function () {
|
|
1022
1022
|
var showModalTrigger = findAllDOMElements(_this.opts.trigger);
|
|
@@ -1045,9 +1045,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1045
1045
|
window.history.replaceState = _this._replaceStateProxy.nativeFn || window.history.replaceState;
|
|
1046
1046
|
}
|
|
1047
1047
|
});
|
|
1048
|
-
/**
|
|
1049
|
-
* Handles focusing after each state update of the plugin.
|
|
1050
|
-
*
|
|
1048
|
+
/**
|
|
1049
|
+
* Handles focusing after each state update of the plugin.
|
|
1050
|
+
*
|
|
1051
1051
|
*/
|
|
1052
1052
|
_defineProperty(_this, "superFocusOnEachUpdate", function () {
|
|
1053
1053
|
if (!_this.el) {
|
|
@@ -1075,23 +1075,23 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1075
1075
|
_this.superFocus.cancel();
|
|
1076
1076
|
}
|
|
1077
1077
|
});
|
|
1078
|
-
/**
|
|
1079
|
-
* The function fired after each state update, debounced.
|
|
1080
|
-
*
|
|
1078
|
+
/**
|
|
1079
|
+
* The function fired after each state update, debounced.
|
|
1080
|
+
*
|
|
1081
1081
|
*/
|
|
1082
1082
|
_defineProperty(_this, "afterUpdate", function () {
|
|
1083
1083
|
_this.superFocusOnEachUpdate();
|
|
1084
1084
|
});
|
|
1085
|
-
/**
|
|
1086
|
-
* pause uploading for the provided file.
|
|
1087
|
-
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1085
|
+
/**
|
|
1086
|
+
* pause uploading for the provided file.
|
|
1087
|
+
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1088
1088
|
*/
|
|
1089
1089
|
_defineProperty(_this, "pauseUpload", function (fileId) {
|
|
1090
1090
|
_this.filerobot.pauseResume(fileId);
|
|
1091
1091
|
});
|
|
1092
|
-
/**
|
|
1093
|
-
* retry uploading for the provided file.
|
|
1094
|
-
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1092
|
+
/**
|
|
1093
|
+
* retry uploading for the provided file.
|
|
1094
|
+
* @param {String} fileId - The id of the file which uploading process would be canceled.
|
|
1095
1095
|
*/
|
|
1096
1096
|
_defineProperty(_this, "retryUpload", function (fileId) {
|
|
1097
1097
|
_this.filerobot.retryUpload(fileId);
|
|
@@ -1393,7 +1393,11 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1393
1393
|
defaultFieldKeyOfBulkEditPanel: '',
|
|
1394
1394
|
hideDetailsViewButton: false,
|
|
1395
1395
|
hideVariationsTab: false,
|
|
1396
|
-
hideMetadataTab: false
|
|
1396
|
+
hideMetadataTab: false,
|
|
1397
|
+
hideFileSpecsMetadataFields: false,
|
|
1398
|
+
variationsHideManualSubTab: false,
|
|
1399
|
+
variationsShowAddPresetButton: false,
|
|
1400
|
+
hideTopBarAddFolderButton: false
|
|
1397
1401
|
};
|
|
1398
1402
|
|
|
1399
1403
|
// merge default options with the ones set by user
|
|
@@ -1420,9 +1424,9 @@ var Explorer = /*#__PURE__*/function (_Plugin) {
|
|
|
1420
1424
|
return _this;
|
|
1421
1425
|
}
|
|
1422
1426
|
|
|
1423
|
-
/**
|
|
1424
|
-
* Any state value that doesn't have a proper slice (container) then it will be stored in the common state here.
|
|
1425
|
-
* @param {Object} update - the object with the new values to be updated in the common state.
|
|
1427
|
+
/**
|
|
1428
|
+
* Any state value that doesn't have a proper slice (container) then it will be stored in the common state here.
|
|
1429
|
+
* @param {Object} update - the object with the new values to be updated in the common state.
|
|
1426
1430
|
*/
|
|
1427
1431
|
_inherits(Explorer, _Plugin);
|
|
1428
1432
|
return _createClass(Explorer, [{
|
|
@@ -42,15 +42,15 @@ import { getMetaRegionalGroupsLanguagesApiValues } from '../components/metadata.
|
|
|
42
42
|
import { selectActiveRegionalLang, selectIsCdnPermalinkEnabled, selectMetadataRegionalGroups } from './metadata.slice';
|
|
43
43
|
import { adaptFiltersToBackendNotation } from '../utils/filters';
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* The order of the code in slice file is:
|
|
47
|
-
* 1. initialState (*No* export needed)
|
|
48
|
-
* 2. automated thunks functions -- uses createThunk API-- (export needed)
|
|
49
|
-
* 3. createSlice (*No* export needed)
|
|
50
|
-
* 4. actions exports
|
|
51
|
-
* 5. selectors (export needed)
|
|
52
|
-
* 6. default reducer export
|
|
53
|
-
*
|
|
45
|
+
/**
|
|
46
|
+
* The order of the code in slice file is:
|
|
47
|
+
* 1. initialState (*No* export needed)
|
|
48
|
+
* 2. automated thunks functions -- uses createThunk API-- (export needed)
|
|
49
|
+
* 3. createSlice (*No* export needed)
|
|
50
|
+
* 4. actions exports
|
|
51
|
+
* 5. selectors (export needed)
|
|
52
|
+
* 6. default reducer export
|
|
53
|
+
*
|
|
54
54
|
*/
|
|
55
55
|
var slicePropName = 'files';
|
|
56
56
|
export var sliceName = "".concat(PLUGINS_IDS.EXPLORER, "/").concat(slicePropName);
|
|
@@ -309,12 +309,12 @@ var updateFilesSorting = function updateFilesSorting(_ref11) {
|
|
|
309
309
|
}
|
|
310
310
|
return !sortBy ? undefined : "".concat(sortBy, ":").concat(sortOrder);
|
|
311
311
|
};
|
|
312
|
-
/**
|
|
313
|
-
* cachedViewQueries === { [key]: value }, means we are fetching the files for which view-mode/feature (folder/label/...etc), examples:
|
|
314
|
-
* { folder: 'folderUuid' } or { labels: 'labelSid' }
|
|
315
|
-
* or { search: 'searchQuery' } or { search: 'searchQuery', folder: 'folderPath' }
|
|
316
|
-
* -- u could add `recursive: true` to be cached with the view also to be considered always in the request till changing the view.
|
|
317
|
-
*
|
|
312
|
+
/**
|
|
313
|
+
* cachedViewQueries === { [key]: value }, means we are fetching the files for which view-mode/feature (folder/label/...etc), examples:
|
|
314
|
+
* { folder: 'folderUuid' } or { labels: 'labelSid' }
|
|
315
|
+
* or { search: 'searchQuery' } or { search: 'searchQuery', folder: 'folderPath' }
|
|
316
|
+
* -- u could add `recursive: true` to be cached with the view also to be considered always in the request till changing the view.
|
|
317
|
+
*
|
|
318
318
|
*/
|
|
319
319
|
// `lastViewOptions` - used to keep tracked of the last applied view for fetchFiles...
|
|
320
320
|
// to be used in fetching files again for the same query without providing query one more time (easier to call the thunk from anyplace without query or complex/spaghetti logic).
|
|
@@ -33,15 +33,15 @@ import { extractFolderTreeSlice } from '../components/FoldersView/FoldersTree/Fo
|
|
|
33
33
|
import getParentFolderPath from '../utils/getParentFolderPath';
|
|
34
34
|
import { selectFilesSortedBy, selectFilesSortOrder } from './files.slice';
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* The order of the code in slice file is:
|
|
38
|
-
* 1. getInitialState (*No* export needed)
|
|
39
|
-
* 2. automated thunks functions -- uses createThunk API-- (export needed)
|
|
40
|
-
* 3. createSlice (*No* export needed)
|
|
41
|
-
* 4. actions exports
|
|
42
|
-
* 5. selectors (export needed)
|
|
43
|
-
* 6. default reducer export
|
|
44
|
-
*
|
|
36
|
+
/**
|
|
37
|
+
* The order of the code in slice file is:
|
|
38
|
+
* 1. getInitialState (*No* export needed)
|
|
39
|
+
* 2. automated thunks functions -- uses createThunk API-- (export needed)
|
|
40
|
+
* 3. createSlice (*No* export needed)
|
|
41
|
+
* 4. actions exports
|
|
42
|
+
* 5. selectors (export needed)
|
|
43
|
+
* 6. default reducer export
|
|
44
|
+
*
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
47
|
var addedFolderExtraProps = {
|
|
@@ -325,6 +325,12 @@ var metadataSlice = createSlice({
|
|
|
325
325
|
regionalFilters: regionalFilters,
|
|
326
326
|
version: (_metadata$version2 = metadata === null || metadata === void 0 ? void 0 : metadata.version) !== null && _metadata$version2 !== void 0 ? _metadata$version2 : null
|
|
327
327
|
});
|
|
328
|
+
},
|
|
329
|
+
presetsUpdated: function presetsUpdated(state, action) {
|
|
330
|
+
var _action$payload;
|
|
331
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
332
|
+
presets: (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.presets) || []
|
|
333
|
+
});
|
|
328
334
|
}
|
|
329
335
|
},
|
|
330
336
|
extraReducers: function extraReducers(builder) {
|
|
@@ -348,8 +354,9 @@ var _metadataSlice$action = metadataSlice.actions,
|
|
|
348
354
|
metadataUpdated = _metadataSlice$action.metadataUpdated,
|
|
349
355
|
metadataRegionalFiltersSet = _metadataSlice$action.metadataRegionalFiltersSet,
|
|
350
356
|
itemMetadataErrorsUpdated = _metadataSlice$action.itemMetadataErrorsUpdated,
|
|
351
|
-
metadataAdaptAndSet = _metadataSlice$action.metadataAdaptAndSet
|
|
352
|
-
|
|
357
|
+
metadataAdaptAndSet = _metadataSlice$action.metadataAdaptAndSet,
|
|
358
|
+
presetsUpdated = _metadataSlice$action.presetsUpdated;
|
|
359
|
+
export { metadataUpdated, metadataRegionalFiltersSet, itemMetadataErrorsUpdated, metadataAdaptAndSet, presetsUpdated };
|
|
353
360
|
export var selectMetadata = function selectMetadata(state) {
|
|
354
361
|
var _state$PLUGINS_IDS$EX;
|
|
355
362
|
return ((_state$PLUGINS_IDS$EX = state[PLUGINS_IDS.EXPLORER]) === null || _state$PLUGINS_IDS$EX === void 0 ? void 0 : _state$PLUGINS_IDS$EX[slicePropName]) || initialState;
|