Skip to content

Commit 35f9a1e

Browse files
Scheduler - Replace underscore-prefixed members in shaders with modifiers
1 parent 0e98856 commit 35f9a1e

4 files changed

Lines changed: 58 additions & 64 deletions

File tree

packages/devextreme/eslint-scheduler-allowlist.mjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ const schedulerWorkspaceOverrides = [
6666
];
6767

6868
const schedulerLegacyMembers = [
69-
'_$allDayIndicator',
7069
'_$allDayPanel',
71-
'_$bottomShader',
72-
'_$container',
7370
'_$dateTable',
7471
'_$dateTableScrollableContent',
7572
'_$flexContainer',
@@ -78,9 +75,7 @@ const schedulerLegacyMembers = [
7875
'_$headerPanelContainer',
7976
'_$mainGroup',
8077
'_$recurrenceGroup',
81-
'_$shader',
8278
'_$thead',
83-
'_$topShader',
8479
'_addEvent',
8580
'_appointmentTooltipOffset',
8681
'_appointments',
@@ -124,7 +119,6 @@ const schedulerLegacyMembers = [
124119
'_renderGrid',
125120
'_renderOverlay',
126121
'_renderToolbar',
127-
'_shader',
128122
'_showCalendar',
129123
'_sidebarScrollable',
130124
'_textCache',

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ import type SchedulerWorkSpace from '../workspaces/m_work_space';
66
const DATE_TIME_SHADER_CLASS = 'dx-scheduler-date-time-shader';
77

88
class CurrentTimeShader {
9-
_$container = this._workSpace._dateTableScrollable.$content();
9+
protected $container = this.workSpace._dateTableScrollable.$content();
1010

11-
_shader!: dxElementWrapper[];
11+
protected shader!: dxElementWrapper[];
1212

13-
_$shader!: dxElementWrapper;
13+
protected $shader!: dxElementWrapper;
1414

15-
constructor(public _workSpace: SchedulerWorkSpace) {
15+
constructor(protected workSpace: SchedulerWorkSpace) {
1616
}
1717

1818
render(): void {
1919
this.initShaderElements();
2020

2121
this.renderShader();
2222

23-
this._shader.forEach((shader) => {
24-
this._$container.append(shader);
23+
this.shader.forEach((shader) => {
24+
this.$container.append(shader);
2525
});
2626
}
2727

2828
initShaderElements(): void {
29-
this._$shader = this.createShader();
30-
this._shader = [];
31-
this._shader.push(this._$shader);
29+
this.$shader = this.createShader();
30+
this.shader = [];
31+
this.shader.push(this.$shader);
3232
}
3333

3434
renderShader(): void {}
@@ -38,8 +38,8 @@ class CurrentTimeShader {
3838
}
3939

4040
clean(): void {
41-
if (this._$container) {
42-
this._$container.find(`.${DATE_TIME_SHADER_CLASS}`).remove();
41+
if (this.$container) {
42+
this.$container.find(`.${DATE_TIME_SHADER_CLASS}`).remove();
4343
}
4444
}
4545
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@ import CurrentTimeShader from './current_time_shader';
66

77
class HorizontalCurrentTimeShader extends CurrentTimeShader {
88
renderShader(): void {
9-
const groupCount = this._workSpace._isHorizontalGroupedWorkSpace()
10-
? this._workSpace._getGroupCount()
9+
const groupCount = this.workSpace._isHorizontalGroupedWorkSpace()
10+
? this.workSpace._getGroupCount()
1111
: 1;
1212

1313
for (let i = 0; i < groupCount; i += 1) {
1414
const isFirstShader = i === 0;
15-
const $shader = isFirstShader ? this._$shader : this.createShader();
15+
const $shader = isFirstShader ? this.$shader : this.createShader();
1616

17-
if (this._workSpace.isGroupedByDate()) {
17+
if (this.workSpace.isGroupedByDate()) {
1818
this.customizeGroupedByDateShader($shader, i);
1919
} else {
2020
this.customizeShader($shader, i);
2121
}
2222

2323
if (!isFirstShader) {
24-
this._shader.push($shader);
24+
this.shader.push($shader);
2525
}
2626
}
2727
}
2828

2929
private customizeShader($shader: dxElementWrapper, groupIndex: number): void {
3030
// @ts-expect-error
31-
const shaderWidth = this._workSpace.getIndicationWidth() as number;
31+
const shaderWidth = this.workSpace.getIndicationWidth() as number;
3232

3333
this.applyShaderWidth($shader, shaderWidth);
3434

3535
if (groupIndex >= 1) {
36-
const workSpace = this._workSpace;
36+
const { workSpace } = this;
3737
const indicationWidth = workSpace._getCellCount() * workSpace.getCellWidth();
3838
$shader.css('left', indicationWidth);
3939
} else {
@@ -42,19 +42,19 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader {
4242
}
4343

4444
private applyShaderWidth($shader: dxElementWrapper, width: number): void {
45-
const maxWidth = getBoundingRect(this._$container.get(0)).width;
45+
const maxWidth = getBoundingRect(this.$container.get(0)).width;
4646
if (width > 0) {
4747
setWidth($shader, Math.min(width, maxWidth));
4848
}
4949
}
5050

5151
private customizeGroupedByDateShader($shader: dxElementWrapper, groupIndex: number): void {
5252
// @ts-expect-error
53-
const cellCount = this._workSpace.getIndicationCellCount() as number;
53+
const cellCount = this.workSpace.getIndicationCellCount() as number;
5454
const integerPart = Math.floor(cellCount);
5555
const fractionPart = cellCount - integerPart;
5656
const isFirstShaderPart = groupIndex === 0;
57-
const workSpace = this._workSpace;
57+
const { workSpace } = this;
5858
const shaderWidth = isFirstShaderPart
5959
// @ts-expect-error
6060
? workSpace.getIndicationWidth() as number

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

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const DATE_TIME_SHADER_TOP_CLASS = 'dx-scheduler-date-time-shader-top';
88
const DATE_TIME_SHADER_BOTTOM_CLASS = 'dx-scheduler-date-time-shader-bottom';
99

1010
class VerticalCurrentTimeShader extends CurrentTimeShader {
11-
_$topShader!: dxElementWrapper;
11+
private $topShader!: dxElementWrapper;
1212

13-
_$bottomShader!: dxElementWrapper;
13+
private $bottomShader!: dxElementWrapper;
1414

15-
_$allDayIndicator!: dxElementWrapper;
15+
private $allDayIndicator!: dxElementWrapper;
1616

1717
renderShader(): void {
1818
let shaderHeight = this.getShaderHeight();
@@ -23,10 +23,10 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
2323
shaderHeight = maxHeight;
2424
}
2525

26-
setHeight(this._$shader, shaderHeight);
27-
const groupCount = this._workSpace._getGroupCount() || 1;
26+
setHeight(this.$shader, shaderHeight);
27+
const groupCount = this.workSpace._getGroupCount() || 1;
2828

29-
if (this._workSpace.isGroupedByDate()) {
29+
if (this.workSpace.isGroupedByDate()) {
3030
this.renderGroupedByDateShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader);
3131
} else {
3232
this.renderShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader);
@@ -41,10 +41,10 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
4141
): void {
4242
for (let i = 0; i < groupCount; i += 1) {
4343
const shaderWidth = this.getShaderWidth();
44-
this.renderTopShader(this._$shader, shaderHeight, shaderWidth, i);
44+
this.renderTopShader(this.$shader, shaderHeight, shaderWidth, i);
4545

4646
if (!isSolidShader) {
47-
this.renderBottomShader(this._$shader, maxHeight, shaderHeight, shaderWidth, i);
47+
this.renderBottomShader(this.$shader, maxHeight, shaderHeight, shaderWidth, i);
4848
}
4949

5050
this.renderAllDayShader(shaderWidth, i);
@@ -60,17 +60,17 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
6060
const shaderWidth = this.getShaderWidth();
6161
const bottomShaderWidth = shaderHeight < 0
6262
? shaderWidth
63-
: shaderWidth - this._workSpace.getCellWidth();
63+
: shaderWidth - this.workSpace.getCellWidth();
6464
const normalizedShaderHeight = Math.max(shaderHeight, 0);
6565

66-
this.renderTopShader(this._$shader, normalizedShaderHeight, shaderWidth * groupCount, 0);
66+
this.renderTopShader(this.$shader, normalizedShaderHeight, shaderWidth * groupCount, 0);
6767

6868
if (!isSolidShader) {
6969
this.renderBottomShader(
70-
this._$shader,
70+
this.$shader,
7171
maxHeight,
7272
normalizedShaderHeight,
73-
bottomShaderWidth * groupCount + this._workSpace.getCellWidth(),
73+
bottomShaderWidth * groupCount + this.workSpace.getCellWidth(),
7474
0,
7575
);
7676
}
@@ -84,18 +84,18 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
8484
width: number,
8585
i: number,
8686
): void {
87-
this._$topShader = $('<div>').addClass(DATE_TIME_SHADER_TOP_CLASS);
87+
this.$topShader = $('<div>').addClass(DATE_TIME_SHADER_TOP_CLASS);
8888
if (width) {
89-
setWidth(this._$topShader, width);
89+
setWidth(this.$topShader, width);
9090
}
9191
if (height) {
92-
setHeight(this._$topShader, height);
92+
setHeight(this.$topShader, height);
9393
}
9494

95-
this._$topShader.css('marginTop', this.getShaderTopOffset(i));
96-
this._$topShader.css('left', this.getShaderOffset(i, width));
95+
this.$topShader.css('marginTop', this.getShaderTopOffset(i));
96+
this.$topShader.css('left', this.getShaderOffset(i, width));
9797

98-
$shader.append(this._$topShader);
98+
$shader.append(this.$topShader);
9999
}
100100

101101
private renderBottomShader(
@@ -105,55 +105,55 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
105105
width: number,
106106
i: number,
107107
): void {
108-
this._$bottomShader = $('<div>').addClass(DATE_TIME_SHADER_BOTTOM_CLASS);
108+
this.$bottomShader = $('<div>').addClass(DATE_TIME_SHADER_BOTTOM_CLASS);
109109

110-
const shaderWidth = height < 0 ? width : width - this._workSpace.getCellWidth();
110+
const shaderWidth = height < 0 ? width : width - this.workSpace.getCellWidth();
111111
const shaderHeight = height < 0 ? maxHeight : maxHeight - height;
112112

113-
setWidth(this._$bottomShader, shaderWidth);
114-
setHeight(this._$bottomShader, shaderHeight);
113+
setWidth(this.$bottomShader, shaderWidth);
114+
setHeight(this.$bottomShader, shaderHeight);
115115

116-
this._$bottomShader.css('left', this.getShaderOffset(i, width - this._workSpace.getCellWidth()));
116+
this.$bottomShader.css('left', this.getShaderOffset(i, width - this.workSpace.getCellWidth()));
117117

118-
$shader.append(this._$bottomShader);
118+
$shader.append(this.$bottomShader);
119119
}
120120

121121
private renderAllDayShader(shaderWidth: number, i: number): void {
122-
if (this._workSpace.option('showAllDayPanel')) {
123-
this._$allDayIndicator = $('<div>').addClass(DATE_TIME_SHADER_ALL_DAY_CLASS);
124-
setHeight(this._$allDayIndicator, this._workSpace.getAllDayHeight());
125-
setWidth(this._$allDayIndicator, shaderWidth);
126-
this._$allDayIndicator.css('left', this.getShaderOffset(i, shaderWidth));
122+
if (this.workSpace.option('showAllDayPanel')) {
123+
this.$allDayIndicator = $('<div>').addClass(DATE_TIME_SHADER_ALL_DAY_CLASS);
124+
setHeight(this.$allDayIndicator, this.workSpace.getAllDayHeight());
125+
setWidth(this.$allDayIndicator, shaderWidth);
126+
this.$allDayIndicator.css('left', this.getShaderOffset(i, shaderWidth));
127127

128-
this._workSpace._$allDayPanel.prepend(this._$allDayIndicator);
128+
this.workSpace._$allDayPanel.prepend(this.$allDayIndicator);
129129
}
130130
}
131131

132132
private getShaderOffset(i: number, width: number): number {
133-
return this._workSpace.getGroupedStrategy().getShaderOffset(i, width) as number;
133+
return this.workSpace.getGroupedStrategy().getShaderOffset(i, width) as number;
134134
}
135135

136136
private getShaderTopOffset(i: number): number {
137-
return this._workSpace.getGroupedStrategy().getShaderTopOffset(i) as number;
137+
return this.workSpace.getGroupedStrategy().getShaderTopOffset(i) as number;
138138
}
139139

140140
private getShaderHeight(): number {
141-
return this._workSpace.getGroupedStrategy().getShaderHeight() as number;
141+
return this.workSpace.getGroupedStrategy().getShaderHeight() as number;
142142
}
143143

144144
private getShaderMaxHeight(): number {
145-
return this._workSpace.getGroupedStrategy().getShaderMaxHeight() as number;
145+
return this.workSpace.getGroupedStrategy().getShaderMaxHeight() as number;
146146
}
147147

148148
private getShaderWidth(): number {
149-
return this._workSpace.getGroupedStrategy().getShaderWidth() as number;
149+
return this.workSpace.getGroupedStrategy().getShaderWidth() as number;
150150
}
151151

152152
clean(): void {
153153
super.clean();
154154

155-
if (this._workSpace?._$allDayPanel) {
156-
this._workSpace._$allDayPanel.find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove();
155+
if (this.workSpace?._$allDayPanel) {
156+
this.workSpace._$allDayPanel.find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove();
157157
}
158158
}
159159
}

0 commit comments

Comments
 (0)