Skip to content

Commit ae23da4

Browse files
authored
Scheduler: fix recurrence appointment width in month timeline for virtual scrolling (T1258030) (#30508)
Co-authored-by: Vladimir Bushmanov <[email protected]>
1 parent 3de8a6d commit ae23da4

File tree

4 files changed

+49
-12
lines changed

4 files changed

+49
-12
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Scheduler from 'devextreme-testcafe-models/scheduler';
2+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
3+
import { createWidget } from '../../../../helpers/createWidget';
4+
import url from '../../../../helpers/getPageUrl';
5+
import { scrollTo } from '../../helpers/utils';
6+
7+
fixture.disablePageReloads`Scheduler: Virtual scrolling`
8+
.page(url(__dirname, '../../../container.html'));
9+
10+
test('it should render recurrence appointment with correct width in month timeline view for virtual scrolling', async (t) => {
11+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
12+
13+
const scheduler = new Scheduler('#container');
14+
15+
await scrollTo(3000, 0);
16+
await t.expect(await takeScreenshot('virtual_scroll_timeline_3000.png', scheduler.workSpace)).ok();
17+
18+
await t
19+
.expect(compareResults.isValid())
20+
.ok(compareResults.errorMessages());
21+
}).before(async () => {
22+
await createWidget(
23+
'dxScheduler',
24+
{
25+
height: 300,
26+
currentView: 'timelineMonth',
27+
views: ['timelineMonth'],
28+
currentDate: new Date(2024, 9, 1),
29+
dataSource: [{
30+
text: 'appointment',
31+
startDate: new Date(2024, 9, 1),
32+
endDate: new Date(2024, 9, 2),
33+
recurrenceRule: 'FREQ=DAILY',
34+
}],
35+
scrolling: { mode: 'virtual' },
36+
},
37+
);
38+
});
25.5 KB
Loading

packages/devextreme/js/__internal/scheduler/appointments/m_cell_position_calculator.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,8 @@ class VirtualStrategy extends BaseStrategy {
222222
isVirtualScrolling = true;
223223

224224
calculateCellPositions(groupIndices, isAllDayRowAppointment, isRecurrentAppointment) {
225-
const appointments = isAllDayRowAppointment
226-
? this.appointments
227-
: this.appointments.filter(({ source, startDate, endDate }) => this.viewDataProvider.isGroupIntersectDateInterval(
228-
source.groupIndex,
229-
startDate,
230-
endDate,
231-
));
232-
233225
if (isRecurrentAppointment) {
234-
return this.createRecurrentAppointmentInfos(appointments, isAllDayRowAppointment);
226+
return this.createRecurrentAppointmentInfos(this.appointments, isAllDayRowAppointment);
235227
}
236228

237229
return super.calculateCellPositions(groupIndices, isAllDayRowAppointment, isRecurrentAppointment);

packages/devextreme/js/__internal/scheduler/appointments/m_settings_generator.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,17 @@ export class AppointmentSettingsGenerator {
657657
itemGroupIndices,
658658
isRecurrent,
659659
} = this._generateDateSettings();
660+
const { isVirtualScrolling, viewDataProvider } = this.options;
661+
const filteredDateSettings = this.isAllDayRowAppointment || !isVirtualScrolling
662+
? dateSettings
663+
: dateSettings.filter(({ source, startDate, endDate }) => viewDataProvider.isGroupIntersectDateInterval(
664+
source.groupIndex,
665+
startDate,
666+
endDate,
667+
));
660668

661-
const cellPositions = this._calculateCellPositions(dateSettings, itemGroupIndices);
662-
663-
const result = this._prepareAppointmentInfos(dateSettings, cellPositions, isRecurrent);
669+
const cellPositions = this._calculateCellPositions(filteredDateSettings, itemGroupIndices);
670+
const result = this._prepareAppointmentInfos(filteredDateSettings, cellPositions, isRecurrent);
664671

665672
return result;
666673
}

0 commit comments

Comments
 (0)