@progress/kendo-angular-charts
Version:
Kendo UI Charts for Angular - A comprehensive package for creating beautiful and interactive data visualization. Every chart type, stock charts, and sparklines are included.
59 lines (58 loc) • 2.59 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 } from '@angular/core';
import { ConfigurationService } from './configuration.service';
import { Change } from './configuration.service';
import { CollectionService } from './collection.service';
import * as i0 from "@angular/core";
import * as i1 from "./configuration.service";
import * as i2 from "./collection.service";
/**
* @hidden
*/
export class CollectionComponent {
configKey;
configurationService;
collectionService;
children;
subscription;
items = [];
constructor(configKey, configurationService, collectionService) {
this.configKey = configKey;
this.configurationService = configurationService;
this.collectionService = collectionService;
this.subscription = collectionService.onItemChange$.subscribe(changes => this.processChanges(changes));
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
ngAfterContentInit() {
this.readItems();
this.children.changes.subscribe(() => this.readItems());
}
processChanges(changes) {
if (!this.children) {
return;
}
const index = this.children.toArray().filter(s => !s.hidden).indexOf(changes.sender);
if (index < 0) {
return;
}
this.items[index] = changes.options;
this.change();
}
readItems() {
this.items = this.children.filter(s => !s.hidden).map(s => s.options);
this.change();
}
change() {
this.configurationService.notify(new Change(this.configKey, this.items.length === 0 ? undefined : this.items));
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CollectionComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: CollectionComponent, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CollectionComponent, decorators: [{
type: Directive
}], ctorParameters: function () { return [{ type: undefined }, { type: i1.ConfigurationService }, { type: i2.CollectionService }]; } });