tntd 2.0.13 → 2.0.14

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 (431) hide show
  1. package/es/array-input/index.js +31 -6
  2. package/es/columns/index.js +12 -6
  3. package/es/development-login/LoginModal.js +10 -4
  4. package/es/drawer/drawer.js +8 -4
  5. package/es/ellipsis/index.js +25 -14
  6. package/es/empty/empty.js +13 -9
  7. package/es/handle/index.js +27 -14
  8. package/es/img/Contain.js +19 -13
  9. package/es/img/Cover.js +24 -13
  10. package/es/img/index.js +21 -14
  11. package/es/index.js +1 -0
  12. package/es/loading-button/index.js +13 -6
  13. package/es/locale/default.js +2 -0
  14. package/es/locale/en_US.js +2 -0
  15. package/es/locale/zh_CN.js +2 -0
  16. package/es/page/Box.js +28 -19
  17. package/es/page/index.js +38 -22
  18. package/es/page/utils.js +5 -0
  19. package/es/prev-locale.js +3 -0
  20. package/es/query-form/Field/Checkbox.js +8 -4
  21. package/es/query-form/Field/Select.js +17 -10
  22. package/es/query-form/Field/SelectInput.js +18 -4
  23. package/es/query-form/Field/fieldsMap.js +1 -0
  24. package/es/query-form/Field/index.js +11 -2
  25. package/es/query-form/createActions.js +8 -0
  26. package/es/query-form/index.js +34 -2
  27. package/es/query-list-scene/List.js +39 -18
  28. package/es/query-list-scene/QueryForm.js +19 -10
  29. package/es/query-list-scene/QueryListScene.js +2 -0
  30. package/es/query-list-scene/Toolbar.js +10 -6
  31. package/es/query-list-scene/createActions.js +3 -0
  32. package/es/render-empty/render-empty.js +2 -0
  33. package/es/steps/steps.js +17 -9
  34. package/es/steps/style/nav.less +3 -1
  35. package/es/svg-components/illustration-403.js +2 -0
  36. package/es/svg-components/illustration-404.js +2 -0
  37. package/es/svg-components/illustration-500.js +2 -0
  38. package/es/svg-components/illustration-empty.js +2 -0
  39. package/es/svg-components/illustration-failure.js +2 -0
  40. package/es/svg-components/illustration-no-access.js +2 -0
  41. package/es/svg-components/illustration-no-chart.js +2 -0
  42. package/es/svg-components/illustration-no-result.js +2 -0
  43. package/es/svg-components/illustration-offline.js +2 -0
  44. package/es/svg-components/illustration-success.js +2 -0
  45. package/es/table/assets/image-loading-background.js +2 -0
  46. package/es/table/assets/image-loading.js +2 -0
  47. package/es/table/hooks/use-column-setting.js +1 -0
  48. package/es/table/table.js +19 -14
  49. package/es/table/table.stories.js +2 -0
  50. package/es/table/utils.js +6 -2
  51. package/es/title/index.js +14 -10
  52. package/es/tntd-cascader/AntdCascader/component/context.js +4 -2
  53. package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +2 -0
  54. package/es/tntd-cascader/AntdCascader/component/getIcons.js +15 -6
  55. package/es/tntd-cascader/AntdCascader/config/utils.js +2 -0
  56. package/es/tntd-cascader/AntdCascader/config/warning.js +8 -4
  57. package/es/tntd-cascader/AntdCascader/index.js +73 -51
  58. package/es/tntd-cascader/rc-cascader/Cascader.js +113 -86
  59. package/es/tntd-cascader/rc-cascader/OptionList/Column.js +26 -16
  60. package/es/tntd-cascader/rc-cascader/OptionList/index.js +43 -26
  61. package/es/tntd-cascader/rc-cascader/OptionList/useActive.js +7 -5
  62. package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +41 -12
  63. package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +10 -4
  64. package/es/tntd-cascader/rc-cascader/hooks/useEntities.js +4 -2
  65. package/es/tntd-cascader/rc-cascader/hooks/useMissingValues.js +1 -0
  66. package/es/tntd-cascader/rc-cascader/hooks/useRefFunc.js +1 -0
  67. package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +7 -2
  68. package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +15 -8
  69. package/es/tntd-cascader/rc-cascader/utils/commonUtil.js +6 -2
  70. package/es/tntd-cascader/rc-cascader/utils/treeUtil.js +4 -2
  71. package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +7 -2
  72. package/es/tntd-icon/fonts/iconfont.js +12 -7
  73. package/es/tntd-icon/index.js +9 -5
  74. package/es/tntd-layout/ActionsContext.js +2 -2
  75. package/es/tntd-layout/AppList.js +14 -2
  76. package/es/tntd-layout/Application.js +4 -0
  77. package/es/tntd-layout/Avatar.js +4 -0
  78. package/es/tntd-layout/CompatibleLanguage.js +13 -0
  79. package/es/tntd-layout/EnterpriseLayout/Avatar.js +4 -0
  80. package/es/tntd-layout/EnterpriseLayout/Language.js +6 -0
  81. package/es/tntd-layout/EnterpriseLayout/Theme.js +4 -0
  82. package/es/tntd-layout/EnterpriseLayout/index.js +2 -2
  83. package/es/tntd-layout/GlobalNavigation/NavigationPopup.js +33 -2
  84. package/es/tntd-layout/GlobalNavigation/index.js +6 -0
  85. package/es/tntd-layout/HeaderActions.js +32 -28
  86. package/es/tntd-layout/HeaderNavs.js +14 -6
  87. package/es/tntd-layout/HeaderTabs.js +35 -14
  88. package/es/tntd-layout/Language.js +6 -0
  89. package/es/tntd-layout/Layout.js +7 -2
  90. package/es/tntd-layout/Logo.js +11 -4
  91. package/es/tntd-layout/OrgAppList.js +39 -22
  92. package/es/tntd-layout/SideMenu.js +45 -8
  93. package/es/tntd-layout/Theme.js +6 -0
  94. package/es/tntd-layout/index.js +17 -9
  95. package/es/tntd-layout/paaslayout/CompactSideMenu.js +15 -0
  96. package/es/tntd-layout/paaslayout/SideMenu.js +15 -0
  97. package/es/tntd-layout/paaslayout/index.js +13 -4
  98. package/es/tntd-layout/storage.js +2 -2
  99. package/es/tntd-modal/index.js +18 -12
  100. package/es/tntd-second-page/index.js +3 -0
  101. package/es/tntd-select/DropDownWrap.js +8 -4
  102. package/es/tntd-select/index.js +118 -74
  103. package/es/utils/checkAuth.js +1 -0
  104. package/es/utils/findMenuInfoByPath.js +3 -0
  105. package/es/utils/index.js +11 -2
  106. package/lib/affix/index.js +10 -4
  107. package/lib/alert/index.js +10 -4
  108. package/lib/anchor/index.js +10 -4
  109. package/lib/array-input/icon.js +7 -1
  110. package/lib/array-input/index.js +91 -41
  111. package/lib/auth-context/index.js +3 -0
  112. package/lib/auto-complete/index.js +10 -4
  113. package/lib/avatar/index.js +10 -4
  114. package/lib/back-top/index.js +10 -4
  115. package/lib/badge/index.js +10 -4
  116. package/lib/breadcrumb/index.js +10 -4
  117. package/lib/button/index.js +10 -4
  118. package/lib/calendar/index.js +10 -4
  119. package/lib/card/index.js +10 -4
  120. package/lib/carousel/index.js +10 -4
  121. package/lib/cascader/index.js +10 -4
  122. package/lib/checkbox/index.js +10 -4
  123. package/lib/col/index.js +10 -4
  124. package/lib/collapse/index.js +11 -4
  125. package/lib/columns/index.js +28 -14
  126. package/lib/comment/index.js +10 -4
  127. package/lib/config-provider/config-provider.js +2 -0
  128. package/lib/config-provider/index.js +10 -4
  129. package/lib/date-picker/index.js +10 -4
  130. package/lib/descriptions/index.js +10 -4
  131. package/lib/development-login/LoginModal.js +50 -25
  132. package/lib/development-login/index.js +22 -11
  133. package/lib/divider/index.js +10 -4
  134. package/lib/drawer/drawer.js +16 -6
  135. package/lib/drawer/index.js +5 -1
  136. package/lib/dropdown/index.js +10 -4
  137. package/lib/ellipsis/Svg/CopySVG.js +4 -0
  138. package/lib/ellipsis/Svg/TickSVG.js +4 -0
  139. package/lib/ellipsis/index.js +73 -42
  140. package/lib/empty/empty.js +30 -14
  141. package/lib/empty/empty.stories.js +21 -3
  142. package/lib/empty/index.js +5 -1
  143. package/lib/exception/exception.js +14 -7
  144. package/lib/exception/index.js +4 -1
  145. package/lib/form/index.js +10 -4
  146. package/lib/handle/index.js +46 -19
  147. package/lib/icon/index.js +10 -4
  148. package/lib/img/Contain.js +23 -12
  149. package/lib/img/Cover.js +53 -31
  150. package/lib/img/index.js +47 -29
  151. package/lib/index.js +187 -100
  152. package/lib/input/index.js +10 -4
  153. package/lib/input-number/index.js +10 -4
  154. package/lib/layout/index.js +10 -4
  155. package/lib/list/index.js +10 -4
  156. package/lib/loading-button/index.js +32 -15
  157. package/lib/locale/default.js +5 -0
  158. package/lib/locale/en_US.js +4 -0
  159. package/lib/locale/index.js +6 -3
  160. package/lib/locale/zh_CN.js +4 -0
  161. package/lib/locale-provider/index.js +10 -4
  162. package/lib/mention/index.js +10 -4
  163. package/lib/mentions/index.js +10 -4
  164. package/lib/menu/index.js +10 -4
  165. package/lib/message/index.js +11 -4
  166. package/lib/modal/index.js +11 -4
  167. package/lib/notification/index.js +10 -4
  168. package/lib/page/Box.js +37 -24
  169. package/lib/page/index.js +66 -37
  170. package/lib/page/utils.js +9 -1
  171. package/lib/page-header/index.js +10 -4
  172. package/lib/pagination/index.js +10 -4
  173. package/lib/popconfirm/index.js +10 -4
  174. package/lib/popover/index.js +10 -4
  175. package/lib/prev-locale.js +10 -1
  176. package/lib/progress/index.js +10 -4
  177. package/lib/query-form/Field/Checkbox.js +11 -2
  178. package/lib/query-form/Field/Select.js +45 -27
  179. package/lib/query-form/Field/SelectInput.js +46 -21
  180. package/lib/query-form/Field/fieldsMap.js +12 -1
  181. package/lib/query-form/Field/index.js +70 -38
  182. package/lib/query-form/createActions.js +7 -0
  183. package/lib/query-form/index.js +121 -52
  184. package/lib/query-form/useForm.js +4 -0
  185. package/lib/query-list-scene/List.js +111 -58
  186. package/lib/query-list-scene/QueryForm.js +67 -37
  187. package/lib/query-list-scene/QueryListScene.js +42 -21
  188. package/lib/query-list-scene/Title.js +5 -1
  189. package/lib/query-list-scene/Toolbar.js +15 -8
  190. package/lib/query-list-scene/createActions.js +6 -0
  191. package/lib/query-list-scene/index.js +10 -0
  192. package/lib/query-list-scene/useActions.js +4 -0
  193. package/lib/radio/index.js +10 -4
  194. package/lib/rate/index.js +10 -4
  195. package/lib/render-empty/index.js +2 -0
  196. package/lib/render-empty/render-empty.js +8 -0
  197. package/lib/result/index.js +10 -4
  198. package/lib/row/index.js +10 -4
  199. package/lib/select/index.js +10 -4
  200. package/lib/skeleton/index.js +10 -4
  201. package/lib/slider/index.js +10 -4
  202. package/lib/spin/index.js +10 -4
  203. package/lib/statistic/index.js +10 -4
  204. package/lib/steps/index.js +5 -1
  205. package/lib/steps/steps.js +29 -12
  206. package/lib/steps/style/nav.less +3 -1
  207. package/lib/svg-components/illustration-403.js +9 -3
  208. package/lib/svg-components/illustration-404.js +9 -3
  209. package/lib/svg-components/illustration-500.js +9 -3
  210. package/lib/svg-components/illustration-empty.js +9 -3
  211. package/lib/svg-components/illustration-failure.js +9 -3
  212. package/lib/svg-components/illustration-no-access.js +9 -3
  213. package/lib/svg-components/illustration-no-chart.js +9 -3
  214. package/lib/svg-components/illustration-no-result.js +9 -3
  215. package/lib/svg-components/illustration-offline.js +9 -3
  216. package/lib/svg-components/illustration-success.js +9 -3
  217. package/lib/svg-components/index.js +11 -0
  218. package/lib/switch/index.js +10 -4
  219. package/lib/table/assets/image-loading-background.js +9 -3
  220. package/lib/table/assets/image-loading.js +9 -3
  221. package/lib/table/context.js +2 -0
  222. package/lib/table/hooks/index.js +2 -1
  223. package/lib/table/hooks/use-column-setting.js +16 -8
  224. package/lib/table/index.js +5 -1
  225. package/lib/table/table.js +63 -34
  226. package/lib/table/table.stories.js +11 -2
  227. package/lib/table/utils.js +11 -2
  228. package/lib/tabs/index.js +10 -4
  229. package/lib/tag/index.js +10 -4
  230. package/lib/time-picker/index.js +10 -4
  231. package/lib/timeline/index.js +10 -4
  232. package/lib/title/index.js +20 -10
  233. package/lib/tntd-cascader/AntdCascader/component/DisabledContext.js +11 -4
  234. package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.js +8 -3
  235. package/lib/tntd-cascader/AntdCascader/component/SizeContext.js +8 -3
  236. package/lib/tntd-cascader/AntdCascader/component/context.js +9 -3
  237. package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +12 -4
  238. package/lib/tntd-cascader/AntdCascader/component/getIcons.js +37 -19
  239. package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js +17 -8
  240. package/lib/tntd-cascader/AntdCascader/config/utils.js +15 -6
  241. package/lib/tntd-cascader/AntdCascader/config/warning.js +15 -7
  242. package/lib/tntd-cascader/AntdCascader/index.js +133 -80
  243. package/lib/tntd-cascader/AntdCascader/interface.js +3 -0
  244. package/lib/tntd-cascader/index.js +2 -0
  245. package/lib/tntd-cascader/rc-cascader/Cascader.js +188 -123
  246. package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js +21 -11
  247. package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +88 -60
  248. package/lib/tntd-cascader/rc-cascader/OptionList/index.js +109 -65
  249. package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js +33 -18
  250. package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +106 -56
  251. package/lib/tntd-cascader/rc-cascader/context.js +8 -3
  252. package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +31 -14
  253. package/lib/tntd-cascader/rc-cascader/hooks/useEntities.js +15 -5
  254. package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.js +11 -3
  255. package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.js +8 -3
  256. package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +15 -3
  257. package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +41 -26
  258. package/lib/tntd-cascader/rc-cascader/index.js +3 -0
  259. package/lib/tntd-cascader/rc-cascader/utils/commonUtil.js +20 -9
  260. package/lib/tntd-cascader/rc-cascader/utils/treeUtil.js +8 -0
  261. package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +14 -7
  262. package/lib/tntd-icon/fonts/iconfont.js +12 -7
  263. package/lib/tntd-icon/index.js +17 -6
  264. package/lib/tntd-layout/ActionsContext.js +3 -0
  265. package/lib/tntd-layout/AppList.js +105 -30
  266. package/lib/tntd-layout/Application.js +84 -22
  267. package/lib/tntd-layout/Avatar.js +72 -18
  268. package/lib/tntd-layout/CompatibleLanguage.js +105 -32
  269. package/lib/tntd-layout/EnterpriseLayout/Avatar.js +80 -24
  270. package/lib/tntd-layout/EnterpriseLayout/Language.js +45 -14
  271. package/lib/tntd-layout/EnterpriseLayout/Theme.js +46 -16
  272. package/lib/tntd-layout/EnterpriseLayout/index.js +12 -4
  273. package/lib/tntd-layout/GlobalNavigation/NavigationPopup.js +174 -45
  274. package/lib/tntd-layout/GlobalNavigation/index.js +70 -19
  275. package/lib/tntd-layout/Header.js +54 -20
  276. package/lib/tntd-layout/HeaderActions.js +64 -33
  277. package/lib/tntd-layout/HeaderNavs.js +59 -19
  278. package/lib/tntd-layout/HeaderTabs.js +111 -43
  279. package/lib/tntd-layout/Iconfont.js +5 -0
  280. package/lib/tntd-layout/Language.js +45 -14
  281. package/lib/tntd-layout/Layout.js +113 -74
  282. package/lib/tntd-layout/Logo.js +41 -14
  283. package/lib/tntd-layout/OrgAppList.js +119 -51
  284. package/lib/tntd-layout/SideMenu.js +120 -42
  285. package/lib/tntd-layout/Theme.js +71 -19
  286. package/lib/tntd-layout/createActions.js +5 -0
  287. package/lib/tntd-layout/images/index.js +28 -0
  288. package/lib/tntd-layout/index.js +49 -21
  289. package/lib/tntd-layout/paaslayout/CompactSideMenu.js +81 -29
  290. package/lib/tntd-layout/paaslayout/Header.js +47 -14
  291. package/lib/tntd-layout/paaslayout/Logo.js +19 -2
  292. package/lib/tntd-layout/paaslayout/SideMenu.js +82 -31
  293. package/lib/tntd-layout/paaslayout/index.js +108 -62
  294. package/lib/tntd-layout/storage.d.ts +1 -1
  295. package/lib/tntd-layout/storage.d.ts.map +1 -1
  296. package/lib/tntd-layout/storage.js +33 -3
  297. package/lib/tntd-modal/index.js +51 -32
  298. package/lib/tntd-second-page/index.js +24 -14
  299. package/lib/tntd-select/DropDownWrap.js +45 -24
  300. package/lib/tntd-select/index.js +206 -117
  301. package/lib/tooltip/index.js +10 -4
  302. package/lib/transfer/index.js +10 -4
  303. package/lib/tree/index.js +10 -4
  304. package/lib/tree-select/index.js +10 -4
  305. package/lib/typography/index.js +10 -4
  306. package/lib/upload/index.js +10 -4
  307. package/lib/utils/checkAuth.js +10 -4
  308. package/lib/utils/findMenuInfoByPath.js +7 -1
  309. package/lib/utils/index.js +41 -13
  310. package/lib/version/index.js +10 -4
  311. package/package.json +1 -1
  312. package/es/array-input/style/index.js +0 -1
  313. package/es/array-input/style/index.js.map +0 -1
  314. package/es/auth-context/style/index.js +0 -1
  315. package/es/auth-context/style/index.js.map +0 -1
  316. package/es/development-login/style/index.js +0 -1
  317. package/es/development-login/style/index.js.map +0 -1
  318. package/es/ellipsis/style/index.js +0 -1
  319. package/es/ellipsis/style/index.js.map +0 -1
  320. package/es/empty/render-empty.js +0 -22
  321. package/es/empty/render-empty.js.map +0 -1
  322. package/es/empty/style/index.js +0 -2
  323. package/es/empty/style/index.js.map +0 -1
  324. package/es/handle/style/index.js +0 -1
  325. package/es/handle/style/index.js.map +0 -1
  326. package/es/icon-list/style/index.js +0 -1
  327. package/es/icon-list/style/index.js.map +0 -1
  328. package/es/img/style/index.js +0 -1
  329. package/es/img/style/index.js.map +0 -1
  330. package/es/loading-button/style/index.js +0 -1
  331. package/es/loading-button/style/index.js.map +0 -1
  332. package/es/page/style/index.js +0 -1
  333. package/es/page/style/index.js.map +0 -1
  334. package/es/query-form/style/index.js +0 -1
  335. package/es/query-form/style/index.js.map +0 -1
  336. package/es/query-list-scene/style/index.js +0 -1
  337. package/es/query-list-scene/style/index.js.map +0 -1
  338. package/es/render-empty/style/index.js +0 -1
  339. package/es/render-empty/style/index.js.map +0 -1
  340. package/es/table/style/index.js +0 -2
  341. package/es/table/style/index.js.map +0 -1
  342. package/es/title/style/index.js +0 -1
  343. package/es/title/style/index.js.map +0 -1
  344. package/es/tntd-icon/style/index.js +0 -1
  345. package/es/tntd-icon/style/index.js.map +0 -1
  346. package/es/tntd-layout/style/index.js +0 -1
  347. package/es/tntd-layout/style/index.js.map +0 -1
  348. package/es/tntd-modal/style/index.js +0 -1
  349. package/es/tntd-modal/style/index.js.map +0 -1
  350. package/es/tntd-select/style/index.js +0 -1
  351. package/es/tntd-select/style/index.js.map +0 -1
  352. package/lib/array-input/style/index.d.ts +0 -1
  353. package/lib/array-input/style/index.d.ts.map +0 -1
  354. package/lib/array-input/style/index.js +0 -1
  355. package/lib/array-input/style/index.js.map +0 -1
  356. package/lib/auth-context/style/index.d.ts +0 -1
  357. package/lib/auth-context/style/index.d.ts.map +0 -1
  358. package/lib/auth-context/style/index.js +0 -1
  359. package/lib/auth-context/style/index.js.map +0 -1
  360. package/lib/development-login/style/index.d.ts +0 -1
  361. package/lib/development-login/style/index.d.ts.map +0 -1
  362. package/lib/development-login/style/index.js +0 -1
  363. package/lib/development-login/style/index.js.map +0 -1
  364. package/lib/ellipsis/style/index.d.ts +0 -1
  365. package/lib/ellipsis/style/index.d.ts.map +0 -1
  366. package/lib/ellipsis/style/index.js +0 -1
  367. package/lib/ellipsis/style/index.js.map +0 -1
  368. package/lib/empty/render-empty.d.ts +0 -3
  369. package/lib/empty/render-empty.d.ts.map +0 -1
  370. package/lib/empty/render-empty.js +0 -32
  371. package/lib/empty/render-empty.js.map +0 -1
  372. package/lib/empty/style/index.d.ts +0 -3
  373. package/lib/empty/style/index.d.ts.map +0 -1
  374. package/lib/empty/style/index.js +0 -4
  375. package/lib/empty/style/index.js.map +0 -1
  376. package/lib/handle/style/index.d.ts +0 -1
  377. package/lib/handle/style/index.d.ts.map +0 -1
  378. package/lib/handle/style/index.js +0 -1
  379. package/lib/handle/style/index.js.map +0 -1
  380. package/lib/icon-list/style/index.d.ts +0 -3
  381. package/lib/icon-list/style/index.d.ts.map +0 -1
  382. package/lib/icon-list/style/index.js +0 -8
  383. package/lib/icon-list/style/index.js.map +0 -1
  384. package/lib/img/style/index.d.ts +0 -1
  385. package/lib/img/style/index.d.ts.map +0 -1
  386. package/lib/img/style/index.js +0 -1
  387. package/lib/img/style/index.js.map +0 -1
  388. package/lib/loading-button/style/index.d.ts +0 -1
  389. package/lib/loading-button/style/index.d.ts.map +0 -1
  390. package/lib/loading-button/style/index.js +0 -1
  391. package/lib/loading-button/style/index.js.map +0 -1
  392. package/lib/page/style/index.d.ts +0 -1
  393. package/lib/page/style/index.d.ts.map +0 -1
  394. package/lib/page/style/index.js +0 -1
  395. package/lib/page/style/index.js.map +0 -1
  396. package/lib/query-form/style/index.d.ts +0 -1
  397. package/lib/query-form/style/index.d.ts.map +0 -1
  398. package/lib/query-form/style/index.js +0 -1
  399. package/lib/query-form/style/index.js.map +0 -1
  400. package/lib/query-list-scene/style/index.d.ts +0 -1
  401. package/lib/query-list-scene/style/index.d.ts.map +0 -1
  402. package/lib/query-list-scene/style/index.js +0 -1
  403. package/lib/query-list-scene/style/index.js.map +0 -1
  404. package/lib/render-empty/style/index.d.ts +0 -2
  405. package/lib/render-empty/style/index.d.ts.map +0 -1
  406. package/lib/render-empty/style/index.js +0 -3
  407. package/lib/render-empty/style/index.js.map +0 -1
  408. package/lib/table/style/index.d.ts +0 -3
  409. package/lib/table/style/index.d.ts.map +0 -1
  410. package/lib/table/style/index.js +0 -4
  411. package/lib/table/style/index.js.map +0 -1
  412. package/lib/title/style/index.d.ts +0 -1
  413. package/lib/title/style/index.d.ts.map +0 -1
  414. package/lib/title/style/index.js +0 -1
  415. package/lib/title/style/index.js.map +0 -1
  416. package/lib/tntd-icon/style/index.d.ts +0 -1
  417. package/lib/tntd-icon/style/index.d.ts.map +0 -1
  418. package/lib/tntd-icon/style/index.js +0 -1
  419. package/lib/tntd-icon/style/index.js.map +0 -1
  420. package/lib/tntd-layout/style/index.d.ts +0 -1
  421. package/lib/tntd-layout/style/index.d.ts.map +0 -1
  422. package/lib/tntd-layout/style/index.js +0 -1
  423. package/lib/tntd-layout/style/index.js.map +0 -1
  424. package/lib/tntd-modal/style/index.d.ts +0 -1
  425. package/lib/tntd-modal/style/index.d.ts.map +0 -1
  426. package/lib/tntd-modal/style/index.js +0 -1
  427. package/lib/tntd-modal/style/index.js.map +0 -1
  428. package/lib/tntd-select/style/index.d.ts +0 -1
  429. package/lib/tntd-select/style/index.d.ts.map +0 -1
  430. package/lib/tntd-select/style/index.js +0 -1
  431. package/lib/tntd-select/style/index.js.map +0 -1
