UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

43 lines (42 loc) 1.56 kB
/** * DevExtreme (esm/__internal/grids/tree_list/m_keyboard_navigation.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { extend } from "../../../core/utils/extend"; import { keyboardNavigationModule } from "../../grids/grid_core/keyboard_navigation/m_keyboard_navigation"; import { keyboardNavigationScrollableA11yExtender } from "../../grids/grid_core/keyboard_navigation/scrollable_a11y"; import core from "./m_core"; const keyboardNavigation = Base => class extends(keyboardNavigationScrollableA11yExtender(Base)) { _leftRightKeysHandler(eventArgs, _isEditing) { const rowIndex = this.getVisibleRowIndex(); const dataController = this._dataController; if (eventArgs.ctrl) { const directionCode = this._getDirectionCodeByKey(eventArgs.keyName); const key = dataController.getKeyByRowIndex(rowIndex); if ("nextInRow" === directionCode) { dataController.expandRow(key) } else { dataController.collapseRow(key) } } else { return super._leftRightKeysHandler.apply(this, arguments) } } }; core.registerModule("keyboardNavigation", extend(true, {}, keyboardNavigationModule, { extenders: { controllers: { keyboardNavigation: keyboardNavigation } } }));