<template>
  <div :class="parentWrapperClass" v-if="vshow">
    <slot name="before:label"></slot>
    <blabel :label="label" :disabled="disabled"></blabel>
    <slot name="after:label"></slot>
    <input
      :disabled="vdisabled"
      autocomplete="off"
      class="form-control"
      type="text"
      :maxlength="COL_SIZE"
      :id="id"
      :name="id"
      v-bind="$attrs"
      v-on="inputListeners"
      :value="value"
    />
    <slot name="after:input"></slot>
    <span class="bar"></span>
    <!-- <span class="error_msg" v-show="errorMsg">{{errorMsg}}</span> -->
    <slot name="after:input:bar"></slot>
  </div>
</template>
<script>
 /* eslint-disable */ 
import Blabel from "./Blabel.vue";
import {
  isUndef,
  isPlainObject
} from "@credenceanalytics/utilities";
export default {
  components: {
    Blabel,
  },
  props: {
    value: null,
    IntCutmStyles: {
      type: String,
    },
    id: {
      type: String,
      required: true,
    },
    label: {
      type: String,
      default: "",
    },
    COL_SIZE: {
      type: [String, Number],
      default: 100,
    },
    hide: {
      type: [String, Boolean, Object],
      default: true,
    },
    disabled: {
      type: [String, Boolean, Object],
      default: false,
    },
    parentWrapperClass: {
      type: String,
      default: "form-group",
    },
    customRules: {
      type: Object,
      default: function () {
        return {};
      },
    },
    errorMsg: {
      type: String,
      default: "",
    },
  },
  computed: {
    topTooltipOptions() {
      return {
        content: this.lLabel,
        placement: "top",
      };
    },
    lLabel() {
      return this.$t(this.label.toLowerCase());
    },
    inputListeners: function () {
      var vm = this;
      return Object.assign({}, this.$listeners, {
        input: function (event) {
          vm.$emit("input", event.target.value);
        },
      });
    },
    vshow() {
      return isUndef(this.hide)
        ? true
        : isPlainObject(this.hide)
        ? this.hide[this.id]
        : this.hide;
    },
    vdisabled() {
      return isUndef(this.disabled)
        ? false
        : isPlainObject(this.disabled)
        ? this.disabled[this.id]
        : this.disabled;
    },
  },
};
</script>
<style lang='scss' scoped>
</style>