@iobroker/adapter-react-v5 6.0.0 → 6.0.2

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,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { IobTheme } from '../types';
2
3
  interface CustomModalProps {
3
4
  icon?: any;
4
5
  open: boolean;
@@ -19,6 +20,7 @@ interface CustomModalProps {
19
20
  progress?: boolean;
20
21
  textInput?: boolean;
21
22
  defaultValue?: string;
23
+ theme: IobTheme;
22
24
  }
23
25
  declare const CustomModal: (props: CustomModalProps) => React.JSX.Element;
24
26
  export default CustomModal;
@@ -46,11 +46,11 @@ const styles = {
46
46
  content: {
47
47
  fontSize: 16,
48
48
  },
49
- languageButton: (theme) => ({
49
+ languageButton: {
50
50
  position: 'absolute',
51
51
  right: 8,
52
52
  top: 8,
53
- }),
53
+ },
54
54
  languageButtonActive: (theme) => ({
55
55
  color: theme.palette.primary.main,
56
56
  }),
@@ -69,7 +69,7 @@ const CustomModal = (props) => {
69
69
  title && react_1.default.createElement(material_1.DialogTitle, null,
70
70
  icon ? react_1.default.createElement(Icon, { style: styles.titleIcon }) : null,
71
71
  title,
72
- i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large", sx: Utils_1.default.getStyle(styles.languageButton, noTranslation && styles.languageButtonActive), onClick: () => toggleTranslation(), title: i18n_1.default.t('Disable/Enable translation') },
72
+ i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large", sx: Utils_1.default.getStyle(props.theme, styles.languageButton, noTranslation && styles.languageButtonActive), onClick: () => toggleTranslation(), title: i18n_1.default.t('Disable/Enable translation') },
73
73
  react_1.default.createElement(icons_material_1.Language, null)) : null),
74
74
  react_1.default.createElement(material_1.DialogContent, { style: Object.assign(Object.assign(Object.assign({}, styles.content), (overflowHidden ? styles.overflowHidden : undefined)), { paddingTop: 8 }) },
75
75
  textInput && react_1.default.createElement(material_1.TextField
@@ -1231,7 +1231,7 @@ class FileBrowserClass extends react_1.Component {
1231
1231
  !this.state.selected.startsWith(`${this.limitToPath}/`) &&
1232
1232
  this.limitToPath !== this.state.selected), title: this.props.t('ra_Upload file'), style: styles.menuButton, color: "inherit", "aria-label": "upload file", onClick: () => this.setState({ uploadFile: true }), size: "small" },
1233
1233
  react_1.default.createElement(icons_material_1.Publish, { fontSize: "small" })) : null,
1234
- this.props.showTypeSelector && IconType ? react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Filter files') },
1234
+ this.props.showTypeSelector && IconType ? react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Filter files'), componentsProps: { popper: { sx: styles.tooltip } } },
1235
1235
  react_1.default.createElement(material_1.IconButton, { size: "small", onClick: e => this.setState({ showTypesMenu: e.target }) },
1236
1236
  react_1.default.createElement(IconType, { fontSize: "small" }))) : null,
1237
1237
  this.state.showTypesMenu ? react_1.default.createElement(material_1.Menu, { open: !0, anchorEl: this.state.showTypesMenu, onClose: () => this.setState({ showTypesMenu: null }) }, Object.keys(FILE_TYPE_ICONS).map(type => {
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSelectIdIcon = exports.getSystemIcon = void 0;
6
+ exports.getSystemIcon = getSystemIcon;
7
+ exports.getSelectIdIcon = getSelectIdIcon;
8
+ exports.default = Icon;
7
9
  const react_1 = __importDefault(require("react"));
8
10
  const react_inlinesvg_1 = __importDefault(require("react-inlinesvg"));
9
11
  const icons_material_1 = require("@mui/icons-material");
@@ -49,7 +51,6 @@ function getSystemIcon(obj) {
49
51
  }
50
52
  return icon || null;
51
53
  }
52
- exports.getSystemIcon = getSystemIcon;
53
54
  function getSelectIdIcon(obj, imagePrefix) {
54
55
  imagePrefix = imagePrefix || '.'; // http://localhost:8081';
55
56
  let src = '';
@@ -96,7 +97,6 @@ function getSelectIdIcon(obj, imagePrefix) {
96
97
  }
97
98
  return src || null;
98
99
  }
99
- exports.getSelectIdIcon = getSelectIdIcon;
100
100
  const REMOTE_SERVER = window.location.hostname.includes('iobroker.in');
101
101
  const REMOTE_PREFIX = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1);
102
102
  function Icon(props) {
@@ -135,4 +135,3 @@ function Icon(props) {
135
135
  }
136
136
  return null;
137
137
  }
138
- exports.default = Icon;
@@ -32,7 +32,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32
32
  };
33
33
  var _a, _ObjectBrowserClass_NON_EXPERT_NAMESPACES;
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ObjectBrowserClass = exports.ITEM_IMAGES = exports.getSelectIdIconFromObjects = void 0;
35
+ exports.ObjectBrowserClass = exports.ITEM_IMAGES = void 0;
36
+ exports.getSelectIdIconFromObjects = getSelectIdIconFromObjects;
36
37
  /**
37
38
  * Copyright 2020-2024, Denis Haev <dogafox@gmail.com>
38
39
  *
@@ -719,37 +720,6 @@ const styles = {
719
720
  display: 'flex',
720
721
  },
721
722
  };
722
- function getStyle(theme, ...args) {
723
- const result = {};
724
- for (let a = 0; a < args.length; a++) {
725
- if (typeof args[a] === 'function') {
726
- Object.assign(result, args[a](theme));
727
- }
728
- else if (args[a] && typeof args[a] === 'object') {
729
- Object.keys(args[a]).forEach((attr) => {
730
- if (typeof args[a][attr] === 'function') {
731
- result[attr] = args[a][attr](theme);
732
- }
733
- else if (typeof args[a][attr] === 'object') {
734
- const obj = args[a][attr];
735
- result[attr] = {};
736
- Object.keys(obj).forEach((attr1) => {
737
- if (typeof obj[attr1] === 'function') {
738
- result[attr][attr1] = obj(theme);
739
- }
740
- else if (obj[attr1] || obj[attr1] === 0) {
741
- result[attr][attr1] = obj[attr1];
742
- }
743
- });
744
- }
745
- else if (args[a][attr] || args[a][attr] === 0) {
746
- result[attr] = args[a][attr];
747
- }
748
- });
749
- }
750
- }
751
- return result;
752
- }
753
723
  /**
754
724
  * Function that walks through all keys of an object or array and applies a function to each key.
755
725
  */
@@ -947,7 +917,6 @@ function getSelectIdIconFromObjects(objects, id, imagePrefix) {
947
917
  }
948
918
  return src || null;
949
919
  }
