react-cron-generator 2.0.9 → 2.0.11

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
@@ -33,9 +33,24 @@ var cronstrueI18n = {exports: {}};
33
33
  };
34
34
  CronParser.prototype.extractParts = function (expression) {
35
35
  if (!this.expression) {
36
- throw new Error("Expression is empty");
36
+ throw new Error("cron expression is empty");
37
37
  }
38
38
  var parsed = expression.trim().split(/[ ]+/);
39
+ for (var i = 0; i < parsed.length; i++) {
40
+ if (parsed[i].includes(",")) {
41
+ var arrayElement = parsed[i]
42
+ .split(",")
43
+ .map(function (item) { return item.trim(); })
44
+ .filter(function (item) { return item !== ""; })
45
+ .map(function (item) { return (!isNaN(Number(item)) ? Number(item) : item); })
46
+ .filter(function (item) { return item !== null && item !== ""; });
47
+ if (arrayElement.length === 0) {
48
+ arrayElement.push("*");
49
+ }
50
+ arrayElement.sort(function (a, b) { return (a !== null && b !== null ? a - b : 0); });
51
+ parsed[i] = arrayElement.map(function (item) { return (item !== null ? item.toString() : ""); }).join(",");
52
+ }
53
+ }
39
54
  if (parsed.length < 5) {
40
55
  throw new Error("Expression has only ".concat(parsed.length, " part").concat(parsed.length == 1 ? "" : "s", ". At least 5 parts are required."));
41
56
  }
@@ -413,9 +428,26 @@ var cronstrueI18n = {exports: {}};
413
428
  else if (s.indexOf("L") > -1) {
414
429
  exp = exp.replace("L", "");
415
430
  }
431
+ var parsedExp = parseInt(exp);
432
+ if (_this.options.tzOffset) {
433
+ var hourExpression = _this.expressionParts[2];
434
+ var hour = parseInt(hourExpression) + (_this.options.tzOffset ? _this.options.tzOffset : 0);
435
+ if (hour >= 24) {
436
+ parsedExp++;
437
+ }
438
+ else if (hour < 0) {
439
+ parsedExp--;
440
+ }
441
+ if (parsedExp > 6) {
442
+ parsedExp = 0;
443
+ }
444
+ else if (parsedExp < 0) {
445
+ parsedExp = 6;
446
+ }
447
+ }
416
448
  var description = _this.i18n.daysOfTheWeekInCase
417
- ? _this.i18n.daysOfTheWeekInCase(form)[parseInt(exp)]
418
- : daysOfWeekNames[parseInt(exp)];
449
+ ? _this.i18n.daysOfTheWeekInCase(form)[parsedExp]
450
+ : daysOfWeekNames[parsedExp];
419
451
  if (s.indexOf("#") > -1) {
420
452
  var dayOfWeekOfMonthDescription = null;
421
453
  var dayOfWeekOfMonthNumber = s.substring(s.indexOf("#") + 1);
@@ -635,7 +667,25 @@ var cronstrueI18n = {exports: {}};
635
667
  return description;
636
668
  };
637
669
  ExpressionDescriptor.prototype.formatTime = function (hourExpression, minuteExpression, secondExpression) {
638
- var hour = parseInt(hourExpression) + (this.options.tzOffset ? this.options.tzOffset : 0);
670
+ var hourOffset = 0;
671
+ var minuteOffset = 0;
672
+ if (this.options.tzOffset) {
673
+ hourOffset = this.options.tzOffset > 0 ? Math.floor(this.options.tzOffset) : Math.ceil(this.options.tzOffset);
674
+ minuteOffset = (parseFloat((this.options.tzOffset % 1).toFixed(2)));
675
+ if (minuteOffset != 0) {
676
+ minuteOffset *= 60;
677
+ }
678
+ }
679
+ var hour = parseInt(hourExpression) + (hourOffset);
680
+ var minute = parseInt(minuteExpression) + (minuteOffset);
681
+ if (minute >= 60) {
682
+ minute -= 60;
683
+ hour += 1;
684
+ }
685
+ else if (minute < 0) {
686
+ minute += 60;
687
+ hour -= 1;
688
+ }
639
689
  if (hour >= 24) {
640
690
  hour = hour - 24;
641
691
  }
@@ -654,7 +704,6 @@ var cronstrueI18n = {exports: {}};
654
704
  hour = 12;
655
705
  }
656
706
  }
657
- var minute = minuteExpression;
658
707
  var second = "";
659
708
  if (secondExpression) {
660
709
  second = ":".concat(("00" + secondExpression).substring(secondExpression.length));
@@ -686,7 +735,7 @@ var cronstrueI18n = {exports: {}};
686
735
 
687
736
 
688
737
  Object.defineProperty(exports, "__esModule", ({ value: true }));
689
- exports.my = exports.vi = exports.ar = exports.th = exports.af = exports.hu = exports.be = exports.ca = exports.fa = exports.sw = exports.sl = exports.fi = exports.sk = exports.cs = exports.he = exports.ja = exports.zh_TW = exports.zh_CN = exports.uk = exports.tr = exports.ru = exports.ro = exports.pt_PT = exports.pt_BR = exports.pl = exports.sv = exports.nb = exports.nl = exports.ko = exports.id = exports.it = exports.fr = exports.es = exports.de = exports.da = exports.en = void 0;
738
+ exports.bg = exports.my = exports.vi = exports.ar = exports.th = exports.af = exports.hu = exports.be = exports.ca = exports.fa = exports.sw = exports.sl = exports.fi = exports.sk = exports.cs = exports.he = exports.ja = exports.zh_TW = exports.zh_CN = exports.uk = exports.tr = exports.ru = exports.ro = exports.pt_PT = exports.pt_BR = exports.pl = exports.sv = exports.nb = exports.nl = exports.ko = exports.id = exports.it = exports.fr = exports.es = exports.de = exports.da = exports.en = void 0;
690
739
  var en_1 = __webpack_require__(751);
691
740
  Object.defineProperty(exports, "en", ({ enumerable: true, get: function () { return en_1.en; } }));
692
741
  var da_1 = __webpack_require__(904);
@@ -759,6 +808,8 @@ var cronstrueI18n = {exports: {}};
759
808
  Object.defineProperty(exports, "vi", ({ enumerable: true, get: function () { return vi_1.vi; } }));
760
809
  var my_1 = __webpack_require__(863);
761
810
  Object.defineProperty(exports, "my", ({ enumerable: true, get: function () { return my_1.my; } }));
811
+ var bg_1 = __webpack_require__(431);
812
+ Object.defineProperty(exports, "bg", ({ enumerable: true, get: function () { return bg_1.bg; } }));
762
813
 
763
814
 
764
815
  /***/ }),
