@douyinfe/semi-foundation 2.36.0-alpha.0 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (477) hide show
  1. package/calendar/calendar.scss +1 -1
  2. package/calendar/foundation.ts +2 -1
  3. package/datePicker/_utils/getYears.ts +8 -4
  4. package/datePicker/foundation.ts +1 -1
  5. package/datePicker/monthsGridFoundation.ts +2 -1
  6. package/datePicker/yearAndMonthFoundation.ts +3 -1
  7. package/lib/cjs/anchor/constants.js +0 -2
  8. package/lib/cjs/anchor/foundation.js +10 -73
  9. package/lib/cjs/anchor/linkFoundation.js +4 -16
  10. package/lib/cjs/autoComplete/constants.js +0 -3
  11. package/lib/cjs/autoComplete/foundation.d.ts +1 -1
  12. package/lib/cjs/autoComplete/foundation.js +25 -139
  13. package/lib/cjs/autoComplete/optionFoundation.js +4 -14
  14. package/lib/cjs/avatar/constants.js +0 -2
  15. package/lib/cjs/avatar/foundation.js +0 -17
  16. package/lib/cjs/backtop/constants.js +0 -2
  17. package/lib/cjs/backtop/foundation.d.ts +2 -2
  18. package/lib/cjs/backtop/foundation.js +0 -21
  19. package/lib/cjs/badge/constants.js +0 -2
  20. package/lib/cjs/banner/constants.js +0 -2
  21. package/lib/cjs/banner/foundation.js +0 -7
  22. package/lib/cjs/base/constants.js +2 -4
  23. package/lib/cjs/base/foundation.d.ts +1 -1
  24. package/lib/cjs/base/foundation.js +12 -46
  25. package/lib/cjs/base/index.js +0 -3
  26. package/lib/cjs/breadcrumb/constants.js +0 -2
  27. package/lib/cjs/breadcrumb/foundation.js +1 -12
  28. package/lib/cjs/breadcrumb/itemFoundation.js +0 -7
  29. package/lib/cjs/button/constants.js +0 -2
  30. package/lib/cjs/calendar/calendar.css +2 -2
  31. package/lib/cjs/calendar/calendar.scss +1 -1
  32. package/lib/cjs/calendar/constants.js +0 -2
  33. package/lib/cjs/calendar/eventUtil.d.ts +1 -1
  34. package/lib/cjs/calendar/eventUtil.js +2 -74
  35. package/lib/cjs/calendar/foundation.d.ts +2 -2
  36. package/lib/cjs/calendar/foundation.js +28 -123
  37. package/lib/cjs/card/constants.js +0 -2
  38. package/lib/cjs/carousel/constants.js +0 -2
  39. package/lib/cjs/carousel/foundation.js +2 -52
  40. package/lib/cjs/cascader/constants.js +0 -3
  41. package/lib/cjs/cascader/foundation.d.ts +4 -4
  42. package/lib/cjs/cascader/foundation.js +28 -242
  43. package/lib/cjs/cascader/util.js +6 -24
  44. package/lib/cjs/checkbox/checkboxFoundation.js +2 -38
  45. package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -23
  46. package/lib/cjs/checkbox/constants.js +0 -2
  47. package/lib/cjs/collapse/constants.js +0 -2
  48. package/lib/cjs/collapse/foundation.d.ts +1 -1
  49. package/lib/cjs/collapse/foundation.js +2 -13
  50. package/lib/cjs/collapsible/constants.js +0 -2
  51. package/lib/cjs/collapsible/foundation.js +0 -9
  52. package/lib/cjs/datePicker/_utils/formatter.js +4 -10
  53. package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +1 -1
  54. package/lib/cjs/datePicker/_utils/getDayOfWeek.js +0 -4
  55. package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +0 -5
  56. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
  57. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +0 -15
  58. package/lib/cjs/datePicker/_utils/getFullDateOffset.js +0 -7
  59. package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +0 -5
  60. package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -6
  61. package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +1 -1
  62. package/lib/cjs/datePicker/_utils/getMonthTable.js +3 -14
  63. package/lib/cjs/datePicker/_utils/getMonthsInYear.js +0 -2
  64. package/lib/cjs/datePicker/_utils/getYears.d.ts +1 -1
  65. package/lib/cjs/datePicker/_utils/getYears.js +9 -7
  66. package/lib/cjs/datePicker/_utils/index.js +0 -13
  67. package/lib/cjs/datePicker/_utils/isAfter.js +0 -4
  68. package/lib/cjs/datePicker/_utils/isBefore.js +0 -4
  69. package/lib/cjs/datePicker/_utils/isBetween.js +0 -4
  70. package/lib/cjs/datePicker/_utils/isDate.js +0 -1
  71. package/lib/cjs/datePicker/_utils/isSameDay.js +0 -4
  72. package/lib/cjs/datePicker/_utils/isTimestamp.js +0 -4
  73. package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +0 -4
  74. package/lib/cjs/datePicker/_utils/isValidDate.js +0 -1
  75. package/lib/cjs/datePicker/_utils/isValidTimeZone.js +0 -1
  76. package/lib/cjs/datePicker/_utils/isWithinInterval.js +0 -4
  77. package/lib/cjs/datePicker/_utils/parser.js +0 -10
  78. package/lib/cjs/datePicker/constants.js +0 -3
  79. package/lib/cjs/datePicker/foundation.d.ts +25 -25
  80. package/lib/cjs/datePicker/foundation.js +22 -333
  81. package/lib/cjs/datePicker/inputFoundation.d.ts +3 -3
  82. package/lib/cjs/datePicker/inputFoundation.js +5 -86
  83. package/lib/cjs/datePicker/monthFoundation.d.ts +1 -1
  84. package/lib/cjs/datePicker/monthFoundation.js +3 -28
  85. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +5 -4
  86. package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
  87. package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +3 -1
  88. package/lib/cjs/datePicker/yearAndMonthFoundation.js +12 -38
  89. package/lib/cjs/descriptions/constants.js +0 -2
  90. package/lib/cjs/divider/constants.js +0 -2
  91. package/lib/cjs/dropdown/constants.js +0 -3
  92. package/lib/cjs/dropdown/foundation.js +4 -23
  93. package/lib/cjs/dropdown/menuFoundation.js +8 -27
  94. package/lib/cjs/empty/constants.js +0 -2
  95. package/lib/cjs/form/constants.js +0 -2
  96. package/lib/cjs/form/foundation.js +75 -206
  97. package/lib/cjs/form/interface.d.ts +5 -5
  98. package/lib/cjs/form/utils.js +47 -77
  99. package/lib/cjs/grid/constants.js +0 -2
  100. package/lib/cjs/highlight/constants.js +0 -2
  101. package/lib/cjs/icons/constants.js +0 -2
  102. package/lib/cjs/image/constants.js +0 -2
  103. package/lib/cjs/image/imageFoundation.js +4 -18
  104. package/lib/cjs/image/previewFooterFoundation.js +0 -13
  105. package/lib/cjs/image/previewFoundation.js +0 -11
  106. package/lib/cjs/image/previewImageFoundation.js +6 -80
  107. package/lib/cjs/image/previewInnerFoundation.js +12 -77
  108. package/lib/cjs/image/utils.js +0 -14
  109. package/lib/cjs/input/constants.js +0 -2
  110. package/lib/cjs/input/foundation.js +17 -101
  111. package/lib/cjs/input/textareaFoundation.js +20 -85
  112. package/lib/cjs/input/util/calculateNodeHeight.js +6 -18
  113. package/lib/cjs/input/util/getSizingData.js +7 -11
  114. package/lib/cjs/inputNumber/constants.js +0 -2
  115. package/lib/cjs/inputNumber/foundation.js +29 -192
  116. package/lib/cjs/layout/constants.js +0 -2
  117. package/lib/cjs/list/constants.js +0 -2
  118. package/lib/cjs/modal/constants.js +0 -2
  119. package/lib/cjs/modal/modalContentFoundation.js +0 -20
  120. package/lib/cjs/modal/modalFoundation.d.ts +2 -2
  121. package/lib/cjs/modal/modalFoundation.js +2 -22
  122. package/lib/cjs/navigation/NavItem.js +0 -10
  123. package/lib/cjs/navigation/constants.js +0 -3
  124. package/lib/cjs/navigation/foundation.js +3 -67
  125. package/lib/cjs/navigation/itemFoundation.d.ts +0 -2
  126. package/lib/cjs/navigation/itemFoundation.js +3 -21
  127. package/lib/cjs/navigation/navigation.css +7 -77
  128. package/lib/cjs/navigation/navigation.scss +7 -119
  129. package/lib/cjs/navigation/subNavFoundation.d.ts +0 -2
  130. package/lib/cjs/navigation/subNavFoundation.js +4 -40
  131. package/lib/cjs/notification/constants.js +0 -3
  132. package/lib/cjs/notification/notificationFoundation.d.ts +3 -3
  133. package/lib/cjs/notification/notificationFoundation.js +0 -16
  134. package/lib/cjs/notification/notificationListFoundation.js +7 -17
  135. package/lib/cjs/overflowList/constants.js +0 -2
  136. package/lib/cjs/overflowList/foundation.js +11 -41
  137. package/lib/cjs/pagination/constants.js +0 -2
  138. package/lib/cjs/pagination/foundation.d.ts +3 -3
  139. package/lib/cjs/pagination/foundation.js +21 -90
  140. package/lib/cjs/popconfirm/constants.js +0 -2
  141. package/lib/cjs/popconfirm/popconfirmFoundation.js +1 -21
  142. package/lib/cjs/popover/constants.js +0 -3
  143. package/lib/cjs/progress/constants.js +0 -2
  144. package/lib/cjs/progress/generates.d.ts +2 -2
  145. package/lib/cjs/progress/generates.js +19 -60
  146. package/lib/cjs/radio/constants.js +0 -2
  147. package/lib/cjs/radio/radioFoundation.js +0 -14
  148. package/lib/cjs/radio/radioGroupFoundation.js +4 -23
  149. package/lib/cjs/radio/radioInnerFoundation.js +2 -19
  150. package/lib/cjs/rating/constants.js +0 -2
  151. package/lib/cjs/rating/foundation.js +11 -61
  152. package/lib/cjs/scrollList/constants.js +0 -2
  153. package/lib/cjs/scrollList/foundation.js +0 -4
  154. package/lib/cjs/scrollList/itemFoundation.js +8 -61
  155. package/lib/cjs/scrollList/scrollTo.js +2 -5
  156. package/lib/cjs/select/constants.js +0 -3
  157. package/lib/cjs/select/foundation.d.ts +2 -2
  158. package/lib/cjs/select/foundation.js +122 -425
  159. package/lib/cjs/select/optionFoundation.js +4 -14
  160. package/lib/cjs/sideSheet/constants.js +0 -2
  161. package/lib/cjs/sideSheet/sideSheetFoundation.js +0 -18
  162. package/lib/cjs/skeleton/constants.js +0 -2
  163. package/lib/cjs/slider/constants.js +0 -2
  164. package/lib/cjs/slider/foundation.d.ts +1 -1
  165. package/lib/cjs/slider/foundation.js +25 -204
  166. package/lib/cjs/space/constants.js +0 -2
  167. package/lib/cjs/spin/constants.js +0 -2
  168. package/lib/cjs/spin/foundation.js +3 -13
  169. package/lib/cjs/steps/bacisSteps.scss +238 -287
  170. package/lib/cjs/steps/constants.js +0 -2
  171. package/lib/cjs/steps/fillSteps.scss +142 -153
  172. package/lib/cjs/steps/navSteps.scss +40 -61
  173. package/lib/cjs/steps/steps.css +17 -381
  174. package/lib/cjs/switch/constants.js +0 -2
  175. package/lib/cjs/switch/foundation.js +2 -18
  176. package/lib/cjs/table/bodyFoundation.js +2 -34
  177. package/lib/cjs/table/cellFoundation.js +0 -5
  178. package/lib/cjs/table/constants.js +7 -8
  179. package/lib/cjs/table/foundation.d.ts +17 -14
  180. package/lib/cjs/table/foundation.js +72 -302
  181. package/lib/cjs/table/table.css +6 -0
  182. package/lib/cjs/table/table.scss +12 -0
  183. package/lib/cjs/table/tableRowFoundation.js +0 -11
  184. package/lib/cjs/table/tableSelectionCellFoundation.js +0 -6
  185. package/lib/cjs/table/utils.d.ts +2 -2
  186. package/lib/cjs/table/utils.js +5 -118
  187. package/lib/cjs/tabs/constants.js +0 -2
  188. package/lib/cjs/tabs/foundation.js +2 -40
  189. package/lib/cjs/tabs/tabs.css +14 -14
  190. package/lib/cjs/tabs/tabs.scss +16 -14
  191. package/lib/cjs/tag/constants.js +1 -2
  192. package/lib/cjs/tagInput/constants.js +0 -2
  193. package/lib/cjs/tagInput/foundation.d.ts +4 -4
  194. package/lib/cjs/tagInput/foundation.js +4 -94
  195. package/lib/cjs/tagInput/utils/getSplitedArray.js +0 -11
  196. package/lib/cjs/timePicker/ComboxFoundation.js +4 -39
  197. package/lib/cjs/timePicker/constants.js +0 -3
  198. package/lib/cjs/timePicker/foundation.d.ts +2 -2
  199. package/lib/cjs/timePicker/foundation.js +6 -102
  200. package/lib/cjs/timePicker/inputFoundation.js +6 -25
  201. package/lib/cjs/timePicker/utils/index.js +6 -45
  202. package/lib/cjs/timePicker/utils/localeDate.js +0 -10
  203. package/lib/cjs/timeline/constants.js +0 -2
  204. package/lib/cjs/timeline/timeline.css +0 -36
  205. package/lib/cjs/timeline/timeline.scss +46 -96
  206. package/lib/cjs/toast/constants.js +0 -3
  207. package/lib/cjs/toast/toastFoundation.d.ts +3 -3
  208. package/lib/cjs/toast/toastFoundation.js +0 -14
  209. package/lib/cjs/toast/toastListFoundation.js +4 -22
  210. package/lib/cjs/tooltip/constants.js +0 -2
  211. package/lib/cjs/tooltip/foundation.d.ts +1 -1
  212. package/lib/cjs/tooltip/foundation.js +63 -291
  213. package/lib/cjs/transfer/constants.js +0 -2
  214. package/lib/cjs/transfer/foundation.d.ts +1 -1
  215. package/lib/cjs/transfer/foundation.js +4 -68
  216. package/lib/cjs/transfer/transferUtils.js +5 -27
  217. package/lib/cjs/tree/constants.js +0 -2
  218. package/lib/cjs/tree/foundation.d.ts +3 -3
  219. package/lib/cjs/tree/foundation.js +34 -150
  220. package/lib/cjs/tree/treeUtil.js +54 -173
  221. package/lib/cjs/treeSelect/constants.js +0 -2
  222. package/lib/cjs/treeSelect/foundation.d.ts +7 -7
  223. package/lib/cjs/treeSelect/foundation.js +18 -192
  224. package/lib/cjs/typography/constants.d.ts +1 -0
  225. package/lib/cjs/typography/constants.js +1 -2
  226. package/lib/cjs/typography/formatNumeral.d.ts +3 -3
  227. package/lib/cjs/typography/formatNumeral.js +16 -32
  228. package/lib/cjs/typography/typography.css +120 -0
  229. package/lib/cjs/typography/typography.scss +131 -6
  230. package/lib/cjs/typography/variables.scss +48 -0
  231. package/lib/cjs/upload/constants.js +0 -2
  232. package/lib/cjs/upload/foundation.d.ts +5 -5
  233. package/lib/cjs/upload/foundation.js +36 -245
  234. package/lib/cjs/upload/utils.js +10 -29
  235. package/lib/cjs/utils/Event.js +2 -21
  236. package/lib/cjs/utils/FocusHandle.d.ts +1 -1
  237. package/lib/cjs/utils/FocusHandle.js +6 -35
  238. package/lib/cjs/utils/Logger.js +0 -21
  239. package/lib/cjs/utils/Store.js +0 -10
  240. package/lib/cjs/utils/a11y.js +18 -43
  241. package/lib/cjs/utils/array.d.ts +1 -1
  242. package/lib/cjs/utils/array.js +0 -7
  243. package/lib/cjs/utils/arrayMove.js +0 -1
  244. package/lib/cjs/utils/classnames.js +0 -12
  245. package/lib/cjs/utils/date-fns-extra.js +0 -35
  246. package/lib/cjs/utils/dom.d.ts +1 -1
  247. package/lib/cjs/utils/dom.js +0 -13
  248. package/lib/cjs/utils/function.js +0 -1
  249. package/lib/cjs/utils/getDataAttr.js +0 -2
  250. package/lib/cjs/utils/getHighlight.js +5 -26
  251. package/lib/cjs/utils/getMotionObjFromProps.js +0 -12
  252. package/lib/cjs/utils/index.js +0 -4
  253. package/lib/cjs/utils/isBothNaN.js +0 -2
  254. package/lib/cjs/utils/isElement.js +0 -1
  255. package/lib/cjs/utils/isEnterPress.js +0 -5
  256. package/lib/cjs/utils/isEscPress.js +0 -5
  257. package/lib/cjs/utils/isNullOrUndefined.js +0 -1
  258. package/lib/cjs/utils/isNumber.js +0 -1
  259. package/lib/cjs/utils/isObject.js +0 -1
  260. package/lib/cjs/utils/isPromise.js +0 -3
  261. package/lib/cjs/utils/isString.js +0 -1
  262. package/lib/cjs/utils/keyCode.js +0 -105
  263. package/lib/cjs/utils/log.js +0 -5
  264. package/lib/cjs/utils/number.js +0 -2
  265. package/lib/cjs/utils/object.d.ts +4 -4
  266. package/lib/cjs/utils/object.js +12 -34
  267. package/lib/cjs/utils/set.js +0 -8
  268. package/lib/cjs/utils/shallowEqualObjects.js +0 -7
  269. package/lib/cjs/utils/touchPolyfill.js +0 -7
  270. package/lib/cjs/utils/type.d.ts +3 -3
  271. package/lib/cjs/utils/uuid.js +2 -9
  272. package/lib/cjs/utils/warning.js +0 -1
  273. package/lib/es/anchor/foundation.js +10 -66
  274. package/lib/es/anchor/linkFoundation.js +4 -12
  275. package/lib/es/autoComplete/foundation.d.ts +1 -1
  276. package/lib/es/autoComplete/foundation.js +24 -132
  277. package/lib/es/autoComplete/optionFoundation.js +4 -10
  278. package/lib/es/avatar/foundation.js +0 -12
  279. package/lib/es/backtop/foundation.d.ts +2 -2
  280. package/lib/es/backtop/foundation.js +0 -16
  281. package/lib/es/banner/foundation.js +0 -3
  282. package/lib/es/base/constants.js +2 -2
  283. package/lib/es/base/foundation.d.ts +1 -1
  284. package/lib/es/base/foundation.js +11 -44
  285. package/lib/es/breadcrumb/foundation.js +0 -7
  286. package/lib/es/breadcrumb/itemFoundation.js +0 -3
  287. package/lib/es/calendar/calendar.css +2 -2
  288. package/lib/es/calendar/calendar.scss +1 -1
  289. package/lib/es/calendar/eventUtil.d.ts +1 -1
  290. package/lib/es/calendar/eventUtil.js +2 -36
  291. package/lib/es/calendar/foundation.d.ts +2 -2
  292. package/lib/es/calendar/foundation.js +28 -117
  293. package/lib/es/carousel/foundation.js +2 -47
  294. package/lib/es/cascader/constants.js +0 -1
  295. package/lib/es/cascader/foundation.d.ts +4 -4
  296. package/lib/es/cascader/foundation.js +30 -226
  297. package/lib/es/cascader/util.js +6 -15
  298. package/lib/es/checkbox/checkboxFoundation.js +2 -34
  299. package/lib/es/checkbox/checkboxGroupFoundation.js +2 -20
  300. package/lib/es/collapse/foundation.d.ts +1 -1
  301. package/lib/es/collapse/foundation.js +2 -9
  302. package/lib/es/collapsible/foundation.js +0 -7
  303. package/lib/es/datePicker/_utils/formatter.js +4 -8
  304. package/lib/es/datePicker/_utils/getDayOfWeek.d.ts +1 -1
  305. package/lib/es/datePicker/_utils/getDayOfWeek.js +0 -3
  306. package/lib/es/datePicker/_utils/getDefaultFormatToken.js +0 -2
  307. package/lib/es/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
  308. package/lib/es/datePicker/_utils/getDefaultPickerDate.js +0 -10
  309. package/lib/es/datePicker/_utils/getFullDateOffset.js +0 -3
  310. package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +0 -4
  311. package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -5
  312. package/lib/es/datePicker/_utils/getMonthTable.d.ts +1 -1
  313. package/lib/es/datePicker/_utils/getMonthTable.js +4 -14
  314. package/lib/es/datePicker/_utils/getMonthsInYear.js +0 -1
  315. package/lib/es/datePicker/_utils/getYears.d.ts +1 -1
  316. package/lib/es/datePicker/_utils/getYears.js +9 -6
  317. package/lib/es/datePicker/_utils/isBetween.js +0 -1
  318. package/lib/es/datePicker/_utils/parser.js +0 -8
  319. package/lib/es/datePicker/foundation.d.ts +25 -25
  320. package/lib/es/datePicker/foundation.js +22 -318
  321. package/lib/es/datePicker/inputFoundation.d.ts +3 -3
  322. package/lib/es/datePicker/inputFoundation.js +5 -74
  323. package/lib/es/datePicker/monthFoundation.d.ts +1 -1
  324. package/lib/es/datePicker/monthFoundation.js +4 -22
  325. package/lib/es/datePicker/monthsGridFoundation.d.ts +5 -4
  326. package/lib/es/datePicker/monthsGridFoundation.js +42 -222
  327. package/lib/es/datePicker/yearAndMonthFoundation.d.ts +3 -1
  328. package/lib/es/datePicker/yearAndMonthFoundation.js +12 -36
  329. package/lib/es/dropdown/foundation.js +4 -18
  330. package/lib/es/dropdown/menuFoundation.js +8 -22
  331. package/lib/es/form/foundation.js +74 -195
  332. package/lib/es/form/interface.d.ts +5 -5
  333. package/lib/es/form/utils.js +47 -70
  334. package/lib/es/image/imageFoundation.js +4 -13
  335. package/lib/es/image/previewFooterFoundation.js +0 -9
  336. package/lib/es/image/previewFoundation.js +0 -7
  337. package/lib/es/image/previewImageFoundation.js +6 -72
  338. package/lib/es/image/previewInnerFoundation.js +12 -70
  339. package/lib/es/image/utils.js +0 -6
  340. package/lib/es/input/foundation.js +17 -93
  341. package/lib/es/input/textareaFoundation.js +20 -75
  342. package/lib/es/input/util/calculateNodeHeight.js +6 -18
  343. package/lib/es/input/util/getSizingData.js +7 -11
  344. package/lib/es/inputNumber/foundation.js +28 -183
  345. package/lib/es/modal/modalContentFoundation.js +0 -15
  346. package/lib/es/modal/modalFoundation.d.ts +2 -2
  347. package/lib/es/modal/modalFoundation.js +2 -17
  348. package/lib/es/navigation/NavItem.js +0 -6
  349. package/lib/es/navigation/constants.js +1 -1
  350. package/lib/es/navigation/foundation.js +2 -60
  351. package/lib/es/navigation/itemFoundation.d.ts +0 -2
  352. package/lib/es/navigation/itemFoundation.js +3 -18
  353. package/lib/es/navigation/navigation.css +7 -77
  354. package/lib/es/navigation/navigation.scss +7 -119
  355. package/lib/es/navigation/subNavFoundation.d.ts +0 -2
  356. package/lib/es/navigation/subNavFoundation.js +4 -36
  357. package/lib/es/notification/constants.js +1 -1
  358. package/lib/es/notification/notificationFoundation.d.ts +3 -3
  359. package/lib/es/notification/notificationFoundation.js +0 -11
  360. package/lib/es/notification/notificationListFoundation.js +6 -13
  361. package/lib/es/overflowList/foundation.js +11 -37
  362. package/lib/es/pagination/foundation.d.ts +3 -3
  363. package/lib/es/pagination/foundation.js +20 -87
  364. package/lib/es/popconfirm/popconfirmFoundation.js +1 -16
  365. package/lib/es/progress/generates.d.ts +2 -2
  366. package/lib/es/progress/generates.js +19 -59
  367. package/lib/es/radio/radioFoundation.js +0 -9
  368. package/lib/es/radio/radioGroupFoundation.js +4 -19
  369. package/lib/es/radio/radioInnerFoundation.js +2 -15
  370. package/lib/es/rating/foundation.js +10 -54
  371. package/lib/es/scrollList/itemFoundation.js +8 -60
  372. package/lib/es/scrollList/scrollTo.js +2 -4
  373. package/lib/es/select/foundation.d.ts +2 -2
  374. package/lib/es/select/foundation.js +122 -411
  375. package/lib/es/select/optionFoundation.js +4 -10
  376. package/lib/es/sideSheet/sideSheetFoundation.js +0 -12
  377. package/lib/es/slider/foundation.d.ts +1 -1
  378. package/lib/es/slider/foundation.js +24 -197
  379. package/lib/es/spin/foundation.js +3 -11
  380. package/lib/es/steps/bacisSteps.scss +238 -287
  381. package/lib/es/steps/fillSteps.scss +142 -153
  382. package/lib/es/steps/navSteps.scss +40 -61
  383. package/lib/es/steps/steps.css +17 -381
  384. package/lib/es/switch/foundation.js +2 -13
  385. package/lib/es/table/bodyFoundation.js +2 -25
  386. package/lib/es/table/cellFoundation.js +0 -1
  387. package/lib/es/table/constants.js +6 -6
  388. package/lib/es/table/foundation.d.ts +17 -14
  389. package/lib/es/table/foundation.js +72 -309
  390. package/lib/es/table/table.css +6 -0
  391. package/lib/es/table/table.scss +12 -0
  392. package/lib/es/table/tableRowFoundation.js +2 -9
  393. package/lib/es/table/tableSelectionCellFoundation.js +0 -2
  394. package/lib/es/table/utils.d.ts +2 -2
  395. package/lib/es/table/utils.js +5 -81
  396. package/lib/es/tabs/foundation.js +2 -35
  397. package/lib/es/tabs/tabs.css +14 -14
  398. package/lib/es/tabs/tabs.scss +16 -14
  399. package/lib/es/tagInput/foundation.d.ts +4 -4
  400. package/lib/es/tagInput/foundation.js +4 -84
  401. package/lib/es/tagInput/utils/getSplitedArray.js +0 -7
  402. package/lib/es/timePicker/ComboxFoundation.js +4 -30
  403. package/lib/es/timePicker/foundation.d.ts +2 -2
  404. package/lib/es/timePicker/foundation.js +7 -95
  405. package/lib/es/timePicker/inputFoundation.js +6 -22
  406. package/lib/es/timePicker/utils/index.js +6 -25
  407. package/lib/es/timePicker/utils/localeDate.js +0 -8
  408. package/lib/es/timeline/timeline.css +0 -36
  409. package/lib/es/timeline/timeline.scss +46 -96
  410. package/lib/es/toast/constants.js +1 -1
  411. package/lib/es/toast/toastFoundation.d.ts +3 -3
  412. package/lib/es/toast/toastFoundation.js +0 -9
  413. package/lib/es/toast/toastListFoundation.js +4 -18
  414. package/lib/es/tooltip/foundation.d.ts +1 -1
  415. package/lib/es/tooltip/foundation.js +63 -288
  416. package/lib/es/transfer/foundation.d.ts +1 -1
  417. package/lib/es/transfer/foundation.js +6 -62
  418. package/lib/es/transfer/transferUtils.js +5 -21
  419. package/lib/es/tree/foundation.d.ts +3 -3
  420. package/lib/es/tree/foundation.js +34 -143
  421. package/lib/es/tree/treeUtil.js +54 -139
  422. package/lib/es/treeSelect/foundation.d.ts +7 -7
  423. package/lib/es/treeSelect/foundation.js +20 -179
  424. package/lib/es/typography/constants.d.ts +1 -0
  425. package/lib/es/typography/constants.js +1 -0
  426. package/lib/es/typography/formatNumeral.d.ts +3 -3
  427. package/lib/es/typography/formatNumeral.js +16 -29
  428. package/lib/es/typography/typography.css +120 -0
  429. package/lib/es/typography/typography.scss +131 -6
  430. package/lib/es/typography/variables.scss +48 -0
  431. package/lib/es/upload/foundation.d.ts +5 -5
  432. package/lib/es/upload/foundation.js +36 -238
  433. package/lib/es/upload/utils.js +10 -24
  434. package/lib/es/utils/Event.js +2 -17
  435. package/lib/es/utils/FocusHandle.d.ts +1 -1
  436. package/lib/es/utils/FocusHandle.js +6 -32
  437. package/lib/es/utils/Logger.js +0 -20
  438. package/lib/es/utils/Store.js +0 -9
  439. package/lib/es/utils/a11y.js +18 -31
  440. package/lib/es/utils/array.d.ts +1 -1
  441. package/lib/es/utils/array.js +0 -5
  442. package/lib/es/utils/classnames.js +0 -10
  443. package/lib/es/utils/date-fns-extra.js +0 -27
  444. package/lib/es/utils/dom.d.ts +1 -1
  445. package/lib/es/utils/dom.js +0 -9
  446. package/lib/es/utils/getDataAttr.js +0 -1
  447. package/lib/es/utils/getHighlight.js +5 -26
  448. package/lib/es/utils/getMotionObjFromProps.js +0 -8
  449. package/lib/es/utils/isBothNaN.js +0 -1
  450. package/lib/es/utils/isEnterPress.js +0 -2
  451. package/lib/es/utils/isEscPress.js +0 -2
  452. package/lib/es/utils/keyCode.js +0 -104
  453. package/lib/es/utils/log.js +0 -3
  454. package/lib/es/utils/object.d.ts +4 -4
  455. package/lib/es/utils/object.js +12 -28
  456. package/lib/es/utils/set.js +0 -5
  457. package/lib/es/utils/shallowEqualObjects.js +0 -6
  458. package/lib/es/utils/touchPolyfill.js +0 -5
  459. package/lib/es/utils/type.d.ts +3 -3
  460. package/lib/es/utils/uuid.js +2 -8
  461. package/navigation/itemFoundation.ts +1 -3
  462. package/navigation/navigation.scss +7 -119
  463. package/navigation/subNavFoundation.ts +1 -3
  464. package/overflowList/foundation.ts +4 -4
  465. package/package.json +2 -2
  466. package/steps/bacisSteps.scss +238 -287
  467. package/steps/fillSteps.scss +142 -153
  468. package/steps/navSteps.scss +40 -61
  469. package/table/foundation.ts +8 -10
  470. package/table/table.scss +12 -0
  471. package/tabs/tabs.scss +16 -14
  472. package/timePicker/foundation.ts +4 -6
  473. package/timeline/timeline.scss +46 -96
  474. package/typography/constants.ts +1 -0
  475. package/typography/typography.scss +131 -6
  476. package/typography/variables.scss +48 -0
  477. package/upload/foundation.ts +8 -8
