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

Single option select feature in the drowdown #22

Closed alok01rai closed 2 years ago

alok01rai commented 2 years ago

There is no option to restrict visitors to select only one value from the dropdown, i. e. If I would like to restrict visitors to select only one month, only one hour, day or minute I can't restrict.

It will be great if you can add a prop saying mode Single.

xrutayisire commented 2 years ago

Hello again,

Thanks for the feature request following our discussion.

I added a new optional prop "mode", by default set to "multiple" but can be set to "single".

You can see the type definition here.

And the demo here: https://xrutayisire.github.io/react-js-cron/?path=/docs/reactjs-cron--single-selection-mode

Can you confirm that it's what you want before I release the changes ? 😃

alok01rai commented 2 years ago

It's perfect. Please release the changes. Thanks for your speedy support.

xrutayisire commented 2 years ago

Thanks for the feedback!

New release v1.4.0 is out in the wild with the new prop "mode" 🎉

Let me know if there is a problem with the release.

alok01rai commented 2 years ago

Hi @xrutayisire ,

Can we enable periodicityOnDoubleClick in single mode?

Also while selecting Month or Year is there option to remove and criteria. I,e, When you select Month there we can select the date as well as Day, so is there any option to remove day option from there?

alok01rai commented 2 years ago

periodicityOnDoubleClick in single mode - Purpose If I would like to run cron on every 15 mins.

vivek-kandhvar commented 2 years ago

Thanks for adding the support for single selection. If we enable single mode selection, the dropdown should auto close on selecting a value. Right now it always stays until the customer clicks outside.

xrutayisire commented 2 years ago

Hello :)

I agree that I could be improved. I don't have the time to do it right now (holidays).

I will handle this issue and your comment when I come back.

xrutayisire commented 2 years ago

Hello,

New release v2.0.0 🥳

@alok01rai, periodicityOnDoubleClick is not ignored anymore when single mode is active, so you can use it. @alok01rai, with new props allowedDropdowns and allowedPeriods, you should be able to display or hide what you want, when you want it. It's dynamic, so feel free to try it. @vivek-kandhvar, when single mode is active AND periodicityOnDoubleClick is false the dropdown will close itself atomatically after any selection.