@@ -997,7 +1048,7 @@ var cronstrueI18n = {exports: {}};
997
1048
  return null;
998
1049
  };
999
1050
  ar.prototype.use24HourTimeFormatByDefault = function () {
1000
- return false;
1051
+ return true;
1001
1052
  };
1002
1053
  ar.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
1003
1054
  return "حدث خطأ في إنشاء وصف المصطلح٠ تأكد من تركيب مصطلح الكرون";
@@ -1185,7 +1236,7 @@ var cronstrueI18n = {exports: {}};
1185
1236
  return null;
1186
1237
  };
1187
1238
  be.prototype.use24HourTimeFormatByDefault = function () {
1188
- return true;
1239
+ return false;
1189
1240
  };
1190
1241
  be.prototype.everyMinute = function () {
1191
1242
  return "кожную хвіліну";
@@ -1346,6 +1397,197 @@ var cronstrueI18n = {exports: {}};
1346
1397
  exports.be = be;
1347
1398
 
1348
1399
 
1400
+ /***/ }),
1401
+
1402
+ /***/ 431:
1403
+ /***/ ((__unused_webpack_module, exports) => {
1404
+
1405
+
1406
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1407
+ exports.bg = void 0;
1408
+ var getPhraseByPlural = function (str, words) {
1409
+ var strAsNumber = str != null ? Number(str) : 0;
1410
+ return strAsNumber < 2 ? words[0] : words[1];
1411
+ };
1412
+ var getPhraseByDayOfWeek = function (str, words) {
1413
+ var strAsNumber = str != null ? Number(str) : 0;
1414
+ return words[[1, 0, 0, 1, 0, 0, 1][strAsNumber]];
1415
+ };
1416
+ var getNumberEnding = function (str, gender) {
1417
+ var strAsNumber = str != null ? Number(str) : 1;
1418
+ strAsNumber = Math.max(Math.min(strAsNumber < 10 || (strAsNumber > 20 && strAsNumber % 10 !== 0) ? strAsNumber % 10 : 3, 3), 1) - 1;
1419
+ var genderIndex = ['м', 'ж', 'ср'].indexOf(gender);
1420
+ return ['в', 'р', 'т'][strAsNumber] + ['и', 'а', 'о'][genderIndex];
1421
+ };
1422
+ var bg = (function () {
1423
+ function bg() {
1424
+ }
1425
+ bg.prototype.atX0SecondsPastTheMinuteGt20 = function () {
1426
+ return null;
1427
+ };
1428
+ bg.prototype.atX0MinutesPastTheHourGt20 = function () {
1429
+ return null;
1430
+ };
1431
+ bg.prototype.commaMonthX0ThroughMonthX1 = function () {
1432
+ return null;
1433
+ };
1434
+ bg.prototype.commaYearX0ThroughYearX1 = function () {
1435
+ return null;
1436
+ };
1437
+ bg.prototype.use24HourTimeFormatByDefault = function () {
1438
+ return true;
1439
+ };
1440
+ bg.prototype.everyMinute = function () {
1441
+ return 'всяка минута';
1442
+ };
1443
+ bg.prototype.everyHour = function () {
1444
+ return 'всеки час';
1445
+ };
1446
+ bg.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
1447
+ return 'Възникна грешка при генериране на описанието на израза. Проверете синтаксиса на cron израза.';
1448
+ };
1449
+ bg.prototype.atSpace = function () {
1450
+ return 'В ';
1451
+ };
1452
+ bg.prototype.everyMinuteBetweenX0AndX1 = function () {
1453
+ return 'Всяка минута от %s до %s';
1454
+ };
1455
+ bg.prototype.at = function () {
1456
+ return 'В';
1457
+ };
1458
+ bg.prototype.spaceAnd = function () {
1459
+ return ' и';
1460
+ };
1461
+ bg.prototype.everySecond = function () {
1462
+ return 'всяка секунда';
1463
+ };
1464
+ bg.prototype.everyX0Seconds = function (s) {
1465
+ return 'всеки %s секунди';
1466
+ };
1467
+ bg.prototype.secondsX0ThroughX1PastTheMinute = function () {
1468
+ return 'секунди от %s до %s';
1469
+ };
1470
+ bg.prototype.atX0SecondsPastTheMinute = function (s) {
1471
+ return "%s-".concat(getNumberEnding(s, 'ж'), " \u0441\u0435\u043A\u0443\u043D\u0434\u0430");
1472
+ };
1473
+ bg.prototype.everyX0Minutes = function (s) {
1474
+ return 'всеки %s минути';
1475
+ };
1476
+ bg.prototype.minutesX0ThroughX1PastTheHour = function () {
1477
+ return 'минути от %s до %s';
1478
+ };
1479
+ bg.prototype.atX0MinutesPastTheHour = function (s) {
1480
+ return "%s-".concat(getNumberEnding(s, 'ж'), " \u043C\u0438\u043D\u0443\u0442a");
1481
+ };
1482
+ bg.prototype.everyX0Hours = function (s) {
1483
+ return 'всеки %s часа';
1484
+ };
1485
+ bg.prototype.betweenX0AndX1 = function () {
1486
+ return 'от %s до %s';
1487
+ };
1488
+ bg.prototype.atX0 = function () {
1489
+ return 'в %s';
1490
+ };
1491
+ bg.prototype.commaEveryDay = function () {
1492
+ return ', всеки ден';
1493
+ };
1494
+ bg.prototype.commaEveryX0DaysOfTheWeek = function (s) {
1495
+ return getPhraseByPlural(s, [', всеки %s ден от седмицата', ', всеки %s дена от седмицата']);
1496
+ };
1497
+ bg.prototype.commaX0ThroughX1 = function (s) {
1498
+ return ', от %s до %s';
1499
+ };
1500
+ bg.prototype.commaAndX0ThroughX1 = function (s) {
1501
+ return ' и от %s до %s';
1502
+ };
1503
+ bg.prototype.first = function (s) {
1504
+ return getPhraseByDayOfWeek(s, ['первият', 'первата']);
1505
+ };
1506
+ bg.prototype.second = function (s) {
1507
+ return getPhraseByDayOfWeek(s, ['вторият', 'втората']);
1508
+ };
1509
+ bg.prototype.third = function (s) {
1510
+ return getPhraseByDayOfWeek(s, ['третият', 'третата']);
1511
+ };
1512
+ bg.prototype.fourth = function (s) {
1513
+ return getPhraseByDayOfWeek(s, ['четвертият', 'четвертата']);
1514
+ };
1515
+ bg.prototype.fifth = function (s) {
1516
+ return getPhraseByDayOfWeek(s, ['петият', 'петата']);
1517
+ };
1518
+ bg.prototype.commaOnThe = function (s) {
1519
+ return ', ';
1520
+ };
1521
+ bg.prototype.spaceX0OfTheMonth = function () {
1522
+ return ' %s на месеца';
1523
+ };
1524
+ bg.prototype.lastDay = function () {
1525
+ return 'последният ден';
1526
+ };
1527
+ bg.prototype.commaOnTheLastX0OfTheMonth = function (s) {
1528
+ return getPhraseByDayOfWeek(s, [', в последният %s от месеца', ', в последната %s отмесеца']);
1529
+ };
1530
+ bg.prototype.commaOnlyOnX0 = function (s) {
1531
+ return ', %s';
1532
+ };
1533
+ bg.prototype.commaAndOnX0 = function () {
1534
+ return ' и %s';
1535
+ };
1536
+ bg.prototype.commaEveryX0Months = function (s) {
1537
+ return ' всеки %s месеца';
1538
+ };
1539
+ bg.prototype.commaOnlyInMonthX0 = function () {
1540
+ return ', %s';
1541
+ };
1542
+ bg.prototype.commaOnlyInX0 = function () {
1543
+ return ', в %s';
1544
+ };
1545
+ bg.prototype.commaOnTheLastDayOfTheMonth = function () {
1546
+ return ', в последният ден на месеца';
1547
+ };
1548
+ bg.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
1549
+ return ', в последния делничен ден от месеца';
1550
+ };
1551
+ bg.prototype.commaDaysBeforeTheLastDayOfTheMonth = function (s) {
1552
+ return getPhraseByPlural(s, [', %s ден преди края на месеца', ', %s дена преди края на месеца']);
1553
+ };
1554
+ bg.prototype.firstWeekday = function () {
1555
+ return 'първият делничен ден';
1556
+ };
1557
+ bg.prototype.weekdayNearestDayX0 = function () {
1558
+ return 'най-близкият делничен ден до %s число';
1559
+ };
1560
+ bg.prototype.commaOnTheX0OfTheMonth = function () {
1561
+ return ', на %s число от месеца';
1562
+ };
1563
+ bg.prototype.commaEveryX0Days = function (s) {
1564
+ return getPhraseByPlural(s, [', всеки %s ден', ', всеки %s дена']);
1565
+ };
1566
+ bg.prototype.commaBetweenDayX0AndX1OfTheMonth = function (s) {
1567
+ var _a;
1568
+ var values = (_a = s === null || s === void 0 ? void 0 : s.split('-')) !== null && _a !== void 0 ? _a : [];
1569
+ return ", \u043E\u0442 %s-".concat(getNumberEnding(values[0], 'ср'), " \u0434\u043E %s-").concat(getNumberEnding(values[1], 'ср'), " \u0447\u0438\u0441\u043B\u043E \u043D\u0430 \u043C\u0435\u0441\u0435\u0446\u0430");
1570
+ };
1571
+ bg.prototype.commaOnDayX0OfTheMonth = function (s) {
1572
+ return ", \u043D\u0430 %s-".concat(getNumberEnding(s, 'ср'), " \u0447\u0438\u0441\u043B\u043E \u043E\u0442 \u043C\u0435\u0441\u0435\u0446\u0430");
1573
+ };
1574
+ bg.prototype.commaEveryX0Years = function (s) {
1575
+ return getPhraseByPlural(s, [', всяка %s година', ', всеки %s години']);
1576
+ };
1577
+ bg.prototype.commaStartingX0 = function () {
1578
+ return ', започвайки %s';
1579
+ };
1580
+ bg.prototype.daysOfTheWeek = function () {
1581
+ return ['неделя', 'понеделник', 'вторник', 'сряда', 'четвъртък', 'петък', 'събота'];
1582
+ };
1583
+ bg.prototype.monthsOfTheYear = function () {
1584
+ return ['януари', 'февруари', 'март', 'април', 'май', 'юни', 'юли', 'август', 'септевмври', 'октомври', 'ноември', 'декември'];
1585
+ };
1586
+ return bg;
1587
+ }());
1588
+ exports.bg = bg;
1589
+
1590
+
1349
1591
  /***/ }),
