import React, { Component } from 'react'; import PropTypes from 'prop-types'; import shallowequal from 'shallowequal'; const propTypes = { record: PropTypes.object, clsPrefix: PropTypes.string, expandable: PropTypes.any, expanded: PropTypes.bool, needIndentSpaced: PropTypes.bool, onExpand: PropTypes.func, }; class ExpandIcon extends Component{ constructor(props){ super(props); } shouldComponentUpdate(nextProps) { return !shallowequal(nextProps, this.props); } render() { const { expandable, clsPrefix, onExpand, needIndentSpaced, expanded, record } = this.props; if (expandable) { const expandClassName = expanded ? 'expanded' : 'collapsed'; return ( onExpand(!expanded, record, e)} /> ); } else if (needIndentSpaced) { return ; } return null; } }; ExpandIcon.propTypes = propTypes; export default ExpandIcon;