Skip to content

Commit c92ba4a

Browse files
Scheduler — Replace underscore-prefixed: Scheduler core (m_scheduler, m_recurrence_editor) (#32883)
1 parent ea968bc commit c92ba4a

19 files changed

Lines changed: 576 additions & 575 deletions

packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts

Lines changed: 199 additions & 199 deletions
Large diffs are not rendered by default.

packages/devextreme/js/__internal/scheduler/m_scheduler.ts

Lines changed: 299 additions & 298 deletions
Large diffs are not rendered by default.

packages/devextreme/js/__internal/scheduler/m_subscribes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ const subscribes = {
7474
const { info } = utils.dataAccessors.getAppointmentSettings(options.$appointment) as AppointmentItemViewModel;
7575
const { startDate } = info.sourceAppointment;
7676

77-
this._checkRecurringAppointment(options.target, options.data, startDate, () => {
78-
this._updateAppointment(options.target, options.data, function () {
77+
this.checkRecurringAppointment(options.target, options.data, startDate, () => {
78+
this.updateAppointmentCore(options.target, options.data, function () {
7979
this._appointments.moveAppointmentBack();
8080
});
8181
});
8282
},
8383

8484
getUpdatedData(rawAppointment) {
85-
return this._getUpdatedData(rawAppointment);
85+
return this.getUpdatedData(rawAppointment);
8686
},
8787

8888
updateAppointmentAfterDrag({
@@ -91,7 +91,7 @@ const subscribes = {
9191
const { info } = utils.dataAccessors.getAppointmentSettings(element) as AppointmentItemViewModel;
9292
// NOTE: enrich target appointment with additional data from the source
9393
// in case of one appointment of series will change
94-
const targetedRawAppointment = extend({}, rawAppointment, this._getUpdatedData(rawAppointment));
94+
const targetedRawAppointment = extend({}, rawAppointment, this.getUpdatedData(rawAppointment));
9595

9696
const fromAllDay = Boolean(rawAppointment.allDay);
9797
const toAllDay = Boolean(targetedRawAppointment.allDay);
@@ -108,8 +108,8 @@ const subscribes = {
108108
}
109109

110110
if (isDropToSelfScheduler && (!isDropToTheSameCell || isDragAndDropBetweenComponents || isDropBetweenAllDay)) {
111-
this._checkRecurringAppointment(rawAppointment, targetedRawAppointment, info.sourceAppointment.startDate, () => {
112-
this._updateAppointment(rawAppointment, targetedRawAppointment, onCancel, event);
111+
this.checkRecurringAppointment(rawAppointment, targetedRawAppointment, info.sourceAppointment.startDate, () => {
112+
this.updateAppointmentCore(rawAppointment, targetedRawAppointment, onCancel, event);
113113
}, undefined, undefined, event);
114114
} else {
115115
onCancel();

packages/devextreme/testing/helpers/scheduler/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,11 @@ export class SchedulerTestWrapper extends ElementWrapper {
591591

592592
getCancelButton: () => this.appointmentPopup.getPopup().find('.dx-popup-cancel'),
593593
clickCancelButton: () => this.appointmentPopup.getCancelButton().trigger('dxclick'),
594-
saveAppointmentData: () => this.instance._appointmentPopup.saveEditDataAsync.call(this.instance._appointmentPopup),
594+
saveAppointmentData: () => this.instance.appointmentPopup.saveEditDataAsync.call(this.instance.appointmentPopup),
595595

596596
hasLoadPanel: () => this.appointmentPopup.getPopup().find('.dx-loadpanel').length !== 0,
597597

598-
getInstance: () => this.instance._appointmentPopup
598+
getInstance: () => this.instance.appointmentPopup
599599
};
600600

601601
this.appointmentForm = {

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.editing.tests.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ module('Integration: Appointment editing', {
135135
currentView: 'timelineMonth'
136136
});
137137

138-
const updateAppointment = scheduler.instance._updateAppointment;
138+
const updateAppointment = scheduler.instance.updateAppointmentCore;
139139
const spy = sinon.spy(noop);
140140
const oldItem = data[0];
141141

142-
scheduler.instance._updateAppointment = spy;
142+
scheduler.instance.updateAppointmentCore = spy;
143143

144144
const cellWidth = getOuterWidth(scheduler.instance.$element().find('.' + DATE_TABLE_CELL_CLASS).eq(0));
145145

@@ -151,7 +151,7 @@ module('Integration: Appointment editing', {
151151
assert.deepEqual(spy.getCall(0).args[0], oldItem, 'Target item is correct');
152152
assert.deepEqual(spy.getCall(0).args[1], $.extend(true, oldItem, { endDate: new Date(2015, 1, 3, 2, 0) }), 'New data is correct');
153153
} finally {
154-
scheduler.instance._updateAppointment = updateAppointment;
154+
scheduler.instance.updateAppointmentCore = updateAppointment;
155155
}
156156
});
157157

@@ -162,11 +162,11 @@ module('Integration: Appointment editing', {
162162

163163
const scheduler = await this.createInstance({ currentDate: new Date(2015, 1, 9), dataSource: data, editing: true });
164164

165-
const updateAppointment = scheduler.instance._updateAppointment;
165+
const updateAppointment = scheduler.instance.updateAppointmentCore;
166166
const spy = sinon.spy(noop);
167167
const oldItem = this.tasks[0];
168168

169-
scheduler.instance._updateAppointment = spy;
169+
scheduler.instance.updateAppointmentCore = spy;
170170

171171
const cellHeight = getOuterHeight(scheduler.instance.$element().find('.' + DATE_TABLE_CELL_CLASS).eq(0));
172172
const hourHeight = cellHeight * 2;
@@ -179,7 +179,7 @@ module('Integration: Appointment editing', {
179179
assert.deepEqual(spy.getCall(0).args[0], oldItem, 'Target item is correct');
180180
assert.deepEqual(spy.getCall(0).args[1], $.extend(true, oldItem, { endDate: new Date(2015, 1, 9, 3, 0) }), 'New data is correct');
181181
} finally {
182-
scheduler.instance._updateAppointment = updateAppointment;
182+
scheduler.instance.updateAppointmentCore = updateAppointment;
183183
}
184184
});
185185

@@ -263,7 +263,7 @@ module('Integration: Appointment editing', {
263263

264264
$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');
265265

266-
const popup = scheduler.instance._appointmentPopup.popup;
266+
const popup = scheduler.instance.appointmentPopup.popup;
267267
});
268268

269269
test('Add new appointment with delay and an error(T381444)', async function(assert) {
@@ -298,7 +298,7 @@ module('Integration: Appointment editing', {
298298

299299
$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');
300300

301-
const popup = scheduler.instance._appointmentPopup.popup;
301+
const popup = scheduler.instance.appointmentPopup.popup;
302302
});
303303

304304
// TODO: update editors in popup

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.monthView.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ module('Integration: Appointments in Month view', {
413413

414414
$('.dx-dialog-buttons .dx-button').eq(0).trigger('dxclick');
415415

416-
const popup = scheduler.instance._appointmentPopup.popup;
416+
const popup = scheduler.instance.appointmentPopup.popup;
417417
const $buttonGroup = $(popup.$content()).find('.dx-buttongroup');
418418

419419
assert.deepEqual($buttonGroup.eq(0).dxButtonGroup('instance').option('selectedItemKeys'), ['MO', 'TH'], 'Right button group select item keys');
@@ -452,7 +452,7 @@ module('Integration: Appointments in Month view', {
452452

453453
$('.dx-dialog-buttons .dx-button').eq(0).trigger('dxclick');
454454

455-
const popup = scheduler.instance._appointmentPopup.popup;
455+
const popup = scheduler.instance.appointmentPopup.popup;
456456
const $buttonGroup = $(popup.$content()).find('.dx-buttongroup');
457457

458458
$buttonGroup.eq(0).dxButtonGroup('instance').option('selectedItemKeys'), ['MO', 'TH'], 'Right button group select item keys';

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.tooltip.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module('Integration: Appointment tooltip', {
5555
height: 600
5656
});
5757

58-
const getAppointmentDisabled = sinon.spy(scheduler.instance._appointmentTooltip._options, 'getAppointmentDisabled');
58+
const getAppointmentDisabled = sinon.spy(scheduler.instance.appointmentTooltip._options, 'getAppointmentDisabled');
5959

6060
const clock = sinon.useFakeTimers();
6161
await scheduler.appointments.click(0, clock);

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.week.based.views.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ module('Integration: Appointment Day, Week views', {
230230
height: 1500
231231
});
232232

233-
const spy = sinon.spy(scheduler.instance._appointmentPopup, 'show');
233+
const spy = sinon.spy(scheduler.instance.appointmentPopup, 'show');
234234

235235
const clock = sinon.useFakeTimers();
236236
await scheduler.appointments.click(0, clock);
@@ -244,7 +244,7 @@ module('Integration: Appointment Day, Week views', {
244244

245245
hide();
246246
} finally {
247-
scheduler.instance._appointmentPopup.show.restore();
247+
scheduler.instance.appointmentPopup.show.restore();
248248
}
249249
});
250250

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointmentPopup.tests.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const checkFormWithRecurrenceEditor = (assert, instance, visibility) => {
3434
assert.equal(form.itemOption(APPOINTMENT_FORM_GROUP_NAMES.Main).colSpan, colSpan, 'colSpan of main group is correct');
3535
assert.equal(form.itemOption(APPOINTMENT_FORM_GROUP_NAMES.Recurrence).colSpan, colSpan, 'colSpan of recurrence group is correct');
3636

37-
assert.equal(instance._appointmentPopup.popup.option('maxWidth'), width, 'maxWidth of popup is correct');
37+
assert.equal(instance.appointmentPopup.popup.option('maxWidth'), width, 'maxWidth of popup is correct');
3838
};
3939

4040
const createInstance = (options) => {
@@ -162,12 +162,12 @@ QUnit.module('Appointment popup form', moduleConfig, () => {
162162
scheduler.appointments.dblclick(0);
163163
scheduler.appointmentPopup.dialog.clickEditSeries();
164164

165-
const form = scheduler.instance._appointmentPopup.form.form;
165+
const form = scheduler.instance.appointmentPopup.form.form;
166166

167167
assert.ok(form.getEditor('repeat').option('value'), 'repeat checkbox should be checked');
168168
assert.ok(form.option('items')[1].visible, 'recurrence form should be visible');
169169

170-
scheduler.instance._appointmentPopup.popup.hide();
170+
scheduler.instance.appointmentPopup.popup.hide();
171171
scheduler.instance.showAppointmentPopup();
172172

173173
assert.notOk(form.getEditor('repeat').option('value'), 'repeat checkbox should be unchecked if empty form');
@@ -330,11 +330,11 @@ QUnit.module('Appointment popup form', moduleConfig, () => {
330330

331331
scheduler.appointments.dblclick();
332332
assert.equal(scheduler.appointmentPopup.isVisible(), expected, text + ' if call from UI');
333-
scheduler.instance._appointmentPopup.popup.option('visible', false);
333+
scheduler.instance.appointmentPopup.popup.option('visible', false);
334334

335335
scheduler.instance.showAppointmentPopup(data[0]);
336336
assert.equal(scheduler.appointmentPopup.isVisible(), expected, text + ' if call showAppointmentPopup method');
337-
scheduler.instance._appointmentPopup.popup.option('visible', false);
337+
scheduler.instance.appointmentPopup.popup.option('visible', false);
338338
});
339339
});
340340

@@ -674,11 +674,11 @@ if(isDesktopEnvironment()) {
674674
const scheduler = await createScheduler();
675675
scheduler.instance.showAppointmentPopup({ startDate: new Date(2018, 5, 18), endDate: Date(2018, 5, 18), text: 'a' });
676676
checkFormWithRecurrenceEditor(assert, scheduler.instance, false);
677-
scheduler.instance._appointmentPopup.popup.hide();
677+
scheduler.instance.appointmentPopup.popup.hide();
678678
scheduler.instance.showAppointmentPopup({ startDate: new Date(2018, 5, 18), endDate: Date(2018, 5, 18), text: 'b', recurrenceRule: 'FREQ=WEEKLY' });
679679
$('.dx-dialog-buttons .dx-button').eq(0).trigger('dxclick');
680680
checkFormWithRecurrenceEditor(assert, scheduler.instance, true);
681-
scheduler.instance._appointmentPopup.popup.hide();
681+
scheduler.instance.appointmentPopup.popup.hide();
682682

683683
scheduler.instance.showAppointmentPopup({ startDate: new Date(2018, 5, 18), endDate: Date(2018, 5, 18), text: 'c' });
684684
checkFormWithRecurrenceEditor(assert, scheduler.instance, false);
@@ -690,7 +690,7 @@ if(isDesktopEnvironment()) {
690690

691691
const form = scheduler.instance.getAppointmentDetailsForm();
692692
form.getEditor('visibilityChanged').option('value', true);
693-
scheduler.instance._appointmentPopup.popup.hide();
693+
scheduler.instance.appointmentPopup.popup.hide();
694694

695695
scheduler.instance.showAppointmentPopup({ startDate: new Date(2018, 5, 18), endDate: Date(2018, 5, 18), text: 'b', recurrenceRule: 'FREQ=WEEKLY' });
696696
$('.dx-dialog-buttons .dx-button').eq(0).trigger('dxclick');
@@ -712,7 +712,7 @@ if(isDesktopEnvironment()) {
712712
const form = scheduler.instance.getAppointmentDetailsForm();
713713

714714
assert.ok(!form.getEditor(null), 'Editor is not rendered');
715-
assert.equal(scheduler.instance._appointmentPopup.popup.option('maxWidth'), APPOINTMENT_POPUP_WIDTH);
715+
assert.equal(scheduler.instance.appointmentPopup.popup.option('maxWidth'), APPOINTMENT_POPUP_WIDTH);
716716
assert.equal(form.option('items')[0].colSpan, 2, 'colSpan of main group');
717717

718718
scheduler.instance.option('recurrenceRuleExpr', 'recurrenceRule');
@@ -737,7 +737,7 @@ if(isDesktopEnvironment()) {
737737
const form = scheduler.instance.getAppointmentDetailsForm();
738738

739739
assert.ok(!form.getEditor(null), 'Editor is not rendered');
740-
assert.equal(scheduler.instance._appointmentPopup.popup.option('maxWidth'), APPOINTMENT_POPUP_WIDTH);
740+
assert.equal(scheduler.instance.appointmentPopup.popup.option('maxWidth'), APPOINTMENT_POPUP_WIDTH);
741741
assert.equal(form.option('items')[0].colSpan, 2, 'colSpan of main group');
742742
});
743743

@@ -769,7 +769,7 @@ QUnit.module('Appointment Popup Content', moduleOptions, () => {
769769

770770
scheduler.instance.showAppointmentPopup({ startDate: new Date(2015, 1, 1), endDate: new Date(2015, 1, 2) });
771771

772-
const appointmentPopupOptions = scheduler.instance._appointmentPopup.popup.option();
772+
const appointmentPopupOptions = scheduler.instance.appointmentPopup.popup.option();
773773

774774
assert.strictEqual(appointmentPopupOptions.enableBodyScroll, false, 'enable body scroll');
775775
assert.strictEqual(appointmentPopupOptions.preventScrollEvents, false, 'prevent scroll events');
@@ -885,7 +885,7 @@ QUnit.module('Appointment Popup Content', moduleOptions, () => {
885885

886886
scheduler.instance.showAppointmentPopup({ startDate: new Date(2015, 1, 1), endDate: new Date(2015, 1, 2), text: 'appointment 1' });
887887

888-
const popup = scheduler.instance._appointmentPopup.popup;
888+
const popup = scheduler.instance.appointmentPopup.popup;
889889

890890
assert.equal(popup.option('height'), 'auto', 'popup has correct height');
891891
assert.equal(popup.option('maxHeight'), '100%', 'popup has correct max-height');
@@ -896,7 +896,7 @@ QUnit.module('Appointment Popup Content', moduleOptions, () => {
896896

897897
scheduler.instance.showAppointmentPopup({ startDate: new Date(2015, 1, 1), endDate: new Date(2015, 1, 2), text: 'appointment 1' });
898898

899-
const popup = scheduler.instance._appointmentPopup.popup;
899+
const popup = scheduler.instance.appointmentPopup.popup;
900900
let contentReadyCalled = 0;
901901

902902
popup.option('onContentReady', function() {
@@ -1392,7 +1392,7 @@ QUnit.module('Appointment Popup Content', moduleOptions, () => {
13921392
QUnit.test('Done button default configuration should be correct', async function(assert) {
13931393
const scheduler = await createInstance({
13941394
onAppointmentFormOpening: function(e) {
1395-
const popup = e.component._appointmentPopup.popup;
1395+
const popup = e.component.appointmentPopup.popup;
13961396
const buttons = popup.option('toolbarItems');
13971397
const doneButton = buttons[0];
13981398

@@ -1414,7 +1414,7 @@ QUnit.module('Appointment Popup Content', moduleOptions, () => {
14141414
store: this.tasks
14151415
}),
14161416
onAppointmentFormOpening: function(e) {
1417-
const popup = e.component._appointmentPopup.popup;
1417+
const popup = e.component.appointmentPopup.popup;
14181418
const buttons = popup.option('toolbarItems');
14191419
buttons[0].options = { text: 'Text 1' };
14201420
popup.option('toolbarItems', buttons);
@@ -1555,7 +1555,7 @@ QUnit.module('Appointment Popup', moduleOptions, () => {
15551555
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,TH;COUNT=10'
15561556
});
15571557

1558-
const popup = scheduler.instance._appointmentPopup.popup;
1558+
const popup = scheduler.instance.appointmentPopup.popup;
15591559
const $buttonGroup = $(popup.$content()).find('.dx-buttongroup');
15601560

15611561
assert.deepEqual($buttonGroup.eq(0).dxButtonGroup('instance').option('selectedItemKeys'), ['MO', 'TH'], 'Right buttons was checked');

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,16 +685,16 @@ QUnit.module('Events', {
685685

686686
assert.equal(contentReadyFiresCount, 1, 'contentReadyFiresCount === 1');
687687

688-
scheduler.instance._workSpaceRecalculation = new Deferred();
688+
scheduler.instance.workSpaceRecalculation = new Deferred();
689689
scheduler.instance._fireContentReadyAction();
690690

691691
assert.equal(contentReadyFiresCount, 1, 'contentReadyFiresCount === 1');
692692

693-
scheduler.instance._workSpaceRecalculation.resolve();
693+
scheduler.instance.workSpaceRecalculation.resolve();
694694

695695
assert.equal(contentReadyFiresCount, 2, 'contentReadyFiresCount === 2');
696696

697-
scheduler.instance._workSpaceRecalculation = null;
697+
scheduler.instance.workSpaceRecalculation = null;
698698
scheduler.instance._fireContentReadyAction();
699699

700700
assert.equal(contentReadyFiresCount, 3, 'contentReadyFiresCount === 3');

0 commit comments

Comments
 (0)