1350
1592
 
1351
1593
  /***/ 708:
@@ -1370,7 +1612,7 @@ var cronstrueI18n = {exports: {}};
1370
1612
  return null;
1371
1613
  };
1372
1614
  ca.prototype.use24HourTimeFormatByDefault = function () {
1373
- return false;
1615
+ return true;
1374
1616
  };
1375
1617
  ca.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
1376
1618
  return "S'ha produït un error mentres es generava la descripció de l'expressió. Revisi la sintaxi de la expressió de cron.";
@@ -2298,7 +2540,7 @@ var cronstrueI18n = {exports: {}};
2298
2540
  return null;
2299
2541
  };
2300
2542
  es.prototype.use24HourTimeFormatByDefault = function () {
2301
- return false;
2543
+ return true;
2302
2544
  };
2303
2545
  es.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
2304
2546
  return "Ocurrió un error mientras se generaba la descripción de la expresión. Revise la sintaxis de la expresión de cron.";
@@ -2649,7 +2891,7 @@ var cronstrueI18n = {exports: {}};
2649
2891
  function fi() {
2650
2892
  }
2651
2893
  fi.prototype.use24HourTimeFormatByDefault = function () {
2652
- return false;
2894
+ return true;
2653
2895
  };
2654
2896
  fi.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
