import { defineComponent, useModel, ref, resolveComponent, createBlock, openBlock, withCtx, createVNode, mergeProps, toHandlers, unref, mergeModels } from 'vue';
import '../../../../../../utils/index.mjs';
import '../../../../base/formItem/index.mjs';
import '../../../../base/cascader/index.mjs';
import { useWatchModelChange } from '../../composables/useWatchModelChange.mjs';
import { searchFormCascaderEmits, searchFormCascaderProps, SearchFormCascaderName } from './searchFormCascader.mjs';
import { getGmEvent } from '../../../../../../utils/src/elementPlus/event.mjs';
import { cascaderEmits, cascaderExposeNames } from '../../../../base/cascader/cascader.mjs';
import { getGmObjExports } from '../../../../../../utils/src/elementPlus/exports.mjs';
import { formItemExposeNames } from '../../../../base/formItem/formItem.mjs';

var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: SearchFormCascaderName
  },
  __name: "SearchFormCascader",
  props: /* @__PURE__ */ mergeModels(searchFormCascaderProps, {
    "modelValue": {},
    "modelModifiers": {}
  }),
  emits: /* @__PURE__ */ mergeModels(searchFormCascaderEmits, ["update:modelValue"]),
  setup(__props, { expose: __expose, emit: __emit }) {
    const modelValue = useModel(__props, "modelValue");
    const props = __props;
    const emit = __emit;
    const cascaderEvents = getGmEvent(cascaderEmits, emit);
    useWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });
    const cascaderRef = ref();
    const formItemRef = ref();
    const { exposeFns: cascaderFns } = getGmObjExports(cascaderRef, cascaderExposeNames);
    const { exposeFns: formItemFns } = getGmObjExports(formItemRef, formItemExposeNames);
    __expose({
      cascaderExposes: {
        ...cascaderFns
      },
      formItemExposes: {
        ...formItemFns
      }
    });
    return (_ctx, _cache) => {
      const _component_gm_cascader = resolveComponent("gm-cascader");
      const _component_gm_form_item = resolveComponent("gm-form-item");
      return openBlock(), createBlock(_component_gm_form_item, {
        ref_key: "formItemRef",
        ref: formItemRef,
        prop: _ctx.prop
      }, {
        default: withCtx(() => [
          createVNode(_component_gm_cascader, mergeProps({
            ref_key: "cascaderRef",
            ref: cascaderRef,
            modelValue: modelValue.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
            options: _ctx.options,
            props: { ..._ctx.cascaderProps },
            clearable: "",
            filterable: "",
            disabled: _ctx.disabled,
            "collapse-tags": "",
            "collapse-tags-tooltip": "",
            class: "gm-w-full",
            placeholder: _ctx.label
          }, toHandlers(unref(cascaderEvents))), null, 16, ["modelValue", "options", "props", "disabled", "placeholder"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["prop"]);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=SearchFormCascader.vue2.mjs.map
