tntd 2.6.18 → 2.6.19

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 (795) hide show
  1. package/es/actions/index.js +8 -22
  2. package/es/affix/index.js +2 -1
  3. package/es/alert/index.js +2 -1
  4. package/es/anchor/index.js +2 -1
  5. package/es/array-input/icon.js +6 -24
  6. package/es/array-input/index.js +119 -203
  7. package/es/auth-context/index.js +2 -1
  8. package/es/auto-complete/index.js +2 -1
  9. package/es/avatar/index.js +2 -1
  10. package/es/back-top/index.js +2 -1
  11. package/es/badge/index.js +2 -1
  12. package/es/breadcrumb/index.js +2 -1
  13. package/es/button/button.js +46 -0
  14. package/es/button/button.js.map +1 -0
  15. package/es/button/index.js +4 -3
  16. package/es/button/index.js.map +1 -1
  17. package/es/calendar/index.js +2 -1
  18. package/es/card/card.js +25 -0
  19. package/es/card/card.js.map +1 -0
  20. package/es/card/index.js +4 -3
  21. package/es/card/index.js.map +1 -1
  22. package/es/carousel/index.js +2 -1
  23. package/es/cascader/index.js +2 -1
  24. package/es/check-card/group.js +138 -186
  25. package/es/check-card/index.js +107 -150
  26. package/es/checkbox/checkbox-group.js +2 -1
  27. package/es/checkbox/index.js +2 -1
  28. package/es/col/index.js +2 -1
  29. package/es/collapse/index.js +2 -1
  30. package/es/color-picker/ColorPicker.js +80 -126
  31. package/es/color-picker/index.js +5 -8
  32. package/es/columns/index.js +30 -66
  33. package/es/columns/style/index.js +2 -1
  34. package/es/comment/index.js +2 -1
  35. package/es/config-provider/DisabledContext.js +5 -9
  36. package/es/config-provider/SizeContext.js +3 -7
  37. package/es/config-provider/config-provider.js +2 -1
  38. package/es/config-provider/index.js +2 -1
  39. package/es/connect/index.js +20 -23
  40. package/es/date-picker/index.js +6 -9
  41. package/es/descriptions/descriptions.js +30 -38
  42. package/es/descriptions/index.js +2 -1
  43. package/es/development-login/LoginModal.js +46 -81
  44. package/es/development-login/index.js +8 -17
  45. package/es/divider/index.js +2 -1
  46. package/es/drawer/drawer.js +20 -27
  47. package/es/drawer/index.js +2 -1
  48. package/es/dropdown/index.js +2 -1
  49. package/es/ellipsis/Svg/CopySVG.js +16 -63
  50. package/es/ellipsis/Svg/TickSVG.js +11 -41
  51. package/es/ellipsis/index.js +93 -125
  52. package/es/ellipsis/index.js.map +1 -1
  53. package/es/empty/empty.js +48 -58
  54. package/es/empty/empty.stories.js +6 -5
  55. package/es/empty/index.js +2 -1
  56. package/es/exception/exception.js +19 -32
  57. package/es/exception/index.js +2 -1
  58. package/es/form/form.js +68 -0
  59. package/es/form/form.js.map +1 -0
  60. package/es/form/index.js +4 -3
  61. package/es/form/index.js.map +1 -1
  62. package/es/handle/handle.js +102 -0
  63. package/es/handle/handle.js.map +1 -0
  64. package/es/handle/index.js +116 -120
  65. package/es/handle/index.js.map +1 -1
  66. package/es/icon/index.js +2 -1
  67. package/es/icon-list/index.js +120 -1
  68. package/es/img/Contain.js +39 -60
  69. package/es/img/Cover.js +72 -98
  70. package/es/img/index.js +32 -48
  71. package/es/index.js +3 -2
  72. package/es/index.js.map +1 -1
  73. package/es/input/index.js +2 -1
  74. package/es/input/input.js +47 -89
  75. package/es/input/input.js.map +1 -1
  76. package/es/input-number/index.js +2 -1
  77. package/es/label/index.js +98 -115
  78. package/es/layout/index.js +2 -1
  79. package/es/list/index.js +2 -1
  80. package/es/loading-button/index.js +28 -33
  81. package/es/locale/default.js +4 -3
  82. package/es/locale/en_US.js +32 -31
  83. package/es/locale/index.js +2 -1
  84. package/es/locale/zh_CN.js +32 -31
  85. package/es/locale-provider/index.js +3 -2
  86. package/es/mentions/index.js +2 -1
  87. package/es/menu/index.js +2 -1
  88. package/es/message/index.js +2 -1
  89. package/es/modal/index.js +2 -1
  90. package/es/modal/modal.js +20 -23
  91. package/es/modal/modal.js.map +1 -1
  92. package/es/notification/index.js +2 -1
  93. package/es/page/Box.js +33 -49
  94. package/es/page/index.js +84 -120
  95. package/es/page/utils.js +14 -12
  96. package/es/page-header/index.js +2 -1
  97. package/es/pagination/index.js +2 -1
  98. package/es/popconfirm/index.js +2 -1
  99. package/es/popover/index.js +2 -1
  100. package/es/prev-locale.js +47 -49
  101. package/es/preview-text/index.js +177 -247
  102. package/es/progress/index.js +2 -1
  103. package/es/query-form/Field/Checkbox.js +17 -20
  104. package/es/query-form/Field/Select.js +39 -54
  105. package/es/query-form/Field/SelectInput.js +45 -65
  106. package/es/query-form/Field/fieldsMap.js +20 -19
  107. package/es/query-form/Field/index.js +67 -108
  108. package/es/query-form/createActions.js +46 -46
  109. package/es/query-form/index.js +247 -327
  110. package/es/query-form/useForm.js +4 -3
  111. package/es/query-list-scene/List.js +255 -321
  112. package/es/query-list-scene/QueryForm.js +94 -132
  113. package/es/query-list-scene/QueryListScene.js +21 -29
  114. package/es/query-list-scene/Title.js +4 -6
  115. package/es/query-list-scene/Toolbar.js +15 -21
  116. package/es/query-list-scene/createActions.js +60 -60
  117. package/es/query-list-scene/index.js +2 -1
  118. package/es/query-list-scene/useActions.js +4 -3
  119. package/es/radio/index.js +2 -1
  120. package/es/radio/radio-group.js +2 -1
  121. package/es/rate/index.js +2 -1
  122. package/es/render-empty/index.js +2 -1
  123. package/es/render-empty/render-empty.js +16 -19
  124. package/es/result/index.js +2 -1
  125. package/es/row/index.js +2 -1
  126. package/es/segmented/index.js +38 -55
  127. package/es/select/index.js +2 -1
  128. package/es/select/select.js +28 -42
  129. package/es/select/select.js.map +1 -1
  130. package/es/skeleton/index.js +2 -1
  131. package/es/slider/index.js +2 -1
  132. package/es/spin/index.js +2 -1
  133. package/es/statistic/index.js +2 -1
  134. package/es/steps/index.js +2 -1
  135. package/es/steps/steps.js +35 -51
  136. package/es/steps/style/nav.less +1 -1
  137. package/es/svg-components/illustration-403.js +58 -206
  138. package/es/svg-components/illustration-404.js +75 -290
  139. package/es/svg-components/illustration-500.js +83 -321
  140. package/es/svg-components/illustration-empty.js +15 -54
  141. package/es/svg-components/illustration-failure.js +36 -112
  142. package/es/svg-components/illustration-no-access.js +35 -114
  143. package/es/svg-components/illustration-no-chart.js +37 -134
  144. package/es/svg-components/illustration-no-result.js +32 -92
  145. package/es/svg-components/illustration-offline.js +43 -131
  146. package/es/svg-components/illustration-success.js +43 -137
  147. package/es/svg-components/index.js +2 -1
  148. package/es/switch/index.js +2 -1
  149. package/es/switch/switch.js +3 -4
  150. package/es/switch/switch.js.map +1 -1
  151. package/es/table/assets/image-loading-background.js +17 -45
  152. package/es/table/assets/image-loading.js +5 -26
  153. package/es/table/constants.js +54 -2
  154. package/es/table/context.js +2 -1
  155. package/es/table/hooks/index.js +2 -1
  156. package/es/table/hooks/use-column-setting.js +16 -13
  157. package/es/table/index.js +2 -1
  158. package/es/table/table.js +172 -168
  159. package/es/table/table.js.map +1 -1
  160. package/es/table/table.stories.js +139 -148
  161. package/es/table/total-shower.js +4 -8
  162. package/es/table/utils.js +18 -17
  163. package/es/tabs/index.js +4 -3
  164. package/es/tabs/index.js.map +1 -1
  165. package/es/tabs/tabPane.js +2 -0
  166. package/es/tabs/tabPane.js.map +1 -0
  167. package/es/tabs/tabs.js +45 -0
  168. package/es/tabs/tabs.js.map +1 -0
  169. package/es/tag/index.js +2 -1
  170. package/es/time-picker/index.js +2 -1
  171. package/es/timeline/index.js +2 -1
  172. package/es/title/index.js +21 -32
  173. package/es/title/index.js.map +1 -1
  174. package/es/tntd-cascader/AntdCascader/component/DisabledContext.js +5 -9
  175. package/es/tntd-cascader/AntdCascader/component/FormItemInputContext.js +2 -1
  176. package/es/tntd-cascader/AntdCascader/component/SizeContext.js +2 -1
  177. package/es/tntd-cascader/AntdCascader/component/context.js +7 -5
  178. package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +10 -22
  179. package/es/tntd-cascader/AntdCascader/component/getIcons.js +50 -72
  180. package/es/tntd-cascader/AntdCascader/component/useCompactItemContext.js +20 -22
  181. package/es/tntd-cascader/AntdCascader/config/utils.js +18 -17
  182. package/es/tntd-cascader/AntdCascader/config/warning.js +10 -9
  183. package/es/tntd-cascader/AntdCascader/index.js +118 -189
  184. package/es/tntd-cascader/AntdCascader/index.less +1 -1
  185. package/es/tntd-cascader/AntdCascader/interface.js +2 -1
  186. package/es/tntd-cascader/index.js +2 -1
  187. package/es/tntd-cascader/rc-cascader/Cascader.js +239 -256
  188. package/es/tntd-cascader/rc-cascader/OptionList/Checkbox.js +11 -21
  189. package/es/tntd-cascader/rc-cascader/OptionList/Column.js +116 -175
  190. package/es/tntd-cascader/rc-cascader/OptionList/index.js +128 -180
  191. package/es/tntd-cascader/rc-cascader/OptionList/useActive.js +19 -22
  192. package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +137 -144
  193. package/es/tntd-cascader/rc-cascader/context.js +2 -1
  194. package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +37 -44
  195. package/es/tntd-cascader/rc-cascader/hooks/useEntities.js +24 -25
  196. package/es/tntd-cascader/rc-cascader/hooks/useMissingValues.js +17 -15
  197. package/es/tntd-cascader/rc-cascader/hooks/useRefFunc.js +8 -7
  198. package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +21 -20
  199. package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +41 -51
  200. package/es/tntd-cascader/rc-cascader/index.js +2 -1
  201. package/es/tntd-cascader/rc-cascader/utils/commonUtil.js +27 -33
  202. package/es/tntd-cascader/rc-cascader/utils/treeUtil.js +32 -29
  203. package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +23 -26
  204. package/es/tntd-form/ErrorList.js +41 -75
  205. package/es/tntd-form/Form.js +98 -107
  206. package/es/tntd-form/Form.js.map +1 -1
  207. package/es/tntd-form/FormItem/ItemHolder.js +117 -126
  208. package/es/tntd-form/FormItem/index.js +206 -232
  209. package/es/tntd-form/FormItemInput.js +31 -72
  210. package/es/tntd-form/FormItemLabel.js +62 -87
  211. package/es/tntd-form/FormList.js +27 -33
  212. package/es/tntd-form/_util/motion.js +27 -36
  213. package/es/tntd-form/_util/reactNode.js +9 -10
  214. package/es/tntd-form/_util/scrollTo.js +2 -2
  215. package/es/tntd-form/_util/type.js +2 -1
  216. package/es/tntd-form/_util/warning.js +4 -3
  217. package/es/tntd-form/_util/wave.js +2 -2
  218. package/es/tntd-form/context.js +24 -29
  219. package/es/tntd-form/hooks/useDebounce.js +12 -11
  220. package/es/tntd-form/hooks/useForm.js +28 -33
  221. package/es/tntd-form/hooks/useFormInstance.js +4 -5
  222. package/es/tntd-form/hooks/useFormItemStatus.js +5 -8
  223. package/es/tntd-form/hooks/useFrameState.js +33 -32
  224. package/es/tntd-form/hooks/useItemRef.js +14 -15
  225. package/es/tntd-form/index.js +2 -1
  226. package/es/tntd-form/interface.js +2 -1
  227. package/es/tntd-form/style/index.js +2 -1
  228. package/es/tntd-form/tntd-form.stories.js +383 -731
  229. package/es/tntd-form/tntd-form.stories.js.map +1 -1
  230. package/es/tntd-form/util.js +13 -10
  231. package/es/tntd-form/validateMessagesContext.js +2 -1
  232. package/es/tntd-icon/fonts/iconfont.js +53 -36
  233. package/es/tntd-icon/index.js +17 -23
  234. package/es/tntd-layout/ActionsContext.js +2 -1
  235. package/es/tntd-layout/AppList.js +77 -135
  236. package/es/tntd-layout/Application.js +29 -42
  237. package/es/tntd-layout/Avatar.js +42 -80
  238. package/es/tntd-layout/CompatibleLanguage.js +56 -93
  239. package/es/tntd-layout/EnterpriseLayout/Avatar.js +47 -93
  240. package/es/tntd-layout/EnterpriseLayout/Language.js +34 -56
  241. package/es/tntd-layout/EnterpriseLayout/Theme.js +24 -45
  242. package/es/tntd-layout/EnterpriseLayout/index.js +9 -17
  243. package/es/tntd-layout/GlobalNavigation/NavigationPopup.js +153 -212
  244. package/es/tntd-layout/GlobalNavigation/index.js +50 -84
  245. package/es/tntd-layout/Header.js +26 -59
  246. package/es/tntd-layout/HeaderActions.js +34 -84
  247. package/es/tntd-layout/HeaderNavs.js +35 -46
  248. package/es/tntd-layout/HeaderTabs.js +140 -176
  249. package/es/tntd-layout/Iconfont.js +2 -1
  250. package/es/tntd-layout/Language.js +33 -55
  251. package/es/tntd-layout/Layout.js +78 -176
  252. package/es/tntd-layout/Logo.js +40 -52
  253. package/es/tntd-layout/OrgAppList.js +139 -208
  254. package/es/tntd-layout/SideMenu.js +160 -230
  255. package/es/tntd-layout/Theme.js +29 -47
  256. package/es/tntd-layout/createActions.js +29 -28
  257. package/es/tntd-layout/images/index.js +32 -31
  258. package/es/tntd-layout/index.js +60 -92
  259. package/es/tntd-layout/paaslayout/CompactSideMenu.js +65 -109
  260. package/es/tntd-layout/paaslayout/Header.js +14 -37
  261. package/es/tntd-layout/paaslayout/Logo.js +3 -2
  262. package/es/tntd-layout/paaslayout/SideMenu.js +63 -109
  263. package/es/tntd-layout/paaslayout/index.js +79 -159
  264. package/es/tntd-layout/storage.js +11 -18
  265. package/es/tntd-modal/index.js +34 -90
  266. package/es/tntd-modal/index.js.map +1 -1
  267. package/es/tntd-modal/index.less +66 -82
  268. package/es/tntd-second-page/index.js +24 -47
  269. package/es/tntd-select/DropDownWrap.js +52 -73
  270. package/es/tntd-select/index.js +500 -586
  271. package/es/tntd-select/index.js.map +1 -1
  272. package/es/tooltip/index.js +2 -1
  273. package/es/transfer/index.js +2 -1
  274. package/es/tree/index.js +2 -1
  275. package/es/tree-select/index.js +2 -1
  276. package/es/typography/index.js +2 -1
  277. package/es/upload/index.js +3 -4
  278. package/es/utils/checkAuth.js +21 -24
  279. package/es/utils/findMenuInfoByPath.js +30 -33
  280. package/es/utils/index.js +73 -65
  281. package/es/utils/index.js.map +1 -1
  282. package/es/utils/lang.js +119 -0
  283. package/es/utils/lang.js.map +1 -0
  284. package/es/utils/simple-template.js +3 -2
  285. package/es/version/index.js +2 -1
  286. package/es/water-mark/index.js +87 -98
  287. package/lib/actions/index.js +14 -31
  288. package/lib/affix/index.d.ts +3 -3
  289. package/lib/affix/index.js +22 -23
  290. package/lib/affix/index.js.map +1 -1
  291. package/lib/alert/index.d.ts +3 -3
  292. package/lib/alert/index.js +22 -23
  293. package/lib/alert/index.js.map +1 -1
  294. package/lib/anchor/index.d.ts +3 -3
  295. package/lib/anchor/index.js +22 -23
  296. package/lib/anchor/index.js.map +1 -1
  297. package/lib/array-input/icon.js +12 -33
  298. package/lib/array-input/index.js +150 -254
  299. package/lib/auth-context/index.js +4 -10
  300. package/lib/auto-complete/index.d.ts +3 -3
  301. package/lib/auto-complete/index.js +22 -23
  302. package/lib/auto-complete/index.js.map +1 -1
  303. package/lib/avatar/index.d.ts +3 -3
  304. package/lib/avatar/index.js +22 -23
  305. package/lib/avatar/index.js.map +1 -1
  306. package/lib/back-top/index.d.ts +3 -3
  307. package/lib/back-top/index.js +22 -23
  308. package/lib/back-top/index.js.map +1 -1
  309. package/lib/badge/index.d.ts +3 -3
  310. package/lib/badge/index.js +22 -23
  311. package/lib/badge/index.js.map +1 -1
  312. package/lib/breadcrumb/index.d.ts +3 -3
  313. package/lib/breadcrumb/index.js +22 -23
  314. package/lib/breadcrumb/index.js.map +1 -1
  315. package/lib/button/button.d.ts +10 -0
  316. package/lib/button/button.d.ts.map +1 -0
  317. package/lib/button/button.js +78 -0
  318. package/lib/button/button.js.map +1 -0
  319. package/lib/button/index.d.ts +3 -3
  320. package/lib/button/index.d.ts.map +1 -1
  321. package/lib/button/index.js +19 -23
  322. package/lib/button/index.js.map +1 -1
  323. package/lib/calendar/index.d.ts +3 -3
  324. package/lib/calendar/index.js +22 -23
  325. package/lib/calendar/index.js.map +1 -1
  326. package/lib/card/card.d.ts +10 -0
  327. package/lib/card/card.d.ts.map +1 -0
  328. package/lib/card/card.js +57 -0
  329. package/lib/card/card.js.map +1 -0
  330. package/lib/card/index.d.ts +3 -3
  331. package/lib/card/index.d.ts.map +1 -1
  332. package/lib/card/index.js +19 -23
  333. package/lib/card/index.js.map +1 -1
  334. package/lib/carousel/index.d.ts +3 -3
  335. package/lib/carousel/index.js +22 -23
  336. package/lib/carousel/index.js.map +1 -1
  337. package/lib/cascader/index.d.ts +3 -3
  338. package/lib/cascader/index.js +26 -29
  339. package/lib/cascader/index.js.map +1 -1
  340. package/lib/check-card/group.js +171 -228
  341. package/lib/check-card/index.js +141 -171
  342. package/lib/checkbox/checkbox-group.d.ts +1 -1
  343. package/lib/checkbox/checkbox-group.js +9 -11
  344. package/lib/checkbox/checkbox-group.js.map +1 -1
  345. package/lib/checkbox/index.d.ts +3 -3
  346. package/lib/checkbox/index.js +25 -37
  347. package/lib/checkbox/index.js.map +1 -1
  348. package/lib/col/index.d.ts +3 -3
  349. package/lib/col/index.js +22 -23
  350. package/lib/col/index.js.map +1 -1
  351. package/lib/collapse/index.d.ts +3 -3
  352. package/lib/collapse/index.js +23 -24
  353. package/lib/collapse/index.js.map +1 -1
  354. package/lib/color-picker/ColorPicker.js +113 -156
  355. package/lib/color-picker/index.js +14 -18
  356. package/lib/color-picker/index.js.map +1 -1
  357. package/lib/columns/index.js +41 -81
  358. package/lib/columns/style/index.js +2 -1
  359. package/lib/comment/index.d.ts +3 -3
  360. package/lib/comment/index.js +22 -23
  361. package/lib/comment/index.js.map +1 -1
  362. package/lib/config-provider/DisabledContext.js +31 -18
  363. package/lib/config-provider/SizeContext.js +28 -19
  364. package/lib/config-provider/config-provider.d.ts +1 -1
  365. package/lib/config-provider/config-provider.js +8 -12
  366. package/lib/config-provider/config-provider.js.map +1 -1
  367. package/lib/config-provider/index.d.ts +4 -4
  368. package/lib/config-provider/index.js +23 -35
  369. package/lib/config-provider/index.js.map +1 -1
  370. package/lib/connect/index.js +26 -44
  371. package/lib/date-picker/index.d.ts +4 -4
  372. package/lib/date-picker/index.js +32 -48
  373. package/lib/date-picker/index.js.map +1 -1
  374. package/lib/descriptions/descriptions.d.ts +3 -3
  375. package/lib/descriptions/descriptions.js +55 -64
  376. package/lib/descriptions/descriptions.js.map +1 -1
  377. package/lib/descriptions/index.d.ts +1 -1
  378. package/lib/descriptions/index.js +22 -23
  379. package/lib/descriptions/index.js.map +1 -1
  380. package/lib/development-login/LoginModal.js +79 -110
  381. package/lib/development-login/index.js +35 -42
  382. package/lib/divider/index.d.ts +3 -3
  383. package/lib/divider/index.js +22 -23
  384. package/lib/divider/index.js.map +1 -1
  385. package/lib/drawer/drawer.d.ts +1 -1
  386. package/lib/drawer/drawer.js +30 -41
  387. package/lib/drawer/drawer.js.map +1 -1
  388. package/lib/drawer/index.d.ts +2 -2
  389. package/lib/drawer/index.js +20 -22
  390. package/lib/drawer/index.js.map +1 -1
  391. package/lib/dropdown/index.d.ts +3 -3
  392. package/lib/dropdown/index.js +22 -23
  393. package/lib/dropdown/index.js.map +1 -1
  394. package/lib/ellipsis/Svg/CopySVG.js +20 -70
  395. package/lib/ellipsis/Svg/TickSVG.js +15 -48
  396. package/lib/ellipsis/index.d.ts.map +1 -1
  397. package/lib/ellipsis/index.js +129 -155
  398. package/lib/ellipsis/index.js.map +1 -1
  399. package/lib/empty/empty.d.ts +2 -2
  400. package/lib/empty/empty.js +75 -90
  401. package/lib/empty/empty.js.map +1 -1
  402. package/lib/empty/empty.stories.js +18 -19
  403. package/lib/empty/index.d.ts +1 -1
  404. package/lib/empty/index.js +19 -20
  405. package/lib/empty/index.js.map +1 -1
  406. package/lib/exception/exception.js +31 -46
  407. package/lib/exception/exception.js.map +1 -1
  408. package/lib/exception/index.js +18 -19
  409. package/lib/form/form.d.ts +15 -0
  410. package/lib/form/form.d.ts.map +1 -0
  411. package/lib/form/form.js +100 -0
  412. package/lib/form/form.js.map +1 -0
  413. package/lib/form/index.d.ts +3 -3
  414. package/lib/form/index.d.ts.map +1 -1
  415. package/lib/form/index.js +19 -23
  416. package/lib/form/index.js.map +1 -1
  417. package/lib/handle/handle.d.ts +3 -0
  418. package/lib/handle/handle.d.ts.map +1 -0
  419. package/lib/handle/handle.js +130 -0
  420. package/lib/handle/handle.js.map +1 -0
  421. package/lib/handle/index.d.ts.map +1 -1
  422. package/lib/handle/index.js +149 -152
  423. package/lib/handle/index.js.map +1 -1
  424. package/lib/icon/index.d.ts +3 -3
  425. package/lib/icon/index.js +22 -23
  426. package/lib/icon/index.js.map +1 -1
  427. package/lib/icon-list/index.js +121 -7
  428. package/lib/img/Contain.js +44 -69
  429. package/lib/img/Cover.js +78 -117
  430. package/lib/img/index.js +60 -74
  431. package/lib/index.d.ts +1 -1
  432. package/lib/index.js +195 -642
  433. package/lib/index.js.map +1 -1
  434. package/lib/input/index.d.ts +1 -1
  435. package/lib/input/index.js +20 -21
  436. package/lib/input/index.js.map +1 -1
  437. package/lib/input/input.d.ts +14 -8
  438. package/lib/input/input.d.ts.map +1 -1
  439. package/lib/input/input.js +90 -95
  440. package/lib/input/input.js.map +1 -1
  441. package/lib/input-number/index.d.ts +3 -3
  442. package/lib/input-number/index.js +24 -26
  443. package/lib/input-number/index.js.map +1 -1
  444. package/lib/label/index.d.ts +2 -2
  445. package/lib/label/index.js +137 -134
  446. package/lib/label/index.js.map +1 -1
  447. package/lib/layout/index.d.ts +3 -3
  448. package/lib/layout/index.js +22 -23
  449. package/lib/layout/index.js.map +1 -1
  450. package/lib/list/index.d.ts +3 -3
  451. package/lib/list/index.js +22 -23
  452. package/lib/list/index.js.map +1 -1
  453. package/lib/loading-button/index.js +55 -58
  454. package/lib/locale/default.js +10 -12
  455. package/lib/locale/default.js.map +1 -1
  456. package/lib/locale/en_US.js +37 -39
  457. package/lib/locale/en_US.js.map +1 -1
  458. package/lib/locale/index.js +18 -36
  459. package/lib/locale/zh_CN.js +37 -39
  460. package/lib/locale/zh_CN.js.map +1 -1
  461. package/lib/locale-provider/index.d.ts +3 -3
  462. package/lib/locale-provider/index.js +25 -26
  463. package/lib/locale-provider/index.js.map +1 -1
  464. package/lib/mentions/index.d.ts +3 -3
  465. package/lib/mentions/index.js +22 -23
  466. package/lib/mentions/index.js.map +1 -1
  467. package/lib/menu/index.d.ts +3 -3
  468. package/lib/menu/index.js +22 -23
  469. package/lib/menu/index.js.map +1 -1
  470. package/lib/message/index.d.ts +3 -3
  471. package/lib/message/index.js +22 -23
  472. package/lib/message/index.js.map +1 -1
  473. package/lib/modal/index.d.ts +1 -1
  474. package/lib/modal/index.js +21 -22
  475. package/lib/modal/index.js.map +1 -1
  476. package/lib/modal/modal.d.ts +14 -13
  477. package/lib/modal/modal.d.ts.map +1 -1
  478. package/lib/modal/modal.js +61 -54
  479. package/lib/modal/modal.js.map +1 -1
  480. package/lib/notification/index.d.ts +3 -3
  481. package/lib/notification/index.js +22 -23
  482. package/lib/notification/index.js.map +1 -1
  483. package/lib/page/Box.js +40 -66
  484. package/lib/page/index.js +95 -148
  485. package/lib/page/utils.js +16 -22
  486. package/lib/page-header/index.d.ts +3 -3
  487. package/lib/page-header/index.js +22 -23
  488. package/lib/page-header/index.js.map +1 -1
  489. package/lib/pagination/index.d.ts +3 -3
  490. package/lib/pagination/index.js +22 -23
  491. package/lib/pagination/index.js.map +1 -1
  492. package/lib/popconfirm/index.d.ts +3 -3
  493. package/lib/popconfirm/index.js +22 -23
  494. package/lib/popconfirm/index.js.map +1 -1
  495. package/lib/popover/index.d.ts +3 -3
  496. package/lib/popover/index.js +22 -23
  497. package/lib/popover/index.js.map +1 -1
  498. package/lib/prev-locale.js +54 -68
  499. package/lib/preview-text/index.d.ts +4 -4
  500. package/lib/preview-text/index.js +209 -263
  501. package/lib/preview-text/index.js.map +1 -1
  502. package/lib/progress/index.d.ts +3 -3
  503. package/lib/progress/index.js +22 -23
  504. package/lib/progress/index.js.map +1 -1
  505. package/lib/query-form/Field/Checkbox.js +22 -28
  506. package/lib/query-form/Field/Select.js +68 -79
  507. package/lib/query-form/Field/SelectInput.js +73 -87
  508. package/lib/query-form/Field/fieldsMap.d.ts +4 -2
  509. package/lib/query-form/Field/fieldsMap.js +32 -34
  510. package/lib/query-form/Field/index.js +96 -143
  511. package/lib/query-form/createActions.js +50 -53
  512. package/lib/query-form/index.js +286 -377
  513. package/lib/query-form/useForm.js +11 -11
  514. package/lib/query-list-scene/List.js +289 -360
  515. package/lib/query-list-scene/QueryForm.js +103 -161
  516. package/lib/query-list-scene/QueryListScene.js +31 -66
  517. package/lib/query-list-scene/Title.js +9 -15
  518. package/lib/query-list-scene/Toolbar.js +20 -31
  519. package/lib/query-list-scene/createActions.js +64 -79
  520. package/lib/query-list-scene/index.js +24 -28
  521. package/lib/query-list-scene/useActions.js +11 -11
  522. package/lib/radio/index.d.ts +3 -3
  523. package/lib/radio/index.js +24 -26
  524. package/lib/radio/index.js.map +1 -1
  525. package/lib/radio/radio-group.d.ts +1 -1
  526. package/lib/radio/radio-group.js +9 -11
  527. package/lib/radio/radio-group.js.map +1 -1
  528. package/lib/rate/index.d.ts +3 -3
  529. package/lib/rate/index.js +22 -23
  530. package/lib/rate/index.js.map +1 -1
  531. package/lib/render-empty/index.js +4 -8
  532. package/lib/render-empty/render-empty.js +22 -28
  533. package/lib/render-empty/render-empty.js.map +1 -1
  534. package/lib/result/index.d.ts +3 -3
  535. package/lib/result/index.js +22 -23
  536. package/lib/result/index.js.map +1 -1
  537. package/lib/row/index.d.ts +3 -3
  538. package/lib/row/index.js +22 -23
  539. package/lib/row/index.js.map +1 -1
  540. package/lib/segmented/index.d.ts +1 -1
  541. package/lib/segmented/index.js +69 -71
  542. package/lib/select/index.d.ts +2 -2
  543. package/lib/select/index.js +20 -22
  544. package/lib/select/index.js.map +1 -1
  545. package/lib/select/select.d.ts +2 -2
  546. package/lib/select/select.d.ts.map +1 -1
  547. package/lib/select/select.js +64 -59
  548. package/lib/select/select.js.map +1 -1
  549. package/lib/skeleton/index.d.ts +3 -3
  550. package/lib/skeleton/index.js +22 -23
  551. package/lib/skeleton/index.js.map +1 -1
  552. package/lib/slider/index.d.ts +3 -3
  553. package/lib/slider/index.js +22 -23
  554. package/lib/slider/index.js.map +1 -1
  555. package/lib/spin/index.d.ts +3 -3
  556. package/lib/spin/index.js +22 -23
  557. package/lib/spin/index.js.map +1 -1
  558. package/lib/statistic/index.d.ts +3 -3
  559. package/lib/statistic/index.js +22 -23
  560. package/lib/statistic/index.js.map +1 -1
  561. package/lib/steps/index.d.ts +1 -1
  562. package/lib/steps/index.js +19 -20
  563. package/lib/steps/index.js.map +1 -1
  564. package/lib/steps/steps.d.ts +3 -3
  565. package/lib/steps/steps.js +59 -72
  566. package/lib/steps/steps.js.map +1 -1
  567. package/lib/steps/style/nav.less +1 -1
  568. package/lib/svg-components/illustration-403.d.ts +1 -1
  569. package/lib/svg-components/illustration-403.js +84 -217
  570. package/lib/svg-components/illustration-404.d.ts +1 -1
  571. package/lib/svg-components/illustration-404.js +101 -301
  572. package/lib/svg-components/illustration-500.d.ts +1 -1
  573. package/lib/svg-components/illustration-500.js +109 -332
  574. package/lib/svg-components/illustration-empty.d.ts +1 -1
  575. package/lib/svg-components/illustration-empty.js +41 -65
  576. package/lib/svg-components/illustration-failure.d.ts +1 -1
  577. package/lib/svg-components/illustration-failure.js +62 -123
  578. package/lib/svg-components/illustration-no-access.d.ts +1 -1
  579. package/lib/svg-components/illustration-no-access.js +61 -125
  580. package/lib/svg-components/illustration-no-chart.d.ts +1 -1
  581. package/lib/svg-components/illustration-no-chart.js +63 -145
  582. package/lib/svg-components/illustration-no-result.d.ts +1 -1
  583. package/lib/svg-components/illustration-no-result.js +58 -103
  584. package/lib/svg-components/illustration-offline.d.ts +1 -1
  585. package/lib/svg-components/illustration-offline.js +69 -142
  586. package/lib/svg-components/illustration-success.d.ts +1 -1
  587. package/lib/svg-components/illustration-success.js +69 -148
  588. package/lib/svg-components/index.js +26 -75
  589. package/lib/switch/index.js +21 -22
  590. package/lib/switch/switch.d.ts +4 -4
  591. package/lib/switch/switch.d.ts.map +1 -1
  592. package/lib/switch/switch.js +27 -35
  593. package/lib/switch/switch.js.map +1 -1
  594. package/lib/table/assets/image-loading-background.d.ts +1 -1
  595. package/lib/table/assets/image-loading-background.js +43 -56
  596. package/lib/table/assets/image-loading.d.ts +1 -1
  597. package/lib/table/assets/image-loading.js +31 -37
  598. package/lib/table/constants.js +57 -11
  599. package/lib/table/context.js +4 -7
  600. package/lib/table/hooks/index.js +16 -14
  601. package/lib/table/hooks/use-column-setting.d.ts +1 -1
  602. package/lib/table/hooks/use-column-setting.js +20 -37
  603. package/lib/table/hooks/use-column-setting.js.map +1 -1
  604. package/lib/table/index.d.ts +1 -1
  605. package/lib/table/index.js +19 -20
  606. package/lib/table/index.js.map +1 -1
  607. package/lib/table/table.d.ts +4 -3
  608. package/lib/table/table.d.ts.map +1 -1
  609. package/lib/table/table.js +216 -207
  610. package/lib/table/table.js.map +1 -1
  611. package/lib/table/table.stories.js +154 -182
  612. package/lib/table/total-shower.d.ts +2 -2
  613. package/lib/table/total-shower.js +10 -14
  614. package/lib/table/total-shower.js.map +1 -1
  615. package/lib/table/utils.d.ts +1 -1
  616. package/lib/table/utils.js +25 -24
  617. package/lib/table/utils.js.map +1 -1
  618. package/lib/tabs/index.d.ts +3 -3
  619. package/lib/tabs/index.d.ts.map +1 -1
  620. package/lib/tabs/index.js +19 -23
  621. package/lib/tabs/index.js.map +1 -1
  622. package/lib/tabs/tabPane.d.ts +1 -0
  623. package/lib/tabs/tabPane.d.ts.map +1 -0
  624. package/lib/tabs/tabPane.js +2 -0
  625. package/lib/tabs/tabPane.js.map +1 -0
  626. package/lib/tabs/tabs.d.ts +12 -0
  627. package/lib/tabs/tabs.d.ts.map +1 -0
  628. package/lib/tabs/tabs.js +77 -0
  629. package/lib/tabs/tabs.js.map +1 -0
  630. package/lib/tag/index.d.ts +3 -3
  631. package/lib/tag/index.js +22 -23
  632. package/lib/tag/index.js.map +1 -1
  633. package/lib/time-picker/index.d.ts +3 -3
  634. package/lib/time-picker/index.js +24 -25
  635. package/lib/time-picker/index.js.map +1 -1
  636. package/lib/timeline/index.d.ts +3 -3
  637. package/lib/timeline/index.js +22 -23
  638. package/lib/timeline/index.js.map +1 -1
  639. package/lib/title/index.d.ts.map +1 -1
  640. package/lib/title/index.js +27 -43
  641. package/lib/title/index.js.map +1 -1
  642. package/lib/tntd-cascader/AntdCascader/component/DisabledContext.js +31 -18
  643. package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.js +26 -9
  644. package/lib/tntd-cascader/AntdCascader/component/SizeContext.js +26 -9
  645. package/lib/tntd-cascader/AntdCascader/component/context.js +16 -18
  646. package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +39 -36
  647. package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -1
  648. package/lib/tntd-cascader/AntdCascader/component/getIcons.js +75 -81
  649. package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js +50 -31
  650. package/lib/tntd-cascader/AntdCascader/config/utils.js +27 -29
  651. package/lib/tntd-cascader/AntdCascader/config/warning.js +35 -19
  652. package/lib/tntd-cascader/AntdCascader/index.js +162 -216
  653. package/lib/tntd-cascader/AntdCascader/index.less +1 -1
  654. package/lib/tntd-cascader/AntdCascader/interface.js +6 -13
  655. package/lib/tntd-cascader/img/no-data-s.png +0 -0
  656. package/lib/tntd-cascader/index.js +8 -12
  657. package/lib/tntd-cascader/rc-cascader/Cascader.js +284 -325
  658. package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js +41 -30
  659. package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +152 -198
  660. package/lib/tntd-cascader/rc-cascader/OptionList/index.js +163 -223
  661. package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js +48 -40
  662. package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +166 -179
  663. package/lib/tntd-cascader/rc-cascader/context.js +27 -11
  664. package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +63 -62
  665. package/lib/tntd-cascader/rc-cascader/hooks/useEntities.js +49 -39
  666. package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.js +41 -26
  667. package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.js +33 -16
  668. package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +51 -30
  669. package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +65 -75
  670. package/lib/tntd-cascader/rc-cascader/index.js +7 -9
  671. package/lib/tntd-cascader/rc-cascader/utils/commonUtil.js +38 -49
  672. package/lib/tntd-cascader/rc-cascader/utils/treeUtil.js +39 -42
  673. package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +30 -34
  674. package/lib/tntd-form/ErrorList.js +77 -99
  675. package/lib/tntd-form/Form.d.ts.map +1 -1
  676. package/lib/tntd-form/Form.js +139 -155
  677. package/lib/tntd-form/Form.js.map +1 -1
  678. package/lib/tntd-form/FormItem/ItemHolder.js +155 -154
  679. package/lib/tntd-form/FormItem/index.js +252 -287
  680. package/lib/tntd-form/FormItemInput.js +62 -88
  681. package/lib/tntd-form/FormItemLabel.js +94 -99
  682. package/lib/tntd-form/FormList.js +58 -52
  683. package/lib/tntd-form/_util/motion.js +34 -51
  684. package/lib/tntd-form/_util/reactNode.js +37 -20
  685. package/lib/tntd-form/_util/scrollTo.js +2 -2
  686. package/lib/tntd-form/_util/type.js +5 -17
  687. package/lib/tntd-form/_util/warning.js +29 -17
  688. package/lib/tntd-form/_util/wave.js +2 -2
  689. package/lib/tntd-form/context.js +59 -47
  690. package/lib/tntd-form/hooks/useDebounce.js +37 -28
  691. package/lib/tntd-form/hooks/useForm.js +57 -56
  692. package/lib/tntd-form/hooks/useFormInstance.js +8 -11
  693. package/lib/tntd-form/hooks/useFormItemStatus.js +13 -18
  694. package/lib/tntd-form/hooks/useFrameState.js +63 -51
  695. package/lib/tntd-form/hooks/useItemRef.js +41 -24
  696. package/lib/tntd-form/index.js +43 -26
  697. package/lib/tntd-form/interface.js +4 -6
  698. package/lib/tntd-form/style/index.js +4 -2
  699. package/lib/tntd-form/tntd-form.stories.d.ts.map +1 -1
  700. package/lib/tntd-form/tntd-form.stories.js +437 -858
  701. package/lib/tntd-form/tntd-form.stories.js.map +1 -1
  702. package/lib/tntd-form/util.js +19 -18
  703. package/lib/tntd-form/validateMessagesContext.js +4 -8
  704. package/lib/tntd-icon/fonts/iconfont.js +53 -36
  705. package/lib/tntd-icon/index.js +25 -40
  706. package/lib/tntd-layout/ActionsContext.js +4 -8
  707. package/lib/tntd-layout/AppList.js +224 -173
  708. package/lib/tntd-layout/Application.js +111 -75
  709. package/lib/tntd-layout/Avatar.js +135 -100
  710. package/lib/tntd-layout/CompatibleLanguage.js +180 -128
  711. package/lib/tntd-layout/EnterpriseLayout/Avatar.js +146 -117
  712. package/lib/tntd-layout/EnterpriseLayout/Language.js +90 -73
  713. package/lib/tntd-layout/EnterpriseLayout/Theme.js +102 -69
  714. package/lib/tntd-layout/EnterpriseLayout/index.js +17 -28
  715. package/lib/tntd-layout/GlobalNavigation/NavigationPopup.js +276 -283
  716. package/lib/tntd-layout/GlobalNavigation/index.js +115 -108
  717. package/lib/tntd-layout/Header.js +136 -77
  718. package/lib/tntd-layout/HeaderActions.js +106 -106
  719. package/lib/tntd-layout/HeaderNavs.js +107 -78
  720. package/lib/tntd-layout/HeaderTabs.js +316 -224
  721. package/lib/tntd-layout/Iconfont.js +7 -11
  722. package/lib/tntd-layout/Language.js +76 -69
  723. package/lib/tntd-layout/Layout.js +171 -214
  724. package/lib/tntd-layout/Logo.js +144 -69
  725. package/lib/tntd-layout/OrgAppList.js +388 -238
  726. package/lib/tntd-layout/SideMenu.js +408 -269
  727. package/lib/tntd-layout/Theme.js +93 -75
  728. package/lib/tntd-layout/createActions.js +34 -45
  729. package/lib/tntd-layout/images/avatar/empty.png +0 -0
  730. package/lib/tntd-layout/images/avatar/female1.png +0 -0
  731. package/lib/tntd-layout/images/avatar/female2.png +0 -0
  732. package/lib/tntd-layout/images/avatar/female3.png +0 -0
  733. package/lib/tntd-layout/images/avatar/female4.png +0 -0
  734. package/lib/tntd-layout/images/avatar/female5.png +0 -0
  735. package/lib/tntd-layout/images/avatar/female6.png +0 -0
  736. package/lib/tntd-layout/images/avatar/male1.png +0 -0
  737. package/lib/tntd-layout/images/avatar/male2.png +0 -0
  738. package/lib/tntd-layout/images/avatar/male3.png +0 -0
  739. package/lib/tntd-layout/images/avatar/male4.png +0 -0
  740. package/lib/tntd-layout/images/avatar/male5.png +0 -0
  741. package/lib/tntd-layout/images/avatar/male6.png +0 -0
  742. package/lib/tntd-layout/images/index.js +66 -68
  743. package/lib/tntd-layout/index.js +95 -137
  744. package/lib/tntd-layout/paaslayout/CompactSideMenu.js +182 -131
  745. package/lib/tntd-layout/paaslayout/Header.js +79 -51
  746. package/lib/tntd-layout/paaslayout/Logo.js +30 -15
  747. package/lib/tntd-layout/paaslayout/SideMenu.js +147 -131
  748. package/lib/tntd-layout/paaslayout/index.js +141 -205
  749. package/lib/tntd-layout/storage.js +30 -58
  750. package/lib/tntd-modal/index.d.ts +2 -15
  751. package/lib/tntd-modal/index.d.ts.map +1 -1
  752. package/lib/tntd-modal/index.js +62 -113
  753. package/lib/tntd-modal/index.js.map +1 -1
  754. package/lib/tntd-modal/index.less +66 -82
  755. package/lib/tntd-second-page/index.js +33 -60
  756. package/lib/tntd-second-page/index.js.map +1 -1
  757. package/lib/tntd-select/DropDownWrap.js +78 -102
  758. package/lib/tntd-select/index.d.ts +2 -2
  759. package/lib/tntd-select/index.d.ts.map +1 -1
  760. package/lib/tntd-select/index.js +538 -631
  761. package/lib/tntd-select/index.js.map +1 -1
  762. package/lib/tooltip/index.d.ts +3 -3
  763. package/lib/tooltip/index.js +22 -23
  764. package/lib/tooltip/index.js.map +1 -1
  765. package/lib/transfer/index.d.ts +3 -3
  766. package/lib/transfer/index.js +22 -23
  767. package/lib/transfer/index.js.map +1 -1
  768. package/lib/tree/index.d.ts +3 -3
  769. package/lib/tree/index.js +22 -23
  770. package/lib/tree/index.js.map +1 -1
  771. package/lib/tree-select/index.d.ts +5 -5
  772. package/lib/tree-select/index.js +27 -30
  773. package/lib/tree-select/index.js.map +1 -1
  774. package/lib/typography/index.d.ts +3 -3
  775. package/lib/typography/index.js +22 -23
  776. package/lib/typography/index.js.map +1 -1
  777. package/lib/upload/index.d.ts +2 -2
  778. package/lib/upload/index.js +26 -32
  779. package/lib/upload/index.js.map +1 -1
  780. package/lib/utils/checkAuth.js +23 -34
  781. package/lib/utils/findMenuInfoByPath.js +34 -41
  782. package/lib/utils/index.d.ts +2 -0
  783. package/lib/utils/index.d.ts.map +1 -1
  784. package/lib/utils/index.js +95 -128
  785. package/lib/utils/index.js.map +1 -1
  786. package/lib/utils/lang.d.ts +2 -0
  787. package/lib/utils/lang.d.ts.map +1 -0
  788. package/lib/utils/lang.js +126 -0
  789. package/lib/utils/lang.js.map +1 -0
  790. package/lib/utils/simple-template.js +7 -11
  791. package/lib/version/index.d.ts +3 -3
  792. package/lib/version/index.js +22 -23
  793. package/lib/version/index.js.map +1 -1
  794. package/lib/water-mark/index.js +117 -130
  795. package/package.json +1 -1
