diff --git a/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts b/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts index 7d7b4a787f75..9e1eb3c496cc 100644 --- a/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts +++ b/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts @@ -10,9 +10,9 @@ import type { AppointmentViewModelPlain } from './view_model/types'; const APPOINTMENT_ITEM_CLASS = 'dx-scheduler-appointment'; export default class AppointmentDragBehavior { - workspace = this.scheduler._workSpace; + workspace = this.scheduler.workSpace; - appointments = this.scheduler._appointments; + appointments = this.scheduler.appointments; initialPosition = { left: 0, @@ -96,7 +96,7 @@ export default class AppointmentDragBehavior { e.itemData = this.getItemData(e.itemElement); e.itemSettings = this.getItemSettings(e.itemElement); - if (this.scheduler._isAppointmentBeingUpdated(e.itemData)) { + if (this.scheduler.isAppointmentBeingUpdated(e.itemData)) { e.cancel = true; return; } @@ -116,7 +116,7 @@ export default class AppointmentDragBehavior { return; } - if (this.scheduler._isAppointmentBeingUpdated(this.appointmentInfo.appointment)) { + if (this.scheduler.isAppointmentBeingUpdated(this.appointmentInfo.appointment)) { e.cancel = true; return; } @@ -156,7 +156,7 @@ export default class AppointmentDragBehavior { } if (e.cancel !== true && isSchedulerComponent(e.toComponent)) { - const targetDragBehavior = e.toComponent._getDragBehavior(); + const targetDragBehavior = e.toComponent.getDragBehavior(); // @ts-expect-error targetDragBehavior.dragBetweenComponentsPromise = new Deferred(); } diff --git a/packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts b/packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts index ddacd7b40dd9..936653eb57f2 100644 --- a/packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts +++ b/packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts @@ -65,7 +65,8 @@ export class CompactAppointmentsHelper { _clickEvent(onAppointmentClick) { return (e) => { - const clickEventArgs = this.instance._createEventArgs(e); + // @ts-expect-error - TODO: architectural debt — CompactAppointmentsHelper directly accesses private Scheduler.createEventArgs + const clickEventArgs = this.instance.createEventArgs(e); onAppointmentClick(clickEventArgs); }; } @@ -164,7 +165,8 @@ export class CompactAppointmentsHelper { _createTemplate(count, isCompact) { this._initButtonTemplate(count, isCompact); - return this.instance._getAppointmentTemplate('appointmentCollectorTemplate'); + // @ts-expect-error - TODO: architectural debt — CompactAppointmentsHelper directly accesses private Scheduler.getAppointmentTemplate + return this.instance.getAppointmentTemplate('appointmentCollectorTemplate'); } _initButtonTemplate(count, isCompact) { diff --git a/packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts b/packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts index 63ba04cc0d99..501339c94bfb 100644 --- a/packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts +++ b/packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts @@ -73,38 +73,38 @@ const days = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']; const getStylingModeFunc = (): string | undefined => (isFluent(current()) ? 'filled' : undefined); class RecurrenceRule { - _recurrenceRule: any; + private recurrenceRule: any; constructor(rule) { - this._recurrenceRule = parseRecurrenceRule(rule); + this.recurrenceRule = parseRecurrenceRule(rule); } makeRules(string) { - this._recurrenceRule = parseRecurrenceRule(string); + this.recurrenceRule = parseRecurrenceRule(string); } makeRule(field, value) { if (!value || (Array.isArray(value) && !value.length)) { // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete this._recurrenceRule[field]; + delete this.recurrenceRule[field]; return; } if (isDefined(field)) { if (field === 'until') { - delete this._recurrenceRule.count; + delete this.recurrenceRule.count; } if (field === 'count') { - delete this._recurrenceRule.until; + delete this.recurrenceRule.until; } - this._recurrenceRule[field] = value; + this.recurrenceRule[field] = value; } } getRepeatEndRule() { - const rules = this._recurrenceRule; + const rules = this.recurrenceRule; if ('count' in rules) { return 'count'; @@ -118,30 +118,30 @@ class RecurrenceRule { } getRecurrenceString() { - return getRecurrenceString(this._recurrenceRule); + return getRecurrenceString(this.recurrenceRule); } getRules() { - return this._recurrenceRule; + return this.recurrenceRule; } getDaysFromByDayRule() { - return daysFromByDayRule(this._recurrenceRule); + return daysFromByDayRule(this.recurrenceRule); } } class RecurrenceEditor extends Editor { - _recurrenceRule!: RecurrenceRule; + private recurrenceRule!: RecurrenceRule; - _$container: any; + private $container: any; - _weekEditor: any; + private weekEditor: any; - _editors!: any[]; + private editors!: any[]; - _$repeatOnWeek: any; + private $repeatOnWeek: any; - _recurrenceForm: any; + private recurrenceForm: any; _getDefaultOptions() { // @ts-expect-error @@ -156,12 +156,12 @@ class RecurrenceEditor extends Editor { }); } - _getFirstDayOfWeek() { + private getFirstDayOfWeek() { const firstDayOfWeek = this.option('firstDayOfWeek'); return isDefined(firstDayOfWeek) ? firstDayOfWeek : dateLocalization.firstDayOfWeekIndex(); } - _createComponent(element, name, config = {}) { + private createComponent(element, name, config = {}) { // @ts-expect-error this._extendConfig(config, { readOnly: this.option('readOnly'), @@ -174,7 +174,7 @@ class RecurrenceEditor extends Editor { _init() { // @ts-expect-error super._init(); - this._recurrenceRule = new RecurrenceRule(this.option('value')); + this.recurrenceRule = new RecurrenceRule(this.option('value')); } _render() { @@ -183,13 +183,13 @@ class RecurrenceEditor extends Editor { (this.$element() as any).addClass(RECURRENCE_EDITOR); - this._$container = $('
') + this.$container = $('
') .addClass(RECURRENCE_EDITOR_CONTAINER) .appendTo(this.$element()); - this._prepareEditors(); - this._renderEditors(this._$container); - this._updateRepeatInputAriaLabel(); + this.prepareEditors(); + this.renderEditors(this.$container); + this.updateRepeatInputAriaLabel(); } getEditorByField(fieldName) { @@ -198,7 +198,7 @@ class RecurrenceEditor extends Editor { if (!isDefined(editor)) { switch (fieldName) { case 'byday': - editor = this._weekEditor; + editor = this.weekEditor; break; default: break; @@ -208,31 +208,31 @@ class RecurrenceEditor extends Editor { return editor; } - _prepareEditors() { - const freq = (this._recurrenceRule.getRules().freq || frequenciesMessages[defaultRecurrenceTypeIndex].value).toLowerCase(); + private prepareEditors() { + const freq = (this.recurrenceRule.getRules().freq || frequenciesMessages[defaultRecurrenceTypeIndex].value).toLowerCase(); - this._editors = [ - this._createFreqEditor(freq), - this._createIntervalEditor(freq), - this._createRepeatOnLabel(freq), + this.editors = [ + this.createFreqEditor(freq), + this.createIntervalEditor(freq), + this.createRepeatOnLabel(freq), { itemType: 'group', cssClass: REPEAT_ON_EDITOR, colCount: 2, colCountByScreen: { xs: 2 }, - items: this._createRepeatOnEditor(freq), + items: this.createRepeatOnEditor(freq), }, { itemType: 'group', colCount: 2, - items: this._createRepeatEndEditor(), + items: this.createRepeatEndEditor(), }, ]; - return this._editors; + return this.editors; } - _createFreqEditor(freq) { + private createFreqEditor(freq) { return { dataField: 'freq', name: 'FREQ', @@ -249,7 +249,7 @@ class RecurrenceEditor extends Editor { elementAttr: { class: FREQUENCY_EDITOR, }, - onValueChanged: (args) => this._valueChangedHandler(args), + onValueChanged: (args) => this.valueChangedHandler(args), }, label: { text: messageLocalization.format('dxScheduler-editorLabelRecurrence'), @@ -257,8 +257,8 @@ class RecurrenceEditor extends Editor { }; } - _createIntervalEditor(freq) { - const interval = this._recurrenceRule.getRules().interval || 1; + private createIntervalEditor(freq) { + const interval = this.recurrenceRule.getRules().interval || 1; return { itemType: 'group', colCount: 2, @@ -280,7 +280,7 @@ class RecurrenceEditor extends Editor { elementAttr: { class: INTERVAL_EDITOR, }, - onValueChanged: (args) => this._valueChangedHandler(args), + onValueChanged: (args) => this.valueChangedHandler(args), }, label: { text: messageLocalization.format('dxScheduler-recurrenceRepeatEvery'), @@ -295,7 +295,7 @@ class RecurrenceEditor extends Editor { }; } - _createRepeatOnLabel(freq) { + private createRepeatOnLabel(freq) { return { itemType: 'group', cssClass: `${REPEAT_ON_EDITOR}${LABEL_POSTFIX}`, @@ -310,30 +310,30 @@ class RecurrenceEditor extends Editor { }; } - _createRepeatOnEditor(freq) { + private createRepeatOnEditor(freq) { return [ - this._createByDayEditor(freq), - this._createByMonthEditor(freq), - this._createByMonthDayEditor(freq), + this.createByDayEditor(freq), + this.createByMonthEditor(freq), + this.createByMonthDayEditor(freq), ]; } - _createByDayEditor(freq) { + private createByDayEditor(freq) { return { dataField: 'byday', colSpan: 2, template: (_, itemElement) => { - const firstDayOfWeek = this._getFirstDayOfWeek() as any; - const byDay = this._daysOfWeekByRules(); + const firstDayOfWeek = this.getFirstDayOfWeek() as any; + const byDay = this.daysOfWeekByRules(); const localDaysNames = dateLocalization.getDayNames('abbreviated'); const dayNames = days.slice(firstDayOfWeek).concat(days.slice(0, firstDayOfWeek)); const itemsButtonGroup = localDaysNames.slice(firstDayOfWeek).concat(localDaysNames.slice(0, firstDayOfWeek)).map((item, index) => ({ text: item, key: dayNames[index] })); - this._$repeatOnWeek = $('
').addClass(RECURRENCE_BUTTON_GROUP).appendTo(itemElement); + this.$repeatOnWeek = $('
').addClass(RECURRENCE_BUTTON_GROUP).appendTo(itemElement); - this._weekEditor = this._createComponent(this._$repeatOnWeek, ButtonGroup, { + this.weekEditor = this.createComponent(this.$repeatOnWeek, ButtonGroup, { items: itemsButtonGroup, field: 'byday', selectionMode: 'multiple', @@ -343,10 +343,10 @@ class RecurrenceEditor extends Editor { const selectedItemKeys = e.component.option('selectedItemKeys'); const selectedKeys = selectedItemKeys?.length ? selectedItemKeys - : this._getDefaultByDayValue(); + : this.getDefaultByDayValue(); - this._recurrenceRule.makeRule('byday', selectedKeys); - this._changeEditorValue(); + this.recurrenceRule.makeRule('byday', selectedKeys); + this.changeEditorValue(); }, }); }, @@ -357,7 +357,7 @@ class RecurrenceEditor extends Editor { }; } - _createByMonthEditor(freq) { + private createByMonthEditor(freq) { const monthsName = (dateLocalization.getMonthNames as any)('wide'); const months = [...Array(12)].map((_, i) => ({ value: `${i + 1}`, text: monthsName[i] })); @@ -368,14 +368,14 @@ class RecurrenceEditor extends Editor { stylingMode: getStylingModeFunc(), field: 'bymonth', items: months, - value: this._monthOfYearByRules(), + value: this.monthOfYearByRules(), width: recurrentEditorSelectBoxWidth, displayExpr: 'text', valueExpr: 'value', elementAttr: { class: MONTH_OF_YEAR, }, - onValueChanged: (args) => this._valueChangedHandler(args), + onValueChanged: (args) => this.valueChangedHandler(args), }, visible: freq === 'yearly', label: { @@ -384,7 +384,7 @@ class RecurrenceEditor extends Editor { }; } - _createByMonthDayEditor(freq) { + private createByMonthDayEditor(freq) { return { dataField: 'bymonthday', editorType: 'dxNumberBox', @@ -397,11 +397,11 @@ class RecurrenceEditor extends Editor { field: 'bymonthday', showSpinButtons: true, useLargeSpinButtons: false, - value: this._dayOfMonthByRules(), + value: this.dayOfMonthByRules(), elementAttr: { class: DAY_OF_MONTH, }, - onValueChanged: (args) => this._valueChangedHandler(args), + onValueChanged: (args) => this.valueChangedHandler(args), }, visible: freq === 'monthly' || freq === 'yearly', label: { @@ -410,8 +410,8 @@ class RecurrenceEditor extends Editor { }; } - _createRepeatEndEditor() { - const repeatType = this._recurrenceRule.getRepeatEndRule(); + private createRepeatEndEditor() { + const repeatType = this.recurrenceRule.getRepeatEndRule(); return [{ colSpan: 2, @@ -438,71 +438,71 @@ class RecurrenceEditor extends Editor { }, layout: 'vertical', elementAttr: { class: REPEAT_END_TYPE_EDITOR }, - onValueChanged: (args) => this._repeatEndValueChangedHandler(args), + onValueChanged: (args) => this.repeatEndValueChangedHandler(args), }, }, { colSpan: 1, itemType: 'group', items: [ - this._getRepeatUntilEditorOptions(), - this._getRepeatCountEditorOptions(), + this.getRepeatUntilEditorOptions(), + this.getRepeatCountEditorOptions(), ], }]; } - _renderEditors($container) { - this._recurrenceForm = this._createComponent($container, Form, { - items: this._editors, + private renderEditors($container) { + this.recurrenceForm = this.createComponent($container, Form, { + items: this.editors, showValidationSummary: false, scrollingEnabled: true, showColonAfterLabel: false, labelLocation: 'top', }); - this._changeRepeatEndInputsVisibility(); + this.changeRepeatEndInputsVisibility(); } getRecurrenceForm() { - return this._recurrenceForm; + return this.recurrenceForm; } changeValueByVisibility(value) { if (value) { if (!this.option('value')) { - this._handleDefaults(); + this.handleDefaults(); } } else { - this._recurrenceRule.makeRules(''); + this.recurrenceRule.makeRules(''); this.option('value', ''); } } - _handleDefaults() { - this._recurrenceRule.makeRule('freq', frequenciesMessages[defaultRecurrenceTypeIndex].value); - this._changeEditorValue(); + private handleDefaults() { + this.recurrenceRule.makeRule('freq', frequenciesMessages[defaultRecurrenceTypeIndex].value); + this.changeEditorValue(); } - _changeEditorValue() { - this.option('value', this._recurrenceRule.getRecurrenceString() ?? ''); + private changeEditorValue() { + this.option('value', this.recurrenceRule.getRecurrenceString() ?? ''); } - _daysOfWeekByRules() { - let daysByRule = this._recurrenceRule.getDaysFromByDayRule(); + private daysOfWeekByRules() { + let daysByRule = this.recurrenceRule.getDaysFromByDayRule(); if (!daysByRule.length) { - daysByRule = this._getDefaultByDayValue(); + daysByRule = this.getDefaultByDayValue(); } return daysByRule; } - _getDefaultByDayValue() { + private getDefaultByDayValue() { const startDate = this.option('startDate') as any; const startDay = startDate.getDay(); return [days[startDay]]; } - _dayOfMonthByRules() { - let dayByRule = this._recurrenceRule.getRules().bymonthday; + private dayOfMonthByRules() { + let dayByRule = this.recurrenceRule.getRules().bymonthday; if (!dayByRule) { dayByRule = (this.option('startDate') as any).getDate(); @@ -511,8 +511,8 @@ class RecurrenceEditor extends Editor { return dayByRule; } - _monthOfYearByRules() { - let monthByRule = this._recurrenceRule.getRules().bymonth; + private monthOfYearByRules() { + let monthByRule = this.recurrenceRule.getRules().bymonth; if (!monthByRule) { monthByRule = (this.option('startDate') as any).getMonth() + 1; @@ -521,43 +521,43 @@ class RecurrenceEditor extends Editor { return String(monthByRule); } - _repeatEndValueChangedHandler(args) { + private repeatEndValueChangedHandler(args) { const { value } = args; - this._changeRepeatEndInputsVisibility(value); + this.changeRepeatEndInputsVisibility(value); if (value === 'until') { - this._recurrenceRule.makeRule(value, this._getUntilValue()); + this.recurrenceRule.makeRule(value, this.getUntilValue()); } if (value === 'count') { - this._recurrenceRule.makeRule(value, this._recurrenceForm.option('formData.count')); + this.recurrenceRule.makeRule(value, this.recurrenceForm.option('formData.count')); } if (value === 'never') { - this._recurrenceRule.makeRule('count', ''); - this._recurrenceRule.makeRule('until', ''); + this.recurrenceRule.makeRule('count', ''); + this.recurrenceRule.makeRule('until', ''); } - this._changeEditorValue(); - this._updateRepeatInputAriaLabel(); + this.changeEditorValue(); + this.updateRepeatInputAriaLabel(); } - _changeRepeatEndInputsVisibility(value = this._recurrenceRule.getRepeatEndRule()) { + private changeRepeatEndInputsVisibility(value = this.recurrenceRule.getRepeatEndRule()) { if (value === 'until') { - this._recurrenceForm.itemOption('until', 'visible', true); - this._recurrenceForm.itemOption('count', 'visible', false); + this.recurrenceForm.itemOption('until', 'visible', true); + this.recurrenceForm.itemOption('count', 'visible', false); } if (value === 'count') { - this._recurrenceForm.itemOption('until', 'visible', false); - this._recurrenceForm.itemOption('count', 'visible', true); + this.recurrenceForm.itemOption('until', 'visible', false); + this.recurrenceForm.itemOption('count', 'visible', true); } if (value === 'never') { - this._recurrenceForm.itemOption('until', 'visible', false); - this._recurrenceForm.itemOption('count', 'visible', false); + this.recurrenceForm.itemOption('until', 'visible', false); + this.recurrenceForm.itemOption('count', 'visible', false); } } - _getRepeatCountEditorOptions() { - const count = this._recurrenceRule.getRules().count || 1; + private getRepeatCountEditorOptions() { + const count = this.recurrenceRule.getRules().count || 1; return { dataField: 'count', @@ -573,39 +573,39 @@ class RecurrenceEditor extends Editor { showSpinButtons: true, useLargeSpinButtons: false, value: count, - onValueChanged: this._repeatCountValueChangeHandler.bind(this), + onValueChanged: this.repeatCountValueChangeHandler.bind(this), inputAttr: { 'aria-label': messageLocalization.format('dxScheduler-recurrenceOccurrenceLabel') }, }, }; } - _updateRepeatInputAriaLabel(): void { + private updateRepeatInputAriaLabel(): void { const radioButtons = this.getEditorByField('repeatEnd').itemElements(); const untilLabel = messageLocalization.format('dxScheduler-recurrenceOn'); - const untilValue = this._recurrenceForm.getEditor('until').option('value'); + const untilValue = this.recurrenceForm.getEditor('until').option('value'); const untilValueFormat = `${dateLocalization.format(untilValue, 'd')} ${dateLocalization.format(untilValue, 'monthAndYear')}`; - const isUntilVisible = this._recurrenceForm.itemOption('until').visible; + const isUntilVisible = this.recurrenceForm.itemOption('until').visible; const countLabel = messageLocalization.format('dxScheduler-recurrenceAfter'); const countPostfix = messageLocalization.format('dxScheduler-recurrenceRepeatCount'); - const countValue = this._recurrenceForm.getEditor('count').option('value'); - const isCountVisible = this._recurrenceForm.itemOption('count').visible; + const countValue = this.recurrenceForm.getEditor('count').option('value'); + const isCountVisible = this.recurrenceForm.itemOption('count').visible; radioButtons[1].setAttribute('aria-label', isUntilVisible ? `${untilLabel} ${untilValueFormat}` : untilLabel); radioButtons[2].setAttribute('aria-label', isCountVisible ? `${countLabel} ${countValue} ${countPostfix}` : countLabel); } - _repeatCountValueChangeHandler(args) { - if (this._recurrenceRule.getRepeatEndRule() === 'count') { + private repeatCountValueChangeHandler(args) { + if (this.recurrenceRule.getRepeatEndRule() === 'count') { const { value } = args; - this._recurrenceRule.makeRule('count', value); - this._changeEditorValue(); - this._updateRepeatInputAriaLabel(); + this.recurrenceRule.makeRule('count', value); + this.changeEditorValue(); + this.updateRepeatInputAriaLabel(); } } - _getRepeatUntilEditorOptions() { - const until = this._getUntilValue(); + private getRepeatUntilEditorOptions() { + const until = this.getUntilValue(); return { dataField: 'until', @@ -618,9 +618,9 @@ class RecurrenceEditor extends Editor { value: until, type: 'date', width: repeatInputWidth, - onValueChanged: this._repeatUntilValueChangeHandler.bind(this), + onValueChanged: this.repeatUntilValueChangeHandler.bind(this), calendarOptions: { - firstDayOfWeek: this._getFirstDayOfWeek(), + firstDayOfWeek: this.getFirstDayOfWeek(), }, useMaskBehavior: true, inputAttr: { 'aria-label': messageLocalization.format('dxScheduler-recurrenceUntilDateLabel') }, @@ -628,8 +628,8 @@ class RecurrenceEditor extends Editor { }; } - _formatUntilDate(date: Date): Date { - const untilDate = this._recurrenceRule.getRules().until; + private formatUntilDate(date: Date): Date { + const untilDate = this.recurrenceRule.getRules().until; const isSameDate = dateUtils.sameDate(untilDate, date); return untilDate && isSameDate @@ -637,9 +637,9 @@ class RecurrenceEditor extends Editor { : dateUtils.setToDayEnd(date); } - _repeatUntilValueChangeHandler(args) { - if (this._recurrenceRule.getRepeatEndRule() === 'until') { - const dateInTimeZone = this._formatUntilDate(new Date(args.value)); + private repeatUntilValueChangeHandler(args) { + if (this.recurrenceRule.getRepeatEndRule() === 'until') { + const dateInTimeZone = this.formatUntilDate(new Date(args.value)); const getStartDateTimeZone: any = this.option('getStartDateTimeZone'); const appointmentTimeZone = getStartDateTimeZone(); @@ -647,90 +647,90 @@ class RecurrenceEditor extends Editor { const dateInLocaleTimeZone = (this.option('timeZoneCalculator') as any) .createDate(dateInTimeZone, path, appointmentTimeZone); - this._recurrenceRule.makeRule('until', dateInLocaleTimeZone); - this._changeEditorValue(); - this._updateRepeatInputAriaLabel(); + this.recurrenceRule.makeRule('until', dateInLocaleTimeZone); + this.changeEditorValue(); + this.updateRepeatInputAriaLabel(); } } - _valueChangedHandler(args) { + private valueChangedHandler(args) { const { value, previousValue } = args; const field = args.component.option('field'); if (!this.option('visible')) { this.option('value', ''); } else { - this._recurrenceRule.makeRule(field, value); + this.recurrenceRule.makeRule(field, value); if (field === 'freq') { - this._makeRepeatOnRule(value); - this._changeRepeatOnVisibility(value, previousValue); + this.makeRepeatOnRule(value); + this.changeRepeatOnVisibility(value, previousValue); } - this._changeEditorValue(); + this.changeEditorValue(); } } - _makeRepeatOnRule(value) { + private makeRepeatOnRule(value) { if (value === 'daily' || value === 'hourly') { - this._recurrenceRule.makeRule('byday', ''); - this._recurrenceRule.makeRule('bymonth', ''); - this._recurrenceRule.makeRule('bymonthday', ''); + this.recurrenceRule.makeRule('byday', ''); + this.recurrenceRule.makeRule('bymonth', ''); + this.recurrenceRule.makeRule('bymonthday', ''); } if (value === 'weekly') { - this._recurrenceRule.makeRule('byday', this._daysOfWeekByRules()); - this._recurrenceRule.makeRule('bymonth', ''); - this._recurrenceRule.makeRule('bymonthday', ''); + this.recurrenceRule.makeRule('byday', this.daysOfWeekByRules()); + this.recurrenceRule.makeRule('bymonth', ''); + this.recurrenceRule.makeRule('bymonthday', ''); } if (value === 'monthly') { - this._recurrenceRule.makeRule('bymonthday', this._dayOfMonthByRules()); - this._recurrenceRule.makeRule('bymonth', ''); - this._recurrenceRule.makeRule('byday', ''); + this.recurrenceRule.makeRule('bymonthday', this.dayOfMonthByRules()); + this.recurrenceRule.makeRule('bymonth', ''); + this.recurrenceRule.makeRule('byday', ''); } if (value === 'yearly') { - this._recurrenceRule.makeRule('bymonthday', this._dayOfMonthByRules()); - this._recurrenceRule.makeRule('bymonth', this._monthOfYearByRules()); - this._recurrenceRule.makeRule('byday', ''); + this.recurrenceRule.makeRule('bymonthday', this.dayOfMonthByRules()); + this.recurrenceRule.makeRule('bymonth', this.monthOfYearByRules()); + this.recurrenceRule.makeRule('byday', ''); } } _optionChanged(args) { switch (args.name) { case 'readOnly': - this._recurrenceForm?.option('readOnly', args.value); - this._weekEditor?.option('readOnly', args.value); + this.recurrenceForm?.option('readOnly', args.value); + this.weekEditor?.option('readOnly', args.value); // @ts-expect-error super._optionChanged(args); break; case 'value': - this._recurrenceRule.makeRules(args.value); + this.recurrenceRule.makeRules(args.value); - this._changeRepeatIntervalLabel(); - this._changeRepeatEndInputsVisibility(); - this._changeEditorsValue(this._recurrenceRule.getRules()); + this.changeRepeatIntervalLabel(); + this.changeRepeatEndInputsVisibility(); + this.changeEditorsValue(this.recurrenceRule.getRules()); // @ts-expect-error super._optionChanged(args); break; case 'startDate': - this._makeRepeatOnRule(this._recurrenceRule.getRules().freq); + this.makeRepeatOnRule(this.recurrenceRule.getRules().freq); - if (isDefined(this._recurrenceRule.getRecurrenceString())) { - this._changeEditorValue(); + if (isDefined(this.recurrenceRule.getRecurrenceString())) { + this.changeEditorValue(); } break; case 'firstDayOfWeek': - if (this._weekEditor) { + if (this.weekEditor) { const localDaysNames = dateLocalization.getDayNames('abbreviated'); const dayNames = days.slice(args.value).concat(days.slice(0, args.value)); const itemsButtonGroup = localDaysNames.slice(args.value).concat(localDaysNames.slice(0, args.value)).map((item, index) => ({ text: item, key: dayNames[index] })); - this._weekEditor.option('items', itemsButtonGroup); + this.weekEditor.option('items', itemsButtonGroup); } - if (this._recurrenceForm.itemOption('until').visible) { - this._recurrenceForm.getEditor('until').option('calendarOptions.firstDayOfWeek', this._getFirstDayOfWeek()); + if (this.recurrenceForm.itemOption('until').visible) { + this.recurrenceForm.getEditor('until').option('calendarOptions.firstDayOfWeek', this.getFirstDayOfWeek()); } break; default: @@ -739,95 +739,95 @@ class RecurrenceEditor extends Editor { } } - _changeRepeatOnVisibility(freq, previousFreq) { + private changeRepeatOnVisibility(freq, previousFreq) { if (freq !== previousFreq) { - this._recurrenceForm.itemOption('byday', 'visible', false); - this._recurrenceForm.itemOption('bymonthday', 'visible', false); - this._recurrenceForm.itemOption('bymonth', 'visible', false); + this.recurrenceForm.itemOption('byday', 'visible', false); + this.recurrenceForm.itemOption('bymonthday', 'visible', false); + this.recurrenceForm.itemOption('bymonth', 'visible', false); - this._recurrenceForm.itemOption('repeatOnLabel', 'visible', freq && freq !== 'daily' && freq !== 'hourly'); + this.recurrenceForm.itemOption('repeatOnLabel', 'visible', freq && freq !== 'daily' && freq !== 'hourly'); if (freq === 'weekly') { - this._recurrenceForm.itemOption('byday', 'visible', true); + this.recurrenceForm.itemOption('byday', 'visible', true); } if (freq === 'monthly') { - this._recurrenceForm.itemOption('bymonthday', 'visible', true); + this.recurrenceForm.itemOption('bymonthday', 'visible', true); } if (freq === 'yearly') { - this._recurrenceForm.itemOption('bymonthday', 'visible', true); - this._recurrenceForm.itemOption('bymonth', 'visible', true); + this.recurrenceForm.itemOption('bymonthday', 'visible', true); + this.recurrenceForm.itemOption('bymonth', 'visible', true); } } } - _changeRepeatIntervalLabel() { - const { freq } = this._recurrenceRule.getRules(); + private changeRepeatIntervalLabel() { + const { freq } = this.recurrenceRule.getRules(); - freq && this._recurrenceForm.itemOption('intervalLabel', 'template', messageLocalization.format(`dxScheduler-recurrenceRepeat${freq.charAt(0).toUpperCase()}${freq.substr(1).toLowerCase()}`)); + freq && this.recurrenceForm.itemOption('intervalLabel', 'template', messageLocalization.format(`dxScheduler-recurrenceRepeat${freq.charAt(0).toUpperCase()}${freq.substr(1).toLowerCase()}`)); } - _changeEditorsValue(rules) { - this._recurrenceForm.getEditor('freq').option('value', (rules.freq || frequenciesMessages[defaultRecurrenceTypeIndex].value).toLowerCase()); + private changeEditorsValue(rules) { + this.recurrenceForm.getEditor('freq').option('value', (rules.freq || frequenciesMessages[defaultRecurrenceTypeIndex].value).toLowerCase()); - this._changeDayOfWeekValue(); - this._changeDayOfMonthValue(); - this._changeMonthOfYearValue(); + this.changeDayOfWeekValue(); + this.changeDayOfMonthValue(); + this.changeMonthOfYearValue(); - this._changeIntervalValue(rules.interval); + this.changeIntervalValue(rules.interval); - this._changeRepeatCountValue(); - this._changeRepeatEndValue(); - this._changeRepeatUntilValue(); + this.changeRepeatCountValue(); + this.changeRepeatEndValue(); + this.changeRepeatUntilValue(); } - _changeIntervalValue(value) { - this._recurrenceForm.getEditor('interval').option('value', value || 1); + private changeIntervalValue(value) { + this.recurrenceForm.getEditor('interval').option('value', value || 1); } - _changeRepeatEndValue() { - const repeatType = this._recurrenceRule.getRepeatEndRule(); + private changeRepeatEndValue() { + const repeatType = this.recurrenceRule.getRepeatEndRule(); - this._recurrenceForm.getEditor('repeatEnd').option('value', repeatType); + this.recurrenceForm.getEditor('repeatEnd').option('value', repeatType); } - _changeDayOfWeekValue() { - const isEditorVisible = this._recurrenceForm.itemOption('byday').visible; + private changeDayOfWeekValue() { + const isEditorVisible = this.recurrenceForm.itemOption('byday').visible; if (isEditorVisible) { - const days = this._daysOfWeekByRules(); + const days = this.daysOfWeekByRules(); this.getEditorByField('byday').option('selectedItemKeys', days); } } - _changeDayOfMonthValue() { - const isEditorVisible = this._recurrenceForm.itemOption('bymonthday').visible; + private changeDayOfMonthValue() { + const isEditorVisible = this.recurrenceForm.itemOption('bymonthday').visible; if (isEditorVisible) { - const day = this._dayOfMonthByRules(); - this._recurrenceForm.getEditor('bymonthday').option('value', day); + const day = this.dayOfMonthByRules(); + this.recurrenceForm.getEditor('bymonthday').option('value', day); } } - _changeMonthOfYearValue() { - const isEditorVisible = this._recurrenceForm.itemOption('bymonth').visible; + private changeMonthOfYearValue() { + const isEditorVisible = this.recurrenceForm.itemOption('bymonth').visible; if (isEditorVisible) { - const month = this._monthOfYearByRules(); - this._recurrenceForm.getEditor('bymonth').option('value', month); + const month = this.monthOfYearByRules(); + this.recurrenceForm.getEditor('bymonth').option('value', month); } } - _changeRepeatCountValue() { - const count = this._recurrenceRule.getRules().count || 1; - this._recurrenceForm.getEditor('count').option('value', count); + private changeRepeatCountValue() { + const count = this.recurrenceRule.getRules().count || 1; + this.recurrenceForm.getEditor('count').option('value', count); } - _changeRepeatUntilValue() { - this._recurrenceForm.getEditor('until').option('value', this._getUntilValue()); + private changeRepeatUntilValue() { + this.recurrenceForm.getEditor('until').option('value', this.getUntilValue()); } - _getUntilValue() { - const untilDate = this._recurrenceRule.getRules().until; + private getUntilValue() { + const untilDate = this.recurrenceRule.getRules().until; if (!untilDate) { - return this._formatUntilDate(new Date()); + return this.formatUntilDate(new Date()); } const getStartDateTimeZone: any = this.option('getStartDateTimeZone'); diff --git a/packages/devextreme/js/__internal/scheduler/m_scheduler.ts b/packages/devextreme/js/__internal/scheduler/m_scheduler.ts index a703f844fd73..f099fef78807 100644 --- a/packages/devextreme/js/__internal/scheduler/m_scheduler.ts +++ b/packages/devextreme/js/__internal/scheduler/m_scheduler.ts @@ -163,67 +163,67 @@ const RECURRENCE_EDITING_MODE = { class Scheduler extends SchedulerOptionsBaseWidget { // NOTE: Do not initialize variables here, because `_initMarkup` function runs before constructor, // and initialization in constructor will erase the data - _timeZoneCalculator!: any; + private _timeZoneCalculator!: any; postponedOperations: any; - _a11yStatus!: dxElementWrapper; + private a11yStatus!: dxElementWrapper; - _workSpace: any; + private workSpace: any; - _header?: SchedulerHeader; + private header?: SchedulerHeader; - _appointments: any; + private appointments: any; appointmentDataSource!: AppointmentDataSource; _dataSource: any; - _dataAccessors!: AppointmentDataAccessor; + dataAccessors!: AppointmentDataAccessor; resourceManager!: ResourceManager; - _actions: any; + private actions: any; _createActionByOption: any; - _appointmentTooltip!: MobileTooltipStrategy | DesktopTooltipStrategy; + private appointmentTooltip!: MobileTooltipStrategy | DesktopTooltipStrategy; - _readyToRenderAppointments?: boolean; + private readyToRenderAppointments?: boolean; - _editing: any; + private editing: any; - _workSpaceRecalculation: any; + private workSpaceRecalculation: any; - _appointmentPopup: any; + private appointmentPopup: any; - _compactAppointmentsHelper!: CompactAppointmentsHelper; + private compactAppointmentsHelper!: CompactAppointmentsHelper; - _asyncTemplatesTimers!: any[]; + private asyncTemplatesTimers!: any[]; - _updatingAppointments: Set = new Set(); + private readonly updatingAppointments: Set = new Set(); - _dataSourceLoadedCallback: any; + private dataSourceLoadedCallback: any; - _subscribes: any; + private subscribes: any; - _notifyScheduler!: NotifyScheduler; + private notifyScheduler!: NotifyScheduler; - _recurrenceDialog: any; + private recurrenceDialog: any; - _layoutManager!: AppointmentLayoutManager; + private layoutManager!: AppointmentLayoutManager; - _appointmentForm: any; + private appointmentForm: any; - _mainContainer: any; + private mainContainer: any; - _all: any; + private readonly all: any; _options: any; - _editAppointmentData: any; + private editAppointmentData: any; - _timeZonesPromise!: Promise; + private timeZonesPromise!: Promise; get timeZoneCalculator() { if (!this._timeZoneCalculator) { @@ -233,11 +233,11 @@ class Scheduler extends SchedulerOptionsBaseWidget { return this._timeZoneCalculator; } - _postponeDataSourceLoading(promise?: any) { - this.postponedOperations.add('_reloadDataSource', this._reloadDataSource.bind(this), promise); + private postponeDataSourceLoading(promise?: any) { + this.postponedOperations.add('reloadDataSource', this.reloadDataSource.bind(this), promise); } - _postponeResourceLoading(forceReload = false) { + private postponeResourceLoading(forceReload = false) { const whenLoaded = this.postponedOperations.add('loadResources', () => { const groups = this.getViewOption('groups'); @@ -251,7 +251,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { resolveCallbacks.resolve(); }); - this._postponeDataSourceLoading(whenLoaded); + this.postponeDataSourceLoading(whenLoaded); return resolveCallbacks.promise(); } @@ -263,65 +263,65 @@ class Scheduler extends SchedulerOptionsBaseWidget { switch (args.name) { case 'customizeDateNavigatorText': - this._updateOption('header', name, value); + this.updateOption('header', name, value); break; case 'firstDayOfWeek': - this._updateOption('workSpace', name, value); - this._updateOption('header', name, value); - this._cleanPopup(); + this.updateOption('workSpace', name, value); + this.updateOption('header', name, value); + this.cleanPopup(); break; case 'currentDate': { const dateValue = this.getViewOption(name); this.option('selectedCellData', []); - this._updateOption('workSpace', name, dateValue); - this._updateOption('header', name, dateValue); - this._updateOption('header', 'startViewDate', this.getStartViewDate()); - this._appointments.option('items', []); - this._setRemoteFilterIfNeeded(); + this.updateOption('workSpace', name, dateValue); + this.updateOption('header', name, dateValue); + this.updateOption('header', 'startViewDate', this.getStartViewDate()); + this.appointments.option('items', []); + this.setRemoteFilterIfNeeded(); - this._postponeDataSourceLoading(); + this.postponeDataSourceLoading(); break; } case 'dataSource': // @ts-expect-error this._initDataSource(); - this._postponeResourceLoading().done(() => { + this.postponeResourceLoading().done(() => { this.appointmentDataSource.setDataSource(this._dataSource); - this._setRemoteFilterIfNeeded(); - this._updateOption('workSpace', 'showAllDayPanel', this.option('showAllDayPanel')); + this.setRemoteFilterIfNeeded(); + this.updateOption('workSpace', 'showAllDayPanel', this.option('showAllDayPanel')); }); break; case 'min': case 'max': { const value = this.getViewOption(name); - this._updateOption('header', name, value); - this._updateOption('workSpace', name, value); + this.updateOption('header', name, value); + this.updateOption('workSpace', name, value); break; } case 'views': if (this.currentView) { this.repaint(); } else { - this._updateOption('header', 'views', this.views); + this.updateOption('header', 'views', this.views); } break; case 'useDropDownViewSwitcher': - this._updateOption('header', name, value); + this.updateOption('header', name, value); break; case 'currentView': - this._appointments.option({ + this.appointments.option({ items: [], - allowDrag: this._allowDragging(), - allowResize: this._allowResizing(), - itemTemplate: this._getAppointmentTemplate('appointmentTemplate'), + allowDrag: this.allowDragging(), + allowResize: this.allowResizing(), + itemTemplate: this.getAppointmentTemplate('appointmentTemplate'), }); - this._postponeResourceLoading().done(() => { - this._refreshWorkSpace(); - this._header?.option(this._headerConfig()); - this._setRemoteFilterIfNeeded(); - this._appointments.option('allowAllDayResize', value !== 'day'); + this.postponeResourceLoading().done(() => { + this.refreshWorkSpace(); + this.header?.option(this.headerConfig()); + this.setRemoteFilterIfNeeded(); + this.appointments.option('allowAllDayResize', value !== 'day'); }); // NOTE: // Calling postponed operations (promises) here, because when we update options with @@ -330,7 +330,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { this.postponedOperations.callPostponedOperations(); break; case 'appointmentTemplate': - this._appointments.option('itemTemplate', value); + this.appointments.option('itemTemplate', value); break; case 'dateCellTemplate': case 'resourceCellTemplate': @@ -339,9 +339,9 @@ class Scheduler extends SchedulerOptionsBaseWidget { this.repaint(); break; case 'groups': - this._postponeResourceLoading().done(() => { - this._refreshWorkSpace(); - this._setRemoteFilterIfNeeded(); + this.postponeResourceLoading().done(() => { + this.refreshWorkSpace(); + this.setRemoteFilterIfNeeded(); }); break; case 'resources': @@ -349,35 +349,35 @@ class Scheduler extends SchedulerOptionsBaseWidget { this.resourceManager = new ResourceManager(this.option('resources')); this.updateAppointmentDataSource(); - this._postponeResourceLoading().done(() => { - this._appointments.option('items', []); - this._refreshWorkSpace(); - this._setRemoteFilterIfNeeded(); - this._createAppointmentPopupForm(); + this.postponeResourceLoading().done(() => { + this.appointments.option('items', []); + this.refreshWorkSpace(); + this.setRemoteFilterIfNeeded(); + this.createAppointmentPopupForm(); }); break; case 'startDayHour': case 'endDayHour': this.updateAppointmentDataSource(); - this._appointments.option('items', []); - this._updateOption('workSpace', name, value); - this._appointments.repaint(); - this._setRemoteFilterIfNeeded(); + this.appointments.option('items', []); + this.updateOption('workSpace', name, value); + this.appointments.repaint(); + this.setRemoteFilterIfNeeded(); - this._postponeDataSourceLoading(); + this.postponeDataSourceLoading(); break; // TODO Vinogradov refactoring: merge it with startDayHour / endDayHour case 'offset': this.updateAppointmentDataSource(); - this._appointments.option('items', []); - this._updateOption('workSpace', 'viewOffset', this.normalizeViewOffsetValue(value)); - this._appointments.repaint(); - this._setRemoteFilterIfNeeded(); + this.appointments.option('items', []); + this.updateOption('workSpace', 'viewOffset', this.normalizeViewOffsetValue(value)); + this.appointments.repaint(); + this.setRemoteFilterIfNeeded(); - this._postponeDataSourceLoading(); + this.postponeDataSourceLoading(); break; case StoreEventNames.ADDING: case StoreEventNames.ADDED: @@ -387,63 +387,63 @@ class Scheduler extends SchedulerOptionsBaseWidget { case StoreEventNames.DELETED: case 'onAppointmentFormOpening': case 'onAppointmentTooltipShowing': - this._actions[name] = this._createActionByOption(name); + this.actions[name] = this._createActionByOption(name); break; case 'onAppointmentRendered': - this._appointments.option('onItemRendered', this._getAppointmentRenderedAction()); + this.appointments.option('onItemRendered', this.getAppointmentRenderedAction()); break; case 'onAppointmentClick': - this._appointments.option('onItemClick', this._createActionByOption(name)); + this.appointments.option('onItemClick', this._createActionByOption(name)); break; case 'onAppointmentDblClick': - this._appointments.option(name, this._createActionByOption(name)); + this.appointments.option(name, this._createActionByOption(name)); break; case 'onAppointmentContextMenu': - this._appointments.option('onItemContextMenu', this._createActionByOption(name)); - this._appointmentTooltip._options.onItemContextMenu = this._createActionByOption(name); + this.appointments.option('onItemContextMenu', this._createActionByOption(name)); + this.appointmentTooltip._options.onItemContextMenu = this._createActionByOption(name); break; case 'noDataText': case 'allowMultipleCellSelection': case 'selectedCellData': case 'accessKey': case 'onCellClick': - this._updateOption('workSpace', name, value); + this.updateOption('workSpace', name, value); break; case 'onCellContextMenu': - this._updateOption('workSpace', name, value); + this.updateOption('workSpace', name, value); break; case 'crossScrollingEnabled': - this._postponeResourceLoading().done(() => { - this._appointments.option('items', []); - this._refreshWorkSpace(); - if (this._readyToRenderAppointments) { - this._appointments.option('items', this._layoutManager.generateViewModel()); + this.postponeResourceLoading().done(() => { + this.appointments.option('items', []); + this.refreshWorkSpace(); + if (this.readyToRenderAppointments) { + this.appointments.option('items', this.layoutManager.generateViewModel()); } }); break; case 'cellDuration': - this._updateOption('workSpace', name, value); - this._appointments.option('items', []); - if (this._readyToRenderAppointments) { - this._updateOption('workSpace', 'hoursInterval', value / 60); - this._appointments.option('items', this._layoutManager.generateViewModel()); + this.updateOption('workSpace', name, value); + this.appointments.option('items', []); + if (this.readyToRenderAppointments) { + this.updateOption('workSpace', 'hoursInterval', value / 60); + this.appointments.option('items', this.layoutManager.generateViewModel()); } break; case 'tabIndex': case 'focusStateEnabled': - this._updateOption('header', name, value); - this._updateOption('workSpace', name, value); - this._appointments.option(name, value); + this.updateOption('header', name, value); + this.updateOption('workSpace', name, value); + this.appointments.option(name, value); // @ts-expect-error super._optionChanged(args); break; case 'width': // TODO: replace with css - this._updateOption('header', name, value); + this.updateOption('header', name, value); if (this.option('crossScrollingEnabled')) { - this._updateOption('workSpace', 'width', value); + this.updateOption('workSpace', 'width', value); } - this._updateOption('workSpace', 'schedulerWidth', value); + this.updateOption('workSpace', 'schedulerWidth', value); // @ts-expect-error super._optionChanged(args); this._dimensionChanged(null, true); @@ -452,16 +452,16 @@ class Scheduler extends SchedulerOptionsBaseWidget { // @ts-expect-error super._optionChanged(args); this._dimensionChanged(null, true); - this._updateOption('workSpace', 'schedulerHeight', value); + this.updateOption('workSpace', 'schedulerHeight', value); break; case 'editing': { - this._initEditing(); - const editing = this._editing; + this.initEditing(); + const { editing } = this; - this._bringEditingModeToAppointments(editing); + this.bringEditingModeToAppointments(editing); this.hideAppointmentTooltip(); - this._cleanPopup(); + this.cleanPopup(); break; } case 'showAllDayPanel': @@ -472,12 +472,12 @@ class Scheduler extends SchedulerOptionsBaseWidget { case 'indicatorUpdateInterval': case 'shadeUntilCurrentTime': case 'groupByDate': - this._updateOption('workSpace', name, value); + this.updateOption('workSpace', name, value); this.repaint(); break; case 'indicatorTime': - this._updateOption('workSpace', name, value); - this._updateOption('header', name, value); + this.updateOption('workSpace', name, value); + this.updateOption('header', name, value); this.repaint(); break; case 'appointmentDragging': @@ -509,32 +509,32 @@ class Scheduler extends SchedulerOptionsBaseWidget { case 'recurrenceExceptionExpr': case 'disabledExpr': case 'visibleExpr': - this._updateExpression(name, value); - this._initAppointmentTemplate(); + this.updateExpression(name, value); + this.initAppointmentTemplate(); this.repaint(); break; case 'adaptivityEnabled': - this._toggleAdaptiveClass(); + this.toggleAdaptiveClass(); this.repaint(); break; case 'scrolling': - this.option('crossScrollingEnabled', this._isHorizontalVirtualScrolling() || this.option('crossScrollingEnabled')); + this.option('crossScrollingEnabled', this.isHorizontalVirtualScrolling() || this.option('crossScrollingEnabled')); - this._updateOption('workSpace', args.fullName, value); + this.updateOption('workSpace', args.fullName, value); break; case 'allDayPanelMode': this.updateAppointmentDataSource(); - this._updateOption('workSpace', args.fullName, value); + this.updateOption('workSpace', args.fullName, value); break; case 'renovateRender': - this._updateOption('workSpace', name, value); + this.updateOption('workSpace', name, value); break; case '_draggingMode': - this._updateOption('workSpace', 'draggingMode', value); + this.updateOption('workSpace', 'draggingMode', value); break; case 'toolbar': - this._header - ? this._header.onToolbarOptionChanged(args.fullName, value) + this.header + ? this.header.onToolbarOptionChanged(args.fullName, value) : this.repaint(); break; default: @@ -543,54 +543,54 @@ class Scheduler extends SchedulerOptionsBaseWidget { } } - _bringEditingModeToAppointments(editing) { + private bringEditingModeToAppointments(editing) { const editingConfig: any = { allowDelete: editing.allowUpdating && editing.allowDeleting, }; - if (!this._isAgenda()) { + if (!this.isAgenda()) { editingConfig.allowDrag = editing.allowDragging; editingConfig.allowResize = editing.allowResizing; - editingConfig.allowAllDayResize = editing.allowResizing && this._supportAllDayResizing(); + editingConfig.allowAllDayResize = editing.allowResizing && this.supportAllDayResizing(); } - this._appointments.option(editingConfig); + this.appointments.option(editingConfig); this.repaint(); } - _isAgenda() { + private isAgenda() { return this.currentView.type === 'agenda'; } - _allowDragging() { - return this._editing.allowDragging && !this._isAgenda(); + private allowDragging() { + return this.editing.allowDragging && !this.isAgenda(); } - _allowResizing() { - return this._editing.allowResizing && !this._isAgenda(); + private allowResizing() { + return this.editing.allowResizing && !this.isAgenda(); } - _allowAllDayResizing() { - return this._editing.allowResizing && this._supportAllDayResizing(); + private allowAllDayResizing() { + return this.editing.allowResizing && this.supportAllDayResizing(); } - _supportAllDayResizing() { + private supportAllDayResizing() { return this.currentView.type !== 'day' || this.currentView.intervalCount > 1; } - _isAllDayExpanded() { - return this.option('showAllDayPanel') && this._layoutManager.hasAllDayAppointments(); + private isAllDayExpanded() { + return this.option('showAllDayPanel') && this.layoutManager.hasAllDayAppointments(); } - _setRemoteFilterIfNeeded(): void { + private setRemoteFilterIfNeeded(): void { const dataSource = this._dataSource; const remoteFiltering = this.option('remoteFiltering'); - if (!this._workSpace || !remoteFiltering || !dataSource) { + if (!this.workSpace || !remoteFiltering || !dataSource) { return; } - const dateRange = this._workSpace.getDateRange(); + const dateRange = this.workSpace.getDateRange(); const startDate = this.timeZoneCalculator.createDate(dateRange[0], 'fromGrid'); const endDate = this.timeZoneCalculator.createDate(dateRange[1], 'fromGrid'); @@ -599,7 +599,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { const filter = combineRemoteFilter({ dataSourceFilter, - dataAccessors: this._dataAccessors, + dataAccessors: this.dataAccessors, min: startDate, max: endDate, dateSerializationFormat, @@ -609,7 +609,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { dataSource.filter(filter); } - _reloadDataSource() { + private reloadDataSource() { // @ts-expect-error const result = new Deferred(); @@ -644,8 +644,8 @@ class Scheduler extends SchedulerOptionsBaseWidget { result?.resolve(); }; - if (this._workSpaceRecalculation) { - this._workSpaceRecalculation?.done(() => { + if (this.workSpaceRecalculation) { + this.workSpaceRecalculation?.done(() => { fireContentReady(); }); } else { @@ -662,44 +662,44 @@ class Scheduler extends SchedulerOptionsBaseWidget { return; } - this._toggleSmallClass(); + this.toggleSmallClass(); const workspace = this.getWorkSpace(); if ( - !this._isAgenda() - && this._layoutManager + !this.isAgenda() + && this.layoutManager && workspace && !isAgendaWorkspaceComponent(workspace) ) { if (isForce || (!isFixedHeight || !isFixedWidth)) { - workspace.option('allDayExpanded', this._isAllDayExpanded()); + workspace.option('allDayExpanded', this.isAllDayExpanded()); workspace._dimensionChanged(); - const appointments = this._layoutManager.generateViewModel(); + const appointments = this.layoutManager.generateViewModel(); - this._appointments.option('items', appointments); + this.appointments.option('items', appointments); } } this.hideAppointmentTooltip(); // TODO popup - this._appointmentPopup.triggerResize(); - this._appointmentPopup.updatePopupFullScreenMode(); + this.appointmentPopup.triggerResize(); + this.appointmentPopup.updatePopupFullScreenMode(); } _clean() { - this._cleanPopup(); + this.cleanPopup(); // @ts-expect-error super._clean(); } - _toggleSmallClass() { + private toggleSmallClass() { const { width } = getBoundingRect((this.$element() as any).get(0)); (this.$element() as any).toggleClass(WIDGET_SMALL_CLASS, width < WIDGET_SMALL_WIDTH); } - _toggleAdaptiveClass() { + private toggleAdaptiveClass() { (this.$element() as any).toggleClass(WIDGET_ADAPTIVE_CLASS, this.option('adaptivityEnabled')); } @@ -711,15 +711,15 @@ class Scheduler extends SchedulerOptionsBaseWidget { return { paginate: false }; } - _initAllDayPanel() { + private initAllDayPanel() { if (this.option('allDayPanelMode') === 'hidden') { this.option('showAllDayPanel', false); } } _init() { - this._timeZonesPromise = timeZoneUtils.cacheTimeZones(); - this._initExpressions({ + this.timeZonesPromise = timeZoneUtils.cacheTimeZones(); + this.initExpressions({ startDateExpr: this.option('startDateExpr'), endDateExpr: this.option('endDateExpr'), startDateTimeZoneExpr: this.option('startDateTimeZoneExpr'), @@ -735,32 +735,32 @@ class Scheduler extends SchedulerOptionsBaseWidget { super._init(); - this._initAllDayPanel(); + this.initAllDayPanel(); // @ts-expect-error this._initDataSource(); - this._customizeDataSourceLoadOptions(); + this.customizeDataSourceLoadOptions(); (this.$element() as any).addClass(WIDGET_CLASS); - this._initEditing(); + this.initEditing(); this.updateAppointmentDataSource(); - this._initActions(); + this.initActions(); - this._compactAppointmentsHelper = new CompactAppointmentsHelper(this); + this.compactAppointmentsHelper = new CompactAppointmentsHelper(this); - this._asyncTemplatesTimers = []; + this.asyncTemplatesTimers = []; - this._dataSourceLoadedCallback = Callbacks(); + this.dataSourceLoadedCallback = Callbacks(); - this._subscribes = subscribes; + this.subscribes = subscribes; this.resourceManager = new ResourceManager(this.option('resources')); - this._notifyScheduler = new NotifyScheduler({ scheduler: this }); + this.notifyScheduler = new NotifyScheduler({ scheduler: this }); } createAppointmentDataSource() { @@ -776,7 +776,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } } - _customizeDataSourceLoadOptions() { + private customizeDataSourceLoadOptions() { this._dataSource?.on('customizeStoreLoadOptions', ({ storeLoadOptions }) => { storeLoadOptions.startDate = this.getStartViewDate(); storeLoadOptions.endDate = this.getEndViewDate(); @@ -784,7 +784,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } _initTemplates() { - this._initAppointmentTemplate(); + this.initAppointmentTemplate(); this._templateManager.addDefaultTemplates({ appointmentTooltip: new EmptyTemplate(), @@ -794,8 +794,8 @@ class Scheduler extends SchedulerOptionsBaseWidget { super._initTemplates(); } - _initAppointmentTemplate() { - const { expr } = this._dataAccessors; + private initAppointmentTemplate() { + const { expr } = this.dataAccessors; const createGetter = (property) => compileGetter(`appointmentData.${property}`); const getDate = (getter) => (data) => { @@ -841,11 +841,11 @@ class Scheduler extends SchedulerOptionsBaseWidget { } _dataSourceChangedHandler(result?: Appointment[]) { - if (this._readyToRenderAppointments) { - this._workSpaceRecalculation.done(() => { - this._layoutManager.prepareAppointments(result); - this._renderAppointments(); - this._updateA11yStatus(); + if (this.readyToRenderAppointments) { + this.workSpaceRecalculation.done(() => { + this.layoutManager.prepareAppointments(result); + this.renderAppointments(); + this.updateA11yStatus(); }); } } @@ -862,40 +862,40 @@ class Scheduler extends SchedulerOptionsBaseWidget { return scrolling?.mode === 'virtual'; } - _renderAppointments() { + private renderAppointments() { const workspace = this.getWorkSpace(); - this._layoutManager.filterAppointments(); + this.layoutManager.filterAppointments(); - workspace.option('allDayExpanded', this._isAllDayExpanded()); + workspace.option('allDayExpanded', this.isAllDayExpanded()); // @ts-expect-error const viewModel: AppointmentViewModelPlain[] = this._isVisible() - ? this._layoutManager.generateViewModel() + ? this.layoutManager.generateViewModel() : []; - this._appointments.option('items', viewModel); + this.appointments.option('items', viewModel); this.appointmentDataSource.cleanState(); - if (this._isAgenda()) { - this._workSpace.renderAgendaLayout(viewModel); + if (this.isAgenda()) { + this.workSpace.renderAgendaLayout(viewModel); } } - _initExpressions(fields: IFieldExpr) { - this._dataAccessors = new AppointmentDataAccessor( + private initExpressions(fields: IFieldExpr) { + this.dataAccessors = new AppointmentDataAccessor( fields, Boolean(config().forceIsoDateParsing), this.option('dateSerializationFormat'), ); } - _updateExpression(name: string, value: string) { - this._dataAccessors.updateExpression(name, value); + private updateExpression(name: string, value: string) { + this.dataAccessors.updateExpression(name, value); } - _initEditing() { + private initEditing() { const editing = this.option('editing'); - this._editing = { + this.editing = { allowAdding: Boolean(editing), allowUpdating: Boolean(editing), allowDeleting: Boolean(editing), @@ -905,14 +905,14 @@ class Scheduler extends SchedulerOptionsBaseWidget { }; if (isObject(editing)) { - this._editing = extend(this._editing, editing); + this.editing = extend(this.editing, editing); } - this._editing.allowDragging = this._editing.allowDragging && this._editing.allowUpdating; - this._editing.allowResizing = this._editing.allowResizing && this._editing.allowUpdating; + this.editing.allowDragging = this.editing.allowDragging && this.editing.allowUpdating; + this.editing.allowResizing = this.editing.allowResizing && this.editing.allowUpdating; const isReadOnly = Object.values({ - ...this._editing, + ...this.editing, form: undefined, popup: undefined, }).every((value) => !value); @@ -922,14 +922,14 @@ class Scheduler extends SchedulerOptionsBaseWidget { _dispose() { this.resourceManager?.dispose(); - this._appointmentTooltip?.dispose(); - this._recurrenceDialog?.hide(RECURRENCE_EDITING_MODE.CANCEL); + this.appointmentTooltip?.dispose(); + this.recurrenceDialog?.hide(RECURRENCE_EDITING_MODE.CANCEL); this.hideAppointmentPopup(); this.hideAppointmentTooltip(); - this._asyncTemplatesTimers.forEach(clearTimeout); - this._asyncTemplatesTimers = []; + this.asyncTemplatesTimers.forEach(clearTimeout); + this.asyncTemplatesTimers = []; // NOTE: Stop all scheduled macro tasks macroTaskArray.dispose(); @@ -938,8 +938,8 @@ class Scheduler extends SchedulerOptionsBaseWidget { super._dispose(); } - _initActions() { - this._actions = { + private initActions() { + this.actions = { onAppointmentAdding: this._createActionByOption(StoreEventNames.ADDING), onAppointmentAdded: this._createActionByOption(StoreEventNames.ADDED), onAppointmentUpdating: this._createActionByOption(StoreEventNames.UPDATING), @@ -951,7 +951,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { }; } - _getAppointmentRenderedAction() { + private getAppointmentRenderedAction() { return this._createActionByOption('onAppointmentRendered', { excludeValidators: ['disabled', 'readOnly'], }); @@ -959,8 +959,8 @@ class Scheduler extends SchedulerOptionsBaseWidget { _renderFocusTarget() { return noop(); } - _updateA11yStatus() { - const dateRange = this._workSpace.getDateRange(); + private updateA11yStatus() { + const dateRange = this.workSpace.getDateRange(); const indicatorTime = this.option('showCurrentTimeIndicator') ? getToday(this.option('indicatorTime') as Date, this.timeZoneCalculator) : undefined; @@ -968,52 +968,52 @@ class Scheduler extends SchedulerOptionsBaseWidget { this.currentView, dateRange[0], dateRange[1], - this._layoutManager.filteredItems.length, + this.layoutManager.filteredItems.length, indicatorTime, ); // @ts-expect-error this.setAria({ label }); - this._a11yStatus.text(label); + this.a11yStatus.text(label); } - _renderA11yStatus() { - this._a11yStatus = createA11yStatusContainer(); - this._a11yStatus.prependTo(this.$element()); + private renderA11yStatus() { + this.a11yStatus = createA11yStatusContainer(); + this.a11yStatus.prependTo(this.$element()); // @ts-expect-error this.setAria({ role: 'application' }); } - _initMarkupOnResourceLoaded() { + private initMarkupOnResourceLoaded() { if (!(this as any)._disposed) { - this._initMarkupCore(); - this._reloadDataSource(); + this.initMarkupCore(); + this.reloadDataSource(); } } _initMarkup(): void { super._initMarkup(); - this._renderA11yStatus(); - this._renderMainContainer(); - this._renderHeader(); - this._toggleAdaptiveClass(); + this.renderA11yStatus(); + this.renderMainContainer(); + this.renderHeader(); + this.toggleAdaptiveClass(); - this._layoutManager = new AppointmentLayoutManager(this); + this.layoutManager = new AppointmentLayoutManager(this); // @ts-expect-error - this._appointments = this._createComponent('
', AppointmentCollection, this._appointmentsConfig()); - this._appointments.option('itemTemplate', this._getAppointmentTemplate('appointmentTemplate')); + this.appointments = this._createComponent('
', AppointmentCollection, this.appointmentsConfig()); + this.appointments.option('itemTemplate', this.getAppointmentTemplate('appointmentTemplate')); - this._appointmentTooltip = new (this.option('adaptivityEnabled') + this.appointmentTooltip = new (this.option('adaptivityEnabled') ? MobileTooltipStrategy - : DesktopTooltipStrategy)(this._getAppointmentTooltipOptions()); + : DesktopTooltipStrategy)(this.getAppointmentTooltipOptions()); - this._createAppointmentPopupForm(); + this.createAppointmentPopupForm(); // @ts-expect-error - if (this._isDataSourceLoaded() || this._isDataSourceLoading()) { - this._initMarkupCore(); + if (this.isDataSourceLoaded() || this._isDataSourceLoading()) { + this.initMarkupCore(); this._dataSourceChangedHandler(this._dataSource.items()); this._fireContentReadyAction(); } else { @@ -1021,46 +1021,46 @@ class Scheduler extends SchedulerOptionsBaseWidget { if (groups?.length) { this.resourceManager.loadGroupResources(groups, true) - .then(() => this._initMarkupOnResourceLoaded()); + .then(() => this.initMarkupOnResourceLoaded()); } else { - this._initMarkupOnResourceLoaded(); + this.initMarkupOnResourceLoaded(); } } } - _createAppointmentPopupForm() { - if (this._appointmentForm) { - this._appointmentForm.form?.dispose(); + private createAppointmentPopupForm() { + if (this.appointmentForm) { + this.appointmentForm.form?.dispose(); } - this._appointmentForm = this.createAppointmentForm(); + this.appointmentForm = this.createAppointmentForm(); - this._appointmentPopup?.dispose(); - this._appointmentPopup = this.createAppointmentPopup(this._appointmentForm); + this.appointmentPopup?.dispose(); + this.appointmentPopup = this.createAppointmentPopup(this.appointmentForm); } - _renderMainContainer() { - this._mainContainer = $('
').addClass('dx-scheduler-container'); + private renderMainContainer() { + this.mainContainer = $('
').addClass('dx-scheduler-container'); - this.$element().append(this._mainContainer); + this.$element().append(this.mainContainer); } createAppointmentForm() { const scheduler = { getResourceById: () => this.resourceManager.resourceById, - getDataAccessors: () => this._dataAccessors, + getDataAccessors: () => this.dataAccessors, // @ts-expect-error createComponent: (element, component, options) => this._createComponent(element, component, options), - getEditingConfig: () => this._editing, + getEditingConfig: () => this.editing, getResourceManager: () => this.resourceManager, getFirstDayOfWeek: () => this.option('firstDayOfWeek'), getStartDayHour: () => this.option('startDayHour'), - getCalculatedEndDate: (startDateWithStartHour) => this._workSpace.calculateEndDate(startDateWithStartHour), + getCalculatedEndDate: (startDateWithStartHour) => this.workSpace.calculateEndDate(startDateWithStartHour), getTimeZoneCalculator: () => this.timeZoneCalculator, }; - if (this._editing.legacyForm) { + if (this.editing.legacyForm) { (scheduler as any).createResourceEditorModel = () => createResourceEditorModel(this.resourceManager.resourceById); return new AppointmentLegacyForm(scheduler); @@ -1078,26 +1078,26 @@ class Scheduler extends SchedulerOptionsBaseWidget { getResourceManager: () => this.resourceManager, - getEditingConfig: () => this._editing, + getEditingConfig: () => this.editing, getTimeZoneCalculator: () => this.timeZoneCalculator, - getDataAccessors: () => this._dataAccessors, - getAppointmentFormOpening: () => this._actions.onAppointmentFormOpening, - processActionResult: (arg, canceled) => this._processActionResult(arg, canceled), + getDataAccessors: () => this.dataAccessors, + getAppointmentFormOpening: () => this.actions.onAppointmentFormOpening, + processActionResult: (arg, canceled) => this.processActionResult(arg, canceled), addAppointment: (appointment) => this.addAppointment(appointment), updateAppointment: (sourceAppointment, updatedAppointment) => this.updateAppointment(sourceAppointment, updatedAppointment), updateScrollPosition: (startDate, appointmentGroupValues, inAllDayRow) => { - this._workSpace.updateScrollPosition(startDate, appointmentGroupValues, inAllDayRow); + this.workSpace.updateScrollPosition(startDate, appointmentGroupValues, inAllDayRow); }, }; - return this._editing.legacyForm + return this.editing.legacyForm ? new AppointmentLegacyPopup(scheduler, form) : new AppointmentPopup(scheduler, form); } - _getAppointmentTooltipOptions() { + private getAppointmentTooltipOptions() { const that = this; return { // @ts-expect-error @@ -1105,19 +1105,19 @@ class Scheduler extends SchedulerOptionsBaseWidget { container: that.$element(), getScrollableContainer: that.getWorkSpaceScrollableContainer.bind(that), addDefaultTemplates: that._templateManager.addDefaultTemplates.bind(that._templateManager), - getAppointmentTemplate: that._getAppointmentTemplate.bind(that), + getAppointmentTemplate: that.getAppointmentTemplate.bind(that), showAppointmentPopup: that.showAppointmentPopup.bind(that), checkAndDeleteAppointment: that.checkAndDeleteAppointment.bind(that), isAppointmentInAllDayPanel: that.isAppointmentInAllDayPanel.bind(that), createFormattedDateText: (appointment, targetedAppointment, format) => this.fire('createFormattedDateText', appointment, targetedAppointment, format), - getAppointmentDisabled: (appointment) => this._dataAccessors.get('disabled', appointment), + getAppointmentDisabled: (appointment) => this.dataAccessors.get('disabled', appointment), onItemContextMenu: that._createActionByOption('onAppointmentContextMenu'), - createEventArgs: that._createEventArgs.bind(that), + createEventArgs: that.createEventArgs.bind(that), }; } - _createEventArgs(e) { + private createEventArgs(e) { const config = { itemData: e.itemData.appointment, itemElement: e.itemElement, @@ -1134,11 +1134,11 @@ class Scheduler extends SchedulerOptionsBaseWidget { checkAndDeleteAppointment(appointment, targetedAppointment) { const targetedAdapter = new AppointmentAdapter( targetedAppointment, - this._dataAccessors, + this.dataAccessors, ); const deletingOptions = this.fireOnAppointmentDeleting(appointment, targetedAdapter); - this._checkRecurringAppointment( + this.checkRecurringAppointment( appointment, targetedAppointment, targetedAdapter.startDate, @@ -1149,7 +1149,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { ); } - _getExtraAppointmentTooltipOptions() { + private getExtraAppointmentTooltipOptions() { return { rtlEnabled: this.option('rtlEnabled'), focusStateEnabled: this.option('focusStateEnabled'), @@ -1159,31 +1159,31 @@ class Scheduler extends SchedulerOptionsBaseWidget { } isAppointmentInAllDayPanel(appointmentData) { - const workSpace = this._workSpace; + const { workSpace } = this; const itTakesAllDay = this.appointmentTakesAllDay(appointmentData); return itTakesAllDay && workSpace.supportAllDayRow() && workSpace.option('showAllDayPanel'); } - _initMarkupCore() { - this._readyToRenderAppointments = hasWindow(); + private initMarkupCore() { + this.readyToRenderAppointments = hasWindow(); - this._workSpace && this._cleanWorkspace(); + this.workSpace && this.cleanWorkspace(); - this._renderWorkSpace(); - this._appointments.option({ - fixedContainer: this._workSpace.getFixedContainer(), - allDayContainer: this._workSpace.getAllDayContainer(), + this.renderWorkSpace(); + this.appointments.option({ + fixedContainer: this.workSpace.getFixedContainer(), + allDayContainer: this.workSpace.getAllDayContainer(), }); - this._waitAsyncTemplate(() => this._workSpaceRecalculation?.resolve()); + this.waitAsyncTemplate(() => this.workSpaceRecalculation?.resolve()); this.createAppointmentDataSource(); - this._setRemoteFilterIfNeeded(); - this._validateKeyFieldIfAgendaExist(); - this._updateA11yStatus(); + this.setRemoteFilterIfNeeded(); + this.validateKeyFieldIfAgendaExist(); + this.updateA11yStatus(); } - _isDataSourceLoaded() { + private isDataSourceLoaded() { return this._dataSource?.isLoaded(); } @@ -1194,21 +1194,21 @@ class Scheduler extends SchedulerOptionsBaseWidget { super._render(); } - _renderHeader() { + private renderHeader() { const toolbarOptions = this.option('toolbar'); const isHeaderShown = Boolean( toolbarOptions.visible ?? toolbarOptions.items?.length, ); if (isHeaderShown) { - const $header = $('
').appendTo(this._mainContainer); - const headerOptions = this._headerConfig(); + const $header = $('
').appendTo(this.mainContainer); + const headerOptions = this.headerConfig(); // @ts-expect-error - this._header = this._createComponent($header, SchedulerHeader, headerOptions); + this.header = this._createComponent($header, SchedulerHeader, headerOptions); } } - _headerConfig(): HeaderOptions { + private headerConfig(): HeaderOptions { return { currentView: this.currentView, views: this.views, @@ -1232,99 +1232,99 @@ class Scheduler extends SchedulerOptionsBaseWidget { }; } - _appointmentsConfig() { + private appointmentsConfig() { const config = { getResourceManager: () => this.resourceManager, getAppointmentDataSource: () => this.appointmentDataSource, - dataAccessors: this._dataAccessors, - notifyScheduler: this._notifyScheduler, - onItemRendered: this._getAppointmentRenderedAction(), + dataAccessors: this.dataAccessors, + notifyScheduler: this.notifyScheduler, + onItemRendered: this.getAppointmentRenderedAction(), onItemClick: this._createActionByOption('onAppointmentClick'), onItemContextMenu: this._createActionByOption('onAppointmentContextMenu'), onAppointmentDblClick: this._createActionByOption('onAppointmentDblClick'), tabIndex: this.option('tabIndex'), focusStateEnabled: this.option('focusStateEnabled'), - allowDrag: this._allowDragging(), - allowDelete: this._editing.allowUpdating && this._editing.allowDeleting, - allowResize: this._allowResizing(), - allowAllDayResize: this._allowAllDayResizing(), + allowDrag: this.allowDragging(), + allowDelete: this.editing.allowUpdating && this.editing.allowDeleting, + allowResize: this.allowResizing(), + allowAllDayResize: this.allowAllDayResizing(), rtlEnabled: this.option('rtlEnabled'), groups: this.getViewOption('groups'), groupByDate: this.getViewOption('groupByDate'), timeZoneCalculator: this.timeZoneCalculator, - getResizableStep: () => (this._workSpace ? this._workSpace.positionHelper.getResizableStep() : 0), - getDOMElementsMetaData: () => this._workSpace?.getDOMElementsMetaData(), - getViewDataProvider: () => this._workSpace?.viewDataProvider, - isVerticalGroupedWorkSpace: () => this._workSpace._isVerticalGroupedWorkSpace(), - isDateAndTimeView: () => isDateAndTimeView(this._workSpace.type), + getResizableStep: () => (this.workSpace ? this.workSpace.positionHelper.getResizableStep() : 0), + getDOMElementsMetaData: () => this.workSpace?.getDOMElementsMetaData(), + getViewDataProvider: () => this.workSpace?.viewDataProvider, + isVerticalGroupedWorkSpace: () => this.workSpace._isVerticalGroupedWorkSpace(), + isDateAndTimeView: () => isDateAndTimeView(this.workSpace.type), onContentReady: () => { - this._workSpace?.option('allDayExpanded', this._isAllDayExpanded()); + this.workSpace?.option('allDayExpanded', this.isAllDayExpanded()); }, }; return config; } - _renderWorkSpace() { + private renderWorkSpace() { const currentViewOptions = this.currentView; if (!currentViewOptions) { return; } - if (this._isAgenda()) { + if (this.isAgenda()) { this.renderAgendaWorkspace(); } else { this.renderGridWorkspace(); } - this._recalculateWorkspace(); + this.recalculateWorkspace(); if (currentViewOptions.startDate) { - this._updateOption('header', 'currentDate', this._workSpace._getHeaderDate()); + this.updateOption('header', 'currentDate', this.workSpace._getHeaderDate()); } } renderGridWorkspace(): void { - if (this._readyToRenderAppointments) { - this._toggleSmallClass(); + if (this.readyToRenderAppointments) { + this.toggleSmallClass(); // TODO(9): Get rid of it as soon as you can. Workspace didn't render Promise.resolve().then(() => { - this._toggleSmallClass(); - this._workSpace?.updateHeaderEmptyCellWidth(); + this.toggleSmallClass(); + this.workSpace?.updateHeaderEmptyCellWidth(); }); } - const $workSpace = $('
').appendTo(this._mainContainer); + const $workSpace = $('
').appendTo(this.mainContainer); const currentViewType = this.currentView.type; const workSpaceComponent = VIEWS_CONFIG[currentViewType].workSpace; - const workSpaceConfig = this._workSpaceConfig(this.currentView); + const workSpaceConfig = this.workSpaceConfig(this.currentView); // @ts-expect-error - this._workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig); + this.workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig); - this._allowDragging() && this._workSpace.initDragBehavior(this, this._all); - this._workSpace._attachTablesEvents(); - this._workSpace.getWorkArea().append(this._appointments.$element()); + this.allowDragging() && this.workSpace.initDragBehavior(this, this.all); + this.workSpace._attachTablesEvents(); + this.workSpace.getWorkArea().append(this.appointments.$element()); } renderAgendaWorkspace(): void { - const $workSpace = $('
').appendTo(this._mainContainer); - const workSpaceConfig = this._workSpaceConfig(this.currentView); + const $workSpace = $('
').appendTo(this.mainContainer); + const workSpaceConfig = this.workSpaceConfig(this.currentView); const workSpaceComponent = VIEWS_CONFIG.agenda.workSpace; // @ts-expect-error - this._workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig); - this._workSpace.getWorkArea().append(this._appointments.$element()); + this.workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig); + this.workSpace.getWorkArea().append(this.appointments.$element()); } - _recalculateWorkspace() { + private recalculateWorkspace() { // @ts-expect-error - this._workSpaceRecalculation = new Deferred(); - triggerResizeEvent(this._workSpace.$element()); - this._waitAsyncTemplate(() => { - this._workSpace.renderCurrentDateTimeLineAndShader(); + this.workSpaceRecalculation = new Deferred(); + triggerResizeEvent(this.workSpace.$element()); + this.waitAsyncTemplate(() => { + this.workSpace.renderCurrentDateTimeLineAndShader(); }); } - _workSpaceConfig(currentViewOptions: NormalizedView) { + private workSpaceConfig(currentViewOptions: NormalizedView) { const scrolling = this.getViewOption('scrolling'); const isVirtualScrolling = scrolling.mode === 'virtual'; const horizontalVirtualScrollingAllowed = isVirtualScrolling @@ -1339,7 +1339,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { const result = extend({ resources: this.option('resources'), getResourceManager: () => this.resourceManager, - getFilteredItems: () => this._layoutManager.filteredItems, // NOTE: used only in agenda + getFilteredItems: () => this.layoutManager.filteredItems, // NOTE: used only in agenda noDataText: this.option('noDataText') || messageLocalization.format('dxCollectionWidget-noDataText'), firstDayOfWeek: this.option('firstDayOfWeek'), @@ -1374,17 +1374,17 @@ class Scheduler extends SchedulerOptionsBaseWidget { allDayPanelMode: this.option('allDayPanelMode'), onSelectedCellsClick: this.showAddAppointmentPopup.bind(this), onRenderAppointments: () => { - this._renderAppointments(); + this.renderAppointments(); }, onShowAllDayPanel: (value) => this.option('showAllDayPanel', value), - getHeaderHeight: () => utils.DOM.getHeaderHeight(this._header), - onScrollEnd: () => this._appointments.updateResizableArea(), + getHeaderHeight: () => utils.DOM.getHeaderHeight(this.header), + onScrollEnd: () => this.appointments.updateResizableArea(), // TODO: SSR does not work correctly with renovated render - renovateRender: this._isRenovatedRender(isVirtualScrolling), + renovateRender: this.isRenovatedRender(isVirtualScrolling), }, currentViewOptions); - result.notifyScheduler = this._notifyScheduler; + result.notifyScheduler = this.notifyScheduler; result.groups = this.resourceManager.groupResources(); result.onCellClick = this._createActionByOption('onCellClick'); result.onCellContextMenu = this._createActionByOption('onCellContextMenu'); @@ -1399,23 +1399,23 @@ class Scheduler extends SchedulerOptionsBaseWidget { return result; } - _isRenovatedRender(isVirtualScrolling) { + private isRenovatedRender(isVirtualScrolling) { return (this.option('renovateRender') && hasWindow()) || isVirtualScrolling; } - _waitAsyncTemplate(callback) { + private waitAsyncTemplate(callback) { if (this._options.silent('templatesRenderAsynchronously')) { const timer = setTimeout(() => { callback(); clearTimeout(timer); }); - this._asyncTemplatesTimers.push(timer); + this.asyncTemplatesTimers.push(timer); } else { callback(); } } - _getAppointmentTemplate(optionName) { + private getAppointmentTemplate(optionName) { if (this.currentView?.[optionName]) { return this._getTemplate(this.currentView[optionName]); } @@ -1424,55 +1424,55 @@ class Scheduler extends SchedulerOptionsBaseWidget { return this._getTemplateByOption(optionName); } - _updateOption(viewName: 'workSpace' | 'header', optionName: string, value: T): void { + private updateOption(viewName: 'workSpace' | 'header', optionName: string, value: T): void { this[`_${viewName}`]?.option(optionName, value); } - _refreshWorkSpace(): void { - this._cleanWorkspace(); + private refreshWorkSpace(): void { + this.cleanWorkspace(); - delete this._workSpace; + delete this.workSpace; - this._renderWorkSpace(); + this.renderWorkSpace(); - if (this._readyToRenderAppointments) { - this._appointments.option({ - fixedContainer: this._workSpace.getFixedContainer(), - allDayContainer: this._workSpace.getAllDayContainer(), + if (this.readyToRenderAppointments) { + this.appointments.option({ + fixedContainer: this.workSpace.getFixedContainer(), + allDayContainer: this.workSpace.getAllDayContainer(), }); - this._waitAsyncTemplate(() => this._workSpaceRecalculation.resolve()); + this.waitAsyncTemplate(() => this.workSpaceRecalculation.resolve()); } } - _cleanWorkspace() { - this._appointments.$element().detach(); - this._workSpace._dispose(); - this._workSpace.$element().remove(); + private cleanWorkspace() { + this.appointments.$element().detach(); + this.workSpace._dispose(); + this.workSpace.$element().remove(); this.option('selectedCellData', []); } getWorkSpaceScrollable() { - return this._workSpace.getScrollable(); + return this.workSpace.getScrollable(); } getWorkSpaceScrollableContainer() { - return this._workSpace.getScrollableContainer(); + return this.workSpace.getScrollableContainer(); } getWorkSpace() { - return this._workSpace; + return this.workSpace; } getHeader() { - return this._header; + return this.header; } - _cleanPopup() { - this._appointmentPopup?.dispose(); + private cleanPopup() { + this.appointmentPopup?.dispose(); } - _checkRecurringAppointment( + private checkRecurringAppointment( rawAppointment, singleAppointment, exceptionDate, @@ -1482,9 +1482,9 @@ class Scheduler extends SchedulerOptionsBaseWidget { dragEvent?: any, recurrenceEditMode?: any, ) { - const recurrenceRule = this._dataAccessors.get('recurrenceRule', rawAppointment); + const recurrenceRule = this.dataAccessors.get('recurrenceRule', rawAppointment); - if (!validateRRule(recurrenceRule) || !this._editing.allowUpdating) { + if (!validateRRule(recurrenceRule) || !this.editing.allowUpdating) { callback(); return; } @@ -1495,18 +1495,18 @@ class Scheduler extends SchedulerOptionsBaseWidget { callback(); break; case 'occurrence': - this._excludeAppointmentFromSeries(rawAppointment, singleAppointment, exceptionDate, isDeleted, isPopupEditing, dragEvent); + this.excludeAppointmentFromSeries(rawAppointment, singleAppointment, exceptionDate, isDeleted, isPopupEditing, dragEvent); break; default: if (dragEvent) { // @ts-expect-error dragEvent.cancel = new Deferred(); } - this._showRecurrenceChangeConfirm(isDeleted) + this.showRecurrenceChangeConfirm(isDeleted) .done((editingMode) => { editingMode === RECURRENCE_EDITING_MODE.SERIES && callback(); - editingMode === RECURRENCE_EDITING_MODE.OCCURRENCE && this._excludeAppointmentFromSeries( + editingMode === RECURRENCE_EDITING_MODE.OCCURRENCE && this.excludeAppointmentFromSeries( rawAppointment, singleAppointment, exceptionDate, @@ -1515,21 +1515,21 @@ class Scheduler extends SchedulerOptionsBaseWidget { dragEvent, ); }) - .fail(() => this._appointments.moveAppointmentBack(dragEvent)); + .fail(() => this.appointments.moveAppointmentBack(dragEvent)); } } - _excludeAppointmentFromSeries(rawAppointment, newRawAppointment, exceptionDate, isDeleted, isPopupEditing, dragEvent) { + private excludeAppointmentFromSeries(rawAppointment, newRawAppointment, exceptionDate, isDeleted, isPopupEditing, dragEvent) { const appointment = excludeFromRecurrence( rawAppointment, exceptionDate, - this._dataAccessors, + this.dataAccessors, ); const singleRawAppointment = { ...newRawAppointment }; /* eslint-disable @typescript-eslint/no-dynamic-delete */ - delete singleRawAppointment[this._dataAccessors.expr.recurrenceExceptionExpr]; - delete singleRawAppointment[this._dataAccessors.expr.recurrenceRuleExpr]; + delete singleRawAppointment[this.dataAccessors.expr.recurrenceExceptionExpr]; + delete singleRawAppointment[this.dataAccessors.expr.recurrenceRuleExpr]; const keyPropertyName = this.appointmentDataSource.keyName; delete singleRawAppointment[keyPropertyName]; @@ -1541,7 +1541,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } if (isPopupEditing) { - this._appointmentPopup.show(singleRawAppointment, { + this.appointmentPopup.show(singleRawAppointment, { isToolbarVisible: true, // TODO: remove when legacyForm is deleted action: ACTION_TO_APPOINTMENT.EXCLUDE_FROM_SERIES, excludeInfo: { @@ -1549,26 +1549,26 @@ class Scheduler extends SchedulerOptionsBaseWidget { updatedAppointment: appointment.source, }, }); - this._editAppointmentData = rawAppointment; + this.editAppointmentData = rawAppointment; } else { this._updateAppointment(rawAppointment, appointment.source, () => { - this._appointments.moveAppointmentBack(dragEvent); + this.appointments.moveAppointmentBack(dragEvent); }, dragEvent); } } - _createRecurrenceException(appointment, exceptionDate) { + private createRecurrenceException(appointment, exceptionDate) { const result: any[] = []; if (appointment.recurrenceException) { result.push(appointment.recurrenceException); } - result.push(this._getSerializedDate(exceptionDate, appointment.startDate, appointment.allDay)); + result.push(this.getSerializedDate(exceptionDate, appointment.startDate, appointment.allDay)); return result.join(); } - _getSerializedDate(date, startDate, isAllDay) { + private getSerializedDate(date, startDate, isAllDay) { isAllDay && date.setHours( startDate.getHours(), startDate.getMinutes(), @@ -1579,13 +1579,13 @@ class Scheduler extends SchedulerOptionsBaseWidget { return dateSerialization.serializeDate(date, UTC_FULL_DATE_FORMAT); } - _showRecurrenceChangeConfirm(isDeleted) { + private showRecurrenceChangeConfirm(isDeleted) { const title = messageLocalization.format(isDeleted ? 'dxScheduler-confirmRecurrenceDeleteTitle' : 'dxScheduler-confirmRecurrenceEditTitle'); const message = messageLocalization.format(isDeleted ? 'dxScheduler-confirmRecurrenceDeleteMessage' : 'dxScheduler-confirmRecurrenceEditMessage'); const seriesText = messageLocalization.format(isDeleted ? 'dxScheduler-confirmRecurrenceDeleteSeries' : 'dxScheduler-confirmRecurrenceEditSeries'); const occurrenceText = messageLocalization.format(isDeleted ? 'dxScheduler-confirmRecurrenceDeleteOccurrence' : 'dxScheduler-confirmRecurrenceEditOccurrence'); - this._recurrenceDialog = customDialog({ + this.recurrenceDialog = customDialog({ title, messageHtml: message, showCloseButton: true, @@ -1597,15 +1597,15 @@ class Scheduler extends SchedulerOptionsBaseWidget { popupOptions: { wrapperAttr: { class: POPUP_DIALOG_CLASS }, onHidden: () => { - this._appointments?.focus(); + this.appointments?.focus(); }, }, } as any); - return this._recurrenceDialog.show(); + return this.recurrenceDialog.show(); } - _getUpdatedData(rawAppointment) { + private getUpdatedData(rawAppointment) { const viewOffset = this.getViewOffsetMs(); const getConvertedFromGrid = (date: any): Date | undefined => { @@ -1620,7 +1620,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { const targetCell = this.getTargetCellData(); const appointment = new AppointmentAdapter( rawAppointment, - this._dataAccessors, + this.dataAccessors, ); const cellStartDate = getConvertedFromGrid(targetCell.startDate); @@ -1642,7 +1642,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { const duration = appointmentEndDate.getTime() - appointmentStartDate.getTime(); - const isKeepAppointmentHours = this._workSpace.keepOriginalHours() + const isKeepAppointmentHours = this.workSpace.keepOriginalHours() && dateUtilsTs.isValidDate(appointment.startDate) && dateUtilsTs.isValidDate(cellStartDate); @@ -1657,7 +1657,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { const result = new AppointmentAdapter( {}, - this._dataAccessors, + this.dataAccessors, ); if (targetCell.allDay !== undefined) { @@ -1667,11 +1667,11 @@ class Scheduler extends SchedulerOptionsBaseWidget { let resultedEndDate = new Date(resultedStartDate.getTime() + duration); - if (this.appointmentTakesAllDay(rawAppointment) && !result.allDay && this._workSpace.supportAllDayRow()) { - resultedEndDate = this._workSpace.calculateEndDate(resultedStartDate); + if (this.appointmentTakesAllDay(rawAppointment) && !result.allDay && this.workSpace.supportAllDayRow()) { + resultedEndDate = this.workSpace.calculateEndDate(resultedStartDate); } - if (appointment.allDay && !this._workSpace.supportAllDayRow() && !this._workSpace.keepOriginalHours()) { + if (appointment.allDay && !this.workSpace.supportAllDayRow() && !this.workSpace.keepOriginalHours()) { const dateCopy = new Date(resultedStartDate); dateCopy.setHours(0); @@ -1696,20 +1696,20 @@ class Scheduler extends SchedulerOptionsBaseWidget { return getTargetedAppointment( appointment, settings, - this._dataAccessors, + this.dataAccessors, this.resourceManager, ); } subscribe(subject, action) { - this._subscribes[subject] = subscribes[subject] = action; + this.subscribes[subject] = subscribes[subject] = action; } fire( subject: Subject, ...args: Parameters ): ReturnType { - const callback = this._subscribes[subject]; + const callback = this.subscribes[subject]; if (!isFunction(callback)) { throw errors.Error('E1031', subject); @@ -1719,10 +1719,10 @@ class Scheduler extends SchedulerOptionsBaseWidget { } getTargetCellData() { - return this._workSpace.getDataByDroppableCell(); + return this.workSpace.getDataByDroppableCell(); } - _updateAppointment(target, rawAppointment, onUpdatePrevented?: any, dragEvent?: any) { + private _updateAppointment(target, rawAppointment, onUpdatePrevented?: any, dragEvent?: any) { const updatingOptions = { newData: rawAppointment, oldData: extend({}, target), @@ -1739,7 +1739,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } }.bind(this); - this._actions[StoreEventNames.UPDATING](updatingOptions); + this.actions[StoreEventNames.UPDATING](updatingOptions); if (dragEvent && !isDeferred(dragEvent.cancel)) { // @ts-expect-error @@ -1747,15 +1747,15 @@ class Scheduler extends SchedulerOptionsBaseWidget { } if (isPromise(updatingOptions.cancel) && dragEvent) { - this._updatingAppointments.add(target); + this.updatingAppointments.add(target); } - return this._processActionResult(updatingOptions, function (canceled) { + return this.processActionResult(updatingOptions, function (canceled) { // @ts-expect-error let deferred = new Deferred(); if (!canceled) { - this._expandAllDayPanel(rawAppointment); + this.expandAllDayPanel(rawAppointment); try { deferred = this.appointmentDataSource @@ -1764,18 +1764,18 @@ class Scheduler extends SchedulerOptionsBaseWidget { dragEvent?.cancel.resolve(false); }) .always((storeAppointment) => { - this._updatingAppointments.delete(target); - this._onDataPromiseCompleted(StoreEventNames.UPDATED, storeAppointment); + this.updatingAppointments.delete(target); + this.onDataPromiseCompleted(StoreEventNames.UPDATED, storeAppointment); }) .fail(() => performFailAction()); } catch (err) { performFailAction(err); - this._updatingAppointments.delete(target); + this.updatingAppointments.delete(target); deferred.resolve(); } } else { performFailAction(); - this._updatingAppointments.delete(target); + this.updatingAppointments.delete(target); deferred.resolve(); } @@ -1783,7 +1783,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { }); } - _processActionResult(actionOptions, callback) { + private processActionResult(actionOptions, callback) { // @ts-expect-error const deferred = new Deferred(); const resolveCallback = (callbackResult) => { @@ -1805,48 +1805,48 @@ class Scheduler extends SchedulerOptionsBaseWidget { return deferred.promise(); } - _expandAllDayPanel(appointment) { - if (!this._isAllDayExpanded() && this.appointmentTakesAllDay(appointment)) { - this._updateOption('workSpace', 'allDayExpanded', true); + private expandAllDayPanel(appointment) { + if (!this.isAllDayExpanded() && this.appointmentTakesAllDay(appointment)) { + this.updateOption('workSpace', 'allDayExpanded', true); } } - _onDataPromiseCompleted(handlerName, storeAppointment, appointment?: any) { + private onDataPromiseCompleted(handlerName, storeAppointment, appointment?: any) { const args: any = { appointmentData: appointment || storeAppointment }; if (storeAppointment instanceof Error) { args.error = storeAppointment; } else { - this._appointmentPopup.visible && this._appointmentPopup.hide(); + this.appointmentPopup.visible && this.appointmentPopup.hide(); } - this._actions[handlerName](args); + this.actions[handlerName](args); this._fireContentReadyAction(); } /// #DEBUG // TODO: remove when legacyForm is deleted getAppointmentDetailsForm() { // for tests - return this._appointmentForm.form; + return this.appointmentForm.form; } /// #ENDDEBUG getAppointmentsInstance() { - return this._appointments; + return this.appointments; } getLayoutManager() { - return this._layoutManager; + return this.layoutManager; } getActions() { - return this._actions; + return this.actions; } appointmentTakesAllDay(rawAppointment) { const appointment = new AppointmentAdapter( rawAppointment, - this._dataAccessors, + this.dataAccessors, ); return isAppointmentTakesAllDay( @@ -1860,7 +1860,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { const appointment = new AppointmentAdapter( rawAppointment, - this._dataAccessors, + this.dataAccessors, ); let startDate = new Date(appointment.startDate); @@ -1887,15 +1887,15 @@ class Scheduler extends SchedulerOptionsBaseWidget { } getStartViewDate() { - return this._workSpace?.getStartViewDate(); + return this.workSpace?.getStartViewDate(); } getEndViewDate() { - return this._workSpace.getEndViewDate(); + return this.workSpace.getEndViewDate(); } showAddAppointmentPopup(cellData, cellGroups) { - const appointmentAdapter = new AppointmentAdapter({}, this._dataAccessors); + const appointmentAdapter = new AppointmentAdapter({}, this.dataAccessors); appointmentAdapter.allDay = Boolean(cellData.allDay); appointmentAdapter.startDate = cellData.startDateUTC; @@ -1921,19 +1921,19 @@ class Scheduler extends SchedulerOptionsBaseWidget { } if (isCreateAppointment) { - delete this._editAppointmentData; // TODO - this._editing.allowAdding && this._appointmentPopup.show(rawAppointment, { + delete this.editAppointmentData; // TODO + this.editing.allowAdding && this.appointmentPopup.show(rawAppointment, { isToolbarVisible: true, // TODO: remove when legacyForm is deleted action: ACTION_TO_APPOINTMENT.CREATE, }); } else { - const startDate = this._dataAccessors.get('startDate', newRawTargetedAppointment || rawAppointment); + const startDate = this.dataAccessors.get('startDate', newRawTargetedAppointment || rawAppointment); - this._checkRecurringAppointment(rawAppointment, newTargetedAppointment, startDate, () => { - this._editAppointmentData = rawAppointment; // TODO + this.checkRecurringAppointment(rawAppointment, newTargetedAppointment, startDate, () => { + this.editAppointmentData = rawAppointment; // TODO - this._appointmentPopup.show(rawAppointment, { - isToolbarVisible: this._editing.allowUpdating, // TODO: remove when legacyForm is deleted + this.appointmentPopup.show(rawAppointment, { + isToolbarVisible: this.editing.allowUpdating, // TODO: remove when legacyForm is deleted action: ACTION_TO_APPOINTMENT.UPDATE, }); }, false, true); @@ -1947,16 +1947,16 @@ class Scheduler extends SchedulerOptionsBaseWidget { const startDate = new Date(this.option('currentDate')); const endDate = new Date(startDate.getTime() + this.option('cellDuration') * toMs('minute')); - this._dataAccessors.set('startDate', result, startDate); - this._dataAccessors.set('endDate', result, endDate); + this.dataAccessors.set('startDate', result, startDate); + this.dataAccessors.set('endDate', result, endDate); return result; } hideAppointmentPopup(saveChanges?: any) { - if (this._appointmentPopup?.visible) { - saveChanges && this._appointmentPopup.saveChangesAsync(); - this._appointmentPopup.hide(); + if (this.appointmentPopup?.visible) { + saveChanges && this.appointmentPopup.saveChangesAsync(); + this.appointmentPopup.hide(); } } @@ -1996,12 +1996,12 @@ class Scheduler extends SchedulerOptionsBaseWidget { this._createActionByOption('onAppointmentTooltipShowing')(arg); - if (this._appointmentTooltip.isAlreadyShown(target)) { + if (this.appointmentTooltip.isAlreadyShown(target)) { this.hideAppointmentTooltip(); } else { - this._processActionResult(arg, (canceled) => { - !canceled && this._appointmentTooltip.show(target, data, { - ...this._getExtraAppointmentTooltipOptions(), + this.processActionResult(arg, (canceled) => { + !canceled && this.appointmentTooltip.show(target, data, { + ...this.getExtraAppointmentTooltipOptions(), ...options, }); }); @@ -2009,7 +2009,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } hideAppointmentTooltip() { - this._appointmentTooltip?.hide(); + this.appointmentTooltip?.hide(); } scrollTo( @@ -2034,7 +2034,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { allDayValue = allDay; } - this._workSpace.scrollTo(date, groupValues, allDayValue, true, align); + this.workSpace.scrollTo(date, groupValues, allDayValue, true, align); } private _isScrollOptionsObject(options?: ScrollToGroupValuesOrOptions): options is ScrollToOptions { @@ -2042,7 +2042,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { && ('align' in options || 'allDay' in options || 'group' in options); } - _isHorizontalVirtualScrolling() { + private isHorizontalVirtualScrolling() { const scrolling = this.option('scrolling'); const { orientation, mode } = scrolling; const isVirtualScrolling = mode === 'virtual'; @@ -2055,7 +2055,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { // NOTE: mutation of raw appointment const appointment = new AppointmentAdapter( rawAppointment, - this._dataAccessors, + this.dataAccessors, ); appointment.text = appointment.text || ''; @@ -2066,19 +2066,19 @@ class Scheduler extends SchedulerOptionsBaseWidget { cancel: false, }; - this._actions[StoreEventNames.ADDING](addingOptions); + this.actions[StoreEventNames.ADDING](addingOptions); - return this._processActionResult(addingOptions, (canceled) => { + return this.processActionResult(addingOptions, (canceled) => { if (canceled) { // @ts-expect-error return new Deferred().resolve(); } - this._expandAllDayPanel(serializedAppointment); + this.expandAllDayPanel(serializedAppointment); return this.appointmentDataSource .add(serializedAppointment) - .always((storeAppointment) => this._onDataPromiseCompleted(StoreEventNames.ADDED, storeAppointment)); + .always((storeAppointment) => this.onDataPromiseCompleted(StoreEventNames.ADDED, storeAppointment)); }); } @@ -2098,17 +2098,17 @@ class Scheduler extends SchedulerOptionsBaseWidget { cancel: false, }; - this._actions[StoreEventNames.DELETING](deletingOptions); + this.actions[StoreEventNames.DELETING](deletingOptions); return deletingOptions; } processDeleteAppointment(rawAppointment, deletingOptions) { - this._processActionResult(deletingOptions, function (canceled) { + this.processActionResult(deletingOptions, function (canceled) { if (!canceled) { this.appointmentDataSource .remove(rawAppointment) - .always((storeAppointment) => this._onDataPromiseCompleted( + .always((storeAppointment) => this.onDataPromiseCompleted( StoreEventNames.DELETED, storeAppointment, rawAppointment, @@ -2125,7 +2125,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { if (typeof date === 'string') { date = new Date(date); } - this._checkRecurringAppointment( + this.checkRecurringAppointment( appointment, { }, date, @@ -2143,15 +2143,15 @@ class Scheduler extends SchedulerOptionsBaseWidget { } focus() { - if (this._editAppointmentData) { - this._appointments.focus(); + if (this.editAppointmentData) { + this.appointments.focus(); } else { - this._workSpace.focus(); + this.workSpace.focus(); } } getOccurrences(startDate: Date, endDate: Date, rawAppointments: Appointment[]): Occurrence[] { - return this._layoutManager.getOccurrences(startDate, endDate, rawAppointments); + return this.layoutManager.getOccurrences(startDate, endDate, rawAppointments); } getFirstDayOfWeek(): FirstDayOfWeek { @@ -2160,7 +2160,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { : dateLocalization.firstDayOfWeekIndex() as FirstDayOfWeek; } - _validateKeyFieldIfAgendaExist() { + private validateKeyFieldIfAgendaExist() { if (!this.appointmentDataSource.isDataSourceInit) { return; } @@ -2173,12 +2173,12 @@ class Scheduler extends SchedulerOptionsBaseWidget { } } - _getDragBehavior() { - return this._workSpace.dragBehavior; + private getDragBehavior() { + return this.workSpace.dragBehavior; } - _isAppointmentBeingUpdated(appointmentData: Appointment): boolean { - return this._updatingAppointments.has(appointmentData); + private isAppointmentBeingUpdated(appointmentData: Appointment): boolean { + return this.updatingAppointments.has(appointmentData); } getViewOffsetMs(): number { diff --git a/packages/devextreme/js/__internal/scheduler/m_subscribes.ts b/packages/devextreme/js/__internal/scheduler/m_subscribes.ts index 15ac39411235..4e41490f3071 100644 --- a/packages/devextreme/js/__internal/scheduler/m_subscribes.ts +++ b/packages/devextreme/js/__internal/scheduler/m_subscribes.ts @@ -24,7 +24,7 @@ const isAllDay = ( scheduler: Scheduler, appointmentData: SafeAppointment, ): boolean => { - const adapter = new AppointmentAdapter(appointmentData, scheduler._dataAccessors); + const adapter = new AppointmentAdapter(appointmentData, scheduler.dataAccessors); if (VERTICAL_VIEW_TYPES.includes(scheduler.currentView.type)) { return isAppointmentTakesAllDay(adapter, scheduler.option('allDayPanelMode')); @@ -68,15 +68,15 @@ const subscribes = { const { info } = utils.dataAccessors.getAppointmentSettings(options.$appointment) as AppointmentItemViewModel; const { startDate } = info.sourceAppointment; - this._checkRecurringAppointment(options.target, options.data, startDate, () => { + this.checkRecurringAppointment(options.target, options.data, startDate, () => { this._updateAppointment(options.target, options.data, function () { - this._appointments.moveAppointmentBack(); + this.appointments.moveAppointmentBack(); }); }); }, getUpdatedData(rawAppointment) { - return this._getUpdatedData(rawAppointment); + return this.getUpdatedData(rawAppointment); }, updateAppointmentAfterDrag({ @@ -85,16 +85,16 @@ const subscribes = { const { info } = utils.dataAccessors.getAppointmentSettings(element) as AppointmentItemViewModel; // NOTE: enrich target appointment with additional data from the source // in case of one appointment of series will change - const targetedRawAppointment = extend({}, rawAppointment, this._getUpdatedData(rawAppointment)); + const targetedRawAppointment = extend({}, rawAppointment, this.getUpdatedData(rawAppointment)); const fromAllDay = Boolean(rawAppointment.allDay); const toAllDay = Boolean(targetedRawAppointment.allDay); - const isDropBetweenAllDay = this._workSpace.supportAllDayRow() && fromAllDay !== toAllDay; + const isDropBetweenAllDay = this.workSpace.supportAllDayRow() && fromAllDay !== toAllDay; const isDragAndDropBetweenComponents = event.fromComponent !== event.toComponent; const onCancel = (): void => { - this._appointments.moveAppointmentBack(event); + this.appointments.moveAppointmentBack(event); }; if (!isDropToSelfScheduler && isDragAndDropBetweenComponents) { // drop between schedulers @@ -102,7 +102,7 @@ const subscribes = { } if (isDropToSelfScheduler && (!isDropToTheSameCell || isDragAndDropBetweenComponents || isDropBetweenAllDay)) { - this._checkRecurringAppointment(rawAppointment, targetedRawAppointment, info.sourceAppointment.startDate, () => { + this.checkRecurringAppointment(rawAppointment, targetedRawAppointment, info.sourceAppointment.startDate, () => { this._updateAppointment(rawAppointment, targetedRawAppointment, onCancel, event); }, undefined, undefined, event); } else { @@ -126,7 +126,7 @@ const subscribes = { ...appointment, ...targetedAppointmentRaw, } as TargetedAppointment; - const adapter = new AppointmentAdapter(targetedAppointment, this._dataAccessors); + const adapter = new AppointmentAdapter(targetedAppointment, this.dataAccessors); // pull out time zone converting from appointment adapter for knockout (T947938) const startDate = targetedAppointment.displayStartDate || this.timeZoneCalculator.createDate(adapter.startDate, 'toGrid'); const endDate = targetedAppointment.displayEndDate || this.timeZoneCalculator.createDate(adapter.endDate, 'toGrid'); @@ -144,7 +144,7 @@ const subscribes = { if (groups?.length) { if (allDay || this.currentView.type === 'month') { - const horizontalGroupBounds = this._workSpace.getGroupBounds(options.coordinates); + const horizontalGroupBounds = this.workSpace.getGroupBounds(options.coordinates); return { left: horizontalGroupBounds.left, right: horizontalGroupBounds.right, @@ -153,8 +153,8 @@ const subscribes = { }; } - if (!allDay && VERTICAL_VIEW_TYPES.includes(this.currentView.type) && this._workSpace._isVerticalGroupedWorkSpace()) { - const verticalGroupBounds = this._workSpace.getGroupBounds(options.coordinates); + if (!allDay && VERTICAL_VIEW_TYPES.includes(this.currentView.type) && this.workSpace._isVerticalGroupedWorkSpace()) { + const verticalGroupBounds = this.workSpace.getGroupBounds(options.coordinates); return { left: 0, right: 0, @@ -221,15 +221,15 @@ const subscribes = { }, renderCompactAppointments(options: CompactAppointmentOptions): dxElementWrapper { - return this._compactAppointmentsHelper.render(options); + return this.compactAppointmentsHelper.render(options); }, clearCompactAppointments() { - this._compactAppointmentsHelper.clear(); + this.compactAppointmentsHelper.clear(); }, getGroupCount() { - return this._workSpace._getGroupCount(); + return this.workSpace._getGroupCount(); }, mapAppointmentFields(config) { @@ -248,7 +248,7 @@ const subscribes = { }, getLayoutManager() { - return this._layoutManager; + return this.layoutManager; }, getAgendaVerticalStepHeight() { @@ -276,11 +276,11 @@ const subscribes = { }, getEndDayHour() { - return this._workSpace.option('endDayHour') || this.option('endDayHour'); + return this.workSpace.option('endDayHour') || this.option('endDayHour'); }, getStartDayHour() { - return this._workSpace.option('startDayHour') || this.option('startDayHour'); + return this.workSpace.option('startDayHour') || this.option('startDayHour'); }, getViewOffsetMs() { @@ -292,7 +292,7 @@ const subscribes = { }, removeDroppableCellClass() { - this._workSpace.removeDroppableCellClass(); + this.workSpace.removeDroppableCellClass(); }, } as const; diff --git a/packages/devextreme/js/__internal/scheduler/view_model/__mock__/scheduler.mock.ts b/packages/devextreme/js/__internal/scheduler/view_model/__mock__/scheduler.mock.ts index 729bace90338..34e91fd71b9f 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/__mock__/scheduler.mock.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/__mock__/scheduler.mock.ts @@ -38,5 +38,5 @@ export const getSchedulerMock = ({ option: (name: string) => ({ firstDayOfWeek: 0, showAllDayPanel: true }[name]), getViewOffsetMs: () => offsetMinutes * 60_000, resourceManager: resourceManager ?? new ResourceManager([]), - _dataAccessors: mockAppointmentDataAccessor, + dataAccessors: mockAppointmentDataAccessor, }) as unknown as Scheduler; diff --git a/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.test.ts b/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.test.ts index 43a7d4160d7b..0b5d379d5d7f 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.test.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.test.ts @@ -27,7 +27,7 @@ describe('getFilterOptions', () => { supportAllDayPanel: false, isDateTimeView: false, resourceManager: schedulerStore.resourceManager, - dataAccessor: schedulerStore._dataAccessors, + dataAccessor: schedulerStore.dataAccessors, timeZone: 'Etc/UTC', firstDayOfWeek: 0, allDayIntervals: [{ diff --git a/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.ts b/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.ts index 605628fcf694..58ee975108e8 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/get_filter_options/get_filter_options.ts @@ -23,7 +23,7 @@ export const getFilterOptions = ( showAllDayPanel: schedulerStore.option('showAllDayPanel'), resourceManager: schedulerStore.resourceManager, timeZone: schedulerStore.getTimeZone(), - dataAccessor: schedulerStore._dataAccessors, + dataAccessor: schedulerStore.dataAccessors, firstDayOfWeek: schedulerStore.option('firstDayOfWeek'), allDayIntervals: shiftIntervals( getVisibleDateTimeIntervals(compareOptions, true), diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/generate_grid_view_model.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/generate_grid_view_model.ts index b91034f26441..33a644339f51 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/generate_grid_view_model.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/generate_grid_view_model.ts @@ -31,7 +31,8 @@ export const generateGridViewModel = ( viewOffset, compareOptions: { endDayHour }, } = optionManager.options; - const { viewDataProvider } = schedulerStore._workSpace; + // @ts-expect-error - TODO: architectural debt — accesses private Scheduler.workSpace + const { viewDataProvider } = schedulerStore.workSpace; const step2 = maybeSplit(items, hasAllDayPanel, (entities, panelName) => { const byGroup = groupByGroupIndex(entities); diff --git a/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.test.ts b/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.test.ts index 33e2bf41f435..b91243c53edc 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.test.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.test.ts @@ -9,7 +9,7 @@ import { prepareAppointments } from './prepare_appointments'; const schedulerMock = { currentView: { type: 'agenda' }, getViewOption: (name: string) => ({ cellDuration: 30, allDayPanelMode: 'all' }[name]), - _dataAccessors: mockAppointmentDataAccessor, + dataAccessors: mockAppointmentDataAccessor, timeZoneCalculator: createTimeZoneCalculator(''), } as unknown as Scheduler; diff --git a/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.ts b/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.ts index 3af52bae686e..496d3c81bf0f 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/preparation/prepare_appointments.ts @@ -10,7 +10,7 @@ export const prepareAppointments = ( items?: Appointment[], ): MinimalAppointmentEntity[] => { const cellDurationInMinutes = schedulerStore.getViewOption('cellDuration'); - const dataAccessors = schedulerStore._dataAccessors; + const { dataAccessors } = schedulerStore; const safeItems = replaceIncorrectEndDate( items, cellDurationInMinutes, diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts index df578104a6a2..048e66d85403 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts @@ -3273,7 +3273,8 @@ const createDragBehaviorConfig = ( const canceled = e.cancel; const { event } = e; const $itemElement = $(e.itemElement); - const appointments = e.component._appointments; + // eslint-disable-next-line prefer-destructuring + const appointments = e.component.appointments; state.itemData = options.getItemData(e.itemElement, appointments); const settings = options.getItemSettings($itemElement, e);