import * as tslib_1 from "tslib";
import * as React from 'react';
import { delegateCombine, delegateRemove, TypeRegistrar } from "igniteui-react-core/ES5/type";
import { LabelsPosition_$type } from "./LabelsPosition";
import { Visibility_$type } from "igniteui-react-core/ES5/Visibility";
import { Style } from "igniteui-react-core/ES5/Style";
import { LeaderLineType_$type } from "./LeaderLineType";
import { OthersCategoryType_$type } from "./OthersCategoryType";
import { PropertyUpdatedEventArgs } from "igniteui-react-core/ES5/igr-property-updated-event-args";
import { ensureEnum, toBrushCollection, fromBrushCollection, isValidProp, getModifiedProps, ensureBool } from "igniteui-react-core/ES5/componentUtil";
/**
 * Represents a IgxDoughnutChartComponent base series.
*/
var IgrRingSeriesBase = /** @class */ (function (_super) {
    tslib_1.__extends(IgrRingSeriesBase, _super);
    function IgrRingSeriesBase(props) {
        var _this = _super.call(this, props) || this;
        _this._dataSource = null;
        _this._tooltipTemplate = null;
        _this._tooltipContent = null;
        _this._tooltipContainerTemplate = null;
        _this._showDefaultTooltip = false;
        _this._propertyUpdated = null;
        _this._propertyUpdated_wrapped = null;
        _this._implementation = _this.createImplementation();
        _this._implementation.externalObject = _this;
        _this.onImplementationCreated();
        return _this;
    }
    IgrRingSeriesBase.prototype.createImplementation = function () {
        return null;
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "dataSource", {
        get: function () {
            return this._dataSource;
        },
        set: function (value) {
            this._dataSource = value;
            this.bindData();
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype.bindData = function () {
        if (this.i != null && this.i !== undefined) {
            this.i.itemsSource = this._dataSource;
        }
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype.onImplementationCreated = function () {
    };
    IgrRingSeriesBase.prototype.initializeProperties = 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[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; }
        }
    };
    IgrRingSeriesBase.prototype.componentDidMount = function () {
        this.initializeProperties();
    };
    IgrRingSeriesBase.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[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;
    };
    IgrRingSeriesBase.prototype.render = function () {
        return null;
    };
    IgrRingSeriesBase._createFromInternal = function (internal) {
        if (!internal) {
            return null;
        }
        if (!internal.$type) {
            return null;
        }
        var name = internal.$type.name;
        var externalName = "Igr" + name;
        if (!TypeRegistrar.isRegistered(externalName)) {
            return null;
        }
        return TypeRegistrar.create(externalName);
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "legend", {
        get: function () {
            if (this.i.legend != null)
                return this.i.legend.externalObject;
        },
        set: function (v) {
            if (v != undefined && v != null)
                this.i.legend = v.i;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "tooltipTemplate", {
        get: function () {
            return this._tooltipTemplate;
        },
        set: function (value) {
            this._tooltipTemplate = value;
            if (value == null) {
                if (this._tooltipContent !== null) {
                    //this._tooltipContent.destroy();
                    this._tooltipContent = null;
                }
            }
            if (this._tooltipContent != null) {
                this._tooltipContent.template = this._tooltipTemplate;
            }
            else {
                if (this.owner != null) {
                    this.owner._ensureTooltipCreated(this);
                }
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "tooltipContainerTemplate", {
        get: function () {
            return this._tooltipContainerTemplate;
        },
        set: function (value) {
            this._tooltipContainerTemplate = value;
            if (this._tooltipContent != null) {
                this._tooltipContent.instance.containerTemplate = this._tooltipContainerTemplate;
            }
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype._ensureTooltipCreated = function (createTooltip, createWrapper) {
        if (this._tooltipTemplate == null) {
            this.i.toolTip = null;
        }
        if (this._tooltipContent == null && this._tooltipTemplate != null) {
            var tooltip = createTooltip();
            if (tooltip == null) {
                return;
            }
            this._tooltipContent = tooltip;
            tooltip.tooltipTemplate = this._tooltipTemplate;
            this.i.toolTip = createWrapper(tooltip);
        }
    };
    IgrRingSeriesBase.prototype._ensureTooltipDestroyed = function () {
        if (this._tooltipContent !== null) {
            //this._tooltipContent.destroy();
            this._tooltipContent = null;
        }
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "showDefaultTooltip", {
        /**
         * Gets or sets whether default tooltip will be shown.
        */
        get: function () {
            return this._showDefaultTooltip;
        },
        set: function (v) {
            this._showDefaultTooltip = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype.sychronizeCollections = function () { };
    Object.defineProperty(IgrRingSeriesBase.prototype, "valueMemberPath", {
        /**
     * Gets or Sets the property name that contains the values.
    */
        get: function () {
            return this.i.b7;
        },
        set: function (v) {
            this.i.b7 = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "labelMemberPath", {
        /**
         * Gets or sets the property name that contains the labels.
        */
        get: function () {
            return this.i.bf;
        },
        set: function (v) {
            this.i.bf = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "legendLabelMemberPath", {
        /**
         * Gets or sets the property name that contains the legend labels.
        */
        get: function () {
            return this.i.bp;
        },
        set: function (v) {
            this.i.bp = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "labelsPosition", {
        /**
         * Gets or sets the position of chart labels.
        */
        get: function () {
            return this.i.aj;
        },
        set: function (v) {
            this.i.aj = ensureEnum(LabelsPosition_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineVisibility", {
        /**
         * Gets or sets whether the leader lines are visible.
        */
        get: function () {
            return this.i.dq;
        },
        set: function (v) {
            this.i.dq = ensureEnum(Visibility_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineFill", {
        /**
         * Gets or sets the fill brush.
        */
        get: function () {
            return this.i.dk ? this.i.dk.fill : null;
        },
        set: function (v) {
            this.ensureLeaderLineStyle();
            this.i.dk.fill = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineStroke", {
        /**
         * Gets or sets the stroke brush.
        */
        get: function () {
            return this.i.dk ? this.i.dk.stroke : null;
        },
        set: function (v) {
            this.ensureLeaderLineStyle();
            this.i.dk.stroke = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineStrokeThickness", {
        /**
         * Gets or sets the stroke thickness.
        */
        get: function () {
            return this.i.dk ? this.i.dk.strokeThickness : NaN;
        },
        set: function (v) {
            this.ensureLeaderLineStyle();
            this.i.dk.strokeThickness = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineOpacity", {
        /**
         * Gets or sets the opacity.
        */
        get: function () {
            return this.i.dk ? this.i.dk.opacity : NaN;
        },
        set: function (v) {
            this.ensureLeaderLineStyle();
            this.i.dk.opacity = +v;
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype.ensureLeaderLineStyle = function () {
        if (this.i.dk) {
            return;
        }
        this.i.dk = new Style();
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineType", {
        /**
         * Gets or sets what type of leader lines will be used for the outside end labels.
        */
        get: function () {
            return this.i.ak;
        },
        set: function (v) {
            this.i.ak = ensureEnum(LeaderLineType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "leaderLineMargin", {
        /**
         * Gets or sets the margin between a label and its leader line. The default is 6 pixels.
        */
        get: function () {
            return this.i.a1;
        },
        set: function (v) {
            this.i.a1 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryThreshold", {
        /**
         * Gets or sets the threshold value that determines if slices are grouped into the Others slice.
        */
        get: function () {
            return this.i.a2;
        },
        set: function (v) {
            this.i.a2 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryType", {
        /**
         * Gets or sets whether to use numeric or percent-based threshold value.
        */
        get: function () {
            return this.i.al;
        },
        set: function (v) {
            this.i.al = ensureEnum(OthersCategoryType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryText", {
        /**
         * Gets or sets the label of the Others slice.
        */
        get: function () {
            return this.i.bt;
        },
        set: function (v) {
            this.i.bt = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "formatLabel", {
        /**
         * Sets or gets a function which takes an object that produces a formatted label for displaying in the chart.
        */
        get: function () {
            return this.i.am;
        },
        set: function (v) {
            this.i.am = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "formatLegendLabel", {
        /**
         * Sets or gets a function which takes an object that produces a formatted label for displaying in the chart's legend.
        */
        get: function () {
            return this.i.an;
        },
        set: function (v) {
            this.i.an = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "labelExtent", {
        /**
         * Gets or sets the pixel amount by which the labels are offset from the edge of the slices.
        */
        get: function () {
            return this.i.a0;
        },
        set: function (v) {
            this.i.a0 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "startAngle", {
        /**
         * Gets or sets the starting angle of the chart.
         * The default zero value is equivalent to 3 o'clock.
        */
        get: function () {
            return this.i.a4;
        },
        set: function (v) {
            this.i.a4 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryFill", {
        /**
         * Gets or sets the fill brush.
        */
        get: function () {
            return this.i.dl ? this.i.dl.fill : null;
        },
        set: function (v) {
            this.ensureOthersCategoryStyle();
            this.i.dl.fill = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryStroke", {
        /**
         * Gets or sets the stroke brush.
        */
        get: function () {
            return this.i.dl ? this.i.dl.stroke : null;
        },
        set: function (v) {
            this.ensureOthersCategoryStyle();
            this.i.dl.stroke = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryStrokeThickness", {
        /**
         * Gets or sets the stroke thickness.
        */
        get: function () {
            return this.i.dl ? this.i.dl.strokeThickness : NaN;
        },
        set: function (v) {
            this.ensureOthersCategoryStyle();
            this.i.dl.strokeThickness = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "othersCategoryOpacity", {
        /**
         * Gets or sets the opacity.
        */
        get: function () {
            return this.i.dl ? this.i.dl.opacity : NaN;
        },
        set: function (v) {
            this.ensureOthersCategoryStyle();
            this.i.dl.opacity = +v;
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype.ensureOthersCategoryStyle = function () {
        if (this.i.dl) {
            return;
        }
        this.i.dl = new Style();
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "selectedSliceFill", {
        /**
         * Gets or sets the fill brush.
        */
        get: function () {
            return this.i.dm ? this.i.dm.fill : null;
        },
        set: function (v) {
            this.ensureSelectedStyle();
            this.i.dm.fill = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "selectedSliceStroke", {
        /**
         * Gets or sets the stroke brush.
        */
        get: function () {
            return this.i.dm ? this.i.dm.stroke : null;
        },
        set: function (v) {
            this.ensureSelectedStyle();
            this.i.dm.stroke = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "selectedSliceStrokeThickness", {
        /**
         * Gets or sets the stroke thickness.
        */
        get: function () {
            return this.i.dm ? this.i.dm.strokeThickness : NaN;
        },
        set: function (v) {
            this.ensureSelectedStyle();
            this.i.dm.strokeThickness = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "selectedSliceOpacity", {
        /**
         * Gets or sets the opacity.
        */
        get: function () {
            return this.i.dm ? this.i.dm.opacity : NaN;
        },
        set: function (v) {
            this.ensureSelectedStyle();
            this.i.dm.opacity = +v;
        },
        enumerable: true,
        configurable: true
    });
    IgrRingSeriesBase.prototype.ensureSelectedStyle = function () {
        if (this.i.dm) {
            return;
        }
        this.i.dm = new Style();
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "brushes", {
        /**
         * Gets or sets the palette of brushes to use for coloring the slices.
        */
        get: function () {
            return fromBrushCollection(this.i.ag);
        },
        set: function (v) {
            this.i.ag = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "outlines", {
        /**
         * Gets or sets the palette of brushes to use for outlines on the slices.
        */
        get: function () {
            return fromBrushCollection(this.i.ah);
        },
        set: function (v) {
            this.i.ah = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "isSurfaceInteractionDisabled", {
        /**
         * Gets or sets whether all surface interactions with the plot area should be disabled.
        */
        get: function () {
            return this.i.ax;
        },
        set: function (v) {
            this.i.ax = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrRingSeriesBase.prototype, "radiusFactor", {
        /**
         * Gets or sets the scaling factor of the chart's radius. Value between 0 and 1.
        */
        get: function () {
            return this.i.a3;
        },
        set: function (v) {
            this.i.a3 = +v;
        },
        enumerable: true,
        configurable: true
    });
    /**
 * Called by the UI framework to provide a UI container for rendering this control.

* @param container  * The UI container element.
*/
    IgrRingSeriesBase.prototype.provideContainer = function (container) {
        this.i.ck(container);
    };
    Object.defineProperty(IgrRingSeriesBase.prototype, "propertyUpdated", {
        /**
         * Event raised when a property (including "effective" and non-dependency property) value changes.
        */
        get: function () {
            return this._propertyUpdated;
        },
        set: function (ev) {
            var _this = this;
            if (this._propertyUpdated_wrapped !== null) {
                this.i.propertyUpdated = delegateRemove(this.i.propertyUpdated, this._propertyUpdated_wrapped);
                this._propertyUpdated_wrapped = null;
                this._propertyUpdated = null;
            }
            this._propertyUpdated = ev;
            this._propertyUpdated_wrapped = function (o, e) {
                var outerArgs = new PropertyUpdatedEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforePropertyUpdated) {
                    _this.beforePropertyUpdated(_this, outerArgs);
                }
                if (_this._propertyUpdated) {
                    _this._propertyUpdated(_this, outerArgs);
                }
            };
            this.i.propertyUpdated = delegateCombine(this.i.propertyUpdated, this._propertyUpdated_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    return IgrRingSeriesBase;
}(React.Component));
export { IgrRingSeriesBase };
