antd3-esm 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Checkbox.js +164 -0
  3. package/dist/CommonMixin.js +816 -0
  4. package/dist/Divider.js +646 -0
  5. package/dist/Notification.js +279 -0
  6. package/dist/Pagination.js +1106 -0
  7. package/dist/PortalWrapper.js +347 -0
  8. package/dist/RowContext.js +5 -0
  9. package/dist/Sider.js +533 -0
  10. package/dist/TextArea.js +432 -0
  11. package/dist/_arrayMap.js +68 -0
  12. package/dist/_assignValue.js +95 -0
  13. package/dist/_copyArray.js +31 -0
  14. package/dist/_hasPath.js +53 -0
  15. package/dist/_overArg.js +437 -0
  16. package/dist/_stringToArray.js +136 -0
  17. package/dist/antd/es/affix.js +12 -0
  18. package/dist/antd/es/alert.js +5 -0
  19. package/dist/antd/es/anchor.js +466 -0
  20. package/dist/antd/es/auto-complete.js +5 -0
  21. package/dist/antd/es/avatar.js +5 -0
  22. package/dist/antd/es/back-top.js +5 -0
  23. package/dist/antd/es/badge.js +5 -0
  24. package/dist/antd/es/breadcrumb.js +18 -0
  25. package/dist/antd/es/button.js +12 -0
  26. package/dist/antd/es/calendar.js +953 -0
  27. package/dist/antd/es/card.js +5 -0
  28. package/dist/antd/es/carousel.js +5 -0
  29. package/dist/antd/es/cascader.js +1275 -0
  30. package/dist/antd/es/checkbox.js +11 -0
  31. package/dist/antd/es/col.js +4 -0
  32. package/dist/antd/es/collapse.js +688 -0
  33. package/dist/antd/es/comment.js +5 -0
  34. package/dist/antd/es/config-provider.js +2 -0
  35. package/dist/antd/es/date-picker.js +4322 -0
  36. package/dist/antd/es/descriptions.js +342 -0
  37. package/dist/antd/es/divider.js +53 -0
  38. package/dist/antd/es/drawer.js +1115 -0
  39. package/dist/antd/es/dropdown.js +14 -0
  40. package/dist/antd/es/empty.js +6 -0
  41. package/dist/antd/es/form.js +5008 -0
  42. package/dist/antd/es/grid.js +13 -0
  43. package/dist/antd/es/icon.js +6 -0
  44. package/dist/antd/es/input-number.js +5 -0
  45. package/dist/antd/es/input.js +16 -0
  46. package/dist/antd/es/layout.js +14 -0
  47. package/dist/antd/es/list.js +5 -0
  48. package/dist/antd/es/locale/ar_EG.js +102 -0
  49. package/dist/antd/es/locale/bg_BG.js +98 -0
  50. package/dist/antd/es/locale/ca_ES.js +96 -0
  51. package/dist/antd/es/locale/cs_CZ.js +96 -0
  52. package/dist/antd/es/locale/da_DK.js +98 -0
  53. package/dist/antd/es/locale/de_DE.js +98 -0
  54. package/dist/antd/es/locale/default.js +2 -0
  55. package/dist/antd/es/locale/el_GR.js +98 -0
  56. package/dist/antd/es/locale/en_GB.js +98 -0
  57. package/dist/antd/es/locale/en_US.js +2 -0
  58. package/dist/antd/es/locale/es_ES.js +114 -0
  59. package/dist/antd/es/locale/et_EE.js +98 -0
  60. package/dist/antd/es/locale/fa_IR.js +98 -0
  61. package/dist/antd/es/locale/fi_FI.js +99 -0
  62. package/dist/antd/es/locale/fr_BE.js +102 -0
  63. package/dist/antd/es/locale/fr_FR.js +102 -0
  64. package/dist/antd/es/locale/ga_IE.js +99 -0
  65. package/dist/antd/es/locale/he_IL.js +99 -0
  66. package/dist/antd/es/locale/hi_IN.js +107 -0
  67. package/dist/antd/es/locale/hr_HR.js +113 -0
  68. package/dist/antd/es/locale/hu_HU.js +99 -0
  69. package/dist/antd/es/locale/hy_AM.js +109 -0
  70. package/dist/antd/es/locale/id_ID.js +101 -0
  71. package/dist/antd/es/locale/is_IS.js +98 -0
  72. package/dist/antd/es/locale/it_IT.js +111 -0
  73. package/dist/antd/es/locale/ja_JP.js +96 -0
  74. package/dist/antd/es/locale/kn_IN.js +107 -0
  75. package/dist/antd/es/locale/ko_KR.js +98 -0
  76. package/dist/antd/es/locale/ku_IQ.js +98 -0
  77. package/dist/antd/es/locale/lv_LV.js +98 -0
  78. package/dist/antd/es/locale/mk_MK.js +113 -0
  79. package/dist/antd/es/locale/mn_MN.js +99 -0
  80. package/dist/antd/es/locale/ms_MY.js +118 -0
  81. package/dist/antd/es/locale/nb_NO.js +97 -0
  82. package/dist/antd/es/locale/ne_NP.js +44 -0
  83. package/dist/antd/es/locale/nl_BE.js +98 -0
  84. package/dist/antd/es/locale/nl_NL.js +117 -0
  85. package/dist/antd/es/locale/pl_PL.js +98 -0
  86. package/dist/antd/es/locale/pt_BR.js +104 -0
  87. package/dist/antd/es/locale/pt_PT.js +127 -0
  88. package/dist/antd/es/locale/ro_RO.js +118 -0
  89. package/dist/antd/es/locale/ru_RU.js +110 -0
  90. package/dist/antd/es/locale/sk_SK.js +118 -0
  91. package/dist/antd/es/locale/sl_SI.js +96 -0
  92. package/dist/antd/es/locale/sr_RS.js +97 -0
  93. package/dist/antd/es/locale/sv_SE.js +101 -0
  94. package/dist/antd/es/locale/ta_IN.js +119 -0
  95. package/dist/antd/es/locale/th_TH.js +117 -0
  96. package/dist/antd/es/locale/tr_TR.js +112 -0
  97. package/dist/antd/es/locale/uk_UA.js +97 -0
  98. package/dist/antd/es/locale/vi_VN.js +99 -0
  99. package/dist/antd/es/locale/zh_CN.js +104 -0
  100. package/dist/antd/es/locale/zh_TW.js +100 -0
  101. package/dist/antd/es/locale-provider.js +6 -0
  102. package/dist/antd/es/mention.js +23215 -0
  103. package/dist/antd/es/mentions.js +961 -0
  104. package/dist/antd/es/menu.js +5 -0
  105. package/dist/antd/es/message.js +161 -0
  106. package/dist/antd/es/modal.js +885 -0
  107. package/dist/antd/es/notification.js +216 -0
  108. package/dist/antd/es/page-header.js +350 -0
  109. package/dist/antd/es/pagination.js +15 -0
  110. package/dist/antd/es/popconfirm.js +215 -0
  111. package/dist/antd/es/popover.js +5 -0
  112. package/dist/antd/es/progress.js +10 -0
  113. package/dist/antd/es/radio.js +10 -0
  114. package/dist/antd/es/rate.js +5 -0
  115. package/dist/antd/es/result.js +828 -0
  116. package/dist/antd/es/row.js +9 -0
  117. package/dist/antd/es/select.js +5 -0
  118. package/dist/antd/es/skeleton.js +370 -0
  119. package/dist/antd/es/slider.js +5 -0
  120. package/dist/antd/es/spin.js +11 -0
  121. package/dist/antd/es/statistic.js +650 -0
  122. package/dist/antd/es/steps.js +5 -0
  123. package/dist/antd/es/style.js +5 -0
  124. package/dist/antd/es/switch.js +5 -0
  125. package/dist/antd/es/table.js +7057 -0
  126. package/dist/antd/es/tabs.js +5 -0
  127. package/dist/antd/es/tag.js +12 -0
  128. package/dist/antd/es/time-picker.js +10 -0
  129. package/dist/antd/es/timeline.js +206 -0
  130. package/dist/antd/es/tooltip.js +9 -0
  131. package/dist/antd/es/transfer.js +2508 -0
  132. package/dist/antd/es/tree-select.js +5 -0
  133. package/dist/antd/es/tree.js +10 -0
  134. package/dist/antd/es/typography.js +1246 -0
  135. package/dist/antd/es/upload.js +3418 -0
  136. package/dist/antd/es/version.js +7 -0
  137. package/dist/col.js +142 -0
  138. package/dist/config-provider.js +6949 -0
  139. package/dist/dropdown.js +442 -0
  140. package/dist/get.js +1043 -0
  141. package/dist/icon.js +6138 -0
  142. package/dist/identity.js +230 -0
  143. package/dist/index.js +462 -0
  144. package/dist/index10.js +478 -0
  145. package/dist/index11.js +232 -0
  146. package/dist/index12.js +2766 -0
  147. package/dist/index13.js +422 -0
  148. package/dist/index14.js +283 -0
  149. package/dist/index15.js +1755 -0
  150. package/dist/index2.js +374 -0
  151. package/dist/index3.js +407 -0
  152. package/dist/index4.js +522 -0
  153. package/dist/index5.js +601 -0
  154. package/dist/index6.js +601 -0
  155. package/dist/index7.js +364 -0
  156. package/dist/index8.js +436 -0
  157. package/dist/index9.js +130 -0
  158. package/dist/input.js +475 -0
  159. package/dist/isLength.js +402 -0
  160. package/dist/keys.js +292 -0
  161. package/dist/menu.js +8138 -0
  162. package/dist/progress.js +852 -0
  163. package/dist/raf.js +34 -0
  164. package/dist/responsiveObserve.js +444 -0
  165. package/dist/row.js +173 -0
  166. package/dist/scrollTo.js +66 -0
  167. package/dist/toInteger.js +123 -0
  168. package/dist/toString.js +84 -0
  169. package/dist/transButton.js +121 -0
  170. package/dist/tree.js +3017 -0
  171. package/dist/warning.js +55 -0
  172. package/dist/wave.js +230 -0
  173. package/dist/zh_CN.js +17 -0
  174. package/package.json +160 -0