@@ -1,11 +1,14 @@
1
1
  var __rest = this && this.__rest || function (s, e) {
2
2
  var t = {};
3
+
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5
+
4
6
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
7
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
8
  }
7
9
  return t;
8
10
  };
11
+
9
12
  import { BaseSelect } from 'rc-select';
10
13
  import useId from 'rc-select/lib/hooks/useId';
11
14
  import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
@@ -24,78 +27,87 @@ import { formatStrategyValues, toPathOptions } from './utils/treeUtil';
24
27
  import warningProps, { warningNullOptions } from './utils/warningPropsUtil';
25
28
  import './context';
26
29
  import './index.less';
30
+
27
31
  function isMultipleValue(value) {
28
32
  return Array.isArray(value) && Array.isArray(value[0]);
29
33
  }
34
+
30
35
  function toRawValues(value) {
31
36
  if (!value) {
32
37
  return [];
33
38
  }
39
+
34
40
  if (isMultipleValue(value)) {
35
41
  return value;
36
42
  }
43
+
37
44
  return (value.length === 0 ? [] : [value]).map(val => Array.isArray(val) ? val : [val]);
38
45
  }
46
+
39
47
  const Cascader = React.forwardRef((props, ref) => {
40
48
  const {
41
- // MISC
42
- id,
43
- prefixCls = 'rc-cascader',
44
- fieldNames,
45
- // Value
46
- defaultValue,
47
- value,
48
- changeOnSelect,
49
- onChange,
50
- displayRender,
51
- checkable,
52
- // Search
53
- searchValue,
54
- onSearch,
55
- showSearch,
56
- // Trigger
57
- expandTrigger,
58
- // Options
59
- options,
60
- dropdownPrefixCls,
61
- loadData,
62
- // Open
63
- popupVisible,
64
- open,
65
- popupClassName,
66
- dropdownClassName,
67
- dropdownMenuColumnStyle,
68
- popupPlacement,
69
- placement,
70
- onDropdownVisibleChange,
71
- onPopupVisibleChange,
72
- renderItem,
73
- // Icon
74
- expandIcon = '>',
75
- loadingIcon,
76
- // Children
77
- children,
78
- dropdownMatchSelectWidth = false,
79
- showCheckedStrategy = SHOW_PARENT
80
- } = props,
81
- restProps = __rest(props, ["id", "prefixCls", "fieldNames", "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "checkable", "searchValue", "onSearch", "showSearch", "expandTrigger", "options", "dropdownPrefixCls", "loadData", "popupVisible", "open", "popupClassName", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", "renderItem", "expandIcon", "loadingIcon", "children", "dropdownMatchSelectWidth", "showCheckedStrategy"]);
49
+ // MISC
50
+ id,
51
+ prefixCls = 'rc-cascader',
52
+ fieldNames,
53
+ // Value
54
+ defaultValue,
55
+ value,
56
+ changeOnSelect,
57
+ onChange,
58
+ displayRender,
59
+ checkable,
60
+ // Search
61
+ searchValue,
62
+ onSearch,
63
+ showSearch,
64
+ // Trigger
65
+ expandTrigger,
66
+ // Options
67
+ options,
68
+ dropdownPrefixCls,
69
+ loadData,
70
+ // Open
71
+ popupVisible,
72
+ open,
73
+ popupClassName,
74
+ dropdownClassName,
75
+ dropdownMenuColumnStyle,
76
+ popupPlacement,
77
+ placement,
78
+ onDropdownVisibleChange,
79
+ onPopupVisibleChange,
80
+ renderItem,
81
+ // Icon
82
+ expandIcon = '>',
83
+ loadingIcon,
84
+ // Children
85
+ children,
86
+ dropdownMatchSelectWidth = false,
87
+ showCheckedStrategy = SHOW_PARENT
88
+ } = props,
89
+ restProps = __rest(props, ["id", "prefixCls", "fieldNames", "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "checkable", "searchValue", "onSearch", "showSearch", "expandTrigger", "options", "dropdownPrefixCls", "loadData", "popupVisible", "open", "popupClassName", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", "renderItem", "expandIcon", "loadingIcon", "children", "dropdownMatchSelectWidth", "showCheckedStrategy"]);
90
+
82
91
  const mergedId = useId(id);
83
92
  const multiple = !!checkable;
84
- const [dropdownVisible, setDropdownVisible] = React.useState(false);
85
- // =========================== Values ===========================
93
+ const [dropdownVisible, setDropdownVisible] = React.useState(false); // =========================== Values ===========================
94
+
86
95
  const [rawValues, setRawValues] = useMergedState(defaultValue, {
87
96
  value,
88
97
  postState: toRawValues
89
- });
90
- // ========================= FieldNames =========================
91
- const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
98
+ }); // ========================= FieldNames =========================
99
+
100
+ const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames),
101
+ /* eslint-disable react-hooks/exhaustive-deps */
92
102
  [JSON.stringify(fieldNames)]
