react-cron-generator 2.0.15 → 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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useEffect } from 'react';
2
+ import { useState, useEffect, useRef, useCallback } from 'react';
3
3
 
4
4
  var cronstrueI18n = {exports: {}};
5
5
 
@@ -222,11 +222,17 @@ var cronstrueI18n = {exports: {}};
222
222
  }
223
223
  };
224
224
  CronParser.prototype.validate = function (parsed) {
225
- this.assertNoInvalidCharacters("DOW", parsed[5]);
226
- this.assertNoInvalidCharacters("DOM", parsed[3]);
227
- this.validateRange(parsed);
228
- };
229
- CronParser.prototype.validateRange = function (parsed) {
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.assertNoInvalidCharacters = function (partDescription, expression) {
238
- var invalidChars = expression.match(/[A-KM-VX-Z]+/gi);
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("".concat(partDescription, " part contains invalid values: '").concat(invalidChars.toString(), "'"));
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 "在每分钟的第 %s 到 %s 秒";
7478
+ return "在一分钟后的第 %s 到 %s 秒";
7473
7479
  };
7474
7480
  zh_CN.prototype.atX0SecondsPastTheMinute = function () {
7475
- return "在每分钟的第 %s 秒";
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 "在每小时的第 %s 到 %s 分钟";
7487
+ return "在整点后的第 %s 到 %s 分钟";
7482
7488
  };
7483
7489
  zh_CN.prototype.atX0MinutesPastTheHour = function () {
7484
- return "在每小时的第 %s 分钟";
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 "在每分鐘的 %s 到 %s 秒";
7659
+ return "在一分鐘後的 %s 到 %s 秒";
7654
7660
  };
7655
7661
  zh_TW.prototype.atX0SecondsPastTheMinute = function () {
7656
- return "在每分鐘的 %s 秒";
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 "在每小時的 %s 到 %s 分鐘";
7668
+ return "在整點後的 %s 到 %s 分鐘";
7663
7669
  };
7664
7670
  zh_TW.prototype.atX0MinutesPastTheHour = function () {
7665
- return "在每小時的 %s 分";
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'), " ", jsx("input", { type: "Number", onChange: onChange, value: value, min: 1, max: 60, disabled: props.disabled }), " ", props.translate('minute(s)')] })));
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, (e.target.value ? `1/${e.target.value}` : e.target.value));
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 && state.every && ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 24) || e.target.value === '')) {
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 && state.every && ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 60) || e.target.value === '')) {
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: '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] })] }))] })) })));
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] = (`${val[2]}`.split('/').length > 1) ? '0' : val[2].toString();
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,27 +8149,70 @@ 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: '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 })] })));
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 })] })));
8153
+ };
8154
+
8155
+ const DaySelect = ({ disabled, multi = false, onChange, value, }) => {
8156
+ const [show, setShow] = useState(false);
8157
+ const ref = useRef(null);
8158
+ const handleClickOutside = useCallback((event) => {
8159
+ if (show && ref.current && !ref.current.contains(event.target)) {
8160
+ setShow(false);
8161
+ }
8162
+ }, [ref, show]);
8163
+ useEffect(() => {
8164
+ // Bind the event listener
8165
+ document.addEventListener('mousedown', handleClickOutside);
8166
+ return () => {
8167
+ // Unbind the event listener on clean up
8168
+ document.removeEventListener('mousedown', handleClickOutside);
8169
+ };
8170
+ }, [handleClickOutside]);
8171
+ const onSelect = (i) => {
8172
+ if (multi && Array.isArray(value)) {
8173
+ onChange((value.includes(i)
8174
+ ? [
8175
+ ...value.slice(0, value.indexOf(i)),
8176
+ ...value.splice(value.indexOf(i) + 1, value.length - 1),
8177
+ ]
8178
+ : [...value, i]));
8179
+ }
8180
+ else {
8181
+ onChange((value === i ? null : i));
8182
+ }
8183
+ };
8184
+ const buildOptions = () => {
8185
+ let options = [];
8186
+ for (let i = 1; i <= 31; i++) {
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 })));
8188
+ }
8189
+ return options;
8190
+ };
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)
8192
+ ? Array.isArray(value)
8193
+ ? value.join(',')
8194
+ : value
8195
+ : '' }), show && jsx("div", Object.assign({ className: "dropdown-content" }, { children: buildOptions() }))] })));
8143
8196
  };
