import * as tslib_1 from "tslib";
import * as React from 'react';
import { TimeAxisIntervalType_$type } from "./TimeAxisIntervalType";
import { TimeAxisInterval } from "./TimeAxisInterval";
import { getModifiedProps, isValidProp, ensureEnum } from "igniteui-react-core/ES5/componentUtil";
/**
 * Settings for an interval on a time axis.
 * Label intervals can be applied to a time axis, which are dynamic, according to the visible range.  During zooming, the visible range of the axis can change, and so a different interval is selected.  The interval selected will be the one with the largest range smaller than the visible range of the axis.
*
* The `IgrTimeAxisInterval` is used for settings the interval on a time axis.
*
* ```ts
*   <IgrDataChart
*     dataSource={this.state.dataSource}
*     width="700px"
*     height="500px">
*     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
* 			dateTimeMemberPath="Date" />
*  </IgrDataChart>
* ```
*
* ```ts
*   <IgrDataChart
*     dataSource={this.state.dataSource}
*     width="700px"
*     height="500px">
*     <IgrTimeXAxis name="xAxis" label="Date"
* 			dateTimeMemberPath="Date" >
*
*  </IgrTimeXAxis>
*  </IgrDataChart>
* ```
*/
var IgrTimeAxisInterval = /** @class */ (function (_super) {
    tslib_1.__extends(IgrTimeAxisInterval, _super);
    function IgrTimeAxisInterval(props) {
        var _this = _super.call(this, props) || this;
        _this._hasUserValues = new Set();
        _this._implementation = _this.createImplementation();
        _this._implementation.externalObject = _this;
        _this.onImplementationCreated();
        return _this;
    }
    IgrTimeAxisInterval.prototype.createImplementation = function () {
        return new TimeAxisInterval();
    };
    Object.defineProperty(IgrTimeAxisInterval.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgrTimeAxisInterval.prototype.onImplementationCreated = function () {
    };
    Object.defineProperty(IgrTimeAxisInterval.prototype, "hasUserValues", {
        get: function () {
            return this._hasUserValues;
        },
        enumerable: true,
        configurable: true
    });
    IgrTimeAxisInterval.prototype.componentDidMount = function () {
        var e_1, _a;
        try {
            for (var _b = tslib_1.__values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var p = _c.value;
                if (isValidProp(this, p)) {
                    this._hasUserValues.add(p);
                    this[p] = this.props[p];
                }
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    IgrTimeAxisInterval.prototype.shouldComponentUpdate = function (nextProps, nextState) {
        var e_2, _a;
        var mod = getModifiedProps(this.props, nextProps);
        try {
            for (var _b = tslib_1.__values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var p = _c.value;
                if (isValidProp(this, p)) {
                    this._hasUserValues.add(p);
                    this[p] = mod[p];
                }
            }
        }
        catch (e_2_1) { e_2 = { error: e_2_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_2) throw e_2.error; }
        }
        return true;
    };
    IgrTimeAxisInterval.prototype.render = function () {
        return null;
    };
    Object.defineProperty(IgrTimeAxisInterval.prototype, "range", {
        /**
         * The visible axis range at which to apply this interval.
        *
        * Use `range` property for the visible axis range at which to apply this interval.
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" />
        *  </IgrDataChart>
        * ```
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" >
        *
        *  </IgrTimeXAxis>
        *  </IgrDataChart>
        * ```
        */
        get: function () {
            return this.i.k;
        },
        set: function (v) {
            this.i.k = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeAxisInterval.prototype, "interval", {
        /**
         * The interval, expressed as a multiple of IntervalType.
        *
        * Use the `interval` property expressed as a multiple of IntervalType.
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" />
        *  </IgrDataChart>
        * ```
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" >
        *
        *  </IgrTimeXAxis>
        *  </IgrDataChart>
        * ```
        */
        get: function () {
            return this.i.f;
        },
        set: function (v) {
            this.i.f = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeAxisInterval.prototype, "intervalType", {
        /**
         * The unit of time for this interval.
        *
        * The `intervalType` is the unit of time for this interval.
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" />
        *  </IgrDataChart>
        * ```
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" >
        *
        *  </IgrTimeXAxis>
        *  </IgrDataChart>
        * ```
        */
        get: function () {
            return this.i.b;
        },
        set: function (v) {
            this.i.b = ensureEnum(TimeAxisIntervalType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    return IgrTimeAxisInterval;
}(React.Component));
export { IgrTimeAxisInterval };
