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
@@ -4,39 +4,55 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
+
7
8
  var _react = _interopRequireWildcard(require("react"));
9
+
8
10
  var _select = _interopRequireDefault(require("../select"));
11
+
9
12
  var _empty = _interopRequireDefault(require("../empty"));
13
+
10
14
  var _DropDownWrap = _interopRequireDefault(require("./DropDownWrap"));
15
+
11
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
17
+
18
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
19
+
20
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23
+
15
24
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
17
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
23
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
25
+
26
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
+
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
+
30
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
31
+
32
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33
+
24
34
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
26
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
+
36
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
+
38
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
+
27
40
  var __rest = void 0 && (void 0).__rest || function (s, e) {
28
41
  var t = {};
42
+
29
43
  for (var p in s) {
30
44
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
31
45
  }
46
+
32
47
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
48
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
34
49
  }
35
50
  return t;
36
51
  };
52
+
37
53
  // 页面实际渲染的下拉菜单数量,实际为 2 * ITEM_ELEMENT_NUMBER
38
- var ITEM_ELEMENT_NUMBER = 30;
39
- // Select size 配置
54
+ var ITEM_ELEMENT_NUMBER = 30; // Select size 配置
55
+
40
56
  var ITEM_HEIGHT_CFG = {
41
57
  small: 24,
42
58
  large: 40,
@@ -48,13 +64,18 @@ var ARROW_CODE = {
48
64
  };
49
65
  var DROPDOWN_HEIGHT = 224;
50
66
  var Option = _select["default"].Option;
51
- var SuperSelect = /*#__PURE__*/function (_PureComponent) {
67
+
68
+ var SuperSelect =
69
+ /*#__PURE__*/
70
+ function (_PureComponent) {
52
71
  _inherits(SuperSelect, _PureComponent);
53
- var _super = _createSuper(SuperSelect);
72
+
54
73
  function SuperSelect(props) {
55
74
  var _this;
75
+
56
76
  _classCallCheck(this, SuperSelect);
57
- _this = _super.call(this, props);
77
+
78
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(SuperSelect).call(this, props));
58
79
  Object.defineProperty(_assertThisInitialized(_this), "turnChildren", {
59
80
  enumerable: true,
60
81
  configurable: true,
@@ -62,6 +83,7 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
62
83
  value: function value(children) {
63
84
  if (!children) return [];
64
85
  var arr = [];
86
+
65
87
  if (children && children.props) {
66
88
  arr.push(children);
67
89
  } else {
@@ -75,6 +97,7 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
75
97
  }
76
98
  });
77
99
  }
100
+
78
101
  return arr;
79
102
  }
80
103
  });
@@ -85,35 +108,42 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
85
108
  value: function value() {
86
109
  // 获取dom设置宽度
87
110
  var _this$props = _this.props,
88
- arr2 = _this$props.children,
89
- _this$props$dropdownM = _this$props.dropdownMatchSelectWidth,
90
- dropdownMatchSelectWidth = _this$props$dropdownM === void 0 ? true : _this$props$dropdownM,
91
- maxWidth = _this$props.maxWidth;
111
+ arr2 = _this$props.children,
112
+ _this$props$dropdownM = _this$props.dropdownMatchSelectWidth,
113
+ dropdownMatchSelectWidth = _this$props$dropdownM === void 0 ? true : _this$props$dropdownM,
114
+ maxWidth = _this$props.maxWidth;
92
115
  var selectDom = document.getElementById(_this.id);
93
116
  var selectWidth = selectDom.clientWidth || selectDom.offsetWidth;
94
117
  var arr = [];
95
118
  var formulaMaxWidth = 10;
119
+
96
120
  if (!dropdownMatchSelectWidth) {
97
121
  formulaMaxWidth = maxWidth || 10;
98
122
  }
123
+
99
124
  if (!dropdownMatchSelectWidth && !maxWidth) {
100
125
  var _children = _this.turnChildren(arr2);
126
+
101
127
  for (var i = 0; i < _children.length; i++) {
102
128
  var val = _children[i].props.children;
129
+
103
130
  var textWidth = _this.getTextPixelWith(val);
131
+
104
132
  arr.push(textWidth.toFixed(2));
105
133
  }
134
+
106
135
  if (arr.length > 0) {
107
136
  formulaMaxWidth = Math.max.apply(Math, arr);
108
137
  }
109
138
  }
139
+
110
140
  _this.setState({
111
141
  selectWidth: selectWidth,
112
142
  maxWidth: formulaMaxWidth
113
143
  });
114
144
  }
