'use strict';

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

var vue = require('vue');
require('../../../../../../utils/index.js');
require('../../../../base/input/index.js');
var useWatchModelChange = require('../../composables/useWatchModelChange.js');
var constants = require('../../constants.js');
var searchFormInput = require('./searchFormInput.js');
var event = require('../../../../../../utils/src/elementPlus/event.js');
var input = require('../../../../base/input/input.js');

var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: searchFormInput.SearchFormInputName
  },
  __name: "SearchFormInput",
  props: /* @__PURE__ */ vue.mergeModels(searchFormInput.searchFormInputProps, {
    "modelValue": {},
    "modelModifiers": {}
  }),
  emits: /* @__PURE__ */ vue.mergeModels(searchFormInput.searchFormInputEmits, ["update:modelValue"]),
  setup(__props, { emit: __emit }) {
    const props = __props;
    const modelValue = vue.useModel(__props, "modelValue");
    useWatchModelChange.useWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });
    const emit = __emit;
    const inputEvents = event.getGmEvent(input.inputEmits, emit);
    const handleQuery = vue.inject(constants.searchFormHandleQueryKey);
    const onKeyupEnter = (value) => {
      handleQuery?.();
      emit("keyupEnter", value);
    };
    return (_ctx, _cache) => {
      const _component_gm_input = vue.resolveComponent("gm-input");
      const _component_gm_form_item = vue.resolveComponent("gm-form-item");
      return vue.openBlock(), vue.createBlock(_component_gm_form_item, { prop: _ctx.prop }, {
        default: vue.withCtx(() => [
          vue.createVNode(_component_gm_input, vue.mergeProps({
            modelValue: modelValue.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
            placeholder: _ctx.label,
            disabled: _ctx.disabled,
            clearable: "",
            class: "gm-w-full"
          }, vue.toHandlers(vue.unref(inputEvents)), {
            onKeyup: vue.withKeys(onKeyupEnter, ["enter"])
          }), null, 16, ["modelValue", "placeholder", "disabled"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["prop"]);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=SearchFormInput.vue2.js.map
