react-cron-generator 2.1.3 → 2.1.5

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
@@ -88,6 +88,12 @@ function App() {
88
88
  }
89
89
  ```
90
90
 
91
+ ## 📸 Screenshots
92
+
93
+ ![Cron Generator Interface](https://raw.githubusercontent.com/sojinantony01/react-cron-generator/master/public/images/Screenshot%20from%202019-06-08%2000-31-31.png)
94
+
95
+ ![Cron Generator Options](https://raw.githubusercontent.com/sojinantony01/react-cron-generator/master/public/images/Screenshot%20from%202019-06-08%2000-31-57.png)
96
+
91
97
  ## 📖 Documentation
92
98
 
93
99
  ### Props
@@ -96,6 +102,7 @@ function App() {
96
102
  |------|------|---------|-------------|
97
103
  | `value` | `string` | `undefined` | Initial cron expression (Unix: 5 fields, Quartz: 6 or 7 fields) |
98
104
  | `onChange` | `(value: string, text: string) => void` | **Required** | Callback fired when cron value changes. Receives cron expression and human-readable text |
105
+ | `onHeaderChange` | `(header: string) => void` | `undefined` | Callback fired when the selected tab/header changes. Receives header value (`'Minutes'`, `'Hourly'`, `'Daily'`, `'Weekly'`, `'Monthly'`, `'Custom'`). Called on initial mount and whenever tabs changes |
99
106
  | `showResultText` | `boolean` | `false` | Display human-readable description below the builder |
100
107
  | `showResultCron` | `boolean` | `false` | Display the cron expression below the builder |
101
108
  | `isUnix` | `boolean` | `false` | Use Unix format (5 fields) instead of Quartz. **Cannot be used with `use6FieldQuartz`** |
@@ -363,12 +370,6 @@ Give a ⭐️ if this project helped you!
363
370
  - [GitHub Repository](https://github.com/sojinantony01/react-cron-generator)
364
371
  - [Issue Tracker](https://github.com/sojinantony01/react-cron-generator/issues)
365
372
 
366
- ## 📸 Screenshots
367
-
368
- ![Cron Generator Interface](https://raw.githubusercontent.com/sojinantony01/react-cron-generator/master/public/images/Screenshot%20from%202019-06-08%2000-31-31.png)
369
-
370
- ![Cron Generator Options](https://raw.githubusercontent.com/sojinantony01/react-cron-generator/master/public/images/Screenshot%20from%202019-06-08%2000-31-57.png)
371
-
372
373
  ---
373
374
 
374
375
  Made with ❤️ by [Sojin Antony](https://github.com/sojinantony01)
package/build/cron.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { HeaderKeyType } from './meta';
2
+ import { HeaderKeyType, HeaderValType } from './meta';
3
3
  export interface CronProp {
4
4
  value?: string;
5
5
  onChange(val: string, text: string): void;
@@ -13,6 +13,7 @@ export interface CronProp {
13
13
  disabled?: boolean;
14
14
  isUnix?: boolean;
15
15
  use6FieldQuartz?: boolean;
16
+ onHeaderChange?(header: HeaderValType): void;
16
17
  }
17
18
  declare const Cron: React.FunctionComponent<CronProp>;
18
19
  export default Cron;
@@ -1 +1 @@
1
- {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../src/lib/cron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAyB,aAAa,EAAiB,MAAM,QAAQ,CAAC;AAK7E,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAeD,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CA8X3C,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../src/lib/cron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAyB,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAK7E,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;CAC9C;AAeD,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAuY3C,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/build/index.js CHANGED
@@ -9270,6 +9270,14 @@ const Cron = (props) => {
9270
9270
  parentChange(state.value);
9271
9271
  }
9272
9272
  }, [state.value, parentChange]);
9273
+ /**
9274
+ * Notify parent when selected tab changes
9275
+ */
9276
+ useEffect(() => {
9277
+ if (state.selectedTab && props.onHeaderChange) {
9278
+ props.onHeaderChange(state.selectedTab);
9279
+ }
9280
+ }, [state.selectedTab]);
9273
9281
  /**
9274
9282
  * Render tab headers
9275
9283
  */