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/dropdown.js
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { cloneElement, Component } from 'react';
|
|
3
|
+
import { c as classNames, P as PropTypes, C as ConfigConsumer } from './config-provider.js';
|
|
4
|
+
import ReactDOM__default from 'react-dom';
|
|
5
|
+
import { b as Trigger, p as polyfill } from './menu.js';
|
|
6
|
+
import { I as Icon } from './icon.js';
|
|
7
|
+
import { t as tuple } from './input.js';
|
|
8
|
+
|
|
9
|
+
var autoAdjustOverflow = {
|
|
10
|
+
adjustX: 1,
|
|
11
|
+
adjustY: 1
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var targetOffset = [0, 0];
|
|
15
|
+
|
|
16
|
+
var placements = {
|
|
17
|
+
topLeft: {
|
|
18
|
+
points: ['bl', 'tl'],
|
|
19
|
+
overflow: autoAdjustOverflow,
|
|
20
|
+
offset: [0, -4],
|
|
21
|
+
targetOffset: targetOffset
|
|
22
|
+
},
|
|
23
|
+
topCenter: {
|
|
24
|
+
points: ['bc', 'tc'],
|
|
25
|
+
overflow: autoAdjustOverflow,
|
|
26
|
+
offset: [0, -4],
|
|
27
|
+
targetOffset: targetOffset
|
|
28
|
+
},
|
|
29
|
+
topRight: {
|
|
30
|
+
points: ['br', 'tr'],
|
|
31
|
+
overflow: autoAdjustOverflow,
|
|
32
|
+
offset: [0, -4],
|
|
33
|
+
targetOffset: targetOffset
|
|
34
|
+
},
|
|
35
|
+
bottomLeft: {
|
|
36
|
+
points: ['tl', 'bl'],
|
|
37
|
+
overflow: autoAdjustOverflow,
|
|
38
|
+
offset: [0, 4],
|
|
39
|
+
targetOffset: targetOffset
|
|
40
|
+
},
|
|
41
|
+
bottomCenter: {
|
|
42
|
+
points: ['tc', 'bc'],
|
|
43
|
+
overflow: autoAdjustOverflow,
|
|
44
|
+
offset: [0, 4],
|
|
45
|
+
targetOffset: targetOffset
|
|
46
|
+
},
|
|
47
|
+
bottomRight: {
|
|
48
|
+
points: ['tr', 'br'],
|
|
49
|
+
overflow: autoAdjustOverflow,
|
|
50
|
+
offset: [0, 4],
|
|
51
|
+
targetOffset: targetOffset
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var _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; };
|
|
56
|
+
|
|
57
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
58
|
+
|
|
59
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
60
|
+
|
|
61
|
+
function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
62
|
+
|
|
63
|
+
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
64
|
+
|
|
65
|
+
var Dropdown$1 = function (_Component) {
|
|
66
|
+
_inherits$1(Dropdown, _Component);
|
|
67
|
+
|
|
68
|
+
function Dropdown(props) {
|
|
69
|
+
_classCallCheck$1(this, Dropdown);
|
|
70
|
+
|
|
71
|
+
var _this = _possibleConstructorReturn$1(this, _Component.call(this, props));
|
|
72
|
+
|
|
73
|
+
_initialiseProps.call(_this);
|
|
74
|
+
|
|
75
|
+
if ('visible' in props) {
|
|
76
|
+
_this.state = {
|
|
77
|
+
visible: props.visible
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
_this.state = {
|
|
81
|
+
visible: props.defaultVisible
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
Dropdown.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps) {
|
|
88
|
+
if ('visible' in nextProps) {
|
|
89
|
+
return {
|
|
90
|
+
visible: nextProps.visible
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Dropdown.prototype.getOverlayElement = function getOverlayElement() {
|
|
97
|
+
var overlay = this.props.overlay;
|
|
98
|
+
|
|
99
|
+
var overlayElement = void 0;
|
|
100
|
+
if (typeof overlay === 'function') {
|
|
101
|
+
overlayElement = overlay();
|
|
102
|
+
} else {
|
|
103
|
+
overlayElement = overlay;
|
|
104
|
+
}
|
|
105
|
+
return overlayElement;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
Dropdown.prototype.getMenuElementOrLambda = function getMenuElementOrLambda() {
|
|
109
|
+
var overlay = this.props.overlay;
|
|
110
|
+
|
|
111
|
+
if (typeof overlay === 'function') {
|
|
112
|
+
return this.getMenuElement;
|
|
113
|
+
}
|
|
114
|
+
return this.getMenuElement();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
Dropdown.prototype.getPopupDomNode = function getPopupDomNode() {
|
|
118
|
+
return this.trigger.getPopupDomNode();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
Dropdown.prototype.getOpenClassName = function getOpenClassName() {
|
|
122
|
+
var _props = this.props,
|
|
123
|
+
openClassName = _props.openClassName,
|
|
124
|
+
prefixCls = _props.prefixCls;
|
|
125
|
+
|
|
126
|
+
if (openClassName !== undefined) {
|
|
127
|
+
return openClassName;
|
|
128
|
+
}
|
|
129
|
+
return prefixCls + '-open';
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
Dropdown.prototype.renderChildren = function renderChildren() {
|
|
133
|
+
var children = this.props.children;
|
|
134
|
+
var visible = this.state.visible;
|
|
135
|
+
|
|
136
|
+
var childrenProps = children.props ? children.props : {};
|
|
137
|
+
var childClassName = classNames(childrenProps.className, this.getOpenClassName());
|
|
138
|
+
return visible && children ? cloneElement(children, { className: childClassName }) : children;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
Dropdown.prototype.render = function render() {
|
|
142
|
+
var _props2 = this.props,
|
|
143
|
+
prefixCls = _props2.prefixCls,
|
|
144
|
+
transitionName = _props2.transitionName,
|
|
145
|
+
animation = _props2.animation,
|
|
146
|
+
align = _props2.align,
|
|
147
|
+
placement = _props2.placement,
|
|
148
|
+
getPopupContainer = _props2.getPopupContainer,
|
|
149
|
+
showAction = _props2.showAction,
|
|
150
|
+
hideAction = _props2.hideAction,
|
|
151
|
+
overlayClassName = _props2.overlayClassName,
|
|
152
|
+
overlayStyle = _props2.overlayStyle,
|
|
153
|
+
trigger = _props2.trigger,
|
|
154
|
+
otherProps = _objectWithoutProperties(_props2, ['prefixCls', 'transitionName', 'animation', 'align', 'placement', 'getPopupContainer', 'showAction', 'hideAction', 'overlayClassName', 'overlayStyle', 'trigger']);
|
|
155
|
+
|
|
156
|
+
var triggerHideAction = hideAction;
|
|
157
|
+
if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) {
|
|
158
|
+
triggerHideAction = ['click'];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return React__default.createElement(
|
|
162
|
+
Trigger,
|
|
163
|
+
_extends$1({}, otherProps, {
|
|
164
|
+
prefixCls: prefixCls,
|
|
165
|
+
ref: this.saveTrigger,
|
|
166
|
+
popupClassName: overlayClassName,
|
|
167
|
+
popupStyle: overlayStyle,
|
|
168
|
+
builtinPlacements: placements,
|
|
169
|
+
action: trigger,
|
|
170
|
+
showAction: showAction,
|
|
171
|
+
hideAction: triggerHideAction || [],
|
|
172
|
+
popupPlacement: placement,
|
|
173
|
+
popupAlign: align,
|
|
174
|
+
popupTransitionName: transitionName,
|
|
175
|
+
popupAnimation: animation,
|
|
176
|
+
popupVisible: this.state.visible,
|
|
177
|
+
afterPopupVisibleChange: this.afterVisibleChange,
|
|
178
|
+
popup: this.getMenuElementOrLambda(),
|
|
179
|
+
onPopupVisibleChange: this.onVisibleChange,
|
|
180
|
+
getPopupContainer: getPopupContainer
|
|
181
|
+
}),
|
|
182
|
+
this.renderChildren()
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return Dropdown;
|
|
187
|
+
}(Component);
|
|
188
|
+
|
|
189
|
+
Dropdown$1.propTypes = {
|
|
190
|
+
minOverlayWidthMatchTrigger: PropTypes.bool,
|
|
191
|
+
onVisibleChange: PropTypes.func,
|
|
192
|
+
onOverlayClick: PropTypes.func,
|
|
193
|
+
prefixCls: PropTypes.string,
|
|
194
|
+
children: PropTypes.any,
|
|
195
|
+
transitionName: PropTypes.string,
|
|
196
|
+
overlayClassName: PropTypes.string,
|
|
197
|
+
openClassName: PropTypes.string,
|
|
198
|
+
animation: PropTypes.any,
|
|
199
|
+
align: PropTypes.object,
|
|
200
|
+
overlayStyle: PropTypes.object,
|
|
201
|
+
placement: PropTypes.string,
|
|
202
|
+
overlay: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
203
|
+
trigger: PropTypes.array,
|
|
204
|
+
alignPoint: PropTypes.bool,
|
|
205
|
+
showAction: PropTypes.array,
|
|
206
|
+
hideAction: PropTypes.array,
|
|
207
|
+
getPopupContainer: PropTypes.func,
|
|
208
|
+
visible: PropTypes.bool,
|
|
209
|
+
defaultVisible: PropTypes.bool
|
|
210
|
+
};
|
|
211
|
+
Dropdown$1.defaultProps = {
|
|
212
|
+
prefixCls: 'rc-dropdown',
|
|
213
|
+
trigger: ['hover'],
|
|
214
|
+
showAction: [],
|
|
215
|
+
overlayClassName: '',
|
|
216
|
+
overlayStyle: {},
|
|
217
|
+
defaultVisible: false,
|
|
218
|
+
onVisibleChange: function onVisibleChange() {},
|
|
219
|
+
|
|
220
|
+
placement: 'bottomLeft'
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var _initialiseProps = function _initialiseProps() {
|
|
224
|
+
var _this2 = this;
|
|
225
|
+
|
|
226
|
+
this.onClick = function (e) {
|
|
227
|
+
var props = _this2.props;
|
|
228
|
+
var overlayProps = _this2.getOverlayElement().props;
|
|
229
|
+
// do no call onVisibleChange, if you need click to hide, use onClick and control visible
|
|
230
|
+
if (!('visible' in props)) {
|
|
231
|
+
_this2.setState({
|
|
232
|
+
visible: false
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (props.onOverlayClick) {
|
|
236
|
+
props.onOverlayClick(e);
|
|
237
|
+
}
|
|
238
|
+
if (overlayProps.onClick) {
|
|
239
|
+
overlayProps.onClick(e);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
this.onVisibleChange = function (visible) {
|
|
244
|
+
var props = _this2.props;
|
|
245
|
+
if (!('visible' in props)) {
|
|
246
|
+
_this2.setState({
|
|
247
|
+
visible: visible
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
props.onVisibleChange(visible);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
this.getMinOverlayWidthMatchTrigger = function () {
|
|
254
|
+
var _props3 = _this2.props,
|
|
255
|
+
minOverlayWidthMatchTrigger = _props3.minOverlayWidthMatchTrigger,
|
|
256
|
+
alignPoint = _props3.alignPoint;
|
|
257
|
+
|
|
258
|
+
if ('minOverlayWidthMatchTrigger' in _this2.props) {
|
|
259
|
+
return minOverlayWidthMatchTrigger;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return !alignPoint;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
this.getMenuElement = function () {
|
|
266
|
+
var prefixCls = _this2.props.prefixCls;
|
|
267
|
+
|
|
268
|
+
var overlayElement = _this2.getOverlayElement();
|
|
269
|
+
var extraOverlayProps = {
|
|
270
|
+
prefixCls: prefixCls + '-menu',
|
|
271
|
+
onClick: _this2.onClick
|
|
272
|
+
};
|
|
273
|
+
if (typeof overlayElement.type === 'string') {
|
|
274
|
+
delete extraOverlayProps.prefixCls;
|
|
275
|
+
}
|
|
276
|
+
return React__default.cloneElement(overlayElement, extraOverlayProps);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
this.afterVisibleChange = function (visible) {
|
|
280
|
+
if (visible && _this2.getMinOverlayWidthMatchTrigger()) {
|
|
281
|
+
var overlayNode = _this2.getPopupDomNode();
|
|
282
|
+
var rootNode = ReactDOM__default.findDOMNode(_this2);
|
|
283
|
+
if (rootNode && overlayNode && rootNode.offsetWidth > overlayNode.offsetWidth) {
|
|
284
|
+
overlayNode.style.minWidth = rootNode.offsetWidth + 'px';
|
|
285
|
+
if (_this2.trigger && _this2.trigger._component && _this2.trigger._component.alignInstance) {
|
|
286
|
+
_this2.trigger._component.alignInstance.forceAlign();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
this.saveTrigger = function (node) {
|
|
293
|
+
_this2.trigger = node;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
polyfill(Dropdown$1);
|
|
298
|
+
|
|
299
|
+
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); }
|
|
300
|
+
|
|
301
|
+
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); }
|
|
302
|
+
|
|
303
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
304
|
+
|
|
305
|
+
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); } }
|
|
306
|
+
|
|
307
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
|
|
308
|
+
|
|
309
|
+
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); }
|
|
310
|
+
|
|
311
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
312
|
+
|
|
313
|
+
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); }; }
|
|
314
|
+
|
|
315
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
316
|
+
|
|
317
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
318
|
+
|
|
319
|
+
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; } }
|
|
320
|
+
|
|
321
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
322
|
+
tuple('topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight');
|
|
323
|
+
|
|
324
|
+
var Dropdown = /*#__PURE__*/function (_React$Component) {
|
|
325
|
+
_inherits(Dropdown, _React$Component);
|
|
326
|
+
|
|
327
|
+
var _super = _createSuper(Dropdown);
|
|
328
|
+
|
|
329
|
+
function Dropdown() {
|
|
330
|
+
var _this;
|
|
331
|
+
|
|
332
|
+
_classCallCheck(this, Dropdown);
|
|
333
|
+
|
|
334
|
+
_this = _super.apply(this, arguments);
|
|
335
|
+
|
|
336
|
+
_this.renderOverlay = function (prefixCls) {
|
|
337
|
+
// rc-dropdown already can process the function of overlay, but we have check logic here.
|
|
338
|
+
// So we need render the element to check and pass back to rc-dropdown.
|
|
339
|
+
var overlay = _this.props.overlay;
|
|
340
|
+
var overlayNode;
|
|
341
|
+
|
|
342
|
+
if (typeof overlay === 'function') {
|
|
343
|
+
overlayNode = overlay();
|
|
344
|
+
} else {
|
|
345
|
+
overlayNode = overlay;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
overlayNode = React.Children.only(overlayNode);
|
|
349
|
+
var overlayProps = overlayNode.props; // Warning if use other mode
|
|
350
|
+
// menu should be focusable in dropdown defaultly
|
|
351
|
+
|
|
352
|
+
var _overlayProps$selecta = overlayProps.selectable,
|
|
353
|
+
selectable = _overlayProps$selecta === void 0 ? false : _overlayProps$selecta,
|
|
354
|
+
_overlayProps$focusab = overlayProps.focusable,
|
|
355
|
+
focusable = _overlayProps$focusab === void 0 ? true : _overlayProps$focusab;
|
|
356
|
+
var expandIcon = /*#__PURE__*/React.createElement("span", {
|
|
357
|
+
className: "".concat(prefixCls, "-menu-submenu-arrow")
|
|
358
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
359
|
+
type: "right",
|
|
360
|
+
className: "".concat(prefixCls, "-menu-submenu-arrow-icon")
|
|
361
|
+
}));
|
|
362
|
+
var fixedModeOverlay = typeof overlayNode.type === 'string' ? overlay : /*#__PURE__*/React.cloneElement(overlayNode, {
|
|
363
|
+
mode: 'vertical',
|
|
364
|
+
selectable: selectable,
|
|
365
|
+
focusable: focusable,
|
|
366
|
+
expandIcon: expandIcon
|
|
367
|
+
});
|
|
368
|
+
return fixedModeOverlay;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
_this.renderDropDown = function (_ref) {
|
|
372
|
+
var getContextPopupContainer = _ref.getPopupContainer,
|
|
373
|
+
getPrefixCls = _ref.getPrefixCls;
|
|
374
|
+
var _this$props = _this.props,
|
|
375
|
+
customizePrefixCls = _this$props.prefixCls,
|
|
376
|
+
children = _this$props.children,
|
|
377
|
+
trigger = _this$props.trigger,
|
|
378
|
+
disabled = _this$props.disabled,
|
|
379
|
+
getPopupContainer = _this$props.getPopupContainer;
|
|
380
|
+
var prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
|
381
|
+
var child = React.Children.only(children);
|
|
382
|
+
var dropdownTrigger = /*#__PURE__*/React.cloneElement(child, {
|
|
383
|
+
className: classNames(child.props.className, "".concat(prefixCls, "-trigger")),
|
|
384
|
+
disabled: disabled
|
|
385
|
+
});
|
|
386
|
+
var triggerActions = disabled ? [] : trigger;
|
|
387
|
+
var alignPoint;
|
|
388
|
+
|
|
389
|
+
if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) {
|
|
390
|
+
alignPoint = true;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return /*#__PURE__*/React.createElement(Dropdown$1, _extends({
|
|
394
|
+
alignPoint: alignPoint
|
|
395
|
+
}, _this.props, {
|
|
396
|
+
prefixCls: prefixCls,
|
|
397
|
+
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
|
398
|
+
transitionName: _this.getTransitionName(),
|
|
399
|
+
trigger: triggerActions,
|
|
400
|
+
overlay: function overlay() {
|
|
401
|
+
return _this.renderOverlay(prefixCls);
|
|
402
|
+
}
|
|
403
|
+
}), dropdownTrigger);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
return _this;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
_createClass(Dropdown, [{
|
|
410
|
+
key: "getTransitionName",
|
|
411
|
+
value: function getTransitionName() {
|
|
412
|
+
var _this$props2 = this.props,
|
|
413
|
+
_this$props2$placemen = _this$props2.placement,
|
|
414
|
+
placement = _this$props2$placemen === void 0 ? '' : _this$props2$placemen,
|
|
415
|
+
transitionName = _this$props2.transitionName;
|
|
416
|
+
|
|
417
|
+
if (transitionName !== undefined) {
|
|
418
|
+
return transitionName;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (placement.indexOf('top') >= 0) {
|
|
422
|
+
return 'slide-down';
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return 'slide-up';
|
|
426
|
+
}
|
|
427
|
+
}, {
|
|
428
|
+
key: "render",
|
|
429
|
+
value: function render() {
|
|
430
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderDropDown);
|
|
431
|
+
}
|
|
432
|
+
}]);
|
|
433
|
+
|
|
434
|
+
return Dropdown;
|
|
435
|
+
}(React.Component);
|
|
436
|
+
Dropdown.defaultProps = {
|
|
437
|
+
mouseEnterDelay: 0.15,
|
|
438
|
+
mouseLeaveDelay: 0.1,
|
|
439
|
+
placement: 'bottomLeft'
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export { Dropdown as D };
|