/*! * 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 } from '@angular/core'; import DevExpress from 'devextreme/bundles/dx.all'; import DxToast from 'devextreme/ui/toast'; 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 { DxoAnimationModule } from './nested/animation'; import { DxoHideModule } from './nested/hide'; import { DxoShowModule } from './nested/show'; 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'; /** * The Toast is a widget that provides pop-up notifications. */ @Component({ selector: 'dx-toast', template: '', providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost ] }) export class DxToastComponent extends DxComponent implements OnDestroy { instance: DxToast; /** * Specifies the shortcut key that sets focus on the widget. */ @Input() get accessKey(): string { return this._getOption('accessKey'); } set accessKey(value: string) { this._setOption('accessKey', value); } /** * 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); } /** * 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 toast is closed if a user clicks it. */ @Input() get closeOnClick(): boolean { return this._getOption('closeOnClick'); } set closeOnClick(value: boolean) { this._setOption('closeOnClick', value); } /** * A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ @Input() get closeOnOutsideClick(): boolean| Function { return this._getOption('closeOnOutsideClick'); } set closeOnOutsideClick(value: boolean| Function) { this._setOption('closeOnOutsideClick', value); } /** * A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ @Input() get closeOnSwipe(): boolean { return this._getOption('closeOnSwipe'); } set closeOnSwipe(value: boolean) { this._setOption('closeOnSwipe', 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); } /** * The time span in milliseconds during which the Toast widget is visible. */ @Input() get displayTime(): number { return this._getOption('displayTime'); } set displayTime(value: number) { this._setOption('displayTime', 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 whether the widget can be focused using keyboard navigation. */ @Input() get focusStateEnabled(): boolean { return this._getOption('focusStateEnabled'); } set focusStateEnabled(value: boolean) { this._setOption('focusStateEnabled', value); } /** * The height of the widget in pixels. */ @Input() get height(): number| Function| string { return this._getOption('height'); } set height(value: number| Function| string) { this._setOption('height', 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); } /** * The Toast message text. */ @Input() get message(): string { return this._getOption('message'); } set message(value: string) { this._setOption('message', 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 the number of the element when the Tab key is used for navigating. */ @Input() get tabIndex(): number { return this._getOption('tabIndex'); } set tabIndex(value: number) { this._setOption('tabIndex', value); } /** * Specifies the Toast widget type. */ @Input() get type(): string { return this._getOption('type'); } set type(value: string) { this._setOption('type', 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); } /** * The widget width in pixels. */ @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 accessKeyChange event. */ @Output() accessKeyChange: EventEmitter; /** * A handler for the animationChange event. */ @Output() animationChange: EventEmitter; /** * A handler for the closeOnBackButtonChange event. */ @Output() closeOnBackButtonChange: EventEmitter; /** * A handler for the closeOnClickChange event. */ @Output() closeOnClickChange: EventEmitter; /** * A handler for the closeOnOutsideClickChange event. */ @Output() closeOnOutsideClickChange: EventEmitter; /** * A handler for the closeOnSwipeChange event. */ @Output() closeOnSwipeChange: EventEmitter; /** * A handler for the contentTemplateChange event. */ @Output() contentTemplateChange: EventEmitter; /** * A handler for the deferRenderingChange event. */ @Output() deferRenderingChange: EventEmitter; /** * A handler for the displayTimeChange event. */ @Output() displayTimeChange: EventEmitter; /** * A handler for the elementAttrChange event. */ @Output() elementAttrChange: EventEmitter; /** * A handler for the focusStateEnabledChange event. */ @Output() focusStateEnabledChange: EventEmitter; /** * A handler for the heightChange event. */ @Output() heightChange: 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 messageChange event. */ @Output() messageChange: 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 tabIndexChange event. */ @Output() tabIndexChange: EventEmitter; /** * A handler for the typeChange event. */ @Output() typeChange: 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, _watcherHelper: WatcherHelper, 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: 'accessKeyChange' }, { emit: 'animationChange' }, { emit: 'closeOnBackButtonChange' }, { emit: 'closeOnClickChange' }, { emit: 'closeOnOutsideClickChange' }, { emit: 'closeOnSwipeChange' }, { emit: 'contentTemplateChange' }, { emit: 'deferRenderingChange' }, { emit: 'displayTimeChange' }, { emit: 'elementAttrChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'maxHeightChange' }, { emit: 'maxWidthChange' }, { emit: 'messageChange' }, { emit: 'minHeightChange' }, { emit: 'minWidthChange' }, { emit: 'positionChange' }, { emit: 'rtlEnabledChange' }, { emit: 'shadingChange' }, { emit: 'shadingColorChange' }, { emit: 'tabIndexChange' }, { emit: 'typeChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); optionHost.setHost(this); } protected _createInstance(element, options) { return new DxToast(element, options); } ngOnDestroy() { this._destroyWidget(); } } @NgModule({ imports: [ DxoAnimationModule, DxoHideModule, DxoShowModule, DxoPositionModule, DxoAtModule, DxoBoundaryOffsetModule, DxoCollisionModule, DxoMyModule, DxoOffsetModule, DxTemplateModule ], declarations: [ DxToastComponent ], exports: [ DxToastComponent, DxoAnimationModule, DxoHideModule, DxoShowModule, DxoPositionModule, DxoAtModule, DxoBoundaryOffsetModule, DxoCollisionModule, DxoMyModule, DxoOffsetModule, DxTemplateModule ], providers: [EventsRegistrator] }) export class DxToastModule { }