<template>
  <n-options-tree ref="options" v-model="isFocus" v-bind="{disabled, state, options, maxHeight, autoClose: false, builders, multiple}"
                  @click="onOptionSelect" @select-all="onSelectAll" @on-confirm="onSubmit">
    <n-filter-refer class="n-select-tree-filter" v-model="isFocus" v-bind="{label, state, name, values, multiple, disabled, clearable}"
                    @u-update="onReferUpdateValues"></n-filter-refer>
  </n-options-tree>
</template>
<script>
import NSelectFilter from '@uif/next/lib/components/select-filter'
import NOptionsTree from '@uif/next/lib/components/options-tree'
import {optionsSelectAll} from '_common/formUtils'

export default {
  inheritAttrs: false,
  name: 'n-select-tree-filter',
  extends: NSelectFilter,
  components: {
    NOptionsTree
  },
  methods: {
    // 点击全选
    onSelectAll (options, isSelected) {
      optionsSelectAll(this.scopeValue, options, isSelected)
      this.state.updateValuesByValue(this.scopeValues, this.scopeValue)
    }
  }
}
</script>
