<template>
  <n-options-virtual-list class="n-options-tree" v-bind="{visible, state, _options, multiple, builders, maxHeight}">
    <template #option="{option}">
      <n-options-tree-item :option="option" :state="state" :multiple="multiple" :builder="builders.option" v-on="$listeners"></n-options-tree-item>
    </template>
    <template #footer>
      <div class="n-options-footer" v-if="state.isFilter && multiple">
        <n-button size="small" type="primary" @click="$emit('on-confirm')">确定</n-button>
      </div>
    </template>
  </n-options-virtual-list>
</template>
<script>
import NOptionsVirtualList from '@uif/next/lib/components/options-virtual-list'
import NOptionsTreeItem from './options-tree-item'
import NOptionsPaster from '../options/options-paster'

export default {
  name: 'n-options-tree-paster',
  extends: NOptionsPaster,
  components: {
    NOptionsVirtualList,
    NOptionsTreeItem
  },
  computed: {
    _options ({state, options}) {
      return state.options || options
    }
  }
}
</script>
