import * as tslib_1 from "tslib";
import { EventEmitter, Output, Input, TemplateRef } from '@angular/core';
import { delegateCombine } from "igniteui-angular-core";
import { LabelsPosition, LabelsPosition_$type } from "./LabelsPosition";
import { Visibility, Visibility_$type } from "igniteui-angular-core";
import { Style } from "igniteui-angular-core";
import { LeaderLineType, LeaderLineType_$type } from "./LeaderLineType";
import { OthersCategoryType, OthersCategoryType_$type } from "./OthersCategoryType";
import { IgxPropertyUpdatedEventArgs } from "igniteui-angular-core";
import { ensureEnum, toBrushCollection, fromBrushCollection, ensureBool, toSpinal, initializePropertiesFromCss, NamePatcher, brushToString, stringToBrush } from "igniteui-angular-core";
import { TypeRegistrar } from "igniteui-angular-core";
/**
 * Represents a IgxRingSeriesBaseComponent base series.
*/
export const IgxRingSeriesBaseComponent_PROVIDERS = [];
export class IgxRingSeriesBaseComponent {
    constructor() {
        //
        this._dataSource = null;
        this._tooltipTemplate = null;
        this._tooltipContent = null;
        this._tooltipContainerTemplate = null;
        this._showDefaultTooltip = false;
        this.__p = null;
        this._hasUserValues = new Set();
        this._stylingContainer = null;
        this._stylingParent = null;
        this._inStyling = false;
        this._propertyUpdated = null;
        this._zoneRunner = null;
        if (this._styling) {
            NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
        }
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return null;
    }
    ngOnInit() {
    }
    set dataSource(value) {
        this._dataSource = value;
        this.bindData();
    }
    get dataSource() {
        return this._dataSource;
    }
    bindData() {
        if (this.i != null && this.i !== undefined) {
            this.i.itemsSource = this._dataSource;
        }
    }
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    static _createFromInternal(internal) {
        if (!internal) {
            return null;
        }
        if (!internal.$type) {
            return null;
        }
        let name = internal.$type.name;
        let externalName = "Igx" + name + "Component";
        if (!TypeRegistrar.isRegistered(externalName)) {
            return null;
        }
        return TypeRegistrar.create(externalName);
    }
    get legend() {
        if (this.i.legend != null)
            return this.i.legend.externalObject;
    }
    set legend(v) {
        if (v != undefined && v != null)
            this.i.legend = v.i;
    }
    set tooltipTemplate(value) {
        this._tooltipTemplate = value;
        if (value == null) {
            if (this._tooltipContent !== null) {
                this._tooltipContent.destroy();
                this._tooltipContent = null;
            }
        }
        if (this._tooltipContent != null) {
            this._tooltipContent.instance.template = this._tooltipTemplate;
        }
        else {
            if (this.owner != null) {
                this.owner._ensureTooltipCreated(this);
            }
        }
    }
    get tooltipTemplate() {
        return this._tooltipTemplate;
    }
    set tooltipContainerTemplate(value) {
        this._tooltipContainerTemplate = value;
        if (this._tooltipContent != null) {
            this._tooltipContent.instance.containerTemplate = this._tooltipContainerTemplate;
        }
    }
    get tooltipContainerTemplate() {
        return this._tooltipContainerTemplate;
    }
    _ensureTooltipCreated(createTooltip, createWrapper) {
        if (this._tooltipTemplate == null) {
            this.i.toolTip = null;
        }
        if (this._tooltipContent == null && this._tooltipTemplate != null) {
            let tooltip = createTooltip();
            if (tooltip == null) {
                return;
            }
            this._tooltipContent = tooltip;
            tooltip.instance.template = this._tooltipTemplate;
            this.i.toolTip = createWrapper(tooltip.location.nativeElement);
        }
    }
    _ensureTooltipDestroyed() {
        if (this._tooltipContent !== null) {
            this._tooltipContent.destroy();
            this._tooltipContent = null;
        }
    }
    /**
     * Gets or sets whether default tooltip will be shown.
    */
    get showDefaultTooltip() {
        return this._showDefaultTooltip;
    }
    set showDefaultTooltip(v) {
        this._showDefaultTooltip = ensureBool(v);
    }
    sychronizeCollections() { }
    /**
 * Gets or Sets the property name that contains the values.
*/
    get valueMemberPath() {
        return this.i.b9;
    }
    set valueMemberPath(v) {
        this.i.b9 = v;
    }
    /**
     * Gets or sets the property name that contains the labels.
    */
    get labelMemberPath() {
        return this.i.bg;
    }
    set labelMemberPath(v) {
        this.i.bg = v;
    }
    /**
     * Gets or sets the property name that contains the legend labels.
    */
    get legendLabelMemberPath() {
        return this.i.br;
    }
    set legendLabelMemberPath(v) {
        this.i.br = v;
    }
    /**
     * Gets or sets the position of chart labels.
    */
    get labelsPosition() {
        return this.i.aj;
    }
    set labelsPosition(v) {
        this.i.aj = ensureEnum(LabelsPosition_$type, v);
    }
    /**
     * Gets or sets whether the leader lines are visible.
    */
    get leaderLineVisibility() {
        return this.i.dw;
    }
    set leaderLineVisibility(v) {
        this.i.dw = ensureEnum(Visibility_$type, v);
    }
    /**
     * Gets or sets the fill brush.
    */
    get leaderLineFill() {
        return this.i.dr ? this.i.dr.fill : null;
    }
    set leaderLineFill(v) {
        this.ensureLeaderLineStyle();
        this.i.dr.fill = v;
    }
    /**
     * Gets or sets the stroke brush.
    */
    get leaderLineStroke() {
        return this.i.dr ? this.i.dr.stroke : null;
    }
    set leaderLineStroke(v) {
        this.ensureLeaderLineStyle();
        this.i.dr.stroke = v;
    }
    /**
     * Gets or sets the stroke thickness.
    */
    get leaderLineStrokeThickness() {
        return this.i.dr ? this.i.dr.strokeThickness : NaN;
    }
    set leaderLineStrokeThickness(v) {
        this.ensureLeaderLineStyle();
        this.i.dr.strokeThickness = +v;
    }
    /**
     * Gets or sets the opacity.
    */
    get leaderLineOpacity() {
        return this.i.dr ? this.i.dr.opacity : NaN;
    }
    set leaderLineOpacity(v) {
        this.ensureLeaderLineStyle();
        this.i.dr.opacity = +v;
    }
    ensureLeaderLineStyle() {
        if (this.i.dr) {
            return;
        }
        this.i.dr = new Style();
    }
    /**
     * Gets or sets what type of leader lines will be used for the outside end labels.
    */
    get leaderLineType() {
        return this.i.ak;
    }
    set leaderLineType(v) {
        this.i.ak = ensureEnum(LeaderLineType_$type, v);
    }
    /**
     * Gets or sets the margin between a label and its leader line. The default is 6 pixels.
    */
    get leaderLineMargin() {
        return this.i.a1;
    }
    set leaderLineMargin(v) {
        this.i.a1 = +v;
    }
    /**
     * Gets or sets the threshold value that determines if slices are grouped into the Others slice.
    */
    get othersCategoryThreshold() {
        return this.i.a2;
    }
    set othersCategoryThreshold(v) {
        this.i.a2 = +v;
    }
    /**
     * Gets or sets whether to use numeric or percent-based threshold value.
    */
    get othersCategoryType() {
        return this.i.al;
    }
    set othersCategoryType(v) {
        this.i.al = ensureEnum(OthersCategoryType_$type, v);
    }
    /**
     * Gets or sets the label of the Others slice.
    */
    get othersCategoryText() {
        return this.i.bv;
    }
    set othersCategoryText(v) {
        this.i.bv = v;
    }
    /**
     * Sets or gets a function which takes an object that produces a formatted label for displaying in the chart.
    */
    get formatLabel() {
        return this.i.am;
    }
    set formatLabel(v) {
        this.i.am = v;
    }
    /**
     * Sets or gets a function which takes an object that produces a formatted label for displaying in the chart's legend.
    */
    get formatLegendLabel() {
        return this.i.an;
    }
    set formatLegendLabel(v) {
        this.i.an = v;
    }
    /**
     * Gets or sets the pixel amount by which the labels are offset from the edge of the slices.
    */
    get labelExtent() {
        return this.i.a0;
    }
    set labelExtent(v) {
        this.i.a0 = +v;
    }
    /**
     * Gets or sets the starting angle of the chart.
     * The default zero value is equivalent to 3 o'clock.
    */
    get startAngle() {
        return this.i.a4;
    }
    set startAngle(v) {
        this.i.a4 = +v;
    }
    /**
     * Gets or sets the fill brush.
    */
    get othersCategoryFill() {
        return this.i.ds ? this.i.ds.fill : null;
    }
    set othersCategoryFill(v) {
        this.ensureOthersCategoryStyle();
        this.i.ds.fill = v;
    }
    /**
     * Gets or sets the stroke brush.
    */
    get othersCategoryStroke() {
        return this.i.ds ? this.i.ds.stroke : null;
    }
    set othersCategoryStroke(v) {
        this.ensureOthersCategoryStyle();
        this.i.ds.stroke = v;
    }
    /**
     * Gets or sets the stroke thickness.
    */
    get othersCategoryStrokeThickness() {
        return this.i.ds ? this.i.ds.strokeThickness : NaN;
    }
    set othersCategoryStrokeThickness(v) {
        this.ensureOthersCategoryStyle();
        this.i.ds.strokeThickness = +v;
    }
    /**
     * Gets or sets the opacity.
    */
    get othersCategoryOpacity() {
        return this.i.ds ? this.i.ds.opacity : NaN;
    }
    set othersCategoryOpacity(v) {
        this.ensureOthersCategoryStyle();
        this.i.ds.opacity = +v;
    }
    ensureOthersCategoryStyle() {
        if (this.i.ds) {
            return;
        }
        this.i.ds = new Style();
    }
    /**
     * Gets or sets the fill brush.
    */
    get selectedSliceFill() {
        return this.i.dt ? this.i.dt.fill : null;
    }
    set selectedSliceFill(v) {
        this.ensureSelectedStyle();
        this.i.dt.fill = v;
    }
    /**
     * Gets or sets the stroke brush.
    */
    get selectedSliceStroke() {
        return this.i.dt ? this.i.dt.stroke : null;
    }
    set selectedSliceStroke(v) {
        this.ensureSelectedStyle();
        this.i.dt.stroke = v;
    }
    /**
     * Gets or sets the stroke thickness.
    */
    get selectedSliceStrokeThickness() {
        return this.i.dt ? this.i.dt.strokeThickness : NaN;
    }
    set selectedSliceStrokeThickness(v) {
        this.ensureSelectedStyle();
        this.i.dt.strokeThickness = +v;
    }
    /**
     * Gets or sets the opacity.
    */
    get selectedSliceOpacity() {
        return this.i.dt ? this.i.dt.opacity : NaN;
    }
    set selectedSliceOpacity(v) {
        this.ensureSelectedStyle();
        this.i.dt.opacity = +v;
    }
    ensureSelectedStyle() {
        if (this.i.dt) {
            return;
        }
        this.i.dt = new Style();
    }
    /**
     * Gets or sets the palette of brushes to use for coloring the slices.
    */
    get brushes() {
        return fromBrushCollection(this.i.ag);
    }
    set brushes(v) {
        this.i.ag = toBrushCollection(v);
    }
    /**
     * Gets or sets the palette of brushes to use for outlines on the slices.
    */
    get outlines() {
        return fromBrushCollection(this.i.ah);
    }
    set outlines(v) {
        this.i.ah = toBrushCollection(v);
    }
    /**
     * Gets or sets the color for labels rendered outside of the pie chart.
    */
    get labelOuterColor() {
        return brushToString(this.i.dp);
    }
    set labelOuterColor(v) {
        this.i.dp = stringToBrush(v);
    }
    /**
     * Gets or sets the color for labels rendered inside of the pie chart.
    */
    get labelInnerColor() {
        return brushToString(this.i.dn);
    }
    set labelInnerColor(v) {
        this.i.dn = stringToBrush(v);
    }
    /**
     * Gets or sets whether all surface interactions with the plot area should be disabled.
    */
    get isSurfaceInteractionDisabled() {
        return this.i.ax;
    }
    set isSurfaceInteractionDisabled(v) {
        this.i.ax = ensureBool(v);
    }
    /**
     * Gets or sets the scaling factor of the chart's radius. Value between 0 and 1.
    */
    get radiusFactor() {
        return this.i.a3;
    }
    set radiusFactor(v) {
        this.i.a3 = +v;
    }
    get hasUserValues() {
        return this._hasUserValues;
    }
    __m(propertyName) {
        if (!this._inStyling) {
            this._hasUserValues.add(propertyName);
        }
    }
    _styling(container, component, parent) {
        if (this._inStyling) {
            return;
        }
        this._inStyling = true;
        this._stylingContainer = container;
        this._stylingParent = component;
        let genericPrefix = "";
        let typeName = this.i.$type.name;
        if (typeName.indexOf("Xam") === 0) {
            typeName = typeName.substring(3);
        }
        genericPrefix = toSpinal("RingSeriesBaseComponent");
        let additionalPrefixes = [];
        let prefix = toSpinal(typeName);
        additionalPrefixes.push(prefix + "-");
        let b = this.i.$type.baseType;
        while (b && b.name != "Object" &&
            b.name != "Base" &&
            b.name != "Control" &&
            b.Name != "DependencyObject" &&
            b.Name != "FrameworkElement") {
            typeName = b.name;
            if (typeName.indexOf("Xam") === 0) {
                typeName = typeName.substring(3);
            }
            let basePrefix = toSpinal(typeName);
            additionalPrefixes.push(basePrefix + "-");
            b = b.baseType;
        }
        if (parent) {
            let parentTypeName = parent.i.$type.name;
            if (parentTypeName.indexOf("Xam") === 0) {
                parentTypeName = parentTypeName.substring(3);
            }
            let parentPrefix = toSpinal(parentTypeName);
            additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
            additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
        }
        initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
        if (this._otherStyling) {
            this._otherStyling(container, component, parent);
        }
        this._inStyling = false;
    }
    /**
 * Called by the UI framework to provide a UI container for rendering this control.

* @param container  * The UI container element.
*/
    provideContainer(container) {
        this.i.cm(container);
    }
    /**
     * Event raised when a property (including "effective" and non-dependency property) value changes.
    */
    get propertyUpdated() {
        if (this._propertyUpdated == null) {
            this._propertyUpdated = new EventEmitter();
            this.i.propertyUpdated = delegateCombine(this.i.propertyUpdated, (o, e) => {
                this._runInZone(() => {
                    let outerArgs = new IgxPropertyUpdatedEventArgs();
                    outerArgs._provideImplementation(e);
                    if (this.beforePropertyUpdated) {
                        this.beforePropertyUpdated(this, outerArgs);
                    }
                    this._propertyUpdated.emit({
                        sender: this,
                        args: outerArgs
                    });
                });
            });
        }
        return this._propertyUpdated;
    }
    _runInZone(act) {
        if (this._zoneRunner != null) {
            this._zoneRunner(act);
        }
        else {
            act();
        }
    }
}
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Array),
    tslib_1.__metadata("design:paramtypes", [Array])
], IgxRingSeriesBaseComponent.prototype, "dataSource", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Object),
    tslib_1.__metadata("design:paramtypes", [Object])
], IgxRingSeriesBaseComponent.prototype, "legend", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", TemplateRef),
    tslib_1.__metadata("design:paramtypes", [TemplateRef])
], IgxRingSeriesBaseComponent.prototype, "tooltipTemplate", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", TemplateRef),
    tslib_1.__metadata("design:paramtypes", [TemplateRef])
], IgxRingSeriesBaseComponent.prototype, "tooltipContainerTemplate", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Boolean),
    tslib_1.__metadata("design:paramtypes", [Boolean])
], IgxRingSeriesBaseComponent.prototype, "showDefaultTooltip", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "valueMemberPath", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "labelMemberPath", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "legendLabelMemberPath", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "labelsPosition", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "leaderLineVisibility", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "leaderLineFill", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "leaderLineStroke", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "leaderLineStrokeThickness", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "leaderLineOpacity", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "leaderLineType", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "leaderLineMargin", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryThreshold", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryType", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryText", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Function])
], IgxRingSeriesBaseComponent.prototype, "formatLabel", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Function])
], IgxRingSeriesBaseComponent.prototype, "formatLegendLabel", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "labelExtent", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "startAngle", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryFill", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryStroke", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryStrokeThickness", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "othersCategoryOpacity", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "selectedSliceFill", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "selectedSliceStroke", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "selectedSliceStrokeThickness", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "selectedSliceOpacity", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Array),
    tslib_1.__metadata("design:paramtypes", [Array])
], IgxRingSeriesBaseComponent.prototype, "brushes", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Array),
    tslib_1.__metadata("design:paramtypes", [Array])
], IgxRingSeriesBaseComponent.prototype, "outlines", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "labelOuterColor", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String),
    tslib_1.__metadata("design:paramtypes", [String])
], IgxRingSeriesBaseComponent.prototype, "labelInnerColor", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Boolean),
    tslib_1.__metadata("design:paramtypes", [Boolean])
], IgxRingSeriesBaseComponent.prototype, "isSurfaceInteractionDisabled", null);
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", Number),
    tslib_1.__metadata("design:paramtypes", [Number])
], IgxRingSeriesBaseComponent.prototype, "radiusFactor", null);
tslib_1.__decorate([
    Output(),
    tslib_1.__metadata("design:type", EventEmitter),
    tslib_1.__metadata("design:paramtypes", [])
], IgxRingSeriesBaseComponent.prototype, "propertyUpdated", null);
//# sourceMappingURL=igx-ring-series-base-component.js.map