<commit_before>import React from 'react';
import Const from './Const';

class TableColumn extends React.Component{

  constructor(props) {
		super(props);
  }

  handleCellEdit(e){
    if(this.props.cellEdit.mode == Const.CELL_EDIT_DBCLICK){
      if(document.selection && document.selection.empty) {
        document.selection.empty();
      } else if(window.getSelection) {
          var sel = window.getSelection();
          sel.removeAllRanges();
      }
    }
    this.props.onEdit(
      e.currentTarget.parentElement.rowIndex,
      e.currentTarget.cellIndex);
  }

  render(){
    var tdStyle = {
      textAlign: this.props.dataAlign,
      display: this.props.hidden?"none":null,
      width: this.props.width,
      maxWidth: this.props.width
    };
    var classname = this.props.className;
    if(this.props.width !== null && this.props.width.indexOf('px') > -1){
        let w = this.props.width.replace('px','');
        classname += " col-md-"+w;
    }


    var opts = {};
    if(this.props.cellEdit){
      if(this.props.cellEdit.mode == Const.CELL_EDIT_CLICK){
        opts.onClick = this.handleCellEdit.bind(this);
      }else if(this.props.cellEdit.mode == Const.CELL_EDIT_DBCLICK){
        opts.onDoubleClick = this.handleCellEdit.bind(this);
      }
    }
    return (
      <td style={tdStyle} className={classname} {...opts}>
        {this.props.children}
      </td>
    )
  }
}
TableColumn.propTypes = {
  dataAlign: React.PropTypes.string,
  hidden: React.PropTypes.bool,
  className:React.PropTypes.string
};

TableColumn.defaultProps = {
  dataAlign: "left",
  hidden: false,
  className:""
}
export default TableColumn;
<commit_msg>fix #146<commit_after>import React from 'react';
import Const from './Const';

class TableColumn extends React.Component{

  constructor(props) {
		super(props);
  }

  handleCellEdit(e){
    if(this.props.cellEdit.mode == Const.CELL_EDIT_DBCLICK){
      if(document.selection && document.selection.empty) {
        document.selection.empty();
      } else if(window.getSelection) {
          var sel = window.getSelection();
          sel.removeAllRanges();
      }
    }
    this.props.onEdit(
      e.currentTarget.parentElement.rowIndex,
      e.currentTarget.cellIndex);
  }

  render(){
    var tdStyle = {
      textAlign: this.props.dataAlign,
      display: this.props.hidden?"none":null,
      width: this.props.width,
      maxWidth: this.props.width
    };
    var classname = this.props.className;
    if(this.props.width &&
      this.props.width !== null && this.props.width.indexOf('px') > -1){
        let w = this.props.width.replace('px','');
        classname += " col-md-"+w;
    }


    var opts = {};
    if(this.props.cellEdit){
      if(this.props.cellEdit.mode == Const.CELL_EDIT_CLICK){
        opts.onClick = this.handleCellEdit.bind(this);
      }else if(this.props.cellEdit.mode == Const.CELL_EDIT_DBCLICK){
        opts.onDoubleClick = this.handleCellEdit.bind(this);
      }
    }
    return (
      <td style={tdStyle} className={classname} {...opts}>
        {this.props.children}
      </td>
    )
  }
}
TableColumn.propTypes = {
  dataAlign: React.PropTypes.string,
  hidden: React.PropTypes.bool,
  className:React.PropTypes.string
};

TableColumn.defaultProps = {
  dataAlign: "left",
  hidden: false,
  className:""
}
export default TableColumn;

{'fraction_non_alphanumeric': 0.14541654225141834, 'fraction_numerical': 0.001492982979994028, 'mean_word_length': 2.7895927601809953, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 9, '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': '4182544', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1082, 'n_words': 174}