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,1755 @@
1
+ import * as React from 'react';
2
+ import React__default, { Component } from 'react';
3
+ import { m as moment, c as classNames, P as PropTypes, j as locale, C as ConfigConsumer, o as interopDefault, q as moment$1, L as LocaleReceiver } from './config-provider.js';
4
+ import { o as omit } from './input.js';
5
+ import { r as raf, p as polyfill, b as Trigger } from './menu.js';
6
+ import ReactDOM__default from 'react-dom';
7
+ import { I as Icon } from './icon.js';
8
+
9
+ function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+
11
+ function _defineProperties$5(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); } }
12
+
13
+ function _createClass$5(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$5(Constructor.prototype, protoProps); return Constructor; }
14
+
15
+ function _possibleConstructorReturn$5(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$5(self); }
16
+
17
+ function _getPrototypeOf$5(o) { _getPrototypeOf$5 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$5(o); }
18
+
19
+ function _assertThisInitialized$5(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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
+ function _defineProperty$5(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; }
26
+
27
+ var Header =
28
+ /*#__PURE__*/
29
+ function (_Component) {
30
+ _inherits$5(Header, _Component);
31
+
32
+ function Header(props) {
33
+ var _this;
34
+
35
+ _classCallCheck$5(this, Header);
36
+
37
+ _this = _possibleConstructorReturn$5(this, _getPrototypeOf$5(Header).call(this, props));
38
+
39
+ _defineProperty$5(_assertThisInitialized$5(_this), "onInputChange", function (event) {
40
+ var str = event.target.value;
41
+
42
+ _this.setState({
43
+ str: str
44
+ });
45
+
46
+ var _this$props = _this.props,
47
+ format = _this$props.format,
48
+ hourOptions = _this$props.hourOptions,
49
+ minuteOptions = _this$props.minuteOptions,
50
+ secondOptions = _this$props.secondOptions,
51
+ disabledHours = _this$props.disabledHours,
52
+ disabledMinutes = _this$props.disabledMinutes,
53
+ disabledSeconds = _this$props.disabledSeconds,
54
+ onChange = _this$props.onChange;
55
+
56
+ if (str) {
57
+ var originalValue = _this.props.value;
58
+
59
+ var value = _this.getProtoValue().clone();
60
+
61
+ var parsed = moment(str, format, true);
62
+
63
+ if (!parsed.isValid()) {
64
+ _this.setState({
65
+ invalid: true
66
+ });
67
+
68
+ return;
69
+ }
70
+
71
+ value.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); // if time value not allowed, response warning.
72
+
73
+ if (hourOptions.indexOf(value.hour()) < 0 || minuteOptions.indexOf(value.minute()) < 0 || secondOptions.indexOf(value.second()) < 0) {
74
+ _this.setState({
75
+ invalid: true
76
+ });
77
+
78
+ return;
79
+ } // if time value is disabled, response warning.
80
+
81
+
82
+ var disabledHourOptions = disabledHours();
83
+ var disabledMinuteOptions = disabledMinutes(value.hour());
84
+ var disabledSecondOptions = disabledSeconds(value.hour(), value.minute());
85
+
86
+ if (disabledHourOptions && disabledHourOptions.indexOf(value.hour()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value.minute()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value.second()) >= 0) {
87
+ _this.setState({
88
+ invalid: true
89
+ });
90
+
91
+ return;
92
+ }
93
+
94
+ if (originalValue) {
95
+ if (originalValue.hour() !== value.hour() || originalValue.minute() !== value.minute() || originalValue.second() !== value.second()) {
96
+ // keep other fields for rc-calendar
97
+ var changedValue = originalValue.clone();
98
+ changedValue.hour(value.hour());
99
+ changedValue.minute(value.minute());
100
+ changedValue.second(value.second());
101
+ onChange(changedValue);
102
+ }
103
+ } else if (originalValue !== value) {
104
+ onChange(value);
105
+ }
106
+ } else {
107
+ onChange(null);
108
+ }
109
+
110
+ _this.setState({
111
+ invalid: false
112
+ });
113
+ });
114
+
115
+ _defineProperty$5(_assertThisInitialized$5(_this), "onKeyDown", function (e) {
116
+ var _this$props2 = _this.props,
117
+ onEsc = _this$props2.onEsc,
118
+ onKeyDown = _this$props2.onKeyDown;
119
+
120
+ if (e.keyCode === 27) {
121
+ onEsc();
122
+ }
123
+
124
+ onKeyDown(e);
125
+ });
126
+
127
+ var _value = props.value,
128
+ _format = props.format;
129
+ _this.state = {
130
+ str: _value && _value.format(_format) || '',
131
+ invalid: false
132
+ };
133
+ return _this;
134
+ }
135
+
136
+ _createClass$5(Header, [{
137
+ key: "componentDidMount",
138
+ value: function componentDidMount() {
139
+ var _this2 = this;
140
+
141
+ var focusOnOpen = this.props.focusOnOpen;
142
+
143
+ if (focusOnOpen) {
144
+ // Wait one frame for the panel to be positioned before focusing
145
+ var requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;
146
+ requestAnimationFrame(function () {
147
+ _this2.refInput.focus();
148
+
149
+ _this2.refInput.select();
150
+ });
151
+ }
152
+ }
153
+ }, {
154
+ key: "componentDidUpdate",
155
+ value: function componentDidUpdate(prevProps) {
156
+ var _this$props3 = this.props,
157
+ value = _this$props3.value,
158
+ format = _this$props3.format;
159
+
160
+ if (value !== prevProps.value) {
161
+ // eslint-disable-next-line react/no-did-update-set-state
162
+ this.setState({
163
+ str: value && value.format(format) || '',
164
+ invalid: false
165
+ });
166
+ }
167
+ }
168
+ }, {
169
+ key: "getProtoValue",
170
+ value: function getProtoValue() {
171
+ var _this$props4 = this.props,
172
+ value = _this$props4.value,
173
+ defaultOpenValue = _this$props4.defaultOpenValue;
174
+ return value || defaultOpenValue;
175
+ }
176
+ }, {
177
+ key: "getInput",
178
+ value: function getInput() {
179
+ var _this3 = this;
180
+
181
+ var _this$props5 = this.props,
182
+ prefixCls = _this$props5.prefixCls,
183
+ placeholder = _this$props5.placeholder,
184
+ inputReadOnly = _this$props5.inputReadOnly;
185
+ var _this$state = this.state,
186
+ invalid = _this$state.invalid,
187
+ str = _this$state.str;
188
+ var invalidClass = invalid ? "".concat(prefixCls, "-input-invalid") : '';
189
+ return React__default.createElement("input", {
190
+ className: classNames("".concat(prefixCls, "-input"), invalidClass),
191
+ ref: function ref(_ref) {
192
+ _this3.refInput = _ref;
193
+ },
194
+ onKeyDown: this.onKeyDown,
195
+ value: str,
196
+ placeholder: placeholder,
197
+ onChange: this.onInputChange,
198
+ readOnly: !!inputReadOnly
199
+ });
200
+ }
201
+ }, {
202
+ key: "render",
203
+ value: function render() {
204
+ var prefixCls = this.props.prefixCls;
205
+ return React__default.createElement("div", {
206
+ className: "".concat(prefixCls, "-input-wrap")
207
+ }, this.getInput());
208
+ }
209
+ }]);
210
+
211
+ return Header;
212
+ }(Component);
213
+
214
+ _defineProperty$5(Header, "propTypes", {
215
+ format: PropTypes.string,
216
+ prefixCls: PropTypes.string,
217
+ disabledDate: PropTypes.func,
218
+ placeholder: PropTypes.string,
219
+ clearText: PropTypes.string,
220
+ value: PropTypes.object,
221
+ inputReadOnly: PropTypes.bool,
222
+ hourOptions: PropTypes.array,
223
+ minuteOptions: PropTypes.array,
224
+ secondOptions: PropTypes.array,
225
+ disabledHours: PropTypes.func,
226
+ disabledMinutes: PropTypes.func,
227
+ disabledSeconds: PropTypes.func,
228
+ onChange: PropTypes.func,
229
+ onEsc: PropTypes.func,
230
+ defaultOpenValue: PropTypes.object,
231
+ currentSelectPanel: PropTypes.string,
232
+ focusOnOpen: PropTypes.bool,
233
+ onKeyDown: PropTypes.func,
234
+ clearIcon: PropTypes.node
235
+ });
236
+
237
+ _defineProperty$5(Header, "defaultProps", {
238
+ inputReadOnly: false
239
+ });
240
+
241
+ function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
242
+
243
+ function _defineProperties$4(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); } }
244
+
245
+ function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); return Constructor; }
246
+
247
+ function _possibleConstructorReturn$4(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$4(self); }
248
+
249
+ function _getPrototypeOf$4(o) { _getPrototypeOf$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$4(o); }
250
+
251
+ function _assertThisInitialized$4(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
252
+
253
+ 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); }
254
+
255
+ function _setPrototypeOf$4(o, p) { _setPrototypeOf$4 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$4(o, p); }
256
+
257
+ function _defineProperty$4(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; }
258
+
259
+ var scrollTo = function scrollTo(element, to, duration) {
260
+ // jump to target if duration zero
261
+ if (duration <= 0) {
262
+ raf(function () {
263
+ element.scrollTop = to;
264
+ });
265
+ return;
266
+ }
267
+
268
+ var difference = to - element.scrollTop;
269
+ var perTick = difference / duration * 10;
270
+ raf(function () {
271
+ element.scrollTop += perTick;
272
+ if (element.scrollTop === to) return;
273
+ scrollTo(element, to, duration - 10);
274
+ });
275
+ };
276
+
277
+ var Select =
278
+ /*#__PURE__*/
279
+ function (_Component) {
280
+ _inherits$4(Select, _Component);
281
+
282
+ function Select() {
283
+ var _getPrototypeOf2;
284
+
285
+ var _this;
286
+
287
+ _classCallCheck$4(this, Select);
288
+
289
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
290
+ args[_key] = arguments[_key];
291
+ }
292
+
293
+ _this = _possibleConstructorReturn$4(this, (_getPrototypeOf2 = _getPrototypeOf$4(Select)).call.apply(_getPrototypeOf2, [this].concat(args)));
294
+
295
+ _defineProperty$4(_assertThisInitialized$4(_this), "state", {
296
+ active: false
297
+ });
298
+
299
+ _defineProperty$4(_assertThisInitialized$4(_this), "onSelect", function (value) {
300
+ var _this$props = _this.props,
301
+ onSelect = _this$props.onSelect,
302
+ type = _this$props.type;
303
+ onSelect(type, value);
304
+ });
305
+
306
+ _defineProperty$4(_assertThisInitialized$4(_this), "handleMouseEnter", function (e) {
307
+ var onMouseEnter = _this.props.onMouseEnter;
308
+
309
+ _this.setState({
310
+ active: true
311
+ });
312
+
313
+ onMouseEnter(e);
314
+ });
315
+
316
+ _defineProperty$4(_assertThisInitialized$4(_this), "handleMouseLeave", function () {
317
+ _this.setState({
318
+ active: false
319
+ });
320
+ });
321
+
322
+ _defineProperty$4(_assertThisInitialized$4(_this), "saveList", function (node) {
323
+ _this.list = node;
324
+ });
325
+
326
+ return _this;
327
+ }
328
+
329
+ _createClass$4(Select, [{
330
+ key: "componentDidMount",
331
+ value: function componentDidMount() {
332
+ // jump to selected option
333
+ this.scrollToSelected(0);
334
+ }
335
+ }, {
336
+ key: "componentDidUpdate",
337
+ value: function componentDidUpdate(prevProps) {
338
+ var selectedIndex = this.props.selectedIndex; // smooth scroll to selected option
339
+
340
+ if (prevProps.selectedIndex !== selectedIndex) {
341
+ this.scrollToSelected(120);
342
+ }
343
+ }
344
+ }, {
345
+ key: "getOptions",
346
+ value: function getOptions() {
347
+ var _this2 = this;
348
+
349
+ var _this$props2 = this.props,
350
+ options = _this$props2.options,
351
+ selectedIndex = _this$props2.selectedIndex,
352
+ prefixCls = _this$props2.prefixCls,
353
+ onEsc = _this$props2.onEsc;
354
+ return options.map(function (item, index) {
355
+ var _classNames;
356
+
357
+ var cls = classNames((_classNames = {}, _defineProperty$4(_classNames, "".concat(prefixCls, "-select-option-selected"), selectedIndex === index), _defineProperty$4(_classNames, "".concat(prefixCls, "-select-option-disabled"), item.disabled), _classNames));
358
+ var onClick = item.disabled ? undefined : function () {
359
+ _this2.onSelect(item.value);
360
+ };
361
+
362
+ var onKeyDown = function onKeyDown(e) {
363
+ if (e.keyCode === 13) onClick();else if (e.keyCode === 27) onEsc();
364
+ };
365
+
366
+ return React__default.createElement("li", {
367
+ role: "button",
368
+ onClick: onClick,
369
+ className: cls,
370
+ key: index,
371
+ disabled: item.disabled,
372
+ tabIndex: "0",
373
+ onKeyDown: onKeyDown
374
+ }, item.value);
375
+ });
376
+ }
377
+ }, {
378
+ key: "scrollToSelected",
379
+ value: function scrollToSelected(duration) {
380
+ // move to selected item
381
+ var selectedIndex = this.props.selectedIndex;
382
+ var select = ReactDOM__default.findDOMNode(this);
383
+ var list = ReactDOM__default.findDOMNode(this.list);
384
+
385
+ if (!list) {
386
+ return;
387
+ }
388
+
389
+ var index = selectedIndex;
390
+
391
+ if (index < 0) {
392
+ index = 0;
393
+ }
394
+
395
+ var topOption = list.children[index];
396
+ var to = topOption.offsetTop;
397
+ scrollTo(select, to, duration);
398
+ }
399
+ }, {
400
+ key: "render",
401
+ value: function render() {
402
+ var _this$props3 = this.props,
403
+ prefixCls = _this$props3.prefixCls,
404
+ options = _this$props3.options;
405
+ var active = this.state.active;
406
+
407
+ if (options.length === 0) {
408
+ return null;
409
+ }
410
+
411
+ var cls = classNames("".concat(prefixCls, "-select"), _defineProperty$4({}, "".concat(prefixCls, "-select-active"), active));
412
+ return React__default.createElement("div", {
413
+ className: cls,
414
+ onMouseEnter: this.handleMouseEnter,
415
+ onMouseLeave: this.handleMouseLeave
416
+ }, React__default.createElement("ul", {
417
+ ref: this.saveList
418
+ }, this.getOptions()));
419
+ }
420
+ }]);
421
+
422
+ return Select;
423
+ }(Component);
424
+
425
+ _defineProperty$4(Select, "propTypes", {
426
+ prefixCls: PropTypes.string,
427
+ options: PropTypes.array,
428
+ selectedIndex: PropTypes.number,
429
+ type: PropTypes.string,
430
+ onSelect: PropTypes.func,
431
+ onMouseEnter: PropTypes.func,
432
+ onEsc: PropTypes.func
433
+ });
434
+
435
+ function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
436
+
437
+ 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); } }
438
+
439
+ function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); return Constructor; }
440
+
441
+ function _possibleConstructorReturn$3(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$3(self); }
442
+
443
+ function _getPrototypeOf$3(o) { _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$3(o); }
444
+
445
+ function _assertThisInitialized$3(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
446
+
447
+ 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); }
448
+
449
+ function _setPrototypeOf$3(o, p) { _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$3(o, p); }
450
+
451
+ function _defineProperty$3(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; }
452
+
453
+ var formatOption = function formatOption(option, disabledOptions) {
454
+ var value = "".concat(option);
455
+
456
+ if (option < 10) {
457
+ value = "0".concat(option);
458
+ }
459
+
460
+ var disabled = false;
461
+
462
+ if (disabledOptions && disabledOptions.indexOf(option) >= 0) {
463
+ disabled = true;
464
+ }
465
+
466
+ return {
467
+ value: value,
468
+ disabled: disabled
469
+ };
470
+ };
471
+
472
+ var Combobox =
473
+ /*#__PURE__*/
474
+ function (_Component) {
475
+ _inherits$3(Combobox, _Component);
476
+
477
+ function Combobox() {
478
+ var _getPrototypeOf2;
479
+
480
+ var _this;
481
+
482
+ _classCallCheck$3(this, Combobox);
483
+
484
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
485
+ args[_key] = arguments[_key];
486
+ }
487
+
488
+ _this = _possibleConstructorReturn$3(this, (_getPrototypeOf2 = _getPrototypeOf$3(Combobox)).call.apply(_getPrototypeOf2, [this].concat(args)));
489
+
490
+ _defineProperty$3(_assertThisInitialized$3(_this), "onItemChange", function (type, itemValue) {
491
+ var _this$props = _this.props,
492
+ onChange = _this$props.onChange,
493
+ defaultOpenValue = _this$props.defaultOpenValue,
494
+ use12Hours = _this$props.use12Hours,
495
+ propValue = _this$props.value,
496
+ isAM = _this$props.isAM,
497
+ onAmPmChange = _this$props.onAmPmChange;
498
+ var value = (propValue || defaultOpenValue).clone();
499
+
500
+ if (type === 'hour') {
501
+ if (use12Hours) {
502
+ if (isAM) {
503
+ value.hour(+itemValue % 12);
504
+ } else {
505
+ value.hour(+itemValue % 12 + 12);
506
+ }
507
+ } else {
508
+ value.hour(+itemValue);
509
+ }
510
+ } else if (type === 'minute') {
511
+ value.minute(+itemValue);
512
+ } else if (type === 'ampm') {
513
+ var ampm = itemValue.toUpperCase();
514
+
515
+ if (use12Hours) {
516
+ if (ampm === 'PM' && value.hour() < 12) {
517
+ value.hour(value.hour() % 12 + 12);
518
+ }
519
+
520
+ if (ampm === 'AM') {
521
+ if (value.hour() >= 12) {
522
+ value.hour(value.hour() - 12);
523
+ }
524
+ }
525
+ }
526
+
527
+ onAmPmChange(ampm);
528
+ } else {
529
+ value.second(+itemValue);
530
+ }
531
+
532
+ onChange(value);
533
+ });
534
+
535
+ _defineProperty$3(_assertThisInitialized$3(_this), "onEnterSelectPanel", function (range) {
536
+ var onCurrentSelectPanelChange = _this.props.onCurrentSelectPanelChange;
537
+ onCurrentSelectPanelChange(range);
538
+ });
539
+
540
+ return _this;
541
+ }
542
+
543
+ _createClass$3(Combobox, [{
544
+ key: "getHourSelect",
545
+ value: function getHourSelect(hour) {
546
+ var _this2 = this;
547
+
548
+ var _this$props2 = this.props,
549
+ prefixCls = _this$props2.prefixCls,
550
+ hourOptions = _this$props2.hourOptions,
551
+ disabledHours = _this$props2.disabledHours,
552
+ showHour = _this$props2.showHour,
553
+ use12Hours = _this$props2.use12Hours,
554
+ onEsc = _this$props2.onEsc;
555
+
556
+ if (!showHour) {
557
+ return null;
558
+ }
559
+
560
+ var disabledOptions = disabledHours();
561
+ var hourOptionsAdj;
562
+ var hourAdj;
563
+
564
+ if (use12Hours) {
565
+ hourOptionsAdj = [12].concat(hourOptions.filter(function (h) {
566
+ return h < 12 && h > 0;
567
+ }));
568
+ hourAdj = hour % 12 || 12;
569
+ } else {
570
+ hourOptionsAdj = hourOptions;
571
+ hourAdj = hour;
572
+ }
573
+
574
+ return React__default.createElement(Select, {
575
+ prefixCls: prefixCls,
576
+ options: hourOptionsAdj.map(function (option) {
577
+ return formatOption(option, disabledOptions);
578
+ }),
579
+ selectedIndex: hourOptionsAdj.indexOf(hourAdj),
580
+ type: "hour",
581
+ onSelect: this.onItemChange,
582
+ onMouseEnter: function onMouseEnter() {
583
+ return _this2.onEnterSelectPanel('hour');
584
+ },
585
+ onEsc: onEsc
586
+ });
587
+ }
588
+ }, {
589
+ key: "getMinuteSelect",
590
+ value: function getMinuteSelect(minute) {
591
+ var _this3 = this;
592
+
593
+ var _this$props3 = this.props,
594
+ prefixCls = _this$props3.prefixCls,
595
+ minuteOptions = _this$props3.minuteOptions,
596
+ disabledMinutes = _this$props3.disabledMinutes,
597
+ defaultOpenValue = _this$props3.defaultOpenValue,
598
+ showMinute = _this$props3.showMinute,
599
+ propValue = _this$props3.value,
600
+ onEsc = _this$props3.onEsc;
601
+
602
+ if (!showMinute) {
603
+ return null;
604
+ }
605
+
606
+ var value = propValue || defaultOpenValue;
607
+ var disabledOptions = disabledMinutes(value.hour());
608
+ return React__default.createElement(Select, {
609
+ prefixCls: prefixCls,
610
+ options: minuteOptions.map(function (option) {
611
+ return formatOption(option, disabledOptions);
612
+ }),
613
+ selectedIndex: minuteOptions.indexOf(minute),
614
+ type: "minute",
615
+ onSelect: this.onItemChange,
616
+ onMouseEnter: function onMouseEnter() {
617
+ return _this3.onEnterSelectPanel('minute');
618
+ },
619
+ onEsc: onEsc
620
+ });
621
+ }
622
+ }, {
623
+ key: "getSecondSelect",
624
+ value: function getSecondSelect(second) {
625
+ var _this4 = this;
626
+
627
+ var _this$props4 = this.props,
628
+ prefixCls = _this$props4.prefixCls,
629
+ secondOptions = _this$props4.secondOptions,
630
+ disabledSeconds = _this$props4.disabledSeconds,
631
+ showSecond = _this$props4.showSecond,
632
+ defaultOpenValue = _this$props4.defaultOpenValue,
633
+ propValue = _this$props4.value,
634
+ onEsc = _this$props4.onEsc;
635
+
636
+ if (!showSecond) {
637
+ return null;
638
+ }
639
+
640
+ var value = propValue || defaultOpenValue;
641
+ var disabledOptions = disabledSeconds(value.hour(), value.minute());
642
+ return React__default.createElement(Select, {
643
+ prefixCls: prefixCls,
644
+ options: secondOptions.map(function (option) {
645
+ return formatOption(option, disabledOptions);
646
+ }),
647
+ selectedIndex: secondOptions.indexOf(second),
648
+ type: "second",
649
+ onSelect: this.onItemChange,
650
+ onMouseEnter: function onMouseEnter() {
651
+ return _this4.onEnterSelectPanel('second');
652
+ },
653
+ onEsc: onEsc
654
+ });
655
+ }
656
+ }, {
657
+ key: "getAMPMSelect",
658
+ value: function getAMPMSelect() {
659
+ var _this5 = this;
660
+
661
+ var _this$props5 = this.props,
662
+ prefixCls = _this$props5.prefixCls,
663
+ use12Hours = _this$props5.use12Hours,
664
+ format = _this$props5.format,
665
+ isAM = _this$props5.isAM,
666
+ onEsc = _this$props5.onEsc;
667
+
668
+ if (!use12Hours) {
669
+ return null;
670
+ }
671
+
672
+ var AMPMOptions = ['am', 'pm'] // If format has A char, then we should uppercase AM/PM
673
+ .map(function (c) {
674
+ return format.match(/\sA/) ? c.toUpperCase() : c;
675
+ }).map(function (c) {
676
+ return {
677
+ value: c
678
+ };
679
+ });
680
+ var selected = isAM ? 0 : 1;
681
+ return React__default.createElement(Select, {
682
+ prefixCls: prefixCls,
683
+ options: AMPMOptions,
684
+ selectedIndex: selected,
685
+ type: "ampm",
686
+ onSelect: this.onItemChange,
687
+ onMouseEnter: function onMouseEnter() {
688
+ return _this5.onEnterSelectPanel('ampm');
689
+ },
690
+ onEsc: onEsc
691
+ });
692
+ }
693
+ }, {
694
+ key: "render",
695
+ value: function render() {
696
+ var _this$props6 = this.props,
697
+ prefixCls = _this$props6.prefixCls,
698
+ defaultOpenValue = _this$props6.defaultOpenValue,
699
+ propValue = _this$props6.value;
700
+ var value = propValue || defaultOpenValue;
701
+ return React__default.createElement("div", {
702
+ className: "".concat(prefixCls, "-combobox")
703
+ }, this.getHourSelect(value.hour()), this.getMinuteSelect(value.minute()), this.getSecondSelect(value.second()), this.getAMPMSelect(value.hour()));
704
+ }
705
+ }]);
706
+
707
+ return Combobox;
708
+ }(Component);
709
+
710
+ _defineProperty$3(Combobox, "propTypes", {
711
+ format: PropTypes.string,
712
+ defaultOpenValue: PropTypes.object,
713
+ prefixCls: PropTypes.string,
714
+ value: PropTypes.object,
715
+ onChange: PropTypes.func,
716
+ onAmPmChange: PropTypes.func,
717
+ showHour: PropTypes.bool,
718
+ showMinute: PropTypes.bool,
719
+ showSecond: PropTypes.bool,
720
+ hourOptions: PropTypes.array,
721
+ minuteOptions: PropTypes.array,
722
+ secondOptions: PropTypes.array,
723
+ disabledHours: PropTypes.func,
724
+ disabledMinutes: PropTypes.func,
725
+ disabledSeconds: PropTypes.func,
726
+ onCurrentSelectPanelChange: PropTypes.func,
727
+ use12Hours: PropTypes.bool,
728
+ onEsc: PropTypes.func,
729
+ isAM: PropTypes.bool
730
+ });
731
+
732
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
733
+
734
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
735
+
736
+ function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
737
+
738
+ 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); } }
739
+
740
+ function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
741
+
742
+ function _possibleConstructorReturn$2(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
743
+
744
+ function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
745
+
746
+ function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
747
+
748
+ 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); }
749
+
750
+ function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
751
+
752
+ 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; }
753
+
754
+ function noop$1() {}
755
+
756
+ function generateOptions(length, disabledOptions, hideDisabledOptions) {
757
+ var step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
758
+ var arr = [];
759
+
760
+ for (var value = 0; value < length; value += step) {
761
+ if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) {
762
+ arr.push(value);
763
+ }
764
+ }
765
+
766
+ return arr;
767
+ }
768
+
769
+ function toNearestValidTime(time, hourOptions, minuteOptions, secondOptions) {
770
+ var hour = hourOptions.slice().sort(function (a, b) {
771
+ return Math.abs(time.hour() - a) - Math.abs(time.hour() - b);
772
+ })[0];
773
+ var minute = minuteOptions.slice().sort(function (a, b) {
774
+ return Math.abs(time.minute() - a) - Math.abs(time.minute() - b);
775
+ })[0];
776
+ var second = secondOptions.slice().sort(function (a, b) {
777
+ return Math.abs(time.second() - a) - Math.abs(time.second() - b);
778
+ })[0];
779
+ return moment("".concat(hour, ":").concat(minute, ":").concat(second), 'HH:mm:ss');
780
+ }
781
+
782
+ var Panel =
783
+ /*#__PURE__*/
784
+ function (_Component) {
785
+ _inherits$2(Panel, _Component);
786
+
787
+ function Panel() {
788
+ var _getPrototypeOf2;
789
+
790
+ var _this;
791
+
792
+ _classCallCheck$2(this, Panel);
793
+
794
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
795
+ args[_key] = arguments[_key];
796
+ }
797
+
798
+ _this = _possibleConstructorReturn$2(this, (_getPrototypeOf2 = _getPrototypeOf$2(Panel)).call.apply(_getPrototypeOf2, [this].concat(args)));
799
+
800
+ _defineProperty$2(_assertThisInitialized$2(_this), "state", {});
801
+
802
+ _defineProperty$2(_assertThisInitialized$2(_this), "onChange", function (newValue) {
803
+ var onChange = _this.props.onChange;
804
+
805
+ _this.setState({
806
+ value: newValue
807
+ });
808
+
809
+ onChange(newValue);
810
+ });
811
+
812
+ _defineProperty$2(_assertThisInitialized$2(_this), "onAmPmChange", function (ampm) {
813
+ var onAmPmChange = _this.props.onAmPmChange;
814
+ onAmPmChange(ampm);
815
+ });
816
+
817
+ _defineProperty$2(_assertThisInitialized$2(_this), "onCurrentSelectPanelChange", function (currentSelectPanel) {
818
+ _this.setState({
819
+ currentSelectPanel: currentSelectPanel
820
+ });
821
+ });
822
+
823
+ _defineProperty$2(_assertThisInitialized$2(_this), "disabledHours", function () {
824
+ var _this$props = _this.props,
825
+ use12Hours = _this$props.use12Hours,
826
+ disabledHours = _this$props.disabledHours;
827
+ var disabledOptions = disabledHours();
828
+
829
+ if (use12Hours && Array.isArray(disabledOptions)) {
830
+ if (_this.isAM()) {
831
+ disabledOptions = disabledOptions.filter(function (h) {
832
+ return h < 12;
833
+ }).map(function (h) {
834
+ return h === 0 ? 12 : h;
835
+ });
836
+ } else {
837
+ disabledOptions = disabledOptions.map(function (h) {
838
+ return h === 12 ? 12 : h - 12;
839
+ });
840
+ }
841
+ }
842
+
843
+ return disabledOptions;
844
+ });
845
+
846
+ return _this;
847
+ }
848
+
849
+ _createClass$2(Panel, [{
850
+ key: "close",
851
+ // https://github.com/ant-design/ant-design/issues/5829
852
+ value: function close() {
853
+ var onEsc = this.props.onEsc;
854
+ onEsc();
855
+ }
856
+ }, {
857
+ key: "isAM",
858
+ value: function isAM() {
859
+ var defaultOpenValue = this.props.defaultOpenValue;
860
+ var value = this.state.value;
861
+ var realValue = value || defaultOpenValue;
862
+ return realValue.hour() >= 0 && realValue.hour() < 12;
863
+ }
864
+ }, {
865
+ key: "render",
866
+ value: function render() {
867
+ var _this$props2 = this.props,
868
+ prefixCls = _this$props2.prefixCls,
869
+ className = _this$props2.className,
870
+ placeholder = _this$props2.placeholder,
871
+ disabledMinutes = _this$props2.disabledMinutes,
872
+ disabledSeconds = _this$props2.disabledSeconds,
873
+ hideDisabledOptions = _this$props2.hideDisabledOptions,
874
+ showHour = _this$props2.showHour,
875
+ showMinute = _this$props2.showMinute,
876
+ showSecond = _this$props2.showSecond,
877
+ format = _this$props2.format,
878
+ defaultOpenValue = _this$props2.defaultOpenValue,
879
+ clearText = _this$props2.clearText,
880
+ onEsc = _this$props2.onEsc,
881
+ addon = _this$props2.addon,
882
+ use12Hours = _this$props2.use12Hours,
883
+ focusOnOpen = _this$props2.focusOnOpen,
884
+ onKeyDown = _this$props2.onKeyDown,
885
+ hourStep = _this$props2.hourStep,
886
+ minuteStep = _this$props2.minuteStep,
887
+ secondStep = _this$props2.secondStep,
888
+ inputReadOnly = _this$props2.inputReadOnly,
889
+ clearIcon = _this$props2.clearIcon;
890
+ var _this$state = this.state,
891
+ value = _this$state.value,
892
+ currentSelectPanel = _this$state.currentSelectPanel;
893
+ var disabledHourOptions = this.disabledHours();
894
+ var disabledMinuteOptions = disabledMinutes(value ? value.hour() : null);
895
+ var disabledSecondOptions = disabledSeconds(value ? value.hour() : null, value ? value.minute() : null);
896
+ var hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions, hourStep);
897
+ var minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions, minuteStep);
898
+ var secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions, secondStep);
899
+ var validDefaultOpenValue = toNearestValidTime(defaultOpenValue, hourOptions, minuteOptions, secondOptions);
900
+ return React__default.createElement("div", {
901
+ className: classNames(className, "".concat(prefixCls, "-inner"))
902
+ }, React__default.createElement(Header, {
903
+ clearText: clearText,
904
+ prefixCls: prefixCls,
905
+ defaultOpenValue: validDefaultOpenValue,
906
+ value: value,
907
+ currentSelectPanel: currentSelectPanel,
908
+ onEsc: onEsc,
909
+ format: format,
910
+ placeholder: placeholder,
911
+ hourOptions: hourOptions,
912
+ minuteOptions: minuteOptions,
913
+ secondOptions: secondOptions,
914
+ disabledHours: this.disabledHours,
915
+ disabledMinutes: disabledMinutes,
916
+ disabledSeconds: disabledSeconds,
917
+ onChange: this.onChange,
918
+ focusOnOpen: focusOnOpen,
919
+ onKeyDown: onKeyDown,
920
+ inputReadOnly: inputReadOnly,
921
+ clearIcon: clearIcon
922
+ }), React__default.createElement(Combobox, {
923
+ prefixCls: prefixCls,
924
+ value: value,
925
+ defaultOpenValue: validDefaultOpenValue,
926
+ format: format,
927
+ onChange: this.onChange,
928
+ onAmPmChange: this.onAmPmChange,
929
+ showHour: showHour,
930
+ showMinute: showMinute,
931
+ showSecond: showSecond,
932
+ hourOptions: hourOptions,
933
+ minuteOptions: minuteOptions,
934
+ secondOptions: secondOptions,
935
+ disabledHours: this.disabledHours,
936
+ disabledMinutes: disabledMinutes,
937
+ disabledSeconds: disabledSeconds,
938
+ onCurrentSelectPanelChange: this.onCurrentSelectPanelChange,
939
+ use12Hours: use12Hours,
940
+ onEsc: onEsc,
941
+ isAM: this.isAM()
942
+ }), addon(this));
943
+ }
944
+ }], [{
945
+ key: "getDerivedStateFromProps",
946
+ value: function getDerivedStateFromProps(props, state) {
947
+ if ('value' in props) {
948
+ return _objectSpread$1({}, state, {
949
+ value: props.value
950
+ });
951
+ }
952
+
953
+ return null;
954
+ }
955
+ }]);
956
+
957
+ return Panel;
958
+ }(Component);
959
+
960
+ _defineProperty$2(Panel, "propTypes", {
961
+ clearText: PropTypes.string,
962
+ prefixCls: PropTypes.string,
963
+ className: PropTypes.string,
964
+ defaultOpenValue: PropTypes.object,
965
+ value: PropTypes.object,
966
+ placeholder: PropTypes.string,
967
+ format: PropTypes.string,
968
+ inputReadOnly: PropTypes.bool,
969
+ disabledHours: PropTypes.func,
970
+ disabledMinutes: PropTypes.func,
971
+ disabledSeconds: PropTypes.func,
972
+ hideDisabledOptions: PropTypes.bool,
973
+ onChange: PropTypes.func,
974
+ onAmPmChange: PropTypes.func,
975
+ onEsc: PropTypes.func,
976
+ showHour: PropTypes.bool,
977
+ showMinute: PropTypes.bool,
978
+ showSecond: PropTypes.bool,
979
+ use12Hours: PropTypes.bool,
980
+ hourStep: PropTypes.number,
981
+ minuteStep: PropTypes.number,
982
+ secondStep: PropTypes.number,
983
+ addon: PropTypes.func,
984
+ focusOnOpen: PropTypes.bool,
985
+ onKeyDown: PropTypes.func,
986
+ clearIcon: PropTypes.node
987
+ });
988
+
989
+ _defineProperty$2(Panel, "defaultProps", {
990
+ prefixCls: 'rc-time-picker-panel',
991
+ onChange: noop$1,
992
+ disabledHours: noop$1,
993
+ disabledMinutes: noop$1,
994
+ disabledSeconds: noop$1,
995
+ defaultOpenValue: moment(),
996
+ use12Hours: false,
997
+ addon: noop$1,
998
+ onKeyDown: noop$1,
999
+ onAmPmChange: noop$1,
1000
+ inputReadOnly: false
1001
+ });
1002
+
1003
+ polyfill(Panel);
1004
+
1005
+ var autoAdjustOverflow = {
1006
+ adjustX: 1,
1007
+ adjustY: 1
1008
+ };
1009
+ var targetOffset = [0, 0];
1010
+ var placements = {
1011
+ bottomLeft: {
1012
+ points: ['tl', 'tl'],
1013
+ overflow: autoAdjustOverflow,
1014
+ offset: [0, -3],
1015
+ targetOffset: targetOffset
1016
+ },
1017
+ bottomRight: {
1018
+ points: ['tr', 'tr'],
1019
+ overflow: autoAdjustOverflow,
1020
+ offset: [0, -3],
1021
+ targetOffset: targetOffset
1022
+ },
1023
+ topRight: {
1024
+ points: ['br', 'br'],
1025
+ overflow: autoAdjustOverflow,
1026
+ offset: [0, 3],
1027
+ targetOffset: targetOffset
1028
+ },
1029
+ topLeft: {
1030
+ points: ['bl', 'bl'],
1031
+ overflow: autoAdjustOverflow,
1032
+ offset: [0, 3],
1033
+ targetOffset: targetOffset
1034
+ }
1035
+ };
1036
+
1037
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1038
+
1039
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1040
+
1041
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1042
+
1043
+ 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); } }
1044
+
1045
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
1046
+
1047
+ function _possibleConstructorReturn$1(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
1048
+
1049
+ function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
1050
+
1051
+ function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1052
+
1053
+ 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); }
1054
+
1055
+ function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
1056
+
1057
+ 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; }
1058
+
1059
+ function noop() {}
1060
+
1061
+ function refFn(field, component) {
1062
+ this[field] = component;
1063
+ }
1064
+
1065
+ var Picker =
1066
+ /*#__PURE__*/
1067
+ function (_Component) {
1068
+ _inherits$1(Picker, _Component);
1069
+
1070
+ function Picker(props) {
1071
+ var _this;
1072
+
1073
+ _classCallCheck$1(this, Picker);
1074
+
1075
+ _this = _possibleConstructorReturn$1(this, _getPrototypeOf$1(Picker).call(this, props));
1076
+
1077
+ _defineProperty$1(_assertThisInitialized$1(_this), "onPanelChange", function (value) {
1078
+ _this.setValue(value);
1079
+ });
1080
+
1081
+ _defineProperty$1(_assertThisInitialized$1(_this), "onAmPmChange", function (ampm) {
1082
+ var onAmPmChange = _this.props.onAmPmChange;
1083
+ onAmPmChange(ampm);
1084
+ });
1085
+
1086
+ _defineProperty$1(_assertThisInitialized$1(_this), "onClear", function (event) {
1087
+ event.stopPropagation();
1088
+
1089
+ _this.setValue(null);
1090
+
1091
+ _this.setOpen(false);
1092
+ });
1093
+
1094
+ _defineProperty$1(_assertThisInitialized$1(_this), "onVisibleChange", function (open) {
1095
+ _this.setOpen(open);
1096
+ });
1097
+
1098
+ _defineProperty$1(_assertThisInitialized$1(_this), "onEsc", function () {
1099
+ _this.setOpen(false);
1100
+
1101
+ _this.focus();
1102
+ });
1103
+
1104
+ _defineProperty$1(_assertThisInitialized$1(_this), "onKeyDown", function (e) {
1105
+ if (e.keyCode === 40) {
1106
+ _this.setOpen(true);
1107
+ }
1108
+ });
1109
+
1110
+ _this.saveInputRef = refFn.bind(_assertThisInitialized$1(_this), 'picker');
1111
+ _this.savePanelRef = refFn.bind(_assertThisInitialized$1(_this), 'panelInstance');
1112
+
1113
+ var defaultOpen = props.defaultOpen,
1114
+ defaultValue = props.defaultValue,
1115
+ _props$open = props.open,
1116
+ _open = _props$open === void 0 ? defaultOpen : _props$open,
1117
+ _props$value = props.value,
1118
+ _value = _props$value === void 0 ? defaultValue : _props$value;
1119
+
1120
+ _this.state = {
1121
+ open: _open,
1122
+ value: _value
1123
+ };
1124
+ return _this;
1125
+ }
1126
+
1127
+ _createClass$1(Picker, [{
1128
+ key: "setValue",
1129
+ value: function setValue(value) {
1130
+ var onChange = this.props.onChange;
1131
+
1132
+ if (!('value' in this.props)) {
1133
+ this.setState({
1134
+ value: value
1135
+ });
1136
+ }
1137
+
1138
+ onChange(value);
1139
+ }
1140
+ }, {
1141
+ key: "getFormat",
1142
+ value: function getFormat() {
1143
+ var _this$props = this.props,
1144
+ format = _this$props.format,
1145
+ showHour = _this$props.showHour,
1146
+ showMinute = _this$props.showMinute,
1147
+ showSecond = _this$props.showSecond,
1148
+ use12Hours = _this$props.use12Hours;
1149
+
1150
+ if (format) {
1151
+ return format;
1152
+ }
1153
+
1154
+ if (use12Hours) {
1155
+ var fmtString = [showHour ? 'h' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) {
1156
+ return !!item;
1157
+ }).join(':');
1158
+ return fmtString.concat(' a');
1159
+ }
1160
+
1161
+ return [showHour ? 'HH' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) {
1162
+ return !!item;
1163
+ }).join(':');
1164
+ }
1165
+ }, {
1166
+ key: "getPanelElement",
1167
+ value: function getPanelElement() {
1168
+ var _this$props2 = this.props,
1169
+ prefixCls = _this$props2.prefixCls,
1170
+ placeholder = _this$props2.placeholder,
1171
+ disabledHours = _this$props2.disabledHours,
1172
+ disabledMinutes = _this$props2.disabledMinutes,
1173
+ disabledSeconds = _this$props2.disabledSeconds,
1174
+ hideDisabledOptions = _this$props2.hideDisabledOptions,
1175
+ inputReadOnly = _this$props2.inputReadOnly,
1176
+ showHour = _this$props2.showHour,
1177
+ showMinute = _this$props2.showMinute,
1178
+ showSecond = _this$props2.showSecond,
1179
+ defaultOpenValue = _this$props2.defaultOpenValue,
1180
+ clearText = _this$props2.clearText,
1181
+ addon = _this$props2.addon,
1182
+ use12Hours = _this$props2.use12Hours,
1183
+ focusOnOpen = _this$props2.focusOnOpen,
1184
+ onKeyDown = _this$props2.onKeyDown,
1185
+ hourStep = _this$props2.hourStep,
1186
+ minuteStep = _this$props2.minuteStep,
1187
+ secondStep = _this$props2.secondStep,
1188
+ clearIcon = _this$props2.clearIcon;
1189
+ var value = this.state.value;
1190
+ return React__default.createElement(Panel, {
1191
+ clearText: clearText,
1192
+ prefixCls: "".concat(prefixCls, "-panel"),
1193
+ ref: this.savePanelRef,
1194
+ value: value,
1195
+ inputReadOnly: inputReadOnly,
1196
+ onChange: this.onPanelChange,
1197
+ onAmPmChange: this.onAmPmChange,
1198
+ defaultOpenValue: defaultOpenValue,
1199
+ showHour: showHour,
1200
+ showMinute: showMinute,
1201
+ showSecond: showSecond,
1202
+ onEsc: this.onEsc,
1203
+ format: this.getFormat(),
1204
+ placeholder: placeholder,
1205
+ disabledHours: disabledHours,
1206
+ disabledMinutes: disabledMinutes,
1207
+ disabledSeconds: disabledSeconds,
1208
+ hideDisabledOptions: hideDisabledOptions,
1209
+ use12Hours: use12Hours,
1210
+ hourStep: hourStep,
1211
+ minuteStep: minuteStep,
1212
+ secondStep: secondStep,
1213
+ addon: addon,
1214
+ focusOnOpen: focusOnOpen,
1215
+ onKeyDown: onKeyDown,
1216
+ clearIcon: clearIcon
1217
+ });
1218
+ }
1219
+ }, {
1220
+ key: "getPopupClassName",
1221
+ value: function getPopupClassName() {
1222
+ var _this$props3 = this.props,
1223
+ showHour = _this$props3.showHour,
1224
+ showMinute = _this$props3.showMinute,
1225
+ showSecond = _this$props3.showSecond,
1226
+ use12Hours = _this$props3.use12Hours,
1227
+ prefixCls = _this$props3.prefixCls,
1228
+ popupClassName = _this$props3.popupClassName;
1229
+ var selectColumnCount = 0;
1230
+
1231
+ if (showHour) {
1232
+ selectColumnCount += 1;
1233
+ }
1234
+
1235
+ if (showMinute) {
1236
+ selectColumnCount += 1;
1237
+ }
1238
+
1239
+ if (showSecond) {
1240
+ selectColumnCount += 1;
1241
+ }
1242
+
1243
+ if (use12Hours) {
1244
+ selectColumnCount += 1;
1245
+ } // Keep it for old compatibility
1246
+
1247
+
1248
+ return classNames(popupClassName, _defineProperty$1({}, "".concat(prefixCls, "-panel-narrow"), (!showHour || !showMinute || !showSecond) && !use12Hours), "".concat(prefixCls, "-panel-column-").concat(selectColumnCount));
1249
+ }
1250
+ }, {
1251
+ key: "setOpen",
1252
+ value: function setOpen(open) {
1253
+ var _this$props4 = this.props,
1254
+ onOpen = _this$props4.onOpen,
1255
+ onClose = _this$props4.onClose;
1256
+ var currentOpen = this.state.open;
1257
+
1258
+ if (currentOpen !== open) {
1259
+ if (!('open' in this.props)) {
1260
+ this.setState({
1261
+ open: open
1262
+ });
1263
+ }
1264
+
1265
+ if (open) {
1266
+ onOpen({
1267
+ open: open
1268
+ });
1269
+ } else {
1270
+ onClose({
1271
+ open: open
1272
+ });
1273
+ }
1274
+ }
1275
+ }
1276
+ }, {
1277
+ key: "focus",
1278
+ value: function focus() {
1279
+ this.picker.focus();
1280
+ }
1281
+ }, {
1282
+ key: "blur",
1283
+ value: function blur() {
1284
+ this.picker.blur();
1285
+ }
1286
+ }, {
1287
+ key: "renderClearButton",
1288
+ value: function renderClearButton() {
1289
+ var _this2 = this;
1290
+
1291
+ var value = this.state.value;
1292
+ var _this$props5 = this.props,
1293
+ prefixCls = _this$props5.prefixCls,
1294
+ allowEmpty = _this$props5.allowEmpty,
1295
+ clearIcon = _this$props5.clearIcon,
1296
+ clearText = _this$props5.clearText,
1297
+ disabled = _this$props5.disabled;
1298
+
1299
+ if (!allowEmpty || !value || disabled) {
1300
+ return null;
1301
+ }
1302
+
1303
+ if (React__default.isValidElement(clearIcon)) {
1304
+ var _ref = clearIcon.props || {},
1305
+ _onClick = _ref.onClick;
1306
+
1307
+ return React__default.cloneElement(clearIcon, {
1308
+ onClick: function onClick() {
1309
+ if (_onClick) _onClick.apply(void 0, arguments);
1310
+
1311
+ _this2.onClear.apply(_this2, arguments);
1312
+ }
1313
+ });
1314
+ }
1315
+
1316
+ return React__default.createElement("a", {
1317
+ role: "button",
1318
+ className: "".concat(prefixCls, "-clear"),
1319
+ title: clearText,
1320
+ onClick: this.onClear,
1321
+ tabIndex: 0
1322
+ }, clearIcon || React__default.createElement("i", {
1323
+ className: "".concat(prefixCls, "-clear-icon")
1324
+ }));
1325
+ }
1326
+ }, {
1327
+ key: "render",
1328
+ value: function render() {
1329
+ var _this$props6 = this.props,
1330
+ prefixCls = _this$props6.prefixCls,
1331
+ placeholder = _this$props6.placeholder,
1332
+ placement = _this$props6.placement,
1333
+ align = _this$props6.align,
1334
+ id = _this$props6.id,
1335
+ disabled = _this$props6.disabled,
1336
+ transitionName = _this$props6.transitionName,
1337
+ style = _this$props6.style,
1338
+ className = _this$props6.className,
1339
+ getPopupContainer = _this$props6.getPopupContainer,
1340
+ name = _this$props6.name,
1341
+ autoComplete = _this$props6.autoComplete,
1342
+ onFocus = _this$props6.onFocus,
1343
+ onBlur = _this$props6.onBlur,
1344
+ autoFocus = _this$props6.autoFocus,
1345
+ inputReadOnly = _this$props6.inputReadOnly,
1346
+ inputIcon = _this$props6.inputIcon,
1347
+ popupStyle = _this$props6.popupStyle;
1348
+ var _this$state = this.state,
1349
+ open = _this$state.open,
1350
+ value = _this$state.value;
1351
+ var popupClassName = this.getPopupClassName();
1352
+ return React__default.createElement(Trigger, {
1353
+ prefixCls: "".concat(prefixCls, "-panel"),
1354
+ popupClassName: popupClassName,
1355
+ popupStyle: popupStyle,
1356
+ popup: this.getPanelElement(),
1357
+ popupAlign: align,
1358
+ builtinPlacements: placements,
1359
+ popupPlacement: placement,
1360
+ action: disabled ? [] : ['click'],
1361
+ destroyPopupOnHide: true,
1362
+ getPopupContainer: getPopupContainer,
1363
+ popupTransitionName: transitionName,
1364
+ popupVisible: open,
1365
+ onPopupVisibleChange: this.onVisibleChange
1366
+ }, React__default.createElement("span", {
1367
+ className: classNames(prefixCls, className),
1368
+ style: style
1369
+ }, React__default.createElement("input", {
1370
+ className: "".concat(prefixCls, "-input"),
1371
+ ref: this.saveInputRef,
1372
+ type: "text",
1373
+ placeholder: placeholder,
1374
+ name: name,
1375
+ onKeyDown: this.onKeyDown,
1376
+ disabled: disabled,
1377
+ value: value && value.format(this.getFormat()) || '',
1378
+ autoComplete: autoComplete,
1379
+ onFocus: onFocus,
1380
+ onBlur: onBlur,
1381
+ autoFocus: autoFocus,
1382
+ onChange: noop,
1383
+ readOnly: !!inputReadOnly,
1384
+ id: id
1385
+ }), inputIcon || React__default.createElement("span", {
1386
+ className: "".concat(prefixCls, "-icon")
1387
+ }), this.renderClearButton()));
1388
+ }
1389
+ }], [{
1390
+ key: "getDerivedStateFromProps",
1391
+ value: function getDerivedStateFromProps(props, state) {
1392
+ var newState = {};
1393
+
1394
+ if ('value' in props) {
1395
+ newState.value = props.value;
1396
+ }
1397
+
1398
+ if (props.open !== undefined) {
1399
+ newState.open = props.open;
1400
+ }
1401
+
1402
+ return Object.keys(newState).length > 0 ? _objectSpread({}, state, {}, newState) : null;
1403
+ }
1404
+ }]);
1405
+
1406
+ return Picker;
1407
+ }(Component);
1408
+
1409
+ _defineProperty$1(Picker, "propTypes", {
1410
+ prefixCls: PropTypes.string,
1411
+ clearText: PropTypes.string,
1412
+ value: PropTypes.object,
1413
+ defaultOpenValue: PropTypes.object,
1414
+ inputReadOnly: PropTypes.bool,
1415
+ disabled: PropTypes.bool,
1416
+ allowEmpty: PropTypes.bool,
1417
+ defaultValue: PropTypes.object,
1418
+ open: PropTypes.bool,
1419
+ defaultOpen: PropTypes.bool,
1420
+ align: PropTypes.object,
1421
+ placement: PropTypes.any,
1422
+ transitionName: PropTypes.string,
1423
+ getPopupContainer: PropTypes.func,
1424
+ placeholder: PropTypes.string,
1425
+ format: PropTypes.string,
1426
+ showHour: PropTypes.bool,
1427
+ showMinute: PropTypes.bool,
1428
+ showSecond: PropTypes.bool,
1429
+ style: PropTypes.object,
1430
+ className: PropTypes.string,
1431
+ popupClassName: PropTypes.string,
1432
+ popupStyle: PropTypes.object,
1433
+ disabledHours: PropTypes.func,
1434
+ disabledMinutes: PropTypes.func,
1435
+ disabledSeconds: PropTypes.func,
1436
+ hideDisabledOptions: PropTypes.bool,
1437
+ onChange: PropTypes.func,
1438
+ onAmPmChange: PropTypes.func,
1439
+ onOpen: PropTypes.func,
1440
+ onClose: PropTypes.func,
1441
+ onFocus: PropTypes.func,
1442
+ onBlur: PropTypes.func,
1443
+ addon: PropTypes.func,
1444
+ name: PropTypes.string,
1445
+ autoComplete: PropTypes.string,
1446
+ use12Hours: PropTypes.bool,
1447
+ hourStep: PropTypes.number,
1448
+ minuteStep: PropTypes.number,
1449
+ secondStep: PropTypes.number,
1450
+ focusOnOpen: PropTypes.bool,
1451
+ onKeyDown: PropTypes.func,
1452
+ autoFocus: PropTypes.bool,
1453
+ id: PropTypes.string,
1454
+ inputIcon: PropTypes.node,
1455
+ clearIcon: PropTypes.node
1456
+ });
1457
+
1458
+ _defineProperty$1(Picker, "defaultProps", {
1459
+ clearText: 'clear',
1460
+ prefixCls: 'rc-time-picker',
1461
+ defaultOpen: false,
1462
+ inputReadOnly: false,
1463
+ style: {},
1464
+ className: '',
1465
+ popupClassName: '',
1466
+ popupStyle: {},
1467
+ align: {},
1468
+ defaultOpenValue: moment(),
1469
+ allowEmpty: true,
1470
+ showHour: true,
1471
+ showMinute: true,
1472
+ showSecond: true,
1473
+ disabledHours: noop,
1474
+ disabledMinutes: noop,
1475
+ disabledSeconds: noop,
1476
+ hideDisabledOptions: false,
1477
+ placement: 'bottomLeft',
1478
+ onChange: noop,
1479
+ onAmPmChange: noop,
1480
+ onOpen: noop,
1481
+ onClose: noop,
1482
+ onFocus: noop,
1483
+ onBlur: noop,
1484
+ addon: noop,
1485
+ use12Hours: false,
1486
+ focusOnOpen: false,
1487
+ onKeyDown: noop
1488
+ });
1489
+
1490
+ polyfill(Picker);
1491
+
1492
+ 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); }
1493
+
1494
+ 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; }
1495
+
1496
+ 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); }
1497
+
1498
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1499
+
1500
+ 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); } }
1501
+
1502
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1503
+
1504
+ 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); }
1505
+
1506
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1507
+
1508
+ 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); }; }
1509
+
1510
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1511
+
1512
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1513
+
1514
+ 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; } }
1515
+
1516
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1517
+
1518
+ var __rest = undefined && undefined.__rest || function (s, e) {
1519
+ var t = {};
1520
+
1521
+ for (var p in s) {
1522
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1523
+ }
1524
+
1525
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1526
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1527
+ }
1528
+ return t;
1529
+ };
1530
+ function generateShowHourMinuteSecond(format) {
1531
+ // Ref: http://momentjs.com/docs/#/parsing/string-format/
1532
+ return {
1533
+ showHour: format.indexOf('H') > -1 || format.indexOf('h') > -1 || format.indexOf('k') > -1,
1534
+ showMinute: format.indexOf('m') > -1,
1535
+ showSecond: format.indexOf('s') > -1
1536
+ };
1537
+ }
1538
+
1539
+ var TimePicker = /*#__PURE__*/function (_React$Component) {
1540
+ _inherits(TimePicker, _React$Component);
1541
+
1542
+ var _super = _createSuper(TimePicker);
1543
+
1544
+ function TimePicker(props) {
1545
+ var _this;
1546
+
1547
+ _classCallCheck(this, TimePicker);
1548
+
1549
+ _this = _super.call(this, props);
1550
+
1551
+ _this.getDefaultLocale = function () {
1552
+ var defaultLocale = _extends(_extends({}, locale), _this.props.locale);
1553
+
1554
+ return defaultLocale;
1555
+ };
1556
+
1557
+ _this.handleOpenClose = function (_ref) {
1558
+ var open = _ref.open;
1559
+ var onOpenChange = _this.props.onOpenChange;
1560
+
1561
+ if (onOpenChange) {
1562
+ onOpenChange(open);
1563
+ }
1564
+ };
1565
+
1566
+ _this.saveTimePicker = function (timePickerRef) {
1567
+ _this.timePickerRef = timePickerRef;
1568
+ };
1569
+
1570
+ _this.handleChange = function (value) {
1571
+ if (!('value' in _this.props)) {
1572
+ _this.setState({
1573
+ value: value
1574
+ });
1575
+ }
1576
+
1577
+ var _this$props = _this.props,
1578
+ onChange = _this$props.onChange,
1579
+ _this$props$format = _this$props.format,
1580
+ format = _this$props$format === void 0 ? 'HH:mm:ss' : _this$props$format;
1581
+
1582
+ if (onChange) {
1583
+ onChange(value, value && value.format(format) || '');
1584
+ }
1585
+ };
1586
+
1587
+ _this.renderTimePicker = function (locale) {
1588
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref2) {
1589
+ var getContextPopupContainer = _ref2.getPopupContainer,
1590
+ getPrefixCls = _ref2.getPrefixCls;
1591
+
1592
+ var _a = _this.props,
1593
+ getPopupContainer = _a.getPopupContainer,
1594
+ customizePrefixCls = _a.prefixCls,
1595
+ className = _a.className,
1596
+ addon = _a.addon,
1597
+ placeholder = _a.placeholder,
1598
+ props = __rest(_a, ["getPopupContainer", "prefixCls", "className", "addon", "placeholder"]);
1599
+
1600
+ var size = props.size;
1601
+ var pickerProps = omit(props, ['defaultValue', 'suffixIcon', 'allowEmpty', 'allowClear']);
1602
+
1603
+ var format = _this.getDefaultFormat();
1604
+
1605
+ var prefixCls = getPrefixCls('time-picker', customizePrefixCls);
1606
+ var pickerClassName = classNames(className, _defineProperty({}, "".concat(prefixCls, "-").concat(size), !!size));
1607
+
1608
+ var pickerAddon = function pickerAddon(panel) {
1609
+ return addon ? /*#__PURE__*/React.createElement("div", {
1610
+ className: "".concat(prefixCls, "-panel-addon")
1611
+ }, addon(panel)) : null;
1612
+ };
1613
+
1614
+ return /*#__PURE__*/React.createElement(Picker, _extends({}, generateShowHourMinuteSecond(format), pickerProps, {
1615
+ allowEmpty: _this.getAllowClear(),
1616
+ prefixCls: prefixCls,
1617
+ getPopupContainer: getPopupContainer || getContextPopupContainer,
1618
+ ref: _this.saveTimePicker,
1619
+ format: format,
1620
+ className: pickerClassName,
1621
+ value: _this.state.value,
1622
+ placeholder: placeholder === undefined ? locale.placeholder : placeholder,
1623
+ onChange: _this.handleChange,
1624
+ onOpen: _this.handleOpenClose,
1625
+ onClose: _this.handleOpenClose,
1626
+ addon: pickerAddon,
1627
+ inputIcon: _this.renderInputIcon(prefixCls),
1628
+ clearIcon: _this.renderClearIcon(prefixCls)
1629
+ }));
1630
+ });
1631
+ };
1632
+
1633
+ var value = props.value || props.defaultValue;
1634
+
1635
+ if (value && !interopDefault(moment$1).isMoment(value)) {
1636
+ throw new Error('The value/defaultValue of TimePicker must be a moment object after `antd@2.0`, ' + 'see: https://u.ant.design/time-picker-value');
1637
+ }
1638
+
1639
+ _this.state = {
1640
+ value: value
1641
+ };
1642
+ return _this;
1643
+ }
1644
+
1645
+ _createClass(TimePicker, [{
1646
+ key: "getDefaultFormat",
1647
+ value: function getDefaultFormat() {
1648
+ var _this$props2 = this.props,
1649
+ format = _this$props2.format,
1650
+ use12Hours = _this$props2.use12Hours;
1651
+
1652
+ if (format) {
1653
+ return format;
1654
+ }
1655
+
1656
+ if (use12Hours) {
1657
+ return 'h:mm:ss a';
1658
+ }
1659
+
1660
+ return 'HH:mm:ss';
1661
+ }
1662
+ }, {
1663
+ key: "getAllowClear",
1664
+ value: function getAllowClear() {
1665
+ var _this$props3 = this.props,
1666
+ allowClear = _this$props3.allowClear,
1667
+ allowEmpty = _this$props3.allowEmpty;
1668
+
1669
+ if ('allowClear' in this.props) {
1670
+ return allowClear;
1671
+ }
1672
+
1673
+ return allowEmpty;
1674
+ }
1675
+ }, {
1676
+ key: "focus",
1677
+ value: function focus() {
1678
+ this.timePickerRef.focus();
1679
+ }
1680
+ }, {
1681
+ key: "blur",
1682
+ value: function blur() {
1683
+ this.timePickerRef.blur();
1684
+ }
1685
+ }, {
1686
+ key: "renderInputIcon",
1687
+ value: function renderInputIcon(prefixCls) {
1688
+ var suffixIcon = this.props.suffixIcon;
1689
+ var clockIcon = suffixIcon && /*#__PURE__*/React.isValidElement(suffixIcon) && /*#__PURE__*/React.cloneElement(suffixIcon, {
1690
+ className: classNames(suffixIcon.props.className, "".concat(prefixCls, "-clock-icon"))
1691
+ }) || /*#__PURE__*/React.createElement(Icon, {
1692
+ type: "clock-circle",
1693
+ className: "".concat(prefixCls, "-clock-icon")
1694
+ });
1695
+ return /*#__PURE__*/React.createElement("span", {
1696
+ className: "".concat(prefixCls, "-icon")
1697
+ }, clockIcon);
1698
+ }
1699
+ }, {
1700
+ key: "renderClearIcon",
1701
+ value: function renderClearIcon(prefixCls) {
1702
+ var clearIcon = this.props.clearIcon;
1703
+ var clearIconPrefixCls = "".concat(prefixCls, "-clear");
1704
+
1705
+ if (clearIcon && /*#__PURE__*/React.isValidElement(clearIcon)) {
1706
+ return /*#__PURE__*/React.cloneElement(clearIcon, {
1707
+ className: classNames(clearIcon.props.className, clearIconPrefixCls)
1708
+ });
1709
+ }
1710
+
1711
+ return /*#__PURE__*/React.createElement(Icon, {
1712
+ type: "close-circle",
1713
+ className: clearIconPrefixCls,
1714
+ theme: "filled"
1715
+ });
1716
+ }
1717
+ }, {
1718
+ key: "render",
1719
+ value: function render() {
1720
+ return /*#__PURE__*/React.createElement(LocaleReceiver, {
1721
+ componentName: "TimePicker",
1722
+ defaultLocale: this.getDefaultLocale()
1723
+ }, this.renderTimePicker);
1724
+ }
1725
+ }], [{
1726
+ key: "getDerivedStateFromProps",
1727
+ value: function getDerivedStateFromProps(nextProps) {
1728
+ if ('value' in nextProps) {
1729
+ return {
1730
+ value: nextProps.value
1731
+ };
1732
+ }
1733
+
1734
+ return null;
1735
+ }
1736
+ }]);
1737
+
1738
+ return TimePicker;
1739
+ }(React.Component);
1740
+
1741
+ TimePicker.defaultProps = {
1742
+ align: {
1743
+ offset: [0, -2]
1744
+ },
1745
+ disabledHours: undefined,
1746
+ disabledMinutes: undefined,
1747
+ disabledSeconds: undefined,
1748
+ hideDisabledOptions: false,
1749
+ placement: 'bottomLeft',
1750
+ transitionName: 'slide-up',
1751
+ focusOnOpen: true
1752
+ };
1753
+ polyfill(TimePicker);
1754
+
1755
+ export { Panel as P, TimePicker as T, generateShowHourMinuteSecond as g };