@iobroker/adapter-react-v5 4.7.14 → 4.8.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.
Files changed (129) hide show
  1. package/Components/JsonConfigComponent/ConfigAccordion.d.ts +1 -1
  2. package/Components/JsonConfigComponent/ConfigAccordion.js +4 -6
  3. package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
  4. package/Components/JsonConfigComponent/ConfigAlive.d.ts +2 -2
  5. package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +36 -13
  6. package/Components/JsonConfigComponent/ConfigAutocomplete.js +66 -164
  7. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +16 -13
  8. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +119 -251
  9. package/Components/JsonConfigComponent/ConfigCRON.d.ts +2 -2
  10. package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +2 -2
  11. package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +2 -2
  12. package/Components/JsonConfigComponent/ConfigCertificates.d.ts +2 -2
  13. package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +14 -13
  14. package/Components/JsonConfigComponent/ConfigCheckbox.js +37 -79
  15. package/Components/JsonConfigComponent/ConfigChip.d.ts +2 -2
  16. package/Components/JsonConfigComponent/ConfigColor.d.ts +2 -2
  17. package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +2 -2
  18. package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +2 -2
  19. package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +6 -0
  20. package/Components/JsonConfigComponent/ConfigDeviceManager.js +18 -0
  21. package/Components/JsonConfigComponent/ConfigFile.d.ts +2 -2
  22. package/Components/JsonConfigComponent/ConfigFile.js +2 -2
  23. package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
  24. package/Components/JsonConfigComponent/ConfigFileSelector.js +8 -5
  25. package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
  26. package/Components/JsonConfigComponent/ConfigFunc.d.ts +2 -2
  27. package/Components/JsonConfigComponent/ConfigGeneric.d.ts +12 -4
  28. package/Components/JsonConfigComponent/ConfigGeneric.js +11 -2
  29. package/Components/JsonConfigComponent/ConfigIP.d.ts +2 -2
  30. package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +2 -2
  31. package/Components/JsonConfigComponent/ConfigImageUpload.js +38 -44
  32. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
  33. package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +2 -2
  34. package/Components/JsonConfigComponent/ConfigInterface.d.ts +2 -2
  35. package/Components/JsonConfigComponent/ConfigInterface.js +1 -1
  36. package/Components/JsonConfigComponent/ConfigInterface.js.map +1 -1
  37. package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +2 -2
  38. package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -1
  39. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
  40. package/Components/JsonConfigComponent/ConfigLanguage.d.ts +6 -13
  41. package/Components/JsonConfigComponent/ConfigLanguage.js +105 -154
  42. package/Components/JsonConfigComponent/ConfigLicense.d.ts +1 -1
  43. package/Components/JsonConfigComponent/ConfigNumber.d.ts +1 -1
  44. package/Components/JsonConfigComponent/ConfigObjectId.d.ts +2 -2
  45. package/Components/JsonConfigComponent/ConfigPanel.js +8 -1
  46. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
  47. package/Components/JsonConfigComponent/ConfigPassword.d.ts +2 -2
  48. package/Components/JsonConfigComponent/ConfigPattern.d.ts +2 -2
  49. package/Components/JsonConfigComponent/ConfigRoom.d.ts +2 -2
  50. package/Components/JsonConfigComponent/ConfigSelect.d.ts +2 -2
  51. package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +2 -2
  52. package/Components/JsonConfigComponent/ConfigSendto.d.ts +23 -17
  53. package/Components/JsonConfigComponent/ConfigSendto.js +259 -399
  54. package/Components/JsonConfigComponent/ConfigSetState.d.ts +2 -2
  55. package/Components/JsonConfigComponent/ConfigSlider.d.ts +2 -2
  56. package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +2 -2
  57. package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +2 -2
  58. package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +2 -2
  59. package/Components/JsonConfigComponent/ConfigStaticText.d.ts +2 -2
  60. package/Components/JsonConfigComponent/ConfigText.d.ts +2 -2
  61. package/Components/JsonConfigComponent/ConfigText.js +18 -0
  62. package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
  63. package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +2 -2
  64. package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +2 -2
  65. package/Components/JsonConfigComponent/ConfigTopic.d.ts +2 -2
  66. package/Components/JsonConfigComponent/ConfigUUID.d.ts +2 -2
  67. package/Components/JsonConfigComponent/ConfigUser.d.ts +2 -2
  68. package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +63 -0
  69. package/Components/JsonConfigComponent/DeviceManager/Communication.js +268 -0
  70. package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +11 -0
  71. package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +15 -0
  72. package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +53 -0
  73. package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +340 -0
  74. package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +45 -0
  75. package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +146 -0
  76. package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +12 -0
  77. package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +69 -0
  78. package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +51 -0
  79. package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +216 -0
  80. package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +13 -0
  81. package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +111 -0
  82. package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +7 -0
  83. package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +16 -0
  84. package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +11 -0
  85. package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +94 -0
  86. package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +10 -0
  87. package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +22 -0
  88. package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +12 -0
  89. package/Components/JsonConfigComponent/DeviceManager/Utils.js +158 -0
  90. package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +21 -0
  91. package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +21 -0
  92. package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +21 -0
  93. package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +21 -0
  94. package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +26 -0
  95. package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +21 -0
  96. package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +21 -0
  97. package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +21 -0
  98. package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +21 -0
  99. package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +21 -0
  100. package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +21 -0
  101. package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +21 -0
  102. package/Components/JsonConfigComponent/DeviceManager/index.d.ts +2 -0
  103. package/Components/JsonConfigComponent/DeviceManager/index.js +10 -0
  104. package/Components/JsonConfigComponent/DeviceManager/index.js.map +1 -0
  105. package/Components/JsonConfigComponent/index.js +2 -7
  106. package/Components/JsonConfigComponent/index.js.map +1 -1
  107. package/Components/TextWithIcon.d.ts +1 -1
  108. package/Components/Utils.js +1 -1
  109. package/Components/Utils.js.map +1 -1
  110. package/Dialogs/ComplexCron.js +15 -17
  111. package/Dialogs/ComplexCron.js.map +1 -1
  112. package/Dialogs/Confirm.d.ts +20 -44
  113. package/Dialogs/Confirm.js +102 -158
  114. package/Dialogs/Error.d.ts +20 -39
  115. package/Dialogs/Error.js +50 -76
  116. package/Dialogs/Message.d.ts +22 -32
  117. package/Dialogs/Message.js +51 -83
  118. package/LegacyConnection.d.ts +3 -3
  119. package/README.md +9 -6
  120. package/i18n.d.ts +6 -6
  121. package/package.json +6 -5
  122. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +0 -1
  123. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +0 -1
  124. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +0 -1
  125. package/Components/JsonConfigComponent/ConfigLanguage.js.map +0 -1
  126. package/Components/JsonConfigComponent/ConfigSendto.js.map +0 -1
  127. package/Dialogs/Confirm.js.map +0 -1
  128. package/Dialogs/Error.js.map +0 -1
  129. package/Dialogs/Message.js.map +0 -1