2655
2897
  return "Virhe kuvauksen generoinnissa. Tarkista cron-syntaksi.";
@@ -3215,7 +3457,7 @@ var cronstrueI18n = {exports: {}};
3215
3457
  return null;
3216
3458
  };
3217
3459
  hu.prototype.use24HourTimeFormatByDefault = function () {
3218
- return false;
3460
+ return true;
3219
3461
  };
3220
3462
  hu.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
3221
3463
  return "Hiba történt a kifejezésleírás generálásakor. Ellenőrizze a cron kifejezés szintaxisát.";
@@ -3403,7 +3645,7 @@ var cronstrueI18n = {exports: {}};
3403
3645
  return null;
3404
3646
  };
3405
3647
  id.prototype.use24HourTimeFormatByDefault = function () {
3406
- return false;
3648
+ return true;
3407
3649
  };
3408
3650
  id.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
3409
3651
  return "Terjadi kesalahan saat membuat deskripsi ekspresi. Periksa sintaks ekspresi cron.";
@@ -3764,7 +4006,7 @@ var cronstrueI18n = {exports: {}};
3764
4006
  function ja() {
3765
4007
  }
3766
4008
  ja.prototype.use24HourTimeFormatByDefault = function () {
3767
- return false;
4009
+ return true;
3768
4010
  };
3769
4011
  ja.prototype.everyMinute = function () {
3770
4012
  return "毎分";
@@ -4011,7 +4253,7 @@ var cronstrueI18n = {exports: {}};
4011
4253
  return "%s분마다";
4012
4254
  };
4013
4255
  ko.prototype.minutesX0ThroughX1PastTheHour = function () {
4014
- return "정시 후 %s분에서 %s까지";
4256
+ return "정시 후 %s분에서 %s분까지";
4015
4257
  };
4016
4258
  ko.prototype.atX0MinutesPastTheHour = function () {
4017
4259
  return "정시 후 %s분에서";
@@ -4074,7 +4316,7 @@ var cronstrueI18n = {exports: {}};
4074
4316
  return ", %s개월마다";
4075
4317
  };
4076
4318
  ko.prototype.commaOnlyInX0 = function () {
4077
- return ", %s에서만";
4319
+ return ", %s에만";
4078
4320
  };
4079
4321
  ko.prototype.commaOnTheLastDayOfTheMonth = function () {
4080
4322
  return ", 해당 월의 마지막 날에";
@@ -4089,7 +4331,7 @@ var cronstrueI18n = {exports: {}};
4089
4331
  return "첫 번째 평일";
4090
4332
  };
4091
4333
  ko.prototype.weekdayNearestDayX0 = function () {
4092
- return "평일 가장 가까운 날 %s";
4334
+ return "%s일과 가장 가까운 평일";
4093
4335
  };
4094
4336
  ko.prototype.commaOnTheX0OfTheMonth = function () {
4095
4337
  return ", 해당 월의 %s에";
@@ -4098,7 +4340,7 @@ var cronstrueI18n = {exports: {}};
4098
4340
  return ", %s일마다";
4099
4341
  };
4100
4342
  ko.prototype.commaBetweenDayX0AndX1OfTheMonth = function () {
4101
- return ", 해당 월의 %s %s일 사이";
4343
+ return ", 해당 월의 %s일에서 %s일까지";
4102
4344
  };
4103
4345
  ko.prototype.commaOnDayX0OfTheMonth = function () {
4104
4346
  return ", 해당 월의 %s일에";
@@ -4338,7 +4580,7 @@ var cronstrueI18n = {exports: {}};
4338
4580
  return null;
4339
4581
  };
4340
4582
  nb.prototype.use24HourTimeFormatByDefault = function () {
4341
- return false;
4583
+ return true;
4342
4584
  };
4343
4585
  nb.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
4344
4586
  return "En feil inntraff ved generering av uttrykksbeskrivelse. Sjekk cron syntaks.";
@@ -4523,7 +4765,7 @@ var cronstrueI18n = {exports: {}};
4523
4765
  return null;
4524
4766
  };
4525
4767
  nl.prototype.use24HourTimeFormatByDefault = function () {
4526
- return false;
4768
+ return true;
4527
4769
  };
4528
4770
  nl.prototype.everyMinute = function () {
4529
4771
  return "elke minuut";
@@ -4893,7 +5135,7 @@ var cronstrueI18n = {exports: {}};
4893
5135
  return null;
4894
5136
  };
4895
5137
  pt_BR.prototype.use24HourTimeFormatByDefault = function () {
4896
- return false;
5138
+ return true;
4897
5139
  };
4898
5140
  pt_BR.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
4899
5141
  return "Ocorreu um erro ao gerar a descrição da expressão Cron.";
@@ -6231,7 +6473,7 @@ var cronstrueI18n = {exports: {}};
6231
6473
  return null;
6232
6474
  };
6233
6475
  sw.prototype.use24HourTimeFormatByDefault = function () {
6234
- return false;
6476
+ return true;
6235
6477
  };
6236
6478
  sw.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
6237
6479
  return "Kuna tatizo wakati wa kutunga msemo. Angalia cron expression syntax.";
@@ -6974,7 +7216,7 @@ var cronstrueI18n = {exports: {}};
6974
7216
  return null;
6975
7217
  };
6976
7218
  vi.prototype.use24HourTimeFormatByDefault = function () {
6977
- return false;
7219
+ return true;
6978
7220
  };
6979
7221
  vi.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
6980
7222
  return "Đã xảy ra lỗi khi tạo mô tả biểu thức. Vui lòng kiểm tra cú pháp biểu thức cron.";
@@ -7352,7 +7594,7 @@ var cronstrueI18n = {exports: {}};
7352
7594
  return ", 從 %s 年至 %s 年";
7353
7595
  };
7354
7596
  zh_TW.prototype.use24HourTimeFormatByDefault = function () {
7355
- return false;
7597
+ return true;
7356
7598
  };
