Skip to content

Commit ceb415b

Browse files
sjburweb-flow
andauthored
Scheduler: refactor workspaces module (TS): part 3 (#33926)
Co-authored-by: Sergei Burkatskii <noreply@github.com>
1 parent 4862374 commit ceb415b

10 files changed

Lines changed: 543 additions & 450 deletions

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,10 @@ export type ScrollToGroupValuesOrOptions = RawGroupValues
305305
| GroupValues
306306
| ScrollToOptions
307307
| undefined;
308+
309+
export interface GroupBoundsOffset {
310+
left: number;
311+
right: number;
312+
top: number;
313+
bottom: number;
314+
}

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { isDateAndTimeView } from '@ts/scheduler/r1/utils/index';
2-
import type { ViewCellData, ViewType } from '@ts/scheduler/types';
3-
4-
interface GridPosition {
5-
rowIndex: number;
6-
columnIndex: number;
7-
}
2+
import type { CellPositionData, ViewCellData, ViewType } from '@ts/scheduler/types';
83

94
interface EdgeIndices {
105
firstColumnIndex: number;
@@ -15,7 +10,7 @@ interface EdgeIndices {
1510

1611
interface ArrowClickOptions {
1712
key: 'up' | 'down' | 'left' | 'right';
18-
focusedCellPosition?: GridPosition;
13+
focusedCellPosition?: CellPositionData;
1914
focusedCellData: ViewCellData;
2015
edgeIndices: EdgeIndices;
2116
getCellDataByPosition: (rowIndex: number, columnIndex: number, isAllDay: boolean) => ViewCellData;
@@ -30,7 +25,7 @@ interface ArrowClickOptions {
3025

3126
interface NextColumnPositionOptions extends ArrowClickOptions {
3227
direction: 'next' | 'prev';
33-
focusedCellPosition: GridPosition;
28+
focusedCellPosition: CellPositionData;
3429
}
3530

3631
interface ProcessEdgeCellOptions {
@@ -67,7 +62,7 @@ export class CellsSelectionController {
6762
return focusedCellData;
6863
}
6964

70-
let nextCellIndices: GridPosition = focusedCellPosition;
65+
let nextCellIndices: CellPositionData = focusedCellPosition;
7166

7267
switch (key) {
7368
case 'down':
@@ -107,10 +102,10 @@ export class CellsSelectionController {
107102
}
108103

109104
getCellFromNextRowPosition(
110-
focusedCellPosition: GridPosition,
105+
focusedCellPosition: CellPositionData,
111106
direction: 'next' | 'prev',
112107
edgeIndices: EdgeIndices,
113-
): GridPosition {
108+
): CellPositionData {
114109
const {
115110
columnIndex,
116111
rowIndex,
@@ -129,7 +124,7 @@ export class CellsSelectionController {
129124
};
130125
}
131126

132-
getCellFromNextColumnPosition(options: NextColumnPositionOptions): GridPosition {
127+
getCellFromNextColumnPosition(options: NextColumnPositionOptions): CellPositionData {
133128
const {
134129
focusedCellPosition,
135130
direction,
@@ -178,7 +173,7 @@ export class CellsSelectionController {
178173
});
179174
}
180175

181-
private processEdgeCell(options: ProcessEdgeCellOptions): GridPosition {
176+
private processEdgeCell(options: ProcessEdgeCellOptions): CellPositionData {
182177
const {
183178
nextColumnIndex,
184179
rowIndex,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ import {
9595
PositionHelper,
9696
} from './helpers/position_helper';
9797
import { VirtualScrollingDispatcher, VirtualScrollingRenderer } from './m_virtual_scrolling';
98-
import HorizontalGroupedStrategy from './m_work_space_grouped_strategy_horizontal';
99-
import VerticalGroupedStrategy from './m_work_space_grouped_strategy_vertical';
10098
import type { ViewDataProviderOptions } from './view_model/m_types';
10199
import ViewDataProvider from './view_model/m_view_data_provider';
100+
import HorizontalGroupedStrategy from './work_space_grouped_strategy_horizontal';
101+
import VerticalGroupedStrategy from './work_space_grouped_strategy_vertical';
102102

103103
interface RenderComponentOptions {
104104
header?: boolean;
@@ -1338,11 +1338,11 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
13381338
return this.$headerPanel && getOuterHeight(this.$headerPanel, true);
13391339
}
13401340

1341-
getTimePanelWidth() {
1341+
getTimePanelWidth(): number {
13421342
return this.$timePanel && getBoundingRect(this.$timePanel.get(0)).width;
13431343
}
13441344

1345-
getGroupTableWidth() {
1345+
getGroupTableWidth(): number {
13461346
return this.$groupTable ? getOuterWidth(this.$groupTable) : 0;
13471347
}
13481348

@@ -1412,7 +1412,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
14121412
return this.getDateTables().find(`.${DATE_TABLE_DROPPABLE_CELL_CLASS}`);
14131413
}
14141414

1415-
protected getWorkSpaceWidth() {
1415+
protected getWorkSpaceWidth(): number {
14161416
return this.cache.memo('workspaceWidth', () => {
14171417
if (this.needCreateCrossScrolling()) {
14181418
return getBoundingRect(this.$dateTable.get(0)).width;
@@ -1669,7 +1669,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
16691669
}
16701670

16711671
// NOTE: refactor leftIndex calculation
1672-
getCellIndexByCoordinates(coordinates, allDay) {
1672+
getCellIndexByCoordinates(coordinates, allDay?) {
16731673
const { horizontalScrollingState, verticalScrollingState } = this.virtualScrollingDispatcher;
16741674

16751675
const cellCount = horizontalScrollingState?.itemCount ?? this.getTotalCellCount(this.getGroupCount());

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

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

0 commit comments

Comments
 (0)