Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const dateLocalization = dependencyInjector({
return formatter(date);
},

parse(text: string, format: FormatObject | string): Date | null | undefined {
parse(text: string, format?: FormatObject | string): Date | null | undefined {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const that = this;
// eslint-disable-next-line @typescript-eslint/init-declarations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const triggerVisibilityChangeEvent = function (eventName) {
const $element = $(element || 'body');

const changeHandlers = $element.filter(VISIBILITY_CHANGE_SELECTOR)
// @ts-expect-error
.add($element.find(VISIBILITY_CHANGE_SELECTOR));

for (let i = 0; i < changeHandlers.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,6 @@ export class ColumnsController extends modules.Controller {
result = false;
}
} else if (gridCoreUtils.isDateType(column.dataType)) {
// @ts-expect-error
parsedValue = dateLocalization.parse(text, column.format);
if (parsedValue) {
result = parsedValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ export class ColumnsView extends ColumnStateMixin(modules.View) {

if (browser.safari) {
// T198380, T809552
// @ts-expect-error
$table.append($('<thead>').append('<tr>'));
}

Expand Down
13 changes: 0 additions & 13 deletions packages/devextreme/js/__internal/ui/calendar/calendar.views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,13 @@ export class MonthView extends BaseView<MonthViewProperties> {
const { weekNumberRule = 'auto', firstDayOfWeek } = this.option();

if (weekNumberRule === 'auto') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.getWeekNumber(
date,
firstDayOfWeek,
firstDayOfWeek === 1 ? 'firstFourDays' : 'firstDay',
);
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.getWeekNumber(date, firstDayOfWeek, weekNumberRule);
}

Expand All @@ -170,7 +168,6 @@ export class MonthView extends BaseView<MonthViewProperties> {
_isTodayCell(cellDate: Date): boolean {
const { _todayDate: today } = this.option();

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameDate(cellDate, today());
}

Expand All @@ -188,12 +185,10 @@ export class MonthView extends BaseView<MonthViewProperties> {
}

_isStartDayOfMonth(cellDate: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameDate(cellDate, dateUtils.getFirstMonthDate(this.option('date')));
}

_isEndDayOfMonth(cellDate: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameDate(cellDate, dateUtils.getLastMonthDate(this.option('date')));
}

Expand Down Expand Up @@ -237,7 +232,6 @@ export class MonthView extends BaseView<MonthViewProperties> {
}

isBoundary(date: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameMonthAndYear(date, this.option('min')) || dateUtils.sameMonthAndYear(date, this.option('max'));
}

Expand All @@ -260,7 +254,6 @@ export class YearView extends BaseView {
_isTodayCell(cellDate: Date): boolean {
const { _todayDate: today } = this.option();

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameMonthAndYear(cellDate, today());
}

Expand Down Expand Up @@ -315,7 +308,6 @@ export class YearView extends BaseView {
}

isBoundary(date: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameYear(date, this.option('min')) || dateUtils.sameYear(date, this.option('max'));
}

Expand All @@ -330,7 +322,6 @@ export class DecadeView extends BaseView {
_isTodayCell(cellDate: Date): boolean {
const { _todayDate: today } = this.option();

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameYear(cellDate, today());
}

Expand Down Expand Up @@ -384,7 +375,6 @@ export class DecadeView extends BaseView {
}

_isValueOnCurrentView(currentDate: Date, value: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameDecade(currentDate, value);
}

Expand All @@ -397,7 +387,6 @@ export class DecadeView extends BaseView {
}

isBoundary(date: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameDecade(date, this.option('min')) || dateUtils.sameDecade(date, this.option('max'));
}

Expand All @@ -412,7 +401,6 @@ export class CenturyView extends BaseView {
_isTodayCell(cellDate: Date): boolean {
const { _todayDate: today } = this.option();

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameDecade(cellDate, today());
}

Expand Down Expand Up @@ -482,7 +470,6 @@ export class CenturyView extends BaseView {
}

isBoundary(date: Date): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return dateUtils.sameCentury(date, this.option('min')) || dateUtils.sameCentury(date, this.option('max'));
}

Expand Down
25 changes: 9 additions & 16 deletions packages/devextreme/js/__internal/ui/date_box/date_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ class DateView extends Editor<DateViewProperties> {
}

_renderRollers(): void {
if (!this._$rollersContainer) {
this._$rollersContainer = $('<div>').addClass(DATEVIEW_ROLLER_CONTAINER_CLASS);
}
this._$rollersContainer ??= $('<div>').addClass(DATEVIEW_ROLLER_CONTAINER_CLASS);

this._$rollersContainer.empty();
this._createRollerConfigs();
Expand All @@ -157,33 +155,30 @@ class DateView extends Editor<DateViewProperties> {
selectedIndex: this._rollerConfigs[name].selectedIndex,
showScrollbar: 'never',
scrollByContent: true,
// TODO Add event type once m_date_view_roller types is refactored
onStart: (e) => {
onStart: (e): void => {
const { component } = e;
const rollerConfig = this._rollerConfigs[name];

component._toggleActive(true);
this._setActiveRoller(rollerConfig);
},
// TODO Add event type once m_date_view_roller types is refactored
onEnd: (e) => {
onEnd: (e): void => {
e.component._toggleActive(false);
},
// TODO Add event type once m_date_view_roller types is refactored
onClick: (e) => {

onClick: (e): void => {
const { component } = e;
const { selectedIndex } = component.option();
const { selectedIndex = 0 } = component.option();
const rollerConfig = this._rollerConfigs[name];

component._toggleActive(true);
this._setActiveRoller(rollerConfig);
this._setRollerState(rollerConfig, selectedIndex);
component._toggleActive(false);
},
// TODO Add event type once m_date_view_roller types is refactored
onSelectedIndexChanged: (e) => {
const { component } = e;
const { selectedIndex } = component.option();
const { selectedIndex = 0 } = component.option();
const rollerConfig = this._rollerConfigs[name];

this._setRollerState(rollerConfig, selectedIndex);
Expand Down Expand Up @@ -211,7 +206,6 @@ class DateView extends Editor<DateViewProperties> {
}

_createRollerConfig(componentName: string): void {
// @ts-expect-error TODO remove once m_date_utils is refactored
const componentInfo = uiDateUtils.DATE_COMPONENTS_INFO[componentName];

const valueRange = this._calculateRollerConfigValueRange(componentName);
Expand Down Expand Up @@ -282,6 +276,7 @@ class DateView extends Editor<DateViewProperties> {
currentValue[setValue](rollerValue);

const normalizedDate = dateUtils.normalizeDate(currentValue, minDate, maxDate);
// @ts-expect-error ts-error
currentValue = uiDateUtils.mergeDates(normalizedDate, currentValue, 'time');
currentValue = dateUtils.normalizeDate(currentValue, minDate, maxDate);

Expand All @@ -304,8 +299,7 @@ class DateView extends Editor<DateViewProperties> {
const roller = this._rollers[rollerType];

if (roller) {
// @ts-expect-error TODO Remove once m_date_view_roller is reworked
const { items } = roller.option();
const { items = [] } = roller.option();

this._createRollerConfig(rollerType);
const rollerConfig = this._rollerConfigs[rollerType];
Expand Down Expand Up @@ -339,7 +333,6 @@ class DateView extends Editor<DateViewProperties> {
const maxMonth = maxYear && curDate.getMonth() === maxDate.getMonth();
const minHour = minMonth && curDate.getDate() === minDate.getDate();
const maxHour = maxMonth && curDate.getDate() === maxDate.getDate();
// @ts-expect-error TODO remove once m_date_utils is refactored
const componentInfo = uiDateUtils.DATE_COMPONENTS_INFO[componentName];
let { startValue } = componentInfo;
let { endValue } = componentInfo;
Expand Down
Loading
Loading