Skip to content

Commit 264d448

Browse files
authored
Scheduler: get rid of the old adapters (DevExpress#30828)
1 parent 65b80bf commit 264d448

File tree

6 files changed

+33
-85
lines changed

6 files changed

+33
-85
lines changed

packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { FunctionTemplate } from '@js/core/templates/function_template';
66
import Button from '@js/ui/button';
77

88
import { APPOINTMENT_SETTINGS_KEY, LIST_ITEM_CLASS, LIST_ITEM_DATA_KEY } from './constants';
9-
import { AppointmentTooltipInfo } from './m_data_structures';
9+
import type { AppointmentTooltipItem } from './types';
1010

1111
const APPOINTMENT_COLLECTOR_CLASS = 'dx-scheduler-appointment-collector';
1212
const COMPACT_APPOINTMENT_COLLECTOR_CLASS = `${APPOINTMENT_COLLECTOR_CLASS}-compact`;
@@ -52,7 +52,14 @@ export class CompactAppointmentsHelper {
5252
this.instance._dataAccessors.set('endDate', targeted, info.sourceAppointment.endDate);
5353
}
5454

55-
return new AppointmentTooltipInfo(appointment, targeted, items.colors[index], items.settings[index]);
55+
const tooltipInfo: AppointmentTooltipItem = {
56+
appointment,
57+
targetedAppointment: targeted,
58+
color: items.colors?.[index] ?? [],
59+
settings: items.settings?.[index] ?? [],
60+
};
61+
62+
return tooltipInfo;
5663
});
5764
}
5865

packages/devextreme/js/__internal/scheduler/m_data_structures.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/devextreme/js/__internal/scheduler/m_date_adapter.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.

packages/devextreme/js/__internal/scheduler/m_scheduler.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import NotifyScheduler from './base/m_widget_notify_scheduler';
4141
import { SchedulerHeader } from './header/m_header';
4242
import type { HeaderOptions } from './header/types';
4343
import { CompactAppointmentsHelper } from './m_compact_appointments_helper';
44-
import { AppointmentTooltipInfo } from './m_data_structures';
4544
import { hide as hideLoading, show as showLoading } from './m_loading';
4645
import { getRecurrenceProcessor } from './m_recurrence';
4746
import type { SubscribeKey, SubscribeMethods } from './m_subscribes';
@@ -60,6 +59,7 @@ import {
6059
import { SchedulerOptionsBaseWidget } from './scheduler_options_base_widget';
6160
import { DesktopTooltipStrategy } from './tooltip_strategies/m_desktop_tooltip_strategy';
6261
import { MobileTooltipStrategy } from './tooltip_strategies/m_mobile_tooltip_strategy';
62+
import type { AppointmentTooltipItem } from './types';
6363
import { AppointmentAdapter } from './utils/appointment_adapter/appointment_adapter';
6464
import { AppointmentDataAccessor } from './utils/data_accessor/appointment_data_accessor';
6565
import type { IFieldExpr } from './utils/index';
@@ -1984,7 +1984,12 @@ class Scheduler extends SchedulerOptionsBaseWidget {
19841984
const getAppointmentColor = this.createGetAppointmentColor();
19851985
const deferredColor = getAppointmentColor(appointmentConfig) as any;
19861986

1987-
const info = new AppointmentTooltipInfo(appointment, targetedAppointment, deferredColor);
1987+
const info: AppointmentTooltipItem = {
1988+
appointment,
1989+
targetedAppointment,
1990+
color: deferredColor,
1991+
settings: [],
1992+
};
19881993
this.showAppointmentTooltipCore(element, [info]);
19891994
}
19901995
}

packages/devextreme/js/__internal/scheduler/m_utils_time_zone.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { macroTaskArray } from '@ts/scheduler/utils/index';
55

66
import dateUtils from '../../core/utils/date';
77
import { globalCache } from './global_cache';
8-
import DateAdapter from './m_date_adapter';
98
import timeZoneDataUtils from './timezones/m_utils_timezones_data';
109
import timeZoneList from './timezones/timezone_list';
1110

@@ -43,17 +42,16 @@ const createUTCDateWithLocalOffset = (date) => {
4342
));
4443
};
4544

46-
const createDateFromUTCWithLocalOffset = (date) => {
47-
const result = DateAdapter(date);
48-
49-
const timezoneOffsetBeforeInMin = result.getTimezoneOffset();
50-
result.addTime(result.getTimezoneOffset('minute'));
51-
result.subtractMinutes(timezoneOffsetBeforeInMin - result.getTimezoneOffset());
52-
53-
return result.source;
54-
};
45+
const createDateFromUTCWithLocalOffset = (date: Date): Date => new Date(
46+
date.getUTCFullYear(),
47+
date.getUTCMonth(),
48+
date.getUTCDate(),
49+
date.getUTCHours(),
50+
date.getUTCMinutes(),
51+
date.getUTCSeconds(),
52+
);
5553

56-
const createUTCDate = (date) => new Date(Date.UTC(
54+
const createUTCDate = (date: Date): Date => new Date(Date.UTC(
5755
date.getUTCFullYear(),
5856
date.getUTCMonth(),
5957
date.getUTCDate(),

packages/devextreme/js/__internal/scheduler/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Appointment } from '@js/ui/scheduler';
22

33
import type { ResourceLoader } from './utils/loader/resource_loader';
4+
import type { AppointmentItemViewModel } from './view_model/generate_view_model/types';
45

56
export type Direction = 'vertical' | 'horizontal';
67
export type GroupOrientation = 'vertical' | 'horizontal';
@@ -242,3 +243,10 @@ export interface ViewDataProviderType {
242243
getCellsBetween: (first: ViewCellData, last: ViewCellData) => ViewCellData[];
243244
viewType: ViewType;
244245
}
246+
247+
export interface AppointmentTooltipItem {
248+
appointment: Appointment;
249+
targetedAppointment?: Appointment;
250+
color?: string;
251+
settings: AppointmentItemViewModel[];
252+
}

0 commit comments

Comments
 (0)