@iobroker/adapter-react-v5 7.2.2 → 7.2.4

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.
@@ -28,7 +28,6 @@ import {
28
28
  ListItem,
29
29
  ListItemButton,
30
30
  ListItemIcon,
31
- ListItemSecondaryAction,
32
31
  ListItemText,
33
32
  Menu,
34
33
  MenuItem,
@@ -1111,11 +1110,14 @@ function binarySearch(list: string[], find: string, _start?: number, _end?: numb
1111
1110
  }
1112
1111
 
1113
1112
  function getName(name: ioBroker.StringOrTranslated, lang: ioBroker.Languages): string {
1114
- if (name && typeof name === 'object') {
1113
+ if (typeof name === 'object') {
1114
+ if (!name) {
1115
+ return '';
1116
+ }
1115
1117
  return (name[lang] || name.en || '').toString();
1116
1118
  }
1117
1119
 
1118
- return (name || '').toString();
1120
+ return name ? name.toString() : '';
1119
1121
  }
1120
1122
 
1121
1123
  export function getSelectIdIconFromObjects(
@@ -3824,13 +3826,16 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
3824
3826
  obj: ioBroker.AdapterObject,
3825
3827
  ): Record<string, CustomAdminColumnStored[]> | null {
3826
3828
  if (obj.common && obj.common.adminColumns && obj.common.name) {
3827
- let columns: string | (string | ioBroker.CustomAdminColumn)[] = obj.common.adminColumns;
3829
+ const columns: string | (string | ioBroker.CustomAdminColumn)[] = obj.common.adminColumns;
3830
+ let aColumns: (string | ioBroker.CustomAdminColumn)[] | undefined;
3828
3831
  if (columns && typeof columns !== 'object') {
3829
- columns = [columns];
3832
+ aColumns = [columns];
3833
+ } else if (columns) {
3834
+ aColumns = columns as (string | ioBroker.CustomAdminColumn)[];
3830
3835
  }
3831
3836
  let cColumns: CustomAdminColumnStored[] | null;
3832
3837
  if (columns) {
3833
- cColumns = (columns as (string | ioBroker.CustomAdminColumn)[])
3838
+ cColumns = aColumns
3834
3839
  .map((_item: string | ioBroker.CustomAdminColumn) => {
3835
3840
  if (typeof _item !== 'object') {
3836
3841
  return { path: _item, name: _item.split('.').pop() };
@@ -3866,7 +3871,7 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
3866
3871
  objTypes: item.objTypes,
3867
3872
  } as CustomAdminColumnStored;
3868
3873
  })
3869
- .filter(item => item) as CustomAdminColumnStored[];
3874
+ .filter((item: CustomAdminColumnStored) => item);
3870
3875
  } else {
3871
3876
  cColumns = null;
3872
3877
  }
@@ -7753,22 +7758,30 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
7753
7758
 
7754
7759
  /**
7755
7760
  * Find the id from the root
7761
+ *
7762
+ * @param root The current root
7763
+ * @param id The object id to find
7756
7764
  */
7757
- private static getItemFromRoot(
7758
- /** The current root */
7759
- root: TreeItem,
7760
- /** the object id to find */
7761
- id: string,
7762
- ): TreeItem | null {
7765
+ private static getItemFromRoot(root: TreeItem, id: string): TreeItem | null {
7763
7766
  const idArr = id.split('.');
7764
7767
  let currId = '';
7765
7768
  let _root: TreeItem | null | undefined = root;
7766
7769
 
7767
- for (const idEntry of idArr) {
7770
+ for (let i = 0; i < idArr.length; i++) {
7771
+ const idEntry = idArr[i];
7768
7772
  currId = currId ? `${currId}.${idEntry}` : idEntry;
7769
- _root = _root.children?.find(item => item.data.id === currId);
7770
- if (!_root) {
7771
- break;
7773
+ let found = false;
7774
+ if (_root.children) {
7775
+ for (let j = 0; j < _root.children.length; j++) {
7776
+ if (_root.children[j].data.id === currId) {
7777
+ _root = _root.children[j];
7778
+ found = true;
7779
+ break;
7780
+ }
7781
+ }
7782
+ }
7783
+ if (!found) {
7784
+ return null;
7772
7785
  }
7773
7786
  }
7774
7787
 
@@ -8495,7 +8508,6 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
8495
8508
  !this.props.notEditable &&
8496
8509
  this.props.objectBrowserAliasEditor &&
8497
8510
  this.props.objectBrowserEditObject &&
8498
- this.state.filter.expertMode &&
8499
8511
  obj?.type === 'state' &&
8500
8512
  // @ts-expect-error deprecated from js-controller 6
8501
8513
  obj.common?.type !== 'file'
@@ -8630,9 +8642,9 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
8630
8642
  {ITEMS[key].label}
8631
8643
  ...
8632
8644
  </ListItemText>
8633
- <ListItemSecondaryAction>
8645
+ <div style={{ ...styles.contextMenuKeys, opacity: 1 }}>
8634
8646
  <ArrowRightIcon />
8635
- </ListItemSecondaryAction>
8647
+ </div>
8636
8648
  </MenuItem>,
8637
8649
  );
8638
8650
 
@@ -1,6 +1,17 @@
1
1
  import React, { Component, type JSX } from 'react';
2
2
 
3
- import { Input, Radio, FormControlLabel, FormGroup, Checkbox, MenuItem, Select, TextField, Box } from '@mui/material';
3
+ import {
4
+ Input,
5
+ Radio,
6
+ FormControlLabel,
7
+ FormGroup,
8
+ Checkbox,
9
+ MenuItem,
10
+ Select,
11
+ TextField,
12
+ Box,
13
+ type Theme,
14
+ } from '@mui/material';
4
15
 
5
16
  import I18n from '../i18n';
6
17
  import type { IobTheme } from '../types';
@@ -547,14 +558,14 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
547
558
  // every minute
548
559
  desc.push(I18n.t('sch_desc_everyMinute'));
549
560
  } else {
550
- // every N minutes
561
+ // every N minute
551
562
  desc.push(I18n.t('sch_desc_everyNMinutes', schedule.time.interval.toString()));
552
563
  }
553
564
  } else if (schedule.time.interval === 1) {
554
565
  // every minute
555
566
  desc.push(I18n.t('sch_desc_everyHour'));
556
567
  } else {
557
- // every N minutes
568
+ // every N minute
558
569
  desc.push(I18n.t('sch_desc_everyNHours', schedule.time.interval.toString()));
559
570
  }
560
571
 
@@ -650,6 +661,11 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
650
661
  style={{ ...styles.inputTime, marginRight: 10 }}
651
662
  key="exactTimeFrom"
652
663
  type="time"
664
+ sx={(theme: Theme) => ({
665
+ '& input[type="time"]::-webkit-calendar-picker-indicator': {
666
+ filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
667
+ },
668
+ })}
653
669
  value={this.state.schedule.time.start}
654
670
  // InputProps={{inputComponent: TextTime}}
655
671
  onChange={e => {
@@ -668,6 +684,11 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
668
684
  style={styles.inputTime}
669
685
  key="exactTimeTo"
670
686
  type="time"
687
+ sx={(theme: Theme) => ({
688
+ '& input[type="time"]::-webkit-calendar-picker-indicator': {
689
+ filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
690
+ },
691
+ })}
671
692
  value={this.state.schedule.time.end}
672
693
  // InputProps={{inputComponent: TextTime}}
673
694
  onChange={e => {
@@ -746,7 +767,7 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
746
767
  </div>
747
768
  )}
748
769
  </div>
749
- {!schedule.time.exactTime && this.getPeriodSettingsMinutes()}
770
+ {!schedule.time.exactTime && this.getPeriodSettingsMinutes(fromTo)}
750
771
  </div>
751
772
  </div>
752
773
  );
@@ -810,13 +831,19 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
810
831
  key="exactTimeValue"
811
832
  value={this.state.schedule.time.start}
812
833
  type="time"
813
- // inputComponent={TextTime}
834
+ sx={(theme: Theme) => ({
835
+ '& input[type="time"]::-webkit-calendar-picker-indicator': {
836
+ filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
837
+ },
838
+ })}
814
839
  onChange={e => {
815
840
  const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
816
841
  _schedule.time.start = e.target.value;
817
842
  this.onChange(_schedule);
818
843
  }}
819
- InputLabelProps={{ shrink: true }}
844
+ slotProps={{
845
+ inputLabel: { shrink: true },
846
+ }}
820
847
  margin="normal"
821
848
  />
822
849
  </div>
@@ -906,7 +933,9 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
906
933
  e.target.value,
907
934
  );
908
935
  }}
909
- InputLabelProps={{ shrink: true }}
936
+ slotProps={{
937
+ inputLabel: { shrink: true },
938
+ }}
910
939
  label={I18n.t('sch_at')}
911
940
  margin="normal"
912
941
  />
@@ -1173,13 +1202,16 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
1173
1202
  ];
1174
1203
  }
1175
1204
 
1176
- getPeriodSettingsMinutes(): JSX.Element {
1205
+ getPeriodSettingsMinutes(fromTo: boolean): JSX.Element {
1177
1206
  return (
1178
- <div style={{ display: 'inline-block' }}>
1179
- <label>{I18n.t('sch_every')}</label>
1207
+ <div style={{ display: 'inline-block', marginTop: fromTo ? 15 : 'inherit' }}>
1208
+ <label style={{ marginLeft: 4, marginRight: 4 }}>{I18n.t('sch_every')}</label>
1180
1209
  <Input
1181
1210
  value={this.state.schedule.time.interval}
1182
- style={{ ...styles.inputEvery, verticalAlign: 'bottom' }}
1211
+ style={{
1212
+ ...styles.inputEvery,
1213
+ verticalAlign: 'bottom',
1214
+ }}
1183
1215
  type="number"
1184
1216
  inputProps={{ min: 1 }}
1185
1217
  onChange={e => {
@@ -1882,7 +1914,9 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
1882
1914
  e.target.value,
1883
1915
  );
1884
1916
  }}
1885
- InputLabelProps={{ shrink: true }}
1917
+ slotProps={{
1918
+ inputLabel: { shrink: true },
1919
+ }}
1886
1920
  margin="normal"
1887
1921
  />
1888
1922
  <FormControlLabel
@@ -1931,7 +1965,9 @@ class Schedule extends Component<ScheduleProps, ScheduleState> {
1931
1965
  e.target.value,
1932
1966
  );
1933
1967
  }}
1934
- InputLabelProps={{ shrink: true }}
1968
+ slotProps={{
1969
+ inputLabel: { shrink: true },
1970
+ }}
1935
1971
  margin="normal"
1936
1972
  />
1937
1973
  )}
