@iobroker/json-config 1.0.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 (221) hide show
  1. package/LICENSE +21 -0
  2. package/build/JsonConfig.d.ts +22 -0
  3. package/build/JsonConfig.js +535 -0
  4. package/build/JsonConfig.js.map +1 -0
  5. package/build/JsonConfigComponent/ChipInput.d.ts +12 -0
  6. package/build/JsonConfigComponent/ChipInput.js +595 -0
  7. package/build/JsonConfigComponent/ChipInput.js.map +1 -0
  8. package/build/JsonConfigComponent/ConfigAccordion.d.ts +15 -0
  9. package/build/JsonConfigComponent/ConfigAccordion.js +185 -0
  10. package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -0
  11. package/build/JsonConfigComponent/ConfigAlive.d.ts +10 -0
  12. package/build/JsonConfigComponent/ConfigAlive.js +63 -0
  13. package/build/JsonConfigComponent/ConfigAlive.js.map +1 -0
  14. package/build/JsonConfigComponent/ConfigAutocomplete.d.ts +37 -0
  15. package/build/JsonConfigComponent/ConfigAutocomplete.js +69 -0
  16. package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -0
  17. package/build/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +17 -0
  18. package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +127 -0
  19. package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -0
  20. package/build/JsonConfigComponent/ConfigCRON.d.ts +15 -0
  21. package/build/JsonConfigComponent/ConfigCRON.js +55 -0
  22. package/build/JsonConfigComponent/ConfigCRON.js.map +1 -0
  23. package/build/JsonConfigComponent/ConfigCertCollection.d.ts +14 -0
  24. package/build/JsonConfigComponent/ConfigCertCollection.js +50 -0
  25. package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -0
  26. package/build/JsonConfigComponent/ConfigCertificateSelect.d.ts +14 -0
  27. package/build/JsonConfigComponent/ConfigCertificateSelect.js +59 -0
  28. package/build/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -0
  29. package/build/JsonConfigComponent/ConfigCertificates.d.ts +14 -0
  30. package/build/JsonConfigComponent/ConfigCertificates.js +104 -0
  31. package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -0
  32. package/build/JsonConfigComponent/ConfigCheckLicense.d.ts +3 -0
  33. package/build/JsonConfigComponent/ConfigCheckLicense.js +546 -0
  34. package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -0
  35. package/build/JsonConfigComponent/ConfigCheckbox.d.ts +15 -0
  36. package/build/JsonConfigComponent/ConfigCheckbox.js +36 -0
  37. package/build/JsonConfigComponent/ConfigCheckbox.js.map +1 -0
  38. package/build/JsonConfigComponent/ConfigChip.d.ts +14 -0
  39. package/build/JsonConfigComponent/ConfigChip.js +67 -0
  40. package/build/JsonConfigComponent/ConfigChip.js.map +1 -0
  41. package/build/JsonConfigComponent/ConfigColor.d.ts +22 -0
  42. package/build/JsonConfigComponent/ConfigColor.js +57 -0
  43. package/build/JsonConfigComponent/ConfigColor.js.map +1 -0
  44. package/build/JsonConfigComponent/ConfigCoordinates.d.ts +14 -0
  45. package/build/JsonConfigComponent/ConfigCoordinates.js +146 -0
  46. package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -0
  47. package/build/JsonConfigComponent/ConfigCustom.d.ts +26 -0
  48. package/build/JsonConfigComponent/ConfigCustom.js +195 -0
  49. package/build/JsonConfigComponent/ConfigCustom.js.map +1 -0
  50. package/build/JsonConfigComponent/ConfigDatePicker.d.ts +14 -0
  51. package/build/JsonConfigComponent/ConfigDatePicker.js +39 -0
  52. package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -0
  53. package/build/JsonConfigComponent/ConfigDeviceManager.d.ts +6 -0
  54. package/build/JsonConfigComponent/ConfigDeviceManager.js +14 -0
  55. package/build/JsonConfigComponent/ConfigDeviceManager.js.map +1 -0
  56. package/build/JsonConfigComponent/ConfigFile.d.ts +15 -0
  57. package/build/JsonConfigComponent/ConfigFile.js +131 -0
  58. package/build/JsonConfigComponent/ConfigFile.js.map +1 -0
  59. package/build/JsonConfigComponent/ConfigFileSelector.d.ts +3 -0
  60. package/build/JsonConfigComponent/ConfigFileSelector.js +434 -0
  61. package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -0
  62. package/build/JsonConfigComponent/ConfigFunc.d.ts +14 -0
  63. package/build/JsonConfigComponent/ConfigFunc.js +56 -0
  64. package/build/JsonConfigComponent/ConfigFunc.js.map +1 -0
  65. package/build/JsonConfigComponent/ConfigGeneric.d.ts +95 -0
  66. package/build/JsonConfigComponent/ConfigGeneric.js +632 -0
  67. package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -0
  68. package/build/JsonConfigComponent/ConfigIP.d.ts +14 -0
  69. package/build/JsonConfigComponent/ConfigIP.js +64 -0
  70. package/build/JsonConfigComponent/ConfigIP.js.map +1 -0
  71. package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +10 -0
  72. package/build/JsonConfigComponent/ConfigImageSendTo.js +62 -0
  73. package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -0
  74. package/build/JsonConfigComponent/ConfigImageUpload.d.ts +14 -0
  75. package/build/JsonConfigComponent/ConfigImageUpload.js +91 -0
  76. package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -0
  77. package/build/JsonConfigComponent/ConfigInstanceSelect.d.ts +14 -0
  78. package/build/JsonConfigComponent/ConfigInstanceSelect.js +133 -0
  79. package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -0
  80. package/build/JsonConfigComponent/ConfigInterface.d.ts +14 -0
  81. package/build/JsonConfigComponent/ConfigInterface.js +74 -0
  82. package/build/JsonConfigComponent/ConfigInterface.js.map +1 -0
  83. package/build/JsonConfigComponent/ConfigJsonEditor.d.ts +13 -0
  84. package/build/JsonConfigComponent/ConfigJsonEditor.js +59 -0
  85. package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -0
  86. package/build/JsonConfigComponent/ConfigLanguage.d.ts +7 -0
  87. package/build/JsonConfigComponent/ConfigLanguage.js +105 -0
  88. package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -0
  89. package/build/JsonConfigComponent/ConfigLicense.d.ts +24 -0
  90. package/build/JsonConfigComponent/ConfigLicense.js +95 -0
  91. package/build/JsonConfigComponent/ConfigLicense.js.map +1 -0
  92. package/build/JsonConfigComponent/ConfigNumber.d.ts +17 -0
  93. package/build/JsonConfigComponent/ConfigNumber.js +114 -0
  94. package/build/JsonConfigComponent/ConfigNumber.js.map +1 -0
  95. package/build/JsonConfigComponent/ConfigObjectId.d.ts +17 -0
  96. package/build/JsonConfigComponent/ConfigObjectId.js +59 -0
  97. package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -0
  98. package/build/JsonConfigComponent/ConfigPanel.d.ts +3 -0
  99. package/build/JsonConfigComponent/ConfigPanel.js +271 -0
  100. package/build/JsonConfigComponent/ConfigPanel.js.map +1 -0
  101. package/build/JsonConfigComponent/ConfigPassword.d.ts +14 -0
  102. package/build/JsonConfigComponent/ConfigPassword.js +105 -0
  103. package/build/JsonConfigComponent/ConfigPassword.js.map +1 -0
  104. package/build/JsonConfigComponent/ConfigPattern.d.ts +21 -0
  105. package/build/JsonConfigComponent/ConfigPattern.js +32 -0
  106. package/build/JsonConfigComponent/ConfigPattern.js.map +1 -0
  107. package/build/JsonConfigComponent/ConfigPort.d.ts +3 -0
  108. package/build/JsonConfigComponent/ConfigPort.js +174 -0
  109. package/build/JsonConfigComponent/ConfigPort.js.map +1 -0
  110. package/build/JsonConfigComponent/ConfigRoom.d.ts +14 -0
  111. package/build/JsonConfigComponent/ConfigRoom.js +56 -0
  112. package/build/JsonConfigComponent/ConfigRoom.js.map +1 -0
  113. package/build/JsonConfigComponent/ConfigSelect.d.ts +14 -0
  114. package/build/JsonConfigComponent/ConfigSelect.js +90 -0
  115. package/build/JsonConfigComponent/ConfigSelect.js.map +1 -0
  116. package/build/JsonConfigComponent/ConfigSelectSendTo.d.ts +17 -0
  117. package/build/JsonConfigComponent/ConfigSelectSendTo.js +175 -0
  118. package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -0
  119. package/build/JsonConfigComponent/ConfigSendto.d.ts +24 -0
  120. package/build/JsonConfigComponent/ConfigSendto.js +290 -0
  121. package/build/JsonConfigComponent/ConfigSendto.js.map +1 -0
  122. package/build/JsonConfigComponent/ConfigSetState.d.ts +18 -0
  123. package/build/JsonConfigComponent/ConfigSetState.js +93 -0
  124. package/build/JsonConfigComponent/ConfigSetState.js.map +1 -0
  125. package/build/JsonConfigComponent/ConfigSlider.d.ts +14 -0
  126. package/build/JsonConfigComponent/ConfigSlider.js +62 -0
  127. package/build/JsonConfigComponent/ConfigSlider.js.map +1 -0
  128. package/build/JsonConfigComponent/ConfigStaticDivider.d.ts +14 -0
  129. package/build/JsonConfigComponent/ConfigStaticDivider.js +39 -0
  130. package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -0
  131. package/build/JsonConfigComponent/ConfigStaticHeader.d.ts +14 -0
  132. package/build/JsonConfigComponent/ConfigStaticHeader.js +45 -0
  133. package/build/JsonConfigComponent/ConfigStaticHeader.js.map +1 -0
  134. package/build/JsonConfigComponent/ConfigStaticImage.d.ts +14 -0
  135. package/build/JsonConfigComponent/ConfigStaticImage.js +36 -0
  136. package/build/JsonConfigComponent/ConfigStaticImage.js.map +1 -0
  137. package/build/JsonConfigComponent/ConfigStaticText.d.ts +14 -0
  138. package/build/JsonConfigComponent/ConfigStaticText.js +51 -0
  139. package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -0
  140. package/build/JsonConfigComponent/ConfigTable.d.ts +3 -0
  141. package/build/JsonConfigComponent/ConfigTable.js +670 -0
  142. package/build/JsonConfigComponent/ConfigTable.js.map +1 -0
  143. package/build/JsonConfigComponent/ConfigTabs.d.ts +34 -0
  144. package/build/JsonConfigComponent/ConfigTabs.js +90 -0
  145. package/build/JsonConfigComponent/ConfigTabs.js.map +1 -0
  146. package/build/JsonConfigComponent/ConfigText.d.ts +14 -0
  147. package/build/JsonConfigComponent/ConfigText.js +105 -0
  148. package/build/JsonConfigComponent/ConfigText.js.map +1 -0
  149. package/build/JsonConfigComponent/ConfigTextSendTo.d.ts +10 -0
  150. package/build/JsonConfigComponent/ConfigTextSendTo.js +76 -0
  151. package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -0
  152. package/build/JsonConfigComponent/ConfigTimePicker.d.ts +14 -0
  153. package/build/JsonConfigComponent/ConfigTimePicker.js +37 -0
  154. package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -0
  155. package/build/JsonConfigComponent/ConfigTopic.d.ts +17 -0
  156. package/build/JsonConfigComponent/ConfigTopic.js +61 -0
  157. package/build/JsonConfigComponent/ConfigTopic.js.map +1 -0
  158. package/build/JsonConfigComponent/ConfigUUID.d.ts +15 -0
  159. package/build/JsonConfigComponent/ConfigUUID.js +31 -0
  160. package/build/JsonConfigComponent/ConfigUUID.js.map +1 -0
  161. package/build/JsonConfigComponent/ConfigUser.d.ts +14 -0
  162. package/build/JsonConfigComponent/ConfigUser.js +70 -0
  163. package/build/JsonConfigComponent/ConfigUser.js.map +1 -0
  164. package/build/JsonConfigComponent/index.d.ts +26 -0
  165. package/build/JsonConfigComponent/index.js +312 -0
  166. package/build/JsonConfigComponent/index.js.map +1 -0
  167. package/build/JsonConfigComponent/wrapper/AdminConnection.d.ts +2 -0
  168. package/build/JsonConfigComponent/wrapper/AdminConnection.js +3 -0
  169. package/build/JsonConfigComponent/wrapper/AdminConnection.js.map +1 -0
  170. package/build/JsonConfigComponent/wrapper/Components/ColorPicker.d.ts +2 -0
  171. package/build/JsonConfigComponent/wrapper/Components/ColorPicker.js +3 -0
  172. package/build/JsonConfigComponent/wrapper/Components/ColorPicker.js.map +1 -0
  173. package/build/JsonConfigComponent/wrapper/Components/CustomModal.d.ts +3 -0
  174. package/build/JsonConfigComponent/wrapper/Components/CustomModal.js +87 -0
  175. package/build/JsonConfigComponent/wrapper/Components/CustomModal.js.map +1 -0
  176. package/build/JsonConfigComponent/wrapper/Components/Editor.d.ts +14 -0
  177. package/build/JsonConfigComponent/wrapper/Components/Editor.js +43 -0
  178. package/build/JsonConfigComponent/wrapper/Components/Editor.js.map +1 -0
  179. package/build/JsonConfigComponent/wrapper/Components/Icon.d.ts +2 -0
  180. package/build/JsonConfigComponent/wrapper/Components/Icon.js +3 -0
  181. package/build/JsonConfigComponent/wrapper/Components/Icon.js.map +1 -0
  182. package/build/JsonConfigComponent/wrapper/Components/TextWithIcon.d.ts +2 -0
  183. package/build/JsonConfigComponent/wrapper/Components/TextWithIcon.js +3 -0
  184. package/build/JsonConfigComponent/wrapper/Components/TextWithIcon.js.map +1 -0
  185. package/build/JsonConfigComponent/wrapper/Components/UploadImage.d.ts +2 -0
  186. package/build/JsonConfigComponent/wrapper/Components/UploadImage.js +3 -0
  187. package/build/JsonConfigComponent/wrapper/Components/UploadImage.js.map +1 -0
  188. package/build/JsonConfigComponent/wrapper/Components/Utils.d.ts +2 -0
  189. package/build/JsonConfigComponent/wrapper/Components/Utils.js +3 -0
  190. package/build/JsonConfigComponent/wrapper/Components/Utils.js.map +1 -0
  191. package/build/JsonConfigComponent/wrapper/Dialogs/Confirm.d.ts +2 -0
  192. package/build/JsonConfigComponent/wrapper/Dialogs/Confirm.js +3 -0
  193. package/build/JsonConfigComponent/wrapper/Dialogs/Confirm.js.map +1 -0
  194. package/build/JsonConfigComponent/wrapper/Dialogs/Cron.d.ts +2 -0
  195. package/build/JsonConfigComponent/wrapper/Dialogs/Cron.js +3 -0
  196. package/build/JsonConfigComponent/wrapper/Dialogs/Cron.js.map +1 -0
  197. package/build/JsonConfigComponent/wrapper/Dialogs/Error.d.ts +2 -0
  198. package/build/JsonConfigComponent/wrapper/Dialogs/Error.js +3 -0
  199. package/build/JsonConfigComponent/wrapper/Dialogs/Error.js.map +1 -0
  200. package/build/JsonConfigComponent/wrapper/Dialogs/Message.d.ts +2 -0
  201. package/build/JsonConfigComponent/wrapper/Dialogs/Message.js +3 -0
  202. package/build/JsonConfigComponent/wrapper/Dialogs/Message.js.map +1 -0
  203. package/build/JsonConfigComponent/wrapper/Dialogs/SelectFile.d.ts +2 -0
  204. package/build/JsonConfigComponent/wrapper/Dialogs/SelectFile.js +3 -0
  205. package/build/JsonConfigComponent/wrapper/Dialogs/SelectFile.js.map +1 -0
  206. package/build/JsonConfigComponent/wrapper/Dialogs/SelectID.d.ts +2 -0
  207. package/build/JsonConfigComponent/wrapper/Dialogs/SelectID.js +3 -0
  208. package/build/JsonConfigComponent/wrapper/Dialogs/SelectID.js.map +1 -0
  209. package/build/JsonConfigComponent/wrapper/i18n.d.ts +2 -0
  210. package/build/JsonConfigComponent/wrapper/i18n.js +3 -0
  211. package/build/JsonConfigComponent/wrapper/i18n.js.map +1 -0
  212. package/build/JsonConfigComponent/wrapper/icons/IconCopy.d.ts +2 -0
  213. package/build/JsonConfigComponent/wrapper/icons/IconCopy.js +3 -0
  214. package/build/JsonConfigComponent/wrapper/icons/IconCopy.js.map +1 -0
  215. package/build/Utils.d.ts +376 -0
  216. package/build/Utils.js +1595 -0
  217. package/build/Utils.js.map +1 -0
  218. package/build/index.d.ts +5 -0
  219. package/build/index.js +6 -0
  220. package/build/index.js.map +1 -0
  221. package/package.json +17 -0