@@ -4,86 +4,55 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _omit2 = _interopRequireDefault(require("lodash/omit"));
9
-
10
8
  var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
11
-
12
9
  var _isString2 = _interopRequireDefault(require("lodash/isString"));
13
-
14
10
  var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
15
-
16
11
  var _foundation = _interopRequireDefault(require("../base/foundation"));
17
-
18
12
  var _keyCode = _interopRequireWildcard(require("../utils/keyCode"));
19
-
20
13
  var _warning = _interopRequireDefault(require("../utils/warning"));
21
-
22
14
  var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
23
-
24
15
  var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
25
-
26
16
  var _a11y = require("../utils/a11y");
27
-
28
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
-
30
18
  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; }
31
-
32
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
-
34
20
  var __rest = void 0 && (void 0).__rest || function (s, e) {
35
21
  var t = {};
36
-
37
22
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
38
-
39
23
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
40
24
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
41
25
  }
42
26
  return t;
43
27
  };
44
28
  /* argus-disable unPkgSensitiveInfo */
45
-
46
29
  /* eslint-disable max-len */
47
-
48
-
49
30
  class SelectFoundation extends _foundation.default {
50
31
  constructor(adapter) {
51
- super(Object.assign({}, adapter)); // keyboard event listner
32
+ super(Object.assign({}, adapter));
33
+ // keyboard event listner
52
34
  // eslint-disable-next-line @typescript-eslint/member-ordering
53
-
54
35
  this._keydownHandler = null;
55
36
  }
56
-
57
37
  init() {
58
38
  this._setDropdownWidth();
59
-
60
39
  const isDefaultOpen = this.getProp('defaultOpen');
61
40
  const isOpen = this.getProp('open');
62
-
63
41
  const originalOptions = this._collectOptions();
64
-
65
42
  this._setDefaultSelection(originalOptions);
66
-
67
43
  if (isDefaultOpen || isOpen) {
68
44
  this.open(undefined, originalOptions);
69
45
  }
70
-
71
46
  const autoFocus = this.getProp('autoFocus');
72
-
73
47
  if (autoFocus) {
74
48
  this.focus();
75
49
  }
76
50
  }
77
-
78
51
  focus() {
79
52
  const isFilterable = this._isFilterable();
80
-
81
53
  const isMultiple = this._isMultiple();
82
-
83
54
  this._adapter.updateFocusState(true);
84
-
85
55
  this._adapter.setIsFocusInContainer(false);
86
-
87
56
  if (isFilterable && isMultiple) {
88
57
  // when filter and multiple, only focus input
89
58
  this.focusInput();
@@ -94,15 +63,14 @@ class SelectFoundation extends _foundation.default {
94
63
  this._focusTrigger();
95
64
  }
96
65
  }
97
-
98
66
  _focusTrigger() {
99
- this._adapter.focusTrigger(); // this.bindKeyBoardEvent();
100
-
67
+ this._adapter.focusTrigger();
68
+ // this.bindKeyBoardEvent();
101
69
  }
102
70
 
103
71
  destroy() {
104
- this._adapter.unregisterClickOutsideHandler(); // this.unBindKeyBoardEvent();
105
-
72
+ this._adapter.unregisterClickOutsideHandler();
73
+ // this.unBindKeyBoardEvent();
106
74
  }
107
75
 
108
76
  _setDropdownWidth() {
@@ -111,7 +79,6 @@ class SelectFoundation extends _foundation.default {
111
79
  dropdownMatchSelectWidth
112
80
  } = this.getProps();
113
81
  let width;
114
-
115
82
  if (dropdownMatchSelectWidth) {
116
83
  if (style && (0, _isNumber2.default)(style.width)) {
117
84
  width = style.width;
@@ -120,22 +87,16 @@ class SelectFoundation extends _foundation.default {
120
87
  } else {
121
88
  width = this._adapter.getTriggerWidth();
122
89
  }
123
-
124
90
  this._adapter.setOptionWrapperWidth(width);
125
91
  }
126
92
  }
127
-
128
93
  _collectOptions() {
129
94
  const originalOptions = this._adapter.getOptionsFromChildren();
130
-
131
- this._adapter.updateOptions(originalOptions); // Reposition the drop-down layer
132
-
133
-
95
+ this._adapter.updateOptions(originalOptions);
96
+ // Reposition the drop-down layer
134
97
  this._adapter.rePositionDropdown();
135
-
136
98
  return originalOptions;
137
99
  }
138
-
139
100
  _setDefaultSelection(originalOptions) {
140
101
  let {
141
102
  value
@@ -143,79 +104,64 @@ class SelectFoundation extends _foundation.default {
143
104
  const {
144
105
  defaultValue
145
106
  } = this.getProps();
146
-
147
- if (this._isControlledComponent()) {// do nothing
107
+ if (this._isControlledComponent()) {
108
+ // do nothing
148
109
  } else {
149
110
  value = defaultValue;
150
111
  }
151
-
152
112
  this._update(value, originalOptions);
153
- } // call when props.optionList change
154
-
155
-
113
+ }
114
+ // call when props.optionList change
156
115
  handleOptionListChange() {
157
116
  const newOptionList = this._collectOptions();
158
-
159
117
  const {
160
118
  selections
161
119
  } = this.getStates();
162
- this.updateOptionsActiveStatus(selections, newOptionList); // reset focusIndex
163
-
120
+ this.updateOptionsActiveStatus(selections, newOptionList);
121
+ // reset focusIndex
164
122
  const {
165
123
  defaultActiveFirstOption
166
124
  } = this.getProps();
167
-
168
125
  if (defaultActiveFirstOption) {
169
126
  this._adapter.updateFocusIndex(0);
170
127
  }
171
- } // In uncontrolled mode, when props.optionList change,
128
+ }
129
+ // In uncontrolled mode, when props.optionList change,
172
130
  // but already had defaultValue or choose some option
173
-
174
-
175
131
  handleOptionListChangeHadDefaultValue() {
176
132
  const selections = this.getState('selections');
177
133
  let value;
178
134
  const {
179
135
  onChangeWithObject
180
136
  } = this.getProps();
181
-
182
137
  const isMultiple = this._isMultiple();
183
-
184
138
  switch (true) {
185
139
  case isMultiple && Boolean(selections.size):
186
140
  try {
187
- value = [...selections].map(item => // At this point item1 is directly the object
141
+ value = [...selections].map(item =>
142
+ // At this point item1 is directly the object
188
143
  onChangeWithObject ? item[1] : item[1].value);
189
144
  } catch (error) {
190
145
  value = [];
191
146
  }
192
-
193
147
  break;
194
-
195
148
  case isMultiple && !selections.size:
196
149
  value = [];
197
150
  break;
198
-
199
151
  case !isMultiple && Boolean(selections.size):
200
152
  try {
201
153
  value = onChangeWithObject ? [...selections][0][1] : [...selections][0][1].value;
202
154
  } catch (error) {}
203
-
204
155
  break;
205
-
206
156
  case !isMultiple && !selections.size:
207
157
  break;
208
-
209
158
  default:
210
159
  break;
211
160
  }
212
-
213
161
  const originalOptions = this._adapter.getOptionsFromChildren();
214
-
215
162
  this._update(value, originalOptions);
216
- } // call when props.value change
217
-
218
-
163
+ }
164
+ // call when props.value change
219
165
  handleValueChange(value) {
220
166
  const {
221
167
  allowCreate,
@@ -225,8 +171,8 @@ class SelectFoundation extends _foundation.default {
225
171
  const {
226
172
  inputValue
227
173
  } = this.getStates();
228
- let originalOptions; // AllowCreate and controlled mode, no need to re-collect optionList
229
-
174
+ let originalOptions;
175
+ // AllowCreate and controlled mode, no need to re-collect optionList
230
176
  if (allowCreate && this._isControlledComponent()) {
231
177
  originalOptions = this.getState('options');
232
178
  originalOptions.forEach(item => item._show = true);
@@ -235,54 +181,46 @@ class SelectFoundation extends _foundation.default {
235
181
  // The options in state cannot be used directly here,
236
182
  // because it is possible to update the optionList and props.value at the same time, and the options in state are still old at this time
237
183
  originalOptions = this._adapter.getOptionsFromChildren();
238
- } // Multi-selection, controlled mode, you need to reposition the drop-down menu after updating
239
-
240
-
184
+ }
185
+ // Multi-selection, controlled mode, you need to reposition the drop-down menu after updating
241
186
  this._adapter.rePositionDropdown();
242
-
243
187
  if (this._isFilterable() && !autoClearSearchValue && inputValue && !remote) {
244
188
  originalOptions = this._filterOption(originalOptions, inputValue);
245
189
  }
246
-
247
190
  this._update(value, originalOptions);
248
- } // Update the selected item in the selection box
249
-
250
-
191
+ }
192
+ // Update the selected item in the selection box
251
193
  _update(propValue, originalOptions) {
252
194
  let selections;
253
-
254
195
  if (!this._isMultiple()) {
255
196
  // Radio
256
197
  selections = this._updateSingle(propValue, originalOptions);
257
198
  } else {
258
199
  selections = this._updateMultiple(propValue, originalOptions);
259
200
  this.updateOverflowItemCount(selections.size);
260
- } // Update the text in the selection box
261
-
262
-
263
- this._adapter.updateSelection(selections); // Update the selected item in the drop-down box
264
-
265
-
201
+ }
202
+ // Update the text in the selection box
203
+ this._adapter.updateSelection(selections);
204
+ // Update the selected item in the drop-down box
266
205
  this.updateOptionsActiveStatus(selections, originalOptions);
267
- } // Optionally selected updates (when components are mounted, or after value changes)
268
-
269
-
206
+ }
207
+ // Optionally selected updates (when components are mounted, or after value changes)
270
208
  _updateSingle(propValue, originalOptions) {
271
209
  const selections = new Map();
272
210
  const {
273
211
  onChangeWithObject
274
- } = this.getProps(); // When onChangeWithObject is true, the defaultValue or Value passed by the props should be the object, which corresponds to the result returned by onChange, so the value of the object needs to be taken as a judgment comparison
275
-
212
+ } = this.getProps();
213
+ // When onChangeWithObject is true, the defaultValue or Value passed by the props should be the object, which corresponds to the result returned by onChange, so the value of the object needs to be taken as a judgment comparison
276
214
  const selectedValue = onChangeWithObject && typeof propValue !== 'undefined' ? propValue.value : propValue;
277
215
  const selectedOptions = originalOptions.filter(option => option.value === selectedValue);
278
- const noMatchOptionInList = !selectedOptions.length && typeof selectedValue !== 'undefined' && selectedValue !== null; // If the current value, there is a matching option in the optionList
279
-
216
+ const noMatchOptionInList = !selectedOptions.length && typeof selectedValue !== 'undefined' && selectedValue !== null;
217
+ // If the current value, there is a matching option in the optionList
280
218
  if (selectedOptions.length) {
281
219
  const selectedOption = selectedOptions[0];
282
- const optionExist = Object.assign({}, selectedOption); // if (onChangeWithObject) {
220
+ const optionExist = Object.assign({}, selectedOption);
221
+ // if (onChangeWithObject) {
283
222
  // OptionExist = {... propValue }; // value is the object with the'value 'Key
284
223
  // }
285
-
286
224
  selections.set(optionExist.label, optionExist);
287
225
  } else if (noMatchOptionInList) {
288
226
  // If the current value does not have a corresponding item in the optionList, construct an option and update it to the selection. However, it does not need to be inserted into the list
@@ -292,53 +230,45 @@ class SelectFoundation extends _foundation.default {
292
230
  _notExist: true,
293
231
  _scrollIndex: -1
294
232
  };
295
-
296
233
  if (onChangeWithObject) {
297
234
  optionNotExist = Object.assign(Object.assign({}, propValue), {
298
235
  _notExist: true,
299
236
  _scrollIndex: -1
300
237
  });
301
238
  }
302
-
303
239
  selections.set(optionNotExist.label, optionNotExist);
304
240
  }
305
-
306
241
  return selections;
307
- } // Multi-selected option update (when the component is mounted, or after the value changes)
308
-
309
-
242
+ }
243
+ // Multi-selected option update (when the component is mounted, or after the value changes)
310
244
  _updateMultiple(propValue, originalOptions) {
311
245
  const nowSelections = this.getState('selections');
312
- let selectedOptionList = []; // Multiple selection is to determine whether it is an array to avoid the problem of defaultValue/value incoming string error
313
-
246
+ let selectedOptionList = [];
247
+ // Multiple selection is to determine whether it is an array to avoid the problem of defaultValue/value incoming string error
314
248
  const propValueIsArray = Array.isArray(propValue);
315
- this.checkMultipleProps(); // If N values are currently selected, the corresponding option data is retrieved from the current selections for retrieval. Because these selected options may not exist in the new optionList
316
-
249
+ this.checkMultipleProps();
250
+ // If N values are currently selected, the corresponding option data is retrieved from the current selections for retrieval. Because these selected options may not exist in the new optionList
317
251
  if (nowSelections.size) {
318
252
  selectedOptionList = [...nowSelections].map(item => item[1]);
319
253
  }
320
-
321
254
  const selections = new Map();
322
255
  let selectedValues = propValue;
323
256
  const {
324
257
  onChangeWithObject
325
- } = this.getProps(); // When onChangeWithObject is true
326
-
258
+ } = this.getProps();
259
+ // When onChangeWithObject is true
327
260
  if (onChangeWithObject && propValueIsArray) {
328
261
  selectedValues = propValue.map(item => item.value);
329
262
  }
330
-
331
263
  if (propValueIsArray && selectedValues.length) {
332
264
  selectedValues.forEach((selectedValue, i) => {
333
265
  // The current value exists in the current optionList
334
266
  const index = originalOptions.findIndex(option => option.value === selectedValue);
335
-
336
267
  if (index !== -1) {
337
268
  selections.set(originalOptions[index].label, originalOptions[index]);
338
269
  } else {
339
270
  // The current value exists in the optionList that has been selected before the change, and does not exist in the current optionList, then directly take the corresponding value from the selections, no need to construct a new option
340
271
  const indexInSelectedList = selectedOptionList.findIndex(option => option.value === selectedValue);
341
-
342
272
  if (indexInSelectedList !== -1) {
343
273
  const option = selectedOptionList[indexInSelectedList];
344
274
  selections.set(option.label, option);
@@ -359,18 +289,14 @@ class SelectFoundation extends _foundation.default {
359
289
  }
360
290
  });
361
291
  }
362
-
363
292
  return selections;
364
293
  }
365
-
366
294
  _isMultiple() {
367
295
  return this.getProp('multiple');
368
296
  }
369
-
370
297
  _isDisabled() {
371
298
  return this.getProp('disabled');
372
299
  }
373
-
374
300
  _isFilterable() {
375
301
  return Boolean(this.getProp('filter')); // filter can be boolean or function
376
302
  }
@@ -382,14 +308,11 @@ class SelectFoundation extends _foundation.default {
382
308
  const {
383
309
  isOpen
384
310
  } = this.getStates();
385
-
386
311
  const isDisabled = this._isDisabled();
387
-
388
312
  if (isDisabled) {
389
313
  return;
390
314
  } else if (!isOpen) {
391
315
  this.open();
392
-
393
316
  this._notifyFocus(e);
394
317
  } else if (isOpen && clickToHide) {
395
318
  this.close(e);
@@ -397,41 +320,28 @@ class SelectFoundation extends _foundation.default {
397
320
  this.focusInput();
398
321
  }
399
322
  }
400
-
401
323
  open(acInput, originalOptions) {
402
324
  const isFilterable = this._isFilterable();
403
-
404
- const options = originalOptions || this.getState('options'); // When searchable, when the drop-down box expands
405
-
325
+ const options = originalOptions || this.getState('options');
326
+ // When searchable, when the drop-down box expands
406
327
  if (isFilterable) {
407
328
  // Also clears the options filter to show all candidates
408
329
  // Options created dynamically but not selected are also filtered out
409
330
  const sugInput = '';
410
-
411
331
  const newOptions = this._filterOption(options, sugInput).filter(item => !item._inputCreateOnly);
412
-
413
332
  this._adapter.updateOptions(newOptions);
414
-
415
333
  this.toggle2SearchInput(true);
416
334
  }
417
-
418
335
  this._adapter.openMenu();
419
-
420
336
  this._setDropdownWidth();
421
-
422
337
  this._adapter.notifyDropdownVisibleChange(true);
423
-
424
338
  this.bindKeyBoardEvent();
425
-
426
339
  this._adapter.registerClickOutsideHandler(e => {
427
340
  this.close(e);
428
-
429
341
  this._notifyBlur(e);
430
-
431
342
  this._adapter.updateFocusState(false);
432
343
  });
433
344
  }
434
-
435
345
  toggle2SearchInput(isShow) {
436
346
  if (isShow) {
437
347
  this._adapter.toggleInputShow(isShow, () => this.focusInput());
@@ -440,209 +350,164 @@ class SelectFoundation extends _foundation.default {
440
350
  this._adapter.toggleInputShow(isShow, () => undefined);
441
351
  }
442
352
  }
443
-
444
353
  close(e, closeCb) {
445
354
  // to support A11y, closing the panel trigger does not necessarily lose focus
446
355
  this._adapter.closeMenu();
447
-
448
356
  this._adapter.notifyDropdownVisibleChange(false);
449
-
450
- this._adapter.setIsFocusInContainer(false); // this.unBindKeyBoardEvent();
357
+ this._adapter.setIsFocusInContainer(false);
358
+ // this.unBindKeyBoardEvent();
451
359
  // this._notifyBlur(e);
452
-
453
-
454
- this._adapter.unregisterClickOutsideHandler(); // this._adapter.updateFocusState(false);
455
-
456
-
360
+ this._adapter.unregisterClickOutsideHandler();
361
+ // this._adapter.updateFocusState(false);
457
362
  const isFilterable = this._isFilterable();
458
-
459
363
  if (isFilterable) {
460
364
  this.toggle2SearchInput(false);
461
365
  }
462
-
463
366
  this._adapter.once('popoverClose', () => {
464
367
  if (isFilterable) {
465
368
  this.clearInput(e);
466
369
  }
467
-
468
370
  if (closeCb) {
469
371
  closeCb();
470
372
  }
471
373
  });
472
374
  }
473
-
474
375
  onSelect(option, optionIndex, event) {
475
376
  const isDisabled = this._isDisabled();
476
-
477
377
  if (isDisabled) {
478
378
  return;
479
- } // If the allowCreate dynamically created option is selected, onCreate needs to be triggered
480
-
481
-
379
+ }
380
+ // If the allowCreate dynamically created option is selected, onCreate needs to be triggered
482
381
  if (option._inputCreateOnly) {
483
382
  this._adapter.notifyCreate(option);
484
383
  }
485
-
486
384
  const isMultiple = this._isMultiple();
487
-
488
385
  if (!isMultiple) {
489
386
  this._handleSingleSelect(option, event);
490
-
491
387
  this._focusTrigger();
492
388
  } else {
493
389
  this._handleMultipleSelect(option, event);
494
390
  }
495
-
496
391
  this._adapter.updateFocusIndex(optionIndex);
497
392
  }
498
-
499
393
  _handleSingleSelect(_a, event) {
500
394
  var {
501
- value,
502
- label
503
- } = _a,
504
- rest = __rest(_a, ["value", "label"]);
505
-
395
+ value,
396
+ label
397
+ } = _a,
398
+ rest = __rest(_a, ["value", "label"]);
506
399
  const selections = new Map().set(label, Object.assign({
507
400
  value,
508
401
  label
509
- }, rest)); // First trigger onSelect, then trigger onChange
510
-
402
+ }, rest));
403
+ // First trigger onSelect, then trigger onChange
511
404
  this._notifySelect(value, Object.assign({
512
405
  value,
513
406
  label
514
- }, rest)); // If it is a controlled component, directly notify
407
+ }, rest));
408
+ // If it is a controlled component, directly notify
515
409
  // Make sure that the operations of updating updateOptions are done after the animation ends
