<commit_before>/*jslint browser: true, es6: true*/
class CanvasDatagrid extends React.Component {
    constructor(props) {
        super(props);
    }
    updateAttributes(nextProps) {
        Object.keys(this.props).forEach(key => {
            if (!nextProps || this.props[key] !== nextProps[key]) {
                if (this.grid.attributes[key] !== undefined) {
                    this.grid.attributes[key] = nextProps ? nextProps[key] : this.props[key];
                } else {
                    this.grid[key] = nextProps ? nextProps[key] : this.props[key];
                }
            }
        });
    }
    componentWillReceiveProps(nextProps) {
        this.updateAttributes(nextProps);
    }
    shouldComponentUpdate() {
        return false;
    }
    componentWillUnmount() {
        this.grid.dispose();
    }
    componentDidMount() {
        var args = {};
        this.grid = ReactDOM.findDOMNode(this);
        this.updateAttributes();
    }
    render() {
        return React.createElement('canvas-datagrid', {});
    }
}
function getRandomData() {
    return [{
        foo: Math.random(),
        bar: Math.random(),
        baz: Math.random()
    }];
}
var grid = React.createElement(CanvasDatagrid, {
        style: {
            backgroundColor: 'tan'
        },
        data: getRandomData(),
        oncellmouseover: function (e) {
            e.cell.value = Math.random()
        }
    });
ReactDOM.render(grid, document.getElementById('root'));<commit_msg>updated react example<commit_after>/*jslint browser: true, es6: true*/
class CanvasDatagrid extends React.Component {
    constructor(props) {
        super(props);
    }
    updateAttributes(nextProps) {
        Object.keys(this.props).forEach(key => {
            if (!nextProps || this.props[key] !== nextProps[key]) {
                if (this.grid.attributes[key] !== undefined) {
                    this.grid.attributes[key] = nextProps ? nextProps[key] : this.props[key];
                } else {
                    this.grid[key] = nextProps ? nextProps[key] : this.props[key];
                }
            }
        });
    }
    componentWillReceiveProps(nextProps) {
        this.updateAttributes(nextProps);
    }
    shouldComponentUpdate() {
        return false;
    }
    componentWillUnmount() {
        this.grid.dispose();
    }
    componentDidMount() {
        var args = {};
        this.grid = ReactDOM.findDOMNode(this);
        this.updateAttributes();
    }
    render() {
        return React.createElement('canvas-datagrid', {});
    }
}
class GenerateRandomDataButton extends React.Component {
    constructor(props) {
        super(props);
        this.state = { data: getRandomData() };
    }
    render() {
        return React.createElement('div', {
                style: {
                    height: '300px'
                }
            },
            React.createElement(CanvasDatagrid, {
                data: this.state.data
            }),
            React.createElement('button', {
                onClick: (e) => { this.onInputChange(getRandomData()); }
            }, 'Generate Random Data')
        );
    }
    onInputChange(data) {
        this.setState({data});
    }
}
function getRandomData() {
    return [{
        foo: Math.random(),
        bar: Math.random(),
        baz: Math.random()
    }];
}
var grid = React.createElement(GenerateRandomDataButton, {});
ReactDOM.render(grid, document.getElementById('root'));
{'fraction_non_alphanumeric': 0.1362980075079411, 'fraction_numerical': 0.0014438348252959862, 'mean_word_length': 1.9430756159728122, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7118307', 'n_tokens_mistral': 977, 'n_tokens_neox': 961, 'n_words': 156}