/*! * devextreme-angular-test * Version: 17.2.8 * Build date: Mon Feb 05 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ import { Component, NgModule, ElementRef, NgZone, Input, Output, OnDestroy, Injector, EventEmitter, OnChanges, DoCheck, SimpleChanges } from '@angular/core'; import DevExpress from 'devextreme/bundles/dx.all'; import DxLinearGauge from 'devextreme/viz/linear_gauge'; import { DxComponent } from '../core/component'; import { DxTemplateHost } from '../core/template-host'; import { DxTemplateModule } from '../core/template'; import { EventsRegistrator } from '../core/events-strategy'; import { NestedOptionHost } from '../core/nested-option'; import { WatcherHelper } from '../core/watcher-helper'; import { IterableDifferHelper } from '../core/iterable-differ-helper'; import { DxoAnimationModule } from './nested/animation'; import { DxoExportModule } from './nested/export'; import { DxoGeometryModule } from './nested/geometry'; import { DxoLoadingIndicatorModule } from './nested/loading-indicator'; import { DxoFontModule } from './nested/font'; import { DxoMarginModule } from './nested/margin'; import { DxoRangeContainerModule } from './nested/range-container'; import { DxiRangeModule } from './nested/range-dxi'; import { DxoWidthModule } from './nested/width'; import { DxoScaleModule } from './nested/scale'; import { DxoLabelModule } from './nested/label'; import { DxoFormatModule } from './nested/format'; import { DxoOverlappingBehaviorModule } from './nested/overlapping-behavior'; import { DxoMajorTickModule } from './nested/major-tick'; import { DxoMinorTickModule } from './nested/minor-tick'; import { DxoTickModule } from './nested/tick'; import { DxoSizeModule } from './nested/size'; import { DxoSubtitleModule } from './nested/subtitle'; import { DxoSubvalueIndicatorModule } from './nested/subvalue-indicator'; import { DxoTextModule } from './nested/text'; import { DxoTitleModule } from './nested/title'; import { DxoTooltipModule } from './nested/tooltip'; import { DxoBorderModule } from './nested/border'; import { DxoShadowModule } from './nested/shadow'; import { DxoValueIndicatorModule } from './nested/value-indicator'; /** * The LinearGauge is a widget that indicates values on a linear numeric scale. */ @Component({ selector: 'dx-linear-gauge', template: '', styles: [ ' :host { display: block; }'], providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ] }) export class DxLinearGaugeComponent extends DxComponent implements OnDestroy, OnChanges, DoCheck { instance: DxLinearGauge; /** * Specifies animation options. */ @Input() get animation(): any { return this._getOption('animation'); } set animation(value: any) { this._setOption('animation', value); } /** * Specifies the color of the parent page element. */ @Input() get containerBackgroundColor(): string { return this._getOption('containerBackgroundColor'); } set containerBackgroundColor(value: string) { this._setOption('containerBackgroundColor', value); } /** * Specifies the attributes to be attached to the widget's root element. */ @Input() get elementAttr(): any { return this._getOption('elementAttr'); } set elementAttr(value: any) { this._setOption('elementAttr', value); } /** * Configures the exporting and printing features. */ @Input() get export(): any { return this._getOption('export'); } set export(value: any) { this._setOption('export', value); } /** * Specifies the options required to set the geometry of the LinearGauge widget. */ @Input() get geometry(): any { return this._getOption('geometry'); } set geometry(value: any) { this._setOption('geometry', value); } /** * Configures the loading indicator. */ @Input() get loadingIndicator(): any { return this._getOption('loadingIndicator'); } set loadingIndicator(value: any) { this._setOption('loadingIndicator', value); } /** * Generates space around the widget. */ @Input() get margin(): any { return this._getOption('margin'); } set margin(value: any) { this._setOption('margin', value); } /** * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. */ @Input() get pathModified(): boolean { return this._getOption('pathModified'); } set pathModified(value: boolean) { this._setOption('pathModified', value); } /** * Specifies gauge range container options. */ @Input() get rangeContainer(): any { return this._getOption('rangeContainer'); } set rangeContainer(value: any) { this._setOption('rangeContainer', value); } /** * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ @Input() get redrawOnResize(): boolean { return this._getOption('redrawOnResize'); } set redrawOnResize(value: boolean) { this._setOption('redrawOnResize', value); } /** * Switches the widget to a right-to-left representation. */ @Input() get rtlEnabled(): boolean { return this._getOption('rtlEnabled'); } set rtlEnabled(value: boolean) { this._setOption('rtlEnabled', value); } /** * Specifies the gauge's scale options. */ @Input() get scale(): any { return this._getOption('scale'); } set scale(value: any) { this._setOption('scale', value); } /** * Specifies the widget's size in pixels. */ @Input() get size(): any { return this._getOption('size'); } set size(value: any) { this._setOption('size', value); } /** * Use the title.subtitle option instead. */ @Input() get subtitle(): string| { font?: DevExpress.viz.Font, text?: string } { return this._getOption('subtitle'); } set subtitle(value: string| { font?: DevExpress.viz.Font, text?: string }) { this._setOption('subtitle', value); } /** * Specifies the appearance options of subvalue indicators. */ @Input() get subvalueIndicator(): any { return this._getOption('subvalueIndicator'); } set subvalueIndicator(value: any) { this._setOption('subvalueIndicator', value); } /** * Specifies a set of subvalues to be designated by the subvalue indicators. */ @Input() get subvalues(): Array { return this._getOption('subvalues'); } set subvalues(value: Array) { this._setOption('subvalues', value); } /** * Sets the name of the theme the widget uses. */ @Input() get theme(): string { return this._getOption('theme'); } set theme(value: string) { this._setOption('theme', value); } /** * Configures the widget's title. */ @Input() get title(): string| { font?: DevExpress.viz.Font, horizontalAlignment?: string, margin?: number| { bottom?: number, left?: number, right?: number, top?: number }, placeholderSize?: number, position?: string, subtitle?: string| { font?: DevExpress.viz.Font, text?: string }, text?: string, verticalAlignment?: string } { return this._getOption('title'); } set title(value: string| { font?: DevExpress.viz.Font, horizontalAlignment?: string, margin?: number| { bottom?: number, left?: number, right?: number, top?: number }, placeholderSize?: number, position?: string, subtitle?: string| { font?: DevExpress.viz.Font, text?: string }, text?: string, verticalAlignment?: string }) { this._setOption('title', value); } /** * Configures tooltips. */ @Input() get tooltip(): any { return this._getOption('tooltip'); } set tooltip(value: any) { this._setOption('tooltip', value); } /** * Specifies the main value on a gauge. */ @Input() get value(): number { return this._getOption('value'); } set value(value: number) { this._setOption('value', value); } /** * Specifies the appearance options of the value indicator. */ @Input() get valueIndicator(): any { return this._getOption('valueIndicator'); } set valueIndicator(value: any) { this._setOption('valueIndicator', value); } /** * A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. */ @Output() onDisposing: EventEmitter; /** * A handler for the drawn event. Executed when the widget has finished drawing itself. */ @Output() onDrawn: EventEmitter; /** * A handler for the exported event. Executed after data from the widget is exported. */ @Output() onExported: EventEmitter; /** * A handler for the exporting event. Executed before data from the widget is exported. */ @Output() onExporting: EventEmitter; /** * A handler for the fileSaving event. Executed before a file with exported data is saved on the user's local storage. */ @Output() onFileSaving: EventEmitter; /** * A handler for the incidentOccurred event. Executed when an error or warning appears in the widget. */ @Output() onIncidentOccurred: EventEmitter; /** * A handler for the initialized event. Executed only once, after the widget is initialized. */ @Output() onInitialized: EventEmitter; /** * A handler for the optionChanged event. Executed after an option of the widget is changed. */ @Output() onOptionChanged: EventEmitter; /** * A handler for the tooltipHidden event. */ @Output() onTooltipHidden: EventEmitter; /** * A handler for the tooltipShown event. */ @Output() onTooltipShown: EventEmitter; /** * A handler for the animationChange event. */ @Output() animationChange: EventEmitter; /** * A handler for the containerBackgroundColorChange event. */ @Output() containerBackgroundColorChange: EventEmitter; /** * A handler for the elementAttrChange event. */ @Output() elementAttrChange: EventEmitter; /** * A handler for the exportChange event. */ @Output() exportChange: EventEmitter; /** * A handler for the geometryChange event. */ @Output() geometryChange: EventEmitter; /** * A handler for the loadingIndicatorChange event. */ @Output() loadingIndicatorChange: EventEmitter; /** * A handler for the marginChange event. */ @Output() marginChange: EventEmitter; /** * A handler for the pathModifiedChange event. */ @Output() pathModifiedChange: EventEmitter; /** * A handler for the rangeContainerChange event. */ @Output() rangeContainerChange: EventEmitter; /** * A handler for the redrawOnResizeChange event. */ @Output() redrawOnResizeChange: EventEmitter; /** * A handler for the rtlEnabledChange event. */ @Output() rtlEnabledChange: EventEmitter; /** * A handler for the scaleChange event. */ @Output() scaleChange: EventEmitter; /** * A handler for the sizeChange event. */ @Output() sizeChange: EventEmitter; /** * A handler for the subtitleChange event. */ @Output() subtitleChange: EventEmitter; /** * A handler for the subvalueIndicatorChange event. */ @Output() subvalueIndicatorChange: EventEmitter; /** * A handler for the subvaluesChange event. */ @Output() subvaluesChange: EventEmitter>; /** * A handler for the themeChange event. */ @Output() themeChange: EventEmitter; /** * A handler for the titleChange event. */ @Output() titleChange: EventEmitter; /** * A handler for the tooltipChange event. */ @Output() tooltipChange: EventEmitter; /** * A handler for the valueChange event. */ @Output() valueChange: EventEmitter; /** * A handler for the valueIndicatorChange event. */ @Output() valueIndicatorChange: EventEmitter; constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost, injector: Injector, private _watcherHelper: WatcherHelper, private _idh: IterableDifferHelper, optionHost: NestedOptionHost) { super(elementRef, ngZone, templateHost, _watcherHelper); injector.get(EventsRegistrator); this._createEventEmitters([ { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'drawn', emit: 'onDrawn' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' }, { subscribe: 'tooltipShown', emit: 'onTooltipShown' }, { emit: 'animationChange' }, { emit: 'containerBackgroundColorChange' }, { emit: 'elementAttrChange' }, { emit: 'exportChange' }, { emit: 'geometryChange' }, { emit: 'loadingIndicatorChange' }, { emit: 'marginChange' }, { emit: 'pathModifiedChange' }, { emit: 'rangeContainerChange' }, { emit: 'redrawOnResizeChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scaleChange' }, { emit: 'sizeChange' }, { emit: 'subtitleChange' }, { emit: 'subvalueIndicatorChange' }, { emit: 'subvaluesChange' }, { emit: 'themeChange' }, { emit: 'titleChange' }, { emit: 'tooltipChange' }, { emit: 'valueChange' }, { emit: 'valueIndicatorChange' } ]); this._idh.setHost(this); optionHost.setHost(this); } protected _createInstance(element, options) { return new DxLinearGauge(element, options); } ngOnDestroy() { this._destroyWidget(); } ngOnChanges(changes: SimpleChanges) { super.ngOnChanges(changes); this.setupChanges('subvalues', changes); } setupChanges(prop: string, changes: SimpleChanges) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } } ngDoCheck() { this._idh.doCheck('subvalues'); this._watcherHelper.checkWatchers(); super.ngDoCheck(); } _setOption(name: string, value: any) { let isSetup = this._idh.setupSingle(name, value); let isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { super._setOption(name, value); } } } @NgModule({ imports: [ DxoAnimationModule, DxoExportModule, DxoGeometryModule, DxoLoadingIndicatorModule, DxoFontModule, DxoMarginModule, DxoRangeContainerModule, DxiRangeModule, DxoWidthModule, DxoScaleModule, DxoLabelModule, DxoFormatModule, DxoOverlappingBehaviorModule, DxoMajorTickModule, DxoMinorTickModule, DxoTickModule, DxoSizeModule, DxoSubtitleModule, DxoSubvalueIndicatorModule, DxoTextModule, DxoTitleModule, DxoTooltipModule, DxoBorderModule, DxoShadowModule, DxoValueIndicatorModule, DxTemplateModule ], declarations: [ DxLinearGaugeComponent ], exports: [ DxLinearGaugeComponent, DxoAnimationModule, DxoExportModule, DxoGeometryModule, DxoLoadingIndicatorModule, DxoFontModule, DxoMarginModule, DxoRangeContainerModule, DxiRangeModule, DxoWidthModule, DxoScaleModule, DxoLabelModule, DxoFormatModule, DxoOverlappingBehaviorModule, DxoMajorTickModule, DxoMinorTickModule, DxoTickModule, DxoSizeModule, DxoSubtitleModule, DxoSubvalueIndicatorModule, DxoTextModule, DxoTitleModule, DxoTooltipModule, DxoBorderModule, DxoShadowModule, DxoValueIndicatorModule, DxTemplateModule ], providers: [EventsRegistrator] }) export class DxLinearGaugeModule { }