<commit_before>import { DropDownElement, MultiDropDownElement } from './../shared/models/drop-down-element';
import { Component, OnInit, ElementRef, Input } from '@angular/core';
import { Subscription, Subject, ReplaySubject } from 'rxjs/Rx';

@Component({
  selector: 'multi-drop-down',
  templateUrl: './multi-drop-down.component.html',
  styleUrls: ['./multi-drop-down.component.scss'],
  inputs: ['inputOptions'],
  outputs: ['selectedValues'],
  host: {
    '(document:click)': 'onDocumentClick($event)',
  }
})
export class MultiDropDownComponent<T> implements OnInit {

  @Input() displayText = "";
  public opened = false;
  public options: MultiDropDownElement<T>[];
  public selectedValues = new ReplaySubject<T[]>(1);
  private _selectAllOption: MultiDropDownElement<T>;

  constructor(private _eref: ElementRef) {
    this._selectAllOption = {
      displayLabel: "Select All",
      value: null,
      isSelected: false
    };
  }

  ngOnInit() {
  }

  set inputOptions(inputOptions: MultiDropDownElement<T>[]) {
    let options: MultiDropDownElement<T>[] = [];
    let defaultSelected = false;
    inputOptions.forEach(option => {
      if (option.isSelected) {
        defaultSelected = true;
      }

      options.push(option);
    })

    options.splice(0, 0, this._selectAllOption);
    this.options = options;

    if (!defaultSelected) {
      this._updateAllSelected(true);
    }

    this._notifyChangeSubscriptions();
  }

  click() {
    this.opened = !this.opened;
  }<commit_msg>Making multi-drop-down component commit values when a user clicks on the input box<commit_after>import { DropDownElement, MultiDropDownElement } from './../shared/models/drop-down-element';
import { Component, OnInit, ElementRef, Input } from '@angular/core';
import { Subscription, Subject, ReplaySubject } from 'rxjs/Rx';

@Component({
  selector: 'multi-drop-down',
  templateUrl: './multi-drop-down.component.html',
  styleUrls: ['./multi-drop-down.component.scss'],
  inputs: ['inputOptions'],
  outputs: ['selectedValues'],
  host: {
    '(document:click)': 'onDocumentClick($event)',
  }
})
export class MultiDropDownComponent<T> implements OnInit {

  @Input() displayText = "";
  public opened = false;
  public options: MultiDropDownElement<T>[];
  public selectedValues = new ReplaySubject<T[]>(1);
  private _selectAllOption: MultiDropDownElement<T>;

  constructor(private _eref: ElementRef) {
    this._selectAllOption = {
      displayLabel: "Select All",
      value: null,
      isSelected: false
    };
  }

  ngOnInit() {
  }

  set inputOptions(inputOptions: MultiDropDownElement<T>[]) {
    let options: MultiDropDownElement<T>[] = [];
    let defaultSelected = false;
    inputOptions.forEach(option => {
      if (option.isSelected) {
        defaultSelected = true;
      }

      options.push(option);
    })

    options.splice(0, 0, this._selectAllOption);
    this.options = options;

    if (!defaultSelected) {
      this._updateAllSelected(true);
    }

    this._notifyChangeSubscriptions();
  }

  click() {
    if(this.opened){
      this._notifyChangeSubscriptions();
    }

    this.opened = !this.opened;
  }
{'fraction_non_alphanumeric': 0.1411802030456853, 'fraction_numerical': 0.0019035532994923859, 'mean_word_length': 3.727136431784108, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '3636979', 'n_tokens_mistral': 975, 'n_tokens_neox': 945, 'n_words': 196}