import './index.less';

var Collapse = {
    name: 'SnCollapse',
    props: {
        accordion: Boolean,
        value: [String, Number, Array],
        border: Boolean
    },
    methods: {
        'switch': function _switch(name, expanded) {
            if (!this.accordion) {
                name = expanded ? this.value.concat(name) : this.value.filter(function (activeName) {
                    return activeName !== name;
                });
            }
            this.$emit('change', name);
            this.$emit('input', name);
        }
    },
    render: function render() {
        var h = arguments[0];
        var border = this.border,
            $slots = this.$slots;

        return h(
            'div',
            {
                'class': {
                    'sn-collapse': true,
                    'sn-collapse-border': border
                }
            },
            [$slots['default']]
        );
    }
};

export default Collapse;