@iobroker/adapter-react-v5 8.2.13 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/build/Components/DeviceType/DeviceTypeSelector.js +2 -2
- package/build/Components/DeviceType/DeviceTypeSelector.js.map +1 -1
- package/build/Components/FileBrowser.js +1 -1
- package/build/Components/FileBrowser.js.map +1 -1
- package/build/Components/Image.js +8 -4
- package/build/Components/Image.js.map +1 -1
- package/build/Components/IobUri.js +3 -3
- package/build/Components/IobUri.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +2 -2
- package/build/Components/ObjectBrowser.js +46 -38
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/Schedule.d.ts +26 -1
- package/build/Components/Schedule.js +37 -24
- package/build/Components/Schedule.js.map +1 -1
- package/build/Components/SelectWithIcon.js +1 -1
- package/build/Components/SelectWithIcon.js.map +1 -1
- package/build/Components/TextWithIcon.js.map +1 -1
- package/build/Components/TreeTable.js +3 -3
- package/build/Components/TreeTable.js.map +1 -1
- package/build/Components/Utils.d.ts +1 -1
- package/build/Components/Utils.js +2 -2
- package/build/Components/Utils.js.map +1 -1
- package/build/Components/objectBrowserUtils.js +9 -6
- package/build/Components/objectBrowserUtils.js.map +1 -1
- package/build/LegacyConnection.d.ts +2 -2
- package/build/LegacyConnection.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { Component, type JSX } from 'react';
|
|
2
2
|
import type { IobTheme } from '../types';
|
|
3
|
+
export interface ScheduleConfigSaved {
|
|
4
|
+
time?: {
|
|
5
|
+
exactTime: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
start: string;
|
|
8
|
+
end: string;
|
|
9
|
+
mode: string;
|
|
10
|
+
interval: number;
|
|
11
|
+
};
|
|
12
|
+
period?: {
|
|
13
|
+
once: string;
|
|
14
|
+
days: number;
|
|
15
|
+
dows: string;
|
|
16
|
+
dates: string;
|
|
17
|
+
weeks: number;
|
|
18
|
+
months: string | number;
|
|
19
|
+
years: number;
|
|
20
|
+
yearMonth: number;
|
|
21
|
+
yearDate: number;
|
|
22
|
+
};
|
|
23
|
+
valid?: {
|
|
24
|
+
from?: string;
|
|
25
|
+
to?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
3
28
|
export interface ScheduleConfig {
|
|
4
29
|
time: {
|
|
5
30
|
exactTime: boolean;
|
|
@@ -56,7 +81,7 @@ export declare class Schedule extends Component<ScheduleProps, ScheduleState> {
|
|
|
56
81
|
getPeriodSettingsMonthly(): JSX.Element[] | null;
|
|
57
82
|
getPeriodSettingsYearly(): JSX.Element[] | null;
|
|
58
83
|
static now2string(isEnd?: boolean): string;
|
|
59
|
-
static string2date(str: string): Date;
|
|
84
|
+
static string2date(str: string | undefined): Date;
|
|
60
85
|
getValidSettings(): JSX.Element;
|
|
61
86
|
render(): JSX.Element;
|
|
62
87
|
}
|
|
@@ -185,6 +185,9 @@ const DEFAULT = {
|
|
|
185
185
|
},
|
|
186
186
|
};
|
|
187
187
|
function string2USdate(date) {
|
|
188
|
+
if (!date) {
|
|
189
|
+
return '';
|
|
190
|
+
}
|
|
188
191
|
const parts = date.split('.');
|
|
189
192
|
if (parts.length === 3) {
|
|
190
193
|
return `${parts[2]}-${parts[1]}-${parts[0]}`;
|
|
@@ -250,13 +253,13 @@ export class Schedule extends Component {
|
|
|
250
253
|
this.setState({ schedule, desc: Schedule.state2text(schedule) });
|
|
251
254
|
}
|
|
252
255
|
const copy = JSON.parse(JSON.stringify(schedule));
|
|
253
|
-
if (copy.period
|
|
256
|
+
if (copy.period?.once) {
|
|
254
257
|
const once = copy.period.once;
|
|
255
258
|
delete copy.period;
|
|
256
259
|
copy.period = { once };
|
|
257
260
|
delete copy.valid;
|
|
258
261
|
}
|
|
259
|
-
else if (copy.period
|
|
262
|
+
else if (copy.period?.days) {
|
|
260
263
|
const days = copy.period.days;
|
|
261
264
|
const daysOfWeek = copy.period.dows;
|
|
262
265
|
delete copy.period;
|
|
@@ -265,7 +268,7 @@ export class Schedule extends Component {
|
|
|
265
268
|
copy.period.dows = daysOfWeek;
|
|
266
269
|
}
|
|
267
270
|
}
|
|
268
|
-
else if (copy.period
|
|
271
|
+
else if (copy.period?.weeks) {
|
|
269
272
|
const weeks = copy.period.weeks;
|
|
270
273
|
const daysOfWeek = copy.period.dows;
|
|
271
274
|
delete copy.period;
|
|
@@ -274,7 +277,7 @@ export class Schedule extends Component {
|
|
|
274
277
|
copy.period.dows = daysOfWeek;
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
|
-
else if (copy.period
|
|
280
|
+
else if (copy.period?.months) {
|
|
278
281
|
const months = copy.period.months;
|
|
279
282
|
const dates = copy.period.dates;
|
|
280
283
|
delete copy.period;
|
|
@@ -283,7 +286,7 @@ export class Schedule extends Component {
|
|
|
283
286
|
copy.period.dates = dates;
|
|
284
287
|
}
|
|
285
288
|
}
|
|
286
|
-
else if (copy.period
|
|
289
|
+
else if (copy.period?.years) {
|
|
287
290
|
const years = copy.period.years;
|
|
288
291
|
const yearMonth = copy.period.yearMonth;
|
|
289
292
|
const yearDate = copy.period.yearDate;
|
|
@@ -293,23 +296,30 @@ export class Schedule extends Component {
|
|
|
293
296
|
copy.period.yearMonth = yearMonth;
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
|
-
if (copy.time
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
if (copy.time?.exactTime) {
|
|
300
|
+
copy.time = {
|
|
301
|
+
exactTime: copy.time?.exactTime,
|
|
302
|
+
};
|
|
300
303
|
}
|
|
301
304
|
else {
|
|
302
|
-
|
|
305
|
+
const _time = copy.time;
|
|
306
|
+
copy.time = {
|
|
307
|
+
start: _time.start,
|
|
308
|
+
end: _time.end,
|
|
309
|
+
mode: _time.mode,
|
|
310
|
+
interval: _time.interval,
|
|
311
|
+
};
|
|
303
312
|
}
|
|
304
313
|
if (copy.valid) {
|
|
305
314
|
if (!copy.valid.to) {
|
|
306
315
|
delete copy.valid.to;
|
|
307
316
|
}
|
|
308
|
-
if (copy.period
|
|
309
|
-
copy.period.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
317
|
+
if (copy.period &&
|
|
318
|
+
(copy.period.days === 1 ||
|
|
319
|
+
copy.period.weeks === 1 ||
|
|
320
|
+
copy.period.months === 1 ||
|
|
321
|
+
copy.period.years === 1)) {
|
|
322
|
+
const from = Schedule.string2date(copy.valid?.from);
|
|
313
323
|
const today = new Date();
|
|
314
324
|
today.setHours(0);
|
|
315
325
|
today.setMinutes(0);
|
|
@@ -336,7 +346,7 @@ export class Schedule extends Component {
|
|
|
336
346
|
}
|
|
337
347
|
}
|
|
338
348
|
const desc = [];
|
|
339
|
-
const validFrom = Schedule.string2date(schedule.valid
|
|
349
|
+
const validFrom = Schedule.string2date(schedule.valid?.from);
|
|
340
350
|
if (schedule.period.once) {
|
|
341
351
|
// once
|
|
342
352
|
const once = Schedule.string2date(schedule.period.once);
|
|
@@ -540,17 +550,17 @@ export class Schedule extends Component {
|
|
|
540
550
|
}
|
|
541
551
|
if (!schedule.period.once) {
|
|
542
552
|
// valid
|
|
543
|
-
if (validFrom.getTime() > Date.now() && schedule.valid
|
|
553
|
+
if (validFrom.getTime() > Date.now() && schedule.valid?.to) {
|
|
544
554
|
// from XXX to XXXX
|
|
545
|
-
desc.push(I18n.t('sch_desc_validFromTo', schedule.valid
|
|
555
|
+
desc.push(I18n.t('sch_desc_validFromTo', schedule.valid?.from, schedule.valid?.to));
|
|
546
556
|
}
|
|
547
557
|
else if (validFrom.getTime() > Date.now()) {
|
|
548
558
|
// from XXXX
|
|
549
|
-
desc.push(I18n.t('sch_desc_validFrom', schedule.valid
|
|
559
|
+
desc.push(I18n.t('sch_desc_validFrom', schedule.valid?.from));
|
|
550
560
|
}
|
|
551
|
-
else if (schedule.valid
|
|
561
|
+
else if (schedule.valid?.to) {
|
|
552
562
|
// till XXXX
|
|
553
|
-
desc.push(I18n.t('sch_desc_validTo', schedule.valid
|
|
563
|
+
desc.push(I18n.t('sch_desc_validTo', schedule.valid?.to));
|
|
554
564
|
}
|
|
555
565
|
}
|
|
556
566
|
return desc.join(' ');
|
|
@@ -1199,6 +1209,9 @@ export class Schedule extends Component {
|
|
|
1199
1209
|
return `${padding(d.getDate())}.${padding(d.getMonth() + 1)}.${padding(d.getFullYear())}`;
|
|
1200
1210
|
}
|
|
1201
1211
|
static string2date(str) {
|
|
1212
|
+
if (!str) {
|
|
1213
|
+
return new Date();
|
|
1214
|
+
}
|
|
1202
1215
|
let parts = str.split('.'); // 31.12.2019
|
|
1203
1216
|
if (parts.length === 1) {
|
|
1204
1217
|
parts = str.split('-'); // 2018-12-31
|
|
@@ -1214,7 +1227,7 @@ export class Schedule extends Component {
|
|
|
1214
1227
|
React.createElement("span", { style: { fontWeight: 'bold', paddingRight: 10 } }, I18n.t('sch_valid')),
|
|
1215
1228
|
React.createElement("span", null, I18n.t('sch_validFrom'))),
|
|
1216
1229
|
React.createElement("div", { style: styles.settingsDiv },
|
|
1217
|
-
React.createElement(TextField, { variant: "standard", style: { ...styles.inputDate, marginRight: 10 }, key: "exactTimeFrom", inputRef: this.refFrom, defaultValue: string2USdate(schedule.valid
|
|
1230
|
+
React.createElement(TextField, { variant: "standard", style: { ...styles.inputDate, marginRight: 10 }, key: "exactTimeFrom", inputRef: this.refFrom, defaultValue: string2USdate(schedule.valid?.from), type: "date",
|
|
1218
1231
|
// inputComponent={TextDate}
|
|
1219
1232
|
onChange: e => {
|
|
1220
1233
|
if (this.timerFrom) {
|
|
@@ -1238,12 +1251,12 @@ export class Schedule extends Component {
|
|
|
1238
1251
|
}, slotProps: {
|
|
1239
1252
|
inputLabel: { shrink: true },
|
|
1240
1253
|
}, margin: "normal" }),
|
|
1241
|
-
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { style: styles.inputRadio, checked: !!schedule.valid
|
|
1254
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { style: styles.inputRadio, checked: !!schedule.valid?.to, onClick: () => {
|
|
1242
1255
|
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1243
1256
|
_schedule.valid.to = _schedule.valid.to ? '' : Schedule.now2string(true);
|
|
1244
1257
|
this.onChange(_schedule);
|
|
1245
1258
|
} }), label: I18n.t('sch_validTo') }),
|
|
1246
|
-
!!schedule.valid
|
|
1259
|
+
!!schedule.valid?.to && (React.createElement(TextField, { variant: "standard", inputRef: this.refTo, style: { ...styles.inputDate, marginRight: 10 }, key: "exactTimeFrom", type: "date", defaultValue: string2USdate(schedule.valid.to),
|
|
1247
1260
|
// inputComponent={TextDate}
|
|
1248
1261
|
onChange: e => {
|
|
1249
1262
|
if (this.timerTo) {
|