@iobroker/adapter-react-v5 6.1.9 → 6.1.10

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.
@@ -180,10 +180,10 @@ const styles = {
180
180
  fontSize: '1rem',
181
181
  verticalAlign: 'top',
182
182
  flexGrow: 1,
183
+ textOverflow: 'ellipsis',
184
+ whiteSpace: 'nowrap',
185
+ overflow: 'hidden',
183
186
  '@media screen and (max-width: 500px)': {
184
- whiteSpace: 'nowrap',
185
- overflow: 'hidden',
186
- textOverflow: 'ellipsis',
187
187
  textAlign: 'end',
188
188
  direction: 'rtl',
189
189
  },
@@ -381,7 +381,9 @@ const styles = {
381
381
  const USER_DATA = '0_userdata.0';
382
382
  function getParentDir(dir) {
383
383
  const parts = (dir || '').split('/');
384
- parts.length && parts.pop();
384
+ if (parts.length) {
385
+ parts.pop();
386
+ }
385
387
  return parts.join('/');
386
388
  }
387
389
  function isFile(path) {
@@ -473,7 +475,7 @@ class FileBrowserClass extends react_1.Component {
473
475
  });
474
476
  }
475
477
  }
476
- catch (e) {
478
+ catch (_a) {
477
479
  expanded = [];
478
480
  }
479
481
  let viewType;
@@ -589,7 +591,7 @@ class FileBrowserClass extends react_1.Component {
589
591
  scrollToSelected() {
590
592
  if (this.mounted) {
591
593
  const el = document.getElementById(this.state.selected);
592
- el && el.scrollIntoView();
594
+ el === null || el === void 0 ? void 0 : el.scrollIntoView();
593
595
  }
594
596
  }
595
597
  async componentDidMount() {
@@ -597,7 +599,9 @@ class FileBrowserClass extends react_1.Component {
597
599
  this.loadFolders()
598
600
  .catch(error => console.error(`Cannot load folders: ${error}`));
599
601
  this.supportSubscribes = await this.props.socket.checkFeatureSupported('BINARY_STATE_EVENT');
600
- this.supportSubscribes && (await this.props.socket.subscribeFiles('*', '*', this.onFileChange));
602
+ if (this.supportSubscribes) {
603
+ await this.props.socket.subscribeFiles('*', '*', this.onFileChange);
604
+ }
601
605
  }
602
606
  componentWillUnmount() {
603
607
  this.supportSubscribes && this.props.socket.unsubscribeFiles('*', '*', this.onFileChange);
@@ -652,7 +656,9 @@ class FileBrowserClass extends react_1.Component {
652
656
  adapter,
653
657
  relPath,
654
658
  });
655
- !this.browseListRunning && this.processBrowseList();
659
+ if (!this.browseListRunning) {
660
+ this.processBrowseList();
661
+ }
656
662
  }
657
663
  });
658
664
  }
@@ -971,13 +977,12 @@ class FileBrowserClass extends react_1.Component {
971
977
  return react_1.default.createElement(material_1.Box, { component: "div", key: item.id, id: item.id, style: this.state.viewType === TABLE ? { marginLeft: padding, width: `calc(100% - ${padding}px` } : {}, onClick: e => (this.state.viewType === TABLE ? this.select(item.id, e) : this.changeFolder(e, item.id)), onDoubleClick: e => this.state.viewType === TABLE && this.toggleFolder(item, e), title: this.getText(item.title), className: "browserItem", sx: Utils_1.default.getStyle(this.props.theme, styles[`item${this.state.viewType}`], styles[`itemFolder${this.state.viewType}`], this.state.selected === item.id ? styles.itemSelected : {}, item.temp ? styles.itemFolderTemp : {}) },
972
978
  react_1.default.createElement(IconEl, { style: Utils_1.default.getStyle(this.props.theme, styles[`itemFolderIcon${this.state.viewType}`], isSpecialData && styles.specialFolder), onClick: this.state.viewType === TABLE ? (e) => this.toggleFolder(item, e) : undefined }),
973
979
  react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles[`itemName${this.state.viewType}`], styles[`itemNameFolder${this.state.viewType}`]) }, isUserData ? this.props.t('ra_User files') : item.name),
974
- react_1.default.createElement(material_1.Hidden, { smDown: true },
975
- react_1.default.createElement("div", { style: styles[`itemSize${this.state.viewType}`] }, this.state.viewType === TABLE && this.state.folders[item.id]
976
- ? this.state.folders[item.id].length
977
- : '')),
978
- react_1.default.createElement(material_1.Hidden, { smDown: true }, this.state.viewType === TABLE && this.props.expertMode ? this.formatAcl(item.acl) : null),
979
- react_1.default.createElement(material_1.Hidden, { smDown: true }, this.state.viewType === TABLE && this.props.expertMode ?
980
- react_1.default.createElement(material_1.Box, { component: "div", sx: styles[`itemDeleteButton${this.state.viewType}`] }) : null),
980
+ react_1.default.createElement(material_1.Box, { component: "div", style: styles[`itemSize${this.state.viewType}`], sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.state.folders[item.id]
981
+ ? this.state.folders[item.id].length
982
+ : ''),
983
+ react_1.default.createElement(material_1.Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.props.expertMode ? this.formatAcl(item.acl) : null),
984
+ this.state.viewType === TABLE && this.props.expertMode ?
985
+ react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign({}, styles.itemDeleteButtonTable), { display: { md: 'inline-block', sm: 'none' } }) }) : null,
981
986
  this.state.viewType === TABLE && this.props.allowDownload ?
