<commit_before>'use babel'
/** @jsx etch.dom */

import etch from 'etch'
import Clipboard from 'clipboard'
import DOMListener from 'dom-listener'

export default class DataResultView {
  constructor({columns, rows}) {
    this.state = {
      columns: columns,
      rows: rows,
      currentStart: 0,
      currentEnd: 200,
      selectedItems: [],
      dragSelectRow: false,
      dragSelectCell: false,
      dragSelectFunc: event => { this.dragSelect(event); },
      columnResizeStartFunc: event => { this.columnResizeStart(event); },
      columnResizeMoveFunc: event => { this.columnResizeMove(event); },
      columnResizeEndFunc: event => { this.columnResizeEnd(event); },
      columnToResize: null
    }
    etch.initialize(this)

    atom.commands.add(this.element, {
      'core:copy': () => {
        let str = this.state.selectedItems.map(ele => ele.innerText).join('\n')
        Clipboard.writeText(str)
      }
    })

    let listener = new DOMListener(this.element)
    listener.add('.result-cell', 'mousedown', event => this.cellDragStart(event))
    listener.add('.result-cell', 'mouseup', event => this.selectDragEnd(event))
    listener.add('.result-row', 'mousedown', event => this.rowDragStart(event))
    listener.add('th', 'mouseup', event => this.selectDragEnd(event))
    listener.add('tr', 'mouseup', event => this.selectDragEnd(event))
    listener.add('.col-header', 'mousemove', event => this.columnResizeCheck(event))
    this.refs.tableHeader.addEventListener('click', () => this.selectTable())
  }

  update(props, children) {
    this.state.columns = props.columns<commit_msg>Changes to remove message related to deprecated use of clipboard on core:copy<commit_after>'use babel'
/** @jsx etch.dom */

import etch from 'etch'
import DOMListener from 'dom-listener'

export default class DataResultView {
  constructor({columns, rows}) {
    this.state = {
      columns: columns,
      rows: rows,
      currentStart: 0,
      currentEnd: 200,
      selectedItems: [],
      dragSelectRow: false,
      dragSelectCell: false,
      dragSelectFunc: event => { this.dragSelect(event); },
      columnResizeStartFunc: event => { this.columnResizeStart(event); },
      columnResizeMoveFunc: event => { this.columnResizeMove(event); },
      columnResizeEndFunc: event => { this.columnResizeEnd(event); },
      columnToResize: null
    }
    etch.initialize(this)

    atom.commands.add(this.element, {
      'core:copy': () => {
        let str = this.state.selectedItems.map(ele => ele.innerText).join('\n')
        atom.clipboard.write(str)
      }
    })

    let listener = new DOMListener(this.element)
    listener.add('.result-cell', 'mousedown', event => this.cellDragStart(event))
    listener.add('.result-cell', 'mouseup', event => this.selectDragEnd(event))
    listener.add('.result-row', 'mousedown', event => this.rowDragStart(event))
    listener.add('th', 'mouseup', event => this.selectDragEnd(event))
    listener.add('tr', 'mouseup', event => this.selectDragEnd(event))
    listener.add('.col-header', 'mousemove', event => this.columnResizeCheck(event))
    this.refs.tableHeader.addEventListener('click', () => this.selectTable())
  }

  update(props, children) {
    this.state.columns = props.columns
{'fraction_non_alphanumeric': 0.1509665541577171, 'fraction_numerical': 0.00245474071801166, 'mean_word_length': 3.6504992867332384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7185305', 'n_tokens_mistral': 986, 'n_tokens_neox': 975, 'n_words': 190}