vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
1.35k stars 115 forks source link

resourceTimelineMultiMonth - new feature request #373

Open jasonladley opened 1 week ago

jasonladley commented 1 week ago

I've been using this calendar for a bit and I've really enjoyed working with it! Recently I was looking for a way to display 2 months or 3 months worth of resource data at a time. I found I could do so by modifying the code (event-calendar.min.js) a bit to add in a new view but was wondering if you'd consider making this an official view everyone could use in a future release? My changes were simple and are shown below:

I added

t.buttonText.resourceTimelineMultiMonth = "timeline 2 months",

and further into the code I define that view and set it's months to 2

t.views.resourceTimelineMultiMonth = {
                buttonText: Le,
                component: ii,
                displayEventEnd: !1,
                dayHeaderFormat: {
                    weekday: "short",
                    day: "numeric"
                },
                duration: {
                    months: 2
                },
                slotDuration: {
                    days: 1
                },
                theme: Re("ec-timeline ec-resource-month-view"),
                titleFormat: {
                    year: "numeric",
                    month: "long"
                }
            }

Now when initializing my calendar I have views like this:

views: {
            resourceTimeGridWeek: {pointer: true},
            resourceTimelineMonth: {
                pointer: true,
                slotWidth: 80,
                resources: resourcesObjectsByJobSet
            },
            resourceTimelineMultiMonth: {
                pointer: true,
                slotWidth: 80,
                resources: resourcesObjectsByJobSet
                },
}

my header toolbar was updated to support the resourceTimelineMultiMonth view

        headerToolbar: {
            start: 'prev,next today',
            center: 'title',
            end: 'resourceTimeGridWeek,resourceTimelineMonth,resourceTimelineMultiMonth'
        }

Any potential issues updating the calendar to add a view like resourceTimelineMultiMonth officially? My use case for this was users asking me to have a way to view data from the previous month on their calendar without clicking back a month. They wanted to click and drag to expand events into future months. for example from November into December. At the moment this isn't possible, but viewing multiple months at a time would allow for this operation.

vkurko commented 6 days ago

Thank you for sharing your code. Indeed, there is currently a lack of an official way to add your own views. I will think about making such an option available.