115
- });
116
- // 获取单行文本的像素宽度
145
+ }); // 获取单行文本的像素宽度
146
+
117
147
  Object.defineProperty(_assertThisInitialized(_this), "getTextPixelWith", {
118
148
  enumerable: true,
119
149
  configurable: true,
@@ -121,9 +151,13 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
121
151
  value: function value(text) {
122
152
  var fontStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '14px';
123
153
  var canvas = document.createElement('canvas'); // 创建 canvas 画布
154
+
124
155
  var context = canvas.getContext('2d'); // 获取 canvas 绘图上下文环境
156
+
125
157
  context.font = fontStyle; // 设置字体样式,使用前设置好对应的 font 样式才能准确获取文字的像素长度
158
+
126
159
  var dimension = context.measureText(text); // 测量文字
160
+
127
161
  return dimension.width;
128
162
  }
129
163
  });
@@ -145,48 +179,58 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
145
179
  configurable: true,
146
180
  writable: true,
147
181
  value: function value() {
148
- _this.scrollEle = document.querySelector(".".concat(_this.dropdownClassName));
149
- // 下拉菜单未展开时元素不存在
182
+ _this.scrollEle = document.querySelector(".".concat(_this.dropdownClassName)); // 下拉菜单未展开时元素不存在
183
+
150
184
  if (!_this.scrollEle) return;
185
+
151
186
  _this.scrollEle.addEventListener('scroll', _this.onScroll, false);
187
+
152
188
  _this.inputEle = document.querySelector("#".concat(_this.id));
153
189
  if (!_this.inputEle) return;
190
+
154
191
  _this.inputEle.addEventListener('keydown', _this.onKeyDown, false);
155
192
  }
