@nutui/nutui-react 2.3.12-beta.0 → 2.3.12

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 (184) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/esm/ActionSheet.js +30 -76
  3. package/dist/esm/Address.js +80 -171
  4. package/dist/esm/Animate.js +21 -49
  5. package/dist/esm/AnimatingNumbers.js +47 -120
  6. package/dist/esm/Audio.js +88 -159
  7. package/dist/esm/Avatar.js +44 -91
  8. package/dist/esm/AvatarCropper.js +149 -268
  9. package/dist/esm/AvatarGroup.js +13 -44
  10. package/dist/esm/BackTop.js +34 -75
  11. package/dist/esm/Barrage.js +49 -83
  12. package/dist/esm/Calendar.js +27 -119
  13. package/dist/esm/CalendarCard.js +180 -291
  14. package/dist/esm/CalendarItem.js +253 -314
  15. package/dist/esm/Card.js +38 -72
  16. package/dist/esm/Cell.js +27 -62
  17. package/dist/esm/CellGroup.js +16 -45
  18. package/dist/esm/CheckboxGroup.js +49 -85
  19. package/dist/esm/CircleProgress.js +42 -93
  20. package/dist/esm/Col.js +17 -48
  21. package/dist/esm/Collapse.js +18 -49
  22. package/dist/esm/ConfigProvider.js +3 -2
  23. package/dist/esm/CountDown.js +62 -101
  24. package/dist/esm/DatePicker.js +87 -127
  25. package/dist/esm/Dialog.js +116 -196
  26. package/dist/esm/Divider.js +16 -36
  27. package/dist/esm/Drag.js +32 -76
  28. package/dist/esm/Elevator.js +93 -133
  29. package/dist/esm/Ellipsis.js +71 -92
  30. package/dist/esm/Empty.js +31 -70
  31. package/dist/esm/FixedNav.js +32 -81
  32. package/dist/esm/Form.js +28 -61
  33. package/dist/esm/Grid.js +27 -51
  34. package/dist/esm/Image.js +47 -102
  35. package/dist/esm/ImagePreview.js +82 -135
  36. package/dist/esm/InfiniteLoading.js +77 -159
  37. package/dist/esm/Input.js +57 -125
  38. package/dist/esm/InputNumber.js +66 -96
  39. package/dist/esm/Layout.js +4 -28
  40. package/dist/esm/Loading.js +13 -40
  41. package/dist/esm/Menu.js +51 -105
  42. package/dist/esm/NavBar.js +46 -85
  43. package/dist/esm/NoticeBar.js +153 -226
  44. package/dist/esm/Notify.js +87 -178
  45. package/dist/esm/NumberKeyboard.js +84 -150
  46. package/dist/esm/Pagination.js +58 -97
  47. package/dist/esm/Picker.js +215 -276
  48. package/dist/esm/Popover.js +111 -159
  49. package/dist/esm/Price.js +23 -60
  50. package/dist/esm/Progress.js +47 -77
  51. package/dist/esm/PullToRefresh.js +94 -201
  52. package/dist/esm/RadioGroup.js +23 -53
  53. package/dist/esm/Range.js +113 -177
  54. package/dist/esm/Rate.js +48 -95
  55. package/dist/esm/Row.js +19 -43
  56. package/dist/esm/SearchBar.js +52 -119
  57. package/dist/esm/ShortPassword.js +58 -106
  58. package/dist/esm/SideNavBar.js +34 -59
  59. package/dist/esm/SideNavBarItem.js +7 -36
  60. package/dist/esm/Signature.js +49 -84
  61. package/dist/esm/Skeleton.js +31 -68
  62. package/dist/esm/Space.js +7 -34
  63. package/dist/esm/Step.js +35 -64
  64. package/dist/esm/Steps.js +16 -40
  65. package/dist/esm/Sticky.js +64 -108
  66. package/dist/esm/SubSideNavBar.js +42 -71
  67. package/dist/esm/Swipe.js +79 -143
  68. package/dist/esm/Swiper.js +136 -183
  69. package/dist/esm/SwiperItem.js +13 -38
  70. package/dist/esm/Switch.js +20 -53
  71. package/dist/esm/TabPane.js +6 -30
  72. package/dist/esm/Tabbar.js +29 -59
  73. package/dist/esm/Table.js +92 -141
  74. package/dist/esm/Tag.js +30 -74
  75. package/dist/esm/TextArea.js +37 -82
  76. package/dist/esm/TimeDetail.js +20 -58
  77. package/dist/esm/TimeSelect.js +57 -95
  78. package/dist/esm/Toast.js +110 -197
  79. package/dist/esm/Tour.js +88 -132
  80. package/dist/esm/TrendArrow.js +32 -74
  81. package/dist/esm/Uploader.js +226 -346
  82. package/dist/esm/UserContext.js +1 -1
  83. package/dist/esm/Video.js +34 -67
  84. package/dist/esm/VirtualList.js +127 -160
  85. package/dist/esm/WaterMark.js +24 -68
  86. package/dist/esm/badge2.js +23 -53
  87. package/dist/esm/button2.js +30 -63
  88. package/dist/esm/can-use-dom.js +1 -1
  89. package/dist/esm/cascader2.js +307 -536
  90. package/dist/esm/checkbox2.js +59 -96
  91. package/dist/esm/collapseitem2.js +48 -86
  92. package/dist/esm/configprovider2.js +43 -1003
  93. package/dist/esm/context.js +1 -1
  94. package/dist/esm/context2.js +1 -1
  95. package/dist/esm/context3.js +1 -1
  96. package/dist/esm/context4.js +1 -1
  97. package/dist/esm/context5.js +8 -8
  98. package/dist/esm/date.js +88 -66
  99. package/dist/esm/formitem2.js +236 -1510
  100. package/dist/esm/get-scroll-parent.js +8 -10
  101. package/dist/esm/griditem2.js +34 -52
  102. package/dist/esm/index.js +5 -12
  103. package/dist/esm/indicator2.js +13 -42
  104. package/dist/esm/menuitem2.js +81 -124
  105. package/dist/esm/overlay2.js +39 -78
  106. package/dist/esm/pad-zero.js +3 -4
  107. package/dist/esm/popup2.js +79 -124
  108. package/dist/esm/px-check.js +2 -2
  109. package/dist/esm/radio2.js +48 -79
  110. package/dist/esm/raf.js +5 -3
  111. package/dist/esm/render.js +17 -54
  112. package/dist/esm/safearea2.js +3 -5
  113. package/dist/esm/supports-passive.js +3 -3
  114. package/dist/esm/tabbaritem2.js +42 -58
  115. package/dist/esm/tabs2.js +82 -120
  116. package/dist/esm/tslib.es6.js +47 -0
  117. package/dist/esm/types/src/packages/button/demos/h5/demo1.d.ts +3 -0
  118. package/dist/esm/types/src/packages/button/demos/h5/demo2.d.ts +3 -0
  119. package/dist/esm/types/src/packages/button/demos/h5/demo3.d.ts +3 -0
  120. package/dist/esm/types/src/packages/button/demos/h5/demo4.d.ts +3 -0
  121. package/dist/esm/types/src/packages/button/demos/h5/demo5.d.ts +3 -0
  122. package/dist/esm/types/src/packages/button/demos/h5/demo6.d.ts +3 -0
  123. package/dist/esm/types/src/packages/button/demos/h5/demo7.d.ts +3 -0
  124. package/dist/esm/types/src/packages/button/demos/h5/demo8.d.ts +3 -0
  125. package/dist/esm/types/src/packages/button/demos/h5/demo9.d.ts +3 -0
  126. package/dist/esm/types/src/packages/button/demos/taro/demo1.d.ts +3 -0
  127. package/dist/esm/types/src/packages/button/demos/taro/demo10.d.ts +3 -0
  128. package/dist/esm/types/src/packages/button/demos/taro/demo2.d.ts +3 -0
  129. package/dist/esm/types/src/packages/button/demos/taro/demo3.d.ts +3 -0
  130. package/dist/esm/types/src/packages/button/demos/taro/demo4.d.ts +3 -0
  131. package/dist/esm/types/src/packages/button/demos/taro/demo5.d.ts +3 -0
  132. package/dist/esm/types/src/packages/button/demos/taro/demo6.d.ts +3 -0
  133. package/dist/esm/types/src/packages/button/demos/taro/demo7.d.ts +3 -0
  134. package/dist/esm/types/src/packages/button/demos/taro/demo8.d.ts +3 -0
  135. package/dist/esm/types/src/packages/button/demos/taro/demo9.d.ts +3 -0
  136. package/dist/esm/types/src/packages/configprovider/configprovider.d.ts +1 -0
  137. package/dist/esm/types/src/packages/configprovider/configprovider.taro.d.ts +1 -0
  138. package/dist/esm/types/src/packages/configprovider/index.d.ts +2 -2
  139. package/dist/esm/types/src/packages/configprovider/index.taro.d.ts +2 -2
  140. package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +2 -0
  141. package/dist/esm/typings.js +1 -1
  142. package/dist/esm/use-click-away.js +9 -13
  143. package/dist/esm/use-client-rect.js +4 -4
  144. package/dist/esm/use-props-value.js +10 -15
  145. package/dist/esm/use-refs.js +5 -7
  146. package/dist/esm/use-touch.js +16 -20
  147. package/dist/locales/base.js +1 -1
  148. package/dist/locales/en-US.js +1 -1
  149. package/dist/locales/id-ID.js +1 -1
  150. package/dist/locales/tr-TR.js +1 -1
  151. package/dist/locales/zh-CN.js +1 -1
  152. package/dist/locales/zh-TW.js +1 -1
  153. package/dist/locales/zh-UG.js +1 -1
  154. package/dist/nutui.react.es.js +242 -284
  155. package/dist/nutui.react.umd.js +239 -281
  156. package/dist/style.mjs +1 -1
  157. package/dist/styles/variables-jmapp.scss +4 -0
  158. package/dist/types/packages/button/demos/h5/demo1.d.ts +3 -0
  159. package/dist/types/packages/button/demos/h5/demo2.d.ts +3 -0
  160. package/dist/types/packages/button/demos/h5/demo3.d.ts +3 -0
  161. package/dist/types/packages/button/demos/h5/demo4.d.ts +3 -0
  162. package/dist/types/packages/button/demos/h5/demo5.d.ts +3 -0
  163. package/dist/types/packages/button/demos/h5/demo6.d.ts +3 -0
  164. package/dist/types/packages/button/demos/h5/demo7.d.ts +3 -0
  165. package/dist/types/packages/button/demos/h5/demo8.d.ts +3 -0
  166. package/dist/types/packages/button/demos/h5/demo9.d.ts +3 -0
  167. package/dist/types/packages/button/demos/taro/demo1.d.ts +3 -0
  168. package/dist/types/packages/button/demos/taro/demo10.d.ts +3 -0
  169. package/dist/types/packages/button/demos/taro/demo2.d.ts +3 -0
  170. package/dist/types/packages/button/demos/taro/demo3.d.ts +3 -0
  171. package/dist/types/packages/button/demos/taro/demo4.d.ts +3 -0
  172. package/dist/types/packages/button/demos/taro/demo5.d.ts +3 -0
  173. package/dist/types/packages/button/demos/taro/demo6.d.ts +3 -0
  174. package/dist/types/packages/button/demos/taro/demo7.d.ts +3 -0
  175. package/dist/types/packages/button/demos/taro/demo8.d.ts +3 -0
  176. package/dist/types/packages/button/demos/taro/demo9.d.ts +3 -0
  177. package/dist/types/packages/configprovider/configprovider.d.ts +1 -0
  178. package/dist/types/packages/configprovider/configprovider.taro.d.ts +1 -0
  179. package/dist/types/packages/configprovider/index.d.ts +2 -2
  180. package/dist/types/packages/configprovider/index.taro.d.ts +2 -2
  181. package/dist/types/packages/empty/empty.d.ts +15 -3
  182. package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +2 -0
  183. package/dist/types/packages/rate/rate.d.ts +1 -1
  184. package/package.json +5 -1