@@ -77,6 +77,7 @@ class DialogSimpleCron extends React.Component<DialogCronProps, DialogCronState>
77
77
  <DialogActions>
78
78
  <Button
79
79
  variant="contained"
80
+ disabled={!this.state.cron || this.state.cron.includes('_')}
80
81
  onClick={() => this.handleOk()}
81
82
  color="primary"
82
83
  startIcon={<IconOk />}
@@ -14,7 +14,7 @@ const IconClosed = (props: IconProps): React.JSX.Element => (
14
14
  >
15
15
  <path
16
16
  fill="currentColor"
17
- d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"
17
+ d="m524,128l-192,0l-64,-64l-160,0c-26.51,0 -48,21.49 -48,48l0,288c0,26.51 21.49,48 48,48l416,0c26.51,0 48,-21.49 48,-48l0,-224c0,-26.51 -21.49,-48 -48,-48z"
18
18
  />
19
19
  </svg>
20
20
  );
@@ -14,7 +14,7 @@ const IconOpen = (props: IconProps): JSX.Element => (
14
14
  >
15
15
  <path
16
16
  fill="currentColor"
17
- d="M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"
17
+ d="m631.75617,292.093l-72.424,124.155a63.997,63.997 0 0 1 -55.281,31.752l-399.964,0c-18.523,0 -30.064,-20.093 -20.731,-36.093l72.424,-124.155a64,64 0 0 1 55.282,-31.752l399.964,0c18.523,0 30.064,20.093 20.73,36.093zm-420.694,-68.093l328,0l0,-48c0,-26.51 -21.49,-48 -48,-48l-160,0l-64,-64l-160,0c-26.51,0 -48,21.49 -48,48l0,278.046l69.077,-118.418c17.137,-29.378 48.912,-47.628 82.923,-47.628z"
18
18
  />
19
19
  </svg>
20
20
  );