@@ -0,0 +1,2766 @@
1
+ import * as React from 'react';
2
+ import React__default, { Component } from 'react';
3
+ import { p as propTypesExports, c as classNames, C as ConfigConsumer } from './config-provider.js';
4
+ import { r as raf, b as Trigger, K as KeyCode, i as classes, A as Animate, p as polyfill } from './menu.js';
5
+ import { a as Menu, c as connected, M as MenuItemGroup } from './Divider.js';
6
+ import { t as toArray$1, w as warning } from './tree.js';
7
+ import * as ReactDOM from 'react-dom';
8
+ import { findDOMNode } from 'react-dom';
9
+ import { s as scrollIntoView } from './index5.js';
10
+ import { o as omit, t as tuple } from './input.js';
11
+ import { I as Icon } from './icon.js';
12
+
13
+ function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+
15
+ function _possibleConstructorReturn$5(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$5(self); }
16
+
17
+ function _assertThisInitialized$5(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+
19
+ function _getPrototypeOf$5(o) { _getPrototypeOf$5 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$5(o); }
20
+
21
+ function _inherits$5(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$5(subClass, superClass); }
22
+
23
+ function _setPrototypeOf$5(o, p) { _setPrototypeOf$5 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$5(o, p); }
24
+
25
+ var OptGroup =
26
+ /*#__PURE__*/
27
+ function (_Component) {
28
+ _inherits$5(OptGroup, _Component);
29
+
30
+ function OptGroup() {
31
+ _classCallCheck$5(this, OptGroup);
32
+
33
+ return _possibleConstructorReturn$5(this, _getPrototypeOf$5(OptGroup).apply(this, arguments));
34
+ }
35
+
36
+ return OptGroup;
37
+ }(Component);
38
+ OptGroup.isSelectOptGroup = true;
39
+
40
+ function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41
+
42
+ function _possibleConstructorReturn$4(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$4(self); }
43
+
44
+ function _assertThisInitialized$4(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
+
46
+ function _getPrototypeOf$4(o) { _getPrototypeOf$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$4(o); }
47
+
48
+ function _inherits$4(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$4(subClass, superClass); }
49
+
50
+ function _setPrototypeOf$4(o, p) { _setPrototypeOf$4 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$4(o, p); }
51
+
52
+ var Option =
53
+ /*#__PURE__*/
54
+ function (_Component) {
55
+ _inherits$4(Option, _Component);
56
+
57
+ function Option() {
58
+ _classCallCheck$4(this, Option);
59
+
60
+ return _possibleConstructorReturn$4(this, _getPrototypeOf$4(Option).apply(this, arguments));
61
+ }
62
+
63
+ return Option;
64
+ }(Component);
65
+ Option.propTypes = {
66
+ value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number])
67
+ };
68
+ Option.isSelectOption = true;
69
+
70
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
71
+
72
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
73
+
74
+ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
75
+
76
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
77
+
78
+ function propsValueType() {
79
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
80
+ args[_key] = arguments[_key];
81
+ }
82
+
83
+ var props = args[0],
84
+ propName = args[1],
85
+ componentName = args[2],
86
+ rest = args.slice(3);
87
+ var basicType = propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number]);
88
+ var labelInValueShape = propTypesExports.shape({
89
+ key: basicType.isRequired,
90
+ label: propTypesExports.node
91
+ });
92
+
93
+ if (props.labelInValue) {
94
+ var validate = propTypesExports.oneOfType([propTypesExports.arrayOf(labelInValueShape), labelInValueShape]);
95
+ var error = validate.apply(void 0, [props, propName, componentName].concat(_toConsumableArray(rest)));
96
+
97
+ if (error) {
98
+ return new Error("Invalid prop `".concat(propName, "` supplied to `").concat(componentName, "`, ") + "when you set `labelInValue` to `true`, `".concat(propName, "` should in ") + "shape of `{ key: string | number, label?: ReactNode }`.");
99
+ }
100
+ } else if ((props.mode === 'multiple' || props.mode === 'tags' || props.multiple || props.tags) && props[propName] === '') {
101
+ return new Error("Invalid prop `".concat(propName, "` of type `string` supplied to `").concat(componentName, "`, ") + "expected `array` when `multiple` or `tags` is `true`.");
102
+ } else {
103
+ var _validate = propTypesExports.oneOfType([propTypesExports.arrayOf(basicType), basicType]);
104
+
105
+ return _validate.apply(void 0, [props, propName, componentName].concat(_toConsumableArray(rest)));
106
+ }
107
+
108
+ return null;
109
+ }
110
+
111
+ var SelectPropTypes$1 = {
112
+ id: propTypesExports.string,
113
+ defaultActiveFirstOption: propTypesExports.bool,
114
+ multiple: propTypesExports.bool,
115
+ filterOption: propTypesExports.any,
116
+ children: propTypesExports.any,
117
+ showSearch: propTypesExports.bool,
118
+ disabled: propTypesExports.bool,
119
+ allowClear: propTypesExports.bool,
120
+ showArrow: propTypesExports.bool,
121
+ tags: propTypesExports.bool,
122
+ prefixCls: propTypesExports.string,
123
+ className: propTypesExports.string,
124
+ transitionName: propTypesExports.string,
125
+ optionLabelProp: propTypesExports.string,
126
+ optionFilterProp: propTypesExports.string,
127
+ animation: propTypesExports.string,
128
+ choiceTransitionName: propTypesExports.string,
129
+ open: propTypesExports.bool,
130
+ defaultOpen: propTypesExports.bool,
131
+ onChange: propTypesExports.func,
132
+ onBlur: propTypesExports.func,
133
+ onFocus: propTypesExports.func,
134
+ onSelect: propTypesExports.func,
135
+ onSearch: propTypesExports.func,
136
+ onPopupScroll: propTypesExports.func,
137
+ onMouseEnter: propTypesExports.func,
138
+ onMouseLeave: propTypesExports.func,
139
+ onInputKeyDown: propTypesExports.func,
140
+ placeholder: propTypesExports.any,
141
+ onDeselect: propTypesExports.func,
142
+ labelInValue: propTypesExports.bool,
143
+ loading: propTypesExports.bool,
144
+ value: propsValueType,
145
+ defaultValue: propsValueType,
146
+ dropdownStyle: propTypesExports.object,
147
+ maxTagTextLength: propTypesExports.number,
148
+ maxTagCount: propTypesExports.number,
149
+ maxTagPlaceholder: propTypesExports.oneOfType([propTypesExports.node, propTypesExports.func]),
150
+ tokenSeparators: propTypesExports.arrayOf(propTypesExports.string),
151
+ getInputElement: propTypesExports.func,
152
+ showAction: propTypesExports.arrayOf(propTypesExports.string),
153
+ clearIcon: propTypesExports.node,
154
+ inputIcon: propTypesExports.node,
155
+ removeIcon: propTypesExports.node,
156
+ menuItemSelectedIcon: propTypesExports.oneOfType([propTypesExports.func, propTypesExports.node]),
157
+ dropdownRender: propTypesExports.func
158
+ };
159
+
160
+ function toTitle(title) {
161
+ if (typeof title === 'string') {
162
+ return title;
163
+ }
164
+
165
+ return '';
166
+ }
167
+ function getValuePropValue(child) {
168
+ if (!child) {
169
+ return null;
170
+ }
171
+
172
+ var props = child.props;
173
+
174
+ if ('value' in props) {
175
+ return props.value;
176
+ }
177
+
178
+ if (child.key) {
179
+ return child.key;
180
+ }
181
+
182
+ if (child.type && child.type.isSelectOptGroup && props.label) {
183
+ return props.label;
184
+ }
185
+
186
+ throw new Error("Need at least a key or a value or a label (only for OptGroup) for ".concat(child));
187
+ }
188
+ function getPropValue(child, prop) {
189
+ if (prop === 'value') {
190
+ return getValuePropValue(child);
191
+ }
192
+
193
+ return child.props[prop];
194
+ }
195
+ function isMultiple(props) {
196
+ return props.multiple;
197
+ }
198
+ function isCombobox(props) {
199
+ return props.combobox;
200
+ }
201
+ function isMultipleOrTags(props) {
202
+ return props.multiple || props.tags;
203
+ }
204
+ function isMultipleOrTagsOrCombobox(props) {
205
+ return isMultipleOrTags(props) || isCombobox(props);
206
+ }
207
+ function isSingleMode(props) {
208
+ return !isMultipleOrTagsOrCombobox(props);
209
+ }
210
+ function toArray(value) {
211
+ var ret = value;
212
+
213
+ if (value === undefined) {
214
+ ret = [];
215
+ } else if (!Array.isArray(value)) {
216
+ ret = [value];
217
+ }
218
+
219
+ return ret;
220
+ }
221
+ function getMapKey(value) {
222
+ return "".concat(typeof value, "-").concat(value);
223
+ }
224
+ function preventDefaultEvent(e) {
225
+ e.preventDefault();
226
+ }
227
+ function findIndexInValueBySingleValue(value, singleValue) {
228
+ var index = -1;
229
+
230
+ if (value) {
231
+ for (var i = 0; i < value.length; i++) {
232
+ if (value[i] === singleValue) {
233
+ index = i;
234
+ break;
235
+ }
236
+ }
237
+ }
238
+
239
+ return index;
240
+ }
241
+ function getLabelFromPropsValue(value, key) {
242
+ var label;
243
+ value = toArray(value);
244
+
245
+ if (value) {
246
+ // tslint:disable-next-line:prefer-for-of
247
+ for (var i = 0; i < value.length; i++) {
248
+ if (value[i].key === key) {
249
+ label = value[i].label;
250
+ break;
251
+ }
252
+ }
253
+ }
254
+
255
+ return label;
256
+ }
257
+ function getSelectKeys(menuItems, value) {
258
+ if (value === null || value === undefined) {
259
+ return [];
260
+ }
261
+
262
+ var selectedKeys = [];
263
+ React__default.Children.forEach(menuItems, function (item) {
264
+ var type = item.type;
265
+
266
+ if (type.isMenuItemGroup) {
267
+ selectedKeys = selectedKeys.concat(getSelectKeys(item.props.children, value));
268
+ } else {
269
+ var itemValue = getValuePropValue(item);
270
+ var itemKey = item.key;
271
+
272
+ if (findIndexInValueBySingleValue(value, itemValue) !== -1 && itemKey) {
273
+ selectedKeys.push(itemKey);
274
+ }
275
+ }
276
+ });
277
+ return selectedKeys;
278
+ }
279
+ var UNSELECTABLE_STYLE = {
280
+ userSelect: 'none',
281
+ WebkitUserSelect: 'none'
282
+ };
283
+ var UNSELECTABLE_ATTRIBUTE = {
284
+ unselectable: 'on'
285
+ };
286
+ function findFirstMenuItem(children) {
287
+ // tslint:disable-next-line:prefer-for-of
288
+ for (var i = 0; i < children.length; i++) {
289
+ var child = children[i];
290
+
291
+ if (child.type.isMenuItemGroup) {
292
+ var found = findFirstMenuItem(child.props.children);
293
+
294
+ if (found) {
295
+ return found;
296
+ }
297
+ } else if (!child.props.disabled) {
298
+ return child;
299
+ }
300
+ }
301
+
302
+ return null;
303
+ }
304
+ function includesSeparators(str, separators) {
305
+ // tslint:disable-next-line:prefer-for-of
306
+ for (var i = 0; i < separators.length; ++i) {
307
+ if (str.lastIndexOf(separators[i]) > 0) {
308
+ return true;
309
+ }
310
+ }
311
+
312
+ return false;
313
+ }
314
+ function splitBySeparators(str, separators) {
315
+ var reg = new RegExp("[".concat(separators.join(), "]"));
316
+ return str.split(reg).filter(function (token) {
317
+ return token;
318
+ });
319
+ }
320
+ function defaultFilterFn(input, child) {
321
+ if (child.props.disabled) {
322
+ return false;
323
+ }
324
+
325
+ var value = toArray(getPropValue(child, this.props.optionFilterProp)).join('');
326
+ return value.toLowerCase().indexOf(input.toLowerCase()) > -1;
327
+ }
328
+ function validateOptionValue(value, props) {
329
+ if (isSingleMode(props) || isMultiple(props)) {
330
+ return;
331
+ }
332
+
333
+ if (typeof value !== 'string') {
334
+ throw new Error("Invalid `value` of type `".concat(typeof value, "` supplied to Option, ") + "expected `string` when `tags/combobox` is `true`.");
335
+ }
336
+ }
337
+ function saveRef(instance, name) {
338
+ return function (node) {
339
+ instance[name] = node;
340
+ };
341
+ }
342
+ function generateUUID() {
343
+
344
+ var d = new Date().getTime();
345
+ var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
346
+ // tslint:disable-next-line:no-bitwise
347
+ var r = (d + Math.random() * 16) % 16 | 0;
348
+ d = Math.floor(d / 16); // tslint:disable-next-line:no-bitwise
349
+
350
+ return (c === 'x' ? r : r & 0x7 | 0x8).toString(16);
351
+ });
352
+ return uuid;
353
+ }
354
+
355
+ function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
356
+
357
+ function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
358
+
359
+ function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
360
+
361
+ function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); return Constructor; }
362
+
363
+ function _possibleConstructorReturn$3(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$3(self); }
364
+
365
+ function _getPrototypeOf$3(o) { _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$3(o); }
366
+
367
+ function _assertThisInitialized$3(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
368
+
369
+ function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$3(subClass, superClass); }
370
+
371
+ function _setPrototypeOf$3(o, p) { _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$3(o, p); }
372
+
373
+ var DropdownMenu =
374
+ /*#__PURE__*/
375
+ function (_React$Component) {
376
+ _inherits$3(DropdownMenu, _React$Component);
377
+
378
+ function DropdownMenu(props) {
379
+ var _this;
380
+
381
+ _classCallCheck$3(this, DropdownMenu);
382
+
383
+ _this = _possibleConstructorReturn$3(this, _getPrototypeOf$3(DropdownMenu).call(this, props));
384
+ _this.rafInstance = null;
385
+ _this.lastVisible = false;
386
+
387
+ _this.scrollActiveItemToView = function () {
388
+ // scroll into view
389
+ var itemComponent = findDOMNode(_this.firstActiveItem);
390
+ var _this$props = _this.props,
391
+ visible = _this$props.visible,
392
+ firstActiveValue = _this$props.firstActiveValue;
393
+ var value = _this.props.value;
394
+
395
+ if (!itemComponent || !visible) {
396
+ return;
397
+ }
398
+
399
+ var scrollIntoViewOpts = {
400
+ onlyScrollIfNeeded: true
401
+ };
402
+
403
+ if ((!value || value.length === 0) && firstActiveValue) {
404
+ scrollIntoViewOpts.alignWithTop = true;
405
+ } // Delay to scroll since current frame item position is not ready when pre view is by filter
406
+ // https://github.com/ant-design/ant-design/issues/11268#issuecomment-406634462
407
+
408
+
409
+ _this.rafInstance = raf(function () {
410
+ scrollIntoView(itemComponent, findDOMNode(_this.menuRef), scrollIntoViewOpts);
411
+ });
412
+ };
413
+
414
+ _this.renderMenu = function () {
415
+ var _this$props2 = _this.props,
416
+ menuItems = _this$props2.menuItems,
417
+ menuItemSelectedIcon = _this$props2.menuItemSelectedIcon,
418
+ defaultActiveFirstOption = _this$props2.defaultActiveFirstOption,
419
+ prefixCls = _this$props2.prefixCls,
420
+ multiple = _this$props2.multiple,
421
+ onMenuSelect = _this$props2.onMenuSelect,
422
+ inputValue = _this$props2.inputValue,
423
+ backfillValue = _this$props2.backfillValue,
424
+ onMenuDeselect = _this$props2.onMenuDeselect,
425
+ visible = _this$props2.visible;
426
+ var firstActiveValue = _this.props.firstActiveValue;
427
+
428
+ if (menuItems && menuItems.length) {
429
+ var menuProps = {};
430
+
431
+ if (multiple) {
432
+ menuProps.onDeselect = onMenuDeselect;
433
+ menuProps.onSelect = onMenuSelect;
434
+ } else {
435
+ menuProps.onClick = onMenuSelect;
436
+ }
437
+
438
+ var value = _this.props.value;
439
+ var selectedKeys = getSelectKeys(menuItems, value);
440
+ var activeKeyProps = {};
441
+ var defaultActiveFirst = defaultActiveFirstOption;
442
+ var clonedMenuItems = menuItems;
443
+
444
+ if (selectedKeys.length || firstActiveValue) {
445
+ if (visible && !_this.lastVisible) {
446
+ activeKeyProps.activeKey = selectedKeys[0] || firstActiveValue;
447
+ } else if (!visible) {
448
+ // Do not trigger auto active since we already have selectedKeys
449
+ if (selectedKeys[0]) {
450
+ defaultActiveFirst = false;
451
+ }
452
+
453
+ activeKeyProps.activeKey = undefined;
454
+ }
455
+
456
+ var foundFirst = false; // set firstActiveItem via cloning menus
457
+ // for scroll into view
458
+
459
+ var clone = function clone(item) {
460
+ var key = item.key;
461
+
462
+ if (!foundFirst && selectedKeys.indexOf(key) !== -1 || !foundFirst && !selectedKeys.length && firstActiveValue.indexOf(item.key) !== -1) {
463
+ foundFirst = true;
464
+ return React.cloneElement(item, {
465
+ ref: function ref(_ref) {
466
+ _this.firstActiveItem = _ref;
467
+ }
468
+ });
469
+ }
470
+
471
+ return item;
472
+ };
473
+
474
+ clonedMenuItems = menuItems.map(function (item) {
475
+ if (item.type.isMenuItemGroup) {
476
+ var children = toArray$1(item.props.children).map(clone);
477
+ return React.cloneElement(item, {}, children);
478
+ }
479
+
480
+ return clone(item);
481
+ });
482
+ } else {
483
+ // Clear firstActiveItem when dropdown menu items was empty
484
+ // Avoid `Unable to find node on an unmounted component`
485
+ // https://github.com/ant-design/ant-design/issues/10774
486
+ _this.firstActiveItem = null;
487
+ } // clear activeKey when inputValue change
488
+
489
+
490
+ var lastValue = value && value[value.length - 1];
491
+
492
+ if (inputValue !== _this.lastInputValue && (!lastValue || lastValue !== backfillValue)) {
493
+ activeKeyProps.activeKey = '';
494
+ }
495
+
496
+ return React.createElement(Menu, _extends$3({
497
+ ref: _this.saveMenuRef,
498
+ style: _this.props.dropdownMenuStyle,
499
+ defaultActiveFirst: defaultActiveFirst,
500
+ role: "listbox",
501
+ itemIcon: multiple ? menuItemSelectedIcon : null
502
+ }, activeKeyProps, {
503
+ multiple: multiple
504
+ }, menuProps, {
505
+ selectedKeys: selectedKeys,
506
+ prefixCls: "".concat(prefixCls, "-menu")
507
+ }), clonedMenuItems);
508
+ }
509
+
510
+ return null;
511
+ };
512
+
513
+ _this.lastInputValue = props.inputValue;
514
+ _this.saveMenuRef = saveRef(_assertThisInitialized$3(_this), 'menuRef');
515
+ return _this;
516
+ }
517
+
518
+ _createClass$3(DropdownMenu, [{
519
+ key: "componentDidMount",
520
+ value: function componentDidMount() {
521
+ this.scrollActiveItemToView();
522
+ this.lastVisible = this.props.visible;
523
+ }
524
+ }, {
525
+ key: "shouldComponentUpdate",
526
+ value: function shouldComponentUpdate(nextProps) {
527
+ if (!nextProps.visible) {
528
+ this.lastVisible = false;
529
+ } // freeze when hide
530
+
531
+
532
+ return this.props.visible && !nextProps.visible || nextProps.visible || nextProps.inputValue !== this.props.inputValue;
533
+ }
534
+ }, {
535
+ key: "componentDidUpdate",
536
+ value: function componentDidUpdate(prevProps) {
537
+ var props = this.props;
538
+
539
+ if (!prevProps.visible && props.visible) {
540
+ this.scrollActiveItemToView();
541
+ }
542
+
543
+ this.lastVisible = props.visible;
544
+ this.lastInputValue = props.inputValue;
545
+ }
546
+ }, {
547
+ key: "componentWillUnmount",
548
+ value: function componentWillUnmount() {
549
+ if (this.rafInstance) {
550
+ raf.cancel(this.rafInstance);
551
+ }
552
+ }
553
+ }, {
554
+ key: "render",
555
+ value: function render() {
556
+ var renderMenu = this.renderMenu();
557
+ return renderMenu ? React.createElement("div", {
558
+ style: {
559
+ overflow: 'auto',
560
+ transform: 'translateZ(0)'
561
+ },
562
+ id: this.props.ariaId,
563
+ onFocus: this.props.onPopupFocus,
564
+ onMouseDown: preventDefaultEvent,
565
+ onScroll: this.props.onPopupScroll
566
+ }, renderMenu) : null;
567
+ }
568
+ }]);
569
+
570
+ return DropdownMenu;
571
+ }(React.Component);
572
+ DropdownMenu.displayName = 'DropdownMenu';
573
+ DropdownMenu.propTypes = {
574
+ ariaId: propTypesExports.string,
575
+ defaultActiveFirstOption: propTypesExports.bool,
576
+ value: propTypesExports.any,
577
+ dropdownMenuStyle: propTypesExports.object,
578
+ multiple: propTypesExports.bool,
579
+ onPopupFocus: propTypesExports.func,
580
+ onPopupScroll: propTypesExports.func,
581
+ onMenuDeSelect: propTypesExports.func,
582
+ onMenuSelect: propTypesExports.func,
583
+ prefixCls: propTypesExports.string,
584
+ menuItems: propTypesExports.any,
585
+ inputValue: propTypesExports.string,
586
+ visible: propTypesExports.bool,
587
+ firstActiveValue: propTypesExports.string,
588
+ menuItemSelectedIcon: propTypesExports.oneOfType([propTypesExports.func, propTypesExports.node])
589
+ };
590
+
591
+ function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
592
+
593
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
594
+
595
+ function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
596
+
597
+ function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
598
+
599
+ function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
600
+
601
+ function _possibleConstructorReturn$2(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
602
+
603
+ function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
604
+
605
+ function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
606
+
607
+ function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$2(subClass, superClass); }
608
+
609
+ function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
610
+
611
+ var __rest$1 = undefined && undefined.__rest || function (s, e) {
612
+ var t = {};
613
+
614
+ for (var p in s) {
615
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
616
+ }
617
+
618
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
619
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
620
+ }
621
+ return t;
622
+ };
623
+ Trigger.displayName = 'Trigger';
624
+ var BUILT_IN_PLACEMENTS = {
625
+ bottomLeft: {
626
+ points: ['tl', 'bl'],
627
+ offset: [0, 4],
628
+ overflow: {
629
+ adjustX: 0,
630
+ adjustY: 1
631
+ }
632
+ },
633
+ topLeft: {
634
+ points: ['bl', 'tl'],
635
+ offset: [0, -4],
636
+ overflow: {
637
+ adjustX: 0,
638
+ adjustY: 1
639
+ }
640
+ }
641
+ };
642
+
643
+ var SelectTrigger =
644
+ /*#__PURE__*/
645
+ function (_React$Component) {
646
+ _inherits$2(SelectTrigger, _React$Component);
647
+
648
+ function SelectTrigger(props) {
649
+ var _this;
650
+
651
+ _classCallCheck$2(this, SelectTrigger);
652
+
653
+ _this = _possibleConstructorReturn$2(this, _getPrototypeOf$2(SelectTrigger).call(this, props));
654
+ _this.dropdownMenuRef = null;
655
+ _this.rafInstance = null;
656
+
657
+ _this.setDropdownWidth = function () {
658
+ _this.cancelRafInstance();
659
+
660
+ _this.rafInstance = raf(function () {
661
+ var dom = ReactDOM.findDOMNode(_assertThisInitialized$2(_this));
662
+ var width = dom.offsetWidth;
663
+
664
+ if (width !== _this.state.dropdownWidth) {
665
+ _this.setState({
666
+ dropdownWidth: width
667
+ });
668
+ }
669
+ });
670
+ };
671
+
672
+ _this.cancelRafInstance = function () {
673
+ if (_this.rafInstance) {
674
+ raf.cancel(_this.rafInstance);
675
+ }
676
+ };
677
+
678
+ _this.getInnerMenu = function () {
679
+ return _this.dropdownMenuRef && _this.dropdownMenuRef.menuRef;
680
+ };
681
+
682
+ _this.getPopupDOMNode = function () {
683
+ return _this.triggerRef.getPopupDomNode();
684
+ };
685
+
686
+ _this.getDropdownElement = function (newProps) {
687
+ var props = _this.props;
688
+ var dropdownRender = props.dropdownRender,
689
+ ariaId = props.ariaId;
690
+ var menuNode = React.createElement(DropdownMenu, _extends$2({
691
+ ref: _this.saveDropdownMenuRef
692
+ }, newProps, {
693
+ ariaId: ariaId,
694
+ prefixCls: _this.getDropdownPrefixCls(),
695
+ onMenuSelect: props.onMenuSelect,
696
+ onMenuDeselect: props.onMenuDeselect,
697
+ onPopupScroll: props.onPopupScroll,
698
+ value: props.value,
699
+ backfillValue: props.backfillValue,
700
+ firstActiveValue: props.firstActiveValue,
701
+ defaultActiveFirstOption: props.defaultActiveFirstOption,
702
+ dropdownMenuStyle: props.dropdownMenuStyle,
703
+ menuItemSelectedIcon: props.menuItemSelectedIcon
704
+ }));
705
+
706
+ if (dropdownRender) {
707
+ return dropdownRender(menuNode, props);
708
+ }
709
+
710
+ return null;
711
+ };
712
+
713
+ _this.getDropdownTransitionName = function () {
714
+ var props = _this.props;
715
+ var transitionName = props.transitionName;
716
+
717
+ if (!transitionName && props.animation) {
718
+ transitionName = "".concat(_this.getDropdownPrefixCls(), "-").concat(props.animation);
719
+ }
720
+
721
+ return transitionName;
722
+ };
723
+
724
+ _this.getDropdownPrefixCls = function () {
725
+ return "".concat(_this.props.prefixCls, "-dropdown");
726
+ };
727
+
728
+ _this.saveDropdownMenuRef = saveRef(_assertThisInitialized$2(_this), 'dropdownMenuRef');
729
+ _this.saveTriggerRef = saveRef(_assertThisInitialized$2(_this), 'triggerRef');
730
+ _this.state = {
731
+ dropdownWidth: 0
732
+ };
733
+ return _this;
734
+ }
735
+
736
+ _createClass$2(SelectTrigger, [{
737
+ key: "componentDidMount",
738
+ value: function componentDidMount() {
739
+ this.setDropdownWidth();
740
+ }
741
+ }, {
742
+ key: "componentDidUpdate",
743
+ value: function componentDidUpdate() {
744
+ this.setDropdownWidth();
745
+ }
746
+ }, {
747
+ key: "componentWillUnmount",
748
+ value: function componentWillUnmount() {
749
+ this.cancelRafInstance();
750
+ }
751
+ }, {
752
+ key: "render",
753
+ value: function render() {
754
+ var _popupClassName;
755
+
756
+ var _a = this.props,
757
+ onPopupFocus = _a.onPopupFocus,
758
+ empty = _a.empty,
759
+ props = __rest$1(_a, ["onPopupFocus", "empty"]);
760
+
761
+ var multiple = props.multiple,
762
+ visible = props.visible,
763
+ inputValue = props.inputValue,
764
+ dropdownAlign = props.dropdownAlign,
765
+ disabled = props.disabled,
766
+ showSearch = props.showSearch,
767
+ dropdownClassName = props.dropdownClassName,
768
+ dropdownStyle = props.dropdownStyle,
769
+ dropdownMatchSelectWidth = props.dropdownMatchSelectWidth;
770
+ var dropdownPrefixCls = this.getDropdownPrefixCls();
771
+ var popupClassName = (_popupClassName = {}, _defineProperty$2(_popupClassName, dropdownClassName, !!dropdownClassName), _defineProperty$2(_popupClassName, "".concat(dropdownPrefixCls, "--").concat(multiple ? 'multiple' : 'single'), 1), _defineProperty$2(_popupClassName, "".concat(dropdownPrefixCls, "--empty"), empty), _popupClassName);
772
+ var popupElement = this.getDropdownElement({
773
+ menuItems: props.options,
774
+ onPopupFocus: onPopupFocus,
775
+ multiple: multiple,
776
+ inputValue: inputValue,
777
+ visible: visible
778
+ });
779
+ var hideAction;
780
+
781
+ if (disabled) {
782
+ hideAction = [];
783
+ } else if (isSingleMode(props) && !showSearch) {
784
+ hideAction = ['click'];
785
+ } else {
786
+ hideAction = ['blur'];
787
+ }
788
+
789
+ var popupStyle = _extends$2({}, dropdownStyle);
790
+
791
+ var widthProp = dropdownMatchSelectWidth ? 'width' : 'minWidth';
792
+
793
+ if (this.state.dropdownWidth) {
794
+ popupStyle[widthProp] = "".concat(this.state.dropdownWidth, "px");
795
+ }
796
+
797
+ return React.createElement(Trigger, _extends$2({}, props, {
798
+ showAction: disabled ? [] : this.props.showAction,
799
+ hideAction: hideAction,
800
+ ref: this.saveTriggerRef,
801
+ popupPlacement: "bottomLeft",
802
+ builtinPlacements: BUILT_IN_PLACEMENTS,
803
+ prefixCls: dropdownPrefixCls,
804
+ popupTransitionName: this.getDropdownTransitionName(),
805
+ onPopupVisibleChange: props.onDropdownVisibleChange,
806
+ popup: popupElement,
807
+ popupAlign: dropdownAlign,
808
+ popupVisible: visible,
809
+ getPopupContainer: props.getPopupContainer,
810
+ popupClassName: classNames(popupClassName),
811
+ popupStyle: popupStyle
812
+ }), props.children);
813
+ }
814
+ }]);
815
+
816
+ return SelectTrigger;
817
+ }(React.Component);
818
+ SelectTrigger.defaultProps = {
819
+ dropdownRender: function dropdownRender(menu) {
820
+ return menu;
821
+ }
822
+ };
823
+ SelectTrigger.propTypes = {
824
+ onPopupFocus: propTypesExports.func,
825
+ onPopupScroll: propTypesExports.func,
826
+ dropdownMatchSelectWidth: propTypesExports.bool,
827
+ dropdownAlign: propTypesExports.object,
828
+ visible: propTypesExports.bool,
829
+ disabled: propTypesExports.bool,
830
+ showSearch: propTypesExports.bool,
831
+ dropdownClassName: propTypesExports.string,
832
+ multiple: propTypesExports.bool,
833
+ inputValue: propTypesExports.string,
834
+ filterOption: propTypesExports.any,
835
+ options: propTypesExports.any,
836
+ prefixCls: propTypesExports.string,
837
+ popupClassName: propTypesExports.string,
838
+ children: propTypesExports.any,
839
+ showAction: propTypesExports.arrayOf(propTypesExports.string),
840
+ menuItemSelectedIcon: propTypesExports.oneOfType([propTypesExports.func, propTypesExports.node]),
841
+ dropdownRender: propTypesExports.func,
842
+ ariaId: propTypesExports.string
843
+ };
844
+ SelectTrigger.displayName = 'SelectTrigger';
845
+
846
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
847
+
848
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
849
+
850
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
851
+
852
+ function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
853
+
854
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
855
+
856
+ function _possibleConstructorReturn$1(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
857
+
858
+ function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
859
+
860
+ function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
861
+
862
+ function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$1(subClass, superClass); }
863
+
864
+ function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
865
+
866
+ function isHidden(node) {
867
+ return !node || node.offsetParent === null;
868
+ }
869
+ var SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
870
+
871
+ var noop = function noop() {
872
+ return null;
873
+ };
874
+
875
+ function chaining() {
876
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
877
+ fns[_key] = arguments[_key];
878
+ }
879
+
880
+ return function () {
881
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
882
+ args[_key2] = arguments[_key2];
883
+ }
884
+
885
+ // tslint:disable-next-line:prefer-for-of
886
+ for (var i = 0; i < fns.length; i++) {
887
+ if (fns[i] && typeof fns[i] === 'function') {
888
+ fns[i].apply(chaining, args);
889
+ }
890
+ }
891
+ };
892
+ }
893
+
894
+ var Select$1 =
895
+ /*#__PURE__*/
896
+ function (_React$Component) {
897
+ _inherits$1(Select, _React$Component);
898
+
899
+ function Select(props) {
900
+ var _this;
901
+
902
+ _classCallCheck$1(this, Select);
903
+
904
+ _this = _possibleConstructorReturn$1(this, _getPrototypeOf$1(Select).call(this, props));
905
+ _this.inputRef = null;
906
+ _this.inputMirrorRef = null;
907
+ _this.topCtrlRef = null;
908
+ _this.selectTriggerRef = null;
909
+ _this.rootRef = null;
910
+ _this.selectionRef = null;
911
+ _this.dropdownContainer = null;
912
+ _this.blurTimer = null;
913
+ _this.focusTimer = null;
914
+ _this.comboboxTimer = null; // tslint:disable-next-line:variable-name
915
+
916
+ _this._focused = false; // tslint:disable-next-line:variable-name
917
+
918
+ _this._mouseDown = false; // tslint:disable-next-line:variable-name
919
+
920
+ _this._options = []; // tslint:disable-next-line:variable-name
921
+
922
+ _this._empty = false;
923
+
924
+ _this.onInputChange = function (event) {
925
+ var tokenSeparators = _this.props.tokenSeparators;
926
+ var val = event.target.value;
927
+
928
+ if (isMultipleOrTags(_this.props) && tokenSeparators.length && includesSeparators(val, tokenSeparators)) {
929
+ var nextValue = _this.getValueByInput(val);
930
+
931
+ if (nextValue !== undefined) {
932
+ _this.fireChange(nextValue);
933
+ }
934
+
935
+ _this.setOpenState(false, {
936
+ needFocus: true
937
+ });
938
+
939
+ _this.setInputValue('', false);
940
+
941
+ return;
942
+ }
943
+
944
+ _this.setInputValue(val);
945
+
946
+ _this.setState({
947
+ open: true
948
+ });
949
+
950
+ if (isCombobox(_this.props)) {
951
+ _this.fireChange([val]);
952
+ }
953
+ };
954
+
955
+ _this.onDropdownVisibleChange = function (open) {
956
+ if (open && !_this._focused) {
957
+ _this.clearBlurTime();
958
+
959
+ _this.timeoutFocus();
960
+
961
+ _this._focused = true;
962
+
963
+ _this.updateFocusClassName();
964
+ }
965
+
966
+ _this.setOpenState(open);
967
+ }; // combobox ignore
968
+
969
+
970
+ _this.onKeyDown = function (event) {
971
+ var open = _this.state.open;
972
+ var disabled = _this.props.disabled;
973
+
974
+ if (disabled) {
975
+ return;
976
+ }
977
+
978
+ var keyCode = event.keyCode;
979
+
980
+ if (open && !_this.getInputDOMNode()) {
981
+ _this.onInputKeyDown(event);
982
+ } else if (keyCode === KeyCode.ENTER || keyCode === KeyCode.DOWN) {
983
+ if (!open) {
984
+ _this.setOpenState(true);
985
+ }
986
+
987
+ event.preventDefault();
988
+ } else if (keyCode === KeyCode.SPACE) {
989
+ // Not block space if popup is shown
990
+ if (!open) {
991
+ _this.setOpenState(true);
992
+
993
+ event.preventDefault();
994
+ }
995
+ }
996
+ };
997
+
998
+ _this.onInputKeyDown = function (event) {
999
+ var _this$props = _this.props,
1000
+ disabled = _this$props.disabled,
1001
+ combobox = _this$props.combobox,
1002
+ defaultActiveFirstOption = _this$props.defaultActiveFirstOption;
1003
+
1004
+ if (disabled) {
1005
+ return;
1006
+ }
1007
+
1008
+ var state = _this.state;
1009
+
1010
+ var isRealOpen = _this.getRealOpenState(state); // magic code
1011
+
1012
+
1013
+ var keyCode = event.keyCode;
1014
+
1015
+ if (isMultipleOrTags(_this.props) && !event.target.value && keyCode === KeyCode.BACKSPACE) {
1016
+ event.preventDefault();
1017
+ var value = state.value;
1018
+
1019
+ if (value.length) {
1020
+ _this.removeSelected(value[value.length - 1]);
1021
+ }
1022
+
1023
+ return;
1024
+ }
1025
+
1026
+ if (keyCode === KeyCode.DOWN) {
1027
+ if (!state.open) {
1028
+ _this.openIfHasChildren();
1029
+
1030
+ event.preventDefault();
1031
+ event.stopPropagation();
1032
+ return;
1033
+ }
1034
+ } else if (keyCode === KeyCode.ENTER && state.open) {
1035
+ // Aviod trigger form submit when select item
1036
+ // https://github.com/ant-design/ant-design/issues/10861
1037
+ // https://github.com/ant-design/ant-design/issues/14544
1038
+ if (isRealOpen || !combobox) {
1039
+ event.preventDefault();
1040
+ } // Hard close popup to avoid lock of non option in combobox mode
1041
+
1042
+
1043
+ if (isRealOpen && combobox && defaultActiveFirstOption === false) {
1044
+ _this.comboboxTimer = setTimeout(function () {
1045
+ _this.setOpenState(false);
1046
+ });
1047
+ }
1048
+ } else if (keyCode === KeyCode.ESC) {
1049
+ if (state.open) {
1050
+ _this.setOpenState(false);
1051
+
1052
+ event.preventDefault();
1053
+ event.stopPropagation();
1054
+ }
1055
+
1056
+ return;
1057
+ }
1058
+
1059
+ if (isRealOpen && _this.selectTriggerRef) {
1060
+ var menu = _this.selectTriggerRef.getInnerMenu();
1061
+
1062
+ if (menu && menu.onKeyDown(event, _this.handleBackfill)) {
1063
+ event.preventDefault();
1064
+ event.stopPropagation();
1065
+ }
1066
+ }
1067
+ };
1068
+
1069
+ _this.onMenuSelect = function (_ref) {
1070
+ var item = _ref.item;
1071
+
1072
+ if (!item) {
1073
+ return;
1074
+ }
1075
+
1076
+ var value = _this.state.value;
1077
+ var props = _this.props;
1078
+ var selectedValue = getValuePropValue(item);
1079
+ var lastValue = value[value.length - 1];
1080
+ var skipTrigger = false;
1081
+
1082
+ if (isMultipleOrTags(props)) {
1083
+ if (findIndexInValueBySingleValue(value, selectedValue) !== -1) {
1084
+ skipTrigger = true;
1085
+ } else {
1086
+ value = value.concat([selectedValue]);
1087
+ }
1088
+ } else {
1089
+ if (!isCombobox(props) && lastValue !== undefined && lastValue === selectedValue && selectedValue !== _this.state.backfillValue) {
1090
+ _this.setOpenState(false, {
1091
+ needFocus: true,
1092
+ fireSearch: false
1093
+ });
1094
+
1095
+ skipTrigger = true;
1096
+ } else {
1097
+ value = [selectedValue];
1098
+
1099
+ _this.setOpenState(false, {
1100
+ needFocus: true,
1101
+ fireSearch: false
1102
+ });
1103
+ }
1104
+ }
1105
+
1106
+ if (!skipTrigger) {
1107
+ _this.fireChange(value);
1108
+ }
1109
+
1110
+ _this.fireSelect(selectedValue);
1111
+
1112
+ if (!skipTrigger) {
1113
+ var inputValue = isCombobox(props) ? getPropValue(item, props.optionLabelProp) : '';
1114
+
1115
+ if (props.autoClearSearchValue) {
1116
+ _this.setInputValue(inputValue, false);
1117
+ }
1118
+ }
1119
+ };
1120
+
1121
+ _this.onMenuDeselect = function (_ref2) {
1122
+ var item = _ref2.item,
1123
+ domEvent = _ref2.domEvent;
1124
+
1125
+ if (domEvent.type === 'keydown' && domEvent.keyCode === KeyCode.ENTER) {
1126
+ var menuItemDomNode = ReactDOM.findDOMNode(item); // https://github.com/ant-design/ant-design/issues/20465#issuecomment-569033796
1127
+
1128
+ if (!isHidden(menuItemDomNode)) {
1129
+ _this.removeSelected(getValuePropValue(item));
1130
+ }
1131
+
1132
+ return;
1133
+ }
1134
+
1135
+ if (domEvent.type === 'click') {
1136
+ _this.removeSelected(getValuePropValue(item));
1137
+ }
1138
+
1139
+ var props = _this.props;
1140
+
1141
+ if (props.autoClearSearchValue) {
1142
+ _this.setInputValue('');
1143
+ }
1144
+ };
1145
+
1146
+ _this.onArrowClick = function (e) {
1147
+ e.stopPropagation();
1148
+ e.preventDefault();
1149
+
1150
+ if (!_this.props.disabled) {
1151
+ _this.setOpenState(!_this.state.open, {
1152
+ needFocus: !_this.state.open
1153
+ });
1154
+ }
1155
+ };
1156
+
1157
+ _this.onPlaceholderClick = function () {
1158
+ if (_this.getInputDOMNode && _this.getInputDOMNode()) {
1159
+ _this.getInputDOMNode().focus();
1160
+ }
1161
+ };
1162
+
1163
+ _this.onOuterFocus = function (e) {
1164
+ if (_this.props.disabled) {
1165
+ e.preventDefault();
1166
+ return;
1167
+ }
1168
+
1169
+ _this.clearBlurTime(); // In IE11, onOuterFocus will be trigger twice when focus input
1170
+ // First one: e.target is div
1171
+ // Second one: e.target is input
1172
+ // other browser only trigger second one
1173
+ // https://github.com/ant-design/ant-design/issues/15942
1174
+ // Here we ignore the first one when e.target is div
1175
+
1176
+
1177
+ var inputNode = _this.getInputDOMNode();
1178
+
1179
+ if (inputNode && e.target === _this.rootRef) {
1180
+ return;
1181
+ }
1182
+
1183
+ if (!isMultipleOrTagsOrCombobox(_this.props) && e.target === inputNode) {
1184
+ return;
1185
+ }
1186
+
1187
+ if (_this._focused) {
1188
+ return;
1189
+ }
1190
+
1191
+ _this._focused = true;
1192
+
1193
+ _this.updateFocusClassName(); // only effect multiple or tag mode
1194
+
1195
+
1196
+ if (!isMultipleOrTags(_this.props) || !_this._mouseDown) {
1197
+ _this.timeoutFocus();
1198
+ }
1199
+ };
1200
+
1201
+ _this.onPopupFocus = function () {
1202
+ // fix ie scrollbar, focus element again
1203
+ _this.maybeFocus(true, true);
1204
+ };
1205
+
1206
+ _this.onOuterBlur = function (e) {
1207
+ if (_this.props.disabled) {
1208
+ e.preventDefault();
1209
+ return;
1210
+ }
1211
+
1212
+ _this.blurTimer = window.setTimeout(function () {
1213
+ _this._focused = false;
1214
+
1215
+ _this.updateFocusClassName();
1216
+
1217
+ var props = _this.props;
1218
+ var value = _this.state.value;
1219
+ var inputValue = _this.state.inputValue;
1220
+
1221
+ if (isSingleMode(props) && props.showSearch && inputValue && props.defaultActiveFirstOption) {
1222
+ var options = _this._options || [];
1223
+
1224
+ if (options.length) {
1225
+ var firstOption = findFirstMenuItem(options);
1226
+
1227
+ if (firstOption) {
1228
+ value = [getValuePropValue(firstOption)];
1229
+
1230
+ _this.fireChange(value);
1231
+ }
1232
+ }
1233
+ } else if (isMultipleOrTags(props) && inputValue) {
1234
+ if (_this._mouseDown) {
1235
+ // need update dropmenu when not blur
1236
+ _this.setInputValue('');
1237
+ } else {
1238
+ // why not use setState?
1239
+ // https://github.com/ant-design/ant-design/issues/14262
1240
+ _this.state.inputValue = '';
1241
+
1242
+ if (_this.getInputDOMNode && _this.getInputDOMNode()) {
1243
+ _this.getInputDOMNode().value = '';
1244
+ }
1245
+ }
1246
+
1247
+ var tmpValue = _this.getValueByInput(inputValue);
1248
+
1249
+ if (tmpValue !== undefined) {
1250
+ value = tmpValue;
1251
+
1252
+ _this.fireChange(value);
1253
+ }
1254
+ } // if click the rest space of Select in multiple mode
1255
+
1256
+
1257
+ if (isMultipleOrTags(props) && _this._mouseDown) {
1258
+ _this.maybeFocus(true, true);
1259
+
1260
+ _this._mouseDown = false;
1261
+ return;
1262
+ }
1263
+
1264
+ _this.setOpenState(false);
1265
+
1266
+ if (props.onBlur) {
1267
+ props.onBlur(_this.getVLForOnChange(value));
1268
+ }
1269
+ }, 10);
1270
+ };
1271
+
1272
+ _this.onClearSelection = function (event) {
1273
+ var props = _this.props;
1274
+ var state = _this.state;
1275
+
1276
+ if (props.disabled) {
1277
+ return;
1278
+ }
1279
+
1280
+ var inputValue = state.inputValue;
1281
+ var value = state.value;
1282
+ event.stopPropagation();
1283
+
1284
+ if (inputValue || value.length) {
1285
+ if (value.length) {
1286
+ _this.fireChange([]);
1287
+ }
1288
+
1289
+ _this.setOpenState(false, {
1290
+ needFocus: true
1291
+ });
1292
+
1293
+ if (inputValue) {
1294
+ _this.setInputValue('');
1295
+ }
1296
+ }
1297
+ };
1298
+
1299
+ _this.onChoiceAnimationLeave = function () {
1300
+ _this.forcePopupAlign();
1301
+ };
1302
+
1303
+ _this.getOptionInfoBySingleValue = function (value, optionsInfo) {
1304
+ var info;
1305
+ optionsInfo = optionsInfo || _this.state.optionsInfo;
1306
+
1307
+ if (optionsInfo[getMapKey(value)]) {
1308
+ info = optionsInfo[getMapKey(value)];
1309
+ }
1310
+
1311
+ if (info) {
1312
+ return info;
1313
+ }
1314
+
1315
+ var defaultLabel = value;
1316
+
1317
+ if (_this.props.labelInValue) {
1318
+ var valueLabel = getLabelFromPropsValue(_this.props.value, value);
1319
+ var defaultValueLabel = getLabelFromPropsValue(_this.props.defaultValue, value);
1320
+
1321
+ if (valueLabel !== undefined) {
1322
+ defaultLabel = valueLabel;
1323
+ } else if (defaultValueLabel !== undefined) {
1324
+ defaultLabel = defaultValueLabel;
1325
+ }
1326
+ }
1327
+
1328
+ var defaultInfo = {
1329
+ option: React.createElement(Option, {
1330
+ value: value,
1331
+ key: value
1332
+ }, value),
1333
+ value: value,
1334
+ label: defaultLabel
1335
+ };
1336
+ return defaultInfo;
1337
+ };
1338
+
1339
+ _this.getOptionBySingleValue = function (value) {
1340
+ var _this$getOptionInfoBy = _this.getOptionInfoBySingleValue(value),
1341
+ option = _this$getOptionInfoBy.option;
1342
+
1343
+ return option;
1344
+ };
1345
+
1346
+ _this.getOptionsBySingleValue = function (values) {
1347
+ return values.map(function (value) {
1348
+ return _this.getOptionBySingleValue(value);
1349
+ });
1350
+ };
1351
+
1352
+ _this.getValueByLabel = function (label) {
1353
+ if (label === undefined) {
1354
+ return null;
1355
+ }
1356
+
1357
+ var value = null;
1358
+ Object.keys(_this.state.optionsInfo).forEach(function (key) {
1359
+ var info = _this.state.optionsInfo[key];
1360
+ var disabled = info.disabled;
1361
+
1362
+ if (disabled) {
1363
+ return;
1364
+ }
1365
+
1366
+ var oldLable = toArray(info.label);
1367
+
1368
+ if (oldLable && oldLable.join('') === label) {
1369
+ value = info.value;
1370
+ }
1371
+ });
1372
+ return value;
1373
+ };
1374
+
1375
+ _this.getVLBySingleValue = function (value) {
1376
+ if (_this.props.labelInValue) {
1377
+ return {
1378
+ key: value,
1379
+ label: _this.getLabelBySingleValue(value)
1380
+ };
1381
+ }
1382
+
1383
+ return value;
1384
+ };
1385
+
1386
+ _this.getVLForOnChange = function (vlsS) {
1387
+ var vls = vlsS;
1388
+
1389
+ if (vls !== undefined) {
1390
+ if (!_this.props.labelInValue) {
1391
+ vls = vls.map(function (v) {
1392
+ return v;
1393
+ });
1394
+ } else {
1395
+ vls = vls.map(function (vl) {
1396
+ return {
1397
+ key: vl,
1398
+ label: _this.getLabelBySingleValue(vl)
1399
+ };
1400
+ });
1401
+ }
1402
+
1403
+ return isMultipleOrTags(_this.props) ? vls : vls[0];
1404
+ }
1405
+
1406
+ return vls;
1407
+ };
1408
+
1409
+ _this.getLabelBySingleValue = function (value, optionsInfo) {
1410
+ var _this$getOptionInfoBy2 = _this.getOptionInfoBySingleValue(value, optionsInfo),
1411
+ label = _this$getOptionInfoBy2.label;
1412
+
1413
+ return label;
1414
+ };
1415
+
1416
+ _this.getDropdownContainer = function () {
1417
+ if (!_this.dropdownContainer) {
1418
+ _this.dropdownContainer = document.createElement('div');
1419
+ document.body.appendChild(_this.dropdownContainer);
1420
+ }
1421
+
1422
+ return _this.dropdownContainer;
1423
+ };
1424
+
1425
+ _this.getPlaceholderElement = function () {
1426
+ var props = _this.props;
1427
+ var state = _this.state;
1428
+ var hidden = false;
1429
+
1430
+ if (state.inputValue) {
1431
+ hidden = true;
1432
+ }
1433
+
1434
+ var value = state.value;
1435
+
1436
+ if (value.length) {
1437
+ hidden = true;
1438
+ }
1439
+
1440
+ if (isCombobox(props) && value.length === 1 && state.value && !state.value[0]) {
1441
+ hidden = false;
1442
+ }
1443
+
1444
+ var placeholder = props.placeholder;
1445
+
1446
+ if (placeholder) {
1447
+ return React.createElement("div", _extends$1({
1448
+ onMouseDown: preventDefaultEvent,
1449
+ style: _extends$1({
1450
+ display: hidden ? 'none' : 'block'
1451
+ }, UNSELECTABLE_STYLE)
1452
+ }, UNSELECTABLE_ATTRIBUTE, {
1453
+ onClick: _this.onPlaceholderClick,
1454
+ className: "".concat(props.prefixCls, "-selection__placeholder")
1455
+ }), placeholder);
1456
+ }
1457
+
1458
+ return null;
1459
+ };
1460
+
1461
+ _this.getInputElement = function () {
1462
+ var props = _this.props;
1463
+ var defaultInput = React.createElement("input", {
1464
+ id: props.id,
1465
+ autoComplete: "off"
1466
+ }); // tslint:disable-next-line:typedef-whitespace
1467
+
1468
+ var inputElement = props.getInputElement ? props.getInputElement() : defaultInput;
1469
+ var inputCls = classNames(inputElement.props.className, _defineProperty$1({}, "".concat(props.prefixCls, "-search__field"), true)); // https://github.com/ant-design/ant-design/issues/4992#issuecomment-281542159
1470
+ // Add space to the end of the inputValue as the width measurement tolerance
1471
+
1472
+ return React.createElement("div", {
1473
+ className: "".concat(props.prefixCls, "-search__field__wrap")
1474
+ }, React.cloneElement(inputElement, {
1475
+ ref: _this.saveInputRef,
1476
+ onChange: _this.onInputChange,
1477
+ onKeyDown: chaining(_this.onInputKeyDown, inputElement.props.onKeyDown, _this.props.onInputKeyDown),
1478
+ value: _this.state.inputValue,
1479
+ disabled: props.disabled,
1480
+ className: inputCls
1481
+ }), React.createElement("span", {
1482
+ ref: _this.saveInputMirrorRef,
1483
+ className: "".concat(props.prefixCls, "-search__field__mirror")
1484
+ }, _this.state.inputValue, "\xA0"));
1485
+ };
1486
+
1487
+ _this.getInputDOMNode = function () {
1488
+ return _this.topCtrlRef ? _this.topCtrlRef.querySelector('input,textarea,div[contentEditable]') : _this.inputRef;
1489
+ };
1490
+
1491
+ _this.getInputMirrorDOMNode = function () {
1492
+ return _this.inputMirrorRef;
1493
+ };
1494
+
1495
+ _this.getPopupDOMNode = function () {
1496
+ if (_this.selectTriggerRef) {
1497
+ return _this.selectTriggerRef.getPopupDOMNode();
1498
+ }
1499
+ };
1500
+
1501
+ _this.getPopupMenuComponent = function () {
1502
+ if (_this.selectTriggerRef) {
1503
+ return _this.selectTriggerRef.getInnerMenu();
1504
+ }
1505
+ };
1506
+
1507
+ _this.setOpenState = function (open) {
1508
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1509
+ var needFocus = config.needFocus,
1510
+ fireSearch = config.fireSearch;
1511
+ var props = _this.props;
1512
+ var state = _this.state;
1513
+
1514
+ if (state.open === open) {
1515
+ _this.maybeFocus(open, !!needFocus);
1516
+
1517
+ return;
1518
+ }
1519
+
1520
+ if (_this.props.onDropdownVisibleChange) {
1521
+ _this.props.onDropdownVisibleChange(open);
1522
+ }
1523
+
1524
+ var nextState = {
1525
+ open: open,
1526
+ backfillValue: ''
1527
+ }; // clear search input value when open is false in singleMode.
1528
+ // https://github.com/ant-design/ant-design/issues/16572
1529
+
1530
+ if (!open && isSingleMode(props) && props.showSearch) {
1531
+ _this.setInputValue('', fireSearch);
1532
+ }
1533
+
1534
+ if (!open) {
1535
+ _this.maybeFocus(open, !!needFocus);
1536
+ }
1537
+
1538
+ _this.setState(_extends$1({
1539
+ open: open
1540
+ }, nextState), function () {
1541
+ if (open) {
1542
+ _this.maybeFocus(open, !!needFocus);
1543
+ }
1544
+ });
1545
+ };
1546
+
1547
+ _this.setInputValue = function (inputValue) {
1548
+ var fireSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1549
+ var onSearch = _this.props.onSearch;
1550
+
1551
+ if (inputValue !== _this.state.inputValue) {
1552
+ _this.setState(function (prevState) {
1553
+ // Additional check if `inputValue` changed in latest state.
1554
+ if (fireSearch && inputValue !== prevState.inputValue && onSearch) {
1555
+ onSearch(inputValue);
1556
+ }
1557
+
1558
+ return {
1559
+ inputValue: inputValue
1560
+ };
1561
+ }, _this.forcePopupAlign);
1562
+ }
1563
+ };
1564
+
1565
+ _this.getValueByInput = function (str) {
1566
+ var _this$props2 = _this.props,
1567
+ multiple = _this$props2.multiple,
1568
+ tokenSeparators = _this$props2.tokenSeparators;
1569
+ var nextValue = _this.state.value;
1570
+ var hasNewValue = false;
1571
+ splitBySeparators(str, tokenSeparators).forEach(function (label) {
1572
+ var selectedValue = [label];
1573
+
1574
+ if (multiple) {
1575
+ var value = _this.getValueByLabel(label);
1576
+
1577
+ if (value && findIndexInValueBySingleValue(nextValue, value) === -1) {
1578
+ nextValue = nextValue.concat(value);
1579
+ hasNewValue = true;
1580
+
1581
+ _this.fireSelect(value);
1582
+ }
1583
+ } else if (findIndexInValueBySingleValue(nextValue, label) === -1) {
1584
+ nextValue = nextValue.concat(selectedValue);
1585
+ hasNewValue = true;
1586
+
1587
+ _this.fireSelect(label);
1588
+ }
1589
+ });
1590
+ return hasNewValue ? nextValue : undefined;
1591
+ };
1592
+
1593
+ _this.getRealOpenState = function (state) {
1594
+ // tslint:disable-next-line:variable-name
1595
+ var _open = _this.props.open;
1596
+
1597
+ if (typeof _open === 'boolean') {
1598
+ return _open;
1599
+ }
1600
+
1601
+ var open = (state || _this.state).open;
1602
+ var options = _this._options || [];
1603
+
1604
+ if (isMultipleOrTagsOrCombobox(_this.props) || !_this.props.showSearch) {
1605
+ if (open && !options.length) {
1606
+ open = false;
1607
+ }
1608
+ }
1609
+
1610
+ return open;
1611
+ };
1612
+
1613
+ _this.markMouseDown = function () {
1614
+ _this._mouseDown = true;
1615
+ };
1616
+
1617
+ _this.markMouseLeave = function () {
1618
+ _this._mouseDown = false;
1619
+ };
1620
+
1621
+ _this.handleBackfill = function (item) {
1622
+ if (!_this.props.backfill || !(isSingleMode(_this.props) || isCombobox(_this.props))) {
1623
+ return;
1624
+ }
1625
+
1626
+ var key = getValuePropValue(item);
1627
+
1628
+ if (isCombobox(_this.props)) {
1629
+ _this.setInputValue(key, false);
1630
+ }
1631
+
1632
+ _this.setState({
1633
+ value: [key],
1634
+ backfillValue: key
1635
+ });
1636
+ };
1637
+
1638
+ _this.filterOption = function (input, child) {
1639
+ var defaultFilter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterFn;
1640
+ var value = _this.state.value;
1641
+ var lastValue = value[value.length - 1];
1642
+
1643
+ if (!input || lastValue && lastValue === _this.state.backfillValue) {
1644
+ return true;
1645
+ }
1646
+
1647
+ var filterFn = _this.props.filterOption;
1648
+
1649
+ if ('filterOption' in _this.props) {
1650
+ if (filterFn === true) {
1651
+ filterFn = defaultFilter.bind(_assertThisInitialized$1(_this));
1652
+ }
1653
+ } else {
1654
+ filterFn = defaultFilter.bind(_assertThisInitialized$1(_this));
1655
+ }
1656
+
1657
+ if (!filterFn) {
1658
+ return true;
1659
+ } else if (typeof filterFn === 'function') {
1660
+ return filterFn.call(_assertThisInitialized$1(_this), input, child);
1661
+ } else if (child.props.disabled) {
1662
+ return false;
1663
+ }
1664
+
1665
+ return true;
1666
+ };
1667
+
1668
+ _this.timeoutFocus = function () {
1669
+ var onFocus = _this.props.onFocus;
1670
+
1671
+ if (_this.focusTimer) {
1672
+ _this.clearFocusTime();
1673
+ }
1674
+
1675
+ _this.focusTimer = window.setTimeout(function () {
1676
+ if (onFocus) {
1677
+ onFocus();
1678
+ }
1679
+ }, 10);
1680
+ };
1681
+
1682
+ _this.clearFocusTime = function () {
1683
+ if (_this.focusTimer) {
1684
+ clearTimeout(_this.focusTimer);
1685
+ _this.focusTimer = null;
1686
+ }
1687
+ };
1688
+
1689
+ _this.clearBlurTime = function () {
1690
+ if (_this.blurTimer) {
1691
+ clearTimeout(_this.blurTimer);
1692
+ _this.blurTimer = null;
1693
+ }
1694
+ };
1695
+
1696
+ _this.clearComboboxTime = function () {
1697
+ if (_this.comboboxTimer) {
1698
+ clearTimeout(_this.comboboxTimer);
1699
+ _this.comboboxTimer = null;
1700
+ }
1701
+ };
1702
+
1703
+ _this.updateFocusClassName = function () {
1704
+ var rootRef = _this.rootRef;
1705
+ var props = _this.props; // avoid setState and its side effect
1706
+
1707
+ if (_this._focused) {
1708
+ classes(rootRef).add("".concat(props.prefixCls, "-focused"));
1709
+ } else {
1710
+ classes(rootRef).remove("".concat(props.prefixCls, "-focused"));
1711
+ }
1712
+ };
1713
+
1714
+ _this.maybeFocus = function (open, needFocus) {
1715
+ if (needFocus || open) {
1716
+ var input = _this.getInputDOMNode();
1717
+
1718
+ var _document = document,
1719
+ activeElement = _document.activeElement;
1720
+
1721
+ if (input && (open || isMultipleOrTagsOrCombobox(_this.props))) {
1722
+ if (activeElement !== input) {
1723
+ input.focus();
1724
+ _this._focused = true;
1725
+ }
1726
+ } else if (activeElement !== _this.selectionRef && _this.selectionRef) {
1727
+ _this.selectionRef.focus();
1728
+
1729
+ _this._focused = true;
1730
+ }
1731
+ }
1732
+ };
1733
+
1734
+ _this.removeSelected = function (selectedKey, e) {
1735
+ var props = _this.props;
1736
+
1737
+ if (props.disabled || _this.isChildDisabled(selectedKey)) {
1738
+ return;
1739
+ } // Do not trigger Trigger popup
1740
+
1741
+
1742
+ if (e && e.stopPropagation) {
1743
+ e.stopPropagation();
1744
+ }
1745
+
1746
+ var oldValue = _this.state.value;
1747
+ var value = oldValue.filter(function (singleValue) {
1748
+ return singleValue !== selectedKey;
1749
+ });
1750
+ var canMultiple = isMultipleOrTags(props);
1751
+
1752
+ if (canMultiple) {
1753
+ var event = selectedKey;
1754
+
1755
+ if (props.labelInValue) {
1756
+ event = {
1757
+ key: selectedKey,
1758
+ label: _this.getLabelBySingleValue(selectedKey)
1759
+ };
1760
+ }
1761
+
1762
+ if (props.onDeselect) {
1763
+ props.onDeselect(event, _this.getOptionBySingleValue(selectedKey));
1764
+ }
1765
+ }
1766
+
1767
+ _this.fireChange(value);
1768
+ };
1769
+
1770
+ _this.openIfHasChildren = function () {
1771
+ var props = _this.props;
1772
+
1773
+ if (React.Children.count(props.children) || isSingleMode(props)) {
1774
+ _this.setOpenState(true);
1775
+ }
1776
+ };
1777
+
1778
+ _this.fireSelect = function (value) {
1779
+ if (_this.props.onSelect) {
1780
+ _this.props.onSelect(_this.getVLBySingleValue(value), _this.getOptionBySingleValue(value));
1781
+ }
1782
+ };
1783
+
1784
+ _this.fireChange = function (value) {
1785
+ var props = _this.props;
1786
+
1787
+ if (!('value' in props)) {
1788
+ _this.setState({
1789
+ value: value
1790
+ }, _this.forcePopupAlign);
1791
+ }
1792
+
1793
+ var vls = _this.getVLForOnChange(value);
1794
+
1795
+ var options = _this.getOptionsBySingleValue(value);
1796
+
1797
+ if (props.onChange) {
1798
+ props.onChange(vls, isMultipleOrTags(_this.props) ? options : options[0]);
1799
+ }
1800
+ };
1801
+
1802
+ _this.isChildDisabled = function (key) {
1803
+ return toArray$1(_this.props.children).some(function (child) {
1804
+ var childValue = getValuePropValue(child);
1805
+ return childValue === key && child.props && child.props.disabled;
1806
+ });
1807
+ };
1808
+
1809
+ _this.forcePopupAlign = function () {
1810
+ if (!_this.state.open) {
1811
+ return;
1812
+ }
1813
+
1814
+ if (_this.selectTriggerRef && _this.selectTriggerRef.triggerRef) {
1815
+ _this.selectTriggerRef.triggerRef.forcePopupAlign();
1816
+ }
1817
+ };
1818
+
1819
+ _this.renderFilterOptions = function () {
1820
+ var inputValue = _this.state.inputValue;
1821
+ var _this$props3 = _this.props,
1822
+ children = _this$props3.children,
1823
+ tags = _this$props3.tags,
1824
+ notFoundContent = _this$props3.notFoundContent;
1825
+ var menuItems = [];
1826
+ var childrenKeys = [];
1827
+ var empty = false;
1828
+
1829
+ var options = _this.renderFilterOptionsFromChildren(children, childrenKeys, menuItems);
1830
+
1831
+ if (tags) {
1832
+ // tags value must be string
1833
+ var value = _this.state.value;
1834
+ value = value.filter(function (singleValue) {
1835
+ return childrenKeys.indexOf(singleValue) === -1 && (!inputValue || String(singleValue).indexOf(String(inputValue)) > -1);
1836
+ }); // sort by length
1837
+
1838
+ value.sort(function (val1, val2) {
1839
+ return val1.length - val2.length;
1840
+ });
1841
+ value.forEach(function (singleValue) {
1842
+ var key = singleValue;
1843
+ var menuItem = React.createElement(connected, {
1844
+ style: UNSELECTABLE_STYLE,
1845
+ role: "option",
1846
+ attribute: UNSELECTABLE_ATTRIBUTE,
1847
+ value: key,
1848
+ key: key
1849
+ }, key);
1850
+ options.push(menuItem);
1851
+ menuItems.push(menuItem);
1852
+ }); // ref: https://github.com/ant-design/ant-design/issues/14090
1853
+
1854
+ if (inputValue && menuItems.every(function (option) {
1855
+ return getValuePropValue(option) !== inputValue;
1856
+ })) {
1857
+ options.unshift(React.createElement(connected, {
1858
+ style: UNSELECTABLE_STYLE,
1859
+ role: "option",
1860
+ attribute: UNSELECTABLE_ATTRIBUTE,
1861
+ value: inputValue,
1862
+ key: inputValue
1863
+ }, inputValue));
1864
+ }
1865
+ }
1866
+
1867
+ if (!options.length && notFoundContent) {
1868
+ empty = true;
1869
+ options = [React.createElement(connected, {
1870
+ style: UNSELECTABLE_STYLE,
1871
+ attribute: UNSELECTABLE_ATTRIBUTE,
1872
+ disabled: true,
1873
+ role: "option",
1874
+ value: "NOT_FOUND",
1875
+ key: "NOT_FOUND"
1876
+ }, notFoundContent)];
1877
+ }
1878
+
1879
+ return {
1880
+ empty: empty,
1881
+ options: options
1882
+ };
1883
+ };
1884
+
1885
+ _this.renderFilterOptionsFromChildren = function (children, childrenKeys, menuItems) {
1886
+ var sel = [];
1887
+ var props = _this.props;
1888
+ var inputValue = _this.state.inputValue;
1889
+ var tags = props.tags;
1890
+ React.Children.forEach(children, function (child) {
1891
+ if (!child) {
1892
+ return;
1893
+ }
1894
+
1895
+ var type = child.type;
1896
+
1897
+ if (type.isSelectOptGroup) {
1898
+ var label = child.props.label;
1899
+ var key = child.key;
1900
+
1901
+ if (!key && typeof label === 'string') {
1902
+ key = label;
1903
+ } else if (!label && key) {
1904
+ label = key;
1905
+ } // Match option group label
1906
+
1907
+
1908
+ if (inputValue && _this.filterOption(inputValue, child)) {
1909
+ var innerItems = toArray$1(child.props.children).map(function (subChild) {
1910
+ var childValueSub = getValuePropValue(subChild) || subChild.key;
1911
+ return React.createElement(connected, _extends$1({
1912
+ key: childValueSub,
1913
+ value: childValueSub
1914
+ }, subChild.props));
1915
+ });
1916
+ sel.push(React.createElement(MenuItemGroup, {
1917
+ key: key,
1918
+ title: label
1919
+ }, innerItems)); // Not match
1920
+ } else {
1921
+ var _innerItems = _this.renderFilterOptionsFromChildren(child.props.children, childrenKeys, menuItems);
1922
+
1923
+ if (_innerItems.length) {
1924
+ sel.push(React.createElement(MenuItemGroup, {
1925
+ key: key,
1926
+ title: label
1927
+ }, _innerItems));
1928
+ }
1929
+ }
1930
+
1931
+ return;
1932
+ }
1933
+
1934
+ warning(type.isSelectOption, 'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' + "instead of `".concat(type.name || type.displayName || child.type, "`."));
1935
+ var childValue = getValuePropValue(child);
1936
+ validateOptionValue(childValue, _this.props);
1937
+
1938
+ if (_this.filterOption(inputValue, child)) {
1939
+ var menuItem = React.createElement(connected, _extends$1({
1940
+ style: UNSELECTABLE_STYLE,
1941
+ attribute: UNSELECTABLE_ATTRIBUTE,
1942
+ value: childValue,
1943
+ key: childValue,
1944
+ role: "option"
1945
+ }, child.props));
1946
+ sel.push(menuItem);
1947
+ menuItems.push(menuItem);
1948
+ }
1949
+
1950
+ if (tags) {
1951
+ childrenKeys.push(childValue);
1952
+ }
1953
+ });
1954
+ return sel;
1955
+ };
1956
+
1957
+ _this.renderTopControlNode = function () {
1958
+ var _this$state = _this.state,
1959
+ open = _this$state.open,
1960
+ inputValue = _this$state.inputValue;
1961
+ var value = _this.state.value;
1962
+ var props = _this.props;
1963
+ var choiceTransitionName = props.choiceTransitionName,
1964
+ prefixCls = props.prefixCls,
1965
+ maxTagTextLength = props.maxTagTextLength,
1966
+ maxTagCount = props.maxTagCount,
1967
+ showSearch = props.showSearch,
1968
+ removeIcon = props.removeIcon;
1969
+ var maxTagPlaceholder = props.maxTagPlaceholder;
1970
+ var className = "".concat(prefixCls, "-selection__rendered"); // search input is inside topControlNode in single, multiple & combobox. 2016/04/13
1971
+
1972
+ var innerNode = null;
1973
+
1974
+ if (isSingleMode(props)) {
1975
+ var selectedValue = null;
1976
+
1977
+ if (value.length) {
1978
+ var showSelectedValue = false;
1979
+ var opacity = 1;
1980
+
1981
+ if (!showSearch) {
1982
+ showSelectedValue = true;
1983
+ } else if (open) {
1984
+ showSelectedValue = !inputValue;
1985
+
1986
+ if (showSelectedValue) {
1987
+ opacity = 0.4;
1988
+ }
1989
+ } else {
1990
+ showSelectedValue = true;
1991
+ }
1992
+
1993
+ var singleValue = value[0];
1994
+
1995
+ var _this$getOptionInfoBy3 = _this.getOptionInfoBySingleValue(singleValue),
1996
+ label = _this$getOptionInfoBy3.label,
1997
+ title = _this$getOptionInfoBy3.title;
1998
+
1999
+ selectedValue = React.createElement("div", {
2000
+ key: "value",
2001
+ className: "".concat(prefixCls, "-selection-selected-value"),
2002
+ title: toTitle(title || label),
2003
+ style: {
2004
+ display: showSelectedValue ? 'block' : 'none',
2005
+ opacity: opacity
2006
+ }
2007
+ }, label);
2008
+ }
2009
+
2010
+ if (!showSearch) {
2011
+ innerNode = [selectedValue];
2012
+ } else {
2013
+ innerNode = [selectedValue, React.createElement("div", {
2014
+ className: "".concat(prefixCls, "-search ").concat(prefixCls, "-search--inline"),
2015
+ key: "input",
2016
+ style: {
2017
+ display: open ? 'block' : 'none'
2018
+ }
2019
+ }, _this.getInputElement())];
2020
+ }
2021
+ } else {
2022
+ var selectedValueNodes = [];
2023
+ var limitedCountValue = value;
2024
+ var maxTagPlaceholderEl;
2025
+
2026
+ if (maxTagCount !== undefined && value.length > maxTagCount) {
2027
+ limitedCountValue = limitedCountValue.slice(0, maxTagCount);
2028
+
2029
+ var omittedValues = _this.getVLForOnChange(value.slice(maxTagCount, value.length));
2030
+
2031
+ var content = "+ ".concat(value.length - maxTagCount, " ...");
2032
+
2033
+ if (maxTagPlaceholder) {
2034
+ content = typeof maxTagPlaceholder === 'function' ? maxTagPlaceholder(omittedValues) : maxTagPlaceholder;
2035
+ }
2036
+
2037
+ maxTagPlaceholderEl = React.createElement("li", _extends$1({
2038
+ style: UNSELECTABLE_STYLE
2039
+ }, UNSELECTABLE_ATTRIBUTE, {
2040
+ role: "presentation",
2041
+ onMouseDown: preventDefaultEvent,
2042
+ className: "".concat(prefixCls, "-selection__choice ").concat(prefixCls, "-selection__choice__disabled"),
2043
+ key: "maxTagPlaceholder",
2044
+ title: toTitle(content)
2045
+ }), React.createElement("div", {
2046
+ className: "".concat(prefixCls, "-selection__choice__content")
2047
+ }, content));
2048
+ }
2049
+
2050
+ if (isMultipleOrTags(props)) {
2051
+ selectedValueNodes = limitedCountValue.map(function (singleValue) {
2052
+ var info = _this.getOptionInfoBySingleValue(singleValue);
2053
+
2054
+ var content = info.label;
2055
+ var title = info.title || content;
2056
+
2057
+ if (maxTagTextLength && typeof content === 'string' && content.length > maxTagTextLength) {
2058
+ content = "".concat(content.slice(0, maxTagTextLength), "...");
2059
+ }
2060
+
2061
+ var disabled = _this.isChildDisabled(singleValue);
2062
+
2063
+ var choiceClassName = disabled ? "".concat(prefixCls, "-selection__choice ").concat(prefixCls, "-selection__choice__disabled") : "".concat(prefixCls, "-selection__choice");
2064
+ return React.createElement("li", _extends$1({
2065
+ style: UNSELECTABLE_STYLE
2066
+ }, UNSELECTABLE_ATTRIBUTE, {
2067
+ onMouseDown: preventDefaultEvent,
2068
+ className: choiceClassName,
2069
+ role: "presentation",
2070
+ key: singleValue || SELECT_EMPTY_VALUE_KEY,
2071
+ title: toTitle(title)
2072
+ }), React.createElement("div", {
2073
+ className: "".concat(prefixCls, "-selection__choice__content")
2074
+ }, content), disabled ? null : React.createElement("span", {
2075
+ onClick: function onClick(event) {
2076
+ _this.removeSelected(singleValue, event);
2077
+ },
2078
+ className: "".concat(prefixCls, "-selection__choice__remove")
2079
+ }, removeIcon || React.createElement("i", {
2080
+ className: "".concat(prefixCls, "-selection__choice__remove-icon")
2081
+ }, "\xD7")));
2082
+ });
2083
+ }
2084
+
2085
+ if (maxTagPlaceholderEl) {
2086
+ selectedValueNodes.push(maxTagPlaceholderEl);
2087
+ }
2088
+
2089
+ selectedValueNodes.push(React.createElement("li", {
2090
+ className: "".concat(prefixCls, "-search ").concat(prefixCls, "-search--inline"),
2091
+ key: "__input"
2092
+ }, _this.getInputElement()));
2093
+
2094
+ if (isMultipleOrTags(props) && choiceTransitionName) {
2095
+ innerNode = React.createElement(Animate, {
2096
+ onLeave: _this.onChoiceAnimationLeave,
2097
+ component: "ul",
2098
+ transitionName: choiceTransitionName
2099
+ }, selectedValueNodes);
2100
+ } else {
2101
+ innerNode = React.createElement("ul", null, selectedValueNodes);
2102
+ }
2103
+ }
2104
+
2105
+ return React.createElement("div", {
2106
+ className: className,
2107
+ ref: _this.saveTopCtrlRef
2108
+ }, _this.getPlaceholderElement(), innerNode);
2109
+ };
2110
+
2111
+ var optionsInfo = Select.getOptionsInfoFromProps(props);
2112
+
2113
+ if (props.tags && typeof props.filterOption !== 'function') {
2114
+ var isDisabledExist = Object.keys(optionsInfo).some(function (key) {
2115
+ return optionsInfo[key].disabled;
2116
+ });
2117
+ warning(!isDisabledExist, 'Please avoid setting option to disabled in tags mode since user can always type text as tag.');
2118
+ }
2119
+
2120
+ _this.state = {
2121
+ value: Select.getValueFromProps(props, true),
2122
+ inputValue: props.combobox ? Select.getInputValueForCombobox(props, optionsInfo, true) : '',
2123
+ open: props.defaultOpen,
2124
+ optionsInfo: optionsInfo,
2125
+ backfillValue: '',
2126
+ // a flag for aviod redundant getOptionsInfoFromProps call
2127
+ skipBuildOptionsInfo: true,
2128
+ ariaId: ''
2129
+ };
2130
+ _this.saveInputRef = saveRef(_assertThisInitialized$1(_this), 'inputRef');
2131
+ _this.saveInputMirrorRef = saveRef(_assertThisInitialized$1(_this), 'inputMirrorRef');
2132
+ _this.saveTopCtrlRef = saveRef(_assertThisInitialized$1(_this), 'topCtrlRef');
2133
+ _this.saveSelectTriggerRef = saveRef(_assertThisInitialized$1(_this), 'selectTriggerRef');
2134
+ _this.saveRootRef = saveRef(_assertThisInitialized$1(_this), 'rootRef');
2135
+ _this.saveSelectionRef = saveRef(_assertThisInitialized$1(_this), 'selectionRef');
2136
+ return _this;
2137
+ }
2138
+
2139
+ _createClass$1(Select, [{
2140
+ key: "componentDidMount",
2141
+ value: function componentDidMount() {
2142
+ // when defaultOpen is true, we should auto focus search input
2143
+ // https://github.com/ant-design/ant-design/issues/14254
2144
+ if (this.props.autoFocus || this.state.open) {
2145
+ this.focus();
2146
+ }
2147
+
2148
+ this.setState({
2149
+ ariaId: generateUUID()
2150
+ });
2151
+ }
2152
+ }, {
2153
+ key: "componentDidUpdate",
2154
+ value: function componentDidUpdate() {
2155
+ if (isMultipleOrTags(this.props)) {
2156
+ var inputNode = this.getInputDOMNode();
2157
+ var mirrorNode = this.getInputMirrorDOMNode();
2158
+
2159
+ if (inputNode && inputNode.value && mirrorNode) {
2160
+ inputNode.style.width = '';
2161
+ inputNode.style.width = "".concat(mirrorNode.clientWidth, "px");
2162
+ } else if (inputNode) {
2163
+ inputNode.style.width = '';
2164
+ }
2165
+ }
2166
+
2167
+ this.forcePopupAlign();
2168
+ }
2169
+ }, {
2170
+ key: "componentWillUnmount",
2171
+ value: function componentWillUnmount() {
2172
+ this.clearFocusTime();
2173
+ this.clearBlurTime();
2174
+ this.clearComboboxTime();
2175
+
2176
+ if (this.dropdownContainer) {
2177
+ ReactDOM.unmountComponentAtNode(this.dropdownContainer);
2178
+ document.body.removeChild(this.dropdownContainer);
2179
+ this.dropdownContainer = null;
2180
+ }
2181
+ }
2182
+ }, {
2183
+ key: "focus",
2184
+ value: function focus() {
2185
+ if (isSingleMode(this.props) && this.selectionRef) {
2186
+ this.selectionRef.focus();
2187
+ } else if (this.getInputDOMNode()) {
2188
+ this.getInputDOMNode().focus();
2189
+ }
2190
+ }
2191
+ }, {
2192
+ key: "blur",
2193
+ value: function blur() {
2194
+ if (isSingleMode(this.props) && this.selectionRef) {
2195
+ this.selectionRef.blur();
2196
+ } else if (this.getInputDOMNode()) {
2197
+ this.getInputDOMNode().blur();
2198
+ }
2199
+ }
2200
+ }, {
2201
+ key: "renderArrow",
2202
+ value: function renderArrow(multiple) {
2203
+ // showArrow : Set to true if not multiple by default but keep set value.
2204
+ var _this$props4 = this.props,
2205
+ _this$props4$showArro = _this$props4.showArrow,
2206
+ showArrow = _this$props4$showArro === void 0 ? !multiple : _this$props4$showArro,
2207
+ loading = _this$props4.loading,
2208
+ inputIcon = _this$props4.inputIcon,
2209
+ prefixCls = _this$props4.prefixCls;
2210
+
2211
+ if (!showArrow && !loading) {
2212
+ return null;
2213
+ } // if loading have loading icon
2214
+
2215
+
2216
+ var defaultIcon = loading ? React.createElement("i", {
2217
+ className: "".concat(prefixCls, "-arrow-loading")
2218
+ }) : React.createElement("i", {
2219
+ className: "".concat(prefixCls, "-arrow-icon")
2220
+ });
2221
+ return React.createElement("span", _extends$1({
2222
+ key: "arrow",
2223
+ className: "".concat(prefixCls, "-arrow"),
2224
+ style: UNSELECTABLE_STYLE
2225
+ }, UNSELECTABLE_ATTRIBUTE, {
2226
+ onClick: this.onArrowClick
2227
+ }), inputIcon || defaultIcon);
2228
+ }
2229
+ }, {
2230
+ key: "renderClear",
2231
+ value: function renderClear() {
2232
+ var _this$props5 = this.props,
2233
+ prefixCls = _this$props5.prefixCls,
2234
+ allowClear = _this$props5.allowClear,
2235
+ clearIcon = _this$props5.clearIcon;
2236
+ var inputValue = this.state.inputValue;
2237
+ var value = this.state.value;
2238
+ var clear = React.createElement("span", _extends$1({
2239
+ key: "clear",
2240
+ className: "".concat(prefixCls, "-selection__clear"),
2241
+ onMouseDown: preventDefaultEvent,
2242
+ style: UNSELECTABLE_STYLE
2243
+ }, UNSELECTABLE_ATTRIBUTE, {
2244
+ onClick: this.onClearSelection
2245
+ }), clearIcon || React.createElement("i", {
2246
+ className: "".concat(prefixCls, "-selection__clear-icon")
2247
+ }, "\xD7"));
2248
+
2249
+ if (!allowClear) {
2250
+ return null;
2251
+ }
2252
+
2253
+ if (isCombobox(this.props)) {
2254
+ if (inputValue) {
2255
+ return clear;
2256
+ }
2257
+
2258
+ return null;
2259
+ }
2260
+
2261
+ if (inputValue || value.length) {
2262
+ return clear;
2263
+ }
2264
+
2265
+ return null;
2266
+ }
2267
+ }, {
2268
+ key: "render",
2269
+ value: function render() {
2270
+ var _rootCls;
2271
+
2272
+ var props = this.props;
2273
+ var multiple = isMultipleOrTags(props); // Default set showArrow to true if not set (not set directly in defaultProps to handle multiple case)
2274
+
2275
+ var _props$showArrow = props.showArrow,
2276
+ showArrow = _props$showArrow === void 0 ? true : _props$showArrow;
2277
+ var state = this.state;
2278
+ var className = props.className,
2279
+ disabled = props.disabled,
2280
+ prefixCls = props.prefixCls,
2281
+ loading = props.loading;
2282
+ var ctrlNode = this.renderTopControlNode();
2283
+ var _this$state2 = this.state,
2284
+ open = _this$state2.open,
2285
+ ariaId = _this$state2.ariaId;
2286
+
2287
+ if (open) {
2288
+ var filterOptions = this.renderFilterOptions();
2289
+ this._empty = filterOptions.empty;
2290
+ this._options = filterOptions.options;
2291
+ }
2292
+
2293
+ var realOpen = this.getRealOpenState();
2294
+ var empty = this._empty;
2295
+ var options = this._options || [];
2296
+ var dataOrAriaAttributeProps = {};
2297
+ Object.keys(props).forEach(function (key) {
2298
+ if (Object.prototype.hasOwnProperty.call(props, key) && (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role')) {
2299
+ dataOrAriaAttributeProps[key] = props[key];
2300
+ }
2301
+ }); // for (const key in props) {
2302
+ // if (
2303
+ // Object.prototype.hasOwnProperty.call(props, key) &&
2304
+ // (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role')
2305
+ // ) {
2306
+ // dataOrAriaAttributeProps[key] = props[key];
2307
+ // }
2308
+ // }
2309
+
2310
+ var extraSelectionProps = _extends$1({}, dataOrAriaAttributeProps);
2311
+
2312
+ if (!isMultipleOrTagsOrCombobox(props)) {
2313
+ extraSelectionProps = _extends$1(_extends$1({}, extraSelectionProps), {
2314
+ onKeyDown: this.onKeyDown,
2315
+ tabIndex: props.disabled ? -1 : props.tabIndex
2316
+ });
2317
+ }
2318
+
2319
+ var rootCls = (_rootCls = {}, _defineProperty$1(_rootCls, className, !!className), _defineProperty$1(_rootCls, prefixCls, 1), _defineProperty$1(_rootCls, "".concat(prefixCls, "-open"), open), _defineProperty$1(_rootCls, "".concat(prefixCls, "-focused"), open || !!this._focused), _defineProperty$1(_rootCls, "".concat(prefixCls, "-combobox"), isCombobox(props)), _defineProperty$1(_rootCls, "".concat(prefixCls, "-disabled"), disabled), _defineProperty$1(_rootCls, "".concat(prefixCls, "-enabled"), !disabled), _defineProperty$1(_rootCls, "".concat(prefixCls, "-allow-clear"), !!props.allowClear), _defineProperty$1(_rootCls, "".concat(prefixCls, "-no-arrow"), !showArrow), _defineProperty$1(_rootCls, "".concat(prefixCls, "-loading"), !!loading), _rootCls);
2320
+ return React.createElement(SelectTrigger, {
2321
+ onPopupFocus: this.onPopupFocus,
2322
+ onMouseEnter: this.props.onMouseEnter,
2323
+ onMouseLeave: this.props.onMouseLeave,
2324
+ dropdownAlign: props.dropdownAlign,
2325
+ dropdownClassName: props.dropdownClassName,
2326
+ dropdownMatchSelectWidth: props.dropdownMatchSelectWidth,
2327
+ defaultActiveFirstOption: props.defaultActiveFirstOption,
2328
+ dropdownMenuStyle: props.dropdownMenuStyle,
2329
+ transitionName: props.transitionName,
2330
+ animation: props.animation,
2331
+ prefixCls: props.prefixCls,
2332
+ dropdownStyle: props.dropdownStyle,
2333
+ combobox: props.combobox,
2334
+ showSearch: props.showSearch,
2335
+ options: options,
2336
+ empty: empty,
2337
+ multiple: multiple,
2338
+ disabled: disabled,
2339
+ visible: realOpen,
2340
+ inputValue: state.inputValue,
2341
+ value: state.value,
2342
+ backfillValue: state.backfillValue,
2343
+ firstActiveValue: props.firstActiveValue,
2344
+ onDropdownVisibleChange: this.onDropdownVisibleChange,
2345
+ getPopupContainer: props.getPopupContainer,
2346
+ onMenuSelect: this.onMenuSelect,
2347
+ onMenuDeselect: this.onMenuDeselect,
2348
+ onPopupScroll: props.onPopupScroll,
2349
+ showAction: props.showAction,
2350
+ ref: this.saveSelectTriggerRef,
2351
+ menuItemSelectedIcon: props.menuItemSelectedIcon,
2352
+ dropdownRender: props.dropdownRender,
2353
+ ariaId: ariaId
2354
+ }, React.createElement("div", {
2355
+ id: props.id,
2356
+ style: props.style,
2357
+ ref: this.saveRootRef,
2358
+ onBlur: this.onOuterBlur,
2359
+ onFocus: this.onOuterFocus,
2360
+ className: classNames(rootCls),
2361
+ onMouseDown: this.markMouseDown,
2362
+ onMouseUp: this.markMouseLeave,
2363
+ onMouseOut: this.markMouseLeave
2364
+ }, React.createElement("div", _extends$1({
2365
+ ref: this.saveSelectionRef,
2366
+ key: "selection",
2367
+ className: "".concat(prefixCls, "-selection\n ").concat(prefixCls, "-selection--").concat(multiple ? 'multiple' : 'single'),
2368
+ role: "combobox",
2369
+ "aria-autocomplete": "list",
2370
+ "aria-haspopup": "true",
2371
+ "aria-controls": ariaId,
2372
+ "aria-expanded": realOpen
2373
+ }, extraSelectionProps), ctrlNode, this.renderClear(), this.renderArrow(!!multiple))));
2374
+ }
2375
+ }]);
2376
+
2377
+ return Select;
2378
+ }(React.Component);
2379
+
2380
+ Select$1.propTypes = SelectPropTypes$1;
2381
+ Select$1.defaultProps = {
2382
+ prefixCls: 'rc-select',
2383
+ defaultOpen: false,
2384
+ labelInValue: false,
2385
+ defaultActiveFirstOption: true,
2386
+ showSearch: true,
2387
+ allowClear: false,
2388
+ placeholder: '',
2389
+ onChange: noop,
2390
+ onFocus: noop,
2391
+ onBlur: noop,
2392
+ onSelect: noop,
2393
+ onSearch: noop,
2394
+ onDeselect: noop,
2395
+ onInputKeyDown: noop,
2396
+ dropdownMatchSelectWidth: true,
2397
+ dropdownStyle: {},
2398
+ dropdownMenuStyle: {},
2399
+ optionFilterProp: 'value',
2400
+ optionLabelProp: 'value',
2401
+ notFoundContent: 'Not Found',
2402
+ backfill: false,
2403
+ showAction: ['click'],
2404
+ tokenSeparators: [],
2405
+ autoClearSearchValue: true,
2406
+ tabIndex: 0,
2407
+ dropdownRender: function dropdownRender(menu) {
2408
+ return menu;
2409
+ }
2410
+ };
2411
+
2412
+ Select$1.getDerivedStateFromProps = function (nextProps, prevState) {
2413
+ var optionsInfo = prevState.skipBuildOptionsInfo ? prevState.optionsInfo : Select$1.getOptionsInfoFromProps(nextProps, prevState);
2414
+ var newState = {
2415
+ optionsInfo: optionsInfo,
2416
+ skipBuildOptionsInfo: false
2417
+ };
2418
+
2419
+ if ('open' in nextProps) {
2420
+ newState.open = nextProps.open;
2421
+ }
2422
+
2423
+ if (nextProps.disabled && prevState.open) {
2424
+ newState.open = false;
2425
+ }
2426
+
2427
+ if ('value' in nextProps) {
2428
+ var value = Select$1.getValueFromProps(nextProps);
2429
+ newState.value = value;
2430
+
2431
+ if (nextProps.combobox) {
2432
+ newState.inputValue = Select$1.getInputValueForCombobox(nextProps, optionsInfo);
2433
+ }
2434
+ }
2435
+
2436
+ return newState;
2437
+ };
2438
+
2439
+ Select$1.getOptionsFromChildren = function (children) {
2440
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
2441
+ React.Children.forEach(children, function (child) {
2442
+ if (!child) {
2443
+ return;
2444
+ }
2445
+
2446
+ var type = child.type;
2447
+
2448
+ if (type.isSelectOptGroup) {
2449
+ Select$1.getOptionsFromChildren(child.props.children, options);
2450
+ } else {
2451
+ options.push(child);
2452
+ }
2453
+ });
2454
+ return options;
2455
+ };
2456
+
2457
+ Select$1.getInputValueForCombobox = function (props, optionsInfo, useDefaultValue) {
2458
+ var value = [];
2459
+
2460
+ if ('value' in props && !useDefaultValue) {
2461
+ value = toArray(props.value);
2462
+ }
2463
+
2464
+ if ('defaultValue' in props && useDefaultValue) {
2465
+ value = toArray(props.defaultValue);
2466
+ }
2467
+
2468
+ if (value.length) {
2469
+ value = value[0];
2470
+ } else {
2471
+ return '';
2472
+ }
2473
+
2474
+ var label = value;
2475
+
2476
+ if (props.labelInValue) {
2477
+ label = value.label;
2478
+ } else if (optionsInfo[getMapKey(value)]) {
2479
+ label = optionsInfo[getMapKey(value)].label;
2480
+ }
2481
+
2482
+ if (label === undefined) {
2483
+ label = '';
2484
+ }
2485
+
2486
+ return label;
2487
+ };
2488
+
2489
+ Select$1.getLabelFromOption = function (props, option) {
2490
+ return getPropValue(option, props.optionLabelProp);
2491
+ };
2492
+
2493
+ Select$1.getOptionsInfoFromProps = function (props, preState) {
2494
+ var options = Select$1.getOptionsFromChildren(props.children);
2495
+ var optionsInfo = {};
2496
+ options.forEach(function (option) {
2497
+ var singleValue = getValuePropValue(option);
2498
+ optionsInfo[getMapKey(singleValue)] = {
2499
+ option: option,
2500
+ value: singleValue,
2501
+ label: Select$1.getLabelFromOption(props, option),
2502
+ title: option.props.title,
2503
+ disabled: option.props.disabled
2504
+ };
2505
+ });
2506
+
2507
+ if (preState) {
2508
+ // keep option info in pre state value.
2509
+ var oldOptionsInfo = preState.optionsInfo;
2510
+ var value = preState.value;
2511
+
2512
+ if (value) {
2513
+ value.forEach(function (v) {
2514
+ var key = getMapKey(v);
2515
+
2516
+ if (!optionsInfo[key] && oldOptionsInfo[key] !== undefined) {
2517
+ optionsInfo[key] = oldOptionsInfo[key];
2518
+ }
2519
+ });
2520
+ }
2521
+ }
2522
+
2523
+ return optionsInfo;
2524
+ };
2525
+
2526
+ Select$1.getValueFromProps = function (props, useDefaultValue) {
2527
+ var value = [];
2528
+
2529
+ if ('value' in props && !useDefaultValue) {
2530
+ value = toArray(props.value);
2531
+ }
2532
+
2533
+ if ('defaultValue' in props && useDefaultValue) {
2534
+ value = toArray(props.defaultValue);
2535
+ }
2536
+
2537
+ if (props.labelInValue) {
2538
+ value = value.map(function (v) {
2539
+ return v.key;
2540
+ });
2541
+ }
2542
+
2543
+ return value;
2544
+ };
2545
+
2546
+ Select$1.displayName = 'Select';
2547
+ polyfill(Select$1);
2548
+
2549
+ Select$1.Option = Option;
2550
+ Select$1.OptGroup = OptGroup;
2551
+
2552
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2553
+
2554
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2555
+
2556
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2557
+
2558
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2559
+
2560
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
2561
+
2562
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
2563
+
2564
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
2565
+
2566
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
2567
+
2568
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2569
+
2570
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
2571
+
2572
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2573
+
2574
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
2575
+
2576
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
2577
+
2578
+ var __rest = undefined && undefined.__rest || function (s, e) {
2579
+ var t = {};
2580
+
2581
+ for (var p in s) {
2582
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2583
+ }
2584
+
2585
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2586
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2587
+ }
2588
+ return t;
2589
+ };
2590
+ var SelectSizes = tuple('default', 'large', 'small');
2591
+ tuple('default', 'multiple', 'tags', 'combobox', 'SECRET_COMBOBOX_MODE_DO_NOT_USE');
2592
+ var SelectPropTypes = {
2593
+ prefixCls: propTypesExports.string,
2594
+ className: propTypesExports.string,
2595
+ size: propTypesExports.oneOf(SelectSizes),
2596
+ notFoundContent: propTypesExports.any,
2597
+ showSearch: propTypesExports.bool,
2598
+ optionLabelProp: propTypesExports.string,
2599
+ transitionName: propTypesExports.string,
2600
+ choiceTransitionName: propTypesExports.string,
2601
+ id: propTypesExports.string
2602
+ };
2603
+
2604
+ var Select = /*#__PURE__*/function (_React$Component) {
2605
+ _inherits(Select, _React$Component);
2606
+
2607
+ var _super = _createSuper(Select);
2608
+
2609
+ function Select(props) {
2610
+ var _this;
2611
+
2612
+ _classCallCheck(this, Select);
2613
+
2614
+ _this = _super.call(this, props);
2615
+
2616
+ _this.saveSelect = function (node) {
2617
+ _this.rcSelect = node;
2618
+ };
2619
+
2620
+ _this.renderSelect = function (_ref) {
2621
+ var _classNames;
2622
+
2623
+ var getContextPopupContainer = _ref.getPopupContainer,
2624
+ getPrefixCls = _ref.getPrefixCls,
2625
+ renderEmpty = _ref.renderEmpty;
2626
+
2627
+ var _a = _this.props,
2628
+ customizePrefixCls = _a.prefixCls,
2629
+ _a$className = _a.className,
2630
+ className = _a$className === void 0 ? '' : _a$className,
2631
+ size = _a.size,
2632
+ mode = _a.mode,
2633
+ getPopupContainer = _a.getPopupContainer,
2634
+ removeIcon = _a.removeIcon,
2635
+ clearIcon = _a.clearIcon,
2636
+ menuItemSelectedIcon = _a.menuItemSelectedIcon,
2637
+ showArrow = _a.showArrow,
2638
+ restProps = __rest(_a, ["prefixCls", "className", "size", "mode", "getPopupContainer", "removeIcon", "clearIcon", "menuItemSelectedIcon", "showArrow"]);
2639
+
2640
+ var rest = omit(restProps, ['inputIcon']);
2641
+ var prefixCls = getPrefixCls('select', customizePrefixCls);
2642
+ var cls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _defineProperty(_classNames, "".concat(prefixCls, "-show-arrow"), showArrow), _classNames), className);
2643
+ var optionLabelProp = _this.props.optionLabelProp;
2644
+
2645
+ if (_this.isCombobox()) {
2646
+ // children 带 dom 结构时,无法填入输入框
2647
+ optionLabelProp = optionLabelProp || 'value';
2648
+ }
2649
+
2650
+ var modeConfig = {
2651
+ multiple: mode === 'multiple',
2652
+ tags: mode === 'tags',
2653
+ combobox: _this.isCombobox()
2654
+ };
2655
+ var finalRemoveIcon = removeIcon && ( /*#__PURE__*/React.isValidElement(removeIcon) ? /*#__PURE__*/React.cloneElement(removeIcon, {
2656
+ className: classNames(removeIcon.props.className, "".concat(prefixCls, "-remove-icon"))
2657
+ }) : removeIcon) || /*#__PURE__*/React.createElement(Icon, {
2658
+ type: "close",
2659
+ className: "".concat(prefixCls, "-remove-icon")
2660
+ });
2661
+ var finalClearIcon = clearIcon && ( /*#__PURE__*/React.isValidElement(clearIcon) ? /*#__PURE__*/React.cloneElement(clearIcon, {
2662
+ className: classNames(clearIcon.props.className, "".concat(prefixCls, "-clear-icon"))
2663
+ }) : clearIcon) || /*#__PURE__*/React.createElement(Icon, {
2664
+ type: "close-circle",
2665
+ theme: "filled",
2666
+ className: "".concat(prefixCls, "-clear-icon")
2667
+ });
2668
+ var finalMenuItemSelectedIcon = menuItemSelectedIcon && ( /*#__PURE__*/React.isValidElement(menuItemSelectedIcon) ? /*#__PURE__*/React.cloneElement(menuItemSelectedIcon, {
2669
+ className: classNames(menuItemSelectedIcon.props.className, "".concat(prefixCls, "-selected-icon"))
2670
+ }) : menuItemSelectedIcon) || /*#__PURE__*/React.createElement(Icon, {
2671
+ type: "check",
2672
+ className: "".concat(prefixCls, "-selected-icon")
2673
+ });
2674
+ return /*#__PURE__*/React.createElement(Select$1, _extends({
2675
+ inputIcon: _this.renderSuffixIcon(prefixCls),
2676
+ removeIcon: finalRemoveIcon,
2677
+ clearIcon: finalClearIcon,
2678
+ menuItemSelectedIcon: finalMenuItemSelectedIcon,
2679
+ showArrow: showArrow
2680
+ }, rest, modeConfig, {
2681
+ prefixCls: prefixCls,
2682
+ className: cls,
2683
+ optionLabelProp: optionLabelProp || 'children',
2684
+ notFoundContent: _this.getNotFoundContent(renderEmpty),
2685
+ getPopupContainer: getPopupContainer || getContextPopupContainer,
2686
+ ref: _this.saveSelect
2687
+ }));
2688
+ };
2689
+ return _this;
2690
+ }
2691
+
2692
+ _createClass(Select, [{
2693
+ key: "getNotFoundContent",
2694
+ value: function getNotFoundContent(renderEmpty) {
2695
+ var notFoundContent = this.props.notFoundContent;
2696
+
2697
+ if (notFoundContent !== undefined) {
2698
+ return notFoundContent;
2699
+ }
2700
+
2701
+ if (this.isCombobox()) {
2702
+ return null;
2703
+ }
2704
+
2705
+ return renderEmpty('Select');
2706
+ }
2707
+ }, {
2708
+ key: "focus",
2709
+ value: function focus() {
2710
+ this.rcSelect.focus();
2711
+ }
2712
+ }, {
2713
+ key: "blur",
2714
+ value: function blur() {
2715
+ this.rcSelect.blur();
2716
+ }
2717
+ }, {
2718
+ key: "isCombobox",
2719
+ value: function isCombobox() {
2720
+ var mode = this.props.mode;
2721
+ return mode === 'combobox' || mode === Select.SECRET_COMBOBOX_MODE_DO_NOT_USE;
2722
+ }
2723
+ }, {
2724
+ key: "renderSuffixIcon",
2725
+ value: function renderSuffixIcon(prefixCls) {
2726
+ var _this$props = this.props,
2727
+ loading = _this$props.loading,
2728
+ suffixIcon = _this$props.suffixIcon;
2729
+
2730
+ if (suffixIcon) {
2731
+ return /*#__PURE__*/React.isValidElement(suffixIcon) ? /*#__PURE__*/React.cloneElement(suffixIcon, {
2732
+ className: classNames(suffixIcon.props.className, "".concat(prefixCls, "-arrow-icon"))
2733
+ }) : suffixIcon;
2734
+ }
2735
+
2736
+ if (loading) {
2737
+ return /*#__PURE__*/React.createElement(Icon, {
2738
+ type: "loading"
2739
+ });
2740
+ }
2741
+
2742
+ return /*#__PURE__*/React.createElement(Icon, {
2743
+ type: "down",
2744
+ className: "".concat(prefixCls, "-arrow-icon")
2745
+ });
2746
+ }
2747
+ }, {
2748
+ key: "render",
2749
+ value: function render() {
2750
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderSelect);
2751
+ }
2752
+ }]);
2753
+
2754
+ return Select;
2755
+ }(React.Component);
2756
+ Select.Option = Option;
2757
+ Select.OptGroup = OptGroup;
2758
+ Select.SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
2759
+ Select.defaultProps = {
2760
+ showSearch: false,
2761
+ transitionName: 'slide-up',
2762
+ choiceTransitionName: 'zoom'
2763
+ };
2764
+ Select.propTypes = SelectPropTypes;
2765
+
2766
+ export { Select as S };