<template>
    <div class="nus_cellgroup">
        <template v-if="list && list.length">
            <template
                class="nu_list-item"
                v-for="(item, index) in list">
                <slot
                    :itemData="_filterItem(item, index)"
                    :index="index"
                    :data="item">
                </slot>
            </template>
        </template>
        <slot v-else></slot>
    </div>
</template>

<script>
import { callFn } from 'nimble-lib';
export default {
    name: 'NuCellgroup',
    props: {
        /**
         * 数据列表
         */
        list: {},
        /**
         * 过滤item项数据
         */
        filterItem: {
            type: Function
        }
    },
    methods: {
        /**
         * 过滤item项数据
         * @param {Object} item item项数据
         * @param {Number} index 索引
         * @param {Number} col 列数
         * @return {Object}
         */
        _filterItem(item, index, col) {
            return callFn(this.filterItem || item, [item, index, col]);
        }
    }
};
</script>

<style lang="scss">
@import '../../../_assets/style/_iconFont.scss';
@import '../../../_assets/style/_var.scss';
@import '../../../_assets/style/_mixin.scss';

.nus_cellgroup{
    border-color: $nucellgroup-br-color;
    *,::after,::before{
        border-color: inherit;
    }
    > .nus_cell{
        padding: 0 0;
        @include borderT(inherit);
        &.nu_cell-more{
            padding-right: 15px;
        }
        .nu_more-wrap{
            right: 0;
        }
        &:first-child{
            &:before{
                display: none;
            }
        }
    }
}
</style>
