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/index7.js
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { c as classNames, C as ConfigConsumer, p as propTypesExports } from './config-provider.js';
|
|
3
|
+
import { p as polyfill } from './menu.js';
|
|
4
|
+
import { o as omit, t as tuple } from './input.js';
|
|
5
|
+
import { I as Icon } from './icon.js';
|
|
6
|
+
import { W as Wave } from './wave.js';
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
|
|
14
|
+
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); } }
|
|
15
|
+
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
|
|
22
|
+
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); }; }
|
|
23
|
+
|
|
24
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
25
|
+
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
|
|
28
|
+
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; } }
|
|
29
|
+
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
35
|
+
var t = {};
|
|
36
|
+
|
|
37
|
+
for (var p in s) {
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
var rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
|
|
47
|
+
var isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
|
|
48
|
+
|
|
49
|
+
function isString(str) {
|
|
50
|
+
return typeof str === 'string';
|
|
51
|
+
} // Insert one space between two chinese characters automatically.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
function insertSpace(child, needInserted) {
|
|
55
|
+
// Check the child if is undefined or null.
|
|
56
|
+
if (child == null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var SPACE = needInserted ? ' ' : ''; // strictNullChecks oops.
|
|
61
|
+
|
|
62
|
+
if (typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && isTwoCNChar(child.props.children)) {
|
|
63
|
+
return /*#__PURE__*/React.cloneElement(child, {}, child.props.children.split('').join(SPACE));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (typeof child === 'string') {
|
|
67
|
+
if (isTwoCNChar(child)) {
|
|
68
|
+
child = child.split('').join(SPACE);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/React.createElement("span", null, child);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return child;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function spaceChildren(children, needInserted) {
|
|
78
|
+
var isPrevChildPure = false;
|
|
79
|
+
var childList = [];
|
|
80
|
+
React.Children.forEach(children, function (child) {
|
|
81
|
+
var type = _typeof(child);
|
|
82
|
+
|
|
83
|
+
var isCurrentChildPure = type === 'string' || type === 'number';
|
|
84
|
+
|
|
85
|
+
if (isPrevChildPure && isCurrentChildPure) {
|
|
86
|
+
var lastIndex = childList.length - 1;
|
|
87
|
+
var lastChild = childList[lastIndex];
|
|
88
|
+
childList[lastIndex] = "".concat(lastChild).concat(child);
|
|
89
|
+
} else {
|
|
90
|
+
childList.push(child);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
isPrevChildPure = isCurrentChildPure;
|
|
94
|
+
}); // Pass to React.Children.map to auto fill key
|
|
95
|
+
|
|
96
|
+
return React.Children.map(childList, function (child) {
|
|
97
|
+
return insertSpace(child, needInserted);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
tuple('default', 'primary', 'ghost', 'dashed', 'danger', 'link');
|
|
102
|
+
var ButtonShapes = tuple('circle', 'circle-outline', 'round');
|
|
103
|
+
var ButtonSizes = tuple('large', 'default', 'small');
|
|
104
|
+
var ButtonHTMLTypes = tuple('submit', 'button', 'reset');
|
|
105
|
+
|
|
106
|
+
var Button = /*#__PURE__*/function (_React$Component) {
|
|
107
|
+
_inherits(Button, _React$Component);
|
|
108
|
+
|
|
109
|
+
var _super = _createSuper(Button);
|
|
110
|
+
|
|
111
|
+
function Button(props) {
|
|
112
|
+
var _this;
|
|
113
|
+
|
|
114
|
+
_classCallCheck(this, Button);
|
|
115
|
+
|
|
116
|
+
_this = _super.call(this, props);
|
|
117
|
+
|
|
118
|
+
_this.saveButtonRef = function (node) {
|
|
119
|
+
_this.buttonNode = node;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
_this.handleClick = function (e) {
|
|
123
|
+
var loading = _this.state.loading;
|
|
124
|
+
var onClick = _this.props.onClick;
|
|
125
|
+
|
|
126
|
+
if (loading) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (onClick) {
|
|
131
|
+
onClick(e);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
_this.renderButton = function (_ref) {
|
|
136
|
+
var _classNames;
|
|
137
|
+
|
|
138
|
+
var getPrefixCls = _ref.getPrefixCls,
|
|
139
|
+
autoInsertSpaceInButton = _ref.autoInsertSpaceInButton;
|
|
140
|
+
|
|
141
|
+
var _a = _this.props,
|
|
142
|
+
customizePrefixCls = _a.prefixCls,
|
|
143
|
+
type = _a.type,
|
|
144
|
+
shape = _a.shape,
|
|
145
|
+
size = _a.size,
|
|
146
|
+
className = _a.className,
|
|
147
|
+
children = _a.children,
|
|
148
|
+
icon = _a.icon,
|
|
149
|
+
ghost = _a.ghost,
|
|
150
|
+
block = _a.block,
|
|
151
|
+
rest = __rest$1(_a, ["prefixCls", "type", "shape", "size", "className", "children", "icon", "ghost", "block"]);
|
|
152
|
+
|
|
153
|
+
var _this$state = _this.state,
|
|
154
|
+
loading = _this$state.loading,
|
|
155
|
+
hasTwoCNChar = _this$state.hasTwoCNChar;
|
|
156
|
+
var prefixCls = getPrefixCls('btn', customizePrefixCls);
|
|
157
|
+
var autoInsertSpace = autoInsertSpaceInButton !== false; // large => lg
|
|
158
|
+
// small => sm
|
|
159
|
+
|
|
160
|
+
var sizeCls = '';
|
|
161
|
+
|
|
162
|
+
switch (size) {
|
|
163
|
+
case 'large':
|
|
164
|
+
sizeCls = 'lg';
|
|
165
|
+
break;
|
|
166
|
+
|
|
167
|
+
case 'small':
|
|
168
|
+
sizeCls = 'sm';
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
var iconType = loading ? 'loading' : icon;
|
|
173
|
+
var classes = classNames(prefixCls, className, (_classNames = {}, _defineProperty$1(_classNames, "".concat(prefixCls, "-").concat(type), type), _defineProperty$1(_classNames, "".concat(prefixCls, "-").concat(shape), shape), _defineProperty$1(_classNames, "".concat(prefixCls, "-").concat(sizeCls), sizeCls), _defineProperty$1(_classNames, "".concat(prefixCls, "-icon-only"), !children && children !== 0 && iconType), _defineProperty$1(_classNames, "".concat(prefixCls, "-loading"), !!loading), _defineProperty$1(_classNames, "".concat(prefixCls, "-background-ghost"), ghost), _defineProperty$1(_classNames, "".concat(prefixCls, "-two-chinese-chars"), hasTwoCNChar && autoInsertSpace), _defineProperty$1(_classNames, "".concat(prefixCls, "-block"), block), _classNames));
|
|
174
|
+
var iconNode = iconType ? /*#__PURE__*/React.createElement(Icon, {
|
|
175
|
+
type: iconType
|
|
176
|
+
}) : null;
|
|
177
|
+
var kids = children || children === 0 ? spaceChildren(children, _this.isNeedInserted() && autoInsertSpace) : null;
|
|
178
|
+
var linkButtonRestProps = omit(rest, ['htmlType', 'loading']);
|
|
179
|
+
|
|
180
|
+
if (linkButtonRestProps.href !== undefined) {
|
|
181
|
+
return /*#__PURE__*/React.createElement("a", _extends$1({}, linkButtonRestProps, {
|
|
182
|
+
className: classes,
|
|
183
|
+
onClick: _this.handleClick,
|
|
184
|
+
ref: _this.saveButtonRef
|
|
185
|
+
}), iconNode, kids);
|
|
186
|
+
} // React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
var _b = rest,
|
|
190
|
+
htmlType = _b.htmlType,
|
|
191
|
+
otherProps = __rest$1(_b, ["htmlType"]);
|
|
192
|
+
|
|
193
|
+
var buttonNode = /*#__PURE__*/React.createElement("button", _extends$1({}, omit(otherProps, ['loading']), {
|
|
194
|
+
type: htmlType,
|
|
195
|
+
className: classes,
|
|
196
|
+
onClick: _this.handleClick,
|
|
197
|
+
ref: _this.saveButtonRef
|
|
198
|
+
}), iconNode, kids);
|
|
199
|
+
|
|
200
|
+
if (type === 'link') {
|
|
201
|
+
return buttonNode;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return /*#__PURE__*/React.createElement(Wave, null, buttonNode);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
_this.state = {
|
|
208
|
+
loading: props.loading,
|
|
209
|
+
hasTwoCNChar: false
|
|
210
|
+
};
|
|
211
|
+
return _this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_createClass(Button, [{
|
|
215
|
+
key: "componentDidMount",
|
|
216
|
+
value: function componentDidMount() {
|
|
217
|
+
this.fixTwoCNChar();
|
|
218
|
+
}
|
|
219
|
+
}, {
|
|
220
|
+
key: "componentDidUpdate",
|
|
221
|
+
value: function componentDidUpdate(prevProps) {
|
|
222
|
+
var _this2 = this;
|
|
223
|
+
|
|
224
|
+
this.fixTwoCNChar();
|
|
225
|
+
|
|
226
|
+
if (prevProps.loading && typeof prevProps.loading !== 'boolean') {
|
|
227
|
+
clearTimeout(this.delayTimeout);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
var loading = this.props.loading;
|
|
231
|
+
|
|
232
|
+
if (loading && typeof loading !== 'boolean' && loading.delay) {
|
|
233
|
+
this.delayTimeout = window.setTimeout(function () {
|
|
234
|
+
_this2.setState({
|
|
235
|
+
loading: loading
|
|
236
|
+
});
|
|
237
|
+
}, loading.delay);
|
|
238
|
+
} else if (prevProps.loading !== loading) {
|
|
239
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
240
|
+
this.setState({
|
|
241
|
+
loading: loading
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, {
|
|
246
|
+
key: "componentWillUnmount",
|
|
247
|
+
value: function componentWillUnmount() {
|
|
248
|
+
if (this.delayTimeout) {
|
|
249
|
+
clearTimeout(this.delayTimeout);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}, {
|
|
253
|
+
key: "fixTwoCNChar",
|
|
254
|
+
value: function fixTwoCNChar() {
|
|
255
|
+
// Fix for HOC usage like <FormatMessage />
|
|
256
|
+
if (!this.buttonNode) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
var buttonText = this.buttonNode.textContent;
|
|
261
|
+
|
|
262
|
+
if (this.isNeedInserted() && isTwoCNChar(buttonText)) {
|
|
263
|
+
if (!this.state.hasTwoCNChar) {
|
|
264
|
+
this.setState({
|
|
265
|
+
hasTwoCNChar: true
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
} else if (this.state.hasTwoCNChar) {
|
|
269
|
+
this.setState({
|
|
270
|
+
hasTwoCNChar: false
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
key: "isNeedInserted",
|
|
276
|
+
value: function isNeedInserted() {
|
|
277
|
+
var _this$props = this.props,
|
|
278
|
+
icon = _this$props.icon,
|
|
279
|
+
children = _this$props.children,
|
|
280
|
+
type = _this$props.type;
|
|
281
|
+
return React.Children.count(children) === 1 && !icon && type !== 'link';
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
key: "render",
|
|
285
|
+
value: function render() {
|
|
286
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderButton);
|
|
287
|
+
}
|
|
288
|
+
}]);
|
|
289
|
+
|
|
290
|
+
return Button;
|
|
291
|
+
}(React.Component);
|
|
292
|
+
|
|
293
|
+
Button.__ANT_BUTTON = true;
|
|
294
|
+
Button.defaultProps = {
|
|
295
|
+
loading: false,
|
|
296
|
+
ghost: false,
|
|
297
|
+
block: false,
|
|
298
|
+
htmlType: 'button'
|
|
299
|
+
};
|
|
300
|
+
Button.propTypes = {
|
|
301
|
+
type: propTypesExports.string,
|
|
302
|
+
shape: propTypesExports.oneOf(ButtonShapes),
|
|
303
|
+
size: propTypesExports.oneOf(ButtonSizes),
|
|
304
|
+
htmlType: propTypesExports.oneOf(ButtonHTMLTypes),
|
|
305
|
+
onClick: propTypesExports.func,
|
|
306
|
+
loading: propTypesExports.oneOfType([propTypesExports.bool, propTypesExports.object]),
|
|
307
|
+
className: propTypesExports.string,
|
|
308
|
+
icon: propTypesExports.string,
|
|
309
|
+
block: propTypesExports.bool,
|
|
310
|
+
title: propTypesExports.string
|
|
311
|
+
};
|
|
312
|
+
polyfill(Button);
|
|
313
|
+
|
|
314
|
+
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); }
|
|
315
|
+
|
|
316
|
+
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; }
|
|
317
|
+
|
|
318
|
+
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
319
|
+
var t = {};
|
|
320
|
+
|
|
321
|
+
for (var p in s) {
|
|
322
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
326
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
327
|
+
}
|
|
328
|
+
return t;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
var ButtonGroup = function ButtonGroup(props) {
|
|
332
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref) {
|
|
333
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
334
|
+
|
|
335
|
+
var customizePrefixCls = props.prefixCls,
|
|
336
|
+
size = props.size,
|
|
337
|
+
className = props.className,
|
|
338
|
+
others = __rest(props, ["prefixCls", "size", "className"]);
|
|
339
|
+
|
|
340
|
+
var prefixCls = getPrefixCls('btn-group', customizePrefixCls); // large => lg
|
|
341
|
+
// small => sm
|
|
342
|
+
|
|
343
|
+
var sizeCls = '';
|
|
344
|
+
|
|
345
|
+
switch (size) {
|
|
346
|
+
case 'large':
|
|
347
|
+
sizeCls = 'lg';
|
|
348
|
+
break;
|
|
349
|
+
|
|
350
|
+
case 'small':
|
|
351
|
+
sizeCls = 'sm';
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
var classes = classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-").concat(sizeCls), sizeCls), className);
|
|
356
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, others, {
|
|
357
|
+
className: classes
|
|
358
|
+
}));
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
Button.Group = ButtonGroup;
|
|
363
|
+
|
|
364
|
+
export { Button as B };
|