/*! * 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 DxTooltip from 'devextreme/ui/tooltip'; 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 { DxoHideModule } from './nested/hide'; import { DxoShowModule } from './nested/show'; import { DxoHideEventModule } from './nested/hide-event'; import { DxoPositionModule } from './nested/position'; import { DxoAtModule } from './nested/at'; import { DxoBoundaryOffsetModule } from './nested/boundary-offset'; import { DxoCollisionModule } from './nested/collision'; import { DxoMyModule } from './nested/my'; import { DxoOffsetModule } from './nested/offset'; import { DxoShowEventModule } from './nested/show-event'; /** * The Tooltip widget displays a tooltip for a specified element on the page. */ @Component({ selector: 'dx-tooltip', template: '', providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ] }) export class DxTooltipComponent extends DxComponent implements OnDestroy, OnChanges, DoCheck { instance: DxTooltip; /** * Configures widget visibility animations. This object contains two fields: show and hide. */ @Input() get animation(): any { return this._getOption('animation'); } set animation(value: any) { this._setOption('animation', value); } /** * Use the toolbarItems option instead. */ @Input() get buttons(): Array { return this._getOption('buttons'); } set buttons(value: Array) { this._setOption('buttons', value); } /** * A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ @Input() get closeOnBackButton(): boolean { return this._getOption('closeOnBackButton'); } set closeOnBackButton(value: boolean) { this._setOption('closeOnBackButton', value); } /** * A Boolean value specifying whether or not the widget is closed if a user clicks outside of the popover window and outside the target element. */ @Input() get closeOnOutsideClick(): boolean| Function { return this._getOption('closeOnOutsideClick'); } set closeOnOutsideClick(value: boolean| Function) { this._setOption('closeOnOutsideClick', value); } /** * A template to be used for rendering widget content. */ @Input() get contentTemplate(): any { return this._getOption('contentTemplate'); } set contentTemplate(value: any) { this._setOption('contentTemplate', value); } /** * Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ @Input() get deferRendering(): boolean { return this._getOption('deferRendering'); } set deferRendering(value: boolean) { this._setOption('deferRendering', value); } /** * Specifies whether the widget responds to user interaction. */ @Input() get disabled(): boolean { return this._getOption('disabled'); } set disabled(value: boolean) { this._setOption('disabled', 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); } /** * Specifies the widget's height. */ @Input() get height(): number| Function| string { return this._getOption('height'); } set height(value: number| Function| string) { this._setOption('height', value); } /** * Specifies options of popover hiding. */ @Input() get hideEvent(): string| { delay?: number, name?: string } { return this._getOption('hideEvent'); } set hideEvent(value: string| { delay?: number, name?: string }) { this._setOption('hideEvent', value); } /** * Specifies text for a hint that appears when a user pauses on the widget. */ @Input() get hint(): string { return this._getOption('hint'); } set hint(value: string) { this._setOption('hint', value); } /** * Specifies whether the widget changes its state when a user pauses on it. */ @Input() get hoverStateEnabled(): boolean { return this._getOption('hoverStateEnabled'); } set hoverStateEnabled(value: boolean) { this._setOption('hoverStateEnabled', value); } /** * Specifies the maximum height the widget can reach while resizing. */ @Input() get maxHeight(): number| Function| string { return this._getOption('maxHeight'); } set maxHeight(value: number| Function| string) { this._setOption('maxHeight', value); } /** * Specifies the maximum width the widget can reach while resizing. */ @Input() get maxWidth(): number| Function| string { return this._getOption('maxWidth'); } set maxWidth(value: number| Function| string) { this._setOption('maxWidth', value); } /** * Specifies the minimum height the widget can reach while resizing. */ @Input() get minHeight(): number| Function| string { return this._getOption('minHeight'); } set minHeight(value: number| Function| string) { this._setOption('minHeight', value); } /** * Specifies the minimum width the widget can reach while resizing. */ @Input() get minWidth(): number| Function| string { return this._getOption('minWidth'); } set minWidth(value: number| Function| string) { this._setOption('minWidth', value); } /** * An object defining widget positioning options. */ @Input() get position(): DevExpress.positionConfig| string { return this._getOption('position'); } set position(value: DevExpress.positionConfig| string) { this._setOption('position', 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); } /** * A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ @Input() get shading(): boolean { return this._getOption('shading'); } set shading(value: boolean) { this._setOption('shading', value); } /** * Specifies the shading color. */ @Input() get shadingColor(): string { return this._getOption('shadingColor'); } set shadingColor(value: string) { this._setOption('shadingColor', value); } /** * Specifies options for displaying the widget. */ @Input() get showEvent(): string| { delay?: number, name?: string } { return this._getOption('showEvent'); } set showEvent(value: string| { delay?: number, name?: string }) { this._setOption('showEvent', value); } /** * The target element associated with a popover. */ @Input() get target(): Element| JQuery { return this._getOption('target'); } set target(value: Element| JQuery) { this._setOption('target', value); } /** * A Boolean value specifying whether or not the widget is visible. */ @Input() get visible(): boolean { return this._getOption('visible'); } set visible(value: boolean) { this._setOption('visible', value); } /** * Specifies the widget's width. */ @Input() get width(): number| Function| string { return this._getOption('width'); } set width(value: number| Function| string) { this._setOption('width', value); } /** * A handler for the contentReady event. Executed when the widget's content is ready. This handler may be executed multiple times during the widget's lifetime depending on the number of times its content changes. */ @Output() onContentReady: EventEmitter; /** * 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 hidden event. */ @Output() onHidden: EventEmitter; /** * A handler for the hiding event. */ @Output() onHiding: 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 showing event. */ @Output() onShowing: EventEmitter; /** * A handler for the shown event. */ @Output() onShown: EventEmitter; /** * A handler for the animationChange event. */ @Output() animationChange: EventEmitter; /** * A handler for the buttonsChange event. */ @Output() buttonsChange: EventEmitter>; /** * A handler for the closeOnBackButtonChange event. */ @Output() closeOnBackButtonChange: EventEmitter; /** * A handler for the closeOnOutsideClickChange event. */ @Output() closeOnOutsideClickChange: EventEmitter; /** * A handler for the contentTemplateChange event. */ @Output() contentTemplateChange: EventEmitter; /** * A handler for the deferRenderingChange event. */ @Output() deferRenderingChange: EventEmitter; /** * A handler for the disabledChange event. */ @Output() disabledChange: EventEmitter; /** * A handler for the elementAttrChange event. */ @Output() elementAttrChange: EventEmitter; /** * A handler for the heightChange event. */ @Output() heightChange: EventEmitter; /** * A handler for the hideEventChange event. */ @Output() hideEventChange: EventEmitter; /** * A handler for the hintChange event. */ @Output() hintChange: EventEmitter; /** * A handler for the hoverStateEnabledChange event. */ @Output() hoverStateEnabledChange: EventEmitter; /** * A handler for the maxHeightChange event. */ @Output() maxHeightChange: EventEmitter; /** * A handler for the maxWidthChange event. */ @Output() maxWidthChange: EventEmitter; /** * A handler for the minHeightChange event. */ @Output() minHeightChange: EventEmitter; /** * A handler for the minWidthChange event. */ @Output() minWidthChange: EventEmitter; /** * A handler for the positionChange event. */ @Output() positionChange: EventEmitter; /** * A handler for the rtlEnabledChange event. */ @Output() rtlEnabledChange: EventEmitter; /** * A handler for the shadingChange event. */ @Output() shadingChange: EventEmitter; /** * A handler for the shadingColorChange event. */ @Output() shadingColorChange: EventEmitter; /** * A handler for the showEventChange event. */ @Output() showEventChange: EventEmitter; /** * A handler for the targetChange event. */ @Output() targetChange: EventEmitter; /** * A handler for the visibleChange event. */ @Output() visibleChange: EventEmitter; /** * A handler for the widthChange event. */ @Output() widthChange: 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: 'contentReady', emit: 'onContentReady' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'hidden', emit: 'onHidden' }, { subscribe: 'hiding', emit: 'onHiding' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'showing', emit: 'onShowing' }, { subscribe: 'shown', emit: 'onShown' }, { emit: 'animationChange' }, { emit: 'buttonsChange' }, { emit: 'closeOnBackButtonChange' }, { emit: 'closeOnOutsideClickChange' }, { emit: 'contentTemplateChange' }, { emit: 'deferRenderingChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'heightChange' }, { emit: 'hideEventChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'maxHeightChange' }, { emit: 'maxWidthChange' }, { emit: 'minHeightChange' }, { emit: 'minWidthChange' }, { emit: 'positionChange' }, { emit: 'rtlEnabledChange' }, { emit: 'shadingChange' }, { emit: 'shadingColorChange' }, { emit: 'showEventChange' }, { emit: 'targetChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); this._idh.setHost(this); optionHost.setHost(this); } protected _createInstance(element, options) { return new DxTooltip(element, options); } ngOnDestroy() { this._destroyWidget(); } ngOnChanges(changes: SimpleChanges) { super.ngOnChanges(changes); this.setupChanges('buttons', changes); } setupChanges(prop: string, changes: SimpleChanges) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } } ngDoCheck() { this._idh.doCheck('buttons'); 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, DxoHideModule, DxoShowModule, DxoHideEventModule, DxoPositionModule, DxoAtModule, DxoBoundaryOffsetModule, DxoCollisionModule, DxoMyModule, DxoOffsetModule, DxoShowEventModule, DxTemplateModule ], declarations: [ DxTooltipComponent ], exports: [ DxTooltipComponent, DxoAnimationModule, DxoHideModule, DxoShowModule, DxoHideEventModule, DxoPositionModule, DxoAtModule, DxoBoundaryOffsetModule, DxoCollisionModule, DxoMyModule, DxoOffsetModule, DxoShowEventModule, DxTemplateModule ], providers: [EventsRegistrator] }) export class DxTooltipModule { }