@iobroker/adapter-react-v5 4.13.24 → 5.0.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.
@@ -6,7 +6,7 @@
6
6
  * */
7
7
  import React from 'react';
8
8
  import type { Connection } from '@iobroker/socket-client';
9
- import { ThemeName, ThemeType, Translator } from '../types';
9
+ import { ThemeName, ThemeType, Translate } from '../types';
10
10
  export interface FileBrowserProps {
11
11
  /** The key to identify this component. */
12
12
  key?: string;
@@ -15,7 +15,7 @@ export interface FileBrowserProps {
15
15
  /** The CSS class name. */
16
16
  className?: string;
17
17
  /** Translation function. */
18
- t: Translator;
18
+ t: Translate;
19
19
  /** The selected language. */
20
20
  lang: ioBroker.Languages;
21
21
  /** The socket connection. */
@@ -1,5 +1,5 @@
1
1
  import React, { Component } from 'react';
2
- import { Translator } from '../types';
2
+ import { Translate } from '../types';
3
3
  interface IconSelectorProps {
4
4
  icons?: {
5
5
  icon?: string;
@@ -12,7 +12,7 @@ interface IconSelectorProps {
12
12
  onlyDevices?: boolean;
13
13
  onSelect?: (icon: string) => void;
14
14
  onChange?: (icon: string) => void;
15
- t: Translator;
15
+ t: Translate;
16
16
  lang: ioBroker.Languages;
17
17
  }
18
18
  interface IconSelectorState {
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
+ import { IobTheme } from '../types';
2
3
  interface SaveCloseButtonsProps {
3
4
  noTextOnButtons?: boolean;
4
- theme: any;
5
+ theme: IobTheme;
5
6
  isIFrame?: boolean;
6
7
  newReact?: boolean;
7
8
  onSave: (close: boolean) => void;
@@ -10,10 +11,7 @@ interface SaveCloseButtonsProps {
10
11
  paddingLeft?: number;
11
12
  changed: boolean;
12
13
  error?: boolean;
13
- classes: {
14
- buttonIcon: string;
15
- };
14
+ classes: Record<string, string>;
16
15
  }
17
- /** @type {typeof SaveCloseButtons} */
18
- declare const _export: React.JSXElementConstructor<Omit<SaveCloseButtonsProps, "classes"> & import("@mui/styles").StyledComponentProps<"buttonIcon"> & object>;
19
- export default _export;
16
+ declare const _default: React.JSXElementConstructor<Omit<SaveCloseButtonsProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
17
+ export default _default;
@@ -9,11 +9,11 @@ const styles_1 = require("@mui/styles");
9
9
  const material_1 = require("@mui/material");
10
10
  const icons_material_1 = require("@mui/icons-material");
11
11
  const i18n_1 = __importDefault(require("../i18n"));
12
- const styles = () => ({
12
+ const styles = {
13
13
  buttonIcon: {
14
14
  marginRight: 8,
15
15
  },
16
- });
16
+ };
17
17
  /**
18
18
  * @typedef {object} SaveCloseButtonsProps
19
19
  * @property {boolean} noTextOnButtons Are the buttons without text
@@ -76,6 +76,4 @@ class SaveCloseButtons extends react_1.default.Component {
76
76
  !noTextOnButtons && i18n_1.default.t('ra_Close')));
77
77
  }
78
78
  }
79
- /** @type {typeof SaveCloseButtons} */
80
- const _export = (0, styles_1.withStyles)(styles)(SaveCloseButtons);
81
- exports.default = _export;
79
+ exports.default = (0, styles_1.withStyles)(styles)(SaveCloseButtons);
@@ -1,32 +1,3 @@
1
1
  import React from 'react';
2
- interface ScheduleConfig {
3
- time: {
4
- exactTime: boolean;
5
- start: string;
6
- end: string;
7
- mode: string;
8
- interval: number;
9
- };
10
- period: {
11
- once: string;
12
- days: number;
13
- dows: string;
14
- dates: string;
15
- weeks: number;
16
- months: string | number;
17
- years: number;
18
- yearMonth: number;
19
- yearDate: number;
20
- };
21
- valid: {
22
- from: string;
23
- to?: string;
24
- };
25
- }
26
- interface ScheduleProps {
27
- classes: Record<string, string>;
28
- schedule: string | ScheduleConfig;
29
- onChange: (schedule: string, desc?: string) => void;
30
- }
31
- declare const _default: React.JSXElementConstructor<Omit<ScheduleProps, "classes"> & import("@mui/styles").StyledComponentProps<"hr" | "scrollWindow" | "rowDiv" | "modeDiv" | "settingsDiv" | "inputTime" | "inputDate" | "inputEvery" | "inputRadio" | "inputGroup" | "inputGroupElement" | "inputDateDay" | "inputDateDayCheck" | "inputSmallCheck" | "rowOnce" | "rowDays" | "rowDows" | "rowDates" | "rowWeeks" | "rowMonths" | "rowMonthsDates" | "rowYears" | "rowDaysDows" | "rowDowsDows"> & object>;
2
+ declare const _default: React.JSXElementConstructor<any>;
32
3
  export default _default;
@@ -30,7 +30,7 @@ const react_1 = __importStar(require("react"));
30
30
  const styles_1 = require("@mui/styles");
31
31
  const material_1 = require("@mui/material");
32
32
  const i18n_1 = __importDefault(require("../i18n"));
33
- const styles = (theme) => ({
33
+ const styles = theme => ({
34
34
  hr: {
35
35
  border: 0,
36
36
  borderTop: '1px solid gray',
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { InputProps } from '@mui/material/Input';
3
- import { ThemeType, Translator } from '../types';
3
+ import { ThemeType, Translate } from '../types';
4
4
  interface SelectWithIconProps {
5
- t: Translator;
5
+ t: Translate;
6
6
  lang: ioBroker.Languages;
7
7
  themeType: ThemeType;
8
8
  value?: string;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const cron2text_1 = __importDefault(require("./cron2text"));
7
7
  const jquery_cron_locale_1 = __importDefault(require("./jquery.cron.locale"));
8
+ // TODO: other languages
8
9
  function correctCasus(text /* , seconds */) {
9
10
  text = text.replace('Каждую(ый) минуту', 'Каждую минуту');
10
11
  text = text.replace('Каждую(ый) минут(у)', 'Каждую минуту');
@@ -5,13 +5,9 @@ interface TabContainerProps {
5
5
  className?: string;
6
6
  onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
7
7
  tabIndex?: number;
8
- classes: {
9
- root: string;
10
- overflowHidden: string;
11
- container: string;
12
- };
8
+ classes: Record<string, string>;
13
9
  children: React.ReactNode;
14
10
  }
15
11
  /** @type {typeof TabContainer} */
16
- declare const _export: React.JSXElementConstructor<Omit<TabContainerProps, "classes"> & import("@mui/styles").StyledComponentProps<"root" | "container" | "overflowHidden"> & object>;
12
+ declare const _export: React.JSXElementConstructor<Omit<TabContainerProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
17
13
  export default _export;
@@ -1,32 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
6
+ const react_1 = __importDefault(require("react"));
30
7
  const styles_1 = require("@mui/styles");
31
8
  const material_1 = require("@mui/material");
32
9
  const Utils_1 = __importDefault(require("./Utils"));
@@ -42,12 +19,9 @@ const styles = {
42
19
  height: '100%',
43
20
  },
44
21
  };
45
- class TabContainer extends react_1.Component {
46
- render() {
47
- const { classes } = this.props;
48
- return react_1.default.createElement(material_1.Paper, { elevation: !Number.isNaN(this.props.elevation) ? this.props.elevation : 1, className: Utils_1.default.clsx(classes.root, { [classes.overflowHidden]: this.props.overflow !== 'visible' }, this.props.className), onKeyDown: this.props.onKeyDown, tabIndex: this.props.tabIndex },
49
- react_1.default.createElement(material_1.Grid, { container: true, direction: "column", wrap: "nowrap", className: classes.container }, this.props.children));
50
- }
22
+ function TabContainer(props) {
23
+ return react_1.default.createElement(material_1.Paper, { elevation: !Number.isNaN(props.elevation) ? props.elevation : 1, className: Utils_1.default.clsx(props.classes.root, { [props.classes.overflowHidden]: props.overflow !== 'visible' }, props.className), onKeyDown: props.onKeyDown, tabIndex: props.tabIndex },
24
+ react_1.default.createElement(material_1.Grid, { container: true, direction: "column", wrap: "nowrap", className: props.classes.container }, props.children));
51
25
  }
52
26
  /** @type {typeof TabContainer} */
53
27
  const _export = (0, styles_1.withStyles)(styles)(TabContainer);
@@ -17,10 +17,7 @@ const styles = {
17
17
  overflow: 'auto',
18
18
  },
19
19
  };
20
- class TabContent extends react_1.default.Component {
21
- render() {
22
- const { classes } = this.props;
23
- return react_1.default.createElement(material_1.Grid, { item: true, className: Utils_1.default.clsx(classes.root, this.props.overflow === 'auto' ? classes.overflowAuto : '') }, this.props.children);
24
- }
20
+ function TabContent(props) {
21
+ return react_1.default.createElement(material_1.Grid, { item: true, className: Utils_1.default.clsx(props.classes.root, props.overflow === 'auto' ? props.classes.overflowAuto : '') }, props.children);
25
22
  }
26
23
  exports.default = (0, styles_1.withStyles)(styles)(TabContent);
@@ -2,7 +2,5 @@ import React from 'react';
2
2
  interface TabHeaderProps {
3
3
  children: React.ReactNode;
4
4
  }
5
- declare class TabHeader extends React.Component<TabHeaderProps> {
6
- render(): React.JSX.Element;
7
- }
5
+ declare function TabHeader(props: TabHeaderProps): React.JSX.Element;
8
6
  export default TabHeader;
@@ -5,9 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const material_1 = require("@mui/material");
8
- class TabHeader extends react_1.default.Component {
9
- render() {
10
- return react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, this.props.children);
11
- }
8
+ function TabHeader(props) {
9
+ return react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, props.children);
12
10
  }
13
11
  exports.default = TabHeader;
@@ -241,63 +241,46 @@ class TreeTable extends react_1.Component {
241
241
  val = val[0];
242
242
  }
243
243
  if (col.lookup) {
244
- return this.renderCellEditSelect(item, col, val);
244
+ return this.renderCellEditSelect(col, val);
245
245
  }
246
246
  if (col.editComponent) {
247
- return this.renderCellEditCustom(item, col, val);
247
+ return this.renderCellEditCustom(col, val, item);
248
248
  }
249
249
  if (col.type === 'boolean' || (!col.type && typeof val === 'boolean')) {
250
- return this.renderCellEditBoolean(item, col, val);
250
+ return this.renderCellEditBoolean(col, val);
251
251
  }
252
252
  if (col.type === 'color') {
253
- return this.renderCellEditColor(item, col, val);
253
+ return this.renderCellEditColor(col, val);
254
254
  }
255
255
  if (col.type === 'oid') {
256
- return this.renderCellEditObjectID(item, col, val);
256
+ return this.renderCellEditObjectID(col, val);
257
257
  }
258
258
  if (col.type === 'numeric') {
259
- return this.renderCellEditNumber(item, col, val);
259
+ return this.renderCellEditNumber(col, val);
260
260
  }
261
- return this.renderCellEditString(item, col, val);
261
+ return this.renderCellEditString(col, val);
262
262
  }
263
- renderCellEditSelect(item, col, val) {
264
- return react_1.default.createElement(material_1.Select, { variant: "standard", onChange: e => {
265
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
266
- if (e.target.value === val) {
267
- delete editData[col.field];
268
- }
269
- else {
270
- editData[col.field] = e.target.value;
271
- }
272
- this.setState({ editData });
273
- }, value: (this.state.editData && this.state.editData[col.field]) || val }, col.lookup && Object.keys(col.lookup)
263
+ onChange(col, oldValue, newValue) {
264
+ const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
265
+ if (newValue === oldValue) {
266
+ delete editData[col.field];
267
+ }
268
+ else {
269
+ editData[col.field] = newValue;
270
+ }
271
+ this.setState({ editData });
272
+ }
273
+ renderCellEditSelect(col, val) {
274
+ return react_1.default.createElement(material_1.Select, { variant: "standard", onChange: e => this.onChange(col, val, e.target.value), value: (this.state.editData && this.state.editData[col.field]) || val }, col.lookup && Object.keys(col.lookup)
274
275
  .map((v, i) => { var _c; return react_1.default.createElement(material_1.MenuItem, { key: i, value: v }, (_c = col.lookup) === null || _c === void 0 ? void 0 : _c[v]); }));
275
276
  }
276
- renderCellEditString(item, col, val) {
277
- return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => {
278
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
279
- if (e.target.value === val) {
280
- delete editData[col.field];
281
- }
282
- else {
283
- editData[col.field] = e.target.value;
284
- }
285
- this.setState({ editData });
286
- } });
277
+ renderCellEditString(col, val) {
278
+ return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => this.onChange(col, val, e.target.value) });
287
279
  }
288
- renderCellEditNumber(item, col, val) {
289
- return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, type: "number", fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => {
290
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
291
- if (e.target.value === val) {
292
- delete editData[col.field];
293
- }
294
- else {
295
- editData[col.field] = e.target.value;
296
- }
297
- this.setState({ editData });
298
- } });
280
+ renderCellEditNumber(col, val) {
281
+ return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, type: "number", fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => this.onChange(col, val, e.target.value) });
299
282
  }
300
- renderCellEditCustom(item, col, val) {
283
+ renderCellEditCustom(col, val, item) {
301
284
  const EditComponent = col.editComponent;
302
285
  // use new value if exists
303
286
  if (this.state.editData && this.state.editData[col.field] !== undefined) {
@@ -305,28 +288,10 @@ class TreeTable extends react_1.Component {
305
288
  item = JSON.parse(JSON.stringify(item));
306
289
  item[col.field] = val;
307
290
  }
308
- return react_1.default.createElement(EditComponent, { value: val, rowData: item, onChange: (newVal) => {
309
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
310
- if (newVal === val) {
311
- delete editData[col.field];
312
- }
313
- else {
314
- editData[col.field] = newVal;
315
- }
316
- this.setState({ editData });
317
- } });
291
+ return react_1.default.createElement(EditComponent, { value: val, rowData: item, onChange: (newVal) => this.onChange(col, val, newVal) });
318
292
  }
319
- renderCellEditBoolean(item, col, val) {
320
- return react_1.default.createElement(material_1.Checkbox, { checked: this.state.editData && this.state.editData[col.field] !== undefined ? !!this.state.editData[col.field] : !!val, onChange: e => {
321
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
322
- if (e.target.checked === !!val) {
323
- delete editData[col.field];
324
- }
325
- else {
326
- editData[col.field] = e.target.checked;
327
- }
328
- this.setState({ editData });
329
- }, inputProps: { 'aria-label': 'checkbox' } });
293
+ renderCellEditBoolean(col, val) {
294
+ return react_1.default.createElement(material_1.Checkbox, { checked: this.state.editData && this.state.editData[col.field] !== undefined ? !!this.state.editData[col.field] : !!val, onChange: e => this.onChange(col, !!val, e.target.checked), inputProps: { 'aria-label': 'checkbox' } });
330
295
  }
331
296
  renderSelectColorDialog() {
332
297
  return react_1.default.createElement(material_1.Dialog, { classes: { root: this.props.classes.colorDialog, paper: this.props.classes.colorDialog }, onClose: () => {
@@ -335,30 +300,12 @@ class TreeTable extends react_1.Component {
335
300
  }, open: this.state.showSelectColor },
336
301
  react_1.default.createElement(react_colorful_1.HexColorPicker, { color: this.state.selectIdValue, onChange: color => this.setState({ selectIdValue: color }, () => this.selectCallback && this.selectCallback(color)) }));
337
302
  }
338
- renderCellEditColor(item, col, val) {
303
+ renderCellEditColor(col, val) {
339
304
  const _val = this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val;
340
305
  return react_1.default.createElement("div", { className: this.props.classes.fieldEdit },
341
- react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: _val, inputProps: { style: { backgroundColor: _val, color: Utils_1.default.isUseBright(_val) ? '#FFF' : '#000' } }, onChange: e => {
342
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
343
- if (e.target.value === val) {
344
- delete editData[col.field];
345
- }
346
- else {
347
- editData[col.field] = e.target.value;
348
- }
349
- this.setState({ editData });
350
- } }),
306
+ react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: _val, inputProps: { style: { backgroundColor: _val, color: Utils_1.default.isUseBright(_val) ? '#FFF' : '#000' } }, onChange: e => this.onChange(col, !!val, e.target.value) }),
351
307
  react_1.default.createElement(material_1.IconButton, { className: this.props.classes.fieldButton, onClick: () => {
352
- this.selectCallback = newColor => {
353
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
354
- if (newColor === val) {
355
- delete editData[col.field];
356
- }
357
- else {
358
- editData[col.field] = newColor;
359
- }
360
- this.setState({ editData });
361
- };
308
+ this.selectCallback = newColor => this.onChange(col, val, newColor);
362
309
  this.setState({ showSelectColor: true, selectIdValue: val });
363
310
  }, size: "large" },
364
311
  react_1.default.createElement(icons_material_1.Colorize, null)));
@@ -373,29 +320,11 @@ class TreeTable extends react_1.Component {
373
320
  }
374
321
  return null;
375
322
  }
376
- renderCellEditObjectID(item, col, val) {
323
+ renderCellEditObjectID(col, val) {
377
324
  return react_1.default.createElement("div", { className: this.props.classes.fieldEdit },
378
- react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => {
379
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
380
- if (e.target.value === val) {
381
- delete editData[col.field];
382
- }
383
- else {
384
- editData[col.field] = e.target.value;
385
- }
386
- this.setState({ editData });
387
- } }),
325
+ react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => this.onChange(col, val, e.target.value) }),
388
326
  react_1.default.createElement(material_1.IconButton, { className: this.props.classes.fieldButton, onClick: () => {
389
- this.selectCallback = selected => {
390
- const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
391
- if (selected === val) {
392
- delete editData[col.field];
393
- }
394
- else {
395
- editData[col.field] = selected;
396
- }
397
- this.setState({ editData });
398
- };
327
+ this.selectCallback = selected => this.onChange(col, val, selected);
399
328
  this.setState({ showSelectId: true, selectIdValue: val });
400
329
  }, size: "large" },
401
330
  react_1.default.createElement(icons_material_1.ViewHeadline, null)));
@@ -5,7 +5,7 @@
5
5
  *
6
6
  **/
7
7
  import React from 'react';
8
- import { ThemeName, ThemeType } from "../types";
8
+ import { ThemeName, ThemeType } from '../types';
9
9
  interface GetObjectNameOptions {
10
10
  name?: ioBroker.StringOrTranslated;
11
11
  language?: ioBroker.Languages;
@@ -1,4 +1,4 @@
1
- import { Translator, Width } from '../types';
1
+ import { Translate, Width } from '../types';
2
2
  import Connection from '../Connection';
3
3
  import Router from './Router';
4
4
 
@@ -14,15 +14,15 @@ export interface ObjectBrowserTableFilter {
14
14
  export type ObjectBrowserColumn = 'name' | 'type' | 'role' | 'room' | 'func' | 'val' | 'buttons';
15
15
 
16
16
  export interface ObjectBrowserCustomFilter {
17
- type?: string | string[];
18
- common?: {
19
- type?: string | string[];
20
- role?: string | string[];
17
+ readonly type?: string | string[];
18
+ readonly common?: {
19
+ readonly type?: string | string[];
20
+ readonly role?: string | string[];
21
21
  // If "_" - no custom set
22
22
  // If "_dataSources" - only data sources (history, sql, influxdb, ...)
23
23
  // Else "telegram." or something like this
24
24
  // `true` - If common.custom not empty
25
- custom?: '_' | '_dataSources' | true | string;
25
+ readonly custom?: '_' | '_dataSources' | true | string;
26
26
  };
27
27
  }
28
28
 
@@ -52,7 +52,7 @@ export interface ObjectBrowserProps {
52
52
  /** Theme name. */
53
53
  themeName?: string;
54
54
  /** Translation function. */
55
- t: Translator;
55
+ t: Translate;
56
56
  /** The selected language. */
57
57
  lang: ioBroker.Languages;
58
58
  /** Allow to select multiple objects? (default: false) */
package/GenericApp.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  import React from 'react';
8
8
  import { AdminConnection } from '@iobroker/socket-client';
9
9
  import Router from './Components/Router';
10
- import { GenericAppProps, GenericAppState, GenericAppSettings, ThemeName, ThemeType, Theme, Width } from './types';
10
+ import { GenericAppProps, GenericAppState, GenericAppSettings, ThemeName, ThemeType, IobTheme, Width } from './types';
11
11
  declare global {
12
12
  /** If config has been changed */
13
13
  var changed: boolean;
@@ -69,15 +69,15 @@ declare class GenericApp<TProps extends GenericAppProps = GenericAppProps, TStat
69
69
  * Get a theme
70
70
  * @param name Theme name
71
71
  */
72
- createTheme(name?: ThemeName | null | undefined): Theme;
72
+ createTheme(name?: ThemeName | null | undefined): IobTheme;
73
73
  /**
74
74
  * Get the theme name
75
75
  */
76
- getThemeName(currentTheme: Theme): ThemeName;
76
+ getThemeName(currentTheme: IobTheme): ThemeName;
77
77
  /**
78
78
  * Get the theme type
79
79
  */
80
- getThemeType(currentTheme: Theme): ThemeType;
80
+ getThemeType(currentTheme: IobTheme): ThemeType;
81
81
  onThemeChanged(newThemeName: string): void;
82
82
  onToggleExpertMode(expertMode: boolean): void;
83
83
  /**
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { type HostInfo } from '@iobroker/js-controller-common/build/esm/lib/common/tools';
3
- import { type FilteredNotificationInformation } from '@iobroker/js-controller-common-db/build/esm/lib/common/notificationHandler';
2
+ import { type HostInfo } from '@iobroker/js-controller-common-db/build/esm/lib/common/tools';
3
+ import { type FilteredNotificationInformation } from '@iobroker/js-controller-common/build/esm/lib/common/notificationHandler';
4
4
  /**
5
5
  * Copyright 2020-2024, Denis Haev (bluefox) <dogafox@gmail.com>
6
6
  *
@@ -578,10 +578,6 @@ declare class Connection {
578
578
  timeoutMs?: number): Promise<HostInfo>;
579
579
  /**
580
580
  * Get the host information (short version).
581
- * @param {string} host
582
- * @param {boolean} [update] Force update.
583
- * @param {number} [timeoutMs] optional read timeout.
584
- * @returns {Promise<any>}
585
581
  */
586
582
  getHostInfoShort(host: string,
587
583
  /** Force update. */
@@ -590,11 +586,6 @@ declare class Connection {
590
586
  timeoutMs?: number): Promise<HostInfo>;
591
587
  /**
592
588
  * Get the repository.
593
- * @param {string} host
594
- * @param {any} [args]
595
- * @param {boolean} [update] Force update.
596
- * @param {number} [timeoutMs] timeout in ms.
597
- * @returns {Promise<any>}
598
589
  */
599
590
  getRepository(host: string, options?: {
600
591
  update: boolean;
@@ -718,7 +709,6 @@ declare class Connection {
718
709
  changePassword(user: string, password: string): Promise<void>;
719
710
  /**
720
711
  * Get the IP addresses of the given host.
721
- * @returns {Promise<string[]>}
722
712
  */
723
713
  getIpAddresses(host: string,
724
714
  /** Force update. */
@@ -841,6 +831,10 @@ declare class Connection {
841
831
  getAdaptersResetCache(adapter?: string): void;
842
832
  getCompactInstances(update?: boolean): Promise<Record<string, ioBroker.InstanceObject>>;
843
833
  getAdapternInstancesResetCache(adapter?: string): void;
834
+ /**
835
+ * Returns very optimized information for adapters to minimize a connection load.
836
+ * Reads only version of installed adapter
837
+ */
844
838
  getCompactInstalled(host: string, update?: boolean, cmdTimeout?: number): Promise<Record<string, ioBroker.AdapterObject>>;
845
839
  getCompactSystemRepositories(update?: boolean, cmdTimeout?: number): Promise<ioBroker.Object>;
846
840
  getCompactSystemConfig(update?: boolean): Promise<ioBroker.Object>;
@@ -1756,10 +1756,6 @@ class Connection {
1756
1756
  }
1757
1757
  /**
1758
1758
  * Get the host information (short version).
1759
- * @param {string} host
1760
- * @param {boolean} [update] Force update.
1761
- * @param {number} [timeoutMs] optional read timeout.
1762
- * @returns {Promise<any>}
1763
1759
  */
1764
1760
  getHostInfoShort(host,
1765
1761
  /** Force update. */
@@ -1805,11 +1801,6 @@ class Connection {
1805
1801
  }
1806
1802
  /**
1807
1803
  * Get the repository.
1808
- * @param {string} host
1809
- * @param {any} [args]
1810
- * @param {boolean} [update] Force update.
1811
- * @param {number} [timeoutMs] timeout in ms.
1812
- * @returns {Promise<any>}
1813
1804
  */
1814
1805
  getRepository(host, options,
1815
1806
  /** Force update. */
@@ -2192,7 +2183,6 @@ class Connection {
2192
2183
  }
2193
2184
  /**
2194
2185
  * Get the IP addresses of the given host.
2195
- * @returns {Promise<string[]>}
2196
2186
  */
2197
2187
  getIpAddresses(host,
2198
2188
  /** Force update. */
@@ -2501,8 +2491,10 @@ class Connection {
2501
2491
  delete this._promises.compactInstances;
2502
2492
  delete this._promises[`instances_${adapter}`];
2503
2493
  }
2504
- // Returns very optimized information for adapters to minimize a connection load.
2505
- // Reads only version of installed adapter
2494
+ /**
2495
+ * Returns very optimized information for adapters to minimize a connection load.
2496
+ * Reads only version of installed adapter
2497
+ */
2506
2498
  getCompactInstalled(host, update, cmdTimeout) {
2507
2499
  if (Connection.isWeb()) {
2508
2500
  return Promise.reject('Allowed only in admin');
package/README.md CHANGED
@@ -670,9 +670,14 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
670
670
  -->
671
671
 
672
672
  ## Changelog
673
+ ### 5.0.0 (2024-05-29)
674
+ * (bluefox) Types are now exported
675
+ * (bluefox) Translator renamed to Translate
676
+ * (bluefox) Breaking: Theme renamed to IobTheme because of the naming conflict
677
+
673
678
  ### 4.13.24 (2024-05-25)
674
679
  * (bluefox) Updated packages
675
- *
680
+
676
681
  * ### 4.13.22 (2024-05-23)
677
682
  * (bluefox) Updated packages
678
683
 
package/Theme.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { type Theme, type ThemeName } from './types';
1
+ import { type IobTheme, type ThemeName } from './types';
2
2
  /**
3
3
  * The theme creation factory function.
4
4
  */
5
- declare const CustomTheme: (type: ThemeName) => Theme;
5
+ declare const CustomTheme: (type: ThemeName) => IobTheme;
6
6
  export default CustomTheme;
@@ -58,6 +58,7 @@ module.exports = {
58
58
  }
59
59
  return webpackConfig;
60
60
  },
61
+
61
62
  overrideDevServerConfig: ({devServerConfig}) => {
62
63
  devServerConfig.headers = {
63
64
  'Access-Control-Allow-Origin': '*',
@@ -67,4 +68,4 @@ module.exports = {
67
68
 
68
69
  return devServerConfig;
69
70
  },
70
- };
71
+ };
package/index.d.ts CHANGED
@@ -128,3 +128,4 @@ export { PROGRESS } from './Connection';
128
128
  export { default as AdminConnection } from './AdminConnection';
129
129
  export * from './AdminConnection';
130
130
  export { default as LegacyConnection } from './LegacyConnection';
131
+ export type * from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "4.13.24",
3
+ "version": "5.0.0",
4
4
  "description": "React classes to develop admin interfaces for ioBroker with react.",
5
5
  "author": {
6
6
  "name": "Denis Haev (bluefox)",
@@ -31,15 +31,15 @@
31
31
  "@emotion/styled": "^11.11.5",
32
32
  "@iobroker/dm-utils": "^0.1.9",
33
33
  "@iobroker/json-config": "^6.17.14",
34
- "@iobroker/socket-client": "^2.4.13",
35
- "@iobroker/types": "^6.0.1-alpha.0-20240524-14a872375",
36
- "@iobroker/js-controller-common": "^6.0.1-alpha.0-20240524-14a872375",
37
- "@iobroker/js-controller-common-db": "^6.0.1-alpha.0-20240524-14a872375",
34
+ "@iobroker/socket-client": "^2.4.14",
35
+ "@iobroker/types": "^6.0.1-alpha.0-20240529-9dbeeb628",
36
+ "@iobroker/js-controller-common": "^6.0.1-alpha.0-20240529-9dbeeb628",
37
+ "@iobroker/js-controller-common-db": "^6.0.1-alpha.0-20240529-9dbeeb628",
38
38
  "@mui/icons-material": "^5.15.18",
39
39
  "@mui/material": "5.14.14",
40
40
  "@mui/styles": "5.14.14",
41
41
  "@mui/x-date-pickers": "^7.5.1",
42
- "@sentry/browser": "^8.4.0",
42
+ "@sentry/browser": "^8.5.0",
43
43
  "react-color": "^2.19.3",
44
44
  "react-colorful": "^5.6.1",
45
45
  "react-cropper": "^2.3.3",
package/types.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Theme as MuiTheme, Palette as MuiPalette } from '@mui/material/styles';
3
3
  import { AdminConnection, Connection } from '@iobroker/socket-client';
4
4
  import LegacyConnection from './LegacyConnection';
5
5
 
6
- export type Translator = (key: string, ...args: any[]) => string;
6
+ export type Translate = (key: string, ...args: (string | number | boolean)[]) => string;
7
7
 
8
8
  export interface ConnectionProps {
9
9
  /** The socket name. */
@@ -79,7 +79,7 @@ export interface GenericAppState {
79
79
  loaded: boolean;
80
80
  themeType: ThemeType;
81
81
  themeName: ThemeName;
82
- theme: Theme;
82
+ theme: IobTheme;
83
83
  expertMode: boolean;
84
84
  selectedTab: string;
85
85
  selectedTabNum: number | undefined;
@@ -123,7 +123,7 @@ interface Palette extends MuiPalette {
123
123
  }
124
124
  }
125
125
 
126
- export interface Theme extends MuiTheme {
126
+ export interface IobTheme extends MuiTheme {
127
127
  name: ThemeName;
128
128
  palette: Palette;
129
129
  toolbar: React.CSSProperties;