@iobroker/adapter-react-v5 7.7.2 → 7.7.3

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.
Files changed (47) hide show
  1. package/build/Components/CustomModal.js +4 -2
  2. package/build/Components/CustomModal.js.map +1 -1
  3. package/build/Components/FileBrowser.d.ts +1 -1
  4. package/build/Components/FileBrowser.js +12 -5
  5. package/build/Components/FileBrowser.js.map +1 -1
  6. package/build/Components/FileViewer.js +1 -1
  7. package/build/Components/FileViewer.js.map +1 -1
  8. package/build/Components/ObjectBrowser.d.ts +2 -0
  9. package/build/Components/ObjectBrowser.js +31 -7
  10. package/build/Components/ObjectBrowser.js.map +1 -1
  11. package/build/Components/Utils.d.ts +7 -6
  12. package/build/Components/Utils.js +68 -62
  13. package/build/Components/Utils.js.map +1 -1
  14. package/build/Dialogs/SelectFile.d.ts +2 -0
  15. package/build/Dialogs/SelectFile.js +2 -3
  16. package/build/Dialogs/SelectFile.js.map +1 -1
  17. package/build/Dialogs/SelectID.d.ts +2 -1
  18. package/build/Dialogs/SelectID.js +3 -3
  19. package/build/Dialogs/SelectID.js.map +1 -1
  20. package/build/LegacyConnection.d.ts +14 -1
  21. package/build/LegacyConnection.js +26 -2
  22. package/build/LegacyConnection.js.map +1 -1
  23. package/build/i18n/de.json +8 -0
  24. package/build/i18n/en.json +8 -0
  25. package/build/i18n/es.json +8 -0
  26. package/build/i18n/fr.json +8 -0
  27. package/build/i18n/it.json +3 -0
  28. package/build/i18n/nl.json +3 -0
  29. package/build/i18n/pl.json +6 -3
  30. package/build/i18n/pt.json +3 -0
  31. package/build/i18n/ru.json +3 -0
  32. package/build/i18n/uk.json +3 -0
  33. package/build/i18n/zh-cn.json +3 -0
  34. package/build/types.d.ts +2 -0
  35. package/i18n/de.json +8 -0
  36. package/i18n/en.json +8 -0
  37. package/i18n/es.json +8 -0
  38. package/i18n/fr.json +8 -0
  39. package/i18n/it.json +3 -0
  40. package/i18n/nl.json +3 -0
  41. package/i18n/pl.json +6 -3
  42. package/i18n/pt.json +3 -0
  43. package/i18n/ru.json +3 -0
  44. package/i18n/uk.json +3 -0
  45. package/i18n/zh-cn.json +3 -0
  46. package/package.json +8 -8
  47. package/craco-module-federation.js +0 -62
@@ -6,14 +6,15 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import type { IobTheme, ThemeName, ThemeType } from '../types';
9
- type SmartName = null | false | string | ({
9
+ type SmartNameObject = {
10
10
  [lang in ioBroker.Languages]?: string;
11
11
  } & {
12
12
  /** Which kind of device it is */
13
13
  smartType?: string | null;
14
14
  /** Which value to set when the ON command is issued */
15
15
  byON?: string | null;
16
- });
16
+ };
17
+ type SmartName = null | false | string | SmartNameObject;
17
18
  type ClassDictionary = Record<string, any>;
18
19
  type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
19
20
  type ClassArray = ClassValue[];
@@ -149,19 +150,19 @@ export declare class Utils {
149
150
  /**
150
151
  * Enable smart name for a state.
151
152
  */
152
- static enableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
153
+ static enableSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, instanceId: string, noCommon?: boolean): void;
153
154
  /**
154
155
  * Completely remove smart name from a state.
155
156
  */
156
- static removeSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
157
+ static removeSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, instanceId: string, noCommon?: boolean): void;
157
158
  /**
158
159
  * Update the smart name of a state.
159
160
  */
160
- static updateSmartName(obj: ioBroker.StateObject, newSmartName: ioBroker.StringOrTranslated, byON: string | null, smartType: string | null, instanceId: string, noCommon?: boolean): void;
161
+ static updateSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, newSmartName: ioBroker.StringOrTranslated | undefined, byON: string | null | undefined, smartType: string | null | undefined, instanceId: string, noCommon?: boolean): void;
161
162
  /**
162
163
  * Disable the smart name of a state.
163
164
  */
164
- static disableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
165
+ static disableSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, instanceId: string, noCommon?: boolean): void;
165
166
  /**
166
167
  * Copy text to the clipboard.
167
168
  */
