import * as tslib_1 from "tslib";
import * as React from 'react';
import { delegateCombine, delegateRemove } from "igniteui-react-core/ES5/type";
import { LegendMouseButtonEventArgs } from "./igr-legend-mouse-button-event-args";
import { LegendMouseEventArgs } from "./igr-legend-mouse-event-args";
import { getModifiedProps, isValidProp } from "igniteui-react-core/ES5/componentUtil";
/**
 * Represents the base class for a legend in IgxDataChartComponent.
*/
var IgrLegendBase = /** @class */ (function (_super) {
    tslib_1.__extends(IgrLegendBase, _super);
    function IgrLegendBase(props) {
        var _this = _super.call(this, props) || this;
        _this._legendItemMouseLeftButtonDown = null;
        _this._legendItemMouseLeftButtonDown_wrapped = null;
        _this._legendItemMouseLeftButtonUp = null;
        _this._legendItemMouseLeftButtonUp_wrapped = null;
        _this._legendItemMouseEnter = null;
        _this._legendItemMouseEnter_wrapped = null;
        _this._legendItemMouseLeave = null;
        _this._legendItemMouseLeave_wrapped = null;
        _this._legendItemMouseMove = null;
        _this._legendItemMouseMove_wrapped = null;
        _this._implementation = _this.createImplementation();
        _this._implementation.externalObject = _this;
        _this.onImplementationCreated();
        return _this;
    }
    IgrLegendBase.prototype.createImplementation = function () {
        return null;
    };
    Object.defineProperty(IgrLegendBase.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgrLegendBase.prototype.onImplementationCreated = function () {
    };
    IgrLegendBase.prototype.componentDidMount = function () {
        try {
            for (var _a = tslib_1.__values(Object.keys(this.props)), _b = _a.next(); !_b.done; _b = _a.next()) {
                var p = _b.value;
                if (isValidProp(this, p)) {
                    this[p] = this.props[p];
                }
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
            }
            finally { if (e_1) throw e_1.error; }
        }
        var e_1, _c;
    };
    IgrLegendBase.prototype.shouldComponentUpdate = function (nextProps, nextState) {
        var mod = getModifiedProps(this.props, nextProps);
        try {
            for (var _a = tslib_1.__values(Object.keys(mod)), _b = _a.next(); !_b.done; _b = _a.next()) {
                var p = _b.value;
                if (isValidProp(this, p)) {
                    this[p] = mod[p];
                }
            }
        }
        catch (e_2_1) { e_2 = { error: e_2_1 }; }
        finally {
            try {
                if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
            }
            finally { if (e_2) throw e_2.error; }
        }
        return true;
        var e_2, _c;
    };
    IgrLegendBase.prototype.render = function () {
        return null;
    };
    Object.defineProperty(IgrLegendBase.prototype, "legendItemMouseLeftButtonDown", {
        /**
         * Event raised when the left mouse button is pressed while the mouse pointer is over a legend item
         * in this Legend.
        */
        get: function () {
            return this._legendItemMouseLeftButtonDown;
        },
        set: function (ev) {
            var _this = this;
            if (this._legendItemMouseLeftButtonDown !== null) {
                this.i.legendItemMouseLeftButtonDown = delegateRemove(this.i.legendItemMouseLeftButtonDown, this._legendItemMouseLeftButtonDown_wrapped);
                this._legendItemMouseLeftButtonDown_wrapped = null;
                this._legendItemMouseLeftButtonDown = null;
            }
            this._legendItemMouseLeftButtonDown = ev;
            this._legendItemMouseLeftButtonDown_wrapped = function (o, e) {
                var outerArgs = new LegendMouseButtonEventArgs();
                outerArgs._provideImplementation(e);
                _this._legendItemMouseLeftButtonDown(_this, outerArgs);
            };
            this.i.legendItemMouseLeftButtonDown = delegateCombine(this.i.legendItemMouseLeftButtonDown, this._legendItemMouseLeftButtonDown_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrLegendBase.prototype, "legendItemMouseLeftButtonUp", {
        /**
         * Event raised when the left mouse button is released while the mouse pointer is over a legend item
         * in this Legend.
        */
        get: function () {
            return this._legendItemMouseLeftButtonUp;
        },
        set: function (ev) {
            var _this = this;
            if (this._legendItemMouseLeftButtonUp !== null) {
                this.i.legendItemMouseLeftButtonUp = delegateRemove(this.i.legendItemMouseLeftButtonUp, this._legendItemMouseLeftButtonUp_wrapped);
                this._legendItemMouseLeftButtonUp_wrapped = null;
                this._legendItemMouseLeftButtonUp = null;
            }
            this._legendItemMouseLeftButtonUp = ev;
            this._legendItemMouseLeftButtonUp_wrapped = function (o, e) {
                var outerArgs = new LegendMouseButtonEventArgs();
                outerArgs._provideImplementation(e);
                _this._legendItemMouseLeftButtonUp(_this, outerArgs);
            };
            this.i.legendItemMouseLeftButtonUp = delegateCombine(this.i.legendItemMouseLeftButtonUp, this._legendItemMouseLeftButtonUp_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrLegendBase.prototype, "legendItemMouseEnter", {
        /**
         * Event raised when the mouse pointer enters a legend item of this legend.
        */
        get: function () {
            return this._legendItemMouseEnter;
        },
        set: function (ev) {
            var _this = this;
            if (this._legendItemMouseEnter !== null) {
                this.i.legendItemMouseEnter = delegateRemove(this.i.legendItemMouseEnter, this._legendItemMouseEnter_wrapped);
                this._legendItemMouseEnter_wrapped = null;
                this._legendItemMouseEnter = null;
            }
            this._legendItemMouseEnter = ev;
            this._legendItemMouseEnter_wrapped = function (o, e) {
                var outerArgs = new LegendMouseEventArgs();
                outerArgs._provideImplementation(e);
                _this._legendItemMouseEnter(_this, outerArgs);
            };
            this.i.legendItemMouseEnter = delegateCombine(this.i.legendItemMouseEnter, this._legendItemMouseEnter_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrLegendBase.prototype, "legendItemMouseLeave", {
        /**
         * Event raised when the mouse pointer leaves a legend item of this legend.
        */
        get: function () {
            return this._legendItemMouseLeave;
        },
        set: function (ev) {
            var _this = this;
            if (this._legendItemMouseLeave !== null) {
                this.i.legendItemMouseLeave = delegateRemove(this.i.legendItemMouseLeave, this._legendItemMouseLeave_wrapped);
                this._legendItemMouseLeave_wrapped = null;
                this._legendItemMouseLeave = null;
            }
            this._legendItemMouseLeave = ev;
            this._legendItemMouseLeave_wrapped = function (o, e) {
                var outerArgs = new LegendMouseEventArgs();
                outerArgs._provideImplementation(e);
                _this._legendItemMouseLeave(_this, outerArgs);
            };
            this.i.legendItemMouseLeave = delegateCombine(this.i.legendItemMouseLeave, this._legendItemMouseLeave_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrLegendBase.prototype, "legendItemMouseMove", {
        /**
         * Event raised when the mouse pointer moves over a legend item of this legend.
        */
        get: function () {
            return this._legendItemMouseMove;
        },
        set: function (ev) {
            var _this = this;
            if (this._legendItemMouseMove !== null) {
                this.i.legendItemMouseMove = delegateRemove(this.i.legendItemMouseMove, this._legendItemMouseMove_wrapped);
                this._legendItemMouseMove_wrapped = null;
                this._legendItemMouseMove = null;
            }
            this._legendItemMouseMove = ev;
            this._legendItemMouseMove_wrapped = function (o, e) {
                var outerArgs = new LegendMouseEventArgs();
                outerArgs._provideImplementation(e);
                _this._legendItemMouseMove(_this, outerArgs);
            };
            this.i.legendItemMouseMove = delegateCombine(this.i.legendItemMouseMove, this._legendItemMouseMove_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    return IgrLegendBase;
}(React.Component));
export { IgrLegendBase };
