@iobroker/adapter-react-v5 2.1.10 → 2.1.11

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.
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
12
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
15
 
14
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -27,9 +29,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
27
29
 
28
30
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
31
 
30
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
31
-
32
- var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
32
+ var _styles = require("@mui/styles");
33
33
 
34
34
  var _react = _interopRequireWildcard(require("react"));
35
35
 
@@ -115,6 +115,8 @@ var _IconClosed = _interopRequireDefault(require("../icons/IconClosed"));
115
115
 
116
116
  var _IconOpen = _interopRequireDefault(require("../icons/IconOpen"));
117
117
 
118
+ var _withWidth = _interopRequireDefault(require("./withWidth"));
119
+
118
120
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
119
121
 
120
122
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -123,17 +125,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
123
125
 
124
126
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
125
127
 
126
- // FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
127
- var withWidth = function withWidth() {
128
- return function (WrappedComponent) {
129
- return function (props) {
130
- return /*#__PURE__*/_react["default"].createElement(WrappedComponent, (0, _extends2["default"])({}, props, {
131
- width: "xs"
132
- }));
133
- };
134
- };
135
- };
136
-
137
128
  var ROW_HEIGHT = 32;
138
129
  var BUTTON_WIDTH = 32;
139
130
  var TILE_HEIGHT = 120;
@@ -158,10 +149,10 @@ var styles = function styles(theme) {
158
149
  padding: theme.spacing(1)
159
150
  },
160
151
  filesDivTable: {
161
- height: "calc(100% - ".concat(48 + theme.spacing(1), "px)")
152
+ height: "calc(100% - ".concat(48 + parseInt(theme.spacing(1), 10), "px)")
162
153
  },
163
154
  filesDivTile: {
164
- height: "calc(100% - ".concat(48 * 2 + theme.spacing(1), "px)"),
155
+ height: "calc(100% - ".concat(48 * 2 + parseInt(theme.spacing(1), 10), "px)"),
165
156
  display: 'flex',
166
157
  alignContent: 'flex-start',
167
158
  alignItems: 'stretch',
@@ -490,6 +481,25 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
490
481
 
491
482
  (0, _classCallCheck2["default"])(this, FileBrowser);
492
483
  _this = _super.call(this, props);
484
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFileChange", function (id, fileName, size) {
485
+ var key = id + '/' + fileName;
486
+ var pos = key.lastIndexOf('/');
487
+ var folder = key.substring(0, pos);
488
+ console.log("File changed ".concat(key, "[").concat(size, "]"));
489
+
490
+ if (_this.state.folders[folder]) {
491
+ _this._tempTimeout[folder] && clearTimeout(_this._tempTimeout[folder]);
492
+ _this._tempTimeout[folder] = setTimeout(function () {
493
+ delete _this._tempTimeout[folder];
494
+
495
+ _this.browseFolder(folder, true).then(function (folders) {
496
+ return _this.setState({
497
+ folders: folders
498
+ });
499
+ });
500
+ }, 300);
501
+ }
502
+ });
493
503
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setStateBackgroundImage", function () {
494
504
  var array = ['light', 'dark', 'colored', 'delete'];
495
505
 
@@ -584,6 +594,8 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
584
594
  _this.browseList = [];
585
595
  _this.browseListRunning = false;
586
596
  _this.initialReadFinished = false;
597
+ _this.supportSubscribes = null;
598
+ _this._tempTimeout = {};
587
599
  return _this;
588
600
  }
589
601
 