@@ -1,651 +1,558 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
5
17
  });
6
- exports["default"] = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _select = _interopRequireDefault(require("../select"));
9
- var _empty = _interopRequireDefault(require("../empty"));
10
- var _spin = _interopRequireDefault(require("../spin"));
11
- var _DropDownWrap = _interopRequireDefault(require("./DropDownWrap"));
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
- 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); }
14
- 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; }
15
- 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); }
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
- 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); } }
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- 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); }
21
- 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); }
22
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
- 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); }; }
24
- 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
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
- 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; } }
27
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
- var __rest = void 0 && (void 0).__rest || function (s, e) {
29
- var t = {};
30
- for (var p in s) {
31
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
32
- }
33
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
34
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
35
- }
36
- return t;
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
37
35
  };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const react_1 = __importStar(require("react"));
41
+ const select_1 = __importDefault(require("../select"));
42
+ const empty_1 = __importDefault(require("../empty"));
43
+ const spin_1 = __importDefault(require("../spin"));
44
+ const DropDownWrap_1 = __importDefault(require("./DropDownWrap"));
45
+ const utils_1 = require("../utils");
38
46
  // 页面实际渲染的下拉菜单数量,实际为 2 * ITEM_ELEMENT_NUMBER
39
- var ITEM_ELEMENT_NUMBER = 30;
47
+ const ITEM_ELEMENT_NUMBER = 30;
40
48
  // Select size 配置
