index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import { Icon } from 'antd';
  4. import CheckboxItem from '../CheckboxItem';
  5. import { Button } from '../Button';
  6. export default class UserAction extends Component {
  7. onAction(key) {
  8. const { onAction } = this.props;
  9. if (onAction) onAction(key);
  10. }
  11. onAll(checked) {
  12. const { onAll } = this.props;
  13. if (onAll) onAll(checked);
  14. }
  15. render() {
  16. const { allCheckbox, help, btnList = [], right } = this.props;
  17. return (
  18. <div className="user-action">
  19. {allCheckbox && (
  20. <div className="all">
  21. <CheckboxItem theme="white" onClick={value => this.onAll(value)} />
  22. 全选
  23. </div>
  24. )}
  25. {btnList.map(btn => {
  26. return (
  27. <Button radius size="small" onClick={() => this.onAction(btn.key)}>
  28. {btn.title}
  29. </Button>
  30. );
  31. })}
  32. {help && <Icon type="question-circle" theme="filled" onClick={() => this.onAction('help')} />}
  33. {right && <div className="right">{right}</div>}
  34. </div>
  35. );
  36. }
  37. }