516
410
  // otherwise the content will be updated when the popup layer is not collapsed, and it looks like it will flash once when it is closed
517
-
518
-
519
411
  if (this._isControlledComponent()) {
520
412
  this.close(event, () => {
521
413
  this._notifyChange(selections);
522
414
  });
523
415
  } else {
524
- this._adapter.updateSelection(selections); // notify user
525
-
526
-
416
+ this._adapter.updateSelection(selections);
417
+ // notify user
527
418
  this._notifyChange(selections);
528
-
529
419
  this.close(event, () => {
530
420
  // Update the selected item in the drop-down box
531
421
  this.updateOptionsActiveStatus(selections);
532
422
  });
533
423
  }
534
424
  }
535
-
536
425
  _handleMultipleSelect(_a, event) {
537
426
  var {
538
- value,
539
- label
540
- } = _a,
541
- rest = __rest(_a, ["value", "label"]);
542
-
427
+ value,
428
+ label
429
+ } = _a,
430
+ rest = __rest(_a, ["value", "label"]);
543
431
  const maxLimit = this._adapter.getMaxLimit();
544
-
545
432
  const selections = this._adapter.getSelections();
546
-
547
433
  const {
548
434
  autoClearSearchValue
549
435
  } = this.getProps();
550
-
551
436
  if (selections.has(label)) {
552
437
  this._notifyDeselect(value, Object.assign({
553
438
  value,
554
439
  label
555
440
  }, rest));
556
-
557
441
  selections.delete(label);
558
442
  } else if (maxLimit && selections.size === maxLimit) {
559
443
  this._adapter.notifyMaxLimit(Object.assign({
560
444
  value,
561
445
  label
562
446
  }, (0, _omit2.default)(rest, '_scrollIndex')));
563
-
564
447
  return;
565
448
  } else {
566
449
  this._notifySelect(value, Object.assign({
567
450
  value,
568
451
  label
569
452
  }, rest));
570
-
571
453
  selections.set(label, Object.assign({
572
454
  value,
573
455
  label
574
456
  }, rest));
575
457
  }