8144
8197
 
8145
8198
  const MonthlyCron = (props) => {
8146
- const [state, setState] = useState({ hour: 0, minute: 0, every: "" });
8199
+ const [state, setState] = useState({ hour: 0, minute: 0, every: '' });
8147
8200
  useEffect(() => {
8148
8201
  let every;
8149
- if (props.value[3] === "L") {
8150
- every = "2";
8202
+ if (props.value[3] === 'L') {
8203
+ every = '2';
8151
8204
  }
8152
- else if (props.value[3] === "LW") {
8153
- every = "3";
8205
+ else if (props.value[3] === 'LW') {
8206
+ every = '3';
8154
8207
  }
8155
- else if (props.value[3].startsWith("L")) {
8156
- every = "4";
8208
+ else if (props.value[3].startsWith('L')) {
8209
+ every = '4';
8157
8210
  }
8158
- else if (props.value[3].includes("!")) {
8159
- every = "5";
8211
+ else if (props.value[3].includes('!')) {
8212
+ every = '5';
8160
8213
  }
8161
8214
  else {
8162
- every = "1";
8215
+ every = '1';
8163
8216
  }
8164
8217
  setState(Object.assign(Object.assign({}, state), { every: every }));
8165
8218
  }, []);
@@ -8167,58 +8220,53 @@ const MonthlyCron = (props) => {
8167
8220
  if (props.disabled) {
8168
8221
  return;
8169
8222
  }
8170
- 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 === '') {
8171
8224
  let val = [
8172
- "0",
8173
- props.value[1] === "*" ? "0" : props.value[1],
8174
- props.value[2] === "*" ? "0" : props.value[2],
8225
+ '0',
8226
+ props.value[1] === '*' ? '0' : props.value[1],
8227
+ props.value[2] === '*' ? '0' : props.value[2],
8175
8228
  props.value[3],
8176
- "1/1",
8177
- "?",
8178
- "*",
8229
+ '1/1',
8230
+ '?',
8231
+ '*',
8179
8232
  ];
8180
8233
  val[3] = `${e.target.value}`;
8181
8234
  props.onChange(val);
8182
8235
  }
8183
8236
  };
8184
- const onMultiDayChange = (e) => {
8237
+ const onMultiDayChange = (value) => {
8185
8238
  if (props.disabled) {
8186
8239
  return;
8187
8240
  }
8188
- if (e.target.value === "" ||
8189
- e.target.value
8190
- .split(",")
8191
- .map((day) => day.trim() ? parseInt(day.trim()) : day)
8192
- .every((day) => typeof day !== "string" ? (day > 0 && day <= 31) : day === "")) {
8193
- let val = [
8194
- "0",
8195
- props.value[1] === "*" ? "0" : props.value[1],
8196
- props.value[2] === "*" ? "0" : props.value[2],
8197
- props.value[3],
8198
- "1/1",
8199
- "?",
8200
- "*",
8201
- ];
8202
- val[3] = `${e.target.value.replaceAll(",", "!")}`;
8203
- props.onChange(val);
8204
- }
8241
+ const val = [
8242
+ '0',
8243
+ props.value[1] === '*' ? '0' : props.value[1],
8244
+ props.value[2] === '*' ? '0' : props.value[2],
8245
+ props.value[3],
8246
+ '1/1',
8247
+ '?',
8248
+ '*',
8249
+ ];
8250
+ val[3] = `${value.filter((p) => p).join('!')}`;
8251
+ props.onChange(val);
8205
8252
  };
8206
8253
  const onLastDayChange = (e) => {
8207
8254
  if (props.disabled) {
8208
8255
  return;
8209
8256
  }
8210
- if ((parseInt(e.target.value) >> 0 && parseInt(e.target.value) <= 31) || e.target.value === "") {
8257
+ if ((parseInt(e.target.value) >> 0 && parseInt(e.target.value) <= 31) ||
8258
+ e.target.value === '') {
8211
8259
  let val = [
8212
- "0",
8213
- props.value[1] === "*" ? "0" : props.value[1],
8214
- props.value[2] === "*" ? "0" : props.value[2],
8260
+ '0',
8261
+ props.value[1] === '*' ? '0' : props.value[1],
8262
+ props.value[2] === '*' ? '0' : props.value[2],
8215
8263
  props.value[3],
8216
- "1/1",
8217
- "?",
8218
- "*",
8264
+ '1/1',
8265
+ '?',
8266
+ '*',
8219
8267
  ];
8220
- if (e.target.value === "") {
8221
- val[3] = "";
8268
+ if (e.target.value === '') {
8269
+ val[3] = '';
8222
8270
  }
8223
8271
  else {
8224
8272
  val[3] = `L-${e.target.value}`;
@@ -8242,94 +8290,96 @@ const MonthlyCron = (props) => {
8242
8290
  val[1] = `${e.target.value}`;
8243
8291
  props.onChange(val);
8244
8292
  };
8245
- const onClickMonthlyOnceRadio = (value = "1") => {
8246
- if (props.disabled || state.every === "1") {
8293
+ const onClickMonthlyOnceRadio = (value = '1') => {
8294
+ if (props.disabled || state.every === '1') {
8247
8295
  return;
8248
8296
  }
8249
8297
  setState(Object.assign(Object.assign({}, state), { every: value }));
8250
8298
  props.onChange([
8251
- "0",
8252
- props.value[1] === "*" ? "0" : props.value[1],
8253
- props.value[2] === "*" ? "0" : props.value[2],
8254
- "1",
8255
- "1/1",
8256
- "?",
8257
- "*",
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
+ '*',
8258
8306
  ]);
8259
8307
  };
8260
- const onClickLastDayOfEveryMonth = (value = "2") => {
8261
- if (props.disabled || state.every === "2") {
8308
+ const onClickLastDayOfEveryMonth = (value = '2') => {
8309
+ if (props.disabled || state.every === '2') {
8262
8310
  return;
8263
8311
  }
8264
8312
  setState(Object.assign(Object.assign({}, state), { every: value }));
8265
8313
  props.onChange([
8266
- "0",
8267
- props.value[1] === "*" ? "0" : props.value[1],
8268
- props.value[2] === "*" ? "0" : props.value[2],
8269
- "L",
8270
- "*",
8271
- "?",
8272
- "*",
8314
+ '0',
8315
+ props.value[1] === '*' ? '0' : props.value[1],
8316
+ props.value[2] === '*' ? '0' : props.value[2],
8317
+ 'L',
8318
+ '*',
8319
+ '?',
8320
+ '*',
8273
8321
  ]);
8274
8322
  };
8275
- const onClickLastWeekdayOfEveryMonth = (value = "3") => {
8276
- if (props.disabled || state.every === "3") {
8323
+ const onClickLastWeekdayOfEveryMonth = (value = '3') => {
8324
+ if (props.disabled || state.every === '3') {
8277
8325
  return;
8278
8326
  }
8279
8327
  setState(Object.assign(Object.assign({}, state), { every: value }));
8280
8328
  props.onChange([
8281
- "0",
8282
- props.value[1] === "*" ? "0" : props.value[1],
8283
- props.value[2] === "*" ? "0" : props.value[2],
8284
- "LW",
8285
- "*",
8286
- "?",
8287
- "*",
8329
+ '0',
8330
+ props.value[1] === '*' ? '0' : props.value[1],
8331
+ props.value[2] === '*' ? '0' : props.value[2],
8332
+ 'LW',
8333
+ '*',
8334
+ '?',
8335
+ '*',
8288
8336
  ]);
8289
8337
  };
8290
- const onClickDaysBeforeEndOfMonth = (value = "4") => {
8291
- if (props.disabled || state.every === "4") {
8338
+ const onClickDaysBeforeEndOfMonth = (value = '4') => {
8339
+ if (props.disabled || state.every === '4') {
8292
8340
  return;
8293
8341
  }
8294
8342
  setState(Object.assign(Object.assign({}, state), { every: value }));
8295
8343
  props.onChange([
8296
- "0",
8297
- props.value[1] === "*" ? "0" : props.value[1],
8298
- props.value[2] === "*" ? "0" : props.value[2],
8344
+ '0',
8345
+ props.value[1] === '*' ? '0' : props.value[1],
8346
+ props.value[2] === '*' ? '0' : props.value[2],
8299
8347
  `L-${1}`,
8300
- "*",
8301
- "?",
8302
- "*",
8348
+ '*',
8349
+ '?',
8350
+ '*',
8303
8351
  ]);
8304
8352
  };
8305
- const onClickMonthlyMultipleRadio = (value = "5") => {
8306
- if (props.disabled || state.every === "5") {
8353
+ const onClickMonthlyMultipleRadio = (value = '5') => {
8354
+ if (props.disabled || state.every === '5') {
8307
8355
  return;
8308
8356
  }
8309
8357
  setState(Object.assign(Object.assign({}, state), { every: value }));
8310
8358
  props.onChange([
8311
- "0",
8312
- props.value[1] === "*" ? "0" : props.value[1],
8313
- props.value[2] === "*" ? "0" : props.value[2],
8314
- "1",
8315
- "1/1",
8316
- "?",
8317
- "*",
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
+ '*',
8318
8366
  ]);
8319
8367
  };
8320
8368
  const translateFn = props.translate;
8321
- 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] ? props.value[3].split("-")[1] : "", 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("input", { readOnly: state.every !== "5", type: "text", value: state.every === "5" ? props.value[3].replaceAll("!", ",") : "", onChange: onMultiDayChange, disabled: props.disabled }), translateFn("Days of every month (comma separated dates)")] })), 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 })] })));
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 })] })));
8322
8372
  };
