Skip to content
Draft
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
36 changes: 6 additions & 30 deletions packages/devextreme/js/__internal/scheduler/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { DataSource } from '@js/common/data';
import registerComponent from '@js/core/component_registrator';
import config from '@js/core/config';
import { getPublicElement } from '@js/core/element';
import type { PostponedOperations } from '@js/core/postponed_operations';
import type { Coordinates, dxElementWrapper } from '@js/core/renderer';
import $ from '@js/core/renderer';
import { BindableTemplate } from '@js/core/templates/bindable_template';
Expand Down Expand Up @@ -57,7 +56,6 @@ import type {
SelectionEndEvent,
} from '@js/ui/scheduler';
import errors from '@js/ui/widget/ui.errors';
import type { Options } from '@ts/core/options/index';
import { addOffsets, isValidDate } from '@ts/core/utils/date';
import { tabbable } from '@ts/core/utils/selectors';
import type { OptionChanged } from '@ts/core/widget/types';
Expand Down Expand Up @@ -95,7 +93,6 @@ import type { AppointmentTooltipExtraOptions, AppointmentTooltipOptions } from '
import type {
AppointmentTooltipContextMenuEventArgs,
AppointmentTooltipItem,
CreateComponentFn,
DOMMetaData,
GroupBoundsOffset,
MappedAppointmentFields,
Expand Down Expand Up @@ -367,12 +364,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
// and initialization in constructor will erase the data
private timeZoneCalculatorInstance: TimeZoneCalculator | null = null;

declare postponedOperations: PostponedOperations;

declare _disposed?: boolean;

declare _options: Options;

private a11yStatus!: dxElementWrapper;

// TODO: used externally in m_appointment_drag_behavior.ts,
Expand All @@ -389,9 +380,8 @@ class Scheduler extends SchedulerOptionsBaseWidget {

declare _dataSource: DataSource | undefined;

// TODO: used externally in workspaces/work_space.ts
// eslint-disable-next-line @typescript-eslint/naming-convention -- inherited Widget API
declare _createComponent: CreateComponentFn;
declare _getTemplate: (template: unknown) => FunctionTemplate;

// TODO: used externally in m_subscribes.ts,
// view_model/preparation/prepare_appointments.ts,
Expand Down Expand Up @@ -680,7 +670,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
this.updateOption('header', name, value);
this.updateOption('workSpace', name, value);
this._appointments.option(name, value);
// @ts-expect-error
super._optionChanged(args);
break;
case 'width':
Expand All @@ -690,12 +679,10 @@ class Scheduler extends SchedulerOptionsBaseWidget {
this.updateOption('workSpace', 'width', value);
}
this.updateOption('workSpace', 'schedulerWidth', value);
// @ts-expect-error
super._optionChanged(args);
this._dimensionChanged(null, true);
break;
case 'height':
// @ts-expect-error
super._optionChanged(args);
this._dimensionChanged(null, true);
this.updateOption('workSpace', 'schedulerHeight', value);
Expand Down Expand Up @@ -787,7 +774,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
}
break;
default:
// @ts-expect-error
super._optionChanged(args);
}
}
Expand Down Expand Up @@ -892,9 +878,9 @@ class Scheduler extends SchedulerOptionsBaseWidget {
}

_fireContentReadyAction(result?: DeferredObj<void>): void {
// @ts-expect-error
const contentReadyBase = super._fireContentReadyAction.bind(this);
const fireContentReady = (): void => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
contentReadyBase();
result?.resolve();
};
Expand All @@ -908,11 +894,10 @@ class Scheduler extends SchedulerOptionsBaseWidget {
}
}

_dimensionChanged(value: unknown, isForce = false): void {
_dimensionChanged(value?: unknown, isForce = false): void {
const isFixedHeight = typeof this.option('height') === 'number';
const isFixedWidth = typeof this.option('width') === 'number';

// @ts-expect-error
if (!this._isVisible()) {
return;
}
Expand Down Expand Up @@ -945,7 +930,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {

_clean(): void {
this.cleanPopup();
// @ts-expect-error
super._clean();
}

Expand Down Expand Up @@ -1052,7 +1036,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
appointmentTooltip: new EmptyTemplate(),
dropDownAppointment: new EmptyTemplate(),
});
// @ts-expect-error
super._initTemplates();
}

Expand Down Expand Up @@ -1101,7 +1084,7 @@ class Scheduler extends SchedulerOptionsBaseWidget {
}

