UNPKG

@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.

70 lines (69 loc) 2.29 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2024 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Injectable, NgZone } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { auditTime } from 'rxjs/operators'; import * as i0 from "@angular/core"; /** * @hidden */ export const THROTTLE_MS = 1000 / 60; /** * @hidden */ export class Change { key; value; constructor(key, value) { this.key = key; this.value = value; } } /** * @hidden */ export class ConfigurationService { ngZone; onChange$; onFastChange$; store = {}; source = new BehaviorSubject({}); constructor(ngZone) { this.ngZone = ngZone; this.initSource(); } initSource() { this.onFastChange$ = this.source.asObservable(); this.onChange$ = this.onFastChange$.pipe(auditTime(THROTTLE_MS)); } push(store) { this.store = store; this.next(); } notify(change) { this.set(change.key, change.value); this.next(); } set(field, value) { let store = this.store; const parts = field.split('.'); let key = parts.shift(); while (parts.length > 0) { store = store[key] = store[key] || {}; key = parts.shift(); } store[key] = value; } next() { this.ngZone.runOutsideAngular(() => { this.source.next(this.store); }); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigurationService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigurationService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigurationService, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });