@progress/kendo-angular-treeview
Version:
Kendo UI TreeView for Angular
34 lines (33 loc) • 1.46 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 { Injectable } from '@angular/core';
import { Subject } from "rxjs";
import * as i0 from "@angular/core";
/**
* @hidden
*/
export class SelectionService {
changes = new Subject();
firstIndex;
isFirstSelected(index) {
return this.firstIndex === index;
}
setFirstSelected(index, selected) {
if (this.firstIndex === index && selected === false) {
this.firstIndex = null;
}
else if (!this.firstIndex && selected) {
this.firstIndex = index;
}
}
select(index, dataItem) {
this.changes.next({ dataItem, index });
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectionService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectionService, decorators: [{
type: Injectable
}] });