Skip to content

Commit ed225c1

Browse files
committed
refactor: delete public methods for headerPanel, flexContainer, allDayShaderIndicator
1 parent d3f9ff4 commit ed225c1

4 files changed

Lines changed: 18 additions & 33 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import CurrentTimeShader from './current_time_shader';
55

66
export const DATE_TIME_SHADER_ALL_DAY_CLASS = 'dx-scheduler-date-time-shader-all-day';
77

8+
const ALL_DAY_PANEL_CLASS = 'dx-scheduler-all-day-panel';
9+
810
const DATE_TIME_SHADER_TOP_CLASS = 'dx-scheduler-date-time-shader-top';
911
const DATE_TIME_SHADER_BOTTOM_CLASS = 'dx-scheduler-date-time-shader-bottom';
1012

@@ -126,7 +128,10 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
126128
setWidth(this.$allDayIndicator, shaderWidth);
127129
this.$allDayIndicator.css('left', this.getShaderOffset(i, shaderWidth));
128130

129-
this.workSpace.addAllDayShaderIndicator(this.$allDayIndicator);
131+
const $allDayPanel = this.workSpace.$element().find(`.${ALL_DAY_PANEL_CLASS}`);
132+
if ($allDayPanel.length) {
133+
$allDayPanel.first().prepend(this.$allDayIndicator);
134+
}
130135
}
131136
}
132137

@@ -153,7 +158,7 @@ class VerticalCurrentTimeShader extends CurrentTimeShader {
153158
clean(): void {
154159
super.clean();
155160

156-
this.workSpace?.removeAllDayShaderIndicator();
161+
this.workSpace?.$element().find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove();
157162
}
158163
}
159164

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { noop } from '@js/core/utils/common';
44
import dateUtils from '@js/core/utils/date';
55
import { extend } from '@js/core/utils/extend';
66
import { getBoundingRect } from '@js/core/utils/position';
7-
import { getOuterWidth, setHeight } from '@js/core/utils/size';
7+
import { getOuterHeight, getOuterWidth, setHeight } from '@js/core/utils/size';
88
import { hasWindow } from '@js/core/utils/window';
99
// NOTE: Renovation component import.
1010
import { HeaderPanelTimelineComponent } from '@ts/scheduler/r1/components/index';
@@ -177,7 +177,7 @@ class SchedulerTimeline extends SchedulerWorkSpace {
177177
private getWorkSpaceMinHeight() {
178178
let minHeight = this.getWorkSpaceHeight();
179179

180-
const workspaceContainerHeight = this.getFlexContainerOuterHeight();
180+
const workspaceContainerHeight = this.$flexContainer ? getOuterHeight(this.$flexContainer, true) : 0;
181181

182182
if (minHeight < workspaceContainerHeight) {
183183
minHeight = workspaceContainerHeight;

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

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import { CompactAppointmentsHelper } from '../m_compact_appointments_helper';
7171
import type { SubscribeKey, SubscribeMethods } from '../m_subscribes';
7272
import tableCreatorModule from '../m_table_creator';
7373
import { utils } from '../m_utils';
74-
import VerticalShader, { DATE_TIME_SHADER_ALL_DAY_CLASS } from '../shaders/current_time_shader_vertical';
74+
import VerticalShader from '../shaders/current_time_shader_vertical';
7575
import type { ResourceLoader } from '../utils/loader/resource_loader';
7676
import {
7777
getAppointmentGroupIndex,
@@ -226,7 +226,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
226226

227227
protected getToday?(): Date;
228228

229-
private $allDayPanel: any;
229+
protected $allDayPanel: any;
230230

231231
private $allDayTitle: any;
232232

@@ -276,7 +276,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
276276

277277
positionHelper!: PositionHelper;
278278

279-
private $headerPanelContainer: any;
279+
protected $headerPanelContainer: any;
280280

281281
private $headerTablesContainer: any;
282282

@@ -294,7 +294,7 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
294294

295295
private allDayPanels!: any[];
296296

297-
private $flexContainer: any;
297+
protected $flexContainer: any;
298298

299299
protected shader: any;
300300

@@ -925,30 +925,6 @@ class SchedulerWorkSpace extends Widget<WorkspaceOptionsInternal> {
925925
}
926926
}
927927

928-
getHeaderPanelContainerHeight(): number {
929-
if (!hasWindow() || !this.$headerPanelContainer) {
930-
return 0;
931-
}
932-
933-
return getBoundingRect(this.$headerPanelContainer.get(0) as HTMLElement).height;
934-
}
935-
936-
getFlexContainerOuterHeight(): number {
937-
if (!this.$flexContainer) {
938-
return 0;
939-
}
940-
941-
return getOuterHeight(this.$flexContainer, true);
942-
}
943-
944-
addAllDayShaderIndicator($indicator: any): void {
945-
this.$allDayPanel?.prepend($indicator);
946-
}
947-
948-
removeAllDayShaderIndicator(): void {
949-
this.$allDayPanel?.find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove();
950-
}
951-
952928
private getScrollbarWidth() {
953929
const containerElement = $(this.$dateTableScrollable.container()).get(0) as HTMLElement;
954930
const scrollbarWidth = containerElement.offsetWidth - containerElement.clientWidth;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getBoundingRect } from '@js/core/utils/position';
2+
import { hasWindow } from '@js/core/utils/window';
23
import { calculateDayDuration, getVerticalGroupCountClass } from '@ts/scheduler/r1/utils/index';
34
import { WORK_SPACE_BORDER_PX } from '@ts/scheduler/workspaces/const';
45

@@ -92,7 +93,10 @@ class VerticalGroupedStrategy {
9293

9394
const dayHeight = (calculateDayDuration(startDayHour, endDayHour) / hoursInterval) * this._workSpace.getCellHeight();
9495
const scrollTop = this.getScrollableScrollTop();
95-
const headerRowHeight = this._workSpace.getHeaderPanelContainerHeight();
96+
let headerRowHeight = 0;
97+
if (hasWindow() && this._workSpace.$headerPanelContainer) {
98+
headerRowHeight = getBoundingRect(this._workSpace.$headerPanelContainer.get(0) as HTMLElement).height;
99+
}
96100

97101
let topOffset = groupIndex * dayHeight + headerRowHeight + this._workSpace.option('getHeaderHeight')() - scrollTop;
98102

0 commit comments

Comments
 (0)