UNPKG

@progress/kendo-angular-dateinputs

Version:

Kendo UI for Angular Date Inputs Package - Everything you need to add date selection functionality to apps (DatePicker, TimePicker, DateInput, DateRangePicker, DateTimePicker, Calendar, and MultiViewCalendar).

58 lines (57 loc) 2.37 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 } from '@angular/core'; import { Action } from '../models/navigation-action.enum'; import { BusViewService } from '../services/bus-view.service'; import * as i0 from "@angular/core"; import * as i1 from "../services/bus-view.service"; const KEY_TO_ACTION = { '33': Action.PrevView, '34': Action.NextView, '35': Action.LastInView, '36': Action.FirstInView, '37': Action.Left, '38': Action.Up, '39': Action.Right, '40': Action.Down, 'meta+38': Action.UpperView, 'meta+40': Action.LowerView }; /** * @hidden */ export class NavigationService { bus; constructor(bus) { this.bus = bus; } action(event) { const action = `${event.ctrlKey || event.metaKey ? 'meta+' : ''}${event.keyCode}`; return KEY_TO_ACTION[action]; } move(value, action, activeView) { const service = this.bus.service(activeView); if (!service) { return value; } if (action === Action.UpperView && this.bus.canMoveUp(activeView)) { this.bus.moveUp(activeView); return value; } if (action === Action.LowerView && this.bus.canMoveDown(activeView)) { this.bus.moveDown(activeView); return value; } return service.move(value, action); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationService, deps: [{ token: i1.BusViewService }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: function () { return [{ type: i1.BusViewService }]; } });