7357
7599
  zh_TW.prototype.everyMinute = function () {
7358
7600
  return "每分鐘";
@@ -7672,6 +7914,9 @@ var i18n = cronstrueWithLocales;
7672
7914
 
7673
7915
  const MinutesCron = (props) => {
7674
7916
  const onChange = (e) => {
7917
+ if (props.disabled) {
7918
+ return;
7919
+ }
7675
7920
  if ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 60) || e.target.value === '') {
7676
7921
  let val = ['0', '*', '*', '*', '*', '?', '*'];
7677
7922
  val[1] = e.target.value ? `0/${e.target.value}` : val[1];
@@ -7679,7 +7924,7 @@ const MinutesCron = (props) => {
7679
7924
  }
7680
7925
  };
7681
7926
  const value = props.value[1].split('/')[1];
7682
- return (jsxs("div", Object.assign({ className: "well" }, { children: [props.translate('Every'), " ", jsx("input", { type: "Number", onChange: onChange, value: value, min: 1, max: 60 }), " ", props.translate('minute(s)')] })));
7927
+ 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)')] })));
7683
7928
  };
7684
7929
 
7685
7930
  const MinutesSelect = (props) => {
@@ -7690,7 +7935,7 @@ const MinutesSelect = (props) => {
7690
7935
  }
7691
7936
  return options;
7692
7937
  };
7693
- return (jsx("select", Object.assign({ disabled: props.disabled === true ? true : false, className: "minutes", onChange: props.onChange, value: props.value }, { children: buildOptions() })));
7938
+ return (jsx("select", Object.assign({ disabled: props.disabled, className: "minutes", onChange: props.onChange, value: props.value }, { children: buildOptions() })));
7694
7939
  };
7695
7940
 
7696
7941
  const HourSelect = (props) => {
@@ -7701,7 +7946,7 @@ const HourSelect = (props) => {
7701
7946
  }
7702
7947
  return options;
7703
7948
  };
7704
- return (jsx("select", Object.assign({ disabled: props.disabled === true ? true : false, className: "hours", onChange: props.onChange, value: props.value }, { children: buildOptions() })));
7949
+ return (jsx("select", Object.assign({ disabled: props.disabled, className: "hours", onChange: props.onChange, value: props.value }, { children: buildOptions() })));
7705
7950
  };
7706
7951
 
7707
7952
  const DailyCron = (props) => {
@@ -7710,15 +7955,24 @@ const DailyCron = (props) => {
7710
7955
  setState(Object.assign(Object.assign({}, state), { every: props.value[3] !== '?' }));
7711
7956
  }, []);
7712
7957
  const onDayChange = (e) => {
7958
+ if (props.disabled) {
7959
+ return;
7960
+ }
7713
7961
  if (!e.target.value || (parseInt(e.target.value) > 0 && parseInt(e.target.value) < 32)) {
7714
7962
  // props.value = ['0', getValueByIndex(1), getValueByIndex(1),'*','*','?','*'];
7715
7963
  onValueChange(3, (e.target.value ? `1/${e.target.value}` : e.target.value));
7716
7964
  }
7717
7965
  };
7718
7966
  const onAtHourChange = (e) => {
7967
+ if (props.disabled) {
7968
+ return;
7969
+ }
7719
7970
  onValueChange(2, e.target.value);
7720
7971
  };
7721
7972
  const onAtMinuteChange = (e) => {
7973
+ if (props.disabled) {
7974
+ return;
7975
+ }
7722
7976
  onValueChange(1, e.target.value);
7723
7977
  };
7724
7978
  const onValueChange = (cronPosition, value) => {
@@ -7727,7 +7981,11 @@ const DailyCron = (props) => {
7727
7981
  props.onChange(val);
7728
7982
  };
7729
7983
  const translateFn = props.translate;
7730
- return (jsxs("div", Object.assign({ className: "tab-pane" }, { children: [jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { type: "radio", onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: true })); props.onChange(); }, value: "1", name: "DailyRadio", checked: state.every }), jsx("span", { children: translateFn('Every') }), jsx("input", { disabled: !state.every, type: "Number", maxLength: 2, onChange: onDayChange, value: props.value[3].split('/')[1] ? props.value[3].split('/')[1] : '' }), jsx("span", { children: translateFn('day(s)') })] })), jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: false })); props.onChange(['0', props.value[1], props.value[2], '?', '*', 'MON-FRI', '*']); }, type: "radio", value: "2", name: "DailyRadio", checked: !state.every }), jsx("span", { children: translateFn('Every week day') })] })), jsx("span", { children: translateFn('Start time') }), jsx(HourSelect, { onChange: onAtHourChange, value: props.value[2] }), jsx(MinutesSelect, { onChange: onAtMinuteChange, value: props.value[1] })] })));
7984
+ return (jsxs("div", Object.assign({ className: "tab-pane" }, { children: [jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { type: "radio", onChange: (e) => { if (props.disabled) {
7985
+ return;
7986
+ } setState(Object.assign(Object.assign({}, state), { every: true })); props.onChange(); }, value: "1", name: "DailyRadio", checked: state.every, disabled: props.disabled }), jsx("span", { children: translateFn('Every') }), jsx("input", { disabled: !state.every || props.disabled, type: "Number", maxLength: 2, onChange: onDayChange, value: props.value[3].split('/')[1] ? props.value[3].split('/')[1] : '' }), jsx("span", { children: translateFn('day(s)') })] })), jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { onChange: (e) => { if (props.disabled) {
7987
+ return;
7988
+ } setState(Object.assign(Object.assign({}, state), { every: false })); props.onChange(['0', props.value[1], props.value[2], '?', '*', 'MON-FRI', '*']); }, type: "radio", value: "2", name: "DailyRadio", checked: !state.every, disabled: props.disabled }), jsx("span", { children: translateFn('Every week day') })] })), jsx("span", { children: 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 })] })));
7731
7989
  };
7732
7990
 
7733
7991
  const HourlyCron = (props) => {
@@ -7738,7 +7996,7 @@ const HourlyCron = (props) => {
7738
7996
  }
7739
7997
  }, []);
