react-cron-generator 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,10 @@ Simple react component to generate cron expression
6
6
 
7
7
  Package helps to build linux scheduler cron expression.
8
8
 
9
+ [![npm version](https://badge.fury.io/js/react-cron-generator.svg)](https://badge.fury.io/js/react-cron-generator) ![Downloads](https://img.shields.io/npm/dm/react-cron-generator.svg)
10
+ <a href="https://github.com/sojinantony01/react-spread-sheet/blob/main/LICENSE">
11
+ <img src="https://img.shields.io/npm/l/react-cron-generator.svg" alt="license">
12
+ </a>
9
13
 
10
14
  ```
11
15
  data = '* * * * * * *'
package/build/index.js CHANGED
@@ -686,7 +686,7 @@ var cronstrueI18n = {exports: {}};
686
686
 
687
687
 
688
688
  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;
689
+ 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
690
  var en_1 = __webpack_require__(751);
691
691
  Object.defineProperty(exports, "en", ({ enumerable: true, get: function () { return en_1.en; } }));
692
692
  var da_1 = __webpack_require__(904);
@@ -759,6 +759,8 @@ var cronstrueI18n = {exports: {}};
759
759
  Object.defineProperty(exports, "vi", ({ enumerable: true, get: function () { return vi_1.vi; } }));
760
760
  var my_1 = __webpack_require__(863);
761
761
  Object.defineProperty(exports, "my", ({ enumerable: true, get: function () { return my_1.my; } }));
762
+ var bg_1 = __webpack_require__(431);
763
+ Object.defineProperty(exports, "bg", ({ enumerable: true, get: function () { return bg_1.bg; } }));
762
764
 
763
765
 
764
766
  /***/ }),
@@ -1346,6 +1348,197 @@ var cronstrueI18n = {exports: {}};
1346
1348
  exports.be = be;
1347
1349
 
1348
1350
 
1351
+ /***/ }),
1352
+
1353
+ /***/ 431:
1354
+ /***/ ((__unused_webpack_module, exports) => {
1355
+
1356
+
1357
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1358
+ exports.bg = void 0;
1359
+ var getPhraseByPlural = function (str, words) {
1360
+ var strAsNumber = str != null ? Number(str) : 0;
1361
+ return strAsNumber < 2 ? words[0] : words[1];
1362
+ };
1363
+ var getPhraseByDayOfWeek = function (str, words) {
1364
+ var strAsNumber = str != null ? Number(str) : 0;
1365
+ return words[[1, 0, 0, 1, 0, 0, 1][strAsNumber]];
1366
+ };
1367
+ var getNumberEnding = function (str, gender) {
1368
+ var strAsNumber = str != null ? Number(str) : 1;
1369
+ strAsNumber = Math.max(Math.min(strAsNumber < 10 || (strAsNumber > 20 && strAsNumber % 10 !== 0) ? strAsNumber % 10 : 3, 3), 1) - 1;
1370
+ var genderIndex = ['м', 'ж', 'ср'].indexOf(gender);
1371
+ return ['в', 'р', 'т'][strAsNumber] + ['и', 'а', 'о'][genderIndex];
1372
+ };
1373
+ var bg = (function () {
1374
+ function bg() {
1375
+ }
1376
+ bg.prototype.atX0SecondsPastTheMinuteGt20 = function () {
1377
+ return null;
1378
+ };
1379
+ bg.prototype.atX0MinutesPastTheHourGt20 = function () {
1380
+ return null;
1381
+ };
1382
+ bg.prototype.commaMonthX0ThroughMonthX1 = function () {
1383
+ return null;
1384
+ };
1385
+ bg.prototype.commaYearX0ThroughYearX1 = function () {
1386
+ return null;
1387
+ };
1388
+ bg.prototype.use24HourTimeFormatByDefault = function () {
1389
+ return true;
1390
+ };
1391
+ bg.prototype.everyMinute = function () {
1392
+ return 'всяка минута';
1393
+ };
1394
+ bg.prototype.everyHour = function () {
1395
+ return 'всеки час';
1396
+ };
1397
+ bg.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
1398
+ return 'Възникна грешка при генериране на описанието на израза. Проверете синтаксиса на cron израза.';
1399
+ };
1400
+ bg.prototype.atSpace = function () {
1401
+ return 'В ';
1402
+ };
1403
+ bg.prototype.everyMinuteBetweenX0AndX1 = function () {
1404
+ return 'Всяка минута от %s до %s';
1405
+ };
1406
+ bg.prototype.at = function () {
1407
+ return 'В';
1408
+ };
1409
+ bg.prototype.spaceAnd = function () {
1410
+ return ' и';
1411
+ };
1412
+ bg.prototype.everySecond = function () {
1413
+ return 'всяка секунда';
1414
+ };
1415
+ bg.prototype.everyX0Seconds = function (s) {
1416
+ return 'всеки %s секунди';
1417
+ };
1418
+ bg.prototype.secondsX0ThroughX1PastTheMinute = function () {
1419
+ return 'секунди от %s до %s';
1420
+ };
1421
+ bg.prototype.atX0SecondsPastTheMinute = function (s) {
1422
+ return "%s-".concat(getNumberEnding(s, 'ж'), " \u0441\u0435\u043A\u0443\u043D\u0434\u0430");
1423
+ };
1424
+ bg.prototype.everyX0Minutes = function (s) {
1425
+ return 'всеки %s минути';
1426
+ };
1427
+ bg.prototype.minutesX0ThroughX1PastTheHour = function () {
1428
+ return 'минути от %s до %s';
1429
+ };
1430
+ bg.prototype.atX0MinutesPastTheHour = function (s) {
1431
+ return "%s-".concat(getNumberEnding(s, 'ж'), " \u043C\u0438\u043D\u0443\u0442a");
1432
+ };
1433
+ bg.prototype.everyX0Hours = function (s) {
1434
+ return 'всеки %s часа';
1435
+ };
1436
+ bg.prototype.betweenX0AndX1 = function () {
1437
+ return 'от %s до %s';
1438
+ };
1439
+ bg.prototype.atX0 = function () {
1440
+ return 'в %s';
1441
+ };
1442
+ bg.prototype.commaEveryDay = function () {
1443
+ return ', всеки ден';
1444
+ };
1445
+ bg.prototype.commaEveryX0DaysOfTheWeek = function (s) {
1446
+ return getPhraseByPlural(s, [', всеки %s ден от седмицата', ', всеки %s дена от седмицата']);
1447
+ };
1448
+ bg.prototype.commaX0ThroughX1 = function (s) {
1449
+ return ', от %s до %s';
1450
+ };
1451
+ bg.prototype.commaAndX0ThroughX1 = function (s) {
1452
+ return ' и от %s до %s';
1453
+ };
1454
+ bg.prototype.first = function (s) {
1455
+ return getPhraseByDayOfWeek(s, ['первият', 'первата']);
1456
+ };
1457
+ bg.prototype.second = function (s) {
1458
+ return getPhraseByDayOfWeek(s, ['вторият', 'втората']);
1459
+ };
1460
+ bg.prototype.third = function (s) {
1461
+ return getPhraseByDayOfWeek(s, ['третият', 'третата']);
1462
+ };
1463
+ bg.prototype.fourth = function (s) {
1464
+ return getPhraseByDayOfWeek(s, ['четвертият', 'четвертата']);
1465
+ };
1466
+ bg.prototype.fifth = function (s) {
1467
+ return getPhraseByDayOfWeek(s, ['петият', 'петата']);
1468
+ };
1469
+ bg.prototype.commaOnThe = function (s) {
1470
+ return ', ';
1471
+ };
1472
+ bg.prototype.spaceX0OfTheMonth = function () {
1473
+ return ' %s на месеца';
1474
+ };
1475
+ bg.prototype.lastDay = function () {
1476
+ return 'последният ден';
1477
+ };
1478
+ bg.prototype.commaOnTheLastX0OfTheMonth = function (s) {
1479
+ return getPhraseByDayOfWeek(s, [', в последният %s от месеца', ', в последната %s отмесеца']);
1480
+ };
1481
+ bg.prototype.commaOnlyOnX0 = function (s) {
1482
+ return ', %s';
1483
+ };
1484
+ bg.prototype.commaAndOnX0 = function () {
1485
+ return ' и %s';
1486
+ };
1487
+ bg.prototype.commaEveryX0Months = function (s) {
1488
+ return ' всеки %s месеца';
1489
+ };
1490
+ bg.prototype.commaOnlyInMonthX0 = function () {
1491
+ return ', %s';
1492
+ };
1493
+ bg.prototype.commaOnlyInX0 = function () {
1494
+ return ', в %s';
1495
+ };
1496
+ bg.prototype.commaOnTheLastDayOfTheMonth = function () {
1497
+ return ', в последният ден на месеца';
1498
+ };
1499
+ bg.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
1500
+ return ', в последния делничен ден от месеца';
1501
+ };
1502
+ bg.prototype.commaDaysBeforeTheLastDayOfTheMonth = function (s) {
1503
+ return getPhraseByPlural(s, [', %s ден преди края на месеца', ', %s дена преди края на месеца']);
1504
+ };
1505
+ bg.prototype.firstWeekday = function () {
1506
+ return 'първият делничен ден';
1507
+ };
1508
+ bg.prototype.weekdayNearestDayX0 = function () {
1509
+ return 'най-близкият делничен ден до %s число';
1510
+ };
1511
+ bg.prototype.commaOnTheX0OfTheMonth = function () {
1512
+ return ', на %s число от месеца';
1513
+ };
1514
+ bg.prototype.commaEveryX0Days = function (s) {
1515
+ return getPhraseByPlural(s, [', всеки %s ден', ', всеки %s дена']);
1516
+ };
1517
+ bg.prototype.commaBetweenDayX0AndX1OfTheMonth = function (s) {
1518
+ var _a;
1519
+ var values = (_a = s === null || s === void 0 ? void 0 : s.split('-')) !== null && _a !== void 0 ? _a : [];
1520
+ 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");
1521
+ };
1522
+ bg.prototype.commaOnDayX0OfTheMonth = function (s) {
1523
+ return ", \u043D\u0430 %s-".concat(getNumberEnding(s, 'ср'), " \u0447\u0438\u0441\u043B\u043E \u043E\u0442 \u043C\u0435\u0441\u0435\u0446\u0430");
1524
+ };
1525
+ bg.prototype.commaEveryX0Years = function (s) {
1526
+ return getPhraseByPlural(s, [', всяка %s година', ', всеки %s години']);
1527
+ };
1528
+ bg.prototype.commaStartingX0 = function () {
1529
+ return ', започвайки %s';
1530
+ };
1531
+ bg.prototype.daysOfTheWeek = function () {
1532
+ return ['неделя', 'понеделник', 'вторник', 'сряда', 'четвъртък', 'петък', 'събота'];
1533
+ };
1534
+ bg.prototype.monthsOfTheYear = function () {
1535
+ return ['януари', 'февруари', 'март', 'април', 'май', 'юни', 'юли', 'август', 'септевмври', 'октомври', 'ноември', 'декември'];
1536
+ };
1537
+ return bg;
1538
+ }());
1539
+ exports.bg = bg;
1540
+
1541
+
1349
1542
  /***/ }),
1350
1543
 
1351
1544
  /***/ 708:
@@ -7990,15 +8183,6 @@ styleInject(css_248z);
7990
8183
  const defaultCron = '0 0 00 1/1 * ? *';
7991
8184
  const Cron = (props) => {
7992
8185
  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
8186
  useEffect(() => {
8003
8187
  let newVal = '';
8004
8188
  newVal = state.value.toString().replace(/,/g, ' ');
@@ -8006,12 +8190,15 @@ const Cron = (props) => {
8006
8190
  if (props.value !== newVal) {
8007
8191
  setValue(props.value ? props.value : "");
8008
8192
  }
8193
+ if (props.translateFn && !props.locale) {
8194
+ console.warn('Warning !!! locale not set while using translateFn');
8195
+ }
8009
8196
  }, [props.value]);
8010
8197
  useEffect(() => {
8011
- parentChange(state.value);
8198
+ state.value && state.value.length && parentChange(state.value);
8012
8199
  }, [state.value]);
8013
8200
  const setValue = (value) => {
8014
- let prevState = state;
8201
+ let prevState = Object.assign({}, state);
8015
8202
  prevState.value = value.replace(/,/g, '!').split(' ');
8016
8203
  const allHeaders = loadHeaders();
8017
8204
  if (value && value.split(' ').length === 6) {
@@ -8077,7 +8264,7 @@ const Cron = (props) => {
8077
8264
  };
8078
8265
  const getVal = () => {
8079
8266
  let val = i18n.toString(state.value.toString().replace(/,/g, ' ').replace(/!/g, ','), { throwExceptionOnParseError: false, locale: state.locale });
8080
- if (val.search('undefined') === -1) {
8267
+ if (val.search('undefined') === -1 && state.value && state.value.length) {
8081
8268
  return val;
8082
8269
  }
8083
8270
  return '-';