950
- exports.getSelectIdIconFromObjects = getSelectIdIconFromObjects;
951
920
  function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth) {
952
921
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
953
922
  _depth = _depth || 0;
@@ -2793,7 +2762,7 @@ class ObjectBrowserClass extends react_1.Component {
2793
2762
  return null;
2794
2763
  }
2795
2764
  return react_1.default.createElement(material_1.Dialog, { onClose: () => this.setState({ columnsSelectorShow: false }), open: !0, sx: {
2796
- '& .MuiPaper-root': getStyle(this.props.theme, styles.dialogColumns, styles[`transparent_${this.state.columnsDialogTransparent}`]),
2765
+ '& .MuiPaper-root': Utils_1.default.getStyle(this.props.theme, styles.dialogColumns, styles[`transparent_${this.state.columnsDialogTransparent}`]),
2797
2766
  } },
2798
2767
  react_1.default.createElement(material_1.DialogTitle, { sx: styles.fontSizeTitle }, this.props.t('ra_Configure')),
2799
2768
  react_1.default.createElement(material_1.DialogContent, { sx: styles.fontSizeTitle },
@@ -4440,7 +4409,7 @@ class ObjectBrowserClass extends react_1.Component {
4440
4409
  useDesc = !!oTooltip;
4441
4410
  }
4442
4411
  }
4443
- return react_1.default.createElement(material_1.Grid, { container: true, direction: "row", wrap: "nowrap", sx: getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
4412
+ return react_1.default.createElement(material_1.Grid, { container: true, direction: "row", wrap: "nowrap", sx: Utils_1.default.getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
4444
4413
  !item.data.visible &&
4445
4414
  !item.data.hasVisibleChildren &&
4446
4415
  styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
@@ -5341,26 +5310,26 @@ class ObjectBrowserClass extends react_1.Component {
5341
5310
  this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer);
5342
5311
  if (this.styleTheme !== this.props.themeType) {
5343
5312
  this.styles = {
5344
- cellIdIconFolder: getStyle(this.props.theme, styles.cellIdIconFolder),
5345
- cellIdIconDocument: getStyle(this.props.theme, styles.cellIdIconDocument),
5346
- iconDeviceError: getStyle(this.props.theme, styles.iconDeviceError),
5347
- iconDeviceConnected: getStyle(this.props.theme, styles.iconDeviceConnected),
5348
- iconDeviceDisconnected: getStyle(this.props.theme, styles.iconDeviceDisconnected),
5349
- cellButtonsButtonWithCustoms: getStyle(this.props.theme, styles.cellButtonsButtonWithCustoms),
5350
- invertedBackground: getStyle(this.props.theme, styles.invertedBackground),
5351
- invertedBackgroundFlex: getStyle(this.props.theme, styles.invertedBackgroundFlex),
5352
- contextMenuEdit: getStyle(this.props.theme, styles.contextMenuEdit),
5353
- contextMenuEditValue: getStyle(this.props.theme, styles.contextMenuEditValue),
5354
- contextMenuView: getStyle(this.props.theme, styles.contextMenuView),
5355
- contextMenuCustom: getStyle(this.props.theme, styles.contextMenuCustom),
5356
- contextMenuACL: getStyle(this.props.theme, styles.contextMenuACL),
5357
- contextMenuRoom: getStyle(this.props.theme, styles.contextMenuRoom),
5358
- contextMenuRole: getStyle(this.props.theme, styles.contextMenuRole),
5359
- contextMenuDelete: getStyle(this.props.theme, styles.contextMenuDelete),
5360
- filterInput: getStyle(this.props.theme, styles.headerCellInput, styles.filterInput),
5361
- iconCopy: getStyle(this.props.theme, styles.cellButtonsValueButton, styles.cellButtonsValueButtonCopy),
5362
- aliasReadWrite: getStyle(styles.cellIdAlias, styles.cellIdAliasReadWrite),
5363
- aliasAlone: getStyle(styles.cellIdAlias, styles.cellIdAliasAlone),
5313
+ cellIdIconFolder: Utils_1.default.getStyle(this.props.theme, styles.cellIdIconFolder),
5314
+ cellIdIconDocument: Utils_1.default.getStyle(this.props.theme, styles.cellIdIconDocument),
5315
+ iconDeviceError: Utils_1.default.getStyle(this.props.theme, styles.iconDeviceError),
5316
+ iconDeviceConnected: Utils_1.default.getStyle(this.props.theme, styles.iconDeviceConnected),
5317
+ iconDeviceDisconnected: Utils_1.default.getStyle(this.props.theme, styles.iconDeviceDisconnected),
5318
+ cellButtonsButtonWithCustoms: Utils_1.default.getStyle(this.props.theme, styles.cellButtonsButtonWithCustoms),
5319
+ invertedBackground: Utils_1.default.getStyle(this.props.theme, styles.invertedBackground),
5320
+ invertedBackgroundFlex: Utils_1.default.getStyle(this.props.theme, styles.invertedBackgroundFlex),
5321
+ contextMenuEdit: Utils_1.default.getStyle(this.props.theme, styles.contextMenuEdit),
5322
+ contextMenuEditValue: Utils_1.default.getStyle(this.props.theme, styles.contextMenuEditValue),
5323
+ contextMenuView: Utils_1.default.getStyle(this.props.theme, styles.contextMenuView),
5324
+ contextMenuCustom: Utils_1.default.getStyle(this.props.theme, styles.contextMenuCustom),
5325
+ contextMenuACL: Utils_1.default.getStyle(this.props.theme, styles.contextMenuACL),
5326
+ contextMenuRoom: Utils_1.default.getStyle(this.props.theme, styles.contextMenuRoom),
5327
+ contextMenuRole: Utils_1.default.getStyle(this.props.theme, styles.contextMenuRole),
5328
+ contextMenuDelete: Utils_1.default.getStyle(this.props.theme, styles.contextMenuDelete),
5329
+ filterInput: Utils_1.default.getStyle(this.props.theme, styles.headerCellInput, styles.filterInput),
5330
+ iconCopy: Utils_1.default.getStyle(this.props.theme, styles.cellButtonsValueButton, styles.cellButtonsValueButtonCopy),
5331
+ aliasReadWrite: Utils_1.default.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasReadWrite),
5332
+ aliasAlone: Utils_1.default.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasAlone),
5364
5333
  };
5365
5334
  this.styleTheme = this.props.themeType;
5366
5335
  }
@@ -1,4 +1,5 @@
1
1
  import React, { Component } from 'react';
2
+ import { IobTheme } from '../types';
2
3
  interface ScheduleConfig {
3
4
  time: {
4
5
  exactTime: boolean;
@@ -26,6 +27,7 @@ interface ScheduleConfig {
26
27
  interface ScheduleProps {
27
28
  schedule: string | ScheduleConfig;
28
29
  onChange: (schedule: string, desc?: string) => void;
30
+ theme: IobTheme;
29
31
  }
30
32
  interface ScheduleState {
31
33
  schedule: ScheduleConfig;
@@ -705,7 +705,7 @@ class Schedule extends react_1.Component {
705
705
  }, 1500, e.target.value);
706
706
  }, InputLabelProps: { shrink: true }, label: i18n_1.default.t('sch_at'), margin: "normal" }))),
707
707
  // ----- days ---
708
- react_1.default.createElement(material_1.Box, { component: "div", key: "days", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowDays) },
708
+ react_1.default.createElement(material_1.Box, { component: "div", key: "days", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowDays) },
709
709
  react_1.default.createElement("div", { style: styles.modeDiv },
710
710
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.days, onClick: () => {
711
711
  const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
@@ -741,7 +741,7 @@ class Schedule extends react_1.Component {
741
741
  </div>,
742
742
  */
743
743
  // ----- weeks ---
744
- react_1.default.createElement(material_1.Box, { component: "div", key: "weeks", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowDows) },
744
+ react_1.default.createElement(material_1.Box, { component: "div", key: "weeks", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowDows) },
745
745
  react_1.default.createElement("div", { style: styles.modeDiv },
746
746
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.weeks, onClick: () => {
747
747
  const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
@@ -758,9 +758,9 @@ class Schedule extends react_1.Component {
758
758
  } }), label: i18n_1.default.t('sch_periodWeekly') })),
759
759
  react_1.default.createElement(material_1.Box, { component: "div", style: styles.settingsDiv },
760
760
  react_1.default.createElement("div", { style: styles.settingsDiv }, this.getPeriodSettingsWeekly()),
761
- react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(styles.settingsDiv, styles.rowDowsDows) }, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
761
+ react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles.settingsDiv, styles.rowDowsDows) }, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
762
762
  // ----- months ---
