import * as tslib_1 from "tslib";
import { Component, forwardRef, Input, ChangeDetectionStrategy } from '@angular/core';
import { IgxTimeAxisBreakCollection } from "./igx-time-axis-break-collection";
import { IgxTimeAxisLabelFormatCollection } from "./igx-time-axis-label-format-collection";
import { IgxTimeAxisIntervalCollection } from "./igx-time-axis-interval-collection";
import { IgxTimeAxisBaseComponent } from "./igx-time-axis-base-component";
import { IgxCategoryAxisBaseComponent } from "./igx-category-axis-base-component";
import { IgxAxisComponent } from "./igx-axis-component";
import { TimeXAxis } from "./TimeXAxis";
import { TimeAxisBreakCollection as TimeAxisBreakCollection_internal } from "./TimeAxisBreakCollection";
import { TimeAxisBreak } from "./TimeAxisBreak";
import { SyncableObservableCollection$1 } from "igniteui-angular-core";
import { TimeAxisLabelFormatCollection as TimeAxisLabelFormatCollection_internal } from "./TimeAxisLabelFormatCollection";
import { TimeAxisLabelFormat } from "./TimeAxisLabelFormat";
import { TimeAxisIntervalCollection as TimeAxisIntervalCollection_internal } from "./TimeAxisIntervalCollection";
import { TimeAxisInterval } from "./TimeAxisInterval";
/**
 * A horizontal axis that uses a DateTime scale.
*
* The `IgxTimeXAxisComponent` is a horizontal axis that uses a DateTime scale.
*
* ```html
* <igx-data-chart
*     [dataSource]="data">
*     <igx-time-x-axis
* 		dateTimeMemberPath="date"
* 		#xAxis>
*     </igx-time-x-axis>
* </igx-data-chart>
* ```
*
* ```ts
* let xAxis = new IgxTimeXAxisComponent();
* xAxis.dataTimeMemberPath="date";
* this.chart.axes.add(xAxis);
* ```
*/
export var IgxTimeXAxisComponent_PROVIDERS = [{ provide: IgxTimeAxisBaseComponent, useExisting: forwardRef(function () { return IgxTimeXAxisComponent; }) }, { provide: IgxCategoryAxisBaseComponent, useExisting: forwardRef(function () { return IgxTimeXAxisComponent; }) }, { provide: IgxAxisComponent, useExisting: forwardRef(function () { return IgxTimeXAxisComponent; }) }];
var IgxTimeXAxisComponent = /** @class */ (function (_super) {
    tslib_1.__extends(IgxTimeXAxisComponent, _super);
    function IgxTimeXAxisComponent() {
        var _this = _super.call(this) || this;
        _this._breaks = null;
        _this._labelFormats = null;
        _this._intervals = null;
        return _this;
    }
    IgxTimeXAxisComponent_1 = IgxTimeXAxisComponent;
    IgxTimeXAxisComponent.prototype.createImplementation = function () {
        return new TimeXAxis();
    };
    Object.defineProperty(IgxTimeXAxisComponent.prototype, "i", {
        /**
                                     * @hidden
                                     */
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxTimeXAxisComponent.prototype, "isPiecewise", {
        get: function () {
            return this.i.cb;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxTimeXAxisComponent.prototype, "breaks", {
        /**
         * TimeAxisBreaks to apply to this axis, representing spans of time to omit, such as weekends.
        *
        * The `breaks` to apply to this axis, representing spans of time to omit, such as weekends.
        *
        * ```html
        * <igx-data-chart
        *     [dataSource]="data">
        *     <igx-time-x-axis
        * 		dateTimeMemberPath="date"
        * 		#xAxis>
        *     </igx-time-x-axis>
        * </igx-data-chart>
        * ```
        *
        * ```ts
        * let xAxis = new IgxTimeXAxisComponent();
        * xAxis.dataTimeMemberPath="date";
        * this.chart.axes.add(xAxis);
        * ```
        */
        get: function () {
            if (this._breaks === null) {
                var coll = new IgxTimeAxisBreakCollection();
                var innerColl = this.i.breaks;
                if (!innerColl) {
                    innerColl = new TimeAxisBreakCollection_internal();
                }
                this._breaks = coll._fromInner(innerColl);
            }
            return this._breaks;
        },
        set: function (v) {
            if (this._breaks !== null) {
                this._breaks._setSyncTarget(null);
                this._breaks = null;
            }
            var coll = new IgxTimeAxisBreakCollection();
            this._breaks = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(TimeAxisBreak.$type);
            var innerColl = this.i.breaks;
            if (!innerColl) {
                innerColl = new TimeAxisBreakCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._breaks._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxTimeXAxisComponent.prototype, "labelFormats", {
        /**
         * A list of axis label formats to apply, which are selected according to the visible axis range.
         * The label format selected will be the one with the largest range smaller than the visible range of the axis.
        */
        get: function () {
            if (this._labelFormats === null) {
                var coll = new IgxTimeAxisLabelFormatCollection();
                var innerColl = this.i.labelFormats;
                if (!innerColl) {
                    innerColl = new TimeAxisLabelFormatCollection_internal();
                }
                this._labelFormats = coll._fromInner(innerColl);
            }
            return this._labelFormats;
        },
        set: function (v) {
            if (this._labelFormats !== null) {
                this._labelFormats._setSyncTarget(null);
                this._labelFormats = null;
            }
            var coll = new IgxTimeAxisLabelFormatCollection();
            this._labelFormats = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(TimeAxisLabelFormat.$type);
            var innerColl = this.i.labelFormats;
            if (!innerColl) {
                innerColl = new TimeAxisLabelFormatCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._labelFormats._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxTimeXAxisComponent.prototype, "intervals", {
        /**
         * A list of axis label intervals to apply, which are selected according to the visible axis range.
         * The interval selected will be the one with the largest range smaller than the visible range of the axis.
        */
        get: function () {
            if (this._intervals === null) {
                var coll = new IgxTimeAxisIntervalCollection();
                var innerColl = this.i.intervals;
                if (!innerColl) {
                    innerColl = new TimeAxisIntervalCollection_internal();
                }
                this._intervals = coll._fromInner(innerColl);
            }
            return this._intervals;
        },
        set: function (v) {
            if (this._intervals !== null) {
                this._intervals._setSyncTarget(null);
                this._intervals = null;
            }
            var coll = new IgxTimeAxisIntervalCollection();
            this._intervals = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(TimeAxisInterval.$type);
            var innerColl = this.i.intervals;
            if (!innerColl) {
                innerColl = new TimeAxisIntervalCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._intervals._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxTimeXAxisComponent.prototype, "isCategoryDateTime", {
        /**
         * Gets if the current axis is of category date time axis type
        */
        get: function () {
            return this.i.b3;
        },
        enumerable: true,
        configurable: true
    });
    IgxTimeXAxisComponent.prototype.getValueLabel = function (value) {
        var iv = this.i.fj(value);
        return (iv);
    };
    /**
     * Gets the index of the data item with the value nearest the given value.
    
    * @param unscaledValue  * The value to find a value close to.
    */
    IgxTimeXAxisComponent.prototype.getIndexClosestToUnscaledValue = function (unscaledValue) {
        var iv = this.i.i$f(unscaledValue);
        return (iv);
    };
    var IgxTimeXAxisComponent_1;
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", IgxTimeAxisBreakCollection),
        tslib_1.__metadata("design:paramtypes", [IgxTimeAxisBreakCollection])
    ], IgxTimeXAxisComponent.prototype, "breaks", null);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", IgxTimeAxisLabelFormatCollection),
        tslib_1.__metadata("design:paramtypes", [IgxTimeAxisLabelFormatCollection])
    ], IgxTimeXAxisComponent.prototype, "labelFormats", null);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", IgxTimeAxisIntervalCollection),
        tslib_1.__metadata("design:paramtypes", [IgxTimeAxisIntervalCollection])
    ], IgxTimeXAxisComponent.prototype, "intervals", null);
    IgxTimeXAxisComponent = IgxTimeXAxisComponent_1 = tslib_1.__decorate([
        Component({
            selector: 'igx-time-x-axis',
            template: "",
            providers: [{ provide: IgxTimeAxisBaseComponent, useExisting: forwardRef(function () { return IgxTimeXAxisComponent_1; }) }, { provide: IgxCategoryAxisBaseComponent, useExisting: forwardRef(function () { return IgxTimeXAxisComponent_1; }) }, { provide: IgxAxisComponent, useExisting: forwardRef(function () { return IgxTimeXAxisComponent_1; }) }],
            changeDetection: ChangeDetectionStrategy.OnPush
        }),
        tslib_1.__metadata("design:paramtypes", [])
    ], IgxTimeXAxisComponent);
    return IgxTimeXAxisComponent;
}(IgxTimeAxisBaseComponent));
export { IgxTimeXAxisComponent };
//# sourceMappingURL=igx-time-x-axis-component.js.map