@iobroker/adapter-react-v5 6.0.14 → 6.0.16

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.
@@ -224,6 +224,27 @@ class FileViewer extends react_1.Component {
224
224
  this.setState({ imgError: true });
225
225
  }, style: Object.assign(Object.assign({}, styles.img), this.props.getStyleBackgroundImage()), src: `${this.props.href}?ts=${this.state.forceUpdate}`, alt: this.props.href });
226
226
  }
227
+ if (this.state.ext && exports.EXTENSIONS.audio.includes(this.state.ext)) {
228
+ return react_1.default.createElement("div", { style: {
229
+ width: '100%',
230
+ height: '100%',
231
+ display: 'flex',
232
+ justifyContent: 'center',
233
+ alignItems: 'center',
234
+ } },
235
+ react_1.default.createElement("audio", { style: { width: '100%' }, src: this.props.href, controls: true }));
236
+ }
237
+ if (this.state.ext && exports.EXTENSIONS.video.includes(this.state.ext)) {
238
+ return (react_1.default.createElement("div", { style: {
239
+ width: '100%',
240
+ height: '100%',
241
+ display: 'flex',
242
+ justifyContent: 'center',
243
+ alignItems: 'center',
244
+ } },
245
+ react_1.default.createElement("video", { style: { width: '100%', height: '100%' }, controls: true },
246
+ react_1.default.createElement("source", { src: this.props.href, type: `video/${this.state.ext}}` }))));
247
+ }
227
248
  if (this.state.code !== null || this.state.text !== null || this.state.editing) {
228
249
  // File viewer in adapter-react does not support write
229
250
  // return <Editor
@@ -1781,7 +1781,6 @@ class ObjectBrowserClass extends react_1.Component {
1781
1781
  this.localStorage = window._localStorage || window.localStorage;
1782
1782
  this.lastAppliedFilter = null;
1783
1783
  this.pausedSubscribes = false;
1784
- this.selectedFound = false;
1785
1784
  this.root = null;
1786
1785
  this.states = {};
1787
1786
  this.subscribes = [];
@@ -2257,6 +2256,7 @@ class ObjectBrowserClass extends react_1.Component {
2257
2256
  selected = props.selected;
2258
2257
  }
2259
2258
  selected = selected.map(id => id.replace(/["']/g, '')).filter(id => id);
2259
+ this.selectedFound = !selected.length && !this.lastSelectedItems.length;
2260
2260
  const columnsStr = this.localStorage.getItem(`${props.dialogName || 'App'}.columns`);
2261
2261
  let columns;
2262
2262
  try {
@@ -2587,8 +2587,9 @@ class ObjectBrowserClass extends react_1.Component {
2587
2587
  * @param isDouble is double click
2588
2588
  */
2589
2589
  onAfterSelect(isDouble) {
2590
+ var _b;
2590
2591
  this.lastSelectedItems = [...this.state.selected];
2591
- if (this.state.selected && this.state.selected.length) {
2592
+ if ((_b = this.state.selected) === null || _b === void 0 ? void 0 : _b.length) {
2592
2593
  this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, JSON.stringify(this.lastSelectedItems));
2593
2594
  if (this.lastSelectedItems.length === 1 && this.objects[this.lastSelectedItems[0]]) {
2594
2595
  const name = this.lastSelectedItems.length === 1
@@ -2598,7 +2599,8 @@ class ObjectBrowserClass extends react_1.Component {
2598
2599
  }
2599
2600
  }
2600
2601
  else {
2601
- this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, '');
2602
+ this.localStorage.removeItem(`${this.props.dialogName || 'App'}.objectSelected`);
2603
+ this.selectedFound = true;
2602
2604
  if (this.state.selected.length) {
2603
2605
  this.setState({ selected: [] }, () => this.props.onSelect && this.props.onSelect([], ''));
2604
2606
  }
@@ -4458,7 +4460,7 @@ class ObjectBrowserClass extends react_1.Component {
4458
4460
  icons),
4459
4461
  react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.grow), (invertBackground ? this.styles.invertedBackgroundFlex : {})) }),
4460
4462
  react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, iconItem),
4461
- this.props.width !== 'xs' || narrowStyleWithDetails ? react_1.default.createElement("div", null,
4463
+ this.props.width !== 'xs' ? react_1.default.createElement("div", null,
4462
4464
  react_1.default.createElement(IconCopy_1.default, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) })) : null);
4463
4465
  let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign(Object.assign({}, styles.cellName), (useDesc ? styles.cellNameWithDesc : undefined)), { width: this.props.width !== 'xs' ? this.columnsVisibility.name : undefined, ml: narrowStyleWithDetails ? 0 : '5px' }) },
