Skip to content

Commit 707d486

Browse files
Scheduler — Replace underscore-prefixed: m_tooltip_strategy_base.ts, m_work_space.ts (#32962)
1 parent 7d76ac1 commit 707d486

7 files changed

Lines changed: 218 additions & 205 deletions

File tree

packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const MAX_TOOLTIP_HEIGHT = 200;
99

1010
export class DesktopTooltipStrategy extends TooltipStrategyBase {
1111
protected override prepareBeforeVisibleChanged(dataList) {
12-
this._tooltip.option('position', {
12+
this.tooltip.option('position', {
1313
my: 'bottom',
1414
at: 'top',
1515
boundary: this.getBoundary(dataList),
16-
offset: this._extraOptions.offset,
16+
offset: this.extraOptions.offset,
1717
collision: 'fit flipfit',
1818
});
1919
}
@@ -24,9 +24,9 @@ export class DesktopTooltipStrategy extends TooltipStrategyBase {
2424

2525
protected override onShown() {
2626
super.onShown();
27-
if (this._extraOptions.isButtonClick) {
28-
this._list.focus();
29-
this._list.option('focusedElement', null);
27+
if (this.extraOptions.isButtonClick) {
28+
this.list.focus();
29+
this.list.option('focusedElement', null);
3030
}
3131
}
3232

@@ -46,11 +46,11 @@ export class DesktopTooltipStrategy extends TooltipStrategyBase {
4646
const tooltip = this._options.createComponent(tooltipElement, Tooltip, {
4747
target,
4848
maxHeight: MAX_TOOLTIP_HEIGHT,
49-
rtlEnabled: this._extraOptions.rtlEnabled,
49+
rtlEnabled: this.extraOptions.rtlEnabled,
5050
onShown: this.onShown.bind(this),
5151
contentTemplate: this.getContentTemplate(dataList),
5252
wrapperAttr: { class: APPOINTMENT_TOOLTIP_WRAPPER_CLASS },
53-
_loopFocus: this._extraOptions._loopFocus,
53+
_loopFocus: this.extraOptions._loopFocus,
5454
});
5555

5656
tooltip.setAria({
@@ -62,7 +62,7 @@ export class DesktopTooltipStrategy extends TooltipStrategyBase {
6262
}
6363

6464
protected override onListRender(e) {
65-
return this._extraOptions.dragBehavior && this._extraOptions.dragBehavior(e);
65+
return this.extraOptions.dragBehavior && this.extraOptions.dragBehavior(e);
6666
}
6767

6868
protected override onListItemContextMenu(e) {

packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_mobile_tooltip_strategy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ export class MobileTooltipStrategy extends TooltipStrategyBase {
7171
private setTooltipConfig(): void {
7272
const isTabletWidth = getWidth(getWindow()) > 700;
7373

74-
const listHeight = getOuterHeight(this._list.$element().find(CLASS.scrollableContent));
75-
this._tooltip.option(
74+
const listHeight = getOuterHeight(this.list.$element().find(CLASS.scrollableContent));
75+
this.tooltip.option(
7676
isTabletWidth
7777
? createTabletDeviceConfig(listHeight)
7878
: createPhoneDeviceConfig(listHeight),
7979
);
8080
}
8181

82-
private async _onShowing(): Promise<void> {
83-
this._tooltip.option('height', MAX_HEIGHT.DEFAULT);
82+
private async onShowing(): Promise<void> {
83+
this.tooltip.option('height', MAX_HEIGHT.DEFAULT);
8484
/*
8585
NOTE: there are two setTooltipConfig calls to reduce blinking of overlay.
8686
The first one sets initial sizes, the second updates them after rendering async templates
@@ -99,7 +99,7 @@ export class MobileTooltipStrategy extends TooltipStrategyBase {
9999
hideOnOutsideClick: true,
100100
animation: animationConfig,
101101

102-
onShowing: () => this._onShowing(),
102+
onShowing: () => this.onShowing(),
103103
onShown: this.onShown.bind(this),
104104
contentTemplate: this.getContentTemplate(dataList),
105105
wrapperAttr: { class: CLASS.slidePanel },

packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,41 @@ const APPOINTMENT_TOOLTIP_TEMPLATE = 'appointmentTooltipTemplate';
2020
export class TooltipStrategyBase {
2121
protected asyncTemplatePromises = new Set<Promise<void>>();
2222

23-
_tooltip: any;
23+
protected tooltip: any;
2424

25+
// TODO: make private once external usages in m_scheduler.ts are removed
2526
_options: any;
2627

27-
_extraOptions: any;
28+
protected extraOptions: any;
2829

29-
_list: any;
30+
protected list: any;
3031

3132
constructor(options) {
32-
this._tooltip = null;
33+
this.tooltip = null;
3334
this._options = options;
34-
this._extraOptions = null;
35+
this.extraOptions = null;
3536
}
3637

3738
show(target, dataList, extraOptions) {
3839
if (this.canShowTooltip(dataList)) {
3940
this.hide();
40-
this._extraOptions = extraOptions;
41+
this.extraOptions = extraOptions;
4142
this.showCore(target, dataList);
4243
}
4344
}
4445

4546
private showCore(target, dataList) {
4647
const describedByValue = isRenderer(target) && target.attr('aria-describedby') as string;
4748

48-
if (!this._tooltip) {
49-
this._tooltip = this.createTooltip(target, dataList);
49+
if (!this.tooltip) {
50+
this.tooltip = this.createTooltip(target, dataList);
5051
} else {
51-
this.shouldUseTarget() && this._tooltip.option('target', target);
52-
this._list.option('dataSource', dataList);
52+
this.shouldUseTarget() && this.tooltip.option('target', target);
53+
this.list.option('dataSource', dataList);
5354
}
5455

5556
this.prepareBeforeVisibleChanged(dataList);
56-
this._tooltip.option('visible', true);
57+
this.tooltip.option('visible', true);
5758

5859
describedByValue && target.attr('aria-describedby', describedByValue);
5960
}
@@ -64,7 +65,7 @@ export class TooltipStrategyBase {
6465
}
6566

6667
private isDeletingAllowed(appointment) {
67-
const { editing } = this._extraOptions;
68+
const { editing } = this.extraOptions;
6869
const disabled = this._options.getAppointmentDisabled(appointment);
6970
const isDeletingAllowed = editing === true || editing?.allowDeleting === true;
7071
return !disabled && isDeletingAllowed;
@@ -74,18 +75,18 @@ export class TooltipStrategyBase {
7475
return (container) => {
7576
const listElement = $('<div>');
7677
$(container).append(listElement);
77-
this._list = this.createList(listElement, dataList);
78-
this._list.registerKeyHandler?.('escape', () => {
78+
this.list = this.createList(listElement, dataList);
79+
this.list.registerKeyHandler?.('escape', () => {
7980
this.hide();
80-
this._tooltip.option('target').focus();
81+
this.tooltip.option('target').focus();
8182
});
82-
this._list.registerKeyHandler?.('del', () => {
83-
const { focusedElement } = this._list.option();
83+
this.list.registerKeyHandler?.('del', () => {
84+
const { focusedElement } = this.list.option();
8485
if (!focusedElement) {
8586
return;
8687
}
8788

88-
const { appointment, targetedAppointment } = this._list._getItemData(focusedElement);
89+
const { appointment, targetedAppointment } = this.list._getItemData(focusedElement);
8990
if (!appointment) {
9091
return;
9192
}
@@ -99,22 +100,22 @@ export class TooltipStrategyBase {
99100
}
100101

101102
isAlreadyShown(target) {
102-
if (this._tooltip && this._tooltip.option('visible')) {
103-
return this._tooltip.option('target')[0] === target[0];
103+
if (this.tooltip && this.tooltip.option('visible')) {
104+
return this.tooltip.option('target')[0] === target[0];
104105
}
105106
return undefined;
106107
}
107108

108109
protected onShown() {
109-
this._list.option('focusStateEnabled', this._extraOptions.focusStateEnabled);
110+
this.list.option('focusStateEnabled', this.extraOptions.focusStateEnabled);
110111
}
111112

112113
dispose() {
113114
}
114115

115116
hide() {
116-
if (this._tooltip) {
117-
this._tooltip.option('visible', false);
117+
if (this.tooltip) {
118+
this.tooltip.option('visible', false);
118119
}
119120
}
120121

@@ -171,7 +172,7 @@ export class TooltipStrategyBase {
171172
}
172173

173174
private createFunctionTemplate(template, appointmentData, targetedAppointmentData, index) {
174-
const isButtonClicked = Boolean(this._extraOptions.isButtonClick);
175+
const isButtonClicked = Boolean(this.extraOptions.isButtonClick);
175176

176177
// @ts-expect-error
177178
return new FunctionTemplate((options) => {
@@ -196,7 +197,7 @@ export class TooltipStrategyBase {
196197

197198
private onListItemClick(e) {
198199
this.hide();
199-
this._extraOptions.clickEvent && this._extraOptions.clickEvent(e);
200+
this.extraOptions.clickEvent && this.extraOptions.clickEvent(e);
200201
this._options.showAppointmentPopup(e.itemData.appointment, false, e.itemData.targetedAppointment);
201202
}
202203

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ class SchedulerAgenda extends WorkSpace {
138138

139139
protected override initWorkSpaceUnits() {
140140
this.initGroupTable();
141-
this._$timePanel = $('<table>').attr('aria-hidden', true).addClass(TIME_PANEL_CLASS);
141+
this.$timePanel = $('<table>').attr('aria-hidden', true).addClass(TIME_PANEL_CLASS);
142142
this._$dateTable = $('<table>').attr('aria-hidden', true).addClass(DATE_TABLE_CLASS);
143143
this._$dateTableScrollableContent = $('<div>').addClass('dx-scheduler-date-table-scrollable-content');
144-
this._$dateTableContainer = $('<div>').addClass('dx-scheduler-date-table-container');
144+
this.$dateTableContainer = $('<div>').addClass('dx-scheduler-date-table-container');
145145
}
146146

147147
private initGroupTable() {
@@ -304,7 +304,7 @@ class SchedulerAgenda extends WorkSpace {
304304

305305
protected override cleanView() {
306306
this._$dateTable.empty();
307-
this._$timePanel.empty();
307+
this.$timePanel.empty();
308308

309309
if (this._$groupTable) {
310310
this._$groupTable.empty();
@@ -323,14 +323,14 @@ class SchedulerAgenda extends WorkSpace {
323323
}
324324

325325
protected override createWorkSpaceStaticElements() {
326-
this._$dateTableContainer.append(this._$dateTable);
326+
this.$dateTableContainer.append(this._$dateTable);
327327
this._dateTableScrollable.$content().append(this._$dateTableScrollableContent);
328328

329329
if (this._$groupTable) {
330330
this._$dateTableScrollableContent.prepend(this._$groupTable);
331331
}
332332

333-
this._$dateTableScrollableContent.append(this._$timePanel, this._$dateTableContainer);
333+
this._$dateTableScrollableContent.append(this.$timePanel, this.$dateTableContainer);
334334
this.$element().append(this._dateTableScrollable.$element());
335335
}
336336

@@ -430,7 +430,7 @@ class SchedulerAgenda extends WorkSpace {
430430

431431
protected override renderTimePanel() {
432432
this.renderTableBody({
433-
container: getPublicElement(this._$timePanel),
433+
container: getPublicElement(this.$timePanel),
434434
rowCount: this.getTimePanelRowCount(),
435435
cellCount: 1,
436436
rowClass: TIME_PANEL_ROW_CLASS,

0 commit comments

Comments
 (0)