react-cron-generator 1.3.13 → 2.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cron-generator",
3
- "version": "1.3.13",
3
+ "version": "2.0.0",
4
4
  "description": "Simple react component to generate cron expression",
5
5
  "keywords": [
6
6
  "React cron generator",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "author": "Sojin antony",
18
18
  "dependencies": {
19
- "cronstrue": "^2.11.0"
19
+ "cronstrue": "^2.12.0"
20
20
  },
21
21
  "main": "dist/index.js",
22
22
  "module": "dist/index.js",
@@ -28,26 +28,46 @@
28
28
  "type": "git",
29
29
  "url": "https://github.com/sojinantony01/react-cron-generator.git"
30
30
  },
31
+ "peerDependencies": {
32
+ "react": ">=16.8.0",
33
+ "react-dom": ">=16.8.0"
34
+ },
31
35
  "devDependencies": {
32
- "@babel/cli": "^7.4.4",
33
- "@babel/core": "^7.4.4",
34
- "@babel/preset-react": "^7.0.0",
35
- "@babel/runtime": "^7.5.1",
36
- "react": "^16.8.6",
37
- "react-dom": "^16.8.6",
38
- "react-scripts": "^3.0.0"
36
+ "@rollup/plugin-commonjs": "^22.0.2",
37
+ "@rollup/plugin-json": "^4.1.0",
38
+ "@rollup/plugin-node-resolve": "^14.1.0",
39
+ "@testing-library/jest-dom": "^5.16.5",
40
+ "@testing-library/react": "^13.4.0",
41
+ "@testing-library/user-event": "^13.5.0",
42
+ "@types/jest": "^27.5.2",
43
+ "@types/node": "^16.11.59",
44
+ "@types/react": "^18.0.20",
45
+ "@types/react-dom": "^18.0.6",
46
+ "postcss": "^8.4.16",
47
+ "react-scripts": "5.0.1",
48
+ "rollup": "^2.79.0",
49
+ "rollup-plugin-peer-deps-external": "^2.2.4",
50
+ "rollup-plugin-postcss": "^4.0.2",
51
+ "rollup-plugin-typescript2": "^0.34.0",
52
+ "sass": "^1.54.9",
53
+ "typescript": "^4.8.3",
54
+ "web-vitals": "^2.1.4"
39
55
  },
40
- "homepage": "https://sojinantony01.github.io/react-cron-generator",
41
56
  "scripts": {
42
57
  "start": "react-scripts start",
43
- "build": "rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,__snapshots__",
58
+ "build": "rm -rf build && rollup -c",
44
59
  "test": "react-scripts test",
45
60
  "eject": "react-scripts eject",
46
61
  "deploy": "gh-pages -d build",
47
- "react-build": "CI=false && react-scripts build"
62
+ "react-build": "CI=false && react-scripts build",
63
+ "prepublishOnly": "npm run build"
48
64
  },
65
+ "homepage": "https://sojinantony01.github.io/react-cron-generator",
49
66
  "eslintConfig": {
50
- "extends": "react-app"
67
+ "extends": [
68
+ "react-app",
69
+ "react-app/jest"
70
+ ]
51
71
  },
52
72
  "license": "ISC",
