import * as tslib_1 from "tslib";
import * as React from 'react';
import { TimeAxisLabelFormat } from "./TimeAxisLabelFormat";
import { getModifiedProps, isValidProp } from "igniteui-react-core/ES5/componentUtil";
/**
 * Settings for a label format on a time axis.
 * Label formats 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 label format is selected.  The label format selected will be the one with the largest range smaller than the visible range of the axis.
*
* The `IgrTimeAxisLabelFormat` provide the settings for a label format on a time axis.
*
* ```ts
* let labelFormat = new TimeAxisLabelFormat();
* labelFormat.format = "hh:mm:ss";
* labelFormat.range = 1000;
* this.xAxis.labelFormats.add(labelFormat);
* labelFormat = new TimeAxisLabelFormat();
* labelFormat.format = "hh:mm";
* labelFormat.range = 60 * 1000;
* this.xAxis.labelFormats.add(labelFormat);
* labelFormat = new TimeAxisLabelFormat();
* labelFormat.format = "MMM-dd-yy";
* labelFormat.range = 24 * 60 * 60 * 1000;
* this.xAxis.labelFormats.add(labelFormat);
* labelFormat = new TimeAxisLabelFormat();
* labelFormat.format = "MMM yy";
* labelFormat.range = 365.24 * 24 * 60 * 60 * 1000;
* this.xAxis.labelFormats.add(labelFormat);
* labelFormat = new TimeAxisLabelFormat();
* labelFormat.format = "yyyy";
* labelFormat.range = 5 * 365 * 24 * 60 * 60 * 1000;
* this.xAxis.labelFormats.add(labelFormat);
* ```
*
* ```ts
*   <IgrDataChart
*     dataSource={this.state.dataSource}
*     width="700px"
*     height="500px">
*     <IgrTimeXAxis name="xAxis" label="Date"
* 			dateTimeMemberPath="Date" >
*
*  </IgrTimeXAxis>
*  </IgrDataChart>
* ```
*/
var IgrTimeAxisLabelFormat = /** @class */ (function (_super) {
    tslib_1.__extends(IgrTimeAxisLabelFormat, _super);
    function IgrTimeAxisLabelFormat(props) {
        var _this = _super.call(this, props) || this;
        _this._hasUserValues = new Set();
        _this._implementation = _this.createImplementation();
        _this._implementation.externalObject = _this;
        _this.onImplementationCreated();
        return _this;
    }
    IgrTimeAxisLabelFormat.prototype.createImplementation = function () {
        return new TimeAxisLabelFormat();
    };
    Object.defineProperty(IgrTimeAxisLabelFormat.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgrTimeAxisLabelFormat.prototype.onImplementationCreated = function () {
    };
    Object.defineProperty(IgrTimeAxisLabelFormat.prototype, "hasUserValues", {
        get: function () {
            return this._hasUserValues;
        },
        enumerable: true,
        configurable: true
    });
    IgrTimeAxisLabelFormat.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; }
        }
    };
    IgrTimeAxisLabelFormat.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;
    };
    IgrTimeAxisLabelFormat.prototype.render = function () {
        return null;
    };
    Object.defineProperty(IgrTimeAxisLabelFormat.prototype, "range", {
        /**
         * The visible axis range at which to apply this label format.
        *
        * The `range` property provide the visible axis range at which to apply this label format.
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date"/>
        * 	</IgrDataChart>
        * ```
        *
        * ```ts
        * let labelFormat = new TimeAxisLabelFormat();
        * labelFormat.format = "hh:mm:ss";
        * labelFormat.range = 1000;
        * this.xAxis.labelFormats.add(labelFormat);
        * labelFormat = new TimeAxisLabelFormat();
        * labelFormat.format = "hh:mm";
        * labelFormat.range = 60 * 1000;
        * this.xAxis.labelFormats.add(labelFormat);
        * labelFormat = new TimeAxisLabelFormat();
        * labelFormat.format = "MMM-dd-yy";
        * labelFormat.range = 24 * 60 * 60 * 1000;
        * this.xAxis.labelFormats.add(labelFormat);
        * ```
        */
        get: function () {
            return this.i.f;
        },
        set: function (v) {
            this.i.f = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeAxisLabelFormat.prototype, "format", {
        /**
         * The DateTime format string to apply.
         * Some common DateTime format strings are: yyyy, MM/dd/yy, and hh:mm:ss.
        *
        * The `format` property provide the DateTime format string to apply.
        *
        * ```ts
        * let labelFormat = new TimeAxisLabelFormat();
        * labelFormat.format = "hh:mm:ss";
        * labelFormat.range = 1000;
        * this.xAxis.labelFormats.add(labelFormat);
        * labelFormat = new TimeAxisLabelFormat();
        * labelFormat.format = "hh:mm";
        * labelFormat.range = 60 * 1000;
        * this.xAxis.labelFormats.add(labelFormat);
        * labelFormat = new TimeAxisLabelFormat();
        * labelFormat.format = "MMM-dd-yy";
        * labelFormat.range = 24 * 60 * 60 * 1000;
        * this.xAxis.labelFormats.add(labelFormat);
        * ```
        *
        * ```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 = v;
        },
        enumerable: true,
        configurable: true
    });
    return IgrTimeAxisLabelFormat;
}(React.Component));
export { IgrTimeAxisLabelFormat };