156
- });
157
- // 模拟 antd select 按下 上下箭头 键时滚动列表
193
+ }); // 模拟 antd select 按下 上下箭头 键时滚动列表
194
+
158
195
  Object.defineProperty(_assertThisInitialized(_this), "onKeyDown", {
159
196
  enumerable: true,
160
197
  configurable: true,
161
198
  writable: true,
162
199
  value: function value(e) {
163
200
  var _ref = e || {},
164
- keyCode = _ref.keyCode;
201
+ keyCode = _ref.keyCode;
202
+
165
203
  setTimeout(function () {
166
204
  var activeItem = document.querySelector(".".concat(_this.dropdownClassName, " .ant-select-dropdown-menu-item-active"));
167
205
  if (!activeItem) return;
168
206
  var offsetTop = activeItem.offsetTop;
169
207
  var isUp = ARROW_CODE[keyCode] === 'up';
170
- var isDown = ARROW_CODE[keyCode] === 'down';
171
- // 在所有列表第一行按上键
208
+ var isDown = ARROW_CODE[keyCode] === 'down'; // 在所有列表第一行按上键
209
+
172
210
  if (offsetTop - _this.prevTop > DROPDOWN_HEIGHT && isUp) {
173
211
  _this.scrollEle.scrollTo(0, _this.allHeight - DROPDOWN_HEIGHT);
212
+
174
213
  _this.prevTop = _this.allHeight;
175
214
  return;
176
- }
177
- // 在所有列表中最后一行按下键
215
+ } // 在所有列表中最后一行按下键
216
+
217
+
178
218
  if (_this.prevTop > offsetTop + DROPDOWN_HEIGHT && isDown) {
179
219
  _this.scrollEle.scrollTo(0, 0);
220
+
180
221
  _this.prevTop = 0;
181
222
  return;
182
223
  }
183
- _this.prevTop = offsetTop;
184
- // 向下滚动到下拉框最后一行时,向下滚动一行的高度
224
+
225
+ _this.prevTop = offsetTop; // 向下滚动到下拉框最后一行时,向下滚动一行的高度
226
+
185
227
  if (offsetTop > _this.scrollEle.scrollTop + DROPDOWN_HEIGHT - _this.ITEM_HEIGHT + 10 && isDown) {
186
228
  _this.scrollEle.scrollTo(0, _this.scrollTop + _this.ITEM_HEIGHT);
229
+
187
230
  return;
188
- }
189
- // 向上滚动到下拉框第一一行时,向上滚动一行的高度
231
+ } // 向上滚动到下拉框第一一行时,向上滚动一行的高度
232
+
233
+
190
234
  if (offsetTop < _this.scrollEle.scrollTop && isUp) {
191
235
  _this.scrollEle.scrollTo(0, _this.scrollTop - _this.ITEM_HEIGHT);
192
236
  }
@@ -207,12 +251,15 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
207
251
  writable: true,
208
252
  value: function value() {
209
253
  _this.allList = _this.getUseChildrenList();
254
+
210
255
  var _this$getStartAndEndI = _this.getStartAndEndIndex(),
211
- startIndex = _this$getStartAndEndI.startIndex,
212
- endIndex = _this$getStartAndEndI.endIndex;
213
- _this.prevScrollTop = _this.scrollTop;
214
- // 重新渲染列表组件 Wrap
256
+ startIndex = _this$getStartAndEndI.startIndex,
257
+ endIndex = _this$getStartAndEndI.endIndex;
258
+
259
+ _this.prevScrollTop = _this.scrollTop; // 重新渲染列表组件 Wrap
260
+
215
261
  var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
262
+
216
263
  _this.wrap.reactList(allHeight, startIndex, endIndex);
217
264
  }
218
265
  });
@@ -221,14 +268,14 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
221
268
  configurable: true,
222
269
  writable: true,
223
270
  value: function value() {
224
- _this.scrollTop = _this.scrollEle.scrollTop;
225
- // 滚动的高度
271
+ _this.scrollTop = _this.scrollEle.scrollTop; // 滚动的高度
272
+
226
273
  var delta = _this.prevScrollTop - _this.scrollTop;
227
274
  delta = delta < 0 ? 0 - delta : delta;
228
275
  delta > _this.reactDelta && _this.onScrollReal();
229
276
  }
230
- });
231
- // 列表可展示所有 children
277
+ }); // 列表可展示所有 children
278
+
232
279
  Object.defineProperty(_assertThisInitialized(_this), "getUseChildrenList", {
233
280
  enumerable: true,
234
281
  configurable: true,
@@ -251,8 +298,8 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
251
298
  endIndex: endIndex
252
299
  };
253
300
  }
