tntd 2.0.14 → 2.0.15

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