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
package/dist/input.js ADDED
@@ -0,0 +1,475 @@
1
+ import * as React from 'react';
2
+ import { c as classNames, C as ConfigConsumer, p as propTypesExports } from './config-provider.js';
3
+ import { p as polyfill } from './menu.js';
4
+ import { e as _extends$1, I as Icon } from './icon.js';
5
+
6
+ function omit(obj, fields) {
7
+ var shallowCopy = _extends$1({}, obj);
8
+ for (var i = 0; i < fields.length; i++) {
9
+ var key = fields[i];
10
+ delete shallowCopy[key];
11
+ }
12
+ return shallowCopy;
13
+ }
14
+
15
+ // https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
16
+ var tuple = function tuple() {
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
19
+ }
20
+
21
+ return args;
22
+ };
23
+ var tupleNum = function tupleNum() {
24
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
25
+ args[_key2] = arguments[_key2];
26
+ }
27
+
28
+ return args;
29
+ };
30
+
31
+ function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
32
+
33
+ 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; }
34
+
35
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36
+
37
+ 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); } }
38
+
39
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
40
+
41
+ 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); }
42
+
43
+ function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
44
+
45
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$1(this, result); }; }
46
+
47
+ function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
48
+
49
+ function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
50
+
51
+ function _isNativeReflectConstruct$1() { 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; } }
52
+
53
+ function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
54
+ var ClearableInputType = tuple('text', 'input');
55
+ function hasPrefixSuffix(props) {
56
+ return !!(props.prefix || props.suffix || props.allowClear);
57
+ }
58
+
59
+ var ClearableLabeledInput = /*#__PURE__*/function (_React$Component) {
60
+ _inherits$1(ClearableLabeledInput, _React$Component);
61
+
62
+ var _super = _createSuper$1(ClearableLabeledInput);
63
+
64
+ function ClearableLabeledInput() {
65
+ _classCallCheck$1(this, ClearableLabeledInput);
66
+
67
+ return _super.apply(this, arguments);
68
+ }
69
+
70
+ _createClass$1(ClearableLabeledInput, [{
71
+ key: "renderClearIcon",
72
+ value: function renderClearIcon(prefixCls) {
73
+ var _this$props = this.props,
74
+ allowClear = _this$props.allowClear,
75
+ value = _this$props.value,
76
+ disabled = _this$props.disabled,
77
+ readOnly = _this$props.readOnly,
78
+ inputType = _this$props.inputType,
79
+ handleReset = _this$props.handleReset;
80
+
81
+ if (!allowClear || disabled || readOnly || value === undefined || value === null || value === '') {
82
+ return null;
83
+ }
84
+
85
+ var className = inputType === ClearableInputType[0] ? "".concat(prefixCls, "-textarea-clear-icon") : "".concat(prefixCls, "-clear-icon");
86
+ return /*#__PURE__*/React.createElement(Icon, {
87
+ type: "close-circle",
88
+ theme: "filled",
89
+ onClick: handleReset,
90
+ className: className,
91
+ role: "button"
92
+ });
93
+ }
94
+ }, {
95
+ key: "renderSuffix",
96
+ value: function renderSuffix(prefixCls) {
97
+ var _this$props2 = this.props,
98
+ suffix = _this$props2.suffix,
99
+ allowClear = _this$props2.allowClear;
100
+
101
+ if (suffix || allowClear) {
102
+ return /*#__PURE__*/React.createElement("span", {
103
+ className: "".concat(prefixCls, "-suffix")
104
+ }, this.renderClearIcon(prefixCls), suffix);
105
+ }
106
+
107
+ return null;
108
+ }
109
+ }, {
110
+ key: "renderLabeledIcon",
111
+ value: function renderLabeledIcon(prefixCls, element) {
112
+ var _classNames;
113
+
114
+ var props = this.props;
115
+ var suffix = this.renderSuffix(prefixCls);
116
+
117
+ if (!hasPrefixSuffix(props)) {
118
+ return /*#__PURE__*/React.cloneElement(element, {
119
+ value: props.value
120
+ });
121
+ }
122
+
123
+ var prefix = props.prefix ? /*#__PURE__*/React.createElement("span", {
124
+ className: "".concat(prefixCls, "-prefix")
125
+ }, props.prefix) : null;
126
+ var affixWrapperCls = classNames(props.className, "".concat(prefixCls, "-affix-wrapper"), (_classNames = {}, _defineProperty$1(_classNames, "".concat(prefixCls, "-affix-wrapper-sm"), props.size === 'small'), _defineProperty$1(_classNames, "".concat(prefixCls, "-affix-wrapper-lg"), props.size === 'large'), _defineProperty$1(_classNames, "".concat(prefixCls, "-affix-wrapper-input-with-clear-btn"), props.suffix && props.allowClear && this.props.value), _classNames));
127
+ return /*#__PURE__*/React.createElement("span", {
128
+ className: affixWrapperCls,
129
+ style: props.style
130
+ }, prefix, /*#__PURE__*/React.cloneElement(element, {
131
+ style: null,
132
+ value: props.value,
133
+ className: getInputClassName(prefixCls, props.size, props.disabled)
134
+ }), suffix);
135
+ }
136
+ }, {
137
+ key: "renderInputWithLabel",
138
+ value: function renderInputWithLabel(prefixCls, labeledElement) {
139
+ var _classNames3;
140
+
141
+ var _this$props3 = this.props,
142
+ addonBefore = _this$props3.addonBefore,
143
+ addonAfter = _this$props3.addonAfter,
144
+ style = _this$props3.style,
145
+ size = _this$props3.size,
146
+ className = _this$props3.className; // Not wrap when there is not addons
147
+
148
+ if (!addonBefore && !addonAfter) {
149
+ return labeledElement;
150
+ }
151
+
152
+ var wrapperClassName = "".concat(prefixCls, "-group");
153
+ var addonClassName = "".concat(wrapperClassName, "-addon");
154
+ var addonBeforeNode = addonBefore ? /*#__PURE__*/React.createElement("span", {
155
+ className: addonClassName
156
+ }, addonBefore) : null;
157
+ var addonAfterNode = addonAfter ? /*#__PURE__*/React.createElement("span", {
158
+ className: addonClassName
159
+ }, addonAfter) : null;
160
+ var mergedWrapperClassName = classNames("".concat(prefixCls, "-wrapper"), _defineProperty$1({}, wrapperClassName, addonBefore || addonAfter));
161
+ var mergedGroupClassName = classNames(className, "".concat(prefixCls, "-group-wrapper"), (_classNames3 = {}, _defineProperty$1(_classNames3, "".concat(prefixCls, "-group-wrapper-sm"), size === 'small'), _defineProperty$1(_classNames3, "".concat(prefixCls, "-group-wrapper-lg"), size === 'large'), _classNames3)); // Need another wrapper for changing display:table to display:inline-block
162
+ // and put style prop in wrapper
163
+
164
+ return /*#__PURE__*/React.createElement("span", {
165
+ className: mergedGroupClassName,
166
+ style: style
167
+ }, /*#__PURE__*/React.createElement("span", {
168
+ className: mergedWrapperClassName
169
+ }, addonBeforeNode, /*#__PURE__*/React.cloneElement(labeledElement, {
170
+ style: null
171
+ }), addonAfterNode));
172
+ }
173
+ }, {
174
+ key: "renderTextAreaWithClearIcon",
175
+ value: function renderTextAreaWithClearIcon(prefixCls, element) {
176
+ var _this$props4 = this.props,
177
+ value = _this$props4.value,
178
+ allowClear = _this$props4.allowClear,
179
+ className = _this$props4.className,
180
+ style = _this$props4.style;
181
+
182
+ if (!allowClear) {
183
+ return /*#__PURE__*/React.cloneElement(element, {
184
+ value: value
185
+ });
186
+ }
187
+
188
+ var affixWrapperCls = classNames(className, "".concat(prefixCls, "-affix-wrapper"), "".concat(prefixCls, "-affix-wrapper-textarea-with-clear-btn"));
189
+ return /*#__PURE__*/React.createElement("span", {
190
+ className: affixWrapperCls,
191
+ style: style
192
+ }, /*#__PURE__*/React.cloneElement(element, {
193
+ style: null,
194
+ value: value
195
+ }), this.renderClearIcon(prefixCls));
196
+ }
197
+ }, {
198
+ key: "renderClearableLabeledInput",
199
+ value: function renderClearableLabeledInput() {
200
+ var _this$props5 = this.props,
201
+ prefixCls = _this$props5.prefixCls,
202
+ inputType = _this$props5.inputType,
203
+ element = _this$props5.element;
204
+
205
+ if (inputType === ClearableInputType[0]) {
206
+ return this.renderTextAreaWithClearIcon(prefixCls, element);
207
+ }
208
+
209
+ return this.renderInputWithLabel(prefixCls, this.renderLabeledIcon(prefixCls, element));
210
+ }
211
+ }, {
212
+ key: "render",
213
+ value: function render() {
214
+ return this.renderClearableLabeledInput();
215
+ }
216
+ }]);
217
+
218
+ return ClearableLabeledInput;
219
+ }(React.Component);
220
+
221
+ polyfill(ClearableLabeledInput);
222
+
223
+ 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); }
224
+
225
+ 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); }
226
+
227
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
228
+
229
+ 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); } }
230
+
231
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
232
+
233
+ 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); }
234
+
235
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
236
+
237
+ 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); }; }
238
+
239
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
240
+
241
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
242
+
243
+ 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; } }
244
+
245
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
246
+
247
+ 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; }
248
+ var InputSizes = tuple('small', 'default', 'large');
249
+ function fixControlledValue(value) {
250
+ if (typeof value === 'undefined' || value === null) {
251
+ return '';
252
+ }
253
+
254
+ return value;
255
+ }
256
+ function resolveOnChange(target, e, onChange) {
257
+ if (onChange) {
258
+ var event = e;
259
+
260
+ if (e.type === 'click') {
261
+ // click clear icon
262
+ event = Object.create(e);
263
+ event.target = target;
264
+ event.currentTarget = target;
265
+ var originalInputValue = target.value; // change target ref value cause e.target.value should be '' when clear input
266
+
267
+ target.value = '';
268
+ onChange(event); // reset target ref value
269
+
270
+ target.value = originalInputValue;
271
+ return;
272
+ }
273
+
274
+ onChange(event);
275
+ }
276
+ }
277
+ function getInputClassName(prefixCls, size, disabled) {
278
+ var _classNames;
279
+
280
+ return classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
281
+ }
282
+
283
+ var Input = /*#__PURE__*/function (_React$Component) {
284
+ _inherits(Input, _React$Component);
285
+
286
+ var _super = _createSuper(Input);
287
+
288
+ function Input(props) {
289
+ var _this;
290
+
291
+ _classCallCheck(this, Input);
292
+
293
+ _this = _super.call(this, props);
294
+
295
+ _this.saveClearableInput = function (input) {
296
+ _this.clearableInput = input;
297
+ };
298
+
299
+ _this.saveInput = function (input) {
300
+ _this.input = input;
301
+ };
302
+
303
+ _this.handleReset = function (e) {
304
+ _this.setValue('', function () {
305
+ _this.focus();
306
+ });
307
+
308
+ resolveOnChange(_this.input, e, _this.props.onChange);
309
+ };
310
+
311
+ _this.renderInput = function (prefixCls) {
312
+ var _this$props = _this.props,
313
+ className = _this$props.className,
314
+ addonBefore = _this$props.addonBefore,
315
+ addonAfter = _this$props.addonAfter,
316
+ size = _this$props.size,
317
+ disabled = _this$props.disabled; // Fix https://fb.me/react-unknown-prop
318
+
319
+ var otherProps = omit(_this.props, ['prefixCls', 'onPressEnter', 'addonBefore', 'addonAfter', 'prefix', 'suffix', 'allowClear', // Input elements must be either controlled or uncontrolled,
320
+ // specify either the value prop, or the defaultValue prop, but not both.
321
+ 'defaultValue', 'size', 'inputType']);
322
+ return /*#__PURE__*/React.createElement("input", _extends({}, otherProps, {
323
+ onChange: _this.handleChange,
324
+ onKeyDown: _this.handleKeyDown,
325
+ className: classNames(getInputClassName(prefixCls, size, disabled), _defineProperty({}, className, className && !addonBefore && !addonAfter)),
326
+ ref: _this.saveInput
327
+ }));
328
+ };
329
+
330
+ _this.clearPasswordValueAttribute = function () {
331
+ // https://github.com/ant-design/ant-design/issues/20541
332
+ _this.removePasswordTimeout = setTimeout(function () {
333
+ if (_this.input && _this.input.getAttribute('type') === 'password' && _this.input.hasAttribute('value')) {
334
+ _this.input.removeAttribute('value');
335
+ }
336
+ });
337
+ };
338
+
339
+ _this.handleChange = function (e) {
340
+ _this.setValue(e.target.value, _this.clearPasswordValueAttribute);
341
+
342
+ resolveOnChange(_this.input, e, _this.props.onChange);
343
+ };
344
+
345
+ _this.handleKeyDown = function (e) {
346
+ var _this$props2 = _this.props,
347
+ onPressEnter = _this$props2.onPressEnter,
348
+ onKeyDown = _this$props2.onKeyDown;
349
+
350
+ if (e.keyCode === 13 && onPressEnter) {
351
+ onPressEnter(e);
352
+ }
353
+
354
+ if (onKeyDown) {
355
+ onKeyDown(e);
356
+ }
357
+ };
358
+
359
+ _this.renderComponent = function (_ref) {
360
+ var getPrefixCls = _ref.getPrefixCls;
361
+ var value = _this.state.value;
362
+ var customizePrefixCls = _this.props.prefixCls;
363
+ var prefixCls = getPrefixCls('input', customizePrefixCls);
364
+ return /*#__PURE__*/React.createElement(ClearableLabeledInput, _extends({}, _this.props, {
365
+ prefixCls: prefixCls,
366
+ inputType: "input",
367
+ value: fixControlledValue(value),
368
+ element: _this.renderInput(prefixCls),
369
+ handleReset: _this.handleReset,
370
+ ref: _this.saveClearableInput
371
+ }));
372
+ };
373
+
374
+ var value = typeof props.value === 'undefined' ? props.defaultValue : props.value;
375
+ _this.state = {
376
+ value: value
377
+ };
378
+ return _this;
379
+ }
380
+
381
+ _createClass(Input, [{
382
+ key: "componentDidMount",
383
+ value: function componentDidMount() {
384
+ this.clearPasswordValueAttribute();
385
+ } // Since polyfill `getSnapshotBeforeUpdate` need work with `componentDidUpdate`.
386
+ // We keep an empty function here.
387
+
388
+ }, {
389
+ key: "componentDidUpdate",
390
+ value: function componentDidUpdate() {}
391
+ }, {
392
+ key: "getSnapshotBeforeUpdate",
393
+ value: function getSnapshotBeforeUpdate(prevProps) {
394
+
395
+ return null;
396
+ }
397
+ }, {
398
+ key: "componentWillUnmount",
399
+ value: function componentWillUnmount() {
400
+ if (this.removePasswordTimeout) {
401
+ clearTimeout(this.removePasswordTimeout);
402
+ }
403
+ }
404
+ }, {
405
+ key: "focus",
406
+ value: function focus() {
407
+ this.input.focus();
408
+ }
409
+ }, {
410
+ key: "blur",
411
+ value: function blur() {
412
+ this.input.blur();
413
+ }
414
+ }, {
415
+ key: "select",
416
+ value: function select() {
417
+ this.input.select();
418
+ }
419
+ }, {
420
+ key: "setValue",
421
+ value: function setValue(value, callback) {
422
+ if (!('value' in this.props)) {
423
+ this.setState({
424
+ value: value
425
+ }, callback);
426
+ }
427
+ }
428
+ }, {
429
+ key: "render",
430
+ value: function render() {
431
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderComponent);
432
+ }
433
+ }], [{
434
+ key: "getDerivedStateFromProps",
435
+ value: function getDerivedStateFromProps(nextProps) {
436
+ if ('value' in nextProps) {
437
+ return {
438
+ value: nextProps.value
439
+ };
440
+ }
441
+
442
+ return null;
443
+ }
444
+ }]);
445
+
446
+ return Input;
447
+ }(React.Component);
448
+
449
+ Input.defaultProps = {
450
+ type: 'text'
451
+ };
452
+ Input.propTypes = {
453
+ type: propTypesExports.string,
454
+ id: propTypesExports.string,
455
+ size: propTypesExports.oneOf(InputSizes),
456
+ maxLength: propTypesExports.number,
457
+ disabled: propTypesExports.bool,
458
+ value: propTypesExports.any,
459
+ defaultValue: propTypesExports.any,
460
+ className: propTypesExports.string,
461
+ addonBefore: propTypesExports.node,
462
+ addonAfter: propTypesExports.node,
463
+ prefixCls: propTypesExports.string,
464
+ onPressEnter: propTypesExports.func,
465
+ onKeyDown: propTypesExports.func,
466
+ onKeyUp: propTypesExports.func,
467
+ onFocus: propTypesExports.func,
468
+ onBlur: propTypesExports.func,
469
+ prefix: propTypesExports.node,
470
+ suffix: propTypesExports.node,
471
+ allowClear: propTypesExports.bool
472
+ };
473
+ polyfill(Input);
474
+
475
+ export { ClearableLabeledInput as C, Input as I, tupleNum as a, fixControlledValue as f, omit as o, resolveOnChange as r, tuple as t };