UNPKG

@progress/kendo-angular-listbox

Version:
48 lines (47 loc) 2.4 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Directive, Input, HostBinding, HostListener } from '@angular/core'; import { ListBoxSelectionService } from './selection.service'; import * as i0 from "@angular/core"; import * as i1 from "./selection.service"; /** * @hidden */ export class ItemSelectableDirective { selectionService; index; constructor(selectionService) { this.selectionService = selectionService; } get selectedClassName() { return this.selectionService.isSelected(this.index); } onClick(event) { event.stopPropagation(); const ctrlKey = event.ctrlKey || event.metaKey; const shiftKey = event.shiftKey; if (shiftKey) { event.preventDefault(); } this.selectionService.select(this.index, ctrlKey, shiftKey); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemSelectableDirective, deps: [{ token: i1.ListBoxSelectionService }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ItemSelectableDirective, isStandalone: true, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "mousedown": "onClick($event)" }, properties: { "class.k-selected": "this.selectedClassName" } }, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemSelectableDirective, decorators: [{ type: Directive, args: [{ selector: '[kendoListBoxItemSelectable]', standalone: true }] }], ctorParameters: () => [{ type: i1.ListBoxSelectionService }], propDecorators: { index: [{ type: Input }], selectedClassName: [{ type: HostBinding, args: ['class.k-selected'] }], onClick: [{ type: HostListener, args: ['mousedown', ['$event']] }] } });