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.
Files changed (174) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Checkbox.js +164 -0
  3. package/dist/CommonMixin.js +816 -0
  4. package/dist/Divider.js +646 -0
  5. package/dist/Notification.js +279 -0
  6. package/dist/Pagination.js +1106 -0
  7. package/dist/PortalWrapper.js +347 -0
  8. package/dist/RowContext.js +5 -0
  9. package/dist/Sider.js +533 -0
  10. package/dist/TextArea.js +432 -0
  11. package/dist/_arrayMap.js +68 -0
  12. package/dist/_assignValue.js +95 -0
  13. package/dist/_copyArray.js +31 -0
  14. package/dist/_hasPath.js +53 -0
  15. package/dist/_overArg.js +437 -0
  16. package/dist/_stringToArray.js +136 -0
  17. package/dist/antd/es/affix.js +12 -0
  18. package/dist/antd/es/alert.js +5 -0
  19. package/dist/antd/es/anchor.js +466 -0
  20. package/dist/antd/es/auto-complete.js +5 -0
  21. package/dist/antd/es/avatar.js +5 -0
  22. package/dist/antd/es/back-top.js +5 -0
  23. package/dist/antd/es/badge.js +5 -0
  24. package/dist/antd/es/breadcrumb.js +18 -0
  25. package/dist/antd/es/button.js +12 -0
  26. package/dist/antd/es/calendar.js +953 -0
  27. package/dist/antd/es/card.js +5 -0
  28. package/dist/antd/es/carousel.js +5 -0
  29. package/dist/antd/es/cascader.js +1275 -0
  30. package/dist/antd/es/checkbox.js +11 -0
  31. package/dist/antd/es/col.js +4 -0
  32. package/dist/antd/es/collapse.js +688 -0
  33. package/dist/antd/es/comment.js +5 -0
  34. package/dist/antd/es/config-provider.js +2 -0
  35. package/dist/antd/es/date-picker.js +4322 -0
  36. package/dist/antd/es/descriptions.js +342 -0
  37. package/dist/antd/es/divider.js +53 -0
  38. package/dist/antd/es/drawer.js +1115 -0
  39. package/dist/antd/es/dropdown.js +14 -0
  40. package/dist/antd/es/empty.js +6 -0
  41. package/dist/antd/es/form.js +5008 -0
  42. package/dist/antd/es/grid.js +13 -0
  43. package/dist/antd/es/icon.js +6 -0
  44. package/dist/antd/es/input-number.js +5 -0
  45. package/dist/antd/es/input.js +16 -0
  46. package/dist/antd/es/layout.js +14 -0
  47. package/dist/antd/es/list.js +5 -0
  48. package/dist/antd/es/locale/ar_EG.js +102 -0
  49. package/dist/antd/es/locale/bg_BG.js +98 -0
  50. package/dist/antd/es/locale/ca_ES.js +96 -0
  51. package/dist/antd/es/locale/cs_CZ.js +96 -0
  52. package/dist/antd/es/locale/da_DK.js +98 -0
  53. package/dist/antd/es/locale/de_DE.js +98 -0
  54. package/dist/antd/es/locale/default.js +2 -0
  55. package/dist/antd/es/locale/el_GR.js +98 -0
  56. package/dist/antd/es/locale/en_GB.js +98 -0
  57. package/dist/antd/es/locale/en_US.js +2 -0
  58. package/dist/antd/es/locale/es_ES.js +114 -0
  59. package/dist/antd/es/locale/et_EE.js +98 -0
  60. package/dist/antd/es/locale/fa_IR.js +98 -0
  61. package/dist/antd/es/locale/fi_FI.js +99 -0
  62. package/dist/antd/es/locale/fr_BE.js +102 -0
  63. package/dist/antd/es/locale/fr_FR.js +102 -0
  64. package/dist/antd/es/locale/ga_IE.js +99 -0
  65. package/dist/antd/es/locale/he_IL.js +99 -0
  66. package/dist/antd/es/locale/hi_IN.js +107 -0
  67. package/dist/antd/es/locale/hr_HR.js +113 -0
  68. package/dist/antd/es/locale/hu_HU.js +99 -0
  69. package/dist/antd/es/locale/hy_AM.js +109 -0
  70. package/dist/antd/es/locale/id_ID.js +101 -0
  71. package/dist/antd/es/locale/is_IS.js +98 -0
  72. package/dist/antd/es/locale/it_IT.js +111 -0
  73. package/dist/antd/es/locale/ja_JP.js +96 -0
  74. package/dist/antd/es/locale/kn_IN.js +107 -0
  75. package/dist/antd/es/locale/ko_KR.js +98 -0
  76. package/dist/antd/es/locale/ku_IQ.js +98 -0
  77. package/dist/antd/es/locale/lv_LV.js +98 -0
  78. package/dist/antd/es/locale/mk_MK.js +113 -0
  79. package/dist/antd/es/locale/mn_MN.js +99 -0
  80. package/dist/antd/es/locale/ms_MY.js +118 -0
  81. package/dist/antd/es/locale/nb_NO.js +97 -0
  82. package/dist/antd/es/locale/ne_NP.js +44 -0
  83. package/dist/antd/es/locale/nl_BE.js +98 -0
  84. package/dist/antd/es/locale/nl_NL.js +117 -0
  85. package/dist/antd/es/locale/pl_PL.js +98 -0
  86. package/dist/antd/es/locale/pt_BR.js +104 -0
  87. package/dist/antd/es/locale/pt_PT.js +127 -0
  88. package/dist/antd/es/locale/ro_RO.js +118 -0
  89. package/dist/antd/es/locale/ru_RU.js +110 -0
  90. package/dist/antd/es/locale/sk_SK.js +118 -0
  91. package/dist/antd/es/locale/sl_SI.js +96 -0
  92. package/dist/antd/es/locale/sr_RS.js +97 -0
  93. package/dist/antd/es/locale/sv_SE.js +101 -0
  94. package/dist/antd/es/locale/ta_IN.js +119 -0
  95. package/dist/antd/es/locale/th_TH.js +117 -0
  96. package/dist/antd/es/locale/tr_TR.js +112 -0
  97. package/dist/antd/es/locale/uk_UA.js +97 -0
  98. package/dist/antd/es/locale/vi_VN.js +99 -0
  99. package/dist/antd/es/locale/zh_CN.js +104 -0
  100. package/dist/antd/es/locale/zh_TW.js +100 -0
  101. package/dist/antd/es/locale-provider.js +6 -0
  102. package/dist/antd/es/mention.js +23215 -0
  103. package/dist/antd/es/mentions.js +961 -0
  104. package/dist/antd/es/menu.js +5 -0
  105. package/dist/antd/es/message.js +161 -0
  106. package/dist/antd/es/modal.js +885 -0
  107. package/dist/antd/es/notification.js +216 -0
  108. package/dist/antd/es/page-header.js +350 -0
  109. package/dist/antd/es/pagination.js +15 -0
  110. package/dist/antd/es/popconfirm.js +215 -0
  111. package/dist/antd/es/popover.js +5 -0
  112. package/dist/antd/es/progress.js +10 -0
  113. package/dist/antd/es/radio.js +10 -0
  114. package/dist/antd/es/rate.js +5 -0
  115. package/dist/antd/es/result.js +828 -0
  116. package/dist/antd/es/row.js +9 -0
  117. package/dist/antd/es/select.js +5 -0
  118. package/dist/antd/es/skeleton.js +370 -0
  119. package/dist/antd/es/slider.js +5 -0
  120. package/dist/antd/es/spin.js +11 -0
  121. package/dist/antd/es/statistic.js +650 -0
  122. package/dist/antd/es/steps.js +5 -0
  123. package/dist/antd/es/style.js +5 -0
  124. package/dist/antd/es/switch.js +5 -0
  125. package/dist/antd/es/table.js +7057 -0
  126. package/dist/antd/es/tabs.js +5 -0
  127. package/dist/antd/es/tag.js +12 -0
  128. package/dist/antd/es/time-picker.js +10 -0
  129. package/dist/antd/es/timeline.js +206 -0
  130. package/dist/antd/es/tooltip.js +9 -0
  131. package/dist/antd/es/transfer.js +2508 -0
  132. package/dist/antd/es/tree-select.js +5 -0
  133. package/dist/antd/es/tree.js +10 -0
  134. package/dist/antd/es/typography.js +1246 -0
  135. package/dist/antd/es/upload.js +3418 -0
  136. package/dist/antd/es/version.js +7 -0
  137. package/dist/col.js +142 -0
  138. package/dist/config-provider.js +6949 -0
  139. package/dist/dropdown.js +442 -0
  140. package/dist/get.js +1043 -0
  141. package/dist/icon.js +6138 -0
  142. package/dist/identity.js +230 -0
  143. package/dist/index.js +462 -0
  144. package/dist/index10.js +478 -0
  145. package/dist/index11.js +232 -0
  146. package/dist/index12.js +2766 -0
  147. package/dist/index13.js +422 -0
  148. package/dist/index14.js +283 -0
  149. package/dist/index15.js +1755 -0
  150. package/dist/index2.js +374 -0
  151. package/dist/index3.js +407 -0
  152. package/dist/index4.js +522 -0
  153. package/dist/index5.js +601 -0
  154. package/dist/index6.js +601 -0
  155. package/dist/index7.js +364 -0
  156. package/dist/index8.js +436 -0
  157. package/dist/index9.js +130 -0
  158. package/dist/input.js +475 -0
  159. package/dist/isLength.js +402 -0
  160. package/dist/keys.js +292 -0
  161. package/dist/menu.js +8138 -0
  162. package/dist/progress.js +852 -0
  163. package/dist/raf.js +34 -0
  164. package/dist/responsiveObserve.js +444 -0
  165. package/dist/row.js +173 -0
  166. package/dist/scrollTo.js +66 -0
  167. package/dist/toInteger.js +123 -0
  168. package/dist/toString.js +84 -0
  169. package/dist/transButton.js +121 -0
  170. package/dist/tree.js +3017 -0
  171. package/dist/warning.js +55 -0
  172. package/dist/wave.js +230 -0
  173. package/dist/zh_CN.js +17 -0
  174. package/package.json +160 -0
