iconUtil.js
2.67 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getIcons;
var React = _interopRequireWildcard(require("react"));
var _DownOutlined = _interopRequireDefault(require("@ant-design/icons/DownOutlined"));
var _LoadingOutlined = _interopRequireDefault(require("@ant-design/icons/LoadingOutlined"));
var _CheckOutlined = _interopRequireDefault(require("@ant-design/icons/CheckOutlined"));
var _CloseOutlined = _interopRequireDefault(require("@ant-design/icons/CloseOutlined"));
var _CloseCircleFilled = _interopRequireDefault(require("@ant-design/icons/CloseCircleFilled"));
var _SearchOutlined = _interopRequireDefault(require("@ant-design/icons/SearchOutlined"));
function getIcons(_ref) {
var suffixIcon = _ref.suffixIcon,
clearIcon = _ref.clearIcon,
menuItemSelectedIcon = _ref.menuItemSelectedIcon,
removeIcon = _ref.removeIcon,
loading = _ref.loading,
multiple = _ref.multiple,
prefixCls = _ref.prefixCls;
// Clear Icon
var mergedClearIcon = clearIcon;
if (!clearIcon) {
mergedClearIcon = /*#__PURE__*/React.createElement(_CloseCircleFilled["default"], null);
} // Arrow item icon
var mergedSuffixIcon = null;
if (suffixIcon !== undefined) {
mergedSuffixIcon = suffixIcon;
} else if (loading) {
mergedSuffixIcon = /*#__PURE__*/React.createElement(_LoadingOutlined["default"], {
spin: true
});
} else {
var iconCls = "".concat(prefixCls, "-suffix");
mergedSuffixIcon = function mergedSuffixIcon(_ref2) {
var open = _ref2.open,
showSearch = _ref2.showSearch;
if (open && showSearch) {
return /*#__PURE__*/React.createElement(_SearchOutlined["default"], {
className: iconCls
});
}
return /*#__PURE__*/React.createElement(_DownOutlined["default"], {
className: iconCls
});
};
} // Checked item icon
var mergedItemIcon = null;
if (menuItemSelectedIcon !== undefined) {
mergedItemIcon = menuItemSelectedIcon;
} else if (multiple) {
mergedItemIcon = /*#__PURE__*/React.createElement(_CheckOutlined["default"], null);
} else {
mergedItemIcon = null;
}
var mergedRemoveIcon = null;
if (removeIcon !== undefined) {
mergedRemoveIcon = removeIcon;
} else {
mergedRemoveIcon = /*#__PURE__*/React.createElement(_CloseOutlined["default"], null);
}
return {
clearIcon: mergedClearIcon,
suffixIcon: mergedSuffixIcon,
itemIcon: mergedItemIcon,
removeIcon: mergedRemoveIcon
};
}