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;
*         }
*     }
* ```
*/
export class IgrItemLegend extends IgrLegendBase {
    render() {
        let div = React.createElement("div", {
            className: "ig-item-legend igr-item-legend",
            ref: this._getMainRef
        });
        return div;
    }
    _getMainRef(div) {
        this._elRef = div;
    }
    componentDidMount() {
        super.componentDidMount();
        this.initializeContent();
    }
    initializeContent() {
        this._elRef.appendChild(this.container.getNativeElement());
    }
    constructor(props) {
        super(props);
        this._getMainRef = this._getMainRef.bind(this);
        let 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);
    }
    destroy() {
        this._wrapper.destroy();
        this.i.provideContainer(null);
    }
    createImplementation() {
        return new ItemLegend();
    }
    get i() {
        return this._implementation;
    }
    createItemwiseLegendItems(legendItems, series) {
        this.i.createItemwiseLegendItems(legendItems, series);
    }
    exportVisualData() {
        return this.i.exportVisualData();
    }
    exportSerializedVisualData() {
        return this.i.exportSerializedVisualData();
    }
    /**
 * Gets whether or not this legend supports itemwise visuals
*/
    get isItemwise() {
        return this.i.isItemwise;
    }
    /**
     * Gets or sets the current Legend object's orientation.
    */
    get orientation() {
        return this.i.bc;
    }
    set orientation(v) {
        this.i.bc = ensureEnum(LegendOrientation_$type, v);
    }
}
//# sourceMappingURL=igr-item-legend.js.map
