<commit_before>import React, { Component, PropTypes } from 'react';
import classSet from 'classnames';
import Const from '../Const';

class SelectFilter extends Component {
  constructor(props) {
    super(props);
    this.filter = this.filter.bind(this);
    this.state = {
      isPlaceholderSelected: (this.props.defaultValue === undefined ||
              !this.props.options.hasOwnProperty(this.props.defaultValue))
    };
  }

  filter(event) {
    const { value } = event.target;
    this.setState({ isPlaceholderSelected: (value === '') });
    this.props.filterHandler(value, Const.FILTER_TYPE.SELECT);
  }

  cleanFiltered() {
    const value = (this.props.defaultValue !== undefined) ? this.props.defaultValue : '';
    this.setState({ isPlaceholderSelected: (value === '') });
    this.refs.selectInput.value = value;
    this.props.filterHandler(value, Const.FILTER_TYPE.SELECT);
  }

  applyFilter(filterOption) {
    filterOption = filterOption + '';
    this.setState({ isPlaceholderSelected: (filterOption === '') });
    this.refs.selectInput.value = filterOption;
    this.props.filterHandler(filterOption, Const.FILTER_TYPE.SELECT);
  }

  getOptions() {
    const optionTags = [];
    const { options, placeholder, columnName } = this.props;
    optionTags.push((
      <option key='-1' value=''>{ placeholder || `Select ${columnName}...` }</option>
    ));
    Object.keys(options).map(key => {<commit_msg>Add an option to customize the "Select" text on SelectFilter filter.<commit_after>import React, { Component, PropTypes } from 'react';
import classSet from 'classnames';
import Const from '../Const';

class SelectFilter extends Component {
  constructor(props) {
    super(props);
    this.filter = this.filter.bind(this);
    this.state = {
      isPlaceholderSelected: (this.props.defaultValue === undefined ||
              !this.props.options.hasOwnProperty(this.props.defaultValue))
    };
  }

  filter(event) {
    const { value } = event.target;
    this.setState({ isPlaceholderSelected: (value === '') });
    this.props.filterHandler(value, Const.FILTER_TYPE.SELECT);
  }

  cleanFiltered() {
    const value = (this.props.defaultValue !== undefined) ? this.props.defaultValue : '';
    this.setState({ isPlaceholderSelected: (value === '') });
    this.refs.selectInput.value = value;
    this.props.filterHandler(value, Const.FILTER_TYPE.SELECT);
  }

  applyFilter(filterOption) {
    filterOption = filterOption + '';
    this.setState({ isPlaceholderSelected: (filterOption === '') });
    this.refs.selectInput.value = filterOption;
    this.props.filterHandler(filterOption, Const.FILTER_TYPE.SELECT);
  }

  getOptions() {
    const optionTags = [];
    const { options, placeholder, columnName, selectText } = this.props;
    const selectTextValue = (selectText !== undefined) ? selectText : 'Select';
    optionTags.push((
      <option key='-1' value=''>{ placeholder || `${selectTextValue} ${columnName}...` }</option>
    ));
    Object.keys(options).map(key => {
{'fraction_non_alphanumeric': 0.15323383084577114, 'fraction_numerical': 0.0006633499170812604, 'mean_word_length': 3.779714738510301, 'pattern_counts': {'":': 0, '<': 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': '5071998', 'n_tokens_mistral': 871, 'n_tokens_neox': 868, 'n_words': 169}