@nutui/nutui-react 1.5.1-beta.0 → 1.5.2-beta.0

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 (350) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/nutui.react.mjs +27 -22
  3. package/dist/nutui.react.umd.js +27 -22
  4. package/package.json +1 -1
  5. package/dist/esm/ActionSheet/style/index.js +0 -2
  6. package/dist/esm/ActionSheet.js +0 -92
  7. package/dist/esm/Address/style/index.js +0 -4
  8. package/dist/esm/Address.js +0 -622
  9. package/dist/esm/Animate/style/index.js +0 -2
  10. package/dist/esm/Animate.js +0 -55
  11. package/dist/esm/AnimatingNumbers/style/index.js +0 -3
  12. package/dist/esm/AnimatingNumbers.js +0 -127
  13. package/dist/esm/Audio/style/index.js +0 -4
  14. package/dist/esm/Audio.js +0 -266
  15. package/dist/esm/Avatar/style/index.js +0 -2
  16. package/dist/esm/Avatar.js +0 -132
  17. package/dist/esm/AvatarContext-15733596.js +0 -3
  18. package/dist/esm/AvatarGroup/style/index.js +0 -2
  19. package/dist/esm/AvatarGroup.js +0 -43
  20. package/dist/esm/BackTop/style/index.js +0 -2
  21. package/dist/esm/BackTop.js +0 -139
  22. package/dist/esm/Badge/style/index.js +0 -2
  23. package/dist/esm/Badge.js +0 -73
  24. package/dist/esm/Barrage/style/index.js +0 -2
  25. package/dist/esm/Barrage.js +0 -99
  26. package/dist/esm/Button/style/index.js +0 -2
  27. package/dist/esm/Button.js +0 -109
  28. package/dist/esm/Calendar/style/index.js +0 -2
  29. package/dist/esm/Calendar.js +0 -129
  30. package/dist/esm/CalendarItem/style/index.js +0 -2
  31. package/dist/esm/CalendarItem.js +0 -676
  32. package/dist/esm/Card/style/index.js +0 -4
  33. package/dist/esm/Card.js +0 -63
  34. package/dist/esm/Cascader/style/index.js +0 -3
  35. package/dist/esm/Cascader.js +0 -673
  36. package/dist/esm/Cell/style/index.js +0 -2
  37. package/dist/esm/Cell.js +0 -103
  38. package/dist/esm/CellGroup/style/index.js +0 -2
  39. package/dist/esm/CellGroup.js +0 -5
  40. package/dist/esm/Checkbox/style/index.js +0 -3
  41. package/dist/esm/Checkbox.js +0 -8
  42. package/dist/esm/CheckboxGroup/style/index.js +0 -2
  43. package/dist/esm/CheckboxGroup.js +0 -113
  44. package/dist/esm/CircleProgress/style/index.js +0 -2
  45. package/dist/esm/CircleProgress.js +0 -116
  46. package/dist/esm/Col/style/index.js +0 -2
  47. package/dist/esm/Col.js +0 -58
  48. package/dist/esm/Collapse/style/index.js +0 -2
  49. package/dist/esm/Collapse.js +0 -99
  50. package/dist/esm/CollapseItem/style/index.js +0 -2
  51. package/dist/esm/CollapseItem.js +0 -148
  52. package/dist/esm/ConfigProvider/style/index.js +0 -2
  53. package/dist/esm/ConfigProvider.js +0 -187
  54. package/dist/esm/CountDown/style/index.js +0 -2
  55. package/dist/esm/CountDown.js +0 -247
  56. package/dist/esm/DatePicker/style/index.js +0 -2
  57. package/dist/esm/DatePicker.js +0 -310
  58. package/dist/esm/Dialog/style/index.js +0 -3
  59. package/dist/esm/Dialog.js +0 -296
  60. package/dist/esm/Divider/style/index.js +0 -2
  61. package/dist/esm/Divider.js +0 -36
  62. package/dist/esm/Drag/style/index.js +0 -2
  63. package/dist/esm/Drag.js +0 -120
  64. package/dist/esm/Elevator/style/index.js +0 -2
  65. package/dist/esm/Elevator.js +0 -236
  66. package/dist/esm/Ellipsis/style/index.js +0 -2
  67. package/dist/esm/Ellipsis.js +0 -177
  68. package/dist/esm/Empty/style/index.js +0 -2
  69. package/dist/esm/Empty.js +0 -82
  70. package/dist/esm/FixedNav/style/index.js +0 -3
  71. package/dist/esm/FixedNav.js +0 -105
  72. package/dist/esm/Form/style/index.js +0 -2
  73. package/dist/esm/Form.js +0 -221
  74. package/dist/esm/FormItem/style/index.js +0 -2
  75. package/dist/esm/FormItem.js +0 -5
  76. package/dist/esm/Grid/style/index.js +0 -2
  77. package/dist/esm/Grid.js +0 -83
  78. package/dist/esm/GridItem/style/index.js +0 -2
  79. package/dist/esm/GridItem.js +0 -125
  80. package/dist/esm/Icon/style/index.js +0 -4
  81. package/dist/esm/Icon.js +0 -5
  82. package/dist/esm/Image/style/index.js +0 -2
  83. package/dist/esm/Image.js +0 -170
  84. package/dist/esm/ImagePreview/style/index.js +0 -4
  85. package/dist/esm/ImagePreview.js +0 -226
  86. package/dist/esm/Indicator/style/index.js +0 -2
  87. package/dist/esm/Indicator.js +0 -52
  88. package/dist/esm/Infiniteloading/style/index.js +0 -2
  89. package/dist/esm/Infiniteloading.js +0 -217
  90. package/dist/esm/Input/style/index.js +0 -2
  91. package/dist/esm/Input.js +0 -363
  92. package/dist/esm/InputNumber/style/index.js +0 -2
  93. package/dist/esm/InputNumber.js +0 -277
  94. package/dist/esm/Layout/style/index.js +0 -2
  95. package/dist/esm/Layout.js +0 -14
  96. package/dist/esm/Menu/style/index.js +0 -3
  97. package/dist/esm/Menu.js +0 -154
  98. package/dist/esm/MenuItem/style/index.js +0 -3
  99. package/dist/esm/MenuItem.js +0 -177
  100. package/dist/esm/NavBar/style/index.js +0 -2
  101. package/dist/esm/NavBar.js +0 -116
  102. package/dist/esm/NoticeBar/style/index.js +0 -2
  103. package/dist/esm/NoticeBar.js +0 -570
  104. package/dist/esm/Notify/style/index.js +0 -2
  105. package/dist/esm/Notify.js +0 -236
  106. package/dist/esm/NumberKeyboard/style/index.js +0 -2
  107. package/dist/esm/NumberKeyboard.js +0 -249
  108. package/dist/esm/Overlay/style/index.js +0 -2
  109. package/dist/esm/Overlay.js +0 -6
  110. package/dist/esm/Pagination/style/index.js +0 -2
  111. package/dist/esm/Pagination.js +0 -170
  112. package/dist/esm/Picker/style/index.js +0 -2
  113. package/dist/esm/Picker.js +0 -496
  114. package/dist/esm/Popover/style/index.js +0 -3
  115. package/dist/esm/Popover.js +0 -225
  116. package/dist/esm/Popup/style/index.js +0 -3
  117. package/dist/esm/Popup.js +0 -195
  118. package/dist/esm/Price/style/index.js +0 -2
  119. package/dist/esm/Price.js +0 -86
  120. package/dist/esm/Progress/style/index.js +0 -2
  121. package/dist/esm/Progress.js +0 -124
  122. package/dist/esm/PullToRefresh/style/index.js +0 -2
  123. package/dist/esm/PullToRefresh.js +0 -277
  124. package/dist/esm/Radio/style/index.js +0 -3
  125. package/dist/esm/Radio.js +0 -6
  126. package/dist/esm/RadioGroup/style/index.js +0 -2
  127. package/dist/esm/RadioGroup.js +0 -123
  128. package/dist/esm/Range/style/index.js +0 -2
  129. package/dist/esm/Range.js +0 -407
  130. package/dist/esm/Rate/style/index.js +0 -2
  131. package/dist/esm/Rate.js +0 -123
  132. package/dist/esm/Row/style/index.js +0 -2
  133. package/dist/esm/Row.js +0 -50
  134. package/dist/esm/SearchBar/style/index.js +0 -2
  135. package/dist/esm/SearchBar.js +0 -237
  136. package/dist/esm/ShortPassword/style/index.js +0 -3
  137. package/dist/esm/ShortPassword.js +0 -193
  138. package/dist/esm/SideNavBar/style/index.js +0 -2
  139. package/dist/esm/SideNavBar.js +0 -58
  140. package/dist/esm/SideNavBarItem/style/index.js +0 -2
  141. package/dist/esm/SideNavBarItem.js +0 -25
  142. package/dist/esm/Signature/style/index.js +0 -2
  143. package/dist/esm/Signature.js +0 -155
  144. package/dist/esm/Skeleton/style/index.js +0 -2
  145. package/dist/esm/Skeleton.js +0 -100
  146. package/dist/esm/Step/style/index.js +0 -2
  147. package/dist/esm/Step.js +0 -89
  148. package/dist/esm/Steps/style/index.js +0 -2
  149. package/dist/esm/Steps.js +0 -40
  150. package/dist/esm/Sticky/style/index.js +0 -2
  151. package/dist/esm/Sticky.js +0 -192
  152. package/dist/esm/SubSideNavBar/style/index.js +0 -2
  153. package/dist/esm/SubSideNavBar.js +0 -79
  154. package/dist/esm/Swipe/style/index.js +0 -2
  155. package/dist/esm/Swipe.js +0 -232
  156. package/dist/esm/Swiper/style/index.js +0 -2
  157. package/dist/esm/Swiper.js +0 -492
  158. package/dist/esm/SwiperItem/style/index.js +0 -2
  159. package/dist/esm/SwiperItem.js +0 -38
  160. package/dist/esm/Switch/style/index.js +0 -2
  161. package/dist/esm/Switch.js +0 -73
  162. package/dist/esm/TabPane/style/index.js +0 -2
  163. package/dist/esm/TabPane.js +0 -6
  164. package/dist/esm/Tabbar/style/index.js +0 -2
  165. package/dist/esm/Tabbar.js +0 -70
  166. package/dist/esm/TabbarItem/style/index.js +0 -2
  167. package/dist/esm/TabbarItem.js +0 -80
  168. package/dist/esm/Table/style/index.js +0 -2
  169. package/dist/esm/Table.js +0 -142
  170. package/dist/esm/Tabs/style/index.js +0 -4
  171. package/dist/esm/Tabs.js +0 -9
  172. package/dist/esm/Tag/style/index.js +0 -2
  173. package/dist/esm/Tag.js +0 -111
  174. package/dist/esm/TextArea/style/index.js +0 -2
  175. package/dist/esm/TextArea.js +0 -150
  176. package/dist/esm/TimeDetail/style/index.js +0 -2
  177. package/dist/esm/TimeDetail.js +0 -69
  178. package/dist/esm/TimePannel/style/index.js +0 -2
  179. package/dist/esm/TimePannel.js +0 -31
  180. package/dist/esm/TimeSelect/style/index.js +0 -4
  181. package/dist/esm/TimeSelect.js +0 -173
  182. package/dist/esm/Toast/style/index.js +0 -2
  183. package/dist/esm/Toast.js +0 -271
  184. package/dist/esm/TrendArrow/style/index.js +0 -2
  185. package/dist/esm/TrendArrow.js +0 -101
  186. package/dist/esm/Uploader/style/index.js +0 -4
  187. package/dist/esm/Uploader.js +0 -566
  188. package/dist/esm/UserContext-101ad4a4.js +0 -3
  189. package/dist/esm/UserContext-2629d479.js +0 -3
  190. package/dist/esm/UserContext-b33bcf21.js +0 -3
  191. package/dist/esm/Video/style/index.js +0 -2
  192. package/dist/esm/Video.js +0 -92
  193. package/dist/esm/VirtualList/style/index.js +0 -2
  194. package/dist/esm/VirtualList.js +0 -315
  195. package/dist/esm/WaterMark/style/index.js +0 -2
  196. package/dist/esm/WaterMark.js +0 -113
  197. package/dist/esm/bem-3b438e61.js +0 -8
  198. package/dist/esm/cellgroup-fcc72767.js +0 -34
  199. package/dist/esm/checkbox-44e13cd0.js +0 -137
  200. package/dist/esm/date-c7aad4c0.js +0 -97
  201. package/dist/esm/formitem-8a73a5fb.js +0 -157
  202. package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
  203. package/dist/esm/grid.context-2ee27d95.js +0 -6
  204. package/dist/esm/icon-4ef1581c.js +0 -70
  205. package/dist/esm/index-030b7245.js +0 -11
  206. package/dist/esm/nutui-react.es.js +0 -94
  207. package/dist/esm/offsetContext-3ab00d40.js +0 -16
  208. package/dist/esm/overlay-de6c79d5.js +0 -83
  209. package/dist/esm/radio-9f141e6b.js +0 -118
  210. package/dist/esm/render-bbebb760.js +0 -79
  211. package/dist/esm/tabpane-01075e6c.js +0 -29
  212. package/dist/esm/tabs-e1b4e4b1.js +0 -181
  213. package/dist/esm/typings-f27b58f4.js +0 -8
  214. package/dist/esm/useClientRect-56bb675b.js +0 -39
  215. package/dist/esm/useTouch-cf73a407.js +0 -99
  216. package/dist/locales/base.d.ts +0 -129
  217. package/dist/locales/base.js +0 -5
  218. package/dist/locales/en-US.d.ts +0 -3
  219. package/dist/locales/en-US.js +0 -135
  220. package/dist/locales/id-ID.d.ts +0 -3
  221. package/dist/locales/id-ID.js +0 -135
  222. package/dist/locales/zh-CN.d.ts +0 -3
  223. package/dist/locales/zh-CN.js +0 -137
  224. package/dist/locales/zh-TW.d.ts +0 -3
  225. package/dist/locales/zh-TW.js +0 -135
  226. package/dist/locales/zh-UG.d.ts +0 -3
  227. package/dist/locales/zh-UG.js +0 -135
  228. package/dist/packages/actionsheet/actionsheet.scss +0 -103
  229. package/dist/packages/address/address.scss +0 -243
  230. package/dist/packages/animate/animate.scss +0 -284
  231. package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -0
  232. package/dist/packages/animatingnumbers/countup.scss +0 -45
  233. package/dist/packages/audio/audio.scss +0 -93
  234. package/dist/packages/avatar/avatar.scss +0 -58
  235. package/dist/packages/avatargroup/avatargroup.scss +0 -14
  236. package/dist/packages/backtop/backtop.scss +0 -29
  237. package/dist/packages/badge/badge.scss +0 -53
  238. package/dist/packages/barrage/barrage.scss +0 -60
  239. package/dist/packages/button/button.scss +0 -245
  240. package/dist/packages/calendar/calendar.scss +0 -265
  241. package/dist/packages/calendaritem/calendaritem.scss +0 -0
  242. package/dist/packages/card/card.scss +0 -83
  243. package/dist/packages/cascader/cascader.scss +0 -108
  244. package/dist/packages/cell/cell.scss +0 -107
  245. package/dist/packages/cellgroup/cellgroup.scss +0 -46
  246. package/dist/packages/checkbox/checkbox.scss +0 -49
  247. package/dist/packages/checkboxgroup/checkboxgroup.scss +0 -33
  248. package/dist/packages/circleprogress/circleprogress.scss +0 -33
  249. package/dist/packages/col/col.scss +0 -24
  250. package/dist/packages/collapse/collapse.scss +0 -0
  251. package/dist/packages/collapseitem/collapseitem.scss +0 -161
  252. package/dist/packages/configprovider/configprovider.scss +0 -0
  253. package/dist/packages/countdown/countdown.scss +0 -3
  254. package/dist/packages/datepicker/datepicker.scss +0 -0
  255. package/dist/packages/dialog/dialog.scss +0 -135
  256. package/dist/packages/divider/divider.scss +0 -73
  257. package/dist/packages/drag/drag.scss +0 -10
  258. package/dist/packages/elevator/elevator.scss +0 -124
  259. package/dist/packages/ellipsis/ellipsis.scss +0 -17
  260. package/dist/packages/empty/empty.scss +0 -42
  261. package/dist/packages/fixednav/fixednav.scss +0 -141
  262. package/dist/packages/form/form.scss +0 -31
  263. package/dist/packages/formitem/formitem.scss +0 -100
  264. package/dist/packages/grid/grid.scss +0 -10
  265. package/dist/packages/griditem/griditem.scss +0 -108
  266. package/dist/packages/icon/icon.scss +0 -132
  267. package/dist/packages/image/image.scss +0 -53
  268. package/dist/packages/imagepreview/imagepreview.scss +0 -51
  269. package/dist/packages/indicator/indicator.scss +0 -70
  270. package/dist/packages/infiniteloading/infiniteloading.scss +0 -69
  271. package/dist/packages/input/input.scss +0 -203
  272. package/dist/packages/inputnumber/inputnumber.scss +0 -79
  273. package/dist/packages/layout/layout.scss +0 -2
  274. package/dist/packages/menu/menu.scss +0 -75
  275. package/dist/packages/menuitem/menuitem.scss +0 -120
  276. package/dist/packages/navbar/navbar.scss +0 -185
  277. package/dist/packages/noticebar/noticebar.scss +0 -156
  278. package/dist/packages/notify/notify.scss +0 -93
  279. package/dist/packages/numberkeyboard/numberkeyboard.scss +0 -147
  280. package/dist/packages/overlay/overlay.scss +0 -75
  281. package/dist/packages/pagination/pagination.scss +0 -81
  282. package/dist/packages/picker/picker.scss +0 -225
  283. package/dist/packages/popover/popover.scss +0 -288
  284. package/dist/packages/popup/popup.scss +0 -201
  285. package/dist/packages/price/price.scss +0 -37
  286. package/dist/packages/progress/progress.scss +0 -114
  287. package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -26
  288. package/dist/packages/radio/radio.scss +0 -84
  289. package/dist/packages/radiogroup/radiogroup.scss +0 -86
  290. package/dist/packages/range/range.scss +0 -224
  291. package/dist/packages/rate/rate.scss +0 -36
  292. package/dist/packages/row/row.scss +0 -83
  293. package/dist/packages/searchbar/searchbar.scss +0 -146
  294. package/dist/packages/shortpassword/shortpassword.scss +0 -203
  295. package/dist/packages/sidenavbar/sidenavbar.scss +0 -100
  296. package/dist/packages/sidenavbaritem/sidenavbaritem.scss +0 -25
  297. package/dist/packages/signature/signature.scss +0 -39
  298. package/dist/packages/skeleton/skeleton.scss +0 -70
  299. package/dist/packages/step/step.scss +0 -274
  300. package/dist/packages/steps/steps.scss +0 -7
  301. package/dist/packages/sticky/sticky.scss +0 -3
  302. package/dist/packages/subsidenavbar/subsidenavbar.scss +0 -35
  303. package/dist/packages/swipe/swipe.scss +0 -33
  304. package/dist/packages/swiper/swiper.scss +0 -45
  305. package/dist/packages/swiperitem/swiperitem.scss +0 -3
  306. package/dist/packages/switch/switch.scss +0 -87
  307. package/dist/packages/tabbar/tabbar.scss +0 -46
  308. package/dist/packages/tabbaritem/tabbaritem.scss +0 -97
  309. package/dist/packages/table/table.scss +0 -152
  310. package/dist/packages/tabpane/tabpane.scss +0 -23
  311. package/dist/packages/tabs/tabs.scss +0 -284
  312. package/dist/packages/tag/tag.scss +0 -67
  313. package/dist/packages/textarea/textarea.scss +0 -60
  314. package/dist/packages/timedetail/timedetail.scss +0 -45
  315. package/dist/packages/timepannel/timepannel.scss +0 -17
  316. package/dist/packages/timeselect/timeselect.scss +0 -73
  317. package/dist/packages/toast/toast.scss +0 -98
  318. package/dist/packages/trendarrow/trendarrow.scss +0 -17
  319. package/dist/packages/uploader/uploader.scss +0 -237
  320. package/dist/packages/video/video.scss +0 -18
  321. package/dist/packages/virtuallist/virtuallist.scss +0 -87
  322. package/dist/packages/watermark/watermark.scss +0 -13
  323. package/dist/style.css +0 -1
  324. package/dist/style.mjs +0 -9
  325. package/dist/styles/animation/drop.scss +0 -24
  326. package/dist/styles/animation/ease.scss +0 -23
  327. package/dist/styles/animation/fade.scss +0 -20
  328. package/dist/styles/animation/icon.scss +0 -245
  329. package/dist/styles/animation/index.scss +0 -7
  330. package/dist/styles/animation/rotate.scss +0 -10
  331. package/dist/styles/animation/zoom.scss +0 -26
  332. package/dist/styles/font/config.json +0 -175
  333. package/dist/styles/font/demo.css +0 -539
  334. package/dist/styles/font/demo_index.html +0 -3063
  335. package/dist/styles/font/iconfont.css +0 -515
  336. package/dist/styles/font/iconfont.eot +0 -0
  337. package/dist/styles/font/iconfont.js +0 -68
  338. package/dist/styles/font/iconfont.json +0 -884
  339. package/dist/styles/font/iconfont.svg +0 -356
  340. package/dist/styles/font/iconfont.ttf +0 -0
  341. package/dist/styles/font/iconfont.woff +0 -0
  342. package/dist/styles/font/iconfont.woff2 +0 -0
  343. package/dist/styles/mixins/index.scss +0 -2
  344. package/dist/styles/mixins/make-animation.scss +0 -24
  345. package/dist/styles/mixins/text-ellipsis.scss +0 -20
  346. package/dist/styles/theme-dark.scss +0 -26
  347. package/dist/styles/theme-default.scss +0 -40
  348. package/dist/styles/themes/default.scss +0 -97
  349. package/dist/styles/variables.scss +0 -2610
  350. package/dist/types/index.d.ts +0 -2198