93
- /* eslint-enable react-hooks/exhaustive-deps */);
94
- // =========================== Option ===========================
95
- const mergedOptions = React.useMemo(() => options || [], [options]);
96
- // Only used in multiple mode, this fn will not call in single mode
103
+ /* eslint-enable react-hooks/exhaustive-deps */
104
+ ); // =========================== Option ===========================
105
+
106
+ const mergedOptions = React.useMemo(() => options || [], [options]); // Only used in multiple mode, this fn will not call in single mode
107
+
97
108
  const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
98
109
  /** Convert path key back to value format */
110
+
99
111
  const getValueByKeyPath = React.useCallback(pathKeys => {
100
112
  const keyPathEntities = getPathKeyEntities();
101
113
  return pathKeys.map(pathKey => {
@@ -104,35 +116,40 @@ const Cascader = React.forwardRef((props, ref) => {
104
116
  } = keyPathEntities[pathKey];
105
117
  return nodes.map(node => node[mergedFieldNames.value]);
106
118
  });
107
- }, [getPathKeyEntities, mergedFieldNames]);
108
- // =========================== Search ===========================
119
+ }, [getPathKeyEntities, mergedFieldNames]); // =========================== Search ===========================
120
+
109
121
  const [mergedSearchValue, setSearchValue] = useMergedState('', {
110
122
  value: searchValue,
111
123
  postState: search => search || ''
112
124
  });
