UNPKG

@progress/kendo-angular-treelist

Version:

Kendo UI TreeList for Angular - Display hierarchical data in an Angular tree grid view that supports sorting, filtering, paging, and much more.

39 lines (38 loc) 1.7 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 { ExpandEvent } from './expand-event'; import { Subject } from "rxjs"; import * as i0 from "@angular/core"; /** * @hidden */ export const defaultExpanded = (_item) => true; /** * @hidden */ export class ExpandStateService { changes = new Subject(); isExpanded = defaultExpanded; toggleState(dataItem) { const isExpanded = this.isExpanded(dataItem); this.changes.next(new ExpandEvent({ dataItem: dataItem, expand: !isExpanded })); } expand(dataItem) { if (!this.isExpanded(dataItem)) { this.changes.next(new ExpandEvent({ dataItem: dataItem, expand: true })); } } collapse(dataItem) { if (this.isExpanded(dataItem)) { this.changes.next(new ExpandEvent({ dataItem: dataItem, expand: false })); } } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExpandStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExpandStateService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExpandStateService, decorators: [{ type: Injectable }] });