@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.
65 lines (64 loc) • 2.82 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 { CollectionService, ItemChange } from './collection.service';
import { ConfigurationService } from './configuration.service';
import { copyChanges } from './copy-changes';
import { toSimpleChanges } from './to-simple-changes';
import * as i0 from "@angular/core";
import * as i1 from "./configuration.service";
import * as i2 from "./collection.service";
/**
* @hidden
*/
export class CollectionItemComponent {
configurationService;
collectionService;
subscription;
options = {};
hidden = false;
constructor(configurationService, collectionService) {
this.configurationService = configurationService;
this.collectionService = collectionService;
this.subscription = configurationService.onFastChange$.subscribe(store => {
this.options = store;
this.notify();
});
}
ngOnChanges(changes) {
const store = this.configurationService.store;
copyChanges(changes, store);
this.configurationService.push(store);
}
/**
* Updates the component fields with the specified values and refreshes the Chart.
*
* Use this method when the configuration values cannot be set through the template.
*
* @example
* ```ts-no-run
* item.notifyChanges({ visible: true });
* ```
*
* @param changes An object containing the updated input fields.
*/
notifyChanges(changes) {
this.ngOnChanges(toSimpleChanges(changes));
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
notify() {
if (!this.collectionService) {
return;
}
this.collectionService.notify(new ItemChange(this, this.options));
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CollectionItemComponent, deps: [{ token: i1.ConfigurationService }, { token: i2.CollectionService }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: CollectionItemComponent, usesOnChanges: true, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CollectionItemComponent, decorators: [{
type: Directive
}], ctorParameters: function () { return [{ type: i1.ConfigurationService }, { type: i2.CollectionService }]; } });