@@ -1,48 +1,4 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
- function ownKeys(e, r) {
10
- var t = Object.keys(e);
11
- if (Object.getOwnPropertySymbols) {
12
- var o = Object.getOwnPropertySymbols(e);
13
- r && (o = o.filter(function(r2) {
14
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
15
- })), t.push.apply(t, o);
16
- }
17
- return t;
18
- }
19
- function _objectSpread(e) {
20
- for (var r = 1; r < arguments.length; r++) {
21
- var t = null != arguments[r] ? arguments[r] : {};
22
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
23
- _defineProperty(e, r2, t[r2]);
24
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
25
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
26
- });
27
- }
28
- return e;
29
- }
30
- function _toPropertyKey(t) {
31
- var i = _toPrimitive(t, "string");
32
- return "symbol" == _typeof(i) ? i : String(i);
33
- }
34
- function _toPrimitive(t, r) {
35
- if ("object" != _typeof(t) || !t)
36
- return t;
37
- var e = t[Symbol.toPrimitive];
38
- if (void 0 !== e) {
39
- var i = e.call(t, r || "default");
40
- if ("object" != _typeof(i))
41
- return i;
42
- throw new TypeError("@@toPrimitive must return a primitive value.");
43
- }
44
- return ("string" === r ? String : Number)(t);
45
- }
1
+ import { _ as __rest, a as __awaiter } from "./tslib.es6.js";
46
2
  import React__default, { useState, useImperativeHandle, useEffect, isValidElement } from "react";
