react-cron-generator 1.2.12 → 1.3.3

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
@@ -5,7 +5,10 @@ Simple react component to generate cron expression
5
5
  ## Getting Started
6
6
 
7
7
  Package helps to build linux scheduler cron expression.
8
- Make sure you have include bootstrap in your project
8
+
9
+ Make sure you have include bootstrap(4.x) in your project.
10
+
11
+ For old bootstrap(3.x) version support, please use cron generator version "1.2.12"
9
12
 
10
13
 
11
14
  ```
@@ -59,7 +62,7 @@ export default App;
59
62
  | Prop | Description | Default | Mandatory
60
63
  | --- | --- | -- | -- |
61
64
  | value | cron expression | | No |
62
- | onChange | | | Yes
65
+ | onChange | have 2 arguments, 1st is cron value and 2nd is cron result text from cronstrue | | Yes
63
66
  | showResultText | show in readable text format | false | No
64
67
  | showResultCron | show cron expression | false | No
65
68
  | translateFn | translate function callback | method | No
@@ -15,7 +15,6 @@
15
15
  padding-left: 5px;
16
16
  cursor: pointer;
17
17
  }
18
-
19
18
  .df {
20
19
  display: flex;
21
20
  }
@@ -30,7 +29,7 @@
30
29
  background-color: white;
31
30
  width: 75px;
32
31
  cursor: pointer;
33
- padding: 4px 0px;
32
+ padding: 4px 2px;
34
33
  border-radius: 4px;
35
34
  }
36
35
  .cron_builder_bordering select option:hover {
@@ -47,11 +46,46 @@
47
46
  border: 1px solid #d0cbcb;
48
47
  padding: 5px;
49
48
  background-color: #dddef13d;
50
- width: 50%;
49
+ width: 100%;
50
+ max-width: 600px;
51
51
  }
52
52
  .text_align_left {
53
53
  text-align: left;
54
54
  }
55
- .nav li {
55
+ .cron_builder .nav li {
56
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%);
57
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
+ }
@@ -89,9 +89,9 @@ var HourlyCron = /*#__PURE__*/function (_Component) {
89
89
  onChange: this.onHourChange,
90
90
  value: this.state.value[2].split('/')[1] ? this.state.value[2].split('/')[1] : ''
91
91
  }), /*#__PURE__*/React.createElement("span", null, translateFn('hour(s)'))), /*#__PURE__*/React.createElement("div", {
92
- className: "well df well-small margin-right-0 margin-left-0"
92
+ className: "well well-small margin-right-0 margin-left-0"
93
93
  }, /*#__PURE__*/React.createElement("div", {
94
- className: "text_align_right row",
94
+ className: "text_align_right",
95
95
  style: {
96
96
  width: '100%'
97
97
  }
package/dist/cron.js CHANGED
@@ -95,12 +95,14 @@ var Cron = /*#__PURE__*/function (_Component) {
95
95
  value: function tabChanged(tab) {
96
96
  var _this2 = this;
97
97
 
98
- this.setState({
99
- selectedTab: tab,
100
- value: this.defaultValue(tab)
101
- }, function () {
102
- return _this2.parentChange(_this2.defaultValue(tab));
103
- });
98
+ if (this.state.selectedTab !== tab) {
99
+ this.setState({
100
+ selectedTab: tab,
101
+ value: this.defaultValue(tab)
102
+ }, function () {
103
+ return _this2.parentChange(_this2.defaultValue(tab));
104
+ });
105
+ }
104
106
  }
105
107
  }, {
106
108
  key: "getHeaders",
@@ -109,9 +111,10 @@ var Cron = /*#__PURE__*/function (_Component) {
109
111
 
110
112
  return this.state.headers.map(function (d, index) {
111
113
  return /*#__PURE__*/React.createElement("li", {
112
- key: index,
113
- className: _this3.state.selectedTab === d ? 'active' : ''
114
+ className: "nav-item",
115
+ key: index
114
116
  }, /*#__PURE__*/React.createElement("a", {
117
+ className: "nav-link ".concat(_this3.state.selectedTab === d ? 'active' : ''),
115
118
  onClick: _this3.tabChanged.bind(_this3, d)
116
119
  }, _this3.translate(d)));
117
120
  });
@@ -142,7 +145,7 @@ var Cron = /*#__PURE__*/function (_Component) {
142
145
  var newVal = '';
143
146
  newVal = val.toString().replace(/,/g, ' ');
144
147
  newVal = newVal.replace(/!/g, ',');
145
- this.props.onChange(newVal);
148
+ this.props.onChange(newVal, this.getVal());
146
149
  }
147
150
  }, {
148
151
  key: "getVal",
@@ -161,13 +164,15 @@ var Cron = /*#__PURE__*/function (_Component) {
161
164
  }, {
162
165
  key: "defaultValue",
163
166
  value: function defaultValue(tab) {
164
- var index = this.state.headers.indexOf(tab);
167
+ var defaultValCron = metadata.find(function (m) {
168
+ return m.name == tab;
169
+ });
165
170
 
166
- if (metadata[index] === -1) {
171
+ if (!defaultValCron || !defaultValCron.initialCron) {
167
172
  return;
168
173
  }
169
174
 
170
- return metadata[index].initialCron;
175
+ return defaultValCron.initialCron;
171
176
  }
172
177
  }, {
173
178
  key: "getComponent",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cron-generator",
3
- "version": "1.2.12",
3
+ "version": "1.3.3",
4
4
  "description": "Simple react component to generate cron expression",
5
5
  "keywords": [
6
6
  "React cron generator",
@@ -41,7 +41,7 @@
41
41
  "cronstrue": "^1.72.0",
42
42
  "react": "^16.8.6",
43
43
  "react-dom": "^16.8.6"
44
- },
44
+ },
45
45
  "homepage": "https://sojinantony01.github.io/react-cron-generator",
46
46
  "scripts": {
47
47
  "start": "react-scripts start",
@@ -49,7 +49,7 @@
49
49
  "test": "react-scripts test",
50
50
  "eject": "react-scripts eject",
51
51
  "deploy": "gh-pages -d build",
52
- "react-build": "react-scripts build"
52
+ "react-build": "CI=false && react-scripts build"
53
53
  },
54
54
  "eslintConfig": {
55
55
  "extends": "react-app"