diff --git a/packages/devextreme/eslint-scheduler-allowlist.mjs b/packages/devextreme/eslint-scheduler-allowlist.mjs new file mode 100644 index 000000000000..1b60679b18b3 --- /dev/null +++ b/packages/devextreme/eslint-scheduler-allowlist.mjs @@ -0,0 +1,130 @@ +const schedulerDOMComponentOverrides = [ + '_createActionByOption', + '_defaultOptionsRules', + '_dimensionChanged', + '_dispose', + '_disposed', + '_getDefaultOptions', + '_init', + '_initTemplates', + '_optionChanged', + '_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 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', +]; + +const schedulerMemberAllowlist = [ + ...schedulerDOMComponentOverrides, + ...schedulerWidgetOverrides, + ...schedulerCollectionWidgetOverrides, + ...schedulerR1Overrides, + ...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 b971ed40dfaa..7922693e11fd 100644 --- a/packages/devextreme/eslint.config.mjs +++ b/packages/devextreme/eslint.config.mjs @@ -17,6 +17,7 @@ import customRules from './eslint_plugins/index.js'; import spellCheckConfig from 'eslint-config-devextreme/spell-check'; import typescriptConfig from 'eslint-config-devextreme/typescript'; import qunitConfig from 'eslint-config-devextreme/qunit'; +import { schedulerMemberAllowlistRegex } from './eslint-scheduler-allowlist.mjs'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -556,7 +557,6 @@ export default [ selector: ['variable', 'function', 'parameter'], format: null, leadingUnderscore: 'forbid', - // allow only a single underscore identifier `_` to bypass this rule filter: { regex: '^_$', match: false, @@ -565,13 +565,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/appointment_popup/m_form.ts b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts index 3b182d90714a..575fcb109ee0 100644 --- a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts +++ b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts @@ -144,18 +144,18 @@ export class AppointmentForm { private readonly resourceManager!: ResourceManager; - private _dxForm?: dxForm; + private dxFormInstance?: dxForm; - private _recurrenceForm!: RecurrenceForm; + private recurrenceForm!: RecurrenceForm; private _popup!: any; - private _$mainGroup?: dxElementWrapper; + private $mainGroup?: dxElementWrapper; - private _$recurrenceGroup?: dxElementWrapper; + private $recurrenceGroup?: dxElementWrapper; get dxForm(): dxForm { - return this._dxForm as dxForm; + return this.dxFormInstance as dxForm; } private get dxPopup(): Popup { @@ -168,7 +168,7 @@ export class AppointmentForm { set readOnly(value: boolean) { this.dxForm.option('readOnly', value); - this._recurrenceForm.setReadOnly(value); + this.recurrenceForm.setReadOnly(value); } get formData(): Record { @@ -210,10 +210,10 @@ export class AppointmentForm { } dispose(): void { - this._dxForm?.dispose(); - this._dxForm = undefined; - if (this._recurrenceForm) { - this._recurrenceForm.dxForm = undefined; + this.dxFormInstance?.dispose(); + this.dxFormInstance = undefined; + if (this.recurrenceForm) { + this.recurrenceForm.dxForm = undefined; } } @@ -222,8 +222,8 @@ export class AppointmentForm { const mainGroup = this.createMainFormGroup(); - this._recurrenceForm = new RecurrenceForm(this.scheduler); - const recurrenceGroup = this._recurrenceForm.createRecurrenceFormGroup(); + this.recurrenceForm = new RecurrenceForm(this.scheduler); + const recurrenceGroup = this.recurrenceForm.createRecurrenceFormGroup(); const items = [mainGroup, recurrenceGroup]; @@ -290,7 +290,7 @@ export class AppointmentForm { } if (isRecurrenceRuleChanged || startDateExpr === dataField) { - this._recurrenceForm.updateRecurrenceFormValues( + this.recurrenceForm.updateRecurrenceFormValues( this.recurrenceRuleRaw, this.startDate, ); @@ -305,15 +305,15 @@ export class AppointmentForm { } }, onInitialized: (e): void => { - this._dxForm = e.component; - this._recurrenceForm.dxForm = this.dxForm; + this.dxFormInstance = e.component; + this.recurrenceForm.dxForm = this.dxForm; onInitialized?.call(this, e); }, onContentReady: (e): void => { const $formElement = e.component.$element(); - this._$mainGroup = $formElement.find(`.${CLASSES.mainGroup}`); - this._$recurrenceGroup = $formElement.find(`.${CLASSES.recurrenceGroup}`); + this.$mainGroup = $formElement.find(`.${CLASSES.mainGroup}`); + this.$recurrenceGroup = $formElement.find(`.${CLASSES.recurrenceGroup}`); this.alignIconsWithEditors(); @@ -680,7 +680,7 @@ export class AppointmentForm { if (e.value === repeatNeverValue) { this.dxForm.updateData(recurrenceRuleExpr, ''); } else { - const currentRecurrenceRule = this._recurrenceForm.recurrenceRule.toString() ?? ''; + const currentRecurrenceRule = this.recurrenceForm.recurrenceRule.toString() ?? ''; const recurrenceRule = new RecurrenceRule(currentRecurrenceRule, this.startDate); recurrenceRule.frequency = e.value; this.dxForm.updateData(recurrenceRuleExpr, recurrenceRule.toString()); @@ -883,16 +883,16 @@ export class AppointmentForm { this.dxPopup.option('height', configuredHeight); } - if (this._$mainGroup) { - this._$mainGroup.removeClass(CLASSES.mainHidden); - this._$mainGroup.removeAttr('inert'); + if (this.$mainGroup) { + this.$mainGroup.removeClass(CLASSES.mainHidden); + this.$mainGroup.removeAttr('inert'); - this.focusFirstFocusableInGroup(this._$mainGroup); + this.focusFirstFocusableInGroup(this.$mainGroup); } - if (this._$recurrenceGroup) { - this._$recurrenceGroup.addClass(CLASSES.recurrenceHidden); - this._$recurrenceGroup.attr('inert', true); + if (this.$recurrenceGroup) { + this.$recurrenceGroup.addClass(CLASSES.recurrenceHidden); + this.$recurrenceGroup.attr('inert', true); } this._popup.updateToolbarForMainGroup(); @@ -913,23 +913,23 @@ export class AppointmentForm { this.dxPopup.option('height', overlayHeight); } - if (this._$mainGroup) { - this._$mainGroup.addClass(CLASSES.mainHidden); - this._$mainGroup.attr('inert', true); + if (this.$mainGroup) { + this.$mainGroup.addClass(CLASSES.mainHidden); + this.$mainGroup.attr('inert', true); } - if (this._$recurrenceGroup) { - this._$recurrenceGroup.removeClass(CLASSES.recurrenceHidden); - this._$recurrenceGroup.removeAttr('inert'); + if (this.$recurrenceGroup) { + this.$recurrenceGroup.removeClass(CLASSES.recurrenceHidden); + this.$recurrenceGroup.removeAttr('inert'); - this.focusFirstFocusableInGroup(this._$recurrenceGroup); + this.focusFirstFocusableInGroup(this.$recurrenceGroup); } this._popup.updateToolbarForRecurrenceGroup(); } saveRecurrenceValue(): void { - const { recurrenceRule } = this._recurrenceForm; + const { recurrenceRule } = this.recurrenceForm; const { recurrenceRuleExpr } = this.scheduler.getDataAccessors().expr; const recurrenceRuleSerialized = recurrenceRule.toString() ?? ''; @@ -1046,12 +1046,12 @@ export class AppointmentForm { } private updateAnimationOffset(): void { - if (!this._$mainGroup) { + if (!this.$mainGroup) { return; } const formElement = this.dxForm.$element()[0]; - const mainGroupElement = this._$mainGroup[0]; + const mainGroupElement = this.$mainGroup[0]; const formRect = formElement.getBoundingClientRect(); const groupRect = mainGroupElement.getBoundingClientRect(); const topOffset = groupRect.top - formRect.top; diff --git a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_legacy_popup.ts b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_legacy_popup.ts index b9864131c2c7..3f0716b1154b 100644 --- a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_legacy_popup.ts +++ b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_legacy_popup.ts @@ -36,6 +36,7 @@ const POPUP_CONFIG = { }, }, ], + // TODO: legacy property _ignorePreventScrollEventsDeprecation: true, }; 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 4aa093eae31c..81cb5301304f 100644 --- a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts +++ b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts @@ -35,6 +35,7 @@ export class AppointmentPopup { form: AppointmentForm; + // TODO: backing field for popup getter, cannot rename due to name conflict private _popup?: dxPopup; private customPopupOptions?: PopupProperties; diff --git a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_recurrence_form.ts b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_recurrence_form.ts index 5034d018757f..30dbf7752357 100644 --- a/packages/devextreme/js/__internal/scheduler/appointment_popup/m_recurrence_form.ts +++ b/packages/devextreme/js/__internal/scheduler/appointment_popup/m_recurrence_form.ts @@ -112,13 +112,13 @@ export class RecurrenceForm { private readonly scheduler: any; - private _dxForm?: dxForm; + private dxFormInstance?: dxForm; private readonly weekDayItems: { text: string; key: string }[] = []; - private _weekDayButtons: Record = {}; + private weekDayButtons: Record = {}; - private _readOnly = false; + private readOnly = false; constructor(scheduler: Scheduler) { this.scheduler = scheduler; @@ -171,15 +171,15 @@ export class RecurrenceForm { } get dxForm(): dxForm { - return this._dxForm as dxForm; + return this.dxFormInstance as dxForm; } set dxForm(value: dxForm | undefined) { - this._dxForm = value; + this.dxFormInstance = value; } setReadOnly(value: boolean): void { - this._readOnly = value; + this.readOnly = value; } createRecurrenceFormGroup(): GroupItem { @@ -354,10 +354,10 @@ export class RecurrenceForm { this.weekDayItems.forEach((item) => { const buttonContainer = $('
').appendTo($container); - this._weekDayButtons[item.key]?.dispose(); - this._weekDayButtons[item.key] = this.scheduler.createComponent(buttonContainer, Button, { + this.weekDayButtons[item.key]?.dispose(); + this.weekDayButtons[item.key] = this.scheduler.createComponent(buttonContainer, Button, { text: item.text, - disabled: this._readOnly, + disabled: this.readOnly, onContentReady: (e): void => { $(e.element).removeClass('dx-button-has-text'); diff --git a/packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts b/packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts index 278cdc41434c..19a5d2c4fb1b 100644 --- a/packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts +++ b/packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts @@ -431,6 +431,7 @@ class SchedulerAppointments extends CollectionWidget { this._preventSingleAppointmentClick = false; } + // TODO: used externally in m_scheduler.ts _renderAppointmentTemplate($container, appointment, model) { const config = { isAllDay: appointment.allDay, @@ -759,7 +760,7 @@ class SchedulerAppointments extends CollectionWidget { const shiftedStartDate = dateUtilsTs.addOffsets(startDate, -viewOffset); const shiftedEndDate = dateUtilsTs.addOffsets(endDate, -viewOffset); - dateRange = this._getDateRange(e, shiftedStartDate, shiftedEndDate); + dateRange = this.getDateRange(e, shiftedStartDate, shiftedEndDate); dateRange.startDate = dateUtilsTs.addOffsets(dateRange.startDate, viewOffset); dateRange.endDate = dateUtilsTs.addOffsets(dateRange.endDate, viewOffset); } @@ -858,7 +859,7 @@ class SchedulerAppointments extends CollectionWidget { return startDate; } - _getDateRange(e, startDate, endDate) { + private getDateRange(e, startDate, endDate) { const itemData = (this as any)._getItemData(e.element); const deltaTime = this.invoke('getDeltaTime', e, this._initialSize, itemData); const renderingStrategyDirection = this.invoke('getRenderingStrategyDirection'); diff --git a/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts b/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts index 5fe80c796193..2eb2b5526805 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_calendar.ts @@ -22,7 +22,7 @@ export default class SchedulerCalendar extends Widget { private calendar?: Calendar; public async show(target: HTMLElement): Promise { - if (!SchedulerCalendar._isMobileLayout()) { + if (!SchedulerCalendar.isMobileLayout()) { this.overlay?.option('target', target); } @@ -44,16 +44,16 @@ 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(); }, @@ -79,19 +79,19 @@ export default class SchedulerCalendar extends Widget { } } - 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', @@ -115,7 +115,7 @@ export default class SchedulerCalendar extends Widget { } } - 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 d9d73de126f2..5642a3fcb92c 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)); }); }, @@ -169,7 +169,7 @@ export const getTodayButtonOptions = ( type: 'normal', onClick() { const { indicatorTime } = header.option(); - header._updateCurrentDate(indicatorTime ?? new Date()); + 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 871172f065e7..b9b5b19e14fe 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_header.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_header.ts @@ -53,7 +53,7 @@ export class SchedulerHeader extends Widget { private calendar?: SchedulerCalendar; get captionText(): string { - return this._getCaption().text; + return this.getCaption().text; } public getIntervalOptions(date: Date): IntervalOptions { @@ -71,17 +71,18 @@ export class SchedulerHeader extends Widget { public _getDefaultOptions(): HeaderOptions { return extend(super._getDefaultOptions(), { + // TODO: passed via scheduler options as _useShortDateFormat _useShortDateFormat: !devices.real().generic || devices.isSimulator(), }) 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 +90,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]); } @@ -117,11 +118,11 @@ export class SchedulerHeader extends Widget { case fullName === 'toolbar.items': 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); @@ -130,7 +131,7 @@ export class SchedulerHeader extends Widget { public _init(): void { super._init(); - this._createEventMap(); + this.createEventMap(); this.$element().addClass(CLASSES.component); } @@ -138,13 +139,13 @@ 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()); @@ -163,9 +164,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 +174,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 +187,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,29 +198,29 @@ 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)); } - 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); + 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(); @@ -231,7 +232,7 @@ export class SchedulerHeader extends Widget { focusStateEnabled, tabIndex, onValueChanged: async (e) => { - this._updateCurrentDate(e.value); + this.updateCurrentDate(e.value); await this.calendar?.hide(); }, }); @@ -239,7 +240,7 @@ export class SchedulerHeader extends Widget { 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); @@ -247,7 +248,7 @@ export class SchedulerHeader extends Widget { }; } - 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 +256,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,21 +276,21 @@ 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 { + 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 8b98db201586..c92e916ca991 100644 --- a/packages/devextreme/js/__internal/scheduler/header/m_view_switcher.ts +++ b/packages/devextreme/js/__internal/scheduler/header/m_view_switcher.ts @@ -54,12 +54,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)]); }); }, @@ -93,17 +93,18 @@ 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) => { viewSwitcher.option('selectedItemKey', getViewName(view as NormalizedView)); }); }, dropDownOptions: { width: 'max-content', + // TODO: legacy naming, used internally _wrapperClassExternal: ClASS.dropDownButtonContent, }, }, diff --git a/packages/devextreme/js/__internal/scheduler/m_scheduler.ts b/packages/devextreme/js/__internal/scheduler/m_scheduler.ts index 7b446445240b..f546dd938bfd 100644 --- a/packages/devextreme/js/__internal/scheduler/m_scheduler.ts +++ b/packages/devextreme/js/__internal/scheduler/m_scheduler.ts @@ -167,22 +167,25 @@ 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 - private _timeZoneCalculator!: any; + private timeZoneCalculatorInstance!: any; postponedOperations: any; private a11yStatus!: dxElementWrapper; + // TODO: used externally in m_appointment_drag_behavior.ts, m_subscribes.ts, workspaces/m_work_space.ts _workSpace: any; private header?: SchedulerHeader; + // TODO: used externally in m_appointment_drag_behavior.ts, m_subscribes.ts, workspaces/m_work_space.ts _appointments: any; appointmentDataSource!: AppointmentDataSource; _dataSource: any; + // TODO: used externally in m_subscribes.ts, view_model/preparation/prepare_appointments.ts, view_model/filtration/utils/get_filter_options/get_filter_options.ts _dataAccessors!: AppointmentDataAccessor; resourceManager!: ResourceManager; @@ -201,6 +204,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { private appointmentPopup: any; + // TODO: used externally in m_subscribes.ts _compactAppointmentsHelper!: CompactAppointmentsHelper; private asyncTemplatesTimers!: any[]; @@ -215,6 +219,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { private recurrenceDialog: any; + // TODO: used externally in m_subscribes.ts _layoutManager!: AppointmentLayoutManager; private appointmentForm: any; @@ -232,11 +237,11 @@ class Scheduler extends SchedulerOptionsBaseWidget { private appointmentRenderedAction!: SchedulerProperties['onAppointmentRendered']; 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) { @@ -809,7 +814,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { } updateAppointmentDataSource() { - this._timeZoneCalculator = null; + this.timeZoneCalculatorInstance = null; if (this.getWorkSpace()) { this.createAppointmentDataSource(); @@ -2104,7 +2109,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { let allDayValue; let align: 'start' | 'center' = 'center'; - if (this._isScrollOptionsObject(groupValuesOrOptions)) { + if (this.isScrollOptionsObject(groupValuesOrOptions)) { groupValues = groupValuesOrOptions.group; allDayValue = groupValuesOrOptions.allDay; align = groupValuesOrOptions.alignInView ?? 'center'; @@ -2120,7 +2125,7 @@ class Scheduler extends SchedulerOptionsBaseWidget { this._workSpace.scrollTo(date, groupValues, allDayValue, true, align); } - private _isScrollOptionsObject(options?: ScrollToGroupValuesOrOptions): options is ScrollToOptions { + private isScrollOptionsObject(options?: ScrollToGroupValuesOrOptions): options is ScrollToOptions { return Boolean(options) && typeof options === 'object' && ('alignInView' in options || 'allDay' in options || 'group' in options); } @@ -2256,10 +2261,12 @@ class Scheduler extends SchedulerOptionsBaseWidget { } } + // TODO: used externally in m_appointment_drag_behavior.ts _getDragBehavior() { return this._workSpace.dragBehavior; } + // TODO: used externally in m_appointment_drag_behavior.ts _isAppointmentBeingUpdated(appointmentData: Appointment): boolean { return this.updatingAppointments.has(appointmentData); } 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..e4038952313f 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 groupPanelItems: GroupRenderItem[][] | null = null; getGroupPanelItems(): GroupRenderItem[][] { - if (this._groupPanelItems !== null) { - return this._groupPanelItems; + if (this.groupPanelItems !== null) { + return this.groupPanelItems; } const { @@ -38,7 +38,7 @@ export class GroupPanelHorizontal extends BaseInfernoComponent { + this.groupPanelItems = 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.shader.forEach((shader) => { + this.$container.append(shader); }); } initShaderElements(): void { - this._$shader = this.createShader(); - this._shader = []; - this._shader.push(this._$shader); + this.$shader = this.createShader(); + 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..5538b06e8fdf 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 @@ -6,34 +6,34 @@ import CurrentTimeShader from './current_time_shader'; class HorizontalCurrentTimeShader extends CurrentTimeShader { renderShader(): void { - const groupCount = this._workSpace._isHorizontalGroupedWorkSpace() - ? this._workSpace._getGroupCount() + const groupCount = this.workSpace._isHorizontalGroupedWorkSpace() + ? this.workSpace._getGroupCount() : 1; 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()) { + if (this.workSpace.isGroupedByDate()) { this.customizeGroupedByDateShader($shader, i); } else { this.customizeShader($shader, i); } if (!isFirstShader) { - this._shader.push($shader); + this.shader.push($shader); } } } private customizeShader($shader: dxElementWrapper, groupIndex: number): void { // @ts-expect-error - const shaderWidth = this._workSpace.getIndicationWidth() as number; + const shaderWidth = this.workSpace.getIndicationWidth() as number; this.applyShaderWidth($shader, shaderWidth); if (groupIndex >= 1) { - const workSpace = this._workSpace; + const { workSpace } = this; const indicationWidth = workSpace._getCellCount() * workSpace.getCellWidth(); $shader.css('left', indicationWidth); } else { @@ -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)); } @@ -50,11 +50,11 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader { private customizeGroupedByDateShader($shader: dxElementWrapper, groupIndex: number): void { // @ts-expect-error - const cellCount = this._workSpace.getIndicationCellCount() as number; + const cellCount = this.workSpace.getIndicationCellCount() as number; const integerPart = Math.floor(cellCount); const fractionPart = cellCount - integerPart; const isFirstShaderPart = groupIndex === 0; - const workSpace = this._workSpace; + const { workSpace } = this; const shaderWidth = isFirstShaderPart // @ts-expect-error ? workSpace.getIndicationWidth() as number 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..fc28586921b6 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,10 +23,10 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { shaderHeight = maxHeight; } - setHeight(this._$shader, shaderHeight); - const groupCount = this._workSpace._getGroupCount() || 1; + setHeight(this.$shader, shaderHeight); + const groupCount = this.workSpace._getGroupCount() || 1; - if (this._workSpace.isGroupedByDate()) { + if (this.workSpace.isGroupedByDate()) { this.renderGroupedByDateShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader); } else { this.renderShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader); @@ -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); @@ -60,17 +60,17 @@ class VerticalCurrentTimeShader extends CurrentTimeShader { const shaderWidth = this.getShaderWidth(); const bottomShaderWidth = shaderHeight < 0 ? shaderWidth - : shaderWidth - this._workSpace.getCellWidth(); + : 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(), + bottomShaderWidth * groupCount + this.workSpace.getCellWidth(), 0, ); } @@ -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,55 +105,55 @@ 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 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)); + 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._workSpace._$allDayPanel.prepend(this._$allDayIndicator); + this.workSpace._$allDayPanel.prepend(this.$allDayIndicator); } } private getShaderOffset(i: number, width: number): number { - return this._workSpace.getGroupedStrategy().getShaderOffset(i, width) as number; + return this.workSpace.getGroupedStrategy().getShaderOffset(i, width) as number; } private getShaderTopOffset(i: number): number { - return this._workSpace.getGroupedStrategy().getShaderTopOffset(i) as number; + return this.workSpace.getGroupedStrategy().getShaderTopOffset(i) as number; } private getShaderHeight(): number { - return this._workSpace.getGroupedStrategy().getShaderHeight() as number; + return this.workSpace.getGroupedStrategy().getShaderHeight() as number; } private getShaderMaxHeight(): number { - return this._workSpace.getGroupedStrategy().getShaderMaxHeight() as number; + return this.workSpace.getGroupedStrategy().getShaderMaxHeight() as number; } private getShaderWidth(): number { - return this._workSpace.getGroupedStrategy().getShaderWidth() as number; + return this.workSpace.getGroupedStrategy().getShaderWidth() as number; } clean(): void { super.clean(); - if (this._workSpace?._$allDayPanel) { - this._workSpace._$allDayPanel.find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove(); + if (this.workSpace?._$allDayPanel) { + this.workSpace._$allDayPanel.find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove(); } } } diff --git a/packages/devextreme/js/__internal/scheduler/utils/options/constants.ts b/packages/devextreme/js/__internal/scheduler/utils/options/constants.ts index 8bbab436d6c8..ee78ea0a8753 100644 --- a/packages/devextreme/js/__internal/scheduler/utils/options/constants.ts +++ b/packages/devextreme/js/__internal/scheduler/utils/options/constants.ts @@ -108,7 +108,9 @@ export const DEFAULT_SCHEDULER_INTERNAL_OPTIONS: SchedulerInternalOptions = { ...DEFAULT_SCHEDULER_OPTIONS.editing, popup: {}, }, + // TODO: legacy option property name _draggingMode: 'outlook', + // TODO: legacy option property name _appointmentTooltipOffset: { x: 0, y: 0 }, appointmentPopupTemplate: 'appointmentPopup', disabledExpr: 'disabled', diff --git a/packages/devextreme/js/__internal/scheduler/utils/options/types.ts b/packages/devextreme/js/__internal/scheduler/utils/options/types.ts index b3e17098bce7..6ca273b213bb 100644 --- a/packages/devextreme/js/__internal/scheduler/utils/options/types.ts +++ b/packages/devextreme/js/__internal/scheduler/utils/options/types.ts @@ -26,7 +26,9 @@ export interface SchedulerInternalOptions { editing: Properties['editing'] | { legacyForm: boolean; }; + // TODO: legacy option property name _draggingMode: 'outlook' | 'default'; + // TODO: legacy option property name _appointmentTooltipOffset: { x: number; y: number }; appointmentPopupTemplate: template; disabledExpr: string; 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_virtual_scrolling.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts index b4f2b040b4e2..c6042ce1baf1 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_virtual_scrolling.ts @@ -580,11 +580,11 @@ class VirtualScrollingBase { 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; 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 8db9e44e7415..d7626023448d 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); @@ -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); } @@ -741,12 +741,13 @@ export class ViewDataGenerator { return hoursInterval * toMs('hour'); } + // TODO: used externally in m_view_data_provider.ts public _getIntervalDuration(intervalCount) { return toMs('day') * intervalCount; } // 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 9337d10e930d..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 @@ -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, 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,