576
-
577
458
  if (this._isControlledComponent()) {
578
459
  // Controlled components, directly notified
579
460
  this._notifyChange(selections);
580
-
581
461
  if (this._isFilterable()) {
582
462
  if (autoClearSearchValue) {
583
463
  this.clearInput(event);
584
464
  }
585
-
586
465
  this.focusInput();
587
466
  }
588
467
  } else {
589
468
  // Uncontrolled components, update ui
590
469
  this._adapter.updateSelection(selections);
591
-
592
- this.updateOverflowItemCount(selections.size); // In multi-select mode, the drop-down pop-up layer is repositioned every time the value is changed, because the height selection of the selection box may have changed
593
-
470
+ this.updateOverflowItemCount(selections.size);
471
+ // In multi-select mode, the drop-down pop-up layer is repositioned every time the value is changed, because the height selection of the selection box may have changed
594
472
  this._adapter.rePositionDropdown();
595
-
596
473
  let {
597
474
  options
598
- } = this.getStates(); // Searchable filtering, when selected, resets Input
599
-
475
+ } = this.getStates();
476
+ // Searchable filtering, when selected, resets Input
600
477
  if (this._isFilterable()) {
601
478
  // When filter active,if autoClearSearchValue is true,reset input after select
602
479
  if (autoClearSearchValue) {
603
- this.clearInput(event); // At the same time, the filtering of options is also cleared, in order to show all candidates
604
-
480
+ this.clearInput(event);
481
+ // At the same time, the filtering of options is also cleared, in order to show all candidates
605
482
  const sugInput = '';
606
483
  options = this._filterOption(options, sugInput);
607
484
  }
608
-
609
485
  this.focusInput();
610
486
  }