7740
7998
  const onHourChange = (e) => {
7741
- if (state.every && ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 24) || e.target.value === '')) {
7999
+ if (!props.disabled && state.every && ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 24) || e.target.value === '')) {
7742
8000
  let val = ['0', '0', '*', '*', '*', '?', '*'];
7743
8001
  val[1] = props.value[1];
7744
8002
  val[2] = e.target.value ? `0/${e.target.value}` : e.target.value;
@@ -7747,7 +8005,7 @@ const HourlyCron = (props) => {
7747
8005
  }
7748
8006
  };
7749
8007
  const onMinuteChange = (e) => {
7750
- if (state.every && ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 60) || e.target.value === '')) {
8008
+ if (!props.disabled && state.every && ((parseInt(e.target.value) > 0 && parseInt(e.target.value) < 60) || e.target.value === '')) {
7751
8009
  let val = ['0', '0', '*', '*', '*', '?', '*'];
7752
8010
  val[1] = e.target.value;
7753
8011
  val[2] = props.value[2];
@@ -7756,33 +8014,52 @@ const HourlyCron = (props) => {
7756
8014
  }
7757
8015
  };
7758
8016
  const onAtHourChange = (e) => {
8017
+ if (props.disabled) {
8018
+ return;
8019
+ }
7759
8020
  let val = ['0', props.value[1], '*', '1/1', '*', '?', '*'];
7760
8021
  val[2] = `${e.target.value}`;
7761
8022
  props.onChange(val);
7762
8023
  };
7763
8024
  const onAtMinuteChange = (e) => {
8025
+ if (props.disabled) {
8026
+ return;
8027
+ }
7764
8028
  let val = ['0', '*', props.value[2], '1/1', '*', '?', '*'];
7765
8029
  val[1] = `${e.target.value}`;
7766
8030
  props.onChange(val);
7767
8031
  };
7768
8032
  const translateFn = props.translate;
7769
- 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" }, { children: [jsx("input", { type: "radio", onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: true })); props.onChange(['0', '0', '0/1', '1/1', '*', '?', '*']); }, checked: state.every }), jsxs("span", { children: [translateFn('Every'), " "] }), jsx("input", { disabled: !state.every, type: "Number", onChange: onHourChange, value: props.value[2].split('/')[1] ? props.value[2].split('/')[1] : '' }), jsx("span", { children: translateFn('hour') }), jsx("input", { disabled: !state.every, type: "Number", onChange: onMinuteChange, value: props.value[1] }), jsx("span", { children: translateFn('minute(s)') })] })), jsx("div", Object.assign({ className: "well well-small margin-right-0 margin-left-0" }, { children: jsxs("div", Object.assign({ className: "text_align_right", style: { width: '100%' } }, { children: [jsx("input", { type: "radio", onChange: (e) => { setState({ every: false }); props.onChange(); }, checked: !state.every }), jsx("span", Object.assign({ className: "" }, { children: translateFn('At') })), jsx(HourSelect, { disabled: state.every, onChange: onAtHourChange, value: props.value[2] }), jsx(MinutesSelect, { disabled: state.every, onChange: onAtMinuteChange, value: props.value[1] })] })) }))] })) })));
8033
+ 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" }, { children: [jsx("input", { type: "radio", onChange: (e) => { if (props.disabled) {
8034
+ return;
8035
+ } setState(Object.assign(Object.assign({}, state), { every: true })); props.onChange(['0', '0', '0/1', '1/1', '*', '?', '*']); }, checked: state.every, disabled: props.disabled }), jsxs("span", { children: [translateFn('Every'), " "] }), jsx("input", { disabled: !state.every || props.disabled, type: "Number", onChange: onHourChange, value: props.value[2].split('/')[1] ? props.value[2].split('/')[1] : '' }), jsx("span", { children: translateFn('hour') }), jsx("input", { disabled: !state.every || props.disabled, type: "Number", onChange: onMinuteChange, value: props.value[1] }), jsx("span", { children: translateFn('minute(s)') })] })), jsx("div", Object.assign({ className: "well well-small margin-right-0 margin-left-0" }, { children: jsxs("div", Object.assign({ className: "text_align_right", style: { width: '100%' } }, { children: [jsx("input", { type: "radio", onChange: (e) => { if (props.disabled) {
8036
+ return;
8037
+ } setState({ every: false }); props.onChange(); }, checked: !state.every, disabled: props.disabled }), jsx("span", Object.assign({ className: "" }, { children: translateFn('At') })), jsx(HourSelect, { disabled: state.every || props.disabled, onChange: onAtHourChange, value: props.value[2] }), jsx(MinutesSelect, { disabled: state.every || props.disabled, onChange: onAtMinuteChange, value: props.value[1] })] })) }))] })) })));
7770
8038
  };
7771
8039
 
