From 8c69bbd6252917f6efb1956e613cb506afa57ea3 Mon Sep 17 00:00:00 2001 From: "anna.shakhova" <68295572+anna-shakhova@users.noreply.github.com> Date: Thu, 20 Aug 2026 11:06:21 +0200 Subject: [PATCH 1/2] Grids: decouple dataController from kbn --- .../data_controller/data_controller.ts | 4 --- .../editor_factory/m_editor_factory.ts | 4 --- .../grids/grid_core/focus/m_focus.ts | 26 ++++++++++++++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts b/packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts index a842133588e6..0502f826ddd6 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts @@ -18,7 +18,6 @@ import { isLocalStore } from '@ts/grids/grid_core/data_source_adapter/utils/stor import type { EditingController } from '@ts/grids/grid_core/editing/m_editing'; import type { FilterSyncController } from '@ts/grids/grid_core/filter/m_filter_sync'; import type { FocusController } from '@ts/grids/grid_core/focus/m_focus'; -import type { KeyboardNavigationController } from '@ts/grids/grid_core/keyboard_navigation/m_keyboard_navigation'; import modules from '@ts/grids/grid_core/m_modules'; import type { Controllers, Module, OptionChanged, RowKey, @@ -137,8 +136,6 @@ export class DataController extends DataHelperMixin(modules.Controller) { private _filterExcludedColumn: Column | null = null; - protected _keyboardNavigationController!: KeyboardNavigationController; - protected _focusController!: FocusController; private loadErrorHandlerProxy!: (e: Error | string) => void; @@ -154,7 +151,6 @@ export class DataController extends DataHelperMixin(modules.Controller) { this._adaptiveColumnsController = this.getController('adaptiveColumns'); this._editingController = this.getController('editing'); this._filterSyncController = this.getController('filterSync'); - this._keyboardNavigationController = this.getController('keyboardNavigation'); this._focusController = this.getController('focus'); this._isPaging = false; diff --git a/packages/devextreme/js/__internal/grids/grid_core/editor_factory/m_editor_factory.ts b/packages/devextreme/js/__internal/grids/grid_core/editor_factory/m_editor_factory.ts index e4ef2b8ac67a..7cc01973c651 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/editor_factory/m_editor_factory.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/editor_factory/m_editor_factory.ts @@ -18,7 +18,6 @@ import type { ColumnHeadersView } from '@ts/grids/grid_core/column_headers/m_col import type { ColumnsResizerViewController, } from '@ts/grids/grid_core/columns_resizing_reordering/m_columns_resizing_reordering'; -import type { KeyboardNavigationController } from '@ts/grids/grid_core/keyboard_navigation/m_keyboard_navigation'; import type { ValidatingController } from '@ts/grids/grid_core/validating/m_validating'; import type { ColumnsController } from '../columns_controller/m_columns_controller'; @@ -76,8 +75,6 @@ export class EditorFactory extends ViewControllerWithMixin { protected _columnsResizerController!: ColumnsResizerViewController; - protected _keyboardNavigationController!: KeyboardNavigationController; - protected _validatingController!: ValidatingController; protected _columnHeadersView!: ColumnHeadersView; @@ -90,7 +87,6 @@ export class EditorFactory extends ViewControllerWithMixin { this._columnsResizerController = this.getController('columnsResizer'); this._editingController = this.getController('editing'); - this._keyboardNavigationController = this.getController('keyboardNavigation'); this._columnsController = this.getController('columns'); this._validatingController = this.getController('validating'); this._columnHeadersView = this.getView('columnHeadersView'); diff --git a/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts b/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts index c7674bad01f4..760629fd6328 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts @@ -498,7 +498,16 @@ const keyboardNavigation = (Base: ModuleType) => c } }; -const editorFactory = (Base: ModuleType) => class FocusEditorFactoryExtender extends Base { +const focusEditorFactoryViewControllerExtender = ( + Base: ModuleType, +) => class FocusEditorFactoryExtender extends Base { + protected _keyboardNavigationController!: KeyboardNavigationController; + + public init(): void { + this._keyboardNavigationController = this.getController('keyboardNavigation'); + super.init(); + } + protected renderFocusOverlay($element, isHideBorder) { const focusedRowEnabled = this.option('focusedRowEnabled'); @@ -548,9 +557,18 @@ const columns = (Base: ModuleType) => class FocusColumnsExten } }; -const data = (Base: ModuleType) => class FocusDataControllerExtender extends Base { +const focusDataControllerExtender = ( + Base: ModuleType, +) => class FocusDataControllerExtender extends Base { private _isDataPushed = false; + protected _keyboardNavigationController!: KeyboardNavigationController; + + public init(): void { + this._keyboardNavigationController = this.getController('keyboardNavigation'); + super.init(); + } + protected _applyChange(change) { if (change && change.changeType === 'updateFocusedRow') return; @@ -1044,11 +1062,11 @@ export const focusModule = { controllers: { keyboardNavigation, - editorFactory, + editorFactory: focusEditorFactoryViewControllerExtender, columns, - data, + data: focusDataControllerExtender, editing, }, From cb49334a521f486700335870e614abcb2beebd74 Mon Sep 17 00:00:00 2001 From: "anna.shakhova" <68295572+anna-shakhova@users.noreply.github.com> Date: Thu, 20 Aug 2026 12:13:28 +0200 Subject: [PATCH 2/2] remove _ in field name --- .../grids/data_grid/focus/m_focus.ts | 2 +- .../grids/grid_core/focus/m_focus.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/data_grid/focus/m_focus.ts b/packages/devextreme/js/__internal/grids/data_grid/focus/m_focus.ts index f0348e583f39..95ad327d2018 100644 --- a/packages/devextreme/js/__internal/grids/data_grid/focus/m_focus.ts +++ b/packages/devextreme/js/__internal/grids/data_grid/focus/m_focus.ts @@ -28,7 +28,7 @@ const data = (Base: DataControllerBase) => class FocusDataControllerExtender ext private changeRowExpand(path, isRowClick) { // @ts-expect-error if (this.option('focusedRowEnabled') && Array.isArray(path) && this.isRowExpanded(path)) { - if ((!isRowClick || !this._keyboardNavigationController.isKeyboardEnabled()) && this._isFocusedRowInsideGroup(path)) { + if ((!isRowClick || !this.keyboardNavigationController.isKeyboardEnabled()) && this._isFocusedRowInsideGroup(path)) { this.option('focusedRowKey', path); } } diff --git a/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts b/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts index 760629fd6328..39fb37dd160b 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/focus/m_focus.ts @@ -501,10 +501,10 @@ const keyboardNavigation = (Base: ModuleType) => c const focusEditorFactoryViewControllerExtender = ( Base: ModuleType, ) => class FocusEditorFactoryExtender extends Base { - protected _keyboardNavigationController!: KeyboardNavigationController; + protected keyboardNavigationController!: KeyboardNavigationController; public init(): void { - this._keyboardNavigationController = this.getController('keyboardNavigation'); + this.keyboardNavigationController = this.getController('keyboardNavigation'); super.init(); } @@ -513,17 +513,17 @@ const focusEditorFactoryViewControllerExtender = ( if ( !focusedRowEnabled - || !this._keyboardNavigationController?.isRowFocusType() + || !this.keyboardNavigationController?.isRowFocusType() || this._editingController.isEditing() || this._columnHeadersView.isFilterRowCell($element) ) { super.renderFocusOverlay($element, isHideBorder); } else if (focusedRowEnabled) { - const isRowElement = this._keyboardNavigationController._getElementType($element) === 'row'; + const isRowElement = this.keyboardNavigationController._getElementType($element) === 'row'; if (isRowElement && !$element.hasClass(ROW_FOCUSED_CLASS)) { - const $cell = this._keyboardNavigationController.getFirstValidCellInRow($element); - this._keyboardNavigationController.focus($cell); + const $cell = this.keyboardNavigationController.getFirstValidCellInRow($element); + this.keyboardNavigationController.focus($cell); } } } @@ -562,10 +562,10 @@ const focusDataControllerExtender = ( ) => class FocusDataControllerExtender extends Base { private _isDataPushed = false; - protected _keyboardNavigationController!: KeyboardNavigationController; + protected keyboardNavigationController!: KeyboardNavigationController; public init(): void { - this._keyboardNavigationController = this.getController('keyboardNavigation'); + this.keyboardNavigationController = this.getController('keyboardNavigation'); super.init(); } @@ -646,7 +646,7 @@ const focusDataControllerExtender = ( const { reload, fullReload, pageIndex, paging, } = operationTypes; - const isVirtualScrolling = this._keyboardNavigationController._isVirtualScrolling(); + const isVirtualScrolling = this.keyboardNavigationController._isVirtualScrolling(); const pagingWithoutVirtualScrolling = paging && !isVirtualScrolling; const focusedRowKey = this.option('focusedRowKey'); const isAutoNavigate = this._focusController.isAutoNavigateToFocusedRow();