im-perativa / streamlit-calendar

A Streamlit component to show calendar view using FullCalendar
https://calendar-component.streamlit.app/
Apache License 2.0
101 stars 10 forks source link

Implemented fullcalendar 'datesSet' callback #25

Open MaxvandenBoom opened 6 months ago

MaxvandenBoom commented 6 months ago

Hi Muhammad,

I noticed that the fullcalendar Streamlit component did not have a callback for date changes in the fullcalender yet. This is handy, for example, when the prev/next buttons are used in the calendar. As such, I implemented the fullcalendar's datesSet callback (https://fullcalendar.io/docs/datesSet) and wanted to share it.

For this update, I build upon your most recent release (22 dec 2023) and followed your style of coding (return format and variable naming).

One problem though: when the calendar’s dates change, both datesSet and eventsSet are triggered. I think setComponent causes only eventsSet to be triggered. As a result, the datesSet callback only works when there is no eventsSet callback requested. I added a warning in the component creation, but maybe you can think of a more elegant solution...

Best, Max

MaxvandenBoom commented 5 months ago

@im-perativa little bump in case you missed it!

im-perativa commented 3 months ago

@MaxvandenBoom thanks for your contribution and sorry for such late reply. Initially i create this package to provide a simple calendar function in streamlit and I'm not sure if we should add every callback to it because in the end we also limited by the streamlit capabilites.

For now, I believe a comprehensive tests with all original callback and their impact with each other should be done first and then we can add all compatible callbacks to this package in a single release.