diff --git a/packages/devextreme/eslint-scheduler-allowlist.mjs b/packages/devextreme/eslint-scheduler-allowlist.mjs new file mode 100644 index 000000000000..4e4495c1e38b --- /dev/null +++ b/packages/devextreme/eslint-scheduler-allowlist.mjs @@ -0,0 +1,140 @@ +const schedulerDOMComponentOverrides = [ + '_createActionByOption', + '_defaultOptionsRules', + '_dimensionChanged', + '_dispose', + '_disposed', + '_getDefaultOptions', + '_init', + '_initTemplates', + '_optionChanged', + '_setDeprecatedOptions', + '_setOptionsByReference', + '_useTemplates', + '_visibilityChanged', +]; + +const schedulerWidgetOverrides = [ + '_activeStateUnit', + '_clean', + '_cleanFocusState', + '_eventBindingTarget', + '_fireContentReadyAction', + '_focusInHandler', + '_focusOutHandler', + '_focusTarget', + '_initMarkup', + '_keyboardHandler', + '_render', + '_renderContent', + '_renderFocusState', + '_renderFocusTarget', + '_supportedKeys', + '_toggleVisibility', + '_createAction', + '_createEventArgs', + '_dataSource', + '_dataSourceChangedHandler', + '_dataSourceOptions', + '_options', +]; + +const schedulerCollectionWidgetOverrides = [ + '_cleanItemContainer', + '_clearDropDownItemsElements', + '_createItemByTemplate', + '_executeItemRenderAction', + '_filteredItems', + '_findItemElementByItem', + '_focusedItemIndexBeforeRender', + '_getItemContent', + '_itemClass', + '_itemClickHandler', + '_itemContainer', + '_moveFocus', + '_postprocessRenderItem', + '_processItemClick', + '_refreshActiveDescendant', + '_renderDirection', + '_renderItem', + '_sortedItems', +]; + +const schedulerR1Overrides = [ + '_propsInfo', + '_value', + '_viewComponent', +]; + +const schedulerFrameworkOptions = [ + '_swipeEnabled', + '_loopFocus', +]; + +const schedulerLegacyMembers = [ + // workspaces/m_work_space.ts + '_$allDayPanel', + '_$dateTable', + '_$dateTableScrollableContent', + '_$flexContainer', + '_$groupTable', + '_$headerPanel', + '_$headerPanelContainer', + '_$thead', + '_dateTableScrollable', + '_getCellCount', + '_getGroupCount', + '_groupedStrategy', + '_isHorizontalGroupedWorkSpace', + '_shader', + '_sidebarScrollable', + + // m_scheduler.ts + '_appointments', + '_compactAppointmentsHelper', + '_dataAccessors', + '_getDragBehavior', + '_isAppointmentBeingUpdated', + '_layoutManager', + '_workSpace', + + // appointments/m_appointment_collection.ts + '_renderAppointmentTemplate', + + // workspaces/view_model/m_view_data_generator.ts + '_getIntervalDuration', + + // workspaces/m_virtual_scrolling.ts + '_renderGrid', + + // appointment_popup/m_popup.ts + '_popup', + + // appointment_popup/m_legacy_popup.ts + '_ignorePreventScrollEventsDeprecation', + + // header/m_header.ts + '_useShortDateFormat', + + // header/m_view_switcher.ts + '_wrapperClassExternal', + + // utils/options/constants.ts, utils/options/types.ts + '_appointmentTooltipOffset', + '_draggingMode', + '_appointmentCountPerCell', + '_collectorOffset', + '_appointmentOffset', +]; + +const schedulerMemberAllowlist = [ + ...schedulerDOMComponentOverrides, + ...schedulerWidgetOverrides, + ...schedulerCollectionWidgetOverrides, + ...schedulerR1Overrides, + ...schedulerFrameworkOptions, + ...schedulerLegacyMembers, +]; + +export const schedulerMemberAllowlistRegex = + `^(_|__esModule|${schedulerMemberAllowlist.map(s => s.replace(/\$/g, '\\$')).join('|')})$`; diff --git a/packages/devextreme/eslint.config.mjs b/packages/devextreme/eslint.config.mjs index 344abc543a66..496937899d26 100644 --- a/packages/devextreme/eslint.config.mjs +++ b/packages/devextreme/eslint.config.mjs @@ -15,6 +15,7 @@ import simpleImportSort from 'eslint-plugin-simple-import-sort'; import { changeRulesToStylistic } from 'eslint-migration-utils'; import unicorn from 'eslint-plugin-unicorn'; import customRules from './eslint_plugins/index.js'; +import { schedulerMemberAllowlistRegex } from './eslint-scheduler-allowlist.mjs'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -575,13 +576,40 @@ export default [ { selector: 'memberLike', format: null, - leadingUnderscore: 'allow', + leadingUnderscore: 'forbid', + filter: { + regex: schedulerMemberAllowlistRegex, + match: false, + }, }, ], 'devextreme-custom/no-deferred': 'error', 'devextreme-custom/prefer-switch-true': ['error', { minBranches: 3 }], }, }, + // Temporarily allow underscore members in appointments/ (pending refactoring) + { + files: ['js/__internal/scheduler/appointments/**/*.ts?(x)'], + rules: { + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: ['variable', 'function', 'parameter'], + format: null, + leadingUnderscore: 'forbid', + filter: { + regex: '^_$', + match: false, + }, + }, + { + selector: 'memberLike', + format: null, + leadingUnderscore: 'allow', + }, + ], + }, + }, // Allow Deferred in m_* scheduler files only { files: ['js/__internal/scheduler/**/m_*.ts?(x)'], diff --git a/packages/devextreme/js/__internal/scheduler/__tests__/__mock__/m_mock_scheduler.ts b/packages/devextreme/js/__internal/scheduler/__tests__/__mock__/m_mock_scheduler.ts index 3c452af4307b..baf1f641e39b 100644 --- a/packages/devextreme/js/__internal/scheduler/__tests__/__mock__/m_mock_scheduler.ts +++ b/packages/devextreme/js/__internal/scheduler/__tests__/__mock__/m_mock_scheduler.ts @@ -19,7 +19,7 @@ export const setupSchedulerTestEnvironment = ({ }: SetupSchedulerTestEnvironmentOptions = {}): void => { jest.spyOn(logger, 'warn').mockImplementation(() => {}); DOMComponent.prototype._isVisible = jest.fn((): boolean => true); - SchedulerWorkSpace.prototype._createCrossScrollingConfig = (): { + (SchedulerWorkSpace.prototype as any).createCrossScrollingConfig = (): { direction: string; onScroll: jest.Mock; onEnd: jest.Mock; diff --git a/packages/devextreme/js/__internal/scheduler/__tests__/workspace.base.test.ts b/packages/devextreme/js/__internal/scheduler/__tests__/workspace.base.test.ts index 297f343f1769..47f2db7aa794 100644 --- a/packages/devextreme/js/__internal/scheduler/__tests__/workspace.base.test.ts +++ b/packages/devextreme/js/__internal/scheduler/__tests__/workspace.base.test.ts @@ -58,12 +58,12 @@ describe('scheduler workspace', () => { expect(workspace.cache.clear).toHaveBeenCalledTimes(1); }); - it(`should clear cache on _cleanView call, view: ${currentView}`, () => { + it(`should clear cache on cleanView call, view: ${currentView}`, () => { const workspace = createWorkspace(WorkSpace, currentView); jest.spyOn(workspace.cache, 'clear'); workspace.cache.memo('test', () => 'value'); - workspace._cleanView(); + (workspace as any).cleanView(); expect(workspace.cache.clear).toHaveBeenCalledTimes(1); expect(workspace.cache.size).toBe(0); diff --git a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts index c040d566eb43..9695e56f6abf 100644 --- a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts +++ b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts @@ -103,7 +103,7 @@ export class AppointmentForm { const colSpan = isRecurrence ? 1 : 2; const mainItems = [ - ...this._createMainItems(expr, triggerResize, changeSize, allowTimeZoneEditing), + ...this.createMainItems(expr, triggerResize, changeSize, allowTimeZoneEditing), ...this.scheduler.createResourceEditorModel(), ]; @@ -124,7 +124,7 @@ export class AppointmentForm { name: APPOINTMENT_FORM_GROUP_NAMES.Recurrence, visible: isRecurrence, colSpan, - items: this._createRecurrenceEditor(expr), + items: this.createRecurrenceEditor(expr), }, ]; @@ -152,7 +152,7 @@ export class AppointmentForm { }); } - _dateBoxValueChanged(args, dateExpr, isNeedCorrect) { + private dateBoxValueChanged(args, dateExpr, isNeedCorrect) { validateAppointmentFormDate(args.component, args.value, args.previousValue); const value = dateSerialization.deserializeDate(args.value); @@ -166,7 +166,7 @@ export class AppointmentForm { } } - _createTimezoneEditor(timeZoneExpr, secondTimeZoneExpr, visibleIndex, colSpan, isMainTimeZone, cssClass, visible = false) { + private createTimezoneEditor(timeZoneExpr, secondTimeZoneExpr, visibleIndex, colSpan, isMainTimeZone, cssClass, visible = false) { const noTzTitle = messageLocalization.format('dxScheduler-noTimezoneTitle'); return { @@ -197,7 +197,7 @@ export class AppointmentForm { }; } - _createDateBoxItems(dataExprs, allowTimeZoneEditing) { + private createDateBoxItems(dataExprs, allowTimeZoneEditing) { const colSpan = allowTimeZoneEditing ? 2 : 1; const firstDayOfWeek = this.scheduler.getFirstDayOfWeek(); @@ -209,11 +209,11 @@ export class AppointmentForm { 'dxScheduler-editorLabelStartDate', E2E_TEST_CLASSES.startDateEditor, (args) => { - this._dateBoxValueChanged(args, dataExprs.endDateExpr, (endValue, startValue) => endValue < startValue); + this.dateBoxValueChanged(args, dataExprs.endDateExpr, (endValue, startValue) => endValue < startValue); }, ), - this._createTimezoneEditor( + this.createTimezoneEditor( dataExprs.startDateTimeZoneExpr, dataExprs.endDateTimeZoneExpr, 1, @@ -230,11 +230,11 @@ export class AppointmentForm { 'dxScheduler-editorLabelEndDate', E2E_TEST_CLASSES.endDateEditor, (args) => { - this._dateBoxValueChanged(args, dataExprs.startDateExpr, (startValue, endValue) => endValue < startValue); + this.dateBoxValueChanged(args, dataExprs.startDateExpr, (startValue, endValue) => endValue < startValue); }, ), - this._createTimezoneEditor( + this.createTimezoneEditor( dataExprs.endDateTimeZoneExpr, dataExprs.startDateTimeZoneExpr, 3, @@ -246,7 +246,7 @@ export class AppointmentForm { ]; } - _changeFormItemDateType(name: string, groupName: string, isAllDay: boolean): void { + private changeFormItemDateType(name: string, groupName: string, isAllDay: boolean): void { const editorPath = this.getEditorPath(name, groupName); const itemEditorOptions = this.form.itemOption(editorPath).editorOptions; @@ -257,7 +257,7 @@ export class AppointmentForm { this.form.itemOption(editorPath, 'editorOptions', newEditorOption); } - _createMainItems(dataExprs, triggerResize, changeSize, allowTimeZoneEditing) { + private createMainItems(dataExprs, triggerResize, changeSize, allowTimeZoneEditing) { return [ { name: this.normalizeEditorName(dataExprs.textExpr), @@ -279,7 +279,7 @@ export class AppointmentForm { lg: 2, xs: 1, }, - items: this._createDateBoxItems(dataExprs, allowTimeZoneEditing), + items: this.createDateBoxItems(dataExprs, allowTimeZoneEditing), }, { itemType: 'group', @@ -317,8 +317,8 @@ export class AppointmentForm { } } - this._changeFormItemDateType(dataExprs.startDateExpr, 'Main', value); - this._changeFormItemDateType(dataExprs.endDateExpr, 'Main', value); + this.changeFormItemDateType(dataExprs.startDateExpr, 'Main', value); + this.changeFormItemDateType(dataExprs.endDateExpr, 'Main', value); }, }, }, { @@ -370,7 +370,7 @@ export class AppointmentForm { ]; } - _createRecurrenceEditor(dataExprs) { + private createRecurrenceEditor(dataExprs) { return [{ name: this.normalizeEditorName(dataExprs.recurrenceRuleExpr), dataField: dataExprs.recurrenceRuleExpr, diff --git a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts index efb8729ea4b1..ac028be50ac4 100644 --- a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts +++ b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts @@ -79,15 +79,15 @@ export class AppointmentPopup { this.state.excludeInfo = config.excludeInfo; if (!this.popup) { - const popupConfig = this._createPopupConfig(); - this.popup = this._createPopup(popupConfig); + const popupConfig = this.createPopupConfig(); + this.popup = this.createPopup(popupConfig); } this.popup.option( 'toolbarItems', getPopupToolbarItems( config.isToolbarVisible, - (e) => this._doneButtonClickHandler(e), + (e) => this.doneButtonClickHandler(e), ), ); @@ -102,7 +102,7 @@ export class AppointmentPopup { this.popup?.$element().remove(); } - _createPopup(options) { + private createPopup(options) { const popupElement = $('
') .addClass(APPOINTMENT_POPUP_CLASS) .appendTo(this.scheduler.getElement()); @@ -110,18 +110,18 @@ export class AppointmentPopup { return this.scheduler.createComponent(popupElement, Popup, options); } - _createPopupConfig() { + private createPopupConfig() { return { ...POPUP_CONFIG, onHiding: () => this.scheduler.focus(), - contentTemplate: () => this._createPopupContent(), - onShowing: (e) => this._onShowing(e), + contentTemplate: () => this.createPopupContent(), + onShowing: (e) => this.onShowing(e), wrapperAttr: { class: APPOINTMENT_POPUP_CLASS }, }; } - _onShowing(e) { - this._updateForm(); + private onShowing(e) { + this.updateForm(); e.component.$overlayContent().attr( 'aria-label', @@ -145,13 +145,13 @@ export class AppointmentPopup { }); } - _createPopupContent() { - this._createForm(); + private createPopupContent() { + this.createForm(); return this.form.dxForm.$element(); // TODO } - _createFormData(rawAppointment) { - const appointment = this._createAppointmentAdapter(rawAppointment); + private createFormData(rawAppointment) { + const appointment = this.createAppointmentAdapter(rawAppointment); const resourceManager = this.scheduler.getResourceManager(); const rawAppointmentGroupValues = getRawAppointmentGroupValues( rawAppointment, @@ -165,15 +165,15 @@ export class AppointmentPopup { }; } - _createForm() { + private createForm() { const rawAppointment = this.state.appointment.data; - const formData = this._createFormData(rawAppointment); + const formData = this.createFormData(rawAppointment); this.form.create(this.triggerResize.bind(this), this.changeSize.bind(this), formData); // TODO } - _isReadOnly(rawAppointment) { - const appointment = this._createAppointmentAdapter(rawAppointment); + private isReadOnly(rawAppointment) { + const appointment = this.createAppointmentAdapter(rawAppointment); if (rawAppointment && appointment.disabled) { return true; @@ -186,22 +186,22 @@ export class AppointmentPopup { return !this.scheduler.getEditingConfig().allowUpdating; } - _createAppointmentAdapter(rawAppointment) { + private createAppointmentAdapter(rawAppointment) { return new AppointmentAdapter( rawAppointment, this.scheduler.getDataAccessors(), ); } - _updateForm() { + private updateForm() { const { data } = this.state.appointment; - const appointment = this._createFormData(data); - const formData = this._createAppointmentAdapter(appointment) + const appointment = this.createFormData(data); + const formData = this.createAppointmentAdapter(appointment) .clone() .calculateDates(this.scheduler.getTimeZoneCalculator(), 'toAppointment') .source; - this.form.readOnly = this._isReadOnly(formData); + this.form.readOnly = this.isReadOnly(formData); this.form.updateFormData(formData); } @@ -237,7 +237,7 @@ export class AppointmentPopup { const deferred = new Deferred(); const validation = this.form.dxForm.validate(); - isShowLoadPanel && this._showLoadPanel(); + isShowLoadPanel && this.showLoadPanel(); when(validation?.complete || validation).done((validation) => { if (validation && !validation.isValid) { @@ -247,13 +247,13 @@ export class AppointmentPopup { } const { repeat } = this.form.formData; - const adapter = this._createAppointmentAdapter(this.form.formData); + const adapter = this.createAppointmentAdapter(this.form.formData); const clonedAdapter = adapter .clone() .calculateDates(this.scheduler.getTimeZoneCalculator(), 'fromAppointment'); const shouldClearRecurrenceRule = !repeat && Boolean(clonedAdapter.recurrenceRule); - this._addMissingDSTTime(adapter, clonedAdapter); + this.addMissingDSTTime(adapter, clonedAdapter); if (shouldClearRecurrenceRule) { clonedAdapter.recurrenceRule = ''; @@ -286,7 +286,7 @@ export class AppointmentPopup { return deferred.promise(); } - _doneButtonClickHandler(e) { + private doneButtonClickHandler(e) { e.cancel = true; this.saveEditDataAsync(); } @@ -295,10 +295,10 @@ export class AppointmentPopup { // @ts-expect-error const deferred = new Deferred(); - if (this._tryLockSaveChanges()) { + if (this.tryLockSaveChanges()) { when(this.saveChangesAsync(true)).done(() => { if (this.state.lastEditData) { // TODO - const adapter = this._createAppointmentAdapter(this.state.lastEditData); + const adapter = this.createAppointmentAdapter(this.state.lastEditData); const { startDate, endDate, allDay } = adapter; @@ -316,7 +316,7 @@ export class AppointmentPopup { this.state.lastEditData = null; } - this._unlockSaveChanges(); + this.unlockSaveChanges(); deferred.resolve(); }); @@ -325,7 +325,7 @@ export class AppointmentPopup { return deferred.promise(); } - _showLoadPanel() { + private showLoadPanel() { const container = this.popup.$overlayContent(); showLoading({ @@ -336,7 +336,7 @@ export class AppointmentPopup { }); } - _tryLockSaveChanges() { + private tryLockSaveChanges() { if (this.state.saveChangesLocker === false) { this.state.saveChangesLocker = true; return true; @@ -344,22 +344,22 @@ export class AppointmentPopup { return false; } - _unlockSaveChanges() { + private unlockSaveChanges() { this.state.saveChangesLocker = false; } // NOTE: Fix ticket T1102713 - _addMissingDSTTime(formAppointmentAdapter, clonedAppointmentAdapter) { + private addMissingDSTTime(formAppointmentAdapter, clonedAppointmentAdapter) { const timeZoneCalculator = this.scheduler.getTimeZoneCalculator(); - clonedAppointmentAdapter.startDate = this._addMissingDSTShiftToDate( + clonedAppointmentAdapter.startDate = this.addMissingDSTShiftToDate( timeZoneCalculator, formAppointmentAdapter.startDate, clonedAppointmentAdapter.startDate, ); if (clonedAppointmentAdapter.endDate) { - clonedAppointmentAdapter.endDate = this._addMissingDSTShiftToDate( + clonedAppointmentAdapter.endDate = this.addMissingDSTShiftToDate( timeZoneCalculator, formAppointmentAdapter.endDate, clonedAppointmentAdapter.endDate, @@ -367,7 +367,7 @@ export class AppointmentPopup { } } - _addMissingDSTShiftToDate(timeZoneCalculator, originFormDate, clonedDate) { + private addMissingDSTShiftToDate(timeZoneCalculator, originFormDate, clonedDate) { const originTimezoneShift = timeZoneCalculator.getOffsets(originFormDate)?.common; const clonedTimezoneShift = timeZoneCalculator.getOffsets(clonedDate)?.common; const shiftDifference = originTimezoneShift - clonedTimezoneShift; diff --git a/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts b/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts index d8152314dfae..2eb2b5526805 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts @@ -17,24 +17,24 @@ const CALENDAR_CLASS = 'dx-scheduler-navigator-calendar'; const CALENDAR_POPOVER_CLASS = 'dx-scheduler-navigator-calendar-popover'; export default class SchedulerCalendar extends Widget { - _overlay?: Popup | Popover; + private overlay?: Popup | Popover; - _calendar?: Calendar; + private calendar?: Calendar; public async show(target: HTMLElement): Promise { - if (!SchedulerCalendar._isMobileLayout()) { - this._overlay?.option('target', target); + if (!SchedulerCalendar.isMobileLayout()) { + this.overlay?.option('target', target); } - await this._overlay?.show(); + await this.overlay?.show(); } public async hide(): Promise { - await this._overlay?.hide(); + await this.overlay?.hide(); } public _keyboardHandler(opts: KeyboardKeyDownEvent): boolean { - return this._calendar?._keyboardHandler(opts) ?? false; + return this.calendar?._keyboardHandler(opts) ?? false; } public _init(): void { @@ -44,18 +44,18 @@ export default class SchedulerCalendar extends Widget { public _render(): void { super._render(); - this._renderOverlay(); + this.renderOverlay(); } - private _renderOverlay(): void { + private renderOverlay(): void { this.$element().addClass(CALENDAR_POPOVER_CLASS); - const isMobileLayout = SchedulerCalendar._isMobileLayout(); + const isMobileLayout = SchedulerCalendar.isMobileLayout(); const overlayConfig = { - contentTemplate: (): dxElementWrapper => this._createOverlayContent(), + contentTemplate: (): dxElementWrapper => this.createOverlayContent(), onShown: (): void => { - this._calendar?.focus(); + this.calendar?.focus(); }, defaultOptionsRules: [ { @@ -73,25 +73,25 @@ export default class SchedulerCalendar extends Widget { }; if (isMobileLayout) { - this._overlay = this._createComponent(this.$element(), Popup, overlayConfig); + this.overlay = this._createComponent(this.$element(), Popup, overlayConfig); } else { - this._overlay = this._createComponent(this.$element(), Popover, overlayConfig); + this.overlay = this._createComponent(this.$element(), Popover, overlayConfig); } } - private _createOverlayContent(): dxElementWrapper { + private createOverlayContent(): dxElementWrapper { const result = $('
').addClass(CALENDAR_CLASS); - this._calendar = this._createComponent(result, Calendar, this._getCalendarOptions()); + this.calendar = this._createComponent(result, Calendar, this.getCalendarOptions()); - if (SchedulerCalendar._isMobileLayout()) { - const scrollable = this._createScrollable(result); + if (SchedulerCalendar.isMobileLayout()) { + const scrollable = this.createScrollable(result); return scrollable.$element(); } return result; } - private _createScrollable(content: dxElementWrapper): Scrollable { + private createScrollable(content: dxElementWrapper): Scrollable { const result = this._createComponent('
', Scrollable, { height: 'auto', direction: 'both', @@ -108,14 +108,14 @@ export default class SchedulerCalendar extends Widget { switch (name) { case 'value': - this._calendar?.option('value', value); + this.calendar?.option('value', value); break; default: break; } } - private _getCalendarOptions(): CalendarProperties { + private getCalendarOptions(): CalendarProperties { const { value, min, max, firstDayOfWeek, focusStateEnabled, tabIndex, onValueChanged, } = this.option(); @@ -132,7 +132,7 @@ export default class SchedulerCalendar extends Widget { }; } - private static _isMobileLayout(): boolean { + private static isMobileLayout(): boolean { return !devices.current().generic; } } diff --git a/packages/devextreme/js/__internal/scheduler/header/m_date_navigator.ts b/packages/devextreme/js/__internal/scheduler/header/m_date_navigator.ts index fed6d888091b..fc4a8a8dc29c 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_date_navigator.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_date_navigator.ts @@ -41,11 +41,11 @@ const isPreviousButtonDisabled = (header: SchedulerHeader): boolean => { if (!dateUtilsTs.isValidDate(minOption)) return false; let min = new Date(minOption); - const caption = header._getCaption(); + const caption = header.getCaption(); min = trimTime(min); - const previousDate = header._getNextDate(Direction.Left, caption.endDate); + const previousDate = header.getNextDate(Direction.Left, caption.endDate); return previousDate < min; }; @@ -55,11 +55,11 @@ const isNextButtonDisabled = (header: SchedulerHeader): boolean => { if (!dateUtilsTs.isValidDate(maxOption)) return false; const max = new Date(maxOption); - const caption = header._getCaption(); + const caption = header.getCaption(); max.setHours(23, 59, 59); - const nextDate = header._getNextDate(Direction.Right, caption.startDate); + const nextDate = header.getNextDate(Direction.Right, caption.startDate); return nextDate > max; }; @@ -73,20 +73,20 @@ const getPreviousButtonOptions = (header: SchedulerHeader): DateNavigatorItem => class: CLASS.previousButton, 'aria-label': ariaMessage, }, - clickHandler: () => header._updateDateByDirection(Direction.Left), + clickHandler: () => header.updateDateByDirection(Direction.Left), onContentReady: (event): void => { const previousButton = event.component; previousButton.option('disabled', isPreviousButtonDisabled(header)); - header._addEvent('min', () => { + header.addEvent('min', () => { previousButton.option('disabled', isPreviousButtonDisabled(header)); }); - header._addEvent('currentDate', () => { + header.addEvent('currentDate', () => { previousButton.option('disabled', isPreviousButtonDisabled(header)); }); - header._addEvent('startViewDate', () => { + header.addEvent('startViewDate', () => { previousButton.option('disabled', isPreviousButtonDisabled(header)); }); }, @@ -97,27 +97,27 @@ const getCalendarButtonOptions = (header: SchedulerHeader): DateNavigatorItem => key: ITEMS_NAME.calendarButton, text: header.captionText, elementAttr: { class: CLASS.calendarButton }, - clickHandler: (event) => header._showCalendar(event), + clickHandler: (event) => header.showCalendar(event), onContentReady: (event): void => { const calendarButton = event.component; - header._addEvent('currentView', () => { + header.addEvent('currentView', () => { calendarButton.option('text', header.captionText); }); - header._addEvent('currentDate', () => { + header.addEvent('currentDate', () => { calendarButton.option('text', header.captionText); }); - header._addEvent('startViewDate', () => { + header.addEvent('startViewDate', () => { calendarButton.option('text', header.captionText); }); - header._addEvent('views', () => { + header.addEvent('views', () => { calendarButton.option('text', header.captionText); }); - header._addEvent('firstDayOfWeek', () => { + header.addEvent('firstDayOfWeek', () => { calendarButton.option('text', header.captionText); }); }, @@ -133,21 +133,21 @@ const getNextButtonOptions = (header: SchedulerHeader): DateNavigatorItem => { class: CLASS.nextButton, 'aria-label': ariaMessage, }, - clickHandler: () => header._updateDateByDirection(Direction.Right), + clickHandler: () => header.updateDateByDirection(Direction.Right), onContentReady: (event): void => { const nextButton = event.component; nextButton.option('disabled', isNextButtonDisabled(header)); - header._addEvent('min', () => { + header.addEvent('min', () => { nextButton.option('disabled', isNextButtonDisabled(header)); }); - header._addEvent('currentDate', () => { + header.addEvent('currentDate', () => { nextButton.option('disabled', isNextButtonDisabled(header)); }); - header._addEvent('startViewDate', () => { + header.addEvent('startViewDate', () => { nextButton.option('disabled', isNextButtonDisabled(header)); }); }, @@ -168,8 +168,8 @@ export const getTodayButtonOptions = ( stylingMode: 'outlined', type: 'normal', onClick() { - const headerOptions = header.option(); - header._updateCurrentDate(headerOptions.indicatorTime ?? new Date()); + const { indicatorTime } = header.option(); + header.updateCurrentDate(indicatorTime ?? new Date()); }, }, }, item) as ToolbarItem; diff --git a/packages/devextreme/js/__internal/scheduler/header/m_header.ts b/packages/devextreme/js/__internal/scheduler/header/m_header.ts index d511504215c3..5e47e2662909 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_header.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_header.ts @@ -48,12 +48,12 @@ const ITEM_NAMES = { export class SchedulerHeader extends Widget { eventMap!: Map; - _toolbar?: Toolbar; + private toolbar?: Toolbar; - _calendar?: SchedulerCalendar; + private calendar?: SchedulerCalendar; get captionText(): string { - return this._getCaption().text; + return this.getCaption().text; } public getIntervalOptions(date: Date): IntervalOptions { @@ -75,13 +75,13 @@ export class SchedulerHeader extends Widget { }) as HeaderOptions; } - private _createEventMap(): void { + private createEventMap(): void { this.eventMap = new Map([ ['currentView', []], ['views', []], - ['currentDate', [this._getCalendarOptionUpdater('value')]], - ['min', [this._getCalendarOptionUpdater('min')]], - ['max', [this._getCalendarOptionUpdater('max')]], + ['currentDate', [this.getCalendarOptionUpdater('value')]], + ['min', [this.getCalendarOptionUpdater('min')]], + ['max', [this.getCalendarOptionUpdater('max')]], ['tabIndex', [this.repaint.bind(this)]], ['focusStateEnabled', [this.repaint.bind(this)]], ['useDropDownViewSwitcher', [this.repaint.bind(this)]], @@ -89,7 +89,7 @@ export class SchedulerHeader extends Widget { ] as [string, EventMapHandler[]][]); } - public _addEvent(name: string, event: EventMapHandler): void { + public addEvent(name: string, event: EventMapHandler): void { const events = this.eventMap.get(name) ?? []; this.eventMap.set(name, [...events, event]); } @@ -115,22 +115,22 @@ export class SchedulerHeader extends Widget { this.repaint(); break; case fullName === 'toolbar.items': - this._toolbar?.option( + this.toolbar?.option( 'items', - (value as []).map((item: ToolbarItem) => this._parseItem(item)), + (value as []).map((item: ToolbarItem) => this.parseItem(item)), ); break; case parts[1] === 'items' && parts.length === 3: - this._toolbar?.option(optionName, this._parseItem(value as ToolbarItem)); + this.toolbar?.option(optionName, this.parseItem(value as ToolbarItem)); break; default: - this._toolbar?.option(optionName, value); + this.toolbar?.option(optionName, value); } } public _init(): void { super._init(); - this._createEventMap(); + this.createEventMap(); this.$element().addClass(CLASSES.component); } @@ -138,18 +138,18 @@ export class SchedulerHeader extends Widget { public _render(): void { super._render(); - this._createEventMap(); - this._renderToolbar(); + this.createEventMap(); + this.renderToolbar(); this._toggleVisibility(); } - private _renderToolbar(): void { - const config = this._createToolbarConfig(); + private renderToolbar(): void { + const config = this.createToolbarConfig(); const toolbarElement = $('
'); toolbarElement.appendTo(this.$element()); - this._toolbar = this._createComponent(toolbarElement, Toolbar, config); + this.toolbar = this._createComponent(toolbarElement, Toolbar, config); } public _toggleVisibility(): void { @@ -163,9 +163,9 @@ export class SchedulerHeader extends Widget { } } - private _createToolbarConfig(): SafeSchedulerOptions['toolbar'] { + private createToolbarConfig(): SafeSchedulerOptions['toolbar'] { const { toolbar } = this.option(); - const parsedItems = toolbar.items.map((element) => this._parseItem(element)); + const parsedItems = toolbar.items.map((element) => this.parseItem(element)); return { ...toolbar, @@ -173,7 +173,7 @@ export class SchedulerHeader extends Widget { }; } - private _parseItem(item: ToolbarItem | string): ToolbarItem { + private parseItem(item: ToolbarItem | string): ToolbarItem { const itemName = typeof item === 'string' ? item : item.name; const itemOptions = typeof item === 'string' ? {} : item; @@ -186,7 +186,7 @@ export class SchedulerHeader extends Widget { ? getDropDownViewSwitcher(this, itemOptions) : getTabViewSwitcher(this, itemOptions); case ITEM_NAMES.dateNavigator: - this._renderCalendar(); + this.renderCalendar(); return getDateNavigator(this, itemOptions); default: @@ -197,33 +197,33 @@ export class SchedulerHeader extends Widget { return extend(true, {}, item) as ToolbarItem; } - private _callEvent(event: string, arg: unknown): void { + private callEvent(event: string, arg: unknown): void { const events = this.eventMap.get(event); - events?.forEach((EventMapHandler) => EventMapHandler(arg)); + events?.forEach((eventMapHandler) => eventMapHandler(arg)); } - public _updateCurrentView(view: Required): void { + public updateCurrentView(view: Required): void { const { onCurrentViewChange } = this.option(); onCurrentViewChange(view.name); } - private _updateCalendarValueAndCurrentDate(date: Date): void { - this._updateCurrentDate(date); - this._calendar?.option('value', date); + private updateCalendarValueAndCurrentDate(date: Date): void { + this.updateCurrentDate(date); + this.calendar?.option('value', date); } - public _updateCurrentDate(date: Date): void { + public updateCurrentDate(date: Date): void { const { onCurrentDateChange } = this.option(); onCurrentDateChange(date); - this._callEvent('currentDate', date); + this.callEvent('currentDate', date); } - private _renderCalendar(): void { + private renderCalendar(): void { const { currentDate, min, max, firstDayOfWeek, focusStateEnabled, tabIndex, } = this.option(); - this._calendar = this._createComponent('
', SchedulerCalendar, { + this.calendar = this._createComponent('
', SchedulerCalendar, { value: currentDate, min, max, @@ -231,23 +231,23 @@ export class SchedulerHeader extends Widget { focusStateEnabled, tabIndex, onValueChanged: async (e) => { - this._updateCurrentDate(e.value); - await this._calendar?.hide(); + this.updateCurrentDate(e.value); + await this.calendar?.hide(); }, }); - this._calendar.$element().appendTo(this.$element()); + this.calendar.$element().appendTo(this.$element()); } - private _getCalendarOptionUpdater(name: string) { + private getCalendarOptionUpdater(name: string) { return (value: unknown): void => { - if (this._calendar) { - this._calendar.option(name, value); + if (this.calendar) { + this.calendar.option(name, value); } }; } - public _getNextDate(direction: Direction, initialDate?: Date): Date { + public getNextDate(direction: Direction, initialDate?: Date): Date { const { currentDate } = this.option(); const date = initialDate ?? currentDate; const options = this.getIntervalOptions(date); @@ -255,19 +255,19 @@ export class SchedulerHeader extends Widget { return getNextIntervalDate(options, direction); } - private _getDisplayedDate(): Date { + private getDisplayedDate(): Date { const { startViewDate, currentView } = this.option(); const isMonth = currentView.type === 'month'; return isMonth ? nextWeek(startViewDate) : startViewDate; } - private _getCaptionOptions(): IntervalOptions { + private getCaptionOptions(): IntervalOptions { const { currentDate, startViewDate } = this.option(); let date = currentDate; if (startViewDate) { - date = this._getDisplayedDate(); + date = this.getDisplayedDate(); } date = dateUtils.trimTime(date); @@ -275,22 +275,22 @@ export class SchedulerHeader extends Widget { return this.getIntervalOptions(date); } - public _getCaption(): DateNavigatorTextInfo { + public getCaption(): DateNavigatorTextInfo { const { customizeDateNavigatorText } = this.option(); - const options = this._getCaptionOptions(); + const options = this.getCaptionOptions(); const useShortDateFormat = this.option()._useShortDateFormat; return getCaption(options, Boolean(useShortDateFormat), customizeDateNavigatorText); } - public _updateDateByDirection(direction: Direction): void { - const date = this._getNextDate(direction); + public updateDateByDirection(direction: Direction): void { + const date = this.getNextDate(direction); - this._updateCalendarValueAndCurrentDate(date); + this.updateCalendarValueAndCurrentDate(date); } - public async _showCalendar(e: ItemClickEvent): Promise { - await this._calendar?.show(e.element); + public async showCalendar(e: ItemClickEvent): Promise { + await this.calendar?.show(e.element); } } diff --git a/packages/devextreme/js/__internal/scheduler/header/m_view_switcher.ts b/packages/devextreme/js/__internal/scheduler/header/m_view_switcher.ts index 3c4dbabccebe..76ae6d55080d 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_view_switcher.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_view_switcher.ts @@ -51,12 +51,12 @@ export const getTabViewSwitcher = ( selectedItemKeys: [selectedView], stylingMode, onItemClick: (e) => { - header._updateCurrentView(e.itemData); + header.updateCurrentView(e.itemData); }, onContentReady: (e) => { const viewSwitcher = e.component; - header._addEvent('currentView', (view) => { + header.addEvent('currentView', (view) => { viewSwitcher.option('selectedItemKeys', [getViewName(view as NormalizedView)]); }); }, @@ -89,12 +89,12 @@ export const getDropDownViewSwitcher = ( class: ClASS.dropDownButton, }, onItemClick: (e) => { - header._updateCurrentView(e.itemData); + header.updateCurrentView(e.itemData); }, onContentReady: (e) => { const viewSwitcher = e.component; - header._addEvent('currentView', (view) => { + header.addEvent('currentView', (view) => { const { views: currentViews } = header.option(); viewSwitcher.option('showArrowIcon', !isOneView(currentViews, (view as NormalizedView).name)); 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 f03257766c25..538c2f9244e4 100644 --- a/packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts +++ b/packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts @@ -26,8 +26,8 @@ export class CompactAppointmentsHelper { render(options: CompactAppointmentOptions): dxElementWrapper { const { isCompact, items } = options; - const template = this._createTemplate(items.length, isCompact); - const button = this._createCompactButton(template, options); + const template = this.createTemplate(items.length, isCompact); + const button = this.createCompactButton(template, options); const $button = button.$element(); this.elements.push($button); @@ -44,34 +44,34 @@ export class CompactAppointmentsHelper { this.elements = []; } - _onButtonClick(e, options: CompactAppointmentOptions) { + private onButtonClick(e, options: CompactAppointmentOptions) { const $button = $(e.element); this.instance.showAppointmentTooltipCore( $button, // @ts-expect-error $button.data('items'), - this._getExtraOptionsForTooltip(options, $button), + this.getExtraOptionsForTooltip(options, $button), ); } - _getExtraOptionsForTooltip(options: CompactAppointmentOptions, $appointmentCollector) { + private getExtraOptionsForTooltip(options: CompactAppointmentOptions, $appointmentCollector) { return { - clickEvent: this._clickEvent(options.onAppointmentClick).bind(this), - dragBehavior: options.allowDrag && this._createTooltipDragBehavior($appointmentCollector).bind(this), + clickEvent: this.clickEvent(options.onAppointmentClick).bind(this), + dragBehavior: options.allowDrag && this.createTooltipDragBehavior($appointmentCollector).bind(this), dropDownAppointmentTemplate: this.instance.option().dropDownAppointmentTemplate, // TODO deprecated option isButtonClick: true, - _loopFocus: true, + tabFocusLoopEnabled: true, }; } - _clickEvent(onAppointmentClick) { + private clickEvent(onAppointmentClick) { return (e) => { const clickEventArgs = this.instance._createEventArgs(e); onAppointmentClick(clickEventArgs); }; } - _createTooltipDragBehavior($appointmentCollector) { + private createTooltipDragBehavior($appointmentCollector) { return (e) => { const $element = $(e.element); const $schedulerElement = $(this.instance.element()); @@ -93,30 +93,30 @@ export class CompactAppointmentsHelper { }; } - _setPosition(element, position) { + private setPosition(element, position) { move(element, { top: position.top, left: position.left, }); } - _createCompactButton(template, options: CompactAppointmentOptions) { - const $button = this._createCompactButtonElement(options); + private createCompactButton(template, options: CompactAppointmentOptions) { + const $button = this.createCompactButtonElement(options); // @ts-expect-error return this.instance._createComponent($button, Button, { type: 'default', width: options.width, height: options.height, - onClick: (e) => this._onButtonClick(e, options), - template: this._renderTemplate(template, options.items, options.isCompact), + onClick: (e) => this.onButtonClick(e, options), + template: this.renderTemplate(template, options.items, options.isCompact), }); } - _createCompactButtonElement({ + private createCompactButtonElement({ isCompact, $container, coordinates, sortedIndex, items, }: CompactAppointmentOptions) { - const appointmentDate = this._getDateText( + const appointmentDate = this.getDateText( items[0].appointment, items[0].targetedAppointment, ); @@ -128,12 +128,12 @@ export class CompactAppointmentsHelper { result.data(APPOINTMENT_SETTINGS_KEY, { sortedIndex }); - this._setPosition(result, coordinates); + this.setPosition(result, coordinates); return result; } - _renderTemplate(template, items: AppointmentTooltipItem[], isCompact) { + private renderTemplate(template, items: AppointmentTooltipItem[], isCompact) { return new (FunctionTemplate as any)((options) => template.render({ model: { appointmentCount: items.length, @@ -144,18 +144,18 @@ export class CompactAppointmentsHelper { })); } - _createTemplate(count, isCompact) { - this._initButtonTemplate(count, isCompact); + private createTemplate(count, isCompact) { + this.initButtonTemplate(count, isCompact); return this.instance.getAppointmentTemplate('appointmentCollectorTemplate'); } - _initButtonTemplate(count, isCompact) { + private initButtonTemplate(count, isCompact) { this.instance._templateManager.addDefaultTemplates({ - appointmentCollector: new (FunctionTemplate as any)((options) => this._createButtonTemplate(count, $(options.container), isCompact)), + appointmentCollector: new (FunctionTemplate as any)((options) => this.createButtonTemplate(count, $(options.container), isCompact)), }); } - _createButtonTemplate(appointmentCount, element, isCompact) { + private createButtonTemplate(appointmentCount, element, isCompact) { const text = isCompact ? appointmentCount : (messageLocalization.getFormatter('dxScheduler-moreAppointments') as any)(appointmentCount); @@ -165,19 +165,19 @@ export class CompactAppointmentsHelper { .addClass(APPOINTMENT_COLLECTOR_CONTENT_CLASS); } - _localizeDate(date) { + private localizeDate(date) { return `${dateLocalization.format(date, 'monthAndDay')}, ${dateLocalization.format(date, 'year')}`; } - _getDateText( + private getDateText( appointment: Appointment, targetedAppointment: Appointment | TargetedAppointment | undefined, ): string { const startDate = targetedAppointment?.displayStartDate ?? appointment.startDate; const endDate = targetedAppointment?.displayEndDate ?? appointment.endDate; - const startDateText = this._localizeDate(startDate); - const endDateText = this._localizeDate(endDate); + const startDateText = this.localizeDate(startDate); + const endDateText = this.localizeDate(endDate); return startDateText === endDateText ? startDateText diff --git a/packages/devextreme/js/__internal/scheduler/m_scheduler.ts b/packages/devextreme/js/__internal/scheduler/m_scheduler.ts index 75cda7828218..d6c79d2dd6b9 100644 --- a/packages/devextreme/js/__internal/scheduler/m_scheduler.ts +++ b/packages/devextreme/js/__internal/scheduler/m_scheduler.ts @@ -159,7 +159,7 @@ 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 timeZoneCalculatorInstance!: any; postponedOperations: any; @@ -213,7 +213,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { private mainContainer: any; - _all: any; + private readonly all: any; _options: any; @@ -222,11 +222,11 @@ class Scheduler extends SchedulerOptionsBaseWidget { private timeZonesPromise!: Promise; get timeZoneCalculator() { - if (!this._timeZoneCalculator) { - this._timeZoneCalculator = createTimeZoneCalculator(this.option('timeZone')); + if (!this.timeZoneCalculatorInstance) { + this.timeZoneCalculatorInstance = createTimeZoneCalculator(this.option('timeZone')); } - return this._timeZoneCalculator; + return this.timeZoneCalculatorInstance; } private postponeDataSourceLoading(promise?: any) { @@ -412,7 +412,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { this._appointments.option('items', []); this.refreshWorkSpace(); if (this.readyToRenderAppointments) { - this._appointments.option('items', this._getAppointmentsToRepaint()); + this._appointments.option('items', this.getAppointmentsToRepaint()); } }); break; @@ -421,7 +421,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { this._appointments.option('items', []); if (this.readyToRenderAppointments) { this.updateOption('workSpace', 'hoursInterval', value / 60); - this._appointments.option('items', this._getAppointmentsToRepaint()); + this._appointments.option('items', this.getAppointmentsToRepaint()); } break; case 'tabIndex': @@ -777,7 +777,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } updateAppointmentDataSource() { - this._timeZoneCalculator = null; + this.timeZoneCalculatorInstance = null; if (this.getWorkSpace()) { this.createAppointmentDataSource(); @@ -879,14 +879,14 @@ class Scheduler extends SchedulerOptionsBaseWidget { // @ts-expect-error const viewModel: AppointmentViewModelPlain[] = this._isVisible() - ? this._getAppointmentsToRepaint() + ? this.getAppointmentsToRepaint() : []; this._appointments.option('items', viewModel); this.appointmentDataSource.cleanState(); } - _getAppointmentsToRepaint(): AppointmentViewModelPlain[] { + getAppointmentsToRepaint(): AppointmentViewModelPlain[] { const appointmentsMap = this._layoutManager.createAppointmentsMap(); return appointmentsMap; } @@ -1296,7 +1296,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { // @ts-expect-error this._workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig); - this.allowDragging() && this._workSpace.initDragBehavior(this, this._all); + this.allowDragging() && this._workSpace.initDragBehavior(this, this.all); this._workSpace.attachTablesEvents(); this._workSpace.getWorkArea().append(this._appointments.$element()); diff --git a/packages/devextreme/js/__internal/scheduler/m_subscribes.ts b/packages/devextreme/js/__internal/scheduler/m_subscribes.ts index f6e772f5bc09..26f8a025e16e 100644 --- a/packages/devextreme/js/__internal/scheduler/m_subscribes.ts +++ b/packages/devextreme/js/__internal/scheduler/m_subscribes.ts @@ -144,7 +144,7 @@ const subscribes = { }; }, - _createAppointmentTitle(data) { + createAppointmentTitle(data) { if (isPlainObject(data)) { return data.text; } diff --git a/packages/devextreme/js/__internal/scheduler/m_table_creator.ts b/packages/devextreme/js/__internal/scheduler/m_table_creator.ts index 9af94f69319a..766e45e5bee2 100644 --- a/packages/devextreme/js/__internal/scheduler/m_table_creator.ts +++ b/packages/devextreme/js/__internal/scheduler/m_table_creator.ts @@ -133,9 +133,9 @@ class SchedulerTableCreator { let rows: any = []; if (type === this.VERTICAL) { - rows = this._makeVerticalGroupedRows(groups, cssClasses, cellTemplate, rowCount); + rows = this.makeVerticalGroupedRows(groups, cssClasses, cellTemplate, rowCount); } else { - rows = this._makeHorizontalGroupedRows(groups, cssClasses, cellCount, cellTemplate, groupByDate); + rows = this.makeHorizontalGroupedRows(groups, cssClasses, cellCount, cellTemplate, groupByDate); } return rows; @@ -244,7 +244,7 @@ class SchedulerTableCreator { return table; } - _makeFlexGroupedRowCells(group, repeatCount, cssClasses, cellTemplate, repeatByDate = 1) { + private makeFlexGroupedRowCells(group, repeatCount, cssClasses, cellTemplate, repeatByDate = 1) { const cells: any[] = []; const { items } = group; const itemCount = items.length; @@ -283,7 +283,7 @@ class SchedulerTableCreator { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _makeVerticalGroupedRows(groups, cssClasses, cellTemplate, rowCount?: any) { + private makeVerticalGroupedRows(groups, cssClasses, cellTemplate, rowCount?: any) { const cellTemplates: any = []; let repeatCount = 1; const cellsArray: any = []; @@ -300,7 +300,7 @@ class SchedulerTableCreator { repeatCount = groups[i - 1].items.length * repeatCount; } - const cells = this._makeFlexGroupedRowCells(groups[i], repeatCount, cssClasses, cellTemplate); + const cells = this.makeFlexGroupedRowCells(groups[i], repeatCount, cssClasses, cellTemplate); cells.forEach(cellIterator); cellsArray.push(cells); } @@ -325,7 +325,7 @@ class SchedulerTableCreator { }; } - _makeHorizontalGroupedRows(groups, cssClasses, cellCount, cellTemplate, groupByDate) { + private makeHorizontalGroupedRows(groups, cssClasses, cellCount, cellTemplate, groupByDate) { let repeatCount = 1; const groupCount = groups.length; const rows: any = []; @@ -346,7 +346,7 @@ class SchedulerTableCreator { repeatCount = groups[i - 1].items.length * repeatCount; } - const cells: any = this._makeGroupedRowCells(groups[i], repeatCount, cssClasses, cellTemplate, repeatByDate); + const cells: any = this.makeGroupedRowCells(groups[i], repeatCount, cssClasses, cellTemplate, repeatByDate); rows.push( $('') @@ -375,7 +375,7 @@ class SchedulerTableCreator { }; } - _makeGroupedRowCells(group, repeatCount, cssClasses, cellTemplate, repeatByDate) { + private makeGroupedRowCells(group, repeatCount, cssClasses, cellTemplate, repeatByDate) { repeatByDate = repeatByDate || 1; repeatCount *= repeatByDate; diff --git a/packages/devextreme/js/__internal/scheduler/r1/components/base/date_header_text.tsx b/packages/devextreme/js/__internal/scheduler/r1/components/base/date_header_text.tsx index bb192763c34a..313bbb7b1beb 100644 --- a/packages/devextreme/js/__internal/scheduler/r1/components/base/date_header_text.tsx +++ b/packages/devextreme/js/__internal/scheduler/r1/components/base/date_header_text.tsx @@ -11,21 +11,21 @@ const DateHeaderTextDefaultProps = { }; export class DateHeaderText extends BaseInfernoComponent { - private _textCache: string[] | null = null; + private textCache: string[] | null = null; getTextParts(): string[] { - if (this._textCache !== null) { - return this._textCache; + if (this.textCache !== null) { + return this.textCache; } const { text } = this.props; - this._textCache = text ? text.split(' ') : ['']; - return this._textCache; + this.textCache = text ? text.split(' ') : ['']; + return this.textCache; } componentWillUpdate(nextProps: DateHeaderTextProps): void { if (this.props.text !== nextProps.text) { - this._textCache = null; + this.textCache = null; } } diff --git a/packages/devextreme/js/__internal/scheduler/r1/components/base/group_panel_horizontal.tsx b/packages/devextreme/js/__internal/scheduler/r1/components/base/group_panel_horizontal.tsx index 8f11dcaa950a..1948c925de5c 100644 --- a/packages/devextreme/js/__internal/scheduler/r1/components/base/group_panel_horizontal.tsx +++ b/packages/devextreme/js/__internal/scheduler/r1/components/base/group_panel_horizontal.tsx @@ -6,11 +6,11 @@ import type { GroupPanelBaseProps } from './group_panel_props'; import { GroupPanelBaseDefaultProps } from './group_panel_props'; export class GroupPanelHorizontal extends BaseInfernoComponent { - private _groupPanelItems: GroupRenderItem[][] | null = null; + private groupPanelItemsCache: GroupRenderItem[][] | null = null; getGroupPanelItems(): GroupRenderItem[][] { - if (this._groupPanelItems !== null) { - return this._groupPanelItems; + if (this.groupPanelItemsCache !== null) { + return this.groupPanelItemsCache; } const { @@ -38,7 +38,7 @@ export class GroupPanelHorizontal extends BaseInfernoComponent { + this.groupPanelItemsCache = groupPanelItems.map((groupsRenderRow, index) => { const colSpan = colSpans[index]; return groupsRenderRow.map((groupItem) => ({ ...groupItem, @@ -46,12 +46,12 @@ export class GroupPanelHorizontal extends BaseInfernoComponent { - this._$container.append(shader); + this.$container.append(shader); }); } initShaderElements(): void { - this._$shader = this.createShader(); + this.$shader = this.createShader(); this._shader = []; - this._shader.push(this._$shader); + this._shader.push(this.$shader); } renderShader(): void {} @@ -38,8 +38,8 @@ class CurrentTimeShader { } clean(): void { - if (this._$container) { - this._$container.find(`.${DATE_TIME_SHADER_CLASS}`).remove(); + if (this.$container) { + this.$container.find(`.${DATE_TIME_SHADER_CLASS}`).remove(); } } } diff --git a/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_horizontal.ts b/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_horizontal.ts index 8936fa571ef3..222888a95262 100644 --- a/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_horizontal.ts +++ b/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_horizontal.ts @@ -12,7 +12,7 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader { for (let i = 0; i < groupCount; i += 1) { const isFirstShader = i === 0; - const $shader = isFirstShader ? this._$shader : this.createShader(); + const $shader = isFirstShader ? this.$shader : this.createShader(); if (this._workSpace.isGroupedByDate()) { this.customizeGroupedByDateShader($shader, i); @@ -42,7 +42,7 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader { } private applyShaderWidth($shader: dxElementWrapper, width: number): void { - const maxWidth = getBoundingRect(this._$container.get(0)).width; + const maxWidth = getBoundingRect(this.$container.get(0)).width; if (width > 0) { setWidth($shader, Math.min(width, maxWidth)); } diff --git a/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_vertical.ts b/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_vertical.ts index 7b4eabf37712..09177d7dd36b 100644 --- a/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_vertical.ts +++ b/packages/devextreme/js/__internal/scheduler/shaders/current_time_shader_vertical.ts @@ -8,11 +8,11 @@ const DATE_TIME_SHADER_TOP_CLASS = 'dx-scheduler-date-time-shader-top'; const DATE_TIME_SHADER_BOTTOM_CLASS = 'dx-scheduler-date-time-shader-bottom'; class VerticalCurrentTimeShader extends CurrentTimeShader { - _$topShader!: dxElementWrapper; + private $topShader!: dxElementWrapper; - _$bottomShader!: dxElementWrapper; + private $bottomShader!: dxElementWrapper; - _$allDayIndicator!: dxElementWrapper; + private $allDayIndicator!: dxElementWrapper; renderShader(): void { let shaderHeight = this.getShaderHeight(); @@ -23,7 +23,7 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { shaderHeight = maxHeight; } - setHeight(this._$shader, shaderHeight); + setHeight(this.$shader, shaderHeight); const groupCount = this._workSpace._getGroupCount() || 1; if (this._workSpace.isGroupedByDate()) { @@ -41,10 +41,10 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { ): void { for (let i = 0; i < groupCount; i += 1) { const shaderWidth = this.getShaderWidth(); - this.renderTopShader(this._$shader, shaderHeight, shaderWidth, i); + this.renderTopShader(this.$shader, shaderHeight, shaderWidth, i); if (!isSolidShader) { - this.renderBottomShader(this._$shader, maxHeight, shaderHeight, shaderWidth, i); + this.renderBottomShader(this.$shader, maxHeight, shaderHeight, shaderWidth, i); } this.renderAllDayShader(shaderWidth, i); @@ -63,11 +63,11 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { : shaderWidth - this._workSpace.getCellWidth(); const normalizedShaderHeight = Math.max(shaderHeight, 0); - this.renderTopShader(this._$shader, normalizedShaderHeight, shaderWidth * groupCount, 0); + this.renderTopShader(this.$shader, normalizedShaderHeight, shaderWidth * groupCount, 0); if (!isSolidShader) { this.renderBottomShader( - this._$shader, + this.$shader, maxHeight, normalizedShaderHeight, bottomShaderWidth * groupCount + this._workSpace.getCellWidth(), @@ -84,18 +84,18 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { width: number, i: number, ): void { - this._$topShader = $('
').addClass(DATE_TIME_SHADER_TOP_CLASS); + this.$topShader = $('
').addClass(DATE_TIME_SHADER_TOP_CLASS); if (width) { - setWidth(this._$topShader, width); + setWidth(this.$topShader, width); } if (height) { - setHeight(this._$topShader, height); + setHeight(this.$topShader, height); } - this._$topShader.css('marginTop', this.getShaderTopOffset(i)); - this._$topShader.css('left', this.getShaderOffset(i, width)); + this.$topShader.css('marginTop', this.getShaderTopOffset(i)); + this.$topShader.css('left', this.getShaderOffset(i, width)); - $shader.append(this._$topShader); + $shader.append(this.$topShader); } private renderBottomShader( @@ -105,27 +105,27 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { width: number, i: number, ): void { - this._$bottomShader = $('
').addClass(DATE_TIME_SHADER_BOTTOM_CLASS); + this.$bottomShader = $('
').addClass(DATE_TIME_SHADER_BOTTOM_CLASS); const shaderWidth = height < 0 ? width : width - this._workSpace.getCellWidth(); const shaderHeight = height < 0 ? maxHeight : maxHeight - height; - setWidth(this._$bottomShader, shaderWidth); - setHeight(this._$bottomShader, shaderHeight); + setWidth(this.$bottomShader, shaderWidth); + setHeight(this.$bottomShader, shaderHeight); - this._$bottomShader.css('left', this.getShaderOffset(i, width - this._workSpace.getCellWidth())); + this.$bottomShader.css('left', this.getShaderOffset(i, width - this._workSpace.getCellWidth())); - $shader.append(this._$bottomShader); + $shader.append(this.$bottomShader); } private renderAllDayShader(shaderWidth: number, i: number): void { if (this._workSpace.option('showAllDayPanel')) { - this._$allDayIndicator = $('
').addClass(DATE_TIME_SHADER_ALL_DAY_CLASS); - setHeight(this._$allDayIndicator, this._workSpace.getAllDayHeight()); - setWidth(this._$allDayIndicator, shaderWidth); - this._$allDayIndicator.css('left', this.getShaderOffset(i, shaderWidth)); + this.$allDayIndicator = $('
').addClass(DATE_TIME_SHADER_ALL_DAY_CLASS); + setHeight(this.$allDayIndicator, this._workSpace.getAllDayHeight()); + setWidth(this.$allDayIndicator, shaderWidth); + this.$allDayIndicator.css('left', this.getShaderOffset(i, shaderWidth)); - this._workSpace._$allDayPanel.prepend(this._$allDayIndicator); + this._workSpace._$allDayPanel.prepend(this.$allDayIndicator); } } diff --git a/packages/devextreme/js/__internal/scheduler/timezones/m_utils_timezones_data.ts b/packages/devextreme/js/__internal/scheduler/timezones/m_utils_timezones_data.ts index 7dbbb7ca20d1..37b7ccd68512 100644 --- a/packages/devextreme/js/__internal/scheduler/timezones/m_utils_timezones_data.ts +++ b/packages/devextreme/js/__internal/scheduler/timezones/m_utils_timezones_data.ts @@ -49,7 +49,7 @@ class TimeZoneCache { const tzCache = new TimeZoneCache(); const timeZoneDataUtils = { - _tzCache: tzCache, + tzCache, getTimeZonesOld(): any { return GlobalConfig().timezones ?? []; diff --git a/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.ts b/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.ts index e9f44a6022e9..0735feab0997 100644 --- a/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.ts +++ b/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.ts @@ -8,49 +8,49 @@ const APPOINTMENT_TOOLTIP_WRAPPER_CLASS = 'dx-scheduler-appointment-tooltip-wrap const MAX_TOOLTIP_HEIGHT = 200; export class DesktopTooltipStrategy extends TooltipStrategyBase { - _prepareBeforeVisibleChanged(dataList) { - this._tooltip.option('position', { + protected override prepareBeforeVisibleChanged(dataList) { + this.tooltip.option('position', { my: 'bottom', at: 'top', - boundary: this._getBoundary(dataList), - offset: this._extraOptions.offset, + boundary: this.getBoundary(dataList), + offset: this.extraOptions.offset, collision: 'fit flipfit', }); } - _getBoundary(dataList) { + private getBoundary(dataList) { return this._options.isAppointmentInAllDayPanel(dataList[0].appointment) ? this._options.container : this._options.getScrollableContainer(); } - _onShown() { - super._onShown(); - if (this._extraOptions.isButtonClick) { - this._list.focus(); - this._list.option('focusedElement', null); + protected override onShown() { + super.onShown(); + if (this.extraOptions.isButtonClick) { + this.list.focus(); + this.list.option('focusedElement', null); } } // @ts-expect-error - _createListOption(target, dataList) { + protected override createListOption(target, dataList) { // @ts-expect-error - const result: any = super._createListOption(target, dataList); + const result: any = super.createListOption(target, dataList); // T724287 this condition is not covered by tests, because touch variable cannot be overridden. // In the future, it is necessary to cover the tests result.showScrollbar = supportUtils.touch ? 'always' : 'onHover'; return result; } - _createTooltip(target, dataList) { - const tooltipElement = this._createTooltipElement(APPOINTMENT_TOOLTIP_WRAPPER_CLASS); + protected override createTooltip(target, dataList) { + const tooltipElement = this.createTooltipElement(APPOINTMENT_TOOLTIP_WRAPPER_CLASS); const tooltip = this._options.createComponent(tooltipElement, Tooltip, { target, maxHeight: MAX_TOOLTIP_HEIGHT, - rtlEnabled: this._extraOptions.rtlEnabled, - onShown: this._onShown.bind(this), - contentTemplate: this._getContentTemplate(dataList), + rtlEnabled: this.extraOptions.rtlEnabled, + onShown: this.onShown.bind(this), + contentTemplate: this.getContentTemplate(dataList), wrapperAttr: { class: APPOINTMENT_TOOLTIP_WRAPPER_CLASS }, - _loopFocus: this._extraOptions._loopFocus, + _loopFocus: this.extraOptions.tabFocusLoopEnabled, }); tooltip.setAria({ @@ -61,11 +61,11 @@ export class DesktopTooltipStrategy extends TooltipStrategyBase { return tooltip; } - _onListRender(e) { - return this._extraOptions.dragBehavior && this._extraOptions.dragBehavior(e); + protected override onListRender(e) { + return this.extraOptions.dragBehavior && this.extraOptions.dragBehavior(e); } - _onListItemContextMenu(e) { + protected override onListItemContextMenu(e) { const contextMenuEventArgs = this._options.createEventArgs(e); this._options.onItemContextMenu(contextMenuEventArgs); } diff --git a/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_mobile_tooltip_strategy.ts b/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_mobile_tooltip_strategy.ts index b88b1d8ec06e..4c0d5b7017ac 100644 --- a/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_mobile_tooltip_strategy.ts +++ b/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_mobile_tooltip_strategy.ts @@ -64,23 +64,23 @@ const createTabletDeviceConfig = (listHeight) => { }; export class MobileTooltipStrategy extends TooltipStrategyBase { - _shouldUseTarget() { + protected override shouldUseTarget() { return false; } private setTooltipConfig(): void { const isTabletWidth = getWidth(getWindow()) > 700; - const listHeight = getOuterHeight(this._list.$element().find(CLASS.scrollableContent)); - this._tooltip.option( + const listHeight = getOuterHeight(this.list.$element().find(CLASS.scrollableContent)); + this.tooltip.option( isTabletWidth ? createTabletDeviceConfig(listHeight) : createPhoneDeviceConfig(listHeight), ); } - private async _onShowing(): Promise { - this._tooltip.option('height', MAX_HEIGHT.DEFAULT); + private async onShowing(): Promise { + this.tooltip.option('height', MAX_HEIGHT.DEFAULT); /* NOTE: there are two setTooltipConfig calls to reduce blinking of overlay. The first one sets initial sizes, the second updates them after rendering async templates @@ -91,17 +91,17 @@ export class MobileTooltipStrategy extends TooltipStrategyBase { this.setTooltipConfig(); } - _createTooltip(target, dataList) { - const element = this._createTooltipElement(CLASS.slidePanel); + protected override createTooltip(target, dataList) { + const element = this.createTooltipElement(CLASS.slidePanel); return this._options.createComponent(element, Overlay, { target: getWindow(), hideOnOutsideClick: true, animation: animationConfig, - onShowing: () => this._onShowing(), - onShown: this._onShown.bind(this), - contentTemplate: this._getContentTemplate(dataList), + onShowing: () => this.onShowing(), + onShown: this.onShown.bind(this), + contentTemplate: this.getContentTemplate(dataList), wrapperAttr: { class: CLASS.slidePanel }, }); } diff --git a/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts b/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts index cdda3463f244..0d332d4a8f65 100644 --- a/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts +++ b/packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts @@ -18,138 +18,145 @@ const TOOLTIP_APPOINTMENT_ITEM_DELETE_BUTTON = `${TOOLTIP_APPOINTMENT_ITEM}-dele export class TooltipStrategyBase { protected asyncTemplatePromises = new Set>(); - _tooltip: any; + protected tooltip: any; + // TODO: make private once external usages in m_scheduler.ts are removed _options: any; - _extraOptions: any; + protected extraOptions: any; - _list: any; + protected list: any; constructor(options) { - this._tooltip = null; + this.tooltip = null; this._options = options; - this._extraOptions = null; + this.extraOptions = null; } show(target, dataList, extraOptions) { - if (this._canShowTooltip(dataList)) { + if (this.canShowTooltip(dataList)) { this.hide(); - this._extraOptions = extraOptions; - this._showCore(target, dataList); + this.extraOptions = extraOptions; + this.showCore(target, dataList); } } - _showCore(target, dataList) { + private showCore(target, dataList) { const describedByValue = isRenderer(target) && target.attr('aria-describedby') as string; - if (!this._tooltip) { - this._tooltip = this._createTooltip(target, dataList); + if (!this.tooltip) { + this.tooltip = this.createTooltip(target, dataList); } else { - this._shouldUseTarget() && this._tooltip.option('target', target); - this._list.option('dataSource', dataList); + this.shouldUseTarget() && this.tooltip.option('target', target); + this.list.option('dataSource', dataList); } - this._prepareBeforeVisibleChanged(dataList); - this._tooltip.option('visible', true); + this.prepareBeforeVisibleChanged(dataList); + this.tooltip.option('visible', true); describedByValue && target.attr('aria-describedby', describedByValue); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _prepareBeforeVisibleChanged(dataList) { + protected prepareBeforeVisibleChanged(dataList) { } - _getContentTemplate(dataList) { + private isDeletingAllowed(appointment) { + const { editing } = this.extraOptions; + const disabled = this._options.getAppointmentDisabled(appointment); + return !disabled && (editing === true || editing?.allowDeleting === true); + } + + protected getContentTemplate(dataList) { return (container) => { const listElement = $('
'); $(container).append(listElement); - this._list = this._createList(listElement, dataList); - this._list.registerKeyHandler?.('escape', () => { + this.list = this.createList(listElement, dataList); + this.list.registerKeyHandler?.('escape', () => { this.hide(); - this._tooltip.option('target').focus(); + this.tooltip.option('target').focus(); }); }; } isAlreadyShown(target) { - if (this._tooltip && this._tooltip.option('visible')) { - return this._tooltip.option('target')[0] === target[0]; + if (this.tooltip && this.tooltip.option('visible')) { + return this.tooltip.option('target')[0] === target[0]; } return undefined; } - _onShown() { - this._list.option('focusStateEnabled', this._extraOptions.focusStateEnabled); + protected onShown() { + this.list.option('focusStateEnabled', this.extraOptions.focusStateEnabled); } dispose() { } hide() { - if (this._tooltip) { - this._tooltip.option('visible', false); + if (this.tooltip) { + this.tooltip.option('visible', false); } } - _shouldUseTarget() { + protected shouldUseTarget() { return true; } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _createTooltip(target, dataList) { + protected createTooltip(target, dataList) { } - _canShowTooltip(dataList) { + private canShowTooltip(dataList) { if (!dataList.length) { return false; } return true; } - _createListOption(dataList) { + protected createListOption(dataList) { return { dataSource: dataList, - onContentReady: this._onListRender.bind(this), - onItemClick: (e) => this._onListItemClick(e), - onItemContextMenu: this._onListItemContextMenu.bind(this), - itemTemplate: (item, index) => this._renderTemplate(item.appointment, item.targetedAppointment, index, item.color), + onContentReady: this.onListRender.bind(this), + onItemClick: (e) => this.onListItemClick(e), + onItemContextMenu: this.onListItemContextMenu.bind(this), + itemTemplate: (item, index) => this.renderTemplate(item.appointment, item.targetedAppointment, index, item.color), _swipeEnabled: false, pageLoadMode: 'scrollBottom', }; } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _onListRender(e) {} + protected onListRender(e) { } - _createTooltipElement(wrapperClass) { + protected createTooltipElement(wrapperClass) { return $('
').appendTo(this._options.container).addClass(wrapperClass); } - _createList(listElement, dataList) { - return this._options.createComponent(listElement, List, this._createListOption(dataList)); + private createList(listElement, dataList) { + return this._options.createComponent(listElement, List, this.createListOption(dataList)); } - _renderTemplate(appointment, targetedAppointment, index, color) { - const itemListContent = this._createItemListContent(appointment, targetedAppointment, color); + private renderTemplate(appointment, targetedAppointment, index, color) { + const itemListContent = this.createItemListContent(appointment, targetedAppointment, color); this._options.addDefaultTemplates({ // @ts-expect-error - [this._getItemListTemplateName()]: new FunctionTemplate((options) => { + [this.getItemListTemplateName()]: new FunctionTemplate((options) => { const $container = $(options.container); $container.append(itemListContent); return $container; }), }); - const template = this._options.getAppointmentTemplate(`${this._getItemListTemplateName()}Template`); - return this._createFunctionTemplate(template, appointment, targetedAppointment, index); + const template = this._options.getAppointmentTemplate(`${this.getItemListTemplateName()}Template`); + return this.createFunctionTemplate(template, appointment, targetedAppointment, index); } - _createFunctionTemplate(template, appointmentData, targetedAppointmentData, index) { - const isButtonClicked = Boolean(this._extraOptions.isButtonClick); + private createFunctionTemplate(template, appointmentData, targetedAppointmentData, index) { + const isButtonClicked = Boolean(this.extraOptions.isButtonClick); - const isEmptyDropDownAppointmentTemplate = this._isEmptyDropDownAppointmentTemplate(); + const isEmptyDropDownAppointmentTemplate = this.isEmptyDropDownAppointmentTemplate(); // @ts-expect-error return new FunctionTemplate((options) => { // eslint-disable-next-line @typescript-eslint/no-invalid-void-type @@ -171,39 +178,36 @@ export class TooltipStrategyBase { }); } - _getItemListTemplateName() { - return this._isEmptyDropDownAppointmentTemplate() ? 'appointmentTooltip' : 'dropDownAppointment'; + private getItemListTemplateName() { + return this.isEmptyDropDownAppointmentTemplate() ? 'appointmentTooltip' : 'dropDownAppointment'; } - _isEmptyDropDownAppointmentTemplate() { - return !this._extraOptions.dropDownAppointmentTemplate || this._extraOptions.dropDownAppointmentTemplate === 'dropDownAppointment'; + private isEmptyDropDownAppointmentTemplate() { + return !this.extraOptions.dropDownAppointmentTemplate || this.extraOptions.dropDownAppointmentTemplate === 'dropDownAppointment'; } - _onListItemClick(e) { + private onListItemClick(e) { this.hide(); - this._extraOptions.clickEvent && this._extraOptions.clickEvent(e); + this.extraOptions.clickEvent && this.extraOptions.clickEvent(e); this._options.showAppointmentPopup(e.itemData.appointment, false, e.itemData.targetedAppointment); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _onListItemContextMenu(e) {} + protected onListItemContextMenu(e) { } - _createItemListContent(appointment, targetedAppointment, color) { - const { editing } = this._extraOptions; + private createItemListContent(appointment, targetedAppointment, color) { const $itemElement = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM); - $itemElement.append(this._createItemListMarker(color)); - $itemElement.append(this._createItemListInfo(this._options.createFormattedDateText(appointment, targetedAppointment))); - - const disabled = this._options.getAppointmentDisabled(appointment); + $itemElement.append(this.createItemListMarker(color)); + $itemElement.append(this.createItemListInfo(this._options.createFormattedDateText(appointment, targetedAppointment))); - if (!disabled && (editing && editing.allowDeleting === true || editing === true)) { - $itemElement.append(this._createDeleteButton(appointment, targetedAppointment)); + if (this.isDeletingAllowed(appointment)) { + $itemElement.append(this.createDeleteButton(appointment, targetedAppointment)); } return $itemElement; } - _createItemListMarker(color) { + private createItemListMarker(color) { const $marker = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_MARKER); const $markerBody = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_MARKER_BODY); @@ -217,7 +221,7 @@ export class TooltipStrategyBase { return $marker; } - _createItemListInfo(object) { + private createItemListInfo(object) { const result = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_CONTENT); const $title = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_CONTENT_SUBJECT).text(object.text); const $date = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_CONTENT_DATE).text(object.formatDate); @@ -225,7 +229,7 @@ export class TooltipStrategyBase { return result.append($title).append($date); } - _createDeleteButton(appointment, targetedAppointment) { + private createDeleteButton(appointment, targetedAppointment) { const $container = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_DELETE_BUTTON_CONTAINER); const $deleteButton = $('
').addClass(TOOLTIP_APPOINTMENT_ITEM_DELETE_BUTTON); diff --git a/packages/devextreme/js/__internal/scheduler/view_model/appointment.dataProcessor.test.ts b/packages/devextreme/js/__internal/scheduler/view_model/appointment.dataProcessor.test.ts index 516aa6c7acf5..d7a11015ab41 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/appointment.dataProcessor.test.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/appointment.dataProcessor.test.ts @@ -438,7 +438,7 @@ describe('data processor', () => { text: 'Appointment 1', startDate: new Date(2015, 1, 9, 1, 0), endDate: new Date(2015, 1, 9, 2, 0), - _recurrenceRule: 'FREQ=DAILY', + customRecurrenceRule: 'FREQ=DAILY', }, { text: 'Appointment 2', @@ -454,7 +454,7 @@ describe('data processor', () => { dataSource, currentView: 'week', currentDate, - recurrenceRuleExpr: '_recurrenceRule', + recurrenceRuleExpr: 'customRecurrenceRule', }); scheduler.setRemoteFilter( @@ -508,7 +508,7 @@ describe('data processor', () => { text: 'Appointment 1', startDate: new Date(2015, 1, 9, 1, 0), endDate: new Date(2015, 1, 9, 2, 0), - _recurrenceRule: 'FREQ=DAILY', + customRecurrenceRule: 'FREQ=DAILY', }, { text: 'Appointment 2', diff --git a/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter.ts b/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter.ts index be84e84590a4..53460fe9d9c2 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter.ts @@ -32,29 +32,29 @@ export class AppointmentFilterBaseStrategy { get timeZoneCalculator() { return this.options.timeZoneCalculator; } - get viewStartDayHour() { return this._resolveOption('startDayHour'); } + get viewStartDayHour() { return this.resolveOption('startDayHour'); } - get viewEndDayHour() { return this._resolveOption('endDayHour'); } + get viewEndDayHour() { return this.resolveOption('endDayHour'); } - get firstDayOfWeek() { return this._resolveOption('firstDayOfWeek'); } + get firstDayOfWeek() { return this.resolveOption('firstDayOfWeek'); } - get showAllDayPanel() { return this._resolveOption('showAllDayPanel'); } + get showAllDayPanel() { return this.resolveOption('showAllDayPanel'); } - get supportAllDayRow() { return this._resolveOption('supportAllDayRow'); } + get supportAllDayRow() { return this.resolveOption('supportAllDayRow'); } - get viewType() { return this._resolveOption('viewType'); } + get viewType() { return this.resolveOption('viewType'); } - get viewDirection() { return this._resolveOption('viewDirection'); } + get viewDirection() { return this.resolveOption('viewDirection'); } - get dateRange() { return this._resolveOption('dateRange'); } + get dateRange() { return this.resolveOption('dateRange'); } - get groupCount() { return this._resolveOption('groupCount'); } + get groupCount() { return this.resolveOption('groupCount'); } - get viewDataProvider(): ViewDataProvider { return this._resolveOption('viewDataProvider'); } + get viewDataProvider(): ViewDataProvider { return this.resolveOption('viewDataProvider'); } - get allDayPanelMode() { return this._resolveOption('allDayPanelMode'); } + get allDayPanelMode() { return this.resolveOption('allDayPanelMode'); } - _resolveOption(name) { + protected resolveOption(name) { const result = this.options[name]; return typeof result === 'function' ? result() @@ -65,7 +65,7 @@ export class AppointmentFilterBaseStrategy { visibleDateIntervals: DateInterval[]; visibleTimeIntervals: DateInterval[]; } { - const viewOffset = this._resolveOption('viewOffset'); + const viewOffset = this.resolveOption('viewOffset'); const intervals = { visibleDateIntervals: getVisibleDateTimeIntervals(compareOptions, true), visibleTimeIntervals: getVisibleDateTimeIntervals(compareOptions, false), @@ -95,7 +95,7 @@ export class AppointmentFilterBaseStrategy { allDayPanelFilter, allDayPanelMode: this.allDayPanelMode, supportAllDayRow: this.supportAllDayRow, - viewOffset: this._resolveOption('viewOffset'), + viewOffset: this.resolveOption('viewOffset'), }; } diff --git a/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter_virtual.ts b/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter_virtual.ts index d1e62956d7e1..cf7719e9c8ec 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter_virtual.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/filtering/m_appointment_filter_virtual.ts @@ -20,7 +20,7 @@ export class AppointmentFilterVirtualStrategy extends AppointmentFilterBaseStrat public static readonly strategyName = 'virtual'; protected getBasePanelFilterOptions(): FilterOptions[] { - const viewOffset = this._resolveOption('viewOffset'); + const viewOffset = this.resolveOption('viewOffset'); const hourMs = toMs('hour'); const isCalculateStartAndEndDayHour = isDateAndTimeView(this.viewType); const endViewDate = this.viewDataProvider.getLastViewDateByEndDayHour(this.viewEndDayHour); @@ -68,7 +68,7 @@ export class AppointmentFilterVirtualStrategy extends AppointmentFilterBaseStrat allDayPanelFilter: false, allDayPanelMode: this.allDayPanelMode, supportAllDayRow: this.supportAllDayRow, - viewOffset: this._resolveOption('viewOffset'), + viewOffset: this.resolveOption('viewOffset'), }); }); diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/data_provider/m_appointment_data_source.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/data_provider/m_appointment_data_source.ts index af4ee4029f5b..ff11cdf6b0f2 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/data_provider/m_appointment_data_source.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/data_provider/m_appointment_data_source.ts @@ -26,7 +26,7 @@ export class AppointmentDataSource { return Boolean(this.dataSource); } - _getStoreKey(target) { + private getStoreKey(target) { const store = this.dataSource.store(); return store.keyOf(target); @@ -36,10 +36,10 @@ export class AppointmentDataSource { this.dataSource = dataSource; this.cleanState(); - this._initStoreChangeHandlers(); + this.initStoreChangeHandlers(); } - _initStoreChangeHandlers() { + private initStoreChangeHandlers() { const { dataSource } = this; const store = dataSource?.store(); @@ -97,7 +97,7 @@ export class AppointmentDataSource { } update(target, data) { - const key = this._getStoreKey(target); + const key = this.getStoreKey(target); // @ts-expect-error const d = new Deferred(); @@ -111,7 +111,7 @@ export class AppointmentDataSource { } remove(rawAppointment) { - const key = this._getStoreKey(rawAppointment); + const key = this.getStoreKey(rawAppointment); return this.dataSource.store().remove(key).done(() => this.dataSource.load()); } diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_cell_position_calculator.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_cell_position_calculator.ts index e6a8ced79d48..3ef003d4f1bf 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_cell_position_calculator.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_cell_position_calculator.ts @@ -54,7 +54,7 @@ class BaseStrategy { coordinates.forEach((item) => { Boolean(item) && result.push( - this._prepareObject(item, index), + this.prepareObject(item, index), ); }); }); @@ -84,7 +84,7 @@ class BaseStrategy { ); } - _prepareObject(position, dateSettingIndex) { + protected prepareObject(position, dateSettingIndex) { position.dateSettingIndex = dateSettingIndex; return { coordinates: position, @@ -241,7 +241,7 @@ class VirtualStrategy extends BaseStrategy { if (coordinate) { result.push( - this._prepareObject(coordinate, index), + this.prepareObject(coordinate, index), ); } }); diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_settings_generator.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_settings_generator.ts index f8737ab3cbeb..b5db8afa8ba2 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_settings_generator.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/m_settings_generator.ts @@ -77,26 +77,26 @@ export class DateGeneratorBaseStrategy { generate(appointmentAdapter) { const { isRecurrent } = appointmentAdapter; - const itemGroupIndices = this._getGroupIndices(this.rawAppointment); + const itemGroupIndices = this.getGroupIndices(this.rawAppointment); - let appointmentList = this._createAppointments(appointmentAdapter, itemGroupIndices); + let appointmentList = this.createAppointments(appointmentAdapter, itemGroupIndices); - appointmentList = this._getProcessedByAppointmentTimeZone(appointmentList, appointmentAdapter); // T983264 + appointmentList = this.getProcessedByAppointmentTimeZone(appointmentList, appointmentAdapter); // T983264 - if (this._canProcessNotNativeTimezoneDates(appointmentAdapter)) { - appointmentList = this._getProcessedNotNativeTimezoneDates(appointmentList, appointmentAdapter); + if (this.canProcessNotNativeTimezoneDates(appointmentAdapter)) { + appointmentList = this.getProcessedNotNativeTimezoneDates(appointmentList, appointmentAdapter); } - let dateSettings = this._createGridAppointmentList(appointmentList, appointmentAdapter); + let dateSettings = this.createGridAppointmentList(appointmentList, appointmentAdapter); - const firstViewDates = this._getAppointmentsFirstViewDate(dateSettings); + const firstViewDates = this.getAppointmentsFirstViewDate(dateSettings); - dateSettings = this._fillNormalizedStartDate(dateSettings, firstViewDates); - dateSettings = this._cropAppointmentsByStartDayHour(dateSettings, firstViewDates); - dateSettings = this._fillNormalizedEndDate(dateSettings, this.rawAppointment); + dateSettings = this.fillNormalizedStartDate(dateSettings, firstViewDates); + dateSettings = this.cropAppointmentsByStartDayHour(dateSettings, firstViewDates); + dateSettings = this.fillNormalizedEndDate(dateSettings, this.rawAppointment); - if (this._needSeparateLongParts()) { - dateSettings = this._separateLongParts(dateSettings, appointmentAdapter); + if (this.needSeparateLongParts()) { + dateSettings = this.separateLongParts(dateSettings, appointmentAdapter); } dateSettings = this.shiftSourceAppointmentDates(dateSettings); @@ -120,7 +120,7 @@ export class DateGeneratorBaseStrategy { })); } - _getProcessedByAppointmentTimeZone(appointmentList, appointment) { + private getProcessedByAppointmentTimeZone(appointmentList, appointment) { const hasAppointmentTimeZone = !isEmptyObject(appointment.startDateTimeZone) || !isEmptyObject(appointment.endDateTimeZone); if (hasAppointmentTimeZone) { @@ -150,8 +150,8 @@ export class DateGeneratorBaseStrategy { return appointmentList; } - _createAppointments(appointment, groupIndices) { - let appointments = this._createRecurrenceAppointments(appointment, groupIndices); + protected createAppointments(appointment, groupIndices) { + let appointments = this.createRecurrenceAppointments(appointment, groupIndices); if (!appointment.isRecurrent && appointments.length === 0) { appointments.push({ @@ -176,7 +176,7 @@ export class DateGeneratorBaseStrategy { return appointments; } - _canProcessNotNativeTimezoneDates(appointment) { + private canProcessNotNativeTimezoneDates(appointment) { const isTimeZoneSet = !isEmptyObject(this.timeZone); if (!isTimeZoneSet) { @@ -190,7 +190,7 @@ export class DateGeneratorBaseStrategy { return !timeZoneUtils.isEqualLocalTimeZone(this.timeZone, appointment.startDate); } - _getDateOffsetDST(date) { + private getDateOffsetDST(date) { const dateMinusHour = new Date(date); dateMinusHour.setHours(dateMinusHour.getHours() - 1); @@ -200,27 +200,27 @@ export class DateGeneratorBaseStrategy { return dateMinusHourCommonOffset - dateCommonOffset; } - _getProcessedNotNativeDateIfCrossDST(date, offset) { - return offset < 0 && this._getDateOffsetDST(date) !== 0 + private getProcessedNotNativeDateIfCrossDST(date, offset) { + return offset < 0 && this.getDateOffsetDST(date) !== 0 ? 0 : offset; } - _getCommonOffset(date) { + private getCommonOffset(date) { return this.timeZoneCalculator.getOffsets(date).common; } - _getProcessedNotNativeTimezoneDates(appointmentList, appointment) { + private getProcessedNotNativeTimezoneDates(appointmentList, appointment) { return appointmentList.map((item) => { - let diffStartDateOffset = this._getCommonOffset(appointment.startDate) - this._getCommonOffset(item.startDate); - let diffEndDateOffset = this._getCommonOffset(appointment.endDate) - this._getCommonOffset(item.endDate); + let diffStartDateOffset = this.getCommonOffset(appointment.startDate) - this.getCommonOffset(item.startDate); + let diffEndDateOffset = this.getCommonOffset(appointment.endDate) - this.getCommonOffset(item.endDate); if (diffStartDateOffset === 0 && diffEndDateOffset === 0) { return item; } - diffStartDateOffset = this._getProcessedNotNativeDateIfCrossDST(item.startDate, diffStartDateOffset); - diffEndDateOffset = this._getProcessedNotNativeDateIfCrossDST(item.endDate, diffEndDateOffset); + diffStartDateOffset = this.getProcessedNotNativeDateIfCrossDST(item.startDate, diffStartDateOffset); + diffEndDateOffset = this.getProcessedNotNativeDateIfCrossDST(item.endDate, diffEndDateOffset); const newStartDate = new Date(item.startDate.getTime() + diffStartDateOffset * toMs('hour')); let newEndDate = new Date(item.endDate.getTime() + diffEndDateOffset * toMs('hour')); @@ -240,7 +240,7 @@ export class DateGeneratorBaseStrategy { }); } - _needSeparateLongParts() { + private needSeparateLongParts() { return this.isVerticalOrientation ? this.isGroupedByDate : this.isGroupedByDate && this.appointmentTakesAllDay; @@ -269,14 +269,14 @@ export class DateGeneratorBaseStrategy { return result; } - _fillNormalizedEndDate(dateSettings, rawAppointment) { + private fillNormalizedEndDate(dateSettings, rawAppointment) { return dateSettings.map((item) => ({ ...item, normalizedEndDate: this.normalizeEndDateByViewEnd(rawAppointment, item.endDate), })); } - _separateLongParts(gridAppointmentList, appointmentAdapter) { + private separateLongParts(gridAppointmentList, appointmentAdapter) { let result: any = []; gridAppointmentList.forEach((gridAppointment) => { @@ -310,11 +310,11 @@ export class DateGeneratorBaseStrategy { return result; } - _createGridAppointmentList(appointmentList, appointmentAdapter) { + private createGridAppointmentList(appointmentList, appointmentAdapter) { return appointmentList.map((source) => { const offsetDifference = appointmentAdapter.startDate.getTimezoneOffset() - source.startDate.getTimezoneOffset(); - if (offsetDifference !== 0 && this._canProcessNotNativeTimezoneDates(appointmentAdapter)) { + if (offsetDifference !== 0 && this.canProcessNotNativeTimezoneDates(appointmentAdapter)) { source.startDate = dateUtilsTs.addOffsets(source.startDate, [offsetDifference * toMs('minute')]); source.endDate = dateUtilsTs.addOffsets(source.endDate, [offsetDifference * toMs('minute')]); } @@ -333,7 +333,7 @@ export class DateGeneratorBaseStrategy { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _createExtremeRecurrenceDates(groupIndex) { + private createExtremeRecurrenceDates(groupIndex) { let startViewDate = this.appointmentTakesAllDay ? dateUtils.trimTime(this.dateRange[0]) : this.dateRange[0]; @@ -355,7 +355,7 @@ export class DateGeneratorBaseStrategy { ]; } - _createRecurrenceOptions(appointment: AppointmentAdapter, groupIndex?) { + protected createRecurrenceOptions(appointment: AppointmentAdapter, groupIndex?) { const { viewOffset } = this.options; // NOTE: For creating a recurrent appointments, // we should use original appointment's dates (without view offset). @@ -365,7 +365,7 @@ export class DateGeneratorBaseStrategy { const [ minRecurrenceDate, maxRecurrenceDate, - ] = this._createExtremeRecurrenceDates(groupIndex); + ] = this.createExtremeRecurrenceDates(groupIndex); const shiftedMinRecurrenceDate = dateUtilsTs.addOffsets(minRecurrenceDate, [viewOffset]); const shiftedMaxRecurrenceDate = dateUtilsTs.addOffsets(maxRecurrenceDate, [viewOffset]); @@ -393,7 +393,7 @@ export class DateGeneratorBaseStrategy { true, ); - const offsetDST = this._getDateOffsetDST(date); + const offsetDST = this.getDateOffsetDST(date); // NOTE: Apply only winter -> summer DST extra offset const extraSummerTimeChangeOffset = offsetDST < 0 ? offsetDST * toMs('hour') @@ -409,10 +409,10 @@ export class DateGeneratorBaseStrategy { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _createRecurrenceAppointments(appointment, groupIndices) { + protected createRecurrenceAppointments(appointment, groupIndices) { const { duration } = appointment; const { viewOffset } = this.options; - const option = this._createRecurrenceOptions(appointment); + const option = this.createRecurrenceOptions(appointment); const generatedStartDates = generateDates(option); return generatedStartDates @@ -434,10 +434,10 @@ export class DateGeneratorBaseStrategy { })); } - _getAppointmentsFirstViewDate(appointments: any[]): Date[] { + private getAppointmentsFirstViewDate(appointments: any[]): Date[] { const { viewOffset } = this.options; return appointments.map((appointment: any): Date => { - const tableFirstDate = this._getAppointmentFirstViewDate({ + const tableFirstDate = this.getAppointmentFirstViewDate({ ...appointment, startDate: dateUtilsTs.addOffsets(appointment.startDate, [viewOffset]), endDate: dateUtilsTs.addOffsets(appointment.endDate, [viewOffset]), @@ -455,7 +455,7 @@ export class DateGeneratorBaseStrategy { }); } - _fillNormalizedStartDate( + private fillNormalizedStartDate( appointments, firstViewDates, // TODO Vinogradov: Check this unused argument. @@ -463,7 +463,7 @@ export class DateGeneratorBaseStrategy { ) { return appointments.map((item, idx) => ({ ...item, - startDate: this._getAppointmentResultDate({ + startDate: this.getAppointmentResultDate({ appointment: item, rawAppointment, startDate: new Date(item.startDate), @@ -473,7 +473,7 @@ export class DateGeneratorBaseStrategy { })); } - _cropAppointmentsByStartDayHour(appointments, firstViewDates) { + private cropAppointmentsByStartDayHour(appointments, firstViewDates) { return appointments.filter((appointment, idx) => { if (!firstViewDates[idx]) { return false; @@ -485,7 +485,7 @@ export class DateGeneratorBaseStrategy { }); } - private _getAppointmentResultDate(options) { + private getAppointmentResultDate(options) { const { appointment, startDayHour, @@ -509,7 +509,7 @@ export class DateGeneratorBaseStrategy { : resultDate; } - _getAppointmentFirstViewDate(appointment: any): Date | null { + private getAppointmentFirstViewDate(appointment: any): Date | null { const groupIndex = appointment.source.groupIndex || 0; const { startDate, @@ -528,7 +528,7 @@ export class DateGeneratorBaseStrategy { ); } - _getGroupIndices(rawAppointment) { + protected getGroupIndices(rawAppointment) { const appointmentGroupValues = getAppointmentGroupValues( rawAppointment, this.resourceManager.resources, @@ -541,7 +541,7 @@ export class DateGeneratorBaseStrategy { export class DateGeneratorVirtualStrategy extends DateGeneratorBaseStrategy { get groupCount() { return this.resourceManager.groupCount(); } - _createRecurrenceAppointments(appointment, groupIndices) { + protected createRecurrenceAppointments(appointment, groupIndices) { const { duration } = appointment; const result: any = []; const validGroupIndices = this.groupCount @@ -549,7 +549,7 @@ export class DateGeneratorVirtualStrategy extends DateGeneratorBaseStrategy { : [0]; validGroupIndices.forEach((groupIndex) => { - const option = this._createRecurrenceOptions(appointment, groupIndex); + const option = this.createRecurrenceOptions(appointment, groupIndex); const generatedStartDates = generateDates(option); const recurrentInfo = generatedStartDates .map((date) => { @@ -571,7 +571,7 @@ export class DateGeneratorVirtualStrategy extends DateGeneratorBaseStrategy { return result; } - _updateGroupIndices(appointments, groupIndices) { + private updateGroupIndices(appointments, groupIndices) { const result: any = []; groupIndices.forEach((groupIndex) => { @@ -589,8 +589,8 @@ export class DateGeneratorVirtualStrategy extends DateGeneratorBaseStrategy { return result; } - _getGroupIndices(rawAppointment) { - let groupIndices: any = super._getGroupIndices(rawAppointment); + protected getGroupIndices(rawAppointment) { + let groupIndices: any = super.getGroupIndices(rawAppointment); const viewDataGroupIndices = this.viewDataProvider.getGroupIndices(); if (!groupIndices?.length) { @@ -602,11 +602,11 @@ export class DateGeneratorVirtualStrategy extends DateGeneratorBaseStrategy { ); } - _createAppointments(appointment, groupIndices) { - const appointments = super._createAppointments(appointment, groupIndices); + protected createAppointments(appointment, groupIndices) { + const appointments = super.createAppointments(appointment, groupIndices); return !appointment.isRecurrent - ? this._updateGroupIndices(appointments, groupIndices) + ? this.updateGroupIndices(appointments, groupIndices) : appointments; } } @@ -651,7 +651,7 @@ export class AppointmentSettingsGenerator { dateSettings, itemGroupIndices, isRecurrent, - } = this._generateDateSettings(); + } = this.generateDateSettings(); const { isVirtualScrolling, viewDataProvider } = this.options; const filteredDateSettings = this.isAllDayRowAppointment || !isVirtualScrolling ? dateSettings @@ -661,17 +661,17 @@ export class AppointmentSettingsGenerator { endDate, )); - const cellPositions = this._calculateCellPositions(filteredDateSettings, itemGroupIndices); - const result = this._prepareAppointmentInfos(filteredDateSettings, cellPositions, isRecurrent); + const cellPositions = this.calculateCellPositions(filteredDateSettings, itemGroupIndices); + const result = this.prepareAppointmentInfos(filteredDateSettings, cellPositions, isRecurrent); return result; } - _generateDateSettings() { + private generateDateSettings() { return this.dateSettingsStrategy.generate(this.appointmentAdapter); } - _calculateCellPositions(dateSettings, itemGroupIndices) { + private calculateCellPositions(dateSettings, itemGroupIndices) { const cellPositionCalculator = new CellPositionCalculator({ ...this.options, dateSettings, @@ -684,12 +684,12 @@ export class AppointmentSettingsGenerator { ); } - _prepareAppointmentInfos(dateSettings, cellPositions, isRecurrent) { + private prepareAppointmentInfos(dateSettings, cellPositions, isRecurrent) { const infos: any = []; cellPositions.forEach(({ coordinates, dateSettingIndex }) => { const dateSetting = dateSettings[dateSettingIndex]; - const dateText = this._getAppointmentDateText(dateSetting); + const dateText = this.getAppointmentDateText(dateSetting); const info = { appointment: dateSetting, @@ -707,7 +707,7 @@ export class AppointmentSettingsGenerator { return infos; } - _getAppointmentDateText(sourceAppointment) { + private getAppointmentDateText(sourceAppointment) { const { startDate, endDate, allDay } = sourceAppointment; return createFormattedDateText({ startDate, diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_adaptive.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_adaptive.ts index fef6b9a9c3a6..77170fe27e09 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_adaptive.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_adaptive.ts @@ -17,18 +17,18 @@ class AdaptivePositioningStrategy extends AppointmentPositioningStrategy { } getCollectorTopOffset(allDay) { - const renderingStrategy = this._renderingStrategy; + const { renderingStrategy } = this; if (renderingStrategy.allDaySupported() && allDay) { return (renderingStrategy.allDayHeight - renderingStrategy.getDropDownButtonAdaptiveSize()) / 2; } - return this._renderingStrategy.cellHeight - COLLECTOR_ADAPTIVE_BOTTOM_OFFSET; + return this.renderingStrategy.cellHeight - COLLECTOR_ADAPTIVE_BOTTOM_OFFSET; } getCollectorLeftOffset() { - const collectorWidth = this._renderingStrategy.getDropDownAppointmentWidth(); + const collectorWidth = this.renderingStrategy.getDropDownAppointmentWidth(); - return (this._renderingStrategy.cellWidth - collectorWidth) / 2; + return (this.renderingStrategy.cellWidth - collectorWidth) / 2; } getAppointmentDefaultOffset() { @@ -36,12 +36,12 @@ class AdaptivePositioningStrategy extends AppointmentPositioningStrategy { } getDynamicAppointmentCountPerCell() { - const renderingStrategy = this._renderingStrategy; + const { renderingStrategy } = this; if (renderingStrategy.allDaySupported()) { return { allDay: 0, - simple: this._calculateDynamicAppointmentCountPerCell() || this._getAppointmentMinCount(), + simple: this.calculateDynamicAppointmentCountPerCell() || this.getAppointmentMinCount(), }; } return 0; @@ -51,22 +51,22 @@ class AdaptivePositioningStrategy extends AppointmentPositioningStrategy { return COLLECTOR_ADAPTIVE_SIZE; } - _getAppointmentMinCount() { + protected getAppointmentMinCount() { return 0; } - _getAppointmentDefaultWidth() { - const renderingStrategy = this._renderingStrategy; + protected getAppointmentDefaultWidth() { + const { renderingStrategy } = this; if (renderingStrategy.allDaySupported()) { return ADAPTIVE_APPOINTMENT_DEFAULT_WIDTH; } - return super._getAppointmentDefaultWidth(); + return super.getAppointmentDefaultWidth(); } - _calculateDynamicAppointmentCountPerCell() { - return Math.floor(this._renderingStrategy._getAppointmentMaxWidth() / this._renderingStrategy._getAppointmentDefaultWidth()); + protected calculateDynamicAppointmentCountPerCell() { + return Math.floor(this.renderingStrategy.getAppointmentMaxWidth() / this.renderingStrategy.getAppointmentDefaultWidth()); } } diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_base.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_base.ts index 9a466397b282..4a1b6ac4f216 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_base.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_appointments_positioning_strategy_base.ts @@ -12,15 +12,15 @@ const COLLECTOR_WIDTH_IN_PERCENTS = 75; const APPOINTMENT_INCREASED_WIDTH = 50; class AppointmentPositioningStrategy { - _renderingStrategy: any; + protected renderingStrategy: any; constructor(renderingStrategy) { - this._renderingStrategy = renderingStrategy; + this.renderingStrategy = renderingStrategy; } getDropDownAppointmentWidth(intervalCount, isAllDay) { if (isAllDay || !isDefined(isAllDay)) { - return COLLECTOR_WIDTH_IN_PERCENTS * this._renderingStrategy.cellWidth / 100; + return COLLECTOR_WIDTH_IN_PERCENTS * this.renderingStrategy.cellWidth / 100; } return COLLECTOR_DEFAULT_WIDTH; } @@ -35,24 +35,24 @@ class AppointmentPositioningStrategy { } getAppointmentDefaultOffset() { - if (this._renderingStrategy._isCompactTheme()) { + if (this.renderingStrategy.isCompactTheme()) { return COMPACT_THEME_APPOINTMENT_DEFAULT_OFFSET; } - return this._renderingStrategy.appointmentOffset; + return this.renderingStrategy.appointmentOffset; } getDynamicAppointmentCountPerCell() { - const renderingStrategy = this._renderingStrategy; + const { renderingStrategy } = this; const { cellHeight } = renderingStrategy; - const allDayCount = Math.floor((cellHeight - renderingStrategy._getAppointmentDefaultOffset()) / renderingStrategy._getAppointmentDefaultHeight()) || this._getAppointmentMinCount(); + const allDayCount = Math.floor((cellHeight - renderingStrategy.getAppointmentDefaultOffset()) / renderingStrategy.getAppointmentDefaultHeight()) || this.getAppointmentMinCount(); // NOTE: Simplify using only object if (renderingStrategy.allDaySupported()) { return { - allDay: renderingStrategy.groupOrientation === 'vertical' ? allDayCount : this._renderingStrategy.appointmentCountPerCell, - simple: this._calculateDynamicAppointmentCountPerCell() || this._getAppointmentMinCount(), + allDay: renderingStrategy.groupOrientation === 'vertical' ? allDayCount : this.renderingStrategy.appointmentCountPerCell, + simple: this.calculateDynamicAppointmentCountPerCell() || this.getAppointmentMinCount(), }; } return allDayCount; @@ -62,15 +62,15 @@ class AppointmentPositioningStrategy { return undefined; } - _getAppointmentMinCount() { + protected getAppointmentMinCount() { return APPOINTMENT_MIN_COUNT; } - _calculateDynamicAppointmentCountPerCell() { - return Math.floor(this._renderingStrategy._getAppointmentMaxWidth() / APPOINTMENT_INCREASED_WIDTH); + protected calculateDynamicAppointmentCountPerCell() { + return Math.floor(this.renderingStrategy.getAppointmentMaxWidth() / APPOINTMENT_INCREASED_WIDTH); } - _getAppointmentDefaultWidth() { + protected getAppointmentDefaultWidth() { return APPOINTMENT_DEFAULT_WIDTH; } } diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_agenda.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_agenda.ts index 8fbd21b59979..935930fc92c9 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_agenda.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_agenda.ts @@ -8,7 +8,7 @@ import { groupAppointmentsByGroupLeafs } from '../../../utils/resource_manager/a import BaseRenderingStrategy from './m_strategy_base'; class AgendaRenderingStrategy extends BaseRenderingStrategy { - _rows: any; + protected rows: any; get instance() { return this.options.instance; } @@ -90,7 +90,7 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { height, width: '100%', sortedIndex: sortedIndex++, - groupIndex: this._calculateGroupIndex(index, appointmentsByResources), + groupIndex: this.calculateGroupIndex(index, appointmentsByResources), agendaSettings: appt.settings, }]); @@ -100,7 +100,7 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { return result; } - _calculateGroupIndex(apptIndex, appointmentsByResources): number | undefined { + protected calculateGroupIndex(apptIndex, appointmentsByResources): number | undefined { let counter = 0; // eslint-disable-next-line @@ -117,19 +117,19 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { return undefined; } - _getAppointmentMaxWidth() { + protected getAppointmentMaxWidth() { return this.cellWidth; } - _needVerifyItemSize() { + protected needVerifyItemSize() { return false; } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getAppointmentParts(geometry, settings) { + protected getAppointmentParts(geometry, settings) { } - _reduceMultiWeekAppointment() { + protected reduceMultiWeekAppointment() { } calculateAppointmentHeight() { @@ -148,22 +148,22 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { return false; } - _sortCondition() { + protected sortCondition() { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _rowCondition(a, b) { + protected rowCondition(a, b) { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _columnCondition(a, b) { + protected columnCondition(a, b) { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _findIndexByKey(arr, iKey, jKey, iValue, jValue) { + protected findIndexByKey(arr, iKey, jKey, iValue, jValue) { } - _markAppointmentAsVirtual() { + protected markAppointmentAsVirtual() { } getDropDownAppointmentWidth() { @@ -176,7 +176,7 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { } calculateRows(appointments, agendaDuration, currentDate) { - this._rows = []; + this.rows = []; currentDate = dateUtils.trimTime(new Date(currentDate)); const groupedAppointments = this.groupAppointmentByResources(appointments); @@ -189,7 +189,7 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { }; if (!currentAppointments.length) { - this._rows.push([]); + this.rows.push([]); return true; } @@ -225,13 +225,13 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { } } - this._rows.push(groupResult); + this.rows.push(groupResult); }); - return this._rows; + return this.rows; } - _iterateRow(row, obj, index) { + protected iterateRow(row, obj, index) { for (let i = 0; i < row.length; i++) { obj.counter += row[i]; if (obj.counter >= index) { @@ -246,7 +246,7 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { index++; for (let i = 0; i < rows.length; i++) { - this._iterateRow(rows[i], obj, index); + this.iterateRow(rows[i], obj, index); if (obj.indexInRow) break; } @@ -257,7 +257,7 @@ class AgendaRenderingStrategy extends BaseRenderingStrategy { return ($appointment, originalStartDate) => { const apptIndex = $appointment.index(); const startViewDate = this.instance.getStartViewDate(); - const calculatedStartDate = this.getDateByIndex(apptIndex, this._rows, startViewDate); + const calculatedStartDate = this.getDateByIndex(apptIndex, this.rows, startViewDate); const wrappedOriginalStartDate = new Date(originalStartDate); return { diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_base.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_base.ts index 9e2b4a63a1d8..e1d16ab2d01b 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_base.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_base.ts @@ -28,13 +28,13 @@ const COMPACT_THEME_WEEK_VIEW_COLLECTOR_OFFSET = 1; class BaseRenderingStrategy { options: any; - _positioningStrategy: any; + protected positioningStrategy: any; - _maxAppointmentCountPerCell: any; + protected maxAppointmentCountPerCell: any; constructor(options) { this.options = options; - this._initPositioningStrategy(); + this.initPositioningStrategy(); } get isAdaptive() { return this.options.adaptivityEnabled; } @@ -105,19 +105,19 @@ class BaseRenderingStrategy { get isVirtualScrolling() { return this.options.isVirtualScrolling; } - _correctCollectorCoordinatesInAdaptive(coordinates, isAllDay) { + protected correctCollectorCoordinatesInAdaptive(coordinates, isAllDay) { coordinates.top += this.getCollectorTopOffset(isAllDay); coordinates.left += this.getCollectorLeftOffset(); } - _initPositioningStrategy() { - this._positioningStrategy = this.isAdaptive + protected initPositioningStrategy() { + this.positioningStrategy = this.isAdaptive ? new AdaptivePositioningStrategy(this) : new AppointmentPositioningStrategy(this); } getPositioningStrategy() { - return this._positioningStrategy; + return this.positioningStrategy; } getAppointmentMinSize(): any { @@ -138,17 +138,17 @@ class BaseRenderingStrategy { // eslint-disable-next-line @typescript-eslint/no-unused-vars createTaskPositionMap(items: SafeAppointment[], skipSorting?) { - delete this._maxAppointmentCountPerCell; + delete this.maxAppointmentCountPerCell; const length = items?.length; if (!length) return; const map: any = []; for (let i = 0; i < length; i++) { - let coordinates = this._getItemPosition(items[i]); + let coordinates = this.getItemPosition(items[i]); if (coordinates.length && this.rtlEnabled) { - coordinates = this._correctRtlCoordinates(coordinates); + coordinates = this.correctRtlCoordinates(coordinates); } coordinates.forEach((item: any) => { @@ -161,14 +161,14 @@ class BaseRenderingStrategy { map.push(coordinates); } - const positionArray = this._getSortedPositions(map); - const resultPositions = this._getResultPositions(positionArray); + const positionArray = this.getSortedPositions(map); + const resultPositions = this.getResultPositions(positionArray); - return this._getExtendedPositionMap(map, resultPositions); + return this.getExtendedPositionMap(map, resultPositions); } - _correctRtlCoordinates(coordinates) { - const width = coordinates[0].width || this._getAppointmentMaxWidth(); + protected correctRtlCoordinates(coordinates) { + const width = coordinates[0].width || this.getAppointmentMaxWidth(); coordinates.forEach((coordinate) => { if (!coordinate.appointmentReduced) { @@ -179,11 +179,11 @@ class BaseRenderingStrategy { return coordinates; } - _getAppointmentMaxWidth() { + protected getAppointmentMaxWidth() { return this.cellWidth; } - _getItemPosition(initialAppointment) { + protected getItemPosition(initialAppointment) { const appointment = this.shiftAppointmentByViewOffset(initialAppointment); const position = this.generateAppointmentSettings(appointment); const allDay = this.isAllDay(appointment); @@ -200,7 +200,7 @@ class BaseRenderingStrategy { let initialRowIndex = position[j].rowIndex; let initialColumnIndex = position[j].columnIndex; - if (this._needVerifyItemSize() || allDay) { + if (this.needVerifyItemSize() || allDay) { const currentMaxAllowedPosition = position[j].hMax; if (this.isAppointmentGreaterThan(currentMaxAllowedPosition, { @@ -212,7 +212,7 @@ class BaseRenderingStrategy { initialRowIndex = position[j].rowIndex; initialColumnIndex = position[j].columnIndex; - resultWidth = this._reduceMultiWeekAppointment( + resultWidth = this.reduceMultiWeekAppointment( width, { left: position[j].left, @@ -220,7 +220,7 @@ class BaseRenderingStrategy { }, ); - multiWeekAppointmentParts = this._getAppointmentParts({ + multiWeekAppointmentParts = this.getAppointmentParts({ sourceAppointmentWidth: width, reducedWidth: resultWidth, height, @@ -240,13 +240,13 @@ class BaseRenderingStrategy { columnIndex: initialColumnIndex, appointmentReduced, }); - result = this._getAppointmentPartsPosition(multiWeekAppointmentParts, position[j], result); + result = this.getAppointmentPartsPosition(multiWeekAppointmentParts, position[j], result); } return result; } - _getAppointmentPartsPosition(appointmentParts, position, result) { + protected getAppointmentPartsPosition(appointmentParts, position, result) { if (appointmentParts.length) { appointmentParts.unshift(position); appointmentParts.forEach((part, index) => { @@ -282,17 +282,17 @@ class BaseRenderingStrategy { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getAppointmentParts(geometry, settings): any { + protected getAppointmentParts(geometry, settings): any { return []; } - _getCompactAppointmentParts(appointmentWidth) { + protected getCompactAppointmentParts(appointmentWidth) { const cellWidth = this.cellWidth || this.getAppointmentMinSize(); return Math.round(appointmentWidth / cellWidth); } - _reduceMultiWeekAppointment(sourceAppointmentWidth, bound) { + protected reduceMultiWeekAppointment(sourceAppointmentWidth, bound) { if (this.rtlEnabled) { sourceAppointmentWidth = Math.floor(bound.left - bound.right); } else { @@ -333,7 +333,7 @@ class BaseRenderingStrategy { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getSortedPositions(positionList, skipSorting?) { + protected getSortedPositions(positionList, skipSorting?) { const result: any = []; const round = (value) => Math.round(value * 100) / 100; @@ -358,56 +358,56 @@ class BaseRenderingStrategy { } } - return result.sort((a, b) => this._sortCondition(a, b)); + return result.sort((a, b) => this.sortCondition(a, b)); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _sortCondition(a, b) { + protected sortCondition(a, b) { } - _getConditions(a, b) { - const isSomeEdge = this._isSomeEdge(a, b); + protected getConditions(a, b) { + const isSomeEdge = this.isSomeEdge(a, b); return { - columnCondition: isSomeEdge || this._normalizeCondition(a.left, b.left), - rowCondition: isSomeEdge || this._normalizeCondition(a.top, b.top), - cellPositionCondition: isSomeEdge || this._normalizeCondition(a.cellPosition, b.cellPosition), + columnCondition: isSomeEdge || this.normalizeCondition(a.left, b.left), + rowCondition: isSomeEdge || this.normalizeCondition(a.top, b.top), + cellPositionCondition: isSomeEdge || this.normalizeCondition(a.cellPosition, b.cellPosition), }; } - _rowCondition(a, b): any { - const conditions = this._getConditions(a, b); + protected rowCondition(a, b): any { + const conditions = this.getConditions(a, b); return conditions.columnCondition || conditions.rowCondition; } - _columnCondition(a, b): any { - const conditions = this._getConditions(a, b); + protected columnCondition(a, b): any { + const conditions = this.getConditions(a, b); return conditions.rowCondition || conditions.columnCondition; } - _isSomeEdge(a, b) { + protected isSomeEdge(a, b) { return a.i === b.i && a.j === b.j; } - _normalizeCondition(first, second) { + protected normalizeCondition(first, second) { // NOTE: ie & ff pixels const result = first - second; return Math.abs(result) > 1 ? result : 0; } - _isItemsCross(firstItem, secondItem) { + protected isItemsCross(firstItem, secondItem) { const areItemsInTheSameTable = Boolean(firstItem.allDay) === Boolean(secondItem.allDay); const areItemsAllDay = firstItem.allDay && secondItem.allDay; if (areItemsInTheSameTable) { - const orientation = this._getOrientation(areItemsAllDay); + const orientation = this.getOrientation(areItemsAllDay); - return this._checkItemsCrossing(firstItem, secondItem, orientation); + return this.checkItemsCrossing(firstItem, secondItem, orientation); } return false; } - _checkItemsCrossing(firstItem, secondItem, orientation) { + protected checkItemsCrossing(firstItem, secondItem, orientation) { const firstItemSide1 = Math.floor(firstItem[orientation[0]]); const firstItemSide2 = Math.floor(firstItem[orientation[1]]); @@ -423,11 +423,11 @@ class BaseRenderingStrategy { ); } - _getOrientation(isAllDay) { + protected getOrientation(isAllDay) { return isAllDay ? ['left', 'right', 'top'] : ['top', 'bottom', 'left']; } - _getResultPositions(sortedArray) { + protected getResultPositions(sortedArray) { const result: any = []; let i; let sortedIndex = 0; @@ -447,7 +447,7 @@ class BaseRenderingStrategy { const createItem = (currentItem, index?) => { const currentIndex = index || 0; - const skipSortIndex = this._skipSortedIndex(currentIndex); + const skipSortIndex = this.skipSortedIndex(currentIndex); if (skipSortIndex) { stack.shouldShiftAfterSkip = true; @@ -482,7 +482,7 @@ class BaseRenderingStrategy { count: maxIndexInStack + 1, i: item.i, j: item.j, - sortedIndex: stack.shouldShiftAfterSkip && !this._skipSortedIndex(item.index) + sortedIndex: stack.shouldShiftAfterSkip && !this.skipSortedIndex(item.index) ? item.sortedIndex + 1 : item.sortedIndex, }); @@ -499,10 +499,10 @@ class BaseRenderingStrategy { if (!stack.items) { startNewStack(currentItem); - } else if (this._isItemsCross(stack, currentItem)) { + } else if (this.isItemsCross(stack, currentItem)) { // eslint-disable-next-line @typescript-eslint/no-loop-func stack.items.forEach((item) => { - if (this._isItemsCross(item, currentItem)) { + if (this.isItemsCross(item, currentItem)) { indexes.push(item.index); } }); @@ -532,11 +532,11 @@ class BaseRenderingStrategy { }); } - _skipSortedIndex(index) { - return index > this._getMaxAppointmentCountPerCell() - 1; + protected skipSortedIndex(index) { + return index > this.getMaxAppointmentCountPerCell() - 1; } - _findIndexByKey(arr, iKey, jKey, iValue, jValue): any { + protected findIndexByKey(arr, iKey, jKey, iValue, jValue): any { let result = 0; for (let i = 0, len = arr.length; i < len; i++) { if (arr[i][iKey] === iValue && arr[i][jKey] === jValue) { @@ -547,7 +547,7 @@ class BaseRenderingStrategy { return result; } - _getExtendedPositionMap(map, positions) { + protected getExtendedPositionMap(map, positions) { let positionCounter = 0; const result: any = []; @@ -558,7 +558,7 @@ class BaseRenderingStrategy { map[i][j].sortedIndex = positions[positionCounter].sortedIndex; map[i][j].count = positions[positionCounter++].count; resultString.push(map[i][j]); - this._checkLongCompactAppointment(map[i][j], resultString); + this.checkLongCompactAppointment(map[i][j], resultString); } result.push(resultString); } @@ -566,22 +566,22 @@ class BaseRenderingStrategy { return result; } - _checkLongCompactAppointment(item, result) { - this._splitLongCompactAppointment(item, result); + protected checkLongCompactAppointment(item, result) { + this.splitLongCompactAppointment(item, result); return result; } - _splitLongCompactAppointment(item, result) { - const appointmentCountPerCell = this._getMaxAppointmentCountPerCellByType(item.allDay); + protected splitLongCompactAppointment(item, result) { + const appointmentCountPerCell = this.getMaxAppointmentCountPerCellByType(item.allDay); let compactCount = 0; if (appointmentCountPerCell !== undefined && item.index > appointmentCountPerCell - 1) { item.isCompact = true; - compactCount = this._getCompactAppointmentParts(item.width); + compactCount = this.getCompactAppointmentParts(item.width); for (let k = 1; k < compactCount; k++) { const compactPart = extend(true, {}, item); - compactPart.left = (this as any)._getCompactLeftCoordinate(item.left, k); + compactPart.left = (this as any).getCompactLeftCoordinate(item.left, k); compactPart.columnIndex += k; compactPart.sortedIndex = null; result.push(compactPart); @@ -590,7 +590,7 @@ class BaseRenderingStrategy { return result; } - protected _adjustDurationByDaylightDiff( + protected adjustDurationByDaylightDiff( duration: number, startDate: Date, endDate: Date, @@ -599,36 +599,36 @@ class BaseRenderingStrategy { const originalStartDate = dateUtilsTs.addOffsets(startDate, [viewOffset]); const originalEndDate = dateUtilsTs.addOffsets(endDate, [viewOffset]); const daylightDiff = timeZoneUtils.getDaylightOffset(originalStartDate, originalEndDate); - const correctedDuration: number = this._needAdjustDuration(daylightDiff) - ? this._calculateDurationByDaylightDiff(duration, daylightDiff) + const correctedDuration: number = this.needAdjustDuration(daylightDiff) + ? this.calculateDurationByDaylightDiff(duration, daylightDiff) : duration; return correctedDuration <= Math.abs(daylightDiff) ? duration : correctedDuration; } - _needAdjustDuration(diff) { + protected needAdjustDuration(diff) { return diff !== 0; } - _calculateDurationByDaylightDiff(duration, diff) { + protected calculateDurationByDaylightDiff(duration, diff) { return duration + diff * toMs('minute'); } - _getCollectorLeftOffset(isAllDay) { + protected calculateCollectorLeftOffset(isAllDay) { if (isAllDay || !this.isApplyCompactAppointmentOffset()) { return 0; } const dropDownButtonWidth = this.getDropDownAppointmentWidth(this.intervalCount, isAllDay); - const rightOffset = this._isCompactTheme() + const rightOffset = this.isCompactTheme() ? COMPACT_THEME_WEEK_VIEW_COLLECTOR_OFFSET : WEEK_VIEW_COLLECTOR_OFFSET; return this.cellWidth - dropDownButtonWidth - rightOffset; } - _markAppointmentAsVirtual(coordinates, isAllDay = false) { - const countFullWidthAppointmentInCell = this._getMaxAppointmentCountPerCellByType(isAllDay); + protected markAppointmentAsVirtual(coordinates, isAllDay = false) { + const countFullWidthAppointmentInCell = this.getMaxAppointmentCountPerCellByType(isAllDay); if ((coordinates.count - countFullWidthAppointmentInCell) > 0) { const { top, left } = coordinates; const compactRender = this.isAdaptive || !isAllDay && this.supportCompactDropDownAppointments(); @@ -636,11 +636,11 @@ class BaseRenderingStrategy { const height = this.getDropDownAppointmentHeight(); const rtlOffset = this.rtlEnabled ? width : 0; coordinates.virtual = { - left: left + this._getCollectorLeftOffset(isAllDay) + rtlOffset, + left: left + this.calculateCollectorLeftOffset(isAllDay) + rtlOffset, top, width, height, - index: this._generateAppointmentCollectorIndex(coordinates, isAllDay), + index: this.generateAppointmentCollectorIndex(coordinates, isAllDay), isAllDay, groupIndex: coordinates.groupIndex, isCompact: compactRender, @@ -656,14 +656,14 @@ class BaseRenderingStrategy { return true; } - _generateAppointmentCollectorIndex({ + protected generateAppointmentCollectorIndex({ groupIndex, rowIndex, columnIndex, }, isAllDay) { return `${groupIndex}-${rowIndex}-${columnIndex}-${isAllDay}`; } - _getMaxAppointmentCountPerCellByType(isAllDay?) { - const appointmentCountPerCell = this._getMaxAppointmentCountPerCell(); + protected getMaxAppointmentCountPerCellByType(isAllDay?) { + const appointmentCountPerCell = this.getMaxAppointmentCountPerCell(); if (isObject(appointmentCountPerCell)) { return isAllDay @@ -700,7 +700,7 @@ class BaseRenderingStrategy { let resultMaxAppointmentsPerCell = maxAppointmentsPerCell; if (isNumeric(this.maxAppointmentsPerCell)) { - const dynamicAppointmentCountPerCell = this._getDynamicAppointmentCountPerCell(); + const dynamicAppointmentCountPerCell = this.getDynamicAppointmentCountPerCell(); const maxAppointmentCountDisplayedInCell = dynamicAppointmentCountPerCell.allDay || dynamicAppointmentCountPerCell; const maxAppointmentsCount = Math.max(currentAppointmentCountInCell, maxAppointmentCountDisplayedInCell); @@ -709,7 +709,7 @@ class BaseRenderingStrategy { return cellHeight / resultMaxAppointmentsPerCell; } - _customizeCoordinates(coordinates, cellHeight, appointmentCountPerCell, topOffset, isAllDay?) { + protected customizeCoordinates(coordinates, cellHeight, appointmentCountPerCell, topOffset, isAllDay?) { const { index, count } = coordinates; const appointmentHeight = this.getVerticalAppointmentHeight(cellHeight, count, appointmentCountPerCell); @@ -720,31 +720,31 @@ class BaseRenderingStrategy { const { left } = coordinates; if (coordinates.isCompact) { - this.isAdaptive && this._correctCollectorCoordinatesInAdaptive(coordinates, isAllDay); + this.isAdaptive && this.correctCollectorCoordinatesInAdaptive(coordinates, isAllDay); - this._markAppointmentAsVirtual(coordinates, isAllDay); + this.markAppointmentAsVirtual(coordinates, isAllDay); } return { height: appointmentHeight, width, top, left, - empty: this._isAppointmentEmpty(cellHeight, width), + empty: this.isAppointmentEmpty(cellHeight, width), }; } - _isAppointmentEmpty(height, width) { - return height < this._getAppointmentMinHeight() || width < this._getAppointmentMinWidth(); + protected isAppointmentEmpty(height, width) { + return height < this.getAppointmentMinHeight() || width < this.getAppointmentMinWidth(); } - _calculateGeometryConfig(coordinates) { + protected calculateGeometryConfig(coordinates) { const overlappingMode = this.maxAppointmentsPerCell; - const offsets: any = this._getOffsets(); - const appointmentDefaultOffset = this._getAppointmentDefaultOffset(); + const offsets: any = this.getOffsets(); + const appointmentDefaultOffset = this.getAppointmentDefaultOffset(); - let appointmentCountPerCell = this._getAppointmentCount(overlappingMode, coordinates); - let ratio: any = this._getDefaultRatio(coordinates, appointmentCountPerCell); - let maxHeight: any = this._getMaxHeight(); + let appointmentCountPerCell = this.getAppointmentCount(overlappingMode, coordinates); + let ratio: any = this.getDefaultRatio(coordinates, appointmentCountPerCell); + let maxHeight: any = this.getMaxHeight(); if (!isNumeric(appointmentCountPerCell)) { appointmentCountPerCell = coordinates.count; @@ -766,25 +766,25 @@ class BaseRenderingStrategy { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getAppointmentCount(overlappingMode, coordinates) { + protected getAppointmentCount(overlappingMode, coordinates) { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getDefaultRatio(coordinates, appointmentCountPerCell) { + protected getDefaultRatio(coordinates, appointmentCountPerCell) { } - _getOffsets() { + protected getOffsets() { } - _getMaxHeight() { + protected getMaxHeight() { } - _needVerifyItemSize() { + protected needVerifyItemSize() { return false; } - _getMaxAppointmentCountPerCell() { - if (!this._maxAppointmentCountPerCell) { + protected getMaxAppointmentCountPerCell() { + if (!this.maxAppointmentCountPerCell) { const overlappingMode = this.maxAppointmentsPerCell; let appointmentCountPerCell; @@ -792,19 +792,19 @@ class BaseRenderingStrategy { appointmentCountPerCell = overlappingMode; } if (overlappingMode === 'auto') { - appointmentCountPerCell = this._getDynamicAppointmentCountPerCell(); + appointmentCountPerCell = this.getDynamicAppointmentCountPerCell(); } if (overlappingMode === 'unlimited') { appointmentCountPerCell = undefined; } - this._maxAppointmentCountPerCell = appointmentCountPerCell; + this.maxAppointmentCountPerCell = appointmentCountPerCell; } - return this._maxAppointmentCountPerCell; + return this.maxAppointmentCountPerCell; } - _getDynamicAppointmentCountPerCell() { + protected getDynamicAppointmentCountPerCell() { return this.getPositioningStrategy().getDynamicAppointmentCountPerCell(); } @@ -812,34 +812,34 @@ class BaseRenderingStrategy { return false; } - _isCompactTheme() { + protected isCompactTheme() { return (currentTheme() || '').split('.').pop() === 'compact'; } - _getAppointmentDefaultOffset() { + protected getAppointmentDefaultOffset() { return this.getPositioningStrategy().getAppointmentDefaultOffset(); } - _getAppointmentDefaultHeight() { - return this._getAppointmentHeightByTheme(); + protected getAppointmentDefaultHeight() { + return this.getAppointmentHeightByTheme(); } - _getAppointmentMinHeight() { - return this._getAppointmentDefaultHeight(); + protected getAppointmentMinHeight() { + return this.getAppointmentDefaultHeight(); } - _getAppointmentHeightByTheme(): number { // TODO get rid of depending from themes - return this._isCompactTheme() + protected getAppointmentHeightByTheme(): number { // TODO get rid of depending from themes + return this.isCompactTheme() ? COMPACT_THEME_APPOINTMENT_DEFAULT_HEIGHT : APPOINTMENT_DEFAULT_HEIGHT; } - _getAppointmentDefaultWidth() { - return this.getPositioningStrategy()._getAppointmentDefaultWidth(); + protected getAppointmentDefaultWidth() { + return this.getPositioningStrategy().getAppointmentDefaultWidth(); } - _getAppointmentMinWidth() { - return this._getAppointmentDefaultWidth(); + protected getAppointmentMinWidth() { + return this.getAppointmentDefaultWidth(); } getAppointmentDurationInMs(apptStartDate, apptEndDate, allDay) { diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal.ts index 9a9156e98bd6..a843028be5ca 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal.ts @@ -10,7 +10,7 @@ const DROP_DOWN_BUTTON_OFFSET = 2; const toMs = dateUtils.dateToMilliseconds; class HorizontalRenderingStrategy extends BaseAppointmentsStrategy { - _needVerifyItemSize() { + protected needVerifyItemSize() { return true; } @@ -25,7 +25,7 @@ class HorizontalRenderingStrategy extends BaseAppointmentsStrategy { let duration = this.getAppointmentDurationInMs(startDate, normalizedEndDate, allDay); - duration = this._adjustDurationByDaylightDiff(duration, startDate, normalizedEndDate); + duration = this.adjustDurationByDaylightDiff(duration, startDate, normalizedEndDate); const cellDuration = this.cellDurationInMinutes * toMs('minute'); const skippedHours = getSkippedHoursInRange( @@ -40,57 +40,57 @@ class HorizontalRenderingStrategy extends BaseAppointmentsStrategy { return width; } - _needAdjustDuration(diff) { + protected needAdjustDuration(diff) { return diff < 0; } getAppointmentGeometry(coordinates) { - const result = this._customizeAppointmentGeometry(coordinates); + const result = this.customizeAppointmentGeometry(coordinates); return super.getAppointmentGeometry(result); } - _customizeAppointmentGeometry(coordinates) { - const config = this._calculateGeometryConfig(coordinates); + protected customizeAppointmentGeometry(coordinates) { + const config = this.calculateGeometryConfig(coordinates); - return this._customizeCoordinates(coordinates, config.height, config.appointmentCountPerCell, config.offset); + return this.customizeCoordinates(coordinates, config.height, config.appointmentCountPerCell, config.offset); } - _getOffsets() { + protected getOffsets() { return { unlimited: 0, auto: 0, }; } - _getCompactLeftCoordinate(itemLeft, index) { + protected getCompactLeftCoordinate(itemLeft, index) { const cellWidth = this.cellWidth || this.getAppointmentMinSize(); return itemLeft + cellWidth * index; } - _getMaxHeight() { + protected getMaxHeight() { return this.cellHeight || this.getAppointmentMinSize(); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getAppointmentCount(overlappingMode, coordinates) { - return this._getMaxAppointmentCountPerCellByType(false); + protected getAppointmentCount(overlappingMode, coordinates) { + return this.getMaxAppointmentCountPerCellByType(false); } - _getAppointmentDefaultHeight() { + protected getAppointmentDefaultHeight() { return DEFAULT_APPOINTMENT_HEIGHT; } - _getAppointmentMinHeight() { + protected getAppointmentMinHeight() { return MIN_APPOINTMENT_HEIGHT; } - _sortCondition(a, b) { - return this._columnCondition(a, b); + protected sortCondition(a, b) { + return this.columnCondition(a, b); } - _getOrientation() { + protected getOrientation() { return ['left', 'right', 'top']; } @@ -103,10 +103,10 @@ class HorizontalRenderingStrategy extends BaseAppointmentsStrategy { return this.dataAccessors.get('allDay', appointmentData); } - _isItemsCross(firstItem, secondItem) { - const orientation = this._getOrientation(); + protected isItemsCross(firstItem, secondItem) { + const orientation = this.getOrientation(); - return this._checkItemsCrossing(firstItem, secondItem, orientation); + return this.checkItemsCrossing(firstItem, secondItem, orientation); } getPositionShift(timeShift) { diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month.ts index bf00c54d5d50..741d34242459 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month.ts @@ -19,13 +19,13 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat get DOMMetaData() { return this.options.DOMMetaData; } - _getLeftPosition(settings) { + protected getLeftPosition(settings) { const fullWeekAppointmentWidth = this.getGroupWidth(settings.groupIndex); - return this._calculateMultiWeekAppointmentLeftOffset(settings.hMax, fullWeekAppointmentWidth); + return this.calculateMultiWeekAppointmentLeftOffset(settings.hMax, fullWeekAppointmentWidth); } - _getChunkCount( + protected getChunkCount( fullChunksWidth, firstChunkWidth, weekWidth, @@ -35,7 +35,7 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat const rawFullChunksWidth = fullChunksWidth - firstChunkWidth + weekWidth; const allChunksCount = Math.ceil(rawFullChunksWidth / weekWidth); - const viewRowIndex = this._tryGetRowIndexInView(startDate); + const viewRowIndex = this.tryGetRowIndexInView(startDate); if (viewRowIndex !== undefined) { const viewChunksCount = this.viewDataProvider.getRowCountInGroup(groupIndex); @@ -48,7 +48,7 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat // NOTE: This method tries to get real row index inside appointment's group view. // We cannot use settings.rowIndex, because this row index for all date table and not for special group. - _tryGetRowIndexInView(positionStartDate) { + protected tryGetRowIndexInView(positionStartDate) { const columnsCount = this.viewDataProvider.getColumnsCount(); if (this.options.dataRange?.length < 1 || !columnsCount) { @@ -65,7 +65,7 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getChunkWidths(geometry, settings, weekWidth) { + protected getChunkWidths(geometry, settings, weekWidth) { const firstChunkWidth = geometry.reducedWidth; const fullChunksWidth = Math.floor(geometry.sourceAppointmentWidth); const widthWithoutFirstChunk = fullChunksWidth - firstChunkWidth; @@ -73,7 +73,7 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat return [firstChunkWidth, fullChunksWidth, widthWithoutFirstChunk]; } - _getTailChunkSettings(withoutFirstChunkWidth, weekWidth, leftPosition) { + protected getTailChunkSettings(withoutFirstChunkWidth, weekWidth, leftPosition) { const tailChunkWidth = withoutFirstChunkWidth % weekWidth || weekWidth; const rtlPosition = leftPosition + (weekWidth - tailChunkWidth); const tailChunkLeftPosition = this.rtlEnabled ? rtlPosition : leftPosition; @@ -81,18 +81,18 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat return [tailChunkWidth, tailChunkLeftPosition]; } - _getAppointmentParts(geometry, settings) { + protected getAppointmentParts(geometry, settings) { const result: any = []; const weekWidth = Math.round(this.getGroupWidth(settings.groupIndex)); - const [firstChunkWidth, fullChunksWidth, withoutFirstChunkWidth] = this._getChunkWidths(geometry, settings, weekWidth); - const leftPosition = this._getLeftPosition(settings); + const [firstChunkWidth, fullChunksWidth, withoutFirstChunkWidth] = this.getChunkWidths(geometry, settings, weekWidth); + const leftPosition = this.getLeftPosition(settings); const { endDate } = settings.info.appointment; const hasTailChunk = this.endViewDate > endDate; - const chunkCount = this._getChunkCount(fullChunksWidth, firstChunkWidth, weekWidth, settings); + const chunkCount = this.getChunkCount(fullChunksWidth, firstChunkWidth, weekWidth, settings); - const [tailChunkWidth, tailChunkLeftPosition] = this._getTailChunkSettings(withoutFirstChunkWidth, weekWidth, leftPosition); + const [tailChunkWidth, tailChunkLeftPosition] = this.getTailChunkSettings(withoutFirstChunkWidth, weekWidth, leftPosition); for (let chunkIndex = 1; chunkIndex < chunkCount; chunkIndex++) { const topPosition = settings.top + this.cellHeight * chunkIndex; @@ -115,7 +115,7 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat return result; } - _calculateMultiWeekAppointmentLeftOffset(max, width) { + protected calculateMultiWeekAppointmentLeftOffset(max, width) { return this.rtlEnabled ? max : max - width; @@ -139,27 +139,27 @@ class HorizontalMonthRenderingStrategy extends HorizontalMonthLineRenderingStrat ); } - _getAppointmentDefaultHeight() { - return this._getAppointmentHeightByTheme(); + protected getAppointmentDefaultHeight() { + return this.getAppointmentHeightByTheme(); } - _getAppointmentMinHeight() { - return this._getAppointmentDefaultHeight(); + protected getAppointmentMinHeight() { + return this.getAppointmentDefaultHeight(); } createTaskPositionMap(items: SafeAppointment[]) { return super.createTaskPositionMap(items, true); } - _getSortedPositions(map) { - return super._getSortedPositions(map, true); + protected getSortedPositions(map) { + return super.getSortedPositions(map, true); } - _getDefaultRatio() { + protected getDefaultRatio() { return MONTH_APPOINTMENT_HEIGHT_RATIO; } - _getOffsets() { + protected getOffsets() { return { unlimited: MONTH_APPOINTMENT_MIN_OFFSET, auto: MONTH_APPOINTMENT_MAX_OFFSET, diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month_line.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month_line.ts index 10bf48dc6695..aa7341020bd4 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month_line.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_horizontal_month_line.ts @@ -15,7 +15,7 @@ class HorizontalMonthLineRenderingStrategy extends HorizontalAppointmentsStrateg } = position.info.appointment; const startDate = dateUtils.trimTime(startDateWithTime); const cellWidth = this.cellWidth || this.getAppointmentMinSize(); - const duration = Math.ceil(this._getDurationInDays(startDate, normalizedEndDate)); + const duration = Math.ceil(this.getDurationInDays(startDate, normalizedEndDate)); let width = this.cropAppointmentWidth(duration * cellWidth, cellWidth); @@ -33,13 +33,13 @@ class HorizontalMonthLineRenderingStrategy extends HorizontalAppointmentsStrateg return width; } - _columnCondition(a, b) { - const conditions = this._getConditions(a, b); + protected columnCondition(a, b) { + const conditions = this.getConditions(a, b); return conditions.rowCondition || conditions.columnCondition || conditions.cellPositionCondition; } - _getDurationInDays(startDate, endDate) { - const adjustedDuration = this._adjustDurationByDaylightDiff(endDate.getTime() - startDate.getTime(), startDate, endDate); + protected getDurationInDays(startDate, endDate) { + const adjustedDuration = this.adjustDurationByDaylightDiff(endDate.getTime() - startDate.getTime(), startDate, endDate); return (adjustedDuration / dateUtils.dateToMilliseconds('day')) || ZERO_APPOINTMENT_DURATION_IN_DAYS; } @@ -55,8 +55,8 @@ class HorizontalMonthLineRenderingStrategy extends HorizontalAppointmentsStrateg return super.createTaskPositionMap(items); } - _getSortedPositions(map, skipSorting) { - let result = super._getSortedPositions(map); + protected getSortedPositions(map, skipSorting) { + let result = super.getSortedPositions(map); if (!skipSorting) { // @ts-expect-error diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_vertical.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_vertical.ts index 1c669b8b55a7..c57255d2e128 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_vertical.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_vertical.ts @@ -14,10 +14,10 @@ const ALLDAY_APPOINTMENT_MAX_VERTICAL_OFFSET = 20; const toMs = dateUtils.dateToMilliseconds; class VerticalRenderingStrategy extends BaseAppointmentsStrategy { - _correctCollectorCoordinatesInAdaptive(coordinates, isAllDay) { + protected correctCollectorCoordinatesInAdaptive(coordinates, isAllDay) { if (isAllDay) { - super._correctCollectorCoordinatesInAdaptive(coordinates, isAllDay); - } else if (this._getMaxAppointmentCountPerCellByType() === 0) { + super.correctCollectorCoordinatesInAdaptive(coordinates, isAllDay); + } else if (this.getMaxAppointmentCountPerCellByType() === 0) { const { cellHeight } = this; const { cellWidth } = this; @@ -29,24 +29,24 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { getAppointmentGeometry(coordinates) { let geometry: any = null; if (coordinates.allDay) { - geometry = this._getAllDayAppointmentGeometry(coordinates); + geometry = this.getAllDayAppointmentGeometry(coordinates); } else { - geometry = this.isAdaptive && coordinates.isCompact ? this._getAdaptiveGeometry(coordinates) : this._getVerticalAppointmentGeometry(coordinates); + geometry = this.isAdaptive && coordinates.isCompact ? this.getAdaptiveGeometry(coordinates) : this.getVerticalAppointmentGeometry(coordinates); } return super.getAppointmentGeometry(geometry); } - _getAdaptiveGeometry(coordinates) { - const config = this._calculateGeometryConfig(coordinates); - return this._customizeCoordinates(coordinates, config.height, config.appointmentCountPerCell, config.offset); + protected getAdaptiveGeometry(coordinates) { + const config = this.calculateGeometryConfig(coordinates); + return this.customizeCoordinates(coordinates, config.height, config.appointmentCountPerCell, config.offset); } - _getItemPosition(initialAppointment) { + protected getItemPosition(initialAppointment) { const allDay = this.isAllDay(initialAppointment); if (allDay) { - return super._getItemPosition(initialAppointment); + return super.getItemPosition(initialAppointment); } const appointment = super.shiftAppointmentByViewOffset(initialAppointment); @@ -75,17 +75,17 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { let multiDaysAppointmentParts = []; const currentMaxAllowedPosition = currentSetting.vMax; - if (this._isMultiViewAppointment(currentSetting, height) || (isAppointmentTakesSeveralDays && !isRecurring)) { + if (this.isMultiViewAppointment(currentSetting, height) || (isAppointmentTakesSeveralDays && !isRecurring)) { const trimmedStartDate = dateUtils.trimTime(appointmentStartDate); const trimmedSettingStartDate = dateUtils.trimTime(currentSetting.info.appointment.startDate); const reduceHead = (trimmedStartDate <= trimmedSettingStartDate) || isRecurring; if (reduceHead) { - resultHeight = this._reduceMultiDayAppointment(height, { + resultHeight = this.reduceMultiDayAppointment(height, { top: currentSetting.top, bottom: currentMaxAllowedPosition, }); - multiDaysAppointmentParts = this._getAppointmentParts({ + multiDaysAppointmentParts = this.getAppointmentParts({ sourceAppointmentHeight: height, reducedHeight: resultHeight, width, @@ -112,7 +112,7 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { appointmentReduced, }); - result = this._getAppointmentPartsPosition( + result = this.getAppointmentPartsPosition( multiDaysAppointmentParts, currentSetting, result, @@ -122,7 +122,7 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { return result; } - _isMultiViewAppointment({ vMax, top }, height) { + protected isMultiViewAppointment({ vMax, top }, height) { // NOTE: we round these numbers, because in js 100 - 33.3333 = 66.66669999 const fullAppointmentHeight = roundFloatPart(height, 2); const remainingHeight = roundFloatPart(vMax - top, 2); @@ -130,15 +130,15 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { return fullAppointmentHeight > remainingHeight; } - _reduceMultiDayAppointment(sourceAppointmentHeight, bound) { + protected reduceMultiDayAppointment(sourceAppointmentHeight, bound) { return Math.min(sourceAppointmentHeight, bound.bottom - Math.floor(bound.top)); } - _getGroupHeight() { + protected getGroupHeight() { return this.cellHeight * this.rowCount; } - _getGroupTopOffset(appointmentSettings) { + protected getGroupTopOffset(appointmentSettings) { const { groupIndex } = appointmentSettings; const groupTop = Math.max(0, this.positionHelper.getGroupTop({ groupIndex, @@ -155,21 +155,21 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { return appointmentGroupTopOffset; } - _getTailHeight(appointmentGeometry, appointmentSettings) { + protected getTailHeight(appointmentGeometry, appointmentSettings) { if (!this.isVirtualScrolling) { return appointmentGeometry.sourceAppointmentHeight - appointmentGeometry.reducedHeight; } - const appointmentGroupTopOffset = this._getGroupTopOffset(appointmentSettings); + const appointmentGroupTopOffset = this.getGroupTopOffset(appointmentSettings); const { sourceAppointmentHeight } = appointmentGeometry; - const groupHeight = this._getGroupHeight(); + const groupHeight = this.getGroupHeight(); const tailHeight = appointmentGroupTopOffset + sourceAppointmentHeight - groupHeight; return tailHeight; } - _getAppointmentParts(appointmentGeometry, appointmentSettings) { + protected getAppointmentParts(appointmentGeometry, appointmentSettings) { const { width } = appointmentGeometry; const result: any = []; let currentPartTop = Math.max(0, this.positionHelper.getGroupTop({ @@ -201,7 +201,7 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { const hasTailPart = this.options.endViewDate > appointmentSettings.info.appointment.endDate; let left = Math.round(appointmentSettings.left + offset); - let tailHeight = this._getTailHeight(appointmentGeometry, appointmentSettings); + let tailHeight = this.getTailHeight(appointmentGeometry, appointmentSettings); let { columnIndex } = appointmentSettings; while (tailHeight > 0 && left < Math.round(hMax)) { @@ -231,31 +231,31 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { return result; } - _getMinuteHeight() { + protected getMinuteHeight() { return this.cellHeight / this.cellDurationInMinutes; } - _getCompactLeftCoordinate(itemLeft, index) { + protected getCompactLeftCoordinate(itemLeft, index) { const cellBorderSize = 1; const cellWidth = this.cellWidth || this.getAppointmentMinSize(); return itemLeft + (cellBorderSize + cellWidth) * index; } - _getVerticalAppointmentGeometry(coordinates) { - const config = this._calculateVerticalGeometryConfig(coordinates); + protected getVerticalAppointmentGeometry(coordinates) { + const config = this.calculateVerticalGeometryConfig(coordinates); - return this._customizeVerticalCoordinates(coordinates, config.width, config.appointmentCountPerCell, config.offset); + return this.customizeVerticalCoordinates(coordinates, config.width, config.appointmentCountPerCell, config.offset); } - _customizeVerticalCoordinates(coordinates, width, appointmentCountPerCell, topOffset, isAllDay?) { + protected customizeVerticalCoordinates(coordinates, width, appointmentCountPerCell, topOffset, isAllDay?) { const appointmentWidth = Math.max(width / appointmentCountPerCell, width / coordinates.count); const { height } = coordinates; const appointmentLeft = coordinates.left + (coordinates.index * appointmentWidth); const { top } = coordinates; if (coordinates.isCompact) { - this._markAppointmentAsVirtual(coordinates, isAllDay); + this.markAppointmentAsVirtual(coordinates, isAllDay); } return { @@ -263,18 +263,18 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { width: appointmentWidth, top, left: appointmentLeft, - empty: this._isAppointmentEmpty(height, width), + empty: this.isAppointmentEmpty(height, width), }; } - _calculateVerticalGeometryConfig(coordinates) { + protected calculateVerticalGeometryConfig(coordinates) { const overlappingMode = this.maxAppointmentsPerCell; - const offsets = this._getOffsets(); - const appointmentDefaultOffset = this._getAppointmentDefaultOffset(); + const offsets = this.getOffsets(); + const appointmentDefaultOffset = this.getAppointmentDefaultOffset(); - let appointmentCountPerCell = this._getAppointmentCount(overlappingMode, coordinates); - let ratio = this._getDefaultRatio(coordinates, appointmentCountPerCell); - let maxWidth = this._getMaxWidth(); + let appointmentCountPerCell = this.getAppointmentCount(overlappingMode, coordinates); + let ratio = this.getDefaultRatio(coordinates, appointmentCountPerCell); + let maxWidth = this.getMaxWidth(); if (!appointmentCountPerCell) { appointmentCountPerCell = coordinates.count; @@ -295,7 +295,7 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { }; } - _getMaxWidth() { + protected getMaxWidth() { return this.cellWidth; } @@ -306,8 +306,8 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { ); } - _getAppointmentMaxWidth() { - return this.cellWidth - this._getAppointmentDefaultOffset(); + protected getAppointmentMaxWidth() { + return this.cellWidth - this.getAppointmentDefaultOffset(); } calculateAppointmentWidth(appointment, position) { @@ -356,9 +356,9 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { this.viewDataProvider, ) * 60; - const durationInMinutes = this._adjustDurationByDaylightDiff(duration, startDate, normalizedEndDate) / toMs('minute') - skippedMinutes; + const durationInMinutes = this.adjustDurationByDaylightDiff(duration, startDate, normalizedEndDate) / toMs('minute') - skippedMinutes; - const height = durationInMinutes * this._getMinuteHeight(); + const height = durationInMinutes * this.getMinuteHeight(); return height; } @@ -367,34 +367,34 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { return 'vertical'; } - _sortCondition(a, b) { + protected sortCondition(a, b) { if (Boolean(a.allDay) !== Boolean(b.allDay)) { return a.allDay ? 1 : -1; } const isAllDay = a.allDay && b.allDay; return this.groupOrientation === 'vertical' && isAllDay - ? this._columnCondition(a, b) - : this._rowCondition(a, b); + ? this.columnCondition(a, b) + : this.rowCondition(a, b); } allDaySupported() { return true; } - _getAllDayAppointmentGeometry(coordinates) { - const config = this._calculateGeometryConfig(coordinates); + protected getAllDayAppointmentGeometry(coordinates) { + const config = this.calculateGeometryConfig(coordinates); - return this._customizeCoordinates(coordinates, config.height, config.appointmentCountPerCell, config.offset, true); + return this.customizeCoordinates(coordinates, config.height, config.appointmentCountPerCell, config.offset, true); } - _calculateGeometryConfig(coordinates) { + protected calculateGeometryConfig(coordinates) { if (!this.allowResizing || !this.allowAllDayResizing) { coordinates.skipResizing = true; } - const config: any = super._calculateGeometryConfig(coordinates); - const minAppointmentCountPerCell = Math.min(config.appointmentCountPerCell, this._getDynamicAppointmentCountPerCell().allDay); + const config: any = super.calculateGeometryConfig(coordinates); + const minAppointmentCountPerCell = Math.min(config.appointmentCountPerCell, this.getDynamicAppointmentCountPerCell().allDay); if (coordinates.allDay && coordinates.count <= minAppointmentCountPerCell) { config.offset = 0; @@ -403,28 +403,28 @@ class VerticalRenderingStrategy extends BaseAppointmentsStrategy { return config; } - _getAppointmentCount(overlappingMode, coordinates) { - return overlappingMode !== 'auto' && (coordinates.count === 1 && !isNumeric(overlappingMode)) ? coordinates.count : this._getMaxAppointmentCountPerCellByType(coordinates.allDay); + protected getAppointmentCount(overlappingMode, coordinates) { + return overlappingMode !== 'auto' && (coordinates.count === 1 && !isNumeric(overlappingMode)) ? coordinates.count : this.getMaxAppointmentCountPerCellByType(coordinates.allDay); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _getDefaultRatio(coordinates, appointmentCountPerCell) { + protected getDefaultRatio(coordinates, appointmentCountPerCell) { return coordinates.count > this.appointmentCountPerCell ? 0.65 : 1; } - _getOffsets() { + protected getOffsets() { return { unlimited: ALLDAY_APPOINTMENT_MIN_VERTICAL_OFFSET, auto: ALLDAY_APPOINTMENT_MAX_VERTICAL_OFFSET, }; } - _getMaxHeight() { + protected getMaxHeight() { return this.allDayHeight || this.getAppointmentMinSize(); } getPositionShift(timeShift, isAllDay) { - if (!isAllDay && this.isAdaptive && this._getMaxAppointmentCountPerCellByType(isAllDay) === 0) { + if (!isAllDay && this.isAdaptive && this.getMaxAppointmentCountPerCellByType(isAllDay) === 0) { return { top: 0, left: 0, diff --git a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_week.ts b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_week.ts index 725656a4b56e..8cb5b1e7c771 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_week.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/rendering_strategies/m_strategy_week.ts @@ -2,7 +2,7 @@ import VerticalRenderingStrategy from './m_strategy_vertical'; class WeekAppointmentRenderingStrategy extends VerticalRenderingStrategy { isApplyCompactAppointmentOffset() { - if (this.isAdaptive && this._getMaxAppointmentCountPerCellByType() === 0) { + if (this.isAdaptive && this.getMaxAppointmentCountPerCellByType() === 0) { return false; } diff --git a/packages/devextreme/js/__internal/scheduler/view_model/m_appointments_layout_manager.ts b/packages/devextreme/js/__internal/scheduler/view_model/m_appointments_layout_manager.ts index 1a306315bb12..f74d12cc051e 100644 --- a/packages/devextreme/js/__internal/scheduler/view_model/m_appointments_layout_manager.ts +++ b/packages/devextreme/js/__internal/scheduler/view_model/m_appointments_layout_manager.ts @@ -36,7 +36,7 @@ class AppointmentLayoutManager { appointmentViewModel = new AppointmentViewModelGenerator(); - _positionMap: any; + private positionMap: any; constructor(public instance: Scheduler) {} @@ -63,7 +63,7 @@ class AppointmentLayoutManager { return strategy.hasAllDayAppointments(this.filteredItems, this.preparedItems); } - protected _getRenderingStrategyOptions() { + protected getRenderingStrategyOptions() { const workspace = this.instance.getWorkSpace(); const { virtualScrollingDispatcher } = this.instance.getWorkSpace(); const { @@ -153,14 +153,14 @@ class AppointmentLayoutManager { } public createAppointmentsMap(): AppointmentViewModelPlain[] { - const renderingStrategyOptions = this._getRenderingStrategyOptions(); + const renderingStrategyOptions = this.getRenderingStrategyOptions(); const { viewModel, positionMap, } = this.appointmentViewModel.generate(this.filteredItems, renderingStrategyOptions) as any; - this._positionMap = positionMap; + this.positionMap = positionMap; return viewModel; } @@ -169,7 +169,7 @@ class AppointmentLayoutManager { const renderingStrategy = this.appointmentViewModel.getRenderingStrategy(); if (!renderingStrategy) { - const options = this._getRenderingStrategyOptions(); + const options = this.getRenderingStrategyOptions(); this.appointmentViewModel.initRenderingStrategy(options); } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/helpers/m_position_helper.ts b/packages/devextreme/js/__internal/scheduler/workspaces/helpers/m_position_helper.ts index 4f06fb59f3ba..1c0cddeb719e 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/helpers/m_position_helper.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/helpers/m_position_helper.ts @@ -201,7 +201,7 @@ class GroupStrategyBase { } getVerticalMax(options) { - let maxAllowedPosition = this._getMaxAllowedVerticalPosition({ + let maxAllowedPosition = this.getMaxAllowedVerticalPosition({ ...options, viewDataProvider: this.viewDataProvider, rtlEnabled: this.rtlEnabled, @@ -219,7 +219,7 @@ class GroupStrategyBase { isGroupedAllDayPanel, }) { const rowCount = this.viewDataProvider.getRowCountInGroup(groupIndex); - const maxVerticalPosition = this._getMaxAllowedVerticalPosition({ + const maxVerticalPosition = this.getMaxAllowedVerticalPosition({ groupIndex, viewDataProvider: this.viewDataProvider, showAllDayPanel, @@ -231,11 +231,11 @@ class GroupStrategyBase { return maxVerticalPosition - getCellHeight(this.DOMMetaData) * rowCount; } - _getAllDayHeight(showAllDayPanel) { + protected getAllDayHeight(showAllDayPanel) { return getAllDayHeight(showAllDayPanel, true, this.DOMMetaData); } - _getMaxAllowedVerticalPosition({ + protected getMaxAllowedVerticalPosition({ groupIndex, showAllDayPanel, isGroupedAllDayPanel, @@ -250,7 +250,7 @@ class GroupStrategyBase { // Should decrease allDayPanel amount due to the dual calculation corrections. if (isGroupedAllDayPanel) { - result -= (groupIndex + 1) * this._getAllDayHeight(showAllDayPanel); + result -= (groupIndex + 1) * this.getAllDayHeight(showAllDayPanel); } return result; @@ -272,7 +272,7 @@ class GroupStrategyHorizontal extends GroupStrategyBase { ? groupIndex : 0; - return this._getMaxAllowedVerticalPosition({ + return this.getMaxAllowedVerticalPosition({ ...options, groupIndex: correctedGroupIndex, }); @@ -282,7 +282,7 @@ class GroupStrategyHorizontal extends GroupStrategyBase { return 0; } - _getAllDayHeight(showAllDayPanel) { + protected getAllDayHeight(showAllDayPanel) { return getAllDayHeight(showAllDayPanel, false, this.DOMMetaData); } } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_agenda.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_agenda.ts index 8e9400878e28..db7cf0da4c57 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_agenda.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_agenda.ts @@ -41,13 +41,13 @@ const INNER_CELL_MARGIN = 5; const OUTER_CELL_MARGIN = 20; class SchedulerAgenda extends WorkSpace { - _startViewDate: any; + private startViewDate: any; - _rows: any; + private rows: number[][] = []; - _$rows: any; + private $rows: any; - _$noDataContainer: any; + private $noDataContainer: any; // eslint-disable-next-line class-methods-use-this protected _activeStateUnit(): string { @@ -59,7 +59,7 @@ class SchedulerAgenda extends WorkSpace { get renderingStrategy() { return (this.invoke as any)('getLayoutManager').getRenderingStrategyInstance(); } getStartViewDate() { - return this._startViewDate; + return this.startViewDate; } _init() { @@ -84,7 +84,7 @@ class SchedulerAgenda extends WorkSpace { break; case 'noDataText': case 'rowHeight': - this._recalculateAgenda(this._rows); + this.recalculateAgenda(this.rows); break; case 'groups': if (!value?.length) { @@ -94,7 +94,7 @@ class SchedulerAgenda extends WorkSpace { this.detachGroupCountClass(); } } else if (!this._$groupTable) { - this._initGroupTable(); + this.initGroupTable(); this._dateTableScrollable.$content().prepend(this._$groupTable); } super._optionChanged(args); @@ -122,7 +122,7 @@ class SchedulerAgenda extends WorkSpace { return AGENDA_CLASS; } - _calculateStartViewDate() { + private calculateStartViewDate() { return agendaUtils.calculateStartViewDate(this.option('currentDate') as any, this.option('startDayHour') as any); } @@ -142,17 +142,15 @@ class SchedulerAgenda extends WorkSpace { protected override updateAllDayVisibility() { return noop(); } - _updateAllDayHeight() { return noop(); } - protected override initWorkSpaceUnits() { - this._initGroupTable(); - this._$timePanel = $('').attr('aria-hidden', true).addClass(TIME_PANEL_CLASS); + this.initGroupTable(); + this.$timePanel = $('
').attr('aria-hidden', true).addClass(TIME_PANEL_CLASS); this._$dateTable = $('
').attr('aria-hidden', true).addClass(DATE_TABLE_CLASS); this._$dateTableScrollableContent = $('
').addClass('dx-scheduler-date-table-scrollable-content'); - this._$dateTableContainer = $('
').addClass('dx-scheduler-date-table-container'); + this.$dateTableContainer = $('
').addClass('dx-scheduler-date-table-container'); } - _initGroupTable() { + private initGroupTable() { const groups = this.option('groups'); if (groups?.length) { this._$groupTable = $('
').attr('aria-hidden', true).addClass(GROUP_TABLE_CLASS); @@ -160,24 +158,24 @@ class SchedulerAgenda extends WorkSpace { } protected override renderView() { - this._startViewDate = this._calculateStartViewDate(); - this._rows = []; + this.startViewDate = this.calculateStartViewDate(); + this.rows = []; this.initPositionHelper(); } - _recalculateAgenda(rows) { + private recalculateAgenda(rows) { let cellTemplates = []; - this._cleanView(); + this.cleanView(); - if (this._rowsIsEmpty(rows)) { - this._renderNoData(); + if (this.rowsIsEmpty(rows)) { + this.renderNoData(); return; } - this._rows = rows; + this.rows = rows; if (this._$groupTable) { cellTemplates = this.renderGroupHeader(); - this._setGroupHeaderCellsHeight(); + this.setGroupHeaderCellsHeight(); } this.renderTimePanel(); @@ -187,11 +185,11 @@ class SchedulerAgenda extends WorkSpace { this._dateTableScrollable.update(); } - _renderNoData() { - this._$noDataContainer = $('
').addClass(NODATA_CONTAINER_CLASS) + private renderNoData() { + this.$noDataContainer = $('
').addClass(NODATA_CONTAINER_CLASS) .html(this.option('noDataText') as any); - this._dateTableScrollable.$content().append(this._$noDataContainer); + this._dateTableScrollable.$content().append(this.$noDataContainer); } protected override setTableSizes() { return noop(); } @@ -199,11 +197,11 @@ class SchedulerAgenda extends WorkSpace { protected override toggleHorizontalScrollClass() { return noop(); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - _createCrossScrollingConfig(argument?: any) { return noop(); } + protected override createCrossScrollingConfig(argument?: any) { return noop(); } - _setGroupHeaderCellsHeight() { + private setGroupHeaderCellsHeight() { const $cells = this.getGroupHeaderCells().filter((_, element) => !element.getAttribute('rowSpan')); - const rows = this._removeEmptyRows(this._rows); + const rows = this.removeEmptyRows(this.rows); if (!rows.length) { return; @@ -211,11 +209,11 @@ class SchedulerAgenda extends WorkSpace { for (let i = 0; i < $cells.length; i++) { const $cellContent = $cells.eq(i).find('.dx-scheduler-group-header-content'); - setOuterHeight($cellContent, this._getGroupRowHeight(rows[i])); + setOuterHeight($cellContent, this.getGroupRowHeight(rows[i])); } } - _rowsIsEmpty(rows) { + private rowsIsEmpty(rows) { let result = true; for (let i = 0; i < rows.length; i++) { @@ -237,7 +235,7 @@ class SchedulerAgenda extends WorkSpace { (this.$element() as any).addClass(className); } - _removeEmptyRows(rows) { + private removeEmptyRows(rows) { const result: any[] = []; const isEmpty = function (data) { return !data.some((value) => value > 0); @@ -312,19 +310,19 @@ class SchedulerAgenda extends WorkSpace { }; } - _cleanView() { + protected override cleanView() { this._$dateTable.empty(); - this._$timePanel.empty(); + this.$timePanel.empty(); if (this._$groupTable) { this._$groupTable.empty(); } - if (this._$noDataContainer) { - this._$noDataContainer.empty(); - this._$noDataContainer.remove(); + if (this.$noDataContainer) { + this.$noDataContainer.empty(); + this.$noDataContainer.remove(); - delete this._$noDataContainer; + delete this.$noDataContainer; } } @@ -333,14 +331,14 @@ class SchedulerAgenda extends WorkSpace { } protected override createWorkSpaceStaticElements() { - this._$dateTableContainer.append(this._$dateTable); + this.$dateTableContainer.append(this._$dateTable); this._dateTableScrollable.$content().append(this._$dateTableScrollableContent); if (this._$groupTable) { this._$dateTableScrollableContent.prepend(this._$groupTable); } - this._$dateTableScrollableContent.append(this._$timePanel, this._$dateTableContainer); + this._$dateTableScrollableContent.append(this.$timePanel, this.$dateTableContainer); this.$element().append(this._dateTableScrollable.$element()); } @@ -356,13 +354,11 @@ class SchedulerAgenda extends WorkSpace { protected override attachEvents() { return noop(); } - _cleanCellDataCache() { return noop(); } - isIndicationAvailable() { return false; } - _prepareCellTemplateOptions(text, date, rowIndex, $cell) { + private prepareCellTemplateOptions(text, date, rowIndex, $cell) { const leaf = this.resourceManager.groupsLeafs[rowIndex]; const groups = leaf?.grouped ?? {}; const groupIndex = leaf?.groupIndex; @@ -384,7 +380,7 @@ class SchedulerAgenda extends WorkSpace { const cellTemplates: any[] = []; const cellTemplateOpt = options.cellTemplate; - this._$rows = []; + this.$rows = []; let i; const fillTableBody = function (rowIndex, rowSize) { @@ -394,7 +390,7 @@ class SchedulerAgenda extends WorkSpace { let cellDayName; const $row = $('
'); const $td = $('').append(this._$rows)); + $(options.container).append($('').append(this.$rows)); this.applyCellTemplates(cellTemplates); } - _setLastRowClass() { - if (this._rows.length > 1 && this._$rows.length) { - const $lastRow = this._$rows[this._$rows.length - 1]; + private setLastRowClass() { + if (this.rows.length > 1 && this.$rows.length) { + const $lastRow = this.$rows[this.$rows.length - 1]; $lastRow.addClass(LAST_ROW_CLASS); } @@ -442,31 +438,31 @@ class SchedulerAgenda extends WorkSpace { protected override renderTimePanel() { this.renderTableBody({ - container: getPublicElement(this._$timePanel), + container: getPublicElement(this.$timePanel), rowCount: this.getTimePanelRowCount(), cellCount: 1, rowClass: TIME_PANEL_ROW_CLASS, cellClass: TIME_PANEL_CELL_CLASS, cellTemplate: this.option('dateCellTemplate'), - getStartDate: this._getTimePanelStartDate.bind(this), + getStartDate: this.getTimePanelStartDate.bind(this), }); } - _getTimePanelStartDate(rowIndex) { + private getTimePanelStartDate(rowIndex) { const current = new Date(this.option('currentDate') as any); const cellDate = new Date(current.setDate(current.getDate() + rowIndex)); return cellDate; } - _getRowHeight(rowSize) { + private getRowHeight(rowSize) { const baseHeight = this.option('rowHeight') as any; const innerOffset = (rowSize - 1) * INNER_CELL_MARGIN; return rowSize ? (baseHeight * rowSize) + innerOffset + OUTER_CELL_MARGIN : 0; } - _getGroupRowHeight(groupRows) { + private getGroupRowHeight(groupRows) { if (!groupRows) { return; } @@ -474,13 +470,13 @@ class SchedulerAgenda extends WorkSpace { let result = 0; for (let i = 0; i < groupRows.length; i++) { - result += this._getRowHeight(groupRows[i]); + result += this.getRowHeight(groupRows[i]); } return result; } - _calculateRows(appointments?: SafeAppointment[]) { + private calculateRows(appointments?: SafeAppointment[]) { return this.renderingStrategy.calculateRows( appointments, this.option('agendaDuration'), @@ -493,8 +489,8 @@ class SchedulerAgenda extends WorkSpace { this.renderView(); - const rows = this._calculateRows(appointments); - this._recalculateAgenda(rows); + const rows = this.calculateRows(appointments); + this.recalculateAgenda(rows); } getAgendaVerticalStepHeight() { @@ -549,9 +545,7 @@ class SchedulerAgenda extends WorkSpace { renovatedRenderSupported() { return false; } - _setSelectedCellsByCellData() {} - - _getIntervalDuration() { + protected override getTotalViewDuration() { return dateUtils.dateToMilliseconds('day') * (this.option('intervalCount') as any); } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_controller.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_controller.ts index eb611889725b..736232c953a9 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_controller.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_controller.ts @@ -103,7 +103,7 @@ export class CellsSelectionController { }; } - return isDateAndTimeView(viewType) ? focusedCellPosition : this._processEdgeCell({ + return isDateAndTimeView(viewType) ? focusedCellPosition : this.processEdgeCell({ nextColumnIndex, rowIndex, columnIndex, @@ -115,7 +115,7 @@ export class CellsSelectionController { }); } - _processEdgeCell(options) { + private processEdgeCell(options) { const { nextColumnIndex, rowIndex, @@ -167,23 +167,23 @@ export class CellsSelectionController { const isValidMultiSelection = isMultiSelection && isMultiSelectionAllowed; const nextFocusedCellData = isValidMultiSelection - ? this._getNextCellData(currentCellData, focusedCellData) + ? this.getNextCellData(currentCellData, focusedCellData) : currentCellData; return nextFocusedCellData; } - _getNextCellData(nextFocusedCellData, focusedCellData, isVirtualCell?: any) { + private getNextCellData(nextFocusedCellData, focusedCellData, isVirtualCell?: any) { if (isVirtualCell) { return focusedCellData; } - const isValidNextFocusedCell = this._isValidNextFocusedCell(nextFocusedCellData, focusedCellData); + const isValidNextFocusedCell = this.isValidNextFocusedCell(nextFocusedCellData, focusedCellData); return isValidNextFocusedCell ? nextFocusedCellData : focusedCellData; } - _isValidNextFocusedCell(nextFocusedCellData, focusedCellData) { + private isValidNextFocusedCell(nextFocusedCellData, focusedCellData) { if (!focusedCellData) { return true; } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_state.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_state.ts index f228a88452cf..30e4eb7d4cb8 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_state.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_cells_selection_state.ts @@ -1,22 +1,22 @@ import type ViewDataProvider from './view_model/m_view_data_provider'; export default class CellsSelectionState { - _focusedCell: any = null; + private focusedCell: any = null; - _selectedCells: any = null; + private selectedCells: any = null; - _firstSelectedCell: any = null; + private firstSelectedCell: any = null; - _prevFocusedCell: any = null; + private prevFocusedCell: any = null; - _prevFirstSelectedCell: any; + private prevFirstSelectedCell: any; - _prevSelectedCells: any = null; + private prevSelectedCells: any = null; constructor(public viewDataProvider: ViewDataProvider) {} getFocusedCell() { - const focusedCell = this._focusedCell; + const { focusedCell } = this; if (!focusedCell) { return undefined; @@ -34,7 +34,7 @@ export default class CellsSelectionState { setFocusedCell(rowIndex, columnIndex, isAllDay) { if (rowIndex >= 0) { const cell = this.viewDataProvider.getCellData(rowIndex, columnIndex, isAllDay); - this._focusedCell = cell; + this.focusedCell = cell; } } @@ -54,20 +54,20 @@ export default class CellsSelectionState { firstCellCoordinates.columnIndex, firstCellCoordinates.allDay, ) - : this._firstSelectedCell; + : this.firstSelectedCell; const lastCell = viewDataProvider.getCellData(lastRowIndex, lastColumnIndex, isLastCellAllDay); - this._firstSelectedCell = firstCell; + this.firstSelectedCell = firstCell; - this._selectedCells = this.viewDataProvider.getCellsBetween(firstCell, lastCell); + this.selectedCells = this.viewDataProvider.getCellsBetween(firstCell, lastCell); } setSelectedCellsByData(selectedCellsData) { - this._selectedCells = selectedCellsData; + this.selectedCells = selectedCellsData; } getSelectedCells() { - return this._selectedCells; + return this.selectedCells; } releaseSelectedAndFocusedCells() { @@ -76,33 +76,33 @@ export default class CellsSelectionState { } releaseSelectedCells() { - this._prevSelectedCells = this._selectedCells; - this._prevFirstSelectedCell = this._firstSelectedCell; + this.prevSelectedCells = this.selectedCells; + this.prevFirstSelectedCell = this.firstSelectedCell; - this._selectedCells = null; - this._firstSelectedCell = null; + this.selectedCells = null; + this.firstSelectedCell = null; } releaseFocusedCell() { - this._prevFocusedCell = this._focusedCell; - this._focusedCell = null; + this.prevFocusedCell = this.focusedCell; + this.focusedCell = null; } restoreSelectedAndFocusedCells() { - this._selectedCells = this._selectedCells || this._prevSelectedCells; - this._focusedCell = this._focusedCell || this._prevFocusedCell; - this._firstSelectedCell = this._firstSelectedCell || this._prevFirstSelectedCell; + this.selectedCells = this.selectedCells || this.prevSelectedCells; + this.focusedCell = this.focusedCell || this.prevFocusedCell; + this.firstSelectedCell = this.firstSelectedCell || this.prevFirstSelectedCell; - this._prevSelectedCells = null; - this._prevFirstSelectedCell = null; - this._prevFocusedCell = null; + this.prevSelectedCells = null; + this.prevFirstSelectedCell = null; + this.prevFocusedCell = null; } clearSelectedAndFocusedCells() { - this._prevSelectedCells = null; - this._selectedCells = null; + this.prevSelectedCells = null; + this.selectedCells = null; - this._prevFocusedCell = null; - this._focusedCell = null; + this.prevFocusedCell = null; + this.focusedCell = null; } } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline.ts index a941dd0eb8b6..3be00b53ca44 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline.ts @@ -35,7 +35,7 @@ const HORIZONTAL = 'horizontal'; const toMs = dateUtils.dateToMilliseconds; class SchedulerTimeline extends SchedulerWorkSpace { - _$sidebarTable: any; + protected override $sidebarTable: any; get verticalGroupTableClass() { return GROUP_TABLE_CLASS; } @@ -44,7 +44,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { get renovatedHeaderPanelComponent() { return HeaderPanelTimelineComponent; } getGroupTableWidth() { - return this._$sidebarTable ? getOuterWidth(this._$sidebarTable) : 0; + return this.$sidebarTable ? getOuterWidth(this.$sidebarTable) : 0; } protected override getTotalRowCount(groupCount) { @@ -59,7 +59,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { return 'shorttime'; } - _getWorkSpaceHeight() { + private getWorkSpaceHeight() { if (this.option('crossScrollingEnabled') && hasWindow()) { return getBoundingRect(this._$dateTable.get(0)).height; } @@ -96,29 +96,29 @@ class SchedulerTimeline extends SchedulerWorkSpace { if (this._isHorizontalGroupedWorkSpace()) { return this._$thead; } - return this._$sidebarTable; + return this.$sidebarTable; } protected override insertAllDayRowsIntoDateTable() { return false; } - _needRenderWeekHeader() { + protected needRenderWeekHeader() { return false; } - _incrementDate(date) { + protected incrementDate(date) { date.setDate(date.getDate() + 1); } getIndicationCellCount() { - const timeDiff = this._getTimeDiff(); - return this._calculateDurationInCells(timeDiff); + const timeDiff = this.getTimeDiff(); + return this.calculateDurationInCells(timeDiff); } - _getTimeDiff() { - let today = this._getToday(); - const date = this._getIndicationFirstViewDate(); + private getTimeDiff() { + let today = this.getToday(); + const date = this.getIndicationFirstViewDate(); const startViewDate = this.getStartViewDate(); const dayLightOffset = timezoneUtils.getDaylightOffsetInMs(startViewDate, today); @@ -130,8 +130,8 @@ class SchedulerTimeline extends SchedulerWorkSpace { return today.getTime() - date.getTime(); } - _calculateDurationInCells(timeDiff) { - const today = this._getToday(); + protected calculateDurationInCells(timeDiff) { + const today = this.getToday(); const differenceInDays = Math.floor(timeDiff / toMs('day')); let duration = (timeDiff - differenceInDays * toMs('day') - (this.option('startDayHour') as any) * toMs('hour')) / this.getCellDuration(); @@ -156,26 +156,26 @@ class SchedulerTimeline extends SchedulerWorkSpace { return this.getIndicationCellCount() * this.getCellWidth(); } - _isVerticalShader() { + protected override isVerticalShader() { return false; } - _isCurrentTimeHeaderCell() { + protected override isCurrentTimeHeaderCell() { return false; } protected override setTableSizes() { super.setTableSizes(); - const minHeight = this._getWorkSpaceMinHeight(); - setHeight(this._$sidebarTable, minHeight); + const minHeight = this.getWorkSpaceMinHeight(); + setHeight(this.$sidebarTable, minHeight); setHeight(this._$dateTable, minHeight); this.virtualScrollingDispatcher.updateDimensions(); } - _getWorkSpaceMinHeight() { - let minHeight = this._getWorkSpaceHeight(); + private getWorkSpaceMinHeight() { + let minHeight = this.getWorkSpaceHeight(); const workspaceContainerHeight = getOuterHeight(this._$flexContainer, true); @@ -193,7 +193,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { }; } - _getCellByCoordinates(cellCoordinates, groupIndex) { + protected override getCellElementByPosition(cellCoordinates, groupIndex) { const indexes = this._groupedStrategy.prepareCellIndexes(cellCoordinates, groupIndex); return this._$dateTable @@ -207,7 +207,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { return getOuterWidth(this._$dateTable, true); } - _getIndicationFirstViewDate() { + private getIndicationFirstViewDate() { return dateUtils.trimTime(new Date(this.getStartViewDate())); } @@ -308,7 +308,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { return { ...options, - isGenerateWeekDaysHeaderData: this._needRenderWeekHeader(), + isGenerateWeekDaysHeaderData: this.needRenderWeekHeader(), getDateForHeaderText: timelineWeekUtils.getDateForHeaderText, }; } @@ -321,7 +321,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { super._init(); (this.$element() as any).addClass(TIMELINE_CLASS); - this._$sidebarTable = $('
') + this.$sidebarTable = $('
') .addClass(GROUP_TABLE_CLASS); } @@ -345,8 +345,6 @@ class SchedulerTimeline extends SchedulerWorkSpace { protected override updateAllDayVisibility() { return noop(); } - _updateAllDayHeight() { return noop(); } - protected override getDateHeaderTemplate() { return this.option('timeCellTemplate'); } @@ -365,7 +363,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { this._shader = new HorizontalShader(this); - this._$sidebarTable.appendTo(this._sidebarScrollable.$content()); + this.$sidebarTable.appendTo(this._sidebarScrollable.$content()); if (this.isRenovatedRender() && this.isVerticalGroupedWorkSpace()) { this.renderRGroupPanel(); @@ -383,9 +381,9 @@ class SchedulerTimeline extends SchedulerWorkSpace { .find(`.${HEADER_PANEL_CELL_CLASS}:not(.${HEADER_PANEL_WEEK_CELL_CLASS})`); } - _getCurrentTimePanelCellIndices() { + getCurrentTimePanelCellIndices() { const columnCountPerGroup = this._getCellCount(); - const today = this._getToday(); + const today = this.getToday(); const index = this.getCellIndexByDate(today); const { columnIndex: currentTimeColumnIndex } = this.getCellCoordinatesByIndex(index); @@ -413,7 +411,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { protected override renderDateHeader() { const $headerRow = super.renderDateHeader(); - if (this._needRenderWeekHeader()) { + if (this.needRenderWeekHeader()) { const firstViewDate = new Date(this.getStartViewDate()); let currentDate = new Date(firstViewDate); @@ -462,7 +460,7 @@ class SchedulerTimeline extends SchedulerWorkSpace { if ((templateIndex % cellsInGroup) === (cellsInGroup - 1)) { currentDate = new Date(firstViewDate); } else { - this._incrementDate(currentDate); + this.incrementDate(currentDate); } } @@ -471,18 +469,18 @@ class SchedulerTimeline extends SchedulerWorkSpace { } } - _renderIndicator(height, rtlOffset, $container, groupCount) { + protected override renderIndicator(height, rtlOffset, $container, groupCount) { let $indicator; const width = this.getIndicationWidth(); if (this.option('groupOrientation') === 'vertical') { - $indicator = this._createIndicator($container); + $indicator = this.createIndicator($container); setHeight($indicator, getBoundingRect($container.get(0)).height); $indicator.css('left', rtlOffset ? rtlOffset - width : width); } else { for (let i = 0; i < groupCount; i++) { const offset = this.isGroupedByDate() ? i * this.getCellWidth() : this._getCellCount() * this.getCellWidth() * i; - $indicator = this._createIndicator($container); + $indicator = this.createIndicator($container); setHeight($indicator, getBoundingRect($container.get(0)).height); $indicator.css('left', rtlOffset ? rtlOffset - width - offset : width + offset); @@ -512,20 +510,14 @@ class SchedulerTimeline extends SchedulerWorkSpace { // Old render methods. // TODO Old render: delete these methods with the old render. - _setCurrentTimeCells(): void { + protected override setCurrentTimeCells(): void { const timePanelCells = this.getTimePanelCells(); - const currentTimeCellIndices = this._getCurrentTimePanelCellIndices(); + const currentTimeCellIndices = this.getCurrentTimePanelCellIndices(); currentTimeCellIndices.forEach((timePanelCellIndex) => { timePanelCells.eq(timePanelCellIndex) .addClass(HEADER_CURRENT_TIME_CELL_CLASS); }); } - - _cleanCurrentTimeCells(): void { - (this.$element() as any) - .find(`.${HEADER_CURRENT_TIME_CELL_CLASS}`) - .removeClass(HEADER_CURRENT_TIME_CELL_CLASS); - } } registerComponent('dxSchedulerTimeline', SchedulerTimeline as any); diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_day.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_day.ts index f27ec597212c..415c4a32cd01 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_day.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_day.ts @@ -12,7 +12,7 @@ class SchedulerTimelineDay extends SchedulerTimeline { return TIMELINE_CLASS; } - _needRenderWeekHeader() { + protected override needRenderWeekHeader() { return this.isWorkSpaceWithCount(); } } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_month.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_month.ts index 25a9f16bf3a8..96478987146a 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_month.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_month.ts @@ -30,7 +30,7 @@ class SchedulerTimelineMonth extends SchedulerTimeline { return this.option('dateCellTemplate'); } - _calculateDurationInCells(timeDiff) { + protected override calculateDurationInCells(timeDiff) { return timeDiff / this.getCellDuration(); } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_week.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_week.ts index 8e03bf0018d4..0f38e0b3cdd5 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_week.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_week.ts @@ -1,5 +1,4 @@ import registerComponent from '@js/core/component_registrator'; -import { getBoundingRect } from '@js/core/utils/position'; import { VIEWS } from '../utils/options/constants_view'; import SchedulerTimeline from './m_timeline'; @@ -13,15 +12,11 @@ export default class SchedulerTimelineWeek extends SchedulerTimeline { return TIMELINE_CLASS; } - _getHeaderPanelCellWidth($headerRow) { - return getBoundingRect($headerRow.children().first().get(0)).width; - } - - _needRenderWeekHeader() { + protected override needRenderWeekHeader() { return true; } - _incrementDate(date) { + protected override incrementDate(date) { date.setDate(date.getDate() + 1); } } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_work_week.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_work_week.ts index 4c89a5f5abaa..f4fe25697191 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_work_week.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_timeline_work_week.ts @@ -23,12 +23,12 @@ class SchedulerTimelineWorkWeek extends SchedulerTimelineWeek { return TIMELINE_CLASS; } - _incrementDate(date) { + protected override incrementDate(date) { const day = date.getDay(); if (day === LAST_DAY_WEEK_INDEX) { date.setDate(date.getDate() + 2); } - super._incrementDate(date); + super.incrementDate(date); } } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts index 944f7e3b8616..8234b6b14de3 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts @@ -21,34 +21,34 @@ const scrollingOrientations = { const DefaultScrollingOrientation = scrollingOrientations.both; export class VirtualScrollingDispatcher { - _rowHeight: any; + private rowHeightValue: any; - _cellWidth: any; + private cellWidthValue: any; - _verticalVirtualScrolling: any; + private verticalVirtualScrollingValue: any; - _horizontalVirtualScrolling: any; + private horizontalVirtualScrollingValue: any; - _onScrollHandler: any; + private onScrollHandler: any; constructor(public options?: any) { if (options) { - this._rowHeight = this.getCellHeight(); - this._cellWidth = this.getCellWidth(); + this.rowHeightValue = this.getCellHeight(); + this.cellWidthValue = this.getCellWidth(); - this._createVirtualScrollingBase(); + this.createVirtualScrollingBase(); } } get isRTL() { return this.options.isRTL(); } - get verticalVirtualScrolling() { return this._verticalVirtualScrolling; } + get verticalVirtualScrolling() { return this.verticalVirtualScrollingValue; } - set verticalVirtualScrolling(value) { this._verticalVirtualScrolling = value; } + set verticalVirtualScrolling(value) { this.verticalVirtualScrollingValue = value; } - get horizontalVirtualScrolling() { return this._horizontalVirtualScrolling; } + get horizontalVirtualScrolling() { return this.horizontalVirtualScrollingValue; } - set horizontalVirtualScrolling(value) { this._horizontalVirtualScrolling = value; } + set horizontalVirtualScrolling(value) { this.horizontalVirtualScrollingValue = value; } get document() { return domAdapter.getDocument(); } @@ -60,15 +60,15 @@ export class VirtualScrollingDispatcher { return this.options.getSchedulerWidth(); } - get rowHeight() { return this._rowHeight; } + get rowHeight() { return this.rowHeightValue; } - set rowHeight(value) { this._rowHeight = value; } + set rowHeight(value) { this.rowHeightValue = value; } get outlineCount() { return this.options.getScrolling().outlineCount; } - get cellWidth() { return this._cellWidth; } + get cellWidth() { return this.cellWidthValue; } - set cellWidth(value) { this._cellWidth = value; } + set cellWidth(value) { this.cellWidthValue = value; } get viewportWidth() { const width = this.width && this.options.getViewWidth(); @@ -229,8 +229,8 @@ export class VirtualScrollingDispatcher { } dispose() { - if (this._onScrollHandler) { - eventsEngine.off(this.document, DOCUMENT_SCROLL_EVENT_NAMESPACE, this._onScrollHandler); + if (this.onScrollHandler) { + eventsEngine.off(this.document, DOCUMENT_SCROLL_EVENT_NAMESPACE, this.onScrollHandler); } } @@ -240,13 +240,13 @@ export class VirtualScrollingDispatcher { if (this.verticalScrollingAllowed !== isVerticalVirtualScrollingCreated || this.horizontalScrollingAllowed !== isHorizontalVirtualScrollingCreated) { - this._rowHeight = this.getCellHeight(); - this._cellWidth = this.getCellWidth(); - this._createVirtualScrollingBase(); + this.rowHeightValue = this.getCellHeight(); + this.cellWidthValue = this.getCellWidth(); + this.createVirtualScrollingBase(); } } - _createVirtualScrollingBase() { + private createVirtualScrollingBase() { if (this.verticalScrollingAllowed) { this.verticalVirtualScrolling = new VerticalVirtualScrolling({ ...this.options, @@ -272,14 +272,14 @@ export class VirtualScrollingDispatcher { attachScrollableEvents() { if (this.isAttachWindowScrollEvent()) { - this._attachWindowScroll(); + this.attachWindowScroll(); } } - _attachWindowScroll() { + private attachWindowScroll() { const window = getWindow(); - this._onScrollHandler = this.options.createAction(() => { + this.onScrollHandler = this.options.createAction(() => { const { scrollX, scrollY, @@ -293,7 +293,7 @@ export class VirtualScrollingDispatcher { } }); - eventsEngine.on(this.document, DOCUMENT_SCROLL_EVENT_NAMESPACE, this._onScrollHandler); + eventsEngine.on(this.document, DOCUMENT_SCROLL_EVENT_NAMESPACE, this.onScrollHandler); } handleOnScrollEvent(scrollPosition) { @@ -338,30 +338,30 @@ export class VirtualScrollingDispatcher { } class VirtualScrollingBase { - _state = this.defaultState; + private stateValue = this.defaultState; viewportSize = this.options.viewportSize; - _itemSize = this.options.itemSize; + private itemSizeValue = this.options.itemSize; - _position = -1; + private positionValue = -1; - _itemSizeChanged = false; + private itemSizeChanged = false; constructor(public options: any) { this.updateState(0); } - get itemSize() { return this._itemSize; } + get itemSize() { return this.itemSizeValue; } set itemSize(value) { - this._itemSizeChanged = this._itemSize !== value; - this._itemSize = value; + this.itemSizeChanged = this.itemSizeValue !== value; + this.itemSizeValue = value; } - get state() { return this._state; } + get state() { return this.stateValue; } - set state(value) { this._state = value; } + set state(value) { this.stateValue = value; } get startIndex() { return this.state.startIndex; } @@ -399,9 +399,9 @@ class VirtualScrollingBase { return this.getTotalItemCount() * this.itemSize - this.viewportSize; } - get position() { return this._position; } + get position() { return this.positionValue; } - set position(value) { this._position = value; } + set position(value) { this.positionValue = value; } needUpdateState(position) { const { @@ -416,7 +416,7 @@ class VirtualScrollingBase { let isStartIndexChanged = false; - if (this._validateAndSavePosition(position)) { + if (this.validateAndSavePosition(position)) { if (position === 0 || position === this.maxScrollPosition) { return true; } @@ -431,7 +431,7 @@ class VirtualScrollingBase { return isStartIndexChanged; } - _validateAndSavePosition(position) { + private validateAndSavePosition(position) { if (!isDefined(position)) { return false; } @@ -443,27 +443,27 @@ class VirtualScrollingBase { return result; } - _correctPosition(position) { + private correctPosition(position) { return position >= 0 ? Math.min(position, this.maxScrollPosition) : -1; } updateState(position, isForce?: any) { - position = this._correctPosition(position); + position = this.correctPosition(position); if (!this.needUpdateState(position) && !isForce) { return false; } - const itemsInfoBefore = this._calcItemInfoBefore(position); - const itemsDeltaBefore = this._calcItemDeltaBefore(itemsInfoBefore); + const itemsInfoBefore = this.calcItemInfoBefore(position); + const itemsDeltaBefore = this.calcItemDeltaBefore(itemsInfoBefore); const { outlineCountAfter, virtualItemCountAfter, itemCountWithAfter, - } = this._calcItemInfoAfter(itemsDeltaBefore); + } = this.calcItemInfoAfter(itemsDeltaBefore); const { virtualItemCountBefore, @@ -482,7 +482,7 @@ class VirtualScrollingBase { this.state.outlineCountAfter = outlineCountAfter; this.state.virtualItemCountAfter = virtualItemCountAfter; - this._updateStateCore(); + this.updateStateCore(); return true; } @@ -498,7 +498,7 @@ class VirtualScrollingBase { } } - _calcItemInfoBefore(position) { + private calcItemInfoBefore(position) { let virtualItemCountBefore = Math.floor(position / this.itemSize); const outlineCountBefore = Math.min(virtualItemCountBefore, this.outlineCount); @@ -511,7 +511,7 @@ class VirtualScrollingBase { }; } - _calcItemDeltaBefore(itemInfoBefore) { + private calcItemDeltaBefore(itemInfoBefore) { const { virtualItemCountBefore, outlineCountBefore, @@ -530,7 +530,7 @@ class VirtualScrollingBase { throw 'getRenderState method should be implemented'; } - _calcItemInfoAfter(itemsDeltaBefore) { + private calcItemInfoAfter(itemsDeltaBefore) { const itemCountWithAfter = itemsDeltaBefore >= this.pageSize ? this.pageSize : itemsDeltaBefore; @@ -552,7 +552,7 @@ class VirtualScrollingBase { }; } - _updateStateCore() { + private updateStateCore() { const { state } = this; const { virtualItemCountBefore } = state; @@ -578,13 +578,13 @@ class VirtualScrollingBase { const isAppend = prevVirtualSizeBefore < virtualSizeBefore; const isPrepend = prevVirtualSizeAfter < virtualSizeAfter; - const needAddItems = this._itemSizeChanged || isAppend || isPrepend; + const needAddItems = this.itemSizeChanged || isAppend || isPrepend; if (needAddItems) { - this._updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter); + this.updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter); } } - _updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter) { + protected updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter) { const { state } = this; state.virtualItemSizeBefore = virtualItemSizeBefore; @@ -649,9 +649,9 @@ class HorizontalVirtualScrolling extends VirtualScrollingBase { }; } - _updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter) { + protected updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter) { if (!this.isRTL) { - super._updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter); + super.updateStateVirtualItems(virtualItemSizeBefore, virtualItemSizeAfter); } else { const { state } = this; @@ -664,33 +664,34 @@ class HorizontalVirtualScrolling extends VirtualScrollingBase { // We do not need this class in renovation export class VirtualScrollingRenderer { - _renderAppointmentTimeoutID: any = null; + private renderAppointmentTimeoutID: any = null; - constructor(public _workspace: any) { + constructor(private readonly workspaceValue: any) { } getRenderTimeout() { return VIRTUAL_APPOINTMENTS_RENDER_TIMEOUT; } - get workspace() { return this._workspace; } + get workspace() { return this.workspaceValue; } updateRender() { this._renderGrid(); - this._renderAppointments(); + this.renderAppointments(); } + // TODO: make private once external usage in m_work_space.ts is removed _renderGrid() { this.workspace.renderWorkSpace(false); } - _renderAppointments() { + private renderAppointments() { const renderTimeout = this.getRenderTimeout(); if (renderTimeout >= 0) { - clearTimeout(this._renderAppointmentTimeoutID); + clearTimeout(this.renderAppointmentTimeoutID); - this._renderAppointmentTimeoutID = setTimeout( + this.renderAppointmentTimeoutID = setTimeout( () => this.workspace.updateAppointments(), renderTimeout, ); 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 dda528dba765..537381ca65a4 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts @@ -205,111 +205,123 @@ type WorkspaceOptionsInternal = Omit & { endDayHour: number; }; class SchedulerWorkSpace extends Widget { - _viewDataProvider: any; + private viewDataProviderValue: any; - _cache: any; + private cacheValue: any; - _cellsSelectionState: any; + private cellsSelectionStateValue: any; - _cellsSelectionController: any; + private cellsSelectionControllerValue: any; + // TODO: make private once external usages in shaders, grouped strategies, m_agenda.ts are removed _dateTableScrollable!: Scrollable; - _selectionChangedAction: any; + private selectionChangedAction: any; - _isCellClick: any; + private isCellClick: any; - _contextMenuHandled: any; + private contextMenuHandled: any; _disposed: any; - _getToday: any; + protected getToday?(): Date; + // TODO: make private once external usages in current_time_shader_vertical.ts are removed _$allDayPanel: any; - _$allDayTitle: any; + private $allDayTitle: any; - _$headerPanelEmptyCell: any; + private $headerPanelEmptyCell: any; + // TODO: make private once external usages in m_timeline.ts, m_work_space_indicator.ts are removed _groupedStrategy: any; - virtualScrollingDispatcher: any; + public virtualScrollingDispatcher: any; - _scrollSync: any; + private scrollSync: any; + // TODO: make private once external usages in m_work_space_grouped_strategy_vertical.ts are removed _$headerPanel: any; + // TODO: make private once external usages in m_timeline.ts, m_agenda.ts, m_work_space_month.ts are removed _$dateTable: any; - _$allDayTable: any; + private $allDayTable: any; - renderer: any; + private renderer: any; _createAction: any; - _cellClickAction: any; + private cellClickAction: any; _createActionByOption: any; - _showPopup: any; + private showPopup: any; - NAME: any; + private readonly NAME: any; - _contextMenuAction: any; + private contextMenuAction: any; + // TODO: make private once external usages in m_agenda.ts are removed _$groupTable: any; + // TODO: make private once external usages in m_timeline.ts are removed _$thead: any; - _headerScrollable: any; + private headerScrollable: any; + // TODO: make private once external usages in m_timeline.ts are removed _sidebarScrollable: any; - preventDefaultDragging: any; + private preventDefaultDragging: any; - dragBehavior: any; + public dragBehavior: any; - _$dateTableContainer: any; + protected $dateTableContainer: any; - _$timePanel: any; + protected $timePanel: any; positionHelper!: PositionHelper; + // TODO: make private once external usages in m_work_space_grouped_strategy_vertical.ts are removed _$headerPanelContainer: any; - _$headerTablesContainer: any; + private $headerTablesContainer: any; - _$fixedContainer: any; + private $fixedContainer: any; - _$allDayContainer: any; + private $allDayContainer: any; + // TODO: make private once external usages in m_agenda.ts are removed _$dateTableScrollableContent: any; - _$sidebarScrollableContent: any; + private $sidebarScrollableContent: any; - _allDayTitles!: any[]; + private allDayTitles!: any[]; - _allDayTables!: any[]; + private allDayTables!: any[]; - _allDayPanels!: any[]; + private allDayPanels!: any[]; + // TODO: make private once external usages in m_timeline.ts are removed _$flexContainer: any; + // TODO: make private once external usages in shaders, m_timeline.ts, m_work_space_indicator.ts are removed _shader: any; - _$sidebarTable: any; + protected $sidebarTable: any; - _interval: any; + private interval: any; - renovatedAllDayPanel: any; + private renovatedAllDayPanel: any; - renovatedDateTable: any; + public renovatedDateTable: any; - renovatedTimePanel: any; + private renovatedTimePanel: any; - renovatedGroupPanel: any; + private renovatedGroupPanel: any; - renovatedHeaderPanel: any; + public renovatedHeaderPanel: any; readonly viewDirection: 'vertical' | 'horizontal' = 'vertical'; @@ -324,18 +336,18 @@ class SchedulerWorkSpace extends Widget { } get viewDataProvider(): ViewDataProvider { - if (!this._viewDataProvider) { - this._viewDataProvider = new ViewDataProvider(this.type as ViewType); + if (!this.viewDataProviderValue) { + this.viewDataProviderValue = new ViewDataProvider(this.type as ViewType); } - return this._viewDataProvider; + return this.viewDataProviderValue; } get cache() { - if (!this._cache) { - this._cache = new Cache(); + if (!this.cacheValue) { + this.cacheValue = new Cache(); } - return this._cache; + return this.cacheValue; } get resourceManager(): ResourceManager { @@ -343,8 +355,8 @@ class SchedulerWorkSpace extends Widget { } get cellsSelectionState() { - if (!this._cellsSelectionState) { - this._cellsSelectionState = new CellsSelectionState(this.viewDataProvider); + if (!this.cellsSelectionStateValue) { + this.cellsSelectionStateValue = new CellsSelectionState(this.viewDataProvider); const selectedCellsOption: any = this.option('selectedCellData'); @@ -367,19 +379,19 @@ class SchedulerWorkSpace extends Widget { }; }); - this._cellsSelectionState.setSelectedCellsByData(validSelectedCells); + this.cellsSelectionStateValue.setSelectedCellsByData(validSelectedCells); } } - return this._cellsSelectionState; + return this.cellsSelectionStateValue; } get cellsSelectionController() { - if (!this._cellsSelectionController) { - this._cellsSelectionController = new CellsSelectionController(); + if (!this.cellsSelectionControllerValue) { + this.cellsSelectionControllerValue = new CellsSelectionController(); } - return this._cellsSelectionController; + return this.cellsSelectionControllerValue; } get isAllDayPanelVisible() { @@ -429,9 +441,9 @@ class SchedulerWorkSpace extends Widget { const selectedCellsElement = selectedCells.map((cellData) => this.getCellByData(cellData)).filter((cell) => Boolean(cell)); e.target = selectedCellsElement; - this._showPopup = true; + this.showPopup = true; - this._cellClickAction({ event: e, cellElement: $(selectedCellsElement), cellData: selectedCells[0] }); + this.cellClickAction({ event: e, cellElement: $(selectedCellsElement), cellData: selectedCells[0] }); } }; const onArrowPressed = (e, key) => { @@ -537,8 +549,8 @@ class SchedulerWorkSpace extends Widget { if (!this.viewDataProvider.isSameCell(focusedCellData, nextCellData)) { const $cell = nextCellData.allDay && !this.isVerticalGroupedWorkSpace() - ? this.dom_getAllDayPanelCell(nextCellPosition.columnIndex) - : this.dom_getDateCell(nextCellPosition); + ? this.domGetAllDayPanelCell(nextCellPosition.columnIndex) + : this.domGetDateCell(nextCellPosition); const isNextCellAllDay = nextCellData.allDay; this.setSelectedCellsStateAndUpdateSelection(isNextCellAllDay, nextCellPosition, isMultiSelection, $cell); @@ -581,9 +593,9 @@ class SchedulerWorkSpace extends Widget { const isTargetInsideWorkspace = $target.is($focusTarget) || $target.closest($focusTarget).length > 0; - if (isTargetInsideWorkspace && this._isCellClick) { - delete this._isCellClick; - delete this._contextMenuHandled; + if (isTargetInsideWorkspace && this.isCellClick) { + delete this.isCellClick; + delete this.contextMenuHandled; // @ts-expect-error super._focusInHandler.apply(this, arguments); @@ -612,7 +624,7 @@ class SchedulerWorkSpace extends Widget { // @ts-expect-error super._focusOutHandler.apply(this, arguments); - if (!this._contextMenuHandled && !this._disposed) { + if (!this.contextMenuHandled && !this._disposed) { this.cellsSelectionState.releaseSelectedAndFocusedCells(); this.viewDataProvider.updateViewData(this.generateRenderOptions()); @@ -628,7 +640,7 @@ class SchedulerWorkSpace extends Widget { return Boolean(this.option('groups')?.length) && this.option('groupOrientation') === 'vertical'; } - // TODO: make it private. Being used as public method by external code. + // TODO: make private once external usages in shaders, m_timeline.ts are removed _isHorizontalGroupedWorkSpace() { return Boolean(this.option('groups')?.length) && this.option('groupOrientation') === 'horizontal'; } @@ -649,7 +661,7 @@ class SchedulerWorkSpace extends Widget { createRAllDayPanelElements() { this._$allDayPanel = $('
').addClass(ALL_DAY_PANEL_CLASS); - this._$allDayTitle = $('
').appendTo(this._$headerPanelEmptyCell); + this.$allDayTitle = $('
').appendTo(this.$headerPanelEmptyCell); } protected dateTableScrollableConfig() { @@ -681,7 +693,7 @@ class SchedulerWorkSpace extends Widget { }; if (this.needCreateCrossScrolling()) { - config = extend(config, this._createCrossScrollingConfig(config)); + config = extend(config, this.createCrossScrollingConfig(config)); } if (this.isVirtualScrolling() @@ -701,15 +713,14 @@ class SchedulerWorkSpace extends Widget { return config; } - // TODO: make it private. Being used as public method by external code. - _createCrossScrollingConfig({ onScroll }): any { + protected createCrossScrollingConfig({ onScroll }): any { return { direction: 'both', onScroll: (event) => { onScroll?.(); - this._scrollSync.sidebar({ top: event.scrollOffset.top }); - this._scrollSync.header({ left: event.scrollOffset.left }); + this.scrollSync.sidebar({ top: event.scrollOffset.top }); + this.scrollSync.header({ left: event.scrollOffset.left }); }, onEnd: () => { (this.option('onScrollEnd') as any)(); @@ -726,7 +737,7 @@ class SchedulerWorkSpace extends Widget { updateManually: true, bounceEnabled: false, onScroll: (event) => { - this._scrollSync.dateTable({ left: event.scrollOffset.left }); + this.scrollSync.dateTable({ left: event.scrollOffset.left }); }, }; } @@ -766,8 +777,8 @@ class SchedulerWorkSpace extends Widget { setWidth(this._$headerPanel, width); setWidth(this._$dateTable, width); - if (this._$allDayTable) { - setWidth(this._$allDayTable, width); + if (this.$allDayTable) { + setWidth(this.$allDayTable, width); } this.attachHeaderTableClasses(); @@ -816,7 +827,7 @@ class SchedulerWorkSpace extends Widget { }); } - // TODO: make it private. Being used as public method by external code. + // TODO: make private once external usages in grouped strategies, shaders, m_timeline.ts are removed _getCellCount() { return this.viewDataProvider.getCellCount({ intervalCount: this.option('intervalCount'), @@ -875,7 +886,7 @@ class SchedulerWorkSpace extends Widget { startRowIndex: 0, startCellIndex: 0, groupOrientation, - today: this._getToday?.(), + today: this.getToday?.(), getResourceManager: this.option('getResourceManager'), isProvideVirtualCellsWidth, isAllDayPanelVisible: this.isAllDayPanelVisible, @@ -914,7 +925,7 @@ class SchedulerWorkSpace extends Widget { const timePanelWidth = this.getTimePanelWidth(); const groupPanelWidth = this.getGroupTableWidth(); - this._$headerPanelEmptyCell.css('width', timePanelWidth + groupPanelWidth); + this.$headerPanelEmptyCell.css('width', timePanelWidth + groupPanelWidth); } } @@ -946,12 +957,12 @@ class SchedulerWorkSpace extends Widget { return getViewStartByOptions( this.option('startDate'), this.option('currentDate'), - this._getIntervalDuration(), + this.getTotalViewDuration(), this.option('startDate') ? this.calculateViewStartDate() : undefined, ); } - protected _getIntervalDuration() { + protected getTotalViewDuration() { return this.viewDataProvider.getIntervalDuration(this.option('intervalCount')); } @@ -995,24 +1006,24 @@ class SchedulerWorkSpace extends Widget { }); eventsEngine.on($element, SCHEDULER_CELL_DXCLICK_EVENT_NAME, cellSelector, (e) => { const $cell = $(e.target); - that._cellClickAction({ event: e, cellElement: getPublicElement($cell), cellData: that.getCellData($cell) }); + that.cellClickAction({ event: e, cellElement: getPublicElement($cell), cellData: that.getCellData($cell) }); }); } private createCellClickAction() { - this._cellClickAction = this._createActionByOption('onCellClick', { + this.cellClickAction = this._createActionByOption('onCellClick', { afterExecute: (e) => this.cellClickHandler(e.args[0].event), }); } private createSelectionChangedAction() { - this._selectionChangedAction = this._createActionByOption('onSelectionChanged'); + this.selectionChangedAction = this._createActionByOption('onSelectionChanged'); } // eslint-disable-next-line @typescript-eslint/no-unused-vars private cellClickHandler(argument?: any) { - if (this._showPopup) { - delete this._showPopup; + if (this.showPopup) { + delete this.showPopup; this.handleSelectedCellsClick(); } } @@ -1021,13 +1032,13 @@ class SchedulerWorkSpace extends Widget { const $target = $(e.target); if (!$target.hasClass(DATE_TABLE_CELL_CLASS) && !$target.hasClass(ALL_DAY_TABLE_CELL_CLASS)) { - this._isCellClick = false; + this.isCellClick = false; return; } - this._isCellClick = true; + this.isCellClick = true; if ($target.hasClass(DATE_TABLE_FOCUSED_CELL_CLASS)) { - this._showPopup = true; + this.showPopup = true; } else { const cellCoordinates = this.getCoordinatesByCell($target); const isAllDayCell = this.hasAllDayClass($target); @@ -1068,12 +1079,12 @@ class SchedulerWorkSpace extends Widget { private contextMenuHandler(e) { const $cell = $(e.target); - this._contextMenuAction({ event: e, cellElement: getPublicElement($cell), cellData: this.getCellData($cell) }); - this._contextMenuHandled = true; + this.contextMenuAction({ event: e, cellElement: getPublicElement($cell), cellData: this.getCellData($cell) }); + this.contextMenuHandled = true; } private createContextMenuAction() { - this._contextMenuAction = this._createActionByOption('onCellContextMenu'); + this.contextMenuAction = this._createActionByOption('onCellContextMenu'); } protected getGroupHeaderContainer() { @@ -1094,7 +1105,7 @@ class SchedulerWorkSpace extends Widget { protected updateScrollable() { this._dateTableScrollable.update(); - this._headerScrollable?.update(); + this.headerScrollable?.update(); this._sidebarScrollable?.update(); this.updateHeaderPanelScrollbarPadding(); } @@ -1139,7 +1150,7 @@ class SchedulerWorkSpace extends Widget { ); } - // TODO: make it private. Being used as public method by external code. + // TODO: make private once external usages in grouped strategies, shaders, m_subscribes.ts, m_timeline.ts are removed _getGroupCount() { return this.resourceManager.groupCount(); } @@ -1229,7 +1240,7 @@ class SchedulerWorkSpace extends Widget { protected getFormat() { return abstract(); } getWorkArea() { - return this._$dateTableContainer; + return this.$dateTableContainer; } getScrollable() { @@ -1261,7 +1272,7 @@ class SchedulerWorkSpace extends Widget { } getTimePanelWidth() { - return this._$timePanel && getBoundingRect(this._$timePanel.get(0)).width; + return this.$timePanel && getBoundingRect(this.$timePanel.get(0)).width; } getGroupTableWidth() { @@ -1345,12 +1356,12 @@ class SchedulerWorkSpace extends Widget { }); } - protected _getCellByCoordinates(cellCoordinates, groupIndex, inAllDayRow) { + protected getCellElementByPosition(cellCoordinates, groupIndex, inAllDayRow) { const indexes = this._groupedStrategy.prepareCellIndexes(cellCoordinates, groupIndex, inAllDayRow); - return this.dom_getDateCell(indexes); + return this.domGetDateCell(indexes); } - private dom_getDateCell(position) { + private domGetDateCell(position) { return this._$dateTable .find(`tr:not(.${VIRTUAL_ROW_CLASS})`) .eq(position.rowIndex) @@ -1358,7 +1369,7 @@ class SchedulerWorkSpace extends Widget { .eq(position.columnIndex); } - private dom_getAllDayPanelCell(columnIndex) { + private domGetAllDayPanelCell(columnIndex) { return this._$allDayPanel .find('tr').eq(0) .find('td').eq(columnIndex); @@ -1921,7 +1932,7 @@ class SchedulerWorkSpace extends Widget { // eslint-disable-next-line @typescript-eslint/no-unused-vars private updateSelectedCellDataOption(selectedCellData, $nextFocusedCell?: any) { this.option('selectedCellData', selectedCellData); - this._selectionChangedAction({ selectedCellData }); + this.selectionChangedAction({ selectedCellData }); } private getCellByData(cellData) { @@ -1941,8 +1952,8 @@ class SchedulerWorkSpace extends Widget { } return allDay && !this.isVerticalGroupedWorkSpace() - ? this.dom_getAllDayPanelCell(position.columnIndex) - : this.dom_getDateCell(position); + ? this.domGetAllDayPanelCell(position.columnIndex) + : this.domGetDateCell(position); } // Must replace all DOM manipulations @@ -2013,7 +2024,7 @@ class SchedulerWorkSpace extends Widget { } // TODO: remove along with old render - private oldRender_getAllDayCellData(groupIndex) { + private oldRenderGetAllDayCellData(groupIndex) { return (cell, rowIndex, columnIndex) => { const validColumnIndex = columnIndex % this._getCellCount(); const options = this.getDateGenerationOptions(true); @@ -2126,8 +2137,8 @@ class SchedulerWorkSpace extends Widget { ...this.virtualScrollingDispatcher.horizontalVirtualScrolling?.getRenderState() || {}, }; - utils.renovation.renderComponent(this, this._$allDayTable, AllDayTableComponent, 'renovatedAllDayPanel', options); - utils.renovation.renderComponent(this, this._$allDayTitle, AllDayPanelTitleComponent, 'renovatedAllDayPanelTitle', {}); + utils.renovation.renderComponent(this, this.$allDayTable, AllDayTableComponent, 'renovatedAllDayPanel', options); + utils.renovation.renderComponent(this, this.$allDayTitle, AllDayPanelTitleComponent, 'renovatedAllDayPanelTitle', {}); } this.updateAllDayVisibility(); @@ -2137,7 +2148,7 @@ class SchedulerWorkSpace extends Widget { renderRTimeTable() { utils.renovation.renderComponent( this, - this._$timePanel, + this.$timePanel, TimePanelComponent, 'renovatedTimePanel', { @@ -2315,7 +2326,7 @@ class SchedulerWorkSpace extends Widget { this.cleanWorkSpace(); break; case 'groups': - this._cleanView(); + this.cleanView(); this.removeAllDayElements(); this.initGrouping(); this.repaint(); @@ -2329,7 +2340,7 @@ class SchedulerWorkSpace extends Widget { break; case 'showAllDayPanel': if (this.isVerticalGroupedWorkSpace()) { - this._cleanView(); + this.cleanView(); this.removeAllDayElements(); this.initGrouping(); this.repaint(); @@ -2425,7 +2436,7 @@ class SchedulerWorkSpace extends Widget { } protected cleanWorkSpace() { - this._cleanView(); + this.cleanView(); this.toggleGroupedClass(); this.toggleWorkSpaceWithOddCells(); @@ -2436,9 +2447,9 @@ class SchedulerWorkSpace extends Widget { } _init() { - this._scrollSync = {}; - this._viewDataProvider = null; - this._cellsSelectionState = null; + this.scrollSync = {}; + this.viewDataProviderValue = null; + this.cellsSelectionStateValue = null; // @ts-expect-error super._init(); @@ -2462,7 +2473,7 @@ class SchedulerWorkSpace extends Widget { viewStartDayHour: this.option('startDayHour'), viewEndDayHour: this.option('endDayHour'), cellDuration: this.getCellDuration(), - groupedStrategy: this._groupedStrategy, + _groupedStrategy: this._groupedStrategy, isGroupedByDate: this.isGroupedByDate(), rtlEnabled: this.option('rtlEnabled'), startViewDate: this.getStartViewDate(), @@ -2534,16 +2545,16 @@ class SchedulerWorkSpace extends Widget { protected initWorkSpaceUnits() { this._$headerPanelContainer = $('
').addClass('dx-scheduler-header-panel-container'); - this._$headerTablesContainer = $('
').addClass('dx-scheduler-header-tables-container'); + this.$headerTablesContainer = $('
').addClass('dx-scheduler-header-tables-container'); this._$headerPanel = $('
'); - setHeight($td, this._getRowHeight(rowSize)); + setHeight($td, this.getRowHeight(rowSize)); if (options.getStartDate) { date = options.getStartDate?.(rowIndex); @@ -403,7 +399,7 @@ class SchedulerAgenda extends WorkSpace { } if (cellTemplateOpt?.render) { - const templateOptions = this._prepareCellTemplateOptions(`${cellDateNumber} ${cellDayName}`, date, i, $td); + const templateOptions = this.prepareCellTemplateOptions(`${cellDateNumber} ${cellDayName}`, date, i, $td); cellTemplates.push(cellTemplateOpt.render.bind(cellTemplateOpt, templateOptions)); } else if (cellDateNumber && cellDayName) { @@ -419,22 +415,22 @@ class SchedulerAgenda extends WorkSpace { } $row.append($td); - this._$rows.push($row); + this.$rows.push($row); } }.bind(this); - for (i = 0; i < this._rows.length; i++) { - each(this._rows[i], fillTableBody); - this._setLastRowClass(); + for (i = 0; i < this.rows.length; i++) { + each(this.rows[i], fillTableBody); + this.setLastRowClass(); } - $(options.container).append($('
').attr('aria-hidden', true); this._$thead = $('').appendTo(this._$headerPanel); - this._$headerPanelEmptyCell = $('
').addClass('dx-scheduler-header-panel-empty-cell'); - this._$allDayTable = $('
').attr('aria-hidden', true); + this.$headerPanelEmptyCell = $('
').addClass('dx-scheduler-header-panel-empty-cell'); + this.$allDayTable = $('
').attr('aria-hidden', true); - this._$fixedContainer = $('
').addClass(FIXED_CONTAINER_CLASS); - this._$allDayContainer = $('
').addClass(ALL_DAY_CONTAINER_CLASS); + this.$fixedContainer = $('
').addClass(FIXED_CONTAINER_CLASS); + this.$allDayContainer = $('
').addClass(ALL_DAY_CONTAINER_CLASS); this._$dateTableScrollableContent = $('
').addClass('dx-scheduler-date-table-scrollable-content'); - this._$sidebarScrollableContent = $('
').addClass('dx-scheduler-side-bar-scrollable-content'); + this.$sidebarScrollableContent = $('
').addClass('dx-scheduler-side-bar-scrollable-content'); this.initAllDayPanelElements(); @@ -2553,16 +2564,16 @@ class SchedulerWorkSpace extends Widget { this.createAllDayPanelElements(); } - this._$timePanel = $('
').addClass(TIME_PANEL_CLASS).attr('aria-hidden', true); + this.$timePanel = $('
').addClass(TIME_PANEL_CLASS).attr('aria-hidden', true); this._$dateTable = $('
').attr('aria-hidden', true); - this._$dateTableContainer = $('
').addClass('dx-scheduler-date-table-container'); + this.$dateTableContainer = $('
').addClass('dx-scheduler-date-table-container'); this._$groupTable = $('
').addClass(WORKSPACE_VERTICAL_GROUP_TABLE_CLASS); } private initAllDayPanelElements() { - this._allDayTitles = []; - this._allDayTables = []; - this._allDayPanels = []; + this.allDayTitles = []; + this.allDayTables = []; + this.allDayPanels = []; } private initDateTableScrollable() { @@ -2570,7 +2581,7 @@ class SchedulerWorkSpace extends Widget { // @ts-expect-error this._dateTableScrollable = this._createComponent($dateTableScrollable, Scrollable, this.dateTableScrollableConfig()); - this._scrollSync.dateTable = getMemoizeScrollTo(() => this._dateTableScrollable); + this.scrollSync.dateTable = getMemoizeScrollTo(() => this._dateTableScrollable); } protected createWorkSpaceElements() { @@ -2582,50 +2593,50 @@ class SchedulerWorkSpace extends Widget { } protected createWorkSpaceStaticElements() { - this._$dateTableContainer.append(this._$dateTable); + this.$dateTableContainer.append(this._$dateTable); if (this.isVerticalGroupedWorkSpace()) { - this._$dateTableContainer.append(this._$allDayContainer); + this.$dateTableContainer.append(this.$allDayContainer); this._$dateTableScrollableContent.append( this._$groupTable, - this._$timePanel, - this._$dateTableContainer, + this.$timePanel, + this.$dateTableContainer, ); this._dateTableScrollable.$content().append( this._$dateTableScrollableContent, ); - this._$headerTablesContainer.append(this._$headerPanel); + this.$headerTablesContainer.append(this._$headerPanel); } else { this._$dateTableScrollableContent.append( - this._$timePanel, - this._$dateTableContainer, + this.$timePanel, + this.$dateTableContainer, ); this._dateTableScrollable.$content().append(this._$dateTableScrollableContent); - this._$headerTablesContainer.append(this._$headerPanel, this._$allDayPanel); - this._$allDayPanel?.append(this._$allDayContainer, this._$allDayTable); + this.$headerTablesContainer.append(this._$headerPanel, this._$allDayPanel); + this._$allDayPanel?.append(this.$allDayContainer, this.$allDayTable); } this.appendHeaderPanelEmptyCellIfNecessary(); - this._$headerPanelContainer.append(this._$headerTablesContainer); + this._$headerPanelContainer.append(this.$headerTablesContainer); this.$element() - .append(this._$fixedContainer) + .append(this.$fixedContainer) .append(this._$headerPanelContainer) .append(this._dateTableScrollable.$element()); } protected createWorkSpaceScrollableElements() { - this.$element().append(this._$fixedContainer); + this.$element().append(this.$fixedContainer); this._$flexContainer = $('
').addClass('dx-scheduler-work-space-flex-container'); this.createHeaderScrollable(); - this._headerScrollable.$content().append(this._$headerPanel); + this.headerScrollable.$content().append(this._$headerPanel); this.appendHeaderPanelEmptyCellIfNecessary(); - this._$headerPanelContainer.append(this._$headerTablesContainer); + this._$headerPanelContainer.append(this.$headerTablesContainer); this.$element().append(this._$headerPanelContainer); this.$element().append(this._$flexContainer); @@ -2633,35 +2644,35 @@ class SchedulerWorkSpace extends Widget { this.createSidebarScrollable(); this._$flexContainer.append(this._dateTableScrollable.$element()); - this._$dateTableContainer.append(this._$dateTable); - this._$dateTableScrollableContent.append(this._$dateTableContainer); + this.$dateTableContainer.append(this._$dateTable); + this._$dateTableScrollableContent.append(this.$dateTableContainer); this._dateTableScrollable.$content().append(this._$dateTableScrollableContent); if (this.isVerticalGroupedWorkSpace()) { - this._$dateTableContainer.append(this._$allDayContainer); - this._$sidebarScrollableContent.append(this._$groupTable, this._$timePanel); + this.$dateTableContainer.append(this.$allDayContainer); + this.$sidebarScrollableContent.append(this._$groupTable, this.$timePanel); } else { - this._headerScrollable.$content().append(this._$allDayPanel); - this._$allDayPanel?.append(this._$allDayContainer, this._$allDayTable); - this._$sidebarScrollableContent.append(this._$timePanel); + this.headerScrollable.$content().append(this._$allDayPanel); + this._$allDayPanel?.append(this.$allDayContainer, this.$allDayTable); + this.$sidebarScrollableContent.append(this.$timePanel); } - this._sidebarScrollable.$content().append(this._$sidebarScrollableContent); + this._sidebarScrollable.$content().append(this.$sidebarScrollableContent); } private appendHeaderPanelEmptyCellIfNecessary() { - this.isRenderHeaderPanelEmptyCell() && this._$headerPanelContainer.append(this._$headerPanelEmptyCell); + this.isRenderHeaderPanelEmptyCell() && this._$headerPanelContainer.append(this.$headerPanelEmptyCell); } private createHeaderScrollable() { const $headerScrollable = $('
') .addClass(SCHEDULER_HEADER_SCROLLABLE_CLASS) - .appendTo(this._$headerTablesContainer); + .appendTo(this.$headerTablesContainer); // @ts-expect-error - this._headerScrollable = this._createComponent($headerScrollable, Scrollable, this.headerScrollableConfig()); - this._scrollSync.header = getMemoizeScrollTo(() => this._headerScrollable); + this.headerScrollable = this._createComponent($headerScrollable, Scrollable, this.headerScrollableConfig()); + this.scrollSync.header = getMemoizeScrollTo(() => this.headerScrollable); } private createSidebarScrollable() { @@ -2678,10 +2689,10 @@ class SchedulerWorkSpace extends Widget { updateManually: true, bounceEnabled: false, onScroll: (event) => { - this._scrollSync.dateTable({ top: event.scrollOffset.top }); + this.scrollSync.dateTable({ top: event.scrollOffset.top }); }, }); - this._scrollSync.sidebar = getMemoizeScrollTo(() => this._sidebarScrollable); + this.scrollSync.sidebar = getMemoizeScrollTo(() => this._sidebarScrollable); } private attachTableClasses() { @@ -2691,10 +2702,10 @@ class SchedulerWorkSpace extends Widget { const groupCount = this._getGroupCount(); for (let i = 0; i < groupCount; i++) { - this.addTableClass(this._allDayTables[i], ALL_DAY_TABLE_CLASS); + this.addTableClass(this.allDayTables[i], ALL_DAY_TABLE_CLASS); } } else if (!this.isRenovatedRender()) { - this.addTableClass(this._$allDayTable, ALL_DAY_TABLE_CLASS); + this.addTableClass(this.$allDayTable, ALL_DAY_TABLE_CLASS); } } @@ -2811,7 +2822,7 @@ class SchedulerWorkSpace extends Widget { } private getDateTables() { - return this._$dateTable.add(this._$allDayTable); + return this._$dateTable.add(this.$allDayTable); } private getDateTable() { @@ -2819,28 +2830,27 @@ class SchedulerWorkSpace extends Widget { } private removeAllDayElements() { - this._$allDayTable?.remove(); - this._$allDayTitle?.remove(); + this.$allDayTable?.remove(); + this.$allDayTitle?.remove(); } - // TODO: make it private. Being used as public method by external code. - _cleanView(): void { + protected cleanView(): void { this.cache.clear(); this.cleanTableWidths(); this.cellsSelectionState.clearSelectedAndFocusedCells(); if (!this.isRenovatedRender()) { this._$thead.empty(); this._$dateTable.empty(); - this._$timePanel.empty(); + this.$timePanel.empty(); this._$groupTable.empty(); - this._$allDayTable?.empty(); - this._$sidebarTable?.empty(); + this.$allDayTable?.empty(); + this.$sidebarTable?.empty(); } this._shader?.clean(); - delete this._interval; + delete this.interval; } _clean() { @@ -2854,7 +2864,7 @@ class SchedulerWorkSpace extends Widget { private cleanTableWidths() { this._$headerPanel.css('width', ''); this._$dateTable.css('width', ''); - this._$allDayTable?.css('width', ''); + this.$allDayTable?.css('width', ''); } private disposeRenovatedComponents() { @@ -2879,11 +2889,11 @@ class SchedulerWorkSpace extends Widget { } getFixedContainer() { - return this._$fixedContainer; + return this.$fixedContainer; } getAllDayContainer() { - return this._$allDayContainer; + return this.$allDayContainer; } updateRender() { @@ -2912,28 +2922,28 @@ class SchedulerWorkSpace extends Widget { .addClass(ALL_DAY_TITLE_CLASS) .text(messageLocalization.format('dxScheduler-allDay')); - this._allDayTitles.push($allDayTitle); + this.allDayTitles.push($allDayTitle); - this._$allDayTable = $('
').attr('aria-hidden', true); - this._allDayTables.push(this._$allDayTable); + this.$allDayTable = $('
').attr('aria-hidden', true); + this.allDayTables.push(this.$allDayTable); this._$allDayPanel = $('
') .addClass(ALL_DAY_PANEL_CLASS) - .append(this._$allDayTable); + .append(this.$allDayTable); - this._allDayPanels.push(this._$allDayPanel); + this.allDayPanels.push(this._$allDayPanel); } } else { - this._$allDayTitle = $('
') + this.$allDayTitle = $('
') .addClass(ALL_DAY_TITLE_CLASS) .text(messageLocalization.format('dxScheduler-allDay')) .appendTo(this.$element()); - this._$allDayTable = $('
').attr('aria-hidden', true); + this.$allDayTable = $('
').attr('aria-hidden', true); this._$allDayPanel = $('
') .addClass(ALL_DAY_PANEL_CLASS) - .append(this._$allDayTable); + .append(this.$allDayTable); } } @@ -3094,14 +3104,14 @@ class SchedulerWorkSpace extends Widget { } const cellTemplates = this.renderTableBody({ - container: this._allDayPanels.length ? getPublicElement(this._allDayTables[index]) : getPublicElement(this._$allDayTable), + container: this.allDayPanels.length ? getPublicElement(this.allDayTables[index]) : getPublicElement(this.$allDayTable), rowCount: 1, cellCount, cellClass: this.getAllDayPanelCellClass.bind(this), rowClass: ALL_DAY_TABLE_ROW_CLASS, cellTemplate: this.option('dataCellTemplate'), // TODO: remove along with old render - getCellData: this.oldRender_getAllDayCellData(index), + getCellData: this.oldRenderGetAllDayCellData(index), groupIndex: index, }, true); @@ -3155,7 +3165,7 @@ class SchedulerWorkSpace extends Widget { }; this.renderTableBody({ - container: getPublicElement(this._$timePanel), + container: getPublicElement(this.$timePanel), rowCount: this.getTimePanelRowCount() * repeatCount, cellCount: 1, cellClass: this.getTimeCellClass.bind(this), @@ -3164,7 +3174,7 @@ class SchedulerWorkSpace extends Widget { getCellText: (rowIndex) => getData(rowIndex, 'text'), getCellDate: (rowIndex) => getData(rowIndex, 'startDate'), groupCount: this._getCellCount(), - allDayElements: this.insertAllDayRowsIntoDateTable() ? this._allDayTitles : undefined, + allDayElements: this.insertAllDayRowsIntoDateTable() ? this.allDayTitles : undefined, getTemplateData: getTimeCellGroups.bind(this), }); } @@ -3205,7 +3215,7 @@ class SchedulerWorkSpace extends Widget { key: CELL_DATA, }; }, - allDayElements: this.insertAllDayRowsIntoDateTable() ? this._allDayPanels : undefined, + allDayElements: this.insertAllDayRowsIntoDateTable() ? this.allDayPanels : undefined, groupCount, groupByDate: this.option('groupByDate'), }); diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_horizontal.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_horizontal.ts index 65aaafb781cd..5e728dfb8bdc 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_horizontal.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_horizontal.ts @@ -4,6 +4,7 @@ import { WORK_SPACE_BORDER_PX } from '@ts/scheduler/workspaces/const'; import { FIRST_GROUP_CELL_CLASS, LAST_GROUP_CELL_CLASS } from '../m_classes'; class HorizontalGroupedStrategy { + // TODO: make private once external usages in current_time_shader.ts, current_time_shader_horizontal.ts are removed constructor(public _workSpace) { } @@ -75,7 +76,7 @@ class HorizontalGroupedStrategy { return this._workSpace.getTimePanelWidth(); } - _createGroupBoundOffset(startCell, endCell, cellWidth) { + private createGroupBoundOffset(startCell, endCell, cellWidth) { const extraOffset = cellWidth / 2; const startOffset = startCell ? startCell.offset().left - extraOffset : 0; @@ -89,19 +90,19 @@ class HorizontalGroupedStrategy { }; } - _getGroupedByDateBoundOffset($cells, cellWidth) { + private getGroupedByDateBoundOffset($cells, cellWidth) { const firstCellIndex = 0; const lastCellIndex = $cells.length - 1; const startCell = $cells.eq(firstCellIndex); const endCell = $cells.eq(lastCellIndex); - return this._createGroupBoundOffset(startCell, endCell, cellWidth); + return this.createGroupBoundOffset(startCell, endCell, cellWidth); } getGroupBoundsOffset(cellCount, $cells, cellWidth, coordinates, groupedDataMap) { if (this._workSpace.isGroupedByDate()) { - return this._getGroupedByDateBoundOffset($cells, cellWidth); + return this.getGroupedByDateBoundOffset($cells, cellWidth); } let startCell; @@ -122,11 +123,11 @@ class HorizontalGroupedStrategy { endCell = $cells.eq(groupEndPosition.columnIndex); } - return this._createGroupBoundOffset(startCell, endCell, cellWidth); + return this.createGroupBoundOffset(startCell, endCell, cellWidth); } shiftIndicator($indicator, height, rtlOffset, groupIndex) { - const offset = this._getIndicatorOffset(groupIndex); + const offset = this.getIndicatorOffset(groupIndex); const horizontalOffset = rtlOffset ? rtlOffset - offset : offset; @@ -134,20 +135,20 @@ class HorizontalGroupedStrategy { $indicator.css('top', height); } - _getIndicatorOffset(groupIndex) { + private getIndicatorOffset(groupIndex) { const groupByDay = this._workSpace.isGroupedByDate(); - return groupByDay ? this._calculateGroupByDateOffset(groupIndex) : this._calculateOffset(groupIndex); + return groupByDay ? this.calculateGroupByDateOffset(groupIndex) : this.calculateOffset(groupIndex); } - _calculateOffset(groupIndex) { + private calculateOffset(groupIndex) { const indicatorStartPosition = this._workSpace.getIndicatorOffset(groupIndex); const offset = this._workSpace._getCellCount() * this._workSpace.getCellWidth() * groupIndex; return indicatorStartPosition + offset; } - _calculateGroupByDateOffset(groupIndex) { + private calculateGroupByDateOffset(groupIndex) { return this._workSpace.getIndicatorOffset(0) * this._workSpace._getGroupCount() + this._workSpace.getCellWidth() * groupIndex; } @@ -183,12 +184,12 @@ class HorizontalGroupedStrategy { // --------------- addAdditionalGroupCellClasses(cellClass, index, i, j, applyUnconditionally = false) { - cellClass = this._addLastGroupCellClass(cellClass, index, applyUnconditionally); + cellClass = this.addLastGroupCellClass(cellClass, index, applyUnconditionally); - return this._addFirstGroupCellClass(cellClass, index, applyUnconditionally); + return this.addFirstGroupCellClass(cellClass, index, applyUnconditionally); } - _addLastGroupCellClass(cellClass, index, applyUnconditionally) { + private addLastGroupCellClass(cellClass, index, applyUnconditionally) { if (applyUnconditionally) { return `${cellClass} ${LAST_GROUP_CELL_CLASS}`; } @@ -206,7 +207,7 @@ class HorizontalGroupedStrategy { return cellClass; } - _addFirstGroupCellClass(cellClass, index, applyUnconditionally) { + private addFirstGroupCellClass(cellClass, index, applyUnconditionally) { if (applyUnconditionally) { return `${cellClass} ${FIRST_GROUP_CELL_CLASS}`; } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_vertical.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_vertical.ts index 4fbf46c25d6a..ebbeb0e0f5d8 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_vertical.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_grouped_strategy_vertical.ts @@ -8,10 +8,11 @@ import { FIRST_GROUP_CELL_CLASS, LAST_GROUP_CELL_CLASS } from '../m_classes'; class VerticalGroupedStrategy { cache = new Cache(); - _groupBoundsOffset: any; + private groupBoundsOffset: any; - _$container: any; + private readonly $container: any; + // TODO: make private once external usages in current_time_shader.ts, current_time_shader_vertical.ts are removed constructor(public _workSpace) { } @@ -103,14 +104,14 @@ class VerticalGroupedStrategy { const { left } = $firstCell.getBoundingClientRect(); const { right } = $lastCell.getBoundingClientRect(); - this._groupBoundsOffset = { + this.groupBoundsOffset = { left, right, top: topOffset, bottom: bottomOffset, }; - return this._groupBoundsOffset; + return this.groupBoundsOffset; }); } @@ -130,7 +131,7 @@ class VerticalGroupedStrategy { getShaderOffset(i, width) { const offset = this._workSpace.option('crossScrollingEnabled') ? 0 : this._workSpace.getGroupTableWidth(); - return this._workSpace.option('rtlEnabled') ? getBoundingRect(this._$container.get(0)).width - offset - this._workSpace.getWorkSpaceLeftOffset() - width : offset; + return this._workSpace.option('rtlEnabled') ? getBoundingRect(this.$container.get(0)).width - offset - this._workSpace.getWorkSpaceLeftOffset() - width : offset; } // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -172,12 +173,12 @@ class VerticalGroupedStrategy { // eslint-disable-next-line @typescript-eslint/no-unused-vars addAdditionalGroupCellClasses(cellClass, index, i, j) { - cellClass = this._addLastGroupCellClass(cellClass, i + 1); + cellClass = this.addLastGroupCellClass(cellClass, i + 1); - return this._addFirstGroupCellClass(cellClass, i + 1); + return this.addFirstGroupCellClass(cellClass, i + 1); } - _addLastGroupCellClass(cellClass, index) { + private addLastGroupCellClass(cellClass, index) { if (index % this._workSpace.getRowCount() === 0) { return `${cellClass} ${LAST_GROUP_CELL_CLASS}`; } @@ -185,7 +186,7 @@ class VerticalGroupedStrategy { return cellClass; } - _addFirstGroupCellClass(cellClass, index) { + private addFirstGroupCellClass(cellClass, index) { if ((index - 1) % this._workSpace.getRowCount() === 0) { return `${cellClass} ${FIRST_GROUP_CELL_CLASS}`; } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts index 2a23d2356840..77a14bb664d6 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts @@ -18,10 +18,9 @@ const SCHEDULER_DATE_TIME_INDICATOR_CLASS = 'dx-scheduler-date-time-indicator'; const TIME_PANEL_CURRENT_TIME_CELL_CLASS = 'dx-scheduler-time-panel-current-time-cell'; class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { - _indicatorInterval: any; + private indicatorInterval: any; - // @ts-expect-error - _getToday() { + protected getToday(): Date { const viewOffset = this.option('viewOffset') as number; const today = getToday(this.option('indicatorTime') as Date, this.timeZoneCalculator); return dateUtilsTs.addOffsets(today, [-viewOffset]); @@ -29,7 +28,7 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { isIndicationOnView(): boolean { if (this.option('showCurrentTimeIndicator')) { - const today = this._getToday(); + const today = this.getToday(); const endViewDate = dateUtils.trimTime(this.getEndViewDate()); return dateUtils.dateInRange(today, this.getStartViewDate(), new Date(endViewDate.getTime() + toMs('day'))); @@ -42,13 +41,13 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { return false; } - const today = this._getToday(); + const today = this.getToday(); return today >= dateUtils.trimTime(new Date(this.getStartViewDate())); } isIndicatorVisible() { - const today = this._getToday(); + const today = this.getToday(); // Subtracts 1 ms from the real endViewDate instead of 1 minute const endViewDate = new Date(this.getEndViewDate().getTime() + toMs('minute') - 1); @@ -59,11 +58,11 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { return dateUtils.dateInRange(today, firstViewDate, endViewDate); } - _renderIndicator(height, rtlOffset, $container, groupCount) { + protected renderIndicator(height, rtlOffset, $container, groupCount) { const groupedByDate = this.isGroupedByDate(); const repeatCount = groupedByDate ? 1 : groupCount; for (let i = 0; i < repeatCount; i++) { - const $indicator = this._createIndicator($container); + const $indicator = this.createIndicator($container); setWidth( $indicator, @@ -73,14 +72,14 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { } } - _createIndicator($container) { + protected createIndicator($container) { const $indicator = $('
').addClass(SCHEDULER_DATE_TIME_INDICATOR_CLASS); $container.append($indicator); return $indicator; } - _getRtlOffset(width) { + private getRtlOffset(width) { return this.option('rtlEnabled') ? getBoundingRect(this._dateTableScrollable.$content().get(0)).width - this.getTimePanelWidth() - width : 0; } @@ -89,27 +88,27 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { return; } - this._clearIndicatorUpdateInterval(); + this.clearIndicatorUpdateInterval(); - this._indicatorInterval = setInterval(() => { + this.indicatorInterval = setInterval(() => { this.renderCurrentDateTimeIndication(); }, this.option('indicatorUpdateInterval')); } - _clearIndicatorUpdateInterval() { - if (this._indicatorInterval) { - clearInterval(this._indicatorInterval); - delete this._indicatorInterval; + private clearIndicatorUpdateInterval() { + if (this.indicatorInterval) { + clearInterval(this.indicatorInterval); + delete this.indicatorInterval; } } - _isVerticalShader() { + protected isVerticalShader() { return true; } getIndicationWidth() { const cellCount = this._getCellCount(); - const cellSpan = Math.min(this._getIndicatorDaysSpan(), cellCount); + const cellSpan = Math.min(this.getIndicatorDaysSpan(), cellCount); const width = cellSpan * this.getCellWidth(); const maxWidth = this.getCellWidth() * cellCount; @@ -117,14 +116,14 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { } getIndicatorOffset() { - const cellSpan = this._getIndicatorDaysSpan() - 1; + const cellSpan = this.getIndicatorDaysSpan() - 1; const offset = cellSpan * this.getCellWidth(); return offset; } - _getIndicatorDaysSpan(): number { - const today = this._getToday(); + private getIndicatorDaysSpan(): number { + const today = this.getToday(); const viewStartTime = this.getStartViewDate().getTime(); let timeDiff = today.getTime() - viewStartTime; @@ -137,7 +136,7 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { } getIndicationHeight() { - const today = timezoneUtils.getDateWithoutTimezoneChange(this._getToday()); + const today = timezoneUtils.getDateWithoutTimezoneChange(this.getToday()); const cellHeight = this.getCellHeight(); const date = new Date(this.getStartViewDate()); @@ -152,7 +151,7 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { } _dispose() { - this._clearIndicatorUpdateInterval(); + this.clearIndicatorUpdateInterval(); super._dispose.apply(this, arguments as any); } @@ -171,17 +170,17 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { } renderCurrentDateTimeLineAndShader(): void { - this._cleanDateTimeIndicator(); + this.cleanDateTimeIndicator(); this._shader?.clean(); this.renderDateTimeIndication(); } - _isCurrentTimeHeaderCell(headerIndex: number): boolean { + protected isCurrentTimeHeaderCell(headerIndex: number): boolean { if (this.isIndicationOnView()) { const { completeDateHeaderMap } = this.viewDataProvider; const date = completeDateHeaderMap[completeDateHeaderMap.length - 1][headerIndex].startDate; - return dateUtils.sameDate(date, this._getToday()); + return dateUtils.sameDate(date, this.getToday()); } return false; @@ -190,17 +189,17 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { protected override getHeaderPanelCellClass(i) { const cellClass = super.getHeaderPanelCellClass(i); - if (this._isCurrentTimeHeaderCell(i)) { + if (this.isCurrentTimeHeaderCell(i)) { return `${cellClass} ${HEADER_CURRENT_TIME_CELL_CLASS}`; } return cellClass; } - _cleanView() { - super._cleanView(); + protected override cleanView() { + super.cleanView(); - this._cleanDateTimeIndicator(); + this.cleanDateTimeIndicator(); } _dimensionChanged() { @@ -209,7 +208,7 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { this.renderCurrentDateTimeLineAndShader(); } - _cleanDateTimeIndicator() { + private cleanDateTimeIndicator() { (this.$element() as any).find(`.${SCHEDULER_DATE_TIME_INDICATOR_CLASS}`).remove(); } @@ -252,9 +251,9 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { }); } - _getCurrentTimePanelCellIndices() { + protected getCurrentTimePanelCellIndices() { const rowCountPerGroup = this.getTimePanelRowCount(); - const today = this._getToday(); + const today = this.getToday(); const index = this.getCellIndexByDate(today); const { rowIndex: currentTimeRowIndex } = this.getCellCoordinatesByIndex(index); @@ -298,32 +297,25 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace { const groupCount = this._getGroupCount() || 1; const $container = this._dateTableScrollable.$content(); const height = this.getIndicationHeight(); - const rtlOffset = this._getRtlOffset(this.getCellWidth()); + const rtlOffset = this.getRtlOffset(this.getCellWidth()); - this._renderIndicator(height, rtlOffset, $container, groupCount); + this.renderIndicator(height, rtlOffset, $container, groupCount); // TODO Old render: delete this code with the old render. if (!this.isRenovatedRender()) { - this._setCurrentTimeCells(); + this.setCurrentTimeCells(); } } - // Temporary new render methods. // TODO Old render: replace base call methods by these after the deleting of the old render. - protected _setCurrentTimeCells(): void { + protected setCurrentTimeCells(): void { const timePanelCells = this.getTimePanelCells(); - const currentTimeCellIndices = this._getCurrentTimePanelCellIndices(); + const currentTimeCellIndices = this.getCurrentTimePanelCellIndices(); currentTimeCellIndices.forEach((timePanelCellIndex) => { timePanelCells.eq(timePanelCellIndex) .addClass(TIME_PANEL_CURRENT_TIME_CELL_CLASS); }); } - - protected _cleanCurrentTimeCells(): void { - (this.$element() as any) - .find(`.${TIME_PANEL_CURRENT_TIME_CELL_CLASS}`) - .removeClass(TIME_PANEL_CURRENT_TIME_CELL_CLASS); - } } registerComponent('dxSchedulerWorkSpace', SchedulerWorkSpaceIndicator as any); diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_month.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_month.ts index c324a45a2773..b0409a223b97 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_month.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_month.ts @@ -158,8 +158,6 @@ class SchedulerWorkSpaceMonth extends SchedulerWorkSpace { protected override updateAllDayVisibility() { return noop(); } - _updateAllDayHeight() { return noop(); } - // -------------- // These methods should be deleted when we get rid of old render // -------------- @@ -168,7 +166,7 @@ class SchedulerWorkSpaceMonth extends SchedulerWorkSpace { protected override renderAllDayPanel() { return noop(); } - _setMonthClassesToCell($cell, data) { + private setMonthClassesToCell($cell, data) { $cell .toggleClass(DATE_TABLE_CURRENT_DATE_CLASS, data.isCurrentDate) .toggleClass(DATE_TABLE_FIRST_OF_MONTH_CLASS, data.isFirstDayMonthHighlighting) @@ -184,7 +182,7 @@ class SchedulerWorkSpaceMonth extends SchedulerWorkSpace { return monthUtils.getCellText(date, this.option('intervalCount') as any); }; options.getCellTextClass = DATE_TABLE_CELL_TEXT_CLASS; - options.setAdditionalClasses = this._setMonthClassesToCell.bind(this); + options.setAdditionalClasses = this.setMonthClassesToCell.bind(this); super.renderTableBody(options); } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_date_header_data_generator.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_date_header_data_generator.ts index e87874ba300a..8cd05ceb7e50 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_date_header_data_generator.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_date_header_data_generator.ts @@ -14,7 +14,7 @@ import { VIEWS } from '../../utils/options/constants_view'; import type { ViewDataProviderExtendedOptions } from './m_types'; export class DateHeaderDataGenerator { - constructor(public _viewDataGenerator) { + constructor(private readonly viewDataGenerator) { } getCompleteDateHeaderMap(options: ViewDataProviderExtendedOptions, completeViewDataMap) { @@ -25,18 +25,18 @@ export class DateHeaderDataGenerator { const result: any[] = []; if (isGenerateWeekDaysHeaderData) { - const weekDaysRow = this._generateWeekDaysHeaderRowMap(options, completeViewDataMap); + const weekDaysRow = this.generateWeekDaysHeaderRowMap(options, completeViewDataMap); result.push(weekDaysRow); } - const dateRow = this._generateHeaderDateRow(options, completeViewDataMap); + const dateRow = this.generateHeaderDateRow(options, completeViewDataMap); result.push(dateRow); return result; } - _generateWeekDaysHeaderRowMap(options: ViewDataProviderExtendedOptions, completeViewDataMap) { + private generateWeekDaysHeaderRowMap(options: ViewDataProviderExtendedOptions, completeViewDataMap) { const { isGroupedByDate, getResourceManager, @@ -51,7 +51,7 @@ export class DateHeaderDataGenerator { const resourceManager = getResourceManager(); const groupCount = resourceManager.groupCount(); - const cellCountInDay = this._viewDataGenerator.getCellCountInDay(startDayHour, endDayHour, hoursInterval); + const cellCountInDay = this.viewDataGenerator.getCellCountInDay(startDayHour, endDayHour, hoursInterval); const horizontalGroupCount = getHorizontalGroupCount(groupCount, groupOrientation); const index = completeViewDataMap[0][0].allDay ? 1 : 0; const colSpan = isGroupedByDate ? horizontalGroupCount * cellCountInDay : cellCountInDay; @@ -60,7 +60,7 @@ export class DateHeaderDataGenerator { ? groupCount : 1; - const daysInGroup = this._viewDataGenerator.daysInInterval * intervalCount; + const daysInGroup = this.viewDataGenerator.daysInInterval * intervalCount; const daysInView = daysInGroup * datesRepeatCount; const weekDaysRow: any[] = []; @@ -81,7 +81,7 @@ export class DateHeaderDataGenerator { return weekDaysRow; } - _generateHeaderDateRow(options: ViewDataProviderExtendedOptions, completeViewDataMap) { + private generateHeaderDateRow(options: ViewDataProviderExtendedOptions, completeViewDataMap) { const { today, isGroupedByDate, @@ -105,7 +105,7 @@ export class DateHeaderDataGenerator { const colSpan = isGroupedByDate ? horizontalGroupCount : 1; const isVerticalGrouping = groupOrientation === 'vertical'; - const cellCountInGroupRow = this._viewDataGenerator.getCellCount({ + const cellCountInGroupRow = this.viewDataGenerator.getCellCount({ intervalCount, currentDate, viewType, @@ -113,7 +113,7 @@ export class DateHeaderDataGenerator { startDayHour, endDayHour, }); - const cellCountInDay = this._viewDataGenerator.getCellCountInDay(startDayHour, endDayHour, hoursInterval); + const cellCountInDay = this.viewDataGenerator.getCellCountInDay(startDayHour, endDayHour, hoursInterval); const slicedByColumnsData = isGroupedByDate ? completeViewDataMap[index].filter((_, columnIndex) => columnIndex % horizontalGroupCount === 0) @@ -177,11 +177,11 @@ export class DateHeaderDataGenerator { const validCellWidth = cellWidth || 0; if (isGenerateWeekDaysHeaderData) { - weekDayRowConfig = this._generateDateHeaderDataRow( + weekDayRowConfig = this.generateDateHeaderDataRow( options, completeDateHeaderMap, completeViewDataMap, - this._viewDataGenerator.getCellCountInDay(startDayHour, endDayHour, hoursInterval), + this.viewDataGenerator.getCellCountInDay(startDayHour, endDayHour, hoursInterval), 0, validCellWidth, ); @@ -189,7 +189,7 @@ export class DateHeaderDataGenerator { dataMap.push(weekDayRowConfig.dateRow); } - const datesRowConfig = this._generateDateHeaderDataRow( + const datesRowConfig = this.generateDateHeaderDataRow( options, completeDateHeaderMap, completeViewDataMap, @@ -214,7 +214,7 @@ export class DateHeaderDataGenerator { }; } - _generateDateHeaderDataRow( + private generateDateHeaderDataRow( options: ViewDataProviderExtendedOptions, completeDateHeaderMap, completeViewDataMap, diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_grouped_data_map_provider.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_grouped_data_map_provider.ts index 0b27c35811d0..5ae9ab69c119 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_grouped_data_map_provider.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_grouped_data_map_provider.ts @@ -11,12 +11,12 @@ export class GroupedDataMapProvider { completeViewDataMap: any; - _viewOptions: any; + private readonly viewOptions: any; constructor(viewDataGenerator, viewDataMap, completeViewDataMap, viewOptions) { this.groupedDataMap = viewDataGenerator.generateGroupedDataMap(viewDataMap); this.completeViewDataMap = completeViewDataMap; - this._viewOptions = viewOptions; + this.viewOptions = viewOptions; } getGroupStartDate(groupIndex: number): Date | null { @@ -101,9 +101,9 @@ export class GroupedDataMapProvider { allDayPanelGroupedMap, dateTableGroupedMap, } = this.groupedDataMap; - const { viewOffset } = this._viewOptions; + const { viewOffset } = this.viewOptions; - const rows = isAllDay && !this._viewOptions.isVerticalGrouping + const rows = isAllDay && !this.viewOptions.isVerticalGrouping ? allDayPanelGroupedMap[groupIndex] ? [allDayPanelGroupedMap[groupIndex]] : [] : dateTableGroupedMap[groupIndex] || []; @@ -124,7 +124,7 @@ export class GroupedDataMapProvider { } : originCellData; - if (this._isSameGroupIndexAndIndex(cellData, groupIndex, index)) { + if (this.isSameGroupIndexAndIndex(cellData, groupIndex, index)) { if (this.isStartDateInCell(startDate, isAllDay, cellData, originCellData)) { return cell.position; } @@ -148,7 +148,7 @@ export class GroupedDataMapProvider { endDate: originCellEndDate, }: any, ): boolean { - const { viewType } = this._viewOptions; + const { viewType } = this.viewOptions; const cellSecondIntervalOffset = this.getCellSecondIntervalOffset( originCellStartDate, @@ -210,7 +210,7 @@ export class GroupedDataMapProvider { return isInOriginInterval || isInSecondInterval; } - _isSameGroupIndexAndIndex(cellData, groupIndex, index) { + private isSameGroupIndexAndIndex(cellData, groupIndex, index) { return cellData.groupIndex === groupIndex && (index === undefined || cellData.index === index); } diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_time_panel_data_generator.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_time_panel_data_generator.ts index ac694311559c..6a282a9feccf 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_time_panel_data_generator.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_time_panel_data_generator.ts @@ -24,7 +24,7 @@ interface TimePanelVisibleInterval { } export class TimePanelDataGenerator { - constructor(public _viewDataGenerator) { + constructor(private readonly viewDataGenerator) { } getCompleteTimePanelMap(options: ViewDataProviderExtendedOptions, completeViewDataMap) { @@ -45,7 +45,7 @@ export class TimePanelDataGenerator { const rowsCount = completeViewDataMap.length - 1; const realEndViewDate = completeViewDataMap[rowsCount][completeViewDataMap[rowsCount].length - 1].endDate; - const rowCountInGroup = this._viewDataGenerator.getRowCount({ + const rowCountInGroup = this.viewDataGenerator.getRowCount({ intervalCount, currentDate, viewType, @@ -53,7 +53,7 @@ export class TimePanelDataGenerator { startDayHour, endDayHour, }); - const cellCountInGroupRow = this._viewDataGenerator.getCellCount({ + const cellCountInGroupRow = this.viewDataGenerator.getCellCount({ intervalCount, currentDate, viewType, @@ -155,14 +155,14 @@ export class TimePanelDataGenerator { const { previousGroupedData: groupedData, - } = this._generateTimePanelDataFromMap(timePanelMap, isVerticalGrouping); + } = this.generateTimePanelDataFromMap(timePanelMap, isVerticalGrouping); timePanelData.groupedData = groupedData; return timePanelData; } - _generateTimePanelDataFromMap(timePanelMap, isVerticalGrouping) { + private generateTimePanelDataFromMap(timePanelMap, isVerticalGrouping) { return timePanelMap.reduce(({ previousGroupIndex, previousGroupedData }, cellData) => { const currentGroupIndex = cellData.groupIndex; if (currentGroupIndex !== previousGroupIndex) { diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator.ts index 5612e69da3a1..c917ade5c4b4 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator.ts @@ -49,12 +49,12 @@ export class ViewDataGenerator { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - protected _calculateStartViewDate(options: any): Date { + protected calculateStartViewDate(options: any): Date { return new Date(); } public getStartViewDate(options): Date { - return this._calculateStartViewDate(options); + return this.calculateStartViewDate(options); } // entry point @@ -74,7 +74,7 @@ export class ViewDataGenerator { hoursInterval, } = options; - this._setVisibilityDates(options); + this.setVisibilityDates(options); this.setHiddenInterval(startDayHour, endDayHour, hoursInterval); const groupsList = getAllGroupValues(getResourceManager().groupsLeafs); @@ -96,12 +96,12 @@ export class ViewDataGenerator { }); let viewDataMap: (ViewCellDataSimple & ViewCellIndex)[][] = []; - const allDayPanelData = this._generateAllDayPanelData( + const allDayPanelData = this.generateAllDayPanelData( options, rowCountInGroup, cellCountInGroupRow, ); - const viewCellsData = this._generateViewCellsData( + const viewCellsData = this.generateViewCellsData( options, rowCountInGroup, cellCountInGroupRow, @@ -114,21 +114,21 @@ export class ViewDataGenerator { viewDataMap.push(...viewCellsData); if (isHorizontalGrouping && !isGroupedByDate) { - viewDataMap = this._transformViewDataMapForHorizontalGrouping(viewDataMap, groupsList); + viewDataMap = this.transformViewDataMapForHorizontalGrouping(viewDataMap, groupsList); } if (isVerticalGrouping) { - viewDataMap = this._transformViewDataMapForVerticalGrouping(viewDataMap, groupsList); + viewDataMap = this.transformViewDataMapForVerticalGrouping(viewDataMap, groupsList); } if (isGroupedByDate) { - viewDataMap = this._transformViewDataMapForGroupingByDate(viewDataMap, groupsList); + viewDataMap = this.transformViewDataMapForGroupingByDate(viewDataMap, groupsList); } - return this._addKeysToCells(viewDataMap); + return this.addKeysToCells(viewDataMap); } - protected _transformViewDataMapForHorizontalGrouping( + protected transformViewDataMapForHorizontalGrouping( viewDataMap: (ViewCellDataSimple & ViewCellIndex)[][], groupsList: GroupLeaf['grouped'][], ): (ViewCellDataSimple & ViewCellIndex)[][] { @@ -151,7 +151,7 @@ export class ViewDataGenerator { return result; } - protected _transformViewDataMapForVerticalGrouping( + protected transformViewDataMapForVerticalGrouping( viewDataMap: (ViewCellDataSimple & ViewCellIndex)[][], groupsList: GroupLeaf['grouped'][], ): (ViewCellDataSimple & ViewCellIndex)[][] { @@ -176,7 +176,7 @@ export class ViewDataGenerator { return result; } - protected _transformViewDataMapForGroupingByDate( + protected transformViewDataMapForGroupingByDate( viewDataMap: (ViewCellDataSimple & ViewCellIndex)[][], groupsList: GroupLeaf['grouped'][], ): (ViewCellDataSimple & ViewCellIndex)[][] { @@ -210,7 +210,7 @@ export class ViewDataGenerator { return result; } - protected _addKeysToCells( + protected addKeysToCells( viewDataMap: (ViewCellDataSimple & ViewCellIndex)[][], ): ViewCellGeneratedData[][] { const totalColumnCount = viewDataMap[0].length; @@ -274,7 +274,7 @@ export class ViewDataGenerator { let correctedStartRowIndex = startRowIndex; let allDayPanelMap = []; - if (this._isStandaloneAllDayPanel(isVerticalGrouping, isAllDayPanelVisible)) { + if (this.isStandaloneAllDayPanel(isVerticalGrouping, isAllDayPanelVisible)) { correctedStartRowIndex++; allDayPanelMap = sliceCells(completeViewDataMap[0], 0, startCellIndex, cellCount); } @@ -291,7 +291,7 @@ export class ViewDataGenerator { }; } - protected _isStandaloneAllDayPanel(isVerticalGrouping, isAllDayPanelVisible) { + protected isStandaloneAllDayPanel(isVerticalGrouping, isAllDayPanelVisible) { return !isVerticalGrouping && isAllDayPanelVisible; } @@ -348,7 +348,7 @@ export class ViewDataGenerator { }; }, { previousGroupIndex: -1, groupedData: [] }); - if (this._isStandaloneAllDayPanel(isVerticalGrouping, isAllDayPanelVisible)) { + if (this.isStandaloneAllDayPanel(isVerticalGrouping, isAllDayPanelVisible)) { groupedData[0].allDayPanel = allDayPanelMap.map(({ cellData }) => cellData); } @@ -371,7 +371,7 @@ export class ViewDataGenerator { }; } - protected _generateViewCellsData( + protected generateViewCellsData( options: ViewDataProviderExtendedOptions, rowCount: number, cellCountInGroupRow: number, @@ -379,13 +379,13 @@ export class ViewDataGenerator { const viewCellsData: (ViewCellDataSimple & ViewCellIndex)[][] = []; for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) { - viewCellsData.push(this._generateCellsRow(options, false, rowIndex, rowCount, cellCountInGroupRow)); + viewCellsData.push(this.generateCellsRow(options, false, rowIndex, rowCount, cellCountInGroupRow)); } return viewCellsData; } - protected _generateAllDayPanelData( + protected generateAllDayPanelData( options: ViewDataProviderExtendedOptions, rowCount: number, columnCount: number, @@ -394,10 +394,10 @@ export class ViewDataGenerator { return null; } - return this._generateCellsRow(options, true, 0, rowCount, columnCount); + return this.generateCellsRow(options, true, 0, rowCount, columnCount); } - protected _generateCellsRow( + protected generateCellsRow( options: ViewDataProviderExtendedOptions, allDay: boolean, rowIndex: number, @@ -410,8 +410,8 @@ export class ViewDataGenerator { const cellDataValue: ViewCellDataSimple = this.getCellData(rowIndex, columnIndex, options, allDay); const index = rowIndex * columnCount + columnIndex; - const isFirstGroupCell = this._isFirstGroupCell(rowIndex, columnIndex, options, rowCount, columnCount); - const isLastGroupCell = this._isLastGroupCell(rowIndex, columnIndex, options, rowCount, columnCount); + const isFirstGroupCell = this.isFirstGroupCell(rowIndex, columnIndex, options, rowCount, columnCount); + const isLastGroupCell = this.isLastGroupCell(rowIndex, columnIndex, options, rowCount, columnCount); cellsRow.push({ ...cellDataValue, @@ -509,7 +509,7 @@ export class ViewDataGenerator { const columnCountBase = this.getCellCount(options); const rowCountBase = this.getRowCount(options); - const cellIndex = this._calculateCellIndex(rowIndex, columnIndex, rowCountBase, columnCountBase); + const cellIndex = this.calculateCellIndex(rowIndex, columnIndex, rowCountBase, columnCountBase); const millisecondsOffset = this.getMillisecondsOffset(cellIndex, interval, cellCountInDay); const offsetByCount = this.isWorkWeekView() @@ -573,7 +573,7 @@ export class ViewDataGenerator { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - protected _calculateCellIndex(rowIndex, columnIndex, rowCount, columnCountBase) { + protected calculateCellIndex(rowIndex, columnIndex, rowCount, columnCountBase) { return (calculateCellIndex as any)(rowIndex, columnIndex, rowCount); } @@ -633,7 +633,7 @@ export class ViewDataGenerator { }; } - protected _isFirstGroupCell(rowIndex, columnIndex, options: ViewDataProviderExtendedOptions, rowCount, columnCount): boolean { + protected isFirstGroupCell(rowIndex, columnIndex, options: ViewDataProviderExtendedOptions, rowCount, columnCount): boolean { const { groupOrientation, getResourceManager, @@ -653,7 +653,7 @@ export class ViewDataGenerator { return rowIndex % rowCount === 0; } - protected _isLastGroupCell(rowIndex, columnIndex, options: ViewDataProviderExtendedOptions, rowCount, columnCount): boolean { + protected isLastGroupCell(rowIndex, columnIndex, options: ViewDataProviderExtendedOptions, rowCount, columnCount): boolean { const { groupOrientation, getResourceManager, @@ -688,8 +688,8 @@ export class ViewDataGenerator { dateTableMap, } = viewDataMap; - const nextDateTableMap = dateTableMap.map((row) => this._markSelectedAndFocusedCellsInRow(row, selectedCells, focusedCell)); - const nextAllDayMap = this._markSelectedAndFocusedCellsInRow(allDayPanelMap, selectedCells, focusedCell); + const nextDateTableMap = dateTableMap.map((row) => this.markSelectedAndFocusedCellsInRow(row, selectedCells, focusedCell)); + const nextAllDayMap = this.markSelectedAndFocusedCellsInRow(allDayPanelMap, selectedCells, focusedCell); return { allDayPanelMap: nextAllDayMap, @@ -697,7 +697,7 @@ export class ViewDataGenerator { }; } - protected _markSelectedAndFocusedCellsInRow(dataRow, selectedCells, focusedCell) { + protected markSelectedAndFocusedCellsInRow(dataRow, selectedCells, focusedCell) { return dataRow.map((cell) => { const { index, @@ -746,7 +746,7 @@ export class ViewDataGenerator { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - protected _setVisibilityDates(options: any) {} + protected setVisibilityDates(options: any) {} public getCellCountInDay(startDayHour, endDayHour, hoursInterval) { const result = calculateDayDuration(startDayHour, endDayHour) / hoursInterval; diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_day.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_day.ts index 271236ee7e13..f29deb8ec768 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_day.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_day.ts @@ -2,7 +2,7 @@ import { dayUtils } from '../../r1/utils/index'; import { ViewDataGenerator } from './m_view_data_generator'; export class ViewDataGeneratorDay extends ViewDataGenerator { - _calculateStartViewDate(options) { + protected calculateStartViewDate(options) { return dayUtils.calculateStartViewDate( options.currentDate, options.startDayHour, diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_month.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_month.ts index 16b61e8fa4f1..519bdf076052 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_month.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_month.ts @@ -14,9 +14,9 @@ const toMs = dateUtils.dateToMilliseconds; const DAYS_IN_WEEK = 7; export class ViewDataGeneratorMonth extends ViewDataGenerator { - _minVisibleDate: any; + private minVisibleDate: any; - _maxVisibleDate: any; + private maxVisibleDate: any; tableAllDay: any = undefined; @@ -36,7 +36,7 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator { const startDate = timezoneUtils.addOffsetsWithoutDST(data.startDate, -viewOffset); data.today = this.isCurrentDate(startDate, indicatorTime, timeZoneCalculator); - data.otherMonth = this.isOtherMonth(startDate, this._minVisibleDate, this._maxVisibleDate); + data.otherMonth = this.isOtherMonth(startDate, this.minVisibleDate, this.maxVisibleDate); data.isFirstDayMonthHighlighting = isFirstCellInMonthWithIntervalCount(startDate, intervalCount); data.text = monthUtils.getCellText(startDate, intervalCount); @@ -51,7 +51,7 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator { return !dateUtils.dateInRange(cellDate, minDate, maxDate, 'date'); } - _calculateCellIndex(rowIndex, columnIndex, rowCount, columnCount) { + protected calculateCellIndex(rowIndex, columnIndex, rowCount, columnCount) { return monthUtils.calculateCellIndex(rowIndex, columnIndex, rowCount, columnCount); } @@ -63,7 +63,7 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator { return toMs('day'); } - _calculateStartViewDate(options) { + protected calculateStartViewDate(options) { return monthUtils.calculateStartViewDate( options.currentDate, options.startDayHour, @@ -73,7 +73,7 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator { ); } - _setVisibilityDates(options) { + protected setVisibilityDates(options) { const { intervalCount, startDate, @@ -83,10 +83,10 @@ export class ViewDataGeneratorMonth extends ViewDataGenerator { const firstMonthDate: any = dateUtils.getFirstMonthDate(startDate); const viewStart = monthUtils.getViewStartByOptions(startDate, currentDate, intervalCount, firstMonthDate); - this._minVisibleDate = new Date(viewStart.setDate(1)); + this.minVisibleDate = new Date(viewStart.setDate(1)); const nextMonthDate = new Date(viewStart.setMonth(viewStart.getMonth() + intervalCount)); - this._maxVisibleDate = new Date(nextMonthDate.setDate(0)); + this.maxVisibleDate = new Date(nextMonthDate.setDate(0)); } getCellCount() { diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_timeline_month.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_timeline_month.ts index 1390ac420b09..dd0f45ed6e7e 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_timeline_month.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_timeline_month.ts @@ -15,7 +15,7 @@ export class ViewDataGeneratorTimelineMonth extends ViewDataGenerator { return toMs('day'); } - _calculateStartViewDate(options: any) { + protected calculateStartViewDate(options: any) { return timelineMonthUtils.calculateStartViewDate( options.currentDate, options.startDayHour, diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_week.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_week.ts index c6635121685a..c62a758cc001 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_week.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_week.ts @@ -8,7 +8,7 @@ export class ViewDataGeneratorWeek extends ViewDataGenerator { return weekUtils.getIntervalDuration(intervalCount); } - _calculateStartViewDate(options) { + protected calculateStartViewDate(options) { return weekUtils.calculateStartViewDate( options.currentDate, options.startDayHour, diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_work_week.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_work_week.ts index 400b4e85b29b..ecf2465f32b7 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_work_week.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_work_week.ts @@ -8,7 +8,7 @@ export class ViewDataGeneratorWorkWeek extends ViewDataGeneratorWeek { return isDataOnWeekend(date); } - _calculateStartViewDate(options) { + protected calculateStartViewDate(options) { return workWeekUtils.calculateStartViewDate( options.currentDate, options.startDayHour, diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_provider.ts b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_provider.ts index be832dd4012d..07a1f59497dc 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_provider.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_provider.ts @@ -37,9 +37,9 @@ export default class ViewDataProvider { viewDataMap!: ViewDataMap; - _groupedDataMapProvider!: GroupedDataMapProvider; + private groupedDataMapProvider!: GroupedDataMapProvider; - _options!: ViewDataProviderExtendedOptions; + private options!: ViewDataProviderExtendedOptions; completeTimePanelMap: any; @@ -58,10 +58,10 @@ export default class ViewDataProvider { dateTableMap: [], allDayPanelMap: [], }; - this._groupedDataMapProvider = null as unknown as GroupedDataMapProvider; + this.groupedDataMapProvider = null as unknown as GroupedDataMapProvider; } - get groupedDataMap() { return this._groupedDataMapProvider.groupedDataMap; } + get groupedDataMap() { return this.groupedDataMapProvider.groupedDataMap; } get hiddenInterval() { return this.viewDataGenerator.hiddenInterval; } @@ -74,9 +74,9 @@ export default class ViewDataProvider { const dateHeaderDataGenerator = new DateHeaderDataGenerator(viewDataGenerator); const timePanelDataGenerator = new TimePanelDataGenerator(viewDataGenerator); - const renderOptions = this._transformRenderOptions(options); + const renderOptions = this.transformRenderOptions(options); - this._options = renderOptions; + this.options = renderOptions; if (isGenerateNewViewData) { this.completeViewDataMap = viewDataGenerator.getCompleteViewDataMap(renderOptions); @@ -91,7 +91,7 @@ export default class ViewDataProvider { this.viewDataMap = viewDataGenerator.generateViewDataMap(this.completeViewDataMap, renderOptions); this.updateViewData(renderOptions); - this._groupedDataMapProvider = new GroupedDataMapProvider( + this.groupedDataMapProvider = new GroupedDataMapProvider( this.viewDataGenerator, this.viewDataMap, this.completeViewDataMap, @@ -114,19 +114,19 @@ export default class ViewDataProvider { } createGroupedDataMapProvider(): void { - this._groupedDataMapProvider = new GroupedDataMapProvider( + this.groupedDataMapProvider = new GroupedDataMapProvider( this.viewDataGenerator, this.viewDataMap, this.completeViewDataMap, { - isVerticalGrouping: this._options.isVerticalGrouping, - viewType: this._options.viewType, + isVerticalGrouping: this.options.isVerticalGrouping, + viewType: this.options.viewType, }, ); } updateViewData(options) { - const renderOptions = this._transformRenderOptions(options); + const renderOptions = this.transformRenderOptions(options); this.viewDataMapWithSelection = this.viewDataGenerator .markSelectedAndFocusedCells(this.viewDataMap, renderOptions); this.viewData = this.viewDataGenerator @@ -137,7 +137,7 @@ export default class ViewDataProvider { ); } - _transformRenderOptions(renderOptions: ViewDataProviderOptions): ViewDataProviderExtendedOptions { + private transformRenderOptions(renderOptions: ViewDataProviderOptions): ViewDataProviderExtendedOptions { const { getResourceManager, groupOrientation, @@ -166,7 +166,7 @@ export default class ViewDataProvider { } getGroupPanelData(options) { - const renderOptions = this._transformRenderOptions(options); + const renderOptions = this.transformRenderOptions(options); const groupResources = renderOptions.getResourceManager().groupResources(); if (groupResources.length > 0) { @@ -183,47 +183,47 @@ export default class ViewDataProvider { } getGroupStartDate(groupIndex) { - return this._groupedDataMapProvider.getGroupStartDate(groupIndex); + return this.groupedDataMapProvider.getGroupStartDate(groupIndex); } getGroupEndDate(groupIndex) { - return this._groupedDataMapProvider.getGroupEndDate(groupIndex); + return this.groupedDataMapProvider.getGroupEndDate(groupIndex); } findGroupCellStartDate(groupIndex, startDate, endDate, isFindByDate = false) { - return this._groupedDataMapProvider.findGroupCellStartDate(groupIndex, startDate, endDate, isFindByDate); + return this.groupedDataMapProvider.findGroupCellStartDate(groupIndex, startDate, endDate, isFindByDate); } findAllDayGroupCellStartDate(groupIndex: number): Date | null { - return this._groupedDataMapProvider.findAllDayGroupCellStartDate(groupIndex); + return this.groupedDataMapProvider.findAllDayGroupCellStartDate(groupIndex); } findCellPositionInMap(cellInfo: any, isAppointmentRender = false): any { - return this._groupedDataMapProvider.findCellPositionInMap(cellInfo, isAppointmentRender); + return this.groupedDataMapProvider.findCellPositionInMap(cellInfo, isAppointmentRender); } getCellsGroup(groupIndex) { - return this._groupedDataMapProvider.getCellsGroup(groupIndex); + return this.groupedDataMapProvider.getCellsGroup(groupIndex); } getCompletedGroupsInfo() { - return this._groupedDataMapProvider.getCompletedGroupsInfo(); + return this.groupedDataMapProvider.getCompletedGroupsInfo(); } getGroupIndices() { - return this._groupedDataMapProvider.getGroupIndices(); + return this.groupedDataMapProvider.getGroupIndices(); } getLastGroupCellPosition(groupIndex) { - return this._groupedDataMapProvider.getLastGroupCellPosition(groupIndex); + return this.groupedDataMapProvider.getLastGroupCellPosition(groupIndex); } getRowCountInGroup(groupIndex) { - return this._groupedDataMapProvider.getRowCountInGroup(groupIndex); + return this.groupedDataMapProvider.getRowCountInGroup(groupIndex); } getCellData(rowIndex: number, columnIndex: number, isAllDay = false, rtlEnabled = false) { - const row = isAllDay && !this._options.isVerticalGrouping + const row = isAllDay && !this.options.isVerticalGrouping ? this.viewDataMap.allDayPanelMap : this.viewDataMap.dateTableMap[rowIndex]; @@ -238,12 +238,12 @@ export default class ViewDataProvider { getCellsByGroupIndexAndAllDay(groupIndex: number, isAllDay: boolean): ViewCellData[][] { const rowsPerGroup = this.getRowCountWithAllDayRows(); - const isShowAllDayPanel = this._options.isAllDayPanelVisible; + const isShowAllDayPanel = this.options.isAllDayPanelVisible; - const firstRowInGroup = this._options.isVerticalGrouping + const firstRowInGroup = this.options.isVerticalGrouping ? groupIndex * rowsPerGroup : 0; - const lastRowInGroup = this._options.isVerticalGrouping + const lastRowInGroup = this.options.isVerticalGrouping ? (groupIndex + 1) * rowsPerGroup - 1 : rowsPerGroup; const correctedFirstRow = isShowAllDayPanel && !isAllDay @@ -268,7 +268,7 @@ export default class ViewDataProvider { } hasGroupAllDayPanel(groupIndex) { - if (this._options.isVerticalGrouping) { + if (this.options.isVerticalGrouping) { return Boolean(this.groupedDataMap.dateTableGroupedMap[groupIndex]?.[0][0].cellData.allDay); } @@ -285,7 +285,7 @@ export default class ViewDataProvider { findGlobalCellPosition(date, groupIndex = 0, allDay = false, findClosest = false) { const { completeViewDataMap } = this; - const showAllDayPanel = this._options.isAllDayPanelVisible; + const showAllDayPanel = this.options.isAllDayPanelVisible; let resultDiff = Number.MAX_VALUE; let resultCellData: ViewCellData | undefined; @@ -294,7 +294,7 @@ export default class ViewDataProvider { const getCellPosition = (columnIndex: number, rowIndex: number) => ({ columnIndex, - rowIndex: showAllDayPanel && !this._options.isVerticalGrouping + rowIndex: showAllDayPanel && !this.options.isVerticalGrouping ? rowIndex - 1 : rowIndex, }); @@ -346,7 +346,7 @@ export default class ViewDataProvider { } getSkippedDaysCount(groupIndex, startDate, endDate, daysCount) { - const { dateTableGroupedMap } = this._groupedDataMapProvider.groupedDataMap; + const { dateTableGroupedMap } = this.groupedDataMapProvider.groupedDataMap; const groupedData = dateTableGroupedMap[groupIndex]; let includedDays = 0; @@ -449,7 +449,7 @@ export default class ViewDataProvider { } getStartViewDate() { - return this._options.startViewDate; + return this.options.startViewDate; } getIntervalDuration(intervalCount: number): number { @@ -460,7 +460,7 @@ export default class ViewDataProvider { const lastEndDate = new Date( this.getLastViewDate().getTime() - dateUtils.dateToMilliseconds('minute'), ); - return dateUtilsTs.addOffsets(lastEndDate, [-this._options.viewOffset]); + return dateUtilsTs.addOffsets(lastEndDate, [-this.options.viewOffset]); } getLastViewDateByEndDayHour(endDayHour: number): Date { @@ -474,10 +474,10 @@ export default class ViewDataProvider { ), ); - return this._adjustEndDateByDaylightDiff(lastCellEndDate, endDateOfLastViewCell); + return this.adjustEndDateByDaylightDiff(lastCellEndDate, endDateOfLastViewCell); } - _adjustEndDateByDaylightDiff(startDate, endDate) { + private adjustEndDateByDaylightDiff(startDate, endDate) { const daylightDiff = timeZoneUtils.getDaylightOffsetInMs(startDate, endDate); const endDateOfLastViewCell = new Date(endDate.getTime() - daylightDiff); @@ -505,10 +505,10 @@ export default class ViewDataProvider { return this.viewDataGenerator.getVisibleDayDuration(startDayHour, endDayHour, hoursInterval); } - getRowCountWithAllDayRows() { - const allDayRowCount = this._options.isAllDayPanelVisible ? 1 : 0; + private getRowCountWithAllDayRows() { + const allDayRowCount = this.options.isAllDayPanelVisible ? 1 : 0; - return this.getRowCount(this._options) + allDayRowCount; + return this.getRowCount(this.options) + allDayRowCount; } getFirstDayOfWeek(firstDayOfWeekOption) { @@ -516,11 +516,11 @@ export default class ViewDataProvider { } setViewOptions(options: ViewDataProviderOptions) { - this._options = this._transformRenderOptions(options); + this.options = this.transformRenderOptions(options); } getViewOptions(): ViewOptions { - return this._options; + return this.options; } getViewPortGroupCount() { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/agenda.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/agenda.tests.js index 56fe791e38fc..9395cfbffa51 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/agenda.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/agenda.tests.js @@ -71,11 +71,11 @@ module('Agenda', {}, () => { assert.deepEqual(firstViewDate, new Date(2016, 1, 17, 2), 'The first view date is OK'); }); - test('_removeEmptyRows method', async function(assert) { + test('removeEmptyRows method', async function(assert) { const rows = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 1], [0, 0, 0, 0, 0], [1, 1, 1, 0, 1]]; const instance = createInstance(); - const resultRows = instance._removeEmptyRows(rows); + const resultRows = instance.removeEmptyRows(rows); assert.deepEqual(resultRows, [[0, 0, 0, 0, 1], [1, 1, 1, 0, 1]], 'The empty rows was removed'); }); @@ -150,7 +150,7 @@ module('Agenda', {}, () => { test('Agenda should be recalculated after rowHeight changed', async function(assert) { const instance = createInstance(); - const recalculateStub = sinon.stub(instance, '_recalculateAgenda'); + const recalculateStub = sinon.stub(instance, 'recalculateAgenda'); instance.option('rowHeight', 100); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.monthView.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.monthView.tests.js index 2953d6d64e1e..9538da4cc22a 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.monthView.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.monthView.tests.js @@ -492,7 +492,7 @@ module('Integration: Appointments in Month view', { height: 600 }); - const appointments = scheduler.instance._getAppointmentsToRepaint(); + const appointments = scheduler.instance.getAppointmentsToRepaint(); const parts = appointments.map((item) => ({ level: item.level, maxLevel: item.maxLevel, diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointmentPopup.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointmentPopup.tests.js index fd17cf00ae33..1c5efef4c1fa 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointmentPopup.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointmentPopup.tests.js @@ -440,7 +440,7 @@ QUnit.module('Appointment popup form', moduleConfig, () => { const deferred = scheduler.appointmentPopup.saveAppointmentData(); - assert.notOk(scheduler.appointmentPopup.getInstance()._tryLockSaveChanges(), 'Save changes already locked'); + assert.notOk(scheduler.appointmentPopup.getInstance().tryLockSaveChanges(), 'Save changes already locked'); assert.ok(scheduler.appointmentPopup.hasLoadPanel(), 'has load panel'); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/cells_selection_state.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/cells_selection_state.tests.js index 8082765522f0..1ecdc72648e2 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/cells_selection_state.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/cells_selection_state.tests.js @@ -190,7 +190,7 @@ module('Cells Selection State', () => { cellsSelectionState.setFocusedCell(1, 1, false); - const focusedCellData = cellsSelectionState._focusedCell; + const focusedCellData = cellsSelectionState.focusedCell; assert.deepEqual( focusedCellData, @@ -301,18 +301,18 @@ module('Cells Selection State', () => { cellsSelectionState.releaseSelectedAndFocusedCells(); assert.deepEqual( - cellsSelectionState._prevFocusedCell, + cellsSelectionState.prevFocusedCell, testViewDataMap.horizontalGrouping[1][1].cellData, 'Correct cached focused cell data', ); assert.deepEqual( - cellsSelectionState._prevSelectedCells, + cellsSelectionState.prevSelectedCells, [testViewDataMap.horizontalGrouping[1][0].cellData, testViewDataMap.horizontalGrouping[1][1].cellData], 'Correct cachedfocused cell', ); - const prevFocusedCellData = cellsSelectionState._focusedCell; - const prevSelectedCells = cellsSelectionState._selectedCells; + const prevFocusedCellData = cellsSelectionState.focusedCell; + const prevSelectedCells = cellsSelectionState.selectedCells; assert.deepEqual( prevFocusedCellData, @@ -353,18 +353,18 @@ module('Cells Selection State', () => { cellsSelectionState.clearSelectedAndFocusedCells(); assert.deepEqual( - cellsSelectionState._prevFocusedCell, + cellsSelectionState.prevFocusedCell, null, 'Correct cached focused cell data', ); assert.deepEqual( - cellsSelectionState._prevSelectedCells, + cellsSelectionState.prevSelectedCells, null, 'Correct cachedfocused cell', ); - const prevFocusedCellData = cellsSelectionState._focusedCell; - const prevSelectedCells = cellsSelectionState._selectedCells; + const prevFocusedCellData = cellsSelectionState.focusedCell; + const prevSelectedCells = cellsSelectionState.selectedCells; assert.deepEqual( prevFocusedCellData, diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.agenda.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.agenda.tests.js index 427af85cff78..874ff7cf533c 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.agenda.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.agenda.tests.js @@ -920,7 +920,7 @@ module('Integration: Agenda', moduleConfig, () => { const rowHeight = 77; const $element = instance.$element(); const expectedWidth = getOuterWidth($element.find('.dx-scheduler-date-table')); - const agendaStub = sinon.stub(agenda, '_getRowHeight').returns(rowHeight); + const agendaStub = sinon.stub(agenda, 'getRowHeight').returns(rowHeight); try { instance.option('dataSource', [ @@ -1734,7 +1734,7 @@ module('Integration: Agenda', moduleConfig, () => { instance.option('dataSource', data); await waitAsync(0); - const calculatedRows = agendaWorkspace._rows[0]; + const calculatedRows = agendaWorkspace.rows[0]; assert.equal(calculatedRows.length, 65, 'Rows are OK'); $.each(calculatedRows, function(index, item) { @@ -1775,7 +1775,7 @@ module('Integration: Agenda', moduleConfig, () => { instance.option('dataSource', data); await waitAsync(0); - const calculatedRows = agendaWorkspace._rows; + const calculatedRows = agendaWorkspace.rows; assert.deepEqual(calculatedRows, [[1, 2, 2, 2, 2]], 'Rows are OK'); } finally { endViewDateStub.restore(); @@ -1809,7 +1809,7 @@ module('Integration: Agenda', moduleConfig, () => { instance.option('dataSource', data); await waitAsync(0); - const calculatedRows = agendaWorkspace._rows; + const calculatedRows = agendaWorkspace.rows; assert.deepEqual(calculatedRows, [[0, 1, 1, 1, 0]], 'Rows are OK'); } finally { endViewDateStub.restore(); @@ -1840,7 +1840,7 @@ module('Integration: Agenda', moduleConfig, () => { instance.option('dataSource', data); await waitAsync(0); - const calculatedRows = agendaWorkspace._rows; + const calculatedRows = agendaWorkspace.rows; assert.deepEqual(calculatedRows, [[1, 1, 1, 1, 0]], 'Rows are OK'); } finally { endViewDateStub.restore(); @@ -1878,7 +1878,7 @@ module('Integration: Agenda', moduleConfig, () => { instance.option('dataSource', data); await waitAsync(0); - const calculatedRows = agendaWorkspace._rows; + const calculatedRows = agendaWorkspace.rows; assert.deepEqual(calculatedRows, [[0, 1, 1, 0, 1, 1, 0]], 'Rows are OK'); } finally { endViewDateStub.restore(); @@ -1921,7 +1921,7 @@ module('Integration: Agenda', moduleConfig, () => { instance.option('dataSource', data); await waitAsync(0); - const calculatedRows = agendaWorkspace._rows; + const calculatedRows = agendaWorkspace.rows; assert.equal(calculatedRows.length, 3, 'Rows are OK'); assert.deepEqual(calculatedRows[0], [0, 1, 2, 0, 1, 0, 0], 'Row is OK'); assert.deepEqual(calculatedRows[1], [0, 0, 1, 1, 1, 0, 0], 'Row is OK'); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/keyboardNavigation.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/keyboardNavigation.tests.js index 9dcf6abff81f..67b6b86de713 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/keyboardNavigation.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/keyboardNavigation.tests.js @@ -88,13 +88,13 @@ QUnit.module('Keyboard Navigation', { }); scheduler.appointments.compact.click(); - assert.notOk(scheduler.instance.appointmentTooltip._list.option('focusStateEnabled'), 'focusStateEnabled was passed correctly'); + assert.notOk(scheduler.instance.appointmentTooltip.list.option('focusStateEnabled'), 'focusStateEnabled was passed correctly'); scheduler.instance.appointmentTooltip.hide(); scheduler.instance.option('focusStateEnabled', true); scheduler.appointments.compact.click(); - assert.ok(scheduler.instance.appointmentTooltip._list.option('focusStateEnabled'), 'focusStateEnabled was passed correctly'); + assert.ok(scheduler.instance.appointmentTooltip.list.option('focusStateEnabled'), 'focusStateEnabled was passed correctly'); }); QUnit.test('Workspace navigation by arrows should work correctly with opened dropDown appointments', async function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/layoutManager.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/layoutManager.tests.js index 36efb46732bd..1fd8e278b68d 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/layoutManager.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/layoutManager.tests.js @@ -1685,7 +1685,7 @@ QUnit.test('Full-size appointment should not have empty class in "auto" mode', a } ); - const getHeightStub = sinon.stub(this.instance.getLayoutManager().getRenderingStrategyInstance(), '_getAppointmentDefaultHeight').callsFake(function() { + const getHeightStub = sinon.stub(this.instance.getLayoutManager().getRenderingStrategyInstance(), 'getAppointmentDefaultHeight').callsFake(function() { return 18; }); @@ -2356,7 +2356,7 @@ QUnit.test('Full-size appointment count depends on maxAppointmentsPerCell option assert.equal($dropDownMenu.length, 0, 'ddAppointment isn\'t rendered'); }); -QUnit.test('_isAppointmentEmpty should work correctly in different strategies', async function(assert) { +QUnit.test('isAppointmentEmpty should work correctly in different strategies', async function(assert) { await this.createInstance({ views: ['timelineDay', 'week'], currentView: 'timelineDay' @@ -2364,18 +2364,18 @@ QUnit.test('_isAppointmentEmpty should work correctly in different strategies', const renderingStrategy = this.instance.getLayoutManager().getRenderingStrategyInstance(); - assert.ok(renderingStrategy._isAppointmentEmpty(34, 41), 'Appointment is empty'); - assert.notOk(renderingStrategy._isAppointmentEmpty(36, 41), 'Appointment isn\'t empty'); + assert.ok(renderingStrategy.isAppointmentEmpty(34, 41), 'Appointment is empty'); + assert.notOk(renderingStrategy.isAppointmentEmpty(36, 41), 'Appointment isn\'t empty'); this.instance.option('currentView', 'week'); await waitAsync(0); - assert.ok(renderingStrategy._isAppointmentEmpty(34, 39), 'Appointment is empty'); - assert.notOk(renderingStrategy._isAppointmentEmpty(36, 41), 'Appointment isn\'t empty'); + assert.ok(renderingStrategy.isAppointmentEmpty(34, 39), 'Appointment is empty'); + assert.notOk(renderingStrategy.isAppointmentEmpty(36, 41), 'Appointment isn\'t empty'); this.instance.option('currentView', 'month'); await waitAsync(0); - assert.ok(renderingStrategy._isAppointmentEmpty(19, 50), 'Appointment is empty'); - assert.notOk(renderingStrategy._isAppointmentEmpty(36, 41), 'Appointment isn\'t empty'); + assert.ok(renderingStrategy.isAppointmentEmpty(19, 50), 'Appointment is empty'); + assert.notOk(renderingStrategy.isAppointmentEmpty(36, 41), 'Appointment isn\'t empty'); }); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js index 0ec24feda67b..4c9815d77f95 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/subscribes.tests.js @@ -173,9 +173,9 @@ module('Subscribes', { await waitAsync(0); const layoutManager = this.instance.getLayoutManager(); - const { _positionMap } = layoutManager; + const { positionMap } = layoutManager; - assert.equal(_positionMap[0].length, 7, 'count is OK'); + assert.equal(positionMap[0].length, 7, 'count is OK'); }); test('"createAppointmentSettings" should return correct count of coordinates for allDay recurrence appointment, allDay = true', async function(assert) { @@ -196,9 +196,9 @@ module('Subscribes', { await waitAsync(0); const layoutManager = this.instance.getLayoutManager(); - const { _positionMap } = layoutManager; + const { positionMap } = layoutManager; - assert.equal(_positionMap[0].length, 7, 'count is OK'); + assert.equal(positionMap[0].length, 7, 'count is OK'); }); test('"createAppointmentSettings" should not change dateRange', async function(assert) { @@ -244,12 +244,12 @@ module('Subscribes', { }); const layoutManager = this.instance.getLayoutManager(); - const { _positionMap } = layoutManager; + const { positionMap } = layoutManager; const $expectedCell = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(1); const expectedLeftCoordinate = $expectedCell.position().left; - assert.equal(_positionMap[0][0].left, expectedLeftCoordinate, 'left coordinate is OK'); + assert.equal(positionMap[0][0].left, expectedLeftCoordinate, 'left coordinate is OK'); }); test('"mapAppointmentFields" should call getTargetedAppointment', async function(assert) { @@ -948,9 +948,9 @@ module('Subscribes', { }); const layoutManager = this.instance.getLayoutManager(); - const { _positionMap } = layoutManager; + const { positionMap } = layoutManager; - assert.notOk(_positionMap[0][0].groupIndex, 'no groupIndex'); + assert.notOk(positionMap[0][0].groupIndex, 'no groupIndex'); }); }); }); @@ -1053,7 +1053,7 @@ module('Grouping By Date', { }); const layoutManager = this.instance.getLayoutManager(); - const results = layoutManager._positionMap[0]; + const results = layoutManager.positionMap[0]; assert.equal(results.length, 3, 'Result length is OK'); this.checkNeedCoordinatesResult(assert, results[0], 3, 0, 0, 96, 1.1); @@ -1104,7 +1104,7 @@ module('Grouping By Date', { const cellHeight = $cell.getBoundingClientRect().height; const layoutManager = this.instance.getLayoutManager(); - const results = layoutManager._positionMap[0]; + const results = layoutManager.positionMap[0]; assert.equal(results.length, 2, 'Coordinates count is ok'); this.checkNeedCoordinatesResult(assert, results[0], 5, 3, cellHeight * 3, cellWidth * 5, 1.5); @@ -1155,7 +1155,7 @@ module('Grouping By Date', { const cellHeight = $cell.getBoundingClientRect().height; const layoutManager = this.instance.getLayoutManager(); - const results = layoutManager._positionMap[0]; + const results = layoutManager.positionMap[0]; assert.equal(results.length, 6, 'Coordinates count is ok'); this.checkNeedCoordinatesResult(assert, results[0], 5, 3, cellHeight * 3, cellWidth * 5, 1.5); @@ -1211,7 +1211,7 @@ module('Grouping By Date', { const cellWidth = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0).get(0).getBoundingClientRect().width; const layoutManager = this.instance.getLayoutManager(); - const results = layoutManager._positionMap[0]; + const results = layoutManager.positionMap[0]; this.checkNeedCoordinatesResult(assert, results[0], 5, 0, 0, cellWidth * 5, 1.5); this.checkNeedCoordinatesResult(assert, results[1], 7, 0, 0, cellWidth * 7, 1.5); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/utils.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/utils.tests.js index e2f37a156c40..547f365b241c 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/utils.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/utils.tests.js @@ -15,13 +15,13 @@ module('Time zone data utils', {}, () => { let lastCallIndex = spyGetUtcOffset.args.length - 1; const offsetByIdCallArgument = spyGetUtcOffset.args[lastCallIndex][0]; - const cachedValue = timeZoneDataUtils._tzCache.tryGet(timeZoneId); + const cachedValue = timeZoneDataUtils.tzCache.tryGet(timeZoneId); timeZoneDataUtils.getTimeZoneDeclarationTuple(timeZoneId, dateTimeStamp); lastCallIndex = spyGetTimeZoneDeclarationTupleCore.args.length - 1; const declarationTupleCallArgument = spyGetTimeZoneDeclarationTupleCore.args[lastCallIndex][0]; - assert.equal(timeZoneDataUtils._tzCache.map.size, expectedCacheSize, 'Cache size should be correct'); + assert.equal(timeZoneDataUtils.tzCache.map.size, expectedCacheSize, 'Cache size should be correct'); assert.equal(cachedValue, offsetByIdCallArgument, 'Function call argument of `getUtcOffset` should be cached'); assert.equal(cachedValue, declarationTupleCallArgument, 'Function call argument of `getTimeZoneDeclarationTupleCore` should be cached'); }; @@ -35,7 +35,7 @@ module('Time zone data utils', {}, () => { ] }); - assert.equal(timeZoneDataUtils._tzCache.map.size, 0, 'Timezone cache should be empty'); + assert.equal(timeZoneDataUtils.tzCache.map.size, 0, 'Timezone cache should be empty'); checkCache('America/Los_Angeles', new Date(2021, 3, 3), 1); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.integration.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.integration.tests.js index 841a5b1416bb..5d7dafc23408 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.integration.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.integration.tests.js @@ -658,7 +658,7 @@ module('Virtual scrolling integration', () => { const { instance } = this.scheduler; const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.equal(settings.groupIndex, 0, 'groupIndex is correct'); }); @@ -1195,7 +1195,7 @@ module('Virtual scrolling integration', () => { () => { const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.equal( settings.groupIndex, @@ -1256,7 +1256,7 @@ module('Virtual scrolling integration', () => { const { instance } = this.scheduler; const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.equal(settings.groupIndex, 0, 'groupIndex is correct'); }); @@ -1292,7 +1292,7 @@ module('Virtual scrolling integration', () => { const { instance } = this.scheduler; const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.equal(settings.groupIndex, 1, 'groupIndex is correct'); }); @@ -1325,7 +1325,7 @@ module('Virtual scrolling integration', () => { const { instance } = this.scheduler; const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.equal(settings.groupIndex, 0, 'groupIndex is correct'); }); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.monthView.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.monthView.tests.js index 49a39a7dda27..f115d5c49513 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.monthView.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/virtual_scrolling.monthView.tests.js @@ -547,7 +547,7 @@ module('Virtual scrolling Month View', () => { promise, () => { const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.equal( settings.groupIndex, @@ -645,7 +645,7 @@ module('Virtual scrolling Month View', () => { promise, () => { const layoutManager = instance.getLayoutManager(); - const settings = layoutManager._positionMap[0][0]; + const settings = layoutManager.positionMap[0][0]; assert.ok(true, `scrollX: ${scrollX}`); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/workSpace.renovation.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/workSpace.renovation.tests.js index 0dacd9ee746c..92fe4294faa8 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/workSpace.renovation.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/workSpace.renovation.tests.js @@ -997,7 +997,7 @@ module('Renovated Render', { showAllDayPanel: true, }, 'dxSchedulerWorkSpaceWeek'); - assert.ok(this.instance._$allDayTable, 'All-day panel has been initialized'); + assert.ok(this.instance.$allDayTable, 'All-day panel has been initialized'); }); // Remove after complete workspace renovation