@iobroker/adapter-react-v5 4.14.1 → 5.0.1
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/SaveCloseButtons.d.ts +5 -7
- package/Components/SaveCloseButtons.js +3 -5
- package/Components/Schedule.d.ts +1 -30
- package/Components/Schedule.js +1 -1
- package/Components/SimpleCron/cronText.js +1 -0
- package/Components/TabContainer.d.ts +2 -6
- package/Components/TabContainer.js +4 -30
- package/Components/TabContent.js +2 -5
- package/Components/TabHeader.d.ts +1 -3
- package/Components/TabHeader.js +2 -4
- package/Components/TreeTable.js +33 -104
- package/Components/Utils.d.ts +8 -7
- 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 +4 -4
- package/README.md +5 -1
- package/Theme.d.ts +2 -2
- package/package.json +1 -1
- package/types.d.ts +2 -2
|
@@ -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.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IobTheme } from '../types';
|
|
2
3
|
interface SaveCloseButtonsProps {
|
|
3
4
|
noTextOnButtons?: boolean;
|
|
4
|
-
theme:
|
|
5
|
+
theme: IobTheme;
|
|
5
6
|
isIFrame?: boolean;
|
|
6
7
|
newReact?: boolean;
|
|
7
8
|
onSave: (close: boolean) => void;
|
|
@@ -10,10 +11,7 @@ interface SaveCloseButtonsProps {
|
|
|
10
11
|
paddingLeft?: number;
|
|
11
12
|
changed: boolean;
|
|
12
13
|
error?: boolean;
|
|
13
|
-
classes:
|
|
14
|
-
buttonIcon: string;
|
|
15
|
-
};
|
|
14
|
+
classes: Record<string, string>;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export default _export;
|
|
16
|
+
declare const _default: React.JSXElementConstructor<Omit<SaveCloseButtonsProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
17
|
+
export default _default;
|
|
@@ -9,11 +9,11 @@ const styles_1 = require("@mui/styles");
|
|
|
9
9
|
const material_1 = require("@mui/material");
|
|
10
10
|
const icons_material_1 = require("@mui/icons-material");
|
|
11
11
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
12
|
-
const styles =
|
|
12
|
+
const styles = {
|
|
13
13
|
buttonIcon: {
|
|
14
14
|
marginRight: 8,
|
|
15
15
|
},
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
/**
|
|
18
18
|
* @typedef {object} SaveCloseButtonsProps
|
|
19
19
|
* @property {boolean} noTextOnButtons Are the buttons without text
|
|
@@ -76,6 +76,4 @@ class SaveCloseButtons extends react_1.default.Component {
|
|
|
76
76
|
!noTextOnButtons && i18n_1.default.t('ra_Close')));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
const _export = (0, styles_1.withStyles)(styles)(SaveCloseButtons);
|
|
81
|
-
exports.default = _export;
|
|
79
|
+
exports.default = (0, styles_1.withStyles)(styles)(SaveCloseButtons);
|
package/Components/Schedule.d.ts
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
time: {
|
|
4
|
-
exactTime: boolean;
|
|
5
|
-
start: string;
|
|
6
|
-
end: string;
|
|
7
|
-
mode: string;
|
|
8
|
-
interval: number;
|
|
9
|
-
};
|
|
10
|
-
period: {
|
|
11
|
-
once: string;
|
|
12
|
-
days: number;
|
|
13
|
-
dows: string;
|
|
14
|
-
dates: string;
|
|
15
|
-
weeks: number;
|
|
16
|
-
months: string | number;
|
|
17
|
-
years: number;
|
|
18
|
-
yearMonth: number;
|
|
19
|
-
yearDate: number;
|
|
20
|
-
};
|
|
21
|
-
valid: {
|
|
22
|
-
from: string;
|
|
23
|
-
to?: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
interface ScheduleProps {
|
|
27
|
-
classes: Record<string, string>;
|
|
28
|
-
schedule: string | ScheduleConfig;
|
|
29
|
-
onChange: (schedule: string, desc?: string) => void;
|
|
30
|
-
}
|
|
31
|
-
declare const _default: React.JSXElementConstructor<Omit<ScheduleProps, "classes"> & import("@mui/styles").StyledComponentProps<"hr" | "scrollWindow" | "rowDiv" | "modeDiv" | "settingsDiv" | "inputTime" | "inputDate" | "inputEvery" | "inputRadio" | "inputGroup" | "inputGroupElement" | "inputDateDay" | "inputDateDayCheck" | "inputSmallCheck" | "rowOnce" | "rowDays" | "rowDows" | "rowDates" | "rowWeeks" | "rowMonths" | "rowMonthsDates" | "rowYears" | "rowDaysDows" | "rowDowsDows"> & object>;
|
|
2
|
+
declare const _default: React.JSXElementConstructor<any>;
|
|
32
3
|
export default _default;
|
package/Components/Schedule.js
CHANGED
|
@@ -30,7 +30,7 @@ const react_1 = __importStar(require("react"));
|
|
|
30
30
|
const styles_1 = require("@mui/styles");
|
|
31
31
|
const material_1 = require("@mui/material");
|
|
32
32
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
33
|
-
const styles =
|
|
33
|
+
const styles = theme => ({
|
|
34
34
|
hr: {
|
|
35
35
|
border: 0,
|
|
36
36
|
borderTop: '1px solid gray',
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const cron2text_1 = __importDefault(require("./cron2text"));
|
|
7
7
|
const jquery_cron_locale_1 = __importDefault(require("./jquery.cron.locale"));
|
|
8
|
+
// TODO: other languages
|
|
8
9
|
function correctCasus(text /* , seconds */) {
|
|
9
10
|
text = text.replace('Каждую(ый) минуту', 'Каждую минуту');
|
|
10
11
|
text = text.replace('Каждую(ый) минут(у)', 'Каждую минуту');
|
|
@@ -5,13 +5,9 @@ interface TabContainerProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
7
7
|
tabIndex?: number;
|
|
8
|
-
classes:
|
|
9
|
-
root: string;
|
|
10
|
-
overflowHidden: string;
|
|
11
|
-
container: string;
|
|
12
|
-
};
|
|
8
|
+
classes: Record<string, string>;
|
|
13
9
|
children: React.ReactNode;
|
|
14
10
|
}
|
|
15
11
|
/** @type {typeof TabContainer} */
|
|
16
|
-
declare const _export: React.JSXElementConstructor<Omit<TabContainerProps, "classes"> & import("@mui/styles").StyledComponentProps<
|
|
12
|
+
declare const _export: React.JSXElementConstructor<Omit<TabContainerProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
17
13
|
export default _export;
|
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 =
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
30
7
|
const styles_1 = require("@mui/styles");
|
|
31
8
|
const material_1 = require("@mui/material");
|
|
32
9
|
const Utils_1 = __importDefault(require("./Utils"));
|
|
@@ -42,12 +19,9 @@ const styles = {
|
|
|
42
19
|
height: '100%',
|
|
43
20
|
},
|
|
44
21
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return react_1.default.createElement(material_1.Paper, { elevation: !Number.isNaN(this.props.elevation) ? this.props.elevation : 1, className: Utils_1.default.clsx(classes.root, { [classes.overflowHidden]: this.props.overflow !== 'visible' }, this.props.className), onKeyDown: this.props.onKeyDown, tabIndex: this.props.tabIndex },
|
|
49
|
-
react_1.default.createElement(material_1.Grid, { container: true, direction: "column", wrap: "nowrap", className: classes.container }, this.props.children));
|
|
50
|
-
}
|
|
22
|
+
function TabContainer(props) {
|
|
23
|
+
return react_1.default.createElement(material_1.Paper, { elevation: !Number.isNaN(props.elevation) ? props.elevation : 1, className: Utils_1.default.clsx(props.classes.root, { [props.classes.overflowHidden]: props.overflow !== 'visible' }, props.className), onKeyDown: props.onKeyDown, tabIndex: props.tabIndex },
|
|
24
|
+
react_1.default.createElement(material_1.Grid, { container: true, direction: "column", wrap: "nowrap", className: props.classes.container }, props.children));
|
|
51
25
|
}
|
|
52
26
|
/** @type {typeof TabContainer} */
|
|
53
27
|
const _export = (0, styles_1.withStyles)(styles)(TabContainer);
|
package/Components/TabContent.js
CHANGED
|
@@ -17,10 +17,7 @@ const styles = {
|
|
|
17
17
|
overflow: 'auto',
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const { classes } = this.props;
|
|
23
|
-
return react_1.default.createElement(material_1.Grid, { item: true, className: Utils_1.default.clsx(classes.root, this.props.overflow === 'auto' ? classes.overflowAuto : '') }, this.props.children);
|
|
24
|
-
}
|
|
20
|
+
function TabContent(props) {
|
|
21
|
+
return react_1.default.createElement(material_1.Grid, { item: true, className: Utils_1.default.clsx(props.classes.root, props.overflow === 'auto' ? props.classes.overflowAuto : '') }, props.children);
|
|
25
22
|
}
|
|
26
23
|
exports.default = (0, styles_1.withStyles)(styles)(TabContent);
|
|
@@ -2,7 +2,5 @@ import React from 'react';
|
|
|
2
2
|
interface TabHeaderProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
-
declare
|
|
6
|
-
render(): React.JSX.Element;
|
|
7
|
-
}
|
|
5
|
+
declare function TabHeader(props: TabHeaderProps): React.JSX.Element;
|
|
8
6
|
export default TabHeader;
|
package/Components/TabHeader.js
CHANGED
|
@@ -5,9 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, this.props.children);
|
|
11
|
-
}
|
|
8
|
+
function TabHeader(props) {
|
|
9
|
+
return react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, props.children);
|
|
12
10
|
}
|
|
13
11
|
exports.default = TabHeader;
|
package/Components/TreeTable.js
CHANGED
|
@@ -241,63 +241,46 @@ class TreeTable extends react_1.Component {
|
|
|
241
241
|
val = val[0];
|
|
242
242
|
}
|
|
243
243
|
if (col.lookup) {
|
|
244
|
-
return this.renderCellEditSelect(
|
|
244
|
+
return this.renderCellEditSelect(col, val);
|
|
245
245
|
}
|
|
246
246
|
if (col.editComponent) {
|
|
247
|
-
return this.renderCellEditCustom(
|
|
247
|
+
return this.renderCellEditCustom(col, val, item);
|
|
248
248
|
}
|
|
249
249
|
if (col.type === 'boolean' || (!col.type && typeof val === 'boolean')) {
|
|
250
|
-
return this.renderCellEditBoolean(
|
|
250
|
+
return this.renderCellEditBoolean(col, val);
|
|
251
251
|
}
|
|
252
252
|
if (col.type === 'color') {
|
|
253
|
-
return this.renderCellEditColor(
|
|
253
|
+
return this.renderCellEditColor(col, val);
|
|
254
254
|
}
|
|
255
255
|
if (col.type === 'oid') {
|
|
256
|
-
return this.renderCellEditObjectID(
|
|
256
|
+
return this.renderCellEditObjectID(col, val);
|
|
257
257
|
}
|
|
258
258
|
if (col.type === 'numeric') {
|
|
259
|
-
return this.renderCellEditNumber(
|
|
259
|
+
return this.renderCellEditNumber(col, val);
|
|
260
260
|
}
|
|
261
|
-
return this.renderCellEditString(
|
|
261
|
+
return this.renderCellEditString(col, val);
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
263
|
+
onChange(col, oldValue, newValue) {
|
|
264
|
+
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
265
|
+
if (newValue === oldValue) {
|
|
266
|
+
delete editData[col.field];
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
editData[col.field] = newValue;
|
|
270
|
+
}
|
|
271
|
+
this.setState({ editData });
|
|
272
|
+
}
|
|
273
|
+
renderCellEditSelect(col, val) {
|
|
274
|
+
return react_1.default.createElement(material_1.Select, { variant: "standard", onChange: e => this.onChange(col, val, e.target.value), value: (this.state.editData && this.state.editData[col.field]) || val }, col.lookup && Object.keys(col.lookup)
|
|
274
275
|
.map((v, i) => { var _c; return react_1.default.createElement(material_1.MenuItem, { key: i, value: v }, (_c = col.lookup) === null || _c === void 0 ? void 0 : _c[v]); }));
|
|
275
276
|
}
|
|
276
|
-
renderCellEditString(
|
|
277
|
-
return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e =>
|
|
278
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
279
|
-
if (e.target.value === val) {
|
|
280
|
-
delete editData[col.field];
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
editData[col.field] = e.target.value;
|
|
284
|
-
}
|
|
285
|
-
this.setState({ editData });
|
|
286
|
-
} });
|
|
277
|
+
renderCellEditString(col, val) {
|
|
278
|
+
return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => this.onChange(col, val, e.target.value) });
|
|
287
279
|
}
|
|
288
|
-
renderCellEditNumber(
|
|
289
|
-
return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, type: "number", fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e =>
|
|
290
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
291
|
-
if (e.target.value === val) {
|
|
292
|
-
delete editData[col.field];
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
editData[col.field] = e.target.value;
|
|
296
|
-
}
|
|
297
|
-
this.setState({ editData });
|
|
298
|
-
} });
|
|
280
|
+
renderCellEditNumber(col, val) {
|
|
281
|
+
return react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.fieldEdit, type: "number", fullWidth: true, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => this.onChange(col, val, e.target.value) });
|
|
299
282
|
}
|
|
300
|
-
renderCellEditCustom(
|
|
283
|
+
renderCellEditCustom(col, val, item) {
|
|
301
284
|
const EditComponent = col.editComponent;
|
|
302
285
|
// use new value if exists
|
|
303
286
|
if (this.state.editData && this.state.editData[col.field] !== undefined) {
|
|
@@ -305,28 +288,10 @@ class TreeTable extends react_1.Component {
|
|
|
305
288
|
item = JSON.parse(JSON.stringify(item));
|
|
306
289
|
item[col.field] = val;
|
|
307
290
|
}
|
|
308
|
-
return react_1.default.createElement(EditComponent, { value: val, rowData: item, onChange: (newVal) =>
|
|
309
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
310
|
-
if (newVal === val) {
|
|
311
|
-
delete editData[col.field];
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
editData[col.field] = newVal;
|
|
315
|
-
}
|
|
316
|
-
this.setState({ editData });
|
|
317
|
-
} });
|
|
291
|
+
return react_1.default.createElement(EditComponent, { value: val, rowData: item, onChange: (newVal) => this.onChange(col, val, newVal) });
|
|
318
292
|
}
|
|
319
|
-
renderCellEditBoolean(
|
|
320
|
-
return react_1.default.createElement(material_1.Checkbox, { checked: this.state.editData && this.state.editData[col.field] !== undefined ? !!this.state.editData[col.field] : !!val, onChange: e => {
|
|
321
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
322
|
-
if (e.target.checked === !!val) {
|
|
323
|
-
delete editData[col.field];
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
editData[col.field] = e.target.checked;
|
|
327
|
-
}
|
|
328
|
-
this.setState({ editData });
|
|
329
|
-
}, inputProps: { 'aria-label': 'checkbox' } });
|
|
293
|
+
renderCellEditBoolean(col, val) {
|
|
294
|
+
return react_1.default.createElement(material_1.Checkbox, { checked: this.state.editData && this.state.editData[col.field] !== undefined ? !!this.state.editData[col.field] : !!val, onChange: e => this.onChange(col, !!val, e.target.checked), inputProps: { 'aria-label': 'checkbox' } });
|
|
330
295
|
}
|
|
331
296
|
renderSelectColorDialog() {
|
|
332
297
|
return react_1.default.createElement(material_1.Dialog, { classes: { root: this.props.classes.colorDialog, paper: this.props.classes.colorDialog }, onClose: () => {
|
|
@@ -335,30 +300,12 @@ class TreeTable extends react_1.Component {
|
|
|
335
300
|
}, open: this.state.showSelectColor },
|
|
336
301
|
react_1.default.createElement(react_colorful_1.HexColorPicker, { color: this.state.selectIdValue, onChange: color => this.setState({ selectIdValue: color }, () => this.selectCallback && this.selectCallback(color)) }));
|
|
337
302
|
}
|
|
338
|
-
renderCellEditColor(
|
|
303
|
+
renderCellEditColor(col, val) {
|
|
339
304
|
const _val = this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val;
|
|
340
305
|
return react_1.default.createElement("div", { className: this.props.classes.fieldEdit },
|
|
341
|
-
react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: _val, inputProps: { style: { backgroundColor: _val, color: Utils_1.default.isUseBright(_val) ? '#FFF' : '#000' } }, onChange: e =>
|
|
342
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
343
|
-
if (e.target.value === val) {
|
|
344
|
-
delete editData[col.field];
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
editData[col.field] = e.target.value;
|
|
348
|
-
}
|
|
349
|
-
this.setState({ editData });
|
|
350
|
-
} }),
|
|
306
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: _val, inputProps: { style: { backgroundColor: _val, color: Utils_1.default.isUseBright(_val) ? '#FFF' : '#000' } }, onChange: e => this.onChange(col, !!val, e.target.value) }),
|
|
351
307
|
react_1.default.createElement(material_1.IconButton, { className: this.props.classes.fieldButton, onClick: () => {
|
|
352
|
-
this.selectCallback = newColor =>
|
|
353
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
354
|
-
if (newColor === val) {
|
|
355
|
-
delete editData[col.field];
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
editData[col.field] = newColor;
|
|
359
|
-
}
|
|
360
|
-
this.setState({ editData });
|
|
361
|
-
};
|
|
308
|
+
this.selectCallback = newColor => this.onChange(col, val, newColor);
|
|
362
309
|
this.setState({ showSelectColor: true, selectIdValue: val });
|
|
363
310
|
}, size: "large" },
|
|
364
311
|
react_1.default.createElement(icons_material_1.Colorize, null)));
|
|
@@ -373,29 +320,11 @@ class TreeTable extends react_1.Component {
|
|
|
373
320
|
}
|
|
374
321
|
return null;
|
|
375
322
|
}
|
|
376
|
-
renderCellEditObjectID(
|
|
323
|
+
renderCellEditObjectID(col, val) {
|
|
377
324
|
return react_1.default.createElement("div", { className: this.props.classes.fieldEdit },
|
|
378
|
-
react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e =>
|
|
379
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
380
|
-
if (e.target.value === val) {
|
|
381
|
-
delete editData[col.field];
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
editData[col.field] = e.target.value;
|
|
385
|
-
}
|
|
386
|
-
this.setState({ editData });
|
|
387
|
-
} }),
|
|
325
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, className: this.props.classes.fieldEditWithButton, value: this.state.editData && this.state.editData[col.field] !== undefined ? this.state.editData[col.field] : val, onChange: e => this.onChange(col, val, e.target.value) }),
|
|
388
326
|
react_1.default.createElement(material_1.IconButton, { className: this.props.classes.fieldButton, onClick: () => {
|
|
389
|
-
this.selectCallback = selected =>
|
|
390
|
-
const editData = this.state.editData ? Object.assign({}, this.state.editData) : {};
|
|
391
|
-
if (selected === val) {
|
|
392
|
-
delete editData[col.field];
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
editData[col.field] = selected;
|
|
396
|
-
}
|
|
397
|
-
this.setState({ editData });
|
|
398
|
-
};
|
|
327
|
+
this.selectCallback = selected => this.onChange(col, val, selected);
|
|
399
328
|
this.setState({ showSelectId: true, selectIdValue: val });
|
|
400
329
|
}, size: "large" },
|
|
401
330
|
react_1.default.createElement(icons_material_1.ViewHeadline, null)));
|
package/Components/Utils.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2018-
|
|
2
|
+
* Copyright 2018-2024 Denis Haev <dogafox@gmail.com>
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
6
|
**/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { ThemeName, ThemeType } from
|
|
8
|
+
import { ThemeName, ThemeType } from '../types';
|
|
9
9
|
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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { AdminConnection } from '@iobroker/socket-client';
|
|
9
9
|
import Router from './Components/Router';
|
|
10
|
-
import { GenericAppProps, GenericAppState, GenericAppSettings, ThemeName, ThemeType,
|
|
10
|
+
import { GenericAppProps, GenericAppState, GenericAppSettings, ThemeName, ThemeType, IobTheme, Width } from './types';
|
|
11
11
|
declare global {
|
|
12
12
|
/** If config has been changed */
|
|
13
13
|
var changed: boolean;
|
|
@@ -69,15 +69,15 @@ declare class GenericApp<TProps extends GenericAppProps = GenericAppProps, TStat
|
|
|
69
69
|
* Get a theme
|
|
70
70
|
* @param name Theme name
|
|
71
71
|
*/
|
|
72
|
-
createTheme(name?: ThemeName | null | undefined):
|
|
72
|
+
createTheme(name?: ThemeName | null | undefined): IobTheme;
|
|
73
73
|
/**
|
|
74
74
|
* Get the theme name
|
|
75
75
|
*/
|
|
76
|
-
getThemeName(currentTheme:
|
|
76
|
+
getThemeName(currentTheme: IobTheme): ThemeName;
|
|
77
77
|
/**
|
|
78
78
|
* Get the theme type
|
|
79
79
|
*/
|
|
80
|
-
getThemeType(currentTheme:
|
|
80
|
+
getThemeType(currentTheme: IobTheme): ThemeType;
|
|
81
81
|
onThemeChanged(newThemeName: string): void;
|
|
82
82
|
onToggleExpertMode(expertMode: boolean): void;
|
|
83
83
|
/**
|
package/README.md
CHANGED
|
@@ -670,9 +670,13 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
|
|
|
670
670
|
-->
|
|
671
671
|
|
|
672
672
|
## Changelog
|
|
673
|
-
###
|
|
673
|
+
### 5.0.1 (2024-05-29)
|
|
674
|
+
* (bluefox) Added better typing
|
|
675
|
+
|
|
676
|
+
### 5.0.0 (2024-05-29)
|
|
674
677
|
* (bluefox) Types are now exported
|
|
675
678
|
* (bluefox) Translator renamed to Translate
|
|
679
|
+
* (bluefox) Breaking: Theme renamed to IobTheme because of the naming conflict
|
|
676
680
|
|
|
677
681
|
### 4.13.24 (2024-05-25)
|
|
678
682
|
* (bluefox) Updated packages
|
package/Theme.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IobTheme, type ThemeName } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* The theme creation factory function.
|
|
4
4
|
*/
|
|
5
|
-
declare const CustomTheme: (type: ThemeName) =>
|
|
5
|
+
declare const CustomTheme: (type: ThemeName) => IobTheme;
|
|
6
6
|
export default CustomTheme;
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface GenericAppState {
|
|
|
79
79
|
loaded: boolean;
|
|
80
80
|
themeType: ThemeType;
|
|
81
81
|
themeName: ThemeName;
|
|
82
|
-
theme:
|
|
82
|
+
theme: IobTheme;
|
|
83
83
|
expertMode: boolean;
|
|
84
84
|
selectedTab: string;
|
|
85
85
|
selectedTabNum: number | undefined;
|
|
@@ -123,7 +123,7 @@ interface Palette extends MuiPalette {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export interface
|
|
126
|
+
export interface IobTheme extends MuiTheme {
|
|
127
127
|
name: ThemeName;
|
|
128
128
|
palette: Palette;
|
|
129
129
|
toolbar: React.CSSProperties;
|