611
-
612
487
  this.updateOptionsActiveStatus(selections, options);
613
-
614
488
  this._notifyChange(selections);
615
489
  }
616
490
  }
617
-
618
491
  clearSelected() {
619
492
  const selections = new Map();
620
-
621
493
  if (this._isControlledComponent()) {
622
494
  this._notifyChange(selections);
623
-
624
495
  this._adapter.notifyClear();
625
496
  } else {
626
497
  this._adapter.updateSelection(selections);
627
-
628
498
  this.updateOptionsActiveStatus(selections);
629
-
630
499
  this._notifyChange(selections);
631
-
632
500
  this._adapter.notifyClear();
633
- } // when call manually by ref method
634
-
635
-
501
+ }
502
+ // when call manually by ref method
636
503
  const {
637
504
  isOpen
638
505
  } = this.getStates();
639
-
640
506
  if (isOpen) {
641
507
  this._adapter.rePositionDropdown();
642
508
  }
643
- } // Update the selected item in the drop-down box
644
-
645
-
509
+ }
510
+ // Update the selected item in the drop-down box
646
511
  updateOptionsActiveStatus(selections) {
647
512
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getState('options');
648
513
  const {
@@ -651,7 +516,6 @@ class SelectFoundation extends _foundation.default {
651
516
  const newOptions = options.map(option => {
652
517
  if (selections.has(option.label)) {
653
518
  option._selected = true;
654
-
655
519
  if (allowCreate) {
656
520
  delete option._inputCreateOnly;
657
521
  }
@@ -659,51 +523,38 @@ class SelectFoundation extends _foundation.default {
659
523
  if (option._inputCreateOnly) {
660
524
  option._show = false;
661
525
  }
662
-
663
526
  option._selected = false;
664
527
  }
665
-
666
528
  return option;
667
529
  });
668
-
669
530
  this._adapter.updateOptions(newOptions);
670
531
  }
671
-
672
532
  removeTag(item) {
673
533
  const selections = this._adapter.getSelections();
674
-
675
534
  selections.delete(item.label);
676
-
677
535
  if (this._isControlledComponent()) {
678
536
  this._notifyDeselect(item.value, item);
679
-
680
537
  this._notifyChange(selections);
681
538
  } else {
682
539
  this._notifyDeselect(item.value, item);
683
-
684
540
  this._adapter.updateSelection(selections);
685
-
686
541
  this.updateOverflowItemCount(selections.size);
687
- this.updateOptionsActiveStatus(selections); // Repostion drop-down layer, because the selection may have changed the number of rows, resulting in a height change
688
-
542
+ this.updateOptionsActiveStatus(selections);
543
+ // Repostion drop-down layer, because the selection may have changed the number of rows, resulting in a height change
689
544
  this._adapter.rePositionDropdown();
690
-
691
545
  this._notifyChange(selections);
692
546
  }
693
- } // The reason why event input is optional is that clearInput may be manually called by the user through ref
694
-
695
-
547
+ }
548
+ // The reason why event input is optional is that clearInput may be manually called by the user through ref
696
549
  clearInput(event) {
697
550
  const {
698
551
  inputValue
699
- } = this.getStates(); // only when input is not null, select should notifySearch and updateOptions
700
-
552
+ } = this.getStates();
553
+ // only when input is not null, select should notifySearch and updateOptions
701
554
  if (inputValue !== '') {
702
555
  this._adapter.updateInputValue('');
703
-
704
- this._adapter.notifySearch('', event); // reset options filter
705
-
706
-
556
+ this._adapter.notifySearch('', event);
557
+ // reset options filter
707
558
  const {
708
559
  options
709
560
  } = this.getStates();
@@ -711,27 +562,20 @@ class SelectFoundation extends _foundation.default {
711
562
  remote
712
563
  } = this.getProps();
713
564
  let optionsAfterFilter = options;
714
-
715
565
  if (!remote) {
716
566
  optionsAfterFilter = this._filterOption(options, '');
717
567
  }
718
-
719
568
  this._adapter.updateOptions(optionsAfterFilter);
720
569
  }
721
570
  }
722
-
723
571
  focusInput() {
724
572
  this._adapter.focusInput();
725
-
726
573
  this._adapter.updateFocusState(true);
727
-
728
574
  this._adapter.setIsFocusInContainer(false);
729
575
  }
730
-
731
576
  handleInputChange(sugInput, event) {
732
577
  // Input is a controlled component, so the value needs to be updated
733
578
  this._adapter.updateInputValue(sugInput);
734
-
735
579
  const {
736
580
  options,
737
581
  isOpen
@@ -741,28 +585,21 @@ class SelectFoundation extends _foundation.default {
741
585
  remote
742
586
  } = this.getProps();
743
587
  let optionsAfterFilter = options;
744
-
745
588
  if (!remote) {
746
589
  // Filter options based on input
747
590
  optionsAfterFilter = this._filterOption(options, sugInput);
748
- } // When allowClear is true, an entry can be created. You need to include the current input as a new Option input
749
-
750
-
591
+ }
592
+ // When allowClear is true, an entry can be created. You need to include the current input as a new Option input
751
593
  optionsAfterFilter = this._createOptionByInput(allowCreate, optionsAfterFilter, sugInput);
752
-
753
594
  this._adapter.updateOptions(optionsAfterFilter);
754
-
755
- this._adapter.notifySearch(sugInput, event); // In multi-select mode, the drop-down box is repositioned each time you enter, because it may cause a line break as the input changes
756
-
757
-
595
+ this._adapter.notifySearch(sugInput, event);
596
+ // In multi-select mode, the drop-down box is repositioned each time you enter, because it may cause a line break as the input changes
758
597
  if (this._isMultiple()) {
759
598
  this._adapter.rePositionDropdown();
760
599
  }
761
600
  }
762
-
763
601
  _filterOption(originalOptions, sugInput) {
764
602
  const filter = this.getProp('filter');
765
-
766
603
  if (!filter) {
767
604
  // 1. No filtering
768
605
  return originalOptions;
@@ -774,13 +611,11 @@ class SelectFoundation extends _foundation.default {
774
611
  const groupLabel = option._parentGroup && option._parentGroup.label;
775
612
  const matchOption = label.includes(input);
776
613
  const matchGroup = (0, _isString2.default)(groupLabel) && groupLabel.toLowerCase().includes(input);
777
-
778
614
  if (matchOption || matchGroup) {
779
615
  option._show = true;
780
616
  } else {
781
617
  option._show = false;
782
618
  }
783
-
784
619
  return option;
785
620
  });
786
621
  } else if (typeof filter === 'function') {
@@ -790,10 +625,8 @@ class SelectFoundation extends _foundation.default {
790
625
  return option;
791
626
  });
792
627
  }
