<template>
  <div class="n-filter">
    <template v-for="input in visibleInputs">
      <n-filter-item :key="getInputKey(input)" v-on="$listeners" :input="input" :_inputs="inputs"></n-filter-item>
    </template>
  </div>
</template>

<script>
import NFilterItem from '@uif/next/lib/components/filter-item'
import {prop} from '@uif/next/lib/utils/tools'
import {getInputKey} from '_common/formUtils'

export default {
  inheritAttrs: false,
  name: 'n-filter',
  components: {
    NFilterItem
  },
  props: {
    // FormItem props 集合
    inputs: prop.array()
  },
  data () {
    return {
      getInputKey
    }
  },
  computed: {
    // 可见的inputs
    visibleInputs ({inputs}) {
      return inputs.filter(input => !input.hidden)
    }
  }
}
</script>
