@iobroker/adapter-react-v5 5.0.0 → 5.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.
- package/Components/FileBrowser.js +0 -1
- package/Components/FileViewer.js +0 -2
- package/Components/Logo.js +1 -1
- package/Components/ObjectBrowser.js +21 -16
- package/Components/Utils.d.ts +7 -6
- package/Components/Utils.js +4 -22
- package/Dialogs/ComplexCron.js +4 -4
- package/Dialogs/Confirm.js +1 -1
- package/Dialogs/Cron.js +1 -1
- package/Dialogs/SelectFile.js +2 -2
- package/Dialogs/SelectID.js +1 -1
- package/Dialogs/SimpleCron.js +1 -1
- package/GenericApp.d.ts +0 -1
- package/GenericApp.js +1 -4
- package/README.md +10 -0
- package/index.d.ts +0 -3
- package/index.js +2 -6
- package/package.json +6 -8
|
@@ -1496,7 +1496,6 @@ class FileBrowser extends react_1.Component {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
});
|
|
1498
1498
|
newState.folders = folders;
|
|
1499
|
-
// @ts-expect-error fix later
|
|
1500
1499
|
this.setState(newState, () => setTimeout(() => {
|
|
1501
1500
|
this.browseFolders([...this.state.expanded], folders)
|
|
1502
1501
|
.then(_folders => this.setState({ folders: _folders }));
|
package/Components/FileViewer.js
CHANGED
|
@@ -176,7 +176,6 @@ class FileViewer extends react_1.Component {
|
|
|
176
176
|
newState.editingValue = fileData;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
// @ts-expect-error I don't know how to fix it
|
|
180
179
|
this.setState(newState);
|
|
181
180
|
})
|
|
182
181
|
.catch(e => window.alert(`Cannot read file: ${e}`));
|
|
@@ -221,7 +220,6 @@ class FileViewer extends react_1.Component {
|
|
|
221
220
|
return react_1.default.createElement(IconNoIcon_1.default, { className: Utils_1.default.clsx(this.props.classes.img, this.props.getClassBackgroundImage()) });
|
|
222
221
|
}
|
|
223
222
|
return react_1.default.createElement(Icon_1.default, { onError: e => {
|
|
224
|
-
// @ts-ignore-error to check
|
|
225
223
|
e.target.onerror = null;
|
|
226
224
|
this.setState({ imgError: true });
|
|
227
225
|
}, className: Utils_1.default.clsx(this.props.classes.img, this.props.getClassBackgroundImage()), src: `${this.props.href}?ts=${this.state.forceUpdate}`, alt: this.props.href });
|
package/Components/Logo.js
CHANGED
|
@@ -21,7 +21,7 @@ class Logo extends react_1.default.Component {
|
|
|
21
21
|
if (f) {
|
|
22
22
|
const r = new window.FileReader();
|
|
23
23
|
r.onload = () => {
|
|
24
|
-
// @ts-
|
|
24
|
+
// @ts-expect-error I don't know how to fix this
|
|
25
25
|
const contents = target.result;
|
|
26
26
|
try {
|
|
27
27
|
const json = JSON.parse(contents);
|
|
@@ -3963,8 +3963,11 @@ class ObjectBrowser extends react_1.Component {
|
|
|
3963
3963
|
}
|
|
3964
3964
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
3965
3965
|
const ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
3966
|
-
|
|
3967
|
-
|
|
3966
|
+
return react_1.default.createElement(ObjectBrowserEditRole
|
|
3967
|
+
// dummy, just to make compiler happy
|
|
3968
|
+
, {
|
|
3969
|
+
// dummy, just to make compiler happy
|
|
3970
|
+
classes: {}, key: "objectBrowserEditRole", id: this.state.roleDialog, socket: this.props.socket, t: this.props.t, roles: this.info.roles, onClose: (obj) => {
|
|
3968
3971
|
if (obj) {
|
|
3969
3972
|
this.info.objects[this.state.roleDialog] = obj;
|
|
3970
3973
|
}
|
|
@@ -4549,9 +4552,8 @@ class ObjectBrowser extends react_1.Component {
|
|
|
4549
4552
|
counter = counter || { count: 0 };
|
|
4550
4553
|
let leaf = this.renderLeaf(root, isExpanded, classes, counter);
|
|
4551
4554
|
const DragWrapper = this.props.DragWrapper;
|
|
4552
|
-
if (this.props.dragEnabled) {
|
|
4555
|
+
if (this.props.dragEnabled && DragWrapper) {
|
|
4553
4556
|
if (root.data.sumVisibility) {
|
|
4554
|
-
// @ts-expect-error How to solve it?
|
|
4555
4557
|
leaf = react_1.default.createElement(DragWrapper, { key: root.data.id, item: root, className: classes.draggable }, leaf);
|
|
4556
4558
|
}
|
|
4557
4559
|
else {
|
|
@@ -4906,8 +4908,7 @@ class ObjectBrowser extends react_1.Component {
|
|
|
4906
4908
|
renderCustomDialog() {
|
|
4907
4909
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
|
4908
4910
|
const ObjectCustomDialog = this.props.objectCustomDialog;
|
|
4909
|
-
|
|
4910
|
-
return react_1.default.createElement(ObjectCustomDialog, { reportChangedIds: (changedIds) => (this.changedIds = [...changedIds]), objectIDs: this.state.customDialog, allVisibleObjects: this.state.customDialogAll, expertMode: this.state.filter.expertMode, isFloatComma: this.props.isFloatComma, t: this.props.t, lang: this.props.lang, socket: this.props.socket, themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, objects: this.objects, customsInstances: this.info.customs, onClose: () => {
|
|
4911
|
+
return react_1.default.createElement(ObjectCustomDialog, { reportChangedIds: (changedIds) => (this.changedIds = [...changedIds]), objectIDs: this.state.customDialog, allVisibleObjects: !!this.state.customDialogAll, expertMode: this.state.filter.expertMode, isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma, t: this.props.t, lang: this.props.lang, socket: this.props.socket, themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, objects: this.objects, customsInstances: this.info.customs, onClose: () => {
|
|
4911
4912
|
var _b;
|
|
4912
4913
|
this.pauseSubscribe(false);
|
|
4913
4914
|
this.setState({ customDialog: null });
|
|
@@ -4917,7 +4918,9 @@ class ObjectBrowser extends react_1.Component {
|
|
|
4917
4918
|
this.forceUpdate();
|
|
4918
4919
|
}
|
|
4919
4920
|
(_b = this.props.router) === null || _b === void 0 ? void 0 : _b.doNavigate('tab-objects');
|
|
4920
|
-
}, systemConfig: this.systemConfig
|
|
4921
|
+
}, systemConfig: this.systemConfig,
|
|
4922
|
+
// dummy, just to make compiler happy
|
|
4923
|
+
classes: {} });
|
|
4921
4924
|
}
|
|
4922
4925
|
return null;
|
|
4923
4926
|
}
|
|
@@ -4936,8 +4939,11 @@ class ObjectBrowser extends react_1.Component {
|
|
|
4936
4939
|
return null;
|
|
4937
4940
|
}
|
|
4938
4941
|
const ObjectBrowserEditObject = this.props.objectBrowserEditObject;
|
|
4939
|
-
|
|
4940
|
-
|
|
4942
|
+
return react_1.default.createElement(ObjectBrowserEditObject
|
|
4943
|
+
// dummy, just to make compiler happy
|
|
4944
|
+
, {
|
|
4945
|
+
// dummy, just to make compiler happy
|
|
4946
|
+
classes: {}, key: this.state.editObjectDialog, obj: this.objects[this.state.editObjectDialog], roleArray: this.info.roles, objects: this.objects, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma, themeType: this.props.themeType, socket: this.props.socket, dialogName: this.props.dialogName, aliasTab: this.state.editObjectAlias, t: this.props.t, expertMode: !!this.state.filter.expertMode, onNewObject: (obj) => this.props.socket
|
|
4941
4947
|
.setObject(obj._id, obj)
|
|
4942
4948
|
.then(() => this.setState({ editObjectDialog: obj._id, editObjectAlias: false }, () => this.onSelect(obj._id)))
|
|
4943
4949
|
.catch(e => this.showError(`Cannot write object: ${e}`)), onClose: (obj) => {
|
|
@@ -4968,16 +4974,14 @@ class ObjectBrowser extends react_1.Component {
|
|
|
4968
4974
|
return null;
|
|
4969
4975
|
}
|
|
4970
4976
|
const ObjectBrowserViewFile = this.props.objectBrowserViewFile;
|
|
4971
|
-
|
|
4972
|
-
return react_1.default.createElement(ObjectBrowserViewFile, { key: "viewFile", obj: this.objects[this.state.viewFileDialog], themeType: this.props.themeType, socket: this.props.socket, dialogName: this.props.dialogName, t: this.props.t, expertMode: this.state.filter.expertMode, onClose: () => this.setState({ viewFileDialog: '' }) });
|
|
4977
|
+
return react_1.default.createElement(ObjectBrowserViewFile, { key: "viewFile", obj: this.objects[this.state.viewFileDialog], socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ viewFileDialog: '' }) });
|
|
4973
4978
|
}
|
|
4974
4979
|
renderAliasEditorDialog() {
|
|
4975
4980
|
if (!this.props.objectBrowserAliasEditor || !this.state.showAliasEditor) {
|
|
4976
4981
|
return null;
|
|
4977
4982
|
}
|
|
4978
4983
|
const ObjectBrowserAliasEditor = this.props.objectBrowserAliasEditor;
|
|
4979
|
-
|
|
4980
|
-
return react_1.default.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], objects: this.objects, themeType: this.props.themeType, socket: this.props.socket, dialogName: this.props.dialogName, t: this.props.t, expertMode: this.state.filter.expertMode, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
4984
|
+
return react_1.default.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], objects: this.objects, socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
4981
4985
|
this.scrollToItem(id);
|
|
4982
4986
|
setTimeout(() => this.setState({
|
|
4983
4987
|
editObjectDialog: id,
|
|
@@ -5325,11 +5329,12 @@ class ObjectBrowser extends react_1.Component {
|
|
|
5325
5329
|
: typeof this.edit.val;
|
|
5326
5330
|
const role = this.objects[this.edit.id].common.role;
|
|
5327
5331
|
const ObjectBrowserValue = this.props.objectBrowserValue;
|
|
5328
|
-
|
|
5329
|
-
return react_1.default.createElement(ObjectBrowserValue, { t: this.props.t, lang: this.props.lang, type: type, role: role, states: Utils_1.default.getStates(this.objects[this.edit.id]), themeType: this.props.themeType, expertMode: this.state.filter.expertMode, value: this.edit.val, socket: this.props.socket, object: this.objects[this.edit.id], defaultHistory: this.defaultHistory, dateFormat: this.props.dateFormat, onClose: (res) => {
|
|
5332
|
+
return react_1.default.createElement(ObjectBrowserValue, { t: this.props.t, lang: this.props.lang, type: type, role: role || '', states: Utils_1.default.getStates(this.objects[this.edit.id]), themeType: this.props.themeType, expertMode: !!this.state.filter.expertMode, value: this.edit.val, socket: this.props.socket, object: this.objects[this.edit.id], defaultHistory: this.defaultHistory, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma, onClose: (res) => {
|
|
5330
5333
|
this.setState({ updateOpened: false });
|
|
5331
5334
|
res && this.onUpdate(res);
|
|
5332
|
-
}
|
|
5335
|
+
},
|
|
5336
|
+
// dummy, just to make compiler happy
|
|
5337
|
+
classes: {} });
|
|
5333
5338
|
}
|
|
5334
5339
|
/**
|
|
5335
5340
|
* The rendering method of this component.
|
package/Components/Utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2018-
|
|
2
|
+
* Copyright 2018-2024 Denis Haev <dogafox@gmail.com>
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -10,11 +10,13 @@ interface GetObjectNameOptions {
|
|
|
10
10
|
name?: ioBroker.StringOrTranslated;
|
|
11
11
|
language?: ioBroker.Languages;
|
|
12
12
|
}
|
|
13
|
-
type SmartName = null |
|
|
13
|
+
type SmartName = null | false | string | ({
|
|
14
|
+
[lang in ioBroker.Languages]?: string;
|
|
15
|
+
} & {
|
|
14
16
|
/** Which kind of device it is */
|
|
15
17
|
smartType?: string | null;
|
|
16
18
|
/** Which value to set when the ON command is issued */
|
|
17
|
-
|
|
19
|
+
byON?: string | null;
|
|
18
20
|
});
|
|
19
21
|
declare namespace clsx {
|
|
20
22
|
type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
|
|
@@ -262,10 +264,9 @@ declare class Utils {
|
|
|
262
264
|
static generateFile(fileName: string, json: string): void;
|
|
263
265
|
/**
|
|
264
266
|
* Convert quality code into text
|
|
265
|
-
* @
|
|
266
|
-
* @returns {array<string>} lines that decode quality
|
|
267
|
+
* @returns lines that decode quality
|
|
267
268
|
*/
|
|
268
|
-
static quality2text(quality:
|
|
269
|
+
static quality2text(quality: ioBroker.STATE_QUALITY[keyof ioBroker.STATE_QUALITY]): string[];
|
|
269
270
|
/**
|
|
270
271
|
* Deep copy object
|
|
271
272
|
*/
|
package/Components/Utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/**
|
|
7
|
-
* Copyright 2018-
|
|
7
|
+
* Copyright 2018-2024 Denis Haev <dogafox@gmail.com>
|
|
8
8
|
*
|
|
9
9
|
* MIT License
|
|
10
10
|
*
|
|
@@ -262,7 +262,6 @@ class Utils {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
if (common) {
|
|
265
|
-
// @ts-ignore todo: after new types released
|
|
266
265
|
settings.color = settings.color || common.color;
|
|
267
266
|
settings.icon = settings.icon || common.icon;
|
|
268
267
|
settings.name = settings.name || common.name;
|
|
@@ -294,7 +293,6 @@ class Utils {
|
|
|
294
293
|
const s = obj.common.custom[NAMESPACE][options.user || 'admin'];
|
|
295
294
|
if (s.useCommon) {
|
|
296
295
|
if (s.color !== undefined) {
|
|
297
|
-
// @ts-ignore todo: after new types released
|
|
298
296
|
obj.common.color = s.color;
|
|
299
297
|
delete s.color;
|
|
300
298
|
}
|
|
@@ -563,7 +561,7 @@ class Utils {
|
|
|
563
561
|
const m = now.match(/(\d{1,4})[-./](\d{1,2})[-./](\d{1,4})/);
|
|
564
562
|
if (m) {
|
|
565
563
|
const a = [parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)];
|
|
566
|
-
//
|
|
564
|
+
// We now have 3 numbers. Let's try to detect where is year, where is day and where is month
|
|
567
565
|
const year = a.find(y => y > 31);
|
|
568
566
|
if (year !== undefined) {
|
|
569
567
|
a.splice(a.indexOf(year), 1);
|
|
@@ -651,18 +649,14 @@ class Utils {
|
|
|
651
649
|
if (!id) {
|
|
652
650
|
if (!noCommon) {
|
|
653
651
|
if (!states.common) {
|
|
654
|
-
// @ts-ignore
|
|
655
652
|
return states.smartName;
|
|
656
653
|
}
|
|
657
654
|
if (states && !states.common) {
|
|
658
|
-
// @ts-ignore
|
|
659
655
|
return states.smartName;
|
|
660
656
|
}
|
|
661
|
-
// @ts-ignore
|
|
662
657
|
return states.common.smartName;
|
|
663
658
|
}
|
|
664
659
|
if (states && !states.common) {
|
|
665
|
-
// @ts-ignore
|
|
666
660
|
return states.smartName;
|
|
667
661
|
}
|
|
668
662
|
const obj = states;
|
|
@@ -670,7 +664,6 @@ class Utils {
|
|
|
670
664
|
obj.common.custom[instanceId].smartName : undefined;
|
|
671
665
|
}
|
|
672
666
|
if (!noCommon) {
|
|
673
|
-
// @ts-ignore
|
|
674
667
|
return states[id].common.smartName;
|
|
675
668
|
}
|
|
676
669
|
const obj = states[id];
|
|
@@ -684,18 +677,14 @@ class Utils {
|
|
|
684
677
|
var _a;
|
|
685
678
|
if (!noCommon) {
|
|
686
679
|
if (!obj.common) {
|
|
687
|
-
// @ts-ignore
|
|
688
680
|
return obj.smartName;
|
|
689
681
|
}
|
|
690
682
|
if (obj && !obj.common) {
|
|
691
|
-
// @ts-ignore
|
|
692
683
|
return obj.smartName;
|
|
693
684
|
}
|
|
694
|
-
// @ts-ignore
|
|
695
685
|
return obj.common.smartName;
|
|
696
686
|
}
|
|
697
687
|
if (obj && !obj.common) {
|
|
698
|
-
// @ts-ignore
|
|
699
688
|
return obj.smartName;
|
|
700
689
|
}
|
|
701
690
|
return ((_a = obj === null || obj === void 0 ? void 0 : obj.common) === null || _a === void 0 ? void 0 : _a.custom) && obj.common.custom[instanceId] ?
|
|
@@ -724,7 +713,6 @@ class Utils {
|
|
|
724
713
|
}
|
|
725
714
|
}
|
|
726
715
|
else {
|
|
727
|
-
// @ts-ignore
|
|
728
716
|
obj.common.smartName = null;
|
|
729
717
|
}
|
|
730
718
|
}
|
|
@@ -783,7 +771,6 @@ class Utils {
|
|
|
783
771
|
}
|
|
784
772
|
else {
|
|
785
773
|
obj.common.smartName = obj.common.smartName || {};
|
|
786
|
-
// @ts-ignore
|
|
787
774
|
obj.common.smartName.byON = byON;
|
|
788
775
|
}
|
|
789
776
|
}
|
|
@@ -832,7 +819,7 @@ class Utils {
|
|
|
832
819
|
delete obj.common.custom[instanceId].uk;
|
|
833
820
|
delete obj.common.custom[instanceId]['zh-cn'];
|
|
834
821
|
}
|
|
835
|
-
// @ts-
|
|
822
|
+
// @ts-expect-error
|
|
836
823
|
}
|
|
837
824
|
else if (obj.common.smartName && obj.common.smartName.byON !== undefined) {
|
|
838
825
|
delete obj.common.smartName.en;
|
|
@@ -848,7 +835,6 @@ class Utils {
|
|
|
848
835
|
delete obj.common.smartName['zh-cn'];
|
|
849
836
|
}
|
|
850
837
|
else {
|
|
851
|
-
// @ts-ignore
|
|
852
838
|
obj.common.smartName = null;
|
|
853
839
|
}
|
|
854
840
|
}
|
|
@@ -865,7 +851,6 @@ class Utils {
|
|
|
865
851
|
obj.common.custom[instanceId].smartName = false;
|
|
866
852
|
}
|
|
867
853
|
else {
|
|
868
|
-
// @ts-ignore
|
|
869
854
|
obj.common.smartName = false;
|
|
870
855
|
}
|
|
871
856
|
}
|
|
@@ -1418,13 +1403,11 @@ class Utils {
|
|
|
1418
1403
|
}
|
|
1419
1404
|
/**
|
|
1420
1405
|
* Convert quality code into text
|
|
1421
|
-
* @
|
|
1422
|
-
* @returns {array<string>} lines that decode quality
|
|
1406
|
+
* @returns lines that decode quality
|
|
1423
1407
|
*/
|
|
1424
1408
|
static quality2text(quality) {
|
|
1425
1409
|
// eslint-disable-next-line no-bitwise
|
|
1426
1410
|
const custom = quality & 0xFFFF0000;
|
|
1427
|
-
// @ts-ignore
|
|
1428
1411
|
const text = QUALITY_BITS[quality];
|
|
1429
1412
|
let result;
|
|
1430
1413
|
if (text) {
|
|
@@ -1523,7 +1506,6 @@ class Utils {
|
|
|
1523
1506
|
*/
|
|
1524
1507
|
static detectMimeType(base64) {
|
|
1525
1508
|
const signature = Object.keys(SIGNATURES).find(s => base64.startsWith(s));
|
|
1526
|
-
// @ts-ignore
|
|
1527
1509
|
return signature ? SIGNATURES[signature] : null;
|
|
1528
1510
|
}
|
|
1529
1511
|
/**
|
package/Dialogs/ComplexCron.js
CHANGED
|
@@ -57,15 +57,15 @@ class DialogComplexCron extends react_1.default.Component {
|
|
|
57
57
|
react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
58
58
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
59
59
|
!!this.props.clearButton && react_1.default.createElement(material_1.Button
|
|
60
|
-
// @ts-expect-error
|
|
60
|
+
// @ts-expect-error grey is valid color
|
|
61
61
|
, {
|
|
62
|
-
// @ts-expect-error
|
|
62
|
+
// @ts-expect-error grey is valid color
|
|
63
63
|
color: "grey", variant: "contained", onClick: () => this.handleClear(), startIcon: react_1.default.createElement(icons_material_1.Delete, null) }, this.props.clear || i18n_1.default.t('ra_Clear')),
|
|
64
64
|
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')),
|
|
65
65
|
react_1.default.createElement(material_1.Button
|
|
66
|
-
// @ts-expect-error
|
|
66
|
+
// @ts-expect-error grey is valid color
|
|
67
67
|
, {
|
|
68
|
-
// @ts-expect-error
|
|
68
|
+
// @ts-expect-error grey is valid color
|
|
69
69
|
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'))));
|
|
70
70
|
}
|
|
71
71
|
}
|
package/Dialogs/Confirm.js
CHANGED
|
@@ -106,7 +106,7 @@ class DialogConfirm extends react_1.Component {
|
|
|
106
106
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
107
107
|
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_ok_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleOk(), color: "primary", autoFocus: true, startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
108
108
|
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_cancel_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleCancel(),
|
|
109
|
-
// @ts-expect-error
|
|
109
|
+
// @ts-expect-error grey is valid color
|
|
110
110
|
color: "grey", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
111
111
|
}
|
|
112
112
|
}
|
package/Dialogs/Cron.js
CHANGED
|
@@ -99,7 +99,7 @@ class DialogCron extends react_1.default.Component {
|
|
|
99
99
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
100
100
|
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')),
|
|
101
101
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleCancel(),
|
|
102
|
-
// @ts-expect-error grey is
|
|
102
|
+
// @ts-expect-error grey is valid color
|
|
103
103
|
color: "grey", startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
104
104
|
}
|
|
105
105
|
}
|
package/Dialogs/SelectFile.js
CHANGED
|
@@ -113,9 +113,9 @@ class DialogSelectFile extends react_1.default.Component {
|
|
|
113
113
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
114
114
|
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')),
|
|
115
115
|
react_1.default.createElement(material_1.Button
|
|
116
|
-
// @ts-expect-error grey is
|
|
116
|
+
// @ts-expect-error grey is valid color
|
|
117
117
|
, {
|
|
118
|
-
// @ts-expect-error grey is
|
|
118
|
+
// @ts-expect-error grey is valid color
|
|
119
119
|
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'))));
|
|
120
120
|
}
|
|
121
121
|
}
|
package/Dialogs/SelectID.js
CHANGED
|
@@ -146,7 +146,7 @@ class DialogSelectID extends react_1.Component {
|
|
|
146
146
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
147
147
|
react_1.default.createElement(material_1.Button, { id: `ar_dialog_selectid_ok_${this.props.dialogName || ''}`, 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')),
|
|
148
148
|
react_1.default.createElement(material_1.Button, { id: `ar_dialog_selectid_cancel_${this.props.dialogName || ''}`,
|
|
149
|
-
// @ts-expect-error
|
|
149
|
+
// @ts-expect-error grey is valid color
|
|
150
150
|
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'))));
|
|
151
151
|
}
|
|
152
152
|
}
|
package/Dialogs/SimpleCron.js
CHANGED
|
@@ -54,7 +54,7 @@ class DialogSimpleCron extends react_1.default.Component {
|
|
|
54
54
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
55
55
|
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')),
|
|
56
56
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleCancel(),
|
|
57
|
-
// @ts-expect-error grey is
|
|
57
|
+
// @ts-expect-error grey is valid color
|
|
58
58
|
color: "grey", startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
59
59
|
}
|
|
60
60
|
}
|
package/GenericApp.d.ts
CHANGED
package/GenericApp.js
CHANGED
|
@@ -131,7 +131,6 @@ class GenericApp extends Router_1.default {
|
|
|
131
131
|
this.socket.systemLang = (obj === null || obj === void 0 ? void 0 : obj.common.language) || 'en';
|
|
132
132
|
i18n_1.default.setLanguage(this.socket.systemLang);
|
|
133
133
|
}
|
|
134
|
-
// @ts-expect-error will be fixed in js-controller
|
|
135
134
|
if (((_a = this._systemConfig) === null || _a === void 0 ? void 0 : _a.expertMode) !== !!((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.expertMode)) {
|
|
136
135
|
this._systemConfig = (obj === null || obj === void 0 ? void 0 : obj.common) || {};
|
|
137
136
|
this.setState({ expertMode: this.getExpertMode() });
|
|
@@ -283,7 +282,7 @@ class GenericApp extends Router_1.default {
|
|
|
283
282
|
(instanceObj === null || instanceObj === void 0 ? void 0 : instanceObj.common) &&
|
|
284
283
|
instanceObj.common.name &&
|
|
285
284
|
instanceObj.common.version &&
|
|
286
|
-
// @ts-expect-error will be extended in js-controller TODO: this is redundant to state `${this.instanceId}.plugins.sentry.enabled`, remove this in future when admin sets the state correctly
|
|
285
|
+
// @ts-expect-error will be extended in js-controller TODO: (BF: 2024.05.30) this is redundant to state `${this.instanceId}.plugins.sentry.enabled`, remove this in future when admin sets the state correctly
|
|
287
286
|
!instanceObj.common.disableDataReporting &&
|
|
288
287
|
window.location.host !== 'localhost:3000';
|
|
289
288
|
// activate sentry plugin
|
|
@@ -451,11 +450,9 @@ class GenericApp extends Router_1.default {
|
|
|
451
450
|
}
|
|
452
451
|
/**
|
|
453
452
|
* Get current expert mode
|
|
454
|
-
* @returns {boolean}
|
|
455
453
|
*/
|
|
456
454
|
getExpertMode() {
|
|
457
455
|
var _a;
|
|
458
|
-
// @ts-expect-error will be fixed in js-controller
|
|
459
456
|
return window.sessionStorage.getItem('App.expertMode') === 'true' || !!((_a = this._systemConfig) === null || _a === void 0 ? void 0 : _a.expertMode);
|
|
460
457
|
}
|
|
461
458
|
/**
|
package/README.md
CHANGED
|
@@ -662,6 +662,12 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
|
|
|
662
662
|
- Replace all `socket.log.error('text')` to `socket.log('text', 'error')`
|
|
663
663
|
- Add to App.js `import { AdminConnection } from '@iobroker/adapter-react-v5';` and `super(props, { Connection: AdminConnection });` if run in admin
|
|
664
664
|
|
|
665
|
+
## Migration from adapter-react-v5@4.x to adapter-react-v5@5.x
|
|
666
|
+
- `Theme` is renamed to IobTheme. It is an object with classes inside. `Theme` is still inside and it same as mui `createTheme`.
|
|
667
|
+
- adapter-react-v5 has all types exported. So you can use `import { type IobTheme, Theme } from '@iobroker/adapter-react-v5';` and `const theme: IobTheme = Theme('light');`
|
|
668
|
+
- Json-Config is now an external package and must be included as dependency separately.
|
|
669
|
+
- Use type `Translate` for `t(word: string, ...args: any[]) => string`
|
|
670
|
+
|
|
665
671
|
## Warning
|
|
666
672
|
`react-inlinesvg@4.0.5` cannot be used. Use `react-inlinesvg@4.0.3` instead.
|
|
667
673
|
<!--
|
|
@@ -670,6 +676,10 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
|
|
|
670
676
|
-->
|
|
671
677
|
|
|
672
678
|
## Changelog
|
|
679
|
+
### 5.0.2 (2024-05-30)
|
|
680
|
+
* (bluefox) Added better typing
|
|
681
|
+
* (bluefox) Json-Config is now a separate package and must be installed additionally
|
|
682
|
+
|
|
673
683
|
### 5.0.0 (2024-05-29)
|
|
674
684
|
* (bluefox) Types are now exported
|
|
675
685
|
* (bluefox) Translator renamed to Translate
|
package/index.d.ts
CHANGED
|
@@ -69,8 +69,6 @@ export { default as LoaderPT } from './Components/Loaders/PT';
|
|
|
69
69
|
export * from './Components/Loaders/PT';
|
|
70
70
|
export { default as LoaderMV } from './Components/Loaders/MV';
|
|
71
71
|
export * from './Components/Loaders/MV';
|
|
72
|
-
export { JsonConfigComponent } from '@iobroker/json-config';
|
|
73
|
-
export type * from '@iobroker/json-config';
|
|
74
72
|
export { default as IconAdapter } from './icons/IconAdapter';
|
|
75
73
|
export * from './icons/IconAdapter';
|
|
76
74
|
export { default as IconAlias } from './icons/IconAlias';
|
|
@@ -121,7 +119,6 @@ export { default as SimpleCronDialog } from './Dialogs/SimpleCron';
|
|
|
121
119
|
export * from './Dialogs/SimpleCron';
|
|
122
120
|
export { default as TextInput } from './Dialogs/TextInput';
|
|
123
121
|
export * from './Dialogs/TextInput';
|
|
124
|
-
export { ConfigGeneric } from '@iobroker/json-config';
|
|
125
122
|
export { default as Connection } from './Connection';
|
|
126
123
|
export * from './Connection';
|
|
127
124
|
export { PROGRESS } from './Connection';
|
package/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.IconOpen = exports.IconLogout = exports.IconInstance = exports.IconFx = exports.IconExpert = exports.IconDocument = exports.IconDevice = exports.IconCopy = exports.IconClosed = exports.IconChannel = exports.IconAlias = exports.IconAdapter = exports.
|
|
21
|
-
exports.LegacyConnection = exports.AdminConnection = exports.PROGRESS = exports.Connection = exports.
|
|
20
|
+
exports.IconState = exports.IconOpen = exports.IconLogout = exports.IconInstance = exports.IconFx = exports.IconExpert = exports.IconDocument = exports.IconDevice = exports.IconCopy = exports.IconClosed = exports.IconChannel = exports.IconAlias = exports.IconAdapter = exports.LoaderMV = exports.LoaderPT = exports.LoaderVendor = exports.SimpleCron = exports.withWidth = exports.Utils = exports.UploadImage = exports.TreeTable = exports.ToggleThemeMenu = exports.TextWithIcon = exports.TableResize = exports.TabHeader = exports.TabContent = exports.TabContainer = exports.SelectWithIcon = exports.Schedule = exports.SaveCloseButtons = exports.Router = exports.ObjectBrowser = exports.MDUtils = exports.Logo = exports.Loader = exports.Image = exports.IconSelector = exports.IconPicker = exports.Icon = exports.FileViewer = exports.FileBrowser = exports.CustomModal = exports.copy = exports.ComplexCron = exports.ColorPicker = exports.Prompt = exports.I18n = exports.i18n = exports.GenericApp = exports.Theme = void 0;
|
|
21
|
+
exports.LegacyConnection = exports.AdminConnection = exports.PROGRESS = exports.Connection = exports.TextInput = exports.SimpleCronDialog = exports.SelectFile = exports.SelectID = exports.Message = exports.Error = exports.Cron = exports.Confirm = exports.ComplexCronDialog = exports.IconClearFilter = exports.IconDocumentReadOnly = exports.IconNoIcon = void 0;
|
|
22
22
|
var Theme_1 = require("./Theme");
|
|
23
23
|
Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return __importDefault(Theme_1).default; } });
|
|
24
24
|
__exportStar(require("./Theme"), exports);
|
|
@@ -128,8 +128,6 @@ __exportStar(require("./Components/Loaders/PT"), exports);
|
|
|
128
128
|
var MV_1 = require("./Components/Loaders/MV");
|
|
129
129
|
Object.defineProperty(exports, "LoaderMV", { enumerable: true, get: function () { return __importDefault(MV_1).default; } });
|
|
130
130
|
__exportStar(require("./Components/Loaders/MV"), exports);
|
|
131
|
-
var json_config_1 = require("@iobroker/json-config");
|
|
132
|
-
Object.defineProperty(exports, "JsonConfigComponent", { enumerable: true, get: function () { return json_config_1.JsonConfigComponent; } });
|
|
133
131
|
var IconAdapter_1 = require("./icons/IconAdapter");
|
|
134
132
|
Object.defineProperty(exports, "IconAdapter", { enumerable: true, get: function () { return __importDefault(IconAdapter_1).default; } });
|
|
135
133
|
__exportStar(require("./icons/IconAdapter"), exports);
|
|
@@ -205,8 +203,6 @@ __exportStar(require("./Dialogs/SimpleCron"), exports);
|
|
|
205
203
|
var TextInput_1 = require("./Dialogs/TextInput");
|
|
206
204
|
Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return __importDefault(TextInput_1).default; } });
|
|
207
205
|
__exportStar(require("./Dialogs/TextInput"), exports);
|
|
208
|
-
var json_config_2 = require("@iobroker/json-config");
|
|
209
|
-
Object.defineProperty(exports, "ConfigGeneric", { enumerable: true, get: function () { return json_config_2.ConfigGeneric; } });
|
|
210
206
|
var Connection_1 = require("./Connection");
|
|
211
207
|
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return __importDefault(Connection_1).default; } });
|
|
212
208
|
__exportStar(require("./Connection"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/adapter-react-v5",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "React classes to develop admin interfaces for ioBroker with react.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Denis Haev (bluefox)",
|
|
@@ -29,17 +29,15 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@emotion/react": "^11.11.4",
|
|
31
31
|
"@emotion/styled": "^11.11.5",
|
|
32
|
-
"@iobroker/dm-utils": "^0.1.9",
|
|
33
|
-
"@iobroker/json-config": "^6.17.14",
|
|
34
32
|
"@iobroker/socket-client": "^2.4.14",
|
|
35
|
-
"@iobroker/types": "^6.0.1-alpha.0-
|
|
36
|
-
"@iobroker/js-controller-common": "^6.0.1-alpha.0-
|
|
37
|
-
"@iobroker/js-controller-common-db": "^6.0.1-alpha.0-
|
|
38
|
-
"@mui/icons-material": "^5.15.
|
|
33
|
+
"@iobroker/types": "^6.0.1-alpha.0-20240530-b38e01746",
|
|
34
|
+
"@iobroker/js-controller-common": "^6.0.1-alpha.0-20240530-b38e01746",
|
|
35
|
+
"@iobroker/js-controller-common-db": "^6.0.1-alpha.0-20240530-b38e01746",
|
|
36
|
+
"@mui/icons-material": "^5.15.19",
|
|
39
37
|
"@mui/material": "5.14.14",
|
|
40
38
|
"@mui/styles": "5.14.14",
|
|
41
39
|
"@mui/x-date-pickers": "^7.5.1",
|
|
42
|
-
"@sentry/browser": "^8.
|
|
40
|
+
"@sentry/browser": "^8.7.0",
|
|
43
41
|
"react-color": "^2.19.3",
|
|
44
42
|
"react-colorful": "^5.6.1",
|
|
45
43
|
"react-cropper": "^2.3.3",
|