ExpandIcon.js
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var React = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
function renderExpandIcon(locale) {
return function expandIcon(_ref) {
var _classNames;
var prefixCls = _ref.prefixCls,
onExpand = _ref.onExpand,
record = _ref.record,
expanded = _ref.expanded,
expandable = _ref.expandable;
var iconPrefix = "".concat(prefixCls, "-row-expand-icon");
return /*#__PURE__*/React.createElement("button", {
type: "button",
onClick: function onClick(e) {
onExpand(record, e);
e.stopPropagation();
},
className: (0, _classnames["default"])(iconPrefix, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, "".concat(iconPrefix, "-spaced"), !expandable), (0, _defineProperty2["default"])(_classNames, "".concat(iconPrefix, "-expanded"), expandable && expanded), (0, _defineProperty2["default"])(_classNames, "".concat(iconPrefix, "-collapsed"), expandable && !expanded), _classNames)),
"aria-label": expanded ? locale.collapse : locale.expand
});
};
}
var _default = renderExpandIcon;
exports["default"] = _default;