Skip to content

Commit e2eb072

Browse files
Scheduler — Replace underscore-prefixed: Workspace group (agenda, timeline, month, indicator)
1 parent 9152bf1 commit e2eb072

8 files changed

Lines changed: 121 additions & 111 deletions

File tree

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

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ const INNER_CELL_MARGIN = 5;
4141
const OUTER_CELL_MARGIN = 20;
4242

4343
class SchedulerAgenda extends WorkSpace {
44-
_startViewDate: any;
44+
private startViewDate: any;
4545

46-
_rows: number[][] = [];
46+
private rows: number[][] = [];
4747

48-
_$rows: any;
48+
private $rows: any;
4949

50-
_$noDataContainer: any;
50+
private $noDataContainer: any;
5151

5252
// eslint-disable-next-line class-methods-use-this
5353
protected _activeStateUnit(): string {
@@ -57,7 +57,7 @@ class SchedulerAgenda extends WorkSpace {
5757
get type() { return VIEWS.AGENDA; }
5858

5959
getStartViewDate() {
60-
return this._startViewDate;
60+
return this.startViewDate;
6161
}
6262

6363
_init() {
@@ -82,7 +82,7 @@ class SchedulerAgenda extends WorkSpace {
8282
break;
8383
case 'noDataText':
8484
case 'rowHeight':
85-
this._recalculateAgenda(this._rows);
85+
this.recalculateAgenda(this.rows);
8686
break;
8787
case 'groups':
8888
if (!value?.length) {
@@ -92,7 +92,7 @@ class SchedulerAgenda extends WorkSpace {
9292
this._detachGroupCountClass();
9393
}
9494
} else if (!this._$groupTable) {
95-
this._initGroupTable();
95+
this.initGroupTable();
9696
this._dateTableScrollable.$content().prepend(this._$groupTable);
9797
}
9898
super._optionChanged(args);
@@ -136,41 +136,41 @@ class SchedulerAgenda extends WorkSpace {
136136

137137
_updateAllDayVisibility() { return noop(); }
138138

139-
_updateAllDayHeight() { return noop(); }
139+
private updateAllDayHeight() { return noop(); }
140140

141141
_initWorkSpaceUnits() {
142-
this._initGroupTable();
142+
this.initGroupTable();
143143
this._$timePanel = $('<table>').attr('aria-hidden', true).addClass(TIME_PANEL_CLASS);
144144
this._$dateTable = $('<table>').attr('aria-hidden', true).addClass(DATE_TABLE_CLASS);
145145
this._$dateTableScrollableContent = $('<div>').addClass('dx-scheduler-date-table-scrollable-content');
146146
this._$dateTableContainer = $('<div>').addClass('dx-scheduler-date-table-container');
147147
}
148148

149-
_initGroupTable() {
149+
private initGroupTable() {
150150
const groups = this.option('groups');
151151
if (groups?.length) {
152152
this._$groupTable = $('<table>').attr('aria-hidden', true).addClass(GROUP_TABLE_CLASS);
153153
}
154154
}
155155

156156
_renderView() {
157-
this._startViewDate = agendaUtils.calculateStartViewDate(this.option('currentDate') as any, this.option('startDayHour') as any);
158-
this._rows = [];
157+
this.startViewDate = agendaUtils.calculateStartViewDate(this.option('currentDate') as any, this.option('startDayHour') as any);
158+
this.rows = [];
159159
}
160160

161-
_recalculateAgenda(rows) {
161+
private recalculateAgenda(rows) {
162162
let cellTemplates = [];
163163
this._cleanView();
164164

165-
if (this._rowsIsEmpty(rows)) {
166-
this._renderNoData();
165+
if (this.rowsIsEmpty(rows)) {
166+
this.renderNoData();
167167
return;
168168
}
169-
this._rows = rows;
169+
this.rows = rows;
170170

171171
if (this._$groupTable) {
172172
cellTemplates = this._renderGroupHeader();
173-
this._setGroupHeaderCellsHeight();
173+
this.setGroupHeaderCellsHeight();
174174
}
175175

176176
this._renderTimePanel();
@@ -179,11 +179,11 @@ class SchedulerAgenda extends WorkSpace {
179179
this._dateTableScrollable.update();
180180
}
181181

182-
_renderNoData() {
183-
this._$noDataContainer = $('<div>').addClass(NODATA_CONTAINER_CLASS)
182+
private renderNoData() {
183+
this.$noDataContainer = $('<div>').addClass(NODATA_CONTAINER_CLASS)
184184
.html(this.option('noDataText') as any);
185185

186-
this._dateTableScrollable.$content().append(this._$noDataContainer);
186+
this._dateTableScrollable.$content().append(this.$noDataContainer);
187187
}
188188

189189
_setTableSizes() { return noop(); }
@@ -193,21 +193,21 @@ class SchedulerAgenda extends WorkSpace {
193193
// eslint-disable-next-line @typescript-eslint/no-unused-vars
194194
_createCrossScrollingConfig(argument?: any) { return noop(); }
195195

196-
_setGroupHeaderCellsHeight() {
196+
private setGroupHeaderCellsHeight() {
197197
const $cells = this._getGroupHeaderCells().filter((_, element) => !element.getAttribute('rowSpan'));
198-
const rows = this._removeEmptyRows(this._rows);
198+
const rows = this.removeEmptyRows(this.rows);
199199

200200
if (!rows.length) {
201201
return;
202202
}
203203

204204
for (let i = 0; i < $cells.length; i++) {
205205
const $cellContent = $cells.eq(i).find('.dx-scheduler-group-header-content');
206-
setOuterHeight($cellContent, this._getGroupRowHeight(rows[i]));
206+
setOuterHeight($cellContent, this.getGroupRowHeight(rows[i]));
207207
}
208208
}
209209

210-
_rowsIsEmpty(rows) {
210+
private rowsIsEmpty(rows) {
211211
let result = true;
212212

213213
for (let i = 0; i < rows.length; i++) {
@@ -229,7 +229,7 @@ class SchedulerAgenda extends WorkSpace {
229229
(this.$element() as any).addClass(className);
230230
}
231231

232-
_removeEmptyRows(rows) {
232+
private removeEmptyRows(rows) {
233233
const result: any[] = [];
234234
const isEmpty = function (data) {
235235
return !data.some((value) => value > 0);
@@ -312,11 +312,11 @@ class SchedulerAgenda extends WorkSpace {
312312
this._$groupTable.empty();
313313
}
314314

315-
if (this._$noDataContainer) {
316-
this._$noDataContainer.empty();
317-
this._$noDataContainer.remove();
315+
if (this.$noDataContainer) {
316+
this.$noDataContainer.empty();
317+
this.$noDataContainer.remove();
318318

319-
delete this._$noDataContainer;
319+
delete this.$noDataContainer;
320320
}
321321
}
322322

@@ -348,13 +348,13 @@ class SchedulerAgenda extends WorkSpace {
348348

349349
_attachEvents() { return noop(); }
350350

351-
_cleanCellDataCache() { return noop(); }
351+
private cleanCellDataCache() { return noop(); }
352352

353353
isIndicationAvailable() {
354354
return false;
355355
}
356356

357-
_prepareCellTemplateOptions(text, date, rowIndex, $cell) {
357+
private prepareCellTemplateOptions(text, date, rowIndex, $cell) {
358358
const leaf = this.resourceManager.groupsLeafs[rowIndex];
359359
const groups = leaf?.grouped ?? {};
360360
const groupIndex = leaf?.groupIndex;
@@ -376,7 +376,7 @@ class SchedulerAgenda extends WorkSpace {
376376
const cellTemplates: any[] = [];
377377
const cellTemplateOpt = options.cellTemplate;
378378

379-
this._$rows = [];
379+
this.$rows = [];
380380
let i;
381381

382382
const fillTableBody = function (rowIndex, rowSize) {
@@ -386,7 +386,7 @@ class SchedulerAgenda extends WorkSpace {
386386
let cellDayName;
387387
const $row = $('<tr>');
388388
const $td = $('<td>');
389-
setHeight($td, this._getRowHeight(rowSize));
389+
setHeight($td, this.getRowHeight(rowSize));
390390

391391
if (options.getStartDate) {
392392
date = options.getStartDate?.(rowIndex);
@@ -395,7 +395,7 @@ class SchedulerAgenda extends WorkSpace {
395395
}
396396

397397
if (cellTemplateOpt?.render) {
398-
const templateOptions = this._prepareCellTemplateOptions(`${cellDateNumber} ${cellDayName}`, date, i, $td);
398+
const templateOptions = this.prepareCellTemplateOptions(`${cellDateNumber} ${cellDayName}`, date, i, $td);
399399

400400
cellTemplates.push(cellTemplateOpt.render.bind(cellTemplateOpt, templateOptions));
401401
} else if (cellDateNumber && cellDayName) {
@@ -411,22 +411,22 @@ class SchedulerAgenda extends WorkSpace {
411411
}
412412

413413
$row.append($td);
414-
this._$rows.push($row);
414+
this.$rows.push($row);
415415
}
416416
}.bind(this);
417417

418-
for (i = 0; i < this._rows.length; i++) {
419-
each(this._rows[i], fillTableBody);
420-
this._setLastRowClass();
418+
for (i = 0; i < this.rows.length; i++) {
419+
each(this.rows[i], fillTableBody);
420+
this.setLastRowClass();
421421
}
422422

423-
$(options.container).append($('<tbody>').append(this._$rows));
423+
$(options.container).append($('<tbody>').append(this.$rows));
424424
this._applyCellTemplates(cellTemplates);
425425
}
426426

427-
_setLastRowClass() {
428-
if (this._rows.length > 1 && this._$rows.length) {
429-
const $lastRow = this._$rows[this._$rows.length - 1];
427+
private setLastRowClass() {
428+
if (this.rows.length > 1 && this.$rows.length) {
429+
const $lastRow = this.$rows[this.$rows.length - 1];
430430

431431
$lastRow.addClass(LAST_ROW_CLASS);
432432
}
@@ -440,33 +440,33 @@ class SchedulerAgenda extends WorkSpace {
440440
rowClass: TIME_PANEL_ROW_CLASS,
441441
cellClass: TIME_PANEL_CELL_CLASS,
442442
cellTemplate: this.option('dateCellTemplate'),
443-
getStartDate: this._getTimePanelStartDate.bind(this),
443+
getStartDate: this.getTimePanelStartDate.bind(this),
444444
});
445445
}
446446

447-
_getTimePanelStartDate(rowIndex) {
447+
private getTimePanelStartDate(rowIndex) {
448448
const current = new Date(this.option('currentDate') as any);
449449
const cellDate = new Date(current.setDate(current.getDate() + rowIndex));
450450

451451
return cellDate;
452452
}
453453

454-
_getRowHeight(rowSize) {
454+
private getRowHeight(rowSize) {
455455
const baseHeight = this.option('rowHeight') as any;
456456
const innerOffset = (rowSize - 1) * INNER_CELL_MARGIN;
457457

458458
return rowSize ? (baseHeight * rowSize) + innerOffset + OUTER_CELL_MARGIN : 0;
459459
}
460460

461-
_getGroupRowHeight(groupRows) {
461+
private getGroupRowHeight(groupRows) {
462462
if (!groupRows) {
463463
return;
464464
}
465465

466466
let result = 0;
467467

468468
for (let i = 0; i < groupRows.length; i++) {
469-
result += this._getRowHeight(groupRows[i]);
469+
result += this.getRowHeight(groupRows[i]);
470470
}
471471

472472
return result;
@@ -481,7 +481,7 @@ class SchedulerAgenda extends WorkSpace {
481481
this.getStartViewDate(),
482482
this.resourceManager.groupCount(),
483483
);
484-
this._recalculateAgenda(rows);
484+
this.recalculateAgenda(rows);
485485
}
486486

487487
getAgendaVerticalStepHeight() {
@@ -536,7 +536,7 @@ class SchedulerAgenda extends WorkSpace {
536536

537537
renovatedRenderSupported() { return false; }
538538

539-
_setSelectedCellsByCellData() {}
539+
private setSelectedCellsByCellData() {}
540540

541541
_getIntervalDuration() {
542542
return dateUtils.dateToMilliseconds('day') * (this.option('intervalCount') as any);

0 commit comments

Comments
 (0)