UNPKG

@progress/kendo-angular-gantt

Version:
81 lines (80 loc) 2.98 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 { Subject } from 'rxjs'; import { MappingService } from '../common/mapping.service'; import * as i0 from "@angular/core"; import * as i1 from "../common/mapping.service"; /** * @hidden */ export class DependencyDomService { mapper; /** * Emits each time some of the tasks or the view have changed. * Fires also on the first change of the table rows and the parent container. */ get taskChanges() { return this.notifier.asObservable(); } get dependencyDomArgs() { return { tasks: this.tasks, contentContainer: this.contentContainer, timelineRow: this.timelineRow }; } notifier = new Subject(); /** * The row element in the Timeline part of the Gantt. */ timelineRow; /** * Used to get retrieve the offset of the task elements relative to the parent container. */ contentContainer; /** * Maps each rendered task to its HTML element. * Uses the task ID field value as key. */ tasks = new Map(); constructor(mapper) { this.mapper = mapper; } ngOnDestroy() { this.tasks.clear(); this.tasks = null; this.contentContainer = null; } registerTimelineRow(timelineRow) { this.timelineRow = timelineRow; this.notifyChanges(); } registerContentContainer(contentContainer) { this.contentContainer = contentContainer; this.notifyChanges(); } registerTask(task, element) { const id = this.mapper.extractFromTask(task, 'id'); this.tasks.set(id, element); this.notifyChanges(); } unregisterTask(task) { const id = this.mapper.extractFromTask(task, 'id'); this.tasks.delete(id); this.notifyChanges(); } /** * Notifies all dependency directives that a change in one of the elements has occured. */ notifyChanges() { this.notifier.next(this.dependencyDomArgs); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DependencyDomService, deps: [{ token: i1.MappingService }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DependencyDomService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DependencyDomService, decorators: [{ type: Injectable }], ctorParameters: () => [{ type: i1.MappingService }] });