47
3
  import classNames from "classnames";
48
4
  import { Loading, Checklist } from "@nutui/icons-react";
@@ -50,52 +6,48 @@ import { P as Popup } from "./popup2.js";
50
6
  import { T as Tabs } from "./tabs2.js";
51
7
  import { C as ComponentDefaults } from "./typings.js";
52
8
  import { u as usePropsValue } from "./use-props-value.js";
53
- var formatTree = function formatTree2(tree, parent, config) {
54
- return tree.map(function(node) {
55
- var _config$value = config.value, valueKey = _config$value === void 0 ? "value" : _config$value, _config$text = config.text, textKey = _config$text === void 0 ? "text" : _config$text, _config$children = config.children, childrenKey = _config$children === void 0 ? "children" : _config$children;
56
- var value = node[valueKey], text = node[textKey], children = node[childrenKey], others = _objectWithoutProperties(node, [valueKey, textKey, childrenKey].map(_toPropertyKey));
57
- var newNode = _objectSpread(_objectSpread({
58
- loading: false
59
- }, others), {}, {
60
- level: parent ? (parent && parent.level || 0) + 1 : 0,
61
- value,
62
- text,
63
- children,
64
- _parent: parent
65
- });
66
- if (newNode.children && newNode.children.length) {
67
- newNode.children = formatTree2(newNode.children, newNode, config);
68
- }
69
- return newNode;
9
+ const formatTree = (tree, parent, config) => tree.map((node) => {
10
+ const { value: valueKey = "value", text: textKey = "text", children: childrenKey = "children" } = config;
11
+ const _a = node, _b = valueKey, value = _a[_b], _c = textKey, text = _a[_c], _d = childrenKey, children = _a[_d], others = __rest(_a, [typeof _b === "symbol" ? _b : _b + "", typeof _c === "symbol" ? _c : _c + "", typeof _d === "symbol" ? _d : _d + ""]);
12
+ const newNode = Object.assign(Object.assign({ loading: false }, others), {
13
+ level: parent ? (parent && parent.level || 0) + 1 : 0,
14
+ value,
15
+ text,
16
+ children,
17
+ _parent: parent
70
18
  });
71
- };
72
- var eachTree = function eachTree2(tree, cb) {
73
- var i = 0;
74
- var node;
19
+ if (newNode.children && newNode.children.length) {
20
+ newNode.children = formatTree(newNode.children, newNode, config);
21
+ }
22
+ return newNode;
23
+ });
24
+ const eachTree = (tree, cb) => {
25
+ let i = 0;
26
+ let node;
75
27
  while (node = tree[i++]) {
76
28
  if (cb(node) === true) {
77
29
  break;
78
30
  }
79
31
  if (node.children && node.children.length) {
80
- eachTree2(node.children, cb);
32
+ eachTree(node.children, cb);
81
33
  }
82
34
  }
83
35
  };
84
- var defaultConvertConfig = {
36
+ const defaultConvertConfig = {
85
37
  topId: null,
86
38
  idKey: "id",
87
39
  pidKey: "pid",
88
40
  sortKey: ""
89
41
  };
90
- var convertListToOptions = function convertListToOptions2(list, options) {
91
- var mergedOptions = _objectSpread(_objectSpread({}, defaultConvertConfig), options || {});
92
- var topId = mergedOptions.topId, idKey = mergedOptions.idKey, pidKey = mergedOptions.pidKey, sortKey = mergedOptions.sortKey;
93
- var result = [];
94
- var map = {};
95
- list.forEach(function(node) {
96
- node = _objectSpread({}, node);
97
- var _node = node, id = _node[idKey], pid = _node[pidKey];
98
- var children = map[pid] = map[pid] || [];
42
+ const convertListToOptions = (list, options) => {
43
+ const mergedOptions = Object.assign(Object.assign({}, defaultConvertConfig), options || {});
44
+ const { topId, idKey, pidKey, sortKey } = mergedOptions;
45
+ let result = [];
46
+ let map = {};
47
+ list.forEach((node) => {
48
+ node = Object.assign({}, node);
49
+ const { [idKey]: id, [pidKey]: pid } = node;
50
+ const children = map[pid] = map[pid] || [];
99
51
  if (!result.length && pid === topId) {
100
52
  result = children;
101
53
  }
@@ -103,528 +55,347 @@ var convertListToOptions = function convertListToOptions2(list, options) {
103
55
  node.children = map[id] || (map[id] = []);
104
56
  });
105
57
  if (sortKey) {
106
- Object.keys(map).forEach(function(i) {
58
+ Object.keys(map).forEach((i) => {
107
59
  if (map[i].length > 1) {
108
- map[i].sort(function(a, b) {
109
- return a[sortKey] - b[sortKey];
110
- });
60
+ map[i].sort((a, b) => a[sortKey] - b[sortKey]);
111
61
  }
112
62
  });
113
63
  }
114
64
  map = null;
115
65
  return result;
116
66
  };
117
- var Tree = /* @__PURE__ */ function() {
118
- function Tree2(nodes, config) {
119
- var _this = this;
120
- _classCallCheck(this, Tree2);
121
- _defineProperty(this, "nodes", void 0);
122
- _defineProperty(this, "config", void 0);
123
- _defineProperty(this, "isLeaf", function(node, lazy) {
124
- var leaf = node.leaf, children = node.children;
125
- var hasChildren = Array.isArray(children) && Boolean(children.length);
67
+ class Tree {
68
+ constructor(nodes, config) {
69
+ this.isLeaf = (node, lazy) => {
70
+ const { leaf, children } = node;
71
+ const hasChildren = Array.isArray(children) && Boolean(children.length);
126
72
  return leaf || !hasChildren && !lazy;
127
- });
128
- _defineProperty(this, "hasChildren", function(node, lazy) {
129
- var isLeaf = _this.isLeaf(node, lazy);
73
+ };
74
+ this.hasChildren = (node, lazy) => {
75
+ const isLeaf = this.isLeaf(node, lazy);
130
76
  if (isLeaf) {
131
77
  return false;
132
78
  }
133
- var children = node.children;
79
+ const { children } = node;
134
80
  return Array.isArray(children) && Boolean(children.length);
135
- });
136
- this.config = _objectSpread({
137
- value: "value",
138
- text: "text",
139
- children: "children"
140
- }, config || {});
81
+ };
82
+ this.config = Object.assign({ value: "value", text: "text", children: "children" }, config || {});
141
83
  this.nodes = formatTree(nodes, null, this.config);
142
84
  }
143
- _createClass(Tree2, [{
144
- key: "updateChildren",
145
- value: function updateChildren(nodes, parent) {
146
- if (!parent) {
147
- this.nodes = formatTree(nodes, null, this.config);
148
- } else {
149
- parent.children = formatTree(nodes, parent, this.config);
150
- }
85
+ updateChildren(nodes, parent) {
86
+ if (!parent) {
87
+ this.nodes = formatTree(nodes, null, this.config);
88
+ } else {
89
+ parent.children = formatTree(nodes, parent, this.config);
151
90
  }
152
- // for test
153
- }, {
154
- key: "getNodeByValue",
155
- value: function getNodeByValue(value) {
156
- var foundNode;
157
- eachTree(this.nodes, function(node) {
158
- if (node.value === value) {
159
- foundNode = node;
160
- return true;
161
- }
162
- return null;
163
- });
164
- return foundNode;
165
- }
166
- }, {
167
- key: "getPathNodesByValue",
168
- value: function getPathNodesByValue(value) {
169
- if (!value.length) {
170
- return [];
91
+ }
92
+ // for test
93
+ getNodeByValue(value) {
94
+ let foundNode;
95
+ eachTree(this.nodes, (node) => {
96
+ if (node.value === value) {
97
+ foundNode = node;
98
+ return true;
171
99
  }
172
- var pathNodes = [];
173
- var currentNodes = this.nodes;
174
- while (currentNodes && currentNodes.length) {
175
- var foundNode = currentNodes.find(function(node) {
176
- return node.value === value[node.level];
177
- });
178
- if (!foundNode) {
179
- break;
180
- }
181
- pathNodes.push(foundNode);
182
- currentNodes = foundNode.children;
100
+ return null;
101
+ });
102
+ return foundNode;
103
+ }
104
+ getPathNodesByValue(value) {
105
+ if (!value.length) {
106
+ return [];
107
+ }
108
+ const pathNodes = [];
109
+ let currentNodes = this.nodes;
110
+ while (currentNodes && currentNodes.length) {
111
+ const foundNode = currentNodes.find((node) => node.value === value[node.level]);
112
+ if (!foundNode) {
113
+ break;
183
114
  }
184
- return pathNodes;
115
+ pathNodes.push(foundNode);
116
+ currentNodes = foundNode.children;
185
117
  }
186
- }]);
187
- return Tree2;
188
- }();
189
- var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
190
- activeColor: "",
191
- activeIcon: "checklist",
192
- popup: true,
193
- options: [],
194
- optionKey: {
195
- textKey: "text",
196
- valueKey: "value",
197
- childrenKey: "children"
198
- },
199
- format: {},
200
- closeable: false,
201
- closeIconPosition: "top-right",
202
- closeIcon: "close",
203
- lazy: false,
204
- onLoad: function onLoad() {
205
- },
206
- onClose: function onClose() {
207
- },
208
- onChange: function onChange() {
209
- },
210
- onPathChange: function onPathChange() {
118
+ return pathNodes;
211
119
  }
212
- });
213
- var InternalCascader = function InternalCascader2(props, ref) {
214
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, activeColor = _defaultProps$props.activeColor, activeIcon = _defaultProps$props.activeIcon, popup = _defaultProps$props.popup, _defaultProps$props$p = _defaultProps$props.popupProps, popupProps = _defaultProps$props$p === void 0 ? {} : _defaultProps$props$p, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
215
- var _useState = useState("c1"), _useState2 = _slicedToArray(_useState, 2), tabvalue = _useState2[0], setTabvalue = _useState2[1];
216
- var _useState3 = useState([]), _useState4 = _slicedToArray(_useState3, 2), optionsData = _useState4[0], setOptionsData = _useState4[1];
217
- var isLazy = function isLazy2() {
218
- return state.configs.lazy && Boolean(state.configs.onLoad);
219
- };
220
- var _usePropsValue = usePropsValue({
120
+ }
121
+ const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { activeColor: "", activeIcon: "checklist", popup: true, options: [], optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" }, format: {}, closeable: false, closeIconPosition: "top-right", closeIcon: "close", lazy: false, onLoad: () => {
122
+ }, onClose: () => {
123
+ }, onChange: () => {
124
+ }, onPathChange: () => {
125
+ } });
126
+ const InternalCascader = (props, ref) => {
127
+ const { className, style, activeColor, activeIcon, popup, popupProps = {}, visible, options, value, defaultValue, optionKey, format, closeable, closeIconPosition, closeIcon, lazy, onLoad, onClose, onChange, onPathChange } = Object.assign(Object.assign({}, defaultProps), props);
128
+ const [tabvalue, setTabvalue] = useState("c1");
129
+ const [optionsData, setOptionsData] = useState([]);
130
+ const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
131
+ const [innerValue, setInnerValue] = usePropsValue({
221
132
  value,
222
133
  defaultValue,
223
134
  finalValue: defaultValue
224
- }), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), innerValue = _usePropsValue2[0], setInnerValue = _usePropsValue2[1];
225
- var _usePropsValue3 = usePropsValue({
135
+ });
136
+ const [innerVisible, setInnerVisible] = usePropsValue({
226
137
  value: props.visible,
227
138
  defaultValue: void 0,
228
139
  finalValue: false
229
- }), _usePropsValue4 = _slicedToArray(_usePropsValue3, 2), innerVisible = _usePropsValue4[0], setInnerVisible = _usePropsValue4[1];
230
- var actions = {
231
- open: function open() {
140
+ });
141
+ const actions = {
142
+ open: () => {
232
143
  setInnerVisible(true);
233
144
  },
234
- close: function close2() {
145
+ close: () => {
235
146
  setInnerVisible(false);
236
147
  }
237
148
  };
238
- useImperativeHandle(ref, function() {
239
- return actions;
240
- });
241
- var _useState5 = useState({
149
+ useImperativeHandle(ref, () => actions);
150
+ const [state] = useState({
242
151
  optionsData: [],
243
- panes: [{
244
- nodes: [],
245
- selectedNode: [],
246
- paneKey: ""
247
- }],
152
+ panes: [
153
+ {
154
+ nodes: [],
155
+ selectedNode: [],
156
+ paneKey: ""
157
+ }
158
+ ],
248
159
  tree: new Tree([], {}),
249
160
  tabsCursor: 0,
250
161
  initLoading: false,
251
162
  currentProcessNode: [],
252
163
  configs: {
253
164
  lazy,
254
- onLoad: onLoad2,
165
+ onLoad,
255
166
  optionKey,
256
167
  format
257
168
  },
258
169
  lazyLoadMap: /* @__PURE__ */ new Map()
259
- }), _useState6 = _slicedToArray(_useState5, 1), state = _useState6[0];
260
- var classPrefix = classNames("nut-cascader");
261
- var classesPane = classNames(_defineProperty({}, "".concat(classPrefix, "-pane"), true));
262
- useEffect(function() {
170
+ });
171
+ const classPrefix = classNames(`nut-cascader`);
172
+ const classesPane = classNames({
173
+ [`${classPrefix}-pane`]: true
174
+ });
175
+ useEffect(() => {
263
176
  initData();
264
177
  }, [options, format]);
265
- var initData = /* @__PURE__ */ function() {
266
- var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee() {
267
- return _regeneratorRuntime.wrap(function _callee$(_context) {
268
- while (1)
269
- switch (_context.prev = _context.next) {
270
- case 0:
271
- state.lazyLoadMap.clear();
272
- if (format && Object.keys(format).length > 0) {
273
- state.optionsData = convertListToOptions(options, format);
274
- } else {
275
- state.optionsData = options;
276
- }
277
- state.tree = new Tree(state.optionsData, {
278
- value: state.configs.optionKey.valueKey,
279
- text: state.configs.optionKey.textKey,
280
- children: state.configs.optionKey.childrenKey
281
- });
282
- if (!(isLazy() && !state.tree.nodes.length)) {
283
- _context.next = 6;
284
- break;
285
- }
286
- _context.next = 6;
287
- return invokeLazyLoad({
288
- root: true,
289
- loading: true,
290
- text: "",
291
- value: ""
292
- });
293
- case 6:
294
- state.panes = [{
295
- nodes: state.tree.nodes,
296
- selectedNode: null,
297
- paneKey: "c1"
298
- }];
299
- syncValue();
300
- setOptionsData(state.panes);
301
- case 9:
302
- case "end":
303
- return _context.stop();
304
- }
305
- }, _callee);
306
- }));
307
- return function initData2() {
308
- return _ref.apply(this, arguments);
309
- };
310
- }();
311
- var syncValue = /* @__PURE__ */ function() {
312
- var _ref2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee3() {
313
- var currentValue, needToSync, parent, last, pathNodes;
314
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
315
- while (1)
316
- switch (_context3.prev = _context3.next) {
317
- case 0:
318
- currentValue = innerValue;
319
- if (!(currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length)) {
320
- _context3.next = 3;
321
- break;
322
- }
323
- return _context3.abrupt("return");
324
- case 3:
325
- if (!(currentValue.length === 0)) {
326
- _context3.next = 6;
327
- break;
328
- }
329
- state.tabsCursor = 0;
330
- return _context3.abrupt("return");
331
- case 6:
332
- needToSync = currentValue;
333
- if (!(isLazy() && Array.isArray(currentValue) && currentValue.length)) {
334
- _context3.next = 19;
335
- break;
336
- }
337
- needToSync = [];
338
- parent = state.tree.nodes.find(function(node) {
339
- return node.value === currentValue[0];
340
- });
341
- if (!parent) {
342
- _context3.next = 19;
343
- break;
344
- }
345
- needToSync = [parent.value];
346
- state.initLoading = true;
347
- _context3.next = 15;
348
- return currentValue.slice(1).reduce(/* @__PURE__ */ function() {
349
- var _ref3 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee2(p, value2) {
350
- var _parent2$children;
351
- var parent2, node;
352
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
353
- while (1)
354
- switch (_context2.prev = _context2.next) {
355
- case 0:
356
- _context2.next = 2;
357
- return p;
358
- case 2:
359
- parent2 = _context2.sent;
360
- _context2.next = 5;
361
- return invokeLazyLoad(parent2);
362
- case 5:
363
- node = parent2 === null || parent2 === void 0 || (_parent2$children = parent2.children) === null || _parent2$children === void 0 ? void 0 : _parent2$children.find(function(item) {
364
- return item.value === value2;
365
- });
366
- if (node) {
367
- needToSync.push(value2);
368
- }
369
- return _context2.abrupt("return", Promise.resolve(node));
370
- case 8:
371
- case "end":
372
- return _context2.stop();
373
- }
374
- }, _callee2);
375
- }));
376
- return function(_x, _x2) {
377
- return _ref3.apply(this, arguments);
378
- };
379
- }(), Promise.resolve(parent));
380
- case 15:
381
- last = _context3.sent;
382
- _context3.next = 18;
383
- return invokeLazyLoad(last);
384
- case 18:
385
- state.initLoading = false;
386
- case 19:
387
- if (needToSync.length && currentValue === defaultValue) {
388
- pathNodes = state.tree.getPathNodesByValue(needToSync);
389
- pathNodes.forEach(function(node, index) {
390
- state.tabsCursor = index;
391
- chooseItem(node, true);
392
- });
393
- }
394
- case 20:
395
- case "end":
396
- return _context3.stop();
397
- }
398
- }, _callee3);
399
- }));
400
- return function syncValue2() {
401
- return _ref2.apply(this, arguments);
402
- };
403
- }();
404
- var invokeLazyLoad = /* @__PURE__ */ function() {
405
- var _ref4 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee4(node) {
406
- var parent, lazyLoadPromise, nodes;
407
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
408
- while (1)
409
- switch (_context4.prev = _context4.next) {
410
- case 0:
411
- if (node) {
412
- _context4.next = 2;
413
- break;
414
- }
415
- return _context4.abrupt("return");
416
- case 2:
417
- if (state.configs.onLoad) {
418
- _context4.next = 5;
419
- break;
420
- }
421
- node.leaf = true;
422
- return _context4.abrupt("return");
423
- case 5:
424
- if (!(state.tree.isLeaf(node, isLazy()) || state.tree.hasChildren(node, isLazy()))) {
425
- _context4.next = 7;
426
- break;
427
- }
428
- return _context4.abrupt("return");
429
- case 7:
430
- node.loading = true;
431
- parent = node.root ? null : node;
432
- lazyLoadPromise = state.lazyLoadMap.get(node);
433
- if (!lazyLoadPromise) {
434
- lazyLoadPromise = new Promise(function(resolve) {
435
- var _state$configs$onLoad, _state$configs;
436
- (_state$configs$onLoad = (_state$configs = state.configs).onLoad) === null || _state$configs$onLoad === void 0 || _state$configs$onLoad.call(_state$configs, node, resolve);
437
- });
438
- state.lazyLoadMap.set(node, lazyLoadPromise);
439
- }
440
- _context4.next = 13;
441
- return lazyLoadPromise;
442
- case 13:
443
- nodes = _context4.sent;
444
- if (Array.isArray(nodes) && nodes.length > 0) {
445
- state.tree.updateChildren(nodes, parent);
446
- } else {
447
- node.leaf = true;
448
- }
449
- node.loading = false;
450
- state.lazyLoadMap["delete"](node);
451
- case 17:
452
- case "end":
453
- return _context4.stop();
178
+ const initData = () => __awaiter(void 0, void 0, void 0, function* () {
179
+ state.lazyLoadMap.clear();
180
+ if (format && Object.keys(format).length > 0) {
181
+ state.optionsData = convertListToOptions(options, format);
182
+ } else {
183
+ state.optionsData = options;
184
+ }
185
+ state.tree = new Tree(state.optionsData, {
186
+ value: state.configs.optionKey.valueKey,
187
+ text: state.configs.optionKey.textKey,
188
+ children: state.configs.optionKey.childrenKey
189
+ });
190
+ if (isLazy() && !state.tree.nodes.length) {
191
+ yield invokeLazyLoad({
192
+ root: true,
193
+ loading: true,
194
+ text: "",
195
+ value: ""
196
+ });
197
+ }
198
+ state.panes = [
199
+ {
200
+ nodes: state.tree.nodes,
201
+ selectedNode: null,
202
+ paneKey: "c1"
203
+ }
204
+ ];
205
+ syncValue();
206
+ setOptionsData(state.panes);
207
+ });
208
+ const syncValue = () => __awaiter(void 0, void 0, void 0, function* () {
209
+ const currentValue = innerValue;
210
+ if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
211
+ return;
212
+ }
213
+ if (currentValue.length === 0) {
214
+ state.tabsCursor = 0;
215
+ return;
216
+ }
217
+ let needToSync = currentValue;
218
+ if (isLazy() && Array.isArray(currentValue) && currentValue.length) {
219
+ needToSync = [];
220
+ const parent = state.tree.nodes.find((node) => node.value === currentValue[0]);
221
+ if (parent) {
222
+ needToSync = [parent.value];
223
+ state.initLoading = true;
224
+ const last = yield currentValue.slice(1).reduce((p, value2) => __awaiter(void 0, void 0, void 0, function* () {
225
+ var _a;
226
+ const parent2 = yield p;
227
+ yield invokeLazyLoad(parent2);
228
+ const node = (_a = parent2 === null || parent2 === void 0 ? void 0 : parent2.children) === null || _a === void 0 ? void 0 : _a.find((item) => item.value === value2);
229
+ if (node) {
230
+ needToSync.push(value2);
454
231
  }
455
- }, _callee4);
456
- }));
457
- return function invokeLazyLoad2(_x3) {
458
- return _ref4.apply(this, arguments);
459
- };
460
- }();
461
- var close = function close2() {
232
+ return Promise.resolve(node);
233
+ }), Promise.resolve(parent));
234
+ yield invokeLazyLoad(last);
235
+ state.initLoading = false;
236
+ }
237
+ }
238
+ if (needToSync.length && currentValue === defaultValue) {
239
+ const pathNodes = state.tree.getPathNodesByValue(needToSync);
240
+ pathNodes.forEach((node, index) => {
241
+ state.tabsCursor = index;
242
+ chooseItem(node, true);
243
+ });
244
+ }
245
+ });
246
+ const invokeLazyLoad = (node) => __awaiter(void 0, void 0, void 0, function* () {
247
+ if (!node) {
248
+ return;
249
+ }
250
+ if (!state.configs.onLoad) {
251
+ node.leaf = true;
252
+ return;
253
+ }
254
+ if (state.tree.isLeaf(node, isLazy()) || state.tree.hasChildren(node, isLazy())) {
255
+ return;
256
+ }
257
+ node.loading = true;
258
+ const parent = node.root ? null : node;
259
+ let lazyLoadPromise = state.lazyLoadMap.get(node);
260
+ if (!lazyLoadPromise) {
261
+ lazyLoadPromise = new Promise((resolve) => {
262
+ var _a, _b;
263
+ (_b = (_a = state.configs).onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, node, resolve);
264
+ });
265
+ state.lazyLoadMap.set(node, lazyLoadPromise);
266
+ }
267
+ const nodes = yield lazyLoadPromise;
268
+ if (Array.isArray(nodes) && nodes.length > 0) {
269
+ state.tree.updateChildren(nodes, parent);
270
+ } else {
271
+ node.leaf = true;
272
+ }
273
+ node.loading = false;
274
+ state.lazyLoadMap.delete(node);
275
+ });
276
+ const close = () => {
462
277
  setInnerVisible(false);
463
- onClose2 && onClose2();
278
+ onClose && onClose();
464
279
  };
465
- var closePopup = function closePopup2() {
280
+ const closePopup = () => {
466
281
  close();
467
282
  };
468
- var chooseItem = /* @__PURE__ */ function() {
469
- var _ref5 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee5(node, type) {
470
- var pathNodes, optionParams, level, _pathNodes, _optionParams;
471
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
472
- while (1)
473
- switch (_context5.prev = _context5.next) {
474
- case 0:
475
- if (!(!type && node.disabled || !state.panes[state.tabsCursor])) {
476
- _context5.next = 2;
477
- break;
478
- }
479
- return _context5.abrupt("return");
480
- case 2:
481
- if (!state.tree.isLeaf(node, isLazy())) {
482
- _context5.next = 10;
483
- break;
484
- }
485
- node.leaf = true;
486
- state.panes[state.tabsCursor].selectedNode = node;
487
- state.panes = state.panes.slice(0, node.level + 1);
488
- if (!type) {
489
- pathNodes = state.panes.map(function(item) {
490
- return item.selectedNode;
491
- });
492
- optionParams = pathNodes.map(function(item) {
493
- return item.value;
494
- });
495
- onChange2(optionParams, pathNodes);
496
- onPathChange2(optionParams, pathNodes);
497
- setInnerValue(optionParams);
498
- }
499
- setOptionsData(state.panes);
500
- close();
501
- return _context5.abrupt("return");
502
- case 10:
503
- if (!state.tree.hasChildren(node, isLazy())) {
504
- _context5.next = 20;
505
- break;
506
- }
507
- level = node.level + 1;
508
- state.panes[state.tabsCursor].selectedNode = node;
509
- state.panes = state.panes.slice(0, level);
510
- state.tabsCursor = level;
511
- state.panes.push({
512
- nodes: node.children || [],
513
- selectedNode: null,
514
- paneKey: "c".concat(state.tabsCursor + 1)
515
- });
516
- setOptionsData(state.panes);
517
- setTabvalue("c".concat(state.tabsCursor + 1));
518
- if (!type) {
519
- _pathNodes = state.panes.map(function(item) {
520
- return item.selectedNode;
521
- });
522
- _optionParams = _pathNodes.map(function(item) {
523
- return item === null || item === void 0 ? void 0 : item.value;
524
- });
525
- onPathChange2(_optionParams, _pathNodes);
526
- }
527
- return _context5.abrupt("return");
528
- case 20:
529
- state.currentProcessNode = node;
530
- if (!node.loading) {
531
- _context5.next = 23;
532
- break;
533
- }
534
- return _context5.abrupt("return");
535
- case 23:
536
- _context5.next = 25;
537
- return invokeLazyLoad(node);
538
- case 25:
539
- if (state.currentProcessNode === node) {
540
- state.panes[state.tabsCursor].selectedNode = node;
541
- chooseItem(node, type);
542
- }
543
- setOptionsData(state.panes);
544
- case 27:
545
- case "end":
546
- return _context5.stop();
547
- }
548
- }, _callee5);
549
- }));
550
- return function chooseItem2(_x4, _x5) {
551
- return _ref5.apply(this, arguments);
552
- };
553
- }();
554
- var renderItem = function renderItem2(pane, node, index) {
555
- var _pane$selectedNode;
556
- var classPrefix2 = "nut-cascader-item";
557
- var checked = ((_pane$selectedNode = pane.selectedNode) === null || _pane$selectedNode === void 0 ? void 0 : _pane$selectedNode.value) === node.value;
558
- var classes = classNames({
283
+ const chooseItem = (node, type) => __awaiter(void 0, void 0, void 0, function* () {
284
+ if (!type && node.disabled || !state.panes[state.tabsCursor]) {
285
+ return;
286
+ }
287
+ if (state.tree.isLeaf(node, isLazy())) {
288
+ node.leaf = true;
289
+ state.panes[state.tabsCursor].selectedNode = node;
290
+ state.panes = state.panes.slice(0, node.level + 1);
291
+ if (!type) {
292
+ const pathNodes = state.panes.map((item) => item.selectedNode);
293
+ const optionParams = pathNodes.map((item) => item.value);
294
+ onChange(optionParams, pathNodes);
295
+ onPathChange(optionParams, pathNodes);
296
+ setInnerValue(optionParams);
297
+ }
298
+ setOptionsData(state.panes);
299
+ close();
300
+ return;
301
+ }
302
+ if (state.tree.hasChildren(node, isLazy())) {
303
+ const level = node.level + 1;
304
+ state.panes[state.tabsCursor].selectedNode = node;
305
+ state.panes = state.panes.slice(0, level);
306
+ state.tabsCursor = level;
307
+ state.panes.push({
308
+ nodes: node.children || [],
309
+ selectedNode: null,
310
+ paneKey: `c${state.tabsCursor + 1}`
311
+ });
312
+ setOptionsData(state.panes);
313
+ setTabvalue(`c${state.tabsCursor + 1}`);
314
+ if (!type) {
315
+ const pathNodes = state.panes.map((item) => item.selectedNode);
316
+ const optionParams = pathNodes.map((item) => item === null || item === void 0 ? void 0 : item.value);
317
+ onPathChange(optionParams, pathNodes);
318
+ }
319
+ return;
320
+ }
321
+ state.currentProcessNode = node;
322
+ if (node.loading) {
323
+ return;
324
+ }
325
+ yield invokeLazyLoad(node);
326
+ if (state.currentProcessNode === node) {
327
+ state.panes[state.tabsCursor].selectedNode = node;
328
+ chooseItem(node, type);
329
+ }
330
+ setOptionsData(state.panes);
331
+ });
332
+ const renderItem = (pane, node, index) => {
333
+ var _a;
334
+ const classPrefix2 = "nut-cascader-item";
335
+ const checked = ((_a = pane.selectedNode) === null || _a === void 0 ? void 0 : _a.value) === node.value;
336
+ const classes = classNames({
559
337
  active: checked,
560
338
  disabled: node.disabled
561
339
  }, classPrefix2);
562
- var classesTitle = classNames(_defineProperty({}, "".concat(classPrefix2, "-title"), true));
563
- var renderIcon = function renderIcon2() {
340
+ const classesTitle = classNames({
341
+ [`${classPrefix2}-title`]: true
342
+ });
343
+ const renderIcon = () => {
564
344
  if (checked) {
565
345
  if (isValidElement(activeIcon)) {
566
346
  return activeIcon;
567
347
  }
568
- return React__default.createElement(Checklist, {
569
- className: "".concat(checked ? "".concat(classPrefix, "-icon-check") : "")
570
- });
348
+ return React__default.createElement(Checklist, { className: `${checked ? `${classPrefix}-icon-check` : ""}` });
571
349
  }
572
350
  return null;
573
351
  };
574
- return React__default.createElement("div", {
575
- style: {
576
- color: checked ? activeColor : ""
577
- },
578
- className: classes,
579
- key: index,
580
- onClick: function onClick() {
352
+ return React__default.createElement(
353
+ "div",
354
+ { style: { color: checked ? activeColor : "" }, className: classes, key: index, onClick: () => {
581
355
  chooseItem(node, false);
582
- }
583
- }, React__default.createElement("div", {
584
- className: classesTitle
585
- }, node.text), node.loading ? React__default.createElement(Loading, {
586
- color: "#969799",
587
- className: "nut-cascader-item-icon-loading"
588
- }) : renderIcon());
356
+ } },
357
+ React__default.createElement("div", { className: classesTitle }, node.text),
358
+ node.loading ? React__default.createElement(Loading, { color: "#969799", className: "nut-cascader-item-icon-loading" }) : renderIcon()
359
+ );
589
360
  };
590
- var renderTabs = function renderTabs2() {
591
- return React__default.createElement("div", {
592
- className: "".concat(classPrefix, " ").concat(className),
593
- style
594
- }, React__default.createElement(Tabs, {
595
- value: tabvalue,
596
- title: function title() {
597
- return optionsData.map(function(pane, index) {
598
- var _pane$selectedNode2, _pane$selectedNode3;
599
- return React__default.createElement("div", {
600
- onClick: function onClick() {
361
+ const renderTabs = () => {
362
+ return React__default.createElement(
363
+ "div",
364
+ { className: `${classPrefix} ${className}`, style },
365
+ React__default.createElement(Tabs, { value: tabvalue, title: () => {
366
+ return optionsData.map((pane, index) => {
367
+ var _a, _b;
368
+ return React__default.createElement(
369
+ "div",
370
+ { onClick: () => {
601
371
  setTabvalue(pane.paneKey);
602
372
  state.tabsCursor = index;
603
- },
604
- className: "nut-tabs-titles-item ".concat(tabvalue === pane.paneKey ? "nut-tabs-titles-item-active" : ""),
605
- key: pane.paneKey
606
- }, React__default.createElement("span", {
607
- className: "nut-tabs-titles-item-text"
608
- }, !state.initLoading && state.panes.length && (pane === null || pane === void 0 || (_pane$selectedNode2 = pane.selectedNode) === null || _pane$selectedNode2 === void 0 ? void 0 : _pane$selectedNode2.text), !state.initLoading && state.panes.length && !(pane !== null && pane !== void 0 && (_pane$selectedNode3 = pane.selectedNode) !== null && _pane$selectedNode3 !== void 0 && _pane$selectedNode3.text) && "请选择", !(!state.initLoading && state.panes.length) && "Loading..."), React__default.createElement("span", {
609
- className: "nut-tabs-titles-item-line"
610
- }));
373
+ }, className: `nut-tabs-titles-item ${tabvalue === pane.paneKey ? "nut-tabs-titles-item-active" : ""}`, key: pane.paneKey },
374
+ React__default.createElement(
375
+ "span",
376
+ { className: "nut-tabs-titles-item-text" },
377
+ !state.initLoading && state.panes.length && ((_a = pane === null || pane === void 0 ? void 0 : pane.selectedNode) === null || _a === void 0 ? void 0 : _a.text),
378
+ !state.initLoading && state.panes.length && !((_b = pane === null || pane === void 0 ? void 0 : pane.selectedNode) === null || _b === void 0 ? void 0 : _b.text) && "请选择",
379
+ !(!state.initLoading && state.panes.length) && "Loading..."
380
+ ),
381
+ React__default.createElement("span", { className: "nut-tabs-titles-item-line" })
382
+ );
611
383
  });
612
- }
613
- }, !state.initLoading && state.panes.length ? optionsData.map(function(pane) {
614
- var _pane$nodes;
615
- return React__default.createElement(Tabs.TabPane, {
616
- key: pane.paneKey,
617
- value: pane.paneKey
618
- }, React__default.createElement("div", {
619
- className: classesPane
620
- }, (_pane$nodes = pane.nodes) === null || _pane$nodes === void 0 ? void 0 : _pane$nodes.map(function(node, index) {
621
- return renderItem(pane, node, index);
622
- })));
623
- }) : React__default.createElement(Tabs.TabPane, null, React__default.createElement("div", {
624
- className: classesPane
625
- }))));
384
+ } }, !state.initLoading && state.panes.length ? optionsData.map((pane) => {
385
+ var _a;
386
+ return React__default.createElement(
387
+ Tabs.TabPane,
388
+ { key: pane.paneKey, value: pane.paneKey },
389
+ React__default.createElement("div", { className: classesPane }, (_a = pane.nodes) === null || _a === void 0 ? void 0 : _a.map((node, index) => renderItem(pane, node, index)))
390
+ );
391
+ }) : React__default.createElement(
392
+ Tabs.TabPane,
393
+ null,
394
+ React__default.createElement("div", { className: classesPane })
395
+ ))
396
+ );
626
397
  };
627
- return React__default.createElement(React__default.Fragment, null, popup ? React__default.createElement(Popup, _objectSpread(_objectSpread({}, popupProps), {}, {
398
+ return React__default.createElement(React__default.Fragment, null, popup ? React__default.createElement(Popup, Object.assign({}, popupProps, {
628
399
  visible: innerVisible,
629
400
  position: "bottom",
630
401
  round: true,
@@ -638,7 +409,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
638
409
  onCloseIconClick: closePopup
639
410
  }), renderTabs()) : renderTabs());
640
411
  };
641
- var Cascader = React__default.forwardRef(InternalCascader);
412
+ const Cascader = React__default.forwardRef(InternalCascader);
642
413
  Cascader.defaultProps = defaultProps;
643
414
  Cascader.displayName = "NutCascader";
644
415
  export {