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
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
import { n, c as classNames, P as PropTypes, C as ConfigConsumer } from '../../config-provider.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { Component, Children } from 'react';
|
|
4
|
+
import { s as shallowEqual, A as Animate, f as cssAnimation, p as polyfill, r as raf } from '../../menu.js';
|
|
5
|
+
import { e as reactIsExports } from '../../tree.js';
|
|
6
|
+
import { I as Icon } from '../../icon.js';
|
|
7
|
+
import 'react-dom';
|
|
8
|
+
import '../../input.js';
|
|
9
|
+
|
|
10
|
+
var css = "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable no-duplicate-selectors */\n/* stylelint-disable */\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\n.ant-collapse {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n font-variant: tabular-nums;\n line-height: 1.5;\n list-style: none;\n font-feature-settings: 'tnum';\n background-color: #fafafa;\n border: 1px solid #d9d9d9;\n border-bottom: 0;\n border-radius: 4px;\n}\n.ant-collapse > .ant-collapse-item {\n border-bottom: 1px solid #d9d9d9;\n}\n.ant-collapse > .ant-collapse-item:last-child,\n.ant-collapse > .ant-collapse-item:last-child > .ant-collapse-header {\n border-radius: 0 0 4px 4px;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header {\n position: relative;\n padding: 12px 16px;\n padding-left: 40px;\n color: rgba(0, 0, 0, 0.85);\n line-height: 22px;\n cursor: pointer;\n transition: all 0.3s;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow {\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n position: absolute;\n top: 50%;\n left: 16px;\n display: inline-block;\n font-size: 12px;\n transform: translateY(-50%);\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow > * {\n line-height: 1;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow svg {\n display: inline-block;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow::before {\n display: none;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow-icon {\n display: block;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow svg {\n transition: transform 0.24s;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-extra {\n float: right;\n}\n.ant-collapse > .ant-collapse-item > .ant-collapse-header:focus {\n outline: none;\n}\n.ant-collapse > .ant-collapse-item.ant-collapse-no-arrow > .ant-collapse-header {\n padding-left: 12px;\n}\n.ant-collapse-icon-position-right > .ant-collapse-item > .ant-collapse-header {\n padding: 12px 16px;\n padding-right: 40px;\n}\n.ant-collapse-icon-position-right > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow {\n right: 16px;\n left: auto;\n}\n.ant-collapse-anim-active {\n transition: height 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);\n}\n.ant-collapse-content {\n overflow: hidden;\n color: rgba(0, 0, 0, 0.65);\n background-color: #fff;\n border-top: 1px solid #d9d9d9;\n}\n.ant-collapse-content > .ant-collapse-content-box {\n padding: 16px;\n}\n.ant-collapse-content-inactive {\n display: none;\n}\n.ant-collapse-item:last-child > .ant-collapse-content {\n border-radius: 0 0 4px 4px;\n}\n.ant-collapse-borderless {\n background-color: #fafafa;\n border: 0;\n}\n.ant-collapse-borderless > .ant-collapse-item {\n border-bottom: 1px solid #d9d9d9;\n}\n.ant-collapse-borderless > .ant-collapse-item:last-child,\n.ant-collapse-borderless > .ant-collapse-item:last-child .ant-collapse-header {\n border-radius: 0;\n}\n.ant-collapse-borderless > .ant-collapse-item > .ant-collapse-content {\n background-color: transparent;\n border-top: 0;\n}\n.ant-collapse-borderless > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 4px;\n}\n.ant-collapse .ant-collapse-item-disabled > .ant-collapse-header,\n.ant-collapse .ant-collapse-item-disabled > .ant-collapse-header > .arrow {\n color: rgba(0, 0, 0, 0.25);\n cursor: not-allowed;\n}\n/*# sourceMappingURL=index.css.map */";
|
|
11
|
+
n(css,{"prepend":true});
|
|
12
|
+
|
|
13
|
+
var _createClass$4 = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
14
|
+
|
|
15
|
+
function _defineProperty$4(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; }
|
|
16
|
+
|
|
17
|
+
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
|
|
19
|
+
function _possibleConstructorReturn$4(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; }
|
|
20
|
+
|
|
21
|
+
function _inherits$4(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; }
|
|
22
|
+
|
|
23
|
+
var PanelContent = function (_Component) {
|
|
24
|
+
_inherits$4(PanelContent, _Component);
|
|
25
|
+
|
|
26
|
+
function PanelContent() {
|
|
27
|
+
_classCallCheck$4(this, PanelContent);
|
|
28
|
+
|
|
29
|
+
return _possibleConstructorReturn$4(this, (PanelContent.__proto__ || Object.getPrototypeOf(PanelContent)).apply(this, arguments));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_createClass$4(PanelContent, [{
|
|
33
|
+
key: 'shouldComponentUpdate',
|
|
34
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
35
|
+
return this.props.forceRender || !shallowEqual(this.props, nextProps);
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: 'render',
|
|
39
|
+
value: function render() {
|
|
40
|
+
var _classnames;
|
|
41
|
+
|
|
42
|
+
this._isActived = this.props.forceRender || this._isActived || this.props.isActive;
|
|
43
|
+
if (!this._isActived) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
var _props = this.props,
|
|
47
|
+
prefixCls = _props.prefixCls,
|
|
48
|
+
isActive = _props.isActive,
|
|
49
|
+
children = _props.children,
|
|
50
|
+
destroyInactivePanel = _props.destroyInactivePanel,
|
|
51
|
+
forceRender = _props.forceRender,
|
|
52
|
+
role = _props.role;
|
|
53
|
+
|
|
54
|
+
var contentCls = classNames((_classnames = {}, _defineProperty$4(_classnames, prefixCls + '-content', true), _defineProperty$4(_classnames, prefixCls + '-content-active', isActive), _defineProperty$4(_classnames, prefixCls + '-content-inactive', !isActive), _classnames));
|
|
55
|
+
var child = !forceRender && !isActive && destroyInactivePanel ? null : React__default.createElement(
|
|
56
|
+
'div',
|
|
57
|
+
{ className: prefixCls + '-content-box' },
|
|
58
|
+
children
|
|
59
|
+
);
|
|
60
|
+
return React__default.createElement(
|
|
61
|
+
'div',
|
|
62
|
+
{
|
|
63
|
+
className: contentCls,
|
|
64
|
+
role: role
|
|
65
|
+
},
|
|
66
|
+
child
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}]);
|
|
70
|
+
|
|
71
|
+
return PanelContent;
|
|
72
|
+
}(Component);
|
|
73
|
+
|
|
74
|
+
PanelContent.propTypes = {
|
|
75
|
+
prefixCls: PropTypes.string,
|
|
76
|
+
isActive: PropTypes.bool,
|
|
77
|
+
children: PropTypes.any,
|
|
78
|
+
destroyInactivePanel: PropTypes.bool,
|
|
79
|
+
forceRender: PropTypes.bool,
|
|
80
|
+
role: PropTypes.string
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
var _createClass$3 = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
84
|
+
|
|
85
|
+
function _defineProperty$3(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; }
|
|
86
|
+
|
|
87
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
88
|
+
|
|
89
|
+
function _possibleConstructorReturn$3(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; }
|
|
90
|
+
|
|
91
|
+
function _inherits$3(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; }
|
|
92
|
+
|
|
93
|
+
var CollapsePanel$1 = function (_Component) {
|
|
94
|
+
_inherits$3(CollapsePanel, _Component);
|
|
95
|
+
|
|
96
|
+
function CollapsePanel() {
|
|
97
|
+
var _ref;
|
|
98
|
+
|
|
99
|
+
var _temp, _this, _ret;
|
|
100
|
+
|
|
101
|
+
_classCallCheck$3(this, CollapsePanel);
|
|
102
|
+
|
|
103
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
104
|
+
args[_key] = arguments[_key];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn$3(this, (_ref = CollapsePanel.__proto__ || Object.getPrototypeOf(CollapsePanel)).call.apply(_ref, [this].concat(args))), _this), _this.handleItemClick = function () {
|
|
108
|
+
var _this$props = _this.props,
|
|
109
|
+
onItemClick = _this$props.onItemClick,
|
|
110
|
+
panelKey = _this$props.panelKey;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
if (typeof onItemClick === 'function') {
|
|
114
|
+
onItemClick(panelKey);
|
|
115
|
+
}
|
|
116
|
+
}, _this.handleKeyPress = function (e) {
|
|
117
|
+
if (e.key === 'Enter' || e.keyCode === 13 || e.which === 13) {
|
|
118
|
+
_this.handleItemClick();
|
|
119
|
+
}
|
|
120
|
+
}, _temp), _possibleConstructorReturn$3(_this, _ret);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_createClass$3(CollapsePanel, [{
|
|
124
|
+
key: 'shouldComponentUpdate',
|
|
125
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
126
|
+
return !shallowEqual(this.props, nextProps);
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: 'render',
|
|
130
|
+
value: function render() {
|
|
131
|
+
var _classNames2;
|
|
132
|
+
|
|
133
|
+
var _props = this.props,
|
|
134
|
+
className = _props.className,
|
|
135
|
+
id = _props.id,
|
|
136
|
+
style = _props.style,
|
|
137
|
+
prefixCls = _props.prefixCls,
|
|
138
|
+
header = _props.header,
|
|
139
|
+
headerClass = _props.headerClass,
|
|
140
|
+
children = _props.children,
|
|
141
|
+
isActive = _props.isActive,
|
|
142
|
+
showArrow = _props.showArrow,
|
|
143
|
+
destroyInactivePanel = _props.destroyInactivePanel,
|
|
144
|
+
disabled = _props.disabled,
|
|
145
|
+
accordion = _props.accordion,
|
|
146
|
+
forceRender = _props.forceRender,
|
|
147
|
+
expandIcon = _props.expandIcon,
|
|
148
|
+
extra = _props.extra;
|
|
149
|
+
|
|
150
|
+
var headerCls = classNames(prefixCls + '-header', _defineProperty$3({}, headerClass, headerClass));
|
|
151
|
+
var itemCls = classNames((_classNames2 = {}, _defineProperty$3(_classNames2, prefixCls + '-item', true), _defineProperty$3(_classNames2, prefixCls + '-item-active', isActive), _defineProperty$3(_classNames2, prefixCls + '-item-disabled', disabled), _classNames2), className);
|
|
152
|
+
|
|
153
|
+
var icon = React__default.createElement('i', { className: 'arrow' });
|
|
154
|
+
if (showArrow && typeof expandIcon === 'function') {
|
|
155
|
+
icon = expandIcon(this.props);
|
|
156
|
+
}
|
|
157
|
+
return React__default.createElement(
|
|
158
|
+
'div',
|
|
159
|
+
{ className: itemCls, style: style, id: id },
|
|
160
|
+
React__default.createElement(
|
|
161
|
+
'div',
|
|
162
|
+
{
|
|
163
|
+
className: headerCls,
|
|
164
|
+
onClick: this.handleItemClick,
|
|
165
|
+
role: accordion ? 'tab' : 'button',
|
|
166
|
+
tabIndex: disabled ? -1 : 0,
|
|
167
|
+
'aria-expanded': '' + isActive,
|
|
168
|
+
onKeyPress: this.handleKeyPress
|
|
169
|
+
},
|
|
170
|
+
showArrow && icon,
|
|
171
|
+
header,
|
|
172
|
+
extra && React__default.createElement(
|
|
173
|
+
'div',
|
|
174
|
+
{ className: prefixCls + '-extra' },
|
|
175
|
+
extra
|
|
176
|
+
)
|
|
177
|
+
),
|
|
178
|
+
React__default.createElement(
|
|
179
|
+
Animate,
|
|
180
|
+
{
|
|
181
|
+
showProp: 'isActive',
|
|
182
|
+
exclusive: true,
|
|
183
|
+
component: '',
|
|
184
|
+
animation: this.props.openAnimation
|
|
185
|
+
},
|
|
186
|
+
React__default.createElement(
|
|
187
|
+
PanelContent,
|
|
188
|
+
{
|
|
189
|
+
prefixCls: prefixCls,
|
|
190
|
+
isActive: isActive,
|
|
191
|
+
destroyInactivePanel: destroyInactivePanel,
|
|
192
|
+
forceRender: forceRender,
|
|
193
|
+
role: accordion ? 'tabpanel' : null
|
|
194
|
+
},
|
|
195
|
+
children
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}]);
|
|
201
|
+
|
|
202
|
+
return CollapsePanel;
|
|
203
|
+
}(Component);
|
|
204
|
+
|
|
205
|
+
CollapsePanel$1.propTypes = {
|
|
206
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
207
|
+
id: PropTypes.string,
|
|
208
|
+
children: PropTypes.any,
|
|
209
|
+
openAnimation: PropTypes.object,
|
|
210
|
+
prefixCls: PropTypes.string,
|
|
211
|
+
header: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),
|
|
212
|
+
headerClass: PropTypes.string,
|
|
213
|
+
showArrow: PropTypes.bool,
|
|
214
|
+
isActive: PropTypes.bool,
|
|
215
|
+
onItemClick: PropTypes.func,
|
|
216
|
+
style: PropTypes.object,
|
|
217
|
+
destroyInactivePanel: PropTypes.bool,
|
|
218
|
+
disabled: PropTypes.bool,
|
|
219
|
+
accordion: PropTypes.bool,
|
|
220
|
+
forceRender: PropTypes.bool,
|
|
221
|
+
expandIcon: PropTypes.func,
|
|
222
|
+
extra: PropTypes.node,
|
|
223
|
+
panelKey: PropTypes.any
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
CollapsePanel$1.defaultProps = {
|
|
227
|
+
showArrow: true,
|
|
228
|
+
isActive: false,
|
|
229
|
+
destroyInactivePanel: false,
|
|
230
|
+
onItemClick: function onItemClick() {},
|
|
231
|
+
|
|
232
|
+
headerClass: '',
|
|
233
|
+
forceRender: false
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
function animate$1(node, show, transitionName, done) {
|
|
237
|
+
var height = void 0;
|
|
238
|
+
return cssAnimation(node, transitionName, {
|
|
239
|
+
start: function start() {
|
|
240
|
+
if (!show) {
|
|
241
|
+
node.style.height = node.offsetHeight + 'px';
|
|
242
|
+
} else {
|
|
243
|
+
height = node.offsetHeight;
|
|
244
|
+
node.style.height = 0;
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
active: function active() {
|
|
248
|
+
node.style.height = (show ? height : 0) + 'px';
|
|
249
|
+
},
|
|
250
|
+
end: function end() {
|
|
251
|
+
node.style.height = '';
|
|
252
|
+
done();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function animation$1(prefixCls) {
|
|
258
|
+
return {
|
|
259
|
+
enter: function enter(node, done) {
|
|
260
|
+
return animate$1(node, true, prefixCls + '-anim', done);
|
|
261
|
+
},
|
|
262
|
+
leave: function leave(node, done) {
|
|
263
|
+
return animate$1(node, false, prefixCls + '-anim', done);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
var _createClass$2 = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
269
|
+
|
|
270
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
271
|
+
|
|
272
|
+
function _defineProperty$2(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; }
|
|
273
|
+
|
|
274
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
275
|
+
|
|
276
|
+
function _possibleConstructorReturn$2(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; }
|
|
277
|
+
|
|
278
|
+
function _inherits$2(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; }
|
|
279
|
+
|
|
280
|
+
function toArray(activeKey) {
|
|
281
|
+
var currentActiveKey = activeKey;
|
|
282
|
+
if (!Array.isArray(currentActiveKey)) {
|
|
283
|
+
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
|
|
284
|
+
}
|
|
285
|
+
return currentActiveKey.map(function (key) {
|
|
286
|
+
return String(key);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
var Collapse$1 = function (_Component) {
|
|
291
|
+
_inherits$2(Collapse, _Component);
|
|
292
|
+
|
|
293
|
+
function Collapse(props) {
|
|
294
|
+
_classCallCheck$2(this, Collapse);
|
|
295
|
+
|
|
296
|
+
var _this = _possibleConstructorReturn$2(this, (Collapse.__proto__ || Object.getPrototypeOf(Collapse)).call(this, props));
|
|
297
|
+
|
|
298
|
+
_initialiseProps.call(_this);
|
|
299
|
+
|
|
300
|
+
var activeKey = props.activeKey,
|
|
301
|
+
defaultActiveKey = props.defaultActiveKey;
|
|
302
|
+
|
|
303
|
+
var currentActiveKey = defaultActiveKey;
|
|
304
|
+
if ('activeKey' in props) {
|
|
305
|
+
currentActiveKey = activeKey;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
_this.state = {
|
|
309
|
+
openAnimation: props.openAnimation || animation$1(props.prefixCls),
|
|
310
|
+
activeKey: toArray(currentActiveKey)
|
|
311
|
+
};
|
|
312
|
+
return _this;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
_createClass$2(Collapse, [{
|
|
316
|
+
key: 'shouldComponentUpdate',
|
|
317
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
318
|
+
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
|
|
319
|
+
}
|
|
320
|
+
}, {
|
|
321
|
+
key: 'render',
|
|
322
|
+
value: function render() {
|
|
323
|
+
var _classNames;
|
|
324
|
+
|
|
325
|
+
var _props = this.props,
|
|
326
|
+
prefixCls = _props.prefixCls,
|
|
327
|
+
className = _props.className,
|
|
328
|
+
style = _props.style,
|
|
329
|
+
accordion = _props.accordion;
|
|
330
|
+
|
|
331
|
+
var collapseClassName = classNames((_classNames = {}, _defineProperty$2(_classNames, prefixCls, true), _defineProperty$2(_classNames, className, !!className), _classNames));
|
|
332
|
+
return React__default.createElement(
|
|
333
|
+
'div',
|
|
334
|
+
{ className: collapseClassName, style: style, role: accordion ? 'tablist' : null },
|
|
335
|
+
this.getItems()
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}], [{
|
|
339
|
+
key: 'getDerivedStateFromProps',
|
|
340
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
341
|
+
var newState = {};
|
|
342
|
+
if ('activeKey' in nextProps) {
|
|
343
|
+
newState.activeKey = toArray(nextProps.activeKey);
|
|
344
|
+
}
|
|
345
|
+
if ('openAnimation' in nextProps) {
|
|
346
|
+
newState.openAnimation = nextProps.openAnimation;
|
|
347
|
+
}
|
|
348
|
+
return newState.activeKey || newState.openAnimation ? newState : null;
|
|
349
|
+
}
|
|
350
|
+
}]);
|
|
351
|
+
|
|
352
|
+
return Collapse;
|
|
353
|
+
}(Component);
|
|
354
|
+
|
|
355
|
+
var _initialiseProps = function _initialiseProps() {
|
|
356
|
+
var _this2 = this;
|
|
357
|
+
|
|
358
|
+
this.onClickItem = function (key) {
|
|
359
|
+
var activeKey = _this2.state.activeKey;
|
|
360
|
+
if (_this2.props.accordion) {
|
|
361
|
+
activeKey = activeKey[0] === key ? [] : [key];
|
|
362
|
+
} else {
|
|
363
|
+
activeKey = [].concat(_toConsumableArray(activeKey));
|
|
364
|
+
var index = activeKey.indexOf(key);
|
|
365
|
+
var isActive = index > -1;
|
|
366
|
+
if (isActive) {
|
|
367
|
+
// remove active state
|
|
368
|
+
activeKey.splice(index, 1);
|
|
369
|
+
} else {
|
|
370
|
+
activeKey.push(key);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
_this2.setActiveKey(activeKey);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
this.getNewChild = function (child, index) {
|
|
377
|
+
if (!child) return null;
|
|
378
|
+
|
|
379
|
+
var activeKey = _this2.state.activeKey;
|
|
380
|
+
var _props2 = _this2.props,
|
|
381
|
+
prefixCls = _props2.prefixCls,
|
|
382
|
+
accordion = _props2.accordion,
|
|
383
|
+
destroyInactivePanel = _props2.destroyInactivePanel,
|
|
384
|
+
expandIcon = _props2.expandIcon;
|
|
385
|
+
// If there is no key provide, use the panel order as default key
|
|
386
|
+
|
|
387
|
+
var key = child.key || String(index);
|
|
388
|
+
var _child$props = child.props,
|
|
389
|
+
header = _child$props.header,
|
|
390
|
+
headerClass = _child$props.headerClass,
|
|
391
|
+
disabled = _child$props.disabled;
|
|
392
|
+
|
|
393
|
+
var isActive = false;
|
|
394
|
+
if (accordion) {
|
|
395
|
+
isActive = activeKey[0] === key;
|
|
396
|
+
} else {
|
|
397
|
+
isActive = activeKey.indexOf(key) > -1;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
var props = {
|
|
401
|
+
key: key,
|
|
402
|
+
panelKey: key,
|
|
403
|
+
header: header,
|
|
404
|
+
headerClass: headerClass,
|
|
405
|
+
isActive: isActive,
|
|
406
|
+
prefixCls: prefixCls,
|
|
407
|
+
destroyInactivePanel: destroyInactivePanel,
|
|
408
|
+
openAnimation: _this2.state.openAnimation,
|
|
409
|
+
accordion: accordion,
|
|
410
|
+
children: child.props.children,
|
|
411
|
+
onItemClick: disabled ? null : _this2.onClickItem,
|
|
412
|
+
expandIcon: expandIcon
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
// https://github.com/ant-design/ant-design/issues/20479
|
|
416
|
+
if (typeof child.type === 'string') {
|
|
417
|
+
return child;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return React__default.cloneElement(child, props);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
this.getItems = function () {
|
|
424
|
+
var children = _this2.props.children;
|
|
425
|
+
|
|
426
|
+
var childList = reactIsExports.isFragment(children) ? children.props.children : children;
|
|
427
|
+
var newChildren = Children.map(childList, _this2.getNewChild);
|
|
428
|
+
|
|
429
|
+
// ref: https://github.com/ant-design/ant-design/issues/13884
|
|
430
|
+
if (reactIsExports.isFragment(children)) {
|
|
431
|
+
return React__default.createElement(
|
|
432
|
+
React__default.Fragment,
|
|
433
|
+
null,
|
|
434
|
+
newChildren
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
return newChildren;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
this.setActiveKey = function (activeKey) {
|
|
442
|
+
if (!('activeKey' in _this2.props)) {
|
|
443
|
+
_this2.setState({ activeKey: activeKey });
|
|
444
|
+
}
|
|
445
|
+
_this2.props.onChange(_this2.props.accordion ? activeKey[0] : activeKey);
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
Collapse$1.propTypes = {
|
|
450
|
+
children: PropTypes.any,
|
|
451
|
+
prefixCls: PropTypes.string,
|
|
452
|
+
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
|
453
|
+
defaultActiveKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
|
454
|
+
openAnimation: PropTypes.object,
|
|
455
|
+
onChange: PropTypes.func,
|
|
456
|
+
accordion: PropTypes.bool,
|
|
457
|
+
className: PropTypes.string,
|
|
458
|
+
style: PropTypes.object,
|
|
459
|
+
destroyInactivePanel: PropTypes.bool,
|
|
460
|
+
expandIcon: PropTypes.func
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
Collapse$1.defaultProps = {
|
|
464
|
+
prefixCls: 'rc-collapse',
|
|
465
|
+
onChange: function onChange() {},
|
|
466
|
+
|
|
467
|
+
accordion: false,
|
|
468
|
+
destroyInactivePanel: false
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
Collapse$1.Panel = CollapsePanel$1;
|
|
472
|
+
|
|
473
|
+
polyfill(Collapse$1);
|
|
474
|
+
|
|
475
|
+
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); }
|
|
476
|
+
|
|
477
|
+
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); }
|
|
478
|
+
|
|
479
|
+
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; }
|
|
480
|
+
|
|
481
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
482
|
+
|
|
483
|
+
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); } }
|
|
484
|
+
|
|
485
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
|
|
486
|
+
|
|
487
|
+
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); }
|
|
488
|
+
|
|
489
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
490
|
+
|
|
491
|
+
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); }; }
|
|
492
|
+
|
|
493
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
494
|
+
|
|
495
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
496
|
+
|
|
497
|
+
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; } }
|
|
498
|
+
|
|
499
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
500
|
+
|
|
501
|
+
var CollapsePanel = /*#__PURE__*/function (_React$Component) {
|
|
502
|
+
_inherits$1(CollapsePanel, _React$Component);
|
|
503
|
+
|
|
504
|
+
var _super = _createSuper$1(CollapsePanel);
|
|
505
|
+
|
|
506
|
+
function CollapsePanel() {
|
|
507
|
+
var _this;
|
|
508
|
+
|
|
509
|
+
_classCallCheck$1(this, CollapsePanel);
|
|
510
|
+
|
|
511
|
+
_this = _super.apply(this, arguments);
|
|
512
|
+
|
|
513
|
+
_this.renderCollapsePanel = function (_ref) {
|
|
514
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
515
|
+
var _this$props = _this.props,
|
|
516
|
+
customizePrefixCls = _this$props.prefixCls,
|
|
517
|
+
_this$props$className = _this$props.className,
|
|
518
|
+
className = _this$props$className === void 0 ? '' : _this$props$className,
|
|
519
|
+
_this$props$showArrow = _this$props.showArrow,
|
|
520
|
+
showArrow = _this$props$showArrow === void 0 ? true : _this$props$showArrow;
|
|
521
|
+
var prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
|
522
|
+
var collapsePanelClassName = classNames(_defineProperty$1({}, "".concat(prefixCls, "-no-arrow"), !showArrow), className);
|
|
523
|
+
return /*#__PURE__*/React.createElement(Collapse$1.Panel, _extends$1({}, _this.props, {
|
|
524
|
+
prefixCls: prefixCls,
|
|
525
|
+
className: collapsePanelClassName
|
|
526
|
+
}));
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
return _this;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
_createClass$1(CollapsePanel, [{
|
|
533
|
+
key: "render",
|
|
534
|
+
value: function render() {
|
|
535
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderCollapsePanel);
|
|
536
|
+
}
|
|
537
|
+
}]);
|
|
538
|
+
|
|
539
|
+
return CollapsePanel;
|
|
540
|
+
}(React.Component);
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Deprecated. We should replace the animation with pure react motion instead of modify style directly.
|
|
544
|
+
* If you are creating new component with animation, please use `./motion`.
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
function animate(node, show, done) {
|
|
548
|
+
var height;
|
|
549
|
+
var requestAnimationFrameId;
|
|
550
|
+
return cssAnimation(node, 'ant-motion-collapse-legacy', {
|
|
551
|
+
start: function start() {
|
|
552
|
+
if (!show) {
|
|
553
|
+
node.style.height = "".concat(node.offsetHeight, "px");
|
|
554
|
+
node.style.opacity = '1';
|
|
555
|
+
} else {
|
|
556
|
+
height = node.offsetHeight;
|
|
557
|
+
node.style.height = '0px';
|
|
558
|
+
node.style.opacity = '0';
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
active: function active() {
|
|
562
|
+
if (requestAnimationFrameId) {
|
|
563
|
+
raf.cancel(requestAnimationFrameId);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
requestAnimationFrameId = raf(function () {
|
|
567
|
+
node.style.height = "".concat(show ? height : 0, "px");
|
|
568
|
+
node.style.opacity = show ? '1' : '0';
|
|
569
|
+
});
|
|
570
|
+
},
|
|
571
|
+
end: function end() {
|
|
572
|
+
if (requestAnimationFrameId) {
|
|
573
|
+
raf.cancel(requestAnimationFrameId);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
node.style.height = '';
|
|
577
|
+
node.style.opacity = '';
|
|
578
|
+
done();
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
var animation = {
|
|
584
|
+
enter: function enter(node, done) {
|
|
585
|
+
return animate(node, true, done);
|
|
586
|
+
},
|
|
587
|
+
leave: function leave(node, done) {
|
|
588
|
+
return animate(node, false, done);
|
|
589
|
+
},
|
|
590
|
+
appear: function appear(node, done) {
|
|
591
|
+
return animate(node, true, done);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
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); }
|
|
596
|
+
|
|
597
|
+
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); }
|
|
598
|
+
|
|
599
|
+
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; }
|
|
600
|
+
|
|
601
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
602
|
+
|
|
603
|
+
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); } }
|
|
604
|
+
|
|
605
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
|
|
606
|
+
|
|
607
|
+
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); }
|
|
608
|
+
|
|
609
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
610
|
+
|
|
611
|
+
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); }; }
|
|
612
|
+
|
|
613
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
614
|
+
|
|
615
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
616
|
+
|
|
617
|
+
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; } }
|
|
618
|
+
|
|
619
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
620
|
+
|
|
621
|
+
var Collapse = /*#__PURE__*/function (_React$Component) {
|
|
622
|
+
_inherits(Collapse, _React$Component);
|
|
623
|
+
|
|
624
|
+
var _super = _createSuper(Collapse);
|
|
625
|
+
|
|
626
|
+
function Collapse() {
|
|
627
|
+
var _this;
|
|
628
|
+
|
|
629
|
+
_classCallCheck(this, Collapse);
|
|
630
|
+
|
|
631
|
+
_this = _super.apply(this, arguments);
|
|
632
|
+
|
|
633
|
+
_this.renderExpandIcon = function () {
|
|
634
|
+
var panelProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
635
|
+
var prefixCls = arguments.length > 1 ? arguments[1] : undefined;
|
|
636
|
+
var expandIcon = _this.props.expandIcon;
|
|
637
|
+
var icon = expandIcon ? expandIcon(panelProps) : /*#__PURE__*/React.createElement(Icon, {
|
|
638
|
+
type: "right",
|
|
639
|
+
rotate: panelProps.isActive ? 90 : undefined
|
|
640
|
+
});
|
|
641
|
+
return /*#__PURE__*/React.isValidElement(icon) ? /*#__PURE__*/React.cloneElement(icon, {
|
|
642
|
+
className: classNames(icon.props.className, "".concat(prefixCls, "-arrow"))
|
|
643
|
+
}) : icon;
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
_this.renderCollapse = function (_ref) {
|
|
647
|
+
var _classNames;
|
|
648
|
+
|
|
649
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
650
|
+
var _this$props = _this.props,
|
|
651
|
+
customizePrefixCls = _this$props.prefixCls,
|
|
652
|
+
_this$props$className = _this$props.className,
|
|
653
|
+
className = _this$props$className === void 0 ? '' : _this$props$className,
|
|
654
|
+
bordered = _this$props.bordered,
|
|
655
|
+
expandIconPosition = _this$props.expandIconPosition;
|
|
656
|
+
var prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
|
657
|
+
var collapseClassName = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-borderless"), !bordered), _defineProperty(_classNames, "".concat(prefixCls, "-icon-position-").concat(expandIconPosition), true), _classNames), className);
|
|
658
|
+
return /*#__PURE__*/React.createElement(Collapse$1, _extends({}, _this.props, {
|
|
659
|
+
expandIcon: function expandIcon(panelProps) {
|
|
660
|
+
return _this.renderExpandIcon(panelProps, prefixCls);
|
|
661
|
+
},
|
|
662
|
+
prefixCls: prefixCls,
|
|
663
|
+
className: collapseClassName
|
|
664
|
+
}));
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
return _this;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
_createClass(Collapse, [{
|
|
671
|
+
key: "render",
|
|
672
|
+
value: function render() {
|
|
673
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderCollapse);
|
|
674
|
+
}
|
|
675
|
+
}]);
|
|
676
|
+
|
|
677
|
+
return Collapse;
|
|
678
|
+
}(React.Component);
|
|
679
|
+
Collapse.Panel = CollapsePanel;
|
|
680
|
+
Collapse.defaultProps = {
|
|
681
|
+
bordered: true,
|
|
682
|
+
openAnimation: _extends(_extends({}, animation), {
|
|
683
|
+
appear: function appear() {}
|
|
684
|
+
}),
|
|
685
|
+
expandIconPosition: 'left'
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
export { Collapse as default };
|