Skip to content

Commit 2266d69

Browse files
committed
fix: copilot review
1 parent 90b3df6 commit 2266d69

7 files changed

Lines changed: 24 additions & 41 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ class Scheduler extends SchedulerOptionsBaseWidget {
540540
this.updateOption('workSpace', name, value);
541541
this.repaint();
542542
break;
543-
// @ts-expect-error
544543
case 'skippedDays':
545544
break;
546545
case 'indicatorTime':

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface SchedulerInternalOptions {
3030
disabledExpr: string;
3131
visibleExpr: string;
3232
allowMultipleCellSelection: boolean;
33+
skippedDays?: number[];
3334
}
3435

3536
export interface SchedulerOptionsRule {

packages/devextreme/js/__internal/scheduler/workspaces/m_agenda.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { VIEWS } from '../utils/options/constants_view';
2424
import { reduceResourcesTree } from '../utils/resource_manager/agenda_group_utils';
2525
import type { GroupNode } from '../utils/resource_manager/types';
2626
import type { ListEntity } from '../view_model/types';
27-
import WorkSpace, { type WorkspaceDateTableScrollableConfig, type WorkspaceOptionChangedOptions, type WorkspaceOptionsInternal } from './m_work_space';
27+
import WorkSpace, { type WorkspaceOptionChangedOptions, type WorkspaceOptionsInternal } from './m_work_space';
2828

2929
const { tableCreator } = tableCreatorModule;
3030

@@ -394,11 +394,9 @@ class SchedulerAgenda extends WorkSpace {
394394

395395
protected renderTableBody(
396396
options: AgendaRenderOptions,
397+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
397398
delayCellTemplateRendering?: unknown,
398399
): void {
399-
if (delayCellTemplateRendering) {
400-
noop();
401-
}
402400
const cellTemplates: unknown[] = [];
403401
const cellTemplateOpt = options.cellTemplate as {
404402
render?: (templateOptions: unknown) => unknown;
@@ -448,7 +446,7 @@ class SchedulerAgenda extends WorkSpace {
448446
};
449447

450448
for (i = 0; i < this.rows.length; i += 1) {
451-
each(this.rows[i], fillTableBody.bind(this));
449+
each(this.rows[i], fillTableBody);
452450
this.setLastRowClass();
453451
}
454452

@@ -529,22 +527,12 @@ class SchedulerAgenda extends WorkSpace {
529527
updateScrollPosition(date: Date): void {
530528
const newDate = this.timeZoneCalculator.createDate(date, 'toGrid');
531529

532-
const bounds = this.getVisibleBounds();
533-
534-
if (this.needUpdateScrollPosition(newDate, bounds)) {
530+
if (this.needUpdateScrollPosition(newDate)) {
535531
this.scrollTo(newDate);
536532
}
537533
}
538534

539-
needUpdateScrollPosition(
540-
date: Date,
541-
appointmentGroupValues?: unknown,
542-
inAllDayRow?: boolean,
543-
): boolean {
544-
if (appointmentGroupValues || inAllDayRow) {
545-
noop();
546-
}
547-
535+
override needUpdateScrollPosition(date: Date): boolean {
548536
const bounds = this.getVisibleBounds();
549537
const hours = date.getHours();
550538
const minutes = date.getMinutes();
@@ -558,7 +546,7 @@ class SchedulerAgenda extends WorkSpace {
558546
isUpdateNeeded = true;
559547
}
560548

561-
if (hours === bounds.bottom.hours && minutes > bounds.top.minutes) {
549+
if (hours === bounds.bottom.hours && minutes > bounds.bottom.minutes) {
562550
isUpdateNeeded = true;
563551
}
564552

packages/devextreme/js/__internal/scheduler/workspaces/m_timeline.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,18 @@ class SchedulerTimeline extends SchedulerWorkSpace {
5757

5858
protected override getTotalRowCount(
5959
groupCount: number,
60+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6061
includeAllDayPanelRows?: unknown,
6162
): number {
62-
if (includeAllDayPanelRows !== undefined) {
63-
noop();
64-
}
65-
6663
if (this.isHorizontalGroupedWorkSpace()) {
6764
return this.getRowCount();
6865
}
6966
const totalGroupCount = groupCount || 1;
7067
return this.getRowCount() * totalGroupCount;
7168
}
7269

73-
protected override getFormat(): string {
74-
const format = getGlobalFormatByDataType('time');
75-
return typeof format === 'string' ? format : 'shorttime';
70+
protected override getFormat(): string | ((date: Date) => string) {
71+
return getGlobalFormatByDataType('time') as string | ((date: Date) => string) || 'shorttime';
7672
}
7773

7874
private getWorkSpaceHeight(): number {
@@ -413,9 +409,6 @@ class SchedulerTimeline extends SchedulerWorkSpace {
413409
$container: dxElementWrapper,
414410
groupCount: number,
415411
): void {
416-
if (height !== undefined) {
417-
noop();
418-
}
419412
// eslint-disable-next-line @typescript-eslint/init-declarations
420413
let $indicator: dxElementWrapper | undefined;
421414
const width = this.getIndicationWidth();

packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_month.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class SchedulerTimelineMonth extends SchedulerTimeline {
3939
return true;
4040
}
4141

42-
// @ts-expect-error
4342
protected override getFormat(): (date: Date) => string {
4443
return formatWeekdayAndDay;
4544
}

packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import pointerEvents from '@js/common/core/events/pointer';
1111
import { addNamespace, isMouseEvent } from '@js/common/core/events/utils/index';
1212
import domAdapter from '@js/core/dom_adapter';
13+
import type { OptionChangedEventInfo } from '@js/core/dom_component';
1314
import { getPublicElement } from '@js/core/element';
1415
import type { dxElementWrapper } from '@js/core/renderer';
1516
import $ from '@js/core/renderer';
@@ -28,6 +29,7 @@ import {
2829
} from '@js/core/utils/size';
2930
import { isDefined } from '@js/core/utils/type';
3031
import { getWindow, hasWindow } from '@js/core/utils/window';
32+
import type { InitializedEventInfo } from '@js/events';
3133
import type { ScrollEvent } from '@js/ui/scroll_view';
3234
import errors from '@js/ui/widget/ui.errors';
3335
import Widget from '@js/ui/widget/ui.widget';
@@ -127,9 +129,9 @@ export interface WorkspaceDateTableScrollableConfig {
127129
bounceEnabled: boolean;
128130
updateManually: boolean;
129131
onScroll: (event: ScrollEvent) => void;
130-
onInitialized: (args: { component: Scrollable }) => void;
131-
onOptionChanged: (args: { fullName: string; value: unknown; component: Scrollable }) => void;
132-
direction?: 'both';
132+
onInitialized: (args: InitializedEventInfo<Scrollable>) => void;
133+
onOptionChanged: (args: OptionChangedEventInfo<Scrollable>) => void;
134+
direction?: 'horizontal' | 'vertical' | 'both';
133135
onEnd?: () => void;
134136
}
135137

@@ -140,6 +142,7 @@ export interface WorkspaceHeaderScrollableConfig {
140142
useNative: false;
141143
updateManually: true;
142144
bounceEnabled: false;
145+
scrollByContent?: boolean;
143146
onScroll: (event: ScrollEvent) => void;
144147
}
145148

@@ -254,7 +257,7 @@ export type WorkspaceOptionChangedOptions = WorkspaceOptionsInternal & {
254257
scrolling?: unknown;
255258
schedulerHeight?: number;
256259
schedulerWidth?: number;
257-
agendaDuration?: number | 'month';
260+
agendaDuration?: number;
258261
rowHeight?: number;
259262
noDataText?: string;
260263
showCurrentTimeIndicator?: boolean;
@@ -736,14 +739,14 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
736739
// To prevent scroll container focus in native mode we set tabindex -1 to container
737740
// In simulated mode focusable behavior prevented by useKeyboard: false private option
738741
onInitialized: ({ component }) => {
739-
const useKeyboardDisabled = !(component.option('useKeyboard') as unknown as boolean);
740-
const useNativeEnabled = component.option('useNative') as unknown as boolean;
742+
const useKeyboardDisabled = (component?.option('useKeyboard') as unknown as boolean | undefined) === false;
743+
const useNativeEnabled = (component?.option('useNative') as unknown as boolean | undefined) === true;
741744
if (useKeyboardDisabled && useNativeEnabled) {
742-
$(component.container()).attr('tabindex', -1);
745+
$(component?.container()).attr('tabindex', -1);
743746
}
744747
},
745748
onOptionChanged: ({ fullName, value, component }) => {
746-
const useKeyboardDisabled = !(component.option('useKeyboard') as unknown as boolean);
749+
const useKeyboardDisabled = (component.option('useKeyboard') as unknown as boolean | undefined) === false;
747750
if (useKeyboardDisabled && fullName === 'useNative' && value === true) {
748751
$(component.container()).attr('tabindex', -1);
749752
}
@@ -1320,7 +1323,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
13201323
});
13211324
}
13221325

1323-
protected getFormat() { return abstract(); }
1326+
protected getFormat(): string | ((date: Date) => string) { return abstract(); }
13241327

13251328
getWorkArea() {
13261329
return this.$dateTableContainer;

packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace {
7676
): void {
7777
const groupedByDate = this.isGroupedByDate();
7878
const repeatCount = groupedByDate ? 1 : groupCount;
79-
Array.from({ length: repeatCount }).forEach((_, i) => {
79+
for (let i = 0; i < repeatCount; i += 1) {
8080
const $indicator = this.createIndicator($container);
8181

8282
setWidth(
8383
$indicator,
8484
groupedByDate ? this.getCellWidth() * groupCount : this.getCellWidth(),
8585
);
8686
this.groupedStrategy.shiftIndicator($indicator, height, rtlOffset, i);
87-
});
87+
}
8888
}
8989

9090
protected createIndicator($container: dxElementWrapper): dxElementWrapper {

0 commit comments

Comments
 (0)