@iobroker/adapter-react-v5 3.1.34 → 3.1.35
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 +54 -150
- package/GenericApp.js.map +1 -1
- package/Prompt.js +0 -2
- package/Prompt.js.map +1 -1
- package/README.md +8 -4
- package/Theme.js +7 -22
- package/Theme.js.map +1 -1
- 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,48 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
14
|
var _react = _interopRequireDefault(require("react"));
|
|
23
|
-
|
|
24
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
16
|
var _styles = require("@mui/styles");
|
|
27
|
-
|
|
28
17
|
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
29
|
-
|
|
30
18
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
31
|
-
|
|
32
19
|
var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
|
|
33
|
-
|
|
34
20
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
35
|
-
|
|
36
21
|
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
37
|
-
|
|
38
22
|
var _i18n = _interopRequireDefault(require("../../i18n"));
|
|
39
|
-
|
|
40
23
|
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
41
|
-
|
|
42
24
|
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); }; }
|
|
43
|
-
|
|
44
25
|
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; } }
|
|
45
|
-
|
|
46
26
|
var styles = function styles(theme) {
|
|
47
27
|
return {
|
|
48
28
|
fullWidth: {
|
|
@@ -50,7 +30,6 @@ var styles = function styles(theme) {
|
|
|
50
30
|
}
|
|
51
31
|
};
|
|
52
32
|
};
|
|
53
|
-
|
|
54
33
|
var LANGUAGES = [{
|
|
55
34
|
value: 'en',
|
|
56
35
|
label: 'English'
|
|
@@ -82,33 +61,25 @@ var LANGUAGES = [{
|
|
|
82
61
|
value: 'zh-ch',
|
|
83
62
|
label: '简体中文'
|
|
84
63
|
}];
|
|
85
|
-
|
|
86
64
|
var ConfigLanguage = /*#__PURE__*/function (_ConfigGeneric) {
|
|
87
65
|
(0, _inherits2["default"])(ConfigLanguage, _ConfigGeneric);
|
|
88
|
-
|
|
89
66
|
var _super = _createSuper(ConfigLanguage);
|
|
90
|
-
|
|
91
67
|
function ConfigLanguage() {
|
|
92
68
|
(0, _classCallCheck2["default"])(this, ConfigLanguage);
|
|
93
69
|
return _super.apply(this, arguments);
|
|
94
70
|
}
|
|
95
|
-
|
|
96
71
|
(0, _createClass2["default"])(ConfigLanguage, [{
|
|
97
72
|
key: "componentDidMount",
|
|
98
73
|
value: function componentDidMount() {
|
|
99
74
|
(0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigLanguage.prototype), "componentDidMount", this).call(this);
|
|
100
|
-
|
|
101
75
|
var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
|
|
102
|
-
|
|
103
76
|
var languages = [].concat(LANGUAGES);
|
|
104
|
-
|
|
105
77
|
if (this.props.schema.system) {
|
|
106
78
|
languages.unshift({
|
|
107
79
|
value: '',
|
|
108
80
|
label: _i18n["default"].t('ra_System language')
|
|
109
81
|
});
|
|
110
82
|
}
|
|
111
|
-
|
|
112
83
|
this.setState({
|
|
113
84
|
value: this.props.schema.system ? value || '' : value || _i18n["default"].getLanguage(),
|
|
114
85
|
selectOptions: languages
|
|
@@ -118,13 +89,11 @@ var ConfigLanguage = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
118
89
|
key: "renderItem",
|
|
119
90
|
value: function renderItem(error, disabled, defaultValue) {
|
|
120
91
|
var _this$state$selectOpt,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
92
|
+
_this = this,
|
|
93
|
+
_this$state$selectOpt2;
|
|
124
94
|
if (!this.state.selectOptions) {
|
|
125
95
|
return null;
|
|
126
96
|
}
|
|
127
|
-
|
|
128
97
|
var item = (_this$state$selectOpt = this.state.selectOptions) === null || _this$state$selectOpt === void 0 ? void 0 : _this$state$selectOpt.find(function (item) {
|
|
129
98
|
return item.value === _this.state.value || !item.value && !_this.state.value;
|
|
130
99
|
});
|
|
@@ -141,30 +110,24 @@ var ConfigLanguage = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
141
110
|
},
|
|
142
111
|
onChange: function onChange(e) {
|
|
143
112
|
var value = e.target.value === '_' ? '' : e.target.value;
|
|
144
|
-
|
|
145
113
|
_this.setState({
|
|
146
114
|
value: value
|
|
147
115
|
}, function () {
|
|
148
116
|
_this.onChange(_this.props.attr, value);
|
|
149
|
-
|
|
150
117
|
if (_this.props.schema.changeGuiLanguage) {
|
|
151
118
|
if (value) {
|
|
152
119
|
if (value === _i18n["default"].getLanguage()) {
|
|
153
120
|
return;
|
|
154
121
|
}
|
|
155
|
-
|
|
156
122
|
_i18n["default"].setLanguage(value);
|
|
157
|
-
|
|
158
123
|
_this.props.changeLanguage && _this.props.changeLanguage();
|
|
159
124
|
} else {
|
|
160
125
|
_this.props.socket.getSystemConfig().then(function (systemConfig) {
|
|
161
126
|
if (systemConfig.common.language === _i18n["default"].getLanguage()) {
|
|
162
127
|
return;
|
|
163
128
|
}
|
|
164
|
-
|
|
165
129
|
if (systemConfig.common.language) {
|
|
166
130
|
_i18n["default"].setLanguage(systemConfig.common.language);
|
|
167
|
-
|
|
168
131
|
_this.props.changeLanguage && _this.props.changeLanguage();
|
|
169
132
|
}
|
|
170
133
|
});
|
|
@@ -182,7 +145,6 @@ var ConfigLanguage = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
182
145
|
}]);
|
|
183
146
|
return ConfigLanguage;
|
|
184
147
|
}(_ConfigGeneric2["default"]);
|
|
185
|
-
|
|
186
148
|
ConfigLanguage.propTypes = {
|
|
187
149
|
socket: _propTypes["default"].object.isRequired,
|
|
188
150
|
themeType: _propTypes["default"].string,
|
|
@@ -194,8 +156,6 @@ ConfigLanguage.propTypes = {
|
|
|
194
156
|
onError: _propTypes["default"].func,
|
|
195
157
|
onChange: _propTypes["default"].func
|
|
196
158
|
};
|
|
197
|
-
|
|
198
159
|
var _default = (0, _styles.withStyles)(styles)(ConfigLanguage);
|
|
199
|
-
|
|
200
160
|
exports["default"] = _default;
|
|
201
161
|
//# sourceMappingURL=ConfigLanguage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigLanguage.js","names":["styles","theme","fullWidth","width","LANGUAGES","value","label","ConfigLanguage","ConfigGeneric","getValue","props","data","attr","languages","schema","system","unshift","I18n","t","setState","getLanguage","selectOptions","error","disabled","defaultValue","state","item","find","classes","getText","val","noTranslation","e","target","onChange","changeGuiLanguage","setLanguage","changeLanguage","socket","getSystemConfig","then","systemConfig","common","language","map","help","renderHelp","helpLink","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigLanguage.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport InputLabel from '@mui/material/InputLabel';\nimport MenuItem from '@mui/material/MenuItem';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormControl from '@mui/material/FormControl';\nimport Select from '@mui/material/Select';\n\nimport I18n from '../../i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n fullWidth: {\n width: '100%'\n }\n});\n\nconst LANGUAGES =[\n {\n value: 'en',\n label: 'English'\n },\n {\n value: 'de',\n label: 'Deutsch'\n },\n {\n value: 'ru',\n label: 'русский'\n },\n {\n value: 'pt',\n label: 'Portugues'\n },\n {\n value: 'nl',\n label: 'Nederlands'\n },\n {\n value: 'fr',\n label: 'français'\n },\n {\n value: 'it',\n label: 'Italiano'\n },\n {\n value: 'es',\n label: 'Espanol'\n },\n {\n value: 'pl',\n label: 'Polski'\n },\n {\n value: 'zh-ch',\n label: '简体中文'\n }\n];\n\nclass ConfigLanguage extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const languages = [...LANGUAGES];\n if (this.props.schema.system) {\n languages.unshift({ value: '', label: I18n.t('ra_System language') });\n }\n\n this.setState({ value: this.props.schema.system ? (value || '') : (value || I18n.getLanguage()), selectOptions: languages });\n }\n\n renderItem(error, disabled, defaultValue) {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const item = this.state.selectOptions?.find(item => item.value === this.state.value || (!item.value && !this.state.value));\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n <InputLabel>{this.getText(this.props.schema.label)}</InputLabel>\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={this.state.value || '_'}\n renderValue={val => this.getText(item?.label, this.props.schema.noTranslation)}\n onChange={e => {\n const value = e.target.value === '_' ? '' : e.target.value;\n this.setState({ value }, () => {\n this.onChange(this.props.attr, value);\n if (this.props.schema.changeGuiLanguage) {\n if (value) {\n if (value === I18n.getLanguage()) {\n return;\n }\n I18n.setLanguage(value);\n this.props.changeLanguage && this.props.changeLanguage();\n } else {\n this.props.socket.getSystemConfig()\n .then(systemConfig => {\n if (systemConfig.common.language === I18n.getLanguage()) {\n return;\n }\n if (systemConfig.common.language) {\n I18n.setLanguage(systemConfig.common.language);\n this.props.changeLanguage && this.props.changeLanguage();\n }\n });\n }\n }\n });\n }}\n >\n {this.state.selectOptions?.map(item =>\n <MenuItem key={item.value} value={item.value}>{item.label}</MenuItem>)}\n </Select>\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigLanguage.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigLanguage);"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigLanguage.js","names":["styles","theme","fullWidth","width","LANGUAGES","value","label","ConfigLanguage","ConfigGeneric","getValue","props","data","attr","languages","schema","system","unshift","I18n","t","setState","getLanguage","selectOptions","error","disabled","defaultValue","state","item","find","classes","getText","val","noTranslation","e","target","onChange","changeGuiLanguage","setLanguage","changeLanguage","socket","getSystemConfig","then","systemConfig","common","language","map","help","renderHelp","helpLink","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigLanguage.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport InputLabel from '@mui/material/InputLabel';\nimport MenuItem from '@mui/material/MenuItem';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormControl from '@mui/material/FormControl';\nimport Select from '@mui/material/Select';\n\nimport I18n from '../../i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n fullWidth: {\n width: '100%'\n }\n});\n\nconst LANGUAGES =[\n {\n value: 'en',\n label: 'English'\n },\n {\n value: 'de',\n label: 'Deutsch'\n },\n {\n value: 'ru',\n label: 'русский'\n },\n {\n value: 'pt',\n label: 'Portugues'\n },\n {\n value: 'nl',\n label: 'Nederlands'\n },\n {\n value: 'fr',\n label: 'français'\n },\n {\n value: 'it',\n label: 'Italiano'\n },\n {\n value: 'es',\n label: 'Espanol'\n },\n {\n value: 'pl',\n label: 'Polski'\n },\n {\n value: 'zh-ch',\n label: '简体中文'\n }\n];\n\nclass ConfigLanguage extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const languages = [...LANGUAGES];\n if (this.props.schema.system) {\n languages.unshift({ value: '', label: I18n.t('ra_System language') });\n }\n\n this.setState({ value: this.props.schema.system ? (value || '') : (value || I18n.getLanguage()), selectOptions: languages });\n }\n\n renderItem(error, disabled, defaultValue) {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const item = this.state.selectOptions?.find(item => item.value === this.state.value || (!item.value && !this.state.value));\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n <InputLabel>{this.getText(this.props.schema.label)}</InputLabel>\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={this.state.value || '_'}\n renderValue={val => this.getText(item?.label, this.props.schema.noTranslation)}\n onChange={e => {\n const value = e.target.value === '_' ? '' : e.target.value;\n this.setState({ value }, () => {\n this.onChange(this.props.attr, value);\n if (this.props.schema.changeGuiLanguage) {\n if (value) {\n if (value === I18n.getLanguage()) {\n return;\n }\n I18n.setLanguage(value);\n this.props.changeLanguage && this.props.changeLanguage();\n } else {\n this.props.socket.getSystemConfig()\n .then(systemConfig => {\n if (systemConfig.common.language === I18n.getLanguage()) {\n return;\n }\n if (systemConfig.common.language) {\n I18n.setLanguage(systemConfig.common.language);\n this.props.changeLanguage && this.props.changeLanguage();\n }\n });\n }\n }\n });\n }}\n >\n {this.state.selectOptions?.map(item =>\n <MenuItem key={item.value} value={item.value}>{item.label}</MenuItem>)}\n </Select>\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigLanguage.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigLanguage);"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAA4C;AAAA;AAE5C,IAAMA,MAAM,GAAG,SAATA,MAAM,CAAGC,KAAK;EAAA,OAAK;IACrBC,SAAS,EAAE;MACPC,KAAK,EAAE;IACX;EACJ,CAAC;AAAA,CAAC;AAEF,IAAMC,SAAS,GAAE,CACb;EACIC,KAAK,EAAE,IAAI;EACXC,KAAK,EAAE;AACX,CAAC,EACD;EACID,KAAK,EAAE,IAAI;EACXC,KAAK,EAAE;AACX,CAAC,EACD;EACID,KAAK,EAAE,IAAI;EACXC,KAAK,EAAE;AACX,CAAC,EACD;EACID,KAAK,EAAE,IAAI;EACXC,KAAK,EAAE;AACX,CAAC,EACD;EACID,KAAK,EAAE,IAAI;EACXC,KAAK,EAAE;AACX,CAAC,EACD;EACID,KAAK,EAAE,IAAI;EACXC,KAAK,EAAE;AACX,CAAC,EACD;EACID,KAAK,EAAE,IA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,CAACI,MAAM;EAC3BC,SAAS,EAAEL,qBAAS,CAACI,MAAM;EAC3BE,KAAK,EAAEN,qBAAS,CAACC,MAAM;EACvBM,SAAS,EAAEP,qBAAS,CAACI,MAAM;EAC3B1C,IAAI,EAAEsC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjCrC,MAAM,EAAEmC,qBAAS,CAACC,MAAM;EACxBO,OAAO,EAAER,qBAAS,CAACS,IAAI;EACvBxB,QAAQ,EAAEe,qBAAS,CAACS;AACxB,CAAC;AAAC,eAEa,IAAAC,kBAAU,EAAC3D,MAAM,CAAC,CAACO,cAAc,CAAC;AAAA"}
|
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
19
|
-
|
|
20
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
16
|
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
18
|
var _styles = require("@mui/styles");
|
|
31
|
-
|
|
32
19
|
var _material = require("@mui/material");
|
|
33
|
-
|
|
34
20
|
var _i18n = _interopRequireDefault(require("../../i18n"));
|
|
35
|
-
|
|
36
21
|
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
37
|
-
|
|
38
22
|
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
39
|
-
|
|
40
23
|
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); }; }
|
|
41
|
-
|
|
42
24
|
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; } }
|
|
43
|
-
|
|
44
25
|
var styles = function styles() {
|
|
45
26
|
return {
|
|
46
27
|
indeterminate: {
|
|
@@ -69,45 +50,36 @@ var styles = function styles() {
|
|
|
69
50
|
}
|
|
70
51
|
};
|
|
71
52
|
};
|
|
72
|
-
|
|
73
53
|
var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
74
54
|
(0, _inherits2["default"])(ConfigNumber, _ConfigGeneric);
|
|
75
|
-
|
|
76
55
|
var _super = _createSuper(ConfigNumber);
|
|
77
|
-
|
|
78
56
|
function ConfigNumber() {
|
|
79
57
|
(0, _classCallCheck2["default"])(this, ConfigNumber);
|
|
80
58
|
return _super.apply(this, arguments);
|
|
81
59
|
}
|
|
82
|
-
|
|
83
60
|
(0, _createClass2["default"])(ConfigNumber, [{
|
|
84
61
|
key: "componentDidMount",
|
|
85
62
|
value: function componentDidMount() {
|
|
86
63
|
(0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigNumber.prototype), "componentDidMount", this).call(this);
|
|
87
|
-
|
|
88
64
|
var _value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
|
|
89
|
-
|
|
90
65
|
if (_value === null || _value === undefined) {
|
|
91
66
|
_value = '';
|
|
92
67
|
}
|
|
93
|
-
|
|
94
68
|
this.setState({
|
|
95
69
|
_value: _value.toString(),
|
|
96
70
|
oldValue: _value.toString()
|
|
97
|
-
});
|
|
71
|
+
});
|
|
72
|
+
// this.props.registerOnForceUpdate(this.props.attr, this.onUpdate);
|
|
98
73
|
}
|
|
99
74
|
}, {
|
|
100
75
|
key: "renderItem",
|
|
101
76
|
value: function renderItem(error, disabled, defaultValue) {
|
|
102
77
|
var _this = this;
|
|
103
|
-
|
|
104
78
|
var isIndeterminate = Array.isArray(this.state.value) || this.state.value === _ConfigGeneric2["default"].DIFFERENT_VALUE;
|
|
105
|
-
|
|
106
79
|
if (this.state.oldValue !== null && this.state.oldValue !== undefined) {
|
|
107
80
|
this.updateTimeout && clearTimeout(this.updateTimeout);
|
|
108
81
|
this.updateTimeout = setTimeout(function () {
|
|
109
82
|
_this.updateTimeout = null;
|
|
110
|
-
|
|
111
83
|
_this.setState({
|
|
112
84
|
oldValue: null
|
|
113
85
|
});
|
|
@@ -116,7 +88,6 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
116
88
|
clearTimeout(this.updateTimeout);
|
|
117
89
|
this.updateTimeout = null;
|
|
118
90
|
}
|
|
119
|
-
|
|
120
91
|
if (isIndeterminate) {
|
|
121
92
|
var arr = (0, _toConsumableArray2["default"])(this.state.value).map(function (item) {
|
|
122
93
|
return {
|
|
@@ -159,18 +130,14 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
159
130
|
if (this.props.schema.min !== undefined && this.state._value < this.props.schema.min) {
|
|
160
131
|
error = _i18n["default"].t('ra_Too small');
|
|
161
132
|
}
|
|
162
|
-
|
|
163
133
|
if (this.props.schema.max !== undefined && this.state._value > this.props.schema.max) {
|
|
164
134
|
error = _i18n["default"].t('ra_Too big');
|
|
165
135
|
}
|
|
166
136
|
}
|
|
167
|
-
|
|
168
137
|
var type = 'number';
|
|
169
|
-
|
|
170
138
|
if (this.props.schema.min !== undefined && this.props.schema.min < 0 || this.props.schema.max !== undefined && this.props.schema.max < 0) {
|
|
171
139
|
type = 'text';
|
|
172
140
|
}
|
|
173
|
-
|
|
174
141
|
var isNumber = this.state._value !== null && this.state._value !== undefined && (typeof this.state._value === 'number' || typeof this.state._value === 'string' && this.state._value.trim() === parseFloat(this.state._value).toString());
|
|
175
142
|
return /*#__PURE__*/_react["default"].createElement(_material.FormControl, {
|
|
176
143
|
variant: "standard",
|
|
@@ -190,7 +157,6 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
190
157
|
className: _Utils["default"].clsx(type === 'text' && isNumber && this.props.classes.textWithArrows),
|
|
191
158
|
onChange: function onChange(e) {
|
|
192
159
|
var _value = e.target.value;
|
|
193
|
-
|
|
194
160
|
if (isFinite(_value)) {
|
|
195
161
|
if (_this.props.schema.min !== undefined && parseFloat(_value) < _this.props.schema.min) {
|
|
196
162
|
_this.onError(_this.props.attr, _i18n["default"].t('ra_Too small'));
|
|
@@ -200,13 +166,11 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
200
166
|
_this.onError(_this.props.attr, _i18n["default"].t('ra_Not a number'));
|
|
201
167
|
} else {
|
|
202
168
|
_this.onError(_this.props.attr); // clear error
|
|
203
|
-
|
|
204
169
|
}
|
|
205
170
|
} else if (_value !== '') {
|
|
206
171
|
_this.onError(_this.props.attr, _i18n["default"].t('ra_Not a number'));
|
|
207
172
|
} else {
|
|
208
173
|
_this.onError(_this.props.attr); // clear error
|
|
209
|
-
|
|
210
174
|
}
|
|
211
175
|
|
|
212
176
|
if (_this.state._value !== _value) {
|
|
@@ -229,7 +193,6 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
229
193
|
className: this.props.classes.arrowUp,
|
|
230
194
|
onClick: function onClick() {
|
|
231
195
|
var _value = parseFloat(_this.state._value) + 1;
|
|
232
|
-
|
|
233
196
|
if (_this.props.schema.max !== undefined && _value <= _this.props.schema.max) {
|
|
234
197
|
_this.setState({
|
|
235
198
|
_value: _value
|
|
@@ -240,7 +203,6 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
240
203
|
className: this.props.classes.arrowDown,
|
|
241
204
|
onClick: function onClick() {
|
|
242
205
|
var _value = parseFloat(_this.state._value) - 1;
|
|
243
|
-
|
|
244
206
|
if (_this.props.schema.min !== undefined && _value >= _this.props.schema.min) {
|
|
245
207
|
_this.setState({
|
|
246
208
|
_value: _value
|
|
@@ -256,9 +218,7 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
256
218
|
if (props.schema.min !== undefined && props.schema.min < 0 || props.schema.max !== undefined && props.schema.max < 0) {
|
|
257
219
|
return null;
|
|
258
220
|
}
|
|
259
|
-
|
|
260
221
|
var _value = _ConfigGeneric2["default"].getValue(props.data, props.attr);
|
|
261
|
-
|
|
262
222
|
if (_value === null || _value === undefined || state.oldValue === null || state.oldValue === undefined || _value.toString() !== parseFloat(state._value).toString() && _value.toString() !== state.oldValue.toString()) {
|
|
263
223
|
return {
|
|
264
224
|
_value: _value
|
|
@@ -270,7 +230,6 @@ var ConfigNumber = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
270
230
|
}]);
|
|
271
231
|
return ConfigNumber;
|
|
272
232
|
}(_ConfigGeneric2["default"]);
|
|
273
|
-
|
|
274
233
|
ConfigNumber.propTypes = {
|
|
275
234
|
socket: _propTypes["default"].object.isRequired,
|
|
276
235
|
themeType: _propTypes["default"].string,
|
|
@@ -282,8 +241,6 @@ ConfigNumber.propTypes = {
|
|
|
282
241
|
onError: _propTypes["default"].func,
|
|
283
242
|
onChange: _propTypes["default"].func
|
|
284
243
|
};
|
|
285
|
-
|
|
286
244
|
var _default = (0, _styles.withStyles)(styles)(ConfigNumber);
|
|
287
|
-
|
|
288
245
|
exports["default"] = _default;
|
|
289
246
|
//# sourceMappingURL=ConfigNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigNumber.js","names":["styles","indeterminate","opacity","control","flexDirection","width","textWithArrows","arrows","display","arrowUp","fontSize","userSelect","cursor","arrowDown","ConfigNumber","_value","ConfigGeneric","getValue","props","data","attr","undefined","setState","toString","oldValue","error","disabled","defaultValue","isIndeterminate","Array","isArray","state","value","DIFFERENT_VALUE","updateTimeout","clearTimeout","setTimeout","arr","map","item","label","unshift","I18n","t","DIFFERENT_LABEL","classes","option","_","onChange","parseFloat","schema","min","params","getText","placeholder","renderHelp","help","helpLink","noTranslation","max","type","isNumber","trim","step","Utils","clsx","e","target","isFinite","onError","isNaN","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","style","className","func","withStyles"],"sources":["JsonConfigComponent/ConfigNumber.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport { Autocomplete, TextField, FormControl } from '@mui/material';\n\nimport I18n from '../../i18n';\nimport Utils from '../Utils';\n\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n indeterminate: {\n opacity: 0.5\n },\n control: {\n flexDirection: 'row',\n width: '100%'\n },\n textWithArrows: {\n width: 'calc(100% - 12px)',\n },\n arrows: {\n width: 12,\n display: 'inline'\n },\n arrowUp: {\n fontSize: 10,\n userSelect: 'none',\n cursor: 'pointer',\n },\n arrowDown: {\n fontSize: 10,\n userSelect: 'none',\n cursor: 'pointer',\n }\n});\n\nclass ConfigNumber extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n let _value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (_value === null || _value === undefined) {\n _value = '';\n }\n this.setState({ _value: _value.toString(), oldValue: _value.toString() });\n // this.props.registerOnForceUpdate(this.props.attr, this.onUpdate);\n }\n\n static getDerivedStateFromProps(props, state) {\n if ((props.schema.min !== undefined && props.schema.min < 0) ||\n (props.schema.max !== undefined && props.schema.max < 0)\n ) {\n return null;\n }\n const _value = ConfigGeneric.getValue(props.data, props.attr);\n if (_value === null || _value === undefined ||\n state.oldValue === null || state.oldValue === undefined ||\n (_value.toString() !== parseFloat(state._value).toString() &&\n _value.toString() !== state.oldValue.toString())\n ) {\n return { _value };\n } else {\n return null;\n }\n }\n\n renderItem(error, disabled, defaultValue) {\n let isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.state.oldValue !== null && this.state.oldValue !== undefined) {\n this.updateTimeout && clearTimeout(this.updateTimeout);\n this.updateTimeout = setTimeout(() => {\n this.updateTimeout = null;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = null;\n }\n\n if (isIndeterminate) {\n const arr = [...this.state.value].map(item => ({ label: item.toString(), value: item }));\n arr.unshift({label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE});\n\n return <Autocomplete\n className={this.props.classes.indeterminate}\n fullWidth\n value={arr[0]}\n getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value) =>\n this.onChange(this.props.attr, value ? parseFloat(value.value) : this.props.schema.min || 0)}\n options={arr}\n getOptionLabel={option => option.label}\n renderInput={params => <TextField\n variant=\"standard\"\n {...params}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n disabled={!!disabled}\n />}\n />;\n } else {\n if (!error && this.state._value !== null && this.state._value !== undefined) {\n if (this.props.schema.min !== undefined && this.state._value < this.props.schema.min) {\n error = I18n.t('ra_Too small');\n }\n if (this.props.schema.max !== undefined && this.state._value > this.props.schema.max) {\n error = I18n.t('ra_Too big');\n }\n }\n\n let type = 'number';\n if ((this.props.schema.min !== undefined && this.props.schema.min < 0) ||\n (this.props.schema.max !== undefined && this.props.schema.max < 0)\n ) {\n type = 'text';\n }\n\n const isNumber = this.state._value !== null &&\n this.state._value !== undefined &&\n (typeof this.state._value === 'number' ||\n (typeof this.state._value === 'string' &&\n this.state._value.trim() === parseFloat(this.state._value).toString())\n );\n\n return <FormControl variant=\"standard\" className={this.props.classes.control}>\n <TextField\n variant=\"standard\"\n type={type}\n fullWidth\n inputProps={{ min: this.props.schema.min, max: this.props.schema.max, step: this.props.schema.step }}\n value={this.state._value === null || this.state._value === undefined ? '' : this.state._value}\n error={!!error}\n disabled={!!disabled}\n className={Utils.clsx(type === 'text' && isNumber && this.props.classes.textWithArrows)}\n onChange={e => {\n const _value = e.target.value;\n if (isFinite(_value)) {\n if (this.props.schema.min !== undefined && parseFloat(_value) < this.props.schema.min) {\n this.onError(this.props.attr, I18n.t('ra_Too small'));\n } else if (this.props.schema.max !== undefined && parseFloat(_value) > this.props.schema.max) {\n this.onError(this.props.attr, I18n.t('ra_Too big'));\n } else if (_value === '-' || isNaN(parseFloat(_value))) {\n this.onError(this.props.attr, I18n.t('ra_Not a number'));\n } else {\n this.onError(this.props.attr); // clear error\n }\n } else if (_value !== '') {\n this.onError(this.props.attr, I18n.t('ra_Not a number'));\n } else {\n this.onError(this.props.attr); // clear error\n }\n\n if (this.state._value !== _value) {\n this.setState({ _value, oldValue: this.state._value }, () => {\n if (_value.trim() === parseFloat(_value).toString()) {\n this.onChange(this.props.attr, parseFloat(_value) || 0);\n }\n });\n }\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={error && typeof error === 'string' ? error : this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n />\n {type === 'text' && isNumber ? <div className={this.props.classes.arrows}>\n <div\n className={this.props.classes.arrowUp}\n onClick={() => {\n let _value = parseFloat(this.state._value) + 1;\n if (this.props.schema.max !== undefined && _value <= this.props.schema.max) {\n this.setState({ _value });\n }\n }}\n >▲</div>\n <div\n className={this.props.classes.arrowDown}\n onClick={() => {\n let _value = parseFloat(this.state._value) - 1;\n if (this.props.schema.min !== undefined && _value >= this.props.schema.min) {\n this.setState({ _value });\n }\n }}\n >▼</div>\n </div> : null}\n </FormControl>;\n }\n }\n}\n\nConfigNumber.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigNumber);"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAGA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,OAAO;IAClBC,aAAa,EAAE;MACXC,OAAO,EAAE;IADE,CADG;IAIlBC,OAAO,EAAE;MACPC,aAAa,EAAE,KADR;MAELC,KAAK,EAAE;IAFF,CAJS;IAQlBC,cAAc,EAAE;MACZD,KAAK,EAAE;IADK,CARE;IAWlBE,MAAM,EAAE;MACJF,KAAK,EAAE,EADH;MAEJG,OAAO,EAAE;IAFL,CAXU;IAelBC,OAAO,EAAE;MACLC,QAAQ,EAAE,EADL;MAELC,UAAU,EAAE,MAFP;MAGLC,MAAM,EAAE;IAHH,CAfS;IAoBlBC,SAAS,EAAE;MACPH,QAAQ,EAAE,EADH;MAEPC,UAAU,EAAE,MAFL;MAGPC,MAAM,EAAE;IAHD;EApBO,CAAP;AAAA,CAAf;;IA2BME,Y;;;;;;;;;;;;WACF,6BAAoB;MAChB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Q,QAAP,OAAsB0B,UAAU,CAAClB,KAAK,CAAChB,MAAP,CAAV,CAAyBQ,QAAzB,EAAtB,IACAR,MAAM,CAACQ,QAAP,OAAsBQ,KAAK,CAACP,QAAN,CAAeD,QAAf,EAH3B,EAIE;QACE,OAAO;UAAER,MAAM,EAANA;QAAF,CAAP;MACH,CAND,MAMO;QACH,OAAO,IAAP;MACH;IACJ;;;EA3BsBC,0B;;AA2J3BF,YAAY,CAACyD,SAAb,GAAyB;EACrBC,MAAM,EAAEC,qBAAA,CAAUC,MAAV,CAAiBC,UADJ;EAErBC,SAAS,EAAEH,qBAAA,CAAUI,MAFA;EAGrBC,SAAS,EAAEL,qBAAA,CAAUI,MAHA;EAIrBE,KAAK,EAAEN,qBAAA,CAAUC,MAJI;EAKrBM,SAAS,EAAEP,qBAAA,CAAUI,MALA;EAMrB1D,IAAI,EAAEsD,qBAAA,CAAUC,MAAV,CAAiBC,UANF;EAOrBzB,MAAM,EAAEuB,qBAAA,CAAUC,MAPG;EAQrBL,OAAO,EAAEI,qBAAA,CAAUQ,IARE;EASrBjC,QAAQ,EAAEyB,qBAAA,CAAUQ;AATC,CAAzB;;eAYe,IAAAC,kBAAA,EAAWlF,MAAX,EAAmBc,YAAnB,C"}
|
|
1
|
+
{"version":3,"file":"ConfigNumber.js","names":["styles","indeterminate","opacity","control","flexDirection","width","textWithArrows","arrows","display","arrowUp","fontSize","userSelect","cursor","arrowDown","ConfigNumber","_value","ConfigGeneric","getValue","props","data","attr","undefined","setState","toString","oldValue","error","disabled","defaultValue","isIndeterminate","Array","isArray","state","value","DIFFERENT_VALUE","updateTimeout","clearTimeout","setTimeout","arr","map","item","label","unshift","I18n","t","DIFFERENT_LABEL","classes","option","_","onChange","parseFloat","schema","min","params","getText","placeholder","renderHelp","help","helpLink","noTranslation","max","type","isNumber","trim","step","Utils","clsx","e","target","isFinite","onError","isNaN","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","style","className","func","withStyles"],"sources":["JsonConfigComponent/ConfigNumber.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport { Autocomplete, TextField, FormControl } from '@mui/material';\n\nimport I18n from '../../i18n';\nimport Utils from '../Utils';\n\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n indeterminate: {\n opacity: 0.5\n },\n control: {\n flexDirection: 'row',\n width: '100%'\n },\n textWithArrows: {\n width: 'calc(100% - 12px)',\n },\n arrows: {\n width: 12,\n display: 'inline'\n },\n arrowUp: {\n fontSize: 10,\n userSelect: 'none',\n cursor: 'pointer',\n },\n arrowDown: {\n fontSize: 10,\n userSelect: 'none',\n cursor: 'pointer',\n }\n});\n\nclass ConfigNumber extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n let _value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (_value === null || _value === undefined) {\n _value = '';\n }\n this.setState({ _value: _value.toString(), oldValue: _value.toString() });\n // this.props.registerOnForceUpdate(this.props.attr, this.onUpdate);\n }\n\n static getDerivedStateFromProps(props, state) {\n if ((props.schema.min !== undefined && props.schema.min < 0) ||\n (props.schema.max !== undefined && props.schema.max < 0)\n ) {\n return null;\n }\n const _value = ConfigGeneric.getValue(props.data, props.attr);\n if (_value === null || _value === undefined ||\n state.oldValue === null || state.oldValue === undefined ||\n (_value.toString() !== parseFloat(state._value).toString() &&\n _value.toString() !== state.oldValue.toString())\n ) {\n return { _value };\n } else {\n return null;\n }\n }\n\n renderItem(error, disabled, defaultValue) {\n let isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_VALUE;\n\n if (this.state.oldValue !== null && this.state.oldValue !== undefined) {\n this.updateTimeout && clearTimeout(this.updateTimeout);\n this.updateTimeout = setTimeout(() => {\n this.updateTimeout = null;\n this.setState({ oldValue: null });\n }, 30);\n } else if (this.updateTimeout) {\n clearTimeout(this.updateTimeout);\n this.updateTimeout = null;\n }\n\n if (isIndeterminate) {\n const arr = [...this.state.value].map(item => ({ label: item.toString(), value: item }));\n arr.unshift({label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE});\n\n return <Autocomplete\n className={this.props.classes.indeterminate}\n fullWidth\n value={arr[0]}\n getOptionSelected={(option, value) => option.label === value.label}\n onChange={(_, value) =>\n this.onChange(this.props.attr, value ? parseFloat(value.value) : this.props.schema.min || 0)}\n options={arr}\n getOptionLabel={option => option.label}\n renderInput={params => <TextField\n variant=\"standard\"\n {...params}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n disabled={!!disabled}\n />}\n />;\n } else {\n if (!error && this.state._value !== null && this.state._value !== undefined) {\n if (this.props.schema.min !== undefined && this.state._value < this.props.schema.min) {\n error = I18n.t('ra_Too small');\n }\n if (this.props.schema.max !== undefined && this.state._value > this.props.schema.max) {\n error = I18n.t('ra_Too big');\n }\n }\n\n let type = 'number';\n if ((this.props.schema.min !== undefined && this.props.schema.min < 0) ||\n (this.props.schema.max !== undefined && this.props.schema.max < 0)\n ) {\n type = 'text';\n }\n\n const isNumber = this.state._value !== null &&\n this.state._value !== undefined &&\n (typeof this.state._value === 'number' ||\n (typeof this.state._value === 'string' &&\n this.state._value.trim() === parseFloat(this.state._value).toString())\n );\n\n return <FormControl variant=\"standard\" className={this.props.classes.control}>\n <TextField\n variant=\"standard\"\n type={type}\n fullWidth\n inputProps={{ min: this.props.schema.min, max: this.props.schema.max, step: this.props.schema.step }}\n value={this.state._value === null || this.state._value === undefined ? '' : this.state._value}\n error={!!error}\n disabled={!!disabled}\n className={Utils.clsx(type === 'text' && isNumber && this.props.classes.textWithArrows)}\n onChange={e => {\n const _value = e.target.value;\n if (isFinite(_value)) {\n if (this.props.schema.min !== undefined && parseFloat(_value) < this.props.schema.min) {\n this.onError(this.props.attr, I18n.t('ra_Too small'));\n } else if (this.props.schema.max !== undefined && parseFloat(_value) > this.props.schema.max) {\n this.onError(this.props.attr, I18n.t('ra_Too big'));\n } else if (_value === '-' || isNaN(parseFloat(_value))) {\n this.onError(this.props.attr, I18n.t('ra_Not a number'));\n } else {\n this.onError(this.props.attr); // clear error\n }\n } else if (_value !== '') {\n this.onError(this.props.attr, I18n.t('ra_Not a number'));\n } else {\n this.onError(this.props.attr); // clear error\n }\n\n if (this.state._value !== _value) {\n this.setState({ _value, oldValue: this.state._value }, () => {\n if (_value.trim() === parseFloat(_value).toString()) {\n this.onChange(this.props.attr, parseFloat(_value) || 0);\n }\n });\n }\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={error && typeof error === 'string' ? error : this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n />\n {type === 'text' && isNumber ? <div className={this.props.classes.arrows}>\n <div\n className={this.props.classes.arrowUp}\n onClick={() => {\n let _value = parseFloat(this.state._value) + 1;\n if (this.props.schema.max !== undefined && _value <= this.props.schema.max) {\n this.setState({ _value });\n }\n }}\n >▲</div>\n <div\n className={this.props.classes.arrowDown}\n onClick={() => {\n let _value = parseFloat(this.state._value) - 1;\n if (this.props.schema.min !== undefined && _value >= this.props.schema.min) {\n this.setState({ _value });\n }\n }}\n >▼</div>\n </div> : null}\n </FormControl>;\n }\n }\n}\n\nConfigNumber.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigNumber);"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA;AAEA;AACA;AAGA;AAA4C;AAAA;AAE5C,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,OAAU;IAClBC,aAAa,EAAE;MACXC,OAAO,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Y,CAAC;AAAA"}
|
|
@@ -1,48 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
19
|
-
|
|
20
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
16
|
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
18
|
var _styles = require("@mui/styles");
|
|
31
|
-
|
|
32
19
|
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
33
|
-
|
|
34
20
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
35
|
-
|
|
36
21
|
var _material = require("@mui/material");
|
|
37
|
-
|
|
38
22
|
var _SelectID = _interopRequireDefault(require("../../Dialogs/SelectID"));
|
|
39
|
-
|
|
40
23
|
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
41
|
-
|
|
42
24
|
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); }; }
|
|
43
|
-
|
|
44
25
|
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; } }
|
|
45
|
-
|
|
46
26
|
var styles = function styles(theme) {
|
|
47
27
|
return {
|
|
48
28
|
fullWidth: {
|
|
@@ -58,23 +38,18 @@ var styles = function styles(theme) {
|
|
|
58
38
|
}
|
|
59
39
|
};
|
|
60
40
|
};
|
|
61
|
-
|
|
62
41
|
var ConfigObjectId = /*#__PURE__*/function (_ConfigGeneric) {
|
|
63
42
|
(0, _inherits2["default"])(ConfigObjectId, _ConfigGeneric);
|
|
64
|
-
|
|
65
43
|
var _super = _createSuper(ConfigObjectId);
|
|
66
|
-
|
|
67
44
|
function ConfigObjectId() {
|
|
68
45
|
(0, _classCallCheck2["default"])(this, ConfigObjectId);
|
|
69
46
|
return _super.apply(this, arguments);
|
|
70
47
|
}
|
|
71
|
-
|
|
72
48
|
(0, _createClass2["default"])(ConfigObjectId, [{
|
|
73
49
|
key: "componentDidMount",
|
|
74
50
|
value: function () {
|
|
75
51
|
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
76
52
|
var _this$props, data, attr, value;
|
|
77
|
-
|
|
78
53
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
79
54
|
while (1) {
|
|
80
55
|
switch (_context.prev = _context.next) {
|
|
@@ -86,7 +61,6 @@ var ConfigObjectId = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
86
61
|
value: value,
|
|
87
62
|
initialized: true
|
|
88
63
|
});
|
|
89
|
-
|
|
90
64
|
case 4:
|
|
91
65
|
case "end":
|
|
92
66
|
return _context.stop();
|
|
@@ -94,30 +68,26 @@ var ConfigObjectId = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
94
68
|
}
|
|
95
69
|
}, _callee, this);
|
|
96
70
|
}));
|
|
97
|
-
|
|
98
71
|
function componentDidMount() {
|
|
99
72
|
return _componentDidMount.apply(this, arguments);
|
|
100
73
|
}
|
|
101
|
-
|
|
102
74
|
return componentDidMount;
|
|
103
75
|
}()
|
|
104
76
|
}, {
|
|
105
77
|
key: "renderItem",
|
|
106
78
|
value: function renderItem(error, disabled, defaultValue) {
|
|
107
79
|
var _this = this;
|
|
108
|
-
|
|
109
80
|
if (!this.state.initialized) {
|
|
110
81
|
return null;
|
|
111
82
|
}
|
|
112
|
-
|
|
113
83
|
var _this$props2 = this.props,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
84
|
+
classes = _this$props2.classes,
|
|
85
|
+
schema = _this$props2.schema,
|
|
86
|
+
socket = _this$props2.socket,
|
|
87
|
+
attr = _this$props2.attr;
|
|
118
88
|
var _this$state = this.state,
|
|
119
|
-
|
|
120
|
-
|
|
89
|
+
value = _this$state.value,
|
|
90
|
+
showSelectId = _this$state.showSelectId;
|
|
121
91
|
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
122
92
|
className: classes.fullWidth,
|
|
123
93
|
variant: "standard"
|
|
@@ -136,7 +106,6 @@ var ConfigObjectId = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
136
106
|
helperText: this.renderHelp(schema.help, schema.helpLink, schema.noTranslation),
|
|
137
107
|
onChange: function onChange(e) {
|
|
138
108
|
var value = e.target.value;
|
|
139
|
-
|
|
140
109
|
_this.setState({
|
|
141
110
|
value: value
|
|
142
111
|
}, function () {
|
|
@@ -180,7 +149,6 @@ var ConfigObjectId = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
180
149
|
}]);
|
|
181
150
|
return ConfigObjectId;
|
|
182
151
|
}(_ConfigGeneric2["default"]);
|
|
183
|
-
|
|
184
152
|
ConfigObjectId.propTypes = {
|
|
185
153
|
socket: _propTypes["default"].object.isRequired,
|
|
186
154
|
themeType: _propTypes["default"].string,
|
|
@@ -195,8 +163,6 @@ ConfigObjectId.propTypes = {
|
|
|
195
163
|
isFloatComma: _propTypes["default"].bool,
|
|
196
164
|
imagePrefix: _propTypes["default"].string
|
|
197
165
|
};
|
|
198
|
-
|
|
199
166
|
var _default = (0, _styles.withStyles)(styles)(ConfigObjectId);
|
|
200
|
-
|
|
201
167
|
exports["default"] = _default;
|
|
202
168
|
//# sourceMappingURL=ConfigObjectId.js.map
|