7772
8040
  const WeeklyCron = (props) => {
7773
8041
  const onAtHourChange = (e) => {
8042
+ if (props.disabled) {
8043
+ return;
8044
+ }
7774
8045
  let val = props.value;
7775
8046
  val[0] = '0';
7776
8047
  val[2] = `${e.target.value}`;
7777
8048
  props.onChange(val);
7778
8049
  };
7779
8050
  const onAtMinuteChange = (e) => {
8051
+ if (props.disabled) {
8052
+ return;
8053
+ }
7780
8054
  let val = props.value;
7781
8055
  val[0] = '0';
7782
8056
  val[1] = `${e.target.value}`;
7783
8057
  props.onChange(val);
7784
8058
  };
7785
8059
  const onCheck = (e) => {
8060
+ if (props.disabled) {
8061
+ return;
8062
+ }
7786
8063
  let val = props.value;
7787
8064
  val[0] = '0';
7788
8065
  if (e.target.checked) {
@@ -7816,7 +8093,7 @@ const WeeklyCron = (props) => {
7816
8093
  val[5] = valFive;
7817
8094
  };
7818
8095
  const translateFn = props.translate;
7819
- 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", { className: 'min_height_auto', type: "checkbox", value: "MON", onChange: onCheck, checked: (props.value[5].search('MON') !== -1) ? true : false }), translateFn('Monday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "WED", onChange: onCheck, checked: props.value[5].search('WED') !== -1 ? true : false }), translateFn('Wednesday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "FRI", onChange: onCheck, checked: (props.value[5].search('FRI') !== -1) ? true : false }), translateFn('Friday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "SUN", onChange: onCheck, checked: props.value[5].search('SUN') !== -1 ? true : false }), translateFn('Sunday')] })) })), jsxs("div", Object.assign({ className: "span6 col-sm-6" }, { children: [jsxs("div", Object.assign({ className: "text_align_left" }, { children: [jsx("input", { className: 'min_height_auto', type: "checkbox", value: "TUE", onChange: onCheck, checked: props.value[5].search('TUE') !== -1 ? true : false }), translateFn('Tuesday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "THU", onChange: onCheck, checked: props.value[5].search('THU') !== -1 ? true : false }), translateFn('Thursday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "SAT", onChange: onCheck, checked: props.value[5].search('SAT') !== -1 ? true : false }), translateFn('Saturday')] })), jsx("br", {}), jsx("br", {})] }))] })), translateFn('Start time'), jsx(HourSelect, { onChange: onAtHourChange, value: props.value[2] }), jsx(MinutesSelect, { onChange: onAtMinuteChange, value: props.value[1] })] })));
8096
+ 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", { className: 'min_height_auto', type: "checkbox", value: "MON", onChange: onCheck, checked: (props.value[5].search('MON') !== -1) ? true : false, disabled: props.disabled }), translateFn('Monday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "WED", onChange: onCheck, checked: props.value[5].search('WED') !== -1 ? true : false, disabled: props.disabled }), translateFn('Wednesday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "FRI", onChange: onCheck, checked: (props.value[5].search('FRI') !== -1) ? true : false, disabled: props.disabled }), translateFn('Friday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "SUN", onChange: onCheck, checked: props.value[5].search('SUN') !== -1 ? true : false, disabled: props.disabled }), translateFn('Sunday')] })) })), jsxs("div", Object.assign({ className: "span6 col-sm-6" }, { children: [jsxs("div", Object.assign({ className: "text_align_left" }, { children: [jsx("input", { className: 'min_height_auto', type: "checkbox", value: "TUE", onChange: onCheck, checked: props.value[5].search('TUE') !== -1 ? true : false, disabled: props.disabled }), translateFn('Tuesday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "THU", onChange: onCheck, checked: props.value[5].search('THU') !== -1 ? true : false, disabled: props.disabled }), translateFn('Thursday'), jsx("br", {}), jsx("input", { className: 'min_height_auto', type: "checkbox", value: "SAT", onChange: onCheck, checked: props.value[5].search('SAT') !== -1 ? true : false, disabled: props.disabled }), 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 })] })));
7820
8097
  };
7821
8098
 
7822
8099
  const MonthlyCron = (props) => {
@@ -7838,6 +8115,9 @@ const MonthlyCron = (props) => {
7838
8115
  setState(Object.assign(Object.assign({}, state), { every: every }));
7839
8116
  }, []);
7840
8117
  const onDayChange = (e) => {
8118
+ if (props.disabled) {
8119
+ return;
8120
+ }
7841
8121
  if (((parseInt(e.target.value) > 0 && parseInt(e.target.value) <= 31)) || e.target.value === "") {
7842
8122
  let val = ['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], props.value[3], '1/1', '?', '*'];
7843
8123
  val[3] = `${e.target.value}`;
@@ -7845,6 +8125,9 @@ const MonthlyCron = (props) => {
7845
8125
  }
7846
8126
  };
7847
8127
  const onLastDayChange = (e) => {
8128
+ if (props.disabled) {
8129
+ return;
8130
+ }
7848
8131
  if (((parseInt(e.target.value) >> 0 && parseInt(e.target.value) <= 31)) || e.target.value === "") {
7849
8132
  let val = ['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], props.value[3], '1/1', '?', '*'];
7850
8133
  if (e.target.value === '') {
@@ -7857,26 +8140,42 @@ const MonthlyCron = (props) => {
7857
8140
  }
7858
8141
  };
7859
8142
  const onAtHourChange = (e) => {
8143
+ if (props.disabled) {
8144
+ return;
8145
+ }
7860
8146
  let val = props.value;
7861
8147
  val[2] = `${e.target.value}`;
7862
8148
  props.onChange(val);
7863
8149
  };
7864
8150
  const onAtMinuteChange = (e) => {
8151
+ if (props.disabled) {
8152
+ return;
8153
+ }
7865
8154
  let val = props.value;
7866
8155
  val[1] = `${e.target.value}`;
7867
8156
  props.onChange(val);
7868
8157
  };
7869
8158
  const translateFn = props.translate;
7870
- return (jsxs("div", Object.assign({ className: "tab-pane" }, { children: [jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { type: "radio", onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], '1', '1/1', '?', '*']); }, value: "1", name: "MonthlyRadio", checked: state.every === "1" ? true : false }), translateFn('Day'), jsx("input", { readOnly: state.every !== "1", type: "number", value: props.value[3], onChange: onDayChange }), translateFn('of every month(s)')] })), jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], 'L', '*', '?', '*']); }, type: "radio", value: "2", name: "DailyRadio", checked: state.every === "2" ? true : false }), translateFn('Last day of every month')] })), jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], 'LW', '*', '?', '*']); }, type: "radio", value: "3", name: "DailyRadio", checked: state.every === "3" ? true : false }), translateFn('On the last weekday of every month')] })), jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { type: "radio", onChange: (e) => { setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], `L-${1}`, '*', '?', '*']); }, value: "4", name: "MonthlyRadio", checked: state.every === "4" ? true : false }), 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 }), translateFn('day(s) before the end of the month')] })), translateFn('Start time'), jsx(HourSelect, { onChange: onAtHourChange, value: props.value[2] }), jsx(MinutesSelect, { onChange: onAtMinuteChange, value: props.value[1] })] })));
8159
+ return (jsxs("div", Object.assign({ className: "tab-pane" }, { children: [jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { type: "radio", onChange: (e) => { if (props.disabled) {
8160
+ return;
8161
+ } setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], '1', '1/1', '?', '*']); }, value: "1", name: "MonthlyRadio", 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" }, { children: [jsx("input", { onChange: (e) => { if (props.disabled) {
8162
+ return;
8163
+ } setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], 'L', '*', '?', '*']); }, type: "radio", value: "2", name: "DailyRadio", checked: state.every === "2" ? true : false, disabled: props.disabled }), translateFn('Last day of every month')] })), jsxs("div", Object.assign({ className: "well well-small" }, { children: [jsx("input", { onChange: (e) => { if (props.disabled) {
8164
+ return;
8165
+ } setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], 'LW', '*', '?', '*']); }, type: "radio", value: "3", name: "DailyRadio", 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" }, { children: [jsx("input", { type: "radio", onChange: (e) => { if (props.disabled) {
8166
+ return;
8167
+ } setState(Object.assign(Object.assign({}, state), { every: e.target.value })); props.onChange(['0', props.value[1] === '*' ? '0' : props.value[1], props.value[2] === '*' ? '0' : props.value[2], `L-${1}`, '*', '?', '*']); }, value: "4", name: "MonthlyRadio", 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')] })), 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 })] })));
7871
8168
  };
