ExpandIcon.js 1.1 KB

123456789101112131415161718192021222324
  1. import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
  2. import { createVNode as _createVNode } from "vue";
  3. import classNames from '../_util/classNames';
  4. function renderExpandIcon(locale) {
  5. return function expandIcon(_ref) {
  6. var _classNames;
  7. var prefixCls = _ref.prefixCls,
  8. onExpand = _ref.onExpand,
  9. record = _ref.record,
  10. expanded = _ref.expanded,
  11. expandable = _ref.expandable;
  12. var iconPrefix = "".concat(prefixCls, "-row-expand-icon");
  13. return _createVNode("button", {
  14. "type": "button",
  15. "onClick": function onClick(e) {
  16. onExpand(record, e);
  17. e.stopPropagation();
  18. },
  19. "class": classNames(iconPrefix, (_classNames = {}, _defineProperty(_classNames, "".concat(iconPrefix, "-spaced"), !expandable), _defineProperty(_classNames, "".concat(iconPrefix, "-expanded"), expandable && expanded), _defineProperty(_classNames, "".concat(iconPrefix, "-collapsed"), expandable && !expanded), _classNames)),
  20. "aria-label": expanded ? locale.collapse : locale.expand
  21. }, null);
  22. };
  23. }
  24. export default renderExpandIcon;