763
- react_1.default.createElement(material_1.Box, { component: "div", key: "months", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowMonths) },
763
+ react_1.default.createElement(material_1.Box, { component: "div", key: "months", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowMonths) },
764
764
  react_1.default.createElement("div", { style: styles.modeDiv },
765
765
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.months, onClick: () => {
766
766
  const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
@@ -778,7 +778,7 @@ class Schedule extends react_1.Component {
778
778
  react_1.default.createElement("div", { style: styles.settingsDiv },
779
779
  this.getPeriodSettingsMonthly(),
780
780
  schedule.period.months ? react_1.default.createElement(material_1.Box, null,
781
- react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(styles.settingsDiv, styles.rowMonthsDates) },
781
+ react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates) },
782
782
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { style: styles.inputRadio, checked: !!schedule.period.dates, onClick: () => {
783
783
  const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
784
784
  _schedule.period.months = _schedule.period.months || 1;
@@ -796,9 +796,9 @@ class Schedule extends react_1.Component {
796
796
  _schedule.period.once = '';
797
797
  this.onChange(_schedule);
798
798
  } }), label: i18n_1.default.t('sch_periodDates') })),
799
- react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(styles.settingsDiv, styles.rowMonthsDates) }, this.getPeriodSettingsDates())) : null)),
799
+ react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates) }, this.getPeriodSettingsDates())) : null)),
800
800
  // ----- years ---