@@ -1,263 +1,131 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
16
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
17
- var _react = _interopRequireDefault(require("react"));
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
- var _styles = require("@mui/styles");
20
- var _material = require("@mui/material");
21
- var _i18n = _interopRequireDefault(require("./wrapper/i18n"));
22
- var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
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); }; }
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; } }
25
- var styles = function styles() {
26
- return {
27
- fullWidth: {
28
- width: '100%'
29
- }
30
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
31
4
  };
32
- var ConfigAutocompleteSendTo = /*#__PURE__*/function (_ConfigGeneric) {
33
- (0, _inherits2["default"])(ConfigAutocompleteSendTo, _ConfigGeneric);
34
- var _super = _createSuper(ConfigAutocompleteSendTo);
35
- function ConfigAutocompleteSendTo() {
36
- (0, _classCallCheck2["default"])(this, ConfigAutocompleteSendTo);
37
- return _super.apply(this, arguments);
38
- }
39
- (0, _createClass2["default"])(ConfigAutocompleteSendTo, [{
40
- key: "componentDidMount",
41
- value: function componentDidMount() {
42
- (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigAutocompleteSendTo.prototype), "componentDidMount", this).call(this);
43
- this.askInstance();
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const styles_1 = require("@mui/styles");
8
+ const material_1 = require("@mui/material");
9
+ const i18n_1 = __importDefault(require("./wrapper/i18n"));
10
+ const ConfigGeneric_1 = __importDefault(require("./ConfigGeneric"));
11
+ const styles = () => ({
12
+ fullWidth: {
13
+ width: '100%',
14
+ },
15
+ });
16
+ class ConfigAutocompleteSendTo extends ConfigGeneric_1.default {
17
+ componentDidMount() {
18
+ super.componentDidMount();
19
+ this.askInstance();
44
20
  }
45
- }, {
46
- key: "askInstance",
47
- value: function askInstance() {
48
- var _this = this;
49
- var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
50
- var selectOptions = this.props.schema.options ? this.props.schema.options.map(function (item) {
51
- return typeof item === 'string' ? {
52
- label: item,
53
- value: item
54
- } : JSON.parse(JSON.stringify(item));
55
- }) : [];
56
- if (this.props.alive) {
57
- var data = this.props.schema.data;
58
- if (data === undefined && this.props.schema.jsonData) {
59
- data = this.getPattern(this.props.schema.jsonData);
60
- try {
61
- data = JSON.parse(data);
62
- } catch (e) {
63
- console.error("Cannot parse json data: ".concat(data));
64
- }
21
+ askInstance() {
22
+ const value = ConfigGeneric_1.default.getValue(this.props.data, this.props.attr);
23
+ const selectOptions = this.props.schema.options ?
24
+ this.props.schema.options.map((item) => (typeof item === 'string' ? { label: item, value: item } : JSON.parse(JSON.stringify(item))))
25
+ :
26
+ [];
27
+ if (this.props.alive) {
28
+ let data = this.props.schema.data;
29
+ if (data === undefined && this.props.schema.jsonData) {
30
+ data = this.getPattern(this.props.schema.jsonData);
31
+ try {
32
+ if (typeof data === 'string') {
33
+ data = JSON.parse(data);
34
+ }
35
+ }
36
+ catch (e) {
37
+ console.error(`Cannot parse json data: ${data}`);
38
+ }
39
+ }
40
+ if (data === undefined) {
41
+ data = null;
42
+ }
43
+ this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`, this.props.schema.command || 'send', data)
44
+ .then((list) => {
45
+ if (list && Array.isArray(list)) {
46
+ list.forEach(item => selectOptions.push(typeof item === 'string' ? { label: item, value: item } : JSON.parse(JSON.stringify(item))));
47
+ }
48
+ // if __different
49
+ if (Array.isArray(value)) {
50
+ selectOptions.unshift({ label: i18n_1.default.t(ConfigGeneric_1.default.DIFFERENT_LABEL), value: ConfigGeneric_1.default.DIFFERENT_VALUE });
51
+ this.setState({ value: ConfigGeneric_1.default.DIFFERENT_VALUE, selectOptions, context: this.getContext() });
52
+ }
53
+ else {
54
+ this.setState({ value, selectOptions, context: this.getContext() });
55
+ }
56
+ });
65
57
  }
66
- if (data === undefined) {
67
- data = null;
58
+ else if (Array.isArray(value)) {
59
+ // if __different
60
+ selectOptions.unshift({ label: i18n_1.default.t(ConfigGeneric_1.default.DIFFERENT_LABEL), value: ConfigGeneric_1.default.DIFFERENT_VALUE });
61
+ this.setState({ value: ConfigGeneric_1.default.DIFFERENT_VALUE, selectOptions });
62
+ }
63
+ else {
64
+ this.setState({ value, selectOptions });
68
65
  }
69
- this.props.socket.sendTo("".concat(this.props.adapterName, ".").concat(this.props.instance), this.props.schema.command || 'send', data).then(function (list) {
70
- if (list && Array.isArray(list)) {
71
- list.forEach(function (item) {
72
- return selectOptions.push(typeof item === 'string' ? {
73
- label: item,
74
- value: item
75
- } : JSON.parse(JSON.stringify(item)));
76
- });
77
- }
78
-
79
- // if __different
80
- if (Array.isArray(value)) {
81
- selectOptions.unshift({
82
- label: _i18n["default"].t(_ConfigGeneric2["default"].DIFFERENT_LABEL),
83
- value: _ConfigGeneric2["default"].DIFFERENT_VALUE
84
- });
85
- _this.setState({
86
- value: _ConfigGeneric2["default"].DIFFERENT_VALUE,
87
- selectOptions: selectOptions,
88
- context: _this.getContext()
89
- });
90
- } else {
91
- _this.setState({
92
- value: value,
93
- selectOptions: selectOptions,
94
- context: _this.getContext()
95
- });
96
- }
97
- });
98
- } else if (Array.isArray(value)) {
99
- // if __different
100
- selectOptions.unshift({
101
- label: _i18n["default"].t(_ConfigGeneric2["default"].DIFFERENT_LABEL),
102
- value: _ConfigGeneric2["default"].DIFFERENT_VALUE
103
- });
104
- this.setState({
105
- value: _ConfigGeneric2["default"].DIFFERENT_VALUE,
106
- selectOptions: selectOptions
107
- });
108
- } else {
109
- this.setState({
110
- value: value,
111
- selectOptions: selectOptions
112
- });
113
- }
114
66
  }
115
- }, {
116
- key: "getContext",
117
- value: function getContext() {
118
- var _this2 = this;
119
- var context = {};
120
- if (Array.isArray(this.props.schema.alsoDependsOn)) {
121
- this.props.schema.alsoDependsOn.forEach(function (attr) {
122
- return context[attr] = _ConfigGeneric2["default"].getValue(_this2.props.data, attr);
123
- });
124
- }
125
- return JSON.stringify(context);
67
+ getContext() {
68
+ const context = {};
69
+ if (Array.isArray(this.props.schema.alsoDependsOn)) {
70
+ this.props.schema.alsoDependsOn.forEach(attr => context[attr] = ConfigGeneric_1.default.getValue(this.props.data, attr));
71
+ }
72
+ return JSON.stringify(context);
126
73
  }
127
- }, {
128
- key: "renderItem",
129
- value: function renderItem(error, disabled /* , defaultValue */) {
130
- var _this3 = this;
131
- if (!this.state.selectOptions) {
132
- return null;
133
- }
134
- if (this.props.alive) {
135
- var context = this.getContext();
136
- if (context !== this.state.context) {
137
- setTimeout(function () {
138
- return _this3.askInstance();
139
- }, 300);
74
+ renderItem(error, disabled) {
75
+ if (!this.state.selectOptions) {
76
+ return null;
77
+ }
78
+ if (this.props.alive) {
79
+ const context = this.getContext();
80
+ if (context !== this.state.context) {
81
+ setTimeout(() => this.askInstance(), 300);
82
+ }
140
83
  }
141
- }
142
- var item;
143
- var options = JSON.parse(JSON.stringify(this.state.selectOptions));
144
- var isIndeterminate = Array.isArray(this.state.value) || this.state.value === _ConfigGeneric2["default"].DIFFERENT_LABEL;
145
- if (isIndeterminate) {
146
- (0, _toConsumableArray2["default"])(this.state.value).filter(function (val) {
147
- return !options.find(function (it) {
148
- return it.value === val;
149
- });
150
- }).forEach(function (it) {
151
- return options.push({
152
- label: it.toString(),
153
- value: it
154
- });
155
- });
156
- item = {
157
- label: _i18n["default"].t(_ConfigGeneric2["default"].DIFFERENT_LABEL),
158
- value: _ConfigGeneric2["default"].DIFFERENT_VALUE
159
- };
160
- options.unshift(item);
161
- } else {
162
- item = this.state.value !== null && this.state.value !== undefined &&
163
- // eslint-disable-next-line
164
- options.find(function (item) {
165
- return item.value == _this3.state.value;
166
- }); // let "==" be and not ===
167
-
168
- if (this.state.value !== null && this.state.value !== undefined && !item) {
169
- item = {
170
- value: this.state.value,
171
- label: this.state.value
172
- };
173
- options.push(item);
84
+ let item;
85
+ const options = JSON.parse(JSON.stringify(this.state.selectOptions));
86
+ const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric_1.default.DIFFERENT_LABEL;
87
+ if (isIndeterminate) {
88
+ [...this.state.value]
89
+ .filter(val => !options.find((it) => it.value === val))
90
+ .forEach(it => options.push({ label: it.toString(), value: it }));
91
+ item = { label: i18n_1.default.t(ConfigGeneric_1.default.DIFFERENT_LABEL), value: ConfigGeneric_1.default.DIFFERENT_VALUE };
92
+ options.unshift(item);
174
93
  }
175
- item = item || null;
176
- }
177
- if (!options.length) {
178
- return /*#__PURE__*/_react["default"].createElement(_material.TextField, {
179
- variant: "standard",
180
- fullWidth: true,
181
- value: this.state.value === null || this.state.value === undefined ? '' : this.state.value,
182
- error: !!error,
183
- disabled: !!disabled,
184
- inputProps: {
185
- maxLength: this.props.schema.maxLength || this.props.schema.max || undefined
186
- },
187
- onChange: function onChange(e) {
188
- var value = e.target.value;
189
- _this3.setState({
190
- value: value
191
- }, function () {
192
- return _this3.onChange(_this3.props.attr, (value || '').trim());
193
- });
194
- },
195
- placeholder: this.getText(this.props.schema.placeholder),
196
- label: this.getText(this.props.schema.label),
197
- helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)
198
- });
199
- }
200
- return /*#__PURE__*/_react["default"].createElement(_material.Autocomplete, {
201
- value: item,
202
- fullWidth: true,
203
- freeSolo: !!this.props.schema.freeSolo,
204
- options: options
205
- // autoComplete
206
- ,
207
- getOptionLabel: function getOptionLabel(option) {
208
- return option && option.label || '';
209
- },
210
- className: this.props.classes.indeterminate,
211
- onInputChange: function onInputChange(e) {
212
- if (e) {
213
- var val = e.target.value;
214
- if (val !== _this3.state.value) {
215
- _this3.setState({
216
- value: val
217
- }, function () {
218
- return _this3.onChange(_this3.props.attr, val);
219
- });
94
+ else {
95
+ item = this.state.value !== null && this.state.value !== undefined &&
96
+ // eslint-disable-next-line
97
+ options.find((item) => item.value == this.state.value); // let "==" be and not ===
98
+ if (this.state.value !== null && this.state.value !== undefined && !item && this.props.schema.freeSolo) {
99
+ item = { value: this.state.value, label: this.state.value };
100
+ options.push(item);
220
101
  }
221
- }
222
- },
223
- onChange: function onChange(_, value) {
224
- var val = (0, _typeof2["default"])(value) === 'object' ? value ? value.value : '' : value;
225
- if (val !== _this3.state.value) {
226
- _this3.setState({
227
- value: val
228
- }, function () {
229
- return _this3.onChange(_this3.props.attr, val);
230
- });
231
- }
232
- },
233
- renderInput: function renderInput(params) {
234
- return /*#__PURE__*/_react["default"].createElement(_material.TextField, (0, _extends2["default"])({
235
- variant: "standard"
236
- }, params, {
237
- // inputProps are important and will be given in params
238
- // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}
239
- error: !!error,
240
- placeholder: _this3.getText(_this3.props.schema.placeholder),
241
- label: _this3.getText(_this3.props.schema.label),
242
- helperText: _this3.renderHelp(_this3.props.schema.help, _this3.props.schema.helpLink, _this3.props.schema.noTranslation),
243
- disabled: !!disabled
244
- }));
102
+ item = item || null;
245
103
  }
246
- });
104
+ if (!options.length) {
105
+ return react_1.default.createElement(material_1.TextField, { variant: "standard", fullWidth: true, value: this.state.value === null || this.state.value === undefined ? '' : this.state.value, error: !!error, disabled: disabled, inputProps: { maxLength: this.props.schema.maxLength || this.props.schema.max || undefined }, onChange: e => {
106
+ const value = e.target.value;
107
+ this.setState({ value }, () => this.onChange(this.props.attr, (value || '').trim()));
108
+ }, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) });
109
+ }
110
+ return react_1.default.createElement(material_1.Autocomplete, { value: item, fullWidth: true, freeSolo: !!this.props.schema.freeSolo, options: options,
111
+ // autoComplete
112
+ getOptionLabel: option => { var _a; return (_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : ''; }, className: this.props.classes.indeterminate, onInputChange: e => {
113
+ if (!e || !this.props.schema.freeSolo) {
114
+ return;
115
+ }
116
+ const val = e.target.value;
117
+ if (val !== this.state.value) {
118
+ this.setState({ value: val }, () => this.onChange(this.props.attr, val));
119
+ }
120
+ }, onChange: (_, value) => {
121
+ const val = typeof value === 'object' ? (value ? value.value : '') : value;
122
+ if (val !== this.state.value) {
123
+ this.setState({ value: val }, () => this.onChange(this.props.attr, val));
124
+ }
125
+ }, renderInput: params => react_1.default.createElement(material_1.TextField, Object.assign({ variant: "standard" }, params, {
126
+ // inputProps are important and will be given in params
127
+ // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}
128
+ error: !!error, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation), disabled: disabled })) });
247
129
  }
248
- }]);
249
- return ConfigAutocompleteSendTo;
250
- }(_ConfigGeneric2["default"]);
251
- ConfigAutocompleteSendTo.propTypes = {
252
- socket: _propTypes["default"].object.isRequired,
253
- themeType: _propTypes["default"].string,
254
- themeName: _propTypes["default"].string,
255
- style: _propTypes["default"].object,
256
- className: _propTypes["default"].string,
257
- data: _propTypes["default"].object.isRequired,
258
- schema: _propTypes["default"].object,
259
- onError: _propTypes["default"].func,
260
- onChange: _propTypes["default"].func
261
- };
262
- var _default = exports["default"] = (0, _styles.withStyles)(styles)(ConfigAutocompleteSendTo);
263
- //# sourceMappingURL=ConfigAutocompleteSendTo.js.map
130
+ }
131
+ exports.default = (0, styles_1.withStyles)(styles)(ConfigAutocompleteSendTo);
@@ -1,4 +1,4 @@
1
- declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
2
2
  themeType: PropTypes.Requireable<string>;
3
3
  themeName: PropTypes.Requireable<string>;
4
4
  style: PropTypes.Requireable<object>;
@@ -9,7 +9,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
9
9
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
10
10
  dateFormat: PropTypes.Requireable<string>;
11
11
  isFloatComma: PropTypes.Requireable<boolean>;
12
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"flex" | "button" | "fullWidth"> & object>;
12
+ }>, "style" | "className" | "themeName" | "dateFormat" | "isFloatComma"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "flex" | "button"> & object>;
13
13
  export default _default;
14
14
  import PropTypes from 'prop-types';
15
15
  import React from 'react';
@@ -1,4 +1,4 @@
1
- declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
2
2
  socket: PropTypes.Validator<object>;
3
3
  themeType: PropTypes.Requireable<string>;
4
4
  themeName: PropTypes.Requireable<string>;
@@ -8,7 +8,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
8
8
  schema: PropTypes.Requireable<object>;
9
9
  onError: PropTypes.Requireable<(...args: any[]) => any>;
10
10
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
11
+ }>, "style" | "className" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
12
  export default _default;
13
13
  import PropTypes from 'prop-types';
14
14
  import React from 'react';
@@ -1,4 +1,4 @@
1
- declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
2
2
  socket: PropTypes.Validator<object>;
3
3
  themeType: PropTypes.Requireable<string>;
4
4
  themeName: PropTypes.Requireable<string>;
@@ -8,7 +8,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
8
8
  schema: PropTypes.Requireable<object>;
9
9
  onError: PropTypes.Requireable<(...args: any[]) => any>;
10
10
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
11
+ }>, "style" | "className" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
12
  export default _default;
13
13
  import PropTypes from 'prop-types';
14
14
  import React from 'react';
@@ -1,4 +1,4 @@
1
- declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
2
2
  socket: PropTypes.Validator<object>;
3
3
  themeType: PropTypes.Requireable<string>;
4
4
  themeName: PropTypes.Requireable<string>;
@@ -8,7 +8,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
8
8
  schema: PropTypes.Requireable<object>;
9
9
  onError: PropTypes.Requireable<(...args: any[]) => any>;
10
10
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "leWidth" | "certWidth"> & object>;
11
+ }>, "style" | "className" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "leWidth" | "certWidth"> & object>;
12
12
  export default _default;
13
13
  import PropTypes from 'prop-types';
14
14
  import React from 'react';
@@ -1,14 +1,15 @@
1
- declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
- socket: PropTypes.Validator<object>;
3
- themeType: PropTypes.Requireable<string>;
4
- themeName: PropTypes.Requireable<string>;
5
- style: PropTypes.Requireable<object>;
6
- className: PropTypes.Requireable<string>;
7
- data: PropTypes.Validator<object>;
8
- schema: PropTypes.Requireable<object>;
9
- onError: PropTypes.Requireable<(...args: any[]) => any>;
10
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"error"> & object>;
12
- export default _default;
13
- import PropTypes from 'prop-types';
14
1
  import React from 'react';
2
+ import type AdminConnection from './wrapper/AdminConnection';
3
+ import { ConfigGenericProps } from './ConfigGeneric';
4
+ interface ConfigCheckboxProps extends ConfigGenericProps {
5
+ socket: AdminConnection;
6
+ themeType: string;
7
+ themeName: string;
8
+ style: Record<string, any>;
9
+ className: string;
10
+ data: Record<string, any>;
11
+ schema: Record<string, any>;
12
+ classes: Record<string, any>;
13
+ }
14
+ declare const _default: React.JSXElementConstructor<Omit<ConfigCheckboxProps, "classes"> & import("@mui/styles").StyledComponentProps<"error"> & object>;
15
+ export default _default;
@@ -1,82 +1,40 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _react = _interopRequireDefault(require("react"));
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
- var _styles = require("@mui/styles");
16
- var _material = require("@mui/material");
17
- var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
18
- var _i18n = _interopRequireDefault(require("./wrapper/i18n"));
19
- 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); }; }
20
- 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; } }
21
- var styles = function styles() {
22
- return {
23
- error: {
24
- color: 'red'
25
- }
26
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
- var ConfigCheckbox = /*#__PURE__*/function (_ConfigGeneric) {
29
- (0, _inherits2["default"])(ConfigCheckbox, _ConfigGeneric);
30
- var _super = _createSuper(ConfigCheckbox);
31
- function ConfigCheckbox() {
32
- (0, _classCallCheck2["default"])(this, ConfigCheckbox);
33
- return _super.apply(this, arguments);
34
- }
35
- (0, _createClass2["default"])(ConfigCheckbox, [{
36
- key: "renderItem",
37
- value: function renderItem(error, disabled) {
38
- var _this = this;
39
- var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
40
- var isIndeterminate = Array.isArray(value);
41
- return /*#__PURE__*/_react["default"].createElement(_material.FormControl, {
42
- className: this.props.classes.fullWidth,
43
- variant: "standard"
44
- }, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
45
- onClick: function onClick(e) {
46
- e.preventDefault();
47
- e.stopPropagation();
48
- _this.onChange(_this.props.attr, !value);
49
- },
50
- control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
51
- indeterminate: isIndeterminate,
52
- checked: !!value,
53
- onChange: function onChange(e) {
54
- if (isIndeterminate) {
55
- _this.onChange(_this.props.attr, true);
56
- } else {
57
- _this.onChange(_this.props.attr, e.target.checked);
58
- }
59
- },
60
- disabled: !!disabled
61
- }),
62
- label: this.getText(this.props.schema.label)
63
- }), /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, {
64
- className: this.props.classes.error
65
- }, error ? this.props.schema.validatorErrorText ? _i18n["default"].t(this.props.schema.validatorErrorText) : _i18n["default"].t('ra_Error') : null), this.props.schema.help ? /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const styles_1 = require("@mui/styles");
8
+ const material_1 = require("@mui/material");
9
+ const ConfigGeneric_1 = __importDefault(require("./ConfigGeneric"));
10
+ const i18n_1 = __importDefault(require("./wrapper/i18n"));
11
+ const styles = () => ({
12
+ error: {
13
+ color: 'red',
14
+ },
15
+ });
16
+ class ConfigCheckbox extends ConfigGeneric_1.default {
17
+ renderItem(error, disabled) {
18
+ const value = ConfigGeneric_1.default.getValue(this.props.data, this.props.attr);
19
+ const isIndeterminate = Array.isArray(value);
20
+ return react_1.default.createElement(material_1.FormControl, { className: this.props.classes.fullWidth, variant: "standard" },
21
+ react_1.default.createElement(material_1.FormControlLabel, { onClick: e => {
22
+ e.preventDefault();
23
+ e.stopPropagation();
24
+ if (!disabled) {
25
+ this.onChange(this.props.attr, !value);
26
+ }
27
+ }, control: react_1.default.createElement(material_1.Checkbox, { indeterminate: isIndeterminate, checked: !!value, onChange: e => {
28
+ if (isIndeterminate) {
29
+ this.onChange(this.props.attr, true);
30
+ }
31
+ else {
32
+ this.onChange(this.props.attr, e.target.checked);
33
+ }
34
+ }, disabled: disabled }), label: this.getText(this.props.schema.label) }),
35
+ react_1.default.createElement(material_1.FormHelperText, { className: this.props.classes.error }, error ? (this.props.schema.validatorErrorText ? i18n_1.default.t(this.props.schema.validatorErrorText) : i18n_1.default.t('ra_Error')) :
36
+ null),
37
+ this.props.schema.help ? react_1.default.createElement(material_1.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
66
38
  }
67
- }]);
68
- return ConfigCheckbox;
69
- }(_ConfigGeneric2["default"]);
70
- ConfigCheckbox.propTypes = {
71
- socket: _propTypes["default"].object.isRequired,
72
- themeType: _propTypes["default"].string,
73
- themeName: _propTypes["default"].string,
74
- style: _propTypes["default"].object,
75
- className: _propTypes["default"].string,
76
- data: _propTypes["default"].object.isRequired,
77
- schema: _propTypes["default"].object,
78
- onError: _propTypes["default"].func,
79
- onChange: _propTypes["default"].func
80
- };
81
- var _default = exports["default"] = (0, _styles.withStyles)(styles)(ConfigCheckbox);
82
- //# sourceMappingURL=ConfigCheckbox.js.map
39
+ }
40
+ exports.default = (0, styles_1.withStyles)(styles)(ConfigCheckbox);
@@ -1,4 +1,4 @@
1
- declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
2
2
  socket: PropTypes.Validator<object>;
3
3
  themeType: PropTypes.Requireable<string>;
4
4
  themeName: PropTypes.Requireable<string>;
@@ -8,7 +8,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
8
8
  schema: PropTypes.Requireable<object>;
9
9
  onError: PropTypes.Requireable<(...args: any[]) => any>;
10
10
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
11
+ }>, "style" | "className" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
12
  export default _default;
13
13
  import PropTypes from 'prop-types';
14
14
  import React from 'react';
@@ -1,6 +1,6 @@
1
1
  export default ConfigColor;
2
- declare class ConfigColor extends ConfigGeneric<any, any> {
3
- constructor(props: any);
2
+ declare class ConfigColor extends ConfigGeneric<import("./ConfigGeneric").ConfigGenericProps, import("./ConfigGeneric").ConfigGenericState> {
3
+ constructor(props: import("./ConfigGeneric").ConfigGenericProps);
4
4
  renderColorDialog(): React.JSX.Element;
5
5
  renderItem(error: any, disabled: any): React.JSX.Element;
6
6
  }