import * as React from 'react';
import { isValidProp, getModifiedProps } from "igniteui-react-core/ES2015/componentUtil";
export const LegendBaseStyles = [`
:host {
    display: block;
}
.ui-chart-legend {
  border: none;
}
.ui-chart-legend-item-text {
  font-size: 12px;
  font-family: "Segoe UI", Arial, sans-serif;
}
.ui-chart-legend-items-list
{
    padding: 0;
    margin: 5px;
}
.ui-chart-legend-item-text
{
    vertical-align: middle;
}
.ui-chart-legend
{
    overflow: auto;
}
.ui-chart-legend-item-badge, .ui-chart-legend-item-badge canvas
{
    vertical-align: middle;
}
`];
/**
 * Represents the base class for a legend in IgxDataChartComponent.
*/
export class IgrLegendBase extends React.Component {
    constructor(props) {
        super(props);
        this._zoneRunner = null;
        this._hasUserValues = new Set();
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (document) {
            //introduce styles globally for now.
        }
    }
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    componentDidMount() {
        for (const p of Object.keys(this.props)) {
            if (isValidProp(this, p)) {
                {
                    this._hasUserValues.add(p);
                    this[p] = this.props[p];
                }
            }
        }
    }
    shouldComponentUpdate(nextProps, nextState) {
        const mod = getModifiedProps(this.props, nextProps);
        for (const p of Object.keys(mod)) {
            if (isValidProp(this, p)) {
                this._hasUserValues.add(p);
                this[p] = mod[p];
            }
        }
        return true;
    }
    render() {
        return null;
    }
    /**
 * Gets if the legend is item-wise.
*/
    get isItemwise() {
        return this.i.isItemwise;
    }
    /**
     * Gets if the legend is a financial legend.
    */
    get isFinancial() {
        return this.i.isFinancial;
    }
}
