@iobroker/adapter-react-v5 7.7.2 → 7.7.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.
- package/build/Components/CustomModal.js +4 -2
- package/build/Components/CustomModal.js.map +1 -1
- package/build/Components/FileBrowser.d.ts +1 -1
- package/build/Components/FileBrowser.js +12 -5
- package/build/Components/FileBrowser.js.map +1 -1
- package/build/Components/FileViewer.js +1 -1
- package/build/Components/FileViewer.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +7 -5
- package/build/Components/ObjectBrowser.js +107 -44
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/Utils.d.ts +7 -6
- package/build/Components/Utils.js +67 -62
- package/build/Components/Utils.js.map +1 -1
- package/build/Dialogs/SelectFile.d.ts +2 -0
- package/build/Dialogs/SelectFile.js +2 -3
- package/build/Dialogs/SelectFile.js.map +1 -1
- package/build/Dialogs/SelectID.d.ts +7 -6
- package/build/Dialogs/SelectID.js +3 -3
- package/build/Dialogs/SelectID.js.map +1 -1
- package/build/LegacyConnection.d.ts +14 -1
- package/build/LegacyConnection.js +26 -2
- package/build/LegacyConnection.js.map +1 -1
- package/build/i18n/de.json +8 -0
- package/build/i18n/en.json +8 -0
- package/build/i18n/es.json +8 -0
- package/build/i18n/fr.json +8 -0
- package/build/i18n/it.json +3 -0
- package/build/i18n/nl.json +3 -0
- package/build/i18n/pl.json +6 -3
- package/build/i18n/pt.json +3 -0
- package/build/i18n/ru.json +3 -0
- package/build/i18n/uk.json +3 -0
- package/build/i18n/zh-cn.json +3 -0
- package/build/types.d.ts +2 -0
- package/i18n/de.json +8 -0
- package/i18n/en.json +8 -0
- package/i18n/es.json +8 -0
- package/i18n/fr.json +8 -0
- package/i18n/it.json +3 -0
- package/i18n/nl.json +3 -0
- package/i18n/pl.json +6 -3
- package/i18n/pt.json +3 -0
- package/i18n/ru.json +3 -0
- package/i18n/uk.json +3 -0
- package/i18n/zh-cn.json +3 -0
- package/package.json +8 -8
- 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
|
|
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
|
-
|
|
742
|
-
|
|
743
|
-
|
|
743
|
+
sureStateObject.common.custom ||= {};
|
|
744
|
+
sureStateObject.common.custom[instanceId] ||= {};
|
|
745
|
+
sureStateObject.common.custom[instanceId].smartName = {};
|
|
744
746
|
}
|
|
745
747
|
else {
|
|
746
|
-
|
|
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 (
|
|
755
|
-
|
|
758
|
+
if (sureStateObject?.common?.custom?.[instanceId]) {
|
|
759
|
+
sureStateObject.common.custom[instanceId] = null;
|
|
756
760
|
}
|
|
757
761
|
}
|
|
758
762
|
else {
|
|
759
|
-
|
|
763
|
+
sureStateObject.common.smartName = null;
|
|
760
764
|
}
|
|
761
765
|
}
|
|
762
766
|
/**
|
|
@@ -764,79 +768,77 @@ 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
|
|
769
|
-
const nnn =
|
|
770
|
-
|
|
771
|
-
|
|
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 (
|
|
775
|
-
delete
|
|
776
|
-
let _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
|
-
|
|
789
|
+
sureStateObject.common.smartName = _smartName;
|
|
784
790
|
}
|
|
785
791
|
if (smartType !== undefined) {
|
|
786
792
|
if (noCommon) {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
793
|
+
sureStateObject.common.custom ||= {};
|
|
794
|
+
sureStateObject.common.custom[instanceId] ||= {};
|
|
795
|
+
sureStateObject.common.custom[instanceId].smartName ||= {};
|
|
790
796
|
if (!smartType) {
|
|
791
|
-
delete
|
|
797
|
+
delete sureStateObject.common.custom[instanceId].smartName.smartType;
|
|
792
798
|
}
|
|
793
799
|
else {
|
|
794
|
-
|
|
800
|
+
sureStateObject.common.custom[instanceId].smartName.smartType = smartType;
|
|
795
801
|
}
|
|
796
802
|
}
|
|
797
803
|
else {
|
|
798
|
-
|
|
804
|
+
sureStateObject.common.smartName ||= {};
|
|
799
805
|
if (!smartType) {
|
|
800
|
-
|
|
801
|
-
delete obj.common.smartName.smartType;
|
|
806
|
+
delete sureStateObject.common.smartName.smartType;
|
|
802
807
|
}
|
|
803
808
|
else {
|
|
804
|
-
|
|
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
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
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
|
-
|
|
818
|
-
|
|
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
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
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
|
-
|
|
832
|
-
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] ===
|
|
839
|
-
(!obj.common.role || obj.common.role.includes('button'))))) {
|
|
841
|
+
(smartName[language] === sureStateObject.common.name && !sureStateObject.common.role))) {
|
|
840
842
|
delete smartName[language];
|
|
841
843
|
let empty = true;
|
|
842
844
|
// Check if the structure has any definitions
|
|
@@ -848,27 +850,28 @@ export class Utils {
|
|
|
848
850
|
}
|
|
849
851
|
// If empty => delete smartName completely
|
|
850
852
|
if (empty) {
|
|
851
|
-
if (noCommon &&
|
|
852
|
-
if (
|
|
853
|
-
delete
|
|
853
|
+
if (noCommon && sureStateObject.common.custom?.[instanceId]) {
|
|
854
|
+
if (sureStateObject.common.custom[instanceId].smartName.byON === undefined) {
|
|
855
|
+
delete sureStateObject.common.custom[instanceId];
|
|
854
856
|
}
|
|
855
857
|
else {
|
|
856
|
-
delete
|
|
857
|
-
delete
|
|
858
|
-
delete
|
|
859
|
-
delete
|
|
860
|
-
delete
|
|
861
|
-
delete
|
|
862
|
-
delete
|
|
863
|
-
delete
|
|
864
|
-
delete
|
|
865
|
-
delete
|
|
866
|
-
delete
|
|
858
|
+
delete sureStateObject.common.custom[instanceId].en;
|
|
859
|
+
delete sureStateObject.common.custom[instanceId].de;
|
|
860
|
+
delete sureStateObject.common.custom[instanceId].ru;
|
|
861
|
+
delete sureStateObject.common.custom[instanceId].nl;
|
|
862
|
+
delete sureStateObject.common.custom[instanceId].pl;
|
|
863
|
+
delete sureStateObject.common.custom[instanceId].it;
|
|
864
|
+
delete sureStateObject.common.custom[instanceId].fr;
|
|
865
|
+
delete sureStateObject.common.custom[instanceId].pt;
|
|
866
|
+
delete sureStateObject.common.custom[instanceId].es;
|
|
867
|
+
delete sureStateObject.common.custom[instanceId].uk;
|
|
868
|
+
delete sureStateObject.common.custom[instanceId]['zh-cn'];
|
|
867
869
|
}
|
|
868
|
-
// @ts-expect-error fixed in js-controller
|
|
869
870
|
}
|
|
870
|
-
else if (
|
|
871
|
-
|
|
871
|
+
else if (sureStateObject.common.smartName &&
|
|
872
|
+
sureStateObject.common.smartName.byON !== undefined) {
|
|
873
|
+
const _smartName = sureStateObject.common
|
|
874
|
+
.smartName;
|
|
872
875
|
delete _smartName.en;
|
|
873
876
|
delete _smartName.de;
|
|
874
877
|
delete _smartName.ru;
|
|
@@ -882,7 +885,7 @@ export class Utils {
|
|
|
882
885
|
delete _smartName['zh-cn'];
|
|
883
886
|
}
|
|
884
887
|
else {
|
|
885
|
-
|
|
888
|
+
sureStateObject.common.smartName = null;
|
|
886
889
|
}
|
|
887
890
|
}
|
|
888
891
|
}
|
|
@@ -892,13 +895,15 @@ export class Utils {
|
|
|
892
895
|
* Disable the smart name of a state.
|
|
893
896
|
*/
|
|
894
897
|
static disableSmartName(obj, instanceId, noCommon) {
|
|
898
|
+
// Typing must be fixed in js-controller
|
|
899
|
+
const sureStateObject = obj;
|
|
895
900
|
if (noCommon) {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
901
|
+
sureStateObject.common.custom ||= {};
|
|
902
|
+
sureStateObject.common.custom[instanceId] ||= {};
|
|
903
|
+
sureStateObject.common.custom[instanceId].smartName = false;
|
|
899
904
|
}
|
|
900
905
|
else {
|
|
901
|
-
|
|
906
|
+
sureStateObject.common.smartName = false;
|
|
902
907
|
}
|
|
903
908
|
}
|
|
904
909
|
/**
|