<commit_before>import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { Observable, Subscription } from 'rxjs/Rx';

@Directive({
  selector: '[resizeable]',
  host: {
    '[class.resizeable]': 'resizeEnabled'
  }
})
export class Resizeable {

  @Input() resizeEnabled: boolean = true;
  @Input() minWidth: number;
  @Input() maxWidth: number;
  @Output() onResize: EventEmitter<any> = new EventEmitter();

  private element: HTMLElement;
  private subscription: Subscription;
  private resizing: boolean = false;

  constructor(element: ElementRef) {
    this.element = element.nativeElement;

    if (this.resizeEnabled) {
      const node = document.createElement('span');
      node.classList.add('resize-handle');
      this.element.appendChild(node);
    }
  }

  ngOnDestroy(): void {
    if (this.subscription) {
      this.subscription.unsubscribe();
    }
  }

  @HostListener('document:mouseup', ['$event'])
  onMouseup() {
    this.resizing = false;

    if (this.subscription) {
      this.subscription.unsubscribe();
      this.onResize.emit(this.element.clientWidth);
    }
  }

  @HostListener('mousedown', ['$event'])
  onMousedown(event) {
    const isHandle = event.target.classList.contains('resize-handle');
    const initialWidth = this.element.clientWidth;
    const mouseDownScreenX = event.screenX;<commit_msg>fix #196 (after resizing a column, any new click generates a new resize event)<commit_after>import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { Observable, Subscription } from 'rxjs/Rx';

@Directive({
  selector: '[resizeable]',
  host: {
    '[class.resizeable]': 'resizeEnabled'
  }
})
export class Resizeable {

  @Input() resizeEnabled: boolean = true;
  @Input() minWidth: number;
  @Input() maxWidth: number;
  @Output() onResize: EventEmitter<any> = new EventEmitter();

  private element: HTMLElement;
  private subscription: Subscription;
  private resizing: boolean = false;

  constructor(element: ElementRef) {
    this.element = element.nativeElement;

    if (this.resizeEnabled) {
      const node = document.createElement('span');
      node.classList.add('resize-handle');
      this.element.appendChild(node);
    }
  }

  ngOnDestroy(): void {
    if (this.subscription) {
      this.subscription.unsubscribe();
    }
  }

  @HostListener('document:mouseup', ['$event'])
  onMouseup() {
    this.resizing = false;

    if (this.subscription && !this.subscription.closed) {
      this.subscription.unsubscribe();
      this.onResize.emit(this.element.clientWidth);
    }
  }

  @HostListener('mousedown', ['$event'])
  onMousedown(event) {
    const isHandle = event.target.classList.contains('resize-handle');
    const initialWidth = this.element.clientWidth;
    const mouseDownScreenX = event.screenX;
{'fraction_non_alphanumeric': 0.1387141858839972, 'fraction_numerical': 0.0010482180293501049, 'mean_word_length': 4.040492957746479, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '116046', 'n_tokens_mistral': 871, 'n_tokens_neox': 870, 'n_words': 183}