254
- });
255
- // 须使用 setTimeout 确保在 dom 加载完成之后添加事件
301
+ }); // 须使用 setTimeout 确保在 dom 加载完成之后添加事件
302
+
256
303
  Object.defineProperty(_assertThisInitialized(_this), "setSuperDrowDownMenu", {
257
304
  enumerable: true,
258
305
  configurable: true,
@@ -260,16 +307,18 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
260
307
  value: function value(visible) {
261
308
  if (!visible) return;
262
309
  _this.allList = _this.getUseChildrenList();
310
+
263
311
  if (!_this.eventTimer || !_this.scrollEle) {
264
312
  _this.eventTimer = setTimeout(function () {
265
313
  return _this.addEvent();
266
314
  }, 0);
267
315
  } else {
268
- var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
269
- // 下拉列表单独重新渲染
316
+ var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100; // 下拉列表单独重新渲染
317
+
270
318
  var _this$getStartAndEndI2 = _this.getStartAndEndIndex(),
271
- startIndex = _this$getStartAndEndI2.startIndex,
272
- endIndex = _this$getStartAndEndI2.endIndex;
319
+ startIndex = _this$getStartAndEndI2.startIndex,
320
+ endIndex = _this$getStartAndEndI2.endIndex;
321
+
273
322
  setTimeout(function () {
274
323
  _this.wrap && _this.wrap.reactList(allHeight, startIndex, endIndex);
275
324
  }, 0);
@@ -284,28 +333,30 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
284
333
  var onDropdownVisibleChange = _this.props.onDropdownVisibleChange;
285
334
  onDropdownVisibleChange && onDropdownVisibleChange(visible);
286
335
  var _this$state = _this.state,
287
- value = _this$state.value,
288
- children = _this$state.children;
289
- // 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
336
+ value = _this$state.value,
337
+ children = _this$state.children; // 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
338
+
290
339
  if (!visible) {
291
340
  // 定时器确保关闭后再设置 filterChildren,防止列表刷新闪烁
292
341
  setTimeout(function () {
293
342
  _this.setState({
294
343
  filterChildren: null
295
344
  });
345
+
296
346
  _this.setDefaultScrollTop(value);
297
- }, 100);
298
- // this.removeEvent();
347
+ }, 100); // this.removeEvent();
299
348
  } else {
300
349
  // this.addEvent();
301
350
  if (value) {
302
351
  // 如果已有 value, 设置默认滚动位置
303
- _this.setDefaultScrollTop();
304
- // 设置下拉列表显示数据
352
+ _this.setDefaultScrollTop(); // 设置下拉列表显示数据
353
+
354
+
305
355
  _this.setSuperDrowDownMenu(visible);
306
356
  } else if (!value && value !== 0 && children && children.length > 0) {
307
357
  // 无数据时,下拉回归至第一个
308
358
  var val = children[0].props.value;
359
+
309
360
  _this.setDefaultScrollTop(val);
310
361
  }
311
362
  }
@@ -319,19 +370,20 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
319
370
  var onDeselect = _this.props.onDeselect;
320
371
  onDeselect && onDeselect(_value);
321
372
  }
322
- });
323
- // 在搜索重新计算下拉滚动条高度
373
+ }); // 在搜索重新计算下拉滚动条高度
374
+
324
375
  Object.defineProperty(_assertThisInitialized(_this), "onChange", {
325
376
  enumerable: true,
326
377
  configurable: true,
327
378
  writable: true,
328
379
  value: function value(_value2, opt) {
329
380
  var _this$props2 = _this.props,
330
- showSearch = _this$props2.showSearch,
331
- onChange = _this$props2.onChange,
332
- autoClearSearchValue = _this$props2.autoClearSearchValue,
333
- maxCount = _this$props2.maxCount,
334
- mode = _this$props2.mode;
381
+ showSearch = _this$props2.showSearch,
382
+ onChange = _this$props2.onChange,
383
+ autoClearSearchValue = _this$props2.autoClearSearchValue,
384
+ maxCount = _this$props2.maxCount,
385
+ mode = _this$props2.mode;
386
+
335
387
  if (showSearch || _this.isMultiple) {
336
388
  // 搜索模式下选择后是否需要重置搜索状态
337
389
  if (autoClearSearchValue !== false) {
@@ -343,6 +395,7 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
343
395
  });
344
396
  }
345
397
  }
398
+
346
399
  if (mode === 'multiple') {
347
400
  if (_value2.length <= maxCount) {
348
401
  _this.setState({
@@ -354,7 +407,9 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
354
407
  value: _value2
355
408
  });
356
409
  }
410
+
357
411
  onChange && onChange(_value2, opt);
412
+
358
413
  if (mode !== 'multiple') {
359
414
  _this.select && _this.select.blur();
360
415
  }
@@ -366,14 +421,17 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
366
421
  writable: true,
367
422
  value: function value(v) {
368
423
  var _this$props3 = _this.props,
369
- showSearch = _this$props3.showSearch,
370
- onSearch = _this$props3.onSearch,
371
- filterOption = _this$props3.filterOption,
372
- arr = _this$props3.children;
424
+ showSearch = _this$props3.showSearch,
425
+ onSearch = _this$props3.onSearch,
426
+ filterOption = _this$props3.filterOption,
427
+ arr = _this$props3.children;
428
+
373
429
  var children = _this.turnChildren(arr);
430
+
374
431
  if (showSearch && filterOption !== false) {
375
432
  // 须根据 filterOption(如有该自定义函数)手动 filter 搜索匹配的列表
376
433
  var filterChildren = null;
434
+
377
435
  if (typeof filterOption === 'function') {
378
436
  filterChildren = children.filter(function (item) {
379
437
  return filterOption(v, item);
@@ -382,16 +440,17 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
382
440
  filterChildren = children.filter(function (item) {
383
441
  return _this.filterOption(v, item);
384
442
  });
385
- }
386
- // 搜索框有值,去除disabled=true的children
443
+ } // 搜索框有值,去除disabled=true的children
444
+
445
+
387
446
  var newFilterChild = [];
388
447
  filterChildren && filterChildren.forEach(function (item, index) {
389
448
  if (!item.props.disabled) {
390
449
  newFilterChild.push(item);
391
450
  }
392
451
  });
393
- filterChildren = newFilterChild;
394
- // 设置下拉列表显示数据
452
+ filterChildren = newFilterChild; // 设置下拉列表显示数据
453
+
395
454
  _this.setState({
396
455
  filterChildren: v === '' ? null : filterChildren
397
456
  }, function () {
@@ -399,13 +458,16 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
399
458
  // 搜索后需要重置滚动位置到0,防止上次 scrollTop 位置无数据
400
459
  if (filterChildren) {
401
460
  _this.scrollTop = 0;
461
+
402
462
  _this.scrollEle.scrollTo(0, 0);
403
- }
404
- // 搜索成功后需要重新设置列表的总高度
463
+ } // 搜索成功后需要重新设置列表的总高度
464
+
465
+
405
466
  _this.setSuperDrowDownMenu(true);
406
467
  }, 0);
407
468
  });
408
469
  }
470
+
409
471
  onSearch && onSearch(v);
410
472
  }
