/**
 * tdesign v0.39.1-alpha.1
 * (c) 2022 tdesign
 * @license MIT
 */

import { h as helper } from '../../_chunks/dep-1ec74b8b.js';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _typeof from '@babel/runtime/helpers/typeof';
import Vue from 'vue';
import { SearchIcon } from 'tdesign-icons-vue';
import { prefix } from '../../config.js';
import { Input } from '../../input/index.js';
import '../../input/addon.js';
import '../../input/input.js';
import '@babel/runtime/helpers/toConsumableArray';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import 'lodash/merge';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '../../config-provider/type.js';
import '../../utils/mixins.js';
import '../../utils/classnames.js';
import '../../utils/event.js';
import '../../input/props.js';
import '../../utils/render-tnode.js';
import 'lodash/isObject';
import '../../input/input-group.js';
import '../../utils/map-props.js';
import '../../utils/withInstall.js';
import 'lodash/capitalize';
import './style/index.js';
import '../../input/type.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var Search = Vue.extend({
  name: "TTransferSearch",
  functional: true,
  model: {
    prop: "searchValue",
    event: "change"
  },
  props: {
    searchValue: {
      type: String,
      "default": ""
    },
    search: {
      type: [Boolean, Object]
    },
    placeholder: String
  },
  render: function render(_, context) {
    var h = arguments[0];
    var _context$props = context.props,
        searchValue = _context$props.searchValue,
        search = _context$props.search,
        placeholder = _context$props.placeholder;
    var inputProps = _typeof(search) === "object" ? search : {
      clearable: true
    };

    var handleChange = function handleChange(value, changeCtx) {
      context.listeners.change && context.listeners.change(value);
      context.listeners.search && context.listeners.search({
        value: value,
        trigger: "input",
        e: changeCtx.e
      });
    };

    var handleEnter = function handleEnter(value, changeCtx) {
      context.listeners.search && context.listeners.search({
        value: value,
        trigger: "input",
        e: changeCtx.e
      });
    };

    return h("div", {
      "class": "".concat(prefix, "-transfer__search-wrapper")
    }, [h(Input, helper([{}, {
      "props": _objectSpread({}, inputProps)
    }, {
      "attrs": {
        "value": searchValue,
        "placeholder": placeholder
      },
      "on": {
        "change": handleChange,
        "enter": handleEnter
      }
    }]), [h(SearchIcon, {
      "slot": "suffix-icon"
    })])]);
  }
});

export { Search as default };
//# sourceMappingURL=transfer-search.js.map