@@ -640,31 +652,42 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
640
652
  }, {
641
653
  key: "componentDidMount",
642
654
  value: function componentDidMount() {
655
+ var _this3 = this;
656
+
643
657
  this.mounted = true;
644
658
  this.loadFolders();
659
+ return this.props.socket.checkFeatureSupported('BINARY_STATE_EVENT').then(function (result) {
660
+ _this3.supportSubscribes = result;
661
+ _this3.supportSubscribes && _this3.props.socket.subscribeFiles('*', '*', _this3.onFileChange);
662
+ });
645
663
  }
646
664
  }, {
647
665
  key: "componentWillUnmount",
648
666
  value: function componentWillUnmount() {
667
+ this.supportSubscribes && this.props.socket.unsubscribeFiles('*', '*', this.onFileChange);
649
668
  this.mounted = false;
650
669
  this.browseList = null;
651
670
  this.browseListRunning = false;
671
+ Object.values(this._tempTimeout).forEach(function (timer) {
672
+ return timer && clearTimeout(timer);
673
+ });
674
+ this._tempTimeout = {};
652
675
  }
653
676
  }, {
654
677
  key: "browseFolders",
655
678
  value: function browseFolders(foldersList, _newFolders, _resolve) {
656
- var _this3 = this;
679
+ var _this4 = this;
657
680
 
658
681
  if (!_newFolders) {
659
682
  _newFolders = {};
660
683
  Object.keys(this.state.folders).forEach(function (folder) {
661
- return _newFolders[folder] = _this3.state.folders[folder];
684
+ return _newFolders[folder] = _this4.state.folders[folder];
662
685
  });
663
686
  }
664
687
 
665
688
  if (!_resolve) {
666
689
  return new Promise(function (resolve) {
667
- return _this3.browseFolders(foldersList, _newFolders, resolve);
690
+ return _this4.browseFolders(foldersList, _newFolders, resolve);
668
691
  });
669
692
  }
670
693
 
@@ -673,11 +696,11 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
673
696
  } else {
674
697
  this.browseFolder(foldersList.shift(), _newFolders).then(function () {
675
698
  return setTimeout(function () {
676
- return _this3.browseFolders(foldersList, _newFolders, _resolve);
699
+ return _this4.browseFolders(foldersList, _newFolders, _resolve);
677
700
  }, 0);
678
701
  })["catch"](function () {
679
702
  return setTimeout(function () {
680
- return _this3.browseFolders(foldersList, _newFolders, _resolve);
703
+ return _this4.browseFolders(foldersList, _newFolders, _resolve);
681
704
  }, 0);
682
705
  });
683
706
  }
@@ -685,26 +708,26 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
685
708
  }, {
686
709
  key: "readDirSerial",
687
710
  value: function readDirSerial(adapter, relPath) {
688
- var _this4 = this;
711
+ var _this5 = this;
689
712
 
690
713
  return new Promise(function (resolve, reject) {
691
- if (_this4.browseList) {
714
+ if (_this5.browseList) {
692
715
  // if component still mounted
693
- _this4.browseList.push({
716
+ _this5.browseList.push({
694
717
  resolve: resolve,
695
718
  reject: reject,
696
719
  adapter: adapter,
697
720
  relPath: relPath
698
721
  });
699
722
 
700
- !_this4.browseListRunning && _this4.processBrowseList();
723
+ !_this5.browseListRunning && _this5.processBrowseList();
701
724
  }
702
725
  });
703
726
  }
704
727
  }, {
705
728
  key: "processBrowseList",
706
729
  value: function processBrowseList(level) {
707
- var _this5 = this;
730
+ var _this6 = this;
708
731
 
709
732
  if (!this.browseListRunning && this.browseList && this.browseList.length) {
710
733
  this.browseListRunning = true;
@@ -724,9 +747,9 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
724
747
 
725
748
  this.browseList[0].processing = true;
726
749
  this.props.socket.readDir(this.browseList[0].adapter, this.browseList[0].relPath).then(function (files) {
727
- if (_this5.browseList) {
750
+ if (_this6.browseList) {
728
751
  // if component still mounted
729
- var item = _this5.browseList.shift();
752
+ var item = _this6.browseList.shift();
730
753
 
731
754
  if (item) {
732
755
  var resolve = item.resolve;
@@ -735,31 +758,31 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
735
758
  item.adapter = null;
736
759
  item.relPath = null;
737
760
  resolve(files);
738
- _this5.browseListRunning = false;
761
+ _this6.browseListRunning = false;
739
762
 
740
- if (_this5.browseList.length) {
763
+ if (_this6.browseList.length) {
741
764
  if (level < 5) {
742
- _this5.processBrowseList(level + 1);
765
+ _this6.processBrowseList(level + 1);
743
766
  } else {
744
767
  setTimeout(function () {
745
- return _this5.processBrowseList(0);
768
+ return _this6.processBrowseList(0);
746
769
  }, 0);
747
770
  }
748
771
  } else {
749
- _this5.setState({
772
+ _this6.setState({
750
773
  queueLength: 0
751
774
  });
752
775
  }
753
776
  } else {
754
- _this5.setState({
777
+ _this6.setState({
755
778
  queueLength: 0
756
779
  });
757
780
  }
758
781
  }
759
782
  })["catch"](function (e) {
760
- if (_this5.browseList) {
783
+ if (_this6.browseList) {
761
784
  // if component still mounted
762
- var item = _this5.browseList.shift();
785
+ var item = _this6.browseList.shift();
763
786
 
764
787
  if (item) {
765
788
  var reject = item.reject;
@@ -768,23 +791,23 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
768
791
  item.adapter = null;
769
792
  item.relPath = null;
770
793
  reject(e);
771
- _this5.browseListRunning = false;
794
+ _this6.browseListRunning = false;
772
795
 
773
- if (_this5.browseList.length) {
796
+ if (_this6.browseList.length) {
774
797
  if (level < 5) {
775
- _this5.processBrowseList(level + 1);
798
+ _this6.processBrowseList(level + 1);
776
799
  } else {
777
800
  setTimeout(function () {
778
- return _this5.processBrowseList(0);
801
+ return _this6.processBrowseList(0);
779
802
  }, 0);
780
803
  }
781
804
  } else {
782
- _this5.setState({
805
+ _this6.setState({
783
806
  queueLength: 0
784
807
  });
785
808
  }
786
809
  } else {
787
- _this5.setState({
810
+ _this6.setState({
788
811
  queueLength: 0
789
812
  });
790
813
  }
@@ -794,23 +817,28 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
794
817
  }
795
818
  }, {
796
819
  key: "browseFolder",
797
- value: function browseFolder(folderId, _newFolders, _checkEmpty) {
798
- var _this6 = this;
820
+ value: function browseFolder(folderId, _newFolders, _checkEmpty, force) {
821
+ var _this7 = this;
822
+
823
+ if (typeof _newFolders === 'boolean') {
824
+ force = _newFolders;
825
+ _newFolders = null;
826
+ }
799
827
 
800
828
  if (!_newFolders) {
801
829
  _newFolders = {};
802
830
  Object.keys(this.state.folders).forEach(function (folder) {
803
- return _newFolders[folder] = _this6.state.folders[folder];
831
+ return _newFolders[folder] = _this7.state.folders[folder];
804
832
  });
805
833
  }
806
834
 
807
- if (_newFolders[folderId]) {
835
+ if (_newFolders[folderId] && !force) {
808
836
  if (!_checkEmpty) {
809
837
  return new Promise(function (resolve, reject) {
810
838
  return Promise.all(_newFolders[folderId].filter(function (item) {
811
839
  return item.folder;
812
840
  }).map(function (item) {
813
- return _this6.browseFolder(item.id, _newFolders, true)["catch"](function (error) {});
841
+ return _this7.browseFolder(item.id, _newFolders, true)["catch"](function (error) {});
814
842
  })).then(function () {
815
843
  return resolve(_newFolders);
816
844
  })["catch"](function (error) {
@@ -828,15 +856,15 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
828
856
  var userData = null; // load only adapter.admin and not other meta files like hm-rpc.0.devices.blablabla
829
857
 
830
858
  objs = objs.filter(function (obj) {
831
- if (!_this6.state.expertMode) {
859
+ if (!_this7.state.expertMode) {
832
860
  return obj._id === '0_userdata.0' || obj._id === 'vis.0';
833
861
  } else {
834
862
  return obj._id.split('.').length <= 2;
835
863
  }
836
864
  }); // remember, that all folders are loaded
837
865
 
838
- if (_this6.state.expertMode) {
839
- _this6.setState({
866
+ if (_this7.state.expertMode) {
867
+ _this7.setState({
840
868
  allFoldersLoaded: true,
841
869
  loadFolders: false
842
870
  });
@@ -877,7 +905,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
877
905
  return Promise.all(_folders.filter(function (item) {
878
906
  return item.folder;
879
907
  }).map(function (item) {
880
- return _this6.browseFolder(item.id, _newFolders, true)["catch"](function (error) {});
908
+ return _this7.browseFolder(item.id, _newFolders, true)["catch"](function (error) {});
881
909
  })).then(function () {
882
910
  return _newFolders;
883
911
  });
@@ -885,7 +913,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
885
913
  return _newFolders;
886
914
  }
887
915
  })["catch"](function (e) {
888
- return _this6.initialReadFinished && window.alert('Cannot read meta items: ' + e);
916
+ return _this7.initialReadFinished && window.alert('Cannot read meta items: ' + e);
889
917
  });
890
918
  } else {
891
919
  var parts = folderId.split('/');
@@ -897,7 +925,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
897
925
  var _folders = [];
898
926
  files.forEach(function (file) {
899
927
  var item = {
900
- id: folderId + '/' + file.file,
928
+ id: "".concat(folderId, "/").concat(file.file),
901
929
  ext: _Utils["default"].getFileExtension(file.file),
902
930
  folder: file.isDir,
903
931
  name: file.file,
@@ -918,7 +946,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
918
946
  return Promise.all(_folders.filter(function (item) {
919
947
  return item.folder;
920
948
  }).map(function (item) {
921
- return _this6.browseFolder(item.id, _newFolders, true);
949
+ return _this7.browseFolder(item.id, _newFolders, true);
922
950
  })).then(function () {
923
951
  return _newFolders;
924
952
  });
@@ -926,7 +954,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
926
954
  return _newFolders;
927
955
  }
928
956
  })["catch"](function (e) {
929
- _this6.initialReadFinished && window.alert("Cannot read ".concat(adapter).concat(relPath ? '/' + relPath : '', ": ").concat(e));
957
+ _this7.initialReadFinished && window.alert("Cannot read ".concat(adapter).concat(relPath ? '/' + relPath : '', ": ").concat(e));
930
958
  _newFolders[folderId] = [];
931
959
  return _newFolders;
932
960
  });
@@ -935,7 +963,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
935
963
  }, {
936
964
  key: "toggleFolder",
937
965
  value: function toggleFolder(item, e) {
938
- var _this7 = this;
966
+ var _this8 = this;
939
967
 
940
968
  e && e.stopPropagation();
941
969
  var expanded = (0, _toConsumableArray2["default"])(this.state.expanded);
@@ -948,12 +976,12 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
948
976
 
949
977
  if (!item.temp) {
950
978
  return this.browseFolder(item.id).then(function (folders) {
951
- return _this7.setState({
979
+ return _this8.setState({
952
980
  expanded: expanded,
953
981
  folders: folders
954
982
  });
955
983
  })["catch"](function (err) {
956
- return window.alert(err === NOT_FOUND ? _this7.props.t('ra_Cannot find "%s"', item.id) : _this7.props.t('ra_Cannot read "%s"', item.id));
984
+ return window.alert(err === NOT_FOUND ? _this8.props.t('ra_Cannot find "%s"', item.id) : _this8.props.t('ra_Cannot read "%s"', item.id));
957
985
  });
958
986
  } else {
959
987
  this.setState({
@@ -971,7 +999,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
971
999
  }, {
972
1000
  key: "changeFolder",
973
1001
  value: function changeFolder(e, folder) {
974
- var _this8 = this;
1002
+ var _this9 = this;
975
1003
 
976
1004
  e && e.stopPropagation();
977
1005
  this.lastSelect = Date.now();
@@ -985,14 +1013,14 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
985
1013
 
986
1014
  if (folder && !this.state.folders[folder]) {
987
1015
  return this.browseFolder(folder).then(function (folders) {
988
- return _this8.setState({
1016
+ return _this9.setState({
989
1017
  folders: folders,
990
1018
  path: folder,
991
1019
  currentDir: folder,
992
1020
  selected: folder,
993
1021
  pathFocus: false
994
1022
  }, function () {
995
- return _this8.props.onSelect && _this8.props.onSelect('');
1023
+ return _this9.props.onSelect && _this9.props.onSelect('');
996
1024
  });
997
1025
  });
998
1026
  } else {
@@ -1002,14 +1030,14 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1002
1030
  path: folder,
1003
1031
  pathFocus: false
1004
1032
  }, function () {
1005
- return _this8.props.onSelect && _this8.props.onSelect('');
1033
+ return _this9.props.onSelect && _this9.props.onSelect('');
1006
1034
  });
1007
1035
  }
1008
1036
  }
1009
1037
  }, {
1010
1038
  key: "select",
1011
1039
  value: function select(id, e, cb) {
1012
- var _this9 = this;
1040
+ var _this10 = this;
1013
1041
 
1014
1042
  if (typeof e === 'function') {
1015
1043
  cb = e;
@@ -1024,13 +1052,13 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1024
1052
  path: id,
1025
1053
  pathFocus: false
1026
1054
  }, function () {
1027
- if (_this9.props.onSelect) {
1055
+ if (_this10.props.onSelect) {
1028
1056
  var ext = _Utils["default"].getFileExtension(id);
1029
1057
 
1030
- if ((!_this9.props.filterFiles || _this9.props.filterFiles.includes(ext)) && (!_this9.props.filterByType || _FileViewer.EXTENSIONS[_this9.props.filterByType].includes(ext))) {
1031
- _this9.props.onSelect(id);
1058
+ if ((!_this10.props.filterFiles || _this10.props.filterFiles.includes(ext)) && (!_this10.props.filterByType || _FileViewer.EXTENSIONS[_this10.props.filterByType].includes(ext))) {
1059
+ _this10.props.onSelect(id);
1032
1060
  } else {
1033
- _this9.props.onSelect('');
1061
+ _this10.props.onSelect('');
1034
1062
  }
1035
1063
  }
1036
1064
 
@@ -1040,7 +1068,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1040
1068
  }, {
1041
1069
  key: "renderFolder",
1042
1070
  value: function renderFolder(item, expanded) {
1043
- var _this10 = this;
1071
+ var _this11 = this;
1044
1072
 
1045
1073
  if (this.state.filterEmpty && (!this.state.folders[item.id] || !this.state.folders[item.id].length) && item.id !== USER_DATA && !item.temp) {
1046
1074
  return null;
@@ -1056,17 +1084,17 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1056
1084
  width: 'calc(100% - ' + padding + 'px'
1057
1085
  } : {},
1058
1086
  onClick: function onClick(e) {
1059
- return _this10.state.viewType === TABLE ? _this10.select(item.id, e) : _this10.changeFolder(e, item.id);
1087
+ return _this11.state.viewType === TABLE ? _this11.select(item.id, e) : _this11.changeFolder(e, item.id);
1060
1088
  },
1061
1089
  onDoubleClick: function onDoubleClick(e) {
1062
- return _this10.state.viewType === TABLE && _this10.toggleFolder(item, e);
1090
+ return _this11.state.viewType === TABLE && _this11.toggleFolder(item, e);
1063
1091
  },
1064
1092
  title: item.title && (0, _typeof2["default"])(item.title) === 'object' ? item.title[this.props.lang] || item.title.end || '' : item.title || null,
1065
1093
  className: _Utils["default"].clsx('browserItem', this.props.classes['item' + this.state.viewType], this.props.classes['itemFolder' + this.state.viewType], this.state.selected === item.id && this.props.classes.itemSelected, item.temp && this.props.classes['itemFolderTemp'])
1066
1094
  }, /*#__PURE__*/_react["default"].createElement(Icon, {
1067
1095
  className: this.props.classes['itemFolderIcon' + this.state.viewType],
1068
1096
  onClick: this.state.viewType === TABLE ? function (e) {
1069
- return _this10.toggleFolder(item, e);
1097
+ return _this11.toggleFolder(item, e);
1070
1098
  } : undefined
1071
1099
  }), /*#__PURE__*/_react["default"].createElement("div", {
1072
1100
  className: _Utils["default"].clsx(this.props.classes['itemName' + this.state.viewType], this.props.classes['itemNameFolder' + this.state.viewType])
@@ -1083,20 +1111,20 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1083
1111
  }) : null), this.state.viewType === TABLE && this.props.allowDownload ? /*#__PURE__*/_react["default"].createElement("div", {
1084
1112
  className: this.props.classes['itemDownloadButton' + this.state.viewType]
1085
1113
  }) : null, this.state.viewType === TABLE && this.props.allowDelete && this.state.folders[item.id] && this.state.folders[item.id].length && (this.state.expertMode || item.id.startsWith(USER_DATA) || item.id.startsWith('vis.0/')) ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
1114
+ size: "large",
1086
1115
  "aria-label": "delete",
1087
1116
  onClick: function onClick(e) {
1088
1117
  e.stopPropagation();
1089
1118
 
1090
- if (_this10.suppressDeleteConfirm > Date.now()) {
1091
- _this10.deleteItem(item.id);
1119
+ if (_this11.suppressDeleteConfirm > Date.now()) {
1120
+ _this11.deleteItem(item.id);
1092
1121
  } else {
1093
- _this10.setState({
1122
+ _this11.setState({
1094
1123
  deleteItem: item.id
1095
1124
  });
1096
1125
  }
1097
1126
  },
1098
- className: this.props.classes['itemDeleteButton' + this.state.viewType],
1099
- size: "large"
1127
+ className: this.props.classes['itemDeleteButton' + this.state.viewType]
1100
1128
  }, /*#__PURE__*/_react["default"].createElement(_Delete["default"], {
1101
1129
  fontSize: "small"
1102
1130
  })) : this.state.viewType === TABLE && this.props.allowDelete ? /*#__PURE__*/_react["default"].createElement("div", {
@@ -1106,13 +1134,13 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1106
1134
  }, {
1107
1135
  key: "renderBackFolder",
1108
1136
  value: function renderBackFolder() {
1109
- var _this11 = this;
1137
+ var _this12 = this;
1110
1138
 
1111
1139
  return /*#__PURE__*/_react["default"].createElement("div", {
1112
1140
  key: this.state.currentDir,
1113
1141
  id: this.state.currentDir,
1114
1142
  onClick: function onClick(e) {
1115
- return _this11.changeFolder(e);
1143
+ return _this12.changeFolder(e);
1116
1144
  },
1117
1145
  title: this.props.t('ra_Back to %s', getParentDir(this.state.currentDir)),
1118
1146
  className: _Utils["default"].clsx('browserItem', this.props.classes['item' + this.state.viewType], this.props.classes['itemFolder' + this.state.viewType])
@@ -1134,7 +1162,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1134
1162
  }, {
1135
1163
  key: "formatAcl",
1136
1164
  value: function formatAcl(acl) {
1137
- var _this12 = this;
1165
+ var _this13 = this;
1138
1166
 
1139
1167
  var access = acl && (acl.permissions || acl.file);
1140
1168
 
@@ -1144,14 +1172,14 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1144
1172
 
1145
1173
  return /*#__PURE__*/_react["default"].createElement("div", {
1146
1174
  className: this.props.classes['itemAccess' + this.state.viewType]
1147
- }, " ", /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
1175
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
1176
+ size: "large",
1148
1177
  onClick: function onClick() {
1149
- return _this12.setState({
1178
+ return _this13.setState({
1150
1179
  modalEditOfAccess: true
1151
1180
  });
1152
1181
  },
1153
- className: this.props.classes['itemAclButton' + this.state.viewType],
1154
- size: "large"
1182
+ className: this.props.classes['itemAclButton' + this.state.viewType]
1155
1183
  }, access || '---'));
1156
1184
  }
1157
1185
  }, {
@@ -1213,7 +1241,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1213
1241
  }, {
1214
1242
  key: "renderFile",
1215
1243
  value: function renderFile(item) {
1216
- var _this13 = this;
1244
+ var _this14 = this;
1217
1245
 
1218
1246
  var padding = this.state.viewType === TABLE ? item.level * this.levelPadding : 0;
1219
1247
 
@@ -1223,16 +1251,16 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1223
1251
  key: item.id,
1224
1252
  id: item.id,
1225
1253
  onDoubleClick: function onDoubleClick() {
1226
- if (!_this13.props.onSelect) {
1227
- _this13.setState({
1228
- viewer: _this13.imagePrefix + item.id
1254
+ if (!_this14.props.onSelect) {
1255
+ _this14.setState({
1256
+ viewer: _this14.imagePrefix + item.id
1229
1257
  });
1230
- } else if ((!_this13.props.filterFiles || _this13.props.filterFiles.includes(item.ext)) && (!_this13.props.filterByType || _FileViewer.EXTENSIONS[_this13.props.filterByType].includes(item.ext))) {
1231
- _this13.props.onSelect(item.id, true);
1258
+ } else if ((!_this14.props.filterFiles || _this14.props.filterFiles.includes(item.ext)) && (!_this14.props.filterByType || _FileViewer.EXTENSIONS[_this14.props.filterByType].includes(item.ext))) {
1259
+ _this14.props.onSelect(item.id, true);
1232
1260
  }
1233
1261
  },
1234
1262
  onClick: function onClick(e) {
1235
- return _this13.select(item.id, e);
1263
+ return _this14.select(item.id, e);
1236
1264
  },
1237
1265
  style: this.state.viewType === TABLE ? {
1238
1266
  marginLeft: padding,
@@ -1260,13 +1288,13 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1260
1288
  onClick: function onClick(e) {
1261
1289
  e.stopPropagation();
1262
1290
 
1263
- if (!_this13.props.onSelect) {
1264
- _this13.setState({
1265
- viewer: _this13.imagePrefix + item.id,
1291
+ if (!_this14.props.onSelect) {
1292
+ _this14.setState({
1293
+ viewer: _this14.imagePrefix + item.id,
1266
1294
  formatEditFile: ext
1267
1295
  });
1268
- } else if ((!_this13.props.filterFiles || _this13.props.filterFiles.includes(item.ext)) && (!_this13.props.filterByType || _FileViewer.EXTENSIONS[_this13.props.filterByType].includes(item.ext))) {
1269
- _this13.props.onSelect(item.id, true);
1296
+ } else if ((!_this14.props.filterFiles || _this14.props.filterFiles.includes(item.ext)) && (!_this14.props.filterByType || _FileViewer.EXTENSIONS[_this14.props.filterByType].includes(item.ext))) {
1297
+ _this14.props.onSelect(item.id, true);
1270
1298
  }
1271
1299
  },
1272
1300
  className: this.props.classes['itemDeleteButton' + this.state.viewType],
@@ -1284,20 +1312,20 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1284
1312
  },
1285
1313
  size: "large"
1286
1314
  }, /*#__PURE__*/_react["default"].createElement(_SaveAlt["default"], null)) : null, this.state.viewType === TABLE && this.props.allowDelete && item.id !== 'vis.0/' && item.id !== USER_DATA && (this.state.expertMode || item.id.startsWith(USER_DATA) || item.id.startsWith('vis.0/')) ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
1315
+ size: "large",
1287
1316
  "aria-label": "delete",
1288
1317
  onClick: function onClick(e) {
1289
1318
  e.stopPropagation();
1290
1319
 
1291
- if (_this13.suppressDeleteConfirm > Date.now()) {
1292
- _this13.deleteItem(item.id);
1320
+ if (_this14.suppressDeleteConfirm > Date.now()) {
1321
+ _this14.deleteItem(item.id);
1293
1322
  } else {
1294
- _this13.setState({
1323
+ _this14.setState({
1295
1324
  deleteItem: item.id
1296
1325
  });
1297
1326
  }
1298
1327
  },
1299
- className: this.props.classes['itemDeleteButton' + this.state.viewType],
1300
- size: "large"
1328
+ className: this.props.classes['itemDeleteButton' + this.state.viewType]
1301
1329
  }, /*#__PURE__*/_react["default"].createElement(_Delete["default"], {
1302
1330
  fontSize: "small"
1303
1331
  })) : this.state.viewType === TABLE && this.props.allowDelete ? /*#__PURE__*/_react["default"].createElement("div", {
@@ -1307,7 +1335,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1307
1335
  }, {
1308
1336
  key: "renderItems",
1309
1337
  value: function renderItems(folderId) {
1310
- var _this14 = this;
1338
+ var _this15 = this;
1311
1339
 
1312
1340
  if (folderId && folderId !== '/' && !this.state.expertMode && folderId !== USER_DATA && !folderId.startsWith(USER_DATA) && folderId !== 'vis.0' && !folderId.startsWith('vis.0/')) {
1313
1341
  return null;
@@ -1323,14 +1351,14 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1323
1351
  }
1324
1352
 
1325
1353
  this.state.folders[folderId].forEach(function (item) {
1326
- if (!_this14.state.expertMode && item.id !== USER_DATA && !item.id.startsWith(USER_DATA) && item.id !== 'vis.0' && !item.id.startsWith('vis.0/')) {
1354
+ if (!_this15.state.expertMode && item.id !== USER_DATA && !item.id.startsWith(USER_DATA) && item.id !== 'vis.0' && !item.id.startsWith('vis.0/')) {
1327
1355
  return;
1328
1356
  }
1329
1357
 
1330
1358
  if (item.folder) {
1331
- res.push(_this14.renderFolder(item));
1332
- } else if ((!_this14.props.filterFiles || _this14.props.filterFiles.includes(item.ext)) && (!_this14.props.filterByType || _FileViewer.EXTENSIONS[_this14.props.filterByType].includes(item.ext))) {
1333
- res.push(_this14.renderFile(item));
1359
+ res.push(_this15.renderFolder(item));
1360
+ } else if ((!_this15.props.filterFiles || _this15.props.filterFiles.includes(item.ext)) && (!_this15.props.filterByType || _FileViewer.EXTENSIONS[_this15.props.filterByType].includes(item.ext))) {
1361
+ res.push(_this15.renderFile(item));
1334
1362
  }
1335
1363
  });
1336
1364
  return res;
@@ -1338,20 +1366,20 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1338
1366
  return this.state.folders[folderId].map(function (item) {
1339
1367
  var res = [];
1340
1368
 
1341
- if (item.id && item.id !== '/' && !_this14.state.expertMode && item.id !== USER_DATA && !item.id.startsWith(USER_DATA) && item.id !== 'vis.0' && !item.id.startsWith('vis.0/')) {
1369
+ if (item.id && item.id !== '/' && !_this15.state.expertMode && item.id !== USER_DATA && !item.id.startsWith(USER_DATA) && item.id !== 'vis.0' && !item.id.startsWith('vis.0/')) {
1342
1370
  return null;
1343
1371
  }
1344
1372
 
1345
1373
  if (item.folder) {
1346
- var expanded = _this14.state.expanded.includes(item.id);
1374
+ var expanded = _this15.state.expanded.includes(item.id);
1347
1375
 
1348
- res.push(_this14.renderFolder(item, expanded));
1376
+ res.push(_this15.renderFolder(item, expanded));
1349
1377
 
1350
- if (_this14.state.folders[item.id] && expanded) {
1351
- res.push(_this14.renderItems(item.id));
1378
+ if (_this15.state.folders[item.id] && expanded) {
1379
+ res.push(_this15.renderItems(item.id));
1352
1380
  }
1353
- } else if ((!_this14.props.filterFiles || _this14.props.filterFiles.includes(item.ext)) && (!_this14.props.filterByType || _FileViewer.EXTENSIONS[_this14.props.filterByType].includes(item.ext))) {
1354
- res.push(_this14.renderFile(item));
1381
+ } else if ((!_this15.props.filterFiles || _this15.props.filterFiles.includes(item.ext)) && (!_this15.props.filterByType || _FileViewer.EXTENSIONS[_this15.props.filterByType].includes(item.ext))) {
1382
+ res.push(_this15.renderFile(item));
1355
1383
  } else {
1356
1384
  return null;
1357
1385
  }
@@ -1382,7 +1410,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1382
1410
  }, {
1383
1411
  key: "renderToolbar",
1384
1412
  value: function renderToolbar() {
1385
- var _this15 = this;
1413
+ var _this16 = this;
1386
1414
 
1387
1415
  return /*#__PURE__*/_react["default"].createElement(_Toolbar["default"], {
1388
1416
  key: "toolbar",
@@ -1393,8 +1421,8 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1393
1421
  className: _Utils["default"].clsx(this.props.classes.menuButton, this.state.expertMode && this.props.classes.menuButtonExpertActive),
1394
1422
  "aria-label": "expert mode",
1395
1423
  onClick: function onClick() {
1396
- return _this15.setState({
1397
- expertMode: !_this15.state.expertMode
1424
+ return _this16.setState({
1425
+ expertMode: !_this16.state.expertMode
1398
1426
  });
1399
1427
  },
1400
1428
  size: "large"
@@ -1404,20 +1432,20 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1404
1432
  className: this.props.classes.menuButton,
1405
1433
  "aria-label": "view mode",
1406
1434
  onClick: function onClick() {
1407
- var viewType = _this15.state.viewType === TABLE ? TILE : TABLE;
1435
+ var viewType = _this16.state.viewType === TABLE ? TILE : TABLE;
1408
1436
  window.localStorage.setItem('files.viewType', viewType);
1409
- var currentDir = _this15.state.selected;
1437
+ var currentDir = _this16.state.selected;
1410
1438
 
1411
1439
  if (isFile(currentDir)) {
1412
1440
  currentDir = getParentDir(currentDir);
1413
1441
  }
1414
1442
 
1415
- _this15.setState({
1443
+ _this16.setState({
1416
1444
  viewType: viewType,
1417
1445
  currentDir: currentDir
1418
1446
  }, function () {
1419
- if (_this15.state.viewType === TABLE) {
1420
- _this15.scrollToSelected();
1447
+ if (_this16.state.viewType === TABLE) {
1448
+ _this16.scrollToSelected();
1421
1449
  }
1422
1450
  });
1423
1451
  },
@@ -1429,10 +1457,10 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1429
1457
  color: this.state.filterEmpty ? 'secondary' : 'inherit',
1430
1458
  "aria-label": "filter empty",
1431
1459
  onClick: function onClick() {
1432
- window.localStorage.setItem('file.empty', !_this15.state.filterEmpty);
1460
+ window.localStorage.setItem('file.empty', !_this16.state.filterEmpty);
1433
1461
 
1434
- _this15.setState({
1435
- filterEmpty: !_this15.state.filterEmpty
1462
+ _this16.setState({
1463
+ filterEmpty: !_this16.state.filterEmpty
1436
1464
  });
1437
1465
  },
1438
1466
  size: "large"
@@ -1443,10 +1471,10 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1443
1471
  color: 'inherit',
1444
1472
  "aria-label": "reload files",
1445
1473
  onClick: function onClick() {
1446
- return _this15.setState({
1474
+ return _this16.setState({
1447
1475
  folders: {}
1448
1476
  }, function () {
1449
- return _this15.loadFolders();
1477
+ return _this16.loadFolders();
1450
1478
  });
1451
1479
  },
1452
1480
  size: "large"
@@ -1458,7 +1486,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1458
1486
  color: 'inherit',
1459
1487
  "aria-label": "add folder",
1460
1488
  onClick: function onClick() {
1461
- return _this15.setState({
1489
+ return _this16.setState({
1462
1490
  addFolder: true
1463
1491
  });
1464
1492
  },
@@ -1471,7 +1499,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1471
1499
  color: 'inherit',
1472
1500
  "aria-label": "upload file",
1473
1501
  onClick: function onClick() {
1474
- return _this15.setState({
1502
+ return _this16.setState({
1475
1503
  uploadFile: true
1476
1504
  });
1477
1505
  },
@@ -1510,7 +1538,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1510
1538
  }, {
1511
1539
  key: "renderInputDialog",
1512
1540
  value: function renderInputDialog() {
1513
- var _this16 = this;
1541
+ var _this17 = this;
1514
1542
 
1515
1543
  if (this.state.addFolder) {
1516
1544
  var parentFolder = this.findFirstFolder(this.state.selected);
@@ -1527,18 +1555,18 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1527
1555
  promptText: this.props.t('ra_If no file will be created in the folder, it will disappear after the browser closed'),
1528
1556
  labelText: this.props.t('ra_Folder name'),
1529
1557
  verify: function verify(text) {
1530
- return _this16.state.folders[parentFolder].find(function (item) {
1558
+ return _this17.state.folders[parentFolder].find(function (item) {
1531
1559
  return item.name === text;
1532
- }) ? '' : _this16.props.t('ra_Duplicate name');
1560
+ }) ? '' : _this17.props.t('ra_Duplicate name');
1533
1561
  },
1534
1562
  onClose: function onClose(name) {
1535
1563
  if (name) {
1536
1564
  var folders = {};
1537
- Object.keys(_this16.state.folders).forEach(function (folder) {
1538
- return folders[folder] = _this16.state.folders[folder];
1565
+ Object.keys(_this17.state.folders).forEach(function (folder) {
1566
+ return folders[folder] = _this17.state.folders[folder];
1539
1567
  });
1540
1568
 
1541
- var parent = _this16.findItem(parentFolder);
1569
+ var parent = _this17.findItem(parentFolder);
1542
1570
 
1543
1571
  var id = parentFolder + '/' + name;
1544
1572
  folders[parentFolder].push({
@@ -1550,7 +1578,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1550
1578
  });
1551
1579
  folders[parentFolder].sort(sortFolders);
1552
1580
  folders[id] = [];
1553
- var expanded = (0, _toConsumableArray2["default"])(_this16.state.expanded);
1581
+ var expanded = (0, _toConsumableArray2["default"])(_this17.state.expanded);
1554
1582
 
1555
1583
  if (!expanded.includes(parentFolder)) {
1556
1584
  expanded.push(parentFolder);
@@ -1559,15 +1587,15 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1559
1587
 
1560
1588
  window.localStorage.setItem('files.expanded', JSON.stringify(expanded));
1561
1589
 
1562
- _this16.setState({
1590
+ _this17.setState({
1563
1591
  addFolder: false,
1564
1592
  folders: folders,
1565
1593
  expanded: expanded
1566
1594
  }, function () {
1567
- return _this16.select(id);
1595
+ return _this17.select(id);
1568
1596
  });
1569
1597
  } else {
1570
- _this16.setState({
1598
+ _this17.setState({
1571
1599
  addFolder: false
1572
1600
  });
1573
1601
  }
@@ -1583,11 +1611,11 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1583
1611
  }, {
1584
1612
  key: "componentDidUpdate",
1585
1613
  value: function componentDidUpdate(prevProps, prevState, snapshot) {
1586
- var _this17 = this;
1614
+ var _this18 = this;
1587
1615
 
1588
1616
  this.setOpacityTimer && clearTimeout(this.setOpacityTimer);
1589
1617
  this.setOpacityTimer = setTimeout(function () {
1590
- _this17.setOpacityTimer = null;
1618
+ _this18.setOpacityTimer = null;
1591
1619
  var items = window.document.getElementsByClassName('browserItem');
1592
1620
 
1593
1621
  for (var i = 0; i < items.length; i++) {
@@ -1630,7 +1658,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1630
1658
  }, {
1631
1659
  key: "renderUpload",
1632
1660
  value: function renderUpload() {
1633
- var _this18 = this;
1661
+ var _this19 = this;
1634
1662
 
1635
1663
  if (this.state.uploadFile) {
1636
1664
  return [/*#__PURE__*/_react["default"].createElement(_Fab["default"], {
@@ -1639,19 +1667,19 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1639
1667
  "aria-label": "close",
1640
1668
  className: this.props.classes.uploadCloseButton,
1641
1669
  onClick: function onClick() {
1642
- return _this18.setState({
1670
+ return _this19.setState({
1643
1671
  uploadFile: false
1644
1672
  });
1645
1673
  }
1646
1674
  }, /*#__PURE__*/_react["default"].createElement(_Close["default"], null)), /*#__PURE__*/_react["default"].createElement(_reactDropzone["default"], {
1647
1675
  key: "dropzone",
1648
1676
  onDragEnter: function onDragEnter() {
1649
- return _this18.setState({
1677
+ return _this19.setState({
1650
1678
  uploadFile: 'dragging'
1651
1679
  });
1652
1680
  },
1653
1681
  onDragLeave: function onDragLeave() {
1654
- return _this18.setState({
1682
+ return _this19.setState({
1655
1683
  uploadFile: true
1656
1684
  });
1657
1685
  },
@@ -1669,30 +1697,30 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1669
1697
  };
1670
1698
 
1671
1699
  reader.onload = function () {
1672
- var parentFolder = _this18.findFirstFolder(_this18.state.selected);
1700
+ var parentFolder = _this19.findFirstFolder(_this19.state.selected);
1673
1701
 
1674
1702
  if (!parentFolder) {
1675
- return window.alert(_this18.props.t('ra_Invalid parent folder!'));
1703
+ return window.alert(_this19.props.t('ra_Invalid parent folder!'));
1676
1704
  }
1677
1705
 
1678
1706
  var id = parentFolder + '/' + file.name;
1679
1707
 
1680
- _this18.uploadFile(id, reader.result).then(function () {
1708
+ _this19.uploadFile(id, reader.result).then(function () {
1681
1709
  if (! --count) {
1682
1710
  var folders = {};
1683
- Object.keys(_this18.state.folders).forEach(function (name) {
1711
+ Object.keys(_this19.state.folders).forEach(function (name) {
1684
1712
  if (name !== parentFolder && !name.startsWith(parentFolder + '/')) {
1685
- folders[name] = _this18.state.folders[name];
1713
+ folders[name] = _this19.state.folders[name];
1686
1714
  }
1687
1715
  });
1688
1716
 
1689
- _this18.setState({
1717
+ _this19.setState({
1690
1718
  uploadFile: false,
1691
1719
  folders: folders
1692
1720
  }, function () {
1693
- return _this18.browseFolders((0, _toConsumableArray2["default"])(_this18.state.expanded), folders).then(function (folders) {
1721
+ return _this19.browseFolders((0, _toConsumableArray2["default"])(_this19.state.expanded), folders).then(function (folders) {
1694
1722
  // open current folder
1695
- var expanded = (0, _toConsumableArray2["default"])(_this18.state.expanded);
1723
+ var expanded = (0, _toConsumableArray2["default"])(_this19.state.expanded);
1696
1724
 
1697
1725
  if (!expanded.includes(parentFolder)) {
1698
1726
  expanded.push(parentFolder);
@@ -1700,11 +1728,11 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1700
1728
  window.localStorage.setItem('files.expanded', JSON.stringify(expanded));
1701
1729
  }
1702
1730
 
1703
- _this18.setState({
1731
+ _this19.setState({
1704
1732
  folders: folders,
1705
1733
  expanded: expanded
1706
1734
  }, function () {
1707
- return _this18.select(id);
1735
+ return _this19.select(id);
1708
1736
  });
1709
1737
  });
1710
1738
  });
@@ -1719,16 +1747,16 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1719
1747
  var getRootProps = _ref2.getRootProps,
1720
1748
  getInputProps = _ref2.getInputProps;
1721
1749
  return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
1722
- className: _Utils["default"].clsx(_this18.props.classes.uploadDiv, _this18.state.uploadFile === 'dragging' && _this18.props.classes.uploadDivDragging)
1750
+ className: _Utils["default"].clsx(_this19.props.classes.uploadDiv, _this19.state.uploadFile === 'dragging' && _this19.props.classes.uploadDivDragging)
1723
1751
  }, getRootProps()), /*#__PURE__*/_react["default"].createElement("input", getInputProps()), /*#__PURE__*/_react["default"].createElement("div", {
1724
- className: _this18.props.classes.uploadCenterDiv
1752
+ className: _this19.props.classes.uploadCenterDiv
1725
1753
  }, /*#__PURE__*/_react["default"].createElement("div", {
1726
- className: _this18.props.classes.uploadCenterTextAndIcon
1754
+ className: _this19.props.classes.uploadCenterTextAndIcon
1727
1755
  }, /*#__PURE__*/_react["default"].createElement(_Publish["default"], {
1728
- className: _this18.props.classes.uploadCenterIcon
1756
+ className: _this19.props.classes.uploadCenterIcon
1729
1757
  }), /*#__PURE__*/_react["default"].createElement("div", {
1730
- className: _this18.props.classes.uploadCenterText
1731
- }, _this18.state.uploadFile === 'dragging' ? _this18.props.t('ra_Drop file here') : _this18.props.t('ra_Place your files here or click here to open the browse dialog')))));
1758
+ className: _this19.props.classes.uploadCenterText
1759
+ }, _this19.state.uploadFile === 'dragging' ? _this19.props.t('ra_Drop file here') : _this19.props.t('ra_Place your files here or click here to open the browse dialog')))));
1732
1760
  })];
1733
1761
  } else {
1734
1762
  return null;
@@ -1737,22 +1765,22 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1737
1765
  }, {
1738
1766
  key: "deleteRecursive",
1739
1767
  value: function deleteRecursive(id) {
1740
- var _this19 = this;
1768
+ var _this20 = this;
1741
1769
 
1742
1770
  var item = this.findItem(id);
1743
1771
 
1744
1772
  if (item.folder) {
1745
1773
  return (this.state.folders[id] ? Promise.all(this.state.folders[id].map(function (item) {
1746
- return _this19.deleteRecursive(item.id);
1774
+ return _this20.deleteRecursive(item.id);
1747
1775
  })) : Promise.resolve()).then(function () {
1748
1776
  // If it is folder of second level
1749
1777
  if (item.level >= 1) {
1750
1778
  var parts = id.split('/');
1751
1779
  var adapter = parts.shift();
1752
1780
 
1753
- _this19.props.socket.deleteFolder(adapter, parts.join('/')).then(function () {
1781
+ _this20.props.socket.deleteFolder(adapter, parts.join('/')).then(function () {
1754
1782
  // remove this folder
1755
- var folders = JSON.parse(JSON.stringify(_this19.state.folders));
1783
+ var folders = JSON.parse(JSON.stringify(_this20.state.folders));
1756
1784
  delete folders[item.id]; // delete folder from parent item
1757
1785
 
1758
1786
  var parentId = getParentDir(item.id);
@@ -1767,8 +1795,8 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1767
1795
  parentFolder.splice(pos, 1);
1768
1796
  }
1769
1797
 
1770
- _this19.select(parentId, function () {
1771
- return _this19.setState({
1798
+ _this20.select(parentId, function () {
1799
+ return _this20.setState({
1772
1800
  folders: folders
1773
1801
  });
1774
1802
  });
@@ -1792,21 +1820,21 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1792
1820
  }, {
1793
1821
  key: "deleteItem",
1794
1822
  value: function deleteItem(_deleteItem) {
1795
- var _this20 = this;
1823
+ var _this21 = this;
1796
1824
 
1797
1825
  _deleteItem = _deleteItem || this.state.deleteItem;
1798
1826
  this.setState({
1799
1827
  deleteItem: ''
1800
1828
  }, function () {
1801
- return _this20.deleteRecursive(_deleteItem).then(function () {
1802
- var pos = _this20.state.expanded.indexOf(_deleteItem);
1829
+ return _this21.deleteRecursive(_deleteItem).then(function () {
1830
+ var pos = _this21.state.expanded.indexOf(_deleteItem);
1803
1831
 
1804
1832
  if (pos !== -1) {
1805
- var expanded = (0, _toConsumableArray2["default"])(_this20.state.expanded);
1833
+ var expanded = (0, _toConsumableArray2["default"])(_this21.state.expanded);
1806
1834
  expanded.splice(pos, 1);
1807
1835
  window.localStorage.setItem('files.expanded', JSON.stringify(expanded));
1808
1836
 
1809
- _this20.setState({
1837
+ _this21.setState({
1810
1838
  expanded: expanded
1811
1839
  });
1812
1840
  }
@@ -1827,14 +1855,14 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1827
1855
  }, {
1828
1856
  key: "renderDeleteDialog",
1829
1857
  value: function renderDeleteDialog() {
1830
- var _this21 = this;
1858
+ var _this22 = this;
1831
1859
 
1832
1860
  if (this.state.deleteItem) {
1833
1861
  return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
1834
1862
  key: "deleteDialog",
1835
1863
  open: true,
1836
1864
  onClose: function onClose() {
1837
- return _this21.setState({
1865
+ return _this22.setState({
1838
1866
  deleteItem: ''
1839
1867
  });
1840
1868
  },
@@ -1842,28 +1870,28 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1842
1870
  }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
1843
1871
  id: "form-dialog-title"
1844
1872
  }, this.props.t('ra_Confirm deletion of %s', this.state.deleteItem.split('/').pop())), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], null, this.props.t('ra_Are you sure?'))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
1845
- color: "grey",
1846
1873
  variant: "contained",
1847
1874
  onClick: function onClick() {
1848
- _this21.suppressDeleteConfirm = Date.now() + 60000 * 5;
1875
+ _this22.suppressDeleteConfirm = Date.now() + 60000 * 5;
1849
1876
 
1850
- _this21.deleteItem();
1851
- }
1877
+ _this22.deleteItem();
1878
+ },
1879
+ color: "grey"
1852
1880
  }, this.props.t('ra_Delete (no confirm for 5 mins)')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
1853
1881
  variant: "contained",
1854
1882
  onClick: function onClick() {
1855
- return _this21.deleteItem();
1883
+ return _this22.deleteItem();
1856
1884
  },
1857
1885
  color: "primary",
1858
1886
  autoFocus: true
1859
1887
  }, this.props.t('ra_Delete')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
1860
- color: "grey",
1861
1888
  variant: "contained",
1862
1889
  onClick: function onClick() {
1863
- return _this21.setState({
1890
+ return _this22.setState({
1864
1891
  deleteItem: ''
1865
1892
  });
1866
- }
1893
+ },
1894
+ color: "grey"
1867
1895
  }, this.props.t('ra_Cancel'))));
1868
1896
  } else {
1869
1897
  return false;
@@ -1872,7 +1900,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1872
1900
  }, {
1873
1901
  key: "renderViewDialog",
1874
1902
  value: function renderViewDialog() {
1875
- var _this22 = this;
1903
+ var _this23 = this;
1876
1904
 
1877
1905
  return this.state.viewer ? /*#__PURE__*/_react["default"].createElement(_FileViewer["default"], {
1878
1906
  key: this.state.viewer,
@@ -1886,7 +1914,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1886
1914
  lang: this.props.lang,
1887
1915
  expertMode: this.state.expertMode,
1888
1916
  onClose: function onClose() {
1889
- return _this22.setState({
1917
+ return _this23.setState({
1890
1918
  viewer: '',
1891
1919
  formatEditFile: ''
1892
1920
  });
@@ -1896,14 +1924,14 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1896
1924
  }, {
1897
1925
  key: "renderError",
1898
1926
  value: function renderError() {
1899
- var _this23 = this;
1927
+ var _this24 = this;
1900
1928
 
1901
1929
  if (this.state.errorText) {
1902
1930
  return /*#__PURE__*/_react["default"].createElement(_Error["default"], {
1903
1931
  key: "errorDialog",
1904
1932
  text: this.state.errorText,
1905
1933
  onClose: function onClose() {
1906
- return _this23.setState({
1934
+ return _this24.setState({
1907
1935
  errorText: ''
1908
1936
  });
1909
1937
  }
@@ -1915,12 +1943,12 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1915
1943
  }, {
1916
1944
  key: "updateItemsAcl",
1917
1945
  value: function updateItemsAcl(info) {
1918
- var _this24 = this;
1946
+ var _this25 = this;
1919
1947
 
1920
1948
  var folders = JSON.parse(JSON.stringify(this.state.folders));
1921
1949
  var changed;
1922
1950
  info.forEach(function (it) {
1923
- var item = _this24.findItem(it.id, folders);
1951
+ var item = _this25.findItem(it.id, folders);
1924
1952
 
1925
1953
  if (item && JSON.stringify(item.acl) !== JSON.stringify(it.acl)) {
1926
1954
  item.acl = it.acl;
@@ -1934,41 +1962,41 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1934
1962
  }, {
1935
1963
  key: "changeToPath",
1936
1964
  value: function changeToPath() {
1937
- var _this25 = this;
1965
+ var _this26 = this;
1938
1966
 
1939
1967
  setTimeout(function () {
1940
- if (_this25.state.path !== _this25.state.selected && (!_this25.lastSelect || Date.now() - _this25.lastSelect > 100)) {
1941
- var folder = _this25.state.path;
1968
+ if (_this26.state.path !== _this26.state.selected && (!_this26.lastSelect || Date.now() - _this26.lastSelect > 100)) {
1969
+ var folder = _this26.state.path;
1942
1970
 
1943
- if (isFile(_this25.state.path)) {
1944
- folder = getParentDir(_this25.state.path);
1971
+ if (isFile(_this26.state.path)) {
1972
+ folder = getParentDir(_this26.state.path);
1945
1973
  }
1946
1974
 
1947
1975
  return new Promise(function (resolve) {
1948
- if (!_this25.state.folders[folder]) {
1949
- return _this25.browseFolder(folder).then(function (folders) {
1950
- return _this25.setState({
1976
+ if (!_this26.state.folders[folder]) {
1977
+ return _this26.browseFolder(folder).then(function (folders) {
1978
+ return _this26.setState({
1951
1979
  folders: folders
1952
1980
  }, function () {
1953
1981
  return resolve(true);
1954
1982
  });
1955
1983
  })["catch"](function (err) {
1956
- return _this25.setState({
1957
- errorText: err === NOT_FOUND ? _this25.props.t('ra_Cannot find "%s"', folder) : _this25.props.t('ra_Cannot read "%s"', folder)
1984
+ return _this26.setState({
1985
+ errorText: err === NOT_FOUND ? _this26.props.t('ra_Cannot find "%s"', folder) : _this26.props.t('ra_Cannot read "%s"', folder)
1958
1986
  });
1959
1987
  });
1960
1988
  } else {
1961
1989
  return resolve(true);
1962
1990
  }
1963
1991
  }).then(function (result) {
1964
- return result && _this25.setState({
1965
- selected: _this25.state.path,
1992
+ return result && _this26.setState({
1993
+ selected: _this26.state.path,
1966
1994
  currentDir: folder,
1967
1995
  pathFocus: false
1968
1996
  });
1969
1997
  });
1970
- } else if (!_this25.lastSelect || Date.now() - _this25.lastSelect > 100) {
1971
- _this25.setState({
1998
+ } else if (!_this26.lastSelect || Date.now() - _this26.lastSelect > 100) {
1999
+ _this26.setState({
1972
2000
  pathFocus: false
1973
2001
  });
1974
2002
  }
@@ -1977,7 +2005,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1977
2005
  }, {
1978
2006
  key: "renderBreadcrumb",
1979
2007
  value: function renderBreadcrumb() {
1980
- var _this26 = this;
2008
+ var _this27 = this;
1981
2009
 
1982
2010
  var parts = this.state.selected.startsWith('/') ? this.state.selected.split('/') : ('/' + this.state.selected).split('/');
1983
2011
  var p = [];
@@ -1987,21 +2015,21 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
1987
2015
 
1988
2016
  if (i < parts.length - 1) {
1989
2017
  return [/*#__PURE__*/_react["default"].createElement("div", {
1990
- key: _this26.state.selected + '_' + i,
1991
- className: _this26.props.classes.pathDivBreadcrumbDir,
2018
+ key: _this27.state.selected + '_' + i,
2019
+ className: _this27.props.classes.pathDivBreadcrumbDir,
1992
2020
  onClick: function onClick(e) {
1993
- return _this26.changeFolder(e, path || '/');
2021
+ return _this27.changeFolder(e, path || '/');
1994
2022
  }
1995
- }, part || _this26.props.t('ra_Root')), /*#__PURE__*/_react["default"].createElement("span", {
1996
- key: _this26.state.selected + '_s_' + i,
1997
- className: _this26.props.classes.pathDivBreadcrumbSlash
2023
+ }, part || _this27.props.t('ra_Root')), /*#__PURE__*/_react["default"].createElement("span", {
2024
+ key: _this27.state.selected + '_s_' + i,
2025
+ className: _this27.props.classes.pathDivBreadcrumbSlash
1998
2026
  }, '>')];
1999
2027
  } else {
2000
2028
  return /*#__PURE__*/_react["default"].createElement("div", {
2001
- key: _this26.state.selected + '_' + i,
2002
- className: _this26.props.classes.pathDivBreadcrumbFile,
2029
+ key: _this27.state.selected + '_' + i,
2030
+ className: _this27.props.classes.pathDivBreadcrumbFile,
2003
2031
  onClick: function onClick() {
2004
- return _this26.setState({
2032
+ return _this27.setState({
2005
2033
  pathFocus: true
2006
2034
  });
2007
2035
  }
@@ -2012,7 +2040,7 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
2012
2040
  }, {
2013
2041
  key: "renderPath",
2014
2042
  value: function renderPath() {
2015
- var _this27 = this;
2043
+ var _this28 = this;
2016
2044
 
2017
2045
  return /*#__PURE__*/_react["default"].createElement("div", {
2018
2046
  key: "path",
@@ -2020,13 +2048,13 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
2020
2048
  }, this.state.pathFocus ? /*#__PURE__*/_react["default"].createElement(_Input["default"], {
2021
2049
  value: this.state.path,
2022
2050
  onKeyDown: function onKeyDown(e) {
2023
- return e.keyCode === 13 && _this27.changeToPath();
2051
+ return e.keyCode === 13 && _this28.changeToPath();
2024
2052
  },
2025
2053
  onBlur: function onBlur(e) {
2026
- return _this27.changeToPath();
2054
+ return _this28.changeToPath();
2027
2055
  },
2028
2056
  onChange: function onChange(e) {
2029
- return _this27.setState({
2057
+ return _this28.setState({
2030
2058
  path: e.target.value
2031
2059
  });
2032
2060
  },
@@ -2036,24 +2064,22 @@ var FileBrowser = /*#__PURE__*/function (_Component) {
2036
2064
  }, {
2037
2065
  key: "render",
2038
2066
  value: function render() {
2039
- var _this28 = this;
2067
+ var _this29 = this;
2040
2068
 
2041
2069
  if (!this.props.ready) {
2042
- return /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
2043
- key: this.props.key ? this.props.key + '_c' : 'c'
2044
- });
2070
+ return /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], null);
2045
2071
  }
2046
2072
 
2047
2073
  if (this.state.loadAllFolders && !this.foldersLoading) {
2048
2074
  this.foldersLoading = true;
2049
2075
  setTimeout(function () {
2050
- _this28.setState({
2076
+ _this29.setState({
2051
2077
  loadAllFolders: false,
2052
2078
  folders: {}
2053
2079
  }, function () {
2054
- _this28.foldersLoading = false;
2080
+ _this29.foldersLoading = false;
2055
2081
 
2056
- _this28.loadFolders();
2082
+ _this29.loadFolders();
2057
2083
  });
2058
2084
  }, 300);
2059
2085
  }
@@ -2119,7 +2145,7 @@ FileBrowser.propTypes = {
2119
2145
  };
2120
2146
  /** @type {typeof FileBrowser} */
2121
2147
 
2122
- var _export = withWidth()((0, _withStyles["default"])(styles)(FileBrowser));
2148
+ var _export = (0, _withWidth["default"])()((0, _styles.withStyles)(styles)(FileBrowser));
2123
2149
 
2124
2150
  var _default = _export;
2125
2151
  exports["default"] = _default;