125
+
113
126
  const onInternalSearch = (searchText, info) => {
114
127
  setSearchValue(searchText);
128
+
115
129
  if (info.source !== 'blur' && onSearch) {
116
130
  onSearch(searchText);
117
131
  }
118
132
  };
133
+
119
134
  const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch);
120
- const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect);
121
- // =========================== Values ===========================
122
- const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
123
- // Fill `rawValues` with checked conduction values
135
+ const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect); // =========================== Values ===========================
136
+
137
+ const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames); // Fill `rawValues` with checked conduction values
138
+
124
139
  const [checkedValues, halfCheckedValues, missingCheckedValues] = React.useMemo(() => {
125
140
  const [existValues, missingValues] = getMissingValues(rawValues);
141
+
126
142
  if (!multiple || !rawValues.length) {
127
143
  return [existValues, [], missingValues];
128
144
  }
145
+
129
146
  const keyPathValues = toPathKeys(existValues);
130
147
  const keyPathEntities = getPathKeyEntities();
131
148
  const {
132
149
  checkedKeys,
133
150
  halfCheckedKeys
134
- } = conductCheck(keyPathValues, true, keyPathEntities);
135
- // Convert key back to value cells
151
+ } = conductCheck(keyPathValues, true, keyPathEntities); // Convert key back to value cells
152
+
136
153
  return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
137
154
  }, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
