UNPKG

@progress/kendo-angular-grid

Version:

Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.

41 lines (40 loc) 1.96 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Injectable, Renderer2 } from '@angular/core'; import * as i0 from "@angular/core"; /** * @hidden */ export class ColumnListKeyboardNavigation { renderer; items; activeIndex = 0; constructor(renderer) { this.renderer = renderer; } next() { this.toggle(this.activeIndex, false); this.activeIndex = Math.min(this.activeIndex + 1, this.items.length - 1); this.toggle(this.activeIndex, true); } prev() { this.toggle(this.activeIndex, false); this.activeIndex = Math.max(this.activeIndex - 1, 0); this.toggle(this.activeIndex, true); } toggle(index, active) { const element = this.items[index]?.host.nativeElement; element && this.renderer.setAttribute(this.items[index].host.nativeElement, 'tabindex', active ? '0' : '-1'); active && element?.focus(); } toggleCheckedState() { this.items[this.activeIndex].host.nativeElement.firstElementChild.click(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnListKeyboardNavigation, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnListKeyboardNavigation }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnListKeyboardNavigation, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; } });