411
473
  });
@@ -426,11 +488,15 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
426
488
  value: function value(data) {
427
489
  var value = _this.state.value;
428
490
  var arr = _this.props.children;
491
+
429
492
  var children = _this.turnChildren(arr);
493
+
430
494
  var val = data || data === 0 ? data : value;
495
+
431
496
  for (var i = 0; i < children.length; i++) {
432
497
  var item = children[i];
433
498
  var itemValue = item.props.value;
499
+
434
500
  if (itemValue === val || Array.isArray(val) && val.includes(itemValue)) {
435
501
  var _ret = function () {
436
502
  var targetScrollTop = i * _this.ITEM_HEIGHT;
@@ -438,12 +504,14 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
438
504
  if (!_this.scrollEle) {
439
505
  _this.addEvent();
440
506
  }
507
+
441
508
  _this.scrollEle && _this.scrollEle.scrollTo(0, targetScrollTop);
442
509
  }, 100);
443
510
  return {
444
511
  v: void 0
445
512
  };
446
513
  }();
514
+
447
515
  if (_typeof(_ret) === "object") return _ret.v;
448
516
  }
449
517
  }
@@ -455,19 +523,24 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
455
523
  writable: true,
456
524
  value: function value() {
457
525
  if (!_this.scrollEle) return;
526
+
458
527
  _this.scrollEle.removeEventListener('scroll', _this.onScroll, false);
528
+
459
529
  if (!_this.inputEle) return;
530
+
460
531
  _this.inputEle.removeEventListener('keydown', _this.onKeyDown, false);
461
532
  }
