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/index4.js ADDED
@@ -0,0 +1,522 @@
1
+ import * as React from 'react';
2
+ import { c as connected$1, D as Divider, M as MenuItemGroup, a as Menu$1 } from './Divider.js';
3
+ import { d as connected, p as polyfill } from './menu.js';
4
+ import { h as createReactContext, c as classNames, p as propTypesExports, C as ConfigConsumer } from './config-provider.js';
5
+ import { o as omit } from './input.js';
6
+ import { T as Tooltip } from './index6.js';
7
+ import { a as SiderContext } from './Sider.js';
8
+ import { w as wrapperRaf } from './raf.js';
9
+ import { c as collapseMotion } from './tree.js';
10
+
11
+ var MenuContext = createReactContext({
12
+ inlineCollapsed: false
13
+ });
14
+
15
+ function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
16
+
17
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
18
+
19
+ function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
+
21
+ 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); } }
22
+
23
+ function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
24
+
25
+ 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); }
26
+
27
+ function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
28
+
29
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf$2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$2(this, result); }; }
30
+
31
+ function _possibleConstructorReturn$2(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
32
+
33
+ function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
34
+
35
+ function _isNativeReflectConstruct$2() { 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; } }
36
+
37
+ function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
38
+
39
+ var SubMenu = /*#__PURE__*/function (_React$Component) {
40
+ _inherits$2(SubMenu, _React$Component);
41
+
42
+ var _super = _createSuper$2(SubMenu);
43
+
44
+ function SubMenu() {
45
+ var _this;
46
+
47
+ _classCallCheck$2(this, SubMenu);
48
+
49
+ _this = _super.apply(this, arguments);
50
+
51
+ _this.onKeyDown = function (e) {
52
+ _this.subMenu.onKeyDown(e);
53
+ };
54
+
55
+ _this.saveSubMenu = function (subMenu) {
56
+ _this.subMenu = subMenu;
57
+ };
58
+
59
+ return _this;
60
+ }
61
+
62
+ _createClass$2(SubMenu, [{
63
+ key: "render",
64
+ value: function render() {
65
+ var _this2 = this;
66
+
67
+ var _this$props = this.props,
68
+ rootPrefixCls = _this$props.rootPrefixCls,
69
+ popupClassName = _this$props.popupClassName;
70
+ return /*#__PURE__*/React.createElement(MenuContext.Consumer, null, function (_ref) {
71
+ var antdMenuTheme = _ref.antdMenuTheme;
72
+ return /*#__PURE__*/React.createElement(connected, _extends$2({}, _this2.props, {
73
+ ref: _this2.saveSubMenu,
74
+ popupClassName: classNames("".concat(rootPrefixCls, "-").concat(antdMenuTheme), popupClassName)
75
+ }));
76
+ });
77
+ }
78
+ }]);
79
+
80
+ return SubMenu;
81
+ }(React.Component);
82
+
83
+ SubMenu.contextTypes = {
84
+ antdMenuTheme: propTypesExports.string
85
+ }; // fix issue:https://github.com/ant-design/ant-design/issues/8666
86
+
87
+ SubMenu.isSubMenu = 1;
88
+
89
+ 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); }
90
+
91
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
92
+
93
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
94
+
95
+ 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); } }
96
+
97
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
98
+
99
+ 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); }
100
+
101
+ function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
102
+
103
+ 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); }; }
104
+
105
+ function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
106
+
107
+ function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
108
+
109
+ 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; } }
110
+
111
+ function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
112
+
113
+ var __rest = undefined && undefined.__rest || function (s, e) {
114
+ var t = {};
115
+
116
+ for (var p in s) {
117
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
118
+ }
119
+
120
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
121
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
122
+ }
123
+ return t;
124
+ };
125
+
126
+ var MenuItem = /*#__PURE__*/function (_React$Component) {
127
+ _inherits$1(MenuItem, _React$Component);
128
+
129
+ var _super = _createSuper$1(MenuItem);
130
+
131
+ function MenuItem() {
132
+ var _this;
133
+
134
+ _classCallCheck$1(this, MenuItem);
135
+
136
+ _this = _super.apply(this, arguments);
137
+
138
+ _this.onKeyDown = function (e) {
139
+ _this.menuItem.onKeyDown(e);
140
+ };
141
+
142
+ _this.saveMenuItem = function (menuItem) {
143
+ _this.menuItem = menuItem;
144
+ };
145
+
146
+ _this.renderItem = function (_ref) {
147
+ var siderCollapsed = _ref.siderCollapsed;
148
+ var _this$props = _this.props,
149
+ level = _this$props.level,
150
+ children = _this$props.children,
151
+ rootPrefixCls = _this$props.rootPrefixCls;
152
+
153
+ var _a = _this.props,
154
+ title = _a.title,
155
+ rest = __rest(_a, ["title"]);
156
+
157
+ return /*#__PURE__*/React.createElement(MenuContext.Consumer, null, function (_ref2) {
158
+ var inlineCollapsed = _ref2.inlineCollapsed;
159
+ var tooltipProps = {
160
+ title: title || (level === 1 ? children : '')
161
+ };
162
+
163
+ if (!siderCollapsed && !inlineCollapsed) {
164
+ tooltipProps.title = null; // Reset `visible` to fix control mode tooltip display not correct
165
+ // ref: https://github.com/ant-design/ant-design/issues/16742
166
+
167
+ tooltipProps.visible = false;
168
+ }
169
+
170
+ return /*#__PURE__*/React.createElement(Tooltip, _extends$1({}, tooltipProps, {
171
+ placement: "right",
172
+ overlayClassName: "".concat(rootPrefixCls, "-inline-collapsed-tooltip")
173
+ }), /*#__PURE__*/React.createElement(connected$1, _extends$1({}, rest, {
174
+ title: title,
175
+ ref: _this.saveMenuItem
176
+ })));
177
+ });
178
+ };
179
+
180
+ return _this;
181
+ }
182
+
183
+ _createClass$1(MenuItem, [{
184
+ key: "render",
185
+ value: function render() {
186
+ return /*#__PURE__*/React.createElement(SiderContext.Consumer, null, this.renderItem);
187
+ }
188
+ }]);
189
+
190
+ return MenuItem;
191
+ }(React.Component);
192
+ MenuItem.isMenuItem = true;
193
+
194
+ 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); }
195
+
196
+ 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); }
197
+
198
+ 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; }
199
+
200
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
201
+
202
+ 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); } }
203
+
204
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
205
+
206
+ 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); }
207
+
208
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
209
+
210
+ 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); }; }
211
+
212
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
213
+
214
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
215
+
216
+ 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; } }
217
+
218
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
219
+
220
+ var InternalMenu = /*#__PURE__*/function (_React$Component) {
221
+ _inherits(InternalMenu, _React$Component);
222
+
223
+ var _super = _createSuper(InternalMenu);
224
+
225
+ function InternalMenu(props) {
226
+ var _this;
227
+
228
+ _classCallCheck(this, InternalMenu);
229
+
230
+ _this = _super.call(this, props); // Restore vertical mode when menu is collapsed responsively when mounted
231
+ // https://github.com/ant-design/ant-design/issues/13104
232
+ // TODO: not a perfect solution, looking a new way to avoid setting switchingModeFromInline in this situation
233
+
234
+ _this.handleMouseEnter = function (e) {
235
+ _this.restoreModeVerticalFromInline();
236
+
237
+ var onMouseEnter = _this.props.onMouseEnter;
238
+
239
+ if (onMouseEnter) {
240
+ onMouseEnter(e);
241
+ }
242
+ };
243
+
244
+ _this.handleTransitionEnd = function (e) {
245
+ // when inlineCollapsed menu width animation finished
246
+ // https://github.com/ant-design/ant-design/issues/12864
247
+ var widthCollapsed = e.propertyName === 'width' && e.target === e.currentTarget; // Fix SVGElement e.target.className.indexOf is not a function
248
+ // https://github.com/ant-design/ant-design/issues/15699
249
+
250
+ var className = e.target.className; // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during an animation.
251
+
252
+ var classNameValue = Object.prototype.toString.call(className) === '[object SVGAnimatedString]' ? className.animVal : className; // Fix for <Menu style={{ width: '100%' }} />, the width transition won't trigger when menu is collapsed
253
+ // https://github.com/ant-design/ant-design-pro/issues/2783
254
+
255
+ var iconScaled = e.propertyName === 'font-size' && classNameValue.indexOf('anticon') >= 0;
256
+
257
+ if (widthCollapsed || iconScaled) {
258
+ _this.restoreModeVerticalFromInline();
259
+ }
260
+ };
261
+
262
+ _this.handleClick = function (e) {
263
+ _this.handleOpenChange([]);
264
+
265
+ var onClick = _this.props.onClick;
266
+
267
+ if (onClick) {
268
+ onClick(e);
269
+ }
270
+ };
271
+
272
+ _this.handleOpenChange = function (openKeys) {
273
+ _this.setOpenKeys(openKeys);
274
+
275
+ var onOpenChange = _this.props.onOpenChange;
276
+
277
+ if (onOpenChange) {
278
+ onOpenChange(openKeys);
279
+ }
280
+ };
281
+
282
+ _this.renderMenu = function (_ref) {
283
+ var getPopupContainer = _ref.getPopupContainer,
284
+ getPrefixCls = _ref.getPrefixCls;
285
+ var _this$props = _this.props,
286
+ customizePrefixCls = _this$props.prefixCls,
287
+ className = _this$props.className,
288
+ theme = _this$props.theme,
289
+ collapsedWidth = _this$props.collapsedWidth;
290
+ var passProps = omit(_this.props, ['collapsedWidth', 'siderCollapsed']);
291
+
292
+ var menuMode = _this.getRealMenuMode();
293
+
294
+ var menuOpenMotion = _this.getOpenMotionProps(menuMode);
295
+
296
+ var prefixCls = getPrefixCls('menu', customizePrefixCls);
297
+ var menuClassName = classNames(className, "".concat(prefixCls, "-").concat(theme), _defineProperty({}, "".concat(prefixCls, "-inline-collapsed"), _this.getInlineCollapsed()));
298
+
299
+ var menuProps = _extends({
300
+ openKeys: _this.state.openKeys,
301
+ onOpenChange: _this.handleOpenChange,
302
+ className: menuClassName,
303
+ mode: menuMode
304
+ }, menuOpenMotion);
305
+
306
+ if (menuMode !== 'inline') {
307
+ // closing vertical popup submenu after click it
308
+ menuProps.onClick = _this.handleClick;
309
+ } // https://github.com/ant-design/ant-design/issues/8587
310
+
311
+
312
+ var hideMenu = _this.getInlineCollapsed() && (collapsedWidth === 0 || collapsedWidth === '0' || collapsedWidth === '0px');
313
+
314
+ if (hideMenu) {
315
+ menuProps.openKeys = [];
316
+ }
317
+
318
+ return /*#__PURE__*/React.createElement(Menu$1, _extends({
319
+ getPopupContainer: getPopupContainer
320
+ }, passProps, menuProps, {
321
+ prefixCls: prefixCls,
322
+ onTransitionEnd: _this.handleTransitionEnd,
323
+ onMouseEnter: _this.handleMouseEnter
324
+ }));
325
+ };
326
+ var openKeys;
327
+
328
+ if ('openKeys' in props) {
329
+ openKeys = props.openKeys;
330
+ } else if ('defaultOpenKeys' in props) {
331
+ openKeys = props.defaultOpenKeys;
332
+ }
333
+
334
+ _this.state = {
335
+ openKeys: openKeys || [],
336
+ switchingModeFromInline: false,
337
+ inlineOpenKeys: [],
338
+ prevProps: props
339
+ };
340
+ return _this;
341
+ }
342
+
343
+ _createClass(InternalMenu, [{
344
+ key: "componentWillUnmount",
345
+ value: function componentWillUnmount() {
346
+ wrapperRaf.cancel(this.mountRafId);
347
+ }
348
+ }, {
349
+ key: "setOpenKeys",
350
+ value: function setOpenKeys(openKeys) {
351
+ if (!('openKeys' in this.props)) {
352
+ this.setState({
353
+ openKeys: openKeys
354
+ });
355
+ }
356
+ }
357
+ }, {
358
+ key: "getRealMenuMode",
359
+ value: function getRealMenuMode() {
360
+ var inlineCollapsed = this.getInlineCollapsed();
361
+
362
+ if (this.state.switchingModeFromInline && inlineCollapsed) {
363
+ return 'inline';
364
+ }
365
+
366
+ var mode = this.props.mode;
367
+ return inlineCollapsed ? 'vertical' : mode;
368
+ }
369
+ }, {
370
+ key: "getInlineCollapsed",
371
+ value: function getInlineCollapsed() {
372
+ var inlineCollapsed = this.props.inlineCollapsed;
373
+
374
+ if (this.props.siderCollapsed !== undefined) {
375
+ return this.props.siderCollapsed;
376
+ }
377
+
378
+ return inlineCollapsed;
379
+ }
380
+ }, {
381
+ key: "getOpenMotionProps",
382
+ value: function getOpenMotionProps(menuMode) {
383
+ var _this$props2 = this.props,
384
+ openTransitionName = _this$props2.openTransitionName,
385
+ openAnimation = _this$props2.openAnimation,
386
+ motion = _this$props2.motion; // Provides by user
387
+
388
+ if (motion) {
389
+ return {
390
+ motion: motion
391
+ };
392
+ }
393
+
394
+ if (openAnimation) {
395
+ return {
396
+ openAnimation: openAnimation
397
+ };
398
+ }
399
+
400
+ if (openTransitionName) {
401
+ return {
402
+ openTransitionName: openTransitionName
403
+ };
404
+ } // Default logic
405
+
406
+
407
+ if (menuMode === 'horizontal') {
408
+ return {
409
+ motion: {
410
+ motionName: 'slide-up'
411
+ }
412
+ };
413
+ }
414
+
415
+ if (menuMode === 'inline') {
416
+ return {
417
+ motion: collapseMotion
418
+ };
419
+ } // When mode switch from inline
420
+ // submenu should hide without animation
421
+
422
+
423
+ return {
424
+ motion: {
425
+ motionName: this.state.switchingModeFromInline ? '' : 'zoom-big'
426
+ }
427
+ };
428
+ }
429
+ }, {
430
+ key: "restoreModeVerticalFromInline",
431
+ value: function restoreModeVerticalFromInline() {
432
+ var switchingModeFromInline = this.state.switchingModeFromInline;
433
+
434
+ if (switchingModeFromInline) {
435
+ this.setState({
436
+ switchingModeFromInline: false
437
+ });
438
+ }
439
+ }
440
+ }, {
441
+ key: "render",
442
+ value: function render() {
443
+ return /*#__PURE__*/React.createElement(MenuContext.Provider, {
444
+ value: {
445
+ inlineCollapsed: this.getInlineCollapsed() || false,
446
+ antdMenuTheme: this.props.theme
447
+ }
448
+ }, /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderMenu));
449
+ }
450
+ }], [{
451
+ key: "getDerivedStateFromProps",
452
+ value: function getDerivedStateFromProps(nextProps, prevState) {
453
+ var prevProps = prevState.prevProps;
454
+ var newState = {
455
+ prevProps: nextProps
456
+ };
457
+
458
+ if (prevProps.mode === 'inline' && nextProps.mode !== 'inline') {
459
+ newState.switchingModeFromInline = true;
460
+ }
461
+
462
+ if ('openKeys' in nextProps) {
463
+ newState.openKeys = nextProps.openKeys;
464
+ } else {
465
+ // [Legacy] Old code will return after `openKeys` changed.
466
+ // Not sure the reason, we should keep this logic still.
467
+ if (nextProps.inlineCollapsed && !prevProps.inlineCollapsed || nextProps.siderCollapsed && !prevProps.siderCollapsed) {
468
+ newState.switchingModeFromInline = true;
469
+ newState.inlineOpenKeys = prevState.openKeys;
470
+ newState.openKeys = [];
471
+ }
472
+
473
+ if (!nextProps.inlineCollapsed && prevProps.inlineCollapsed || !nextProps.siderCollapsed && prevProps.siderCollapsed) {
474
+ newState.openKeys = prevState.inlineOpenKeys;
475
+ newState.inlineOpenKeys = [];
476
+ }
477
+ }
478
+
479
+ return newState;
480
+ }
481
+ }]);
482
+
483
+ return InternalMenu;
484
+ }(React.Component);
485
+
486
+ InternalMenu.defaultProps = {
487
+ className: '',
488
+ theme: 'light',
489
+ focusable: false
490
+ };
491
+ polyfill(InternalMenu); // We should keep this as ref-able
492
+
493
+ var Menu = /*#__PURE__*/function (_React$Component2) {
494
+ _inherits(Menu, _React$Component2);
495
+
496
+ var _super2 = _createSuper(Menu);
497
+
498
+ function Menu() {
499
+ _classCallCheck(this, Menu);
500
+
501
+ return _super2.apply(this, arguments);
502
+ }
503
+
504
+ _createClass(Menu, [{
505
+ key: "render",
506
+ value: function render() {
507
+ var _this2 = this;
508
+
509
+ return /*#__PURE__*/React.createElement(SiderContext.Consumer, null, function (context) {
510
+ return /*#__PURE__*/React.createElement(InternalMenu, _extends({}, _this2.props, context));
511
+ });
512
+ }
513
+ }]);
514
+
515
+ return Menu;
516
+ }(React.Component);
517
+ Menu.Divider = Divider;
518
+ Menu.Item = MenuItem;
519
+ Menu.SubMenu = SubMenu;
520
+ Menu.ItemGroup = MenuItemGroup;
521
+
522
+ export { Menu as M };