import * as React from 'react';
import { IgrLegendBase } from './igr-legend-base';
import { ItemLegend } from "./ItemLegend";
import { ReactRenderer } from "igniteui-react-core/ES2015/react-renderer";
import { DataChartStylingDefaults } from './DataChartStylingDefaults';
/**
 * 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`
*/
export class IgrItemLegend extends IgrLegendBase {
    render() {
        let div = React.createElement("div", {
            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();
    }
    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;
    }
}
