import React, { Component, PropTypes } from 'react'; import Checkbox from '../checkbox'; import Search from './search.jsx'; import {classSet} from 'rc-util'; function noop() { } class TransferList extends Component { constructor(props) { super(props); } handleSelectALl() { this.props.handleSelectAll(this.getGlobalCheckStatus()); } handleSelect(selectedItem, e) { this.props.handleSelect(selectedItem, e.target.checked); } handleFilter(e) { this.props.handleFilter(e); } getGlobalCheckStatus() { let { dataSource } = this.props; let globalCheckStatus; let selectedRowLength = 0; dataSource.forEach((data)=> { if ( data.checked ) { selectedRowLength++; } }); if ( selectedRowLength > 0 ) { if ( selectedRowLength < dataSource.length ) { globalCheckStatus = 'part'; } else { globalCheckStatus = 'all'; } } else { globalCheckStatus = 'none'; } return globalCheckStatus; } renderCheckbox(props) { const { prefixCls } = props; const checkboxCls = { [`${prefixCls}-checkbox`]: true, }; if (props.checkPart) { checkboxCls[`${prefixCls}-checkbox-indeterminate`] = true; } else if (props.checked) { checkboxCls[`${prefixCls}-checkbox-checked`] = true; } let customEle = null; if (typeof props.checkable !== 'boolean') { customEle = props.checkable; } if (props.disabled) { checkboxCls[`${prefixCls}-checkbox-disabled`] = true; return {customEle}; } return ({customEle}); } render() { const { prefixCls, config, header, footer, dataSource, filter, customLayout } = this.props; let globalCheckStatus = this.getGlobalCheckStatus(); const headerDom = header({...this.props, globalCheckStatus}); const footerDom = footer({...this.props, globalCheckStatus}); const layout = customLayout({...this.props, globalCheckStatus}); return (