@@ -737,26 +737,30 @@ export class Utils {
737
737
  * Enable smart name for a state.
738
738
  */
739
739
  static enableSmartName(obj, instanceId, noCommon) {
740
+ // Typing must be fixed in js-controller
741
+ const sureStateObject = obj;
740
742
  if (noCommon) {
741
- obj.common.custom = obj.common.custom || {};
742
- obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
743
- obj.common.custom[instanceId].smartName = {};
743
+ sureStateObject.common.custom ||= {};
744
+ sureStateObject.common.custom[instanceId] ||= {};
745
+ sureStateObject.common.custom[instanceId].smartName = {};
744
746
  }
745
747
  else {
746
- obj.common.smartName = {};
748
+ sureStateObject.common.smartName = {};
747
749
  }
748
750
  }
749
751
  /**
750
752
  * Completely remove smart name from a state.
751
753
  */
752
754
  static removeSmartName(obj, instanceId, noCommon) {
755
+ // Typing must be fixed in js-controller
756
+ const sureStateObject = obj;
753
757
  if (noCommon) {
754
- if (obj.common && obj.common.custom && obj.common.custom[instanceId]) {
755
- obj.common.custom[instanceId] = null;
758
+ if (sureStateObject?.common?.custom?.[instanceId]) {
759
+ sureStateObject.common.custom[instanceId] = null;
756
760
  }
757
761
  }
758
762
  else {
759
- obj.common.smartName = null;
763
+ sureStateObject.common.smartName = null;
760
764
  }
761
765
  }
762
766
  /**
@@ -764,79 +768,78 @@ export class Utils {
764
768
  */
765
769
  static updateSmartName(obj, newSmartName, byON, smartType, instanceId, noCommon) {
766
770
  const language = I18n.getLanguage();
771
+ // Typing must be fixed in js-controller
772
+ const sureStateObject = obj;
767
773
  // convert the old format
768
- if (typeof obj.common.smartName === 'string') {
769
- const nnn = obj.common.smartName;
770
- obj.common.smartName = {};
771
- obj.common.smartName[language] = nnn;
774
+ if (typeof sureStateObject.common.smartName === 'string') {
775
+ const nnn = sureStateObject.common.smartName;
776
+ sureStateObject.common.smartName = {};
777
+ sureStateObject.common.smartName[language] = nnn;
772
778
  }
773
779
  // convert the old settings
774
- if (obj.native && obj.native.byON) {
775
- delete obj.native.byON;
776
- let _smartName = obj.common.smartName;
780
+ if (sureStateObject.native?.byON) {
781
+ delete sureStateObject.native.byON;
782
+ let _smartName = sureStateObject.common.smartName;
777
783
  if (_smartName && typeof _smartName !== 'object') {
778
784
  _smartName = {
779
785
  en: _smartName,
780
786
  [language]: _smartName,
781
787
  };
782
788
  }
783
- obj.common.smartName = _smartName;
789
+ sureStateObject.common.smartName = _smartName;
784
790
  }
785
791
  if (smartType !== undefined) {
786
792
  if (noCommon) {
787
- obj.common.custom = obj.common.custom || {};
788
- obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
789
- obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};
793
+ sureStateObject.common.custom ||= {};
794
+ sureStateObject.common.custom[instanceId] ||= {};
795
+ sureStateObject.common.custom[instanceId].smartName ||= {};
790
796
  if (!smartType) {
791
- delete obj.common.custom[instanceId].smartName.smartType;
797
+ delete sureStateObject.common.custom[instanceId].smartName.smartType;
792
798
  }
793
799
  else {
794
- obj.common.custom[instanceId].smartName.smartType = smartType;
800
+ sureStateObject.common.custom[instanceId].smartName.smartType = smartType;
795
801
  }
796
802
  }
797
803
  else {
798
- obj.common.smartName = obj.common.smartName || {};
804
+ sureStateObject.common.smartName ||= {};
799
805
  if (!smartType) {
800
- // @ts-expect-error fixed in js-controller
801
- delete obj.common.smartName.smartType;
806
+ delete sureStateObject.common.smartName.smartType;
802
807
  }
803
808
  else {
804
- // @ts-expect-error fixed in js-controller
805
- obj.common.smartName.smartType = smartType;
809
+ sureStateObject.common.smartName.smartType = smartType;
806
810
  }
807
811
  }
808
812
  }
809
813
  if (byON !== undefined) {
810
814
  if (noCommon) {
811
- obj.common.custom = obj.common.custom || {};
812
- obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
813
- obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};
814
- obj.common.custom[instanceId].smartName.byON = byON;
815
+ sureStateObject.common.custom ||= {};
816
+ sureStateObject.common.custom[instanceId] ||= {};
817
+ sureStateObject.common.custom[instanceId].smartName ||= {};
818
+ sureStateObject.common.custom[instanceId].smartName.byON = byON;
815
819
  }
816
820
  else {
817
- obj.common.smartName = obj.common.smartName || {};
818
- // @ts-expect-error fixed in js-controller
819
- obj.common.smartName.byON = byON;
821
+ sureStateObject.common.smartName ||= {};
822
+ sureStateObject.common.smartName.byON = byON;
820
823
  }
821
824
  }
822
825
  if (newSmartName !== undefined) {
823
826
  let smartName;
824
827
  if (noCommon) {
825
- obj.common.custom = obj.common.custom || {};
826
- obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
827
- obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};
828
- smartName = obj.common.custom[instanceId].smartName;
828
+ sureStateObject.common.custom ||= {};
829
+ sureStateObject.common.custom[instanceId] ||= {};
830
+ sureStateObject.common.custom[instanceId].smartName ||= {};
831
+ smartName = sureStateObject.common.custom[instanceId].smartName;
829
832
  }
830
833
  else {
831
- obj.common.smartName = obj.common.smartName || {};
832
- smartName = obj.common.smartName;
834
+ sureStateObject.common.smartName ||= {};
835
+ smartName = sureStateObject.common.smartName;
833
836
  }
834
837
  smartName[language] = newSmartName;
835
838
  // If smart name deleted
836
839
  if (smartName &&
837
840
  (!smartName[language] ||
838
- (smartName[language] === obj.common.name &&
839
- (!obj.common.role || obj.common.role.includes('button'))))) {
841
+ (smartName[language] === sureStateObject.common.name &&
842
+ (!sureStateObject.common.role || sureStateObject.common.role.includes('button'))))) {
840
843
  delete smartName[language];
841
844
  let empty = true;
842
845
  // Check if the structure has any definitions
@@ -848,27 +851,28 @@ export class Utils {
848
851
  }
849
852
  // If empty => delete smartName completely
850
853
  if (empty) {
851
- if (noCommon && obj.common.custom && obj.common.custom[instanceId]) {
852
- if (obj.common.custom[instanceId].smartName.byON === undefined) {
853
- delete obj.common.custom[instanceId];
854
+ if (noCommon && sureStateObject.common.custom?.[instanceId]) {
855
+ if (sureStateObject.common.custom[instanceId].smartName.byON === undefined) {
856
+ delete sureStateObject.common.custom[instanceId];
854
857
  }
855
858
  else {
856
- delete obj.common.custom[instanceId].en;
857
- delete obj.common.custom[instanceId].de;
858
- delete obj.common.custom[instanceId].ru;
859
- delete obj.common.custom[instanceId].nl;
860
- delete obj.common.custom[instanceId].pl;
861
- delete obj.common.custom[instanceId].it;
862
- delete obj.common.custom[instanceId].fr;
863
- delete obj.common.custom[instanceId].pt;
864
- delete obj.common.custom[instanceId].es;
865
- delete obj.common.custom[instanceId].uk;
866
- delete obj.common.custom[instanceId]['zh-cn'];
859
+ delete sureStateObject.common.custom[instanceId].en;
860
+ delete sureStateObject.common.custom[instanceId].de;
861
+ delete sureStateObject.common.custom[instanceId].ru;
862
+ delete sureStateObject.common.custom[instanceId].nl;
863
+ delete sureStateObject.common.custom[instanceId].pl;
864
+ delete sureStateObject.common.custom[instanceId].it;
865
+ delete sureStateObject.common.custom[instanceId].fr;
866
+ delete sureStateObject.common.custom[instanceId].pt;
867
+ delete sureStateObject.common.custom[instanceId].es;
868
+ delete sureStateObject.common.custom[instanceId].uk;
869
+ delete sureStateObject.common.custom[instanceId]['zh-cn'];
867
870
  }
868
- // @ts-expect-error fixed in js-controller
869
871
  }
870
- else if (obj.common.smartName && obj.common.smartName.byON !== undefined) {
871
- const _smartName = obj.common.smartName;
872
+ else if (sureStateObject.common.smartName &&
873
+ sureStateObject.common.smartName.byON !== undefined) {
874
+ const _smartName = sureStateObject.common
875
+ .smartName;
872
876
  delete _smartName.en;
873
877
  delete _smartName.de;
874
878
  delete _smartName.ru;
@@ -882,7 +886,7 @@ export class Utils {
882
886
  delete _smartName['zh-cn'];
883
887
  }
884
888
  else {
885
- obj.common.smartName = null;
889
+ sureStateObject.common.smartName = null;
886
890
  }
887
891
  }
888
892
  }
@@ -892,13 +896,15 @@ export class Utils {
892
896
  * Disable the smart name of a state.
893
897
  */
894
898
  static disableSmartName(obj, instanceId, noCommon) {
899
+ // Typing must be fixed in js-controller
900
+ const sureStateObject = obj;
895
901
  if (noCommon) {
896
- obj.common.custom = obj.common.custom || {};
897
- obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
898
- obj.common.custom[instanceId].smartName = false;
902
+ sureStateObject.common.custom ||= {};
903
+ sureStateObject.common.custom[instanceId] ||= {};
904
+ sureStateObject.common.custom[instanceId].smartName = false;
899
905
  }
900
906
  else {
901
- obj.common.smartName = false;
907
+ sureStateObject.common.smartName = false;
902
908
  }
903
909
  }
904
910
  /**