ExpandIcon.js 832 B

12345678910111213141516171819202122232425262728293031
  1. "use client";
  2. import * as React from 'react';
  3. import classNames from 'classnames';
  4. function renderExpandIcon(locale) {
  5. return props => {
  6. const {
  7. prefixCls,
  8. onExpand,
  9. record,
  10. expanded,
  11. expandable
  12. } = props;
  13. const iconPrefix = `${prefixCls}-row-expand-icon`;
  14. return /*#__PURE__*/React.createElement("button", {
  15. type: "button",
  16. onClick: e => {
  17. onExpand(record, e);
  18. e.stopPropagation();
  19. },
  20. className: classNames(iconPrefix, {
  21. [`${iconPrefix}-spaced`]: !expandable,
  22. [`${iconPrefix}-expanded`]: expandable && expanded,
  23. [`${iconPrefix}-collapsed`]: expandable && !expanded
  24. }),
  25. "aria-label": expanded ? locale.collapse : locale.expand,
  26. "aria-expanded": expanded
  27. });
  28. };
  29. }
  30. export default renderExpandIcon;