53
73
  "browserslist": {
@@ -1,91 +0,0 @@
1
- .cron_builder_bordering {
2
- border: 1px solid #ddd;
3
- border-top: none;
4
- text-align: center;
5
- padding: 10px;
6
- background: #fff;
7
- }
8
- .cron_builder_bordering input, .cron_builder_bordering select {
9
- width: 100px;
10
- margin-right: 10px;
11
- margin-left: 10px;
12
- border: 1px solid #ddd;
13
- border-radius: 4px;
14
- outline: none;
15
- padding-left: 5px;
16
- cursor: pointer;
17
- }
18
- .df {
19
- display: flex;
20
- }
21
- .cron-builder-bg {
22
- background-color: #086090;
23
- color: white;
24
- text-align: center;
25
- margin-bottom: 4px;
26
- padding: 8px 0px;
27
- }
28
- .cron_builder_bordering select {
29
- background-color: white;
30
- width: 75px;
31
- cursor: pointer;
32
- padding: 4px 2px;
33
- border-radius: 4px;
34
- }
35
- .cron_builder_bordering select option:hover {
36
- background-color: #086090;
37
- }
38
- .well-small input {
39
- width: auto !important;
40
- }
41
- .cron_builder_bordering input[type='radio'] {
42
- margin-top: 0px;
43
- vertical-align: middle;
44
- }
45
- .cron_builder {
46
- border: 1px solid #d0cbcb;
47
- padding: 5px;
48
- background-color: #dddef13d;
49
- width: 100%;
50
- max-width: 600px;
51
- }
52
- .text_align_left {
53
- text-align: left;
54
- }
55
- .cron_builder .nav li {
56
- cursor: pointer;
57
- flex: 0 0 85px;
58
- text-align: center;
59
- }
60
- .cron_builder .nav li a {
61
- color:#337ab7;
62
-
63
- }
64
- .cron_builder .nav-tabs .nav-link:focus, .cron_builder .nav-tabs .nav-link:hover {
65
- border-color: transparent transparent transparent;
66
- background-color: #eeeeee;
67
- }
68
- .cron_builder .nav-tabs .nav-item.show .nav-link, .cron_builder .nav-tabs .nav-link.active {
69
- border-color: #dee2e6 #dee2e6 #fff;
70
- background-color: #ffffff;
71
- }
72
- .cron_builder {
73
- font-size: 14px;
74
- }
75
- .cron_builder .well {
76
- min-height: 20px;
77
- padding: 19px;
78
- margin-bottom: 20px;
79
- background-color: #f5f5f5;
80
- border: 1px solid #e3e3e3;
81
- border-radius: 4px;
82
- -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 5%);
83
- box-shadow: inset 0 1px 1px rgb(0 0 0 / 5%);
84
- }
85
- @media screen and (max-width:767px) {
86
- .cron_builder .nav li {
87
- cursor: pointer;
88
- flex: 0 0 65px;
89
- text-align: center;
90
- }
91
- }
@@ -1,46 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
- import React, { Component } from 'react';
6
-
7
- var CustomCron = /*#__PURE__*/function (_Component) {
8
- _inherits(CustomCron, _Component);
9
-
10
- var _super = _createSuper(CustomCron);
11
-
12
- function CustomCron(props) {
13
- var _this;
14
-
15
- _classCallCheck(this, CustomCron);
16
-
17
- _this = _super.call(this, props);
18
- _this.state = {};
19
- return _this;
20
- }
21
-
22
- _createClass(CustomCron, [{
23
- key: "onChange",
24
- value: function onChange(e) {
25
- this.props.onChange(e.target.value.replace(/,/g, '!').split(" "));
26
- }
27
- }, {
28
- key: "render",
29
- value: function render() {
30
- var translateFn = this.props.translate;
31
- this.state.value = this.props.value;
32
- var val = this.props.value.toString().replace(/,/g, ' ').replace(/!/g, ',');
33
- return /*#__PURE__*/React.createElement("div", {
34
- className: "well"
35
- }, translateFn('Expression'), " ", /*#__PURE__*/React.createElement("input", {
36
- type: "text",
37
- onChange: this.onChange.bind(this),
38
- value: val
39
- }));
40
- }
41
- }]);
42
-
43
- return CustomCron;
44
- }(Component);
45
-
46
- export { CustomCron as default };
@@ -1,130 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
-
7
- /* eslint-disable react/no-direct-mutation-state */
8
- import React, { Component } from 'react';
9
- import Minutes from '../minutes-select';
10
- import Hour from '../hour-select';
11
-
12
- var DailyCron = /*#__PURE__*/function (_Component) {
13
- _inherits(DailyCron, _Component);
14
-
15
- var _super = _createSuper(DailyCron);
16
-
17
- function DailyCron(props) {
18
- var _this;
19
-
20
- _classCallCheck(this, DailyCron);
21
-
22
- _this = _super.call(this, props);
23
- _this.state = {
24
- hour: 0,
25
- minute: 0
26
- };
27
- _this.onDayChange = _this.onDayChange.bind(_assertThisInitialized(_this));
28
- _this.onAtHourChange = _this.onAtHourChange.bind(_assertThisInitialized(_this));
29
- _this.onAtMinuteChange = _this.onAtMinuteChange.bind(_assertThisInitialized(_this));
30
- return _this;
31
- }
32
-
33
- _createClass(DailyCron, [{
34
- key: "UNSAFE_componentWillMount",
35
- value: function UNSAFE_componentWillMount() {
36
- this.state.value = this.props.value;
37
- this.state.every = this.props.value[3] !== '?';
38
- }
39
- }, {
40
- key: "onDayChange",
41
- value: function onDayChange(e) {
42
- if (!e.target.value || e.target.value > 0 && e.target.value < 32) {
43
- this.state.value = ['0', this.getValueByIndex(1), this.getValueByIndex(1), '*', '*', '?', '*'];
44
- this.onValueChange(3, e.target.value ? "1/".concat(e.target.value) : e.target.value);
45
- }
46
- }
47
- /**
48
- * If value is * return 0 else return value
49
- * @param {position in array} index
50
- */
51
-
52
- }, {
53
- key: "getValueByIndex",
54
- value: function getValueByIndex(index) {
55
- return this.state.value[index] === '*' ? '0' : this.state.value[index];
56
- }
57
- }, {
58
- key: "onAtHourChange",
59
- value: function onAtHourChange(e) {
60
- this.onValueChange(2, e.target.value);
61
- }
62
- }, {
63
- key: "onAtMinuteChange",
64
- value: function onAtMinuteChange(e) {
65
- this.onValueChange(1, e.target.value);
66
- }
67
- }, {
68
- key: "onValueChange",
69
- value: function onValueChange(cronPosition, value) {
70
- var val = this.state.value;
71
- val[cronPosition] = value;
72
- this.props.onChange(val);
73
- }
74
- }, {
75
- key: "render",
76
- value: function render() {
77
- var _this2 = this;
78
-
79
- var translateFn = this.props.translate;
80
- this.state.value = this.props.value;
81
- return /*#__PURE__*/React.createElement("div", {
82
- className: "tab-pane"
83
- }, /*#__PURE__*/React.createElement("div", {
84
- className: "well well-small"
85
- }, /*#__PURE__*/React.createElement("input", {
86
- type: "radio",
87
- onChange: function onChange(e) {
88
- _this2.setState({
89
- every: true
90
- });
91
-
92
- _this2.props.onChange();
93
- },
94
- value: "1",
95
- name: "DailyRadio",
96
- checked: this.state.every
97
- }), /*#__PURE__*/React.createElement("span", null, translateFn('Every')), /*#__PURE__*/React.createElement("input", {
98
- disabled: !this.state.every,
99
- type: "Number",
100
- maxLength: "2",
101
- onChange: this.onDayChange,
102
- value: this.state.value[3].split('/')[1] ? this.state.value[3].split('/')[1] : ''
103
- }), /*#__PURE__*/React.createElement("span", null, translateFn('day(s)'))), /*#__PURE__*/React.createElement("div", {
104
- className: "well well-small"
105
- }, /*#__PURE__*/React.createElement("input", {
106
- onChange: function onChange(e) {
107
- _this2.setState({
108
- every: false
109
- });
110
-
111
- _this2.props.onChange(['0', _this2.state.value[1], _this2.state.value[2], '?', '*', 'MON-FRI', '*']);
112
- },
113
- type: "radio",
114
- value: "2",
115
- name: "DailyRadio",
116
- checked: !this.state.every
117
- }), /*#__PURE__*/React.createElement("span", null, translateFn('Every week day'))), /*#__PURE__*/React.createElement("span", null, translateFn('Start time')), /*#__PURE__*/React.createElement(Hour, {
118
- onChange: this.onAtHourChange,
119
- value: this.state.value[2]
120
- }), /*#__PURE__*/React.createElement(Minutes, {
121
- onChange: this.onAtMinuteChange,
122
- value: this.state.value[1]
123
- }));
124
- }
125
- }]);
126
-
127
- return DailyCron;
128
- }(Component);
129
-
130
- export { DailyCron as default };
@@ -1,143 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
- import React, { Component } from 'react';
7
- import Minutes from '../minutes-select';
8
- import Hour from '../hour-select';
9
-
10
- var HourlyCron = /*#__PURE__*/function (_Component) {
11
- _inherits(HourlyCron, _Component);
12
-
13
- var _super = _createSuper(HourlyCron);
14
-
15
- function HourlyCron(props) {
16
- var _this;
17
-
18
- _classCallCheck(this, HourlyCron);
19
-
20
- _this = _super.call(this, props);
21
- _this.state = {
22
- every: false
23
- };
24
- _this.onHourChange = _this.onHourChange.bind(_assertThisInitialized(_this));
25
- _this.onAtHourChange = _this.onAtHourChange.bind(_assertThisInitialized(_this));
26
- _this.onAtMinuteChange = _this.onAtMinuteChange.bind(_assertThisInitialized(_this));
27
- _this.onMinuteChange = _this.onMinuteChange.bind(_assertThisInitialized(_this));
28
- return _this;
29
- }
30
-
31
- _createClass(HourlyCron, [{
32
- key: "UNSAFE_componentWillMount",
33
- value: function UNSAFE_componentWillMount() {
34
- this.state.value = this.props.value;
35
-
36
- if (this.state.value[2].split('/')[1] || this.state.value[2] === '*') {
37
- this.state.every = true;
38
- }
39
- }
40
- }, {
41
- key: "onHourChange",
42
- value: function onHourChange(e) {
43
- if (this.state.every && (e.target.value > 0 && e.target.value < 24 || e.target.value === '')) {
44
- var val = ['0', '0', '*', '*', '*', '?', '*'];
45
- val[1] = this.state.value[1];
46
- val[2] = e.target.value ? "0/".concat(e.target.value) : e.target.value;
47
- val[3] = '1/1';
48
- this.props.onChange(val);
49
- }
50
- }
51
- }, {
52
- key: "onMinuteChange",
53
- value: function onMinuteChange(e) {
54
- if (this.state.every && (e.target.value > 0 && e.target.value < 60 || e.target.value === '')) {
55
- var val = ['0', '0', '*', '*', '*', '?', '*'];
56
- val[1] = e.target.value;
57
- val[2] = this.state.value[2];
58
- val[3] = '1/1';
59
- this.props.onChange(val);
60
- }
61
- }
62
- }, {
63
- key: "onAtHourChange",
64
- value: function onAtHourChange(e) {
65
- var val = ['0', this.state.value[1], '*', '1/1', '*', '?', '*'];
66
- val[2] = "".concat(e.target.value);
67
- this.props.onChange(val);
68
- }
69
- }, {
70
- key: "onAtMinuteChange",
71
- value: function onAtMinuteChange(e) {
72
- var val = ['0', '*', this.state.value[2], '1/1', '*', '?', '*'];
73
- val[1] = "".concat(e.target.value);
74
- this.props.onChange(val);
75
- }
76
- }, {
77
- key: "render",
78
- value: function render() {
79
- var _this2 = this;
80
-
81
- var translateFn = this.props.translate;
82
- this.state.value = this.props.value;
83
- return /*#__PURE__*/React.createElement("div", {
84
- className: "tab-content"
85
- }, /*#__PURE__*/React.createElement("div", {
86
- className: "tab-pane active"
87
- }, /*#__PURE__*/React.createElement("div", {
88
- className: "well well-small"
89
- }, /*#__PURE__*/React.createElement("input", {
90
- type: "radio",
91
- onChange: function onChange(e) {
92
- _this2.setState({
93
- every: true
94
- });
95
-
96
- _this2.props.onChange(['0', '0', '0/1', '1/1', '*', '?', '*']);
97
- },
98
- checked: this.state.every
99
- }), /*#__PURE__*/React.createElement("span", null, translateFn('Every'), " "), /*#__PURE__*/React.createElement("input", {
100
- disabled: !this.state.every,
101
- type: "Number",
102
- onChange: this.onHourChange,
103
- value: this.state.value[2].split('/')[1] ? this.state.value[2].split('/')[1] : ''
104
- }), /*#__PURE__*/React.createElement("span", null, translateFn('hour')), /*#__PURE__*/React.createElement("input", {
105
- disabled: !this.state.every,
106
- type: "Number",
107
- onChange: this.onMinuteChange,
108
- value: this.state.value[1]
109
- }), /*#__PURE__*/React.createElement("span", null, translateFn('minutes(s)'))), /*#__PURE__*/React.createElement("div", {
110
- className: "well well-small margin-right-0 margin-left-0"
111
- }, /*#__PURE__*/React.createElement("div", {
112
- className: "text_align_right",
113
- style: {
114
- width: '100%'
115
- }
116
- }, /*#__PURE__*/React.createElement("input", {
117
- type: "radio",
118
- onChange: function onChange(e) {
119
- _this2.setState({
120
- every: false
121
- });
122
-
123
- _this2.props.onChange();
124
- },
125
- checked: !this.state.every
126
- }), /*#__PURE__*/React.createElement("span", {
127
- className: ""
128
- }, translateFn('At')), /*#__PURE__*/React.createElement(Hour, {
129
- disabled: this.state.every,
130
- onChange: this.onAtHourChange,
131
- value: this.state.value[2]
132
- }), /*#__PURE__*/React.createElement(Minutes, {
133
- disabled: this.state.every,
134
- onChange: this.onAtMinuteChange,
135
- value: this.state.value[1]
136
- })))));
137
- }
138
- }]);
139
-
140
- return HourlyCron;
141
- }(Component);
142
-
143
- export { HourlyCron as default };
@@ -1,52 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
- import React, { Component } from 'react';
6
-
7
- var MinutesCron = /*#__PURE__*/function (_Component) {
8
- _inherits(MinutesCron, _Component);
9
-
10
- var _super = _createSuper(MinutesCron);
11
-
12
- function MinutesCron() {
13
- _classCallCheck(this, MinutesCron);
14
-
15
- return _super.apply(this, arguments);
16
- }
17
-
18
- _createClass(MinutesCron, [{
19
- key: "onChange",
20
- value: function onChange(e) {
21
- if (e.target.value > 0 && e.target.value < 60 || e.target.value === '') {
22
- var val = ['0', '*', '*', '*', '*', '?', '*'];
23
- val[1] = e.target.value ? "0/".concat(e.target.value) : val[1];
24
- this.props.onChange(val);
25
- }
26
- }
27
- }, {
28
- key: "render",
29
- value: function render() {
30
- var translateFn = this.props.translate;
31
- var value = this.props.value;
32
-
33
- if (value && value.length > 1) {
34
- value = value[1].split('/')[1];
35
- }
36
-
37
- return /*#__PURE__*/React.createElement("div", {
38
- className: "well"
39
- }, translateFn('Every'), " ", /*#__PURE__*/React.createElement("input", {
40
- type: "Number",
41
- onChange: this.onChange.bind(this),
42
- value: value,
43
- min: 1,
44
- max: 60
45
- }), " ", translateFn('minute(s)'));
46
- }
47
- }]);
48
-
49
- return MinutesCron;
50
- }(Component);
51
-
52
- export { MinutesCron as default };