Closed pedrocarmona closed 5 years ago
Thanks, @pedrocarmona for this documentation. I agree that the use of plugins is not yet correctly documented. I did put your work into a small Glitch project https://glitch.com/edit/#!/stimu-fpkr-range?path=src/controllers/datepicker_controller.js:18:3
My main concern is that to achieve this we are using functions with underscore prefix which are meant to be private and could, therefore, change in the future. I
Bottom line, to fully support the range plugin it does require some extra work on the lib itself
Thanks for the mention. After a short experiment with Stimulus, I've gone back to React probably won't be contributing to this codebase, unfortunately.
Hi Adrian, thanks for feedback. I agree with you :) If you want I can make a PR with configurable element, just like in the example.
In another topic, I started using stimulusjs recently and I really like you approach to save and apply flatpickr's config. I am copying this approach to use a private controller for slim_select, and it feels not DRY. I see that few parts could be extracted:
utils#kebabCase
,_initializeOptions
_string
, _date
...
into its own npm package (ex stimulus-plugin / PluginController ... and then flatpickr would extend it.
Do you agree?@pedrocarmona about your suggestions, lots of thing will be largely simplified with the Value API please see https://github.com/stimulusjs/stimulus/pull/202
You can already test it by using
"stimulus": "https://github.com/stimulusjs/dev-builds/archive/b8cc8c4/stimulus.tar.gz"
About your proposed PR go ahead. How would you describe the API?
I was thinking that this could maybe be automatic if within the element there is both a rangeStart
& rangeStop
Target.
Can we do in such case a dynamic import of the npm package?
Hi Adrien,
Thank you for this lib. I am adding instructions to how to use the flatpickr's range plugin. Could also be added to the lib if you prefer.
Thank you, Pedro