_renderContent(): void {
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._renderContentImpl();
}

Expand Down Expand Up @@ -1133,7 +1116,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {

workspace?.option('allDayExpanded', this.isAllDayExpanded());

// @ts-expect-error
const viewModel: AppointmentViewModelPlain[] = this._isVisible()
? this._layoutManager.generateViewModel()
: [];
Expand Down Expand Up @@ -1199,7 +1181,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
// NOTE: Stop all scheduled macro tasks
macroTaskArray.dispose();

// @ts-expect-error
super._dispose();
}

Expand Down Expand Up @@ -1249,15 +1230,13 @@ class Scheduler extends SchedulerOptionsBaseWidget {
indicatorTime,
);

// @ts-expect-error
this.setAria({ label });
this.a11yStatus.text(label);
}

private renderA11yStatus(): void {
this.a11yStatus = createA11yStatusContainer();
this.a11yStatus.prependTo(this.$element());
// @ts-expect-error
this.setAria({ role: 'application' });
}

Expand Down Expand Up @@ -1531,7 +1510,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
_render(): void {
this.getWorkSpace()?.updateHeaderEmptyCellWidth();

// @ts-expect-error
super._render();
}

Expand Down Expand Up @@ -2714,10 +2692,8 @@ class Scheduler extends SchedulerOptionsBaseWidget {
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
(Scheduler as any).include(DataHelperMixin);
Scheduler.include(DataHelperMixin);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
registerComponent('dxScheduler', Scheduler as any);
registerComponent('dxScheduler', Scheduler);

export default Scheduler;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Widget from '@js/ui/widget/ui.widget';
import { extend } from '@ts/core/utils/extend';
import type { OptionChanged } from '@ts/core/widget/types';
import Widget from '@ts/core/widget/widget';

import {
DEFAULT_SCHEDULER_INTEGRATION_OPTIONS,
Expand All @@ -18,8 +18,6 @@ import { SchedulerOptionsValidator, SchedulerOptionsValidatorErrorsHandler } fro
import timeZoneUtils from './utils_time_zone';

export class SchedulerOptionsBaseWidget extends Widget<SafeSchedulerOptions> {
declare _disposed?: boolean;

protected views: NormalizedView[] = [];

public currentView!: NormalizedView;
Expand All @@ -28,15 +26,13 @@ export class SchedulerOptionsBaseWidget extends Widget<SafeSchedulerOptions> {

private optionsValidatorErrorHandler!: SchedulerOptionsValidatorErrorsHandler;

protected _init(): void {
// @ts-expect-error
_init(): void {
super._init();
this.optionsValidator = new SchedulerOptionsValidator();
this.optionsValidatorErrorHandler = new SchedulerOptionsValidatorErrorsHandler();
}

protected _getDefaultOptions(): SafeSchedulerOptions {
// @ts-expect-error
_getDefaultOptions(): SafeSchedulerOptions {
const options = super._getDefaultOptions();

return extend(true, options, {
Expand All @@ -46,8 +42,7 @@ export class SchedulerOptionsBaseWidget extends Widget<SafeSchedulerOptions> {
}) as SafeSchedulerOptions;
}

protected _defaultOptionsRules(): SchedulerOptionsRule[] {
// @ts-expect-error
_defaultOptionsRules(): SchedulerOptionsRule[] {
const rules: SchedulerOptionsRule[] = super._defaultOptionsRules();

return rules.concat(DEFAULT_SCHEDULER_OPTIONS_RULES);
Expand All @@ -62,8 +57,7 @@ export class SchedulerOptionsBaseWidget extends Widget<SafeSchedulerOptions> {
);
}

protected _initMarkup(): void {
// @ts-expect-error
_initMarkup(): void {
super._initMarkup();
this.updateViews();
this.validateOptions();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { template } from '@js/common';
import type { DefaultOptionsRule } from '@js/core/options';
import type { Properties } from '@js/ui/scheduler';

export type RawViewType = Required<Properties>['views'][number];
Expand Down Expand Up @@ -33,10 +34,7 @@ export interface SchedulerInternalOptions {
skippedDays?: number[];
}

export interface SchedulerOptionsRule {
device: () => boolean;
options: Properties & Partial<SchedulerInternalOptions>;
}
export type SchedulerOptionsRule = DefaultOptionsRule<SafeSchedulerOptions>;

type RequiredOptions = 'views'
| 'currentView'
Expand Down
Loading