/**
 * util.js
 *
 * @Author: apple
 * @Date: 2018/1/29 19:18
 */

import React, { Component, Children, isValidElement, cloneElement } from 'react';

var getPanelItems = function getPanelItems(children) {
    var items = [];
    Children.forEach(children, function (item) {
        if (isValidElement(item)) {
            items.push(item);
        }
    });
    return items;
};
var renderElement = function renderElement(children) {
    return getPanelItems(children).map(function (item, key) {
        if (!React.isValidElement(item)) {
            return null;
        }
        return cloneElement(item, {
            key: 'panel-' + key
        });
    });
};

export { getPanelItems, renderElement };