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.
- package/LICENSE +21 -0
- package/dist/Checkbox.js +164 -0
- package/dist/CommonMixin.js +816 -0
- package/dist/Divider.js +646 -0
- package/dist/Notification.js +279 -0
- package/dist/Pagination.js +1106 -0
- package/dist/PortalWrapper.js +347 -0
- package/dist/RowContext.js +5 -0
- package/dist/Sider.js +533 -0
- package/dist/TextArea.js +432 -0
- package/dist/_arrayMap.js +68 -0
- package/dist/_assignValue.js +95 -0
- package/dist/_copyArray.js +31 -0
- package/dist/_hasPath.js +53 -0
- package/dist/_overArg.js +437 -0
- package/dist/_stringToArray.js +136 -0
- package/dist/antd/es/affix.js +12 -0
- package/dist/antd/es/alert.js +5 -0
- package/dist/antd/es/anchor.js +466 -0
- package/dist/antd/es/auto-complete.js +5 -0
- package/dist/antd/es/avatar.js +5 -0
- package/dist/antd/es/back-top.js +5 -0
- package/dist/antd/es/badge.js +5 -0
- package/dist/antd/es/breadcrumb.js +18 -0
- package/dist/antd/es/button.js +12 -0
- package/dist/antd/es/calendar.js +953 -0
- package/dist/antd/es/card.js +5 -0
- package/dist/antd/es/carousel.js +5 -0
- package/dist/antd/es/cascader.js +1275 -0
- package/dist/antd/es/checkbox.js +11 -0
- package/dist/antd/es/col.js +4 -0
- package/dist/antd/es/collapse.js +688 -0
- package/dist/antd/es/comment.js +5 -0
- package/dist/antd/es/config-provider.js +2 -0
- package/dist/antd/es/date-picker.js +4322 -0
- package/dist/antd/es/descriptions.js +342 -0
- package/dist/antd/es/divider.js +53 -0
- package/dist/antd/es/drawer.js +1115 -0
- package/dist/antd/es/dropdown.js +14 -0
- package/dist/antd/es/empty.js +6 -0
- package/dist/antd/es/form.js +5008 -0
- package/dist/antd/es/grid.js +13 -0
- package/dist/antd/es/icon.js +6 -0
- package/dist/antd/es/input-number.js +5 -0
- package/dist/antd/es/input.js +16 -0
- package/dist/antd/es/layout.js +14 -0
- package/dist/antd/es/list.js +5 -0
- package/dist/antd/es/locale/ar_EG.js +102 -0
- package/dist/antd/es/locale/bg_BG.js +98 -0
- package/dist/antd/es/locale/ca_ES.js +96 -0
- package/dist/antd/es/locale/cs_CZ.js +96 -0
- package/dist/antd/es/locale/da_DK.js +98 -0
- package/dist/antd/es/locale/de_DE.js +98 -0
- package/dist/antd/es/locale/default.js +2 -0
- package/dist/antd/es/locale/el_GR.js +98 -0
- package/dist/antd/es/locale/en_GB.js +98 -0
- package/dist/antd/es/locale/en_US.js +2 -0
- package/dist/antd/es/locale/es_ES.js +114 -0
- package/dist/antd/es/locale/et_EE.js +98 -0
- package/dist/antd/es/locale/fa_IR.js +98 -0
- package/dist/antd/es/locale/fi_FI.js +99 -0
- package/dist/antd/es/locale/fr_BE.js +102 -0
- package/dist/antd/es/locale/fr_FR.js +102 -0
- package/dist/antd/es/locale/ga_IE.js +99 -0
- package/dist/antd/es/locale/he_IL.js +99 -0
- package/dist/antd/es/locale/hi_IN.js +107 -0
- package/dist/antd/es/locale/hr_HR.js +113 -0
- package/dist/antd/es/locale/hu_HU.js +99 -0
- package/dist/antd/es/locale/hy_AM.js +109 -0
- package/dist/antd/es/locale/id_ID.js +101 -0
- package/dist/antd/es/locale/is_IS.js +98 -0
- package/dist/antd/es/locale/it_IT.js +111 -0
- package/dist/antd/es/locale/ja_JP.js +96 -0
- package/dist/antd/es/locale/kn_IN.js +107 -0
- package/dist/antd/es/locale/ko_KR.js +98 -0
- package/dist/antd/es/locale/ku_IQ.js +98 -0
- package/dist/antd/es/locale/lv_LV.js +98 -0
- package/dist/antd/es/locale/mk_MK.js +113 -0
- package/dist/antd/es/locale/mn_MN.js +99 -0
- package/dist/antd/es/locale/ms_MY.js +118 -0
- package/dist/antd/es/locale/nb_NO.js +97 -0
- package/dist/antd/es/locale/ne_NP.js +44 -0
- package/dist/antd/es/locale/nl_BE.js +98 -0
- package/dist/antd/es/locale/nl_NL.js +117 -0
- package/dist/antd/es/locale/pl_PL.js +98 -0
- package/dist/antd/es/locale/pt_BR.js +104 -0
- package/dist/antd/es/locale/pt_PT.js +127 -0
- package/dist/antd/es/locale/ro_RO.js +118 -0
- package/dist/antd/es/locale/ru_RU.js +110 -0
- package/dist/antd/es/locale/sk_SK.js +118 -0
- package/dist/antd/es/locale/sl_SI.js +96 -0
- package/dist/antd/es/locale/sr_RS.js +97 -0
- package/dist/antd/es/locale/sv_SE.js +101 -0
- package/dist/antd/es/locale/ta_IN.js +119 -0
- package/dist/antd/es/locale/th_TH.js +117 -0
- package/dist/antd/es/locale/tr_TR.js +112 -0
- package/dist/antd/es/locale/uk_UA.js +97 -0
- package/dist/antd/es/locale/vi_VN.js +99 -0
- package/dist/antd/es/locale/zh_CN.js +104 -0
- package/dist/antd/es/locale/zh_TW.js +100 -0
- package/dist/antd/es/locale-provider.js +6 -0
- package/dist/antd/es/mention.js +23215 -0
- package/dist/antd/es/mentions.js +961 -0
- package/dist/antd/es/menu.js +5 -0
- package/dist/antd/es/message.js +161 -0
- package/dist/antd/es/modal.js +885 -0
- package/dist/antd/es/notification.js +216 -0
- package/dist/antd/es/page-header.js +350 -0
- package/dist/antd/es/pagination.js +15 -0
- package/dist/antd/es/popconfirm.js +215 -0
- package/dist/antd/es/popover.js +5 -0
- package/dist/antd/es/progress.js +10 -0
- package/dist/antd/es/radio.js +10 -0
- package/dist/antd/es/rate.js +5 -0
- package/dist/antd/es/result.js +828 -0
- package/dist/antd/es/row.js +9 -0
- package/dist/antd/es/select.js +5 -0
- package/dist/antd/es/skeleton.js +370 -0
- package/dist/antd/es/slider.js +5 -0
- package/dist/antd/es/spin.js +11 -0
- package/dist/antd/es/statistic.js +650 -0
- package/dist/antd/es/steps.js +5 -0
- package/dist/antd/es/style.js +5 -0
- package/dist/antd/es/switch.js +5 -0
- package/dist/antd/es/table.js +7057 -0
- package/dist/antd/es/tabs.js +5 -0
- package/dist/antd/es/tag.js +12 -0
- package/dist/antd/es/time-picker.js +10 -0
- package/dist/antd/es/timeline.js +206 -0
- package/dist/antd/es/tooltip.js +9 -0
- package/dist/antd/es/transfer.js +2508 -0
- package/dist/antd/es/tree-select.js +5 -0
- package/dist/antd/es/tree.js +10 -0
- package/dist/antd/es/typography.js +1246 -0
- package/dist/antd/es/upload.js +3418 -0
- package/dist/antd/es/version.js +7 -0
- package/dist/col.js +142 -0
- package/dist/config-provider.js +6949 -0
- package/dist/dropdown.js +442 -0
- package/dist/get.js +1043 -0
- package/dist/icon.js +6138 -0
- package/dist/identity.js +230 -0
- package/dist/index.js +462 -0
- package/dist/index10.js +478 -0
- package/dist/index11.js +232 -0
- package/dist/index12.js +2766 -0
- package/dist/index13.js +422 -0
- package/dist/index14.js +283 -0
- package/dist/index15.js +1755 -0
- package/dist/index2.js +374 -0
- package/dist/index3.js +407 -0
- package/dist/index4.js +522 -0
- package/dist/index5.js +601 -0
- package/dist/index6.js +601 -0
- package/dist/index7.js +364 -0
- package/dist/index8.js +436 -0
- package/dist/index9.js +130 -0
- package/dist/input.js +475 -0
- package/dist/isLength.js +402 -0
- package/dist/keys.js +292 -0
- package/dist/menu.js +8138 -0
- package/dist/progress.js +852 -0
- package/dist/raf.js +34 -0
- package/dist/responsiveObserve.js +444 -0
- package/dist/row.js +173 -0
- package/dist/scrollTo.js +66 -0
- package/dist/toInteger.js +123 -0
- package/dist/toString.js +84 -0
- package/dist/transButton.js +121 -0
- package/dist/tree.js +3017 -0
- package/dist/warning.js +55 -0
- package/dist/wave.js +230 -0
- package/dist/zh_CN.js +17 -0
- package/package.json +160 -0
package/dist/Divider.js
ADDED
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { n as noop, l as libExports, g as getActiveKey, e as connected$1, K as KeyCode, m as menuAllProps } from './menu.js';
|
|
3
|
+
import * as ReactDOM from 'react-dom';
|
|
4
|
+
import { c as classNames } from './config-provider.js';
|
|
5
|
+
import { s as scrollIntoView } from './index5.js';
|
|
6
|
+
|
|
7
|
+
function _typeof$3(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$3 = function _typeof(obj) { return typeof obj; }; } else { _typeof$3 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$3(obj); }
|
|
8
|
+
function getMotion(_ref) {
|
|
9
|
+
var prefixCls = _ref.prefixCls,
|
|
10
|
+
motion = _ref.motion,
|
|
11
|
+
openAnimation = _ref.openAnimation,
|
|
12
|
+
openTransitionName = _ref.openTransitionName;
|
|
13
|
+
|
|
14
|
+
if (motion) {
|
|
15
|
+
return motion;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (_typeof$3(openAnimation) === 'object' && openAnimation) ; else if (typeof openAnimation === 'string') {
|
|
19
|
+
return {
|
|
20
|
+
motionName: "".concat(prefixCls, "-open-").concat(openAnimation)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (openTransitionName) {
|
|
25
|
+
return {
|
|
26
|
+
motionName: openTransitionName
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _typeof$2(obj) { 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); }
|
|
34
|
+
|
|
35
|
+
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; }
|
|
36
|
+
|
|
37
|
+
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$1(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; }
|
|
38
|
+
|
|
39
|
+
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; }
|
|
40
|
+
|
|
41
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
42
|
+
|
|
43
|
+
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); } }
|
|
44
|
+
|
|
45
|
+
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
|
|
46
|
+
|
|
47
|
+
function _possibleConstructorReturn$2(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
|
|
48
|
+
|
|
49
|
+
function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
|
|
50
|
+
|
|
51
|
+
function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
52
|
+
|
|
53
|
+
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); }
|
|
54
|
+
|
|
55
|
+
function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
|
|
56
|
+
|
|
57
|
+
var Menu =
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
function (_React$Component) {
|
|
60
|
+
_inherits$2(Menu, _React$Component);
|
|
61
|
+
|
|
62
|
+
function Menu(props) {
|
|
63
|
+
var _this;
|
|
64
|
+
|
|
65
|
+
_classCallCheck$2(this, Menu);
|
|
66
|
+
|
|
67
|
+
_this = _possibleConstructorReturn$2(this, _getPrototypeOf$2(Menu).call(this, props));
|
|
68
|
+
|
|
69
|
+
_this.onSelect = function (selectInfo) {
|
|
70
|
+
var _assertThisInitialize = _assertThisInitialized$2(_this),
|
|
71
|
+
props = _assertThisInitialize.props;
|
|
72
|
+
|
|
73
|
+
if (props.selectable) {
|
|
74
|
+
// root menu
|
|
75
|
+
var _this$store$getState = _this.store.getState(),
|
|
76
|
+
_selectedKeys = _this$store$getState.selectedKeys;
|
|
77
|
+
|
|
78
|
+
var selectedKey = selectInfo.key;
|
|
79
|
+
|
|
80
|
+
if (props.multiple) {
|
|
81
|
+
_selectedKeys = _selectedKeys.concat([selectedKey]);
|
|
82
|
+
} else {
|
|
83
|
+
_selectedKeys = [selectedKey];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!('selectedKeys' in props)) {
|
|
87
|
+
_this.store.setState({
|
|
88
|
+
selectedKeys: _selectedKeys
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
props.onSelect(_objectSpread$1({}, selectInfo, {
|
|
93
|
+
selectedKeys: _selectedKeys
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
_this.onClick = function (e) {
|
|
99
|
+
_this.props.onClick(e);
|
|
100
|
+
}; // onKeyDown needs to be exposed as a instance method
|
|
101
|
+
// e.g., in rc-select, we need to navigate menu item while
|
|
102
|
+
// current active item is rc-select input box rather than the menu itself
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
_this.onKeyDown = function (e, callback) {
|
|
106
|
+
_this.innerMenu.getWrappedInstance().onKeyDown(e, callback);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
_this.onOpenChange = function (event) {
|
|
110
|
+
var _assertThisInitialize2 = _assertThisInitialized$2(_this),
|
|
111
|
+
props = _assertThisInitialize2.props;
|
|
112
|
+
|
|
113
|
+
var openKeys = _this.store.getState().openKeys.concat();
|
|
114
|
+
|
|
115
|
+
var changed = false;
|
|
116
|
+
|
|
117
|
+
var processSingle = function processSingle(e) {
|
|
118
|
+
var oneChanged = false;
|
|
119
|
+
|
|
120
|
+
if (e.open) {
|
|
121
|
+
oneChanged = openKeys.indexOf(e.key) === -1;
|
|
122
|
+
|
|
123
|
+
if (oneChanged) {
|
|
124
|
+
openKeys.push(e.key);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
var index = openKeys.indexOf(e.key);
|
|
128
|
+
oneChanged = index !== -1;
|
|
129
|
+
|
|
130
|
+
if (oneChanged) {
|
|
131
|
+
openKeys.splice(index, 1);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
changed = changed || oneChanged;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
if (Array.isArray(event)) {
|
|
139
|
+
// batch change call
|
|
140
|
+
event.forEach(processSingle);
|
|
141
|
+
} else {
|
|
142
|
+
processSingle(event);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (changed) {
|
|
146
|
+
if (!('openKeys' in _this.props)) {
|
|
147
|
+
_this.store.setState({
|
|
148
|
+
openKeys: openKeys
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
props.onOpenChange(openKeys);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
_this.onDeselect = function (selectInfo) {
|
|
157
|
+
var _assertThisInitialize3 = _assertThisInitialized$2(_this),
|
|
158
|
+
props = _assertThisInitialize3.props;
|
|
159
|
+
|
|
160
|
+
if (props.selectable) {
|
|
161
|
+
var _selectedKeys2 = _this.store.getState().selectedKeys.concat();
|
|
162
|
+
|
|
163
|
+
var selectedKey = selectInfo.key;
|
|
164
|
+
|
|
165
|
+
var index = _selectedKeys2.indexOf(selectedKey);
|
|
166
|
+
|
|
167
|
+
if (index !== -1) {
|
|
168
|
+
_selectedKeys2.splice(index, 1);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!('selectedKeys' in props)) {
|
|
172
|
+
_this.store.setState({
|
|
173
|
+
selectedKeys: _selectedKeys2
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
props.onDeselect(_objectSpread$1({}, selectInfo, {
|
|
178
|
+
selectedKeys: _selectedKeys2
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
_this.getOpenTransitionName = function () {
|
|
184
|
+
var _assertThisInitialize4 = _assertThisInitialized$2(_this),
|
|
185
|
+
props = _assertThisInitialize4.props;
|
|
186
|
+
|
|
187
|
+
var transitionName = props.openTransitionName;
|
|
188
|
+
var animationName = props.openAnimation;
|
|
189
|
+
|
|
190
|
+
if (!transitionName && typeof animationName === 'string') {
|
|
191
|
+
transitionName = "".concat(props.prefixCls, "-open-").concat(animationName);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return transitionName;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
_this.setInnerMenu = function (node) {
|
|
198
|
+
_this.innerMenu = node;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
_this.isRootMenu = true;
|
|
202
|
+
var selectedKeys = props.defaultSelectedKeys;
|
|
203
|
+
var openKeys = props.defaultOpenKeys;
|
|
204
|
+
|
|
205
|
+
if ('selectedKeys' in props) {
|
|
206
|
+
selectedKeys = props.selectedKeys || [];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if ('openKeys' in props) {
|
|
210
|
+
openKeys = props.openKeys || [];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
_this.store = libExports.create({
|
|
214
|
+
selectedKeys: selectedKeys,
|
|
215
|
+
openKeys: openKeys,
|
|
216
|
+
activeKey: {
|
|
217
|
+
'0-menu-': getActiveKey(props, props.activeKey)
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
return _this;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
_createClass$2(Menu, [{
|
|
224
|
+
key: "componentDidMount",
|
|
225
|
+
value: function componentDidMount() {
|
|
226
|
+
this.updateMiniStore();
|
|
227
|
+
}
|
|
228
|
+
}, {
|
|
229
|
+
key: "componentDidUpdate",
|
|
230
|
+
value: function componentDidUpdate() {
|
|
231
|
+
this.updateMiniStore();
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "updateMiniStore",
|
|
235
|
+
value: function updateMiniStore() {
|
|
236
|
+
if ('selectedKeys' in this.props) {
|
|
237
|
+
this.store.setState({
|
|
238
|
+
selectedKeys: this.props.selectedKeys || []
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if ('openKeys' in this.props) {
|
|
243
|
+
this.store.setState({
|
|
244
|
+
openKeys: this.props.openKeys || []
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "render",
|
|
250
|
+
value: function render() {
|
|
251
|
+
var props = _objectSpread$1({}, this.props);
|
|
252
|
+
|
|
253
|
+
props.className += " ".concat(props.prefixCls, "-root");
|
|
254
|
+
props = _objectSpread$1({}, props, {
|
|
255
|
+
onClick: this.onClick,
|
|
256
|
+
onOpenChange: this.onOpenChange,
|
|
257
|
+
onDeselect: this.onDeselect,
|
|
258
|
+
onSelect: this.onSelect,
|
|
259
|
+
parentMenu: this,
|
|
260
|
+
motion: getMotion(this.props)
|
|
261
|
+
});
|
|
262
|
+
delete props.openAnimation;
|
|
263
|
+
delete props.openTransitionName;
|
|
264
|
+
return React.createElement(libExports.Provider, {
|
|
265
|
+
store: this.store
|
|
266
|
+
}, React.createElement(connected$1, Object.assign({}, props, {
|
|
267
|
+
ref: this.setInnerMenu
|
|
268
|
+
}), this.props.children));
|
|
269
|
+
}
|
|
270
|
+
}]);
|
|
271
|
+
|
|
272
|
+
return Menu;
|
|
273
|
+
}(React.Component);
|
|
274
|
+
|
|
275
|
+
Menu.defaultProps = {
|
|
276
|
+
selectable: true,
|
|
277
|
+
onClick: noop,
|
|
278
|
+
onSelect: noop,
|
|
279
|
+
onOpenChange: noop,
|
|
280
|
+
onDeselect: noop,
|
|
281
|
+
defaultSelectedKeys: [],
|
|
282
|
+
defaultOpenKeys: [],
|
|
283
|
+
subMenuOpenDelay: 0.1,
|
|
284
|
+
subMenuCloseDelay: 0.1,
|
|
285
|
+
triggerSubMenuAction: 'hover',
|
|
286
|
+
prefixCls: 'rc-menu',
|
|
287
|
+
className: '',
|
|
288
|
+
mode: 'vertical',
|
|
289
|
+
style: {},
|
|
290
|
+
builtinPlacements: {},
|
|
291
|
+
overflowedIndicator: React.createElement("span", null, "\xB7\xB7\xB7")
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
function _typeof$1(obj) { 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); }
|
|
295
|
+
|
|
296
|
+
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; }
|
|
297
|
+
|
|
298
|
+
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(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; }
|
|
299
|
+
|
|
300
|
+
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; }
|
|
301
|
+
|
|
302
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
303
|
+
|
|
304
|
+
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); } }
|
|
305
|
+
|
|
306
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
|
|
307
|
+
|
|
308
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
309
|
+
|
|
310
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
311
|
+
|
|
312
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
313
|
+
|
|
314
|
+
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); }
|
|
315
|
+
|
|
316
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
317
|
+
var MenuItem =
|
|
318
|
+
/*#__PURE__*/
|
|
319
|
+
function (_React$Component) {
|
|
320
|
+
_inherits$1(MenuItem, _React$Component);
|
|
321
|
+
|
|
322
|
+
function MenuItem() {
|
|
323
|
+
var _this;
|
|
324
|
+
|
|
325
|
+
_classCallCheck$1(this, MenuItem);
|
|
326
|
+
|
|
327
|
+
_this = _possibleConstructorReturn$1(this, _getPrototypeOf$1(MenuItem).apply(this, arguments));
|
|
328
|
+
|
|
329
|
+
_this.onKeyDown = function (e) {
|
|
330
|
+
var keyCode = e.keyCode;
|
|
331
|
+
|
|
332
|
+
if (keyCode === KeyCode.ENTER) {
|
|
333
|
+
_this.onClick(e);
|
|
334
|
+
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return undefined;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
_this.onMouseLeave = function (e) {
|
|
342
|
+
var _this$props = _this.props,
|
|
343
|
+
eventKey = _this$props.eventKey,
|
|
344
|
+
onItemHover = _this$props.onItemHover,
|
|
345
|
+
onMouseLeave = _this$props.onMouseLeave;
|
|
346
|
+
onItemHover({
|
|
347
|
+
key: eventKey,
|
|
348
|
+
hover: false
|
|
349
|
+
});
|
|
350
|
+
onMouseLeave({
|
|
351
|
+
key: eventKey,
|
|
352
|
+
domEvent: e
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
_this.onMouseEnter = function (e) {
|
|
357
|
+
var _this$props2 = _this.props,
|
|
358
|
+
eventKey = _this$props2.eventKey,
|
|
359
|
+
onItemHover = _this$props2.onItemHover,
|
|
360
|
+
onMouseEnter = _this$props2.onMouseEnter;
|
|
361
|
+
onItemHover({
|
|
362
|
+
key: eventKey,
|
|
363
|
+
hover: true
|
|
364
|
+
});
|
|
365
|
+
onMouseEnter({
|
|
366
|
+
key: eventKey,
|
|
367
|
+
domEvent: e
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
_this.onClick = function (e) {
|
|
372
|
+
var _this$props3 = _this.props,
|
|
373
|
+
eventKey = _this$props3.eventKey,
|
|
374
|
+
multiple = _this$props3.multiple,
|
|
375
|
+
onClick = _this$props3.onClick,
|
|
376
|
+
onSelect = _this$props3.onSelect,
|
|
377
|
+
onDeselect = _this$props3.onDeselect,
|
|
378
|
+
isSelected = _this$props3.isSelected;
|
|
379
|
+
var info = {
|
|
380
|
+
key: eventKey,
|
|
381
|
+
keyPath: [eventKey],
|
|
382
|
+
item: _assertThisInitialized$1(_this),
|
|
383
|
+
domEvent: e
|
|
384
|
+
};
|
|
385
|
+
onClick(info);
|
|
386
|
+
|
|
387
|
+
if (multiple) {
|
|
388
|
+
if (isSelected) {
|
|
389
|
+
onDeselect(info);
|
|
390
|
+
} else {
|
|
391
|
+
onSelect(info);
|
|
392
|
+
}
|
|
393
|
+
} else if (!isSelected) {
|
|
394
|
+
onSelect(info);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
_this.saveNode = function (node) {
|
|
399
|
+
_this.node = node;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
return _this;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
_createClass$1(MenuItem, [{
|
|
406
|
+
key: "componentDidMount",
|
|
407
|
+
value: function componentDidMount() {
|
|
408
|
+
// invoke customized ref to expose component to mixin
|
|
409
|
+
this.callRef();
|
|
410
|
+
}
|
|
411
|
+
}, {
|
|
412
|
+
key: "componentDidUpdate",
|
|
413
|
+
value: function componentDidUpdate(prevProps) {
|
|
414
|
+
var _this$props4 = this.props,
|
|
415
|
+
active = _this$props4.active,
|
|
416
|
+
parentMenu = _this$props4.parentMenu,
|
|
417
|
+
eventKey = _this$props4.eventKey; // 在 parentMenu 上层保存滚动状态,避免重复的 MenuItem key 导致滚动跳动
|
|
418
|
+
// https://github.com/ant-design/ant-design/issues/16181
|
|
419
|
+
|
|
420
|
+
if (!prevProps.active && active && (!parentMenu || !parentMenu["scrolled-".concat(eventKey)])) {
|
|
421
|
+
if (this.node) {
|
|
422
|
+
scrollIntoView(this.node, ReactDOM.findDOMNode(parentMenu), {
|
|
423
|
+
onlyScrollIfNeeded: true
|
|
424
|
+
});
|
|
425
|
+
parentMenu["scrolled-".concat(eventKey)] = true;
|
|
426
|
+
}
|
|
427
|
+
} else if (parentMenu && parentMenu["scrolled-".concat(eventKey)]) {
|
|
428
|
+
delete parentMenu["scrolled-".concat(eventKey)];
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
this.callRef();
|
|
432
|
+
}
|
|
433
|
+
}, {
|
|
434
|
+
key: "componentWillUnmount",
|
|
435
|
+
value: function componentWillUnmount() {
|
|
436
|
+
var props = this.props;
|
|
437
|
+
|
|
438
|
+
if (props.onDestroy) {
|
|
439
|
+
props.onDestroy(props.eventKey);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}, {
|
|
443
|
+
key: "getPrefixCls",
|
|
444
|
+
value: function getPrefixCls() {
|
|
445
|
+
return "".concat(this.props.rootPrefixCls, "-item");
|
|
446
|
+
}
|
|
447
|
+
}, {
|
|
448
|
+
key: "getActiveClassName",
|
|
449
|
+
value: function getActiveClassName() {
|
|
450
|
+
return "".concat(this.getPrefixCls(), "-active");
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
key: "getSelectedClassName",
|
|
454
|
+
value: function getSelectedClassName() {
|
|
455
|
+
return "".concat(this.getPrefixCls(), "-selected");
|
|
456
|
+
}
|
|
457
|
+
}, {
|
|
458
|
+
key: "getDisabledClassName",
|
|
459
|
+
value: function getDisabledClassName() {
|
|
460
|
+
return "".concat(this.getPrefixCls(), "-disabled");
|
|
461
|
+
}
|
|
462
|
+
}, {
|
|
463
|
+
key: "callRef",
|
|
464
|
+
value: function callRef() {
|
|
465
|
+
if (this.props.manualRef) {
|
|
466
|
+
this.props.manualRef(this);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}, {
|
|
470
|
+
key: "render",
|
|
471
|
+
value: function render() {
|
|
472
|
+
var _classNames;
|
|
473
|
+
|
|
474
|
+
var props = _objectSpread({}, this.props);
|
|
475
|
+
|
|
476
|
+
var className = classNames(this.getPrefixCls(), props.className, (_classNames = {}, _defineProperty(_classNames, this.getActiveClassName(), !props.disabled && props.active), _defineProperty(_classNames, this.getSelectedClassName(), props.isSelected), _defineProperty(_classNames, this.getDisabledClassName(), props.disabled), _classNames));
|
|
477
|
+
|
|
478
|
+
var attrs = _objectSpread({}, props.attribute, {
|
|
479
|
+
title: props.title,
|
|
480
|
+
className: className,
|
|
481
|
+
// set to menuitem by default
|
|
482
|
+
role: props.role || 'menuitem',
|
|
483
|
+
'aria-disabled': props.disabled
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
if (props.role === 'option') {
|
|
487
|
+
// overwrite to option
|
|
488
|
+
attrs = _objectSpread({}, attrs, {
|
|
489
|
+
role: 'option',
|
|
490
|
+
'aria-selected': props.isSelected
|
|
491
|
+
});
|
|
492
|
+
} else if (props.role === null || props.role === 'none') {
|
|
493
|
+
// sometimes we want to specify role inside <li/> element
|
|
494
|
+
// <li><a role='menuitem'>Link</a></li> would be a good example
|
|
495
|
+
// in this case the role on <li/> should be "none" to
|
|
496
|
+
// remove the implied listitem role.
|
|
497
|
+
// https://www.w3.org/TR/wai-aria-practices-1.1/examples/menubar/menubar-1/menubar-1.html
|
|
498
|
+
attrs.role = 'none';
|
|
499
|
+
} // In case that onClick/onMouseLeave/onMouseEnter is passed down from owner
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
var mouseEvent = {
|
|
503
|
+
onClick: props.disabled ? null : this.onClick,
|
|
504
|
+
onMouseLeave: props.disabled ? null : this.onMouseLeave,
|
|
505
|
+
onMouseEnter: props.disabled ? null : this.onMouseEnter
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
var style = _objectSpread({}, props.style);
|
|
509
|
+
|
|
510
|
+
if (props.mode === 'inline') {
|
|
511
|
+
style.paddingLeft = props.inlineIndent * props.level;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
menuAllProps.forEach(function (key) {
|
|
515
|
+
return delete props[key];
|
|
516
|
+
});
|
|
517
|
+
var icon = this.props.itemIcon;
|
|
518
|
+
|
|
519
|
+
if (typeof this.props.itemIcon === 'function') {
|
|
520
|
+
// TODO: This is a bug which should fixed after TS refactor
|
|
521
|
+
icon = React.createElement(this.props.itemIcon, this.props);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
return React.createElement("li", Object.assign({}, props, attrs, mouseEvent, {
|
|
525
|
+
style: style,
|
|
526
|
+
ref: this.saveNode
|
|
527
|
+
}), props.children, icon);
|
|
528
|
+
}
|
|
529
|
+
}]);
|
|
530
|
+
|
|
531
|
+
return MenuItem;
|
|
532
|
+
}(React.Component);
|
|
533
|
+
MenuItem.isMenuItem = true;
|
|
534
|
+
MenuItem.defaultProps = {
|
|
535
|
+
onSelect: noop,
|
|
536
|
+
onMouseEnter: noop,
|
|
537
|
+
onMouseLeave: noop,
|
|
538
|
+
manualRef: noop
|
|
539
|
+
};
|
|
540
|
+
var connected = libExports.connect(function (_ref, _ref2) {
|
|
541
|
+
var activeKey = _ref.activeKey,
|
|
542
|
+
selectedKeys = _ref.selectedKeys;
|
|
543
|
+
var eventKey = _ref2.eventKey,
|
|
544
|
+
subMenuKey = _ref2.subMenuKey;
|
|
545
|
+
return {
|
|
546
|
+
active: activeKey[subMenuKey] === eventKey,
|
|
547
|
+
isSelected: selectedKeys.indexOf(eventKey) !== -1
|
|
548
|
+
};
|
|
549
|
+
})(MenuItem);
|
|
550
|
+
|
|
551
|
+
function _typeof(obj) { 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); }
|
|
552
|
+
|
|
553
|
+
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); }
|
|
554
|
+
|
|
555
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
556
|
+
|
|
557
|
+
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); } }
|
|
558
|
+
|
|
559
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
|
|
560
|
+
|
|
561
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
562
|
+
|
|
563
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
564
|
+
|
|
565
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
566
|
+
|
|
567
|
+
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); }
|
|
568
|
+
|
|
569
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
570
|
+
|
|
571
|
+
var MenuItemGroup =
|
|
572
|
+
/*#__PURE__*/
|
|
573
|
+
function (_React$Component) {
|
|
574
|
+
_inherits(MenuItemGroup, _React$Component);
|
|
575
|
+
|
|
576
|
+
function MenuItemGroup() {
|
|
577
|
+
var _this;
|
|
578
|
+
|
|
579
|
+
_classCallCheck(this, MenuItemGroup);
|
|
580
|
+
|
|
581
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(MenuItemGroup).apply(this, arguments));
|
|
582
|
+
|
|
583
|
+
_this.renderInnerMenuItem = function (item) {
|
|
584
|
+
var _this$props = _this.props,
|
|
585
|
+
renderMenuItem = _this$props.renderMenuItem,
|
|
586
|
+
index = _this$props.index;
|
|
587
|
+
return renderMenuItem(item, index, _this.props.subMenuKey);
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
return _this;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
_createClass(MenuItemGroup, [{
|
|
594
|
+
key: "render",
|
|
595
|
+
value: function render() {
|
|
596
|
+
var props = _extends({}, this.props);
|
|
597
|
+
|
|
598
|
+
var _props$className = props.className,
|
|
599
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
600
|
+
rootPrefixCls = props.rootPrefixCls;
|
|
601
|
+
var titleClassName = "".concat(rootPrefixCls, "-item-group-title");
|
|
602
|
+
var listClassName = "".concat(rootPrefixCls, "-item-group-list");
|
|
603
|
+
var title = props.title,
|
|
604
|
+
children = props.children;
|
|
605
|
+
menuAllProps.forEach(function (key) {
|
|
606
|
+
return delete props[key];
|
|
607
|
+
}); // Set onClick to null, to ignore propagated onClick event
|
|
608
|
+
|
|
609
|
+
delete props.onClick;
|
|
610
|
+
return React.createElement("li", Object.assign({}, props, {
|
|
611
|
+
className: "".concat(className, " ").concat(rootPrefixCls, "-item-group")
|
|
612
|
+
}), React.createElement("div", {
|
|
613
|
+
className: titleClassName,
|
|
614
|
+
title: typeof title === 'string' ? title : undefined
|
|
615
|
+
}, title), React.createElement("ul", {
|
|
616
|
+
className: listClassName
|
|
617
|
+
}, React.Children.map(children, this.renderInnerMenuItem)));
|
|
618
|
+
}
|
|
619
|
+
}]);
|
|
620
|
+
|
|
621
|
+
return MenuItemGroup;
|
|
622
|
+
}(React.Component);
|
|
623
|
+
|
|
624
|
+
MenuItemGroup.isMenuItemGroup = true;
|
|
625
|
+
MenuItemGroup.defaultProps = {
|
|
626
|
+
disabled: true
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
var Divider = function Divider(_ref) {
|
|
630
|
+
var className = _ref.className,
|
|
631
|
+
rootPrefixCls = _ref.rootPrefixCls,
|
|
632
|
+
style = _ref.style;
|
|
633
|
+
return React.createElement("li", {
|
|
634
|
+
className: "".concat(className, " ").concat(rootPrefixCls, "-item-divider"),
|
|
635
|
+
style: style
|
|
636
|
+
});
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
Divider.defaultProps = {
|
|
640
|
+
// To fix keyboard UX.
|
|
641
|
+
disabled: true,
|
|
642
|
+
className: '',
|
|
643
|
+
style: {}
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
export { Divider as D, MenuItemGroup as M, Menu as a, connected as c };
|