41
- var ITEM_HEIGHT_CFG = {
42
- small: 24,
43
- large: 40,
44
- "default": 32
49
+ const ITEM_HEIGHT_CFG = {
50
+ small: 24,
51
+ large: 40,
52
+ default: 32,
45
53
  };
46
- var ARROW_CODE = {
47
- 40: 'down',
48
- 38: 'up'
54
+ const ARROW_CODE = {
55
+ 40: 'down',
56
+ 38: 'up',
49
57
  };
50
- var DROPDOWN_HEIGHT = 224;
51
- var Option = _select["default"].Option;
52
- var SuperSelect = /*#__PURE__*/function (_PureComponent) {
53
- _inherits(SuperSelect, _PureComponent);
54
- var _super = _createSuper(SuperSelect);
55
- function SuperSelect(props) {
56
- var _this;
57
- _classCallCheck(this, SuperSelect);
58
- _this = _super.call(this, props);
59
- Object.defineProperty(_assertThisInitialized(_this), "turnChildren", {
60
- enumerable: true,
61
- configurable: true,
62
- writable: true,
63
- value: function value(children) {
64
- if (!children) return [];
65
- var arr = [];
66
- if (children && children.props) {
67
- arr.push(children);
68
- } else {
69
- children.forEach(function (item) {
70
- if (item) {
71
- if (item instanceof Array) {
72
- arr = arr.concat(item);
73
- } else {
74
- arr.push(item);
75
- }
58
+ const DROPDOWN_HEIGHT = 224;
59
+ const Option = select_1.default.Option;
60
+ class SuperSelect extends react_1.PureComponent {
61
+ constructor(props) {
62
+ super(props);
63
+ Object.defineProperty(this, "turnChildren", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: (children) => {
68
+ if (!children)
69
+ return [];
70
+ let arr = [];
71
+ if (children && children.props) {
72
+ arr.push(children);
73
+ }
74
+ else {
75
+ children.forEach((item) => {
76
+ if (item) {
77
+ if (item instanceof Array) {
78
+ arr = arr.concat(item);
79
+ }
80
+ else {
81
+ arr.push(item);
82
+ }
83
+ }
84
+ });
85
+ }
86
+ return arr;
76
87
  }
77
- });
78
- }
79
- return arr;
80
- }
81
- });
82
- Object.defineProperty(_assertThisInitialized(_this), "formulaWidth", {
83
- enumerable: true,
84
- configurable: true,
85
- writable: true,
86
- value: function value() {
87
- // 获取dom设置宽度
88
- var _this$props = _this.props,
89
- arr2 = _this$props.children,
90
- _this$props$dropdownM = _this$props.dropdownMatchSelectWidth,
91
- dropdownMatchSelectWidth = _this$props$dropdownM === void 0 ? true : _this$props$dropdownM,
92
- maxWidth = _this$props.maxWidth;
93
- var selectDom = document.getElementById(_this.id);
94
- var selectWidth = selectDom.clientWidth || selectDom.offsetWidth;
95
- var arr = [];
96
- var formulaMaxWidth = 10;
97
- if (!dropdownMatchSelectWidth) {
98
- formulaMaxWidth = maxWidth || 10;
99
- }
100
- if (!dropdownMatchSelectWidth && !maxWidth) {
101
- var _children = _this.turnChildren(arr2);
102
- for (var i = 0; i < _children.length; i++) {
103
- var val = _children[i].props.children;
104
- var textWidth = _this.getTextPixelWith(val);
105
- arr.push(textWidth.toFixed(2));
106
- }
107
- if (arr.length > 0) {
108
- formulaMaxWidth = Math.max.apply(Math, arr);
109
- }
110
- }
111
- _this.setState({
112
- selectWidth: selectWidth,
113
- maxWidth: formulaMaxWidth
114
88
  });
115
- }
116
- });
117
- // 获取单行文本的像素宽度
118
- Object.defineProperty(_assertThisInitialized(_this), "getTextPixelWith", {
119
- enumerable: true,
120
- configurable: true,
121
- writable: true,
122
- value: function value(text) {
123
- var fontStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '14px';
124
- var canvas = document.createElement('canvas'); // 创建 canvas 画布
125
- var context = canvas.getContext('2d'); // 获取 canvas 绘图上下文环境
126
- context.font = fontStyle; // 设置字体样式,使用前设置好对应的 font 样式才能准确获取文字的像素长度
127
- var dimension = context.measureText(text); // 测量文字
128
- return dimension.width;
129
- }
130
- });
131
- Object.defineProperty(_assertThisInitialized(_this), "getItemStyle", {
132
- enumerable: true,
133
- configurable: true,
134
- writable: true,
135
- value: function value(i) {
136
- return {
137
- position: 'absolute',
138
- top: _this.ITEM_HEIGHT * i,
139
- width: '100%',
140
- height: _this.ITEM_HEIGHT
141
- };
142
- }
143
- });
144
- Object.defineProperty(_assertThisInitialized(_this), "preventEvent", {
145
- enumerable: true,
146
- configurable: true,
147
- writable: true,
148
- value: function value(e) {
149
- e.preventDefault();
150
- }
151
- });
152
- Object.defineProperty(_assertThisInitialized(_this), "addEvent", {
153
- enumerable: true,
154
- configurable: true,
155
- writable: true,
156
- value: function value() {
157
- _this.scrollEle = document.querySelector(".".concat(_this.dropdownClassName));
158
- // 下拉菜单未展开时元素不存在
159
- if (!_this.scrollEle) return;
160
- _this.scrollEle.addEventListener('mousedown', _this.preventEvent, false);
161
- _this.scrollEle.addEventListener('scroll', _this.onScroll, false);
162
- _this.inputEle = document.querySelector("#".concat(_this.id));
163
- if (!_this.inputEle) return;
164
- _this.inputEle.addEventListener('keydown', _this.onKeyDown, false);
165
- }
166
- });
167
- // 模拟 antd select 按下 上下箭头 键时滚动列表
168
- Object.defineProperty(_assertThisInitialized(_this), "onKeyDown", {
169
- enumerable: true,
170
- configurable: true,
171
- writable: true,
172
- value: function value(e) {
173
- var _ref = e || {},
174
- keyCode = _ref.keyCode;
175
- setTimeout(function () {
176
- var activeItem = document.querySelector(".".concat(_this.dropdownClassName, " .ant-select-dropdown-menu-item-active"));
177
- if (!activeItem) return;
178
- var offsetTop = activeItem.offsetTop;
179
- var isUp = ARROW_CODE[keyCode] === 'up';
180
- var isDown = ARROW_CODE[keyCode] === 'down';
181
- // 在所有列表第一行按上键
182
- if (offsetTop - _this.prevTop > DROPDOWN_HEIGHT && isUp && _this.scrollEle) {
183
- _this.scrollEle.scrollTo(0, _this.allHeight - DROPDOWN_HEIGHT);
184
- _this.prevTop = _this.allHeight;
185
- return;
186
- }
187
- // 在所有列表中最后一行按下键
188
- if (_this.prevTop > offsetTop + DROPDOWN_HEIGHT && isDown && _this.scrollEle) {
189
- _this.scrollEle.scrollTo(0, 0);
190
- _this.prevTop = 0;
191
- return;
192
- }
193
- _this.prevTop = offsetTop;
194
- // 向下滚动到下拉框最后一行时,向下滚动一行的高度
195
- if (offsetTop > _this.scrollEle.scrollTop + DROPDOWN_HEIGHT - _this.ITEM_HEIGHT + 10 && isDown) {
196
- _this.scrollEle.scrollTo(0, _this.scrollTop + _this.ITEM_HEIGHT);
197
- return;
198
- }
199
- // 向上滚动到下拉框第一一行时,向上滚动一行的高度
200
- if (offsetTop < _this.scrollEle.scrollTop && isUp) {
201
- _this.scrollEle.scrollTo(0, _this.scrollTop - _this.ITEM_HEIGHT);
202
- }
203
- }, 100);
204
- }
205
- });
206
- Object.defineProperty(_assertThisInitialized(_this), "onScroll", {
207
- enumerable: true,
208
- configurable: true,
209
- writable: true,
210
- value: function value() {
211
- return _this.throttleByHeight(_this.onScrollReal);
212
- }
213
- });
214
- Object.defineProperty(_assertThisInitialized(_this), "onScrollReal", {
215
- enumerable: true,
216
- configurable: true,
217
- writable: true,
218
- value: function value() {
219
- _this.allList = _this.getUseChildrenList();
220
- var _this$getStartAndEndI = _this.getStartAndEndIndex(),
221
- startIndex = _this$getStartAndEndI.startIndex,
222
- endIndex = _this$getStartAndEndI.endIndex;
223
- _this.prevScrollTop = _this.scrollTop;
224
- // 重新渲染列表组件 Wrap
225
- var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
226
- _this.wrap.reactList(allHeight, startIndex, endIndex);
227
- }
228
- });
229
- Object.defineProperty(_assertThisInitialized(_this), "throttleByHeight", {
230
- enumerable: true,
231
- configurable: true,
232
- writable: true,
233
- value: function value() {
234
- _this.scrollTop = _this.scrollEle.scrollTop;
235
- // 滚动的高度
236
- var delta = _this.prevScrollTop - _this.scrollTop;
237
- delta = delta < 0 ? 0 - delta : delta;
238
- delta > _this.reactDelta && _this.onScrollReal();
239
- }
240
- });
241
- // 列表可展示所有 children
242
- Object.defineProperty(_assertThisInitialized(_this), "getUseChildrenList", {
243
- enumerable: true,
244
- configurable: true,
245
- writable: true,
246
- value: function value() {
247
- return _this.state.filterChildren || _this.state.children;
248
- }
249
- });
250
- Object.defineProperty(_assertThisInitialized(_this), "getStartAndEndIndex", {
251
- enumerable: true,
252
- configurable: true,
253
- writable: true,
254
- value: function value() {
255
- // 滚动后显示在列表可视区中的第一个 item 的 index
256
- var showIndex = Number((_this.scrollTop / _this.ITEM_HEIGHT).toFixed(0));
257
- var startIndex = showIndex - ITEM_ELEMENT_NUMBER < 0 ? 0 : showIndex - ITEM_ELEMENT_NUMBER / 2;
258
- var endIndex = showIndex + ITEM_ELEMENT_NUMBER;
259
- return {
260
- startIndex: startIndex,
261
- endIndex: endIndex
262
- };
263
- }
264
- });
265
- // 须使用 setTimeout 确保在 dom 加载完成之后添加事件
266
- Object.defineProperty(_assertThisInitialized(_this), "setSuperDrowDownMenu", {
267
- enumerable: true,
268
- configurable: true,
269
- writable: true,
270
- value: function value(visible) {
271
- if (!visible) return;
272
- _this.allList = _this.getUseChildrenList();
273
- if (!_this.eventTimer || !_this.scrollEle) {
274
- _this.eventTimer = setTimeout(function () {
275
- return _this.addEvent();
276
- }, 0);
277
- } else {
278
- var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
279
- // 下拉列表单独重新渲染
280
- var _this$getStartAndEndI2 = _this.getStartAndEndIndex(),
281
- startIndex = _this$getStartAndEndI2.startIndex,
282
- endIndex = _this$getStartAndEndI2.endIndex;
283
- setTimeout(function () {
284
- _this.wrap && _this.wrap.reactList(allHeight, startIndex, endIndex);
285
- }, 0);
286
- }
287
- }
288
- });
289
- Object.defineProperty(_assertThisInitialized(_this), "onDropdownVisibleChange", {
290
- enumerable: true,
291
- configurable: true,
292
- writable: true,
293
- value: function value(visible) {
294
- var onDropdownVisibleChange = _this.props.onDropdownVisibleChange;
295
- onDropdownVisibleChange && onDropdownVisibleChange(visible);
296
- var _this$state = _this.state,
297
- value = _this$state.value,
298
- children = _this$state.children;
299
- // 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
300
- if (!visible) {
301
- // 定时器确保关闭后再设置 filterChildren,防止列表刷新闪烁
302
- setTimeout(function () {
303
- _this.setState({
304
- filterChildren: null
305
- });
306
- _this.setDefaultScrollTop(value);
307
- }, 100);
308
- // this.removeEvent();
309
- } else {
310
- // this.addEvent();
311
- if (value) {
312
- // 如果已有 value, 设置默认滚动位置
313
- _this.setDefaultScrollTop();
314
- // 设置下拉列表显示数据
315
- _this.setSuperDrowDownMenu(visible);
316
- } else if (!value && value !== 0 && children && children.length > 0) {
317
- // 无数据时,下拉回归至第一个
318
- var val = children[0].props.value;
319
- _this.setDefaultScrollTop(val);
320
- }
321
- }
322
- }
323
- });
324
- Object.defineProperty(_assertThisInitialized(_this), "onDeselect", {
325
- enumerable: true,
326
- configurable: true,
327
- writable: true,
328
- value: function value(_value) {
329
- var onDeselect = _this.props.onDeselect;
330
- onDeselect && onDeselect(_value);
331
- }
332
- });
333
- // 在搜索重新计算下拉滚动条高度
334
- Object.defineProperty(_assertThisInitialized(_this), "onChange", {
335
- enumerable: true,
336
- configurable: true,
337
- writable: true,
338
- value: function value(_value2, opt) {
339
- var _this$props2 = _this.props,
340
- showSearch = _this$props2.showSearch,
341
- onChange = _this$props2.onChange,
342
- autoClearSearchValue = _this$props2.autoClearSearchValue,
343
- maxCount = _this$props2.maxCount,
344
- mode = _this$props2.mode;
345
- if (showSearch || _this.isMultiple) {
346
- // 搜索模式下选择后是否需要重置搜索状态
347
- if (autoClearSearchValue !== false) {
348
- _this.setState({
349
- filterChildren: null
350
- }, function () {
351
- // 搜索成功后重新设置列表的总高度
352
- _this.setSuperDrowDownMenu(true);
353
- });
354
- }
355
- }
356
- if (mode === 'multiple') {
357
- if (_value2.length <= maxCount) {
358
- _this.setState({
359
- value: _value2
360
- });
361
- }
362
- } else {
363
- _this.setState({
364
- value: _value2
365
- });
366
- }
367
- onChange && onChange(_value2, opt);
368
- if (mode !== 'multiple') {
369
- _this.select && _this.select.blur();
370
- }
371
- }
372
- });
373
- Object.defineProperty(_assertThisInitialized(_this), "onSearch", {
374
- enumerable: true,
375
- configurable: true,
376
- writable: true,
377
- value: function value(v) {
378
- var _this$props3 = _this.props,
379
- showSearch = _this$props3.showSearch,
380
- onSearch = _this$props3.onSearch,
381
- filterOption = _this$props3.filterOption,
382
- arr = _this$props3.children;
383
- var children = _this.turnChildren(arr);
384
- if (showSearch && filterOption !== false) {
385
- // 须根据 filterOption(如有该自定义函数)手动 filter 搜索匹配的列表
386
- var filterChildren = null;
387
- if (typeof filterOption === 'function') {
388
- filterChildren = children.filter(function (item) {
389
- return filterOption(v, item);
390
- });
391
- } else if (filterOption === undefined) {
392
- filterChildren = children.filter(function (item) {
393
- return _this.filterOption(v, item);
394
- });
395
- }
396
- // 搜索框有值,去除disabled=true的children
397
- var newFilterChild = [];
398
- filterChildren && filterChildren.forEach(function (item, index) {
399
- if (!item.props.disabled) {
400
- newFilterChild.push(item);
89
+ Object.defineProperty(this, "formulaWidth", {
90
+ enumerable: true,
91
+ configurable: true,
92
+ writable: true,
93
+ value: () => {
94
+ // 获取dom设置宽度
95
+ const { children: arr2, dropdownMatchSelectWidth = true, maxWidth } = this.props;
96
+ const selectDom = document.getElementById(this.id);
97
+ const selectWidth = selectDom.clientWidth || selectDom.offsetWidth;
98
+ let arr = [];
99
+ let formulaMaxWidth = 10;
100
+ if (!dropdownMatchSelectWidth) {
101
+ formulaMaxWidth = maxWidth || 10;
102
+ }
103
+ if (!dropdownMatchSelectWidth && !maxWidth) {
104
+ const children = this.turnChildren(arr2);
105
+ for (let i = 0; i < children.length; i++) {
106
+ const val = children[i].props.children;
107
+ const textWidth = this.getTextPixelWith(val);
108
+ arr.push(textWidth.toFixed(2));
109
+ }
110
+ if (arr.length > 0) {
111
+ formulaMaxWidth = Math.max(...arr);
112
+ }
113
+ }
114
+ this.setState({
115
+ selectWidth,
116
+ maxWidth: formulaMaxWidth,
117
+ });
401
118
  }
402
- });
403
- filterChildren = newFilterChild;
404
- // 设置下拉列表显示数据
405
- _this.setState({
406
- filterChildren: v === '' ? null : filterChildren
407
- }, function () {
408
- setTimeout(function () {
409
- // 搜索后需要重置滚动位置到0,防止上次 scrollTop 位置无数据
410
- if (filterChildren && _this.scrollEle) {
411
- _this.scrollTop = 0;
412
- _this.scrollEle.scrollTo(0, 0);
413
- }
414
- // 搜索成功后需要重新设置列表的总高度
415
- _this.setSuperDrowDownMenu(true);
416
- }, 0);
417
- });
418
- }
419
- onSearch && onSearch(v);
420
- }
421
- });
422
- Object.defineProperty(_assertThisInitialized(_this), "filterOption", {
423
- enumerable: true,
424
- configurable: true,
425
- writable: true,
426
- value: function value(v, option) {
427
- // 自定义过滤对应的 option 属性配置
428
- var filterProps = _this.props.optionFilterProp || 'value';
429
- return "".concat(option.props[filterProps]).indexOf(v) >= 0;
430
- }
431
- });
432
- Object.defineProperty(_assertThisInitialized(_this), "setDefaultScrollTop", {
433
- enumerable: true,
434
- configurable: true,
435
- writable: true,
436
- value: function value(data) {
437
- var value = _this.state.value;
438
- var arr = _this.props.children;
439
- var children = _this.turnChildren(arr);
440
- var val = data || data === 0 ? data : value;
441
- for (var i = 0; i < children.length; i++) {
442
- var item = children[i];
443
- var itemValue = item.props.value;
444
- if (itemValue === val || Array.isArray(val) && val.includes(itemValue)) {
445
- var _ret = function () {
446
- var targetScrollTop = i * _this.ITEM_HEIGHT;
447
- setTimeout(function () {
448
- if (!_this.scrollEle) {
449
- _this.addEvent();
119
+ });
120
+ // 获取单行文本的像素宽度
121
+ Object.defineProperty(this, "getTextPixelWith", {
122
+ enumerable: true,
123
+ configurable: true,
124
+ writable: true,
125
+ value: (text, fontStyle = '14px') => {
126
+ let canvas = document.createElement('canvas'); // 创建 canvas 画布
127
+ let context = canvas.getContext('2d'); // 获取 canvas 绘图上下文环境
128
+ context.font = fontStyle; // 设置字体样式,使用前设置好对应的 font 样式才能准确获取文字的像素长度
129
+ let dimension = context.measureText(text); // 测量文字
130
+ return dimension.width;
131
+ }
132
+ });
133
+ Object.defineProperty(this, "getItemStyle", {
134
+ enumerable: true,
135
+ configurable: true,
136
+ writable: true,
137
+ value: (i) => ({
138
+ position: 'absolute',
139
+ top: this.ITEM_HEIGHT * i,
140
+ width: '100%',
141
+ height: this.ITEM_HEIGHT,
142
+ })
143
+ });
144
+ Object.defineProperty(this, "preventEvent", {
145
+ enumerable: true,
146
+ configurable: true,
147
+ writable: true,
148
+ value: (e) => {
149
+ e.preventDefault();
150
+ }
151
+ });
152
+ Object.defineProperty(this, "addEvent", {
153
+ enumerable: true,
154
+ configurable: true,
155
+ writable: true,
156
+ value: () => {
157
+ this.scrollEle = document.querySelector(`.${this.dropdownClassName}`);
158
+ // 下拉菜单未展开时元素不存在
159
+ if (!this.scrollEle)
160
+ return;
161
+ this.scrollEle.addEventListener('mousedown', this.preventEvent, false);
162
+ this.scrollEle.addEventListener('scroll', this.onScroll, false);
163
+ this.inputEle = document.querySelector(`#${this.id}`);
164
+ if (!this.inputEle)
165
+ return;
166
+ this.inputEle.addEventListener('keydown', this.onKeyDown, false);
167
+ }
168
+ });
169
+ // 模拟 antd select 按下 上下箭头 键时滚动列表
170
+ Object.defineProperty(this, "onKeyDown", {
171
+ enumerable: true,
172
+ configurable: true,
173
+ writable: true,
174
+ value: (e) => {
175
+ const { keyCode } = e || {};
176
+ setTimeout(() => {
177
+ const activeItem = document.querySelector(`.${this.dropdownClassName} .ant-select-dropdown-menu-item-active`);
178
+ if (!activeItem)
179
+ return;
180
+ const { offsetTop } = activeItem;
181
+ const isUp = ARROW_CODE[keyCode] === 'up';
182
+ const isDown = ARROW_CODE[keyCode] === 'down';
183
+ // 在所有列表第一行按上键
184
+ if (offsetTop - this.prevTop > DROPDOWN_HEIGHT && isUp && this.scrollEle) {
185
+ this.scrollEle.scrollTo(0, this.allHeight - DROPDOWN_HEIGHT);
186
+ this.prevTop = this.allHeight;
187
+ return;
188
+ }
189
+ // 在所有列表中最后一行按下键
190
+ if (this.prevTop > offsetTop + DROPDOWN_HEIGHT && isDown && this.scrollEle) {
191
+ this.scrollEle.scrollTo(0, 0);
192
+ this.prevTop = 0;
193
+ return;
194
+ }
195
+ this.prevTop = offsetTop;
196
+ // 向下滚动到下拉框最后一行时,向下滚动一行的高度
197
+ if (offsetTop > this.scrollEle.scrollTop + DROPDOWN_HEIGHT - this.ITEM_HEIGHT + 10 &&
198
+ isDown) {
199
+ this.scrollEle.scrollTo(0, this.scrollTop + this.ITEM_HEIGHT);
200
+ return;
201
+ }
202
+ // 向上滚动到下拉框第一一行时,向上滚动一行的高度
203
+ if (offsetTop < this.scrollEle.scrollTop && isUp) {
204
+ this.scrollEle.scrollTo(0, this.scrollTop - this.ITEM_HEIGHT);
205
+ }
206
+ }, 100);
207
+ }
208
+ });
209
+ Object.defineProperty(this, "onScroll", {
210
+ enumerable: true,
211
+ configurable: true,
212
+ writable: true,
213
+ value: () => this.throttleByHeight(this.onScrollReal)
214
+ });
215
+ Object.defineProperty(this, "onScrollReal", {
216
+ enumerable: true,
217
+ configurable: true,
218
+ writable: true,
219
+ value: () => {
220
+ this.allList = this.getUseChildrenList();
221
+ const { startIndex, endIndex } = this.getStartAndEndIndex();
222
+ this.prevScrollTop = this.scrollTop;
223
+ // 重新渲染列表组件 Wrap
224
+ const allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
225
+ this.wrap.reactList(allHeight, startIndex, endIndex);
226
+ }
227
+ });
228
+ Object.defineProperty(this, "throttleByHeight", {
229
+ enumerable: true,
230
+ configurable: true,
231
+ writable: true,
232
+ value: () => {
233
+ this.scrollTop = this.scrollEle.scrollTop;
234
+ // 滚动的高度
235
+ let delta = this.prevScrollTop - this.scrollTop;
236
+ delta = delta < 0 ? 0 - delta : delta;
237
+ delta > this.reactDelta && this.onScrollReal();
238
+ }
239
+ });
240
+ // 列表可展示所有 children
241
+ Object.defineProperty(this, "getUseChildrenList", {
242
+ enumerable: true,
243
+ configurable: true,
244
+ writable: true,
245
+ value: () => this.state.filterChildren || this.state.children
246
+ });
247
+ Object.defineProperty(this, "getStartAndEndIndex", {
248
+ enumerable: true,
249
+ configurable: true,
250
+ writable: true,
251
+ value: () => {
252
+ // 滚动后显示在列表可视区中的第一个 item 的 index
253
+ const showIndex = Number((this.scrollTop / this.ITEM_HEIGHT).toFixed(0));
254
+ const startIndex = showIndex - ITEM_ELEMENT_NUMBER < 0 ? 0 : showIndex - ITEM_ELEMENT_NUMBER / 2;
255
+ const endIndex = showIndex + ITEM_ELEMENT_NUMBER;
256
+ return { startIndex, endIndex };
257
+ }
258
+ });
259
+ // 须使用 setTimeout 确保在 dom 加载完成之后添加事件
260
+ Object.defineProperty(this, "setSuperDrowDownMenu", {
261
+ enumerable: true,
262
+ configurable: true,
263
+ writable: true,
264
+ value: (visible) => {
265
+ if (!visible)
266
+ return;
267
+ this.allList = this.getUseChildrenList();
268
+ if (!this.eventTimer || !this.scrollEle) {
269
+ this.eventTimer = setTimeout(() => this.addEvent(), 0);
270
+ }
271
+ else {
272
+ const allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
273
+ // 下拉列表单独重新渲染
274
+ const { startIndex, endIndex } = this.getStartAndEndIndex();
275
+ setTimeout(() => {
276
+ this.wrap && this.wrap.reactList(allHeight, startIndex, endIndex);
277
+ }, 0);
450
278
  }
451
- _this.scrollEle && _this.scrollEle.scrollTo(0, targetScrollTop);
452
- }, 100);
453
- return {
454
- v: void 0
455
- };
456
- }();
457
- if (_typeof(_ret) === "object") return _ret.v;
458
- }
459
- }
460
- }
461
- });
462
- Object.defineProperty(_assertThisInitialized(_this), "removeEvent", {
463
- enumerable: true,
464
- configurable: true,
465
- writable: true,
466
- value: function value() {
467
- if (!_this.scrollEle) return;
468
- _this.scrollEle.removeEventListener('mousedown', _this.preventEvent, false);
469
- _this.scrollEle.removeEventListener('scroll', _this.onScroll, false);
470
- if (!_this.inputEle) return;
471
- _this.inputEle.removeEventListener('keydown', _this.onKeyDown, false);
472
- }
473
- });
474
- var mode = props.mode,
475
- defaultValue = props.defaultValue,
476
- value = props.value,
477
- optionHeight = props.optionHeight,
478
- arr = props.children;
479
- _this.isMultiple = ['tags', 'multiple'].includes(mode);
480
- var children = _this.turnChildren(arr);
481
- // 设置默认 value
482
- var defaultV = _this.isMultiple ? [] : '';
483
- defaultV = value || defaultValue || defaultV;
484
- _this.state = {
485
- children: children || [],
486
- filterChildren: null,
487
- value: defaultV,
488
- maxWidth: null,
489
- selectWidth: null
490
- };
491
- // 下拉菜单项行高
492
- _this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
493
- // 可视区 dom 高度
494
- _this.visibleDomHeight = _this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
495
- // 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
496
- _this.reactDelta = _this.visibleDomHeight / 3;
497
- // 是否拖动滚动条快速滚动状态
498
- _this.isStopReact = false;
499
- // 上一次滚动的 scrollTop 值
500
- _this.prevScrollTop = 0;
501
- // 上一次按下方向键时 scrollTop 值
502
- _this.prevTop = 0;
503
- _this.scrollTop = 0;
504
- // className
505
- _this.dropdownClassName = "dc".concat(+new Date());
506
- _this.id = "sid".concat(+new Date());
507
- return _this;
508
- }
509
- _createClass(SuperSelect, [{
510
- key: "componentDidMount",
511
- value: function componentDidMount() {
512
- var _this2 = this;
513
- // defaultOpens=true 时添加滚动事件
514
- setTimeout(function () {
515
- _this2.addEvent();
516
- }, 500);
517
- var arr = this.props.children;
518
- var children = this.turnChildren(arr);
519
- // if (children && children.length > 0) {
520
- this.formulaWidth();
521
- // }
522
- }
523
- }, {
524
- key: "componentDidUpdate",
525
- value: function componentDidUpdate(prevProps) {
526
- var _this3 = this;
527
- var _this$props4 = this.props,
528
- mode = _this$props4.mode,
529
- defaultValue = _this$props4.defaultValue,
530
- value = _this$props4.value,
531
- children = _this$props4.children;
532
- var arr = this.turnChildren(children);
533
- if (prevProps.children !== children) {
534
- this.isMultiple = ['tags', 'multiple'].includes(mode);
535
- this.setState({
536
- children: arr || [],
537
- filterChildren: null
538
- }, function () {
539
- if (arr && arr.length > 0) {
540
- _this3.formulaWidth();
541
- if (!_this3.inputEle) {
542
- _this3.removeEvent();
543
- _this3.addEvent();
544
279
  }
545
- }
546
280
  });
547
- }
548
- if (prevProps.value !== value) {
549
- // 更新时设置默认 value
550
- var defaultV = this.isMultiple ? [] : '';
551
- defaultV = value || defaultValue || defaultV;
552
- this.setState({
553
- value: defaultV
281
+ Object.defineProperty(this, "onDropdownVisibleChange", {
282
+ enumerable: true,
283
+ configurable: true,
284
+ writable: true,
285
+ value: (visible) => {
286
+ const { onDropdownVisibleChange } = this.props;
287
+ onDropdownVisibleChange && onDropdownVisibleChange(visible);
288
+ const { value, children } = this.state;
289
+ // 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
290
+ if (!visible) {
291
+ // 定时器确保关闭后再设置 filterChildren,防止列表刷新闪烁
292
+ setTimeout(() => {
293
+ this.setState({ filterChildren: null });
294
+ this.setDefaultScrollTop(value);
295
+ }, 100);
296
+ // this.removeEvent();
297
+ }
298
+ else {
299
+ // this.addEvent();
300
+ if (value) {
301
+ // 如果已有 value, 设置默认滚动位置
302
+ this.setDefaultScrollTop();
303
+ // 设置下拉列表显示数据
304
+ this.setSuperDrowDownMenu(visible);
305
+ }
306
+ else if (!value && value !== 0 && children && children.length > 0) {
307
+ // 无数据时,下拉回归至第一个
308
+ const val = children[0].props.value;
309
+ this.setDefaultScrollTop(val);
310
+ }
311
+ }
312
+ }
313
+ });
314
+ Object.defineProperty(this, "onDeselect", {
315
+ enumerable: true,
316
+ configurable: true,
317
+ writable: true,
318
+ value: (value) => {
319
+ const { onDeselect } = this.props;
320
+ onDeselect && onDeselect(value);
321
+ }
322
+ });
323
+ // 在搜索重新计算下拉滚动条高度
324
+ Object.defineProperty(this, "onChange", {
325
+ enumerable: true,
326
+ configurable: true,
327
+ writable: true,
328
+ value: (value, opt) => {
329
+ const { showSearch, onChange, autoClearSearchValue, maxCount, mode } = this.props;
330
+ if (showSearch || this.isMultiple) {
331
+ // 搜索模式下选择后是否需要重置搜索状态
332
+ if (autoClearSearchValue !== false) {
333
+ this.setState({ filterChildren: null }, () => {
334
+ // 搜索成功后重新设置列表的总高度
335
+ this.setSuperDrowDownMenu(true);
336
+ });
337
+ }
338
+ }
339
+ if (mode === 'multiple') {
340
+ if (value.length <= maxCount) {
341
+ this.setState({ value });
342
+ }
343
+ }
344
+ else {
345
+ this.setState({ value });
346
+ }
347
+ onChange && onChange(value, opt);
348
+ if (mode !== 'multiple') {
349
+ this.select && this.select.blur();
350
+ }
351
+ }
352
+ });
353
+ Object.defineProperty(this, "onSearch", {
354
+ enumerable: true,
355
+ configurable: true,
356
+ writable: true,
357
+ value: (v) => {
358
+ const { showSearch, onSearch, filterOption, children: arr } = this.props;
359
+ let children = this.turnChildren(arr);
360
+ if (showSearch && filterOption !== false) {
361
+ // 须根据 filterOption(如有该自定义函数)手动 filter 搜索匹配的列表
362
+ let filterChildren = null;
363
+ if (typeof filterOption === 'function') {
364
+ filterChildren = children.filter((item) => filterOption(v, item));
365
+ }
366
+ else if (filterOption === undefined) {
367
+ filterChildren = children.filter((item) => this.filterOption(v, item));
368
+ }
369
+ // 搜索框有值,去除disabled=true的children
370
+ let newFilterChild = [];
371
+ filterChildren &&
372
+ filterChildren.forEach((item, index) => {
373
+ if (!item.props.disabled) {
374
+ newFilterChild.push(item);
375
+ }
376
+ });
377
+ filterChildren = newFilterChild;
378
+ // 设置下拉列表显示数据
379
+ this.setState({ filterChildren: v === '' ? null : filterChildren }, () => {
380
+ setTimeout(() => {
381
+ // 搜索后需要重置滚动位置到0,防止上次 scrollTop 位置无数据
382
+ if (filterChildren && this.scrollEle) {
383
+ this.scrollTop = 0;
384
+ this.scrollEle.scrollTo(0, 0);
385
+ }
386
+ // 搜索成功后需要重新设置列表的总高度
387
+ this.setSuperDrowDownMenu(true);
388
+ }, 0);
389
+ });
390
+ }
391
+ onSearch && onSearch(v);
392
+ }
554
393
  });
555
- }
394
+ Object.defineProperty(this, "filterOption", {
395
+ enumerable: true,
396
+ configurable: true,
397
+ writable: true,
398
+ value: (v, option) => {
399
+ // 自定义过滤对应的 option 属性配置
400
+ const filterProps = this.props.optionFilterProp || 'value';
401
+ return `${option.props[filterProps]}`.indexOf(v) >= 0;
402
+ }
403
+ });
404
+ Object.defineProperty(this, "setDefaultScrollTop", {
405
+ enumerable: true,
406
+ configurable: true,
407
+ writable: true,
408
+ value: (data) => {
409
+ const { value } = this.state;
410
+ const { children: arr } = this.props;
411
+ const children = this.turnChildren(arr);
412
+ let val = data || data === 0 ? data : value;
413
+ for (let i = 0; i < children.length; i++) {
414
+ const item = children[i];
415
+ const itemValue = item.props.value;
416
+ if (itemValue === val || (Array.isArray(val) && val.includes(itemValue))) {
417
+ const targetScrollTop = i * this.ITEM_HEIGHT;
418
+ setTimeout(() => {
419
+ if (!this.scrollEle) {
420
+ this.addEvent();
421
+ }
422
+ this.scrollEle && this.scrollEle.scrollTo(0, targetScrollTop);
423
+ }, 100);
424
+ return;
425
+ }
426
+ }
427
+ }
428
+ });
429
+ Object.defineProperty(this, "removeEvent", {
430
+ enumerable: true,
431
+ configurable: true,
432
+ writable: true,
433
+ value: () => {
434
+ if (!this.scrollEle)
435
+ return;
436
+ this.scrollEle.removeEventListener('mousedown', this.preventEvent, false);
437
+ this.scrollEle.removeEventListener('scroll', this.onScroll, false);
438
+ if (!this.inputEle)
439
+ return;
440
+ this.inputEle.removeEventListener('keydown', this.onKeyDown, false);
441
+ }
442
+ });
443
+ const { mode, defaultValue, value, optionHeight, children: arr } = props;
444
+ this.isMultiple = ['tags', 'multiple'].includes(mode);
445
+ const children = this.turnChildren(arr);
446
+ // 设置默认 value
447
+ let defaultV = this.isMultiple ? [] : '';
448
+ defaultV = value || defaultValue || defaultV;
449
+ this.state = {
450
+ children: children || [],
451
+ filterChildren: null,
452
+ value: defaultV,
453
+ maxWidth: null,
454
+ selectWidth: null,
455
+ };
456
+ // 下拉菜单项行高
457
+ this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
458
+ // 可视区 dom 高度
459
+ this.visibleDomHeight = this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
460
+ // 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
461
+ this.reactDelta = this.visibleDomHeight / 3;
462
+ // 是否拖动滚动条快速滚动状态
463
+ this.isStopReact = false;
464
+ // 上一次滚动的 scrollTop 值
465
+ this.prevScrollTop = 0;
466
+ // 上一次按下方向键时 scrollTop 值
467
+ this.prevTop = 0;
468
+ this.scrollTop = 0;
469
+ // className
470
+ this.dropdownClassName = `dc${+new Date()}`;
471
+ this.id = `sid${+new Date()}`;
556
472
  }
557
- }, {
558
- key: "componentWillUnmount",
559
- value: function componentWillUnmount() {
560
- this.removeEvent();
473
+ componentDidMount() {
474
+ // defaultOpens=true 时添加滚动事件
475
+ setTimeout(() => {
476
+ this.addEvent();
477
+ }, 500);
478
+ const { children: arr } = this.props;
479
+ const children = this.turnChildren(arr);
480
+ // if (children && children.length > 0) {
481
+ this.formulaWidth();
482
+ // }
561
483
  }
562
- }, {
563
- key: "render",
564
- value: function render() {
565
- var _this4 = this;
566
- var _this$state2 = this.state,
567
- maxWidth = _this$state2.maxWidth,
568
- selectWidth = _this$state2.selectWidth;
569
- var _a = this.props,
570
- dropdownStyle = _a.dropdownStyle,
571
- optionLabelProp = _a.optionLabelProp,
572
- dropdownClassName = _a.dropdownClassName,
573
- props = __rest(_a, ["dropdownStyle", "optionLabelProp", "dropdownClassName"]);
574
- this.allList = this.getUseChildrenList();
575
- this.allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
576
- var _this$getStartAndEndI3 = this.getStartAndEndIndex(),
577
- startIndex = _this$getStartAndEndI3.startIndex,
578
- endIndex = _this$getStartAndEndI3.endIndex;
579
- var dynamicWidth = maxWidth;
580
- if (this.allList.length === 0 || maxWidth < selectWidth) {
581
- dynamicWidth = selectWidth;
582
- }
583
- dropdownStyle = Object.assign(Object.assign({
584
- maxHeight: "".concat(DROPDOWN_HEIGHT, "px")
585
- }, dropdownStyle), {
586
- overflow: 'auto',
587
- position: 'relative',
588
- maxWidth: dynamicWidth
589
- });
590
- var value = this.state.value;
591
- // 判断处于 antd Form 中时不自动设置 value
592
- var _props = Object.assign({}, props);
593
- // 先删除 value,再手动赋值,防止空 value 影响 placeholder
594
- delete _props.value;
595
- // value 为空字符会隐藏 placeholder,改为 undefined
596
- if (typeof value === 'string' && !value) {
597
- _props.value = undefined;
598
- } else {
599
- _props.value = value;
600
- }
601
- optionLabelProp = optionLabelProp || 'children';
602
- return _react["default"].createElement(_select["default"], Object.assign({}, _props, {
603
- id: this.id,
604
- onSearch: this.onSearch,
605
- onChange: this.onChange,
606
- dropdownClassName: "".concat(this.dropdownClassName, " ").concat(dropdownClassName || ''),
607
- optionLabelProp: optionLabelProp,
608
- dropdownStyle: dropdownStyle,
609
- onDropdownVisibleChange: this.onDropdownVisibleChange,
610
- onDeselect: this.onDeselect,
611
- ref: function ref(ele) {
612
- return _this4.select = ele;
613
- },
614
- dropdownRender: function dropdownRender(menu, props) {
615
- if (_props.loading) {
616
- return _react["default"].createElement(_spin["default"], {
617
- size: "small",
618
- style: {
619
- marginLeft: 8
620
- }
484
+ componentDidUpdate(prevProps) {
485
+ const { mode, defaultValue, value, children } = this.props;
486
+ let arr = this.turnChildren(children);
487
+ if (prevProps.children !== children) {
488
+ this.isMultiple = ['tags', 'multiple'].includes(mode);
489
+ this.setState({
490
+ children: arr || [],
491
+ filterChildren: null,
492
+ }, () => {
493
+ if (arr && arr.length > 0) {
494
+ this.formulaWidth();
495
+ if (!this.inputEle) {
496
+ this.removeEvent();
497
+ this.addEvent();
498
+ }
499
+ }
621
500
  });
622
- }
623
- if (_this4.allList.length === 0) {
624
- return _react["default"].createElement("div", {
625
- style: {
626
- padding: '5px 12px'
627
- }
628
- }, _react["default"].createElement(_empty["default"], {
629
- image: _empty["default"].PRESENTED_IMAGE_SIMPLE
630
- }));
631
- }
632
- return _react["default"].createElement(_DropDownWrap["default"], Object.assign({}, {
633
- startIndex: startIndex,
634
- endIndex: endIndex,
635
- allHeight: _this4.allHeight,
636
- menu: menu,
637
- itemHeight: _this4.ITEM_HEIGHT
638
- }, {
639
- ref: function ref(ele) {
640
- _this4.wrap = ele;
641
- }
642
- }));
643
501
  }
644
- }), this.allList);
502
+ if (prevProps.value !== value) {
503
+ // 更新时设置默认 value
504
+ let defaultV = this.isMultiple ? [] : '';
505
+ defaultV = value || defaultValue || defaultV;
506
+ this.setState({ value: defaultV });
507
+ }
508
+ }
509
+ componentWillUnmount() {
510
+ this.removeEvent();
511
+ }
512
+ render() {
513
+ const { maxWidth, selectWidth } = this.state;
514
+ let _a = this.props, { dropdownStyle, optionLabelProp, dropdownClassName } = _a, props = __rest(_a, ["dropdownStyle", "optionLabelProp", "dropdownClassName"]);
515
+ this.allList = this.getUseChildrenList();
516
+ this.allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
517
+ const { startIndex, endIndex } = this.getStartAndEndIndex();
518
+ let dynamicWidth = maxWidth;
519
+ if (this.allList.length === 0 || maxWidth < selectWidth) {
520
+ dynamicWidth = selectWidth;
521
+ }
522
+ dropdownStyle = Object.assign(Object.assign({ maxHeight: `${DROPDOWN_HEIGHT}px` }, dropdownStyle), { overflow: 'auto', position: 'relative', maxWidth: dynamicWidth });
523
+ const { value } = this.state;
524
+ // 判断处于 antd Form 中时不自动设置 value
525
+ const _props = Object.assign({}, props);
526
+ // 先删除 value,再手动赋值,防止空 value 影响 placeholder
527
+ delete _props.value;
528
+ // value 为空字符会隐藏 placeholder,改为 undefined
529
+ if (typeof value === 'string' && !value) {
530
+ _props.value = undefined;
531
+ }
532
+ else {
533
+ _props.value = value;
534
+ }
535
+ optionLabelProp = optionLabelProp || 'children';
536
+ return (react_1.default.createElement(select_1.default, Object.assign({}, _props, { id: this.id, placeholder: (0, utils_1.capitalizeFirstLetter)(props === null || props === void 0 ? void 0 : props.placeholder, props === null || props === void 0 ? void 0 : props.capitalize), onSearch: this.onSearch, onChange: this.onChange, dropdownClassName: `${this.dropdownClassName} ${dropdownClassName || ''}`, optionLabelProp: optionLabelProp, dropdownStyle: dropdownStyle, onDropdownVisibleChange: this.onDropdownVisibleChange, onDeselect: this.onDeselect, ref: (ele) => (this.select = ele), dropdownRender: (menu, props) => {
537
+ if (_props.loading) {
538
+ return (react_1.default.createElement(spin_1.default, { size: "small", style: { marginLeft: 8 } }));
539
+ }
540
+ if (this.allList.length === 0) {
541
+ return (react_1.default.createElement("div", { style: { padding: '5px 12px' } },
542
+ react_1.default.createElement(empty_1.default, { image: empty_1.default.PRESENTED_IMAGE_SIMPLE })));
543
+ }
544
+ return (react_1.default.createElement(DropDownWrap_1.default, Object.assign({}, {
545
+ startIndex,
546
+ endIndex,
547
+ allHeight: this.allHeight,
548
+ menu,
549
+ itemHeight: this.ITEM_HEIGHT,
550
+ }, { ref: (ele) => {
551
+ this.wrap = ele;
552
+ } })));
553
+ } }), this.allList));
645
554
  }
646
- }]);
647
- return SuperSelect;
648
- }(_react.PureComponent);
555
+ }
649
556
  SuperSelect.Option = Option;
650
- var _default = SuperSelect;
651
- exports["default"] = _default;
557
+ exports.default = SuperSelect;
558
+ //# sourceMappingURL=index.js.map