@progress/kendo-angular-listbox
Version:
Kendo UI for Angular ListBox
43 lines (42 loc) • 2.23 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* 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();
this.selectionService.select(this.index);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ItemSelectableDirective, deps: [{ token: i1.ListBoxSelectionService }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", 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: "16.2.12", ngImport: i0, type: ItemSelectableDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoListBoxItemSelectable]',
standalone: true
}]
}], ctorParameters: function () { return [{ type: i1.ListBoxSelectionService }]; }, propDecorators: { index: [{
type: Input
}], selectedClassName: [{
type: HostBinding,
args: ['class.k-selected']
}], onClick: [{
type: HostListener,
args: ['mousedown', ['$event']]
}] } });