801
- react_1.default.createElement(material_1.Box, { component: "div", key: "years", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowYears) },
801
+ react_1.default.createElement(material_1.Box, { component: "div", key: "years", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowYears) },
802
802
  react_1.default.createElement("div", { style: styles.modeDiv },
803
803
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.years, onClick: () => {
804
804
  const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.cron2state = void 0;
6
+ exports.cron2state = cron2state;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const material_1 = require("@mui/material");
9
9
  const cronText_1 = __importDefault(require("./cronText"));
@@ -213,7 +213,6 @@ function cron2state(cron, force) {
213
213
  }
214
214
  return state;
215
215
  }
216
- exports.cron2state = cron2state;
217
216
  class SimpleCron extends react_1.default.Component {
218
217
  constructor(props) {
219
218
  super(props);
@@ -604,7 +603,7 @@ class SimpleCron extends react_1.default.Component {
604
603
  render() {
605
604
  return react_1.default.createElement("div", { style: styles.mainDiv },
606
605
  react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%' } },
607
- react_1.default.createElement(material_1.TextField, { style: { width: '100%' }, value: this.state.cron, disabled: true })),
606
+ react_1.default.createElement(material_1.TextField, { variant: "standard", style: { width: '100%' }, value: this.state.cron, disabled: true })),
608
607
  react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%', height: 60 } }, (0, cronText_1.default)(this.state.cron, this.props.language || 'en')),
609
608
  react_1.default.createElement("div", null,
610
609
  react_1.default.createElement(material_1.FormControl, { variant: "standard", style: Object.assign(Object.assign({}, styles.formControl), { marginLeft: 8, marginTop: 8 }) },
@@ -2,10 +2,13 @@ import React from 'react';
2
2
  interface TabContainerProps {
3
3
  elevation?: number;
4
4
  overflow?: string;
5
- className?: string;
6
- style?: React.CSSProperties;
5
+ styles?: {
6
+ root?: React.CSSProperties;
7
+ container?: React.CSSProperties;
8
+ };
7
9
  onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
8
10
  tabIndex?: number;
11
+ /** The content of the component. */
9
12
  children: React.ReactNode;
10
13
  }
11
14
  declare function TabContainer(props: TabContainerProps): React.JSX.Element;
@@ -18,7 +18,8 @@ const styles = {
18
18
  },
19
19
  };
20
20
  function TabContainer(props) {
21
- return react_1.default.createElement(material_1.Paper, { elevation: !Number.isNaN(props.elevation) ? props.elevation : 1, className: props.className, style: Object.assign(Object.assign(Object.assign({}, styles.root), (props.overflow !== 'visible' ? styles.overflowHidden : undefined)), props.style), onKeyDown: props.onKeyDown, tabIndex: props.tabIndex },
21
+ var _a;
22
+ return react_1.default.createElement(material_1.Paper, { elevation: !Number.isNaN(props.elevation) ? props.elevation : 1, style: Object.assign(Object.assign(Object.assign({}, styles.root), (((_a = props.styles) === null || _a === void 0 ? void 0 : _a.root) || undefined)), (props.overflow !== 'visible' ? styles.overflowHidden : undefined)), onKeyDown: props.onKeyDown, tabIndex: props.tabIndex },
22
23
  react_1.default.createElement(material_1.Grid, { container: true, direction: "column", wrap: "nowrap", sx: styles.container }, props.children));
23
24
  }
24
25
  exports.default = TabContainer;
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  interface TabContentProps {
3
- overflow?: string;
4
- children: React.ReactNode;
3
+ /** The content of the component. */
4
+ children: React.JSX.Element | (React.JSX.Element | null | React.JSX.Element[])[];
5
+ /** Overflow behavior */
6
+ overflow?: 'auto';
7
+ style?: React.CSSProperties;
5
8
  }
6
9
  declare function TabContent(props: TabContentProps): React.JSX.Element;
7
10
  export default TabContent;
@@ -16,6 +16,6 @@ const styles = {
16
16
  },
17
17
  };
18
18
  function TabContent(props) {
19
- return react_1.default.createElement(material_1.Grid, { item: true, sx: Object.assign(Object.assign({}, styles.root), (props.overflow === 'auto' ? styles.overflowAuto : undefined)) }, props.children);
19
+ return react_1.default.createElement(material_1.Grid, { item: true, sx: Object.assign(Object.assign({}, props.style), (props.overflow === 'auto' ? styles.overflowAuto : undefined)) }, props.children);
20
20
  }
21
21
  exports.default = TabContent;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = ToggleThemeMenu;
6
7
  const react_1 = __importDefault(require("react"));
7
8
  const material_1 = require("@mui/material");
8
9
  const icons_material_1 = require("@mui/icons-material");
@@ -15,4 +16,3 @@ function ToggleThemeMenu({ themeName, toggleTheme, t, className, style, size, })
15
16
  themeName === 'colored' && react_1.default.createElement(icons_material_1.Brightness6, { className: className }),
16
17
  themeName !== 'dark' && themeName !== 'blue' && themeName !== 'colored' && react_1.default.createElement(icons_material_1.Brightness7, { className: className }))));
17
18
  }
18
- exports.default = ToggleThemeMenu;
@@ -1,5 +1,6 @@
1
1
  import React, { Component } from 'react';
2
2
  import type Connection from '../Connection';
3
+ import { IobTheme } from '../types';
3
4
  interface Column {
4
5
  cellStyle?: Record<string, any>;
5
6
  editComponent?: React.FC<{
@@ -36,6 +37,7 @@ interface TreeTableProps {
36
37
  /** Shift in pixels for every level */
37
38
  levelShift?: number;
38
39
  adapterName: string;
40
+ theme: IobTheme;
39
41
  }
40
42
  interface TreeTableState {
41
43
  opened: string[];
@@ -434,19 +434,19 @@ class TreeTable extends react_1.Component {
434
434
  renderHead() {
435
435
  return react_1.default.createElement(material_1.TableHead, null,
436
436
  react_1.default.createElement(material_1.TableRow, { key: "headerRow" },
437
- react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles.cellExpand) }),
438
- react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles[`width_${this.props.columns[0].field.replace(/\./g, '_')}`]), style: this.props.columns[0].headerStyle || this.props.columns[0].cellStyle, sortDirection: this.props.noSort ? false : (this.state.orderBy === this.props.columns[0].field ? this.state.order : false) }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === this.props.columns[0].field, direction: this.state.orderBy === this.props.columns[0].field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(this.props.columns[0].field) },
437
+ react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles.cellExpand) }),
438
+ react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles[`width_${this.props.columns[0].field.replace(/\./g, '_')}`]), style: this.props.columns[0].headerStyle || this.props.columns[0].cellStyle, sortDirection: this.props.noSort ? false : (this.state.orderBy === this.props.columns[0].field ? this.state.order : false) }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === this.props.columns[0].field, direction: this.state.orderBy === this.props.columns[0].field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(this.props.columns[0].field) },
439
439
  this.props.columns[0].title || this.props.columns[0].field,
