Scheduler: Provide the SnapToCellsMode option#33021
Scheduler: Provide the SnapToCellsMode option#33021sjbur wants to merge 9 commits intoDevExpress:26_1from
Conversation
b489e98 to
0e91e46
Compare
0e91e46 to
21d39d2
Compare
21d39d2 to
7263bf7
Compare
...s/__internal/scheduler/view_model/generate_view_model/options/get_view_model_options.test.ts
Outdated
Show resolved
Hide resolved
| export type GroupOrientation = 'vertical' | 'horizontal'; | ||
| export type ViewType = 'agenda' | 'day' | 'month' | 'timelineDay' | 'timelineMonth' | 'timelineWeek' | 'timelineWorkWeek' | 'week' | 'workWeek'; | ||
| export type AllDayPanelModeType = 'all' | 'allDay' | 'hidden'; | ||
| export type SnapToCellsModeType = 'always' | 'auto' | 'never'; |
There was a problem hiding this comment.
Small suggestion: we can import this type directly from Scheduler's d.ts (like Appointment type is imported), instead of duplicating the type here.
| isTimelineView: true, isMonthView: true, viewOrientation: 'horizontal', snapToCellsMode: 'always', | ||
| }, | ||
| agenda: { | ||
| isTimelineView: false, isMonthView: false, viewOrientation: 'vertical', snapToCellsMode: 'always', |
There was a problem hiding this comment.
question: can we remove 'agenda' view from this config as it was before? Agenda view doesn't have snapping at all, and so agenda.snapToCellsMode value will never be read.
There was a problem hiding this comment.
As I see in the generateViewModel function here, when generating view model for agenda, the option manager is never used. So we really don't need value for 'agenda' here
| timelineWeek: { isTimelineView: true, isMonthView: false, viewOrientation: 'horizontal' }, | ||
| timelineWorkWeek: { isTimelineView: true, isMonthView: false, viewOrientation: 'horizontal' }, | ||
| timelineMonth: { isTimelineView: true, isMonthView: true, viewOrientation: 'horizontal' }, | ||
| snapToCellsMode: SnapToCellsModeType; |
There was a problem hiding this comment.
I suggest to move default snapToCellsMode values to contant_view.ts.
That file already defines specific default options for each view.
If you move default values there, then we won't need to get defaultSnapToCellsMode here, because schedulerStore.getViewOption('snapToCellsMode') will be enough
| innerStep2, | ||
| optionManager.getCells(panelName), | ||
| panelName === 'allDayPanel' ? 'always' : snapToCellsMode, | ||
| ); |
There was a problem hiding this comment.
Can we add tests that check that scheduler.snapToCellsMode and scheduler.view.snapToCellsMode options actually have effect?
I mean if I have this config:
$().dxScheduler({
snapToCellsMode: 'always',
currentView: 'day'
})or this config:
$().dxScheduler({
view: [{ type: 'day', snapToCells: 'always' }]
currentView: 'day'
})then check that the option is applied
There was a problem hiding this comment.
Added integration test which tests 3 cases for day view
- Checks default behaviour without setting snapToCellsMode
- Checks behaviour when root snapToCellsMode is set
- Checks behaviour when snapToCellsMode is set via views config
No description provided.