@@ -1,673 +0,0 @@
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 _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
- import React__default, { useState, useEffect } from 'react';
14
- import classNames from 'classnames';
15
- import Popup from './Popup.js';
16
- import { T as Tabs } from './tabs-e1b4e4b1.js';
17
- import { T as TabPane } from './tabpane-01075e6c.js';
18
- import { I as Icon } from './icon-4ef1581c.js';
19
- import { c as cn } from './bem-3b438e61.js';
20
- import './Icon.js';
21
- import './typings-f27b58f4.js';
22
- import './TabPane.js';
23
- import '@bem-react/classname';
24
- var defaultProps$1 = {
25
- data: {
26
- text: '',
27
- value: '',
28
- paneKey: '',
29
- disabled: false,
30
- loading: false,
31
- children: []
32
- },
33
- activeColor: '#fa2c19',
34
- checked: false,
35
- checkedIcon: 'checklist',
36
- chooseItem: function chooseItem() {}
37
- };
38
- var InternalCascaderItem = function InternalCascaderItem(props, ref) {
39
- var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
40
- data = _defaultProps$1$props.data,
41
- checked = _defaultProps$1$props.checked,
42
- checkedIcon = _defaultProps$1$props.checkedIcon,
43
- chooseItem = _defaultProps$1$props.chooseItem,
44
- activeColor = _defaultProps$1$props.activeColor;
45
- var b = cn('cascader-item');
46
- var classes = classNames({
47
- active: checked,
48
- disabled: data.disabled
49
- }, b(''));
50
- var classesTitle = classNames(_defineProperty({}, "".concat(b(''), "__title"), true));
51
- return React__default.createElement("div", {
52
- style: {
53
- color: checked ? activeColor : ''
54
- },
55
- className: classes,
56
- onClick: function onClick() {
57
- chooseItem(data);
58
- }
59
- }, React__default.createElement("div", {
60
- className: classesTitle
61
- }, data.text), data.loading ? React__default.createElement(Icon, {
62
- color: "#969799",
63
- className: "nut-cascader-item__icon-loading",
64
- name: "loading"
65
- }) : React__default.createElement(Icon, {
66
- className: "".concat(checked ? b('icon-check') : ''),
67
- name: checked ? checkedIcon : ''
68
- }));
69
- };
70
- var CascaderItem = React__default.forwardRef(InternalCascaderItem);
71
- CascaderItem.defaultProps = defaultProps$1;
72
- CascaderItem.displayName = 'NutCascaderItem';
73
- var formatTree = function formatTree(tree, parent, config) {
74
- return tree.map(function (node) {
75
- var _config$value = config.value,
76
- valueKey = _config$value === void 0 ? 'value' : _config$value,
77
- _config$text = config.text,
78
- textKey = _config$text === void 0 ? 'text' : _config$text,
79
- _config$children = config.children,
80
- childrenKey = _config$children === void 0 ? 'children' : _config$children;
81
- var value = node[valueKey],
82
- text = node[textKey],
83
- children = node[childrenKey],
84
- others = _objectWithoutProperties(node, [valueKey, textKey, childrenKey].map(_toPropertyKey));
85
- var newNode = _objectSpread(_objectSpread({
86
- loading: false
87
- }, others), {}, {
88
- level: parent ? (parent && parent.level || 0) + 1 : 0,
89
- value: value,
90
- text: text,
91
- children: children,
92
- _parent: parent
93
- });
94
- if (newNode.children && newNode.children.length) {
95
- newNode.children = formatTree(newNode.children, newNode, config);
96
- }
97
- return newNode;
98
- });
99
- };
100
- var eachTree = function eachTree(tree, cb) {
101
- var i = 0;
102
- var node;
103
- while (node = tree[i++]) {
104
- if (cb(node) === true) {
105
- break;
106
- }
107
- if (node.children && node.children.length) {
108
- eachTree(node.children, cb);
109
- }
110
- }
111
- };
112
- var defaultConvertConfig = {
113
- topId: null,
114
- idKey: 'id',
115
- pidKey: 'pid',
116
- sortKey: ''
117
- };
118
- var convertListToOptions = function convertListToOptions(list, options) {
119
- var mergedOptions = _objectSpread(_objectSpread({}, defaultConvertConfig), options || {});
120
- var topId = mergedOptions.topId,
121
- idKey = mergedOptions.idKey,
122
- pidKey = mergedOptions.pidKey,
123
- sortKey = mergedOptions.sortKey;
124
- var result = [];
125
- var map = {};
126
- list.forEach(function (node) {
127
- node = _objectSpread({}, node);
128
- var _node = node,
129
- id = _node[idKey],
130
- pid = _node[pidKey];
131
- var children = map[pid] = map[pid] || [];
132
- // const children = map[pid] || []
133
- if (!result.length && pid === topId) {
134
- result = children;
135
- }
136
- children.push(node);
137
- node.children = map[id] || (map[id] = []);
138
- });
139
- if (sortKey) {
140
- Object.keys(map).forEach(function (i) {
141
- if (map[i].length > 1) {
142
- map[i].sort(function (a, b) {
143
- return a[sortKey] - b[sortKey];
144
- });
145
- }
146
- });
147
- }
148
- map = null;
149
- return result;
150
- };
151
- var Tree = /*#__PURE__*/function () {
152
- function Tree(nodes, config) {
153
- var _this = this;
154
- _classCallCheck(this, Tree);
155
- _defineProperty(this, "nodes", void 0);
156
- _defineProperty(this, "config", void 0);
157
- _defineProperty(this, "isLeaf", function (node, lazy) {
158
- var leaf = node.leaf,
159
- children = node.children;
160
- var hasChildren = Array.isArray(children) && Boolean(children.length);
161
- return leaf || !hasChildren && !lazy;
162
- });
163
- _defineProperty(this, "hasChildren", function (node, lazy) {
164
- var isLeaf = _this.isLeaf(node, lazy);
165
- if (isLeaf) {
166
- return false;
167
- }
168
- var children = node.children;
169
- return Array.isArray(children) && Boolean(children.length);
170
- });
171
- this.config = _objectSpread({
172
- value: 'value',
173
- text: 'text',
174
- children: 'children'
175
- }, config || {});
176
- this.nodes = formatTree(nodes, null, this.config);
177
- }
178
- _createClass(Tree, [{
179
- key: "updateChildren",
180
- value: function updateChildren(nodes, parent) {
181
- if (!parent) {
182
- this.nodes = formatTree(nodes, null, this.config);
183
- } else {
184
- parent.children = formatTree(nodes, parent, this.config);
185
- }
186
- }
187
- // for test
188
- }, {
189
- key: "getNodeByValue",
190
- value: function getNodeByValue(value) {
191
- var foundNode;
192
- eachTree(this.nodes, function (node) {
193
- if (node.value === value) {
194
- foundNode = node;
195
- return true;
196
- }
197
- return null;
198
- });
199
- return foundNode;
200
- }
201
- }, {
202
- key: "getPathNodesByValue",
203
- value: function getPathNodesByValue(value) {
204
- if (!value.length) {
205
- return [];
206
- }
207
- var pathNodes = [];
208
- var currentNodes = this.nodes;
209
- while (currentNodes && currentNodes.length) {
210
- var foundNode = currentNodes.find(function (node) {
211
- return node.value === value[node.level];
212
- });
213
- if (!foundNode) {
214
- break;
215
- }
216
- pathNodes.push(foundNode);
217
- currentNodes = foundNode.children;
218
- }
219
- return pathNodes;
220
- }
221
- }]);
222
- return Tree;
223
- }();
224
- var defaultProps = _objectSpread({
225
- className: '',
226
- style: {},
227
- activeColor: '#fa2c19',
228
- checkedIcon: 'checklist',
229
- tabsColor: '',
230
- poppable: true,
231
- visible: false,
232
- options: [],
233
- value: [],
234
- title: '',
235
- textKey: 'text',
236
- valueKey: 'value',
237
- childrenKey: 'children',
238
- convertConfig: {},
239
- closeable: false,
240
- closeIconPosition: 'top-right',
241
- closeIcon: 'close',
242
- lazy: false,
243
- lazyLoad: function lazyLoad() {},
244
- onClose: function onClose() {},
245
- onChange: function onChange() {},
246
- onPathChange: function onPathChange() {}
247
- }, Popup.defaultProps);
248
- var InternalCascader = function InternalCascader(props, ref) {
249
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
250
- className = _defaultProps$props.className,
251
- style = _defaultProps$props.style,
252
- tabsColor = _defaultProps$props.tabsColor,
253
- poppable = _defaultProps$props.poppable,
254
- visible = _defaultProps$props.visible,
255
- options = _defaultProps$props.options,
256
- value = _defaultProps$props.value,
257
- title = _defaultProps$props.title,
258
- textKey = _defaultProps$props.textKey,
259
- valueKey = _defaultProps$props.valueKey,
260
- childrenKey = _defaultProps$props.childrenKey,
261
- convertConfig = _defaultProps$props.convertConfig,
262
- closeable = _defaultProps$props.closeable,
263
- closeIconPosition = _defaultProps$props.closeIconPosition,
264
- closeIcon = _defaultProps$props.closeIcon,
265
- lazy = _defaultProps$props.lazy,
266
- lazyLoad = _defaultProps$props.lazyLoad,
267
- onClose = _defaultProps$props.onClose,
268
- onChange = _defaultProps$props.onChange,
269
- onPathChange = _defaultProps$props.onPathChange;
270
- var _useState = useState('c1'),
271
- _useState2 = _slicedToArray(_useState, 2),
272
- tabvalue = _useState2[0],
273
- setTabvalue = _useState2[1];
274
- var _useState3 = useState([]),
275
- _useState4 = _slicedToArray(_useState3, 2),
276
- optionsData = _useState4[0],
277
- setOptionsData = _useState4[1];
278
- var isLazy = function isLazy() {
279
- return state.configs.lazy && Boolean(state.configs.lazyLoad);
280
- };
281
- var _useState5 = useState({
282
- optionsData: [],
283
- panes: [{
284
- nodes: [],
285
- selectedNode: [],
286
- paneKey: ''
287
- }],
288
- innerValue: value,
289
- tree: new Tree([], {}),
290
- tabsCursor: 0,
291
- initLoading: false,
292
- currentProcessNode: [],
293
- configs: {
294
- lazy: lazy,
295
- lazyLoad: lazyLoad,
296
- valueKey: valueKey,
297
- textKey: textKey,
298
- childrenKey: childrenKey,
299
- convertConfig: convertConfig
300
- },
301
- lazyLoadMap: new Map()
302
- }),
303
- _useState6 = _slicedToArray(_useState5, 1),
304
- state = _useState6[0];
305
- var b = cn('cascader');
306
- var classes = classNames(b(''));
307
- var classesPane = classNames(_defineProperty({}, "".concat(b(''), "-pane"), true));
308
- useEffect(function () {
309
- initData();
310
- }, []);
311
- useEffect(function () {
312
- if (value !== state.innerValue) {
313
- state.innerValue = value;
314
- }
315
- }, [value]);
316
- useEffect(function () {
317
- initData();
318
- }, [options]);
319
- var initData = /*#__PURE__*/function () {
320
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
321
- return _regeneratorRuntime.wrap(function _callee$(_context) {
322
- while (1) switch (_context.prev = _context.next) {
323
- case 0:
324
- // 初始化开始处理数据
325
- state.lazyLoadMap.clear();
326
- if (convertConfig && Object.keys(convertConfig).length > 0) {
327
- state.optionsData = convertListToOptions(options, convertConfig);
328
- } else {
329
- state.optionsData = options;
330
- }
331
- state.tree = new Tree(state.optionsData, {
332
- value: state.configs.valueKey,
333
- text: state.configs.textKey,
334
- children: state.configs.childrenKey
335
- });
336
- if (!(isLazy() && !state.tree.nodes.length)) {
337
- _context.next = 6;
338
- break;
339
- }
340
- _context.next = 6;
341
- return invokeLazyLoad({
342
- root: true,
343
- loading: true,
344
- text: '',
345
- value: ''
346
- });
347
- case 6:
348
- state.panes = [{
349
- nodes: state.tree.nodes,
350
- selectedNode: null,
351
- paneKey: 'c1'
352
- }];
353
- syncValue();
354
- setOptionsData(state.panes);
355
- case 9:
356
- case "end":
357
- return _context.stop();
358
- }
359
- }, _callee);
360
- }));
361
- return function initData() {
362
- return _ref.apply(this, arguments);
363
- };
364
- }();
365
- // 处理有默认值时的数据
366
- var syncValue = /*#__PURE__*/function () {
367
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
368
- var currentValue, needToSync, parent, last, pathNodes;
369
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
370
- while (1) switch (_context3.prev = _context3.next) {
371
- case 0:
372
- currentValue = state.innerValue;
373
- if (!(currentValue === undefined || !state.tree.nodes.length)) {
374
- _context3.next = 3;
375
- break;
376
- }
377
- return _context3.abrupt("return");
378
- case 3:
379
- if (!(currentValue.length === 0)) {
380
- _context3.next = 6;
381
- break;
382
- }
383
- state.tabsCursor = 0;
384
- return _context3.abrupt("return");
385
- case 6:
386
- needToSync = currentValue;
387
- if (!(isLazy() && Array.isArray(currentValue) && currentValue.length)) {
388
- _context3.next = 19;
389
- break;
390
- }
391
- needToSync = [];
392
- parent = state.tree.nodes.find(function (node) {
393
- return node.value === currentValue[0];
394
- });
395
- if (!parent) {
396
- _context3.next = 19;
397
- break;
398
- }
399
- needToSync = [parent.value];
400
- state.initLoading = true;
401
- _context3.next = 15;
402
- return currentValue.slice(1).reduce( /*#__PURE__*/function () {
403
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p, value) {
404
- var _parent$children;
405
- var parent, node;
406
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
407
- while (1) switch (_context2.prev = _context2.next) {
408
- case 0:
409
- _context2.next = 2;
410
- return p;
411
- case 2:
412
- parent = _context2.sent;
413
- _context2.next = 5;
414
- return invokeLazyLoad(parent);
415
- case 5:
416
- node = parent === null || parent === void 0 ? void 0 : (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.find(function (item) {
417
- return item.value === value;
418
- });
419
- if (node) {
420
- needToSync.push(value);
421
- }
422
- return _context2.abrupt("return", Promise.resolve(node));
423
- case 8:
424
- case "end":
425
- return _context2.stop();
426
- }
427
- }, _callee2);
428
- }));
429
- return function (_x, _x2) {
430
- return _ref3.apply(this, arguments);
431
- };
432
- }(), Promise.resolve(parent));
433
- case 15:
434
- last = _context3.sent;
435
- _context3.next = 18;
436
- return invokeLazyLoad(last);
437
- case 18:
438
- state.initLoading = false;
439
- case 19:
440
- if (needToSync.length && currentValue === value) {
441
- pathNodes = state.tree.getPathNodesByValue(needToSync);
442
- pathNodes.forEach(function (node, index) {
443
- state.tabsCursor = index;
444
- // 当有默认值时,不触发 chooseItem 里的 emit 事件
445
- _chooseItem(node, true);
446
- });
447
- }
448
- case 20:
449
- case "end":
450
- return _context3.stop();
451
- }
452
- }, _callee3);
453
- }));
454
- return function syncValue() {
455
- return _ref2.apply(this, arguments);
456
- };
457
- }();
458
- var invokeLazyLoad = /*#__PURE__*/function () {
459
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
460
- var parent, lazyLoadPromise, nodes;
461
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
462
- while (1) switch (_context4.prev = _context4.next) {
463
- case 0:
464
- if (node) {
465
- _context4.next = 2;
466
- break;
467
- }
468
- return _context4.abrupt("return");
469
- case 2:
470
- if (state.configs.lazyLoad) {
471
- _context4.next = 5;
472
- break;
473
- }
474
- node.leaf = true;
475
- return _context4.abrupt("return");
476
- case 5:
477
- if (!(state.tree.isLeaf(node, isLazy()) || state.tree.hasChildren(node, isLazy()))) {
478
- _context4.next = 7;
479
- break;
480
- }
481
- return _context4.abrupt("return");
482
- case 7:
483
- node.loading = true;
484
- parent = node.root ? null : node;
485
- lazyLoadPromise = state.lazyLoadMap.get(node);
486
- if (!lazyLoadPromise) {
487
- lazyLoadPromise = new Promise(function (resolve) {
488
- var _state$configs$lazyLo, _state$configs;
489
- // 外部必须resolve
490
- (_state$configs$lazyLo = (_state$configs = state.configs).lazyLoad) === null || _state$configs$lazyLo === void 0 ? void 0 : _state$configs$lazyLo.call(_state$configs, node, resolve);
491
- });
492
- state.lazyLoadMap.set(node, lazyLoadPromise);
493
- }
494
- _context4.next = 13;
495
- return lazyLoadPromise;
496
- case 13:
497
- nodes = _context4.sent;
498
- if (Array.isArray(nodes) && nodes.length > 0) {
499
- state.tree.updateChildren(nodes, parent);
500
- } else {
501
- // 如果加载完成后没有提供子节点,作为叶子节点处理
502
- node.leaf = true;
503
- }
504
- node.loading = false;
505
- state.lazyLoadMap["delete"](node);
506
- case 17:
507
- case "end":
508
- return _context4.stop();
509
- }
510
- }, _callee4);
511
- }));
512
- return function invokeLazyLoad(_x3) {
513
- return _ref4.apply(this, arguments);
514
- };
515
- }();
516
- var close = function close() {
517
- onClose && onClose();
518
- };
519
- var closePopup = function closePopup() {
520
- close();
521
- };
522
- /* type: 是否是静默模式,是的话不触发事件
523
- tabsCursor: tab的索引 */
524
- var _chooseItem = /*#__PURE__*/function () {
525
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(node, type) {
526
- var pathNodes, optionParams, level, _pathNodes, _optionParams;
527
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
528
- while (1) switch (_context5.prev = _context5.next) {
529
- case 0:
530
- if (!(!type && node.disabled || !state.panes[state.tabsCursor])) {
531
- _context5.next = 2;
532
- break;
533
- }
534
- return _context5.abrupt("return");
535
- case 2:
536
- if (!state.tree.isLeaf(node, isLazy())) {
537
- _context5.next = 10;
538
- break;
539
- }
540
- node.leaf = true;
541
- state.panes[state.tabsCursor].selectedNode = node;
542
- state.panes = state.panes.slice(0, node.level + 1);
543
- if (!type) {
544
- pathNodes = state.panes.map(function (item) {
545
- return item.selectedNode;
546
- });
547
- optionParams = pathNodes.map(function (item) {
548
- return item.value;
549
- });
550
- onChange(optionParams, pathNodes);
551
- onPathChange(optionParams, pathNodes);
552
- }
553
- setOptionsData(state.panes);
554
- close();
555
- return _context5.abrupt("return");
556
- case 10:
557
- if (!state.tree.hasChildren(node, isLazy())) {
558
- _context5.next = 20;
559
- break;
560
- }
561
- level = node.level + 1;
562
- state.panes[state.tabsCursor].selectedNode = node;
563
- state.panes = state.panes.slice(0, level);
564
- state.tabsCursor = level;
565
- state.panes.push({
566
- nodes: node.children || [],
567
- selectedNode: null,
568
- paneKey: "c".concat(state.tabsCursor + 1)
569
- });
570
- setTabvalue("c".concat(state.tabsCursor + 1));
571
- setOptionsData(state.panes);
572
- if (!type) {
573
- _pathNodes = state.panes.map(function (item) {
574
- return item.selectedNode;
575
- });
576
- _optionParams = _pathNodes.map(function (item) {
577
- return item === null || item === void 0 ? void 0 : item.value;
578
- });
579
- onPathChange(_optionParams, _pathNodes);
580
- }
581
- return _context5.abrupt("return");
582
- case 20:
583
- state.currentProcessNode = node;
584
- if (!node.loading) {
585
- _context5.next = 23;
586
- break;
587
- }
588
- return _context5.abrupt("return");
589
- case 23:
590
- _context5.next = 25;
591
- return invokeLazyLoad(node);
592
- case 25:
593
- if (state.currentProcessNode === node) {
594
- state.panes[state.tabsCursor].selectedNode = node;
595
- _chooseItem(node, type);
596
- }
597
- setOptionsData(state.panes);
598
- case 27:
599
- case "end":
600
- return _context5.stop();
601
- }
602
- }, _callee5);
603
- }));
604
- return function chooseItem(_x4, _x5) {
605
- return _ref5.apply(this, arguments);
606
- };
607
- }();
608
- var renderItem = function renderItem() {
609
- return React__default.createElement("div", {
610
- className: "".concat(classes, " ").concat(className),
611
- style: style
612
- }, poppable && React__default.createElement("div", {
613
- className: b('title')
614
- }, title), React__default.createElement(Tabs, {
615
- value: tabvalue,
616
- titleNode: function titleNode() {
617
- return optionsData.map(function (pane, index) {
618
- var _pane$selectedNode, _pane$selectedNode2;
619
- return React__default.createElement("div", {
620
- onClick: function onClick() {
621
- setTabvalue(pane.paneKey);
622
- state.tabsCursor = index;
623
- },
624
- className: "nut-tabs__titles-item ".concat(tabvalue === pane.paneKey ? 'active' : ''),
625
- key: pane.paneKey
626
- }, React__default.createElement("span", {
627
- className: "nut-tabs__titles-item__text"
628
- }, !state.initLoading && state.panes.length && (pane === null || pane === void 0 ? void 0 : (_pane$selectedNode = pane.selectedNode) === null || _pane$selectedNode === void 0 ? void 0 : _pane$selectedNode.text), !state.initLoading && state.panes.length && !(pane !== null && pane !== void 0 && (_pane$selectedNode2 = pane.selectedNode) !== null && _pane$selectedNode2 !== void 0 && _pane$selectedNode2.text) && '请选择', !(!state.initLoading && state.panes.length) && 'Loading...'), React__default.createElement("span", {
629
- className: "nut-tabs__titles-item__line",
630
- style: {
631
- background: tabsColor
632
- }
633
- }));
634
- });
635
- }
636
- }, !state.initLoading && state.panes.length ? optionsData.map(function (pane) {
637
- return React__default.createElement(TabPane, {
638
- key: pane.paneKey,
639
- paneKey: pane.paneKey
640
- }, React__default.createElement("div", {
641
- className: classesPane
642
- }, pane.nodes && pane.nodes.map(function (node, index) {
643
- var _pane$selectedNode3;
644
- return React__default.createElement(CascaderItem, _objectSpread(_objectSpread({
645
- key: index
646
- }, props), {}, {
647
- data: node,
648
- checked: ((_pane$selectedNode3 = pane.selectedNode) === null || _pane$selectedNode3 === void 0 ? void 0 : _pane$selectedNode3.value) === node.value,
649
- chooseItem: function chooseItem(node) {
650
- return _chooseItem(node, false);
651
- }
652
- }));
653
- })));
654
- }) : React__default.createElement(TabPane, null, React__default.createElement("div", {
655
- className: classesPane
656
- }))));
657
- };
658
- return React__default.createElement(React__default.Fragment, null, poppable ? React__default.createElement(Popup, {
659
- popClass: "cascadar-popup",
660
- visible: visible,
661
- position: "bottom",
662
- round: true,
663
- closeable: closeable,
664
- closeIconPosition: closeIconPosition,
665
- closeIcon: closeIcon,
666
- onClickOverlay: closePopup,
667
- onClickCloseIcon: closePopup
668
- }, renderItem()) : renderItem());
669
- };
670
- var Cascader = React__default.forwardRef(InternalCascader);
671
- Cascader.defaultProps = defaultProps;
672
- Cascader.displayName = 'NutCascader';
673
- export { Cascader as default };
@@ -1,2 +0,0 @@
1
- import '../../Icon/style'
2
- import '../../../packages/cell/cell.scss'