import _extends from "@babel/runtime/helpers/esm/extends";
import ksPopup from '../popup';
import employeeSearch from '../employee/index';
import './style';

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c('ks-popup', _vm._g(_vm._b({
    staticClass: "ks-employee-popup",
    attrs: {
      "value": _vm.value
    }
  }, 'ks-popup', _vm.bindAttr, false), _vm.$listeners), [_vm.title ? _c('div', {
    staticClass: "ks-employee-popup-header"
  }, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _vm._v(" "), _c('employee-search', _vm._b({
    staticClass: "ks-employee-search",
    on: {
      "focus": _vm.focus,
      "blur": _vm.blur,
      "clear": _vm.clear,
      "cancel": _vm.cancel,
      "confirm": _vm.confirm
    },
    scopedSlots: _vm._u([{
      key: "employeeListInfo",
      fn: function fn(ref) {
        var item = ref.item;
        return [_vm._t("employeeListInfo", null, {
          "item": item
        })];
      }
    }], null, true),
    model: {
      value: _vm.employee,
      callback: function callback($v) {
        _vm.employee = $v;
      },
      expression: "employee"
    }
  }, 'employee-search', _vm.$attrs, false))], 1);
};

var __vue_staticRenderFns__ = [];
export default {
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__,
  name: 'ks-employee-popup',
  props: {
    value: Boolean,
    popAttr: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    title: {
      type: String,
      default: '选择成员'
    },
    // 默认选中人员
    defaultValue: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  components: {
    employeeSearch: employeeSearch
  },
  data: function data() {
    return {
      employee: [].concat(this.defaultValue)
    };
  },
  watch: {
    value: function value(val) {
      window.ks && window.ks.setCloseButton && window.ks.setCloseButton({
        isShow: !val
      });
    }
  },
  computed: {
    bindAttr: function bindAttr() {
      return _extends({
        position: 'bottom',
        getContainer: 'body',
        closeIconPosition: 'top-left',
        closeIcon: 'arrow-left',
        closeable: true
      }, this.popAttr);
    }
  },
  methods: {
    confirm: function confirm(list) {
      this.$emit('input', false);
      this.$emit('confirm', list);
    },
    cancel: function cancel() {
      this.$emit('cancel', false);
    },
    focus: function focus() {
      this.$emit('focus');
    },
    blur: function blur() {
      this.$emit('blur');
    },
    clear: function clear() {
      this.$emit('clear');
    }
  }
};