462
533
  });
463
534
  var mode = props.mode,
464
- defaultValue = props.defaultValue,
465
- value = props.value,
466
- optionHeight = props.optionHeight,
467
- arr = props.children;
535
+ defaultValue = props.defaultValue,
536
+ value = props.value,
537
+ optionHeight = props.optionHeight,
538
+ arr = props.children;
468
539
  _this.isMultiple = ['tags', 'multiple'].includes(mode);
469
- var children = _this.turnChildren(arr);
470
- // 设置默认 value
540
+
541
+ var children = _this.turnChildren(arr); // 设置默认 value
542
+
543
+
471
544
  var defaultV = _this.isMultiple ? [] : '';
472
545
  defaultV = value || defaultValue || defaultV;
473
546
  _this.state = {
@@ -476,58 +549,62 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
476
549
  value: defaultV,
477
550
  maxWidth: null,
478
551
  selectWidth: null
479
- };
480
- // 下拉菜单项行高
481
- _this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
482
- // 可视区 dom 高度
483
- _this.visibleDomHeight = _this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
484
- // 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
485
- _this.reactDelta = _this.visibleDomHeight / 3;
486
- // 是否拖动滚动条快速滚动状态
487
- _this.isStopReact = false;
488
- // 上一次滚动的 scrollTop 值
489
- _this.prevScrollTop = 0;
490
- // 上一次按下方向键时 scrollTop 值
552
+ }; // 下拉菜单项行高
553
+
554
+ _this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default']; // 可视区 dom 高度
555
+
556
+ _this.visibleDomHeight = _this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER; // 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
557
+
558
+ _this.reactDelta = _this.visibleDomHeight / 3; // 是否拖动滚动条快速滚动状态
559
+
560
+ _this.isStopReact = false; // 上一次滚动的 scrollTop 值
561
+
562
+ _this.prevScrollTop = 0; // 上一次按下方向键时 scrollTop 值
563
+
491
564
  _this.prevTop = 0;
492
- _this.scrollTop = 0;
493
- // className
565
+ _this.scrollTop = 0; // className
566
+
494
567
  _this.dropdownClassName = "dc".concat(+new Date());
495
568
  _this.id = "sid".concat(+new Date());
496
569
  return _this;
497
570
  }