793
-
794
628
  return undefined;
795
629
  }
796
-
797
630
  _createOptionByInput(allowCreate, optionsAfterFilter, sugInput) {
798
631
  if (allowCreate) {
799
632
  if (sugInput) {
@@ -811,13 +644,11 @@ class SelectFoundation extends _foundation.default {
811
644
  optionsAfterFilter.forEach((option, index) => {
812
645
  if (!option._show && !option._inputCreateOnly) {
813
646
  return;
814
- } // The matching algorithm is not necessarily through labels?
815
-
816
-
647
+ }
648
+ // The matching algorithm is not necessarily through labels?
817
649
  if (option.label === sugInput) {
818
650
  matchOptionIndex = index;
819
651
  }
820
-
821
652
  if (option._inputCreateOnly) {
822
653
  createOptionIndex = index;
823
654
  option.value = sugInput;
@@ -825,11 +656,9 @@ class SelectFoundation extends _foundation.default {
825
656
  option._show = true;
826
657
  }
827
658
  });
828
-
829
659
  if (createOptionIndex === -1 && matchOptionIndex === -1) {
830
660
  optionsAfterFilter.push(newOptionByInput);
831
661
  }
832
-
833
662
  if (matchOptionIndex !== -1) {
834
663
  optionsAfterFilter = optionsAfterFilter.filter(item => !item._inputCreateOnly);
835
664
  }
@@ -837,26 +666,21 @@ class SelectFoundation extends _foundation.default {
837
666
  // Delete input unselected items
838
667
  optionsAfterFilter = optionsAfterFilter.filter(item => !item._inputCreateOnly);
839
668
  }
840
- } // TODO Promise supports asynchronous creation
841
-
842
-
669
+ }
670
+ // TODO Promise supports asynchronous creation
843
671
  return optionsAfterFilter;
844
672
  }
845
-
846
673
  bindKeyBoardEvent() {
847
674
  this._keydownHandler = event => {
848
675
  this._handleKeyDown(event);
849
676
  };
850
-
851
677
  this._adapter.registerKeyDown(this._keydownHandler);
852
678
  }
853
-
854
679
  unBindKeyBoardEvent() {
855
680
  if (this._keydownHandler) {
856
681
  this._adapter.unregisterKeyDown();
857
682
  }
858
683
  }
859
-
860
684
  _handleKeyDown(event) {
861
685
  const key = event.keyCode;
862
686
  const {
@@ -868,157 +692,117 @@ class SelectFoundation extends _foundation.default {
868
692
  const {
869
693
  isOpen
870
694
  } = this.getStates();
871
-
872
695
  if (loading || disabled) {
873
696
  return;
874
697
  }
875
-
876
698
  switch (key) {
877
699
  case _keyCode.default.UP:
878
700
  // Prevent Input's cursor from following
879
701
  // Prevent Input cursor from following
880
702
  event.preventDefault();
881
-
882
703
  this._handleArrowKeyDown(-1);
883
-
884
704
  break;
885
-
886
705
  case _keyCode.default.DOWN:
887
706
  // Prevent Input's cursor from following
888
707
  // Prevent Input cursor from following
889
708
  event.preventDefault();
890
-
891
709
  this._handleArrowKeyDown(1);
892
-
893
710
  break;
894
-
895
711
  case _keyCode.default.BACKSPACE:
896
712
  this._handleBackspaceKeyDown();
897
-
898
713
  break;
899
-
900
714
  case _keyCode.default.ENTER:
901
715
  // internal-issues:302
902
716
  // prevent trigger form’s submit when use in form
903
717
  (0, _a11y.handlePrevent)(event);
904
-
905
718
  this._handleEnterKeyDown(event);
906
-
907
719
  break;
908
-
909
720
  case _keyCode.default.ESC:
910
721
  isOpen && this.close(event);
911
722
  filter && !multiple && this._focusTrigger();
912
723
  break;
913
-
914
724
  case _keyCode.default.TAB:
915
725
  // check if slot have focusable element
916
726
  this._handleTabKeyDown(event);
917
-
918
727
  break;
919
-
920
728
  default:
921
729
  break;
922
730
  }
923
731
  }
924
-
925
732
  handleContainerKeyDown(event) {
926
733
  // when focus in contanier, handle the key down
927
734
  const key = event.keyCode;
928
735
  const {
929
736
  isOpen
930
737
  } = this.getStates();
931
-
932
738
  switch (key) {
933
739
  case _keyCode.default.TAB:
934
740
  isOpen && this._handleTabKeyDown(event);
935
741
  break;
936
-
937
742
  default:
938
743
  break;
939
744
  }
940
745
  }
941
-
942
746
  _getEnableFocusIndex(offset) {
943
747
  const {
944
748
  focusIndex,
945
749
  options
946
750
  } = this.getStates();
947
- const visibleOptions = options.filter(item => item._show); // let visibleOptions = options;
948
-
751
+ const visibleOptions = options.filter(item => item._show);
752
+ // let visibleOptions = options;
949
753
  const optionsLength = visibleOptions.length;
950
754
  let index = focusIndex + offset;
951
-
952
755
  if (index < 0) {
953
756
  index = optionsLength - 1;
954
757
  }
955
-
956
758
  if (index >= optionsLength) {
957
759
  index = 0;
958
- } // avoid newIndex option is disabled
959
-
960
-
760
+ }
761
+ // avoid newIndex option is disabled
961
762
  if (offset > 0) {
962
763
  let nearestActiveOption = -1;
963
-
964
764
  for (let i = 0; i < visibleOptions.length; i++) {
965
765
  const optionIsActive = !visibleOptions[i].disabled;
966
-
967
766
  if (optionIsActive) {
968
767
  nearestActiveOption = i;
969
768
  }
970
-
971
769
  if (nearestActiveOption >= index) {
972
770
  break;
973
771
  }
974
772
  }
975
-
976
773
  index = nearestActiveOption;
977
774
  } else {
978
775
  let nearestActiveOption = visibleOptions.length;
979
-
980
776
  for (let i = optionsLength - 1; i >= 0; i--) {
981
777
  const optionIsActive = !visibleOptions[i].disabled;
982
-
983
778
  if (optionIsActive) {
984
779
  nearestActiveOption = i;
985
780
  }
986
-
987
781
  if (nearestActiveOption <= index) {
988
782
  break;
989
783
  }
990
784
  }
991
-
992
785
  index = nearestActiveOption;
993
- } // console.log('new:' + index);
994
-
995
-
786
+ }
787
+ // console.log('new:' + index);
996
788
  this._adapter.updateFocusIndex(index);
997
-
998
789
  this._adapter.updateScrollTop(index);
999
790
  }
1000
-
1001
791
  _handleArrowKeyDown(offset) {
1002
792
  const {
1003
793
  isOpen
1004
794
  } = this.getStates();
1005
795
  isOpen ? this._getEnableFocusIndex(offset) : this.open();
1006
796
  }
1007
-
1008
797
  _handleTabKeyDown(event) {
1009
798
  const {
1010
799
  isOpen
1011
800
  } = this.getStates();
1012
-
1013
801
  this._adapter.updateFocusState(false);
1014
-
1015
802
  if (isOpen) {
1016
803
  const container = this._adapter.getContainer();
1017
-
1018
804
  const focusableElements = this._adapter.getFocusableElements(container);
1019
-
1020
805
  const focusableNum = focusableElements.length;
1021
-
1022
806
  if (focusableNum > 0) {
1023
807
  // Shift + Tab will move focus backward
1024
808
  if (event.shiftKey) {
@@ -1029,7 +813,6 @@ class SelectFoundation extends _foundation.default {
1029
813
  } else {
1030
814
  // there are no focusable elements inside the container, tab to next element and trigger blur
1031
815
  this.close(event);
1032
-
1033
816
  this._notifyBlur(event);
1034
817
  }
1035
818
  } else {
@@ -1037,55 +820,41 @@ class SelectFoundation extends _foundation.default {
1037
820
  this._notifyBlur(event);
1038
821
  }
1039
822
  }
1040
-
1041
823
  _handlePanelOpenTabKeyDown(focusableElements, event) {
1042
824
  const activeElement = this._adapter.getActiveElement();
1043
-
1044
825
  const isFocusInContainer = this._adapter.getIsFocusInContainer();
1045
-
1046
826
  if (!isFocusInContainer) {
1047
827
  // focus in trigger, set next focus to the first element in container
1048
828
  focusableElements[0].focus();
1049
-
1050
829
  this._adapter.setIsFocusInContainer(true);
1051
-
1052
830
  (0, _a11y.handlePrevent)(event);
1053
831
  } else if (activeElement === focusableElements[focusableElements.length - 1]) {
1054
832
  // focus in the last element in container, focus back to trigger and close panel
1055
833
  this._focusTrigger();
1056
-
1057
834
  this.close(event);
1058
835
  (0, _a11y.handlePrevent)(event);
1059
836
  }
1060
837
  }
1061
-
1062
838
  _handlePanelOpenShiftTabKeyDown(focusableElements, event) {
1063
839
  const activeElement = this._adapter.getActiveElement();
1064
-
1065
840
  const isFocusInContainer = this._adapter.getIsFocusInContainer();
1066
-
1067
841
  if (!isFocusInContainer) {
1068
842
  // focus in trigger, close the panel, shift tab to previe element and trigger blur
1069
843
  this.close(event);
1070
-
1071
844
  this._notifyBlur(event);
1072
845
  } else if (activeElement === focusableElements[0]) {
1073
846
  // focus in the first element in container, focus back to trigger
1074
847
  this._focusTrigger();
1075
-
1076
848
  this._adapter.setIsFocusInContainer(false);
1077
-
1078
849
  (0, _a11y.handlePrevent)(event);
1079
850
  }
1080
851
  }
1081
-
1082
852
  _handleEnterKeyDown(event) {
1083
853
  const {
1084
854
  isOpen,
1085
855
  options,
1086
856
  focusIndex
1087
857
  } = this.getStates();
1088
-
1089
858
  if (!isOpen) {
1090
859
  this.open();
1091
860
  } else {
@@ -1093,19 +862,16 @@ class SelectFoundation extends _foundation.default {
1093
862
  const visibleOptions = options.filter(item => item._show);
1094
863
  const {
1095
864
  length
1096
- } = visibleOptions; // fix issue 1201
1097
-
865
+ } = visibleOptions;
866
+ // fix issue 1201
1098
867
  if (length <= focusIndex) {
1099
868
  return;
1100
869
  }
1101
-
1102
870
  if (visibleOptions && length) {
1103
871
  const selectedOption = visibleOptions[focusIndex];
1104
-
1105
872
  if (selectedOption.disabled) {
1106
873
  return;
1107
874
  }
1108
-
1109
875
  this.onSelect(selectedOption, focusIndex, event);
1110
876
  }
1111
877
  } else {
@@ -1113,44 +879,38 @@ class SelectFoundation extends _foundation.default {
1113
879
  }
1114
880
  }
1115
881
  }
1116
-
1117
882
  _handleBackspaceKeyDown() {
1118
883
  if (this._isMultiple()) {
1119
884
  const selections = this._adapter.getSelections();
1120
-
1121
885
  const {
1122
886
  inputValue
1123
887
  } = this.getStates();
1124
888
  const length = selections.size;
1125
-
1126
889
  if (length && !inputValue) {
1127
890
  const keys = [...selections.keys()];
1128
891
  let index = length - 1;
1129
892
  let targetLabel = keys[index];
1130
893
  let targetItem = selections.get(targetLabel);
1131
- let isAllDisabled = false; // can skip disabled item when remove trigger by backspace
1132
-
894
+ let isAllDisabled = false;
895
+ // can skip disabled item when remove trigger by backspace
1133
896
  if (targetItem.disabled && index === 0) {
1134
897
  return;
1135
898
  }
1136
-
1137
899
  while (targetItem.disabled && index !== 0) {
1138
900
  index = index - 1;
1139
901
  targetLabel = keys[index];
1140
- targetItem = selections.get(targetLabel); // eslint-disable-next-line
1141
-
902
+ targetItem = selections.get(targetLabel);
903
+ // eslint-disable-next-line
1142
904
  if (index == 0 && targetItem.disabled) {
1143
905
  isAllDisabled = true;
1144
906
  }
1145
907
  }
1146
-
1147
908
  if (!isAllDisabled) {
1148
909
  this.removeTag(targetItem);
1149
910
  }
1150
911
  }
1151
912
  }
1152
913
  }
1153
-
1154
914
  _notifyChange(selections) {
1155
915
  const {
1156
916
  onChangeWithObject
@@ -1158,40 +918,27 @@ class SelectFoundation extends _foundation.default {
1158
918
  const stateSelections = this.getState('selections');
1159
919
  let notifyVal;
1160
920
  const selectionsProps = [...selections.values()];
1161
-
1162
921
  const isMultiple = this._isMultiple();
1163
-
1164
922
  const hasChange = this._diffSelections(selections, stateSelections, isMultiple);
1165
-
1166
923
  if (!hasChange) {
1167
924
  return;
1168
925
  }
1169
-
1170
926
  switch (true) {
1171
927
  case onChangeWithObject:
1172
928
  this._notifyChangeWithObject(selections);
1173
-
1174
929
  break;
1175
-
1176
930
  case !onChangeWithObject && !isMultiple:
1177
931
  notifyVal = selectionsProps.length ? selectionsProps[0].value : undefined;
1178
-
1179
932
  this._adapter.notifyChange(notifyVal);
1180
-
1181
933
  break;
1182
-
1183
934
  case !onChangeWithObject && isMultiple:
1184
935
  notifyVal = selectionsProps.length ? selectionsProps.map(props => props.value) : [];
1185
-
1186
936
  this._adapter.notifyChange(notifyVal);
1187
-
1188
937
  break;
1189
-
1190
938
  default:
1191
939
  break;
1192
940
  }
1193
941
  }
1194
-
1195
942
  _removeInternalKey(option) {
1196
943
  // eslint-disable-next-line
1197
944
  let newOption = Object.assign({}, option);
@@ -1199,47 +946,37 @@ class SelectFoundation extends _foundation.default {
1199
946
  delete newOption._show;
1200
947
  delete newOption._selected;
1201
948
  delete newOption._scrollIndex;
1202
-
1203
949
  if ('_keyInOptionList' in newOption) {
1204
950
  newOption.key = newOption._keyInOptionList;
1205
951
  delete newOption._keyInOptionList;
1206
952
  }
1207
-
1208
953
  return newOption;
1209
954
  }
1210
-
1211
955
  _notifySelect(value, option) {
1212
956
  const newOption = this._removeInternalKey(option);
1213
-
1214
957
  this._adapter.notifySelect(value, newOption);
1215
958
  }
1216
-
1217
959
  _notifyDeselect(value, option) {
1218
960
  const newOption = this._removeInternalKey(option);
1219
-
1220
961
  this._adapter.notifyDeselect(value, newOption);
1221
962
  }
1222
-
1223
963
  _diffSelections(selections, oldSelections, isMultiple) {
1224
964
  let diff = true;
1225
-
1226
965
  if (!isMultiple) {
1227
966
  const selectionProps = [...selections.values()];
1228
967
  const oldSelectionProps = [...oldSelections.values()];
1229
968
  const optionLabel = selectionProps[0] ? selectionProps[0].label : selectionProps[0];
1230
969
  const oldOptionLabel = oldSelectionProps[0] ? oldSelectionProps[0].label : oldSelectionProps[0];
1231
970
  diff = !(0, _isEqual2.default)(optionLabel, oldOptionLabel);
1232
- } else {// When multiple selection, there is no scene where the value is different between the two operations
971
+ } else {
972
+ // When multiple selection, there is no scene where the value is different between the two operations
1233
973
  }
1234
-
1235
974
  return diff;
1236
- } // When onChangeWithObject is true, the onChange input parameter is not only value, but also label and other parameters
1237
-
1238
-
975
+ }
976
+ // When onChangeWithObject is true, the onChange input parameter is not only value, but also label and other parameters
1239
977
  _notifyChangeWithObject(selections) {
1240
978
  const stateSelections = this.getState('selections');
1241
979
  const values = [];
1242
-
1243
980
  for (const item of selections.entries()) {
1244
981
  let val = Object.assign({
1245
982
  label: item[0]
@@ -1247,87 +984,69 @@ class SelectFoundation extends _foundation.default {
1247
984
  val = this._removeInternalKey(val);
1248
985
  values.push(val);
1249
986
  }
1250
-
1251
987
  if (!this._isMultiple()) {
1252
988
  this._adapter.notifyChange(values[0]);
1253
989
  } else {
1254
990
  this._adapter.notifyChange(values);
1255
991
  }
1256
- } // Scenes that may trigger blur:
992
+ }
993
+ // Scenes that may trigger blur:
1257
994
  // 1、clickOutSide
1258
995
  // 2、 tab to next element/ shift tab to previous element
1259
996
  // 3、[remove when add a11y] click option / press enter, and then select complete(when multiple is false
1260
997
  // 4、[remove when add a11y] press esc when dropdown list open
1261
-
1262
-
1263
998
  _notifyBlur(e) {
1264
999
  this._adapter.notifyBlur(e);
1265
- } // Scenes that may trigger focus:
1000
+ }
1001
+ // Scenes that may trigger focus:
1266
1002
  // 1、click selection
1267
-
1268
-
1269
1003
  _notifyFocus(e) {
1270
1004
  this._adapter.notifyFocus(e);
1271
1005
  }
1272
-
1273
1006
  handleMouseEnter(e) {
1274
1007
  this._adapter.updateHovering(true);
1275
-
1276
1008
  this._adapter.notifyMouseEnter(e);
1277
1009
  }
1278
-
1279
1010
  handleMouseLeave(e) {
1280
1011
  this._adapter.updateHovering(false);
1281
-
1282
1012
  this._adapter.notifyMouseLeave(e);
1283
1013
  }
1284
-
1285
1014
  handleClearClick(e) {
1286
1015
  const {
1287
1016
  filter
1288
1017
  } = this.getProps();
1289
-
1290
1018
  if (filter) {
1291
1019
  this.clearInput(e);
1292
1020
  }
1293
-
1294
- this.clearSelected(); // prevent this click open dropdown
1295
-
1021
+ this.clearSelected();
1022
+ // prevent this click open dropdown
1296
1023
  e.stopPropagation();
1297
1024
  }
1298
-
1299
1025
  handleKeyPress(e) {
1300
1026
  if (e && e.key === _keyCode.ENTER_KEY) {
1301
1027
  this.handleClick(e);
1302
1028
  }
1303
1029
  }
1304
1030
  /* istanbul ignore next */
1305
-
1306
-
1307
1031
  handleClearBtnEnterPress(e) {
1308
1032
  if ((0, _isEnterPress.default)(e)) {
1309
1033
  this.handleClearClick(e);
1310
1034
  }
1311
1035
  }
1312
-
1313
1036
  handleOptionMouseEnter(optionIndex) {
1314
1037
  this._adapter.updateFocusIndex(optionIndex);
1315
1038
  }
1316
-
1317
1039
  handleListScroll(e) {
1318
1040
  this._adapter.notifyListScroll(e);
1319
1041
  }
1320
-
1321
1042
  handleTriggerFocus(e) {
1322
- this.bindKeyBoardEvent(); // close the tag in multiple select did not trigger select focus, but trigger TriggerFocus, so not need to updateFocusState in this function
1043
+ this.bindKeyBoardEvent();
1044
+ // close the tag in multiple select did not trigger select focus, but trigger TriggerFocus, so not need to updateFocusState in this function
1323
1045
  // this._adapter.updateFocusState(true);
1324
-
1325
1046
  this._adapter.setIsFocusInContainer(false);
1326
1047
  }
1327
-
1328
1048
  handleTriggerBlur(e) {
1329
1049
  this._adapter.updateFocusState(false);
1330
-
1331
1050
  const {
1332
1051
  filter,
1333
1052
  autoFocus
@@ -1335,28 +1054,24 @@ class SelectFoundation extends _foundation.default {
1335
1054
  const {
1336
1055
  isOpen,
1337
1056
  isFocus
1338
- } = this.getStates(); // Under normal circumstances, blur will be accompanied by clickOutsideHandler, so the notify of blur can be called uniformly in clickOutsideHandler
1057
+ } = this.getStates();
1058
+ // Under normal circumstances, blur will be accompanied by clickOutsideHandler, so the notify of blur can be called uniformly in clickOutsideHandler
1339
1059
  // But when autoFocus or the panel is close, because clickOutsideHandler is not register or unregister, you need to listen for the trigger's blur and trigger the notify callback
1340
-
1341
1060
  if (isFocus && !isOpen) {
1342
1061
  this._notifyBlur(e);
1343
1062
  }
1344
1063
  }
1345
-
1346
1064
  handleInputBlur(e) {
1347
1065
  const {
1348
1066
  filter,
1349
1067
  autoFocus
1350
1068
  } = this.getProps();
1351
-
1352
1069
  const isMultiple = this._isMultiple();
1353
-
1354
1070
  if (autoFocus && filter && !isMultiple) {
1355
1071
  // under this condition, when input blur, hide the input
1356
1072
  this.toggle2SearchInput(false);
1357
1073
  }
1358
1074
  }
1359
-
1360
1075
  selectAll() {
1361
1076
  const {
1362
1077
  options
@@ -1365,23 +1080,18 @@ class SelectFoundation extends _foundation.default {
1365
1080
  onChangeWithObject
1366
1081
  } = this.getProps();
1367
1082
  let selectedValues = [];
1368
-
1369
1083
  const isMultiple = this._isMultiple();
1370
-
1371
1084
  if (!isMultiple) {
1372
1085
  console.warn(`[Semi Select]: It seems that you have called the selectAll method in the single-selection Select.
1373
1086
  Please note that this is not a legal way to use it`);
1374
1087
  return;
1375
1088
  }
1376
-
1377
1089
  if (onChangeWithObject) {
1378
1090
  selectedValues = options;
1379
1091
  } else {
1380
1092
  selectedValues = options.map(option => option.value);
1381
1093
  }
1382
-
1383
1094
  this.handleValueChange(selectedValues);
1384
-
1385
1095
  this._adapter.notifyChange(selectedValues);
1386
1096
  }
1387
1097
  /**
@@ -1389,8 +1099,6 @@ class SelectFoundation extends _foundation.default {
1389
1099
  * -defaultValue/value in multiple selection mode is array
1390
1100
  * @param {Object} props
1391
1101
  */
1392
-
1393
-
1394
1102
  checkMultipleProps(props) {
1395
1103
  if (this._isMultiple()) {
1396
1104
  const currentProps = props ? props : this.getProps();
@@ -1399,28 +1107,23 @@ class SelectFoundation extends _foundation.default {
1399
1107
  value
1400
1108
  } = currentProps;
1401
1109
  const selectedValues = value || defaultValue;
1402
-
1403
1110
  if (!(0, _isNullOrUndefined.default)(selectedValues) && !Array.isArray(selectedValues)) {
1404
1111
  /* istanbul ignore next */
1405
1112
  (0, _warning.default)(true, '[Semi Select] defaultValue/value should be array type in multiple mode');
1406
1113
  }
1407
1114
  }
1408
1115
  }
1409
-
1410
1116
  updateScrollTop() {
1411
1117
  this._adapter.updateScrollTop();
1412
1118
  }
1413
-
1414
1119
  updateOverflowItemCount(selectionLength, overFlowCount) {
1415
1120
  const {
1416
1121
  maxTagCount,
1417
1122
  ellipsisTrigger
1418
1123
  } = this.getProps();
1419
-
1420
1124
  if (!ellipsisTrigger) {
1421
1125
  return;
1422
1126
  }
1423
-
1424
1127
  if (overFlowCount) {
1425
1128
  this._adapter.updateOverflowItemCount(overFlowCount);
1426
1129
  } else if (typeof maxTagCount === 'number') {
@@ -1431,28 +1134,22 @@ class SelectFoundation extends _foundation.default {
1431
1134
  }
1432
1135
  }
1433
1136
  }
1434
-
1435
1137
  updateIsFullTags() {
1436
1138
  const {
1437
1139
  isFullTags
1438
1140
  } = this.getStates();
1439
-
1440
1141
  if (!isFullTags) {
1441
1142
  this._adapter.setState({
1442
1143
  isFullTags: true
1443
1144
  });
1444
1145
  }
1445
1146
  }
1446
-
1447
1147
  handlePopoverClose() {
1448
1148
  this._adapter.emit('popoverClose');
1449
- } // need to remove focus style of option when user hover slot
1450
-
1451
-
1149
+ }
1150
+ // need to remove focus style of option when user hover slot
1452
1151
  handleSlotMouseEnter() {
1453
1152
  this._adapter.updateFocusIndex(-1);
1454
1153
  }
1455
-
1456
1154
  }
1457
-
1458
1155
  exports.default = SelectFoundation;