440
440
  this.state.orderBy === this.props.columns[0].field ?
441
441
  react_1.default.createElement("span", { style: styles.visuallyHidden }, this.state.order === 'desc' ? 'sorted descending' : 'sorted ascending') : null)),
442
- this.props.columns.map((col, i) => (!i && !col.hidden ? null : react_1.default.createElement(material_1.TableCell, { key: col.field, sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles[`width_${col.field.replace(/\./g, '_')}`]), style: col.headerStyle || col.cellStyle, component: "th" }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === col.field, direction: this.state.orderBy === col.field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(col.field) },
442
+ this.props.columns.map((col, i) => (!i && !col.hidden ? null : react_1.default.createElement(material_1.TableCell, { key: col.field, sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles[`width_${col.field.replace(/\./g, '_')}`]), style: col.headerStyle || col.cellStyle, component: "th" }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === col.field, direction: this.state.orderBy === col.field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(col.field) },
443
443
  col.title || col.field,
444
444
  this.state.orderBy === col.field ?
445
445
  react_1.default.createElement("span", { style: styles.visuallyHidden }, this.state.order === 'desc' ? 'sorted descending' : 'sorted ascending') : null)))),
446
- this.props.onUpdate ? react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles.cellButton) }, !this.props.noAdd ? react_1.default.createElement(material_1.Fab, { color: "primary", size: "small", disabled: this.state.editMode !== false, onClick: () => this.props.onUpdate && this.props.onUpdate(true) },
446
+ this.props.onUpdate ? react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles.cellButton) }, !this.props.noAdd ? react_1.default.createElement(material_1.Fab, { color: "primary", size: "small", disabled: this.state.editMode !== false, onClick: () => this.props.onUpdate && this.props.onUpdate(true) },
447
447
  react_1.default.createElement(icons_material_1.Add, null)) : null) : null,