@@ -0,0 +1,1275 @@
1
+ import { n, g as getDefaultExportFromCjs, P as PropTypes, c as classNames, C as ConfigConsumer, L as LocaleReceiver } from '../../config-provider.js';
2
+ import * as React from 'react';
3
+ import React__default, { cloneElement, Component } from 'react';
4
+ import { b as Trigger, K as KeyCode, p as polyfill } from '../../menu.js';
5
+ import { w as warning } from '../../tree.js';
6
+ import { findDOMNode } from 'react-dom';
7
+ import { o as omit, I as Input } from '../../input.js';
8
+ import '../../index10.js';
9
+ import { I as Icon } from '../../icon.js';
10
+ import '../../index7.js';
11
+ import '../../wave.js';
12
+ import '../../raf.js';
13
+ import '../../TextArea.js';
14
+ import '../../index2.js';
15
+ import '../../warning.js';
16
+
17
+ 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-cascader {\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}\n.ant-cascader-input.ant-input {\n position: static;\n width: 100%;\n padding-right: 24px;\n background-color: transparent !important;\n cursor: pointer;\n}\n.ant-cascader-picker-show-search .ant-cascader-input.ant-input {\n position: relative;\n}\n.ant-cascader-picker {\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 position: relative;\n display: inline-block;\n background-color: #fff;\n border-radius: 4px;\n outline: 0;\n cursor: pointer;\n transition: color 0.3s;\n}\n.ant-cascader-picker-with-value .ant-cascader-picker-label {\n color: transparent;\n}\n.ant-cascader-picker-disabled {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n cursor: not-allowed;\n}\n.ant-cascader-picker-disabled .ant-cascader-input {\n cursor: not-allowed;\n}\n.ant-cascader-picker:focus .ant-cascader-input {\n border-color: #40a9ff;\n border-right-width: 1px !important;\n outline: 0;\n box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);\n}\n.ant-cascader-picker-show-search.ant-cascader-picker-focused {\n color: rgba(0, 0, 0, 0.25);\n}\n.ant-cascader-picker-label {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n height: 20px;\n margin-top: -10px;\n padding: 0 20px 0 12px;\n overflow: hidden;\n line-height: 20px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.ant-cascader-picker-clear {\n position: absolute;\n top: 50%;\n right: 12px;\n z-index: 2;\n width: 12px;\n height: 12px;\n margin-top: -6px;\n color: rgba(0, 0, 0, 0.25);\n font-size: 12px;\n line-height: 12px;\n background: #fff;\n cursor: pointer;\n opacity: 0;\n transition: color 0.3s ease, opacity 0.15s ease;\n}\n.ant-cascader-picker-clear:hover {\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-cascader-picker:hover .ant-cascader-picker-clear {\n opacity: 1;\n}\n.ant-cascader-picker-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n z-index: 1;\n width: 12px;\n height: 12px;\n margin-top: -6px;\n color: rgba(0, 0, 0, 0.25);\n font-size: 12px;\n line-height: 12px;\n transition: transform 0.2s;\n}\n.ant-cascader-picker-arrow.ant-cascader-picker-arrow-expand {\n transform: rotate(180deg);\n}\n.ant-cascader-picker-label:hover + .ant-cascader-input {\n border-color: #40a9ff;\n border-right-width: 1px !important;\n}\n.ant-cascader-picker-small .ant-cascader-picker-clear,\n.ant-cascader-picker-small .ant-cascader-picker-arrow {\n right: 8px;\n}\n.ant-cascader-menus {\n position: absolute;\n z-index: 1050;\n font-size: 14px;\n white-space: nowrap;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n.ant-cascader-menus ul,\n.ant-cascader-menus ol {\n margin: 0;\n list-style: none;\n}\n.ant-cascader-menus-empty,\n.ant-cascader-menus-hidden {\n display: none;\n}\n.ant-cascader-menus.slide-up-enter.slide-up-enter-active.ant-cascader-menus-placement-bottomLeft,\n.ant-cascader-menus.slide-up-appear.slide-up-appear-active.ant-cascader-menus-placement-bottomLeft {\n animation-name: antSlideUpIn;\n}\n.ant-cascader-menus.slide-up-enter.slide-up-enter-active.ant-cascader-menus-placement-topLeft,\n.ant-cascader-menus.slide-up-appear.slide-up-appear-active.ant-cascader-menus-placement-topLeft {\n animation-name: antSlideDownIn;\n}\n.ant-cascader-menus.slide-up-leave.slide-up-leave-active.ant-cascader-menus-placement-bottomLeft {\n animation-name: antSlideUpOut;\n}\n.ant-cascader-menus.slide-up-leave.slide-up-leave-active.ant-cascader-menus-placement-topLeft {\n animation-name: antSlideDownOut;\n}\n.ant-cascader-menu {\n display: inline-block;\n min-width: 111px;\n height: 180px;\n margin: 0;\n padding: 4px 0;\n overflow: auto;\n vertical-align: top;\n list-style: none;\n border-right: 1px solid #e8e8e8;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n}\n.ant-cascader-menu:first-child {\n border-radius: 4px 0 0 4px;\n}\n.ant-cascader-menu:last-child {\n margin-right: -1px;\n border-right-color: transparent;\n border-radius: 0 4px 4px 0;\n}\n.ant-cascader-menu:only-child {\n border-radius: 4px;\n}\n.ant-cascader-menu-item {\n padding: 5px 12px;\n line-height: 22px;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.3s;\n}\n.ant-cascader-menu-item:hover {\n background: #e6f7ff;\n}\n.ant-cascader-menu-item-disabled {\n color: rgba(0, 0, 0, 0.25);\n cursor: not-allowed;\n}\n.ant-cascader-menu-item-disabled:hover {\n background: transparent;\n}\n.ant-cascader-menu-item-active:not(.ant-cascader-menu-item-disabled),\n.ant-cascader-menu-item-active:not(.ant-cascader-menu-item-disabled):hover {\n font-weight: 600;\n background-color: #fafafa;\n}\n.ant-cascader-menu-item-expand {\n position: relative;\n padding-right: 24px;\n}\n.ant-cascader-menu-item-expand .ant-cascader-menu-item-expand-icon,\n.ant-cascader-menu-item-loading-icon {\n display: inline-block;\n font-size: 12px;\n font-size: 10px \\9;\n transform: scale(0.83333333) rotate(0deg);\n position: absolute;\n right: 12px;\n color: rgba(0, 0, 0, 0.45);\n}\n:root .ant-cascader-menu-item-expand .ant-cascader-menu-item-expand-icon,\n:root .ant-cascader-menu-item-loading-icon {\n font-size: 12px;\n}\n.ant-cascader-menu-item .ant-cascader-menu-item-keyword {\n color: #f5222d;\n}\n/*# sourceMappingURL=index.css.map */";
18
+ n(css,{"prepend":true});
19
+
20
+ var lib$1 = {exports: {}};
21
+
22
+ var lib = lib$1.exports;
23
+
24
+ var hasRequiredLib;
25
+
26
+ function requireLib () {
27
+ if (hasRequiredLib) return lib$1.exports;
28
+ hasRequiredLib = 1;
29
+ (function (module, exports$1) {
30
+ (function (global, factory) {
31
+ module.exports = factory() ;
32
+ }(lib, (function () {
33
+ function arrayTreeFilter(data, filterFn, options) {
34
+ options = options || {};
35
+ options.childrenKeyName = options.childrenKeyName || "children";
36
+ var children = data || [];
37
+ var result = [];
38
+ var level = 0;
39
+ do {
40
+ var foundItem = children.filter(function (item) {
41
+ return filterFn(item, level);
42
+ })[0];
43
+ if (!foundItem) {
44
+ break;
45
+ }
46
+ result.push(foundItem);
47
+ children = foundItem[options.childrenKeyName] || [];
48
+ level += 1;
49
+ } while (children.length > 0);
50
+ return result;
51
+ }
52
+
53
+ return arrayTreeFilter;
54
+
55
+ })));
56
+ } (lib$1));
57
+ return lib$1.exports;
58
+ }
59
+
60
+ var libExports = requireLib();
61
+ var arrayTreeFilter = /*@__PURE__*/getDefaultExportFromCjs(libExports);
62
+
63
+ var arrays;
64
+ var hasRequiredArrays;
65
+
66
+ function requireArrays () {
67
+ if (hasRequiredArrays) return arrays;
68
+ hasRequiredArrays = 1;
69
+
70
+ function shallowEqualArrays(arrA, arrB) {
71
+ if (arrA === arrB) {
72
+ return true;
73
+ }
74
+
75
+ if (!arrA || !arrB) {
76
+ return false;
77
+ }
78
+
79
+ var len = arrA.length;
80
+
81
+ if (arrB.length !== len) {
82
+ return false;
83
+ }
84
+
85
+ for (var i = 0; i < len; i++) {
86
+ if (arrA[i] !== arrB[i]) {
87
+ return false;
88
+ }
89
+ }
90
+
91
+ return true;
92
+ }
93
+
94
+ arrays = shallowEqualArrays;
95
+ return arrays;
96
+ }
97
+
98
+ var arraysExports = requireArrays();
99
+ var shallowEqualArrays = /*@__PURE__*/getDefaultExportFromCjs(arraysExports);
100
+
101
+ var _extends$2 = 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; };
102
+
103
+ 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; }; }();
104
+
105
+ function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
106
+
107
+ 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; }
108
+
109
+ 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; }
110
+
111
+ var Menus = function (_React$Component) {
112
+ _inherits$2(Menus, _React$Component);
113
+
114
+ function Menus(props) {
115
+ _classCallCheck$2(this, Menus);
116
+
117
+ var _this = _possibleConstructorReturn$2(this, (Menus.__proto__ || Object.getPrototypeOf(Menus)).call(this, props));
118
+
119
+ _this.saveMenuItem = function (index) {
120
+ return function (node) {
121
+ _this.menuItems[index] = node;
122
+ };
123
+ };
124
+
125
+ _this.menuItems = {};
126
+ return _this;
127
+ }
128
+
129
+ _createClass$2(Menus, [{
130
+ key: 'componentDidMount',
131
+ value: function componentDidMount() {
132
+ this.scrollActiveItemToView();
133
+ }
134
+ }, {
135
+ key: 'componentDidUpdate',
136
+ value: function componentDidUpdate(prevProps) {
137
+ if (!prevProps.visible && this.props.visible) {
138
+ this.scrollActiveItemToView();
139
+ }
140
+ }
141
+ }, {
142
+ key: 'getFieldName',
143
+ value: function getFieldName(name) {
144
+ var _props = this.props,
145
+ fieldNames = _props.fieldNames,
146
+ defaultFieldNames = _props.defaultFieldNames;
147
+ // 防止只设置单个属性的名字
148
+
149
+ return fieldNames[name] || defaultFieldNames[name];
150
+ }
151
+ }, {
152
+ key: 'getOption',
153
+ value: function getOption(option, menuIndex) {
154
+ var _props2 = this.props,
155
+ prefixCls = _props2.prefixCls,
156
+ expandTrigger = _props2.expandTrigger,
157
+ expandIcon = _props2.expandIcon,
158
+ loadingIcon = _props2.loadingIcon;
159
+
160
+ var onSelect = this.props.onSelect.bind(this, option, menuIndex);
161
+ var onItemDoubleClick = this.props.onItemDoubleClick.bind(this, option, menuIndex);
162
+ var expandProps = {
163
+ onClick: onSelect,
164
+ onDoubleClick: onItemDoubleClick
165
+ };
166
+ var menuItemCls = prefixCls + '-menu-item';
167
+ var expandIconNode = null;
168
+ var hasChildren = option[this.getFieldName('children')] && option[this.getFieldName('children')].length > 0;
169
+ if (hasChildren || option.isLeaf === false) {
170
+ menuItemCls += ' ' + prefixCls + '-menu-item-expand';
171
+ if (!option.loading) {
172
+ expandIconNode = React__default.createElement(
173
+ 'span',
174
+ { className: prefixCls + '-menu-item-expand-icon' },
175
+ expandIcon
176
+ );
177
+ }
178
+ }
179
+ if (expandTrigger === 'hover' && (hasChildren || option.isLeaf === false)) {
180
+ expandProps = {
181
+ onMouseEnter: this.delayOnSelect.bind(this, onSelect),
182
+ onMouseLeave: this.delayOnSelect.bind(this),
183
+ onClick: onSelect
184
+ };
185
+ }
186
+ if (this.isActiveOption(option, menuIndex)) {
187
+ menuItemCls += ' ' + prefixCls + '-menu-item-active';
188
+ expandProps.ref = this.saveMenuItem(menuIndex);
189
+ }
190
+ if (option.disabled) {
191
+ menuItemCls += ' ' + prefixCls + '-menu-item-disabled';
192
+ }
193
+
194
+ var loadingIconNode = null;
195
+ if (option.loading) {
196
+ menuItemCls += ' ' + prefixCls + '-menu-item-loading';
197
+ loadingIconNode = loadingIcon || null;
198
+ }
199
+
200
+ var title = '';
201
+ if ('title' in option) {
202
+ title = option.title;
203
+ } else if (typeof option[this.getFieldName('label')] === 'string') {
204
+ title = option[this.getFieldName('label')];
205
+ }
206
+
207
+ return React__default.createElement(
208
+ 'li',
209
+ _extends$2({
210
+ key: option[this.getFieldName('value')],
211
+ className: menuItemCls,
212
+ title: title
213
+ }, expandProps, {
214
+ role: 'menuitem',
215
+ onMouseDown: function onMouseDown(e) {
216
+ return e.preventDefault();
217
+ }
218
+ }),
219
+ option[this.getFieldName('label')],
220
+ expandIconNode,
221
+ loadingIconNode
222
+ );
223
+ }
224
+ }, {
225
+ key: 'getActiveOptions',
226
+ value: function getActiveOptions(values) {
227
+ var _this2 = this;
228
+
229
+ var activeValue = values || this.props.activeValue;
230
+ var options = this.props.options;
231
+ return arrayTreeFilter(options, function (o, level) {
232
+ return o[_this2.getFieldName('value')] === activeValue[level];
233
+ }, { childrenKeyName: this.getFieldName('children') });
234
+ }
235
+ }, {
236
+ key: 'getShowOptions',
237
+ value: function getShowOptions() {
238
+ var _this3 = this;
239
+
240
+ var options = this.props.options;
241
+
242
+ var result = this.getActiveOptions().map(function (activeOption) {
243
+ return activeOption[_this3.getFieldName('children')];
244
+ }).filter(function (activeOption) {
245
+ return !!activeOption;
246
+ });
247
+ result.unshift(options);
248
+ return result;
249
+ }
250
+ }, {
251
+ key: 'delayOnSelect',
252
+ value: function delayOnSelect(onSelect) {
253
+ var _this4 = this;
254
+
255
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
256
+ args[_key - 1] = arguments[_key];
257
+ }
258
+
259
+ if (this.delayTimer) {
260
+ clearTimeout(this.delayTimer);
261
+ this.delayTimer = null;
262
+ }
263
+ if (typeof onSelect === 'function') {
264
+ this.delayTimer = setTimeout(function () {
265
+ onSelect(args);
266
+ _this4.delayTimer = null;
267
+ }, 150);
268
+ }
269
+ }
270
+ }, {
271
+ key: 'scrollActiveItemToView',
272
+ value: function scrollActiveItemToView() {
273
+ // scroll into view
274
+ var optionsLength = this.getShowOptions().length;
275
+ for (var i = 0; i < optionsLength; i++) {
276
+ var itemComponent = this.menuItems[i];
277
+ if (itemComponent) {
278
+ var target = findDOMNode(itemComponent);
279
+ target.parentNode.scrollTop = target.offsetTop;
280
+ }
281
+ }
282
+ }
283
+ }, {
284
+ key: 'isActiveOption',
285
+ value: function isActiveOption(option, menuIndex) {
286
+ var _props$activeValue = this.props.activeValue,
287
+ activeValue = _props$activeValue === undefined ? [] : _props$activeValue;
288
+
289
+ return activeValue[menuIndex] === option[this.getFieldName('value')];
290
+ }
291
+ }, {
292
+ key: 'render',
293
+ value: function render() {
294
+ var _this5 = this;
295
+
296
+ var _props3 = this.props,
297
+ prefixCls = _props3.prefixCls,
298
+ dropdownMenuColumnStyle = _props3.dropdownMenuColumnStyle;
299
+
300
+ return React__default.createElement(
301
+ 'div',
302
+ null,
303
+ this.getShowOptions().map(function (options, menuIndex) {
304
+ return React__default.createElement(
305
+ 'ul',
306
+ { className: prefixCls + '-menu', key: menuIndex, style: dropdownMenuColumnStyle },
307
+ options.map(function (option) {
308
+ return _this5.getOption(option, menuIndex);
309
+ })
310
+ );
311
+ })
312
+ );
313
+ }
314
+ }]);
315
+
316
+ return Menus;
317
+ }(React__default.Component);
318
+
319
+ Menus.defaultProps = {
320
+ options: [],
321
+ value: [],
322
+ activeValue: [],
323
+ onSelect: function onSelect() {},
324
+
325
+ prefixCls: 'rc-cascader-menus',
326
+ visible: false,
327
+ expandTrigger: 'click'
328
+ };
329
+
330
+ Menus.propTypes = {
331
+ value: PropTypes.array,
332
+ activeValue: PropTypes.array,
333
+ options: PropTypes.array,
334
+ prefixCls: PropTypes.string,
335
+ expandTrigger: PropTypes.string,
336
+ onSelect: PropTypes.func,
337
+ visible: PropTypes.bool,
338
+ dropdownMenuColumnStyle: PropTypes.object,
339
+ defaultFieldNames: PropTypes.object,
340
+ fieldNames: PropTypes.object,
341
+ expandIcon: PropTypes.node,
342
+ loadingIcon: PropTypes.node,
343
+ onItemDoubleClick: PropTypes.func
344
+ };
345
+
346
+ var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
347
+
348
+ var _createClass$1 = 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; }; }();
349
+
350
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
351
+
352
+ 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); } }
353
+
354
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
355
+
356
+ function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
357
+
358
+ function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
359
+
360
+ var BUILT_IN_PLACEMENTS = {
361
+ bottomLeft: {
362
+ points: ['tl', 'bl'],
363
+ offset: [0, 4],
364
+ overflow: {
365
+ adjustX: 1,
366
+ adjustY: 1
367
+ }
368
+ },
369
+ topLeft: {
370
+ points: ['bl', 'tl'],
371
+ offset: [0, -4],
372
+ overflow: {
373
+ adjustX: 1,
374
+ adjustY: 1
375
+ }
376
+ },
377
+ bottomRight: {
378
+ points: ['tr', 'br'],
379
+ offset: [0, 4],
380
+ overflow: {
381
+ adjustX: 1,
382
+ adjustY: 1
383
+ }
384
+ },
385
+ topRight: {
386
+ points: ['br', 'tr'],
387
+ offset: [0, -4],
388
+ overflow: {
389
+ adjustX: 1,
390
+ adjustY: 1
391
+ }
392
+ }
393
+ };
394
+
395
+ var Cascader$1 = function (_Component) {
396
+ _inherits$1(Cascader, _Component);
397
+
398
+ function Cascader(props) {
399
+ _classCallCheck$1(this, Cascader);
400
+
401
+ var _this = _possibleConstructorReturn$1(this, (Cascader.__proto__ || Object.getPrototypeOf(Cascader)).call(this, props));
402
+
403
+ _this.setPopupVisible = function (popupVisible) {
404
+ if (!('popupVisible' in _this.props)) {
405
+ _this.setState({ popupVisible: popupVisible });
406
+ }
407
+ // sync activeValue with value when panel open
408
+ if (popupVisible && !_this.state.popupVisible) {
409
+ _this.setState({
410
+ activeValue: _this.state.value
411
+ });
412
+ }
413
+ _this.props.onPopupVisibleChange(popupVisible);
414
+ };
415
+
416
+ _this.handleChange = function (options, setProps, e) {
417
+ if (e.type !== 'keydown' || e.keyCode === KeyCode.ENTER) {
418
+ _this.props.onChange(options.map(function (o) {
419
+ return o[_this.getFieldName('value')];
420
+ }), options);
421
+ _this.setPopupVisible(setProps.visible);
422
+ }
423
+ };
424
+
425
+ _this.handlePopupVisibleChange = function (popupVisible) {
426
+ _this.setPopupVisible(popupVisible);
427
+ };
428
+
429
+ _this.handleMenuSelect = function (targetOption, menuIndex, e) {
430
+ // Keep focused state for keyboard support
431
+ var triggerNode = _this.trigger.getRootDomNode();
432
+ if (triggerNode && triggerNode.focus) {
433
+ triggerNode.focus();
434
+ }
435
+ var _this$props = _this.props,
436
+ changeOnSelect = _this$props.changeOnSelect,
437
+ loadData = _this$props.loadData,
438
+ expandTrigger = _this$props.expandTrigger;
439
+
440
+ if (!targetOption || targetOption.disabled) {
441
+ return;
442
+ }
443
+ var activeValue = _this.state.activeValue;
444
+
445
+ activeValue = activeValue.slice(0, menuIndex + 1);
446
+ activeValue[menuIndex] = targetOption[_this.getFieldName('value')];
447
+ var activeOptions = _this.getActiveOptions(activeValue);
448
+ if (targetOption.isLeaf === false && !targetOption[_this.getFieldName('children')] && loadData) {
449
+ if (changeOnSelect) {
450
+ _this.handleChange(activeOptions, { visible: true }, e);
451
+ }
452
+ _this.setState({ activeValue: activeValue });
453
+ loadData(activeOptions);
454
+ return;
455
+ }
456
+ var newState = {};
457
+ if (!targetOption[_this.getFieldName('children')] || !targetOption[_this.getFieldName('children')].length) {
458
+ _this.handleChange(activeOptions, { visible: false }, e);
459
+ // set value to activeValue when select leaf option
460
+ newState.value = activeValue;
461
+ // add e.type judgement to prevent `onChange` being triggered by mouseEnter
462
+ } else if (changeOnSelect && (e.type === 'click' || e.type === 'keydown')) {
463
+ if (expandTrigger === 'hover') {
464
+ _this.handleChange(activeOptions, { visible: false }, e);
465
+ } else {
466
+ _this.handleChange(activeOptions, { visible: true }, e);
467
+ }
468
+ // set value to activeValue on every select
469
+ newState.value = activeValue;
470
+ }
471
+ newState.activeValue = activeValue;
472
+ // not change the value by keyboard
473
+ if ('value' in _this.props || e.type === 'keydown' && e.keyCode !== KeyCode.ENTER) {
474
+ delete newState.value;
475
+ }
476
+ _this.setState(newState);
477
+ };
478
+
479
+ _this.handleItemDoubleClick = function () {
480
+ var changeOnSelect = _this.props.changeOnSelect;
481
+
482
+ if (changeOnSelect) {
483
+ _this.setPopupVisible(false);
484
+ }
485
+ };
486
+
487
+ _this.handleKeyDown = function (e) {
488
+ var children = _this.props.children;
489
+ // https://github.com/ant-design/ant-design/issues/6717
490
+ // Don't bind keyboard support when children specify the onKeyDown
491
+
492
+ if (children && children.props.onKeyDown) {
493
+ children.props.onKeyDown(e);
494
+ return;
495
+ }
496
+ var activeValue = [].concat(_toConsumableArray(_this.state.activeValue));
497
+ var currentLevel = activeValue.length - 1 < 0 ? 0 : activeValue.length - 1;
498
+ var currentOptions = _this.getCurrentLevelOptions();
499
+ var currentIndex = currentOptions.map(function (o) {
500
+ return o[_this.getFieldName('value')];
501
+ }).indexOf(activeValue[currentLevel]);
502
+ if (e.keyCode !== KeyCode.DOWN && e.keyCode !== KeyCode.UP && e.keyCode !== KeyCode.LEFT && e.keyCode !== KeyCode.RIGHT && e.keyCode !== KeyCode.ENTER && e.keyCode !== KeyCode.SPACE && e.keyCode !== KeyCode.BACKSPACE && e.keyCode !== KeyCode.ESC && e.keyCode !== KeyCode.TAB) {
503
+ return;
504
+ }
505
+ // Press any keys above to reopen menu
506
+ if (!_this.state.popupVisible && e.keyCode !== KeyCode.BACKSPACE && e.keyCode !== KeyCode.LEFT && e.keyCode !== KeyCode.RIGHT && e.keyCode !== KeyCode.ESC && e.keyCode !== KeyCode.TAB) {
507
+ _this.setPopupVisible(true);
508
+ return;
509
+ }
510
+ if (e.keyCode === KeyCode.DOWN || e.keyCode === KeyCode.UP) {
511
+ e.preventDefault();
512
+ var nextIndex = currentIndex;
513
+ if (nextIndex !== -1) {
514
+ if (e.keyCode === KeyCode.DOWN) {
515
+ nextIndex += 1;
516
+ nextIndex = nextIndex >= currentOptions.length ? 0 : nextIndex;
517
+ } else {
518
+ nextIndex -= 1;
519
+ nextIndex = nextIndex < 0 ? currentOptions.length - 1 : nextIndex;
520
+ }
521
+ } else {
522
+ nextIndex = 0;
523
+ }
524
+ activeValue[currentLevel] = currentOptions[nextIndex][_this.getFieldName('value')];
525
+ } else if (e.keyCode === KeyCode.LEFT || e.keyCode === KeyCode.BACKSPACE) {
526
+ e.preventDefault();
527
+ activeValue.splice(activeValue.length - 1, 1);
528
+ } else if (e.keyCode === KeyCode.RIGHT) {
529
+ e.preventDefault();
530
+ if (currentOptions[currentIndex] && currentOptions[currentIndex][_this.getFieldName('children')]) {
531
+ activeValue.push(currentOptions[currentIndex][_this.getFieldName('children')][0][_this.getFieldName('value')]);
532
+ }
533
+ } else if (e.keyCode === KeyCode.ESC || e.keyCode === KeyCode.TAB) {
534
+ _this.setPopupVisible(false);
535
+ return;
536
+ }
537
+ if (!activeValue || activeValue.length === 0) {
538
+ _this.setPopupVisible(false);
539
+ }
540
+ var activeOptions = _this.getActiveOptions(activeValue);
541
+ var targetOption = activeOptions[activeOptions.length - 1];
542
+ _this.handleMenuSelect(targetOption, activeOptions.length - 1, e);
543
+
544
+ if (_this.props.onKeyDown) {
545
+ _this.props.onKeyDown(e);
546
+ }
547
+ };
548
+
549
+ _this.saveTrigger = function (node) {
550
+ _this.trigger = node;
551
+ };
552
+
553
+ var initialValue = [];
554
+ if ('value' in props) {
555
+ initialValue = props.value || [];
556
+ } else if ('defaultValue' in props) {
557
+ initialValue = props.defaultValue || [];
558
+ }
559
+
560
+ warning(!('filedNames' in props), '`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead.');
561
+
562
+ _this.state = {
563
+ popupVisible: props.popupVisible,
564
+ activeValue: initialValue,
565
+ value: initialValue,
566
+ prevProps: props
567
+ };
568
+ _this.defaultFieldNames = { label: 'label', value: 'value', children: 'children' };
569
+ return _this;
570
+ }
571
+
572
+ _createClass$1(Cascader, [{
573
+ key: 'getPopupDOMNode',
574
+ value: function getPopupDOMNode() {
575
+ return this.trigger.getPopupDomNode();
576
+ }
577
+ }, {
578
+ key: 'getFieldName',
579
+ value: function getFieldName(name) {
580
+ var defaultFieldNames = this.defaultFieldNames;
581
+ var _props = this.props,
582
+ fieldNames = _props.fieldNames,
583
+ filedNames = _props.filedNames;
584
+
585
+ if ('filedNames' in this.props) {
586
+ return filedNames[name] || defaultFieldNames[name]; // For old compatibility
587
+ }
588
+ return fieldNames[name] || defaultFieldNames[name];
589
+ }
590
+ }, {
591
+ key: 'getFieldNames',
592
+ value: function getFieldNames() {
593
+ var _props2 = this.props,
594
+ fieldNames = _props2.fieldNames,
595
+ filedNames = _props2.filedNames;
596
+
597
+ if ('filedNames' in this.props) {
598
+ return filedNames; // For old compatibility
599
+ }
600
+ return fieldNames;
601
+ }
602
+ }, {
603
+ key: 'getCurrentLevelOptions',
604
+ value: function getCurrentLevelOptions() {
605
+ var _this2 = this;
606
+
607
+ var _props$options = this.props.options,
608
+ options = _props$options === undefined ? [] : _props$options;
609
+ var _state$activeValue = this.state.activeValue,
610
+ activeValue = _state$activeValue === undefined ? [] : _state$activeValue;
611
+
612
+ var result = arrayTreeFilter(options, function (o, level) {
613
+ return o[_this2.getFieldName('value')] === activeValue[level];
614
+ }, { childrenKeyName: this.getFieldName('children') });
615
+ if (result[result.length - 2]) {
616
+ return result[result.length - 2][this.getFieldName('children')];
617
+ }
618
+ return [].concat(_toConsumableArray(options)).filter(function (o) {
619
+ return !o.disabled;
620
+ });
621
+ }
622
+ }, {
623
+ key: 'getActiveOptions',
624
+ value: function getActiveOptions(activeValue) {
625
+ var _this3 = this;
626
+
627
+ return arrayTreeFilter(this.props.options || [], function (o, level) {
628
+ return o[_this3.getFieldName('value')] === activeValue[level];
629
+ }, { childrenKeyName: this.getFieldName('children') });
630
+ }
631
+ }, {
632
+ key: 'render',
633
+ value: function render() {
634
+ var _props3 = this.props,
635
+ prefixCls = _props3.prefixCls,
636
+ transitionName = _props3.transitionName,
637
+ popupClassName = _props3.popupClassName,
638
+ _props3$options = _props3.options,
639
+ options = _props3$options === undefined ? [] : _props3$options,
640
+ disabled = _props3.disabled,
641
+ builtinPlacements = _props3.builtinPlacements,
642
+ popupPlacement = _props3.popupPlacement,
643
+ children = _props3.children,
644
+ restProps = _objectWithoutProperties(_props3, ['prefixCls', 'transitionName', 'popupClassName', 'options', 'disabled', 'builtinPlacements', 'popupPlacement', 'children']);
645
+ // Did not show popup when there is no options
646
+
647
+
648
+ var menus = React__default.createElement('div', null);
649
+ var emptyMenuClassName = '';
650
+ if (options && options.length > 0) {
651
+ menus = React__default.createElement(Menus, _extends$1({}, this.props, {
652
+ fieldNames: this.getFieldNames(),
653
+ defaultFieldNames: this.defaultFieldNames,
654
+ activeValue: this.state.activeValue,
655
+ onSelect: this.handleMenuSelect,
656
+ onItemDoubleClick: this.handleItemDoubleClick,
657
+ visible: this.state.popupVisible
658
+ }));
659
+ } else {
660
+ emptyMenuClassName = ' ' + prefixCls + '-menus-empty';
661
+ }
662
+ return React__default.createElement(
663
+ Trigger,
664
+ _extends$1({
665
+ ref: this.saveTrigger
666
+ }, restProps, {
667
+ options: options,
668
+ disabled: disabled,
669
+ popupPlacement: popupPlacement,
670
+ builtinPlacements: builtinPlacements,
671
+ popupTransitionName: transitionName,
672
+ action: disabled ? [] : ['click'],
673
+ popupVisible: disabled ? false : this.state.popupVisible,
674
+ onPopupVisibleChange: this.handlePopupVisibleChange,
675
+ prefixCls: prefixCls + '-menus',
676
+ popupClassName: popupClassName + emptyMenuClassName,
677
+ popup: menus
678
+ }),
679
+ cloneElement(children, {
680
+ onKeyDown: this.handleKeyDown,
681
+ tabIndex: disabled ? undefined : 0
682
+ })
683
+ );
684
+ }
685
+ }], [{
686
+ key: 'getDerivedStateFromProps',
687
+ value: function getDerivedStateFromProps(nextProps, prevState) {
688
+ var _prevState$prevProps = prevState.prevProps,
689
+ prevProps = _prevState$prevProps === undefined ? {} : _prevState$prevProps;
690
+
691
+ var newState = {
692
+ prevProps: nextProps
693
+ };
694
+
695
+ if ('value' in nextProps && !shallowEqualArrays(prevProps.value, nextProps.value)) {
696
+ newState.value = nextProps.value || [];
697
+
698
+ // allow activeValue diff from value
699
+ // https://github.com/ant-design/ant-design/issues/2767
700
+ if (!('loadData' in nextProps)) {
701
+ newState.activeValue = nextProps.value || [];
702
+ }
703
+ }
704
+ if ('popupVisible' in nextProps) {
705
+ newState.popupVisible = nextProps.popupVisible;
706
+ }
707
+
708
+ return newState;
709
+ }
710
+ }]);
711
+
712
+ return Cascader;
713
+ }(Component);
714
+
715
+ Cascader$1.defaultProps = {
716
+ onChange: function onChange() {},
717
+ onPopupVisibleChange: function onPopupVisibleChange() {},
718
+
719
+ disabled: false,
720
+ transitionName: '',
721
+ prefixCls: 'rc-cascader',
722
+ popupClassName: '',
723
+ popupPlacement: 'bottomLeft',
724
+ builtinPlacements: BUILT_IN_PLACEMENTS,
725
+ expandTrigger: 'click',
726
+ fieldNames: { label: 'label', value: 'value', children: 'children' },
727
+ expandIcon: '>'
728
+ };
729
+
730
+ Cascader$1.propTypes = {
731
+ value: PropTypes.array,
732
+ defaultValue: PropTypes.array,
733
+ options: PropTypes.array.isRequired,
734
+ onChange: PropTypes.func,
735
+ onPopupVisibleChange: PropTypes.func,
736
+ popupVisible: PropTypes.bool,
737
+ disabled: PropTypes.bool,
738
+ transitionName: PropTypes.string,
739
+ popupClassName: PropTypes.string,
740
+ popupPlacement: PropTypes.string,
741
+ prefixCls: PropTypes.string,
742
+ dropdownMenuColumnStyle: PropTypes.object,
743
+ builtinPlacements: PropTypes.object,
744
+ loadData: PropTypes.func,
745
+ changeOnSelect: PropTypes.bool,
746
+ children: PropTypes.node,
747
+ onKeyDown: PropTypes.func,
748
+ expandTrigger: PropTypes.string,
749
+ fieldNames: PropTypes.object,
750
+ filedNames: PropTypes.object, // typo but for compatibility
751
+ expandIcon: PropTypes.node,
752
+ loadingIcon: PropTypes.node
753
+ };
754
+
755
+ polyfill(Cascader$1);
756
+
757
+ 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); }
758
+
759
+ 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); }
760
+
761
+ 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; }
762
+
763
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
764
+
765
+ 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); } }
766
+
767
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
768
+
769
+ 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); }
770
+
771
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
772
+
773
+ 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); }; }
774
+
775
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
776
+
777
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
778
+
779
+ 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; } }
780
+
781
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
782
+
783
+ var __rest = undefined && undefined.__rest || function (s, e) {
784
+ var t = {};
785
+
786
+ for (var p in s) {
787
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
788
+ }
789
+
790
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
791
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
792
+ }
793
+ return t;
794
+ };
795
+
796
+ var defaultLimit = 50;
797
+
798
+ function highlightKeyword(str, keyword, prefixCls) {
799
+ return str.split(keyword).map(function (node, index) {
800
+ return index === 0 ? node : [/*#__PURE__*/React.createElement("span", {
801
+ className: "".concat(prefixCls, "-menu-item-keyword"),
802
+ key: "seperator"
803
+ }, keyword), node];
804
+ });
805
+ }
806
+
807
+ function defaultFilterOption(inputValue, path, names) {
808
+ return path.some(function (option) {
809
+ return option[names.label].indexOf(inputValue) > -1;
810
+ });
811
+ }
812
+
813
+ function defaultRenderFilteredOption(inputValue, path, prefixCls, names) {
814
+ return path.map(function (option, index) {
815
+ var label = option[names.label];
816
+ var node = label.indexOf(inputValue) > -1 ? highlightKeyword(label, inputValue, prefixCls) : label;
817
+ return index === 0 ? node : [' / ', node];
818
+ });
819
+ }
820
+
821
+ function defaultSortFilteredOption(a, b, inputValue, names) {
822
+ function callback(elem) {
823
+ return elem[names.label].indexOf(inputValue) > -1;
824
+ }
825
+
826
+ return a.findIndex(callback) - b.findIndex(callback);
827
+ }
828
+
829
+ function getFieldNames(props) {
830
+ var fieldNames = props.fieldNames,
831
+ filedNames = props.filedNames;
832
+
833
+ if ('filedNames' in props) {
834
+ return filedNames; // For old compatibility
835
+ }
836
+
837
+ return fieldNames;
838
+ }
839
+
840
+ function getFilledFieldNames(props) {
841
+ var fieldNames = getFieldNames(props) || {};
842
+ var names = {
843
+ children: fieldNames.children || 'children',
844
+ label: fieldNames.label || 'label',
845
+ value: fieldNames.value || 'value'
846
+ };
847
+ return names;
848
+ }
849
+
850
+ function flattenTree(options, props) {
851
+ var ancestor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
852
+ var names = getFilledFieldNames(props);
853
+ var flattenOptions = [];
854
+ var childrenName = names.children;
855
+ options.forEach(function (option) {
856
+ var path = ancestor.concat(option);
857
+
858
+ if (props.changeOnSelect || !option[childrenName] || !option[childrenName].length) {
859
+ flattenOptions.push(path);
860
+ }
861
+
862
+ if (option[childrenName]) {
863
+ flattenOptions = flattenOptions.concat(flattenTree(option[childrenName], props, path));
864
+ }
865
+ });
866
+ return flattenOptions;
867
+ }
868
+
869
+ var defaultDisplayRender = function defaultDisplayRender(label) {
870
+ return label.join(' / ');
871
+ };
872
+
873
+ var Cascader = /*#__PURE__*/function (_React$Component) {
874
+ _inherits(Cascader, _React$Component);
875
+
876
+ var _super = _createSuper(Cascader);
877
+
878
+ function Cascader(props) {
879
+ var _this;
880
+
881
+ _classCallCheck(this, Cascader);
882
+
883
+ _this = _super.call(this, props);
884
+ _this.cachedOptions = [];
885
+
886
+ _this.setValue = function (value) {
887
+ var selectedOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
888
+
889
+ if (!('value' in _this.props)) {
890
+ _this.setState({
891
+ value: value
892
+ });
893
+ }
894
+
895
+ var onChange = _this.props.onChange;
896
+
897
+ if (onChange) {
898
+ onChange(value, selectedOptions);
899
+ }
900
+ };
901
+
902
+ _this.saveInput = function (node) {
903
+ _this.input = node;
904
+ };
905
+
906
+ _this.handleChange = function (value, selectedOptions) {
907
+ _this.setState({
908
+ inputValue: ''
909
+ });
910
+
911
+ if (selectedOptions[0].__IS_FILTERED_OPTION) {
912
+ var unwrappedValue = value[0];
913
+ var unwrappedSelectedOptions = selectedOptions[0].path;
914
+
915
+ _this.setValue(unwrappedValue, unwrappedSelectedOptions);
916
+
917
+ return;
918
+ }
919
+
920
+ _this.setValue(value, selectedOptions);
921
+ };
922
+
923
+ _this.handlePopupVisibleChange = function (popupVisible) {
924
+ if (!('popupVisible' in _this.props)) {
925
+ _this.setState(function (state) {
926
+ return {
927
+ popupVisible: popupVisible,
928
+ inputFocused: popupVisible,
929
+ inputValue: popupVisible ? state.inputValue : ''
930
+ };
931
+ });
932
+ }
933
+
934
+ var onPopupVisibleChange = _this.props.onPopupVisibleChange;
935
+
936
+ if (onPopupVisibleChange) {
937
+ onPopupVisibleChange(popupVisible);
938
+ }
939
+ };
940
+
941
+ _this.handleInputBlur = function () {
942
+ _this.setState({
943
+ inputFocused: false
944
+ });
945
+ };
946
+
947
+ _this.handleInputClick = function (e) {
948
+ var _this$state = _this.state,
949
+ inputFocused = _this$state.inputFocused,
950
+ popupVisible = _this$state.popupVisible; // Prevent `Trigger` behaviour.
951
+
952
+ if (inputFocused || popupVisible) {
953
+ e.stopPropagation();
954
+
955
+ if (e.nativeEvent.stopImmediatePropagation) {
956
+ e.nativeEvent.stopImmediatePropagation();
957
+ }
958
+ }
959
+ };
960
+
961
+ _this.handleKeyDown = function (e) {
962
+ // SPACE => https://github.com/ant-design/ant-design/issues/16871
963
+ if (e.keyCode === KeyCode.BACKSPACE || e.keyCode === KeyCode.SPACE) {
964
+ e.stopPropagation();
965
+ }
966
+ };
967
+
968
+ _this.handleInputChange = function (e) {
969
+ var inputValue = e.target.value;
970
+
971
+ _this.setState({
972
+ inputValue: inputValue
973
+ });
974
+ };
975
+
976
+ _this.clearSelection = function (e) {
977
+ e.preventDefault();
978
+ e.stopPropagation();
979
+
980
+ if (!_this.state.inputValue) {
981
+ _this.setValue([]);
982
+
983
+ _this.handlePopupVisibleChange(false);
984
+ } else {
985
+ _this.setState({
986
+ inputValue: ''
987
+ });
988
+ }
989
+ };
990
+
991
+ _this.renderCascader = function (_ref, locale) {
992
+ var _classNames, _classNames2, _classNames3, _classNames4;
993
+
994
+ var getContextPopupContainer = _ref.getPopupContainer,
995
+ getPrefixCls = _ref.getPrefixCls,
996
+ renderEmpty = _ref.renderEmpty;
997
+
998
+ var _assertThisInitialize = _assertThisInitialized(_this),
999
+ props = _assertThisInitialize.props,
1000
+ state = _assertThisInitialize.state;
1001
+
1002
+ var customizePrefixCls = props.prefixCls,
1003
+ customizeInputPrefixCls = props.inputPrefixCls,
1004
+ children = props.children,
1005
+ _props$placeholder = props.placeholder,
1006
+ placeholder = _props$placeholder === void 0 ? locale.placeholder || 'Please select' : _props$placeholder,
1007
+ size = props.size,
1008
+ disabled = props.disabled,
1009
+ className = props.className,
1010
+ style = props.style,
1011
+ allowClear = props.allowClear,
1012
+ _props$showSearch = props.showSearch,
1013
+ showSearch = _props$showSearch === void 0 ? false : _props$showSearch,
1014
+ suffixIcon = props.suffixIcon,
1015
+ notFoundContent = props.notFoundContent,
1016
+ otherProps = __rest(props, ["prefixCls", "inputPrefixCls", "children", "placeholder", "size", "disabled", "className", "style", "allowClear", "showSearch", "suffixIcon", "notFoundContent"]);
1017
+
1018
+ var value = state.value,
1019
+ inputFocused = state.inputFocused;
1020
+ var prefixCls = getPrefixCls('cascader', customizePrefixCls);
1021
+ var inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
1022
+ var sizeCls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(inputPrefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(inputPrefixCls, "-sm"), size === 'small'), _classNames));
1023
+ var clearIcon = allowClear && !disabled && value.length > 0 || state.inputValue ? /*#__PURE__*/React.createElement(Icon, {
1024
+ type: "close-circle",
1025
+ theme: "filled",
1026
+ className: "".concat(prefixCls, "-picker-clear"),
1027
+ onClick: _this.clearSelection
1028
+ }) : null;
1029
+ var arrowCls = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-picker-arrow"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-picker-arrow-expand"), state.popupVisible), _classNames2));
1030
+ var pickerCls = classNames(className, "".concat(prefixCls, "-picker"), (_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefixCls, "-picker-with-value"), state.inputValue), _defineProperty(_classNames3, "".concat(prefixCls, "-picker-disabled"), disabled), _defineProperty(_classNames3, "".concat(prefixCls, "-picker-").concat(size), !!size), _defineProperty(_classNames3, "".concat(prefixCls, "-picker-show-search"), !!showSearch), _defineProperty(_classNames3, "".concat(prefixCls, "-picker-focused"), inputFocused), _classNames3)); // Fix bug of https://github.com/facebook/react/pull/5004
1031
+ // and https://fb.me/react-unknown-prop
1032
+
1033
+ var inputProps = omit(otherProps, ['onChange', 'options', 'popupPlacement', 'transitionName', 'displayRender', 'onPopupVisibleChange', 'changeOnSelect', 'expandTrigger', 'popupVisible', 'getPopupContainer', 'loadData', 'popupClassName', 'filterOption', 'renderFilteredOption', 'sortFilteredOption', 'notFoundContent', 'fieldNames', 'filedNames']);
1034
+ var options = props.options;
1035
+ var names = getFilledFieldNames(_this.props);
1036
+
1037
+ if (options && options.length > 0) {
1038
+ if (state.inputValue) {
1039
+ options = _this.generateFilteredOptions(prefixCls, renderEmpty);
1040
+ }
1041
+ } else {
1042
+ var _ref2;
1043
+
1044
+ options = [(_ref2 = {}, _defineProperty(_ref2, names.value, 'ANT_CASCADER_NOT_FOUND'), _defineProperty(_ref2, names.label, notFoundContent || renderEmpty('Cascader')), _defineProperty(_ref2, "disabled", true), _defineProperty(_ref2, "isEmptyNode", true), _ref2)];
1045
+ } // Dropdown menu should keep previous status until it is fully closed.
1046
+
1047
+
1048
+ if (!state.popupVisible) {
1049
+ options = _this.cachedOptions;
1050
+ } else {
1051
+ _this.cachedOptions = options;
1052
+ }
1053
+
1054
+ var dropdownMenuColumnStyle = {};
1055
+ var isNotFound = (options || []).length === 1 && options[0].isEmptyNode;
1056
+
1057
+ if (isNotFound) {
1058
+ dropdownMenuColumnStyle.height = 'auto'; // Height of one row.
1059
+ } // The default value of `matchInputWidth` is `true`
1060
+
1061
+
1062
+ var resultListMatchInputWidth = showSearch.matchInputWidth !== false;
1063
+
1064
+ if (resultListMatchInputWidth && (state.inputValue || isNotFound) && _this.input) {
1065
+ dropdownMenuColumnStyle.width = _this.input.input.offsetWidth;
1066
+ }
1067
+
1068
+ var inputIcon = suffixIcon && ( /*#__PURE__*/React.isValidElement(suffixIcon) ? /*#__PURE__*/React.cloneElement(suffixIcon, {
1069
+ className: classNames((_classNames4 = {}, _defineProperty(_classNames4, suffixIcon.props.className, suffixIcon.props.className), _defineProperty(_classNames4, "".concat(prefixCls, "-picker-arrow"), true), _classNames4))
1070
+ }) : /*#__PURE__*/React.createElement("span", {
1071
+ className: "".concat(prefixCls, "-picker-arrow")
1072
+ }, suffixIcon)) || /*#__PURE__*/React.createElement(Icon, {
1073
+ type: "down",
1074
+ className: arrowCls
1075
+ });
1076
+ var input = children || /*#__PURE__*/React.createElement("span", {
1077
+ style: style,
1078
+ className: pickerCls
1079
+ }, /*#__PURE__*/React.createElement("span", {
1080
+ className: "".concat(prefixCls, "-picker-label")
1081
+ }, _this.getLabel()), /*#__PURE__*/React.createElement(Input, _extends({}, inputProps, {
1082
+ tabIndex: "-1",
1083
+ ref: _this.saveInput,
1084
+ prefixCls: inputPrefixCls,
1085
+ placeholder: value && value.length > 0 ? undefined : placeholder,
1086
+ className: "".concat(prefixCls, "-input ").concat(sizeCls),
1087
+ value: state.inputValue,
1088
+ disabled: disabled,
1089
+ readOnly: !showSearch,
1090
+ autoComplete: inputProps.autoComplete || 'off',
1091
+ onClick: showSearch ? _this.handleInputClick : undefined,
1092
+ onBlur: showSearch ? _this.handleInputBlur : undefined,
1093
+ onKeyDown: _this.handleKeyDown,
1094
+ onChange: showSearch ? _this.handleInputChange : undefined
1095
+ })), clearIcon, inputIcon);
1096
+ var expandIcon = /*#__PURE__*/React.createElement(Icon, {
1097
+ type: "right"
1098
+ });
1099
+ var loadingIcon = /*#__PURE__*/React.createElement("span", {
1100
+ className: "".concat(prefixCls, "-menu-item-loading-icon")
1101
+ }, /*#__PURE__*/React.createElement(Icon, {
1102
+ type: "redo",
1103
+ spin: true
1104
+ }));
1105
+ var getPopupContainer = props.getPopupContainer || getContextPopupContainer;
1106
+ var rest = omit(props, ['inputIcon', 'expandIcon', 'loadingIcon']);
1107
+ return /*#__PURE__*/React.createElement(Cascader$1, _extends({}, rest, {
1108
+ prefixCls: prefixCls,
1109
+ getPopupContainer: getPopupContainer,
1110
+ options: options,
1111
+ value: value,
1112
+ popupVisible: state.popupVisible,
1113
+ onPopupVisibleChange: _this.handlePopupVisibleChange,
1114
+ onChange: _this.handleChange,
1115
+ dropdownMenuColumnStyle: dropdownMenuColumnStyle,
1116
+ expandIcon: expandIcon,
1117
+ loadingIcon: loadingIcon
1118
+ }), input);
1119
+ };
1120
+
1121
+ _this.state = {
1122
+ value: props.value || props.defaultValue || [],
1123
+ inputValue: '',
1124
+ inputFocused: false,
1125
+ popupVisible: props.popupVisible,
1126
+ flattenOptions: props.showSearch ? flattenTree(props.options, props) : undefined,
1127
+ prevProps: props
1128
+ };
1129
+ return _this;
1130
+ }
1131
+
1132
+ _createClass(Cascader, [{
1133
+ key: "getLabel",
1134
+ value: function getLabel() {
1135
+ var _this$props = this.props,
1136
+ options = _this$props.options,
1137
+ _this$props$displayRe = _this$props.displayRender,
1138
+ displayRender = _this$props$displayRe === void 0 ? defaultDisplayRender : _this$props$displayRe;
1139
+ var names = getFilledFieldNames(this.props);
1140
+ var value = this.state.value;
1141
+ var unwrappedValue = Array.isArray(value[0]) ? value[0] : value;
1142
+ var selectedOptions = arrayTreeFilter(options, function (o, level) {
1143
+ return o[names.value] === unwrappedValue[level];
1144
+ }, {
1145
+ childrenKeyName: names.children
1146
+ });
1147
+ var label = selectedOptions.map(function (o) {
1148
+ return o[names.label];
1149
+ });
1150
+ return displayRender(label, selectedOptions);
1151
+ }
1152
+ }, {
1153
+ key: "generateFilteredOptions",
1154
+ value: function generateFilteredOptions(prefixCls, renderEmpty) {
1155
+ var _this2 = this,
1156
+ _ref4;
1157
+
1158
+ var _this$props2 = this.props,
1159
+ showSearch = _this$props2.showSearch,
1160
+ notFoundContent = _this$props2.notFoundContent;
1161
+ var names = getFilledFieldNames(this.props);
1162
+ var _showSearch$filter = showSearch.filter,
1163
+ filter = _showSearch$filter === void 0 ? defaultFilterOption : _showSearch$filter,
1164
+ _showSearch$render = showSearch.render,
1165
+ render = _showSearch$render === void 0 ? defaultRenderFilteredOption : _showSearch$render,
1166
+ _showSearch$sort = showSearch.sort,
1167
+ sort = _showSearch$sort === void 0 ? defaultSortFilteredOption : _showSearch$sort,
1168
+ _showSearch$limit = showSearch.limit,
1169
+ limit = _showSearch$limit === void 0 ? defaultLimit : _showSearch$limit;
1170
+ var _this$state2 = this.state,
1171
+ _this$state2$flattenO = _this$state2.flattenOptions,
1172
+ flattenOptions = _this$state2$flattenO === void 0 ? [] : _this$state2$flattenO,
1173
+ inputValue = _this$state2.inputValue; // Limit the filter if needed
1174
+
1175
+ var filtered;
1176
+
1177
+ if (limit > 0) {
1178
+ filtered = [];
1179
+ var matchCount = 0; // Perf optimization to filter items only below the limit
1180
+
1181
+ flattenOptions.some(function (path) {
1182
+ var match = filter(_this2.state.inputValue, path, names);
1183
+
1184
+ if (match) {
1185
+ filtered.push(path);
1186
+ matchCount += 1;
1187
+ }
1188
+
1189
+ return matchCount >= limit;
1190
+ });
1191
+ } else {
1192
+ filtered = flattenOptions.filter(function (path) {
1193
+ return filter(_this2.state.inputValue, path, names);
1194
+ });
1195
+ }
1196
+
1197
+ filtered.sort(function (a, b) {
1198
+ return sort(a, b, inputValue, names);
1199
+ });
1200
+
1201
+ if (filtered.length > 0) {
1202
+ return filtered.map(function (path) {
1203
+ var _ref3;
1204
+
1205
+ return _ref3 = {
1206
+ __IS_FILTERED_OPTION: true,
1207
+ path: path
1208
+ }, _defineProperty(_ref3, names.value, path.map(function (o) {
1209
+ return o[names.value];
1210
+ })), _defineProperty(_ref3, names.label, render(inputValue, path, prefixCls, names)), _defineProperty(_ref3, "disabled", path.some(function (o) {
1211
+ return !!o.disabled;
1212
+ })), _defineProperty(_ref3, "isEmptyNode", true), _ref3;
1213
+ });
1214
+ }
1215
+
1216
+ return [(_ref4 = {}, _defineProperty(_ref4, names.value, 'ANT_CASCADER_NOT_FOUND'), _defineProperty(_ref4, names.label, notFoundContent || renderEmpty('Cascader')), _defineProperty(_ref4, "disabled", true), _defineProperty(_ref4, "isEmptyNode", true), _ref4)];
1217
+ }
1218
+ }, {
1219
+ key: "focus",
1220
+ value: function focus() {
1221
+ this.input.focus();
1222
+ }
1223
+ }, {
1224
+ key: "blur",
1225
+ value: function blur() {
1226
+ this.input.blur();
1227
+ }
1228
+ }, {
1229
+ key: "render",
1230
+ value: function render() {
1231
+ var _this3 = this;
1232
+
1233
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configArgument) {
1234
+ return /*#__PURE__*/React.createElement(LocaleReceiver, null, function (locale) {
1235
+ return _this3.renderCascader(configArgument, locale);
1236
+ });
1237
+ });
1238
+ }
1239
+ }], [{
1240
+ key: "getDerivedStateFromProps",
1241
+ value: function getDerivedStateFromProps(nextProps, _ref5) {
1242
+ var prevProps = _ref5.prevProps;
1243
+ var newState = {
1244
+ prevProps: nextProps
1245
+ };
1246
+
1247
+ if ('value' in nextProps) {
1248
+ newState.value = nextProps.value || [];
1249
+ }
1250
+
1251
+ if ('popupVisible' in nextProps) {
1252
+ newState.popupVisible = nextProps.popupVisible;
1253
+ }
1254
+
1255
+ if (nextProps.showSearch && prevProps.options !== nextProps.options) {
1256
+ newState.flattenOptions = flattenTree(nextProps.options, nextProps);
1257
+ }
1258
+
1259
+ return newState;
1260
+ }
1261
+ }]);
1262
+
1263
+ return Cascader;
1264
+ }(React.Component);
1265
+
1266
+ Cascader.defaultProps = {
1267
+ transitionName: 'slide-up',
1268
+ popupPlacement: 'bottomLeft',
1269
+ options: [],
1270
+ disabled: false,
1271
+ allowClear: true
1272
+ };
1273
+ polyfill(Cascader);
1274
+
1275
+ export { Cascader as default };