Skip to content

Commit 33bbda9

Browse files
Fix after review: remove comments, add access modifiers, delete dead code, rename underscore-prefixed members
1 parent 0f92e68 commit 33bbda9

9 files changed

Lines changed: 43 additions & 62 deletions

packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_horizontal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader {
3434

3535
if (groupIndex >= 1) {
3636
const workSpace = this._workSpace;
37-
const indicationWidth = workSpace._getCellCount() * workSpace.getCellWidth();
37+
const indicationWidth = workSpace.getCellCount() * workSpace.getCellWidth();
3838
$shader.css('left', indicationWidth);
3939
} else {
4040
$shader.css('left', 0);
@@ -64,7 +64,7 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader {
6464
this.applyShaderWidth($shader, shaderWidth);
6565

6666
if (isFirstShaderPart) {
67-
shaderLeft = workSpace._getCellCount() * workSpace.getCellWidth() * groupIndex;
67+
shaderLeft = workSpace.getCellCount() * workSpace.getCellWidth() * groupIndex;
6868
} else {
6969
shaderLeft = workSpace.getCellWidth() * integerPart * workSpace._getGroupCount()
7070
+ groupIndex * workSpace.getCellWidth();

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class SchedulerAgenda extends WorkSpace {
124124
return this.option('agendaDuration') as number;
125125
}
126126

127-
_getCellCount() {
127+
override getCellCount() {
128128
return 1;
129129
}
130130

@@ -348,8 +348,6 @@ class SchedulerAgenda extends WorkSpace {
348348

349349
protected override attachEvents() { return noop(); }
350350

351-
private cleanCellDataCache() { return noop(); }
352-
353351
isIndicationAvailable() {
354352
return false;
355353
}
@@ -536,8 +534,6 @@ class SchedulerAgenda extends WorkSpace {
536534

537535
renovatedRenderSupported() { return false; }
538536

539-
private setSelectedCellsByCellData() {}
540-
541537
protected override getTotalViewDuration() {
542538
return dateUtils.dateToMilliseconds('day') * (this.option('intervalCount') as any);
543539
}

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

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const HORIZONTAL = 'horizontal';
3535
const toMs = dateUtils.dateToMilliseconds;
3636

3737
class SchedulerTimeline extends SchedulerWorkSpace {
38-
_$sidebarTable: any;
38+
protected override $sidebarTable: any;
3939

4040
get verticalGroupTableClass() { return GROUP_TABLE_CLASS; }
4141

@@ -44,7 +44,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
4444
get renovatedHeaderPanelComponent() { return HeaderPanelTimelineComponent; }
4545

4646
getGroupTableWidth() {
47-
return this._$sidebarTable ? getOuterWidth(this._$sidebarTable) : 0;
47+
return this.$sidebarTable ? getOuterWidth(this.$sidebarTable) : 0;
4848
}
4949

5050
protected override getTotalRowCount(groupCount) {
@@ -96,19 +96,17 @@ class SchedulerTimeline extends SchedulerWorkSpace {
9696
if (this._isHorizontalGroupedWorkSpace()) {
9797
return this._$thead;
9898
}
99-
return this._$sidebarTable;
99+
return this.$sidebarTable;
100100
}
101101

102102
protected override insertAllDayRowsIntoDateTable() {
103103
return false;
104104
}
105105

106-
// Overridden in SchedulerTimelineDay, SchedulerTimelineWeek
107106
protected needRenderWeekHeader() {
108107
return false;
109108
}
110109

111-
// Overridden in SchedulerTimelineWeek, SchedulerTimelineWorkWeek
112110
protected incrementDate(date) {
113111
date.setDate(date.getDate() + 1);
114112
}
@@ -132,7 +130,6 @@ class SchedulerTimeline extends SchedulerWorkSpace {
132130
return today.getTime() - date.getTime();
133131
}
134132

135-
// Overridden in SchedulerTimelineMonth
136133
protected calculateDurationInCells(timeDiff) {
137134
const today = this.getToday();
138135
const differenceInDays = Math.floor(timeDiff / toMs('day'));
@@ -159,19 +156,19 @@ class SchedulerTimeline extends SchedulerWorkSpace {
159156
return this.getIndicationCellCount() * this.getCellWidth();
160157
}
161158

162-
isVerticalShader() {
159+
protected override isVerticalShader() {
163160
return false;
164161
}
165162

166-
isCurrentTimeHeaderCell() {
163+
protected override isCurrentTimeHeaderCell() {
167164
return false;
168165
}
169166

170167
protected override setTableSizes() {
171168
super.setTableSizes();
172169

173170
const minHeight = this.getWorkSpaceMinHeight();
174-
setHeight(this._$sidebarTable, minHeight);
171+
setHeight(this.$sidebarTable, minHeight);
175172
setHeight(this._$dateTable, minHeight);
176173

177174
this.virtualScrollingDispatcher.updateDimensions();
@@ -191,7 +188,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
191188

192189
protected override getCellCoordinatesByIndex(index) {
193190
return {
194-
columnIndex: index % this._getCellCount(),
191+
columnIndex: index % this.getCellCount(),
195192
rowIndex: 0,
196193
};
197194
}
@@ -307,7 +304,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
307304
super._init();
308305

309306
(this.$element() as any).addClass(TIMELINE_CLASS);
310-
this._$sidebarTable = $('<div>')
307+
this.$sidebarTable = $('<div>')
311308
.addClass(GROUP_TABLE_CLASS);
312309
}
313310

@@ -349,7 +346,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
349346

350347
this._shader = new HorizontalShader(this);
351348

352-
this._$sidebarTable.appendTo(this._sidebarScrollable.$content());
349+
this.$sidebarTable.appendTo(this._sidebarScrollable.$content());
353350

354351
if (this.isRenovatedRender() && this.isVerticalGroupedWorkSpace()) {
355352
this.renderRGroupPanel();
@@ -368,7 +365,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
368365
}
369366

370367
getCurrentTimePanelCellIndices() {
371-
const columnCountPerGroup = this._getCellCount();
368+
const columnCountPerGroup = this.getCellCount();
372369
const today = this.getToday();
373370
const index = this.getCellIndexByDate(today);
374371
const { columnIndex: currentTimeColumnIndex } = this.getCellCoordinatesByIndex(index);
@@ -455,7 +452,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
455452
}
456453
}
457454

458-
renderIndicator(height, rtlOffset, $container, groupCount) {
455+
protected override renderIndicator(height, rtlOffset, $container, groupCount) {
459456
let $indicator;
460457
const width = this.getIndicationWidth();
461458

@@ -465,7 +462,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
465462
$indicator.css('left', rtlOffset ? rtlOffset - width : width);
466463
} else {
467464
for (let i = 0; i < groupCount; i++) {
468-
const offset = this.isGroupedByDate() ? i * this.getCellWidth() : this._getCellCount() * this.getCellWidth() * i;
465+
const offset = this.isGroupedByDate() ? i * this.getCellWidth() : this.getCellCount() * this.getCellWidth() * i;
469466
$indicator = this.createIndicator($container);
470467
setHeight($indicator, getBoundingRect($container.get(0)).height);
471468

@@ -486,7 +483,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
486483
groupHeaderClass: this.getGroupHeaderClass.bind(this),
487484
groupHeaderContentClass: GROUP_HEADER_CONTENT_CLASS,
488485
},
489-
this._getCellCount() || 1,
486+
this.getCellCount() || 1,
490487
this.option('resourceCellTemplate'),
491488
this.getTotalRowCount(this._getGroupCount()),
492489
groupByDate,
@@ -496,7 +493,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
496493
// Old render methods.
497494
// TODO Old render: delete these methods with the old render.
498495

499-
setCurrentTimeCells(): void {
496+
protected override setCurrentTimeCells(): void {
500497
const timePanelCells = this.getTimePanelCells();
501498
const currentTimeCellIndices = this.getCurrentTimePanelCellIndices();
502499
currentTimeCellIndices.forEach((timePanelCellIndex) => {

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import registerComponent from '@js/core/component_registrator';
2-
import { getBoundingRect } from '@js/core/utils/position';
32

43
import { VIEWS } from '../utils/options/constants_view';
54
import SchedulerTimeline from './m_timeline';
@@ -13,10 +12,6 @@ export default class SchedulerTimelineWeek extends SchedulerTimeline {
1312
return TIMELINE_CLASS;
1413
}
1514

16-
_getHeaderPanelCellWidth($headerRow) {
17-
return getBoundingRect($headerRow.children().first().get(0)).width;
18-
}
19-
2015
protected override needRenderWeekHeader() {
2116
return true;
2217
}

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
298298

299299
_shader: any;
300300

301-
_$sidebarTable: any;
301+
protected $sidebarTable: any;
302302

303303
_interval: any;
304304

@@ -822,9 +822,8 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
822822
});
823823
}
824824

825-
// TODO: rename to getCellCount — used externally via workSpace reference:
826-
// m_work_space_grouped_strategy_horizontal.ts (7 usages), m_work_space_grouped_strategy_vertical.ts, shaders/current_time_shader_horizontal.ts
827-
_getCellCount() {
825+
// TODO: should be protected, but accessed externally from strategy classes and shaders
826+
getCellCount() {
828827
return this.viewDataProvider.getCellCount({
829828
intervalCount: this.option('intervalCount'),
830829
currentDate: this.option('currentDate'),
@@ -1665,7 +1664,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
16651664
}
16661665

16671666
getGroupBoundsHorizontal(coordinates) {
1668-
const cellCount = this._getCellCount();
1667+
const cellCount = this.getCellCount();
16691668
const $cells = this.getCells();
16701669
const cellWidth = this.getCellWidth();
16711670

@@ -2014,7 +2013,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
20142013
// TODO: remove along with old render
20152014
private oldRender_getAllDayCellData(groupIndex) {
20162015
return (cell, rowIndex, columnIndex) => {
2017-
const validColumnIndex = columnIndex % this._getCellCount();
2016+
const validColumnIndex = columnIndex % this.getCellCount();
20182017
const options = this.getDateGenerationOptions(true);
20192018
let startDate = this.viewDataProvider.viewDataGenerator.getDateByCellIndices(
20202019
options as any,
@@ -2029,7 +2028,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
20292028
if (this.isGroupedByDate()) {
20302029
validGroupIndex = Math.floor(columnIndex % this._getGroupCount());
20312030
} else if (this._isHorizontalGroupedWorkSpace()) {
2032-
validGroupIndex = Math.floor(columnIndex / this._getCellCount());
2031+
validGroupIndex = Math.floor(columnIndex / this.getCellCount());
20332032
}
20342033

20352034
const data: any = {
@@ -2833,7 +2832,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
28332832
this._$groupTable.empty();
28342833

28352834
this._$allDayTable?.empty();
2836-
this._$sidebarTable?.empty();
2835+
this.$sidebarTable?.empty();
28372836
}
28382837

28392838
this._shader?.clean();
@@ -2991,7 +2990,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
29912990
groupHeaderClass: this.getGroupHeaderClass.bind(this),
29922991
groupHeaderContentClass: GROUP_HEADER_CONTENT_CLASS,
29932992
},
2994-
this._getCellCount() || 1,
2993+
this.getCellCount() || 1,
29952994
this.option('resourceCellTemplate'),
29962995
this._getGroupCount(),
29972996
groupByDate,
@@ -3001,7 +3000,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
30013000
protected renderDateHeader(): any {
30023001
const container = this.getDateHeaderContainer();
30033002
const $headerRow = $('<tr>').addClass(HEADER_ROW_CLASS);
3004-
const count = this._getCellCount();
3003+
const count = this.getCellCount();
30053004
const cellTemplate = this.getDateHeaderTemplate();
30063005
const repeatCount = this.getCalculateHeaderCellRepeatCount();
30073006
const templateCallbacks = [];
@@ -3085,7 +3084,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
30853084
}
30863085

30873086
protected renderAllDayPanel(index?: any) {
3088-
let cellCount = this._getCellCount();
3087+
let cellCount = this.getCellCount();
30893088

30903089
if (!this.isVerticalGroupedWorkSpace()) {
30913090
cellCount *= this._getGroupCount() || 1;
@@ -3161,7 +3160,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
31613160
cellTemplate: this.option('timeCellTemplate'),
31623161
getCellText: (rowIndex) => getData(rowIndex, 'text'),
31633162
getCellDate: (rowIndex) => getData(rowIndex, 'startDate'),
3164-
groupCount: this._getCellCount(),
3163+
groupCount: this.getCellCount(),
31653164
allDayElements: this.insertAllDayRowsIntoDateTable() ? this._allDayTitles : undefined,
31663165
getTemplateData: getTimeCellGroups.bind(this),
31673166
});

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class HorizontalGroupedStrategy {
1414
if (!groupByDay) {
1515
return {
1616
rowIndex: cellCoordinates.rowIndex,
17-
columnIndex: cellCoordinates.columnIndex + groupIndex * this._workSpace._getCellCount(),
17+
columnIndex: cellCoordinates.columnIndex + groupIndex * this._workSpace.getCellCount(),
1818
};
1919
}
2020
return {
@@ -30,7 +30,7 @@ class HorizontalGroupedStrategy {
3030
if (groupByDay) {
3131
return columnIndex % groupCount;
3232
}
33-
return Math.floor(columnIndex / this._workSpace._getCellCount());
33+
return Math.floor(columnIndex / this._workSpace.getCellCount());
3434
}
3535

3636
calculateHeaderCellRepeatCount() {
@@ -44,7 +44,7 @@ class HorizontalGroupedStrategy {
4444
getTotalCellCount(groupCount) {
4545
groupCount = groupCount || 1;
4646

47-
return this._workSpace._getCellCount() * groupCount;
47+
return this._workSpace.getCellCount() * groupCount;
4848
}
4949

5050
getTotalRowCount() {
@@ -142,7 +142,7 @@ class HorizontalGroupedStrategy {
142142

143143
_calculateOffset(groupIndex) {
144144
const indicatorStartPosition = this._workSpace.getIndicatorOffset(groupIndex);
145-
const offset = this._workSpace._getCellCount() * this._workSpace.getCellWidth() * groupIndex;
145+
const offset = this._workSpace.getCellCount() * this._workSpace.getCellWidth() * groupIndex;
146146

147147
return indicatorStartPosition + offset;
148148
}
@@ -152,7 +152,7 @@ class HorizontalGroupedStrategy {
152152
}
153153

154154
getShaderOffset(i, width) {
155-
const offset = this._workSpace._getCellCount() * this._workSpace.getCellWidth() * i;
155+
const offset = this._workSpace.getCellCount() * this._workSpace.getCellWidth() * i;
156156
return this._workSpace.option('rtlEnabled') ? getBoundingRect(this._workSpace._dateTableScrollable.$content().get(0)).width - offset - this._workSpace.getTimePanelWidth() - width : offset;
157157
}
158158

@@ -199,7 +199,7 @@ class HorizontalGroupedStrategy {
199199
if (index % this._workSpace._getGroupCount() === 0) {
200200
return `${cellClass} ${LAST_GROUP_CELL_CLASS}`;
201201
}
202-
} else if (index % this._workSpace._getCellCount() === 0) {
202+
} else if (index % this._workSpace.getCellCount() === 0) {
203203
return `${cellClass} ${LAST_GROUP_CELL_CLASS}`;
204204
}
205205

@@ -217,7 +217,7 @@ class HorizontalGroupedStrategy {
217217
if ((index - 1) % this._workSpace._getGroupCount() === 0) {
218218
return `${cellClass} ${FIRST_GROUP_CELL_CLASS}`;
219219
}
220-
} else if ((index - 1) % this._workSpace._getCellCount() === 0) {
220+
} else if ((index - 1) % this._workSpace.getCellCount() === 0) {
221221
return `${cellClass} ${FIRST_GROUP_CELL_CLASS}`;
222222
}
223223

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class VerticalGroupedStrategy {
4545
}
4646

4747
getTotalCellCount() {
48-
return this._workSpace._getCellCount();
48+
return this._workSpace.getCellCount();
4949
}
5050

5151
getTotalRowCount() {

0 commit comments

Comments
 (0)