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/index13.js
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { c as classNames, C as ConfigConsumer, p as propTypesExports } from './config-provider.js';
|
|
3
|
+
import { C as Checkbox } from './Checkbox.js';
|
|
4
|
+
import { s as shallowEqual, p as polyfill } from './menu.js';
|
|
5
|
+
|
|
6
|
+
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); }
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
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); }
|
|
11
|
+
|
|
12
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
|
|
14
|
+
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); } }
|
|
15
|
+
|
|
16
|
+
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
|
|
21
|
+
|
|
22
|
+
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); }; }
|
|
23
|
+
|
|
24
|
+
function _possibleConstructorReturn$2(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
|
|
25
|
+
|
|
26
|
+
function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
|
|
28
|
+
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; } }
|
|
29
|
+
|
|
30
|
+
function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
|
|
31
|
+
|
|
32
|
+
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
|
|
35
|
+
for (var p in s) {
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
41
|
+
}
|
|
42
|
+
return t;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var Radio = /*#__PURE__*/function (_React$Component) {
|
|
46
|
+
_inherits$2(Radio, _React$Component);
|
|
47
|
+
|
|
48
|
+
var _super = _createSuper$2(Radio);
|
|
49
|
+
|
|
50
|
+
function Radio() {
|
|
51
|
+
var _this;
|
|
52
|
+
|
|
53
|
+
_classCallCheck$2(this, Radio);
|
|
54
|
+
|
|
55
|
+
_this = _super.apply(this, arguments);
|
|
56
|
+
|
|
57
|
+
_this.saveCheckbox = function (node) {
|
|
58
|
+
_this.rcCheckbox = node;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
_this.onChange = function (e) {
|
|
62
|
+
if (_this.props.onChange) {
|
|
63
|
+
_this.props.onChange(e);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (_this.context.radioGroup && _this.context.radioGroup.onChange) {
|
|
67
|
+
_this.context.radioGroup.onChange(e);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_this.renderRadio = function (_ref) {
|
|
72
|
+
var _classNames;
|
|
73
|
+
|
|
74
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
75
|
+
|
|
76
|
+
var _assertThisInitialize = _assertThisInitialized$2(_this),
|
|
77
|
+
props = _assertThisInitialize.props,
|
|
78
|
+
context = _assertThisInitialize.context;
|
|
79
|
+
|
|
80
|
+
var customizePrefixCls = props.prefixCls,
|
|
81
|
+
className = props.className,
|
|
82
|
+
children = props.children,
|
|
83
|
+
style = props.style,
|
|
84
|
+
restProps = __rest$1(props, ["prefixCls", "className", "children", "style"]);
|
|
85
|
+
|
|
86
|
+
var radioGroup = context.radioGroup;
|
|
87
|
+
var prefixCls = getPrefixCls('radio', customizePrefixCls);
|
|
88
|
+
|
|
89
|
+
var radioProps = _extends$1({}, restProps);
|
|
90
|
+
|
|
91
|
+
if (radioGroup) {
|
|
92
|
+
radioProps.name = radioGroup.name;
|
|
93
|
+
radioProps.onChange = _this.onChange;
|
|
94
|
+
radioProps.checked = props.value === radioGroup.value;
|
|
95
|
+
radioProps.disabled = props.disabled || radioGroup.disabled;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var wrapperClassString = classNames(className, (_classNames = {}, _defineProperty$1(_classNames, "".concat(prefixCls, "-wrapper"), true), _defineProperty$1(_classNames, "".concat(prefixCls, "-wrapper-checked"), radioProps.checked), _defineProperty$1(_classNames, "".concat(prefixCls, "-wrapper-disabled"), radioProps.disabled), _classNames));
|
|
99
|
+
return (
|
|
100
|
+
/*#__PURE__*/
|
|
101
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
102
|
+
React.createElement("label", {
|
|
103
|
+
className: wrapperClassString,
|
|
104
|
+
style: style,
|
|
105
|
+
onMouseEnter: props.onMouseEnter,
|
|
106
|
+
onMouseLeave: props.onMouseLeave
|
|
107
|
+
}, /*#__PURE__*/React.createElement(Checkbox, _extends$1({}, radioProps, {
|
|
108
|
+
prefixCls: prefixCls,
|
|
109
|
+
ref: _this.saveCheckbox
|
|
110
|
+
})), children !== undefined ? /*#__PURE__*/React.createElement("span", null, children) : null)
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return _this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
_createClass$2(Radio, [{
|
|
118
|
+
key: "shouldComponentUpdate",
|
|
119
|
+
value: function shouldComponentUpdate(nextProps, nextState, nextContext) {
|
|
120
|
+
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) || !shallowEqual(this.context.radioGroup, nextContext.radioGroup);
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "focus",
|
|
124
|
+
value: function focus() {
|
|
125
|
+
this.rcCheckbox.focus();
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "blur",
|
|
129
|
+
value: function blur() {
|
|
130
|
+
this.rcCheckbox.blur();
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "render",
|
|
134
|
+
value: function render() {
|
|
135
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderRadio);
|
|
136
|
+
}
|
|
137
|
+
}]);
|
|
138
|
+
|
|
139
|
+
return Radio;
|
|
140
|
+
}(React.Component);
|
|
141
|
+
Radio.defaultProps = {
|
|
142
|
+
type: 'radio'
|
|
143
|
+
};
|
|
144
|
+
Radio.contextTypes = {
|
|
145
|
+
radioGroup: propTypesExports.any
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
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); }
|
|
149
|
+
|
|
150
|
+
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; }
|
|
151
|
+
|
|
152
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
153
|
+
|
|
154
|
+
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); } }
|
|
155
|
+
|
|
156
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
|
157
|
+
|
|
158
|
+
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); }
|
|
159
|
+
|
|
160
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
161
|
+
|
|
162
|
+
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); }; }
|
|
163
|
+
|
|
164
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
165
|
+
|
|
166
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
167
|
+
|
|
168
|
+
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; } }
|
|
169
|
+
|
|
170
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
171
|
+
|
|
172
|
+
function getCheckedValue(children) {
|
|
173
|
+
var value = null;
|
|
174
|
+
var matched = false;
|
|
175
|
+
React.Children.forEach(children, function (radio) {
|
|
176
|
+
if (radio && radio.props && radio.props.checked) {
|
|
177
|
+
value = radio.props.value;
|
|
178
|
+
matched = true;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return matched ? {
|
|
182
|
+
value: value
|
|
183
|
+
} : undefined;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
var RadioGroup = /*#__PURE__*/function (_React$Component) {
|
|
187
|
+
_inherits$1(RadioGroup, _React$Component);
|
|
188
|
+
|
|
189
|
+
var _super = _createSuper$1(RadioGroup);
|
|
190
|
+
|
|
191
|
+
function RadioGroup(props) {
|
|
192
|
+
var _this;
|
|
193
|
+
|
|
194
|
+
_classCallCheck$1(this, RadioGroup);
|
|
195
|
+
|
|
196
|
+
_this = _super.call(this, props);
|
|
197
|
+
|
|
198
|
+
_this.onRadioChange = function (ev) {
|
|
199
|
+
var lastValue = _this.state.value;
|
|
200
|
+
var value = ev.target.value;
|
|
201
|
+
|
|
202
|
+
if (!('value' in _this.props)) {
|
|
203
|
+
_this.setState({
|
|
204
|
+
value: value
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
var onChange = _this.props.onChange;
|
|
209
|
+
|
|
210
|
+
if (onChange && value !== lastValue) {
|
|
211
|
+
onChange(ev);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
_this.renderGroup = function (_ref) {
|
|
216
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
217
|
+
|
|
218
|
+
var _assertThisInitialize = _assertThisInitialized$1(_this),
|
|
219
|
+
props = _assertThisInitialize.props;
|
|
220
|
+
|
|
221
|
+
var customizePrefixCls = props.prefixCls,
|
|
222
|
+
_props$className = props.className,
|
|
223
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
224
|
+
options = props.options,
|
|
225
|
+
buttonStyle = props.buttonStyle;
|
|
226
|
+
var prefixCls = getPrefixCls('radio', customizePrefixCls);
|
|
227
|
+
var groupPrefixCls = "".concat(prefixCls, "-group");
|
|
228
|
+
var classString = classNames(groupPrefixCls, "".concat(groupPrefixCls, "-").concat(buttonStyle), _defineProperty({}, "".concat(groupPrefixCls, "-").concat(props.size), props.size), className);
|
|
229
|
+
var children = props.children; // 如果存在 options, 优先使用
|
|
230
|
+
|
|
231
|
+
if (options && options.length > 0) {
|
|
232
|
+
children = options.map(function (option) {
|
|
233
|
+
if (typeof option === 'string') {
|
|
234
|
+
// 此处类型自动推导为 string
|
|
235
|
+
return /*#__PURE__*/React.createElement(Radio, {
|
|
236
|
+
key: option,
|
|
237
|
+
prefixCls: prefixCls,
|
|
238
|
+
disabled: _this.props.disabled,
|
|
239
|
+
value: option,
|
|
240
|
+
checked: _this.state.value === option
|
|
241
|
+
}, option);
|
|
242
|
+
} // 此处类型自动推导为 { label: string value: string }
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
return /*#__PURE__*/React.createElement(Radio, {
|
|
246
|
+
key: "radio-group-value-options-".concat(option.value),
|
|
247
|
+
prefixCls: prefixCls,
|
|
248
|
+
disabled: option.disabled || _this.props.disabled,
|
|
249
|
+
value: option.value,
|
|
250
|
+
checked: _this.state.value === option.value
|
|
251
|
+
}, option.label);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
256
|
+
className: classString,
|
|
257
|
+
style: props.style,
|
|
258
|
+
onMouseEnter: props.onMouseEnter,
|
|
259
|
+
onMouseLeave: props.onMouseLeave,
|
|
260
|
+
id: props.id
|
|
261
|
+
}, children);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
var value;
|
|
265
|
+
|
|
266
|
+
if ('value' in props) {
|
|
267
|
+
value = props.value;
|
|
268
|
+
} else if ('defaultValue' in props) {
|
|
269
|
+
value = props.defaultValue;
|
|
270
|
+
} else {
|
|
271
|
+
var checkedValue = getCheckedValue(props.children);
|
|
272
|
+
value = checkedValue && checkedValue.value;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
_this.state = {
|
|
276
|
+
value: value
|
|
277
|
+
};
|
|
278
|
+
return _this;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
_createClass$1(RadioGroup, [{
|
|
282
|
+
key: "getChildContext",
|
|
283
|
+
value: function getChildContext() {
|
|
284
|
+
return {
|
|
285
|
+
radioGroup: {
|
|
286
|
+
onChange: this.onRadioChange,
|
|
287
|
+
value: this.state.value,
|
|
288
|
+
disabled: this.props.disabled,
|
|
289
|
+
name: this.props.name
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "shouldComponentUpdate",
|
|
295
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
296
|
+
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
|
|
297
|
+
}
|
|
298
|
+
}, {
|
|
299
|
+
key: "render",
|
|
300
|
+
value: function render() {
|
|
301
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderGroup);
|
|
302
|
+
}
|
|
303
|
+
}], [{
|
|
304
|
+
key: "getDerivedStateFromProps",
|
|
305
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
306
|
+
if ('value' in nextProps) {
|
|
307
|
+
return {
|
|
308
|
+
value: nextProps.value
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
var checkedValue = getCheckedValue(nextProps.children);
|
|
313
|
+
|
|
314
|
+
if (checkedValue) {
|
|
315
|
+
return {
|
|
316
|
+
value: checkedValue.value
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
}]);
|
|
323
|
+
|
|
324
|
+
return RadioGroup;
|
|
325
|
+
}(React.Component);
|
|
326
|
+
|
|
327
|
+
RadioGroup.defaultProps = {
|
|
328
|
+
buttonStyle: 'outline'
|
|
329
|
+
};
|
|
330
|
+
RadioGroup.childContextTypes = {
|
|
331
|
+
radioGroup: propTypesExports.any
|
|
332
|
+
};
|
|
333
|
+
polyfill(RadioGroup);
|
|
334
|
+
|
|
335
|
+
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); }
|
|
336
|
+
|
|
337
|
+
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); }
|
|
338
|
+
|
|
339
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
340
|
+
|
|
341
|
+
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); } }
|
|
342
|
+
|
|
343
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
|
|
344
|
+
|
|
345
|
+
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); }
|
|
346
|
+
|
|
347
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
348
|
+
|
|
349
|
+
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); }; }
|
|
350
|
+
|
|
351
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
352
|
+
|
|
353
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
354
|
+
|
|
355
|
+
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; } }
|
|
356
|
+
|
|
357
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
358
|
+
|
|
359
|
+
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
360
|
+
var t = {};
|
|
361
|
+
|
|
362
|
+
for (var p in s) {
|
|
363
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
367
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
368
|
+
}
|
|
369
|
+
return t;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
var RadioButton = /*#__PURE__*/function (_React$Component) {
|
|
373
|
+
_inherits(RadioButton, _React$Component);
|
|
374
|
+
|
|
375
|
+
var _super = _createSuper(RadioButton);
|
|
376
|
+
|
|
377
|
+
function RadioButton() {
|
|
378
|
+
var _this;
|
|
379
|
+
|
|
380
|
+
_classCallCheck(this, RadioButton);
|
|
381
|
+
|
|
382
|
+
_this = _super.apply(this, arguments);
|
|
383
|
+
|
|
384
|
+
_this.renderRadioButton = function (_ref) {
|
|
385
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
386
|
+
|
|
387
|
+
var _a = _this.props,
|
|
388
|
+
customizePrefixCls = _a.prefixCls,
|
|
389
|
+
radioProps = __rest(_a, ["prefixCls"]);
|
|
390
|
+
|
|
391
|
+
var prefixCls = getPrefixCls('radio-button', customizePrefixCls);
|
|
392
|
+
|
|
393
|
+
if (_this.context.radioGroup) {
|
|
394
|
+
radioProps.checked = _this.props.value === _this.context.radioGroup.value;
|
|
395
|
+
radioProps.disabled = _this.props.disabled || _this.context.radioGroup.disabled;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return /*#__PURE__*/React.createElement(Radio, _extends({
|
|
399
|
+
prefixCls: prefixCls
|
|
400
|
+
}, radioProps));
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
return _this;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
_createClass(RadioButton, [{
|
|
407
|
+
key: "render",
|
|
408
|
+
value: function render() {
|
|
409
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderRadioButton);
|
|
410
|
+
}
|
|
411
|
+
}]);
|
|
412
|
+
|
|
413
|
+
return RadioButton;
|
|
414
|
+
}(React.Component);
|
|
415
|
+
RadioButton.contextTypes = {
|
|
416
|
+
radioGroup: propTypesExports.any
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
Radio.Button = RadioButton;
|
|
420
|
+
Radio.Group = RadioGroup;
|
|
421
|
+
|
|
422
|
+
export { RadioButton as R, RadioGroup as a, Radio as b };
|