8323
8373
 
8324
8374
  const CustomCron = (props) => {
8325
8375
  const onChange = (e) => {
8326
8376
  if (props.disabled)
8327
8377
  return;
8328
- props.onChange(e.target.value.replace(/,/g, '!').split(" "));
8378
+ props.onChange(e.target.value.replace(/,/g, '!').split(' '));
8329
8379
  };
8330
8380
  const translateFn = props.translate;
8331
8381
  let val = props.value.toString().replace(/,/g, ' ').replace(/!/g, ',');
8332
- return (jsxs("div", Object.assign({ className: "well" }, { children: [translateFn('Expression'), " ", jsx("input", { type: "text", onChange: onChange, value: val, disabled: props.disabled })] })));
8382
+ return (jsxs("div", Object.assign({ className: "well" }, { children: [translateFn('Expression'), ' ', jsx("input", { type: "text", onChange: onChange, value: val, disabled: props.disabled })] })));
8333
8383
  };
8334
8384
 
8335
8385
  const HEADER = {
@@ -8338,7 +8388,7 @@ const HEADER = {
8338
8388
  DAILY: 'DAILY',
8339
8389
  WEEKLY: 'WEEKLY',
8340
8390
  MONTHLY: 'MONTHLY',
8341
- CUSTOM: 'CUSTOM'
8391
+ CUSTOM: 'CUSTOM',
8342
8392
  };
8343
8393
  const HEADER_VALUES = {
8344
8394
  MINUTES: 'Minutes',
@@ -8346,44 +8396,51 @@ const HEADER_VALUES = {
8346
8396
  DAILY: 'Daily',
8347
8397
  WEEKLY: 'Weekly',
8348
8398
  MONTHLY: 'Monthly',
8349
- CUSTOM: 'Custom'
8399
+ CUSTOM: 'Custom',
8350
8400
  };
8351
- const defaultTabs = [HEADER_VALUES.MINUTES, HEADER_VALUES.HOURLY, HEADER_VALUES.DAILY, HEADER_VALUES.WEEKLY, HEADER_VALUES.MONTHLY, HEADER_VALUES.CUSTOM];
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
+ ];
8352
8409
  const metadata = [
8353
8410
  {
8354
8411
  component: MinutesCron,
8355
8412
  name: HEADER_VALUES.MINUTES,
8356
- initialCron: ['0', '0/1', '*', '*', '*', '?', '*']
8413
+ initialCron: ['0', '0/1', '*', '*', '*', '?', '*'],
8357
8414
  },
8358
8415
  {
8359
8416
  component: HourlyCron,
8360
8417
  name: HEADER_VALUES.HOURLY,
8361
- initialCron: ['0', '0', '00', '1/1', '*', '?', '*']
8418
+ initialCron: ['0', '0', '00', '1/1', '*', '?', '*'],
8362
8419
  },
8363
8420
  {
8364
8421
  component: DailyCron,
8365
8422
  name: HEADER_VALUES.DAILY,
8366
- initialCron: ['0', '0', '00', '1/1', '*', '?', '*']
8423
+ initialCron: ['0', '0', '00', '1/1', '*', '?', '*'],
8367
8424
  },
8368
8425
  {
8369
8426
  component: WeeklyCron,
8370
8427
  name: HEADER_VALUES.WEEKLY,
8371
- initialCron: ['0', '0', '00', '?', '*', '*', '*']
8428
+ initialCron: ['0', '0', '00', '?', '*', '*', '*'],
8372
8429
  },
8373
8430
  {
8374
8431
  component: MonthlyCron,
8375
8432
  name: HEADER_VALUES.MONTHLY,
8376
- initialCron: ['0', '0', '00', '1', '1/1', '?', '*']
8433
+ initialCron: ['0', '0', '00', '1', '1/1', '?', '*'],
8377
8434
  },
8378
8435
  {
8379
8436
  component: CustomCron,
8380
8437
  name: HEADER_VALUES.CUSTOM,
8381
- initialCron: ['*', '*', '*', '*', '*', '*', '*']
8382
- }
8438
+ initialCron: ['*', '*', '*', '*', '*', '*', '*'],
8439
+ },
8383
8440
  ];
