import "../../../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                                */
/* empty css                                                                    */
import { computed, createElementBlock, openBlock, createVNode, mergeProps, toHandlers } from "vue";
import { getCurrentVueInstance } from "../../../utils/getInstance.mjs";
/* empty css               */
import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElInput } from "../../../../../../node_modules/element-plus/es/components/input/index.mjs";
const _hoisted_1 = { class: "textarea-field-wrapper" };
const _sfc_main = /* @__PURE__ */ Object.assign({
  inheritAttrs: false
}, {
  __name: "Textarea",
  props: {
    config: {
      type: Object,
      required: true
    },
    modelValue: {
      type: [String, Number],
      default: ""
    },
    placeholder: {
      type: String,
      default: ""
    },
    disabled: {
      type: Boolean,
      default: false
    },
    readonly: {
      type: Boolean,
      default: false
    },
    maxLength: {
      type: Number,
      default: 1e3
    },
    showWordCount: {
      type: Boolean,
      default: false
    },
    rows: {
      type: Number,
      default: 4
    },
    autosize: {
      type: [Boolean, Object],
      default: false
    }
  },
  emits: ["update:modelValue", "change"],
  setup(__props, { emit: __emit }) {
    const ctx = getCurrentVueInstance();
    const props = __props;
    const emit = __emit;
    const inputValue = computed({
      get: () => props.modelValue,
      set: (val) => {
        emit("update:modelValue", val);
      }
    });
    const realMaxLength = computed(() => {
      return Math.floor(props.maxLength / (ctx.$dbFieldLengthRatio || 1));
    });
    function handleChange(val) {
      emit("change", val);
    }
    return (_ctx, _cache) => {
      const _component_el_input = ElInput;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(_component_el_input, mergeProps({
          modelValue: inputValue.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
        }, toHandlers(__props.config.eventHandlers), {
          type: "textarea",
          placeholder: __props.placeholder,
          disabled: __props.disabled,
          readonly: __props.readonly,
          maxlength: realMaxLength.value,
          "show-word-limit": __props.showWordCount,
          rows: __props.rows,
          autosize: __props.autosize,
          resize: "none",
          onChange: handleChange
        }), null, 16, ["modelValue", "placeholder", "disabled", "readonly", "maxlength", "show-word-limit", "rows", "autosize"])
      ]);
    };
  }
});
const _Textarea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1bdb1a05"]]);
export {
  _Textarea as default
};
