import * as tslib_1 from "tslib";
import { EventEmitter, Output, Component, forwardRef, ChangeDetectionStrategy } from '@angular/core';
import { IgxStrategyBasedIndicatorComponent } from './igx-strategy-based-indicator-component';
import { IgxFinancialIndicatorComponent } from './igx-financial-indicator-component';
import { IgxFinancialSeriesComponent } from './igx-financial-series-component';
import { IgxSeriesComponent } from './igx-series-component';
import { CustomIndicator } from "./CustomIndicator";
import { FinancialEventArgs } from "./igx-financial-event-args";
import { delegateCombine } from "igniteui-angular-core/ES5/type";
export var IgxCustomIndicatorComponent_PROVIDERS = [{ provide: IgxStrategyBasedIndicatorComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent; }) }, { provide: IgxFinancialIndicatorComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent; }) }, { provide: IgxFinancialSeriesComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent; }) }, { provide: IgxSeriesComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent; }) }];
/**
 * Represents a IgxDataChartComponent Custom Indicator series.
 * The indicator value is calculated in the user specified Indicator event handler.
*
* `IgxCustomIndicatorComponent` class specify the series as Custom Indicator series.
*
* ```html
* <igx-data-chart [dataSource]="data">
*   <igx-category-x-axis #xAxis
*     label="time">
*   </igx-category-x-axis>
*   <igx-numeric-y-axis #yAxis>
*   </igx-numeric-y-axis>
*   <igx-commodity-channel-index-indicator
*     [xAxis]="xAxis"
*     [yAxis]="yAxis"
*     openMemberPath="open"
*     highMemberPath="high"
*     lowMemberPath="low"
*     closeMemberPath="close"
*     volumeMemberPath="volume" >
*   </igx-commodity-channel-index-indicator>
* </igx-data-chart>
* ```
*
* ```ts
* let series = new IgxCustomIndicatorComponent();
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.openMemberPath = "open";
* series.highMemberPath = "high";
* series.lowMemberPath = "low";
* series.closeMemberPath = "close";
* this.chart.series.add(series);
* ```
*/
var IgxCustomIndicatorComponent = /** @class */ (function (_super) {
    tslib_1.__extends(IgxCustomIndicatorComponent, _super);
    function IgxCustomIndicatorComponent() {
        var _this = _super.call(this) || this;
        _this._indicator = null;
        _this._basedOnColumns = null;
        return _this;
    }
    IgxCustomIndicatorComponent_1 = IgxCustomIndicatorComponent;
    IgxCustomIndicatorComponent.prototype.createImplementation = function () {
        return new CustomIndicator();
    };
    Object.defineProperty(IgxCustomIndicatorComponent.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxCustomIndicatorComponent.prototype, "indicator", {
        /**
         * This event is raised when the indicator values need to be computed.
        */
        get: function () {
            var _this = this;
            if (this._indicator == null) {
                this._indicator = new EventEmitter();
                this.i.indicator = delegateCombine(this.i.indicator, function (o, e) {
                    var outerArgs = new FinancialEventArgs();
                    outerArgs._provideImplementation(e);
                    _this._indicator.emit({
                        sender: _this,
                        args: outerArgs
                    });
                });
            }
            return this._indicator;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxCustomIndicatorComponent.prototype, "basedOnColumns", {
        /**
         * This event is raised when the based on columns to be specified.
        */
        get: function () {
            var _this = this;
            if (this._basedOnColumns == null) {
                this._basedOnColumns = new EventEmitter();
                this.i.basedOnColumns = delegateCombine(this.i.indicator, function (o, e) {
                    var outerArgs = new FinancialEventArgs();
                    outerArgs._provideImplementation(e);
                    _this._basedOnColumns.emit({
                        sender: _this,
                        args: outerArgs
                    });
                });
            }
            return this._indicator;
        },
        enumerable: true,
        configurable: true
    });
    var IgxCustomIndicatorComponent_1;
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter),
        tslib_1.__metadata("design:paramtypes", [])
    ], IgxCustomIndicatorComponent.prototype, "indicator", null);
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter),
        tslib_1.__metadata("design:paramtypes", [])
    ], IgxCustomIndicatorComponent.prototype, "basedOnColumns", null);
    IgxCustomIndicatorComponent = IgxCustomIndicatorComponent_1 = tslib_1.__decorate([
        Component({
            selector: 'igx-custom-indicator',
            template: "",
            providers: [{ provide: IgxStrategyBasedIndicatorComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent_1; }) }, { provide: IgxFinancialIndicatorComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent_1; }) }, { provide: IgxFinancialSeriesComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent_1; }) }, { provide: IgxSeriesComponent, useExisting: forwardRef(function () { return IgxCustomIndicatorComponent_1; }) }],
            changeDetection: ChangeDetectionStrategy.OnPush
        }),
        tslib_1.__metadata("design:paramtypes", [])
    ], IgxCustomIndicatorComponent);
    return IgxCustomIndicatorComponent;
}(IgxStrategyBasedIndicatorComponent));
export { IgxCustomIndicatorComponent };
//# sourceMappingURL=igx-custom-indicator-component.js.map