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