Skip to content

Commit 1b19a7a

Browse files
committed
feat: copilot review
1 parent 335731a commit 1b19a7a

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

packages/devextreme/js/__internal/scheduler/r1/utils/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export const getKeyByGroup = (
338338

339339
export const getToday = (
340340
indicatorTime: Date | undefined,
341-
timeZoneCalculator: TimeZoneCalculator,
341+
timeZoneCalculator: TimeZoneCalculator | undefined,
342342
): Date => {
343343
const todayDate = indicatorTime ?? new Date();
344344

packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ export class GroupedDataMapProvider {
143143
} = cellInfo;
144144
const { viewOffset } = this.viewOptions;
145145

146-
const matchingCell = this.getRowsForCellSearch(allDay, groupIndex)
147-
.flatMap((row) => row)
148-
.find((cell) => {
146+
// eslint-disable-next-line no-undef-init
147+
let foundPosition: CellPositionData | undefined = undefined;
148+
this.getRowsForCellSearch(allDay, groupIndex).some(
149+
(row) => row.some((cell) => {
149150
const originCellData = cell.cellData;
150151
// NOTE: If this is appointment's render call
151152
// we should shift the real cellData dates by viewOffset
@@ -158,11 +159,18 @@ export class GroupedDataMapProvider {
158159
}
159160
: originCellData;
160161

161-
return this.isSameGroupIndexAndIndex(cellData, groupIndex, index)
162-
&& this.isStartDateInCell(startDate, allDay ?? false, cellData, originCellData);
163-
});
162+
if (
163+
this.isSameGroupIndexAndIndex(cellData, groupIndex, index)
164+
&& this.isStartDateInCell(startDate, allDay, cellData, originCellData)
165+
) {
166+
foundPosition = cell.position;
167+
return true;
168+
}
169+
return false;
170+
}),
171+
);
164172

165-
return matchingCell?.position;
173+
return foundPosition;
166174
}
167175

168176
private getRowsForCellSearch(

packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator_month.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator {
4444

4545
data.today = this.isCurrentDate(
4646
startDate,
47-
indicatorTime as Date,
48-
timeZoneCalculator as TimeZoneCalculator,
47+
indicatorTime,
48+
timeZoneCalculator,
4949
);
5050
data.otherMonth = this.isOtherMonth(startDate, this.minVisibleDate, this.maxVisibleDate);
5151
data.isFirstDayMonthHighlighting = isFirstCellInMonthWithIntervalCount(
@@ -57,7 +57,11 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator {
5757
return data;
5858
}
5959

60-
isCurrentDate(date: Date, indicatorTime: Date, timeZoneCalculator: TimeZoneCalculator): boolean {
60+
isCurrentDate(
61+
date: Date,
62+
indicatorTime: Date | undefined,
63+
timeZoneCalculator: TimeZoneCalculator | undefined,
64+
): boolean {
6165
return dateUtils.sameDate(date, getToday(indicatorTime, timeZoneCalculator));
6266
}
6367

0 commit comments

Comments
 (0)