@iobroker/adapter-react-v5 4.13.7 → 4.13.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/ComplexCron.js +10 -10
- package/Components/SimpleCron/index.d.ts +1 -1
- package/Components/SimpleCron/index.js +17 -10
- package/README.md +3 -0
- package/package.json +1 -1
|
@@ -189,7 +189,7 @@ class ComplexCron extends react_1.Component {
|
|
|
189
189
|
hours: null,
|
|
190
190
|
dates: null,
|
|
191
191
|
months: null,
|
|
192
|
-
|
|
192
|
+
dow: null,
|
|
193
193
|
},
|
|
194
194
|
};
|
|
195
195
|
Object.assign(this.state, state);
|
|
@@ -208,7 +208,7 @@ class ComplexCron extends react_1.Component {
|
|
|
208
208
|
hours: cronParts[2] || '*',
|
|
209
209
|
dates: cronParts[3] || '*',
|
|
210
210
|
months: cronParts[4] || '*',
|
|
211
|
-
|
|
211
|
+
dow: cronParts[5] || '*',
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
else {
|
|
@@ -218,13 +218,13 @@ class ComplexCron extends react_1.Component {
|
|
|
218
218
|
hours: cronParts[1] || '*',
|
|
219
219
|
dates: cronParts[2] || '*',
|
|
220
220
|
months: cronParts[3] || '*',
|
|
221
|
-
|
|
221
|
+
dow: cronParts[4] || '*',
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
return options;
|
|
225
225
|
}
|
|
226
226
|
static state2cron(state) {
|
|
227
|
-
let text = `${state.minutes} ${state.hours} ${state.dates} ${state.months} ${state.
|
|
227
|
+
let text = `${state.minutes} ${state.hours} ${state.dates} ${state.months} ${state.dow}`;
|
|
228
228
|
if (state.seconds !== false) {
|
|
229
229
|
text = `${state.seconds} ${text}`;
|
|
230
230
|
}
|
|
@@ -370,8 +370,8 @@ class ComplexCron extends react_1.Component {
|
|
|
370
370
|
else if (attr === 'months') {
|
|
371
371
|
this.setState({ months: value, modes }, () => this.recalcCron());
|
|
372
372
|
}
|
|
373
|
-
else if (attr === '
|
|
374
|
-
this.setState({
|
|
373
|
+
else if (attr === 'dow') {
|
|
374
|
+
this.setState({ dow: value, modes }, () => this.recalcCron());
|
|
375
375
|
}
|
|
376
376
|
else {
|
|
377
377
|
this.setState({ modes }, () => this.recalcCron());
|
|
@@ -393,8 +393,8 @@ class ComplexCron extends react_1.Component {
|
|
|
393
393
|
else if (attr === 'months') {
|
|
394
394
|
this.setState({ months: value }, () => this.recalcCron());
|
|
395
395
|
}
|
|
396
|
-
else if (attr === '
|
|
397
|
-
this.setState({
|
|
396
|
+
else if (attr === 'dow') {
|
|
397
|
+
this.setState({ dow: value }, () => this.recalcCron());
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
}
|
|
@@ -412,13 +412,13 @@ class ComplexCron extends react_1.Component {
|
|
|
412
412
|
react_1.default.createElement(material_1.Tab, { id: "hours", label: i18n_1.default.t('sc_hours') }),
|
|
413
413
|
react_1.default.createElement(material_1.Tab, { id: "dates", label: i18n_1.default.t('sc_dates') }),
|
|
414
414
|
react_1.default.createElement(material_1.Tab, { id: "months", label: i18n_1.default.t('sc_months') }),
|
|
415
|
-
react_1.default.createElement(material_1.Tab, { id: "
|
|
415
|
+
react_1.default.createElement(material_1.Tab, { id: "dow", label: i18n_1.default.t('sc_dows') }))),
|
|
416
416
|
tab === 0 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('seconds', 60)),
|
|
417
417
|
tab === 1 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('minutes', 60)),
|
|
418
418
|
tab === 2 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('hours', 24)),
|
|
419
419
|
tab === 3 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('dates', 31)),
|
|
420
420
|
tab === 4 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('months', 12)),
|
|
421
|
-
tab === 5 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('
|
|
421
|
+
tab === 5 && react_1.default.createElement("div", { className: this.props.classes.tabContent }, this.getPeriodsTab('dow', 7)));
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
exports.default = (0, styles_1.withStyles)(styles)(ComplexCron);
|
|
@@ -34,6 +34,6 @@ interface SimpleCronState {
|
|
|
34
34
|
weekdays: number[];
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export declare function cron2state(cron: string): Partial<SimpleCronState> | null;
|
|
37
|
+
export declare function cron2state(cron: string, force?: boolean): Partial<SimpleCronState> | null;
|
|
38
38
|
declare const _default: React.JSXElementConstructor<Omit<SimpleCronProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
39
39
|
export default _default;
|
|
@@ -66,7 +66,7 @@ const DEFAULT_STATE = {
|
|
|
66
66
|
unit: PERIODIC_TYPES.minutes,
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
|
-
function cron2state(cron) {
|
|
69
|
+
function cron2state(cron, force) {
|
|
70
70
|
cron = cron.replace(/['"]/g, '').trim();
|
|
71
71
|
const cronParts = cron.split(' ');
|
|
72
72
|
let options;
|
|
@@ -96,7 +96,8 @@ function cron2state(cron) {
|
|
|
96
96
|
options.minutes === '*' &&
|
|
97
97
|
options.hours === '*' &&
|
|
98
98
|
options.date === '*' &&
|
|
99
|
-
options.months === '*'
|
|
99
|
+
options.months === '*' &&
|
|
100
|
+
(options.dow === '*' || force)) {
|
|
100
101
|
state = {
|
|
101
102
|
mode: 'interval',
|
|
102
103
|
interval: {
|
|
@@ -109,7 +110,8 @@ function cron2state(cron) {
|
|
|
109
110
|
options.minutes === '*' &&
|
|
110
111
|
options.hours === '*' &&
|
|
111
112
|
options.date === '*' &&
|
|
112
|
-
options.months === '*'
|
|
113
|
+
options.months === '*' &&
|
|
114
|
+
(options.dow === '*' || force)) {
|
|
113
115
|
state = {
|
|
114
116
|
mode: 'interval',
|
|
115
117
|
interval: {
|
|
@@ -122,7 +124,8 @@ function cron2state(cron) {
|
|
|
122
124
|
options.minutes.includes('/') &&
|
|
123
125
|
options.hours === '*' &&
|
|
124
126
|
options.date === '*' &&
|
|
125
|
-
options.months === '*'
|
|
127
|
+
options.months === '*' &&
|
|
128
|
+
(options.dow === '*' || force)) {
|
|
126
129
|
// */n * * * *
|
|
127
130
|
state = {
|
|
128
131
|
mode: 'interval',
|
|
@@ -137,7 +140,8 @@ function cron2state(cron) {
|
|
|
137
140
|
options.minutes === '*' &&
|
|
138
141
|
options.hours === '*' &&
|
|
139
142
|
options.date === '*' &&
|
|
140
|
-
options.months === '*'
|
|
143
|
+
options.months === '*' &&
|
|
144
|
+
(options.dow === '*' || force)) {
|
|
141
145
|
// */n * * * * *
|
|
142
146
|
state = {
|
|
143
147
|
mode: 'interval',
|
|
@@ -152,7 +156,8 @@ function cron2state(cron) {
|
|
|
152
156
|
options.minutes === '*' &&
|
|
153
157
|
options.hours.includes('-') &&
|
|
154
158
|
options.date === '*' &&
|
|
155
|
-
options.months === '*'
|
|
159
|
+
options.months === '*' &&
|
|
160
|
+
(options.dow === '*' || force)) {
|
|
156
161
|
// */n * 1-24 * * 1-7 or */n * 1-24 * * *
|
|
157
162
|
state = {
|
|
158
163
|
mode: 'intervalBetween',
|
|
@@ -169,7 +174,8 @@ function cron2state(cron) {
|
|
|
169
174
|
options.minutes.includes('/') &&
|
|
170
175
|
options.hours.includes('-') &&
|
|
171
176
|
options.date === '*' &&
|
|
172
|
-
options.months === '*'
|
|
177
|
+
options.months === '*' &&
|
|
178
|
+
(options.dow === '*' || force)) {
|
|
173
179
|
// */n 1-24 * * 1-7 or */n 1-24 * * *
|
|
174
180
|
state = {
|
|
175
181
|
mode: 'intervalBetween',
|
|
@@ -186,7 +192,8 @@ function cron2state(cron) {
|
|
|
186
192
|
parseInt(options.minutes, 10).toString() === options.minutes &&
|
|
187
193
|
parseInt(options.hours, 10).toString() === options.hours &&
|
|
188
194
|
options.date === '*' &&
|
|
189
|
-
options.months === '*'
|
|
195
|
+
options.months === '*' &&
|
|
196
|
+
(options.dow === '*' || force)) {
|
|
190
197
|
// m h * * 1-7 or m h * * *
|
|
191
198
|
state = {
|
|
192
199
|
mode: 'specific',
|
|
@@ -201,7 +208,7 @@ function cron2state(cron) {
|
|
|
201
208
|
parseInt(options.hours, 10).toString() === options.hours &&
|
|
202
209
|
parseInt(options.date, 10).toString() === options.date &&
|
|
203
210
|
parseInt(options.months, 10).toString() === options.months &&
|
|
204
|
-
options.dow === '*') {
|
|
211
|
+
(options.dow === '*' || force)) {
|
|
205
212
|
// m h d M *
|
|
206
213
|
state = {
|
|
207
214
|
mode: 'once',
|
|
@@ -221,7 +228,7 @@ class SimpleCron extends react_1.default.Component {
|
|
|
221
228
|
if (cron[0] === '{') {
|
|
222
229
|
cron = '';
|
|
223
230
|
}
|
|
224
|
-
const state = cron2state(cron || '* * * * *') || DEFAULT_STATE;
|
|
231
|
+
const state = cron2state(cron || '* * * * *', true) || DEFAULT_STATE;
|
|
225
232
|
this.state = {
|
|
226
233
|
extended: false,
|
|
227
234
|
cron: SimpleCron.state2cron(state),
|
package/README.md
CHANGED
|
@@ -670,6 +670,9 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
|
|
|
670
670
|
-->
|
|
671
671
|
|
|
672
672
|
## Changelog
|
|
673
|
+
### 4.13.8 (2024-04-19)
|
|
674
|
+
* (bluefox) Corrected CRON selector
|
|
675
|
+
|
|
673
676
|
### 4.13.7 (2024-04-19)
|
|
674
677
|
* (bluefox) Migrated ColorPicker to typescript
|
|
675
678
|
|