982
987
  react_1.default.createElement("div", { style: styles[`itemDownloadEmpty${this.state.viewType}`] }) : null,
983
988
  this.state.viewType === TABLE &&
@@ -1083,9 +1088,9 @@ class FileBrowserClass extends react_1.Component {
1083
1088
  :
1084
1089
  this.getFileIcon(ext),
1085
1090
  react_1.default.createElement(material_1.Box, { component: "div", sx: styles[`itemName${this.state.viewType}`] }, item.name),
1086
- react_1.default.createElement(material_1.Hidden, { smDown: true }, this.formatSize(item.size)),
1087
- react_1.default.createElement(material_1.Hidden, { smDown: true }, this.state.viewType === TABLE && this.props.expertMode ? this.formatAcl(item.acl) : null),
1088
- react_1.default.createElement(material_1.Hidden, { smDown: true }, this.state.viewType === TABLE && this.props.expertMode && FileBrowserClass.getEditFile(ext) ?
1091
+ react_1.default.createElement(material_1.Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.formatSize(item.size)),
1092
+ react_1.default.createElement(material_1.Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.props.expertMode ? this.formatAcl(item.acl) : null),
1093
+ react_1.default.createElement(material_1.Box, { component: "div", sx: { display: { md: 'inline-block', sm: 'none' } } }, this.state.viewType === TABLE && this.props.expertMode && FileBrowserClass.getEditFile(ext) ?
1089
1094
  react_1.default.createElement(material_1.IconButton, { "aria-label": "edit", onClick: e => {
1090
1095
  e.stopPropagation();
1091
1096
  if (!this.props.onSelect) {
@@ -1098,7 +1103,7 @@ class FileBrowserClass extends react_1.Component {
1098
1103
  FileViewer_1.EXTENSIONS[this.state.filterByType].includes(item.ext)))) {
1099
1104
  this.props.onSelect(item.id, true, !!this.state.folders[item.id]);
1100
1105
  }
1101
- }, sx: styles[`itemDeleteButton${this.state.viewType}`], size: "large" },
1106
+ }, sx: styles.itemDeleteButtonTable, size: "large" },
1102
1107
  react_1.default.createElement(icons_material_1.Edit, { fontSize: "small" }))
1103
1108
  :
1104
1109
  react_1.default.createElement(material_1.Box, { component: "div", sx: styles[`itemDeleteButton${this.state.viewType}`] })),
@@ -89,7 +89,9 @@ class FileViewer extends react_1.Component {
89
89
  this.timeout = null;
90
90
  this.onFileChanged = (id, fileName, size) => {
91
91
  if (!this.state.changed) {
92
- this.timeout && clearTimeout(this.timeout);
92
+ if (this.timeout) {
93
+ clearTimeout(this.timeout);
94
+ }
93
95
  this.timeout = setTimeout(() => {
94
96
  this.timeout = null;
95
97
  if (size === null) {
@@ -153,7 +155,7 @@ class FileViewer extends react_1.Component {
153
155
  try {
154
156
  fileData = atob(bufferToBase64(data.data, true));
155
157
  }
156
- catch (e) {
158
+ catch (_a) {
157
159
  console.error('Cannot convert base64 to string');
158
160
  fileData = '';
159
161
  }
@@ -187,15 +189,22 @@ class FileViewer extends react_1.Component {
187
189
  parts.splice(0, 2);
188
190
  const adapter = parts[0];
189
191
  const name = parts.splice(1).join('/');
190
- this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
192
+ if (this.props.supportSubscribes) {
193
+ this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
194
+ }
191
195
  }
192
196
  componentWillUnmount() {
193
- this.timeout && clearTimeout(this.timeout);
197
+ if (this.timeout) {
198
+ clearTimeout(this.timeout);
199
+ this.timeout = null;
200
+ }
194
201
  const parts = this.props.href.split('/');
195
202
  parts.splice(0, 2);
196
203
  const adapter = parts[0];
197
204
  const name = parts.splice(1).join('/');
198
- this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
205
+ if (this.props.supportSubscribes) {
206
+ this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
207
+ }
199
208
  }
200
209
  static getEditFile(ext) {
201
210
  switch (ext) {
@@ -57,6 +57,8 @@ export interface TreeItemData {
57
57
  title?: string;
58
58
  /** if the item has "write" button (value=true, ack=false) */
59
59
  button?: boolean;
60
+ /** If the item has read and write and is boolean */
61
+ switch?: boolean;
60
62
  /** if the item has custom settings in `common.custom` */
61
63
  hasCustoms?: boolean;
62
64
  /** If this item is visible */