<commit_before><script>
import noop from "../../utils/noop";

export default {
  name: "InputNumber",
  props: {
    name: String,
    value: Number,
    min: Number,
    max: Number,
    prefix: [String, Number],
    sufix: [String, Number],
    disabled: {
      type: Boolean,
      default: false
    },
    onChange: {
      type: Function,
      default: noop
    }
  },
  methods: {
    onChangeInputNumber(event) {
      if (!this.disabled) {
        this.onChange(this.value, this.name, this.min, this.max);
      }
    }
  }
};
</script>

<template>
  <label :class="['input-number', { 'disabled': disabled }]" :title="value">
    <span v-if="prefix" class="prefix"> {{ prefix }} </span>
    <input type="number" :name="name" :min="min" :max="max" @change="onChangeInputNumber" v-model="value" :disabled="disabled">
    <span v-if="sufix" class="sufix"> {{ sufix }} </span>
  </label>
</template><commit_msg>InputNumber improvements<commit_after><script>
import noop from "../../utils/noop";

export default {
  name: "InputNumber",
  props: {
    name: String,
    value: Number,
    min: Number,
    max: Number,
    step: Number,
    prefix: [String, Number],
    sufix: [String, Number],
    disabled: {
      type: Boolean,
      default: false
    },
    onChange: {
      type: Function,
      default: noop
    }
  },
  methods: {
    onChangeInputNumber(event) {
      if (!this.disabled) {
        this.onChange(this.value, this.name, this.min, this.max, this.step);
      }
    }
  },
  mounted() {
    this.$refs.inpNumber.addEventListener('mousewheel', noop);
  },
  beforeDestroy() {
    this.$refs.inpNumber.removeEventListener('mousewheel', noop);
  },
};
</script>

<template>
  <label :class="['input-number', { 'disabled': disabled }]" :title="value">
    <span v-if="prefix" class="prefix"> {{ prefix }} </span>
    <input ref="inpNumber" type="number" :name="name" :step="step" :min="min" :max="max" @change="onChangeInputNumber" v-model="value" :disabled="disabled">
    <span v-if="sufix" class="sufix"> {{ sufix }} </span>
  </label>
</template>
{'fraction_non_alphanumeric': 0.18759018759018758, 'fraction_numerical': 0.0, 'mean_word_length': 3.126984126984127, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '2553607', 'n_tokens_mistral': 701, 'n_tokens_neox': 702, 'n_words': 149}