138
155
  const deDuplicatedValues = React.useMemo(() => {
@@ -140,11 +157,11 @@ const Cascader = React.forwardRef((props, ref) => {
140
157
  const deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
141
158
  return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];
142
159
  }, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
143
- const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
144
- // =========================== Change ===========================
160
+ const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender); // =========================== Change ===========================
161
+
145
162
  const triggerChange = useRefFunc(nextValues => {
146
- setRawValues(nextValues);
147
- // Save perf if no need trigger event
163
+ setRawValues(nextValues); // Save perf if no need trigger event
164
+
148
165
  if (onChange) {
149
166
  const nextRawValues = toRawValues(nextValues);
150
167
  const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
@@ -152,10 +169,11 @@ const Cascader = React.forwardRef((props, ref) => {
152
169
  const triggerOptions = multiple ? valueOptions : valueOptions[0];
153
170
  onChange(triggerValues, triggerOptions);
154
171
  }
155
- });
156
- // =========================== Select ===========================
172
+ }); // =========================== Select ===========================
173
+
157
174
  const onInternalSelect = useRefFunc(valuePath => {
158
175
  setSearchValue('');
176
+
159
177
  if (!multiple) {
160
178
  triggerChange(valuePath);
161
179
  } else {
@@ -164,19 +182,21 @@ const Cascader = React.forwardRef((props, ref) => {
164
182
  const checkedPathKeys = toPathKeys(checkedValues);
165
183
  const halfCheckedPathKeys = toPathKeys(halfCheckedValues);
166
184
  const existInChecked = checkedPathKeys.includes(pathKey);
167
- const existInMissing = missingCheckedValues.some(valueCells => toPathKey(valueCells) === pathKey);
168
- // Do update
185
+ const existInMissing = missingCheckedValues.some(valueCells => toPathKey(valueCells) === pathKey); // Do update
186
+
169
187
  let nextCheckedValues = checkedValues;
170
188
  let nextMissingValues = missingCheckedValues;
189
+
171
190
  if (existInMissing && !existInChecked) {
172
191
  // Missing value only do filter
173
192
  nextMissingValues = missingCheckedValues.filter(valueCells => toPathKey(valueCells) !== pathKey);
174
193
  } else {
175
194
  // Update checked key first
176
195
  const nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter(key => key !== pathKey) : [...checkedPathKeys, pathKey];
177
- const pathKeyEntities = getPathKeyEntities();
178
- // Conduction by selected or not
196
+ const pathKeyEntities = getPathKeyEntities(); // Conduction by selected or not
197
+
179
198
  let checkedKeys;
199
+
180
200
  if (existInChecked) {
181
201
  ;
182
202
  ({
@@ -190,41 +210,48 @@ const Cascader = React.forwardRef((props, ref) => {
190
210
  ({
191
211
  checkedKeys
192
212
  } = conductCheck(nextRawCheckedKeys, true, pathKeyEntities));
193
- }
194
- // Roll up to parent level keys
213
+ } // Roll up to parent level keys
214
+
215
+
195
216
  const deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
196
217
  nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
197
218
  }
219
+
198
220
  triggerChange([...nextMissingValues, ...nextCheckedValues]);
199
221
  }
200
- });
201
- // Display Value change logic
222
+ }); // Display Value change logic
223
+
202
224
  const onDisplayValuesChange = (_, info) => {
203
225
  if (info.type === 'clear') {
204
226
  triggerChange([]);
205
227
  return;
206
- }
207
- // Cascader do not support `add` type. Only support `remove`
228
+ } // Cascader do not support `add` type. Only support `remove`
229
+
230
+
208
231
  const {
209
232
  valueCells
210
233
  } = info.values[0];
211
234
  onInternalSelect(valueCells);
212
- };
213
- // ============================ Open ============================
235
+ }; // ============================ Open ============================
236
+
237
+
214
238
  const mergedOpen = open !== undefined ? open : popupVisible;
215
239
  const mergedDropdownClassName = dropdownClassName || popupClassName;
216
240
  const mergedPlacement = placement || popupPlacement;
241
+
217
242
  const onInternalDropdownVisibleChange = nextVisible => {
218
243
  onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
219
244
  onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
220
245
  setDropdownVisible(nextVisible);
221
- };
222
- // ========================== Warning ===========================
246
+ }; // ========================== Warning ===========================
247
+
248
+
223
249
  if (process.env.NODE_ENV !== 'production') {
224
250
  warningProps(props);
225
251
  warningNullOptions(mergedOptions, mergedFieldNames);
226
- }
227
- // ========================== Context ===========================
252
+ } // ========================== Context ===========================
253
+
254
+
228
255
  const cascaderContext = React.useMemo(() => ({
229
256
  options: mergedOptions,
230
257
  fieldNames: mergedFieldNames,
@@ -242,15 +269,13 @@ const Cascader = React.forwardRef((props, ref) => {
242
269
  dropdownMenuColumnStyle,
243
270
  renderItem,
244
271
  dropdownVisible
245
- }), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, renderItem, dropdownVisible]);
246
- // ==============================================================
272
+ }), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, renderItem, dropdownVisible]); // ==============================================================
247
273
  // == Render ==