@@ -0,0 +1,174 @@
1
+ import React from 'react';
2
+ import { withStyles } from '@mui/styles';
3
+ import { TextField } from '@mui/material';
4
+ import I18n from './wrapper/i18n';
5
+ import ConfigGeneric from './ConfigGeneric';
6
+ const styles = () => ({
7
+ indeterminate: {
8
+ opacity: 0.5,
9
+ },
10
+ control: {
11
+ flexDirection: 'row',
12
+ width: '100%',
13
+ },
14
+ warning: {
15
+ '& .Mui-error': {
16
+ color: 'orange',
17
+ },
18
+ },
19
+ });
20
+ class ConfigPort extends ConfigGeneric {
21
+ updateTimeout;
22
+ async componentDidMount() {
23
+ super.componentDidMount();
24
+ let _value = ConfigGeneric.getValue(this.props.data, this.props.attr);
25
+ if (_value === null || _value === undefined) {
26
+ _value = '';
27
+ }
28
+ this.setState({ _value: _value.toString(), oldValue: _value.toString() });
29
+ // read all instances
30
+ const instances = await this.props.socket.getAdapterInstances();
31
+ const ownId = `system.adapter.${this.props.adapterName}.${this.props.instance}`;
32
+ const instanceObj = await this.props.socket.getObject(ownId);
33
+ const ownHostname = instanceObj?.common.host;
34
+ const ports = [];
35
+ instances
36
+ .forEach(instance => {
37
+ // ignore own instance and instances on another host
38
+ if (!instance || instance._id === ownId || instance.common.host !== ownHostname) {
39
+ return;
40
+ }
41
+ // check port only if bind attribute is present too
42
+ if (!instance.native?.bind) {
43
+ return;
44
+ }
45
+ // if let's encrypt is enabled and update is enabled, then add port to check
46
+ if (instance?.native &&
47
+ instance.native.secure &&
48
+ instance.native.leEnabled &&
49
+ instance.native.leUpdate) {
50
+ const port = parseInt(instance.native.leCheckPort || instance.native.lePort, 10);
51
+ port && ports.push({
52
+ name: `${instance._id.replace('system.adapter.', '')} (LE)`,
53
+ port,
54
+ v6bind: instance.native.bind.includes(':') ? instance.native.bind : instance.native.v6bind,
55
+ bind: instance.native.bind,
56
+ enabled: !!instance.common?.enabled,
57
+ });
58
+ }
59
+ const port = parseInt(instance?.native?.port, 10);
60
+ if (port) {
61
+ ports.push({
62
+ name: instance._id.replace('system.adapter.', ''),
63
+ bind: instance.native.bind,
64
+ v6bind: instance.native.bind.includes(':') ? instance.native.bind : instance.native.v6bind,
65
+ port,
66
+ enabled: !!instance.common?.enabled,
67
+ });
68
+ }
69
+ });
70
+ this.setState({ ports });
71
+ }
72
+ static getDerivedStateFromProps(props, state) {
73
+ const _value = ConfigGeneric.getValue(props.data, props.attr);
74
+ if (_value === null || _value === undefined ||
75
+ state.oldValue === null || state.oldValue === undefined ||
76
+ (_value.toString() !== parseInt(state._value, 10).toString() &&
77
+ _value.toString() !== state.oldValue.toString())) {
78
+ return { _value };
79
+ }
80
+ return null;
81
+ }
82
+ checkValue(value) {
83
+ if (value === null || value === undefined) {
84
+ return null;
85
+ }
86
+ const min = this.props.schema.min === undefined ? 20 : this.props.schema.min;
87
+ const max = this.props.schema.max || 0xFFFF;
88
+ value = value.toString().trim();
89
+ const f = value === '' ? 0 : parseInt(value, 10);
90
+ if (value !== '' && Number.isNaN(f)) {
91
+ return 'ra_Not a number';
92
+ }
93
+ // eslint-disable-next-line no-restricted-properties
94
+ if (value !== '' && window.isFinite(Number(value))) {
95
+ if (f < min) {
96
+ return 'ra_Too small';
97
+ }
98
+ if (f > max) {
99
+ return 'ra_Too big';
100
+ }
101
+ if (value === '' || value === '-' || Number.isNaN(f)) {
102
+ return 'ra_Not a number';
103
+ }
104
+ return null;
105
+ }
106
+ return 'ra_Not a number';
107
+ }
108
+ renderItem(error, disabled) {
109
+ if (this.state.oldValue !== null && this.state.oldValue !== undefined) {
110
+ this.updateTimeout && clearTimeout(this.updateTimeout);
111
+ this.updateTimeout = setTimeout(() => {
112
+ this.updateTimeout = undefined;
113
+ this.setState({ oldValue: null });
114
+ }, 30);
115
+ }
116
+ else if (this.updateTimeout) {
117
+ clearTimeout(this.updateTimeout);
118
+ this.updateTimeout = undefined;
119
+ }
120
+ const min = this.props.schema.min === undefined ? 20 : this.props.schema.min;
121
+ const max = this.props.schema.max || 0xFFFF;
122
+ let warning;
123
+ if (this.state.ports) {
124
+ const num = parseInt(this.state._value, 10);
125
+ if (num) {
126
+ // filter ports only with the same bind address
127
+ // todo: IPv6 (v6bind or '::/0')
128
+ const ports = this.state.ports.filter(item => !this.props.data.bind ||
129
+ this.props.data.bind === item.bind ||
130
+ this.props.data.bind === '0.0.0.0' ||
131
+ item.bind === '0.0.0.0');
132
+ let idx = ports.findIndex(item => item.port === num && item.enabled);
133
+ if (idx !== -1) {
134
+ error = I18n.t('ra_Port is already used by %s', this.state.ports[idx].name);
135
+ }
136
+ else {
137
+ idx = ports.findIndex(item => item.port === num && !item.enabled);
138
+ if (idx !== -1) {
139
+ warning = true;
140
+ error = I18n.t('ra_Port could be used by %s', this.state.ports[idx].name);
141
+ }
142
+ }
143
+ }
144
+ }
145
+ if (!error && this.state._value !== null && this.state._value !== undefined) {
146
+ error = this.checkValue(this.state._value);
147
+ if (typeof error === 'string') {
148
+ error = I18n.t(error);
149
+ }
150
+ }
151
+ return React.createElement(TextField, { variant: "standard", type: "number", fullWidth: true, inputProps: {
152
+ min,
153
+ max,
154
+ readOnly: this.props.schema.readOnly || false,
155
+ }, value: this.state._value === null || this.state._value === undefined ? '' : this.state._value, error: !!error, disabled: !!disabled, className: warning ? this.props.classes.warning : '', onChange: e => {
156
+ const _value = Number(e.target.value.toString().replace(/[^0-9]/g, '')).toString();
157
+ const _error = this.checkValue(_value);
158
+ if (_error) {
159
+ this.onError(this.props.attr, I18n.t(_error));
160
+ }
161
+ else {
162
+ this.onError(this.props.attr); // clear error
163
+ }
164
+ this.setState({ _value, oldValue: this.state._value }, () => {
165
+ if (_value.trim() === parseInt(_value, 10).toString()) {
166
+ this.onChange(this.props.attr, parseInt(_value, 10) || 0);
167
+ }
168
+ });
169
+ }, placeholder: this.getText(this.props.schema.placeholder), label: this.getText(this.props.schema.label), helperText: error && typeof error === 'string' ? error : this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) });
170
+ }
171
+ }
172
+ // @ts-expect-error check later on
173
+ export default withStyles(styles)(ConfigPort);
174
+ //# sourceMappingURL=ConfigPort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigPort.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPort.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,OAAO,aAAyD,MAAM,iBAAiB,CAAC;AAExF,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;IAClB,aAAa,EAAE;QACX,OAAO,EAAE,GAAG;KACf;IACD,OAAO,E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AAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAC/J,CAAC;IACP,CAAC;CACJ;AAED,kCAAkC;AAClC,eAAe,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "data" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "onChange" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "onError" | "themeType" | "disabled" | "classes"> & Pick<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
+ }>, "className" | "style" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning" | "disabled" | "classes">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
+ export default _default;
13
+ import PropTypes from 'prop-types';
14
+ import React from 'react';
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { withStyles } from '@mui/styles';
4
+ import { InputLabel, MenuItem, FormHelperText, FormControl, Select, } from '@mui/material';
5
+ import TextWithIcon from './wrapper/Components/TextWithIcon';
6
+ import I18n from './wrapper/i18n';
7
+ import ConfigGeneric from './ConfigGeneric';
8
+ const styles = () => ({
9
+ fullWidth: {
10
+ width: '100%',
11
+ },
12
+ });
13
+ class ConfigFunc extends ConfigGeneric {
14
+ componentDidMount() {
15
+ super.componentDidMount();
16
+ const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
17
+ this.props.socket.getEnums('rooms')
18
+ .then(enums => {
19
+ const selectOptions = Object.keys(enums)
20
+ .map(id => ({
21
+ value: this.props.schema.short ? id.replace('enum.rooms.', '') : id,
22
+ label: this.getText(enums[id].common.name),
23
+ obj: enums[id],
24
+ }));
25
+ if (this.props.schema.allowDeactivate !== false) {
26
+ selectOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });
27
+ }
28
+ this.setState({ value, selectOptions });
29
+ });
30
+ }
31
+ renderItem(error, disabled /* , defaultValue */) {
32
+ if (!this.state.selectOptions) {
33
+ return null;
34
+ }
35
+ const item = this.state.selectOptions.find(it => it.value === this.state.value);
36
+ return React.createElement(FormControl, { variant: "standard", className: this.props.classes.fullWidth },
37
+ this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
38
+ React.createElement(Select, { variant: "standard", error: !!error, disabled: !!disabled, value: this.state.value || '_', renderValue: () => (item ? (item.obj ? React.createElement(TextWithIcon, { value: item.obj, themeType: this.props.themeType, lang: I18n.getLanguage() }) : item.label) : ''), onChange: e => {
39
+ this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => this.onChange(this.props.attr, this.state.value));
40
+ } }, this.state.selectOptions.map(it => React.createElement(MenuItem, { key: it.value, value: it.value, style: it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {} }, it.obj ? React.createElement(TextWithIcon, { value: it.obj, themeType: this.props.themeType, lang: I18n.getLanguage() }) : it.label))),
41
+ this.props.schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
42
+ }
43
+ }
44
+ ConfigFunc.propTypes = {
45
+ socket: PropTypes.object.isRequired,
46
+ themeType: PropTypes.string,
47
+ themeName: PropTypes.string,
48
+ style: PropTypes.object,
49
+ className: PropTypes.string,
50
+ data: PropTypes.object.isRequired,
51
+ schema: PropTypes.object,
52
+ onError: PropTypes.func,
53
+ onChange: PropTypes.func,
54
+ };
55
+ export default withStyles(styles)(ConfigFunc);
56
+ //# sourceMappingURL=ConfigRoom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigRoom.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigRoom.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,MAAM,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAC7D,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;IAClB,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC,CAAC;AAEH,MAAM,UAAW,SAAQ,aAAa;IAClC,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;aAC9B,IAAI,CAAC,KAAK,CAAC,EAAE;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;iBACnC,GAAG,CAAC,EAA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,CAAC,CAAC,oBAAC,YAAY,IAAC,KAAK,EAAE,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,GAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CACxG,CAAC,CACX;YACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,cAAc,QAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAkB,CAAC,CAAC,CAAC,IAAI,CAC9J,CAAC;IACnB,CAAC;CACJ;AAED,UAAU,CAAC,SAAS,GAAG;IACnB,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACjC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,QAAQ,EAAE,SAAS,CAAC,IAAI;CAC3B,CAAC;AAEF,eAAe,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "data" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "onChange" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "onError" | "themeType" | "disabled" | "classes"> & Pick<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
+ }>, "className" | "style" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning" | "disabled" | "classes">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "noMargin"> & object>;
12
+ export default _default;
13
+ import PropTypes from 'prop-types';
14
+ import React from 'react';
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { withStyles } from '@mui/styles';
4
+ import { InputLabel, FormHelperText, FormControl, Select, MenuItem, ListSubheader, } from '@mui/material';
5
+ import I18n from './wrapper/i18n';
6
+ import Utils from './wrapper/Components/Utils';
7
+ import ConfigGeneric from './ConfigGeneric';
8
+ const styles = () => ({
9
+ fullWidth: {
10
+ width: '100%',
11
+ },
12
+ noMargin: {
13
+ '&>div': {
14
+ marginTop: 0,
15
+ },
16
+ },
17
+ });
18
+ class ConfigSelect extends ConfigGeneric {
19
+ componentDidMount() {
20
+ super.componentDidMount();
21
+ const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
22
+ const selectOptions = [];
23
+ (this.props.schema.options || []).forEach(item => {
24
+ // if optgroup
25
+ if (Array.isArray(item.items)) {
26
+ selectOptions.push({ label: item.label, value: item.value, group: true });
27
+ item.items = item.items.forEach(it => selectOptions.push(it));
28
+ return;
29
+ }
30
+ selectOptions.push(item);
31
+ });
32
+ // if __different
33
+ if (Array.isArray(value)) {
34
+ this.initialValue = [...value];
35
+ selectOptions.unshift({ label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE });
36
+ this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });
37
+ }
38
+ else {
39
+ this.setState({ value, selectOptions });
40
+ }
41
+ }
42
+ renderItem(error, disabled /* , defaultValue */) {
43
+ if (!this.state.selectOptions) {
44
+ return null;
45
+ }
46
+ const selectOptions = (this.state.selectOptions || []).filter(item => {
47
+ // if optgroup or no hidden function
48
+ if (!item.hidden) {
49
+ return true;
50
+ }
51
+ if (this.props.custom) {
52
+ return !this.executeCustom(item.hidden, this.props.data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData);
53
+ }
54
+ return !this.execute(item.hidden, this.props.schema.default, this.props.data, this.props.arrayIndex, this.props.globalData);
55
+ });
56
+ // eslint-disable-next-line
57
+ const item = selectOptions.find(it => it.value == this.state.value); // let "==" be and not ===
58
+ return React.createElement(FormControl, { variant: "standard", className: Utils.clsx(this.props.classes.fullWidth, this.props.arrayIndex !== undefined && this.props.classes.noMargin), id: `jsonSelect_${this.props.schema.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}` },
59
+ this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
60
+ React.createElement(Select, { variant: "standard", error: !!error, disabled: !!disabled, value: this.state.value || '_', renderValue: () => this.getText(item?.label, this.props.schema.noTranslation), onChange: e => {
61
+ this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {
62
+ if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {
63
+ this.onChange(this.props.attr, this.initialValue);
64
+ }
65
+ else {
66
+ this.onChange(this.props.attr, this.state.value);
67
+ }
68
+ });
69
+ } }, selectOptions.map((it, i) => {
70
+ if (it.group) {
71
+ return React.createElement(ListSubheader, { key: i }, this.getText(it.label, this.props.schema.noTranslation));
72
+ }
73
+ return React.createElement(MenuItem, { key: i, value: it.value, style: it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {} }, this.getText(it.label, this.props.schema.noTranslation));
74
+ })),
75
+ this.props.schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
76
+ }
77
+ }
78
+ ConfigSelect.propTypes = {
79
+ socket: PropTypes.object.isRequired,
80
+ themeType: PropTypes.string,
81
+ themeName: PropTypes.string,
82
+ style: PropTypes.object,
83
+ className: PropTypes.string,
84
+ data: PropTypes.object.isRequired,
85
+ schema: PropTypes.object,
86
+ onError: PropTypes.func,
87
+ onChange: PropTypes.func,
88
+ };
89
+ export default withStyles(styles)(ConfigSelect);
90
+ //# sourceMappingURL=ConfigSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelect.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAQ,EACJ,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,EACN,QAAQ,EACR,aAAa,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAE/C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;IAClB,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,QAAQ,EAAE;QACN,OAAO,EAAE;YACL,SAAS,EAAE,CAAC;SACf;KACJ;CACJ,CAAC,CAAC;AAEH,MAAM,YAAa,SAAQ,aAAa;IACpC,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,C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,MAAM;IAC3B,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACjC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,QAAQ,EAAE,SAAS,CAAC,IAAI;CAC3B,CAAC;AAEF,eAAe,UAAU,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "data" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "onChange" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "onError" | "themeType" | "disabled" | "classes"> & Pick<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ adapterName: PropTypes.Requireable<string>;
7
+ alive: PropTypes.Requireable<boolean>;
8
+ instance: PropTypes.Requireable<number>;
9
+ className: PropTypes.Requireable<string>;
10
+ data: PropTypes.Validator<object>;
11
+ schema: PropTypes.Requireable<object>;
12
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
13
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
14
+ }>, "className" | "style" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "systemConfig" | "changed" | "common" | "commandRunning" | "disabled" | "classes">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "menuPaper"> & object>;
15
+ export default _default;
16
+ import PropTypes from 'prop-types';
17
+ import React from 'react';
@@ -0,0 +1,175 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { withStyles } from '@mui/styles';
4
+ import { InputLabel, MenuItem, FormHelperText, FormControl, Select, TextField, CircularProgress, ListItemText, Checkbox, Chip, Box, } from '@mui/material';
5
+ import I18n from './wrapper/i18n';
6
+ import ConfigGeneric from './ConfigGeneric';
7
+ const styles = () => ({
8
+ fullWidth: {
9
+ width: '100%',
10
+ },
11
+ menuPaper: {
12
+ maxHeight: 800,
13
+ },
14
+ });
15
+ /*
16
+ to use this option, your adapter must implement listUart message
17
+
18
+ adapter.on('message', obj => {
19
+ if (obj) {
20
+ switch (obj.command) {
21
+ case 'command':
22
+ if (obj.callback) {
23
+ try {
24
+ const serialport = require('serialport');
25
+ if (serialport) {
26
+ // read all found serial ports
27
+ serialport.list()
28
+ .then(ports => {
29
+ adapter.log.info('List of port: ' + JSON.stringify(ports));
30
+ adapter.sendTo(obj.from, obj.command, ports.map(item =>
31
+ ({label: item.path, value: item.path})), obj.callback);
32
+ })
33
+ .catch(e => {
34
+ adapter.sendTo(obj.from, obj.command, [], obj.callback);
35
+ adapter.log.error(e)
36
+ });
37
+ } else {
38
+ adapter.log.warn('Module serialport is not available');
39
+ adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);
40
+ }
41
+ } catch (e) {
42
+ adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);
43
+ }
44
+ }
45
+
46
+ break;
47
+ }
48
+ }
49
+ });
50
+ */
51
+ class ConfigSelectSendTo extends ConfigGeneric {
52
+ componentDidMount() {
53
+ super.componentDidMount();
54
+ this.askInstance();
55
+ }
56
+ askInstance() {
57
+ if (this.props.alive) {
58
+ let data = this.props.schema.data;
59
+ if (data === undefined && this.props.schema.jsonData) {
60
+ data = this.getPattern(this.props.schema.jsonData);
61
+ try {
62
+ data = JSON.parse(data);
63
+ }
64
+ catch (e) {
65
+ console.error(`Cannot parse json data: ${data}`);
66
+ }
67
+ }
68
+ if (data === undefined) {
69
+ data = null;
70
+ }
71
+ this.props.socket.sendTo(`${this.props.adapterName}.${this.props.instance}`, this.props.schema.command || 'send', data)
72
+ .then(list => this.setState({ list, context: this.getContext() }));
73
+ }
74
+ else {
75
+ const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
76
+ this.setState({ value });
77
+ }
78
+ }
79
+ getContext() {
80
+ const context = {};
81
+ if (Array.isArray(this.props.schema.alsoDependsOn)) {
82
+ this.props.schema.alsoDependsOn.forEach(attr => context[attr] = ConfigGeneric.getValue(this.props.data, attr));
83
+ }
84
+ return JSON.stringify(context);
85
+ }
86
+ _getValue() {
87
+ let value = this.state.value === null || this.state.value === undefined ? ConfigGeneric.getValue(this.props.data, this.props.attr) : this.state.value;
88
+ if (this.props.schema.multiple) {
89
+ if (typeof value === 'string') {
90
+ value = [value];
91
+ }
92
+ else if (value === null || value === undefined) {
93
+ value = [];
94
+ }
95
+ }
96
+ return value;
97
+ }
98
+ renderItem(error, disabled /* , defaultValue */) {
99
+ if (this.props.alive) {
100
+ const context = this.getContext();
101
+ if (context !== this.state.context) {
102
+ setTimeout(() => this.askInstance(), 300);
103
+ }
104
+ }
105
+ const value = this._getValue();
106
+ if (!this.props.alive) {
107
+ if (this.props.schema.multiple || this.props.schema.manual === false) {
108
+ return I18n.t('ra_Cannot retrieve options, as instance is offline');
109
+ }
110
+ return React.createElement(TextField, { variant: "standard", fullWidth: true, value: value, error: !!error, disabled: !!disabled, onChange: e => {
111
+ const value_ = e.target.value;
112
+ this.setState({ value: value_ }, () => this.onChange(this.props.attr, (value_ || '').trim()));
113
+ }, 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) });
114
+ }
115
+ if (!this.state.list) {
116
+ return React.createElement(CircularProgress, { size: "small" });
117
+ }
118
+ const selectOptions = this.state.list
119
+ .filter(item => {
120
+ if (!item.hidden) {
121
+ return true;
122
+ }
123
+ if (this.props.custom) {
124
+ return !this.executeCustom(item.hidden, this.props.schema.default, this.props.data, this.props.instanceObj, this.props.arrayIndex, this.props.globalData);
125
+ }
126
+ return !this.execute(item.hidden, this.props.schema.default, this.props.data, this.props.arrayIndex, this.props.globalData);
127
+ });
128
+ const item = selectOptions.find(it => it.value === value);
129
+ return React.createElement(FormControl, { variant: "standard", className: this.props.classes.fullWidth },
130
+ this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
131
+ React.createElement(Select, { variant: "standard", error: !!error, multiple: this.props.schema.multiple, disabled: !!disabled, value: value, MenuProps: this.props.schema.multiple ? { classes: { paper: this.props.classes.menuPaper } } : undefined, renderValue: val => (this.props.schema.multiple ?
132
+ React.createElement(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, val.map(v => {
133
+ const it = selectOptions.find(_item => _item.value === v);
134
+ if (it || this.props.schema.showAllValues !== false) {
135
+ const label = it?.label || v;
136
+ return React.createElement(Chip, { key: v, label: label });
137
+ }
138
+ return null;
139
+ }))
140
+ :
141
+ (item?.label || val)), onChange: e => {
142
+ this.onChange(this.props.attr, e.target.value);
143
+ } }, selectOptions.map((it, i) => React.createElement(MenuItem, { key: i, value: it.value },
144
+ this.props.schema.multiple ? React.createElement(Checkbox, { checked: value.includes(it.value), onClick: () => {
145
+ const _value = JSON.parse(JSON.stringify(this._getValue()));
146
+ const pos = value.indexOf(it.value);
147
+ if (pos !== -1) {
148
+ _value.splice(pos, 1);
149
+ }
150
+ else {
151
+ _value.push(it.value);
152
+ _value.sort();
153
+ }
154
+ this.setState({ value: _value }, () => this.onChange(this.props.attr, _value));
155
+ } }) : null,
156
+ React.createElement(ListItemText, { primary: it.label })))),
157
+ this.props.schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
158
+ }
159
+ }
160
+ ConfigSelectSendTo.propTypes = {
161
+ socket: PropTypes.object.isRequired,
162
+ themeType: PropTypes.string,
163
+ themeName: PropTypes.string,
164
+ style: PropTypes.object,
165
+ adapterName: PropTypes.string,
166
+ alive: PropTypes.bool,
167
+ instance: PropTypes.number,
168
+ className: PropTypes.string,
169
+ data: PropTypes.object.isRequired,
170
+ schema: PropTypes.object,
171
+ onError: PropTypes.func,
172
+ onChange: PropTypes.func,
173
+ };
174
+ export default withStyles(styles)(ConfigSelectSendTo);
175
+ //# sourceMappingURL=ConfigSelectSendTo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigSelectSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelectSendTo.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,GAAG,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;IAClB,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,SAAS,EAAE;QACP,SAAS,EAAE,GAAG;KACjB;CACJ,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,MAAM,kBAAmB,SAAQ,aAAa;IAC1C,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED,WAAW;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YAClB,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YAClC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAClD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UAAU;IACnC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,KAAK,EAAE,SAAS,CAAC,IAAI;IACrB,QAAQ,EAAE,SAAS,CAAC,MAAM;IAC1B,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACjC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,QAAQ,EAAE,SAAS,CAAC,IAAI;CAC3B,CAAC;AAEF,eAAe,UAAU,CAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type AdminConnection from './wrapper/AdminConnection';
3
+ import { ConfigGenericProps } from './ConfigGeneric';
4
+ interface ConfigSendToSchema {
5
+ /** If the component should execute the sendTo command once initially too */
6
+ onLoaded?: boolean;
7
+ [other: string]: any;
8
+ }
9
+ interface ConfigSendToProps extends ConfigGenericProps {
10
+ socket: AdminConnection;
11
+ themeType: string;
12
+ themeName: string;
13
+ style: Record<string, any>;
14
+ className: string;
15
+ data: Record<string, any>;
16
+ schema: ConfigSendToSchema;
17
+ adapterName: string;
18
+ instance: number;
19
+ commandRunning: boolean;
20
+ onCommandRunning: (running: boolean) => void;
21
+ classes: Record<string, any>;
22
+ }
23
+ declare const _default: React.JSXElementConstructor<Omit<ConfigSendToProps, "classes"> & import("@mui/styles").StyledComponentProps<"icon" | "fullWidth"> & object>;
24
+ export default _default;