@iobroker/json-config 7.4.0 → 7.4.2
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/README.md +44 -35
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.js +16 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +19 -4
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.js +219 -138
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticHeader.js +12 -5
- package/build/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticInfo.js +53 -15
- package/build/JsonConfigComponent/ConfigStaticInfo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +3 -3
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js +35 -15
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/types.d.ts +23 -5
- package/package.json +3 -3
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TextField, IconButton, Button, Switch, Slider } from '@mui/material';
|
|
3
|
-
import { I18n } from '@iobroker/adapter-react-v5';
|
|
2
|
+
import { TextField, IconButton, Button, Switch, Slider, Box } from '@mui/material';
|
|
3
|
+
import { I18n, Icon } from '@iobroker/adapter-react-v5';
|
|
4
4
|
import getIconByName from './Icons';
|
|
5
5
|
import ConfigGeneric from './ConfigGeneric';
|
|
6
|
+
function valueBlinkOnce(theme, color) {
|
|
7
|
+
if (typeof color === 'string') {
|
|
8
|
+
return {
|
|
9
|
+
'@keyframes newStateAnimationOnceColor': {
|
|
10
|
+
'0%': {
|
|
11
|
+
color,
|
|
12
|
+
},
|
|
13
|
+
'100%': {
|
|
14
|
+
color: theme.palette.mode === 'dark' ? '#fff' : '#000',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
animation: 'newStateAnimationOnceColor 2s ease-in-out',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
'@keyframes newStateAnimationOnce': {
|
|
22
|
+
'0%': {
|
|
23
|
+
color: '#00f900',
|
|
24
|
+
},
|
|
25
|
+
'80%': {
|
|
26
|
+
color: theme.palette.mode === 'dark' ? '#518851' : '#008000',
|
|
27
|
+
},
|
|
28
|
+
'100%': {
|
|
29
|
+
color: theme.palette.mode === 'dark' ? '#fff' : '#000',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
animation: 'newStateAnimationOnce 2s ease-in-out',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
6
35
|
class ConfigState extends ConfigGeneric {
|
|
7
36
|
controlTimeout = null;
|
|
8
37
|
delayedUpdate = {
|
|
@@ -10,6 +39,9 @@ class ConfigState extends ConfigGeneric {
|
|
|
10
39
|
value: null,
|
|
11
40
|
};
|
|
12
41
|
getObjectID() {
|
|
42
|
+
if (this.props.schema.foreign) {
|
|
43
|
+
return this.props.schema.oid;
|
|
44
|
+
}
|
|
13
45
|
return `${this.props.schema.system ? 'system.adapter.' : ''}${this.props.adapterName}.${this.props.instance}.${this.props.schema.oid}`;
|
|
14
46
|
}
|
|
15
47
|
async componentDidMount() {
|
|
@@ -105,8 +137,7 @@ class ConfigState extends ConfigGeneric {
|
|
|
105
137
|
if (this.props.schema.falseImage) {
|
|
106
138
|
icon = getIconByName(this.props.schema.falseImage);
|
|
107
139
|
}
|
|
108
|
-
const text = this.getText(this.props.schema.falseText, this.props.schema.noTranslation)
|
|
109
|
-
this.getText(this.props.schema.label, this.props.schema.noTranslation);
|
|
140
|
+
const text = this.getText(this.props.schema.falseText || this.props.schema.label, this.props.schema.noTranslation);
|
|
110
141
|
if (!text && icon) {
|
|
111
142
|
content = (React.createElement(IconButton, { style: this.props.schema.falseTextStyle, disabled: !!this.props.schema.readOnly, onClick: async () => {
|
|
112
143
|
if (this.props.schema.confirm) {
|
|
@@ -142,101 +173,6 @@ class ConfigState extends ConfigGeneric {
|
|
|
142
173
|
} }, text || this.getObjectID().split('.').pop()));
|
|
143
174
|
}
|
|
144
175
|
}
|
|
145
|
-
else if (this.state.controlType === 'switch') {
|
|
146
|
-
let iconFalse = null;
|
|
147
|
-
const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);
|
|
148
|
-
if (this.props.schema.falseImage) {
|
|
149
|
-
iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);
|
|
150
|
-
}
|
|
151
|
-
let iconTrue = null;
|
|
152
|
-
const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);
|
|
153
|
-
if (this.props.schema.trueImage) {
|
|
154
|
-
iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);
|
|
155
|
-
}
|
|
156
|
-
content = (React.createElement(Switch, { checked: !!this.state.stateValue, disabled: !!this.props.schema.readOnly, onChange: async () => {
|
|
157
|
-
if (this.props.schema.confirm) {
|
|
158
|
-
this.setState({
|
|
159
|
-
confirmDialog: true,
|
|
160
|
-
confirmCallback: async (result) => {
|
|
161
|
-
if (result) {
|
|
162
|
-
await this.props.socket.setState(this.getObjectID(), !this.state.stateValue, false);
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
await this.props.socket.setState(this.getObjectID(), !this.state.stateValue, false);
|
|
169
|
-
}
|
|
170
|
-
} }));
|
|
171
|
-
if (textFalse || iconFalse || textTrue || iconTrue) {
|
|
172
|
-
content = (React.createElement("div", { style: { display: 'flex', alignItems: 'center', fontSize: 14 } },
|
|
173
|
-
React.createElement("span", { style: this.props.schema.falseTextStyle },
|
|
174
|
-
textFalse,
|
|
175
|
-
iconFalse),
|
|
176
|
-
content,
|
|
177
|
-
React.createElement("span", { style: this.props.schema.trueTextStyle },
|
|
178
|
-
iconTrue,
|
|
179
|
-
textTrue)));
|
|
180
|
-
}
|
|
181
|
-
const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);
|
|
182
|
-
if (label) {
|
|
183
|
-
content = (React.createElement("div", { style: { display: 'flex', alignItems: 'center', fontSize: '1rem' } },
|
|
184
|
-
React.createElement("span", { style: { marginRight: 8 } }, label),
|
|
185
|
-
content));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
else if (this.state.controlType === 'slider') {
|
|
189
|
-
let iconFalse = null;
|
|
190
|
-
const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);
|
|
191
|
-
if (this.props.schema.falseImage) {
|
|
192
|
-
iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);
|
|
193
|
-
}
|
|
194
|
-
let iconTrue = null;
|
|
195
|
-
const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);
|
|
196
|
-
if (this.props.schema.trueImage) {
|
|
197
|
-
iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);
|
|
198
|
-
}
|
|
199
|
-
const min = this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;
|
|
200
|
-
const max = this.props.schema.max === undefined
|
|
201
|
-
? this.state.obj.common.max === undefined
|
|
202
|
-
? 100
|
|
203
|
-
: this.state.obj.common.max
|
|
204
|
-
: this.props.schema.max;
|
|
205
|
-
const step = this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;
|
|
206
|
-
content = (React.createElement(Slider, { style: { width: '100%', flexGrow: 1 }, min: min, max: max, disabled: !!this.props.schema.readOnly, step: step, value: this.state.stateValue, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`, onChange: (_e, value) => {
|
|
207
|
-
this.setState({ stateValue: value }, () => {
|
|
208
|
-
if (this.controlTimeout) {
|
|
209
|
-
clearTimeout(this.controlTimeout);
|
|
210
|
-
}
|
|
211
|
-
this.controlTimeout = setTimeout(async () => {
|
|
212
|
-
console.log(`${Date.now()} Send new value: ${this.state.stateValue}`);
|
|
213
|
-
this.controlTimeout = null;
|
|
214
|
-
await this.props.socket.setState(this.getObjectID(), this.state.stateValue, false);
|
|
215
|
-
}, this.props.schema.controlDelay || 0);
|
|
216
|
-
});
|
|
217
|
-
} }));
|
|
218
|
-
if (textFalse || iconFalse || textTrue || iconTrue) {
|
|
219
|
-
content = (React.createElement("div", { style: {
|
|
220
|
-
display: 'flex',
|
|
221
|
-
width: '100%',
|
|
222
|
-
flexGrow: 1,
|
|
223
|
-
alignItems: 'center',
|
|
224
|
-
} },
|
|
225
|
-
React.createElement("span", { style: { marginRight: 16, ...this.props.schema.falseTextStyle } },
|
|
226
|
-
textFalse,
|
|
227
|
-
iconFalse),
|
|
228
|
-
content,
|
|
229
|
-
React.createElement("span", { style: { marginLeft: 16, ...this.props.schema.trueTextStyle } },
|
|
230
|
-
iconTrue,
|
|
231
|
-
textTrue)));
|
|
232
|
-
}
|
|
233
|
-
const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);
|
|
234
|
-
if (label) {
|
|
235
|
-
content = (React.createElement("div", { style: { display: 'flex', width: '100%', alignItems: 'center' } },
|
|
236
|
-
React.createElement("span", { style: { whiteSpace: 'nowrap', marginRight: 8, fontSize: '1rem' } }, label),
|
|
237
|
-
content));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
176
|
else if (this.state.controlType === 'input') {
|
|
241
177
|
content = (React.createElement(TextField, { style: { width: '100%' }, value: this.state.stateValue, variant: "standard", slotProps: {
|
|
242
178
|
input: {
|
|
@@ -285,55 +221,200 @@ class ConfigState extends ConfigGeneric {
|
|
|
285
221
|
await this.props.socket.setState(this.getObjectID(), val, false);
|
|
286
222
|
}, this.props.schema.controlDelay || 0);
|
|
287
223
|
});
|
|
288
|
-
}, label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) }));
|
|
224
|
+
}, label: this.getText(this.props.schema.label, this.props.schema.noTranslation), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) }));
|
|
289
225
|
}
|
|
290
|
-
else
|
|
291
|
-
let
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
226
|
+
else {
|
|
227
|
+
let fontSize;
|
|
228
|
+
if (this.props.schema.size === 'normal') {
|
|
229
|
+
fontSize = 16;
|
|
230
|
+
}
|
|
231
|
+
else if (this.props.schema.size === 'large') {
|
|
232
|
+
fontSize = 20;
|
|
233
|
+
}
|
|
234
|
+
else if (typeof this.props.schema.size === 'number') {
|
|
235
|
+
fontSize = this.props.schema.size;
|
|
236
|
+
}
|
|
237
|
+
let label = this.getText(this.props.schema.label, this.props.schema.noTranslation);
|
|
238
|
+
const divStyle = {
|
|
239
|
+
display: 'flex',
|
|
240
|
+
alignItems: 'center',
|
|
241
|
+
fontSize: fontSize || '1rem',
|
|
242
|
+
gap: 8,
|
|
243
|
+
};
|
|
244
|
+
if (!this.props.schema.narrow) {
|
|
245
|
+
divStyle.width = '100%';
|
|
246
|
+
divStyle.justifyContent = 'space-between';
|
|
247
|
+
}
|
|
248
|
+
if (label.trim()) {
|
|
249
|
+
if (!label.trim().endsWith(':') && this.props.schema.addColon) {
|
|
250
|
+
label = `${label.trim()}:`;
|
|
298
251
|
}
|
|
299
|
-
style = this.props.schema.falseTextStyle;
|
|
300
252
|
}
|
|
301
|
-
|
|
302
|
-
|
|
253
|
+
let blinkStyle;
|
|
254
|
+
if (this.props.schema.blinkOnUpdate) {
|
|
255
|
+
blinkStyle = valueBlinkOnce(this.props.theme, this.props.schema.blinkOnUpdate);
|
|
256
|
+
}
|
|
257
|
+
let labelIcon;
|
|
258
|
+
if (this.props.schema.labelIcon) {
|
|
259
|
+
labelIcon = (React.createElement(Icon, { src: this.props.schema.labelIcon, style: { marginRight: 4 } }));
|
|
260
|
+
}
|
|
261
|
+
let labelControl;
|
|
262
|
+
if (label && labelIcon) {
|
|
263
|
+
labelControl = (React.createElement("div", { style: { whiteSpace: 'nowrap' } },
|
|
264
|
+
labelIcon,
|
|
265
|
+
label));
|
|
266
|
+
}
|
|
267
|
+
else if (label) {
|
|
268
|
+
labelControl = React.createElement("div", { style: { whiteSpace: 'nowrap' } }, label);
|
|
269
|
+
}
|
|
270
|
+
else if (labelIcon) {
|
|
271
|
+
labelControl = labelIcon;
|
|
272
|
+
}
|
|
273
|
+
if (this.state.controlType === 'switch') {
|
|
274
|
+
let iconFalse = null;
|
|
275
|
+
const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);
|
|
276
|
+
if (this.props.schema.falseImage) {
|
|
277
|
+
iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);
|
|
278
|
+
}
|
|
279
|
+
let iconTrue = null;
|
|
280
|
+
const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);
|
|
303
281
|
if (this.props.schema.trueImage) {
|
|
304
|
-
|
|
282
|
+
iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);
|
|
283
|
+
}
|
|
284
|
+
content = (React.createElement(Switch, { checked: !!this.state.stateValue, disabled: !!this.props.schema.readOnly, onChange: async () => {
|
|
285
|
+
if (this.props.schema.confirm) {
|
|
286
|
+
this.setState({
|
|
287
|
+
confirmDialog: true,
|
|
288
|
+
confirmCallback: async (result) => {
|
|
289
|
+
if (result) {
|
|
290
|
+
await this.props.socket.setState(this.getObjectID(), !this.state.stateValue, false);
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
await this.props.socket.setState(this.getObjectID(), !this.state.stateValue, false);
|
|
297
|
+
}
|
|
298
|
+
} }));
|
|
299
|
+
if (textFalse || iconFalse || textTrue || iconTrue) {
|
|
300
|
+
content = (React.createElement("div", { style: { display: 'flex', alignItems: 'center', fontSize: 14 } },
|
|
301
|
+
React.createElement("span", { style: this.props.schema.falseTextStyle },
|
|
302
|
+
textFalse,
|
|
303
|
+
iconFalse),
|
|
304
|
+
content,
|
|
305
|
+
React.createElement("span", { style: this.props.schema.trueTextStyle },
|
|
306
|
+
iconTrue,
|
|
307
|
+
textTrue)));
|
|
308
|
+
}
|
|
309
|
+
if (labelControl) {
|
|
310
|
+
content = (React.createElement("div", { style: divStyle },
|
|
311
|
+
labelControl,
|
|
312
|
+
content));
|
|
305
313
|
}
|
|
306
|
-
style = this.props.schema.trueTextStyle;
|
|
307
|
-
}
|
|
308
|
-
const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);
|
|
309
|
-
content = (React.createElement("div", { style: { fontSize: '1rem', ...style } },
|
|
310
|
-
label,
|
|
311
|
-
label ? React.createElement("span", { style: { marginRight: 8 } }, ":") : null,
|
|
312
|
-
icon,
|
|
313
|
-
text || (this.state.stateValue ? I18n.t('ra_true') : I18n.t('ra_false'))));
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
// text or HTML
|
|
317
|
-
const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);
|
|
318
|
-
const unit = this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;
|
|
319
|
-
let value;
|
|
320
|
-
if (this.state.controlType === 'html') {
|
|
321
|
-
value = React.createElement("span", { dangerouslySetInnerHTML: { __html: this.state.stateValue } });
|
|
322
314
|
}
|
|
323
|
-
else if (this.state.
|
|
324
|
-
|
|
315
|
+
else if (this.state.controlType === 'slider') {
|
|
316
|
+
let iconFalse = null;
|
|
317
|
+
const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);
|
|
318
|
+
if (this.props.schema.falseImage) {
|
|
319
|
+
iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);
|
|
320
|
+
}
|
|
321
|
+
let iconTrue = null;
|
|
322
|
+
const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);
|
|
323
|
+
if (this.props.schema.trueImage) {
|
|
324
|
+
iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);
|
|
325
|
+
}
|
|
326
|
+
const min = this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;
|
|
327
|
+
const max = this.props.schema.max === undefined
|
|
328
|
+
? this.state.obj.common.max === undefined
|
|
329
|
+
? 100
|
|
330
|
+
: this.state.obj.common.max
|
|
331
|
+
: this.props.schema.max;
|
|
332
|
+
const step = this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;
|
|
333
|
+
content = (React.createElement(Slider, { style: { width: '100%', flexGrow: 1 }, min: min, max: max, disabled: !!this.props.schema.readOnly, step: step, value: this.state.stateValue, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`, onChange: (_e, value) => {
|
|
334
|
+
this.setState({ stateValue: value }, () => {
|
|
335
|
+
if (this.controlTimeout) {
|
|
336
|
+
clearTimeout(this.controlTimeout);
|
|
337
|
+
}
|
|
338
|
+
this.controlTimeout = setTimeout(async () => {
|
|
339
|
+
console.log(`${Date.now()} Send new value: ${this.state.stateValue}`);
|
|
340
|
+
this.controlTimeout = null;
|
|
341
|
+
await this.props.socket.setState(this.getObjectID(), this.state.stateValue, false);
|
|
342
|
+
}, this.props.schema.controlDelay || 0);
|
|
343
|
+
});
|
|
344
|
+
} }));
|
|
345
|
+
if (textFalse || iconFalse || textTrue || iconTrue) {
|
|
346
|
+
content = (React.createElement("div", { style: {
|
|
347
|
+
display: 'flex',
|
|
348
|
+
width: '100%',
|
|
349
|
+
flexGrow: 1,
|
|
350
|
+
alignItems: 'center',
|
|
351
|
+
} },
|
|
352
|
+
React.createElement("span", { style: { marginRight: 16, ...this.props.schema.falseTextStyle } },
|
|
353
|
+
textFalse,
|
|
354
|
+
iconFalse),
|
|
355
|
+
content,
|
|
356
|
+
React.createElement("span", { style: { marginLeft: 16, ...this.props.schema.trueTextStyle } },
|
|
357
|
+
iconTrue,
|
|
358
|
+
textTrue)));
|
|
359
|
+
}
|
|
360
|
+
if (labelControl) {
|
|
361
|
+
content = (React.createElement("div", { style: divStyle },
|
|
362
|
+
labelControl,
|
|
363
|
+
content));
|
|
364
|
+
}
|
|
325
365
|
}
|
|
326
|
-
else if (this.state.
|
|
327
|
-
|
|
366
|
+
else if (this.state.obj.common.type === 'boolean') {
|
|
367
|
+
let icon = null;
|
|
368
|
+
let text;
|
|
369
|
+
let style;
|
|
370
|
+
if (!this.state.stateValue) {
|
|
371
|
+
text = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);
|
|
372
|
+
if (this.props.schema.falseImage) {
|
|
373
|
+
icon = getIconByName(this.props.schema.falseImage, text ? { marginLeft: 8 } : undefined);
|
|
374
|
+
}
|
|
375
|
+
style = this.props.schema.falseTextStyle;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
text = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);
|
|
379
|
+
if (this.props.schema.trueImage) {
|
|
380
|
+
icon = getIconByName(this.props.schema.falseImage, text ? { marginRight: 8 } : undefined);
|
|
381
|
+
}
|
|
382
|
+
style = this.props.schema.trueTextStyle;
|
|
383
|
+
}
|
|
384
|
+
style = Object.assign(divStyle, style);
|
|
385
|
+
content = (React.createElement("div", { style: style },
|
|
386
|
+
labelControl,
|
|
387
|
+
React.createElement(Box, { style: { display: 'flex', alignItems: 'center', gap: 8 }, sx: blinkStyle, key: this.props.schema.blinkOnUpdate ? text : undefined },
|
|
388
|
+
icon,
|
|
389
|
+
text || (this.state.stateValue ? I18n.t('ra_true') : I18n.t('ra_false')))));
|
|
328
390
|
}
|
|
329
391
|
else {
|
|
330
|
-
|
|
392
|
+
// text or HTML
|
|
393
|
+
const unit = this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;
|
|
394
|
+
let value;
|
|
395
|
+
let key;
|
|
396
|
+
if (this.state.controlType === 'html') {
|
|
397
|
+
key = (this.state.stateValue || '').toString();
|
|
398
|
+
value = React.createElement("span", { dangerouslySetInnerHTML: { __html: this.state.stateValue } });
|
|
399
|
+
}
|
|
400
|
+
else if (this.state.stateValue === null) {
|
|
401
|
+
value = 'null';
|
|
402
|
+
key = value;
|
|
403
|
+
}
|
|
404
|
+
else if (this.state.stateValue === undefined) {
|
|
405
|
+
value = 'undefined';
|
|
406
|
+
key = value;
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
value = this.state.stateValue.toString();
|
|
410
|
+
key = value;
|
|
411
|
+
}
|
|
412
|
+
content = (React.createElement("div", { style: divStyle },
|
|
413
|
+
labelControl,
|
|
414
|
+
React.createElement("div", { style: { display: 'flex', alignItems: 'baseline', gap: 4 } },
|
|
415
|
+
React.createElement(Box, { sx: blinkStyle, key: this.props.schema.blinkOnUpdate ? key : undefined }, value),
|
|
416
|
+
unit ? React.createElement("span", { style: { opacity: 0.7, fontSize: 'smaller' } }, unit) : null)));
|
|
331
417
|
}
|
|
332
|
-
content = (React.createElement("div", { style: { fontSize: '1rem' } },
|
|
333
|
-
label,
|
|
334
|
-
label ? React.createElement("span", { style: { marginRight: 8 } }, ":") : null,
|
|
335
|
-
value,
|
|
336
|
-
unit ? React.createElement("span", { style: { opacity: 0.7 } }, unit) : null));
|
|
337
418
|
}
|
|
338
419
|
return content;
|
|
339
420
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigState.js","sourceRoot":"./src/","sources":["Json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,CAAC,CAAC;YACrF,MAAM,IAAI,GACN,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;YACxG,IAAI,KAAK,CAAC;YACV,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,MAAM,EAAE;gBACnC,KAAK,GAAG,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,UAAoB,EAAE,GAAI,CAAC;aAC1F;iBAAM,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE;gBACvC,KAAK,GAAG,MAAM,CAAC;aAClB;iBAAM,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;gBAC5C,KAAK,GAAG,WAAW,CAAC;aACvB;iBAAM;gBACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;aACjC;YAED,OAAO,GAAG,CACN,6BAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC3B,KAAK;gBACL,KAAK,CAAC,CAAC,CAAC,8BAAM,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,QAAU,CAAC,CAAC,CAAC,IAAI;gBACxD,KAAK;gBACL,IAAI,CAAC,CAAC,CAAC,8BAAM,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,IAAG,IAAI,CAAQ,CAAC,CAAC,CAAC,IAAI,CACzD,CACT,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton, Button, Switch, Slider } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemState } from '#JC/types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigStateProps extends ConfigGenericProps {\n schema: ConfigItemState;\n}\n\ninterface ConfigStateState extends ConfigGenericState {\n stateValue?: string | number | boolean | null;\n controlType?: string;\n obj?: ioBroker.Object | null;\n}\n\nclass ConfigState extends ConfigGeneric<ConfigStateProps, ConfigStateState> {\n controlTimeout: ReturnType<typeof setTimeout> | null = null;\n\n delayedUpdate: { timer: ReturnType<typeof setTimeout> | null; value: string | boolean | number | null } = {\n timer: null,\n value: null,\n };\n\n getObjectID(): string {\n return `${this.props.schema.system ? 'system.adapter.' : ''}${this.props.adapterName}.${this.props.instance}.${this.props.schema.oid}`;\n }\n\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const obj: ioBroker.StateObject = (await this.props.socket.getObject(\n this.getObjectID(),\n )) as ioBroker.StateObject;\n const controlType = this.props.schema.control || this.detectType(obj);\n\n const state = await this.props.socket.getState(this.getObjectID());\n\n this.setState({ stateValue: state ? state.val : null, controlType, obj }, async () => {\n await this.props.socket.subscribeState(this.getObjectID(), this.onStateChanged);\n });\n }\n\n componentWillUnmount(): void {\n super.componentWillUnmount();\n this.props.socket.unsubscribeState(this.getObjectID(), this.onStateChanged);\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n this.controlTimeout = null;\n this.props.socket\n .setState(this.getObjectID(), this.state.stateValue, false)\n .catch(e => console.error(`Cannot control value: ${e}`));\n }\n }\n\n onStateChanged = (_id: string, state: ioBroker.State | null | undefined): void => {\n let val = state ? state.val : null;\n if (this.state.controlType === 'button' || this.state.controlType === 'switch') {\n val = !!val;\n if (this.state.stateValue !== val) {\n this.setState({ stateValue: val });\n }\n } else if (val !== null && (this.state.controlType === 'slider' || this.state.controlType === 'number')) {\n val = parseFloat(val as unknown as string);\n console.log(`${Date.now()} Received new value: ${val}`);\n if (val !== this.state.stateValue) {\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n this.delayedUpdate.value = val;\n this.delayedUpdate.timer = setTimeout(() => {\n this.setState({ stateValue: this.delayedUpdate.value });\n }, 500);\n } else if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n } else if (this.state.stateValue.toString() !== val.toString()) {\n this.setState({ stateValue: val });\n }\n };\n\n detectType(obj: ioBroker.StateObject): 'button' | 'switch' | 'slider' | 'input' | 'text' {\n obj = obj || ({} as ioBroker.StateObject);\n obj.common = obj.common || ({} as ioBroker.StateCommon);\n\n // read object\n if (obj.common.type === 'boolean') {\n if (this.props.schema.controlled !== false) {\n if (obj.common.read === false || this.props.schema.controlled === true) {\n return 'button';\n }\n if (obj.common.write || this.props.schema.controlled === true) {\n return 'switch';\n }\n }\n\n return 'text';\n }\n\n if (obj.common.type === 'number' && this.props.schema.controlled !== false) {\n if (obj.common.write || this.props.schema.controlled === true) {\n if (obj.common.max !== undefined) {\n return 'slider';\n }\n return 'input';\n }\n return 'text';\n }\n\n if (obj.common.write && this.props.schema.controlled !== false) {\n return 'input';\n }\n\n return 'text';\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (!this.state.obj) {\n return null;\n }\n\n let content: JSX.Element;\n\n if (this.state.controlType === 'button') {\n let icon: JSX.Element | null = null;\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage);\n }\n\n const text =\n this.getText(this.props.schema.falseText, this.props.schema.noTranslation) ||\n this.getText(this.props.schema.label, this.props.schema.noTranslation);\n if (!text && icon) {\n content = (\n <IconButton\n style={this.props.schema.falseTextStyle}\n disabled={!!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n },\n });\n } else {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n }}\n >\n {icon}\n </IconButton>\n );\n } else {\n content = (\n <Button\n variant={this.props.schema.variant || 'contained'}\n startIcon={icon}\n style={this.props.schema.falseTextStyle}\n disabled={!!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n },\n });\n } else {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n }}\n >\n {text || this.getObjectID().split('.').pop()}\n </Button>\n );\n }\n } else if (this.state.controlType === 'switch') {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n content = (\n <Switch\n checked={!!this.state.stateValue}\n disabled={!!this.props.schema.readOnly}\n onChange={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.socket.setState(\n this.getObjectID(),\n !this.state.stateValue,\n false,\n );\n }\n },\n });\n } else {\n await this.props.socket.setState(this.getObjectID(), !this.state.stateValue, false);\n }\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>\n <span style={this.props.schema.falseTextStyle}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={this.props.schema.trueTextStyle}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n\n const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n if (label) {\n content = (\n <div style={{ display: 'flex', alignItems: 'center', fontSize: '1rem' }}>\n <span style={{ marginRight: 8 }}>{label}</span>\n {content}\n </div>\n );\n }\n } else if (this.state.controlType === 'slider') {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n const min = this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? 100\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;\n\n content = (\n <Slider\n style={{ width: '100%', flexGrow: 1 }}\n min={min}\n max={max}\n disabled={!!this.props.schema.readOnly}\n step={step}\n value={this.state.stateValue as number}\n valueLabelDisplay=\"auto\"\n valueLabelFormat={(value: number) =>\n `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`\n }\n onChange={(_e: Event, value: number) => {\n this.setState({ stateValue: value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n console.log(`${Date.now()} Send new value: ${this.state.stateValue}`);\n this.controlTimeout = null;\n await this.props.socket.setState(this.getObjectID(), this.state.stateValue, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div\n style={{\n display: 'flex',\n width: '100%',\n flexGrow: 1,\n alignItems: 'center',\n }}\n >\n <span style={{ marginRight: 16, ...this.props.schema.falseTextStyle }}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={{ marginLeft: 16, ...this.props.schema.trueTextStyle }}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n if (label) {\n content = (\n <div style={{ display: 'flex', width: '100%', alignItems: 'center' }}>\n <span style={{ whiteSpace: 'nowrap', marginRight: 8, fontSize: '1rem' }}>{label}</span>\n {content}\n </div>\n );\n }\n } else if (this.state.controlType === 'input') {\n content = (\n <TextField\n style={{ width: '100%' }}\n value={this.state.stateValue}\n variant=\"standard\"\n slotProps={{\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n htmlInput: {\n readOnly: !!this.props.schema.readOnly,\n },\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n await this.props.socket.setState(this.getObjectID(), this.state.stateValue, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n } else if (this.state.obj.common.type === 'number') {\n const min = this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? 100\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;\n\n content = (\n <TextField\n variant=\"standard\"\n style={{ width: '100%' }}\n value={this.state.stateValue}\n type=\"number\"\n slotProps={{\n htmlInput: { min, max, step, readOnly: !!this.props.schema.readOnly },\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n const val = parseFloat(this.state.stateValue as unknown as string);\n await this.props.socket.setState(this.getObjectID(), val, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n } else if (this.state.obj.common.type === 'boolean') {\n let icon: JSX.Element | null = null;\n let text: string;\n let style: React.CSSProperties | undefined;\n if (!this.state.stateValue) {\n text = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginLeft: 8 } : undefined);\n }\n style = this.props.schema.falseTextStyle;\n } else {\n text = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginRight: 8 } : undefined);\n }\n style = this.props.schema.trueTextStyle;\n }\n const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n content = (\n <div style={{ fontSize: '1rem', ...style }}>\n {label}\n {label ? <span style={{ marginRight: 8 }}>:</span> : null}\n {icon}\n {text || (this.state.stateValue ? I18n.t('ra_true') : I18n.t('ra_false'))}\n </div>\n );\n } else {\n // text or HTML\n const label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n const unit =\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;\n let value;\n if (this.state.controlType === 'html') {\n value = <span dangerouslySetInnerHTML={{ __html: this.state.stateValue as string }} />;\n } else if (this.state.stateValue === null) {\n value = 'null';\n } else if (this.state.stateValue === undefined) {\n value = 'undefined';\n } else {\n value = this.state.stateValue;\n }\n\n content = (\n <div style={{ fontSize: '1rem' }}>\n {label}\n {label ? <span style={{ marginRight: 8 }}>:</span> : null}\n {value}\n {unit ? <span style={{ opacity: 0.7 }}>{unit}</span> : null}\n </div>\n );\n }\n\n return content;\n }\n}\n\nexport default ConfigState;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigState.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAGvE,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,SAAS,cAAc,CAAC,KAAe,EAAE,KAAwB;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,OAAO;YACH,uCAAuC,EAAE;gBACrC,IAAI,EAAE;oBACF,KAAK;iBACR;gBACD,MAAM,EAAE;oBACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;iBACzD;aACJ;YACD,SAAS,EAAE,2CAA2C;SACzD,CAAC;KACL;IACD,OAAO;QACH,kCAAkC,EAAE;YAChC,IAAI,EAAE;gBACF,KAAK,EAAE,SAAS;aACnB;YACD,KAAK,EAAE;gBACH,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;aAC/D;YACD,MAAM,EAAE;gBACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;aACzD;SACJ;QACD,SAAS,EAAE,sCAAsC;KACpD,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AC,CAAC,IAAI,CAC9E,CACJ,CACT,CAAC;aACL;SACJ;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton, Button, Switch, Slider, Box } from '@mui/material';\n\nimport { I18n, Icon, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemState } from '#JC/types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction valueBlinkOnce(theme: IobTheme, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes newStateAnimationOnceColor': {\n '0%': {\n color,\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'newStateAnimationOnceColor 2s ease-in-out',\n };\n }\n return {\n '@keyframes newStateAnimationOnce': {\n '0%': {\n color: '#00f900',\n },\n '80%': {\n color: theme.palette.mode === 'dark' ? '#518851' : '#008000',\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'newStateAnimationOnce 2s ease-in-out',\n };\n}\n\ninterface ConfigStateProps extends ConfigGenericProps {\n schema: ConfigItemState;\n}\n\ninterface ConfigStateState extends ConfigGenericState {\n stateValue?: string | number | boolean | null;\n controlType?: string;\n obj?: ioBroker.Object | null;\n}\n\nclass ConfigState extends ConfigGeneric<ConfigStateProps, ConfigStateState> {\n controlTimeout: ReturnType<typeof setTimeout> | null = null;\n\n delayedUpdate: { timer: ReturnType<typeof setTimeout> | null; value: string | boolean | number | null } = {\n timer: null,\n value: null,\n };\n\n getObjectID(): string {\n if (this.props.schema.foreign) {\n return this.props.schema.oid;\n }\n return `${this.props.schema.system ? 'system.adapter.' : ''}${this.props.adapterName}.${this.props.instance}.${this.props.schema.oid}`;\n }\n\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const obj: ioBroker.StateObject = (await this.props.socket.getObject(\n this.getObjectID(),\n )) as ioBroker.StateObject;\n const controlType = this.props.schema.control || this.detectType(obj);\n\n const state = await this.props.socket.getState(this.getObjectID());\n\n this.setState({ stateValue: state ? state.val : null, controlType, obj }, async () => {\n await this.props.socket.subscribeState(this.getObjectID(), this.onStateChanged);\n });\n }\n\n componentWillUnmount(): void {\n super.componentWillUnmount();\n this.props.socket.unsubscribeState(this.getObjectID(), this.onStateChanged);\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n this.controlTimeout = null;\n this.props.socket\n .setState(this.getObjectID(), this.state.stateValue, false)\n .catch(e => console.error(`Cannot control value: ${e}`));\n }\n }\n\n onStateChanged = (_id: string, state: ioBroker.State | null | undefined): void => {\n let val = state ? state.val : null;\n if (this.state.controlType === 'button' || this.state.controlType === 'switch') {\n val = !!val;\n if (this.state.stateValue !== val) {\n this.setState({ stateValue: val });\n }\n } else if (val !== null && (this.state.controlType === 'slider' || this.state.controlType === 'number')) {\n val = parseFloat(val as unknown as string);\n console.log(`${Date.now()} Received new value: ${val}`);\n if (val !== this.state.stateValue) {\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n this.delayedUpdate.value = val;\n this.delayedUpdate.timer = setTimeout(() => {\n this.setState({ stateValue: this.delayedUpdate.value });\n }, 500);\n } else if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n } else if (this.state.stateValue.toString() !== val.toString()) {\n this.setState({ stateValue: val });\n }\n };\n\n detectType(obj: ioBroker.StateObject): 'button' | 'switch' | 'slider' | 'input' | 'text' {\n obj = obj || ({} as ioBroker.StateObject);\n obj.common = obj.common || ({} as ioBroker.StateCommon);\n\n // read object\n if (obj.common.type === 'boolean') {\n if (this.props.schema.controlled !== false) {\n if (obj.common.read === false || this.props.schema.controlled === true) {\n return 'button';\n }\n if (obj.common.write || this.props.schema.controlled === true) {\n return 'switch';\n }\n }\n\n return 'text';\n }\n\n if (obj.common.type === 'number' && this.props.schema.controlled !== false) {\n if (obj.common.write || this.props.schema.controlled === true) {\n if (obj.common.max !== undefined) {\n return 'slider';\n }\n return 'input';\n }\n return 'text';\n }\n\n if (obj.common.write && this.props.schema.controlled !== false) {\n return 'input';\n }\n\n return 'text';\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (!this.state.obj) {\n return null;\n }\n\n let content: JSX.Element;\n\n if (this.state.controlType === 'button') {\n let icon: JSX.Element | null = null;\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage);\n }\n\n const text = this.getText(\n this.props.schema.falseText || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n\n if (!text && icon) {\n content = (\n <IconButton\n style={this.props.schema.falseTextStyle}\n disabled={!!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n },\n });\n } else {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n }}\n >\n {icon}\n </IconButton>\n );\n } else {\n content = (\n <Button\n variant={this.props.schema.variant || 'contained'}\n startIcon={icon}\n style={this.props.schema.falseTextStyle}\n disabled={!!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n },\n });\n } else {\n await this.props.socket.setState(this.getObjectID(), true, false);\n }\n }}\n >\n {text || this.getObjectID().split('.').pop()}\n </Button>\n );\n }\n } else if (this.state.controlType === 'input') {\n content = (\n <TextField\n style={{ width: '100%' }}\n value={this.state.stateValue}\n variant=\"standard\"\n slotProps={{\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n htmlInput: {\n readOnly: !!this.props.schema.readOnly,\n },\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n await this.props.socket.setState(this.getObjectID(), this.state.stateValue, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n } else if (this.state.obj.common.type === 'number') {\n const min = this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? 100\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;\n\n content = (\n <TextField\n variant=\"standard\"\n style={{ width: '100%' }}\n value={this.state.stateValue}\n type=\"number\"\n slotProps={{\n htmlInput: { min, max, step, readOnly: !!this.props.schema.readOnly },\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n const val = parseFloat(this.state.stateValue as unknown as string);\n await this.props.socket.setState(this.getObjectID(), val, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n } else {\n let fontSize: number | undefined;\n if (this.props.schema.size === 'normal') {\n fontSize = 16;\n } else if (this.props.schema.size === 'large') {\n fontSize = 20;\n } else if (typeof this.props.schema.size === 'number') {\n fontSize = this.props.schema.size;\n }\n let label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n\n const divStyle: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n fontSize: fontSize || '1rem',\n gap: 8,\n };\n\n if (!this.props.schema.narrow) {\n divStyle.width = '100%';\n divStyle.justifyContent = 'space-between';\n }\n\n if (label.trim()) {\n if (!label.trim().endsWith(':') && this.props.schema.addColon) {\n label = `${label.trim()}:`;\n }\n }\n\n let blinkStyle: React.CSSProperties | undefined;\n if (this.props.schema.blinkOnUpdate) {\n blinkStyle = valueBlinkOnce(this.props.theme, this.props.schema.blinkOnUpdate);\n }\n\n let labelIcon: React.JSX.Element | undefined;\n if (this.props.schema.labelIcon) {\n labelIcon = (\n <Icon\n src={this.props.schema.labelIcon}\n style={{ marginRight: 4 }}\n />\n );\n }\n\n let labelControl: React.JSX.Element | undefined;\n if (label && labelIcon) {\n labelControl = (\n <div style={{ whiteSpace: 'nowrap' }}>\n {labelIcon}\n {label}\n </div>\n );\n } else if (label) {\n labelControl = <div style={{ whiteSpace: 'nowrap' }}>{label}</div>;\n } else if (labelIcon) {\n labelControl = labelIcon;\n }\n\n if (this.state.controlType === 'switch') {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n content = (\n <Switch\n checked={!!this.state.stateValue}\n disabled={!!this.props.schema.readOnly}\n onChange={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.socket.setState(\n this.getObjectID(),\n !this.state.stateValue,\n false,\n );\n }\n },\n });\n } else {\n await this.props.socket.setState(this.getObjectID(), !this.state.stateValue, false);\n }\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>\n <span style={this.props.schema.falseTextStyle}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={this.props.schema.trueTextStyle}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n\n if (labelControl) {\n content = (\n <div style={divStyle}>\n {labelControl}\n {content}\n </div>\n );\n }\n } else if (this.state.controlType === 'slider') {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n const min =\n this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? 100\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;\n\n content = (\n <Slider\n style={{ width: '100%', flexGrow: 1 }}\n min={min}\n max={max}\n disabled={!!this.props.schema.readOnly}\n step={step}\n value={this.state.stateValue as number}\n valueLabelDisplay=\"auto\"\n valueLabelFormat={(value: number) =>\n `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`\n }\n onChange={(_e: Event, value: number) => {\n this.setState({ stateValue: value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n console.log(`${Date.now()} Send new value: ${this.state.stateValue}`);\n this.controlTimeout = null;\n await this.props.socket.setState(this.getObjectID(), this.state.stateValue, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div\n style={{\n display: 'flex',\n width: '100%',\n flexGrow: 1,\n alignItems: 'center',\n }}\n >\n <span style={{ marginRight: 16, ...this.props.schema.falseTextStyle }}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={{ marginLeft: 16, ...this.props.schema.trueTextStyle }}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n if (labelControl) {\n content = (\n <div style={divStyle}>\n {labelControl}\n {content}\n </div>\n );\n }\n } else if (this.state.obj.common.type === 'boolean') {\n let icon: JSX.Element | null = null;\n let text: string;\n let style: React.CSSProperties | undefined;\n if (!this.state.stateValue) {\n text = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginLeft: 8 } : undefined);\n }\n style = this.props.schema.falseTextStyle;\n } else {\n text = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginRight: 8 } : undefined);\n }\n style = this.props.schema.trueTextStyle;\n }\n style = Object.assign(divStyle, style);\n\n content = (\n <div style={style}>\n {labelControl}\n <Box\n style={{ display: 'flex', alignItems: 'center', gap: 8 }}\n sx={blinkStyle}\n key={this.props.schema.blinkOnUpdate ? text : undefined}\n >\n {icon}\n {text || (this.state.stateValue ? I18n.t('ra_true') : I18n.t('ra_false'))}\n </Box>\n </div>\n );\n } else {\n // text or HTML\n const unit =\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;\n\n let value;\n let key: string;\n if (this.state.controlType === 'html') {\n key = (this.state.stateValue || '').toString();\n value = <span dangerouslySetInnerHTML={{ __html: this.state.stateValue as string }} />;\n } else if (this.state.stateValue === null) {\n value = 'null';\n key = value;\n } else if (this.state.stateValue === undefined) {\n value = 'undefined';\n key = value;\n } else {\n value = this.state.stateValue.toString();\n key = value;\n }\n\n content = (\n <div style={divStyle}>\n {labelControl}\n <div style={{ display: 'flex', alignItems: 'baseline', gap: 4 }}>\n <Box\n sx={blinkStyle}\n key={this.props.schema.blinkOnUpdate ? key : undefined}\n >\n {value}\n </Box>\n {unit ? <span style={{ opacity: 0.7, fontSize: 'smaller' }}>{unit}</span> : null}\n </div>\n </div>\n );\n }\n }\n\n return content;\n }\n}\n\nexport default ConfigState;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigStaticDivider.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAIR;IACA,SAAS,EAAE,CAAC,KAAe,
|
|
1
|
+
{"version":3,"file":"ConfigStaticDivider.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAIR;IACA,SAAS,EAAE,CAAC,KAAe,EAAuB,EAAE,CAAC,CAAC;QAClD,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QA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type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticDivider } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: {\n fullWidth: (theme: IobTheme) => React.CSSProperties;\n primary: (theme: IobTheme) => React.CSSProperties;\n secondary: (theme: IobTheme) => React.CSSProperties;\n} = {\n fullWidth: (theme: IobTheme): React.CSSProperties => ({\n width: '100%',\n backgroundColor: theme.palette.mode === 'dark' ? '#FFF' : '#000',\n borderStyle: 'hidden',\n }),\n primary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.primary.main,\n }),\n secondary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.secondary.main,\n }),\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemStaticDivider;\n}\n\nclass ConfigStaticDivider extends ConfigGeneric<ConfigInstanceSelectProps, ConfigGenericState> {\n renderItem(): JSX.Element {\n return (\n <Box\n component=\"hr\"\n sx={Utils.getStyle(\n this.props.theme,\n styles.fullWidth,\n this.props.schema.color === 'primary'\n ? styles.primary\n : this.props.schema.color === 'secondary'\n ? styles.secondary\n : {\n backgroundColor:\n this.props.schema.color || (this.props.themeType === 'dark' ? '#333' : '#ddd'),\n },\n {\n height: this.props.schema.color ? this.props.schema.height || 2 : this.props.schema.height || 1,\n },\n )}\n />\n );\n }\n}\n\nexport default ConfigStaticDivider;\n"]}
|