@iobroker/adapter-react-v5 7.1.3 → 7.2.1

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.
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const socket_client_1 = require("@iobroker/socket-client");
4
+ exports.default = socket_client_1.AdminConnection;
@@ -471,8 +471,19 @@ class UploadImage extends react_1.Component {
471
471
  render() {
472
472
  const { disabled, icon, removeIconFunc, error, crop, onChange } = this.props;
473
473
  const maxSize = this.props.maxSize || 10 * 1024;
474
- const accept = this.props.accept || { 'image/*': [] };
474
+ let accept = this.props.accept || { 'image/*': [] };
475
475
  const { uploadFile, anchorEl, cropHandler } = this.state;
476
+ // covert '"image/png"' to { 'image/*': [] }
477
+ if (typeof accept === 'string') {
478
+ accept = { [accept]: [] };
479
+ }
480
+ else if (Array.isArray(accept)) {
481
+ const result = {};
482
+ accept.forEach(item => {
483
+ result[item] = [];
484
+ });
485
+ accept = result;
486
+ }
476
487
  return (react_1.default.createElement(react_dropzone_1.default, { disabled: !!disabled || cropHandler, key: "dropzone", multiple: false, accept: accept, maxSize: maxSize, onDragEnter: () => this.setState({ uploadFile: 'dragging' }), onDragLeave: () => this.setState({ uploadFile: true }), onDrop: (acceptedFiles, errors) => {
477
488
  this.setState({ uploadFile: false });
478
489
  if (!acceptedFiles.length) {
@@ -495,14 +506,14 @@ class UploadImage extends react_1.Component {
495
506
  ? i18n_1.default.t('ra_Drop file here')
496
507
  : i18n_1.default.t('ra_Place your files here or click here to open the browse dialog')))) : (removeIconFunc &&
497
508
  !cropHandler && (react_1.default.createElement("div", { style: styles.buttonRemoveWrapper },
498
- react_1.default.createElement(material_1.Tooltip, { title: i18n_1.default.t('ra_Clear'), componentsProps: { popper: { sx: { pointerEvents: 'none' } } } },
509
+ react_1.default.createElement(material_1.Tooltip, { title: i18n_1.default.t('ra_Clear'), slotProps: { popper: { sx: { pointerEvents: 'none' } } } },
499
510
  react_1.default.createElement(material_1.IconButton, { size: "large", onClick: e => {
500
511
  removeIconFunc && removeIconFunc();
501
512
  e.stopPropagation();
502
513
  } },
503
514
  react_1.default.createElement(icons_material_1.Close, null)))))),
504
515
  icon && crop && (react_1.default.createElement("div", { style: styles.buttonCropWrapper },
505
- react_1.default.createElement(material_1.Tooltip, { title: i18n_1.default.t('ra_Crop'), componentsProps: { popper: { sx: { pointerEvents: 'none' } } } },
516
+ react_1.default.createElement(material_1.Tooltip, { title: i18n_1.default.t('ra_Crop'), slotProps: { popper: { sx: { pointerEvents: 'none' } } } },
506
517
  react_1.default.createElement(material_1.IconButton, { size: "large", onClick: e => {
507
518
  if (!cropHandler) {
508
519
  this.setState({ cropHandler: true });
@@ -9,7 +9,7 @@ interface DialogConfirmProps {
9
9
  /** The dialog title; default: Are you sure? (translated) */
10
10
  title?: string;
11
11
  /** The dialog text */
12
- text?: string | React.JSX.Element;
12
+ text?: string | React.JSX.Element | React.JSX.Element[];
13
13
  /** Close handler. */
14
14
  onClose?: (ok: boolean) => void;
15
15
  /** if the dialog must be fill sized */
@@ -7,7 +7,7 @@
7
7
  import React, { Component, type JSX } from 'react';
8
8
  interface DialogErrorProps {
9
9
  title?: string;
10
- text: string | React.JSX.Element;
10
+ text: string | React.JSX.Element | React.JSX.Element[];
11
11
  onClose?: () => void;
12
12
  fullWidth?: boolean;
13
13
  }
@@ -7,7 +7,7 @@
7
7
  import React, { Component, type JSX } from 'react';
8
8
  interface DialogMessageProps {
9
9
  title?: string;
10
- text: string | React.JSX.Element;
10
+ text: string | React.JSX.Element | React.JSX.Element[];
11
11
  onClose?: () => void;
12
12
  fullWidth?: boolean;
13
13
  icon?: React.JSX.Element;
@@ -14,6 +14,7 @@ declare global {
14
14
  registerSocketOnLoad: (func: () => void) => void;
15
15
  vendorPrefix: undefined | string;
16
16
  io: any;
17
+ iob: any;
17
18
  }
18
19
  }
19
20
  export type CompactSystemRepositoryEntry = {
@@ -164,7 +164,7 @@ class Connection {
164
164
  */
165
165
  startSocket() {
166
166
  // if socket io is not yet loaded
167
- if (typeof window.io === 'undefined') {
167
+ if (typeof window.io === 'undefined' && typeof window.iob === 'undefined') {
168
168
  // if in index.html the onLoad function not defined
169
169
  if (typeof window.registerSocketOnLoad !== 'function') {
170
170
  // poll if loaded
@@ -225,7 +225,7 @@ class Connection {
225
225
  }
226
226
  }
227
227
  const url = port ? `${protocol}://${host}:${port}${path}` : `${protocol}://${host}${path}`;
228
- this._socket = window.io.connect(url, {
228
+ this._socket = (window.io || window.iob).connect(url, {
229
229
  path: path.endsWith('/') ? `${path}socket.io` : `${path}/socket.io`,
230
230
  query: 'ws=true',
231
231
  name: this.props.name,