import * as tslib_1 from "tslib";
import * as React from 'react';
import { IgrLegendBase } from './igr-legend-base';
import { ItemLegend } from "./ItemLegend";
import { LegendOrientation_$type } from './LegendOrientation';
import { ReactRenderer } from "igniteui-react-core";
import { DataChartStylingDefaults } from './DataChartStylingDefaults';
import { ensureEnum } from "igniteui-react-core";
/**
 * Represents a legend that displays an item for each point in the series.
*
* You can use the `IgrItemLegend` to display a legend item for each data member bound to the `IgrBubbleSeries`
*
* ```ts
*   <IgrItemLegend ref={this.onLegendRef} />
* ```
*
* ```ts
* this.onLegendRef = this.onLegendRef.bind(this);
* public onLegendRef(legend: IgrItemLegend) {
*         this.legend = legend;
*         if (this.chart) {
*             this.chart.actualSeries[0].legend = this.legend;
*         }
*     }
* ```
*/
var IgrItemLegend = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(IgrItemLegend, _super);
    function IgrItemLegend(props) {
        var _this = _super.call(this, props) || this;
        _this._getMainRef = _this._getMainRef.bind(_this);
        var container;
        if (document) {
            container = document.createElement("div");
            container.style.display = "block";
            container.style.width = "100%";
            container.style.height = "100%";
        }
        var root;
        root = container;
        var ren = new ReactRenderer(root, document, true, DataChartStylingDefaults);
        _this.container = ren.getWrapper(container);
        _this._wrapper = ren;
        _this.i.provideContainer(ren);
        return _this;
    }
    IgrItemLegend.prototype.render = function () {
        var div = React.createElement("div", {
            className: "ig-item-legend igr-item-legend",
            ref: this._getMainRef
        });
        return div;
    };
    IgrItemLegend.prototype._getMainRef = function (div) {
        this._elRef = div;
    };
    IgrItemLegend.prototype.componentDidMount = function () {
        _super.prototype.componentDidMount.call(this);
        this.initializeContent();
    };
    IgrItemLegend.prototype.initializeContent = function () {
        this._elRef.appendChild(this.container.getNativeElement());
    };
    IgrItemLegend.prototype.destroy = function () {
        this._wrapper.destroy();
        this.i.provideContainer(null);
    };
    IgrItemLegend.prototype.createImplementation = function () {
        return new ItemLegend();
    };
    Object.defineProperty(IgrItemLegend.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgrItemLegend.prototype.createItemwiseLegendItems = function (legendItems, series) {
        this.i.createItemwiseLegendItems(legendItems, series);
    };
    IgrItemLegend.prototype.exportVisualData = function () {
        return this.i.exportVisualData();
    };
    IgrItemLegend.prototype.exportSerializedVisualData = function () {
        return this.i.exportSerializedVisualData();
    };
    Object.defineProperty(IgrItemLegend.prototype, "isItemwise", {
        /**
     * Gets whether or not this legend supports itemwise visuals
    */
        get: function () {
            return this.i.isItemwise;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrItemLegend.prototype, "orientation", {
        /**
         * Gets or sets the current Legend object's orientation.
        */
        get: function () {
            return this.i.bc;
        },
        set: function (v) {
            this.i.bc = ensureEnum(LegendOrientation_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    return IgrItemLegend;
}(IgrLegendBase));
export { IgrItemLegend };
//# sourceMappingURL=igr-item-legend.js.map