448
448
  this.props.onDelete || this.props.onUpdate ?
449
- react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles.cellButton) }) : null));
449
+ react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles.cellButton) }) : null));
450
450
  }
451
451
  render() {
452
452
  const col = this.props.columns.find(_col => _col.field === this.state.orderBy);
package/Dialogs/Cron.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { IobTheme } from '../types';
2
3
  interface DialogCronProps {
3
4
  onClose: () => void;
4
5
  onOk: (cron: string) => void;
@@ -12,6 +13,7 @@ interface DialogCronProps {
12
13
  complex?: boolean;
13
14
  /** do not show wizard */
14
15
  noWizard?: boolean;
16
+ theme: IobTheme;
15
17
  }
16
18
  interface DialogCronState {
17
19
  cron: string;
package/Dialogs/Cron.js CHANGED
@@ -86,7 +86,7 @@ class DialogCron extends react_1.default.Component {
86
86
  react_1.default.createElement(material_1.Radio, { key: "complex", checked: this.state.mode === 'complex', onChange: () => this.setMode('complex') }),
87
87
  react_1.default.createElement("label", { onClick: () => this.setMode('complex'), style: this.state.mode !== 'complex' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_cron')))) : null,
88
88
  this.state.mode === 'simple' && react_1.default.createElement(SimpleCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() }),
89
- this.state.mode === 'wizard' && react_1.default.createElement(Schedule_1.default, { schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) }),
89
+ this.state.mode === 'wizard' && react_1.default.createElement(Schedule_1.default, { theme: this.props.theme, schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) }),
90
90
  this.state.mode === 'complex' && react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
91
91
  react_1.default.createElement(material_1.DialogActions, null,
92
92
  react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Connection } from '@iobroker/socket-client';
3
+ import { IobTheme } from '../types';
3
4
  interface DialogSelectFileProps {
4
5
  /** where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated) */
5
6
  dialogName?: string;
@@ -21,6 +22,8 @@ interface DialogSelectFileProps {
21
22
  themeName?: string;
22
23
  /** Theme type. */
23
24
  themeType?: 'dark' | 'light';
25
+ /** Theme object. */
26
+ theme: IobTheme;
24
27
  /** The selected IDs. */
25
28
  selected?: string | string[];
26
29
  /** The ok button text; default: OK (translated) */
@@ -108,7 +108,7 @@ class DialogSelectFile extends react_1.default.Component {
108
108
  react_1.default.createElement(material_1.DialogContent, { style: Object.assign(Object.assign({}, styles.content), styles.contentMobile) },
109
109
  react_1.default.createElement(FileBrowser_1.default, { ready: true, imagePrefix: this.props.imagePrefix || this.props.prefix || '../', allowUpload: !!this.props.allowUpload, allowDownload: this.props.allowDownload !== false, allowCreateFolder: !!this.props.allowCreateFolder, allowDelete: !!this.props.allowDelete, allowView: this.props.allowView !== false, showViewTypeButton: this.props.showViewTypeButton !== false, showToolbar: this.props.showToolbar !== false, limitPath: this.props.limitPath, filterFiles: this.props.filterFiles, filterByType: this.props.filterByType, selected: this.props.selected, restrictToFolder: this.props.restrictToFolder, allowNonRestricted: this.props.allowNonRestricted, onSelect: (selected, isDoubleClick, isFolder) => {
110
110
  this.setState({ selected: Array.isArray(selected) ? selected : [selected] }, () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk());
111
- }, t: this.props.t || i18n_1.default.t, lang: this.props.lang || i18n_1.default.getLanguage(), socket: this.props.socket, themeType: this.props.themeType, themeName: this.props.themeName, showExpertButton: this.props.showExpertButton, expertMode: this.props.expertMode, showTypeSelector: this.props.showTypeSelector })),
111
+ }, t: this.props.t || i18n_1.default.t, lang: this.props.lang || i18n_1.default.getLanguage(), socket: this.props.socket, themeType: this.props.themeType, themeName: this.props.themeName, theme: this.props.theme, showExpertButton: this.props.showExpertButton, expertMode: this.props.expertMode, showTypeSelector: this.props.showTypeSelector })),
112
112
  react_1.default.createElement(material_1.DialogActions, null,
113
113
  react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), startIcon: react_1.default.createElement(icons_material_1.Check, null), disabled: !this.state.selected.length, color: "primary" }, this.props.ok || i18n_1.default.t('ra_Ok')),