571
+
498
572
  _createClass(SuperSelect, [{
499
573
  key: "componentDidMount",
500
574
  value: function componentDidMount() {
501
575
  var _this2 = this;
576
+
502
577
  // defaultOpens=true 时添加滚动事件
503
578
  setTimeout(function () {
504
579
  _this2.addEvent();
505
580
  }, 500);
506
581
  var arr = this.props.children;
507
- var children = this.turnChildren(arr);
508
- // if (children && children.length > 0) {
509
- this.formulaWidth();
510
- // }
582
+ var children = this.turnChildren(arr); // if (children && children.length > 0) {
583
+
584
+ this.formulaWidth(); // }
511
585
  }
512
586
  }, {
513
587
  key: "componentDidUpdate",
514
588
  value: function componentDidUpdate(prevProps) {
515
589
  var _this$props4 = this.props,
516
- mode = _this$props4.mode,
517
- defaultValue = _this$props4.defaultValue,
518
- value = _this$props4.value,
519
- children = _this$props4.children;
590
+ mode = _this$props4.mode,
591
+ defaultValue = _this$props4.defaultValue,
592
+ value = _this$props4.value,
593
+ children = _this$props4.children;
520
594
  var arr = this.turnChildren(children);
595
+
521
596
  if (prevProps.children !== children) {
522
597
  this.isMultiple = ['tags', 'multiple'].includes(mode);
523
598
  this.setState({
524
599
  children: arr || [],
525
600
  filterChildren: null
526
601
  });
602
+
527
603
  if (arr && arr.length > 0) {
528
604
  this.formulaWidth();
529
605
  }
530
606
  }
607
+
531
608
  if (prevProps.value !== value) {
532
609
  // 更新时设置默认 value
533
610
  var defaultV = this.isMultiple ? [] : '';
@@ -546,23 +623,30 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
546
623
  key: "render",
547
624
  value: function render() {
548
625
  var _this3 = this;
626
+
549
627
  var _this$state2 = this.state,
550
- maxWidth = _this$state2.maxWidth,
551
- selectWidth = _this$state2.selectWidth;
628
+ maxWidth = _this$state2.maxWidth,
629
+ selectWidth = _this$state2.selectWidth;
630
+
552
631
  var _a = this.props,
553
- dropdownStyle = _a.dropdownStyle,
554
- optionLabelProp = _a.optionLabelProp,
555
- dropdownClassName = _a.dropdownClassName,
556
- props = __rest(_a, ["dropdownStyle", "optionLabelProp", "dropdownClassName"]);
632
+ dropdownStyle = _a.dropdownStyle,
633
+ optionLabelProp = _a.optionLabelProp,
634
+ dropdownClassName = _a.dropdownClassName,
635
+ props = __rest(_a, ["dropdownStyle", "optionLabelProp", "dropdownClassName"]);
636
+
557
637
  this.allList = this.getUseChildrenList();
558
638
  this.allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
639
+
559
640
  var _this$getStartAndEndI3 = this.getStartAndEndIndex(),
560
- startIndex = _this$getStartAndEndI3.startIndex,
561
- endIndex = _this$getStartAndEndI3.endIndex;
641
+ startIndex = _this$getStartAndEndI3.startIndex,
642
+ endIndex = _this$getStartAndEndI3.endIndex;
643
+
562
644
  var dynamicWidth = maxWidth;
645
+
563
646
  if (this.allList.length === 0 || maxWidth < selectWidth) {
564
647
  dynamicWidth = selectWidth;
565
648
  }
649
+
566
650
  dropdownStyle = Object.assign(Object.assign({
567
651
  maxHeight: "".concat(DROPDOWN_HEIGHT, "px")
568
652
  }, dropdownStyle), {
@@ -570,17 +654,19 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
570
654
  position: 'relative',
571
655
  maxWidth: dynamicWidth
572
656
  });
573
- var value = this.state.value;
574
- // 判断处于 antd Form 中时不自动设置 value
575
- var _props = Object.assign({}, props);
576
- // 先删除 value,再手动赋值,防止空 value 影响 placeholder
577
- delete _props.value;
578
- // value 为空字符会隐藏 placeholder,改为 undefined
657
+ var value = this.state.value; // 判断处于 antd Form 中时不自动设置 value
658
+
659
+ var _props = Object.assign({}, props); // 先删除 value,再手动赋值,防止空 value 影响 placeholder
660
+
661
+
662
+ delete _props.value; // value 为空字符会隐藏 placeholder,改为 undefined
663
+
579
664
  if (typeof value === 'string' && !value) {
580
665
  _props.value = undefined;
581
666
  } else {
582
667
  _props.value = value;
583
668
  }
669
+
584
670
  optionLabelProp = optionLabelProp || 'children';
585
671
  return _react["default"].createElement(_select["default"], Object.assign({}, _props, {
586
672
  id: this.id,
@@ -604,6 +690,7 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
604
690
  image: _empty["default"].PRESENTED_IMAGE_SIMPLE
605
691
  }));
606
692
  }
693
+
607
694
  return _react["default"].createElement(_DropDownWrap["default"], Object.assign({}, {
608
695
  startIndex: startIndex,
609
696
  endIndex: endIndex,
@@ -619,8 +706,10 @@ var SuperSelect = /*#__PURE__*/function (_PureComponent) {
619
706
  }), this.allList);
620
707
  }
621
708
  }]);
709
+
622
710
  return SuperSelect;
623
711
  }(_react.PureComponent);
712
+
624
713
  SuperSelect.Option = Option;
625
714
  var _default = SuperSelect;
626
715
  exports["default"] = _default;