Skip to content

Commit f549caf

Browse files
Scheduler — Replace underscore-prefixed: Long tail (popup, helpers, header, utils) (DevExpress#33010)
1 parent 2d8591a commit f549caf

File tree

8 files changed

+134
-135
lines changed

8 files changed

+134
-135
lines changed

packages/devextreme/js/__internal/scheduler/appointment_popup/m_legacy_popup.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ export class AppointmentPopup {
7979
this.state.excludeInfo = config.excludeInfo;
8080

8181
if (!this.popup) {
82-
const popupConfig = this._createPopupConfig();
83-
this.popup = this._createPopup(popupConfig);
82+
const popupConfig = this.createPopupConfig();
83+
this.popup = this.createPopup(popupConfig);
8484
}
8585

8686
this.popup.option(
8787
'toolbarItems',
8888
getPopupToolbarItems(
8989
config.isToolbarVisible,
90-
(e) => this._doneButtonClickHandler(e),
90+
(e) => this.doneButtonClickHandler(e),
9191
),
9292
);
9393

@@ -102,26 +102,26 @@ export class AppointmentPopup {
102102
this.popup?.$element().remove();
103103
}
104104

105-
_createPopup(options) {
105+
private createPopup(options) {
106106
const popupElement = $('<div>')
107107
.addClass(APPOINTMENT_POPUP_CLASS)
108108
.appendTo(this.scheduler.getElement());
109109

110110
return this.scheduler.createComponent(popupElement, Popup, options);
111111
}
112112

113-
_createPopupConfig() {
113+
private createPopupConfig() {
114114
return {
115115
...POPUP_CONFIG,
116116
onHiding: () => this.scheduler.focus(),
117-
contentTemplate: () => this._createPopupContent(),
118-
onShowing: (e) => this._onShowing(e),
117+
contentTemplate: () => this.createPopupContent(),
118+
onShowing: (e) => this.onShowing(e),
119119
wrapperAttr: { class: APPOINTMENT_POPUP_CLASS },
120120
};
121121
}
122122

123-
_onShowing(e) {
124-
this._updateForm();
123+
private onShowing(e) {
124+
this.updateForm();
125125

126126
e.component.$overlayContent().attr(
127127
'aria-label',
@@ -145,13 +145,13 @@ export class AppointmentPopup {
145145
});
146146
}
147147

148-
_createPopupContent() {
149-
this._createForm();
148+
private createPopupContent() {
149+
this.createForm();
150150
return this.form.dxForm.$element(); // TODO
151151
}
152152

153-
_createFormData(rawAppointment) {
154-
const appointment = this._createAppointmentAdapter(rawAppointment);
153+
private createFormData(rawAppointment) {
154+
const appointment = this.createAppointmentAdapter(rawAppointment);
155155
const resourceManager = this.scheduler.getResourceManager();
156156
const rawAppointmentGroupValues = getRawAppointmentGroupValues(
157157
rawAppointment,
@@ -165,15 +165,15 @@ export class AppointmentPopup {
165165
};
166166
}
167167

168-
_createForm() {
168+
private createForm() {
169169
const rawAppointment = this.state.appointment.data;
170-
const formData = this._createFormData(rawAppointment);
170+
const formData = this.createFormData(rawAppointment);
171171

172172
this.form.create(this.triggerResize.bind(this), this.changeSize.bind(this), formData); // TODO
173173
}
174174

175-
_isReadOnly(rawAppointment) {
176-
const appointment = this._createAppointmentAdapter(rawAppointment);
175+
private isReadOnly(rawAppointment) {
176+
const appointment = this.createAppointmentAdapter(rawAppointment);
177177

178178
if (rawAppointment && appointment.disabled) {
179179
return true;
@@ -186,22 +186,22 @@ export class AppointmentPopup {
186186
return !this.scheduler.getEditingConfig().allowUpdating;
187187
}
188188

189-
_createAppointmentAdapter(rawAppointment) {
189+
private createAppointmentAdapter(rawAppointment) {
190190
return new AppointmentAdapter(
191191
rawAppointment,
192192
this.scheduler.getDataAccessors(),
193193
);
194194
}
195195

196-
_updateForm() {
196+
private updateForm() {
197197
const { data } = this.state.appointment;
198-
const appointment = this._createFormData(data);
199-
const formData = this._createAppointmentAdapter(appointment)
198+
const appointment = this.createFormData(data);
199+
const formData = this.createAppointmentAdapter(appointment)
200200
.clone()
201201
.calculateDates(this.scheduler.getTimeZoneCalculator(), 'toAppointment')
202202
.source;
203203

204-
this.form.readOnly = this._isReadOnly(formData);
204+
this.form.readOnly = this.isReadOnly(formData);
205205
this.form.updateFormData(formData);
206206
}
207207

@@ -237,7 +237,7 @@ export class AppointmentPopup {
237237
const deferred = new Deferred();
238238
const validation = this.form.dxForm.validate();
239239

240-
isShowLoadPanel && this._showLoadPanel();
240+
isShowLoadPanel && this.showLoadPanel();
241241

242242
when(validation?.complete || validation).done((validation) => {
243243
if (validation && !validation.isValid) {
@@ -247,13 +247,13 @@ export class AppointmentPopup {
247247
}
248248

249249
const { repeat } = this.form.formData;
250-
const adapter = this._createAppointmentAdapter(this.form.formData);
250+
const adapter = this.createAppointmentAdapter(this.form.formData);
251251
const clonedAdapter = adapter
252252
.clone()
253253
.calculateDates(this.scheduler.getTimeZoneCalculator(), 'fromAppointment');
254254
const shouldClearRecurrenceRule = !repeat && Boolean(clonedAdapter.recurrenceRule);
255255

256-
this._addMissingDSTTime(adapter, clonedAdapter);
256+
this.addMissingDSTTime(adapter, clonedAdapter);
257257

258258
if (shouldClearRecurrenceRule) {
259259
clonedAdapter.recurrenceRule = '';
@@ -286,7 +286,7 @@ export class AppointmentPopup {
286286
return deferred.promise();
287287
}
288288

289-
_doneButtonClickHandler(e) {
289+
private doneButtonClickHandler(e) {
290290
e.cancel = true;
291291
this.saveEditDataAsync();
292292
}
@@ -295,10 +295,10 @@ export class AppointmentPopup {
295295
// @ts-expect-error
296296
const deferred = new Deferred();
297297

298-
if (this._tryLockSaveChanges()) {
298+
if (this.tryLockSaveChanges()) {
299299
when(this.saveChangesAsync(true)).done(() => {
300300
if (this.state.lastEditData) { // TODO
301-
const adapter = this._createAppointmentAdapter(this.state.lastEditData);
301+
const adapter = this.createAppointmentAdapter(this.state.lastEditData);
302302

303303
const { startDate, endDate, allDay } = adapter;
304304

@@ -316,7 +316,7 @@ export class AppointmentPopup {
316316
this.state.lastEditData = null;
317317
}
318318

319-
this._unlockSaveChanges();
319+
this.unlockSaveChanges();
320320

321321
deferred.resolve();
322322
});
@@ -325,7 +325,7 @@ export class AppointmentPopup {
325325
return deferred.promise();
326326
}
327327

328-
_showLoadPanel() {
328+
private showLoadPanel() {
329329
const container = this.popup.$overlayContent();
330330

331331
showLoading({
@@ -336,38 +336,38 @@ export class AppointmentPopup {
336336
});
337337
}
338338

339-
_tryLockSaveChanges() {
339+
private tryLockSaveChanges() {
340340
if (this.state.saveChangesLocker === false) {
341341
this.state.saveChangesLocker = true;
342342
return true;
343343
}
344344
return false;
345345
}
346346

347-
_unlockSaveChanges() {
347+
private unlockSaveChanges() {
348348
this.state.saveChangesLocker = false;
349349
}
350350

351351
// NOTE: Fix ticket T1102713
352-
_addMissingDSTTime(formAppointmentAdapter, clonedAppointmentAdapter) {
352+
private addMissingDSTTime(formAppointmentAdapter, clonedAppointmentAdapter) {
353353
const timeZoneCalculator = this.scheduler.getTimeZoneCalculator();
354354

355-
clonedAppointmentAdapter.startDate = this._addMissingDSTShiftToDate(
355+
clonedAppointmentAdapter.startDate = this.addMissingDSTShiftToDate(
356356
timeZoneCalculator,
357357
formAppointmentAdapter.startDate,
358358
clonedAppointmentAdapter.startDate,
359359
);
360360

361361
if (clonedAppointmentAdapter.endDate) {
362-
clonedAppointmentAdapter.endDate = this._addMissingDSTShiftToDate(
362+
clonedAppointmentAdapter.endDate = this.addMissingDSTShiftToDate(
363363
timeZoneCalculator,
364364
formAppointmentAdapter.endDate,
365365
clonedAppointmentAdapter.endDate,
366366
);
367367
}
368368
}
369369

370-
_addMissingDSTShiftToDate(timeZoneCalculator, originFormDate, clonedDate) {
370+
private addMissingDSTShiftToDate(timeZoneCalculator, originFormDate, clonedDate) {
371371
const originTimezoneShift = timeZoneCalculator.getOffsets(originFormDate)?.common;
372372
const clonedTimezoneShift = timeZoneCalculator.getOffsets(clonedDate)?.common;
373373
const shiftDifference = originTimezoneShift - clonedTimezoneShift;

0 commit comments

Comments
 (0)