content: import React from 'react';
  import {BaseMixin, ElementaryMixin, ContentMixin, Tools} from './../common/common.js';
  
  import './tree-list.less';
  
  export default React.createClass({
  
    //@@viewOn:mixins
    mixins: [
      BaseMixin,
      ElementaryMixin,
      ContentMixin
    ],
    //@@viewOff:mixins
  
    //@@viewOn:statics
    statics: {
      tagName: 'UU5.Bricks.Tree.List',
      classNames: {
        main: 'uu5-bricks-tree-list'
      },
      defaults: {
        childTagName: 'UU5.Bricks.Tree.Item'
      }
    },
    //@@viewOff:statics
  
    //@@viewOn:propTypes
    propTypes: {
      items: React.PropTypes.array,
      glyphiconExpanded: React.PropTypes.string,
      glyphiconCollapsed: React.PropTypes.string,
      allowTags: React.PropTypes.array
    },
    //@@viewOff:propTypes
  
    //@@viewOn:getDefaultProps
    getDefaultProps: function () {
      return {
        items: null,
        glyphiconExpanded: null,
        glyphiconCollapsed: null,
        allowTags: []
      };
    },
    //@@viewOff:getDefaultProps
  
    //@@viewOn:standardComponentLifeCycle
    //@@viewOff:standardComponentLifeCycle
  
    //@@viewOn:interface
    //@@viewOff:interface
  
    //@@viewOn:overridingMethods
    expandChildProps_: function (child) {
      var newChildProps = Tools.mergeDeep({}, child.props);
      newChildProps.glyphiconExpanded = newChildProps.glyphiconExpanded || this.props.glyphiconExpanded;
      newChildProps.glyphiconCollapsed = newChildProps.glyphiconCollapsed || this.props.glyphiconCollapsed;
      return newChildProps;
    },
  
    shouldChildRender_: function (child) {
      var childTagName = Tools.getChildTagName(child);
      var childTagNames = this.props.allowTags.concat(this.getDefault().childTagName);
      return childTagNames.indexOf(childTagName) > -1;
    },
    //@@viewOff:overridingMethods
  
    //@@viewOn:componentSpecificHelpers
    _getItems: function () {
      var list = this;
      var content = this.getContent();
  
      if (this.props.items) {
        content = this.props.items.map(function (itemProps) {
          var result;
          if (typeof itemProps.type === 'function') {
            result = itemProps;
          } else {
            result = {tag: list.getDefault().childTagName, props: itemProps};
          }
          return result;
        });
      }
      return this.buildChildren({content: content, children: this.props.children});
    },
    //@@viewOff:componentSpecificHelpers
  
    //@@viewOn:render
    render: function () {
      return (
        <ul {...this.buildMainAttrs()}>
          {this._getItems()}
          {this.getDisabledCover()}
        </ul>
      );
    }
    //@@viewOff:render
  });