@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.
62 lines (61 loc) • 2.5 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 { copyChanges } from './copy-changes';
import { toSimpleChanges } from './to-simple-changes';
import * as i0 from "@angular/core";
import * as i1 from "./configuration.service";
/**
* @hidden
*/
export class SettingsComponent {
configKey;
configurationService;
store = {};
constructor(configKey, configurationService) {
this.configKey = configKey;
this.configurationService = configurationService;
if (configKey === undefined) {
throw new Error('Configuration key not set');
}
}
ngOnDestroy() {
this.store = undefined;
this.notify();
}
ngOnChanges(changes) {
copyChanges(changes, this.store);
this.notify();
}
/**
* 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));
}
markAsVisible() {
this.store.visible = true;
this.notify();
}
notify() {
this.configurationService.notify(new Change(this.configKey, this.store));
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SettingsComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: SettingsComponent, usesOnChanges: true, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SettingsComponent, decorators: [{
type: Directive
}], ctorParameters: function () { return [{ type: undefined }, { type: i1.ConfigurationService }]; } });