xrutayisire / react-js-cron

A React cron editor built with antd
https://xrutayisire.github.io/react-js-cron/?path=/docs/reactjs-cron--demo
MIT License
247 stars 106 forks source link

Provide control over select props for each field type #49

Closed matt-koevort closed 1 year ago

matt-koevort commented 1 year ago

🤔 This is a ...

🔗 Related issue link

💡 Background and solution

We have recently run into a problem where the onMouseDown event handler in antd/lib/select component is causing a modal (where the Cron component is rendered) to close. It has been found that this is due to the event bubbling. To solve this we can either:

  1. Explicitly set the onMouseDown to not propagate the event, or
  2. Provide more granular control over each select component that can be rendered by the Cron component

This PR addresses Option 2.

The Cron component can take a customSelectProps prop which is an object which has optional SelectProps definitions for each field type. These are then spread into each respective field component in Cron.tsx.

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03 :tada:

Comparison is base (5d8585e) 84.75% compared to head (f1f04a2) 84.78%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #49 +/- ## ========================================== + Coverage 84.75% 84.78% +0.03% ========================================== Files 12 12 Lines 492 493 +1 Branches 197 198 +1 ========================================== + Hits 417 418 +1 Misses 12 12 Partials 63 63 ``` | [Impacted Files](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire) | Coverage Δ | | |---|---|---| | [src/fields/Hours.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9Ib3Vycy50c3g=) | `71.42% <ø> (ø)` | | | [src/fields/Minutes.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9NaW51dGVzLnRzeA==) | `64.28% <ø> (ø)` | | | [src/fields/MonthDays.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9Nb250aERheXMudHN4) | `61.53% <ø> (ø)` | | | [src/fields/Months.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9Nb250aHMudHN4) | `55.55% <ø> (ø)` | | | [src/fields/Period.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9QZXJpb2QudHN4) | `56.75% <ø> (ø)` | | | [src/fields/WeekDays.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL2ZpZWxkcy9XZWVrRGF5cy50c3g=) | `50.00% <ø> (ø)` | | | [src/Cron.tsx](https://codecov.io/gh/xrutayisire/react-js-cron/pull/49?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire#diff-c3JjL0Nyb24udHN4) | `93.54% <100.00%> (+0.07%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Xavier+Rutayisire)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

xrutayisire commented 1 year ago

Hello, thanks for the MR! I let you handle prettier problems