248
274
  // ==============================================================
275
+
249
276
  const emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;
250
- const dropdownStyle =
251
- // Search to match width
252
- mergedSearchValue && searchConfig.matchInputWidth ||
253
- // Empty keep the width
277
+ const dropdownStyle = // Search to match width
278
+ mergedSearchValue && searchConfig.matchInputWidth || // Empty keep the width
254
279
  emptyOptions ? {} : {
255
280
  minWidth: 'auto'
256
281
  };
@@ -283,9 +308,11 @@ const Cascader = React.forwardRef((props, ref) => {
283
308
  getRawInputElement: () => children
284
309
  })));
285
310
  });
311
+
286
312
  if (process.env.NODE_ENV !== 'production') {
287
313
  Cascader.displayName = 'Cascader';
288
314
  }
315
+
289
316
  Cascader.SHOW_PARENT = SHOW_PARENT;
290
317
  Cascader.SHOW_CHILD = SHOW_CHILD;
291
318
  export default Cascader;
@@ -39,42 +39,47 @@ export default function Column({
39
39
  } = React.useContext(CascaderContext);
40
40
  const hoverOpen = expandTrigger === 'hover';
41
41
  /** 单选情况下滚动到相应的位置 */
42
+
42
43
  React.useEffect(() => {
43
44
  let timer = null;
45
+
44
46
  if (ref.current && ref.current.scrollTo && !multiple && dropdownVisible) {
45
47
  const index = options.findIndex(it => it[fieldNames.value] === activeValue);
48
+
46
49
  if (index > 0 && !isNaN(index)) {
47
50
  timer = window.setTimeout(() => {
48
51
  ref.current.scrollTo((optionHeight || 36) * index);
49
52
  }, 5);
50
53
  }
51
54
  }
55
+
52
56
  return () => {
53
57
  if (timer) {
54
58
  window.clearTimeout(timer);
55
59
  }
60
+
56
61
  timer = null;
57
62
  };
58
- }, [multiple, activeValue, options, fieldNames, dropdownVisible, optionHeight]);
59
- // ============================ Option ============================
63
+ }, [multiple, activeValue, options, fieldNames, dropdownVisible, optionHeight]); // ============================ Option ============================
64
+
60
65
  const optionInfoList = React.useMemo(() => options.map(option => {
61
66
  var _a;
67
+
62
68
  const {
63
69
  disabled
64
70
  } = option;
65
71
  const searchOptions = option[SEARCH_MARK];
66
72
  const label = (_a = option[FIX_LABEL]) !== null && _a !== void 0 ? _a : option[fieldNames.label];
67
73
  const value = option[fieldNames.value];
68
- const isMergedLeaf = isLeaf(option, fieldNames);
69
- // Get real value of option. Search option is different way.
70
- const fullPath = searchOptions ?
71
- // @ts-ignore
74
+ const isMergedLeaf = isLeaf(option, fieldNames); // Get real value of option. Search option is different way.
75
+
76
+ const fullPath = searchOptions ? // @ts-ignore
72
77
  searchOptions.map(opt => opt[fieldNames.value]) : [...prevValuePath, value];
73
78
  const fullPathKey = toPathKey(fullPath);
74
- const isLoading = loadingKeys.includes(fullPathKey);
75
- // >>>>> checked
76
- const checked = checkedSet.has(fullPathKey);
77
- // >>>>> halfChecked
79
+ const isLoading = loadingKeys.includes(fullPathKey); // >>>>> checked
80
+
81
+ const checked = checkedSet.has(fullPathKey); // >>>>> halfChecked
82
+
78
83
  const halfChecked = halfCheckedSet.has(fullPathKey);
79
84
  return {
80
85
  disabled,
@@ -88,8 +93,8 @@ export default function Column({
88
93
  fullPath,
89
94
  fullPathKey
90
95
  };
91
- }), [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);
92
- // ============================ Render ============================
96
+ }), [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]); // ============================ Render ============================
97
+
93
98
  return React.createElement("ul", {
94
99
  className: menuPrefixCls,
95
100
  role: "menu"
@@ -117,20 +122,24 @@ export default function Column({
117
122
  if (!disabled && (!hoverOpen || !isMergedLeaf)) {
118
123
  onActive(fullPath);
119
124
  }
120
- };
121
- // >>>>> Selection
125
+ }; // >>>>> Selection
126
+
127
+
122
128
  const triggerSelect = () => {
123
129
  if (isSelectable(option)) {
124
130
  onSelect(fullPath, isMergedLeaf);
125
131
  }
126
- };
127
- // >>>>> Title
132
+ }; // >>>>> Title
133
+
134
+
128
135
  let title;
136
+
129
137
  if (typeof option.title === 'string') {
130
138
  title = option.title;
131
139
  } else if (typeof label === 'string') {
132
140
  title = label;
133
141
  }
142
+
134
143
  return React.createElement("li", {
135
144
  key: fullPathKey,
136
145
  className: classNames(menuItemPrefixCls, {
@@ -147,6 +156,7 @@ export default function Column({
147
156
  "data-path-key": fullPathKey,
148
157
  onClick: () => {
149
158
  triggerOpenPath();
159
+
150
160
  if (!multiple || isMergedLeaf) {
151
161
  triggerSelect();
152
162
  }
@@ -11,6 +11,7 @@ import useActive from './useActive';
11
11
  import useKeyboard from './useKeyboard';
12
12
  const RefOptionList = React.forwardRef((props, ref) => {
13
13
  var _a, _b;
14
+
14
15
  const {
15
16
  prefixCls,
16
17
  multiple,
@@ -36,26 +37,30 @@ const RefOptionList = React.forwardRef((props, ref) => {
36
37
  renderItem,
37
38
  dropdownVisible
38
39
  } = React.useContext(CascaderContext);
39
- const mergedPrefixCls = dropdownPrefixCls || prefixCls;
40
- // ========================= loadData =========================
40
+ const mergedPrefixCls = dropdownPrefixCls || prefixCls; // ========================= loadData =========================
41
+
41
42
  const [loadingKeys, setLoadingKeys] = React.useState([]);
43
+
42
44
  const internalLoadData = valueCells => {
43
45
  // Do not load when search
44
46
  if (!loadData || searchValue) {
45
47
  return;
46
48
  }
49
+
47
50
  const optionList = toPathOptions(valueCells, options, fieldNames);
48
51
  const rawOptions = optionList.map(({
49
52
  option
50
53
  }) => option);
51
54
  const lastOption = rawOptions[rawOptions.length - 1];
55
+
52
56
  if (lastOption && !isLeaf(lastOption, fieldNames)) {
53
57
  const pathKey = toPathKey(valueCells);
54
58
  setLoadingKeys(keys => [...keys, pathKey]);
55
59
  loadData(rawOptions);
56
60
  }
57
- };
58
- // zombieJ: This is bad. We should make this same as `rc-tree` to use Promise instead.
61
+ }; // zombieJ: This is bad. We should make this same as `rc-tree` to use Promise instead.
62
+
63
+
59
64
  React.useEffect(() => {
60
65
  if (loadingKeys.length) {
61
66
  loadingKeys.forEach(loadingKey => {
@@ -64,23 +69,25 @@ const RefOptionList = React.forwardRef((props, ref) => {
64
69
  option
65
70
  }) => option);
66
71
  const lastOption = optionList[optionList.length - 1];
72
+
67
73
  if (!lastOption || lastOption[fieldNames.children] || isLeaf(lastOption, fieldNames)) {
68
74
  setLoadingKeys(keys => keys.filter(key => key !== loadingKey));
69
75
  }
70
76
  });
71
77
  }
72
- }, [options, loadingKeys, fieldNames]);
73
- // ========================== Values ==========================
78
+ }, [options, loadingKeys, fieldNames]); // ========================== Values ==========================
79
+
74
80
  const checkedSet = React.useMemo(() => new Set(toPathKeys(values)), [values]);
75
- const halfCheckedSet = React.useMemo(() => new Set(toPathKeys(halfValues)), [halfValues]);
76
- // ====================== Accessibility =======================
77
- const [activeValueCells, setActiveValueCells] = useActive();
78
- // =========================== Path ===========================
81
+ const halfCheckedSet = React.useMemo(() => new Set(toPathKeys(halfValues)), [halfValues]); // ====================== Accessibility =======================
82
+
83
+ const [activeValueCells, setActiveValueCells] = useActive(); // =========================== Path ===========================
84
+
79
85
  const onPathOpen = nextValueCells => {
80
- setActiveValueCells(nextValueCells);
81
- // Trigger loadData
86
+ setActiveValueCells(nextValueCells); // Trigger loadData
87
+
82
88
  internalLoadData(nextValueCells);
83
89
  };
90
+
84
91
  const isSelectable = option => {
85
92
  const {
86
93
  disabled
@@ -88,49 +95,59 @@ const RefOptionList = React.forwardRef((props, ref) => {
88
95
  const isMergedLeaf = isLeaf(option, fieldNames);
89
96
  return !disabled && (isMergedLeaf || changeOnSelect || multiple);
90
97
  };
98
+
91
99
  const onPathSelect = (valuePath, leaf, fromKeyboard = false) => {
92
100
  onSelect(valuePath);
101
+
93
102
  if (!multiple && (leaf || changeOnSelect && (expandTrigger === 'hover' || fromKeyboard))) {
94
103
  toggleOpen(false);
95
104
  }
96
- };
97
- // ========================== Option ==========================
105
+ }; // ========================== Option ==========================
106
+
107
+
98
108
  const mergedOptions = React.useMemo(() => {
99
109
  if (searchValue) {
100
110
  return searchOptions;
101
111
  }
112
+
102
113
  return options;
103
- }, [searchValue, searchOptions, options]);
104
- // ========================== Column ==========================
114
+ }, [searchValue, searchOptions, options]); // ========================== Column ==========================
115
+
105
116
  const optionColumns = React.useMemo(() => {
106
117
  const optionList = [{
107
118
  options: mergedOptions
108
119
  }];
109
120
  let currentList = mergedOptions;
121
+
110
122
  for (let i = 0; i < activeValueCells.length; i += 1) {
111
123
  const activeValueCell = activeValueCells[i];
112
124
  const currentOption = currentList.find(option => option[fieldNames.value] === activeValueCell);
113
125
  const subOptions = currentOption === null || currentOption === void 0 ? void 0 : currentOption[fieldNames.children];
126
+
114
127
  if (!(subOptions === null || subOptions === void 0 ? void 0 : subOptions.length)) {
115
128
  break;
116
129
  }
130
+
117
131
  currentList = subOptions;
118
132
  optionList.push({
119
133
  options: subOptions
120
134
  });
121
135
  }
136
+
122
137
  return optionList;
123
- }, [mergedOptions, activeValueCells, fieldNames]);
124
- // ========================= Keyboard =========================
138
+ }, [mergedOptions, activeValueCells, fieldNames]); // ========================= Keyboard =========================
139
+
125
140
  const onKeyboardSelect = (selectValueCells, option) => {
126
141
  if (isSelectable(option)) {
127
142
  onPathSelect(selectValueCells, isLeaf(option, fieldNames), true);
128
143
  }
129
144
  };
130
- useKeyboard(ref, mergedOptions, fieldNames, activeValueCells, onPathOpen, onKeyboardSelect);
131
- // >>>>> Active Scroll
145
+
146
+ useKeyboard(ref, mergedOptions, fieldNames, activeValueCells, onPathOpen, onKeyboardSelect); // >>>>> Active Scroll
147
+
132
148
  React.useEffect(() => {
133
149
  var _a;
150
+
134
151
  for (let i = 0; i < activeValueCells.length; i += 1) {
135
152
  const cellPath = activeValueCells.slice(0, i + 1);
136
153
  const cellKeyPath = toPathKey(cellPath);
@@ -141,9 +158,9 @@ const RefOptionList = React.forwardRef((props, ref) => {
141
158
  scrollIntoParentView(ele);
142
159
  }
143
160
  }
144
- }, [activeValueCells]);
145
- // ========================== Render ==========================
161
+ }, [activeValueCells]); // ========================== Render ==========================
146
162
  // >>>>> Empty
163
+
147
164
  const isEmpty = !((_b = (_a = optionColumns[0]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.length);
148
165
  const emptyList = [{
149
166
  [fieldNames.value]: '__EMPTY__',
@@ -159,8 +176,8 @@ const RefOptionList = React.forwardRef((props, ref) => {
159
176
  halfCheckedSet,
160
177
  loadingKeys,
161
178
  isSelectable
162
- });
163
- // >>>>> Columns
179
+ }); // >>>>> Columns
180
+
164
181
  const mergedOptionColumns = isEmpty ? [{
165
182
  options: emptyList
166
183
  }] : optionColumns;
@@ -180,8 +197,8 @@ const RefOptionList = React.forwardRef((props, ref) => {
180
197
  activeValue: activeValue,
181
198
  renderItem: renderItem
182
199
  }));
183
- });
184
- // >>>>> Render
200
+ }); // >>>>> Render
201
+
185
202
  return React.createElement("div", {
186
203
  className: classNames(`${mergedPrefixCls}-menus`, {
187
204
  [`${mergedPrefixCls}-menu-empty`]: isEmpty,
@@ -5,6 +5,7 @@ import { useBaseProps } from 'rc-select';
5
5
  /**
6
6
  * Control the active open options path.
7
7
  */
8
+
8
9
  export default (() => {
9
10
  const {
10
11
  multiple,
@@ -12,18 +13,19 @@ export default (() => {
12
13
  } = useBaseProps();
13
14
  const {
14
15
  values
15
- } = React.useContext(CascaderContext);
16
- // Record current dropdown active options
16
+ } = React.useContext(CascaderContext); // Record current dropdown active options
17
17
  // This also control the open status
18
+
18
19
  const [activeValueCells, setActiveValueCells] = React.useState([]);
19
20
  React.useEffect(() => {
20
21
  if (open && !multiple) {
21
22
  const firstValueCells = values[0];
22
23
  setActiveValueCells(firstValueCells || []);
23
24
  }
24
- }, /* eslint-disable react-hooks/exhaustive-deps */
25
+ },
26
+ /* eslint-disable react-hooks/exhaustive-deps */
25
27
  [open]
26
- /* eslint-enable react-hooks/exhaustive-deps */);
27
-
28
+ /* eslint-enable react-hooks/exhaustive-deps */
29
+ );
28
30
  return [activeValueCells, setActiveValueCells];
29
31
  });