8384
8441
  const validateHeaders = (headers) => {
8385
8442
  const validatedHeaders = [];
8386
- headers.forEach(header => {
8443
+ headers.forEach((header) => {
8387
8444
  if (!HEADER_VALUES[header]) {
8388
8445
  throw new Error('Invalid header ' + header);
8389
8446
  // Avoid duplicates
@@ -8455,7 +8512,7 @@ var translations = {
8455
8512
  Monthly: Monthly,
8456
8513
  Custom: Custom,
8457
8514
  Expression: Expression,
8458
- "Days of every month (comma separated dates)": "Days of every month (comma separated dates)"
8515
+ "Days of every month": "Days of every month"
8459
8516
  };
8460
8517
 
8461
8518
  function styleInject(css, ref) {
@@ -8485,18 +8542,22 @@ function styleInject(css, ref) {
8485
8542
  }
8486
8543
  }
8487
8544
 
8488
- 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, .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, .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, .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, .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,\"Noto Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";\n}\n.cron_builder .cursor_pointer {\n cursor: pointer;\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";
8489
8546
  styleInject(css_248z);
8490
8547
 
8491
8548
  const defaultCron = '0 0 00 1/1 * ? *';
8492
8549
  const Cron = (props) => {
8493
- const [state, setState] = useState({ value: [], headers: loadHeaders(props.options), locale: props.locale ? props.locale : 'en' });
8550
+ const [state, setState] = useState({
8551
+ value: [],
8552
+ headers: loadHeaders(props.options),
8553
+ locale: props.locale ? props.locale : 'en',
8554
+ });
8494
8555
  useEffect(() => {
8495
8556
  let newVal = '';
8496
8557
  newVal = state.value.toString().replace(/,/g, ' ');
8497
8558
  newVal = newVal.replace(/!/g, ',');
8498
8559
  if (props.value !== newVal) {
8499
- setValue(props.value ? props.value : "");
8560
+ setValue(props.value ? props.value : '');
8500
8561
  }
8501
8562
  if (props.translateFn && !props.locale) {
8502
8563
  console.warn('Warning !!! locale not set while using translateFn');
@@ -8515,20 +8576,20 @@ const Cron = (props) => {
8515
8576
  if (!value || value.split(' ').length !== 7) {
8516
8577
  value = '0 0 00 1/1 * ? *';
8517
8578
  prevState.selectedTab = allHeaders[0];
8518
- prevState.value = value.split(" ");
8519
- parentChange(value.split(" "));
8579
+ prevState.value = value.split(' ');
8580
+ parentChange(value.split(' '));
8520
8581
  }
8521
8582
  else {
8522
8583
  prevState.value = value.replace(/,/g, '!').split(' ');
8523
8584
  }
8524
8585
  let val = prevState.value;
8525
- if ((val[1].search('/') !== -1) && (val[2] === '*') && (val[3] === '1/1')) {
8586
+ if (val[1].search('/') !== -1 && val[2] === '*' && val[3] === '1/1') {
8526
8587
  prevState.selectedTab = allHeaders[0];
8527
8588
  }
8528
- else if ((val[3] === '1/1')) {
8589
+ else if (val[3] === '1/1') {
8529
8590
  prevState.selectedTab = allHeaders[1];
8530
8591
  }
8531
- else if ((val[3].search('/') !== -1) || (val[5] === 'MON-FRI')) {
8592
+ else if (val[3].search('/') !== -1 || val[5] === 'MON-FRI') {
8532
8593
  prevState.selectedTab = allHeaders[2];
8533
8594
  }
8534
8595
  else if (val[3] === '?') {
@@ -8552,7 +8613,7 @@ const Cron = (props) => {
8552
8613
  };
8553
8614
  const getHeaders = () => {
8554
8615
  return state.headers.map((d, index) => {
8555
- 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);
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));
8556
8617
  });
8557
8618
  };
8558
8619
  const onValueChange = (val) => {
@@ -8571,30 +8632,33 @@ const Cron = (props) => {
8571
8632
  props.onChange(newVal, getVal());
8572
8633
  };
8573
8634
  const getVal = () => {
8574
- let val = i18n.toString(state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), { throwExceptionOnParseError: false, locale: state.locale });
8635
+ let val = i18n.toString(state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), {
8636
+ throwExceptionOnParseError: false,
8637
+ locale: state.locale,
8638
+ });
8575
8639
  if (val.search('undefined') === -1 && state.value && state.value.length) {
8576
8640
  return val;
8577
8641
  }
8578
8642
  return '-';
8579
8643
  };
8580
8644
  const defaultValue = (tab) => {
8581
- let defaultValCron = metadata.find(m => m.name == tab);
8645
+ let defaultValCron = metadata.find((m) => m.name == tab);
8582
8646
  if (!defaultValCron || !defaultValCron.initialCron) {
8583
- return defaultCron.split(" ");
8647
+ return defaultCron.split(' ');
8584
8648
  }
8585
- return defaultValCron.initialCron;
8649
+ return [...defaultValCron.initialCron];
8586
8650
  };
8587
8651
  const getComponent = (tab) => {
8588
8652
  const index = state.headers.indexOf(tab);
8589
- let selectedMetaData = metadata.find(data => data.name === tab);
8653
+ let selectedMetaData = metadata.find((data) => data.name === tab);
8590
8654
  if (!selectedMetaData) {
8591
- selectedMetaData = metadata[index];
8655
+ selectedMetaData = Object.assign({}, metadata[index]);
8592
8656
  }
8593
8657
  if (!selectedMetaData) {
8594
8658
  throw new Error('Value does not match any available headers.');
8595
8659
  }
8596
8660
  const CronComponent = selectedMetaData.component;
8597
- 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 }));
8598
8662
  };
8599
8663
  const translate = (key) => {
8600
8664
  let translatedText = key;
@@ -8609,8 +8673,8 @@ const Cron = (props) => {
8609
8673
  }
8610
8674
  return translatedText;
8611
8675
  };
8612
- 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, ',') }))] })));
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, ',') })))] })));
8613
8677
  };
8614
8678
 
8615
- export { HEADER, Cron as default };
8679
+ export { HEADER, i18n as cronstrue, Cron as default };
8616
8680
  //# sourceMappingURL=index.js.map