import Transfer from './transfer';

export default {
  name: 'PickerPanel',
  components: {Transfer},
  props: {
    defaultChecked: Array,
    treeProps: Object,
    checkedUsers: Array,
    renderChecked: Function,
    renderCheckedItem: Function,
    selectPanelButton: Function,
    radio: Boolean,
    isSearchCheckAll: Boolean,
    height: Number,
    checkOnClickNode: Boolean
  },

  render() {
    const {parentName, userName, renderFilter, filterNodeMethod} = this.treeProps;
    return (<Transfer ref="tree"
      class={this.radio ? 'radio' : ''}
      fieldNames={{
        parent: parentName,
        userName: userName
      }}
      height={this.height}
      treeProps={this.treeProps}
      filterNodeMethod={filterNodeMethod}
      defaultChecked={this.defaultChecked}
      checkedUsers={this.checkedUsers}
      renderChecked={this.renderChecked}
      renderCheckedItem={this.renderCheckedItem}
      selectPanelButton={this.selectPanelButton}
      radio={this.radio}
      isSearchCheckAll={this.isSearchCheckAll}
      checkOnClickNode={this.checkOnClickNode}
    >
      <template slot="filter">{renderFilter && renderFilter(this.$refs['tree'])}</template>
    </Transfer>);
  }
};
