import { defineComponent, resolveComponent, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, createVNode, createBlock, withCtx } from 'vue';
import _ from 'lodash';
import '../../../../utils/index.mjs';
import '../config/index.mjs';
import { createNamespace } from '../../../../utils/create-namespace.mjs';
import { treeSelectHeaderSearchEmits, treeSelectHeaderSearchProps } from '../config/header-search.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlTreeSelectHeaderSearch" },
  __name: "header-search",
  props: treeSelectHeaderSearchProps,
  emits: treeSelectHeaderSearchEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace("tree-search");
    const handleInputChange = (e) => {
      props.onSearchInputChange && props.onSearchInputChange(e.target.value);
    };
    const handleClick = (e) => emits("click", e);
    const throttleInputChange = _.throttle(handleInputChange, props.throttleTime);
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_ll_input = resolveComponent("ll-input");
      const _component_ll_button = resolveComponent("ll-button");
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(unref(bem).e("header"))
        },
        [
          createCommentVNode(" input "),
          createVNode(_component_ll_input, {
            value: props.searchValue,
            placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57",
            onChange: unref(throttleInputChange)
          }, {
            prefix: withCtx(() => [
              createVNode(_component_ll_icon, {
                "icon-name": "icon-search",
                class: normalizeClass(unref(bem).e("header-icon"))
              }, null, 8, ["class"])
            ]),
            _: 1
            /* STABLE */
          }, 8, ["value", "onChange"]),
          createCommentVNode(" add "),
          _ctx.isShowAddBtn ? (openBlock(), createBlock(_component_ll_button, {
            key: 0,
            class: normalizeClass(`${unref(bem).e("header-button")}`),
            onClick: handleClick
          }, {
            default: withCtx(() => [
              createVNode(_component_ll_icon, { "icon-name": "icon-add" })
            ]),
            _: 1
            /* STABLE */
          }, 8, ["class"])) : createCommentVNode("v-if", true)
        ],
        2
        /* CLASS */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=header-search.vue2.mjs.map
