'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var inputNumber = require('./input-number.js');
var elementPlus = require('element-plus');

"use strict";
const __default__ = vue.defineComponent({
  name: "me-input-number"
});
var script = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: /* @__PURE__ */ vue.mergeModels({
    suffix: { type: String, required: false, default: "" },
    width: { type: [Number, String], required: false, default: 150 },
    showControl: { type: Boolean, required: false, default: true },
    min: { type: Number, required: false, default: 0 }
  }, {
    "modelValue": { type: Number },
    "modelModifiers": {}
  }),
  emits: ["update:modelValue"],
  setup(__props) {
    const props = __props;
    const model = vue.useModel(__props, "modelValue");
    const refInputNumber = vue.ref();
    const getSize = (val) => {
      let res = inputNumber.isNumber(val) ? val + "px" : val;
      return res;
    };
    const inputNumberStyle = vue.computed(() => {
      return {
        width: getSize(props.width)
      };
    });
    vue.onMounted(() => {
      const el = refInputNumber.value.$el;
      el.querySelector(".el-input__wrapper").setAttribute("suffix", props.suffix);
    });
    const onBlur = (e) => {
      const value = e.target.value;
      if (!value) {
        model.value = 0;
      }
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElInputNumber), vue.mergeProps({
        ref_key: "refInputNumber",
        ref: refInputNumber,
        modelValue: model.value,
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
        class: "me-input-number"
      }, _ctx.$attrs, {
        controls: true,
        "controls-position": "right",
        style: inputNumberStyle.value,
        min: __props.min,
        onBlur
      }), null, 16, ["modelValue", "style", "min"]);
    };
  }
});

exports.default = script;
//# sourceMappingURL=input-number.vue2.js.map
