@iobroker/adapter-react-v5 3.1.34 → 3.2.0
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/404.js +0 -23
- package/Components/404.js.map +1 -1
- package/Components/ColorPicker.js +6 -37
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ComplexCron.js +10 -84
- package/Components/ComplexCron.js.map +1 -1
- package/Components/CustomModal.js +29 -54
- package/Components/CustomModal.js.map +1 -1
- package/Components/FileBrowser.js +15 -265
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +7 -68
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.d.ts +1 -1
- package/Components/Icon.js +2 -42
- package/Components/Icon.js.map +1 -1
- package/Components/IconPicker.js +6 -28
- package/Components/IconPicker.js.map +1 -1
- package/Components/IconSelector.js +3 -55
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +1 -38
- package/Components/Image.js.map +1 -1
- package/Components/JsonConfigComponent/ChipInput.js +66 -197
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -31
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +6 -39
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +6 -52
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +5 -39
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +4 -42
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -28
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigChip.js +4 -33
- package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.js +0 -34
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -33
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +14 -73
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +0 -46
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +7 -126
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -34
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js +15 -110
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +2 -35
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +4 -44
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +1 -59
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +7 -40
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +2 -42
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +2 -45
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +6 -40
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +7 -91
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -42
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -25
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -34
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +4 -34
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +11 -67
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +8 -91
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -55
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -28
- package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -21
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -24
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -23
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -31
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +13 -105
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +2 -35
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +0 -34
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -37
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -29
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +2 -40
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +5 -81
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/Loader.js +2 -20
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +2 -20
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +2 -21
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/Logo.js +6 -39
- package/Components/Logo.js.map +1 -1
- package/Components/MDUtils.js +3 -27
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +1 -1
- package/Components/ObjectBrowser.js +181 -788
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js +7 -31
- package/Components/Router.js.map +1 -1
- package/Components/SaveCloseButtons.js +2 -32
- package/Components/SaveCloseButtons.js.map +1 -1
- package/Components/Schedule.js +29 -251
- package/Components/Schedule.js.map +1 -1
- package/Components/SelectWithIcon.d.ts +1 -1
- package/Components/SelectWithIcon.js +0 -48
- package/Components/SelectWithIcon.js.map +1 -1
- package/Components/SimpleCron/cron2text.js +45 -91
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/cronText.js +0 -6
- package/Components/SimpleCron/cronText.js.map +1 -1
- package/Components/SimpleCron/index.js +19 -102
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/SimpleCron/jquery.cron.locale.js +44 -24
- package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
- package/Components/TabContainer.js +2 -23
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.js +2 -22
- package/Components/TabContent.js.map +1 -1
- package/Components/TabHeader.js +1 -17
- package/Components/TabHeader.js.map +1 -1
- package/Components/TableResize.js +6 -51
- package/Components/TableResize.js.map +1 -1
- package/Components/TextWithIcon.js +0 -20
- package/Components/TextWithIcon.js.map +1 -1
- package/Components/ToggleThemeMenu.js +5 -13
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/TreeTable.js +4 -121
- package/Components/TreeTable.js.map +1 -1
- package/Components/UploadImage.js +17 -60
- package/Components/UploadImage.js.map +1 -1
- package/Components/Utils.js +87 -263
- package/Components/Utils.js.map +1 -1
- package/Components/copy-to-clipboard.js +16 -38
- package/Components/copy-to-clipboard.js.map +1 -1
- package/Components/withWidth.js +2 -10
- package/Components/withWidth.js.map +1 -1
- package/Connection.d.ts +1 -0
- package/Connection.js +156 -527
- package/Connection.js.map +1 -1
- package/Dialogs/ComplexCron.js +0 -34
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.js +1 -39
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/Cron.js +1 -37
- package/Dialogs/Cron.js.map +1 -1
- package/Dialogs/Error.d.ts +1 -1
- package/Dialogs/Error.js +2 -29
- package/Dialogs/Error.js.map +1 -1
- package/Dialogs/FileSelect.js +2 -36
- package/Dialogs/FileSelect.js.map +1 -1
- package/Dialogs/Message.js +2 -27
- package/Dialogs/Message.js.map +1 -1
- package/Dialogs/SelectID.d.ts +1 -1
- package/Dialogs/SelectID.js +3 -40
- package/Dialogs/SelectID.js.map +1 -1
- package/Dialogs/SimpleCron.js +1 -33
- package/Dialogs/SimpleCron.js.map +1 -1
- package/Dialogs/TextInput.js +2 -34
- package/Dialogs/TextInput.js.map +1 -1
- package/GenericApp.js +55 -150
- package/GenericApp.js.map +1 -1
- package/Prompt.js +0 -2
- package/Prompt.js.map +1 -1
- package/README.md +11 -4
- package/Theme.js +7 -22
- package/Theme.js.map +1 -1
- package/i18n/uk.json +326 -0
- package/i18n.d.ts +2 -0
- package/i18n.js +9 -29
- package/i18n.js.map +1 -1
- package/icons/IconAdapter.d.ts +2 -2
- package/icons/IconAdapter.js +2 -6
- package/icons/IconAdapter.js.map +1 -1
- package/icons/IconAlias.d.ts +2 -2
- package/icons/IconAlias.js +2 -6
- package/icons/IconAlias.js.map +1 -1
- package/icons/IconChannel.d.ts +2 -2
- package/icons/IconChannel.js +2 -6
- package/icons/IconChannel.js.map +1 -1
- package/icons/IconClearFilter.d.ts +2 -2
- package/icons/IconClearFilter.js +0 -5
- package/icons/IconClearFilter.js.map +1 -1
- package/icons/IconClosed.d.ts +2 -2
- package/icons/IconClosed.js +0 -5
- package/icons/IconClosed.js.map +1 -1
- package/icons/IconCopy.d.ts +2 -2
- package/icons/IconCopy.js +0 -5
- package/icons/IconCopy.js.map +1 -1
- package/icons/IconDevice.d.ts +2 -2
- package/icons/IconDevice.js +0 -5
- package/icons/IconDevice.js.map +1 -1
- package/icons/IconDocument.d.ts +2 -2
- package/icons/IconDocument.js +0 -5
- package/icons/IconDocument.js.map +1 -1
- package/icons/IconDocumentReadOnly.d.ts +2 -2
- package/icons/IconDocumentReadOnly.js +0 -5
- package/icons/IconDocumentReadOnly.js.map +1 -1
- package/icons/IconExpert.d.ts +2 -2
- package/icons/IconExpert.js +0 -5
- package/icons/IconExpert.js.map +1 -1
- package/icons/IconFx.d.ts +2 -2
- package/icons/IconFx.js +0 -5
- package/icons/IconFx.js.map +1 -1
- package/icons/IconInstance.d.ts +2 -2
- package/icons/IconInstance.js +0 -5
- package/icons/IconInstance.js.map +1 -1
- package/icons/IconLogout.d.ts +2 -2
- package/icons/IconLogout.js +0 -5
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconNoIcon.d.ts +2 -2
- package/icons/IconNoIcon.js +0 -5
- package/icons/IconNoIcon.js.map +1 -1
- package/icons/IconOpen.d.ts +2 -2
- package/icons/IconOpen.js +0 -5
- package/icons/IconOpen.js.map +1 -1
- package/icons/IconState.d.ts +2 -2
- package/icons/IconState.js +0 -6
- package/icons/IconState.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,75 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
14
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
-
|
|
24
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
16
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
17
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
-
|
|
32
19
|
var _react = _interopRequireWildcard(require("react"));
|
|
33
|
-
|
|
34
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
21
|
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
37
|
-
|
|
38
22
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
39
|
-
|
|
40
23
|
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
41
|
-
|
|
42
24
|
var _Warning = _interopRequireDefault(require("@mui/icons-material/Warning"));
|
|
43
|
-
|
|
44
25
|
var _Error = _interopRequireDefault(require("@mui/icons-material/Error"));
|
|
45
|
-
|
|
46
26
|
var _i18n = _interopRequireDefault(require("../../i18n"));
|
|
47
|
-
|
|
48
27
|
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
49
|
-
|
|
50
28
|
var _Confirm = _interopRequireDefault(require("../../Dialogs/Confirm"));
|
|
51
|
-
|
|
52
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
|
-
|
|
54
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
-
|
|
56
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
57
|
-
|
|
58
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
|
-
|
|
60
33
|
var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
61
34
|
(0, _inherits2["default"])(ConfigGeneric, _Component);
|
|
62
|
-
|
|
63
35
|
var _super = _createSuper(ConfigGeneric);
|
|
64
|
-
|
|
65
36
|
function ConfigGeneric(props) {
|
|
66
37
|
var _this;
|
|
67
|
-
|
|
68
38
|
(0, _classCallCheck2["default"])(this, ConfigGeneric);
|
|
69
39
|
_this = _super.call(this, props);
|
|
70
40
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onUpdate", function (data) {
|
|
71
41
|
var value = ConfigGeneric.getValue(data || _this.props.data, _this.props.attr) || '';
|
|
72
|
-
|
|
73
42
|
if (_this.state.value !== value) {
|
|
74
43
|
_this.setState({
|
|
75
44
|
value: value
|
|
@@ -85,7 +54,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
85
54
|
confirmData: null
|
|
86
55
|
};
|
|
87
56
|
_this.isError = {};
|
|
88
|
-
|
|
89
57
|
if (_this.props.schema) {
|
|
90
58
|
if (_this.props.custom) {
|
|
91
59
|
_this.defaultValue = _this.props.schema.defaultFunc ? _this.executeCustom(_this.props.schema.defaultFunc, _this.props.schema["default"], _this.props.data, _this.props.instanceObj, _this.props.arrayIndex, _this.props.globalData) : _this.props.schema["default"];
|
|
@@ -93,32 +61,27 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
93
61
|
_this.defaultValue = _this.props.schema.defaultFunc ? _this.execute(_this.props.schema.defaultFunc, _this.props.schema["default"], _this.props.data, _this.props.arrayIndex, _this.props.globalData) : _this.props.schema["default"];
|
|
94
62
|
}
|
|
95
63
|
}
|
|
96
|
-
|
|
97
64
|
_this.lang = _i18n["default"].getLanguage();
|
|
98
65
|
return _this;
|
|
99
66
|
}
|
|
100
|
-
|
|
101
67
|
(0, _createClass2["default"])(ConfigGeneric, [{
|
|
102
68
|
key: "componentDidMount",
|
|
103
69
|
value: function componentDidMount() {
|
|
104
70
|
var _this2 = this;
|
|
105
|
-
|
|
106
71
|
this.props.registerOnForceUpdate && this.props.registerOnForceUpdate(this.props.attr, this.onUpdate);
|
|
107
|
-
var LIKE_SELECT = ['select', 'autocomplete', 'autocompleteSendTo'];
|
|
108
|
-
|
|
72
|
+
var LIKE_SELECT = ['select', 'autocomplete', 'autocompleteSendTo'];
|
|
73
|
+
// init default value
|
|
109
74
|
if (this.defaultValue !== undefined) {
|
|
110
75
|
var value = ConfigGeneric.getValue(this.props.data, this.props.attr);
|
|
111
|
-
|
|
112
76
|
if (value === undefined || LIKE_SELECT.includes(this.props.schema.type) && (value === '' || value === null)) {
|
|
113
77
|
setTimeout(function () {
|
|
114
78
|
if (_this2.props.custom) {
|
|
115
79
|
_this2.props.onChange(_this2.props.attr, _this2.defaultValue, function () {
|
|
116
80
|
return _this2.props.forceUpdate([_this2.props.attr], _this2.props.data);
|
|
117
|
-
});
|
|
118
|
-
|
|
81
|
+
});
|
|
82
|
+
//this.onChange(this.props.attr, this.defaultValue);
|
|
119
83
|
} else {
|
|
120
84
|
ConfigGeneric.setValue(_this2.props.data, _this2.props.attr, _this2.defaultValue);
|
|
121
|
-
|
|
122
85
|
_this2.props.onChange(_this2.props.data, undefined, function () {
|
|
123
86
|
return _this2.props.forceUpdate([_this2.props.attr], _this2.props.data);
|
|
124
87
|
});
|
|
@@ -133,14 +96,11 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
133
96
|
key: "sendTo",
|
|
134
97
|
value: function sendTo() {
|
|
135
98
|
var _this3 = this;
|
|
136
|
-
|
|
137
99
|
if (this.props.alive) {
|
|
138
100
|
this.defaultSendToDone = true;
|
|
139
101
|
var data = this.props.schema.data;
|
|
140
|
-
|
|
141
102
|
if (data === undefined && this.props.schema.jsonData) {
|
|
142
103
|
data = this.getPattern(this.props.schema.jsonData);
|
|
143
|
-
|
|
144
104
|
try {
|
|
145
105
|
data = JSON.parse(data);
|
|
146
106
|
} catch (e) {
|
|
@@ -152,21 +112,18 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
152
112
|
value: ConfigGeneric.getValue(this.props.data, this.props.attr)
|
|
153
113
|
};
|
|
154
114
|
}
|
|
155
|
-
|
|
156
115
|
if (data === undefined) {
|
|
157
116
|
data = null;
|
|
158
117
|
}
|
|
159
|
-
|
|
160
118
|
this.props.socket.sendTo("".concat(this.props.adapterName, ".").concat(this.props.instance), this.props.schema.defaultSendTo, data).then(function (value) {
|
|
161
119
|
if (value !== null && value !== undefined) {
|
|
162
120
|
if (_this3.props.custom) {
|
|
163
121
|
_this3.props.onChange(_this3.props.attr, value, function () {
|
|
164
122
|
return _this3.props.forceUpdate([_this3.props.attr], _this3.props.data);
|
|
165
|
-
});
|
|
166
|
-
|
|
123
|
+
});
|
|
124
|
+
//this.onChange(this.props.attr, this.defaultValue);
|
|
167
125
|
} else {
|
|
168
126
|
ConfigGeneric.setValue(_this3.props.data, _this3.props.attr, value);
|
|
169
|
-
|
|
170
127
|
_this3.props.onChange(_this3.props.data, undefined, function () {
|
|
171
128
|
return _this3.props.forceUpdate([_this3.props.attr], _this3.props.data);
|
|
172
129
|
});
|
|
@@ -174,8 +131,8 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
174
131
|
}
|
|
175
132
|
});
|
|
176
133
|
} else {
|
|
177
|
-
this.defaultSendToDone = false;
|
|
178
|
-
|
|
134
|
+
this.defaultSendToDone = false;
|
|
135
|
+
// show error, that instance does not started
|
|
179
136
|
this.onError(this.props.attr, _i18n["default"].t('ra_Instance %s is not alive', this.props.instance));
|
|
180
137
|
}
|
|
181
138
|
}
|
|
@@ -183,7 +140,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
183
140
|
key: "componentWillUnmount",
|
|
184
141
|
value: function componentWillUnmount() {
|
|
185
142
|
this.props.registerOnForceUpdate && this.props.registerOnForceUpdate(this.props.attr);
|
|
186
|
-
|
|
187
143
|
if (this.sendToTimeout) {
|
|
188
144
|
clearTimeout(this.sendToTimeout);
|
|
189
145
|
this.sendToTimeout = null;
|
|
@@ -195,10 +151,8 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
195
151
|
if (!text) {
|
|
196
152
|
return '';
|
|
197
153
|
}
|
|
198
|
-
|
|
199
154
|
if (typeof text === 'string') {
|
|
200
155
|
text = noTranslation ? text : _i18n["default"].t(text);
|
|
201
|
-
|
|
202
156
|
if (text.includes('${')) {
|
|
203
157
|
return this.getPattern(text);
|
|
204
158
|
} else {
|
|
@@ -221,14 +175,11 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
221
175
|
key: "renderConfirmDialog",
|
|
222
176
|
value: function renderConfirmDialog() {
|
|
223
177
|
var _this4 = this;
|
|
224
|
-
|
|
225
178
|
if (!this.state.confirmDialog) {
|
|
226
179
|
return null;
|
|
227
180
|
}
|
|
228
|
-
|
|
229
181
|
var confirm = this.state.confirmData || this.props.schema.confirm;
|
|
230
182
|
var icon = null;
|
|
231
|
-
|
|
232
183
|
if (confirm.type === 'warning') {
|
|
233
184
|
icon = /*#__PURE__*/_react["default"].createElement(_Warning["default"], null);
|
|
234
185
|
} else if (confirm.type === 'error') {
|
|
@@ -236,7 +187,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
236
187
|
} else if (confirm.type === 'info') {
|
|
237
188
|
icon = /*#__PURE__*/_react["default"].createElement(_Info["default"], null);
|
|
238
189
|
}
|
|
239
|
-
|
|
240
190
|
return /*#__PURE__*/_react["default"].createElement(_Confirm["default"], {
|
|
241
191
|
title: this.getText(confirm.title) || _i18n["default"].t('ra_Please confirm'),
|
|
242
192
|
text: this.getText(confirm.text),
|
|
@@ -249,13 +199,10 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
249
199
|
}, function () {
|
|
250
200
|
if (isOk) {
|
|
251
201
|
var data = JSON.parse(JSON.stringify(_this4.props.data));
|
|
252
|
-
|
|
253
202
|
if (_this4.state.confirmDepAttr) {
|
|
254
203
|
ConfigGeneric.setValue(data, _this4.state.confirmDepAttr, _this4.state.confirmDepNewValue);
|
|
255
204
|
}
|
|
256
|
-
|
|
257
205
|
ConfigGeneric.setValue(data, _this4.state.confirmAttr, _this4.state.confirmNewValue);
|
|
258
|
-
|
|
259
206
|
_this4.setState({
|
|
260
207
|
confirmDialog: false,
|
|
261
208
|
confirmDepAttr: null,
|
|
@@ -286,10 +233,8 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
286
233
|
key: "onChange",
|
|
287
234
|
value: function onChange(attr, newValue) {
|
|
288
235
|
var _this5 = this;
|
|
289
|
-
|
|
290
236
|
var data = JSON.parse(JSON.stringify(this.props.data));
|
|
291
237
|
ConfigGeneric.setValue(data, attr, newValue);
|
|
292
|
-
|
|
293
238
|
if (this.props.schema.confirm && this.execute(this.props.schema.confirm.condition, false, data, this.props.arrayIndex, this.props.globalData)) {
|
|
294
239
|
return this.setState({
|
|
295
240
|
confirmDialog: true,
|
|
@@ -302,10 +247,8 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
302
247
|
if (this.props.schema.confirmDependsOn) {
|
|
303
248
|
for (var z = 0; z < this.props.schema.confirmDependsOn.length; z++) {
|
|
304
249
|
var dep = this.props.schema.confirmDependsOn[z];
|
|
305
|
-
|
|
306
250
|
if (dep.confirm) {
|
|
307
251
|
var val = ConfigGeneric.getValue(data, dep.attr);
|
|
308
|
-
|
|
309
252
|
if (this.execute(dep.confirm.condition, false, data, this.props.arrayIndex, this.props.globalData)) {
|
|
310
253
|
return this.setState({
|
|
311
254
|
confirmDialog: true,
|
|
@@ -319,18 +262,13 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
319
262
|
}
|
|
320
263
|
}
|
|
321
264
|
}
|
|
322
|
-
|
|
323
265
|
var changed = [];
|
|
324
|
-
|
|
325
266
|
if (this.props.schema.onChangeDependsOn) {
|
|
326
267
|
for (var _z = 0; _z < this.props.schema.onChangeDependsOn.length; _z++) {
|
|
327
268
|
var _dep = this.props.schema.onChangeDependsOn[_z];
|
|
328
|
-
|
|
329
269
|
if (_dep.onChange) {
|
|
330
270
|
var _val = ConfigGeneric.getValue(data, _dep.attr);
|
|
331
|
-
|
|
332
271
|
var _newValue = this.props.custom ? this.executeCustom(_dep.onChange.calculateFunc, data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData) : this.execute(_dep.onChange.calculateFunc, _val, data, this.props.arrayIndex, this.props.globalData);
|
|
333
|
-
|
|
334
272
|
if (_newValue !== _val) {
|
|
335
273
|
ConfigGeneric.setValue(data, _dep.attr, _newValue);
|
|
336
274
|
changed.push(_dep.attr);
|
|
@@ -338,38 +276,31 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
338
276
|
}
|
|
339
277
|
}
|
|
340
278
|
}
|
|
341
|
-
|
|
342
279
|
if (this.props.schema.hiddenDependsOn) {
|
|
343
280
|
for (var _z2 = 0; _z2 < this.props.schema.hiddenDependsOn.length; _z2++) {
|
|
344
281
|
var _dep2 = this.props.schema.hiddenDependsOn[_z2];
|
|
345
282
|
_dep2.hidden && changed.push(_dep2.attr);
|
|
346
283
|
}
|
|
347
284
|
}
|
|
348
|
-
|
|
349
285
|
if (this.props.schema.labelDependsOn) {
|
|
350
286
|
for (var _z3 = 0; _z3 < this.props.schema.labelDependsOn.length; _z3++) {
|
|
351
287
|
var _dep3 = this.props.schema.labelDependsOn[_z3];
|
|
352
288
|
_dep3.hidden && changed.push(_dep3.attr);
|
|
353
289
|
}
|
|
354
290
|
}
|
|
355
|
-
|
|
356
291
|
if (this.props.schema.helpDependsOn) {
|
|
357
292
|
for (var _z4 = 0; _z4 < this.props.schema.helpDependsOn.length; _z4++) {
|
|
358
293
|
var _dep4 = this.props.schema.helpDependsOn[_z4];
|
|
359
294
|
_dep4.hidden && changed.push(_dep4.attr);
|
|
360
295
|
}
|
|
361
296
|
}
|
|
362
|
-
|
|
363
297
|
if (this.props.schema.onChange && !this.props.schema.onChange.ignoreOwnChanges) {
|
|
364
298
|
var _val2 = ConfigGeneric.getValue(data, this.props.attr);
|
|
365
|
-
|
|
366
299
|
var _newValue2 = this.props.custom ? this.executeCustom(this.props.schema.onChange.calculateFunc, data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData) : this.execute(this.props.schema.onChange.calculateFunc, _val2, data, this.props.arrayIndex, this.props.globalData);
|
|
367
|
-
|
|
368
300
|
if (_newValue2 !== _val2) {
|
|
369
301
|
ConfigGeneric.setValue(data, this.props.attr, _newValue2);
|
|
370
302
|
}
|
|
371
303
|
}
|
|
372
|
-
|
|
373
304
|
if (this.props.custom) {
|
|
374
305
|
this.props.onChange(attr, newValue);
|
|
375
306
|
changed && changed.length && changed.forEach(function (_attr, i) {
|
|
@@ -390,15 +321,14 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
390
321
|
if (func && (0, _typeof2["default"])(func) === 'object') {
|
|
391
322
|
func = func.func;
|
|
392
323
|
}
|
|
393
|
-
|
|
394
324
|
if (!func) {
|
|
395
325
|
return defaultValue;
|
|
396
326
|
} else {
|
|
397
327
|
try {
|
|
398
328
|
// eslint-disable-next-line no-new-func
|
|
399
329
|
var f = new Function('data', 'originalData', '_system', '_alive', '_common', '_socket', '_instance', 'arrayIndex', 'globalData', func.includes('return') ? func : 'return ' + func);
|
|
400
|
-
var result = f(data || this.props.data, this.props.originalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket, this.props.instance, arrayIndex, globalData);
|
|
401
|
-
|
|
330
|
+
var result = f(data || this.props.data, this.props.originalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket, this.props.instance, arrayIndex, globalData);
|
|
331
|
+
// console.log(result);
|
|
402
332
|
return result;
|
|
403
333
|
} catch (e) {
|
|
404
334
|
console.error("Cannot execute ".concat(func, ": ").concat(e));
|
|
@@ -412,7 +342,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
412
342
|
if (func && (0, _typeof2["default"])(func) === 'object') {
|
|
413
343
|
func = func.func;
|
|
414
344
|
}
|
|
415
|
-
|
|
416
345
|
if (!func) {
|
|
417
346
|
return null;
|
|
418
347
|
} else {
|
|
@@ -435,7 +364,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
435
364
|
var disabled;
|
|
436
365
|
var hidden;
|
|
437
366
|
var defaultValue;
|
|
438
|
-
|
|
439
367
|
if (this.props.custom) {
|
|
440
368
|
error = schema.validator ? !this.executeCustom(schema.validator, this.props.data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData) : false;
|
|
441
369
|
disabled = schema.disabled ? this.executeCustom(schema.disabled, this.props.data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData) : false;
|
|
@@ -447,7 +375,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
447
375
|
hidden = schema.hidden ? this.execute(schema.hidden, false, this.props.data, this.props.arrayIndex, this.props.globalData) : false;
|
|
448
376
|
defaultValue = schema.defaultFunc ? this.execute(schema.defaultFunc, schema["default"], this.props.data, this.props.arrayIndex, this.props.globalData) : schema["default"];
|
|
449
377
|
}
|
|
450
|
-
|
|
451
378
|
return {
|
|
452
379
|
error: error,
|
|
453
380
|
disabled: disabled,
|
|
@@ -463,7 +390,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
463
390
|
} else {
|
|
464
391
|
this.isError[attr] = error;
|
|
465
392
|
}
|
|
466
|
-
|
|
467
393
|
this.props.onError && this.props.onError(attr, error);
|
|
468
394
|
}
|
|
469
395
|
}, {
|
|
@@ -476,7 +402,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
476
402
|
value: function renderHelp(text, link, noTranslation) {
|
|
477
403
|
if (!link) {
|
|
478
404
|
text = this.getText(text, noTranslation) || '';
|
|
479
|
-
|
|
480
405
|
if (text && text.includes('<a ')) {
|
|
481
406
|
return _Utils["default"].renderTextWithA(text);
|
|
482
407
|
} else {
|
|
@@ -498,14 +423,12 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
498
423
|
key: "getPattern",
|
|
499
424
|
value: function getPattern(pattern, data) {
|
|
500
425
|
data = data || this.props.data;
|
|
501
|
-
|
|
502
426
|
if (!pattern) {
|
|
503
427
|
return '';
|
|
504
428
|
} else {
|
|
505
429
|
if ((0, _typeof2["default"])(pattern) === 'object') {
|
|
506
430
|
pattern = pattern.func;
|
|
507
431
|
}
|
|
508
|
-
|
|
509
432
|
try {
|
|
510
433
|
if (this.props.custom) {
|
|
511
434
|
// eslint-disable-next-line no-new-func
|
|
@@ -514,7 +437,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
514
437
|
} else {
|
|
515
438
|
// eslint-disable-next-line no-new-func
|
|
516
439
|
var _f = new Function('data', 'originalData', 'arrayIndex', 'globalData', '_system', '_alive', '_common', '_socket', 'return `' + pattern.replace(/`/g, '\\`') + '`');
|
|
517
|
-
|
|
518
440
|
return _f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket);
|
|
519
441
|
}
|
|
520
442
|
} catch (e) {
|
|
@@ -527,27 +449,21 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
527
449
|
key: "render",
|
|
528
450
|
value: function render() {
|
|
529
451
|
var _this6 = this;
|
|
530
|
-
|
|
531
452
|
var schema = this.props.schema;
|
|
532
|
-
|
|
533
453
|
if (!schema) {
|
|
534
454
|
return null;
|
|
535
455
|
}
|
|
536
|
-
|
|
537
456
|
if (this.props.alive && this.defaultSendToDone === false) {
|
|
538
457
|
this.sendToTimeout = setTimeout(function () {
|
|
539
458
|
_this6.sendToTimeout = null;
|
|
540
|
-
|
|
541
459
|
_this6.sendTo();
|
|
542
460
|
}, 200);
|
|
543
461
|
}
|
|
544
|
-
|
|
545
462
|
var _this$calculate = this.calculate(schema),
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
463
|
+
error = _this$calculate.error,
|
|
464
|
+
disabled = _this$calculate.disabled,
|
|
465
|
+
hidden = _this$calculate.hidden,
|
|
466
|
+
defaultValue = _this$calculate.defaultValue;
|
|
551
467
|
if (hidden) {
|
|
552
468
|
// Remove all errors if element is hidden
|
|
553
469
|
if (Object.keys(this.isError).length) {
|
|
@@ -558,7 +474,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
558
474
|
}, 100, JSON.parse(JSON.stringify(this.isError)));
|
|
559
475
|
this.isError = {};
|
|
560
476
|
}
|
|
561
|
-
|
|
562
477
|
if (schema.hideOnlyControl) {
|
|
563
478
|
var item = /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
564
479
|
item: true,
|
|
@@ -568,12 +483,9 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
568
483
|
sm: schema.sm || undefined,
|
|
569
484
|
style: Object.assign({}, {
|
|
570
485
|
marginBottom: 0,
|
|
571
|
-
|
|
572
|
-
/*marginRight: 8, */
|
|
573
|
-
textAlign: 'left'
|
|
486
|
+
/*marginRight: 8, */textAlign: 'left'
|
|
574
487
|
}, schema.style, this.props.themeType === 'dark' ? schema.darkStyle : {})
|
|
575
488
|
});
|
|
576
|
-
|
|
577
489
|
if (schema.newLine) {
|
|
578
490
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
579
491
|
style: {
|
|
@@ -606,9 +518,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
606
518
|
this.isError = {};
|
|
607
519
|
}
|
|
608
520
|
}
|
|
609
|
-
|
|
610
521
|
var renderedItem = this.renderItem(error, disabled || this.props.commandRunning || this.props.disabled, defaultValue);
|
|
611
|
-
|
|
612
522
|
var _item = /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
613
523
|
item: true,
|
|
614
524
|
title: this.getText(schema.tooltip),
|
|
@@ -639,7 +549,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
639
549
|
},
|
|
640
550
|
title: this.props.schema.buttonTooltip ? this.getText(this.props.schema.buttonTooltip, this.props.schema.buttonTooltipNoTranslation) : _i18n["default"].t('ra_Request data by instance')
|
|
641
551
|
}, this.getText(this.props.schema.button)))) : renderedItem);
|
|
642
|
-
|
|
643
552
|
if (schema.newLine) {
|
|
644
553
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
645
554
|
style: {
|
|
@@ -666,7 +575,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
666
575
|
return data[attr[0]];
|
|
667
576
|
} else {
|
|
668
577
|
var part = attr.shift();
|
|
669
|
-
|
|
670
578
|
if ((0, _typeof2["default"])(data[part]) === 'object') {
|
|
671
579
|
return ConfigGeneric.getValue(data[part], attr);
|
|
672
580
|
} else {
|
|
@@ -689,11 +597,9 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
689
597
|
}
|
|
690
598
|
} else {
|
|
691
599
|
var part = attr.shift();
|
|
692
|
-
|
|
693
600
|
if (!data[part] || (0, _typeof2["default"])(data[part]) === 'object') {
|
|
694
601
|
data[part] = data[part] || {};
|
|
695
602
|
}
|
|
696
|
-
|
|
697
603
|
return ConfigGeneric.setValue(data[part], attr, value);
|
|
698
604
|
}
|
|
699
605
|
}
|
|
@@ -701,7 +607,6 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
701
607
|
}]);
|
|
702
608
|
return ConfigGeneric;
|
|
703
609
|
}(_react.Component);
|
|
704
|
-
|
|
705
610
|
(0, _defineProperty2["default"])(ConfigGeneric, "DIFFERENT_VALUE", '__different__');
|
|
706
611
|
(0, _defineProperty2["default"])(ConfigGeneric, "DIFFERENT_LABEL", 'ra___different__');
|
|
707
612
|
(0, _defineProperty2["default"])(ConfigGeneric, "NONE_VALUE", '');
|