<commit_before>/**
 * Created by pratik on 2/1/18.
 */
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {CommonDataService} from "../../services/data/common.data.service";
@Component({
  selector: 'data-grid-filter',
  template: `    
      <input type="text" [(ngModel)]="filterValue" [attr.placeholder]="column.text" (keyup)="keyUpSearch(column)" type="{{column.dataType==='string' ? 'text' : 'number'}}" class="form-control" aria-label="Text input with dropdown button">
      <i class="fa fa-filter" aria-hidden="true" (click)="showToolTip = !showToolTip"></i>

      <span *ngIf="showToolTip" class="dropdown" style="width: 250px;">
        <ul class="dropdown-list">
          <li class="list-items" *ngFor="let opt of filterOptions">
            <div *ngIf="opt.type===column.dataType"  (click)="selectedOption(column,opt)">
              {{opt.key}}&nbsp;<i [class]="opt.checkedStatus" aria-hidden="true"></i>
            </div>
          </li>
         </ul>
      </span>
  `
})

export class DataGridFilterComponent implements OnInit {
  @Input() column: any;

  @Output() filterObject: any = new EventEmitter<any>();

  filterValue: any;

  filterOptions: any;

  elementId: any;

  showToolTip : boolean;

  constructor(private dataTableService: CommonDataService) {

    this.filterOptions = [
      {
        'key': 'Is Equal To',
        'value': '==',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Is Not Equal To',
        'value': '!=',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Start With',
        'value': '1',
        'type': 'string',
        'checkedStatus': 'fa fa-check'
      },

      {
        'key': 'Ends With',
        'value': '2',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Contains',
        'value': '3',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Is Equal To',
        'value': '==',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is Not Equal To',
        'value': '!=',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is greater Than',
        'value': '<',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is less Than',
        'value': '>',
        'type': 'number',
        'checkedStatus': ''
      },

      {
        'key': 'Is less Than or equal to',
        'value': '>=',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is greater Than or equal to',
        'value': '=<',
        'type': 'number',
        'checkedStatus': 'fa fa-check'
      }
    ];
  }

  ngOnInit() {
  }

  selectedOption(col: any, opt: any) {
    this.checkStatus();
    let filter: any = {};
    opt.checkedStatus = 'fa fa-check';
    filter['key'] = col.dataIndex;
    filter['value'] = this.filterValue;
    filter['filter'] = opt.value;
    filter['type'] = col.dataType;
    if (this.filterValue) {
      col.filterIcon = true;
      this.filterDataObject(filter, col);
    }
  }

  keyUpSearch(col: any) {
    if (this.filterValue == null || this.filterValue === '') {
      this.removeFilter(col);
    }else {
      col.filterIcon = true;
      const filter: any = {};
      filter['key'] = col.dataIndex;
      filter['value'] = this.filterValue;
      filter['type'] = col.dataType;
      this.filterOptions.forEach((opt) => {
        if (opt.checkedStatus === 'fa fa-check') {
          if (col.dataType === opt.type) {
            filter['filter'] = opt.value;
          }
        }
      });
      this.filterDataObject(filter, col);
    }
  }
  removeFilter(column: any) {
    this.filterValue = '';
    column.filterIcon = false;
    // $('#' + column.dataIndex).val('');
    this.dataTableService.filteredObject.forEach((option : any, index : any) => {
      if (option.key === column.dataIndex) {
        this.dataTableService.filteredObject.splice(index, 1);<commit_msg>component : Removed inline styling<commit_after>/**
 * Created by pratik on 2/1/18.
 */
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {CommonDataService} from "../../services/data/common.data.service";
@Component({
  selector: 'data-grid-filter',
  template: `    
      <input type="text" [(ngModel)]="filterValue" [attr.placeholder]="column.text" (keyup)="keyUpSearch(column)" type="{{column.dataType==='string' ? 'text' : 'number'}}" class="form-control" aria-label="Text input with dropdown button">
      <i class="fa fa-filter" aria-hidden="true" (click)="showToolTip = !showToolTip"></i>

      <span *ngIf="showToolTip" class="dropdown" style="width: 250px;">
        <ul class="dropdown-list">
          <li class="list-items" *ngFor="let opt of filterOptions">
            <div *ngIf="opt.type===column.dataType"  (click)="selectedOption(column,opt)">
              {{opt.key}}&nbsp;<i [class]="opt.checkedStatus" aria-hidden="true"></i>
            </div>
          </li>
         </ul>
      </span>
  `
})

export class DataGridFilterComponent implements OnInit {
  @Input() column: any;

  @Output() filterObject: any = new EventEmitter<any>();

  filterValue: any;

  filterOptions: any;

  elementId: any;

  showToolTip : boolean;

  constructor(private dataTableService: CommonDataService) {

    this.filterOptions = [
      {
        'key': 'Is Equal To',
        'value': '==',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Is Not Equal To',
        'value': '!=',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Start With',
        'value': '1',
        'type': 'string',
        'checkedStatus': 'fa fa-check'
      },

      {
        'key': 'Ends With',
        'value': '2',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Contains',
        'value': '3',
        'type': 'string',
        'checkedStatus': ''
      },
      {
        'key': 'Is Equal To',
        'value': '==',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is Not Equal To',
        'value': '!=',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is greater Than',
        'value': '<',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is less Than',
        'value': '>',
        'type': 'number',
        'checkedStatus': ''
      },

      {
        'key': 'Is less Than or equal to',
        'value': '>=',
        'type': 'number',
        'checkedStatus': ''
      },
      {
        'key': 'Is greater Than or equal to',
        'value': '=<',
        'type': 'number',
        'checkedStatus': 'fa fa-check'
      }
    ];
  }

  ngOnInit() {
  }

  selectedOption(col: any, opt: any) {
    this.checkStatus();
    let filter: any = {};
    opt.checkedStatus = 'fa fa-check';
    filter['key'] = col.dataIndex;
    filter['value'] = this.filterValue;
    filter['filter'] = opt.value;
    filter['type'] = col.dataType;
    if (this.filterValue) {
      col.filterIcon = true;
      this.filterDataObject(filter, col);
    }
  }

  keyUpSearch(col: any) {
    if (this.filterValue == null || this.filterValue === '') {
      this.removeFilter(col);
    }else {
      col.filterIcon = true;
      const filter: any = {};
      filter['key'] = col.dataIndex;
      filter['value'] = this.filterValue;
      filter['type'] = col.dataType;
      this.filterOptions.forEach((opt : any) => {
        if (opt.checkedStatus === 'fa fa-check') {
          if (col.dataType === opt.type) {
            filter['filter'] = opt.value;
          }
        }
      });
      this.filterDataObject(filter, col);
    }
  }
  removeFilter(column: any) {
    this.filterValue = '';
    column.filterIcon = false;
    // $('#' + column.dataIndex).val('');
    this.dataTableService.filteredObject.forEach((option : any, index : any) => {
      if (option.key === column.dataIndex) {
        this.dataTableService.filteredObject.splice(index, 1);
{'fraction_non_alphanumeric': 0.18677423297885343, 'fraction_numerical': 0.0026891578046693556, 'mean_word_length': 2.1700891127469975, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 39, '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': '2364298', 'n_tokens_mistral': 2621, 'n_tokens_neox': 2559, 'n_words': 525}