114
114
  react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.handleCancel(), startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
@@ -7,6 +7,7 @@
7
7
  import React, { Component } from 'react';
8
8
  import type Connection from '../Connection';
9
9
  import { ObjectBrowserColumn, ObjectBrowserCustomFilter, ObjectBrowserType } from '../Components/types';
10
+ import { IobTheme } from '../types';
10
11
  export interface SelectIDFilters {
11
12
  id?: string;
12
13
  name?: string;
@@ -32,6 +33,8 @@ interface DialogSelectIDProps {
32
33
  notEditable?: boolean;
33
34
  themeName?: string;
34
35
  themeType?: string;
36
+ /** The theme object */
37
+ theme?: IobTheme;
35
38
  customFilter?: ObjectBrowserCustomFilter;
36
39
  selected?: string | string[];
37
40
  ok?: string;
@@ -133,7 +133,7 @@ class DialogSelectID extends react_1.Component {
133
133
  // style={{ width: '100%', height: '100%' }}
134
134
  columns: this.props.columns || ['name', 'type', 'role', 'room', 'func', 'val'], types: this.props.types ? (Array.isArray(this.props.types) ? this.props.types : [this.props.types]) : ['state'], root: this.props.root, t: i18n_1.default.t, lang: this.props.lang || i18n_1.default.getLanguage(), socket: this.props.socket, selected: this.state.selected, multiSelect: this.props.multiSelect, notEditable: this.props.notEditable === undefined ? true : this.props.notEditable,
135
135
  // name={this.state.name}
136
- themeName: this.props.themeName, themeType: this.props.themeType, customFilter: this.props.customFilter, onFilterChanged: (filterConfig) => {
136
+ themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, customFilter: this.props.customFilter, onFilterChanged: (filterConfig) => {
137
137
  this.filters = filterConfig;
138
138
  (window._localStorage || window.localStorage).setItem(this.dialogName, JSON.stringify(filterConfig));
139
139
  }, onSelect: (_selected, name, isDouble) => {
@@ -4,7 +4,6 @@
4
4
  * MIT License
5
5
  *
6
6
  * */
7
- /// <reference types="node" />
8
7
  import { type HostInfo } from '@iobroker/js-controller-common-db/build/esm/lib/common/tools';
9
8
  import { type FilteredNotificationInformation } from '@iobroker/js-controller-common/build/esm/lib/common/notificationHandler';
10
9
  declare global {
@@ -6,7 +6,8 @@
6
6
  *
7
7
  * */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.pattern2RegEx = exports.ERRORS = exports.PROGRESS = void 0;
9
+ exports.ERRORS = exports.PROGRESS = void 0;
10
+ exports.pattern2RegEx = pattern2RegEx;
10
11
  /** Possible progress states. */
11
12
  exports.PROGRESS = {
12
13
  /** The socket is connecting. */
@@ -95,7 +96,6 @@ function pattern2RegEx(pattern) {
95
96
  .replace(/\*/g, '.*');
96
97
  return (startsWithWildcard ? '' : '^') + pattern + (endsWithWildcard ? '' : '$');
97
98
  }
98
- exports.pattern2RegEx = pattern2RegEx;
99
99
  class Connection {
100
100
  constructor(props) {
101
101
  this.systemLang = 'en';
package/README.md CHANGED
@@ -690,7 +690,8 @@ class JsonComponent extends ConfigGeneric {
690
690
  The main change is that the `withStyles` was removed. So you have to replace all `withStyles` with `sx` or `style` properties.
691
691
 
692
692
  You can read more about sx [here](https://mui.com/system/getting-started/the-sx-prop/).
693
-
693
+ - Remove at start of the file `import { withStyles } from '@mui/styles';`
694
+ - Replace at the very end of the file `export default withStyles(styles)(MyComponent);` with `export default MyComponent;`
694
695
  - Modify `const styles`:
695
696
  Before:
696
697
  ```
@@ -733,11 +734,11 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
733
734
  - Modify `classes`:
734
735
  Before: `<Dialog classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}>`
735
736
 
736
- After: `<Dialog {{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
737
+ After: `<Dialog sx={{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
737
738
 
738
739
  Before: `<Dialog classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}>`
739
740
 
740
- After: `<Dialog {{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
741
+ After: `<Dialog sx={{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
741
742
 
742
743
  Before: `<ListItem classes={{ root: styles.listItem }} >`
743
744
 
@@ -751,20 +752,26 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
751
752
 
752
753
  After: `<Badge sx={{ '& .MuiBadge-badge': styles.expertBadge }}>`
753
754
 
755
+ Before: `<Tab classes={{ selected: styles.selected }} />`
756
+
757
+ After: `<Tab sx={{ '&.Mui-selected': styles.selected }} />`
758
+
754
759
  Before: `<Tooltip title={this.props.t('ra_Refresh tree')} classes={{ popper: styles.tooltip }}>`
755
760
 
756
761
  After: `<Tooltip title={this.props.t('ra_Refresh tree')} componentsProps={{ popper: { sx: { pointerEvents: 'none' } } }}>`
757
762
  Or: `<Tooltip title={this.props.t('ra_Refresh tree')} componentsProps={{ popper: { sx: styles.tooltip } }}>`
758
763
 
759
- ## Warning
760
- `react-inlinesvg@4.0.5` cannot be used. Use `react-inlinesvg@4.0.3` instead.
764
+ Before. `<AccordionSummary classes={{ root: styles.rootStyle, content: styles.content }}>`
765
+
766
+ After. `<AccordionSummary sx={{ '&.MuiAccordionSummary-root': styles.rootStyle, '& .MuiAccordionSummary-content': styles.content }}>`
767
+
761
768
  <!--
762
769
  Placeholder for the next version (at the beginning of the line):
763
770
  ### **WORK IN PROGRESS**
764
771
  -->
765
772
 
766
773
  ## Changelog
767
- ### 6.0.0 (2024-06-19)
774
+ ### 6.0.2 (2024-06-21)
768
775
  * (bluefox) Removed the usage of `withStyles` in favor of `sx` and `style` properties (see [Migration from v5 to v6](#migration-from-v5-to-v6)
769
776
  * (bluefox) (BREAKING) Higher version of `@mui/material` (5.15.20) is used
770
777
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "React classes to develop admin interfaces for ioBroker with react.",
5
5
  "author": {
6
6
  "name": "Denis Haev (bluefox)",
@@ -36,12 +36,12 @@
36
36
  "@mui/icons-material": "^5.15.20",
37
37
  "@mui/material": "^5.15.20",
38
38
  "@mui/x-date-pickers": "^7.7.0",
39
- "@sentry/browser": "^8.9.2",
39
+ "@sentry/browser": "^8.10.0",
40
40
  "react-color": "^2.19.3",
41
41
  "react-colorful": "^5.6.1",
42
42
  "react-cropper": "^2.3.3",
43
43
  "react-dropzone": "^14.2.3",
44
44
  "react-icons": "^5.2.1",
45
- "react-inlinesvg": "4.1.3"
45
+ "react-inlinesvg": "^4.1.3"
46
46
  }
47
47
  }