"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                                */
;/* empty css                                                                    */
const Vue = require("vue");
const getInstance = require("../../../utils/getInstance.js");
;/* empty css               */
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../../../node_modules/element-plus/es/components/input/index.js");
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 = getInstance.getCurrentVueInstance();
    const props = __props;
    const emit = __emit;
    const inputValue = Vue.computed({
      get: () => props.modelValue,
      set: (val) => {
        emit("update:modelValue", val);
      }
    });
    const realMaxLength = Vue.computed(() => {
      return Math.floor(props.maxLength / (ctx.$dbFieldLengthRatio || 1));
    });
    function handleChange(val) {
      emit("change", val);
    }
    return (_ctx, _cache) => {
      const _component_el_input = index.ElInput;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createVNode(_component_el_input, Vue.mergeProps({
          modelValue: inputValue.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
        }, Vue.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__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-1bdb1a05"]]);
exports.default = _Textarea;