7872
8169
 
7873
8170
  const CustomCron = (props) => {
7874
8171
  const onChange = (e) => {
8172
+ if (props.disabled)
8173
+ return;
7875
8174
  props.onChange(e.target.value.replace(/,/g, '!').split(" "));
7876
8175
  };
7877
8176
  const translateFn = props.translate;
7878
8177
  let val = props.value.toString().replace(/,/g, ' ').replace(/!/g, ',');
7879
- return (jsxs("div", Object.assign({ className: "well" }, { children: [translateFn('Expression'), " ", jsx("input", { type: "text", onChange: onChange, value: val })] })));
8178
+ return (jsxs("div", Object.assign({ className: "well" }, { children: [translateFn('Expression'), " ", jsx("input", { type: "text", onChange: onChange, value: val, disabled: props.disabled })] })));
7880
8179
  };
7881
8180
 
7882
8181
  const HEADER = {
@@ -7984,21 +8283,12 @@ function styleInject(css, ref) {
7984
8283
  }
7985
8284
  }
7986
8285
 
7987
- 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 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 { \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.nav.nav-tabs {\n list-style: none;\n display: flex;\n margin: 0 0;\n padding-left: 0;\n}\n.row {\n display: flex;\n}\n.col-sm-6 {\n flex: 0 0 50%;\n}\n.min_height_auto {\n min-height: auto !important;\n}\nbody {\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}";
8286
+ 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.nav.nav-tabs {\n list-style: none;\n display: flex;\n margin: 0 0;\n padding-left: 0;\n}\n.row {\n display: flex;\n}\n.col-sm-6 {\n flex: 0 0 50%;\n}\n.min_height_auto {\n min-height: auto !important;\n}\nbody {\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}";
7988
8287
  styleInject(css_248z);
7989
8288
 
7990
8289
  const defaultCron = '0 0 00 1/1 * ? *';
7991
8290
  const Cron = (props) => {
7992
8291
  const [state, setState] = useState({ value: [], headers: loadHeaders(props.options), locale: props.locale ? props.locale : 'en' });
7993
- useEffect(() => {
7994
- setValue(props.value ? props.value : "");
7995
- if (props.translateFn && !props.locale) {
7996
- console.log('Warning !!! locale not set while using translateFn');
7997
- }
7998
- // if(this.props.onRef) {
7999
- // this.props.onRef(this);
8000
- // }
8001
- }, []);
8002
8292
  useEffect(() => {
8003
8293
  let newVal = '';
8004
8294
  newVal = state.value.toString().replace(/,/g, ' ');
@@ -8006,12 +8296,15 @@ const Cron = (props) => {
8006
8296
  if (props.value !== newVal) {
8007
8297
  setValue(props.value ? props.value : "");
8008
8298
  }
8299
+ if (props.translateFn && !props.locale) {
8300
+ console.warn('Warning !!! locale not set while using translateFn');
8301
+ }
8009
8302
  }, [props.value]);
8010
8303
  useEffect(() => {
8011
- parentChange(state.value);
8304
+ state.value && state.value.length && parentChange(state.value);
8012
8305
  }, [state.value]);
8013
8306
  const setValue = (value) => {
8014
- let prevState = state;
8307
+ let prevState = Object.assign({}, state);
8015
8308
  prevState.value = value.replace(/,/g, '!').split(' ');
8016
8309
  const allHeaders = loadHeaders();
8017
8310
  if (value && value.split(' ').length === 6) {
@@ -8051,13 +8344,13 @@ const Cron = (props) => {
8051
8344
  setState(prevState);
8052
8345
  };
8053
8346
  const tabChanged = (tab) => {
8054
- if (state.selectedTab !== tab) {
8347
+ if (state.selectedTab !== tab && !props.disabled) {
8055
8348
  setState(Object.assign(Object.assign({}, state), { selectedTab: tab, value: defaultValue(tab) }));
8056
8349
  }
8057
8350
  };
8058
8351
  const getHeaders = () => {
8059
8352
  return state.headers.map((d, index) => {
8060
- return jsx("li", Object.assign({ className: "nav-item" }, { children: jsx("a", Object.assign({ className: `nav-link ${state.selectedTab === d ? 'active' : ''}`, onClick: () => tabChanged(d) }, { children: translate(d) })) }), index);
8353
+ 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);
8061
8354
  });
8062
8355
  };
8063
8356
  const onValueChange = (val) => {
@@ -8077,7 +8370,7 @@ const Cron = (props) => {
8077
8370
  };
8078
8371
  const getVal = () => {
8079
8372
  let val = i18n.toString(state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), { throwExceptionOnParseError: false, locale: state.locale });
8080
- if (val.search('undefined') === -1) {
8373
+ if (val.search('undefined') === -1 && state.value && state.value.length) {
8081
8374
  return val;
8082
8375
  }
8083
8376
  return '-';
@@ -8099,7 +8392,7 @@ const Cron = (props) => {
8099
8392
  throw new Error('Value does not match any available headers.');
8100
8393
  }
8101
8394
  const CronComponent = selectedMetaData.component;
8102
- return jsx(CronComponent, { translate: translate, value: state.value, onChange: onValueChange });
8395
+ return jsx(CronComponent, { translate: translate, value: state.value, onChange: onValueChange, disabled: props.disabled });
8103
8396
  };
8104
8397
  const translate = (key) => {
8105
8398
  let translatedText = key;