react-cron-generator 2.0.16 → 2.0.17
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/build/cron-tab/monthly.d.ts +1 -1
- package/build/day-select/index.d.ts +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js +167 -137
- package/build/index.js.map +1 -1
- package/build/meta/index.d.ts +2 -2
- package/package.json +5 -2
package/build/index.js
CHANGED
|
@@ -222,11 +222,17 @@ var cronstrueI18n = {exports: {}};
|
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
CronParser.prototype.validate = function (parsed) {
|
|
225
|
-
|
|
226
|
-
this.
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
var standardCronPartCharacters = "0-9,\\-*\/";
|
|
226
|
+
this.validateOnlyExpectedCharactersFound(parsed[0], standardCronPartCharacters);
|
|
227
|
+
this.validateOnlyExpectedCharactersFound(parsed[1], standardCronPartCharacters);
|
|
228
|
+
this.validateOnlyExpectedCharactersFound(parsed[2], standardCronPartCharacters);
|
|
229
|
+
this.validateOnlyExpectedCharactersFound(parsed[3], "0-9,\\-*\/LW");
|
|
230
|
+
this.validateOnlyExpectedCharactersFound(parsed[4], standardCronPartCharacters);
|
|
231
|
+
this.validateOnlyExpectedCharactersFound(parsed[5], "0-9,\\-*\/L#");
|
|
232
|
+
this.validateOnlyExpectedCharactersFound(parsed[6], standardCronPartCharacters);
|
|
233
|
+
this.validateAnyRanges(parsed);
|
|
234
|
+
};
|
|
235
|
+
CronParser.prototype.validateAnyRanges = function (parsed) {
|
|
230
236
|
rangeValidator_1.default.secondRange(parsed[0]);
|
|
231
237
|
rangeValidator_1.default.minuteRange(parsed[1]);
|
|
232
238
|
rangeValidator_1.default.hourRange(parsed[2]);
|
|
@@ -234,10 +240,10 @@ var cronstrueI18n = {exports: {}};
|
|
|
234
240
|
rangeValidator_1.default.monthRange(parsed[4], this.monthStartIndexZero);
|
|
235
241
|
rangeValidator_1.default.dayOfWeekRange(parsed[5], this.dayOfWeekStartIndexZero);
|
|
236
242
|
};
|
|
237
|
-
CronParser.prototype.
|
|
238
|
-
var invalidChars =
|
|
243
|
+
CronParser.prototype.validateOnlyExpectedCharactersFound = function (cronPart, allowedCharsExpression) {
|
|
244
|
+
var invalidChars = cronPart.match(new RegExp("[^".concat(allowedCharsExpression, "]+"), "gi"));
|
|
239
245
|
if (invalidChars && invalidChars.length) {
|
|
240
|
-
throw new Error("
|
|
246
|
+
throw new Error("Expression contains invalid values: '".concat(invalidChars.toString(), "'"));
|
|
241
247
|
}
|
|
242
248
|
};
|
|
243
249
|
return CronParser;
|
|
@@ -7469,19 +7475,19 @@ var cronstrueI18n = {exports: {}};
|
|
|
7469
7475
|
return "每隔 %s 秒";
|
|
7470
7476
|
};
|
|
7471
7477
|
zh_CN.prototype.secondsX0ThroughX1PastTheMinute = function () {
|
|
7472
|
-
return "
|
|
7478
|
+
return "在一分钟后的第 %s 到 %s 秒";
|
|
7473
7479
|
};
|
|
7474
7480
|
zh_CN.prototype.atX0SecondsPastTheMinute = function () {
|
|
7475
|
-
return "
|
|
7481
|
+
return "在一分钟后的第 %s 秒";
|
|
7476
7482
|
};
|
|
7477
7483
|
zh_CN.prototype.everyX0Minutes = function () {
|
|
7478
7484
|
return "每隔 %s 分钟";
|
|
7479
7485
|
};
|
|
7480
7486
|
zh_CN.prototype.minutesX0ThroughX1PastTheHour = function () {
|
|
7481
|
-
return "
|
|
7487
|
+
return "在整点后的第 %s 到 %s 分钟";
|
|
7482
7488
|
};
|
|
7483
7489
|
zh_CN.prototype.atX0MinutesPastTheHour = function () {
|
|
7484
|
-
return "
|
|
7490
|
+
return "在整点后的第 %s 分钟";
|
|
7485
7491
|
};
|
|
7486
7492
|
zh_CN.prototype.everyX0Hours = function () {
|
|
7487
7493
|
return "每隔 %s 小时";
|
|
@@ -7650,19 +7656,19 @@ var cronstrueI18n = {exports: {}};
|
|
|
7650
7656
|
return "每 %s 秒";
|
|
7651
7657
|
};
|
|
7652
7658
|
zh_TW.prototype.secondsX0ThroughX1PastTheMinute = function () {
|
|
7653
|
-
return "
|
|
7659
|
+
return "在一分鐘後的 %s 到 %s 秒";
|
|
7654
7660
|
};
|
|
7655
7661
|
zh_TW.prototype.atX0SecondsPastTheMinute = function () {
|
|
7656
|
-
return "
|
|
7662
|
+
return "在一分鐘後的 %s 秒";
|
|
7657
7663
|
};
|
|
7658
7664
|
zh_TW.prototype.everyX0Minutes = function () {
|
|
7659
7665
|
return "每 %s 分鐘";
|
|
7660
7666
|
};
|
|
7661
7667
|
zh_TW.prototype.minutesX0ThroughX1PastTheHour = function () {
|
|
7662
|
-
return "
|
|
7668
|
+
return "在整點後的 %s 到 %s 分鐘";
|
|
7663
7669
|
};
|
|
7664
7670
|
zh_TW.prototype.atX0MinutesPastTheHour = function () {
|
|
7665
|
-
return "
|
|
7671
|
+
return "在整點後的 %s 分";
|
|
7666
7672
|
};
|
|
7667
7673
|
zh_TW.prototype.everyX0Hours = function () {
|
|
7668
7674
|
return "每 %s 小時";
|
|
@@ -7950,7 +7956,7 @@ const MinutesCron = (props) => {
|
|
|
7950
7956
|
}
|
|
7951
7957
|
};
|
|
7952
7958
|
const value = props.value[1].split('/')[1];
|
|
7953
|
-
return (jsxs("div", Object.assign({ className: "well" }, { children: [props.translate('Every'),
|
|
7959
|
+
return (jsxs("div", Object.assign({ className: "well" }, { children: [props.translate('Every'), ' ', jsx("input", { type: "Number", onChange: onChange, value: value, min: 1, max: 60, disabled: props.disabled }), ' ', props.translate('minute(s)')] })));
|
|
7954
7960
|
};
|
|
7955
7961
|
|
|
7956
7962
|
const MinutesSelect = (props) => {
|
|
@@ -7986,7 +7992,7 @@ const DailyCron = (props) => {
|
|
|
7986
7992
|
}
|
|
7987
7993
|
if (!e.target.value || (parseInt(e.target.value) > 0 && parseInt(e.target.value) < 32)) {
|
|
7988
7994
|
// props.value = ['0', getValueByIndex(1), getValueByIndex(1),'*','*','?','*'];
|
|
7989
|
-
onValueChange(3,
|
|
7995
|
+
onValueChange(3, e.target.value ? `1/${e.target.value}` : e.target.value);
|
|
7990
7996
|
}
|
|
7991
7997
|
};
|
|
7992
7998
|
const onAtHourChange = (e) => {
|
|
@@ -8032,7 +8038,9 @@ const HourlyCron = (props) => {
|
|
|
8032
8038
|
}
|
|
8033
8039
|
}, []);
|
|
8034
8040
|
const onHourChange = (e) => {
|
|
8035
|
-
if (!props.disabled &&
|
|
8041
|
+
if (!props.disabled &&
|
|
8042
|
+
state.every &&
|
|
8043
|
+
((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 24) || e.target.value === '')) {
|
|
8036
8044
|
let val = ['0', '0', '*', '*', '*', '?', '*'];
|
|
8037
8045
|
val[1] = props.value[1];
|
|
8038
8046
|
val[2] = e.target.value ? `0/${e.target.value}` : e.target.value;
|
|
@@ -8041,7 +8049,9 @@ const HourlyCron = (props) => {
|
|
|
8041
8049
|
}
|
|
8042
8050
|
};
|
|
8043
8051
|
const onMinuteChange = (e) => {
|
|
8044
|
-
if (!props.disabled &&
|
|
8052
|
+
if (!props.disabled &&
|
|
8053
|
+
state.every &&
|
|
8054
|
+
((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 60) || e.target.value === '')) {
|
|
8045
8055
|
let val = ['0', '0', '*', '*', '*', '?', '*'];
|
|
8046
8056
|
val[1] = e.target.value;
|
|
8047
8057
|
val[2] = props.value[2];
|
|
@@ -8080,7 +8090,7 @@ const HourlyCron = (props) => {
|
|
|
8080
8090
|
props.onChange();
|
|
8081
8091
|
};
|
|
8082
8092
|
const translateFn = props.translate;
|
|
8083
|
-
return (jsx("div", Object.assign({ className: "tab-content" }, { children: jsxs("div", Object.assign({ className: "tab-pane active" }, { children: [jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: onClickEveryHourMinute }, { children: [jsx("input", { name:
|
|
8093
|
+
return (jsx("div", Object.assign({ className: "tab-content" }, { children: jsxs("div", Object.assign({ className: "tab-pane active" }, { children: [jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: onClickEveryHourMinute }, { children: [jsx("input", { name: "EveryHourMinute", type: "radio", checked: state.every, disabled: props.disabled }), jsxs("span", { children: [translateFn('Every'), " "] }), jsx("input", { readOnly: !state.every, disabled: props.disabled, type: "Number", onChange: onHourChange, value: props.value[2].split('/')[1] ? props.value[2].split('/')[1] : '' }), jsx("span", { children: translateFn('hour') }), jsx("input", { readOnly: !state.every, disabled: props.disabled, type: "Number", onChange: onMinuteChange, value: props.value[1] }), jsx("span", { children: translateFn('minute(s)') })] })), jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: onClickEverySpecificHour }, { children: [jsx("input", { name: "EverySpecificHour", type: "radio", checked: !state.every, disabled: props.disabled }), jsx("span", { children: translateFn('At') }), jsx(HourSelect, { disabled: props.disabled, onChange: onAtHourChange, value: props.value[2] }), jsx(MinutesSelect, { disabled: props.disabled, onChange: onAtMinuteChange, value: props.value[1] })] }))] })) })));
|
|
8084
8094
|
};
|
|
8085
8095
|
|
|
8086
8096
|
const WeeklyCron = (props) => {
|
|
@@ -8117,7 +8127,7 @@ const WeeklyCron = (props) => {
|
|
|
8117
8127
|
props.onChange(val);
|
|
8118
8128
|
};
|
|
8119
8129
|
const onDayChecked = (val, e) => {
|
|
8120
|
-
val[2] =
|
|
8130
|
+
val[2] = `${val[2]}`.split('/').length > 1 ? '0' : val[2].toString();
|
|
8121
8131
|
val[3] = '?';
|
|
8122
8132
|
val[4] = '*';
|
|
8123
8133
|
if (val[5] === '*' || val[5] === '?' || val[5] === 'MON-FRI') {
|
|
@@ -8139,7 +8149,7 @@ const WeeklyCron = (props) => {
|
|
|
8139
8149
|
val[5] = valFive;
|
|
8140
8150
|
};
|
|
8141
8151
|
const translateFn = props.translate;
|
|
8142
|
-
return (jsxs("div", Object.assign({ className: "container-fluid" }, { children: [jsxs("div", Object.assign({ className: "well well-small row" }, { children: [jsx("div", Object.assign({ className: "span6 col-sm-6" }, { children: jsxs("div", Object.assign({ className: "text_align_left" }, { children: [jsx("input", { id: "mon-checkbox", className:
|
|
8152
|
+
return (jsxs("div", Object.assign({ className: "container-fluid" }, { children: [jsxs("div", Object.assign({ className: "well well-small row" }, { children: [jsx("div", Object.assign({ className: "span6 col-sm-6" }, { children: jsxs("div", Object.assign({ className: "text_align_left" }, { children: [jsx("input", { id: "mon-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "MON", onChange: onCheck, checked: props.value[5].search('MON') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "mon-checkbox" }, { children: translateFn('Monday') })), jsx("br", {}), jsx("input", { id: "wed-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "WED", onChange: onCheck, checked: props.value[5].search('WED') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "wed-checkbox" }, { children: translateFn('Wednesday') })), jsx("br", {}), jsx("input", { id: "fri-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "FRI", onChange: onCheck, checked: props.value[5].search('FRI') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "fri-checkbox" }, { children: translateFn('Friday') })), jsx("br", {}), jsx("input", { id: "sun-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "SUN", onChange: onCheck, checked: props.value[5].search('SUN') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "sun-checkbox" }, { children: translateFn('Sunday') }))] })) })), jsxs("div", Object.assign({ className: "span6 col-sm-6" }, { children: [jsxs("div", Object.assign({ className: "text_align_left" }, { children: [jsx("input", { id: "tue-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "TUE", onChange: onCheck, checked: props.value[5].search('TUE') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "tue-checkbox" }, { children: translateFn('Tuesday') })), jsx("br", {}), jsx("input", { id: "thu-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "THU", onChange: onCheck, checked: props.value[5].search('THU') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "thu-checkbox" }, { children: translateFn('Thursday') })), jsx("br", {}), jsx("input", { id: "sat-checkbox", className: "min_height_auto cursor_pointer", type: "checkbox", value: "SAT", onChange: onCheck, checked: props.value[5].search('SAT') !== -1 ? true : false, disabled: props.disabled }), jsx("label", Object.assign({ className: "cursor_pointer", htmlFor: "sat-checkbox" }, { children: translateFn('Saturday') }))] })), jsx("br", {}), jsx("br", {})] }))] })), translateFn('Start time'), jsx(HourSelect, { onChange: onAtHourChange, value: props.value[2], disabled: props.disabled }), jsx(MinutesSelect, { onChange: onAtMinuteChange, value: props.value[1], disabled: props.disabled })] })));
|
|
8143
8153
|
};
|
|
8144
8154
|
|
|
8145
8155
|
const DaySelect = ({ disabled, multi = false, onChange, value, }) => {
|
|
@@ -8152,16 +8162,19 @@ const DaySelect = ({ disabled, multi = false, onChange, value, }) => {
|
|
|
8152
8162
|
}, [ref, show]);
|
|
8153
8163
|
useEffect(() => {
|
|
8154
8164
|
// Bind the event listener
|
|
8155
|
-
document.addEventListener(
|
|
8165
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
8156
8166
|
return () => {
|
|
8157
8167
|
// Unbind the event listener on clean up
|
|
8158
|
-
document.removeEventListener(
|
|
8168
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
8159
8169
|
};
|
|
8160
8170
|
}, [handleClickOutside]);
|
|
8161
8171
|
const onSelect = (i) => {
|
|
8162
8172
|
if (multi && Array.isArray(value)) {
|
|
8163
8173
|
onChange((value.includes(i)
|
|
8164
|
-
? [
|
|
8174
|
+
? [
|
|
8175
|
+
...value.slice(0, value.indexOf(i)),
|
|
8176
|
+
...value.splice(value.indexOf(i) + 1, value.length - 1),
|
|
8177
|
+
]
|
|
8165
8178
|
: [...value, i]));
|
|
8166
8179
|
}
|
|
8167
8180
|
else {
|
|
@@ -8171,35 +8184,35 @@ const DaySelect = ({ disabled, multi = false, onChange, value, }) => {
|
|
|
8171
8184
|
const buildOptions = () => {
|
|
8172
8185
|
let options = [];
|
|
8173
8186
|
for (let i = 1; i <= 31; i++) {
|
|
8174
|
-
options.push(jsx("label", Object.assign({ className: `dropdown-item ${(Array.isArray(value) ? value.includes(i.toString()) : value === i.toString()) ?
|
|
8187
|
+
options.push(jsx("label", Object.assign({ className: `dropdown-item ${(Array.isArray(value) ? value.includes(i.toString()) : value === i.toString()) ? 'dropdown-item-selected' : ''}`, onClick: () => !disabled && onSelect(i.toString()) }, { children: i })));
|
|
8175
8188
|
}
|
|
8176
8189
|
return options;
|
|
8177
8190
|
};
|
|
8178
8191
|
return (jsxs("div", Object.assign({ className: "dropdown mx-2", ref: ref }, { children: [jsx("input", { disabled: disabled, className: "dropbtn mx-0", onClick: () => setShow((s) => !s), value: (Array.isArray(value) ? value.length : value)
|
|
8179
8192
|
? Array.isArray(value)
|
|
8180
|
-
? value.join(
|
|
8193
|
+
? value.join(',')
|
|
8181
8194
|
: value
|
|
8182
|
-
:
|
|
8195
|
+
: '' }), show && jsx("div", Object.assign({ className: "dropdown-content" }, { children: buildOptions() }))] })));
|
|
8183
8196
|
};
|
|
8184
8197
|
|
|
8185
8198
|
const MonthlyCron = (props) => {
|
|
8186
|
-
const [state, setState] = useState({ hour: 0, minute: 0, every:
|
|
8199
|
+
const [state, setState] = useState({ hour: 0, minute: 0, every: '' });
|
|
8187
8200
|
useEffect(() => {
|
|
8188
8201
|
let every;
|
|
8189
|
-
if (props.value[3] ===
|
|
8190
|
-
every =
|
|
8202
|
+
if (props.value[3] === 'L') {
|
|
8203
|
+
every = '2';
|
|
8191
8204
|
}
|
|
8192
|
-
else if (props.value[3] ===
|
|
8193
|
-
every =
|
|
8205
|
+
else if (props.value[3] === 'LW') {
|
|
8206
|
+
every = '3';
|
|
8194
8207
|
}
|
|
8195
|
-
else if (props.value[3].startsWith(
|
|
8196
|
-
every =
|
|
8208
|
+
else if (props.value[3].startsWith('L')) {
|
|
8209
|
+
every = '4';
|
|
8197
8210
|
}
|
|
8198
|
-
else if (props.value[3].includes(
|
|
8199
|
-
every =
|
|
8211
|
+
else if (props.value[3].includes('!')) {
|
|
8212
|
+
every = '5';
|
|
8200
8213
|
}
|
|
8201
8214
|
else {
|
|
8202
|
-
every =
|
|
8215
|
+
every = '1';
|
|
8203
8216
|
}
|
|
8204
8217
|
setState(Object.assign(Object.assign({}, state), { every: every }));
|
|
8205
8218
|
}, []);
|
|
@@ -8207,15 +8220,15 @@ const MonthlyCron = (props) => {
|
|
|
8207
8220
|
if (props.disabled) {
|
|
8208
8221
|
return;
|
|
8209
8222
|
}
|
|
8210
|
-
if ((parseInt(e.target.value) > 0 && parseInt(e.target.value) <= 31) || e.target.value ===
|
|
8223
|
+
if ((parseInt(e.target.value) > 0 && parseInt(e.target.value) <= 31) || e.target.value === '') {
|
|
8211
8224
|
let val = [
|
|
8212
|
-
|
|
8213
|
-
props.value[1] ===
|
|
8214
|
-
props.value[2] ===
|
|
8225
|
+
'0',
|
|
8226
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8227
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8215
8228
|
props.value[3],
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8229
|
+
'1/1',
|
|
8230
|
+
'?',
|
|
8231
|
+
'*',
|
|
8219
8232
|
];
|
|
8220
8233
|
val[3] = `${e.target.value}`;
|
|
8221
8234
|
props.onChange(val);
|
|
@@ -8226,33 +8239,34 @@ const MonthlyCron = (props) => {
|
|
|
8226
8239
|
return;
|
|
8227
8240
|
}
|
|
8228
8241
|
const val = [
|
|
8229
|
-
|
|
8230
|
-
props.value[1] ===
|
|
8231
|
-
props.value[2] ===
|
|
8242
|
+
'0',
|
|
8243
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8244
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8232
8245
|
props.value[3],
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8246
|
+
'1/1',
|
|
8247
|
+
'?',
|
|
8248
|
+
'*',
|
|
8236
8249
|
];
|
|
8237
|
-
val[3] = `${value.filter(p => p).join(
|
|
8250
|
+
val[3] = `${value.filter((p) => p).join('!')}`;
|
|
8238
8251
|
props.onChange(val);
|
|
8239
8252
|
};
|
|
8240
8253
|
const onLastDayChange = (e) => {
|
|
8241
8254
|
if (props.disabled) {
|
|
8242
8255
|
return;
|
|
8243
8256
|
}
|
|
8244
|
-
if ((parseInt(e.target.value) >> 0 && parseInt(e.target.value) <= 31) ||
|
|
8257
|
+
if ((parseInt(e.target.value) >> 0 && parseInt(e.target.value) <= 31) ||
|
|
8258
|
+
e.target.value === '') {
|
|
8245
8259
|
let val = [
|
|
8246
|
-
|
|
8247
|
-
props.value[1] ===
|
|
8248
|
-
props.value[2] ===
|
|
8260
|
+
'0',
|
|
8261
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8262
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8249
8263
|
props.value[3],
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8264
|
+
'1/1',
|
|
8265
|
+
'?',
|
|
8266
|
+
'*',
|
|
8253
8267
|
];
|
|
8254
|
-
if (e.target.value ===
|
|
8255
|
-
val[3] =
|
|
8268
|
+
if (e.target.value === '') {
|
|
8269
|
+
val[3] = '';
|
|
8256
8270
|
}
|
|
8257
8271
|
else {
|
|
8258
8272
|
val[3] = `L-${e.target.value}`;
|
|
@@ -8276,94 +8290,96 @@ const MonthlyCron = (props) => {
|
|
|
8276
8290
|
val[1] = `${e.target.value}`;
|
|
8277
8291
|
props.onChange(val);
|
|
8278
8292
|
};
|
|
8279
|
-
const onClickMonthlyOnceRadio = (value =
|
|
8280
|
-
if (props.disabled || state.every ===
|
|
8293
|
+
const onClickMonthlyOnceRadio = (value = '1') => {
|
|
8294
|
+
if (props.disabled || state.every === '1') {
|
|
8281
8295
|
return;
|
|
8282
8296
|
}
|
|
8283
8297
|
setState(Object.assign(Object.assign({}, state), { every: value }));
|
|
8284
8298
|
props.onChange([
|
|
8285
|
-
|
|
8286
|
-
props.value[1] ===
|
|
8287
|
-
props.value[2] ===
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8299
|
+
'0',
|
|
8300
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8301
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8302
|
+
'1',
|
|
8303
|
+
'1/1',
|
|
8304
|
+
'?',
|
|
8305
|
+
'*',
|
|
8292
8306
|
]);
|
|
8293
8307
|
};
|
|
8294
|
-
const onClickLastDayOfEveryMonth = (value =
|
|
8295
|
-
if (props.disabled || state.every ===
|
|
8308
|
+
const onClickLastDayOfEveryMonth = (value = '2') => {
|
|
8309
|
+
if (props.disabled || state.every === '2') {
|
|
8296
8310
|
return;
|
|
8297
8311
|
}
|
|
8298
8312
|
setState(Object.assign(Object.assign({}, state), { every: value }));
|
|
8299
8313
|
props.onChange([
|
|
8300
|
-
|
|
8301
|
-
props.value[1] ===
|
|
8302
|
-
props.value[2] ===
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8314
|
+
'0',
|
|
8315
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8316
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8317
|
+
'L',
|
|
8318
|
+
'*',
|
|
8319
|
+
'?',
|
|
8320
|
+
'*',
|
|
8307
8321
|
]);
|
|
8308
8322
|
};
|
|
8309
|
-
const onClickLastWeekdayOfEveryMonth = (value =
|
|
8310
|
-
if (props.disabled || state.every ===
|
|
8323
|
+
const onClickLastWeekdayOfEveryMonth = (value = '3') => {
|
|
8324
|
+
if (props.disabled || state.every === '3') {
|
|
8311
8325
|
return;
|
|
8312
8326
|
}
|
|
8313
8327
|
setState(Object.assign(Object.assign({}, state), { every: value }));
|
|
8314
8328
|
props.onChange([
|
|
8315
|
-
|
|
8316
|
-
props.value[1] ===
|
|
8317
|
-
props.value[2] ===
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8329
|
+
'0',
|
|
8330
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8331
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8332
|
+
'LW',
|
|
8333
|
+
'*',
|
|
8334
|
+
'?',
|
|
8335
|
+
'*',
|
|
8322
8336
|
]);
|
|
8323
8337
|
};
|
|
8324
|
-
const onClickDaysBeforeEndOfMonth = (value =
|
|
8325
|
-
if (props.disabled || state.every ===
|
|
8338
|
+
const onClickDaysBeforeEndOfMonth = (value = '4') => {
|
|
8339
|
+
if (props.disabled || state.every === '4') {
|
|
8326
8340
|
return;
|
|
8327
8341
|
}
|
|
8328
8342
|
setState(Object.assign(Object.assign({}, state), { every: value }));
|
|
8329
8343
|
props.onChange([
|
|
8330
|
-
|
|
8331
|
-
props.value[1] ===
|
|
8332
|
-
props.value[2] ===
|
|
8344
|
+
'0',
|
|
8345
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8346
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8333
8347
|
`L-${1}`,
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8348
|
+
'*',
|
|
8349
|
+
'?',
|
|
8350
|
+
'*',
|
|
8337
8351
|
]);
|
|
8338
8352
|
};
|
|
8339
|
-
const onClickMonthlyMultipleRadio = (value =
|
|
8340
|
-
if (props.disabled || state.every ===
|
|
8353
|
+
const onClickMonthlyMultipleRadio = (value = '5') => {
|
|
8354
|
+
if (props.disabled || state.every === '5') {
|
|
8341
8355
|
return;
|
|
8342
8356
|
}
|
|
8343
8357
|
setState(Object.assign(Object.assign({}, state), { every: value }));
|
|
8344
8358
|
props.onChange([
|
|
8345
|
-
|
|
8346
|
-
props.value[1] ===
|
|
8347
|
-
props.value[2] ===
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8359
|
+
'0',
|
|
8360
|
+
props.value[1] === '*' ? '0' : props.value[1],
|
|
8361
|
+
props.value[2] === '*' ? '0' : props.value[2],
|
|
8362
|
+
'1',
|
|
8363
|
+
'1/1',
|
|
8364
|
+
'?',
|
|
8365
|
+
'*',
|
|
8352
8366
|
]);
|
|
8353
8367
|
};
|
|
8354
8368
|
const translateFn = props.translate;
|
|
8355
|
-
return (jsxs("div", Object.assign({ className: "tab-pane" }, { children: [jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: () => onClickMonthlyOnceRadio() }, { children: [jsx("input", { type: "radio", value: "1", name: "MonthlyOnceRadio", checked: state.every ===
|
|
8369
|
+
return (jsxs("div", Object.assign({ className: "tab-pane" }, { children: [jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: () => onClickMonthlyOnceRadio() }, { children: [jsx("input", { type: "radio", value: "1", name: "MonthlyOnceRadio", checked: state.every === '1' ? true : false, disabled: props.disabled }), translateFn('Day'), jsx("input", { readOnly: state.every !== '1', type: "number", value: props.value[3], onChange: onDayChange, disabled: props.disabled }), translateFn('of every month(s)')] })), jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: () => onClickLastDayOfEveryMonth() }, { children: [jsx("input", { type: "radio", value: "2", name: "LastDayOfEveryMonth", checked: state.every === '2' ? true : false, disabled: props.disabled }), translateFn('Last day of every month')] })), jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: () => onClickLastWeekdayOfEveryMonth() }, { children: [jsx("input", { type: "radio", value: "3", name: "LastWeekdayOfEveryMonth", checked: state.every === '3' ? true : false, disabled: props.disabled }), translateFn('On the last weekday of every month')] })), jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: () => onClickDaysBeforeEndOfMonth() }, { children: [jsx("input", { type: "radio", value: "4", name: "DaysBeforeEndOfMonth", checked: state.every === '4' ? true : false, disabled: props.disabled }), jsx("input", { readOnly: state.every !== '4', type: "number", value: props.value[3].split('-').length && props.value[3].split('-')[1]
|
|
8370
|
+
? props.value[3].split('-')[1]
|
|
8371
|
+
: '', onChange: onLastDayChange, disabled: props.disabled }), translateFn('day(s) before the end of the month')] })), jsxs("div", Object.assign({ className: "well well-small cursor_pointer", onClick: () => onClickMonthlyMultipleRadio() }, { children: [jsx("input", { type: "radio", value: "5", name: "MonthlyMultipleRadio", checked: state.every === '5' ? true : false, disabled: props.disabled }), jsx(DaySelect, { onChange: (e) => onMultiDayChange(e), disabled: props.disabled, value: state.every === '5' ? props.value[3].split('!') : [], multi: true }), translateFn('Days of every month')] })), translateFn('Start time'), jsx(HourSelect, { onChange: onAtHourChange, value: props.value[2], disabled: props.disabled }), jsx(MinutesSelect, { onChange: onAtMinuteChange, value: props.value[1], disabled: props.disabled })] })));
|
|
8356
8372
|
};
|
|
8357
8373
|
|
|
8358
8374
|
const CustomCron = (props) => {
|
|
8359
8375
|
const onChange = (e) => {
|
|
8360
8376
|
if (props.disabled)
|
|
8361
8377
|
return;
|
|
8362
|
-
props.onChange(e.target.value.replace(/,/g, '!').split(
|
|
8378
|
+
props.onChange(e.target.value.replace(/,/g, '!').split(' '));
|
|
8363
8379
|
};
|
|
8364
8380
|
const translateFn = props.translate;
|
|
8365
8381
|
let val = props.value.toString().replace(/,/g, ' ').replace(/!/g, ',');
|
|
8366
|
-
return (jsxs("div", Object.assign({ className: "well" }, { children: [translateFn('Expression'),
|
|
8382
|
+
return (jsxs("div", Object.assign({ className: "well" }, { children: [translateFn('Expression'), ' ', jsx("input", { type: "text", onChange: onChange, value: val, disabled: props.disabled })] })));
|
|
8367
8383
|
};
|
|
8368
8384
|
|
|
8369
8385
|
const HEADER = {
|
|
@@ -8372,7 +8388,7 @@ const HEADER = {
|
|
|
8372
8388
|
DAILY: 'DAILY',
|
|
8373
8389
|
WEEKLY: 'WEEKLY',
|
|
8374
8390
|
MONTHLY: 'MONTHLY',
|
|
8375
|
-
CUSTOM: 'CUSTOM'
|
|
8391
|
+
CUSTOM: 'CUSTOM',
|
|
8376
8392
|
};
|
|
8377
8393
|
const HEADER_VALUES = {
|
|
8378
8394
|
MINUTES: 'Minutes',
|
|
@@ -8380,44 +8396,51 @@ const HEADER_VALUES = {
|
|
|
8380
8396
|
DAILY: 'Daily',
|
|
8381
8397
|
WEEKLY: 'Weekly',
|
|
8382
8398
|
MONTHLY: 'Monthly',
|
|
8383
|
-
CUSTOM: 'Custom'
|
|
8399
|
+
CUSTOM: 'Custom',
|
|
8384
8400
|
};
|
|
8385
|
-
const defaultTabs = [
|
|
8401
|
+
const defaultTabs = [
|
|
8402
|
+
HEADER_VALUES.MINUTES,
|
|
8403
|
+
HEADER_VALUES.HOURLY,
|
|
8404
|
+
HEADER_VALUES.DAILY,
|
|
8405
|
+
HEADER_VALUES.WEEKLY,
|
|
8406
|
+
HEADER_VALUES.MONTHLY,
|
|
8407
|
+
HEADER_VALUES.CUSTOM,
|
|
8408
|
+
];
|
|
8386
8409
|
const metadata = [
|
|
8387
8410
|
{
|
|
8388
8411
|
component: MinutesCron,
|
|
8389
8412
|
name: HEADER_VALUES.MINUTES,
|
|
8390
|
-
initialCron: ['0', '0/1', '*', '*', '*', '?', '*']
|
|
8413
|
+
initialCron: ['0', '0/1', '*', '*', '*', '?', '*'],
|
|
8391
8414
|
},
|
|
8392
8415
|
{
|
|
8393
8416
|
component: HourlyCron,
|
|
8394
8417
|
name: HEADER_VALUES.HOURLY,
|
|
8395
|
-
initialCron: ['0', '0', '00', '1/1', '*', '?', '*']
|
|
8418
|
+
initialCron: ['0', '0', '00', '1/1', '*', '?', '*'],
|
|
8396
8419
|
},
|
|
8397
8420
|
{
|
|
8398
8421
|
component: DailyCron,
|
|
8399
8422
|
name: HEADER_VALUES.DAILY,
|
|
8400
|
-
initialCron: ['0', '0', '00', '1/1', '*', '?', '*']
|
|
8423
|
+
initialCron: ['0', '0', '00', '1/1', '*', '?', '*'],
|
|
8401
8424
|
},
|
|
8402
8425
|
{
|
|
8403
8426
|
component: WeeklyCron,
|
|
8404
8427
|
name: HEADER_VALUES.WEEKLY,
|
|
8405
|
-
initialCron: ['0', '0', '00', '?', '*', '*', '*']
|
|
8428
|
+
initialCron: ['0', '0', '00', '?', '*', '*', '*'],
|
|
8406
8429
|
},
|
|
8407
8430
|
{
|
|
8408
8431
|
component: MonthlyCron,
|
|
8409
8432
|
name: HEADER_VALUES.MONTHLY,
|
|
8410
|
-
initialCron: ['0', '0', '00', '1', '1/1', '?', '*']
|
|
8433
|
+
initialCron: ['0', '0', '00', '1', '1/1', '?', '*'],
|
|
8411
8434
|
},
|
|
8412
8435
|
{
|
|
8413
8436
|
component: CustomCron,
|
|
8414
8437
|
name: HEADER_VALUES.CUSTOM,
|
|
8415
|
-
initialCron: ['*', '*', '*', '*', '*', '*', '*']
|
|
8416
|
-
}
|
|
8438
|
+
initialCron: ['*', '*', '*', '*', '*', '*', '*'],
|
|
8439
|
+
},
|
|
8417
8440
|
];
|
|
8418
8441
|
const validateHeaders = (headers) => {
|
|
8419
8442
|
const validatedHeaders = [];
|
|
8420
|
-
headers.forEach(header => {
|
|
8443
|
+
headers.forEach((header) => {
|
|
8421
8444
|
if (!HEADER_VALUES[header]) {
|
|
8422
8445
|
throw new Error('Invalid header ' + header);
|
|
8423
8446
|
// Avoid duplicates
|
|
@@ -8519,18 +8542,22 @@ function styleInject(css, ref) {
|
|
|
8519
8542
|
}
|
|
8520
8543
|
}
|
|
8521
8544
|
|
|
8522
|
-
var css_248z = ".cron_builder_bordering {\n
|
|
8545
|
+
var css_248z = ".cron_builder_bordering {\n border: 1px solid #ddd;\n border-top: none;\n text-align: center;\n padding: 10px;\n background: #fff;\n}\n.cron_builder_bordering input,\n.cron_builder_bordering select {\n width: 100px;\n margin-right: 10px;\n margin-left: 10px;\n border: 1px solid #ddd;\n border-radius: 4px;\n outline: none;\n padding: 0px 5px;\n min-height: 28px;\n}\n.df {\n display: flex;\n}\n.cron-builder-bg {\n background-color: #086090;\n color: white;\n text-align: center;\n margin-bottom: 4px;\n padding: 8px 0px;\n}\n.cron_builder_bordering select {\n background-color: white;\n width: 75px;\n cursor: pointer;\n padding: 4px 2px;\n border-radius: 4px;\n}\n.cron_builder_bordering select:disabled {\n background-color: #f5f5f5;\n cursor: default;\n}\n.cron_builder_bordering select option:hover {\n background-color: #086090;\n}\n.well-small input {\n width: auto !important;\n}\n.cron_builder_bordering input[type='radio'] {\n margin-top: 0px;\n vertical-align: middle;\n}\n.cron_builder {\n border: 1px solid #d0cbcb;\n padding: 5px;\n background-color: #dddef13d;\n width: 100%;\n max-width: 600px;\n}\n.text_align_left {\n text-align: left;\n}\n.cron_builder .nav li {\n cursor: pointer;\n flex: 1 1 10px;\n text-align: center;\n width: 10px;\n display: flex;\n padding: 0px 1px;\n}\n.cron_builder .nav li a {\n color: #337ab7;\n width: 100%;\n padding: 10px;\n display: inline-block;\n border-radius: 4px 4px 0px 0px;\n}\n.cron_builder .nav-tabs .nav-link:focus,\n.cron_builder .nav-tabs .nav-link:hover {\n border-color: transparent transparent transparent;\n background-color: #eeeeee;\n}\n.cron_builder .nav-tabs .nav-item.show .nav-link,\n.cron_builder .nav-tabs .nav-link.active {\n border-color: #dee2e6 #dee2e6 #fff;\n background-color: #ffffff;\n}\n.cron_builder .nav-tabs .nav-item.show .nav-link,\n.cron_builder .nav-tabs .nav-link.disabled {\n color: #6c757d;\n background-color: #ffffff;\n border-color: transparent transparent #ffffff;\n cursor: not-allowed;\n}\n.cron_builder {\n font-size: 14px;\n}\n.cron_builder .well {\n min-height: 20px;\n padding: 19px;\n margin-bottom: 20px;\n background-color: #f5f5f5;\n border: 1px solid #e3e3e3;\n border-radius: 4px;\n -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 5%);\n box-shadow: inset 0 1px 1px rgb(0 0 0 / 5%);\n}\n@media screen and (max-width: 767px) {\n .cron_builder .nav li {\n cursor: pointer;\n flex: 0 0 65px;\n text-align: center;\n }\n}\n\n/* ---- boostrap ----- */\n.cron_builder .nav.nav-tabs {\n list-style: none;\n display: flex;\n margin: 0 0;\n padding-left: 0;\n}\n.cron_builder .row {\n display: flex;\n}\n.cron_builder .col-sm-6 {\n flex: 0 0 50%;\n}\n.cron_builder .min_height_auto {\n min-height: auto !important;\n}\n.cron_builder {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n 'Noto Color Emoji';\n}\n.cron_builder .cursor_pointer {\n cursor: pointer;\n}\n\n.cron_builder .dropbtn {\n cursor: pointer;\n}\n\n.cron_builder .dropdown {\n position: relative;\n display: inline-block;\n}\n\n.cron_builder .dropdown-content {\n position: absolute;\n background-color: #f1f1f1;\n min-width: 140px;\n overflow: auto;\n box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);\n z-index: 1;\n left: 0;\n right: 0;\n text-align: left;\n max-height: 150px;\n overflow: auto;\n}\n\n@media screen and (min-height: 800px) {\n .cron_builder .dropdown-content {\n max-height: 200px;\n }\n}\n\n.cron_builder .dropdown-content .dropdown-item {\n color: black;\n padding: 12px 16px;\n text-decoration: none;\n display: block;\n}\n\n.cron_builder .dropdown-content .dropdown-item:hover,\n.cron_builder .dropdown-content .dropdown-item-selected {\n background-color: #086090;\n color: white;\n}\n\n.cron_builder .mx-0 {\n margin-left: 0 !important;\n margin-right: 0 !important;\n}\n.cron_builder .mx-2 {\n margin-left: 10px !important;\n margin-right: 10px !important;\n}\n";
|
|
8523
8546
|
styleInject(css_248z);
|
|
8524
8547
|
|
|
8525
8548
|
const defaultCron = '0 0 00 1/1 * ? *';
|
|
8526
8549
|
const Cron = (props) => {
|
|
8527
|
-
const [state, setState] = useState({
|
|
8550
|
+
const [state, setState] = useState({
|
|
8551
|
+
value: [],
|
|
8552
|
+
headers: loadHeaders(props.options),
|
|
8553
|
+
locale: props.locale ? props.locale : 'en',
|
|
8554
|
+
});
|
|
8528
8555
|
useEffect(() => {
|
|
8529
8556
|
let newVal = '';
|
|
8530
8557
|
newVal = state.value.toString().replace(/,/g, ' ');
|
|
8531
8558
|
newVal = newVal.replace(/!/g, ',');
|
|
8532
8559
|
if (props.value !== newVal) {
|
|
8533
|
-
setValue(props.value ? props.value :
|
|
8560
|
+
setValue(props.value ? props.value : '');
|
|
8534
8561
|
}
|
|
8535
8562
|
if (props.translateFn && !props.locale) {
|
|
8536
8563
|
console.warn('Warning !!! locale not set while using translateFn');
|
|
@@ -8549,20 +8576,20 @@ const Cron = (props) => {
|
|
|
8549
8576
|
if (!value || value.split(' ').length !== 7) {
|
|
8550
8577
|
value = '0 0 00 1/1 * ? *';
|
|
8551
8578
|
prevState.selectedTab = allHeaders[0];
|
|
8552
|
-
prevState.value = value.split(
|
|
8553
|
-
parentChange(value.split(
|
|
8579
|
+
prevState.value = value.split(' ');
|
|
8580
|
+
parentChange(value.split(' '));
|
|
8554
8581
|
}
|
|
8555
8582
|
else {
|
|
8556
8583
|
prevState.value = value.replace(/,/g, '!').split(' ');
|
|
8557
8584
|
}
|
|
8558
8585
|
let val = prevState.value;
|
|
8559
|
-
if (
|
|
8586
|
+
if (val[1].search('/') !== -1 && val[2] === '*' && val[3] === '1/1') {
|
|
8560
8587
|
prevState.selectedTab = allHeaders[0];
|
|
8561
8588
|
}
|
|
8562
|
-
else if (
|
|
8589
|
+
else if (val[3] === '1/1') {
|
|
8563
8590
|
prevState.selectedTab = allHeaders[1];
|
|
8564
8591
|
}
|
|
8565
|
-
else if (
|
|
8592
|
+
else if (val[3].search('/') !== -1 || val[5] === 'MON-FRI') {
|
|
8566
8593
|
prevState.selectedTab = allHeaders[2];
|
|
8567
8594
|
}
|
|
8568
8595
|
else if (val[3] === '?') {
|
|
@@ -8586,7 +8613,7 @@ const Cron = (props) => {
|
|
|
8586
8613
|
};
|
|
8587
8614
|
const getHeaders = () => {
|
|
8588
8615
|
return state.headers.map((d, index) => {
|
|
8589
|
-
return jsx("li", Object.assign({ className: "nav-item" }, { children: jsx("a", Object.assign({ className: `nav-link ${state.selectedTab === d ? 'active' : ''} ${props.disabled ?
|
|
8616
|
+
return (jsx("li", Object.assign({ className: "nav-item" }, { children: jsx("a", Object.assign({ className: `nav-link ${state.selectedTab === d ? 'active' : ''} ${props.disabled ? 'disabled' : ''}`, onClick: () => tabChanged(d) }, { children: translate(d) })) }), index));
|
|
8590
8617
|
});
|
|
8591
8618
|
};
|
|
8592
8619
|
const onValueChange = (val) => {
|
|
@@ -8605,30 +8632,33 @@ const Cron = (props) => {
|
|
|
8605
8632
|
props.onChange(newVal, getVal());
|
|
8606
8633
|
};
|
|
8607
8634
|
const getVal = () => {
|
|
8608
|
-
let val = i18n.toString(state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), {
|
|
8635
|
+
let val = i18n.toString(state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), {
|
|
8636
|
+
throwExceptionOnParseError: false,
|
|
8637
|
+
locale: state.locale,
|
|
8638
|
+
});
|
|
8609
8639
|
if (val.search('undefined') === -1 && state.value && state.value.length) {
|
|
8610
8640
|
return val;
|
|
8611
8641
|
}
|
|
8612
8642
|
return '-';
|
|
8613
8643
|
};
|
|
8614
8644
|
const defaultValue = (tab) => {
|
|
8615
|
-
let defaultValCron = metadata.find(m => m.name == tab);
|
|
8645
|
+
let defaultValCron = metadata.find((m) => m.name == tab);
|
|
8616
8646
|
if (!defaultValCron || !defaultValCron.initialCron) {
|
|
8617
|
-
return defaultCron.split(
|
|
8647
|
+
return defaultCron.split(' ');
|
|
8618
8648
|
}
|
|
8619
|
-
return defaultValCron.initialCron;
|
|
8649
|
+
return [...defaultValCron.initialCron];
|
|
8620
8650
|
};
|
|
8621
8651
|
const getComponent = (tab) => {
|
|
8622
8652
|
const index = state.headers.indexOf(tab);
|
|
8623
|
-
let selectedMetaData = metadata.find(data => data.name === tab);
|
|
8653
|
+
let selectedMetaData = metadata.find((data) => data.name === tab);
|
|
8624
8654
|
if (!selectedMetaData) {
|
|
8625
|
-
selectedMetaData = metadata[index];
|
|
8655
|
+
selectedMetaData = Object.assign({}, metadata[index]);
|
|
8626
8656
|
}
|
|
8627
8657
|
if (!selectedMetaData) {
|
|
8628
8658
|
throw new Error('Value does not match any available headers.');
|
|
8629
8659
|
}
|
|
8630
8660
|
const CronComponent = selectedMetaData.component;
|
|
8631
|
-
return jsx(CronComponent, { translate: translate, value: state.value, onChange: onValueChange, disabled: props.disabled });
|
|
8661
|
+
return (jsx(CronComponent, { translate: translate, value: state.value, onChange: onValueChange, disabled: props.disabled }));
|
|
8632
8662
|
};
|
|
8633
8663
|
const translate = (key) => {
|
|
8634
8664
|
let translatedText = key;
|
|
@@ -8643,7 +8673,7 @@ const Cron = (props) => {
|
|
|
8643
8673
|
}
|
|
8644
8674
|
return translatedText;
|
|
8645
8675
|
};
|
|
8646
|
-
return (jsxs("div", Object.assign({ className:
|
|
8676
|
+
return (jsxs("div", Object.assign({ className: "cron_builder" }, { children: [jsx("ul", Object.assign({ className: "nav nav-tabs" }, { children: getHeaders() })), jsx("div", Object.assign({ className: "cron_builder_bordering" }, { children: state.selectedTab ? getComponent(state.selectedTab) : 'Select a header' })), props.showResultText && jsx("div", Object.assign({ className: "cron-builder-bg" }, { children: getVal() })), props.showResultCron && (jsx("div", Object.assign({ className: "cron-builder-bg" }, { children: state.value.toString().replace(/,/g, ' ').replace(/!/g, ',') })))] })));
|
|
8647
8677
|
};
|
|
8648
8678
|
|
|
8649
8679
|
export { HEADER, i18n as cronstrue, Cron as default };
|