4464
4466
  name,
@@ -4615,6 +4617,9 @@ class ObjectBrowserClass extends react_1.Component {
4615
4617
  padding: 10,
4616
4618
  backgroundColor: this.props.theme.palette.mode === 'dark' ? '#333' : '#ccc',
4617
4619
  } },
4620
+ react_1.default.createElement("div", { style: styles.cellDetailsLine },
4621
+ react_1.default.createElement("div", { style: { flexGrow: 1 } }),
4622
+ react_1.default.createElement(IconCopy_1.default, { style: styles.cellCopyButtonInDetails, onClick: e => this.onCopy(e, id) })),
4618
4623
  colName && react_1.default.createElement("div", { style: styles.cellDetailsLine },
4619
4624
  react_1.default.createElement("span", { style: styles.cellDetailsName },
4620
4625
  this.texts.name,
@@ -5035,15 +5040,18 @@ class ObjectBrowserClass extends react_1.Component {
5035
5040
  * Called when component is updated.
5036
5041
  */
5037
5042
  componentDidUpdate() {
5038
- var _b, _c, _d, _e;
5043
+ var _b, _c, _d, _e, _f, _g;
5044
+ if (!this.selectedFound && !((_b = this.state.selected) === null || _b === void 0 ? void 0 : _b.length) && !((_c = this.lastSelectedItems) === null || _c === void 0 ? void 0 : _c.length)) {
5045
+ this.selectedFound = true;
5046
+ }
5039
5047
  if (this.tableRef.current) {
5040
5048
  const scrollBarWidth = this.tableRef.current.offsetWidth - this.tableRef.current.clientWidth;
5041
5049
  if (this.state.scrollBarWidth !== scrollBarWidth) {
5042
5050
  setTimeout(() => this.setState({ scrollBarWidth }), 100);
5043
5051
  }
5044
5052
  else if (!this.selectedFound &&
5045
- (((_b = this.state.selected) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = this.lastSelectedItems) === null || _c === void 0 ? void 0 : _c[0]))) {
5046
- this.scrollToItem(((_d = this.state.selected) === null || _d === void 0 ? void 0 : _d[0]) || ((_e = this.lastSelectedItems) === null || _e === void 0 ? void 0 : _e[0]));
5053
+ (((_d = this.state.selected) === null || _d === void 0 ? void 0 : _d[0]) || ((_e = this.lastSelectedItems) === null || _e === void 0 ? void 0 : _e[0]))) {
5054
+ this.scrollToItem(((_f = this.state.selected) === null || _f === void 0 ? void 0 : _f[0]) || ((_g = this.lastSelectedItems) === null || _g === void 0 ? void 0 : _g[0]));
5047
5055
  }
5048
5056
  }
5049
5057
  }
package/README.md CHANGED
@@ -781,6 +781,10 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
781
781
  -->
782
782
 
783
783
  ## Changelog
784
+ ### 6.0.16 (2024-07-14)
785
+ * (bluefox) Allowed playing mp3 files in the file browser
786
+ * (bluefox) Corrected jump by object selection
787
+
784
788
  ### 6.0.14 (2024-07-07)
785
789
  * (bluefox) Corrected theme type selection
786
790
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "6.0.14",
3
+ "version": "6.0.16",
4
4
  "description": "React classes to develop admin interfaces for ioBroker with react.",
5
5
  "author": {
6
6
  "name": "Denis Haev (bluefox)",
@@ -30,13 +30,13 @@
30
30
  "@emotion/react": "^11.11.4",
31
31
  "@emotion/styled": "^11.11.5",
32
32
  "@iobroker/socket-client": "^2.4.18",
33
- "@iobroker/types": "^6.0.7-alpha.0-20240702-5c723a4ac",
34
- "@iobroker/js-controller-common": "^6.0.6",
35
- "@iobroker/js-controller-common-db": "^6.0.6",
36
- "@mui/icons-material": "^5.16.0",
37
- "@mui/material": "^5.16.0",
38
- "@mui/x-date-pickers": "^7.9.0",
39
- "@sentry/browser": "^8.15.0",
33
+ "@iobroker/types": "^6.0.8",
34
+ "@iobroker/js-controller-common": "^6.0.8",
35
+ "@iobroker/js-controller-common-db": "^6.0.8",
36
+ "@mui/icons-material": "^5.16.1",
37
+ "@mui/material": "^5.16.1",
38
+ "@mui/x-date-pickers": "^7.10.0",
39
+ "@sentry/browser": "^8.17.0",
40
40
  "react-color": "^2.19.3",
41
41
  "react-colorful": "^5.6.1",
42
42
  "react-cropper": "^2.3.3",